@activepieces/piece-google-bigquery 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +28 -28
package/src/index.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
"use strict";var lw=Object.create;var fi=Object.defineProperty;var dw=Object.getOwnPropertyDescriptor;var pw=Object.getOwnPropertyNames;var fw=Object.getPrototypeOf,mw=Object.prototype.hasOwnProperty;var o=(t,e)=>fi(t,"name",{value:e,configurable:!0});var ut=(t,e)=>()=>(t&&(e=t(t=0)),e);var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),La=(t,e)=>{for(var r in e)fi(t,r,{get:e[r],enumerable:!0})},Hf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of pw(e))!mw.call(t,i)&&i!==r&&fi(t,i,{get:()=>e[i],enumerable:!(n=dw(e,i))||n.enumerable});return t};var ht=(t,e,r)=>(r=t!=null?lw(fw(t)):{},Hf(e||!t||!t.__esModule?fi(r,"default",{value:t,enumerable:!0}):r,t)),hw=t=>Hf(fi({},"__esModule",{value:!0}),t);var uh=M((sh,is)=>{(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 w=0,E=-1,T=(h.match(l.zoneIndex)||[])[0],k,B;for(T&&(T=T.substring(1),h=h.replace(/%.+$/,""));(E=h.indexOf(":",E+1))>=0;)w++;if(h.substr(0,2)==="::"&&w--,h.substr(-2,2)==="::"&&w--,w>_)return null;for(B=_-w,k=":";B--;)k+="0:";return h=h.replace("::",k),h[0]===":"&&(h=h.slice(1)),h[h.length-1]===":"&&(h=h.slice(0,-1)),_=function(){let W=h.split(":"),V=[];for(let H=0;H<W.length;H++)V.push(parseInt(W[H],16));return V}(),{parts:_,zoneId:T}}o(p,"expandIPv6");function f(h,_,w,E){if(h.length!==_.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let T=0,k;for(;E>0;){if(k=w-E,k<0&&(k=0),h[T]>>k!==_[T]>>k)return!1;E-=w,T+=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 w,E;for(w=0;w<_.length;w++)if(E=_[w],!(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(_,w){let E;if(w===void 0&&(E=_,_=E[0],w=E[1]),_.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,_.octets,8,w)},h.prototype.prefixLengthFromSubnetMask=function(){let _=0,w=!1,E={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},T,k,B;for(T=3;T>=0;T-=1)if(k=this.octets[T],k in E){if(B=E[k],w&&B!==0)return null;B!==8&&(w=!0),_+=B}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),w=_[0].toByteArray(),E=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),T=[],k=0;for(;k<4;)T.push(parseInt(w[k],10)|parseInt(E[k],10)^255),k++;return new this(T)}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 _,w,E,T,k;try{for(_=this.parseCIDR(h),E=_[0].toByteArray(),k=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),T=[],w=0;w<4;)T.push(parseInt(E[w],10)&parseInt(k[w],10)),w++;return new this(T)}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 w=parseInt(_[2]);if(w>=0&&w<=32){let E=[this.parse(_[1]),w];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 _,w,E;if(_=h.match(r.fourOctet))return function(){let T=_.slice(1,6),k=[];for(let B=0;B<T.length;B++)w=T[B],k.push(m(w));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 T=[],k;for(k=0;k<=24;k+=8)T.push(E>>k&255);return T}().reverse()}else return(_=h.match(r.twoOctet))?function(){let T=_.slice(1,4),k=[];if(E=m(T[1]),E>16777215||E<0)throw new Error("ipaddr: address outside defined range");return k.push(m(T[0])),k.push(E>>16&255),k.push(E>>8&255),k.push(E&255),k}():(_=h.match(r.threeOctet))?function(){let T=_.slice(1,5),k=[];if(E=m(T[2]),E>65535||E<0)throw new Error("ipaddr: address outside defined range");return k.push(m(T[0])),k.push(m(T[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],w=0,E=Math.floor(h/8);for(;w<E;)_[w]=255,w++;return E<4&&(_[E]=Math.pow(2,h%8)-1<<8-h%8),new this(_)},S.IPv6=function(){function h(_,w){let E,T;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(T=this.parts[E],!(0<=T&&T<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");w&&(this.zoneId=w)}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(_,w){let E;if(w===void 0&&(E=_,_=E[0],w=E[1]),_.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,_.parts,16,w)},h.prototype.prefixLengthFromSubnetMask=function(){let _=0,w=!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},T,k;for(let B=7;B>=0;B-=1)if(T=this.parts[B],T in E){if(k=E[T],w&&k!==0)return null;k!==16&&(w=!0),_+=k}else return null;return 128-_},h.prototype.range=function(){return S.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){let _,w=[],E=this.parts;for(let T=0;T<E.length;T++)_=E[T],w.push(_>>8),w.push(_&255);return w},h.prototype.toFixedLengthString=function(){let _=function(){let E=[];for(let T=0;T<this.parts.length;T++)E.push(g(this.parts[T].toString(16),4));return E}.call(this).join(":"),w="";return this.zoneId&&(w=`%${this.zoneId}`),_+w},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),w=_[0],E=_[1];return new S.IPv4([w>>8,w&255,E>>8,E&255])},h.prototype.toNormalizedString=function(){let _=function(){let E=[];for(let T=0;T<this.parts.length;T++)E.push(this.parts[T].toString(16));return E}.call(this).join(":"),w="";return this.zoneId&&(w=`%${this.zoneId}`),_+w},h.prototype.toRFC5952String=function(){let _=/((^|:)(0(:|$)){2,})/g,w=this.toNormalizedString(),E=0,T=-1,k;for(;k=_.exec(w);)k[0].length>T&&(E=k.index,T=k[0].length);return T<0?w:`${w.substring(0,E)}::${w.substring(E+T)}`},h.prototype.toString=function(){return this.toRFC5952String()},h}(),S.IPv6.broadcastAddressFromCIDR=function(h){try{let _=this.parseCIDR(h),w=_[0].toByteArray(),E=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),T=[],k=0;for(;k<16;)T.push(parseInt(w[k],10)|parseInt(E[k],10)^255),k++;return new this(T)}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 _,w,E,T,k;try{for(_=this.parseCIDR(h),E=_[0].toByteArray(),k=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),T=[],w=0;w<16;)T.push(parseInt(E[w],10)&parseInt(k[w],10)),w++;return new this(T)}catch(B){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${B})`)}},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 _,w,E;if((w=h.match(/^(.+)\/(\d+)$/))&&(_=parseInt(w[2]),_>=0&&_<=128))return E=[this.parse(w[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 _,w,E,T,k,B;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))&&(B=E[6]||"",_=E[1],E[1].endsWith("::")||(_=_.slice(0,-1)),_=p(_+B,6),_.parts)){for(k=[parseInt(E[2]),parseInt(E[3]),parseInt(E[4]),parseInt(E[5])],w=0;w<k.length;w++)if(T=k[w],!(0<=T&&T<=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],w=0,E=Math.floor(h/8);for(;w<E;)_[w]=255,w++;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,_,w){let E,T,k,B;w==null&&(w="unicast");for(T in _)if(Object.prototype.hasOwnProperty.call(_,T)){for(k=_[T],k[0]&&!(k[0]instanceof Array)&&(k=[k]),E=0;E<k.length;E++)if(B=k[E],h.kind()===B[0].kind()&&h.match.apply(h,B))return T}return w},typeof is<"u"&&is.exports?is.exports=S:t.ipaddr=S})(sh)});var ng=M((VV,rg)=>{var tg=require("stream").Stream,Vx=require("util");rg.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");Vx.inherits(hr,tg);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=tg.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 sg=M((WV,ag)=>{var Hx=require("util"),ig=require("stream").Stream,og=ng();ag.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");Hx.inherits(Xe,ig);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 og)){var r=og.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 ig.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 cg=M((ZV,ug)=>{"use strict";ug.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 pg=M(kt=>{"use strict";var ps=cg(),Wx=require("path").extname,lg=/^\s*([^;\s]*)(?:;|\s|$)/,Gx=/^text\//i;kt.charset=dg;kt.charsets={lookup:dg};kt.contentType=Zx;kt.extension=Jx;kt.extensions=Object.create(null);kt.lookup=Kx;kt.types=Object.create(null);Qx(kt.extensions,kt.types);function dg(t){if(!t||typeof t!="string")return!1;var e=lg.exec(t),r=e&&ps[e[1].toLowerCase()];return r&&r.charset?r.charset:e&&Gx.test(e[1])?"UTF-8":!1}o(dg,"charset");function Zx(t){if(!t||typeof t!="string")return!1;var e=t.indexOf("/")===-1?kt.lookup(t):t;if(!e)return!1;if(e.indexOf("charset")===-1){var r=kt.charset(e);r&&(e+="; charset="+r.toLowerCase())}return e}o(Zx,"contentType");function Jx(t){if(!t||typeof t!="string")return!1;var e=lg.exec(t),r=e&&kt.extensions[e[1].toLowerCase()];return!r||!r.length?!1:r[0]}o(Jx,"extension");function Kx(t){if(!t||typeof t!="string")return!1;var e=Wx("x."+t).toLowerCase().substr(1);return e&&kt.types[e]||!1}o(Kx,"lookup");function Qx(t,e){var r=["nginx","apache",void 0,"iana"];Object.keys(ps).forEach(o(function(i){var u=ps[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(ps[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(Qx,"populateMaps")});var mg=M((QV,fg)=>{fg.exports=Yx;function Yx(t){var e=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;e?e(t):setTimeout(t,0)}o(Yx,"defer")});var el=M((XV,gg)=>{var hg=mg();gg.exports=Xx;function Xx(t){var e=!1;return hg(function(){e=!0}),o(function(n,i){e?t(n,i):hg(o(function(){t(n,i)},"nextTick_callback"))},"async_callback")}o(Xx,"async")});var tl=M((tH,yg)=>{yg.exports=eA;function eA(t){Object.keys(t.jobs).forEach(tA.bind(t)),t.jobs={}}o(eA,"abort");function tA(t){typeof this.jobs[t]=="function"&&this.jobs[t]()}o(tA,"clean")});var rl=M((nH,bg)=>{var _g=el(),rA=tl();bg.exports=nA;function nA(t,e,r,n){var i=r.keyedList?r.keyedList[r.index]:r.index;r.jobs[i]=oA(e,i,t[i],function(u,c){i in r.jobs&&(delete r.jobs[i],u?rA(r):r.results[i]=c,n(u,r.results))})}o(nA,"iterate");function oA(t,e,r,n){var i;return t.length==2?i=t(r,_g(n)):i=t(r,e,_g(n)),i}o(oA,"runJob")});var nl=M((iH,vg)=>{vg.exports=iA;function iA(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(iA,"state")});var ol=M((sH,Eg)=>{var aA=tl(),sA=el();Eg.exports=uA;function uA(t){Object.keys(this.jobs).length&&(this.index=this.size,aA(this),sA(t)(null,this.results))}o(uA,"terminator")});var Pg=M((cH,Sg)=>{var cA=rl(),lA=nl(),dA=ol();Sg.exports=pA;function pA(t,e,r){for(var n=lA(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 dA.bind(n,r)}o(pA,"parallel")});var il=M((dH,fs)=>{var wg=rl(),fA=nl(),mA=ol();fs.exports=hA;fs.exports.ascending=Tg;fs.exports.descending=gA;function hA(t,e,r,n){var i=fA(t,r);return wg(t,e,i,o(function u(c,l){if(c){n(c,l);return}if(i.index++,i.index<(i.keyedList||t).length){wg(t,e,i,u);return}n(null,i.results)},"iteratorHandler")),mA.bind(i,n)}o(hA,"serialOrdered");function Tg(t,e){return t<e?-1:t>e?1:0}o(Tg,"ascending");function gA(t,e){return-1*Tg(t,e)}o(gA,"descending")});var Ag=M((fH,xg)=>{var yA=il();xg.exports=_A;function _A(t,e,r){return yA(t,e,null,r)}o(_A,"serial")});var Rg=M((hH,Ig)=>{Ig.exports={parallel:Pg(),serial:Ag(),serialOrdered:il()}});var al=M((gH,Cg)=>{"use strict";Cg.exports=Object});var Og=M((yH,kg)=>{"use strict";kg.exports=Error});var zg=M((_H,$g)=>{"use strict";$g.exports=EvalError});var Dg=M((bH,Ng)=>{"use strict";Ng.exports=RangeError});var Ug=M((vH,jg)=>{"use strict";jg.exports=ReferenceError});var Lg=M((EH,Mg)=>{"use strict";Mg.exports=SyntaxError});var ms=M((SH,Fg)=>{"use strict";Fg.exports=TypeError});var qg=M((PH,Bg)=>{"use strict";Bg.exports=URIError});var Hg=M((wH,Vg)=>{"use strict";Vg.exports=Math.abs});var Gg=M((TH,Wg)=>{"use strict";Wg.exports=Math.floor});var Jg=M((xH,Zg)=>{"use strict";Zg.exports=Math.max});var Qg=M((AH,Kg)=>{"use strict";Kg.exports=Math.min});var Xg=M((IH,Yg)=>{"use strict";Yg.exports=Math.pow});var ty=M((RH,ey)=>{"use strict";ey.exports=Math.round});var ny=M((CH,ry)=>{"use strict";ry.exports=Number.isNaN||o(function(e){return e!==e},"isNaN")});var iy=M((OH,oy)=>{"use strict";var bA=ny();oy.exports=o(function(e){return bA(e)||e===0?e:e<0?-1:1},"sign")});var sy=M((zH,ay)=>{"use strict";ay.exports=Object.getOwnPropertyDescriptor});var sl=M((NH,uy)=>{"use strict";var hs=sy();if(hs)try{hs([],"length")}catch{hs=null}uy.exports=hs});var ly=M((DH,cy)=>{"use strict";var gs=Object.defineProperty||!1;if(gs)try{gs({},"a",{value:1})}catch{gs=!1}cy.exports=gs});var ul=M((jH,dy)=>{"use strict";dy.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 my=M((MH,fy)=>{"use strict";var py=typeof Symbol<"u"&&Symbol,vA=ul();fy.exports=o(function(){return typeof py!="function"||typeof Symbol!="function"||typeof py("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:vA()},"hasNativeSymbols")});var cl=M((FH,hy)=>{"use strict";hy.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var ll=M((BH,gy)=>{"use strict";var EA=al();gy.exports=EA.getPrototypeOf||null});var by=M((qH,_y)=>{"use strict";var SA="Function.prototype.bind called on incompatible ",PA=Object.prototype.toString,wA=Math.max,TA="[object Function]",yy=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"),xA=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"),AA=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");_y.exports=o(function(e){var r=this;if(typeof r!="function"||PA.apply(r)!==TA)throw new TypeError(SA+r);for(var n=xA(arguments,1),i,u=o(function(){if(this instanceof i){var m=r.apply(this,yy(n,arguments));return Object(m)===m?m:this}return r.apply(e,yy(n,arguments))},"binder"),c=wA(0,r.length-n.length),l=[],p=0;p<c;p++)l[p]="$"+p;if(i=Function("binder","return function ("+AA(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 To=M((HH,vy)=>{"use strict";var IA=by();vy.exports=Function.prototype.bind||IA});var ys=M((WH,Ey)=>{"use strict";Ey.exports=Function.prototype.call});var dl=M((GH,Sy)=>{"use strict";Sy.exports=Function.prototype.apply});var wy=M((ZH,Py)=>{"use strict";Py.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var xy=M((JH,Ty)=>{"use strict";var RA=To(),CA=dl(),kA=ys(),OA=wy();Ty.exports=OA||RA.call(kA,CA)});var Iy=M((KH,Ay)=>{"use strict";var $A=To(),zA=ms(),NA=ys(),DA=xy();Ay.exports=o(function(e){if(e.length<1||typeof e[0]!="function")throw new zA("a function is required");return DA($A,NA,e)},"callBindBasic")});var zy=M((YH,$y)=>{"use strict";var jA=Iy(),Ry=sl(),ky;try{ky=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var pl=!!ky&&Ry&&Ry(Object.prototype,"__proto__"),Oy=Object,Cy=Oy.getPrototypeOf;$y.exports=pl&&typeof pl.get=="function"?jA([pl.get]):typeof Cy=="function"?o(function(e){return Cy(e==null?e:Oy(e))},"getDunder"):!1});var My=M((eW,Uy)=>{"use strict";var Ny=cl(),Dy=ll(),jy=zy();Uy.exports=Ny?o(function(e){return Ny(e)},"getProto"):Dy?o(function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return Dy(e)},"getProto"):jy?o(function(e){return jy(e)},"getProto"):null});var fl=M((rW,Ly)=>{"use strict";var UA=Function.prototype.call,MA=Object.prototype.hasOwnProperty,LA=To();Ly.exports=LA.call(UA,MA)});var Gy=M((nW,Wy)=>{"use strict";var we,FA=al(),BA=Og(),qA=zg(),VA=Dg(),HA=Ug(),Ro=Lg(),Io=ms(),WA=qg(),GA=Hg(),ZA=Gg(),JA=Jg(),KA=Qg(),QA=Xg(),YA=ty(),XA=iy(),Vy=Function,ml=o(function(t){try{return Vy('"use strict"; return ('+t+").constructor;")()}catch{}},"getEvalledConstructor"),zi=sl(),eI=ly(),hl=o(function(){throw new Io},"throwTypeError"),tI=zi?function(){try{return arguments.callee,hl}catch{try{return zi(arguments,"callee").get}catch{return hl}}}():hl,xo=my()(),ct=My(),rI=ll(),nI=cl(),Hy=dl(),Ni=ys(),Ao={},oI=typeof Uint8Array>"u"||!ct?we:ct(Uint8Array),Fn={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?we:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?we:ArrayBuffer,"%ArrayIteratorPrototype%":xo&&ct?ct([][Symbol.iterator]()):we,"%AsyncFromSyncIteratorPrototype%":we,"%AsyncFunction%":Ao,"%AsyncGenerator%":Ao,"%AsyncGeneratorFunction%":Ao,"%AsyncIteratorPrototype%":Ao,"%Atomics%":typeof Atomics>"u"?we:Atomics,"%BigInt%":typeof BigInt>"u"?we:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?we:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?we:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?we:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":BA,"%eval%":eval,"%EvalError%":qA,"%Float16Array%":typeof Float16Array>"u"?we:Float16Array,"%Float32Array%":typeof Float32Array>"u"?we:Float32Array,"%Float64Array%":typeof Float64Array>"u"?we:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?we:FinalizationRegistry,"%Function%":Vy,"%GeneratorFunction%":Ao,"%Int8Array%":typeof Int8Array>"u"?we:Int8Array,"%Int16Array%":typeof Int16Array>"u"?we:Int16Array,"%Int32Array%":typeof Int32Array>"u"?we:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":xo&&ct?ct(ct([][Symbol.iterator]())):we,"%JSON%":typeof JSON=="object"?JSON:we,"%Map%":typeof Map>"u"?we:Map,"%MapIteratorPrototype%":typeof Map>"u"||!xo||!ct?we:ct(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":FA,"%Object.getOwnPropertyDescriptor%":zi,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?we:Promise,"%Proxy%":typeof Proxy>"u"?we:Proxy,"%RangeError%":VA,"%ReferenceError%":HA,"%Reflect%":typeof Reflect>"u"?we:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?we:Set,"%SetIteratorPrototype%":typeof Set>"u"||!xo||!ct?we:ct(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?we:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":xo&&ct?ct(""[Symbol.iterator]()):we,"%Symbol%":xo?Symbol:we,"%SyntaxError%":Ro,"%ThrowTypeError%":tI,"%TypedArray%":oI,"%TypeError%":Io,"%Uint8Array%":typeof Uint8Array>"u"?we:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?we:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?we:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?we:Uint32Array,"%URIError%":WA,"%WeakMap%":typeof WeakMap>"u"?we:WeakMap,"%WeakRef%":typeof WeakRef>"u"?we:WeakRef,"%WeakSet%":typeof WeakSet>"u"?we:WeakSet,"%Function.prototype.call%":Ni,"%Function.prototype.apply%":Hy,"%Object.defineProperty%":eI,"%Object.getPrototypeOf%":rI,"%Math.abs%":GA,"%Math.floor%":ZA,"%Math.max%":JA,"%Math.min%":KA,"%Math.pow%":QA,"%Math.round%":YA,"%Math.sign%":XA,"%Reflect.getPrototypeOf%":nI};if(ct)try{null.error}catch(t){Fy=ct(ct(t)),Fn["%Error.prototype%"]=Fy}var Fy,iI=o(function t(e){var r;if(e==="%AsyncFunction%")r=ml("async function () {}");else if(e==="%GeneratorFunction%")r=ml("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=ml("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&ct&&(r=ct(i.prototype))}return Fn[e]=r,r},"doEval"),By={__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"]},Di=To(),_s=fl(),aI=Di.call(Ni,Array.prototype.concat),sI=Di.call(Hy,Array.prototype.splice),qy=Di.call(Ni,String.prototype.replace),bs=Di.call(Ni,String.prototype.slice),uI=Di.call(Ni,RegExp.prototype.exec),cI=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,lI=/\\(\\)?/g,dI=o(function(e){var r=bs(e,0,1),n=bs(e,-1);if(r==="%"&&n!=="%")throw new Ro("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Ro("invalid intrinsic syntax, expected opening `%`");var i=[];return qy(e,cI,function(u,c,l,p){i[i.length]=l?qy(p,lI,"$1"):c||u}),i},"stringToPath"),pI=o(function(e,r){var n=e,i;if(_s(By,n)&&(i=By[n],n="%"+i[0]+"%"),_s(Fn,n)){var u=Fn[n];if(u===Ao&&(u=iI(n)),typeof u>"u"&&!r)throw new Io("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:u}}throw new Ro("intrinsic "+e+" does not exist!")},"getBaseIntrinsic");Wy.exports=o(function(e,r){if(typeof e!="string"||e.length===0)throw new Io("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Io('"allowMissing" argument must be a boolean');if(uI(/^%?[^%]*%?$/,e)===null)throw new Ro("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=dI(e),i=n.length>0?n[0]:"",u=pI("%"+i+"%",r),c=u.name,l=u.value,p=!1,f=u.alias;f&&(i=f[0],sI(n,aI([0,1],f)));for(var m=1,g=!0;m<n.length;m+=1){var S=n[m],h=bs(S,0,1),_=bs(S,-1);if((h==='"'||h==="'"||h==="`"||_==='"'||_==="'"||_==="`")&&h!==_)throw new Ro("property names with quotes must have matching quotes");if((S==="constructor"||!g)&&(p=!0),i+="."+S,c="%"+i+"%",_s(Fn,c))l=Fn[c];else if(l!=null){if(!(S in l)){if(!r)throw new Io("base intrinsic for "+e+" exists, but the property is not available.");return}if(zi&&m+1>=n.length){var w=zi(l,S);g=!!w,g&&"get"in w&&!("originalValue"in w.get)?l=w.get:l=l[S]}else g=_s(l,S),l=l[S];g&&!p&&(Fn[c]=l)}}return l},"GetIntrinsic")});var Jy=M((iW,Zy)=>{"use strict";var fI=ul();Zy.exports=o(function(){return fI()&&!!Symbol.toStringTag},"hasToStringTagShams")});var Yy=M((sW,Qy)=>{"use strict";var mI=Gy(),Ky=mI("%Object.defineProperty%",!0),hI=Jy()(),gI=fl(),yI=ms(),vs=hI?Symbol.toStringTag:null;Qy.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 yI("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");vs&&(n||!gI(e,vs))&&(Ky?Ky(e,vs,{configurable:!i,enumerable:!1,value:r,writable:!1}):e[vs]=r)},"setToStringTag")});var e_=M((cW,Xy)=>{"use strict";var _I=Function.prototype.call,bI=Object.prototype.hasOwnProperty,vI=To();Xy.exports=vI.call(_I,bI)});var r_=M((lW,t_)=>{"use strict";t_.exports=function(t,e){return Object.keys(e).forEach(function(r){t[r]=t[r]||e[r]}),t}});var i_=M((dW,o_)=>{"use strict";var bl=sg(),EI=require("util"),gl=require("path"),SI=require("http"),PI=require("https"),wI=require("url").parse,TI=require("fs"),xI=require("stream").Stream,AI=require("crypto"),yl=pg(),II=Rg(),RI=Yy(),En=e_(),_l=r_();function n_(t){return String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}o(n_,"escapeHeaderParam");function Ce(t){if(!(this instanceof Ce))return new Ce(t);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],bl.call(this),t=t||{};for(var e in t)this[e]=t[e]}o(Ce,"FormData");EI.inherits(Ce,bl);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=bl.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&&En(e,"httpVersion"))&&!(e instanceof xI))&&(r.knownLength||this._valuesToMeasure.push(e))};Ce.prototype._lengthRetriever=function(t,e){En(t,"fd")?t.end!=null&&t.end!=1/0&&t.start!=null?e(null,t.end+1-(t.start?t.start:0)):TI.stat(t.path,function(r,n){if(r){e(r);return}var i=n.size-(t.start?t.start:0);e(null,i)}):En(t,"httpVersion")?e(null,Number(t.headers["content-length"])):En(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="'+n_(t)+'"'].concat(n||[]),"Content-Type":[].concat(i||[])};typeof r.header=="object"&&_l(c,r.header);var l;for(var p in c)if(En(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=gl.normalize(e.filepath).replace(/\\/g,"/"):e.filename||t&&(t.name||t.path)?r=gl.basename(e.filename||t&&(t.name||t.path)):t&&t.readable&&En(t,"httpVersion")&&(r=gl.basename(t.client._httpMessage.path||"")),r)return'filename="'+n_(r)+'"'};Ce.prototype._getContentType=function(t,e){var r=e.contentType;return!r&&t&&t.name&&(r=yl.lookup(t.name)),!r&&t&&t.path&&(r=yl.lookup(t.path)),!r&&t&&t.readable&&En(t,"httpVersion")&&(r=t.headers["content-type"]),!r&&(e.filepath||e.filename)&&(r=yl.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)En(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="--------------------------"+AI.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}II.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=wI(t),n=_l({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},i)):(n=_l(t,i),n.port||(n.port=n.protocol==="https:"?443:80)),n.headers=this.getHeaders(t.headers),n.protocol==="https:"?r=PI.request(n):r=SI.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]"};RI(Ce.prototype,"FormData");o_.exports=Ce});var vl=M((zW,h_)=>{"use strict";var Es=Object.prototype.hasOwnProperty,m_=Object.prototype.toString,u_=Object.defineProperty,c_=Object.getOwnPropertyDescriptor,l_=o(function(e){return typeof Array.isArray=="function"?Array.isArray(e):m_.call(e)==="[object Array]"},"isArray"),d_=o(function(e){if(!e||m_.call(e)!=="[object Object]")return!1;var r=Es.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&Es.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;var i;for(i in e);return typeof i>"u"||Es.call(e,i)},"isPlainObject"),p_=o(function(e,r){u_&&r.name==="__proto__"?u_(e,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):e[r.name]=r.newValue},"setProperty"),f_=o(function(e,r){if(r==="__proto__")if(Es.call(e,r)){if(c_)return c_(e,r).value}else return;return e[r]},"getProperty");h_.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=f_(l,r),i=f_(e,r),l!==i&&(m&&i&&(d_(i)||(u=l_(i)))?(u?(u=!1,c=n&&l_(n)?n:[]):c=n&&d_(n)?n:{},p_(l,{name:r,newValue:t(m,c,i)})):typeof i<"u"&&p_(l,{name:r,newValue:i}));return l},"extend")});var g_=M((DW,UI)=>{UI.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 __=M((jW,y_)=>{"use strict";var MI=g_();y_.exports={pkg:MI}});var Pl=M(rr=>{"use strict";var v_=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=E_;var b_=v_(vl()),LI=v_(__()),El=LI.default.pkg;rr.GAXIOS_ERROR_SYMBOL=Symbol.for(`${El.name}-gaxios-error`);var Sl=class t extends Error{static{o(this,"GaxiosError")}config;response;code;status;error;[rr.GAXIOS_ERROR_SYMBOL]=El.version;static[Symbol.hasInstance](e){return e&&typeof e=="object"&&rr.GAXIOS_ERROR_SYMBOL in e&&e[rr.GAXIOS_ERROR_SYMBOL]===El.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,b_.default)(!0,{},r),this.response&&(this.response.config=(0,b_.default)(!0,{},this.response.config)),this.response){try{this.response.data=FI(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=Sl;function FI(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(FI,"translateData");function E_(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&&(E_({config:t.response.config}),r(t.response.headers),t.response.bodyUsed&&(n(t.response,"data"),i(t.response.data))),t}o(E_,"defaultErrorRedactor")});var P_=M(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});wl.getRetryConfig=BI;async function BI(t){let e=S_(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||qI)(t))return{shouldRetry:!1,config:t.config};let i=VI(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(BI,"getRetryConfig");function qI(t){let e=S_(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(qI,"shouldRetryRequest");function S_(t){if(t&&t.config&&t.config.retryConfig)return t.config.retryConfig}o(S_,"getConfig");function VI(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(VI,"getNextRetryDelay")});var xl=M(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.GaxiosInterceptorManager=void 0;var Tl=class extends Set{static{o(this,"GaxiosInterceptorManager")}};Ss.GaxiosInterceptorManager=Tl});var T_=M((VW,w_)=>{var Co=1e3,ko=Co*60,Oo=ko*60,Bn=Oo*24,HI=Bn*7,WI=Bn*365.25;w_.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return GI(t);if(r==="number"&&isFinite(t))return e.long?JI(t):ZI(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function GI(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*WI;case"weeks":case"week":case"w":return r*HI;case"days":case"day":case"d":return r*Bn;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Oo;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*Co;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}o(GI,"parse");function ZI(t){var e=Math.abs(t);return e>=Bn?Math.round(t/Bn)+"d":e>=Oo?Math.round(t/Oo)+"h":e>=ko?Math.round(t/ko)+"m":e>=Co?Math.round(t/Co)+"s":t+"ms"}o(ZI,"fmtShort");function JI(t){var e=Math.abs(t);return e>=Bn?Ps(t,e,Bn,"day"):e>=Oo?Ps(t,e,Oo,"hour"):e>=ko?Ps(t,e,ko,"minute"):e>=Co?Ps(t,e,Co,"second"):t+" ms"}o(JI,"fmtLong");function Ps(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}o(Ps,"plural")});var Al=M((WW,x_)=>{function KI(t){r.debug=r,r.default=r,r.coerce=p,r.disable=c,r.enable=i,r.enabled=l,r.humanize=T_(),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 w(...E){if(!w.enabled)return;let T=w,k=Number(new Date),B=k-(g||k);T.diff=B,T.prev=g,T.curr=k,g=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,(H,J)=>{if(H==="%%")return"%";W++;let te=r.formatters[J];if(typeof te=="function"){let Z=E[W];H=te.call(T,Z),E.splice(W,1),W--}return H}),r.formatArgs.call(T,E),(T.log||r.log).apply(T,E)}return o(w,"debug"),w.namespace=m,w.useColors=r.useColors(),w.color=r.selectColor(m),w.extend=n,w.destroy=r.destroy,Object.defineProperty(w,"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(w),w}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,w=0;for(;S<m.length;)if(h<g.length&&(g[h]===m[S]||g[h]==="*"))g[h]==="*"?(_=h,w=S,h++):(S++,h++);else if(_!==-1)h=_+1,w++,S=w;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(KI,"setup");x_.exports=KI});var A_=M((Ot,ws)=>{Ot.formatArgs=YI;Ot.save=XI;Ot.load=eR;Ot.useColors=QI;Ot.storage=tR();Ot.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`."))}})();Ot.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 QI(){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(QI,"useColors");function YI(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+ws.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(YI,"formatArgs");Ot.log=console.debug||console.log||(()=>{});function XI(t){try{t?Ot.storage.setItem("debug",t):Ot.storage.removeItem("debug")}catch{}}o(XI,"save");function eR(){let t;try{t=Ot.storage.getItem("debug")||Ot.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}o(eR,"load");function tR(){try{return localStorage}catch{}}o(tR,"localstorage");ws.exports=Al()(Ot);var{formatters:rR}=ws.exports;rR.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var R_=M((JW,I_)=>{"use strict";I_.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 O_=M((KW,k_)=>{"use strict";var nR=require("os"),C_=require("tty"),nr=R_(),{env:lt}=process,Sn;nr("no-color")||nr("no-colors")||nr("color=false")||nr("color=never")?Sn=0:(nr("color")||nr("colors")||nr("color=true")||nr("color=always"))&&(Sn=1);"FORCE_COLOR"in lt&&(lt.FORCE_COLOR==="true"?Sn=1:lt.FORCE_COLOR==="false"?Sn=0:Sn=lt.FORCE_COLOR.length===0?1:Math.min(parseInt(lt.FORCE_COLOR,10),3));function Il(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}o(Il,"translateLevel");function Rl(t,e){if(Sn===0)return 0;if(nr("color=16m")||nr("color=full")||nr("color=truecolor"))return 3;if(nr("color=256"))return 2;if(t&&!e&&Sn===void 0)return 0;let r=Sn||0;if(lt.TERM==="dumb")return r;if(process.platform==="win32"){let n=nR.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in lt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in lt)||lt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in lt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(lt.TEAMCITY_VERSION)?1:0;if(lt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in lt){let n=parseInt((lt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(lt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(lt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(lt.TERM)||"COLORTERM"in lt?1:r}o(Rl,"supportsColor");function oR(t){let e=Rl(t,t&&t.isTTY);return Il(e)}o(oR,"getSupportLevel");k_.exports={supportsColor:oR,stdout:Il(Rl(!0,C_.isatty(1))),stderr:Il(Rl(!0,C_.isatty(2)))}});var z_=M((dt,xs)=>{var iR=require("tty"),Ts=require("util");dt.init=pR;dt.log=cR;dt.formatArgs=sR;dt.save=lR;dt.load=dR;dt.useColors=aR;dt.destroy=Ts.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");dt.colors=[6,2,3,4,5,1];try{let t=O_();t&&(t.stderr||t).level>=2&&(dt.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{}dt.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 dt.inspectOpts?!!dt.inspectOpts.colors:iR.isatty(process.stderr.fd)}o(aR,"useColors");function sR(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 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([][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([][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(""[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&<&&(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(`
|
|
4
4
|
`).join(`
|
|
5
|
-
`+u),t.push(i+"m+"+
|
|
6
|
-
`)}o(
|
|
7
|
-
`).map(e=>e.trim()).join(" ")}
|
|
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
|
|
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
|
|
9
9
|
\r
|
|
10
|
-
`);if(S===-1){
|
|
11
|
-
`),_=h.shift();if(!_)return t.destroy(),r(new Error("No header received from proxy CONNECT response"));let
|
|
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
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,
|
|
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",$R),r.secureEndpoint?(ji("Upgrading socket connection to TLS"),q_.connect({...H_(V_(r),"host","path","port"),socket:i})):i;i.destroy();let g=new Is.Socket({writable:!1});return g.readable=!0,e.once("socket",S=>{ji("Replaying proxy buffer for failed request"),(0,IR.default)(S.listenerCount("data")>0),S.push(m),S.push(null)}),g}};Rs.protocols=["http","https"];or.HttpsProxyAgent=Rs;function $R(t){t.resume()}o($R,"resume");function H_(t,...e){let r={},n;for(n in t)e.includes(n)||(r[n]=t[n]);return r}o(H_,"omit")});function zR(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 J_,K_=ut(()=>{o(zR,"dataUriToBuffer");J_=zR});var Y_=M((Cs,Q_)=>{(function(t,e){typeof Cs=="object"&&typeof Q_<"u"?e(Cs):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.WebStreamsPolyfill={}))})(Cs,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 w(a,s,d){return g(a,s,d)}o(w,"transformPromiseWith");function E(a){g(a,void 0,n)}o(E,"setPromiseIsHandledToTrue");let T=o(a=>{if(typeof queueMicrotask=="function")T=queueMicrotask;else{let s=f(void 0);T=o(d=>g(s,d),"_queueMicrotask")}return T(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 B(a,s,d){try{return f(k(a,s,d))}catch(v){return m(v)}}o(B,"promiseCall");let W=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===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,j=s._elements,L=j[v];return A===W&&(d=s._next,A=0),--this._size,this._cursor=A,s!==d&&(this._front=d),j[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]]"),te=Symbol("[[CancelSteps]]"),Z=Symbol("[[PullSteps]]"),Ne=Symbol("[[ReleaseSteps]]");function Se(a,s){a._ownerReadableStream=s,s._reader=a,s._state==="readable"?Ve(a):s._state==="closed"?Ze(a):He(a,s._storedError)}o(Se,"ReadableStreamReaderGenericInitialize");function be(a,s){let d=a._ownerReadableStream;return dr(d,s)}o(be,"ReadableStreamReaderGenericCancel");function Oe(a){let s=a._ownerReadableStream;s._state==="readable"?jt(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[Ne](),s._reader=void 0,a._ownerReadableStream=void 0}o(Oe,"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),jt(a,s)}o(He,"defaultReaderClosedPromiseInitializeAsRejected");function Ze(a){Ve(a),Xn(a)}o(Ze,"defaultReaderClosedPromiseInitializeAsResolved");function jt(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(jt,"defaultReaderClosedPromiseReject");function Et(a,s){He(a,s)}o(Et,"defaultReaderClosedPromiseResetToRejected");function Xn(a){a._closedPromise_resolve!==void 0&&(a._closedPromise_resolve(void 0),a._closedPromise_resolve=void 0,a._closedPromise_reject=void 0)}o(Xn,"defaultReaderClosedPromiseResolve");let Tr=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},ni=Math.trunc||function(a){return a<0?Math.ceil(a):Math.floor(a)};function G(a){return typeof a=="object"||typeof a=="function"}o(G,"isDictionary");function Rt(a,s){if(a!==void 0&&!G(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 oi(a){return typeof a=="object"&&a!==null||typeof a=="function"}o(oi,"isObject");function Pt(a,s){if(!oi(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 N(a){return x(ni(a))}o(N,"integerPart");function R(a,s){let v=Number.MAX_SAFE_INTEGER,A=Number(a);if(A=x(A),!Tr(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!Tr(A)||A===0?0:A}o(R,"convertUnsignedLongLongWithEnforceRange");function $(a,s){if(!ln(a))throw new TypeError(`${s} is not a ReadableStream.`)}o($,"assertReadableStream");function U(a){return new F(a)}o(U,"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 z(a){let s=a._reader;return!(s===void 0||!Y(s))}o(z,"ReadableStreamHasDefaultReader");class F{static{o(this,"ReadableStreamDefaultReader")}constructor(s){if(it(s,1,"ReadableStreamDefaultReader"),$(s,"First parameter"),dn(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(Ge("closed"))}cancel(s=void 0){return Y(this)?this._ownerReadableStream===void 0?m(Ie("cancel")):be(this,s):m(Ge("cancel"))}read(){if(!Y(this))return m(Ge("read"));if(this._ownerReadableStream===void 0)return m(Ie("read from"));let s,d,v=p((j,L)=>{s=j,d=L});return ee(this,{_chunkSteps:o(j=>s({value:j,done:!1}),"_chunkSteps"),_closeSteps:o(()=>s({value:void 0,done:!0}),"_closeSteps"),_errorSteps:o(j=>d(j),"_errorSteps")}),v}releaseLock(){if(!Y(this))throw Ge("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 ee(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(ee,"ReadableStreamDefaultReaderRead");function Re(a){Oe(a);let s=new TypeError("Reader was released");We(a,s)}o(Re,"ReadableStreamDefaultReaderRelease");function We(a,s){let d=a._readRequests;a._readRequests=new V,d.forEach(v=>{v._errorSteps(s)})}o(We,"ReadableStreamDefaultReaderErrorReadRequests");function Ge(a){return new TypeError(`ReadableStreamDefaultReader.prototype.${a} can only be used on a ReadableStreamDefaultReader`)}o(Ge,"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?w(this._ongoingPromise,s,s):s(),this._ongoingPromise}return(s){let d=o(()=>this._returnSteps(s),"returnSteps");return this._ongoingPromise?w(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 ee(s,{_chunkSteps:o(L=>{this._ongoingPromise=void 0,T(()=>d({value:L,done:!1}))},"_chunkSteps"),_closeSteps:o(()=>{this._ongoingPromise=void 0,this._isFinished=!0,Oe(s),d({value:void 0,done:!0})},"_closeSteps"),_errorSteps:o(L=>{this._ongoingPromise=void 0,this._isFinished=!0,Oe(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 Oe(d),w(v,()=>({value:s,done:!0}))}return Oe(d),f({value:s,done:!0})}}let at={next(){return to(this)?this._asyncIteratorImpl.next():m(ro("next"))},return(a){return to(this)?this._asyncIteratorImpl.return(a):m(ro("return"))}};Object.setPrototypeOf(at,Ae);function eo(a,s){let d=U(a),v=new De(d,s),A=Object.create(at);return A._asyncIteratorImpl=v,A}o(eo,"AcquireReadableStreamAsyncIterator");function to(a){if(!r(a)||!Object.prototype.hasOwnProperty.call(a,"_asyncIteratorImpl"))return!1;try{return a._asyncIteratorImpl instanceof De}catch{return!1}}o(to,"IsReadableStreamAsyncIterator");function ro(a){return new TypeError(`ReadableStreamAsyncIterator.${a} can only be used on a ReadableSteamAsyncIterator`)}o(ro,"streamAsyncIteratorBrandCheckException");let Ut=Number.isNaN||function(a){return a!==a};var Lr,_t,st;function je(a){return a.slice()}o(je,"CreateArrayFromList");function Bp(a,s,d,v,A){new Uint8Array(a).set(new Uint8Array(d,v,A),s)}o(Bp,"CopyDataBlockBytes");let Fr=o(a=>(typeof a.transfer=="function"?Fr=o(s=>s.transfer(),"TransferArrayBuffer"):typeof structuredClone=="function"?Fr=o(s=>structuredClone(s,{transfer:[s]}),"TransferArrayBuffer"):Fr=o(s=>s,"TransferArrayBuffer"),Fr(a)),"TransferArrayBuffer"),an=o(a=>(typeof a.detached=="boolean"?an=o(s=>s.detached,"IsDetachedBuffer"):an=o(s=>s.byteLength===0,"IsDetachedBuffer"),an(a)),"IsDetachedBuffer");function qp(a,s,d){if(a.slice)return a.slice(s,d);let v=d-s,A=new ArrayBuffer(v);return Bp(A,0,a,s,v),A}o(qp,"ArrayBufferSlice");function fa(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(fa,"GetMethod");function RS(a){let s={[Symbol.iterator]:()=>a.iterator},d=async function*(){return yield*s}(),v=d.next;return{iterator:d,nextMethod:v,done:!1}}o(RS,"CreateAsyncFromSyncIterator");let Bu=(st=(Lr=Symbol.asyncIterator)!==null&&Lr!==void 0?Lr:(_t=Symbol.for)===null||_t===void 0?void 0:_t.call(Symbol,"Symbol.asyncIterator"))!==null&&st!==void 0?st:"@@asyncIterator";function Vp(a,s="sync",d){if(d===void 0)if(s==="async"){if(d=fa(a,Bu),d===void 0){let j=fa(a,Symbol.iterator),L=Vp(a,"sync",j);return RS(L)}}else d=fa(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(Vp,"GetIterator");function CS(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(CS,"IteratorNext");function kS(a){return!!a.done}o(kS,"IteratorComplete");function OS(a){return a.value}o(OS,"IteratorValue");function $S(a){return!(typeof a!="number"||Ut(a)||a<0)}o($S,"IsNonNegativeNumber");function Hp(a){let s=qp(a.buffer,a.byteOffset,a.byteOffset+a.byteLength);return new Uint8Array(s)}o(Hp,"CloneAsUint8Array");function qu(a){let s=a._queue.shift();return a._queueTotalSize-=s.size,a._queueTotalSize<0&&(a._queueTotalSize=0),s.value}o(qu,"DequeueValue");function Vu(a,s,d){if(!$S(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(Vu,"EnqueueValueWithSize");function zS(a){return a._queue.peek().value}o(zS,"PeekQueueValue");function sn(a){a._queue=new V,a._queueTotalSize=0}o(sn,"ResetQueue");function Wp(a){return a===DataView}o(Wp,"isDataViewConstructor");function NS(a){return Wp(a.constructor)}o(NS,"isDataView");function DS(a){return Wp(a)?1:a.BYTES_PER_ELEMENT}o(DS,"arrayBufferViewElementSize");class Cn{static{o(this,"ReadableStreamBYOBRequest")}constructor(){throw new TypeError("Illegal constructor")}get view(){if(!Hu(this))throw Ku("view");return this._view}respond(s){if(!Hu(this))throw Ku("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(an(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");ya(this._associatedReadableByteStreamController,s)}respondWithNewView(s){if(!Hu(this))throw Ku("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(an(s.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");_a(this._associatedReadableByteStreamController,s)}}Object.defineProperties(Cn.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),i(Cn.prototype.respond,"respond"),i(Cn.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Cn.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Br{static{o(this,"ReadableByteStreamController")}constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!kn(this))throw ai("byobRequest");return Ju(this)}get desiredSize(){if(!kn(this))throw ai("desiredSize");return rf(this)}close(){if(!kn(this))throw ai("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`);ii(this)}enqueue(s){if(!kn(this))throw ai("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`);ga(this,s)}error(s=void 0){if(!kn(this))throw ai("error");Xt(this,s)}[te](s){Gp(this),sn(this);let d=this._cancelAlgorithm(s);return ha(this),d}[Z](s){let d=this._controlledReadableByteStream;if(this._queueTotalSize>0){tf(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 j={buffer:A,bufferByteLength:v,byteOffset:0,byteLength:v,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(j)}I(d,s),On(this)}[Ne](){if(this._pendingPullIntos.length>0){let s=this._pendingPullIntos.peek();s.readerType="none",this._pendingPullIntos=new V,this._pendingPullIntos.push(s)}}}Object.defineProperties(Br.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),i(Br.prototype.close,"close"),i(Br.prototype.enqueue,"enqueue"),i(Br.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Br.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function kn(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_controlledReadableByteStream")?!1:a instanceof Br}o(kn,"IsReadableByteStreamController");function Hu(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_associatedReadableByteStreamController")?!1:a instanceof Cn}o(Hu,"IsReadableStreamBYOBRequest");function On(a){if(!FS(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,On(a)),null),v=>(Xt(a,v),null))}o(On,"ReadableByteStreamControllerCallPullIfNeeded");function Gp(a){Gu(a),a._pendingPullIntos=new V}o(Gp,"ReadableByteStreamControllerClearPendingPullIntos");function Wu(a,s){let d=!1;a._state==="closed"&&(d=!0);let v=Zp(s);s.readerType==="default"?C(a,v,d):GS(a,v,d)}o(Wu,"ReadableByteStreamControllerCommitPullIntoDescriptor");function Zp(a){let s=a.bytesFilled,d=a.elementSize;return new a.viewConstructor(a.buffer,a.byteOffset,s/d)}o(Zp,"ReadableByteStreamControllerConvertPullIntoDescriptor");function ma(a,s,d,v){a._queue.push({buffer:s,byteOffset:d,byteLength:v}),a._queueTotalSize+=v}o(ma,"ReadableByteStreamControllerEnqueueChunkToQueue");function Jp(a,s,d,v){let A;try{A=qp(s,d,d+v)}catch(j){throw Xt(a,j),j}ma(a,A,0,v)}o(Jp,"ReadableByteStreamControllerEnqueueClonedChunkToQueue");function Kp(a,s){s.bytesFilled>0&&Jp(a,s.buffer,s.byteOffset,s.bytesFilled),no(a)}o(Kp,"ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue");function Qp(a,s){let d=Math.min(a._queueTotalSize,s.byteLength-s.bytesFilled),v=s.bytesFilled+d,A=d,j=!1,L=v%s.elementSize,Q=v-L;Q>=s.minimumFill&&(A=Q-s.bytesFilled,j=!0);let ue=a._queue;for(;A>0;){let oe=ue.peek(),he=Math.min(A,oe.byteLength),ve=s.byteOffset+s.bytesFilled;Bp(s.buffer,ve,oe.buffer,oe.byteOffset,he),oe.byteLength===he?ue.shift():(oe.byteOffset+=he,oe.byteLength-=he),a._queueTotalSize-=he,Yp(a,he,s),A-=he}return j}o(Qp,"ReadableByteStreamControllerFillPullIntoDescriptorFromQueue");function Yp(a,s,d){d.bytesFilled+=s}o(Yp,"ReadableByteStreamControllerFillHeadPullIntoDescriptor");function Xp(a){a._queueTotalSize===0&&a._closeRequested?(ha(a),pi(a._controlledReadableByteStream)):On(a)}o(Xp,"ReadableByteStreamControllerHandleQueueDrain");function Gu(a){a._byobRequest!==null&&(a._byobRequest._associatedReadableByteStreamController=void 0,a._byobRequest._view=null,a._byobRequest=null)}o(Gu,"ReadableByteStreamControllerInvalidateBYOBRequest");function Zu(a){for(;a._pendingPullIntos.length>0;){if(a._queueTotalSize===0)return;let s=a._pendingPullIntos.peek();Qp(a,s)&&(no(a),Wu(a._controlledReadableByteStream,s))}}o(Zu,"ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue");function jS(a){let s=a._controlledReadableByteStream._reader;for(;s._readRequests.length>0;){if(a._queueTotalSize===0)return;let d=s._readRequests.shift();tf(a,d)}}o(jS,"ReadableByteStreamControllerProcessReadRequestsUsingQueue");function US(a,s,d,v){let A=a._controlledReadableByteStream,j=s.constructor,L=DS(j),{byteOffset:Q,byteLength:ue}=s,oe=d*L,he;try{he=Fr(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:j,readerType:"byob"};if(a._pendingPullIntos.length>0){a._pendingPullIntos.push(ve),af(A,v);return}if(A._state==="closed"){let Le=new j(ve.buffer,ve.byteOffset,0);v._closeSteps(Le);return}if(a._queueTotalSize>0){if(Qp(a,ve)){let Le=Zp(ve);Xp(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),af(A,v),On(a)}o(US,"ReadableByteStreamControllerPullInto");function MS(a,s){s.readerType==="none"&&no(a);let d=a._controlledReadableByteStream;if(Qu(d))for(;sf(d)>0;){let v=no(a);Wu(d,v)}}o(MS,"ReadableByteStreamControllerRespondInClosedState");function LS(a,s,d){if(Yp(a,s,d),d.readerType==="none"){Kp(a,d),Zu(a);return}if(d.bytesFilled<d.minimumFill)return;no(a);let v=d.bytesFilled%d.elementSize;if(v>0){let A=d.byteOffset+d.bytesFilled;Jp(a,d.buffer,A-v,v)}d.bytesFilled-=v,Wu(a._controlledReadableByteStream,d),Zu(a)}o(LS,"ReadableByteStreamControllerRespondInReadableState");function ef(a,s){let d=a._pendingPullIntos.peek();Gu(a),a._controlledReadableByteStream._state==="closed"?MS(a,d):LS(a,s,d),On(a)}o(ef,"ReadableByteStreamControllerRespondInternal");function no(a){return a._pendingPullIntos.shift()}o(no,"ReadableByteStreamControllerShiftPendingPullInto");function FS(a){let s=a._controlledReadableByteStream;return s._state!=="readable"||a._closeRequested||!a._started?!1:!!(z(s)&&D(s)>0||Qu(s)&&sf(s)>0||rf(a)>0)}o(FS,"ReadableByteStreamControllerShouldCallPull");function ha(a){a._pullAlgorithm=void 0,a._cancelAlgorithm=void 0}o(ha,"ReadableByteStreamControllerClearAlgorithms");function ii(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}}ha(a),pi(s)}}o(ii,"ReadableByteStreamControllerClose");function ga(a,s){let d=a._controlledReadableByteStream;if(a._closeRequested||d._state!=="readable")return;let{buffer:v,byteOffset:A,byteLength:j}=s;if(an(v))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");let L=Fr(v);if(a._pendingPullIntos.length>0){let Q=a._pendingPullIntos.peek();if(an(Q.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");Gu(a),Q.buffer=Fr(Q.buffer),Q.readerType==="none"&&Kp(a,Q)}if(z(d))if(jS(a),D(d)===0)ma(a,L,A,j);else{a._pendingPullIntos.length>0&&no(a);let Q=new Uint8Array(L,A,j);C(d,Q,!1)}else Qu(d)?(ma(a,L,A,j),Zu(a)):ma(a,L,A,j);On(a)}o(ga,"ReadableByteStreamControllerEnqueue");function Xt(a,s){let d=a._controlledReadableByteStream;d._state==="readable"&&(Gp(a),sn(a),ha(a),kf(d,s))}o(Xt,"ReadableByteStreamControllerError");function tf(a,s){let d=a._queue.shift();a._queueTotalSize-=d.byteLength,Xp(a);let v=new Uint8Array(d.buffer,d.byteOffset,d.byteLength);s._chunkSteps(v)}o(tf,"ReadableByteStreamControllerFillReadRequestFromQueue");function Ju(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(Cn.prototype);qS(v,a,d),a._byobRequest=v}return a._byobRequest}o(Ju,"ReadableByteStreamControllerGetBYOBRequest");function rf(a){let s=a._controlledReadableByteStream._state;return s==="errored"?null:s==="closed"?0:a._strategyHWM-a._queueTotalSize}o(rf,"ReadableByteStreamControllerGetDesiredSize");function ya(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=Fr(d.buffer),ef(a,s)}o(ya,"ReadableByteStreamControllerRespond");function _a(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=Fr(s.buffer),ef(a,A)}o(_a,"ReadableByteStreamControllerRespondWithNewView");function nf(a,s,d,v,A,j,L){s._controlledReadableByteStream=a,s._pullAgain=!1,s._pulling=!1,s._byobRequest=null,s._queue=s._queueTotalSize=void 0,sn(s),s._closeRequested=!1,s._started=!1,s._strategyHWM=j,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,On(s),null),ue=>(Xt(s,ue),null))}o(nf,"SetUpReadableByteStreamController");function BS(a,s,d){let v=Object.create(Br.prototype),A,j,L;s.start!==void 0?A=o(()=>s.start(v),"startAlgorithm"):A=o(()=>{},"startAlgorithm"),s.pull!==void 0?j=o(()=>s.pull(v),"pullAlgorithm"):j=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");nf(a,v,A,j,L,d,Q)}o(BS,"SetUpReadableByteStreamControllerFromUnderlyingSource");function qS(a,s,d){a._associatedReadableByteStreamController=s,a._view=d}o(qS,"SetUpReadableStreamBYOBRequest");function Ku(a){return new TypeError(`ReadableStreamBYOBRequest.prototype.${a} can only be used on a ReadableStreamBYOBRequest`)}o(Ku,"byobRequestBrandCheckException");function ai(a){return new TypeError(`ReadableByteStreamController.prototype.${a} can only be used on a ReadableByteStreamController`)}o(ai,"byteStreamControllerBrandCheckException");function VS(a,s){Rt(a,s);let d=a?.mode;return{mode:d===void 0?void 0:HS(d,`${s} has member 'mode' that`)}}o(VS,"convertReaderOptions");function HS(a,s){if(a=`${a}`,a!=="byob")throw new TypeError(`${s} '${a}' is not a valid enumeration value for ReadableStreamReaderMode`);return a}o(HS,"convertReadableStreamReaderMode");function WS(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(WS,"convertByobReadOptions");function of(a){return new un(a)}o(of,"AcquireReadableStreamBYOBReader");function af(a,s){a._reader._readIntoRequests.push(s)}o(af,"ReadableStreamAddReadIntoRequest");function GS(a,s,d){let A=a._reader._readIntoRequests.shift();d?A._closeSteps(s):A._chunkSteps(s)}o(GS,"ReadableStreamFulfillReadIntoRequest");function sf(a){return a._reader._readIntoRequests.length}o(sf,"ReadableStreamGetNumReadIntoRequests");function Qu(a){let s=a._reader;return!(s===void 0||!$n(s))}o(Qu,"ReadableStreamHasBYOBReader");class un{static{o(this,"ReadableStreamBYOBReader")}constructor(s){if(it(s,1,"ReadableStreamBYOBReader"),$(s,"First parameter"),dn(s))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!kn(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 $n(this)?this._closedPromise:m(ba("closed"))}cancel(s=void 0){return $n(this)?this._ownerReadableStream===void 0?m(Ie("cancel")):be(this,s):m(ba("cancel"))}read(s,d={}){if(!$n(this))return m(ba("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(an(s.buffer))return m(new TypeError("view's buffer has been detached"));let v;try{v=WS(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(Ie("read from"));let j,L,Q=p((oe,he)=>{j=oe,L=he});return uf(this,s,A,{_chunkSteps:o(oe=>j({value:oe,done:!1}),"_chunkSteps"),_closeSteps:o(oe=>j({value:oe,done:!0}),"_closeSteps"),_errorSteps:o(oe=>L(oe),"_errorSteps")}),Q}releaseLock(){if(!$n(this))throw ba("releaseLock");this._ownerReadableStream!==void 0&&ZS(this)}}Object.defineProperties(un.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),i(un.prototype.cancel,"cancel"),i(un.prototype.read,"read"),i(un.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(un.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function $n(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_readIntoRequests")?!1:a instanceof un}o($n,"IsReadableStreamBYOBReader");function uf(a,s,d,v){let A=a._ownerReadableStream;A._disturbed=!0,A._state==="errored"?v._errorSteps(A._storedError):US(A._readableStreamController,s,d,v)}o(uf,"ReadableStreamBYOBReaderRead");function ZS(a){Oe(a);let s=new TypeError("Reader was released");cf(a,s)}o(ZS,"ReadableStreamBYOBReaderRelease");function cf(a,s){let d=a._readIntoRequests;a._readIntoRequests=new V,d.forEach(v=>{v._errorSteps(s)})}o(cf,"ReadableStreamBYOBReaderErrorReadIntoRequests");function ba(a){return new TypeError(`ReadableStreamBYOBReader.prototype.${a} can only be used on a ReadableStreamBYOBReader`)}o(ba,"byobReaderBrandCheckException");function si(a,s){let{highWaterMark:d}=a;if(d===void 0)return s;if(Ut(d)||d<0)throw new RangeError("Invalid highWaterMark");return d}o(si,"ExtractHighWaterMark");function va(a){let{size:s}=a;return s||(()=>1)}o(va,"ExtractSizeAlgorithm");function Ea(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:JS(v,`${s} has member 'size' that`)}}o(Ea,"convertQueuingStrategy");function JS(a,s){return St(a,s),d=>P(a(d))}o(JS,"convertQueuingStrategySize");function KS(a,s){Rt(a,s);let d=a?.abort,v=a?.close,A=a?.start,j=a?.type,L=a?.write;return{abort:d===void 0?void 0:QS(d,a,`${s} has member 'abort' that`),close:v===void 0?void 0:YS(v,a,`${s} has member 'close' that`),start:A===void 0?void 0:XS(A,a,`${s} has member 'start' that`),write:L===void 0?void 0:eP(L,a,`${s} has member 'write' that`),type:j}}o(KS,"convertUnderlyingSink");function QS(a,s,d){return St(a,d),v=>B(a,s,[v])}o(QS,"convertUnderlyingSinkAbortCallback");function YS(a,s,d){return St(a,d),()=>B(a,s,[])}o(YS,"convertUnderlyingSinkCloseCallback");function XS(a,s,d){return St(a,d),v=>k(a,s,[v])}o(XS,"convertUnderlyingSinkStartCallback");function eP(a,s,d){return St(a,d),(v,A)=>B(a,s,[v,A])}o(eP,"convertUnderlyingSinkWriteCallback");function lf(a,s){if(!oo(a))throw new TypeError(`${s} is not a WritableStream.`)}o(lf,"assertWritableStream");function tP(a){if(typeof a!="object"||a===null)return!1;try{return typeof a.aborted=="boolean"}catch{return!1}}o(tP,"isAbortSignal");let rP=typeof AbortController=="function";function nP(){if(rP)return new AbortController}o(nP,"createAbortController");class cn{static{o(this,"WritableStream")}constructor(s={},d={}){s===void 0?s=null:Pt(s,"First parameter");let v=Ea(d,"Second parameter"),A=KS(s,"First parameter");if(pf(this),A.type!==void 0)throw new RangeError("Invalid type is specified");let L=va(v),Q=si(v,1);yP(this,A,Q,L)}get locked(){if(!oo(this))throw xa("locked");return io(this)}abort(s=void 0){return oo(this)?io(this)?m(new TypeError("Cannot abort a stream that already has a writer")):Sa(this,s):m(xa("abort"))}close(){return oo(this)?io(this)?m(new TypeError("Cannot close a stream that already has a writer")):xr(this)?m(new TypeError("Cannot close an already-closing stream")):ff(this):m(xa("close"))}getWriter(){if(!oo(this))throw xa("getWriter");return df(this)}}Object.defineProperties(cn.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),i(cn.prototype.abort,"abort"),i(cn.prototype.close,"close"),i(cn.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(cn.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});function df(a){return new qr(a)}o(df,"AcquireWritableStreamDefaultWriter");function oP(a,s,d,v,A=1,j=()=>1){let L=Object.create(cn.prototype);pf(L);let Q=Object.create(ao.prototype);return bf(L,Q,a,s,d,v,A,j),L}o(oP,"CreateWritableStream");function pf(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(pf,"InitializeWritableStream");function oo(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_writableStreamController")?!1:a instanceof cn}o(oo,"IsWritableStream");function io(a){return a._writer!==void 0}o(io,"IsWritableStreamLocked");function Sa(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 j=p((L,Q)=>{a._pendingAbortRequest={_promise:void 0,_resolve:L,_reject:Q,_reason:s,_wasAlreadyErroring:A}});return a._pendingAbortRequest._promise=j,A||Xu(a,s),j}o(Sa,"WritableStreamAbort");function ff(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,j)=>{let L={_resolve:A,_reject:j};a._closeRequest=L}),v=a._writer;return v!==void 0&&a._backpressure&&s==="writable"&&sc(v),_P(a._writableStreamController),d}o(ff,"WritableStreamClose");function iP(a){return p((d,v)=>{let A={_resolve:d,_reject:v};a._writeRequests.push(A)})}o(iP,"WritableStreamAddWriteRequest");function Yu(a,s){if(a._state==="writable"){Xu(a,s);return}ec(a)}o(Yu,"WritableStreamDealWithRejection");function Xu(a,s){let d=a._writableStreamController;a._state="erroring",a._storedError=s;let v=a._writer;v!==void 0&&hf(v,s),!lP(a)&&d._started&&ec(a)}o(Xu,"WritableStreamStartErroring");function ec(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){Pa(a);return}let d=a._pendingAbortRequest;if(a._pendingAbortRequest=void 0,d._wasAlreadyErroring){d._reject(s),Pa(a);return}let v=a._writableStreamController[H](d._reason);S(v,()=>(d._resolve(),Pa(a),null),A=>(d._reject(A),Pa(a),null))}o(ec,"WritableStreamFinishErroring");function aP(a){a._inFlightWriteRequest._resolve(void 0),a._inFlightWriteRequest=void 0}o(aP,"WritableStreamFinishInFlightWrite");function sP(a,s){a._inFlightWriteRequest._reject(s),a._inFlightWriteRequest=void 0,Yu(a,s)}o(sP,"WritableStreamFinishInFlightWriteWithError");function uP(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&&Pf(d)}o(uP,"WritableStreamFinishInFlightClose");function cP(a,s){a._inFlightCloseRequest._reject(s),a._inFlightCloseRequest=void 0,a._pendingAbortRequest!==void 0&&(a._pendingAbortRequest._reject(s),a._pendingAbortRequest=void 0),Yu(a,s)}o(cP,"WritableStreamFinishInFlightCloseWithError");function xr(a){return!(a._closeRequest===void 0&&a._inFlightCloseRequest===void 0)}o(xr,"WritableStreamCloseQueuedOrInFlight");function lP(a){return!(a._inFlightWriteRequest===void 0&&a._inFlightCloseRequest===void 0)}o(lP,"WritableStreamHasOperationMarkedInFlight");function dP(a){a._inFlightCloseRequest=a._closeRequest,a._closeRequest=void 0}o(dP,"WritableStreamMarkCloseRequestInFlight");function pP(a){a._inFlightWriteRequest=a._writeRequests.shift()}o(pP,"WritableStreamMarkFirstWriteRequestInFlight");function Pa(a){a._closeRequest!==void 0&&(a._closeRequest._reject(a._storedError),a._closeRequest=void 0);let s=a._writer;s!==void 0&&ic(s,a._storedError)}o(Pa,"WritableStreamRejectCloseAndClosedPromiseIfNeeded");function tc(a,s){let d=a._writer;d!==void 0&&s!==a._backpressure&&(s?TP(d):sc(d)),a._backpressure=s}o(tc,"WritableStreamUpdateBackpressure");class qr{static{o(this,"WritableStreamDefaultWriter")}constructor(s){if(it(s,1,"WritableStreamDefaultWriter"),lf(s,"First parameter"),io(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?Ia(this):wf(this),Aa(this);else if(d==="erroring")ac(this,s._storedError),Aa(this);else if(d==="closed")wf(this),PP(this);else{let v=s._storedError;ac(this,v),Sf(this,v)}}get closed(){return zn(this)?this._closedPromise:m(Nn("closed"))}get desiredSize(){if(!zn(this))throw Nn("desiredSize");if(this._ownerWritableStream===void 0)throw ci("desiredSize");return gP(this)}get ready(){return zn(this)?this._readyPromise:m(Nn("ready"))}abort(s=void 0){return zn(this)?this._ownerWritableStream===void 0?m(ci("abort")):fP(this,s):m(Nn("abort"))}close(){if(!zn(this))return m(Nn("close"));let s=this._ownerWritableStream;return s===void 0?m(ci("close")):xr(s)?m(new TypeError("Cannot close an already-closing stream")):mf(this)}releaseLock(){if(!zn(this))throw Nn("releaseLock");this._ownerWritableStream!==void 0&&gf(this)}write(s=void 0){return zn(this)?this._ownerWritableStream===void 0?m(ci("write to")):yf(this,s):m(Nn("write"))}}Object.defineProperties(qr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),i(qr.prototype.abort,"abort"),i(qr.prototype.close,"close"),i(qr.prototype.releaseLock,"releaseLock"),i(qr.prototype.write,"write"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(qr.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function zn(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_ownerWritableStream")?!1:a instanceof qr}o(zn,"IsWritableStreamDefaultWriter");function fP(a,s){let d=a._ownerWritableStream;return Sa(d,s)}o(fP,"WritableStreamDefaultWriterAbort");function mf(a){let s=a._ownerWritableStream;return ff(s)}o(mf,"WritableStreamDefaultWriterClose");function mP(a){let s=a._ownerWritableStream,d=s._state;return xr(s)||d==="closed"?f(void 0):d==="errored"?m(s._storedError):mf(a)}o(mP,"WritableStreamDefaultWriterCloseWithErrorPropagation");function hP(a,s){a._closedPromiseState==="pending"?ic(a,s):wP(a,s)}o(hP,"WritableStreamDefaultWriterEnsureClosedPromiseRejected");function hf(a,s){a._readyPromiseState==="pending"?Tf(a,s):xP(a,s)}o(hf,"WritableStreamDefaultWriterEnsureReadyPromiseRejected");function gP(a){let s=a._ownerWritableStream,d=s._state;return d==="errored"||d==="erroring"?null:d==="closed"?0:vf(s._writableStreamController)}o(gP,"WritableStreamDefaultWriterGetDesiredSize");function gf(a){let s=a._ownerWritableStream,d=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");hf(a,d),hP(a,d),s._writer=void 0,a._ownerWritableStream=void 0}o(gf,"WritableStreamDefaultWriterRelease");function yf(a,s){let d=a._ownerWritableStream,v=d._writableStreamController,A=bP(v,s);if(d!==a._ownerWritableStream)return m(ci("write to"));let j=d._state;if(j==="errored")return m(d._storedError);if(xr(d)||j==="closed")return m(new TypeError("The stream is closing or closed and cannot be written to"));if(j==="erroring")return m(d._storedError);let L=iP(d);return vP(v,s,A),L}o(yf,"WritableStreamDefaultWriterWrite");let _f={};class ao{static{o(this,"WritableStreamDefaultController")}constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!rc(this))throw oc("abortReason");return this._abortReason}get signal(){if(!rc(this))throw oc("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(s=void 0){if(!rc(this))throw oc("error");this._controlledWritableStream._state==="writable"&&Ef(this,s)}[H](s){let d=this._abortAlgorithm(s);return wa(this),d}[J](){sn(this)}}Object.defineProperties(ao.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ao.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function rc(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_controlledWritableStream")?!1:a instanceof ao}o(rc,"IsWritableStreamDefaultController");function bf(a,s,d,v,A,j,L,Q){s._controlledWritableStream=a,a._writableStreamController=s,s._queue=void 0,s._queueTotalSize=void 0,sn(s),s._abortReason=void 0,s._abortController=nP(),s._started=!1,s._strategySizeAlgorithm=Q,s._strategyHWM=L,s._writeAlgorithm=v,s._closeAlgorithm=A,s._abortAlgorithm=j;let ue=nc(s);tc(a,ue);let oe=d(),he=f(oe);S(he,()=>(s._started=!0,Ta(s),null),ve=>(s._started=!0,Yu(a,ve),null))}o(bf,"SetUpWritableStreamDefaultController");function yP(a,s,d,v){let A=Object.create(ao.prototype),j,L,Q,ue;s.start!==void 0?j=o(()=>s.start(A),"startAlgorithm"):j=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"),bf(a,A,j,L,Q,ue,d,v)}o(yP,"SetUpWritableStreamDefaultControllerFromUnderlyingSink");function wa(a){a._writeAlgorithm=void 0,a._closeAlgorithm=void 0,a._abortAlgorithm=void 0,a._strategySizeAlgorithm=void 0}o(wa,"WritableStreamDefaultControllerClearAlgorithms");function _P(a){Vu(a,_f,0),Ta(a)}o(_P,"WritableStreamDefaultControllerClose");function bP(a,s){try{return a._strategySizeAlgorithm(s)}catch(d){return ui(a,d),1}}o(bP,"WritableStreamDefaultControllerGetChunkSize");function vf(a){return a._strategyHWM-a._queueTotalSize}o(vf,"WritableStreamDefaultControllerGetDesiredSize");function vP(a,s,d){try{Vu(a,s,d)}catch(A){ui(a,A);return}let v=a._controlledWritableStream;if(!xr(v)&&v._state==="writable"){let A=nc(a);tc(v,A)}Ta(a)}o(vP,"WritableStreamDefaultControllerWrite");function Ta(a){let s=a._controlledWritableStream;if(!a._started||s._inFlightWriteRequest!==void 0)return;if(s._state==="erroring"){ec(s);return}if(a._queue.length===0)return;let v=zS(a);v===_f?EP(a):SP(a,v)}o(Ta,"WritableStreamDefaultControllerAdvanceQueueIfNeeded");function ui(a,s){a._controlledWritableStream._state==="writable"&&Ef(a,s)}o(ui,"WritableStreamDefaultControllerErrorIfNeeded");function EP(a){let s=a._controlledWritableStream;dP(s),qu(a);let d=a._closeAlgorithm();wa(a),S(d,()=>(uP(s),null),v=>(cP(s,v),null))}o(EP,"WritableStreamDefaultControllerProcessClose");function SP(a,s){let d=a._controlledWritableStream;pP(d);let v=a._writeAlgorithm(s);S(v,()=>{aP(d);let A=d._state;if(qu(a),!xr(d)&&A==="writable"){let j=nc(a);tc(d,j)}return Ta(a),null},A=>(d._state==="writable"&&wa(a),sP(d,A),null))}o(SP,"WritableStreamDefaultControllerProcessWrite");function nc(a){return vf(a)<=0}o(nc,"WritableStreamDefaultControllerGetBackpressure");function Ef(a,s){let d=a._controlledWritableStream;wa(a),Xu(d,s)}o(Ef,"WritableStreamDefaultControllerError");function xa(a){return new TypeError(`WritableStream.prototype.${a} can only be used on a WritableStream`)}o(xa,"streamBrandCheckException$2");function oc(a){return new TypeError(`WritableStreamDefaultController.prototype.${a} can only be used on a WritableStreamDefaultController`)}o(oc,"defaultControllerBrandCheckException$2");function Nn(a){return new TypeError(`WritableStreamDefaultWriter.prototype.${a} can only be used on a WritableStreamDefaultWriter`)}o(Nn,"defaultWriterBrandCheckException");function ci(a){return new TypeError("Cannot "+a+" a stream using a released writer")}o(ci,"defaultWriterLockException");function Aa(a){a._closedPromise=p((s,d)=>{a._closedPromise_resolve=s,a._closedPromise_reject=d,a._closedPromiseState="pending"})}o(Aa,"defaultWriterClosedPromiseInitialize");function Sf(a,s){Aa(a),ic(a,s)}o(Sf,"defaultWriterClosedPromiseInitializeAsRejected");function PP(a){Aa(a),Pf(a)}o(PP,"defaultWriterClosedPromiseInitializeAsResolved");function ic(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(ic,"defaultWriterClosedPromiseReject");function wP(a,s){Sf(a,s)}o(wP,"defaultWriterClosedPromiseResetToRejected");function Pf(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(Pf,"defaultWriterClosedPromiseResolve");function Ia(a){a._readyPromise=p((s,d)=>{a._readyPromise_resolve=s,a._readyPromise_reject=d}),a._readyPromiseState="pending"}o(Ia,"defaultWriterReadyPromiseInitialize");function ac(a,s){Ia(a),Tf(a,s)}o(ac,"defaultWriterReadyPromiseInitializeAsRejected");function wf(a){Ia(a),sc(a)}o(wf,"defaultWriterReadyPromiseInitializeAsResolved");function Tf(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(Tf,"defaultWriterReadyPromiseReject");function TP(a){Ia(a)}o(TP,"defaultWriterReadyPromiseReset");function xP(a,s){ac(a,s)}o(xP,"defaultWriterReadyPromiseResetToRejected");function sc(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(sc,"defaultWriterReadyPromiseResolve");function AP(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof global<"u")return global}o(AP,"getGlobals");let uc=AP();function IP(a){if(!(typeof a=="function"||typeof a=="object")||a.name!=="DOMException")return!1;try{return new a,!0}catch{return!1}}o(IP,"isDOMExceptionConstructor");function RP(){let a=uc?.DOMException;return IP(a)?a:void 0}o(RP,"getFromGlobal");function CP(){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(CP,"createPolyfill");let kP=RP()||CP();function xf(a,s,d,v,A,j){let L=U(a),Q=df(s);a._disturbed=!0;let ue=!1,oe=f(void 0);return p((he,ve)=>{let Le;if(j!==void 0){if(Le=o(()=>{let ie=j.reason!==void 0?j.reason:new kP("Aborted","AbortError"),Te=[];v||Te.push(()=>s._state==="writable"?Sa(s,ie):f(void 0)),A||Te.push(()=>a._state==="readable"?dr(a,ie):f(void 0)),Ct(()=>Promise.all(Te.map(Fe=>Fe())),!0,ie)},"abortAlgorithm"),j.aborted){Le();return}j.addEventListener("abort",Le)}function pr(){return p((ie,Te)=>{function Fe(Mt){Mt?ie():g(lo(),Fe,Te)}o(Fe,"next"),Fe(!1)})}o(pr,"pipeLoop");function lo(){return ue?f(!0):g(Q._readyPromise,()=>p((ie,Te)=>{ee(L,{_chunkSteps:o(Fe=>{oe=g(yf(Q,Fe),void 0,e),ie(!1)},"_chunkSteps"),_closeSteps:o(()=>ie(!0),"_closeSteps"),_errorSteps:Te})}))}if(o(lo,"pipeStep"),Hr(a,L._closedPromise,ie=>(v?er(!0,ie):Ct(()=>Sa(s,ie),!0,ie),null)),Hr(s,Q._closedPromise,ie=>(A?er(!0,ie):Ct(()=>dr(a,ie),!0,ie),null)),wt(a,L._closedPromise,()=>(d?er():Ct(()=>mP(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 fn(){let ie=oe;return g(oe,()=>ie!==oe?fn():void 0)}o(fn,"waitForWritesToFinish");function Hr(ie,Te,Fe){ie._state==="errored"?Fe(ie._storedError):_(Te,Fe)}o(Hr,"isOrBecomesErrored");function wt(ie,Te,Fe){ie._state==="closed"?Fe():h(Te,Fe)}o(wt,"isOrBecomesClosed");function Ct(ie,Te,Fe){if(ue)return;ue=!0,s._state==="writable"&&!xr(s)?h(fn(),Mt):Mt();function Mt(){return S(ie(),()=>Wr(Te,Fe),po=>Wr(!0,po)),null}o(Mt,"doTheRest")}o(Ct,"shutdownWithAction");function er(ie,Te){ue||(ue=!0,s._state==="writable"&&!xr(s)?h(fn(),()=>Wr(ie,Te)):Wr(ie,Te))}o(er,"shutdown");function Wr(ie,Te){return gf(Q),Oe(L),j!==void 0&&j.removeEventListener("abort",Le),ie?ve(Te):he(void 0),null}o(Wr,"finalize")})}o(xf,"ReadableStreamPipeTo");class Vr{static{o(this,"ReadableStreamDefaultController")}constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Ra(this))throw ka("desiredSize");return cc(this)}close(){if(!Ra(this))throw ka("close");if(!uo(this))throw new TypeError("The stream is not in a state that permits close");Dn(this)}enqueue(s=void 0){if(!Ra(this))throw ka("enqueue");if(!uo(this))throw new TypeError("The stream is not in a state that permits enqueue");return so(this,s)}error(s=void 0){if(!Ra(this))throw ka("error");lr(this,s)}[te](s){sn(this);let d=this._cancelAlgorithm(s);return Ca(this),d}[Z](s){let d=this._controlledReadableStream;if(this._queue.length>0){let v=qu(this);this._closeRequested&&this._queue.length===0?(Ca(this),pi(d)):li(this),s._chunkSteps(v)}else I(d,s),li(this)}[Ne](){}}Object.defineProperties(Vr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),i(Vr.prototype.close,"close"),i(Vr.prototype.enqueue,"enqueue"),i(Vr.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Vr.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function Ra(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_controlledReadableStream")?!1:a instanceof Vr}o(Ra,"IsReadableStreamDefaultController");function li(a){if(!Af(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,li(a)),null),v=>(lr(a,v),null))}o(li,"ReadableStreamDefaultControllerCallPullIfNeeded");function Af(a){let s=a._controlledReadableStream;return!uo(a)||!a._started?!1:!!(dn(s)&&D(s)>0||cc(a)>0)}o(Af,"ReadableStreamDefaultControllerShouldCallPull");function Ca(a){a._pullAlgorithm=void 0,a._cancelAlgorithm=void 0,a._strategySizeAlgorithm=void 0}o(Ca,"ReadableStreamDefaultControllerClearAlgorithms");function Dn(a){if(!uo(a))return;let s=a._controlledReadableStream;a._closeRequested=!0,a._queue.length===0&&(Ca(a),pi(s))}o(Dn,"ReadableStreamDefaultControllerClose");function so(a,s){if(!uo(a))return;let d=a._controlledReadableStream;if(dn(d)&&D(d)>0)C(d,s,!1);else{let v;try{v=a._strategySizeAlgorithm(s)}catch(A){throw lr(a,A),A}try{Vu(a,s,v)}catch(A){throw lr(a,A),A}}li(a)}o(so,"ReadableStreamDefaultControllerEnqueue");function lr(a,s){let d=a._controlledReadableStream;d._state==="readable"&&(sn(a),Ca(a),kf(d,s))}o(lr,"ReadableStreamDefaultControllerError");function cc(a){let s=a._controlledReadableStream._state;return s==="errored"?null:s==="closed"?0:a._strategyHWM-a._queueTotalSize}o(cc,"ReadableStreamDefaultControllerGetDesiredSize");function OP(a){return!Af(a)}o(OP,"ReadableStreamDefaultControllerHasBackpressure");function uo(a){let s=a._controlledReadableStream._state;return!a._closeRequested&&s==="readable"}o(uo,"ReadableStreamDefaultControllerCanCloseOrEnqueue");function If(a,s,d,v,A,j,L){s._controlledReadableStream=a,s._queue=void 0,s._queueTotalSize=void 0,sn(s),s._started=!1,s._closeRequested=!1,s._pullAgain=!1,s._pulling=!1,s._strategySizeAlgorithm=L,s._strategyHWM=j,s._pullAlgorithm=v,s._cancelAlgorithm=A,a._readableStreamController=s;let Q=d();S(f(Q),()=>(s._started=!0,li(s),null),ue=>(lr(s,ue),null))}o(If,"SetUpReadableStreamDefaultController");function $P(a,s,d,v){let A=Object.create(Vr.prototype),j,L,Q;s.start!==void 0?j=o(()=>s.start(A),"startAlgorithm"):j=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"),If(a,A,j,L,Q,d,v)}o($P,"SetUpReadableStreamDefaultControllerFromUnderlyingSource");function ka(a){return new TypeError(`ReadableStreamDefaultController.prototype.${a} can only be used on a ReadableStreamDefaultController`)}o(ka,"defaultControllerBrandCheckException$1");function zP(a,s){return kn(a._readableStreamController)?DP(a):NP(a)}o(zP,"ReadableStreamTee");function NP(a,s){let d=U(a),v=!1,A=!1,j=!1,L=!1,Q,ue,oe,he,ve,Le=p(wt=>{ve=wt});function pr(){return v?(A=!0,f(void 0)):(v=!0,ee(d,{_chunkSteps:o(Ct=>{T(()=>{A=!1;let er=Ct,Wr=Ct;j||so(oe._readableStreamController,er),L||so(he._readableStreamController,Wr),v=!1,A&&pr()})},"_chunkSteps"),_closeSteps:o(()=>{v=!1,j||Dn(oe._readableStreamController),L||Dn(he._readableStreamController),(!j||!L)&&ve(void 0)},"_closeSteps"),_errorSteps:o(()=>{v=!1},"_errorSteps")}),f(void 0))}o(pr,"pullAlgorithm");function lo(wt){if(j=!0,Q=wt,L){let Ct=je([Q,ue]),er=dr(a,Ct);ve(er)}return Le}o(lo,"cancel1Algorithm");function fn(wt){if(L=!0,ue=wt,j){let Ct=je([Q,ue]),er=dr(a,Ct);ve(er)}return Le}o(fn,"cancel2Algorithm");function Hr(){}return o(Hr,"startAlgorithm"),oe=di(Hr,pr,lo),he=di(Hr,pr,fn),_(d._closedPromise,wt=>(lr(oe._readableStreamController,wt),lr(he._readableStreamController,wt),(!j||!L)&&ve(void 0),null)),[oe,he]}o(NP,"ReadableStreamDefaultTee");function DP(a){let s=U(a),d=!1,v=!1,A=!1,j=!1,L=!1,Q,ue,oe,he,ve,Le=p(ie=>{ve=ie});function pr(ie){_(ie._closedPromise,Te=>(ie!==s||(Xt(oe._readableStreamController,Te),Xt(he._readableStreamController,Te),(!j||!L)&&ve(void 0)),null))}o(pr,"forwardReaderError");function lo(){$n(s)&&(Oe(s),s=U(a),pr(s)),ee(s,{_chunkSteps:o(Te=>{T(()=>{v=!1,A=!1;let Fe=Te,Mt=Te;if(!j&&!L)try{Mt=Hp(Te)}catch(po){Xt(oe._readableStreamController,po),Xt(he._readableStreamController,po),ve(dr(a,po));return}j||ga(oe._readableStreamController,Fe),L||ga(he._readableStreamController,Mt),d=!1,v?Hr():A&&wt()})},"_chunkSteps"),_closeSteps:o(()=>{d=!1,j||ii(oe._readableStreamController),L||ii(he._readableStreamController),oe._readableStreamController._pendingPullIntos.length>0&&ya(oe._readableStreamController,0),he._readableStreamController._pendingPullIntos.length>0&&ya(he._readableStreamController,0),(!j||!L)&&ve(void 0)},"_closeSteps"),_errorSteps:o(()=>{d=!1},"_errorSteps")})}o(lo,"pullWithDefaultReader");function fn(ie,Te){Y(s)&&(Oe(s),s=of(a),pr(s));let Fe=Te?he:oe,Mt=Te?oe:he;uf(s,ie,1,{_chunkSteps:o(fo=>{T(()=>{v=!1,A=!1;let mo=Te?L:j;if(Te?j:L)mo||_a(Fe._readableStreamController,fo);else{let Vf;try{Vf=Hp(fo)}catch(mc){Xt(Fe._readableStreamController,mc),Xt(Mt._readableStreamController,mc),ve(dr(a,mc));return}mo||_a(Fe._readableStreamController,fo),ga(Mt._readableStreamController,Vf)}d=!1,v?Hr():A&&wt()})},"_chunkSteps"),_closeSteps:o(fo=>{d=!1;let mo=Te?L:j,Ma=Te?j:L;mo||ii(Fe._readableStreamController),Ma||ii(Mt._readableStreamController),fo!==void 0&&(mo||_a(Fe._readableStreamController,fo),!Ma&&Mt._readableStreamController._pendingPullIntos.length>0&&ya(Mt._readableStreamController,0)),(!mo||!Ma)&&ve(void 0)},"_closeSteps"),_errorSteps:o(()=>{d=!1},"_errorSteps")})}o(fn,"pullWithBYOBReader");function Hr(){if(d)return v=!0,f(void 0);d=!0;let ie=Ju(oe._readableStreamController);return ie===null?lo():fn(ie._view,!1),f(void 0)}o(Hr,"pull1Algorithm");function wt(){if(d)return A=!0,f(void 0);d=!0;let ie=Ju(he._readableStreamController);return ie===null?lo():fn(ie._view,!0),f(void 0)}o(wt,"pull2Algorithm");function Ct(ie){if(j=!0,Q=ie,L){let Te=je([Q,ue]),Fe=dr(a,Te);ve(Fe)}return Le}o(Ct,"cancel1Algorithm");function er(ie){if(L=!0,ue=ie,j){let Te=je([Q,ue]),Fe=dr(a,Te);ve(Fe)}return Le}o(er,"cancel2Algorithm");function Wr(){}return o(Wr,"startAlgorithm"),oe=Cf(Wr,Hr,Ct),he=Cf(Wr,wt,er),pr(s),[oe,he]}o(DP,"ReadableByteStreamTee");function jP(a){return r(a)&&typeof a.getReader<"u"}o(jP,"isReadableStreamLike");function UP(a){return jP(a)?LP(a.getReader()):MP(a)}o(UP,"ReadableStreamFrom");function MP(a){let s,d=Vp(a,"async"),v=e;function A(){let L;try{L=CS(d)}catch(ue){return m(ue)}let Q=f(L);return w(Q,ue=>{if(!r(ue))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(kS(ue))Dn(s._readableStreamController);else{let he=OS(ue);so(s._readableStreamController,he)}})}o(A,"pullAlgorithm");function j(L){let Q=d.iterator,ue;try{ue=fa(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 w(he,ve=>{if(!r(ve))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")})}return o(j,"cancelAlgorithm"),s=di(v,A,j,0),s}o(MP,"ReadableStreamFromIterable");function LP(a){let s,d=e;function v(){let j;try{j=a.read()}catch(L){return m(L)}return w(j,L=>{if(!r(L))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(L.done)Dn(s._readableStreamController);else{let Q=L.value;so(s._readableStreamController,Q)}})}o(v,"pullAlgorithm");function A(j){try{return f(a.cancel(j))}catch(L){return m(L)}}return o(A,"cancelAlgorithm"),s=di(d,v,A,0),s}o(LP,"ReadableStreamFromDefaultReader");function FP(a,s){Rt(a,s);let d=a,v=d?.autoAllocateChunkSize,A=d?.cancel,j=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:BP(A,d,`${s} has member 'cancel' that`),pull:j===void 0?void 0:qP(j,d,`${s} has member 'pull' that`),start:L===void 0?void 0:VP(L,d,`${s} has member 'start' that`),type:Q===void 0?void 0:HP(Q,`${s} has member 'type' that`)}}o(FP,"convertUnderlyingDefaultOrByteSource");function BP(a,s,d){return St(a,d),v=>B(a,s,[v])}o(BP,"convertUnderlyingSourceCancelCallback");function qP(a,s,d){return St(a,d),v=>B(a,s,[v])}o(qP,"convertUnderlyingSourcePullCallback");function VP(a,s,d){return St(a,d),v=>k(a,s,[v])}o(VP,"convertUnderlyingSourceStartCallback");function HP(a,s){if(a=`${a}`,a!=="bytes")throw new TypeError(`${s} '${a}' is not a valid enumeration value for ReadableStreamType`);return a}o(HP,"convertReadableStreamType");function WP(a,s){return Rt(a,s),{preventCancel:!!a?.preventCancel}}o(WP,"convertIteratorOptions");function Rf(a,s){Rt(a,s);let d=a?.preventAbort,v=a?.preventCancel,A=a?.preventClose,j=a?.signal;return j!==void 0&&GP(j,`${s} has member 'signal' that`),{preventAbort:!!d,preventCancel:!!v,preventClose:!!A,signal:j}}o(Rf,"convertPipeOptions");function GP(a,s){if(!tP(a))throw new TypeError(`${s} is not an AbortSignal.`)}o(GP,"assertAbortSignal");function ZP(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"),lf(v,`${s} has member 'writable' that`),{readable:d,writable:v}}o(ZP,"convertReadableWritablePair");class bt{static{o(this,"ReadableStream")}constructor(s={},d={}){s===void 0?s=null:Pt(s,"First parameter");let v=Ea(d,"Second parameter"),A=FP(s,"First parameter");if(lc(this),A.type==="bytes"){if(v.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let j=si(v,0);BS(this,A,j)}else{let j=va(v),L=si(v,1);$P(this,A,L,j)}}get locked(){if(!ln(this))throw jn("locked");return dn(this)}cancel(s=void 0){return ln(this)?dn(this)?m(new TypeError("Cannot cancel a stream that already has a reader")):dr(this,s):m(jn("cancel"))}getReader(s=void 0){if(!ln(this))throw jn("getReader");return VS(s,"First parameter").mode===void 0?U(this):of(this)}pipeThrough(s,d={}){if(!ln(this))throw jn("pipeThrough");it(s,1,"pipeThrough");let v=ZP(s,"First parameter"),A=Rf(d,"Second parameter");if(dn(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(io(v.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let j=xf(this,v.writable,A.preventClose,A.preventAbort,A.preventCancel,A.signal);return E(j),v.readable}pipeTo(s,d={}){if(!ln(this))return m(jn("pipeTo"));if(s===void 0)return m("Parameter 1 is required in 'pipeTo'.");if(!oo(s))return m(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let v;try{v=Rf(d,"Second parameter")}catch(A){return m(A)}return dn(this)?m(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):io(s)?m(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):xf(this,s,v.preventClose,v.preventAbort,v.preventCancel,v.signal)}tee(){if(!ln(this))throw jn("tee");let s=zP(this);return je(s)}values(s=void 0){if(!ln(this))throw jn("values");let d=WP(s,"First parameter");return eo(this,d.preventCancel)}[Bu](s){return this.values(s)}static from(s){return UP(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,Bu,{value:bt.prototype.values,writable:!0,configurable:!0});function di(a,s,d,v=1,A=()=>1){let j=Object.create(bt.prototype);lc(j);let L=Object.create(Vr.prototype);return If(j,L,a,s,d,v,A),j}o(di,"CreateReadableStream");function Cf(a,s,d){let v=Object.create(bt.prototype);lc(v);let A=Object.create(Br.prototype);return nf(v,A,a,s,d,0,void 0),v}o(Cf,"CreateReadableByteStream");function lc(a){a._state="readable",a._reader=void 0,a._storedError=void 0,a._disturbed=!1}o(lc,"InitializeReadableStream");function ln(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_readableStreamController")?!1:a instanceof bt}o(ln,"IsReadableStream");function dn(a){return a._reader!==void 0}o(dn,"IsReadableStreamLocked");function dr(a,s){if(a._disturbed=!0,a._state==="closed")return f(void 0);if(a._state==="errored")return m(a._storedError);pi(a);let d=a._reader;if(d!==void 0&&$n(d)){let A=d._readIntoRequests;d._readIntoRequests=new V,A.forEach(j=>{j._closeSteps(void 0)})}let v=a._readableStreamController[te](s);return w(v,e)}o(dr,"ReadableStreamCancel");function pi(a){a._state="closed";let s=a._reader;if(s!==void 0&&(Xn(s),Y(s))){let d=s._readRequests;s._readRequests=new V,d.forEach(v=>{v._closeSteps()})}}o(pi,"ReadableStreamClose");function kf(a,s){a._state="errored",a._storedError=s;let d=a._reader;d!==void 0&&(jt(d,s),Y(d)?We(d,s):cf(d,s))}o(kf,"ReadableStreamError");function jn(a){return new TypeError(`ReadableStream.prototype.${a} can only be used on a ReadableStream`)}o(jn,"streamBrandCheckException$1");function Of(a,s){Rt(a,s);let d=a?.highWaterMark;return y(d,"highWaterMark","QueuingStrategyInit"),{highWaterMark:P(d)}}o(Of,"convertQueuingStrategyInit");let $f=o(a=>a.byteLength,"byteLengthSizeFunction");i($f,"size");class Oa{static{o(this,"ByteLengthQueuingStrategy")}constructor(s){it(s,1,"ByteLengthQueuingStrategy"),s=Of(s,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=s.highWaterMark}get highWaterMark(){if(!Nf(this))throw zf("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Nf(this))throw zf("size");return $f}}Object.defineProperties(Oa.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Oa.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function zf(a){return new TypeError(`ByteLengthQueuingStrategy.prototype.${a} can only be used on a ByteLengthQueuingStrategy`)}o(zf,"byteLengthBrandCheckException");function Nf(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_byteLengthQueuingStrategyHighWaterMark")?!1:a instanceof Oa}o(Nf,"IsByteLengthQueuingStrategy");let Df=o(()=>1,"countSizeFunction");i(Df,"size");class $a{static{o(this,"CountQueuingStrategy")}constructor(s){it(s,1,"CountQueuingStrategy"),s=Of(s,"First parameter"),this._countQueuingStrategyHighWaterMark=s.highWaterMark}get highWaterMark(){if(!Uf(this))throw jf("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Uf(this))throw jf("size");return Df}}Object.defineProperties($a.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty($a.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function jf(a){return new TypeError(`CountQueuingStrategy.prototype.${a} can only be used on a CountQueuingStrategy`)}o(jf,"countBrandCheckException");function Uf(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_countQueuingStrategyHighWaterMark")?!1:a instanceof $a}o(Uf,"IsCountQueuingStrategy");function JP(a,s){Rt(a,s);let d=a?.cancel,v=a?.flush,A=a?.readableType,j=a?.start,L=a?.transform,Q=a?.writableType;return{cancel:d===void 0?void 0:XP(d,a,`${s} has member 'cancel' that`),flush:v===void 0?void 0:KP(v,a,`${s} has member 'flush' that`),readableType:A,start:j===void 0?void 0:QP(j,a,`${s} has member 'start' that`),transform:L===void 0?void 0:YP(L,a,`${s} has member 'transform' that`),writableType:Q}}o(JP,"convertTransformer");function KP(a,s,d){return St(a,d),v=>B(a,s,[v])}o(KP,"convertTransformerFlushCallback");function QP(a,s,d){return St(a,d),v=>k(a,s,[v])}o(QP,"convertTransformerStartCallback");function YP(a,s,d){return St(a,d),(v,A)=>B(a,s,[v,A])}o(YP,"convertTransformerTransformCallback");function XP(a,s,d){return St(a,d),v=>B(a,s,[v])}o(XP,"convertTransformerCancelCallback");class za{static{o(this,"TransformStream")}constructor(s={},d={},v={}){s===void 0&&(s=null);let A=Ea(d,"Second parameter"),j=Ea(v,"Third parameter"),L=JP(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=si(j,0),ue=va(j),oe=si(A,1),he=va(A),ve,Le=p(pr=>{ve=pr});ew(this,Le,oe,he,Q,ue),rw(this,L),L.start!==void 0?ve(L.start(this._transformStreamController)):ve(void 0)}get readable(){if(!Mf(this))throw qf("readable");return this._readable}get writable(){if(!Mf(this))throw qf("writable");return this._writable}}Object.defineProperties(za.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(za.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});function ew(a,s,d,v,A,j){function L(){return s}o(L,"startAlgorithm");function Q(Le){return iw(a,Le)}o(Q,"writeAlgorithm");function ue(Le){return aw(a,Le)}o(ue,"abortAlgorithm");function oe(){return sw(a)}o(oe,"closeAlgorithm"),a._writable=oP(L,Q,oe,ue,d,v);function he(){return uw(a)}o(he,"pullAlgorithm");function ve(Le){return cw(a,Le)}o(ve,"cancelAlgorithm"),a._readable=di(L,he,ve,A,j),a._backpressure=void 0,a._backpressureChangePromise=void 0,a._backpressureChangePromise_resolve=void 0,Na(a,!0),a._transformStreamController=void 0}o(ew,"InitializeTransformStream");function Mf(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_transformStreamController")?!1:a instanceof za}o(Mf,"IsTransformStream");function Lf(a,s){lr(a._readable._readableStreamController,s),dc(a,s)}o(Lf,"TransformStreamError");function dc(a,s){ja(a._transformStreamController),ui(a._writable._writableStreamController,s),pc(a)}o(dc,"TransformStreamErrorWritableAndUnblockWrite");function pc(a){a._backpressure&&Na(a,!1)}o(pc,"TransformStreamUnblockWrite");function Na(a,s){a._backpressureChangePromise!==void 0&&a._backpressureChangePromise_resolve(),a._backpressureChangePromise=p(d=>{a._backpressureChangePromise_resolve=d}),a._backpressure=s}o(Na,"TransformStreamSetBackpressure");class pn{static{o(this,"TransformStreamDefaultController")}constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Da(this))throw Ua("desiredSize");let s=this._controlledTransformStream._readable._readableStreamController;return cc(s)}enqueue(s=void 0){if(!Da(this))throw Ua("enqueue");Ff(this,s)}error(s=void 0){if(!Da(this))throw Ua("error");nw(this,s)}terminate(){if(!Da(this))throw Ua("terminate");ow(this)}}Object.defineProperties(pn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),i(pn.prototype.enqueue,"enqueue"),i(pn.prototype.error,"error"),i(pn.prototype.terminate,"terminate"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(pn.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function Da(a){return!r(a)||!Object.prototype.hasOwnProperty.call(a,"_controlledTransformStream")?!1:a instanceof pn}o(Da,"IsTransformStreamDefaultController");function tw(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(tw,"SetUpTransformStreamDefaultController");function rw(a,s){let d=Object.create(pn.prototype),v,A,j;s.transform!==void 0?v=o(L=>s.transform(L,d),"transformAlgorithm"):v=o(L=>{try{return Ff(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?j=o(L=>s.cancel(L),"cancelAlgorithm"):j=o(()=>f(void 0),"cancelAlgorithm"),tw(a,d,v,A,j)}o(rw,"SetUpTransformStreamDefaultControllerFromTransformer");function ja(a){a._transformAlgorithm=void 0,a._flushAlgorithm=void 0,a._cancelAlgorithm=void 0}o(ja,"TransformStreamDefaultControllerClearAlgorithms");function Ff(a,s){let d=a._controlledTransformStream,v=d._readable._readableStreamController;if(!uo(v))throw new TypeError("Readable side is not in a state that permits enqueue");try{so(v,s)}catch(j){throw dc(d,j),d._readable._storedError}OP(v)!==d._backpressure&&Na(d,!0)}o(Ff,"TransformStreamDefaultControllerEnqueue");function nw(a,s){Lf(a._controlledTransformStream,s)}o(nw,"TransformStreamDefaultControllerError");function Bf(a,s){let d=a._transformAlgorithm(s);return w(d,void 0,v=>{throw Lf(a._controlledTransformStream,v),v})}o(Bf,"TransformStreamDefaultControllerPerformTransform");function ow(a){let s=a._controlledTransformStream,d=s._readable._readableStreamController;Dn(d);let v=new TypeError("TransformStream terminated");dc(s,v)}o(ow,"TransformStreamDefaultControllerTerminate");function iw(a,s){let d=a._transformStreamController;if(a._backpressure){let v=a._backpressureChangePromise;return w(v,()=>{let A=a._writable;if(A._state==="erroring")throw A._storedError;return Bf(d,s)})}return Bf(d,s)}o(iw,"TransformStreamDefaultSinkWriteAlgorithm");function aw(a,s){let d=a._transformStreamController;if(d._finishPromise!==void 0)return d._finishPromise;let v=a._readable;d._finishPromise=p((j,L)=>{d._finishPromise_resolve=j,d._finishPromise_reject=L});let A=d._cancelAlgorithm(s);return ja(d),S(A,()=>(v._state==="errored"?co(d,v._storedError):(lr(v._readableStreamController,s),fc(d)),null),j=>(lr(v._readableStreamController,j),co(d,j),null)),d._finishPromise}o(aw,"TransformStreamDefaultSinkAbortAlgorithm");function sw(a){let s=a._transformStreamController;if(s._finishPromise!==void 0)return s._finishPromise;let d=a._readable;s._finishPromise=p((A,j)=>{s._finishPromise_resolve=A,s._finishPromise_reject=j});let v=s._flushAlgorithm();return ja(s),S(v,()=>(d._state==="errored"?co(s,d._storedError):(Dn(d._readableStreamController),fc(s)),null),A=>(lr(d._readableStreamController,A),co(s,A),null)),s._finishPromise}o(sw,"TransformStreamDefaultSinkCloseAlgorithm");function uw(a){return Na(a,!1),a._backpressureChangePromise}o(uw,"TransformStreamDefaultSourcePullAlgorithm");function cw(a,s){let d=a._transformStreamController;if(d._finishPromise!==void 0)return d._finishPromise;let v=a._writable;d._finishPromise=p((j,L)=>{d._finishPromise_resolve=j,d._finishPromise_reject=L});let A=d._cancelAlgorithm(s);return ja(d),S(A,()=>(v._state==="errored"?co(d,v._storedError):(ui(v._writableStreamController,s),pc(a),fc(d)),null),j=>(ui(v._writableStreamController,j),pc(a),co(d,j),null)),d._finishPromise}o(cw,"TransformStreamDefaultSourceCancelAlgorithm");function Ua(a){return new TypeError(`TransformStreamDefaultController.prototype.${a} can only be used on a TransformStreamDefaultController`)}o(Ua,"defaultControllerBrandCheckException");function fc(a){a._finishPromise_resolve!==void 0&&(a._finishPromise_resolve(),a._finishPromise_resolve=void 0,a._finishPromise_reject=void 0)}o(fc,"defaultControllerFinishPromiseResolve");function co(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(co,"defaultControllerFinishPromiseReject");function qf(a){return new TypeError(`TransformStream.prototype.${a} can only be used on a TransformStream`)}o(qf,"streamBrandCheckException"),t.ByteLengthQueuingStrategy=Oa,t.CountQueuingStrategy=$a,t.ReadableByteStreamController=Br,t.ReadableStream=bt,t.ReadableStreamBYOBReader=un,t.ReadableStreamBYOBRequest=Cn,t.ReadableStreamDefaultController=Vr,t.ReadableStreamDefaultReader=F,t.TransformStream=za,t.TransformStreamDefaultController=pn,t.WritableStream=cn,t.WritableStreamDefaultController=ao,t.WritableStreamDefaultWriter=qr})});var X_=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,Y_())}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*$l(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,eb),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+eb)).arrayBuffer();n+=c.byteLength,yield new Uint8Array(c)}}}var mG,eb,tb,NR,gr,Ui=ut(()=>{mG=ht(X_(),1);eb=65536;o($l,"toIterator");tb=class zl{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 zl?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 $l(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 $l(this.#e,!1))e.set(n,r),r+=n.length;return e.buffer}stream(){let e=$l(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 zl([],{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(tb.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});NR=tb,gr=NR});var DR,jR,Pn,Nl=ut(()=>{Ui();DR=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])}},jR=DR,Pn=jR});function ob(t,e=gr){var r=`${rb()}${rb()}`.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+
|
|
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
|
|
16
16
|
\r
|
|
17
17
|
${u.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
|
|
18
18
|
`)}\r
|
|
19
|
-
`):n.push(i+
|
|
19
|
+
`):n.push(i+Ml(c)+`"; filename="${Ml(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
|
|
24
|
-
`)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),"e"),
|
|
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,_,w,E=o(W=>{this[W+"Mark"]=r},"mark"),T=o(W=>{delete this[W+"Mark"]},"clear"),k=o((W,V,H,J)=>{(V===void 0||V!==H)&&this[W](J&&J.subarray(V,H))},"callback"),B=o((W,V)=>{let H=W+"Mark";H in this&&(V?(k(W,this[H],r,e),delete this[H]):(k(W,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(_===Fi)m|=Tn.LAST_BOUNDARY;else if(_!==js)return;p++;break}else if(p-1===c.length-2){if(m&Tn.LAST_BOUNDARY&&_===Fi)f=Be.END,m=0;else if(!(m&Tn.LAST_BOUNDARY)&&_===Ds)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(_===js){T("onHeaderField"),f=Be.HEADERS_ALMOST_DONE;break}if(p++,_===Fi)break;if(_===BR){if(p===1)return;B("onHeaderField",!0),f=Be.HEADER_VALUE_START;break}if(w=HR(_),w<qR||w>VR)return;break;case Be.HEADER_VALUE_START:if(_===FR)break;E("onHeaderValue"),f=Be.HEADER_VALUE;case Be.HEADER_VALUE:_===js&&(B("onHeaderValue",!0),k("onHeaderEnd"),f=Be.HEADER_VALUE_ALMOST_DONE);break;case Be.HEADER_VALUE_ALMOST_DONE:if(_!==Ds)return;f=Be.HEADER_FIELD_START;break;case Be.HEADERS_ALMOST_DONE:if(_!==Ds)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&&B("onPartData",!0),p++):p=0;else if(p===c.length)p++,_===js?m|=Tn.PART_BOUNDARY:_===Fi?m|=Tn.LAST_BOUNDARY:p=0;else if(p-1===c.length)if(m&Tn.PART_BOUNDARY){if(p=0,_===Ds){m&=~Tn.PART_BOUNDARY,k("onPartEnd"),k("onPartBegin"),f=Be.HEADER_FIELD_START;break}}else m&Tn.LAST_BOUNDARY&&_===Fi?(k("onPartEnd"),f=Be.END,m=0):p=0;if(p>0)u[p-1]=_;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 Be.END:break;default:throw new Error(`Unexpected state entered: ${f}`)}B("onHeaderField"),B("onHeaderValue"),B("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(WR,"_fileName");o(GR,"toFormData")});async function Bl(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 Xr?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,en,qt,ZR,zt,kr,zo,JR,Us,Eb,Sb,Ms=ut(()=>{ir=ht(require("node:stream"),1),en=require("node:util"),qt=require("node:buffer");Ui();ks();jl();Os();zs();ZR=(0,en.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:Ul(e)?e=qt.Buffer.from(e.toString()):Li(e)||qt.Buffer.isBuffer(e)||(en.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 wn?(e=ob(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):Li(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 Xr?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 Bl(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 wn,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(()=>(vb(),bb));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 Bl(this);return new TextDecoder().decode(e)}buffer(){return Bl(this)}};kr.prototype.buffer=(0,en.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,en.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});o(Bl,"consumeBody");zo=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"),JR=(0,en.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"),Us=o((t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":Ul(t)?"application/x-www-form-urlencoded;charset=UTF-8":Li(t)?t.type||null:qt.Buffer.isBuffer(t)||en.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof wn?`multipart/form-data; boundary=${e[zt].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${JR(t)}`:t instanceof ir.default?null:"text/plain;charset=UTF-8","extractContentType"),Eb=o(t=>{let{body:e}=t[zt];return e===null?0:Li(e)?e.size:qt.Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},"getTotalBytes"),Sb=o(async(t,{body:e})=>{e===null?t.end():await ZR(e,t)},"writeToStream")});function Pb(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 Ls(e),Vl(e,String(r)),!0}catch{return!1}}))}var ql,Bi,Ls,Vl,Nt,Fs=ut(()=>{ql=require("node:util"),Bi=ht(require("node:http"),1),Ls=typeof Bi.default.validateHeaderName=="function"?Bi.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}},Vl=typeof Bi.default.validateHeaderValue=="function"?Bi.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"&&!ql.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"||ql.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])=>(Ls(n),Vl(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)=>(Ls(c),Vl(c,String(l)),URLSearchParams.prototype[i].call(n,String(c).toLowerCase(),String(l)));case"delete":case"has":case"getAll":return c=>(Ls(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(Pb,"fromRawHeaders")});var KR,qi,Hl=ut(()=>{KR=new Set([301,302,303,307,308]),qi=o(t=>KR.has(t),"isRedirect")});var yr,Vt,wb=ut(()=>{Fs();Ms();Hl();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=Us(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(!qi(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 Tb,xb=ut(()=>{Tb=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 Ab(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 kb(t){if(!Rb.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function QR(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,Ib.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 No(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:QR(t)}function Ob(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=Ab(i),c=Ab(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 No(u)&&!No(l)?"no-referrer":c.toString();case"strict-origin-when-cross-origin":return u.origin===l.origin?u:No(u)&&!No(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 No(u)&&!No(l)?"no-referrer":u;default:throw new TypeError(`Invalid referrerPolicy: ${n}`)}}function $b(t){let e=(t.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let n of e)n&&Rb.has(n)&&(r=n);return r}var Ib,Rb,Cb,Wl=ut(()=>{Ib=require("node:net");o(Ab,"stripURLForUseAsAReferrer");Rb=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),Cb="strict-origin-when-cross-origin";o(kb,"validateReferrerPolicy");o(QR,"isOriginPotentiallyTrustworthy");o(No,"isUrlPotentiallyTrustworthy");o(Ob,"determineRequestsReferrer");o($b,"parseReferrerPolicyFromHeader")});var zb,Nb,pt,Vi,YR,xn,Db,jb=ut(()=>{zb=require("node:url"),Nb=require("node:util");Fs();Ms();zs();xb();Wl();pt=Symbol("Request internals"),Vi=o(t=>typeof t=="object"&&typeof t[pt]=="object","isRequest"),YR=(0,Nb.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),xn=class t extends kr{static{o(this,"Request")}constructor(e,r={}){let n;if(Vi(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()),!Vi(r)&&"data"in r&&YR(),(r.body!=null||Vi(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:Vi(e)&&e.body!==null?zo(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=Us(u,this);f&&c.set("Content-Type",f)}let l=Vi(e)?e.signal:null;if("signal"in r&&(l=r.signal),l!=null&&!ib(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[pt]={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[pt].method}get url(){return(0,zb.format)(this[pt].parsedURL)}get headers(){return this[pt].headers}get redirect(){return this[pt].redirect}get signal(){return this[pt].signal}get referrer(){if(this[pt].referrer==="no-referrer")return"";if(this[pt].referrer==="client")return"about:client";if(this[pt].referrer)return this[pt].referrer.toString()}get referrerPolicy(){return this[pt].referrerPolicy}set referrerPolicy(e){this[pt].referrerPolicy=kb(e)}clone(){return new t(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(xn.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}});Db=o(t=>{let{parsedURL:e}=t[pt],r=new Nt(t[pt].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=Eb(t);typeof l=="number"&&!Number.isNaN(l)&&(n=String(l))}n&&r.set("Content-Length",n),t.referrerPolicy===""&&(t.referrerPolicy=Cb),t.referrer&&t.referrer!=="no-referrer"?t[pt].referrer=Ob(t):t[pt].referrer="no-referrer",t[pt].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=Tb(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 Hi,Ub=ut(()=>{Os();Hi=class extends Xr{static{o(this,"AbortError")}constructor(e,r="aborted"){super(e,r)}}});var Fb={};La(Fb,{AbortError:()=>Hi,Blob:()=>gr,FetchError:()=>At,File:()=>Pn,FormData:()=>wn,Headers:()=>Nt,Request:()=>xn,Response:()=>Vt,blobFrom:()=>fb,blobFromSync:()=>pb,default:()=>Gl,fileFrom:()=>mb,fileFromSync:()=>hb,isRedirect:()=>qi});async function Gl(t,e){return new Promise((r,n)=>{let i=new xn(t,e),{parsedURL:u,options:c}=Db(i);if(!XR.has(u.protocol))throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${u.protocol.replace(/:$/,"")}" is not supported.`);if(u.protocol==="data:"){let _=J_(i.url),w=new Vt(_,{headers:{"Content-Type":_.typeFull}});r(w);return}let l=(u.protocol==="https:"?Lb.default:Mb.default).request,{signal:p}=i,f=null,m=o(()=>{let _=new Hi("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 w;_.prependListener("end",()=>{w=_._eventsCount}),_.prependListener("close",E=>{if(f&&w<_._eventsCount&&!E){let T=new Error("Premature close");T.code="ERR_STREAM_PREMATURE_CLOSE",f.body.emit("error",T)}})}),S.on("response",_=>{S.setTimeout(0);let w=Pb(_.rawHeaders);if(qi(_.statusCode)){let W=w.get("Location"),V=null;try{V=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(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 Nt(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(!ab(i.url,V)||!sb(i.url,V))for(let te of["authorization","www-authenticate","cookie","cookie2"])H.headers.delete(te);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=$b(w);J&&(H.referrerPolicy=J),r(Gl(new xn(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,W=>{W&&n(W)});process.version<"v12.10"&&_.on("aborted",g);let T={url:i.url,status:_.statusCode,statusText:_.statusMessage,headers:w,size:i.size,counter:i.counter,highWaterMark:i.highWaterMark},k=w.get("Content-Encoding");if(!i.compress||i.method==="HEAD"||k===null||_.statusCode===204||_.statusCode===304){f=new Vt(E,T),r(f);return}let B={flush:Wn.default.Z_SYNC_FLUSH,finishFlush:Wn.default.Z_SYNC_FLUSH};if(k==="gzip"||k==="x-gzip"){E=(0,Ht.pipeline)(E,Wn.default.createGunzip(B),W=>{W&&n(W)}),f=new Vt(E,T),r(f);return}if(k==="deflate"||k==="x-deflate"){let W=(0,Ht.pipeline)(_,new Ht.PassThrough,V=>{V&&n(V)});W.once("data",V=>{(V[0]&15)===8?E=(0,Ht.pipeline)(E,Wn.default.createInflate(),H=>{H&&n(H)}):E=(0,Ht.pipeline)(E,Wn.default.createInflateRaw(),H=>{H&&n(H)}),f=new Vt(E,T),r(f)}),W.once("end",()=>{f||(f=new Vt(E,T),r(f))});return}if(k==="br"){E=(0,Ht.pipeline)(E,Wn.default.createBrotliDecompress(),W=>{W&&n(W)}),f=new Vt(E,T),r(f);return}f=new Vt(E,T),r(f)}),Sb(S,i).catch(n)})}function eC(t,e){let r=Wi.Buffer.from(`0\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
|
|
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=
|
|
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
|
|
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(()=>ht(Z_()))).HttpsProxyAgent,this.#i}static async#u(){let e=typeof window<"u"&&!!window;return this.#a||=e?window.fetch:(await Promise.resolve().then(()=>(Bb(),Fb))).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=Bs;Do=Bs});var yt=M(It=>{"use strict";var sC=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]}),uC=It&&It.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sC(e,t,r)};Object.defineProperty(It,"__esModule",{value:!0});It.instance=It.Gaxios=It.GaxiosError=void 0;It.request=lC;var Wb=Hb();Object.defineProperty(It,"Gaxios",{enumerable:!0,get:o(function(){return Wb.Gaxios},"get")});var cC=Pl();Object.defineProperty(It,"GaxiosError",{enumerable:!0,get:o(function(){return cC.GaxiosError},"get")});uC(xl(),It);It.instance=new Wb.Gaxios;async function lC(t){return It.instance.request(t)}o(lC,"request")});var Zl=M((Gb,qs)=>{(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,te,Z=G.prototype={constructor:G,toString:null,valueOf:null},Ne=new G(1),Se=20,be=4,Oe=-7,Ie=21,Ve=-1e7,He=1e7,Ze=!1,jt=1,Et=0,Xn={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},Tr="0123456789abcdefghijklmnopqrstuvwxyz",ni=!0;function G(y,P){var x,N,R,$,U,I,C,D,z=this;if(!(z instanceof G))return new G(y,P);if(P==null){if(y&&y._isBigNumber===!0){z.s=y.s,!y.c||y.e>He?z.c=z.e=null:y.e<Ve?z.c=[z.e=0]:(z.e=y.e,z.c=y.c.slice());return}if((I=typeof y=="number")&&y*0==0){if(z.s=1/y<0?(y=-y,-1):1,y===~~y){for($=0,U=y;U>=10;U/=10,$++);$>He?z.c=z.e=null:(z.e=$,z.c=[y]);return}D=String(y)}else{if(!r.test(D=String(y)))return te(z,D,I);z.s=D.charCodeAt(0)==45?(D=D.slice(1),-1):1}($=D.indexOf("."))>-1&&(D=D.replace(".","")),(U=D.search(/e/i))>0?($<0&&($=U),$+=+D.slice(U+1),D=D.substring(0,U)):$<0&&($=D.length)}else{if(T(P,2,Tr.length,"Base"),P==10&&ni)return z=new G(y),Pt(z,Se+z.e+1,be);if(D=String(y),I=typeof y=="number"){if(y*0!=0)return te(z,D,I,P);if(z.s=1/y<0?(D=D.slice(1),-1):1,G.DEBUG&&D.replace(/^0\.0*|\./,"").length>15)throw Error(c+y)}else z.s=D.charCodeAt(0)===45?(D=D.slice(1),-1):1;for(x=Tr.slice(0,P),$=U=0,C=D.length;U<C;U++)if(x.indexOf(N=D.charAt(U))<0){if(N=="."){if(U>$){$=C;continue}}else if(!R&&(D==D.toUpperCase()&&(D=D.toLowerCase())||D==D.toLowerCase()&&(D=D.toUpperCase()))){R=!0,U=-1,$=0;continue}return te(z,String(y),I,P)}I=!1,D=J(D,P,10,z.s),($=D.indexOf("."))>-1?D=D.replace(".",""):$=D.length}for(U=0;D.charCodeAt(U)===48;U++);for(C=D.length;D.charCodeAt(--C)===48;);if(D=D.slice(U,++C)){if(C-=U,I&&G.DEBUG&&C>15&&(y>f||y!==i(y)))throw Error(c+z.s*y);if(($=$-U-1)>He)z.c=z.e=null;else if($<Ve)z.c=[z.e=0];else{if(z.e=$,z.c=[],U=($+1)%p,$<0&&(U+=p),U<C){for(U&&z.c.push(+D.slice(0,U)),C-=p;U<C;)z.c.push(+D.slice(U,U+=p));U=p-(D=D.slice(U)).length}else U-=C;for(;U--;D+="0");z.c.push(+D)}}else z.c=[z.e=0]}o(G,"BigNumber"),G.clone=h,G.ROUND_UP=0,G.ROUND_DOWN=1,G.ROUND_CEIL=2,G.ROUND_FLOOR=3,G.ROUND_HALF_UP=4,G.ROUND_HALF_DOWN=5,G.ROUND_HALF_EVEN=6,G.ROUND_HALF_CEIL=7,G.ROUND_HALF_FLOOR=8,G.EUCLID=9,G.config=G.set=function(y){var P,x;if(y!=null)if(typeof y=="object"){if(y.hasOwnProperty(P="DECIMAL_PLACES")&&(x=y[P],T(x,0,S,P),Se=x),y.hasOwnProperty(P="ROUNDING_MODE")&&(x=y[P],T(x,0,8,P),be=x),y.hasOwnProperty(P="EXPONENTIAL_AT")&&(x=y[P],x&&x.pop?(T(x[0],-S,0,P),T(x[1],0,S,P),Oe=x[0],Ie=x[1]):(T(x,-S,S,P),Oe=-(Ie=x<0?-x:x))),y.hasOwnProperty(P="RANGE"))if(x=y[P],x&&x.pop)T(x[0],-S,-1,P),T(x[1],1,S,P),Ve=x[0],He=x[1];else if(T(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))Ze=x;else throw Ze=!x,Error(u+"crypto unavailable");else Ze=x;else throw Error(u+P+" not true or false: "+x);if(y.hasOwnProperty(P="MODULO_MODE")&&(x=y[P],T(x,0,9,P),jt=x),y.hasOwnProperty(P="POW_PRECISION")&&(x=y[P],T(x,0,S,P),Et=x),y.hasOwnProperty(P="FORMAT"))if(x=y[P],typeof x=="object")Xn=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))ni=x.slice(0,10)=="0123456789",Tr=x;else throw Error(u+P+" invalid: "+x)}else throw Error(u+"Object expected: "+y);return{DECIMAL_PLACES:Se,ROUNDING_MODE:be,EXPONENTIAL_AT:[Oe,Ie],RANGE:[Ve,He],CRYPTO:Ze,MODULO_MODE:jt,POW_PRECISION:Et,FORMAT:Xn,ALPHABET:Tr}},G.isBigNumber=function(y){if(!y||y._isBigNumber!==!0)return!1;if(!G.DEBUG)return!0;var P,x,N=y.c,R=y.e,$=y.s;e:if({}.toString.call(N)=="[object Array]"){if(($===1||$===-1)&&R>=-S&&R<=S&&R===i(R)){if(N[0]===0){if(R===0&&N.length===1)return!0;break e}if(P=(R+1)%p,P<1&&(P+=p),String(N[0]).length==P){for(P=0;P<N.length;P++)if(x=N[P],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: "+y)},G.maximum=G.max=function(){return St(arguments,-1)},G.minimum=G.min=function(){return St(arguments,1)},G.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 N,R,$,U,I,C=0,D=[],z=new G(Ne);if(x==null?x=Se:T(x,0,S),U=n(x/p),Ze)if(crypto.getRandomValues){for(N=crypto.getRandomValues(new Uint32Array(U*=2));C<U;)I=N[C]*131072+(N[C+1]>>>11),I>=9e15?(R=crypto.getRandomValues(new Uint32Array(2)),N[C]=R[0],N[C+1]=R[1]):(D.push(I%1e14),C+=2);C=U/2}else if(crypto.randomBytes){for(N=crypto.randomBytes(U*=7);C<U;)I=(N[C]&31)*281474976710656+N[C+1]*1099511627776+N[C+2]*4294967296+N[C+3]*16777216+(N[C+4]<<16)+(N[C+5]<<8)+N[C+6],I>=9e15?crypto.randomBytes(7).copy(N,C):(D.push(I%1e14),C+=7);C=U/7}else throw Ze=!1,Error(u+"crypto unavailable");if(!Ze)for(;C<U;)I=P(),I<9e15&&(D[C++]=I%1e14);for(U=D[--C],x%=p,U&&x&&(I=m[p-x],D[C]=i(U/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 z.e=$,z.c=D,z}}(),G.sum=function(){for(var y=1,P=arguments,x=new G(P[0]);y<P.length;)x=x.plus(P[y++]);return x},J=function(){var y="0123456789";function P(x,N,R,$){for(var U,I=[0],C,D=0,z=x.length;D<z;){for(C=I.length;C--;I[C]*=N);for(I[0]+=$.indexOf(x.charAt(D++)),U=0;U<I.length;U++)I[U]>R-1&&(I[U+1]==null&&(I[U+1]=0),I[U+1]+=I[U]/R|0,I[U]%=R)}return I.reverse()}return o(P,"toBaseOut"),function(x,N,R,$,U){var I,C,D,z,F,Y,ee,Re,We=x.indexOf("."),Ge=Se,Ae=be;for(We>=0&&(z=Et,Et=0,x=x.replace(".",""),Re=new G(N),Y=Re.pow(x.length-We),Et=z,Re.c=P(W(w(Y.c),Y.e,"0"),10,R,y),Re.e=Re.c.length),ee=P(x,N,R,U?(I=Tr,y):(I=y,Tr)),D=z=ee.length;ee[--z]==0;ee.pop());if(!ee[0])return I.charAt(0);if(We<0?--D:(Y.c=ee,Y.e=D,Y.s=$,Y=H(Y,Re,Ge,Ae,R),ee=Y.c,F=Y.r,D=Y.e),C=D+Ge+1,We=ee[C],z=R/2,F=F||C<0||ee[C+1]!=null,F=Ae<4?(We!=null||F)&&(Ae==0||Ae==(Y.s<0?3:2)):We>z||We==z&&(Ae==4||F||Ae==6&&ee[C-1]&1||Ae==(Y.s<0?8:7)),C<1||!ee[0])x=F?W(I.charAt(1),-Ge,I.charAt(0)):I.charAt(0);else{if(ee.length=C,F)for(--R;++ee[--C]>R;)ee[C]=0,C||(++D,ee=[1].concat(ee));for(z=ee.length;!ee[--z];);for(We=0,x="";We<=z;x+=I.charAt(ee[We++]));x=W(x,D,I.charAt(0))}return x}}(),H=function(){function y(N,R,$){var U,I,C,D,z=0,F=N.length,Y=R%g,ee=R/g|0;for(N=N.slice();F--;)C=N[F]%g,D=N[F]/g|0,U=ee*C+D*Y,I=Y*C+U%g*g+z,z=(I/$|0)+(U/g|0)+ee*D,N[F]=I%$;return z&&(N=[z].concat(N)),N}o(y,"multiply");function P(N,R,$,U){var I,C;if($!=U)C=$>U?1:-1;else for(I=C=0;I<$;I++)if(N[I]!=R[I]){C=N[I]>R[I]?1:-1;break}return C}o(P,"compare");function x(N,R,$,U){for(var I=0;$--;)N[$]-=I,I=N[$]<R[$]?1:0,N[$]=I*U+N[$]-R[$];for(;!N[0]&&N.length>1;N.splice(0,1));}return o(x,"subtract"),function(N,R,$,U,I){var C,D,z,F,Y,ee,Re,We,Ge,Ae,De,at,eo,to,ro,Ut,Lr,_t=N.s==R.s?1:-1,st=N.c,je=R.c;if(!st||!st[0]||!je||!je[0])return new G(!N.s||!R.s||(st?je&&st[0]==je[0]:!je)?NaN:st&&st[0]==0||!je?_t*0:_t/0);for(We=new G(_t),Ge=We.c=[],D=N.e-R.e,_t=$+D+1,I||(I=l,D=_(N.e/p)-_(R.e/p),_t=_t/p|0),z=0;je[z]==(st[z]||0);z++);if(je[z]>(st[z]||0)&&D--,_t<0)Ge.push(1),F=!0;else{for(to=st.length,Ut=je.length,z=0,_t+=2,Y=i(I/(je[0]+1)),Y>1&&(je=y(je,Y,I),st=y(st,Y,I),Ut=je.length,to=st.length),eo=Ut,Ae=st.slice(0,Ut),De=Ae.length;De<Ut;Ae[De++]=0);Lr=je.slice(),Lr=[0].concat(Lr),ro=je[0],je[1]>=I/2&&ro++;do{if(Y=0,C=P(je,Ae,Ut,De),C<0){if(at=Ae[0],Ut!=De&&(at=at*I+(Ae[1]||0)),Y=i(at/ro),Y>1)for(Y>=I&&(Y=I-1),ee=y(je,Y,I),Re=ee.length,De=Ae.length;P(ee,Ae,Re,De)==1;)Y--,x(ee,Ut<Re?Lr:je,Re,I),Re=ee.length,C=1;else Y==0&&(C=Y=1),ee=je.slice(),Re=ee.length;if(Re<De&&(ee=[0].concat(ee)),x(Ae,ee,De,I),De=Ae.length,C==-1)for(;P(je,Ae,Ut,De)<1;)Y++,x(Ae,Ut<De?Lr:je,De,I),De=Ae.length}else C===0&&(Y++,Ae=[0]);Ge[z++]=Y,Ae[0]?Ae[De++]=st[eo]||0:(Ae=[st[eo]],De=1)}while((eo++<to||Ae[0]!=null)&&_t--);F=Ae[0]!=null,Ge[0]||Ge.splice(0,1)}if(I==l){for(z=1,_t=Ge[0];_t>=10;_t/=10,z++);Pt(We,$+(We.e=z+D*p-1)+1,U,F)}else We.e=D,We.r=+F;return We}}();function Rt(y,P,x,N){var R,$,U,I,C;if(x==null?x=be:T(x,0,8),!y.c)return y.toString();if(R=y.c[0],U=y.e,P==null)C=w(y.c),C=N==1||N==2&&(U<=Oe||U>=Ie)?B(C,U):W(C,U,"0");else if(y=Pt(new G(y),P,x),$=y.e,C=w(y.c),I=C.length,N==1||N==2&&(P<=$||$<=Oe)){for(;I<P;C+="0",I++);C=B(C,$)}else if(P-=U+(N===2&&$>U),C=W(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,N,R=1,$=new G(y[0]);R<y.length;R++)N=new G(y[R]),(!N.s||(x=E($,N))===P||x===0&&$.s===P)&&($=N);return $}o(St,"maxOrMin");function oi(y,P,x){for(var N=1,R=P.length;!P[--R];P.pop());for(R=P[0];R>=10;R/=10,N++);return(x=N+x*p-1)>He?y.c=y.e=null:x<Ve?y.c=[y.e=0]:(y.e=x,y.c=P),y}o(oi,"normalise"),te=function(){var y=/^(-?)0([xbo])(?=\w[\w.]*$)/i,P=/^([^.]+)\.$/,x=/^\.([^.]+)$/,N=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function($,U,I,C){var D,z=I?U:U.replace(R,"");if(N.test(z))$.s=isNaN(z)?null:z<0?-1:1;else{if(!I&&(z=z.replace(y,function(F,Y,ee){return D=(ee=ee.toLowerCase())=="x"?16:ee=="b"?2:8,!C||C==D?Y:F}),C&&(D=C,z=z.replace(P,"$1").replace(x,"0.$1")),U!=z))return new G(z,D);if(G.DEBUG)throw Error(u+"Not a"+(C?" base "+C:"")+" number: "+U);$.s=null}$.c=$.e=null}}();function Pt(y,P,x,N){var R,$,U,I,C,D,z,F=y.c,Y=m;if(F){e:{for(R=1,I=F[0];I>=10;I/=10,R++);if($=P-R,$<0)$+=p,U=P,C=F[D=0],z=i(C/Y[R-U-1]%10);else if(D=n(($+1)/p),D>=F.length)if(N){for(;F.length<=D;F.push(0));C=z=0,R=1,$%=p,U=$-p+1}else break e;else{for(C=I=F[D],R=1;I>=10;I/=10,R++);$%=p,U=$-p+R,z=U<0?0:i(C/Y[R-U-1]%10)}if(N=N||P<0||F[D+1]!=null||(U<0?C:C%Y[R-U-1]),N=x<4?(z||N)&&(x==0||x==(y.s<0?3:2)):z>5||z==5&&(x==4||N||x==6&&($>0?U>0?C/Y[R-U]:0:F[D-1])%10&1||x==(y.s<0?8:7)),P<1||!F[0])return F.length=0,N?(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]=U>0?i(C/Y[R-U]%Y[U])*I:0),N)for(;;)if(D==0){for($=1,U=F[0];U>=10;U/=10,$++);for(U=F[0]+=I,I=1;U>=10;U/=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=w(y.c),P=x<=Oe||x>=Ie?B(P,x):W(P,x,"0"),y.s<0?"-"+P:P)}return o(it,"valueOf"),Z.absoluteValue=Z.abs=function(){var y=new G(this);return y.s<0&&(y.s=1),y},Z.comparedTo=function(y,P){return E(this,new G(y,P))},Z.decimalPlaces=Z.dp=function(y,P){var x,N,R,$=this;if(y!=null)return T(y,0,S),P==null?P=be:T(P,0,8),Pt(new G($),y+$.e+1,P);if(!(x=$.c))return null;if(N=((R=x.length-1)-_(this.e/p))*p,R=x[R])for(;R%10==0;R/=10,N--);return N<0&&(N=0),N},Z.dividedBy=Z.div=function(y,P){return H(this,new G(y,P),Se,be)},Z.dividedToIntegerBy=Z.idiv=function(y,P){return H(this,new G(y,P),0,1)},Z.exponentiatedBy=Z.pow=function(y,P){var x,N,R,$,U,I,C,D,z,F=this;if(y=new G(y),y.c&&!y.isInteger())throw Error(u+"Exponent not an integer: "+it(y));if(P!=null&&(P=new G(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 z=new G(Math.pow(+it(F),I?y.s*(2-k(y)):+it(y))),P?z.mod(P):z;if(C=y.s<0,P){if(P.c?!P.c[0]:!P.s)return new G(NaN);N=!C&&F.isInteger()&&P.isInteger(),N&&(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 G(C?1/$:$);Et&&($=n(Et/p+2))}for(I?(x=new G(.5),C&&(y.s=1),D=k(y)):(R=Math.abs(+it(y)),D=R%2),z=new G(Ne);;){if(D){if(z=z.times(F),!z.c)break;$?z.c.length>$&&(z.c.length=$):N&&(z=z.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=$):N&&(F=F.mod(P))}return N?z:(C&&(z=Ne.div(z)),P?z.mod(P):$?Pt(z,Et,be,U):z)},Z.integerValue=function(y){var P=new G(this);return y==null?y=be:T(y,0,8),Pt(P,P.e+1,y)},Z.isEqualTo=Z.eq=function(y,P){return E(this,new G(y,P))===0},Z.isFinite=function(){return!!this.c},Z.isGreaterThan=Z.gt=function(y,P){return E(this,new G(y,P))>0},Z.isGreaterThanOrEqualTo=Z.gte=function(y,P){return(P=E(this,new G(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 G(y,P))<0},Z.isLessThanOrEqualTo=Z.lte=function(y,P){return(P=E(this,new G(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,N,R,$,U=this,I=U.s;if(y=new G(y,P),P=y.s,!I||!P)return new G(NaN);if(I!=P)return y.s=-P,U.plus(y);var C=U.e/p,D=y.e/p,z=U.c,F=y.c;if(!C||!D){if(!z||!F)return z?(y.s=-P,y):new G(F?U:NaN);if(!z[0]||!F[0])return F[0]?(y.s=-P,y):new G(z[0]?U:be==3?-0:0)}if(C=_(C),D=_(D),z=z.slice(),I=C-D){for(($=I<0)?(I=-I,R=z):(D=C,R=F),R.reverse(),P=I;P--;R.push(0));R.reverse()}else for(N=($=(I=z.length)<(P=F.length))?I:P,I=P=0;P<N;P++)if(z[P]!=F[P]){$=z[P]<F[P];break}if($&&(R=z,z=F,F=R,y.s=-y.s),P=(N=F.length)-(x=z.length),P>0)for(;P--;z[x++]=0);for(P=l-1;N>I;){if(z[--N]<F[N]){for(x=N;x&&!z[--x];z[x]=P);--z[x],z[N]+=l}z[N]-=F[N]}for(;z[0]==0;z.splice(0,1),--D);return z[0]?oi(y,z,D):(y.s=be==3?-1:1,y.c=[y.e=0],y)},Z.modulo=Z.mod=function(y,P){var x,N,R=this;return y=new G(y,P),!R.c||!y.s||y.c&&!y.c[0]?new G(NaN):!y.c||R.c&&!R.c[0]?new G(R):(jt==9?(N=y.s,y.s=1,x=H(R,y,0,3),y.s=N,x.s*=N):x=H(R,y,0,jt),y=R.minus(x.times(y)),!y.c[0]&&jt==1&&(y.s=R.s),y)},Z.multipliedBy=Z.times=function(y,P){var x,N,R,$,U,I,C,D,z,F,Y,ee,Re,We,Ge,Ae=this,De=Ae.c,at=(y=new G(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(N=_(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(We=l,Ge=g,R=F;--R>=0;){for(x=0,Y=at[R]%Ge,ee=at[R]/Ge|0,U=C,$=R+U;$>R;)D=De[--U]%Ge,z=De[U]/Ge|0,I=ee*D+z*Y,D=Y*D+I%Ge*Ge+Re[$]+x,x=(D/We|0)+(I/Ge|0)+ee*z,Re[$--]=D%We;Re[$]=x}return x?++N:Re.splice(0,1),oi(y,Re,N)},Z.negated=function(){var y=new G(this);return y.s=-y.s||null,y},Z.plus=function(y,P){var x,N=this,R=N.s;if(y=new G(y,P),P=y.s,!R||!P)return new G(NaN);if(R!=P)return y.s=-P,N.minus(y);var $=N.e/p,U=y.e/p,I=N.c,C=y.c;if(!$||!U){if(!I||!C)return new G(R/0);if(!I[0]||!C[0])return C[0]?y:new G(I[0]?N:R*0)}if($=_($),U=_(U),I=I.slice(),R=$-U){for(R>0?(U=$,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),++U),oi(y,I,U)},Z.precision=Z.sd=function(y,P){var x,N,R,$=this;if(y!=null&&y!==!!y)return T(y,1,S),P==null?P=be:T(P,0,8),Pt(new G($),y,P);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 y&&$.e+1>N&&(N=$.e+1),N},Z.shiftedBy=function(y){return T(y,-f,f),this.times("1e"+y)},Z.squareRoot=Z.sqrt=function(){var y,P,x,N,R,$=this,U=$.c,I=$.s,C=$.e,D=Se+4,z=new G("0.5");if(I!==1||!U||!U[0])return new G(!I||I<0&&(!U||U[0])?NaN:U?$:1/0);if(I=Math.sqrt(+it($)),I==0||I==1/0?(P=w(U),(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 G(P)):x=new G(I+""),x.c[0]){for(C=x.e,I=C+D,I<3&&(I=0);;)if(R=x,x=z.times(R.plus(H($,R,D,1))),w(R.c).slice(0,I)===(P=w(x.c)).slice(0,I))if(x.e<C&&--I,P=P.slice(I-3,I+1),P=="9999"||!N&&P=="4999"){if(!N&&(Pt(R,R.e+Se+2,0),R.times(R).eq($))){x=R;break}D+=4,I+=4,N=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&&(T(y,0,S),y++),Rt(this,y,P,1)},Z.toFixed=function(y,P){return y!=null&&(T(y,0,S),y=y+this.e+1),Rt(this,y,P)},Z.toFormat=function(y,P,x){var N,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=Xn;else if(typeof x!="object")throw Error(u+"Argument not an object: "+x);if(N=R.toFixed(y,P),R.c){var $,U=N.split("."),I=+x.groupSize,C=+x.secondaryGroupSize,D=x.groupSeparator||"",z=U[0],F=U[1],Y=R.s<0,ee=Y?z.slice(1):z,Re=ee.length;if(C&&($=I,I=C,C=$,Re-=$),I>0&&Re>0){for($=Re%I||I,z=ee.substr(0,$);$<Re;$+=I)z+=D+ee.substr($,I);C>0&&(z+=D+ee.slice($)),Y&&(z="-"+z)}N=F?z+(x.decimalSeparator||"")+((C=+x.fractionGroupSize)?F.replace(new RegExp("\\d{"+C+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):F):z}return(x.prefix||"")+N+(x.suffix||"")},Z.toFraction=function(y){var P,x,N,R,$,U,I,C,D,z,F,Y,ee=this,Re=ee.c;if(y!=null&&(I=new G(y),!I.isInteger()&&(I.c||I.s!==1)||I.lt(Ne)))throw Error(u+"Argument "+(I.isInteger()?"out of range: ":"not an integer: ")+it(I));if(!Re)return new G(ee);for(P=new G(Ne),D=x=new G(Ne),N=C=new G(Ne),Y=w(Re),$=P.e=Y.length-ee.e-1,P.c[0]=m[(U=$%p)<0?p+U:U],y=!y||I.comparedTo(P)>0?$>0?P:D:I,U=He,He=1/0,I=new G(Y),C.c[0]=0;z=H(I,P,0,1),R=x.plus(z.times(N)),R.comparedTo(y)!=1;)x=N,N=R,D=C.plus(z.times(R=D)),C=R,P=I.minus(z.times(R=P)),I=R;return R=H(y.minus(x),N,0,1),C=C.plus(R.times(D)),x=x.plus(R.times(N)),C.s=D.s=ee.s,$=$*2,F=H(D,N,$,be).minus(ee).abs().comparedTo(H(C,x,$,be).minus(ee).abs())<1?[D,N]:[C,x],He=U,F},Z.toNumber=function(){return+it(this)},Z.toPrecision=function(y,P){return y!=null&&T(y,1,S),Rt(this,y,P,2)},Z.toString=function(y){var P,x=this,N=x.s,R=x.e;return R===null?N?(P="Infinity",N<0&&(P="-"+P)):P="NaN":(y==null?P=R<=Oe||R>=Ie?B(w(x.c),R):W(w(x.c),R,"0"):y===10&&ni?(x=Pt(new G(x),Se+R+1,be),P=W(w(x.c),x.e,"0")):(T(y,2,Tr.length,"Base"),P=J(W(w(x.c),R,"0"),10,y,N,!0)),N<0&&x.c[0]&&(P="-"+P)),P},Z.valueOf=Z.toJSON=function(){return it(this)},Z._isBigNumber=!0,V!=null&&G.set(V),G}o(h,"clone");function _(V){var H=V|0;return V>0||V===H?H:H-1}o(_,"bitFloor");function w(V){for(var H,J,te=1,Z=V.length,Ne=V[0]+"";te<Z;){for(H=V[te++]+"",J=p-H.length;J--;H="0"+H);Ne+=H}for(Z=Ne.length;Ne.charCodeAt(--Z)===48;);return Ne.slice(0,Z+1||1)}o(w,"coeffToString");function E(V,H){var J,te,Z=V.c,Ne=H.c,Se=V.s,be=H.s,Oe=V.e,Ie=H.e;if(!Se||!be)return null;if(J=Z&&!Z[0],te=Ne&&!Ne[0],J||te)return J?te?0:-be:Se;if(Se!=be)return Se;if(J=Se<0,te=Oe==Ie,!Z||!Ne)return te?0:!Z^J?1:-1;if(!te)return Oe>Ie^J?1:-1;for(be=(Oe=Z.length)<(Ie=Ne.length)?Oe:Ie,Se=0;Se<be;Se++)if(Z[Se]!=Ne[Se])return Z[Se]>Ne[Se]^J?1:-1;return Oe==Ie?0:Oe>Ie^J?1:-1}o(E,"compare");function T(V,H,J,te){if(V<H||V>J||V!==i(V))throw Error(u+(te||"Argument")+(typeof V=="number"?V<H||V>J?" out of range: ":" not an integer: ":" not a primitive number: ")+String(V))}o(T,"intCheck");function k(V){var H=V.c.length-1;return _(V.e/p)==H&&V.c[H]%2!=0}o(k,"isOdd");function B(V,H){return(V.length>1?V.charAt(0)+"."+V.slice(1):V)+(H<0?"e":"e+")+H}o(B,"toExponential");function W(V,H,J){var te,Z;if(H<0){for(Z=J+".";++H;Z+=J);V=Z+V}else if(te=V.length,++H>te){for(Z=J,H-=te;--H;Z+=J);V+=Z}else H<te&&(V=V.slice(0,H)+"."+V.slice(H));return V}o(W,"toFixedPoint"),e=h(),e.default=e.BigNumber=e,typeof define=="function"&&define.amd?define(function(){return e}):typeof qs<"u"&&qs.exports?qs.exports=e:(t||(t=typeof self<"u"&&self?self:window),t.BigNumber=e)})(Gb)});var Qb=M((NZ,Kb)=>{var Zb=Zl(),Jb=Kb.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,_,w=n,E,T=m[f],k=T!=null&&(T instanceof Zb||Zb.isBigNumber(T));switch(T&&typeof T=="object"&&typeof T.toJSON=="function"&&(T=T.toJSON(f)),typeof c=="function"&&(T=c.call(m,f,T)),typeof T){case"string":return k?T:l(T);case"number":return isFinite(T)?String(T):"null";case"boolean":case"null":case"bigint":return String(T);case"object":if(!T)return"null";if(n+=i,E=[],Object.prototype.toString.apply(T)==="[object Array]"){for(_=T.length,g=0;g<_;g+=1)E[g]=p(g,T)||"null";return h=E.length===0?"[]":n?`[
|
|
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?`[
|
|
32
32
|
`+n+E.join(`,
|
|
33
33
|
`+n)+`
|
|
34
|
-
`+
|
|
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?`{
|
|
35
35
|
`+n+E.join(`,
|
|
36
36
|
`+n)+`
|
|
37
|
-
`+
|
|
38
|
-
`,r:"\r",t:" "},u,c=o(function(w){throw{name:"SyntaxError",message:w,at:r,text:u}},"error"),l=o(function(w){return w&&w!==n&&c("Expected '"+w+"' instead of '"+n+"'"),n=u.charAt(r),r+=1,n},"next"),p=o(function(){var w,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(w=+E,!isFinite(w))c("Bad number");else return Vs==null&&(Vs=Zl()),E.length>15?e.storeAsString?E:e.useNativeBigInt?BigInt(E):new Vs(E):e.alwaysParseAsBig?e.useNativeBigInt?BigInt(w):new Vs(w):w},"number"),f=o(function(){var w,E,T="",k;if(n==='"')for(var B=r;l();){if(n==='"')return r-1>B&&(T+=u.substring(B,r-1)),l(),T;if(n==="\\"){if(r-1>B&&(T+=u.substring(B,r-1)),l(),n==="u"){for(k=0,E=0;E<4&&(w=parseInt(l(),16),!!isFinite(w));E+=1)k=k*16+w;T+=String.fromCharCode(k)}else if(typeof i[n]=="string")T+=i[n];else break;B=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 w=[];if(n==="["){if(l("["),m(),n==="]")return l("]"),w;for(;n;){if(w.push(S()),m(),n==="]")return l("]"),w;l(","),m()}}c("Bad array")},"array"),_=o(function(){var w,E=Object.create(null);if(n==="{"){if(l("{"),m(),n==="}")return l("}"),E;for(;n;){if(w=f(),m(),l(":"),e.strict===!0&&Object.hasOwnProperty.call(E,w)&&c('Duplicate key "'+w+'"'),dC.test(w)===!0?e.protoAction==="error"?c("Object contains forbidden prototype property"):e.protoAction==="ignore"?S():E[w]=S():pC.test(w)===!0?e.constructorAction==="error"?c("Object contains forbidden constructor property"):e.constructorAction==="ignore"?S():E[w]=S():E[w]=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(w,E){var T;return u=w+"",r=0,n=" ",T=S(),m(),n&&c("Syntax error"),typeof E=="function"?o(function k(B,W){var V,H,J=B[W];return J&&typeof J=="object"&&Object.keys(J).forEach(function(te){H=k(J,te),H!==void 0?J[te]=H:delete J[te]}),E.call(B,W,J)},"walk")({"":T},""):T}},"json_parse");Yb.exports=fC});var rv=M((MZ,Hs)=>{var ev=Qb().stringify,tv=Xb();Hs.exports=function(t){return{parse:tv(t),stringify:ev}};Hs.exports.parse=tv();Hs.exports.stringify=ev});var Jl=M(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.GCE_LINUX_BIOS_PATHS=void 0;_r.isGoogleCloudServerless=iv;_r.isGoogleComputeEngineLinux=av;_r.isGoogleComputeEngineMACAddress=sv;_r.isGoogleComputeEngine=uv;_r.detectGCPResidency=hC;var nv=require("fs"),ov=require("os");_r.GCE_LINUX_BIOS_PATHS={BIOS_DATE:"/sys/class/dmi/id/bios_date",BIOS_VENDOR:"/sys/class/dmi/id/bios_vendor"};var mC=/^42:01/;function iv(){return!!(process.env.CLOUD_RUN_JOB||process.env.FUNCTION_NAME||process.env.K_SERVICE)}o(iv,"isGoogleCloudServerless");function av(){if((0,ov.platform)()!=="linux")return!1;try{(0,nv.statSync)(_r.GCE_LINUX_BIOS_PATHS.BIOS_DATE);let t=(0,nv.readFileSync)(_r.GCE_LINUX_BIOS_PATHS.BIOS_VENDOR,"utf8");return/Google/.test(t)}catch{return!1}}o(av,"isGoogleComputeEngineLinux");function sv(){let t=(0,ov.networkInterfaces)();for(let e of Object.values(t))if(e){for(let{mac:r}of e)if(mC.test(r))return!0}return!1}o(sv,"isGoogleComputeEngineMACAddress");function uv(){return av()||sv()}o(uv,"isGoogleComputeEngine");function hC(){return iv()||uv()}o(hC,"detectGCPResidency")});var cv=M(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.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="")}};Ws.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 fv=M(Me=>{"use strict";var gC=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]}),yC=Me&&Me.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lv=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"&&gC(r,e,n[i]);return yC(r,e),r}}();Object.defineProperty(Me,"__esModule",{value:!0});Me.env=Me.DebugLogBackendBase=Me.placeholder=Me.AdhocDebugLogger=Me.LogSeverity=void 0;Me.getNodeBackend=Ql;Me.getDebugBackend=bC;Me.getStructuredBackend=vC;Me.setBackend=EC;Me.log=pv;var _C=require("events"),Gi=lv(require("process")),dv=lv(require("util")),Wt=cv(),br;(function(t){t.DEFAULT="DEFAULT",t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR"})(br||(Me.LogSeverity=br={}));var Zi=class extends _C.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=>pv(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=Zi;Me.placeholder=new Zi("",()=>{}).func;var Uo=class{static{o(this,"DebugLogBackendBase")}constructor(){var e;this.cached=new Map,this.filters=[],this.filtersSet=!1;let r=(e=Gi.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=Uo;var Kl=class extends Uo{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=`${Wt.Colours.green}${e}${Wt.Colours.reset}`,c=`${Wt.Colours.yellow}${Gi.pid}${Wt.Colours.reset}`,l;switch(r.severity){case br.ERROR:l=`${Wt.Colours.red}${r.severity}${Wt.Colours.reset}`;break;case br.INFO:l=`${Wt.Colours.magenta}${r.severity}${Wt.Colours.reset}`;break;case br.WARNING:l=`${Wt.Colours.yellow}${r.severity}${Wt.Colours.reset}`;break;default:l=(i=r.severity)!==null&&i!==void 0?i:br.DEFAULT;break}let p=dv.formatWithOptions({colors:Wt.Colours.enabled},...n),f=Object.assign({},r);delete f.severity;let m=Object.getOwnPropertyNames(f).length?JSON.stringify(f):"",g=m?`${Wt.Colours.grey}${m}${Wt.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 Ql(){return new Kl}o(Ql,"getNodeBackend");var Yl=class extends Uo{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=Gi.env.NODE_DEBUG)!==null&&e!==void 0?e:"";Gi.env.NODE_DEBUG=`${r}${r?",":""}${this.filters.join(",")}`}};function bC(t){return new Yl(t)}o(bC,"getDebugBackend");var Xl=class extends Uo{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:dv.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 vC(t){return new Xl(t)}o(vC,"getStructuredBackend");Me.env={nodeEnables:"GOOGLE_SDK_NODE_LOGGING"};var ed=new Map,Gt;function EC(t){Gt=t,ed.clear()}o(EC,"setBackend");function pv(t,e){if(!Gt&&!Gi.env[Me.env.nodeEnables]||!t)return Me.placeholder;e&&(t=`${e.instance.namespace}:${t}`);let r=ed.get(t);if(r)return r.func;if(Gt===null)return Me.placeholder;Gt===void 0&&(Gt=Ql());let n=(()=>{let i;return new Zi(t,(c,...l)=>{if(i!==Gt){if(Gt===null)return;Gt===void 0&&(Gt=Ql()),i=Gt}Gt?.log(t,c,...l)})})();return ed.set(t,n),n.func}o(pv,"log")});var td=M(Zn=>{"use strict";var SC=Zn&&Zn.__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]}),PC=Zn&&Zn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&SC(e,t,r)};Object.defineProperty(Zn,"__esModule",{value:!0});PC(fv(),Zn)});var Ki=M(ae=>{"use strict";var hv=ae&&ae.__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]}),wC=ae&&ae.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TC=ae&&ae.__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"&&hv(r,e,n[i]);return wC(r,e),r}}(),xC=ae&&ae.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hv(e,t,r)};Object.defineProperty(ae,"__esModule",{value:!0});ae.gcpResidencyCache=ae.METADATA_SERVER_DETECTION=ae.HEADERS=ae.HEADER_VALUE=ae.HEADER_NAME=ae.SECONDARY_HOST_ADDRESS=ae.HOST_ADDRESS=ae.BASE_PATH=void 0;ae.instance=OC;ae.project=$C;ae.universe=zC;ae.bulk=NC;ae.isAvailable=jC;ae.resetIsAvailableCache=UC;ae.getGCPResidency=od;ae.setGCPResidency=gv;ae.requestTimeout=yv;var rd=yt(),AC=rv(),IC=Jl(),RC=TC(td());ae.BASE_PATH="/computeMetadata/v1";ae.HOST_ADDRESS="http://169.254.169.254";ae.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.";ae.HEADER_NAME="Metadata-Flavor";ae.HEADER_VALUE="Google";ae.HEADERS=Object.freeze({[ae.HEADER_NAME]:ae.HEADER_VALUE});var mv=RC.log("gcp-metadata");ae.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 nd(t){return t||(t=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||ae.HOST_ADDRESS),/^https?:\/\//.test(t)||(t=`http://${t}`),new URL(ae.BASE_PATH,t).href}o(nd,"getBaseUrl");function CC(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(CC,"validate");async function Ji(t,e={},r=3,n=!1){let i=new Headers(ae.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}`:(CC(e),e.property&&(u+=`/${e.property}`),new Headers(e.headers).forEach((g,S)=>i.set(S,g)),c=e.params||c);let l=n?kC:rd.request,p={url:`${nd()}/${u}`,headers:i,retryConfig:{noResponseRetries:r},params:c,responseType:"text",timeout:yv()};mv.info("instance request %j",p);let f=await l(p);mv.info("instance metadata is %s",f.data);let m=f.headers.get(ae.HEADER_NAME);if(m!==ae.HEADER_VALUE)throw new RangeError(`Invalid response from metadata service: incorrect ${ae.HEADER_NAME} header. Expected '${ae.HEADER_VALUE}', got ${m?`'${m}'`:"no header"}`);if(typeof f.data=="string")try{return AC.parse(f.data)}catch{}return f.data}o(Ji,"metadataAccessor");async function kC(t){let e={...t,url:t.url?.toString().replace(nd(),nd(ae.SECONDARY_HOST_ADDRESS))},r=(0,rd.request)(t),n=(0,rd.request)(e);return Promise.any([r,n])}o(kC,"fastFailMetadataRequest");function OC(t){return Ji("instance",t)}o(OC,"instance");function $C(t){return Ji("project",t)}o($C,"project");function zC(t){return Ji("universe",t)}o(zC,"universe");async function NC(t){let e={};return await Promise.all(t.map(r=>(async()=>{let n=await Ji(r),i=r.metadataKey;e[i]=n})())),e}o(NC,"bulk");function DC(){return process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0}o(DC,"detectGCPAvailableRetries");var Gs;async function jC(){if(process.env.METADATA_SERVER_DETECTION){let t=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(t in ae.METADATA_SERVER_DETECTION))throw new RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${t}\`, but it should be \`${Object.keys(ae.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`);switch(t){case"assume-present":return!0;case"none":return!1;case"bios-only":return od();case"ping-only":}}try{return Gs===void 0&&(Gs=Ji("instance",void 0,DC(),!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST))),await Gs,!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(jC,"isAvailable");function UC(){Gs=void 0}o(UC,"resetIsAvailableCache");ae.gcpResidencyCache=null;function od(){return ae.gcpResidencyCache===null&&gv(),ae.gcpResidencyCache}o(od,"getGCPResidency");function gv(t=null){ae.gcpResidencyCache=t!==null?t:(0,IC.detectGCPResidency)()}o(gv,"setGCPResidency");function yv(){return od()?0:3e3}o(yv,"requestTimeout");xC(Jl(),ae)});var vv=M(Zs=>{"use strict";Zs.byteLength=LC;Zs.toByteArray=BC;Zs.fromByteArray=HC;var Or=[],ar=[],MC=typeof Uint8Array<"u"?Uint8Array:Array,id="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Jn=0,_v=id.length;Jn<_v;++Jn)Or[Jn]=id[Jn],ar[id.charCodeAt(Jn)]=Jn;var Jn,_v;ar[45]=62;ar[95]=63;function bv(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(bv,"getLens");function LC(t){var e=bv(t),r=e[0],n=e[1];return(r+n)*3/4-n}o(LC,"byteLength");function FC(t,e,r){return(e+r)*3/4-r}o(FC,"_byteLength");function BC(t){var e,r=bv(t),n=r[0],i=r[1],u=new MC(FC(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(BC,"toByteArray");function qC(t){return Or[t>>18&63]+Or[t>>12&63]+Or[t>>6&63]+Or[t&63]}o(qC,"tripletToBase64");function VC(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(qC(n));return i.join("")}o(VC,"encodeChunk");function HC(t){for(var e,r=t.length,n=r%3,i=[],u=16383,c=0,l=r-n;c<l;c+=u)i.push(VC(t,c,c+u>l?l:c+u));return n===1?(e=t[r-1],i.push(Or[e>>2]+Or[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Or[e>>10]+Or[e>>4&63]+Or[e<<2&63]+"=")),i.join("")}o(HC,"fromByteArray")});var sd=M(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.fromArrayBufferToHex=WC;function WC(t){return Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join("")}o(WC,"fromArrayBufferToHex")});var Ev=M(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.BrowserCrypto=void 0;var Mo=vv(),GC=sd(),ud=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 Mo.fromByteArray(new Uint8Array(n))}randomBytesBase64(e){let r=new Uint8Array(e);return window.crypto.getRandomValues(r),Mo.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=Mo.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 Mo.fromByteArray(new Uint8Array(c))}decodeBase64StringUtf8(e){let r=Mo.toByteArray(t.padBase64(e));return new TextDecoder().decode(r)}encodeBase64StringUtf8(e){let r=new TextEncoder().encode(e);return Mo.fromByteArray(r)}async sha256DigestHex(e){let r=new TextEncoder().encode(e),n=await window.crypto.subtle.digest("SHA-256",r);return(0,GC.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))}};Js.BrowserCrypto=ud});var Sv=M(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.NodeCrypto=void 0;var Lo=require("crypto"),cd=class{static{o(this,"NodeCrypto")}async sha256DigestBase64(e){return Lo.createHash("sha256").update(e).digest("base64")}randomBytesBase64(e){return Lo.randomBytes(e).toString("base64")}async verify(e,r,n){let i=Lo.createVerify("RSA-SHA256");return i.update(r),i.end(),i.verify(e,n,"base64")}async sign(e,r){let n=Lo.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 Lo.createHash("sha256").update(e).digest("hex")}async signWithHmacSha256(e,r){let n=typeof e=="string"?e:JC(e);return ZC(Lo.createHmac("sha256",n).update(r).digest())}};Ks.NodeCrypto=cd;function ZC(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}o(ZC,"toArrayBuffer");function JC(t){return Buffer.from(t)}o(JC,"toBuffer")});var Qi=M(tn=>{"use strict";var KC=tn&&tn.__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]}),QC=tn&&tn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KC(e,t,r)};Object.defineProperty(tn,"__esModule",{value:!0});tn.createCrypto=ek;tn.hasBrowserCrypto=Pv;var YC=Ev(),XC=Sv();QC(sd(),tn);function ek(){return Pv()?new YC.BrowserCrypto:new XC.NodeCrypto}o(ek,"createCrypto");function Pv(){return typeof window<"u"&&typeof window.crypto<"u"&&typeof window.crypto.subtle<"u"}o(Pv,"hasBrowserCrypto")});var Fo=M((ld,Tv)=>{var Qs=require("buffer"),$r=Qs.Buffer;function wv(t,e){for(var r in t)e[r]=t[r]}o(wv,"copyProps");$r.from&&$r.alloc&&$r.allocUnsafe&&$r.allocUnsafeSlow?Tv.exports=Qs:(wv(Qs,ld),ld.Buffer=Kn);function Kn(t,e,r){return $r(t,e,r)}o(Kn,"SafeBuffer");Kn.prototype=Object.create($r.prototype);wv($r,Kn);Kn.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return $r(t,e,r)};Kn.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=$r(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Kn.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return $r(t)};Kn.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Qs.SlowBuffer(t)}});var Av=M((sJ,xv)=>{"use strict";function dd(t){var e=(t/8|0)+(t%8===0?0:1);return e}o(dd,"getParamSize");var tk={ES256:dd(256),ES384:dd(384),ES512:dd(521)};function rk(t){var e=tk[t];if(e)return e;throw new Error('Unknown algorithm "'+t+'"')}o(rk,"getParamBytesForAlg");xv.exports=rk});var pd=M((cJ,$v)=>{"use strict";var Ys=Fo().Buffer,Rv=Av(),Xs=128,Cv=0,nk=32,ok=16,ik=2,kv=ok|nk|Cv<<6,eu=ik|Cv<<6;function ak(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}o(ak,"base64Url");function Ov(t){if(Ys.isBuffer(t))return t;if(typeof t=="string")return Ys.from(t,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}o(Ov,"signatureAsBuffer");function sk(t,e){t=Ov(t);var r=Rv(e),n=r+1,i=t.length,u=0;if(t[u++]!==kv)throw new Error('Could not find expected "seq"');var c=t[u++];if(c===(Xs|1)&&(c=t[u++]),i-u<c)throw new Error('"seq" specified length of "'+c+'", only "'+(i-u)+'" remaining');if(t[u++]!==eu)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++]!==eu)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=Ys.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=ak(h),h}o(sk,"derToJose");function Iv(t,e,r){for(var n=0;e+n<r&&t[e+n]===0;)++n;var i=t[e+n]>=Xs;return i&&--n,n}o(Iv,"countPadding");function uk(t,e){t=Ov(t);var r=Rv(e),n=t.length;if(n!==r*2)throw new TypeError('"'+e+'" signatures must be "'+r*2+'" bytes, saw "'+n+'"');var i=Iv(t,0,r),u=Iv(t,r,t.length),c=r-i,l=r-u,p=2+c+1+1+l,f=p<Xs,m=Ys.allocUnsafe((f?2:3)+p),g=0;return m[g++]=kv,f?m[g++]=p:(m[g++]=Xs|1,m[g++]=p&255),m[g++]=eu,m[g++]=c,i<0?(m[g++]=0,g+=t.copy(m,g,0,r)):g+=t.copy(m,g,i,r),m[g++]=eu,m[g++]=l,u<0?(m[g++]=0,t.copy(m,g,r)):t.copy(m,g,r+u),m}o(uk,"joseToDer");$v.exports={derToJose:sk,joseToDer:uk}});var vr=M(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.LRUCache=void 0;rn.snakeToCamel=Nv;rn.originalOrCamelOptions=pk;rn.removeUndefinedValuesInObject=fk;rn.isValidFile=mk;rn.getWellKnownCertificateConfigFileLocation=hk;var ck=require("fs"),lk=require("os"),fd=require("path"),dk="certificate_config.json",zv="gcloud";function Nv(t){return t.replace(/([_][^_])/g,e=>e.slice(1).toUpperCase())}o(Nv,"snakeToCamel");function pk(t){function e(r){let n=t||{};return n[r]??n[Nv(r)]}return o(e,"get"),{get:e}}o(pk,"originalOrCamelOptions");var md=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()}};rn.LRUCache=md;function fk(t){return Object.entries(t).forEach(([e,r])=>{(r===void 0||r==="undefined")&&delete t[e]}),t}o(fk,"removeUndefinedValuesInObject");async function mk(t){try{return(await ck.promises.lstat(t)).isFile()}catch{return!1}}o(mk,"isValidFile");function hk(){let t=process.env.CLOUDSDK_CONFIG||(gk()?fd.join(process.env.APPDATA||"",zv):fd.join(process.env.HOME||"",".config",zv));return fd.join(t,dk)}o(hk,"getWellKnownCertificateConfigFileLocation");function gk(){return lk.platform().startsWith("win")}o(gk,"_isWindows")});var Dv=M((fJ,yk)=>{yk.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 hd=M(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.USER_AGENT=An.PRODUCT_NAME=An.pkg=void 0;var jv=Dv();An.pkg=jv;var Uv="google-api-nodejs-client";An.PRODUCT_NAME=Uv;var _k=`${Uv}/${jv.version}`;An.USER_AGENT=_k});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 bk=require("events"),gd=yt(),vk=vr(),Ek=td(),yd=hd();Er.DEFAULT_UNIVERSE="googleapis.com";Er.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=5*60*1e3;var _d=class t extends bk.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,vk.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 gd.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&&gd.Gaxios.mergeHeaders(u,r.headers),n&&gd.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,Ek.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(`${yd.PRODUCT_NAME}/`)||e.headers.set("User-Agent",`${r} ${yd.USER_AGENT}`):e.headers.set("User-Agent",yd.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=_d});var vd=M(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.LoginTicket=void 0;var bd=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()}}};tu.LoginTicket=bd});var Qn=M(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.OAuth2Client=zr.ClientAuthentication=zr.CertificateFormat=zr.CodeChallengeMethod=void 0;var Mv=yt(),Sk=require("querystring"),Pk=require("stream"),wk=pd(),Lv=vr(),Ed=Qi(),Bo=Zt(),Tk=vd(),Fv;(function(t){t.Plain="plain",t.S256="S256"})(Fv||(zr.CodeChallengeMethod=Fv={}));var nn;(function(t){t.PEM="PEM",t.JWK="JWK"})(nn||(zr.CertificateFormat=nn={}));var Yi;(function(t){t.ClientSecretPost="ClientSecretPost",t.ClientSecretBasic="ClientSecretBasic",t.None="None"})(Yi||(zr.ClientAuthentication=Yi={}));var Sd=class t extends Bo.AuthClient{static{o(this,"OAuth2Client")}redirectUri;certificateCache={};certificateExpiry=null;certificateCacheFormat=nn.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||Yi.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()+"?"+Sk.stringify(e)}generateCodeVerifier(){throw new Error("generateCodeVerifier is removed, please use generateCodeVerifierAsync instead.")}async generateCodeVerifierAsync(){let e=(0,Ed.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===Yi.ClientSecretBasic){let p=Buffer.from(`${this._clientId}:${this._clientSecret}`);n.set("authorization",`Basic ${p.toString("base64")}`)}this.clientAuthentication===Yi.ClientSecretPost&&(i.client_secret=this._clientSecret);let u={...t.RETRY_CONFIG,method:"POST",url:r,data:new URLSearchParams((0,Lv.removeUndefinedValuesInObject)(i)),headers:n};Bo.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,Lv.removeUndefinedValuesInObject)(n))};Bo.AuthClient.setMethodName(c,"refreshTokenNoCache"),i=await this.transporter.request(c)}catch(c){throw c instanceof Mv.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(Bo.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=Mv.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 Pk.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,Ed.hasBrowserCrypto)()?nn.JWK:nn.PEM;if(this.certificateExpiry&&e<this.certificateExpiry.getTime()&&this.certificateCacheFormat===r)return{certs:this.certificateCache,format:r};let n,i;switch(r){case nn.PEM:i=this.endpoints.oauth2FederatedSignonPemCertsUrl.toString();break;case nn.JWK:i=this.endpoints.oauth2FederatedSignonJwkCertsUrl.toString();break;default:throw new Error(`Unsupported certificate format ${r}`)}try{let f={...t.RETRY_CONFIG,url:i};Bo.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 nn.PEM:l=n.data;break;case nn.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};Bo.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,Ed.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(B){throw B instanceof Error&&(B.message=`Can't parse token envelope: ${l[0]}': ${B.message}`),B}if(!m)throw new Error("Can't parse token envelope: "+l[0]);try{g=JSON.parse(c.decodeBase64StringUtf8(l[1]))}catch(B){throw B instanceof Error&&(B.message=`Can't parse token payload '${l[0]}`),B}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=wk.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 w=Number(g.exp);if(isNaN(w))throw new Error("exp field using invalid format");let E=new Date().getTime()/1e3;if(w>=E+u)throw new Error("Expiration time too far in future: "+JSON.stringify(g));let T=_-t.CLOCK_SKEW_SECS_,k=w+t.CLOCK_SKEW_SECS_;if(E<T)throw new Error("Token used too early, "+E+" < "+T+": "+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 B=g.aud,W=!1;if(n.constructor===Array?W=n.indexOf(B)>-1:W=B===n,!W)throw new Error("Wrong recipient, payload audience != requiredAudience")}return new Tk.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=Sd});var wd=M(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.Compute=void 0;var xk=yt(),Bv=Ki(),Ak=Qn(),Pd=class extends Ak.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 Bv.instance(i)}catch(i){throw i instanceof xk.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 Bv.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))}};ru.Compute=Pd});var xd=M(nu=>{"use strict";Object.defineProperty(nu,"__esModule",{value:!0});nu.IdTokenClient=void 0;var Ik=Qn(),Td=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}};nu.IdTokenClient=Td});var Ad=M(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.GCPEnv=void 0;qo.clear=Rk;qo.getEnv=Ck;var qv=Ki(),Nr;(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"})(Nr||(qo.GCPEnv=Nr={}));var Xi;function Rk(){Xi=void 0}o(Rk,"clear");async function Ck(){return Xi||(Xi=kk(),Xi)}o(Ck,"getEnv");async function kk(){let t=Nr.NONE;return Ok()?t=Nr.APP_ENGINE:$k()?t=Nr.CLOUD_FUNCTIONS:await jk()?await Dk()?t=Nr.KUBERNETES_ENGINE:zk()?t=Nr.CLOUD_RUN:Nk()?t=Nr.CLOUD_RUN_JOBS:t=Nr.COMPUTE_ENGINE:t=Nr.NONE,t}o(kk,"getEnvMemoized");function Ok(){return!!(process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME)}o(Ok,"isAppEngine");function $k(){return!!(process.env.FUNCTION_NAME||process.env.FUNCTION_TARGET)}o($k,"isCloudFunction");function zk(){return!!process.env.K_CONFIGURATION}o(zk,"isCloudRun");function Nk(){return!!process.env.CLOUD_RUN_JOB}o(Nk,"isCloudRunJob");async function Dk(){try{return await qv.instance("attributes/cluster-name"),!0}catch{return!1}}o(Dk,"isKubernetesEngine");async function jk(){return qv.isAvailable()}o(jk,"isComputeEngine")});var Id=M((AJ,Vv)=>{var ou=Fo().Buffer,Uk=require("stream"),Mk=require("util");function iu(t){if(this.buffer=null,this.writable=!0,this.readable=!0,!t)return this.buffer=ou.alloc(0),this;if(typeof t.pipe=="function")return this.buffer=ou.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(iu,"DataStream");Mk.inherits(iu,Uk);iu.prototype.write=o(function(e){this.buffer=ou.concat([this.buffer,ou.from(e)]),this.emit("data",e)},"write");iu.prototype.end=o(function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1},"end");Vv.exports=iu});var Wv=M((RJ,Hv)=>{"use strict";var ea=require("buffer").Buffer,Rd=require("buffer").SlowBuffer;Hv.exports=au;function au(t,e){if(!ea.isBuffer(t)||!ea.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(au,"bufferEq");au.install=function(){ea.prototype.equal=Rd.prototype.equal=o(function(e){return au(this,e)},"equal")};var Lk=ea.prototype.equal,Fk=Rd.prototype.equal;au.restore=function(){ea.prototype.equal=Lk,Rd.prototype.equal=Fk}});var $d=M((kJ,tE)=>{var Ho=Fo().Buffer,sr=require("crypto"),Zv=pd(),Gv=require("util"),Bk=`"%s" is not a valid algorithm.
|
|
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.
|
|
39
39
|
Supported algorithms are:
|
|
40
|
-
"HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,ta="secret must be a string or buffer",Vo="key must be a string or a buffer",qk="key must be a string, a buffer or an object",kd=typeof sr.createPublicKey=="function";kd&&(Vo+=" or a KeyObject",ta+="or a KeyObject");function Jv(t){if(!Ho.isBuffer(t)&&typeof t!="string"&&(!kd||typeof t!="object"||typeof t.type!="string"||typeof t.asymmetricKeyType!="string"||typeof t.export!="function"))throw Sr(Vo)}o(Jv,"checkIsPublicKey");function Kv(t){if(!Ho.isBuffer(t)&&typeof t!="string"&&typeof t!="object")throw Sr(qk)}o(Kv,"checkIsPrivateKey");function Vk(t){if(!Ho.isBuffer(t)){if(typeof t=="string")return t;if(!kd||typeof t!="object"||t.type!=="secret"||typeof t.export!="function")throw Sr(ta)}}o(Vk,"checkIsSecretKey");function Od(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}o(Od,"fromBase64");function Qv(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(Qv,"toBase64");function Sr(t){var e=[].slice.call(arguments,1),r=Gv.format.bind(Gv,t).apply(null,e);return new TypeError(r)}o(Sr,"typeError");function Hk(t){return Ho.isBuffer(t)||typeof t=="string"}o(Hk,"bufferOrString");function ra(t){return Hk(t)||(t=JSON.stringify(t)),t}o(ra,"normalizeInput");function Yv(t){return o(function(r,n){Vk(n),r=ra(r);var i=sr.createHmac("sha"+t,n),u=(i.update(r),i.digest("base64"));return Od(u)},"sign")}o(Yv,"createHmacSigner");var Cd,Wk="timingSafeEqual"in sr?o(function(e,r){return e.byteLength!==r.byteLength?!1:sr.timingSafeEqual(e,r)},"timingSafeEqual"):o(function(e,r){return Cd||(Cd=Wv()),Cd(e,r)},"timingSafeEqual");function Gk(t){return o(function(r,n,i){var u=Yv(t)(r,i);return Wk(Ho.from(n),Ho.from(u))},"verify")}o(Gk,"createHmacVerifier");function Xv(t){return o(function(r,n){Kv(n),r=ra(r);var i=sr.createSign("RSA-SHA"+t),u=(i.update(r),i.sign(n,"base64"));return Od(u)},"sign")}o(Xv,"createKeySigner");function eE(t){return o(function(r,n,i){Jv(i),r=ra(r),n=Qv(n);var u=sr.createVerify("RSA-SHA"+t);return u.update(r),u.verify(i,n,"base64")},"verify")}o(eE,"createKeyVerifier");function Zk(t){return o(function(r,n){Kv(n),r=ra(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 Od(u)},"sign")}o(Zk,"createPSSKeySigner");function Jk(t){return o(function(r,n,i){Jv(i),r=ra(r),n=Qv(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(Jk,"createPSSKeyVerifier");function Kk(t){var e=Xv(t);return o(function(){var n=e.apply(null,arguments);return n=Zv.derToJose(n,"ES"+t),n},"sign")}o(Kk,"createECDSASigner");function Qk(t){var e=eE(t);return o(function(n,i,u){i=Zv.joseToDer(i,"ES"+t).toString("base64");var c=e(n,i,u);return c},"verify")}o(Qk,"createECDSAVerifer");function Yk(){return o(function(){return""},"sign")}o(Yk,"createNoneSigner");function Xk(){return o(function(e,r){return r===""},"verify")}o(Xk,"createNoneVerifier");tE.exports=o(function(e){var r={hs:Yv,rs:Xv,ps:Zk,es:Kk,none:Yk},n={hs:Gk,rs:eE,ps:Jk,es:Qk,none:Xk},i=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!i)throw Sr(Bk,e);var u=(i[1]||i[3]).toLowerCase(),c=i[2];return{sign:r[u](c),verify:n[u](c)}},"jwa")});var zd=M(($J,rE)=>{var eO=require("buffer").Buffer;rE.exports=o(function(e){return typeof e=="string"?e:typeof e=="number"||eO.isBuffer(e)?e.toString():JSON.stringify(e)},"toString")});var uE=M((NJ,sE)=>{var tO=Fo().Buffer,nE=Id(),rO=$d(),nO=require("stream"),oE=zd(),Nd=require("util");function iE(t,e){return tO.from(t,e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}o(iE,"base64url");function oO(t,e,r){r=r||"utf8";var n=iE(oE(t),"binary"),i=iE(oE(e),r);return Nd.format("%s.%s",n,i)}o(oO,"jwsSecuredInput");function aE(t){var e=t.header,r=t.payload,n=t.secret||t.privateKey,i=t.encoding,u=rO(e.alg),c=oO(e,r,i),l=u.sign(c,n);return Nd.format("%s.%s",c,l)}o(aE,"jwsSign");function su(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 nE(e);this.readable=!0,this.header=t.header,this.encoding=t.encoding,this.secret=this.privateKey=this.key=r,this.payload=new nE(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(su,"SignStream");Nd.inherits(su,nO);su.prototype.sign=o(function(){try{var e=aE({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");su.sign=aE;sE.exports=su});var _E=M((jJ,yE)=>{var lE=Fo().Buffer,cE=Id(),iO=$d(),aO=require("stream"),dE=zd(),sO=require("util"),uO=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function cO(t){return Object.prototype.toString.call(t)==="[object Object]"}o(cO,"isObject");function lO(t){if(cO(t))return t;try{return JSON.parse(t)}catch{return}}o(lO,"safeJsonParse");function pE(t){var e=t.split(".",1)[0];return lO(lE.from(e,"base64").toString("binary"))}o(pE,"headerFromJWS");function dO(t){return t.split(".",2).join(".")}o(dO,"securedInputFromJWS");function fE(t){return t.split(".")[2]}o(fE,"signatureFromJWS");function pO(t,e){e=e||"utf8";var r=t.split(".")[1];return lE.from(r,"base64").toString(e)}o(pO,"payloadFromJWS");function mE(t){return uO.test(t)&&!!pE(t)}o(mE,"isValidJws");function hE(t,e,r){if(!e){var n=new Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}t=dE(t);var i=fE(t),u=dO(t),c=iO(e);return c.verify(u,i,r)}o(hE,"jwsVerify");function gE(t,e){if(e=e||{},t=dE(t),!mE(t))return null;var r=pE(t);if(!r)return null;var n=pO(t);return(r.typ==="JWT"||e.json)&&(n=JSON.parse(n,e.encoding)),{header:r,payload:n,signature:fE(t)}}o(gE,"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 cE(e);this.readable=!0,this.algorithm=t.algorithm,this.encoding=t.encoding,this.secret=this.publicKey=this.key=r,this.signature=new cE(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");sO.inherits(Wo,aO);Wo.prototype.verify=o(function(){try{var e=hE(this.signature.buffer,this.algorithm,this.key.buffer),r=gE(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=gE;Wo.isValid=mE;Wo.verify=hE;yE.exports=Wo});var Dd=M(In=>{var bE=uE(),uu=_E(),fO=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];In.ALGORITHMS=fO;In.sign=bE.sign;In.verify=uu.verify;In.decode=uu.decode;In.isValid=uu.isValid;In.createSign=o(function(e){return new bE(e)},"createSign");In.createVerify=o(function(e){return new uu(e)},"createVerify")});var zE=M(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});lu.GoogleToken=void 0;var vE=cu(require("fs")),mO=yt(),hO=cu(Dd()),gO=cu(require("path")),yO=require("util");function cu(t,e){if(typeof WeakMap=="function")var r=new WeakMap,n=new WeakMap;return(cu=o(function(u,c){if(!c&&u&&u.__esModule)return u;var l,p,f={__proto__:null,default:u};if(u===null||on(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(cu,"_interopRequireWildcard");function on(t){"@babel/helpers - typeof";return on=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},on(t)}o(on,"_typeof");function _O(t,e){RE(t,e),e.add(t)}o(_O,"_classPrivateMethodInitSpec");function bO(t,e,r){RE(t,e),e.set(t,r)}o(bO,"_classPrivateFieldInitSpec");function RE(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(RE,"_checkPrivateRedeclaration");function EE(t,e,r){return t.set(Pr(t,e),r),r}o(EE,"_classPrivateFieldSet");function SE(t,e){return t.get(Pr(t,e))}o(SE,"_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 PE(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,OE(n.key),n)}}o(PE,"_defineProperties");function CE(t,e,r){return e&&PE(t.prototype,e),r&&PE(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}o(CE,"_createClass");function kE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}o(kE,"_classCallCheck");function vO(t,e,r){return e=aa(e),EO(t,Bd()?Reflect.construct(e,r||[],aa(t).constructor):e.apply(t,r))}o(vO,"_callSuper");function EO(t,e){if(e&&(on(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return SO(t)}o(EO,"_possibleConstructorReturn");function SO(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}o(SO,"_assertThisInitialized");function PO(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&&ia(t,e)}o(PO,"_inherits");function jd(t){var e=typeof Map=="function"?new Map:void 0;return jd=o(function(n){if(n===null||!TO(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 wO(n,arguments,aa(this).constructor)}return o(i,"Wrapper"),i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ia(i,n)},"_wrapNativeSuper"),jd(t)}o(jd,"_wrapNativeSuper");function wO(t,e,r){if(Bd())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&ia(i,r.prototype),i}o(wO,"_construct");function Bd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Bd=o(function(){return!!t},"_isNativeReflectConstruct"))()}o(Bd,"_isNativeReflectConstruct");function TO(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}o(TO,"_isNativeFunction");function ia(t,e){return ia=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},ia(t,e)}o(ia,"_setPrototypeOf");function aa(t){return aa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},aa(t)}o(aa,"_getPrototypeOf");function Jt(t,e,r){return(e=OE(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}o(Jt,"_defineProperty");function OE(t){var e=xO(t,"string");return on(e)=="symbol"?e:e+""}o(OE,"_toPropertyKey");function xO(t,e){if(on(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(on(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}o(xO,"_toPrimitive");function Qt(){var t,e,r=typeof Symbol=="function"?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function u(h,_,w,E){var T=_&&_.prototype instanceof l?_:l,k=Object.create(T.prototype);return Kt(k,"_invoke",function(B,W,V){var H,J,te,Z=0,Ne=V||[],Se=!1,be={p:0,n:0,v:t,a:Oe,f:Oe.bind(t,4),d:o(function(Ve,He){return H=Ve,J=0,te=t,be.n=He,c},"d")};function Oe(Ie,Ve){for(J=Ie,te=Ve,e=0;!Se&&Z&&!He&&e<Ne.length;e++){var He,Ze=Ne[e],jt=be.p,Et=Ze[2];Ie>3?(He=Et===Ve)&&(te=Ze[(J=Ze[4])?5:(J=3,3)],Ze[4]=Ze[5]=t):Ze[0]<=jt&&((He=Ie<2&&jt<Ze[1])?(J=0,be.v=Ve,be.n=Ze[1]):jt<Et&&(He=Ie<3||Ze[0]>Ve||Ve>Et)&&(Ze[4]=Ie,Ze[5]=Ve,be.n=Et,J=0))}if(He||Ie>1)return c;throw Se=!0,Ve}return o(Oe,"d"),function(Ie,Ve,He){if(Z>1)throw TypeError("Generator is already running");for(Se&&Ve===1&&Oe(Ve,He),J=Ve,te=He;(e=J<2?t:te)||!Se;){H||(J?J<3?(J>1&&(be.n=-1),Oe(J,te)):be.n=te:be.v=te);try{if(Z=2,H){if(J||(Ie="next"),e=H[Ie]){if(!(e=e.call(H,te)))throw TypeError("iterator result is not an object");if(!e.done)return e;te=e.value,J<2&&(J=0)}else J===1&&(e=H.return)&&e.call(H),J<2&&(te=TypeError("The iterator does not provide a '"+Ie+"' method"),J=1);H=t}else if((e=(Se=be.n<0)?te:B.call(W,be))!==c)break}catch(Ze){H=t,J=1,te=Ze}finally{Z=1}}return{value:e,done:Se}}}(h,w,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 wE(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(wE,"asyncGeneratorStep");function Go(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var u=t.apply(e,r);function c(p){wE(u,n,i,c,l,"next",p)}o(c,"_next");function l(p){wE(u,n,i,c,l,"throw",p)}o(l,"_throw"),c(void 0)})}}o(Go,"_asyncToGenerator");var TE=vE.readFile?(0,yO.promisify)(vE.readFile):Go(Qt().m(o(function t(){return Qt().w(function(e){for(;;)switch(e.n){case 0:throw new oa("use key rather than keyFile.","MISSING_CREDENTIALS");case 1:return e.a(2)}},t)},"_callee"))),xE="https://oauth2.googleapis.com/token",AO="https://oauth2.googleapis.com/revoke?token=",oa=function(t){function e(r,n){var i;return kE(this,e),i=vO(this,e,[r]),Jt(i,"code",void 0),i.code=n,i}return o(e,"ErrorWithCode"),PO(e,t),CE(e)}(jd(Error)),na=new WeakMap,Dr=new WeakSet,FJ=lu.GoogleToken=function(){function t(e){kE(this,t),_O(this,Dr),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,mO.request)(n)},"request")}),bO(this,na,void 0),Pr(Dr,this,$E).call(this,e)}return o(t,"GoogleToken"),CE(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(on(r)==="object"&&(n=r,r=void 0),n=Object.assign({forceRefresh:!1},n),r){var i=r;Pr(Dr,this,AE).call(this,n).then(function(u){return i(null,u)},r);return}return Pr(Dr,this,AE).call(this,n)},"getToken")},{key:"getCredentials",value:function(){var e=Go(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=gO.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,TE(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 oa("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,TE(i,"utf8");case 5:return m=S.v,S.a(2,{privateKey:m});case 6:throw new oa("*.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 oa("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(Dr,this,IE).call(this).then(function(){return r()},r);return}return Pr(Dr,this,IE).call(this)},"revokeToken")}])}();function AE(t){return Ud.apply(this,arguments)}o(AE,"_getTokenAsync");function Ud(){return Ud=Go(Qt().m(o(function t(e){return Qt().w(function(r){for(;;)switch(r.n){case 0:if(!(SE(na,this)&&!e.forceRefresh)){r.n=1;break}return r.a(2,SE(na,this));case 1:return r.p=1,r.n=2,EE(na,this,Pr(Dr,this,IO).call(this,e));case 2:return r.a(2,r.v);case 3:return r.p=3,EE(na,this,void 0),r.f(3);case 4:return r.a(2)}},t,this,[[1,,3,4]])},"_callee3"))),Ud.apply(this,arguments)}o(Ud,"_getTokenAsync2");function IO(t){return Md.apply(this,arguments)}o(IO,"_getTokenAsyncInner");function Md(){return Md=Go(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(Dr,this,RO).call(this);case 4:return n.a(2,Pr(Dr,this,CO).call(this))}},t,this)},"_callee4"))),Md.apply(this,arguments)}o(Md,"_getTokenAsyncInner2");function RO(){if(!this.iss)throw new oa("email is required.","MISSING_CREDENTIALS")}o(RO,"_ensureEmail");function IE(){return Ld.apply(this,arguments)}o(IE,"_revokeTokenAsync");function Ld(){return Ld=Go(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=AO+this.accessToken,r.n=2,this.transporter.request({url:e,retry:!0});case 2:Pr(Dr,this,$E).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"))),Ld.apply(this,arguments)}o(Ld,"_revokeTokenAsync2");function $E(){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,on(t.scope)==="object"?this.scope=t.scope.join(" "):this.scope=t.scope,this.eagerRefreshThresholdMillis=t.eagerRefreshThresholdMillis,t.transporter&&(this.transporter=t.transporter)}o($E,"_configure");function CO(){return Fd.apply(this,arguments)}o(CO,"_requestToken");function Fd(){return Fd=Go(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:xE,exp:e+3600,iat:e,sub:this.sub},r),i=hO.sign({header:{alg:"RS256"},payload:n,secret:this.key}),g.p=1,g.n=2,this.transporter.request({method:"POST",url:xE,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"))),Fd.apply(this,arguments)}o(Fd,"_requestToken2")});var Vd=M(du=>{"use strict";Object.defineProperty(du,"__esModule",{value:!0});du.JWTAccess=void 0;var kO=Dd(),OO=vr(),NE={alg:"RS256",typ:"JWT"},qd=class t{static{o(this,"JWTAccess")}email;key;keyId;projectId;eagerRefreshThresholdMillis;cache=new OO.LRUCache({capacity:500,maxAge:60*60*1e3});constructor(e,r,n,i){this.email=e,this.key=r,this.keyId=n,this.eagerRefreshThresholdMillis=i??5*60*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?{...NE,kid:this.keyId}:NE,g=Object.assign(f,r),S=kO.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)}})})}};du.JWTAccess=qd});var Wd=M(fu=>{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});fu.JWT=void 0;var DE=zE(),$O=Vd(),zO=Qn(),pu=Zt(),Hd=class t extends zO.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!==pu.DEFAULT_UNIVERSE;if(this.subject&&this.universeDomain!==pu.DEFAULT_UNIVERSE)throw new RangeError(`Service Account user is configured for the credential. Domain-wide delegation is not supported in universes other than ${pu.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 $O.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!==pu.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 DE.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 DE.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.")}};fu.JWT=Hd});var Zd=M(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.UserRefreshClient=Zo.USER_REFRESH_ACCOUNT_TYPE=void 0;var NO=Qn(),DO=Zt();Zo.USER_REFRESH_ACCOUNT_TYPE="authorized_user";var Gd=class t extends NO.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 DO.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}};Zo.UserRefreshClient=Gd});var Kd=M(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.Impersonated=Jo.IMPERSONATED_ACCOUNT_TYPE=void 0;var jE=Qn(),jO=yt(),UO=vr();Jo.IMPERSONATED_ACCOUNT_TYPE="impersonated_service_account";var Jd=class t extends jE.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 jE.OAuth2Client,this.targetPrincipal=e.targetPrincipal??"",this.delegates=e.delegates??[],this.targetScopes=e.targetScopes??[],this.lifetime=e.lifetime??3600,!!!(0,UO.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 jO.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}};Jo.Impersonated=Jd});var Yd=M(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.OAuthClientAuthHandler=void 0;sa.getErrorFromOAuthErrorResponse=FO;var Ko=yt(),MO=Qi(),LO=["PUT","POST","PATCH"],Qd=class{static{o(this,"OAuthClientAuthHandler")}#e=(0,MO.createCrypto)();#t;transporter;constructor(e){e&&"clientId"in e?(this.#t=e,this.transporter=new Ko.Gaxios):(this.#t=e?.clientAuthentication,this.transporter=e?.transporter||new Ko.Gaxios)}applyClientAuthenticationOptions(e,r){e.headers=Ko.Gaxios.mergeHeaders(e.headers),this.injectAuthenticatedHeaders(e,r),r||this.injectAuthenticatedRequestBody(e)}injectAuthenticatedHeaders(e,r){if(r)e.headers=Ko.Gaxios.mergeHeaders(e.headers,{authorization:`Bearer ${r}`});else if(this.#t?.confidentialClientType==="basic"){e.headers=Ko.Gaxios.mergeHeaders(e.headers);let n=this.#t.clientId,i=this.#t.clientSecret||"",u=this.#e.encodeBase64StringUtf8(`${n}:${i}`);Ko.Gaxios.mergeHeaders(e.headers,{authorization:`Basic ${u}`})}}injectAuthenticatedRequestBody(e){if(this.#t?.confidentialClientType==="request-body"){let r=(e.method||"GET").toUpperCase();if(!LO.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"]}}}};sa.OAuthClientAuthHandler=Qd;function FO(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(FO,"getErrorFromOAuthErrorResponse")});var hu=M(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.StsCredentials=void 0;var BO=yt(),qO=Zt(),UE=Yd(),VO=vr(),Xd=class t extends UE.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,VO.removeUndefinedValuesInObject)(i))};qO.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 BO.GaxiosError&&c.response?(0,UE.getErrorFromOAuthErrorResponse)(c.response.data,c):c}}};mu.StsCredentials=Xd});var Rn=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 HO=yt(),WO=require("stream"),ep=Zt(),GO=hu(),ME=vr(),ZO=hd(),JO="urn:ietf:params:oauth:grant-type:token-exchange",KO="urn:ietf:params:oauth:token-type:access_token",tp="https://www.googleapis.com/auth/cloud-platform",QO=3600;ur.EXPIRATION_TIME_OFFSET=5*60*1e3;ur.EXTERNAL_ACCOUNT_TYPE="external_account";ur.CLOUD_RESOURCE_MANAGER="https://cloudresourcemanager.googleapis.com/v1/projects/";var YO="//iam\\.googleapis\\.com/locations/[^/]+/workforcePools/[^/]+/providers/.+",XO="https://sts.{universeDomain}/v1/token",rp=class t extends ep.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,ME.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")??XO.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,ME.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 GO.StsCredentials({tokenExchangeEndpoint:this.tokenUrl,clientAuthentication:this.clientAuth}),this.scopes=r.get("scopes")||[tp],this.cachedAccessToken=null,this.audience=r.get("audience"),this.subjectTokenType=c,this.workforcePoolUserProject=l;let g=new RegExp(YO);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=QO),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}`};ep.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=HO.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 WO.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:JO,audience:this.audience,requestedTokenType:KO,subjectToken:e,subjectTokenType:this.subjectTokenType,scope:this.serviceAccountImpersonationUrl?[tp]: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"}};ep.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||[tp]}getMetricsHeaderValue(){let e=process.version.replace(/^v/,""),r=this.serviceAccountImpersonationUrl!==void 0,n=this.credentialSourceType?this.credentialSourceType:"unknown";return`gl-node/${e} auth/${ZO.pkg.version} google-byoid-sdk source/${n} sa-impersonation/${r} config-lifetime/${this.configLifetimeRequested}`}getTokenUrl(){return this.tokenUrl}};ur.BaseExternalAccountClient=rp});var LE=M(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.FileSubjectTokenSupplier=void 0;var op=require("util"),ip=require("fs"),e0=(0,op.promisify)(ip.readFile??(()=>{})),t0=(0,op.promisify)(ip.realpath??(()=>{})),r0=(0,op.promisify)(ip.lstat??(()=>{})),np=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 t0(e),!(await r0(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}};gu.FileSubjectTokenSupplier=np});var FE=M(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.UrlSubjectTokenSupplier=void 0;var n0=Zt(),ap=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};n0.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}};yu.UrlSubjectTokenSupplier=ap});var BE=M(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.CertificateSubjectTokenSupplier=Yt.InvalidConfigurationError=Yt.CertificateSourceUnavailableError=Yt.CERTIFICATE_CONFIGURATION_ENV_VARIABLE=void 0;var _u=vr(),bu=require("fs"),vu=require("crypto"),o0=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 sp=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 o0.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,_u.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,_u.isValidFile)(r))return r;throw new jr(`Path from environment variable "${Yt.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" is invalid: ${r}`)}let n=(0,_u.getWellKnownCertificateConfigFileLocation)();if(await(0,_u.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 bu.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 bu.promises.readFile(e),new vu.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 bu.promises.readFile(r),(0,vu.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 vu.X509Certificate(e);if(!this.trustChainPath)return JSON.stringify([r.raw.toString("base64")]);try{let u=((await bu.promises.readFile(this.trustChainPath,"utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g)??[]).map((p,f)=>{try{return new vu.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=sp});var lp=M(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.IdentityPoolClient=void 0;var i0=Rn(),up=vr(),a0=LE(),s0=FE(),qE=BE(),u0=hu(),VE=yt(),cp=class t extends i0.BaseExternalAccountClient{static{o(this,"IdentityPoolClient")}subjectTokenSupplier;constructor(e){super(e);let r=(0,up.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,up.originalOrCamelOptions)(n),c=(0,up.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 s0.UrlSubjectTokenSupplier({url:m,formatType:l,subjectTokenFieldName:p,headers:S,additionalGaxiosOptions:t.RETRY_CONFIG});else if(g){this.credentialSourceType="certificate";let h=new qE.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 qE.CertificateSubjectTokenSupplier){let r=await this.subjectTokenSupplier.createMtlsHttpsAgent();this.stsCredential=new u0.StsCredentials({tokenExchangeEndpoint:this.getTokenUrl(),clientAuthentication:this.clientAuth,transporter:new VE.Gaxios({agent:r})}),this.transporter=new VE.Gaxios({...this.transporter.defaults||{},agent:r})}return e}};Eu.IdentityPoolClient=cp});var pp=M(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.AwsRequestSigner=void 0;var Su=yt(),WE=Qi(),HE="AWS4-HMAC-SHA256",c0="aws4_request",dp=class{static{o(this,"AwsRequestSigner")}getCredentials;region;crypto;constructor(e,r){this.getCredentials=e,this.region=r,this.crypto=(0,WE.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 d0({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=Su.Gaxios.mergeHeaders(f.amzDate?{"x-amz-date":f.amzDate}:{},{authorization:f.authorizationHeader,host:p.host},c||{});l.token&&Su.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}};Pu.AwsRequestSigner=dp;async function ua(t,e,r){return await t.signWithHmacSha256(e,r)}o(ua,"sign");async function l0(t,e,r,n,i){let u=await ua(t,`AWS4${e}`,r),c=await ua(t,u,n),l=await ua(t,c,i);return await ua(t,l,"aws4_request")}o(l0,"getSigningKey");async function d0(t){let e=Su.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=Su.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)}
|
|
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
41
|
`});let m=f.join(";"),g=await t.crypto.sha256DigestHex(r),S=`${t.method.toUpperCase()}
|
|
42
42
|
${t.canonicalUri}
|
|
43
43
|
${t.canonicalQuerystring}
|
|
44
44
|
${p}
|
|
45
45
|
${m}
|
|
46
|
-
${g}`,h=`${c}/${t.region}/${n}/${
|
|
46
|
+
${g}`,h=`${c}/${t.region}/${n}/${C0}`,_=`${iS}
|
|
47
47
|
${u}
|
|
48
48
|
${h}
|
|
49
|
-
`+await t.crypto.sha256DigestHex(S),w=await l0(t.crypto,t.securityCredentials.secretAccessKey,c,t.region,n),E=await ua(t.crypto,w,_),T=`${HE} Credential=${t.securityCredentials.accessKeyId}/${h}, SignedHeaders=${m}, Signature=${(0,WE.fromArrayBufferToHex)(E)}`;return{amzDate:e.has("date")?void 0:u,authorizationHeader:T,canonicalQuerystring:t.canonicalQuerystring}}o(d0,"generateAuthenticationHeaderMap")});var GE=M(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.DefaultAwsSecurityCredentialsSupplier=void 0;var wu=Zt(),fp=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};wu.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 wu.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 wu.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 wu.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}};Tu.DefaultAwsSecurityCredentialsSupplier=fp});var hp=M(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.AwsClient=void 0;var p0=pp(),f0=Rn(),m0=GE(),ZE=vr(),h0=yt(),mp=class t extends f0.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,ZE.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,ZE.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 m0.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 p0.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 h0.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}))}};xu.AwsClient=mp});var vp=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 Au="urn:ietf:params:oauth:token-type:saml2",gp="urn:ietf:params:oauth:token-type:id_token",yp="urn:ietf:params:oauth:token-type:jwt",_p=class{static{o(this,"ExecutableResponse")}version;success;expirationTime;tokenType;errorCode;errorMessage;subjectToken;constructor(e){if(!e.version)throw new Iu("Executable response must contain a 'version' field.");if(e.success===void 0)throw new Ru("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!==Au&&this.tokenType!==gp&&this.tokenType!==yp)throw new Cu(`Executable response must contain a 'token_type' field when successful and it must be one of ${gp}, ${yp}, or ${Au}.`);if(this.tokenType===Au){if(!e.saml_response)throw new ca(`Executable response must contain a 'saml_response' field when token_type=${Au}.`);this.subjectToken=e.saml_response}else{if(!e.id_token)throw new ca(`Executable response must contain a 'id_token' field when token_type=${gp} or ${yp}.`);this.subjectToken=e.id_token}}else{if(!e.code)throw new ku("Executable response must contain a 'code' field when unsuccessful.");if(!e.message)throw new Ou("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=_p;var Ur=class extends Error{static{o(this,"ExecutableResponseError")}constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}};ot.ExecutableResponseError=Ur;var Iu=class extends Ur{static{o(this,"InvalidVersionFieldError")}};ot.InvalidVersionFieldError=Iu;var Ru=class extends Ur{static{o(this,"InvalidSuccessFieldError")}};ot.InvalidSuccessFieldError=Ru;var bp=class extends Ur{static{o(this,"InvalidExpirationTimeFieldError")}};ot.InvalidExpirationTimeFieldError=bp;var Cu=class extends Ur{static{o(this,"InvalidTokenTypeFieldError")}};ot.InvalidTokenTypeFieldError=Cu;var ku=class extends Ur{static{o(this,"InvalidCodeFieldError")}};ot.InvalidCodeFieldError=ku;var Ou=class extends Ur{static{o(this,"InvalidMessageFieldError")}};ot.InvalidMessageFieldError=Ou;var ca=class extends Ur{static{o(this,"InvalidSubjectTokenError")}};ot.InvalidSubjectTokenError=ca});var Pp=M(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.PluggableAuthHandler=Qo.ExecutableError=void 0;var Yn=vp(),g0=require("child_process"),Ep=require("fs"),$u=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)}};Qo.ExecutableError=$u;var Sp=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=g0.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 Yn.ExecutableResponse(p);return r(f)}catch(p){return p instanceof Yn.ExecutableResponseError?n(p):n(new Yn.ExecutableResponseError(`The executable returned an invalid response: ${u}`))}else return n(new $u(u,l.toString()))})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0)return;let e;try{e=await Ep.promises.realpath(this.outputFile)}catch{return}if(!(await Ep.promises.lstat(e)).isFile())return;let r=await Ep.promises.readFile(e,{encoding:"utf8"});if(r!=="")try{let n=JSON.parse(r);return new Yn.ExecutableResponse(n).isValid()?new Yn.ExecutableResponse(n):void 0}catch(n){throw n instanceof Yn.ExecutableResponseError?n:new Yn.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}};Qo.PluggableAuthHandler=Sp});var Tp=M(Yo=>{"use strict";Object.defineProperty(Yo,"__esModule",{value:!0});Yo.PluggableAuthClient=Yo.ExecutableError=void 0;var y0=Rn(),_0=vp(),JE=Pp(),b0=Pp();Object.defineProperty(Yo,"ExecutableError",{enumerable:!0,get:o(function(){return b0.ExecutableError},"get")});var v0=30*1e3,KE=5*1e3,QE=120*1e3,E0="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES",YE=1,wp=class extends y0.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=v0;else if(this.timeoutMillis=e.credential_source.executable.timeout_millis,this.timeoutMillis<KE||this.timeoutMillis>QE)throw new Error(`Timeout must be between ${KE} and ${QE} milliseconds.`);this.outputFile=e.credential_source.executable.output_file,this.handler=new JE.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile}),this.credentialSourceType="executable"}async retrieveSubjectToken(){if(process.env[E0]!=="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>YE)throw new Error(`Version of executable is not currently supported, maximum supported version is ${YE}.`);if(!e.success)throw new JE.ExecutableError(e.errorMessage,e.errorCode);if(this.outputFile&&!e.expirationTime)throw new _0.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}};Yo.PluggableAuthClient=wp});var Ap=M(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.ExternalAccountClient=void 0;var S0=Rn(),P0=lp(),w0=hp(),T0=Tp(),xp=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===S0.EXTERNAL_ACCOUNT_TYPE?e.credential_source?.environment_id?new w0.AwsClient(e):e.credential_source?.executable?new T0.PluggableAuthClient(e):new P0.IdentityPoolClient(e):null}};zu.ExternalAccountClient=xp});var Cp=M(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.ExternalAccountAuthorizedUserClient=Xo.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var eS=Zt(),XE=Yd(),tS=yt(),x0=require("stream"),A0=Rn();Xo.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var I0="https://sts.{universeDomain}/v1/oauthtoken",Ip=class t extends XE.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})};eS.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 tS.GaxiosError&&i.response?(0,XE.getErrorFromOAuthErrorResponse)(i.response.data,i):i}}},Rp=class extends eS.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 Ip({tokenRefreshEndpoint:e.token_url??I0.replace("{universeDomain}",this.universeDomain),transporter:this.transporter,clientAuthentication:r}),this.cachedAccessToken=null,this.quotaProjectId=e.quota_project_id,typeof e?.eagerRefreshThresholdMillis!="number"?this.eagerRefreshThresholdMillis=A0.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=tS.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 x0.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}};Xo.ExternalAccountAuthorizedUserClient=Rp});var iS=M(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.GoogleAuth=wr.GoogleAuthExceptionMessages=void 0;var R0=require("child_process"),la=require("fs"),C0=yt(),da=Ki(),k0=require("os"),kp=require("path"),O0=Qi(),$0=wd(),z0=xd(),N0=Ad(),ei=Wd(),rS=Zd(),ti=Kd(),D0=Ap(),pa=Rn(),Op=Zt(),nS=Cp(),oS=vr();wr.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(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.
|
|
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 $p=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(wr.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===wr.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(wr.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 da.universe("universe-domain"),e||=Op.DEFAULT_UNIVERSE}catch(r){if(r&&r?.response?.status===404)e=Op.DEFAULT_UNIVERSE;else throw r}return e}async getUniverseDomain(){let e=(0,oS.originalOrCamelOptions)(this.clientOptions).get("universe_domain");try{e??=(await this.getClient()).universeDomain}catch{e??=Op.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 ei.JWT?r.scopes=this.scopes:r instanceof pa.BaseExternalAccountClient&&(r.scopes=this.getAnyScopes()),await this.#t(r);if(r=await this._tryGetApplicationCredentialsFromWellKnownFile(e),r)return r instanceof ei.JWT?r.scopes=this.scopes:r instanceof pa.BaseExternalAccountClient&&(r.scopes=this.getAnyScopes()),await this.#t(r);if(await this._checkIsGCE())return e.scopes=this.getAnyScopes(),await this.#t(new $0.Compute(e));throw new Error(wr.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=da.getGCPResidency()||await da.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=kp.join(i,".config"))}return r&&(r=kp.join(r,"gcloud","application_default_credentials.json"),la.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=la.realpathSync(e),!la.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=la.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!==ti.IMPERSONATED_ACCOUNT_TYPE)throw new Error(`The incoming JSON object does not have the "${ti.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 ti.Impersonated({...e,sourceClient:r,targetPrincipal:n,targetScopes:Array.isArray(i)?i:[i]})}fromJSON(e,r={}){let n,i=(0,oS.originalOrCamelOptions)(r).get("universe_domain");return e.type===rS.USER_REFRESH_ACCOUNT_TYPE?(n=new rS.UserRefreshClient(r),n.fromJSON(e)):e.type===ti.IMPERSONATED_ACCOUNT_TYPE?n=this.fromImpersonatedJSON(e):e.type===pa.EXTERNAL_ACCOUNT_TYPE?(n=D0.ExternalAccountClient.fromJSON({...e,...r}),n.scopes=this.getAnyScopes()):e.type===nS.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE?n=new nS.ExternalAccountAuthorizedUserClient({...e,...r}):(r.scopes=this.scopes,n=new ei.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 ei.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 ei.JWT({...r,apiKey:e})}_isWindows(){let e=k0.platform();return!!(e&&e.length>=3&&e.substring(0,3).toLowerCase()==="win")}async getDefaultServiceProjectId(){return new Promise(e=>{(0,R0.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!==pa.EXTERNAL_ACCOUNT_TYPE?null:await(await this.getClient()).getProjectId()}async getGCEProjectId(){try{return await da.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 ti.Impersonated)return{client_email:e.getTargetPrincipal()};if(e instanceof pa.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([da.instance("service-accounts/default/email"),this.getUniverseDomain()]);return{client_email:r,universe_domain:n}}throw new Error(wr.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=kp.resolve(this.keyFilename),r=la.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 z0.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=C0.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,N0.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 ti.Impersonated)return(await n.sign(e)).signedBlob;let u=(0,O0.createCrypto)();if(n instanceof ei.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}};wr.GoogleAuth=$p});var aS=M(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.IAMAuth=void 0;var zp=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}}};Nu.IAMAuth=zp});var sS=M(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.DownscopedClient=Mr.EXPIRATION_TIME_OFFSET=Mr.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var j0=yt(),U0=require("stream"),Np=Zt(),M0=hu(),L0="urn:ietf:params:oauth:grant-type:token-exchange",F0="urn:ietf:params:oauth:token-type:access_token",B0="urn:ietf:params:oauth:token-type:access_token";Mr.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;Mr.EXPIRATION_TIME_OFFSET=5*60*1e3;var Dp=class extends Np.AuthClient{static{o(this,"DownscopedClient")}authClient;credentialAccessBoundary;cachedDownscopedAccessToken;stsCredential;constructor(e,r={accessBoundary:{accessBoundaryRules:[]}}){if(super(e instanceof Np.AuthClient?{}:e),e instanceof Np.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>Mr.MAX_ACCESS_BOUNDARY_RULES_COUNT)throw new Error(`The provided access boundary has more than ${Mr.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 M0.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=j0.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 U0.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:L0,requestedTokenType:F0,subjectToken:e,subjectTokenType:B0},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}};Mr.DownscopedClient=Dp});var uS=M(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.PassThroughClient=void 0;var q0=Zt(),jp=class extends q0.AuthClient{static{o(this,"PassThroughClient")}async request(e){return this.transporter.request(e)}async getAccessToken(){return{}}async getRequestHeaders(){return new Headers}};Du.PassThroughClient=jp});var fS=M(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.GoogleAuth=X.auth=X.PassThroughClient=X.ExternalAccountAuthorizedUserClient=X.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=X.ExecutableError=X.PluggableAuthClient=X.DownscopedClient=X.BaseExternalAccountClient=X.ExternalAccountClient=X.IdentityPoolClient=X.AwsRequestSigner=X.AwsClient=X.UserRefreshClient=X.LoginTicket=X.ClientAuthentication=X.OAuth2Client=X.CodeChallengeMethod=X.Impersonated=X.JWT=X.JWTAccess=X.IdTokenClient=X.IAMAuth=X.GCPEnv=X.Compute=X.DEFAULT_UNIVERSE=X.AuthClient=X.gaxios=X.gcpMetadata=void 0;var cS=iS();Object.defineProperty(X,"GoogleAuth",{enumerable:!0,get:o(function(){return cS.GoogleAuth},"get")});X.gcpMetadata=Ki();X.gaxios=yt();var lS=Zt();Object.defineProperty(X,"AuthClient",{enumerable:!0,get:o(function(){return lS.AuthClient},"get")});Object.defineProperty(X,"DEFAULT_UNIVERSE",{enumerable:!0,get:o(function(){return lS.DEFAULT_UNIVERSE},"get")});var V0=wd();Object.defineProperty(X,"Compute",{enumerable:!0,get:o(function(){return V0.Compute},"get")});var H0=Ad();Object.defineProperty(X,"GCPEnv",{enumerable:!0,get:o(function(){return H0.GCPEnv},"get")});var W0=aS();Object.defineProperty(X,"IAMAuth",{enumerable:!0,get:o(function(){return W0.IAMAuth},"get")});var G0=xd();Object.defineProperty(X,"IdTokenClient",{enumerable:!0,get:o(function(){return G0.IdTokenClient},"get")});var Z0=Vd();Object.defineProperty(X,"JWTAccess",{enumerable:!0,get:o(function(){return Z0.JWTAccess},"get")});var J0=Wd();Object.defineProperty(X,"JWT",{enumerable:!0,get:o(function(){return J0.JWT},"get")});var K0=Kd();Object.defineProperty(X,"Impersonated",{enumerable:!0,get:o(function(){return K0.Impersonated},"get")});var Up=Qn();Object.defineProperty(X,"CodeChallengeMethod",{enumerable:!0,get:o(function(){return Up.CodeChallengeMethod},"get")});Object.defineProperty(X,"OAuth2Client",{enumerable:!0,get:o(function(){return Up.OAuth2Client},"get")});Object.defineProperty(X,"ClientAuthentication",{enumerable:!0,get:o(function(){return Up.ClientAuthentication},"get")});var Q0=vd();Object.defineProperty(X,"LoginTicket",{enumerable:!0,get:o(function(){return Q0.LoginTicket},"get")});var Y0=Zd();Object.defineProperty(X,"UserRefreshClient",{enumerable:!0,get:o(function(){return Y0.UserRefreshClient},"get")});var X0=hp();Object.defineProperty(X,"AwsClient",{enumerable:!0,get:o(function(){return X0.AwsClient},"get")});var e$=pp();Object.defineProperty(X,"AwsRequestSigner",{enumerable:!0,get:o(function(){return e$.AwsRequestSigner},"get")});var t$=lp();Object.defineProperty(X,"IdentityPoolClient",{enumerable:!0,get:o(function(){return t$.IdentityPoolClient},"get")});var r$=Ap();Object.defineProperty(X,"ExternalAccountClient",{enumerable:!0,get:o(function(){return r$.ExternalAccountClient},"get")});var n$=Rn();Object.defineProperty(X,"BaseExternalAccountClient",{enumerable:!0,get:o(function(){return n$.BaseExternalAccountClient},"get")});var o$=sS();Object.defineProperty(X,"DownscopedClient",{enumerable:!0,get:o(function(){return o$.DownscopedClient},"get")});var dS=Tp();Object.defineProperty(X,"PluggableAuthClient",{enumerable:!0,get:o(function(){return dS.PluggableAuthClient},"get")});Object.defineProperty(X,"ExecutableError",{enumerable:!0,get:o(function(){return dS.ExecutableError},"get")});var pS=Cp();Object.defineProperty(X,"EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE",{enumerable:!0,get:o(function(){return pS.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE},"get")});Object.defineProperty(X,"ExternalAccountAuthorizedUserClient",{enumerable:!0,get:o(function(){return pS.ExternalAccountAuthorizedUserClient},"get")});var i$=uS();Object.defineProperty(X,"PassThroughClient",{enumerable:!0,get:o(function(){return i$.PassThroughClient},"get")});var a$=new cS.GoogleAuth;X.auth=a$});var m$={};La(m$,{bigQueryAuth:()=>ke,googleBigQuery:()=>f$});module.exports=hw(m$);var gw=Object.freeze({status:"aborted"});function re(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(re,"$constructor");var yw=Symbol("zod_brand"),Ar=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Fa=class extends Error{static{o(this,"$ZodEncodeError")}constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},hc={};function Gr(t){return t&&Object.assign(hc,t),hc}o(Gr,"config");function yc(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(yc,"getEnumValues");function Gf(t,e){return typeof e=="bigint"?e.toString():e}o(Gf,"jsonStringifyReplacer");function qa(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}o(qa,"cached");function Zf(t){return t==null}o(Zf,"nullish");function Va(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}o(Va,"cleanRegex");var Wf=Symbol("evaluating");function et(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Wf)return n===void 0&&(n=Wf,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}o(et,"defineLazy");var _c="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function mi(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}o(mi,"isObject");var _w=qa(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Jf(t){if(mi(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(mi(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}o(Jf,"isPlainObject");var Kf=new Set(["string","number","symbol"]);function ho(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(ho,"escapeRegex");function Ha(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}o(Ha,"clone");function Ke(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(Ke,"normalizeParams");function Qf(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}o(Qf,"optionalKeys");var bw={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 go(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(go,"aborted");function mn(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}o(mn,"prefixIssues");function Ba(t){return typeof t=="string"?t:t?.message}o(Ba,"unwrapMessage");function hn(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=Ba(t.inst?._zod.def?.error?.(t))??Ba(e?.error?.(t))??Ba(r.customError?.(t))??Ba(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}o(hn,"finalizeIssue");function Yf(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}o(Yf,"getLengthableOrigin");function bc(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}o(bc,"issue");var Xf=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,Gf,2),Object.defineProperty(t,"toString",{value:o(()=>t.message,"value"),enumerable:!1})},"initializer"),em=re("$ZodError",Xf),hi=re("$ZodError",Xf,{Parent:Error});var Ew=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=>hn(p,u,Gr())));throw _c(l,i?.callee),l}return c.value},"_parse"),Wa=Ew(hi),Sw=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=>hn(p,u,Gr())));throw _c(l,i?.callee),l}return c.value},"_parseAsync"),Ga=Sw(hi),Pw=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??em)(u.issues.map(c=>hn(c,i,Gr())))}:{success:!0,data:u.value}},"_safeParse"),gi=Pw(hi),ww=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=>hn(c,i,Gr())))}:{success:!0,data:u.value}},"_safeParseAsync"),yi=ww(hi);var Tw="(?:(?:\\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])))",xw=new RegExp(`^${Tw}$`);var tm=o(t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},"string"),rm=/^-?\d+n?$/;var vc=/^-?\d+(?:\.\d+)?$/,nm=/^(?:true|false)$/i;var yo=re("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])});var om=re("$ZodCheckMinLength",(t,e)=>{var r;yo.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Zf(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=Yf(i);n.issues.push({origin:c,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}});var Ec=re("$ZodCheckStringFormat",(t,e)=>{var r,n;yo.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=()=>{})}),im=re("$ZodCheckRegex",(t,e)=>{Ec.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 sm={major:4,minor:3,patch:6};var Qe=re("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=sm;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=go(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=go(c,S)))});else{if(c.issues.length===S)continue;f||(f=go(c,S))}}return m?m.then(()=>c):c},"runChecks"),u=o((c,l,p)=>{if(go(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=gi(t,i);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return yi(t,i).then(c=>c.success?{value:c.data}:{issues:c.error?.issues})}},"validate"),vendor:"zod",version:1}))}),Ka=re("$ZodString",(t,e)=>{Qe.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??tm(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}}),Sc=re("$ZodStringFormat",(t,e)=>{Ec.init(t,e),Ka.init(t,e)});var pm=re("$ZodURL",(t,e)=>{Sc.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 fm=re("$ZodNumber",(t,e)=>{Qe.init(t,e),t._zod.pattern=t._zod.bag.pattern??vc,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}});var Pc=re("$ZodBoolean",(t,e)=>{Qe.init(t,e),t._zod.pattern=nm,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}}),mm=re("$ZodBigInt",(t,e)=>{Qe.init(t,e),t._zod.pattern=rm,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 hm=re("$ZodAny",(t,e)=>{Qe.init(t,e),t._zod.parse=r=>r}),gm=re("$ZodUnknown",(t,e)=>{Qe.init(t,e),t._zod.parse=r=>r});var ym=re("$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}}),_m=re("$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 um(t,e,r){t.issues.length&&e.issues.push(...mn(r,t.issues)),e.value[r]=t.value}o(um,"handleArrayResult");var bm=re("$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=>um(f,r,c))):um(p,r,c)}return u.length?Promise.all(u).then(()=>r):r}});function Ja(t,e,r,n,i){if(t.issues.length){if(i&&!(r in n))return;e.issues.push(...mn(r,t.issues))}t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}o(Ja,"handlePropertyResult");function Aw(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=Qf(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}o(Aw,"normalizeDef");function Iw(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=>Ja(h,r,g,e,m))):Ja(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(Iw,"handleCatchall");var vm=re("$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=qa(()=>Aw(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=mi,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",w=h._zod.run({value:f[S],issues:[]},p);w instanceof Promise?m.push(w.then(E=>Ja(E,l,S,f,_))):Ja(w,l,S,f,_)}return u?Iw(m,f,l,p,n.value,t):m.length?Promise.all(m).then(()=>l):l}});function cm(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=>!go(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=>hn(c,n,Gr())))}),e)}o(cm,"handleUnionResults");var wc=re("$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=>Va(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=>cm(p,i,t,u)):cm(l,i,t,u)}});var Em=re("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,wc.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=qa(()=>{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(!mi(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 Sm=re("$ZodRecord",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!Jf(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(...mn(f,g.issues)),r.value[f]=g.value})):(m.issues.length&&r.issues.push(...mn(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"&&vc.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=>hn(g,n,Gr())),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(...mn(l,g.issues)),r.value[p.value]=g.value})):(m.issues.length&&r.issues.push(...mn(l,m.issues)),r.value[p.value]=m.value)}}return u.length?Promise.all(u).then(()=>r):r}});var Pm=re("$ZodEnum",(t,e)=>{Qe.init(t,e);let r=yc(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>Kf.has(typeof i)).map(i=>typeof i=="string"?ho(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}}),wm=re("$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"?ho(n):n?ho(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 Tm=re("$ZodTransform",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Fa(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 lm(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}o(lm,"handleOptionalResult");var xm=re("$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(`^(${Va(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=>lm(u,r.value)):lm(i,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}});var Am=re("$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(`^(${Va(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 Im=re("$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=>Za(c,e.in,n)):Za(u,e.in,n)}let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(u=>Za(u,e.out,n)):Za(i,e.out,n)}});function Za(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}o(Za,"handlePipeResult");var Rm=re("$ZodCustom",(t,e)=>{yo.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=>dm(u,r,n,t));dm(i,r,n,t)}});function dm(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(bc(i))}}o(dm,"handleRefineResult");var km,Ow=Symbol("ZodOutput"),$w=Symbol("ZodInput"),Tc=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 Om(){return new Tc}o(Om,"registry");(km=globalThis).__zod_globalRegistry??(km.__zod_globalRegistry=Om());var xc=globalThis.__zod_globalRegistry;function $m(t,e){return new t({type:"string",...Ke(e)})}o($m,"_string");function zm(t,e){return new t({type:"string",coerce:!0,...Ke(e)})}o(zm,"_coercedString");function Nm(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Ke(e)})}o(Nm,"_url");function Dm(t,e){return new t({type:"number",checks:[],...Ke(e)})}o(Dm,"_number");function jm(t,e){return new t({type:"number",coerce:!0,checks:[],...Ke(e)})}o(jm,"_coercedNumber");function Um(t,e){return new t({type:"boolean",...Ke(e)})}o(Um,"_boolean");function Mm(t,e){return new t({type:"boolean",coerce:!0,...Ke(e)})}o(Mm,"_coercedBoolean");function Lm(t,e){return new t({type:"bigint",coerce:!0,...Ke(e)})}o(Lm,"_coercedBigint");function Fm(t){return new t({type:"any"})}o(Fm,"_any");function Bm(t){return new t({type:"unknown"})}o(Bm,"_unknown");function qm(t,e){return new t({type:"void",...Ke(e)})}o(qm,"_void");function Vm(t,e){return new t({type:"date",coerce:!0,...Ke(e)})}o(Vm,"_coercedDate");function fr(t,e){return new om({check:"min_length",...Ke(e),minimum:t})}o(fr,"_minLength");function gn(t,e){return new im({check:"string_format",format:"regex",...Ke(e),pattern:t})}o(gn,"_regex");function Hm(t,e,r){let n=Ke(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}o(Hm,"_custom");var tt=re("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)=>Wa(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>gi(t,r,n),t.parseAsync=async(r,n)=>Ga(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>yi(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)=>Ha(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.apply=r=>r(t)}),Ya=re("ZodMiniString",(t,e)=>{Ka.init(t,e),tt.init(t,e)});function b(t){return $m(Ya,t)}o(b,"string");var Wm=re("ZodMiniStringFormat",(t,e)=>{Sc.init(t,e),Ya.init(t,e)});var qw=re("ZodMiniURL",(t,e)=>{pm.init(t,e),Wm.init(t,e)});function Gm(t){return Nm(qw,t)}o(Gm,"url");var Ac=re("ZodMiniNumber",(t,e)=>{fm.init(t,e),tt.init(t,e)});function Tt(t){return Dm(Ac,t)}o(Tt,"number");var Ic=re("ZodMiniBoolean",(t,e)=>{Pc.init(t,e),tt.init(t,e)});function Ue(t){return Um(Ic,t)}o(Ue,"boolean");var Zm=re("ZodMiniBigInt",(t,e)=>{mm.init(t,e),tt.init(t,e)});var Vw=re("ZodMiniAny",(t,e)=>{hm.init(t,e),tt.init(t,e)});function bi(){return Fm(Vw)}o(bi,"any");var Hw=re("ZodMiniUnknown",(t,e)=>{gm.init(t,e),tt.init(t,e)});function pe(){return Bm(Hw)}o(pe,"unknown");var Ww=re("ZodMiniVoid",(t,e)=>{ym.init(t,e),tt.init(t,e)});function Jm(t){return qm(Ww,t)}o(Jm,"_void");var Km=re("ZodMiniDate",(t,e)=>{_m.init(t,e),tt.init(t,e)});var Gw=re("ZodMiniArray",(t,e)=>{bm.init(t,e),tt.init(t,e)});function ge(t,e){return new Gw({type:"array",element:t,...Ke(e)})}o(ge,"array");var Zw=re("ZodMiniObject",(t,e)=>{vm.init(t,e),tt.init(t,e),et(t,"shape",()=>e.shape)});function O(t,e){let r={type:"object",shape:t??{},...Ke(e)};return new Zw(r)}o(O,"object");var Jw=re("ZodMiniUnion",(t,e)=>{wc.init(t,e),tt.init(t,e)});function ye(t,e){return new Jw({type:"union",options:t,...Ke(e)})}o(ye,"union");var Kw=re("ZodMiniDiscriminatedUnion",(t,e)=>{Em.init(t,e),tt.init(t,e)});function _o(t,e,r){return new Kw({type:"union",options:e,discriminator:t,...Ke(r)})}o(_o,"discriminatedUnion");var Qw=re("ZodMiniRecord",(t,e)=>{Sm.init(t,e),tt.init(t,e)});function fe(t,e,r){return new Qw({type:"record",keyType:t,valueType:e,...Ke(r)})}o(fe,"record");var Yw=re("ZodMiniEnum",(t,e)=>{Pm.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 Yw({type:"enum",entries:r,...Ke(e)})}o(Ee,"_enum");var Xw=re("ZodMiniLiteral",(t,e)=>{wm.init(t,e),tt.init(t,e)});function se(t,e){return new Xw({type:"literal",values:Array.isArray(t)?t:[t],...Ke(e)})}o(se,"literal");var eT=re("ZodMiniTransform",(t,e)=>{Tm.init(t,e),tt.init(t,e)});function yn(t){return new eT({type:"transform",transform:t})}o(yn,"transform");var tT=re("ZodMiniOptional",(t,e)=>{xm.init(t,e),tt.init(t,e)});function q(t){return new tT({type:"optional",innerType:t})}o(q,"optional");var rT=re("ZodMiniNullable",(t,e)=>{Am.init(t,e),tt.init(t,e)});function vi(t){return new rT({type:"nullable",innerType:t})}o(vi,"nullable");var nT=re("ZodMiniPipe",(t,e)=>{Im.init(t,e),tt.init(t,e)});function _n(t,e){return new nT({type:"pipe",in:t,out:e})}o(_n,"pipe");var oT=re("ZodMiniCustom",(t,e)=>{Rm.init(t,e),tt.init(t,e)});function Xa(t,e){return Hm(oT,t??(()=>!0),e)}o(Xa,"custom");var Ei={};La(Ei,{bigint:()=>dT,boolean:()=>lT,date:()=>pT,number:()=>cT,string:()=>uT});function uT(t){return zm(Ya,t)}o(uT,"string");function cT(t){return jm(Ac,t)}o(cT,"number");function lT(t){return Mm(Ic,t)}o(lT,"boolean");function dT(t){return Lm(Zm,t)}o(dT,"bigint");function pT(t){return Vm(Km,t)}o(pT,"date");var Cc=O({retryOnFailure:O({defaultValue:q(Ue()),hide:q(Ue())}),continueOnFailure:O({defaultValue:q(Ue()),hide:q(Ue())})}),Rc=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 Rc(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:q(b())}),_e=o((t,e)=>O({type:se(e),required:Ue(),defaultValue:q(bi())}),"TPropertyValue");var Lt=O({...$e.shape,..._e(b(),"SHORT_TEXT").shape}),Zr=O({...$e.shape,..._e(b(),"LONG_TEXT").shape});var Ym=O({label:b(),value:pe()}),es=O({disabled:q(Ue()),placeholder:q(b()),options:ge(Ym)});var Ft=O({...$e.shape,options:es,..._e(pe(),"STATIC_DROPDOWN").shape}),Jr=O({...$e.shape,options:es,..._e(ge(pe()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var kc=O({...$e.shape,..._e(pe(),"DROPDOWN").shape,refreshers:ge(b())}),Si=O({...$e.shape,..._e(ge(pe()),"MULTI_SELECT_DROPDOWN").shape,refreshers:ge(b())});var Kr=O({...$e.shape,..._e(Ue(),"CHECKBOX").shape});var Qr=O({...$e.shape,..._e(Tt(),"NUMBER").shape});var Pi=O({...$e.shape,..._e(pe(),"FILE").shape});var wi=O({...$e.shape,..._e(b(),"DATE_TIME").shape});var Xm=fe(b(),ye([Lt,Zr,Ft,Si,Jr,Kr,Qr,Pi,wi])),Ti=O({...$e.shape,properties:Xm,..._e(ge(pe()),"ARRAY").shape});var xi=O({...$e.shape,..._e(ye([fe(b(),pe())]),"JSON").shape});var eh=ye([Lt,Ft,xi,Ti,Jr]),mT=fe(b(),eh),Oc=O({refreshers:ge(b()),...$e.shape,..._e(pe(),"DYNAMIC").shape});var ts=O({...$e.shape,..._e(Jm(),"MARKDOWN").shape});var Ai=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(Ai||{}),bo=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(bo||{}),vo=(T=>(T.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",T.COMMUNICATION="COMMUNICATION",T.COMMERCE="COMMERCE",T.CORE="CORE",T.UNIVERSAL_AI="UNIVERSAL_AI",T.FLOW_CONTROL="FLOW_CONTROL",T.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",T.ACCOUNTING="ACCOUNTING",T.PRODUCTIVITY="PRODUCTIVITY",T.CONTENT_AND_FILES="CONTENT_AND_FILES",T.DEVELOPER_TOOLS="DEVELOPER_TOOLS",T.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",T.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",T.HUMAN_RESOURCES="HUMAN_RESOURCES",T.PAYMENT_PROCESSING="PAYMENT_PROCESSING",T.MARKETING="MARKETING",T.SALES_AND_CRM="SALES_AND_CRM",T))(vo||{});var Ii=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(Ii||{}),$c="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||{}),Ri=(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))(Ri||{}),hT=O({strategy:Ee(Ri),paramName:q(b())}),Ci=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(Ci||{});var rs=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(rs||{}),th=O({status:q(Tt()),body:q(pe()),headers:q(fe(b(),b()))}),rh=O({type:se("DELAY"),resumeDateTime:b(),requestIdToReply:q(b()),handlerId:q(b()),streamStepProgress:q(Ee(rs))}),nh=O({type:se("WEBHOOK"),requestId:b(),requestIdToReply:q(b()),response:th,handlerId:q(b()),streamStepProgress:q(Ee(rs))}),gT=ye([rh,nh]);var yT=O({body:pe(),rawBody:q(pe()),headers:fe(b(),b()),queryParams:fe(b(),b())});function gt(t){return t==null}o(gt,"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 ns(t,e){if(t==null)throw new Error(`${e} is null or undefined`)}o(ns,"assertNotNullOrUndefined");var zc=ht(require("crypto"),1);var _T=128,Un,Eo,bT=o(t=>{!Un||Un.length<t?(Un=Buffer.allocUnsafe(t*_T),zc.default.randomFillSync(Un),Eo=0):Eo+t>Un.length&&(zc.default.randomFillSync(Un),Eo=0),Eo+=t},"fillPool"),vT=o(t=>(bT(t|=0),Un.subarray(Eo-t,Eo)),"random"),ET=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"),ih=o((t,e=21)=>ET(t,e,vT),"customAlphabet");var ST="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ah=21,KF=b().check(gn(new RegExp(`^[0-9a-zA-Z]{${ah}}$`))),PT=ih(ST,ah);var bn=_n(yn(t=>t instanceof Date?t.toISOString():t),b()),tr={id:b(),created:bn,updated:bn},Je=o(t=>q(vi(t)),"Nullable");function Nc(t){return q(vi(Ee(t)))}o(Nc,"NullableEnum");var XF=_n(yn(t=>t==="true"||t===!0?!0:t==="false"||t===!1?!1:void 0),q(Ue())),os=o(t=>_n(yn(e=>Array.isArray(e)?e:e!==void 0?[e]:void 0),q(ge(t))),"OptionalArrayFromQuery");var rB=fe(b(),pe());var Oi=(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))(Oi||{});var mB=b().check(gn(/^#[0-9A-Fa-f]{6}$/));var gB=O({filename:b(),data:pe(),type:se("file"),mimetype:q(b())});var wT=ht(uh());var PB=O({...tr,name:b(),permissions:ge(b()),platformId:Je(b()),type:b(),userCount:q(Tt())});var ch=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(ch||{}),Dc=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Dc||{}),jc=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(jc||{});var Uc=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(Uc||{});var Mc=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Mc||{});var TT=O({mode:Ee(ch),value:pe()}),xT=O({auth:q(b()),fields:fe(b(),TT)}),AT=O({pieceName:b(),pieceVersion:b(),actionName:b(),predefinedInput:q(xT)}),IT=O({type:se("PIECE"),toolName:b().check(fr(1)),pieceMetadata:AT}),RT=O({type:se("none")}),CT=O({type:se("access_token"),accessToken:b()}),kT=O({type:se("api_key"),apiKey:b(),apiKeyHeader:b()}),OT=O({type:se("headers"),headers:fe(b(),b())}),$T=_o("type",[RT,CT,kT,OT]),lh=O({type:se("FLOW"),toolName:b().check(fr(1)),externalFlowId:b(),flowDisplayName:q(b())}),dh=O({type:se("MCP"),toolName:b().check(fr(1)),serverUrl:Gm(),protocol:Ee(jc),auth:$T}),ph=O({type:se("KNOWLEDGE_BASE"),toolName:b().check(fr(1)),sourceType:Ee(Dc),sourceId:b(),sourceName:b()}),zT=_o("type",[IT,lh,dh,ph]),NT=O({displayName:b(),description:q(b()),type:Ee(Uc)}),fh=O({type:se("MARKDOWN"),markdown:b()}),So={type:se("TOOL_CALL"),input:Je(fe(b(),pe())),output:q(pe()),toolName:b(),status:Ee(Mc),toolCallId:b(),startTime:b(),endTime:q(b())},KB=O(So),mh=_o("toolCallType",[O({...So,toolCallType:se("PIECE"),pieceName:b(),pieceVersion:b(),actionName:b()}),O({...So,toolCallType:se("FLOW"),displayName:b(),externalFlowId:b()}),O({...So,toolCallType:se("MCP"),displayName:b(),serverUrl:b()}),O({...So,toolCallType:se("KNOWLEDGE_BASE"),displayName:b(),sourceType:b()}),O({...So,toolCallType:se("UNKNOWN"),displayName:b()})]),DT=ye([fh,mh]);var Lc=(r=>(r.IMAGE="image",r.TEXT="text",r))(Lc||{}),Yr=O({apiKey:b()}),jT=Yr,UT=O({apiKey:b(),apiKeyHash:b()}),MT=Yr,LT=Yr,FT=Yr,BT=Yr,qT=Yr,VT=Yr,HT=Yr,hh=O({accessKeyId:b().check(fr(1)),secretAccessKey:b().check(fr(1))}),WT=O({}),GT=O({}),ZT=O({}),JT=O({}),KT=O({}),QT=O({}),gh=O({modelId:b(),modelName:b(),modelType:Ee(Lc)}),yh=O({apiKeyHeader:b(),baseUrl:b(),models:ge(gh),defaultHeaders:q(fe(b(),b()))}),_h=O({accountId:b(),gatewayId:b(),models:ge(gh),vertexProject:q(b()),vertexRegion:q(b())}),bh=O({resourceName:b(),apiVersion:_n(yn(t=>typeof t=="string"&&t.trim().length===0?void 0:t),q(b()))}),vh=O({region:b().check(fr(1))}),YT=ye([jT,FT,BT,qT,VT,LT,MT,UT,hh,HT]),Eh=ye([yh,_h,bh,vh,WT,ZT,JT,KT,GT,QT]),XT=O({id:b(),name:b(),type:Ee(Lc)}),ex=O({id:b(),name:b(),provider:Ee(Oi),config:Eh,enabledForChat:Ue()}),tx=O({provider:Ee(Oi),config:Eh,auth:YT,platformId:b()});var eq={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"};var rx=O({base64Url:b(),fileName:b(),extension:q(b())}),nx=O({mimeType:b(),url:b(),fileName:q(b())}),Fc=ye([rx,nx]);var ox=ye([O({type:se("file"),value:Fc}),O({type:se("markdown"),value:b(),files:q(ge(Fc))})]),ix=O({sessionId:b(),message:b(),files:q(ge(b()))});var Ph=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(Ph||{}),wh=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(wh||{}),Bc=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(Bc||{});var ax=ye([O({...tr,name:b(),externalId:b(),type:se("STATIC_DROPDOWN"),tableId:b(),projectId:b(),data:O({options:ge(O({value:b()}))})}),O({...tr,name:b(),externalId:b(),type:ye([se("TEXT"),se("NUMBER"),se("DATE")]),tableId:b(),projectId:b()})]),sx=O({...tr,name:b(),folderId:Je(b()),projectId:b(),externalId:b(),status:Nc(wh),trigger:Nc(Ph)}),ux=O({...tr,tableId:b(),projectId:b(),cells:fe(b(),O({updated:b(),created:b(),value:pe(),fieldName:b()}))}),cx=O({events:ge(Ee(Bc)),webhookUrl:b(),flowId:b()}),lx=O({fields:ge(O({id:b(),name:b()})),rows:ge(fe(b(),b())),name:b()}),dx=O({projectId:b(),limit:q(Ei.number()),cursor:q(b()),name:q(b()),externalIds:os(b()),folderId:q(b()),folderIds:os(b())}),px=O({records:ge(ge(O({fieldId:b(),value:xh()}))),tableId:b()}),fx=O({cells:q(ge(O({fieldId:b(),value:xh()}))),tableId:b(),agentUpdate:q(Ue())}),Th=_o("operator",[Mn("eq"),Mn("neq"),Mn("gt"),Mn("gte"),Mn("lt"),Mn("lte"),Mn("co"),Sh("exists"),Sh("not_exists")]),mx=O({tableId:b(),limit:q(Ei.number()),cursor:q(b()),filters:os(Th)});function xh(){return _n(yn(t=>t==null?t:String(t)),vi(b()))}o(xh,"coerceToString");function Mn(t){return O({fieldId:b(),operator:se(t),value:b()})}o(Mn,"valueFilter");function Sh(t){return O({fieldId:b(),operator:se(t)})}o(Sh,"existenceFilter");var hx=O({status:q(Tt()),body:q(pe()),headers:q(fe(b(),b()))}),gx=O({...tr,deleted:Je(bn),ownerId:b(),displayName:b(),platformId:b(),externalId:Je(b())});var Ah=O({name:b(),description:q(b()),type:b(),required:Ue()}),yx=O({pieceName:b(),triggerName:b(),input:O({toolName:b(),toolDescription:b(),inputSchema:ge(Ah),returnsResponse:Ue()})});var Ih="^[0-9]+\\.[0-9]+\\.[0-9]+$",bq=new RegExp(Ih),bx="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",vq=b().check(gn(new RegExp(Ih))),Eq=b().check(gn(new RegExp(bx))),vx=O({packageType:se("ARCHIVE"),pieceType:Ee(bo),pieceName:b(),pieceVersion:b(),archiveId:b(),platformId:b()}),Rh=O({packageType:se("REGISTRY"),pieceType:se("OFFICIAL"),pieceName:b(),pieceVersion:b()}),Ch=O({packageType:se("REGISTRY"),pieceType:se("CUSTOM"),pieceName:b(),pieceVersion:b(),platformId:b()}),Sq=ye([Rh,Ch]),Pq=ye([vx,Rh,Ch]),kh=(e=>(e.CRON_EXPRESSION="CRON_EXPRESSION",e))(kh||{}),Ex=O({type:Ee(kh),cronExpression:b(),timezone:b()}),wq=O({...tr,type:Ee(mr),projectId:b(),flowId:b(),triggerName:b(),schedule:Je(Ex),flowVersionId:b(),pieceName:b(),pieceVersion:b(),deleted:Je(b()),simulate:Ue()}),Oh=(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))(Oh||{}),$h=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))($h||{}),zh=(r=>(r.S3="S3",r.DB="DB",r))(zh||{}),Tq=O({...tr,projectId:Je(b()),platformId:Je(b()),type:Ee(Oh),compression:Ee($h),data:q(pe()),location:Ee(zh),size:Je(Tt()),fileName:Je(b()),s3Key:Je(b()),metadata:Je(fe(b(),b()))}),Nh=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(Nh||{}),Dh=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(Dh||{}),xq=O({id:b(),email:b(),firstName:b(),status:Ee(Dh),externalId:Je(b()),platformId:Je(b()),platformRole:Ee(Nh),lastName:b(),created:bn,updated:bn,lastActiveDate:Je(bn),imageUrl:Je(b())});var Vc=O({...$e.shape,..._e(fe(b(),pe()),"OBJECT").shape});var Mh=O({...$e.shape,..._e(b(),"COLOR").shape});var Hc=ye([Lt,Zr,ts,Kr,Ft,Jr,kc,Si,Oc,Qr,Ti,Vc,xi,wi,Pi,Mh]),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 Ir=O({displayName:b(),description:q(b())});var Lh=O({username:b(),password:b()}),Wc=O({...Ir.shape,username:O({displayName:b(),description:q(b())}),password:O({displayName:b(),description:q(b())}),..._e(Lh,"BASIC_AUTH").shape});var Tx=fe(b(),ye([Lt,Zr,Qr,Kr,Ft])),Gc=O({...Ir.shape,props:Tx,..._e(pe(),"CUSTOM_AUTH").shape});var Ln=O({...Ir.shape,..._e(O({auth:b()}),"SECRET_TEXT").shape});var xx=fe(b(),ye([Lt,Zr,Ln,Qr,Kr,Ft,Jr,ts])),Fh=O({...Ir.shape,props:xx,..._e(pe(),"OIDC").shape});var Zc=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(Zc||{}),Bh=ye([Lt,Ln,Ft]),qh=fe(b(),Bh),Ax=O({props:q(fe(b(),Bh)),authUrl:b(),tokenUrl:b(),scope:ge(b()),prompt:q(ye([se("none"),se("consent"),se("login"),se("omit")])),pkce:q(Ue()),pkceMethod:q(ye([se("plain"),se("S256")])),authorizationMethod:q(Ee(Zc)),grantType:q(ye([Ee(Ii),se($c)])),extra:q(fe(b(),b()))}),Vh=O({access_token:b(),props:q(qh),data:fe(b(),bi())}),Jc=O({...Ir.shape,...Ax.shape,..._e(Vh,"OAUTH2").shape});var Po=ye([Wc,Gc,Fh,Jc,Ln]),$i="Connection",as={SecretText(t){return{...t,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(t){return{...t,valueSchema:void 0,type:"OAUTH2",displayName:t.displayName||$i}},BasicAuth(t){return{...t,valueSchema:void 0,type:"BASIC_AUTH",displayName:t.displayName||$i,required:!0}},CustomAuth(t){return{...t,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:t.displayName||$i}},OIDC(t){return{...t,valueSchema:void 0,type:"OIDC",displayName:t.displayName||$i}},None(){}};var o6={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 Ix=O({...$e.shape,..._e(pe(),"CUSTOM").shape,code:b()});var Rx=ye([Hc,Po]),Kc=fe(b(),Rx),w6=fe(b(),Hc);var Hh=ye([O({strategy:se("CRON"),cronExpression:b()}),O({strategy:se("NONE")})]),wo=class{constructor(e,r,n,i,u,c,l,p,f,m,g,S,h,_,w,E,T,k,B){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=w;this.sampleData=E;this.testStrategy=T;this.outputSchema=k;this.aiMetadata=B}static{o(this,"ITrigger")}},vn=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,gt(t.sampleData)&>(t.test)?"SIMULATION":"TEST_FUNCTION",t.outputSchema,t.aiMetadata)}},"createTrigger");var Wh="2",ss="0.82.0";var Qc=class{constructor(e,r,n,i,u,c,l,p,f=ss,m,g=""){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._actions={};this._triggers={};this.getContextInfo=o(()=>({version:Wh}),"getContextInfo");(!Cx(f)||kx(f,ss))&&(this.minimumSupportedRelease=ss),u.forEach(S=>this._actions[S.name]=S),c.forEach(S=>this._triggers[S.name]=S)}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,contextInfo:this.getContextInfo?.()}}getAction(e){return this._actions[e]}getTrigger(e){return this._triggers[e]}actions(){return this._actions}triggers(){return this._triggers}},Gh=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 Qc(t.displayName,t.logoUrl,t.authors??[],t.events,t.actions,t.triggers,t.categories??[],t.auth,t.minimumSupportedRelease,t.maximumSupportedRelease,t.description)},"createPiece");function Cx(t){return/^\d+\.\d+\.\d+$/.test(t)}o(Cx,"isValidSimpleSemver");function kx(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(kx,"isSemverLessThan");var Ox=q(fe(b(),fe(b(),b()))),Zh=O({id:q(b()),name:b(),displayName:b(),logoUrl:b(),description:b(),authors:ge(b()),platformId:q(b()),directoryPath:q(b()),auth:q(ye([Po,ge(Po)])),version:b(),categories:q(ge(Ee(vo))),minimumSupportedRelease:q(b()),maximumSupportedRelease:q(b()),i18n:Ox}),$x=Ee(["human","ai","both"]),Jh=O({description:q(b()),idempotent:q(Ue())}),Kh=O({name:b(),displayName:b(),description:b(),props:Kc,requireAuth:Ue(),errorHandlingOptions:q(Cc),outputSchema:q(Xa()),audience:q($x),aiMetadata:q(Jh)}),Qh=O({name:b(),displayName:b(),description:b(),props:Kc,errorHandlingOptions:q(Cc),type:Ee(mr),sampleData:pe(),handshakeConfiguration:q(Xa()),renewConfiguration:q(Hh),testStrategy:Ee(Ci),outputSchema:q(Xa()),aiMetadata:q(Jh)}),zx=O({...Zh.shape,actions:fe(b(),Kh),triggers:fe(b(),Qh)}),Nx=O({...Zh.shape,actions:Tt(),triggers:Tt(),suggestedActions:q(ge(Qh)),suggestedTriggers:q(ge(Kh))}),Yh=O({projectUsage:Tt(),tags:q(ge(b())),pieceType:Ee(bo),packageType:Ee(Ai),platformId:q(b()),archiveId:q(b())}),w2=O({...zx.shape,...Yh.shape}),T2=O({...Nx.shape,...Yh.shape}),x2=O({name:b(),version:b()});var Dx=ht(require("path")),jx=ht(require("fs/promises"));var us=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"};if(e.authentication&&this.populateAuthentication(e.authentication,r),e.body)switch(e.headers?.["Content-Type"]){case"text/csv":r["Content-Type"]="text/csv";break;default:r["Content-Type"]="application/json";break}return e.headers&&(r={...r,...e.headers}),r}populateAuthentication(e,r){this.authenticationConverter.convert(e,r)}};var cs=class{static{o(this,"DelegatingAuthenticationConverter")}constructor(e=new Yc,r=new Xc){this.converters={BEARER_TOKEN:e,BASIC:r}}convert(e,r){return this.converters[e.type].convert(e,r)}},Yc=class{static{o(this,"BearerTokenAuthenticationConverter")}convert(e,r){return r.Authorization=`Bearer ${e.token}`,r}},Xc=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 ls=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}}};var ds=class extends us{static{o(this,"FetchHttpClient")}constructor(e="",r=new cs){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[B,W]of Object.entries(c))i.append(B,W);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:_}=Ux(e.body,u),w=Lx({...u,...h}),E=await Mx(async()=>{let B=new AbortController,W=e.timeout&&e.timeout>0?setTimeout(()=>B.abort(),e.timeout):void 0;try{let V={method:e.method.toString(),headers:w,body:S,redirect:m?"follow":"manual",signal:B.signal};return _&&(V.duplex="half"),r?.dispatcher!==void 0&&(V.dispatcher=r.dispatcher),await fetch(p,V)}finally{W!==void 0&&clearTimeout(W)}},g),T=m?300:400;if(E.status<200||E.status>=T){let B=await Xh(E,f),W=new ls(e.body,{status:E.status,responseBody:B});throw console.error("[HttpClient#(sanitized error message)] Request failed:",W),W}let k=await Xh(E,f);return{status:E.status,headers:Fx(E.headers),body:k}}};function Ux(t,e){return qx(t)?{body:void 0,extraHeaders:{},isStream:!1}:Bx(t)?{body:t,extraHeaders:t.getHeaders(),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(Ux,"serializeBody");async function Xh(t,e){switch(e){case"arraybuffer":return Buffer.from(await t.arrayBuffer());case"blob":return await t.blob();case"text":return await t.text();case"json":default:{let r=await t.text();if(r.length===0)return;try{return JSON.parse(r)}catch{return r}}}}o(Xh,"parseResponseBody");async function Mx(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(Mx,"sendWithRetries");function eg(t){let e=Math.min(1e3*2**t,3e4);return new Promise(r=>setTimeout(r,e))}o(eg,"backoff");function Lx(t){let e={};for(let[r,n]of Object.entries(t))n!==void 0&&(e[r]=Array.isArray(n)?n.join(", "):n);return e}o(Lx,"normalizeHeaders");function Fx(t){let e={};return t.forEach((r,n)=>{e[n]=r}),e}o(Fx,"toHttpHeaders");function Bx(t){return typeof t=="object"&&t!==null&&typeof t.getHeaders=="function"&&typeof t.pipe=="function"}o(Bx,"isNodeFormData");function qx(t){return t==null}o(qx,"isNil");var Pe=new ds;var xt=(c=>(c.GET="GET",c.POST="POST",c.PATCH="PATCH",c.PUT="PUT",c.DELETE="DELETE",c.HEAD="HEAD",c))(xt||{});var CI=ht(require("fs")),a_=ht(i_());var kI={"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 OI(t){let e=t.split(";")[0].trim().toLowerCase();return kI[e]??""}o(OI,"contentTypeToExtension");var $I=o(({baseUrl:t,relativePath:e})=>{let r=t.endsWith("/")?t:`${t}/`,n=e.startsWith("/")?e.slice(1):e;return`${r}${n}`},"joinBaseUrlWithRelativePath"),zI=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 s_({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 ${
|
|
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:**
|
|
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 ${zI(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 Lp.JWT({email:e.client_email,key:e.private_key,scopes:Mp}).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 ze(t){if(t.type==="CUSTOM_AUTH"){let e=JSON.parse(t.props.serviceAccountJson),n=await new Lp.JWT({email:e.client_email,key:e.private_key,scopes:Mp}).getAccessToken();if(n.token)return n.token;throw new Error("Could not retrieve access token from service account JSON")}return t.access_token}o(ze,"getAccessToken");var qe=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 ze(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")}),ft=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 ze(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")}),mt=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 ze(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 mS(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(mS,"getTableSchema");async function ju(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(ju,"runDmlQuery");async function ri(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(ri,"waitForJobResults");var hS=rt({auth:ke,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 ze(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,w=await ri(l,e,_,i??void 0);f={...w,jobReference:{projectId:e,jobId:_}},m=w.schema?.fields??m}let g=[...f.rows??[]],S=f.pageToken;for(;S&&g.length<c;){let _=c-g.length,w=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(...w.body.rows??[]),S=w.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 s$(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(s$,"fieldToProperty");var gS=rt({auth:ke,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:ft,table_id:mt,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 ze(t),u=await mS(i,e,r,n);return Object.fromEntries(u.filter(c=>c.type!=="RECORD").map(c=>[c.name,s$(c)]))}catch{return{}}},"props")})},async run(t){let{project_id:e,dataset_id:r,table_id:n,values:i}=t.propsValue,u=await ze(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 yS=rt({auth:ke,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:ft,table_id:mt,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 ze(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 _S=rt({auth:ke,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:ft,table_id:mt,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 ze(t.auth),p=`DELETE FROM ${`\`${e}.${r}.${n}\``} WHERE ${i}`,f=await ju(c,e,p,u??void 0);return{success:!0,rows_deleted:f.deletedRowCount,job_id:f.jobId}}});var bS=rt({auth:ke,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:ft,table_id:mt,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 ze(t.auth),f=`UPDATE ${`\`${e}.${r}.${n}\``} SET ${i} WHERE ${u}`,m=await ju(l,e,f,c??void 0);return{success:!0,rows_updated:m.updatedRowCount,job_id:m.jobId}}});var vS=rt({auth:ke,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:ft,table_id:mt,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 ze(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 ri(l,e,S.jobReference.jobId,c??void 0);S={...E,jobReference:S.jobReference},h=E.schema?.fields??h}let _=Dt(h,S.rows??[]),w=_.length>0;return{found:w,...w?_[0]:{}}}});var ES=rt({auth:ke,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:ft,table_id:mt,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 ze(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 ri(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,w=`${Date.now()}-${Math.random().toString(36).slice(2,9)}`,T=(await Pe.sendRequest({method:"POST",url:`${xe}/projects/${e}/datasets/${r}/tables/${n}/insertAll`,headers:{Authorization:`Bearer ${l}`},body:{kind:"bigquery#tableDataInsertAllRequest",rows:[{insertId:w,json:_}]}})).body.insertErrors??[];if(T.length>0){let k=T[0]?.errors[0];throw new Error(`Row creation failed: ${k?.message??"Unknown error"} (reason: ${k?.reason??"unknown"})`)}return{found:!1,created:!0,insert_id:w,..._}}});var SS=rt({auth:ke,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 ze(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 PS=500;function u$(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(u$,"parseInputData");var wS=rt({auth:ke,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:ft,table_id:mt,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=u$(i);if(l.length===0)throw new Error("Data contains no rows to import.");let p=await ze(t.auth),f=Date.now(),m=0,g=0,S=[];for(let h=0;h<l.length;h+=PS){let _=l.slice(h,h+PS),w=_.map((k,B)=>({insertId:`${f}-${h+B}-${Math.random().toString(36).slice(2,9)}`,json:k})),T=(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:w}})).body.insertErrors??[];if(T.length>0&&!(u??!1)){let k=T[0]?.errors[0];throw new Error(`Import failed on row ${h+(T[0]?.index??0)}: ${k?.message??"Unknown error"}`)}m+=_.length-T.length,g+=T.length,S.push(...T.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:ft,table_id:mt,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})},Uu={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 ze(t),m=r??Date.now()-7*24*60*60*1e3,g=`\`${n}.${i}.${u}\``,S=c,h=`SELECT * FROM ${g} WHERE \`${S}\` > TIMESTAMP_MILLIS(${m}) ORDER BY \`${S}\` ASC LIMIT ${p}`,w=(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(!w.jobComplete)for(let k=0;k<30&&!w.jobComplete;k++)w=(await Pe.sendRequest({method:"GET",url:`${xe}/projects/${n}/queries/${w.jobReference.jobId}`,headers:{Authorization:`Bearer ${f}`},queryParams:{timeoutMs:"10000",maxResults:String(p)}})).body;let E=w.schema?.fields??[];return Dt(E,w.rows??[]).map(k=>{let B=k[S],W;if(typeof B=="string"){let V=parseFloat(B);W=!isNaN(V)&&V>1e9?V*1e3:new Date(B).getTime()}else typeof B=="number"?W=B>1e12?B:B*1e3:W=Date.now();return{epochMilliSeconds:W,data:k}})},"items")},TS=vn({auth:ke,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(Uu,t)},async onEnable(t){await nt.onEnable(Uu,t)},async onDisable(t){await nt.onDisable(Uu,t)},async run(t){return await nt.poll(Uu,t)}});var l$={project_id:qe,dataset_id:ft,table_id:mt,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})},Mu={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 ze(t),g=r??Date.now()-7*24*60*60*1e3,S=`\`${n}.${i}.${u}\``,h=c,_=l?` AND \`${l}\` < TIMESTAMP_MILLIS(${g})`:"",w=[`SELECT * FROM ${S}`,`WHERE \`${h}\` > TIMESTAMP_MILLIS(${g})${_}`,`ORDER BY \`${h}\` ASC`,`LIMIT ${f}`].join(" "),T=(await Pe.sendRequest({method:"POST",url:`${xe}/projects/${n}/queries`,headers:{Authorization:`Bearer ${m}`},body:{query:w,useLegacySql:!1,maxResults:f,timeoutMs:3e4}})).body;if(!T.jobComplete)for(let W=0;W<30&&!T.jobComplete;W++)T=(await Pe.sendRequest({method:"GET",url:`${xe}/projects/${n}/queries/${T.jobReference.jobId}`,headers:{Authorization:`Bearer ${m}`},queryParams:{timeoutMs:"10000",maxResults:String(f)}})).body;let k=T.schema?.fields??[];return Dt(k,T.rows??[]).map(W=>{let V=W[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:W}})},"items")},xS=vn({auth:ke,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:l$,sampleData:{id:"1",updated_at:"2024-01-15T10:30:00Z",status:"active"},type:"POLLING",async test(t){return await nt.test(Mu,t)},async onEnable(t){await nt.onEnable(Mu,t)},async onDisable(t){await nt.onDisable(Mu,t)},async run(t){return await nt.poll(Mu,t)}});var d$={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})},Lu={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 ze(t),l=(r??Date.now()-24*60*60*1e3)-60*60*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),w=[],E=[],T;do{let B=await Pe.sendRequest({method:"GET",url:`${xe}/projects/${n}/queries/${S}`,headers:{Authorization:`Bearer ${c}`},queryParams:{maxResults:String(Math.min(u-w.length,1e3)),timeoutMs:"5000",...T?{pageToken:T}:{},...h?{location:h}:{}}});B.body.schema?.fields&&(E=B.body.schema.fields),w.push(...B.body.rows??[]),T=B.body.pageToken}while(T&&w.length<u);let k=Dt(E,w.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")},AS=vn({auth:ke,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:d$,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(Lu,t)},async onEnable(t){await nt.onEnable(Lu,t)},async onDisable(t){await nt.onDisable(Lu,t)},async run(t){return await nt.poll(Lu,t)}});var p$={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})},Fu={strategy:0,items:o(async({auth:t,propsValue:e,lastFetchEpochMS:r})=>{let{project_id:n,include_failed:i}=e,u=await ze(t),c=(r??Date.now()-24*60*60*1e3)-60*60*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")},IS=vn({auth:ke,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:p$,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(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 f$=Gh({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:[hS,gS,yS,_S,bS,vS,ES,SS,wS,s_({baseUrl:o(()=>xe,"baseUrl"),auth:ke,authMapping:o(async t=>({Authorization:`Bearer ${await ze(t)}`}),"authMapping")})],triggers:[TS,xS,AS,IS]});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 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});
|
|
67
67
|
/*! Bundled license information:
|
|
68
68
|
|
|
69
69
|
mime-types/index.js:
|