From e6a3df8c6a4b098a52bd5afc23ed6a844273a02b Mon Sep 17 00:00:00 2001 From: elrrrrrrr Date: Thu, 18 Jun 2026 14:28:24 +0800 Subject: [PATCH] fix: strip trailing slash from registry URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default registry input was `https://registry.npmjs.org/` (trailing slash) and was passed verbatim to `ut config set registry`. utoo joins URLs as `{registry}/{pkg}`, producing `//`, which npm's registry rejects with HTTP 406 Not Acceptable — breaking dependency resolution. Drop the trailing slash from the default and normalize any caller-supplied trailing slashes in the action before use. Co-Authored-By: Claude Opus 4.8 (1M context) --- action.yml | 2 +- dist/setup/index.js | 2 +- src/action.ts | 5 ++++- src/index.ts | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index b0ac576..39bca83 100644 --- a/action.yml +++ b/action.yml @@ -14,7 +14,7 @@ inputs: registry: description: The URL of the npm registry to use for installing Utoo. required: false - default: https://registry.npmjs.org/ + default: https://registry.npmjs.org cache-store: required: false type: boolean diff --git a/dist/setup/index.js b/dist/setup/index.js index 9474015..2f45e15 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -127,7 +127,7 @@ More info on storage limits: https://docs.github.com/en/billing/managing-billing Other caches with similar key:`);for(let A of s?.artifactCaches||[])bn.debug(`Cache Key: ${A?.cacheKey}, Cache Version: ${A?.cacheVersion}, Cache Scope: ${A?.scope}, Cache Created: ${A?.creationTime}`)}}})}o(Tfe,"printCachesListForDiagnostics");function kfe(t,e,r){return an(this,void 0,void 0,function*(){let n=new Rfe.URL(t),i=(0,$R.getDownloadOptions)(r);n.hostname.endsWith(".blob.core.windows.net")?i.useAzureSdk?yield(0,Yy.downloadCacheStorageSDK)(t,e,i):i.concurrentBlobDownloads?yield(0,Yy.downloadCacheHttpClientConcurrent)(t,e,i):yield(0,Yy.downloadCacheHttpClient)(t,e):yield(0,Yy.downloadCacheHttpClient)(t,e)})}o(kfe,"downloadCache");or.downloadCache=kfe;function Lfe(t,e,r){return an(this,void 0,void 0,function*(){let n=ZR(),i=$c.getCacheVersion(e,r?.compressionMethod,r?.enableCrossOsArchive),s={key:t,version:i,cacheSize:r?.cacheSize};return yield(0,Co.retryTypedResponse)("reserveCache",()=>an(this,void 0,void 0,function*(){return n.postJson(Pd("caches"),s)}))})}o(Lfe,"reserveCache");or.reserveCache=Lfe;function Kz(t,e){return`bytes ${t}-${e}/*`}o(Kz,"getContentRange");function Mfe(t,e,r,n,i){return an(this,void 0,void 0,function*(){bn.debug(`Uploading chunk of size ${i-n+1} bytes at offset ${n} with content range: ${Kz(n,i)}`);let s={"Content-Type":"application/octet-stream","Content-Range":Kz(n,i)},a=yield(0,Co.retryHttpClientResponse)(`uploadChunk (start: ${n}, end: ${i})`,()=>an(this,void 0,void 0,function*(){return t.sendStream("PATCH",e,r(),s)}));if(!(0,Co.isSuccessStatusCode)(a.message.statusCode))throw new Error(`Cache service responded with ${a.message.statusCode} during upload chunk.`)})}o(Mfe,"uploadChunk");function Ofe(t,e,r,n){return an(this,void 0,void 0,function*(){let i=$c.getArchiveFileSizeInBytes(r),s=Pd(`caches/${e.toString()}`),a=KR.openSync(r,"r"),A=(0,$R.getUploadOptions)(n),c=$c.assertDefined("uploadConcurrency",A.uploadConcurrency),l=$c.assertDefined("uploadChunkSize",A.uploadChunkSize),u=[...new Array(c).keys()];bn.debug("Awaiting all uploads");let d=0;try{yield Promise.all(u.map(()=>an(this,void 0,void 0,function*(){for(;dKR.createReadStream(r,{fd:a,start:p,end:C,autoClose:!1}).on("error",I=>{throw new Error(`Cache upload failed because file read failed with ${I.message}`)}),p,C)}})))}finally{KR.closeSync(a)}})}o(Ofe,"uploadFile");function Ffe(t,e,r){return an(this,void 0,void 0,function*(){let n={size:r};return yield(0,Co.retryTypedResponse)("commitCache",()=>an(this,void 0,void 0,function*(){return t.postJson(Pd(`caches/${e.toString()}`),n)}))})}o(Ffe,"commitCache");function Ufe(t,e,r,n){return an(this,void 0,void 0,function*(){if((0,$R.getUploadOptions)(n).useAzureSdk){if(!r)throw new Error("Azure Storage SDK can only be used when a signed URL is provided.");yield(0,Sfe.uploadCacheArchiveSDK)(r,e,n)}else{let s=ZR();bn.debug("Upload cache"),yield Ofe(s,t,e,n),bn.debug("Commiting cache");let a=$c.getArchiveFileSizeInBytes(e);bn.info(`Cache Size: ~${Math.round(a/(1024*1024))} MB (${a} B)`);let A=yield Ffe(s,t,a);if(!(0,Co.isSuccessStatusCode)(A.statusCode))throw new Error(`Cache service responded with ${A.statusCode} during commit cache.`);bn.info("Cache saved successfully")}})}o(Ufe,"saveCache");or.saveCache=Ufe});var Jy=m(Zc=>{"use strict";Object.defineProperty(Zc,"__esModule",{value:!0});Zc.isJsonObject=Zc.typeofJsonValue=void 0;function qfe(t){let e=typeof t;if(e=="object"){if(Array.isArray(t))return"array";if(t===null)return"null"}return e}o(qfe,"typeofJsonValue");Zc.typeofJsonValue=qfe;function Hfe(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}o(Hfe,"isJsonObject");Zc.isJsonObject=Hfe});var Wy=m(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.base64encode=el.base64decode=void 0;var Es="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Vy=[];for(let t=0;t>4,a=s,i=2;break;case 2:r[n++]=(a&15)<<4|(s&60)>>2,a=s,i=3;break;case 3:r[n++]=(a&3)<<6|s,i=0;break}}if(i==1)throw Error("invalid base64 string.");return r.subarray(0,n)}o(zfe,"base64decode");el.base64decode=zfe;function Gfe(t){let e="",r=0,n,i=0;for(let s=0;s>2],i=(n&3)<<4,r=1;break;case 1:e+=Es[i|n>>4],i=(n&15)<<2,r=2;break;case 2:e+=Es[i|n>>6],e+=Es[n&63],r=0;break}return r&&(e+=Es[i],e+="=",r==1&&(e+="=")),e}o(Gfe,"base64encode");el.base64encode=Gfe});var $z=m(Ky=>{"use strict";Object.defineProperty(Ky,"__esModule",{value:!0});Ky.utf8read=void 0;var eS=o(t=>String.fromCharCode.apply(String,t),"fromCharCodes");function jfe(t){if(t.length<1)return"";let e=0,r=[],n=[],i=0,s,a=t.length;for(;e191&&s<224?n[i++]=(s&31)<<6|t[e++]&63:s>239&&s<365?(s=((s&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,n[i++]=55296+(s>>10),n[i++]=56320+(s&1023)):n[i++]=(s&15)<<12|(t[e++]&63)<<6|t[e++]&63,i>8191&&(r.push(eS(n)),i=0);return r.length?(i&&r.push(eS(n.slice(0,i))),r.join("")):eS(n.slice(0,i))}o(jfe,"utf8read");Ky.utf8read=jfe});var Dd=m(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});ji.WireType=ji.mergeBinaryOptions=ji.UnknownFieldHandler=void 0;var Yfe;(function(t){t.symbol=Symbol.for("protobuf-ts/unknown"),t.onRead=(r,n,i,s,a)=>{(e(n)?n[t.symbol]:n[t.symbol]=[]).push({no:i,wireType:s,data:a})},t.onWrite=(r,n,i)=>{for(let{no:s,wireType:a,data:A}of t.list(n))i.tag(s,a).raw(A)},t.list=(r,n)=>{if(e(r)){let i=r[t.symbol];return n?i.filter(s=>s.no==n):i}return[]},t.last=(r,n)=>t.list(r,n).slice(-1)[0];let e=o(r=>r&&Array.isArray(r[t.symbol]),"is")})(Yfe=ji.UnknownFieldHandler||(ji.UnknownFieldHandler={}));function Jfe(t,e){return Object.assign(Object.assign({},t),e)}o(Jfe,"mergeBinaryOptions");ji.mergeBinaryOptions=Jfe;var Vfe;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(Vfe=ji.WireType||(ji.WireType={}))});var $y=m(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.varint32read=An.varint32write=An.int64toString=An.int64fromString=An.varint64write=An.varint64read=void 0;function Wfe(){let t=0,e=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(t|=(i&127)<>4,!(r&128))return this.assertBounds(),[t,e];for(let n=3;n<=31;n+=7){let i=this.buf[this.pos++];if(e|=(i&127)<>>s,A=!(!(a>>>7)&&e==0),c=(A?a|128:a)&255;if(r.push(c),!A)return}let n=t>>>28&15|(e&7)<<4,i=!!(e>>3);if(r.push((i?n|128:n)&255),!!i){for(let s=3;s<31;s=s+7){let a=e>>>s,A=!!(a>>>7),c=(A?a|128:a)&255;if(r.push(c),!A)return}r.push(e>>>31&1)}}o(Kfe,"varint64write");An.varint64write=Kfe;var Xy=65536*65536;function Xfe(t){let e=t[0]=="-";e&&(t=t.slice(1));let r=1e6,n=0,i=0;function s(a,A){let c=Number(t.slice(a,A));i*=r,n=n*r+c,n>=Xy&&(i=i+(n/Xy|0),n=n%Xy)}return o(s,"add1e6digit"),s(-24,-18),s(-18,-12),s(-12,-6),s(-6),[e,n,i]}o(Xfe,"int64fromString");An.int64fromString=Xfe;function $fe(t,e){if(e>>>0<=2097151)return""+(Xy*e+(t>>>0));let r=t&16777215,n=(t>>>24|e<<8)>>>0&16777215,i=e>>16&65535,s=r+n*6777216+i*6710656,a=n+i*8147497,A=i*2,c=1e7;s>=c&&(a+=Math.floor(s/c),s%=c),a>=c&&(A+=Math.floor(a/c),a%=c);function l(u,d){let g=u?String(u):"";return d?"0000000".slice(g.length)+g:g}return o(l,"decimalFrom1e7"),l(A,0)+l(a,A)+l(s,1)}o($fe,"int64toString");An.int64toString=$fe;function Zfe(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let r=0;r<9;r++)e.push(t&127|128),t=t>>7;e.push(1)}}o(Zfe,"varint32write");An.varint32write=Zfe;function epe(){let t=this.buf[this.pos++],e=t&127;if(!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,!(t&128))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let r=5;t&128&&r<10;r++)t=this.buf[this.pos++];if(t&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}o(epe,"varint32read");An.varint32read=epe});var Io=m(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.PbLong=Bo.PbULong=Bo.detectBi=void 0;var _d=$y(),Ze;function Zz(){let t=new DataView(new ArrayBuffer(8));Ze=globalThis.BigInt!==void 0&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:t}:void 0}o(Zz,"detectBi");Bo.detectBi=Zz;Zz();function eG(t){if(!t)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}o(eG,"assertBi");var tG=/^-?[0-9]+$/,eE=4294967296,Zy=2147483648,tE=class{static{o(this,"SharedPbLong")}constructor(e,r){this.lo=e|0,this.hi=r|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*eE+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}},vd=class t extends tE{static{o(this,"PbULong")}static from(e){if(Ze)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=Ze.C(e);case"number":if(e===0)return this.ZERO;e=Ze.C(e);case"bigint":if(!e)return this.ZERO;if(eZe.UMAX)throw new Error("ulong too large");return Ze.V.setBigUint64(0,e,!0),new t(Ze.V.getInt32(0,!0),Ze.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!tG.test(e))throw new Error("string is no integer");let[r,n,i]=_d.int64fromString(e);if(r)throw new Error("signed value for ulong");return new t(n,i);case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new t(e,e/eE)}throw new Error("unknown value "+typeof e)}toString(){return Ze?this.toBigInt().toString():_d.int64toString(this.lo,this.hi)}toBigInt(){return eG(Ze),Ze.V.setInt32(0,this.lo,!0),Ze.V.setInt32(4,this.hi,!0),Ze.V.getBigUint64(0,!0)}};Bo.PbULong=vd;vd.ZERO=new vd(0,0);var Td=class t extends tE{static{o(this,"PbLong")}static from(e){if(Ze)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=Ze.C(e);case"number":if(e===0)return this.ZERO;e=Ze.C(e);case"bigint":if(!e)return this.ZERO;if(eZe.MAX)throw new Error("signed long too large");return Ze.V.setBigInt64(0,e,!0),new t(Ze.V.getInt32(0,!0),Ze.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!tG.test(e))throw new Error("string is no integer");let[r,n,i]=_d.int64fromString(e);if(r){if(i>Zy||i==Zy&&n!=0)throw new Error("signed long too small")}else if(i>=Zy)throw new Error("signed long too large");let s=new t(n,i);return r?s.negate():s;case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new t(e,e/eE):new t(-e,-e/eE).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&Zy)!==0}negate(){let e=~this.hi,r=this.lo;return r?r=~r+1:e+=1,new t(r,e)}toString(){if(Ze)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+_d.int64toString(e.lo,e.hi)}return _d.int64toString(this.lo,this.hi)}toBigInt(){return eG(Ze),Ze.V.setInt32(0,this.lo,!0),Ze.V.setInt32(4,this.hi,!0),Ze.V.getBigInt64(0,!0)}};Bo.PbLong=Td;Td.ZERO=new Td(0,0)});var tS=m(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.BinaryReader=rl.binaryReadOptions=void 0;var tl=Dd(),kd=Io(),rG=$y(),nG={readUnknownField:!0,readerFactory:t=>new rE(t)};function tpe(t){return t?Object.assign(Object.assign({},nG),t):nG}o(tpe,"binaryReadOptions");rl.binaryReadOptions=tpe;var rE=class{static{o(this,"BinaryReader")}constructor(e,r){this.varint64=rG.varint64read,this.uint32=rG.varint32read,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=r??new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),r=e>>>3,n=e&7;if(r<=0||n<0||n>5)throw new Error("illegal tag: field no "+r+" wire type "+n);return[r,n]}skip(e){let r=this.pos;switch(e){case tl.WireType.Varint:for(;this.buf[this.pos++]&128;);break;case tl.WireType.Bit64:this.pos+=4;case tl.WireType.Bit32:this.pos+=4;break;case tl.WireType.LengthDelimited:let n=this.uint32();this.pos+=n;break;case tl.WireType.StartGroup:let i;for(;(i=this.tag()[1])!==tl.WireType.EndGroup;)this.skip(i);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new kd.PbLong(...this.varint64())}uint64(){return new kd.PbULong(...this.varint64())}sint64(){let[e,r]=this.varint64(),n=-(e&1);return e=(e>>>1|(r&1)<<31)^n,r=r>>>1^n,new kd.PbLong(e,r)}bool(){let[e,r]=this.varint64();return e!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new kd.PbULong(this.sfixed32(),this.sfixed32())}sfixed64(){return new kd.PbLong(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),r=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(r,r+e)}string(){return this.textDecoder.decode(this.bytes())}};rl.BinaryReader=rE});var nl=m(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.assertFloat32=Wn.assertUInt32=Wn.assertInt32=Wn.assertNever=Wn.assert=void 0;function rpe(t,e){if(!t)throw new Error(e)}o(rpe,"assert");Wn.assert=rpe;function npe(t,e){throw new Error(e??"Unexpected object: "+t)}o(npe,"assertNever");Wn.assertNever=npe;var ipe=34028234663852886e22,spe=-34028234663852886e22,ope=4294967295,ape=2147483647,Ape=-2147483648;function cpe(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>ape||tope||t<0)throw new Error("invalid uint 32: "+t)}o(lpe,"assertUInt32");Wn.assertUInt32=lpe;function upe(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>ipe||t{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.BinaryWriter=sl.binaryWriteOptions=void 0;var Ld=Io(),Md=$y(),il=nl(),iG={writeUnknownFields:!0,writerFactory:()=>new nE};function dpe(t){return t?Object.assign(Object.assign({},iG),t):iG}o(dpe,"binaryWriteOptions");sl.binaryWriteOptions=dpe;var nE=class{static{o(this,"BinaryWriter")}constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(il.assertUInt32(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return il.assertInt32(e),Md.varint32write(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let r=this.textEncoder.encode(e);return this.uint32(r.byteLength),this.raw(r)}float(e){il.assertFloat32(e);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,e,!0),this.raw(r)}double(e){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,e,!0),this.raw(r)}fixed32(e){il.assertUInt32(e);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e,!0),this.raw(r)}sfixed32(e){il.assertInt32(e);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,e,!0),this.raw(r)}sint32(e){return il.assertInt32(e),e=(e<<1^e>>31)>>>0,Md.varint32write(e,this.buf),this}sfixed64(e){let r=new Uint8Array(8),n=new DataView(r.buffer),i=Ld.PbLong.from(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(r)}fixed64(e){let r=new Uint8Array(8),n=new DataView(r.buffer),i=Ld.PbULong.from(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(r)}int64(e){let r=Ld.PbLong.from(e);return Md.varint64write(r.lo,r.hi,this.buf),this}sint64(e){let r=Ld.PbLong.from(e),n=r.hi>>31,i=r.lo<<1^n,s=(r.hi<<1|r.lo>>>31)^n;return Md.varint64write(i,s,this.buf),this}uint64(e){let r=Ld.PbULong.from(e);return Md.varint64write(r.lo,r.hi,this.buf),this}};sl.BinaryWriter=nE});var nS=m(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.mergeJsonOptions=Qo.jsonWriteOptions=Qo.jsonReadOptions=void 0;var sG={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},oG={ignoreUnknownFields:!1};function gpe(t){return t?Object.assign(Object.assign({},oG),t):oG}o(gpe,"jsonReadOptions");Qo.jsonReadOptions=gpe;function mpe(t){return t?Object.assign(Object.assign({},sG),t):sG}o(mpe,"jsonWriteOptions");Qo.jsonWriteOptions=mpe;function hpe(t,e){var r,n;let i=Object.assign(Object.assign({},t),e);return i.typeRegistry=[...(r=t?.typeRegistry)!==null&&r!==void 0?r:[],...(n=e?.typeRegistry)!==null&&n!==void 0?n:[]],i}o(hpe,"mergeJsonOptions");Qo.mergeJsonOptions=hpe});var Od=m(iE=>{"use strict";Object.defineProperty(iE,"__esModule",{value:!0});iE.MESSAGE_TYPE=void 0;iE.MESSAGE_TYPE=Symbol.for("protobuf-ts/message-type")});var iS=m(sE=>{"use strict";Object.defineProperty(sE,"__esModule",{value:!0});sE.lowerCamelCase=void 0;function fpe(t){let e=!1,r=[];for(let n=0;n{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.readMessageOption=Wt.readFieldOption=Wt.readFieldOptions=Wt.normalizeFieldInfo=Wt.RepeatType=Wt.LongType=Wt.ScalarType=void 0;var aG=iS(),ppe;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(ppe=Wt.ScalarType||(Wt.ScalarType={}));var ype;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER"})(ype=Wt.LongType||(Wt.LongType={}));var AG;(function(t){t[t.NO=0]="NO",t[t.PACKED=1]="PACKED",t[t.UNPACKED=2]="UNPACKED"})(AG=Wt.RepeatType||(Wt.RepeatType={}));function Epe(t){var e,r,n,i;return t.localName=(e=t.localName)!==null&&e!==void 0?e:aG.lowerCamelCase(t.name),t.jsonName=(r=t.jsonName)!==null&&r!==void 0?r:aG.lowerCamelCase(t.name),t.repeat=(n=t.repeat)!==null&&n!==void 0?n:AG.NO,t.opt=(i=t.opt)!==null&&i!==void 0?i:t.repeat||t.oneof?!1:t.kind=="message",t}o(Epe,"normalizeFieldInfo");Wt.normalizeFieldInfo=Epe;function Cpe(t,e,r,n){var i;let s=(i=t.fields.find((a,A)=>a.localName==e||A==e))===null||i===void 0?void 0:i.options;return s&&s[r]?n.fromJson(s[r]):void 0}o(Cpe,"readFieldOptions");Wt.readFieldOptions=Cpe;function Bpe(t,e,r,n){var i;let s=(i=t.fields.find((A,c)=>A.localName==e||c==e))===null||i===void 0?void 0:i.options;if(!s)return;let a=s[r];return a===void 0?a:n?n.fromJson(a):a}o(Bpe,"readFieldOption");Wt.readFieldOption=Bpe;function Ipe(t,e,r){let i=t.options[e];return i===void 0?i:r?r.fromJson(i):i}o(Ipe,"readMessageOption");Wt.readMessageOption=Ipe});var sS=m(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.getSelectedOneofValue=cn.clearOneofValue=cn.setUnknownOneofValue=cn.setOneofValue=cn.getOneofValue=cn.isOneofGroup=void 0;function Qpe(t){if(typeof t!="object"||t===null||!t.hasOwnProperty("oneofKind"))return!1;switch(typeof t.oneofKind){case"string":return t[t.oneofKind]===void 0?!1:Object.keys(t).length==2;case"undefined":return Object.keys(t).length==1;default:return!1}}o(Qpe,"isOneofGroup");cn.isOneofGroup=Qpe;function bpe(t,e){return t[e]}o(bpe,"getOneofValue");cn.getOneofValue=bpe;function Npe(t,e,r){t.oneofKind!==void 0&&delete t[t.oneofKind],t.oneofKind=e,r!==void 0&&(t[e]=r)}o(Npe,"setOneofValue");cn.setOneofValue=Npe;function xpe(t,e,r){t.oneofKind!==void 0&&delete t[t.oneofKind],t.oneofKind=e,r!==void 0&&e!==void 0&&(t[e]=r)}o(xpe,"setUnknownOneofValue");cn.setUnknownOneofValue=xpe;function Rpe(t){t.oneofKind!==void 0&&delete t[t.oneofKind],t.oneofKind=void 0}o(Rpe,"clearOneofValue");cn.clearOneofValue=Rpe;function Spe(t){if(t.oneofKind!==void 0)return t[t.oneofKind]}o(Spe,"getSelectedOneofValue");cn.getSelectedOneofValue=Spe});var aS=m(oE=>{"use strict";Object.defineProperty(oE,"__esModule",{value:!0});oE.ReflectionTypeCheck=void 0;var Pt=di(),wpe=sS(),oS=class{static{o(this,"ReflectionTypeCheck")}constructor(e){var r;this.fields=(r=e.fields)!==null&&r!==void 0?r:[]}prepare(){if(this.data)return;let e=[],r=[],n=[];for(let i of this.fields)if(i.oneof)n.includes(i.oneof)||(n.push(i.oneof),e.push(i.oneof),r.push(i.oneof));else switch(r.push(i.localName),i.kind){case"scalar":case"enum":(!i.opt||i.repeat)&&e.push(i.localName);break;case"message":i.repeat&&e.push(i.localName);break;case"map":e.push(i.localName);break}this.data={req:e,known:r,oneofs:Object.values(n)}}is(e,r,n=!1){if(r<0)return!0;if(e==null||typeof e!="object")return!1;this.prepare();let i=Object.keys(e),s=this.data;if(i.length!i.includes(a))||!n&&i.some(a=>!s.known.includes(a)))return!1;if(r<1)return!0;for(let a of s.oneofs){let A=e[a];if(!wpe.isOneofGroup(A))return!1;if(A.oneofKind===void 0)continue;let c=this.fields.find(l=>l.localName===A.oneofKind);if(!c||!this.field(A[A.oneofKind],c,n,r))return!1}for(let a of this.fields)if(a.oneof===void 0&&!this.field(e[a.localName],a,n,r))return!1;return!0}field(e,r,n,i){let s=r.repeat;switch(r.kind){case"scalar":return e===void 0?r.opt:s?this.scalars(e,r.T,i,r.L):this.scalar(e,r.T,r.L);case"enum":return e===void 0?r.opt:s?this.scalars(e,Pt.ScalarType.INT32,i):this.scalar(e,Pt.ScalarType.INT32);case"message":return e===void 0?!0:s?this.messages(e,r.T(),n,i):this.message(e,r.T(),n,i);case"map":if(typeof e!="object"||e===null)return!1;if(i<2)return!0;if(!this.mapKeys(e,r.K,i))return!1;switch(r.V.kind){case"scalar":return this.scalars(Object.values(e),r.V.T,i,r.V.L);case"enum":return this.scalars(Object.values(e),Pt.ScalarType.INT32,i);case"message":return this.messages(Object.values(e),r.V.T(),n,i)}break}return!0}message(e,r,n,i){return n?r.isAssignable(e,i):r.is(e,i)}messages(e,r,n,i){if(!Array.isArray(e))return!1;if(i<2)return!0;if(n){for(let s=0;sparseInt(s)),r,n);case Pt.ScalarType.BOOL:return this.scalars(i.slice(0,n).map(s=>s=="true"?!0:s=="false"?!1:s),r,n);default:return this.scalars(i,r,n,Pt.LongType.STRING)}}};oE.ReflectionTypeCheck=oS});var AE=m(aE=>{"use strict";Object.defineProperty(aE,"__esModule",{value:!0});aE.reflectionLongConvert=void 0;var cG=di();function Ppe(t,e){switch(e){case cG.LongType.BIGINT:return t.toBigInt();case cG.LongType.NUMBER:return t.toNumber();default:return t.toString()}}o(Ppe,"reflectionLongConvert");aE.reflectionLongConvert=Ppe});var cS=m(uE=>{"use strict";Object.defineProperty(uE,"__esModule",{value:!0});uE.ReflectionJsonReader=void 0;var lG=Jy(),Dpe=Wy(),Kt=di(),cE=Io(),Ia=nl(),lE=AE(),AS=class{static{o(this,"ReflectionJsonReader")}constructor(e){this.info=e}prepare(){var e;if(this.fMap===void 0){this.fMap={};let r=(e=this.info.fields)!==null&&e!==void 0?e:[];for(let n of r)this.fMap[n.name]=n,this.fMap[n.jsonName]=n,this.fMap[n.localName]=n}}assert(e,r,n){if(!e){let i=lG.typeofJsonValue(n);throw(i=="number"||i=="boolean")&&(i=n.toString()),new Error(`Cannot parse JSON ${i} for ${this.info.typeName}#${r}`)}}read(e,r,n){this.prepare();let i=[];for(let[s,a]of Object.entries(e)){let A=this.fMap[s];if(!A){if(!n.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${s}`);continue}let c=A.localName,l;if(A.oneof){if(a===null&&(A.kind!=="enum"||A.T()[0]!=="google.protobuf.NullValue"))continue;if(i.includes(A.oneof))throw new Error(`Multiple members of the oneof group "${A.oneof}" of ${this.info.typeName} are present in JSON.`);i.push(A.oneof),l=r[A.oneof]={oneofKind:c}}else l=r;if(A.kind=="map"){if(a===null)continue;this.assert(lG.isJsonObject(a),A.name,a);let u=l[c];for(let[d,g]of Object.entries(a)){this.assert(g!==null,A.name+" map value",null);let p;switch(A.V.kind){case"message":p=A.V.T().internalJsonRead(g,n);break;case"enum":if(p=this.enum(A.V.T(),g,A.name,n.ignoreUnknownFields),p===!1)continue;break;case"scalar":p=this.scalar(g,A.V.T,A.V.L,A.name);break}this.assert(p!==void 0,A.name+" map value",g);let C=d;A.K==Kt.ScalarType.BOOL&&(C=C=="true"?!0:C=="false"?!1:C),C=this.scalar(C,A.K,Kt.LongType.STRING,A.name).toString(),u[C]=p}}else if(A.repeat){if(a===null)continue;this.assert(Array.isArray(a),A.name,a);let u=l[c];for(let d of a){this.assert(d!==null,A.name,null);let g;switch(A.kind){case"message":g=A.T().internalJsonRead(d,n);break;case"enum":if(g=this.enum(A.T(),d,A.name,n.ignoreUnknownFields),g===!1)continue;break;case"scalar":g=this.scalar(d,A.T,A.L,A.name);break}this.assert(g!==void 0,A.name,a),u.push(g)}}else switch(A.kind){case"message":if(a===null&&A.T().typeName!="google.protobuf.Value"){this.assert(A.oneof===void 0,A.name+" (oneof member)",null);continue}l[c]=A.T().internalJsonRead(a,n,l[c]);break;case"enum":if(a===null)continue;let u=this.enum(A.T(),a,A.name,n.ignoreUnknownFields);if(u===!1)continue;l[c]=u;break;case"scalar":if(a===null)continue;l[c]=this.scalar(a,A.T,A.L,A.name);break}}}enum(e,r,n,i){if(e[0]=="google.protobuf.NullValue"&&Ia.assert(r===null||r==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`),r===null)return 0;switch(typeof r){case"number":return Ia.assert(Number.isInteger(r),`Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${r}.`),r;case"string":let s=r;e[2]&&r.substring(0,e[2].length)===e[2]&&(s=r.substring(e[2].length));let a=e[1][s];return typeof a>"u"&&i?!1:(Ia.assert(typeof a=="number",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${r}".`),a)}Ia.assert(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof r}".`)}scalar(e,r,n,i){let s;try{switch(r){case Kt.ScalarType.DOUBLE:case Kt.ScalarType.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""){s="empty string";break}if(typeof e=="string"&&e.trim().length!==e.length){s="extra whitespace";break}if(typeof e!="string"&&typeof e!="number")break;let a=Number(e);if(Number.isNaN(a)){s="not a number";break}if(!Number.isFinite(a)){s="too large or small";break}return r==Kt.ScalarType.FLOAT&&Ia.assertFloat32(a),a;case Kt.ScalarType.INT32:case Kt.ScalarType.FIXED32:case Kt.ScalarType.SFIXED32:case Kt.ScalarType.SINT32:case Kt.ScalarType.UINT32:if(e===null)return 0;let A;if(typeof e=="number"?A=e:e===""?s="empty string":typeof e=="string"&&(e.trim().length!==e.length?s="extra whitespace":A=Number(e)),A===void 0)break;return r==Kt.ScalarType.UINT32?Ia.assertUInt32(A):Ia.assertInt32(A),A;case Kt.ScalarType.INT64:case Kt.ScalarType.SFIXED64:case Kt.ScalarType.SINT64:if(e===null)return lE.reflectionLongConvert(cE.PbLong.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return lE.reflectionLongConvert(cE.PbLong.from(e),n);case Kt.ScalarType.FIXED64:case Kt.ScalarType.UINT64:if(e===null)return lE.reflectionLongConvert(cE.PbULong.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return lE.reflectionLongConvert(cE.PbULong.from(e),n);case Kt.ScalarType.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case Kt.ScalarType.STRING:if(e===null)return"";if(typeof e!="string"){s="extra whitespace";break}try{encodeURIComponent(e)}catch(c){c="invalid UTF8";break}return e;case Kt.ScalarType.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return Dpe.base64decode(e)}}catch(a){s=a.message}this.assert(!1,i+(s?" - "+s:""),e)}};uE.ReflectionJsonReader=AS});var uS=m(dE=>{"use strict";Object.defineProperty(dE,"__esModule",{value:!0});dE.ReflectionJsonWriter=void 0;var _pe=Wy(),uG=Io(),Fr=di(),ft=nl(),lS=class{static{o(this,"ReflectionJsonWriter")}constructor(e){var r;this.fields=(r=e.fields)!==null&&r!==void 0?r:[]}write(e,r){let n={},i=e;for(let s of this.fields){if(!s.oneof){let l=this.field(s,i[s.localName],r);l!==void 0&&(n[r.useProtoFieldName?s.name:s.jsonName]=l);continue}let a=i[s.oneof];if(a.oneofKind!==s.localName)continue;let A=s.kind=="scalar"||s.kind=="enum"?Object.assign(Object.assign({},r),{emitDefaultValues:!0}):r,c=this.field(s,a[s.localName],A);ft.assert(c!==void 0),n[r.useProtoFieldName?s.name:s.jsonName]=c}return n}field(e,r,n){let i;if(e.kind=="map"){ft.assert(typeof r=="object"&&r!==null);let s={};switch(e.V.kind){case"scalar":for(let[c,l]of Object.entries(r)){let u=this.scalar(e.V.T,l,e.name,!1,!0);ft.assert(u!==void 0),s[c.toString()]=u}break;case"message":let a=e.V.T();for(let[c,l]of Object.entries(r)){let u=this.message(a,l,e.name,n);ft.assert(u!==void 0),s[c.toString()]=u}break;case"enum":let A=e.V.T();for(let[c,l]of Object.entries(r)){ft.assert(l===void 0||typeof l=="number");let u=this.enum(A,l,e.name,!1,!0,n.enumAsInteger);ft.assert(u!==void 0),s[c.toString()]=u}break}(n.emitDefaultValues||Object.keys(s).length>0)&&(i=s)}else if(e.repeat){ft.assert(Array.isArray(r));let s=[];switch(e.kind){case"scalar":for(let c=0;c0||n.emitDefaultValues)&&(i=s)}else switch(e.kind){case"scalar":i=this.scalar(e.T,r,e.name,e.opt,n.emitDefaultValues);break;case"enum":i=this.enum(e.T(),r,e.name,e.opt,n.emitDefaultValues,n.enumAsInteger);break;case"message":i=this.message(e.T(),r,e.name,n);break}return i}enum(e,r,n,i,s,a){if(e[0]=="google.protobuf.NullValue")return!s&&!i?void 0:null;if(r===void 0){ft.assert(i);return}if(!(r===0&&!s&&!i))return ft.assert(typeof r=="number"),ft.assert(Number.isInteger(r)),a||!e[1].hasOwnProperty(r)?r:e[2]?e[2]+e[1][r]:e[1][r]}message(e,r,n,i){return r===void 0?i.emitDefaultValues?null:void 0:e.internalJsonWrite(r,i)}scalar(e,r,n,i,s){if(r===void 0){ft.assert(i);return}let a=s||i;switch(e){case Fr.ScalarType.INT32:case Fr.ScalarType.SFIXED32:case Fr.ScalarType.SINT32:return r===0?a?0:void 0:(ft.assertInt32(r),r);case Fr.ScalarType.FIXED32:case Fr.ScalarType.UINT32:return r===0?a?0:void 0:(ft.assertUInt32(r),r);case Fr.ScalarType.FLOAT:ft.assertFloat32(r);case Fr.ScalarType.DOUBLE:return r===0?a?0:void 0:(ft.assert(typeof r=="number"),Number.isNaN(r)?"NaN":r===Number.POSITIVE_INFINITY?"Infinity":r===Number.NEGATIVE_INFINITY?"-Infinity":r);case Fr.ScalarType.STRING:return r===""?a?"":void 0:(ft.assert(typeof r=="string"),r);case Fr.ScalarType.BOOL:return r===!1?a?!1:void 0:(ft.assert(typeof r=="boolean"),r);case Fr.ScalarType.UINT64:case Fr.ScalarType.FIXED64:ft.assert(typeof r=="number"||typeof r=="string"||typeof r=="bigint");let A=uG.PbULong.from(r);return A.isZero()&&!a?void 0:A.toString();case Fr.ScalarType.INT64:case Fr.ScalarType.SFIXED64:case Fr.ScalarType.SINT64:ft.assert(typeof r=="number"||typeof r=="string"||typeof r=="bigint");let c=uG.PbLong.from(r);return c.isZero()&&!a?void 0:c.toString();case Fr.ScalarType.BYTES:return ft.assert(r instanceof Uint8Array),r.byteLength?_pe.base64encode(r):a?"":void 0}}};dE.ReflectionJsonWriter=lS});var mE=m(gE=>{"use strict";Object.defineProperty(gE,"__esModule",{value:!0});gE.reflectionScalarDefault=void 0;var gi=di(),dG=AE(),gG=Io();function vpe(t,e=gi.LongType.STRING){switch(t){case gi.ScalarType.BOOL:return!1;case gi.ScalarType.UINT64:case gi.ScalarType.FIXED64:return dG.reflectionLongConvert(gG.PbULong.ZERO,e);case gi.ScalarType.INT64:case gi.ScalarType.SFIXED64:case gi.ScalarType.SINT64:return dG.reflectionLongConvert(gG.PbLong.ZERO,e);case gi.ScalarType.DOUBLE:case gi.ScalarType.FLOAT:return 0;case gi.ScalarType.BYTES:return new Uint8Array(0);case gi.ScalarType.STRING:return"";default:return 0}}o(vpe,"reflectionScalarDefault");gE.reflectionScalarDefault=vpe});var gS=m(hE=>{"use strict";Object.defineProperty(hE,"__esModule",{value:!0});hE.ReflectionBinaryReader=void 0;var mG=Dd(),Lt=di(),Fd=AE(),hG=mE(),dS=class{static{o(this,"ReflectionBinaryReader")}constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){let r=(e=this.info.fields)!==null&&e!==void 0?e:[];this.fieldNoToField=new Map(r.map(n=>[n.no,n]))}}read(e,r,n,i){this.prepare();let s=i===void 0?e.len:e.pos+i;for(;e.pos{"use strict";Object.defineProperty(fE,"__esModule",{value:!0});fE.ReflectionBinaryWriter=void 0;var Nn=Dd(),it=di(),ol=nl(),Ud=Io(),mS=class{static{o(this,"ReflectionBinaryWriter")}constructor(e){this.info=e}prepare(){if(!this.fields){let e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((r,n)=>r.no-n.no)}}write(e,r,n){this.prepare();for(let s of this.fields){let a,A,c=s.repeat,l=s.localName;if(s.oneof){let u=e[s.oneof];if(u.oneofKind!==l)continue;a=u[l],A=!0}else a=e[l],A=!1;switch(s.kind){case"scalar":case"enum":let u=s.kind=="enum"?it.ScalarType.INT32:s.T;if(c)if(ol.assert(Array.isArray(a)),c==it.RepeatType.PACKED)this.packed(r,u,s.no,a);else for(let d of a)this.scalar(r,u,s.no,d,!0);else a===void 0?ol.assert(s.opt):this.scalar(r,u,s.no,a,A||s.opt);break;case"message":if(c){ol.assert(Array.isArray(a));for(let d of a)this.message(r,n,s.T(),s.no,d)}else this.message(r,n,s.T(),s.no,a);break;case"map":ol.assert(typeof a=="object"&&a!==null);for(let[d,g]of Object.entries(a))this.mapEntry(r,n,s,d,g);break}}let i=n.writeUnknownFields;i!==!1&&(i===!0?Nn.UnknownFieldHandler.onWrite:i)(this.info.typeName,e,r)}mapEntry(e,r,n,i,s){e.tag(n.no,Nn.WireType.LengthDelimited),e.fork();let a=i;switch(n.K){case it.ScalarType.INT32:case it.ScalarType.FIXED32:case it.ScalarType.UINT32:case it.ScalarType.SFIXED32:case it.ScalarType.SINT32:a=Number.parseInt(i);break;case it.ScalarType.BOOL:ol.assert(i=="true"||i=="false"),a=i=="true";break}switch(this.scalar(e,n.K,1,a,!0),n.V.kind){case"scalar":this.scalar(e,n.V.T,2,s,!0);break;case"enum":this.scalar(e,it.ScalarType.INT32,2,s,!0);break;case"message":this.message(e,r,n.V.T(),2,s);break}e.join()}message(e,r,n,i,s){s!==void 0&&(n.internalBinaryWrite(s,e.tag(i,Nn.WireType.LengthDelimited).fork(),r),e.join())}scalar(e,r,n,i,s){let[a,A,c]=this.scalarInfo(r,i);(!c||s)&&(e.tag(n,a),e[A](i))}packed(e,r,n,i){if(!i.length)return;ol.assert(r!==it.ScalarType.BYTES&&r!==it.ScalarType.STRING),e.tag(n,Nn.WireType.LengthDelimited),e.fork();let[,s]=this.scalarInfo(r);for(let a=0;a{"use strict";Object.defineProperty(pE,"__esModule",{value:!0});pE.reflectionCreate=void 0;var Tpe=mE(),kpe=Od();function Lpe(t){let e=t.messagePrototype?Object.create(t.messagePrototype):Object.defineProperty({},kpe.MESSAGE_TYPE,{value:t});for(let r of t.fields){let n=r.localName;if(!r.opt)if(r.oneof)e[r.oneof]={oneofKind:void 0};else if(r.repeat)e[n]=[];else switch(r.kind){case"scalar":e[n]=Tpe.reflectionScalarDefault(r.T,r.L);break;case"enum":e[n]=0;break;case"map":e[n]={};break}}return e}o(Lpe,"reflectionCreate");pE.reflectionCreate=Lpe});var pS=m(yE=>{"use strict";Object.defineProperty(yE,"__esModule",{value:!0});yE.reflectionMergePartial=void 0;function Mpe(t,e,r){let n,i=r,s;for(let a of t.fields){let A=a.localName;if(a.oneof){let c=i[a.oneof];if(c?.oneofKind==null)continue;if(n=c[A],s=e[a.oneof],s.oneofKind=c.oneofKind,n==null){delete s[A];continue}}else if(n=i[A],s=e,n==null)continue;switch(a.repeat&&(s[A].length=n.length),a.kind){case"scalar":case"enum":if(a.repeat)for(let l=0;l{"use strict";Object.defineProperty(CE,"__esModule",{value:!0});CE.reflectionEquals=void 0;var yS=di();function Ope(t,e,r){if(e===r)return!0;if(!e||!r)return!1;for(let n of t.fields){let i=n.localName,s=n.oneof?e[n.oneof][i]:e[i],a=n.oneof?r[n.oneof][i]:r[i];switch(n.kind){case"enum":case"scalar":let A=n.kind=="enum"?yS.ScalarType.INT32:n.T;if(!(n.repeat?fG(A,s,a):yG(A,s,a)))return!1;break;case"map":if(!(n.V.kind=="message"?pG(n.V.T(),EE(s),EE(a)):fG(n.V.kind=="enum"?yS.ScalarType.INT32:n.V.T,EE(s),EE(a))))return!1;break;case"message":let c=n.T();if(!(n.repeat?pG(c,s,a):c.equals(s,a)))return!1;break}}return!0}o(Ope,"reflectionEquals");CE.reflectionEquals=Ope;var EE=Object.values;function yG(t,e,r){if(e===r)return!0;if(t!==yS.ScalarType.BYTES)return!1;let n=e,i=r;if(n.length!==i.length)return!1;for(let s=0;s{"use strict";Object.defineProperty(BE,"__esModule",{value:!0});BE.MessageType=void 0;var Fpe=Od(),Upe=di(),qpe=aS(),Hpe=cS(),zpe=uS(),Gpe=gS(),jpe=hS(),Ype=fS(),CS=pS(),Jpe=Jy(),EG=nS(),Vpe=ES(),Wpe=rS(),Kpe=tS(),CG=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),Xpe=CG[Fpe.MESSAGE_TYPE]={},BS=class{static{o(this,"MessageType")}constructor(e,r,n){this.defaultCheckDepth=16,this.typeName=e,this.fields=r.map(Upe.normalizeFieldInfo),this.options=n??{},Xpe.value=this,this.messagePrototype=Object.create(null,CG),this.refTypeCheck=new qpe.ReflectionTypeCheck(this),this.refJsonReader=new Hpe.ReflectionJsonReader(this),this.refJsonWriter=new zpe.ReflectionJsonWriter(this),this.refBinReader=new Gpe.ReflectionBinaryReader(this),this.refBinWriter=new jpe.ReflectionBinaryWriter(this)}create(e){let r=Ype.reflectionCreate(this);return e!==void 0&&CS.reflectionMergePartial(this,r,e),r}clone(e){let r=this.create();return CS.reflectionMergePartial(this,r,e),r}equals(e,r){return Vpe.reflectionEquals(this,e,r)}is(e,r=this.defaultCheckDepth){return this.refTypeCheck.is(e,r,!1)}isAssignable(e,r=this.defaultCheckDepth){return this.refTypeCheck.is(e,r,!0)}mergePartial(e,r){CS.reflectionMergePartial(this,e,r)}fromBinary(e,r){let n=Kpe.binaryReadOptions(r);return this.internalBinaryRead(n.readerFactory(e),e.byteLength,n)}fromJson(e,r){return this.internalJsonRead(e,EG.jsonReadOptions(r))}fromJsonString(e,r){let n=JSON.parse(e);return this.fromJson(n,r)}toJson(e,r){return this.internalJsonWrite(e,EG.jsonWriteOptions(r))}toJsonString(e,r){var n;let i=this.toJson(e,r);return JSON.stringify(i,null,(n=r?.prettySpaces)!==null&&n!==void 0?n:0)}toBinary(e,r){let n=Wpe.binaryWriteOptions(r);return this.internalBinaryWrite(e,n.writerFactory(),n).finish()}internalJsonRead(e,r,n){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let i=n??this.create();return this.refJsonReader.read(e,i,r),i}throw new Error(`Unable to parse message ${this.typeName} from JSON ${Jpe.typeofJsonValue(e)}.`)}internalJsonWrite(e,r){return this.refJsonWriter.write(e,r)}internalBinaryWrite(e,r,n){return this.refBinWriter.write(e,r,n),r}internalBinaryRead(e,r,n,i){let s=i??this.create();return this.refBinReader.read(e,s,n,r),s}};BE.MessageType=BS});var IG=m(IE=>{"use strict";Object.defineProperty(IE,"__esModule",{value:!0});IE.containsMessageType=void 0;var $pe=Od();function Zpe(t){return t[$pe.MESSAGE_TYPE]!=null}o(Zpe,"containsMessageType");IE.containsMessageType=Zpe});var bG=m(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.listEnumNumbers=Yi.listEnumNames=Yi.listEnumValues=Yi.isEnumObject=void 0;function QG(t){if(typeof t!="object"||t===null||!t.hasOwnProperty(0))return!1;for(let e of Object.keys(t)){let r=parseInt(e);if(Number.isNaN(r)){let n=t[e];if(n===void 0||typeof n!="number"||t[n]===void 0)return!1}else{let n=t[r];if(n===void 0||t[n]!==r)return!1}}return!0}o(QG,"isEnumObject");Yi.isEnumObject=QG;function IS(t){if(!QG(t))throw new Error("not a typescript enum object");let e=[];for(let[r,n]of Object.entries(t))typeof n=="number"&&e.push({name:r,number:n});return e}o(IS,"listEnumValues");Yi.listEnumValues=IS;function eye(t){return IS(t).map(e=>e.name)}o(eye,"listEnumNames");Yi.listEnumNames=eye;function tye(t){return IS(t).map(e=>e.number).filter((e,r,n)=>n.indexOf(e)==r)}o(tye,"listEnumNumbers");Yi.listEnumNumbers=tye});var Mt=m(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});var NG=Jy();Object.defineProperty(ne,"typeofJsonValue",{enumerable:!0,get:function(){return NG.typeofJsonValue}});Object.defineProperty(ne,"isJsonObject",{enumerable:!0,get:function(){return NG.isJsonObject}});var xG=Wy();Object.defineProperty(ne,"base64decode",{enumerable:!0,get:function(){return xG.base64decode}});Object.defineProperty(ne,"base64encode",{enumerable:!0,get:function(){return xG.base64encode}});var rye=$z();Object.defineProperty(ne,"utf8read",{enumerable:!0,get:function(){return rye.utf8read}});var QS=Dd();Object.defineProperty(ne,"WireType",{enumerable:!0,get:function(){return QS.WireType}});Object.defineProperty(ne,"mergeBinaryOptions",{enumerable:!0,get:function(){return QS.mergeBinaryOptions}});Object.defineProperty(ne,"UnknownFieldHandler",{enumerable:!0,get:function(){return QS.UnknownFieldHandler}});var RG=tS();Object.defineProperty(ne,"BinaryReader",{enumerable:!0,get:function(){return RG.BinaryReader}});Object.defineProperty(ne,"binaryReadOptions",{enumerable:!0,get:function(){return RG.binaryReadOptions}});var SG=rS();Object.defineProperty(ne,"BinaryWriter",{enumerable:!0,get:function(){return SG.BinaryWriter}});Object.defineProperty(ne,"binaryWriteOptions",{enumerable:!0,get:function(){return SG.binaryWriteOptions}});var wG=Io();Object.defineProperty(ne,"PbLong",{enumerable:!0,get:function(){return wG.PbLong}});Object.defineProperty(ne,"PbULong",{enumerable:!0,get:function(){return wG.PbULong}});var bS=nS();Object.defineProperty(ne,"jsonReadOptions",{enumerable:!0,get:function(){return bS.jsonReadOptions}});Object.defineProperty(ne,"jsonWriteOptions",{enumerable:!0,get:function(){return bS.jsonWriteOptions}});Object.defineProperty(ne,"mergeJsonOptions",{enumerable:!0,get:function(){return bS.mergeJsonOptions}});var nye=Od();Object.defineProperty(ne,"MESSAGE_TYPE",{enumerable:!0,get:function(){return nye.MESSAGE_TYPE}});var iye=BG();Object.defineProperty(ne,"MessageType",{enumerable:!0,get:function(){return iye.MessageType}});var Qa=di();Object.defineProperty(ne,"ScalarType",{enumerable:!0,get:function(){return Qa.ScalarType}});Object.defineProperty(ne,"LongType",{enumerable:!0,get:function(){return Qa.LongType}});Object.defineProperty(ne,"RepeatType",{enumerable:!0,get:function(){return Qa.RepeatType}});Object.defineProperty(ne,"normalizeFieldInfo",{enumerable:!0,get:function(){return Qa.normalizeFieldInfo}});Object.defineProperty(ne,"readFieldOptions",{enumerable:!0,get:function(){return Qa.readFieldOptions}});Object.defineProperty(ne,"readFieldOption",{enumerable:!0,get:function(){return Qa.readFieldOption}});Object.defineProperty(ne,"readMessageOption",{enumerable:!0,get:function(){return Qa.readMessageOption}});var sye=aS();Object.defineProperty(ne,"ReflectionTypeCheck",{enumerable:!0,get:function(){return sye.ReflectionTypeCheck}});var oye=fS();Object.defineProperty(ne,"reflectionCreate",{enumerable:!0,get:function(){return oye.reflectionCreate}});var aye=mE();Object.defineProperty(ne,"reflectionScalarDefault",{enumerable:!0,get:function(){return aye.reflectionScalarDefault}});var Aye=pS();Object.defineProperty(ne,"reflectionMergePartial",{enumerable:!0,get:function(){return Aye.reflectionMergePartial}});var cye=ES();Object.defineProperty(ne,"reflectionEquals",{enumerable:!0,get:function(){return cye.reflectionEquals}});var lye=gS();Object.defineProperty(ne,"ReflectionBinaryReader",{enumerable:!0,get:function(){return lye.ReflectionBinaryReader}});var uye=hS();Object.defineProperty(ne,"ReflectionBinaryWriter",{enumerable:!0,get:function(){return uye.ReflectionBinaryWriter}});var dye=cS();Object.defineProperty(ne,"ReflectionJsonReader",{enumerable:!0,get:function(){return dye.ReflectionJsonReader}});var gye=uS();Object.defineProperty(ne,"ReflectionJsonWriter",{enumerable:!0,get:function(){return gye.ReflectionJsonWriter}});var mye=IG();Object.defineProperty(ne,"containsMessageType",{enumerable:!0,get:function(){return mye.containsMessageType}});var qd=sS();Object.defineProperty(ne,"isOneofGroup",{enumerable:!0,get:function(){return qd.isOneofGroup}});Object.defineProperty(ne,"setOneofValue",{enumerable:!0,get:function(){return qd.setOneofValue}});Object.defineProperty(ne,"getOneofValue",{enumerable:!0,get:function(){return qd.getOneofValue}});Object.defineProperty(ne,"clearOneofValue",{enumerable:!0,get:function(){return qd.clearOneofValue}});Object.defineProperty(ne,"getSelectedOneofValue",{enumerable:!0,get:function(){return qd.getSelectedOneofValue}});var QE=bG();Object.defineProperty(ne,"listEnumValues",{enumerable:!0,get:function(){return QE.listEnumValues}});Object.defineProperty(ne,"listEnumNames",{enumerable:!0,get:function(){return QE.listEnumNames}});Object.defineProperty(ne,"listEnumNumbers",{enumerable:!0,get:function(){return QE.listEnumNumbers}});Object.defineProperty(ne,"isEnumObject",{enumerable:!0,get:function(){return QE.isEnumObject}});var hye=iS();Object.defineProperty(ne,"lowerCamelCase",{enumerable:!0,get:function(){return hye.lowerCamelCase}});var Hd=nl();Object.defineProperty(ne,"assert",{enumerable:!0,get:function(){return Hd.assert}});Object.defineProperty(ne,"assertNever",{enumerable:!0,get:function(){return Hd.assertNever}});Object.defineProperty(ne,"assertInt32",{enumerable:!0,get:function(){return Hd.assertInt32}});Object.defineProperty(ne,"assertUInt32",{enumerable:!0,get:function(){return Hd.assertUInt32}});Object.defineProperty(ne,"assertFloat32",{enumerable:!0,get:function(){return Hd.assertFloat32}})});var NS=m(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.readServiceOption=Ji.readMethodOption=Ji.readMethodOptions=Ji.normalizeMethodInfo=void 0;var fye=Mt();function pye(t,e){var r,n,i;let s=t;return s.service=e,s.localName=(r=s.localName)!==null&&r!==void 0?r:fye.lowerCamelCase(s.name),s.serverStreaming=!!s.serverStreaming,s.clientStreaming=!!s.clientStreaming,s.options=(n=s.options)!==null&&n!==void 0?n:{},s.idempotency=(i=s.idempotency)!==null&&i!==void 0?i:void 0,s}o(pye,"normalizeMethodInfo");Ji.normalizeMethodInfo=pye;function yye(t,e,r,n){var i;let s=(i=t.methods.find((a,A)=>a.localName===e||A===e))===null||i===void 0?void 0:i.options;return s&&s[r]?n.fromJson(s[r]):void 0}o(yye,"readMethodOptions");Ji.readMethodOptions=yye;function Eye(t,e,r,n){var i;let s=(i=t.methods.find((A,c)=>A.localName===e||c===e))===null||i===void 0?void 0:i.options;if(!s)return;let a=s[r];return a===void 0?a:n?n.fromJson(a):a}o(Eye,"readMethodOption");Ji.readMethodOption=Eye;function Cye(t,e,r){let n=t.options;if(!n)return;let i=n[e];return i===void 0?i:r?r.fromJson(i):i}o(Cye,"readServiceOption");Ji.readServiceOption=Cye});var PG=m(bE=>{"use strict";Object.defineProperty(bE,"__esModule",{value:!0});bE.ServiceType=void 0;var Bye=NS(),xS=class{static{o(this,"ServiceType")}constructor(e,r,n){this.typeName=e,this.methods=r.map(i=>Bye.normalizeMethodInfo(i,this)),this.options=n??{}}};bE.ServiceType=xS});var SS=m(NE=>{"use strict";Object.defineProperty(NE,"__esModule",{value:!0});NE.RpcError=void 0;var RS=class extends Error{static{o(this,"RpcError")}constructor(e,r="UNKNOWN",n){super(e),this.name="RpcError",Object.setPrototypeOf(this,new.target.prototype),this.code=r,this.meta=n??{}}toString(){let e=[this.name+": "+this.message];this.code&&(e.push(""),e.push("Code: "+this.code)),this.serviceName&&this.methodName&&e.push("Method: "+this.serviceName+"/"+this.methodName);let r=Object.entries(this.meta);if(r.length){e.push(""),e.push("Meta:");for(let[n,i]of r)e.push(` ${n}: ${i}`)}return e.join(` `)}};NE.RpcError=RS});var wS=m(RE=>{"use strict";Object.defineProperty(RE,"__esModule",{value:!0});RE.mergeRpcOptions=void 0;var DG=Mt();function Iye(t,e){if(!e)return t;let r={};xE(t,r),xE(e,r);for(let n of Object.keys(e)){let i=e[n];switch(n){case"jsonOptions":r.jsonOptions=DG.mergeJsonOptions(t.jsonOptions,r.jsonOptions);break;case"binaryOptions":r.binaryOptions=DG.mergeBinaryOptions(t.binaryOptions,r.binaryOptions);break;case"meta":r.meta={},xE(t.meta,r.meta),xE(e.meta,r.meta);break;case"interceptors":r.interceptors=t.interceptors?t.interceptors.concat(i):i.concat();break}}return r}o(Iye,"mergeRpcOptions");RE.mergeRpcOptions=Iye;function xE(t,e){if(!t)return;let r=e;for(let[n,i]of Object.entries(t))i instanceof Date?r[n]=new Date(i.getTime()):Array.isArray(i)?r[n]=i.concat():r[n]=i}o(xE,"copy")});var DS=m(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});ba.Deferred=ba.DeferredState=void 0;var Vi;(function(t){t[t.PENDING=0]="PENDING",t[t.REJECTED=1]="REJECTED",t[t.RESOLVED=2]="RESOLVED"})(Vi=ba.DeferredState||(ba.DeferredState={}));var PS=class{static{o(this,"Deferred")}constructor(e=!0){this._state=Vi.PENDING,this._promise=new Promise((r,n)=>{this._resolve=r,this._reject=n}),e&&this._promise.catch(r=>{})}get state(){return this._state}get promise(){return this._promise}resolve(e){if(this.state!==Vi.PENDING)throw new Error(`cannot resolve ${Vi[this.state].toLowerCase()}`);this._resolve(e),this._state=Vi.RESOLVED}reject(e){if(this.state!==Vi.PENDING)throw new Error(`cannot reject ${Vi[this.state].toLowerCase()}`);this._reject(e),this._state=Vi.REJECTED}resolvePending(e){this._state===Vi.PENDING&&this.resolve(e)}rejectPending(e){this._state===Vi.PENDING&&this.reject(e)}};ba.Deferred=PS});var vS=m(SE=>{"use strict";Object.defineProperty(SE,"__esModule",{value:!0});SE.RpcOutputStreamController=void 0;var _G=DS(),Na=Mt(),_S=class{static{o(this,"RpcOutputStreamController")}constructor(){this._lis={nxt:[],msg:[],err:[],cmp:[]},this._closed=!1,this._itState={q:[]}}onNext(e){return this.addLis(e,this._lis.nxt)}onMessage(e){return this.addLis(e,this._lis.msg)}onError(e){return this.addLis(e,this._lis.err)}onComplete(e){return this.addLis(e,this._lis.cmp)}addLis(e,r){return r.push(e),()=>{let n=r.indexOf(e);n>=0&&r.splice(n,1)}}clearLis(){for(let e of Object.values(this._lis))e.splice(0,e.length)}get closed(){return this._closed!==!1}notifyNext(e,r,n){Na.assert((e?1:0)+(r?1:0)+(n?1:0)<=1,"only one emission at a time"),e&&this.notifyMessage(e),r&&this.notifyError(r),n&&this.notifyComplete()}notifyMessage(e){Na.assert(!this.closed,"stream is closed"),this.pushIt({value:e,done:!1}),this._lis.msg.forEach(r=>r(e)),this._lis.nxt.forEach(r=>r(e,void 0,!1))}notifyError(e){Na.assert(!this.closed,"stream is closed"),this._closed=e,this.pushIt(e),this._lis.err.forEach(r=>r(e)),this._lis.nxt.forEach(r=>r(void 0,e,!1)),this.clearLis()}notifyComplete(){Na.assert(!this.closed,"stream is closed"),this._closed=!0,this.pushIt({value:null,done:!0}),this._lis.cmp.forEach(e=>e()),this._lis.nxt.forEach(e=>e(void 0,void 0,!0)),this.clearLis()}[Symbol.asyncIterator](){return this._closed===!0?this.pushIt({value:null,done:!0}):this._closed!==!1&&this.pushIt(this._closed),{next:()=>{let e=this._itState;Na.assert(e,"bad state"),Na.assert(!e.p,"iterator contract broken");let r=e.q.shift();return r?"value"in r?Promise.resolve(r):Promise.reject(r):(e.p=new _G.Deferred,e.p.promise)}}}pushIt(e){let r=this._itState;if(r.p){let n=r.p;Na.assert(n.state==_G.DeferredState.PENDING,"iterator contract broken"),"value"in e?n.resolve(e):n.reject(e),delete r.p}else r.q.push(e)}};SE.RpcOutputStreamController=_S});var kS=m(al=>{"use strict";var Qye=al&&al.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}return o(i,"adopt"),new(r||(r=Promise))(function(s,a){function A(u){try{l(n.next(u))}catch(d){a(d)}}o(A,"fulfilled");function c(u){try{l(n.throw(u))}catch(d){a(d)}}o(c,"rejected");function l(u){u.done?s(u.value):i(u.value).then(A,c)}o(l,"step"),l((n=n.apply(t,e||[])).next())})};Object.defineProperty(al,"__esModule",{value:!0});al.UnaryCall=void 0;var TS=class{static{o(this,"UnaryCall")}constructor(e,r,n,i,s,a,A){this.method=e,this.requestHeaders=r,this.request=n,this.headers=i,this.response=s,this.status=a,this.trailers=A}then(e,r){return this.promiseFinished().then(n=>e?Promise.resolve(e(n)):n,n=>r?Promise.resolve(r(n)):Promise.reject(n))}promiseFinished(){return Qye(this,void 0,void 0,function*(){let[e,r,n,i]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,response:r,status:n,trailers:i}})}};al.UnaryCall=TS});var MS=m(Al=>{"use strict";var bye=Al&&Al.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}return o(i,"adopt"),new(r||(r=Promise))(function(s,a){function A(u){try{l(n.next(u))}catch(d){a(d)}}o(A,"fulfilled");function c(u){try{l(n.throw(u))}catch(d){a(d)}}o(c,"rejected");function l(u){u.done?s(u.value):i(u.value).then(A,c)}o(l,"step"),l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Al,"__esModule",{value:!0});Al.ServerStreamingCall=void 0;var LS=class{static{o(this,"ServerStreamingCall")}constructor(e,r,n,i,s,a,A){this.method=e,this.requestHeaders=r,this.request=n,this.headers=i,this.responses=s,this.status=a,this.trailers=A}then(e,r){return this.promiseFinished().then(n=>e?Promise.resolve(e(n)):n,n=>r?Promise.resolve(r(n)):Promise.reject(n))}promiseFinished(){return bye(this,void 0,void 0,function*(){let[e,r,n]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,status:r,trailers:n}})}};Al.ServerStreamingCall=LS});var FS=m(cl=>{"use strict";var Nye=cl&&cl.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}return o(i,"adopt"),new(r||(r=Promise))(function(s,a){function A(u){try{l(n.next(u))}catch(d){a(d)}}o(A,"fulfilled");function c(u){try{l(n.throw(u))}catch(d){a(d)}}o(c,"rejected");function l(u){u.done?s(u.value):i(u.value).then(A,c)}o(l,"step"),l((n=n.apply(t,e||[])).next())})};Object.defineProperty(cl,"__esModule",{value:!0});cl.ClientStreamingCall=void 0;var OS=class{static{o(this,"ClientStreamingCall")}constructor(e,r,n,i,s,a,A){this.method=e,this.requestHeaders=r,this.requests=n,this.headers=i,this.response=s,this.status=a,this.trailers=A}then(e,r){return this.promiseFinished().then(n=>e?Promise.resolve(e(n)):n,n=>r?Promise.resolve(r(n)):Promise.reject(n))}promiseFinished(){return Nye(this,void 0,void 0,function*(){let[e,r,n,i]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,headers:e,response:r,status:n,trailers:i}})}};cl.ClientStreamingCall=OS});var qS=m(ll=>{"use strict";var xye=ll&&ll.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}return o(i,"adopt"),new(r||(r=Promise))(function(s,a){function A(u){try{l(n.next(u))}catch(d){a(d)}}o(A,"fulfilled");function c(u){try{l(n.throw(u))}catch(d){a(d)}}o(c,"rejected");function l(u){u.done?s(u.value):i(u.value).then(A,c)}o(l,"step"),l((n=n.apply(t,e||[])).next())})};Object.defineProperty(ll,"__esModule",{value:!0});ll.DuplexStreamingCall=void 0;var US=class{static{o(this,"DuplexStreamingCall")}constructor(e,r,n,i,s,a,A){this.method=e,this.requestHeaders=r,this.requests=n,this.headers=i,this.responses=s,this.status=a,this.trailers=A}then(e,r){return this.promiseFinished().then(n=>e?Promise.resolve(e(n)):n,n=>r?Promise.resolve(r(n)):Promise.reject(n))}promiseFinished(){return xye(this,void 0,void 0,function*(){let[e,r,n]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,headers:e,status:r,trailers:n}})}};ll.DuplexStreamingCall=US});var TG=m(gl=>{"use strict";var Rye=gl&&gl.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}return o(i,"adopt"),new(r||(r=Promise))(function(s,a){function A(u){try{l(n.next(u))}catch(d){a(d)}}o(A,"fulfilled");function c(u){try{l(n.throw(u))}catch(d){a(d)}}o(c,"rejected");function l(u){u.done?s(u.value):i(u.value).then(A,c)}o(l,"step"),l((n=n.apply(t,e||[])).next())})};Object.defineProperty(gl,"__esModule",{value:!0});gl.TestTransport=void 0;var Kn=SS(),wE=Mt(),vG=vS(),Sye=wS(),wye=kS(),Pye=MS(),Dye=FS(),_ye=qS(),dl=class t{static{o(this,"TestTransport")}constructor(e){this.suppressUncaughtRejections=!0,this.headerDelay=10,this.responseDelay=50,this.betweenResponseDelay=10,this.afterResponseDelay=10,this.data=e??{}}get sentMessages(){return this.lastInput instanceof ul?this.lastInput.sent:typeof this.lastInput=="object"?[this.lastInput.single]:[]}get sendComplete(){return this.lastInput instanceof ul?this.lastInput.completed:typeof this.lastInput=="object"}promiseHeaders(){var e;let r=(e=this.data.headers)!==null&&e!==void 0?e:t.defaultHeaders;return r instanceof Kn.RpcError?Promise.reject(r):Promise.resolve(r)}promiseSingleResponse(e){if(this.data.response instanceof Kn.RpcError)return Promise.reject(this.data.response);let r;return Array.isArray(this.data.response)?(wE.assert(this.data.response.length>0),r=this.data.response[0]):this.data.response!==void 0?r=this.data.response:r=e.O.create(),wE.assert(e.O.is(r)),Promise.resolve(r)}streamResponses(e,r,n){return Rye(this,void 0,void 0,function*(){let i=[];if(this.data.response===void 0)i.push(e.O.create());else if(Array.isArray(this.data.response))for(let s of this.data.response)wE.assert(e.O.is(s)),i.push(s);else this.data.response instanceof Kn.RpcError||(wE.assert(e.O.is(this.data.response)),i.push(this.data.response));try{yield ar(this.responseDelay,n)(void 0)}catch(s){r.notifyError(s);return}if(this.data.response instanceof Kn.RpcError){r.notifyError(this.data.response);return}for(let s of i){r.notifyMessage(s);try{yield ar(this.betweenResponseDelay,n)(void 0)}catch(a){r.notifyError(a);return}}if(this.data.status instanceof Kn.RpcError){r.notifyError(this.data.status);return}if(this.data.trailers instanceof Kn.RpcError){r.notifyError(this.data.trailers);return}r.notifyComplete()})}promiseStatus(){var e;let r=(e=this.data.status)!==null&&e!==void 0?e:t.defaultStatus;return r instanceof Kn.RpcError?Promise.reject(r):Promise.resolve(r)}promiseTrailers(){var e;let r=(e=this.data.trailers)!==null&&e!==void 0?e:t.defaultTrailers;return r instanceof Kn.RpcError?Promise.reject(r):Promise.resolve(r)}maybeSuppressUncaught(...e){if(this.suppressUncaughtRejections)for(let r of e)r.catch(()=>{})}mergeOptions(e){return Sye.mergeRpcOptions({},e)}unary(e,r,n){var i;let s=(i=n.meta)!==null&&i!==void 0?i:{},a=this.promiseHeaders().then(ar(this.headerDelay,n.abort)),A=a.catch(u=>{}).then(ar(this.responseDelay,n.abort)).then(u=>this.promiseSingleResponse(e)),c=A.catch(u=>{}).then(ar(this.afterResponseDelay,n.abort)).then(u=>this.promiseStatus()),l=A.catch(u=>{}).then(ar(this.afterResponseDelay,n.abort)).then(u=>this.promiseTrailers());return this.maybeSuppressUncaught(c,l),this.lastInput={single:r},new wye.UnaryCall(e,s,r,a,A,c,l)}serverStreaming(e,r,n){var i;let s=(i=n.meta)!==null&&i!==void 0?i:{},a=this.promiseHeaders().then(ar(this.headerDelay,n.abort)),A=new vG.RpcOutputStreamController,c=a.then(ar(this.responseDelay,n.abort)).catch(()=>{}).then(()=>this.streamResponses(e,A,n.abort)).then(ar(this.afterResponseDelay,n.abort)),l=c.then(()=>this.promiseStatus()),u=c.then(()=>this.promiseTrailers());return this.maybeSuppressUncaught(l,u),this.lastInput={single:r},new Pye.ServerStreamingCall(e,s,r,a,A,l,u)}clientStreaming(e,r){var n;let i=(n=r.meta)!==null&&n!==void 0?n:{},s=this.promiseHeaders().then(ar(this.headerDelay,r.abort)),a=s.catch(l=>{}).then(ar(this.responseDelay,r.abort)).then(l=>this.promiseSingleResponse(e)),A=a.catch(l=>{}).then(ar(this.afterResponseDelay,r.abort)).then(l=>this.promiseStatus()),c=a.catch(l=>{}).then(ar(this.afterResponseDelay,r.abort)).then(l=>this.promiseTrailers());return this.maybeSuppressUncaught(A,c),this.lastInput=new ul(this.data,r.abort),new Dye.ClientStreamingCall(e,i,this.lastInput,s,a,A,c)}duplex(e,r){var n;let i=(n=r.meta)!==null&&n!==void 0?n:{},s=this.promiseHeaders().then(ar(this.headerDelay,r.abort)),a=new vG.RpcOutputStreamController,A=s.then(ar(this.responseDelay,r.abort)).catch(()=>{}).then(()=>this.streamResponses(e,a,r.abort)).then(ar(this.afterResponseDelay,r.abort)),c=A.then(()=>this.promiseStatus()),l=A.then(()=>this.promiseTrailers());return this.maybeSuppressUncaught(c,l),this.lastInput=new ul(this.data,r.abort),new _ye.DuplexStreamingCall(e,i,this.lastInput,s,a,c,l)}};gl.TestTransport=dl;dl.defaultHeaders={responseHeader:"test"};dl.defaultStatus={code:"OK",detail:"all good"};dl.defaultTrailers={responseTrailer:"test"};function ar(t,e){return r=>new Promise((n,i)=>{if(e?.aborted)i(new Kn.RpcError("user cancel","CANCELLED"));else{let s=setTimeout(()=>n(r),t);e&&e.addEventListener("abort",a=>{clearTimeout(s),i(new Kn.RpcError("user cancel","CANCELLED"))})}})}o(ar,"delay");var ul=class{static{o(this,"TestInputStream")}constructor(e,r){this._completed=!1,this._sent=[],this.data=e,this.abort=r}get sent(){return this._sent}get completed(){return this._completed}send(e){if(this.data.inputMessage instanceof Kn.RpcError)return Promise.reject(this.data.inputMessage);let r=this.data.inputMessage===void 0?10:this.data.inputMessage;return Promise.resolve(void 0).then(()=>{this._sent.push(e)}).then(ar(r,this.abort))}complete(){if(this.data.inputComplete instanceof Kn.RpcError)return Promise.reject(this.data.inputComplete);let e=this.data.inputComplete===void 0?10:this.data.inputComplete;return Promise.resolve(void 0).then(()=>{this._completed=!0}).then(ar(e,this.abort))}}});var kG=m(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.stackDuplexStreamingInterceptors=Xn.stackClientStreamingInterceptors=Xn.stackServerStreamingInterceptors=Xn.stackUnaryInterceptors=Xn.stackIntercept=void 0;var vye=Mt();function zd(t,e,r,n,i){var s,a,A,c;if(t=="unary"){let l=o((u,d,g)=>e.unary(u,d,g),"tail");for(let u of((s=n.interceptors)!==null&&s!==void 0?s:[]).filter(d=>d.interceptUnary).reverse()){let d=l;l=o((g,p,C)=>u.interceptUnary(d,g,p,C),"tail")}return l(r,i,n)}if(t=="serverStreaming"){let l=o((u,d,g)=>e.serverStreaming(u,d,g),"tail");for(let u of((a=n.interceptors)!==null&&a!==void 0?a:[]).filter(d=>d.interceptServerStreaming).reverse()){let d=l;l=o((g,p,C)=>u.interceptServerStreaming(d,g,p,C),"tail")}return l(r,i,n)}if(t=="clientStreaming"){let l=o((u,d)=>e.clientStreaming(u,d),"tail");for(let u of((A=n.interceptors)!==null&&A!==void 0?A:[]).filter(d=>d.interceptClientStreaming).reverse()){let d=l;l=o((g,p)=>u.interceptClientStreaming(d,g,p),"tail")}return l(r,n)}if(t=="duplex"){let l=o((u,d)=>e.duplex(u,d),"tail");for(let u of((c=n.interceptors)!==null&&c!==void 0?c:[]).filter(d=>d.interceptDuplex).reverse()){let d=l;l=o((g,p)=>u.interceptDuplex(d,g,p),"tail")}return l(r,n)}vye.assertNever(t)}o(zd,"stackIntercept");Xn.stackIntercept=zd;function Tye(t,e,r,n){return zd("unary",t,e,n,r)}o(Tye,"stackUnaryInterceptors");Xn.stackUnaryInterceptors=Tye;function kye(t,e,r,n){return zd("serverStreaming",t,e,n,r)}o(kye,"stackServerStreamingInterceptors");Xn.stackServerStreamingInterceptors=kye;function Lye(t,e,r){return zd("clientStreaming",t,e,r)}o(Lye,"stackClientStreamingInterceptors");Xn.stackClientStreamingInterceptors=Lye;function Mye(t,e,r){return zd("duplex",t,e,r)}o(Mye,"stackDuplexStreamingInterceptors");Xn.stackDuplexStreamingInterceptors=Mye});var LG=m(PE=>{"use strict";Object.defineProperty(PE,"__esModule",{value:!0});PE.ServerCallContextController=void 0;var HS=class{static{o(this,"ServerCallContextController")}constructor(e,r,n,i,s={code:"OK",detail:""}){this._cancelled=!1,this._listeners=[],this.method=e,this.headers=r,this.deadline=n,this.trailers={},this._sendRH=i,this.status=s}notifyCancelled(){if(!this._cancelled){this._cancelled=!0;for(let e of this._listeners)e()}}sendResponseHeaders(e){this._sendRH(e)}get cancelled(){return this._cancelled}onCancel(e){let r=this._listeners;return r.push(e),()=>{let n=r.indexOf(e);n>=0&&r.splice(n,1)}}};PE.ServerCallContextController=HS});var OG=m(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});var Oye=PG();Object.defineProperty(Dt,"ServiceType",{enumerable:!0,get:function(){return Oye.ServiceType}});var zS=NS();Object.defineProperty(Dt,"readMethodOptions",{enumerable:!0,get:function(){return zS.readMethodOptions}});Object.defineProperty(Dt,"readMethodOption",{enumerable:!0,get:function(){return zS.readMethodOption}});Object.defineProperty(Dt,"readServiceOption",{enumerable:!0,get:function(){return zS.readServiceOption}});var Fye=SS();Object.defineProperty(Dt,"RpcError",{enumerable:!0,get:function(){return Fye.RpcError}});var Uye=wS();Object.defineProperty(Dt,"mergeRpcOptions",{enumerable:!0,get:function(){return Uye.mergeRpcOptions}});var qye=vS();Object.defineProperty(Dt,"RpcOutputStreamController",{enumerable:!0,get:function(){return qye.RpcOutputStreamController}});var Hye=TG();Object.defineProperty(Dt,"TestTransport",{enumerable:!0,get:function(){return Hye.TestTransport}});var MG=DS();Object.defineProperty(Dt,"Deferred",{enumerable:!0,get:function(){return MG.Deferred}});Object.defineProperty(Dt,"DeferredState",{enumerable:!0,get:function(){return MG.DeferredState}});var zye=qS();Object.defineProperty(Dt,"DuplexStreamingCall",{enumerable:!0,get:function(){return zye.DuplexStreamingCall}});var Gye=FS();Object.defineProperty(Dt,"ClientStreamingCall",{enumerable:!0,get:function(){return Gye.ClientStreamingCall}});var jye=MS();Object.defineProperty(Dt,"ServerStreamingCall",{enumerable:!0,get:function(){return jye.ServerStreamingCall}});var Yye=kS();Object.defineProperty(Dt,"UnaryCall",{enumerable:!0,get:function(){return Yye.UnaryCall}});var Gd=kG();Object.defineProperty(Dt,"stackIntercept",{enumerable:!0,get:function(){return Gd.stackIntercept}});Object.defineProperty(Dt,"stackDuplexStreamingInterceptors",{enumerable:!0,get:function(){return Gd.stackDuplexStreamingInterceptors}});Object.defineProperty(Dt,"stackClientStreamingInterceptors",{enumerable:!0,get:function(){return Gd.stackClientStreamingInterceptors}});Object.defineProperty(Dt,"stackServerStreamingInterceptors",{enumerable:!0,get:function(){return Gd.stackServerStreamingInterceptors}});Object.defineProperty(Dt,"stackUnaryInterceptors",{enumerable:!0,get:function(){return Gd.stackUnaryInterceptors}});var Jye=LG();Object.defineProperty(Dt,"ServerCallContextController",{enumerable:!0,get:function(){return Jye.ServerCallContextController}})});var qG=m(DE=>{"use strict";Object.defineProperty(DE,"__esModule",{value:!0});DE.CacheScope=void 0;var FG=Mt(),UG=Mt(),Vye=Mt(),Wye=Mt(),Kye=Mt(),GS=class extends Kye.MessageType{static{o(this,"CacheScope$Type")}constructor(){super("github.actions.results.entities.v1.CacheScope",[{no:1,name:"scope",kind:"scalar",T:9},{no:2,name:"permission",kind:"scalar",T:3}])}create(e){let r={scope:"",permission:"0"};return globalThis.Object.defineProperty(r,Wye.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,Vye.reflectionMergePartial)(this,r,e),r}internalBinaryRead(e,r,n,i){let s=i??this.create(),a=e.pos+r;for(;e.pos{"use strict";Object.defineProperty(_E,"__esModule",{value:!0});_E.CacheMetadata=void 0;var HG=Mt(),zG=Mt(),Xye=Mt(),$ye=Mt(),Zye=Mt(),jS=qG(),YS=class extends Zye.MessageType{static{o(this,"CacheMetadata$Type")}constructor(){super("github.actions.results.entities.v1.CacheMetadata",[{no:1,name:"repository_id",kind:"scalar",T:3},{no:2,name:"scope",kind:"message",repeat:1,T:()=>jS.CacheScope}])}create(e){let r={repositoryId:"0",scope:[]};return globalThis.Object.defineProperty(r,$ye.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,Xye.reflectionMergePartial)(this,r,e),r}internalBinaryRead(e,r,n,i){let s=i??this.create(),a=e.pos+r;for(;e.pos{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.CacheService=_t.GetCacheEntryDownloadURLResponse=_t.GetCacheEntryDownloadURLRequest=_t.FinalizeCacheEntryUploadResponse=_t.FinalizeCacheEntryUploadRequest=_t.CreateCacheEntryResponse=_t.CreateCacheEntryRequest=void 0;var eEe=OG(),Ar=Mt(),$n=Mt(),ml=Mt(),hl=Mt(),fl=Mt(),Cs=GG(),JS=class extends fl.MessageType{static{o(this,"CreateCacheEntryRequest$Type")}constructor(){super("github.actions.results.api.v1.CreateCacheEntryRequest",[{no:1,name:"metadata",kind:"message",T:()=>Cs.CacheMetadata},{no:2,name:"key",kind:"scalar",T:9},{no:3,name:"version",kind:"scalar",T:9}])}create(e){let r={key:"",version:""};return globalThis.Object.defineProperty(r,hl.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,ml.reflectionMergePartial)(this,r,e),r}internalBinaryRead(e,r,n,i){let s=i??this.create(),a=e.pos+r;for(;e.posCs.CacheMetadata},{no:2,name:"key",kind:"scalar",T:9},{no:3,name:"size_bytes",kind:"scalar",T:3},{no:4,name:"version",kind:"scalar",T:9}])}create(e){let r={key:"",sizeBytes:"0",version:""};return globalThis.Object.defineProperty(r,hl.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,ml.reflectionMergePartial)(this,r,e),r}internalBinaryRead(e,r,n,i){let s=i??this.create(),a=e.pos+r;for(;e.posCs.CacheMetadata},{no:2,name:"key",kind:"scalar",T:9},{no:3,name:"restore_keys",kind:"scalar",repeat:2,T:9},{no:4,name:"version",kind:"scalar",T:9}])}create(e){let r={key:"",restoreKeys:[],version:""};return globalThis.Object.defineProperty(r,hl.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,ml.reflectionMergePartial)(this,r,e),r}internalBinaryRead(e,r,n,i){let s=i??this.create(),a=e.pos+r;for(;e.pos{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});pl.CacheServiceClientProtobuf=pl.CacheServiceClientJSON=void 0;var Zn=jG(),ZS=class{static{o(this,"CacheServiceClientJSON")}constructor(e){this.rpc=e,this.CreateCacheEntry.bind(this),this.FinalizeCacheEntryUpload.bind(this),this.GetCacheEntryDownloadURL.bind(this)}CreateCacheEntry(e){let r=Zn.CreateCacheEntryRequest.toJson(e,{useProtoFieldName:!0,emitDefaultValues:!1});return this.rpc.request("github.actions.results.api.v1.CacheService","CreateCacheEntry","application/json",r).then(i=>Zn.CreateCacheEntryResponse.fromJson(i,{ignoreUnknownFields:!0}))}FinalizeCacheEntryUpload(e){let r=Zn.FinalizeCacheEntryUploadRequest.toJson(e,{useProtoFieldName:!0,emitDefaultValues:!1});return this.rpc.request("github.actions.results.api.v1.CacheService","FinalizeCacheEntryUpload","application/json",r).then(i=>Zn.FinalizeCacheEntryUploadResponse.fromJson(i,{ignoreUnknownFields:!0}))}GetCacheEntryDownloadURL(e){let r=Zn.GetCacheEntryDownloadURLRequest.toJson(e,{useProtoFieldName:!0,emitDefaultValues:!1});return this.rpc.request("github.actions.results.api.v1.CacheService","GetCacheEntryDownloadURL","application/json",r).then(i=>Zn.GetCacheEntryDownloadURLResponse.fromJson(i,{ignoreUnknownFields:!0}))}};pl.CacheServiceClientJSON=ZS;var ew=class{static{o(this,"CacheServiceClientProtobuf")}constructor(e){this.rpc=e,this.CreateCacheEntry.bind(this),this.FinalizeCacheEntryUpload.bind(this),this.GetCacheEntryDownloadURL.bind(this)}CreateCacheEntry(e){let r=Zn.CreateCacheEntryRequest.toBinary(e);return this.rpc.request("github.actions.results.api.v1.CacheService","CreateCacheEntry","application/protobuf",r).then(i=>Zn.CreateCacheEntryResponse.fromBinary(i))}FinalizeCacheEntryUpload(e){let r=Zn.FinalizeCacheEntryUploadRequest.toBinary(e);return this.rpc.request("github.actions.results.api.v1.CacheService","FinalizeCacheEntryUpload","application/protobuf",r).then(i=>Zn.FinalizeCacheEntryUploadResponse.fromBinary(i))}GetCacheEntryDownloadURL(e){let r=Zn.GetCacheEntryDownloadURLRequest.toBinary(e);return this.rpc.request("github.actions.results.api.v1.CacheService","GetCacheEntryDownloadURL","application/protobuf",r).then(i=>Zn.GetCacheEntryDownloadURLResponse.fromBinary(i))}};pl.CacheServiceClientProtobuf=ew});var JG=m(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.maskSecretUrls=yl.maskSigUrl=void 0;var vE=gr();function tw(t){if(t)try{let r=new URL(t).searchParams.get("sig");r&&((0,vE.setSecret)(r),(0,vE.setSecret)(encodeURIComponent(r)))}catch(e){(0,vE.debug)(`Failed to parse URL: ${t} ${e instanceof Error?e.message:String(e)}`)}}o(tw,"maskSigUrl");yl.maskSigUrl=tw;function tEe(t){if(typeof t!="object"||t===null){(0,vE.debug)("body is not an object or is null");return}"signed_upload_url"in t&&typeof t.signed_upload_url=="string"&&tw(t.signed_upload_url),"signed_download_url"in t&&typeof t.signed_download_url=="string"&&tw(t.signed_download_url)}o(tEe,"maskSecretUrls");yl.maskSecretUrls=tEe});var VG=m(Bl=>{"use strict";var TE=Bl&&Bl.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}return o(i,"adopt"),new(r||(r=Promise))(function(s,a){function A(u){try{l(n.next(u))}catch(d){a(d)}}o(A,"fulfilled");function c(u){try{l(n.throw(u))}catch(d){a(d)}}o(c,"rejected");function l(u){u.done?s(u.value):i(u.value).then(A,c)}o(l,"step"),l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Bl,"__esModule",{value:!0});Bl.internalCacheTwirpClient=void 0;var El=gr(),rEe=WR(),jd=HR(),nEe=Gy(),iEe=SA(),sEe=zm(),Cl=Vo(),oEe=YG(),aEe=JG(),rw=class{static{o(this,"CacheServiceClient")}constructor(e,r,n,i){this.maxAttempts=5,this.baseRetryIntervalMilliseconds=3e3,this.retryMultiplier=1.5;let s=(0,iEe.getRuntimeToken)();this.baseUrl=(0,nEe.getCacheServiceURL)(),r&&(this.maxAttempts=r),n&&(this.baseRetryIntervalMilliseconds=n),i&&(this.retryMultiplier=i),this.httpClient=new Cl.HttpClient(e,[new sEe.BearerCredentialHandler(s)])}request(e,r,n,i){return TE(this,void 0,void 0,function*(){let s=new URL(`/twirp/${e}/${r}`,this.baseUrl).href;(0,El.debug)(`[Request] ${r} ${s}`);let a={"Content-Type":n};try{let{body:A}=yield this.retryableRequest(()=>TE(this,void 0,void 0,function*(){return this.httpClient.post(s,JSON.stringify(i),a)}));return A}catch(A){throw new Error(`Failed to ${r}: ${A.message}`)}})}retryableRequest(e){return TE(this,void 0,void 0,function*(){let r=0,n="",i="";for(;r=200&&e<300:!1}isRetryableHttpStatusCode(e){return e?[Cl.HttpCodes.BadGateway,Cl.HttpCodes.GatewayTimeout,Cl.HttpCodes.InternalServerError,Cl.HttpCodes.ServiceUnavailable,Cl.HttpCodes.TooManyRequests].includes(e):!1}sleep(e){return TE(this,void 0,void 0,function*(){return new Promise(r=>setTimeout(r,e))})}getExponentialRetryTimeMilliseconds(e){if(e<0)throw new Error("attempt should be a positive integer");if(e===0)return this.baseRetryIntervalMilliseconds;let r=this.baseRetryIntervalMilliseconds*Math.pow(this.retryMultiplier,e),n=r*this.retryMultiplier;return Math.trunc(Math.random()*(n-r)+r)}};function AEe(t){let e=new rw((0,rEe.getUserAgentString)(),t?.maxAttempts,t?.retryIntervalMs,t?.retryMultiplier);return new oEe.CacheServiceClientJSON(e)}o(AEe,"internalCacheTwirpClient");Bl.internalCacheTwirpClient=AEe});var XG=m(Sr=>{"use strict";var cEe=Sr&&Sr.__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:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lEe=Sr&&Sr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nw=Sr&&Sr.__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)&&cEe(e,t,r);return lEe(e,t),e},Bs=Sr&&Sr.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}return o(i,"adopt"),new(r||(r=Promise))(function(s,a){function A(u){try{l(n.next(u))}catch(d){a(d)}}o(A,"fulfilled");function c(u){try{l(n.throw(u))}catch(d){a(d)}}o(c,"rejected");function l(u){u.done?s(u.value):i(u.value).then(A,c)}o(l,"step"),l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.createTar=Sr.extractTar=Sr.listTar=void 0;var uEe=gu(),kE=nw(jm()),WG=require("fs"),mi=nw(require("path")),iw=nw(SA()),lt=xA(),bo=process.platform==="win32";function dEe(){return Bs(this,void 0,void 0,function*(){switch(process.platform){case"win32":{let t=yield iw.getGnuTarPathOnWindows(),e=lt.SystemTarPathOnWindows;if(t)return{path:t,type:lt.ArchiveToolType.GNU};if((0,WG.existsSync)(e))return{path:e,type:lt.ArchiveToolType.BSD};break}case"darwin":{let t=yield kE.which("gtar",!1);return t?{path:t,type:lt.ArchiveToolType.GNU}:{path:yield kE.which("tar",!0),type:lt.ArchiveToolType.BSD}}default:break}return{path:yield kE.which("tar",!0),type:lt.ArchiveToolType.GNU}})}o(dEe,"getTarPath");function gEe(t,e,r,n=""){return Bs(this,void 0,void 0,function*(){let i=[`"${t.path}"`],s=iw.getCacheFileName(e),a="cache.tar",A=KG(),c=t.type===lt.ArchiveToolType.BSD&&e!==lt.CompressionMethod.Gzip&&bo;switch(r){case"create":i.push("--posix","-cf",c?a:s.replace(new RegExp(`\\${mi.sep}`,"g"),"/"),"--exclude",c?a:s.replace(new RegExp(`\\${mi.sep}`,"g"),"/"),"-P","-C",A.replace(new RegExp(`\\${mi.sep}`,"g"),"/"),"--files-from",lt.ManifestFilename);break;case"extract":i.push("-xf",c?a:n.replace(new RegExp(`\\${mi.sep}`,"g"),"/"),"-P","-C",A.replace(new RegExp(`\\${mi.sep}`,"g"),"/"));break;case"list":i.push("-tf",c?a:n.replace(new RegExp(`\\${mi.sep}`,"g"),"/"),"-P");break}if(t.type===lt.ArchiveToolType.GNU)switch(process.platform){case"win32":i.push("--force-local");break;case"darwin":i.push("--delay-directory-restore");break}return i})}o(gEe,"getTarArgs");function sw(t,e,r=""){return Bs(this,void 0,void 0,function*(){let n,i=yield dEe(),s=yield gEe(i,t,e,r),a=e!=="create"?yield mEe(i,t,r):yield hEe(i,t),A=i.type===lt.ArchiveToolType.BSD&&t!==lt.CompressionMethod.Gzip&&bo;return A&&e!=="create"?n=[[...a].join(" "),[...s].join(" ")]:n=[[...s].join(" "),[...a].join(" ")],A?n:[n.join(" ")]})}o(sw,"getCommands");function KG(){var t;return(t=process.env.GITHUB_WORKSPACE)!==null&&t!==void 0?t:process.cwd()}o(KG,"getWorkingDirectory");function mEe(t,e,r){return Bs(this,void 0,void 0,function*(){let n=t.type===lt.ArchiveToolType.BSD&&e!==lt.CompressionMethod.Gzip&&bo;switch(e){case lt.CompressionMethod.Zstd:return n?["zstd -d --long=30 --force -o",lt.TarFilename,r.replace(new RegExp(`\\${mi.sep}`,"g"),"/")]:["--use-compress-program",bo?'"zstd -d --long=30"':"unzstd --long=30"];case lt.CompressionMethod.ZstdWithoutLong:return n?["zstd -d --force -o",lt.TarFilename,r.replace(new RegExp(`\\${mi.sep}`,"g"),"/")]:["--use-compress-program",bo?'"zstd -d"':"unzstd"];default:return["-z"]}})}o(mEe,"getDecompressionProgram");function hEe(t,e){return Bs(this,void 0,void 0,function*(){let r=iw.getCacheFileName(e),n=t.type===lt.ArchiveToolType.BSD&&e!==lt.CompressionMethod.Gzip&&bo;switch(e){case lt.CompressionMethod.Zstd:return n?["zstd -T0 --long=30 --force -o",r.replace(new RegExp(`\\${mi.sep}`,"g"),"/"),lt.TarFilename]:["--use-compress-program",bo?'"zstd -T0 --long=30"':"zstdmt --long=30"];case lt.CompressionMethod.ZstdWithoutLong:return n?["zstd -T0 --force -o",r.replace(new RegExp(`\\${mi.sep}`,"g"),"/"),lt.TarFilename]:["--use-compress-program",bo?'"zstd -T0"':"zstdmt"];default:return["-z"]}})}o(hEe,"getCompressionProgram");function ow(t,e){return Bs(this,void 0,void 0,function*(){for(let r of t)try{yield(0,uEe.exec)(r,void 0,{cwd:e,env:Object.assign(Object.assign({},process.env),{MSYS:"winsymlinks:nativestrict"})})}catch(n){throw new Error(`${r.split(" ")[0]} failed with error: ${n?.message}`)}})}o(ow,"execCommands");function fEe(t,e){return Bs(this,void 0,void 0,function*(){let r=yield sw(e,"list",t);yield ow(r)})}o(fEe,"listTar");Sr.listTar=fEe;function pEe(t,e){return Bs(this,void 0,void 0,function*(){let r=KG();yield kE.mkdirP(r);let n=yield sw(e,"extract",t);yield ow(n)})}o(pEe,"extractTar");Sr.extractTar=pEe;function yEe(t,e,r){return Bs(this,void 0,void 0,function*(){(0,WG.writeFileSync)(mi.join(t,lt.ManifestFilename),e.join(` -`));let n=yield sw(r,"create");yield ow(n,t)})}o(yEe,"createTar");Sr.createTar=yEe});var ej=m(Yt=>{"use strict";var EEe=Yt&&Yt.__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:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CEe=Yt&&Yt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yd=Yt&&Yt.__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)&&EEe(e,t,r);return CEe(e,t),e},Ql=Yt&&Yt.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}return o(i,"adopt"),new(r||(r=Promise))(function(s,a){function A(u){try{l(n.next(u))}catch(d){a(d)}}o(A,"fulfilled");function c(u){try{l(n.throw(u))}catch(d){a(d)}}o(c,"rejected");function l(u){u.done?s(u.value):i(u.value).then(A,c)}o(l,"step"),l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Yt,"__esModule",{value:!0});Yt.saveCache=Yt.restoreCache=Yt.isFeatureAvailable=Yt.ReserveCacheError=Yt.ValidationError=void 0;var ce=Yd(gr()),LE=Yd(require("path")),pt=Yd(SA()),Il=Yd(Xz()),$G=Yd(VG()),Jd=Gy(),No=XG(),BEe=xA(),ME=Vo(),ei=class t extends Error{static{o(this,"ValidationError")}constructor(e){super(e),this.name="ValidationError",Object.setPrototypeOf(this,t.prototype)}};Yt.ValidationError=ei;var xa=class t extends Error{static{o(this,"ReserveCacheError")}constructor(e){super(e),this.name="ReserveCacheError",Object.setPrototypeOf(this,t.prototype)}};Yt.ReserveCacheError=xa;function ZG(t){if(!t||t.length===0)throw new ei("Path Validation Error: At least one directory or file path is required")}o(ZG,"checkPaths");function aw(t){if(t.length>512)throw new ei(`Key Validation Error: ${t} cannot be larger than 512 characters.`);if(!/^[^,]*$/.test(t))throw new ei(`Key Validation Error: ${t} cannot contain commas.`)}o(aw,"checkKey");function IEe(){switch((0,Jd.getCacheServiceVersion)()){case"v2":return!!process.env.ACTIONS_RESULTS_URL;case"v1":default:return!!process.env.ACTIONS_CACHE_URL}}o(IEe,"isFeatureAvailable");Yt.isFeatureAvailable=IEe;function QEe(t,e,r,n,i=!1){return Ql(this,void 0,void 0,function*(){let s=(0,Jd.getCacheServiceVersion)();switch(ce.debug(`Cache service version: ${s}`),ZG(t),s){case"v2":return yield NEe(t,e,r,n,i);case"v1":default:return yield bEe(t,e,r,n,i)}})}o(QEe,"restoreCache");Yt.restoreCache=QEe;function bEe(t,e,r,n,i=!1){return Ql(this,void 0,void 0,function*(){r=r||[];let s=[e,...r];if(ce.debug("Resolved Keys:"),ce.debug(JSON.stringify(s)),s.length>10)throw new ei("Key Validation Error: Keys are limited to a maximum of 10.");for(let c of s)aw(c);let a=yield pt.getCompressionMethod(),A="";try{let c=yield Il.getCacheEntry(s,t,{compressionMethod:a,enableCrossOsArchive:i});if(!c?.archiveLocation)return;if(n?.lookupOnly)return ce.info("Lookup only - skipping download"),c.cacheKey;A=LE.join(yield pt.createTempDirectory(),pt.getCacheFileName(a)),ce.debug(`Archive Path: ${A}`),yield Il.downloadCache(c.archiveLocation,A,n),ce.isDebug()&&(yield(0,No.listTar)(A,a));let l=pt.getArchiveFileSizeInBytes(A);return ce.info(`Cache Size: ~${Math.round(l/(1024*1024))} MB (${l} B)`),yield(0,No.extractTar)(A,a),ce.info("Cache restored successfully"),c.cacheKey}catch(c){let l=c;if(l.name===ei.name)throw c;l instanceof ME.HttpClientError&&typeof l.statusCode=="number"&&l.statusCode>=500?ce.error(`Failed to restore: ${c.message}`):ce.warning(`Failed to restore: ${c.message}`)}finally{try{yield pt.unlinkFile(A)}catch(c){ce.debug(`Failed to delete archive: ${c}`)}}})}o(bEe,"restoreCacheV1");function NEe(t,e,r,n,i=!1){return Ql(this,void 0,void 0,function*(){n=Object.assign(Object.assign({},n),{useAzureSdk:!0}),r=r||[];let s=[e,...r];if(ce.debug("Resolved Keys:"),ce.debug(JSON.stringify(s)),s.length>10)throw new ei("Key Validation Error: Keys are limited to a maximum of 10.");for(let A of s)aw(A);let a="";try{let A=$G.internalCacheTwirpClient(),c=yield pt.getCompressionMethod(),l={key:e,restoreKeys:r,version:pt.getCacheVersion(t,c,i)},u=yield A.GetCacheEntryDownloadURL(l);if(!u.ok){ce.debug(`Cache not found for version ${l.version} of keys: ${s.join(", ")}`);return}if(l.key!==u.matchedKey?ce.info(`Cache hit for restore-key: ${u.matchedKey}`):ce.info(`Cache hit for: ${u.matchedKey}`),n?.lookupOnly)return ce.info("Lookup only - skipping download"),u.matchedKey;a=LE.join(yield pt.createTempDirectory(),pt.getCacheFileName(c)),ce.debug(`Archive path: ${a}`),ce.debug(`Starting download of archive to: ${a}`),yield Il.downloadCache(u.signedDownloadUrl,a,n);let g=pt.getArchiveFileSizeInBytes(a);return ce.info(`Cache Size: ~${Math.round(g/(1024*1024))} MB (${g} B)`),ce.isDebug()&&(yield(0,No.listTar)(a,c)),yield(0,No.extractTar)(a,c),ce.info("Cache restored successfully"),u.matchedKey}catch(A){let c=A;if(c.name===ei.name)throw A;c instanceof ME.HttpClientError&&typeof c.statusCode=="number"&&c.statusCode>=500?ce.error(`Failed to restore: ${A.message}`):ce.warning(`Failed to restore: ${A.message}`)}finally{try{a&&(yield pt.unlinkFile(a))}catch(A){ce.debug(`Failed to delete archive: ${A}`)}}})}o(NEe,"restoreCacheV2");function xEe(t,e,r,n=!1){return Ql(this,void 0,void 0,function*(){let i=(0,Jd.getCacheServiceVersion)();switch(ce.debug(`Cache service version: ${i}`),ZG(t),aw(e),i){case"v2":return yield SEe(t,e,r,n);case"v1":default:return yield REe(t,e,r,n)}})}o(xEe,"saveCache");Yt.saveCache=xEe;function REe(t,e,r,n=!1){var i,s,a,A,c;return Ql(this,void 0,void 0,function*(){let l=yield pt.getCompressionMethod(),u=-1,d=yield pt.resolvePaths(t);if(ce.debug("Cache Paths:"),ce.debug(`${JSON.stringify(d)}`),d.length===0)throw new Error("Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.");let g=yield pt.createTempDirectory(),p=LE.join(g,pt.getCacheFileName(l));ce.debug(`Archive Path: ${p}`);try{yield(0,No.createTar)(g,d,l),ce.isDebug()&&(yield(0,No.listTar)(p,l));let C=10*1024*1024*1024,I=pt.getArchiveFileSizeInBytes(p);if(ce.debug(`File Size: ${I}`),I>C&&!(0,Jd.isGhes)())throw new Error(`Cache size of ~${Math.round(I/(1024*1024))} MB (${I} B) is over the 10GB limit, not saving cache.`);ce.debug("Reserving Cache");let Q=yield Il.reserveCache(e,t,{compressionMethod:l,enableCrossOsArchive:n,cacheSize:I});if(!((i=Q?.result)===null||i===void 0)&&i.cacheId)u=(s=Q?.result)===null||s===void 0?void 0:s.cacheId;else throw Q?.statusCode===400?new Error((A=(a=Q?.error)===null||a===void 0?void 0:a.message)!==null&&A!==void 0?A:`Cache size of ~${Math.round(I/(1024*1024))} MB (${I} B) is over the data cap limit, not saving cache.`):new xa(`Unable to reserve cache with key ${e}, another job may be creating this cache. More details: ${(c=Q?.error)===null||c===void 0?void 0:c.message}`);ce.debug(`Saving Cache (ID: ${u})`),yield Il.saveCache(u,p,"",r)}catch(C){let I=C;if(I.name===ei.name)throw C;I.name===xa.name?ce.info(`Failed to save: ${I.message}`):I instanceof ME.HttpClientError&&typeof I.statusCode=="number"&&I.statusCode>=500?ce.error(`Failed to save: ${I.message}`):ce.warning(`Failed to save: ${I.message}`)}finally{try{yield pt.unlinkFile(p)}catch(C){ce.debug(`Failed to delete archive: ${C}`)}}return u})}o(REe,"saveCacheV1");function SEe(t,e,r,n=!1){return Ql(this,void 0,void 0,function*(){r=Object.assign(Object.assign({},r),{uploadChunkSize:64*1024*1024,uploadConcurrency:8,useAzureSdk:!0});let i=yield pt.getCompressionMethod(),s=$G.internalCacheTwirpClient(),a=-1,A=yield pt.resolvePaths(t);if(ce.debug("Cache Paths:"),ce.debug(`${JSON.stringify(A)}`),A.length===0)throw new Error("Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.");let c=yield pt.createTempDirectory(),l=LE.join(c,pt.getCacheFileName(i));ce.debug(`Archive Path: ${l}`);try{yield(0,No.createTar)(c,A,i),ce.isDebug()&&(yield(0,No.listTar)(l,i));let u=pt.getArchiveFileSizeInBytes(l);if(ce.debug(`File Size: ${u}`),u>BEe.CacheFileSizeLimit&&!(0,Jd.isGhes)())throw new Error(`Cache size of ~${Math.round(u/(1024*1024))} MB (${u} B) is over the 10GB limit, not saving cache.`);r.archiveSizeBytes=u,ce.debug("Reserving Cache");let d=pt.getCacheVersion(t,i,n),g={key:e,version:d},p;try{let Q=yield s.CreateCacheEntry(g);if(!Q.ok)throw new Error("Response was not ok");p=Q.signedUploadUrl}catch(Q){throw ce.debug(`Failed to reserve cache: ${Q}`),new xa(`Unable to reserve cache with key ${e}, another job may be creating this cache.`)}ce.debug(`Attempting to upload cache located at: ${l}`),yield Il.saveCache(a,l,p,r);let C={key:e,version:d,sizeBytes:`${u}`},I=yield s.FinalizeCacheEntryUpload(C);if(ce.debug(`FinalizeCacheEntryUploadResponse: ${I.ok}`),!I.ok)throw new Error(`Unable to finalize cache with key ${e}, another job may be finalizing this cache.`);a=parseInt(I.entryId)}catch(u){let d=u;if(d.name===ei.name)throw u;d.name===xa.name?ce.info(`Failed to save: ${d.message}`):d instanceof ME.HttpClientError&&typeof d.statusCode=="number"&&d.statusCode>=500?ce.error(`Failed to save: ${d.message}`):ce.warning(`Failed to save: ${d.message}`)}finally{try{yield pt.unlinkFile(l)}catch(u){ce.debug(`Failed to delete archive: ${u}`)}}return a})}o(SEe,"saveCacheV2")});var aj=require("node:os"),ti=Ro(gr());var Aw=require("node:os"),xn=require("node:path"),Vd=require("node:fs"),Ur=Ro(gr()),bl=Ro(ej()),nj=Ro(gu()),ij=Ro(gr());var tj=Ro(gr());async function rj(t,e){let r;for(let n=0;n<=e;n++)try{return await t()}catch(i){r=i,nsetTimeout(s,1e3*(n+1))))}throw r}o(rj,"retry");var wEe="https://registry.npmmirror.com",sj=o(async t=>{let e=t.version||"latest",r=t.registry||"https://registry.npmjs.org/",n=DEe(t),i=t.cacheStore===!0&&(0,bl.isFeatureAvailable)(),s=process.platform==="win32",a=(0,xn.join)((0,Aw.homedir)(),".npm"),A=(0,xn.join)((0,Aw.homedir)(),".cache","nm"),c=s?a:(0,xn.join)(a,"bin"),l=s?(0,xn.join)(a,"node_modules","utoo"):(0,xn.join)(a,"lib","node_modules","utoo"),u=s?".exe":"",d=[(0,xn.join)(c,`utoo${u}`),(0,xn.join)(c,`ut${u}`),...s?[(0,xn.join)(c,"utx.cmd")]:[(0,xn.join)(c,"utx")],l];try{(0,Vd.mkdirSync)(c,{recursive:!0}),(0,Vd.mkdirSync)(A,{recursive:!0})}catch(N){if(N.code!=="EEXIST")throw N}(0,Ur.addPath)(c);let g=(0,xn.join)(c,"utoo"),p,C=!1,I=e;if(n&&(I=await vEe(e,r)),n){let N=`utoo-binary-${I}-${process.platform}-${process.arch}`;(0,Ur.info)(`Attempting to restore Utoo binary cache with key: ${N}`),await(0,bl.restoreCache)(d,N)&&((0,Ur.info)("Restored Utoo binary from cache"),p=await oj(c),p?((0,Ur.info)(`Using cached Utoo version ${p}`),C=!0):(0,Ur.info)("Cached Utoo binary is invalid, will reinstall"))}if(i&&!C){let N=`utoo-store-${r}`;await(0,bl.restoreCache)([A],N)&&(0,Ur.info)("Restored npm cache from store cache")}if(!C&&((0,Ur.info)(`Installing Utoo version ${e} from ${r}`),p=await rj(async()=>await PEe(e,r,c),3),!p))throw new Error("Failed to install Utoo or get its version. Please try again.");return(0,ij.saveState)("cache",JSON.stringify({utooCacheEnabled:n,storeCacheEnabled:i,cacheHit:C,utooPath:g,npmCacheDir:A,utooCachePaths:d,version:p,resolvedVersion:I,registry:r})),r.includes(wEe)||await _Ee(r),{version:p,utooPath:g,cacheHit:C}},"default");async function PEe(t,e,r){let n=t==="latest"?"utoo":`utoo@${t}`,{exitCode:i,stderr:s}=await(0,nj.getExecOutput)("npm",["install","-g",n,`--registry=${e}`,`--prefix=${r.replace(/[/\\]bin$/,"")}`],{ignoreReturnCode:!0});if(i!==0)throw new Error(`Failed to install utoo: ${s}`);let a=await oj(r);if(a)return a;throw new Error("Utoo was installed but package.json could not be found or read")}o(PEe,"installUtoo");function DEe(t){let{cacheUtoo:e}=t;return e?(0,bl.isFeatureAvailable)():!1}o(DEe,"isUtooCacheEnabled");async function _Ee(t){try{let{execSync:e}=require("child_process");e(`ut config set registry ${t} --global`,{stdio:"pipe",shell:!0})}catch(e){(0,Ur.warning)(`Failed to set npm registry: ${e}`)}}o(_Ee,"setRegistry");async function oj(t){let e=t.replace(/[/\\]bin$/,""),r=[(0,xn.join)(e,"lib","node_modules","utoo","package.json"),(0,xn.join)(e,"node_modules","utoo","package.json")];for(let n of r)try{if(!(0,Vd.existsSync)(n))continue;let s=await(await import("node:fs/promises")).readFile(n,"utf-8"),a=JSON.parse(s);if(a.version)return a.version}catch{continue}}o(oj,"getUtooVersion");async function vEe(t,e){if(/^\d+\.\d+\.\d+/.test(t))return t;try{(0,Ur.info)(`Resolving version "${t}" from registry...`);let r=`${e.replace(/\/$/,"")}/utoo/${t}`,n=await fetch(r);if(!n.ok)return(0,Ur.warning)(`Failed to fetch version manifest: ${n.statusText}`),t;let s=(await n.json()).version;if(s)return(0,Ur.info)(`Resolved "${t}" to "${s}"`),s}catch(r){(0,Ur.warning)(`Failed to resolve version: ${r}`)}return t}o(vEe,"resolveVersion");process.env.RUNNER_TEMP||(process.env.RUNNER_TEMP=(0,aj.tmpdir)());sj({version:(0,ti.getInput)("utoo-version")||"latest",registry:(0,ti.getInput)("registry")||"https://registry.npmjs.org/",cacheStore:(0,ti.getBooleanInput)("cache-store")===!0,cacheUtoo:(0,ti.getBooleanInput)("cache-utoo")===!0}).then(({version:t,utooPath:e,cacheHit:r})=>{(0,ti.setOutput)("utoo-version",t),(0,ti.setOutput)("utoo-path",e),(0,ti.setOutput)("cache-hit",r),process.exit(0)}).catch(t=>{(0,ti.setFailed)(t),process.exit(1)}); +`));let n=yield sw(r,"create");yield ow(n,t)})}o(yEe,"createTar");Sr.createTar=yEe});var ej=m(Yt=>{"use strict";var EEe=Yt&&Yt.__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:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CEe=Yt&&Yt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yd=Yt&&Yt.__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)&&EEe(e,t,r);return CEe(e,t),e},Ql=Yt&&Yt.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}return o(i,"adopt"),new(r||(r=Promise))(function(s,a){function A(u){try{l(n.next(u))}catch(d){a(d)}}o(A,"fulfilled");function c(u){try{l(n.throw(u))}catch(d){a(d)}}o(c,"rejected");function l(u){u.done?s(u.value):i(u.value).then(A,c)}o(l,"step"),l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Yt,"__esModule",{value:!0});Yt.saveCache=Yt.restoreCache=Yt.isFeatureAvailable=Yt.ReserveCacheError=Yt.ValidationError=void 0;var ce=Yd(gr()),LE=Yd(require("path")),pt=Yd(SA()),Il=Yd(Xz()),$G=Yd(VG()),Jd=Gy(),No=XG(),BEe=xA(),ME=Vo(),ei=class t extends Error{static{o(this,"ValidationError")}constructor(e){super(e),this.name="ValidationError",Object.setPrototypeOf(this,t.prototype)}};Yt.ValidationError=ei;var xa=class t extends Error{static{o(this,"ReserveCacheError")}constructor(e){super(e),this.name="ReserveCacheError",Object.setPrototypeOf(this,t.prototype)}};Yt.ReserveCacheError=xa;function ZG(t){if(!t||t.length===0)throw new ei("Path Validation Error: At least one directory or file path is required")}o(ZG,"checkPaths");function aw(t){if(t.length>512)throw new ei(`Key Validation Error: ${t} cannot be larger than 512 characters.`);if(!/^[^,]*$/.test(t))throw new ei(`Key Validation Error: ${t} cannot contain commas.`)}o(aw,"checkKey");function IEe(){switch((0,Jd.getCacheServiceVersion)()){case"v2":return!!process.env.ACTIONS_RESULTS_URL;case"v1":default:return!!process.env.ACTIONS_CACHE_URL}}o(IEe,"isFeatureAvailable");Yt.isFeatureAvailable=IEe;function QEe(t,e,r,n,i=!1){return Ql(this,void 0,void 0,function*(){let s=(0,Jd.getCacheServiceVersion)();switch(ce.debug(`Cache service version: ${s}`),ZG(t),s){case"v2":return yield NEe(t,e,r,n,i);case"v1":default:return yield bEe(t,e,r,n,i)}})}o(QEe,"restoreCache");Yt.restoreCache=QEe;function bEe(t,e,r,n,i=!1){return Ql(this,void 0,void 0,function*(){r=r||[];let s=[e,...r];if(ce.debug("Resolved Keys:"),ce.debug(JSON.stringify(s)),s.length>10)throw new ei("Key Validation Error: Keys are limited to a maximum of 10.");for(let c of s)aw(c);let a=yield pt.getCompressionMethod(),A="";try{let c=yield Il.getCacheEntry(s,t,{compressionMethod:a,enableCrossOsArchive:i});if(!c?.archiveLocation)return;if(n?.lookupOnly)return ce.info("Lookup only - skipping download"),c.cacheKey;A=LE.join(yield pt.createTempDirectory(),pt.getCacheFileName(a)),ce.debug(`Archive Path: ${A}`),yield Il.downloadCache(c.archiveLocation,A,n),ce.isDebug()&&(yield(0,No.listTar)(A,a));let l=pt.getArchiveFileSizeInBytes(A);return ce.info(`Cache Size: ~${Math.round(l/(1024*1024))} MB (${l} B)`),yield(0,No.extractTar)(A,a),ce.info("Cache restored successfully"),c.cacheKey}catch(c){let l=c;if(l.name===ei.name)throw c;l instanceof ME.HttpClientError&&typeof l.statusCode=="number"&&l.statusCode>=500?ce.error(`Failed to restore: ${c.message}`):ce.warning(`Failed to restore: ${c.message}`)}finally{try{yield pt.unlinkFile(A)}catch(c){ce.debug(`Failed to delete archive: ${c}`)}}})}o(bEe,"restoreCacheV1");function NEe(t,e,r,n,i=!1){return Ql(this,void 0,void 0,function*(){n=Object.assign(Object.assign({},n),{useAzureSdk:!0}),r=r||[];let s=[e,...r];if(ce.debug("Resolved Keys:"),ce.debug(JSON.stringify(s)),s.length>10)throw new ei("Key Validation Error: Keys are limited to a maximum of 10.");for(let A of s)aw(A);let a="";try{let A=$G.internalCacheTwirpClient(),c=yield pt.getCompressionMethod(),l={key:e,restoreKeys:r,version:pt.getCacheVersion(t,c,i)},u=yield A.GetCacheEntryDownloadURL(l);if(!u.ok){ce.debug(`Cache not found for version ${l.version} of keys: ${s.join(", ")}`);return}if(l.key!==u.matchedKey?ce.info(`Cache hit for restore-key: ${u.matchedKey}`):ce.info(`Cache hit for: ${u.matchedKey}`),n?.lookupOnly)return ce.info("Lookup only - skipping download"),u.matchedKey;a=LE.join(yield pt.createTempDirectory(),pt.getCacheFileName(c)),ce.debug(`Archive path: ${a}`),ce.debug(`Starting download of archive to: ${a}`),yield Il.downloadCache(u.signedDownloadUrl,a,n);let g=pt.getArchiveFileSizeInBytes(a);return ce.info(`Cache Size: ~${Math.round(g/(1024*1024))} MB (${g} B)`),ce.isDebug()&&(yield(0,No.listTar)(a,c)),yield(0,No.extractTar)(a,c),ce.info("Cache restored successfully"),u.matchedKey}catch(A){let c=A;if(c.name===ei.name)throw A;c instanceof ME.HttpClientError&&typeof c.statusCode=="number"&&c.statusCode>=500?ce.error(`Failed to restore: ${A.message}`):ce.warning(`Failed to restore: ${A.message}`)}finally{try{a&&(yield pt.unlinkFile(a))}catch(A){ce.debug(`Failed to delete archive: ${A}`)}}})}o(NEe,"restoreCacheV2");function xEe(t,e,r,n=!1){return Ql(this,void 0,void 0,function*(){let i=(0,Jd.getCacheServiceVersion)();switch(ce.debug(`Cache service version: ${i}`),ZG(t),aw(e),i){case"v2":return yield SEe(t,e,r,n);case"v1":default:return yield REe(t,e,r,n)}})}o(xEe,"saveCache");Yt.saveCache=xEe;function REe(t,e,r,n=!1){var i,s,a,A,c;return Ql(this,void 0,void 0,function*(){let l=yield pt.getCompressionMethod(),u=-1,d=yield pt.resolvePaths(t);if(ce.debug("Cache Paths:"),ce.debug(`${JSON.stringify(d)}`),d.length===0)throw new Error("Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.");let g=yield pt.createTempDirectory(),p=LE.join(g,pt.getCacheFileName(l));ce.debug(`Archive Path: ${p}`);try{yield(0,No.createTar)(g,d,l),ce.isDebug()&&(yield(0,No.listTar)(p,l));let C=10*1024*1024*1024,I=pt.getArchiveFileSizeInBytes(p);if(ce.debug(`File Size: ${I}`),I>C&&!(0,Jd.isGhes)())throw new Error(`Cache size of ~${Math.round(I/(1024*1024))} MB (${I} B) is over the 10GB limit, not saving cache.`);ce.debug("Reserving Cache");let Q=yield Il.reserveCache(e,t,{compressionMethod:l,enableCrossOsArchive:n,cacheSize:I});if(!((i=Q?.result)===null||i===void 0)&&i.cacheId)u=(s=Q?.result)===null||s===void 0?void 0:s.cacheId;else throw Q?.statusCode===400?new Error((A=(a=Q?.error)===null||a===void 0?void 0:a.message)!==null&&A!==void 0?A:`Cache size of ~${Math.round(I/(1024*1024))} MB (${I} B) is over the data cap limit, not saving cache.`):new xa(`Unable to reserve cache with key ${e}, another job may be creating this cache. More details: ${(c=Q?.error)===null||c===void 0?void 0:c.message}`);ce.debug(`Saving Cache (ID: ${u})`),yield Il.saveCache(u,p,"",r)}catch(C){let I=C;if(I.name===ei.name)throw C;I.name===xa.name?ce.info(`Failed to save: ${I.message}`):I instanceof ME.HttpClientError&&typeof I.statusCode=="number"&&I.statusCode>=500?ce.error(`Failed to save: ${I.message}`):ce.warning(`Failed to save: ${I.message}`)}finally{try{yield pt.unlinkFile(p)}catch(C){ce.debug(`Failed to delete archive: ${C}`)}}return u})}o(REe,"saveCacheV1");function SEe(t,e,r,n=!1){return Ql(this,void 0,void 0,function*(){r=Object.assign(Object.assign({},r),{uploadChunkSize:64*1024*1024,uploadConcurrency:8,useAzureSdk:!0});let i=yield pt.getCompressionMethod(),s=$G.internalCacheTwirpClient(),a=-1,A=yield pt.resolvePaths(t);if(ce.debug("Cache Paths:"),ce.debug(`${JSON.stringify(A)}`),A.length===0)throw new Error("Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.");let c=yield pt.createTempDirectory(),l=LE.join(c,pt.getCacheFileName(i));ce.debug(`Archive Path: ${l}`);try{yield(0,No.createTar)(c,A,i),ce.isDebug()&&(yield(0,No.listTar)(l,i));let u=pt.getArchiveFileSizeInBytes(l);if(ce.debug(`File Size: ${u}`),u>BEe.CacheFileSizeLimit&&!(0,Jd.isGhes)())throw new Error(`Cache size of ~${Math.round(u/(1024*1024))} MB (${u} B) is over the 10GB limit, not saving cache.`);r.archiveSizeBytes=u,ce.debug("Reserving Cache");let d=pt.getCacheVersion(t,i,n),g={key:e,version:d},p;try{let Q=yield s.CreateCacheEntry(g);if(!Q.ok)throw new Error("Response was not ok");p=Q.signedUploadUrl}catch(Q){throw ce.debug(`Failed to reserve cache: ${Q}`),new xa(`Unable to reserve cache with key ${e}, another job may be creating this cache.`)}ce.debug(`Attempting to upload cache located at: ${l}`),yield Il.saveCache(a,l,p,r);let C={key:e,version:d,sizeBytes:`${u}`},I=yield s.FinalizeCacheEntryUpload(C);if(ce.debug(`FinalizeCacheEntryUploadResponse: ${I.ok}`),!I.ok)throw new Error(`Unable to finalize cache with key ${e}, another job may be finalizing this cache.`);a=parseInt(I.entryId)}catch(u){let d=u;if(d.name===ei.name)throw u;d.name===xa.name?ce.info(`Failed to save: ${d.message}`):d instanceof ME.HttpClientError&&typeof d.statusCode=="number"&&d.statusCode>=500?ce.error(`Failed to save: ${d.message}`):ce.warning(`Failed to save: ${d.message}`)}finally{try{yield pt.unlinkFile(l)}catch(u){ce.debug(`Failed to delete archive: ${u}`)}}return a})}o(SEe,"saveCacheV2")});var aj=require("node:os"),ti=Ro(gr());var Aw=require("node:os"),xn=require("node:path"),Vd=require("node:fs"),Ur=Ro(gr()),bl=Ro(ej()),nj=Ro(gu()),ij=Ro(gr());var tj=Ro(gr());async function rj(t,e){let r;for(let n=0;n<=e;n++)try{return await t()}catch(i){r=i,nsetTimeout(s,1e3*(n+1))))}throw r}o(rj,"retry");var wEe="https://registry.npmmirror.com",sj=o(async t=>{let e=t.version||"latest",r=(t.registry||"https://registry.npmjs.org").replace(/\/+$/,""),n=DEe(t),i=t.cacheStore===!0&&(0,bl.isFeatureAvailable)(),s=process.platform==="win32",a=(0,xn.join)((0,Aw.homedir)(),".npm"),A=(0,xn.join)((0,Aw.homedir)(),".cache","nm"),c=s?a:(0,xn.join)(a,"bin"),l=s?(0,xn.join)(a,"node_modules","utoo"):(0,xn.join)(a,"lib","node_modules","utoo"),u=s?".exe":"",d=[(0,xn.join)(c,`utoo${u}`),(0,xn.join)(c,`ut${u}`),...s?[(0,xn.join)(c,"utx.cmd")]:[(0,xn.join)(c,"utx")],l];try{(0,Vd.mkdirSync)(c,{recursive:!0}),(0,Vd.mkdirSync)(A,{recursive:!0})}catch(N){if(N.code!=="EEXIST")throw N}(0,Ur.addPath)(c);let g=(0,xn.join)(c,"utoo"),p,C=!1,I=e;if(n&&(I=await vEe(e,r)),n){let N=`utoo-binary-${I}-${process.platform}-${process.arch}`;(0,Ur.info)(`Attempting to restore Utoo binary cache with key: ${N}`),await(0,bl.restoreCache)(d,N)&&((0,Ur.info)("Restored Utoo binary from cache"),p=await oj(c),p?((0,Ur.info)(`Using cached Utoo version ${p}`),C=!0):(0,Ur.info)("Cached Utoo binary is invalid, will reinstall"))}if(i&&!C){let N=`utoo-store-${r}`;await(0,bl.restoreCache)([A],N)&&(0,Ur.info)("Restored npm cache from store cache")}if(!C&&((0,Ur.info)(`Installing Utoo version ${e} from ${r}`),p=await rj(async()=>await PEe(e,r,c),3),!p))throw new Error("Failed to install Utoo or get its version. Please try again.");return(0,ij.saveState)("cache",JSON.stringify({utooCacheEnabled:n,storeCacheEnabled:i,cacheHit:C,utooPath:g,npmCacheDir:A,utooCachePaths:d,version:p,resolvedVersion:I,registry:r})),r.includes(wEe)||await _Ee(r),{version:p,utooPath:g,cacheHit:C}},"default");async function PEe(t,e,r){let n=t==="latest"?"utoo":`utoo@${t}`,{exitCode:i,stderr:s}=await(0,nj.getExecOutput)("npm",["install","-g",n,`--registry=${e}`,`--prefix=${r.replace(/[/\\]bin$/,"")}`],{ignoreReturnCode:!0});if(i!==0)throw new Error(`Failed to install utoo: ${s}`);let a=await oj(r);if(a)return a;throw new Error("Utoo was installed but package.json could not be found or read")}o(PEe,"installUtoo");function DEe(t){let{cacheUtoo:e}=t;return e?(0,bl.isFeatureAvailable)():!1}o(DEe,"isUtooCacheEnabled");async function _Ee(t){try{let{execSync:e}=require("child_process");e(`ut config set registry ${t} --global`,{stdio:"pipe",shell:!0})}catch(e){(0,Ur.warning)(`Failed to set npm registry: ${e}`)}}o(_Ee,"setRegistry");async function oj(t){let e=t.replace(/[/\\]bin$/,""),r=[(0,xn.join)(e,"lib","node_modules","utoo","package.json"),(0,xn.join)(e,"node_modules","utoo","package.json")];for(let n of r)try{if(!(0,Vd.existsSync)(n))continue;let s=await(await import("node:fs/promises")).readFile(n,"utf-8"),a=JSON.parse(s);if(a.version)return a.version}catch{continue}}o(oj,"getUtooVersion");async function vEe(t,e){if(/^\d+\.\d+\.\d+/.test(t))return t;try{(0,Ur.info)(`Resolving version "${t}" from registry...`);let r=`${e.replace(/\/$/,"")}/utoo/${t}`,n=await fetch(r);if(!n.ok)return(0,Ur.warning)(`Failed to fetch version manifest: ${n.statusText}`),t;let s=(await n.json()).version;if(s)return(0,Ur.info)(`Resolved "${t}" to "${s}"`),s}catch(r){(0,Ur.warning)(`Failed to resolve version: ${r}`)}return t}o(vEe,"resolveVersion");process.env.RUNNER_TEMP||(process.env.RUNNER_TEMP=(0,aj.tmpdir)());sj({version:(0,ti.getInput)("utoo-version")||"latest",registry:(0,ti.getInput)("registry")||"https://registry.npmjs.org",cacheStore:(0,ti.getBooleanInput)("cache-store")===!0,cacheUtoo:(0,ti.getBooleanInput)("cache-utoo")===!0}).then(({version:t,utooPath:e,cacheHit:r})=>{(0,ti.setOutput)("utoo-version",t),(0,ti.setOutput)("utoo-path",e),(0,ti.setOutput)("cache-hit",r),process.exit(0)}).catch(t=>{(0,ti.setFailed)(t),process.exit(1)}); /*! Bundled license information: undici/lib/fetch/body.js: diff --git a/src/action.ts b/src/action.ts index 2a48495..2c77b94 100644 --- a/src/action.ts +++ b/src/action.ts @@ -36,7 +36,10 @@ export type CacheState = { export default async (options: Input): Promise => { const version = options.version || "latest"; - const registry = options.registry || "https://registry.npmjs.org/"; + const registry = (options.registry || "https://registry.npmjs.org").replace( + /\/+$/, + "", + ); const utooCacheEnabled = isUtooCacheEnabled(options); const storeCacheEnabled = options.cacheStore === true && isFeatureAvailable(); diff --git a/src/index.ts b/src/index.ts index 3872c06..ab6c92a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,7 +8,7 @@ if (!process.env.RUNNER_TEMP) { runAction({ version: getInput("utoo-version") || "latest", - registry: getInput("registry") || "https://registry.npmjs.org/", + registry: getInput("registry") || "https://registry.npmjs.org", cacheStore: getBooleanInput("cache-store") === true, // Default false cacheUtoo: getBooleanInput("cache-utoo") === true, // Default true })