@activepieces/piece-google-bigquery 0.0.5 → 0.0.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +30 -30
package/src/index.js CHANGED
@@ -1,59 +1,59 @@
1
- "use strict";var TT=Object.create;var mi=Object.defineProperty;var wT=Object.getOwnPropertyDescriptor;var xT=Object.getOwnPropertyNames;var AT=Object.getPrototypeOf,IT=Object.prototype.hasOwnProperty;var o=(t,e)=>mi(t,"name",{value:e,configurable:!0});var ct=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var M=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Ba=(t,e)=>{for(var r in e)mi(t,r,{get:e[r],enumerable:!0})},Zf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of xT(e))!IT.call(t,i)&&i!==r&&mi(t,i,{get:()=>e[i],enumerable:!(n=wT(e,i))||n.enumerable});return t};var gt=(t,e,r)=>(r=t!=null?TT(AT(t)):{},Zf(e||!t||!t.__esModule?mi(r,"default",{value:t,enumerable:!0}):r,t)),RT=t=>Zf(mi({},"__esModule",{value:!0}),t);var yh=M((gh,cs)=>{(function(t){"use strict";let e="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${e}\\.${e}\\.${e}\\.${e}$`,"i"),threeOctet:new RegExp(`^${e}\\.${e}\\.${e}$`,"i"),twoOctet:new RegExp(`^${e}\\.${e}$`,"i"),longValue:new RegExp(`^${e}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),u="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(u,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${u})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${u})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${e}\\.${e}\\.${e}\\.${e}(${u})?$`,"i")};function p(h,_){if(h.indexOf("::")!==h.lastIndexOf("::"))return null;let T=0,E=-1,w=(h.match(l.zoneIndex)||[])[0],k,q;for(w&&(w=w.substring(1),h=h.replace(/%.+$/,""));(E=h.indexOf(":",E+1))>=0;)T++;if(h.substr(0,2)==="::"&&T--,h.substr(-2,2)==="::"&&T--,T>_)return null;for(q=_-T,k=":";q--;)k+="0:";return h=h.replace("::",k),h[0]===":"&&(h=h.slice(1)),h[h.length-1]===":"&&(h=h.slice(0,-1)),_=(function(){let G=h.split(":"),V=[];for(let H=0;H<G.length;H++)V.push(parseInt(G[H],16));return V})(),{parts:_,zoneId:w}}o(p,"expandIPv6");function f(h,_,T,E){if(h.length!==_.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let w=0,k;for(;E>0;){if(k=T-E,k<0&&(k=0),h[w]>>k!==_[w]>>k)return!1;E-=T,w+=1}return!0}o(f,"matchCIDR");function m(h){if(i.test(h))return parseInt(h,16);if(h[0]==="0"&&!isNaN(parseInt(h[1],10))){if(n.test(h))return parseInt(h,8);throw new Error(`ipaddr: cannot parse ${h} as octal`)}return parseInt(h,10)}o(m,"parseIntAuto");function g(h,_){for(;h.length<_;)h=`0${h}`;return h}o(g,"padPart");let S={};S.IPv4=(function(){function h(_){if(_.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let T,E;for(T=0;T<_.length;T++)if(E=_[T],!(0<=E&&E<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=_}return o(h,"IPv4"),h.prototype.SpecialRanges={unspecified:[[new h([0,0,0,0]),8]],broadcast:[[new h([255,255,255,255]),32]],multicast:[[new h([224,0,0,0]),4]],linkLocal:[[new h([169,254,0,0]),16]],loopback:[[new h([127,0,0,0]),8]],carrierGradeNat:[[new h([100,64,0,0]),10]],private:[[new h([10,0,0,0]),8],[new h([172,16,0,0]),12],[new h([192,168,0,0]),16]],reserved:[[new h([192,0,0,0]),24],[new h([192,0,2,0]),24],[new h([192,88,99,0]),24],[new h([198,18,0,0]),15],[new h([198,51,100,0]),24],[new h([203,0,113,0]),24],[new h([240,0,0,0]),4]],as112:[[new h([192,175,48,0]),24],[new h([192,31,196,0]),24]],amt:[[new h([192,52,193,0]),24]]},h.prototype.kind=function(){return"ipv4"},h.prototype.match=function(_,T){let E;if(T===void 0&&(E=_,_=E[0],T=E[1]),_.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,_.octets,8,T)},h.prototype.prefixLengthFromSubnetMask=function(){let _=0,T=!1,E={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},w,k,q;for(w=3;w>=0;w-=1)if(k=this.octets[w],k in E){if(q=E[k],T&&q!==0)return null;q!==8&&(T=!0),_+=q}else return null;return 32-_},h.prototype.range=function(){return S.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){return this.octets.slice(0)},h.prototype.toIPv4MappedAddress=function(){return S.IPv6.parse(`::ffff:${this.toString()}`)},h.prototype.toNormalizedString=function(){return this.toString()},h.prototype.toString=function(){return this.octets.join(".")},h})(),S.IPv4.broadcastAddressFromCIDR=function(h){try{let _=this.parseCIDR(h),T=_[0].toByteArray(),E=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),w=[],k=0;for(;k<4;)w.push(parseInt(T[k],10)|parseInt(E[k],10)^255),k++;return new this(w)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},S.IPv4.isIPv4=function(h){return this.parser(h)!==null},S.IPv4.isValid=function(h){try{return new this(this.parser(h)),!0}catch{return!1}},S.IPv4.isValidCIDR=function(h){try{return this.parseCIDR(h),!0}catch{return!1}},S.IPv4.isValidFourPartDecimal=function(h){return!!(S.IPv4.isValid(h)&&h.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},S.IPv4.isValidCIDRFourPartDecimal=function(h){let _=h.match(/^(.+)\/(\d+)$/);return!S.IPv4.isValidCIDR(h)||!_?!1:S.IPv4.isValidFourPartDecimal(_[1])},S.IPv4.networkAddressFromCIDR=function(h){let _,T,E,w,k;try{for(_=this.parseCIDR(h),E=_[0].toByteArray(),k=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),w=[],T=0;T<4;)w.push(parseInt(E[T],10)&parseInt(k[T],10)),T++;return new this(w)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},S.IPv4.parse=function(h){let _=this.parser(h);if(_===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(_)},S.IPv4.parseCIDR=function(h){let _;if(_=h.match(/^(.+)\/(\d+)$/)){let T=parseInt(_[2]);if(T>=0&&T<=32){let E=[this.parse(_[1]),T];return Object.defineProperty(E,"toString",{value:o(function(){return this.join("/")},"value")}),E}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},S.IPv4.parser=function(h){let _,T,E;if(_=h.match(r.fourOctet))return(function(){let w=_.slice(1,6),k=[];for(let q=0;q<w.length;q++)T=w[q],k.push(m(T));return k})();if(_=h.match(r.longValue)){if(E=m(_[1]),E>4294967295||E<0)throw new Error("ipaddr: address outside defined range");return(function(){let w=[],k;for(k=0;k<=24;k+=8)w.push(E>>k&255);return w})().reverse()}else return(_=h.match(r.twoOctet))?(function(){let w=_.slice(1,4),k=[];if(E=m(w[1]),E>16777215||E<0)throw new Error("ipaddr: address outside defined range");return k.push(m(w[0])),k.push(E>>16&255),k.push(E>>8&255),k.push(E&255),k})():(_=h.match(r.threeOctet))?(function(){let w=_.slice(1,5),k=[];if(E=m(w[2]),E>65535||E<0)throw new Error("ipaddr: address outside defined range");return k.push(m(w[0])),k.push(m(w[1])),k.push(E>>8&255),k.push(E&255),k})():null},S.IPv4.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>32)throw new Error("ipaddr: invalid IPv4 prefix length");let _=[0,0,0,0],T=0,E=Math.floor(h/8);for(;T<E;)_[T]=255,T++;return E<4&&(_[E]=Math.pow(2,h%8)-1<<8-h%8),new this(_)},S.IPv6=(function(){function h(_,T){let E,w;if(_.length===16)for(this.parts=[],E=0;E<=14;E+=2)this.parts.push(_[E]<<8|_[E+1]);else if(_.length===8)this.parts=_;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(E=0;E<this.parts.length;E++)if(w=this.parts[E],!(0<=w&&w<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");T&&(this.zoneId=T)}return o(h,"IPv6"),h.prototype.SpecialRanges={unspecified:[new h([0,0,0,0,0,0,0,0]),128],linkLocal:[new h([65152,0,0,0,0,0,0,0]),10],multicast:[new h([65280,0,0,0,0,0,0,0]),8],loopback:[new h([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new h([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new h([0,0,0,0,0,65535,0,0]),96],discard:[new h([256,0,0,0,0,0,0,0]),64],rfc6145:[new h([0,0,0,0,65535,0,0,0]),96],rfc6052:[new h([100,65435,0,0,0,0,0,0]),96],"6to4":[new h([8194,0,0,0,0,0,0,0]),16],teredo:[new h([8193,0,0,0,0,0,0,0]),32],benchmarking:[new h([8193,2,0,0,0,0,0,0]),48],amt:[new h([8193,3,0,0,0,0,0,0]),32],as112v6:[[new h([8193,4,274,0,0,0,0,0]),48],[new h([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new h([8193,16,0,0,0,0,0,0]),28],orchid2:[new h([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new h([8193,48,0,0,0,0,0,0]),28],reserved:[[new h([8193,0,0,0,0,0,0,0]),23],[new h([8193,3512,0,0,0,0,0,0]),32]]},h.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},h.prototype.kind=function(){return"ipv6"},h.prototype.match=function(_,T){let E;if(T===void 0&&(E=_,_=E[0],T=E[1]),_.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,_.parts,16,T)},h.prototype.prefixLengthFromSubnetMask=function(){let _=0,T=!1,E={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},w,k;for(let q=7;q>=0;q-=1)if(w=this.parts[q],w in E){if(k=E[w],T&&k!==0)return null;k!==16&&(T=!0),_+=k}else return null;return 128-_},h.prototype.range=function(){return S.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){let _,T=[],E=this.parts;for(let w=0;w<E.length;w++)_=E[w],T.push(_>>8),T.push(_&255);return T},h.prototype.toFixedLengthString=function(){let _=(function(){let E=[];for(let w=0;w<this.parts.length;w++)E.push(g(this.parts[w].toString(16),4));return E}).call(this).join(":"),T="";return this.zoneId&&(T=`%${this.zoneId}`),_+T},h.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let _=this.parts.slice(-2),T=_[0],E=_[1];return new S.IPv4([T>>8,T&255,E>>8,E&255])},h.prototype.toNormalizedString=function(){let _=(function(){let E=[];for(let w=0;w<this.parts.length;w++)E.push(this.parts[w].toString(16));return E}).call(this).join(":"),T="";return this.zoneId&&(T=`%${this.zoneId}`),_+T},h.prototype.toRFC5952String=function(){let _=/((^|:)(0(:|$)){2,})/g,T=this.toNormalizedString(),E=0,w=-1,k;for(;k=_.exec(T);)k[0].length>w&&(E=k.index,w=k[0].length);return w<0?T:`${T.substring(0,E)}::${T.substring(E+w)}`},h.prototype.toString=function(){return this.toRFC5952String()},h})(),S.IPv6.broadcastAddressFromCIDR=function(h){try{let _=this.parseCIDR(h),T=_[0].toByteArray(),E=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),w=[],k=0;for(;k<16;)w.push(parseInt(T[k],10)|parseInt(E[k],10)^255),k++;return new this(w)}catch(_){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${_})`)}},S.IPv6.isIPv6=function(h){return this.parser(h)!==null},S.IPv6.isValid=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{let _=this.parser(h);return new this(_.parts,_.zoneId),!0}catch{return!1}},S.IPv6.isValidCIDR=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{return this.parseCIDR(h),!0}catch{return!1}},S.IPv6.networkAddressFromCIDR=function(h){let _,T,E,w,k;try{for(_=this.parseCIDR(h),E=_[0].toByteArray(),k=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),w=[],T=0;T<16;)w.push(parseInt(E[T],10)&parseInt(k[T],10)),T++;return new this(w)}catch(q){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${q})`)}},S.IPv6.parse=function(h){let _=this.parser(h);if(_.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(_.parts,_.zoneId)},S.IPv6.parseCIDR=function(h){let _,T,E;if((T=h.match(/^(.+)\/(\d+)$/))&&(_=parseInt(T[2]),_>=0&&_<=128))return E=[this.parse(T[1]),_],Object.defineProperty(E,"toString",{value:o(function(){return this.join("/")},"value")}),E;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},S.IPv6.parser=function(h){let _,T,E,w,k,q;if(E=h.match(l.deprecatedTransitional))return this.parser(`::ffff:${E[1]}`);if(l.native.test(h))return p(h,8);if((E=h.match(l.transitional))&&(q=E[6]||"",_=E[1],E[1].endsWith("::")||(_=_.slice(0,-1)),_=p(_+q,6),_.parts)){for(k=[parseInt(E[2]),parseInt(E[3]),parseInt(E[4]),parseInt(E[5])],T=0;T<k.length;T++)if(w=k[T],!(0<=w&&w<=255))return null;return _.parts.push(k[0]<<8|k[1]),_.parts.push(k[2]<<8|k[3]),{parts:_.parts,zoneId:_.zoneId}}return null},S.IPv6.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>128)throw new Error("ipaddr: invalid IPv6 prefix length");let _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],T=0,E=Math.floor(h/8);for(;T<E;)_[T]=255,T++;return E<16&&(_[E]=Math.pow(2,h%8)-1<<8-h%8),new this(_)},S.fromByteArray=function(h){let _=h.length;if(_===4)return new S.IPv4(h);if(_===16)return new S.IPv6(h);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},S.isValid=function(h){return S.IPv6.isValid(h)||S.IPv4.isValid(h)},S.isValidCIDR=function(h){return S.IPv6.isValidCIDR(h)||S.IPv4.isValidCIDR(h)},S.parse=function(h){if(S.IPv6.isValid(h))return S.IPv6.parse(h);if(S.IPv4.isValid(h))return S.IPv4.parse(h);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},S.parseCIDR=function(h){try{return S.IPv6.parseCIDR(h)}catch{try{return S.IPv4.parseCIDR(h)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},S.process=function(h){let _=this.parse(h);return _.kind()==="ipv6"&&_.isIPv4MappedAddress()?_.toIPv4Address():_},S.subnetMatch=function(h,_,T){let E,w,k,q;T==null&&(T="unicast");for(w in _)if(Object.prototype.hasOwnProperty.call(_,w)){for(k=_[w],k[0]&&!(k[0]instanceof Array)&&(k=[k]),E=0;E<k.length;E++)if(q=k[E],h.kind()===q[0].kind()&&h.match.apply(h,q))return w}return T},typeof cs<"u"&&cs.exports?cs.exports=S:t.ipaddr=S})(gh)});var yg=M((hH,gg)=>{var hg=require("stream").Stream,dA=require("util");gg.exports=hr;function hr(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}o(hr,"DelayedStream");dA.inherits(hr,hg);hr.create=function(t,e){var r=new this;e=e||{};for(var n in e)r[n]=e[n];r.source=t;var i=t.emit;return t.emit=function(){return r._handleEmit(arguments),i.apply(t,arguments)},t.on("error",function(){}),r.pauseStream&&t.pause(),r};Object.defineProperty(hr.prototype,"readable",{configurable:!0,enumerable:!0,get:o(function(){return this.source.readable},"get")});hr.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};hr.prototype.resume=function(){this._released||this.release(),this.source.resume()};hr.prototype.pause=function(){this.source.pause()};hr.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this)),this._bufferedEvents=[]};hr.prototype.pipe=function(){var t=hg.prototype.pipe.apply(this,arguments);return this.resume(),t};hr.prototype._handleEmit=function(t){if(this._released){this.emit.apply(this,t);return}t[0]==="data"&&(this.dataSize+=t[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(t)};hr.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(t))}}});var Eg=M((yH,vg)=>{var pA=require("util"),bg=require("stream").Stream,_g=yg();vg.exports=Xe;function Xe(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}o(Xe,"CombinedStream");pA.inherits(Xe,bg);Xe.create=function(t){var e=new this;t=t||{};for(var r in t)e[r]=t[r];return e};Xe.isStreamLike=function(t){return typeof t!="function"&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"&&!Buffer.isBuffer(t)};Xe.prototype.append=function(t){var e=Xe.isStreamLike(t);if(e){if(!(t instanceof _g)){var r=_g.create(t,{maxDataSize:1/0,pauseStream:this.pauseStreams});t.on("data",this._checkDataSize.bind(this)),t=r}this._handleErrors(t),this.pauseStreams&&t.pause()}return this._streams.push(t),this};Xe.prototype.pipe=function(t,e){return bg.prototype.pipe.call(this,t,e),this.resume(),t};Xe.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};Xe.prototype._realGetNext=function(){var t=this._streams.shift();if(typeof t>"u"){this.end();return}if(typeof t!="function"){this._pipeNext(t);return}var e=t;e(function(r){var n=Xe.isStreamLike(r);n&&(r.on("data",this._checkDataSize.bind(this)),this._handleErrors(r)),this._pipeNext(r)}.bind(this))};Xe.prototype._pipeNext=function(t){this._currentStream=t;var e=Xe.isStreamLike(t);if(e){t.on("end",this._getNext.bind(this)),t.pipe(this,{end:!1});return}var r=t;this.write(r),this._getNext()};Xe.prototype._handleErrors=function(t){var e=this;t.on("error",function(r){e._emitError(r)})};Xe.prototype.write=function(t){this.emit("data",t)};Xe.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};Xe.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function"&&this._currentStream.resume(),this.emit("resume")};Xe.prototype.end=function(){this._reset(),this.emit("end")};Xe.prototype.destroy=function(){this._reset(),this.emit("close")};Xe.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};Xe.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(t))}};Xe.prototype._updateDataSize=function(){this.dataSize=0;var t=this;this._streams.forEach(function(e){e.dataSize&&(t.dataSize+=e.dataSize)}),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)};Xe.prototype._emitError=function(t){this._reset(),this.emit("error",t)}});var Pg=M((bH,Sg)=>{"use strict";Sg.exports={"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dat"]},"application/msword":{source:"iana",extensions:["doc"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",extensions:["docx"]},"application/vnd.ms-excel":{source:"iana",extensions:["xls"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",extensions:["xlsx"]},"application/vnd.ms-powerpoint":{source:"iana",extensions:["ppt"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",extensions:["pptx"]},"application/csv":{compressible:!0,extensions:["csv"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"text/plain":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["txt","text","log"]},"text/html":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["html","htm"]},"text/css":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["css"]},"text/csv":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["csv"]},"text/markdown":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["md","markdown"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/webp":{source:"apache",compressible:!1,extensions:["webp"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tiff","tif"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/heic":{source:"iana",compressible:!1,extensions:["heic"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mp3","mpga"]},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/ogg":{source:"iana",compressible:!1,extensions:["ogg","oga"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","m4v"]},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg"]},"video/webm":{source:"iana",compressible:!1,extensions:["webm"]},"video/quicktime":{source:"iana",compressible:!1,extensions:["mov","qt"]},"video/x-msvideo":{source:"iana",compressible:!1,extensions:["avi"]},"font/woff":{source:"iana",compressible:!1,extensions:["woff"]},"font/woff2":{source:"iana",compressible:!1,extensions:["woff2"]},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"multipart/form-data":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/ics":{compressible:!0,extensions:["ics"]},"text/calendar":{source:"iana",compressible:!0,extensions:["ics","ifb"]},"application/x-ndjson":{compressible:!0,extensions:["ndjson"]}}});var xg=M(Ot=>{"use strict";var hs=Pg(),fA=require("path").extname,Tg=/^\s*([^;\s]*)(?:;|\s|$)/,mA=/^text\//i;Ot.charset=wg;Ot.charsets={lookup:wg};Ot.contentType=hA;Ot.extension=gA;Ot.extensions=Object.create(null);Ot.lookup=yA;Ot.types=Object.create(null);_A(Ot.extensions,Ot.types);function wg(t){if(!t||typeof t!="string")return!1;var e=Tg.exec(t),r=e&&hs[e[1].toLowerCase()];return r&&r.charset?r.charset:e&&mA.test(e[1])?"UTF-8":!1}o(wg,"charset");function hA(t){if(!t||typeof t!="string")return!1;var e=t.indexOf("/")===-1?Ot.lookup(t):t;if(!e)return!1;if(e.indexOf("charset")===-1){var r=Ot.charset(e);r&&(e+="; charset="+r.toLowerCase())}return e}o(hA,"contentType");function gA(t){if(!t||typeof t!="string")return!1;var e=Tg.exec(t),r=e&&Ot.extensions[e[1].toLowerCase()];return!r||!r.length?!1:r[0]}o(gA,"extension");function yA(t){if(!t||typeof t!="string")return!1;var e=fA("x."+t).toLowerCase().substr(1);return e&&Ot.types[e]||!1}o(yA,"lookup");function _A(t,e){var r=["nginx","apache",void 0,"iana"];Object.keys(hs).forEach(o(function(i){var u=hs[i],c=u.extensions;if(!(!c||!c.length)){t[i]=c;for(var l=0;l<c.length;l++){var p=c[l];if(e[p]){var f=r.indexOf(hs[e[p]].source),m=r.indexOf(u.source);if(e[p]!=="application/octet-stream"&&(f>m||f===m&&e[p].substr(0,12)==="application/"))continue}e[p]=i}}},"forEachMimeType"))}o(_A,"populateMaps")});var Ig=M((SH,Ag)=>{Ag.exports=bA;function bA(t){var e=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;e?e(t):setTimeout(t,0)}o(bA,"defer")});var nl=M((TH,Cg)=>{var Rg=Ig();Cg.exports=vA;function vA(t){var e=!1;return Rg(function(){e=!0}),o(function(n,i){e?t(n,i):Rg(o(function(){t(n,i)},"nextTick_callback"))},"async_callback")}o(vA,"async")});var ol=M((xH,Og)=>{Og.exports=EA;function EA(t){Object.keys(t.jobs).forEach(SA.bind(t)),t.jobs={}}o(EA,"abort");function SA(t){typeof this.jobs[t]=="function"&&this.jobs[t]()}o(SA,"clean")});var il=M((IH,$g)=>{var kg=nl(),PA=ol();$g.exports=TA;function TA(t,e,r,n){var i=r.keyedList?r.keyedList[r.index]:r.index;r.jobs[i]=wA(e,i,t[i],function(u,c){i in r.jobs&&(delete r.jobs[i],u?PA(r):r.results[i]=c,n(u,r.results))})}o(TA,"iterate");function wA(t,e,r,n){var i;return t.length==2?i=t(r,kg(n)):i=t(r,e,kg(n)),i}o(wA,"runJob")});var al=M((CH,Ng)=>{Ng.exports=xA;function xA(t,e){var r=!Array.isArray(t),n={index:0,keyedList:r||e?Object.keys(t):null,jobs:{},results:r?{}:[],size:r?Object.keys(t).length:t.length};return e&&n.keyedList.sort(r?e:function(i,u){return e(t[i],t[u])}),n}o(xA,"state")});var sl=M((kH,zg)=>{var AA=ol(),IA=nl();zg.exports=RA;function RA(t){Object.keys(this.jobs).length&&(this.index=this.size,AA(this),IA(t)(null,this.results))}o(RA,"terminator")});var Ug=M((NH,Dg)=>{var CA=il(),OA=al(),kA=sl();Dg.exports=$A;function $A(t,e,r){for(var n=OA(t);n.index<(n.keyedList||t).length;)CA(t,e,n,function(i,u){if(i){r(i,u);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}}),n.index++;return kA.bind(n,r)}o($A,"parallel")});var ul=M((DH,gs)=>{var jg=il(),NA=al(),zA=sl();gs.exports=DA;gs.exports.ascending=Mg;gs.exports.descending=UA;function DA(t,e,r,n){var i=NA(t,r);return jg(t,e,i,o(function u(c,l){if(c){n(c,l);return}if(i.index++,i.index<(i.keyedList||t).length){jg(t,e,i,u);return}n(null,i.results)},"iteratorHandler")),zA.bind(i,n)}o(DA,"serialOrdered");function Mg(t,e){return t<e?-1:t>e?1:0}o(Mg,"ascending");function UA(t,e){return-1*Mg(t,e)}o(UA,"descending")});var Fg=M((jH,Lg)=>{var jA=ul();Lg.exports=MA;function MA(t,e,r){return jA(t,e,null,r)}o(MA,"serial")});var qg=M((LH,Bg)=>{Bg.exports={parallel:Ug(),serial:Fg(),serialOrdered:ul()}});var cl=M((FH,Vg)=>{"use strict";Vg.exports=Object});var Gg=M((BH,Hg)=>{"use strict";Hg.exports=Error});var Zg=M((qH,Wg)=>{"use strict";Wg.exports=EvalError});var Kg=M((VH,Jg)=>{"use strict";Jg.exports=RangeError});var Yg=M((HH,Qg)=>{"use strict";Qg.exports=ReferenceError});var ey=M((GH,Xg)=>{"use strict";Xg.exports=SyntaxError});var ys=M((WH,ty)=>{"use strict";ty.exports=TypeError});var ny=M((ZH,ry)=>{"use strict";ry.exports=URIError});var iy=M((JH,oy)=>{"use strict";oy.exports=Math.abs});var sy=M((KH,ay)=>{"use strict";ay.exports=Math.floor});var cy=M((QH,uy)=>{"use strict";uy.exports=Math.max});var dy=M((YH,ly)=>{"use strict";ly.exports=Math.min});var fy=M((XH,py)=>{"use strict";py.exports=Math.pow});var hy=M((eG,my)=>{"use strict";my.exports=Math.round});var yy=M((tG,gy)=>{"use strict";gy.exports=Number.isNaN||o(function(e){return e!==e},"isNaN")});var by=M((nG,_y)=>{"use strict";var LA=yy();_y.exports=o(function(e){return LA(e)||e===0?e:e<0?-1:1},"sign")});var Ey=M((iG,vy)=>{"use strict";vy.exports=Object.getOwnPropertyDescriptor});var ll=M((aG,Sy)=>{"use strict";var _s=Ey();if(_s)try{_s([],"length")}catch{_s=null}Sy.exports=_s});var Ty=M((sG,Py)=>{"use strict";var bs=Object.defineProperty||!1;if(bs)try{bs({},"a",{value:1})}catch{bs=!1}Py.exports=bs});var dl=M((uG,wy)=>{"use strict";wy.exports=o(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(var u in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var c=Object.getOwnPropertySymbols(e);if(c.length!==1||c[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(e,r);if(l.value!==i||l.enumerable!==!0)return!1}return!0},"hasSymbols")});var Iy=M((lG,Ay)=>{"use strict";var xy=typeof Symbol<"u"&&Symbol,FA=dl();Ay.exports=o(function(){return typeof xy!="function"||typeof Symbol!="function"||typeof xy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:FA()},"hasNativeSymbols")});var pl=M((pG,Ry)=>{"use strict";Ry.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var fl=M((fG,Cy)=>{"use strict";var BA=cl();Cy.exports=BA.getPrototypeOf||null});var $y=M((mG,ky)=>{"use strict";var qA="Function.prototype.bind called on incompatible ",VA=Object.prototype.toString,HA=Math.max,GA="[object Function]",Oy=o(function(e,r){for(var n=[],i=0;i<e.length;i+=1)n[i]=e[i];for(var u=0;u<r.length;u+=1)n[u+e.length]=r[u];return n},"concatty"),WA=o(function(e,r){for(var n=[],i=r||0,u=0;i<e.length;i+=1,u+=1)n[u]=e[i];return n},"slicy"),ZA=o(function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r},"joiny");ky.exports=o(function(e){var r=this;if(typeof r!="function"||VA.apply(r)!==GA)throw new TypeError(qA+r);for(var n=WA(arguments,1),i,u=o(function(){if(this instanceof i){var m=r.apply(this,Oy(n,arguments));return Object(m)===m?m:this}return r.apply(e,Oy(n,arguments))},"binder"),c=HA(0,r.length-n.length),l=[],p=0;p<c;p++)l[p]="$"+p;if(i=Function("binder","return function ("+ZA(l,",")+"){ return binder.apply(this,arguments); }")(u),r.prototype){var f=o(function(){},"Empty");f.prototype=r.prototype,i.prototype=new f,f.prototype=null}return i},"bind")});var xo=M((gG,Ny)=>{"use strict";var JA=$y();Ny.exports=Function.prototype.bind||JA});var vs=M((yG,zy)=>{"use strict";zy.exports=Function.prototype.call});var ml=M((_G,Dy)=>{"use strict";Dy.exports=Function.prototype.apply});var jy=M((bG,Uy)=>{"use strict";Uy.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Ly=M((vG,My)=>{"use strict";var KA=xo(),QA=ml(),YA=vs(),XA=jy();My.exports=XA||KA.call(YA,QA)});var By=M((EG,Fy)=>{"use strict";var eI=xo(),tI=ys(),rI=vs(),nI=Ly();Fy.exports=o(function(e){if(e.length<1||typeof e[0]!="function")throw new tI("a function is required");return nI(eI,rI,e)},"callBindBasic")});var Zy=M((PG,Wy)=>{"use strict";var oI=By(),qy=ll(),Hy;try{Hy=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var hl=!!Hy&&qy&&qy(Object.prototype,"__proto__"),Gy=Object,Vy=Gy.getPrototypeOf;Wy.exports=hl&&typeof hl.get=="function"?oI([hl.get]):typeof Vy=="function"?o(function(e){return Vy(e==null?e:Gy(e))},"getDunder"):!1});var Xy=M((wG,Yy)=>{"use strict";var Jy=pl(),Ky=fl(),Qy=Zy();Yy.exports=Jy?o(function(e){return Jy(e)},"getProto"):Ky?o(function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return Ky(e)},"getProto"):Qy?o(function(e){return Qy(e)},"getProto"):null});var gl=M((AG,e_)=>{"use strict";var iI=Function.prototype.call,aI=Object.prototype.hasOwnProperty,sI=xo();e_.exports=sI.call(iI,aI)});var s_=M((IG,a_)=>{"use strict";var Te,uI=cl(),cI=Gg(),lI=Zg(),dI=Kg(),pI=Yg(),Co=ey(),Ro=ys(),fI=ny(),mI=iy(),hI=sy(),gI=cy(),yI=dy(),_I=fy(),bI=hy(),vI=by(),o_=Function,yl=o(function(t){try{return o_('"use strict"; return ('+t+").constructor;")()}catch{}},"getEvalledConstructor"),Di=ll(),EI=Ty(),_l=o(function(){throw new Ro},"throwTypeError"),SI=Di?(function(){try{return arguments.callee,_l}catch{try{return Di(arguments,"callee").get}catch{return _l}}})():_l,Ao=Iy()(),lt=Xy(),PI=fl(),TI=pl(),i_=ml(),Ui=vs(),Io={},wI=typeof Uint8Array>"u"||!lt?Te:lt(Uint8Array),Vn={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Te:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Te:ArrayBuffer,"%ArrayIteratorPrototype%":Ao&&lt?lt([][Symbol.iterator]()):Te,"%AsyncFromSyncIteratorPrototype%":Te,"%AsyncFunction%":Io,"%AsyncGenerator%":Io,"%AsyncGeneratorFunction%":Io,"%AsyncIteratorPrototype%":Io,"%Atomics%":typeof Atomics>"u"?Te:Atomics,"%BigInt%":typeof BigInt>"u"?Te:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Te:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Te:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Te:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":cI,"%eval%":eval,"%EvalError%":lI,"%Float16Array%":typeof Float16Array>"u"?Te:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Te:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Te:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Te:FinalizationRegistry,"%Function%":o_,"%GeneratorFunction%":Io,"%Int8Array%":typeof Int8Array>"u"?Te:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Te:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Te:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ao&&lt?lt(lt([][Symbol.iterator]())):Te,"%JSON%":typeof JSON=="object"?JSON:Te,"%Map%":typeof Map>"u"?Te:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ao||!lt?Te:lt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":uI,"%Object.getOwnPropertyDescriptor%":Di,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Te:Promise,"%Proxy%":typeof Proxy>"u"?Te:Proxy,"%RangeError%":dI,"%ReferenceError%":pI,"%Reflect%":typeof Reflect>"u"?Te:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Te:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ao||!lt?Te:lt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Te:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ao&&lt?lt(""[Symbol.iterator]()):Te,"%Symbol%":Ao?Symbol:Te,"%SyntaxError%":Co,"%ThrowTypeError%":SI,"%TypedArray%":wI,"%TypeError%":Ro,"%Uint8Array%":typeof Uint8Array>"u"?Te:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Te:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Te:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Te:Uint32Array,"%URIError%":fI,"%WeakMap%":typeof WeakMap>"u"?Te:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Te:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Te:WeakSet,"%Function.prototype.call%":Ui,"%Function.prototype.apply%":i_,"%Object.defineProperty%":EI,"%Object.getPrototypeOf%":PI,"%Math.abs%":mI,"%Math.floor%":hI,"%Math.max%":gI,"%Math.min%":yI,"%Math.pow%":_I,"%Math.round%":bI,"%Math.sign%":vI,"%Reflect.getPrototypeOf%":TI};if(lt)try{null.error}catch(t){t_=lt(lt(t)),Vn["%Error.prototype%"]=t_}var t_,xI=o(function t(e){var r;if(e==="%AsyncFunction%")r=yl("async function () {}");else if(e==="%GeneratorFunction%")r=yl("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=yl("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&lt&&(r=lt(i.prototype))}return Vn[e]=r,r},"doEval"),r_={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ji=xo(),Es=gl(),AI=ji.call(Ui,Array.prototype.concat),II=ji.call(i_,Array.prototype.splice),n_=ji.call(Ui,String.prototype.replace),Ss=ji.call(Ui,String.prototype.slice),RI=ji.call(Ui,RegExp.prototype.exec),CI=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,OI=/\\(\\)?/g,kI=o(function(e){var r=Ss(e,0,1),n=Ss(e,-1);if(r==="%"&&n!=="%")throw new Co("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Co("invalid intrinsic syntax, expected opening `%`");var i=[];return n_(e,CI,function(u,c,l,p){i[i.length]=l?n_(p,OI,"$1"):c||u}),i},"stringToPath"),$I=o(function(e,r){var n=e,i;if(Es(r_,n)&&(i=r_[n],n="%"+i[0]+"%"),Es(Vn,n)){var u=Vn[n];if(u===Io&&(u=xI(n)),typeof u>"u"&&!r)throw new Ro("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:u}}throw new Co("intrinsic "+e+" does not exist!")},"getBaseIntrinsic");a_.exports=o(function(e,r){if(typeof e!="string"||e.length===0)throw new Ro("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Ro('"allowMissing" argument must be a boolean');if(RI(/^%?[^%]*%?$/,e)===null)throw new Co("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=kI(e),i=n.length>0?n[0]:"",u=$I("%"+i+"%",r),c=u.name,l=u.value,p=!1,f=u.alias;f&&(i=f[0],II(n,AI([0,1],f)));for(var m=1,g=!0;m<n.length;m+=1){var S=n[m],h=Ss(S,0,1),_=Ss(S,-1);if((h==='"'||h==="'"||h==="`"||_==='"'||_==="'"||_==="`")&&h!==_)throw new Co("property names with quotes must have matching quotes");if((S==="constructor"||!g)&&(p=!0),i+="."+S,c="%"+i+"%",Es(Vn,c))l=Vn[c];else if(l!=null){if(!(S in l)){if(!r)throw new Ro("base intrinsic for "+e+" exists, but the property is not available.");return}if(Di&&m+1>=n.length){var T=Di(l,S);g=!!T,g&&"get"in T&&!("originalValue"in T.get)?l=T.get:l=l[S]}else g=Es(l,S),l=l[S];g&&!p&&(Vn[c]=l)}}return l},"GetIntrinsic")});var c_=M((CG,u_)=>{"use strict";var NI=dl();u_.exports=o(function(){return NI()&&!!Symbol.toStringTag},"hasToStringTagShams")});var p_=M((kG,d_)=>{"use strict";var zI=s_(),l_=zI("%Object.defineProperty%",!0),DI=c_()(),UI=gl(),jI=ys(),Ps=DI?Symbol.toStringTag:null;d_.exports=o(function(e,r){var n=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof n<"u"&&typeof n!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new jI("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Ps&&(n||!UI(e,Ps))&&(l_?l_(e,Ps,{configurable:!i,enumerable:!1,value:r,writable:!1}):e[Ps]=r)},"setToStringTag")});var m_=M((NG,f_)=>{"use strict";var MI=Function.prototype.call,LI=Object.prototype.hasOwnProperty,FI=xo();f_.exports=FI.call(MI,LI)});var g_=M((zG,h_)=>{"use strict";h_.exports=function(t,e){return Object.keys(e).forEach(function(r){t[r]=t[r]||e[r]}),t}});var b_=M((DG,__)=>{"use strict";var Sl=Eg(),BI=require("util"),bl=require("path"),qI=require("http"),VI=require("https"),HI=require("url").parse,GI=require("fs"),WI=require("stream").Stream,ZI=require("crypto"),vl=xg(),JI=qg(),KI=p_(),Tn=m_(),El=g_();function y_(t){return String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}o(y_,"escapeHeaderParam");function Ce(t){if(!(this instanceof Ce))return new Ce(t);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],Sl.call(this),t=t||{};for(var e in t)this[e]=t[e]}o(Ce,"FormData");BI.inherits(Ce,Sl);Ce.LINE_BREAK=`\r
2
- `;Ce.DEFAULT_CONTENT_TYPE="application/octet-stream";Ce.prototype.append=function(t,e,r){r=r||{},typeof r=="string"&&(r={filename:r});var n=Sl.prototype.append.bind(this);if((typeof e=="number"||e==null)&&(e=String(e)),Array.isArray(e)){this._error(new Error("Arrays are not supported."));return}var i=this._multiPartHeader(t,e,r),u=this._multiPartFooter();n(i),n(e),n(u),this._trackLength(i,e,r)};Ce.prototype._trackLength=function(t,e,r){var n=0;r.knownLength!=null?n+=Number(r.knownLength):Buffer.isBuffer(e)?n=e.length:typeof e=="string"&&(n=Buffer.byteLength(e)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(t)+Ce.LINE_BREAK.length,!(!e||!e.path&&!(e.readable&&Tn(e,"httpVersion"))&&!(e instanceof WI))&&(r.knownLength||this._valuesToMeasure.push(e))};Ce.prototype._lengthRetriever=function(t,e){Tn(t,"fd")?t.end!=null&&t.end!=1/0&&t.start!=null?e(null,t.end+1-(t.start?t.start:0)):GI.stat(t.path,function(r,n){if(r){e(r);return}var i=n.size-(t.start?t.start:0);e(null,i)}):Tn(t,"httpVersion")?e(null,Number(t.headers["content-length"])):Tn(t,"httpModule")?(t.on("response",function(r){t.pause(),e(null,Number(r.headers["content-length"]))}),t.resume()):e("Unknown stream")};Ce.prototype._multiPartHeader=function(t,e,r){if(typeof r.header=="string")return r.header;var n=this._getContentDisposition(e,r),i=this._getContentType(e,r),u="",c={"Content-Disposition":["form-data",'name="'+y_(t)+'"'].concat(n||[]),"Content-Type":[].concat(i||[])};typeof r.header=="object"&&El(c,r.header);var l;for(var p in c)if(Tn(c,p)){if(l=c[p],l==null)continue;Array.isArray(l)||(l=[l]),l.length&&(u+=p+": "+l.join("; ")+Ce.LINE_BREAK)}return"--"+this.getBoundary()+Ce.LINE_BREAK+u+Ce.LINE_BREAK};Ce.prototype._getContentDisposition=function(t,e){var r;if(typeof e.filepath=="string"?r=bl.normalize(e.filepath).replace(/\\/g,"/"):e.filename||t&&(t.name||t.path)?r=bl.basename(e.filename||t&&(t.name||t.path)):t&&t.readable&&Tn(t,"httpVersion")&&(r=bl.basename(t.client._httpMessage.path||"")),r)return'filename="'+y_(r)+'"'};Ce.prototype._getContentType=function(t,e){var r=e.contentType;return!r&&t&&t.name&&(r=vl.lookup(t.name)),!r&&t&&t.path&&(r=vl.lookup(t.path)),!r&&t&&t.readable&&Tn(t,"httpVersion")&&(r=t.headers["content-type"]),!r&&(e.filepath||e.filename)&&(r=vl.lookup(e.filepath||e.filename)),!r&&t&&typeof t=="object"&&(r=Ce.DEFAULT_CONTENT_TYPE),r};Ce.prototype._multiPartFooter=function(){return function(t){var e=Ce.LINE_BREAK,r=this._streams.length===0;r&&(e+=this._lastBoundary()),t(e)}.bind(this)};Ce.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+Ce.LINE_BREAK};Ce.prototype.getHeaders=function(t){var e,r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(e in t)Tn(t,e)&&(r[e.toLowerCase()]=t[e]);return r};Ce.prototype.setBoundary=function(t){if(typeof t!="string")throw new TypeError("FormData boundary must be a string");this._boundary=t};Ce.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};Ce.prototype.getBuffer=function(){for(var t=new Buffer.alloc(0),e=this.getBoundary(),r=0,n=this._streams.length;r<n;r++)typeof this._streams[r]!="function"&&(Buffer.isBuffer(this._streams[r])?t=Buffer.concat([t,this._streams[r]]):t=Buffer.concat([t,Buffer.from(this._streams[r])]),(typeof this._streams[r]!="string"||this._streams[r].substring(2,e.length+2)!==e)&&(t=Buffer.concat([t,Buffer.from(Ce.LINE_BREAK)])));return Buffer.concat([t,Buffer.from(this._lastBoundary())])};Ce.prototype._generateBoundary=function(){this._boundary="--------------------------"+ZI.randomBytes(12).toString("hex")};Ce.prototype.getLengthSync=function(){var t=this._overheadLength+this._valueLength;return this._streams.length&&(t+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),t};Ce.prototype.hasKnownLength=function(){var t=!0;return this._valuesToMeasure.length&&(t=!1),t};Ce.prototype.getLength=function(t){var e=this._overheadLength+this._valueLength;if(this._streams.length&&(e+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(t.bind(this,null,e));return}JI.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){t(r);return}n.forEach(function(i){e+=i}),t(null,e)})};Ce.prototype.submit=function(t,e){var r,n,i={method:"post"};return typeof t=="string"?(t=HI(t),n=El({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},i)):(n=El(t,i),n.port||(n.port=n.protocol==="https:"?443:80)),n.headers=this.getHeaders(t.headers),n.protocol==="https:"?r=VI.request(n):r=qI.request(n),this.getLength(function(u,c){if(u&&u!=="Unknown stream"){this._error(u);return}if(c&&r.setHeader("Content-Length",c),this.pipe(r),e){var l,p=o(function(f,m){return r.removeListener("error",p),r.removeListener("response",l),e.call(this,f,m)},"callback");l=p.bind(this,null),r.on("error",p),r.on("response",l)}}.bind(this)),r};Ce.prototype._error=function(t){this.error||(this.error=t,this.pause(),this.emit("error",t))};Ce.prototype.toString=function(){return"[object FormData]"};KI(Ce.prototype,"FormData");__.exports=Ce});var Pl=M((oW,R_)=>{"use strict";var Ts=Object.prototype.hasOwnProperty,I_=Object.prototype.toString,S_=Object.defineProperty,P_=Object.getOwnPropertyDescriptor,T_=o(function(e){return typeof Array.isArray=="function"?Array.isArray(e):I_.call(e)==="[object Array]"},"isArray"),w_=o(function(e){if(!e||I_.call(e)!=="[object Object]")return!1;var r=Ts.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&Ts.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;var i;for(i in e);return typeof i>"u"||Ts.call(e,i)},"isPlainObject"),x_=o(function(e,r){S_&&r.name==="__proto__"?S_(e,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):e[r.name]=r.newValue},"setProperty"),A_=o(function(e,r){if(r==="__proto__")if(Ts.call(e,r)){if(P_)return P_(e,r).value}else return;return e[r]},"getProperty");R_.exports=o(function t(){var e,r,n,i,u,c,l=arguments[0],p=1,f=arguments.length,m=!1;for(typeof l=="boolean"&&(m=l,l=arguments[1]||{},p=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});p<f;++p)if(e=arguments[p],e!=null)for(r in e)n=A_(l,r),i=A_(e,r),l!==i&&(m&&i&&(w_(i)||(u=T_(i)))?(u?(u=!1,c=n&&T_(n)?n:[]):c=n&&w_(n)?n:{},x_(l,{name:r,newValue:t(m,c,i)})):typeof i<"u"&&x_(l,{name:r,newValue:i}));return l},"extend")});var C_=M((aW,iR)=>{iR.exports={name:"gaxios",version:"7.1.3",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"packages/gaxios",url:"https://github.com/googleapis/google-cloud-node-core.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.1","@types/node":"^22.0.0","@types/sinon":"^17.0.0","@types/tmp":"0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.0.0",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.0","is-docker":"^3.0.0",jsdoc:"^4.0.0","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",linkinator:"^6.1.2",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.0-beta.13","null-loader":"^4.0.0","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","stream-browserify":"^3.0.0",tmp:"0.2.5","ts-loader":"^9.5.2",typescript:"^5.8.3",webpack:"^5.35.0","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2",rimraf:"^5.0.1"},homepage:"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/gaxios"}});var k_=M((sW,O_)=>{"use strict";var aR=C_();O_.exports={pkg:aR}});var xl=M(rr=>{"use strict";var N_=rr&&rr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rr,"__esModule",{value:!0});rr.GaxiosError=rr.GAXIOS_ERROR_SYMBOL=void 0;rr.defaultErrorRedactor=z_;var $_=N_(Pl()),sR=N_(k_()),Tl=sR.default.pkg;rr.GAXIOS_ERROR_SYMBOL=Symbol.for(`${Tl.name}-gaxios-error`);var wl=class t extends Error{static{o(this,"GaxiosError")}config;response;code;status;error;[rr.GAXIOS_ERROR_SYMBOL]=Tl.version;static[Symbol.hasInstance](e){return e&&typeof e=="object"&&rr.GAXIOS_ERROR_SYMBOL in e&&e[rr.GAXIOS_ERROR_SYMBOL]===Tl.version?!0:Function.prototype[Symbol.hasInstance].call(t,e)}constructor(e,r,n,i){if(super(e,{cause:i}),this.config=r,this.response=n,this.error=i instanceof Error?i:void 0,this.config=(0,$_.default)(!0,{},r),this.response&&(this.response.config=(0,$_.default)(!0,{},this.response.config)),this.response){try{this.response.data=uR(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}i instanceof DOMException?this.code=i.name:i&&typeof i=="object"&&"code"in i&&(typeof i.code=="string"||typeof i.code=="number")&&(this.code=i.code)}static extractAPIErrorFromResponse(e,r="The request failed"){let n=r;if(typeof e.data=="string"&&(n=e.data),e.data&&typeof e.data=="object"&&"error"in e.data&&e.data.error&&!e.ok){if(typeof e.data.error=="string")return{message:e.data.error,code:e.status,status:e.statusText};if(typeof e.data.error=="object"){n="message"in e.data.error&&typeof e.data.error.message=="string"?e.data.error.message:n;let i="status"in e.data.error&&typeof e.data.error.status=="string"?e.data.error.status:e.statusText,u="code"in e.data.error&&typeof e.data.error.code=="number"?e.data.error.code:e.status;if("errors"in e.data.error&&Array.isArray(e.data.error.errors)){let c=[];for(let l of e.data.error.errors)typeof l=="object"&&"message"in l&&typeof l.message=="string"&&c.push(l.message);return Object.assign({message:c.join(`
3
- `)||n,code:u,status:i},e.data.error)}return Object.assign({message:n,code:u,status:i},e.data.error)}}return{message:n,code:e.status,status:e.statusText}}};rr.GaxiosError=wl;function uR(t,e){switch(t){case"stream":return e;case"json":return JSON.parse(JSON.stringify(e));case"arraybuffer":return JSON.parse(Buffer.from(e).toString("utf8"));case"blob":return JSON.parse(e.text());default:return e}}o(uR,"translateData");function z_(t){let e="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";function r(u){u&&u.forEach((c,l)=>{(/^authentication$/i.test(l)||/^authorization$/i.test(l)||/secret/i.test(l))&&u.set(l,e)})}o(r,"redactHeaders");function n(u,c){if(typeof u=="object"&&u!==null&&typeof u[c]=="string"){let l=u[c];(/grant_type=/i.test(l)||/assertion=/i.test(l)||/secret/i.test(l))&&(u[c]=e)}}o(n,"redactString");function i(u){!u||typeof u!="object"||(u instanceof FormData||u instanceof URLSearchParams||"forEach"in u&&"set"in u?u.forEach((c,l)=>{(["grant_type","assertion"].includes(l)||/secret/.test(l))&&u.set(l,e)}):("grant_type"in u&&(u.grant_type=e),"assertion"in u&&(u.assertion=e),"client_secret"in u&&(u.client_secret=e)))}return o(i,"redactObject"),t.config&&(r(t.config.headers),n(t.config,"data"),i(t.config.data),n(t.config,"body"),i(t.config.body),t.config.url.searchParams.has("token")&&t.config.url.searchParams.set("token",e),t.config.url.searchParams.has("client_secret")&&t.config.url.searchParams.set("client_secret",e)),t.response&&(z_({config:t.response.config}),r(t.response.headers),t.response.bodyUsed&&(n(t.response,"data"),i(t.response.data))),t}o(z_,"defaultErrorRedactor")});var U_=M(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.getRetryConfig=cR;async function cR(t){let e=D_(t);if(!t||!t.config||!e&&!t.config.retry)return{shouldRetry:!1};e=e||{},e.currentRetryAttempt=e.currentRetryAttempt||0,e.retry=e.retry===void 0||e.retry===null?3:e.retry,e.httpMethodsToRetry=e.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],e.noResponseRetries=e.noResponseRetries===void 0||e.noResponseRetries===null?2:e.noResponseRetries,e.retryDelayMultiplier=e.retryDelayMultiplier?e.retryDelayMultiplier:2,e.timeOfFirstRequest=e.timeOfFirstRequest?e.timeOfFirstRequest:Date.now(),e.totalTimeout=e.totalTimeout?e.totalTimeout:Number.MAX_SAFE_INTEGER,e.maxRetryDelay=e.maxRetryDelay?e.maxRetryDelay:Number.MAX_SAFE_INTEGER;let r=[[100,199],[408,408],[429,429],[500,599]];if(e.statusCodesToRetry=e.statusCodesToRetry||r,t.config.retryConfig=e,!await(e.shouldRetry||lR)(t))return{shouldRetry:!1,config:t.config};let i=dR(e);t.config.retryConfig.currentRetryAttempt+=1;let u=e.retryBackoff?e.retryBackoff(t,i):new Promise(c=>{setTimeout(c,i)});return e.onRetryAttempt&&await e.onRetryAttempt(t),await u,{shouldRetry:!0,config:t.config}}o(cR,"getRetryConfig");function lR(t){let e=D_(t);if(t.config.signal?.aborted&&t.code!=="TimeoutError"||t.code==="AbortError"||!e||e.retry===0||!t.response&&(e.currentRetryAttempt||0)>=e.noResponseRetries||!e.httpMethodsToRetry||!e.httpMethodsToRetry.includes(t.config.method?.toUpperCase()||"GET"))return!1;if(t.response&&t.response.status){let r=!1;for(let[n,i]of e.statusCodesToRetry){let u=t.response.status;if(u>=n&&u<=i){r=!0;break}}if(!r)return!1}return e.currentRetryAttempt=e.currentRetryAttempt||0,!(e.currentRetryAttempt>=e.retry)}o(lR,"shouldRetryRequest");function D_(t){if(t&&t.config&&t.config.retryConfig)return t.config.retryConfig}o(D_,"getConfig");function dR(t){let r=(t.currentRetryAttempt?0:t.retryDelay??100)+(Math.pow(t.retryDelayMultiplier,t.currentRetryAttempt)-1)/2*1e3,n=t.totalTimeout-(Date.now()-t.timeOfFirstRequest);return Math.min(r,n,t.maxRetryDelay)}o(dR,"getNextRetryDelay")});var Rl=M(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.GaxiosInterceptorManager=void 0;var Il=class extends Set{static{o(this,"GaxiosInterceptorManager")}};ws.GaxiosInterceptorManager=Il});var M_=M((mW,j_)=>{var Oo=1e3,ko=Oo*60,$o=ko*60,Hn=$o*24,pR=Hn*7,fR=Hn*365.25;j_.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return mR(t);if(r==="number"&&isFinite(t))return e.long?gR(t):hR(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function mR(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*fR;case"weeks":case"week":case"w":return r*pR;case"days":case"day":case"d":return r*Hn;case"hours":case"hour":case"hrs":case"hr":case"h":return r*$o;case"minutes":case"minute":case"mins":case"min":case"m":return r*ko;case"seconds":case"second":case"secs":case"sec":case"s":return r*Oo;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}o(mR,"parse");function hR(t){var e=Math.abs(t);return e>=Hn?Math.round(t/Hn)+"d":e>=$o?Math.round(t/$o)+"h":e>=ko?Math.round(t/ko)+"m":e>=Oo?Math.round(t/Oo)+"s":t+"ms"}o(hR,"fmtShort");function gR(t){var e=Math.abs(t);return e>=Hn?xs(t,e,Hn,"day"):e>=$o?xs(t,e,$o,"hour"):e>=ko?xs(t,e,ko,"minute"):e>=Oo?xs(t,e,Oo,"second"):t+" ms"}o(gR,"fmtLong");function xs(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}o(xs,"plural")});var Cl=M((gW,L_)=>{function yR(t){r.debug=r,r.default=r,r.coerce=p,r.disable=c,r.enable=i,r.enabled=l,r.humanize=M_(),r.destroy=f,Object.keys(t).forEach(m=>{r[m]=t[m]}),r.names=[],r.skips=[],r.formatters={};function e(m){let g=0;for(let S=0;S<m.length;S++)g=(g<<5)-g+m.charCodeAt(S),g|=0;return r.colors[Math.abs(g)%r.colors.length]}o(e,"selectColor"),r.selectColor=e;function r(m){let g,S=null,h,_;function T(...E){if(!T.enabled)return;let w=T,k=Number(new Date),q=k-(g||k);w.diff=q,w.prev=g,w.curr=k,g=k,E[0]=r.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let G=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(H,J)=>{if(H==="%%")return"%";G++;let re=r.formatters[J];if(typeof re=="function"){let Z=E[G];H=re.call(w,Z),E.splice(G,1),G--}return H}),r.formatArgs.call(w,E),(w.log||r.log).apply(w,E)}return o(T,"debug"),T.namespace=m,T.useColors=r.useColors(),T.color=r.selectColor(m),T.extend=n,T.destroy=r.destroy,Object.defineProperty(T,"enabled",{enumerable:!0,configurable:!1,get:o(()=>S!==null?S:(h!==r.namespaces&&(h=r.namespaces,_=r.enabled(m)),_),"get"),set:o(E=>{S=E},"set")}),typeof r.init=="function"&&r.init(T),T}o(r,"createDebug");function n(m,g){let S=r(this.namespace+(typeof g>"u"?":":g)+m);return S.log=this.log,S}o(n,"extend");function i(m){r.save(m),r.namespaces=m,r.names=[],r.skips=[];let g=(typeof m=="string"?m:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let S of g)S[0]==="-"?r.skips.push(S.slice(1)):r.names.push(S)}o(i,"enable");function u(m,g){let S=0,h=0,_=-1,T=0;for(;S<m.length;)if(h<g.length&&(g[h]===m[S]||g[h]==="*"))g[h]==="*"?(_=h,T=S,h++):(S++,h++);else if(_!==-1)h=_+1,T++,S=T;else return!1;for(;h<g.length&&g[h]==="*";)h++;return h===g.length}o(u,"matchesTemplate");function c(){let m=[...r.names,...r.skips.map(g=>"-"+g)].join(",");return r.enable(""),m}o(c,"disable");function l(m){for(let g of r.skips)if(u(m,g))return!1;for(let g of r.names)if(u(m,g))return!0;return!1}o(l,"enabled");function p(m){return m instanceof Error?m.stack||m.message:m}o(p,"coerce");function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return o(f,"destroy"),r.enable(r.load()),r}o(yR,"setup");L_.exports=yR});var F_=M((kt,As)=>{kt.formatArgs=bR;kt.save=vR;kt.load=ER;kt.useColors=_R;kt.storage=SR();kt.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();kt.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function _R(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}o(_R,"useColors");function bR(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+As.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),t.splice(n,0,e)}o(bR,"formatArgs");kt.log=console.debug||console.log||(()=>{});function vR(t){try{t?kt.storage.setItem("debug",t):kt.storage.removeItem("debug")}catch{}}o(vR,"save");function ER(){let t;try{t=kt.storage.getItem("debug")||kt.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}o(ER,"load");function SR(){try{return localStorage}catch{}}o(SR,"localstorage");As.exports=Cl()(kt);var{formatters:PR}=As.exports;PR.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var q_=M((bW,B_)=>{"use strict";B_.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),i=e.indexOf("--");return n!==-1&&(i===-1||n<i)}});var G_=M((vW,H_)=>{"use strict";var TR=require("os"),V_=require("tty"),nr=q_(),{env:dt}=process,wn;nr("no-color")||nr("no-colors")||nr("color=false")||nr("color=never")?wn=0:(nr("color")||nr("colors")||nr("color=true")||nr("color=always"))&&(wn=1);"FORCE_COLOR"in dt&&(dt.FORCE_COLOR==="true"?wn=1:dt.FORCE_COLOR==="false"?wn=0:wn=dt.FORCE_COLOR.length===0?1:Math.min(parseInt(dt.FORCE_COLOR,10),3));function Ol(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}o(Ol,"translateLevel");function kl(t,e){if(wn===0)return 0;if(nr("color=16m")||nr("color=full")||nr("color=truecolor"))return 3;if(nr("color=256"))return 2;if(t&&!e&&wn===void 0)return 0;let r=wn||0;if(dt.TERM==="dumb")return r;if(process.platform==="win32"){let n=TR.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in dt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in dt)||dt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in dt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(dt.TEAMCITY_VERSION)?1:0;if(dt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in dt){let n=parseInt((dt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(dt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(dt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(dt.TERM)||"COLORTERM"in dt?1:r}o(kl,"supportsColor");function wR(t){let e=kl(t,t&&t.isTTY);return Ol(e)}o(wR,"getSupportLevel");H_.exports={supportsColor:wR,stdout:Ol(kl(!0,V_.isatty(1))),stderr:Ol(kl(!0,V_.isatty(2)))}});var Z_=M((pt,Rs)=>{var xR=require("tty"),Is=require("util");pt.init=$R;pt.log=CR;pt.formatArgs=IR;pt.save=OR;pt.load=kR;pt.useColors=AR;pt.destroy=Is.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");pt.colors=[6,2,3,4,5,1];try{let t=G_();t&&(t.stderr||t).level>=2&&(pt.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}pt.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,u)=>u.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),t[r]=n,t},{});function AR(){return"colors"in pt.inspectOpts?!!pt.inspectOpts.colors:xR.isatty(process.stderr.fd)}o(AR,"useColors");function IR(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),u=` ${i};1m${e} \x1B[0m`;t[0]=u+t[0].split(`
1
+ "use strict";var kT=Object.create;var hi=Object.defineProperty;var $T=Object.getOwnPropertyDescriptor;var zT=Object.getOwnPropertyNames;var NT=Object.getPrototypeOf,DT=Object.prototype.hasOwnProperty;var o=(t,e)=>hi(t,"name",{value:e,configurable:!0});var ct=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var L=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},qa=(t,e)=>{for(var r in e)hi(t,r,{get:e[r],enumerable:!0})},Qf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of zT(e))!DT.call(t,i)&&i!==r&&hi(t,i,{get:()=>e[i],enumerable:!(n=$T(e,i))||n.enumerable});return t};var yt=(t,e,r)=>(r=t!=null?kT(NT(t)):{},Qf(e||!t||!t.__esModule?hi(r,"default",{value:t,enumerable:!0}):r,t)),UT=t=>Qf(hi({},"__esModule",{value:!0}),t);var Ph=L((Eh,ls)=>{(function(t){"use strict";let e="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${e}\\.${e}\\.${e}\\.${e}$`,"i"),threeOctet:new RegExp(`^${e}\\.${e}\\.${e}$`,"i"),twoOctet:new RegExp(`^${e}\\.${e}$`,"i"),longValue:new RegExp(`^${e}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),u="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(u,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${u})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${u})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${e}\\.${e}\\.${e}\\.${e}(${u})?$`,"i")};function p(h,b){if(h.indexOf("::")!==h.lastIndexOf("::"))return null;let T=0,E=-1,w=(h.match(l.zoneIndex)||[])[0],k,q;for(w&&(w=w.substring(1),h=h.replace(/%.+$/,""));(E=h.indexOf(":",E+1))>=0;)T++;if(h.substr(0,2)==="::"&&T--,h.substr(-2,2)==="::"&&T--,T>b)return null;for(q=b-T,k=":";q--;)k+="0:";return h=h.replace("::",k),h[0]===":"&&(h=h.slice(1)),h[h.length-1]===":"&&(h=h.slice(0,-1)),b=(function(){let W=h.split(":"),H=[];for(let V=0;V<W.length;V++)H.push(parseInt(W[V],16));return H})(),{parts:b,zoneId:w}}o(p,"expandIPv6");function f(h,b,T,E){if(h.length!==b.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let w=0,k;for(;E>0;){if(k=T-E,k<0&&(k=0),h[w]>>k!==b[w]>>k)return!1;E-=T,w+=1}return!0}o(f,"matchCIDR");function m(h){if(i.test(h))return parseInt(h,16);if(h[0]==="0"&&!isNaN(parseInt(h[1],10))){if(n.test(h))return parseInt(h,8);throw new Error(`ipaddr: cannot parse ${h} as octal`)}return parseInt(h,10)}o(m,"parseIntAuto");function y(h,b){for(;h.length<b;)h=`0${h}`;return h}o(y,"padPart");let P={};P.IPv4=(function(){function h(b){if(b.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let T,E;for(T=0;T<b.length;T++)if(E=b[T],!(0<=E&&E<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=b}return o(h,"IPv4"),h.prototype.SpecialRanges={unspecified:[[new h([0,0,0,0]),8]],broadcast:[[new h([255,255,255,255]),32]],multicast:[[new h([224,0,0,0]),4]],linkLocal:[[new h([169,254,0,0]),16]],loopback:[[new h([127,0,0,0]),8]],carrierGradeNat:[[new h([100,64,0,0]),10]],private:[[new h([10,0,0,0]),8],[new h([172,16,0,0]),12],[new h([192,168,0,0]),16]],reserved:[[new h([192,0,0,0]),24],[new h([192,0,2,0]),24],[new h([192,88,99,0]),24],[new h([198,18,0,0]),15],[new h([198,51,100,0]),24],[new h([203,0,113,0]),24],[new h([240,0,0,0]),4]],as112:[[new h([192,175,48,0]),24],[new h([192,31,196,0]),24]],amt:[[new h([192,52,193,0]),24]]},h.prototype.kind=function(){return"ipv4"},h.prototype.match=function(b,T){let E;if(T===void 0&&(E=b,b=E[0],T=E[1]),b.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,b.octets,8,T)},h.prototype.prefixLengthFromSubnetMask=function(){let b=0,T=!1,E={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},w,k,q;for(w=3;w>=0;w-=1)if(k=this.octets[w],k in E){if(q=E[k],T&&q!==0)return null;q!==8&&(T=!0),b+=q}else return null;return 32-b},h.prototype.range=function(){return P.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){return this.octets.slice(0)},h.prototype.toIPv4MappedAddress=function(){return P.IPv6.parse(`::ffff:${this.toString()}`)},h.prototype.toNormalizedString=function(){return this.toString()},h.prototype.toString=function(){return this.octets.join(".")},h})(),P.IPv4.broadcastAddressFromCIDR=function(h){try{let b=this.parseCIDR(h),T=b[0].toByteArray(),E=this.subnetMaskFromPrefixLength(b[1]).toByteArray(),w=[],k=0;for(;k<4;)w.push(parseInt(T[k],10)|parseInt(E[k],10)^255),k++;return new this(w)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},P.IPv4.isIPv4=function(h){return this.parser(h)!==null},P.IPv4.isValid=function(h){try{return new this(this.parser(h)),!0}catch{return!1}},P.IPv4.isValidCIDR=function(h){try{return this.parseCIDR(h),!0}catch{return!1}},P.IPv4.isValidFourPartDecimal=function(h){return!!(P.IPv4.isValid(h)&&h.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},P.IPv4.isValidCIDRFourPartDecimal=function(h){let b=h.match(/^(.+)\/(\d+)$/);return!P.IPv4.isValidCIDR(h)||!b?!1:P.IPv4.isValidFourPartDecimal(b[1])},P.IPv4.networkAddressFromCIDR=function(h){let b,T,E,w,k;try{for(b=this.parseCIDR(h),E=b[0].toByteArray(),k=this.subnetMaskFromPrefixLength(b[1]).toByteArray(),w=[],T=0;T<4;)w.push(parseInt(E[T],10)&parseInt(k[T],10)),T++;return new this(w)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},P.IPv4.parse=function(h){let b=this.parser(h);if(b===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(b)},P.IPv4.parseCIDR=function(h){let b;if(b=h.match(/^(.+)\/(\d+)$/)){let T=parseInt(b[2]);if(T>=0&&T<=32){let E=[this.parse(b[1]),T];return Object.defineProperty(E,"toString",{value:o(function(){return this.join("/")},"value")}),E}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},P.IPv4.parser=function(h){let b,T,E;if(b=h.match(r.fourOctet))return(function(){let w=b.slice(1,6),k=[];for(let q=0;q<w.length;q++)T=w[q],k.push(m(T));return k})();if(b=h.match(r.longValue)){if(E=m(b[1]),E>4294967295||E<0)throw new Error("ipaddr: address outside defined range");return(function(){let w=[],k;for(k=0;k<=24;k+=8)w.push(E>>k&255);return w})().reverse()}else return(b=h.match(r.twoOctet))?(function(){let w=b.slice(1,4),k=[];if(E=m(w[1]),E>16777215||E<0)throw new Error("ipaddr: address outside defined range");return k.push(m(w[0])),k.push(E>>16&255),k.push(E>>8&255),k.push(E&255),k})():(b=h.match(r.threeOctet))?(function(){let w=b.slice(1,5),k=[];if(E=m(w[2]),E>65535||E<0)throw new Error("ipaddr: address outside defined range");return k.push(m(w[0])),k.push(m(w[1])),k.push(E>>8&255),k.push(E&255),k})():null},P.IPv4.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>32)throw new Error("ipaddr: invalid IPv4 prefix length");let b=[0,0,0,0],T=0,E=Math.floor(h/8);for(;T<E;)b[T]=255,T++;return E<4&&(b[E]=Math.pow(2,h%8)-1<<8-h%8),new this(b)},P.IPv6=(function(){function h(b,T){let E,w;if(b.length===16)for(this.parts=[],E=0;E<=14;E+=2)this.parts.push(b[E]<<8|b[E+1]);else if(b.length===8)this.parts=b;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(E=0;E<this.parts.length;E++)if(w=this.parts[E],!(0<=w&&w<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");T&&(this.zoneId=T)}return o(h,"IPv6"),h.prototype.SpecialRanges={unspecified:[new h([0,0,0,0,0,0,0,0]),128],linkLocal:[new h([65152,0,0,0,0,0,0,0]),10],multicast:[new h([65280,0,0,0,0,0,0,0]),8],loopback:[new h([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new h([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new h([0,0,0,0,0,65535,0,0]),96],discard:[new h([256,0,0,0,0,0,0,0]),64],rfc6145:[new h([0,0,0,0,65535,0,0,0]),96],rfc6052:[new h([100,65435,0,0,0,0,0,0]),96],"6to4":[new h([8194,0,0,0,0,0,0,0]),16],teredo:[new h([8193,0,0,0,0,0,0,0]),32],benchmarking:[new h([8193,2,0,0,0,0,0,0]),48],amt:[new h([8193,3,0,0,0,0,0,0]),32],as112v6:[[new h([8193,4,274,0,0,0,0,0]),48],[new h([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new h([8193,16,0,0,0,0,0,0]),28],orchid2:[new h([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new h([8193,48,0,0,0,0,0,0]),28],reserved:[[new h([8193,0,0,0,0,0,0,0]),23],[new h([8193,3512,0,0,0,0,0,0]),32]]},h.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},h.prototype.kind=function(){return"ipv6"},h.prototype.match=function(b,T){let E;if(T===void 0&&(E=b,b=E[0],T=E[1]),b.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,b.parts,16,T)},h.prototype.prefixLengthFromSubnetMask=function(){let b=0,T=!1,E={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},w,k;for(let q=7;q>=0;q-=1)if(w=this.parts[q],w in E){if(k=E[w],T&&k!==0)return null;k!==16&&(T=!0),b+=k}else return null;return 128-b},h.prototype.range=function(){return P.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){let b,T=[],E=this.parts;for(let w=0;w<E.length;w++)b=E[w],T.push(b>>8),T.push(b&255);return T},h.prototype.toFixedLengthString=function(){let b=(function(){let E=[];for(let w=0;w<this.parts.length;w++)E.push(y(this.parts[w].toString(16),4));return E}).call(this).join(":"),T="";return this.zoneId&&(T=`%${this.zoneId}`),b+T},h.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let b=this.parts.slice(-2),T=b[0],E=b[1];return new P.IPv4([T>>8,T&255,E>>8,E&255])},h.prototype.toNormalizedString=function(){let b=(function(){let E=[];for(let w=0;w<this.parts.length;w++)E.push(this.parts[w].toString(16));return E}).call(this).join(":"),T="";return this.zoneId&&(T=`%${this.zoneId}`),b+T},h.prototype.toRFC5952String=function(){let b=/((^|:)(0(:|$)){2,})/g,T=this.toNormalizedString(),E=0,w=-1,k;for(;k=b.exec(T);)k[0].length>w&&(E=k.index,w=k[0].length);return w<0?T:`${T.substring(0,E)}::${T.substring(E+w)}`},h.prototype.toString=function(){return this.toRFC5952String()},h})(),P.IPv6.broadcastAddressFromCIDR=function(h){try{let b=this.parseCIDR(h),T=b[0].toByteArray(),E=this.subnetMaskFromPrefixLength(b[1]).toByteArray(),w=[],k=0;for(;k<16;)w.push(parseInt(T[k],10)|parseInt(E[k],10)^255),k++;return new this(w)}catch(b){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${b})`)}},P.IPv6.isIPv6=function(h){return this.parser(h)!==null},P.IPv6.isValid=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{let b=this.parser(h);return new this(b.parts,b.zoneId),!0}catch{return!1}},P.IPv6.isValidCIDR=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{return this.parseCIDR(h),!0}catch{return!1}},P.IPv6.networkAddressFromCIDR=function(h){let b,T,E,w,k;try{for(b=this.parseCIDR(h),E=b[0].toByteArray(),k=this.subnetMaskFromPrefixLength(b[1]).toByteArray(),w=[],T=0;T<16;)w.push(parseInt(E[T],10)&parseInt(k[T],10)),T++;return new this(w)}catch(q){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${q})`)}},P.IPv6.parse=function(h){let b=this.parser(h);if(b.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(b.parts,b.zoneId)},P.IPv6.parseCIDR=function(h){let b,T,E;if((T=h.match(/^(.+)\/(\d+)$/))&&(b=parseInt(T[2]),b>=0&&b<=128))return E=[this.parse(T[1]),b],Object.defineProperty(E,"toString",{value:o(function(){return this.join("/")},"value")}),E;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},P.IPv6.parser=function(h){let b,T,E,w,k,q;if(E=h.match(l.deprecatedTransitional))return this.parser(`::ffff:${E[1]}`);if(l.native.test(h))return p(h,8);if((E=h.match(l.transitional))&&(q=E[6]||"",b=E[1],E[1].endsWith("::")||(b=b.slice(0,-1)),b=p(b+q,6),b.parts)){for(k=[parseInt(E[2]),parseInt(E[3]),parseInt(E[4]),parseInt(E[5])],T=0;T<k.length;T++)if(w=k[T],!(0<=w&&w<=255))return null;return b.parts.push(k[0]<<8|k[1]),b.parts.push(k[2]<<8|k[3]),{parts:b.parts,zoneId:b.zoneId}}return null},P.IPv6.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>128)throw new Error("ipaddr: invalid IPv6 prefix length");let b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],T=0,E=Math.floor(h/8);for(;T<E;)b[T]=255,T++;return E<16&&(b[E]=Math.pow(2,h%8)-1<<8-h%8),new this(b)},P.fromByteArray=function(h){let b=h.length;if(b===4)return new P.IPv4(h);if(b===16)return new P.IPv6(h);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},P.isValid=function(h){return P.IPv6.isValid(h)||P.IPv4.isValid(h)},P.isValidCIDR=function(h){return P.IPv6.isValidCIDR(h)||P.IPv4.isValidCIDR(h)},P.parse=function(h){if(P.IPv6.isValid(h))return P.IPv6.parse(h);if(P.IPv4.isValid(h))return P.IPv4.parse(h);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},P.parseCIDR=function(h){try{return P.IPv6.parseCIDR(h)}catch{try{return P.IPv4.parseCIDR(h)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},P.process=function(h){let b=this.parse(h);return b.kind()==="ipv6"&&b.isIPv4MappedAddress()?b.toIPv4Address():b},P.subnetMatch=function(h,b,T){let E,w,k,q;T==null&&(T="unicast");for(w in b)if(Object.prototype.hasOwnProperty.call(b,w)){for(k=b[w],k[0]&&!(k[0]instanceof Array)&&(k=[k]),E=0;E<k.length;E++)if(q=k[E],h.kind()===q[0].kind()&&h.match.apply(h,q))return w}return T},typeof ls<"u"&&ls.exports?ls.exports=P:t.ipaddr=P})(Eh)});var wg=L((LH,Tg)=>{var Sg=require("stream").Stream,EA=require("util");Tg.exports=hr;function hr(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}o(hr,"DelayedStream");EA.inherits(hr,Sg);hr.create=function(t,e){var r=new this;e=e||{};for(var n in e)r[n]=e[n];r.source=t;var i=t.emit;return t.emit=function(){return r._handleEmit(arguments),i.apply(t,arguments)},t.on("error",function(){}),r.pauseStream&&t.pause(),r};Object.defineProperty(hr.prototype,"readable",{configurable:!0,enumerable:!0,get:o(function(){return this.source.readable},"get")});hr.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};hr.prototype.resume=function(){this._released||this.release(),this.source.resume()};hr.prototype.pause=function(){this.source.pause()};hr.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this)),this._bufferedEvents=[]};hr.prototype.pipe=function(){var t=Sg.prototype.pipe.apply(this,arguments);return this.resume(),t};hr.prototype._handleEmit=function(t){if(this._released){this.emit.apply(this,t);return}t[0]==="data"&&(this.dataSize+=t[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(t)};hr.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(t))}}});var Rg=L((BH,Ig)=>{var PA=require("util"),Ag=require("stream").Stream,xg=wg();Ig.exports=Xe;function Xe(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}o(Xe,"CombinedStream");PA.inherits(Xe,Ag);Xe.create=function(t){var e=new this;t=t||{};for(var r in t)e[r]=t[r];return e};Xe.isStreamLike=function(t){return typeof t!="function"&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"&&!Buffer.isBuffer(t)};Xe.prototype.append=function(t){var e=Xe.isStreamLike(t);if(e){if(!(t instanceof xg)){var r=xg.create(t,{maxDataSize:1/0,pauseStream:this.pauseStreams});t.on("data",this._checkDataSize.bind(this)),t=r}this._handleErrors(t),this.pauseStreams&&t.pause()}return this._streams.push(t),this};Xe.prototype.pipe=function(t,e){return Ag.prototype.pipe.call(this,t,e),this.resume(),t};Xe.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};Xe.prototype._realGetNext=function(){var t=this._streams.shift();if(typeof t>"u"){this.end();return}if(typeof t!="function"){this._pipeNext(t);return}var e=t;e(function(r){var n=Xe.isStreamLike(r);n&&(r.on("data",this._checkDataSize.bind(this)),this._handleErrors(r)),this._pipeNext(r)}.bind(this))};Xe.prototype._pipeNext=function(t){this._currentStream=t;var e=Xe.isStreamLike(t);if(e){t.on("end",this._getNext.bind(this)),t.pipe(this,{end:!1});return}var r=t;this.write(r),this._getNext()};Xe.prototype._handleErrors=function(t){var e=this;t.on("error",function(r){e._emitError(r)})};Xe.prototype.write=function(t){this.emit("data",t)};Xe.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};Xe.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function"&&this._currentStream.resume(),this.emit("resume")};Xe.prototype.end=function(){this._reset(),this.emit("end")};Xe.prototype.destroy=function(){this._reset(),this.emit("close")};Xe.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};Xe.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(t))}};Xe.prototype._updateDataSize=function(){this.dataSize=0;var t=this;this._streams.forEach(function(e){e.dataSize&&(t.dataSize+=e.dataSize)}),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)};Xe.prototype._emitError=function(t){this._reset(),this.emit("error",t)}});var Og=L((VH,Cg)=>{"use strict";Cg.exports={"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dat"]},"application/msword":{source:"iana",extensions:["doc"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",extensions:["docx"]},"application/vnd.ms-excel":{source:"iana",extensions:["xls"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",extensions:["xlsx"]},"application/vnd.ms-powerpoint":{source:"iana",extensions:["ppt"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",extensions:["pptx"]},"application/csv":{compressible:!0,extensions:["csv"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"text/plain":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["txt","text","log"]},"text/html":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["html","htm"]},"text/css":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["css"]},"text/csv":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["csv"]},"text/markdown":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["md","markdown"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/webp":{source:"apache",compressible:!1,extensions:["webp"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tiff","tif"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/heic":{source:"iana",compressible:!1,extensions:["heic"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mp3","mpga"]},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/ogg":{source:"iana",compressible:!1,extensions:["ogg","oga"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","m4v"]},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg"]},"video/webm":{source:"iana",compressible:!1,extensions:["webm"]},"video/quicktime":{source:"iana",compressible:!1,extensions:["mov","qt"]},"video/x-msvideo":{source:"iana",compressible:!1,extensions:["avi"]},"font/woff":{source:"iana",compressible:!1,extensions:["woff"]},"font/woff2":{source:"iana",compressible:!1,extensions:["woff2"]},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"multipart/form-data":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/ics":{compressible:!0,extensions:["ics"]},"text/calendar":{source:"iana",compressible:!0,extensions:["ics","ifb"]},"application/x-ndjson":{compressible:!0,extensions:["ndjson"]}}});var zg=L(Ot=>{"use strict";var gs=Og(),SA=require("path").extname,kg=/^\s*([^;\s]*)(?:;|\s|$)/,TA=/^text\//i;Ot.charset=$g;Ot.charsets={lookup:$g};Ot.contentType=wA;Ot.extension=xA;Ot.extensions=Object.create(null);Ot.lookup=AA;Ot.types=Object.create(null);IA(Ot.extensions,Ot.types);function $g(t){if(!t||typeof t!="string")return!1;var e=kg.exec(t),r=e&&gs[e[1].toLowerCase()];return r&&r.charset?r.charset:e&&TA.test(e[1])?"UTF-8":!1}o($g,"charset");function wA(t){if(!t||typeof t!="string")return!1;var e=t.indexOf("/")===-1?Ot.lookup(t):t;if(!e)return!1;if(e.indexOf("charset")===-1){var r=Ot.charset(e);r&&(e+="; charset="+r.toLowerCase())}return e}o(wA,"contentType");function xA(t){if(!t||typeof t!="string")return!1;var e=kg.exec(t),r=e&&Ot.extensions[e[1].toLowerCase()];return!r||!r.length?!1:r[0]}o(xA,"extension");function AA(t){if(!t||typeof t!="string")return!1;var e=SA("x."+t).toLowerCase().substr(1);return e&&Ot.types[e]||!1}o(AA,"lookup");function IA(t,e){var r=["nginx","apache",void 0,"iana"];Object.keys(gs).forEach(o(function(i){var u=gs[i],c=u.extensions;if(!(!c||!c.length)){t[i]=c;for(var l=0;l<c.length;l++){var p=c[l];if(e[p]){var f=r.indexOf(gs[e[p]].source),m=r.indexOf(u.source);if(e[p]!=="application/octet-stream"&&(f>m||f===m&&e[p].substr(0,12)==="application/"))continue}e[p]=i}}},"forEachMimeType"))}o(IA,"populateMaps")});var Dg=L((WH,Ng)=>{Ng.exports=RA;function RA(t){var e=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;e?e(t):setTimeout(t,0)}o(RA,"defer")});var al=L((JH,jg)=>{var Ug=Dg();jg.exports=CA;function CA(t){var e=!1;return Ug(function(){e=!0}),o(function(n,i){e?t(n,i):Ug(o(function(){t(n,i)},"nextTick_callback"))},"async_callback")}o(CA,"async")});var sl=L((QH,Mg)=>{Mg.exports=OA;function OA(t){Object.keys(t.jobs).forEach(kA.bind(t)),t.jobs={}}o(OA,"abort");function kA(t){typeof this.jobs[t]=="function"&&this.jobs[t]()}o(kA,"clean")});var ul=L((XH,Fg)=>{var Lg=al(),$A=sl();Fg.exports=zA;function zA(t,e,r,n){var i=r.keyedList?r.keyedList[r.index]:r.index;r.jobs[i]=NA(e,i,t[i],function(u,c){i in r.jobs&&(delete r.jobs[i],u?$A(r):r.results[i]=c,n(u,r.results))})}o(zA,"iterate");function NA(t,e,r,n){var i;return t.length==2?i=t(r,Lg(n)):i=t(r,e,Lg(n)),i}o(NA,"runJob")});var cl=L((tG,Bg)=>{Bg.exports=DA;function DA(t,e){var r=!Array.isArray(t),n={index:0,keyedList:r||e?Object.keys(t):null,jobs:{},results:r?{}:[],size:r?Object.keys(t).length:t.length};return e&&n.keyedList.sort(r?e:function(i,u){return e(t[i],t[u])}),n}o(DA,"state")});var ll=L((nG,qg)=>{var UA=sl(),jA=al();qg.exports=MA;function MA(t){Object.keys(this.jobs).length&&(this.index=this.size,UA(this),jA(t)(null,this.results))}o(MA,"terminator")});var Hg=L((iG,Vg)=>{var LA=ul(),FA=cl(),BA=ll();Vg.exports=qA;function qA(t,e,r){for(var n=FA(t);n.index<(n.keyedList||t).length;)LA(t,e,n,function(i,u){if(i){r(i,u);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}}),n.index++;return BA.bind(n,r)}o(qA,"parallel")});var dl=L((sG,ys)=>{var Gg=ul(),VA=cl(),HA=ll();ys.exports=GA;ys.exports.ascending=Wg;ys.exports.descending=WA;function GA(t,e,r,n){var i=VA(t,r);return Gg(t,e,i,o(function u(c,l){if(c){n(c,l);return}if(i.index++,i.index<(i.keyedList||t).length){Gg(t,e,i,u);return}n(null,i.results)},"iteratorHandler")),HA.bind(i,n)}o(GA,"serialOrdered");function Wg(t,e){return t<e?-1:t>e?1:0}o(Wg,"ascending");function WA(t,e){return-1*Wg(t,e)}o(WA,"descending")});var Jg=L((cG,Zg)=>{var ZA=dl();Zg.exports=JA;function JA(t,e,r){return ZA(t,e,null,r)}o(JA,"serial")});var Qg=L((dG,Kg)=>{Kg.exports={parallel:Hg(),serial:Jg(),serialOrdered:dl()}});var pl=L((pG,Yg)=>{"use strict";Yg.exports=Object});var ey=L((fG,Xg)=>{"use strict";Xg.exports=Error});var ry=L((mG,ty)=>{"use strict";ty.exports=EvalError});var oy=L((hG,ny)=>{"use strict";ny.exports=RangeError});var ay=L((gG,iy)=>{"use strict";iy.exports=ReferenceError});var uy=L((yG,sy)=>{"use strict";sy.exports=SyntaxError});var _s=L((_G,cy)=>{"use strict";cy.exports=TypeError});var dy=L((bG,ly)=>{"use strict";ly.exports=URIError});var fy=L((vG,py)=>{"use strict";py.exports=Math.abs});var hy=L((EG,my)=>{"use strict";my.exports=Math.floor});var yy=L((PG,gy)=>{"use strict";gy.exports=Math.max});var by=L((SG,_y)=>{"use strict";_y.exports=Math.min});var Ey=L((TG,vy)=>{"use strict";vy.exports=Math.pow});var Sy=L((wG,Py)=>{"use strict";Py.exports=Math.round});var wy=L((xG,Ty)=>{"use strict";Ty.exports=Number.isNaN||o(function(e){return e!==e},"isNaN")});var Ay=L((IG,xy)=>{"use strict";var KA=wy();xy.exports=o(function(e){return KA(e)||e===0?e:e<0?-1:1},"sign")});var Ry=L((CG,Iy)=>{"use strict";Iy.exports=Object.getOwnPropertyDescriptor});var fl=L((OG,Cy)=>{"use strict";var bs=Ry();if(bs)try{bs([],"length")}catch{bs=null}Cy.exports=bs});var ky=L((kG,Oy)=>{"use strict";var vs=Object.defineProperty||!1;if(vs)try{vs({},"a",{value:1})}catch{vs=!1}Oy.exports=vs});var ml=L(($G,$y)=>{"use strict";$y.exports=o(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(var u in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var c=Object.getOwnPropertySymbols(e);if(c.length!==1||c[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(e,r);if(l.value!==i||l.enumerable!==!0)return!1}return!0},"hasSymbols")});var Dy=L((NG,Ny)=>{"use strict";var zy=typeof Symbol<"u"&&Symbol,QA=ml();Ny.exports=o(function(){return typeof zy!="function"||typeof Symbol!="function"||typeof zy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:QA()},"hasNativeSymbols")});var hl=L((UG,Uy)=>{"use strict";Uy.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var gl=L((jG,jy)=>{"use strict";var YA=pl();jy.exports=YA.getPrototypeOf||null});var Fy=L((MG,Ly)=>{"use strict";var XA="Function.prototype.bind called on incompatible ",eI=Object.prototype.toString,tI=Math.max,rI="[object Function]",My=o(function(e,r){for(var n=[],i=0;i<e.length;i+=1)n[i]=e[i];for(var u=0;u<r.length;u+=1)n[u+e.length]=r[u];return n},"concatty"),nI=o(function(e,r){for(var n=[],i=r||0,u=0;i<e.length;i+=1,u+=1)n[u]=e[i];return n},"slicy"),oI=o(function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r},"joiny");Ly.exports=o(function(e){var r=this;if(typeof r!="function"||eI.apply(r)!==rI)throw new TypeError(XA+r);for(var n=nI(arguments,1),i,u=o(function(){if(this instanceof i){var m=r.apply(this,My(n,arguments));return Object(m)===m?m:this}return r.apply(e,My(n,arguments))},"binder"),c=tI(0,r.length-n.length),l=[],p=0;p<c;p++)l[p]="$"+p;if(i=Function("binder","return function ("+oI(l,",")+"){ return binder.apply(this,arguments); }")(u),r.prototype){var f=o(function(){},"Empty");f.prototype=r.prototype,i.prototype=new f,f.prototype=null}return i},"bind")});var Ao=L((FG,By)=>{"use strict";var iI=Fy();By.exports=Function.prototype.bind||iI});var Es=L((BG,qy)=>{"use strict";qy.exports=Function.prototype.call});var yl=L((qG,Vy)=>{"use strict";Vy.exports=Function.prototype.apply});var Gy=L((VG,Hy)=>{"use strict";Hy.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Zy=L((HG,Wy)=>{"use strict";var aI=Ao(),sI=yl(),uI=Es(),cI=Gy();Wy.exports=cI||aI.call(uI,sI)});var Ky=L((GG,Jy)=>{"use strict";var lI=Ao(),dI=_s(),pI=Es(),fI=Zy();Jy.exports=o(function(e){if(e.length<1||typeof e[0]!="function")throw new dI("a function is required");return fI(lI,pI,e)},"callBindBasic")});var r_=L((ZG,t_)=>{"use strict";var mI=Ky(),Qy=fl(),Xy;try{Xy=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var _l=!!Xy&&Qy&&Qy(Object.prototype,"__proto__"),e_=Object,Yy=e_.getPrototypeOf;t_.exports=_l&&typeof _l.get=="function"?mI([_l.get]):typeof Yy=="function"?o(function(e){return Yy(e==null?e:e_(e))},"getDunder"):!1});var s_=L((KG,a_)=>{"use strict";var n_=hl(),o_=gl(),i_=r_();a_.exports=n_?o(function(e){return n_(e)},"getProto"):o_?o(function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return o_(e)},"getProto"):i_?o(function(e){return i_(e)},"getProto"):null});var bl=L((YG,u_)=>{"use strict";var hI=Function.prototype.call,gI=Object.prototype.hasOwnProperty,yI=Ao();u_.exports=yI.call(hI,gI)});var h_=L((XG,m_)=>{"use strict";var Te,_I=pl(),bI=ey(),vI=ry(),EI=oy(),PI=ay(),Oo=uy(),Co=_s(),SI=dy(),TI=fy(),wI=hy(),xI=yy(),AI=by(),II=Ey(),RI=Sy(),CI=Ay(),p_=Function,vl=o(function(t){try{return p_('"use strict"; return ('+t+").constructor;")()}catch{}},"getEvalledConstructor"),Ui=fl(),OI=ky(),El=o(function(){throw new Co},"throwTypeError"),kI=Ui?(function(){try{return arguments.callee,El}catch{try{return Ui(arguments,"callee").get}catch{return El}}})():El,Io=Dy()(),dt=s_(),$I=gl(),zI=hl(),f_=yl(),ji=Es(),Ro={},NI=typeof Uint8Array>"u"||!dt?Te:dt(Uint8Array),Vn={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Te:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Te:ArrayBuffer,"%ArrayIteratorPrototype%":Io&&dt?dt([][Symbol.iterator]()):Te,"%AsyncFromSyncIteratorPrototype%":Te,"%AsyncFunction%":Ro,"%AsyncGenerator%":Ro,"%AsyncGeneratorFunction%":Ro,"%AsyncIteratorPrototype%":Ro,"%Atomics%":typeof Atomics>"u"?Te:Atomics,"%BigInt%":typeof BigInt>"u"?Te:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Te:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Te:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Te:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":bI,"%eval%":eval,"%EvalError%":vI,"%Float16Array%":typeof Float16Array>"u"?Te:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Te:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Te:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Te:FinalizationRegistry,"%Function%":p_,"%GeneratorFunction%":Ro,"%Int8Array%":typeof Int8Array>"u"?Te:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Te:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Te:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Io&&dt?dt(dt([][Symbol.iterator]())):Te,"%JSON%":typeof JSON=="object"?JSON:Te,"%Map%":typeof Map>"u"?Te:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Io||!dt?Te:dt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":_I,"%Object.getOwnPropertyDescriptor%":Ui,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Te:Promise,"%Proxy%":typeof Proxy>"u"?Te:Proxy,"%RangeError%":EI,"%ReferenceError%":PI,"%Reflect%":typeof Reflect>"u"?Te:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Te:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Io||!dt?Te:dt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Te:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Io&&dt?dt(""[Symbol.iterator]()):Te,"%Symbol%":Io?Symbol:Te,"%SyntaxError%":Oo,"%ThrowTypeError%":kI,"%TypedArray%":NI,"%TypeError%":Co,"%Uint8Array%":typeof Uint8Array>"u"?Te:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Te:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Te:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Te:Uint32Array,"%URIError%":SI,"%WeakMap%":typeof WeakMap>"u"?Te:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Te:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Te:WeakSet,"%Function.prototype.call%":ji,"%Function.prototype.apply%":f_,"%Object.defineProperty%":OI,"%Object.getPrototypeOf%":$I,"%Math.abs%":TI,"%Math.floor%":wI,"%Math.max%":xI,"%Math.min%":AI,"%Math.pow%":II,"%Math.round%":RI,"%Math.sign%":CI,"%Reflect.getPrototypeOf%":zI};if(dt)try{null.error}catch(t){c_=dt(dt(t)),Vn["%Error.prototype%"]=c_}var c_,DI=o(function t(e){var r;if(e==="%AsyncFunction%")r=vl("async function () {}");else if(e==="%GeneratorFunction%")r=vl("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=vl("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&dt&&(r=dt(i.prototype))}return Vn[e]=r,r},"doEval"),l_={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Mi=Ao(),Ps=bl(),UI=Mi.call(ji,Array.prototype.concat),jI=Mi.call(f_,Array.prototype.splice),d_=Mi.call(ji,String.prototype.replace),Ss=Mi.call(ji,String.prototype.slice),MI=Mi.call(ji,RegExp.prototype.exec),LI=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,FI=/\\(\\)?/g,BI=o(function(e){var r=Ss(e,0,1),n=Ss(e,-1);if(r==="%"&&n!=="%")throw new Oo("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Oo("invalid intrinsic syntax, expected opening `%`");var i=[];return d_(e,LI,function(u,c,l,p){i[i.length]=l?d_(p,FI,"$1"):c||u}),i},"stringToPath"),qI=o(function(e,r){var n=e,i;if(Ps(l_,n)&&(i=l_[n],n="%"+i[0]+"%"),Ps(Vn,n)){var u=Vn[n];if(u===Ro&&(u=DI(n)),typeof u>"u"&&!r)throw new Co("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:u}}throw new Oo("intrinsic "+e+" does not exist!")},"getBaseIntrinsic");m_.exports=o(function(e,r){if(typeof e!="string"||e.length===0)throw new Co("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Co('"allowMissing" argument must be a boolean');if(MI(/^%?[^%]*%?$/,e)===null)throw new Oo("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=BI(e),i=n.length>0?n[0]:"",u=qI("%"+i+"%",r),c=u.name,l=u.value,p=!1,f=u.alias;f&&(i=f[0],jI(n,UI([0,1],f)));for(var m=1,y=!0;m<n.length;m+=1){var P=n[m],h=Ss(P,0,1),b=Ss(P,-1);if((h==='"'||h==="'"||h==="`"||b==='"'||b==="'"||b==="`")&&h!==b)throw new Oo("property names with quotes must have matching quotes");if((P==="constructor"||!y)&&(p=!0),i+="."+P,c="%"+i+"%",Ps(Vn,c))l=Vn[c];else if(l!=null){if(!(P in l)){if(!r)throw new Co("base intrinsic for "+e+" exists, but the property is not available.");return}if(Ui&&m+1>=n.length){var T=Ui(l,P);y=!!T,y&&"get"in T&&!("originalValue"in T.get)?l=T.get:l=l[P]}else y=Ps(l,P),l=l[P];y&&!p&&(Vn[c]=l)}}return l},"GetIntrinsic")});var y_=L((tW,g_)=>{"use strict";var VI=ml();g_.exports=o(function(){return VI()&&!!Symbol.toStringTag},"hasToStringTagShams")});var v_=L((nW,b_)=>{"use strict";var HI=h_(),__=HI("%Object.defineProperty%",!0),GI=y_()(),WI=bl(),ZI=_s(),Ts=GI?Symbol.toStringTag:null;b_.exports=o(function(e,r){var n=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof n<"u"&&typeof n!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new ZI("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Ts&&(n||!WI(e,Ts))&&(__?__(e,Ts,{configurable:!i,enumerable:!1,value:r,writable:!1}):e[Ts]=r)},"setToStringTag")});var P_=L((iW,E_)=>{"use strict";var JI=Function.prototype.call,KI=Object.prototype.hasOwnProperty,QI=Ao();E_.exports=QI.call(JI,KI)});var T_=L((aW,S_)=>{"use strict";S_.exports=function(t,e){return Object.keys(e).forEach(function(r){t[r]=t[r]||e[r]}),t}});var A_=L((sW,x_)=>{"use strict";var wl=Rg(),YI=require("util"),Pl=require("path"),XI=require("http"),eR=require("https"),tR=require("url").parse,rR=require("fs"),nR=require("stream").Stream,oR=require("crypto"),Sl=zg(),iR=Qg(),aR=v_(),wn=P_(),Tl=T_();function w_(t){return String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}o(w_,"escapeHeaderParam");function Oe(t){if(!(this instanceof Oe))return new Oe(t);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],wl.call(this),t=t||{};for(var e in t)this[e]=t[e]}o(Oe,"FormData");YI.inherits(Oe,wl);Oe.LINE_BREAK=`\r
2
+ `;Oe.DEFAULT_CONTENT_TYPE="application/octet-stream";Oe.prototype.append=function(t,e,r){r=r||{},typeof r=="string"&&(r={filename:r});var n=wl.prototype.append.bind(this);if((typeof e=="number"||e==null)&&(e=String(e)),Array.isArray(e)){this._error(new Error("Arrays are not supported."));return}var i=this._multiPartHeader(t,e,r),u=this._multiPartFooter();n(i),n(e),n(u),this._trackLength(i,e,r)};Oe.prototype._trackLength=function(t,e,r){var n=0;r.knownLength!=null?n+=Number(r.knownLength):Buffer.isBuffer(e)?n=e.length:typeof e=="string"&&(n=Buffer.byteLength(e)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(t)+Oe.LINE_BREAK.length,!(!e||!e.path&&!(e.readable&&wn(e,"httpVersion"))&&!(e instanceof nR))&&(r.knownLength||this._valuesToMeasure.push(e))};Oe.prototype._lengthRetriever=function(t,e){wn(t,"fd")?t.end!=null&&t.end!=1/0&&t.start!=null?e(null,t.end+1-(t.start?t.start:0)):rR.stat(t.path,function(r,n){if(r){e(r);return}var i=n.size-(t.start?t.start:0);e(null,i)}):wn(t,"httpVersion")?e(null,Number(t.headers["content-length"])):wn(t,"httpModule")?(t.on("response",function(r){t.pause(),e(null,Number(r.headers["content-length"]))}),t.resume()):e("Unknown stream")};Oe.prototype._multiPartHeader=function(t,e,r){if(typeof r.header=="string")return r.header;var n=this._getContentDisposition(e,r),i=this._getContentType(e,r),u="",c={"Content-Disposition":["form-data",'name="'+w_(t)+'"'].concat(n||[]),"Content-Type":[].concat(i||[])};typeof r.header=="object"&&Tl(c,r.header);var l;for(var p in c)if(wn(c,p)){if(l=c[p],l==null)continue;Array.isArray(l)||(l=[l]),l.length&&(u+=p+": "+l.join("; ")+Oe.LINE_BREAK)}return"--"+this.getBoundary()+Oe.LINE_BREAK+u+Oe.LINE_BREAK};Oe.prototype._getContentDisposition=function(t,e){var r;if(typeof e.filepath=="string"?r=Pl.normalize(e.filepath).replace(/\\/g,"/"):e.filename||t&&(t.name||t.path)?r=Pl.basename(e.filename||t&&(t.name||t.path)):t&&t.readable&&wn(t,"httpVersion")&&(r=Pl.basename(t.client._httpMessage.path||"")),r)return'filename="'+w_(r)+'"'};Oe.prototype._getContentType=function(t,e){var r=e.contentType;return!r&&t&&t.name&&(r=Sl.lookup(t.name)),!r&&t&&t.path&&(r=Sl.lookup(t.path)),!r&&t&&t.readable&&wn(t,"httpVersion")&&(r=t.headers["content-type"]),!r&&(e.filepath||e.filename)&&(r=Sl.lookup(e.filepath||e.filename)),!r&&t&&typeof t=="object"&&(r=Oe.DEFAULT_CONTENT_TYPE),r};Oe.prototype._multiPartFooter=function(){return function(t){var e=Oe.LINE_BREAK,r=this._streams.length===0;r&&(e+=this._lastBoundary()),t(e)}.bind(this)};Oe.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+Oe.LINE_BREAK};Oe.prototype.getHeaders=function(t){var e,r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(e in t)wn(t,e)&&(r[e.toLowerCase()]=t[e]);return r};Oe.prototype.setBoundary=function(t){if(typeof t!="string")throw new TypeError("FormData boundary must be a string");this._boundary=t};Oe.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};Oe.prototype.getBuffer=function(){for(var t=new Buffer.alloc(0),e=this.getBoundary(),r=0,n=this._streams.length;r<n;r++)typeof this._streams[r]!="function"&&(Buffer.isBuffer(this._streams[r])?t=Buffer.concat([t,this._streams[r]]):t=Buffer.concat([t,Buffer.from(this._streams[r])]),(typeof this._streams[r]!="string"||this._streams[r].substring(2,e.length+2)!==e)&&(t=Buffer.concat([t,Buffer.from(Oe.LINE_BREAK)])));return Buffer.concat([t,Buffer.from(this._lastBoundary())])};Oe.prototype._generateBoundary=function(){this._boundary="--------------------------"+oR.randomBytes(12).toString("hex")};Oe.prototype.getLengthSync=function(){var t=this._overheadLength+this._valueLength;return this._streams.length&&(t+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),t};Oe.prototype.hasKnownLength=function(){var t=!0;return this._valuesToMeasure.length&&(t=!1),t};Oe.prototype.getLength=function(t){var e=this._overheadLength+this._valueLength;if(this._streams.length&&(e+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(t.bind(this,null,e));return}iR.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){t(r);return}n.forEach(function(i){e+=i}),t(null,e)})};Oe.prototype.submit=function(t,e){var r,n,i={method:"post"};return typeof t=="string"?(t=tR(t),n=Tl({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},i)):(n=Tl(t,i),n.port||(n.port=n.protocol==="https:"?443:80)),n.headers=this.getHeaders(t.headers),n.protocol==="https:"?r=eR.request(n):r=XI.request(n),this.getLength(function(u,c){if(u&&u!=="Unknown stream"){this._error(u);return}if(c&&r.setHeader("Content-Length",c),this.pipe(r),e){var l,p=o(function(f,m){return r.removeListener("error",p),r.removeListener("response",l),e.call(this,f,m)},"callback");l=p.bind(this,null),r.on("error",p),r.on("response",l)}}.bind(this)),r};Oe.prototype._error=function(t){this.error||(this.error=t,this.pause(),this.emit("error",t))};Oe.prototype.toString=function(){return"[object FormData]"};aR(Oe.prototype,"FormData");x_.exports=Oe});var xl=L((CW,U_)=>{"use strict";var ws=Object.prototype.hasOwnProperty,D_=Object.prototype.toString,C_=Object.defineProperty,O_=Object.getOwnPropertyDescriptor,k_=o(function(e){return typeof Array.isArray=="function"?Array.isArray(e):D_.call(e)==="[object Array]"},"isArray"),$_=o(function(e){if(!e||D_.call(e)!=="[object Object]")return!1;var r=ws.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&ws.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;var i;for(i in e);return typeof i>"u"||ws.call(e,i)},"isPlainObject"),z_=o(function(e,r){C_&&r.name==="__proto__"?C_(e,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):e[r.name]=r.newValue},"setProperty"),N_=o(function(e,r){if(r==="__proto__")if(ws.call(e,r)){if(O_)return O_(e,r).value}else return;return e[r]},"getProperty");U_.exports=o(function t(){var e,r,n,i,u,c,l=arguments[0],p=1,f=arguments.length,m=!1;for(typeof l=="boolean"&&(m=l,l=arguments[1]||{},p=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});p<f;++p)if(e=arguments[p],e!=null)for(r in e)n=N_(l,r),i=N_(e,r),l!==i&&(m&&i&&($_(i)||(u=k_(i)))?(u?(u=!1,c=n&&k_(n)?n:[]):c=n&&$_(n)?n:{},z_(l,{name:r,newValue:t(m,c,i)})):typeof i<"u"&&z_(l,{name:r,newValue:i}));return l},"extend")});var j_=L((kW,hR)=>{hR.exports={name:"gaxios",version:"7.1.3",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"packages/gaxios",url:"https://github.com/googleapis/google-cloud-node-core.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.1","@types/node":"^22.0.0","@types/sinon":"^17.0.0","@types/tmp":"0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.0.0",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.0","is-docker":"^3.0.0",jsdoc:"^4.0.0","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",linkinator:"^6.1.2",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.0-beta.13","null-loader":"^4.0.0","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","stream-browserify":"^3.0.0",tmp:"0.2.5","ts-loader":"^9.5.2",typescript:"^5.8.3",webpack:"^5.35.0","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2",rimraf:"^5.0.1"},homepage:"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/gaxios"}});var L_=L(($W,M_)=>{"use strict";var gR=j_();M_.exports={pkg:gR}});var Rl=L(rr=>{"use strict";var B_=rr&&rr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rr,"__esModule",{value:!0});rr.GaxiosError=rr.GAXIOS_ERROR_SYMBOL=void 0;rr.defaultErrorRedactor=q_;var F_=B_(xl()),yR=B_(L_()),Al=yR.default.pkg;rr.GAXIOS_ERROR_SYMBOL=Symbol.for(`${Al.name}-gaxios-error`);var Il=class t extends Error{static{o(this,"GaxiosError")}config;response;code;status;error;[rr.GAXIOS_ERROR_SYMBOL]=Al.version;static[Symbol.hasInstance](e){return e&&typeof e=="object"&&rr.GAXIOS_ERROR_SYMBOL in e&&e[rr.GAXIOS_ERROR_SYMBOL]===Al.version?!0:Function.prototype[Symbol.hasInstance].call(t,e)}constructor(e,r,n,i){if(super(e,{cause:i}),this.config=r,this.response=n,this.error=i instanceof Error?i:void 0,this.config=(0,F_.default)(!0,{},r),this.response&&(this.response.config=(0,F_.default)(!0,{},this.response.config)),this.response){try{this.response.data=_R(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}i instanceof DOMException?this.code=i.name:i&&typeof i=="object"&&"code"in i&&(typeof i.code=="string"||typeof i.code=="number")&&(this.code=i.code)}static extractAPIErrorFromResponse(e,r="The request failed"){let n=r;if(typeof e.data=="string"&&(n=e.data),e.data&&typeof e.data=="object"&&"error"in e.data&&e.data.error&&!e.ok){if(typeof e.data.error=="string")return{message:e.data.error,code:e.status,status:e.statusText};if(typeof e.data.error=="object"){n="message"in e.data.error&&typeof e.data.error.message=="string"?e.data.error.message:n;let i="status"in e.data.error&&typeof e.data.error.status=="string"?e.data.error.status:e.statusText,u="code"in e.data.error&&typeof e.data.error.code=="number"?e.data.error.code:e.status;if("errors"in e.data.error&&Array.isArray(e.data.error.errors)){let c=[];for(let l of e.data.error.errors)typeof l=="object"&&"message"in l&&typeof l.message=="string"&&c.push(l.message);return Object.assign({message:c.join(`
3
+ `)||n,code:u,status:i},e.data.error)}return Object.assign({message:n,code:u,status:i},e.data.error)}}return{message:n,code:e.status,status:e.statusText}}};rr.GaxiosError=Il;function _R(t,e){switch(t){case"stream":return e;case"json":return JSON.parse(JSON.stringify(e));case"arraybuffer":return JSON.parse(Buffer.from(e).toString("utf8"));case"blob":return JSON.parse(e.text());default:return e}}o(_R,"translateData");function q_(t){let e="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";function r(u){u&&u.forEach((c,l)=>{(/^authentication$/i.test(l)||/^authorization$/i.test(l)||/secret/i.test(l))&&u.set(l,e)})}o(r,"redactHeaders");function n(u,c){if(typeof u=="object"&&u!==null&&typeof u[c]=="string"){let l=u[c];(/grant_type=/i.test(l)||/assertion=/i.test(l)||/secret/i.test(l))&&(u[c]=e)}}o(n,"redactString");function i(u){!u||typeof u!="object"||(u instanceof FormData||u instanceof URLSearchParams||"forEach"in u&&"set"in u?u.forEach((c,l)=>{(["grant_type","assertion"].includes(l)||/secret/.test(l))&&u.set(l,e)}):("grant_type"in u&&(u.grant_type=e),"assertion"in u&&(u.assertion=e),"client_secret"in u&&(u.client_secret=e)))}return o(i,"redactObject"),t.config&&(r(t.config.headers),n(t.config,"data"),i(t.config.data),n(t.config,"body"),i(t.config.body),t.config.url.searchParams.has("token")&&t.config.url.searchParams.set("token",e),t.config.url.searchParams.has("client_secret")&&t.config.url.searchParams.set("client_secret",e)),t.response&&(q_({config:t.response.config}),r(t.response.headers),t.response.bodyUsed&&(n(t.response,"data"),i(t.response.data))),t}o(q_,"defaultErrorRedactor")});var H_=L(Cl=>{"use strict";Object.defineProperty(Cl,"__esModule",{value:!0});Cl.getRetryConfig=bR;async function bR(t){let e=V_(t);if(!t||!t.config||!e&&!t.config.retry)return{shouldRetry:!1};e=e||{},e.currentRetryAttempt=e.currentRetryAttempt||0,e.retry=e.retry===void 0||e.retry===null?3:e.retry,e.httpMethodsToRetry=e.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],e.noResponseRetries=e.noResponseRetries===void 0||e.noResponseRetries===null?2:e.noResponseRetries,e.retryDelayMultiplier=e.retryDelayMultiplier?e.retryDelayMultiplier:2,e.timeOfFirstRequest=e.timeOfFirstRequest?e.timeOfFirstRequest:Date.now(),e.totalTimeout=e.totalTimeout?e.totalTimeout:Number.MAX_SAFE_INTEGER,e.maxRetryDelay=e.maxRetryDelay?e.maxRetryDelay:Number.MAX_SAFE_INTEGER;let r=[[100,199],[408,408],[429,429],[500,599]];if(e.statusCodesToRetry=e.statusCodesToRetry||r,t.config.retryConfig=e,!await(e.shouldRetry||vR)(t))return{shouldRetry:!1,config:t.config};let i=ER(e);t.config.retryConfig.currentRetryAttempt+=1;let u=e.retryBackoff?e.retryBackoff(t,i):new Promise(c=>{setTimeout(c,i)});return e.onRetryAttempt&&await e.onRetryAttempt(t),await u,{shouldRetry:!0,config:t.config}}o(bR,"getRetryConfig");function vR(t){let e=V_(t);if(t.config.signal?.aborted&&t.code!=="TimeoutError"||t.code==="AbortError"||!e||e.retry===0||!t.response&&(e.currentRetryAttempt||0)>=e.noResponseRetries||!e.httpMethodsToRetry||!e.httpMethodsToRetry.includes(t.config.method?.toUpperCase()||"GET"))return!1;if(t.response&&t.response.status){let r=!1;for(let[n,i]of e.statusCodesToRetry){let u=t.response.status;if(u>=n&&u<=i){r=!0;break}}if(!r)return!1}return e.currentRetryAttempt=e.currentRetryAttempt||0,!(e.currentRetryAttempt>=e.retry)}o(vR,"shouldRetryRequest");function V_(t){if(t&&t.config&&t.config.retryConfig)return t.config.retryConfig}o(V_,"getConfig");function ER(t){let r=(t.currentRetryAttempt?0:t.retryDelay??100)+(Math.pow(t.retryDelayMultiplier,t.currentRetryAttempt)-1)/2*1e3,n=t.totalTimeout-(Date.now()-t.timeOfFirstRequest);return Math.min(r,n,t.maxRetryDelay)}o(ER,"getNextRetryDelay")});var kl=L(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.GaxiosInterceptorManager=void 0;var Ol=class extends Set{static{o(this,"GaxiosInterceptorManager")}};xs.GaxiosInterceptorManager=Ol});var W_=L((LW,G_)=>{var ko=1e3,$o=ko*60,zo=$o*60,Hn=zo*24,PR=Hn*7,SR=Hn*365.25;G_.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return TR(t);if(r==="number"&&isFinite(t))return e.long?xR(t):wR(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function TR(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*SR;case"weeks":case"week":case"w":return r*PR;case"days":case"day":case"d":return r*Hn;case"hours":case"hour":case"hrs":case"hr":case"h":return r*zo;case"minutes":case"minute":case"mins":case"min":case"m":return r*$o;case"seconds":case"second":case"secs":case"sec":case"s":return r*ko;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}o(TR,"parse");function wR(t){var e=Math.abs(t);return e>=Hn?Math.round(t/Hn)+"d":e>=zo?Math.round(t/zo)+"h":e>=$o?Math.round(t/$o)+"m":e>=ko?Math.round(t/ko)+"s":t+"ms"}o(wR,"fmtShort");function xR(t){var e=Math.abs(t);return e>=Hn?As(t,e,Hn,"day"):e>=zo?As(t,e,zo,"hour"):e>=$o?As(t,e,$o,"minute"):e>=ko?As(t,e,ko,"second"):t+" ms"}o(xR,"fmtLong");function As(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}o(As,"plural")});var $l=L((BW,Z_)=>{function AR(t){r.debug=r,r.default=r,r.coerce=p,r.disable=c,r.enable=i,r.enabled=l,r.humanize=W_(),r.destroy=f,Object.keys(t).forEach(m=>{r[m]=t[m]}),r.names=[],r.skips=[],r.formatters={};function e(m){let y=0;for(let P=0;P<m.length;P++)y=(y<<5)-y+m.charCodeAt(P),y|=0;return r.colors[Math.abs(y)%r.colors.length]}o(e,"selectColor"),r.selectColor=e;function r(m){let y,P=null,h,b;function T(...E){if(!T.enabled)return;let w=T,k=Number(new Date),q=k-(y||k);w.diff=q,w.prev=y,w.curr=k,y=k,E[0]=r.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let W=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(V,J)=>{if(V==="%%")return"%";W++;let re=r.formatters[J];if(typeof re=="function"){let G=E[W];V=re.call(w,G),E.splice(W,1),W--}return V}),r.formatArgs.call(w,E),(w.log||r.log).apply(w,E)}return o(T,"debug"),T.namespace=m,T.useColors=r.useColors(),T.color=r.selectColor(m),T.extend=n,T.destroy=r.destroy,Object.defineProperty(T,"enabled",{enumerable:!0,configurable:!1,get:o(()=>P!==null?P:(h!==r.namespaces&&(h=r.namespaces,b=r.enabled(m)),b),"get"),set:o(E=>{P=E},"set")}),typeof r.init=="function"&&r.init(T),T}o(r,"createDebug");function n(m,y){let P=r(this.namespace+(typeof y>"u"?":":y)+m);return P.log=this.log,P}o(n,"extend");function i(m){r.save(m),r.namespaces=m,r.names=[],r.skips=[];let y=(typeof m=="string"?m:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let P of y)P[0]==="-"?r.skips.push(P.slice(1)):r.names.push(P)}o(i,"enable");function u(m,y){let P=0,h=0,b=-1,T=0;for(;P<m.length;)if(h<y.length&&(y[h]===m[P]||y[h]==="*"))y[h]==="*"?(b=h,T=P,h++):(P++,h++);else if(b!==-1)h=b+1,T++,P=T;else return!1;for(;h<y.length&&y[h]==="*";)h++;return h===y.length}o(u,"matchesTemplate");function c(){let m=[...r.names,...r.skips.map(y=>"-"+y)].join(",");return r.enable(""),m}o(c,"disable");function l(m){for(let y of r.skips)if(u(m,y))return!1;for(let y of r.names)if(u(m,y))return!0;return!1}o(l,"enabled");function p(m){return m instanceof Error?m.stack||m.message:m}o(p,"coerce");function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return o(f,"destroy"),r.enable(r.load()),r}o(AR,"setup");Z_.exports=AR});var J_=L((kt,Is)=>{kt.formatArgs=RR;kt.save=CR;kt.load=OR;kt.useColors=IR;kt.storage=kR();kt.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();kt.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function IR(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}o(IR,"useColors");function RR(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Is.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),t.splice(n,0,e)}o(RR,"formatArgs");kt.log=console.debug||console.log||(()=>{});function CR(t){try{t?kt.storage.setItem("debug",t):kt.storage.removeItem("debug")}catch{}}o(CR,"save");function OR(){let t;try{t=kt.storage.getItem("debug")||kt.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}o(OR,"load");function kR(){try{return localStorage}catch{}}o(kR,"localstorage");Is.exports=$l()(kt);var{formatters:$R}=Is.exports;$R.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Q_=L((HW,K_)=>{"use strict";K_.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),i=e.indexOf("--");return n!==-1&&(i===-1||n<i)}});var eb=L((GW,X_)=>{"use strict";var zR=require("os"),Y_=require("tty"),nr=Q_(),{env:pt}=process,xn;nr("no-color")||nr("no-colors")||nr("color=false")||nr("color=never")?xn=0:(nr("color")||nr("colors")||nr("color=true")||nr("color=always"))&&(xn=1);"FORCE_COLOR"in pt&&(pt.FORCE_COLOR==="true"?xn=1:pt.FORCE_COLOR==="false"?xn=0:xn=pt.FORCE_COLOR.length===0?1:Math.min(parseInt(pt.FORCE_COLOR,10),3));function zl(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}o(zl,"translateLevel");function Nl(t,e){if(xn===0)return 0;if(nr("color=16m")||nr("color=full")||nr("color=truecolor"))return 3;if(nr("color=256"))return 2;if(t&&!e&&xn===void 0)return 0;let r=xn||0;if(pt.TERM==="dumb")return r;if(process.platform==="win32"){let n=zR.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in pt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in pt)||pt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in pt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(pt.TEAMCITY_VERSION)?1:0;if(pt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in pt){let n=parseInt((pt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(pt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(pt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(pt.TERM)||"COLORTERM"in pt?1:r}o(Nl,"supportsColor");function NR(t){let e=Nl(t,t&&t.isTTY);return zl(e)}o(NR,"getSupportLevel");X_.exports={supportsColor:NR,stdout:zl(Nl(!0,Y_.isatty(1))),stderr:zl(Nl(!0,Y_.isatty(2)))}});var rb=L((ft,Cs)=>{var DR=require("tty"),Rs=require("util");ft.init=qR;ft.log=LR;ft.formatArgs=jR;ft.save=FR;ft.load=BR;ft.useColors=UR;ft.destroy=Rs.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");ft.colors=[6,2,3,4,5,1];try{let t=eb();t&&(t.stderr||t).level>=2&&(ft.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}ft.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,u)=>u.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),t[r]=n,t},{});function UR(){return"colors"in ft.inspectOpts?!!ft.inspectOpts.colors:DR.isatty(process.stderr.fd)}o(UR,"useColors");function jR(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),u=` ${i};1m${e} \x1B[0m`;t[0]=u+t[0].split(`
4
4
  `).join(`
5
- `+u),t.push(i+"m+"+Rs.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=RR()+e+" "+t[0]}o(IR,"formatArgs");function RR(){return pt.inspectOpts.hideDate?"":new Date().toISOString()+" "}o(RR,"getDate");function CR(...t){return process.stderr.write(Is.formatWithOptions(pt.inspectOpts,...t)+`
6
- `)}o(CR,"log");function OR(t){t?process.env.DEBUG=t:delete process.env.DEBUG}o(OR,"save");function kR(){return process.env.DEBUG}o(kR,"load");function $R(t){t.inspectOpts={};let e=Object.keys(pt.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=pt.inspectOpts[e[r]]}o($R,"init");Rs.exports=Cl()(pt);var{formatters:W_}=Rs.exports;W_.o=function(t){return this.inspectOpts.colors=this.useColors,Is.inspect(t,this.inspectOpts).split(`
7
- `).map(e=>e.trim()).join(" ")};W_.O=function(t){return this.inspectOpts.colors=this.useColors,Is.inspect(t,this.inspectOpts)}});var Nl=M((PW,$l)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?$l.exports=F_():$l.exports=Z_()});var Q_=M($t=>{"use strict";var NR=$t&&$t.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),zR=$t&&$t.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),J_=$t&&$t.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NR(e,t,r);return zR(e,t),e};Object.defineProperty($t,"__esModule",{value:!0});$t.req=$t.json=$t.toBuffer=void 0;var DR=J_(require("http")),UR=J_(require("https"));async function K_(t){let e=0,r=[];for await(let n of t)e+=n.length,r.push(n);return Buffer.concat(r,e)}o(K_,"toBuffer");$t.toBuffer=K_;async function jR(t){let r=(await K_(t)).toString("utf8");try{return JSON.parse(r)}catch(n){let i=n;throw i.message+=` (input: ${r})`,i}}o(jR,"json");$t.json=jR;function MR(t,e={}){let n=((typeof t=="string"?t:t.href).startsWith("https:")?UR:DR).request(t,e),i=new Promise((u,c)=>{n.once("response",u).once("error",c).end()});return n.then=i.then.bind(i),n}o(MR,"req");$t.req=MR});var tb=M(Bt=>{"use strict";var X_=Bt&&Bt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),LR=Bt&&Bt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),eb=Bt&&Bt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&X_(e,t,r);return LR(e,t),e},FR=Bt&&Bt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&X_(e,t,r)};Object.defineProperty(Bt,"__esModule",{value:!0});Bt.Agent=void 0;var BR=eb(require("net")),Y_=eb(require("http")),qR=require("https");FR(Q_(),Bt);var Cr=Symbol("AgentBaseInternalState"),zl=class extends Y_.Agent{static{o(this,"Agent")}constructor(e){super(e),this[Cr]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint=="boolean")return e.secureEndpoint;if(typeof e.protocol=="string")return e.protocol==="https:"}let{stack:r}=new Error;return typeof r!="string"?!1:r.split(`
8
- `).some(n=>n.indexOf("(https.js:")!==-1||n.indexOf("node:https:")!==-1)}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[e]||(this.sockets[e]=[]);let r=new BR.Socket({writable:!1});return this.sockets[e].push(r),this.totalSocketCount++,r}decrementSockets(e,r){if(!this.sockets[e]||r===null)return;let n=this.sockets[e],i=n.indexOf(r);i!==-1&&(n.splice(i,1),this.totalSocketCount--,n.length===0&&delete this.sockets[e])}getName(e){return this.isSecureEndpoint(e)?qR.Agent.prototype.getName.call(this,e):super.getName(e)}createSocket(e,r,n){let i={...r,secureEndpoint:this.isSecureEndpoint(r)},u=this.getName(i),c=this.incrementSockets(u);Promise.resolve().then(()=>this.connect(e,i)).then(l=>{if(this.decrementSockets(u,c),l instanceof Y_.Agent)try{return l.addRequest(e,i)}catch(p){return n(p)}this[Cr].currentSocket=l,super.createSocket(e,r,n)},l=>{this.decrementSockets(u,c),n(l)})}createConnection(){let e=this[Cr].currentSocket;if(this[Cr].currentSocket=void 0,!e)throw new Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[Cr].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){this[Cr]&&(this[Cr].defaultPort=e)}get protocol(){return this[Cr].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){this[Cr]&&(this[Cr].protocol=e)}};Bt.Agent=zl});var rb=M(No=>{"use strict";var VR=No&&No.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(No,"__esModule",{value:!0});No.parseProxyResponse=void 0;var HR=VR(Nl()),Cs=(0,HR.default)("https-proxy-agent:parse-proxy-response");function GR(t){return new Promise((e,r)=>{let n=0,i=[];function u(){let m=t.read();m?f(m):t.once("readable",u)}o(u,"read");function c(){t.removeListener("end",l),t.removeListener("error",p),t.removeListener("readable",u)}o(c,"cleanup");function l(){c(),Cs("onend"),r(new Error("Proxy connection ended before receiving CONNECT response"))}o(l,"onend");function p(m){c(),Cs("onerror %o",m),r(m)}o(p,"onerror");function f(m){i.push(m),n+=m.length;let g=Buffer.concat(i,n),S=g.indexOf(`\r
5
+ `+u),t.push(i+"m+"+Cs.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=MR()+e+" "+t[0]}o(jR,"formatArgs");function MR(){return ft.inspectOpts.hideDate?"":new Date().toISOString()+" "}o(MR,"getDate");function LR(...t){return process.stderr.write(Rs.formatWithOptions(ft.inspectOpts,...t)+`
6
+ `)}o(LR,"log");function FR(t){t?process.env.DEBUG=t:delete process.env.DEBUG}o(FR,"save");function BR(){return process.env.DEBUG}o(BR,"load");function qR(t){t.inspectOpts={};let e=Object.keys(ft.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=ft.inspectOpts[e[r]]}o(qR,"init");Cs.exports=$l()(ft);var{formatters:tb}=Cs.exports;tb.o=function(t){return this.inspectOpts.colors=this.useColors,Rs.inspect(t,this.inspectOpts).split(`
7
+ `).map(e=>e.trim()).join(" ")};tb.O=function(t){return this.inspectOpts.colors=this.useColors,Rs.inspect(t,this.inspectOpts)}});var Ul=L((JW,Dl)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Dl.exports=J_():Dl.exports=rb()});var ib=L($t=>{"use strict";var VR=$t&&$t.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),HR=$t&&$t.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),nb=$t&&$t.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VR(e,t,r);return HR(e,t),e};Object.defineProperty($t,"__esModule",{value:!0});$t.req=$t.json=$t.toBuffer=void 0;var GR=nb(require("http")),WR=nb(require("https"));async function ob(t){let e=0,r=[];for await(let n of t)e+=n.length,r.push(n);return Buffer.concat(r,e)}o(ob,"toBuffer");$t.toBuffer=ob;async function ZR(t){let r=(await ob(t)).toString("utf8");try{return JSON.parse(r)}catch(n){let i=n;throw i.message+=` (input: ${r})`,i}}o(ZR,"json");$t.json=ZR;function JR(t,e={}){let n=((typeof t=="string"?t:t.href).startsWith("https:")?WR:GR).request(t,e),i=new Promise((u,c)=>{n.once("response",u).once("error",c).end()});return n.then=i.then.bind(i),n}o(JR,"req");$t.req=JR});var cb=L(Bt=>{"use strict";var sb=Bt&&Bt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),KR=Bt&&Bt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),ub=Bt&&Bt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sb(e,t,r);return KR(e,t),e},QR=Bt&&Bt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sb(e,t,r)};Object.defineProperty(Bt,"__esModule",{value:!0});Bt.Agent=void 0;var YR=ub(require("net")),ab=ub(require("http")),XR=require("https");QR(ib(),Bt);var Cr=Symbol("AgentBaseInternalState"),jl=class extends ab.Agent{static{o(this,"Agent")}constructor(e){super(e),this[Cr]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint=="boolean")return e.secureEndpoint;if(typeof e.protocol=="string")return e.protocol==="https:"}let{stack:r}=new Error;return typeof r!="string"?!1:r.split(`
8
+ `).some(n=>n.indexOf("(https.js:")!==-1||n.indexOf("node:https:")!==-1)}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[e]||(this.sockets[e]=[]);let r=new YR.Socket({writable:!1});return this.sockets[e].push(r),this.totalSocketCount++,r}decrementSockets(e,r){if(!this.sockets[e]||r===null)return;let n=this.sockets[e],i=n.indexOf(r);i!==-1&&(n.splice(i,1),this.totalSocketCount--,n.length===0&&delete this.sockets[e])}getName(e){return this.isSecureEndpoint(e)?XR.Agent.prototype.getName.call(this,e):super.getName(e)}createSocket(e,r,n){let i={...r,secureEndpoint:this.isSecureEndpoint(r)},u=this.getName(i),c=this.incrementSockets(u);Promise.resolve().then(()=>this.connect(e,i)).then(l=>{if(this.decrementSockets(u,c),l instanceof ab.Agent)try{return l.addRequest(e,i)}catch(p){return n(p)}this[Cr].currentSocket=l,super.createSocket(e,r,n)},l=>{this.decrementSockets(u,c),n(l)})}createConnection(){let e=this[Cr].currentSocket;if(this[Cr].currentSocket=void 0,!e)throw new Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[Cr].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){this[Cr]&&(this[Cr].defaultPort=e)}get protocol(){return this[Cr].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){this[Cr]&&(this[Cr].protocol=e)}};Bt.Agent=jl});var lb=L(No=>{"use strict";var eC=No&&No.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(No,"__esModule",{value:!0});No.parseProxyResponse=void 0;var tC=eC(Ul()),Os=(0,tC.default)("https-proxy-agent:parse-proxy-response");function rC(t){return new Promise((e,r)=>{let n=0,i=[];function u(){let m=t.read();m?f(m):t.once("readable",u)}o(u,"read");function c(){t.removeListener("end",l),t.removeListener("error",p),t.removeListener("readable",u)}o(c,"cleanup");function l(){c(),Os("onend"),r(new Error("Proxy connection ended before receiving CONNECT response"))}o(l,"onend");function p(m){c(),Os("onerror %o",m),r(m)}o(p,"onerror");function f(m){i.push(m),n+=m.length;let y=Buffer.concat(i,n),P=y.indexOf(`\r
9
9
  \r
10
- `);if(S===-1){Cs("have not received end of HTTP headers yet..."),u();return}let h=g.slice(0,S).toString("ascii").split(`\r
11
- `),_=h.shift();if(!_)return t.destroy(),r(new Error("No header received from proxy CONNECT response"));let T=_.split(" "),E=+T[1],w=T.slice(2).join(" "),k={};for(let q of h){if(!q)continue;let G=q.indexOf(":");if(G===-1)return t.destroy(),r(new Error(`Invalid header from proxy CONNECT response: "${q}"`));let V=q.slice(0,G).toLowerCase(),H=q.slice(G+1).trimStart(),J=k[V];typeof J=="string"?k[V]=[J,H]:Array.isArray(J)?J.push(H):k[V]=H}Cs("got proxy server response: %o %o",_,k),c(),e({connect:{statusCode:E,statusText:w,headers:k},buffered:g})}o(f,"ondata"),t.on("error",p),t.on("end",l),u()})}o(GR,"parseProxyResponse");No.parseProxyResponse=GR});var ub=M(or=>{"use strict";var WR=or&&or.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),ZR=or&&or.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),ab=or&&or.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WR(e,t,r);return ZR(e,t),e},sb=or&&or.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(or,"__esModule",{value:!0});or.HttpsProxyAgent=void 0;var Os=ab(require("net")),nb=ab(require("tls")),JR=sb(require("assert")),KR=sb(Nl()),QR=tb(),YR=require("url"),XR=rb(),Mi=(0,KR.default)("https-proxy-agent"),ob=o(t=>t.servername===void 0&&t.host&&!Os.isIP(t.host)?{...t,servername:t.host}:t,"setServernameFromNonIpHost"),ks=class extends QR.Agent{static{o(this,"HttpsProxyAgent")}constructor(e,r){super(r),this.options={path:void 0},this.proxy=typeof e=="string"?new YR.URL(e):e,this.proxyHeaders=r?.headers??{},Mi("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),i=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...r?ib(r,"headers"):null,host:n,port:i}}async connect(e,r){let{proxy:n}=this;if(!r.host)throw new TypeError('No "host" provided');let i;n.protocol==="https:"?(Mi("Creating `tls.Socket`: %o",this.connectOpts),i=nb.connect(ob(this.connectOpts))):(Mi("Creating `net.Socket`: %o",this.connectOpts),i=Os.connect(this.connectOpts));let u=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},c=Os.isIPv6(r.host)?`[${r.host}]`:r.host,l=`CONNECT ${c}:${r.port} HTTP/1.1\r
12
- `;if(n.username||n.password){let S=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;u["Proxy-Authorization"]=`Basic ${Buffer.from(S).toString("base64")}`}u.Host=`${c}:${r.port}`,u["Proxy-Connection"]||(u["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let S of Object.keys(u))l+=`${S}: ${u[S]}\r
13
- `;let p=(0,XR.parseProxyResponse)(i);i.write(`${l}\r
14
- `);let{connect:f,buffered:m}=await p;if(e.emit("proxyConnect",f),this.emit("proxyConnect",f,e),f.statusCode===200)return e.once("socket",eC),r.secureEndpoint?(Mi("Upgrading socket connection to TLS"),nb.connect({...ib(ob(r),"host","path","port"),socket:i})):i;i.destroy();let g=new Os.Socket({writable:!1});return g.readable=!0,e.once("socket",S=>{Mi("Replaying proxy buffer for failed request"),(0,JR.default)(S.listenerCount("data")>0),S.push(m),S.push(null)}),g}};ks.protocols=["http","https"];or.HttpsProxyAgent=ks;function eC(t){t.resume()}o(eC,"resume");function ib(t,...e){let r={},n;for(n in t)e.includes(n)||(r[n]=t[n]);return r}o(ib,"omit")});function tC(t){if(!/^data:/i.test(t))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');t=t.replace(/\r?\n/g,"");let e=t.indexOf(",");if(e===-1||e<=4)throw new TypeError("malformed data: URI");let r=t.substring(5,e).split(";"),n="",i=!1,u=r[0]||"text/plain",c=u;for(let m=1;m<r.length;m++)r[m]==="base64"?i=!0:r[m]&&(c+=`;${r[m]}`,r[m].indexOf("charset=")===0&&(n=r[m].substring(8)));!r[0]&&!n.length&&(c+=";charset=US-ASCII",n="US-ASCII");let l=i?"base64":"ascii",p=unescape(t.substring(e+1)),f=Buffer.from(p,l);return f.type=u,f.typeFull=c,f.charset=n,f}var cb,lb=ct(()=>{o(tC,"dataUriToBuffer");cb=tC});var pb=M(($s,db)=>{(function(t,e){typeof $s=="object"&&typeof db<"u"?e($s):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.WebStreamsPolyfill={}))})($s,(function(t){"use strict";function e(){}o(e,"noop");function r(a){return typeof a=="object"&&a!==null||typeof a=="function"}o(r,"typeIsObject");let n=e;function i(a,s){try{Object.defineProperty(a,"name",{value:s,configurable:!0})}catch{}}o(i,"setFunctionName");let u=Promise,c=Promise.prototype.then,l=Promise.reject.bind(u);function p(a){return new u(a)}o(p,"newPromise");function f(a){return p(s=>s(a))}o(f,"promiseResolvedWith");function m(a){return l(a)}o(m,"promiseRejectedWith");function g(a,s,d){return c.call(a,s,d)}o(g,"PerformPromiseThen");function S(a,s,d){g(g(a,s,d),void 0,n)}o(S,"uponPromise");function h(a,s){S(a,s)}o(h,"uponFulfillment");function _(a,s){S(a,void 0,s)}o(_,"uponRejection");function T(a,s,d){return g(a,s,d)}o(T,"transformPromiseWith");function E(a){g(a,void 0,n)}o(E,"setPromiseIsHandledToTrue");let w=o(a=>{if(typeof queueMicrotask=="function")w=queueMicrotask;else{let s=f(void 0);w=o(d=>g(s,d),"_queueMicrotask")}return w(a)},"_queueMicrotask");function k(a,s,d){if(typeof a!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(a,s,d)}o(k,"reflectCall");function q(a,s,d){try{return f(k(a,s,d))}catch(v){return m(v)}}o(q,"promiseCall");let G=16384;class V{static{o(this,"SimpleQueue")}constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(s){let d=this._back,v=d;d._elements.length===G-1&&(v={_elements:[],_next:void 0}),d._elements.push(s),v!==d&&(this._back=v,d._next=v),++this._size}shift(){let s=this._front,d=s,v=this._cursor,A=v+1,U=s._elements,L=U[v];return A===G&&(d=s._next,A=0),--this._size,this._cursor=A,s!==d&&(this._front=d),U[v]=void 0,L}forEach(s){let d=this._cursor,v=this._front,A=v._elements;for(;(d!==A.length||v._next!==void 0)&&!(d===A.length&&(v=v._next,A=v._elements,d=0,A.length===0));)s(A[d]),++d}peek(){let s=this._front,d=this._cursor;return s._elements[d]}}let H=Symbol("[[AbortSteps]]"),J=Symbol("[[ErrorSteps]]"),re=Symbol("[[CancelSteps]]"),Z=Symbol("[[PullSteps]]"),ze=Symbol("[[ReleaseSteps]]");function Se(a,s){a._ownerReadableStream=s,s._reader=a,s._state==="readable"?Ve(a):s._state==="closed"?Je(a):He(a,s._storedError)}o(Se,"ReadableStreamReaderGenericInitialize");function be(a,s){let d=a._ownerReadableStream;return dr(d,s)}o(be,"ReadableStreamReaderGenericCancel");function ke(a){let s=a._ownerReadableStream;s._state==="readable"?Ut(a,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):Et(a,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),s._readableStreamController[ze](),s._reader=void 0,a._ownerReadableStream=void 0}o(ke,"ReadableStreamReaderGenericRelease");function Ie(a){return new TypeError("Cannot "+a+" a stream using a released reader")}o(Ie,"readerLockException");function Ve(a){a._closedPromise=p((s,d)=>{a._closedPromise_resolve=s,a._closedPromise_reject=d})}o(Ve,"defaultReaderClosedPromiseInitialize");function He(a,s){Ve(a),Ut(a,s)}o(He,"defaultReaderClosedPromiseInitializeAsRejected");function Je(a){Ve(a),ro(a)}o(Je,"defaultReaderClosedPromiseInitializeAsResolved");function Ut(a,s){a._closedPromise_reject!==void 0&&(E(a._closedPromise),a._closedPromise_reject(s),a._closedPromise_resolve=void 0,a._closedPromise_reject=void 0)}o(Ut,"defaultReaderClosedPromiseReject");function Et(a,s){He(a,s)}o(Et,"defaultReaderClosedPromiseResetToRejected");function ro(a){a._closedPromise_resolve!==void 0&&(a._closedPromise_resolve(void 0),a._closedPromise_resolve=void 0,a._closedPromise_reject=void 0)}o(ro,"defaultReaderClosedPromiseResolve");let wr=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},oi=Math.trunc||function(a){return a<0?Math.ceil(a):Math.floor(a)};function W(a){return typeof a=="object"||typeof a=="function"}o(W,"isDictionary");function Rt(a,s){if(a!==void 0&&!W(a))throw new TypeError(`${s} is not an object.`)}o(Rt,"assertDictionary");function St(a,s){if(typeof a!="function")throw new TypeError(`${s} is not a function.`)}o(St,"assertFunction");function ii(a){return typeof a=="object"&&a!==null||typeof a=="function"}o(ii,"isObject");function Pt(a,s){if(!ii(a))throw new TypeError(`${s} is not an object.`)}o(Pt,"assertObject");function it(a,s,d){if(a===void 0)throw new TypeError(`Parameter ${s} is required in '${d}'.`)}o(it,"assertRequiredArgument");function y(a,s,d){if(a===void 0)throw new TypeError(`${s} is required in '${d}'.`)}o(y,"assertRequiredField");function P(a){return Number(a)}o(P,"convertUnrestrictedDouble");function x(a){return a===0?0:a}o(x,"censorNegativeZero");function z(a){return x(oi(a))}o(z,"integerPart");function R(a,s){let v=Number.MAX_SAFE_INTEGER,A=Number(a);if(A=x(A),!wr(A))throw new TypeError(`${s} is not a finite number`);if(A=z(A),A<0||A>v)throw new TypeError(`${s} is outside the accepted range of 0 to ${v}, inclusive`);return!wr(A)||A===0?0:A}o(R,"convertUnsignedLongLongWithEnforceRange");function $(a,s){if(!dn(a))throw new TypeError(`${s} is not a ReadableStream.`)}o($,"assertReadableStream");function j(a){return new F(a)}o(j,"AcquireReadableStreamDefaultReader");function I(a,s){a._reader._readRequests.push(s)}o(I,"ReadableStreamAddReadRequest");function C(a,s,d){let A=a._reader._readRequests.shift();d?A._closeSteps():A._chunkSteps(s)}o(C,"ReadableStreamFulfillReadRequest");function D(a){return a._reader._readRequests.length}o(D,"ReadableStreamGetNumReadRequests");function N(a){let s=a._reader;return!(s===void 0||!Y(s))}o(N,"ReadableStreamHasDefaultReader");class F{static{o(this,"ReadableStreamDefaultReader")}constructor(s){if(it(s,1,"ReadableStreamDefaultReader"),$(s,"First parameter"),pn(s))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Se(this,s),this._readRequests=new V}get closed(){return Y(this)?this._closedPromise:m(We("closed"))}cancel(s=void 0){return Y(this)?this._ownerReadableStream===void 0?m(Ie("cancel")):be(this,s):m(We("cancel"))}read(){if(!Y(this))return m(We("read"));if(this._ownerReadableStream===void 0)return m(Ie("read from"));let s,d,v=p((U,L)=>{s=U,d=L});return te(this,{_chunkSteps:o(U=>s({value:U,done:!1}),"_chunkSteps"),_closeSteps:o(()=>s({value:void 0,done:!0}),"_closeSteps"),_errorSteps:o(U=>d(U),"_errorSteps")}),v}releaseLock(){if(!Y(this))throw We("releaseLock");this._ownerReadableStream!==void 0&&Re(this)}}Object.defineProperties(F.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),i(F.prototype.cancel,"cancel"),i(F.prototype.read,"read"),i(F.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(F.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function Y(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_readRequests")?!1:a instanceof F}o(Y,"IsReadableStreamDefaultReader");function te(a,s){let d=a._ownerReadableStream;d._disturbed=!0,d._state==="closed"?s._closeSteps():d._state==="errored"?s._errorSteps(d._storedError):d._readableStreamController[Z](s)}o(te,"ReadableStreamDefaultReaderRead");function Re(a){ke(a);let s=new TypeError("Reader was released");Ge(a,s)}o(Re,"ReadableStreamDefaultReaderRelease");function Ge(a,s){let d=a._readRequests;a._readRequests=new V,d.forEach(v=>{v._errorSteps(s)})}o(Ge,"ReadableStreamDefaultReaderErrorReadRequests");function We(a){return new TypeError(`ReadableStreamDefaultReader.prototype.${a} can only be used on a ReadableStreamDefaultReader`)}o(We,"defaultReaderBrandCheckException");let Ae=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class De{static{o(this,"ReadableStreamAsyncIteratorImpl")}constructor(s,d){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=s,this._preventCancel=d}next(){let s=o(()=>this._nextSteps(),"nextSteps");return this._ongoingPromise=this._ongoingPromise?T(this._ongoingPromise,s,s):s(),this._ongoingPromise}return(s){let d=o(()=>this._returnSteps(s),"returnSteps");return this._ongoingPromise?T(this._ongoingPromise,d,d):d()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let s=this._reader,d,v,A=p((L,Q)=>{d=L,v=Q});return te(s,{_chunkSteps:o(L=>{this._ongoingPromise=void 0,w(()=>d({value:L,done:!1}))},"_chunkSteps"),_closeSteps:o(()=>{this._ongoingPromise=void 0,this._isFinished=!0,ke(s),d({value:void 0,done:!0})},"_closeSteps"),_errorSteps:o(L=>{this._ongoingPromise=void 0,this._isFinished=!0,ke(s),v(L)},"_errorSteps")}),A}_returnSteps(s){if(this._isFinished)return Promise.resolve({value:s,done:!0});this._isFinished=!0;let d=this._reader;if(!this._preventCancel){let v=be(d,s);return ke(d),T(v,()=>({value:s,done:!0}))}return ke(d),f({value:s,done:!0})}}let at={next(){return oo(this)?this._asyncIteratorImpl.next():m(io("next"))},return(a){return oo(this)?this._asyncIteratorImpl.return(a):m(io("return"))}};Object.setPrototypeOf(at,Ae);function no(a,s){let d=j(a),v=new De(d,s),A=Object.create(at);return A._asyncIteratorImpl=v,A}o(no,"AcquireReadableStreamAsyncIterator");function oo(a){if(!r(a)||!Object.prototype.hasOwnProperty.call(a,"_asyncIteratorImpl"))return!1;try{return a._asyncIteratorImpl instanceof De}catch{return!1}}o(oo,"IsReadableStreamAsyncIterator");function io(a){return new TypeError(`ReadableStreamAsyncIterator.${a} can only be used on a ReadableSteamAsyncIterator`)}o(io,"streamAsyncIteratorBrandCheckException");let jt=Number.isNaN||function(a){return a!==a};var Fr,_t,st;function je(a){return a.slice()}o(je,"CreateArrayFromList");function Hp(a,s,d,v,A){new Uint8Array(a).set(new Uint8Array(d,v,A),s)}o(Hp,"CopyDataBlockBytes");let Br=o(a=>(typeof a.transfer=="function"?Br=o(s=>s.transfer(),"TransferArrayBuffer"):typeof structuredClone=="function"?Br=o(s=>structuredClone(s,{transfer:[s]}),"TransferArrayBuffer"):Br=o(s=>s,"TransferArrayBuffer"),Br(a)),"TransferArrayBuffer"),sn=o(a=>(typeof a.detached=="boolean"?sn=o(s=>s.detached,"IsDetachedBuffer"):sn=o(s=>s.byteLength===0,"IsDetachedBuffer"),sn(a)),"IsDetachedBuffer");function Gp(a,s,d){if(a.slice)return a.slice(s,d);let v=d-s,A=new ArrayBuffer(v);return Hp(A,0,a,s,v),A}o(Gp,"ArrayBufferSlice");function ha(a,s){let d=a[s];if(d!=null){if(typeof d!="function")throw new TypeError(`${String(s)} is not a function`);return d}}o(ha,"GetMethod");function qS(a){let s={[Symbol.iterator]:()=>a.iterator},d=(async function*(){return yield*s})(),v=d.next;return{iterator:d,nextMethod:v,done:!1}}o(qS,"CreateAsyncFromSyncIterator");let Hu=(st=(Fr=Symbol.asyncIterator)!==null&&Fr!==void 0?Fr:(_t=Symbol.for)===null||_t===void 0?void 0:_t.call(Symbol,"Symbol.asyncIterator"))!==null&&st!==void 0?st:"@@asyncIterator";function Wp(a,s="sync",d){if(d===void 0)if(s==="async"){if(d=ha(a,Hu),d===void 0){let U=ha(a,Symbol.iterator),L=Wp(a,"sync",U);return qS(L)}}else d=ha(a,Symbol.iterator);if(d===void 0)throw new TypeError("The object is not iterable");let v=k(d,a,[]);if(!r(v))throw new TypeError("The iterator method must return an object");let A=v.next;return{iterator:v,nextMethod:A,done:!1}}o(Wp,"GetIterator");function VS(a){let s=k(a.nextMethod,a.iterator,[]);if(!r(s))throw new TypeError("The iterator.next() method must return an object");return s}o(VS,"IteratorNext");function HS(a){return!!a.done}o(HS,"IteratorComplete");function GS(a){return a.value}o(GS,"IteratorValue");function WS(a){return!(typeof a!="number"||jt(a)||a<0)}o(WS,"IsNonNegativeNumber");function Zp(a){let s=Gp(a.buffer,a.byteOffset,a.byteOffset+a.byteLength);return new Uint8Array(s)}o(Zp,"CloneAsUint8Array");function Gu(a){let s=a._queue.shift();return a._queueTotalSize-=s.size,a._queueTotalSize<0&&(a._queueTotalSize=0),s.value}o(Gu,"DequeueValue");function Wu(a,s,d){if(!WS(d)||d===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");a._queue.push({value:s,size:d}),a._queueTotalSize+=d}o(Wu,"EnqueueValueWithSize");function ZS(a){return a._queue.peek().value}o(ZS,"PeekQueueValue");function un(a){a._queue=new V,a._queueTotalSize=0}o(un,"ResetQueue");function Jp(a){return a===DataView}o(Jp,"isDataViewConstructor");function JS(a){return Jp(a.constructor)}o(JS,"isDataView");function KS(a){return Jp(a)?1:a.BYTES_PER_ELEMENT}o(KS,"arrayBufferViewElementSize");class $n{static{o(this,"ReadableStreamBYOBRequest")}constructor(){throw new TypeError("Illegal constructor")}get view(){if(!Zu(this))throw Xu("view");return this._view}respond(s){if(!Zu(this))throw Xu("respond");if(it(s,1,"respond"),s=R(s,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(sn(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");ba(this._associatedReadableByteStreamController,s)}respondWithNewView(s){if(!Zu(this))throw Xu("respondWithNewView");if(it(s,1,"respondWithNewView"),!ArrayBuffer.isView(s))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(sn(s.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");va(this._associatedReadableByteStreamController,s)}}Object.defineProperties($n.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),i($n.prototype.respond,"respond"),i($n.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty($n.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class qr{static{o(this,"ReadableByteStreamController")}constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Nn(this))throw si("byobRequest");return Yu(this)}get desiredSize(){if(!Nn(this))throw si("desiredSize");return af(this)}close(){if(!Nn(this))throw si("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let s=this._controlledReadableByteStream._state;if(s!=="readable")throw new TypeError(`The stream (in ${s} state) is not in the readable state and cannot be closed`);ai(this)}enqueue(s){if(!Nn(this))throw si("enqueue");if(it(s,1,"enqueue"),!ArrayBuffer.isView(s))throw new TypeError("chunk must be an array buffer view");if(s.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(s.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let d=this._controlledReadableByteStream._state;if(d!=="readable")throw new TypeError(`The stream (in ${d} state) is not in the readable state and cannot be enqueued to`);_a(this,s)}error(s=void 0){if(!Nn(this))throw si("error");Xt(this,s)}[re](s){Kp(this),un(this);let d=this._cancelAlgorithm(s);return ya(this),d}[Z](s){let d=this._controlledReadableByteStream;if(this._queueTotalSize>0){of(this,s);return}let v=this._autoAllocateChunkSize;if(v!==void 0){let A;try{A=new ArrayBuffer(v)}catch(L){s._errorSteps(L);return}let U={buffer:A,bufferByteLength:v,byteOffset:0,byteLength:v,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(U)}I(d,s),zn(this)}[ze](){if(this._pendingPullIntos.length>0){let s=this._pendingPullIntos.peek();s.readerType="none",this._pendingPullIntos=new V,this._pendingPullIntos.push(s)}}}Object.defineProperties(qr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),i(qr.prototype.close,"close"),i(qr.prototype.enqueue,"enqueue"),i(qr.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(qr.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function Nn(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_controlledReadableByteStream")?!1:a instanceof qr}o(Nn,"IsReadableByteStreamController");function Zu(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_associatedReadableByteStreamController")?!1:a instanceof $n}o(Zu,"IsReadableStreamBYOBRequest");function zn(a){if(!tP(a))return;if(a._pulling){a._pullAgain=!0;return}a._pulling=!0;let d=a._pullAlgorithm();S(d,()=>(a._pulling=!1,a._pullAgain&&(a._pullAgain=!1,zn(a)),null),v=>(Xt(a,v),null))}o(zn,"ReadableByteStreamControllerCallPullIfNeeded");function Kp(a){Ku(a),a._pendingPullIntos=new V}o(Kp,"ReadableByteStreamControllerClearPendingPullIntos");function Ju(a,s){let d=!1;a._state==="closed"&&(d=!0);let v=Qp(s);s.readerType==="default"?C(a,v,d):sP(a,v,d)}o(Ju,"ReadableByteStreamControllerCommitPullIntoDescriptor");function Qp(a){let s=a.bytesFilled,d=a.elementSize;return new a.viewConstructor(a.buffer,a.byteOffset,s/d)}o(Qp,"ReadableByteStreamControllerConvertPullIntoDescriptor");function ga(a,s,d,v){a._queue.push({buffer:s,byteOffset:d,byteLength:v}),a._queueTotalSize+=v}o(ga,"ReadableByteStreamControllerEnqueueChunkToQueue");function Yp(a,s,d,v){let A;try{A=Gp(s,d,d+v)}catch(U){throw Xt(a,U),U}ga(a,A,0,v)}o(Yp,"ReadableByteStreamControllerEnqueueClonedChunkToQueue");function Xp(a,s){s.bytesFilled>0&&Yp(a,s.buffer,s.byteOffset,s.bytesFilled),ao(a)}o(Xp,"ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue");function ef(a,s){let d=Math.min(a._queueTotalSize,s.byteLength-s.bytesFilled),v=s.bytesFilled+d,A=d,U=!1,L=v%s.elementSize,Q=v-L;Q>=s.minimumFill&&(A=Q-s.bytesFilled,U=!0);let ue=a._queue;for(;A>0;){let oe=ue.peek(),he=Math.min(A,oe.byteLength),ve=s.byteOffset+s.bytesFilled;Hp(s.buffer,ve,oe.buffer,oe.byteOffset,he),oe.byteLength===he?ue.shift():(oe.byteOffset+=he,oe.byteLength-=he),a._queueTotalSize-=he,tf(a,he,s),A-=he}return U}o(ef,"ReadableByteStreamControllerFillPullIntoDescriptorFromQueue");function tf(a,s,d){d.bytesFilled+=s}o(tf,"ReadableByteStreamControllerFillHeadPullIntoDescriptor");function rf(a){a._queueTotalSize===0&&a._closeRequested?(ya(a),fi(a._controlledReadableByteStream)):zn(a)}o(rf,"ReadableByteStreamControllerHandleQueueDrain");function Ku(a){a._byobRequest!==null&&(a._byobRequest._associatedReadableByteStreamController=void 0,a._byobRequest._view=null,a._byobRequest=null)}o(Ku,"ReadableByteStreamControllerInvalidateBYOBRequest");function Qu(a){for(;a._pendingPullIntos.length>0;){if(a._queueTotalSize===0)return;let s=a._pendingPullIntos.peek();ef(a,s)&&(ao(a),Ju(a._controlledReadableByteStream,s))}}o(Qu,"ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue");function QS(a){let s=a._controlledReadableByteStream._reader;for(;s._readRequests.length>0;){if(a._queueTotalSize===0)return;let d=s._readRequests.shift();of(a,d)}}o(QS,"ReadableByteStreamControllerProcessReadRequestsUsingQueue");function YS(a,s,d,v){let A=a._controlledReadableByteStream,U=s.constructor,L=KS(U),{byteOffset:Q,byteLength:ue}=s,oe=d*L,he;try{he=Br(s.buffer)}catch(Le){v._errorSteps(Le);return}let ve={buffer:he,bufferByteLength:he.byteLength,byteOffset:Q,byteLength:ue,bytesFilled:0,minimumFill:oe,elementSize:L,viewConstructor:U,readerType:"byob"};if(a._pendingPullIntos.length>0){a._pendingPullIntos.push(ve),cf(A,v);return}if(A._state==="closed"){let Le=new U(ve.buffer,ve.byteOffset,0);v._closeSteps(Le);return}if(a._queueTotalSize>0){if(ef(a,ve)){let Le=Qp(ve);rf(a),v._chunkSteps(Le);return}if(a._closeRequested){let Le=new TypeError("Insufficient bytes to fill elements in the given buffer");Xt(a,Le),v._errorSteps(Le);return}}a._pendingPullIntos.push(ve),cf(A,v),zn(a)}o(YS,"ReadableByteStreamControllerPullInto");function XS(a,s){s.readerType==="none"&&ao(a);let d=a._controlledReadableByteStream;if(ec(d))for(;lf(d)>0;){let v=ao(a);Ju(d,v)}}o(XS,"ReadableByteStreamControllerRespondInClosedState");function eP(a,s,d){if(tf(a,s,d),d.readerType==="none"){Xp(a,d),Qu(a);return}if(d.bytesFilled<d.minimumFill)return;ao(a);let v=d.bytesFilled%d.elementSize;if(v>0){let A=d.byteOffset+d.bytesFilled;Yp(a,d.buffer,A-v,v)}d.bytesFilled-=v,Ju(a._controlledReadableByteStream,d),Qu(a)}o(eP,"ReadableByteStreamControllerRespondInReadableState");function nf(a,s){let d=a._pendingPullIntos.peek();Ku(a),a._controlledReadableByteStream._state==="closed"?XS(a,d):eP(a,s,d),zn(a)}o(nf,"ReadableByteStreamControllerRespondInternal");function ao(a){return a._pendingPullIntos.shift()}o(ao,"ReadableByteStreamControllerShiftPendingPullInto");function tP(a){let s=a._controlledReadableByteStream;return s._state!=="readable"||a._closeRequested||!a._started?!1:!!(N(s)&&D(s)>0||ec(s)&&lf(s)>0||af(a)>0)}o(tP,"ReadableByteStreamControllerShouldCallPull");function ya(a){a._pullAlgorithm=void 0,a._cancelAlgorithm=void 0}o(ya,"ReadableByteStreamControllerClearAlgorithms");function ai(a){let s=a._controlledReadableByteStream;if(!(a._closeRequested||s._state!=="readable")){if(a._queueTotalSize>0){a._closeRequested=!0;return}if(a._pendingPullIntos.length>0){let d=a._pendingPullIntos.peek();if(d.bytesFilled%d.elementSize!==0){let v=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Xt(a,v),v}}ya(a),fi(s)}}o(ai,"ReadableByteStreamControllerClose");function _a(a,s){let d=a._controlledReadableByteStream;if(a._closeRequested||d._state!=="readable")return;let{buffer:v,byteOffset:A,byteLength:U}=s;if(sn(v))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");let L=Br(v);if(a._pendingPullIntos.length>0){let Q=a._pendingPullIntos.peek();if(sn(Q.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");Ku(a),Q.buffer=Br(Q.buffer),Q.readerType==="none"&&Xp(a,Q)}if(N(d))if(QS(a),D(d)===0)ga(a,L,A,U);else{a._pendingPullIntos.length>0&&ao(a);let Q=new Uint8Array(L,A,U);C(d,Q,!1)}else ec(d)?(ga(a,L,A,U),Qu(a)):ga(a,L,A,U);zn(a)}o(_a,"ReadableByteStreamControllerEnqueue");function Xt(a,s){let d=a._controlledReadableByteStream;d._state==="readable"&&(Kp(a),un(a),ya(a),Nf(d,s))}o(Xt,"ReadableByteStreamControllerError");function of(a,s){let d=a._queue.shift();a._queueTotalSize-=d.byteLength,rf(a);let v=new Uint8Array(d.buffer,d.byteOffset,d.byteLength);s._chunkSteps(v)}o(of,"ReadableByteStreamControllerFillReadRequestFromQueue");function Yu(a){if(a._byobRequest===null&&a._pendingPullIntos.length>0){let s=a._pendingPullIntos.peek(),d=new Uint8Array(s.buffer,s.byteOffset+s.bytesFilled,s.byteLength-s.bytesFilled),v=Object.create($n.prototype);nP(v,a,d),a._byobRequest=v}return a._byobRequest}o(Yu,"ReadableByteStreamControllerGetBYOBRequest");function af(a){let s=a._controlledReadableByteStream._state;return s==="errored"?null:s==="closed"?0:a._strategyHWM-a._queueTotalSize}o(af,"ReadableByteStreamControllerGetDesiredSize");function ba(a,s){let d=a._pendingPullIntos.peek();if(a._controlledReadableByteStream._state==="closed"){if(s!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(s===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(d.bytesFilled+s>d.byteLength)throw new RangeError("bytesWritten out of range")}d.buffer=Br(d.buffer),nf(a,s)}o(ba,"ReadableByteStreamControllerRespond");function va(a,s){let d=a._pendingPullIntos.peek();if(a._controlledReadableByteStream._state==="closed"){if(s.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(s.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(d.byteOffset+d.bytesFilled!==s.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(d.bufferByteLength!==s.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(d.bytesFilled+s.byteLength>d.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let A=s.byteLength;d.buffer=Br(s.buffer),nf(a,A)}o(va,"ReadableByteStreamControllerRespondWithNewView");function sf(a,s,d,v,A,U,L){s._controlledReadableByteStream=a,s._pullAgain=!1,s._pulling=!1,s._byobRequest=null,s._queue=s._queueTotalSize=void 0,un(s),s._closeRequested=!1,s._started=!1,s._strategyHWM=U,s._pullAlgorithm=v,s._cancelAlgorithm=A,s._autoAllocateChunkSize=L,s._pendingPullIntos=new V,a._readableStreamController=s;let Q=d();S(f(Q),()=>(s._started=!0,zn(s),null),ue=>(Xt(s,ue),null))}o(sf,"SetUpReadableByteStreamController");function rP(a,s,d){let v=Object.create(qr.prototype),A,U,L;s.start!==void 0?A=o(()=>s.start(v),"startAlgorithm"):A=o(()=>{},"startAlgorithm"),s.pull!==void 0?U=o(()=>s.pull(v),"pullAlgorithm"):U=o(()=>f(void 0),"pullAlgorithm"),s.cancel!==void 0?L=o(ue=>s.cancel(ue),"cancelAlgorithm"):L=o(()=>f(void 0),"cancelAlgorithm");let Q=s.autoAllocateChunkSize;if(Q===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");sf(a,v,A,U,L,d,Q)}o(rP,"SetUpReadableByteStreamControllerFromUnderlyingSource");function nP(a,s,d){a._associatedReadableByteStreamController=s,a._view=d}o(nP,"SetUpReadableStreamBYOBRequest");function Xu(a){return new TypeError(`ReadableStreamBYOBRequest.prototype.${a} can only be used on a ReadableStreamBYOBRequest`)}o(Xu,"byobRequestBrandCheckException");function si(a){return new TypeError(`ReadableByteStreamController.prototype.${a} can only be used on a ReadableByteStreamController`)}o(si,"byteStreamControllerBrandCheckException");function oP(a,s){Rt(a,s);let d=a?.mode;return{mode:d===void 0?void 0:iP(d,`${s} has member 'mode' that`)}}o(oP,"convertReaderOptions");function iP(a,s){if(a=`${a}`,a!=="byob")throw new TypeError(`${s} '${a}' is not a valid enumeration value for ReadableStreamReaderMode`);return a}o(iP,"convertReadableStreamReaderMode");function aP(a,s){var d;Rt(a,s);let v=(d=a?.min)!==null&&d!==void 0?d:1;return{min:R(v,`${s} has member 'min' that`)}}o(aP,"convertByobReadOptions");function uf(a){return new cn(a)}o(uf,"AcquireReadableStreamBYOBReader");function cf(a,s){a._reader._readIntoRequests.push(s)}o(cf,"ReadableStreamAddReadIntoRequest");function sP(a,s,d){let A=a._reader._readIntoRequests.shift();d?A._closeSteps(s):A._chunkSteps(s)}o(sP,"ReadableStreamFulfillReadIntoRequest");function lf(a){return a._reader._readIntoRequests.length}o(lf,"ReadableStreamGetNumReadIntoRequests");function ec(a){let s=a._reader;return!(s===void 0||!Dn(s))}o(ec,"ReadableStreamHasBYOBReader");class cn{static{o(this,"ReadableStreamBYOBReader")}constructor(s){if(it(s,1,"ReadableStreamBYOBReader"),$(s,"First parameter"),pn(s))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Nn(s._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Se(this,s),this._readIntoRequests=new V}get closed(){return Dn(this)?this._closedPromise:m(Ea("closed"))}cancel(s=void 0){return Dn(this)?this._ownerReadableStream===void 0?m(Ie("cancel")):be(this,s):m(Ea("cancel"))}read(s,d={}){if(!Dn(this))return m(Ea("read"));if(!ArrayBuffer.isView(s))return m(new TypeError("view must be an array buffer view"));if(s.byteLength===0)return m(new TypeError("view must have non-zero byteLength"));if(s.buffer.byteLength===0)return m(new TypeError("view's buffer must have non-zero byteLength"));if(sn(s.buffer))return m(new TypeError("view's buffer has been detached"));let v;try{v=aP(d,"options")}catch(oe){return m(oe)}let A=v.min;if(A===0)return m(new TypeError("options.min must be greater than 0"));if(JS(s)){if(A>s.byteLength)return m(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(A>s.length)return m(new RangeError("options.min must be less than or equal to view's length"));if(this._ownerReadableStream===void 0)return m(Ie("read from"));let U,L,Q=p((oe,he)=>{U=oe,L=he});return df(this,s,A,{_chunkSteps:o(oe=>U({value:oe,done:!1}),"_chunkSteps"),_closeSteps:o(oe=>U({value:oe,done:!0}),"_closeSteps"),_errorSteps:o(oe=>L(oe),"_errorSteps")}),Q}releaseLock(){if(!Dn(this))throw Ea("releaseLock");this._ownerReadableStream!==void 0&&uP(this)}}Object.defineProperties(cn.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),i(cn.prototype.cancel,"cancel"),i(cn.prototype.read,"read"),i(cn.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(cn.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function Dn(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_readIntoRequests")?!1:a instanceof cn}o(Dn,"IsReadableStreamBYOBReader");function df(a,s,d,v){let A=a._ownerReadableStream;A._disturbed=!0,A._state==="errored"?v._errorSteps(A._storedError):YS(A._readableStreamController,s,d,v)}o(df,"ReadableStreamBYOBReaderRead");function uP(a){ke(a);let s=new TypeError("Reader was released");pf(a,s)}o(uP,"ReadableStreamBYOBReaderRelease");function pf(a,s){let d=a._readIntoRequests;a._readIntoRequests=new V,d.forEach(v=>{v._errorSteps(s)})}o(pf,"ReadableStreamBYOBReaderErrorReadIntoRequests");function Ea(a){return new TypeError(`ReadableStreamBYOBReader.prototype.${a} can only be used on a ReadableStreamBYOBReader`)}o(Ea,"byobReaderBrandCheckException");function ui(a,s){let{highWaterMark:d}=a;if(d===void 0)return s;if(jt(d)||d<0)throw new RangeError("Invalid highWaterMark");return d}o(ui,"ExtractHighWaterMark");function Sa(a){let{size:s}=a;return s||(()=>1)}o(Sa,"ExtractSizeAlgorithm");function Pa(a,s){Rt(a,s);let d=a?.highWaterMark,v=a?.size;return{highWaterMark:d===void 0?void 0:P(d),size:v===void 0?void 0:cP(v,`${s} has member 'size' that`)}}o(Pa,"convertQueuingStrategy");function cP(a,s){return St(a,s),d=>P(a(d))}o(cP,"convertQueuingStrategySize");function lP(a,s){Rt(a,s);let d=a?.abort,v=a?.close,A=a?.start,U=a?.type,L=a?.write;return{abort:d===void 0?void 0:dP(d,a,`${s} has member 'abort' that`),close:v===void 0?void 0:pP(v,a,`${s} has member 'close' that`),start:A===void 0?void 0:fP(A,a,`${s} has member 'start' that`),write:L===void 0?void 0:mP(L,a,`${s} has member 'write' that`),type:U}}o(lP,"convertUnderlyingSink");function dP(a,s,d){return St(a,d),v=>q(a,s,[v])}o(dP,"convertUnderlyingSinkAbortCallback");function pP(a,s,d){return St(a,d),()=>q(a,s,[])}o(pP,"convertUnderlyingSinkCloseCallback");function fP(a,s,d){return St(a,d),v=>k(a,s,[v])}o(fP,"convertUnderlyingSinkStartCallback");function mP(a,s,d){return St(a,d),(v,A)=>q(a,s,[v,A])}o(mP,"convertUnderlyingSinkWriteCallback");function ff(a,s){if(!so(a))throw new TypeError(`${s} is not a WritableStream.`)}o(ff,"assertWritableStream");function hP(a){if(typeof a!="object"||a===null)return!1;try{return typeof a.aborted=="boolean"}catch{return!1}}o(hP,"isAbortSignal");let gP=typeof AbortController=="function";function yP(){if(gP)return new AbortController}o(yP,"createAbortController");class ln{static{o(this,"WritableStream")}constructor(s={},d={}){s===void 0?s=null:Pt(s,"First parameter");let v=Pa(d,"Second parameter"),A=lP(s,"First parameter");if(hf(this),A.type!==void 0)throw new RangeError("Invalid type is specified");let L=Sa(v),Q=ui(v,1);OP(this,A,Q,L)}get locked(){if(!so(this))throw Ia("locked");return uo(this)}abort(s=void 0){return so(this)?uo(this)?m(new TypeError("Cannot abort a stream that already has a writer")):Ta(this,s):m(Ia("abort"))}close(){return so(this)?uo(this)?m(new TypeError("Cannot close a stream that already has a writer")):xr(this)?m(new TypeError("Cannot close an already-closing stream")):gf(this):m(Ia("close"))}getWriter(){if(!so(this))throw Ia("getWriter");return mf(this)}}Object.defineProperties(ln.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),i(ln.prototype.abort,"abort"),i(ln.prototype.close,"close"),i(ln.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ln.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});function mf(a){return new Vr(a)}o(mf,"AcquireWritableStreamDefaultWriter");function _P(a,s,d,v,A=1,U=()=>1){let L=Object.create(ln.prototype);hf(L);let Q=Object.create(co.prototype);return Sf(L,Q,a,s,d,v,A,U),L}o(_P,"CreateWritableStream");function hf(a){a._state="writable",a._storedError=void 0,a._writer=void 0,a._writableStreamController=void 0,a._writeRequests=new V,a._inFlightWriteRequest=void 0,a._closeRequest=void 0,a._inFlightCloseRequest=void 0,a._pendingAbortRequest=void 0,a._backpressure=!1}o(hf,"InitializeWritableStream");function so(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_writableStreamController")?!1:a instanceof ln}o(so,"IsWritableStream");function uo(a){return a._writer!==void 0}o(uo,"IsWritableStreamLocked");function Ta(a,s){var d;if(a._state==="closed"||a._state==="errored")return f(void 0);a._writableStreamController._abortReason=s,(d=a._writableStreamController._abortController)===null||d===void 0||d.abort(s);let v=a._state;if(v==="closed"||v==="errored")return f(void 0);if(a._pendingAbortRequest!==void 0)return a._pendingAbortRequest._promise;let A=!1;v==="erroring"&&(A=!0,s=void 0);let U=p((L,Q)=>{a._pendingAbortRequest={_promise:void 0,_resolve:L,_reject:Q,_reason:s,_wasAlreadyErroring:A}});return a._pendingAbortRequest._promise=U,A||rc(a,s),U}o(Ta,"WritableStreamAbort");function gf(a){let s=a._state;if(s==="closed"||s==="errored")return m(new TypeError(`The stream (in ${s} state) is not in the writable state and cannot be closed`));let d=p((A,U)=>{let L={_resolve:A,_reject:U};a._closeRequest=L}),v=a._writer;return v!==void 0&&a._backpressure&&s==="writable"&&lc(v),kP(a._writableStreamController),d}o(gf,"WritableStreamClose");function bP(a){return p((d,v)=>{let A={_resolve:d,_reject:v};a._writeRequests.push(A)})}o(bP,"WritableStreamAddWriteRequest");function tc(a,s){if(a._state==="writable"){rc(a,s);return}nc(a)}o(tc,"WritableStreamDealWithRejection");function rc(a,s){let d=a._writableStreamController;a._state="erroring",a._storedError=s;let v=a._writer;v!==void 0&&_f(v,s),!TP(a)&&d._started&&nc(a)}o(rc,"WritableStreamStartErroring");function nc(a){a._state="errored",a._writableStreamController[J]();let s=a._storedError;if(a._writeRequests.forEach(A=>{A._reject(s)}),a._writeRequests=new V,a._pendingAbortRequest===void 0){wa(a);return}let d=a._pendingAbortRequest;if(a._pendingAbortRequest=void 0,d._wasAlreadyErroring){d._reject(s),wa(a);return}let v=a._writableStreamController[H](d._reason);S(v,()=>(d._resolve(),wa(a),null),A=>(d._reject(A),wa(a),null))}o(nc,"WritableStreamFinishErroring");function vP(a){a._inFlightWriteRequest._resolve(void 0),a._inFlightWriteRequest=void 0}o(vP,"WritableStreamFinishInFlightWrite");function EP(a,s){a._inFlightWriteRequest._reject(s),a._inFlightWriteRequest=void 0,tc(a,s)}o(EP,"WritableStreamFinishInFlightWriteWithError");function SP(a){a._inFlightCloseRequest._resolve(void 0),a._inFlightCloseRequest=void 0,a._state==="erroring"&&(a._storedError=void 0,a._pendingAbortRequest!==void 0&&(a._pendingAbortRequest._resolve(),a._pendingAbortRequest=void 0)),a._state="closed";let d=a._writer;d!==void 0&&xf(d)}o(SP,"WritableStreamFinishInFlightClose");function PP(a,s){a._inFlightCloseRequest._reject(s),a._inFlightCloseRequest=void 0,a._pendingAbortRequest!==void 0&&(a._pendingAbortRequest._reject(s),a._pendingAbortRequest=void 0),tc(a,s)}o(PP,"WritableStreamFinishInFlightCloseWithError");function xr(a){return!(a._closeRequest===void 0&&a._inFlightCloseRequest===void 0)}o(xr,"WritableStreamCloseQueuedOrInFlight");function TP(a){return!(a._inFlightWriteRequest===void 0&&a._inFlightCloseRequest===void 0)}o(TP,"WritableStreamHasOperationMarkedInFlight");function wP(a){a._inFlightCloseRequest=a._closeRequest,a._closeRequest=void 0}o(wP,"WritableStreamMarkCloseRequestInFlight");function xP(a){a._inFlightWriteRequest=a._writeRequests.shift()}o(xP,"WritableStreamMarkFirstWriteRequestInFlight");function wa(a){a._closeRequest!==void 0&&(a._closeRequest._reject(a._storedError),a._closeRequest=void 0);let s=a._writer;s!==void 0&&uc(s,a._storedError)}o(wa,"WritableStreamRejectCloseAndClosedPromiseIfNeeded");function oc(a,s){let d=a._writer;d!==void 0&&s!==a._backpressure&&(s?MP(d):lc(d)),a._backpressure=s}o(oc,"WritableStreamUpdateBackpressure");class Vr{static{o(this,"WritableStreamDefaultWriter")}constructor(s){if(it(s,1,"WritableStreamDefaultWriter"),ff(s,"First parameter"),uo(s))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=s,s._writer=this;let d=s._state;if(d==="writable")!xr(s)&&s._backpressure?Ca(this):Af(this),Ra(this);else if(d==="erroring")cc(this,s._storedError),Ra(this);else if(d==="closed")Af(this),UP(this);else{let v=s._storedError;cc(this,v),wf(this,v)}}get closed(){return Un(this)?this._closedPromise:m(jn("closed"))}get desiredSize(){if(!Un(this))throw jn("desiredSize");if(this._ownerWritableStream===void 0)throw li("desiredSize");return CP(this)}get ready(){return Un(this)?this._readyPromise:m(jn("ready"))}abort(s=void 0){return Un(this)?this._ownerWritableStream===void 0?m(li("abort")):AP(this,s):m(jn("abort"))}close(){if(!Un(this))return m(jn("close"));let s=this._ownerWritableStream;return s===void 0?m(li("close")):xr(s)?m(new TypeError("Cannot close an already-closing stream")):yf(this)}releaseLock(){if(!Un(this))throw jn("releaseLock");this._ownerWritableStream!==void 0&&bf(this)}write(s=void 0){return Un(this)?this._ownerWritableStream===void 0?m(li("write to")):vf(this,s):m(jn("write"))}}Object.defineProperties(Vr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),i(Vr.prototype.abort,"abort"),i(Vr.prototype.close,"close"),i(Vr.prototype.releaseLock,"releaseLock"),i(Vr.prototype.write,"write"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Vr.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function Un(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_ownerWritableStream")?!1:a instanceof Vr}o(Un,"IsWritableStreamDefaultWriter");function AP(a,s){let d=a._ownerWritableStream;return Ta(d,s)}o(AP,"WritableStreamDefaultWriterAbort");function yf(a){let s=a._ownerWritableStream;return gf(s)}o(yf,"WritableStreamDefaultWriterClose");function IP(a){let s=a._ownerWritableStream,d=s._state;return xr(s)||d==="closed"?f(void 0):d==="errored"?m(s._storedError):yf(a)}o(IP,"WritableStreamDefaultWriterCloseWithErrorPropagation");function RP(a,s){a._closedPromiseState==="pending"?uc(a,s):jP(a,s)}o(RP,"WritableStreamDefaultWriterEnsureClosedPromiseRejected");function _f(a,s){a._readyPromiseState==="pending"?If(a,s):LP(a,s)}o(_f,"WritableStreamDefaultWriterEnsureReadyPromiseRejected");function CP(a){let s=a._ownerWritableStream,d=s._state;return d==="errored"||d==="erroring"?null:d==="closed"?0:Pf(s._writableStreamController)}o(CP,"WritableStreamDefaultWriterGetDesiredSize");function bf(a){let s=a._ownerWritableStream,d=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");_f(a,d),RP(a,d),s._writer=void 0,a._ownerWritableStream=void 0}o(bf,"WritableStreamDefaultWriterRelease");function vf(a,s){let d=a._ownerWritableStream,v=d._writableStreamController,A=$P(v,s);if(d!==a._ownerWritableStream)return m(li("write to"));let U=d._state;if(U==="errored")return m(d._storedError);if(xr(d)||U==="closed")return m(new TypeError("The stream is closing or closed and cannot be written to"));if(U==="erroring")return m(d._storedError);let L=bP(d);return NP(v,s,A),L}o(vf,"WritableStreamDefaultWriterWrite");let Ef={};class co{static{o(this,"WritableStreamDefaultController")}constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!ic(this))throw sc("abortReason");return this._abortReason}get signal(){if(!ic(this))throw sc("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(s=void 0){if(!ic(this))throw sc("error");this._controlledWritableStream._state==="writable"&&Tf(this,s)}[H](s){let d=this._abortAlgorithm(s);return xa(this),d}[J](){un(this)}}Object.defineProperties(co.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(co.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function ic(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_controlledWritableStream")?!1:a instanceof co}o(ic,"IsWritableStreamDefaultController");function Sf(a,s,d,v,A,U,L,Q){s._controlledWritableStream=a,a._writableStreamController=s,s._queue=void 0,s._queueTotalSize=void 0,un(s),s._abortReason=void 0,s._abortController=yP(),s._started=!1,s._strategySizeAlgorithm=Q,s._strategyHWM=L,s._writeAlgorithm=v,s._closeAlgorithm=A,s._abortAlgorithm=U;let ue=ac(s);oc(a,ue);let oe=d(),he=f(oe);S(he,()=>(s._started=!0,Aa(s),null),ve=>(s._started=!0,tc(a,ve),null))}o(Sf,"SetUpWritableStreamDefaultController");function OP(a,s,d,v){let A=Object.create(co.prototype),U,L,Q,ue;s.start!==void 0?U=o(()=>s.start(A),"startAlgorithm"):U=o(()=>{},"startAlgorithm"),s.write!==void 0?L=o(oe=>s.write(oe,A),"writeAlgorithm"):L=o(()=>f(void 0),"writeAlgorithm"),s.close!==void 0?Q=o(()=>s.close(),"closeAlgorithm"):Q=o(()=>f(void 0),"closeAlgorithm"),s.abort!==void 0?ue=o(oe=>s.abort(oe),"abortAlgorithm"):ue=o(()=>f(void 0),"abortAlgorithm"),Sf(a,A,U,L,Q,ue,d,v)}o(OP,"SetUpWritableStreamDefaultControllerFromUnderlyingSink");function xa(a){a._writeAlgorithm=void 0,a._closeAlgorithm=void 0,a._abortAlgorithm=void 0,a._strategySizeAlgorithm=void 0}o(xa,"WritableStreamDefaultControllerClearAlgorithms");function kP(a){Wu(a,Ef,0),Aa(a)}o(kP,"WritableStreamDefaultControllerClose");function $P(a,s){try{return a._strategySizeAlgorithm(s)}catch(d){return ci(a,d),1}}o($P,"WritableStreamDefaultControllerGetChunkSize");function Pf(a){return a._strategyHWM-a._queueTotalSize}o(Pf,"WritableStreamDefaultControllerGetDesiredSize");function NP(a,s,d){try{Wu(a,s,d)}catch(A){ci(a,A);return}let v=a._controlledWritableStream;if(!xr(v)&&v._state==="writable"){let A=ac(a);oc(v,A)}Aa(a)}o(NP,"WritableStreamDefaultControllerWrite");function Aa(a){let s=a._controlledWritableStream;if(!a._started||s._inFlightWriteRequest!==void 0)return;if(s._state==="erroring"){nc(s);return}if(a._queue.length===0)return;let v=ZS(a);v===Ef?zP(a):DP(a,v)}o(Aa,"WritableStreamDefaultControllerAdvanceQueueIfNeeded");function ci(a,s){a._controlledWritableStream._state==="writable"&&Tf(a,s)}o(ci,"WritableStreamDefaultControllerErrorIfNeeded");function zP(a){let s=a._controlledWritableStream;wP(s),Gu(a);let d=a._closeAlgorithm();xa(a),S(d,()=>(SP(s),null),v=>(PP(s,v),null))}o(zP,"WritableStreamDefaultControllerProcessClose");function DP(a,s){let d=a._controlledWritableStream;xP(d);let v=a._writeAlgorithm(s);S(v,()=>{vP(d);let A=d._state;if(Gu(a),!xr(d)&&A==="writable"){let U=ac(a);oc(d,U)}return Aa(a),null},A=>(d._state==="writable"&&xa(a),EP(d,A),null))}o(DP,"WritableStreamDefaultControllerProcessWrite");function ac(a){return Pf(a)<=0}o(ac,"WritableStreamDefaultControllerGetBackpressure");function Tf(a,s){let d=a._controlledWritableStream;xa(a),rc(d,s)}o(Tf,"WritableStreamDefaultControllerError");function Ia(a){return new TypeError(`WritableStream.prototype.${a} can only be used on a WritableStream`)}o(Ia,"streamBrandCheckException$2");function sc(a){return new TypeError(`WritableStreamDefaultController.prototype.${a} can only be used on a WritableStreamDefaultController`)}o(sc,"defaultControllerBrandCheckException$2");function jn(a){return new TypeError(`WritableStreamDefaultWriter.prototype.${a} can only be used on a WritableStreamDefaultWriter`)}o(jn,"defaultWriterBrandCheckException");function li(a){return new TypeError("Cannot "+a+" a stream using a released writer")}o(li,"defaultWriterLockException");function Ra(a){a._closedPromise=p((s,d)=>{a._closedPromise_resolve=s,a._closedPromise_reject=d,a._closedPromiseState="pending"})}o(Ra,"defaultWriterClosedPromiseInitialize");function wf(a,s){Ra(a),uc(a,s)}o(wf,"defaultWriterClosedPromiseInitializeAsRejected");function UP(a){Ra(a),xf(a)}o(UP,"defaultWriterClosedPromiseInitializeAsResolved");function uc(a,s){a._closedPromise_reject!==void 0&&(E(a._closedPromise),a._closedPromise_reject(s),a._closedPromise_resolve=void 0,a._closedPromise_reject=void 0,a._closedPromiseState="rejected")}o(uc,"defaultWriterClosedPromiseReject");function jP(a,s){wf(a,s)}o(jP,"defaultWriterClosedPromiseResetToRejected");function xf(a){a._closedPromise_resolve!==void 0&&(a._closedPromise_resolve(void 0),a._closedPromise_resolve=void 0,a._closedPromise_reject=void 0,a._closedPromiseState="resolved")}o(xf,"defaultWriterClosedPromiseResolve");function Ca(a){a._readyPromise=p((s,d)=>{a._readyPromise_resolve=s,a._readyPromise_reject=d}),a._readyPromiseState="pending"}o(Ca,"defaultWriterReadyPromiseInitialize");function cc(a,s){Ca(a),If(a,s)}o(cc,"defaultWriterReadyPromiseInitializeAsRejected");function Af(a){Ca(a),lc(a)}o(Af,"defaultWriterReadyPromiseInitializeAsResolved");function If(a,s){a._readyPromise_reject!==void 0&&(E(a._readyPromise),a._readyPromise_reject(s),a._readyPromise_resolve=void 0,a._readyPromise_reject=void 0,a._readyPromiseState="rejected")}o(If,"defaultWriterReadyPromiseReject");function MP(a){Ca(a)}o(MP,"defaultWriterReadyPromiseReset");function LP(a,s){cc(a,s)}o(LP,"defaultWriterReadyPromiseResetToRejected");function lc(a){a._readyPromise_resolve!==void 0&&(a._readyPromise_resolve(void 0),a._readyPromise_resolve=void 0,a._readyPromise_reject=void 0,a._readyPromiseState="fulfilled")}o(lc,"defaultWriterReadyPromiseResolve");function FP(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof global<"u")return global}o(FP,"getGlobals");let dc=FP();function BP(a){if(!(typeof a=="function"||typeof a=="object")||a.name!=="DOMException")return!1;try{return new a,!0}catch{return!1}}o(BP,"isDOMExceptionConstructor");function qP(){let a=dc?.DOMException;return BP(a)?a:void 0}o(qP,"getFromGlobal");function VP(){let a=o(function(d,v){this.message=d||"",this.name=v||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)},"DOMException");return i(a,"DOMException"),a.prototype=Object.create(Error.prototype),Object.defineProperty(a.prototype,"constructor",{value:a,writable:!0,configurable:!0}),a}o(VP,"createPolyfill");let HP=qP()||VP();function Rf(a,s,d,v,A,U){let L=j(a),Q=mf(s);a._disturbed=!0;let ue=!1,oe=f(void 0);return p((he,ve)=>{let Le;if(U!==void 0){if(Le=o(()=>{let ie=U.reason!==void 0?U.reason:new HP("Aborted","AbortError"),we=[];v||we.push(()=>s._state==="writable"?Ta(s,ie):f(void 0)),A||we.push(()=>a._state==="readable"?dr(a,ie):f(void 0)),Ct(()=>Promise.all(we.map(Fe=>Fe())),!0,ie)},"abortAlgorithm"),U.aborted){Le();return}U.addEventListener("abort",Le)}function pr(){return p((ie,we)=>{function Fe(Mt){Mt?ie():g(mo(),Fe,we)}o(Fe,"next"),Fe(!1)})}o(pr,"pipeLoop");function mo(){return ue?f(!0):g(Q._readyPromise,()=>p((ie,we)=>{te(L,{_chunkSteps:o(Fe=>{oe=g(vf(Q,Fe),void 0,e),ie(!1)},"_chunkSteps"),_closeSteps:o(()=>ie(!0),"_closeSteps"),_errorSteps:we})}))}if(o(mo,"pipeStep"),Gr(a,L._closedPromise,ie=>(v?er(!0,ie):Ct(()=>Ta(s,ie),!0,ie),null)),Gr(s,Q._closedPromise,ie=>(A?er(!0,ie):Ct(()=>dr(a,ie),!0,ie),null)),Tt(a,L._closedPromise,()=>(d?er():Ct(()=>IP(Q)),null)),xr(s)||s._state==="closed"){let ie=new TypeError("the destination writable stream closed before all data could be piped to it");A?er(!0,ie):Ct(()=>dr(a,ie),!0,ie)}E(pr());function mn(){let ie=oe;return g(oe,()=>ie!==oe?mn():void 0)}o(mn,"waitForWritesToFinish");function Gr(ie,we,Fe){ie._state==="errored"?Fe(ie._storedError):_(we,Fe)}o(Gr,"isOrBecomesErrored");function Tt(ie,we,Fe){ie._state==="closed"?Fe():h(we,Fe)}o(Tt,"isOrBecomesClosed");function Ct(ie,we,Fe){if(ue)return;ue=!0,s._state==="writable"&&!xr(s)?h(mn(),Mt):Mt();function Mt(){return S(ie(),()=>Wr(we,Fe),ho=>Wr(!0,ho)),null}o(Mt,"doTheRest")}o(Ct,"shutdownWithAction");function er(ie,we){ue||(ue=!0,s._state==="writable"&&!xr(s)?h(mn(),()=>Wr(ie,we)):Wr(ie,we))}o(er,"shutdown");function Wr(ie,we){return bf(Q),ke(L),U!==void 0&&U.removeEventListener("abort",Le),ie?ve(we):he(void 0),null}o(Wr,"finalize")})}o(Rf,"ReadableStreamPipeTo");class Hr{static{o(this,"ReadableStreamDefaultController")}constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Oa(this))throw $a("desiredSize");return pc(this)}close(){if(!Oa(this))throw $a("close");if(!po(this))throw new TypeError("The stream is not in a state that permits close");Mn(this)}enqueue(s=void 0){if(!Oa(this))throw $a("enqueue");if(!po(this))throw new TypeError("The stream is not in a state that permits enqueue");return lo(this,s)}error(s=void 0){if(!Oa(this))throw $a("error");lr(this,s)}[re](s){un(this);let d=this._cancelAlgorithm(s);return ka(this),d}[Z](s){let d=this._controlledReadableStream;if(this._queue.length>0){let v=Gu(this);this._closeRequested&&this._queue.length===0?(ka(this),fi(d)):di(this),s._chunkSteps(v)}else I(d,s),di(this)}[ze](){}}Object.defineProperties(Hr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),i(Hr.prototype.close,"close"),i(Hr.prototype.enqueue,"enqueue"),i(Hr.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Hr.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function Oa(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_controlledReadableStream")?!1:a instanceof Hr}o(Oa,"IsReadableStreamDefaultController");function di(a){if(!Cf(a))return;if(a._pulling){a._pullAgain=!0;return}a._pulling=!0;let d=a._pullAlgorithm();S(d,()=>(a._pulling=!1,a._pullAgain&&(a._pullAgain=!1,di(a)),null),v=>(lr(a,v),null))}o(di,"ReadableStreamDefaultControllerCallPullIfNeeded");function Cf(a){let s=a._controlledReadableStream;return!po(a)||!a._started?!1:!!(pn(s)&&D(s)>0||pc(a)>0)}o(Cf,"ReadableStreamDefaultControllerShouldCallPull");function ka(a){a._pullAlgorithm=void 0,a._cancelAlgorithm=void 0,a._strategySizeAlgorithm=void 0}o(ka,"ReadableStreamDefaultControllerClearAlgorithms");function Mn(a){if(!po(a))return;let s=a._controlledReadableStream;a._closeRequested=!0,a._queue.length===0&&(ka(a),fi(s))}o(Mn,"ReadableStreamDefaultControllerClose");function lo(a,s){if(!po(a))return;let d=a._controlledReadableStream;if(pn(d)&&D(d)>0)C(d,s,!1);else{let v;try{v=a._strategySizeAlgorithm(s)}catch(A){throw lr(a,A),A}try{Wu(a,s,v)}catch(A){throw lr(a,A),A}}di(a)}o(lo,"ReadableStreamDefaultControllerEnqueue");function lr(a,s){let d=a._controlledReadableStream;d._state==="readable"&&(un(a),ka(a),Nf(d,s))}o(lr,"ReadableStreamDefaultControllerError");function pc(a){let s=a._controlledReadableStream._state;return s==="errored"?null:s==="closed"?0:a._strategyHWM-a._queueTotalSize}o(pc,"ReadableStreamDefaultControllerGetDesiredSize");function GP(a){return!Cf(a)}o(GP,"ReadableStreamDefaultControllerHasBackpressure");function po(a){let s=a._controlledReadableStream._state;return!a._closeRequested&&s==="readable"}o(po,"ReadableStreamDefaultControllerCanCloseOrEnqueue");function Of(a,s,d,v,A,U,L){s._controlledReadableStream=a,s._queue=void 0,s._queueTotalSize=void 0,un(s),s._started=!1,s._closeRequested=!1,s._pullAgain=!1,s._pulling=!1,s._strategySizeAlgorithm=L,s._strategyHWM=U,s._pullAlgorithm=v,s._cancelAlgorithm=A,a._readableStreamController=s;let Q=d();S(f(Q),()=>(s._started=!0,di(s),null),ue=>(lr(s,ue),null))}o(Of,"SetUpReadableStreamDefaultController");function WP(a,s,d,v){let A=Object.create(Hr.prototype),U,L,Q;s.start!==void 0?U=o(()=>s.start(A),"startAlgorithm"):U=o(()=>{},"startAlgorithm"),s.pull!==void 0?L=o(()=>s.pull(A),"pullAlgorithm"):L=o(()=>f(void 0),"pullAlgorithm"),s.cancel!==void 0?Q=o(ue=>s.cancel(ue),"cancelAlgorithm"):Q=o(()=>f(void 0),"cancelAlgorithm"),Of(a,A,U,L,Q,d,v)}o(WP,"SetUpReadableStreamDefaultControllerFromUnderlyingSource");function $a(a){return new TypeError(`ReadableStreamDefaultController.prototype.${a} can only be used on a ReadableStreamDefaultController`)}o($a,"defaultControllerBrandCheckException$1");function ZP(a,s){return Nn(a._readableStreamController)?KP(a):JP(a)}o(ZP,"ReadableStreamTee");function JP(a,s){let d=j(a),v=!1,A=!1,U=!1,L=!1,Q,ue,oe,he,ve,Le=p(Tt=>{ve=Tt});function pr(){return v?(A=!0,f(void 0)):(v=!0,te(d,{_chunkSteps:o(Ct=>{w(()=>{A=!1;let er=Ct,Wr=Ct;U||lo(oe._readableStreamController,er),L||lo(he._readableStreamController,Wr),v=!1,A&&pr()})},"_chunkSteps"),_closeSteps:o(()=>{v=!1,U||Mn(oe._readableStreamController),L||Mn(he._readableStreamController),(!U||!L)&&ve(void 0)},"_closeSteps"),_errorSteps:o(()=>{v=!1},"_errorSteps")}),f(void 0))}o(pr,"pullAlgorithm");function mo(Tt){if(U=!0,Q=Tt,L){let Ct=je([Q,ue]),er=dr(a,Ct);ve(er)}return Le}o(mo,"cancel1Algorithm");function mn(Tt){if(L=!0,ue=Tt,U){let Ct=je([Q,ue]),er=dr(a,Ct);ve(er)}return Le}o(mn,"cancel2Algorithm");function Gr(){}return o(Gr,"startAlgorithm"),oe=pi(Gr,pr,mo),he=pi(Gr,pr,mn),_(d._closedPromise,Tt=>(lr(oe._readableStreamController,Tt),lr(he._readableStreamController,Tt),(!U||!L)&&ve(void 0),null)),[oe,he]}o(JP,"ReadableStreamDefaultTee");function KP(a){let s=j(a),d=!1,v=!1,A=!1,U=!1,L=!1,Q,ue,oe,he,ve,Le=p(ie=>{ve=ie});function pr(ie){_(ie._closedPromise,we=>(ie!==s||(Xt(oe._readableStreamController,we),Xt(he._readableStreamController,we),(!U||!L)&&ve(void 0)),null))}o(pr,"forwardReaderError");function mo(){Dn(s)&&(ke(s),s=j(a),pr(s)),te(s,{_chunkSteps:o(we=>{w(()=>{v=!1,A=!1;let Fe=we,Mt=we;if(!U&&!L)try{Mt=Zp(we)}catch(ho){Xt(oe._readableStreamController,ho),Xt(he._readableStreamController,ho),ve(dr(a,ho));return}U||_a(oe._readableStreamController,Fe),L||_a(he._readableStreamController,Mt),d=!1,v?Gr():A&&Tt()})},"_chunkSteps"),_closeSteps:o(()=>{d=!1,U||ai(oe._readableStreamController),L||ai(he._readableStreamController),oe._readableStreamController._pendingPullIntos.length>0&&ba(oe._readableStreamController,0),he._readableStreamController._pendingPullIntos.length>0&&ba(he._readableStreamController,0),(!U||!L)&&ve(void 0)},"_closeSteps"),_errorSteps:o(()=>{d=!1},"_errorSteps")})}o(mo,"pullWithDefaultReader");function mn(ie,we){Y(s)&&(ke(s),s=uf(a),pr(s));let Fe=we?he:oe,Mt=we?oe:he;df(s,ie,1,{_chunkSteps:o(go=>{w(()=>{v=!1,A=!1;let yo=we?L:U;if(we?U:L)yo||va(Fe._readableStreamController,go);else{let Wf;try{Wf=Zp(go)}catch(yc){Xt(Fe._readableStreamController,yc),Xt(Mt._readableStreamController,yc),ve(dr(a,yc));return}yo||va(Fe._readableStreamController,go),_a(Mt._readableStreamController,Wf)}d=!1,v?Gr():A&&Tt()})},"_chunkSteps"),_closeSteps:o(go=>{d=!1;let yo=we?L:U,Fa=we?U:L;yo||ai(Fe._readableStreamController),Fa||ai(Mt._readableStreamController),go!==void 0&&(yo||va(Fe._readableStreamController,go),!Fa&&Mt._readableStreamController._pendingPullIntos.length>0&&ba(Mt._readableStreamController,0)),(!yo||!Fa)&&ve(void 0)},"_closeSteps"),_errorSteps:o(()=>{d=!1},"_errorSteps")})}o(mn,"pullWithBYOBReader");function Gr(){if(d)return v=!0,f(void 0);d=!0;let ie=Yu(oe._readableStreamController);return ie===null?mo():mn(ie._view,!1),f(void 0)}o(Gr,"pull1Algorithm");function Tt(){if(d)return A=!0,f(void 0);d=!0;let ie=Yu(he._readableStreamController);return ie===null?mo():mn(ie._view,!0),f(void 0)}o(Tt,"pull2Algorithm");function Ct(ie){if(U=!0,Q=ie,L){let we=je([Q,ue]),Fe=dr(a,we);ve(Fe)}return Le}o(Ct,"cancel1Algorithm");function er(ie){if(L=!0,ue=ie,U){let we=je([Q,ue]),Fe=dr(a,we);ve(Fe)}return Le}o(er,"cancel2Algorithm");function Wr(){}return o(Wr,"startAlgorithm"),oe=$f(Wr,Gr,Ct),he=$f(Wr,Tt,er),pr(s),[oe,he]}o(KP,"ReadableByteStreamTee");function QP(a){return r(a)&&typeof a.getReader<"u"}o(QP,"isReadableStreamLike");function YP(a){return QP(a)?eT(a.getReader()):XP(a)}o(YP,"ReadableStreamFrom");function XP(a){let s,d=Wp(a,"async"),v=e;function A(){let L;try{L=VS(d)}catch(ue){return m(ue)}let Q=f(L);return T(Q,ue=>{if(!r(ue))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(HS(ue))Mn(s._readableStreamController);else{let he=GS(ue);lo(s._readableStreamController,he)}})}o(A,"pullAlgorithm");function U(L){let Q=d.iterator,ue;try{ue=ha(Q,"return")}catch(ve){return m(ve)}if(ue===void 0)return f(void 0);let oe;try{oe=k(ue,Q,[L])}catch(ve){return m(ve)}let he=f(oe);return T(he,ve=>{if(!r(ve))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")})}return o(U,"cancelAlgorithm"),s=pi(v,A,U,0),s}o(XP,"ReadableStreamFromIterable");function eT(a){let s,d=e;function v(){let U;try{U=a.read()}catch(L){return m(L)}return T(U,L=>{if(!r(L))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(L.done)Mn(s._readableStreamController);else{let Q=L.value;lo(s._readableStreamController,Q)}})}o(v,"pullAlgorithm");function A(U){try{return f(a.cancel(U))}catch(L){return m(L)}}return o(A,"cancelAlgorithm"),s=pi(d,v,A,0),s}o(eT,"ReadableStreamFromDefaultReader");function tT(a,s){Rt(a,s);let d=a,v=d?.autoAllocateChunkSize,A=d?.cancel,U=d?.pull,L=d?.start,Q=d?.type;return{autoAllocateChunkSize:v===void 0?void 0:R(v,`${s} has member 'autoAllocateChunkSize' that`),cancel:A===void 0?void 0:rT(A,d,`${s} has member 'cancel' that`),pull:U===void 0?void 0:nT(U,d,`${s} has member 'pull' that`),start:L===void 0?void 0:oT(L,d,`${s} has member 'start' that`),type:Q===void 0?void 0:iT(Q,`${s} has member 'type' that`)}}o(tT,"convertUnderlyingDefaultOrByteSource");function rT(a,s,d){return St(a,d),v=>q(a,s,[v])}o(rT,"convertUnderlyingSourceCancelCallback");function nT(a,s,d){return St(a,d),v=>q(a,s,[v])}o(nT,"convertUnderlyingSourcePullCallback");function oT(a,s,d){return St(a,d),v=>k(a,s,[v])}o(oT,"convertUnderlyingSourceStartCallback");function iT(a,s){if(a=`${a}`,a!=="bytes")throw new TypeError(`${s} '${a}' is not a valid enumeration value for ReadableStreamType`);return a}o(iT,"convertReadableStreamType");function aT(a,s){return Rt(a,s),{preventCancel:!!a?.preventCancel}}o(aT,"convertIteratorOptions");function kf(a,s){Rt(a,s);let d=a?.preventAbort,v=a?.preventCancel,A=a?.preventClose,U=a?.signal;return U!==void 0&&sT(U,`${s} has member 'signal' that`),{preventAbort:!!d,preventCancel:!!v,preventClose:!!A,signal:U}}o(kf,"convertPipeOptions");function sT(a,s){if(!hP(a))throw new TypeError(`${s} is not an AbortSignal.`)}o(sT,"assertAbortSignal");function uT(a,s){Rt(a,s);let d=a?.readable;y(d,"readable","ReadableWritablePair"),$(d,`${s} has member 'readable' that`);let v=a?.writable;return y(v,"writable","ReadableWritablePair"),ff(v,`${s} has member 'writable' that`),{readable:d,writable:v}}o(uT,"convertReadableWritablePair");class bt{static{o(this,"ReadableStream")}constructor(s={},d={}){s===void 0?s=null:Pt(s,"First parameter");let v=Pa(d,"Second parameter"),A=tT(s,"First parameter");if(fc(this),A.type==="bytes"){if(v.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let U=ui(v,0);rP(this,A,U)}else{let U=Sa(v),L=ui(v,1);WP(this,A,L,U)}}get locked(){if(!dn(this))throw Ln("locked");return pn(this)}cancel(s=void 0){return dn(this)?pn(this)?m(new TypeError("Cannot cancel a stream that already has a reader")):dr(this,s):m(Ln("cancel"))}getReader(s=void 0){if(!dn(this))throw Ln("getReader");return oP(s,"First parameter").mode===void 0?j(this):uf(this)}pipeThrough(s,d={}){if(!dn(this))throw Ln("pipeThrough");it(s,1,"pipeThrough");let v=uT(s,"First parameter"),A=kf(d,"Second parameter");if(pn(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(uo(v.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let U=Rf(this,v.writable,A.preventClose,A.preventAbort,A.preventCancel,A.signal);return E(U),v.readable}pipeTo(s,d={}){if(!dn(this))return m(Ln("pipeTo"));if(s===void 0)return m("Parameter 1 is required in 'pipeTo'.");if(!so(s))return m(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let v;try{v=kf(d,"Second parameter")}catch(A){return m(A)}return pn(this)?m(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):uo(s)?m(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Rf(this,s,v.preventClose,v.preventAbort,v.preventCancel,v.signal)}tee(){if(!dn(this))throw Ln("tee");let s=ZP(this);return je(s)}values(s=void 0){if(!dn(this))throw Ln("values");let d=aT(s,"First parameter");return no(this,d.preventCancel)}[Hu](s){return this.values(s)}static from(s){return YP(s)}}Object.defineProperties(bt,{from:{enumerable:!0}}),Object.defineProperties(bt.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),i(bt.from,"from"),i(bt.prototype.cancel,"cancel"),i(bt.prototype.getReader,"getReader"),i(bt.prototype.pipeThrough,"pipeThrough"),i(bt.prototype.pipeTo,"pipeTo"),i(bt.prototype.tee,"tee"),i(bt.prototype.values,"values"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(bt.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(bt.prototype,Hu,{value:bt.prototype.values,writable:!0,configurable:!0});function pi(a,s,d,v=1,A=()=>1){let U=Object.create(bt.prototype);fc(U);let L=Object.create(Hr.prototype);return Of(U,L,a,s,d,v,A),U}o(pi,"CreateReadableStream");function $f(a,s,d){let v=Object.create(bt.prototype);fc(v);let A=Object.create(qr.prototype);return sf(v,A,a,s,d,0,void 0),v}o($f,"CreateReadableByteStream");function fc(a){a._state="readable",a._reader=void 0,a._storedError=void 0,a._disturbed=!1}o(fc,"InitializeReadableStream");function dn(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_readableStreamController")?!1:a instanceof bt}o(dn,"IsReadableStream");function pn(a){return a._reader!==void 0}o(pn,"IsReadableStreamLocked");function dr(a,s){if(a._disturbed=!0,a._state==="closed")return f(void 0);if(a._state==="errored")return m(a._storedError);fi(a);let d=a._reader;if(d!==void 0&&Dn(d)){let A=d._readIntoRequests;d._readIntoRequests=new V,A.forEach(U=>{U._closeSteps(void 0)})}let v=a._readableStreamController[re](s);return T(v,e)}o(dr,"ReadableStreamCancel");function fi(a){a._state="closed";let s=a._reader;if(s!==void 0&&(ro(s),Y(s))){let d=s._readRequests;s._readRequests=new V,d.forEach(v=>{v._closeSteps()})}}o(fi,"ReadableStreamClose");function Nf(a,s){a._state="errored",a._storedError=s;let d=a._reader;d!==void 0&&(Ut(d,s),Y(d)?Ge(d,s):pf(d,s))}o(Nf,"ReadableStreamError");function Ln(a){return new TypeError(`ReadableStream.prototype.${a} can only be used on a ReadableStream`)}o(Ln,"streamBrandCheckException$1");function zf(a,s){Rt(a,s);let d=a?.highWaterMark;return y(d,"highWaterMark","QueuingStrategyInit"),{highWaterMark:P(d)}}o(zf,"convertQueuingStrategyInit");let Df=o(a=>a.byteLength,"byteLengthSizeFunction");i(Df,"size");class Na{static{o(this,"ByteLengthQueuingStrategy")}constructor(s){it(s,1,"ByteLengthQueuingStrategy"),s=zf(s,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=s.highWaterMark}get highWaterMark(){if(!jf(this))throw Uf("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!jf(this))throw Uf("size");return Df}}Object.defineProperties(Na.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Na.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function Uf(a){return new TypeError(`ByteLengthQueuingStrategy.prototype.${a} can only be used on a ByteLengthQueuingStrategy`)}o(Uf,"byteLengthBrandCheckException");function jf(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_byteLengthQueuingStrategyHighWaterMark")?!1:a instanceof Na}o(jf,"IsByteLengthQueuingStrategy");let Mf=o(()=>1,"countSizeFunction");i(Mf,"size");class za{static{o(this,"CountQueuingStrategy")}constructor(s){it(s,1,"CountQueuingStrategy"),s=zf(s,"First parameter"),this._countQueuingStrategyHighWaterMark=s.highWaterMark}get highWaterMark(){if(!Ff(this))throw Lf("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Ff(this))throw Lf("size");return Mf}}Object.defineProperties(za.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(za.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function Lf(a){return new TypeError(`CountQueuingStrategy.prototype.${a} can only be used on a CountQueuingStrategy`)}o(Lf,"countBrandCheckException");function Ff(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_countQueuingStrategyHighWaterMark")?!1:a instanceof za}o(Ff,"IsCountQueuingStrategy");function cT(a,s){Rt(a,s);let d=a?.cancel,v=a?.flush,A=a?.readableType,U=a?.start,L=a?.transform,Q=a?.writableType;return{cancel:d===void 0?void 0:fT(d,a,`${s} has member 'cancel' that`),flush:v===void 0?void 0:lT(v,a,`${s} has member 'flush' that`),readableType:A,start:U===void 0?void 0:dT(U,a,`${s} has member 'start' that`),transform:L===void 0?void 0:pT(L,a,`${s} has member 'transform' that`),writableType:Q}}o(cT,"convertTransformer");function lT(a,s,d){return St(a,d),v=>q(a,s,[v])}o(lT,"convertTransformerFlushCallback");function dT(a,s,d){return St(a,d),v=>k(a,s,[v])}o(dT,"convertTransformerStartCallback");function pT(a,s,d){return St(a,d),(v,A)=>q(a,s,[v,A])}o(pT,"convertTransformerTransformCallback");function fT(a,s,d){return St(a,d),v=>q(a,s,[v])}o(fT,"convertTransformerCancelCallback");class Da{static{o(this,"TransformStream")}constructor(s={},d={},v={}){s===void 0&&(s=null);let A=Pa(d,"Second parameter"),U=Pa(v,"Third parameter"),L=cT(s,"First parameter");if(L.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(L.writableType!==void 0)throw new RangeError("Invalid writableType specified");let Q=ui(U,0),ue=Sa(U),oe=ui(A,1),he=Sa(A),ve,Le=p(pr=>{ve=pr});mT(this,Le,oe,he,Q,ue),gT(this,L),L.start!==void 0?ve(L.start(this._transformStreamController)):ve(void 0)}get readable(){if(!Bf(this))throw Gf("readable");return this._readable}get writable(){if(!Bf(this))throw Gf("writable");return this._writable}}Object.defineProperties(Da.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Da.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});function mT(a,s,d,v,A,U){function L(){return s}o(L,"startAlgorithm");function Q(Le){return bT(a,Le)}o(Q,"writeAlgorithm");function ue(Le){return vT(a,Le)}o(ue,"abortAlgorithm");function oe(){return ET(a)}o(oe,"closeAlgorithm"),a._writable=_P(L,Q,oe,ue,d,v);function he(){return ST(a)}o(he,"pullAlgorithm");function ve(Le){return PT(a,Le)}o(ve,"cancelAlgorithm"),a._readable=pi(L,he,ve,A,U),a._backpressure=void 0,a._backpressureChangePromise=void 0,a._backpressureChangePromise_resolve=void 0,Ua(a,!0),a._transformStreamController=void 0}o(mT,"InitializeTransformStream");function Bf(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_transformStreamController")?!1:a instanceof Da}o(Bf,"IsTransformStream");function qf(a,s){lr(a._readable._readableStreamController,s),mc(a,s)}o(qf,"TransformStreamError");function mc(a,s){Ma(a._transformStreamController),ci(a._writable._writableStreamController,s),hc(a)}o(mc,"TransformStreamErrorWritableAndUnblockWrite");function hc(a){a._backpressure&&Ua(a,!1)}o(hc,"TransformStreamUnblockWrite");function Ua(a,s){a._backpressureChangePromise!==void 0&&a._backpressureChangePromise_resolve(),a._backpressureChangePromise=p(d=>{a._backpressureChangePromise_resolve=d}),a._backpressure=s}o(Ua,"TransformStreamSetBackpressure");class fn{static{o(this,"TransformStreamDefaultController")}constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!ja(this))throw La("desiredSize");let s=this._controlledTransformStream._readable._readableStreamController;return pc(s)}enqueue(s=void 0){if(!ja(this))throw La("enqueue");Vf(this,s)}error(s=void 0){if(!ja(this))throw La("error");yT(this,s)}terminate(){if(!ja(this))throw La("terminate");_T(this)}}Object.defineProperties(fn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),i(fn.prototype.enqueue,"enqueue"),i(fn.prototype.error,"error"),i(fn.prototype.terminate,"terminate"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(fn.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function ja(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_controlledTransformStream")?!1:a instanceof fn}o(ja,"IsTransformStreamDefaultController");function hT(a,s,d,v,A){s._controlledTransformStream=a,a._transformStreamController=s,s._transformAlgorithm=d,s._flushAlgorithm=v,s._cancelAlgorithm=A,s._finishPromise=void 0,s._finishPromise_resolve=void 0,s._finishPromise_reject=void 0}o(hT,"SetUpTransformStreamDefaultController");function gT(a,s){let d=Object.create(fn.prototype),v,A,U;s.transform!==void 0?v=o(L=>s.transform(L,d),"transformAlgorithm"):v=o(L=>{try{return Vf(d,L),f(void 0)}catch(Q){return m(Q)}},"transformAlgorithm"),s.flush!==void 0?A=o(()=>s.flush(d),"flushAlgorithm"):A=o(()=>f(void 0),"flushAlgorithm"),s.cancel!==void 0?U=o(L=>s.cancel(L),"cancelAlgorithm"):U=o(()=>f(void 0),"cancelAlgorithm"),hT(a,d,v,A,U)}o(gT,"SetUpTransformStreamDefaultControllerFromTransformer");function Ma(a){a._transformAlgorithm=void 0,a._flushAlgorithm=void 0,a._cancelAlgorithm=void 0}o(Ma,"TransformStreamDefaultControllerClearAlgorithms");function Vf(a,s){let d=a._controlledTransformStream,v=d._readable._readableStreamController;if(!po(v))throw new TypeError("Readable side is not in a state that permits enqueue");try{lo(v,s)}catch(U){throw mc(d,U),d._readable._storedError}GP(v)!==d._backpressure&&Ua(d,!0)}o(Vf,"TransformStreamDefaultControllerEnqueue");function yT(a,s){qf(a._controlledTransformStream,s)}o(yT,"TransformStreamDefaultControllerError");function Hf(a,s){let d=a._transformAlgorithm(s);return T(d,void 0,v=>{throw qf(a._controlledTransformStream,v),v})}o(Hf,"TransformStreamDefaultControllerPerformTransform");function _T(a){let s=a._controlledTransformStream,d=s._readable._readableStreamController;Mn(d);let v=new TypeError("TransformStream terminated");mc(s,v)}o(_T,"TransformStreamDefaultControllerTerminate");function bT(a,s){let d=a._transformStreamController;if(a._backpressure){let v=a._backpressureChangePromise;return T(v,()=>{let A=a._writable;if(A._state==="erroring")throw A._storedError;return Hf(d,s)})}return Hf(d,s)}o(bT,"TransformStreamDefaultSinkWriteAlgorithm");function vT(a,s){let d=a._transformStreamController;if(d._finishPromise!==void 0)return d._finishPromise;let v=a._readable;d._finishPromise=p((U,L)=>{d._finishPromise_resolve=U,d._finishPromise_reject=L});let A=d._cancelAlgorithm(s);return Ma(d),S(A,()=>(v._state==="errored"?fo(d,v._storedError):(lr(v._readableStreamController,s),gc(d)),null),U=>(lr(v._readableStreamController,U),fo(d,U),null)),d._finishPromise}o(vT,"TransformStreamDefaultSinkAbortAlgorithm");function ET(a){let s=a._transformStreamController;if(s._finishPromise!==void 0)return s._finishPromise;let d=a._readable;s._finishPromise=p((A,U)=>{s._finishPromise_resolve=A,s._finishPromise_reject=U});let v=s._flushAlgorithm();return Ma(s),S(v,()=>(d._state==="errored"?fo(s,d._storedError):(Mn(d._readableStreamController),gc(s)),null),A=>(lr(d._readableStreamController,A),fo(s,A),null)),s._finishPromise}o(ET,"TransformStreamDefaultSinkCloseAlgorithm");function ST(a){return Ua(a,!1),a._backpressureChangePromise}o(ST,"TransformStreamDefaultSourcePullAlgorithm");function PT(a,s){let d=a._transformStreamController;if(d._finishPromise!==void 0)return d._finishPromise;let v=a._writable;d._finishPromise=p((U,L)=>{d._finishPromise_resolve=U,d._finishPromise_reject=L});let A=d._cancelAlgorithm(s);return Ma(d),S(A,()=>(v._state==="errored"?fo(d,v._storedError):(ci(v._writableStreamController,s),hc(a),gc(d)),null),U=>(ci(v._writableStreamController,U),hc(a),fo(d,U),null)),d._finishPromise}o(PT,"TransformStreamDefaultSourceCancelAlgorithm");function La(a){return new TypeError(`TransformStreamDefaultController.prototype.${a} can only be used on a TransformStreamDefaultController`)}o(La,"defaultControllerBrandCheckException");function gc(a){a._finishPromise_resolve!==void 0&&(a._finishPromise_resolve(),a._finishPromise_resolve=void 0,a._finishPromise_reject=void 0)}o(gc,"defaultControllerFinishPromiseResolve");function fo(a,s){a._finishPromise_reject!==void 0&&(E(a._finishPromise),a._finishPromise_reject(s),a._finishPromise_resolve=void 0,a._finishPromise_reject=void 0)}o(fo,"defaultControllerFinishPromiseReject");function Gf(a){return new TypeError(`TransformStream.prototype.${a} can only be used on a TransformStream`)}o(Gf,"streamBrandCheckException"),t.ByteLengthQueuingStrategy=Na,t.CountQueuingStrategy=za,t.ReadableByteStreamController=qr,t.ReadableStream=bt,t.ReadableStreamBYOBReader=cn,t.ReadableStreamBYOBRequest=$n,t.ReadableStreamDefaultController=Hr,t.ReadableStreamDefaultReader=F,t.TransformStream=Da,t.TransformStreamDefaultController=fn,t.WritableStream=ln,t.WritableStreamDefaultController=co,t.WritableStreamDefaultWriter=Vr}))});var fb=M(()=>{if(!globalThis.ReadableStream)try{let t=require("node:process"),{emitWarning:e}=t;try{t.emitWarning=()=>{},Object.assign(globalThis,require("node:stream/web")),t.emitWarning=e}catch(r){throw t.emitWarning=e,r}}catch{Object.assign(globalThis,pb())}try{let{Blob:t}=require("buffer");t&&!t.prototype.stream&&(t.prototype.stream=o(function(r){let n=0,i=this;return new ReadableStream({type:"bytes",async pull(u){let l=await i.slice(n,Math.min(i.size,n+65536)).arrayBuffer();n+=l.byteLength,u.enqueue(new Uint8Array(l)),n===i.size&&u.close()}})},"name"))}catch{}});async function*Dl(t,e=!0){for(let r of t)if("stream"in r)yield*r.stream();else if(ArrayBuffer.isView(r))if(e){let n=r.byteOffset,i=r.byteOffset+r.byteLength;for(;n!==i;){let u=Math.min(i-n,mb),c=r.buffer.slice(n,n+u);n+=c.byteLength,yield new Uint8Array(c)}}else yield r;else{let n=0,i=r;for(;n!==i.size;){let c=await i.slice(n,Math.min(i.size,n+mb)).arrayBuffer();n+=c.byteLength,yield new Uint8Array(c)}}}var jW,mb,hb,rC,gr,Li=ct(()=>{jW=gt(fb(),1);mb=65536;o(Dl,"toIterator");hb=class Ul{static{o(this,"Blob")}#e=[];#t="";#r=0;#n="transparent";constructor(e=[],r={}){if(typeof e!="object"||e===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof e[Symbol.iterator]!="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof r!="object"&&typeof r!="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");r===null&&(r={});let n=new TextEncoder;for(let u of e){let c;ArrayBuffer.isView(u)?c=new Uint8Array(u.buffer.slice(u.byteOffset,u.byteOffset+u.byteLength)):u instanceof ArrayBuffer?c=new Uint8Array(u.slice(0)):u instanceof Ul?c=u:c=n.encode(`${u}`),this.#r+=ArrayBuffer.isView(c)?c.byteLength:c.size,this.#e.push(c)}this.#n=`${r.endings===void 0?"transparent":r.endings}`;let i=r.type===void 0?"":String(r.type);this.#t=/^[\x20-\x7E]*$/.test(i)?i:""}get size(){return this.#r}get type(){return this.#t}async text(){let e=new TextDecoder,r="";for await(let n of Dl(this.#e,!1))r+=e.decode(n,{stream:!0});return r+=e.decode(),r}async arrayBuffer(){let e=new Uint8Array(this.size),r=0;for await(let n of Dl(this.#e,!1))e.set(n,r),r+=n.length;return e.buffer}stream(){let e=Dl(this.#e,!0);return new globalThis.ReadableStream({type:"bytes",async pull(r){let n=await e.next();n.done?r.close():r.enqueue(n.value)},async cancel(){await e.return()}})}slice(e=0,r=this.size,n=""){let{size:i}=this,u=e<0?Math.max(i+e,0):Math.min(e,i),c=r<0?Math.max(i+r,0):Math.min(r,i),l=Math.max(c-u,0),p=this.#e,f=[],m=0;for(let S of p){if(m>=l)break;let h=ArrayBuffer.isView(S)?S.byteLength:S.size;if(u&&h<=u)u-=h,c-=h;else{let _;ArrayBuffer.isView(S)?(_=S.subarray(u,Math.min(h,c)),m+=_.byteLength):(_=S.slice(u,Math.min(h,c)),m+=_.size),c-=h,f.push(_),u=0}}let g=new Ul([],{type:String(n).toLowerCase()});return g.#r=l,g.#e=f,g}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](e){return e&&typeof e=="object"&&typeof e.constructor=="function"&&(typeof e.stream=="function"||typeof e.arrayBuffer=="function")&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}};Object.defineProperties(hb.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});rC=hb,gr=rC});var nC,oC,xn,jl=ct(()=>{Li();nC=class extends gr{static{o(this,"File")}#e=0;#t="";constructor(e,r,n={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(e,n),n===null&&(n={});let i=n.lastModified===void 0?Date.now():Number(n.lastModified);Number.isNaN(i)||(this.#e=i),this.#t=String(r)}get name(){return this.#t}get lastModified(){return this.#e}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](e){return!!e&&e instanceof gr&&/^(File)$/.test(e[Symbol.toStringTag])}},oC=nC,xn=oC});function _b(t,e=gr){var r=`${gb()}${gb()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),n=[],i=`--${r}\r
15
- Content-Disposition: form-data; name="`;return t.forEach((u,c)=>typeof u=="string"?n.push(i+Ml(c)+`"\r
10
+ `);if(P===-1){Os("have not received end of HTTP headers yet..."),u();return}let h=y.slice(0,P).toString("ascii").split(`\r
11
+ `),b=h.shift();if(!b)return t.destroy(),r(new Error("No header received from proxy CONNECT response"));let T=b.split(" "),E=+T[1],w=T.slice(2).join(" "),k={};for(let q of h){if(!q)continue;let W=q.indexOf(":");if(W===-1)return t.destroy(),r(new Error(`Invalid header from proxy CONNECT response: "${q}"`));let H=q.slice(0,W).toLowerCase(),V=q.slice(W+1).trimStart(),J=k[H];typeof J=="string"?k[H]=[J,V]:Array.isArray(J)?J.push(V):k[H]=V}Os("got proxy server response: %o %o",b,k),c(),e({connect:{statusCode:E,statusText:w,headers:k},buffered:y})}o(f,"ondata"),t.on("error",p),t.on("end",l),u()})}o(rC,"parseProxyResponse");No.parseProxyResponse=rC});var gb=L(or=>{"use strict";var nC=or&&or.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),oC=or&&or.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),mb=or&&or.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nC(e,t,r);return oC(e,t),e},hb=or&&or.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(or,"__esModule",{value:!0});or.HttpsProxyAgent=void 0;var ks=mb(require("net")),db=mb(require("tls")),iC=hb(require("assert")),aC=hb(Ul()),sC=cb(),uC=require("url"),cC=lb(),Li=(0,aC.default)("https-proxy-agent"),pb=o(t=>t.servername===void 0&&t.host&&!ks.isIP(t.host)?{...t,servername:t.host}:t,"setServernameFromNonIpHost"),$s=class extends sC.Agent{static{o(this,"HttpsProxyAgent")}constructor(e,r){super(r),this.options={path:void 0},this.proxy=typeof e=="string"?new uC.URL(e):e,this.proxyHeaders=r?.headers??{},Li("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),i=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...r?fb(r,"headers"):null,host:n,port:i}}async connect(e,r){let{proxy:n}=this;if(!r.host)throw new TypeError('No "host" provided');let i;n.protocol==="https:"?(Li("Creating `tls.Socket`: %o",this.connectOpts),i=db.connect(pb(this.connectOpts))):(Li("Creating `net.Socket`: %o",this.connectOpts),i=ks.connect(this.connectOpts));let u=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},c=ks.isIPv6(r.host)?`[${r.host}]`:r.host,l=`CONNECT ${c}:${r.port} HTTP/1.1\r
12
+ `;if(n.username||n.password){let P=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;u["Proxy-Authorization"]=`Basic ${Buffer.from(P).toString("base64")}`}u.Host=`${c}:${r.port}`,u["Proxy-Connection"]||(u["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let P of Object.keys(u))l+=`${P}: ${u[P]}\r
13
+ `;let p=(0,cC.parseProxyResponse)(i);i.write(`${l}\r
14
+ `);let{connect:f,buffered:m}=await p;if(e.emit("proxyConnect",f),this.emit("proxyConnect",f,e),f.statusCode===200)return e.once("socket",lC),r.secureEndpoint?(Li("Upgrading socket connection to TLS"),db.connect({...fb(pb(r),"host","path","port"),socket:i})):i;i.destroy();let y=new ks.Socket({writable:!1});return y.readable=!0,e.once("socket",P=>{Li("Replaying proxy buffer for failed request"),(0,iC.default)(P.listenerCount("data")>0),P.push(m),P.push(null)}),y}};$s.protocols=["http","https"];or.HttpsProxyAgent=$s;function lC(t){t.resume()}o(lC,"resume");function fb(t,...e){let r={},n;for(n in t)e.includes(n)||(r[n]=t[n]);return r}o(fb,"omit")});function dC(t){if(!/^data:/i.test(t))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');t=t.replace(/\r?\n/g,"");let e=t.indexOf(",");if(e===-1||e<=4)throw new TypeError("malformed data: URI");let r=t.substring(5,e).split(";"),n="",i=!1,u=r[0]||"text/plain",c=u;for(let m=1;m<r.length;m++)r[m]==="base64"?i=!0:r[m]&&(c+=`;${r[m]}`,r[m].indexOf("charset=")===0&&(n=r[m].substring(8)));!r[0]&&!n.length&&(c+=";charset=US-ASCII",n="US-ASCII");let l=i?"base64":"ascii",p=unescape(t.substring(e+1)),f=Buffer.from(p,l);return f.type=u,f.typeFull=c,f.charset=n,f}var yb,_b=ct(()=>{o(dC,"dataUriToBuffer");yb=dC});var vb=L((zs,bb)=>{(function(t,e){typeof zs=="object"&&typeof bb<"u"?e(zs):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.WebStreamsPolyfill={}))})(zs,(function(t){"use strict";function e(){}o(e,"noop");function r(a){return typeof a=="object"&&a!==null||typeof a=="function"}o(r,"typeIsObject");let n=e;function i(a,s){try{Object.defineProperty(a,"name",{value:s,configurable:!0})}catch{}}o(i,"setFunctionName");let u=Promise,c=Promise.prototype.then,l=Promise.reject.bind(u);function p(a){return new u(a)}o(p,"newPromise");function f(a){return p(s=>s(a))}o(f,"promiseResolvedWith");function m(a){return l(a)}o(m,"promiseRejectedWith");function y(a,s,d){return c.call(a,s,d)}o(y,"PerformPromiseThen");function P(a,s,d){y(y(a,s,d),void 0,n)}o(P,"uponPromise");function h(a,s){P(a,s)}o(h,"uponFulfillment");function b(a,s){P(a,void 0,s)}o(b,"uponRejection");function T(a,s,d){return y(a,s,d)}o(T,"transformPromiseWith");function E(a){y(a,void 0,n)}o(E,"setPromiseIsHandledToTrue");let w=o(a=>{if(typeof queueMicrotask=="function")w=queueMicrotask;else{let s=f(void 0);w=o(d=>y(s,d),"_queueMicrotask")}return w(a)},"_queueMicrotask");function k(a,s,d){if(typeof a!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(a,s,d)}o(k,"reflectCall");function q(a,s,d){try{return f(k(a,s,d))}catch(v){return m(v)}}o(q,"promiseCall");let W=16384;class H{static{o(this,"SimpleQueue")}constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(s){let d=this._back,v=d;d._elements.length===W-1&&(v={_elements:[],_next:void 0}),d._elements.push(s),v!==d&&(this._back=v,d._next=v),++this._size}shift(){let s=this._front,d=s,v=this._cursor,A=v+1,U=s._elements,F=U[v];return A===W&&(d=s._next,A=0),--this._size,this._cursor=A,s!==d&&(this._front=d),U[v]=void 0,F}forEach(s){let d=this._cursor,v=this._front,A=v._elements;for(;(d!==A.length||v._next!==void 0)&&!(d===A.length&&(v=v._next,A=v._elements,d=0,A.length===0));)s(A[d]),++d}peek(){let s=this._front,d=this._cursor;return s._elements[d]}}let V=Symbol("[[AbortSteps]]"),J=Symbol("[[ErrorSteps]]"),re=Symbol("[[CancelSteps]]"),G=Symbol("[[PullSteps]]"),je=Symbol("[[ReleaseSteps]]");function Ee(a,s){a._ownerReadableStream=s,s._reader=a,s._state==="readable"?Ue(a):s._state==="closed"?Ke(a):He(a,s._storedError)}o(Ee,"ReadableStreamReaderGenericInitialize");function ve(a,s){let d=a._ownerReadableStream;return dr(d,s)}o(ve,"ReadableStreamReaderGenericCancel");function ze(a){let s=a._ownerReadableStream;s._state==="readable"?Ut(a,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):Pt(a,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),s._readableStreamController[je](),s._reader=void 0,a._ownerReadableStream=void 0}o(ze,"ReadableStreamReaderGenericRelease");function $e(a){return new TypeError("Cannot "+a+" a stream using a released reader")}o($e,"readerLockException");function Ue(a){a._closedPromise=p((s,d)=>{a._closedPromise_resolve=s,a._closedPromise_reject=d})}o(Ue,"defaultReaderClosedPromiseInitialize");function He(a,s){Ue(a),Ut(a,s)}o(He,"defaultReaderClosedPromiseInitializeAsRejected");function Ke(a){Ue(a),ro(a)}o(Ke,"defaultReaderClosedPromiseInitializeAsResolved");function Ut(a,s){a._closedPromise_reject!==void 0&&(E(a._closedPromise),a._closedPromise_reject(s),a._closedPromise_resolve=void 0,a._closedPromise_reject=void 0)}o(Ut,"defaultReaderClosedPromiseReject");function Pt(a,s){He(a,s)}o(Pt,"defaultReaderClosedPromiseResetToRejected");function ro(a){a._closedPromise_resolve!==void 0&&(a._closedPromise_resolve(void 0),a._closedPromise_resolve=void 0,a._closedPromise_reject=void 0)}o(ro,"defaultReaderClosedPromiseResolve");let wr=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},ii=Math.trunc||function(a){return a<0?Math.ceil(a):Math.floor(a)};function Z(a){return typeof a=="object"||typeof a=="function"}o(Z,"isDictionary");function Rt(a,s){if(a!==void 0&&!Z(a))throw new TypeError(`${s} is not an object.`)}o(Rt,"assertDictionary");function St(a,s){if(typeof a!="function")throw new TypeError(`${s} is not a function.`)}o(St,"assertFunction");function ai(a){return typeof a=="object"&&a!==null||typeof a=="function"}o(ai,"isObject");function Tt(a,s){if(!ai(a))throw new TypeError(`${s} is not an object.`)}o(Tt,"assertObject");function at(a,s,d){if(a===void 0)throw new TypeError(`Parameter ${s} is required in '${d}'.`)}o(at,"assertRequiredArgument");function _(a,s,d){if(a===void 0)throw new TypeError(`${s} is required in '${d}'.`)}o(_,"assertRequiredField");function S(a){return Number(a)}o(S,"convertUnrestrictedDouble");function x(a){return a===0?0:a}o(x,"censorNegativeZero");function N(a){return x(ii(a))}o(N,"integerPart");function R(a,s){let v=Number.MAX_SAFE_INTEGER,A=Number(a);if(A=x(A),!wr(A))throw new TypeError(`${s} is not a finite number`);if(A=N(A),A<0||A>v)throw new TypeError(`${s} is outside the accepted range of 0 to ${v}, inclusive`);return!wr(A)||A===0?0:A}o(R,"convertUnsignedLongLongWithEnforceRange");function $(a,s){if(!dn(a))throw new TypeError(`${s} is not a ReadableStream.`)}o($,"assertReadableStream");function j(a){return new B(a)}o(j,"AcquireReadableStreamDefaultReader");function I(a,s){a._reader._readRequests.push(s)}o(I,"ReadableStreamAddReadRequest");function O(a,s,d){let A=a._reader._readRequests.shift();d?A._closeSteps():A._chunkSteps(s)}o(O,"ReadableStreamFulfillReadRequest");function D(a){return a._reader._readRequests.length}o(D,"ReadableStreamGetNumReadRequests");function z(a){let s=a._reader;return!(s===void 0||!Y(s))}o(z,"ReadableStreamHasDefaultReader");class B{static{o(this,"ReadableStreamDefaultReader")}constructor(s){if(at(s,1,"ReadableStreamDefaultReader"),$(s,"First parameter"),pn(s))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Ee(this,s),this._readRequests=new H}get closed(){return Y(this)?this._closedPromise:m(We("closed"))}cancel(s=void 0){return Y(this)?this._ownerReadableStream===void 0?m($e("cancel")):ve(this,s):m(We("cancel"))}read(){if(!Y(this))return m(We("read"));if(this._ownerReadableStream===void 0)return m($e("read from"));let s,d,v=p((U,F)=>{s=U,d=F});return te(this,{_chunkSteps:o(U=>s({value:U,done:!1}),"_chunkSteps"),_closeSteps:o(()=>s({value:void 0,done:!0}),"_closeSteps"),_errorSteps:o(U=>d(U),"_errorSteps")}),v}releaseLock(){if(!Y(this))throw We("releaseLock");this._ownerReadableStream!==void 0&&Re(this)}}Object.defineProperties(B.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),i(B.prototype.cancel,"cancel"),i(B.prototype.read,"read"),i(B.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(B.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function Y(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_readRequests")?!1:a instanceof B}o(Y,"IsReadableStreamDefaultReader");function te(a,s){let d=a._ownerReadableStream;d._disturbed=!0,d._state==="closed"?s._closeSteps():d._state==="errored"?s._errorSteps(d._storedError):d._readableStreamController[G](s)}o(te,"ReadableStreamDefaultReaderRead");function Re(a){ze(a);let s=new TypeError("Reader was released");Ge(a,s)}o(Re,"ReadableStreamDefaultReaderRelease");function Ge(a,s){let d=a._readRequests;a._readRequests=new H,d.forEach(v=>{v._errorSteps(s)})}o(Ge,"ReadableStreamDefaultReaderErrorReadRequests");function We(a){return new TypeError(`ReadableStreamDefaultReader.prototype.${a} can only be used on a ReadableStreamDefaultReader`)}o(We,"defaultReaderBrandCheckException");let Ie=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class De{static{o(this,"ReadableStreamAsyncIteratorImpl")}constructor(s,d){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=s,this._preventCancel=d}next(){let s=o(()=>this._nextSteps(),"nextSteps");return this._ongoingPromise=this._ongoingPromise?T(this._ongoingPromise,s,s):s(),this._ongoingPromise}return(s){let d=o(()=>this._returnSteps(s),"returnSteps");return this._ongoingPromise?T(this._ongoingPromise,d,d):d()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let s=this._reader,d,v,A=p((F,Q)=>{d=F,v=Q});return te(s,{_chunkSteps:o(F=>{this._ongoingPromise=void 0,w(()=>d({value:F,done:!1}))},"_chunkSteps"),_closeSteps:o(()=>{this._ongoingPromise=void 0,this._isFinished=!0,ze(s),d({value:void 0,done:!0})},"_closeSteps"),_errorSteps:o(F=>{this._ongoingPromise=void 0,this._isFinished=!0,ze(s),v(F)},"_errorSteps")}),A}_returnSteps(s){if(this._isFinished)return Promise.resolve({value:s,done:!0});this._isFinished=!0;let d=this._reader;if(!this._preventCancel){let v=ve(d,s);return ze(d),T(v,()=>({value:s,done:!0}))}return ze(d),f({value:s,done:!0})}}let st={next(){return oo(this)?this._asyncIteratorImpl.next():m(io("next"))},return(a){return oo(this)?this._asyncIteratorImpl.return(a):m(io("return"))}};Object.setPrototypeOf(st,Ie);function no(a,s){let d=j(a),v=new De(d,s),A=Object.create(st);return A._asyncIteratorImpl=v,A}o(no,"AcquireReadableStreamAsyncIterator");function oo(a){if(!r(a)||!Object.prototype.hasOwnProperty.call(a,"_asyncIteratorImpl"))return!1;try{return a._asyncIteratorImpl instanceof De}catch{return!1}}o(oo,"IsReadableStreamAsyncIterator");function io(a){return new TypeError(`ReadableStreamAsyncIterator.${a} can only be used on a ReadableSteamAsyncIterator`)}o(io,"streamAsyncIteratorBrandCheckException");let jt=Number.isNaN||function(a){return a!==a};var Fr,bt,ut;function Me(a){return a.slice()}o(Me,"CreateArrayFromList");function Zp(a,s,d,v,A){new Uint8Array(a).set(new Uint8Array(d,v,A),s)}o(Zp,"CopyDataBlockBytes");let Br=o(a=>(typeof a.transfer=="function"?Br=o(s=>s.transfer(),"TransferArrayBuffer"):typeof structuredClone=="function"?Br=o(s=>structuredClone(s,{transfer:[s]}),"TransferArrayBuffer"):Br=o(s=>s,"TransferArrayBuffer"),Br(a)),"TransferArrayBuffer"),sn=o(a=>(typeof a.detached=="boolean"?sn=o(s=>s.detached,"IsDetachedBuffer"):sn=o(s=>s.byteLength===0,"IsDetachedBuffer"),sn(a)),"IsDetachedBuffer");function Jp(a,s,d){if(a.slice)return a.slice(s,d);let v=d-s,A=new ArrayBuffer(v);return Zp(A,0,a,s,v),A}o(Jp,"ArrayBufferSlice");function ga(a,s){let d=a[s];if(d!=null){if(typeof d!="function")throw new TypeError(`${String(s)} is not a function`);return d}}o(ga,"GetMethod");function QP(a){let s={[Symbol.iterator]:()=>a.iterator},d=(async function*(){return yield*s})(),v=d.next;return{iterator:d,nextMethod:v,done:!1}}o(QP,"CreateAsyncFromSyncIterator");let Gu=(ut=(Fr=Symbol.asyncIterator)!==null&&Fr!==void 0?Fr:(bt=Symbol.for)===null||bt===void 0?void 0:bt.call(Symbol,"Symbol.asyncIterator"))!==null&&ut!==void 0?ut:"@@asyncIterator";function Kp(a,s="sync",d){if(d===void 0)if(s==="async"){if(d=ga(a,Gu),d===void 0){let U=ga(a,Symbol.iterator),F=Kp(a,"sync",U);return QP(F)}}else d=ga(a,Symbol.iterator);if(d===void 0)throw new TypeError("The object is not iterable");let v=k(d,a,[]);if(!r(v))throw new TypeError("The iterator method must return an object");let A=v.next;return{iterator:v,nextMethod:A,done:!1}}o(Kp,"GetIterator");function YP(a){let s=k(a.nextMethod,a.iterator,[]);if(!r(s))throw new TypeError("The iterator.next() method must return an object");return s}o(YP,"IteratorNext");function XP(a){return!!a.done}o(XP,"IteratorComplete");function eS(a){return a.value}o(eS,"IteratorValue");function tS(a){return!(typeof a!="number"||jt(a)||a<0)}o(tS,"IsNonNegativeNumber");function Qp(a){let s=Jp(a.buffer,a.byteOffset,a.byteOffset+a.byteLength);return new Uint8Array(s)}o(Qp,"CloneAsUint8Array");function Wu(a){let s=a._queue.shift();return a._queueTotalSize-=s.size,a._queueTotalSize<0&&(a._queueTotalSize=0),s.value}o(Wu,"DequeueValue");function Zu(a,s,d){if(!tS(d)||d===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");a._queue.push({value:s,size:d}),a._queueTotalSize+=d}o(Zu,"EnqueueValueWithSize");function rS(a){return a._queue.peek().value}o(rS,"PeekQueueValue");function un(a){a._queue=new H,a._queueTotalSize=0}o(un,"ResetQueue");function Yp(a){return a===DataView}o(Yp,"isDataViewConstructor");function nS(a){return Yp(a.constructor)}o(nS,"isDataView");function oS(a){return Yp(a)?1:a.BYTES_PER_ELEMENT}o(oS,"arrayBufferViewElementSize");class zn{static{o(this,"ReadableStreamBYOBRequest")}constructor(){throw new TypeError("Illegal constructor")}get view(){if(!Ju(this))throw ec("view");return this._view}respond(s){if(!Ju(this))throw ec("respond");if(at(s,1,"respond"),s=R(s,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(sn(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");va(this._associatedReadableByteStreamController,s)}respondWithNewView(s){if(!Ju(this))throw ec("respondWithNewView");if(at(s,1,"respondWithNewView"),!ArrayBuffer.isView(s))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(sn(s.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");Ea(this._associatedReadableByteStreamController,s)}}Object.defineProperties(zn.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),i(zn.prototype.respond,"respond"),i(zn.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(zn.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class qr{static{o(this,"ReadableByteStreamController")}constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Nn(this))throw ui("byobRequest");return Xu(this)}get desiredSize(){if(!Nn(this))throw ui("desiredSize");return cf(this)}close(){if(!Nn(this))throw ui("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let s=this._controlledReadableByteStream._state;if(s!=="readable")throw new TypeError(`The stream (in ${s} state) is not in the readable state and cannot be closed`);si(this)}enqueue(s){if(!Nn(this))throw ui("enqueue");if(at(s,1,"enqueue"),!ArrayBuffer.isView(s))throw new TypeError("chunk must be an array buffer view");if(s.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(s.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let d=this._controlledReadableByteStream._state;if(d!=="readable")throw new TypeError(`The stream (in ${d} state) is not in the readable state and cannot be enqueued to`);ba(this,s)}error(s=void 0){if(!Nn(this))throw ui("error");Xt(this,s)}[re](s){Xp(this),un(this);let d=this._cancelAlgorithm(s);return _a(this),d}[G](s){let d=this._controlledReadableByteStream;if(this._queueTotalSize>0){uf(this,s);return}let v=this._autoAllocateChunkSize;if(v!==void 0){let A;try{A=new ArrayBuffer(v)}catch(F){s._errorSteps(F);return}let U={buffer:A,bufferByteLength:v,byteOffset:0,byteLength:v,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(U)}I(d,s),Dn(this)}[je](){if(this._pendingPullIntos.length>0){let s=this._pendingPullIntos.peek();s.readerType="none",this._pendingPullIntos=new H,this._pendingPullIntos.push(s)}}}Object.defineProperties(qr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),i(qr.prototype.close,"close"),i(qr.prototype.enqueue,"enqueue"),i(qr.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(qr.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function Nn(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_controlledReadableByteStream")?!1:a instanceof qr}o(Nn,"IsReadableByteStreamController");function Ju(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_associatedReadableByteStreamController")?!1:a instanceof zn}o(Ju,"IsReadableStreamBYOBRequest");function Dn(a){if(!cS(a))return;if(a._pulling){a._pullAgain=!0;return}a._pulling=!0;let d=a._pullAlgorithm();P(d,()=>(a._pulling=!1,a._pullAgain&&(a._pullAgain=!1,Dn(a)),null),v=>(Xt(a,v),null))}o(Dn,"ReadableByteStreamControllerCallPullIfNeeded");function Xp(a){Qu(a),a._pendingPullIntos=new H}o(Xp,"ReadableByteStreamControllerClearPendingPullIntos");function Ku(a,s){let d=!1;a._state==="closed"&&(d=!0);let v=ef(s);s.readerType==="default"?O(a,v,d):hS(a,v,d)}o(Ku,"ReadableByteStreamControllerCommitPullIntoDescriptor");function ef(a){let s=a.bytesFilled,d=a.elementSize;return new a.viewConstructor(a.buffer,a.byteOffset,s/d)}o(ef,"ReadableByteStreamControllerConvertPullIntoDescriptor");function ya(a,s,d,v){a._queue.push({buffer:s,byteOffset:d,byteLength:v}),a._queueTotalSize+=v}o(ya,"ReadableByteStreamControllerEnqueueChunkToQueue");function tf(a,s,d,v){let A;try{A=Jp(s,d,d+v)}catch(U){throw Xt(a,U),U}ya(a,A,0,v)}o(tf,"ReadableByteStreamControllerEnqueueClonedChunkToQueue");function rf(a,s){s.bytesFilled>0&&tf(a,s.buffer,s.byteOffset,s.bytesFilled),ao(a)}o(rf,"ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue");function nf(a,s){let d=Math.min(a._queueTotalSize,s.byteLength-s.bytesFilled),v=s.bytesFilled+d,A=d,U=!1,F=v%s.elementSize,Q=v-F;Q>=s.minimumFill&&(A=Q-s.bytesFilled,U=!0);let le=a._queue;for(;A>0;){let oe=le.peek(),_e=Math.min(A,oe.byteLength),Pe=s.byteOffset+s.bytesFilled;Zp(s.buffer,Pe,oe.buffer,oe.byteOffset,_e),oe.byteLength===_e?le.shift():(oe.byteOffset+=_e,oe.byteLength-=_e),a._queueTotalSize-=_e,of(a,_e,s),A-=_e}return U}o(nf,"ReadableByteStreamControllerFillPullIntoDescriptorFromQueue");function of(a,s,d){d.bytesFilled+=s}o(of,"ReadableByteStreamControllerFillHeadPullIntoDescriptor");function af(a){a._queueTotalSize===0&&a._closeRequested?(_a(a),mi(a._controlledReadableByteStream)):Dn(a)}o(af,"ReadableByteStreamControllerHandleQueueDrain");function Qu(a){a._byobRequest!==null&&(a._byobRequest._associatedReadableByteStreamController=void 0,a._byobRequest._view=null,a._byobRequest=null)}o(Qu,"ReadableByteStreamControllerInvalidateBYOBRequest");function Yu(a){for(;a._pendingPullIntos.length>0;){if(a._queueTotalSize===0)return;let s=a._pendingPullIntos.peek();nf(a,s)&&(ao(a),Ku(a._controlledReadableByteStream,s))}}o(Yu,"ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue");function iS(a){let s=a._controlledReadableByteStream._reader;for(;s._readRequests.length>0;){if(a._queueTotalSize===0)return;let d=s._readRequests.shift();uf(a,d)}}o(iS,"ReadableByteStreamControllerProcessReadRequestsUsingQueue");function aS(a,s,d,v){let A=a._controlledReadableByteStream,U=s.constructor,F=oS(U),{byteOffset:Q,byteLength:le}=s,oe=d*F,_e;try{_e=Br(s.buffer)}catch(Fe){v._errorSteps(Fe);return}let Pe={buffer:_e,bufferByteLength:_e.byteLength,byteOffset:Q,byteLength:le,bytesFilled:0,minimumFill:oe,elementSize:F,viewConstructor:U,readerType:"byob"};if(a._pendingPullIntos.length>0){a._pendingPullIntos.push(Pe),pf(A,v);return}if(A._state==="closed"){let Fe=new U(Pe.buffer,Pe.byteOffset,0);v._closeSteps(Fe);return}if(a._queueTotalSize>0){if(nf(a,Pe)){let Fe=ef(Pe);af(a),v._chunkSteps(Fe);return}if(a._closeRequested){let Fe=new TypeError("Insufficient bytes to fill elements in the given buffer");Xt(a,Fe),v._errorSteps(Fe);return}}a._pendingPullIntos.push(Pe),pf(A,v),Dn(a)}o(aS,"ReadableByteStreamControllerPullInto");function sS(a,s){s.readerType==="none"&&ao(a);let d=a._controlledReadableByteStream;if(tc(d))for(;ff(d)>0;){let v=ao(a);Ku(d,v)}}o(sS,"ReadableByteStreamControllerRespondInClosedState");function uS(a,s,d){if(of(a,s,d),d.readerType==="none"){rf(a,d),Yu(a);return}if(d.bytesFilled<d.minimumFill)return;ao(a);let v=d.bytesFilled%d.elementSize;if(v>0){let A=d.byteOffset+d.bytesFilled;tf(a,d.buffer,A-v,v)}d.bytesFilled-=v,Ku(a._controlledReadableByteStream,d),Yu(a)}o(uS,"ReadableByteStreamControllerRespondInReadableState");function sf(a,s){let d=a._pendingPullIntos.peek();Qu(a),a._controlledReadableByteStream._state==="closed"?sS(a,d):uS(a,s,d),Dn(a)}o(sf,"ReadableByteStreamControllerRespondInternal");function ao(a){return a._pendingPullIntos.shift()}o(ao,"ReadableByteStreamControllerShiftPendingPullInto");function cS(a){let s=a._controlledReadableByteStream;return s._state!=="readable"||a._closeRequested||!a._started?!1:!!(z(s)&&D(s)>0||tc(s)&&ff(s)>0||cf(a)>0)}o(cS,"ReadableByteStreamControllerShouldCallPull");function _a(a){a._pullAlgorithm=void 0,a._cancelAlgorithm=void 0}o(_a,"ReadableByteStreamControllerClearAlgorithms");function si(a){let s=a._controlledReadableByteStream;if(!(a._closeRequested||s._state!=="readable")){if(a._queueTotalSize>0){a._closeRequested=!0;return}if(a._pendingPullIntos.length>0){let d=a._pendingPullIntos.peek();if(d.bytesFilled%d.elementSize!==0){let v=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Xt(a,v),v}}_a(a),mi(s)}}o(si,"ReadableByteStreamControllerClose");function ba(a,s){let d=a._controlledReadableByteStream;if(a._closeRequested||d._state!=="readable")return;let{buffer:v,byteOffset:A,byteLength:U}=s;if(sn(v))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");let F=Br(v);if(a._pendingPullIntos.length>0){let Q=a._pendingPullIntos.peek();if(sn(Q.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");Qu(a),Q.buffer=Br(Q.buffer),Q.readerType==="none"&&rf(a,Q)}if(z(d))if(iS(a),D(d)===0)ya(a,F,A,U);else{a._pendingPullIntos.length>0&&ao(a);let Q=new Uint8Array(F,A,U);O(d,Q,!1)}else tc(d)?(ya(a,F,A,U),Yu(a)):ya(a,F,A,U);Dn(a)}o(ba,"ReadableByteStreamControllerEnqueue");function Xt(a,s){let d=a._controlledReadableByteStream;d._state==="readable"&&(Xp(a),un(a),_a(a),Uf(d,s))}o(Xt,"ReadableByteStreamControllerError");function uf(a,s){let d=a._queue.shift();a._queueTotalSize-=d.byteLength,af(a);let v=new Uint8Array(d.buffer,d.byteOffset,d.byteLength);s._chunkSteps(v)}o(uf,"ReadableByteStreamControllerFillReadRequestFromQueue");function Xu(a){if(a._byobRequest===null&&a._pendingPullIntos.length>0){let s=a._pendingPullIntos.peek(),d=new Uint8Array(s.buffer,s.byteOffset+s.bytesFilled,s.byteLength-s.bytesFilled),v=Object.create(zn.prototype);dS(v,a,d),a._byobRequest=v}return a._byobRequest}o(Xu,"ReadableByteStreamControllerGetBYOBRequest");function cf(a){let s=a._controlledReadableByteStream._state;return s==="errored"?null:s==="closed"?0:a._strategyHWM-a._queueTotalSize}o(cf,"ReadableByteStreamControllerGetDesiredSize");function va(a,s){let d=a._pendingPullIntos.peek();if(a._controlledReadableByteStream._state==="closed"){if(s!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(s===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(d.bytesFilled+s>d.byteLength)throw new RangeError("bytesWritten out of range")}d.buffer=Br(d.buffer),sf(a,s)}o(va,"ReadableByteStreamControllerRespond");function Ea(a,s){let d=a._pendingPullIntos.peek();if(a._controlledReadableByteStream._state==="closed"){if(s.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(s.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(d.byteOffset+d.bytesFilled!==s.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(d.bufferByteLength!==s.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(d.bytesFilled+s.byteLength>d.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let A=s.byteLength;d.buffer=Br(s.buffer),sf(a,A)}o(Ea,"ReadableByteStreamControllerRespondWithNewView");function lf(a,s,d,v,A,U,F){s._controlledReadableByteStream=a,s._pullAgain=!1,s._pulling=!1,s._byobRequest=null,s._queue=s._queueTotalSize=void 0,un(s),s._closeRequested=!1,s._started=!1,s._strategyHWM=U,s._pullAlgorithm=v,s._cancelAlgorithm=A,s._autoAllocateChunkSize=F,s._pendingPullIntos=new H,a._readableStreamController=s;let Q=d();P(f(Q),()=>(s._started=!0,Dn(s),null),le=>(Xt(s,le),null))}o(lf,"SetUpReadableByteStreamController");function lS(a,s,d){let v=Object.create(qr.prototype),A,U,F;s.start!==void 0?A=o(()=>s.start(v),"startAlgorithm"):A=o(()=>{},"startAlgorithm"),s.pull!==void 0?U=o(()=>s.pull(v),"pullAlgorithm"):U=o(()=>f(void 0),"pullAlgorithm"),s.cancel!==void 0?F=o(le=>s.cancel(le),"cancelAlgorithm"):F=o(()=>f(void 0),"cancelAlgorithm");let Q=s.autoAllocateChunkSize;if(Q===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");lf(a,v,A,U,F,d,Q)}o(lS,"SetUpReadableByteStreamControllerFromUnderlyingSource");function dS(a,s,d){a._associatedReadableByteStreamController=s,a._view=d}o(dS,"SetUpReadableStreamBYOBRequest");function ec(a){return new TypeError(`ReadableStreamBYOBRequest.prototype.${a} can only be used on a ReadableStreamBYOBRequest`)}o(ec,"byobRequestBrandCheckException");function ui(a){return new TypeError(`ReadableByteStreamController.prototype.${a} can only be used on a ReadableByteStreamController`)}o(ui,"byteStreamControllerBrandCheckException");function pS(a,s){Rt(a,s);let d=a?.mode;return{mode:d===void 0?void 0:fS(d,`${s} has member 'mode' that`)}}o(pS,"convertReaderOptions");function fS(a,s){if(a=`${a}`,a!=="byob")throw new TypeError(`${s} '${a}' is not a valid enumeration value for ReadableStreamReaderMode`);return a}o(fS,"convertReadableStreamReaderMode");function mS(a,s){var d;Rt(a,s);let v=(d=a?.min)!==null&&d!==void 0?d:1;return{min:R(v,`${s} has member 'min' that`)}}o(mS,"convertByobReadOptions");function df(a){return new cn(a)}o(df,"AcquireReadableStreamBYOBReader");function pf(a,s){a._reader._readIntoRequests.push(s)}o(pf,"ReadableStreamAddReadIntoRequest");function hS(a,s,d){let A=a._reader._readIntoRequests.shift();d?A._closeSteps(s):A._chunkSteps(s)}o(hS,"ReadableStreamFulfillReadIntoRequest");function ff(a){return a._reader._readIntoRequests.length}o(ff,"ReadableStreamGetNumReadIntoRequests");function tc(a){let s=a._reader;return!(s===void 0||!Un(s))}o(tc,"ReadableStreamHasBYOBReader");class cn{static{o(this,"ReadableStreamBYOBReader")}constructor(s){if(at(s,1,"ReadableStreamBYOBReader"),$(s,"First parameter"),pn(s))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Nn(s._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Ee(this,s),this._readIntoRequests=new H}get closed(){return Un(this)?this._closedPromise:m(Pa("closed"))}cancel(s=void 0){return Un(this)?this._ownerReadableStream===void 0?m($e("cancel")):ve(this,s):m(Pa("cancel"))}read(s,d={}){if(!Un(this))return m(Pa("read"));if(!ArrayBuffer.isView(s))return m(new TypeError("view must be an array buffer view"));if(s.byteLength===0)return m(new TypeError("view must have non-zero byteLength"));if(s.buffer.byteLength===0)return m(new TypeError("view's buffer must have non-zero byteLength"));if(sn(s.buffer))return m(new TypeError("view's buffer has been detached"));let v;try{v=mS(d,"options")}catch(oe){return m(oe)}let A=v.min;if(A===0)return m(new TypeError("options.min must be greater than 0"));if(nS(s)){if(A>s.byteLength)return m(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(A>s.length)return m(new RangeError("options.min must be less than or equal to view's length"));if(this._ownerReadableStream===void 0)return m($e("read from"));let U,F,Q=p((oe,_e)=>{U=oe,F=_e});return mf(this,s,A,{_chunkSteps:o(oe=>U({value:oe,done:!1}),"_chunkSteps"),_closeSteps:o(oe=>U({value:oe,done:!0}),"_closeSteps"),_errorSteps:o(oe=>F(oe),"_errorSteps")}),Q}releaseLock(){if(!Un(this))throw Pa("releaseLock");this._ownerReadableStream!==void 0&&gS(this)}}Object.defineProperties(cn.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),i(cn.prototype.cancel,"cancel"),i(cn.prototype.read,"read"),i(cn.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(cn.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function Un(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_readIntoRequests")?!1:a instanceof cn}o(Un,"IsReadableStreamBYOBReader");function mf(a,s,d,v){let A=a._ownerReadableStream;A._disturbed=!0,A._state==="errored"?v._errorSteps(A._storedError):aS(A._readableStreamController,s,d,v)}o(mf,"ReadableStreamBYOBReaderRead");function gS(a){ze(a);let s=new TypeError("Reader was released");hf(a,s)}o(gS,"ReadableStreamBYOBReaderRelease");function hf(a,s){let d=a._readIntoRequests;a._readIntoRequests=new H,d.forEach(v=>{v._errorSteps(s)})}o(hf,"ReadableStreamBYOBReaderErrorReadIntoRequests");function Pa(a){return new TypeError(`ReadableStreamBYOBReader.prototype.${a} can only be used on a ReadableStreamBYOBReader`)}o(Pa,"byobReaderBrandCheckException");function ci(a,s){let{highWaterMark:d}=a;if(d===void 0)return s;if(jt(d)||d<0)throw new RangeError("Invalid highWaterMark");return d}o(ci,"ExtractHighWaterMark");function Sa(a){let{size:s}=a;return s||(()=>1)}o(Sa,"ExtractSizeAlgorithm");function Ta(a,s){Rt(a,s);let d=a?.highWaterMark,v=a?.size;return{highWaterMark:d===void 0?void 0:S(d),size:v===void 0?void 0:yS(v,`${s} has member 'size' that`)}}o(Ta,"convertQueuingStrategy");function yS(a,s){return St(a,s),d=>S(a(d))}o(yS,"convertQueuingStrategySize");function _S(a,s){Rt(a,s);let d=a?.abort,v=a?.close,A=a?.start,U=a?.type,F=a?.write;return{abort:d===void 0?void 0:bS(d,a,`${s} has member 'abort' that`),close:v===void 0?void 0:vS(v,a,`${s} has member 'close' that`),start:A===void 0?void 0:ES(A,a,`${s} has member 'start' that`),write:F===void 0?void 0:PS(F,a,`${s} has member 'write' that`),type:U}}o(_S,"convertUnderlyingSink");function bS(a,s,d){return St(a,d),v=>q(a,s,[v])}o(bS,"convertUnderlyingSinkAbortCallback");function vS(a,s,d){return St(a,d),()=>q(a,s,[])}o(vS,"convertUnderlyingSinkCloseCallback");function ES(a,s,d){return St(a,d),v=>k(a,s,[v])}o(ES,"convertUnderlyingSinkStartCallback");function PS(a,s,d){return St(a,d),(v,A)=>q(a,s,[v,A])}o(PS,"convertUnderlyingSinkWriteCallback");function gf(a,s){if(!so(a))throw new TypeError(`${s} is not a WritableStream.`)}o(gf,"assertWritableStream");function SS(a){if(typeof a!="object"||a===null)return!1;try{return typeof a.aborted=="boolean"}catch{return!1}}o(SS,"isAbortSignal");let TS=typeof AbortController=="function";function wS(){if(TS)return new AbortController}o(wS,"createAbortController");class ln{static{o(this,"WritableStream")}constructor(s={},d={}){s===void 0?s=null:Tt(s,"First parameter");let v=Ta(d,"Second parameter"),A=_S(s,"First parameter");if(_f(this),A.type!==void 0)throw new RangeError("Invalid type is specified");let F=Sa(v),Q=ci(v,1);MS(this,A,Q,F)}get locked(){if(!so(this))throw Ra("locked");return uo(this)}abort(s=void 0){return so(this)?uo(this)?m(new TypeError("Cannot abort a stream that already has a writer")):wa(this,s):m(Ra("abort"))}close(){return so(this)?uo(this)?m(new TypeError("Cannot close a stream that already has a writer")):xr(this)?m(new TypeError("Cannot close an already-closing stream")):bf(this):m(Ra("close"))}getWriter(){if(!so(this))throw Ra("getWriter");return yf(this)}}Object.defineProperties(ln.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),i(ln.prototype.abort,"abort"),i(ln.prototype.close,"close"),i(ln.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ln.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});function yf(a){return new Vr(a)}o(yf,"AcquireWritableStreamDefaultWriter");function xS(a,s,d,v,A=1,U=()=>1){let F=Object.create(ln.prototype);_f(F);let Q=Object.create(co.prototype);return wf(F,Q,a,s,d,v,A,U),F}o(xS,"CreateWritableStream");function _f(a){a._state="writable",a._storedError=void 0,a._writer=void 0,a._writableStreamController=void 0,a._writeRequests=new H,a._inFlightWriteRequest=void 0,a._closeRequest=void 0,a._inFlightCloseRequest=void 0,a._pendingAbortRequest=void 0,a._backpressure=!1}o(_f,"InitializeWritableStream");function so(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_writableStreamController")?!1:a instanceof ln}o(so,"IsWritableStream");function uo(a){return a._writer!==void 0}o(uo,"IsWritableStreamLocked");function wa(a,s){var d;if(a._state==="closed"||a._state==="errored")return f(void 0);a._writableStreamController._abortReason=s,(d=a._writableStreamController._abortController)===null||d===void 0||d.abort(s);let v=a._state;if(v==="closed"||v==="errored")return f(void 0);if(a._pendingAbortRequest!==void 0)return a._pendingAbortRequest._promise;let A=!1;v==="erroring"&&(A=!0,s=void 0);let U=p((F,Q)=>{a._pendingAbortRequest={_promise:void 0,_resolve:F,_reject:Q,_reason:s,_wasAlreadyErroring:A}});return a._pendingAbortRequest._promise=U,A||nc(a,s),U}o(wa,"WritableStreamAbort");function bf(a){let s=a._state;if(s==="closed"||s==="errored")return m(new TypeError(`The stream (in ${s} state) is not in the writable state and cannot be closed`));let d=p((A,U)=>{let F={_resolve:A,_reject:U};a._closeRequest=F}),v=a._writer;return v!==void 0&&a._backpressure&&s==="writable"&&dc(v),LS(a._writableStreamController),d}o(bf,"WritableStreamClose");function AS(a){return p((d,v)=>{let A={_resolve:d,_reject:v};a._writeRequests.push(A)})}o(AS,"WritableStreamAddWriteRequest");function rc(a,s){if(a._state==="writable"){nc(a,s);return}oc(a)}o(rc,"WritableStreamDealWithRejection");function nc(a,s){let d=a._writableStreamController;a._state="erroring",a._storedError=s;let v=a._writer;v!==void 0&&Ef(v,s),!kS(a)&&d._started&&oc(a)}o(nc,"WritableStreamStartErroring");function oc(a){a._state="errored",a._writableStreamController[J]();let s=a._storedError;if(a._writeRequests.forEach(A=>{A._reject(s)}),a._writeRequests=new H,a._pendingAbortRequest===void 0){xa(a);return}let d=a._pendingAbortRequest;if(a._pendingAbortRequest=void 0,d._wasAlreadyErroring){d._reject(s),xa(a);return}let v=a._writableStreamController[V](d._reason);P(v,()=>(d._resolve(),xa(a),null),A=>(d._reject(A),xa(a),null))}o(oc,"WritableStreamFinishErroring");function IS(a){a._inFlightWriteRequest._resolve(void 0),a._inFlightWriteRequest=void 0}o(IS,"WritableStreamFinishInFlightWrite");function RS(a,s){a._inFlightWriteRequest._reject(s),a._inFlightWriteRequest=void 0,rc(a,s)}o(RS,"WritableStreamFinishInFlightWriteWithError");function CS(a){a._inFlightCloseRequest._resolve(void 0),a._inFlightCloseRequest=void 0,a._state==="erroring"&&(a._storedError=void 0,a._pendingAbortRequest!==void 0&&(a._pendingAbortRequest._resolve(),a._pendingAbortRequest=void 0)),a._state="closed";let d=a._writer;d!==void 0&&Rf(d)}o(CS,"WritableStreamFinishInFlightClose");function OS(a,s){a._inFlightCloseRequest._reject(s),a._inFlightCloseRequest=void 0,a._pendingAbortRequest!==void 0&&(a._pendingAbortRequest._reject(s),a._pendingAbortRequest=void 0),rc(a,s)}o(OS,"WritableStreamFinishInFlightCloseWithError");function xr(a){return!(a._closeRequest===void 0&&a._inFlightCloseRequest===void 0)}o(xr,"WritableStreamCloseQueuedOrInFlight");function kS(a){return!(a._inFlightWriteRequest===void 0&&a._inFlightCloseRequest===void 0)}o(kS,"WritableStreamHasOperationMarkedInFlight");function $S(a){a._inFlightCloseRequest=a._closeRequest,a._closeRequest=void 0}o($S,"WritableStreamMarkCloseRequestInFlight");function zS(a){a._inFlightWriteRequest=a._writeRequests.shift()}o(zS,"WritableStreamMarkFirstWriteRequestInFlight");function xa(a){a._closeRequest!==void 0&&(a._closeRequest._reject(a._storedError),a._closeRequest=void 0);let s=a._writer;s!==void 0&&cc(s,a._storedError)}o(xa,"WritableStreamRejectCloseAndClosedPromiseIfNeeded");function ic(a,s){let d=a._writer;d!==void 0&&s!==a._backpressure&&(s?WS(d):dc(d)),a._backpressure=s}o(ic,"WritableStreamUpdateBackpressure");class Vr{static{o(this,"WritableStreamDefaultWriter")}constructor(s){if(at(s,1,"WritableStreamDefaultWriter"),gf(s,"First parameter"),uo(s))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=s,s._writer=this;let d=s._state;if(d==="writable")!xr(s)&&s._backpressure?Oa(this):Cf(this),Ca(this);else if(d==="erroring")lc(this,s._storedError),Ca(this);else if(d==="closed")Cf(this),HS(this);else{let v=s._storedError;lc(this,v),If(this,v)}}get closed(){return jn(this)?this._closedPromise:m(Mn("closed"))}get desiredSize(){if(!jn(this))throw Mn("desiredSize");if(this._ownerWritableStream===void 0)throw di("desiredSize");return jS(this)}get ready(){return jn(this)?this._readyPromise:m(Mn("ready"))}abort(s=void 0){return jn(this)?this._ownerWritableStream===void 0?m(di("abort")):NS(this,s):m(Mn("abort"))}close(){if(!jn(this))return m(Mn("close"));let s=this._ownerWritableStream;return s===void 0?m(di("close")):xr(s)?m(new TypeError("Cannot close an already-closing stream")):vf(this)}releaseLock(){if(!jn(this))throw Mn("releaseLock");this._ownerWritableStream!==void 0&&Pf(this)}write(s=void 0){return jn(this)?this._ownerWritableStream===void 0?m(di("write to")):Sf(this,s):m(Mn("write"))}}Object.defineProperties(Vr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),i(Vr.prototype.abort,"abort"),i(Vr.prototype.close,"close"),i(Vr.prototype.releaseLock,"releaseLock"),i(Vr.prototype.write,"write"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Vr.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function jn(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_ownerWritableStream")?!1:a instanceof Vr}o(jn,"IsWritableStreamDefaultWriter");function NS(a,s){let d=a._ownerWritableStream;return wa(d,s)}o(NS,"WritableStreamDefaultWriterAbort");function vf(a){let s=a._ownerWritableStream;return bf(s)}o(vf,"WritableStreamDefaultWriterClose");function DS(a){let s=a._ownerWritableStream,d=s._state;return xr(s)||d==="closed"?f(void 0):d==="errored"?m(s._storedError):vf(a)}o(DS,"WritableStreamDefaultWriterCloseWithErrorPropagation");function US(a,s){a._closedPromiseState==="pending"?cc(a,s):GS(a,s)}o(US,"WritableStreamDefaultWriterEnsureClosedPromiseRejected");function Ef(a,s){a._readyPromiseState==="pending"?Of(a,s):ZS(a,s)}o(Ef,"WritableStreamDefaultWriterEnsureReadyPromiseRejected");function jS(a){let s=a._ownerWritableStream,d=s._state;return d==="errored"||d==="erroring"?null:d==="closed"?0:xf(s._writableStreamController)}o(jS,"WritableStreamDefaultWriterGetDesiredSize");function Pf(a){let s=a._ownerWritableStream,d=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Ef(a,d),US(a,d),s._writer=void 0,a._ownerWritableStream=void 0}o(Pf,"WritableStreamDefaultWriterRelease");function Sf(a,s){let d=a._ownerWritableStream,v=d._writableStreamController,A=FS(v,s);if(d!==a._ownerWritableStream)return m(di("write to"));let U=d._state;if(U==="errored")return m(d._storedError);if(xr(d)||U==="closed")return m(new TypeError("The stream is closing or closed and cannot be written to"));if(U==="erroring")return m(d._storedError);let F=AS(d);return BS(v,s,A),F}o(Sf,"WritableStreamDefaultWriterWrite");let Tf={};class co{static{o(this,"WritableStreamDefaultController")}constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!ac(this))throw uc("abortReason");return this._abortReason}get signal(){if(!ac(this))throw uc("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(s=void 0){if(!ac(this))throw uc("error");this._controlledWritableStream._state==="writable"&&Af(this,s)}[V](s){let d=this._abortAlgorithm(s);return Aa(this),d}[J](){un(this)}}Object.defineProperties(co.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(co.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function ac(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_controlledWritableStream")?!1:a instanceof co}o(ac,"IsWritableStreamDefaultController");function wf(a,s,d,v,A,U,F,Q){s._controlledWritableStream=a,a._writableStreamController=s,s._queue=void 0,s._queueTotalSize=void 0,un(s),s._abortReason=void 0,s._abortController=wS(),s._started=!1,s._strategySizeAlgorithm=Q,s._strategyHWM=F,s._writeAlgorithm=v,s._closeAlgorithm=A,s._abortAlgorithm=U;let le=sc(s);ic(a,le);let oe=d(),_e=f(oe);P(_e,()=>(s._started=!0,Ia(s),null),Pe=>(s._started=!0,rc(a,Pe),null))}o(wf,"SetUpWritableStreamDefaultController");function MS(a,s,d,v){let A=Object.create(co.prototype),U,F,Q,le;s.start!==void 0?U=o(()=>s.start(A),"startAlgorithm"):U=o(()=>{},"startAlgorithm"),s.write!==void 0?F=o(oe=>s.write(oe,A),"writeAlgorithm"):F=o(()=>f(void 0),"writeAlgorithm"),s.close!==void 0?Q=o(()=>s.close(),"closeAlgorithm"):Q=o(()=>f(void 0),"closeAlgorithm"),s.abort!==void 0?le=o(oe=>s.abort(oe),"abortAlgorithm"):le=o(()=>f(void 0),"abortAlgorithm"),wf(a,A,U,F,Q,le,d,v)}o(MS,"SetUpWritableStreamDefaultControllerFromUnderlyingSink");function Aa(a){a._writeAlgorithm=void 0,a._closeAlgorithm=void 0,a._abortAlgorithm=void 0,a._strategySizeAlgorithm=void 0}o(Aa,"WritableStreamDefaultControllerClearAlgorithms");function LS(a){Zu(a,Tf,0),Ia(a)}o(LS,"WritableStreamDefaultControllerClose");function FS(a,s){try{return a._strategySizeAlgorithm(s)}catch(d){return li(a,d),1}}o(FS,"WritableStreamDefaultControllerGetChunkSize");function xf(a){return a._strategyHWM-a._queueTotalSize}o(xf,"WritableStreamDefaultControllerGetDesiredSize");function BS(a,s,d){try{Zu(a,s,d)}catch(A){li(a,A);return}let v=a._controlledWritableStream;if(!xr(v)&&v._state==="writable"){let A=sc(a);ic(v,A)}Ia(a)}o(BS,"WritableStreamDefaultControllerWrite");function Ia(a){let s=a._controlledWritableStream;if(!a._started||s._inFlightWriteRequest!==void 0)return;if(s._state==="erroring"){oc(s);return}if(a._queue.length===0)return;let v=rS(a);v===Tf?qS(a):VS(a,v)}o(Ia,"WritableStreamDefaultControllerAdvanceQueueIfNeeded");function li(a,s){a._controlledWritableStream._state==="writable"&&Af(a,s)}o(li,"WritableStreamDefaultControllerErrorIfNeeded");function qS(a){let s=a._controlledWritableStream;$S(s),Wu(a);let d=a._closeAlgorithm();Aa(a),P(d,()=>(CS(s),null),v=>(OS(s,v),null))}o(qS,"WritableStreamDefaultControllerProcessClose");function VS(a,s){let d=a._controlledWritableStream;zS(d);let v=a._writeAlgorithm(s);P(v,()=>{IS(d);let A=d._state;if(Wu(a),!xr(d)&&A==="writable"){let U=sc(a);ic(d,U)}return Ia(a),null},A=>(d._state==="writable"&&Aa(a),RS(d,A),null))}o(VS,"WritableStreamDefaultControllerProcessWrite");function sc(a){return xf(a)<=0}o(sc,"WritableStreamDefaultControllerGetBackpressure");function Af(a,s){let d=a._controlledWritableStream;Aa(a),nc(d,s)}o(Af,"WritableStreamDefaultControllerError");function Ra(a){return new TypeError(`WritableStream.prototype.${a} can only be used on a WritableStream`)}o(Ra,"streamBrandCheckException$2");function uc(a){return new TypeError(`WritableStreamDefaultController.prototype.${a} can only be used on a WritableStreamDefaultController`)}o(uc,"defaultControllerBrandCheckException$2");function Mn(a){return new TypeError(`WritableStreamDefaultWriter.prototype.${a} can only be used on a WritableStreamDefaultWriter`)}o(Mn,"defaultWriterBrandCheckException");function di(a){return new TypeError("Cannot "+a+" a stream using a released writer")}o(di,"defaultWriterLockException");function Ca(a){a._closedPromise=p((s,d)=>{a._closedPromise_resolve=s,a._closedPromise_reject=d,a._closedPromiseState="pending"})}o(Ca,"defaultWriterClosedPromiseInitialize");function If(a,s){Ca(a),cc(a,s)}o(If,"defaultWriterClosedPromiseInitializeAsRejected");function HS(a){Ca(a),Rf(a)}o(HS,"defaultWriterClosedPromiseInitializeAsResolved");function cc(a,s){a._closedPromise_reject!==void 0&&(E(a._closedPromise),a._closedPromise_reject(s),a._closedPromise_resolve=void 0,a._closedPromise_reject=void 0,a._closedPromiseState="rejected")}o(cc,"defaultWriterClosedPromiseReject");function GS(a,s){If(a,s)}o(GS,"defaultWriterClosedPromiseResetToRejected");function Rf(a){a._closedPromise_resolve!==void 0&&(a._closedPromise_resolve(void 0),a._closedPromise_resolve=void 0,a._closedPromise_reject=void 0,a._closedPromiseState="resolved")}o(Rf,"defaultWriterClosedPromiseResolve");function Oa(a){a._readyPromise=p((s,d)=>{a._readyPromise_resolve=s,a._readyPromise_reject=d}),a._readyPromiseState="pending"}o(Oa,"defaultWriterReadyPromiseInitialize");function lc(a,s){Oa(a),Of(a,s)}o(lc,"defaultWriterReadyPromiseInitializeAsRejected");function Cf(a){Oa(a),dc(a)}o(Cf,"defaultWriterReadyPromiseInitializeAsResolved");function Of(a,s){a._readyPromise_reject!==void 0&&(E(a._readyPromise),a._readyPromise_reject(s),a._readyPromise_resolve=void 0,a._readyPromise_reject=void 0,a._readyPromiseState="rejected")}o(Of,"defaultWriterReadyPromiseReject");function WS(a){Oa(a)}o(WS,"defaultWriterReadyPromiseReset");function ZS(a,s){lc(a,s)}o(ZS,"defaultWriterReadyPromiseResetToRejected");function dc(a){a._readyPromise_resolve!==void 0&&(a._readyPromise_resolve(void 0),a._readyPromise_resolve=void 0,a._readyPromise_reject=void 0,a._readyPromiseState="fulfilled")}o(dc,"defaultWriterReadyPromiseResolve");function JS(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof global<"u")return global}o(JS,"getGlobals");let pc=JS();function KS(a){if(!(typeof a=="function"||typeof a=="object")||a.name!=="DOMException")return!1;try{return new a,!0}catch{return!1}}o(KS,"isDOMExceptionConstructor");function QS(){let a=pc?.DOMException;return KS(a)?a:void 0}o(QS,"getFromGlobal");function YS(){let a=o(function(d,v){this.message=d||"",this.name=v||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)},"DOMException");return i(a,"DOMException"),a.prototype=Object.create(Error.prototype),Object.defineProperty(a.prototype,"constructor",{value:a,writable:!0,configurable:!0}),a}o(YS,"createPolyfill");let XS=QS()||YS();function kf(a,s,d,v,A,U){let F=j(a),Q=yf(s);a._disturbed=!0;let le=!1,oe=f(void 0);return p((_e,Pe)=>{let Fe;if(U!==void 0){if(Fe=o(()=>{let ae=U.reason!==void 0?U.reason:new XS("Aborted","AbortError"),we=[];v||we.push(()=>s._state==="writable"?wa(s,ae):f(void 0)),A||we.push(()=>a._state==="readable"?dr(a,ae):f(void 0)),Ct(()=>Promise.all(we.map(Be=>Be())),!0,ae)},"abortAlgorithm"),U.aborted){Fe();return}U.addEventListener("abort",Fe)}function pr(){return p((ae,we)=>{function Be(Mt){Mt?ae():y(mo(),Be,we)}o(Be,"next"),Be(!1)})}o(pr,"pipeLoop");function mo(){return le?f(!0):y(Q._readyPromise,()=>p((ae,we)=>{te(F,{_chunkSteps:o(Be=>{oe=y(Sf(Q,Be),void 0,e),ae(!1)},"_chunkSteps"),_closeSteps:o(()=>ae(!0),"_closeSteps"),_errorSteps:we})}))}if(o(mo,"pipeStep"),Gr(a,F._closedPromise,ae=>(v?er(!0,ae):Ct(()=>wa(s,ae),!0,ae),null)),Gr(s,Q._closedPromise,ae=>(A?er(!0,ae):Ct(()=>dr(a,ae),!0,ae),null)),wt(a,F._closedPromise,()=>(d?er():Ct(()=>DS(Q)),null)),xr(s)||s._state==="closed"){let ae=new TypeError("the destination writable stream closed before all data could be piped to it");A?er(!0,ae):Ct(()=>dr(a,ae),!0,ae)}E(pr());function mn(){let ae=oe;return y(oe,()=>ae!==oe?mn():void 0)}o(mn,"waitForWritesToFinish");function Gr(ae,we,Be){ae._state==="errored"?Be(ae._storedError):b(we,Be)}o(Gr,"isOrBecomesErrored");function wt(ae,we,Be){ae._state==="closed"?Be():h(we,Be)}o(wt,"isOrBecomesClosed");function Ct(ae,we,Be){if(le)return;le=!0,s._state==="writable"&&!xr(s)?h(mn(),Mt):Mt();function Mt(){return P(ae(),()=>Wr(we,Be),ho=>Wr(!0,ho)),null}o(Mt,"doTheRest")}o(Ct,"shutdownWithAction");function er(ae,we){le||(le=!0,s._state==="writable"&&!xr(s)?h(mn(),()=>Wr(ae,we)):Wr(ae,we))}o(er,"shutdown");function Wr(ae,we){return Pf(Q),ze(F),U!==void 0&&U.removeEventListener("abort",Fe),ae?Pe(we):_e(void 0),null}o(Wr,"finalize")})}o(kf,"ReadableStreamPipeTo");class Hr{static{o(this,"ReadableStreamDefaultController")}constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!ka(this))throw za("desiredSize");return fc(this)}close(){if(!ka(this))throw za("close");if(!po(this))throw new TypeError("The stream is not in a state that permits close");Ln(this)}enqueue(s=void 0){if(!ka(this))throw za("enqueue");if(!po(this))throw new TypeError("The stream is not in a state that permits enqueue");return lo(this,s)}error(s=void 0){if(!ka(this))throw za("error");lr(this,s)}[re](s){un(this);let d=this._cancelAlgorithm(s);return $a(this),d}[G](s){let d=this._controlledReadableStream;if(this._queue.length>0){let v=Wu(this);this._closeRequested&&this._queue.length===0?($a(this),mi(d)):pi(this),s._chunkSteps(v)}else I(d,s),pi(this)}[je](){}}Object.defineProperties(Hr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),i(Hr.prototype.close,"close"),i(Hr.prototype.enqueue,"enqueue"),i(Hr.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Hr.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function ka(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_controlledReadableStream")?!1:a instanceof Hr}o(ka,"IsReadableStreamDefaultController");function pi(a){if(!$f(a))return;if(a._pulling){a._pullAgain=!0;return}a._pulling=!0;let d=a._pullAlgorithm();P(d,()=>(a._pulling=!1,a._pullAgain&&(a._pullAgain=!1,pi(a)),null),v=>(lr(a,v),null))}o(pi,"ReadableStreamDefaultControllerCallPullIfNeeded");function $f(a){let s=a._controlledReadableStream;return!po(a)||!a._started?!1:!!(pn(s)&&D(s)>0||fc(a)>0)}o($f,"ReadableStreamDefaultControllerShouldCallPull");function $a(a){a._pullAlgorithm=void 0,a._cancelAlgorithm=void 0,a._strategySizeAlgorithm=void 0}o($a,"ReadableStreamDefaultControllerClearAlgorithms");function Ln(a){if(!po(a))return;let s=a._controlledReadableStream;a._closeRequested=!0,a._queue.length===0&&($a(a),mi(s))}o(Ln,"ReadableStreamDefaultControllerClose");function lo(a,s){if(!po(a))return;let d=a._controlledReadableStream;if(pn(d)&&D(d)>0)O(d,s,!1);else{let v;try{v=a._strategySizeAlgorithm(s)}catch(A){throw lr(a,A),A}try{Zu(a,s,v)}catch(A){throw lr(a,A),A}}pi(a)}o(lo,"ReadableStreamDefaultControllerEnqueue");function lr(a,s){let d=a._controlledReadableStream;d._state==="readable"&&(un(a),$a(a),Uf(d,s))}o(lr,"ReadableStreamDefaultControllerError");function fc(a){let s=a._controlledReadableStream._state;return s==="errored"?null:s==="closed"?0:a._strategyHWM-a._queueTotalSize}o(fc,"ReadableStreamDefaultControllerGetDesiredSize");function eT(a){return!$f(a)}o(eT,"ReadableStreamDefaultControllerHasBackpressure");function po(a){let s=a._controlledReadableStream._state;return!a._closeRequested&&s==="readable"}o(po,"ReadableStreamDefaultControllerCanCloseOrEnqueue");function zf(a,s,d,v,A,U,F){s._controlledReadableStream=a,s._queue=void 0,s._queueTotalSize=void 0,un(s),s._started=!1,s._closeRequested=!1,s._pullAgain=!1,s._pulling=!1,s._strategySizeAlgorithm=F,s._strategyHWM=U,s._pullAlgorithm=v,s._cancelAlgorithm=A,a._readableStreamController=s;let Q=d();P(f(Q),()=>(s._started=!0,pi(s),null),le=>(lr(s,le),null))}o(zf,"SetUpReadableStreamDefaultController");function tT(a,s,d,v){let A=Object.create(Hr.prototype),U,F,Q;s.start!==void 0?U=o(()=>s.start(A),"startAlgorithm"):U=o(()=>{},"startAlgorithm"),s.pull!==void 0?F=o(()=>s.pull(A),"pullAlgorithm"):F=o(()=>f(void 0),"pullAlgorithm"),s.cancel!==void 0?Q=o(le=>s.cancel(le),"cancelAlgorithm"):Q=o(()=>f(void 0),"cancelAlgorithm"),zf(a,A,U,F,Q,d,v)}o(tT,"SetUpReadableStreamDefaultControllerFromUnderlyingSource");function za(a){return new TypeError(`ReadableStreamDefaultController.prototype.${a} can only be used on a ReadableStreamDefaultController`)}o(za,"defaultControllerBrandCheckException$1");function rT(a,s){return Nn(a._readableStreamController)?oT(a):nT(a)}o(rT,"ReadableStreamTee");function nT(a,s){let d=j(a),v=!1,A=!1,U=!1,F=!1,Q,le,oe,_e,Pe,Fe=p(wt=>{Pe=wt});function pr(){return v?(A=!0,f(void 0)):(v=!0,te(d,{_chunkSteps:o(Ct=>{w(()=>{A=!1;let er=Ct,Wr=Ct;U||lo(oe._readableStreamController,er),F||lo(_e._readableStreamController,Wr),v=!1,A&&pr()})},"_chunkSteps"),_closeSteps:o(()=>{v=!1,U||Ln(oe._readableStreamController),F||Ln(_e._readableStreamController),(!U||!F)&&Pe(void 0)},"_closeSteps"),_errorSteps:o(()=>{v=!1},"_errorSteps")}),f(void 0))}o(pr,"pullAlgorithm");function mo(wt){if(U=!0,Q=wt,F){let Ct=Me([Q,le]),er=dr(a,Ct);Pe(er)}return Fe}o(mo,"cancel1Algorithm");function mn(wt){if(F=!0,le=wt,U){let Ct=Me([Q,le]),er=dr(a,Ct);Pe(er)}return Fe}o(mn,"cancel2Algorithm");function Gr(){}return o(Gr,"startAlgorithm"),oe=fi(Gr,pr,mo),_e=fi(Gr,pr,mn),b(d._closedPromise,wt=>(lr(oe._readableStreamController,wt),lr(_e._readableStreamController,wt),(!U||!F)&&Pe(void 0),null)),[oe,_e]}o(nT,"ReadableStreamDefaultTee");function oT(a){let s=j(a),d=!1,v=!1,A=!1,U=!1,F=!1,Q,le,oe,_e,Pe,Fe=p(ae=>{Pe=ae});function pr(ae){b(ae._closedPromise,we=>(ae!==s||(Xt(oe._readableStreamController,we),Xt(_e._readableStreamController,we),(!U||!F)&&Pe(void 0)),null))}o(pr,"forwardReaderError");function mo(){Un(s)&&(ze(s),s=j(a),pr(s)),te(s,{_chunkSteps:o(we=>{w(()=>{v=!1,A=!1;let Be=we,Mt=we;if(!U&&!F)try{Mt=Qp(we)}catch(ho){Xt(oe._readableStreamController,ho),Xt(_e._readableStreamController,ho),Pe(dr(a,ho));return}U||ba(oe._readableStreamController,Be),F||ba(_e._readableStreamController,Mt),d=!1,v?Gr():A&&wt()})},"_chunkSteps"),_closeSteps:o(()=>{d=!1,U||si(oe._readableStreamController),F||si(_e._readableStreamController),oe._readableStreamController._pendingPullIntos.length>0&&va(oe._readableStreamController,0),_e._readableStreamController._pendingPullIntos.length>0&&va(_e._readableStreamController,0),(!U||!F)&&Pe(void 0)},"_closeSteps"),_errorSteps:o(()=>{d=!1},"_errorSteps")})}o(mo,"pullWithDefaultReader");function mn(ae,we){Y(s)&&(ze(s),s=df(a),pr(s));let Be=we?_e:oe,Mt=we?oe:_e;mf(s,ae,1,{_chunkSteps:o(go=>{w(()=>{v=!1,A=!1;let yo=we?F:U;if(we?U:F)yo||Ea(Be._readableStreamController,go);else{let Kf;try{Kf=Qp(go)}catch(_c){Xt(Be._readableStreamController,_c),Xt(Mt._readableStreamController,_c),Pe(dr(a,_c));return}yo||Ea(Be._readableStreamController,go),ba(Mt._readableStreamController,Kf)}d=!1,v?Gr():A&&wt()})},"_chunkSteps"),_closeSteps:o(go=>{d=!1;let yo=we?F:U,Ba=we?U:F;yo||si(Be._readableStreamController),Ba||si(Mt._readableStreamController),go!==void 0&&(yo||Ea(Be._readableStreamController,go),!Ba&&Mt._readableStreamController._pendingPullIntos.length>0&&va(Mt._readableStreamController,0)),(!yo||!Ba)&&Pe(void 0)},"_closeSteps"),_errorSteps:o(()=>{d=!1},"_errorSteps")})}o(mn,"pullWithBYOBReader");function Gr(){if(d)return v=!0,f(void 0);d=!0;let ae=Xu(oe._readableStreamController);return ae===null?mo():mn(ae._view,!1),f(void 0)}o(Gr,"pull1Algorithm");function wt(){if(d)return A=!0,f(void 0);d=!0;let ae=Xu(_e._readableStreamController);return ae===null?mo():mn(ae._view,!0),f(void 0)}o(wt,"pull2Algorithm");function Ct(ae){if(U=!0,Q=ae,F){let we=Me([Q,le]),Be=dr(a,we);Pe(Be)}return Fe}o(Ct,"cancel1Algorithm");function er(ae){if(F=!0,le=ae,U){let we=Me([Q,le]),Be=dr(a,we);Pe(Be)}return Fe}o(er,"cancel2Algorithm");function Wr(){}return o(Wr,"startAlgorithm"),oe=Df(Wr,Gr,Ct),_e=Df(Wr,wt,er),pr(s),[oe,_e]}o(oT,"ReadableByteStreamTee");function iT(a){return r(a)&&typeof a.getReader<"u"}o(iT,"isReadableStreamLike");function aT(a){return iT(a)?uT(a.getReader()):sT(a)}o(aT,"ReadableStreamFrom");function sT(a){let s,d=Kp(a,"async"),v=e;function A(){let F;try{F=YP(d)}catch(le){return m(le)}let Q=f(F);return T(Q,le=>{if(!r(le))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(XP(le))Ln(s._readableStreamController);else{let _e=eS(le);lo(s._readableStreamController,_e)}})}o(A,"pullAlgorithm");function U(F){let Q=d.iterator,le;try{le=ga(Q,"return")}catch(Pe){return m(Pe)}if(le===void 0)return f(void 0);let oe;try{oe=k(le,Q,[F])}catch(Pe){return m(Pe)}let _e=f(oe);return T(_e,Pe=>{if(!r(Pe))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")})}return o(U,"cancelAlgorithm"),s=fi(v,A,U,0),s}o(sT,"ReadableStreamFromIterable");function uT(a){let s,d=e;function v(){let U;try{U=a.read()}catch(F){return m(F)}return T(U,F=>{if(!r(F))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(F.done)Ln(s._readableStreamController);else{let Q=F.value;lo(s._readableStreamController,Q)}})}o(v,"pullAlgorithm");function A(U){try{return f(a.cancel(U))}catch(F){return m(F)}}return o(A,"cancelAlgorithm"),s=fi(d,v,A,0),s}o(uT,"ReadableStreamFromDefaultReader");function cT(a,s){Rt(a,s);let d=a,v=d?.autoAllocateChunkSize,A=d?.cancel,U=d?.pull,F=d?.start,Q=d?.type;return{autoAllocateChunkSize:v===void 0?void 0:R(v,`${s} has member 'autoAllocateChunkSize' that`),cancel:A===void 0?void 0:lT(A,d,`${s} has member 'cancel' that`),pull:U===void 0?void 0:dT(U,d,`${s} has member 'pull' that`),start:F===void 0?void 0:pT(F,d,`${s} has member 'start' that`),type:Q===void 0?void 0:fT(Q,`${s} has member 'type' that`)}}o(cT,"convertUnderlyingDefaultOrByteSource");function lT(a,s,d){return St(a,d),v=>q(a,s,[v])}o(lT,"convertUnderlyingSourceCancelCallback");function dT(a,s,d){return St(a,d),v=>q(a,s,[v])}o(dT,"convertUnderlyingSourcePullCallback");function pT(a,s,d){return St(a,d),v=>k(a,s,[v])}o(pT,"convertUnderlyingSourceStartCallback");function fT(a,s){if(a=`${a}`,a!=="bytes")throw new TypeError(`${s} '${a}' is not a valid enumeration value for ReadableStreamType`);return a}o(fT,"convertReadableStreamType");function mT(a,s){return Rt(a,s),{preventCancel:!!a?.preventCancel}}o(mT,"convertIteratorOptions");function Nf(a,s){Rt(a,s);let d=a?.preventAbort,v=a?.preventCancel,A=a?.preventClose,U=a?.signal;return U!==void 0&&hT(U,`${s} has member 'signal' that`),{preventAbort:!!d,preventCancel:!!v,preventClose:!!A,signal:U}}o(Nf,"convertPipeOptions");function hT(a,s){if(!SS(a))throw new TypeError(`${s} is not an AbortSignal.`)}o(hT,"assertAbortSignal");function gT(a,s){Rt(a,s);let d=a?.readable;_(d,"readable","ReadableWritablePair"),$(d,`${s} has member 'readable' that`);let v=a?.writable;return _(v,"writable","ReadableWritablePair"),gf(v,`${s} has member 'writable' that`),{readable:d,writable:v}}o(gT,"convertReadableWritablePair");class vt{static{o(this,"ReadableStream")}constructor(s={},d={}){s===void 0?s=null:Tt(s,"First parameter");let v=Ta(d,"Second parameter"),A=cT(s,"First parameter");if(mc(this),A.type==="bytes"){if(v.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let U=ci(v,0);lS(this,A,U)}else{let U=Sa(v),F=ci(v,1);tT(this,A,F,U)}}get locked(){if(!dn(this))throw Fn("locked");return pn(this)}cancel(s=void 0){return dn(this)?pn(this)?m(new TypeError("Cannot cancel a stream that already has a reader")):dr(this,s):m(Fn("cancel"))}getReader(s=void 0){if(!dn(this))throw Fn("getReader");return pS(s,"First parameter").mode===void 0?j(this):df(this)}pipeThrough(s,d={}){if(!dn(this))throw Fn("pipeThrough");at(s,1,"pipeThrough");let v=gT(s,"First parameter"),A=Nf(d,"Second parameter");if(pn(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(uo(v.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let U=kf(this,v.writable,A.preventClose,A.preventAbort,A.preventCancel,A.signal);return E(U),v.readable}pipeTo(s,d={}){if(!dn(this))return m(Fn("pipeTo"));if(s===void 0)return m("Parameter 1 is required in 'pipeTo'.");if(!so(s))return m(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let v;try{v=Nf(d,"Second parameter")}catch(A){return m(A)}return pn(this)?m(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):uo(s)?m(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):kf(this,s,v.preventClose,v.preventAbort,v.preventCancel,v.signal)}tee(){if(!dn(this))throw Fn("tee");let s=rT(this);return Me(s)}values(s=void 0){if(!dn(this))throw Fn("values");let d=mT(s,"First parameter");return no(this,d.preventCancel)}[Gu](s){return this.values(s)}static from(s){return aT(s)}}Object.defineProperties(vt,{from:{enumerable:!0}}),Object.defineProperties(vt.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),i(vt.from,"from"),i(vt.prototype.cancel,"cancel"),i(vt.prototype.getReader,"getReader"),i(vt.prototype.pipeThrough,"pipeThrough"),i(vt.prototype.pipeTo,"pipeTo"),i(vt.prototype.tee,"tee"),i(vt.prototype.values,"values"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(vt.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(vt.prototype,Gu,{value:vt.prototype.values,writable:!0,configurable:!0});function fi(a,s,d,v=1,A=()=>1){let U=Object.create(vt.prototype);mc(U);let F=Object.create(Hr.prototype);return zf(U,F,a,s,d,v,A),U}o(fi,"CreateReadableStream");function Df(a,s,d){let v=Object.create(vt.prototype);mc(v);let A=Object.create(qr.prototype);return lf(v,A,a,s,d,0,void 0),v}o(Df,"CreateReadableByteStream");function mc(a){a._state="readable",a._reader=void 0,a._storedError=void 0,a._disturbed=!1}o(mc,"InitializeReadableStream");function dn(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_readableStreamController")?!1:a instanceof vt}o(dn,"IsReadableStream");function pn(a){return a._reader!==void 0}o(pn,"IsReadableStreamLocked");function dr(a,s){if(a._disturbed=!0,a._state==="closed")return f(void 0);if(a._state==="errored")return m(a._storedError);mi(a);let d=a._reader;if(d!==void 0&&Un(d)){let A=d._readIntoRequests;d._readIntoRequests=new H,A.forEach(U=>{U._closeSteps(void 0)})}let v=a._readableStreamController[re](s);return T(v,e)}o(dr,"ReadableStreamCancel");function mi(a){a._state="closed";let s=a._reader;if(s!==void 0&&(ro(s),Y(s))){let d=s._readRequests;s._readRequests=new H,d.forEach(v=>{v._closeSteps()})}}o(mi,"ReadableStreamClose");function Uf(a,s){a._state="errored",a._storedError=s;let d=a._reader;d!==void 0&&(Ut(d,s),Y(d)?Ge(d,s):hf(d,s))}o(Uf,"ReadableStreamError");function Fn(a){return new TypeError(`ReadableStream.prototype.${a} can only be used on a ReadableStream`)}o(Fn,"streamBrandCheckException$1");function jf(a,s){Rt(a,s);let d=a?.highWaterMark;return _(d,"highWaterMark","QueuingStrategyInit"),{highWaterMark:S(d)}}o(jf,"convertQueuingStrategyInit");let Mf=o(a=>a.byteLength,"byteLengthSizeFunction");i(Mf,"size");class Na{static{o(this,"ByteLengthQueuingStrategy")}constructor(s){at(s,1,"ByteLengthQueuingStrategy"),s=jf(s,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=s.highWaterMark}get highWaterMark(){if(!Ff(this))throw Lf("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Ff(this))throw Lf("size");return Mf}}Object.defineProperties(Na.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Na.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function Lf(a){return new TypeError(`ByteLengthQueuingStrategy.prototype.${a} can only be used on a ByteLengthQueuingStrategy`)}o(Lf,"byteLengthBrandCheckException");function Ff(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_byteLengthQueuingStrategyHighWaterMark")?!1:a instanceof Na}o(Ff,"IsByteLengthQueuingStrategy");let Bf=o(()=>1,"countSizeFunction");i(Bf,"size");class Da{static{o(this,"CountQueuingStrategy")}constructor(s){at(s,1,"CountQueuingStrategy"),s=jf(s,"First parameter"),this._countQueuingStrategyHighWaterMark=s.highWaterMark}get highWaterMark(){if(!Vf(this))throw qf("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Vf(this))throw qf("size");return Bf}}Object.defineProperties(Da.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Da.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function qf(a){return new TypeError(`CountQueuingStrategy.prototype.${a} can only be used on a CountQueuingStrategy`)}o(qf,"countBrandCheckException");function Vf(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_countQueuingStrategyHighWaterMark")?!1:a instanceof Da}o(Vf,"IsCountQueuingStrategy");function yT(a,s){Rt(a,s);let d=a?.cancel,v=a?.flush,A=a?.readableType,U=a?.start,F=a?.transform,Q=a?.writableType;return{cancel:d===void 0?void 0:ET(d,a,`${s} has member 'cancel' that`),flush:v===void 0?void 0:_T(v,a,`${s} has member 'flush' that`),readableType:A,start:U===void 0?void 0:bT(U,a,`${s} has member 'start' that`),transform:F===void 0?void 0:vT(F,a,`${s} has member 'transform' that`),writableType:Q}}o(yT,"convertTransformer");function _T(a,s,d){return St(a,d),v=>q(a,s,[v])}o(_T,"convertTransformerFlushCallback");function bT(a,s,d){return St(a,d),v=>k(a,s,[v])}o(bT,"convertTransformerStartCallback");function vT(a,s,d){return St(a,d),(v,A)=>q(a,s,[v,A])}o(vT,"convertTransformerTransformCallback");function ET(a,s,d){return St(a,d),v=>q(a,s,[v])}o(ET,"convertTransformerCancelCallback");class Ua{static{o(this,"TransformStream")}constructor(s={},d={},v={}){s===void 0&&(s=null);let A=Ta(d,"Second parameter"),U=Ta(v,"Third parameter"),F=yT(s,"First parameter");if(F.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(F.writableType!==void 0)throw new RangeError("Invalid writableType specified");let Q=ci(U,0),le=Sa(U),oe=ci(A,1),_e=Sa(A),Pe,Fe=p(pr=>{Pe=pr});PT(this,Fe,oe,_e,Q,le),TT(this,F),F.start!==void 0?Pe(F.start(this._transformStreamController)):Pe(void 0)}get readable(){if(!Hf(this))throw Jf("readable");return this._readable}get writable(){if(!Hf(this))throw Jf("writable");return this._writable}}Object.defineProperties(Ua.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Ua.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});function PT(a,s,d,v,A,U){function F(){return s}o(F,"startAlgorithm");function Q(Fe){return AT(a,Fe)}o(Q,"writeAlgorithm");function le(Fe){return IT(a,Fe)}o(le,"abortAlgorithm");function oe(){return RT(a)}o(oe,"closeAlgorithm"),a._writable=xS(F,Q,oe,le,d,v);function _e(){return CT(a)}o(_e,"pullAlgorithm");function Pe(Fe){return OT(a,Fe)}o(Pe,"cancelAlgorithm"),a._readable=fi(F,_e,Pe,A,U),a._backpressure=void 0,a._backpressureChangePromise=void 0,a._backpressureChangePromise_resolve=void 0,ja(a,!0),a._transformStreamController=void 0}o(PT,"InitializeTransformStream");function Hf(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_transformStreamController")?!1:a instanceof Ua}o(Hf,"IsTransformStream");function Gf(a,s){lr(a._readable._readableStreamController,s),hc(a,s)}o(Gf,"TransformStreamError");function hc(a,s){La(a._transformStreamController),li(a._writable._writableStreamController,s),gc(a)}o(hc,"TransformStreamErrorWritableAndUnblockWrite");function gc(a){a._backpressure&&ja(a,!1)}o(gc,"TransformStreamUnblockWrite");function ja(a,s){a._backpressureChangePromise!==void 0&&a._backpressureChangePromise_resolve(),a._backpressureChangePromise=p(d=>{a._backpressureChangePromise_resolve=d}),a._backpressure=s}o(ja,"TransformStreamSetBackpressure");class fn{static{o(this,"TransformStreamDefaultController")}constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Ma(this))throw Fa("desiredSize");let s=this._controlledTransformStream._readable._readableStreamController;return fc(s)}enqueue(s=void 0){if(!Ma(this))throw Fa("enqueue");Wf(this,s)}error(s=void 0){if(!Ma(this))throw Fa("error");wT(this,s)}terminate(){if(!Ma(this))throw Fa("terminate");xT(this)}}Object.defineProperties(fn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),i(fn.prototype.enqueue,"enqueue"),i(fn.prototype.error,"error"),i(fn.prototype.terminate,"terminate"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(fn.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function Ma(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_controlledTransformStream")?!1:a instanceof fn}o(Ma,"IsTransformStreamDefaultController");function ST(a,s,d,v,A){s._controlledTransformStream=a,a._transformStreamController=s,s._transformAlgorithm=d,s._flushAlgorithm=v,s._cancelAlgorithm=A,s._finishPromise=void 0,s._finishPromise_resolve=void 0,s._finishPromise_reject=void 0}o(ST,"SetUpTransformStreamDefaultController");function TT(a,s){let d=Object.create(fn.prototype),v,A,U;s.transform!==void 0?v=o(F=>s.transform(F,d),"transformAlgorithm"):v=o(F=>{try{return Wf(d,F),f(void 0)}catch(Q){return m(Q)}},"transformAlgorithm"),s.flush!==void 0?A=o(()=>s.flush(d),"flushAlgorithm"):A=o(()=>f(void 0),"flushAlgorithm"),s.cancel!==void 0?U=o(F=>s.cancel(F),"cancelAlgorithm"):U=o(()=>f(void 0),"cancelAlgorithm"),ST(a,d,v,A,U)}o(TT,"SetUpTransformStreamDefaultControllerFromTransformer");function La(a){a._transformAlgorithm=void 0,a._flushAlgorithm=void 0,a._cancelAlgorithm=void 0}o(La,"TransformStreamDefaultControllerClearAlgorithms");function Wf(a,s){let d=a._controlledTransformStream,v=d._readable._readableStreamController;if(!po(v))throw new TypeError("Readable side is not in a state that permits enqueue");try{lo(v,s)}catch(U){throw hc(d,U),d._readable._storedError}eT(v)!==d._backpressure&&ja(d,!0)}o(Wf,"TransformStreamDefaultControllerEnqueue");function wT(a,s){Gf(a._controlledTransformStream,s)}o(wT,"TransformStreamDefaultControllerError");function Zf(a,s){let d=a._transformAlgorithm(s);return T(d,void 0,v=>{throw Gf(a._controlledTransformStream,v),v})}o(Zf,"TransformStreamDefaultControllerPerformTransform");function xT(a){let s=a._controlledTransformStream,d=s._readable._readableStreamController;Ln(d);let v=new TypeError("TransformStream terminated");hc(s,v)}o(xT,"TransformStreamDefaultControllerTerminate");function AT(a,s){let d=a._transformStreamController;if(a._backpressure){let v=a._backpressureChangePromise;return T(v,()=>{let A=a._writable;if(A._state==="erroring")throw A._storedError;return Zf(d,s)})}return Zf(d,s)}o(AT,"TransformStreamDefaultSinkWriteAlgorithm");function IT(a,s){let d=a._transformStreamController;if(d._finishPromise!==void 0)return d._finishPromise;let v=a._readable;d._finishPromise=p((U,F)=>{d._finishPromise_resolve=U,d._finishPromise_reject=F});let A=d._cancelAlgorithm(s);return La(d),P(A,()=>(v._state==="errored"?fo(d,v._storedError):(lr(v._readableStreamController,s),yc(d)),null),U=>(lr(v._readableStreamController,U),fo(d,U),null)),d._finishPromise}o(IT,"TransformStreamDefaultSinkAbortAlgorithm");function RT(a){let s=a._transformStreamController;if(s._finishPromise!==void 0)return s._finishPromise;let d=a._readable;s._finishPromise=p((A,U)=>{s._finishPromise_resolve=A,s._finishPromise_reject=U});let v=s._flushAlgorithm();return La(s),P(v,()=>(d._state==="errored"?fo(s,d._storedError):(Ln(d._readableStreamController),yc(s)),null),A=>(lr(d._readableStreamController,A),fo(s,A),null)),s._finishPromise}o(RT,"TransformStreamDefaultSinkCloseAlgorithm");function CT(a){return ja(a,!1),a._backpressureChangePromise}o(CT,"TransformStreamDefaultSourcePullAlgorithm");function OT(a,s){let d=a._transformStreamController;if(d._finishPromise!==void 0)return d._finishPromise;let v=a._writable;d._finishPromise=p((U,F)=>{d._finishPromise_resolve=U,d._finishPromise_reject=F});let A=d._cancelAlgorithm(s);return La(d),P(A,()=>(v._state==="errored"?fo(d,v._storedError):(li(v._writableStreamController,s),gc(a),yc(d)),null),U=>(li(v._writableStreamController,U),gc(a),fo(d,U),null)),d._finishPromise}o(OT,"TransformStreamDefaultSourceCancelAlgorithm");function Fa(a){return new TypeError(`TransformStreamDefaultController.prototype.${a} can only be used on a TransformStreamDefaultController`)}o(Fa,"defaultControllerBrandCheckException");function yc(a){a._finishPromise_resolve!==void 0&&(a._finishPromise_resolve(),a._finishPromise_resolve=void 0,a._finishPromise_reject=void 0)}o(yc,"defaultControllerFinishPromiseResolve");function fo(a,s){a._finishPromise_reject!==void 0&&(E(a._finishPromise),a._finishPromise_reject(s),a._finishPromise_resolve=void 0,a._finishPromise_reject=void 0)}o(fo,"defaultControllerFinishPromiseReject");function Jf(a){return new TypeError(`TransformStream.prototype.${a} can only be used on a TransformStream`)}o(Jf,"streamBrandCheckException"),t.ByteLengthQueuingStrategy=Na,t.CountQueuingStrategy=Da,t.ReadableByteStreamController=qr,t.ReadableStream=vt,t.ReadableStreamBYOBReader=cn,t.ReadableStreamBYOBRequest=zn,t.ReadableStreamDefaultController=Hr,t.ReadableStreamDefaultReader=B,t.TransformStream=Ua,t.TransformStreamDefaultController=fn,t.WritableStream=ln,t.WritableStreamDefaultController=co,t.WritableStreamDefaultWriter=Vr}))});var Eb=L(()=>{if(!globalThis.ReadableStream)try{let t=require("node:process"),{emitWarning:e}=t;try{t.emitWarning=()=>{},Object.assign(globalThis,require("node:stream/web")),t.emitWarning=e}catch(r){throw t.emitWarning=e,r}}catch{Object.assign(globalThis,vb())}try{let{Blob:t}=require("buffer");t&&!t.prototype.stream&&(t.prototype.stream=o(function(r){let n=0,i=this;return new ReadableStream({type:"bytes",async pull(u){let l=await i.slice(n,Math.min(i.size,n+65536)).arrayBuffer();n+=l.byteLength,u.enqueue(new Uint8Array(l)),n===i.size&&u.close()}})},"name"))}catch{}});async function*Ml(t,e=!0){for(let r of t)if("stream"in r)yield*r.stream();else if(ArrayBuffer.isView(r))if(e){let n=r.byteOffset,i=r.byteOffset+r.byteLength;for(;n!==i;){let u=Math.min(i-n,Pb),c=r.buffer.slice(n,n+u);n+=c.byteLength,yield new Uint8Array(c)}}else yield r;else{let n=0,i=r;for(;n!==i.size;){let c=await i.slice(n,Math.min(i.size,n+Pb)).arrayBuffer();n+=c.byteLength,yield new Uint8Array(c)}}}var lZ,Pb,Sb,pC,gr,Fi=ct(()=>{lZ=yt(Eb(),1);Pb=65536;o(Ml,"toIterator");Sb=class Ll{static{o(this,"Blob")}#e=[];#t="";#r=0;#n="transparent";constructor(e=[],r={}){if(typeof e!="object"||e===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof e[Symbol.iterator]!="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof r!="object"&&typeof r!="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");r===null&&(r={});let n=new TextEncoder;for(let u of e){let c;ArrayBuffer.isView(u)?c=new Uint8Array(u.buffer.slice(u.byteOffset,u.byteOffset+u.byteLength)):u instanceof ArrayBuffer?c=new Uint8Array(u.slice(0)):u instanceof Ll?c=u:c=n.encode(`${u}`),this.#r+=ArrayBuffer.isView(c)?c.byteLength:c.size,this.#e.push(c)}this.#n=`${r.endings===void 0?"transparent":r.endings}`;let i=r.type===void 0?"":String(r.type);this.#t=/^[\x20-\x7E]*$/.test(i)?i:""}get size(){return this.#r}get type(){return this.#t}async text(){let e=new TextDecoder,r="";for await(let n of Ml(this.#e,!1))r+=e.decode(n,{stream:!0});return r+=e.decode(),r}async arrayBuffer(){let e=new Uint8Array(this.size),r=0;for await(let n of Ml(this.#e,!1))e.set(n,r),r+=n.length;return e.buffer}stream(){let e=Ml(this.#e,!0);return new globalThis.ReadableStream({type:"bytes",async pull(r){let n=await e.next();n.done?r.close():r.enqueue(n.value)},async cancel(){await e.return()}})}slice(e=0,r=this.size,n=""){let{size:i}=this,u=e<0?Math.max(i+e,0):Math.min(e,i),c=r<0?Math.max(i+r,0):Math.min(r,i),l=Math.max(c-u,0),p=this.#e,f=[],m=0;for(let P of p){if(m>=l)break;let h=ArrayBuffer.isView(P)?P.byteLength:P.size;if(u&&h<=u)u-=h,c-=h;else{let b;ArrayBuffer.isView(P)?(b=P.subarray(u,Math.min(h,c)),m+=b.byteLength):(b=P.slice(u,Math.min(h,c)),m+=b.size),c-=h,f.push(b),u=0}}let y=new Ll([],{type:String(n).toLowerCase()});return y.#r=l,y.#e=f,y}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](e){return e&&typeof e=="object"&&typeof e.constructor=="function"&&(typeof e.stream=="function"||typeof e.arrayBuffer=="function")&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}};Object.defineProperties(Sb.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});pC=Sb,gr=pC});var fC,mC,An,Fl=ct(()=>{Fi();fC=class extends gr{static{o(this,"File")}#e=0;#t="";constructor(e,r,n={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(e,n),n===null&&(n={});let i=n.lastModified===void 0?Date.now():Number(n.lastModified);Number.isNaN(i)||(this.#e=i),this.#t=String(r)}get name(){return this.#t}get lastModified(){return this.#e}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](e){return!!e&&e instanceof gr&&/^(File)$/.test(e[Symbol.toStringTag])}},mC=fC,An=mC});function xb(t,e=gr){var r=`${Tb()}${Tb()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),n=[],i=`--${r}\r
15
+ Content-Disposition: form-data; name="`;return t.forEach((u,c)=>typeof u=="string"?n.push(i+Bl(c)+`"\r
16
16
  \r
17
17
  ${u.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
18
18
  `)}\r
19
- `):n.push(i+Ml(c)+`"; filename="${Ml(u.name,1)}"\r
19
+ `):n.push(i+Bl(c)+`"; filename="${Bl(u.name,1)}"\r
20
20
  Content-Type: ${u.type||"application/octet-stream"}\r
21
21
  \r
22
22
  `,u,`\r
23
- `)),n.push(`--${r}--`),new e(n,{type:"multipart/form-data; boundary="+r})}var Fi,iC,aC,gb,sC,yb,Ml,Gn,An,Ns=ct(()=>{Li();jl();({toStringTag:Fi,iterator:iC,hasInstance:aC}=Symbol),gb=Math.random,sC="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),yb=o((t,e,r)=>(t+="",/^(Blob|File)$/.test(e&&e[Fi])?[(r=r!==void 0?r+"":e[Fi]=="File"?e.name:"blob",t),e.name!==r||e[Fi]=="blob"?new xn([e],r,e):e]:[t,e+""]),"f"),Ml=o((t,e)=>(e?t:t.replace(/\r?\n|\r/g,`\r
24
- `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),"e"),Gn=o((t,e,r)=>{if(e.length<r)throw new TypeError(`Failed to execute '${t}' on 'FormData': ${r} arguments required, but only ${e.length} present.`)},"x"),An=class{static{o(this,"FormData")}#e=[];constructor(...e){if(e.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[Fi](){return"FormData"}[iC](){return this.entries()}static[aC](e){return e&&typeof e=="object"&&e[Fi]==="FormData"&&!sC.some(r=>typeof e[r]!="function")}append(...e){Gn("append",arguments,2),this.#e.push(yb(...e))}delete(e){Gn("delete",arguments,1),e+="",this.#e=this.#e.filter(([r])=>r!==e)}get(e){Gn("get",arguments,1),e+="";for(var r=this.#e,n=r.length,i=0;i<n;i++)if(r[i][0]===e)return r[i][1];return null}getAll(e,r){return Gn("getAll",arguments,1),r=[],e+="",this.#e.forEach(n=>n[0]===e&&r.push(n[1])),r}has(e){return Gn("has",arguments,1),e+="",this.#e.some(r=>r[0]===e)}forEach(e,r){Gn("forEach",arguments,1);for(var[n,i]of this)e.call(r,i,n,this)}set(...e){Gn("set",arguments,2);var r=[],n=!0;e=yb(...e),this.#e.forEach(i=>{i[0]===e[0]?n&&(n=!r.push(e)):r.push(i)}),n&&r.push(e),this.#e=r}*entries(){yield*this.#e}*keys(){for(var[e]of this)yield e}*values(){for(var[,e]of this)yield e}};o(_b,"formDataToBlob")});var en,zs=ct(()=>{en=class extends Error{static{o(this,"FetchBaseError")}constructor(e,r){super(e),Error.captureStackTrace(this,this.constructor),this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}});var At,Ll=ct(()=>{zs();At=class extends en{static{o(this,"FetchError")}constructor(e,r,n){super(e,r),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}}});var Ds,Fl,Bi,bb,vb,Eb,Us=ct(()=>{Ds=Symbol.toStringTag,Fl=o(t=>typeof t=="object"&&typeof t.append=="function"&&typeof t.delete=="function"&&typeof t.get=="function"&&typeof t.getAll=="function"&&typeof t.has=="function"&&typeof t.set=="function"&&typeof t.sort=="function"&&t[Ds]==="URLSearchParams","isURLSearchParameters"),Bi=o(t=>t&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.constructor=="function"&&/^(Blob|File)$/.test(t[Ds]),"isBlob"),bb=o(t=>typeof t=="object"&&(t[Ds]==="AbortSignal"||t[Ds]==="EventTarget"),"isAbortSignal"),vb=o((t,e)=>{let r=new URL(e).hostname,n=new URL(t).hostname;return r===n||r.endsWith(`.${n}`)},"isDomainOrSubdomain"),Eb=o((t,e)=>{let r=new URL(e).protocol,n=new URL(t).protocol;return r===n},"isSameProtocol")});var Pb=M((nZ,Sb)=>{if(!globalThis.DOMException)try{let{MessageChannel:t}=require("worker_threads"),e=new t().port1,r=new ArrayBuffer;e.postMessage(r,[r,r])}catch(t){t.constructor.name==="DOMException"&&(globalThis.DOMException=t.constructor)}Sb.exports=globalThis.DOMException});var Wn,Tb,wb,Bl,xb,Ab,Ib,Rb,Cb,Ob,js,ql=ct(()=>{Wn=require("node:fs"),Tb=require("node:path"),wb=gt(Pb(),1);jl();Li();({stat:Bl}=Wn.promises),xb=o((t,e)=>Cb((0,Wn.statSync)(t),t,e),"blobFromSync"),Ab=o((t,e)=>Bl(t).then(r=>Cb(r,t,e)),"blobFrom"),Ib=o((t,e)=>Bl(t).then(r=>Ob(r,t,e)),"fileFrom"),Rb=o((t,e)=>Ob((0,Wn.statSync)(t),t,e),"fileFromSync"),Cb=o((t,e,r="")=>new gr([new js({path:e,size:t.size,lastModified:t.mtimeMs,start:0})],{type:r}),"fromBlob"),Ob=o((t,e,r="")=>new xn([new js({path:e,size:t.size,lastModified:t.mtimeMs,start:0})],(0,Tb.basename)(e),{type:r,lastModified:t.mtimeMs}),"fromFile"),js=class t{static{o(this,"BlobDataItem")}#e;#t;constructor(e){this.#e=e.path,this.#t=e.start,this.size=e.size,this.lastModified=e.lastModified}slice(e,r){return new t({path:this.#e,lastModified:this.lastModified,size:r-e,start:this.#t+e})}async*stream(){let{mtimeMs:e}=await Bl(this.#e);if(e>this.lastModified)throw new wb.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*(0,Wn.createReadStream)(this.#e,{start:this.#t,end:this.#t+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}});var $b={};Ba($b,{toFormData:()=>mC});function fC(t){let e=t.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!e)return;let r=e[2]||e[3]||"",n=r.slice(r.lastIndexOf("\\")+1);return n=n.replace(/%22/g,'"'),n=n.replace(/&#(\d{4});/g,(i,u)=>String.fromCharCode(u)),n}async function mC(t,e){if(!/multipart/i.test(e))throw new TypeError("Failed to fetch");let r=e.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!r)throw new TypeError("no or bad content-type header, no multipart boundary");let n=new Vl(r[1]||r[2]),i,u,c,l,p,f,m=[],g=new An,S=o(w=>{c+=E.decode(w,{stream:!0})},"onPartData"),h=o(w=>{m.push(w)},"appendToFile"),_=o(()=>{let w=new xn(m,f,{type:p});g.append(l,w)},"appendFileToFormData"),T=o(()=>{g.append(l,c)},"appendEntryToFormData"),E=new TextDecoder("utf-8");E.decode(),n.onPartBegin=function(){n.onPartData=S,n.onPartEnd=T,i="",u="",c="",l="",p="",f=null,m.length=0},n.onHeaderField=function(w){i+=E.decode(w,{stream:!0})},n.onHeaderValue=function(w){u+=E.decode(w,{stream:!0})},n.onHeaderEnd=function(){if(u+=E.decode(),i=i.toLowerCase(),i==="content-disposition"){let w=u.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);w&&(l=w[2]||w[3]||""),f=fC(u),f&&(n.onPartData=h,n.onPartEnd=_)}else i==="content-type"&&(p=u);u="",i=""};for await(let w of t)n.write(w);return n.end(),g}var Or,Be,kb,In,Ms,Ls,uC,qi,cC,lC,dC,pC,Zn,Vl,Nb=ct(()=>{ql();Ns();Or=0,Be={START_BOUNDARY:Or++,HEADER_FIELD_START:Or++,HEADER_FIELD:Or++,HEADER_VALUE_START:Or++,HEADER_VALUE:Or++,HEADER_VALUE_ALMOST_DONE:Or++,HEADERS_ALMOST_DONE:Or++,PART_DATA_START:Or++,PART_DATA:Or++,END:Or++},kb=1,In={PART_BOUNDARY:kb,LAST_BOUNDARY:kb*=2},Ms=10,Ls=13,uC=32,qi=45,cC=58,lC=97,dC=122,pC=o(t=>t|32,"lower"),Zn=o(()=>{},"noop"),Vl=class{static{o(this,"MultipartParser")}constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=Zn,this.onHeaderField=Zn,this.onHeadersEnd=Zn,this.onHeaderValue=Zn,this.onPartBegin=Zn,this.onPartData=Zn,this.onPartEnd=Zn,this.boundaryChars={},e=`\r
25
- --`+e;let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n),this.boundaryChars[r[n]]=!0;this.boundary=r,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=Be.START_BOUNDARY}write(e){let r=0,n=e.length,i=this.index,{lookbehind:u,boundary:c,boundaryChars:l,index:p,state:f,flags:m}=this,g=this.boundary.length,S=g-1,h=e.length,_,T,E=o(G=>{this[G+"Mark"]=r},"mark"),w=o(G=>{delete this[G+"Mark"]},"clear"),k=o((G,V,H,J)=>{(V===void 0||V!==H)&&this[G](J&&J.subarray(V,H))},"callback"),q=o((G,V)=>{let H=G+"Mark";H in this&&(V?(k(G,this[H],r,e),delete this[H]):(k(G,this[H],e.length,e),this[H]=0))},"dataCallback");for(r=0;r<n;r++)switch(_=e[r],f){case Be.START_BOUNDARY:if(p===c.length-2){if(_===qi)m|=In.LAST_BOUNDARY;else if(_!==Ls)return;p++;break}else if(p-1===c.length-2){if(m&In.LAST_BOUNDARY&&_===qi)f=Be.END,m=0;else if(!(m&In.LAST_BOUNDARY)&&_===Ms)p=0,k("onPartBegin"),f=Be.HEADER_FIELD_START;else return;break}_!==c[p+2]&&(p=-2),_===c[p+2]&&p++;break;case Be.HEADER_FIELD_START:f=Be.HEADER_FIELD,E("onHeaderField"),p=0;case Be.HEADER_FIELD:if(_===Ls){w("onHeaderField"),f=Be.HEADERS_ALMOST_DONE;break}if(p++,_===qi)break;if(_===cC){if(p===1)return;q("onHeaderField",!0),f=Be.HEADER_VALUE_START;break}if(T=pC(_),T<lC||T>dC)return;break;case Be.HEADER_VALUE_START:if(_===uC)break;E("onHeaderValue"),f=Be.HEADER_VALUE;case Be.HEADER_VALUE:_===Ls&&(q("onHeaderValue",!0),k("onHeaderEnd"),f=Be.HEADER_VALUE_ALMOST_DONE);break;case Be.HEADER_VALUE_ALMOST_DONE:if(_!==Ms)return;f=Be.HEADER_FIELD_START;break;case Be.HEADERS_ALMOST_DONE:if(_!==Ms)return;k("onHeadersEnd"),f=Be.PART_DATA_START;break;case Be.PART_DATA_START:f=Be.PART_DATA,E("onPartData");case Be.PART_DATA:if(i=p,p===0){for(r+=S;r<h&&!(e[r]in l);)r+=g;r-=S,_=e[r]}if(p<c.length)c[p]===_?(p===0&&q("onPartData",!0),p++):p=0;else if(p===c.length)p++,_===Ls?m|=In.PART_BOUNDARY:_===qi?m|=In.LAST_BOUNDARY:p=0;else if(p-1===c.length)if(m&In.PART_BOUNDARY){if(p=0,_===Ms){m&=~In.PART_BOUNDARY,k("onPartEnd"),k("onPartBegin"),f=Be.HEADER_FIELD_START;break}}else m&In.LAST_BOUNDARY&&_===qi?(k("onPartEnd"),f=Be.END,m=0):p=0;if(p>0)u[p-1]=_;else if(i>0){let G=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);k("onPartData",0,i,G),i=0,E("onPartData"),r--}break;case Be.END:break;default:throw new Error(`Unexpected state entered: ${f}`)}q("onHeaderField"),q("onHeaderValue"),q("onPartData"),this.index=p,this.state=f,this.flags=m}end(){if(this.state===Be.HEADER_FIELD_START&&this.index===0||this.state===Be.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==Be.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}};o(fC,"_fileName");o(mC,"toFormData")});async function Hl(t){if(t[Nt].disturbed)throw new TypeError(`body used already for: ${t.url}`);if(t[Nt].disturbed=!0,t[Nt].error)throw t[Nt].error;let{body:e}=t;if(e===null)return qt.Buffer.alloc(0);if(!(e instanceof ir.default))return qt.Buffer.alloc(0);let r=[],n=0;try{for await(let i of e){if(t.size>0&&n+i.length>t.size){let u=new At(`content size at ${t.url} over limit: ${t.size}`,"max-size");throw e.destroy(u),u}n+=i.length,r.push(i)}}catch(i){throw i instanceof en?i:new At(`Invalid response body while trying to fetch ${t.url}: ${i.message}`,"system",i)}if(e.readableEnded===!0||e._readableState.ended===!0)try{return r.every(i=>typeof i=="string")?qt.Buffer.from(r.join("")):qt.Buffer.concat(r,n)}catch(i){throw new At(`Could not create Buffer from response body for ${t.url}: ${i.message}`,"system",i)}else throw new At(`Premature close of server response while trying to fetch ${t.url}`)}var ir,tn,qt,hC,Nt,kr,zo,gC,Fs,zb,Db,Bs=ct(()=>{ir=gt(require("node:stream"),1),tn=require("node:util"),qt=require("node:buffer");Li();Ns();Ll();zs();Us();hC=(0,tn.promisify)(ir.default.pipeline),Nt=Symbol("Body internals"),kr=class{static{o(this,"Body")}constructor(e,{size:r=0}={}){let n=null;e===null?e=null:Fl(e)?e=qt.Buffer.from(e.toString()):Bi(e)||qt.Buffer.isBuffer(e)||(tn.types.isAnyArrayBuffer(e)?e=qt.Buffer.from(e):ArrayBuffer.isView(e)?e=qt.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof ir.default||(e instanceof An?(e=_b(e),n=e.type.split("=")[1]):e=qt.Buffer.from(String(e))));let i=e;qt.Buffer.isBuffer(e)?i=ir.default.Readable.from(e):Bi(e)&&(i=ir.default.Readable.from(e.stream())),this[Nt]={body:e,stream:i,boundary:n,disturbed:!1,error:null},this.size=r,e instanceof ir.default&&e.on("error",u=>{let c=u instanceof en?u:new At(`Invalid response body while trying to fetch ${this.url}: ${u.message}`,"system",u);this[Nt].error=c})}get body(){return this[Nt].stream}get bodyUsed(){return this[Nt].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:n}=await Hl(this);return e.slice(r,r+n)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let n=new An,i=new URLSearchParams(await this.text());for(let[u,c]of i)n.append(u,c);return n}let{toFormData:r}=await Promise.resolve().then(()=>(Nb(),$b));return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[Nt].body&&this[Nt].body.type||"",r=await this.arrayBuffer();return new gr([r],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await Hl(this);return new TextDecoder().decode(e)}buffer(){return Hl(this)}};kr.prototype.buffer=(0,tn.deprecate)(kr.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(kr.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,tn.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});o(Hl,"consumeBody");zo=o((t,e)=>{let r,n,{body:i}=t[Nt];if(t.bodyUsed)throw new Error("cannot clone body after it is used");return i instanceof ir.default&&typeof i.getBoundary!="function"&&(r=new ir.PassThrough({highWaterMark:e}),n=new ir.PassThrough({highWaterMark:e}),i.pipe(r),i.pipe(n),t[Nt].stream=r,i=n),i},"clone"),gC=(0,tn.deprecate)(t=>t.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),Fs=o((t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":Fl(t)?"application/x-www-form-urlencoded;charset=UTF-8":Bi(t)?t.type||null:qt.Buffer.isBuffer(t)||tn.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof An?`multipart/form-data; boundary=${e[Nt].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${gC(t)}`:t instanceof ir.default?null:"text/plain;charset=UTF-8","extractContentType"),zb=o(t=>{let{body:e}=t[Nt];return e===null?0:Bi(e)?e.size:qt.Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},"getTotalBytes"),Db=o(async(t,{body:e})=>{e===null?t.end():await hC(e,t)},"writeToStream")});function Ub(t=[]){return new zt(t.reduce((e,r,n,i)=>(n%2===0&&e.push(i.slice(n,n+2)),e),[]).filter(([e,r])=>{try{return qs(e),Wl(e,String(r)),!0}catch{return!1}}))}var Gl,Vi,qs,Wl,zt,Vs=ct(()=>{Gl=require("node:util"),Vi=gt(require("node:http"),1),qs=typeof Vi.default.validateHeaderName=="function"?Vi.default.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){let e=new TypeError(`Header name must be a valid HTTP token [${t}]`);throw Object.defineProperty(e,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),e}},Wl=typeof Vi.default.validateHeaderValue=="function"?Vi.default.validateHeaderValue:(t,e)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(e)){let r=new TypeError(`Invalid character in header content ["${t}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}},zt=class t extends URLSearchParams{static{o(this,"Headers")}constructor(e){let r=[];if(e instanceof t){let n=e.raw();for(let[i,u]of Object.entries(n))r.push(...u.map(c=>[i,c]))}else if(e!=null)if(typeof e=="object"&&!Gl.types.isBoxedPrimitive(e)){let n=e[Symbol.iterator];if(n==null)r.push(...Object.entries(e));else{if(typeof n!="function")throw new TypeError("Header pairs must be iterable");r=[...e].map(i=>{if(typeof i!="object"||Gl.types.isBoxedPrimitive(i))throw new TypeError("Each header pair must be an iterable object");return[...i]}).map(i=>{if(i.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...i]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return r=r.length>0?r.map(([n,i])=>(qs(n),Wl(n,String(i)),[String(n).toLowerCase(),String(i)])):void 0,super(r),new Proxy(this,{get(n,i,u){switch(i){case"append":case"set":return(c,l)=>(qs(c),Wl(c,String(l)),URLSearchParams.prototype[i].call(n,String(c).toLowerCase(),String(l)));case"delete":case"has":case"getAll":return c=>(qs(c),URLSearchParams.prototype[i].call(n,String(c).toLowerCase()));case"keys":return()=>(n.sort(),new Set(URLSearchParams.prototype.keys.call(n)).keys());default:return Reflect.get(n,i,u)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let r=this.getAll(e);if(r.length===0)return null;let n=r.join(", ");return/^content-encoding$/i.test(e)&&(n=n.toLowerCase()),n}forEach(e,r=void 0){for(let n of this.keys())Reflect.apply(e,r,[this.get(n),n,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,r)=>(e[r]=this.getAll(r),e),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((e,r)=>{let n=this.getAll(r);return r==="host"?e[r]=n[0]:e[r]=n.length>1?n:n[0],e},{})}};Object.defineProperties(zt.prototype,["get","entries","forEach","values"].reduce((t,e)=>(t[e]={enumerable:!0},t),{}));o(Ub,"fromRawHeaders")});var yC,Hi,Zl=ct(()=>{yC=new Set([301,302,303,307,308]),Hi=o(t=>yC.has(t),"isRedirect")});var yr,Vt,jb=ct(()=>{Vs();Bs();Zl();yr=Symbol("Response internals"),Vt=class t extends kr{static{o(this,"Response")}constructor(e=null,r={}){super(e,r);let n=r.status!=null?r.status:200,i=new zt(r.headers);if(e!==null&&!i.has("Content-Type")){let u=Fs(e,this);u&&i.append("Content-Type",u)}this[yr]={type:"default",url:r.url,status:n,statusText:r.statusText||"",headers:i,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[yr].type}get url(){return this[yr].url||""}get status(){return this[yr].status}get ok(){return this[yr].status>=200&&this[yr].status<300}get redirected(){return this[yr].counter>0}get statusText(){return this[yr].statusText}get headers(){return this[yr].headers}get highWaterMark(){return this[yr].highWaterMark}clone(){return new t(zo(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(e,r=302){if(!Hi(r))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new t(null,{headers:{location:new URL(e).toString()},status:r})}static error(){let e=new t(null,{status:0,statusText:""});return e[yr].type="error",e}static json(e=void 0,r={}){let n=JSON.stringify(e);if(n===void 0)throw new TypeError("data is not JSON serializable");let i=new zt(r&&r.headers);return i.has("content-type")||i.set("content-type","application/json"),new t(n,{...r,headers:i})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(Vt.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}})});var Mb,Lb=ct(()=>{Mb=o(t=>{if(t.search)return t.search;let e=t.href.length-1,r=t.hash||(t.href[e]==="#"?"#":"");return t.href[e-r.length]==="?"?"?":""},"getSearch")});function Fb(t,e=!1){return t==null||(t=new URL(t),/^(about|blob|data):$/.test(t.protocol))?"no-referrer":(t.username="",t.password="",t.hash="",e&&(t.pathname="",t.search=""),t)}function Hb(t){if(!qb.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function _C(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,Bb.isIP)(e);return r===4&&/^127\./.test(e)||r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(e)?!0:t.host==="localhost"||t.host.endsWith(".localhost")?!1:t.protocol==="file:"}function Do(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:_C(t)}function Gb(t,{referrerURLCallback:e,referrerOriginCallback:r}={}){if(t.referrer==="no-referrer"||t.referrerPolicy==="")return null;let n=t.referrerPolicy;if(t.referrer==="about:client")return"no-referrer";let i=t.referrer,u=Fb(i),c=Fb(i,!0);u.toString().length>4096&&(u=c),e&&(u=e(u)),r&&(c=r(c));let l=new URL(t.url);switch(n){case"no-referrer":return"no-referrer";case"origin":return c;case"unsafe-url":return u;case"strict-origin":return Do(u)&&!Do(l)?"no-referrer":c.toString();case"strict-origin-when-cross-origin":return u.origin===l.origin?u:Do(u)&&!Do(l)?"no-referrer":c;case"same-origin":return u.origin===l.origin?u:"no-referrer";case"origin-when-cross-origin":return u.origin===l.origin?u:c;case"no-referrer-when-downgrade":return Do(u)&&!Do(l)?"no-referrer":u;default:throw new TypeError(`Invalid referrerPolicy: ${n}`)}}function Wb(t){let e=(t.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let n of e)n&&qb.has(n)&&(r=n);return r}var Bb,qb,Vb,Jl=ct(()=>{Bb=require("node:net");o(Fb,"stripURLForUseAsAReferrer");qb=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),Vb="strict-origin-when-cross-origin";o(Hb,"validateReferrerPolicy");o(_C,"isOriginPotentiallyTrustworthy");o(Do,"isUrlPotentiallyTrustworthy");o(Gb,"determineRequestsReferrer");o(Wb,"parseReferrerPolicyFromHeader")});var Zb,Jb,ft,Gi,bC,Rn,Kb,Qb=ct(()=>{Zb=require("node:url"),Jb=require("node:util");Vs();Bs();Us();Lb();Jl();ft=Symbol("Request internals"),Gi=o(t=>typeof t=="object"&&typeof t[ft]=="object","isRequest"),bC=(0,Jb.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Rn=class t extends kr{static{o(this,"Request")}constructor(e,r={}){let n;if(Gi(e)?n=new URL(e.url):(n=new URL(e),e={}),n.username!==""||n.password!=="")throw new TypeError(`${n} is an url with embedded credentials.`);let i=r.method||e.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(i)&&(i=i.toUpperCase()),!Gi(r)&&"data"in r&&bC(),(r.body!=null||Gi(e)&&e.body!==null)&&(i==="GET"||i==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let u=r.body?r.body:Gi(e)&&e.body!==null?zo(e):null;super(u,{size:r.size||e.size||0});let c=new zt(r.headers||e.headers||{});if(u!==null&&!c.has("Content-Type")){let f=Fs(u,this);f&&c.set("Content-Type",f)}let l=Gi(e)?e.signal:null;if("signal"in r&&(l=r.signal),l!=null&&!bb(l))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let p=r.referrer==null?e.referrer:r.referrer;if(p==="")p="no-referrer";else if(p){let f=new URL(p);p=/^about:(\/\/)?client$/.test(f)?"client":f}else p=void 0;this[ft]={method:i,redirect:r.redirect||e.redirect||"follow",headers:c,parsedURL:n,signal:l,referrer:p},this.follow=r.follow===void 0?e.follow===void 0?20:e.follow:r.follow,this.compress=r.compress===void 0?e.compress===void 0?!0:e.compress:r.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent,this.highWaterMark=r.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=r.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=r.referrerPolicy||e.referrerPolicy||""}get method(){return this[ft].method}get url(){return(0,Zb.format)(this[ft].parsedURL)}get headers(){return this[ft].headers}get redirect(){return this[ft].redirect}get signal(){return this[ft].signal}get referrer(){if(this[ft].referrer==="no-referrer")return"";if(this[ft].referrer==="client")return"about:client";if(this[ft].referrer)return this[ft].referrer.toString()}get referrerPolicy(){return this[ft].referrerPolicy}set referrerPolicy(e){this[ft].referrerPolicy=Hb(e)}clone(){return new t(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(Rn.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});Kb=o(t=>{let{parsedURL:e}=t[ft],r=new zt(t[ft].headers);r.has("Accept")||r.set("Accept","*/*");let n=null;if(t.body===null&&/^(post|put)$/i.test(t.method)&&(n="0"),t.body!==null){let l=zb(t);typeof l=="number"&&!Number.isNaN(l)&&(n=String(l))}n&&r.set("Content-Length",n),t.referrerPolicy===""&&(t.referrerPolicy=Vb),t.referrer&&t.referrer!=="no-referrer"?t[ft].referrer=Gb(t):t[ft].referrer="no-referrer",t[ft].referrer instanceof URL&&r.set("Referer",t.referrer),r.has("User-Agent")||r.set("User-Agent","node-fetch"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip, deflate, br");let{agent:i}=t;typeof i=="function"&&(i=i(e));let u=Mb(e),c={path:e.pathname+u,method:t.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:i};return{parsedURL:e,options:c}},"getNodeRequestOptions")});var Wi,Yb=ct(()=>{zs();Wi=class extends en{static{o(this,"AbortError")}constructor(e,r="aborted"){super(e,r)}}});var tv={};Ba(tv,{AbortError:()=>Wi,Blob:()=>gr,FetchError:()=>At,File:()=>xn,FormData:()=>An,Headers:()=>zt,Request:()=>Rn,Response:()=>Vt,blobFrom:()=>Ab,blobFromSync:()=>xb,default:()=>Kl,fileFrom:()=>Ib,fileFromSync:()=>Rb,isRedirect:()=>Hi});async function Kl(t,e){return new Promise((r,n)=>{let i=new Rn(t,e),{parsedURL:u,options:c}=Kb(i);if(!vC.has(u.protocol))throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${u.protocol.replace(/:$/,"")}" is not supported.`);if(u.protocol==="data:"){let _=cb(i.url),T=new Vt(_,{headers:{"Content-Type":_.typeFull}});r(T);return}let l=(u.protocol==="https:"?ev.default:Xb.default).request,{signal:p}=i,f=null,m=o(()=>{let _=new Wi("The operation was aborted.");n(_),i.body&&i.body instanceof Ht.default.Readable&&i.body.destroy(_),!(!f||!f.body)&&f.body.emit("error",_)},"abort");if(p&&p.aborted){m();return}let g=o(()=>{m(),h()},"abortAndFinalize"),S=l(u.toString(),c);p&&p.addEventListener("abort",g);let h=o(()=>{S.abort(),p&&p.removeEventListener("abort",g)},"finalize");S.on("error",_=>{n(new At(`request to ${i.url} failed, reason: ${_.message}`,"system",_)),h()}),EC(S,_=>{f&&f.body&&f.body.destroy(_)}),process.version<"v14"&&S.on("socket",_=>{let T;_.prependListener("end",()=>{T=_._eventsCount}),_.prependListener("close",E=>{if(f&&T<_._eventsCount&&!E){let w=new Error("Premature close");w.code="ERR_STREAM_PREMATURE_CLOSE",f.body.emit("error",w)}})}),S.on("response",_=>{S.setTimeout(0);let T=Ub(_.rawHeaders);if(Hi(_.statusCode)){let G=T.get("Location"),V=null;try{V=G===null?null:new URL(G,i.url)}catch{if(i.redirect!=="manual"){n(new At(`uri requested responds with an invalid redirect URL: ${G}`,"invalid-redirect")),h();return}}switch(i.redirect){case"error":n(new At(`uri requested responds with a redirect, redirect mode is set to error: ${i.url}`,"no-redirect")),h();return;case"manual":break;case"follow":{if(V===null)break;if(i.counter>=i.follow){n(new At(`maximum redirect reached at: ${i.url}`,"max-redirect")),h();return}let H={headers:new zt(i.headers),follow:i.follow,counter:i.counter+1,agent:i.agent,compress:i.compress,method:i.method,body:zo(i),signal:i.signal,size:i.size,referrer:i.referrer,referrerPolicy:i.referrerPolicy};if(!vb(i.url,V)||!Eb(i.url,V))for(let re of["authorization","www-authenticate","cookie","cookie2"])H.headers.delete(re);if(_.statusCode!==303&&i.body&&e.body instanceof Ht.default.Readable){n(new At("Cannot follow redirect with body being a readable stream","unsupported-redirect")),h();return}(_.statusCode===303||(_.statusCode===301||_.statusCode===302)&&i.method==="POST")&&(H.method="GET",H.body=void 0,H.headers.delete("content-length"));let J=Wb(T);J&&(H.referrerPolicy=J),r(Kl(new Rn(V,H))),h();return}default:return n(new TypeError(`Redirect option '${i.redirect}' is not a valid value of RequestRedirect`))}}p&&_.once("end",()=>{p.removeEventListener("abort",g)});let E=(0,Ht.pipeline)(_,new Ht.PassThrough,G=>{G&&n(G)});process.version<"v12.10"&&_.on("aborted",g);let w={url:i.url,status:_.statusCode,statusText:_.statusMessage,headers:T,size:i.size,counter:i.counter,highWaterMark:i.highWaterMark},k=T.get("Content-Encoding");if(!i.compress||i.method==="HEAD"||k===null||_.statusCode===204||_.statusCode===304){f=new Vt(E,w),r(f);return}let q={flush:Jn.default.Z_SYNC_FLUSH,finishFlush:Jn.default.Z_SYNC_FLUSH};if(k==="gzip"||k==="x-gzip"){E=(0,Ht.pipeline)(E,Jn.default.createGunzip(q),G=>{G&&n(G)}),f=new Vt(E,w),r(f);return}if(k==="deflate"||k==="x-deflate"){let G=(0,Ht.pipeline)(_,new Ht.PassThrough,V=>{V&&n(V)});G.once("data",V=>{(V[0]&15)===8?E=(0,Ht.pipeline)(E,Jn.default.createInflate(),H=>{H&&n(H)}):E=(0,Ht.pipeline)(E,Jn.default.createInflateRaw(),H=>{H&&n(H)}),f=new Vt(E,w),r(f)}),G.once("end",()=>{f||(f=new Vt(E,w),r(f))});return}if(k==="br"){E=(0,Ht.pipeline)(E,Jn.default.createBrotliDecompress(),G=>{G&&n(G)}),f=new Vt(E,w),r(f);return}f=new Vt(E,w),r(f)}),Db(S,i).catch(n)})}function EC(t,e){let r=Zi.Buffer.from(`0\r
23
+ `)),n.push(`--${r}--`),new e(n,{type:"multipart/form-data; boundary="+r})}var Bi,hC,gC,Tb,yC,wb,Bl,Gn,In,Ns=ct(()=>{Fi();Fl();({toStringTag:Bi,iterator:hC,hasInstance:gC}=Symbol),Tb=Math.random,yC="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),wb=o((t,e,r)=>(t+="",/^(Blob|File)$/.test(e&&e[Bi])?[(r=r!==void 0?r+"":e[Bi]=="File"?e.name:"blob",t),e.name!==r||e[Bi]=="blob"?new An([e],r,e):e]:[t,e+""]),"f"),Bl=o((t,e)=>(e?t:t.replace(/\r?\n|\r/g,`\r
24
+ `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),"e"),Gn=o((t,e,r)=>{if(e.length<r)throw new TypeError(`Failed to execute '${t}' on 'FormData': ${r} arguments required, but only ${e.length} present.`)},"x"),In=class{static{o(this,"FormData")}#e=[];constructor(...e){if(e.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[Bi](){return"FormData"}[hC](){return this.entries()}static[gC](e){return e&&typeof e=="object"&&e[Bi]==="FormData"&&!yC.some(r=>typeof e[r]!="function")}append(...e){Gn("append",arguments,2),this.#e.push(wb(...e))}delete(e){Gn("delete",arguments,1),e+="",this.#e=this.#e.filter(([r])=>r!==e)}get(e){Gn("get",arguments,1),e+="";for(var r=this.#e,n=r.length,i=0;i<n;i++)if(r[i][0]===e)return r[i][1];return null}getAll(e,r){return Gn("getAll",arguments,1),r=[],e+="",this.#e.forEach(n=>n[0]===e&&r.push(n[1])),r}has(e){return Gn("has",arguments,1),e+="",this.#e.some(r=>r[0]===e)}forEach(e,r){Gn("forEach",arguments,1);for(var[n,i]of this)e.call(r,i,n,this)}set(...e){Gn("set",arguments,2);var r=[],n=!0;e=wb(...e),this.#e.forEach(i=>{i[0]===e[0]?n&&(n=!r.push(e)):r.push(i)}),n&&r.push(e),this.#e=r}*entries(){yield*this.#e}*keys(){for(var[e]of this)yield e}*values(){for(var[,e]of this)yield e}};o(xb,"formDataToBlob")});var en,Ds=ct(()=>{en=class extends Error{static{o(this,"FetchBaseError")}constructor(e,r){super(e),Error.captureStackTrace(this,this.constructor),this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}});var At,ql=ct(()=>{Ds();At=class extends en{static{o(this,"FetchError")}constructor(e,r,n){super(e,r),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}}});var Us,Vl,qi,Ab,Ib,Rb,js=ct(()=>{Us=Symbol.toStringTag,Vl=o(t=>typeof t=="object"&&typeof t.append=="function"&&typeof t.delete=="function"&&typeof t.get=="function"&&typeof t.getAll=="function"&&typeof t.has=="function"&&typeof t.set=="function"&&typeof t.sort=="function"&&t[Us]==="URLSearchParams","isURLSearchParameters"),qi=o(t=>t&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.constructor=="function"&&/^(Blob|File)$/.test(t[Us]),"isBlob"),Ab=o(t=>typeof t=="object"&&(t[Us]==="AbortSignal"||t[Us]==="EventTarget"),"isAbortSignal"),Ib=o((t,e)=>{let r=new URL(e).hostname,n=new URL(t).hostname;return r===n||r.endsWith(`.${n}`)},"isDomainOrSubdomain"),Rb=o((t,e)=>{let r=new URL(e).protocol,n=new URL(t).protocol;return r===n},"isSameProtocol")});var Ob=L((RZ,Cb)=>{if(!globalThis.DOMException)try{let{MessageChannel:t}=require("worker_threads"),e=new t().port1,r=new ArrayBuffer;e.postMessage(r,[r,r])}catch(t){t.constructor.name==="DOMException"&&(globalThis.DOMException=t.constructor)}Cb.exports=globalThis.DOMException});var Wn,kb,$b,Hl,zb,Nb,Db,Ub,jb,Mb,Ms,Gl=ct(()=>{Wn=require("node:fs"),kb=require("node:path"),$b=yt(Ob(),1);Fl();Fi();({stat:Hl}=Wn.promises),zb=o((t,e)=>jb((0,Wn.statSync)(t),t,e),"blobFromSync"),Nb=o((t,e)=>Hl(t).then(r=>jb(r,t,e)),"blobFrom"),Db=o((t,e)=>Hl(t).then(r=>Mb(r,t,e)),"fileFrom"),Ub=o((t,e)=>Mb((0,Wn.statSync)(t),t,e),"fileFromSync"),jb=o((t,e,r="")=>new gr([new Ms({path:e,size:t.size,lastModified:t.mtimeMs,start:0})],{type:r}),"fromBlob"),Mb=o((t,e,r="")=>new An([new Ms({path:e,size:t.size,lastModified:t.mtimeMs,start:0})],(0,kb.basename)(e),{type:r,lastModified:t.mtimeMs}),"fromFile"),Ms=class t{static{o(this,"BlobDataItem")}#e;#t;constructor(e){this.#e=e.path,this.#t=e.start,this.size=e.size,this.lastModified=e.lastModified}slice(e,r){return new t({path:this.#e,lastModified:this.lastModified,size:r-e,start:this.#t+e})}async*stream(){let{mtimeMs:e}=await Hl(this.#e);if(e>this.lastModified)throw new $b.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*(0,Wn.createReadStream)(this.#e,{start:this.#t,end:this.#t+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}});var Fb={};qa(Fb,{toFormData:()=>TC});function SC(t){let e=t.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!e)return;let r=e[2]||e[3]||"",n=r.slice(r.lastIndexOf("\\")+1);return n=n.replace(/%22/g,'"'),n=n.replace(/&#(\d{4});/g,(i,u)=>String.fromCharCode(u)),n}async function TC(t,e){if(!/multipart/i.test(e))throw new TypeError("Failed to fetch");let r=e.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!r)throw new TypeError("no or bad content-type header, no multipart boundary");let n=new Wl(r[1]||r[2]),i,u,c,l,p,f,m=[],y=new In,P=o(w=>{c+=E.decode(w,{stream:!0})},"onPartData"),h=o(w=>{m.push(w)},"appendToFile"),b=o(()=>{let w=new An(m,f,{type:p});y.append(l,w)},"appendFileToFormData"),T=o(()=>{y.append(l,c)},"appendEntryToFormData"),E=new TextDecoder("utf-8");E.decode(),n.onPartBegin=function(){n.onPartData=P,n.onPartEnd=T,i="",u="",c="",l="",p="",f=null,m.length=0},n.onHeaderField=function(w){i+=E.decode(w,{stream:!0})},n.onHeaderValue=function(w){u+=E.decode(w,{stream:!0})},n.onHeaderEnd=function(){if(u+=E.decode(),i=i.toLowerCase(),i==="content-disposition"){let w=u.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);w&&(l=w[2]||w[3]||""),f=SC(u),f&&(n.onPartData=h,n.onPartEnd=b)}else i==="content-type"&&(p=u);u="",i=""};for await(let w of t)n.write(w);return n.end(),y}var Or,qe,Lb,Rn,Ls,Fs,_C,Vi,bC,vC,EC,PC,Zn,Wl,Bb=ct(()=>{Gl();Ns();Or=0,qe={START_BOUNDARY:Or++,HEADER_FIELD_START:Or++,HEADER_FIELD:Or++,HEADER_VALUE_START:Or++,HEADER_VALUE:Or++,HEADER_VALUE_ALMOST_DONE:Or++,HEADERS_ALMOST_DONE:Or++,PART_DATA_START:Or++,PART_DATA:Or++,END:Or++},Lb=1,Rn={PART_BOUNDARY:Lb,LAST_BOUNDARY:Lb*=2},Ls=10,Fs=13,_C=32,Vi=45,bC=58,vC=97,EC=122,PC=o(t=>t|32,"lower"),Zn=o(()=>{},"noop"),Wl=class{static{o(this,"MultipartParser")}constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=Zn,this.onHeaderField=Zn,this.onHeadersEnd=Zn,this.onHeaderValue=Zn,this.onPartBegin=Zn,this.onPartData=Zn,this.onPartEnd=Zn,this.boundaryChars={},e=`\r
25
+ --`+e;let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n),this.boundaryChars[r[n]]=!0;this.boundary=r,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=qe.START_BOUNDARY}write(e){let r=0,n=e.length,i=this.index,{lookbehind:u,boundary:c,boundaryChars:l,index:p,state:f,flags:m}=this,y=this.boundary.length,P=y-1,h=e.length,b,T,E=o(W=>{this[W+"Mark"]=r},"mark"),w=o(W=>{delete this[W+"Mark"]},"clear"),k=o((W,H,V,J)=>{(H===void 0||H!==V)&&this[W](J&&J.subarray(H,V))},"callback"),q=o((W,H)=>{let V=W+"Mark";V in this&&(H?(k(W,this[V],r,e),delete this[V]):(k(W,this[V],e.length,e),this[V]=0))},"dataCallback");for(r=0;r<n;r++)switch(b=e[r],f){case qe.START_BOUNDARY:if(p===c.length-2){if(b===Vi)m|=Rn.LAST_BOUNDARY;else if(b!==Fs)return;p++;break}else if(p-1===c.length-2){if(m&Rn.LAST_BOUNDARY&&b===Vi)f=qe.END,m=0;else if(!(m&Rn.LAST_BOUNDARY)&&b===Ls)p=0,k("onPartBegin"),f=qe.HEADER_FIELD_START;else return;break}b!==c[p+2]&&(p=-2),b===c[p+2]&&p++;break;case qe.HEADER_FIELD_START:f=qe.HEADER_FIELD,E("onHeaderField"),p=0;case qe.HEADER_FIELD:if(b===Fs){w("onHeaderField"),f=qe.HEADERS_ALMOST_DONE;break}if(p++,b===Vi)break;if(b===bC){if(p===1)return;q("onHeaderField",!0),f=qe.HEADER_VALUE_START;break}if(T=PC(b),T<vC||T>EC)return;break;case qe.HEADER_VALUE_START:if(b===_C)break;E("onHeaderValue"),f=qe.HEADER_VALUE;case qe.HEADER_VALUE:b===Fs&&(q("onHeaderValue",!0),k("onHeaderEnd"),f=qe.HEADER_VALUE_ALMOST_DONE);break;case qe.HEADER_VALUE_ALMOST_DONE:if(b!==Ls)return;f=qe.HEADER_FIELD_START;break;case qe.HEADERS_ALMOST_DONE:if(b!==Ls)return;k("onHeadersEnd"),f=qe.PART_DATA_START;break;case qe.PART_DATA_START:f=qe.PART_DATA,E("onPartData");case qe.PART_DATA:if(i=p,p===0){for(r+=P;r<h&&!(e[r]in l);)r+=y;r-=P,b=e[r]}if(p<c.length)c[p]===b?(p===0&&q("onPartData",!0),p++):p=0;else if(p===c.length)p++,b===Fs?m|=Rn.PART_BOUNDARY:b===Vi?m|=Rn.LAST_BOUNDARY:p=0;else if(p-1===c.length)if(m&Rn.PART_BOUNDARY){if(p=0,b===Ls){m&=~Rn.PART_BOUNDARY,k("onPartEnd"),k("onPartBegin"),f=qe.HEADER_FIELD_START;break}}else m&Rn.LAST_BOUNDARY&&b===Vi?(k("onPartEnd"),f=qe.END,m=0):p=0;if(p>0)u[p-1]=b;else if(i>0){let W=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);k("onPartData",0,i,W),i=0,E("onPartData"),r--}break;case qe.END:break;default:throw new Error(`Unexpected state entered: ${f}`)}q("onHeaderField"),q("onHeaderValue"),q("onPartData"),this.index=p,this.state=f,this.flags=m}end(){if(this.state===qe.HEADER_FIELD_START&&this.index===0||this.state===qe.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==qe.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}};o(SC,"_fileName");o(TC,"toFormData")});async function Zl(t){if(t[zt].disturbed)throw new TypeError(`body used already for: ${t.url}`);if(t[zt].disturbed=!0,t[zt].error)throw t[zt].error;let{body:e}=t;if(e===null)return qt.Buffer.alloc(0);if(!(e instanceof ir.default))return qt.Buffer.alloc(0);let r=[],n=0;try{for await(let i of e){if(t.size>0&&n+i.length>t.size){let u=new At(`content size at ${t.url} over limit: ${t.size}`,"max-size");throw e.destroy(u),u}n+=i.length,r.push(i)}}catch(i){throw i instanceof en?i:new At(`Invalid response body while trying to fetch ${t.url}: ${i.message}`,"system",i)}if(e.readableEnded===!0||e._readableState.ended===!0)try{return r.every(i=>typeof i=="string")?qt.Buffer.from(r.join("")):qt.Buffer.concat(r,n)}catch(i){throw new At(`Could not create Buffer from response body for ${t.url}: ${i.message}`,"system",i)}else throw new At(`Premature close of server response while trying to fetch ${t.url}`)}var ir,tn,qt,wC,zt,kr,Do,xC,Bs,qb,Vb,qs=ct(()=>{ir=yt(require("node:stream"),1),tn=require("node:util"),qt=require("node:buffer");Fi();Ns();ql();Ds();js();wC=(0,tn.promisify)(ir.default.pipeline),zt=Symbol("Body internals"),kr=class{static{o(this,"Body")}constructor(e,{size:r=0}={}){let n=null;e===null?e=null:Vl(e)?e=qt.Buffer.from(e.toString()):qi(e)||qt.Buffer.isBuffer(e)||(tn.types.isAnyArrayBuffer(e)?e=qt.Buffer.from(e):ArrayBuffer.isView(e)?e=qt.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof ir.default||(e instanceof In?(e=xb(e),n=e.type.split("=")[1]):e=qt.Buffer.from(String(e))));let i=e;qt.Buffer.isBuffer(e)?i=ir.default.Readable.from(e):qi(e)&&(i=ir.default.Readable.from(e.stream())),this[zt]={body:e,stream:i,boundary:n,disturbed:!1,error:null},this.size=r,e instanceof ir.default&&e.on("error",u=>{let c=u instanceof en?u:new At(`Invalid response body while trying to fetch ${this.url}: ${u.message}`,"system",u);this[zt].error=c})}get body(){return this[zt].stream}get bodyUsed(){return this[zt].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:n}=await Zl(this);return e.slice(r,r+n)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let n=new In,i=new URLSearchParams(await this.text());for(let[u,c]of i)n.append(u,c);return n}let{toFormData:r}=await Promise.resolve().then(()=>(Bb(),Fb));return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[zt].body&&this[zt].body.type||"",r=await this.arrayBuffer();return new gr([r],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await Zl(this);return new TextDecoder().decode(e)}buffer(){return Zl(this)}};kr.prototype.buffer=(0,tn.deprecate)(kr.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(kr.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,tn.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});o(Zl,"consumeBody");Do=o((t,e)=>{let r,n,{body:i}=t[zt];if(t.bodyUsed)throw new Error("cannot clone body after it is used");return i instanceof ir.default&&typeof i.getBoundary!="function"&&(r=new ir.PassThrough({highWaterMark:e}),n=new ir.PassThrough({highWaterMark:e}),i.pipe(r),i.pipe(n),t[zt].stream=r,i=n),i},"clone"),xC=(0,tn.deprecate)(t=>t.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),Bs=o((t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":Vl(t)?"application/x-www-form-urlencoded;charset=UTF-8":qi(t)?t.type||null:qt.Buffer.isBuffer(t)||tn.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof In?`multipart/form-data; boundary=${e[zt].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${xC(t)}`:t instanceof ir.default?null:"text/plain;charset=UTF-8","extractContentType"),qb=o(t=>{let{body:e}=t[zt];return e===null?0:qi(e)?e.size:qt.Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},"getTotalBytes"),Vb=o(async(t,{body:e})=>{e===null?t.end():await wC(e,t)},"writeToStream")});function Hb(t=[]){return new Nt(t.reduce((e,r,n,i)=>(n%2===0&&e.push(i.slice(n,n+2)),e),[]).filter(([e,r])=>{try{return Vs(e),Kl(e,String(r)),!0}catch{return!1}}))}var Jl,Hi,Vs,Kl,Nt,Hs=ct(()=>{Jl=require("node:util"),Hi=yt(require("node:http"),1),Vs=typeof Hi.default.validateHeaderName=="function"?Hi.default.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){let e=new TypeError(`Header name must be a valid HTTP token [${t}]`);throw Object.defineProperty(e,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),e}},Kl=typeof Hi.default.validateHeaderValue=="function"?Hi.default.validateHeaderValue:(t,e)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(e)){let r=new TypeError(`Invalid character in header content ["${t}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}},Nt=class t extends URLSearchParams{static{o(this,"Headers")}constructor(e){let r=[];if(e instanceof t){let n=e.raw();for(let[i,u]of Object.entries(n))r.push(...u.map(c=>[i,c]))}else if(e!=null)if(typeof e=="object"&&!Jl.types.isBoxedPrimitive(e)){let n=e[Symbol.iterator];if(n==null)r.push(...Object.entries(e));else{if(typeof n!="function")throw new TypeError("Header pairs must be iterable");r=[...e].map(i=>{if(typeof i!="object"||Jl.types.isBoxedPrimitive(i))throw new TypeError("Each header pair must be an iterable object");return[...i]}).map(i=>{if(i.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...i]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return r=r.length>0?r.map(([n,i])=>(Vs(n),Kl(n,String(i)),[String(n).toLowerCase(),String(i)])):void 0,super(r),new Proxy(this,{get(n,i,u){switch(i){case"append":case"set":return(c,l)=>(Vs(c),Kl(c,String(l)),URLSearchParams.prototype[i].call(n,String(c).toLowerCase(),String(l)));case"delete":case"has":case"getAll":return c=>(Vs(c),URLSearchParams.prototype[i].call(n,String(c).toLowerCase()));case"keys":return()=>(n.sort(),new Set(URLSearchParams.prototype.keys.call(n)).keys());default:return Reflect.get(n,i,u)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let r=this.getAll(e);if(r.length===0)return null;let n=r.join(", ");return/^content-encoding$/i.test(e)&&(n=n.toLowerCase()),n}forEach(e,r=void 0){for(let n of this.keys())Reflect.apply(e,r,[this.get(n),n,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,r)=>(e[r]=this.getAll(r),e),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((e,r)=>{let n=this.getAll(r);return r==="host"?e[r]=n[0]:e[r]=n.length>1?n:n[0],e},{})}};Object.defineProperties(Nt.prototype,["get","entries","forEach","values"].reduce((t,e)=>(t[e]={enumerable:!0},t),{}));o(Hb,"fromRawHeaders")});var AC,Gi,Ql=ct(()=>{AC=new Set([301,302,303,307,308]),Gi=o(t=>AC.has(t),"isRedirect")});var yr,Vt,Gb=ct(()=>{Hs();qs();Ql();yr=Symbol("Response internals"),Vt=class t extends kr{static{o(this,"Response")}constructor(e=null,r={}){super(e,r);let n=r.status!=null?r.status:200,i=new Nt(r.headers);if(e!==null&&!i.has("Content-Type")){let u=Bs(e,this);u&&i.append("Content-Type",u)}this[yr]={type:"default",url:r.url,status:n,statusText:r.statusText||"",headers:i,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[yr].type}get url(){return this[yr].url||""}get status(){return this[yr].status}get ok(){return this[yr].status>=200&&this[yr].status<300}get redirected(){return this[yr].counter>0}get statusText(){return this[yr].statusText}get headers(){return this[yr].headers}get highWaterMark(){return this[yr].highWaterMark}clone(){return new t(Do(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(e,r=302){if(!Gi(r))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new t(null,{headers:{location:new URL(e).toString()},status:r})}static error(){let e=new t(null,{status:0,statusText:""});return e[yr].type="error",e}static json(e=void 0,r={}){let n=JSON.stringify(e);if(n===void 0)throw new TypeError("data is not JSON serializable");let i=new Nt(r&&r.headers);return i.has("content-type")||i.set("content-type","application/json"),new t(n,{...r,headers:i})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(Vt.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}})});var Wb,Zb=ct(()=>{Wb=o(t=>{if(t.search)return t.search;let e=t.href.length-1,r=t.hash||(t.href[e]==="#"?"#":"");return t.href[e-r.length]==="?"?"?":""},"getSearch")});function Jb(t,e=!1){return t==null||(t=new URL(t),/^(about|blob|data):$/.test(t.protocol))?"no-referrer":(t.username="",t.password="",t.hash="",e&&(t.pathname="",t.search=""),t)}function Xb(t){if(!Qb.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function IC(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,Kb.isIP)(e);return r===4&&/^127\./.test(e)||r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(e)?!0:t.host==="localhost"||t.host.endsWith(".localhost")?!1:t.protocol==="file:"}function Uo(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:IC(t)}function ev(t,{referrerURLCallback:e,referrerOriginCallback:r}={}){if(t.referrer==="no-referrer"||t.referrerPolicy==="")return null;let n=t.referrerPolicy;if(t.referrer==="about:client")return"no-referrer";let i=t.referrer,u=Jb(i),c=Jb(i,!0);u.toString().length>4096&&(u=c),e&&(u=e(u)),r&&(c=r(c));let l=new URL(t.url);switch(n){case"no-referrer":return"no-referrer";case"origin":return c;case"unsafe-url":return u;case"strict-origin":return Uo(u)&&!Uo(l)?"no-referrer":c.toString();case"strict-origin-when-cross-origin":return u.origin===l.origin?u:Uo(u)&&!Uo(l)?"no-referrer":c;case"same-origin":return u.origin===l.origin?u:"no-referrer";case"origin-when-cross-origin":return u.origin===l.origin?u:c;case"no-referrer-when-downgrade":return Uo(u)&&!Uo(l)?"no-referrer":u;default:throw new TypeError(`Invalid referrerPolicy: ${n}`)}}function tv(t){let e=(t.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let n of e)n&&Qb.has(n)&&(r=n);return r}var Kb,Qb,Yb,Yl=ct(()=>{Kb=require("node:net");o(Jb,"stripURLForUseAsAReferrer");Qb=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),Yb="strict-origin-when-cross-origin";o(Xb,"validateReferrerPolicy");o(IC,"isOriginPotentiallyTrustworthy");o(Uo,"isUrlPotentiallyTrustworthy");o(ev,"determineRequestsReferrer");o(tv,"parseReferrerPolicyFromHeader")});var rv,nv,mt,Wi,RC,Cn,ov,iv=ct(()=>{rv=require("node:url"),nv=require("node:util");Hs();qs();js();Zb();Yl();mt=Symbol("Request internals"),Wi=o(t=>typeof t=="object"&&typeof t[mt]=="object","isRequest"),RC=(0,nv.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Cn=class t extends kr{static{o(this,"Request")}constructor(e,r={}){let n;if(Wi(e)?n=new URL(e.url):(n=new URL(e),e={}),n.username!==""||n.password!=="")throw new TypeError(`${n} is an url with embedded credentials.`);let i=r.method||e.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(i)&&(i=i.toUpperCase()),!Wi(r)&&"data"in r&&RC(),(r.body!=null||Wi(e)&&e.body!==null)&&(i==="GET"||i==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let u=r.body?r.body:Wi(e)&&e.body!==null?Do(e):null;super(u,{size:r.size||e.size||0});let c=new Nt(r.headers||e.headers||{});if(u!==null&&!c.has("Content-Type")){let f=Bs(u,this);f&&c.set("Content-Type",f)}let l=Wi(e)?e.signal:null;if("signal"in r&&(l=r.signal),l!=null&&!Ab(l))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let p=r.referrer==null?e.referrer:r.referrer;if(p==="")p="no-referrer";else if(p){let f=new URL(p);p=/^about:(\/\/)?client$/.test(f)?"client":f}else p=void 0;this[mt]={method:i,redirect:r.redirect||e.redirect||"follow",headers:c,parsedURL:n,signal:l,referrer:p},this.follow=r.follow===void 0?e.follow===void 0?20:e.follow:r.follow,this.compress=r.compress===void 0?e.compress===void 0?!0:e.compress:r.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent,this.highWaterMark=r.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=r.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=r.referrerPolicy||e.referrerPolicy||""}get method(){return this[mt].method}get url(){return(0,rv.format)(this[mt].parsedURL)}get headers(){return this[mt].headers}get redirect(){return this[mt].redirect}get signal(){return this[mt].signal}get referrer(){if(this[mt].referrer==="no-referrer")return"";if(this[mt].referrer==="client")return"about:client";if(this[mt].referrer)return this[mt].referrer.toString()}get referrerPolicy(){return this[mt].referrerPolicy}set referrerPolicy(e){this[mt].referrerPolicy=Xb(e)}clone(){return new t(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(Cn.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});ov=o(t=>{let{parsedURL:e}=t[mt],r=new Nt(t[mt].headers);r.has("Accept")||r.set("Accept","*/*");let n=null;if(t.body===null&&/^(post|put)$/i.test(t.method)&&(n="0"),t.body!==null){let l=qb(t);typeof l=="number"&&!Number.isNaN(l)&&(n=String(l))}n&&r.set("Content-Length",n),t.referrerPolicy===""&&(t.referrerPolicy=Yb),t.referrer&&t.referrer!=="no-referrer"?t[mt].referrer=ev(t):t[mt].referrer="no-referrer",t[mt].referrer instanceof URL&&r.set("Referer",t.referrer),r.has("User-Agent")||r.set("User-Agent","node-fetch"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip, deflate, br");let{agent:i}=t;typeof i=="function"&&(i=i(e));let u=Wb(e),c={path:e.pathname+u,method:t.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:i};return{parsedURL:e,options:c}},"getNodeRequestOptions")});var Zi,av=ct(()=>{Ds();Zi=class extends en{static{o(this,"AbortError")}constructor(e,r="aborted"){super(e,r)}}});var cv={};qa(cv,{AbortError:()=>Zi,Blob:()=>gr,FetchError:()=>At,File:()=>An,FormData:()=>In,Headers:()=>Nt,Request:()=>Cn,Response:()=>Vt,blobFrom:()=>Nb,blobFromSync:()=>zb,default:()=>Xl,fileFrom:()=>Db,fileFromSync:()=>Ub,isRedirect:()=>Gi});async function Xl(t,e){return new Promise((r,n)=>{let i=new Cn(t,e),{parsedURL:u,options:c}=ov(i);if(!CC.has(u.protocol))throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${u.protocol.replace(/:$/,"")}" is not supported.`);if(u.protocol==="data:"){let b=yb(i.url),T=new Vt(b,{headers:{"Content-Type":b.typeFull}});r(T);return}let l=(u.protocol==="https:"?uv.default:sv.default).request,{signal:p}=i,f=null,m=o(()=>{let b=new Zi("The operation was aborted.");n(b),i.body&&i.body instanceof Ht.default.Readable&&i.body.destroy(b),!(!f||!f.body)&&f.body.emit("error",b)},"abort");if(p&&p.aborted){m();return}let y=o(()=>{m(),h()},"abortAndFinalize"),P=l(u.toString(),c);p&&p.addEventListener("abort",y);let h=o(()=>{P.abort(),p&&p.removeEventListener("abort",y)},"finalize");P.on("error",b=>{n(new At(`request to ${i.url} failed, reason: ${b.message}`,"system",b)),h()}),OC(P,b=>{f&&f.body&&f.body.destroy(b)}),process.version<"v14"&&P.on("socket",b=>{let T;b.prependListener("end",()=>{T=b._eventsCount}),b.prependListener("close",E=>{if(f&&T<b._eventsCount&&!E){let w=new Error("Premature close");w.code="ERR_STREAM_PREMATURE_CLOSE",f.body.emit("error",w)}})}),P.on("response",b=>{P.setTimeout(0);let T=Hb(b.rawHeaders);if(Gi(b.statusCode)){let W=T.get("Location"),H=null;try{H=W===null?null:new URL(W,i.url)}catch{if(i.redirect!=="manual"){n(new At(`uri requested responds with an invalid redirect URL: ${W}`,"invalid-redirect")),h();return}}switch(i.redirect){case"error":n(new At(`uri requested responds with a redirect, redirect mode is set to error: ${i.url}`,"no-redirect")),h();return;case"manual":break;case"follow":{if(H===null)break;if(i.counter>=i.follow){n(new At(`maximum redirect reached at: ${i.url}`,"max-redirect")),h();return}let V={headers:new Nt(i.headers),follow:i.follow,counter:i.counter+1,agent:i.agent,compress:i.compress,method:i.method,body:Do(i),signal:i.signal,size:i.size,referrer:i.referrer,referrerPolicy:i.referrerPolicy};if(!Ib(i.url,H)||!Rb(i.url,H))for(let re of["authorization","www-authenticate","cookie","cookie2"])V.headers.delete(re);if(b.statusCode!==303&&i.body&&e.body instanceof Ht.default.Readable){n(new At("Cannot follow redirect with body being a readable stream","unsupported-redirect")),h();return}(b.statusCode===303||(b.statusCode===301||b.statusCode===302)&&i.method==="POST")&&(V.method="GET",V.body=void 0,V.headers.delete("content-length"));let J=tv(T);J&&(V.referrerPolicy=J),r(Xl(new Cn(H,V))),h();return}default:return n(new TypeError(`Redirect option '${i.redirect}' is not a valid value of RequestRedirect`))}}p&&b.once("end",()=>{p.removeEventListener("abort",y)});let E=(0,Ht.pipeline)(b,new Ht.PassThrough,W=>{W&&n(W)});process.version<"v12.10"&&b.on("aborted",y);let w={url:i.url,status:b.statusCode,statusText:b.statusMessage,headers:T,size:i.size,counter:i.counter,highWaterMark:i.highWaterMark},k=T.get("Content-Encoding");if(!i.compress||i.method==="HEAD"||k===null||b.statusCode===204||b.statusCode===304){f=new Vt(E,w),r(f);return}let q={flush:Jn.default.Z_SYNC_FLUSH,finishFlush:Jn.default.Z_SYNC_FLUSH};if(k==="gzip"||k==="x-gzip"){E=(0,Ht.pipeline)(E,Jn.default.createGunzip(q),W=>{W&&n(W)}),f=new Vt(E,w),r(f);return}if(k==="deflate"||k==="x-deflate"){let W=(0,Ht.pipeline)(b,new Ht.PassThrough,H=>{H&&n(H)});W.once("data",H=>{(H[0]&15)===8?E=(0,Ht.pipeline)(E,Jn.default.createInflate(),V=>{V&&n(V)}):E=(0,Ht.pipeline)(E,Jn.default.createInflateRaw(),V=>{V&&n(V)}),f=new Vt(E,w),r(f)}),W.once("end",()=>{f||(f=new Vt(E,w),r(f))});return}if(k==="br"){E=(0,Ht.pipeline)(E,Jn.default.createBrotliDecompress(),W=>{W&&n(W)}),f=new Vt(E,w),r(f);return}f=new Vt(E,w),r(f)}),Vb(P,i).catch(n)})}function OC(t,e){let r=Ji.Buffer.from(`0\r
26
26
  \r
27
- `),n=!1,i=!1,u;t.on("response",c=>{let{headers:l}=c;n=l["transfer-encoding"]==="chunked"&&!l["content-length"]}),t.on("socket",c=>{let l=o(()=>{if(n&&!i){let f=new Error("Premature close");f.code="ERR_STREAM_PREMATURE_CLOSE",e(f)}},"onSocketClose"),p=o(f=>{i=Zi.Buffer.compare(f.slice(-5),r)===0,!i&&u&&(i=Zi.Buffer.compare(u.slice(-3),r.slice(0,3))===0&&Zi.Buffer.compare(f.slice(-2),r.slice(3))===0),u=f},"onData");c.prependListener("close",l),c.on("data",p),t.on("close",()=>{c.removeListener("close",l),c.removeListener("data",p)})})}var Xb,ev,Jn,Ht,Zi,vC,rv=ct(()=>{Xb=gt(require("node:http"),1),ev=gt(require("node:https"),1),Jn=gt(require("node:zlib"),1),Ht=gt(require("node:stream"),1),Zi=require("node:buffer");lb();Bs();jb();Vs();Qb();Ll();Yb();Zl();Ns();Us();Jl();ql();vC=new Set(["data:","http:","https:"]);o(Kl,"fetch");o(EC,"fixResponseChunkedTransferBadEnding")});var iv=M(jo=>{"use strict";var SC=jo&&jo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},Uo;Object.defineProperty(jo,"__esModule",{value:!0});jo.Gaxios=void 0;var PC=SC(Pl()),TC=require("https"),Kn=xl(),wC=U_(),nv=require("stream"),ov=Rl(),xC=o(async()=>globalThis.crypto?.randomUUID()||(await import("crypto")).randomUUID(),"randomUUID"),AC=204,Hs=class{static{o(this,"Gaxios")}agentCache=new Map;defaults;interceptors;constructor(e){this.defaults=e||{},this.interceptors={request:new ov.GaxiosInterceptorManager,response:new ov.GaxiosInterceptorManager}}fetch(...e){let r=e[0],n=e[1],i,u=new Headers;return typeof r=="string"?i=new URL(r):r instanceof URL?i=r:r&&r.url&&(i=new URL(r.url)),r&&typeof r=="object"&&"headers"in r&&Uo.mergeHeaders(u,r.headers),n&&Uo.mergeHeaders(u,new Headers(n.headers)),typeof r=="object"&&!(r instanceof URL)?this.request({...n,...r,headers:u,url:i}):this.request({...n,headers:u,url:i})}async request(e={}){let r=await this.#n(e);return r=await this.#t(r),this.#r(this._request(r))}async _defaultAdapter(e){let r=e.fetchImplementation||this.defaults.fetchImplementation||await Uo.#u(),n={...e};delete n.data;let i=await r(e.url,n),u=await this.getResponseData(e,i);return Object.getOwnPropertyDescriptor(i,"data")?.configurable||Object.defineProperties(i,{data:{configurable:!0,writable:!0,enumerable:!0,value:u}}),Object.assign(i,{config:e,data:u})}async _request(e){try{let r;if(e.adapter?r=await e.adapter(e,this._defaultAdapter.bind(this)):r=await this._defaultAdapter(e),!e.validateStatus(r.status)){if(e.responseType==="stream"){let i=[];for await(let u of r.data)i.push(u);r.data=i.toString()}let n=Kn.GaxiosError.extractAPIErrorFromResponse(r,`Request failed with status code ${r.status}`);throw new Kn.GaxiosError(n?.message,e,r,n)}return r}catch(r){let n;r instanceof Kn.GaxiosError?n=r:r instanceof Error?n=new Kn.GaxiosError(r.message,e,void 0,r):n=new Kn.GaxiosError("Unexpected Gaxios Error",e,void 0,r);let{shouldRetry:i,config:u}=await(0,wC.getRetryConfig)(n);if(i&&u)return n.config.retryConfig.currentRetryAttempt=u.retryConfig.currentRetryAttempt,e.retryConfig=n.config?.retryConfig,this.#o(e),this._request(e);throw e.errorRedactor&&e.errorRedactor(n),n}}async getResponseData(e,r){if(r.status===AC)return"";if(e.maxContentLength&&r.headers.has("content-length")&&e.maxContentLength<Number.parseInt(r.headers?.get("content-length")||""))throw new Kn.GaxiosError("Response's `Content-Length` is over the limit.",e,Object.assign(r,{config:e}));switch(e.responseType){case"stream":return r.body;case"json":{let n=await r.text();try{return JSON.parse(n)}catch{return n}}case"arraybuffer":return r.arrayBuffer();case"blob":return r.blob();case"text":return r.text();default:return this.getResponseDataFromContentType(r)}}#e(e,r=[]){let n=new URL(e),i=[...r],u=(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[];for(let c of u)i.push(c.trim());for(let c of i)if(c instanceof RegExp){if(c.test(n.toString()))return!1}else if(c instanceof URL){if(c.origin===n.origin)return!1}else if(c.startsWith("*.")||c.startsWith(".")){let l=c.replace(/^\*\./,".");if(n.hostname.endsWith(l))return!1}else if(c===n.origin||c===n.hostname||c===n.href)return!1;return!0}async#t(e){let r=Promise.resolve(e);for(let n of this.interceptors.request.values())n&&(r=r.then(n.resolved,n.rejected));return r}async#r(e){let r=Promise.resolve(e);for(let n of this.interceptors.response.values())n&&(r=r.then(n.resolved,n.rejected));return r}async#n(e){let r=new Headers(this.defaults.headers);Uo.mergeHeaders(r,e.headers);let n=(0,PC.default)(!0,{},this.defaults,e);if(!n.url)throw new Error("URL is required.");if(n.baseURL&&(n.url=new URL(n.url,n.baseURL)),n.url=new URL(n.url),n.params)if(n.paramsSerializer){let c=n.paramsSerializer(n.params);c.startsWith("?")&&(c=c.slice(1));let l=n.url.toString().includes("?")?"&":"?";n.url=n.url+l+c}else{let c=n.url instanceof URL?n.url:new URL(n.url);for(let[l,p]of new URLSearchParams(n.params))c.searchParams.append(l,p);n.url=c}typeof e.maxContentLength=="number"&&(n.size=e.maxContentLength),typeof e.maxRedirects=="number"&&(n.follow=e.maxRedirects);let i=typeof n.data=="string"||n.data instanceof ArrayBuffer||n.data instanceof Blob||globalThis.File&&n.data instanceof File||n.data instanceof FormData||n.data instanceof nv.Readable||n.data instanceof ReadableStream||n.data instanceof String||n.data instanceof URLSearchParams||ArrayBuffer.isView(n.data)||["Blob","File","FormData"].includes(n.data?.constructor?.name||"");if(n.multipart?.length){let c=await xC();r.set("content-type",`multipart/related; boundary=${c}`),n.body=nv.Readable.from(this.getMultipartRequest(n.multipart,c))}else i?n.body=n.data:typeof n.data=="object"?r.get("Content-Type")==="application/x-www-form-urlencoded"?n.body=n.paramsSerializer?n.paramsSerializer(n.data):new URLSearchParams(n.data):(r.has("content-type")||r.set("content-type","application/json"),n.body=JSON.stringify(n.data)):n.data&&(n.body=n.data);n.validateStatus=n.validateStatus||this.validateStatus,n.responseType=n.responseType||"unknown",!r.has("accept")&&n.responseType==="json"&&r.set("accept","application/json");let u=n.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(!n.agent)if(u&&this.#e(n.url,n.noProxy)){let c=await Uo.#s();this.agentCache.has(u)?n.agent=this.agentCache.get(u):(n.agent=new c(u,{cert:n.cert,key:n.key}),this.agentCache.set(u,n.agent))}else n.cert&&n.key&&(this.agentCache.has(n.key)?n.agent=this.agentCache.get(n.key):(n.agent=new TC.Agent({cert:n.cert,key:n.key}),this.agentCache.set(n.key,n.agent)));return typeof n.errorRedactor!="function"&&n.errorRedactor!==!1&&(n.errorRedactor=Kn.defaultErrorRedactor),n.body&&!("duplex"in n)&&(n.duplex="half"),this.#o(n),Object.assign(n,{headers:r,url:n.url instanceof URL?n.url:new URL(n.url)})}#o(e){if(e.timeout){let r=AbortSignal.timeout(e.timeout);e.signal&&!e.signal.aborted?e.signal=AbortSignal.any([e.signal,r]):e.signal=r}}validateStatus(e){return e>=200&&e<300}async getResponseDataFromContentType(e){let r=e.headers.get("Content-Type");if(r===null)return e.text();if(r=r.toLowerCase(),r.includes("application/json")){let n=await e.text();try{n=JSON.parse(n)}catch{}return n}else return r.match(/^text\//)?e.text():e.blob()}async*getMultipartRequest(e,r){let n=`--${r}--`;for(let i of e){let u=i.headers.get("Content-Type")||"application/octet-stream";yield`--${r}\r
27
+ `),n=!1,i=!1,u;t.on("response",c=>{let{headers:l}=c;n=l["transfer-encoding"]==="chunked"&&!l["content-length"]}),t.on("socket",c=>{let l=o(()=>{if(n&&!i){let f=new Error("Premature close");f.code="ERR_STREAM_PREMATURE_CLOSE",e(f)}},"onSocketClose"),p=o(f=>{i=Ji.Buffer.compare(f.slice(-5),r)===0,!i&&u&&(i=Ji.Buffer.compare(u.slice(-3),r.slice(0,3))===0&&Ji.Buffer.compare(f.slice(-2),r.slice(3))===0),u=f},"onData");c.prependListener("close",l),c.on("data",p),t.on("close",()=>{c.removeListener("close",l),c.removeListener("data",p)})})}var sv,uv,Jn,Ht,Ji,CC,lv=ct(()=>{sv=yt(require("node:http"),1),uv=yt(require("node:https"),1),Jn=yt(require("node:zlib"),1),Ht=yt(require("node:stream"),1),Ji=require("node:buffer");_b();qs();Gb();Hs();iv();ql();av();Ql();Ns();js();Yl();Gl();CC=new Set(["data:","http:","https:"]);o(Xl,"fetch");o(OC,"fixResponseChunkedTransferBadEnding")});var fv=L(Mo=>{"use strict";var kC=Mo&&Mo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},jo;Object.defineProperty(Mo,"__esModule",{value:!0});Mo.Gaxios=void 0;var $C=kC(xl()),zC=require("https"),Kn=Rl(),NC=H_(),dv=require("stream"),pv=kl(),DC=o(async()=>globalThis.crypto?.randomUUID()||(await import("crypto")).randomUUID(),"randomUUID"),UC=204,Gs=class{static{o(this,"Gaxios")}agentCache=new Map;defaults;interceptors;constructor(e){this.defaults=e||{},this.interceptors={request:new pv.GaxiosInterceptorManager,response:new pv.GaxiosInterceptorManager}}fetch(...e){let r=e[0],n=e[1],i,u=new Headers;return typeof r=="string"?i=new URL(r):r instanceof URL?i=r:r&&r.url&&(i=new URL(r.url)),r&&typeof r=="object"&&"headers"in r&&jo.mergeHeaders(u,r.headers),n&&jo.mergeHeaders(u,new Headers(n.headers)),typeof r=="object"&&!(r instanceof URL)?this.request({...n,...r,headers:u,url:i}):this.request({...n,headers:u,url:i})}async request(e={}){let r=await this.#n(e);return r=await this.#t(r),this.#r(this._request(r))}async _defaultAdapter(e){let r=e.fetchImplementation||this.defaults.fetchImplementation||await jo.#u(),n={...e};delete n.data;let i=await r(e.url,n),u=await this.getResponseData(e,i);return Object.getOwnPropertyDescriptor(i,"data")?.configurable||Object.defineProperties(i,{data:{configurable:!0,writable:!0,enumerable:!0,value:u}}),Object.assign(i,{config:e,data:u})}async _request(e){try{let r;if(e.adapter?r=await e.adapter(e,this._defaultAdapter.bind(this)):r=await this._defaultAdapter(e),!e.validateStatus(r.status)){if(e.responseType==="stream"){let i=[];for await(let u of r.data)i.push(u);r.data=i.toString()}let n=Kn.GaxiosError.extractAPIErrorFromResponse(r,`Request failed with status code ${r.status}`);throw new Kn.GaxiosError(n?.message,e,r,n)}return r}catch(r){let n;r instanceof Kn.GaxiosError?n=r:r instanceof Error?n=new Kn.GaxiosError(r.message,e,void 0,r):n=new Kn.GaxiosError("Unexpected Gaxios Error",e,void 0,r);let{shouldRetry:i,config:u}=await(0,NC.getRetryConfig)(n);if(i&&u)return n.config.retryConfig.currentRetryAttempt=u.retryConfig.currentRetryAttempt,e.retryConfig=n.config?.retryConfig,this.#o(e),this._request(e);throw e.errorRedactor&&e.errorRedactor(n),n}}async getResponseData(e,r){if(r.status===UC)return"";if(e.maxContentLength&&r.headers.has("content-length")&&e.maxContentLength<Number.parseInt(r.headers?.get("content-length")||""))throw new Kn.GaxiosError("Response's `Content-Length` is over the limit.",e,Object.assign(r,{config:e}));switch(e.responseType){case"stream":return r.body;case"json":{let n=await r.text();try{return JSON.parse(n)}catch{return n}}case"arraybuffer":return r.arrayBuffer();case"blob":return r.blob();case"text":return r.text();default:return this.getResponseDataFromContentType(r)}}#e(e,r=[]){let n=new URL(e),i=[...r],u=(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[];for(let c of u)i.push(c.trim());for(let c of i)if(c instanceof RegExp){if(c.test(n.toString()))return!1}else if(c instanceof URL){if(c.origin===n.origin)return!1}else if(c.startsWith("*.")||c.startsWith(".")){let l=c.replace(/^\*\./,".");if(n.hostname.endsWith(l))return!1}else if(c===n.origin||c===n.hostname||c===n.href)return!1;return!0}async#t(e){let r=Promise.resolve(e);for(let n of this.interceptors.request.values())n&&(r=r.then(n.resolved,n.rejected));return r}async#r(e){let r=Promise.resolve(e);for(let n of this.interceptors.response.values())n&&(r=r.then(n.resolved,n.rejected));return r}async#n(e){let r=new Headers(this.defaults.headers);jo.mergeHeaders(r,e.headers);let n=(0,$C.default)(!0,{},this.defaults,e);if(!n.url)throw new Error("URL is required.");if(n.baseURL&&(n.url=new URL(n.url,n.baseURL)),n.url=new URL(n.url),n.params)if(n.paramsSerializer){let c=n.paramsSerializer(n.params);c.startsWith("?")&&(c=c.slice(1));let l=n.url.toString().includes("?")?"&":"?";n.url=n.url+l+c}else{let c=n.url instanceof URL?n.url:new URL(n.url);for(let[l,p]of new URLSearchParams(n.params))c.searchParams.append(l,p);n.url=c}typeof e.maxContentLength=="number"&&(n.size=e.maxContentLength),typeof e.maxRedirects=="number"&&(n.follow=e.maxRedirects);let i=typeof n.data=="string"||n.data instanceof ArrayBuffer||n.data instanceof Blob||globalThis.File&&n.data instanceof File||n.data instanceof FormData||n.data instanceof dv.Readable||n.data instanceof ReadableStream||n.data instanceof String||n.data instanceof URLSearchParams||ArrayBuffer.isView(n.data)||["Blob","File","FormData"].includes(n.data?.constructor?.name||"");if(n.multipart?.length){let c=await DC();r.set("content-type",`multipart/related; boundary=${c}`),n.body=dv.Readable.from(this.getMultipartRequest(n.multipart,c))}else i?n.body=n.data:typeof n.data=="object"?r.get("Content-Type")==="application/x-www-form-urlencoded"?n.body=n.paramsSerializer?n.paramsSerializer(n.data):new URLSearchParams(n.data):(r.has("content-type")||r.set("content-type","application/json"),n.body=JSON.stringify(n.data)):n.data&&(n.body=n.data);n.validateStatus=n.validateStatus||this.validateStatus,n.responseType=n.responseType||"unknown",!r.has("accept")&&n.responseType==="json"&&r.set("accept","application/json");let u=n.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(!n.agent)if(u&&this.#e(n.url,n.noProxy)){let c=await jo.#s();this.agentCache.has(u)?n.agent=this.agentCache.get(u):(n.agent=new c(u,{cert:n.cert,key:n.key}),this.agentCache.set(u,n.agent))}else n.cert&&n.key&&(this.agentCache.has(n.key)?n.agent=this.agentCache.get(n.key):(n.agent=new zC.Agent({cert:n.cert,key:n.key}),this.agentCache.set(n.key,n.agent)));return typeof n.errorRedactor!="function"&&n.errorRedactor!==!1&&(n.errorRedactor=Kn.defaultErrorRedactor),n.body&&!("duplex"in n)&&(n.duplex="half"),this.#o(n),Object.assign(n,{headers:r,url:n.url instanceof URL?n.url:new URL(n.url)})}#o(e){if(e.timeout){let r=AbortSignal.timeout(e.timeout);e.signal&&!e.signal.aborted?e.signal=AbortSignal.any([e.signal,r]):e.signal=r}}validateStatus(e){return e>=200&&e<300}async getResponseDataFromContentType(e){let r=e.headers.get("Content-Type");if(r===null)return e.text();if(r=r.toLowerCase(),r.includes("application/json")){let n=await e.text();try{n=JSON.parse(n)}catch{}return n}else return r.match(/^text\//)?e.text():e.blob()}async*getMultipartRequest(e,r){let n=`--${r}--`;for(let i of e){let u=i.headers.get("Content-Type")||"application/octet-stream";yield`--${r}\r
28
28
  Content-Type: ${u}\r
29
29
  \r
30
30
  `,typeof i.content=="string"?yield i.content:yield*i.content,yield`\r
31
- `}yield n}static#i;static#a;static async#s(){return this.#i||=(await Promise.resolve().then(()=>gt(ub()))).HttpsProxyAgent,this.#i}static async#u(){let e=typeof window<"u"&&!!window;return this.#a||=e?window.fetch:(await Promise.resolve().then(()=>(rv(),tv))).default,this.#a}static mergeHeaders(e,...r){e=e instanceof Headers?e:new Headers(e);for(let n of r)(n instanceof Headers?n:new Headers(n)).forEach((u,c)=>{c==="set-cookie"?e.append(c,u):e.set(c,u)});return e}};jo.Gaxios=Hs;Uo=Hs});var yt=M(It=>{"use strict";var IC=It&&It.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),RC=It&&It.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&IC(e,t,r)};Object.defineProperty(It,"__esModule",{value:!0});It.instance=It.Gaxios=It.GaxiosError=void 0;It.request=OC;var av=iv();Object.defineProperty(It,"Gaxios",{enumerable:!0,get:o(function(){return av.Gaxios},"get")});var CC=xl();Object.defineProperty(It,"GaxiosError",{enumerable:!0,get:o(function(){return CC.GaxiosError},"get")});RC(Rl(),It);It.instance=new av.Gaxios;async function OC(t){return It.instance.request(t)}o(OC,"request")});var Ql=M((sv,Gs)=>{(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,u="[BigNumber Error] ",c=u+"Number primitive has more than 15 significant digits: ",l=1e14,p=14,f=9007199254740991,m=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,S=1e9;function h(V){var H,J,re,Z=W.prototype={constructor:W,toString:null,valueOf:null},ze=new W(1),Se=20,be=4,ke=-7,Ie=21,Ve=-1e7,He=1e7,Je=!1,Ut=1,Et=0,ro={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},wr="0123456789abcdefghijklmnopqrstuvwxyz",oi=!0;function W(y,P){var x,z,R,$,j,I,C,D,N=this;if(!(N instanceof W))return new W(y,P);if(P==null){if(y&&y._isBigNumber===!0){N.s=y.s,!y.c||y.e>He?N.c=N.e=null:y.e<Ve?N.c=[N.e=0]:(N.e=y.e,N.c=y.c.slice());return}if((I=typeof y=="number")&&y*0==0){if(N.s=1/y<0?(y=-y,-1):1,y===~~y){for($=0,j=y;j>=10;j/=10,$++);$>He?N.c=N.e=null:(N.e=$,N.c=[y]);return}D=String(y)}else{if(!r.test(D=String(y)))return re(N,D,I);N.s=D.charCodeAt(0)==45?(D=D.slice(1),-1):1}($=D.indexOf("."))>-1&&(D=D.replace(".","")),(j=D.search(/e/i))>0?($<0&&($=j),$+=+D.slice(j+1),D=D.substring(0,j)):$<0&&($=D.length)}else{if(w(P,2,wr.length,"Base"),P==10&&oi)return N=new W(y),Pt(N,Se+N.e+1,be);if(D=String(y),I=typeof y=="number"){if(y*0!=0)return re(N,D,I,P);if(N.s=1/y<0?(D=D.slice(1),-1):1,W.DEBUG&&D.replace(/^0\.0*|\./,"").length>15)throw Error(c+y)}else N.s=D.charCodeAt(0)===45?(D=D.slice(1),-1):1;for(x=wr.slice(0,P),$=j=0,C=D.length;j<C;j++)if(x.indexOf(z=D.charAt(j))<0){if(z=="."){if(j>$){$=C;continue}}else if(!R&&(D==D.toUpperCase()&&(D=D.toLowerCase())||D==D.toLowerCase()&&(D=D.toUpperCase()))){R=!0,j=-1,$=0;continue}return re(N,String(y),I,P)}I=!1,D=J(D,P,10,N.s),($=D.indexOf("."))>-1?D=D.replace(".",""):$=D.length}for(j=0;D.charCodeAt(j)===48;j++);for(C=D.length;D.charCodeAt(--C)===48;);if(D=D.slice(j,++C)){if(C-=j,I&&W.DEBUG&&C>15&&(y>f||y!==i(y)))throw Error(c+N.s*y);if(($=$-j-1)>He)N.c=N.e=null;else if($<Ve)N.c=[N.e=0];else{if(N.e=$,N.c=[],j=($+1)%p,$<0&&(j+=p),j<C){for(j&&N.c.push(+D.slice(0,j)),C-=p;j<C;)N.c.push(+D.slice(j,j+=p));j=p-(D=D.slice(j)).length}else j-=C;for(;j--;D+="0");N.c.push(+D)}}else N.c=[N.e=0]}o(W,"BigNumber"),W.clone=h,W.ROUND_UP=0,W.ROUND_DOWN=1,W.ROUND_CEIL=2,W.ROUND_FLOOR=3,W.ROUND_HALF_UP=4,W.ROUND_HALF_DOWN=5,W.ROUND_HALF_EVEN=6,W.ROUND_HALF_CEIL=7,W.ROUND_HALF_FLOOR=8,W.EUCLID=9,W.config=W.set=function(y){var P,x;if(y!=null)if(typeof y=="object"){if(y.hasOwnProperty(P="DECIMAL_PLACES")&&(x=y[P],w(x,0,S,P),Se=x),y.hasOwnProperty(P="ROUNDING_MODE")&&(x=y[P],w(x,0,8,P),be=x),y.hasOwnProperty(P="EXPONENTIAL_AT")&&(x=y[P],x&&x.pop?(w(x[0],-S,0,P),w(x[1],0,S,P),ke=x[0],Ie=x[1]):(w(x,-S,S,P),ke=-(Ie=x<0?-x:x))),y.hasOwnProperty(P="RANGE"))if(x=y[P],x&&x.pop)w(x[0],-S,-1,P),w(x[1],1,S,P),Ve=x[0],He=x[1];else if(w(x,-S,S,P),x)Ve=-(He=x<0?-x:x);else throw Error(u+P+" cannot be zero: "+x);if(y.hasOwnProperty(P="CRYPTO"))if(x=y[P],x===!!x)if(x)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))Je=x;else throw Je=!x,Error(u+"crypto unavailable");else Je=x;else throw Error(u+P+" not true or false: "+x);if(y.hasOwnProperty(P="MODULO_MODE")&&(x=y[P],w(x,0,9,P),Ut=x),y.hasOwnProperty(P="POW_PRECISION")&&(x=y[P],w(x,0,S,P),Et=x),y.hasOwnProperty(P="FORMAT"))if(x=y[P],typeof x=="object")ro=x;else throw Error(u+P+" not an object: "+x);if(y.hasOwnProperty(P="ALPHABET"))if(x=y[P],typeof x=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(x))oi=x.slice(0,10)=="0123456789",wr=x;else throw Error(u+P+" invalid: "+x)}else throw Error(u+"Object expected: "+y);return{DECIMAL_PLACES:Se,ROUNDING_MODE:be,EXPONENTIAL_AT:[ke,Ie],RANGE:[Ve,He],CRYPTO:Je,MODULO_MODE:Ut,POW_PRECISION:Et,FORMAT:ro,ALPHABET:wr}},W.isBigNumber=function(y){if(!y||y._isBigNumber!==!0)return!1;if(!W.DEBUG)return!0;var P,x,z=y.c,R=y.e,$=y.s;e:if({}.toString.call(z)=="[object Array]"){if(($===1||$===-1)&&R>=-S&&R<=S&&R===i(R)){if(z[0]===0){if(R===0&&z.length===1)return!0;break e}if(P=(R+1)%p,P<1&&(P+=p),String(z[0]).length==P){for(P=0;P<z.length;P++)if(x=z[P],x<0||x>=l||x!==i(x))break e;if(x!==0)return!0}}}else if(z===null&&R===null&&($===null||$===1||$===-1))return!0;throw Error(u+"Invalid BigNumber: "+y)},W.maximum=W.max=function(){return St(arguments,-1)},W.minimum=W.min=function(){return St(arguments,1)},W.random=(function(){var y=9007199254740992,P=Math.random()*y&2097151?function(){return i(Math.random()*y)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(x){var z,R,$,j,I,C=0,D=[],N=new W(ze);if(x==null?x=Se:w(x,0,S),j=n(x/p),Je)if(crypto.getRandomValues){for(z=crypto.getRandomValues(new Uint32Array(j*=2));C<j;)I=z[C]*131072+(z[C+1]>>>11),I>=9e15?(R=crypto.getRandomValues(new Uint32Array(2)),z[C]=R[0],z[C+1]=R[1]):(D.push(I%1e14),C+=2);C=j/2}else if(crypto.randomBytes){for(z=crypto.randomBytes(j*=7);C<j;)I=(z[C]&31)*281474976710656+z[C+1]*1099511627776+z[C+2]*4294967296+z[C+3]*16777216+(z[C+4]<<16)+(z[C+5]<<8)+z[C+6],I>=9e15?crypto.randomBytes(7).copy(z,C):(D.push(I%1e14),C+=7);C=j/7}else throw Je=!1,Error(u+"crypto unavailable");if(!Je)for(;C<j;)I=P(),I<9e15&&(D[C++]=I%1e14);for(j=D[--C],x%=p,j&&x&&(I=m[p-x],D[C]=i(j/I)*I);D[C]===0;D.pop(),C--);if(C<0)D=[$=0];else{for($=-1;D[0]===0;D.splice(0,1),$-=p);for(C=1,I=D[0];I>=10;I/=10,C++);C<p&&($-=p-C)}return N.e=$,N.c=D,N}})(),W.sum=function(){for(var y=1,P=arguments,x=new W(P[0]);y<P.length;)x=x.plus(P[y++]);return x},J=(function(){var y="0123456789";function P(x,z,R,$){for(var j,I=[0],C,D=0,N=x.length;D<N;){for(C=I.length;C--;I[C]*=z);for(I[0]+=$.indexOf(x.charAt(D++)),j=0;j<I.length;j++)I[j]>R-1&&(I[j+1]==null&&(I[j+1]=0),I[j+1]+=I[j]/R|0,I[j]%=R)}return I.reverse()}return o(P,"toBaseOut"),function(x,z,R,$,j){var I,C,D,N,F,Y,te,Re,Ge=x.indexOf("."),We=Se,Ae=be;for(Ge>=0&&(N=Et,Et=0,x=x.replace(".",""),Re=new W(z),Y=Re.pow(x.length-Ge),Et=N,Re.c=P(G(T(Y.c),Y.e,"0"),10,R,y),Re.e=Re.c.length),te=P(x,z,R,j?(I=wr,y):(I=y,wr)),D=N=te.length;te[--N]==0;te.pop());if(!te[0])return I.charAt(0);if(Ge<0?--D:(Y.c=te,Y.e=D,Y.s=$,Y=H(Y,Re,We,Ae,R),te=Y.c,F=Y.r,D=Y.e),C=D+We+1,Ge=te[C],N=R/2,F=F||C<0||te[C+1]!=null,F=Ae<4?(Ge!=null||F)&&(Ae==0||Ae==(Y.s<0?3:2)):Ge>N||Ge==N&&(Ae==4||F||Ae==6&&te[C-1]&1||Ae==(Y.s<0?8:7)),C<1||!te[0])x=F?G(I.charAt(1),-We,I.charAt(0)):I.charAt(0);else{if(te.length=C,F)for(--R;++te[--C]>R;)te[C]=0,C||(++D,te=[1].concat(te));for(N=te.length;!te[--N];);for(Ge=0,x="";Ge<=N;x+=I.charAt(te[Ge++]));x=G(x,D,I.charAt(0))}return x}})(),H=(function(){function y(z,R,$){var j,I,C,D,N=0,F=z.length,Y=R%g,te=R/g|0;for(z=z.slice();F--;)C=z[F]%g,D=z[F]/g|0,j=te*C+D*Y,I=Y*C+j%g*g+N,N=(I/$|0)+(j/g|0)+te*D,z[F]=I%$;return N&&(z=[N].concat(z)),z}o(y,"multiply");function P(z,R,$,j){var I,C;if($!=j)C=$>j?1:-1;else for(I=C=0;I<$;I++)if(z[I]!=R[I]){C=z[I]>R[I]?1:-1;break}return C}o(P,"compare");function x(z,R,$,j){for(var I=0;$--;)z[$]-=I,I=z[$]<R[$]?1:0,z[$]=I*j+z[$]-R[$];for(;!z[0]&&z.length>1;z.splice(0,1));}return o(x,"subtract"),function(z,R,$,j,I){var C,D,N,F,Y,te,Re,Ge,We,Ae,De,at,no,oo,io,jt,Fr,_t=z.s==R.s?1:-1,st=z.c,je=R.c;if(!st||!st[0]||!je||!je[0])return new W(!z.s||!R.s||(st?je&&st[0]==je[0]:!je)?NaN:st&&st[0]==0||!je?_t*0:_t/0);for(Ge=new W(_t),We=Ge.c=[],D=z.e-R.e,_t=$+D+1,I||(I=l,D=_(z.e/p)-_(R.e/p),_t=_t/p|0),N=0;je[N]==(st[N]||0);N++);if(je[N]>(st[N]||0)&&D--,_t<0)We.push(1),F=!0;else{for(oo=st.length,jt=je.length,N=0,_t+=2,Y=i(I/(je[0]+1)),Y>1&&(je=y(je,Y,I),st=y(st,Y,I),jt=je.length,oo=st.length),no=jt,Ae=st.slice(0,jt),De=Ae.length;De<jt;Ae[De++]=0);Fr=je.slice(),Fr=[0].concat(Fr),io=je[0],je[1]>=I/2&&io++;do{if(Y=0,C=P(je,Ae,jt,De),C<0){if(at=Ae[0],jt!=De&&(at=at*I+(Ae[1]||0)),Y=i(at/io),Y>1)for(Y>=I&&(Y=I-1),te=y(je,Y,I),Re=te.length,De=Ae.length;P(te,Ae,Re,De)==1;)Y--,x(te,jt<Re?Fr:je,Re,I),Re=te.length,C=1;else Y==0&&(C=Y=1),te=je.slice(),Re=te.length;if(Re<De&&(te=[0].concat(te)),x(Ae,te,De,I),De=Ae.length,C==-1)for(;P(je,Ae,jt,De)<1;)Y++,x(Ae,jt<De?Fr:je,De,I),De=Ae.length}else C===0&&(Y++,Ae=[0]);We[N++]=Y,Ae[0]?Ae[De++]=st[no]||0:(Ae=[st[no]],De=1)}while((no++<oo||Ae[0]!=null)&&_t--);F=Ae[0]!=null,We[0]||We.splice(0,1)}if(I==l){for(N=1,_t=We[0];_t>=10;_t/=10,N++);Pt(Ge,$+(Ge.e=N+D*p-1)+1,j,F)}else Ge.e=D,Ge.r=+F;return Ge}})();function Rt(y,P,x,z){var R,$,j,I,C;if(x==null?x=be:w(x,0,8),!y.c)return y.toString();if(R=y.c[0],j=y.e,P==null)C=T(y.c),C=z==1||z==2&&(j<=ke||j>=Ie)?q(C,j):G(C,j,"0");else if(y=Pt(new W(y),P,x),$=y.e,C=T(y.c),I=C.length,z==1||z==2&&(P<=$||$<=ke)){for(;I<P;C+="0",I++);C=q(C,$)}else if(P-=j+(z===2&&$>j),C=G(C,$,"0"),$+1>I){if(--P>0)for(C+=".";P--;C+="0");}else if(P+=$-I,P>0)for($+1==I&&(C+=".");P--;C+="0");return y.s<0&&R?"-"+C:C}o(Rt,"format");function St(y,P){for(var x,z,R=1,$=new W(y[0]);R<y.length;R++)z=new W(y[R]),(!z.s||(x=E($,z))===P||x===0&&$.s===P)&&($=z);return $}o(St,"maxOrMin");function ii(y,P,x){for(var z=1,R=P.length;!P[--R];P.pop());for(R=P[0];R>=10;R/=10,z++);return(x=z+x*p-1)>He?y.c=y.e=null:x<Ve?y.c=[y.e=0]:(y.e=x,y.c=P),y}o(ii,"normalise"),re=(function(){var y=/^(-?)0([xbo])(?=\w[\w.]*$)/i,P=/^([^.]+)\.$/,x=/^\.([^.]+)$/,z=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function($,j,I,C){var D,N=I?j:j.replace(R,"");if(z.test(N))$.s=isNaN(N)?null:N<0?-1:1;else{if(!I&&(N=N.replace(y,function(F,Y,te){return D=(te=te.toLowerCase())=="x"?16:te=="b"?2:8,!C||C==D?Y:F}),C&&(D=C,N=N.replace(P,"$1").replace(x,"0.$1")),j!=N))return new W(N,D);if(W.DEBUG)throw Error(u+"Not a"+(C?" base "+C:"")+" number: "+j);$.s=null}$.c=$.e=null}})();function Pt(y,P,x,z){var R,$,j,I,C,D,N,F=y.c,Y=m;if(F){e:{for(R=1,I=F[0];I>=10;I/=10,R++);if($=P-R,$<0)$+=p,j=P,C=F[D=0],N=i(C/Y[R-j-1]%10);else if(D=n(($+1)/p),D>=F.length)if(z){for(;F.length<=D;F.push(0));C=N=0,R=1,$%=p,j=$-p+1}else break e;else{for(C=I=F[D],R=1;I>=10;I/=10,R++);$%=p,j=$-p+R,N=j<0?0:i(C/Y[R-j-1]%10)}if(z=z||P<0||F[D+1]!=null||(j<0?C:C%Y[R-j-1]),z=x<4?(N||z)&&(x==0||x==(y.s<0?3:2)):N>5||N==5&&(x==4||z||x==6&&($>0?j>0?C/Y[R-j]:0:F[D-1])%10&1||x==(y.s<0?8:7)),P<1||!F[0])return F.length=0,z?(P-=y.e+1,F[0]=Y[(p-P%p)%p],y.e=-P||0):F[0]=y.e=0,y;if($==0?(F.length=D,I=1,D--):(F.length=D+1,I=Y[p-$],F[D]=j>0?i(C/Y[R-j]%Y[j])*I:0),z)for(;;)if(D==0){for($=1,j=F[0];j>=10;j/=10,$++);for(j=F[0]+=I,I=1;j>=10;j/=10,I++);$!=I&&(y.e++,F[0]==l&&(F[0]=1));break}else{if(F[D]+=I,F[D]!=l)break;F[D--]=0,I=1}for($=F.length;F[--$]===0;F.pop());}y.e>He?y.c=y.e=null:y.e<Ve&&(y.c=[y.e=0])}return y}o(Pt,"round");function it(y){var P,x=y.e;return x===null?y.toString():(P=T(y.c),P=x<=ke||x>=Ie?q(P,x):G(P,x,"0"),y.s<0?"-"+P:P)}return o(it,"valueOf"),Z.absoluteValue=Z.abs=function(){var y=new W(this);return y.s<0&&(y.s=1),y},Z.comparedTo=function(y,P){return E(this,new W(y,P))},Z.decimalPlaces=Z.dp=function(y,P){var x,z,R,$=this;if(y!=null)return w(y,0,S),P==null?P=be:w(P,0,8),Pt(new W($),y+$.e+1,P);if(!(x=$.c))return null;if(z=((R=x.length-1)-_(this.e/p))*p,R=x[R])for(;R%10==0;R/=10,z--);return z<0&&(z=0),z},Z.dividedBy=Z.div=function(y,P){return H(this,new W(y,P),Se,be)},Z.dividedToIntegerBy=Z.idiv=function(y,P){return H(this,new W(y,P),0,1)},Z.exponentiatedBy=Z.pow=function(y,P){var x,z,R,$,j,I,C,D,N,F=this;if(y=new W(y),y.c&&!y.isInteger())throw Error(u+"Exponent not an integer: "+it(y));if(P!=null&&(P=new W(P)),I=y.e>14,!F.c||!F.c[0]||F.c[0]==1&&!F.e&&F.c.length==1||!y.c||!y.c[0])return N=new W(Math.pow(+it(F),I?y.s*(2-k(y)):+it(y))),P?N.mod(P):N;if(C=y.s<0,P){if(P.c?!P.c[0]:!P.s)return new W(NaN);z=!C&&F.isInteger()&&P.isInteger(),z&&(F=F.mod(P))}else{if(y.e>9&&(F.e>0||F.e<-1||(F.e==0?F.c[0]>1||I&&F.c[1]>=24e7:F.c[0]<8e13||I&&F.c[0]<=9999975e7)))return $=F.s<0&&k(y)?-0:0,F.e>-1&&($=1/$),new W(C?1/$:$);Et&&($=n(Et/p+2))}for(I?(x=new W(.5),C&&(y.s=1),D=k(y)):(R=Math.abs(+it(y)),D=R%2),N=new W(ze);;){if(D){if(N=N.times(F),!N.c)break;$?N.c.length>$&&(N.c.length=$):z&&(N=N.mod(P))}if(R){if(R=i(R/2),R===0)break;D=R%2}else if(y=y.times(x),Pt(y,y.e+1,1),y.e>14)D=k(y);else{if(R=+it(y),R===0)break;D=R%2}F=F.times(F),$?F.c&&F.c.length>$&&(F.c.length=$):z&&(F=F.mod(P))}return z?N:(C&&(N=ze.div(N)),P?N.mod(P):$?Pt(N,Et,be,j):N)},Z.integerValue=function(y){var P=new W(this);return y==null?y=be:w(y,0,8),Pt(P,P.e+1,y)},Z.isEqualTo=Z.eq=function(y,P){return E(this,new W(y,P))===0},Z.isFinite=function(){return!!this.c},Z.isGreaterThan=Z.gt=function(y,P){return E(this,new W(y,P))>0},Z.isGreaterThanOrEqualTo=Z.gte=function(y,P){return(P=E(this,new W(y,P)))===1||P===0},Z.isInteger=function(){return!!this.c&&_(this.e/p)>this.c.length-2},Z.isLessThan=Z.lt=function(y,P){return E(this,new W(y,P))<0},Z.isLessThanOrEqualTo=Z.lte=function(y,P){return(P=E(this,new W(y,P)))===-1||P===0},Z.isNaN=function(){return!this.s},Z.isNegative=function(){return this.s<0},Z.isPositive=function(){return this.s>0},Z.isZero=function(){return!!this.c&&this.c[0]==0},Z.minus=function(y,P){var x,z,R,$,j=this,I=j.s;if(y=new W(y,P),P=y.s,!I||!P)return new W(NaN);if(I!=P)return y.s=-P,j.plus(y);var C=j.e/p,D=y.e/p,N=j.c,F=y.c;if(!C||!D){if(!N||!F)return N?(y.s=-P,y):new W(F?j:NaN);if(!N[0]||!F[0])return F[0]?(y.s=-P,y):new W(N[0]?j:be==3?-0:0)}if(C=_(C),D=_(D),N=N.slice(),I=C-D){for(($=I<0)?(I=-I,R=N):(D=C,R=F),R.reverse(),P=I;P--;R.push(0));R.reverse()}else for(z=($=(I=N.length)<(P=F.length))?I:P,I=P=0;P<z;P++)if(N[P]!=F[P]){$=N[P]<F[P];break}if($&&(R=N,N=F,F=R,y.s=-y.s),P=(z=F.length)-(x=N.length),P>0)for(;P--;N[x++]=0);for(P=l-1;z>I;){if(N[--z]<F[z]){for(x=z;x&&!N[--x];N[x]=P);--N[x],N[z]+=l}N[z]-=F[z]}for(;N[0]==0;N.splice(0,1),--D);return N[0]?ii(y,N,D):(y.s=be==3?-1:1,y.c=[y.e=0],y)},Z.modulo=Z.mod=function(y,P){var x,z,R=this;return y=new W(y,P),!R.c||!y.s||y.c&&!y.c[0]?new W(NaN):!y.c||R.c&&!R.c[0]?new W(R):(Ut==9?(z=y.s,y.s=1,x=H(R,y,0,3),y.s=z,x.s*=z):x=H(R,y,0,Ut),y=R.minus(x.times(y)),!y.c[0]&&Ut==1&&(y.s=R.s),y)},Z.multipliedBy=Z.times=function(y,P){var x,z,R,$,j,I,C,D,N,F,Y,te,Re,Ge,We,Ae=this,De=Ae.c,at=(y=new W(y,P)).c;if(!De||!at||!De[0]||!at[0])return!Ae.s||!y.s||De&&!De[0]&&!at||at&&!at[0]&&!De?y.c=y.e=y.s=null:(y.s*=Ae.s,!De||!at?y.c=y.e=null:(y.c=[0],y.e=0)),y;for(z=_(Ae.e/p)+_(y.e/p),y.s*=Ae.s,C=De.length,F=at.length,C<F&&(Re=De,De=at,at=Re,R=C,C=F,F=R),R=C+F,Re=[];R--;Re.push(0));for(Ge=l,We=g,R=F;--R>=0;){for(x=0,Y=at[R]%We,te=at[R]/We|0,j=C,$=R+j;$>R;)D=De[--j]%We,N=De[j]/We|0,I=te*D+N*Y,D=Y*D+I%We*We+Re[$]+x,x=(D/Ge|0)+(I/We|0)+te*N,Re[$--]=D%Ge;Re[$]=x}return x?++z:Re.splice(0,1),ii(y,Re,z)},Z.negated=function(){var y=new W(this);return y.s=-y.s||null,y},Z.plus=function(y,P){var x,z=this,R=z.s;if(y=new W(y,P),P=y.s,!R||!P)return new W(NaN);if(R!=P)return y.s=-P,z.minus(y);var $=z.e/p,j=y.e/p,I=z.c,C=y.c;if(!$||!j){if(!I||!C)return new W(R/0);if(!I[0]||!C[0])return C[0]?y:new W(I[0]?z:R*0)}if($=_($),j=_(j),I=I.slice(),R=$-j){for(R>0?(j=$,x=C):(R=-R,x=I),x.reverse();R--;x.push(0));x.reverse()}for(R=I.length,P=C.length,R-P<0&&(x=C,C=I,I=x,P=R),R=0;P;)R=(I[--P]=I[P]+C[P]+R)/l|0,I[P]=l===I[P]?0:I[P]%l;return R&&(I=[R].concat(I),++j),ii(y,I,j)},Z.precision=Z.sd=function(y,P){var x,z,R,$=this;if(y!=null&&y!==!!y)return w(y,1,S),P==null?P=be:w(P,0,8),Pt(new W($),y,P);if(!(x=$.c))return null;if(R=x.length-1,z=R*p+1,R=x[R]){for(;R%10==0;R/=10,z--);for(R=x[0];R>=10;R/=10,z++);}return y&&$.e+1>z&&(z=$.e+1),z},Z.shiftedBy=function(y){return w(y,-f,f),this.times("1e"+y)},Z.squareRoot=Z.sqrt=function(){var y,P,x,z,R,$=this,j=$.c,I=$.s,C=$.e,D=Se+4,N=new W("0.5");if(I!==1||!j||!j[0])return new W(!I||I<0&&(!j||j[0])?NaN:j?$:1/0);if(I=Math.sqrt(+it($)),I==0||I==1/0?(P=T(j),(P.length+C)%2==0&&(P+="0"),I=Math.sqrt(+P),C=_((C+1)/2)-(C<0||C%2),I==1/0?P="5e"+C:(P=I.toExponential(),P=P.slice(0,P.indexOf("e")+1)+C),x=new W(P)):x=new W(I+""),x.c[0]){for(C=x.e,I=C+D,I<3&&(I=0);;)if(R=x,x=N.times(R.plus(H($,R,D,1))),T(R.c).slice(0,I)===(P=T(x.c)).slice(0,I))if(x.e<C&&--I,P=P.slice(I-3,I+1),P=="9999"||!z&&P=="4999"){if(!z&&(Pt(R,R.e+Se+2,0),R.times(R).eq($))){x=R;break}D+=4,I+=4,z=1}else{(!+P||!+P.slice(1)&&P.charAt(0)=="5")&&(Pt(x,x.e+Se+2,1),y=!x.times(x).eq($));break}}return Pt(x,x.e+Se+1,be,y)},Z.toExponential=function(y,P){return y!=null&&(w(y,0,S),y++),Rt(this,y,P,1)},Z.toFixed=function(y,P){return y!=null&&(w(y,0,S),y=y+this.e+1),Rt(this,y,P)},Z.toFormat=function(y,P,x){var z,R=this;if(x==null)y!=null&&P&&typeof P=="object"?(x=P,P=null):y&&typeof y=="object"?(x=y,y=P=null):x=ro;else if(typeof x!="object")throw Error(u+"Argument not an object: "+x);if(z=R.toFixed(y,P),R.c){var $,j=z.split("."),I=+x.groupSize,C=+x.secondaryGroupSize,D=x.groupSeparator||"",N=j[0],F=j[1],Y=R.s<0,te=Y?N.slice(1):N,Re=te.length;if(C&&($=I,I=C,C=$,Re-=$),I>0&&Re>0){for($=Re%I||I,N=te.substr(0,$);$<Re;$+=I)N+=D+te.substr($,I);C>0&&(N+=D+te.slice($)),Y&&(N="-"+N)}z=F?N+(x.decimalSeparator||"")+((C=+x.fractionGroupSize)?F.replace(new RegExp("\\d{"+C+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):F):N}return(x.prefix||"")+z+(x.suffix||"")},Z.toFraction=function(y){var P,x,z,R,$,j,I,C,D,N,F,Y,te=this,Re=te.c;if(y!=null&&(I=new W(y),!I.isInteger()&&(I.c||I.s!==1)||I.lt(ze)))throw Error(u+"Argument "+(I.isInteger()?"out of range: ":"not an integer: ")+it(I));if(!Re)return new W(te);for(P=new W(ze),D=x=new W(ze),z=C=new W(ze),Y=T(Re),$=P.e=Y.length-te.e-1,P.c[0]=m[(j=$%p)<0?p+j:j],y=!y||I.comparedTo(P)>0?$>0?P:D:I,j=He,He=1/0,I=new W(Y),C.c[0]=0;N=H(I,P,0,1),R=x.plus(N.times(z)),R.comparedTo(y)!=1;)x=z,z=R,D=C.plus(N.times(R=D)),C=R,P=I.minus(N.times(R=P)),I=R;return R=H(y.minus(x),z,0,1),C=C.plus(R.times(D)),x=x.plus(R.times(z)),C.s=D.s=te.s,$=$*2,F=H(D,z,$,be).minus(te).abs().comparedTo(H(C,x,$,be).minus(te).abs())<1?[D,z]:[C,x],He=j,F},Z.toNumber=function(){return+it(this)},Z.toPrecision=function(y,P){return y!=null&&w(y,1,S),Rt(this,y,P,2)},Z.toString=function(y){var P,x=this,z=x.s,R=x.e;return R===null?z?(P="Infinity",z<0&&(P="-"+P)):P="NaN":(y==null?P=R<=ke||R>=Ie?q(T(x.c),R):G(T(x.c),R,"0"):y===10&&oi?(x=Pt(new W(x),Se+R+1,be),P=G(T(x.c),x.e,"0")):(w(y,2,wr.length,"Base"),P=J(G(T(x.c),R,"0"),10,y,z,!0)),z<0&&x.c[0]&&(P="-"+P)),P},Z.valueOf=Z.toJSON=function(){return it(this)},Z._isBigNumber=!0,V!=null&&W.set(V),W}o(h,"clone");function _(V){var H=V|0;return V>0||V===H?H:H-1}o(_,"bitFloor");function T(V){for(var H,J,re=1,Z=V.length,ze=V[0]+"";re<Z;){for(H=V[re++]+"",J=p-H.length;J--;H="0"+H);ze+=H}for(Z=ze.length;ze.charCodeAt(--Z)===48;);return ze.slice(0,Z+1||1)}o(T,"coeffToString");function E(V,H){var J,re,Z=V.c,ze=H.c,Se=V.s,be=H.s,ke=V.e,Ie=H.e;if(!Se||!be)return null;if(J=Z&&!Z[0],re=ze&&!ze[0],J||re)return J?re?0:-be:Se;if(Se!=be)return Se;if(J=Se<0,re=ke==Ie,!Z||!ze)return re?0:!Z^J?1:-1;if(!re)return ke>Ie^J?1:-1;for(be=(ke=Z.length)<(Ie=ze.length)?ke:Ie,Se=0;Se<be;Se++)if(Z[Se]!=ze[Se])return Z[Se]>ze[Se]^J?1:-1;return ke==Ie?0:ke>Ie^J?1:-1}o(E,"compare");function w(V,H,J,re){if(V<H||V>J||V!==i(V))throw Error(u+(re||"Argument")+(typeof V=="number"?V<H||V>J?" out of range: ":" not an integer: ":" not a primitive number: ")+String(V))}o(w,"intCheck");function k(V){var H=V.c.length-1;return _(V.e/p)==H&&V.c[H]%2!=0}o(k,"isOdd");function q(V,H){return(V.length>1?V.charAt(0)+"."+V.slice(1):V)+(H<0?"e":"e+")+H}o(q,"toExponential");function G(V,H,J){var re,Z;if(H<0){for(Z=J+".";++H;Z+=J);V=Z+V}else if(re=V.length,++H>re){for(Z=J,H-=re;--H;Z+=J);V+=Z}else H<re&&(V=V.slice(0,H)+"."+V.slice(H));return V}o(G,"toFixedPoint"),e=h(),e.default=e.BigNumber=e,typeof define=="function"&&define.amd?define(function(){return e}):typeof Gs<"u"&&Gs.exports?Gs.exports=e:(t||(t=typeof self<"u"&&self?self:window),t.BigNumber=e)})(sv)});var dv=M((iJ,lv)=>{var uv=Ql(),cv=lv.exports;(function(){"use strict";function t(f){return f<10?"0"+f:f}o(t,"f");var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n,i,u={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},c;function l(f){return r.lastIndex=0,r.test(f)?'"'+f.replace(r,function(m){var g=u[m];return typeof g=="string"?g:"\\u"+("0000"+m.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+f+'"'}o(l,"quote");function p(f,m){var g,S,h,_,T=n,E,w=m[f],k=w!=null&&(w instanceof uv||uv.isBigNumber(w));switch(w&&typeof w=="object"&&typeof w.toJSON=="function"&&(w=w.toJSON(f)),typeof c=="function"&&(w=c.call(m,f,w)),typeof w){case"string":return k?w:l(w);case"number":return isFinite(w)?String(w):"null";case"boolean":case"null":case"bigint":return String(w);case"object":if(!w)return"null";if(n+=i,E=[],Object.prototype.toString.apply(w)==="[object Array]"){for(_=w.length,g=0;g<_;g+=1)E[g]=p(g,w)||"null";return h=E.length===0?"[]":n?`[
31
+ `}yield n}static#i;static#a;static async#s(){return this.#i||=(await Promise.resolve().then(()=>yt(gb()))).HttpsProxyAgent,this.#i}static async#u(){let e=typeof window<"u"&&!!window;return this.#a||=e?window.fetch:(await Promise.resolve().then(()=>(lv(),cv))).default,this.#a}static mergeHeaders(e,...r){e=e instanceof Headers?e:new Headers(e);for(let n of r)(n instanceof Headers?n:new Headers(n)).forEach((u,c)=>{c==="set-cookie"?e.append(c,u):e.set(c,u)});return e}};Mo.Gaxios=Gs;jo=Gs});var _t=L(It=>{"use strict";var jC=It&&It.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),MC=It&&It.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jC(e,t,r)};Object.defineProperty(It,"__esModule",{value:!0});It.instance=It.Gaxios=It.GaxiosError=void 0;It.request=FC;var mv=fv();Object.defineProperty(It,"Gaxios",{enumerable:!0,get:o(function(){return mv.Gaxios},"get")});var LC=Rl();Object.defineProperty(It,"GaxiosError",{enumerable:!0,get:o(function(){return LC.GaxiosError},"get")});MC(kl(),It);It.instance=new mv.Gaxios;async function FC(t){return It.instance.request(t)}o(FC,"request")});var ed=L((hv,Ws)=>{(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,u="[BigNumber Error] ",c=u+"Number primitive has more than 15 significant digits: ",l=1e14,p=14,f=9007199254740991,m=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,P=1e9;function h(H){var V,J,re,G=Z.prototype={constructor:Z,toString:null,valueOf:null},je=new Z(1),Ee=20,ve=4,ze=-7,$e=21,Ue=-1e7,He=1e7,Ke=!1,Ut=1,Pt=0,ro={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},wr="0123456789abcdefghijklmnopqrstuvwxyz",ii=!0;function Z(_,S){var x,N,R,$,j,I,O,D,z=this;if(!(z instanceof Z))return new Z(_,S);if(S==null){if(_&&_._isBigNumber===!0){z.s=_.s,!_.c||_.e>He?z.c=z.e=null:_.e<Ue?z.c=[z.e=0]:(z.e=_.e,z.c=_.c.slice());return}if((I=typeof _=="number")&&_*0==0){if(z.s=1/_<0?(_=-_,-1):1,_===~~_){for($=0,j=_;j>=10;j/=10,$++);$>He?z.c=z.e=null:(z.e=$,z.c=[_]);return}D=String(_)}else{if(!r.test(D=String(_)))return re(z,D,I);z.s=D.charCodeAt(0)==45?(D=D.slice(1),-1):1}($=D.indexOf("."))>-1&&(D=D.replace(".","")),(j=D.search(/e/i))>0?($<0&&($=j),$+=+D.slice(j+1),D=D.substring(0,j)):$<0&&($=D.length)}else{if(w(S,2,wr.length,"Base"),S==10&&ii)return z=new Z(_),Tt(z,Ee+z.e+1,ve);if(D=String(_),I=typeof _=="number"){if(_*0!=0)return re(z,D,I,S);if(z.s=1/_<0?(D=D.slice(1),-1):1,Z.DEBUG&&D.replace(/^0\.0*|\./,"").length>15)throw Error(c+_)}else z.s=D.charCodeAt(0)===45?(D=D.slice(1),-1):1;for(x=wr.slice(0,S),$=j=0,O=D.length;j<O;j++)if(x.indexOf(N=D.charAt(j))<0){if(N=="."){if(j>$){$=O;continue}}else if(!R&&(D==D.toUpperCase()&&(D=D.toLowerCase())||D==D.toLowerCase()&&(D=D.toUpperCase()))){R=!0,j=-1,$=0;continue}return re(z,String(_),I,S)}I=!1,D=J(D,S,10,z.s),($=D.indexOf("."))>-1?D=D.replace(".",""):$=D.length}for(j=0;D.charCodeAt(j)===48;j++);for(O=D.length;D.charCodeAt(--O)===48;);if(D=D.slice(j,++O)){if(O-=j,I&&Z.DEBUG&&O>15&&(_>f||_!==i(_)))throw Error(c+z.s*_);if(($=$-j-1)>He)z.c=z.e=null;else if($<Ue)z.c=[z.e=0];else{if(z.e=$,z.c=[],j=($+1)%p,$<0&&(j+=p),j<O){for(j&&z.c.push(+D.slice(0,j)),O-=p;j<O;)z.c.push(+D.slice(j,j+=p));j=p-(D=D.slice(j)).length}else j-=O;for(;j--;D+="0");z.c.push(+D)}}else z.c=[z.e=0]}o(Z,"BigNumber"),Z.clone=h,Z.ROUND_UP=0,Z.ROUND_DOWN=1,Z.ROUND_CEIL=2,Z.ROUND_FLOOR=3,Z.ROUND_HALF_UP=4,Z.ROUND_HALF_DOWN=5,Z.ROUND_HALF_EVEN=6,Z.ROUND_HALF_CEIL=7,Z.ROUND_HALF_FLOOR=8,Z.EUCLID=9,Z.config=Z.set=function(_){var S,x;if(_!=null)if(typeof _=="object"){if(_.hasOwnProperty(S="DECIMAL_PLACES")&&(x=_[S],w(x,0,P,S),Ee=x),_.hasOwnProperty(S="ROUNDING_MODE")&&(x=_[S],w(x,0,8,S),ve=x),_.hasOwnProperty(S="EXPONENTIAL_AT")&&(x=_[S],x&&x.pop?(w(x[0],-P,0,S),w(x[1],0,P,S),ze=x[0],$e=x[1]):(w(x,-P,P,S),ze=-($e=x<0?-x:x))),_.hasOwnProperty(S="RANGE"))if(x=_[S],x&&x.pop)w(x[0],-P,-1,S),w(x[1],1,P,S),Ue=x[0],He=x[1];else if(w(x,-P,P,S),x)Ue=-(He=x<0?-x:x);else throw Error(u+S+" cannot be zero: "+x);if(_.hasOwnProperty(S="CRYPTO"))if(x=_[S],x===!!x)if(x)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))Ke=x;else throw Ke=!x,Error(u+"crypto unavailable");else Ke=x;else throw Error(u+S+" not true or false: "+x);if(_.hasOwnProperty(S="MODULO_MODE")&&(x=_[S],w(x,0,9,S),Ut=x),_.hasOwnProperty(S="POW_PRECISION")&&(x=_[S],w(x,0,P,S),Pt=x),_.hasOwnProperty(S="FORMAT"))if(x=_[S],typeof x=="object")ro=x;else throw Error(u+S+" not an object: "+x);if(_.hasOwnProperty(S="ALPHABET"))if(x=_[S],typeof x=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(x))ii=x.slice(0,10)=="0123456789",wr=x;else throw Error(u+S+" invalid: "+x)}else throw Error(u+"Object expected: "+_);return{DECIMAL_PLACES:Ee,ROUNDING_MODE:ve,EXPONENTIAL_AT:[ze,$e],RANGE:[Ue,He],CRYPTO:Ke,MODULO_MODE:Ut,POW_PRECISION:Pt,FORMAT:ro,ALPHABET:wr}},Z.isBigNumber=function(_){if(!_||_._isBigNumber!==!0)return!1;if(!Z.DEBUG)return!0;var S,x,N=_.c,R=_.e,$=_.s;e:if({}.toString.call(N)=="[object Array]"){if(($===1||$===-1)&&R>=-P&&R<=P&&R===i(R)){if(N[0]===0){if(R===0&&N.length===1)return!0;break e}if(S=(R+1)%p,S<1&&(S+=p),String(N[0]).length==S){for(S=0;S<N.length;S++)if(x=N[S],x<0||x>=l||x!==i(x))break e;if(x!==0)return!0}}}else if(N===null&&R===null&&($===null||$===1||$===-1))return!0;throw Error(u+"Invalid BigNumber: "+_)},Z.maximum=Z.max=function(){return St(arguments,-1)},Z.minimum=Z.min=function(){return St(arguments,1)},Z.random=(function(){var _=9007199254740992,S=Math.random()*_&2097151?function(){return i(Math.random()*_)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(x){var N,R,$,j,I,O=0,D=[],z=new Z(je);if(x==null?x=Ee:w(x,0,P),j=n(x/p),Ke)if(crypto.getRandomValues){for(N=crypto.getRandomValues(new Uint32Array(j*=2));O<j;)I=N[O]*131072+(N[O+1]>>>11),I>=9e15?(R=crypto.getRandomValues(new Uint32Array(2)),N[O]=R[0],N[O+1]=R[1]):(D.push(I%1e14),O+=2);O=j/2}else if(crypto.randomBytes){for(N=crypto.randomBytes(j*=7);O<j;)I=(N[O]&31)*281474976710656+N[O+1]*1099511627776+N[O+2]*4294967296+N[O+3]*16777216+(N[O+4]<<16)+(N[O+5]<<8)+N[O+6],I>=9e15?crypto.randomBytes(7).copy(N,O):(D.push(I%1e14),O+=7);O=j/7}else throw Ke=!1,Error(u+"crypto unavailable");if(!Ke)for(;O<j;)I=S(),I<9e15&&(D[O++]=I%1e14);for(j=D[--O],x%=p,j&&x&&(I=m[p-x],D[O]=i(j/I)*I);D[O]===0;D.pop(),O--);if(O<0)D=[$=0];else{for($=-1;D[0]===0;D.splice(0,1),$-=p);for(O=1,I=D[0];I>=10;I/=10,O++);O<p&&($-=p-O)}return z.e=$,z.c=D,z}})(),Z.sum=function(){for(var _=1,S=arguments,x=new Z(S[0]);_<S.length;)x=x.plus(S[_++]);return x},J=(function(){var _="0123456789";function S(x,N,R,$){for(var j,I=[0],O,D=0,z=x.length;D<z;){for(O=I.length;O--;I[O]*=N);for(I[0]+=$.indexOf(x.charAt(D++)),j=0;j<I.length;j++)I[j]>R-1&&(I[j+1]==null&&(I[j+1]=0),I[j+1]+=I[j]/R|0,I[j]%=R)}return I.reverse()}return o(S,"toBaseOut"),function(x,N,R,$,j){var I,O,D,z,B,Y,te,Re,Ge=x.indexOf("."),We=Ee,Ie=ve;for(Ge>=0&&(z=Pt,Pt=0,x=x.replace(".",""),Re=new Z(N),Y=Re.pow(x.length-Ge),Pt=z,Re.c=S(W(T(Y.c),Y.e,"0"),10,R,_),Re.e=Re.c.length),te=S(x,N,R,j?(I=wr,_):(I=_,wr)),D=z=te.length;te[--z]==0;te.pop());if(!te[0])return I.charAt(0);if(Ge<0?--D:(Y.c=te,Y.e=D,Y.s=$,Y=V(Y,Re,We,Ie,R),te=Y.c,B=Y.r,D=Y.e),O=D+We+1,Ge=te[O],z=R/2,B=B||O<0||te[O+1]!=null,B=Ie<4?(Ge!=null||B)&&(Ie==0||Ie==(Y.s<0?3:2)):Ge>z||Ge==z&&(Ie==4||B||Ie==6&&te[O-1]&1||Ie==(Y.s<0?8:7)),O<1||!te[0])x=B?W(I.charAt(1),-We,I.charAt(0)):I.charAt(0);else{if(te.length=O,B)for(--R;++te[--O]>R;)te[O]=0,O||(++D,te=[1].concat(te));for(z=te.length;!te[--z];);for(Ge=0,x="";Ge<=z;x+=I.charAt(te[Ge++]));x=W(x,D,I.charAt(0))}return x}})(),V=(function(){function _(N,R,$){var j,I,O,D,z=0,B=N.length,Y=R%y,te=R/y|0;for(N=N.slice();B--;)O=N[B]%y,D=N[B]/y|0,j=te*O+D*Y,I=Y*O+j%y*y+z,z=(I/$|0)+(j/y|0)+te*D,N[B]=I%$;return z&&(N=[z].concat(N)),N}o(_,"multiply");function S(N,R,$,j){var I,O;if($!=j)O=$>j?1:-1;else for(I=O=0;I<$;I++)if(N[I]!=R[I]){O=N[I]>R[I]?1:-1;break}return O}o(S,"compare");function x(N,R,$,j){for(var I=0;$--;)N[$]-=I,I=N[$]<R[$]?1:0,N[$]=I*j+N[$]-R[$];for(;!N[0]&&N.length>1;N.splice(0,1));}return o(x,"subtract"),function(N,R,$,j,I){var O,D,z,B,Y,te,Re,Ge,We,Ie,De,st,no,oo,io,jt,Fr,bt=N.s==R.s?1:-1,ut=N.c,Me=R.c;if(!ut||!ut[0]||!Me||!Me[0])return new Z(!N.s||!R.s||(ut?Me&&ut[0]==Me[0]:!Me)?NaN:ut&&ut[0]==0||!Me?bt*0:bt/0);for(Ge=new Z(bt),We=Ge.c=[],D=N.e-R.e,bt=$+D+1,I||(I=l,D=b(N.e/p)-b(R.e/p),bt=bt/p|0),z=0;Me[z]==(ut[z]||0);z++);if(Me[z]>(ut[z]||0)&&D--,bt<0)We.push(1),B=!0;else{for(oo=ut.length,jt=Me.length,z=0,bt+=2,Y=i(I/(Me[0]+1)),Y>1&&(Me=_(Me,Y,I),ut=_(ut,Y,I),jt=Me.length,oo=ut.length),no=jt,Ie=ut.slice(0,jt),De=Ie.length;De<jt;Ie[De++]=0);Fr=Me.slice(),Fr=[0].concat(Fr),io=Me[0],Me[1]>=I/2&&io++;do{if(Y=0,O=S(Me,Ie,jt,De),O<0){if(st=Ie[0],jt!=De&&(st=st*I+(Ie[1]||0)),Y=i(st/io),Y>1)for(Y>=I&&(Y=I-1),te=_(Me,Y,I),Re=te.length,De=Ie.length;S(te,Ie,Re,De)==1;)Y--,x(te,jt<Re?Fr:Me,Re,I),Re=te.length,O=1;else Y==0&&(O=Y=1),te=Me.slice(),Re=te.length;if(Re<De&&(te=[0].concat(te)),x(Ie,te,De,I),De=Ie.length,O==-1)for(;S(Me,Ie,jt,De)<1;)Y++,x(Ie,jt<De?Fr:Me,De,I),De=Ie.length}else O===0&&(Y++,Ie=[0]);We[z++]=Y,Ie[0]?Ie[De++]=ut[no]||0:(Ie=[ut[no]],De=1)}while((no++<oo||Ie[0]!=null)&&bt--);B=Ie[0]!=null,We[0]||We.splice(0,1)}if(I==l){for(z=1,bt=We[0];bt>=10;bt/=10,z++);Tt(Ge,$+(Ge.e=z+D*p-1)+1,j,B)}else Ge.e=D,Ge.r=+B;return Ge}})();function Rt(_,S,x,N){var R,$,j,I,O;if(x==null?x=ve:w(x,0,8),!_.c)return _.toString();if(R=_.c[0],j=_.e,S==null)O=T(_.c),O=N==1||N==2&&(j<=ze||j>=$e)?q(O,j):W(O,j,"0");else if(_=Tt(new Z(_),S,x),$=_.e,O=T(_.c),I=O.length,N==1||N==2&&(S<=$||$<=ze)){for(;I<S;O+="0",I++);O=q(O,$)}else if(S-=j+(N===2&&$>j),O=W(O,$,"0"),$+1>I){if(--S>0)for(O+=".";S--;O+="0");}else if(S+=$-I,S>0)for($+1==I&&(O+=".");S--;O+="0");return _.s<0&&R?"-"+O:O}o(Rt,"format");function St(_,S){for(var x,N,R=1,$=new Z(_[0]);R<_.length;R++)N=new Z(_[R]),(!N.s||(x=E($,N))===S||x===0&&$.s===S)&&($=N);return $}o(St,"maxOrMin");function ai(_,S,x){for(var N=1,R=S.length;!S[--R];S.pop());for(R=S[0];R>=10;R/=10,N++);return(x=N+x*p-1)>He?_.c=_.e=null:x<Ue?_.c=[_.e=0]:(_.e=x,_.c=S),_}o(ai,"normalise"),re=(function(){var _=/^(-?)0([xbo])(?=\w[\w.]*$)/i,S=/^([^.]+)\.$/,x=/^\.([^.]+)$/,N=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function($,j,I,O){var D,z=I?j:j.replace(R,"");if(N.test(z))$.s=isNaN(z)?null:z<0?-1:1;else{if(!I&&(z=z.replace(_,function(B,Y,te){return D=(te=te.toLowerCase())=="x"?16:te=="b"?2:8,!O||O==D?Y:B}),O&&(D=O,z=z.replace(S,"$1").replace(x,"0.$1")),j!=z))return new Z(z,D);if(Z.DEBUG)throw Error(u+"Not a"+(O?" base "+O:"")+" number: "+j);$.s=null}$.c=$.e=null}})();function Tt(_,S,x,N){var R,$,j,I,O,D,z,B=_.c,Y=m;if(B){e:{for(R=1,I=B[0];I>=10;I/=10,R++);if($=S-R,$<0)$+=p,j=S,O=B[D=0],z=i(O/Y[R-j-1]%10);else if(D=n(($+1)/p),D>=B.length)if(N){for(;B.length<=D;B.push(0));O=z=0,R=1,$%=p,j=$-p+1}else break e;else{for(O=I=B[D],R=1;I>=10;I/=10,R++);$%=p,j=$-p+R,z=j<0?0:i(O/Y[R-j-1]%10)}if(N=N||S<0||B[D+1]!=null||(j<0?O:O%Y[R-j-1]),N=x<4?(z||N)&&(x==0||x==(_.s<0?3:2)):z>5||z==5&&(x==4||N||x==6&&($>0?j>0?O/Y[R-j]:0:B[D-1])%10&1||x==(_.s<0?8:7)),S<1||!B[0])return B.length=0,N?(S-=_.e+1,B[0]=Y[(p-S%p)%p],_.e=-S||0):B[0]=_.e=0,_;if($==0?(B.length=D,I=1,D--):(B.length=D+1,I=Y[p-$],B[D]=j>0?i(O/Y[R-j]%Y[j])*I:0),N)for(;;)if(D==0){for($=1,j=B[0];j>=10;j/=10,$++);for(j=B[0]+=I,I=1;j>=10;j/=10,I++);$!=I&&(_.e++,B[0]==l&&(B[0]=1));break}else{if(B[D]+=I,B[D]!=l)break;B[D--]=0,I=1}for($=B.length;B[--$]===0;B.pop());}_.e>He?_.c=_.e=null:_.e<Ue&&(_.c=[_.e=0])}return _}o(Tt,"round");function at(_){var S,x=_.e;return x===null?_.toString():(S=T(_.c),S=x<=ze||x>=$e?q(S,x):W(S,x,"0"),_.s<0?"-"+S:S)}return o(at,"valueOf"),G.absoluteValue=G.abs=function(){var _=new Z(this);return _.s<0&&(_.s=1),_},G.comparedTo=function(_,S){return E(this,new Z(_,S))},G.decimalPlaces=G.dp=function(_,S){var x,N,R,$=this;if(_!=null)return w(_,0,P),S==null?S=ve:w(S,0,8),Tt(new Z($),_+$.e+1,S);if(!(x=$.c))return null;if(N=((R=x.length-1)-b(this.e/p))*p,R=x[R])for(;R%10==0;R/=10,N--);return N<0&&(N=0),N},G.dividedBy=G.div=function(_,S){return V(this,new Z(_,S),Ee,ve)},G.dividedToIntegerBy=G.idiv=function(_,S){return V(this,new Z(_,S),0,1)},G.exponentiatedBy=G.pow=function(_,S){var x,N,R,$,j,I,O,D,z,B=this;if(_=new Z(_),_.c&&!_.isInteger())throw Error(u+"Exponent not an integer: "+at(_));if(S!=null&&(S=new Z(S)),I=_.e>14,!B.c||!B.c[0]||B.c[0]==1&&!B.e&&B.c.length==1||!_.c||!_.c[0])return z=new Z(Math.pow(+at(B),I?_.s*(2-k(_)):+at(_))),S?z.mod(S):z;if(O=_.s<0,S){if(S.c?!S.c[0]:!S.s)return new Z(NaN);N=!O&&B.isInteger()&&S.isInteger(),N&&(B=B.mod(S))}else{if(_.e>9&&(B.e>0||B.e<-1||(B.e==0?B.c[0]>1||I&&B.c[1]>=24e7:B.c[0]<8e13||I&&B.c[0]<=9999975e7)))return $=B.s<0&&k(_)?-0:0,B.e>-1&&($=1/$),new Z(O?1/$:$);Pt&&($=n(Pt/p+2))}for(I?(x=new Z(.5),O&&(_.s=1),D=k(_)):(R=Math.abs(+at(_)),D=R%2),z=new Z(je);;){if(D){if(z=z.times(B),!z.c)break;$?z.c.length>$&&(z.c.length=$):N&&(z=z.mod(S))}if(R){if(R=i(R/2),R===0)break;D=R%2}else if(_=_.times(x),Tt(_,_.e+1,1),_.e>14)D=k(_);else{if(R=+at(_),R===0)break;D=R%2}B=B.times(B),$?B.c&&B.c.length>$&&(B.c.length=$):N&&(B=B.mod(S))}return N?z:(O&&(z=je.div(z)),S?z.mod(S):$?Tt(z,Pt,ve,j):z)},G.integerValue=function(_){var S=new Z(this);return _==null?_=ve:w(_,0,8),Tt(S,S.e+1,_)},G.isEqualTo=G.eq=function(_,S){return E(this,new Z(_,S))===0},G.isFinite=function(){return!!this.c},G.isGreaterThan=G.gt=function(_,S){return E(this,new Z(_,S))>0},G.isGreaterThanOrEqualTo=G.gte=function(_,S){return(S=E(this,new Z(_,S)))===1||S===0},G.isInteger=function(){return!!this.c&&b(this.e/p)>this.c.length-2},G.isLessThan=G.lt=function(_,S){return E(this,new Z(_,S))<0},G.isLessThanOrEqualTo=G.lte=function(_,S){return(S=E(this,new Z(_,S)))===-1||S===0},G.isNaN=function(){return!this.s},G.isNegative=function(){return this.s<0},G.isPositive=function(){return this.s>0},G.isZero=function(){return!!this.c&&this.c[0]==0},G.minus=function(_,S){var x,N,R,$,j=this,I=j.s;if(_=new Z(_,S),S=_.s,!I||!S)return new Z(NaN);if(I!=S)return _.s=-S,j.plus(_);var O=j.e/p,D=_.e/p,z=j.c,B=_.c;if(!O||!D){if(!z||!B)return z?(_.s=-S,_):new Z(B?j:NaN);if(!z[0]||!B[0])return B[0]?(_.s=-S,_):new Z(z[0]?j:ve==3?-0:0)}if(O=b(O),D=b(D),z=z.slice(),I=O-D){for(($=I<0)?(I=-I,R=z):(D=O,R=B),R.reverse(),S=I;S--;R.push(0));R.reverse()}else for(N=($=(I=z.length)<(S=B.length))?I:S,I=S=0;S<N;S++)if(z[S]!=B[S]){$=z[S]<B[S];break}if($&&(R=z,z=B,B=R,_.s=-_.s),S=(N=B.length)-(x=z.length),S>0)for(;S--;z[x++]=0);for(S=l-1;N>I;){if(z[--N]<B[N]){for(x=N;x&&!z[--x];z[x]=S);--z[x],z[N]+=l}z[N]-=B[N]}for(;z[0]==0;z.splice(0,1),--D);return z[0]?ai(_,z,D):(_.s=ve==3?-1:1,_.c=[_.e=0],_)},G.modulo=G.mod=function(_,S){var x,N,R=this;return _=new Z(_,S),!R.c||!_.s||_.c&&!_.c[0]?new Z(NaN):!_.c||R.c&&!R.c[0]?new Z(R):(Ut==9?(N=_.s,_.s=1,x=V(R,_,0,3),_.s=N,x.s*=N):x=V(R,_,0,Ut),_=R.minus(x.times(_)),!_.c[0]&&Ut==1&&(_.s=R.s),_)},G.multipliedBy=G.times=function(_,S){var x,N,R,$,j,I,O,D,z,B,Y,te,Re,Ge,We,Ie=this,De=Ie.c,st=(_=new Z(_,S)).c;if(!De||!st||!De[0]||!st[0])return!Ie.s||!_.s||De&&!De[0]&&!st||st&&!st[0]&&!De?_.c=_.e=_.s=null:(_.s*=Ie.s,!De||!st?_.c=_.e=null:(_.c=[0],_.e=0)),_;for(N=b(Ie.e/p)+b(_.e/p),_.s*=Ie.s,O=De.length,B=st.length,O<B&&(Re=De,De=st,st=Re,R=O,O=B,B=R),R=O+B,Re=[];R--;Re.push(0));for(Ge=l,We=y,R=B;--R>=0;){for(x=0,Y=st[R]%We,te=st[R]/We|0,j=O,$=R+j;$>R;)D=De[--j]%We,z=De[j]/We|0,I=te*D+z*Y,D=Y*D+I%We*We+Re[$]+x,x=(D/Ge|0)+(I/We|0)+te*z,Re[$--]=D%Ge;Re[$]=x}return x?++N:Re.splice(0,1),ai(_,Re,N)},G.negated=function(){var _=new Z(this);return _.s=-_.s||null,_},G.plus=function(_,S){var x,N=this,R=N.s;if(_=new Z(_,S),S=_.s,!R||!S)return new Z(NaN);if(R!=S)return _.s=-S,N.minus(_);var $=N.e/p,j=_.e/p,I=N.c,O=_.c;if(!$||!j){if(!I||!O)return new Z(R/0);if(!I[0]||!O[0])return O[0]?_:new Z(I[0]?N:R*0)}if($=b($),j=b(j),I=I.slice(),R=$-j){for(R>0?(j=$,x=O):(R=-R,x=I),x.reverse();R--;x.push(0));x.reverse()}for(R=I.length,S=O.length,R-S<0&&(x=O,O=I,I=x,S=R),R=0;S;)R=(I[--S]=I[S]+O[S]+R)/l|0,I[S]=l===I[S]?0:I[S]%l;return R&&(I=[R].concat(I),++j),ai(_,I,j)},G.precision=G.sd=function(_,S){var x,N,R,$=this;if(_!=null&&_!==!!_)return w(_,1,P),S==null?S=ve:w(S,0,8),Tt(new Z($),_,S);if(!(x=$.c))return null;if(R=x.length-1,N=R*p+1,R=x[R]){for(;R%10==0;R/=10,N--);for(R=x[0];R>=10;R/=10,N++);}return _&&$.e+1>N&&(N=$.e+1),N},G.shiftedBy=function(_){return w(_,-f,f),this.times("1e"+_)},G.squareRoot=G.sqrt=function(){var _,S,x,N,R,$=this,j=$.c,I=$.s,O=$.e,D=Ee+4,z=new Z("0.5");if(I!==1||!j||!j[0])return new Z(!I||I<0&&(!j||j[0])?NaN:j?$:1/0);if(I=Math.sqrt(+at($)),I==0||I==1/0?(S=T(j),(S.length+O)%2==0&&(S+="0"),I=Math.sqrt(+S),O=b((O+1)/2)-(O<0||O%2),I==1/0?S="5e"+O:(S=I.toExponential(),S=S.slice(0,S.indexOf("e")+1)+O),x=new Z(S)):x=new Z(I+""),x.c[0]){for(O=x.e,I=O+D,I<3&&(I=0);;)if(R=x,x=z.times(R.plus(V($,R,D,1))),T(R.c).slice(0,I)===(S=T(x.c)).slice(0,I))if(x.e<O&&--I,S=S.slice(I-3,I+1),S=="9999"||!N&&S=="4999"){if(!N&&(Tt(R,R.e+Ee+2,0),R.times(R).eq($))){x=R;break}D+=4,I+=4,N=1}else{(!+S||!+S.slice(1)&&S.charAt(0)=="5")&&(Tt(x,x.e+Ee+2,1),_=!x.times(x).eq($));break}}return Tt(x,x.e+Ee+1,ve,_)},G.toExponential=function(_,S){return _!=null&&(w(_,0,P),_++),Rt(this,_,S,1)},G.toFixed=function(_,S){return _!=null&&(w(_,0,P),_=_+this.e+1),Rt(this,_,S)},G.toFormat=function(_,S,x){var N,R=this;if(x==null)_!=null&&S&&typeof S=="object"?(x=S,S=null):_&&typeof _=="object"?(x=_,_=S=null):x=ro;else if(typeof x!="object")throw Error(u+"Argument not an object: "+x);if(N=R.toFixed(_,S),R.c){var $,j=N.split("."),I=+x.groupSize,O=+x.secondaryGroupSize,D=x.groupSeparator||"",z=j[0],B=j[1],Y=R.s<0,te=Y?z.slice(1):z,Re=te.length;if(O&&($=I,I=O,O=$,Re-=$),I>0&&Re>0){for($=Re%I||I,z=te.substr(0,$);$<Re;$+=I)z+=D+te.substr($,I);O>0&&(z+=D+te.slice($)),Y&&(z="-"+z)}N=B?z+(x.decimalSeparator||"")+((O=+x.fractionGroupSize)?B.replace(new RegExp("\\d{"+O+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):B):z}return(x.prefix||"")+N+(x.suffix||"")},G.toFraction=function(_){var S,x,N,R,$,j,I,O,D,z,B,Y,te=this,Re=te.c;if(_!=null&&(I=new Z(_),!I.isInteger()&&(I.c||I.s!==1)||I.lt(je)))throw Error(u+"Argument "+(I.isInteger()?"out of range: ":"not an integer: ")+at(I));if(!Re)return new Z(te);for(S=new Z(je),D=x=new Z(je),N=O=new Z(je),Y=T(Re),$=S.e=Y.length-te.e-1,S.c[0]=m[(j=$%p)<0?p+j:j],_=!_||I.comparedTo(S)>0?$>0?S:D:I,j=He,He=1/0,I=new Z(Y),O.c[0]=0;z=V(I,S,0,1),R=x.plus(z.times(N)),R.comparedTo(_)!=1;)x=N,N=R,D=O.plus(z.times(R=D)),O=R,S=I.minus(z.times(R=S)),I=R;return R=V(_.minus(x),N,0,1),O=O.plus(R.times(D)),x=x.plus(R.times(N)),O.s=D.s=te.s,$=$*2,B=V(D,N,$,ve).minus(te).abs().comparedTo(V(O,x,$,ve).minus(te).abs())<1?[D,N]:[O,x],He=j,B},G.toNumber=function(){return+at(this)},G.toPrecision=function(_,S){return _!=null&&w(_,1,P),Rt(this,_,S,2)},G.toString=function(_){var S,x=this,N=x.s,R=x.e;return R===null?N?(S="Infinity",N<0&&(S="-"+S)):S="NaN":(_==null?S=R<=ze||R>=$e?q(T(x.c),R):W(T(x.c),R,"0"):_===10&&ii?(x=Tt(new Z(x),Ee+R+1,ve),S=W(T(x.c),x.e,"0")):(w(_,2,wr.length,"Base"),S=J(W(T(x.c),R,"0"),10,_,N,!0)),N<0&&x.c[0]&&(S="-"+S)),S},G.valueOf=G.toJSON=function(){return at(this)},G._isBigNumber=!0,H!=null&&Z.set(H),Z}o(h,"clone");function b(H){var V=H|0;return H>0||H===V?V:V-1}o(b,"bitFloor");function T(H){for(var V,J,re=1,G=H.length,je=H[0]+"";re<G;){for(V=H[re++]+"",J=p-V.length;J--;V="0"+V);je+=V}for(G=je.length;je.charCodeAt(--G)===48;);return je.slice(0,G+1||1)}o(T,"coeffToString");function E(H,V){var J,re,G=H.c,je=V.c,Ee=H.s,ve=V.s,ze=H.e,$e=V.e;if(!Ee||!ve)return null;if(J=G&&!G[0],re=je&&!je[0],J||re)return J?re?0:-ve:Ee;if(Ee!=ve)return Ee;if(J=Ee<0,re=ze==$e,!G||!je)return re?0:!G^J?1:-1;if(!re)return ze>$e^J?1:-1;for(ve=(ze=G.length)<($e=je.length)?ze:$e,Ee=0;Ee<ve;Ee++)if(G[Ee]!=je[Ee])return G[Ee]>je[Ee]^J?1:-1;return ze==$e?0:ze>$e^J?1:-1}o(E,"compare");function w(H,V,J,re){if(H<V||H>J||H!==i(H))throw Error(u+(re||"Argument")+(typeof H=="number"?H<V||H>J?" out of range: ":" not an integer: ":" not a primitive number: ")+String(H))}o(w,"intCheck");function k(H){var V=H.c.length-1;return b(H.e/p)==V&&H.c[V]%2!=0}o(k,"isOdd");function q(H,V){return(H.length>1?H.charAt(0)+"."+H.slice(1):H)+(V<0?"e":"e+")+V}o(q,"toExponential");function W(H,V,J){var re,G;if(V<0){for(G=J+".";++V;G+=J);H=G+H}else if(re=H.length,++V>re){for(G=J,V-=re;--V;G+=J);H+=G}else V<re&&(H=H.slice(0,V)+"."+H.slice(V));return H}o(W,"toFixedPoint"),e=h(),e.default=e.BigNumber=e,typeof define=="function"&&define.amd?define(function(){return e}):typeof Ws<"u"&&Ws.exports?Ws.exports=e:(t||(t=typeof self<"u"&&self?self:window),t.BigNumber=e)})(hv)});var bv=L((OJ,_v)=>{var gv=ed(),yv=_v.exports;(function(){"use strict";function t(f){return f<10?"0"+f:f}o(t,"f");var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n,i,u={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},c;function l(f){return r.lastIndex=0,r.test(f)?'"'+f.replace(r,function(m){var y=u[m];return typeof y=="string"?y:"\\u"+("0000"+m.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+f+'"'}o(l,"quote");function p(f,m){var y,P,h,b,T=n,E,w=m[f],k=w!=null&&(w instanceof gv||gv.isBigNumber(w));switch(w&&typeof w=="object"&&typeof w.toJSON=="function"&&(w=w.toJSON(f)),typeof c=="function"&&(w=c.call(m,f,w)),typeof w){case"string":return k?w:l(w);case"number":return isFinite(w)?String(w):"null";case"boolean":case"null":case"bigint":return String(w);case"object":if(!w)return"null";if(n+=i,E=[],Object.prototype.toString.apply(w)==="[object Array]"){for(b=w.length,y=0;y<b;y+=1)E[y]=p(y,w)||"null";return h=E.length===0?"[]":n?`[
32
32
  `+n+E.join(`,
33
33
  `+n)+`
34
- `+T+"]":"["+E.join(",")+"]",n=T,h}if(c&&typeof c=="object")for(_=c.length,g=0;g<_;g+=1)typeof c[g]=="string"&&(S=c[g],h=p(S,w),h&&E.push(l(S)+(n?": ":":")+h));else Object.keys(w).forEach(function(q){var G=p(q,w);G&&E.push(l(q)+(n?": ":":")+G)});return h=E.length===0?"{}":n?`{
34
+ `+T+"]":"["+E.join(",")+"]",n=T,h}if(c&&typeof c=="object")for(b=c.length,y=0;y<b;y+=1)typeof c[y]=="string"&&(P=c[y],h=p(P,w),h&&E.push(l(P)+(n?": ":":")+h));else Object.keys(w).forEach(function(q){var W=p(q,w);W&&E.push(l(q)+(n?": ":":")+W)});return h=E.length===0?"{}":n?`{
35
35
  `+n+E.join(`,
36
36
  `+n)+`
37
- `+T+"}":"{"+E.join(",")+"}",n=T,h}}o(p,"str"),typeof cv.stringify!="function"&&(cv.stringify=function(f,m,g){var S;if(n="",i="",typeof g=="number")for(S=0;S<g;S+=1)i+=" ";else typeof g=="string"&&(i=g);if(c=m,m&&typeof m!="function"&&(typeof m!="object"||typeof m.length!="number"))throw new Error("JSON.stringify");return p("",{"":f})})})()});var fv=M((sJ,pv)=>{var Ws=null,kC=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,$C=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/,NC=o(function(t){"use strict";var e={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(t!=null){if(t.strict===!0&&(e.strict=!0),t.storeAsString===!0&&(e.storeAsString=!0),e.alwaysParseAsBig=t.alwaysParseAsBig===!0?t.alwaysParseAsBig:!1,e.useNativeBigInt=t.useNativeBigInt===!0?t.useNativeBigInt:!1,typeof t.constructorAction<"u")if(t.constructorAction==="error"||t.constructorAction==="ignore"||t.constructorAction==="preserve")e.constructorAction=t.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${t.constructorAction}`);if(typeof t.protoAction<"u")if(t.protoAction==="error"||t.protoAction==="ignore"||t.protoAction==="preserve")e.protoAction=t.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${t.protoAction}`)}var r,n,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
38
- `,r:"\r",t:" "},u,c=o(function(T){throw{name:"SyntaxError",message:T,at:r,text:u}},"error"),l=o(function(T){return T&&T!==n&&c("Expected '"+T+"' instead of '"+n+"'"),n=u.charAt(r),r+=1,n},"next"),p=o(function(){var T,E="";for(n==="-"&&(E="-",l("-"));n>="0"&&n<="9";)E+=n,l();if(n===".")for(E+=".";l()&&n>="0"&&n<="9";)E+=n;if(n==="e"||n==="E")for(E+=n,l(),(n==="-"||n==="+")&&(E+=n,l());n>="0"&&n<="9";)E+=n,l();if(T=+E,!isFinite(T))c("Bad number");else return Ws==null&&(Ws=Ql()),E.length>15?e.storeAsString?E:e.useNativeBigInt?BigInt(E):new Ws(E):e.alwaysParseAsBig?e.useNativeBigInt?BigInt(T):new Ws(T):T},"number"),f=o(function(){var T,E,w="",k;if(n==='"')for(var q=r;l();){if(n==='"')return r-1>q&&(w+=u.substring(q,r-1)),l(),w;if(n==="\\"){if(r-1>q&&(w+=u.substring(q,r-1)),l(),n==="u"){for(k=0,E=0;E<4&&(T=parseInt(l(),16),!!isFinite(T));E+=1)k=k*16+T;w+=String.fromCharCode(k)}else if(typeof i[n]=="string")w+=i[n];else break;q=r}}c("Bad string")},"string"),m=o(function(){for(;n&&n<=" ";)l()},"white"),g=o(function(){switch(n){case"t":return l("t"),l("r"),l("u"),l("e"),!0;case"f":return l("f"),l("a"),l("l"),l("s"),l("e"),!1;case"n":return l("n"),l("u"),l("l"),l("l"),null}c("Unexpected '"+n+"'")},"word"),S,h=o(function(){var T=[];if(n==="["){if(l("["),m(),n==="]")return l("]"),T;for(;n;){if(T.push(S()),m(),n==="]")return l("]"),T;l(","),m()}}c("Bad array")},"array"),_=o(function(){var T,E=Object.create(null);if(n==="{"){if(l("{"),m(),n==="}")return l("}"),E;for(;n;){if(T=f(),m(),l(":"),e.strict===!0&&Object.hasOwnProperty.call(E,T)&&c('Duplicate key "'+T+'"'),kC.test(T)===!0?e.protoAction==="error"?c("Object contains forbidden prototype property"):e.protoAction==="ignore"?S():E[T]=S():$C.test(T)===!0?e.constructorAction==="error"?c("Object contains forbidden constructor property"):e.constructorAction==="ignore"?S():E[T]=S():E[T]=S(),m(),n==="}")return l("}"),E;l(","),m()}}c("Bad object")},"object");return S=o(function(){switch(m(),n){case"{":return _();case"[":return h();case'"':return f();case"-":return p();default:return n>="0"&&n<="9"?p():g()}},"value"),function(T,E){var w;return u=T+"",r=0,n=" ",w=S(),m(),n&&c("Syntax error"),typeof E=="function"?o((function k(q,G){var V,H,J=q[G];return J&&typeof J=="object"&&Object.keys(J).forEach(function(re){H=k(J,re),H!==void 0?J[re]=H:delete J[re]}),E.call(q,G,J)}),"walk")({"":w},""):w}},"json_parse");pv.exports=NC});var gv=M((cJ,Zs)=>{var mv=dv().stringify,hv=fv();Zs.exports=function(t){return{parse:hv(t),stringify:mv}};Zs.exports.parse=hv();Zs.exports.stringify=mv});var Yl=M(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.GCE_LINUX_BIOS_PATHS=void 0;_r.isGoogleCloudServerless=bv;_r.isGoogleComputeEngineLinux=vv;_r.isGoogleComputeEngineMACAddress=Ev;_r.isGoogleComputeEngine=Sv;_r.detectGCPResidency=DC;var yv=require("fs"),_v=require("os");_r.GCE_LINUX_BIOS_PATHS={BIOS_DATE:"/sys/class/dmi/id/bios_date",BIOS_VENDOR:"/sys/class/dmi/id/bios_vendor"};var zC=/^42:01/;function bv(){return!!(process.env.CLOUD_RUN_JOB||process.env.FUNCTION_NAME||process.env.K_SERVICE)}o(bv,"isGoogleCloudServerless");function vv(){if((0,_v.platform)()!=="linux")return!1;try{(0,yv.statSync)(_r.GCE_LINUX_BIOS_PATHS.BIOS_DATE);let t=(0,yv.readFileSync)(_r.GCE_LINUX_BIOS_PATHS.BIOS_VENDOR,"utf8");return/Google/.test(t)}catch{return!1}}o(vv,"isGoogleComputeEngineLinux");function Ev(){let t=(0,_v.networkInterfaces)();for(let e of Object.values(t))if(e){for(let{mac:r}of e)if(zC.test(r))return!0}return!1}o(Ev,"isGoogleComputeEngineMACAddress");function Sv(){return vv()||Ev()}o(Sv,"isGoogleComputeEngine");function DC(){return bv()||Sv()}o(DC,"detectGCPResidency")});var Pv=M(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.Colours=void 0;var vt=class t{static{o(this,"Colours")}static isEnabled(e){return e&&e.isTTY&&(typeof e.getColorDepth=="function"?e.getColorDepth()>2:!0)}static refresh(){t.enabled=t.isEnabled(process==null?void 0:process.stderr),this.enabled?(t.reset="\x1B[0m",t.bright="\x1B[1m",t.dim="\x1B[2m",t.red="\x1B[31m",t.green="\x1B[32m",t.yellow="\x1B[33m",t.blue="\x1B[34m",t.magenta="\x1B[35m",t.cyan="\x1B[36m",t.white="\x1B[37m",t.grey="\x1B[90m"):(t.reset="",t.bright="",t.dim="",t.red="",t.green="",t.yellow="",t.blue="",t.magenta="",t.cyan="",t.white="",t.grey="")}};Js.Colours=vt;vt.enabled=!1;vt.reset="";vt.bright="";vt.dim="";vt.red="";vt.green="";vt.yellow="";vt.blue="";vt.magenta="";vt.cyan="";vt.white="";vt.grey="";vt.refresh()});var Av=M(Me=>{"use strict";var UC=Me&&Me.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),jC=Me&&Me.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Tv=Me&&Me.__importStar||(function(){var t=o(function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&UC(r,e,n[i]);return jC(r,e),r}})();Object.defineProperty(Me,"__esModule",{value:!0});Me.env=Me.DebugLogBackendBase=Me.placeholder=Me.AdhocDebugLogger=Me.LogSeverity=void 0;Me.getNodeBackend=ed;Me.getDebugBackend=LC;Me.getStructuredBackend=FC;Me.setBackend=BC;Me.log=xv;var MC=require("events"),Ji=Tv(require("process")),wv=Tv(require("util")),Gt=Pv(),br;(function(t){t.DEFAULT="DEFAULT",t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR"})(br||(Me.LogSeverity=br={}));var Ki=class extends MC.EventEmitter{static{o(this,"AdhocDebugLogger")}constructor(e,r){super(),this.namespace=e,this.upstream=r,this.func=Object.assign(this.invoke.bind(this),{instance:this,on:o((n,i)=>this.on(n,i),"on")}),this.func.debug=(...n)=>this.invokeSeverity(br.DEBUG,...n),this.func.info=(...n)=>this.invokeSeverity(br.INFO,...n),this.func.warn=(...n)=>this.invokeSeverity(br.WARNING,...n),this.func.error=(...n)=>this.invokeSeverity(br.ERROR,...n),this.func.sublog=n=>xv(n,this.func)}invoke(e,...r){if(this.upstream)try{this.upstream(e,...r)}catch{}try{this.emit("log",e,r)}catch{}}invokeSeverity(e,...r){this.invoke({severity:e},...r)}};Me.AdhocDebugLogger=Ki;Me.placeholder=new Ki("",()=>{}).func;var Mo=class{static{o(this,"DebugLogBackendBase")}constructor(){var e;this.cached=new Map,this.filters=[],this.filtersSet=!1;let r=(e=Ji.env[Me.env.nodeEnables])!==null&&e!==void 0?e:"*";r==="all"&&(r="*"),this.filters=r.split(",")}log(e,r,...n){try{this.filtersSet||(this.setFilters(),this.filtersSet=!0);let i=this.cached.get(e);i||(i=this.makeLogger(e),this.cached.set(e,i)),i(r,...n)}catch(i){console.error(i)}}};Me.DebugLogBackendBase=Mo;var Xl=class extends Mo{static{o(this,"NodeBackend")}constructor(){super(...arguments),this.enabledRegexp=/.*/g}isEnabled(e){return this.enabledRegexp.test(e)}makeLogger(e){return this.enabledRegexp.test(e)?(r,...n)=>{var i;let u=`${Gt.Colours.green}${e}${Gt.Colours.reset}`,c=`${Gt.Colours.yellow}${Ji.pid}${Gt.Colours.reset}`,l;switch(r.severity){case br.ERROR:l=`${Gt.Colours.red}${r.severity}${Gt.Colours.reset}`;break;case br.INFO:l=`${Gt.Colours.magenta}${r.severity}${Gt.Colours.reset}`;break;case br.WARNING:l=`${Gt.Colours.yellow}${r.severity}${Gt.Colours.reset}`;break;default:l=(i=r.severity)!==null&&i!==void 0?i:br.DEFAULT;break}let p=wv.formatWithOptions({colors:Gt.Colours.enabled},...n),f=Object.assign({},r);delete f.severity;let m=Object.getOwnPropertyNames(f).length?JSON.stringify(f):"",g=m?`${Gt.Colours.grey}${m}${Gt.Colours.reset}`:"";console.error("%s [%s|%s] %s%s",c,u,l,p,m?` ${g}`:"")}:()=>{}}setFilters(){let r=this.filters.join(",").replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=new RegExp(`^${r}$`,"i")}};function ed(){return new Xl}o(ed,"getNodeBackend");var td=class extends Mo{static{o(this,"DebugBackend")}constructor(e){super(),this.debugPkg=e}makeLogger(e){let r=this.debugPkg(e);return(n,...i)=>{r(i[0],...i.slice(1))}}setFilters(){var e;let r=(e=Ji.env.NODE_DEBUG)!==null&&e!==void 0?e:"";Ji.env.NODE_DEBUG=`${r}${r?",":""}${this.filters.join(",")}`}};function LC(t){return new td(t)}o(LC,"getDebugBackend");var rd=class extends Mo{static{o(this,"StructuredBackend")}constructor(e){var r;super(),this.upstream=(r=e)!==null&&r!==void 0?r:void 0}makeLogger(e){var r;let n=(r=this.upstream)===null||r===void 0?void 0:r.makeLogger(e);return(i,...u)=>{var c;let l=(c=i.severity)!==null&&c!==void 0?c:br.INFO,p=Object.assign({severity:l,message:wv.format(...u)},i),f=JSON.stringify(p);n?n(i,f):console.log("%s",f)}}setFilters(){var e;(e=this.upstream)===null||e===void 0||e.setFilters()}};function FC(t){return new rd(t)}o(FC,"getStructuredBackend");Me.env={nodeEnables:"GOOGLE_SDK_NODE_LOGGING"};var nd=new Map,Wt;function BC(t){Wt=t,nd.clear()}o(BC,"setBackend");function xv(t,e){if(!Wt&&!Ji.env[Me.env.nodeEnables]||!t)return Me.placeholder;e&&(t=`${e.instance.namespace}:${t}`);let r=nd.get(t);if(r)return r.func;if(Wt===null)return Me.placeholder;Wt===void 0&&(Wt=ed());let n=(()=>{let i;return new Ki(t,(c,...l)=>{if(i!==Wt){if(Wt===null)return;Wt===void 0&&(Wt=ed()),i=Wt}Wt?.log(t,c,...l)})})();return nd.set(t,n),n.func}o(xv,"log")});var od=M(Qn=>{"use strict";var qC=Qn&&Qn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),VC=Qn&&Qn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qC(e,t,r)};Object.defineProperty(Qn,"__esModule",{value:!0});VC(Av(),Qn)});var Yi=M(se=>{"use strict";var Rv=se&&se.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),HC=se&&se.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),GC=se&&se.__importStar||(function(){var t=o(function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&Rv(r,e,n[i]);return HC(r,e),r}})(),WC=se&&se.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Rv(e,t,r)};Object.defineProperty(se,"__esModule",{value:!0});se.gcpResidencyCache=se.METADATA_SERVER_DETECTION=se.HEADERS=se.HEADER_VALUE=se.HEADER_NAME=se.SECONDARY_HOST_ADDRESS=se.HOST_ADDRESS=se.BASE_PATH=void 0;se.instance=XC;se.project=eO;se.universe=tO;se.bulk=rO;se.isAvailable=oO;se.resetIsAvailableCache=iO;se.getGCPResidency=sd;se.setGCPResidency=Cv;se.requestTimeout=Ov;var id=yt(),ZC=gv(),JC=Yl(),KC=GC(od());se.BASE_PATH="/computeMetadata/v1";se.HOST_ADDRESS="http://169.254.169.254";se.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.";se.HEADER_NAME="Metadata-Flavor";se.HEADER_VALUE="Google";se.HEADERS=Object.freeze({[se.HEADER_NAME]:se.HEADER_VALUE});var Iv=KC.log("gcp-metadata");se.METADATA_SERVER_DETECTION=Object.freeze({"assume-present":"don't try to ping the metadata server, but assume it's present",none:"don't try to ping the metadata server, but don't try to use it either","bios-only":"treat the result of a BIOS probe as canonical (don't fall back to pinging)","ping-only":"skip the BIOS probe, and go straight to pinging"});function ad(t){return t||(t=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||se.HOST_ADDRESS),/^https?:\/\//.test(t)||(t=`http://${t}`),new URL(se.BASE_PATH,t).href}o(ad,"getBaseUrl");function QC(t){Object.keys(t).forEach(e=>{switch(e){case"params":case"property":case"headers":break;case"qs":throw new Error("'qs' is not a valid configuration option. Please use 'params' instead.");default:throw new Error(`'${e}' is not a valid configuration option.`)}})}o(QC,"validate");async function Qi(t,e={},r=3,n=!1){let i=new Headers(se.HEADERS),u="",c={};if(typeof t=="object"){let g=t;new Headers(g.headers).forEach((S,h)=>i.set(h,S)),u=g.metadataKey,c=g.params||c,r=g.noResponseRetries||r,n=g.fastFail||n}else u=t;typeof e=="string"?u+=`/${e}`:(QC(e),e.property&&(u+=`/${e.property}`),new Headers(e.headers).forEach((g,S)=>i.set(S,g)),c=e.params||c);let l=n?YC:id.request,p={url:`${ad()}/${u}`,headers:i,retryConfig:{noResponseRetries:r},params:c,responseType:"text",timeout:Ov()};Iv.info("instance request %j",p);let f=await l(p);Iv.info("instance metadata is %s",f.data);let m=f.headers.get(se.HEADER_NAME);if(m!==se.HEADER_VALUE)throw new RangeError(`Invalid response from metadata service: incorrect ${se.HEADER_NAME} header. Expected '${se.HEADER_VALUE}', got ${m?`'${m}'`:"no header"}`);if(typeof f.data=="string")try{return ZC.parse(f.data)}catch{}return f.data}o(Qi,"metadataAccessor");async function YC(t){let e={...t,url:t.url?.toString().replace(ad(),ad(se.SECONDARY_HOST_ADDRESS))},r=(0,id.request)(t),n=(0,id.request)(e);return Promise.any([r,n])}o(YC,"fastFailMetadataRequest");function XC(t){return Qi("instance",t)}o(XC,"instance");function eO(t){return Qi("project",t)}o(eO,"project");function tO(t){return Qi("universe",t)}o(tO,"universe");async function rO(t){let e={};return await Promise.all(t.map(r=>(async()=>{let n=await Qi(r),i=r.metadataKey;e[i]=n})())),e}o(rO,"bulk");function nO(){return process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0}o(nO,"detectGCPAvailableRetries");var Ks;async function oO(){if(process.env.METADATA_SERVER_DETECTION){let t=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(t in se.METADATA_SERVER_DETECTION))throw new RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${t}\`, but it should be \`${Object.keys(se.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`);switch(t){case"assume-present":return!0;case"none":return!1;case"bios-only":return sd();case"ping-only":}}try{return Ks===void 0&&(Ks=Qi("instance",void 0,nO(),!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST))),await Ks,!0}catch(t){let e=t;if(process.env.DEBUG_AUTH&&console.info(e),e.type==="request-timeout"||e.response&&e.response.status===404)return!1;if(!(e.response&&e.response.status===404)&&(!e.code||!["EHOSTDOWN","EHOSTUNREACH","ENETUNREACH","ENOENT","ENOTFOUND","ECONNREFUSED"].includes(e.code.toString()))){let r="UNKNOWN";e.code&&(r=e.code.toString()),process.emitWarning(`received unexpected error = ${e.message} code = ${r}`,"MetadataLookupWarning")}return!1}}o(oO,"isAvailable");function iO(){Ks=void 0}o(iO,"resetIsAvailableCache");se.gcpResidencyCache=null;function sd(){return se.gcpResidencyCache===null&&Cv(),se.gcpResidencyCache}o(sd,"getGCPResidency");function Cv(t=null){se.gcpResidencyCache=t!==null?t:(0,JC.detectGCPResidency)()}o(Cv,"setGCPResidency");function Ov(){return sd()?0:3e3}o(Ov,"requestTimeout");WC(Yl(),se)});var Nv=M(Qs=>{"use strict";Qs.byteLength=sO;Qs.toByteArray=cO;Qs.fromByteArray=pO;var $r=[],ar=[],aO=typeof Uint8Array<"u"?Uint8Array:Array,ud="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Yn=0,kv=ud.length;Yn<kv;++Yn)$r[Yn]=ud[Yn],ar[ud.charCodeAt(Yn)]=Yn;var Yn,kv;ar[45]=62;ar[95]=63;function $v(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}o($v,"getLens");function sO(t){var e=$v(t),r=e[0],n=e[1];return(r+n)*3/4-n}o(sO,"byteLength");function uO(t,e,r){return(e+r)*3/4-r}o(uO,"_byteLength");function cO(t){var e,r=$v(t),n=r[0],i=r[1],u=new aO(uO(t,n,i)),c=0,l=i>0?n-4:n,p;for(p=0;p<l;p+=4)e=ar[t.charCodeAt(p)]<<18|ar[t.charCodeAt(p+1)]<<12|ar[t.charCodeAt(p+2)]<<6|ar[t.charCodeAt(p+3)],u[c++]=e>>16&255,u[c++]=e>>8&255,u[c++]=e&255;return i===2&&(e=ar[t.charCodeAt(p)]<<2|ar[t.charCodeAt(p+1)]>>4,u[c++]=e&255),i===1&&(e=ar[t.charCodeAt(p)]<<10|ar[t.charCodeAt(p+1)]<<4|ar[t.charCodeAt(p+2)]>>2,u[c++]=e>>8&255,u[c++]=e&255),u}o(cO,"toByteArray");function lO(t){return $r[t>>18&63]+$r[t>>12&63]+$r[t>>6&63]+$r[t&63]}o(lO,"tripletToBase64");function dO(t,e,r){for(var n,i=[],u=e;u<r;u+=3)n=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(t[u+2]&255),i.push(lO(n));return i.join("")}o(dO,"encodeChunk");function pO(t){for(var e,r=t.length,n=r%3,i=[],u=16383,c=0,l=r-n;c<l;c+=u)i.push(dO(t,c,c+u>l?l:c+u));return n===1?(e=t[r-1],i.push($r[e>>2]+$r[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push($r[e>>10]+$r[e>>4&63]+$r[e<<2&63]+"=")),i.join("")}o(pO,"fromByteArray")});var ld=M(cd=>{"use strict";Object.defineProperty(cd,"__esModule",{value:!0});cd.fromArrayBufferToHex=fO;function fO(t){return Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join("")}o(fO,"fromArrayBufferToHex")});var zv=M(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.BrowserCrypto=void 0;var Lo=Nv(),mO=ld(),dd=class t{static{o(this,"BrowserCrypto")}constructor(){if(typeof window>"u"||window.crypto===void 0||window.crypto.subtle===void 0)throw new Error("SubtleCrypto not found. Make sure it's an https:// website.")}async sha256DigestBase64(e){let r=new TextEncoder().encode(e),n=await window.crypto.subtle.digest("SHA-256",r);return Lo.fromByteArray(new Uint8Array(n))}randomBytesBase64(e){let r=new Uint8Array(e);return window.crypto.getRandomValues(r),Lo.fromByteArray(r)}static padBase64(e){for(;e.length%4!==0;)e+="=";return e}async verify(e,r,n){let i={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},u=new TextEncoder().encode(r),c=Lo.toByteArray(t.padBase64(n)),l=await window.crypto.subtle.importKey("jwk",e,i,!0,["verify"]);return await window.crypto.subtle.verify(i,l,c,u)}async sign(e,r){let n={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},i=new TextEncoder().encode(r),u=await window.crypto.subtle.importKey("jwk",e,n,!0,["sign"]),c=await window.crypto.subtle.sign(n,u,i);return Lo.fromByteArray(new Uint8Array(c))}decodeBase64StringUtf8(e){let r=Lo.toByteArray(t.padBase64(e));return new TextDecoder().decode(r)}encodeBase64StringUtf8(e){let r=new TextEncoder().encode(e);return Lo.fromByteArray(r)}async sha256DigestHex(e){let r=new TextEncoder().encode(e),n=await window.crypto.subtle.digest("SHA-256",r);return(0,mO.fromArrayBufferToHex)(n)}async signWithHmacSha256(e,r){let n=typeof e=="string"?e:String.fromCharCode(...new Uint16Array(e)),i=new TextEncoder,u=await window.crypto.subtle.importKey("raw",i.encode(n),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return window.crypto.subtle.sign("HMAC",u,i.encode(r))}};Ys.BrowserCrypto=dd});var Dv=M(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.NodeCrypto=void 0;var Fo=require("crypto"),pd=class{static{o(this,"NodeCrypto")}async sha256DigestBase64(e){return Fo.createHash("sha256").update(e).digest("base64")}randomBytesBase64(e){return Fo.randomBytes(e).toString("base64")}async verify(e,r,n){let i=Fo.createVerify("RSA-SHA256");return i.update(r),i.end(),i.verify(e,n,"base64")}async sign(e,r){let n=Fo.createSign("RSA-SHA256");return n.update(r),n.end(),n.sign(e,"base64")}decodeBase64StringUtf8(e){return Buffer.from(e,"base64").toString("utf-8")}encodeBase64StringUtf8(e){return Buffer.from(e,"utf-8").toString("base64")}async sha256DigestHex(e){return Fo.createHash("sha256").update(e).digest("hex")}async signWithHmacSha256(e,r){let n=typeof e=="string"?e:gO(e);return hO(Fo.createHmac("sha256",n).update(r).digest())}};Xs.NodeCrypto=pd;function hO(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}o(hO,"toArrayBuffer");function gO(t){return Buffer.from(t)}o(gO,"toBuffer")});var Xi=M(rn=>{"use strict";var yO=rn&&rn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),_O=rn&&rn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yO(e,t,r)};Object.defineProperty(rn,"__esModule",{value:!0});rn.createCrypto=EO;rn.hasBrowserCrypto=Uv;var bO=zv(),vO=Dv();_O(ld(),rn);function EO(){return Uv()?new bO.BrowserCrypto:new vO.NodeCrypto}o(EO,"createCrypto");function Uv(){return typeof window<"u"&&typeof window.crypto<"u"&&typeof window.crypto.subtle<"u"}o(Uv,"hasBrowserCrypto")});var Bo=M((fd,Mv)=>{var eu=require("buffer"),Nr=eu.Buffer;function jv(t,e){for(var r in t)e[r]=t[r]}o(jv,"copyProps");Nr.from&&Nr.alloc&&Nr.allocUnsafe&&Nr.allocUnsafeSlow?Mv.exports=eu:(jv(eu,fd),fd.Buffer=Xn);function Xn(t,e,r){return Nr(t,e,r)}o(Xn,"SafeBuffer");Xn.prototype=Object.create(Nr.prototype);jv(Nr,Xn);Xn.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Nr(t,e,r)};Xn.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Nr(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Xn.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Nr(t)};Xn.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return eu.SlowBuffer(t)}});var Fv=M((OJ,Lv)=>{"use strict";function md(t){var e=(t/8|0)+(t%8===0?0:1);return e}o(md,"getParamSize");var SO={ES256:md(256),ES384:md(384),ES512:md(521)};function PO(t){var e=SO[t];if(e)return e;throw new Error('Unknown algorithm "'+t+'"')}o(PO,"getParamBytesForAlg");Lv.exports=PO});var hd=M(($J,Wv)=>{"use strict";var tu=Bo().Buffer,qv=Fv(),ru=128,Vv=0,TO=32,wO=16,xO=2,Hv=wO|TO|Vv<<6,nu=xO|Vv<<6;function AO(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}o(AO,"base64Url");function Gv(t){if(tu.isBuffer(t))return t;if(typeof t=="string")return tu.from(t,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}o(Gv,"signatureAsBuffer");function IO(t,e){t=Gv(t);var r=qv(e),n=r+1,i=t.length,u=0;if(t[u++]!==Hv)throw new Error('Could not find expected "seq"');var c=t[u++];if(c===(ru|1)&&(c=t[u++]),i-u<c)throw new Error('"seq" specified length of "'+c+'", only "'+(i-u)+'" remaining');if(t[u++]!==nu)throw new Error('Could not find expected "int" for "r"');var l=t[u++];if(i-u-2<l)throw new Error('"r" specified length of "'+l+'", only "'+(i-u-2)+'" available');if(n<l)throw new Error('"r" specified length of "'+l+'", max of "'+n+'" is acceptable');var p=u;if(u+=l,t[u++]!==nu)throw new Error('Could not find expected "int" for "s"');var f=t[u++];if(i-u!==f)throw new Error('"s" specified length of "'+f+'", expected "'+(i-u)+'"');if(n<f)throw new Error('"s" specified length of "'+f+'", max of "'+n+'" is acceptable');var m=u;if(u+=f,u!==i)throw new Error('Expected to consume entire buffer, but "'+(i-u)+'" bytes remain');var g=r-l,S=r-f,h=tu.allocUnsafe(g+l+S+f);for(u=0;u<g;++u)h[u]=0;t.copy(h,u,p+Math.max(-g,0),p+l),u=r;for(var _=u;u<_+S;++u)h[u]=0;return t.copy(h,u,m+Math.max(-S,0),m+f),h=h.toString("base64"),h=AO(h),h}o(IO,"derToJose");function Bv(t,e,r){for(var n=0;e+n<r&&t[e+n]===0;)++n;var i=t[e+n]>=ru;return i&&--n,n}o(Bv,"countPadding");function RO(t,e){t=Gv(t);var r=qv(e),n=t.length;if(n!==r*2)throw new TypeError('"'+e+'" signatures must be "'+r*2+'" bytes, saw "'+n+'"');var i=Bv(t,0,r),u=Bv(t,r,t.length),c=r-i,l=r-u,p=2+c+1+1+l,f=p<ru,m=tu.allocUnsafe((f?2:3)+p),g=0;return m[g++]=Hv,f?m[g++]=p:(m[g++]=ru|1,m[g++]=p&255),m[g++]=nu,m[g++]=c,i<0?(m[g++]=0,g+=t.copy(m,g,0,r)):g+=t.copy(m,g,i,r),m[g++]=nu,m[g++]=l,u<0?(m[g++]=0,t.copy(m,g,r)):t.copy(m,g,r+u),m}o(RO,"joseToDer");Wv.exports={derToJose:IO,joseToDer:RO}});var vr=M(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.LRUCache=void 0;nn.snakeToCamel=Jv;nn.originalOrCamelOptions=$O;nn.removeUndefinedValuesInObject=NO;nn.isValidFile=zO;nn.getWellKnownCertificateConfigFileLocation=DO;var CO=require("fs"),OO=require("os"),gd=require("path"),kO="certificate_config.json",Zv="gcloud";function Jv(t){return t.replace(/([_][^_])/g,e=>e.slice(1).toUpperCase())}o(Jv,"snakeToCamel");function $O(t){function e(r){let n=t||{};return n[r]??n[Jv(r)]}return o(e,"get"),{get:e}}o($O,"originalOrCamelOptions");var yd=class{static{o(this,"LRUCache")}capacity;#e=new Map;maxAge;constructor(e){this.capacity=e.capacity,this.maxAge=e.maxAge}#t(e,r){this.#e.delete(e),this.#e.set(e,{value:r,lastAccessed:Date.now()})}set(e,r){this.#t(e,r),this.#r()}get(e){let r=this.#e.get(e);if(r)return this.#t(e,r.value),this.#r(),r.value}#r(){let e=this.maxAge?Date.now()-this.maxAge:0,r=this.#e.entries().next();for(;!r.done&&(this.#e.size>this.capacity||r.value[1].lastAccessed<e);)this.#e.delete(r.value[0]),r=this.#e.entries().next()}};nn.LRUCache=yd;function NO(t){return Object.entries(t).forEach(([e,r])=>{(r===void 0||r==="undefined")&&delete t[e]}),t}o(NO,"removeUndefinedValuesInObject");async function zO(t){try{return(await CO.promises.lstat(t)).isFile()}catch{return!1}}o(zO,"isValidFile");function DO(){let t=process.env.CLOUDSDK_CONFIG||(UO()?gd.join(process.env.APPDATA||"",Zv):gd.join(process.env.HOME||"",".config",Zv));return gd.join(t,kO)}o(DO,"getWellKnownCertificateConfigFileLocation");function UO(){return OO.platform().startsWith("win")}o(UO,"_isWindows")});var Kv=M((UJ,jO)=>{jO.exports={name:"google-auth-library",version:"10.5.0",author:"Google Inc.",description:"Google APIs Authentication Client Library for Node.js",engines:{node:">=18"},main:"./build/src/index.js",types:"./build/src/index.d.ts",repository:"googleapis/google-auth-library-nodejs.git",keywords:["google","api","google apis","client","client library"],dependencies:{"base64-js":"^1.3.0","ecdsa-sig-formatter":"^1.0.11",gaxios:"^7.0.0","gcp-metadata":"^8.0.0","google-logging-utils":"^1.0.0",gtoken:"^8.0.0",jws:"^4.0.0"},devDependencies:{"@types/base64-js":"^1.2.5","@types/jws":"^3.1.0","@types/mocha":"^10.0.10","@types/mv":"^2.1.0","@types/ncp":"^2.0.1","@types/node":"^22.0.0","@types/sinon":"^17.0.0","assert-rejects":"^1.0.0",c8:"^10.0.0",codecov:"^3.0.2",gts:"^6.0.0","is-docker":"^3.0.0",jsdoc:"^4.0.0","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",keypair:"^1.0.4",mocha:"^11.1.0",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","ts-loader":"^8.0.0",typescript:"5.8.2",webpack:"^5.21.2","webpack-cli":"^4.0.0"},files:["build/src","!build/src/**/*.map"],scripts:{test:"c8 mocha build/test",clean:"gts clean",prepare:"npm run compile",lint:"gts check --no-inline-config",compile:"tsc -p .",fix:"gts fix",pretest:"npm run compile -- --sourceMap",docs:"jsdoc -c .jsdoc.js","samples-setup":"cd samples/ && npm link ../ && npm run setup && cd ../","samples-test":"cd samples/ && npm link ../ && npm test && cd ../","system-test":"mocha build/system-test --timeout 60000","presystem-test":"npm run compile -- --sourceMap",webpack:"webpack","browser-test":"karma start","docs-test":"echo 'disabled until linkinator is fixed'","predocs-test":"npm run docs",prelint:"cd samples; npm link ../; npm install"},license:"Apache-2.0"}});var _d=M(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.USER_AGENT=Cn.PRODUCT_NAME=Cn.pkg=void 0;var Qv=Kv();Cn.pkg=Qv;var Yv="google-api-nodejs-client";Cn.PRODUCT_NAME=Yv;var MO=`${Yv}/${Qv.version}`;Cn.USER_AGENT=MO});var Zt=M(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.AuthClient=Er.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=Er.DEFAULT_UNIVERSE=void 0;var LO=require("events"),bd=yt(),FO=vr(),BO=od(),vd=_d();Er.DEFAULT_UNIVERSE="googleapis.com";Er.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=300*1e3;var Ed=class t extends LO.EventEmitter{static{o(this,"AuthClient")}apiKey;projectId;quotaProjectId;transporter;credentials={};eagerRefreshThresholdMillis=Er.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS;forceRefreshOnFailure=!1;universeDomain=Er.DEFAULT_UNIVERSE;static RequestMethodNameSymbol=Symbol("request method name");static RequestLogIdSymbol=Symbol("request log id");constructor(e={}){super();let r=(0,FO.originalOrCamelOptions)(e);this.apiKey=e.apiKey,this.projectId=r.get("project_id")??null,this.quotaProjectId=r.get("quota_project_id"),this.credentials=r.get("credentials")??{},this.universeDomain=r.get("universe_domain")??Er.DEFAULT_UNIVERSE,this.transporter=e.transporter??new bd.Gaxios(e.transporterOptions),r.get("useAuthRequestParameters")!==!1&&(this.transporter.interceptors.request.add(t.DEFAULT_REQUEST_INTERCEPTOR),this.transporter.interceptors.response.add(t.DEFAULT_RESPONSE_INTERCEPTOR)),e.eagerRefreshThresholdMillis&&(this.eagerRefreshThresholdMillis=e.eagerRefreshThresholdMillis),this.forceRefreshOnFailure=e.forceRefreshOnFailure??!1}fetch(...e){let r=e[0],n=e[1],i,u=new Headers;return typeof r=="string"?i=new URL(r):r instanceof URL?i=r:r&&r.url&&(i=new URL(r.url)),r&&typeof r=="object"&&"headers"in r&&bd.Gaxios.mergeHeaders(u,r.headers),n&&bd.Gaxios.mergeHeaders(u,new Headers(n.headers)),typeof r=="object"&&!(r instanceof URL)?this.request({...n,...r,headers:u,url:i}):this.request({...n,headers:u,url:i})}setCredentials(e){this.credentials=e}addSharedMetadataHeaders(e){return!e.has("x-goog-user-project")&&this.quotaProjectId&&e.set("x-goog-user-project",this.quotaProjectId),e}addUserProjectAndAuthHeaders(e,r){let n=r.get("x-goog-user-project"),i=r.get("authorization");return n&&e.set("x-goog-user-project",n),i&&e.set("authorization",i),e}static log=(0,BO.log)("auth");static DEFAULT_REQUEST_INTERCEPTOR={resolved:o(async e=>{if(!e.headers.has("x-goog-api-client")){let n=process.version.replace(/^v/,"");e.headers.set("x-goog-api-client",`gl-node/${n}`)}let r=e.headers.get("User-Agent");r?r.includes(`${vd.PRODUCT_NAME}/`)||e.headers.set("User-Agent",`${r} ${vd.USER_AGENT}`):e.headers.set("User-Agent",vd.USER_AGENT);try{let n=e,i=n[t.RequestMethodNameSymbol],u=`${Math.floor(Math.random()*1e3)}`;n[t.RequestLogIdSymbol]=u;let c={url:e.url,headers:e.headers};i?t.log.info("%s [%s] request %j",i,u,c):t.log.info("[%s] request %j",u,c)}catch{}return e},"resolved")};static DEFAULT_RESPONSE_INTERCEPTOR={resolved:o(async e=>{try{let r=e.config,n=r[t.RequestMethodNameSymbol],i=r[t.RequestLogIdSymbol];n?t.log.info("%s [%s] response %j",n,i,e.data):t.log.info("[%s] response %j",i,e.data)}catch{}return e},"resolved"),rejected:o(async e=>{try{let r=e.config,n=r[t.RequestMethodNameSymbol],i=r[t.RequestLogIdSymbol];n?t.log.info("%s [%s] error %j",n,i,e.response?.data):t.log.error("[%s] error %j",i,e.response?.data)}catch{}throw e},"rejected")};static setMethodName(e,r){try{let n=e;n[t.RequestMethodNameSymbol]=r}catch{}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};Er.AuthClient=Ed});var Pd=M(ou=>{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});ou.LoginTicket=void 0;var Sd=class{static{o(this,"LoginTicket")}envelope;payload;constructor(e,r){this.envelope=e,this.payload=r}getEnvelope(){return this.envelope}getPayload(){return this.payload}getUserId(){let e=this.getPayload();return e&&e.sub?e.sub:null}getAttributes(){return{envelope:this.getEnvelope(),payload:this.getPayload()}}};ou.LoginTicket=Sd});var eo=M(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.OAuth2Client=zr.ClientAuthentication=zr.CertificateFormat=zr.CodeChallengeMethod=void 0;var Xv=yt(),qO=require("querystring"),VO=require("stream"),HO=hd(),eE=vr(),Td=Xi(),qo=Zt(),GO=Pd(),tE;(function(t){t.Plain="plain",t.S256="S256"})(tE||(zr.CodeChallengeMethod=tE={}));var on;(function(t){t.PEM="PEM",t.JWK="JWK"})(on||(zr.CertificateFormat=on={}));var ea;(function(t){t.ClientSecretPost="ClientSecretPost",t.ClientSecretBasic="ClientSecretBasic",t.None="None"})(ea||(zr.ClientAuthentication=ea={}));var wd=class t extends qo.AuthClient{static{o(this,"OAuth2Client")}redirectUri;certificateCache={};certificateExpiry=null;certificateCacheFormat=on.PEM;refreshTokenPromises=new Map;endpoints;issuers;clientAuthentication;_clientId;_clientSecret;refreshHandler;constructor(e={},r,n){super(typeof e=="object"?e:{}),typeof e!="object"&&(e={clientId:e,clientSecret:r,redirectUri:n}),this._clientId=e.clientId||e.client_id,this._clientSecret=e.clientSecret||e.client_secret,this.redirectUri=e.redirectUri||e.redirect_uris?.[0],this.endpoints={tokenInfoUrl:"https://oauth2.googleapis.com/tokeninfo",oauth2AuthBaseUrl:"https://accounts.google.com/o/oauth2/v2/auth",oauth2TokenUrl:"https://oauth2.googleapis.com/token",oauth2RevokeUrl:"https://oauth2.googleapis.com/revoke",oauth2FederatedSignonPemCertsUrl:"https://www.googleapis.com/oauth2/v1/certs",oauth2FederatedSignonJwkCertsUrl:"https://www.googleapis.com/oauth2/v3/certs",oauth2IapPublicKeyUrl:"https://www.gstatic.com/iap/verify/public_key",...e.endpoints},this.clientAuthentication=e.clientAuthentication||ea.ClientSecretPost,this.issuers=e.issuers||["accounts.google.com","https://accounts.google.com",this.universeDomain]}static GOOGLE_TOKEN_INFO_URL="https://oauth2.googleapis.com/tokeninfo";static CLOCK_SKEW_SECS_=300;static DEFAULT_MAX_TOKEN_LIFETIME_SECS_=86400;generateAuthUrl(e={}){if(e.code_challenge_method&&!e.code_challenge)throw new Error("If a code_challenge_method is provided, code_challenge must be included.");return e.response_type=e.response_type||"code",e.client_id=e.client_id||this._clientId,e.redirect_uri=e.redirect_uri||this.redirectUri,Array.isArray(e.scope)&&(e.scope=e.scope.join(" ")),this.endpoints.oauth2AuthBaseUrl.toString()+"?"+qO.stringify(e)}generateCodeVerifier(){throw new Error("generateCodeVerifier is removed, please use generateCodeVerifierAsync instead.")}async generateCodeVerifierAsync(){let e=(0,Td.createCrypto)(),n=e.randomBytesBase64(96).replace(/\+/g,"~").replace(/=/g,"_").replace(/\//g,"-"),u=(await e.sha256DigestBase64(n)).split("=")[0].replace(/\+/g,"-").replace(/\//g,"_");return{codeVerifier:n,codeChallenge:u}}getToken(e,r){let n=typeof e=="string"?{code:e}:e;if(r)this.getTokenAsync(n).then(i=>r(null,i.tokens,i.res),i=>r(i,null,i.response));else return this.getTokenAsync(n)}async getTokenAsync(e){let r=this.endpoints.oauth2TokenUrl.toString(),n=new Headers,i={client_id:e.client_id||this._clientId,code_verifier:e.codeVerifier,code:e.code,grant_type:"authorization_code",redirect_uri:e.redirect_uri||this.redirectUri};if(this.clientAuthentication===ea.ClientSecretBasic){let p=Buffer.from(`${this._clientId}:${this._clientSecret}`);n.set("authorization",`Basic ${p.toString("base64")}`)}this.clientAuthentication===ea.ClientSecretPost&&(i.client_secret=this._clientSecret);let u={...t.RETRY_CONFIG,method:"POST",url:r,data:new URLSearchParams((0,eE.removeUndefinedValuesInObject)(i)),headers:n};qo.AuthClient.setMethodName(u,"getTokenAsync");let c=await this.transporter.request(u),l=c.data;return c.data&&c.data.expires_in&&(l.expiry_date=new Date().getTime()+c.data.expires_in*1e3,delete l.expires_in),this.emit("tokens",l),{tokens:l,res:c}}async refreshToken(e){if(!e)return this.refreshTokenNoCache(e);if(this.refreshTokenPromises.has(e))return this.refreshTokenPromises.get(e);let r=this.refreshTokenNoCache(e).then(n=>(this.refreshTokenPromises.delete(e),n),n=>{throw this.refreshTokenPromises.delete(e),n});return this.refreshTokenPromises.set(e,r),r}async refreshTokenNoCache(e){if(!e)throw new Error("No refresh token is set.");let r=this.endpoints.oauth2TokenUrl.toString(),n={refresh_token:e,client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token"},i;try{let c={...t.RETRY_CONFIG,method:"POST",url:r,data:new URLSearchParams((0,eE.removeUndefinedValuesInObject)(n))};qo.AuthClient.setMethodName(c,"refreshTokenNoCache"),i=await this.transporter.request(c)}catch(c){throw c instanceof Xv.GaxiosError&&c.message==="invalid_grant"&&c.response?.data&&/ReAuth/i.test(c.response.data.error_description)&&(c.message=JSON.stringify(c.response.data)),c}let u=i.data;return i.data&&i.data.expires_in&&(u.expiry_date=new Date().getTime()+i.data.expires_in*1e3,delete u.expires_in),this.emit("tokens",u),{tokens:u,res:i}}refreshAccessToken(e){if(e)this.refreshAccessTokenAsync().then(r=>e(null,r.credentials,r.res),e);else return this.refreshAccessTokenAsync()}async refreshAccessTokenAsync(){let e=await this.refreshToken(this.credentials.refresh_token),r=e.tokens;return r.refresh_token=this.credentials.refresh_token,this.credentials=r,{credentials:this.credentials,res:e.res}}getAccessToken(e){if(e)this.getAccessTokenAsync().then(r=>e(null,r.token,r.res),e);else return this.getAccessTokenAsync()}async getAccessTokenAsync(){if(!this.credentials.access_token||this.isTokenExpiring()){if(!this.credentials.refresh_token)if(this.refreshHandler){let n=await this.processAndValidateRefreshHandler();if(n?.access_token)return this.setCredentials(n),{token:this.credentials.access_token}}else throw new Error("No refresh token or refresh handler callback is set.");let r=await this.refreshAccessTokenAsync();if(!r.credentials||r.credentials&&!r.credentials.access_token)throw new Error("Could not refresh access token.");return{token:r.credentials.access_token,res:r.res}}else return{token:this.credentials.access_token}}async getRequestHeaders(e){return(await this.getRequestMetadataAsync(e)).headers}async getRequestMetadataAsync(e){let r=this.credentials;if(!r.access_token&&!r.refresh_token&&!this.apiKey&&!this.refreshHandler)throw new Error("No access, refresh token, API key or refresh handler callback is set.");if(r.access_token&&!this.isTokenExpiring()){r.token_type=r.token_type||"Bearer";let l=new Headers({authorization:r.token_type+" "+r.access_token});return{headers:this.addSharedMetadataHeaders(l)}}if(this.refreshHandler){let l=await this.processAndValidateRefreshHandler();if(l?.access_token){this.setCredentials(l);let p=new Headers({authorization:"Bearer "+this.credentials.access_token});return{headers:this.addSharedMetadataHeaders(p)}}}if(this.apiKey)return{headers:new Headers({"X-Goog-Api-Key":this.apiKey})};let n=null,i=null;try{n=await this.refreshToken(r.refresh_token),i=n.tokens}catch(l){let p=l;throw p.response&&(p.response.status===403||p.response.status===404)&&(p.message=`Could not refresh access token: ${p.message}`),p}let u=this.credentials;u.token_type=u.token_type||"Bearer",i.refresh_token=u.refresh_token,this.credentials=i;let c=new Headers({authorization:u.token_type+" "+i.access_token});return{headers:this.addSharedMetadataHeaders(c),res:n.res}}static getRevokeTokenUrl(e){return new t().getRevokeTokenURL(e).toString()}getRevokeTokenURL(e){let r=new URL(this.endpoints.oauth2RevokeUrl);return r.searchParams.append("token",e),r}revokeToken(e,r){let n={...t.RETRY_CONFIG,url:this.getRevokeTokenURL(e).toString(),method:"POST"};if(qo.AuthClient.setMethodName(n,"revokeToken"),r)this.transporter.request(n).then(i=>r(null,i),r);else return this.transporter.request(n)}revokeCredentials(e){if(e)this.revokeCredentialsAsync().then(r=>e(null,r),e);else return this.revokeCredentialsAsync()}async revokeCredentialsAsync(){let e=this.credentials.access_token;if(this.credentials={},e)return this.revokeToken(e);throw new Error("No access token to revoke.")}request(e,r){if(r)this.requestAsync(e).then(n=>r(null,n),n=>r(n,n.response));else return this.requestAsync(e)}async requestAsync(e,r=!1){try{let n=await this.getRequestMetadataAsync();return e.headers=Xv.Gaxios.mergeHeaders(e.headers),this.addUserProjectAndAuthHeaders(e.headers,n.headers),this.apiKey&&e.headers.set("X-Goog-Api-Key",this.apiKey),await this.transporter.request(e)}catch(n){let i=n.response;if(i){let u=i.status,c=this.credentials&&this.credentials.access_token&&this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure),l=this.credentials&&this.credentials.access_token&&!this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure)&&this.refreshHandler,p=i.config.data instanceof VO.Readable,f=u===401||u===403;if(!r&&f&&!p&&c)return await this.refreshAccessTokenAsync(),this.requestAsync(e,!0);if(!r&&f&&!p&&l){let m=await this.processAndValidateRefreshHandler();return m?.access_token&&this.setCredentials(m),this.requestAsync(e,!0)}}throw n}}verifyIdToken(e,r){if(r&&typeof r!="function")throw new Error("This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.");if(r)this.verifyIdTokenAsync(e).then(n=>r(null,n),r);else return this.verifyIdTokenAsync(e)}async verifyIdTokenAsync(e){if(!e.idToken)throw new Error("The verifyIdToken method requires an ID Token");let r=await this.getFederatedSignonCertsAsync();return await this.verifySignedJwtWithCertsAsync(e.idToken,r.certs,e.audience,this.issuers,e.maxExpiry)}async getTokenInfo(e){let{data:r}=await this.transporter.request({...t.RETRY_CONFIG,method:"POST",headers:{"content-type":"application/x-www-form-urlencoded;charset=UTF-8",authorization:`Bearer ${e}`},url:this.endpoints.tokenInfoUrl.toString()}),n=Object.assign({expiry_date:new Date().getTime()+r.expires_in*1e3,scopes:r.scope.split(" ")},r);return delete n.expires_in,delete n.scope,n}getFederatedSignonCerts(e){if(e)this.getFederatedSignonCertsAsync().then(r=>e(null,r.certs,r.res),e);else return this.getFederatedSignonCertsAsync()}async getFederatedSignonCertsAsync(){let e=new Date().getTime(),r=(0,Td.hasBrowserCrypto)()?on.JWK:on.PEM;if(this.certificateExpiry&&e<this.certificateExpiry.getTime()&&this.certificateCacheFormat===r)return{certs:this.certificateCache,format:r};let n,i;switch(r){case on.PEM:i=this.endpoints.oauth2FederatedSignonPemCertsUrl.toString();break;case on.JWK:i=this.endpoints.oauth2FederatedSignonJwkCertsUrl.toString();break;default:throw new Error(`Unsupported certificate format ${r}`)}try{let f={...t.RETRY_CONFIG,url:i};qo.AuthClient.setMethodName(f,"getFederatedSignonCertsAsync"),n=await this.transporter.request(f)}catch(f){throw f instanceof Error&&(f.message=`Failed to retrieve verification certificates: ${f.message}`),f}let u=n?.headers.get("cache-control"),c=-1;if(u){let f=/max-age=(?<maxAge>[0-9]+)/.exec(u)?.groups?.maxAge;f&&(c=Number(f)*1e3)}let l={};switch(r){case on.PEM:l=n.data;break;case on.JWK:for(let f of n.data.keys)l[f.kid]=f;break;default:throw new Error(`Unsupported certificate format ${r}`)}let p=new Date;return this.certificateExpiry=c===-1?null:new Date(p.getTime()+c),this.certificateCache=l,this.certificateCacheFormat=r,{certs:l,format:r,res:n}}getIapPublicKeys(e){if(e)this.getIapPublicKeysAsync().then(r=>e(null,r.pubkeys,r.res),e);else return this.getIapPublicKeysAsync()}async getIapPublicKeysAsync(){let e,r=this.endpoints.oauth2IapPublicKeyUrl.toString();try{let n={...t.RETRY_CONFIG,url:r};qo.AuthClient.setMethodName(n,"getIapPublicKeysAsync"),e=await this.transporter.request(n)}catch(n){throw n instanceof Error&&(n.message=`Failed to retrieve verification certificates: ${n.message}`),n}return{pubkeys:e.data,res:e}}verifySignedJwtWithCerts(){throw new Error("verifySignedJwtWithCerts is removed, please use verifySignedJwtWithCertsAsync instead.")}async verifySignedJwtWithCertsAsync(e,r,n,i,u){let c=(0,Td.createCrypto)();u||(u=t.DEFAULT_MAX_TOKEN_LIFETIME_SECS_);let l=e.split(".");if(l.length!==3)throw new Error("Wrong number of segments in token: "+e);let p=l[0]+"."+l[1],f=l[2],m,g;try{m=JSON.parse(c.decodeBase64StringUtf8(l[0]))}catch(q){throw q instanceof Error&&(q.message=`Can't parse token envelope: ${l[0]}': ${q.message}`),q}if(!m)throw new Error("Can't parse token envelope: "+l[0]);try{g=JSON.parse(c.decodeBase64StringUtf8(l[1]))}catch(q){throw q instanceof Error&&(q.message=`Can't parse token payload '${l[0]}`),q}if(!g)throw new Error("Can't parse token payload: "+l[1]);if(!Object.prototype.hasOwnProperty.call(r,m.kid))throw new Error("No pem found for envelope: "+JSON.stringify(m));let S=r[m.kid];if(m.alg==="ES256"&&(f=HO.joseToDer(f,"ES256").toString("base64")),!await c.verify(S,p,f))throw new Error("Invalid token signature: "+e);if(!g.iat)throw new Error("No issue time in token: "+JSON.stringify(g));if(!g.exp)throw new Error("No expiration time in token: "+JSON.stringify(g));let _=Number(g.iat);if(isNaN(_))throw new Error("iat field using invalid format");let T=Number(g.exp);if(isNaN(T))throw new Error("exp field using invalid format");let E=new Date().getTime()/1e3;if(T>=E+u)throw new Error("Expiration time too far in future: "+JSON.stringify(g));let w=_-t.CLOCK_SKEW_SECS_,k=T+t.CLOCK_SKEW_SECS_;if(E<w)throw new Error("Token used too early, "+E+" < "+w+": "+JSON.stringify(g));if(E>k)throw new Error("Token used too late, "+E+" > "+k+": "+JSON.stringify(g));if(i&&i.indexOf(g.iss)<0)throw new Error("Invalid issuer, expected one of ["+i+"], but got "+g.iss);if(typeof n<"u"&&n!==null){let q=g.aud,G=!1;if(n.constructor===Array?G=n.indexOf(q)>-1:G=q===n,!G)throw new Error("Wrong recipient, payload audience != requiredAudience")}return new GO.LoginTicket(m,g)}async processAndValidateRefreshHandler(){if(this.refreshHandler){let e=await this.refreshHandler();if(!e.access_token)throw new Error("No access token is returned by the refreshHandler callback.");return e}}isTokenExpiring(){let e=this.credentials.expiry_date;return e?e<=new Date().getTime()+this.eagerRefreshThresholdMillis:!1}};zr.OAuth2Client=wd});var Ad=M(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});iu.Compute=void 0;var WO=yt(),rE=Yi(),ZO=eo(),xd=class extends ZO.OAuth2Client{static{o(this,"Compute")}serviceAccountEmail;scopes;constructor(e={}){super(e),this.credentials={expiry_date:1,refresh_token:"compute-placeholder"},this.serviceAccountEmail=e.serviceAccountEmail||"default",this.scopes=Array.isArray(e.scopes)?e.scopes:e.scopes?[e.scopes]:[]}async refreshTokenNoCache(){let e=`service-accounts/${this.serviceAccountEmail}/token`,r;try{let i={property:e};this.scopes.length>0&&(i.params={scopes:this.scopes.join(",")}),r=await rE.instance(i)}catch(i){throw i instanceof WO.GaxiosError&&(i.message=`Could not refresh access token: ${i.message}`,this.wrapError(i)),i}let n=r;return r&&r.expires_in&&(n.expiry_date=new Date().getTime()+r.expires_in*1e3,delete n.expires_in),this.emit("tokens",n),{tokens:n,res:null}}async fetchIdToken(e){let r=`service-accounts/${this.serviceAccountEmail}/identity?format=full&audience=${e}`,n;try{let i={property:r};n=await rE.instance(i)}catch(i){throw i instanceof Error&&(i.message=`Could not fetch ID token: ${i.message}`),i}return n}wrapError(e){let r=e.response;r&&r.status&&(e.status=r.status,r.status===403?e.message="A Forbidden error was returned while attempting to retrieve an access token for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have the correct permission scopes specified: "+e.message:r.status===404&&(e.message="A Not Found error was returned while attempting to retrieve an accesstoken for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have any permission scopes specified: "+e.message))}};iu.Compute=xd});var Rd=M(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.IdTokenClient=void 0;var JO=eo(),Id=class extends JO.OAuth2Client{static{o(this,"IdTokenClient")}targetAudience;idTokenProvider;constructor(e){super(e),this.targetAudience=e.targetAudience,this.idTokenProvider=e.idTokenProvider}async getRequestMetadataAsync(){if(!this.credentials.id_token||!this.credentials.expiry_date||this.isTokenExpiring()){let r=await this.idTokenProvider.fetchIdToken(this.targetAudience);this.credentials={id_token:r,expiry_date:this.getIdTokenExpiryDate(r)}}return{headers:new Headers({authorization:"Bearer "+this.credentials.id_token})}}getIdTokenExpiryDate(e){let r=e.split(".")[1];if(r)return JSON.parse(Buffer.from(r,"base64").toString("ascii")).exp*1e3}};au.IdTokenClient=Id});var Cd=M(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.GCPEnv=void 0;Vo.clear=KO;Vo.getEnv=QO;var nE=Yi(),Dr;(function(t){t.APP_ENGINE="APP_ENGINE",t.KUBERNETES_ENGINE="KUBERNETES_ENGINE",t.CLOUD_FUNCTIONS="CLOUD_FUNCTIONS",t.COMPUTE_ENGINE="COMPUTE_ENGINE",t.CLOUD_RUN="CLOUD_RUN",t.CLOUD_RUN_JOBS="CLOUD_RUN_JOBS",t.NONE="NONE"})(Dr||(Vo.GCPEnv=Dr={}));var ta;function KO(){ta=void 0}o(KO,"clear");async function QO(){return ta||(ta=YO(),ta)}o(QO,"getEnv");async function YO(){let t=Dr.NONE;return XO()?t=Dr.APP_ENGINE:ek()?t=Dr.CLOUD_FUNCTIONS:await ok()?await nk()?t=Dr.KUBERNETES_ENGINE:tk()?t=Dr.CLOUD_RUN:rk()?t=Dr.CLOUD_RUN_JOBS:t=Dr.COMPUTE_ENGINE:t=Dr.NONE,t}o(YO,"getEnvMemoized");function XO(){return!!(process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME)}o(XO,"isAppEngine");function ek(){return!!(process.env.FUNCTION_NAME||process.env.FUNCTION_TARGET)}o(ek,"isCloudFunction");function tk(){return!!process.env.K_CONFIGURATION}o(tk,"isCloudRun");function rk(){return!!process.env.CLOUD_RUN_JOB}o(rk,"isCloudRunJob");async function nk(){try{return await nE.instance("attributes/cluster-name"),!0}catch{return!1}}o(nk,"isKubernetesEngine");async function ok(){return nE.isAvailable()}o(ok,"isComputeEngine")});var Od=M((QJ,oE)=>{var su=Bo().Buffer,ik=require("stream"),ak=require("util");function uu(t){if(this.buffer=null,this.writable=!0,this.readable=!0,!t)return this.buffer=su.alloc(0),this;if(typeof t.pipe=="function")return this.buffer=su.alloc(0),t.pipe(this),this;if(t.length||typeof t=="object")return this.buffer=t,this.writable=!1,process.nextTick(function(){this.emit("end",t),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof t+")")}o(uu,"DataStream");ak.inherits(uu,ik);uu.prototype.write=o(function(e){this.buffer=su.concat([this.buffer,su.from(e)]),this.emit("data",e)},"write");uu.prototype.end=o(function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1},"end");oE.exports=uu});var aE=M((XJ,iE)=>{"use strict";var ra=require("buffer").Buffer,kd=require("buffer").SlowBuffer;iE.exports=cu;function cu(t,e){if(!ra.isBuffer(t)||!ra.isBuffer(e)||t.length!==e.length)return!1;for(var r=0,n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}o(cu,"bufferEq");cu.install=function(){ra.prototype.equal=kd.prototype.equal=o(function(e){return cu(this,e)},"equal")};var sk=ra.prototype.equal,uk=kd.prototype.equal;cu.restore=function(){ra.prototype.equal=sk,kd.prototype.equal=uk}});var Dd=M((t3,hE)=>{var Go=Bo().Buffer,sr=require("crypto"),uE=hd(),sE=require("util"),ck=`"%s" is not a valid algorithm.
37
+ `+T+"}":"{"+E.join(",")+"}",n=T,h}}o(p,"str"),typeof yv.stringify!="function"&&(yv.stringify=function(f,m,y){var P;if(n="",i="",typeof y=="number")for(P=0;P<y;P+=1)i+=" ";else typeof y=="string"&&(i=y);if(c=m,m&&typeof m!="function"&&(typeof m!="object"||typeof m.length!="number"))throw new Error("JSON.stringify");return p("",{"":f})})})()});var Ev=L(($J,vv)=>{var Zs=null,BC=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,qC=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/,VC=o(function(t){"use strict";var e={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(t!=null){if(t.strict===!0&&(e.strict=!0),t.storeAsString===!0&&(e.storeAsString=!0),e.alwaysParseAsBig=t.alwaysParseAsBig===!0?t.alwaysParseAsBig:!1,e.useNativeBigInt=t.useNativeBigInt===!0?t.useNativeBigInt:!1,typeof t.constructorAction<"u")if(t.constructorAction==="error"||t.constructorAction==="ignore"||t.constructorAction==="preserve")e.constructorAction=t.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${t.constructorAction}`);if(typeof t.protoAction<"u")if(t.protoAction==="error"||t.protoAction==="ignore"||t.protoAction==="preserve")e.protoAction=t.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${t.protoAction}`)}var r,n,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
38
+ `,r:"\r",t:" "},u,c=o(function(T){throw{name:"SyntaxError",message:T,at:r,text:u}},"error"),l=o(function(T){return T&&T!==n&&c("Expected '"+T+"' instead of '"+n+"'"),n=u.charAt(r),r+=1,n},"next"),p=o(function(){var T,E="";for(n==="-"&&(E="-",l("-"));n>="0"&&n<="9";)E+=n,l();if(n===".")for(E+=".";l()&&n>="0"&&n<="9";)E+=n;if(n==="e"||n==="E")for(E+=n,l(),(n==="-"||n==="+")&&(E+=n,l());n>="0"&&n<="9";)E+=n,l();if(T=+E,!isFinite(T))c("Bad number");else return Zs==null&&(Zs=ed()),E.length>15?e.storeAsString?E:e.useNativeBigInt?BigInt(E):new Zs(E):e.alwaysParseAsBig?e.useNativeBigInt?BigInt(T):new Zs(T):T},"number"),f=o(function(){var T,E,w="",k;if(n==='"')for(var q=r;l();){if(n==='"')return r-1>q&&(w+=u.substring(q,r-1)),l(),w;if(n==="\\"){if(r-1>q&&(w+=u.substring(q,r-1)),l(),n==="u"){for(k=0,E=0;E<4&&(T=parseInt(l(),16),!!isFinite(T));E+=1)k=k*16+T;w+=String.fromCharCode(k)}else if(typeof i[n]=="string")w+=i[n];else break;q=r}}c("Bad string")},"string"),m=o(function(){for(;n&&n<=" ";)l()},"white"),y=o(function(){switch(n){case"t":return l("t"),l("r"),l("u"),l("e"),!0;case"f":return l("f"),l("a"),l("l"),l("s"),l("e"),!1;case"n":return l("n"),l("u"),l("l"),l("l"),null}c("Unexpected '"+n+"'")},"word"),P,h=o(function(){var T=[];if(n==="["){if(l("["),m(),n==="]")return l("]"),T;for(;n;){if(T.push(P()),m(),n==="]")return l("]"),T;l(","),m()}}c("Bad array")},"array"),b=o(function(){var T,E=Object.create(null);if(n==="{"){if(l("{"),m(),n==="}")return l("}"),E;for(;n;){if(T=f(),m(),l(":"),e.strict===!0&&Object.hasOwnProperty.call(E,T)&&c('Duplicate key "'+T+'"'),BC.test(T)===!0?e.protoAction==="error"?c("Object contains forbidden prototype property"):e.protoAction==="ignore"?P():E[T]=P():qC.test(T)===!0?e.constructorAction==="error"?c("Object contains forbidden constructor property"):e.constructorAction==="ignore"?P():E[T]=P():E[T]=P(),m(),n==="}")return l("}"),E;l(","),m()}}c("Bad object")},"object");return P=o(function(){switch(m(),n){case"{":return b();case"[":return h();case'"':return f();case"-":return p();default:return n>="0"&&n<="9"?p():y()}},"value"),function(T,E){var w;return u=T+"",r=0,n=" ",w=P(),m(),n&&c("Syntax error"),typeof E=="function"?o((function k(q,W){var H,V,J=q[W];return J&&typeof J=="object"&&Object.keys(J).forEach(function(re){V=k(J,re),V!==void 0?J[re]=V:delete J[re]}),E.call(q,W,J)}),"walk")({"":w},""):w}},"json_parse");vv.exports=VC});var Tv=L((NJ,Js)=>{var Pv=bv().stringify,Sv=Ev();Js.exports=function(t){return{parse:Sv(t),stringify:Pv}};Js.exports.parse=Sv();Js.exports.stringify=Pv});var td=L(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.GCE_LINUX_BIOS_PATHS=void 0;_r.isGoogleCloudServerless=Av;_r.isGoogleComputeEngineLinux=Iv;_r.isGoogleComputeEngineMACAddress=Rv;_r.isGoogleComputeEngine=Cv;_r.detectGCPResidency=GC;var wv=require("fs"),xv=require("os");_r.GCE_LINUX_BIOS_PATHS={BIOS_DATE:"/sys/class/dmi/id/bios_date",BIOS_VENDOR:"/sys/class/dmi/id/bios_vendor"};var HC=/^42:01/;function Av(){return!!(process.env.CLOUD_RUN_JOB||process.env.FUNCTION_NAME||process.env.K_SERVICE)}o(Av,"isGoogleCloudServerless");function Iv(){if((0,xv.platform)()!=="linux")return!1;try{(0,wv.statSync)(_r.GCE_LINUX_BIOS_PATHS.BIOS_DATE);let t=(0,wv.readFileSync)(_r.GCE_LINUX_BIOS_PATHS.BIOS_VENDOR,"utf8");return/Google/.test(t)}catch{return!1}}o(Iv,"isGoogleComputeEngineLinux");function Rv(){let t=(0,xv.networkInterfaces)();for(let e of Object.values(t))if(e){for(let{mac:r}of e)if(HC.test(r))return!0}return!1}o(Rv,"isGoogleComputeEngineMACAddress");function Cv(){return Iv()||Rv()}o(Cv,"isGoogleComputeEngine");function GC(){return Av()||Cv()}o(GC,"detectGCPResidency")});var Ov=L(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.Colours=void 0;var Et=class t{static{o(this,"Colours")}static isEnabled(e){return e&&e.isTTY&&(typeof e.getColorDepth=="function"?e.getColorDepth()>2:!0)}static refresh(){t.enabled=t.isEnabled(process==null?void 0:process.stderr),this.enabled?(t.reset="\x1B[0m",t.bright="\x1B[1m",t.dim="\x1B[2m",t.red="\x1B[31m",t.green="\x1B[32m",t.yellow="\x1B[33m",t.blue="\x1B[34m",t.magenta="\x1B[35m",t.cyan="\x1B[36m",t.white="\x1B[37m",t.grey="\x1B[90m"):(t.reset="",t.bright="",t.dim="",t.red="",t.green="",t.yellow="",t.blue="",t.magenta="",t.cyan="",t.white="",t.grey="")}};Ks.Colours=Et;Et.enabled=!1;Et.reset="";Et.bright="";Et.dim="";Et.red="";Et.green="";Et.yellow="";Et.blue="";Et.magenta="";Et.cyan="";Et.white="";Et.grey="";Et.refresh()});var Nv=L(Le=>{"use strict";var WC=Le&&Le.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),ZC=Le&&Le.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),kv=Le&&Le.__importStar||(function(){var t=o(function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&WC(r,e,n[i]);return ZC(r,e),r}})();Object.defineProperty(Le,"__esModule",{value:!0});Le.env=Le.DebugLogBackendBase=Le.placeholder=Le.AdhocDebugLogger=Le.LogSeverity=void 0;Le.getNodeBackend=nd;Le.getDebugBackend=KC;Le.getStructuredBackend=QC;Le.setBackend=YC;Le.log=zv;var JC=require("events"),Ki=kv(require("process")),$v=kv(require("util")),Gt=Ov(),br;(function(t){t.DEFAULT="DEFAULT",t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR"})(br||(Le.LogSeverity=br={}));var Qi=class extends JC.EventEmitter{static{o(this,"AdhocDebugLogger")}constructor(e,r){super(),this.namespace=e,this.upstream=r,this.func=Object.assign(this.invoke.bind(this),{instance:this,on:o((n,i)=>this.on(n,i),"on")}),this.func.debug=(...n)=>this.invokeSeverity(br.DEBUG,...n),this.func.info=(...n)=>this.invokeSeverity(br.INFO,...n),this.func.warn=(...n)=>this.invokeSeverity(br.WARNING,...n),this.func.error=(...n)=>this.invokeSeverity(br.ERROR,...n),this.func.sublog=n=>zv(n,this.func)}invoke(e,...r){if(this.upstream)try{this.upstream(e,...r)}catch{}try{this.emit("log",e,r)}catch{}}invokeSeverity(e,...r){this.invoke({severity:e},...r)}};Le.AdhocDebugLogger=Qi;Le.placeholder=new Qi("",()=>{}).func;var Lo=class{static{o(this,"DebugLogBackendBase")}constructor(){var e;this.cached=new Map,this.filters=[],this.filtersSet=!1;let r=(e=Ki.env[Le.env.nodeEnables])!==null&&e!==void 0?e:"*";r==="all"&&(r="*"),this.filters=r.split(",")}log(e,r,...n){try{this.filtersSet||(this.setFilters(),this.filtersSet=!0);let i=this.cached.get(e);i||(i=this.makeLogger(e),this.cached.set(e,i)),i(r,...n)}catch(i){console.error(i)}}};Le.DebugLogBackendBase=Lo;var rd=class extends Lo{static{o(this,"NodeBackend")}constructor(){super(...arguments),this.enabledRegexp=/.*/g}isEnabled(e){return this.enabledRegexp.test(e)}makeLogger(e){return this.enabledRegexp.test(e)?(r,...n)=>{var i;let u=`${Gt.Colours.green}${e}${Gt.Colours.reset}`,c=`${Gt.Colours.yellow}${Ki.pid}${Gt.Colours.reset}`,l;switch(r.severity){case br.ERROR:l=`${Gt.Colours.red}${r.severity}${Gt.Colours.reset}`;break;case br.INFO:l=`${Gt.Colours.magenta}${r.severity}${Gt.Colours.reset}`;break;case br.WARNING:l=`${Gt.Colours.yellow}${r.severity}${Gt.Colours.reset}`;break;default:l=(i=r.severity)!==null&&i!==void 0?i:br.DEFAULT;break}let p=$v.formatWithOptions({colors:Gt.Colours.enabled},...n),f=Object.assign({},r);delete f.severity;let m=Object.getOwnPropertyNames(f).length?JSON.stringify(f):"",y=m?`${Gt.Colours.grey}${m}${Gt.Colours.reset}`:"";console.error("%s [%s|%s] %s%s",c,u,l,p,m?` ${y}`:"")}:()=>{}}setFilters(){let r=this.filters.join(",").replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=new RegExp(`^${r}$`,"i")}};function nd(){return new rd}o(nd,"getNodeBackend");var od=class extends Lo{static{o(this,"DebugBackend")}constructor(e){super(),this.debugPkg=e}makeLogger(e){let r=this.debugPkg(e);return(n,...i)=>{r(i[0],...i.slice(1))}}setFilters(){var e;let r=(e=Ki.env.NODE_DEBUG)!==null&&e!==void 0?e:"";Ki.env.NODE_DEBUG=`${r}${r?",":""}${this.filters.join(",")}`}};function KC(t){return new od(t)}o(KC,"getDebugBackend");var id=class extends Lo{static{o(this,"StructuredBackend")}constructor(e){var r;super(),this.upstream=(r=e)!==null&&r!==void 0?r:void 0}makeLogger(e){var r;let n=(r=this.upstream)===null||r===void 0?void 0:r.makeLogger(e);return(i,...u)=>{var c;let l=(c=i.severity)!==null&&c!==void 0?c:br.INFO,p=Object.assign({severity:l,message:$v.format(...u)},i),f=JSON.stringify(p);n?n(i,f):console.log("%s",f)}}setFilters(){var e;(e=this.upstream)===null||e===void 0||e.setFilters()}};function QC(t){return new id(t)}o(QC,"getStructuredBackend");Le.env={nodeEnables:"GOOGLE_SDK_NODE_LOGGING"};var ad=new Map,Wt;function YC(t){Wt=t,ad.clear()}o(YC,"setBackend");function zv(t,e){if(!Wt&&!Ki.env[Le.env.nodeEnables]||!t)return Le.placeholder;e&&(t=`${e.instance.namespace}:${t}`);let r=ad.get(t);if(r)return r.func;if(Wt===null)return Le.placeholder;Wt===void 0&&(Wt=nd());let n=(()=>{let i;return new Qi(t,(c,...l)=>{if(i!==Wt){if(Wt===null)return;Wt===void 0&&(Wt=nd()),i=Wt}Wt?.log(t,c,...l)})})();return ad.set(t,n),n.func}o(zv,"log")});var sd=L(Qn=>{"use strict";var XC=Qn&&Qn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),eO=Qn&&Qn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&XC(e,t,r)};Object.defineProperty(Qn,"__esModule",{value:!0});eO(Nv(),Qn)});var Xi=L(se=>{"use strict";var Uv=se&&se.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),tO=se&&se.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),rO=se&&se.__importStar||(function(){var t=o(function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&Uv(r,e,n[i]);return tO(r,e),r}})(),nO=se&&se.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Uv(e,t,r)};Object.defineProperty(se,"__esModule",{value:!0});se.gcpResidencyCache=se.METADATA_SERVER_DETECTION=se.HEADERS=se.HEADER_VALUE=se.HEADER_NAME=se.SECONDARY_HOST_ADDRESS=se.HOST_ADDRESS=se.BASE_PATH=void 0;se.instance=cO;se.project=lO;se.universe=dO;se.bulk=pO;se.isAvailable=mO;se.resetIsAvailableCache=hO;se.getGCPResidency=ld;se.setGCPResidency=jv;se.requestTimeout=Mv;var ud=_t(),oO=Tv(),iO=td(),aO=rO(sd());se.BASE_PATH="/computeMetadata/v1";se.HOST_ADDRESS="http://169.254.169.254";se.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.";se.HEADER_NAME="Metadata-Flavor";se.HEADER_VALUE="Google";se.HEADERS=Object.freeze({[se.HEADER_NAME]:se.HEADER_VALUE});var Dv=aO.log("gcp-metadata");se.METADATA_SERVER_DETECTION=Object.freeze({"assume-present":"don't try to ping the metadata server, but assume it's present",none:"don't try to ping the metadata server, but don't try to use it either","bios-only":"treat the result of a BIOS probe as canonical (don't fall back to pinging)","ping-only":"skip the BIOS probe, and go straight to pinging"});function cd(t){return t||(t=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||se.HOST_ADDRESS),/^https?:\/\//.test(t)||(t=`http://${t}`),new URL(se.BASE_PATH,t).href}o(cd,"getBaseUrl");function sO(t){Object.keys(t).forEach(e=>{switch(e){case"params":case"property":case"headers":break;case"qs":throw new Error("'qs' is not a valid configuration option. Please use 'params' instead.");default:throw new Error(`'${e}' is not a valid configuration option.`)}})}o(sO,"validate");async function Yi(t,e={},r=3,n=!1){let i=new Headers(se.HEADERS),u="",c={};if(typeof t=="object"){let y=t;new Headers(y.headers).forEach((P,h)=>i.set(h,P)),u=y.metadataKey,c=y.params||c,r=y.noResponseRetries||r,n=y.fastFail||n}else u=t;typeof e=="string"?u+=`/${e}`:(sO(e),e.property&&(u+=`/${e.property}`),new Headers(e.headers).forEach((y,P)=>i.set(P,y)),c=e.params||c);let l=n?uO:ud.request,p={url:`${cd()}/${u}`,headers:i,retryConfig:{noResponseRetries:r},params:c,responseType:"text",timeout:Mv()};Dv.info("instance request %j",p);let f=await l(p);Dv.info("instance metadata is %s",f.data);let m=f.headers.get(se.HEADER_NAME);if(m!==se.HEADER_VALUE)throw new RangeError(`Invalid response from metadata service: incorrect ${se.HEADER_NAME} header. Expected '${se.HEADER_VALUE}', got ${m?`'${m}'`:"no header"}`);if(typeof f.data=="string")try{return oO.parse(f.data)}catch{}return f.data}o(Yi,"metadataAccessor");async function uO(t){let e={...t,url:t.url?.toString().replace(cd(),cd(se.SECONDARY_HOST_ADDRESS))},r=(0,ud.request)(t),n=(0,ud.request)(e);return Promise.any([r,n])}o(uO,"fastFailMetadataRequest");function cO(t){return Yi("instance",t)}o(cO,"instance");function lO(t){return Yi("project",t)}o(lO,"project");function dO(t){return Yi("universe",t)}o(dO,"universe");async function pO(t){let e={};return await Promise.all(t.map(r=>(async()=>{let n=await Yi(r),i=r.metadataKey;e[i]=n})())),e}o(pO,"bulk");function fO(){return process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0}o(fO,"detectGCPAvailableRetries");var Qs;async function mO(){if(process.env.METADATA_SERVER_DETECTION){let t=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(t in se.METADATA_SERVER_DETECTION))throw new RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${t}\`, but it should be \`${Object.keys(se.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`);switch(t){case"assume-present":return!0;case"none":return!1;case"bios-only":return ld();case"ping-only":}}try{return Qs===void 0&&(Qs=Yi("instance",void 0,fO(),!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST))),await Qs,!0}catch(t){let e=t;if(process.env.DEBUG_AUTH&&console.info(e),e.type==="request-timeout"||e.response&&e.response.status===404)return!1;if(!(e.response&&e.response.status===404)&&(!e.code||!["EHOSTDOWN","EHOSTUNREACH","ENETUNREACH","ENOENT","ENOTFOUND","ECONNREFUSED"].includes(e.code.toString()))){let r="UNKNOWN";e.code&&(r=e.code.toString()),process.emitWarning(`received unexpected error = ${e.message} code = ${r}`,"MetadataLookupWarning")}return!1}}o(mO,"isAvailable");function hO(){Qs=void 0}o(hO,"resetIsAvailableCache");se.gcpResidencyCache=null;function ld(){return se.gcpResidencyCache===null&&jv(),se.gcpResidencyCache}o(ld,"getGCPResidency");function jv(t=null){se.gcpResidencyCache=t!==null?t:(0,iO.detectGCPResidency)()}o(jv,"setGCPResidency");function Mv(){return ld()?0:3e3}o(Mv,"requestTimeout");nO(td(),se)});var Bv=L(Ys=>{"use strict";Ys.byteLength=yO;Ys.toByteArray=bO;Ys.fromByteArray=PO;var $r=[],ar=[],gO=typeof Uint8Array<"u"?Uint8Array:Array,dd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Yn=0,Lv=dd.length;Yn<Lv;++Yn)$r[Yn]=dd[Yn],ar[dd.charCodeAt(Yn)]=Yn;var Yn,Lv;ar[45]=62;ar[95]=63;function Fv(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}o(Fv,"getLens");function yO(t){var e=Fv(t),r=e[0],n=e[1];return(r+n)*3/4-n}o(yO,"byteLength");function _O(t,e,r){return(e+r)*3/4-r}o(_O,"_byteLength");function bO(t){var e,r=Fv(t),n=r[0],i=r[1],u=new gO(_O(t,n,i)),c=0,l=i>0?n-4:n,p;for(p=0;p<l;p+=4)e=ar[t.charCodeAt(p)]<<18|ar[t.charCodeAt(p+1)]<<12|ar[t.charCodeAt(p+2)]<<6|ar[t.charCodeAt(p+3)],u[c++]=e>>16&255,u[c++]=e>>8&255,u[c++]=e&255;return i===2&&(e=ar[t.charCodeAt(p)]<<2|ar[t.charCodeAt(p+1)]>>4,u[c++]=e&255),i===1&&(e=ar[t.charCodeAt(p)]<<10|ar[t.charCodeAt(p+1)]<<4|ar[t.charCodeAt(p+2)]>>2,u[c++]=e>>8&255,u[c++]=e&255),u}o(bO,"toByteArray");function vO(t){return $r[t>>18&63]+$r[t>>12&63]+$r[t>>6&63]+$r[t&63]}o(vO,"tripletToBase64");function EO(t,e,r){for(var n,i=[],u=e;u<r;u+=3)n=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(t[u+2]&255),i.push(vO(n));return i.join("")}o(EO,"encodeChunk");function PO(t){for(var e,r=t.length,n=r%3,i=[],u=16383,c=0,l=r-n;c<l;c+=u)i.push(EO(t,c,c+u>l?l:c+u));return n===1?(e=t[r-1],i.push($r[e>>2]+$r[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push($r[e>>10]+$r[e>>4&63]+$r[e<<2&63]+"=")),i.join("")}o(PO,"fromByteArray")});var fd=L(pd=>{"use strict";Object.defineProperty(pd,"__esModule",{value:!0});pd.fromArrayBufferToHex=SO;function SO(t){return Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join("")}o(SO,"fromArrayBufferToHex")});var qv=L(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.BrowserCrypto=void 0;var Fo=Bv(),TO=fd(),md=class t{static{o(this,"BrowserCrypto")}constructor(){if(typeof window>"u"||window.crypto===void 0||window.crypto.subtle===void 0)throw new Error("SubtleCrypto not found. Make sure it's an https:// website.")}async sha256DigestBase64(e){let r=new TextEncoder().encode(e),n=await window.crypto.subtle.digest("SHA-256",r);return Fo.fromByteArray(new Uint8Array(n))}randomBytesBase64(e){let r=new Uint8Array(e);return window.crypto.getRandomValues(r),Fo.fromByteArray(r)}static padBase64(e){for(;e.length%4!==0;)e+="=";return e}async verify(e,r,n){let i={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},u=new TextEncoder().encode(r),c=Fo.toByteArray(t.padBase64(n)),l=await window.crypto.subtle.importKey("jwk",e,i,!0,["verify"]);return await window.crypto.subtle.verify(i,l,c,u)}async sign(e,r){let n={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},i=new TextEncoder().encode(r),u=await window.crypto.subtle.importKey("jwk",e,n,!0,["sign"]),c=await window.crypto.subtle.sign(n,u,i);return Fo.fromByteArray(new Uint8Array(c))}decodeBase64StringUtf8(e){let r=Fo.toByteArray(t.padBase64(e));return new TextDecoder().decode(r)}encodeBase64StringUtf8(e){let r=new TextEncoder().encode(e);return Fo.fromByteArray(r)}async sha256DigestHex(e){let r=new TextEncoder().encode(e),n=await window.crypto.subtle.digest("SHA-256",r);return(0,TO.fromArrayBufferToHex)(n)}async signWithHmacSha256(e,r){let n=typeof e=="string"?e:String.fromCharCode(...new Uint16Array(e)),i=new TextEncoder,u=await window.crypto.subtle.importKey("raw",i.encode(n),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return window.crypto.subtle.sign("HMAC",u,i.encode(r))}};Xs.BrowserCrypto=md});var Vv=L(eu=>{"use strict";Object.defineProperty(eu,"__esModule",{value:!0});eu.NodeCrypto=void 0;var Bo=require("crypto"),hd=class{static{o(this,"NodeCrypto")}async sha256DigestBase64(e){return Bo.createHash("sha256").update(e).digest("base64")}randomBytesBase64(e){return Bo.randomBytes(e).toString("base64")}async verify(e,r,n){let i=Bo.createVerify("RSA-SHA256");return i.update(r),i.end(),i.verify(e,n,"base64")}async sign(e,r){let n=Bo.createSign("RSA-SHA256");return n.update(r),n.end(),n.sign(e,"base64")}decodeBase64StringUtf8(e){return Buffer.from(e,"base64").toString("utf-8")}encodeBase64StringUtf8(e){return Buffer.from(e,"utf-8").toString("base64")}async sha256DigestHex(e){return Bo.createHash("sha256").update(e).digest("hex")}async signWithHmacSha256(e,r){let n=typeof e=="string"?e:xO(e);return wO(Bo.createHmac("sha256",n).update(r).digest())}};eu.NodeCrypto=hd;function wO(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}o(wO,"toArrayBuffer");function xO(t){return Buffer.from(t)}o(xO,"toBuffer")});var ea=L(rn=>{"use strict";var AO=rn&&rn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[r]},"get")}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),IO=rn&&rn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&AO(e,t,r)};Object.defineProperty(rn,"__esModule",{value:!0});rn.createCrypto=OO;rn.hasBrowserCrypto=Hv;var RO=qv(),CO=Vv();IO(fd(),rn);function OO(){return Hv()?new RO.BrowserCrypto:new CO.NodeCrypto}o(OO,"createCrypto");function Hv(){return typeof window<"u"&&typeof window.crypto<"u"&&typeof window.crypto.subtle<"u"}o(Hv,"hasBrowserCrypto")});var qo=L((gd,Wv)=>{var tu=require("buffer"),zr=tu.Buffer;function Gv(t,e){for(var r in t)e[r]=t[r]}o(Gv,"copyProps");zr.from&&zr.alloc&&zr.allocUnsafe&&zr.allocUnsafeSlow?Wv.exports=tu:(Gv(tu,gd),gd.Buffer=Xn);function Xn(t,e,r){return zr(t,e,r)}o(Xn,"SafeBuffer");Xn.prototype=Object.create(zr.prototype);Gv(zr,Xn);Xn.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return zr(t,e,r)};Xn.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=zr(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Xn.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return zr(t)};Xn.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return tu.SlowBuffer(t)}});var Jv=L((n3,Zv)=>{"use strict";function yd(t){var e=(t/8|0)+(t%8===0?0:1);return e}o(yd,"getParamSize");var kO={ES256:yd(256),ES384:yd(384),ES512:yd(521)};function $O(t){var e=kO[t];if(e)return e;throw new Error('Unknown algorithm "'+t+'"')}o($O,"getParamBytesForAlg");Zv.exports=$O});var _d=L((i3,tE)=>{"use strict";var ru=qo().Buffer,Qv=Jv(),nu=128,Yv=0,zO=32,NO=16,DO=2,Xv=NO|zO|Yv<<6,ou=DO|Yv<<6;function UO(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}o(UO,"base64Url");function eE(t){if(ru.isBuffer(t))return t;if(typeof t=="string")return ru.from(t,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}o(eE,"signatureAsBuffer");function jO(t,e){t=eE(t);var r=Qv(e),n=r+1,i=t.length,u=0;if(t[u++]!==Xv)throw new Error('Could not find expected "seq"');var c=t[u++];if(c===(nu|1)&&(c=t[u++]),i-u<c)throw new Error('"seq" specified length of "'+c+'", only "'+(i-u)+'" remaining');if(t[u++]!==ou)throw new Error('Could not find expected "int" for "r"');var l=t[u++];if(i-u-2<l)throw new Error('"r" specified length of "'+l+'", only "'+(i-u-2)+'" available');if(n<l)throw new Error('"r" specified length of "'+l+'", max of "'+n+'" is acceptable');var p=u;if(u+=l,t[u++]!==ou)throw new Error('Could not find expected "int" for "s"');var f=t[u++];if(i-u!==f)throw new Error('"s" specified length of "'+f+'", expected "'+(i-u)+'"');if(n<f)throw new Error('"s" specified length of "'+f+'", max of "'+n+'" is acceptable');var m=u;if(u+=f,u!==i)throw new Error('Expected to consume entire buffer, but "'+(i-u)+'" bytes remain');var y=r-l,P=r-f,h=ru.allocUnsafe(y+l+P+f);for(u=0;u<y;++u)h[u]=0;t.copy(h,u,p+Math.max(-y,0),p+l),u=r;for(var b=u;u<b+P;++u)h[u]=0;return t.copy(h,u,m+Math.max(-P,0),m+f),h=h.toString("base64"),h=UO(h),h}o(jO,"derToJose");function Kv(t,e,r){for(var n=0;e+n<r&&t[e+n]===0;)++n;var i=t[e+n]>=nu;return i&&--n,n}o(Kv,"countPadding");function MO(t,e){t=eE(t);var r=Qv(e),n=t.length;if(n!==r*2)throw new TypeError('"'+e+'" signatures must be "'+r*2+'" bytes, saw "'+n+'"');var i=Kv(t,0,r),u=Kv(t,r,t.length),c=r-i,l=r-u,p=2+c+1+1+l,f=p<nu,m=ru.allocUnsafe((f?2:3)+p),y=0;return m[y++]=Xv,f?m[y++]=p:(m[y++]=nu|1,m[y++]=p&255),m[y++]=ou,m[y++]=c,i<0?(m[y++]=0,y+=t.copy(m,y,0,r)):y+=t.copy(m,y,i,r),m[y++]=ou,m[y++]=l,u<0?(m[y++]=0,t.copy(m,y,r)):t.copy(m,y,r+u),m}o(MO,"joseToDer");tE.exports={derToJose:jO,joseToDer:MO}});var vr=L(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.LRUCache=void 0;nn.snakeToCamel=nE;nn.originalOrCamelOptions=qO;nn.removeUndefinedValuesInObject=VO;nn.isValidFile=HO;nn.getWellKnownCertificateConfigFileLocation=GO;var LO=require("fs"),FO=require("os"),bd=require("path"),BO="certificate_config.json",rE="gcloud";function nE(t){return t.replace(/([_][^_])/g,e=>e.slice(1).toUpperCase())}o(nE,"snakeToCamel");function qO(t){function e(r){let n=t||{};return n[r]??n[nE(r)]}return o(e,"get"),{get:e}}o(qO,"originalOrCamelOptions");var vd=class{static{o(this,"LRUCache")}capacity;#e=new Map;maxAge;constructor(e){this.capacity=e.capacity,this.maxAge=e.maxAge}#t(e,r){this.#e.delete(e),this.#e.set(e,{value:r,lastAccessed:Date.now()})}set(e,r){this.#t(e,r),this.#r()}get(e){let r=this.#e.get(e);if(r)return this.#t(e,r.value),this.#r(),r.value}#r(){let e=this.maxAge?Date.now()-this.maxAge:0,r=this.#e.entries().next();for(;!r.done&&(this.#e.size>this.capacity||r.value[1].lastAccessed<e);)this.#e.delete(r.value[0]),r=this.#e.entries().next()}};nn.LRUCache=vd;function VO(t){return Object.entries(t).forEach(([e,r])=>{(r===void 0||r==="undefined")&&delete t[e]}),t}o(VO,"removeUndefinedValuesInObject");async function HO(t){try{return(await LO.promises.lstat(t)).isFile()}catch{return!1}}o(HO,"isValidFile");function GO(){let t=process.env.CLOUDSDK_CONFIG||(WO()?bd.join(process.env.APPDATA||"",rE):bd.join(process.env.HOME||"",".config",rE));return bd.join(t,BO)}o(GO,"getWellKnownCertificateConfigFileLocation");function WO(){return FO.platform().startsWith("win")}o(WO,"_isWindows")});var oE=L((c3,ZO)=>{ZO.exports={name:"google-auth-library",version:"10.5.0",author:"Google Inc.",description:"Google APIs Authentication Client Library for Node.js",engines:{node:">=18"},main:"./build/src/index.js",types:"./build/src/index.d.ts",repository:"googleapis/google-auth-library-nodejs.git",keywords:["google","api","google apis","client","client library"],dependencies:{"base64-js":"^1.3.0","ecdsa-sig-formatter":"^1.0.11",gaxios:"^7.0.0","gcp-metadata":"^8.0.0","google-logging-utils":"^1.0.0",gtoken:"^8.0.0",jws:"^4.0.0"},devDependencies:{"@types/base64-js":"^1.2.5","@types/jws":"^3.1.0","@types/mocha":"^10.0.10","@types/mv":"^2.1.0","@types/ncp":"^2.0.1","@types/node":"^22.0.0","@types/sinon":"^17.0.0","assert-rejects":"^1.0.0",c8:"^10.0.0",codecov:"^3.0.2",gts:"^6.0.0","is-docker":"^3.0.0",jsdoc:"^4.0.0","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",keypair:"^1.0.4",mocha:"^11.1.0",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","ts-loader":"^8.0.0",typescript:"5.8.2",webpack:"^5.21.2","webpack-cli":"^4.0.0"},files:["build/src","!build/src/**/*.map"],scripts:{test:"c8 mocha build/test",clean:"gts clean",prepare:"npm run compile",lint:"gts check --no-inline-config",compile:"tsc -p .",fix:"gts fix",pretest:"npm run compile -- --sourceMap",docs:"jsdoc -c .jsdoc.js","samples-setup":"cd samples/ && npm link ../ && npm run setup && cd ../","samples-test":"cd samples/ && npm link ../ && npm test && cd ../","system-test":"mocha build/system-test --timeout 60000","presystem-test":"npm run compile -- --sourceMap",webpack:"webpack","browser-test":"karma start","docs-test":"echo 'disabled until linkinator is fixed'","predocs-test":"npm run docs",prelint:"cd samples; npm link ../; npm install"},license:"Apache-2.0"}});var Ed=L(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.USER_AGENT=On.PRODUCT_NAME=On.pkg=void 0;var iE=oE();On.pkg=iE;var aE="google-api-nodejs-client";On.PRODUCT_NAME=aE;var JO=`${aE}/${iE.version}`;On.USER_AGENT=JO});var Zt=L(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.AuthClient=Er.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=Er.DEFAULT_UNIVERSE=void 0;var KO=require("events"),Pd=_t(),QO=vr(),YO=sd(),Sd=Ed();Er.DEFAULT_UNIVERSE="googleapis.com";Er.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=300*1e3;var Td=class t extends KO.EventEmitter{static{o(this,"AuthClient")}apiKey;projectId;quotaProjectId;transporter;credentials={};eagerRefreshThresholdMillis=Er.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS;forceRefreshOnFailure=!1;universeDomain=Er.DEFAULT_UNIVERSE;static RequestMethodNameSymbol=Symbol("request method name");static RequestLogIdSymbol=Symbol("request log id");constructor(e={}){super();let r=(0,QO.originalOrCamelOptions)(e);this.apiKey=e.apiKey,this.projectId=r.get("project_id")??null,this.quotaProjectId=r.get("quota_project_id"),this.credentials=r.get("credentials")??{},this.universeDomain=r.get("universe_domain")??Er.DEFAULT_UNIVERSE,this.transporter=e.transporter??new Pd.Gaxios(e.transporterOptions),r.get("useAuthRequestParameters")!==!1&&(this.transporter.interceptors.request.add(t.DEFAULT_REQUEST_INTERCEPTOR),this.transporter.interceptors.response.add(t.DEFAULT_RESPONSE_INTERCEPTOR)),e.eagerRefreshThresholdMillis&&(this.eagerRefreshThresholdMillis=e.eagerRefreshThresholdMillis),this.forceRefreshOnFailure=e.forceRefreshOnFailure??!1}fetch(...e){let r=e[0],n=e[1],i,u=new Headers;return typeof r=="string"?i=new URL(r):r instanceof URL?i=r:r&&r.url&&(i=new URL(r.url)),r&&typeof r=="object"&&"headers"in r&&Pd.Gaxios.mergeHeaders(u,r.headers),n&&Pd.Gaxios.mergeHeaders(u,new Headers(n.headers)),typeof r=="object"&&!(r instanceof URL)?this.request({...n,...r,headers:u,url:i}):this.request({...n,headers:u,url:i})}setCredentials(e){this.credentials=e}addSharedMetadataHeaders(e){return!e.has("x-goog-user-project")&&this.quotaProjectId&&e.set("x-goog-user-project",this.quotaProjectId),e}addUserProjectAndAuthHeaders(e,r){let n=r.get("x-goog-user-project"),i=r.get("authorization");return n&&e.set("x-goog-user-project",n),i&&e.set("authorization",i),e}static log=(0,YO.log)("auth");static DEFAULT_REQUEST_INTERCEPTOR={resolved:o(async e=>{if(!e.headers.has("x-goog-api-client")){let n=process.version.replace(/^v/,"");e.headers.set("x-goog-api-client",`gl-node/${n}`)}let r=e.headers.get("User-Agent");r?r.includes(`${Sd.PRODUCT_NAME}/`)||e.headers.set("User-Agent",`${r} ${Sd.USER_AGENT}`):e.headers.set("User-Agent",Sd.USER_AGENT);try{let n=e,i=n[t.RequestMethodNameSymbol],u=`${Math.floor(Math.random()*1e3)}`;n[t.RequestLogIdSymbol]=u;let c={url:e.url,headers:e.headers};i?t.log.info("%s [%s] request %j",i,u,c):t.log.info("[%s] request %j",u,c)}catch{}return e},"resolved")};static DEFAULT_RESPONSE_INTERCEPTOR={resolved:o(async e=>{try{let r=e.config,n=r[t.RequestMethodNameSymbol],i=r[t.RequestLogIdSymbol];n?t.log.info("%s [%s] response %j",n,i,e.data):t.log.info("[%s] response %j",i,e.data)}catch{}return e},"resolved"),rejected:o(async e=>{try{let r=e.config,n=r[t.RequestMethodNameSymbol],i=r[t.RequestLogIdSymbol];n?t.log.info("%s [%s] error %j",n,i,e.response?.data):t.log.error("[%s] error %j",i,e.response?.data)}catch{}throw e},"rejected")};static setMethodName(e,r){try{let n=e;n[t.RequestMethodNameSymbol]=r}catch{}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};Er.AuthClient=Td});var xd=L(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});iu.LoginTicket=void 0;var wd=class{static{o(this,"LoginTicket")}envelope;payload;constructor(e,r){this.envelope=e,this.payload=r}getEnvelope(){return this.envelope}getPayload(){return this.payload}getUserId(){let e=this.getPayload();return e&&e.sub?e.sub:null}getAttributes(){return{envelope:this.getEnvelope(),payload:this.getPayload()}}};iu.LoginTicket=wd});var eo=L(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.OAuth2Client=Nr.ClientAuthentication=Nr.CertificateFormat=Nr.CodeChallengeMethod=void 0;var sE=_t(),XO=require("querystring"),ek=require("stream"),tk=_d(),uE=vr(),Ad=ea(),Vo=Zt(),rk=xd(),cE;(function(t){t.Plain="plain",t.S256="S256"})(cE||(Nr.CodeChallengeMethod=cE={}));var on;(function(t){t.PEM="PEM",t.JWK="JWK"})(on||(Nr.CertificateFormat=on={}));var ta;(function(t){t.ClientSecretPost="ClientSecretPost",t.ClientSecretBasic="ClientSecretBasic",t.None="None"})(ta||(Nr.ClientAuthentication=ta={}));var Id=class t extends Vo.AuthClient{static{o(this,"OAuth2Client")}redirectUri;certificateCache={};certificateExpiry=null;certificateCacheFormat=on.PEM;refreshTokenPromises=new Map;endpoints;issuers;clientAuthentication;_clientId;_clientSecret;refreshHandler;constructor(e={},r,n){super(typeof e=="object"?e:{}),typeof e!="object"&&(e={clientId:e,clientSecret:r,redirectUri:n}),this._clientId=e.clientId||e.client_id,this._clientSecret=e.clientSecret||e.client_secret,this.redirectUri=e.redirectUri||e.redirect_uris?.[0],this.endpoints={tokenInfoUrl:"https://oauth2.googleapis.com/tokeninfo",oauth2AuthBaseUrl:"https://accounts.google.com/o/oauth2/v2/auth",oauth2TokenUrl:"https://oauth2.googleapis.com/token",oauth2RevokeUrl:"https://oauth2.googleapis.com/revoke",oauth2FederatedSignonPemCertsUrl:"https://www.googleapis.com/oauth2/v1/certs",oauth2FederatedSignonJwkCertsUrl:"https://www.googleapis.com/oauth2/v3/certs",oauth2IapPublicKeyUrl:"https://www.gstatic.com/iap/verify/public_key",...e.endpoints},this.clientAuthentication=e.clientAuthentication||ta.ClientSecretPost,this.issuers=e.issuers||["accounts.google.com","https://accounts.google.com",this.universeDomain]}static GOOGLE_TOKEN_INFO_URL="https://oauth2.googleapis.com/tokeninfo";static CLOCK_SKEW_SECS_=300;static DEFAULT_MAX_TOKEN_LIFETIME_SECS_=86400;generateAuthUrl(e={}){if(e.code_challenge_method&&!e.code_challenge)throw new Error("If a code_challenge_method is provided, code_challenge must be included.");return e.response_type=e.response_type||"code",e.client_id=e.client_id||this._clientId,e.redirect_uri=e.redirect_uri||this.redirectUri,Array.isArray(e.scope)&&(e.scope=e.scope.join(" ")),this.endpoints.oauth2AuthBaseUrl.toString()+"?"+XO.stringify(e)}generateCodeVerifier(){throw new Error("generateCodeVerifier is removed, please use generateCodeVerifierAsync instead.")}async generateCodeVerifierAsync(){let e=(0,Ad.createCrypto)(),n=e.randomBytesBase64(96).replace(/\+/g,"~").replace(/=/g,"_").replace(/\//g,"-"),u=(await e.sha256DigestBase64(n)).split("=")[0].replace(/\+/g,"-").replace(/\//g,"_");return{codeVerifier:n,codeChallenge:u}}getToken(e,r){let n=typeof e=="string"?{code:e}:e;if(r)this.getTokenAsync(n).then(i=>r(null,i.tokens,i.res),i=>r(i,null,i.response));else return this.getTokenAsync(n)}async getTokenAsync(e){let r=this.endpoints.oauth2TokenUrl.toString(),n=new Headers,i={client_id:e.client_id||this._clientId,code_verifier:e.codeVerifier,code:e.code,grant_type:"authorization_code",redirect_uri:e.redirect_uri||this.redirectUri};if(this.clientAuthentication===ta.ClientSecretBasic){let p=Buffer.from(`${this._clientId}:${this._clientSecret}`);n.set("authorization",`Basic ${p.toString("base64")}`)}this.clientAuthentication===ta.ClientSecretPost&&(i.client_secret=this._clientSecret);let u={...t.RETRY_CONFIG,method:"POST",url:r,data:new URLSearchParams((0,uE.removeUndefinedValuesInObject)(i)),headers:n};Vo.AuthClient.setMethodName(u,"getTokenAsync");let c=await this.transporter.request(u),l=c.data;return c.data&&c.data.expires_in&&(l.expiry_date=new Date().getTime()+c.data.expires_in*1e3,delete l.expires_in),this.emit("tokens",l),{tokens:l,res:c}}async refreshToken(e){if(!e)return this.refreshTokenNoCache(e);if(this.refreshTokenPromises.has(e))return this.refreshTokenPromises.get(e);let r=this.refreshTokenNoCache(e).then(n=>(this.refreshTokenPromises.delete(e),n),n=>{throw this.refreshTokenPromises.delete(e),n});return this.refreshTokenPromises.set(e,r),r}async refreshTokenNoCache(e){if(!e)throw new Error("No refresh token is set.");let r=this.endpoints.oauth2TokenUrl.toString(),n={refresh_token:e,client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token"},i;try{let c={...t.RETRY_CONFIG,method:"POST",url:r,data:new URLSearchParams((0,uE.removeUndefinedValuesInObject)(n))};Vo.AuthClient.setMethodName(c,"refreshTokenNoCache"),i=await this.transporter.request(c)}catch(c){throw c instanceof sE.GaxiosError&&c.message==="invalid_grant"&&c.response?.data&&/ReAuth/i.test(c.response.data.error_description)&&(c.message=JSON.stringify(c.response.data)),c}let u=i.data;return i.data&&i.data.expires_in&&(u.expiry_date=new Date().getTime()+i.data.expires_in*1e3,delete u.expires_in),this.emit("tokens",u),{tokens:u,res:i}}refreshAccessToken(e){if(e)this.refreshAccessTokenAsync().then(r=>e(null,r.credentials,r.res),e);else return this.refreshAccessTokenAsync()}async refreshAccessTokenAsync(){let e=await this.refreshToken(this.credentials.refresh_token),r=e.tokens;return r.refresh_token=this.credentials.refresh_token,this.credentials=r,{credentials:this.credentials,res:e.res}}getAccessToken(e){if(e)this.getAccessTokenAsync().then(r=>e(null,r.token,r.res),e);else return this.getAccessTokenAsync()}async getAccessTokenAsync(){if(!this.credentials.access_token||this.isTokenExpiring()){if(!this.credentials.refresh_token)if(this.refreshHandler){let n=await this.processAndValidateRefreshHandler();if(n?.access_token)return this.setCredentials(n),{token:this.credentials.access_token}}else throw new Error("No refresh token or refresh handler callback is set.");let r=await this.refreshAccessTokenAsync();if(!r.credentials||r.credentials&&!r.credentials.access_token)throw new Error("Could not refresh access token.");return{token:r.credentials.access_token,res:r.res}}else return{token:this.credentials.access_token}}async getRequestHeaders(e){return(await this.getRequestMetadataAsync(e)).headers}async getRequestMetadataAsync(e){let r=this.credentials;if(!r.access_token&&!r.refresh_token&&!this.apiKey&&!this.refreshHandler)throw new Error("No access, refresh token, API key or refresh handler callback is set.");if(r.access_token&&!this.isTokenExpiring()){r.token_type=r.token_type||"Bearer";let l=new Headers({authorization:r.token_type+" "+r.access_token});return{headers:this.addSharedMetadataHeaders(l)}}if(this.refreshHandler){let l=await this.processAndValidateRefreshHandler();if(l?.access_token){this.setCredentials(l);let p=new Headers({authorization:"Bearer "+this.credentials.access_token});return{headers:this.addSharedMetadataHeaders(p)}}}if(this.apiKey)return{headers:new Headers({"X-Goog-Api-Key":this.apiKey})};let n=null,i=null;try{n=await this.refreshToken(r.refresh_token),i=n.tokens}catch(l){let p=l;throw p.response&&(p.response.status===403||p.response.status===404)&&(p.message=`Could not refresh access token: ${p.message}`),p}let u=this.credentials;u.token_type=u.token_type||"Bearer",i.refresh_token=u.refresh_token,this.credentials=i;let c=new Headers({authorization:u.token_type+" "+i.access_token});return{headers:this.addSharedMetadataHeaders(c),res:n.res}}static getRevokeTokenUrl(e){return new t().getRevokeTokenURL(e).toString()}getRevokeTokenURL(e){let r=new URL(this.endpoints.oauth2RevokeUrl);return r.searchParams.append("token",e),r}revokeToken(e,r){let n={...t.RETRY_CONFIG,url:this.getRevokeTokenURL(e).toString(),method:"POST"};if(Vo.AuthClient.setMethodName(n,"revokeToken"),r)this.transporter.request(n).then(i=>r(null,i),r);else return this.transporter.request(n)}revokeCredentials(e){if(e)this.revokeCredentialsAsync().then(r=>e(null,r),e);else return this.revokeCredentialsAsync()}async revokeCredentialsAsync(){let e=this.credentials.access_token;if(this.credentials={},e)return this.revokeToken(e);throw new Error("No access token to revoke.")}request(e,r){if(r)this.requestAsync(e).then(n=>r(null,n),n=>r(n,n.response));else return this.requestAsync(e)}async requestAsync(e,r=!1){try{let n=await this.getRequestMetadataAsync();return e.headers=sE.Gaxios.mergeHeaders(e.headers),this.addUserProjectAndAuthHeaders(e.headers,n.headers),this.apiKey&&e.headers.set("X-Goog-Api-Key",this.apiKey),await this.transporter.request(e)}catch(n){let i=n.response;if(i){let u=i.status,c=this.credentials&&this.credentials.access_token&&this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure),l=this.credentials&&this.credentials.access_token&&!this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure)&&this.refreshHandler,p=i.config.data instanceof ek.Readable,f=u===401||u===403;if(!r&&f&&!p&&c)return await this.refreshAccessTokenAsync(),this.requestAsync(e,!0);if(!r&&f&&!p&&l){let m=await this.processAndValidateRefreshHandler();return m?.access_token&&this.setCredentials(m),this.requestAsync(e,!0)}}throw n}}verifyIdToken(e,r){if(r&&typeof r!="function")throw new Error("This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.");if(r)this.verifyIdTokenAsync(e).then(n=>r(null,n),r);else return this.verifyIdTokenAsync(e)}async verifyIdTokenAsync(e){if(!e.idToken)throw new Error("The verifyIdToken method requires an ID Token");let r=await this.getFederatedSignonCertsAsync();return await this.verifySignedJwtWithCertsAsync(e.idToken,r.certs,e.audience,this.issuers,e.maxExpiry)}async getTokenInfo(e){let{data:r}=await this.transporter.request({...t.RETRY_CONFIG,method:"POST",headers:{"content-type":"application/x-www-form-urlencoded;charset=UTF-8",authorization:`Bearer ${e}`},url:this.endpoints.tokenInfoUrl.toString()}),n=Object.assign({expiry_date:new Date().getTime()+r.expires_in*1e3,scopes:r.scope.split(" ")},r);return delete n.expires_in,delete n.scope,n}getFederatedSignonCerts(e){if(e)this.getFederatedSignonCertsAsync().then(r=>e(null,r.certs,r.res),e);else return this.getFederatedSignonCertsAsync()}async getFederatedSignonCertsAsync(){let e=new Date().getTime(),r=(0,Ad.hasBrowserCrypto)()?on.JWK:on.PEM;if(this.certificateExpiry&&e<this.certificateExpiry.getTime()&&this.certificateCacheFormat===r)return{certs:this.certificateCache,format:r};let n,i;switch(r){case on.PEM:i=this.endpoints.oauth2FederatedSignonPemCertsUrl.toString();break;case on.JWK:i=this.endpoints.oauth2FederatedSignonJwkCertsUrl.toString();break;default:throw new Error(`Unsupported certificate format ${r}`)}try{let f={...t.RETRY_CONFIG,url:i};Vo.AuthClient.setMethodName(f,"getFederatedSignonCertsAsync"),n=await this.transporter.request(f)}catch(f){throw f instanceof Error&&(f.message=`Failed to retrieve verification certificates: ${f.message}`),f}let u=n?.headers.get("cache-control"),c=-1;if(u){let f=/max-age=(?<maxAge>[0-9]+)/.exec(u)?.groups?.maxAge;f&&(c=Number(f)*1e3)}let l={};switch(r){case on.PEM:l=n.data;break;case on.JWK:for(let f of n.data.keys)l[f.kid]=f;break;default:throw new Error(`Unsupported certificate format ${r}`)}let p=new Date;return this.certificateExpiry=c===-1?null:new Date(p.getTime()+c),this.certificateCache=l,this.certificateCacheFormat=r,{certs:l,format:r,res:n}}getIapPublicKeys(e){if(e)this.getIapPublicKeysAsync().then(r=>e(null,r.pubkeys,r.res),e);else return this.getIapPublicKeysAsync()}async getIapPublicKeysAsync(){let e,r=this.endpoints.oauth2IapPublicKeyUrl.toString();try{let n={...t.RETRY_CONFIG,url:r};Vo.AuthClient.setMethodName(n,"getIapPublicKeysAsync"),e=await this.transporter.request(n)}catch(n){throw n instanceof Error&&(n.message=`Failed to retrieve verification certificates: ${n.message}`),n}return{pubkeys:e.data,res:e}}verifySignedJwtWithCerts(){throw new Error("verifySignedJwtWithCerts is removed, please use verifySignedJwtWithCertsAsync instead.")}async verifySignedJwtWithCertsAsync(e,r,n,i,u){let c=(0,Ad.createCrypto)();u||(u=t.DEFAULT_MAX_TOKEN_LIFETIME_SECS_);let l=e.split(".");if(l.length!==3)throw new Error("Wrong number of segments in token: "+e);let p=l[0]+"."+l[1],f=l[2],m,y;try{m=JSON.parse(c.decodeBase64StringUtf8(l[0]))}catch(q){throw q instanceof Error&&(q.message=`Can't parse token envelope: ${l[0]}': ${q.message}`),q}if(!m)throw new Error("Can't parse token envelope: "+l[0]);try{y=JSON.parse(c.decodeBase64StringUtf8(l[1]))}catch(q){throw q instanceof Error&&(q.message=`Can't parse token payload '${l[0]}`),q}if(!y)throw new Error("Can't parse token payload: "+l[1]);if(!Object.prototype.hasOwnProperty.call(r,m.kid))throw new Error("No pem found for envelope: "+JSON.stringify(m));let P=r[m.kid];if(m.alg==="ES256"&&(f=tk.joseToDer(f,"ES256").toString("base64")),!await c.verify(P,p,f))throw new Error("Invalid token signature: "+e);if(!y.iat)throw new Error("No issue time in token: "+JSON.stringify(y));if(!y.exp)throw new Error("No expiration time in token: "+JSON.stringify(y));let b=Number(y.iat);if(isNaN(b))throw new Error("iat field using invalid format");let T=Number(y.exp);if(isNaN(T))throw new Error("exp field using invalid format");let E=new Date().getTime()/1e3;if(T>=E+u)throw new Error("Expiration time too far in future: "+JSON.stringify(y));let w=b-t.CLOCK_SKEW_SECS_,k=T+t.CLOCK_SKEW_SECS_;if(E<w)throw new Error("Token used too early, "+E+" < "+w+": "+JSON.stringify(y));if(E>k)throw new Error("Token used too late, "+E+" > "+k+": "+JSON.stringify(y));if(i&&i.indexOf(y.iss)<0)throw new Error("Invalid issuer, expected one of ["+i+"], but got "+y.iss);if(typeof n<"u"&&n!==null){let q=y.aud,W=!1;if(n.constructor===Array?W=n.indexOf(q)>-1:W=q===n,!W)throw new Error("Wrong recipient, payload audience != requiredAudience")}return new rk.LoginTicket(m,y)}async processAndValidateRefreshHandler(){if(this.refreshHandler){let e=await this.refreshHandler();if(!e.access_token)throw new Error("No access token is returned by the refreshHandler callback.");return e}}isTokenExpiring(){let e=this.credentials.expiry_date;return e?e<=new Date().getTime()+this.eagerRefreshThresholdMillis:!1}};Nr.OAuth2Client=Id});var Cd=L(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.Compute=void 0;var nk=_t(),lE=Xi(),ok=eo(),Rd=class extends ok.OAuth2Client{static{o(this,"Compute")}serviceAccountEmail;scopes;constructor(e={}){super(e),this.credentials={expiry_date:1,refresh_token:"compute-placeholder"},this.serviceAccountEmail=e.serviceAccountEmail||"default",this.scopes=Array.isArray(e.scopes)?e.scopes:e.scopes?[e.scopes]:[]}async refreshTokenNoCache(){let e=`service-accounts/${this.serviceAccountEmail}/token`,r;try{let i={property:e};this.scopes.length>0&&(i.params={scopes:this.scopes.join(",")}),r=await lE.instance(i)}catch(i){throw i instanceof nk.GaxiosError&&(i.message=`Could not refresh access token: ${i.message}`,this.wrapError(i)),i}let n=r;return r&&r.expires_in&&(n.expiry_date=new Date().getTime()+r.expires_in*1e3,delete n.expires_in),this.emit("tokens",n),{tokens:n,res:null}}async fetchIdToken(e){let r=`service-accounts/${this.serviceAccountEmail}/identity?format=full&audience=${e}`,n;try{let i={property:r};n=await lE.instance(i)}catch(i){throw i instanceof Error&&(i.message=`Could not fetch ID token: ${i.message}`),i}return n}wrapError(e){let r=e.response;r&&r.status&&(e.status=r.status,r.status===403?e.message="A Forbidden error was returned while attempting to retrieve an access token for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have the correct permission scopes specified: "+e.message:r.status===404&&(e.message="A Not Found error was returned while attempting to retrieve an accesstoken for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have any permission scopes specified: "+e.message))}};au.Compute=Rd});var kd=L(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});su.IdTokenClient=void 0;var ik=eo(),Od=class extends ik.OAuth2Client{static{o(this,"IdTokenClient")}targetAudience;idTokenProvider;constructor(e){super(e),this.targetAudience=e.targetAudience,this.idTokenProvider=e.idTokenProvider}async getRequestMetadataAsync(){if(!this.credentials.id_token||!this.credentials.expiry_date||this.isTokenExpiring()){let r=await this.idTokenProvider.fetchIdToken(this.targetAudience);this.credentials={id_token:r,expiry_date:this.getIdTokenExpiryDate(r)}}return{headers:new Headers({authorization:"Bearer "+this.credentials.id_token})}}getIdTokenExpiryDate(e){let r=e.split(".")[1];if(r)return JSON.parse(Buffer.from(r,"base64").toString("ascii")).exp*1e3}};su.IdTokenClient=Od});var $d=L(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.GCPEnv=void 0;Ho.clear=ak;Ho.getEnv=sk;var dE=Xi(),Dr;(function(t){t.APP_ENGINE="APP_ENGINE",t.KUBERNETES_ENGINE="KUBERNETES_ENGINE",t.CLOUD_FUNCTIONS="CLOUD_FUNCTIONS",t.COMPUTE_ENGINE="COMPUTE_ENGINE",t.CLOUD_RUN="CLOUD_RUN",t.CLOUD_RUN_JOBS="CLOUD_RUN_JOBS",t.NONE="NONE"})(Dr||(Ho.GCPEnv=Dr={}));var ra;function ak(){ra=void 0}o(ak,"clear");async function sk(){return ra||(ra=uk(),ra)}o(sk,"getEnv");async function uk(){let t=Dr.NONE;return ck()?t=Dr.APP_ENGINE:lk()?t=Dr.CLOUD_FUNCTIONS:await mk()?await fk()?t=Dr.KUBERNETES_ENGINE:dk()?t=Dr.CLOUD_RUN:pk()?t=Dr.CLOUD_RUN_JOBS:t=Dr.COMPUTE_ENGINE:t=Dr.NONE,t}o(uk,"getEnvMemoized");function ck(){return!!(process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME)}o(ck,"isAppEngine");function lk(){return!!(process.env.FUNCTION_NAME||process.env.FUNCTION_TARGET)}o(lk,"isCloudFunction");function dk(){return!!process.env.K_CONFIGURATION}o(dk,"isCloudRun");function pk(){return!!process.env.CLOUD_RUN_JOB}o(pk,"isCloudRunJob");async function fk(){try{return await dE.instance("attributes/cluster-name"),!0}catch{return!1}}o(fk,"isKubernetesEngine");async function mk(){return dE.isAvailable()}o(mk,"isComputeEngine")});var zd=L((S3,pE)=>{var uu=qo().Buffer,hk=require("stream"),gk=require("util");function cu(t){if(this.buffer=null,this.writable=!0,this.readable=!0,!t)return this.buffer=uu.alloc(0),this;if(typeof t.pipe=="function")return this.buffer=uu.alloc(0),t.pipe(this),this;if(t.length||typeof t=="object")return this.buffer=t,this.writable=!1,process.nextTick(function(){this.emit("end",t),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof t+")")}o(cu,"DataStream");gk.inherits(cu,hk);cu.prototype.write=o(function(e){this.buffer=uu.concat([this.buffer,uu.from(e)]),this.emit("data",e)},"write");cu.prototype.end=o(function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1},"end");pE.exports=cu});var mE=L((w3,fE)=>{"use strict";var na=require("buffer").Buffer,Nd=require("buffer").SlowBuffer;fE.exports=lu;function lu(t,e){if(!na.isBuffer(t)||!na.isBuffer(e)||t.length!==e.length)return!1;for(var r=0,n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}o(lu,"bufferEq");lu.install=function(){na.prototype.equal=Nd.prototype.equal=o(function(e){return lu(this,e)},"equal")};var yk=na.prototype.equal,_k=Nd.prototype.equal;lu.restore=function(){na.prototype.equal=yk,Nd.prototype.equal=_k}});var Md=L((A3,SE)=>{var Wo=qo().Buffer,sr=require("crypto"),gE=_d(),hE=require("util"),bk=`"%s" is not a valid algorithm.
39
39
  Supported algorithms are:
40
- "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,na="secret must be a string or buffer",Ho="key must be a string or a buffer",lk="key must be a string, a buffer or an object",Nd=typeof sr.createPublicKey=="function";Nd&&(Ho+=" or a KeyObject",na+="or a KeyObject");function cE(t){if(!Go.isBuffer(t)&&typeof t!="string"&&(!Nd||typeof t!="object"||typeof t.type!="string"||typeof t.asymmetricKeyType!="string"||typeof t.export!="function"))throw Sr(Ho)}o(cE,"checkIsPublicKey");function lE(t){if(!Go.isBuffer(t)&&typeof t!="string"&&typeof t!="object")throw Sr(lk)}o(lE,"checkIsPrivateKey");function dk(t){if(!Go.isBuffer(t)){if(typeof t=="string")return t;if(!Nd||typeof t!="object"||t.type!=="secret"||typeof t.export!="function")throw Sr(na)}}o(dk,"checkIsSecretKey");function zd(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}o(zd,"fromBase64");function dE(t){t=t.toString();var e=4-t.length%4;if(e!==4)for(var r=0;r<e;++r)t+="=";return t.replace(/\-/g,"+").replace(/_/g,"/")}o(dE,"toBase64");function Sr(t){var e=[].slice.call(arguments,1),r=sE.format.bind(sE,t).apply(null,e);return new TypeError(r)}o(Sr,"typeError");function pk(t){return Go.isBuffer(t)||typeof t=="string"}o(pk,"bufferOrString");function oa(t){return pk(t)||(t=JSON.stringify(t)),t}o(oa,"normalizeInput");function pE(t){return o(function(r,n){dk(n),r=oa(r);var i=sr.createHmac("sha"+t,n),u=(i.update(r),i.digest("base64"));return zd(u)},"sign")}o(pE,"createHmacSigner");var $d,fk="timingSafeEqual"in sr?o(function(e,r){return e.byteLength!==r.byteLength?!1:sr.timingSafeEqual(e,r)},"timingSafeEqual"):o(function(e,r){return $d||($d=aE()),$d(e,r)},"timingSafeEqual");function mk(t){return o(function(r,n,i){var u=pE(t)(r,i);return fk(Go.from(n),Go.from(u))},"verify")}o(mk,"createHmacVerifier");function fE(t){return o(function(r,n){lE(n),r=oa(r);var i=sr.createSign("RSA-SHA"+t),u=(i.update(r),i.sign(n,"base64"));return zd(u)},"sign")}o(fE,"createKeySigner");function mE(t){return o(function(r,n,i){cE(i),r=oa(r),n=dE(n);var u=sr.createVerify("RSA-SHA"+t);return u.update(r),u.verify(i,n,"base64")},"verify")}o(mE,"createKeyVerifier");function hk(t){return o(function(r,n){lE(n),r=oa(r);var i=sr.createSign("RSA-SHA"+t),u=(i.update(r),i.sign({key:n,padding:sr.constants.RSA_PKCS1_PSS_PADDING,saltLength:sr.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return zd(u)},"sign")}o(hk,"createPSSKeySigner");function gk(t){return o(function(r,n,i){cE(i),r=oa(r),n=dE(n);var u=sr.createVerify("RSA-SHA"+t);return u.update(r),u.verify({key:i,padding:sr.constants.RSA_PKCS1_PSS_PADDING,saltLength:sr.constants.RSA_PSS_SALTLEN_DIGEST},n,"base64")},"verify")}o(gk,"createPSSKeyVerifier");function yk(t){var e=fE(t);return o(function(){var n=e.apply(null,arguments);return n=uE.derToJose(n,"ES"+t),n},"sign")}o(yk,"createECDSASigner");function _k(t){var e=mE(t);return o(function(n,i,u){i=uE.joseToDer(i,"ES"+t).toString("base64");var c=e(n,i,u);return c},"verify")}o(_k,"createECDSAVerifer");function bk(){return o(function(){return""},"sign")}o(bk,"createNoneSigner");function vk(){return o(function(e,r){return r===""},"verify")}o(vk,"createNoneVerifier");hE.exports=o(function(e){var r={hs:pE,rs:fE,ps:hk,es:yk,none:bk},n={hs:mk,rs:mE,ps:gk,es:_k,none:vk},i=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!i)throw Sr(ck,e);var u=(i[1]||i[3]).toLowerCase(),c=i[2];return{sign:r[u](c),verify:n[u](c)}},"jwa")});var Ud=M((n3,gE)=>{var Ek=require("buffer").Buffer;gE.exports=o(function(e){return typeof e=="string"?e:typeof e=="number"||Ek.isBuffer(e)?e.toString():JSON.stringify(e)},"toString")});var SE=M((i3,EE)=>{var Sk=Bo().Buffer,yE=Od(),Pk=Dd(),Tk=require("stream"),_E=Ud(),jd=require("util");function bE(t,e){return Sk.from(t,e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}o(bE,"base64url");function wk(t,e,r){r=r||"utf8";var n=bE(_E(t),"binary"),i=bE(_E(e),r);return jd.format("%s.%s",n,i)}o(wk,"jwsSecuredInput");function vE(t){var e=t.header,r=t.payload,n=t.secret||t.privateKey,i=t.encoding,u=Pk(e.alg),c=wk(e,r,i),l=u.sign(c,n);return jd.format("%s.%s",c,l)}o(vE,"jwsSign");function lu(t){var e=t.secret;if(e=e??t.privateKey,e=e??t.key,/^hs/i.test(t.header.alg)===!0&&e==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var r=new yE(e);this.readable=!0,this.header=t.header,this.encoding=t.encoding,this.secret=this.privateKey=this.key=r,this.payload=new yE(t.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}o(lu,"SignStream");jd.inherits(lu,Tk);lu.prototype.sign=o(function(){try{var e=vE({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(r){this.readable=!1,this.emit("error",r),this.emit("close")}},"sign");lu.sign=vE;EE.exports=lu});var kE=M((s3,OE)=>{var TE=Bo().Buffer,PE=Od(),xk=Dd(),Ak=require("stream"),wE=Ud(),Ik=require("util"),Rk=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function Ck(t){return Object.prototype.toString.call(t)==="[object Object]"}o(Ck,"isObject");function Ok(t){if(Ck(t))return t;try{return JSON.parse(t)}catch{return}}o(Ok,"safeJsonParse");function xE(t){var e=t.split(".",1)[0];return Ok(TE.from(e,"base64").toString("binary"))}o(xE,"headerFromJWS");function kk(t){return t.split(".",2).join(".")}o(kk,"securedInputFromJWS");function AE(t){return t.split(".")[2]}o(AE,"signatureFromJWS");function $k(t,e){e=e||"utf8";var r=t.split(".")[1];return TE.from(r,"base64").toString(e)}o($k,"payloadFromJWS");function IE(t){return Rk.test(t)&&!!xE(t)}o(IE,"isValidJws");function RE(t,e,r){if(!e){var n=new Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}t=wE(t);var i=AE(t),u=kk(t),c=xk(e);return c.verify(u,i,r)}o(RE,"jwsVerify");function CE(t,e){if(e=e||{},t=wE(t),!IE(t))return null;var r=xE(t);if(!r)return null;var n=$k(t);return(r.typ==="JWT"||e.json)&&(n=JSON.parse(n,e.encoding)),{header:r,payload:n,signature:AE(t)}}o(CE,"jwsDecode");function Wo(t){t=t||{};var e=t.secret;if(e=e??t.publicKey,e=e??t.key,/^hs/i.test(t.algorithm)===!0&&e==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var r=new PE(e);this.readable=!0,this.algorithm=t.algorithm,this.encoding=t.encoding,this.secret=this.publicKey=this.key=r,this.signature=new PE(t.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}o(Wo,"VerifyStream");Ik.inherits(Wo,Ak);Wo.prototype.verify=o(function(){try{var e=RE(this.signature.buffer,this.algorithm,this.key.buffer),r=CE(this.signature.buffer,this.encoding);return this.emit("done",e,r),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(n){this.readable=!1,this.emit("error",n),this.emit("close")}},"verify");Wo.decode=CE;Wo.isValid=IE;Wo.verify=RE;OE.exports=Wo});var Md=M(On=>{var $E=SE(),du=kE(),Nk=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];On.ALGORITHMS=Nk;On.sign=$E.sign;On.verify=du.verify;On.decode=du.decode;On.isValid=du.isValid;On.createSign=o(function(e){return new $E(e)},"createSign");On.createVerify=o(function(e){return new du(e)},"createVerify")});var ZE=M(fu=>{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});fu.GoogleToken=void 0;var NE=pu(require("fs")),zk=yt(),Dk=pu(Md()),Uk=pu(require("path")),jk=require("util");function pu(t,e){if(typeof WeakMap=="function")var r=new WeakMap,n=new WeakMap;return(pu=o(function(u,c){if(!c&&u&&u.__esModule)return u;var l,p,f={__proto__:null,default:u};if(u===null||an(u)!="object"&&typeof u!="function")return f;if(l=c?n:r){if(l.has(u))return l.get(u);l.set(u,f)}for(var m in u)m!=="default"&&{}.hasOwnProperty.call(u,m)&&((p=(l=Object.defineProperty)&&Object.getOwnPropertyDescriptor(u,m))&&(p.get||p.set)?l(f,m,p):f[m]=u[m]);return f},"_interopRequireWildcard"))(t,e)}o(pu,"_interopRequireWildcard");function an(t){"@babel/helpers - typeof";return an=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},an(t)}o(an,"_typeof");function Mk(t,e){qE(t,e),e.add(t)}o(Mk,"_classPrivateMethodInitSpec");function Lk(t,e,r){qE(t,e),e.set(t,r)}o(Lk,"_classPrivateFieldInitSpec");function qE(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(qE,"_checkPrivateRedeclaration");function zE(t,e,r){return t.set(Pr(t,e),r),r}o(zE,"_classPrivateFieldSet");function DE(t,e){return t.get(Pr(t,e))}o(DE,"_classPrivateFieldGet");function Pr(t,e,r){if(typeof t=="function"?t===e:t.has(e))return arguments.length<3?e:r;throw new TypeError("Private element is not present on this object")}o(Pr,"_assertClassBrand");function UE(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,GE(n.key),n)}}o(UE,"_defineProperties");function VE(t,e,r){return e&&UE(t.prototype,e),r&&UE(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}o(VE,"_createClass");function HE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}o(HE,"_classCallCheck");function Fk(t,e,r){return e=ua(e),Bk(t,Hd()?Reflect.construct(e,r||[],ua(t).constructor):e.apply(t,r))}o(Fk,"_callSuper");function Bk(t,e){if(e&&(an(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qk(t)}o(Bk,"_possibleConstructorReturn");function qk(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}o(qk,"_assertThisInitialized");function Vk(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&sa(t,e)}o(Vk,"_inherits");function Ld(t){var e=typeof Map=="function"?new Map:void 0;return Ld=o(function(n){if(n===null||!Gk(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return Hk(n,arguments,ua(this).constructor)}return o(i,"Wrapper"),i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),sa(i,n)},"_wrapNativeSuper"),Ld(t)}o(Ld,"_wrapNativeSuper");function Hk(t,e,r){if(Hd())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&sa(i,r.prototype),i}o(Hk,"_construct");function Hd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Hd=o(function(){return!!t},"_isNativeReflectConstruct"))()}o(Hd,"_isNativeReflectConstruct");function Gk(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}o(Gk,"_isNativeFunction");function sa(t,e){return sa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},sa(t,e)}o(sa,"_setPrototypeOf");function ua(t){return ua=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ua(t)}o(ua,"_getPrototypeOf");function Jt(t,e,r){return(e=GE(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}o(Jt,"_defineProperty");function GE(t){var e=Wk(t,"string");return an(e)=="symbol"?e:e+""}o(GE,"_toPropertyKey");function Wk(t,e){if(an(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(an(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}o(Wk,"_toPrimitive");function Qt(){var t,e,r=typeof Symbol=="function"?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function u(h,_,T,E){var w=_&&_.prototype instanceof l?_:l,k=Object.create(w.prototype);return Kt(k,"_invoke",(function(q,G,V){var H,J,re,Z=0,ze=V||[],Se=!1,be={p:0,n:0,v:t,a:ke,f:ke.bind(t,4),d:o(function(Ve,He){return H=Ve,J=0,re=t,be.n=He,c},"d")};function ke(Ie,Ve){for(J=Ie,re=Ve,e=0;!Se&&Z&&!He&&e<ze.length;e++){var He,Je=ze[e],Ut=be.p,Et=Je[2];Ie>3?(He=Et===Ve)&&(re=Je[(J=Je[4])?5:(J=3,3)],Je[4]=Je[5]=t):Je[0]<=Ut&&((He=Ie<2&&Ut<Je[1])?(J=0,be.v=Ve,be.n=Je[1]):Ut<Et&&(He=Ie<3||Je[0]>Ve||Ve>Et)&&(Je[4]=Ie,Je[5]=Ve,be.n=Et,J=0))}if(He||Ie>1)return c;throw Se=!0,Ve}return o(ke,"d"),function(Ie,Ve,He){if(Z>1)throw TypeError("Generator is already running");for(Se&&Ve===1&&ke(Ve,He),J=Ve,re=He;(e=J<2?t:re)||!Se;){H||(J?J<3?(J>1&&(be.n=-1),ke(J,re)):be.n=re:be.v=re);try{if(Z=2,H){if(J||(Ie="next"),e=H[Ie]){if(!(e=e.call(H,re)))throw TypeError("iterator result is not an object");if(!e.done)return e;re=e.value,J<2&&(J=0)}else J===1&&(e=H.return)&&e.call(H),J<2&&(re=TypeError("The iterator does not provide a '"+Ie+"' method"),J=1);H=t}else if((e=(Se=be.n<0)?re:q.call(G,be))!==c)break}catch(Je){H=t,J=1,re=Je}finally{Z=1}}return{value:e,done:Se}}})(h,T,E),!0),k}o(u,"i");var c={};function l(){}o(l,"Generator");function p(){}o(p,"GeneratorFunction");function f(){}o(f,"GeneratorFunctionPrototype"),e=Object.getPrototypeOf;var m=[][n]?e(e([][n]())):(Kt(e={},n,function(){return this}),e),g=f.prototype=l.prototype=Object.create(m);function S(h){return Object.setPrototypeOf?Object.setPrototypeOf(h,f):(h.__proto__=f,Kt(h,i,"GeneratorFunction")),h.prototype=Object.create(g),h}return o(S,"f"),p.prototype=f,Kt(g,"constructor",f),Kt(f,"constructor",p),p.displayName="GeneratorFunction",Kt(f,i,"GeneratorFunction"),Kt(g),Kt(g,i,"Generator"),Kt(g,n,function(){return this}),Kt(g,"toString",function(){return"[object Generator]"}),(Qt=o(function(){return{w:u,m:S}},"_regenerator"))()}o(Qt,"_regenerator");function Kt(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch{i=0}Kt=o(function(c,l,p,f){if(l)i?i(c,l,{value:p,enumerable:!f,configurable:!f,writable:!f}):c[l]=p;else{var m=o(function(S,h){Kt(c,S,function(_){return this._invoke(S,h,_)})},"o");m("next",0),m("throw",1),m("return",2)}},"_regeneratorDefine"),Kt(t,e,r,n)}o(Kt,"_regeneratorDefine2");function jE(t,e,r,n,i,u,c){try{var l=t[u](c),p=l.value}catch(f){return void r(f)}l.done?e(p):Promise.resolve(p).then(n,i)}o(jE,"asyncGeneratorStep");function Zo(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var u=t.apply(e,r);function c(p){jE(u,n,i,c,l,"next",p)}o(c,"_next");function l(p){jE(u,n,i,c,l,"throw",p)}o(l,"_throw"),c(void 0)})}}o(Zo,"_asyncToGenerator");var ME=NE.readFile?(0,jk.promisify)(NE.readFile):Zo(Qt().m(o(function t(){return Qt().w(function(e){for(;;)switch(e.n){case 0:throw new aa("use key rather than keyFile.","MISSING_CREDENTIALS");case 1:return e.a(2)}},t)},"_callee"))),LE="https://oauth2.googleapis.com/token",Zk="https://oauth2.googleapis.com/revoke?token=",aa=(function(t){function e(r,n){var i;return HE(this,e),i=Fk(this,e,[r]),Jt(i,"code",void 0),i.code=n,i}return o(e,"ErrorWithCode"),Vk(e,t),VE(e)})(Ld(Error)),ia=new WeakMap,Ur=new WeakSet,d3=fu.GoogleToken=(function(){function t(e){HE(this,t),Mk(this,Ur),Jt(this,"expiresAt",void 0),Jt(this,"key",void 0),Jt(this,"keyFile",void 0),Jt(this,"iss",void 0),Jt(this,"sub",void 0),Jt(this,"scope",void 0),Jt(this,"rawToken",void 0),Jt(this,"tokenExpires",void 0),Jt(this,"email",void 0),Jt(this,"additionalClaims",void 0),Jt(this,"eagerRefreshThresholdMillis",void 0),Jt(this,"transporter",{request:o(function(n){return(0,zk.request)(n)},"request")}),Lk(this,ia,void 0),Pr(Ur,this,WE).call(this,e)}return o(t,"GoogleToken"),VE(t,[{key:"accessToken",get:o(function(){return this.rawToken?this.rawToken.access_token:void 0},"get")},{key:"idToken",get:o(function(){return this.rawToken?this.rawToken.id_token:void 0},"get")},{key:"tokenType",get:o(function(){return this.rawToken?this.rawToken.token_type:void 0},"get")},{key:"refreshToken",get:o(function(){return this.rawToken?this.rawToken.refresh_token:void 0},"get")},{key:"hasExpired",value:o(function(){var r=new Date().getTime();return this.rawToken&&this.expiresAt?r>=this.expiresAt:!0},"hasExpired")},{key:"isTokenExpiring",value:o(function(){var r,n=new Date().getTime(),i=(r=this.eagerRefreshThresholdMillis)!==null&&r!==void 0?r:0;return this.rawToken&&this.expiresAt?this.expiresAt<=n+i:!0},"isTokenExpiring")},{key:"getToken",value:o(function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(an(r)==="object"&&(n=r,r=void 0),n=Object.assign({forceRefresh:!1},n),r){var i=r;Pr(Ur,this,FE).call(this,n).then(function(u){return i(null,u)},r);return}return Pr(Ur,this,FE).call(this,n)},"getToken")},{key:"getCredentials",value:(function(){var e=Zo(Qt().m(o(function n(i){var u,c,l,p,f,m,g;return Qt().w(function(S){for(;;)switch(S.n){case 0:u=Uk.extname(i),g=u,S.n=g===".json"?1:g===".der"||g===".crt"||g===".pem"?4:g===".p12"||g===".pfx"?6:7;break;case 1:return S.n=2,ME(i,"utf8");case 2:if(c=S.v,l=JSON.parse(c),p=l.private_key,f=l.client_email,!(!p||!f)){S.n=3;break}throw new aa("private_key and client_email are required.","MISSING_CREDENTIALS");case 3:return S.a(2,{privateKey:p,clientEmail:f});case 4:return S.n=5,ME(i,"utf8");case 5:return m=S.v,S.a(2,{privateKey:m});case 6:throw new aa("*.p12 certificates are not supported after v6.1.2. Consider utilizing *.json format or converting *.p12 to *.pem using the OpenSSL CLI.","UNKNOWN_CERTIFICATE_TYPE");case 7:throw new aa("Unknown certificate type. Type is determined based on file extension. Current supported extensions are *.json, and *.pem.","UNKNOWN_CERTIFICATE_TYPE");case 8:return S.a(2)}},n)},"_callee2")));function r(n){return e.apply(this,arguments)}return o(r,"getCredentials"),r})()},{key:"revokeToken",value:o(function(r){if(r){Pr(Ur,this,BE).call(this).then(function(){return r()},r);return}return Pr(Ur,this,BE).call(this)},"revokeToken")}])})();function FE(t){return Fd.apply(this,arguments)}o(FE,"_getTokenAsync");function Fd(){return Fd=Zo(Qt().m(o(function t(e){return Qt().w(function(r){for(;;)switch(r.n){case 0:if(!(DE(ia,this)&&!e.forceRefresh)){r.n=1;break}return r.a(2,DE(ia,this));case 1:return r.p=1,r.n=2,zE(ia,this,Pr(Ur,this,Jk).call(this,e));case 2:return r.a(2,r.v);case 3:return r.p=3,zE(ia,this,void 0),r.f(3);case 4:return r.a(2)}},t,this,[[1,,3,4]])},"_callee3"))),Fd.apply(this,arguments)}o(Fd,"_getTokenAsync2");function Jk(t){return Bd.apply(this,arguments)}o(Jk,"_getTokenAsyncInner");function Bd(){return Bd=Zo(Qt().m(o(function t(e){var r;return Qt().w(function(n){for(;;)switch(n.n){case 0:if(!(this.isTokenExpiring()===!1&&e.forceRefresh===!1)){n.n=1;break}return n.a(2,Promise.resolve(this.rawToken));case 1:if(!(!this.key&&!this.keyFile)){n.n=2;break}throw new Error("No key or keyFile set.");case 2:if(!(!this.key&&this.keyFile)){n.n=4;break}return n.n=3,this.getCredentials(this.keyFile);case 3:r=n.v,this.key=r.privateKey,this.iss=r.clientEmail||this.iss,r.clientEmail||Pr(Ur,this,Kk).call(this);case 4:return n.a(2,Pr(Ur,this,Qk).call(this))}},t,this)},"_callee4"))),Bd.apply(this,arguments)}o(Bd,"_getTokenAsyncInner2");function Kk(){if(!this.iss)throw new aa("email is required.","MISSING_CREDENTIALS")}o(Kk,"_ensureEmail");function BE(){return qd.apply(this,arguments)}o(BE,"_revokeTokenAsync");function qd(){return qd=Zo(Qt().m(o(function t(){var e;return Qt().w(function(r){for(;;)switch(r.n){case 0:if(this.accessToken){r.n=1;break}throw new Error("No token to revoke.");case 1:return e=Zk+this.accessToken,r.n=2,this.transporter.request({url:e,retry:!0});case 2:Pr(Ur,this,WE).call(this,{email:this.iss,sub:this.sub,key:this.key,keyFile:this.keyFile,scope:this.scope,additionalClaims:this.additionalClaims});case 3:return r.a(2)}},t,this)},"_callee5"))),qd.apply(this,arguments)}o(qd,"_revokeTokenAsync2");function WE(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.keyFile=t.keyFile,this.key=t.key,this.rawToken=void 0,this.iss=t.email||t.iss,this.sub=t.sub,this.additionalClaims=t.additionalClaims,an(t.scope)==="object"?this.scope=t.scope.join(" "):this.scope=t.scope,this.eagerRefreshThresholdMillis=t.eagerRefreshThresholdMillis,t.transporter&&(this.transporter=t.transporter)}o(WE,"_configure");function Qk(){return Vd.apply(this,arguments)}o(Qk,"_requestToken");function Vd(){return Vd=Zo(Qt().m(o(function t(){var e,r,n,i,u,c,l,p,f,m;return Qt().w(function(g){for(;;)switch(g.n){case 0:return e=Math.floor(new Date().getTime()/1e3),r=this.additionalClaims||{},n=Object.assign({iss:this.iss,scope:this.scope,aud:LE,exp:e+3600,iat:e,sub:this.sub},r),i=Dk.sign({header:{alg:"RS256"},payload:n,secret:this.key}),g.p=1,g.n=2,this.transporter.request({method:"POST",url:LE,data:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:i}),responseType:"json",retryConfig:{httpMethodsToRetry:["POST"]}});case 2:return u=g.v,this.rawToken=u.data,this.expiresAt=u.data.expires_in===null||u.data.expires_in===void 0?void 0:(e+u.data.expires_in)*1e3,g.a(2,this.rawToken);case 3:throw g.p=3,m=g.v,this.rawToken=void 0,this.tokenExpires=void 0,p=m.response&&(c=m.response)!==null&&c!==void 0&&c.data?(l=m.response)===null||l===void 0?void 0:l.data:{},p.error&&(f=p.error_description?": ".concat(p.error_description):"",m.message="".concat(p.error).concat(f)),m;case 4:return g.a(2)}},t,this,[[1,3]])},"_callee6"))),Vd.apply(this,arguments)}o(Vd,"_requestToken2")});var Wd=M(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.JWTAccess=void 0;var Yk=Md(),Xk=vr(),JE={alg:"RS256",typ:"JWT"},Gd=class t{static{o(this,"JWTAccess")}email;key;keyId;projectId;eagerRefreshThresholdMillis;cache=new Xk.LRUCache({capacity:500,maxAge:3600*1e3});constructor(e,r,n,i){this.email=e,this.key=r,this.keyId=n,this.eagerRefreshThresholdMillis=i??300*1e3}getCachedKey(e,r){let n=e;if(r&&Array.isArray(r)&&r.length?n=e?`${e}_${r.join("_")}`:`${r.join("_")}`:typeof r=="string"&&(n=e?`${e}_${r}`:r),!n)throw Error("Scopes or url must be provided");return n}getRequestHeaders(e,r,n){let i=this.getCachedKey(e,n),u=this.cache.get(i),c=Date.now();if(u&&u.expiration-c>this.eagerRefreshThresholdMillis)return new Headers(u.headers);let l=Math.floor(Date.now()/1e3),p=t.getExpirationTime(l),f;if(Array.isArray(n)&&(n=n.join(" ")),n?f={iss:this.email,sub:this.email,scope:n,exp:p,iat:l}:f={iss:this.email,sub:this.email,aud:e,exp:p,iat:l},r){for(let _ in f)if(r[_])throw new Error(`The '${_}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`)}let m=this.keyId?{...JE,kid:this.keyId}:JE,g=Object.assign(f,r),S=Yk.sign({header:m,payload:g,secret:this.key}),h=new Headers({authorization:`Bearer ${S}`});return this.cache.set(i,{expiration:p*1e3,headers:h}),h}static getExpirationTime(e){return e+3600}fromJSON(e){if(!e)throw new Error("Must pass in a JSON object containing the service account auth settings.");if(!e.client_email)throw new Error("The incoming JSON object does not contain a client_email field");if(!e.private_key)throw new Error("The incoming JSON object does not contain a private_key field");this.email=e.client_email,this.key=e.private_key,this.keyId=e.private_key_id,this.projectId=e.project_id}fromStream(e,r){if(r)this.fromStreamAsync(e).then(()=>r(),r);else return this.fromStreamAsync(e)}fromStreamAsync(e){return new Promise((r,n)=>{e||n(new Error("Must pass in a stream containing the service account auth settings."));let i="";e.setEncoding("utf8").on("data",u=>i+=u).on("error",n).on("end",()=>{try{let u=JSON.parse(i);this.fromJSON(u),r()}catch(u){n(u)}})})}};mu.JWTAccess=Gd});var Jd=M(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.JWT=void 0;var KE=ZE(),e0=Wd(),t0=eo(),hu=Zt(),Zd=class t extends t0.OAuth2Client{static{o(this,"JWT")}email;keyFile;key;keyId;defaultScopes;scopes;scope;subject;gtoken;additionalClaims;useJWTAccessWithScope;defaultServicePath;access;constructor(e={}){super(e),this.email=e.email,this.keyFile=e.keyFile,this.key=e.key,this.keyId=e.keyId,this.scopes=e.scopes,this.subject=e.subject,this.additionalClaims=e.additionalClaims,this.credentials={refresh_token:"jwt-placeholder",expiry_date:1}}createScoped(e){let r=new t(this);return r.scopes=e,r}async getRequestMetadataAsync(e){e=this.defaultServicePath?`https://${this.defaultServicePath}/`:e;let r=!this.hasUserScopes()&&e||this.useJWTAccessWithScope&&this.hasAnyScopes()||this.universeDomain!==hu.DEFAULT_UNIVERSE;if(this.subject&&this.universeDomain!==hu.DEFAULT_UNIVERSE)throw new RangeError(`Service Account user is configured for the credential. Domain-wide delegation is not supported in universes other than ${hu.DEFAULT_UNIVERSE}`);if(!this.apiKey&&r)if(this.additionalClaims&&this.additionalClaims.target_audience){let{tokens:n}=await this.refreshToken();return{headers:this.addSharedMetadataHeaders(new Headers({authorization:`Bearer ${n.id_token}`}))}}else{this.access||(this.access=new e0.JWTAccess(this.email,this.key,this.keyId,this.eagerRefreshThresholdMillis));let n;this.hasUserScopes()?n=this.scopes:e||(n=this.defaultScopes);let i=this.useJWTAccessWithScope||this.universeDomain!==hu.DEFAULT_UNIVERSE,u=await this.access.getRequestHeaders(e??void 0,this.additionalClaims,i?n:void 0);return{headers:this.addSharedMetadataHeaders(u)}}else return this.hasAnyScopes()||this.apiKey?super.getRequestMetadataAsync(e):{headers:new Headers}}async fetchIdToken(e){let r=new KE.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:{target_audience:e},transporter:this.transporter});if(await r.getToken({forceRefresh:!0}),!r.idToken)throw new Error("Unknown error: Failed to fetch ID token");return r.idToken}hasUserScopes(){return this.scopes?this.scopes.length>0:!1}hasAnyScopes(){return!!(this.scopes&&this.scopes.length>0||this.defaultScopes&&this.defaultScopes.length>0)}authorize(e){if(e)this.authorizeAsync().then(r=>e(null,r),e);else return this.authorizeAsync()}async authorizeAsync(){let e=await this.refreshToken();if(!e)throw new Error("No result returned");return this.credentials=e.tokens,this.credentials.refresh_token="jwt-placeholder",this.key=this.gtoken.key,this.email=this.gtoken.iss,e.tokens}async refreshTokenNoCache(){let e=this.createGToken(),n={access_token:(await e.getToken({forceRefresh:this.isTokenExpiring()})).access_token,token_type:"Bearer",expiry_date:e.expiresAt,id_token:e.idToken};return this.emit("tokens",n),{res:null,tokens:n}}createGToken(){return this.gtoken||(this.gtoken=new KE.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:this.additionalClaims,transporter:this.transporter})),this.gtoken}fromJSON(e){if(!e)throw new Error("Must pass in a JSON object containing the service account auth settings.");if(!e.client_email)throw new Error("The incoming JSON object does not contain a client_email field");if(!e.private_key)throw new Error("The incoming JSON object does not contain a private_key field");this.email=e.client_email,this.key=e.private_key,this.keyId=e.private_key_id,this.projectId=e.project_id,this.quotaProjectId=e.quota_project_id,this.universeDomain=e.universe_domain||this.universeDomain}fromStream(e,r){if(r)this.fromStreamAsync(e).then(()=>r(),r);else return this.fromStreamAsync(e)}fromStreamAsync(e){return new Promise((r,n)=>{if(!e)throw new Error("Must pass in a stream containing the service account auth settings.");let i="";e.setEncoding("utf8").on("error",n).on("data",u=>i+=u).on("end",()=>{try{let u=JSON.parse(i);this.fromJSON(u),r()}catch(u){n(u)}})})}fromAPIKey(e){if(typeof e!="string")throw new Error("Must provide an API Key string.");this.apiKey=e}async getCredentials(){if(this.key)return{private_key:this.key,client_email:this.email};if(this.keyFile){let r=await this.createGToken().getCredentials(this.keyFile);return{private_key:r.privateKey,client_email:r.clientEmail}}throw new Error("A key or a keyFile must be provided to getCredentials.")}};gu.JWT=Zd});var Qd=M(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.UserRefreshClient=Jo.USER_REFRESH_ACCOUNT_TYPE=void 0;var r0=eo(),n0=Zt();Jo.USER_REFRESH_ACCOUNT_TYPE="authorized_user";var Kd=class t extends r0.OAuth2Client{static{o(this,"UserRefreshClient")}_refreshToken;constructor(e,r,n,i,u){let c=e&&typeof e=="object"?e:{clientId:e,clientSecret:r,refreshToken:n,eagerRefreshThresholdMillis:i,forceRefreshOnFailure:u};super(c),this._refreshToken=c.refreshToken,this.credentials.refresh_token=c.refreshToken}async refreshTokenNoCache(){return super.refreshTokenNoCache(this._refreshToken)}async fetchIdToken(e){let r={...t.RETRY_CONFIG,url:this.endpoints.oauth2TokenUrl,method:"POST",data:new URLSearchParams({client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token",refresh_token:this._refreshToken,target_audience:e})};return n0.AuthClient.setMethodName(r,"fetchIdToken"),(await this.transporter.request(r)).data.id_token}fromJSON(e){if(!e)throw new Error("Must pass in a JSON object containing the user refresh token");if(e.type!=="authorized_user")throw new Error('The incoming JSON object does not have the "authorized_user" type');if(!e.client_id)throw new Error("The incoming JSON object does not contain a client_id field");if(!e.client_secret)throw new Error("The incoming JSON object does not contain a client_secret field");if(!e.refresh_token)throw new Error("The incoming JSON object does not contain a refresh_token field");this._clientId=e.client_id,this._clientSecret=e.client_secret,this._refreshToken=e.refresh_token,this.credentials.refresh_token=e.refresh_token,this.quotaProjectId=e.quota_project_id,this.universeDomain=e.universe_domain||this.universeDomain}fromStream(e,r){if(r)this.fromStreamAsync(e).then(()=>r(),r);else return this.fromStreamAsync(e)}async fromStreamAsync(e){return new Promise((r,n)=>{if(!e)return n(new Error("Must pass in a stream containing the user refresh token."));let i="";e.setEncoding("utf8").on("error",n).on("data",u=>i+=u).on("end",()=>{try{let u=JSON.parse(i);return this.fromJSON(u),r()}catch(u){return n(u)}})})}static fromJSON(e){let r=new t;return r.fromJSON(e),r}};Jo.UserRefreshClient=Kd});var Xd=M(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});Ko.Impersonated=Ko.IMPERSONATED_ACCOUNT_TYPE=void 0;var QE=eo(),o0=yt(),i0=vr();Ko.IMPERSONATED_ACCOUNT_TYPE="impersonated_service_account";var Yd=class t extends QE.OAuth2Client{static{o(this,"Impersonated")}sourceClient;targetPrincipal;targetScopes;delegates;lifetime;endpoint;constructor(e={}){if(super(e),this.credentials={expiry_date:1,refresh_token:"impersonated-placeholder"},this.sourceClient=e.sourceClient??new QE.OAuth2Client,this.targetPrincipal=e.targetPrincipal??"",this.delegates=e.delegates??[],this.targetScopes=e.targetScopes??[],this.lifetime=e.lifetime??3600,!!!(0,i0.originalOrCamelOptions)(e).get("universe_domain"))this.universeDomain=this.sourceClient.universeDomain;else if(this.sourceClient.universeDomain!==this.universeDomain)throw new RangeError(`Universe domain ${this.sourceClient.universeDomain} in source credentials does not match ${this.universeDomain} universe domain set for impersonated credentials.`);this.endpoint=e.endpoint??`https://iamcredentials.${this.universeDomain}`}async sign(e){await this.sourceClient.getAccessToken();let r=`projects/-/serviceAccounts/${this.targetPrincipal}`,n=`${this.endpoint}/v1/${r}:signBlob`,i={delegates:this.delegates,payload:Buffer.from(e).toString("base64")};return(await this.sourceClient.request({...t.RETRY_CONFIG,url:n,data:i,method:"POST"})).data}getTargetPrincipal(){return this.targetPrincipal}async refreshToken(){try{await this.sourceClient.getAccessToken();let e="projects/-/serviceAccounts/"+this.targetPrincipal,r=`${this.endpoint}/v1/${e}:generateAccessToken`,n={delegates:this.delegates,scope:this.targetScopes,lifetime:this.lifetime+"s"},i=await this.sourceClient.request({...t.RETRY_CONFIG,url:r,data:n,method:"POST"}),u=i.data;return this.credentials.access_token=u.accessToken,this.credentials.expiry_date=Date.parse(u.expireTime),{tokens:this.credentials,res:i}}catch(e){if(!(e instanceof Error))throw e;let r=0,n="";throw e instanceof o0.GaxiosError&&(r=e?.response?.data?.error?.status,n=e?.response?.data?.error?.message),r&&n?(e.message=`${r}: unable to impersonate: ${n}`,e):(e.message=`unable to impersonate: ${e}`,e)}}async fetchIdToken(e,r){await this.sourceClient.getAccessToken();let n=`projects/-/serviceAccounts/${this.targetPrincipal}`,i=`${this.endpoint}/v1/${n}:generateIdToken`,u={delegates:this.delegates,audience:e,includeEmail:r?.includeEmail??!0,useEmailAzp:r?.includeEmail??!0};return(await this.sourceClient.request({...t.RETRY_CONFIG,url:i,data:u,method:"POST"})).data.token}};Ko.Impersonated=Yd});var tp=M(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.OAuthClientAuthHandler=void 0;ca.getErrorFromOAuthErrorResponse=u0;var Qo=yt(),a0=Xi(),s0=["PUT","POST","PATCH"],ep=class{static{o(this,"OAuthClientAuthHandler")}#e=(0,a0.createCrypto)();#t;transporter;constructor(e){e&&"clientId"in e?(this.#t=e,this.transporter=new Qo.Gaxios):(this.#t=e?.clientAuthentication,this.transporter=e?.transporter||new Qo.Gaxios)}applyClientAuthenticationOptions(e,r){e.headers=Qo.Gaxios.mergeHeaders(e.headers),this.injectAuthenticatedHeaders(e,r),r||this.injectAuthenticatedRequestBody(e)}injectAuthenticatedHeaders(e,r){if(r)e.headers=Qo.Gaxios.mergeHeaders(e.headers,{authorization:`Bearer ${r}`});else if(this.#t?.confidentialClientType==="basic"){e.headers=Qo.Gaxios.mergeHeaders(e.headers);let n=this.#t.clientId,i=this.#t.clientSecret||"",u=this.#e.encodeBase64StringUtf8(`${n}:${i}`);Qo.Gaxios.mergeHeaders(e.headers,{authorization:`Basic ${u}`})}}injectAuthenticatedRequestBody(e){if(this.#t?.confidentialClientType==="request-body"){let r=(e.method||"GET").toUpperCase();if(!s0.includes(r))throw new Error(`${r} HTTP method does not support ${this.#t.confidentialClientType} client authentication`);let i=new Headers(e.headers).get("content-type");if(i?.startsWith("application/x-www-form-urlencoded")||e.data instanceof URLSearchParams){let u=new URLSearchParams(e.data??"");u.append("client_id",this.#t.clientId),u.append("client_secret",this.#t.clientSecret||""),e.data=u}else if(i?.startsWith("application/json"))e.data=e.data||{},Object.assign(e.data,{client_id:this.#t.clientId,client_secret:this.#t.clientSecret||""});else throw new Error(`${i} content-types are not supported with ${this.#t.confidentialClientType} client authentication`)}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};ca.OAuthClientAuthHandler=ep;function u0(t,e){let r=t.error,n=t.error_description,i=t.error_uri,u=`Error code ${r}`;typeof n<"u"&&(u+=`: ${n}`),typeof i<"u"&&(u+=` - ${i}`);let c=new Error(u);if(e){let l=Object.keys(e);e.stack&&l.push("stack"),l.forEach(p=>{p!=="message"&&Object.defineProperty(c,p,{value:e[p],writable:!1,enumerable:!0})})}return c}o(u0,"getErrorFromOAuthErrorResponse")});var _u=M(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.StsCredentials=void 0;var c0=yt(),l0=Zt(),YE=tp(),d0=vr(),rp=class t extends YE.OAuthClientAuthHandler{static{o(this,"StsCredentials")}#e;constructor(e={tokenExchangeEndpoint:""},r){(typeof e!="object"||e instanceof URL)&&(e={tokenExchangeEndpoint:e,clientAuthentication:r}),super(e),this.#e=e.tokenExchangeEndpoint}async exchangeToken(e,r,n){let i={grant_type:e.grantType,resource:e.resource,audience:e.audience,scope:e.scope?.join(" "),requested_token_type:e.requestedTokenType,subject_token:e.subjectToken,subject_token_type:e.subjectTokenType,actor_token:e.actingParty?.actorToken,actor_token_type:e.actingParty?.actorTokenType,options:n&&JSON.stringify(n)},u={...t.RETRY_CONFIG,url:this.#e.toString(),method:"POST",headers:r,data:new URLSearchParams((0,d0.removeUndefinedValuesInObject)(i))};l0.AuthClient.setMethodName(u,"exchangeToken"),this.applyClientAuthenticationOptions(u);try{let c=await this.transporter.request(u),l=c.data;return l.res=c,l}catch(c){throw c instanceof c0.GaxiosError&&c.response?(0,YE.getErrorFromOAuthErrorResponse)(c.response.data,c):c}}};yu.StsCredentials=rp});var kn=M(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.BaseExternalAccountClient=ur.CLOUD_RESOURCE_MANAGER=ur.EXTERNAL_ACCOUNT_TYPE=ur.EXPIRATION_TIME_OFFSET=void 0;var p0=yt(),f0=require("stream"),np=Zt(),m0=_u(),XE=vr(),h0=_d(),g0="urn:ietf:params:oauth:grant-type:token-exchange",y0="urn:ietf:params:oauth:token-type:access_token",op="https://www.googleapis.com/auth/cloud-platform",_0=3600;ur.EXPIRATION_TIME_OFFSET=300*1e3;ur.EXTERNAL_ACCOUNT_TYPE="external_account";ur.CLOUD_RESOURCE_MANAGER="https://cloudresourcemanager.googleapis.com/v1/projects/";var b0="//iam\\.googleapis\\.com/locations/[^/]+/workforcePools/[^/]+/providers/.+",v0="https://sts.{universeDomain}/v1/token",ip=class t extends np.AuthClient{static{o(this,"BaseExternalAccountClient")}scopes;projectNumber;audience;subjectTokenType;stsCredential;clientAuth;credentialSourceType;cachedAccessToken;serviceAccountImpersonationUrl;serviceAccountImpersonationLifetime;workforcePoolUserProject;configLifetimeRequested;tokenUrl;cloudResourceManagerURL;supplierContext;#e=null;constructor(e){super(e);let r=(0,XE.originalOrCamelOptions)(e),n=r.get("type");if(n&&n!==ur.EXTERNAL_ACCOUNT_TYPE)throw new Error(`Expected "${ur.EXTERNAL_ACCOUNT_TYPE}" type but received "${e.type}"`);let i=r.get("client_id"),u=r.get("client_secret");this.tokenUrl=r.get("token_url")??v0.replace("{universeDomain}",this.universeDomain);let c=r.get("subject_token_type"),l=r.get("workforce_pool_user_project"),p=r.get("service_account_impersonation_url"),f=r.get("service_account_impersonation"),m=(0,XE.originalOrCamelOptions)(f).get("token_lifetime_seconds");this.cloudResourceManagerURL=new URL(r.get("cloud_resource_manager_url")||`https://cloudresourcemanager.${this.universeDomain}/v1/projects/`),i&&(this.clientAuth={confidentialClientType:"basic",clientId:i,clientSecret:u}),this.stsCredential=new m0.StsCredentials({tokenExchangeEndpoint:this.tokenUrl,clientAuthentication:this.clientAuth}),this.scopes=r.get("scopes")||[op],this.cachedAccessToken=null,this.audience=r.get("audience"),this.subjectTokenType=c,this.workforcePoolUserProject=l;let g=new RegExp(b0);if(this.workforcePoolUserProject&&!this.audience.match(g))throw new Error("workforcePoolUserProject should not be set for non-workforce pool credentials.");this.serviceAccountImpersonationUrl=p,this.serviceAccountImpersonationLifetime=m,this.serviceAccountImpersonationLifetime?this.configLifetimeRequested=!0:(this.configLifetimeRequested=!1,this.serviceAccountImpersonationLifetime=_0),this.projectNumber=this.getProjectNumber(this.audience),this.supplierContext={audience:this.audience,subjectTokenType:this.subjectTokenType,transporter:this.transporter}}getServiceAccountEmail(){if(this.serviceAccountImpersonationUrl){if(this.serviceAccountImpersonationUrl.length>256)throw new RangeError(`URL is too long: ${this.serviceAccountImpersonationUrl}`);return/serviceAccounts\/(?<email>[^:]+):generateAccessToken$/.exec(this.serviceAccountImpersonationUrl)?.groups?.email||null}return null}setCredentials(e){super.setCredentials(e),this.cachedAccessToken=e}async getAccessToken(){return(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let e=await this.getAccessToken(),r=new Headers({authorization:`Bearer ${e.token}`});return this.addSharedMetadataHeaders(r)}request(e,r){if(r)this.requestAsync(e).then(n=>r(null,n),n=>r(n,n.response));else return this.requestAsync(e)}async getProjectId(){let e=this.projectNumber||this.workforcePoolUserProject;if(this.projectId)return this.projectId;if(e){let r=await this.getRequestHeaders(),n={...t.RETRY_CONFIG,headers:r,url:`${this.cloudResourceManagerURL.toString()}${e}`};np.AuthClient.setMethodName(n,"getProjectId");let i=await this.transporter.request(n);return this.projectId=i.data.projectId,this.projectId}return null}async requestAsync(e,r=!1){let n;try{let i=await this.getRequestHeaders();e.headers=p0.Gaxios.mergeHeaders(e.headers),this.addUserProjectAndAuthHeaders(e.headers,i),n=await this.transporter.request(e)}catch(i){let u=i.response;if(u){let c=u.status,l=u.config.data instanceof f0.Readable;if(!r&&(c===401||c===403)&&!l&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(e,!0)}throw i}return n}async refreshAccessTokenAsync(){this.#e=this.#e||this.#t();try{return await this.#e}finally{this.#e=null}}async#t(){let e=await this.retrieveSubjectToken(),r={grantType:g0,audience:this.audience,requestedTokenType:y0,subjectToken:e,subjectTokenType:this.subjectTokenType,scope:this.serviceAccountImpersonationUrl?[op]:this.getScopesArray()},n=!this.clientAuth&&this.workforcePoolUserProject?{userProject:this.workforcePoolUserProject}:void 0,i=new Headers({"x-goog-api-client":this.getMetricsHeaderValue()}),u=await this.stsCredential.exchangeToken(r,i,n);return this.serviceAccountImpersonationUrl?this.cachedAccessToken=await this.getImpersonatedAccessToken(u.access_token):u.expires_in?this.cachedAccessToken={access_token:u.access_token,expiry_date:new Date().getTime()+u.expires_in*1e3,res:u.res}:this.cachedAccessToken={access_token:u.access_token,res:u.res},this.credentials={},Object.assign(this.credentials,this.cachedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedAccessToken.expiry_date,access_token:this.cachedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedAccessToken}getProjectNumber(e){let r=e.match(/\/projects\/([^/]+)/);return r?r[1]:null}async getImpersonatedAccessToken(e){let r={...t.RETRY_CONFIG,url:this.serviceAccountImpersonationUrl,method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e}`},data:{scope:this.getScopesArray(),lifetime:this.serviceAccountImpersonationLifetime+"s"}};np.AuthClient.setMethodName(r,"getImpersonatedAccessToken");let n=await this.transporter.request(r),i=n.data;return{access_token:i.accessToken,expiry_date:new Date(i.expireTime).getTime(),res:n}}isExpired(e){let r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:!1}getScopesArray(){return typeof this.scopes=="string"?[this.scopes]:this.scopes||[op]}getMetricsHeaderValue(){let e=process.version.replace(/^v/,""),r=this.serviceAccountImpersonationUrl!==void 0,n=this.credentialSourceType?this.credentialSourceType:"unknown";return`gl-node/${e} auth/${h0.pkg.version} google-byoid-sdk source/${n} sa-impersonation/${r} config-lifetime/${this.configLifetimeRequested}`}getTokenUrl(){return this.tokenUrl}};ur.BaseExternalAccountClient=ip});var eS=M(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.FileSubjectTokenSupplier=void 0;var sp=require("util"),up=require("fs"),E0=(0,sp.promisify)(up.readFile??(()=>{})),S0=(0,sp.promisify)(up.realpath??(()=>{})),P0=(0,sp.promisify)(up.lstat??(()=>{})),ap=class{static{o(this,"FileSubjectTokenSupplier")}filePath;formatType;subjectTokenFieldName;constructor(e){this.filePath=e.filePath,this.formatType=e.formatType,this.subjectTokenFieldName=e.subjectTokenFieldName}async getSubjectToken(){let e=this.filePath;try{if(e=await S0(e),!(await P0(e)).isFile())throw new Error}catch(i){throw i instanceof Error&&(i.message=`The file at ${e} does not exist, or it is not a file. ${i.message}`),i}let r,n=await E0(e,{encoding:"utf8"});if(this.formatType==="text"?r=n:this.formatType==="json"&&this.subjectTokenFieldName&&(r=JSON.parse(n)[this.subjectTokenFieldName]),!r)throw new Error("Unable to parse the subject_token from the credential_source file");return r}};bu.FileSubjectTokenSupplier=ap});var tS=M(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.UrlSubjectTokenSupplier=void 0;var T0=Zt(),cp=class{static{o(this,"UrlSubjectTokenSupplier")}url;headers;formatType;subjectTokenFieldName;additionalGaxiosOptions;constructor(e){this.url=e.url,this.formatType=e.formatType,this.subjectTokenFieldName=e.subjectTokenFieldName,this.headers=e.headers,this.additionalGaxiosOptions=e.additionalGaxiosOptions}async getSubjectToken(e){let r={...this.additionalGaxiosOptions,url:this.url,method:"GET",headers:this.headers};T0.AuthClient.setMethodName(r,"getSubjectToken");let n;if(this.formatType==="text"?n=(await e.transporter.request(r)).data:this.formatType==="json"&&this.subjectTokenFieldName&&(n=(await e.transporter.request(r)).data[this.subjectTokenFieldName]),!n)throw new Error("Unable to parse the subject_token from the credential_source URL");return n}};vu.UrlSubjectTokenSupplier=cp});var rS=M(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.CertificateSubjectTokenSupplier=Yt.InvalidConfigurationError=Yt.CertificateSourceUnavailableError=Yt.CERTIFICATE_CONFIGURATION_ENV_VARIABLE=void 0;var Eu=vr(),Su=require("fs"),Pu=require("crypto"),w0=require("https");Yt.CERTIFICATE_CONFIGURATION_ENV_VARIABLE="GOOGLE_API_CERTIFICATE_CONFIG";var jr=class extends Error{static{o(this,"CertificateSourceUnavailableError")}constructor(e){super(e),this.name="CertificateSourceUnavailableError"}};Yt.CertificateSourceUnavailableError=jr;var cr=class extends Error{static{o(this,"InvalidConfigurationError")}constructor(e){super(e),this.name="InvalidConfigurationError"}};Yt.InvalidConfigurationError=cr;var lp=class{static{o(this,"CertificateSubjectTokenSupplier")}certificateConfigPath;trustChainPath;cert;key;constructor(e){if(!e.useDefaultCertificateConfig&&!e.certificateConfigLocation)throw new cr("Either `useDefaultCertificateConfig` must be true or a `certificateConfigLocation` must be provided.");if(e.useDefaultCertificateConfig&&e.certificateConfigLocation)throw new cr("Both `useDefaultCertificateConfig` and `certificateConfigLocation` cannot be provided.");this.trustChainPath=e.trustChainPath,this.certificateConfigPath=e.certificateConfigLocation??""}async createMtlsHttpsAgent(){if(!this.key||!this.cert)throw new cr("Cannot create mTLS Agent with missing certificate or key");return new w0.Agent({key:this.key,cert:this.cert})}async getSubjectToken(){this.certificateConfigPath=await this.#e();let{certPath:e,keyPath:r}=await this.#t();return{cert:this.cert,key:this.key}=await this.#r(e,r),await this.#n(this.cert)}async#e(){let e=this.certificateConfigPath;if(e){if(await(0,Eu.isValidFile)(e))return e;throw new jr(`Provided certificate config path is invalid: ${e}`)}let r=process.env[Yt.CERTIFICATE_CONFIGURATION_ENV_VARIABLE];if(r){if(await(0,Eu.isValidFile)(r))return r;throw new jr(`Path from environment variable "${Yt.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" is invalid: ${r}`)}let n=(0,Eu.getWellKnownCertificateConfigFileLocation)();if(await(0,Eu.isValidFile)(n))return n;throw new jr(`Could not find certificate configuration file. Searched override path, the "${Yt.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" env var, and the gcloud path (${n}).`)}async#t(){let e=this.certificateConfigPath,r;try{r=await Su.promises.readFile(e,"utf8")}catch{throw new jr(`Failed to read certificate config file at: ${e}`)}try{let n=JSON.parse(r),i=n?.cert_configs?.workload?.cert_path,u=n?.cert_configs?.workload?.key_path;if(!i||!u)throw new cr(`Certificate config file (${e}) is missing required "cert_path" or "key_path" in the workload config.`);return{certPath:i,keyPath:u}}catch(n){throw n instanceof cr?n:new cr(`Failed to parse certificate config from ${e}: ${n.message}`)}}async#r(e,r){let n,i;try{n=await Su.promises.readFile(e),new Pu.X509Certificate(n)}catch(u){let c=u instanceof Error?u.message:String(u);throw new jr(`Failed to read certificate file at ${e}: ${c}`)}try{i=await Su.promises.readFile(r),(0,Pu.createPrivateKey)(i)}catch(u){let c=u instanceof Error?u.message:String(u);throw new jr(`Failed to read private key file at ${r}: ${c}`)}return{cert:n,key:i}}async#n(e){let r=new Pu.X509Certificate(e);if(!this.trustChainPath)return JSON.stringify([r.raw.toString("base64")]);try{let u=((await Su.promises.readFile(this.trustChainPath,"utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g)??[]).map((p,f)=>{try{return new Pu.X509Certificate(p)}catch(m){let g=m instanceof Error?m.message:String(m);throw new cr(`Failed to parse certificate at index ${f} in trust chain file ${this.trustChainPath}: ${g}`)}}),c=u.findIndex(p=>r.raw.equals(p.raw)),l;if(c===-1)l=[r,...u];else if(c===0)l=u;else throw new cr(`Leaf certificate exists in the trust chain but is not the first entry (found at index ${c}).`);return JSON.stringify(l.map(p=>p.raw.toString("base64")))}catch(n){if(n instanceof cr)throw n;let i=n instanceof Error?n.message:String(n);throw new jr(`Failed to process certificate chain from ${this.trustChainPath}: ${i}`)}}};Yt.CertificateSubjectTokenSupplier=lp});var fp=M(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.IdentityPoolClient=void 0;var x0=kn(),dp=vr(),A0=eS(),I0=tS(),nS=rS(),R0=_u(),oS=yt(),pp=class t extends x0.BaseExternalAccountClient{static{o(this,"IdentityPoolClient")}subjectTokenSupplier;constructor(e){super(e);let r=(0,dp.originalOrCamelOptions)(e),n=r.get("credential_source"),i=r.get("subject_token_supplier");if(!n&&!i)throw new Error("A credential source or subject token supplier must be specified.");if(n&&i)throw new Error("Only one of credential source or subject token supplier can be specified.");if(i)this.subjectTokenSupplier=i,this.credentialSourceType="programmatic";else{let u=(0,dp.originalOrCamelOptions)(n),c=(0,dp.originalOrCamelOptions)(u.get("format")),l=c.get("type")||"text",p=c.get("subject_token_field_name");if(l!=="json"&&l!=="text")throw new Error(`Invalid credential_source format "${l}"`);if(l==="json"&&!p)throw new Error("Missing subject_token_field_name for JSON credential_source format");let f=u.get("file"),m=u.get("url"),g=u.get("certificate"),S=u.get("headers");if(f&&m||m&&g||f&&g)throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.');if(f)this.credentialSourceType="file",this.subjectTokenSupplier=new A0.FileSubjectTokenSupplier({filePath:f,formatType:l,subjectTokenFieldName:p});else if(m)this.credentialSourceType="url",this.subjectTokenSupplier=new I0.UrlSubjectTokenSupplier({url:m,formatType:l,subjectTokenFieldName:p,headers:S,additionalGaxiosOptions:t.RETRY_CONFIG});else if(g){this.credentialSourceType="certificate";let h=new nS.CertificateSubjectTokenSupplier({useDefaultCertificateConfig:g.use_default_certificate_config,certificateConfigLocation:g.certificate_config_location,trustChainPath:g.trust_chain_path});this.subjectTokenSupplier=h}else throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.')}}async retrieveSubjectToken(){let e=await this.subjectTokenSupplier.getSubjectToken(this.supplierContext);if(this.subjectTokenSupplier instanceof nS.CertificateSubjectTokenSupplier){let r=await this.subjectTokenSupplier.createMtlsHttpsAgent();this.stsCredential=new R0.StsCredentials({tokenExchangeEndpoint:this.getTokenUrl(),clientAuthentication:this.clientAuth,transporter:new oS.Gaxios({agent:r})}),this.transporter=new oS.Gaxios({...this.transporter.defaults||{},agent:r})}return e}};Tu.IdentityPoolClient=pp});var hp=M(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.AwsRequestSigner=void 0;var wu=yt(),aS=Xi(),iS="AWS4-HMAC-SHA256",C0="aws4_request",mp=class{static{o(this,"AwsRequestSigner")}getCredentials;region;crypto;constructor(e,r){this.getCredentials=e,this.region=r,this.crypto=(0,aS.createCrypto)()}async getRequestOptions(e){if(!e.url)throw new RangeError('"url" is required in "amzOptions"');let r=typeof e.data=="object"?JSON.stringify(e.data):e.data,n=e.url,i=e.method||"GET",u=e.body||r,c=e.headers,l=await this.getCredentials(),p=new URL(n);if(typeof u!="string"&&u!==void 0)throw new TypeError(`'requestPayload' is expected to be a string if provided. Got: ${u}`);let f=await k0({crypto:this.crypto,host:p.host,canonicalUri:p.pathname,canonicalQuerystring:p.search.slice(1),method:i,region:this.region,securityCredentials:l,requestPayload:u,additionalAmzHeaders:c}),m=wu.Gaxios.mergeHeaders(f.amzDate?{"x-amz-date":f.amzDate}:{},{authorization:f.authorizationHeader,host:p.host},c||{});l.token&&wu.Gaxios.mergeHeaders(m,{"x-amz-security-token":l.token});let g={url:n,method:i,headers:m};return u!==void 0&&(g.body=u),g}};xu.AwsRequestSigner=mp;async function la(t,e,r){return await t.signWithHmacSha256(e,r)}o(la,"sign");async function O0(t,e,r,n,i){let u=await la(t,`AWS4${e}`,r),c=await la(t,u,n),l=await la(t,c,i);return await la(t,l,"aws4_request")}o(O0,"getSigningKey");async function k0(t){let e=wu.Gaxios.mergeHeaders(t.additionalAmzHeaders),r=t.requestPayload||"",n=t.host.split(".")[0],i=new Date,u=i.toISOString().replace(/[-:]/g,"").replace(/\.[0-9]+/,""),c=i.toISOString().replace(/[-]/g,"").replace(/T.*/,"");t.securityCredentials.token&&e.set("x-amz-security-token",t.securityCredentials.token);let l=wu.Gaxios.mergeHeaders({host:t.host},e.has("date")?{}:{"x-amz-date":u},e),p="",f=[...l.keys()].sort();f.forEach(k=>{p+=`${k}:${l.get(k)}
41
- `});let m=f.join(";"),g=await t.crypto.sha256DigestHex(r),S=`${t.method.toUpperCase()}
40
+ "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,oa="secret must be a string or buffer",Go="key must be a string or a buffer",vk="key must be a string, a buffer or an object",Ud=typeof sr.createPublicKey=="function";Ud&&(Go+=" or a KeyObject",oa+="or a KeyObject");function yE(t){if(!Wo.isBuffer(t)&&typeof t!="string"&&(!Ud||typeof t!="object"||typeof t.type!="string"||typeof t.asymmetricKeyType!="string"||typeof t.export!="function"))throw Pr(Go)}o(yE,"checkIsPublicKey");function _E(t){if(!Wo.isBuffer(t)&&typeof t!="string"&&typeof t!="object")throw Pr(vk)}o(_E,"checkIsPrivateKey");function Ek(t){if(!Wo.isBuffer(t)){if(typeof t=="string")return t;if(!Ud||typeof t!="object"||t.type!=="secret"||typeof t.export!="function")throw Pr(oa)}}o(Ek,"checkIsSecretKey");function jd(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}o(jd,"fromBase64");function bE(t){t=t.toString();var e=4-t.length%4;if(e!==4)for(var r=0;r<e;++r)t+="=";return t.replace(/\-/g,"+").replace(/_/g,"/")}o(bE,"toBase64");function Pr(t){var e=[].slice.call(arguments,1),r=hE.format.bind(hE,t).apply(null,e);return new TypeError(r)}o(Pr,"typeError");function Pk(t){return Wo.isBuffer(t)||typeof t=="string"}o(Pk,"bufferOrString");function ia(t){return Pk(t)||(t=JSON.stringify(t)),t}o(ia,"normalizeInput");function vE(t){return o(function(r,n){Ek(n),r=ia(r);var i=sr.createHmac("sha"+t,n),u=(i.update(r),i.digest("base64"));return jd(u)},"sign")}o(vE,"createHmacSigner");var Dd,Sk="timingSafeEqual"in sr?o(function(e,r){return e.byteLength!==r.byteLength?!1:sr.timingSafeEqual(e,r)},"timingSafeEqual"):o(function(e,r){return Dd||(Dd=mE()),Dd(e,r)},"timingSafeEqual");function Tk(t){return o(function(r,n,i){var u=vE(t)(r,i);return Sk(Wo.from(n),Wo.from(u))},"verify")}o(Tk,"createHmacVerifier");function EE(t){return o(function(r,n){_E(n),r=ia(r);var i=sr.createSign("RSA-SHA"+t),u=(i.update(r),i.sign(n,"base64"));return jd(u)},"sign")}o(EE,"createKeySigner");function PE(t){return o(function(r,n,i){yE(i),r=ia(r),n=bE(n);var u=sr.createVerify("RSA-SHA"+t);return u.update(r),u.verify(i,n,"base64")},"verify")}o(PE,"createKeyVerifier");function wk(t){return o(function(r,n){_E(n),r=ia(r);var i=sr.createSign("RSA-SHA"+t),u=(i.update(r),i.sign({key:n,padding:sr.constants.RSA_PKCS1_PSS_PADDING,saltLength:sr.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return jd(u)},"sign")}o(wk,"createPSSKeySigner");function xk(t){return o(function(r,n,i){yE(i),r=ia(r),n=bE(n);var u=sr.createVerify("RSA-SHA"+t);return u.update(r),u.verify({key:i,padding:sr.constants.RSA_PKCS1_PSS_PADDING,saltLength:sr.constants.RSA_PSS_SALTLEN_DIGEST},n,"base64")},"verify")}o(xk,"createPSSKeyVerifier");function Ak(t){var e=EE(t);return o(function(){var n=e.apply(null,arguments);return n=gE.derToJose(n,"ES"+t),n},"sign")}o(Ak,"createECDSASigner");function Ik(t){var e=PE(t);return o(function(n,i,u){i=gE.joseToDer(i,"ES"+t).toString("base64");var c=e(n,i,u);return c},"verify")}o(Ik,"createECDSAVerifer");function Rk(){return o(function(){return""},"sign")}o(Rk,"createNoneSigner");function Ck(){return o(function(e,r){return r===""},"verify")}o(Ck,"createNoneVerifier");SE.exports=o(function(e){var r={hs:vE,rs:EE,ps:wk,es:Ak,none:Rk},n={hs:Tk,rs:PE,ps:xk,es:Ik,none:Ck},i=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!i)throw Pr(bk,e);var u=(i[1]||i[3]).toLowerCase(),c=i[2];return{sign:r[u](c),verify:n[u](c)}},"jwa")});var Ld=L((R3,TE)=>{var Ok=require("buffer").Buffer;TE.exports=o(function(e){return typeof e=="string"?e:typeof e=="number"||Ok.isBuffer(e)?e.toString():JSON.stringify(e)},"toString")});var CE=L((O3,RE)=>{var kk=qo().Buffer,wE=zd(),$k=Md(),zk=require("stream"),xE=Ld(),Fd=require("util");function AE(t,e){return kk.from(t,e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}o(AE,"base64url");function Nk(t,e,r){r=r||"utf8";var n=AE(xE(t),"binary"),i=AE(xE(e),r);return Fd.format("%s.%s",n,i)}o(Nk,"jwsSecuredInput");function IE(t){var e=t.header,r=t.payload,n=t.secret||t.privateKey,i=t.encoding,u=$k(e.alg),c=Nk(e,r,i),l=u.sign(c,n);return Fd.format("%s.%s",c,l)}o(IE,"jwsSign");function du(t){var e=t.secret;if(e=e??t.privateKey,e=e??t.key,/^hs/i.test(t.header.alg)===!0&&e==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var r=new wE(e);this.readable=!0,this.header=t.header,this.encoding=t.encoding,this.secret=this.privateKey=this.key=r,this.payload=new wE(t.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}o(du,"SignStream");Fd.inherits(du,zk);du.prototype.sign=o(function(){try{var e=IE({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(r){this.readable=!1,this.emit("error",r),this.emit("close")}},"sign");du.sign=IE;RE.exports=du});var LE=L(($3,ME)=>{var kE=qo().Buffer,OE=zd(),Dk=Md(),Uk=require("stream"),$E=Ld(),jk=require("util"),Mk=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function Lk(t){return Object.prototype.toString.call(t)==="[object Object]"}o(Lk,"isObject");function Fk(t){if(Lk(t))return t;try{return JSON.parse(t)}catch{return}}o(Fk,"safeJsonParse");function zE(t){var e=t.split(".",1)[0];return Fk(kE.from(e,"base64").toString("binary"))}o(zE,"headerFromJWS");function Bk(t){return t.split(".",2).join(".")}o(Bk,"securedInputFromJWS");function NE(t){return t.split(".")[2]}o(NE,"signatureFromJWS");function qk(t,e){e=e||"utf8";var r=t.split(".")[1];return kE.from(r,"base64").toString(e)}o(qk,"payloadFromJWS");function DE(t){return Mk.test(t)&&!!zE(t)}o(DE,"isValidJws");function UE(t,e,r){if(!e){var n=new Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}t=$E(t);var i=NE(t),u=Bk(t),c=Dk(e);return c.verify(u,i,r)}o(UE,"jwsVerify");function jE(t,e){if(e=e||{},t=$E(t),!DE(t))return null;var r=zE(t);if(!r)return null;var n=qk(t);return(r.typ==="JWT"||e.json)&&(n=JSON.parse(n,e.encoding)),{header:r,payload:n,signature:NE(t)}}o(jE,"jwsDecode");function Zo(t){t=t||{};var e=t.secret;if(e=e??t.publicKey,e=e??t.key,/^hs/i.test(t.algorithm)===!0&&e==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var r=new OE(e);this.readable=!0,this.algorithm=t.algorithm,this.encoding=t.encoding,this.secret=this.publicKey=this.key=r,this.signature=new OE(t.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}o(Zo,"VerifyStream");jk.inherits(Zo,Uk);Zo.prototype.verify=o(function(){try{var e=UE(this.signature.buffer,this.algorithm,this.key.buffer),r=jE(this.signature.buffer,this.encoding);return this.emit("done",e,r),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(n){this.readable=!1,this.emit("error",n),this.emit("close")}},"verify");Zo.decode=jE;Zo.isValid=DE;Zo.verify=UE;ME.exports=Zo});var Bd=L(kn=>{var FE=CE(),pu=LE(),Vk=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];kn.ALGORITHMS=Vk;kn.sign=FE.sign;kn.verify=pu.verify;kn.decode=pu.decode;kn.isValid=pu.isValid;kn.createSign=o(function(e){return new FE(e)},"createSign");kn.createVerify=o(function(e){return new pu(e)},"createVerify")});var rP=L(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.GoogleToken=void 0;var BE=fu(require("fs")),Hk=_t(),Gk=fu(Bd()),Wk=fu(require("path")),Zk=require("util");function fu(t,e){if(typeof WeakMap=="function")var r=new WeakMap,n=new WeakMap;return(fu=o(function(u,c){if(!c&&u&&u.__esModule)return u;var l,p,f={__proto__:null,default:u};if(u===null||an(u)!="object"&&typeof u!="function")return f;if(l=c?n:r){if(l.has(u))return l.get(u);l.set(u,f)}for(var m in u)m!=="default"&&{}.hasOwnProperty.call(u,m)&&((p=(l=Object.defineProperty)&&Object.getOwnPropertyDescriptor(u,m))&&(p.get||p.set)?l(f,m,p):f[m]=u[m]);return f},"_interopRequireWildcard"))(t,e)}o(fu,"_interopRequireWildcard");function an(t){"@babel/helpers - typeof";return an=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},an(t)}o(an,"_typeof");function Jk(t,e){QE(t,e),e.add(t)}o(Jk,"_classPrivateMethodInitSpec");function Kk(t,e,r){QE(t,e),e.set(t,r)}o(Kk,"_classPrivateFieldInitSpec");function QE(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(QE,"_checkPrivateRedeclaration");function qE(t,e,r){return t.set(Sr(t,e),r),r}o(qE,"_classPrivateFieldSet");function VE(t,e){return t.get(Sr(t,e))}o(VE,"_classPrivateFieldGet");function Sr(t,e,r){if(typeof t=="function"?t===e:t.has(e))return arguments.length<3?e:r;throw new TypeError("Private element is not present on this object")}o(Sr,"_assertClassBrand");function HE(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,eP(n.key),n)}}o(HE,"_defineProperties");function YE(t,e,r){return e&&HE(t.prototype,e),r&&HE(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}o(YE,"_createClass");function XE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}o(XE,"_classCallCheck");function Qk(t,e,r){return e=ca(e),Yk(t,Zd()?Reflect.construct(e,r||[],ca(t).constructor):e.apply(t,r))}o(Qk,"_callSuper");function Yk(t,e){if(e&&(an(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xk(t)}o(Yk,"_possibleConstructorReturn");function Xk(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}o(Xk,"_assertThisInitialized");function e0(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ua(t,e)}o(e0,"_inherits");function qd(t){var e=typeof Map=="function"?new Map:void 0;return qd=o(function(n){if(n===null||!r0(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return t0(n,arguments,ca(this).constructor)}return o(i,"Wrapper"),i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ua(i,n)},"_wrapNativeSuper"),qd(t)}o(qd,"_wrapNativeSuper");function t0(t,e,r){if(Zd())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&ua(i,r.prototype),i}o(t0,"_construct");function Zd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Zd=o(function(){return!!t},"_isNativeReflectConstruct"))()}o(Zd,"_isNativeReflectConstruct");function r0(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}o(r0,"_isNativeFunction");function ua(t,e){return ua=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},ua(t,e)}o(ua,"_setPrototypeOf");function ca(t){return ca=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ca(t)}o(ca,"_getPrototypeOf");function Jt(t,e,r){return(e=eP(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}o(Jt,"_defineProperty");function eP(t){var e=n0(t,"string");return an(e)=="symbol"?e:e+""}o(eP,"_toPropertyKey");function n0(t,e){if(an(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(an(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}o(n0,"_toPrimitive");function Qt(){var t,e,r=typeof Symbol=="function"?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function u(h,b,T,E){var w=b&&b.prototype instanceof l?b:l,k=Object.create(w.prototype);return Kt(k,"_invoke",(function(q,W,H){var V,J,re,G=0,je=H||[],Ee=!1,ve={p:0,n:0,v:t,a:ze,f:ze.bind(t,4),d:o(function(Ue,He){return V=Ue,J=0,re=t,ve.n=He,c},"d")};function ze($e,Ue){for(J=$e,re=Ue,e=0;!Ee&&G&&!He&&e<je.length;e++){var He,Ke=je[e],Ut=ve.p,Pt=Ke[2];$e>3?(He=Pt===Ue)&&(re=Ke[(J=Ke[4])?5:(J=3,3)],Ke[4]=Ke[5]=t):Ke[0]<=Ut&&((He=$e<2&&Ut<Ke[1])?(J=0,ve.v=Ue,ve.n=Ke[1]):Ut<Pt&&(He=$e<3||Ke[0]>Ue||Ue>Pt)&&(Ke[4]=$e,Ke[5]=Ue,ve.n=Pt,J=0))}if(He||$e>1)return c;throw Ee=!0,Ue}return o(ze,"d"),function($e,Ue,He){if(G>1)throw TypeError("Generator is already running");for(Ee&&Ue===1&&ze(Ue,He),J=Ue,re=He;(e=J<2?t:re)||!Ee;){V||(J?J<3?(J>1&&(ve.n=-1),ze(J,re)):ve.n=re:ve.v=re);try{if(G=2,V){if(J||($e="next"),e=V[$e]){if(!(e=e.call(V,re)))throw TypeError("iterator result is not an object");if(!e.done)return e;re=e.value,J<2&&(J=0)}else J===1&&(e=V.return)&&e.call(V),J<2&&(re=TypeError("The iterator does not provide a '"+$e+"' method"),J=1);V=t}else if((e=(Ee=ve.n<0)?re:q.call(W,ve))!==c)break}catch(Ke){V=t,J=1,re=Ke}finally{G=1}}return{value:e,done:Ee}}})(h,T,E),!0),k}o(u,"i");var c={};function l(){}o(l,"Generator");function p(){}o(p,"GeneratorFunction");function f(){}o(f,"GeneratorFunctionPrototype"),e=Object.getPrototypeOf;var m=[][n]?e(e([][n]())):(Kt(e={},n,function(){return this}),e),y=f.prototype=l.prototype=Object.create(m);function P(h){return Object.setPrototypeOf?Object.setPrototypeOf(h,f):(h.__proto__=f,Kt(h,i,"GeneratorFunction")),h.prototype=Object.create(y),h}return o(P,"f"),p.prototype=f,Kt(y,"constructor",f),Kt(f,"constructor",p),p.displayName="GeneratorFunction",Kt(f,i,"GeneratorFunction"),Kt(y),Kt(y,i,"Generator"),Kt(y,n,function(){return this}),Kt(y,"toString",function(){return"[object Generator]"}),(Qt=o(function(){return{w:u,m:P}},"_regenerator"))()}o(Qt,"_regenerator");function Kt(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch{i=0}Kt=o(function(c,l,p,f){if(l)i?i(c,l,{value:p,enumerable:!f,configurable:!f,writable:!f}):c[l]=p;else{var m=o(function(P,h){Kt(c,P,function(b){return this._invoke(P,h,b)})},"o");m("next",0),m("throw",1),m("return",2)}},"_regeneratorDefine"),Kt(t,e,r,n)}o(Kt,"_regeneratorDefine2");function GE(t,e,r,n,i,u,c){try{var l=t[u](c),p=l.value}catch(f){return void r(f)}l.done?e(p):Promise.resolve(p).then(n,i)}o(GE,"asyncGeneratorStep");function Jo(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var u=t.apply(e,r);function c(p){GE(u,n,i,c,l,"next",p)}o(c,"_next");function l(p){GE(u,n,i,c,l,"throw",p)}o(l,"_throw"),c(void 0)})}}o(Jo,"_asyncToGenerator");var WE=BE.readFile?(0,Zk.promisify)(BE.readFile):Jo(Qt().m(o(function t(){return Qt().w(function(e){for(;;)switch(e.n){case 0:throw new sa("use key rather than keyFile.","MISSING_CREDENTIALS");case 1:return e.a(2)}},t)},"_callee"))),ZE="https://oauth2.googleapis.com/token",o0="https://oauth2.googleapis.com/revoke?token=",sa=(function(t){function e(r,n){var i;return XE(this,e),i=Qk(this,e,[r]),Jt(i,"code",void 0),i.code=n,i}return o(e,"ErrorWithCode"),e0(e,t),YE(e)})(qd(Error)),aa=new WeakMap,Ur=new WeakSet,U3=mu.GoogleToken=(function(){function t(e){XE(this,t),Jk(this,Ur),Jt(this,"expiresAt",void 0),Jt(this,"key",void 0),Jt(this,"keyFile",void 0),Jt(this,"iss",void 0),Jt(this,"sub",void 0),Jt(this,"scope",void 0),Jt(this,"rawToken",void 0),Jt(this,"tokenExpires",void 0),Jt(this,"email",void 0),Jt(this,"additionalClaims",void 0),Jt(this,"eagerRefreshThresholdMillis",void 0),Jt(this,"transporter",{request:o(function(n){return(0,Hk.request)(n)},"request")}),Kk(this,aa,void 0),Sr(Ur,this,tP).call(this,e)}return o(t,"GoogleToken"),YE(t,[{key:"accessToken",get:o(function(){return this.rawToken?this.rawToken.access_token:void 0},"get")},{key:"idToken",get:o(function(){return this.rawToken?this.rawToken.id_token:void 0},"get")},{key:"tokenType",get:o(function(){return this.rawToken?this.rawToken.token_type:void 0},"get")},{key:"refreshToken",get:o(function(){return this.rawToken?this.rawToken.refresh_token:void 0},"get")},{key:"hasExpired",value:o(function(){var r=new Date().getTime();return this.rawToken&&this.expiresAt?r>=this.expiresAt:!0},"hasExpired")},{key:"isTokenExpiring",value:o(function(){var r,n=new Date().getTime(),i=(r=this.eagerRefreshThresholdMillis)!==null&&r!==void 0?r:0;return this.rawToken&&this.expiresAt?this.expiresAt<=n+i:!0},"isTokenExpiring")},{key:"getToken",value:o(function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(an(r)==="object"&&(n=r,r=void 0),n=Object.assign({forceRefresh:!1},n),r){var i=r;Sr(Ur,this,JE).call(this,n).then(function(u){return i(null,u)},r);return}return Sr(Ur,this,JE).call(this,n)},"getToken")},{key:"getCredentials",value:(function(){var e=Jo(Qt().m(o(function n(i){var u,c,l,p,f,m,y;return Qt().w(function(P){for(;;)switch(P.n){case 0:u=Wk.extname(i),y=u,P.n=y===".json"?1:y===".der"||y===".crt"||y===".pem"?4:y===".p12"||y===".pfx"?6:7;break;case 1:return P.n=2,WE(i,"utf8");case 2:if(c=P.v,l=JSON.parse(c),p=l.private_key,f=l.client_email,!(!p||!f)){P.n=3;break}throw new sa("private_key and client_email are required.","MISSING_CREDENTIALS");case 3:return P.a(2,{privateKey:p,clientEmail:f});case 4:return P.n=5,WE(i,"utf8");case 5:return m=P.v,P.a(2,{privateKey:m});case 6:throw new sa("*.p12 certificates are not supported after v6.1.2. Consider utilizing *.json format or converting *.p12 to *.pem using the OpenSSL CLI.","UNKNOWN_CERTIFICATE_TYPE");case 7:throw new sa("Unknown certificate type. Type is determined based on file extension. Current supported extensions are *.json, and *.pem.","UNKNOWN_CERTIFICATE_TYPE");case 8:return P.a(2)}},n)},"_callee2")));function r(n){return e.apply(this,arguments)}return o(r,"getCredentials"),r})()},{key:"revokeToken",value:o(function(r){if(r){Sr(Ur,this,KE).call(this).then(function(){return r()},r);return}return Sr(Ur,this,KE).call(this)},"revokeToken")}])})();function JE(t){return Vd.apply(this,arguments)}o(JE,"_getTokenAsync");function Vd(){return Vd=Jo(Qt().m(o(function t(e){return Qt().w(function(r){for(;;)switch(r.n){case 0:if(!(VE(aa,this)&&!e.forceRefresh)){r.n=1;break}return r.a(2,VE(aa,this));case 1:return r.p=1,r.n=2,qE(aa,this,Sr(Ur,this,i0).call(this,e));case 2:return r.a(2,r.v);case 3:return r.p=3,qE(aa,this,void 0),r.f(3);case 4:return r.a(2)}},t,this,[[1,,3,4]])},"_callee3"))),Vd.apply(this,arguments)}o(Vd,"_getTokenAsync2");function i0(t){return Hd.apply(this,arguments)}o(i0,"_getTokenAsyncInner");function Hd(){return Hd=Jo(Qt().m(o(function t(e){var r;return Qt().w(function(n){for(;;)switch(n.n){case 0:if(!(this.isTokenExpiring()===!1&&e.forceRefresh===!1)){n.n=1;break}return n.a(2,Promise.resolve(this.rawToken));case 1:if(!(!this.key&&!this.keyFile)){n.n=2;break}throw new Error("No key or keyFile set.");case 2:if(!(!this.key&&this.keyFile)){n.n=4;break}return n.n=3,this.getCredentials(this.keyFile);case 3:r=n.v,this.key=r.privateKey,this.iss=r.clientEmail||this.iss,r.clientEmail||Sr(Ur,this,a0).call(this);case 4:return n.a(2,Sr(Ur,this,s0).call(this))}},t,this)},"_callee4"))),Hd.apply(this,arguments)}o(Hd,"_getTokenAsyncInner2");function a0(){if(!this.iss)throw new sa("email is required.","MISSING_CREDENTIALS")}o(a0,"_ensureEmail");function KE(){return Gd.apply(this,arguments)}o(KE,"_revokeTokenAsync");function Gd(){return Gd=Jo(Qt().m(o(function t(){var e;return Qt().w(function(r){for(;;)switch(r.n){case 0:if(this.accessToken){r.n=1;break}throw new Error("No token to revoke.");case 1:return e=o0+this.accessToken,r.n=2,this.transporter.request({url:e,retry:!0});case 2:Sr(Ur,this,tP).call(this,{email:this.iss,sub:this.sub,key:this.key,keyFile:this.keyFile,scope:this.scope,additionalClaims:this.additionalClaims});case 3:return r.a(2)}},t,this)},"_callee5"))),Gd.apply(this,arguments)}o(Gd,"_revokeTokenAsync2");function tP(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.keyFile=t.keyFile,this.key=t.key,this.rawToken=void 0,this.iss=t.email||t.iss,this.sub=t.sub,this.additionalClaims=t.additionalClaims,an(t.scope)==="object"?this.scope=t.scope.join(" "):this.scope=t.scope,this.eagerRefreshThresholdMillis=t.eagerRefreshThresholdMillis,t.transporter&&(this.transporter=t.transporter)}o(tP,"_configure");function s0(){return Wd.apply(this,arguments)}o(s0,"_requestToken");function Wd(){return Wd=Jo(Qt().m(o(function t(){var e,r,n,i,u,c,l,p,f,m;return Qt().w(function(y){for(;;)switch(y.n){case 0:return e=Math.floor(new Date().getTime()/1e3),r=this.additionalClaims||{},n=Object.assign({iss:this.iss,scope:this.scope,aud:ZE,exp:e+3600,iat:e,sub:this.sub},r),i=Gk.sign({header:{alg:"RS256"},payload:n,secret:this.key}),y.p=1,y.n=2,this.transporter.request({method:"POST",url:ZE,data:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:i}),responseType:"json",retryConfig:{httpMethodsToRetry:["POST"]}});case 2:return u=y.v,this.rawToken=u.data,this.expiresAt=u.data.expires_in===null||u.data.expires_in===void 0?void 0:(e+u.data.expires_in)*1e3,y.a(2,this.rawToken);case 3:throw y.p=3,m=y.v,this.rawToken=void 0,this.tokenExpires=void 0,p=m.response&&(c=m.response)!==null&&c!==void 0&&c.data?(l=m.response)===null||l===void 0?void 0:l.data:{},p.error&&(f=p.error_description?": ".concat(p.error_description):"",m.message="".concat(p.error).concat(f)),m;case 4:return y.a(2)}},t,this,[[1,3]])},"_callee6"))),Wd.apply(this,arguments)}o(Wd,"_requestToken2")});var Kd=L(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.JWTAccess=void 0;var u0=Bd(),c0=vr(),nP={alg:"RS256",typ:"JWT"},Jd=class t{static{o(this,"JWTAccess")}email;key;keyId;projectId;eagerRefreshThresholdMillis;cache=new c0.LRUCache({capacity:500,maxAge:3600*1e3});constructor(e,r,n,i){this.email=e,this.key=r,this.keyId=n,this.eagerRefreshThresholdMillis=i??300*1e3}getCachedKey(e,r){let n=e;if(r&&Array.isArray(r)&&r.length?n=e?`${e}_${r.join("_")}`:`${r.join("_")}`:typeof r=="string"&&(n=e?`${e}_${r}`:r),!n)throw Error("Scopes or url must be provided");return n}getRequestHeaders(e,r,n){let i=this.getCachedKey(e,n),u=this.cache.get(i),c=Date.now();if(u&&u.expiration-c>this.eagerRefreshThresholdMillis)return new Headers(u.headers);let l=Math.floor(Date.now()/1e3),p=t.getExpirationTime(l),f;if(Array.isArray(n)&&(n=n.join(" ")),n?f={iss:this.email,sub:this.email,scope:n,exp:p,iat:l}:f={iss:this.email,sub:this.email,aud:e,exp:p,iat:l},r){for(let b in f)if(r[b])throw new Error(`The '${b}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`)}let m=this.keyId?{...nP,kid:this.keyId}:nP,y=Object.assign(f,r),P=u0.sign({header:m,payload:y,secret:this.key}),h=new Headers({authorization:`Bearer ${P}`});return this.cache.set(i,{expiration:p*1e3,headers:h}),h}static getExpirationTime(e){return e+3600}fromJSON(e){if(!e)throw new Error("Must pass in a JSON object containing the service account auth settings.");if(!e.client_email)throw new Error("The incoming JSON object does not contain a client_email field");if(!e.private_key)throw new Error("The incoming JSON object does not contain a private_key field");this.email=e.client_email,this.key=e.private_key,this.keyId=e.private_key_id,this.projectId=e.project_id}fromStream(e,r){if(r)this.fromStreamAsync(e).then(()=>r(),r);else return this.fromStreamAsync(e)}fromStreamAsync(e){return new Promise((r,n)=>{e||n(new Error("Must pass in a stream containing the service account auth settings."));let i="";e.setEncoding("utf8").on("data",u=>i+=u).on("error",n).on("end",()=>{try{let u=JSON.parse(i);this.fromJSON(u),r()}catch(u){n(u)}})})}};hu.JWTAccess=Jd});var Yd=L(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.JWT=void 0;var oP=rP(),l0=Kd(),d0=eo(),gu=Zt(),Qd=class t extends d0.OAuth2Client{static{o(this,"JWT")}email;keyFile;key;keyId;defaultScopes;scopes;scope;subject;gtoken;additionalClaims;useJWTAccessWithScope;defaultServicePath;access;constructor(e={}){super(e),this.email=e.email,this.keyFile=e.keyFile,this.key=e.key,this.keyId=e.keyId,this.scopes=e.scopes,this.subject=e.subject,this.additionalClaims=e.additionalClaims,this.credentials={refresh_token:"jwt-placeholder",expiry_date:1}}createScoped(e){let r=new t(this);return r.scopes=e,r}async getRequestMetadataAsync(e){e=this.defaultServicePath?`https://${this.defaultServicePath}/`:e;let r=!this.hasUserScopes()&&e||this.useJWTAccessWithScope&&this.hasAnyScopes()||this.universeDomain!==gu.DEFAULT_UNIVERSE;if(this.subject&&this.universeDomain!==gu.DEFAULT_UNIVERSE)throw new RangeError(`Service Account user is configured for the credential. Domain-wide delegation is not supported in universes other than ${gu.DEFAULT_UNIVERSE}`);if(!this.apiKey&&r)if(this.additionalClaims&&this.additionalClaims.target_audience){let{tokens:n}=await this.refreshToken();return{headers:this.addSharedMetadataHeaders(new Headers({authorization:`Bearer ${n.id_token}`}))}}else{this.access||(this.access=new l0.JWTAccess(this.email,this.key,this.keyId,this.eagerRefreshThresholdMillis));let n;this.hasUserScopes()?n=this.scopes:e||(n=this.defaultScopes);let i=this.useJWTAccessWithScope||this.universeDomain!==gu.DEFAULT_UNIVERSE,u=await this.access.getRequestHeaders(e??void 0,this.additionalClaims,i?n:void 0);return{headers:this.addSharedMetadataHeaders(u)}}else return this.hasAnyScopes()||this.apiKey?super.getRequestMetadataAsync(e):{headers:new Headers}}async fetchIdToken(e){let r=new oP.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:{target_audience:e},transporter:this.transporter});if(await r.getToken({forceRefresh:!0}),!r.idToken)throw new Error("Unknown error: Failed to fetch ID token");return r.idToken}hasUserScopes(){return this.scopes?this.scopes.length>0:!1}hasAnyScopes(){return!!(this.scopes&&this.scopes.length>0||this.defaultScopes&&this.defaultScopes.length>0)}authorize(e){if(e)this.authorizeAsync().then(r=>e(null,r),e);else return this.authorizeAsync()}async authorizeAsync(){let e=await this.refreshToken();if(!e)throw new Error("No result returned");return this.credentials=e.tokens,this.credentials.refresh_token="jwt-placeholder",this.key=this.gtoken.key,this.email=this.gtoken.iss,e.tokens}async refreshTokenNoCache(){let e=this.createGToken(),n={access_token:(await e.getToken({forceRefresh:this.isTokenExpiring()})).access_token,token_type:"Bearer",expiry_date:e.expiresAt,id_token:e.idToken};return this.emit("tokens",n),{res:null,tokens:n}}createGToken(){return this.gtoken||(this.gtoken=new oP.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:this.additionalClaims,transporter:this.transporter})),this.gtoken}fromJSON(e){if(!e)throw new Error("Must pass in a JSON object containing the service account auth settings.");if(!e.client_email)throw new Error("The incoming JSON object does not contain a client_email field");if(!e.private_key)throw new Error("The incoming JSON object does not contain a private_key field");this.email=e.client_email,this.key=e.private_key,this.keyId=e.private_key_id,this.projectId=e.project_id,this.quotaProjectId=e.quota_project_id,this.universeDomain=e.universe_domain||this.universeDomain}fromStream(e,r){if(r)this.fromStreamAsync(e).then(()=>r(),r);else return this.fromStreamAsync(e)}fromStreamAsync(e){return new Promise((r,n)=>{if(!e)throw new Error("Must pass in a stream containing the service account auth settings.");let i="";e.setEncoding("utf8").on("error",n).on("data",u=>i+=u).on("end",()=>{try{let u=JSON.parse(i);this.fromJSON(u),r()}catch(u){n(u)}})})}fromAPIKey(e){if(typeof e!="string")throw new Error("Must provide an API Key string.");this.apiKey=e}async getCredentials(){if(this.key)return{private_key:this.key,client_email:this.email};if(this.keyFile){let r=await this.createGToken().getCredentials(this.keyFile);return{private_key:r.privateKey,client_email:r.clientEmail}}throw new Error("A key or a keyFile must be provided to getCredentials.")}};yu.JWT=Qd});var ep=L(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});Ko.UserRefreshClient=Ko.USER_REFRESH_ACCOUNT_TYPE=void 0;var p0=eo(),f0=Zt();Ko.USER_REFRESH_ACCOUNT_TYPE="authorized_user";var Xd=class t extends p0.OAuth2Client{static{o(this,"UserRefreshClient")}_refreshToken;constructor(e,r,n,i,u){let c=e&&typeof e=="object"?e:{clientId:e,clientSecret:r,refreshToken:n,eagerRefreshThresholdMillis:i,forceRefreshOnFailure:u};super(c),this._refreshToken=c.refreshToken,this.credentials.refresh_token=c.refreshToken}async refreshTokenNoCache(){return super.refreshTokenNoCache(this._refreshToken)}async fetchIdToken(e){let r={...t.RETRY_CONFIG,url:this.endpoints.oauth2TokenUrl,method:"POST",data:new URLSearchParams({client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token",refresh_token:this._refreshToken,target_audience:e})};return f0.AuthClient.setMethodName(r,"fetchIdToken"),(await this.transporter.request(r)).data.id_token}fromJSON(e){if(!e)throw new Error("Must pass in a JSON object containing the user refresh token");if(e.type!=="authorized_user")throw new Error('The incoming JSON object does not have the "authorized_user" type');if(!e.client_id)throw new Error("The incoming JSON object does not contain a client_id field");if(!e.client_secret)throw new Error("The incoming JSON object does not contain a client_secret field");if(!e.refresh_token)throw new Error("The incoming JSON object does not contain a refresh_token field");this._clientId=e.client_id,this._clientSecret=e.client_secret,this._refreshToken=e.refresh_token,this.credentials.refresh_token=e.refresh_token,this.quotaProjectId=e.quota_project_id,this.universeDomain=e.universe_domain||this.universeDomain}fromStream(e,r){if(r)this.fromStreamAsync(e).then(()=>r(),r);else return this.fromStreamAsync(e)}async fromStreamAsync(e){return new Promise((r,n)=>{if(!e)return n(new Error("Must pass in a stream containing the user refresh token."));let i="";e.setEncoding("utf8").on("error",n).on("data",u=>i+=u).on("end",()=>{try{let u=JSON.parse(i);return this.fromJSON(u),r()}catch(u){return n(u)}})})}static fromJSON(e){let r=new t;return r.fromJSON(e),r}};Ko.UserRefreshClient=Xd});var rp=L(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.Impersonated=Qo.IMPERSONATED_ACCOUNT_TYPE=void 0;var iP=eo(),m0=_t(),h0=vr();Qo.IMPERSONATED_ACCOUNT_TYPE="impersonated_service_account";var tp=class t extends iP.OAuth2Client{static{o(this,"Impersonated")}sourceClient;targetPrincipal;targetScopes;delegates;lifetime;endpoint;constructor(e={}){if(super(e),this.credentials={expiry_date:1,refresh_token:"impersonated-placeholder"},this.sourceClient=e.sourceClient??new iP.OAuth2Client,this.targetPrincipal=e.targetPrincipal??"",this.delegates=e.delegates??[],this.targetScopes=e.targetScopes??[],this.lifetime=e.lifetime??3600,!!!(0,h0.originalOrCamelOptions)(e).get("universe_domain"))this.universeDomain=this.sourceClient.universeDomain;else if(this.sourceClient.universeDomain!==this.universeDomain)throw new RangeError(`Universe domain ${this.sourceClient.universeDomain} in source credentials does not match ${this.universeDomain} universe domain set for impersonated credentials.`);this.endpoint=e.endpoint??`https://iamcredentials.${this.universeDomain}`}async sign(e){await this.sourceClient.getAccessToken();let r=`projects/-/serviceAccounts/${this.targetPrincipal}`,n=`${this.endpoint}/v1/${r}:signBlob`,i={delegates:this.delegates,payload:Buffer.from(e).toString("base64")};return(await this.sourceClient.request({...t.RETRY_CONFIG,url:n,data:i,method:"POST"})).data}getTargetPrincipal(){return this.targetPrincipal}async refreshToken(){try{await this.sourceClient.getAccessToken();let e="projects/-/serviceAccounts/"+this.targetPrincipal,r=`${this.endpoint}/v1/${e}:generateAccessToken`,n={delegates:this.delegates,scope:this.targetScopes,lifetime:this.lifetime+"s"},i=await this.sourceClient.request({...t.RETRY_CONFIG,url:r,data:n,method:"POST"}),u=i.data;return this.credentials.access_token=u.accessToken,this.credentials.expiry_date=Date.parse(u.expireTime),{tokens:this.credentials,res:i}}catch(e){if(!(e instanceof Error))throw e;let r=0,n="";throw e instanceof m0.GaxiosError&&(r=e?.response?.data?.error?.status,n=e?.response?.data?.error?.message),r&&n?(e.message=`${r}: unable to impersonate: ${n}`,e):(e.message=`unable to impersonate: ${e}`,e)}}async fetchIdToken(e,r){await this.sourceClient.getAccessToken();let n=`projects/-/serviceAccounts/${this.targetPrincipal}`,i=`${this.endpoint}/v1/${n}:generateIdToken`,u={delegates:this.delegates,audience:e,includeEmail:r?.includeEmail??!0,useEmailAzp:r?.includeEmail??!0};return(await this.sourceClient.request({...t.RETRY_CONFIG,url:i,data:u,method:"POST"})).data.token}};Qo.Impersonated=tp});var op=L(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.OAuthClientAuthHandler=void 0;la.getErrorFromOAuthErrorResponse=_0;var Yo=_t(),g0=ea(),y0=["PUT","POST","PATCH"],np=class{static{o(this,"OAuthClientAuthHandler")}#e=(0,g0.createCrypto)();#t;transporter;constructor(e){e&&"clientId"in e?(this.#t=e,this.transporter=new Yo.Gaxios):(this.#t=e?.clientAuthentication,this.transporter=e?.transporter||new Yo.Gaxios)}applyClientAuthenticationOptions(e,r){e.headers=Yo.Gaxios.mergeHeaders(e.headers),this.injectAuthenticatedHeaders(e,r),r||this.injectAuthenticatedRequestBody(e)}injectAuthenticatedHeaders(e,r){if(r)e.headers=Yo.Gaxios.mergeHeaders(e.headers,{authorization:`Bearer ${r}`});else if(this.#t?.confidentialClientType==="basic"){e.headers=Yo.Gaxios.mergeHeaders(e.headers);let n=this.#t.clientId,i=this.#t.clientSecret||"",u=this.#e.encodeBase64StringUtf8(`${n}:${i}`);Yo.Gaxios.mergeHeaders(e.headers,{authorization:`Basic ${u}`})}}injectAuthenticatedRequestBody(e){if(this.#t?.confidentialClientType==="request-body"){let r=(e.method||"GET").toUpperCase();if(!y0.includes(r))throw new Error(`${r} HTTP method does not support ${this.#t.confidentialClientType} client authentication`);let i=new Headers(e.headers).get("content-type");if(i?.startsWith("application/x-www-form-urlencoded")||e.data instanceof URLSearchParams){let u=new URLSearchParams(e.data??"");u.append("client_id",this.#t.clientId),u.append("client_secret",this.#t.clientSecret||""),e.data=u}else if(i?.startsWith("application/json"))e.data=e.data||{},Object.assign(e.data,{client_id:this.#t.clientId,client_secret:this.#t.clientSecret||""});else throw new Error(`${i} content-types are not supported with ${this.#t.confidentialClientType} client authentication`)}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};la.OAuthClientAuthHandler=np;function _0(t,e){let r=t.error,n=t.error_description,i=t.error_uri,u=`Error code ${r}`;typeof n<"u"&&(u+=`: ${n}`),typeof i<"u"&&(u+=` - ${i}`);let c=new Error(u);if(e){let l=Object.keys(e);e.stack&&l.push("stack"),l.forEach(p=>{p!=="message"&&Object.defineProperty(c,p,{value:e[p],writable:!1,enumerable:!0})})}return c}o(_0,"getErrorFromOAuthErrorResponse")});var bu=L(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.StsCredentials=void 0;var b0=_t(),v0=Zt(),aP=op(),E0=vr(),ip=class t extends aP.OAuthClientAuthHandler{static{o(this,"StsCredentials")}#e;constructor(e={tokenExchangeEndpoint:""},r){(typeof e!="object"||e instanceof URL)&&(e={tokenExchangeEndpoint:e,clientAuthentication:r}),super(e),this.#e=e.tokenExchangeEndpoint}async exchangeToken(e,r,n){let i={grant_type:e.grantType,resource:e.resource,audience:e.audience,scope:e.scope?.join(" "),requested_token_type:e.requestedTokenType,subject_token:e.subjectToken,subject_token_type:e.subjectTokenType,actor_token:e.actingParty?.actorToken,actor_token_type:e.actingParty?.actorTokenType,options:n&&JSON.stringify(n)},u={...t.RETRY_CONFIG,url:this.#e.toString(),method:"POST",headers:r,data:new URLSearchParams((0,E0.removeUndefinedValuesInObject)(i))};v0.AuthClient.setMethodName(u,"exchangeToken"),this.applyClientAuthenticationOptions(u);try{let c=await this.transporter.request(u),l=c.data;return l.res=c,l}catch(c){throw c instanceof b0.GaxiosError&&c.response?(0,aP.getErrorFromOAuthErrorResponse)(c.response.data,c):c}}};_u.StsCredentials=ip});var $n=L(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.BaseExternalAccountClient=ur.CLOUD_RESOURCE_MANAGER=ur.EXTERNAL_ACCOUNT_TYPE=ur.EXPIRATION_TIME_OFFSET=void 0;var P0=_t(),S0=require("stream"),ap=Zt(),T0=bu(),sP=vr(),w0=Ed(),x0="urn:ietf:params:oauth:grant-type:token-exchange",A0="urn:ietf:params:oauth:token-type:access_token",sp="https://www.googleapis.com/auth/cloud-platform",I0=3600;ur.EXPIRATION_TIME_OFFSET=300*1e3;ur.EXTERNAL_ACCOUNT_TYPE="external_account";ur.CLOUD_RESOURCE_MANAGER="https://cloudresourcemanager.googleapis.com/v1/projects/";var R0="//iam\\.googleapis\\.com/locations/[^/]+/workforcePools/[^/]+/providers/.+",C0="https://sts.{universeDomain}/v1/token",up=class t extends ap.AuthClient{static{o(this,"BaseExternalAccountClient")}scopes;projectNumber;audience;subjectTokenType;stsCredential;clientAuth;credentialSourceType;cachedAccessToken;serviceAccountImpersonationUrl;serviceAccountImpersonationLifetime;workforcePoolUserProject;configLifetimeRequested;tokenUrl;cloudResourceManagerURL;supplierContext;#e=null;constructor(e){super(e);let r=(0,sP.originalOrCamelOptions)(e),n=r.get("type");if(n&&n!==ur.EXTERNAL_ACCOUNT_TYPE)throw new Error(`Expected "${ur.EXTERNAL_ACCOUNT_TYPE}" type but received "${e.type}"`);let i=r.get("client_id"),u=r.get("client_secret");this.tokenUrl=r.get("token_url")??C0.replace("{universeDomain}",this.universeDomain);let c=r.get("subject_token_type"),l=r.get("workforce_pool_user_project"),p=r.get("service_account_impersonation_url"),f=r.get("service_account_impersonation"),m=(0,sP.originalOrCamelOptions)(f).get("token_lifetime_seconds");this.cloudResourceManagerURL=new URL(r.get("cloud_resource_manager_url")||`https://cloudresourcemanager.${this.universeDomain}/v1/projects/`),i&&(this.clientAuth={confidentialClientType:"basic",clientId:i,clientSecret:u}),this.stsCredential=new T0.StsCredentials({tokenExchangeEndpoint:this.tokenUrl,clientAuthentication:this.clientAuth}),this.scopes=r.get("scopes")||[sp],this.cachedAccessToken=null,this.audience=r.get("audience"),this.subjectTokenType=c,this.workforcePoolUserProject=l;let y=new RegExp(R0);if(this.workforcePoolUserProject&&!this.audience.match(y))throw new Error("workforcePoolUserProject should not be set for non-workforce pool credentials.");this.serviceAccountImpersonationUrl=p,this.serviceAccountImpersonationLifetime=m,this.serviceAccountImpersonationLifetime?this.configLifetimeRequested=!0:(this.configLifetimeRequested=!1,this.serviceAccountImpersonationLifetime=I0),this.projectNumber=this.getProjectNumber(this.audience),this.supplierContext={audience:this.audience,subjectTokenType:this.subjectTokenType,transporter:this.transporter}}getServiceAccountEmail(){if(this.serviceAccountImpersonationUrl){if(this.serviceAccountImpersonationUrl.length>256)throw new RangeError(`URL is too long: ${this.serviceAccountImpersonationUrl}`);return/serviceAccounts\/(?<email>[^:]+):generateAccessToken$/.exec(this.serviceAccountImpersonationUrl)?.groups?.email||null}return null}setCredentials(e){super.setCredentials(e),this.cachedAccessToken=e}async getAccessToken(){return(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let e=await this.getAccessToken(),r=new Headers({authorization:`Bearer ${e.token}`});return this.addSharedMetadataHeaders(r)}request(e,r){if(r)this.requestAsync(e).then(n=>r(null,n),n=>r(n,n.response));else return this.requestAsync(e)}async getProjectId(){let e=this.projectNumber||this.workforcePoolUserProject;if(this.projectId)return this.projectId;if(e){let r=await this.getRequestHeaders(),n={...t.RETRY_CONFIG,headers:r,url:`${this.cloudResourceManagerURL.toString()}${e}`};ap.AuthClient.setMethodName(n,"getProjectId");let i=await this.transporter.request(n);return this.projectId=i.data.projectId,this.projectId}return null}async requestAsync(e,r=!1){let n;try{let i=await this.getRequestHeaders();e.headers=P0.Gaxios.mergeHeaders(e.headers),this.addUserProjectAndAuthHeaders(e.headers,i),n=await this.transporter.request(e)}catch(i){let u=i.response;if(u){let c=u.status,l=u.config.data instanceof S0.Readable;if(!r&&(c===401||c===403)&&!l&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(e,!0)}throw i}return n}async refreshAccessTokenAsync(){this.#e=this.#e||this.#t();try{return await this.#e}finally{this.#e=null}}async#t(){let e=await this.retrieveSubjectToken(),r={grantType:x0,audience:this.audience,requestedTokenType:A0,subjectToken:e,subjectTokenType:this.subjectTokenType,scope:this.serviceAccountImpersonationUrl?[sp]:this.getScopesArray()},n=!this.clientAuth&&this.workforcePoolUserProject?{userProject:this.workforcePoolUserProject}:void 0,i=new Headers({"x-goog-api-client":this.getMetricsHeaderValue()}),u=await this.stsCredential.exchangeToken(r,i,n);return this.serviceAccountImpersonationUrl?this.cachedAccessToken=await this.getImpersonatedAccessToken(u.access_token):u.expires_in?this.cachedAccessToken={access_token:u.access_token,expiry_date:new Date().getTime()+u.expires_in*1e3,res:u.res}:this.cachedAccessToken={access_token:u.access_token,res:u.res},this.credentials={},Object.assign(this.credentials,this.cachedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedAccessToken.expiry_date,access_token:this.cachedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedAccessToken}getProjectNumber(e){let r=e.match(/\/projects\/([^/]+)/);return r?r[1]:null}async getImpersonatedAccessToken(e){let r={...t.RETRY_CONFIG,url:this.serviceAccountImpersonationUrl,method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e}`},data:{scope:this.getScopesArray(),lifetime:this.serviceAccountImpersonationLifetime+"s"}};ap.AuthClient.setMethodName(r,"getImpersonatedAccessToken");let n=await this.transporter.request(r),i=n.data;return{access_token:i.accessToken,expiry_date:new Date(i.expireTime).getTime(),res:n}}isExpired(e){let r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:!1}getScopesArray(){return typeof this.scopes=="string"?[this.scopes]:this.scopes||[sp]}getMetricsHeaderValue(){let e=process.version.replace(/^v/,""),r=this.serviceAccountImpersonationUrl!==void 0,n=this.credentialSourceType?this.credentialSourceType:"unknown";return`gl-node/${e} auth/${w0.pkg.version} google-byoid-sdk source/${n} sa-impersonation/${r} config-lifetime/${this.configLifetimeRequested}`}getTokenUrl(){return this.tokenUrl}};ur.BaseExternalAccountClient=up});var uP=L(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.FileSubjectTokenSupplier=void 0;var lp=require("util"),dp=require("fs"),O0=(0,lp.promisify)(dp.readFile??(()=>{})),k0=(0,lp.promisify)(dp.realpath??(()=>{})),$0=(0,lp.promisify)(dp.lstat??(()=>{})),cp=class{static{o(this,"FileSubjectTokenSupplier")}filePath;formatType;subjectTokenFieldName;constructor(e){this.filePath=e.filePath,this.formatType=e.formatType,this.subjectTokenFieldName=e.subjectTokenFieldName}async getSubjectToken(){let e=this.filePath;try{if(e=await k0(e),!(await $0(e)).isFile())throw new Error}catch(i){throw i instanceof Error&&(i.message=`The file at ${e} does not exist, or it is not a file. ${i.message}`),i}let r,n=await O0(e,{encoding:"utf8"});if(this.formatType==="text"?r=n:this.formatType==="json"&&this.subjectTokenFieldName&&(r=JSON.parse(n)[this.subjectTokenFieldName]),!r)throw new Error("Unable to parse the subject_token from the credential_source file");return r}};vu.FileSubjectTokenSupplier=cp});var cP=L(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.UrlSubjectTokenSupplier=void 0;var z0=Zt(),pp=class{static{o(this,"UrlSubjectTokenSupplier")}url;headers;formatType;subjectTokenFieldName;additionalGaxiosOptions;constructor(e){this.url=e.url,this.formatType=e.formatType,this.subjectTokenFieldName=e.subjectTokenFieldName,this.headers=e.headers,this.additionalGaxiosOptions=e.additionalGaxiosOptions}async getSubjectToken(e){let r={...this.additionalGaxiosOptions,url:this.url,method:"GET",headers:this.headers};z0.AuthClient.setMethodName(r,"getSubjectToken");let n;if(this.formatType==="text"?n=(await e.transporter.request(r)).data:this.formatType==="json"&&this.subjectTokenFieldName&&(n=(await e.transporter.request(r)).data[this.subjectTokenFieldName]),!n)throw new Error("Unable to parse the subject_token from the credential_source URL");return n}};Eu.UrlSubjectTokenSupplier=pp});var lP=L(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.CertificateSubjectTokenSupplier=Yt.InvalidConfigurationError=Yt.CertificateSourceUnavailableError=Yt.CERTIFICATE_CONFIGURATION_ENV_VARIABLE=void 0;var Pu=vr(),Su=require("fs"),Tu=require("crypto"),N0=require("https");Yt.CERTIFICATE_CONFIGURATION_ENV_VARIABLE="GOOGLE_API_CERTIFICATE_CONFIG";var jr=class extends Error{static{o(this,"CertificateSourceUnavailableError")}constructor(e){super(e),this.name="CertificateSourceUnavailableError"}};Yt.CertificateSourceUnavailableError=jr;var cr=class extends Error{static{o(this,"InvalidConfigurationError")}constructor(e){super(e),this.name="InvalidConfigurationError"}};Yt.InvalidConfigurationError=cr;var fp=class{static{o(this,"CertificateSubjectTokenSupplier")}certificateConfigPath;trustChainPath;cert;key;constructor(e){if(!e.useDefaultCertificateConfig&&!e.certificateConfigLocation)throw new cr("Either `useDefaultCertificateConfig` must be true or a `certificateConfigLocation` must be provided.");if(e.useDefaultCertificateConfig&&e.certificateConfigLocation)throw new cr("Both `useDefaultCertificateConfig` and `certificateConfigLocation` cannot be provided.");this.trustChainPath=e.trustChainPath,this.certificateConfigPath=e.certificateConfigLocation??""}async createMtlsHttpsAgent(){if(!this.key||!this.cert)throw new cr("Cannot create mTLS Agent with missing certificate or key");return new N0.Agent({key:this.key,cert:this.cert})}async getSubjectToken(){this.certificateConfigPath=await this.#e();let{certPath:e,keyPath:r}=await this.#t();return{cert:this.cert,key:this.key}=await this.#r(e,r),await this.#n(this.cert)}async#e(){let e=this.certificateConfigPath;if(e){if(await(0,Pu.isValidFile)(e))return e;throw new jr(`Provided certificate config path is invalid: ${e}`)}let r=process.env[Yt.CERTIFICATE_CONFIGURATION_ENV_VARIABLE];if(r){if(await(0,Pu.isValidFile)(r))return r;throw new jr(`Path from environment variable "${Yt.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" is invalid: ${r}`)}let n=(0,Pu.getWellKnownCertificateConfigFileLocation)();if(await(0,Pu.isValidFile)(n))return n;throw new jr(`Could not find certificate configuration file. Searched override path, the "${Yt.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" env var, and the gcloud path (${n}).`)}async#t(){let e=this.certificateConfigPath,r;try{r=await Su.promises.readFile(e,"utf8")}catch{throw new jr(`Failed to read certificate config file at: ${e}`)}try{let n=JSON.parse(r),i=n?.cert_configs?.workload?.cert_path,u=n?.cert_configs?.workload?.key_path;if(!i||!u)throw new cr(`Certificate config file (${e}) is missing required "cert_path" or "key_path" in the workload config.`);return{certPath:i,keyPath:u}}catch(n){throw n instanceof cr?n:new cr(`Failed to parse certificate config from ${e}: ${n.message}`)}}async#r(e,r){let n,i;try{n=await Su.promises.readFile(e),new Tu.X509Certificate(n)}catch(u){let c=u instanceof Error?u.message:String(u);throw new jr(`Failed to read certificate file at ${e}: ${c}`)}try{i=await Su.promises.readFile(r),(0,Tu.createPrivateKey)(i)}catch(u){let c=u instanceof Error?u.message:String(u);throw new jr(`Failed to read private key file at ${r}: ${c}`)}return{cert:n,key:i}}async#n(e){let r=new Tu.X509Certificate(e);if(!this.trustChainPath)return JSON.stringify([r.raw.toString("base64")]);try{let u=((await Su.promises.readFile(this.trustChainPath,"utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g)??[]).map((p,f)=>{try{return new Tu.X509Certificate(p)}catch(m){let y=m instanceof Error?m.message:String(m);throw new cr(`Failed to parse certificate at index ${f} in trust chain file ${this.trustChainPath}: ${y}`)}}),c=u.findIndex(p=>r.raw.equals(p.raw)),l;if(c===-1)l=[r,...u];else if(c===0)l=u;else throw new cr(`Leaf certificate exists in the trust chain but is not the first entry (found at index ${c}).`);return JSON.stringify(l.map(p=>p.raw.toString("base64")))}catch(n){if(n instanceof cr)throw n;let i=n instanceof Error?n.message:String(n);throw new jr(`Failed to process certificate chain from ${this.trustChainPath}: ${i}`)}}};Yt.CertificateSubjectTokenSupplier=fp});var gp=L(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.IdentityPoolClient=void 0;var D0=$n(),mp=vr(),U0=uP(),j0=cP(),dP=lP(),M0=bu(),pP=_t(),hp=class t extends D0.BaseExternalAccountClient{static{o(this,"IdentityPoolClient")}subjectTokenSupplier;constructor(e){super(e);let r=(0,mp.originalOrCamelOptions)(e),n=r.get("credential_source"),i=r.get("subject_token_supplier");if(!n&&!i)throw new Error("A credential source or subject token supplier must be specified.");if(n&&i)throw new Error("Only one of credential source or subject token supplier can be specified.");if(i)this.subjectTokenSupplier=i,this.credentialSourceType="programmatic";else{let u=(0,mp.originalOrCamelOptions)(n),c=(0,mp.originalOrCamelOptions)(u.get("format")),l=c.get("type")||"text",p=c.get("subject_token_field_name");if(l!=="json"&&l!=="text")throw new Error(`Invalid credential_source format "${l}"`);if(l==="json"&&!p)throw new Error("Missing subject_token_field_name for JSON credential_source format");let f=u.get("file"),m=u.get("url"),y=u.get("certificate"),P=u.get("headers");if(f&&m||m&&y||f&&y)throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.');if(f)this.credentialSourceType="file",this.subjectTokenSupplier=new U0.FileSubjectTokenSupplier({filePath:f,formatType:l,subjectTokenFieldName:p});else if(m)this.credentialSourceType="url",this.subjectTokenSupplier=new j0.UrlSubjectTokenSupplier({url:m,formatType:l,subjectTokenFieldName:p,headers:P,additionalGaxiosOptions:t.RETRY_CONFIG});else if(y){this.credentialSourceType="certificate";let h=new dP.CertificateSubjectTokenSupplier({useDefaultCertificateConfig:y.use_default_certificate_config,certificateConfigLocation:y.certificate_config_location,trustChainPath:y.trust_chain_path});this.subjectTokenSupplier=h}else throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.')}}async retrieveSubjectToken(){let e=await this.subjectTokenSupplier.getSubjectToken(this.supplierContext);if(this.subjectTokenSupplier instanceof dP.CertificateSubjectTokenSupplier){let r=await this.subjectTokenSupplier.createMtlsHttpsAgent();this.stsCredential=new M0.StsCredentials({tokenExchangeEndpoint:this.getTokenUrl(),clientAuthentication:this.clientAuth,transporter:new pP.Gaxios({agent:r})}),this.transporter=new pP.Gaxios({...this.transporter.defaults||{},agent:r})}return e}};wu.IdentityPoolClient=hp});var _p=L(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.AwsRequestSigner=void 0;var xu=_t(),mP=ea(),fP="AWS4-HMAC-SHA256",L0="aws4_request",yp=class{static{o(this,"AwsRequestSigner")}getCredentials;region;crypto;constructor(e,r){this.getCredentials=e,this.region=r,this.crypto=(0,mP.createCrypto)()}async getRequestOptions(e){if(!e.url)throw new RangeError('"url" is required in "amzOptions"');let r=typeof e.data=="object"?JSON.stringify(e.data):e.data,n=e.url,i=e.method||"GET",u=e.body||r,c=e.headers,l=await this.getCredentials(),p=new URL(n);if(typeof u!="string"&&u!==void 0)throw new TypeError(`'requestPayload' is expected to be a string if provided. Got: ${u}`);let f=await B0({crypto:this.crypto,host:p.host,canonicalUri:p.pathname,canonicalQuerystring:p.search.slice(1),method:i,region:this.region,securityCredentials:l,requestPayload:u,additionalAmzHeaders:c}),m=xu.Gaxios.mergeHeaders(f.amzDate?{"x-amz-date":f.amzDate}:{},{authorization:f.authorizationHeader,host:p.host},c||{});l.token&&xu.Gaxios.mergeHeaders(m,{"x-amz-security-token":l.token});let y={url:n,method:i,headers:m};return u!==void 0&&(y.body=u),y}};Au.AwsRequestSigner=yp;async function da(t,e,r){return await t.signWithHmacSha256(e,r)}o(da,"sign");async function F0(t,e,r,n,i){let u=await da(t,`AWS4${e}`,r),c=await da(t,u,n),l=await da(t,c,i);return await da(t,l,"aws4_request")}o(F0,"getSigningKey");async function B0(t){let e=xu.Gaxios.mergeHeaders(t.additionalAmzHeaders),r=t.requestPayload||"",n=t.host.split(".")[0],i=new Date,u=i.toISOString().replace(/[-:]/g,"").replace(/\.[0-9]+/,""),c=i.toISOString().replace(/[-]/g,"").replace(/T.*/,"");t.securityCredentials.token&&e.set("x-amz-security-token",t.securityCredentials.token);let l=xu.Gaxios.mergeHeaders({host:t.host},e.has("date")?{}:{"x-amz-date":u},e),p="",f=[...l.keys()].sort();f.forEach(k=>{p+=`${k}:${l.get(k)}
41
+ `});let m=f.join(";"),y=await t.crypto.sha256DigestHex(r),P=`${t.method.toUpperCase()}
42
42
  ${t.canonicalUri}
43
43
  ${t.canonicalQuerystring}
44
44
  ${p}
45
45
  ${m}
46
- ${g}`,h=`${c}/${t.region}/${n}/${C0}`,_=`${iS}
46
+ ${y}`,h=`${c}/${t.region}/${n}/${L0}`,b=`${fP}
47
47
  ${u}
48
48
  ${h}
49
- `+await t.crypto.sha256DigestHex(S),T=await O0(t.crypto,t.securityCredentials.secretAccessKey,c,t.region,n),E=await la(t.crypto,T,_),w=`${iS} Credential=${t.securityCredentials.accessKeyId}/${h}, SignedHeaders=${m}, Signature=${(0,aS.fromArrayBufferToHex)(E)}`;return{amzDate:e.has("date")?void 0:u,authorizationHeader:w,canonicalQuerystring:t.canonicalQuerystring}}o(k0,"generateAuthenticationHeaderMap")});var sS=M(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.DefaultAwsSecurityCredentialsSupplier=void 0;var Au=Zt(),gp=class{static{o(this,"DefaultAwsSecurityCredentialsSupplier")}regionUrl;securityCredentialsUrl;imdsV2SessionTokenUrl;additionalGaxiosOptions;constructor(e){this.regionUrl=e.regionUrl,this.securityCredentialsUrl=e.securityCredentialsUrl,this.imdsV2SessionTokenUrl=e.imdsV2SessionTokenUrl,this.additionalGaxiosOptions=e.additionalGaxiosOptions}async getAwsRegion(e){if(this.#n)return this.#n;let r=new Headers;if(!this.#n&&this.imdsV2SessionTokenUrl&&r.set("x-aws-ec2-metadata-token",await this.#e(e.transporter)),!this.regionUrl)throw new RangeError('Unable to determine AWS region due to missing "options.credential_source.region_url"');let n={...this.additionalGaxiosOptions,url:this.regionUrl,method:"GET",headers:r};Au.AuthClient.setMethodName(n,"getAwsRegion");let i=await e.transporter.request(n);return i.data.substr(0,i.data.length-1)}async getAwsSecurityCredentials(e){if(this.#o)return this.#o;let r=new Headers;this.imdsV2SessionTokenUrl&&r.set("x-aws-ec2-metadata-token",await this.#e(e.transporter));let n=await this.#t(r,e.transporter),i=await this.#r(n,r,e.transporter);return{accessKeyId:i.AccessKeyId,secretAccessKey:i.SecretAccessKey,token:i.Token}}async#e(e){let r={...this.additionalGaxiosOptions,url:this.imdsV2SessionTokenUrl,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"300"}};return Au.AuthClient.setMethodName(r,"#getImdsV2SessionToken"),(await e.request(r)).data}async#t(e,r){if(!this.securityCredentialsUrl)throw new Error('Unable to determine AWS role name due to missing "options.credential_source.url"');let n={...this.additionalGaxiosOptions,url:this.securityCredentialsUrl,method:"GET",headers:e};return Au.AuthClient.setMethodName(n,"#getAwsRoleName"),(await r.request(n)).data}async#r(e,r,n){let i={...this.additionalGaxiosOptions,url:`${this.securityCredentialsUrl}/${e}`,headers:r};return Au.AuthClient.setMethodName(i,"#retrieveAwsSecurityCredentials"),(await n.request(i)).data}get#n(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||null}get#o(){return process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY?{accessKeyId:process.env.AWS_ACCESS_KEY_ID,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY,token:process.env.AWS_SESSION_TOKEN}:null}};Iu.DefaultAwsSecurityCredentialsSupplier=gp});var _p=M(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.AwsClient=void 0;var $0=hp(),N0=kn(),z0=sS(),uS=vr(),D0=yt(),yp=class t extends N0.BaseExternalAccountClient{static{o(this,"AwsClient")}environmentId;awsSecurityCredentialsSupplier;regionalCredVerificationUrl;awsRequestSigner;region;static#e="https://sts.{region}.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15";static AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";static AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254";constructor(e){super(e);let r=(0,uS.originalOrCamelOptions)(e),n=r.get("credential_source"),i=r.get("aws_security_credentials_supplier");if(!n&&!i)throw new Error("A credential source or AWS security credentials supplier must be specified.");if(n&&i)throw new Error("Only one of credential source or AWS security credentials supplier can be specified.");if(i)this.awsSecurityCredentialsSupplier=i,this.regionalCredVerificationUrl=t.#e,this.credentialSourceType="programmatic";else{let u=(0,uS.originalOrCamelOptions)(n);this.environmentId=u.get("environment_id");let c=u.get("region_url"),l=u.get("url"),p=u.get("imdsv2_session_token_url");this.awsSecurityCredentialsSupplier=new z0.DefaultAwsSecurityCredentialsSupplier({regionUrl:c,securityCredentialsUrl:l,imdsV2SessionTokenUrl:p}),this.regionalCredVerificationUrl=u.get("regional_cred_verification_url"),this.credentialSourceType="aws",this.validateEnvironmentId()}this.awsRequestSigner=null,this.region=""}validateEnvironmentId(){let e=this.environmentId?.match(/^(aws)(\d+)$/);if(!e||!this.regionalCredVerificationUrl)throw new Error('No valid AWS "credential_source" provided');if(parseInt(e[2],10)!==1)throw new Error(`aws version "${e[2]}" is not supported in the current build.`)}async retrieveSubjectToken(){this.awsRequestSigner||(this.region=await this.awsSecurityCredentialsSupplier.getAwsRegion(this.supplierContext),this.awsRequestSigner=new $0.AwsRequestSigner(async()=>this.awsSecurityCredentialsSupplier.getAwsSecurityCredentials(this.supplierContext),this.region));let e=await this.awsRequestSigner.getRequestOptions({...t.RETRY_CONFIG,url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"}),r=[];return D0.Gaxios.mergeHeaders({"x-goog-cloud-target-resource":this.audience},e.headers).forEach((i,u)=>r.push({key:u,value:i})),encodeURIComponent(JSON.stringify({url:e.url,method:e.method,headers:r}))}};Ru.AwsClient=yp});var Pp=M(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.InvalidSubjectTokenError=ot.InvalidMessageFieldError=ot.InvalidCodeFieldError=ot.InvalidTokenTypeFieldError=ot.InvalidExpirationTimeFieldError=ot.InvalidSuccessFieldError=ot.InvalidVersionFieldError=ot.ExecutableResponseError=ot.ExecutableResponse=void 0;var Cu="urn:ietf:params:oauth:token-type:saml2",bp="urn:ietf:params:oauth:token-type:id_token",vp="urn:ietf:params:oauth:token-type:jwt",Ep=class{static{o(this,"ExecutableResponse")}version;success;expirationTime;tokenType;errorCode;errorMessage;subjectToken;constructor(e){if(!e.version)throw new Ou("Executable response must contain a 'version' field.");if(e.success===void 0)throw new ku("Executable response must contain a 'success' field.");if(this.version=e.version,this.success=e.success,this.success){if(this.expirationTime=e.expiration_time,this.tokenType=e.token_type,this.tokenType!==Cu&&this.tokenType!==bp&&this.tokenType!==vp)throw new $u(`Executable response must contain a 'token_type' field when successful and it must be one of ${bp}, ${vp}, or ${Cu}.`);if(this.tokenType===Cu){if(!e.saml_response)throw new da(`Executable response must contain a 'saml_response' field when token_type=${Cu}.`);this.subjectToken=e.saml_response}else{if(!e.id_token)throw new da(`Executable response must contain a 'id_token' field when token_type=${bp} or ${vp}.`);this.subjectToken=e.id_token}}else{if(!e.code)throw new Nu("Executable response must contain a 'code' field when unsuccessful.");if(!e.message)throw new zu("Executable response must contain a 'message' field when unsuccessful.");this.errorCode=e.code,this.errorMessage=e.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return this.expirationTime!==void 0&&this.expirationTime<Math.round(Date.now()/1e3)}};ot.ExecutableResponse=Ep;var Mr=class extends Error{static{o(this,"ExecutableResponseError")}constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}};ot.ExecutableResponseError=Mr;var Ou=class extends Mr{static{o(this,"InvalidVersionFieldError")}};ot.InvalidVersionFieldError=Ou;var ku=class extends Mr{static{o(this,"InvalidSuccessFieldError")}};ot.InvalidSuccessFieldError=ku;var Sp=class extends Mr{static{o(this,"InvalidExpirationTimeFieldError")}};ot.InvalidExpirationTimeFieldError=Sp;var $u=class extends Mr{static{o(this,"InvalidTokenTypeFieldError")}};ot.InvalidTokenTypeFieldError=$u;var Nu=class extends Mr{static{o(this,"InvalidCodeFieldError")}};ot.InvalidCodeFieldError=Nu;var zu=class extends Mr{static{o(this,"InvalidMessageFieldError")}};ot.InvalidMessageFieldError=zu;var da=class extends Mr{static{o(this,"InvalidSubjectTokenError")}};ot.InvalidSubjectTokenError=da});var xp=M(Yo=>{"use strict";Object.defineProperty(Yo,"__esModule",{value:!0});Yo.PluggableAuthHandler=Yo.ExecutableError=void 0;var to=Pp(),U0=require("child_process"),Tp=require("fs"),Du=class extends Error{static{o(this,"ExecutableError")}code;constructor(e,r){super(`The executable failed with exit code: ${r} and error message: ${e}.`),this.code=r,Object.setPrototypeOf(this,new.target.prototype)}};Yo.ExecutableError=Du;var wp=class t{static{o(this,"PluggableAuthHandler")}commandComponents;timeoutMillis;outputFile;constructor(e){if(!e.command)throw new Error("No command provided.");if(this.commandComponents=t.parseCommand(e.command),this.timeoutMillis=e.timeoutMillis,!this.timeoutMillis)throw new Error("No timeoutMillis provided.");this.outputFile=e.outputFile}retrieveResponseFromExecutable(e){return new Promise((r,n)=>{let i=U0.spawn(this.commandComponents[0],this.commandComponents.slice(1),{env:{...process.env,...Object.fromEntries(e)}}),u="";i.stdout.on("data",l=>{u+=l}),i.stderr.on("data",l=>{u+=l});let c=setTimeout(()=>(i.removeAllListeners(),i.kill(),n(new Error("The executable failed to finish within the timeout specified."))),this.timeoutMillis);i.on("close",l=>{if(clearTimeout(c),l===0)try{let p=JSON.parse(u),f=new to.ExecutableResponse(p);return r(f)}catch(p){return p instanceof to.ExecutableResponseError?n(p):n(new to.ExecutableResponseError(`The executable returned an invalid response: ${u}`))}else return n(new Du(u,l.toString()))})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0)return;let e;try{e=await Tp.promises.realpath(this.outputFile)}catch{return}if(!(await Tp.promises.lstat(e)).isFile())return;let r=await Tp.promises.readFile(e,{encoding:"utf8"});if(r!=="")try{let n=JSON.parse(r);return new to.ExecutableResponse(n).isValid()?new to.ExecutableResponse(n):void 0}catch(n){throw n instanceof to.ExecutableResponseError?n:new to.ExecutableResponseError(`The output file contained an invalid response: ${r}`)}}static parseCommand(e){let r=e.match(/(?:[^\s"]+|"[^"]*")+/g);if(!r)throw new Error(`Provided command: "${e}" could not be parsed.`);for(let n=0;n<r.length;n++)r[n][0]==='"'&&r[n].slice(-1)==='"'&&(r[n]=r[n].slice(1,-1));return r}};Yo.PluggableAuthHandler=wp});var Ip=M(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.PluggableAuthClient=Xo.ExecutableError=void 0;var j0=kn(),M0=Pp(),cS=xp(),L0=xp();Object.defineProperty(Xo,"ExecutableError",{enumerable:!0,get:o(function(){return L0.ExecutableError},"get")});var F0=30*1e3,lS=5*1e3,dS=120*1e3,B0="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES",pS=1,Ap=class extends j0.BaseExternalAccountClient{static{o(this,"PluggableAuthClient")}command;timeoutMillis;outputFile;handler;constructor(e){if(super(e),!e.credential_source.executable)throw new Error('No valid Pluggable Auth "credential_source" provided.');if(this.command=e.credential_source.executable.command,!this.command)throw new Error('No valid Pluggable Auth "credential_source" provided.');if(e.credential_source.executable.timeout_millis===void 0)this.timeoutMillis=F0;else if(this.timeoutMillis=e.credential_source.executable.timeout_millis,this.timeoutMillis<lS||this.timeoutMillis>dS)throw new Error(`Timeout must be between ${lS} and ${dS} milliseconds.`);this.outputFile=e.credential_source.executable.output_file,this.handler=new cS.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile}),this.credentialSourceType="executable"}async retrieveSubjectToken(){if(process.env[B0]!=="1")throw new Error("Pluggable Auth executables need to be explicitly allowed to run by setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment Variable to 1.");let e;if(this.outputFile&&(e=await this.handler.retrieveCachedResponse()),!e){let r=new Map;r.set("GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE",this.audience),r.set("GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE",this.subjectTokenType),r.set("GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE","0"),this.outputFile&&r.set("GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE",this.outputFile);let n=this.getServiceAccountEmail();n&&r.set("GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL",n),e=await this.handler.retrieveResponseFromExecutable(r)}if(e.version>pS)throw new Error(`Version of executable is not currently supported, maximum supported version is ${pS}.`);if(!e.success)throw new cS.ExecutableError(e.errorMessage,e.errorCode);if(this.outputFile&&!e.expirationTime)throw new M0.InvalidExpirationTimeFieldError("The executable response must contain the `expiration_time` field for successful responses when an output_file has been specified in the configuration.");if(e.isExpired())throw new Error("Executable response is expired.");return e.subjectToken}};Xo.PluggableAuthClient=Ap});var Cp=M(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.ExternalAccountClient=void 0;var q0=kn(),V0=fp(),H0=_p(),G0=Ip(),Rp=class{static{o(this,"ExternalAccountClient")}constructor(){throw new Error("ExternalAccountClients should be initialized via: ExternalAccountClient.fromJSON(), directly via explicit constructors, eg. new AwsClient(options), new IdentityPoolClient(options), newPluggableAuthClientOptions, or via new GoogleAuth(options).getClient()")}static fromJSON(e){return e&&e.type===q0.EXTERNAL_ACCOUNT_TYPE?e.credential_source?.environment_id?new H0.AwsClient(e):e.credential_source?.executable?new G0.PluggableAuthClient(e):new V0.IdentityPoolClient(e):null}};Uu.ExternalAccountClient=Rp});var $p=M(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.ExternalAccountAuthorizedUserClient=ei.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var mS=Zt(),fS=tp(),hS=yt(),W0=require("stream"),Z0=kn();ei.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var J0="https://sts.{universeDomain}/v1/oauthtoken",Op=class t extends fS.OAuthClientAuthHandler{static{o(this,"ExternalAccountAuthorizedUserHandler")}#e;constructor(e){super(e),this.#e=e.tokenRefreshEndpoint}async refreshToken(e,r){let n={...t.RETRY_CONFIG,url:this.#e,method:"POST",headers:r,data:new URLSearchParams({grant_type:"refresh_token",refresh_token:e})};mS.AuthClient.setMethodName(n,"refreshToken"),this.applyClientAuthenticationOptions(n);try{let i=await this.transporter.request(n),u=i.data;return u.res=i,u}catch(i){throw i instanceof hS.GaxiosError&&i.response?(0,fS.getErrorFromOAuthErrorResponse)(i.response.data,i):i}}},kp=class extends mS.AuthClient{static{o(this,"ExternalAccountAuthorizedUserClient")}cachedAccessToken;externalAccountAuthorizedUserHandler;refreshToken;constructor(e){super(e),e.universe_domain&&(this.universeDomain=e.universe_domain),this.refreshToken=e.refresh_token;let r={confidentialClientType:"basic",clientId:e.client_id,clientSecret:e.client_secret};this.externalAccountAuthorizedUserHandler=new Op({tokenRefreshEndpoint:e.token_url??J0.replace("{universeDomain}",this.universeDomain),transporter:this.transporter,clientAuthentication:r}),this.cachedAccessToken=null,this.quotaProjectId=e.quota_project_id,typeof e?.eagerRefreshThresholdMillis!="number"?this.eagerRefreshThresholdMillis=Z0.EXPIRATION_TIME_OFFSET:this.eagerRefreshThresholdMillis=e.eagerRefreshThresholdMillis,this.forceRefreshOnFailure=!!e?.forceRefreshOnFailure}async getAccessToken(){return(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let e=await this.getAccessToken(),r=new Headers({authorization:`Bearer ${e.token}`});return this.addSharedMetadataHeaders(r)}request(e,r){if(r)this.requestAsync(e).then(n=>r(null,n),n=>r(n,n.response));else return this.requestAsync(e)}async requestAsync(e,r=!1){let n;try{let i=await this.getRequestHeaders();e.headers=hS.Gaxios.mergeHeaders(e.headers),this.addUserProjectAndAuthHeaders(e.headers,i),n=await this.transporter.request(e)}catch(i){let u=i.response;if(u){let c=u.status,l=u.config.data instanceof W0.Readable;if(!r&&(c===401||c===403)&&!l&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(e,!0)}throw i}return n}async refreshAccessTokenAsync(){let e=await this.externalAccountAuthorizedUserHandler.refreshToken(this.refreshToken);return this.cachedAccessToken={access_token:e.access_token,expiry_date:new Date().getTime()+e.expires_in*1e3,res:e.res},e.refresh_token!==void 0&&(this.refreshToken=e.refresh_token),this.cachedAccessToken}isExpired(e){let r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:!1}};ei.ExternalAccountAuthorizedUserClient=kp});var bS=M(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.GoogleAuth=Tr.GoogleAuthExceptionMessages=void 0;var K0=require("child_process"),pa=require("fs"),Q0=yt(),fa=Yi(),Y0=require("os"),Np=require("path"),X0=Xi(),e$=Ad(),t$=Rd(),r$=Cd(),ti=Jd(),gS=Qd(),ri=Xd(),n$=Cp(),ma=kn(),zp=Zt(),yS=$p(),_S=vr();Tr.GoogleAuthExceptionMessages={API_KEY_WITH_CREDENTIALS:"API Keys and Credentials are mutually exclusive authentication methods and cannot be used together.",NO_PROJECT_ID_FOUND:`Unable to detect a Project Id in the current environment.
49
+ `+await t.crypto.sha256DigestHex(P),T=await F0(t.crypto,t.securityCredentials.secretAccessKey,c,t.region,n),E=await da(t.crypto,T,b),w=`${fP} Credential=${t.securityCredentials.accessKeyId}/${h}, SignedHeaders=${m}, Signature=${(0,mP.fromArrayBufferToHex)(E)}`;return{amzDate:e.has("date")?void 0:u,authorizationHeader:w,canonicalQuerystring:t.canonicalQuerystring}}o(B0,"generateAuthenticationHeaderMap")});var hP=L(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.DefaultAwsSecurityCredentialsSupplier=void 0;var Iu=Zt(),bp=class{static{o(this,"DefaultAwsSecurityCredentialsSupplier")}regionUrl;securityCredentialsUrl;imdsV2SessionTokenUrl;additionalGaxiosOptions;constructor(e){this.regionUrl=e.regionUrl,this.securityCredentialsUrl=e.securityCredentialsUrl,this.imdsV2SessionTokenUrl=e.imdsV2SessionTokenUrl,this.additionalGaxiosOptions=e.additionalGaxiosOptions}async getAwsRegion(e){if(this.#n)return this.#n;let r=new Headers;if(!this.#n&&this.imdsV2SessionTokenUrl&&r.set("x-aws-ec2-metadata-token",await this.#e(e.transporter)),!this.regionUrl)throw new RangeError('Unable to determine AWS region due to missing "options.credential_source.region_url"');let n={...this.additionalGaxiosOptions,url:this.regionUrl,method:"GET",headers:r};Iu.AuthClient.setMethodName(n,"getAwsRegion");let i=await e.transporter.request(n);return i.data.substr(0,i.data.length-1)}async getAwsSecurityCredentials(e){if(this.#o)return this.#o;let r=new Headers;this.imdsV2SessionTokenUrl&&r.set("x-aws-ec2-metadata-token",await this.#e(e.transporter));let n=await this.#t(r,e.transporter),i=await this.#r(n,r,e.transporter);return{accessKeyId:i.AccessKeyId,secretAccessKey:i.SecretAccessKey,token:i.Token}}async#e(e){let r={...this.additionalGaxiosOptions,url:this.imdsV2SessionTokenUrl,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"300"}};return Iu.AuthClient.setMethodName(r,"#getImdsV2SessionToken"),(await e.request(r)).data}async#t(e,r){if(!this.securityCredentialsUrl)throw new Error('Unable to determine AWS role name due to missing "options.credential_source.url"');let n={...this.additionalGaxiosOptions,url:this.securityCredentialsUrl,method:"GET",headers:e};return Iu.AuthClient.setMethodName(n,"#getAwsRoleName"),(await r.request(n)).data}async#r(e,r,n){let i={...this.additionalGaxiosOptions,url:`${this.securityCredentialsUrl}/${e}`,headers:r};return Iu.AuthClient.setMethodName(i,"#retrieveAwsSecurityCredentials"),(await n.request(i)).data}get#n(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||null}get#o(){return process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY?{accessKeyId:process.env.AWS_ACCESS_KEY_ID,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY,token:process.env.AWS_SESSION_TOKEN}:null}};Ru.DefaultAwsSecurityCredentialsSupplier=bp});var Ep=L(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.AwsClient=void 0;var q0=_p(),V0=$n(),H0=hP(),gP=vr(),G0=_t(),vp=class t extends V0.BaseExternalAccountClient{static{o(this,"AwsClient")}environmentId;awsSecurityCredentialsSupplier;regionalCredVerificationUrl;awsRequestSigner;region;static#e="https://sts.{region}.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15";static AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";static AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254";constructor(e){super(e);let r=(0,gP.originalOrCamelOptions)(e),n=r.get("credential_source"),i=r.get("aws_security_credentials_supplier");if(!n&&!i)throw new Error("A credential source or AWS security credentials supplier must be specified.");if(n&&i)throw new Error("Only one of credential source or AWS security credentials supplier can be specified.");if(i)this.awsSecurityCredentialsSupplier=i,this.regionalCredVerificationUrl=t.#e,this.credentialSourceType="programmatic";else{let u=(0,gP.originalOrCamelOptions)(n);this.environmentId=u.get("environment_id");let c=u.get("region_url"),l=u.get("url"),p=u.get("imdsv2_session_token_url");this.awsSecurityCredentialsSupplier=new H0.DefaultAwsSecurityCredentialsSupplier({regionUrl:c,securityCredentialsUrl:l,imdsV2SessionTokenUrl:p}),this.regionalCredVerificationUrl=u.get("regional_cred_verification_url"),this.credentialSourceType="aws",this.validateEnvironmentId()}this.awsRequestSigner=null,this.region=""}validateEnvironmentId(){let e=this.environmentId?.match(/^(aws)(\d+)$/);if(!e||!this.regionalCredVerificationUrl)throw new Error('No valid AWS "credential_source" provided');if(parseInt(e[2],10)!==1)throw new Error(`aws version "${e[2]}" is not supported in the current build.`)}async retrieveSubjectToken(){this.awsRequestSigner||(this.region=await this.awsSecurityCredentialsSupplier.getAwsRegion(this.supplierContext),this.awsRequestSigner=new q0.AwsRequestSigner(async()=>this.awsSecurityCredentialsSupplier.getAwsSecurityCredentials(this.supplierContext),this.region));let e=await this.awsRequestSigner.getRequestOptions({...t.RETRY_CONFIG,url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"}),r=[];return G0.Gaxios.mergeHeaders({"x-goog-cloud-target-resource":this.audience},e.headers).forEach((i,u)=>r.push({key:u,value:i})),encodeURIComponent(JSON.stringify({url:e.url,method:e.method,headers:r}))}};Cu.AwsClient=vp});var xp=L(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.InvalidSubjectTokenError=it.InvalidMessageFieldError=it.InvalidCodeFieldError=it.InvalidTokenTypeFieldError=it.InvalidExpirationTimeFieldError=it.InvalidSuccessFieldError=it.InvalidVersionFieldError=it.ExecutableResponseError=it.ExecutableResponse=void 0;var Ou="urn:ietf:params:oauth:token-type:saml2",Pp="urn:ietf:params:oauth:token-type:id_token",Sp="urn:ietf:params:oauth:token-type:jwt",Tp=class{static{o(this,"ExecutableResponse")}version;success;expirationTime;tokenType;errorCode;errorMessage;subjectToken;constructor(e){if(!e.version)throw new ku("Executable response must contain a 'version' field.");if(e.success===void 0)throw new $u("Executable response must contain a 'success' field.");if(this.version=e.version,this.success=e.success,this.success){if(this.expirationTime=e.expiration_time,this.tokenType=e.token_type,this.tokenType!==Ou&&this.tokenType!==Pp&&this.tokenType!==Sp)throw new zu(`Executable response must contain a 'token_type' field when successful and it must be one of ${Pp}, ${Sp}, or ${Ou}.`);if(this.tokenType===Ou){if(!e.saml_response)throw new pa(`Executable response must contain a 'saml_response' field when token_type=${Ou}.`);this.subjectToken=e.saml_response}else{if(!e.id_token)throw new pa(`Executable response must contain a 'id_token' field when token_type=${Pp} or ${Sp}.`);this.subjectToken=e.id_token}}else{if(!e.code)throw new Nu("Executable response must contain a 'code' field when unsuccessful.");if(!e.message)throw new Du("Executable response must contain a 'message' field when unsuccessful.");this.errorCode=e.code,this.errorMessage=e.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return this.expirationTime!==void 0&&this.expirationTime<Math.round(Date.now()/1e3)}};it.ExecutableResponse=Tp;var Mr=class extends Error{static{o(this,"ExecutableResponseError")}constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}};it.ExecutableResponseError=Mr;var ku=class extends Mr{static{o(this,"InvalidVersionFieldError")}};it.InvalidVersionFieldError=ku;var $u=class extends Mr{static{o(this,"InvalidSuccessFieldError")}};it.InvalidSuccessFieldError=$u;var wp=class extends Mr{static{o(this,"InvalidExpirationTimeFieldError")}};it.InvalidExpirationTimeFieldError=wp;var zu=class extends Mr{static{o(this,"InvalidTokenTypeFieldError")}};it.InvalidTokenTypeFieldError=zu;var Nu=class extends Mr{static{o(this,"InvalidCodeFieldError")}};it.InvalidCodeFieldError=Nu;var Du=class extends Mr{static{o(this,"InvalidMessageFieldError")}};it.InvalidMessageFieldError=Du;var pa=class extends Mr{static{o(this,"InvalidSubjectTokenError")}};it.InvalidSubjectTokenError=pa});var Rp=L(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.PluggableAuthHandler=Xo.ExecutableError=void 0;var to=xp(),W0=require("child_process"),Ap=require("fs"),Uu=class extends Error{static{o(this,"ExecutableError")}code;constructor(e,r){super(`The executable failed with exit code: ${r} and error message: ${e}.`),this.code=r,Object.setPrototypeOf(this,new.target.prototype)}};Xo.ExecutableError=Uu;var Ip=class t{static{o(this,"PluggableAuthHandler")}commandComponents;timeoutMillis;outputFile;constructor(e){if(!e.command)throw new Error("No command provided.");if(this.commandComponents=t.parseCommand(e.command),this.timeoutMillis=e.timeoutMillis,!this.timeoutMillis)throw new Error("No timeoutMillis provided.");this.outputFile=e.outputFile}retrieveResponseFromExecutable(e){return new Promise((r,n)=>{let i=W0.spawn(this.commandComponents[0],this.commandComponents.slice(1),{env:{...process.env,...Object.fromEntries(e)}}),u="";i.stdout.on("data",l=>{u+=l}),i.stderr.on("data",l=>{u+=l});let c=setTimeout(()=>(i.removeAllListeners(),i.kill(),n(new Error("The executable failed to finish within the timeout specified."))),this.timeoutMillis);i.on("close",l=>{if(clearTimeout(c),l===0)try{let p=JSON.parse(u),f=new to.ExecutableResponse(p);return r(f)}catch(p){return p instanceof to.ExecutableResponseError?n(p):n(new to.ExecutableResponseError(`The executable returned an invalid response: ${u}`))}else return n(new Uu(u,l.toString()))})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0)return;let e;try{e=await Ap.promises.realpath(this.outputFile)}catch{return}if(!(await Ap.promises.lstat(e)).isFile())return;let r=await Ap.promises.readFile(e,{encoding:"utf8"});if(r!=="")try{let n=JSON.parse(r);return new to.ExecutableResponse(n).isValid()?new to.ExecutableResponse(n):void 0}catch(n){throw n instanceof to.ExecutableResponseError?n:new to.ExecutableResponseError(`The output file contained an invalid response: ${r}`)}}static parseCommand(e){let r=e.match(/(?:[^\s"]+|"[^"]*")+/g);if(!r)throw new Error(`Provided command: "${e}" could not be parsed.`);for(let n=0;n<r.length;n++)r[n][0]==='"'&&r[n].slice(-1)==='"'&&(r[n]=r[n].slice(1,-1));return r}};Xo.PluggableAuthHandler=Ip});var Op=L(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.PluggableAuthClient=ei.ExecutableError=void 0;var Z0=$n(),J0=xp(),yP=Rp(),K0=Rp();Object.defineProperty(ei,"ExecutableError",{enumerable:!0,get:o(function(){return K0.ExecutableError},"get")});var Q0=30*1e3,_P=5*1e3,bP=120*1e3,Y0="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES",vP=1,Cp=class extends Z0.BaseExternalAccountClient{static{o(this,"PluggableAuthClient")}command;timeoutMillis;outputFile;handler;constructor(e){if(super(e),!e.credential_source.executable)throw new Error('No valid Pluggable Auth "credential_source" provided.');if(this.command=e.credential_source.executable.command,!this.command)throw new Error('No valid Pluggable Auth "credential_source" provided.');if(e.credential_source.executable.timeout_millis===void 0)this.timeoutMillis=Q0;else if(this.timeoutMillis=e.credential_source.executable.timeout_millis,this.timeoutMillis<_P||this.timeoutMillis>bP)throw new Error(`Timeout must be between ${_P} and ${bP} milliseconds.`);this.outputFile=e.credential_source.executable.output_file,this.handler=new yP.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile}),this.credentialSourceType="executable"}async retrieveSubjectToken(){if(process.env[Y0]!=="1")throw new Error("Pluggable Auth executables need to be explicitly allowed to run by setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment Variable to 1.");let e;if(this.outputFile&&(e=await this.handler.retrieveCachedResponse()),!e){let r=new Map;r.set("GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE",this.audience),r.set("GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE",this.subjectTokenType),r.set("GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE","0"),this.outputFile&&r.set("GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE",this.outputFile);let n=this.getServiceAccountEmail();n&&r.set("GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL",n),e=await this.handler.retrieveResponseFromExecutable(r)}if(e.version>vP)throw new Error(`Version of executable is not currently supported, maximum supported version is ${vP}.`);if(!e.success)throw new yP.ExecutableError(e.errorMessage,e.errorCode);if(this.outputFile&&!e.expirationTime)throw new J0.InvalidExpirationTimeFieldError("The executable response must contain the `expiration_time` field for successful responses when an output_file has been specified in the configuration.");if(e.isExpired())throw new Error("Executable response is expired.");return e.subjectToken}};ei.PluggableAuthClient=Cp});var $p=L(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.ExternalAccountClient=void 0;var X0=$n(),e$=gp(),t$=Ep(),r$=Op(),kp=class{static{o(this,"ExternalAccountClient")}constructor(){throw new Error("ExternalAccountClients should be initialized via: ExternalAccountClient.fromJSON(), directly via explicit constructors, eg. new AwsClient(options), new IdentityPoolClient(options), newPluggableAuthClientOptions, or via new GoogleAuth(options).getClient()")}static fromJSON(e){return e&&e.type===X0.EXTERNAL_ACCOUNT_TYPE?e.credential_source?.environment_id?new t$.AwsClient(e):e.credential_source?.executable?new r$.PluggableAuthClient(e):new e$.IdentityPoolClient(e):null}};ju.ExternalAccountClient=kp});var Dp=L(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.ExternalAccountAuthorizedUserClient=ti.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var PP=Zt(),EP=op(),SP=_t(),n$=require("stream"),o$=$n();ti.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var i$="https://sts.{universeDomain}/v1/oauthtoken",zp=class t extends EP.OAuthClientAuthHandler{static{o(this,"ExternalAccountAuthorizedUserHandler")}#e;constructor(e){super(e),this.#e=e.tokenRefreshEndpoint}async refreshToken(e,r){let n={...t.RETRY_CONFIG,url:this.#e,method:"POST",headers:r,data:new URLSearchParams({grant_type:"refresh_token",refresh_token:e})};PP.AuthClient.setMethodName(n,"refreshToken"),this.applyClientAuthenticationOptions(n);try{let i=await this.transporter.request(n),u=i.data;return u.res=i,u}catch(i){throw i instanceof SP.GaxiosError&&i.response?(0,EP.getErrorFromOAuthErrorResponse)(i.response.data,i):i}}},Np=class extends PP.AuthClient{static{o(this,"ExternalAccountAuthorizedUserClient")}cachedAccessToken;externalAccountAuthorizedUserHandler;refreshToken;constructor(e){super(e),e.universe_domain&&(this.universeDomain=e.universe_domain),this.refreshToken=e.refresh_token;let r={confidentialClientType:"basic",clientId:e.client_id,clientSecret:e.client_secret};this.externalAccountAuthorizedUserHandler=new zp({tokenRefreshEndpoint:e.token_url??i$.replace("{universeDomain}",this.universeDomain),transporter:this.transporter,clientAuthentication:r}),this.cachedAccessToken=null,this.quotaProjectId=e.quota_project_id,typeof e?.eagerRefreshThresholdMillis!="number"?this.eagerRefreshThresholdMillis=o$.EXPIRATION_TIME_OFFSET:this.eagerRefreshThresholdMillis=e.eagerRefreshThresholdMillis,this.forceRefreshOnFailure=!!e?.forceRefreshOnFailure}async getAccessToken(){return(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let e=await this.getAccessToken(),r=new Headers({authorization:`Bearer ${e.token}`});return this.addSharedMetadataHeaders(r)}request(e,r){if(r)this.requestAsync(e).then(n=>r(null,n),n=>r(n,n.response));else return this.requestAsync(e)}async requestAsync(e,r=!1){let n;try{let i=await this.getRequestHeaders();e.headers=SP.Gaxios.mergeHeaders(e.headers),this.addUserProjectAndAuthHeaders(e.headers,i),n=await this.transporter.request(e)}catch(i){let u=i.response;if(u){let c=u.status,l=u.config.data instanceof n$.Readable;if(!r&&(c===401||c===403)&&!l&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(e,!0)}throw i}return n}async refreshAccessTokenAsync(){let e=await this.externalAccountAuthorizedUserHandler.refreshToken(this.refreshToken);return this.cachedAccessToken={access_token:e.access_token,expiry_date:new Date().getTime()+e.expires_in*1e3,res:e.res},e.refresh_token!==void 0&&(this.refreshToken=e.refresh_token),this.cachedAccessToken}isExpired(e){let r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:!1}};ti.ExternalAccountAuthorizedUserClient=Np});var AP=L(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.GoogleAuth=Tr.GoogleAuthExceptionMessages=void 0;var a$=require("child_process"),fa=require("fs"),s$=_t(),ma=Xi(),u$=require("os"),Up=require("path"),c$=ea(),l$=Cd(),d$=kd(),p$=$d(),ri=Yd(),TP=ep(),ni=rp(),f$=$p(),ha=$n(),jp=Zt(),wP=Dp(),xP=vr();Tr.GoogleAuthExceptionMessages={API_KEY_WITH_CREDENTIALS:"API Keys and Credentials are mutually exclusive authentication methods and cannot be used together.",NO_PROJECT_ID_FOUND:`Unable to detect a Project Id in the current environment.
50
50
  To learn more about authentication and Google APIs, visit:
51
51
  https://cloud.google.com/docs/authentication/getting-started`,NO_CREDENTIALS_FOUND:`Unable to find credentials in current environment.
52
52
  To learn more about authentication and Google APIs, visit:
53
53
  https://cloud.google.com/docs/authentication/getting-started`,NO_ADC_FOUND:"Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.",NO_UNIVERSE_DOMAIN_FOUND:`Unable to detect a Universe Domain in the current environment.
54
54
  To learn more about Universe Domain retrieval, visit:
55
- https://cloud.google.com/compute/docs/metadata/predefined-metadata-keys`};var Dp=class{static{o(this,"GoogleAuth")}checkIsGCE=void 0;useJWTAccessWithScope;defaultServicePath;get isGCE(){return this.checkIsGCE}_findProjectIdPromise;_cachedProjectId;jsonContent=null;apiKey;cachedCredential=null;#e=null;defaultScopes;keyFilename;scopes;clientOptions={};constructor(e={}){if(this._cachedProjectId=e.projectId||null,this.cachedCredential=e.authClient||null,this.keyFilename=e.keyFilename||e.keyFile,this.scopes=e.scopes,this.clientOptions=e.clientOptions||{},this.jsonContent=e.credentials||null,this.apiKey=e.apiKey||this.clientOptions.apiKey||null,this.apiKey&&(this.jsonContent||this.clientOptions.credentials))throw new RangeError(Tr.GoogleAuthExceptionMessages.API_KEY_WITH_CREDENTIALS);e.universeDomain&&(this.clientOptions.universeDomain=e.universeDomain)}setGapicJWTValues(e){e.defaultServicePath=this.defaultServicePath,e.useJWTAccessWithScope=this.useJWTAccessWithScope,e.defaultScopes=this.defaultScopes}getProjectId(e){if(e)this.getProjectIdAsync().then(r=>e(null,r),e);else return this.getProjectIdAsync()}async getProjectIdOptional(){try{return await this.getProjectId()}catch(e){if(e instanceof Error&&e.message===Tr.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)return null;throw e}}async findAndCacheProjectId(){let e=null;if(e||=await this.getProductionProjectId(),e||=await this.getFileProjectId(),e||=await this.getDefaultServiceProjectId(),e||=await this.getGCEProjectId(),e||=await this.getExternalAccountClientProjectId(),e)return this._cachedProjectId=e,e;throw new Error(Tr.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)}async getProjectIdAsync(){return this._cachedProjectId?this._cachedProjectId:(this._findProjectIdPromise||(this._findProjectIdPromise=this.findAndCacheProjectId()),this._findProjectIdPromise)}async getUniverseDomainFromMetadataServer(){let e;try{e=await fa.universe("universe-domain"),e||=zp.DEFAULT_UNIVERSE}catch(r){if(r&&r?.response?.status===404)e=zp.DEFAULT_UNIVERSE;else throw r}return e}async getUniverseDomain(){let e=(0,_S.originalOrCamelOptions)(this.clientOptions).get("universe_domain");try{e??=(await this.getClient()).universeDomain}catch{e??=zp.DEFAULT_UNIVERSE}return e}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(e={},r){let n;if(typeof e=="function"?r=e:n=e,r)this.getApplicationDefaultAsync(n).then(i=>r(null,i.credential,i.projectId),r);else return this.getApplicationDefaultAsync(n)}async getApplicationDefaultAsync(e={}){if(this.cachedCredential)return await this.#t(this.cachedCredential,null);let r;if(r=await this._tryGetApplicationCredentialsFromEnvironmentVariable(e),r)return r instanceof ti.JWT?r.scopes=this.scopes:r instanceof ma.BaseExternalAccountClient&&(r.scopes=this.getAnyScopes()),await this.#t(r);if(r=await this._tryGetApplicationCredentialsFromWellKnownFile(e),r)return r instanceof ti.JWT?r.scopes=this.scopes:r instanceof ma.BaseExternalAccountClient&&(r.scopes=this.getAnyScopes()),await this.#t(r);if(await this._checkIsGCE())return e.scopes=this.getAnyScopes(),await this.#t(new e$.Compute(e));throw new Error(Tr.GoogleAuthExceptionMessages.NO_ADC_FOUND)}async#t(e,r=process.env.GOOGLE_CLOUD_QUOTA_PROJECT||null){let n=await this.getProjectIdOptional();return r&&(e.quotaProjectId=r),this.cachedCredential=e,{credential:e,projectId:n}}async _checkIsGCE(){return this.checkIsGCE===void 0&&(this.checkIsGCE=fa.getGCPResidency()||await fa.isAvailable()),this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(e){let r=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials;if(!r||r.length===0)return null;try{return this._getApplicationCredentialsFromFilePath(r,e)}catch(n){throw n instanceof Error&&(n.message=`Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${n.message}`),n}}async _tryGetApplicationCredentialsFromWellKnownFile(e){let r=null;if(this._isWindows())r=process.env.APPDATA;else{let i=process.env.HOME;i&&(r=Np.join(i,".config"))}return r&&(r=Np.join(r,"gcloud","application_default_credentials.json"),pa.existsSync(r)||(r=null)),r?await this._getApplicationCredentialsFromFilePath(r,e):null}async _getApplicationCredentialsFromFilePath(e,r={}){if(!e||e.length===0)throw new Error("The file path is invalid.");try{if(e=pa.realpathSync(e),!pa.lstatSync(e).isFile())throw new Error}catch(i){throw i instanceof Error&&(i.message=`The file at ${e} does not exist, or it is not a file. ${i.message}`),i}let n=pa.createReadStream(e);return this.fromStream(n,r)}fromImpersonatedJSON(e){if(!e)throw new Error("Must pass in a JSON object containing an impersonated refresh token");if(e.type!==ri.IMPERSONATED_ACCOUNT_TYPE)throw new Error(`The incoming JSON object does not have the "${ri.IMPERSONATED_ACCOUNT_TYPE}" type`);if(!e.source_credentials)throw new Error("The incoming JSON object does not contain a source_credentials field");if(!e.service_account_impersonation_url)throw new Error("The incoming JSON object does not contain a service_account_impersonation_url field");let r=this.fromJSON(e.source_credentials);if(e.service_account_impersonation_url?.length>256)throw new RangeError(`Target principal is too long: ${e.service_account_impersonation_url}`);let n=/(?<target>[^/]+):(generateAccessToken|generateIdToken)$/.exec(e.service_account_impersonation_url)?.groups?.target;if(!n)throw new RangeError(`Cannot extract target principal from ${e.service_account_impersonation_url}`);let i=(this.scopes||e.scopes||this.defaultScopes)??[];return new ri.Impersonated({...e,sourceClient:r,targetPrincipal:n,targetScopes:Array.isArray(i)?i:[i]})}fromJSON(e,r={}){let n,i=(0,_S.originalOrCamelOptions)(r).get("universe_domain");return e.type===gS.USER_REFRESH_ACCOUNT_TYPE?(n=new gS.UserRefreshClient(r),n.fromJSON(e)):e.type===ri.IMPERSONATED_ACCOUNT_TYPE?n=this.fromImpersonatedJSON(e):e.type===ma.EXTERNAL_ACCOUNT_TYPE?(n=n$.ExternalAccountClient.fromJSON({...e,...r}),n.scopes=this.getAnyScopes()):e.type===yS.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE?n=new yS.ExternalAccountAuthorizedUserClient({...e,...r}):(r.scopes=this.scopes,n=new ti.JWT(r),this.setGapicJWTValues(n),n.fromJSON(e)),i&&(n.universeDomain=i),n}_cacheClientFromJSON(e,r){let n=this.fromJSON(e,r);return this.jsonContent=e,this.cachedCredential=n,n}fromStream(e,r={},n){let i={};if(typeof r=="function"?n=r:i=r,n)this.fromStreamAsync(e,i).then(u=>n(null,u),n);else return this.fromStreamAsync(e,i)}fromStreamAsync(e,r){return new Promise((n,i)=>{if(!e)throw new Error("Must pass in a stream containing the Google auth settings.");let u=[];e.setEncoding("utf8").on("error",i).on("data",c=>u.push(c)).on("end",()=>{try{try{let c=JSON.parse(u.join("")),l=this._cacheClientFromJSON(c,r);return n(l)}catch(c){if(!this.keyFilename)throw c;let l=new ti.JWT({...this.clientOptions,keyFile:this.keyFilename});return this.cachedCredential=l,this.setGapicJWTValues(l),n(l)}}catch(c){return i(c)}})})}fromAPIKey(e,r={}){return new ti.JWT({...r,apiKey:e})}_isWindows(){let e=Y0.platform();return!!(e&&e.length>=3&&e.substring(0,3).toLowerCase()==="win")}async getDefaultServiceProjectId(){return new Promise(e=>{(0,K0.exec)("gcloud config config-helper --format json",(r,n)=>{if(!r&&n)try{let i=JSON.parse(n).configuration.properties.core.project;e(i);return}catch{}e(null)})})}getProductionProjectId(){return process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project}async getFileProjectId(){if(this.cachedCredential)return this.cachedCredential.projectId;if(this.keyFilename){let r=await this.getClient();if(r&&r.projectId)return r.projectId}let e=await this._tryGetApplicationCredentialsFromEnvironmentVariable();return e?e.projectId:null}async getExternalAccountClientProjectId(){return!this.jsonContent||this.jsonContent.type!==ma.EXTERNAL_ACCOUNT_TYPE?null:await(await this.getClient()).getProjectId()}async getGCEProjectId(){try{return await fa.project("project-id")}catch{return null}}getCredentials(e){if(e)this.getCredentialsAsync().then(r=>e(null,r),e);else return this.getCredentialsAsync()}async getCredentialsAsync(){let e=await this.getClient();if(e instanceof ri.Impersonated)return{client_email:e.getTargetPrincipal()};if(e instanceof ma.BaseExternalAccountClient){let r=e.getServiceAccountEmail();if(r)return{client_email:r,universe_domain:e.universeDomain}}if(this.jsonContent)return{client_email:this.jsonContent.client_email,private_key:this.jsonContent.private_key,universe_domain:this.jsonContent.universe_domain};if(await this._checkIsGCE()){let[r,n]=await Promise.all([fa.instance("service-accounts/default/email"),this.getUniverseDomain()]);return{client_email:r,universe_domain:n}}throw new Error(Tr.GoogleAuthExceptionMessages.NO_CREDENTIALS_FOUND)}async getClient(){if(this.cachedCredential)return this.cachedCredential;this.#e=this.#e||this.#r();try{return await this.#e}finally{this.#e=null}}async#r(){if(this.jsonContent)return this._cacheClientFromJSON(this.jsonContent,this.clientOptions);if(this.keyFilename){let e=Np.resolve(this.keyFilename),r=pa.createReadStream(e);return await this.fromStreamAsync(r,this.clientOptions)}else if(this.apiKey){let e=await this.fromAPIKey(this.apiKey,this.clientOptions);e.scopes=this.scopes;let{credential:r}=await this.#t(e);return r}else{let{credential:e}=await this.getApplicationDefaultAsync(this.clientOptions);return e}}async getIdTokenClient(e){let r=await this.getClient();if(!("fetchIdToken"in r))throw new Error("Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.");return new t$.IdTokenClient({targetAudience:e,idTokenProvider:r})}async getAccessToken(){return(await(await this.getClient()).getAccessToken()).token}async getRequestHeaders(e){return(await this.getClient()).getRequestHeaders(e)}async authorizeRequest(e={}){let r=e.url,i=await(await this.getClient()).getRequestHeaders(r);return e.headers=Q0.Gaxios.mergeHeaders(e.headers,i),e}async fetch(...e){return(await this.getClient()).fetch(...e)}async request(e){return(await this.getClient()).request(e)}getEnv(){return(0,r$.getEnv)()}async sign(e,r){let n=await this.getClient(),i=await this.getUniverseDomain();if(r=r||`https://iamcredentials.${i}/v1/projects/-/serviceAccounts/`,n instanceof ri.Impersonated)return(await n.sign(e)).signedBlob;let u=(0,X0.createCrypto)();if(n instanceof ti.JWT&&n.key)return await u.sign(n.key,e);let c=await this.getCredentials();if(!c.client_email)throw new Error("Cannot sign data without `client_email`.");return this.signBlob(u,c.client_email,e,r)}async signBlob(e,r,n,i){let u=new URL(i+`${r}:signBlob`);return(await this.request({method:"POST",url:u.href,data:{payload:e.encodeBase64StringUtf8(n)},retry:!0,retryConfig:{httpMethodsToRetry:["POST"]}})).data.signedBlob}};Tr.GoogleAuth=Dp});var vS=M(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.IAMAuth=void 0;var Up=class{static{o(this,"IAMAuth")}selector;token;constructor(e,r){this.selector=e,this.token=r,this.selector=e,this.token=r}getRequestHeaders(){return{"x-goog-iam-authority-selector":this.selector,"x-goog-iam-authorization-token":this.token}}};ju.IAMAuth=Up});var ES=M(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.DownscopedClient=Lr.EXPIRATION_TIME_OFFSET=Lr.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var o$=yt(),i$=require("stream"),jp=Zt(),a$=_u(),s$="urn:ietf:params:oauth:grant-type:token-exchange",u$="urn:ietf:params:oauth:token-type:access_token",c$="urn:ietf:params:oauth:token-type:access_token";Lr.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;Lr.EXPIRATION_TIME_OFFSET=300*1e3;var Mp=class extends jp.AuthClient{static{o(this,"DownscopedClient")}authClient;credentialAccessBoundary;cachedDownscopedAccessToken;stsCredential;constructor(e,r={accessBoundary:{accessBoundaryRules:[]}}){if(super(e instanceof jp.AuthClient?{}:e),e instanceof jp.AuthClient?(this.authClient=e,this.credentialAccessBoundary=r):(this.authClient=e.authClient,this.credentialAccessBoundary=e.credentialAccessBoundary),this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length===0)throw new Error("At least one access boundary rule needs to be defined.");if(this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length>Lr.MAX_ACCESS_BOUNDARY_RULES_COUNT)throw new Error(`The provided access boundary has more than ${Lr.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`);for(let n of this.credentialAccessBoundary.accessBoundary.accessBoundaryRules)if(n.availablePermissions.length===0)throw new Error("At least one permission should be defined in access boundary rules.");this.stsCredential=new a$.StsCredentials({tokenExchangeEndpoint:`https://sts.${this.universeDomain}/v1/token`}),this.cachedDownscopedAccessToken=null}setCredentials(e){if(!e.expiry_date)throw new Error("The access token expiry_date field is missing in the provided credentials.");super.setCredentials(e),this.cachedDownscopedAccessToken=e}async getAccessToken(){return(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){let e=await this.getAccessToken(),r=new Headers({authorization:`Bearer ${e.token}`});return this.addSharedMetadataHeaders(r)}request(e,r){if(r)this.requestAsync(e).then(n=>r(null,n),n=>r(n,n.response));else return this.requestAsync(e)}async requestAsync(e,r=!1){let n;try{let i=await this.getRequestHeaders();e.headers=o$.Gaxios.mergeHeaders(e.headers),this.addUserProjectAndAuthHeaders(e.headers,i),n=await this.transporter.request(e)}catch(i){let u=i.response;if(u){let c=u.status,l=u.config.data instanceof i$.Readable;if(!r&&(c===401||c===403)&&!l&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(e,!0)}throw i}return n}async refreshAccessTokenAsync(){let e=(await this.authClient.getAccessToken()).token,r={grantType:s$,requestedTokenType:u$,subjectToken:e,subjectTokenType:c$},n=await this.stsCredential.exchangeToken(r,void 0,this.credentialAccessBoundary),i=this.authClient.credentials?.expiry_date||null,u=n.expires_in?new Date().getTime()+n.expires_in*1e3:i;return this.cachedDownscopedAccessToken={access_token:n.access_token,expiry_date:u,res:n.res},this.credentials={},Object.assign(this.credentials,this.cachedDownscopedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedDownscopedAccessToken}isExpired(e){let r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:!1}};Lr.DownscopedClient=Mp});var SS=M(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.PassThroughClient=void 0;var l$=Zt(),Lp=class extends l$.AuthClient{static{o(this,"PassThroughClient")}async request(e){return this.transporter.request(e)}async getAccessToken(){return{}}async getRequestHeaders(){return new Headers}};Mu.PassThroughClient=Lp});var AS=M(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.GoogleAuth=ee.auth=ee.PassThroughClient=ee.ExternalAccountAuthorizedUserClient=ee.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=ee.ExecutableError=ee.PluggableAuthClient=ee.DownscopedClient=ee.BaseExternalAccountClient=ee.ExternalAccountClient=ee.IdentityPoolClient=ee.AwsRequestSigner=ee.AwsClient=ee.UserRefreshClient=ee.LoginTicket=ee.ClientAuthentication=ee.OAuth2Client=ee.CodeChallengeMethod=ee.Impersonated=ee.JWT=ee.JWTAccess=ee.IdTokenClient=ee.IAMAuth=ee.GCPEnv=ee.Compute=ee.DEFAULT_UNIVERSE=ee.AuthClient=ee.gaxios=ee.gcpMetadata=void 0;var PS=bS();Object.defineProperty(ee,"GoogleAuth",{enumerable:!0,get:o(function(){return PS.GoogleAuth},"get")});ee.gcpMetadata=Yi();ee.gaxios=yt();var TS=Zt();Object.defineProperty(ee,"AuthClient",{enumerable:!0,get:o(function(){return TS.AuthClient},"get")});Object.defineProperty(ee,"DEFAULT_UNIVERSE",{enumerable:!0,get:o(function(){return TS.DEFAULT_UNIVERSE},"get")});var d$=Ad();Object.defineProperty(ee,"Compute",{enumerable:!0,get:o(function(){return d$.Compute},"get")});var p$=Cd();Object.defineProperty(ee,"GCPEnv",{enumerable:!0,get:o(function(){return p$.GCPEnv},"get")});var f$=vS();Object.defineProperty(ee,"IAMAuth",{enumerable:!0,get:o(function(){return f$.IAMAuth},"get")});var m$=Rd();Object.defineProperty(ee,"IdTokenClient",{enumerable:!0,get:o(function(){return m$.IdTokenClient},"get")});var h$=Wd();Object.defineProperty(ee,"JWTAccess",{enumerable:!0,get:o(function(){return h$.JWTAccess},"get")});var g$=Jd();Object.defineProperty(ee,"JWT",{enumerable:!0,get:o(function(){return g$.JWT},"get")});var y$=Xd();Object.defineProperty(ee,"Impersonated",{enumerable:!0,get:o(function(){return y$.Impersonated},"get")});var Fp=eo();Object.defineProperty(ee,"CodeChallengeMethod",{enumerable:!0,get:o(function(){return Fp.CodeChallengeMethod},"get")});Object.defineProperty(ee,"OAuth2Client",{enumerable:!0,get:o(function(){return Fp.OAuth2Client},"get")});Object.defineProperty(ee,"ClientAuthentication",{enumerable:!0,get:o(function(){return Fp.ClientAuthentication},"get")});var _$=Pd();Object.defineProperty(ee,"LoginTicket",{enumerable:!0,get:o(function(){return _$.LoginTicket},"get")});var b$=Qd();Object.defineProperty(ee,"UserRefreshClient",{enumerable:!0,get:o(function(){return b$.UserRefreshClient},"get")});var v$=_p();Object.defineProperty(ee,"AwsClient",{enumerable:!0,get:o(function(){return v$.AwsClient},"get")});var E$=hp();Object.defineProperty(ee,"AwsRequestSigner",{enumerable:!0,get:o(function(){return E$.AwsRequestSigner},"get")});var S$=fp();Object.defineProperty(ee,"IdentityPoolClient",{enumerable:!0,get:o(function(){return S$.IdentityPoolClient},"get")});var P$=Cp();Object.defineProperty(ee,"ExternalAccountClient",{enumerable:!0,get:o(function(){return P$.ExternalAccountClient},"get")});var T$=kn();Object.defineProperty(ee,"BaseExternalAccountClient",{enumerable:!0,get:o(function(){return T$.BaseExternalAccountClient},"get")});var w$=ES();Object.defineProperty(ee,"DownscopedClient",{enumerable:!0,get:o(function(){return w$.DownscopedClient},"get")});var wS=Ip();Object.defineProperty(ee,"PluggableAuthClient",{enumerable:!0,get:o(function(){return wS.PluggableAuthClient},"get")});Object.defineProperty(ee,"ExecutableError",{enumerable:!0,get:o(function(){return wS.ExecutableError},"get")});var xS=$p();Object.defineProperty(ee,"EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE",{enumerable:!0,get:o(function(){return xS.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE},"get")});Object.defineProperty(ee,"ExternalAccountAuthorizedUserClient",{enumerable:!0,get:o(function(){return xS.ExternalAccountAuthorizedUserClient},"get")});var x$=SS();Object.defineProperty(ee,"PassThroughClient",{enumerable:!0,get:o(function(){return x$.PassThroughClient},"get")});var A$=new PS.GoogleAuth;ee.auth=A$});var z$={};Ba(z$,{bigQueryAuth:()=>Oe,googleBigQuery:()=>N$});module.exports=RT(z$);var CT=Object.freeze({status:"aborted"});function X(t,e,r){function n(l,p){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:p,constr:c,traits:new Set},enumerable:!1}),l._zod.traits.has(t))return;l._zod.traits.add(t),e(l,p);let f=c.prototype,m=Object.keys(f);for(let g=0;g<m.length;g++){let S=m[g];S in l||(l[S]=f[S].bind(l))}}o(n,"init");let i=r?.Parent??Object;class u extends i{static{o(this,"Definition")}}Object.defineProperty(u,"name",{value:t});function c(l){var p;let f=r?.Parent?new u:this;n(f,l),(p=f._zod).deferred??(p.deferred=[]);for(let m of f._zod.deferred)m();return f}return o(c,"_"),Object.defineProperty(c,"init",{value:n}),Object.defineProperty(c,Symbol.hasInstance,{value:o(l=>r?.Parent&&l instanceof r.Parent?!0:l?._zod?.traits?.has(t),"value")}),Object.defineProperty(c,"name",{value:t}),c}o(X,"$constructor");var Ar=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},qa=class extends Error{static{o(this,"$ZodEncodeError")}constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},_c={};function Zr(t){return t&&Object.assign(_c,t),_c}o(Zr,"config");function vc(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}o(vc,"getEnumValues");function Kf(t,e){return typeof e=="bigint"?e.toString():e}o(Kf,"jsonStringifyReplacer");function Ha(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}o(Ha,"cached");function Qf(t){return t==null}o(Qf,"nullish");function Ga(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}o(Ga,"cleanRegex");var Jf=Symbol("evaluating");function et(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Jf)return n===void 0&&(n=Jf,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}o(et,"defineLazy");var Ec="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function hi(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}o(hi,"isObject");var OT=Ha(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Yf(t){if(hi(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(hi(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}o(Yf,"isPlainObject");var Xf=new Set(["string","number","symbol"]);function _o(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(_o,"escapeRegex");function Wa(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}o(Wa,"clone");function Ze(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:o(()=>e,"error")};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:o(()=>e.error,"error")}:e}o(Ze,"normalizeParams");function em(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}o(em,"optionalKeys");var tm={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function bo(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}o(bo,"aborted");function hn(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}o(hn,"prefixIssues");function Va(t){return typeof t=="string"?t:t?.message}o(Va,"unwrapMessage");function gn(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=Va(t.inst?._zod.def?.error?.(t))??Va(e?.error?.(t))??Va(r.customError?.(t))??Va(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}o(gn,"finalizeIssue");function rm(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}o(rm,"getLengthableOrigin");function Sc(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}o(Sc,"issue");var nm=o((t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Kf,2),Object.defineProperty(t,"toString",{value:o(()=>t.message,"value"),enumerable:!1})},"initializer"),om=X("$ZodError",nm),gi=X("$ZodError",nm,{Parent:Error});var $T=o(t=>(e,r,n,i)=>{let u=n?Object.assign(n,{async:!1}):{async:!1},c=e._zod.run({value:r,issues:[]},u);if(c instanceof Promise)throw new Ar;if(c.issues.length){let l=new(i?.Err??t)(c.issues.map(p=>gn(p,u,Zr())));throw Ec(l,i?.callee),l}return c.value},"_parse"),Za=$T(gi),NT=o(t=>async(e,r,n,i)=>{let u=n?Object.assign(n,{async:!0}):{async:!0},c=e._zod.run({value:r,issues:[]},u);if(c instanceof Promise&&(c=await c),c.issues.length){let l=new(i?.Err??t)(c.issues.map(p=>gn(p,u,Zr())));throw Ec(l,i?.callee),l}return c.value},"_parseAsync"),Ja=NT(gi),zT=o(t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},u=e._zod.run({value:r,issues:[]},i);if(u instanceof Promise)throw new Ar;return u.issues.length?{success:!1,error:new(t??om)(u.issues.map(c=>gn(c,i,Zr())))}:{success:!0,data:u.value}},"_safeParse"),yi=zT(gi),DT=o(t=>async(e,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},u=e._zod.run({value:r,issues:[]},i);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new t(u.issues.map(c=>gn(c,i,Zr())))}:{success:!0,data:u.value}},"_safeParseAsync"),_i=DT(gi);var UT="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",jT=new RegExp(`^${UT}$`);var im=o(t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},"string"),am=/^-?\d+n?$/,sm=/^-?\d+$/,Pc=/^-?\d+(?:\.\d+)?$/,um=/^(?:true|false)$/i;var yn=X("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),MT={number:"number",bigint:"bigint",object:"date"};var cm=X("$ZodCheckGreaterThan",(t,e)=>{yn.init(t,e);let r=MT[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,u=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>u&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}});var lm=X("$ZodCheckNumberFormat",(t,e)=>{yn.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,u]=tm[e.format];t._zod.onattach.push(c=>{let l=c._zod.bag;l.format=e.format,l.minimum=i,l.maximum=u,r&&(l.pattern=sm)}),t._zod.check=c=>{let l=c.value;if(r){if(!Number.isInteger(l)){c.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:l,inst:t});return}if(!Number.isSafeInteger(l)){l>0?c.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):c.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}l<i&&c.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),l>u&&c.issues.push({origin:"number",input:l,code:"too_big",maximum:u,inclusive:!0,inst:t,continue:!e.abort})}});var dm=X("$ZodCheckMinLength",(t,e)=>{var r;yn.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Qf(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let c=rm(i);n.issues.push({origin:c,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}});var Tc=X("$ZodCheckStringFormat",(t,e)=>{var r,n;yn.init(t,e),t._zod.onattach.push(i=>{let u=i._zod.bag;u.format=e.format,e.pattern&&(u.patterns??(u.patterns=new Set),u.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),pm=X("$ZodCheckRegex",(t,e)=>{Tc.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}});var mm={major:4,minor:3,patch:6};var Qe=X("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=mm;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let i of n)for(let u of i._zod.onattach)u(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let i=o((c,l,p)=>{let f=bo(c),m;for(let g of l){if(g._zod.def.when){if(!g._zod.def.when(c))continue}else if(f)continue;let S=c.issues.length,h=g._zod.check(c);if(h instanceof Promise&&p?.async===!1)throw new Ar;if(m||h instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await h,c.issues.length!==S&&(f||(f=bo(c,S)))});else{if(c.issues.length===S)continue;f||(f=bo(c,S))}}return m?m.then(()=>c):c},"runChecks"),u=o((c,l,p)=>{if(bo(c))return c.aborted=!0,c;let f=i(l,n,p);if(f instanceof Promise){if(p.async===!1)throw new Ar;return f.then(m=>t._zod.parse(m,p))}return t._zod.parse(f,p)},"handleCanaryResult");t._zod.run=(c,l)=>{if(l.skipChecks)return t._zod.parse(c,l);if(l.direction==="backward"){let f=t._zod.parse({value:c.value,issues:[]},{...l,skipChecks:!0});return f instanceof Promise?f.then(m=>u(m,c,l)):u(f,c,l)}let p=t._zod.parse(c,l);if(p instanceof Promise){if(l.async===!1)throw new Ar;return p.then(f=>i(f,n,l))}return i(p,n,l)}}et(t,"~standard",()=>({validate:o(i=>{try{let u=yi(t,i);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return _i(t,i).then(c=>c.success?{value:c.data}:{issues:c.error?.issues})}},"validate"),vendor:"zod",version:1}))}),Ya=X("$ZodString",(t,e)=>{Qe.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??im(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),wc=X("$ZodStringFormat",(t,e)=>{Tc.init(t,e),Ya.init(t,e)});var bm=X("$ZodURL",(t,e)=>{wc.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}});var xc=X("$ZodNumber",(t,e)=>{Qe.init(t,e),t._zod.pattern=t._zod.bag.pattern??Pc,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let u=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...u?{received:u}:{}}),r}}),vm=X("$ZodNumberFormat",(t,e)=>{lm.init(t,e),xc.init(t,e)}),Ac=X("$ZodBoolean",(t,e)=>{Qe.init(t,e),t._zod.pattern=um,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}}),Em=X("$ZodBigInt",(t,e)=>{Qe.init(t,e),t._zod.pattern=am,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}});var Sm=X("$ZodAny",(t,e)=>{Qe.init(t,e),t._zod.parse=r=>r}),Pm=X("$ZodUnknown",(t,e)=>{Qe.init(t,e),t._zod.parse=r=>r});var Tm=X("$ZodVoid",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:t}),r}}),wm=X("$ZodDate",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,u=i instanceof Date;return u&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...u?{received:"Invalid Date"}:{},inst:t}),r}});function hm(t,e,r){t.issues.length&&e.issues.push(...hn(r,t.issues)),e.value[r]=t.value}o(hm,"handleArrayResult");var xm=X("$ZodArray",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),r;r.value=Array(i.length);let u=[];for(let c=0;c<i.length;c++){let l=i[c],p=e.element._zod.run({value:l,issues:[]},n);p instanceof Promise?u.push(p.then(f=>hm(f,r,c))):hm(p,r,c)}return u.length?Promise.all(u).then(()=>r):r}});function Qa(t,e,r,n,i){if(t.issues.length){if(i&&!(r in n))return;e.issues.push(...hn(r,t.issues))}t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}o(Qa,"handlePropertyResult");function LT(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=em(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}o(LT,"normalizeDef");function FT(t,e,r,n,i,u){let c=[],l=i.keySet,p=i.catchall._zod,f=p.def.type,m=p.optout==="optional";for(let g in e){if(l.has(g))continue;if(f==="never"){c.push(g);continue}let S=p.run({value:e[g],issues:[]},n);S instanceof Promise?t.push(S.then(h=>Qa(h,r,g,e,m))):Qa(S,r,g,e,m)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:e,inst:u}),t.length?Promise.all(t).then(()=>r):r}o(FT,"handleCatchall");var Am=X("$ZodObject",(t,e)=>{if(Qe.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let l=e.shape;Object.defineProperty(e,"shape",{get:o(()=>{let p={...l};return Object.defineProperty(e,"shape",{value:p}),p},"get")})}let n=Ha(()=>LT(e));et(t._zod,"propValues",()=>{let l=e.shape,p={};for(let f in l){let m=l[f]._zod;if(m.values){p[f]??(p[f]=new Set);for(let g of m.values)p[f].add(g)}}return p});let i=hi,u=e.catchall,c;t._zod.parse=(l,p)=>{c??(c=n.value);let f=l.value;if(!i(f))return l.issues.push({expected:"object",code:"invalid_type",input:f,inst:t}),l;l.value={};let m=[],g=c.shape;for(let S of c.keys){let h=g[S],_=h._zod.optout==="optional",T=h._zod.run({value:f[S],issues:[]},p);T instanceof Promise?m.push(T.then(E=>Qa(E,l,S,f,_))):Qa(T,l,S,f,_)}return u?FT(m,f,l,p,n.value,t):m.length?Promise.all(m).then(()=>l):l}});function gm(t,e,r,n){for(let u of t)if(u.issues.length===0)return e.value=u.value,e;let i=t.filter(u=>!bo(u));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(u=>u.issues.map(c=>gn(c,n,Zr())))}),e)}o(gm,"handleUnionResults");var Ic=X("$ZodUnion",(t,e)=>{Qe.init(t,e),et(t._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),et(t._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),et(t._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),et(t._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){let i=e.options.map(u=>u._zod.pattern);return new RegExp(`^(${i.map(u=>Ga(u.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(i,u)=>{if(r)return n(i,u);let c=!1,l=[];for(let p of e.options){let f=p._zod.run({value:i.value,issues:[]},u);if(f instanceof Promise)l.push(f),c=!0;else{if(f.issues.length===0)return f;l.push(f)}}return c?Promise.all(l).then(p=>gm(p,i,t,u)):gm(l,i,t,u)}});var Im=X("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Ic.init(t,e);let r=t._zod.parse;et(t._zod,"propValues",()=>{let i={};for(let u of e.options){let c=u._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(u)}"`);for(let[l,p]of Object.entries(c)){i[l]||(i[l]=new Set);for(let f of p)i[l].add(f)}}return i});let n=Ha(()=>{let i=e.options,u=new Map;for(let c of i){let l=c._zod.propValues?.[e.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(c)}"`);for(let p of l){if(u.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);u.set(p,c)}}return u});t._zod.parse=(i,u)=>{let c=i.value;if(!hi(c))return i.issues.push({code:"invalid_type",expected:"object",input:c,inst:t}),i;let l=n.value.get(c?.[e.discriminator]);return l?l._zod.run(i,u):e.unionFallback?r(i,u):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:c,path:[e.discriminator],inst:t}),i)}});var Rm=X("$ZodRecord",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!Yf(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),r;let u=[],c=e.keyType._zod.values;if(c){r.value={};let l=new Set;for(let f of c)if(typeof f=="string"||typeof f=="number"||typeof f=="symbol"){l.add(typeof f=="number"?f.toString():f);let m=e.valueType._zod.run({value:i[f],issues:[]},n);m instanceof Promise?u.push(m.then(g=>{g.issues.length&&r.issues.push(...hn(f,g.issues)),r.value[f]=g.value})):(m.issues.length&&r.issues.push(...hn(f,m.issues)),r.value[f]=m.value)}let p;for(let f in i)l.has(f)||(p=p??[],p.push(f));p&&p.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:p})}else{r.value={};for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;let p=e.keyType._zod.run({value:l,issues:[]},n);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Pc.test(l)&&p.issues.length){let g=e.keyType._zod.run({value:Number(l),issues:[]},n);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(p=g)}if(p.issues.length){e.mode==="loose"?r.value[l]=i[l]:r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(g=>gn(g,n,Zr())),input:l,path:[l],inst:t});continue}let m=e.valueType._zod.run({value:i[l],issues:[]},n);m instanceof Promise?u.push(m.then(g=>{g.issues.length&&r.issues.push(...hn(l,g.issues)),r.value[p.value]=g.value})):(m.issues.length&&r.issues.push(...hn(l,m.issues)),r.value[p.value]=m.value)}}return u.length?Promise.all(u).then(()=>r):r}});var Cm=X("$ZodEnum",(t,e)=>{Qe.init(t,e);let r=vc(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>Xf.has(typeof i)).map(i=>typeof i=="string"?_o(i):i.toString()).join("|")})$`),t._zod.parse=(i,u)=>{let c=i.value;return n.has(c)||i.issues.push({code:"invalid_value",values:r,input:c,inst:t}),i}}),Om=X("$ZodLiteral",(t,e)=>{if(Qe.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?_o(n):n?_o(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,i)=>{let u=n.value;return r.has(u)||n.issues.push({code:"invalid_value",values:e.values,input:u,inst:t}),n}});var km=X("$ZodTransform",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new qa(t.constructor.name);let i=e.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(c=>(r.value=c,r));if(i instanceof Promise)throw new Ar;return r.value=i,r}});function ym(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}o(ym,"handleOptionalResult");var $m=X("$ZodOptional",(t,e)=>{Qe.init(t,e),t._zod.optin="optional",t._zod.optout="optional",et(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),et(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Ga(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(u=>ym(u,r.value)):ym(i,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}});var Nm=X("$ZodNullable",(t,e)=>{Qe.init(t,e),et(t._zod,"optin",()=>e.innerType._zod.optin),et(t._zod,"optout",()=>e.innerType._zod.optout),et(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Ga(r.source)}|null)$`):void 0}),et(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)});var zm=X("$ZodPipe",(t,e)=>{Qe.init(t,e),et(t._zod,"values",()=>e.in._zod.values),et(t._zod,"optin",()=>e.in._zod.optin),et(t._zod,"optout",()=>e.out._zod.optout),et(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let u=e.out._zod.run(r,n);return u instanceof Promise?u.then(c=>Ka(c,e.in,n)):Ka(u,e.in,n)}let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(u=>Ka(u,e.out,n)):Ka(i,e.out,n)}});function Ka(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}o(Ka,"handlePipeResult");var Dm=X("$ZodCustom",(t,e)=>{yn.init(t,e),Qe.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(u=>_m(u,r,n,t));_m(i,r,n,t)}});function _m(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(Sc(i))}}o(_m,"handleRefineResult");var jm;var Rc=class{static{o(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Mm(){return new Rc}o(Mm,"registry");(jm=globalThis).__zod_globalRegistry??(jm.__zod_globalRegistry=Mm());var Cc=globalThis.__zod_globalRegistry;function Lm(t,e){return new t({type:"string",...Ze(e)})}o(Lm,"_string");function Fm(t,e){return new t({type:"string",coerce:!0,...Ze(e)})}o(Fm,"_coercedString");function Bm(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Ze(e)})}o(Bm,"_url");function qm(t,e){return new t({type:"number",checks:[],...Ze(e)})}o(qm,"_number");function Vm(t,e){return new t({type:"number",coerce:!0,checks:[],...Ze(e)})}o(Vm,"_coercedNumber");function Hm(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Ze(e)})}o(Hm,"_int");function Gm(t,e){return new t({type:"boolean",...Ze(e)})}o(Gm,"_boolean");function Wm(t,e){return new t({type:"boolean",coerce:!0,...Ze(e)})}o(Wm,"_coercedBoolean");function Zm(t,e){return new t({type:"bigint",coerce:!0,...Ze(e)})}o(Zm,"_coercedBigint");function Jm(t){return new t({type:"any"})}o(Jm,"_any");function Km(t){return new t({type:"unknown"})}o(Km,"_unknown");function Qm(t,e){return new t({type:"void",...Ze(e)})}o(Qm,"_void");function Ym(t,e){return new t({type:"date",coerce:!0,...Ze(e)})}o(Ym,"_coercedDate");function Xa(t,e){return new cm({check:"greater_than",...Ze(e),value:t,inclusive:!0})}o(Xa,"_gte");function fr(t,e){return new dm({check:"min_length",...Ze(e),minimum:t})}o(fr,"_minLength");function _n(t,e){return new pm({check:"string_format",format:"regex",...Ze(e),pattern:t})}o(_n,"_regex");function Xm(t,e,r){let n=Ze(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}o(Xm,"_custom");var tt=X("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");Qe.init(t,e),t.def=e,t.type=e.type,t.parse=(r,n)=>Za(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>yi(t,r,n),t.parseAsync=async(r,n)=>Ja(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>_i(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),t.with=t.check,t.clone=(r,n)=>Wa(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.apply=r=>r(t)}),ts=X("ZodMiniString",(t,e)=>{Ya.init(t,e),tt.init(t,e)});function b(t){return Lm(ts,t)}o(b,"string");var eh=X("ZodMiniStringFormat",(t,e)=>{wc.init(t,e),ts.init(t,e)});var ew=X("ZodMiniURL",(t,e)=>{bm.init(t,e),eh.init(t,e)});function th(t){return Bm(ew,t)}o(th,"url");var rs=X("ZodMiniNumber",(t,e)=>{xc.init(t,e),tt.init(t,e)});function wt(t){return qm(rs,t)}o(wt,"number");var tw=X("ZodMiniNumberFormat",(t,e)=>{vm.init(t,e),rs.init(t,e)});function rh(t){return Hm(tw,t)}o(rh,"int");var Oc=X("ZodMiniBoolean",(t,e)=>{Ac.init(t,e),tt.init(t,e)});function Ue(t){return Gm(Oc,t)}o(Ue,"boolean");var nh=X("ZodMiniBigInt",(t,e)=>{Em.init(t,e),tt.init(t,e)});var rw=X("ZodMiniAny",(t,e)=>{Sm.init(t,e),tt.init(t,e)});function vi(){return Jm(rw)}o(vi,"any");var nw=X("ZodMiniUnknown",(t,e)=>{Pm.init(t,e),tt.init(t,e)});function pe(){return Km(nw)}o(pe,"unknown");var ow=X("ZodMiniVoid",(t,e)=>{Tm.init(t,e),tt.init(t,e)});function oh(t){return Qm(ow,t)}o(oh,"_void");var ih=X("ZodMiniDate",(t,e)=>{wm.init(t,e),tt.init(t,e)});var iw=X("ZodMiniArray",(t,e)=>{xm.init(t,e),tt.init(t,e)});function ge(t,e){return new iw({type:"array",element:t,...Ze(e)})}o(ge,"array");var aw=X("ZodMiniObject",(t,e)=>{Am.init(t,e),tt.init(t,e),et(t,"shape",()=>e.shape)});function O(t,e){let r={type:"object",shape:t??{},...Ze(e)};return new aw(r)}o(O,"object");var sw=X("ZodMiniUnion",(t,e)=>{Ic.init(t,e),tt.init(t,e)});function ye(t,e){return new sw({type:"union",options:t,...Ze(e)})}o(ye,"union");var uw=X("ZodMiniDiscriminatedUnion",(t,e)=>{Im.init(t,e),tt.init(t,e)});function bn(t,e,r){return new uw({type:"union",options:e,discriminator:t,...Ze(r)})}o(bn,"discriminatedUnion");var cw=X("ZodMiniRecord",(t,e)=>{Rm.init(t,e),tt.init(t,e)});function fe(t,e,r){return new cw({type:"record",keyType:t,valueType:e,...Ze(r)})}o(fe,"record");var lw=X("ZodMiniEnum",(t,e)=>{Cm.init(t,e),tt.init(t,e),t.options=Object.values(e.entries)});function Ee(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new lw({type:"enum",entries:r,...Ze(e)})}o(Ee,"_enum");var dw=X("ZodMiniLiteral",(t,e)=>{Om.init(t,e),tt.init(t,e)});function ae(t,e){return new dw({type:"literal",values:Array.isArray(t)?t:[t],...Ze(e)})}o(ae,"literal");var pw=X("ZodMiniTransform",(t,e)=>{km.init(t,e),tt.init(t,e)});function vn(t){return new pw({type:"transform",transform:t})}o(vn,"transform");var fw=X("ZodMiniOptional",(t,e)=>{$m.init(t,e),tt.init(t,e)});function B(t){return new fw({type:"optional",innerType:t})}o(B,"optional");var mw=X("ZodMiniNullable",(t,e)=>{Nm.init(t,e),tt.init(t,e)});function Ei(t){return new mw({type:"nullable",innerType:t})}o(Ei,"nullable");var hw=X("ZodMiniPipe",(t,e)=>{zm.init(t,e),tt.init(t,e)});function En(t,e){return new hw({type:"pipe",in:t,out:e})}o(En,"pipe");var gw=X("ZodMiniCustom",(t,e)=>{Dm.init(t,e),tt.init(t,e)});function ns(t,e){return Xm(gw,t??(()=>!0),e)}o(ns,"custom");var Si={};Ba(Si,{bigint:()=>Sw,boolean:()=>Ew,date:()=>Pw,number:()=>vw,string:()=>bw});function bw(t){return Fm(ts,t)}o(bw,"string");function vw(t){return Vm(rs,t)}o(vw,"number");function Ew(t){return Wm(Oc,t)}o(Ew,"boolean");function Sw(t){return Zm(nh,t)}o(Sw,"bigint");function Pw(t){return Ym(ih,t)}o(Pw,"date");var $c=O({retryOnFailure:O({defaultValue:B(Ue()),hide:B(Ue())}),continueOnFailure:O({defaultValue:B(Ue()),hide:B(Ue())})}),kc=class{constructor(e,r,n,i,u,c,l,p,f,m,g){this.name=e;this.displayName=r;this.description=n;this.props=i;this.run=u;this.test=c;this.requireAuth=l;this.errorHandlingOptions=p;this.outputSchema=f;this.audience=m;this.aiMetadata=g}static{o(this,"IAction")}},rt=o(t=>new kc(t.name,t.displayName,t.description,t.props,t.run,t.test??t.run,t.requireAuth??!0,t.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},t.outputSchema,t.audience,t.aiMetadata),"createAction");var $e=O({displayName:b(),description:B(b())}),_e=o((t,e)=>O({type:ae(e),required:Ue(),defaultValue:B(vi())}),"TPropertyValue");var Lt=O({...$e.shape,..._e(b(),"SHORT_TEXT").shape}),Jr=O({...$e.shape,..._e(b(),"LONG_TEXT").shape});var sh=O({label:b(),value:pe()}),os=O({disabled:B(Ue()),placeholder:B(b()),options:ge(sh)});var Ft=O({...$e.shape,options:os,..._e(pe(),"STATIC_DROPDOWN").shape}),Kr=O({...$e.shape,options:os,..._e(ge(pe()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var Nc=O({...$e.shape,..._e(pe(),"DROPDOWN").shape,refreshers:ge(b())}),Pi=O({...$e.shape,..._e(ge(pe()),"MULTI_SELECT_DROPDOWN").shape,refreshers:ge(b())});var Qr=O({...$e.shape,..._e(Ue(),"CHECKBOX").shape});var Yr=O({...$e.shape,..._e(wt(),"NUMBER").shape});var Ti=O({...$e.shape,streaming:B(Ue()),..._e(pe(),"FILE").shape});var wi=O({...$e.shape,..._e(b(),"DATE_TIME").shape});var uh=fe(b(),ye([Lt,Jr,Ft,Pi,Kr,Qr,Yr,Ti,wi])),xi=O({...$e.shape,properties:uh,..._e(ge(pe()),"ARRAY").shape});var Ai=O({...$e.shape,..._e(ye([fe(b(),pe())]),"JSON").shape});var ch=ye([Lt,Ft,Ai,xi,Kr]),ww=fe(b(),ch),zc=O({refreshers:ge(b()),...$e.shape,..._e(pe(),"DYNAMIC").shape});var is=O({...$e.shape,..._e(oh(),"MARKDOWN").shape});var Ii=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(Ii||{}),vo=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(vo||{}),Eo=(w=>(w.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",w.COMMUNICATION="COMMUNICATION",w.COMMERCE="COMMERCE",w.CORE="CORE",w.UNIVERSAL_AI="UNIVERSAL_AI",w.FLOW_CONTROL="FLOW_CONTROL",w.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",w.ACCOUNTING="ACCOUNTING",w.PRODUCTIVITY="PRODUCTIVITY",w.CONTENT_AND_FILES="CONTENT_AND_FILES",w.DEVELOPER_TOOLS="DEVELOPER_TOOLS",w.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",w.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",w.HUMAN_RESOURCES="HUMAN_RESOURCES",w.PAYMENT_PROCESSING="PAYMENT_PROCESSING",w.MARKETING="MARKETING",w.SALES_AND_CRM="SALES_AND_CRM",w))(Eo||{});var Ri=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(Ri||{}),Dc="both_client_credentials_and_authorization_code";var mr=(i=>(i.POLLING="POLLING",i.WEBHOOK="WEBHOOK",i.APP_WEBHOOK="APP_WEBHOOK",i.MANUAL="MANUAL",i))(mr||{}),Ci=(u=>(u.NONE="NONE",u.HEADER_PRESENT="HEADER_PRESENT",u.QUERY_PRESENT="QUERY_PRESENT",u.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",u.HEAD_REQUEST="HEAD_REQUEST",u))(Ci||{}),xw=O({strategy:Ee(Ci),paramName:B(b())}),Oi=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(Oi||{});var as=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(as||{}),lh=O({status:B(wt()),body:B(pe()),headers:B(fe(b(),b()))}),dh=O({type:ae("DELAY"),resumeDateTime:b(),requestIdToReply:B(b()),handlerId:B(b()),streamStepProgress:B(Ee(as))}),ph=O({type:ae("WEBHOOK"),requestId:b(),requestIdToReply:B(b()),response:lh,handlerId:B(b()),streamStepProgress:B(Ee(as))}),Aw=ye([dh,ph]);var Iw=O({body:pe(),rawBody:B(pe()),headers:fe(b(),b()),queryParams:fe(b(),b())});function ut(t){return t==null}o(ut,"isNil");function ki(t){return t==null?!0:typeof t=="string"||Array.isArray(t)?t.length===0:typeof t=="object"?Object.keys(t).length===0:!1}o(ki,"isEmpty");function ss(t,e){if(t==null)throw new Error(`${e} is null or undefined`)}o(ss,"assertNotNullOrUndefined");var Uc=gt(require("crypto"),1);var Rw=128,Fn,So,Cw=o(t=>{!Fn||Fn.length<t?(Fn=Buffer.allocUnsafe(t*Rw),Uc.default.randomFillSync(Fn),So=0):So+t>Fn.length&&(Uc.default.randomFillSync(Fn),So=0),So+=t},"fillPool"),Ow=o(t=>(Cw(t|=0),Fn.subarray(So-t,So)),"random"),kw=o((t,e,r)=>{let n=(2<<31-Math.clz32(t.length-1|1))-1,i=Math.ceil(1.6*n*e/t.length);return(u=e)=>{let c="";for(;;){let l=r(i),p=i;for(;p--;)if(c+=t[l[p]&n]||"",c.length===u)return c}}},"customRandom"),mh=o((t,e=21)=>kw(t,e,Ow),"customAlphabet");var $w="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",hh=21,hB=b().check(_n(new RegExp(`^[0-9a-zA-Z]{${hh}}$`))),Nw=mh($w,hh);var Sn=En(vn(t=>t instanceof Date?t.toISOString():t),b()),tr={id:b(),created:Sn,updated:Sn},Ke=o(t=>B(Ei(t)),"Nullable");function jc(t){return B(Ei(Ee(t)))}o(jc,"NullableEnum");var _B=En(vn(t=>t==="true"||t===!0?!0:t==="false"||t===!1?!1:void 0),B(Ue())),us=o(t=>En(vn(e=>Array.isArray(e)?e:e!==void 0?[e]:void 0),B(ge(t))),"OptionalArrayFromQuery");var EB=fe(b(),pe());var $i=(m=>(m.OPENAI="openai",m.OPENROUTER="openrouter",m.ANTHROPIC="anthropic",m.AZURE="azure",m.GOOGLE="google",m.ACTIVEPIECES="activepieces",m.CLOUDFLARE_GATEWAY="cloudflare-gateway",m.CUSTOM="custom",m.BEDROCK="bedrock",m.MISTRAL="mistral",m))($i||{});var $B=b().check(_n(/^#[0-9A-Fa-f]{6}$/));var zB=O({filename:b(),data:pe(),type:ae("file"),mimetype:B(b())});var zw=gt(yh());var BB=O({...tr,name:b(),permissions:ge(b()),platformId:Ke(b()),type:b(),userCount:B(wt())});var _h=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(_h||{}),Mc=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Mc||{}),Lc=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(Lc||{});var Fc=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(Fc||{});var Bc=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Bc||{});var Dw=O({mode:Ee(_h),value:pe()}),Uw=O({auth:B(b()),fields:fe(b(),Dw)}),jw=O({pieceName:b(),pieceVersion:b(),actionName:b(),predefinedInput:B(Uw)}),Mw=O({type:ae("PIECE"),toolName:b().check(fr(1)),pieceMetadata:jw}),Lw=O({type:ae("none")}),Fw=O({type:ae("access_token"),accessToken:b()}),Bw=O({type:ae("api_key"),apiKey:b(),apiKeyHeader:b()}),qw=O({type:ae("headers"),headers:fe(b(),b())}),Vw=bn("type",[Lw,Fw,Bw,qw]),bh=O({type:ae("FLOW"),toolName:b().check(fr(1)),externalFlowId:b(),flowDisplayName:B(b())}),vh=O({type:ae("MCP"),toolName:b().check(fr(1)),serverUrl:th(),protocol:Ee(Lc),auth:Vw}),Eh=O({type:ae("KNOWLEDGE_BASE"),toolName:b().check(fr(1)),sourceType:Ee(Mc),sourceId:b(),sourceName:b()}),Hw=bn("type",[Mw,bh,vh,Eh]),Gw=O({displayName:b(),description:B(b()),type:Ee(Fc)}),Sh=O({type:ae("MARKDOWN"),markdown:b()}),Po={type:ae("TOOL_CALL"),input:Ke(fe(b(),pe())),output:B(pe()),toolName:b(),status:Ee(Bc),toolCallId:b(),startTime:b(),endTime:B(b())},b4=O(Po),Ph=bn("toolCallType",[O({...Po,toolCallType:ae("PIECE"),pieceName:b(),pieceVersion:b(),actionName:b()}),O({...Po,toolCallType:ae("FLOW"),displayName:b(),externalFlowId:b()}),O({...Po,toolCallType:ae("MCP"),displayName:b(),serverUrl:b()}),O({...Po,toolCallType:ae("KNOWLEDGE_BASE"),displayName:b(),sourceType:b()}),O({...Po,toolCallType:ae("UNKNOWN"),displayName:b()})]),Ww=ye([Sh,Ph]);var qc=(r=>(r.IMAGE="image",r.TEXT="text",r))(qc||{}),Xr=O({apiKey:b()}),Zw=Xr,Jw=O({apiKey:b(),apiKeyHash:b()}),Kw=Xr,Qw=Xr,Yw=Xr,Xw=Xr,ex=Xr,tx=Xr,rx=Xr,Ih=O({accessKeyId:b().check(fr(1)),secretAccessKey:b().check(fr(1))}),nx=O({}),ox=O({}),ix=O({}),ax=O({}),sx=O({}),ux=O({}),Rh=O({modelId:b(),modelName:b(),modelType:Ee(qc)}),Ch=O({apiKeyHeader:b(),baseUrl:b(),models:ge(Rh),defaultHeaders:B(fe(b(),b()))}),Oh=O({accountId:b(),gatewayId:b(),models:ge(Rh),vertexProject:B(b()),vertexRegion:B(b())}),kh=O({resourceName:b(),apiVersion:En(vn(t=>typeof t=="string"&&t.trim().length===0?void 0:t),B(b()))}),$h=O({region:b().check(fr(1))}),cx=ye([Zw,Yw,Xw,ex,tx,Qw,Kw,Jw,Ih,rx]),Nh=ye([Ch,Oh,kh,$h,nx,ix,ax,sx,ox,ux]),lx=O({id:b(),name:b(),type:Ee(qc)}),dx=O({id:b(),name:b(),provider:Ee($i),config:Nh,enabledForChat:Ue()}),px=O({provider:Ee($i),config:Nh,auth:cx,platformId:b()});var P4={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},Th=["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],fx=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],mx=["claude-sonnet-4.6","claude-opus-4.7","claude-haiku-4.5"],wh=["gemini-2.5-pro","gemini-2.5-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],hx=["grok-4.20","grok-4.1-fast"],gx={openai:Th,anthropic:fx,google:wh,activepieces:[...mx.map(t=>`anthropic/${t}`),...Th.map(t=>`openai/${t}`),...wh.map(t=>`google/${t}`),...hx.map(t=>`x-ai/${t}`)]};var xh=128e3,yx={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function _x({provider:t}){return t?yx[t]??xh:xh}o(_x,"getMaxContextTokens");var Ah={openai:"text-embedding-3-small",google:"text-embedding-004",azure:"text-embedding-3-small",activepieces:"text-embedding-3-small",openrouter:"openai/text-embedding-3-small"},bx={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},vx=new Set(["anthropic","mistral"]);function Ir(t){return{chatModels:gx[t],maxContextTokens:_x({provider:t}),defaultEmbeddingModel:Ah[t],supportsEmbedding:Ah[t]!==void 0,supportsImageGeneration:!vx.has(t),webSearch:bx[t]}}o(Ir,"buildProviderCapabilities");var Ex={openai:Ir("openai"),anthropic:Ir("anthropic"),openrouter:Ir("openrouter"),azure:Ir("azure"),google:Ir("google"),"cloudflare-gateway":Ir("cloudflare-gateway"),custom:Ir("custom"),bedrock:Ir("bedrock"),mistral:Ir("mistral"),activepieces:Ir("activepieces")};var Sx=O({base64Url:b(),fileName:b(),extension:B(b())}),Px=O({mimeType:b(),url:b(),fileName:B(b())}),Vc=ye([Sx,Px]);var Tx=ye([O({type:ae("file"),value:Vc}),O({type:ae("markdown"),value:b(),files:B(ge(Vc))})]),wx=O({sessionId:b(),message:b(),files:B(ge(b()))});var Dh=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(Dh||{}),Uh=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(Uh||{}),Hc=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(Hc||{});var xx=ye([O({...tr,name:b(),externalId:b(),type:ae("STATIC_DROPDOWN"),tableId:b(),projectId:b(),data:O({options:ge(O({value:b()}))})}),O({...tr,name:b(),externalId:b(),type:ye([ae("TEXT"),ae("NUMBER"),ae("DATE")]),tableId:b(),projectId:b()})]),Ax=O({...tr,name:b(),folderId:Ke(b()),projectId:b(),externalId:b(),status:jc(Uh),trigger:jc(Dh)}),Ix=O({...tr,tableId:b(),projectId:b(),cells:fe(b(),O({updated:b(),created:b(),value:pe(),fieldName:b()}))}),Rx=O({events:ge(Ee(Hc)),webhookUrl:b(),flowId:b()}),Cx=O({fields:ge(O({id:b(),name:b()})),rows:ge(fe(b(),b())),name:b()}),Ox=O({projectId:b(),limit:B(Si.number()),cursor:B(b()),name:B(b()),externalIds:us(b()),folderId:B(b()),folderIds:us(b())}),kx=O({records:ge(ge(O({fieldId:b(),value:Mh()}))),tableId:b()}),$x=O({cells:B(ge(O({fieldId:b(),value:Mh()}))),tableId:b(),agentUpdate:B(Ue())}),jh=bn("operator",[Bn("eq"),Bn("neq"),Bn("gt"),Bn("gte"),Bn("lt"),Bn("lte"),Bn("co"),zh("exists"),zh("not_exists")]),Nx=O({tableId:b(),limit:B(Si.number()),cursor:B(b()),filters:us(jh)});function Mh(){return En(vn(t=>t==null?t:String(t)),Ei(b()))}o(Mh,"coerceToString");function Bn(t){return O({fieldId:b(),operator:ae(t),value:b()})}o(Bn,"valueFilter");function zh(t){return O({fieldId:b(),operator:ae(t)})}o(zh,"existenceFilter");var zx=O({status:B(wt()),body:B(pe()),headers:B(fe(b(),b()))}),Dx=O({...tr,deleted:Ke(Sn),ownerId:b(),displayName:b(),platformId:b(),externalId:Ke(b())});var Lh=O({name:b(),description:B(b()),type:b(),required:Ue()}),Ux=O({pieceName:b(),triggerName:b(),input:O({toolName:b(),toolDescription:b(),inputSchema:ge(Lh),returnsResponse:Ue()})});var Fh="^[0-9]+\\.[0-9]+\\.[0-9]+$",B4=new RegExp(Fh),Mx="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",q4=b().check(_n(new RegExp(Fh))),V4=b().check(_n(new RegExp(Mx))),Lx=O({packageType:ae("ARCHIVE"),pieceType:Ee(vo),pieceName:b(),pieceVersion:b(),archiveId:b(),platformId:b()}),Bh=O({packageType:ae("REGISTRY"),pieceType:ae("OFFICIAL"),pieceName:b(),pieceVersion:b()}),qh=O({packageType:ae("REGISTRY"),pieceType:ae("CUSTOM"),pieceName:b(),pieceVersion:b(),platformId:b()}),H4=ye([Bh,qh]),G4=ye([Lx,Bh,qh]);var Fx=bn("type",[O({type:ae("CRON_EXPRESSION"),cronExpression:b(),timezone:b()}),O({type:ae("INTERVAL"),intervalMs:rh().check(Xa(6e4))})]),W4=O({...tr,type:Ee(mr),projectId:b(),flowId:b(),triggerName:b(),schedule:Ke(Fx),flowVersionId:b(),pieceName:b(),pieceVersion:b(),deleted:Ke(b()),simulate:Ue()}),Vh=(E=>(E.UNKNOWN="UNKNOWN",E.FLOW_RUN_LOG="FLOW_RUN_LOG",E.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",E.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",E.FLOW_STEP_FILE="FLOW_STEP_FILE",E.SAMPLE_DATA="SAMPLE_DATA",E.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",E.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",E.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",E.PROJECT_RELEASE="PROJECT_RELEASE",E.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",E.PLATFORM_ASSET="PLATFORM_ASSET",E.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",E.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",E.KNOWLEDGE_BASE="KNOWLEDGE_BASE",E.FLOW_BUNDLE="FLOW_BUNDLE",E))(Vh||{}),Hh=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(Hh||{}),Gh=(r=>(r.S3="S3",r.DB="DB",r))(Gh||{}),Z4=O({...tr,projectId:Ke(b()),platformId:Ke(b()),type:Ee(Vh),compression:Ee(Hh),data:B(pe()),location:Ee(Gh),size:Ke(wt()),fileName:Ke(b()),s3Key:Ke(b()),metadata:Ke(fe(b(),b()))}),Wh=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(Wh||{}),Zh=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(Zh||{}),J4=O({id:b(),email:b(),firstName:b(),status:Ee(Zh),externalId:Ke(b()),platformId:Ke(b()),platformRole:Ee(Wh),lastName:b(),created:Sn,updated:Sn,lastActiveDate:Ke(Sn),imageUrl:Ke(b())});var Wc=O({...$e.shape,..._e(fe(b(),pe()),"OBJECT").shape});var Qh=O({...$e.shape,..._e(b(),"COLOR").shape});var Zc=ye([Lt,Jr,is,Qr,Ft,Kr,Nc,Pi,zc,Yr,xi,Wc,Ai,wi,Ti,Qh]),K={ShortText(t){return{...t,valueSchema:void 0,type:"SHORT_TEXT"}},Checkbox(t){return{...t,valueSchema:void 0,type:"CHECKBOX"}},LongText(t){return{...t,valueSchema:void 0,type:"LONG_TEXT"}},MarkDown(t){return{displayName:"Markdown",required:!1,description:t.value,type:"MARKDOWN",valueSchema:void 0,variant:t.variant??"INFO"}},Number(t){return{...t,valueSchema:void 0,type:"NUMBER"}},Json(t){return{...t,valueSchema:void 0,type:"JSON"}},Array(t){return{...t,valueSchema:void 0,type:"ARRAY"}},Object(t){return{...t,valueSchema:void 0,type:"OBJECT"}},Dropdown(t){return{...t,valueSchema:void 0,type:"DROPDOWN"}},StaticDropdown(t){return{...t,valueSchema:void 0,type:"STATIC_DROPDOWN"}},MultiSelectDropdown(t){return{...t,valueSchema:void 0,type:"MULTI_SELECT_DROPDOWN"}},DynamicProperties(t){return{...t,valueSchema:void 0,type:"DYNAMIC"}},StaticMultiSelectDropdown(t){return{...t,valueSchema:void 0,type:"STATIC_MULTI_SELECT_DROPDOWN"}},DateTime(t){return{...t,valueSchema:void 0,type:"DATE_TIME"}},File(t){return{...t,valueSchema:void 0,type:"FILE"}},Custom(t){let e=t.code.toString();return{...t,code:e,valueSchema:void 0,type:"CUSTOM"}},Color(t){return{...t,valueSchema:void 0,type:"COLOR"}}};var Rr=O({displayName:b(),description:B(b())});var Yh=O({username:b(),password:b()}),Jc=O({...Rr.shape,username:O({displayName:b(),description:B(b())}),password:O({displayName:b(),description:B(b())}),..._e(Yh,"BASIC_AUTH").shape});var Hx=fe(b(),ye([Lt,Jr,Yr,Qr,Ft])),Kc=O({...Rr.shape,props:Hx,..._e(pe(),"CUSTOM_AUTH").shape});var qn=O({...Rr.shape,..._e(O({auth:b()}),"SECRET_TEXT").shape});var Gx=fe(b(),ye([Lt,Jr,qn,Yr,Qr,Ft,Kr,is])),Xh=O({...Rr.shape,props:Gx,..._e(pe(),"OIDC").shape});var Qc=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(Qc||{}),eg=ye([Lt,qn,Ft]),tg=fe(b(),eg),Wx=O({props:B(fe(b(),eg)),authUrl:b(),tokenUrl:b(),scope:ge(b()),prompt:B(ye([ae("none"),ae("consent"),ae("login"),ae("omit")])),pkce:B(Ue()),pkceMethod:B(ye([ae("plain"),ae("S256")])),authorizationMethod:B(Ee(Qc)),grantType:B(ye([Ee(Ri),ae(Dc)])),extra:B(fe(b(),b()))}),rg=O({access_token:b(),props:B(tg),data:fe(b(),vi())}),Yc=O({...Rr.shape,...Wx.shape,..._e(rg,"OAUTH2").shape});var To=ye([Jc,Kc,Xh,Yc,qn]),Ni="Connection",ls={SecretText(t){return{...t,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(t){return{...t,valueSchema:void 0,type:"OAUTH2",displayName:t.displayName||Ni}},BasicAuth(t){return{...t,valueSchema:void 0,type:"BASIC_AUTH",displayName:t.displayName||Ni,required:!0}},CustomAuth(t){return{...t,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:t.displayName||Ni}},OIDC(t){return{...t,valueSchema:void 0,type:"OIDC",displayName:t.displayName||Ni}},None(){}};var A6={OAUTH2:"OAUTH2",CLOUD_OAUTH2:"OAUTH2",PLATFORM_OAUTH2:"OAUTH2",BASIC_AUTH:"BASIC_AUTH",CUSTOM_AUTH:"CUSTOM_AUTH",OIDC:"OIDC",SECRET_TEXT:"SECRET_TEXT",NO_AUTH:void 0};var Zx=O({...$e.shape,..._e(pe(),"CUSTOM").shape,code:b()});var Jx=ye([Zc,To]),Xc=fe(b(),Jx),W6=fe(b(),Zc);var ng=ye([O({strategy:ae("CRON"),cronExpression:b()}),O({strategy:ae("NONE")})]),wo=class{constructor(e,r,n,i,u,c,l,p,f,m,g,S,h,_,T,E,w,k,q){this.name=e;this.displayName=r;this.description=n;this.requireAuth=i;this.props=u;this.type=c;this.handshakeConfiguration=l;this.onHandshake=p;this.renewConfiguration=f;this.onRenew=m;this.onEnable=g;this.onDisable=S;this.onStart=h;this.run=_;this.test=T;this.sampleData=E;this.testStrategy=w;this.outputSchema=k;this.aiMetadata=q}static{o(this,"ITrigger")}},Pn=o(t=>{switch(t.type){case"WEBHOOK":return new wo(t.name,t.displayName,t.description,t.requireAuth??!0,t.props,t.type,t.handshakeConfiguration??{strategy:"NONE"},t.onHandshake??(async()=>({status:200})),t.renewConfiguration??{strategy:"NONE"},t.onRenew??(async()=>Promise.resolve()),t.onEnable,t.onDisable,t.onStart??(async()=>Promise.resolve()),t.run,t.test??(()=>Promise.resolve([t.sampleData])),t.sampleData,t.test?"TEST_FUNCTION":"SIMULATION",t.outputSchema,t.aiMetadata);case"POLLING":return new wo(t.name,t.displayName,t.description,t.requireAuth??!0,t.props,t.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),t.onEnable,t.onDisable,t.onStart??(async()=>Promise.resolve()),t.run,t.test??(()=>Promise.resolve([t.sampleData])),t.sampleData,"TEST_FUNCTION",t.outputSchema,t.aiMetadata);case"MANUAL":return new wo(t.name,t.displayName,t.description,t.requireAuth??!0,t.props,t.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),t.onEnable,t.onDisable,t.onStart??(async()=>Promise.resolve()),t.run,t.test??(()=>Promise.resolve([t.sampleData])),t.sampleData,"TEST_FUNCTION",t.outputSchema,t.aiMetadata);case"APP_WEBHOOK":return new wo(t.name,t.displayName,t.description,t.requireAuth??!0,t.props,t.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),t.onEnable,t.onDisable,t.onStart??(async()=>Promise.resolve()),t.run,t.test??(()=>Promise.resolve([t.sampleData])),t.sampleData,ut(t.sampleData)&&ut(t.test)?"SIMULATION":"TEST_FUNCTION",t.outputSchema,t.aiMetadata)}},"createTrigger");var og="2",ds="0.82.0";var el=class{constructor(e,r,n,i,u,c,l,p,f=ds,m,g="",S){this.displayName=e;this.logoUrl=r;this.authors=n;this.events=i;this.categories=l;this.auth=p;this.minimumSupportedRelease=f;this.maximumSupportedRelease=m;this.description=g;this.deprecated=S;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:og}),"getContextInfo");(!Kx(f)||Qx(f,ds))&&(this.minimumSupportedRelease=ds),u.forEach(h=>this._actions[h.name]=h),c.forEach(h=>this._triggers[h.name]=h)}static{o(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:this.auth,minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,deprecated:this.deprecated,contextInfo:this.getContextInfo?.()}}getAction(e){return this._actions[e]}getTrigger(e){return this._triggers[e]}actions(){return this._actions}triggers(){return this._triggers}},ig=o(t=>{if(t.auth&&Array.isArray(t.auth)&&!t.auth.every((r,n,i)=>n===i.findIndex(u=>u.type===r.type)))throw new Error("Auth properties must be unique by type");return new el(t.displayName,t.logoUrl,t.authors??[],t.events,t.actions,t.triggers,t.categories??[],t.auth,t.minimumSupportedRelease,t.maximumSupportedRelease,t.description,t.deprecated)},"createPiece");function Kx(t){return/^\d+\.\d+\.\d+$/.test(t)}o(Kx,"isValidSimpleSemver");function Qx(t,e){let[r,n,i]=t.split(".").map(Number),[u,c,l]=e.split(".").map(Number);return r!==u?r<u:n!==c?n<c:i<l}o(Qx,"isSemverLessThan");var Yx=B(fe(b(),fe(b(),b()))),ag=O({id:B(b()),name:b(),displayName:b(),logoUrl:b(),description:b(),authors:ge(b()),platformId:B(b()),directoryPath:B(b()),auth:B(ye([To,ge(To)])),version:b(),categories:B(ge(Ee(Eo))),minimumSupportedRelease:B(b()),maximumSupportedRelease:B(b()),deprecated:B(Ue()),i18n:Yx}),Xx=Ee(["human","ai","both"]),sg=O({description:B(b()),idempotent:B(Ue())}),ug=O({name:b(),displayName:b(),description:b(),props:Xc,requireAuth:Ue(),errorHandlingOptions:B($c),outputSchema:B(ns()),audience:B(Xx),aiMetadata:B(sg)}),cg=O({name:b(),displayName:b(),description:b(),props:Xc,errorHandlingOptions:B($c),type:Ee(mr),sampleData:pe(),handshakeConfiguration:B(ns()),renewConfiguration:B(ng),testStrategy:Ee(Oi),outputSchema:B(ns()),aiMetadata:B(sg)}),eA=O({...ag.shape,actions:fe(b(),ug),triggers:fe(b(),cg)}),tA=O({...ag.shape,actions:wt(),triggers:wt(),suggestedActions:B(ge(ug)),suggestedTriggers:B(ge(cg))}),lg=O({projectUsage:wt(),pieceType:Ee(vo),packageType:Ee(Ii),platformId:B(b()),archiveId:B(b())}),WV=O({...eA.shape,...lg.shape}),ZV=O({...tA.shape,...lg.shape}),JV=O({name:b(),version:b()});var rA=gt(require("path")),nA=gt(require("fs/promises"));var mg=require("node:stream");var ps=class{constructor(e,r){this.baseUrl=e;this.authenticationConverter=r}static{o(this,"BaseHttpClient")}getUrl(e){let r=new URL(`${this.baseUrl}${e.url}`),n=`${r.origin}${r.pathname}`,i=new URLSearchParams;return r.searchParams.forEach((u,c)=>{i.append(c,u)}),{urlWithoutQueryParams:n,queryParams:i}}getHeaders(e){let r={Accept:"application/json"};return e.authentication&&this.populateAuthentication(e.authentication,r),e.body&&(e.headers?.["Content-Type"]==="text/csv"?r["Content-Type"]="text/csv":r["Content-Type"]="application/json"),e.headers&&(r={...r,...e.headers}),r}populateAuthentication(e,r){this.authenticationConverter.convert(e,r)}};var fs=class{static{o(this,"DelegatingAuthenticationConverter")}constructor(e=new tl,r=new rl){this.converters={BEARER_TOKEN:e,BASIC:r}}convert(e,r){return this.converters[e.type].convert(e,r)}},tl=class{static{o(this,"BearerTokenAuthenticationConverter")}convert(e,r){return r.Authorization=`Bearer ${e.token}`,r}},rl=class{static{o(this,"BasicTokenAuthenticationConverter")}convert(e,r){let n=`${e.username}:${e.password}`,i=Buffer.from(n).toString("base64");return r.Authorization=`Basic ${i}`,r}};var zi=class extends Error{constructor(r,n){let i=n.status||500,u=Buffer.isBuffer(n.responseBody)?n.responseBody.toString():n.responseBody;super(JSON.stringify({response:{status:i,body:u},request:{body:r}}));this.requestBody=r;this.status=i,this.responseBody=u}static{o(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};function dg({error:t,requestBody:e}){return t instanceof zi?t.errorMessage():{response:{status:0,body:t instanceof Error?t.message:String(t)},request:{body:e}}}o(dg,"toFailsafeOutput");var xt=(c=>(c.GET="GET",c.POST="POST",c.PATCH="PATCH",c.PUT="PUT",c.DELETE="DELETE",c.HEAD="HEAD",c))(xt||{});var ms=class extends ps{static{o(this,"FetchHttpClient")}constructor(e="",r=new fs){super(e,r)}async sendRequest(e,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:n,queryParams:i}=this.getUrl(e),u=this.getHeaders(e),c=e.queryParams??{};for(let[q,G]of Object.entries(c))i.append(q,G);let l=i.toString(),p=l?`${n}?${l}`:n,f=e.responseType??"json",m=e.followRedirects??!0,g=e.retries??0,{body:S,extraHeaders:h,isStream:_}=oA(e.method)?iA(e.body,u):{body:void 0,extraHeaders:{},isStream:!1},T=sA({...u,...h}),E=await aA(async()=>{let q=new AbortController,G=e.timeout&&e.timeout>0?setTimeout(()=>q.abort(),e.timeout):void 0;try{let V={method:e.method.toString(),headers:T,body:S,redirect:m?"follow":"manual",signal:q.signal};return _&&(V.duplex="half"),r?.dispatcher!==void 0&&(V.dispatcher=r.dispatcher),await fetch(p,V)}finally{G!==void 0&&clearTimeout(G)}},g),w=m?300:400;if(E.status<200||E.status>=w){let q=await pg(E,f),G=new zi(e.body,{status:E.status,responseBody:q});throw console.error("[HttpClient#(sanitized error message)] Request failed:",G),G}let k=await pg(E,f);return{status:E.status,headers:uA(E.headers),body:k}}};function oA(t){return t!=="GET"&&t!=="HEAD"}o(oA,"acceptsRequestBody");function iA(t,e){if(lA(t))return{body:void 0,extraHeaders:{},isStream:!1};if(cA(t)){let n=new mg.PassThrough;return t.on("error",i=>n.destroy(i)),t.pipe(n),{body:n,extraHeaders:t.getHeaders(),isStream:!0}}return typeof t=="string"||Buffer.isBuffer(t)||t instanceof URLSearchParams||t instanceof ArrayBuffer||typeof FormData<"u"&&t instanceof FormData||typeof Blob<"u"&&t instanceof Blob?{body:t,extraHeaders:{},isStream:!1}:(e["Content-Type"]??e["content-type"]??"").includes("application/x-www-form-urlencoded")?{body:new URLSearchParams(t).toString(),extraHeaders:{},isStream:!1}:{body:JSON.stringify(t),extraHeaders:{},isStream:!1}}o(iA,"serializeBody");async function pg(t,e){switch(e){case"arraybuffer":return Buffer.from(await t.arrayBuffer());case"blob":return await t.blob();case"text":return await t.text();default:{let r=await t.text();if(r.length===0)return;try{return JSON.parse(r)}catch{return r}}}}o(pg,"parseResponseBody");async function aA(t,e){let r;for(let n=0;n<=e;n++)try{let i=await t();if(i.status>=500&&n<e){await fg(n);continue}return i}catch(i){if(r=i,n<e){await fg(n);continue}throw i}throw r}o(aA,"sendWithRetries");function fg(t){let e=Math.min(1e3*2**t,3e4);return new Promise(r=>setTimeout(r,e))}o(fg,"backoff");function sA(t){let e={};for(let[r,n]of Object.entries(t))n!==void 0&&(e[r.toLowerCase()]=Array.isArray(n)?n.join(", "):n);return e}o(sA,"normalizeHeaders");function uA(t){let e={};return t.forEach((r,n)=>{e[n]=r}),e}o(uA,"toHttpHeaders");function cA(t){return typeof t=="object"&&t!==null&&typeof t.getHeaders=="function"&&typeof t.pipe=="function"&&typeof t.on=="function"}o(cA,"isNodeFormData");function lA(t){return t==null}o(lA,"isNil");var Pe=new ms;var QI=gt(require("fs")),v_=gt(b_());var YI={"application/json":"json","application/pdf":"pdf","application/xml":"xml","text/xml":"xml","application/zip":"zip","application/gzip":"gz","application/x-tar":"tar","application/octet-stream":"bin","application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/rtf":"rtf","application/javascript":"js","application/x-www-form-urlencoded":"bin","text/plain":"txt","text/html":"html","text/css":"css","text/csv":"csv","text/calendar":"ics","text/markdown":"md","image/png":"png","image/jpeg":"jpeg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/bmp":"bmp","image/tiff":"tiff","image/x-icon":"ico","image/vnd.microsoft.icon":"ico","image/heic":"heic","audio/mpeg":"mp3","audio/mp4":"m4a","audio/wav":"wav","audio/x-wav":"wav","audio/ogg":"ogg","audio/webm":"weba","video/mp4":"mp4","video/mpeg":"mpeg","video/webm":"webm","video/quicktime":"mov","video/x-msvideo":"avi","font/woff":"woff","font/woff2":"woff2","font/ttf":"ttf","font/otf":"otf"};function XI(t){let e=t.split(";")[0].trim().toLowerCase();return YI[e]??""}o(XI,"contentTypeToExtension");var eR=o(({baseUrl:t,relativePath:e})=>{let r=t.endsWith("/")?t:`${t}/`,n=e.startsWith("/")?e.slice(1):e;return`${r}${n}`},"joinBaseUrlWithRelativePath"),tR=o((t,e)=>{let r="https://api.example.com";try{let n=e?t(e):void 0;return(n?.endsWith("/")?n.slice(0,-1):n)??r}catch{return r}},"getBaseUrlForDescription");function E_({auth:t,baseUrl:e,authMapping:r,description:n,displayName:i,name:u,props:c,extraProps:l,authLocation:p="headers"}){return rt({audience:"human",name:u||"custom_api_call",displayName:i||"Custom API Call",description:n||"Make a custom API call to a specific endpoint",auth:t,requireAuth:!!t,props:{url:K.DynamicProperties({auth:t,displayName:"",required:!0,refreshers:[],props:o(async({auth:f})=>({url:K.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
56
- i.e ${tR(e,f)}/resource or /resource`,required:!0,defaultValue:f?e(f):"",...c?.url??{}})}),"props")}),method:K.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(xt).map(f=>({label:f,value:f}))},...c?.method??{}}),headers:K.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...c?.headers??{}}),queryParams:K.Object({displayName:"Query Parameters",required:!0,...c?.queryParams??{}}),body_type:K.StaticDropdown({displayName:"Body Type",required:!1,defaultValue:"none",options:{disabled:!1,options:[{label:"None",value:"none"},{label:"JSON",value:"json"},{label:"Form Data",value:"form_data"},{label:"Raw",value:"raw"}]}}),body:K.DynamicProperties({auth:t,displayName:"Body",refreshers:["body_type"],required:!1,props:o(async({body_type:f})=>{if(!f)return{};let m=f,g={};switch(m){case"none":break;case"json":g.data=K.Json({displayName:"JSON Body",required:!0,...c?.body??{}});break;case"raw":g.data=K.LongText({displayName:"Raw Body",required:!0});break;case"form_data":g.data=K.Array({displayName:"Form Data",required:!0,properties:{fieldName:K.ShortText({displayName:"Field Name",required:!0}),fieldType:K.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:K.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:K.File({displayName:"File Field Value",required:!1})}});break}return g},"props")}),response_is_binary:K.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:K.Checkbox({displayName:"No Error on Failure",required:!1,...c?.failsafe??{}}),timeout:K.Number({displayName:"Timeout (in seconds)",required:!1,...c?.timeout??{}}),followRedirects:K.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...l},run:o(async f=>{let{method:m,url:g,headers:S,queryParams:h,body:_,body_type:T,failsafe:E,timeout:w,response_is_binary:k,followRedirects:q}=f.propsValue;ss(m,"Method"),ss(g,"URL");let G=ut(r)?{}:await r(f.auth,f.propsValue),V=g.url,H=V.startsWith("http://")||V.startsWith("https://")?V:eR({baseUrl:e(f.auth),relativePath:V}),J={method:m,url:H,headers:{...S??{},...p==="headers"||!ut(p)?G:{}},queryParams:{...p==="queryParams"?G:{},...h??{}},timeout:w?w*1e3:0,followRedirects:q};if(k&&(J.responseType="arraybuffer"),_)if(T&&T!=="none"){let re=_.data;if(T==="form_data"){let Z=re,ze=new v_.default;for(let{fieldName:Se,fieldType:be,textFieldValue:ke,fileFieldValue:Ie}of Z)be==="text"&&!ki(ke)?ze.append(Se,ke):be==="file"&&!ki(Ie)&&ze.append(Se,Ie.data,{filename:Ie?.filename});J.body=ze,J.headers={...J.headers,...ze.getHeaders()}}else J.body=re}else T||(J.body=_);try{let re=await Pe.sendRequest(J);return await rR(f.files,re.body,re.status,re.headers,k)}catch(re){if(E)return dg({error:re,requestBody:J.body});throw re}},"run")})}o(E_,"createCustomApiCallAction");var rR=o(async(t,e,r,n,i)=>{let u;if(i&&nR(e)){let c=Array.isArray(n?.["content-type"])?n["content-type"][0]:n?.["content-type"],l=XI(c??"")||"txt",p;e instanceof ArrayBuffer?p=Buffer.from(new Uint8Array(e)):Buffer.isBuffer(e)?p=e:p=Buffer.from(e),u=await t.write({fileName:`output.${l}`,data:p})}else u=e;return{status:r,headers:n,body:u}},"handleBinaryResponse"),nR=o(t=>t instanceof ArrayBuffer||Buffer.isBuffer(t),"isBinaryBody");var nt={async poll(t,{store:e,auth:r,propsValue:n,maxItemsToPoll:i,files:u,server:c}){switch(t.strategy){case 0:{let l=await e.get("lastPoll");if(ut(l))throw new Error("lastPoll doesn't exist in the store.");let p=await t.items({store:e,auth:r,propsValue:n,lastFetchEpochMS:l,server:c}),f=p.reduce((m,g)=>Math.max(m,g.epochMilliSeconds),l);return await e.put("lastPoll",f),p.filter(m=>m.epochMilliSeconds>l).map(m=>m.data)}case 1:{let l=await e.get("lastItem"),p=await t.items({store:e,auth:r,propsValue:n,lastItemId:l,files:u,server:c}),f=p.findIndex(S=>S.id===l),m=[];ut(l)||f==-1?m=p??[]:m=p?.slice(0,f)??[],ut(i)||(m=m.slice(-i));let g=m?.[0]?.id;return ut(g)||await e.put("lastItem",g),m.map(S=>S.data)}}},async onEnable(t,{store:e,auth:r,propsValue:n,server:i}){switch(t.strategy){case 0:{await e.put("lastPoll",Date.now());break}case 1:{let c=(await t.items({store:e,auth:r,propsValue:n,lastItemId:null,server:i}))?.[0]?.id;ut(c)?await e.delete("lastItem"):await e.put("lastItem",c);break}}},async onDisable(t,e){switch(t.strategy){case 0:case 1:return}},async test(t,{auth:e,propsValue:r,store:n,files:i,server:u}){let c=[];switch(t.strategy){case 0:{c=await t.items({store:n,auth:e,propsValue:r,lastFetchEpochMS:0,server:u});break}case 1:{c=await t.items({store:n,auth:e,propsValue:r,lastItemId:null,files:i,server:u});break}}return oR(c.map(l=>l.data))}};function oR(t){return t.length<=5?t:t.slice(0,5)}o(oR,"getFirstFiveOrAll");var qp=gt(AS());var xe="https://bigquery.googleapis.com/bigquery/v2",Bp=["https://www.googleapis.com/auth/bigquery"],Oe=[ls.OAuth2({description:"Sign in with your Google account. If you are using your own OAuth2 credentials, make sure to include the following scope: `https://www.googleapis.com/auth/bigquery`",authUrl:"https://accounts.google.com/o/oauth2/auth",tokenUrl:"https://oauth2.googleapis.com/token",required:!0,scope:Bp}),ls.CustomAuth({displayName:"Service Account",description:"Use a GCP service account for automated, server-to-server access \u2014 no user sign-in required. Recommended for production workflows.",required:!0,props:{instructions:K.MarkDown({value:`**How to create a service account key:**
55
+ https://cloud.google.com/compute/docs/metadata/predefined-metadata-keys`};var Mp=class{static{o(this,"GoogleAuth")}checkIsGCE=void 0;useJWTAccessWithScope;defaultServicePath;get isGCE(){return this.checkIsGCE}_findProjectIdPromise;_cachedProjectId;jsonContent=null;apiKey;cachedCredential=null;#e=null;defaultScopes;keyFilename;scopes;clientOptions={};constructor(e={}){if(this._cachedProjectId=e.projectId||null,this.cachedCredential=e.authClient||null,this.keyFilename=e.keyFilename||e.keyFile,this.scopes=e.scopes,this.clientOptions=e.clientOptions||{},this.jsonContent=e.credentials||null,this.apiKey=e.apiKey||this.clientOptions.apiKey||null,this.apiKey&&(this.jsonContent||this.clientOptions.credentials))throw new RangeError(Tr.GoogleAuthExceptionMessages.API_KEY_WITH_CREDENTIALS);e.universeDomain&&(this.clientOptions.universeDomain=e.universeDomain)}setGapicJWTValues(e){e.defaultServicePath=this.defaultServicePath,e.useJWTAccessWithScope=this.useJWTAccessWithScope,e.defaultScopes=this.defaultScopes}getProjectId(e){if(e)this.getProjectIdAsync().then(r=>e(null,r),e);else return this.getProjectIdAsync()}async getProjectIdOptional(){try{return await this.getProjectId()}catch(e){if(e instanceof Error&&e.message===Tr.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)return null;throw e}}async findAndCacheProjectId(){let e=null;if(e||=await this.getProductionProjectId(),e||=await this.getFileProjectId(),e||=await this.getDefaultServiceProjectId(),e||=await this.getGCEProjectId(),e||=await this.getExternalAccountClientProjectId(),e)return this._cachedProjectId=e,e;throw new Error(Tr.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)}async getProjectIdAsync(){return this._cachedProjectId?this._cachedProjectId:(this._findProjectIdPromise||(this._findProjectIdPromise=this.findAndCacheProjectId()),this._findProjectIdPromise)}async getUniverseDomainFromMetadataServer(){let e;try{e=await ma.universe("universe-domain"),e||=jp.DEFAULT_UNIVERSE}catch(r){if(r&&r?.response?.status===404)e=jp.DEFAULT_UNIVERSE;else throw r}return e}async getUniverseDomain(){let e=(0,xP.originalOrCamelOptions)(this.clientOptions).get("universe_domain");try{e??=(await this.getClient()).universeDomain}catch{e??=jp.DEFAULT_UNIVERSE}return e}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(e={},r){let n;if(typeof e=="function"?r=e:n=e,r)this.getApplicationDefaultAsync(n).then(i=>r(null,i.credential,i.projectId),r);else return this.getApplicationDefaultAsync(n)}async getApplicationDefaultAsync(e={}){if(this.cachedCredential)return await this.#t(this.cachedCredential,null);let r;if(r=await this._tryGetApplicationCredentialsFromEnvironmentVariable(e),r)return r instanceof ri.JWT?r.scopes=this.scopes:r instanceof ha.BaseExternalAccountClient&&(r.scopes=this.getAnyScopes()),await this.#t(r);if(r=await this._tryGetApplicationCredentialsFromWellKnownFile(e),r)return r instanceof ri.JWT?r.scopes=this.scopes:r instanceof ha.BaseExternalAccountClient&&(r.scopes=this.getAnyScopes()),await this.#t(r);if(await this._checkIsGCE())return e.scopes=this.getAnyScopes(),await this.#t(new l$.Compute(e));throw new Error(Tr.GoogleAuthExceptionMessages.NO_ADC_FOUND)}async#t(e,r=process.env.GOOGLE_CLOUD_QUOTA_PROJECT||null){let n=await this.getProjectIdOptional();return r&&(e.quotaProjectId=r),this.cachedCredential=e,{credential:e,projectId:n}}async _checkIsGCE(){return this.checkIsGCE===void 0&&(this.checkIsGCE=ma.getGCPResidency()||await ma.isAvailable()),this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(e){let r=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials;if(!r||r.length===0)return null;try{return this._getApplicationCredentialsFromFilePath(r,e)}catch(n){throw n instanceof Error&&(n.message=`Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${n.message}`),n}}async _tryGetApplicationCredentialsFromWellKnownFile(e){let r=null;if(this._isWindows())r=process.env.APPDATA;else{let i=process.env.HOME;i&&(r=Up.join(i,".config"))}return r&&(r=Up.join(r,"gcloud","application_default_credentials.json"),fa.existsSync(r)||(r=null)),r?await this._getApplicationCredentialsFromFilePath(r,e):null}async _getApplicationCredentialsFromFilePath(e,r={}){if(!e||e.length===0)throw new Error("The file path is invalid.");try{if(e=fa.realpathSync(e),!fa.lstatSync(e).isFile())throw new Error}catch(i){throw i instanceof Error&&(i.message=`The file at ${e} does not exist, or it is not a file. ${i.message}`),i}let n=fa.createReadStream(e);return this.fromStream(n,r)}fromImpersonatedJSON(e){if(!e)throw new Error("Must pass in a JSON object containing an impersonated refresh token");if(e.type!==ni.IMPERSONATED_ACCOUNT_TYPE)throw new Error(`The incoming JSON object does not have the "${ni.IMPERSONATED_ACCOUNT_TYPE}" type`);if(!e.source_credentials)throw new Error("The incoming JSON object does not contain a source_credentials field");if(!e.service_account_impersonation_url)throw new Error("The incoming JSON object does not contain a service_account_impersonation_url field");let r=this.fromJSON(e.source_credentials);if(e.service_account_impersonation_url?.length>256)throw new RangeError(`Target principal is too long: ${e.service_account_impersonation_url}`);let n=/(?<target>[^/]+):(generateAccessToken|generateIdToken)$/.exec(e.service_account_impersonation_url)?.groups?.target;if(!n)throw new RangeError(`Cannot extract target principal from ${e.service_account_impersonation_url}`);let i=(this.scopes||e.scopes||this.defaultScopes)??[];return new ni.Impersonated({...e,sourceClient:r,targetPrincipal:n,targetScopes:Array.isArray(i)?i:[i]})}fromJSON(e,r={}){let n,i=(0,xP.originalOrCamelOptions)(r).get("universe_domain");return e.type===TP.USER_REFRESH_ACCOUNT_TYPE?(n=new TP.UserRefreshClient(r),n.fromJSON(e)):e.type===ni.IMPERSONATED_ACCOUNT_TYPE?n=this.fromImpersonatedJSON(e):e.type===ha.EXTERNAL_ACCOUNT_TYPE?(n=f$.ExternalAccountClient.fromJSON({...e,...r}),n.scopes=this.getAnyScopes()):e.type===wP.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE?n=new wP.ExternalAccountAuthorizedUserClient({...e,...r}):(r.scopes=this.scopes,n=new ri.JWT(r),this.setGapicJWTValues(n),n.fromJSON(e)),i&&(n.universeDomain=i),n}_cacheClientFromJSON(e,r){let n=this.fromJSON(e,r);return this.jsonContent=e,this.cachedCredential=n,n}fromStream(e,r={},n){let i={};if(typeof r=="function"?n=r:i=r,n)this.fromStreamAsync(e,i).then(u=>n(null,u),n);else return this.fromStreamAsync(e,i)}fromStreamAsync(e,r){return new Promise((n,i)=>{if(!e)throw new Error("Must pass in a stream containing the Google auth settings.");let u=[];e.setEncoding("utf8").on("error",i).on("data",c=>u.push(c)).on("end",()=>{try{try{let c=JSON.parse(u.join("")),l=this._cacheClientFromJSON(c,r);return n(l)}catch(c){if(!this.keyFilename)throw c;let l=new ri.JWT({...this.clientOptions,keyFile:this.keyFilename});return this.cachedCredential=l,this.setGapicJWTValues(l),n(l)}}catch(c){return i(c)}})})}fromAPIKey(e,r={}){return new ri.JWT({...r,apiKey:e})}_isWindows(){let e=u$.platform();return!!(e&&e.length>=3&&e.substring(0,3).toLowerCase()==="win")}async getDefaultServiceProjectId(){return new Promise(e=>{(0,a$.exec)("gcloud config config-helper --format json",(r,n)=>{if(!r&&n)try{let i=JSON.parse(n).configuration.properties.core.project;e(i);return}catch{}e(null)})})}getProductionProjectId(){return process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project}async getFileProjectId(){if(this.cachedCredential)return this.cachedCredential.projectId;if(this.keyFilename){let r=await this.getClient();if(r&&r.projectId)return r.projectId}let e=await this._tryGetApplicationCredentialsFromEnvironmentVariable();return e?e.projectId:null}async getExternalAccountClientProjectId(){return!this.jsonContent||this.jsonContent.type!==ha.EXTERNAL_ACCOUNT_TYPE?null:await(await this.getClient()).getProjectId()}async getGCEProjectId(){try{return await ma.project("project-id")}catch{return null}}getCredentials(e){if(e)this.getCredentialsAsync().then(r=>e(null,r),e);else return this.getCredentialsAsync()}async getCredentialsAsync(){let e=await this.getClient();if(e instanceof ni.Impersonated)return{client_email:e.getTargetPrincipal()};if(e instanceof ha.BaseExternalAccountClient){let r=e.getServiceAccountEmail();if(r)return{client_email:r,universe_domain:e.universeDomain}}if(this.jsonContent)return{client_email:this.jsonContent.client_email,private_key:this.jsonContent.private_key,universe_domain:this.jsonContent.universe_domain};if(await this._checkIsGCE()){let[r,n]=await Promise.all([ma.instance("service-accounts/default/email"),this.getUniverseDomain()]);return{client_email:r,universe_domain:n}}throw new Error(Tr.GoogleAuthExceptionMessages.NO_CREDENTIALS_FOUND)}async getClient(){if(this.cachedCredential)return this.cachedCredential;this.#e=this.#e||this.#r();try{return await this.#e}finally{this.#e=null}}async#r(){if(this.jsonContent)return this._cacheClientFromJSON(this.jsonContent,this.clientOptions);if(this.keyFilename){let e=Up.resolve(this.keyFilename),r=fa.createReadStream(e);return await this.fromStreamAsync(r,this.clientOptions)}else if(this.apiKey){let e=await this.fromAPIKey(this.apiKey,this.clientOptions);e.scopes=this.scopes;let{credential:r}=await this.#t(e);return r}else{let{credential:e}=await this.getApplicationDefaultAsync(this.clientOptions);return e}}async getIdTokenClient(e){let r=await this.getClient();if(!("fetchIdToken"in r))throw new Error("Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.");return new d$.IdTokenClient({targetAudience:e,idTokenProvider:r})}async getAccessToken(){return(await(await this.getClient()).getAccessToken()).token}async getRequestHeaders(e){return(await this.getClient()).getRequestHeaders(e)}async authorizeRequest(e={}){let r=e.url,i=await(await this.getClient()).getRequestHeaders(r);return e.headers=s$.Gaxios.mergeHeaders(e.headers,i),e}async fetch(...e){return(await this.getClient()).fetch(...e)}async request(e){return(await this.getClient()).request(e)}getEnv(){return(0,p$.getEnv)()}async sign(e,r){let n=await this.getClient(),i=await this.getUniverseDomain();if(r=r||`https://iamcredentials.${i}/v1/projects/-/serviceAccounts/`,n instanceof ni.Impersonated)return(await n.sign(e)).signedBlob;let u=(0,c$.createCrypto)();if(n instanceof ri.JWT&&n.key)return await u.sign(n.key,e);let c=await this.getCredentials();if(!c.client_email)throw new Error("Cannot sign data without `client_email`.");return this.signBlob(u,c.client_email,e,r)}async signBlob(e,r,n,i){let u=new URL(i+`${r}:signBlob`);return(await this.request({method:"POST",url:u.href,data:{payload:e.encodeBase64StringUtf8(n)},retry:!0,retryConfig:{httpMethodsToRetry:["POST"]}})).data.signedBlob}};Tr.GoogleAuth=Mp});var IP=L(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.IAMAuth=void 0;var Lp=class{static{o(this,"IAMAuth")}selector;token;constructor(e,r){this.selector=e,this.token=r,this.selector=e,this.token=r}getRequestHeaders(){return{"x-goog-iam-authority-selector":this.selector,"x-goog-iam-authorization-token":this.token}}};Mu.IAMAuth=Lp});var RP=L(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.DownscopedClient=Lr.EXPIRATION_TIME_OFFSET=Lr.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var m$=_t(),h$=require("stream"),Fp=Zt(),g$=bu(),y$="urn:ietf:params:oauth:grant-type:token-exchange",_$="urn:ietf:params:oauth:token-type:access_token",b$="urn:ietf:params:oauth:token-type:access_token";Lr.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;Lr.EXPIRATION_TIME_OFFSET=300*1e3;var Bp=class extends Fp.AuthClient{static{o(this,"DownscopedClient")}authClient;credentialAccessBoundary;cachedDownscopedAccessToken;stsCredential;constructor(e,r={accessBoundary:{accessBoundaryRules:[]}}){if(super(e instanceof Fp.AuthClient?{}:e),e instanceof Fp.AuthClient?(this.authClient=e,this.credentialAccessBoundary=r):(this.authClient=e.authClient,this.credentialAccessBoundary=e.credentialAccessBoundary),this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length===0)throw new Error("At least one access boundary rule needs to be defined.");if(this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length>Lr.MAX_ACCESS_BOUNDARY_RULES_COUNT)throw new Error(`The provided access boundary has more than ${Lr.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`);for(let n of this.credentialAccessBoundary.accessBoundary.accessBoundaryRules)if(n.availablePermissions.length===0)throw new Error("At least one permission should be defined in access boundary rules.");this.stsCredential=new g$.StsCredentials({tokenExchangeEndpoint:`https://sts.${this.universeDomain}/v1/token`}),this.cachedDownscopedAccessToken=null}setCredentials(e){if(!e.expiry_date)throw new Error("The access token expiry_date field is missing in the provided credentials.");super.setCredentials(e),this.cachedDownscopedAccessToken=e}async getAccessToken(){return(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){let e=await this.getAccessToken(),r=new Headers({authorization:`Bearer ${e.token}`});return this.addSharedMetadataHeaders(r)}request(e,r){if(r)this.requestAsync(e).then(n=>r(null,n),n=>r(n,n.response));else return this.requestAsync(e)}async requestAsync(e,r=!1){let n;try{let i=await this.getRequestHeaders();e.headers=m$.Gaxios.mergeHeaders(e.headers),this.addUserProjectAndAuthHeaders(e.headers,i),n=await this.transporter.request(e)}catch(i){let u=i.response;if(u){let c=u.status,l=u.config.data instanceof h$.Readable;if(!r&&(c===401||c===403)&&!l&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(e,!0)}throw i}return n}async refreshAccessTokenAsync(){let e=(await this.authClient.getAccessToken()).token,r={grantType:y$,requestedTokenType:_$,subjectToken:e,subjectTokenType:b$},n=await this.stsCredential.exchangeToken(r,void 0,this.credentialAccessBoundary),i=this.authClient.credentials?.expiry_date||null,u=n.expires_in?new Date().getTime()+n.expires_in*1e3:i;return this.cachedDownscopedAccessToken={access_token:n.access_token,expiry_date:u,res:n.res},this.credentials={},Object.assign(this.credentials,this.cachedDownscopedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedDownscopedAccessToken}isExpired(e){let r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:!1}};Lr.DownscopedClient=Bp});var CP=L(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.PassThroughClient=void 0;var v$=Zt(),qp=class extends v$.AuthClient{static{o(this,"PassThroughClient")}async request(e){return this.transporter.request(e)}async getAccessToken(){return{}}async getRequestHeaders(){return new Headers}};Lu.PassThroughClient=qp});var NP=L(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.GoogleAuth=ee.auth=ee.PassThroughClient=ee.ExternalAccountAuthorizedUserClient=ee.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=ee.ExecutableError=ee.PluggableAuthClient=ee.DownscopedClient=ee.BaseExternalAccountClient=ee.ExternalAccountClient=ee.IdentityPoolClient=ee.AwsRequestSigner=ee.AwsClient=ee.UserRefreshClient=ee.LoginTicket=ee.ClientAuthentication=ee.OAuth2Client=ee.CodeChallengeMethod=ee.Impersonated=ee.JWT=ee.JWTAccess=ee.IdTokenClient=ee.IAMAuth=ee.GCPEnv=ee.Compute=ee.DEFAULT_UNIVERSE=ee.AuthClient=ee.gaxios=ee.gcpMetadata=void 0;var OP=AP();Object.defineProperty(ee,"GoogleAuth",{enumerable:!0,get:o(function(){return OP.GoogleAuth},"get")});ee.gcpMetadata=Xi();ee.gaxios=_t();var kP=Zt();Object.defineProperty(ee,"AuthClient",{enumerable:!0,get:o(function(){return kP.AuthClient},"get")});Object.defineProperty(ee,"DEFAULT_UNIVERSE",{enumerable:!0,get:o(function(){return kP.DEFAULT_UNIVERSE},"get")});var E$=Cd();Object.defineProperty(ee,"Compute",{enumerable:!0,get:o(function(){return E$.Compute},"get")});var P$=$d();Object.defineProperty(ee,"GCPEnv",{enumerable:!0,get:o(function(){return P$.GCPEnv},"get")});var S$=IP();Object.defineProperty(ee,"IAMAuth",{enumerable:!0,get:o(function(){return S$.IAMAuth},"get")});var T$=kd();Object.defineProperty(ee,"IdTokenClient",{enumerable:!0,get:o(function(){return T$.IdTokenClient},"get")});var w$=Kd();Object.defineProperty(ee,"JWTAccess",{enumerable:!0,get:o(function(){return w$.JWTAccess},"get")});var x$=Yd();Object.defineProperty(ee,"JWT",{enumerable:!0,get:o(function(){return x$.JWT},"get")});var A$=rp();Object.defineProperty(ee,"Impersonated",{enumerable:!0,get:o(function(){return A$.Impersonated},"get")});var Vp=eo();Object.defineProperty(ee,"CodeChallengeMethod",{enumerable:!0,get:o(function(){return Vp.CodeChallengeMethod},"get")});Object.defineProperty(ee,"OAuth2Client",{enumerable:!0,get:o(function(){return Vp.OAuth2Client},"get")});Object.defineProperty(ee,"ClientAuthentication",{enumerable:!0,get:o(function(){return Vp.ClientAuthentication},"get")});var I$=xd();Object.defineProperty(ee,"LoginTicket",{enumerable:!0,get:o(function(){return I$.LoginTicket},"get")});var R$=ep();Object.defineProperty(ee,"UserRefreshClient",{enumerable:!0,get:o(function(){return R$.UserRefreshClient},"get")});var C$=Ep();Object.defineProperty(ee,"AwsClient",{enumerable:!0,get:o(function(){return C$.AwsClient},"get")});var O$=_p();Object.defineProperty(ee,"AwsRequestSigner",{enumerable:!0,get:o(function(){return O$.AwsRequestSigner},"get")});var k$=gp();Object.defineProperty(ee,"IdentityPoolClient",{enumerable:!0,get:o(function(){return k$.IdentityPoolClient},"get")});var $$=$p();Object.defineProperty(ee,"ExternalAccountClient",{enumerable:!0,get:o(function(){return $$.ExternalAccountClient},"get")});var z$=$n();Object.defineProperty(ee,"BaseExternalAccountClient",{enumerable:!0,get:o(function(){return z$.BaseExternalAccountClient},"get")});var N$=RP();Object.defineProperty(ee,"DownscopedClient",{enumerable:!0,get:o(function(){return N$.DownscopedClient},"get")});var $P=Op();Object.defineProperty(ee,"PluggableAuthClient",{enumerable:!0,get:o(function(){return $P.PluggableAuthClient},"get")});Object.defineProperty(ee,"ExecutableError",{enumerable:!0,get:o(function(){return $P.ExecutableError},"get")});var zP=Dp();Object.defineProperty(ee,"EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE",{enumerable:!0,get:o(function(){return zP.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE},"get")});Object.defineProperty(ee,"ExternalAccountAuthorizedUserClient",{enumerable:!0,get:o(function(){return zP.ExternalAccountAuthorizedUserClient},"get")});var D$=CP();Object.defineProperty(ee,"PassThroughClient",{enumerable:!0,get:o(function(){return D$.PassThroughClient},"get")});var U$=new OP.GoogleAuth;ee.auth=U$});var H$={};qa(H$,{bigQueryAuth:()=>ke,googleBigQuery:()=>V$});module.exports=UT(H$);var jT=Object.freeze({status:"aborted"});function X(t,e,r){function n(l,p){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:p,constr:c,traits:new Set},enumerable:!1}),l._zod.traits.has(t))return;l._zod.traits.add(t),e(l,p);let f=c.prototype,m=Object.keys(f);for(let y=0;y<m.length;y++){let P=m[y];P in l||(l[P]=f[P].bind(l))}}o(n,"init");let i=r?.Parent??Object;class u extends i{static{o(this,"Definition")}}Object.defineProperty(u,"name",{value:t});function c(l){var p;let f=r?.Parent?new u:this;n(f,l),(p=f._zod).deferred??(p.deferred=[]);for(let m of f._zod.deferred)m();return f}return o(c,"_"),Object.defineProperty(c,"init",{value:n}),Object.defineProperty(c,Symbol.hasInstance,{value:o(l=>r?.Parent&&l instanceof r.Parent?!0:l?._zod?.traits?.has(t),"value")}),Object.defineProperty(c,"name",{value:t}),c}o(X,"$constructor");var Ar=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Va=class extends Error{static{o(this,"$ZodEncodeError")}constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},bc={};function Zr(t){return t&&Object.assign(bc,t),bc}o(Zr,"config");function Ec(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}o(Ec,"getEnumValues");function Xf(t,e){return typeof e=="bigint"?e.toString():e}o(Xf,"jsonStringifyReplacer");function Ga(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}o(Ga,"cached");function em(t){return t==null}o(em,"nullish");function Wa(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}o(Wa,"cleanRegex");var Yf=Symbol("evaluating");function tt(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Yf)return n===void 0&&(n=Yf,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}o(tt,"defineLazy");var Pc="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function gi(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}o(gi,"isObject");var MT=Ga(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function tm(t){if(gi(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(gi(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}o(tm,"isPlainObject");var rm=new Set(["string","number","symbol"]);function _o(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(_o,"escapeRegex");function Za(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}o(Za,"clone");function Ze(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:o(()=>e,"error")};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:o(()=>e.error,"error")}:e}o(Ze,"normalizeParams");function nm(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}o(nm,"optionalKeys");var om={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function bo(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}o(bo,"aborted");function hn(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}o(hn,"prefixIssues");function Ha(t){return typeof t=="string"?t:t?.message}o(Ha,"unwrapMessage");function gn(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=Ha(t.inst?._zod.def?.error?.(t))??Ha(e?.error?.(t))??Ha(r.customError?.(t))??Ha(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}o(gn,"finalizeIssue");function im(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}o(im,"getLengthableOrigin");function Sc(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}o(Sc,"issue");var am=o((t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Xf,2),Object.defineProperty(t,"toString",{value:o(()=>t.message,"value"),enumerable:!1})},"initializer"),sm=X("$ZodError",am),yi=X("$ZodError",am,{Parent:Error});var FT=o(t=>(e,r,n,i)=>{let u=n?Object.assign(n,{async:!1}):{async:!1},c=e._zod.run({value:r,issues:[]},u);if(c instanceof Promise)throw new Ar;if(c.issues.length){let l=new(i?.Err??t)(c.issues.map(p=>gn(p,u,Zr())));throw Pc(l,i?.callee),l}return c.value},"_parse"),Ja=FT(yi),BT=o(t=>async(e,r,n,i)=>{let u=n?Object.assign(n,{async:!0}):{async:!0},c=e._zod.run({value:r,issues:[]},u);if(c instanceof Promise&&(c=await c),c.issues.length){let l=new(i?.Err??t)(c.issues.map(p=>gn(p,u,Zr())));throw Pc(l,i?.callee),l}return c.value},"_parseAsync"),Ka=BT(yi),qT=o(t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},u=e._zod.run({value:r,issues:[]},i);if(u instanceof Promise)throw new Ar;return u.issues.length?{success:!1,error:new(t??sm)(u.issues.map(c=>gn(c,i,Zr())))}:{success:!0,data:u.value}},"_safeParse"),_i=qT(yi),VT=o(t=>async(e,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},u=e._zod.run({value:r,issues:[]},i);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new t(u.issues.map(c=>gn(c,i,Zr())))}:{success:!0,data:u.value}},"_safeParseAsync"),bi=VT(yi);var HT="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",GT=new RegExp(`^${HT}$`);var um=o(t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},"string"),cm=/^-?\d+n?$/,lm=/^-?\d+$/,Tc=/^-?\d+(?:\.\d+)?$/,dm=/^(?:true|false)$/i;var yn=X("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),WT={number:"number",bigint:"bigint",object:"date"};var pm=X("$ZodCheckGreaterThan",(t,e)=>{yn.init(t,e);let r=WT[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,u=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>u&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}});var fm=X("$ZodCheckNumberFormat",(t,e)=>{yn.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,u]=om[e.format];t._zod.onattach.push(c=>{let l=c._zod.bag;l.format=e.format,l.minimum=i,l.maximum=u,r&&(l.pattern=lm)}),t._zod.check=c=>{let l=c.value;if(r){if(!Number.isInteger(l)){c.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:l,inst:t});return}if(!Number.isSafeInteger(l)){l>0?c.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):c.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}l<i&&c.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),l>u&&c.issues.push({origin:"number",input:l,code:"too_big",maximum:u,inclusive:!0,inst:t,continue:!e.abort})}});var mm=X("$ZodCheckMinLength",(t,e)=>{var r;yn.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!em(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let c=im(i);n.issues.push({origin:c,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}});var wc=X("$ZodCheckStringFormat",(t,e)=>{var r,n;yn.init(t,e),t._zod.onattach.push(i=>{let u=i._zod.bag;u.format=e.format,e.pattern&&(u.patterns??(u.patterns=new Set),u.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),hm=X("$ZodCheckRegex",(t,e)=>{wc.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}});var ym={major:4,minor:3,patch:6};var Ye=X("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=ym;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let i of n)for(let u of i._zod.onattach)u(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let i=o((c,l,p)=>{let f=bo(c),m;for(let y of l){if(y._zod.def.when){if(!y._zod.def.when(c))continue}else if(f)continue;let P=c.issues.length,h=y._zod.check(c);if(h instanceof Promise&&p?.async===!1)throw new Ar;if(m||h instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await h,c.issues.length!==P&&(f||(f=bo(c,P)))});else{if(c.issues.length===P)continue;f||(f=bo(c,P))}}return m?m.then(()=>c):c},"runChecks"),u=o((c,l,p)=>{if(bo(c))return c.aborted=!0,c;let f=i(l,n,p);if(f instanceof Promise){if(p.async===!1)throw new Ar;return f.then(m=>t._zod.parse(m,p))}return t._zod.parse(f,p)},"handleCanaryResult");t._zod.run=(c,l)=>{if(l.skipChecks)return t._zod.parse(c,l);if(l.direction==="backward"){let f=t._zod.parse({value:c.value,issues:[]},{...l,skipChecks:!0});return f instanceof Promise?f.then(m=>u(m,c,l)):u(f,c,l)}let p=t._zod.parse(c,l);if(p instanceof Promise){if(l.async===!1)throw new Ar;return p.then(f=>i(f,n,l))}return i(p,n,l)}}tt(t,"~standard",()=>({validate:o(i=>{try{let u=_i(t,i);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return bi(t,i).then(c=>c.success?{value:c.data}:{issues:c.error?.issues})}},"validate"),vendor:"zod",version:1}))}),Xa=X("$ZodString",(t,e)=>{Ye.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??um(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),xc=X("$ZodStringFormat",(t,e)=>{wc.init(t,e),Xa.init(t,e)});var Pm=X("$ZodURL",(t,e)=>{xc.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}});var Ac=X("$ZodNumber",(t,e)=>{Ye.init(t,e),t._zod.pattern=t._zod.bag.pattern??Tc,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let u=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...u?{received:u}:{}}),r}}),Sm=X("$ZodNumberFormat",(t,e)=>{fm.init(t,e),Ac.init(t,e)}),Ic=X("$ZodBoolean",(t,e)=>{Ye.init(t,e),t._zod.pattern=dm,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}}),Tm=X("$ZodBigInt",(t,e)=>{Ye.init(t,e),t._zod.pattern=cm,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}});var wm=X("$ZodAny",(t,e)=>{Ye.init(t,e),t._zod.parse=r=>r}),xm=X("$ZodUnknown",(t,e)=>{Ye.init(t,e),t._zod.parse=r=>r});var Am=X("$ZodVoid",(t,e)=>{Ye.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:t}),r}}),Im=X("$ZodDate",(t,e)=>{Ye.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,u=i instanceof Date;return u&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...u?{received:"Invalid Date"}:{},inst:t}),r}});function _m(t,e,r){t.issues.length&&e.issues.push(...hn(r,t.issues)),e.value[r]=t.value}o(_m,"handleArrayResult");var Rm=X("$ZodArray",(t,e)=>{Ye.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),r;r.value=Array(i.length);let u=[];for(let c=0;c<i.length;c++){let l=i[c],p=e.element._zod.run({value:l,issues:[]},n);p instanceof Promise?u.push(p.then(f=>_m(f,r,c))):_m(p,r,c)}return u.length?Promise.all(u).then(()=>r):r}});function Ya(t,e,r,n,i){if(t.issues.length){if(i&&!(r in n))return;e.issues.push(...hn(r,t.issues))}t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}o(Ya,"handlePropertyResult");function ZT(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=nm(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}o(ZT,"normalizeDef");function JT(t,e,r,n,i,u){let c=[],l=i.keySet,p=i.catchall._zod,f=p.def.type,m=p.optout==="optional";for(let y in e){if(l.has(y))continue;if(f==="never"){c.push(y);continue}let P=p.run({value:e[y],issues:[]},n);P instanceof Promise?t.push(P.then(h=>Ya(h,r,y,e,m))):Ya(P,r,y,e,m)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:e,inst:u}),t.length?Promise.all(t).then(()=>r):r}o(JT,"handleCatchall");var Cm=X("$ZodObject",(t,e)=>{if(Ye.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let l=e.shape;Object.defineProperty(e,"shape",{get:o(()=>{let p={...l};return Object.defineProperty(e,"shape",{value:p}),p},"get")})}let n=Ga(()=>ZT(e));tt(t._zod,"propValues",()=>{let l=e.shape,p={};for(let f in l){let m=l[f]._zod;if(m.values){p[f]??(p[f]=new Set);for(let y of m.values)p[f].add(y)}}return p});let i=gi,u=e.catchall,c;t._zod.parse=(l,p)=>{c??(c=n.value);let f=l.value;if(!i(f))return l.issues.push({expected:"object",code:"invalid_type",input:f,inst:t}),l;l.value={};let m=[],y=c.shape;for(let P of c.keys){let h=y[P],b=h._zod.optout==="optional",T=h._zod.run({value:f[P],issues:[]},p);T instanceof Promise?m.push(T.then(E=>Ya(E,l,P,f,b))):Ya(T,l,P,f,b)}return u?JT(m,f,l,p,n.value,t):m.length?Promise.all(m).then(()=>l):l}});function bm(t,e,r,n){for(let u of t)if(u.issues.length===0)return e.value=u.value,e;let i=t.filter(u=>!bo(u));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(u=>u.issues.map(c=>gn(c,n,Zr())))}),e)}o(bm,"handleUnionResults");var Rc=X("$ZodUnion",(t,e)=>{Ye.init(t,e),tt(t._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),tt(t._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),tt(t._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),tt(t._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){let i=e.options.map(u=>u._zod.pattern);return new RegExp(`^(${i.map(u=>Wa(u.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(i,u)=>{if(r)return n(i,u);let c=!1,l=[];for(let p of e.options){let f=p._zod.run({value:i.value,issues:[]},u);if(f instanceof Promise)l.push(f),c=!0;else{if(f.issues.length===0)return f;l.push(f)}}return c?Promise.all(l).then(p=>bm(p,i,t,u)):bm(l,i,t,u)}});var Om=X("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Rc.init(t,e);let r=t._zod.parse;tt(t._zod,"propValues",()=>{let i={};for(let u of e.options){let c=u._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(u)}"`);for(let[l,p]of Object.entries(c)){i[l]||(i[l]=new Set);for(let f of p)i[l].add(f)}}return i});let n=Ga(()=>{let i=e.options,u=new Map;for(let c of i){let l=c._zod.propValues?.[e.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(c)}"`);for(let p of l){if(u.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);u.set(p,c)}}return u});t._zod.parse=(i,u)=>{let c=i.value;if(!gi(c))return i.issues.push({code:"invalid_type",expected:"object",input:c,inst:t}),i;let l=n.value.get(c?.[e.discriminator]);return l?l._zod.run(i,u):e.unionFallback?r(i,u):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:c,path:[e.discriminator],inst:t}),i)}});var km=X("$ZodRecord",(t,e)=>{Ye.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!tm(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),r;let u=[],c=e.keyType._zod.values;if(c){r.value={};let l=new Set;for(let f of c)if(typeof f=="string"||typeof f=="number"||typeof f=="symbol"){l.add(typeof f=="number"?f.toString():f);let m=e.valueType._zod.run({value:i[f],issues:[]},n);m instanceof Promise?u.push(m.then(y=>{y.issues.length&&r.issues.push(...hn(f,y.issues)),r.value[f]=y.value})):(m.issues.length&&r.issues.push(...hn(f,m.issues)),r.value[f]=m.value)}let p;for(let f in i)l.has(f)||(p=p??[],p.push(f));p&&p.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:p})}else{r.value={};for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;let p=e.keyType._zod.run({value:l,issues:[]},n);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Tc.test(l)&&p.issues.length){let y=e.keyType._zod.run({value:Number(l),issues:[]},n);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");y.issues.length===0&&(p=y)}if(p.issues.length){e.mode==="loose"?r.value[l]=i[l]:r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(y=>gn(y,n,Zr())),input:l,path:[l],inst:t});continue}let m=e.valueType._zod.run({value:i[l],issues:[]},n);m instanceof Promise?u.push(m.then(y=>{y.issues.length&&r.issues.push(...hn(l,y.issues)),r.value[p.value]=y.value})):(m.issues.length&&r.issues.push(...hn(l,m.issues)),r.value[p.value]=m.value)}}return u.length?Promise.all(u).then(()=>r):r}});var $m=X("$ZodEnum",(t,e)=>{Ye.init(t,e);let r=Ec(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>rm.has(typeof i)).map(i=>typeof i=="string"?_o(i):i.toString()).join("|")})$`),t._zod.parse=(i,u)=>{let c=i.value;return n.has(c)||i.issues.push({code:"invalid_value",values:r,input:c,inst:t}),i}}),zm=X("$ZodLiteral",(t,e)=>{if(Ye.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?_o(n):n?_o(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,i)=>{let u=n.value;return r.has(u)||n.issues.push({code:"invalid_value",values:e.values,input:u,inst:t}),n}});var Nm=X("$ZodTransform",(t,e)=>{Ye.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Va(t.constructor.name);let i=e.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(c=>(r.value=c,r));if(i instanceof Promise)throw new Ar;return r.value=i,r}});function vm(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}o(vm,"handleOptionalResult");var Dm=X("$ZodOptional",(t,e)=>{Ye.init(t,e),t._zod.optin="optional",t._zod.optout="optional",tt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),tt(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Wa(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(u=>vm(u,r.value)):vm(i,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}});var Um=X("$ZodNullable",(t,e)=>{Ye.init(t,e),tt(t._zod,"optin",()=>e.innerType._zod.optin),tt(t._zod,"optout",()=>e.innerType._zod.optout),tt(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Wa(r.source)}|null)$`):void 0}),tt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)});var jm=X("$ZodPipe",(t,e)=>{Ye.init(t,e),tt(t._zod,"values",()=>e.in._zod.values),tt(t._zod,"optin",()=>e.in._zod.optin),tt(t._zod,"optout",()=>e.out._zod.optout),tt(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let u=e.out._zod.run(r,n);return u instanceof Promise?u.then(c=>Qa(c,e.in,n)):Qa(u,e.in,n)}let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(u=>Qa(u,e.out,n)):Qa(i,e.out,n)}});function Qa(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}o(Qa,"handlePipeResult");var Mm=X("$ZodCustom",(t,e)=>{yn.init(t,e),Ye.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(u=>Em(u,r,n,t));Em(i,r,n,t)}});function Em(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(Sc(i))}}o(Em,"handleRefineResult");var Fm;var Cc=class{static{o(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Bm(){return new Cc}o(Bm,"registry");(Fm=globalThis).__zod_globalRegistry??(Fm.__zod_globalRegistry=Bm());var Oc=globalThis.__zod_globalRegistry;function qm(t,e){return new t({type:"string",...Ze(e)})}o(qm,"_string");function Vm(t,e){return new t({type:"string",coerce:!0,...Ze(e)})}o(Vm,"_coercedString");function Hm(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Ze(e)})}o(Hm,"_url");function Gm(t,e){return new t({type:"number",checks:[],...Ze(e)})}o(Gm,"_number");function Wm(t,e){return new t({type:"number",coerce:!0,checks:[],...Ze(e)})}o(Wm,"_coercedNumber");function Zm(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Ze(e)})}o(Zm,"_int");function Jm(t,e){return new t({type:"boolean",...Ze(e)})}o(Jm,"_boolean");function Km(t,e){return new t({type:"boolean",coerce:!0,...Ze(e)})}o(Km,"_coercedBoolean");function Qm(t,e){return new t({type:"bigint",coerce:!0,...Ze(e)})}o(Qm,"_coercedBigint");function Ym(t){return new t({type:"any"})}o(Ym,"_any");function Xm(t){return new t({type:"unknown"})}o(Xm,"_unknown");function eh(t,e){return new t({type:"void",...Ze(e)})}o(eh,"_void");function th(t,e){return new t({type:"date",coerce:!0,...Ze(e)})}o(th,"_coercedDate");function es(t,e){return new pm({check:"greater_than",...Ze(e),value:t,inclusive:!0})}o(es,"_gte");function fr(t,e){return new mm({check:"min_length",...Ze(e),minimum:t})}o(fr,"_minLength");function _n(t,e){return new hm({check:"string_format",format:"regex",...Ze(e),pattern:t})}o(_n,"_regex");function rh(t,e,r){let n=Ze(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}o(rh,"_custom");var rt=X("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");Ye.init(t,e),t.def=e,t.type=e.type,t.parse=(r,n)=>Ja(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>_i(t,r,n),t.parseAsync=async(r,n)=>Ka(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>bi(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),t.with=t.check,t.clone=(r,n)=>Za(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.apply=r=>r(t)}),rs=X("ZodMiniString",(t,e)=>{Xa.init(t,e),rt.init(t,e)});function g(t){return qm(rs,t)}o(g,"string");var nh=X("ZodMiniStringFormat",(t,e)=>{xc.init(t,e),rs.init(t,e)});var uw=X("ZodMiniURL",(t,e)=>{Pm.init(t,e),nh.init(t,e)});function oh(t){return Hm(uw,t)}o(oh,"url");var ns=X("ZodMiniNumber",(t,e)=>{Ac.init(t,e),rt.init(t,e)});function lt(t){return Gm(ns,t)}o(lt,"number");var cw=X("ZodMiniNumberFormat",(t,e)=>{Sm.init(t,e),ns.init(t,e)});function ih(t){return Zm(cw,t)}o(ih,"int");var kc=X("ZodMiniBoolean",(t,e)=>{Ic.init(t,e),rt.init(t,e)});function Ce(t){return Jm(kc,t)}o(Ce,"boolean");var ah=X("ZodMiniBigInt",(t,e)=>{Tm.init(t,e),rt.init(t,e)});var lw=X("ZodMiniAny",(t,e)=>{wm.init(t,e),rt.init(t,e)});function Ei(){return Ym(lw)}o(Ei,"any");var dw=X("ZodMiniUnknown",(t,e)=>{xm.init(t,e),rt.init(t,e)});function he(){return Xm(dw)}o(he,"unknown");var pw=X("ZodMiniVoid",(t,e)=>{Am.init(t,e),rt.init(t,e)});function sh(t){return eh(pw,t)}o(sh,"_void");var uh=X("ZodMiniDate",(t,e)=>{Im.init(t,e),rt.init(t,e)});var fw=X("ZodMiniArray",(t,e)=>{Rm.init(t,e),rt.init(t,e)});function de(t,e){return new fw({type:"array",element:t,...Ze(e)})}o(de,"array");var mw=X("ZodMiniObject",(t,e)=>{Cm.init(t,e),rt.init(t,e),tt(t,"shape",()=>e.shape)});function C(t,e){let r={type:"object",shape:t??{},...Ze(e)};return new mw(r)}o(C,"object");var hw=X("ZodMiniUnion",(t,e)=>{Rc.init(t,e),rt.init(t,e)});function be(t,e){return new hw({type:"union",options:t,...Ze(e)})}o(be,"union");var gw=X("ZodMiniDiscriminatedUnion",(t,e)=>{Om.init(t,e),rt.init(t,e)});function bn(t,e,r){return new gw({type:"union",options:e,discriminator:t,...Ze(r)})}o(bn,"discriminatedUnion");var yw=X("ZodMiniRecord",(t,e)=>{km.init(t,e),rt.init(t,e)});function ge(t,e,r){return new yw({type:"record",keyType:t,valueType:e,...Ze(r)})}o(ge,"record");var _w=X("ZodMiniEnum",(t,e)=>{$m.init(t,e),rt.init(t,e),t.options=Object.values(e.entries)});function ue(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new _w({type:"enum",entries:r,...Ze(e)})}o(ue,"_enum");var bw=X("ZodMiniLiteral",(t,e)=>{zm.init(t,e),rt.init(t,e)});function ie(t,e){return new bw({type:"literal",values:Array.isArray(t)?t:[t],...Ze(e)})}o(ie,"literal");var vw=X("ZodMiniTransform",(t,e)=>{Nm.init(t,e),rt.init(t,e)});function vn(t){return new vw({type:"transform",transform:t})}o(vn,"transform");var Ew=X("ZodMiniOptional",(t,e)=>{Dm.init(t,e),rt.init(t,e)});function M(t){return new Ew({type:"optional",innerType:t})}o(M,"optional");var Pw=X("ZodMiniNullable",(t,e)=>{Um.init(t,e),rt.init(t,e)});function Pi(t){return new Pw({type:"nullable",innerType:t})}o(Pi,"nullable");var Sw=X("ZodMiniPipe",(t,e)=>{jm.init(t,e),rt.init(t,e)});function En(t,e){return new Sw({type:"pipe",in:t,out:e})}o(En,"pipe");var Tw=X("ZodMiniCustom",(t,e)=>{Mm.init(t,e),rt.init(t,e)});function os(t,e){return rh(Tw,t??(()=>!0),e)}o(os,"custom");var Si={};qa(Si,{bigint:()=>Cw,boolean:()=>Rw,date:()=>Ow,number:()=>Iw,string:()=>Aw});function Aw(t){return Vm(rs,t)}o(Aw,"string");function Iw(t){return Wm(ns,t)}o(Iw,"number");function Rw(t){return Km(kc,t)}o(Rw,"boolean");function Cw(t){return Qm(ah,t)}o(Cw,"bigint");function Ow(t){return th(uh,t)}o(Ow,"date");var zc=C({retryOnFailure:C({defaultValue:M(Ce()),hide:M(Ce())}),continueOnFailure:C({defaultValue:M(Ce()),hide:M(Ce())})}),$c=class{constructor(e,r,n,i,u,c,l,p,f,m,y,P,h){this.name=e;this.displayName=r;this.description=n;this.props=i;this.propertyGroups=u;this.run=c;this.test=l;this.requireAuth=p;this.errorHandlingOptions=f;this.outputSchema=m;this.audience=y;this.aiMetadata=P;this.classification=h}static{o(this,"IAction")}},nt=o(t=>new $c(t.name,t.displayName,t.description,t.props,t.propertyGroups,t.run,t.test??t.run,t.requireAuth??!0,t.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},t.outputSchema,t.audience,t.aiMetadata,t.classification),"createAction");var xe=C({displayName:g(),description:M(g()),advanced:M(Ce()),width:M(ue(["half","full"])),icon:M(g()),placeholder:M(g())}),ye=o((t,e)=>C({type:ie(e),required:Ce(),defaultValue:M(Ei())}),"TPropertyValue");var Lt=C({...xe.shape,...ye(g(),"SHORT_TEXT").shape}),Jr=C({...xe.shape,...ye(g(),"LONG_TEXT").shape});var lh=C({label:g(),value:he(),description:M(g()),icon:M(g())}),is=C({disabled:M(Ce()),placeholder:M(g()),options:de(lh)});var $w=ue(["cards"]),Ft=C({...xe.shape,options:is,display:M($w),...ye(he(),"STATIC_DROPDOWN").shape}),Kr=C({...xe.shape,options:is,...ye(de(he()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var Nc=C({...xe.shape,...ye(he(),"DROPDOWN").shape,refreshers:de(g())}),Ti=C({...xe.shape,...ye(de(he()),"MULTI_SELECT_DROPDOWN").shape,refreshers:de(g())});var Qr=C({...xe.shape,reveals:M(de(g())),...ye(Ce(),"CHECKBOX").shape});var Yr=C({...xe.shape,display:M(ue(["stepper"])),min:M(lt()),max:M(lt()),step:M(lt()),...ye(lt(),"NUMBER").shape});var wi=C({...xe.shape,streaming:M(Ce()),...ye(he(),"FILE").shape});var xi=C({...xe.shape,...ye(g(),"DATE_TIME").shape});var dh=ge(g(),be([Lt,Jr,Ft,Ti,Kr,Qr,Yr,wi,xi])),Ai=C({...xe.shape,properties:dh,...ye(de(he()),"ARRAY").shape});var ph=ue(["any_time","last_24_hours","last_7_days","last_30_days","last_90_days","this_month","custom"]),fh=C({preset:M(ph),after:M(g()),before:M(g())}),Dc=C({...xe.shape,display:M(ue(["dropdown"])),...ye(fh,"DATE_RANGE").shape});var Ii=C({...xe.shape,...ye(be([ge(g(),he())]),"JSON").shape});var mh=be([Lt,Ft,Ii,Ai,Kr]),zw=ge(g(),mh),Uc=C({refreshers:de(g()),...xe.shape,...ye(he(),"DYNAMIC").shape});var as=C({...xe.shape,...ye(sh(),"MARKDOWN").shape});var Ri=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(Ri||{}),vo=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(vo||{}),Eo=(w=>(w.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",w.COMMUNICATION="COMMUNICATION",w.COMMERCE="COMMERCE",w.CORE="CORE",w.UNIVERSAL_AI="UNIVERSAL_AI",w.FLOW_CONTROL="FLOW_CONTROL",w.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",w.ACCOUNTING="ACCOUNTING",w.PRODUCTIVITY="PRODUCTIVITY",w.CONTENT_AND_FILES="CONTENT_AND_FILES",w.DEVELOPER_TOOLS="DEVELOPER_TOOLS",w.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",w.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",w.HUMAN_RESOURCES="HUMAN_RESOURCES",w.PAYMENT_PROCESSING="PAYMENT_PROCESSING",w.MARKETING="MARKETING",w.SALES_AND_CRM="SALES_AND_CRM",w))(Eo||{});var Ci=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(Ci||{}),jc="both_client_credentials_and_authorization_code";var mr=(i=>(i.POLLING="POLLING",i.WEBHOOK="WEBHOOK",i.APP_WEBHOOK="APP_WEBHOOK",i.MANUAL="MANUAL",i))(mr||{}),Oi=(u=>(u.NONE="NONE",u.HEADER_PRESENT="HEADER_PRESENT",u.QUERY_PRESENT="QUERY_PRESENT",u.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",u.HEAD_REQUEST="HEAD_REQUEST",u))(Oi||{}),Nw=C({strategy:ue(Oi),paramName:M(g())}),ki=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(ki||{});var ss=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(ss||{}),hh=C({status:M(lt()),body:M(he()),headers:M(ge(g(),g()))}),gh=C({type:ie("DELAY"),resumeDateTime:g(),requestIdToReply:M(g()),handlerId:M(g()),streamStepProgress:M(ue(ss))}),yh=C({type:ie("WEBHOOK"),requestId:g(),requestIdToReply:M(g()),response:hh,handlerId:M(g()),streamStepProgress:M(ue(ss))}),Dw=be([gh,yh]);var Uw=C({body:he(),rawBody:M(he()),headers:ge(g(),g()),queryParams:ge(g(),g())});function et(t){return t==null}o(et,"isNil");function $i(t){return t==null?!0:typeof t=="string"||Array.isArray(t)?t.length===0:typeof t=="object"?Object.keys(t).length===0:!1}o($i,"isEmpty");function us(t,e){if(t==null)throw new Error(`${e} is null or undefined`)}o(us,"assertNotNullOrUndefined");var Mc=yt(require("crypto"),1);var jw=128,Pn,Po,Mw=o(t=>{if(t<0)throw new RangeError("Wrong ID size");try{!Pn||Pn.length<t?(Pn=Buffer.allocUnsafe(t*jw),Mc.default.randomFillSync(Pn),Po=0):Po+t>Pn.length&&(Mc.default.randomFillSync(Pn),Po=0)}catch(e){throw Pn=void 0,e}Po+=t},"fillPool"),Lw=o(t=>(Mw(t|=0),Pn.subarray(Po-t,Po)),"random"),Fw=o((t,e,r)=>{let n=(2<<31-Math.clz32(t.length-1|1))-1,i=Math.ceil(1.6*n*e/t.length);return(u=e)=>{if(u<=0)return"";let c="";for(;;){let l=r(i),p=i;for(;p--;)if(c+=t[l[p]&n]||"",c.length===u)return c}}},"customRandom"),bh=o((t,e=21)=>Fw(t,e,Lw),"customAlphabet");var Bw="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",vh=21,RB=g().check(_n(new RegExp(`^[0-9a-zA-Z]{${vh}}$`))),qw=bh(Bw,vh);var Sn=En(vn(t=>t instanceof Date?t.toISOString():t),g()),tr={id:g(),created:Sn,updated:Sn},Qe=o(t=>M(Pi(t)),"Nullable");function Lc(t){return M(Pi(ue(t)))}o(Lc,"NullableEnum");var kB=En(vn(t=>t==="true"||t===!0?!0:t==="false"||t===!1?!1:void 0),M(Ce())),cs=o(t=>En(vn(e=>Array.isArray(e)?e:e!==void 0?[e]:void 0),M(de(t))),"OptionalArrayFromQuery");var NB=ge(g(),he());var zi=(m=>(m.OPENAI="openai",m.OPENROUTER="openrouter",m.ANTHROPIC="anthropic",m.AZURE="azure",m.GOOGLE="google",m.ACTIVEPIECES="activepieces",m.CLOUDFLARE_GATEWAY="cloudflare-gateway",m.CUSTOM="custom",m.BEDROCK="bedrock",m.MISTRAL="mistral",m))(zi||{});var WB=g().check(_n(/^#[0-9A-Fa-f]{6}$/));var JB=C({filename:g(),data:he(),type:ie("file"),mimetype:M(g())});var Vw=yt(Ph());var r4=C({...tr,name:g(),permissions:de(g()),platformId:Qe(g()),type:g(),userCount:M(lt())});var Sh=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(Sh||{}),Fc=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Fc||{}),Bc=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(Bc||{});var qc=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(qc||{});var Vc=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Vc||{});var Hw=C({mode:ue(Sh),value:he()}),Gw=C({auth:M(g()),fields:ge(g(),Hw)}),Ww=C({pieceName:g(),pieceVersion:g(),actionName:g(),predefinedInput:M(Gw)}),Zw=C({type:ie("PIECE"),toolName:g().check(fr(1)),pieceMetadata:Ww}),Jw=C({type:ie("none")}),Kw=C({type:ie("access_token"),accessToken:g()}),Qw=C({type:ie("api_key"),apiKey:g(),apiKeyHeader:g()}),Yw=C({type:ie("headers"),headers:ge(g(),g())}),Xw=bn("type",[Jw,Kw,Qw,Yw]),Th=C({type:ie("FLOW"),toolName:g().check(fr(1)),externalFlowId:g(),flowDisplayName:M(g())}),wh=C({type:ie("MCP"),toolName:g().check(fr(1)),serverUrl:oh(),protocol:ue(Bc),auth:Xw}),xh=C({type:ie("KNOWLEDGE_BASE"),toolName:g().check(fr(1)),sourceType:ue(Fc),sourceId:g(),sourceName:g()}),ex=bn("type",[Zw,Th,wh,xh]),tx=C({displayName:g(),description:M(g()),type:ue(qc)}),Ah=C({type:ie("MARKDOWN"),markdown:g()}),So={type:ie("TOOL_CALL"),input:Qe(ge(g(),he())),output:M(he()),toolName:g(),status:ue(Vc),toolCallId:g(),startTime:g(),endTime:M(g())},$4=C(So),Ih=bn("toolCallType",[C({...So,toolCallType:ie("PIECE"),pieceName:g(),pieceVersion:g(),actionName:g()}),C({...So,toolCallType:ie("FLOW"),displayName:g(),externalFlowId:g()}),C({...So,toolCallType:ie("MCP"),displayName:g(),serverUrl:g()}),C({...So,toolCallType:ie("KNOWLEDGE_BASE"),displayName:g(),sourceType:g()}),C({...So,toolCallType:ie("UNKNOWN"),displayName:g()})]),rx=be([Ah,Ih]);var Hc=(r=>(r.IMAGE="image",r.TEXT="text",r))(Hc||{}),Xr=C({apiKey:g()}),nx=Xr,ox=C({apiKey:g(),apiKeyHash:g()}),ix=Xr,ax=Xr,sx=Xr,ux=Xr,cx=Xr,lx=Xr,dx=Xr,$h=C({accessKeyId:g().check(fr(1)),secretAccessKey:g().check(fr(1))}),px=C({}),fx=C({}),mx=C({}),hx=C({}),gx=C({}),yx=C({}),zh=C({modelId:g(),modelName:g(),modelType:ue(Hc)}),Nh=C({apiKeyHeader:g(),baseUrl:g(),models:de(zh),defaultHeaders:M(ge(g(),g()))}),Dh=C({accountId:g(),gatewayId:g(),models:de(zh),vertexProject:M(g()),vertexRegion:M(g())}),Uh=C({resourceName:g(),apiVersion:En(vn(t=>typeof t=="string"&&t.trim().length===0?void 0:t),M(g()))}),jh=C({region:g().check(fr(1))}),_x=be([nx,sx,ux,cx,lx,ax,ix,ox,$h,dx]),Mh=be([Nh,Dh,Uh,jh,px,mx,hx,gx,fx,yx]),bx=C({id:g(),name:g(),type:ue(Hc)}),vx=C({id:g(),name:g(),provider:ue(zi),config:Mh,enabledForChat:Ce()}),Ex=C({provider:ue(zi),config:Mh,auth:_x,platformId:g()});var U4={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},Rh=["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],Px=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],Sx=["claude-sonnet-4.6","claude-opus-4.7","claude-haiku-4.5"],Ch=["gemini-2.5-pro","gemini-2.5-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],Tx=["grok-4.20","grok-4.1-fast"],wx={openai:Rh,anthropic:Px,google:Ch,activepieces:[...Sx.map(t=>`anthropic/${t}`),...Rh.map(t=>`openai/${t}`),...Ch.map(t=>`google/${t}`),...Tx.map(t=>`x-ai/${t}`)]};var Oh=128e3,xx={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function Ax({provider:t}){return t?xx[t]??Oh:Oh}o(Ax,"getMaxContextTokens");var kh={openai:"text-embedding-3-small",google:"text-embedding-004",azure:"text-embedding-3-small",activepieces:"text-embedding-3-small",openrouter:"openai/text-embedding-3-small"},Ix={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},Rx=new Set(["anthropic","mistral"]);function Ir(t){return{chatModels:wx[t],maxContextTokens:Ax({provider:t}),defaultEmbeddingModel:kh[t],supportsEmbedding:kh[t]!==void 0,supportsImageGeneration:!Rx.has(t),webSearch:Ix[t]}}o(Ir,"buildProviderCapabilities");var Cx={openai:Ir("openai"),anthropic:Ir("anthropic"),openrouter:Ir("openrouter"),azure:Ir("azure"),google:Ir("google"),"cloudflare-gateway":Ir("cloudflare-gateway"),custom:Ir("custom"),bedrock:Ir("bedrock"),mistral:Ir("mistral"),activepieces:Ir("activepieces")};var Ox=C({base64Url:g(),fileName:g(),extension:M(g())}),kx=C({mimeType:g(),url:g(),fileName:M(g())}),Gc=be([Ox,kx]);var $x=be([C({type:ie("file"),value:Gc}),C({type:ie("markdown"),value:g(),files:M(de(Gc))})]),zx=C({sessionId:g(),message:g(),files:M(de(g()))});var Fh=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(Fh||{}),Bh=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(Bh||{}),Wc=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(Wc||{});var Nx=be([C({...tr,name:g(),externalId:g(),type:ie("STATIC_DROPDOWN"),tableId:g(),projectId:g(),data:C({options:de(C({value:g()}))})}),C({...tr,name:g(),externalId:g(),type:be([ie("TEXT"),ie("NUMBER"),ie("DATE"),ie("DATETIME")]),tableId:g(),projectId:g()})]),Dx=C({...tr,name:g(),folderId:Qe(g()),projectId:g(),externalId:g(),status:Lc(Bh),trigger:Lc(Fh)}),Ux=C({...tr,tableId:g(),projectId:g(),cells:ge(g(),C({updated:g(),created:g(),value:he(),fieldName:g()}))}),jx=C({events:de(ue(Wc)),webhookUrl:g(),flowId:g()}),Mx=C({fields:de(C({id:g(),name:g()})),rows:de(ge(g(),g())),name:g()}),Lx=C({projectId:g(),limit:M(Si.number()),cursor:M(g()),name:M(g()),externalIds:cs(g()),folderId:M(g()),folderIds:cs(g())}),Fx=C({records:de(de(C({fieldId:g(),value:Vh()}))),tableId:g()}),Bx=C({cells:M(de(C({fieldId:g(),value:Vh()}))),tableId:g(),agentUpdate:M(Ce())}),qh=bn("operator",[Bn("eq"),Bn("neq"),Bn("gt"),Bn("gte"),Bn("lt"),Bn("lte"),Bn("co"),Lh("exists"),Lh("not_exists")]),qx=C({tableId:g(),limit:M(Si.number()),cursor:M(g()),filters:cs(qh)});function Vh(){return En(vn(t=>t==null?t:String(t)),Pi(g()))}o(Vh,"coerceToString");function Bn(t){return C({fieldId:g(),operator:ie(t),value:g()})}o(Bn,"valueFilter");function Lh(t){return C({fieldId:g(),operator:ie(t)})}o(Lh,"existenceFilter");var Vx=C({status:M(lt()),body:M(he()),headers:M(ge(g(),g()))}),Hx=C({...tr,deleted:Qe(Sn),ownerId:g(),displayName:g(),platformId:g(),externalId:Qe(g())});var Hh=C({name:g(),description:M(g()),type:g(),required:Ce()}),Gx=C({pieceName:g(),triggerName:g(),input:C({toolName:g(),toolDescription:g(),inputSchema:de(Hh),returnsResponse:Ce()})});var Gh="^[0-9]+\\.[0-9]+\\.[0-9]+$",rq=new RegExp(Gh),Zx="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",nq=g().check(_n(new RegExp(Gh))),oq=g().check(_n(new RegExp(Zx))),Jx=C({packageType:ie("ARCHIVE"),pieceType:ue(vo),pieceName:g(),pieceVersion:g(),archiveId:g(),platformId:g()}),Wh=C({packageType:ie("REGISTRY"),pieceType:ie("OFFICIAL"),pieceName:g(),pieceVersion:g()}),Zh=C({packageType:ie("REGISTRY"),pieceType:ie("CUSTOM"),pieceName:g(),pieceVersion:g(),platformId:g()}),iq=be([Wh,Zh]),aq=be([Jx,Wh,Zh]);var Kx=bn("type",[C({type:ie("CRON_EXPRESSION"),cronExpression:g(),timezone:g()}),C({type:ie("INTERVAL"),intervalMs:ih().check(es(6e4))})]),sq=C({...tr,type:ue(mr),projectId:g(),flowId:g(),triggerName:g(),schedule:Qe(Kx),flowVersionId:g(),pieceName:g(),pieceVersion:g(),deleted:Qe(g()),simulate:Ce()}),Jh=(E=>(E.UNKNOWN="UNKNOWN",E.FLOW_RUN_LOG="FLOW_RUN_LOG",E.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",E.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",E.FLOW_STEP_FILE="FLOW_STEP_FILE",E.SAMPLE_DATA="SAMPLE_DATA",E.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",E.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",E.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",E.PROJECT_RELEASE="PROJECT_RELEASE",E.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",E.PLATFORM_ASSET="PLATFORM_ASSET",E.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",E.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",E.KNOWLEDGE_BASE="KNOWLEDGE_BASE",E.FLOW_BUNDLE="FLOW_BUNDLE",E))(Jh||{}),Kh=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(Kh||{}),Qh=(r=>(r.S3="S3",r.DB="DB",r))(Qh||{}),uq=C({...tr,projectId:Qe(g()),platformId:Qe(g()),type:ue(Jh),compression:ue(Kh),data:M(he()),location:ue(Qh),size:Qe(lt()),fileName:Qe(g()),s3Key:Qe(g()),metadata:Qe(ge(g(),g()))}),Yh=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(Yh||{}),Xh=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(Xh||{}),cq=C({id:g(),email:g(),firstName:g(),status:ue(Xh),externalId:Qe(g()),platformId:Qe(g()),platformRole:ue(Yh),lastName:g(),created:Sn,updated:Sn,lastActiveDate:Qe(Sn),imageUrl:Qe(g())});var Jc=C({...xe.shape,...ye(ge(g(),he()),"OBJECT").shape});var Kc=C({...xe.shape,formatProperty:M(g()),...ye(g(),"RICH_TEXT").shape});var rg=C({...xe.shape,...ye(g(),"COLOR").shape});var Qc=be([Lt,Jr,Kc,as,Qr,Ft,Kr,Nc,Ti,Uc,Yr,Ai,Jc,Ii,xi,Dc,wi,rg]),K={ShortText(t){return{...t,valueSchema:void 0,type:"SHORT_TEXT"}},Checkbox(t){return{...t,valueSchema:void 0,type:"CHECKBOX"}},LongText(t){return{...t,valueSchema:void 0,type:"LONG_TEXT"}},RichText(t){return{...t,valueSchema:void 0,type:"RICH_TEXT"}},MarkDown(t){return{displayName:"Markdown",required:!1,description:t.value,type:"MARKDOWN",valueSchema:void 0,variant:t.variant??"INFO"}},Number(t){return{...t,valueSchema:void 0,type:"NUMBER"}},Json(t){return{...t,valueSchema:void 0,type:"JSON"}},Array(t){return{...t,valueSchema:void 0,type:"ARRAY"}},Object(t){return{...t,valueSchema:void 0,type:"OBJECT"}},Dropdown(t){return{...t,valueSchema:void 0,type:"DROPDOWN"}},StaticDropdown(t){return{...t,valueSchema:void 0,type:"STATIC_DROPDOWN"}},MultiSelectDropdown(t){return{...t,valueSchema:void 0,type:"MULTI_SELECT_DROPDOWN"}},DynamicProperties(t){return{...t,valueSchema:void 0,type:"DYNAMIC"}},StaticMultiSelectDropdown(t){return{...t,valueSchema:void 0,type:"STATIC_MULTI_SELECT_DROPDOWN"}},DateTime(t){return{...t,valueSchema:void 0,type:"DATE_TIME"}},DateRange(t){return{...t,valueSchema:void 0,type:"DATE_RANGE"}},File(t){return{...t,valueSchema:void 0,type:"FILE"}},Custom(t){let e=t.code.toString();return{...t,code:e,valueSchema:void 0,type:"CUSTOM"}},Color(t){return{...t,valueSchema:void 0,type:"COLOR"}}};var Rr=C({displayName:g(),description:M(g()),hasConnectionIdentifier:M(Ce())});var ng=C({username:g(),password:g()}),Yc=C({...Rr.shape,username:C({displayName:g(),description:M(g())}),password:C({displayName:g(),description:M(g())}),...ye(ng,"BASIC_AUTH").shape});var eA=ge(g(),be([Lt,Jr,Yr,Qr,Ft])),Xc=C({...Rr.shape,props:eA,...ye(he(),"CUSTOM_AUTH").shape});var qn=C({...Rr.shape,...ye(C({auth:g()}),"SECRET_TEXT").shape});var tA=ge(g(),be([Lt,Jr,qn,Yr,Qr,Ft,Kr,as])),og=C({...Rr.shape,props:tA,...ye(he(),"OIDC").shape});var el=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(el||{}),ig=be([Lt,qn,Ft]),ag=ge(g(),ig),rA=C({props:M(ge(g(),ig)),authUrl:g(),tokenUrl:g(),scope:de(g()),prompt:M(be([ie("none"),ie("consent"),ie("login"),ie("omit")])),pkce:M(Ce()),pkceMethod:M(be([ie("plain"),ie("S256")])),authorizationMethod:M(ue(el)),grantType:M(be([ue(Ci),ie(jc)])),extra:M(ge(g(),g()))}),sg=C({access_token:g(),props:M(ag),data:ge(g(),Ei())}),tl=C({...Rr.shape,...rA.shape,...ye(sg,"OAUTH2").shape});var To=be([Yc,Xc,og,tl,qn]),Ni="Connection",ds={SecretText(t){return{...t,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(t){return{...t,valueSchema:void 0,type:"OAUTH2",displayName:t.displayName||Ni}},BasicAuth(t){return{...t,valueSchema:void 0,type:"BASIC_AUTH",displayName:t.displayName||Ni,required:!0}},CustomAuth(t){return{...t,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:t.displayName||Ni}},OIDC(t){return{...t,valueSchema:void 0,type:"OIDC",displayName:t.displayName||Ni}},None(){}};var G6={OAUTH2:"OAUTH2",CLOUD_OAUTH2:"OAUTH2",PLATFORM_OAUTH2:"OAUTH2",BASIC_AUTH:"BASIC_AUTH",CUSTOM_AUTH:"CUSTOM_AUTH",OIDC:"OIDC",SECRET_TEXT:"SECRET_TEXT",NO_AUTH:void 0};var nA=C({...xe.shape,...ye(he(),"CUSTOM").shape,code:g()});var oA=be([Qc,To]),rl=ge(g(),oA),fV=ge(g(),Qc);var ug=be([C({strategy:ie("CRON"),cronExpression:g()}),C({strategy:ie("NONE")})]),wo=class{constructor(e,r,n,i,u,c,l,p,f,m,y,P,h,b,T,E,w,k,q,W,H){this.name=e;this.displayName=r;this.description=n;this.requireAuth=i;this.props=u;this.type=c;this.handshakeConfiguration=l;this.onHandshake=p;this.renewConfiguration=f;this.onRenew=m;this.onEnable=y;this.onDisable=P;this.onStart=h;this.run=b;this.test=T;this.sampleData=E;this.testStrategy=w;this.outputSchema=k;this.aiMetadata=q;this.classification=W;this.propertyGroups=H}static{o(this,"ITrigger")}},Tn=o(t=>{switch(t.type){case"WEBHOOK":return new wo(t.name,t.displayName,t.description,t.requireAuth??!0,t.props,t.type,t.handshakeConfiguration??{strategy:"NONE"},t.onHandshake??(async()=>({status:200})),t.renewConfiguration??{strategy:"NONE"},t.onRenew??(async()=>Promise.resolve()),t.onEnable,t.onDisable,t.onStart??(async()=>Promise.resolve()),t.run,t.test??(()=>Promise.resolve([t.sampleData])),t.sampleData,t.test?"TEST_FUNCTION":"SIMULATION",t.outputSchema,t.aiMetadata,t.classification,t.propertyGroups);case"POLLING":return new wo(t.name,t.displayName,t.description,t.requireAuth??!0,t.props,t.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),t.onEnable,t.onDisable,t.onStart??(async()=>Promise.resolve()),t.run,t.test??(()=>Promise.resolve([t.sampleData])),t.sampleData,"TEST_FUNCTION",t.outputSchema,t.aiMetadata,t.classification,t.propertyGroups);case"MANUAL":return new wo(t.name,t.displayName,t.description,t.requireAuth??!0,t.props,t.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),t.onEnable,t.onDisable,t.onStart??(async()=>Promise.resolve()),t.run,t.test??(()=>Promise.resolve([t.sampleData])),t.sampleData,"TEST_FUNCTION",t.outputSchema,t.aiMetadata,t.classification,t.propertyGroups);case"APP_WEBHOOK":return new wo(t.name,t.displayName,t.description,t.requireAuth??!0,t.props,t.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),t.onEnable,t.onDisable,t.onStart??(async()=>Promise.resolve()),t.run,t.test??(()=>Promise.resolve([t.sampleData])),t.sampleData,et(t.sampleData)&&et(t.test)?"SIMULATION":"TEST_FUNCTION",t.outputSchema,t.aiMetadata,t.classification,t.propertyGroups)}},"createTrigger");var cg="2",ps="0.82.0";var nl=class{constructor(e,r,n,i,u,c,l,p,f=ps,m,y="",P){this.displayName=e;this.logoUrl=r;this.authors=n;this.events=i;this.categories=l;this.auth=p;this.minimumSupportedRelease=f;this.maximumSupportedRelease=m;this.description=y;this.deprecated=P;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:cg}),"getContextInfo");(!aA(f)||sA(f,ps))&&(this.minimumSupportedRelease=ps),u.forEach(h=>this._actions[h.name]=h),c.forEach(h=>this._triggers[h.name]=h)}static{o(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:iA(this.auth),minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,deprecated:this.deprecated,contextInfo:this.getContextInfo?.()}}getAction(e){return this._actions[e]}getTrigger(e){return this._triggers[e]}actions(){return this._actions}triggers(){return this._triggers}},dg=o(t=>{if(t.auth&&Array.isArray(t.auth)&&!t.auth.every((r,n,i)=>n===i.findIndex(u=>u.type===r.type)))throw new Error("Auth properties must be unique by type");return new nl(t.displayName,t.logoUrl,t.authors??[],t.events,t.actions,t.triggers,t.categories??[],t.auth,t.minimumSupportedRelease,t.maximumSupportedRelease,t.description,t.deprecated)},"createPiece");function iA(t){if(t!==void 0)return Array.isArray(t)?t.map(lg):lg(t)}o(iA,"withConnectionIdentifierFlag");function lg(t){return{...t,hasConnectionIdentifier:t.getConnectionIdentifier!==void 0}}o(lg,"flagConnectionIdentifier");function aA(t){return/^\d+\.\d+\.\d+$/.test(t)}o(aA,"isValidSimpleSemver");function sA(t,e){let[r,n,i]=t.split(".").map(Number),[u,c,l]=e.split(".").map(Number);return r!==u?r<u:n!==c?n<c:i<l}o(sA,"isSemverLessThan");var uA=M(ge(g(),ge(g(),g()))),pg=C({id:M(g()),name:g(),displayName:g(),logoUrl:g(),description:g(),authors:de(g()),platformId:M(g()),directoryPath:M(g()),auth:M(be([To,de(To)])),version:g(),categories:M(de(ue(Eo))),minimumSupportedRelease:M(g()),maximumSupportedRelease:M(g()),deprecated:M(Ce()),i18n:uA}),cA=ue(["human","ai","both"]),fg=C({description:M(g()),idempotent:M(Ce())}),mg=ue(["READ","SEARCH","WRITE","DESTRUCTIVE"]);var lA=ue(["tabs","section","summary","builder","footer"]),hg=C({key:g(),display:lA,label:M(g()),description:M(g()),icon:M(g()),props:de(g())}),gg=C({name:g(),displayName:g(),description:g(),props:rl,propertyGroups:M(de(hg)),requireAuth:Ce(),errorHandlingOptions:M(zc),outputSchema:M(os()),audience:M(cA),aiMetadata:M(fg),classification:M(mg)}),yg=C({name:g(),displayName:g(),description:g(),props:rl,propertyGroups:M(de(hg)),errorHandlingOptions:M(zc),type:ue(mr),sampleData:he(),handshakeConfiguration:M(os()),renewConfiguration:M(ug),testStrategy:ue(ki),outputSchema:M(os()),aiMetadata:M(fg),classification:M(mg)}),dA=C({...pg.shape,actions:ge(g(),gg),triggers:ge(g(),yg)}),pA=C({...pg.shape,actions:lt(),triggers:lt(),suggestedActions:M(de(gg)),suggestedTriggers:M(de(yg))}),_g=C({projectUsage:lt(),pieceType:ue(vo),packageType:ue(Ri),platformId:M(g()),archiveId:M(g())}),h2=C({...dA.shape,..._g.shape}),g2=C({...pA.shape,..._g.shape}),y2=C({name:g(),version:g()});var fA=yt(require("path")),mA=yt(require("fs/promises"));var xo=require("node:stream");var fs=class{constructor(e,r){this.baseUrl=e;this.authenticationConverter=r}static{o(this,"BaseHttpClient")}getUrl(e){let r=new URL(`${this.baseUrl}${e.url}`),n=`${r.origin}${r.pathname}`,i=new URLSearchParams;return r.searchParams.forEach((u,c)=>{i.append(c,u)}),{urlWithoutQueryParams:n,queryParams:i}}getHeaders(e){let r={Accept:"application/json"};return e.authentication&&this.populateAuthentication(e.authentication,r),e.body&&(e.headers?.["Content-Type"]==="text/csv"?r["Content-Type"]="text/csv":r["Content-Type"]="application/json"),e.headers&&(r={...r,...e.headers}),r}populateAuthentication(e,r){this.authenticationConverter.convert(e,r)}};var ms=class{static{o(this,"DelegatingAuthenticationConverter")}constructor(e=new ol,r=new il){this.converters={BEARER_TOKEN:e,BASIC:r}}convert(e,r){return this.converters[e.type].convert(e,r)}},ol=class{static{o(this,"BearerTokenAuthenticationConverter")}convert(e,r){return r.Authorization=`Bearer ${e.token}`,r}},il=class{static{o(this,"BasicTokenAuthenticationConverter")}convert(e,r){let n=`${e.username}:${e.password}`,i=Buffer.from(n).toString("base64");return r.Authorization=`Basic ${i}`,r}};var Di=class extends Error{constructor(r,n){let i=n.status||500,u=Buffer.isBuffer(n.responseBody)?n.responseBody.toString():n.responseBody;super(JSON.stringify({response:{status:i,body:u},request:{body:r}}));this.requestBody=r;this.status=i,this.responseBody=u}static{o(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};function bg({error:t,requestBody:e}){return t instanceof Di?t.errorMessage():{response:{status:0,body:t instanceof Error?t.message:String(t)},request:{body:e}}}o(bg,"toFailsafeOutput");var xt=(c=>(c.GET="GET",c.POST="POST",c.PATCH="PATCH",c.PUT="PUT",c.DELETE="DELETE",c.HEAD="HEAD",c))(xt||{});var hs=class extends fs{static{o(this,"FetchHttpClient")}constructor(e="",r=new ms){super(e,r)}async sendRequest(e,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:n,queryParams:i}=this.getUrl(e),u=this.getHeaders(e),c=e.queryParams??{};for(let[q,W]of Object.entries(c))i.append(q,W);let l=i.toString(),p=l?`${n}?${l}`:n,f=e.responseType??"json",m=e.followRedirects??!0,y=e.retries??0,{body:P,extraHeaders:h,isStream:b}=hA(e.method)?gA(e.body,u):{body:void 0,extraHeaders:{},isStream:!1},T=_A({...u,...h}),E=await yA(async()=>{let q=new AbortController,W=e.timeout&&e.timeout>0?setTimeout(()=>q.abort(),e.timeout):void 0;try{let H={method:e.method.toString(),headers:T,body:P,redirect:m?"follow":"manual",signal:q.signal};return b&&(H.duplex="half"),r?.dispatcher!==void 0&&(H.dispatcher=r.dispatcher),await fetch(p,H)}finally{W!==void 0&&clearTimeout(W)}},b?0:y),w=m?300:400;if(E.status<200||E.status>=w){let q=await vg(E,f==="stream"?"text":f),W=new Di(e.body,{status:E.status,responseBody:q});throw console.error("[HttpClient#(sanitized error message)] Request failed:",W),W}let k=await vg(E,f);return{status:E.status,headers:bA(E.headers),body:k}}};function hA(t){return t!=="GET"&&t!=="HEAD"}o(hA,"acceptsRequestBody");function gA(t,e){if(Pg(t))return{body:void 0,extraHeaders:{},isStream:!1};if(vA(t)){let n=new xo.PassThrough;return t.on("error",i=>n.destroy(i)),t.pipe(n),{body:n,extraHeaders:t.getHeaders(),isStream:!0}}return t instanceof xo.Readable?{body:t,extraHeaders:{},isStream:!0}:typeof t=="string"||Buffer.isBuffer(t)||t instanceof URLSearchParams||t instanceof ArrayBuffer||typeof FormData<"u"&&t instanceof FormData||typeof Blob<"u"&&t instanceof Blob?{body:t,extraHeaders:{},isStream:!1}:(e["Content-Type"]??e["content-type"]??"").includes("application/x-www-form-urlencoded")?{body:new URLSearchParams(t).toString(),extraHeaders:{},isStream:!1}:{body:JSON.stringify(t),extraHeaders:{},isStream:!1}}o(gA,"serializeBody");async function vg(t,e){switch(e){case"arraybuffer":return Buffer.from(await t.arrayBuffer());case"stream":return Pg(t.body)?xo.Readable.from([]):xo.Readable.fromWeb(t.body);case"blob":return await t.blob();case"text":return await t.text();default:{let r=await t.text();if(r.length===0)return;try{return JSON.parse(r)}catch{return r}}}}o(vg,"parseResponseBody");async function yA(t,e){let r;for(let n=0;n<=e;n++)try{let i=await t();if(i.status>=500&&n<e){await Eg(n);continue}return i}catch(i){if(r=i,n<e){await Eg(n);continue}throw i}throw r}o(yA,"sendWithRetries");function Eg(t){let e=Math.min(1e3*2**t,3e4);return new Promise(r=>setTimeout(r,e))}o(Eg,"backoff");function _A(t){let e={};for(let[r,n]of Object.entries(t))n!==void 0&&(e[r.toLowerCase()]=Array.isArray(n)?n.join(", "):n);return e}o(_A,"normalizeHeaders");function bA(t){let e={};return t.forEach((r,n)=>{e[n]=r}),e}o(bA,"toHttpHeaders");function vA(t){return typeof t=="object"&&t!==null&&typeof t.getHeaders=="function"&&typeof t.pipe=="function"&&typeof t.on=="function"}o(vA,"isNodeFormData");function Pg(t){return t==null}o(Pg,"isNil");var Se=new hs;var sR=yt(require("fs")),I_=yt(A_());var uR={"application/json":"json","application/pdf":"pdf","application/xml":"xml","text/xml":"xml","application/zip":"zip","application/gzip":"gz","application/x-tar":"tar","application/octet-stream":"bin","application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/rtf":"rtf","application/javascript":"js","application/x-www-form-urlencoded":"bin","text/plain":"txt","text/html":"html","text/css":"css","text/csv":"csv","text/calendar":"ics","text/markdown":"md","image/png":"png","image/jpeg":"jpeg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/bmp":"bmp","image/tiff":"tiff","image/x-icon":"ico","image/vnd.microsoft.icon":"ico","image/heic":"heic","audio/mpeg":"mp3","audio/mp4":"m4a","audio/wav":"wav","audio/x-wav":"wav","audio/ogg":"ogg","audio/webm":"weba","video/mp4":"mp4","video/mpeg":"mpeg","video/webm":"webm","video/quicktime":"mov","video/x-msvideo":"avi","font/woff":"woff","font/woff2":"woff2","font/ttf":"ttf","font/otf":"otf"};function cR(t){let e=t.split(";")[0].trim().toLowerCase();return uR[e]??""}o(cR,"contentTypeToExtension");var lR=o(({baseUrl:t,relativePath:e})=>{let r=t.endsWith("/")?t:`${t}/`,n=e.startsWith("/")?e.slice(1):e;return`${r}${n}`},"joinBaseUrlWithRelativePath"),dR=o((t,e)=>{let r="https://api.example.com";try{let n=e?t(e):void 0;return(n?.endsWith("/")?n.slice(0,-1):n)??r}catch{return r}},"getBaseUrlForDescription");function R_({auth:t,baseUrl:e,authMapping:r,description:n,displayName:i,name:u,props:c,extraProps:l,authLocation:p="headers",classification:f="WRITE"}){return nt({audience:"human",name:u||"custom_api_call",classification:f,displayName:i||"Custom API Call",description:n||"Make a custom API call to a specific endpoint",auth:t,requireAuth:!!t,props:{url:K.DynamicProperties({auth:t,displayName:"",required:!0,refreshers:[],props:o(async({auth:m})=>({url:K.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
56
+ i.e ${dR(e,m)}/resource or /resource`,required:!0,defaultValue:m?e(m):"",...c?.url??{}})}),"props")}),method:K.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(xt).map(m=>({label:m,value:m}))},...c?.method??{}}),headers:K.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...c?.headers??{}}),queryParams:K.Object({displayName:"Query Parameters",required:!0,...c?.queryParams??{}}),body_type:K.StaticDropdown({displayName:"Body Type",required:!1,defaultValue:"none",options:{disabled:!1,options:[{label:"None",value:"none"},{label:"JSON",value:"json"},{label:"Form Data",value:"form_data"},{label:"Raw",value:"raw"}]}}),body:K.DynamicProperties({auth:t,displayName:"Body",refreshers:["body_type"],required:!1,props:o(async({body_type:m})=>{if(!m)return{};let y=m,P={};switch(y){case"none":break;case"json":P.data=K.Json({displayName:"JSON Body",required:!0,...c?.body??{}});break;case"raw":P.data=K.LongText({displayName:"Raw Body",required:!0});break;case"form_data":P.data=K.Array({displayName:"Form Data",required:!0,properties:{fieldName:K.ShortText({displayName:"Field Name",required:!0}),fieldType:K.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:K.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:K.File({displayName:"File Field Value",required:!1})}});break}return P},"props")}),response_is_binary:K.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:K.Checkbox({displayName:"No Error on Failure",required:!1,...c?.failsafe??{}}),timeout:K.Number({displayName:"Timeout (in seconds)",required:!1,...c?.timeout??{}}),followRedirects:K.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...l},run:o(async m=>{let{method:y,url:P,headers:h,queryParams:b,body:T,body_type:E,failsafe:w,timeout:k,response_is_binary:q,followRedirects:W}=m.propsValue;us(y,"Method"),us(P,"URL");let H=et(r)?{}:await r(m.auth,m.propsValue),V=P.url,J=V.startsWith("http://")||V.startsWith("https://")?V:lR({baseUrl:e(m.auth),relativePath:V}),re={method:y,url:J,headers:{...h??{},...p==="headers"||!et(p)?H:{}},queryParams:{...p==="queryParams"?H:{},...b??{}},timeout:k?k*1e3:0,followRedirects:W};if(q&&(re.responseType="arraybuffer"),T)if(E&&E!=="none"){let G=T.data;if(E==="form_data"){let je=G,Ee=new I_.default;for(let{fieldName:ve,fieldType:ze,textFieldValue:$e,fileFieldValue:Ue}of je)ze==="text"&&!$i($e)?Ee.append(ve,$e):ze==="file"&&!$i(Ue)&&Ee.append(ve,Ue.data,{filename:Ue?.filename});re.body=Ee,re.headers={...re.headers,...Ee.getHeaders()}}else re.body=G}else E||(re.body=T);try{let G=await Se.sendRequest(re);return await pR(m.files,G.body,G.status,G.headers,q)}catch(G){if(w)return bg({error:G,requestBody:re.body});throw G}},"run")})}o(R_,"createCustomApiCallAction");var pR=o(async(t,e,r,n,i)=>{let u;if(i&&fR(e)){let c=Array.isArray(n?.["content-type"])?n["content-type"][0]:n?.["content-type"],l=cR(c??"")||"txt",p;e instanceof ArrayBuffer?p=Buffer.from(new Uint8Array(e)):Buffer.isBuffer(e)?p=e:p=Buffer.from(e),u=await t.write({fileName:`output.${l}`,data:p})}else u=e;return{status:r,headers:n,body:u}},"handleBinaryResponse"),fR=o(t=>t instanceof ArrayBuffer||Buffer.isBuffer(t),"isBinaryBody");var ot={async poll(t,{store:e,auth:r,propsValue:n,maxItemsToPoll:i,files:u,server:c}){switch(t.strategy){case 0:{let l=await e.get("lastPoll");if(et(l))throw new Error("lastPoll doesn't exist in the store.");let p=await t.items({store:e,auth:r,propsValue:n,lastFetchEpochMS:l,server:c}),f=p.reduce((m,y)=>Math.max(m,y.epochMilliSeconds),l);return await e.put("lastPoll",f),p.filter(m=>m.epochMilliSeconds>l).map(m=>m.data)}case 1:{let l=await e.get("lastItem"),p=await t.items({store:e,auth:r,propsValue:n,lastItemId:l,files:u,server:c}),f=p.findIndex(P=>P.id===l),m=[];et(l)||f==-1?m=p??[]:m=p?.slice(0,f)??[],et(i)||(m=m.slice(-i));let y=m?.[0]?.id;return et(y)||await e.put("lastItem",y),m.map(P=>P.data)}}},async onEnable(t,{store:e,auth:r,propsValue:n,server:i,isRepublish:u}){switch(t.strategy){case 0:{if(u&&!et(await e.get("lastPoll")))break;await e.put("lastPoll",Date.now());break}case 1:{if(u&&!et(await e.get("lastItem")))break;let l=(await t.items({store:e,auth:r,propsValue:n,lastItemId:null,server:i}))?.[0]?.id;et(l)?await e.delete("lastItem"):await e.put("lastItem",l);break}}},async onDisable(t,e){switch(t.strategy){case 0:case 1:return}},async test(t,{auth:e,propsValue:r,store:n,files:i,server:u}){let c=[];switch(t.strategy){case 0:{c=await t.items({store:n,auth:e,propsValue:r,lastFetchEpochMS:0,server:u});break}case 1:{c=await t.items({store:n,auth:e,propsValue:r,lastItemId:null,files:i,server:u});break}}return mR(c.map(l=>l.data))}};function mR(t){return t.length<=5?t:t.slice(0,5)}o(mR,"getFirstFiveOrAll");var Gp=yt(NP());var Ae="https://bigquery.googleapis.com/bigquery/v2",Hp=["https://www.googleapis.com/auth/bigquery","email"],ke=[ds.OAuth2({description:"Sign in with your Google account. If you are using your own OAuth2 credentials, make sure to include the following scope: `https://www.googleapis.com/auth/bigquery`",authUrl:"https://accounts.google.com/o/oauth2/auth",tokenUrl:"https://oauth2.googleapis.com/token",required:!0,scope:Hp}),ds.CustomAuth({displayName:"Service Account",description:"Use a GCP service account for automated, server-to-server access \u2014 no user sign-in required. Recommended for production workflows.",required:!0,props:{instructions:K.MarkDown({value:`**How to create a service account key:**
57
57
 
58
58
  1. Open [Google Cloud Console](https://console.cloud.google.com/) and select your project from the top dropdown.
59
59
  2. Go to **IAM & Admin** \u2192 **Service Accounts** in the left sidebar.
@@ -62,8 +62,8 @@ i.e ${tR(e,f)}/resource or /resource`,required:!0,defaultValue:f?e(f):"",...c?.u
62
62
  5. Under **Grant this service account access**, add the **BigQuery User** role (or **BigQuery Admin** for full access). Click **Done**.
63
63
  6. Click on the service account you just created, then open the **Keys** tab.
64
64
  7. Click **Add Key** \u2192 **Create new key** \u2192 select **JSON** \u2192 click **Create**.
65
- 8. A \`.json\` file will download \u2014 open it in a text editor and paste the entire contents into the field below.`}),serviceAccountJson:K.ShortText({displayName:"Service Account JSON",description:"Paste the full contents of the downloaded .json key file here",required:!0})},validate:o(async({auth:t})=>{try{let e=JSON.parse(t.serviceAccountJson);if(!e.client_email||!e.private_key)return{valid:!1,error:'Service account JSON must contain "client_email" and "private_key" fields'};if(!(await new qp.JWT({email:e.client_email,key:e.private_key,scopes:Bp}).getAccessToken()).token)throw new Error("Empty token returned");return{valid:!0}}catch(e){return{valid:!1,error:`Service account authentication failed: ${e.message}`}}},"validate")})];async function Ne(t){if(t.type==="CUSTOM_AUTH"){let e=JSON.parse(t.props.serviceAccountJson),n=await new qp.JWT({email:e.client_email,key:e.private_key,scopes:Bp}).getAccessToken();if(n.token)return n.token;throw new Error("Could not retrieve access token from service account JSON")}return t.access_token}o(Ne,"getAccessToken");var qe=K.Dropdown({auth:Oe,displayName:"Project",description:"Select your Google Cloud project",refreshers:[],required:!0,options:o(async({auth:t})=>{if(!t)return{disabled:!0,options:[],placeholder:"Please connect your account first"};try{let e=await Ne(t);return{disabled:!1,options:((await Pe.sendRequest({method:"GET",url:`${xe}/projects`,headers:{Authorization:`Bearer ${e}`},queryParams:{maxResults:"200"}})).body.projects??[]).map(i=>({label:i.friendlyName?`${i.friendlyName} (${i.projectReference.projectId})`:i.projectReference.projectId,value:i.projectReference.projectId}))}}catch{return{disabled:!0,options:[],placeholder:"Failed to load projects. Check your connection."}}},"options")}),mt=K.Dropdown({auth:Oe,displayName:"Dataset",description:"Select the BigQuery dataset",refreshers:["project_id"],required:!0,options:o(async({auth:t,project_id:e})=>{if(!t||!e)return{disabled:!0,options:[],placeholder:"Please select a project first"};try{let r=await Ne(t),n=[],i;do{let u=await Pe.sendRequest({method:"GET",url:`${xe}/projects/${e}/datasets`,headers:{Authorization:`Bearer ${r}`},queryParams:{maxResults:"200",...i?{pageToken:i}:{}}});for(let c of u.body.datasets??[])n.push({label:c.friendlyName??c.datasetReference.datasetId,value:c.datasetReference.datasetId});i=u.body.nextPageToken}while(i);return{disabled:!1,options:n}}catch{return{disabled:!0,options:[],placeholder:"Failed to load datasets. Check your project selection."}}},"options")}),ht=K.Dropdown({auth:Oe,displayName:"Table",description:"Select the BigQuery table",refreshers:["project_id","dataset_id"],required:!0,options:o(async({auth:t,project_id:e,dataset_id:r})=>{if(!t||!e||!r)return{disabled:!0,options:[],placeholder:"Please select a project and dataset first"};try{let n=await Ne(t),i=[],u;do{let c=await Pe.sendRequest({method:"GET",url:`${xe}/projects/${e}/datasets/${r}/tables`,headers:{Authorization:`Bearer ${n}`},queryParams:{maxResults:"200",...u?{pageToken:u}:{}}});for(let l of c.body.tables??[]){let p=l.friendlyName?`${l.friendlyName} (${l.tableReference.tableId})`:l.tableReference.tableId;i.push({label:p,value:l.tableReference.tableId})}u=c.body.nextPageToken}while(u);return{disabled:!1,options:i}}catch{return{disabled:!0,options:[],placeholder:"Failed to load tables. Check your dataset selection."}}},"options")});function Dt(t,e){return e.map(r=>{let n={};return t.forEach((i,u)=>{let c=r.f[u]?.v;c==null?n[i.name]=null:Array.isArray(c)?n[i.name]=c.map(l=>typeof l.v=="object"?JSON.stringify(l.v):String(l.v??"")).join(", "):typeof c=="object"?n[i.name]=JSON.stringify(c):n[i.name]=c}),n})}o(Dt,"bigQueryRowsToFlat");async function IS(t,e,r,n){return(await Pe.sendRequest({method:"GET",url:`${xe}/projects/${e}/datasets/${r}/tables/${n}`,headers:{Authorization:`Bearer ${t}`},queryParams:{fields:"schema"}})).body.schema?.fields??[]}o(IS,"getTableSchema");async function Lu(t,e,r,n){let u=(await Pe.sendRequest({method:"POST",url:`${xe}/projects/${e}/queries`,headers:{Authorization:`Bearer ${t}`},body:{query:r,useLegacySql:!1,timeoutMs:1e4,...n?{location:n}:{}}})).body.jobReference.jobId;for(let c=0;c<60;c++){let l=await Pe.sendRequest({method:"GET",url:`${xe}/projects/${e}/jobs/${u}`,headers:{Authorization:`Bearer ${t}`},queryParams:{...n?{location:n}:{}}});if(l.body.status.state==="DONE"){if(l.body.status.errorResult)throw new Error(`Query failed: ${l.body.status.errorResult.message}`);let p=l.body.statistics?.query?.dmlStats??{},f=parseInt(p.deletedRowCount??"0",10),m=parseInt(p.updatedRowCount??"0",10),g=parseInt(p.insertedRowCount??"0",10);return{jobId:u,affectedRowCount:f+m+g,deletedRowCount:f,updatedRowCount:m,insertedRowCount:g}}await new Promise(p=>setTimeout(p,2e3))}throw new Error("DML query timed out after 2 minutes.")}o(Lu,"runDmlQuery");async function ni(t,e,r,n){for(let i=0;i<60;i++){let u=await Pe.sendRequest({method:"GET",url:`${xe}/projects/${e}/queries/${r}`,headers:{Authorization:`Bearer ${t}`},queryParams:{timeoutMs:"10000",maxResults:"1000",...n?{location:n}:{}}});if(u.body.jobComplete)return u.body}throw new Error("Query did not complete within 10 minutes. Try simplifying your query or using a smaller dataset.")}o(ni,"waitForJobResults");var RS=rt({auth:Oe,name:"run_query",displayName:"Run a Query",description:"Execute a SQL query on BigQuery and return the results as flat rows",audience:"both",aiMetadata:{description:"Runs an arbitrary standard-SQL (or legacy-SQL) statement against BigQuery in a given project and returns the result rows, paginating up to the max-rows cap. Use it for any ad-hoc read or aggregation when no purpose-built action fits, or when you need full SQL control. Note that BigQuery SQL is not limited to reads \u2014 a DML/DDL statement passed here will mutate data \u2014 so idempotency depends on the query you supply; a plain SELECT is safe to repeat.",idempotent:!1},props:{project_id:qe,query:K.LongText({displayName:"SQL Query",description:"The SQL query to run. Uses standard SQL syntax. Example: `SELECT * FROM \\`my_dataset.my_table\\` LIMIT 100`",required:!0}),max_results:K.Number({displayName:"Max Rows",description:"Maximum number of rows to return (up to 10,000)",required:!1,defaultValue:1e3}),location:K.ShortText({displayName:"Location",description:"Geographic location of your dataset (e.g. US, EU, us-central1). Leave blank for US.",required:!1}),use_legacy_sql:K.Checkbox({displayName:"Use Legacy SQL",description:"Enable only if your query uses BigQuery Legacy SQL syntax (not recommended)",required:!1,defaultValue:!1})},async run(t){let{project_id:e,query:r,max_results:n,location:i,use_legacy_sql:u}=t.propsValue,c=Math.min(n??1e3,1e4),l=await Ne(t.auth),f=(await Pe.sendRequest({method:"POST",url:`${xe}/projects/${e}/queries`,headers:{Authorization:`Bearer ${l}`},body:{query:r,useLegacySql:u??!1,maxResults:Math.min(c,1e3),timeoutMs:1e4,...i?{location:i}:{}}})).body,m=f.schema?.fields??[];if(!f.jobComplete){let _=f.jobReference.jobId,T=await ni(l,e,_,i??void 0);f={...T,jobReference:{projectId:e,jobId:_}},m=T.schema?.fields??m}let g=[...f.rows??[]],S=f.pageToken;for(;S&&g.length<c;){let _=c-g.length,T=await Pe.sendRequest({method:"GET",url:`${xe}/projects/${e}/queries/${f.jobReference.jobId}`,headers:{Authorization:`Bearer ${l}`},queryParams:{pageToken:S,maxResults:String(Math.min(_,1e3)),...i?{location:i}:{}}});g.push(...T.body.rows??[]),S=T.body.pageToken}let h=Dt(m,g.slice(0,c));return{rows:h,row_count:h.length,total_rows:parseInt(f.totalRows??"0",10),bytes_processed:f.totalBytesProcessed??"0",job_id:f.jobReference?.jobId??null,cache_hit:f.cacheHit??!1}}});function I$(t){let e=`Type: ${t.type}${t.mode?` \xB7 Mode: ${t.mode}`:""}`;return K.ShortText({displayName:t.name,description:e,required:t.mode==="REQUIRED"})}o(I$,"fieldToProperty");var CS=rt({auth:Oe,name:"create_row",displayName:"Create Row",description:"Creates a single new row in a BigQuery table. Column fields are loaded from the table schema.",audience:"both",aiMetadata:{description:"Streams one new row into a BigQuery table via the streaming insert API, with each column supplied as a separate value (loaded from the live table schema; empty values are dropped rather than written as nulls). Choose this when an agent has a single record to append and knows the target project, dataset, and table. Not idempotent: each call appends another row, so repeating it duplicates the record.",idempotent:!1},props:{project_id:qe,dataset_id:mt,table_id:ht,values:K.DynamicProperties({displayName:"Row Values",description:"Enter a value for each column. Fields are loaded from the table schema.",required:!0,auth:Oe,refreshers:["project_id","dataset_id","table_id"],props:o(async({auth:t,project_id:e,dataset_id:r,table_id:n})=>{if(!t||!e||!r||!n)return{};try{let i=await Ne(t),u=await IS(i,e,r,n);return Object.fromEntries(u.filter(c=>c.type!=="RECORD").map(c=>[c.name,I$(c)]))}catch{return{}}},"props")})},async run(t){let{project_id:e,dataset_id:r,table_id:n,values:i}=t.propsValue,u=await Ne(t.auth),l=Object.fromEntries(Object.entries(i).filter(([,g])=>g!==""&&g!==null&&g!==void 0)),p=`${Date.now()}-${Math.random().toString(36).slice(2,9)}`,m=(await Pe.sendRequest({method:"POST",url:`${xe}/projects/${e}/datasets/${r}/tables/${n}/insertAll`,headers:{Authorization:`Bearer ${u}`},body:{kind:"bigquery#tableDataInsertAllRequest",rows:[{insertId:p,json:l}]}})).body.insertErrors??[];if(m.length>0){let g=m[0]?.errors[0];throw new Error(`Row insert failed: ${g?.message??"Unknown error"} (reason: ${g?.reason??"unknown"}, field: ${g?.location??"unknown"})`)}return{success:!0,insert_id:p,...l}}});var OS=rt({auth:Oe,name:"create_rows",displayName:"Create Rows",description:"Creates new rows of data in a BigQuery table (accepts an array of row objects). Rows are available to query within seconds.",audience:"both",aiMetadata:{description:"Streams a batch of rows into a BigQuery table in one streaming-insert call, taking a JSON array of objects whose keys match the column names. Choose this over Create Row when appending multiple records at once. Optional flags control whether the whole batch fails on a bad row or skips invalid rows / unknown fields. Not idempotent: every call appends the rows again, so repeating it duplicates them.",idempotent:!1},props:{project_id:qe,dataset_id:mt,table_id:ht,rows:K.Json({displayName:"Rows",description:'An array of row objects to insert. Keys must match the table column names. Example: `[{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]`',required:!0}),skip_invalid_rows:K.Checkbox({displayName:"Skip Invalid Rows",description:"If enabled, valid rows are inserted even when some rows in the batch are invalid. If disabled (default), the entire batch fails if any row is invalid.",required:!1,defaultValue:!1}),ignore_unknown_values:K.Checkbox({displayName:"Ignore Unknown Fields",description:"If enabled, fields not in the table schema are silently discarded. If disabled (default), unknown fields cause the row to fail.",required:!1,defaultValue:!1})},async run(t){let{project_id:e,dataset_id:r,table_id:n,rows:i,skip_invalid_rows:u,ignore_unknown_values:c}=t.propsValue;if(!Array.isArray(i)||i.length===0)throw new Error('Rows must be a non-empty JSON array of objects, e.g. [{"column": "value"}]');let l=await Ne(t.auth),p=Date.now(),f=i.map((h,_)=>({insertId:`${p}-${_}-${Math.random().toString(36).slice(2,9)}`,json:h})),g=(await Pe.sendRequest({method:"POST",url:`${xe}/projects/${e}/datasets/${r}/tables/${n}/insertAll`,headers:{Authorization:`Bearer ${l}`},body:{kind:"bigquery#tableDataInsertAllRequest",skipInvalidRows:u??!1,ignoreUnknownValues:c??!1,rows:f}})).body.insertErrors??[];if(g.length>0&&!(u??!1)){let h=g[0]?.errors[0];throw new Error(`Insert failed on row ${g[0]?.index}: ${h?.message??"Unknown error"} (reason: ${h?.reason??"unknown"})`)}let S=g.map(h=>({row_index:h.index,error_count:h.errors.length,first_error_reason:h.errors[0]?.reason??null,first_error_location:h.errors[0]?.location??null,first_error_message:h.errors[0]?.message??null}));return{success:g.length===0,rows_attempted:i.length,rows_inserted:i.length-g.length,error_count:g.length,errors:S}}});var kS=rt({auth:Oe,name:"delete_rows",displayName:"Delete Rows",description:"Deletes one or more rows from a BigQuery table using a SQL WHERE condition.",audience:"both",aiMetadata:{description:"Deletes every row matching a SQL WHERE condition from a BigQuery table by running a DELETE DML statement (supply only the condition body, without the WHERE keyword). Use it to remove records that meet a filter. Effectively idempotent on the same data \u2014 a repeat matches no remaining rows \u2014 but it is a destructive mutation, so an overly broad condition can remove far more than intended.",idempotent:!1},props:{project_id:qe,dataset_id:mt,table_id:ht,where_clause:K.LongText({displayName:"WHERE Clause",description:'SQL condition to match the rows to delete. Do not include the WHERE keyword. Example: `status = "inactive" AND created_at < "2023-01-01"`',required:!0}),location:K.ShortText({displayName:"Location",description:"Dataset location (e.g. US, EU). Leave blank to use the default.",required:!1})},async run(t){let{project_id:e,dataset_id:r,table_id:n,where_clause:i,location:u}=t.propsValue,c=await Ne(t.auth),p=`DELETE FROM ${`\`${e}.${r}.${n}\``} WHERE ${i}`,f=await Lu(c,e,p,u??void 0);return{success:!0,rows_deleted:f.deletedRowCount,job_id:f.jobId}}});var $S=rt({auth:Oe,name:"update_rows",displayName:"Update Row(s)",description:"Updates one or more existing rows in a BigQuery table using SQL SET and WHERE expressions.",audience:"both",aiMetadata:{description:"Updates rows in a BigQuery table by running an UPDATE DML statement, applying a comma-separated SET assignment to every row matching a WHERE condition (supply both as raw SQL fragments without the SET/WHERE keywords). Use it to change column values on existing records. Mutates state on each run, so it is not safe to assume idempotency \u2014 assignments to fixed literal values repeat harmlessly, but relative expressions (e.g. incrementing a counter) compound on every call.",idempotent:!1},props:{project_id:qe,dataset_id:mt,table_id:ht,set_expression:K.LongText({displayName:"SET Expression",description:'Comma-separated column assignments. Do not include the SET keyword. Example: `status = "active", updated_at = CURRENT_TIMESTAMP()`',required:!0}),where_clause:K.LongText({displayName:"WHERE Clause",description:'SQL condition to match the rows to update. Do not include the WHERE keyword. Example: `id = "abc123"`',required:!0}),location:K.ShortText({displayName:"Location",description:"Dataset location (e.g. US, EU). Leave blank to use the default.",required:!1})},async run(t){let{project_id:e,dataset_id:r,table_id:n,set_expression:i,where_clause:u,location:c}=t.propsValue,l=await Ne(t.auth),f=`UPDATE ${`\`${e}.${r}.${n}\``} SET ${i} WHERE ${u}`,m=await Lu(l,e,f,c??void 0);return{success:!0,rows_updated:m.updatedRowCount,job_id:m.jobId}}});var NS=rt({auth:Oe,name:"find_one_row",displayName:"Find One Row",description:"Find a single row by specifying a WHERE clause and an optional ORDER BY. Returns the first matching row, or empty if none found.",audience:"both",aiMetadata:{description:'Looks up a single row in a BigQuery table that matches a SQL WHERE condition, with an optional ORDER BY to control which row is picked when several match. Choose this for a simple keyed lookup or "does this record exist" check rather than writing a full query. Read-only and idempotent; returns the first match (or a not-found flag) without altering data.',idempotent:!0},props:{project_id:qe,dataset_id:mt,table_id:ht,where_clause:K.LongText({displayName:"WHERE Clause",description:'SQL condition to filter rows. Do not include the WHERE keyword. Example: `email = "user@example.com"`',required:!0}),order_by:K.ShortText({displayName:"ORDER BY",description:"Optional column(s) to sort results before picking the first row. Example: `created_at DESC`",required:!1}),location:K.ShortText({displayName:"Location",description:"Dataset location (e.g. US, EU). Leave blank to use the default.",required:!1})},async run(t){let{project_id:e,dataset_id:r,table_id:n,where_clause:i,order_by:u,location:c}=t.propsValue,l=await Ne(t.auth),p=`\`${e}.${r}.${n}\``,f=u?` ORDER BY ${u}`:"",m=`SELECT * FROM ${p} WHERE ${i}${f} LIMIT 1`,S=(await Pe.sendRequest({method:"POST",url:`${xe}/projects/${e}/queries`,headers:{Authorization:`Bearer ${l}`},body:{query:m,useLegacySql:!1,maxResults:1,timeoutMs:1e4,...c?{location:c}:{}}})).body,h=S.schema?.fields??[];if(!S.jobComplete){let E=await ni(l,e,S.jobReference.jobId,c??void 0);S={...E,jobReference:S.jobReference},h=E.schema?.fields??h}let _=Dt(h,S.rows??[]),T=_.length>0;return{found:T,...T?_[0]:{}}}});var zS=rt({auth:Oe,name:"find_or_create_row",displayName:"Find or Create Record",description:"Searches for a row matching a WHERE clause. If found, returns it. If not found, inserts the provided row data and returns that.",audience:"both",aiMetadata:{description:"Finds the first row matching a SQL WHERE condition in a BigQuery table and returns it; if none matches, streams the supplied JSON row in and returns that instead, flagging whether it was found or created. Use it as a get-or-insert to avoid duplicates when ensuring a record exists. Conditionally idempotent: it only inserts when nothing matches, but because the WHERE condition and the inserted data are independent, a poorly aligned condition can let repeated calls insert duplicate rows.",idempotent:!1},props:{project_id:qe,dataset_id:mt,table_id:ht,where_clause:K.LongText({displayName:"WHERE Clause",description:'SQL condition to search for an existing row. Do not include WHERE. Example: `email = "user@example.com"`',required:!0}),create_data:K.Json({displayName:"Row to Create (if not found)",description:'A JSON object of column/value pairs to insert if no matching row exists. Example: `{"email": "user@example.com", "name": "Alice"}`',required:!0}),location:K.ShortText({displayName:"Location",description:"Dataset location (e.g. US, EU). Leave blank to use the default.",required:!1})},async run(t){let{project_id:e,dataset_id:r,table_id:n,where_clause:i,create_data:u,location:c}=t.propsValue,l=await Ne(t.auth),f=`SELECT * FROM ${`\`${e}.${r}.${n}\``} WHERE ${i} LIMIT 1`,g=(await Pe.sendRequest({method:"POST",url:`${xe}/projects/${e}/queries`,headers:{Authorization:`Bearer ${l}`},body:{query:f,useLegacySql:!1,maxResults:1,timeoutMs:1e4,...c?{location:c}:{}}})).body,S=g.schema?.fields??[];if(!g.jobComplete){let k=await ni(l,e,g.jobReference.jobId,c??void 0);g={...k,jobReference:g.jobReference},S=k.schema?.fields??S}let h=Dt(S,g.rows??[]);if(h.length>0)return{found:!0,created:!1,...h[0]};let _=u,T=`${Date.now()}-${Math.random().toString(36).slice(2,9)}`,w=(await Pe.sendRequest({method:"POST",url:`${xe}/projects/${e}/datasets/${r}/tables/${n}/insertAll`,headers:{Authorization:`Bearer ${l}`},body:{kind:"bigquery#tableDataInsertAllRequest",rows:[{insertId:T,json:_}]}})).body.insertErrors??[];if(w.length>0){let k=w[0]?.errors[0];throw new Error(`Row creation failed: ${k?.message??"Unknown error"} (reason: ${k?.reason??"unknown"})`)}return{found:!1,created:!0,insert_id:T,..._}}});var DS=rt({auth:Oe,name:"get_rows_for_job",displayName:"Get Rows for Job Completed",description:'Retrieves the result rows from a completed BigQuery query job by Job ID. Use this after a "Query Job Completed" trigger to fetch the full result set.',audience:"both",aiMetadata:{description:'Fetches the cached result rows of an already-completed BigQuery query job by its job ID, paginating up to the max-rows cap. Use it to retrieve the full result set after a "Query Job Completed" trigger or a "Run a Query" action hands you a job ID. The job must already be finished \u2014 it errors if the job is still running. Read-only and idempotent.',idempotent:!0},props:{project_id:qe,job_id:K.ShortText({displayName:"Job ID",description:'The BigQuery job ID to fetch results for. This is returned by the "Query Job Completed" trigger or a "Run a Query" action.',required:!0}),max_results:K.Number({displayName:"Max Rows",description:"Maximum number of rows to return (up to 10,000). Default: 1,000.",required:!1,defaultValue:1e3}),location:K.ShortText({displayName:"Location",description:"Dataset location where the job ran (e.g. US, EU). Leave blank for US.",required:!1})},async run(t){let{project_id:e,job_id:r,max_results:n,location:i}=t.propsValue,u=Math.min(n??1e3,1e4),c=await Ne(t.auth),l=[],p=[],f,m="0",g="0",S=!1;do{let _=u-l.length,E=(await Pe.sendRequest({method:"GET",url:`${xe}/projects/${e}/queries/${r}`,headers:{Authorization:`Bearer ${c}`},queryParams:{maxResults:String(Math.min(_,1e3)),timeoutMs:"10000",...f?{pageToken:f}:{},...i?{location:i}:{}}})).body;if(!E.jobComplete)throw new Error(`Job ${r} has not completed yet. Wait for the job to finish before fetching results.`);E.schema?.fields&&(p=E.schema.fields),l.push(...E.rows??[]),f=E.pageToken,m=E.totalRows??m,g=E.totalBytesProcessed??g,S=E.cacheHit??S}while(f&&l.length<u);let h=Dt(p,l.slice(0,u));return{rows:h,row_count:h.length,total_rows:parseInt(m,10),bytes_processed:g,cache_hit:S,job_id:r}}});var US=500;function R$(t){if(Array.isArray(t))return t;if(typeof t=="string"){let e=t.trim();return e.startsWith("[")?JSON.parse(e):e.split(`
66
- `).map(r=>r.trim()).filter(r=>r.length>0).map(r=>JSON.parse(r))}throw new Error("Data must be a JSON array or a newline-delimited JSON (NDJSON) string.")}o(R$,"parseInputData");var jS=rt({auth:Oe,name:"import_data",displayName:"Import Data",description:"Imports a batch of rows into a BigQuery table. Accepts a JSON array or newline-delimited JSON (NDJSON). Large datasets are automatically split into chunks.",audience:"both",aiMetadata:{description:"Bulk-imports rows into a BigQuery table via streaming inserts, accepting either a JSON array of objects or a newline-delimited JSON (NDJSON) string and automatically splitting large datasets into chunks. Choose this for ingesting a large or variably-formatted dataset in one step; optional flags control whether the batch fails on bad rows or skips invalid rows / unknown fields. Not idempotent: each call appends the rows again, duplicating data if re-run.",idempotent:!1},props:{project_id:qe,dataset_id:mt,table_id:ht,data:K.Json({displayName:"Data",description:"The data to import. Provide a JSON array of objects (`[{...}, {...}]`) or a newline-delimited JSON string where each line is one row object.",required:!0}),skip_invalid_rows:K.Checkbox({displayName:"Skip Invalid Rows",description:"Continue importing valid rows even if some rows fail validation. Default: off (fail entire batch).",required:!1,defaultValue:!1}),ignore_unknown_values:K.Checkbox({displayName:"Ignore Unknown Fields",description:"Silently drop fields not present in the table schema. Default: off (fail on unknown fields).",required:!1,defaultValue:!1})},async run(t){let{project_id:e,dataset_id:r,table_id:n,data:i,skip_invalid_rows:u,ignore_unknown_values:c}=t.propsValue,l=R$(i);if(l.length===0)throw new Error("Data contains no rows to import.");let p=await Ne(t.auth),f=Date.now(),m=0,g=0,S=[];for(let h=0;h<l.length;h+=US){let _=l.slice(h,h+US),T=_.map((k,q)=>({insertId:`${f}-${h+q}-${Math.random().toString(36).slice(2,9)}`,json:k})),w=(await Pe.sendRequest({method:"POST",url:`${xe}/projects/${e}/datasets/${r}/tables/${n}/insertAll`,headers:{Authorization:`Bearer ${p}`},body:{kind:"bigquery#tableDataInsertAllRequest",skipInvalidRows:u??!1,ignoreUnknownValues:c??!1,rows:T}})).body.insertErrors??[];if(w.length>0&&!(u??!1)){let k=w[0]?.errors[0];throw new Error(`Import failed on row ${h+(w[0]?.index??0)}: ${k?.message??"Unknown error"}`)}m+=_.length-w.length,g+=w.length,S.push(...w.map(k=>({row_index:h+k.index,first_error:k.errors[0]?.message??"Unknown",reason:k.errors[0]?.reason??null})))}return{success:g===0,rows_attempted:l.length,rows_imported:m,error_count:g,errors:S}}});var C$={project_id:qe,dataset_id:mt,table_id:ht,sort_column:K.ShortText({displayName:"Sort Column",description:"Name of the column used to detect new rows. The table is ordered by this column (DESC) and any row newer than the last check is returned. Use a TIMESTAMP or DATETIME column, e.g. `created_at`.",required:!0}),max_results:K.Number({displayName:"Max Rows per Check",description:"Maximum number of new rows to return per poll (default: 500).",required:!1,defaultValue:500})},Fu={strategy:0,items:o(async({auth:t,propsValue:e,lastFetchEpochMS:r})=>{let{project_id:n,dataset_id:i,table_id:u,sort_column:c,max_results:l}=e,p=l??500,f=await Ne(t),m=r??Date.now()-10080*60*1e3,g=`\`${n}.${i}.${u}\``,S=c,h=`SELECT * FROM ${g} WHERE \`${S}\` > TIMESTAMP_MILLIS(${m}) ORDER BY \`${S}\` ASC LIMIT ${p}`,T=(await Pe.sendRequest({method:"POST",url:`${xe}/projects/${n}/queries`,headers:{Authorization:`Bearer ${f}`},body:{query:h,useLegacySql:!1,maxResults:p,timeoutMs:3e4}})).body;if(!T.jobComplete)for(let k=0;k<30&&!T.jobComplete;k++)T=(await Pe.sendRequest({method:"GET",url:`${xe}/projects/${n}/queries/${T.jobReference.jobId}`,headers:{Authorization:`Bearer ${f}`},queryParams:{timeoutMs:"10000",maxResults:String(p)}})).body;let E=T.schema?.fields??[];return Dt(E,T.rows??[]).map(k=>{let q=k[S],G;if(typeof q=="string"){let V=parseFloat(q);G=!isNaN(V)&&V>1e9?V*1e3:new Date(q).getTime()}else typeof q=="number"?G=q>1e12?q:q*1e3:G=Date.now();return{epochMilliSeconds:G,data:k}})},"items")},MS=Pn({auth:Oe,name:"new_row",displayName:"New Row",description:"Triggers when a new row is added to a BigQuery table. Polls every 5 minutes by comparing the latest value in a sort column against the previous check.",aiMetadata:{description:"Fires for each new row appended to a BigQuery table, detected by polling a TIMESTAMP/DATETIME sort column for values newer than the previous check. Each event represents one newly inserted row. Detection depends entirely on the chosen sort column advancing for new rows."},props:C$,sampleData:{id:"1",created_at:"2024-01-15T10:30:00Z",name:"Example row"},type:"POLLING",async test(t){return await nt.test(Fu,t)},async onEnable(t){await nt.onEnable(Fu,t)},async onDisable(t){await nt.onDisable(Fu,t)},async run(t){return await nt.poll(Fu,t)}});var O$={project_id:qe,dataset_id:mt,table_id:ht,updated_at_column:K.ShortText({displayName:"Updated At Column",description:"Name of the TIMESTAMP column that records when a row was last updated, e.g. `updated_at`. Rows where this column is newer than the last check are returned.",required:!0}),created_at_column:K.ShortText({displayName:"Created At Column (optional)",description:"If provided, only rows where the updated timestamp is newer than the created timestamp are returned, excluding brand-new rows from the results.",required:!1}),max_results:K.Number({displayName:"Max Rows per Check",description:"Maximum number of updated rows to return per poll (default: 500).",required:!1,defaultValue:500})},Bu={strategy:0,items:o(async({auth:t,propsValue:e,lastFetchEpochMS:r})=>{let{project_id:n,dataset_id:i,table_id:u,updated_at_column:c,created_at_column:l,max_results:p}=e,f=p??500,m=await Ne(t),g=r??Date.now()-10080*60*1e3,S=`\`${n}.${i}.${u}\``,h=c,_=l?` AND \`${l}\` < TIMESTAMP_MILLIS(${g})`:"",T=[`SELECT * FROM ${S}`,`WHERE \`${h}\` > TIMESTAMP_MILLIS(${g})${_}`,`ORDER BY \`${h}\` ASC`,`LIMIT ${f}`].join(" "),w=(await Pe.sendRequest({method:"POST",url:`${xe}/projects/${n}/queries`,headers:{Authorization:`Bearer ${m}`},body:{query:T,useLegacySql:!1,maxResults:f,timeoutMs:3e4}})).body;if(!w.jobComplete)for(let G=0;G<30&&!w.jobComplete;G++)w=(await Pe.sendRequest({method:"GET",url:`${xe}/projects/${n}/queries/${w.jobReference.jobId}`,headers:{Authorization:`Bearer ${m}`},queryParams:{timeoutMs:"10000",maxResults:String(f)}})).body;let k=w.schema?.fields??[];return Dt(k,w.rows??[]).map(G=>{let V=G[h],H;if(typeof V=="string"){let J=parseFloat(V);H=!isNaN(J)&&J>1e9?J*1e3:new Date(V).getTime()}else typeof V=="number"?H=V>1e12?V:V*1e3:H=Date.now();return{epochMilliSeconds:H,data:G}})},"items")},LS=Pn({auth:Oe,name:"updated_row",displayName:"Updated Row",description:"Triggers when an existing row is updated in a BigQuery table. Requires an `updated_at` TIMESTAMP column that is set whenever a row changes.",aiMetadata:{description:"Fires for each row whose updated-at TIMESTAMP column advances past the previous check, representing a modified row in a BigQuery table. Requires that column to be set whenever a row changes; supplying an optional created-at column excludes brand-new rows so only genuine updates fire."},props:O$,sampleData:{id:"1",updated_at:"2024-01-15T10:30:00Z",status:"active"},type:"POLLING",async test(t){return await nt.test(Bu,t)},async onEnable(t){await nt.onEnable(Bu,t)},async onDisable(t){await nt.onDisable(Bu,t)},async run(t){return await nt.poll(Bu,t)}});var k$={project_id:qe,max_rows_per_job:K.Number({displayName:"Max Rows per Job",description:"Maximum number of result rows to fetch per completed job (default: 500).",required:!1,defaultValue:500})},qu={strategy:0,items:o(async({auth:t,propsValue:e,lastFetchEpochMS:r})=>{let{project_id:n,max_rows_per_job:i}=e,u=i??500,c=await Ne(t),l=(r??Date.now()-1440*60*1e3)-3600*1e3,f=((await Pe.sendRequest({method:"GET",url:`${xe}/projects/${n}/jobs`,headers:{Authorization:`Bearer ${c}`},queryParams:{stateFilter:"done",projection:"full",minCreationTime:String(l),maxResults:"50"}})).body.jobs??[]).filter(g=>g.configuration.jobType==="QUERY"&&!g.status.errorResult&&parseInt(g.statistics.endTime??"0",10)>(r??0)),m=[];for(let g of f){let S=g.jobReference.jobId,h=g.jobReference.location,_=parseInt(g.statistics.endTime??"0",10),T=[],E=[],w;do{let q=await Pe.sendRequest({method:"GET",url:`${xe}/projects/${n}/queries/${S}`,headers:{Authorization:`Bearer ${c}`},queryParams:{maxResults:String(Math.min(u-T.length,1e3)),timeoutMs:"5000",...w?{pageToken:w}:{},...h?{location:h}:{}}});q.body.schema?.fields&&(E=q.body.schema.fields),T.push(...q.body.rows??[]),w=q.body.pageToken}while(w&&T.length<u);let k=Dt(E,T.slice(0,u));m.push({epochMilliSeconds:_,data:{job_id:S,project_id:g.jobReference.projectId,location:h??null,query:g.configuration.query?.query??null,completed_at:g.statistics.endTime?new Date(_).toISOString():null,bytes_processed:g.statistics.query?.totalBytesProcessed??null,cache_hit:g.statistics.query?.cacheHit??null,user_email:g.user_email??null,row_count:k.length,rows:k}})}return m},"items")},FS=Pn({auth:Oe,name:"query_job_completed",displayName:"Query Job Completed (With Row Data)",description:"Triggers when a BigQuery query job finishes successfully. Each flow run receives the job metadata and the result rows from that query.",aiMetadata:{description:"Fires when a successful (non-errored) QUERY-type job completes in the BigQuery project, detected by polling the project job history. Each event represents one finished query job and carries its metadata plus the fetched result rows. Only query jobs are surfaced; load, copy, and extract jobs are ignored."},props:k$,sampleData:{job_id:"job_abc123",project_id:"my-project",query:"SELECT * FROM my_dataset.my_table LIMIT 10",completed_at:"2024-01-15T10:30:00Z",bytes_processed:"1024",cache_hit:!1,row_count:2,rows:[{id:"1",name:"Alice"},{id:"2",name:"Bob"}]},type:"POLLING",async test(t){return await nt.test(qu,t)},async onEnable(t){await nt.onEnable(qu,t)},async onDisable(t){await nt.onDisable(qu,t)},async run(t){return await nt.poll(qu,t)}});var $$={project_id:qe,include_failed:K.Checkbox({displayName:"Include Failed Jobs",description:"If enabled, jobs that completed with an error are also returned. Default: off (only successful jobs).",required:!1,defaultValue:!1})},Vu={strategy:0,items:o(async({auth:t,propsValue:e,lastFetchEpochMS:r})=>{let{project_id:n,include_failed:i}=e,u=await Ne(t),c=(r??Date.now()-1440*60*1e3)-3600*1e3;return((await Pe.sendRequest({method:"GET",url:`${xe}/projects/${n}/jobs`,headers:{Authorization:`Bearer ${u}`},queryParams:{stateFilter:"done",projection:"full",minCreationTime:String(c),maxResults:"100"}})).body.jobs??[]).filter(f=>!(parseInt(f.statistics.endTime??"0",10)<=(r??0)||!(i??!1)&&f.status.errorResult)).map(f=>{let m=parseInt(f.statistics.endTime??"0",10),g=f.statistics.query?.dmlStats;return{epochMilliSeconds:m,data:{job_id:f.jobReference.jobId,project_id:f.jobReference.projectId,location:f.jobReference.location??null,job_type:f.configuration.jobType,status:f.status.errorResult?"FAILED":"SUCCESS",error_message:f.status.errorResult?.message??null,error_reason:f.status.errorResult?.reason??null,query:f.configuration.query?.query??null,created_at:f.statistics.creationTime?new Date(parseInt(f.statistics.creationTime,10)).toISOString():null,started_at:f.statistics.startTime?new Date(parseInt(f.statistics.startTime,10)).toISOString():null,completed_at:m?new Date(m).toISOString():null,bytes_processed:f.statistics.query?.totalBytesProcessed??f.statistics.totalBytesProcessed??null,cache_hit:f.statistics.query?.cacheHit??null,dml_inserted_rows:g?.insertedRowCount??null,dml_deleted_rows:g?.deletedRowCount??null,dml_updated_rows:g?.updatedRowCount??null,user_email:f.user_email??null}}})},"items")},BS=Pn({auth:Oe,name:"new_job_completed",displayName:"New Job Completed",description:"Triggers when any BigQuery job (query, load, copy, or extract) finishes. Returns the job metadata including status, type, and timing.",aiMetadata:{description:"Fires when any BigQuery job of any type (query, load, copy, or extract) finishes in the project, detected by polling the job history. Each event represents one completed job and carries its metadata \u2014 type, status, timing, bytes processed, and DML row counts. By default only successful jobs fire; enabling the include-failed option also surfaces jobs that ended with an error."},props:$$,sampleData:{job_id:"job_xyz789",project_id:"my-project",job_type:"QUERY",status:"SUCCESS",error_message:null,query:"SELECT COUNT(*) FROM my_dataset.events",completed_at:"2024-01-15T10:30:00Z",bytes_processed:"2048",cache_hit:!1,user_email:"user@example.com"},type:"POLLING",async test(t){return await nt.test(Vu,t)},async onEnable(t){await nt.onEnable(Vu,t)},async onDisable(t){await nt.onDisable(Vu,t)},async run(t){return await nt.poll(Vu,t)}});var N$=ig({displayName:"Google BigQuery",description:"Query, analyze, and stream data into Google BigQuery \u2014 the fully managed, serverless data warehouse",minimumSupportedRelease:"0.36.1",logoUrl:"https://cdn.activepieces.com/pieces/google-bigquery.png",categories:["BUSINESS_INTELLIGENCE"],authors:["AhmadTash"],auth:Oe,actions:[RS,CS,OS,kS,$S,NS,zS,DS,jS,E_({baseUrl:o(()=>xe,"baseUrl"),auth:Oe,authMapping:o(async t=>({Authorization:`Bearer ${await Ne(t)}`}),"authMapping")})],triggers:[MS,LS,FS,BS]});0&&(module.exports={bigQueryAuth,googleBigQuery});
65
+ 8. A \`.json\` file will download \u2014 open it in a text editor and paste the entire contents into the field below.`}),serviceAccountJson:K.ShortText({displayName:"Service Account JSON",description:"Paste the full contents of the downloaded .json key file here",required:!0})},validate:o(async({auth:t})=>{try{let e=JSON.parse(t.serviceAccountJson);if(!e.client_email||!e.private_key)return{valid:!1,error:'Service account JSON must contain "client_email" and "private_key" fields'};if(!(await new Gp.JWT({email:e.client_email,key:e.private_key,scopes:Hp}).getAccessToken()).token)throw new Error("Empty token returned");return{valid:!0}}catch(e){return{valid:!1,error:`Service account authentication failed: ${e.message}`}}},"validate")})];async function Ne(t){if(t.type==="CUSTOM_AUTH"){let e=JSON.parse(t.props.serviceAccountJson),n=await new Gp.JWT({email:e.client_email,key:e.private_key,scopes:Hp}).getAccessToken();if(n.token)return n.token;throw new Error("Could not retrieve access token from service account JSON")}return t.access_token}o(Ne,"getAccessToken");var Ve=K.Dropdown({auth:ke,displayName:"Project",description:"Select your Google Cloud project",refreshers:[],required:!0,options:o(async({auth:t})=>{if(!t)return{disabled:!0,options:[],placeholder:"Please connect your account first"};try{let e=await Ne(t);return{disabled:!1,options:((await Se.sendRequest({method:"GET",url:`${Ae}/projects`,headers:{Authorization:`Bearer ${e}`},queryParams:{maxResults:"200"}})).body.projects??[]).map(i=>({label:i.friendlyName?`${i.friendlyName} (${i.projectReference.projectId})`:i.projectReference.projectId,value:i.projectReference.projectId}))}}catch{return{disabled:!0,options:[],placeholder:"Failed to load projects. Check your connection."}}},"options")}),ht=K.Dropdown({auth:ke,displayName:"Dataset",description:"Select the BigQuery dataset",refreshers:["project_id"],required:!0,options:o(async({auth:t,project_id:e})=>{if(!t||!e)return{disabled:!0,options:[],placeholder:"Please select a project first"};try{let r=await Ne(t),n=[],i;do{let u=await Se.sendRequest({method:"GET",url:`${Ae}/projects/${e}/datasets`,headers:{Authorization:`Bearer ${r}`},queryParams:{maxResults:"200",...i?{pageToken:i}:{}}});for(let c of u.body.datasets??[])n.push({label:c.friendlyName??c.datasetReference.datasetId,value:c.datasetReference.datasetId});i=u.body.nextPageToken}while(i);return{disabled:!1,options:n}}catch{return{disabled:!0,options:[],placeholder:"Failed to load datasets. Check your project selection."}}},"options")}),gt=K.Dropdown({auth:ke,displayName:"Table",description:"Select the BigQuery table",refreshers:["project_id","dataset_id"],required:!0,options:o(async({auth:t,project_id:e,dataset_id:r})=>{if(!t||!e||!r)return{disabled:!0,options:[],placeholder:"Please select a project and dataset first"};try{let n=await Ne(t),i=[],u;do{let c=await Se.sendRequest({method:"GET",url:`${Ae}/projects/${e}/datasets/${r}/tables`,headers:{Authorization:`Bearer ${n}`},queryParams:{maxResults:"200",...u?{pageToken:u}:{}}});for(let l of c.body.tables??[]){let p=l.friendlyName?`${l.friendlyName} (${l.tableReference.tableId})`:l.tableReference.tableId;i.push({label:p,value:l.tableReference.tableId})}u=c.body.nextPageToken}while(u);return{disabled:!1,options:i}}catch{return{disabled:!0,options:[],placeholder:"Failed to load tables. Check your dataset selection."}}},"options")});function Dt(t,e){return e.map(r=>{let n={};return t.forEach((i,u)=>{let c=r.f[u]?.v;c==null?n[i.name]=null:Array.isArray(c)?n[i.name]=c.map(l=>typeof l.v=="object"?JSON.stringify(l.v):String(l.v??"")).join(", "):typeof c=="object"?n[i.name]=JSON.stringify(c):n[i.name]=c}),n})}o(Dt,"bigQueryRowsToFlat");async function DP(t,e,r,n){return(await Se.sendRequest({method:"GET",url:`${Ae}/projects/${e}/datasets/${r}/tables/${n}`,headers:{Authorization:`Bearer ${t}`},queryParams:{fields:"schema"}})).body.schema?.fields??[]}o(DP,"getTableSchema");async function Fu(t,e,r,n){let u=(await Se.sendRequest({method:"POST",url:`${Ae}/projects/${e}/queries`,headers:{Authorization:`Bearer ${t}`},body:{query:r,useLegacySql:!1,timeoutMs:1e4,...n?{location:n}:{}}})).body.jobReference.jobId;for(let c=0;c<60;c++){let l=await Se.sendRequest({method:"GET",url:`${Ae}/projects/${e}/jobs/${u}`,headers:{Authorization:`Bearer ${t}`},queryParams:{...n?{location:n}:{}}});if(l.body.status.state==="DONE"){if(l.body.status.errorResult)throw new Error(`Query failed: ${l.body.status.errorResult.message}`);let p=l.body.statistics?.query?.dmlStats??{},f=parseInt(p.deletedRowCount??"0",10),m=parseInt(p.updatedRowCount??"0",10),y=parseInt(p.insertedRowCount??"0",10);return{jobId:u,affectedRowCount:f+m+y,deletedRowCount:f,updatedRowCount:m,insertedRowCount:y}}await new Promise(p=>setTimeout(p,2e3))}throw new Error("DML query timed out after 2 minutes.")}o(Fu,"runDmlQuery");async function oi(t,e,r,n){for(let i=0;i<60;i++){let u=await Se.sendRequest({method:"GET",url:`${Ae}/projects/${e}/queries/${r}`,headers:{Authorization:`Bearer ${t}`},queryParams:{timeoutMs:"10000",maxResults:"1000",...n?{location:n}:{}}});if(u.body.jobComplete)return u.body}throw new Error("Query did not complete within 10 minutes. Try simplifying your query or using a smaller dataset.")}o(oi,"waitForJobResults");var UP=nt({auth:ke,name:"run_query",classification:"WRITE",displayName:"Run a Query",description:"Execute a SQL query on BigQuery and return the results as flat rows",audience:"both",aiMetadata:{description:"Runs an arbitrary standard-SQL (or legacy-SQL) statement against BigQuery in a given project and returns the result rows, paginating up to the max-rows cap. Use it for any ad-hoc read or aggregation when no purpose-built action fits, or when you need full SQL control. Note that BigQuery SQL is not limited to reads \u2014 a DML/DDL statement passed here will mutate data \u2014 so idempotency depends on the query you supply; a plain SELECT is safe to repeat.",idempotent:!1},props:{project_id:Ve,query:K.LongText({displayName:"SQL Query",description:"The SQL query to run. Uses standard SQL syntax. Example: `SELECT * FROM \\`my_dataset.my_table\\` LIMIT 100`",required:!0}),max_results:K.Number({displayName:"Max Rows",description:"Maximum number of rows to return (up to 10,000)",required:!1,defaultValue:1e3}),location:K.ShortText({displayName:"Location",description:"Geographic location of your dataset (e.g. US, EU, us-central1). Leave blank for US.",required:!1}),use_legacy_sql:K.Checkbox({displayName:"Use Legacy SQL",description:"Enable only if your query uses BigQuery Legacy SQL syntax (not recommended)",required:!1,defaultValue:!1})},async run(t){let{project_id:e,query:r,max_results:n,location:i,use_legacy_sql:u}=t.propsValue,c=Math.min(n??1e3,1e4),l=await Ne(t.auth),f=(await Se.sendRequest({method:"POST",url:`${Ae}/projects/${e}/queries`,headers:{Authorization:`Bearer ${l}`},body:{query:r,useLegacySql:u??!1,maxResults:Math.min(c,1e3),timeoutMs:1e4,...i?{location:i}:{}}})).body,m=f.schema?.fields??[];if(!f.jobComplete){let b=f.jobReference.jobId,T=await oi(l,e,b,i??void 0);f={...T,jobReference:{projectId:e,jobId:b}},m=T.schema?.fields??m}let y=[...f.rows??[]],P=f.pageToken;for(;P&&y.length<c;){let b=c-y.length,T=await Se.sendRequest({method:"GET",url:`${Ae}/projects/${e}/queries/${f.jobReference.jobId}`,headers:{Authorization:`Bearer ${l}`},queryParams:{pageToken:P,maxResults:String(Math.min(b,1e3)),...i?{location:i}:{}}});y.push(...T.body.rows??[]),P=T.body.pageToken}let h=Dt(m,y.slice(0,c));return{rows:h,row_count:h.length,total_rows:parseInt(f.totalRows??"0",10),bytes_processed:f.totalBytesProcessed??"0",job_id:f.jobReference?.jobId??null,cache_hit:f.cacheHit??!1}}});function j$(t){let e=`Type: ${t.type}${t.mode?` \xB7 Mode: ${t.mode}`:""}`;return K.ShortText({displayName:t.name,description:e,required:t.mode==="REQUIRED"})}o(j$,"fieldToProperty");var jP=nt({auth:ke,name:"create_row",classification:"WRITE",displayName:"Create Row",description:"Creates a single new row in a BigQuery table. Column fields are loaded from the table schema.",audience:"both",aiMetadata:{description:"Streams one new row into a BigQuery table via the streaming insert API, with each column supplied as a separate value (loaded from the live table schema; empty values are dropped rather than written as nulls). Choose this when an agent has a single record to append and knows the target project, dataset, and table. Not idempotent: each call appends another row, so repeating it duplicates the record.",idempotent:!1},props:{project_id:Ve,dataset_id:ht,table_id:gt,values:K.DynamicProperties({displayName:"Row Values",description:"Enter a value for each column. Fields are loaded from the table schema.",required:!0,auth:ke,refreshers:["project_id","dataset_id","table_id"],props:o(async({auth:t,project_id:e,dataset_id:r,table_id:n})=>{if(!t||!e||!r||!n)return{};try{let i=await Ne(t),u=await DP(i,e,r,n);return Object.fromEntries(u.filter(c=>c.type!=="RECORD").map(c=>[c.name,j$(c)]))}catch{return{}}},"props")})},async run(t){let{project_id:e,dataset_id:r,table_id:n,values:i}=t.propsValue,u=await Ne(t.auth),l=Object.fromEntries(Object.entries(i).filter(([,y])=>y!==""&&y!==null&&y!==void 0)),p=`${Date.now()}-${Math.random().toString(36).slice(2,9)}`,m=(await Se.sendRequest({method:"POST",url:`${Ae}/projects/${e}/datasets/${r}/tables/${n}/insertAll`,headers:{Authorization:`Bearer ${u}`},body:{kind:"bigquery#tableDataInsertAllRequest",rows:[{insertId:p,json:l}]}})).body.insertErrors??[];if(m.length>0){let y=m[0]?.errors[0];throw new Error(`Row insert failed: ${y?.message??"Unknown error"} (reason: ${y?.reason??"unknown"}, field: ${y?.location??"unknown"})`)}return{success:!0,insert_id:p,...l}}});var MP=nt({auth:ke,name:"create_rows",classification:"WRITE",displayName:"Create Rows",description:"Creates new rows of data in a BigQuery table (accepts an array of row objects). Rows are available to query within seconds.",audience:"both",aiMetadata:{description:"Streams a batch of rows into a BigQuery table in one streaming-insert call, taking a JSON array of objects whose keys match the column names. Choose this over Create Row when appending multiple records at once. Optional flags control whether the whole batch fails on a bad row or skips invalid rows / unknown fields. Not idempotent: every call appends the rows again, so repeating it duplicates them.",idempotent:!1},props:{project_id:Ve,dataset_id:ht,table_id:gt,rows:K.Json({displayName:"Rows",description:'An array of row objects to insert. Keys must match the table column names. Example: `[{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]`',required:!0}),skip_invalid_rows:K.Checkbox({displayName:"Skip Invalid Rows",description:"If enabled, valid rows are inserted even when some rows in the batch are invalid. If disabled (default), the entire batch fails if any row is invalid.",required:!1,defaultValue:!1}),ignore_unknown_values:K.Checkbox({displayName:"Ignore Unknown Fields",description:"If enabled, fields not in the table schema are silently discarded. If disabled (default), unknown fields cause the row to fail.",required:!1,defaultValue:!1})},async run(t){let{project_id:e,dataset_id:r,table_id:n,rows:i,skip_invalid_rows:u,ignore_unknown_values:c}=t.propsValue;if(!Array.isArray(i)||i.length===0)throw new Error('Rows must be a non-empty JSON array of objects, e.g. [{"column": "value"}]');let l=await Ne(t.auth),p=Date.now(),f=i.map((h,b)=>({insertId:`${p}-${b}-${Math.random().toString(36).slice(2,9)}`,json:h})),y=(await Se.sendRequest({method:"POST",url:`${Ae}/projects/${e}/datasets/${r}/tables/${n}/insertAll`,headers:{Authorization:`Bearer ${l}`},body:{kind:"bigquery#tableDataInsertAllRequest",skipInvalidRows:u??!1,ignoreUnknownValues:c??!1,rows:f}})).body.insertErrors??[];if(y.length>0&&!(u??!1)){let h=y[0]?.errors[0];throw new Error(`Insert failed on row ${y[0]?.index}: ${h?.message??"Unknown error"} (reason: ${h?.reason??"unknown"})`)}let P=y.map(h=>({row_index:h.index,error_count:h.errors.length,first_error_reason:h.errors[0]?.reason??null,first_error_location:h.errors[0]?.location??null,first_error_message:h.errors[0]?.message??null}));return{success:y.length===0,rows_attempted:i.length,rows_inserted:i.length-y.length,error_count:y.length,errors:P}}});var LP=nt({auth:ke,name:"delete_rows",classification:"DESTRUCTIVE",displayName:"Delete Rows",description:"Deletes one or more rows from a BigQuery table using a SQL WHERE condition.",audience:"both",aiMetadata:{description:"Deletes every row matching a SQL WHERE condition from a BigQuery table by running a DELETE DML statement (supply only the condition body, without the WHERE keyword). Use it to remove records that meet a filter. Effectively idempotent on the same data \u2014 a repeat matches no remaining rows \u2014 but it is a destructive mutation, so an overly broad condition can remove far more than intended.",idempotent:!1},props:{project_id:Ve,dataset_id:ht,table_id:gt,where_clause:K.LongText({displayName:"WHERE Clause",description:'SQL condition to match the rows to delete. Do not include the WHERE keyword. Example: `status = "inactive" AND created_at < "2023-01-01"`',required:!0}),location:K.ShortText({displayName:"Location",description:"Dataset location (e.g. US, EU). Leave blank to use the default.",required:!1})},async run(t){let{project_id:e,dataset_id:r,table_id:n,where_clause:i,location:u}=t.propsValue,c=await Ne(t.auth),p=`DELETE FROM ${`\`${e}.${r}.${n}\``} WHERE ${i}`,f=await Fu(c,e,p,u??void 0);return{success:!0,rows_deleted:f.deletedRowCount,job_id:f.jobId}}});var FP=nt({auth:ke,name:"update_rows",classification:"WRITE",displayName:"Update Row(s)",description:"Updates one or more existing rows in a BigQuery table using SQL SET and WHERE expressions.",audience:"both",aiMetadata:{description:"Updates rows in a BigQuery table by running an UPDATE DML statement, applying a comma-separated SET assignment to every row matching a WHERE condition (supply both as raw SQL fragments without the SET/WHERE keywords). Use it to change column values on existing records. Mutates state on each run, so it is not safe to assume idempotency \u2014 assignments to fixed literal values repeat harmlessly, but relative expressions (e.g. incrementing a counter) compound on every call.",idempotent:!1},props:{project_id:Ve,dataset_id:ht,table_id:gt,set_expression:K.LongText({displayName:"SET Expression",description:'Comma-separated column assignments. Do not include the SET keyword. Example: `status = "active", updated_at = CURRENT_TIMESTAMP()`',required:!0}),where_clause:K.LongText({displayName:"WHERE Clause",description:'SQL condition to match the rows to update. Do not include the WHERE keyword. Example: `id = "abc123"`',required:!0}),location:K.ShortText({displayName:"Location",description:"Dataset location (e.g. US, EU). Leave blank to use the default.",required:!1})},async run(t){let{project_id:e,dataset_id:r,table_id:n,set_expression:i,where_clause:u,location:c}=t.propsValue,l=await Ne(t.auth),f=`UPDATE ${`\`${e}.${r}.${n}\``} SET ${i} WHERE ${u}`,m=await Fu(l,e,f,c??void 0);return{success:!0,rows_updated:m.updatedRowCount,job_id:m.jobId}}});var BP=nt({auth:ke,name:"find_one_row",classification:"SEARCH",displayName:"Find One Row",description:"Find a single row by specifying a WHERE clause and an optional ORDER BY. Returns the first matching row, or empty if none found.",audience:"both",aiMetadata:{description:'Looks up a single row in a BigQuery table that matches a SQL WHERE condition, with an optional ORDER BY to control which row is picked when several match. Choose this for a simple keyed lookup or "does this record exist" check rather than writing a full query. Read-only and idempotent; returns the first match (or a not-found flag) without altering data.',idempotent:!0},props:{project_id:Ve,dataset_id:ht,table_id:gt,where_clause:K.LongText({displayName:"WHERE Clause",description:'SQL condition to filter rows. Do not include the WHERE keyword. Example: `email = "user@example.com"`',required:!0}),order_by:K.ShortText({displayName:"ORDER BY",description:"Optional column(s) to sort results before picking the first row. Example: `created_at DESC`",required:!1}),location:K.ShortText({displayName:"Location",description:"Dataset location (e.g. US, EU). Leave blank to use the default.",required:!1})},async run(t){let{project_id:e,dataset_id:r,table_id:n,where_clause:i,order_by:u,location:c}=t.propsValue,l=await Ne(t.auth),p=`\`${e}.${r}.${n}\``,f=u?` ORDER BY ${u}`:"",m=`SELECT * FROM ${p} WHERE ${i}${f} LIMIT 1`,P=(await Se.sendRequest({method:"POST",url:`${Ae}/projects/${e}/queries`,headers:{Authorization:`Bearer ${l}`},body:{query:m,useLegacySql:!1,maxResults:1,timeoutMs:1e4,...c?{location:c}:{}}})).body,h=P.schema?.fields??[];if(!P.jobComplete){let E=await oi(l,e,P.jobReference.jobId,c??void 0);P={...E,jobReference:P.jobReference},h=E.schema?.fields??h}let b=Dt(h,P.rows??[]),T=b.length>0;return{found:T,...T?b[0]:{}}}});var qP=nt({auth:ke,name:"find_or_create_row",classification:"WRITE",displayName:"Find or Create Record",description:"Searches for a row matching a WHERE clause. If found, returns it. If not found, inserts the provided row data and returns that.",audience:"both",aiMetadata:{description:"Finds the first row matching a SQL WHERE condition in a BigQuery table and returns it; if none matches, streams the supplied JSON row in and returns that instead, flagging whether it was found or created. Use it as a get-or-insert to avoid duplicates when ensuring a record exists. Conditionally idempotent: it only inserts when nothing matches, but because the WHERE condition and the inserted data are independent, a poorly aligned condition can let repeated calls insert duplicate rows.",idempotent:!1},props:{project_id:Ve,dataset_id:ht,table_id:gt,where_clause:K.LongText({displayName:"WHERE Clause",description:'SQL condition to search for an existing row. Do not include WHERE. Example: `email = "user@example.com"`',required:!0}),create_data:K.Json({displayName:"Row to Create (if not found)",description:'A JSON object of column/value pairs to insert if no matching row exists. Example: `{"email": "user@example.com", "name": "Alice"}`',required:!0}),location:K.ShortText({displayName:"Location",description:"Dataset location (e.g. US, EU). Leave blank to use the default.",required:!1})},async run(t){let{project_id:e,dataset_id:r,table_id:n,where_clause:i,create_data:u,location:c}=t.propsValue,l=await Ne(t.auth),f=`SELECT * FROM ${`\`${e}.${r}.${n}\``} WHERE ${i} LIMIT 1`,y=(await Se.sendRequest({method:"POST",url:`${Ae}/projects/${e}/queries`,headers:{Authorization:`Bearer ${l}`},body:{query:f,useLegacySql:!1,maxResults:1,timeoutMs:1e4,...c?{location:c}:{}}})).body,P=y.schema?.fields??[];if(!y.jobComplete){let k=await oi(l,e,y.jobReference.jobId,c??void 0);y={...k,jobReference:y.jobReference},P=k.schema?.fields??P}let h=Dt(P,y.rows??[]);if(h.length>0)return{found:!0,created:!1,...h[0]};let b=u,T=`${Date.now()}-${Math.random().toString(36).slice(2,9)}`,w=(await Se.sendRequest({method:"POST",url:`${Ae}/projects/${e}/datasets/${r}/tables/${n}/insertAll`,headers:{Authorization:`Bearer ${l}`},body:{kind:"bigquery#tableDataInsertAllRequest",rows:[{insertId:T,json:b}]}})).body.insertErrors??[];if(w.length>0){let k=w[0]?.errors[0];throw new Error(`Row creation failed: ${k?.message??"Unknown error"} (reason: ${k?.reason??"unknown"})`)}return{found:!1,created:!0,insert_id:T,...b}}});var VP=nt({auth:ke,name:"get_rows_for_job",classification:"READ",displayName:"Get Rows for Job Completed",description:'Retrieves the result rows from a completed BigQuery query job by Job ID. Use this after a "Query Job Completed" trigger to fetch the full result set.',audience:"both",aiMetadata:{description:'Fetches the cached result rows of an already-completed BigQuery query job by its job ID, paginating up to the max-rows cap. Use it to retrieve the full result set after a "Query Job Completed" trigger or a "Run a Query" action hands you a job ID. The job must already be finished \u2014 it errors if the job is still running. Read-only and idempotent.',idempotent:!0},props:{project_id:Ve,job_id:K.ShortText({displayName:"Job ID",description:'The BigQuery job ID to fetch results for. This is returned by the "Query Job Completed" trigger or a "Run a Query" action.',required:!0}),max_results:K.Number({displayName:"Max Rows",description:"Maximum number of rows to return (up to 10,000). Default: 1,000.",required:!1,defaultValue:1e3}),location:K.ShortText({displayName:"Location",description:"Dataset location where the job ran (e.g. US, EU). Leave blank for US.",required:!1})},async run(t){let{project_id:e,job_id:r,max_results:n,location:i}=t.propsValue,u=Math.min(n??1e3,1e4),c=await Ne(t.auth),l=[],p=[],f,m="0",y="0",P=!1;do{let b=u-l.length,E=(await Se.sendRequest({method:"GET",url:`${Ae}/projects/${e}/queries/${r}`,headers:{Authorization:`Bearer ${c}`},queryParams:{maxResults:String(Math.min(b,1e3)),timeoutMs:"10000",...f?{pageToken:f}:{},...i?{location:i}:{}}})).body;if(!E.jobComplete)throw new Error(`Job ${r} has not completed yet. Wait for the job to finish before fetching results.`);E.schema?.fields&&(p=E.schema.fields),l.push(...E.rows??[]),f=E.pageToken,m=E.totalRows??m,y=E.totalBytesProcessed??y,P=E.cacheHit??P}while(f&&l.length<u);let h=Dt(p,l.slice(0,u));return{rows:h,row_count:h.length,total_rows:parseInt(m,10),bytes_processed:y,cache_hit:P,job_id:r}}});var HP=500;function M$(t){if(Array.isArray(t))return t;if(typeof t=="string"){let e=t.trim();return e.startsWith("[")?JSON.parse(e):e.split(`
66
+ `).map(r=>r.trim()).filter(r=>r.length>0).map(r=>JSON.parse(r))}throw new Error("Data must be a JSON array or a newline-delimited JSON (NDJSON) string.")}o(M$,"parseInputData");var GP=nt({auth:ke,name:"import_data",classification:"WRITE",displayName:"Import Data",description:"Imports a batch of rows into a BigQuery table. Accepts a JSON array or newline-delimited JSON (NDJSON). Large datasets are automatically split into chunks.",audience:"both",aiMetadata:{description:"Bulk-imports rows into a BigQuery table via streaming inserts, accepting either a JSON array of objects or a newline-delimited JSON (NDJSON) string and automatically splitting large datasets into chunks. Choose this for ingesting a large or variably-formatted dataset in one step; optional flags control whether the batch fails on bad rows or skips invalid rows / unknown fields. Not idempotent: each call appends the rows again, duplicating data if re-run.",idempotent:!1},props:{project_id:Ve,dataset_id:ht,table_id:gt,data:K.Json({displayName:"Data",description:"The data to import. Provide a JSON array of objects (`[{...}, {...}]`) or a newline-delimited JSON string where each line is one row object.",required:!0}),skip_invalid_rows:K.Checkbox({displayName:"Skip Invalid Rows",description:"Continue importing valid rows even if some rows fail validation. Default: off (fail entire batch).",required:!1,defaultValue:!1}),ignore_unknown_values:K.Checkbox({displayName:"Ignore Unknown Fields",description:"Silently drop fields not present in the table schema. Default: off (fail on unknown fields).",required:!1,defaultValue:!1})},async run(t){let{project_id:e,dataset_id:r,table_id:n,data:i,skip_invalid_rows:u,ignore_unknown_values:c}=t.propsValue,l=M$(i);if(l.length===0)throw new Error("Data contains no rows to import.");let p=await Ne(t.auth),f=Date.now(),m=0,y=0,P=[];for(let h=0;h<l.length;h+=HP){let b=l.slice(h,h+HP),T=b.map((k,q)=>({insertId:`${f}-${h+q}-${Math.random().toString(36).slice(2,9)}`,json:k})),w=(await Se.sendRequest({method:"POST",url:`${Ae}/projects/${e}/datasets/${r}/tables/${n}/insertAll`,headers:{Authorization:`Bearer ${p}`},body:{kind:"bigquery#tableDataInsertAllRequest",skipInvalidRows:u??!1,ignoreUnknownValues:c??!1,rows:T}})).body.insertErrors??[];if(w.length>0&&!(u??!1)){let k=w[0]?.errors[0];throw new Error(`Import failed on row ${h+(w[0]?.index??0)}: ${k?.message??"Unknown error"}`)}m+=b.length-w.length,y+=w.length,P.push(...w.map(k=>({row_index:h+k.index,first_error:k.errors[0]?.message??"Unknown",reason:k.errors[0]?.reason??null})))}return{success:y===0,rows_attempted:l.length,rows_imported:m,error_count:y,errors:P}}});var L$={project_id:Ve,dataset_id:ht,table_id:gt,sort_column:K.ShortText({displayName:"Sort Column",description:"Name of the column used to detect new rows. The table is ordered by this column (DESC) and any row newer than the last check is returned. Use a TIMESTAMP or DATETIME column, e.g. `created_at`.",required:!0}),max_results:K.Number({displayName:"Max Rows per Check",description:"Maximum number of new rows to return per poll (default: 500).",required:!1,defaultValue:500})},Bu={strategy:0,items:o(async({auth:t,propsValue:e,lastFetchEpochMS:r})=>{let{project_id:n,dataset_id:i,table_id:u,sort_column:c,max_results:l}=e,p=l??500,f=await Ne(t),m=r??Date.now()-10080*60*1e3,y=`\`${n}.${i}.${u}\``,P=c,h=`SELECT * FROM ${y} WHERE \`${P}\` > TIMESTAMP_MILLIS(${m}) ORDER BY \`${P}\` ASC LIMIT ${p}`,T=(await Se.sendRequest({method:"POST",url:`${Ae}/projects/${n}/queries`,headers:{Authorization:`Bearer ${f}`},body:{query:h,useLegacySql:!1,maxResults:p,timeoutMs:3e4}})).body;if(!T.jobComplete)for(let k=0;k<30&&!T.jobComplete;k++)T=(await Se.sendRequest({method:"GET",url:`${Ae}/projects/${n}/queries/${T.jobReference.jobId}`,headers:{Authorization:`Bearer ${f}`},queryParams:{timeoutMs:"10000",maxResults:String(p)}})).body;let E=T.schema?.fields??[];return Dt(E,T.rows??[]).map(k=>{let q=k[P],W;if(typeof q=="string"){let H=parseFloat(q);W=!isNaN(H)&&H>1e9?H*1e3:new Date(q).getTime()}else typeof q=="number"?W=q>1e12?q:q*1e3:W=Date.now();return{epochMilliSeconds:W,data:k}})},"items")},WP=Tn({auth:ke,name:"new_row",classification:"READ",displayName:"New Row",description:"Triggers when a new row is added to a BigQuery table. Polls every 5 minutes by comparing the latest value in a sort column against the previous check.",aiMetadata:{description:"Fires for each new row appended to a BigQuery table, detected by polling a TIMESTAMP/DATETIME sort column for values newer than the previous check. Each event represents one newly inserted row. Detection depends entirely on the chosen sort column advancing for new rows."},props:L$,sampleData:{id:"1",created_at:"2024-01-15T10:30:00Z",name:"Example row"},type:"POLLING",async test(t){return await ot.test(Bu,t)},async onEnable(t){await ot.onEnable(Bu,t)},async onDisable(t){await ot.onDisable(Bu,t)},async run(t){return await ot.poll(Bu,t)}});var F$={project_id:Ve,dataset_id:ht,table_id:gt,updated_at_column:K.ShortText({displayName:"Updated At Column",description:"Name of the TIMESTAMP column that records when a row was last updated, e.g. `updated_at`. Rows where this column is newer than the last check are returned.",required:!0}),created_at_column:K.ShortText({displayName:"Created At Column (optional)",description:"If provided, only rows where the updated timestamp is newer than the created timestamp are returned, excluding brand-new rows from the results.",required:!1}),max_results:K.Number({displayName:"Max Rows per Check",description:"Maximum number of updated rows to return per poll (default: 500).",required:!1,defaultValue:500})},qu={strategy:0,items:o(async({auth:t,propsValue:e,lastFetchEpochMS:r})=>{let{project_id:n,dataset_id:i,table_id:u,updated_at_column:c,created_at_column:l,max_results:p}=e,f=p??500,m=await Ne(t),y=r??Date.now()-10080*60*1e3,P=`\`${n}.${i}.${u}\``,h=c,b=l?` AND \`${l}\` < TIMESTAMP_MILLIS(${y})`:"",T=[`SELECT * FROM ${P}`,`WHERE \`${h}\` > TIMESTAMP_MILLIS(${y})${b}`,`ORDER BY \`${h}\` ASC`,`LIMIT ${f}`].join(" "),w=(await Se.sendRequest({method:"POST",url:`${Ae}/projects/${n}/queries`,headers:{Authorization:`Bearer ${m}`},body:{query:T,useLegacySql:!1,maxResults:f,timeoutMs:3e4}})).body;if(!w.jobComplete)for(let W=0;W<30&&!w.jobComplete;W++)w=(await Se.sendRequest({method:"GET",url:`${Ae}/projects/${n}/queries/${w.jobReference.jobId}`,headers:{Authorization:`Bearer ${m}`},queryParams:{timeoutMs:"10000",maxResults:String(f)}})).body;let k=w.schema?.fields??[];return Dt(k,w.rows??[]).map(W=>{let H=W[h],V;if(typeof H=="string"){let J=parseFloat(H);V=!isNaN(J)&&J>1e9?J*1e3:new Date(H).getTime()}else typeof H=="number"?V=H>1e12?H:H*1e3:V=Date.now();return{epochMilliSeconds:V,data:W}})},"items")},ZP=Tn({auth:ke,name:"updated_row",classification:"READ",displayName:"Updated Row",description:"Triggers when an existing row is updated in a BigQuery table. Requires an `updated_at` TIMESTAMP column that is set whenever a row changes.",aiMetadata:{description:"Fires for each row whose updated-at TIMESTAMP column advances past the previous check, representing a modified row in a BigQuery table. Requires that column to be set whenever a row changes; supplying an optional created-at column excludes brand-new rows so only genuine updates fire."},props:F$,sampleData:{id:"1",updated_at:"2024-01-15T10:30:00Z",status:"active"},type:"POLLING",async test(t){return await ot.test(qu,t)},async onEnable(t){await ot.onEnable(qu,t)},async onDisable(t){await ot.onDisable(qu,t)},async run(t){return await ot.poll(qu,t)}});var B$={project_id:Ve,max_rows_per_job:K.Number({displayName:"Max Rows per Job",description:"Maximum number of result rows to fetch per completed job (default: 500).",required:!1,defaultValue:500})},Vu={strategy:0,items:o(async({auth:t,propsValue:e,lastFetchEpochMS:r})=>{let{project_id:n,max_rows_per_job:i}=e,u=i??500,c=await Ne(t),l=(r??Date.now()-1440*60*1e3)-3600*1e3,f=((await Se.sendRequest({method:"GET",url:`${Ae}/projects/${n}/jobs`,headers:{Authorization:`Bearer ${c}`},queryParams:{stateFilter:"done",projection:"full",minCreationTime:String(l),maxResults:"50"}})).body.jobs??[]).filter(y=>y.configuration.jobType==="QUERY"&&!y.status.errorResult&&parseInt(y.statistics.endTime??"0",10)>(r??0)),m=[];for(let y of f){let P=y.jobReference.jobId,h=y.jobReference.location,b=parseInt(y.statistics.endTime??"0",10),T=[],E=[],w;do{let q=await Se.sendRequest({method:"GET",url:`${Ae}/projects/${n}/queries/${P}`,headers:{Authorization:`Bearer ${c}`},queryParams:{maxResults:String(Math.min(u-T.length,1e3)),timeoutMs:"5000",...w?{pageToken:w}:{},...h?{location:h}:{}}});q.body.schema?.fields&&(E=q.body.schema.fields),T.push(...q.body.rows??[]),w=q.body.pageToken}while(w&&T.length<u);let k=Dt(E,T.slice(0,u));m.push({epochMilliSeconds:b,data:{job_id:P,project_id:y.jobReference.projectId,location:h??null,query:y.configuration.query?.query??null,completed_at:y.statistics.endTime?new Date(b).toISOString():null,bytes_processed:y.statistics.query?.totalBytesProcessed??null,cache_hit:y.statistics.query?.cacheHit??null,user_email:y.user_email??null,row_count:k.length,rows:k}})}return m},"items")},JP=Tn({auth:ke,name:"query_job_completed",classification:"READ",displayName:"Query Job Completed (With Row Data)",description:"Triggers when a BigQuery query job finishes successfully. Each flow run receives the job metadata and the result rows from that query.",aiMetadata:{description:"Fires when a successful (non-errored) QUERY-type job completes in the BigQuery project, detected by polling the project job history. Each event represents one finished query job and carries its metadata plus the fetched result rows. Only query jobs are surfaced; load, copy, and extract jobs are ignored."},props:B$,sampleData:{job_id:"job_abc123",project_id:"my-project",query:"SELECT * FROM my_dataset.my_table LIMIT 10",completed_at:"2024-01-15T10:30:00Z",bytes_processed:"1024",cache_hit:!1,row_count:2,rows:[{id:"1",name:"Alice"},{id:"2",name:"Bob"}]},type:"POLLING",async test(t){return await ot.test(Vu,t)},async onEnable(t){await ot.onEnable(Vu,t)},async onDisable(t){await ot.onDisable(Vu,t)},async run(t){return await ot.poll(Vu,t)}});var q$={project_id:Ve,include_failed:K.Checkbox({displayName:"Include Failed Jobs",description:"If enabled, jobs that completed with an error are also returned. Default: off (only successful jobs).",required:!1,defaultValue:!1})},Hu={strategy:0,items:o(async({auth:t,propsValue:e,lastFetchEpochMS:r})=>{let{project_id:n,include_failed:i}=e,u=await Ne(t),c=(r??Date.now()-1440*60*1e3)-3600*1e3;return((await Se.sendRequest({method:"GET",url:`${Ae}/projects/${n}/jobs`,headers:{Authorization:`Bearer ${u}`},queryParams:{stateFilter:"done",projection:"full",minCreationTime:String(c),maxResults:"100"}})).body.jobs??[]).filter(f=>!(parseInt(f.statistics.endTime??"0",10)<=(r??0)||!(i??!1)&&f.status.errorResult)).map(f=>{let m=parseInt(f.statistics.endTime??"0",10),y=f.statistics.query?.dmlStats;return{epochMilliSeconds:m,data:{job_id:f.jobReference.jobId,project_id:f.jobReference.projectId,location:f.jobReference.location??null,job_type:f.configuration.jobType,status:f.status.errorResult?"FAILED":"SUCCESS",error_message:f.status.errorResult?.message??null,error_reason:f.status.errorResult?.reason??null,query:f.configuration.query?.query??null,created_at:f.statistics.creationTime?new Date(parseInt(f.statistics.creationTime,10)).toISOString():null,started_at:f.statistics.startTime?new Date(parseInt(f.statistics.startTime,10)).toISOString():null,completed_at:m?new Date(m).toISOString():null,bytes_processed:f.statistics.query?.totalBytesProcessed??f.statistics.totalBytesProcessed??null,cache_hit:f.statistics.query?.cacheHit??null,dml_inserted_rows:y?.insertedRowCount??null,dml_deleted_rows:y?.deletedRowCount??null,dml_updated_rows:y?.updatedRowCount??null,user_email:f.user_email??null}}})},"items")},KP=Tn({auth:ke,name:"new_job_completed",classification:"READ",displayName:"New Job Completed",description:"Triggers when any BigQuery job (query, load, copy, or extract) finishes. Returns the job metadata including status, type, and timing.",aiMetadata:{description:"Fires when any BigQuery job of any type (query, load, copy, or extract) finishes in the project, detected by polling the job history. Each event represents one completed job and carries its metadata \u2014 type, status, timing, bytes processed, and DML row counts. By default only successful jobs fire; enabling the include-failed option also surfaces jobs that ended with an error."},props:q$,sampleData:{job_id:"job_xyz789",project_id:"my-project",job_type:"QUERY",status:"SUCCESS",error_message:null,query:"SELECT COUNT(*) FROM my_dataset.events",completed_at:"2024-01-15T10:30:00Z",bytes_processed:"2048",cache_hit:!1,user_email:"user@example.com"},type:"POLLING",async test(t){return await ot.test(Hu,t)},async onEnable(t){await ot.onEnable(Hu,t)},async onDisable(t){await ot.onDisable(Hu,t)},async run(t){return await ot.poll(Hu,t)}});var V$=dg({displayName:"Google BigQuery",description:"Query, analyze, and stream data into Google BigQuery \u2014 the fully managed, serverless data warehouse",minimumSupportedRelease:"0.36.1",logoUrl:"https://cdn.activepieces.com/pieces/google-bigquery.png",categories:["BUSINESS_INTELLIGENCE"],authors:["AhmadTash"],auth:ke,actions:[UP,jP,MP,LP,FP,BP,qP,VP,GP,R_({baseUrl:o(()=>Ae,"baseUrl"),auth:ke,authMapping:o(async t=>({Authorization:`Bearer ${await Ne(t)}`}),"authMapping")})],triggers:[WP,ZP,JP,KP]});0&&(module.exports={bigQueryAuth,googleBigQuery});
67
67
  /*! Bundled license information:
68
68
 
69
69
  mime-types/index.js: