@monoai/nscloud-nx-cache-action 0.0.0-stage → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as bundleCreateRequire } from 'node:module';
3
+ const require = bundleCreateRequire(import.meta.url);
4
+ var rc=Object.defineProperty;var s=(e,t)=>rc(e,"name",{value:t,configurable:!0});import{constants as ee}from"node:fs";var Ln=ee.S_IRUSR|ee.S_IWUSR,Cn=Ln|ee.S_IXUSR,jr=ee.S_IRGRP|ee.S_IXGRP,Qr=ee.S_IROTH|ee.S_IXOTH,Fe=Object.freeze({OwnerOnlyFile:Ln,OwnerOnlyDirectory:Cn,Executable:Cn|jr|Qr,ReadableFile:Ln|ee.S_IRGRP|ee.S_IROTH,Mask:Cn|jr|ee.S_IWGRP|Qr|ee.S_IWOTH}),_t=Object.freeze({Read:"r",ExclusiveWrite:"wx"});import{resolve as sc}from"node:path";var ge=Object.freeze({ReadOnly:"read-only",ReadWrite:"read-write"}),Ue=Object.freeze({FailOpen:"fail-open",Strict:"strict"}),at="ord",eo=10*1073741824,Ct=2*1073741824,kn=512*1048576,Lt=4*1024,to=168,no=to*36e5,ro=eo-Ct;function Rt(e,t,n){let r=e[t],o=r===void 0?n:Number(r);if(!Number.isSafeInteger(o)||o<1)throw new Error(`Invalid ${t}`);return o}s(Rt,"integer");function oo(e){let t=e.NX_ARCHIVE_DIRECTORY;if(!t)throw new Error("NX_ARCHIVE_DIRECTORY is required");let n=e.NX_CACHE_FAILURE_MODE??Ue.FailOpen;if(n!==Ue.Strict&&n!==Ue.FailOpen)throw new Error("Invalid cache failure mode");let r=e.NX_CACHE_ACCESS??ge.ReadWrite;if(r!==ge.ReadOnly&&r!==ge.ReadWrite)throw new Error("Invalid cache access mode");let o=e.NX_CACHE_REMOTE_ACCESS??ge.ReadWrite;if(o!==ge.ReadOnly&&o!==ge.ReadWrite)throw new Error("Invalid remote cache access mode");let a=Rt(e,"NX_CACHE_DISK_BYTES",eo),i=Rt(e,"NX_CACHE_EXTRACTION_BYTES",Ct),c=Rt(e,"NX_CACHE_ARCHIVE_BYTES",kn);if(a-i<c+Lt)throw new Error("Cache disk budget is too small");return{directory:sc(t),strict:n===Ue.Strict,readOnly:r===ge.ReadOnly,remoteReadOnly:o===ge.ReadOnly,maxDiskBytes:a-i,extractionBytes:i,maxArchiveBytes:c,maxAgeMs:Rt(e,"NX_CACHE_RETENTION_HOURS",to)*36e5}}s(oo,"configuration");import{mkdir as lo,open as st,lstat as it,rename as Ft,rm as Ut,utimes as mc}from"node:fs/promises";import{constants as Dt}from"node:fs";import{basename as dc,join as te}from"node:path";import{createHash as fo,randomUUID as mo}from"node:crypto";import{lstat as ao,readdir as io,rm as so,statfs as cc,mkdir as uc}from"node:fs/promises";import{join as co}from"node:path";var lc=36e5,uo=16;function fc(e){return e instanceof Error&&"code"in e&&e.code==="ENOENT"}s(fc,"disappeared");var kt=class{constructor(t,n,r){this.directory=t;this.bytes=n;this.trace=r;if(!Number.isSafeInteger(n)||n<1)throw new Error("Invalid disk budget")}directory;bytes;trace;static{s(this,"DiskBudget")}reserved=0;admission=Promise.resolve();async entries(){let t=await io(this.directory),n=[],r=s(async o=>{let a=co(this.directory,o);try{let i=await ao(a);if(/^\.tmp-[a-zA-Z0-9_-]+$/.test(o)){Date.now()-i.mtimeMs>lc&&await so(a,{recursive:!0,force:!0});return}if(!/^[a-zA-Z0-9_-]{1,128}$/.test(o)||!i.isDirectory())return;let c=0;for(let u of await io(a))c+=(await ao(co(a,u))).size;return{entry:a,size:c,modified:i.mtimeMs}}catch(i){if(!fc(i))throw i;return}},"inspect");for(let o=0;o<t.length;o+=uo){let a=await Promise.allSettled(t.slice(o,o+uo).map(r));for(let i of a){if(i.status==="rejected")throw i.reason;i.value&&n.push(i.value)}}return n.sort((o,a)=>o.modified-a.modified)}async reserve(t){if(!Number.isSafeInteger(t)||t<1||t>this.bytes)throw new Error("Invalid disk reservation");let n=this.admission,r=s(()=>{},"unlock");this.admission=new Promise(a=>{r=a});let o=this.trace?.begin("disk.queue");await n,o?.();try{await uc(this.directory,{recursive:!0,mode:Fe.OwnerOnlyDirectory});let a=this.reserved,i=this.trace?.begin("disk.scan"),c;try{c=await this.entries()}finally{i?.()}let u=c.reduce((h,p)=>h+p.size,0);for(let h of c){if(u+a+t<=this.bytes)break;let p=this.trace?.begin("disk.evict");try{await so(h.entry,{recursive:!0,force:!0})}finally{p?.({bytes:h.size})}u-=h.size}if(u+a+t>this.bytes)throw new Error("Cache disk budget exhausted");let l=this.trace?.begin("disk.statfs"),f=await cc(this.directory).finally(()=>l?.({entries:c.length,reservedBytes:a+t}));if(f.bavail*f.bsize<this.reserved+t)throw new Error("Insufficient cache disk space");this.reserved+=t;let d=!1;return()=>{d||(d=!0,this.reserved-=t)}}finally{r()}}};var pc=3,ho=1;function ue(e,t){return e instanceof Error&&"code"in e&&e.code===t}s(ue,"isCode");function ct(e){if(!/^[a-zA-Z0-9_-]{1,128}$/.test(e))throw new Error("Invalid cache hash")}s(ct,"validateHash");var Y=class extends Error{static{s(this,"CacheIntegrityError")}};function hc(e){return typeof e=="object"&&e!==null}s(hc,"isRecord");function yc(e){if(!hc(e))throw new Y("Invalid archive metadata");let{version:t,bytes:n,digest:r,createdAt:o}=e,a=t===ho,i=typeof n=="number"&&Number.isSafeInteger(n)&&n>0,c=typeof r=="string"&&/^[a-f0-9]{64}$/.test(r),u=typeof o=="number"&&Number.isSafeInteger(o);if(!a||!i||!c||!u)throw new Y("Invalid archive metadata");return{version:t,bytes:n,digest:r,createdAt:o}}s(yc,"parseArchiveMetadata");async function po(e,t){if(process.platform==="win32")return;let n=await st(e,_t.Read),r=t?.begin("local.directory-fsync");try{await n.sync()}finally{await n.close(),r?.()}}s(po,"syncDirectory");var Vt=class{static{s(this,"LocalStore")}directory;maxBytes;maxAgeMs;budget;trace;locks=new Map;constructor(t,n={}){let r=typeof n=="number"?{maxArchiveBytes:n}:n;if(this.directory=te(t,"entries-v1"),this.maxBytes=r.maxArchiveBytes??kn,this.maxAgeMs=r.maxAgeMs??no,this.trace=r.trace,this.budget=new kt(this.directory,r.maxDiskBytes??ro,this.trace),!Number.isSafeInteger(this.maxBytes)||this.maxBytes<1||!Number.isSafeInteger(this.maxAgeMs)||this.maxAgeMs<1)throw new Error("Invalid local store limits")}async withHashLock(t,n){let r=this.locks.get(t)??Promise.resolve(),o=s(()=>{},"unlock"),a=new Promise(c=>{o=c});this.locks.set(t,a);let i=this.trace?.begin("local.hash-lock");await r,i?.();try{return await n()}finally{this.locks.get(t)===a&&this.locks.delete(t),o()}}async get(t,n){ct(t);let r=this.trace?.begin("local.lookup");try{return await this.withHashLock(t,()=>this.getUnlocked(t,n))}finally{r?.()}}async getUnlocked(t,n){let r=te(this.directory,t),o;try{let a=await it(r);if(o=a,!a.isDirectory()||a.isSymbolicLink())throw new Y("Invalid archive directory");let i=te(r,"metadata.json"),c=await it(i);if(!c.isFile()||c.isSymbolicLink()||c.size>Lt)throw new Y("Invalid archive metadata file");let u,l=this.trace?.begin("local.metadata");try{let E=await st(i,Dt.O_RDONLY|(Dt.O_NOFOLLOW??0));try{u=yc(JSON.parse(await E.readFile("utf8")))}finally{await E.close()}}catch{throw new Y("Invalid archive metadata")}finally{l?.()}if(Date.now()-u.createdAt>this.maxAgeMs)return await this.removeObserved(r,a),null;let f=te(r,"archive"),d=await it(f);if(!d.isFile()||d.isSymbolicLink()||d.size!==u.bytes||d.size>this.maxBytes)throw new Y("Archive size mismatch");let h=fo("sha256"),p=await st(f,Dt.O_RDONLY|(Dt.O_NOFOLLOW??0)),y=this.trace?.begin("local.verify");try{for await(let E of p.createReadStream())h.update(E)}finally{await p.close(),y?.({bytes:d.size})}if(h.digest("hex")!==u.digest)throw new Y("Archive digest mismatch");let g=new Date,N=this.trace?.begin("local.touch");try{await mc(r,g,g)}finally{N?.()}return f}catch(a){if(ue(a,"ENOENT"))return o&&(await this.removeObserved(r,o),n?.(new Y("Incomplete archive entry"))),null;if(a instanceof Y)return o&&await this.removeObserved(r,o),n?.(a),null;throw a}}async removeObserved(t,n){let r;try{r=await it(t)}catch(i){if(ue(i,"ENOENT"))return;throw i}if(r.dev!==n.dev||r.ino!==n.ino)return;let o=te(this.directory,`.tmp-corrupt-${mo()}`);try{await Ft(t,o)}catch(i){if(ue(i,"ENOENT"))return;throw i}let a=await it(o);if(a.dev!==n.dev||a.ino!==n.ino){for(let i=0;i<pc;i++)try{await Ft(o,t);return}catch(c){if(!ue(c,"EEXIST")&&!ue(c,"ENOTEMPTY"))throw c;if(await this.getUnlocked(dc(t))){await Ut(o,{recursive:!0,force:!0});return}}throw new Y("Could not restore displaced archive")}await Ut(o,{recursive:!0,force:!0})}async remove(t){ct(t),await this.withHashLock(t,()=>Ut(te(this.directory,t),{recursive:!0,force:!0}))}async receive(t,n,r){ct(t),await lo(this.directory,{recursive:!0});let o=te(this.directory,t),a=te(this.directory,`.tmp-${t}-${mo()}`),i=this.trace?.begin("local.receive"),c;try{c=await this.budget.reserve(this.maxBytes+Lt),await lo(a,{mode:Fe.OwnerOnlyDirectory});let u=await st(te(a,"archive"),_t.ExclusiveWrite,Fe.OwnerOnlyFile),l=0,f=fo("sha256");try{for await(let g of n){if(r?.aborted)throw r.reason;if(l+=g.length,l>this.maxBytes)throw new Error("Archive exceeds byte limit");f.update(g);let N=this.trace?.begin("local.write");try{await u.writeFile(g)}finally{N?.({bytes:g.length,chunks:1})}}if(r?.aborted)throw r.reason;if(!l)throw new Y("Empty archive");let d=this.trace?.begin("local.fsync");try{await u.sync()}finally{d?.({bytes:l})}await u.close();let h={version:ho,bytes:l,digest:f.digest("hex"),createdAt:Date.now()},p=await st(te(a,"metadata.json"),_t.ExclusiveWrite,Fe.OwnerOnlyFile);try{let g=this.trace?.begin("local.metadata-write");try{await p.writeFile(JSON.stringify(h))}finally{g?.()}let N=this.trace?.begin("local.metadata-fsync");try{await p.sync()}finally{N?.()}}finally{await p.close()}await po(a,this.trace);let y=this.trace?.begin("local.commit");try{return await this.withHashLock(t,async()=>{let g=await this.getUnlocked(t);if(g)return{file:g,created:!1,bytes:l};try{await Ft(a,o)}catch(N){if(!ue(N,"EEXIST")&&!ue(N,"ENOTEMPTY"))throw N;let E=await this.getUnlocked(t);if(E)return{file:E,created:!1,bytes:l};try{await Ft(a,o)}catch(S){if(!ue(S,"EEXIST")&&!ue(S,"ENOTEMPTY"))throw S;let T=await this.getUnlocked(t);if(T)return{file:T,created:!1,bytes:l};throw S}}return await po(this.directory,this.trace),{file:te(o,"archive"),created:!0,bytes:l}})}finally{y?.()}}finally{await u.close(),await Ut(a,{recursive:!0,force:!0})}}finally{c?.(),i?.()}}};var b;(function(e){e[e.Canceled=1]="Canceled",e[e.Unknown=2]="Unknown",e[e.InvalidArgument=3]="InvalidArgument",e[e.DeadlineExceeded=4]="DeadlineExceeded",e[e.NotFound=5]="NotFound",e[e.AlreadyExists=6]="AlreadyExists",e[e.PermissionDenied=7]="PermissionDenied",e[e.ResourceExhausted=8]="ResourceExhausted",e[e.FailedPrecondition=9]="FailedPrecondition",e[e.Aborted=10]="Aborted",e[e.OutOfRange=11]="OutOfRange",e[e.Unimplemented=12]="Unimplemented",e[e.Internal=13]="Internal",e[e.Unavailable=14]="Unavailable",e[e.DataLoss=15]="DataLoss",e[e.Unauthenticated=16]="Unauthenticated"})(b||(b={}));function ut(e,t){return e!==null&&typeof e=="object"&&"$typeName"in e&&typeof e.$typeName=="string"?t===void 0?!0:t.typeName===e.$typeName:!1}s(ut,"isMessage");var m;(function(e){e[e.DOUBLE=1]="DOUBLE",e[e.FLOAT=2]="FLOAT",e[e.INT64=3]="INT64",e[e.UINT64=4]="UINT64",e[e.INT32=5]="INT32",e[e.FIXED64=6]="FIXED64",e[e.FIXED32=7]="FIXED32",e[e.BOOL=8]="BOOL",e[e.STRING=9]="STRING",e[e.BYTES=12]="BYTES",e[e.UINT32=13]="UINT32",e[e.SFIXED32=15]="SFIXED32",e[e.SFIXED64=16]="SFIXED64",e[e.SINT32=17]="SINT32",e[e.SINT64=18]="SINT64"})(m||(m={}));function bo(){let e=this.buf,t=this.pos,n=0,r=0;for(let a=0;a<28;a+=7){let i=e[t++];if(n|=(i&127)<<a,(i&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}}let o=e[t++];if(n|=(o&15)<<28,r=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}for(let a=3;a<=31;a+=7){let i=e[t++];if(r|=(i&127)<<a,(i&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}}throw new Error("invalid varint")}s(bo,"varint64read");var Mt=4294967296;function Fn(e){let t=e[0]==="-";t&&(e=e.slice(1));let n=1e6,r=0,o=0;function a(i,c){let u=Number(e.slice(i,c));o*=n,r=r*n+u,r>=Mt&&(o=o+(r/Mt|0),r=r%Mt)}return s(a,"add1e6digit"),a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?Eo(r,o):Dn(r,o)}s(Fn,"int64FromString");function go(e,t){let n=Dn(e,t),r=n.hi&2147483648;r&&(n=Eo(n.lo,n.hi));let o=Un(n.lo,n.hi);return r?"-"+o:o}s(go,"int64ToString");function Un(e,t){if({lo:e,hi:t}=bc(e,t),t<=2097151)return String(Mt*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,o=t>>16&65535,a=n+r*6777216+o*6710656,i=r+o*8147497,c=o*2,u=1e7;return a>=u&&(i+=Math.floor(a/u),a%=u),i>=u&&(c+=Math.floor(i/u),i%=u),c.toString()+yo(i)+yo(a)}s(Un,"uInt64ToString");function bc(e,t){return{lo:e>>>0,hi:t>>>0}}s(bc,"toUnsigned");function Dn(e,t){return{lo:e|0,hi:t|0}}s(Dn,"newBits");function Eo(e,t){return t=~t,e?e=~e+1:t+=1,Dn(e,t)}s(Eo,"negate");var yo=s(e=>{let t=String(e);return"0000000".slice(t.length)+t},"decimalFrom1e7WithLeadingZeros");function No(e,t){if(e>>>0<128){t.push(e);return}if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e=e>>7;t.push(1)}}s(No,"varint32write");function wo(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let n=5;(e&128)!==0&&n<10;n++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}s(wo,"varint32read");var x=gc();function gc(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!globalThis.Deno||!!globalThis.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let n=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),o=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(i){let c=typeof i=="bigint"?i:BigInt(i);if(c>r||c<n)throw new Error(`invalid int64: ${i}`);return c},uParse(i){let c=typeof i=="bigint"?i:BigInt(i);if(c>a||c<o)throw new Error(`invalid uint64: ${i}`);return c},enc(i){return e.setBigInt64(0,this.parse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(i){return e.setBigInt64(0,this.uParse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(i,c){return e.setInt32(0,i,!0),e.setInt32(4,c,!0),e.getBigInt64(0,!0)},uDec(i,c){return e.setInt32(0,i,!0),e.setInt32(4,c,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(n){return typeof n!="string"&&(n=n.toString()),So(n),n},uParse(n){return typeof n!="string"&&(n=n.toString()),To(n),n},enc(n){return typeof n!="string"&&(n=n.toString()),So(n),Fn(n)},uEnc(n){return typeof n!="string"&&(n=n.toString()),To(n),Fn(n)},dec(n,r){return go(n,r)},uDec(n,r){return Un(n,r)}}}s(gc,"makeInt64Support");function So(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}s(So,"assertInt64String");function To(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}s(To,"assertUInt64String");function G(e,t){switch(e){case m.STRING:return"";case m.BOOL:return!1;case m.DOUBLE:case m.FLOAT:return 0;case m.INT64:case m.UINT64:case m.SFIXED64:case m.FIXED64:case m.SINT64:return t?"0":x.zero;case m.BYTES:return new Uint8Array(0);default:return 0}}s(G,"scalarZeroValue");function vo(e,t){switch(e){case m.BOOL:return t===!1;case m.STRING:return t==="";case m.BYTES:return t instanceof Uint8Array&&!t.byteLength;case m.DOUBLE:case m.FLOAT:return Object.is(t,0);default:return t==0}}s(vo,"isScalarZeroValue");var Io=2,M=Symbol.for("reflect unsafe local");function xo(e,t){let n=e[t.localName].case;return n===void 0?n:t.fields.find(r=>r.localName===n)}s(xo,"unsafeOneofCase");function Ao(e,t){let n=t.localName;if(t.oneof)return e[t.oneof.localName].case===n;if(t.presence!=Io)return e[n]!==void 0&&Object.prototype.hasOwnProperty.call(e,n);switch(t.fieldKind){case"list":return e[n].length>0;case"map":return Object.keys(e[n]).length>0;case"scalar":return!vo(t.scalar,e[n]);case"enum":return e[n]!==t.enum.values[0].number}throw new Error("message field with implicit presence")}s(Ao,"unsafeIsSet");function Te(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0}s(Te,"unsafeIsSetExplicit");function _o(e,t){if(t.oneof){let n=e[t.oneof.localName];return n.case===t.localName?n.value:void 0}return e[t.localName]}s(_o,"unsafeGet");function Ro(e,t,n){t.oneof?e[t.oneof.localName]={case:t.localName,value:n}:e[t.localName]=n}s(Ro,"unsafeSet");function Oo(e,t){let n=t.localName;if(t.oneof){let r=t.oneof.localName;e[r].case===n&&(e[r]={case:void 0})}else if(t.presence!=Io)delete e[n];else switch(t.fieldKind){case"map":e[n]={};break;case"list":e[n]=[];break;case"enum":e[n]=t.enum.values[0].number;break;case"scalar":e[n]=G(t.scalar,t.longAsString);break}}s(Oo,"unsafeClear");function ne(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}s(ne,"isObject");function lt(e,t){var n,r,o,a;if(ne(e)&&M in e&&"add"in e&&"field"in e&&typeof e.field=="function"){if(t!==void 0){let i=t,c=e.field();return i.listKind==c.listKind&&i.scalar===c.scalar&&((n=i.message)===null||n===void 0?void 0:n.typeName)===((r=c.message)===null||r===void 0?void 0:r.typeName)&&((o=i.enum)===null||o===void 0?void 0:o.typeName)===((a=c.enum)===null||a===void 0?void 0:a.typeName)}return!0}return!1}s(lt,"isReflectList");function ft(e,t){var n,r,o,a;if(ne(e)&&M in e&&"has"in e&&"field"in e&&typeof e.field=="function"){if(t!==void 0){let i=t,c=e.field();return i.mapKey===c.mapKey&&i.mapKind==c.mapKind&&i.scalar===c.scalar&&((n=i.message)===null||n===void 0?void 0:n.typeName)===((r=c.message)===null||r===void 0?void 0:r.typeName)&&((o=i.enum)===null||o===void 0?void 0:o.typeName)===((a=c.enum)===null||a===void 0?void 0:a.typeName)}return!0}return!1}s(ft,"isReflectMap");function mt(e,t){return ne(e)&&M in e&&"desc"in e&&ne(e.desc)&&e.desc.kind==="message"&&(t===void 0||e.desc.typeName==t.typeName)}s(mt,"isReflectMessage");function Co(e){return Lo(e.$typeName)}s(Co,"isWrapper");function J(e){let t=e.fields[0];return Lo(e.typeName)&&t!==void 0&&t.fieldKind=="scalar"&&t.name=="value"&&t.number==1}s(J,"isWrapperDesc");function Pt(e){switch(e.typeName){case"google.protobuf.Any":case"google.protobuf.Timestamp":case"google.protobuf.Duration":case"google.protobuf.FieldMask":case"google.protobuf.Struct":case"google.protobuf.Value":case"google.protobuf.ListValue":return!0;default:return J(e)}}s(Pt,"hasCustomJsonRepresentation");var Ec=new Set(["google.protobuf.DoubleValue","google.protobuf.FloatValue","google.protobuf.Int64Value","google.protobuf.UInt64Value","google.protobuf.Int32Value","google.protobuf.UInt32Value","google.protobuf.BoolValue","google.protobuf.StringValue","google.protobuf.BytesValue"]);function Lo(e){return Ec.has(e)}s(Lo,"isWrapperTypeName");var Nc=999,wc=998,Fo=2;function L(e,t){return ut(t,e)?t:Uo(e)(t)}s(L,"create");var ko=new WeakMap;function Uo(e){let t=ko.get(e);return t===void 0&&(t=Sc(e),ko.set(e,t)),t}s(Uo,"compiledCreate");var Vn=0,Do=1,Vo=2,Mo=3;function Sc(e){let t=e.typeName,{properties:n,prototype:r}=Tc(e);return o=>{let a;r!==void 0?(a=Object.create(r),a.$typeName=t):a={$typeName:t};for(let i=0;i<n.length;i++){let c=n[i],u=c.name,l=o?.[u];switch(c.kind){case Vn:l!=null?a[u]=c.convert!==void 0?c.convert(l):l:c.constant!==void 0&&(a[u]=c.constant);break;case Do:a[u]=c.convert!==void 0&&Array.isArray(l)?l.map(c.convert):l??[];break;case Vo:if(c.convert===void 0||!ne(l))a[u]=l??{};else{let f={},d=Object.keys(l);for(let h=0;h<d.length;h++)f[d[h]]=c.convert(l[d[h]]);a[u]=f}break;case Mo:{let f=l;if(f?.case!=null){let d=c.convert.get(f.case);if(d!==void 0){a[u]={case:f.case,value:d(f.value)};break}}a[u]={case:void 0};break}}}return a}}s(Sc,"compileCreate");function Tc(e){var t,n;let r=[],o={},a=Ic(e);for(let i of e.members){let c=i.localName;if(i.kind=="oneof"){r.push({name:c,kind:Mo,constant:void 0,convert:vc(i)});continue}switch(i.fieldKind){case"message":{r.push({name:c,kind:Vn,constant:void 0,convert:Yt(i)});break}case"list":{r.push({name:c,kind:Do,constant:void 0,convert:i.listKind=="message"?(t=Yt(i))!==null&&t!==void 0?t:(u=>u):i.scalar==m.BYTES?dt:void 0});break}case"map":{r.push({name:c,kind:Vo,constant:void 0,convert:i.mapKind=="message"?(n=Yt(i))!==null&&n!==void 0?n:(u=>u):i.scalar==m.BYTES?dt:void 0});break}default:{let u=xc(i);r.push({name:c,kind:Vn,constant:i.presence==Fo?u:void 0,convert:i.fieldKind=="scalar"&&i.scalar==m.BYTES?dt:void 0}),a&&(o[c]=u);break}}}return{properties:r,prototype:a?o:void 0}}s(Tc,"compileInitMessage");function vc(e){let t=new Map;for(let n of e.fields){let r;n.fieldKind=="message"?r=Yt(n):n.fieldKind=="scalar"&&n.scalar==m.BYTES&&(r=dt),t.set(n.localName,r??(o=>o))}return t}s(vc,"compileConvertOneof");function Yt(e){if(e.fieldKind=="message"&&!e.oneof&&J(e.message))return e.message.fields[0].scalar==m.BYTES?dt:void 0;if(e.message.typeName=="google.protobuf.Struct"&&e.parent.typeName!=="google.protobuf.Value")return;let t=e.message,n;return r=>!ne(r)||ut(r,t)?r:(n??(n=Uo(t)),n(r))}s(Yt,"compileConvertMessage");function dt(e){return Array.isArray(e)?new Uint8Array(e):e}s(dt,"toU8Arr");function Ic(e){switch(e.file.edition){case Nc:return!1;case wc:return!0;default:return e.fields.some(t=>t.presence!=Fo&&t.fieldKind!="message"&&!t.oneof)}}s(Ic,"needsPrototypeChain");function xc(e){let t=e.getDefaultValue();return t!==void 0?e.fieldKind=="scalar"&&e.longAsString?t.toString():t:e.fieldKind=="scalar"?G(e.scalar,e.longAsString):e.enum.values[0].number}s(xc,"createZeroValue");var Ac=["FieldValueInvalidError","FieldListRangeError","ForeignFieldError"],R=class extends Error{static{s(this,"FieldError")}constructor(t,n,r="FieldValueInvalidError"){super(n),this.name=r,this.field=()=>t}};function Po(e){return e instanceof Error&&Ac.includes(e.name)&&"field"in e&&typeof e.field=="function"}s(Po,"isFieldError");var Mn;function _c(e){var t;Mn=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:Pn(e.encodeUtf8.bind(e))})}s(_c,"configureTextEncoding");function pt(){if(!Mn){let e=globalThis;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,n=new e.TextDecoder,r,o={encodeUtf8(i){return t.encode(i)},decodeUtf8(i,c){return c?(r||(r=new e.TextDecoder("utf-8",{fatal:!0})),r.decode(i)):n.decode(i)},checkUtf8(i){try{return encodeURIComponent(i),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let a=String.prototype.isWellFormed;a&&(o.checkUtf8=i=>a.call(i)),_c(o)}return Mn}s(pt,"getTextEncoding");function Pn(e){return(t,n)=>{let r=e(t);return n.set(r),{written:r.byteLength}}}s(Pn,"emulateEncodeInto");var F;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})(F||(F={}));var Gn=34028234663852886e22,Wn=-34028234663852886e22,Xn=4294967295,$n=2147483647,Zn=-2147483648,De=class{static{s(this,"BinaryWriter")}constructor(t){this.stackPos=[],this.encodeUtf8Into=t?Pn(t):pt().encodeUtf8Into,this.buffer=Bo,this.viewCache=Oc,this.pos=0}ensureCapacity(t){let n=this.pos+t;if(n>this.buffer.length){let r=this.buffer.length||Rc;for(;r<n;)r*=2;let o=new Uint8Array(r);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,n=this.viewCache;if(n.byteLength===t.byteLength)return n;let r=new DataView(t.buffer);return this.viewCache=r,r}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(ht),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let n=this.pos-t-ht,r=Yn(n);return r>ht&&(this.ensureCapacity(r-ht),this.buffer.copyWithin(t+r,t+ht,this.pos)),this.pos=t,this.uint32(n),this.pos+=n,this}tag(t,n){return this.uint32((t<<3|n)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(Yo(t),this.ensureCapacity(5),t<128)return this.buffer[this.pos++]=t,this;for(;t>127;)this.buffer[this.pos++]=t&127|128,t>>>=7;return this.buffer[this.pos++]=t,this}int32(t){if(Bn(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let n=0;n<9;n++)this.buffer[this.pos++]=t&127|128,t>>=7;return this.buffer[this.pos++]=1,this}bool(t){return this.ensureCapacity(1),this.buffer[this.pos++]=t?1:0,this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){typeof t!="string"&&(t=String(t));let n=t.length;if(n<=Go){this.ensureCapacity(n+1);let u=this.buffer,l=this.pos;u[l++]=n;let f=0;for(;f<n;f++){let d=t.charCodeAt(f);if(d>127)break;u[l++]=d}if(f==n)return this.pos=l,this}this.ensureCapacity(n*3+5);let r=Yn(n),o=this.buffer,a=this.pos,{written:i}=this.encodeUtf8Into(t,o.subarray(a+r)),c=Yn(i);return c!=r&&o.copyWithin(a+c,a+r,a+r+i),this.uint32(i),this.pos+=i,this}float(t){return Cc(t),this.ensureCapacity(4),this.view().setFloat32(this.pos,t,!0),this.pos+=4,this}double(t){return this.ensureCapacity(8),this.view().setFloat64(this.pos,t,!0),this.pos+=8,this}fixed32(t){return Yo(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return Bn(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return Bn(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let n=x.enc(t);this.ensureCapacity(8);let r=this.view();return r.setInt32(this.pos,n.lo,!0),r.setInt32(this.pos+4,n.hi,!0),this.pos+=8,this}fixed64(t){let n=x.uEnc(t);this.ensureCapacity(8);let r=this.view();return r.setInt32(this.pos,n.lo,!0),r.setInt32(this.pos+4,n.hi,!0),this.pos+=8,this}int64(t){let n=x.enc(t);return this.writeVarint64(n.lo,n.hi)}sint64(t){let n=x.enc(t),r=n.hi>>31,o=n.lo<<1^r,a=(n.hi<<1|n.lo>>>31)^r;return this.writeVarint64(o,a)}uint64(t){let n=x.uEnc(t);return this.writeVarint64(n.lo,n.hi)}writeVarint64(t,n){this.ensureCapacity(10);let r=this.buffer,o=this.pos;for(let c=0;c<28;c=c+7){let u=t>>>c,l=!(!(u>>>7)&&n==0);if(r[o++]=(l?u|128:u)&255,!l)return this.pos=o,this}let a=t>>>28&15|(n&7)<<4,i=n>>3!=0;if(r[o++]=(i?a|128:a)&255,!i)return this.pos=o,this;for(let c=3;c<31;c=c+7){let u=n>>>c,l=!!(u>>>7);if(r[o++]=(l?u|128:u)&255,!l)return this.pos=o,this}return r[o++]=n>>>31&1,this.pos=o,this}},Rc=128,ht=1,Bo=new Uint8Array(0),Oc=new DataView(Bo.buffer),Go=32;function Yn(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}s(Yn,"varint32Size");var ve=class{static{s(this,"BinaryReader")}constructor(t,n=pt().decodeUtf8){this.decodeUtf8=n,this.varint64Lo=0,this.varint64Hi=0,this.varint64=bo,this.uint32=wo,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,n=this.uint32(),r=this.pos-t;if(r>5||r==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=n>>>3,a=n&7;if(o<=0||a>5)throw new Error("illegal tag: field no "+o+" wire type "+a);return[o,a]}skip(t,n,r=100){let o=this.pos;switch(t){case F.Varint:for(;this.buf[this.pos++]&128;);break;case F.Bit64:this.pos+=4;case F.Bit32:this.pos+=4;break;case F.LengthDelimited:let a=this.uint32();this.pos+=a;break;case F.StartGroup:if(r<=0)throw new Error("maximum recursion depth reached");for(;;){let[i,c]=this.tag();if(c===F.EndGroup){if(n!==void 0&&i!==n)throw new Error("invalid end group tag");break}this.skip(c,i,r-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),x.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),x.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,n=this.varint64Hi,r=-(t&1);return t=(t>>>1|(n&1)<<31)^r,n=n>>>1^r,x.dec(t,n)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return x.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return x.dec(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 t=this.uint32(),n=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(n,n+t)}string(t){let n=this.bytes(),r=n.length;if(r<=Go){let o=new Array(r);for(let a=0;a<r;a++){let i=n[a];if(i>127)return this.decodeUtf8(n,t);o[a]=i}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(n,t)}};function Bn(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>$n||e<Zn)throw new Error("invalid int32: "+e)}s(Bn,"assertInt32");function Yo(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>Xn||e<0)throw new Error("invalid uint32: "+e)}s(Yo,"assertUInt32");function Cc(e){if(typeof e=="string"){let t=e;if(e=Number(e),Number.isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>Gn||e<Wn))throw new Error("invalid float32: "+e)}s(Cc,"assertFloat32");function Bt(e,t){let n=e.fieldKind=="list"?lt(t,e):e.fieldKind=="map"?ft(t,e):Kn(e,t);if(n===!0)return;let r;switch(e.fieldKind){case"list":r=`expected ${$o(e)}, got ${D(t)}`;break;case"map":r=`expected ${Zo(e)}, got ${D(t)}`;break;default:r=K(e,t,n)}return new R(e,r)}s(Bt,"checkField");function Jn(e,t,n){let r=Kn(e,n);if(r!==!0)return new R(e,`list item #${t+1}: ${K(e,n,r)}`)}s(Jn,"checkListItem");function Wo(e,t,n){let r=le(e.mapKey)(t);if(r!==!0)return new R(e,`invalid map key: ${K({scalar:e.mapKey},t,r)}`);let o=Kn(e,n);if(o!==!0)return new R(e,`map entry ${D(t)}: ${K(e,n,o)}`)}s(Wo,"checkMapEntry");function Kn(e,t){return e.scalar!==void 0?le(e.scalar)(t):e.enum!==void 0?e.enum.open?le(m.INT32)(t):e.enum.values.some(n=>n.number===t):mt(t,e.message)}s(Kn,"checkSingular");function le(e){switch(e){case m.DOUBLE:return t=>typeof t=="number";case m.FLOAT:return t=>typeof t!="number"?!1:Number.isNaN(t)||!Number.isFinite(t)?!0:t>Gn||t<Wn?`${t.toFixed()} out of range`:!0;case m.INT32:case m.SFIXED32:case m.SINT32:return t=>typeof t!="number"||!Number.isInteger(t)?!1:t>$n||t<Zn?`${t.toFixed()} out of range`:!0;case m.FIXED32:case m.UINT32:return t=>typeof t!="number"||!Number.isInteger(t)?!1:t>Xn||t<0?`${t.toFixed()} out of range`:!0;case m.BOOL:return t=>typeof t=="boolean";case m.STRING:return t=>typeof t!="string"?!1:pt().checkUtf8(t)||"invalid UTF8";case m.BYTES:return t=>t instanceof Uint8Array;case m.INT64:case m.SFIXED64:case m.SINT64:return t=>{if(typeof t=="bigint"||typeof t=="number"||typeof t=="string"&&t.length>0)try{return x.parse(t),!0}catch{return`${t} out of range`}return!1};case m.FIXED64:case m.UINT64:return t=>{if(typeof t=="bigint"||typeof t=="number"||typeof t=="string"&&t.length>0)try{return x.uParse(t),!0}catch{return`${t} out of range`}return!1}}}s(le,"checkScalarValue");function K(e,t,n){return n=typeof n=="string"?`: ${n}`:`, got ${D(t)}`,e.scalar!==void 0?`expected ${Lc(e.scalar)}`+n:e.enum!==void 0?`expected ${e.enum.toString()}`+n:`expected ${Xo(e.message)}`+n}s(K,"reasonSingular");function D(e){switch(typeof e){case"object":return e===null?"null":e instanceof Uint8Array?`Uint8Array(${e.length})`:Array.isArray(e)?`Array(${e.length})`:lt(e)?$o(e.field()):ft(e)?Zo(e.field()):mt(e)?Xo(e.desc):ut(e)?`message ${e.$typeName}`:"object";case"string":return e.length>30?"string":`"${e.split('"').join('\\"')}"`;case"boolean":return String(e);case"number":return String(e);case"bigint":return String(e)+"n";default:return typeof e}}s(D,"formatVal");function Xo(e){return`ReflectMessage (${e.typeName})`}s(Xo,"formatReflectMessage");function $o(e){switch(e.listKind){case"message":return`ReflectList (${e.message.toString()})`;case"enum":return`ReflectList (${e.enum.toString()})`;case"scalar":return`ReflectList (${m[e.scalar]})`}}s($o,"formatReflectList");function Zo(e){switch(e.mapKind){case"message":return`ReflectMap (${m[e.mapKey]}, ${e.message.toString()})`;case"enum":return`ReflectMap (${m[e.mapKey]}, ${e.enum.toString()})`;case"scalar":return`ReflectMap (${m[e.mapKey]}, ${m[e.scalar]})`}}s(Zo,"formatReflectMap");function Lc(e){switch(e){case m.STRING:return"string";case m.BOOL:return"boolean";case m.INT64:case m.SINT64:case m.SFIXED64:return"bigint (int64)";case m.UINT64:case m.FIXED64:return"bigint (uint64)";case m.BYTES:return"Uint8Array";case m.DOUBLE:return"number (float64)";case m.FLOAT:return"number (float32)";case m.FIXED32:case m.UINT32:return"number (uint32)";case m.INT32:case m.SFIXED32:case m.SINT32:return"number (int32)"}}s(Lc,"scalarTypeDescription");var kc=0;function $(e){if(Fc(e))return{toMessage:s(n=>Gt(n),"toMessage"),toLocal:s(n=>Wt(n),"toLocal")};if(e.fieldKind=="message"&&!e.oneof&&J(e.message)){let n=e.message,r=n.fields[0].localName;return{toMessage:s(o=>{let a=L(n);return o!==void 0&&(a[r]=o),a},"toMessage"),toLocal:s(o=>o[r],"toLocal")}}let t=e.message;return{toMessage:s(n=>n===void 0?L(t):n,"toMessage"),toLocal:s(n=>n,"toLocal")}}s($,"localMessageMapper");function Fc(e){return e.message.typeName=="google.protobuf.Struct"&&e.parent.typeName!="google.protobuf.Value"}s(Fc,"usesJsonRepresentation");function Gt(e){let t={$typeName:"google.protobuf.Struct",fields:{}};if(ne(e))for(let n of Object.keys(e))t.fields[n]=Ko(e[n]);return t}s(Gt,"wktStructToReflect");function Wt(e){let t={};for(let n of Object.keys(e.fields))t[n]=Jo(e.fields[n]);return t}s(Wt,"wktStructToLocal");function Jo(e){switch(e.kind.case){case"structValue":return Wt(e.kind.value);case"listValue":return e.kind.value.values.map(Jo);case"nullValue":case void 0:return null;default:return e.kind.value}}s(Jo,"wktValueToLocal");function Ko(e){let t={$typeName:"google.protobuf.Value",kind:{case:void 0}};switch(typeof e){case"number":t.kind={case:"numberValue",value:e};break;case"string":t.kind={case:"stringValue",value:e};break;case"boolean":t.kind={case:"boolValue",value:e};break;case"object":if(e===null)t.kind={case:"nullValue",value:kc};else if(Array.isArray(e)){let n={$typeName:"google.protobuf.ListValue",values:[]};if(Array.isArray(e))for(let r of e)n.values.push(Ko(r));t.kind={case:"listValue",value:n}}else t.kind={case:"structValue",value:Gt(e)};break}return t}s(Ko,"wktValueToReflect");function Qo(e,t,n=!0){return new $t(e,t,n)}s(Qo,"reflect");var zo=new WeakMap,$t=class{static{s(this,"ReflectMessageImpl")}get sortedFields(){let t=zo.get(this.desc);if(t)return t;let n=this.desc.fields.concat().sort((r,o)=>r.number-o.number);return zo.set(this.desc,n),n}constructor(t,n,r=!0){this.lists=new Map,this.maps=new Map,this.check=r,this.desc=t,this.message=this[M]=n??L(t),this.fields=t.fields,this.oneofs=t.oneofs,this.members=t.members}findNumber(t){return this._fieldsByNumber||(this._fieldsByNumber=new Map(this.desc.fields.map(n=>[n.number,n]))),this._fieldsByNumber.get(t)}oneofCase(t){return yt(this.message,t),xo(this.message,t)}isSet(t){return yt(this.message,t),Ao(this.message,t)}clear(t){yt(this.message,t),Oo(this.message,t)}get(t){yt(this.message,t);let n=_o(this.message,t);switch(t.fieldKind){case"list":let r=this.lists.get(t);return(!r||r[M]!==n)&&this.lists.set(t,r=new jn(t,n,this.check)),r;case"map":let o=this.maps.get(t);return(!o||o[M]!==n)&&this.maps.set(t,o=new Qn(t,n,this.check)),o;case"message":return er(t,n,this.check);case"scalar":return n===void 0?G(t.scalar,!1):tr(t,n);case"enum":return n??t.enum.values[0].number}}set(t,n){if(yt(this.message,t),this.check){let o=Bt(t,n);if(o)throw o}let r;t.fieldKind=="message"?r=qn(t,n):ft(n)||lt(n)?r=n[M]:r=nr(t,n),Ro(this.message,t,r)}getUnknown(){return this.message.$unknown}setUnknown(t){this.message.$unknown=t}};function yt(e,t){if(t.parent.typeName!==e.$typeName)throw new R(t,`cannot use ${t.toString()} with message ${e.$typeName}`,"ForeignFieldError")}s(yt,"assertOwn");var jn=class{static{s(this,"ReflectListImpl")}field(){return this._field}get size(){return this._arr.length}constructor(t,n,r){this._field=t,this._arr=this[M]=n,this.check=r}get(t){let n=this._arr[t];return n===void 0?void 0:zn(this._field,n,this.check)}set(t,n){if(t<0||t>=this._arr.length)throw new R(this._field,`list item #${t+1}: out of range`);if(this.check){let r=Jn(this._field,t,n);if(r)throw r}this._arr[t]=Ho(this._field,n)}add(t){if(this.check){let n=Jn(this._field,this._arr.length,t);if(n)throw n}this._arr.push(Ho(this._field,t))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(let t of this._arr)yield zn(this._field,t,this.check)}*entries(){for(let t=0;t<this._arr.length;t++)yield[t,zn(this._field,this._arr[t],this.check)]}};var Qn=class{static{s(this,"ReflectMapImpl")}constructor(t,n,r=!0){this.obj=this[M]=n??{},this.check=r,this._field=t}field(){return this._field}set(t,n){if(this.check){let r=Wo(this._field,t,n);if(r)throw r}return this.obj[Xt(t)]=Uc(this._field,n),this}delete(t){let n=Xt(t),r=Object.prototype.hasOwnProperty.call(this.obj,n);return r&&delete this.obj[n],r}clear(){for(let t of Object.keys(this.obj))delete this.obj[t]}get(t){let n=this.obj[Xt(t)];return n!==void 0&&(n=Hn(this._field,n,this.check)),n}has(t){return Object.prototype.hasOwnProperty.call(this.obj,Xt(t))}*keys(){for(let t of Object.keys(this.obj))yield jo(t,this._field.mapKey)}*entries(){for(let t of Object.entries(this.obj))yield[jo(t[0],this._field.mapKey),Hn(this._field,t[1],this.check)]}[Symbol.iterator](){return this.entries()}get size(){return Object.keys(this.obj).length}*values(){for(let t of Object.values(this.obj))yield Hn(this._field,t,this.check)}forEach(t,n){for(let r of this.entries())t.call(n,r[1],r[0],this)}};function qn(e,t){return mt(t)?Co(t.message)&&!e.oneof&&e.fieldKind=="message"?t.message.value:t.desc.typeName=="google.protobuf.Struct"&&e.parent.typeName!="google.protobuf.Value"?Wt(t.message):t.message:t}s(qn,"messageToLocal");function er(e,t,n){return t!==void 0&&(J(e.message)&&!e.oneof&&e.fieldKind=="message"?t={$typeName:e.message.typeName,value:tr(e.message.fields[0],t)}:e.message.typeName=="google.protobuf.Struct"&&e.parent.typeName!="google.protobuf.Value"&&ne(t)&&(t=Gt(t))),new $t(e.message,t,n)}s(er,"messageToReflect");function Ho(e,t){return e.listKind=="message"?qn(e,t):nr(e,t)}s(Ho,"listItemToLocal");function zn(e,t,n){return e.listKind=="message"?er(e,t,n):tr(e,t)}s(zn,"listItemToReflect");function Uc(e,t){return e.mapKind=="message"?qn(e,t):nr(e,t)}s(Uc,"mapValueToLocal");function Hn(e,t,n){return e.mapKind=="message"?er(e,t,n):t}s(Hn,"mapValueToReflect");function Xt(e){return typeof e=="string"||typeof e=="number"?e:String(e)}s(Xt,"mapKeyToLocal");function jo(e,t){switch(t){case m.STRING:return e;case m.INT32:case m.FIXED32:case m.UINT32:case m.SFIXED32:case m.SINT32:{let n=Number.parseInt(e);if(Number.isFinite(n))return n;break}case m.BOOL:switch(e){case"true":return!0;case"false":return!1}break;case m.UINT64:case m.FIXED64:try{return x.uParse(e)}catch{}break;default:try{return x.parse(e)}catch{}break}return e}s(jo,"mapKeyToReflect");function tr(e,t){switch(e.scalar){case m.INT64:case m.SFIXED64:case m.SINT64:"longAsString"in e&&e.longAsString&&typeof t=="string"&&(t=x.parse(t));break;case m.FIXED64:case m.UINT64:"longAsString"in e&&e.longAsString&&typeof t=="string"&&(t=x.uParse(t));break}return t}s(tr,"longToReflect");function nr(e,t){switch(e.scalar){case m.INT64:case m.SFIXED64:case m.SINT64:"longAsString"in e&&e.longAsString?t=String(t):(typeof t=="string"||typeof t=="number")&&(t=x.parse(t));break;case m.FIXED64:case m.UINT64:"longAsString"in e&&e.longAsString?t=String(t):(typeof t=="string"||typeof t=="number")&&(t=x.uParse(t));break}return t}s(nr,"longToLocal");var qo=Uint8Array.prototype.setFromBase64;function Me(e){let t=e.length,n=t-(t+3>>2);(t&3)==0&&e[t-1]=="="&&(n-=e[t-2]=="="?2:1);let r=new Uint8Array(n),o=-1;if(qo)try{let a=qo.call(r,e);a.read==t&&(o=a.written)}catch{}return o<0&&(o=Dc(r,e)),o==n?r:r.subarray(0,o)}s(Me,"base64Decode");function Dc(e,t){let n=Mc(),r=0,o=0,a,i=0;for(let c=0;c<t.length;c++){if(a=n[t.charCodeAt(c)],a===void 0)switch(t[c]){case"=":o=0;case`
5
+ `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string")}switch(o){case 0:i=a,o=1;break;case 1:e[r++]=i<<2|(a&48)>>4,i=a,o=2;break;case 2:e[r++]=(i&15)<<4|(a&60)>>2,i=a,o=3;break;case 3:e[r++]=(i&3)<<6|a,o=0;break}}if(o==1)throw Error("invalid base64 string");return r}s(Dc,"setFromBase64");var ea=Uint8Array.prototype.toBase64,Vc={std:{alphabet:"base64",omitPadding:!1},std_raw:{alphabet:"base64",omitPadding:!0},url:{alphabet:"base64url",omitPadding:!0}};function Pe(e,t="std"){if(ea)return ea.call(e,Vc[t]);let n=na(t),r=t=="std",o="",a=0,i,c=0;for(let u=0;u<e.length;u++)switch(i=e[u],a){case 0:o+=n[i>>2],c=(i&3)<<4,a=1;break;case 1:o+=n[c|i>>4],c=(i&15)<<2,a=2;break;case 2:o+=n[c|i>>6],o+=n[i&63],a=0;break}return a&&(o+=n[c],r&&(o+="=",a==1&&(o+="="))),o}s(Pe,"base64Encode");var Zt,ta,Ve;function na(e){return Zt||(Zt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),ta=Zt.slice(0,-2).concat("-","_")),e=="url"?ta:Zt}s(na,"getEncodeTable");function Mc(){if(!Ve){Ve=[];let e=na("std");for(let t=0;t<e.length;t++)Ve[e[t].charCodeAt(0)]=t;Ve[45]=e.indexOf("+"),Ve[95]=e.indexOf("/")}return Ve}s(Mc,"getDecodeTable");function fe(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let o=e.charAt(r);switch(o){case"_":t=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(o),t=!1;break;default:t&&(t=!1,o=o.toUpperCase()),n.push(o);break}}return n.join("")}s(fe,"protoCamelCase");function Jt(e){return e.replace(/[A-Z]/g,t=>"_"+t.toLowerCase())}s(Jt,"protoSnakeCase");var Pc=new Set(["constructor","toString","toJSON","valueOf"]);function Ye(e){return Pc.has(e)?e+"$":e}s(Ye,"safeObjectProperty");function bt(e){for(let t of e.field)Te(t,"jsonName")||(t.jsonName=fe(t.name));e.nestedType.forEach(bt)}s(bt,"restoreJsonNames");function ra(e,t){let n=e.values.find(r=>r.name===t);if(!n)throw new Error(`cannot parse ${e} default value: ${t}`);return n.number}s(ra,"parseTextFormatEnumValue");function oa(e,t){switch(e){case m.STRING:return t;case m.BYTES:{let n=Yc(t);if(n===!1)throw new Error(`cannot parse ${m[e]} default value: ${t}`);return n}case m.INT64:case m.SFIXED64:case m.SINT64:return x.parse(t);case m.UINT64:case m.FIXED64:return x.uParse(t);case m.DOUBLE:case m.FLOAT:switch(t){case"inf":return Number.POSITIVE_INFINITY;case"-inf":return Number.NEGATIVE_INFINITY;case"nan":return Number.NaN;default:return parseFloat(t)}case m.BOOL:return t==="true";case m.INT32:case m.UINT32:case m.SINT32:case m.FIXED32:case m.SFIXED32:return parseInt(t,10)}}s(oa,"parseTextFormatScalarValue");function Yc(e){let t=[],n={tail:e,c:"",next(){return this.tail.length==0?!1:(this.c=this.tail[0],this.tail=this.tail.substring(1),!0)},take(r){if(this.tail.length>=r){let o=this.tail.substring(0,r);return this.tail=this.tail.substring(r),o}return!1}};for(;n.next();)switch(n.c){case"\\":if(n.next())switch(n.c){case"\\":t.push(n.c.charCodeAt(0));break;case"b":t.push(8);break;case"f":t.push(12);break;case"n":t.push(10);break;case"r":t.push(13);break;case"t":t.push(9);break;case"v":t.push(11);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let r=n.c,o=n.take(2);if(o===!1)return!1;let a=parseInt(r+o,8);if(Number.isNaN(a))return!1;t.push(a);break}case"x":{let r=n.c,o=n.take(2);if(o===!1)return!1;let a=parseInt(r+o,16);if(Number.isNaN(a))return!1;t.push(a);break}case"u":{let r=n.c,o=n.take(4);if(o===!1)return!1;let a=parseInt(r+o,16);if(Number.isNaN(a))return!1;let i=new Uint8Array(4);new DataView(i.buffer).setInt32(0,a,!0),t.push(i[0],i[1],i[2],i[3]);break}case"U":{let r=n.c,o=n.take(8);if(o===!1)return!1;let a=x.uEnc(r+o),i=new Uint8Array(8),c=new DataView(i.buffer);c.setInt32(0,a.lo,!0),c.setInt32(4,a.hi,!0),t.push(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7]);break}}break;default:t.push(n.c.charCodeAt(0))}return new Uint8Array(t)}s(Yc,"unescapeBytesDefaultValue");function*Kt(e){switch(e.kind){case"file":for(let t of e.messages)yield t,yield*Kt(t);yield*e.enums,yield*e.services,yield*e.extensions;break;case"message":for(let t of e.nestedMessages)yield t,yield*Kt(t);yield*e.nestedEnums,yield*e.nestedExtensions;break}}s(Kt,"nestedTypes");function zt(...e){let t=Bc();if(!e.length)return t;if("$typeName"in e[0]&&e[0].$typeName=="google.protobuf.FileDescriptorSet"){for(let n of e[0].file)ca(n,t);return t}if("$typeName"in e[0]){let a=function(i){let c=[];for(let u of i.dependency){if(t.getFile(u)!=null||o.has(u))continue;let l=r(u);if(!l)throw new Error(`Unable to resolve ${u}, imported by ${i.name}`);"kind"in l?t.addFile(l,!1,!0):(o.add(l.name),c.push(l))}return c.concat(...c.map(a))};s(a,"recurseDeps");let n=e[0],r=e[1],o=new Set;for(let i of[n,...a(n)].reverse())ca(i,t)}else for(let n of e)for(let r of n.files)t.addFile(r);return t}s(zt,"createFileRegistry");function Bc(){let e=new Map,t=new Map,n=new Map;return{kind:"registry",types:e,extendees:t,[Symbol.iterator](){return e.values()},get files(){return n.values()},addFile(r,o,a){if(n.set(r.proto.name,r),!o)for(let i of Kt(r))this.add(i);if(a)for(let i of r.dependencies)this.addFile(i,o,a)},add(r){if(r.kind=="extension"){let o=t.get(r.extendee.typeName);o||t.set(r.extendee.typeName,o=new Map),o.set(r.number,r)}e.set(r.typeName,r)},get(r){return e.get(r)},getFile(r){return n.get(r)},getMessage(r){let o=e.get(r);return o?.kind=="message"?o:void 0},getEnum(r){let o=e.get(r);return o?.kind=="enum"?o:void 0},getExtension(r){let o=e.get(r);return o?.kind=="extension"?o:void 0},getExtensionFor(r,o){var a;return(a=t.get(r.typeName))===null||a===void 0?void 0:a.get(o)},getService(r){let o=e.get(r);return o?.kind=="service"?o:void 0}}}s(Bc,"createBaseRegistry");var Gc=998,Wc=999,Xc=9999,$c=9,Et=10,gt=11,Zc=12,aa=14,sr=3,Jc=2,ia=1,Kc=0,rr=1,sa=2,zc=3,Hc=1,jc=2,Qc=1,qc=2;var eu=1001,la={998:{fieldPresence:1,enumType:2,repeatedFieldEncoding:2,utf8Validation:3,messageEncoding:1,jsonFormat:2,enforceNamingStyle:2,defaultSymbolVisibility:1},999:{fieldPresence:2,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1e3:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1001:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:1,defaultSymbolVisibility:2}};function ca(e,t){var n,r;let o={kind:"file",proto:e,deprecated:(r=(n=e.options)===null||n===void 0?void 0:n.deprecated)!==null&&r!==void 0?r:!1,edition:ou(e),name:e.name.replace(/\.proto$/,""),dependencies:au(e,t),enums:[],messages:[],extensions:[],services:[],toString(){return`file ${e.name}`}},a=new Map,i={get(c){return a.get(c)},add(c){var u;re(((u=c.proto.options)===null||u===void 0?void 0:u.mapEntry)===!0),a.set(c.typeName,c)}};for(let c of e.enumType)fa(c,o,void 0,t);for(let c of e.messageType)ma(c,o,void 0,t,i);for(let c of e.service)tu(c,o,t);or(o,t);for(let c of a.values())ar(c,t,i);for(let c of o.messages)ar(c,t,i),or(c,t);t.addFile(o,!0)}s(ca,"addFile");function or(e,t){switch(e.kind){case"file":for(let n of e.proto.extension){let r=ir(n,e,t);e.extensions.push(r),t.add(r)}break;case"message":for(let n of e.proto.extension){let r=ir(n,e,t);e.nestedExtensions.push(r),t.add(r)}for(let n of e.nestedMessages)or(n,t);break}}s(or,"addExtensions");function ar(e,t,n){let r=e.proto.oneofDecl.map(a=>ru(a,e)),o=new Set;for(let a of e.proto.field){let i=cu(a,r),c=ir(a,e,t,i,n);e.fields.push(c),e.field[c.localName]=c,i===void 0?e.members.push(c):(i.fields.push(c),o.has(i)||(o.add(i),e.members.push(i)))}for(let a of r.filter(i=>o.has(i)))e.oneofs.push(a);for(let a of e.nestedMessages)ar(a,t,n)}s(ar,"addFields");function fa(e,t,n,r){var o,a,i,c,u;let l=iu(e.name,e.value),f={kind:"enum",proto:e,deprecated:(a=(o=e.options)===null||o===void 0?void 0:o.deprecated)!==null&&a!==void 0?a:!1,file:t,parent:n,open:!0,name:e.name,typeName:Ht(e,n,t),value:{},values:[],sharedPrefix:l,toString(){return`enum ${this.typeName}`}};f.open=mu(f),r.add(f);for(let d of e.value){let h=d.name;f.values.push(f.value[d.number]={kind:"enum_value",proto:d,deprecated:(c=(i=d.options)===null||i===void 0?void 0:i.deprecated)!==null&&c!==void 0?c:!1,parent:f,name:h,localName:Ye(l==null?h:h.substring(l.length)),number:d.number,toString(){return`enum value ${f.typeName}.${h}`}})}((u=n?.nestedEnums)!==null&&u!==void 0?u:t.enums).push(f)}s(fa,"addEnum");function ma(e,t,n,r,o){var a,i,c,u;let l={kind:"message",proto:e,deprecated:(i=(a=e.options)===null||a===void 0?void 0:a.deprecated)!==null&&i!==void 0?i:!1,file:t,parent:n,name:e.name,typeName:Ht(e,n,t),fields:[],field:{},oneofs:[],members:[],nestedEnums:[],nestedMessages:[],nestedExtensions:[],toString(){return`message ${this.typeName}`}};((c=e.options)===null||c===void 0?void 0:c.mapEntry)===!0?o.add(l):(((u=n?.nestedMessages)!==null&&u!==void 0?u:t.messages).push(l),r.add(l));for(let f of e.enumType)fa(f,t,l,r);for(let f of e.nestedType)ma(f,t,l,r,o)}s(ma,"addMessage");function tu(e,t,n){var r,o;let a={kind:"service",proto:e,deprecated:(o=(r=e.options)===null||r===void 0?void 0:r.deprecated)!==null&&o!==void 0?o:!1,file:t,name:e.name,typeName:Ht(e,void 0,t),methods:[],method:{},toString(){return`service ${this.typeName}`}};t.services.push(a),n.add(a);for(let i of e.method){let c=nu(i,a,n);a.methods.push(c),a.method[c.localName]=c}}s(tu,"addService");function nu(e,t,n){var r,o,a,i;let c;e.clientStreaming&&e.serverStreaming?c="bidi_streaming":e.clientStreaming?c="client_streaming":e.serverStreaming?c="server_streaming":c="unary";let u=n.getMessage(me(e.inputType)),l=n.getMessage(me(e.outputType));re(u,`invalid MethodDescriptorProto: input_type ${e.inputType} not found`),re(l,`invalid MethodDescriptorProto: output_type ${e.inputType} not found`);let f=e.name;return{kind:"rpc",proto:e,deprecated:(o=(r=e.options)===null||r===void 0?void 0:r.deprecated)!==null&&o!==void 0?o:!1,parent:t,name:f,localName:Ye(f.length?Ye(f[0].toLowerCase()+f.substring(1)):f),methodKind:c,input:u,output:l,idempotency:(i=(a=e.options)===null||a===void 0?void 0:a.idempotencyLevel)!==null&&i!==void 0?i:Kc,toString(){return`rpc ${t.typeName}.${f}`}}}s(nu,"newMethod");function ru(e,t){return{kind:"oneof",proto:e,deprecated:!1,parent:t,fields:[],name:e.name,localName:Ye(fe(e.name)),toString(){return`oneof ${t.typeName}.${this.name}`}}}s(ru,"newOneof");function ir(e,t,n,r,o){var a,i,c;let u=o===void 0,l={kind:"field",proto:e,deprecated:(i=(a=e.options)===null||a===void 0?void 0:a.deprecated)!==null&&i!==void 0?i:!1,name:e.name,number:e.number,scalar:void 0,message:void 0,enum:void 0,presence:uu(e,r,u,t),utf8Validation:du(e,t),listKind:void 0,mapKind:void 0,mapKey:void 0,delimitedEncoding:void 0,packed:void 0,longAsString:!1,getDefaultValue:void 0},f;if(u){let y=t.kind=="file"?t:t.file,g=t.kind=="file"?void 0:t,N=Ht(e,g,y);l.kind="extension",l.file=y,l.parent=g,l.oneof=void 0,l.typeName=N,l.jsonName=`[${N}]`,f=s(()=>`extension ${N}`,"toStr");let E=n.getMessage(me(e.extendee));re(E,`invalid FieldDescriptorProto: extendee ${e.extendee} not found`),l.extendee=E}else{let y=t;re(y.kind=="message"),l.parent=y,l.oneof=r,l.localName=r?fe(e.name):Ye(fe(e.name)),l.jsonName=e.jsonName,f=s(()=>`field ${y.typeName}.${e.name}`,"toStr")}Object.defineProperty(l,"toString",{value:f,writable:!0,enumerable:!0,configurable:!0});let d=e.label,h=e.type,p=(c=e.options)===null||c===void 0?void 0:c.jstype;if(d===sr){let y=h==gt?o?.get(me(e.typeName)):void 0;if(y){l.fieldKind="map";let{key:g,value:N}=fu(y);return l.mapKey=g.scalar,l.mapKind=N.fieldKind,l.message=N.message,l.delimitedEncoding=!1,l.enum=N.enum,l.scalar=N.scalar,l}switch(l.fieldKind="list",h){case gt:case Et:l.listKind="message",l.message=n.getMessage(me(e.typeName)),re(l.message),l.delimitedEncoding=ua(e,t);break;case aa:l.listKind="enum",l.enum=n.getEnum(me(e.typeName)),re(l.enum);break;default:l.listKind="scalar",l.scalar=h,l.longAsString=p==ia;break}return l.packed=lu(e,t),l}switch(h){case gt:case Et:l.fieldKind="message",l.message=n.getMessage(me(e.typeName)),re(l.message,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),l.delimitedEncoding=ua(e,t),l.getDefaultValue=()=>{};break;case aa:{let y=n.getEnum(me(e.typeName));re(y!==void 0,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),l.fieldKind="enum",l.enum=n.getEnum(me(e.typeName)),l.getDefaultValue=()=>Te(e,"defaultValue")?ra(y,e.defaultValue):void 0;break}default:{l.fieldKind="scalar",l.scalar=h,l.longAsString=p==ia,l.getDefaultValue=()=>Te(e,"defaultValue")?oa(h,e.defaultValue):void 0;break}}return l}s(ir,"newField");function ou(e){switch(e.syntax){case"":case"proto2":return Gc;case"proto3":return Wc;case"editions":if(e.edition===Xc)return eu;if(e.edition in la)return e.edition;throw new Error(`${e.name}: unsupported edition`);default:throw new Error(`${e.name}: unsupported syntax "${e.syntax}"`)}}s(ou,"getFileEdition");function au(e,t){return e.dependency.map(n=>{let r=t.getFile(n);if(!r)throw new Error(`Cannot find ${n}, imported by ${e.name}`);return r})}s(au,"findFileDependencies");function iu(e,t){let n=su(e)+"_";for(let r of t){if(!r.name.toLowerCase().startsWith(n))return;let o=r.name.substring(n.length);if(o.length==0||/^\d/.test(o))return}return n}s(iu,"findEnumSharedPrefix");function su(e){return(e.substring(0,1)+e.substring(1).replace(/[A-Z]/g,t=>"_"+t)).toLowerCase()}s(su,"camelToSnakeCase");function Ht(e,t,n){let r;return t?r=`${t.typeName}.${e.name}`:n.proto.package.length>0?r=`${n.proto.package}.${e.name}`:r=`${e.name}`,r}s(Ht,"makeTypeName");function me(e){return e.startsWith(".")?e.substring(1):e}s(me,"trimLeadingDot");function cu(e,t){if(!Te(e,"oneofIndex")||e.proto3Optional)return;let n=t[e.oneofIndex];return re(n,`invalid FieldDescriptorProto: oneof #${e.oneofIndex} for field #${e.number} not found`),n}s(cu,"findOneof");function uu(e,t,n,r){if(e.label==Jc)return zc;if(e.label==sr)return sa;if(t||e.proto3Optional||n)return rr;let o=Ie("fieldPresence",{proto:e,parent:r});return o==sa&&(e.type==gt||e.type==Et)?rr:o}s(uu,"getFieldPresence");function lu(e,t){if(e.label!=sr)return!1;switch(e.type){case $c:case Zc:case Et:case gt:return!1}let n=e.options;return n&&Te(n,"packed")?n.packed:Hc==Ie("repeatedFieldEncoding",{proto:e,parent:t})}s(lu,"isPackedField");function fu(e){let t=e.fields.find(r=>r.number===1),n=e.fields.find(r=>r.number===2);return re(t&&t.fieldKind=="scalar"&&t.scalar!=m.BYTES&&t.scalar!=m.FLOAT&&t.scalar!=m.DOUBLE&&n&&n.fieldKind!="list"&&n.fieldKind!="map"),{key:t,value:n}}s(fu,"findMapEntryFields");function mu(e){var t;return Qc==Ie("enumType",{proto:e.proto,parent:(t=e.parent)!==null&&t!==void 0?t:e.file})}s(mu,"isEnumOpen");function ua(e,t){return e.type==Et?!0:jc==Ie("messageEncoding",{proto:e,parent:t})}s(ua,"isDelimitedEncoding");function du(e,t){return qc==Ie("utf8Validation",{proto:e,parent:t})}s(du,"isUtf8Validated");function Ie(e,t){var n,r;let o=(n=t.proto.options)===null||n===void 0?void 0:n.features;if(o){let a=o[e];if(a!=0)return a}if("kind"in t){if(t.kind=="message")return Ie(e,(r=t.parent)!==null&&r!==void 0?r:t.file);let a=la[t.edition];if(!a)throw new Error(`feature default for edition ${t.edition} not found`);return a[e]}return Ie(e,t.parent)}s(Ie,"resolveFeature");function re(e,t){if(!e)throw new Error(t)}s(re,"assert");function da(e){let t=pu(e);return t.messageType.forEach(bt),zt(t,()=>{}).getFile(t.name)}s(da,"boot");function pu(e){return Object.assign(Object.create({syntax:"",edition:0}),Object.assign(Object.assign({$typeName:"google.protobuf.FileDescriptorProto",dependency:[],publicDependency:[],weakDependency:[],optionDependency:[],service:[],extension:[]},e),{messageType:e.messageType.map(pa),enumType:e.enumType.map(ha)}))}s(pu,"bootFileDescriptorProto");function pa(e){var t,n,r,o,a,i,c,u;return Object.assign(Object.create({visibility:0}),{$typeName:"google.protobuf.DescriptorProto",name:e.name,field:(n=(t=e.field)===null||t===void 0?void 0:t.map(hu))!==null&&n!==void 0?n:[],extension:[],nestedType:(o=(r=e.nestedType)===null||r===void 0?void 0:r.map(pa))!==null&&o!==void 0?o:[],enumType:(i=(a=e.enumType)===null||a===void 0?void 0:a.map(ha))!==null&&i!==void 0?i:[],extensionRange:(u=(c=e.extensionRange)===null||c===void 0?void 0:c.map(f=>Object.assign({$typeName:"google.protobuf.DescriptorProto.ExtensionRange"},f)))!==null&&u!==void 0?u:[],oneofDecl:[],reservedRange:[],reservedName:[]})}s(pa,"bootDescriptorProto");function hu(e){return Object.assign(Object.create({label:1,typeName:"",extendee:"",defaultValue:"",oneofIndex:0,jsonName:"",proto3Optional:!1}),Object.assign(Object.assign({$typeName:"google.protobuf.FieldDescriptorProto"},e),{options:e.options?yu(e.options):void 0}))}s(hu,"bootFieldDescriptorProto");function yu(e){var t,n,r;return Object.assign(Object.create({ctype:0,packed:!1,jstype:0,lazy:!1,unverifiedLazy:!1,deprecated:!1,weak:!1,debugRedact:!1,retention:0}),Object.assign(Object.assign({$typeName:"google.protobuf.FieldOptions"},e),{targets:(t=e.targets)!==null&&t!==void 0?t:[],editionDefaults:(r=(n=e.editionDefaults)===null||n===void 0?void 0:n.map(a=>Object.assign({$typeName:"google.protobuf.FieldOptions.EditionDefault"},a)))!==null&&r!==void 0?r:[],uninterpretedOption:[]}))}s(yu,"bootFieldOptions");function ha(e){return Object.assign(Object.create({visibility:0}),{$typeName:"google.protobuf.EnumDescriptorProto",name:e.name,reservedName:[],reservedRange:[],value:e.value.map(n=>Object.assign({$typeName:"google.protobuf.EnumValueDescriptorProto"},n))})}s(ha,"bootEnumDescriptorProto");function B(e,t,...n){return n.reduce((r,o)=>r.nestedMessages[o],e.messages[t])}s(B,"messageDesc");var bu=da({name:"google/protobuf/descriptor.proto",package:"google.protobuf",messageType:[{name:"FileDescriptorSet",field:[{name:"file",number:1,type:11,label:3,typeName:".google.protobuf.FileDescriptorProto"}],extensionRange:[{start:536e6,end:536000001}]},{name:"FileDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"package",number:2,type:9,label:1},{name:"dependency",number:3,type:9,label:3},{name:"public_dependency",number:10,type:5,label:3},{name:"weak_dependency",number:11,type:5,label:3},{name:"option_dependency",number:15,type:9,label:3},{name:"message_type",number:4,type:11,label:3,typeName:".google.protobuf.DescriptorProto"},{name:"enum_type",number:5,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto"},{name:"service",number:6,type:11,label:3,typeName:".google.protobuf.ServiceDescriptorProto"},{name:"extension",number:7,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"options",number:8,type:11,label:1,typeName:".google.protobuf.FileOptions"},{name:"source_code_info",number:9,type:11,label:1,typeName:".google.protobuf.SourceCodeInfo"},{name:"syntax",number:12,type:9,label:1},{name:"edition",number:14,type:14,label:1,typeName:".google.protobuf.Edition"}]},{name:"DescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"field",number:2,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"extension",number:6,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"nested_type",number:3,type:11,label:3,typeName:".google.protobuf.DescriptorProto"},{name:"enum_type",number:4,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto"},{name:"extension_range",number:5,type:11,label:3,typeName:".google.protobuf.DescriptorProto.ExtensionRange"},{name:"oneof_decl",number:8,type:11,label:3,typeName:".google.protobuf.OneofDescriptorProto"},{name:"options",number:7,type:11,label:1,typeName:".google.protobuf.MessageOptions"},{name:"reserved_range",number:9,type:11,label:3,typeName:".google.protobuf.DescriptorProto.ReservedRange"},{name:"reserved_name",number:10,type:9,label:3},{name:"visibility",number:11,type:14,label:1,typeName:".google.protobuf.SymbolVisibility"}],nestedType:[{name:"ExtensionRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.ExtensionRangeOptions"}]},{name:"ReservedRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1}]}]},{name:"ExtensionRangeOptions",field:[{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"},{name:"declaration",number:2,type:11,label:3,typeName:".google.protobuf.ExtensionRangeOptions.Declaration",options:{retention:2}},{name:"features",number:50,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"verification",number:3,type:14,label:1,typeName:".google.protobuf.ExtensionRangeOptions.VerificationState",defaultValue:"UNVERIFIED",options:{retention:2}}],nestedType:[{name:"Declaration",field:[{name:"number",number:1,type:5,label:1},{name:"full_name",number:2,type:9,label:1},{name:"type",number:3,type:9,label:1},{name:"reserved",number:5,type:8,label:1},{name:"repeated",number:6,type:8,label:1}]}],enumType:[{name:"VerificationState",value:[{name:"DECLARATION",number:0},{name:"UNVERIFIED",number:1}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"FieldDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"number",number:3,type:5,label:1},{name:"label",number:4,type:14,label:1,typeName:".google.protobuf.FieldDescriptorProto.Label"},{name:"type",number:5,type:14,label:1,typeName:".google.protobuf.FieldDescriptorProto.Type"},{name:"type_name",number:6,type:9,label:1},{name:"extendee",number:2,type:9,label:1},{name:"default_value",number:7,type:9,label:1},{name:"oneof_index",number:9,type:5,label:1},{name:"json_name",number:10,type:9,label:1},{name:"options",number:8,type:11,label:1,typeName:".google.protobuf.FieldOptions"},{name:"proto3_optional",number:17,type:8,label:1}],enumType:[{name:"Type",value:[{name:"TYPE_DOUBLE",number:1},{name:"TYPE_FLOAT",number:2},{name:"TYPE_INT64",number:3},{name:"TYPE_UINT64",number:4},{name:"TYPE_INT32",number:5},{name:"TYPE_FIXED64",number:6},{name:"TYPE_FIXED32",number:7},{name:"TYPE_BOOL",number:8},{name:"TYPE_STRING",number:9},{name:"TYPE_GROUP",number:10},{name:"TYPE_MESSAGE",number:11},{name:"TYPE_BYTES",number:12},{name:"TYPE_UINT32",number:13},{name:"TYPE_ENUM",number:14},{name:"TYPE_SFIXED32",number:15},{name:"TYPE_SFIXED64",number:16},{name:"TYPE_SINT32",number:17},{name:"TYPE_SINT64",number:18}]},{name:"Label",value:[{name:"LABEL_OPTIONAL",number:1},{name:"LABEL_REPEATED",number:3},{name:"LABEL_REQUIRED",number:2}]}]},{name:"OneofDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"options",number:2,type:11,label:1,typeName:".google.protobuf.OneofOptions"}]},{name:"EnumDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"value",number:2,type:11,label:3,typeName:".google.protobuf.EnumValueDescriptorProto"},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.EnumOptions"},{name:"reserved_range",number:4,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto.EnumReservedRange"},{name:"reserved_name",number:5,type:9,label:3},{name:"visibility",number:6,type:14,label:1,typeName:".google.protobuf.SymbolVisibility"}],nestedType:[{name:"EnumReservedRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1}]}]},{name:"EnumValueDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"number",number:2,type:5,label:1},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.EnumValueOptions"}]},{name:"ServiceDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"method",number:2,type:11,label:3,typeName:".google.protobuf.MethodDescriptorProto"},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.ServiceOptions"}]},{name:"MethodDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"input_type",number:2,type:9,label:1},{name:"output_type",number:3,type:9,label:1},{name:"options",number:4,type:11,label:1,typeName:".google.protobuf.MethodOptions"},{name:"client_streaming",number:5,type:8,label:1,defaultValue:"false"},{name:"server_streaming",number:6,type:8,label:1,defaultValue:"false"}]},{name:"FileOptions",field:[{name:"java_package",number:1,type:9,label:1},{name:"java_outer_classname",number:8,type:9,label:1},{name:"java_multiple_files",number:10,type:8,label:1,defaultValue:"false",options:{}},{name:"java_generate_equals_and_hash",number:20,type:8,label:1,options:{deprecated:!0}},{name:"java_string_check_utf8",number:27,type:8,label:1,defaultValue:"false"},{name:"optimize_for",number:9,type:14,label:1,typeName:".google.protobuf.FileOptions.OptimizeMode",defaultValue:"SPEED"},{name:"go_package",number:11,type:9,label:1},{name:"cc_generic_services",number:16,type:8,label:1,defaultValue:"false"},{name:"java_generic_services",number:17,type:8,label:1,defaultValue:"false"},{name:"py_generic_services",number:18,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:23,type:8,label:1,defaultValue:"false"},{name:"cc_enable_arenas",number:31,type:8,label:1,defaultValue:"true"},{name:"objc_class_prefix",number:36,type:9,label:1},{name:"csharp_namespace",number:37,type:9,label:1},{name:"swift_prefix",number:39,type:9,label:1},{name:"php_class_prefix",number:40,type:9,label:1},{name:"php_namespace",number:41,type:9,label:1},{name:"php_metadata_namespace",number:44,type:9,label:1},{name:"ruby_package",number:45,type:9,label:1},{name:"features",number:50,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],enumType:[{name:"OptimizeMode",value:[{name:"SPEED",number:1},{name:"CODE_SIZE",number:2},{name:"LITE_RUNTIME",number:3}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"MessageOptions",field:[{name:"message_set_wire_format",number:1,type:8,label:1,defaultValue:"false"},{name:"no_standard_descriptor_accessor",number:2,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"map_entry",number:7,type:8,label:1},{name:"deprecated_legacy_json_field_conflicts",number:11,type:8,label:1,options:{deprecated:!0}},{name:"features",number:12,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"FieldOptions",field:[{name:"ctype",number:1,type:14,label:1,typeName:".google.protobuf.FieldOptions.CType",defaultValue:"STRING"},{name:"packed",number:2,type:8,label:1},{name:"jstype",number:6,type:14,label:1,typeName:".google.protobuf.FieldOptions.JSType",defaultValue:"JS_NORMAL"},{name:"lazy",number:5,type:8,label:1,defaultValue:"false"},{name:"unverified_lazy",number:15,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"weak",number:10,type:8,label:1,defaultValue:"false",options:{deprecated:!0}},{name:"debug_redact",number:16,type:8,label:1,defaultValue:"false"},{name:"retention",number:17,type:14,label:1,typeName:".google.protobuf.FieldOptions.OptionRetention"},{name:"targets",number:19,type:14,label:3,typeName:".google.protobuf.FieldOptions.OptionTargetType"},{name:"edition_defaults",number:20,type:11,label:3,typeName:".google.protobuf.FieldOptions.EditionDefault"},{name:"features",number:21,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"feature_support",number:22,type:11,label:1,typeName:".google.protobuf.FieldOptions.FeatureSupport"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],nestedType:[{name:"EditionDefault",field:[{name:"edition",number:3,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"value",number:2,type:9,label:1}]},{name:"FeatureSupport",field:[{name:"edition_introduced",number:1,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"edition_deprecated",number:2,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"deprecation_warning",number:3,type:9,label:1},{name:"edition_removed",number:4,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"removal_error",number:5,type:9,label:1}]}],enumType:[{name:"CType",value:[{name:"STRING",number:0},{name:"CORD",number:1},{name:"STRING_PIECE",number:2}]},{name:"JSType",value:[{name:"JS_NORMAL",number:0},{name:"JS_STRING",number:1},{name:"JS_NUMBER",number:2}]},{name:"OptionRetention",value:[{name:"RETENTION_UNKNOWN",number:0},{name:"RETENTION_RUNTIME",number:1},{name:"RETENTION_SOURCE",number:2}]},{name:"OptionTargetType",value:[{name:"TARGET_TYPE_UNKNOWN",number:0},{name:"TARGET_TYPE_FILE",number:1},{name:"TARGET_TYPE_EXTENSION_RANGE",number:2},{name:"TARGET_TYPE_MESSAGE",number:3},{name:"TARGET_TYPE_FIELD",number:4},{name:"TARGET_TYPE_ONEOF",number:5},{name:"TARGET_TYPE_ENUM",number:6},{name:"TARGET_TYPE_ENUM_ENTRY",number:7},{name:"TARGET_TYPE_SERVICE",number:8},{name:"TARGET_TYPE_METHOD",number:9}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"OneofOptions",field:[{name:"features",number:1,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"EnumOptions",field:[{name:"allow_alias",number:2,type:8,label:1},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"deprecated_legacy_json_field_conflicts",number:6,type:8,label:1,options:{deprecated:!0}},{name:"features",number:7,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"EnumValueOptions",field:[{name:"deprecated",number:1,type:8,label:1,defaultValue:"false"},{name:"features",number:2,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"debug_redact",number:3,type:8,label:1,defaultValue:"false"},{name:"feature_support",number:4,type:11,label:1,typeName:".google.protobuf.FieldOptions.FeatureSupport"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"ServiceOptions",field:[{name:"features",number:34,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"deprecated",number:33,type:8,label:1,defaultValue:"false"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"MethodOptions",field:[{name:"deprecated",number:33,type:8,label:1,defaultValue:"false"},{name:"idempotency_level",number:34,type:14,label:1,typeName:".google.protobuf.MethodOptions.IdempotencyLevel",defaultValue:"IDEMPOTENCY_UNKNOWN"},{name:"features",number:35,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],enumType:[{name:"IdempotencyLevel",value:[{name:"IDEMPOTENCY_UNKNOWN",number:0},{name:"NO_SIDE_EFFECTS",number:1},{name:"IDEMPOTENT",number:2}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"UninterpretedOption",field:[{name:"name",number:2,type:11,label:3,typeName:".google.protobuf.UninterpretedOption.NamePart"},{name:"identifier_value",number:3,type:9,label:1},{name:"positive_int_value",number:4,type:4,label:1},{name:"negative_int_value",number:5,type:3,label:1},{name:"double_value",number:6,type:1,label:1},{name:"string_value",number:7,type:12,label:1},{name:"aggregate_value",number:8,type:9,label:1}],nestedType:[{name:"NamePart",field:[{name:"name_part",number:1,type:9,label:2},{name:"is_extension",number:2,type:8,label:2}]}]},{name:"FeatureSet",field:[{name:"field_presence",number:1,type:14,label:1,typeName:".google.protobuf.FeatureSet.FieldPresence",options:{retention:1,targets:[4,1],editionDefaults:[{value:"EXPLICIT",edition:900},{value:"IMPLICIT",edition:999},{value:"EXPLICIT",edition:1e3}]}},{name:"enum_type",number:2,type:14,label:1,typeName:".google.protobuf.FeatureSet.EnumType",options:{retention:1,targets:[6,1],editionDefaults:[{value:"CLOSED",edition:900},{value:"OPEN",edition:999}]}},{name:"repeated_field_encoding",number:3,type:14,label:1,typeName:".google.protobuf.FeatureSet.RepeatedFieldEncoding",options:{retention:1,targets:[4,1],editionDefaults:[{value:"EXPANDED",edition:900},{value:"PACKED",edition:999}]}},{name:"utf8_validation",number:4,type:14,label:1,typeName:".google.protobuf.FeatureSet.Utf8Validation",options:{retention:1,targets:[4,1],editionDefaults:[{value:"NONE",edition:900},{value:"VERIFY",edition:999}]}},{name:"message_encoding",number:5,type:14,label:1,typeName:".google.protobuf.FeatureSet.MessageEncoding",options:{retention:1,targets:[4,1],editionDefaults:[{value:"LENGTH_PREFIXED",edition:900}]}},{name:"json_format",number:6,type:14,label:1,typeName:".google.protobuf.FeatureSet.JsonFormat",options:{retention:1,targets:[3,6,1],editionDefaults:[{value:"LEGACY_BEST_EFFORT",edition:900},{value:"ALLOW",edition:999}]}},{name:"enforce_naming_style",number:7,type:14,label:1,typeName:".google.protobuf.FeatureSet.EnforceNamingStyle",options:{retention:2,targets:[1,2,3,4,5,6,7,8,9],editionDefaults:[{value:"STYLE_LEGACY",edition:900},{value:"STYLE2024",edition:1001}]}},{name:"default_symbol_visibility",number:8,type:14,label:1,typeName:".google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility",options:{retention:2,targets:[1],editionDefaults:[{value:"EXPORT_ALL",edition:900},{value:"EXPORT_TOP_LEVEL",edition:1001}]}}],nestedType:[{name:"VisibilityFeature",enumType:[{name:"DefaultSymbolVisibility",value:[{name:"DEFAULT_SYMBOL_VISIBILITY_UNKNOWN",number:0},{name:"EXPORT_ALL",number:1},{name:"EXPORT_TOP_LEVEL",number:2},{name:"LOCAL_ALL",number:3},{name:"STRICT",number:4}]}]}],enumType:[{name:"FieldPresence",value:[{name:"FIELD_PRESENCE_UNKNOWN",number:0},{name:"EXPLICIT",number:1},{name:"IMPLICIT",number:2},{name:"LEGACY_REQUIRED",number:3}]},{name:"EnumType",value:[{name:"ENUM_TYPE_UNKNOWN",number:0},{name:"OPEN",number:1},{name:"CLOSED",number:2}]},{name:"RepeatedFieldEncoding",value:[{name:"REPEATED_FIELD_ENCODING_UNKNOWN",number:0},{name:"PACKED",number:1},{name:"EXPANDED",number:2}]},{name:"Utf8Validation",value:[{name:"UTF8_VALIDATION_UNKNOWN",number:0},{name:"VERIFY",number:2},{name:"NONE",number:3}]},{name:"MessageEncoding",value:[{name:"MESSAGE_ENCODING_UNKNOWN",number:0},{name:"LENGTH_PREFIXED",number:1},{name:"DELIMITED",number:2}]},{name:"JsonFormat",value:[{name:"JSON_FORMAT_UNKNOWN",number:0},{name:"ALLOW",number:1},{name:"LEGACY_BEST_EFFORT",number:2}]},{name:"EnforceNamingStyle",value:[{name:"ENFORCE_NAMING_STYLE_UNKNOWN",number:0},{name:"STYLE2024",number:1},{name:"STYLE_LEGACY",number:2}]}],extensionRange:[{start:1e3,end:9995},{start:9995,end:1e4},{start:1e4,end:10001}]},{name:"FeatureSetDefaults",field:[{name:"defaults",number:1,type:11,label:3,typeName:".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"},{name:"minimum_edition",number:4,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"maximum_edition",number:5,type:14,label:1,typeName:".google.protobuf.Edition"}],nestedType:[{name:"FeatureSetEditionDefault",field:[{name:"edition",number:3,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"overridable_features",number:4,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"fixed_features",number:5,type:11,label:1,typeName:".google.protobuf.FeatureSet"}]}]},{name:"SourceCodeInfo",field:[{name:"location",number:1,type:11,label:3,typeName:".google.protobuf.SourceCodeInfo.Location"}],nestedType:[{name:"Location",field:[{name:"path",number:1,type:5,label:3,options:{packed:!0}},{name:"span",number:2,type:5,label:3,options:{packed:!0}},{name:"leading_comments",number:3,type:9,label:1},{name:"trailing_comments",number:4,type:9,label:1},{name:"leading_detached_comments",number:6,type:9,label:3}]}],extensionRange:[{start:536e6,end:536000001}]},{name:"GeneratedCodeInfo",field:[{name:"annotation",number:1,type:11,label:3,typeName:".google.protobuf.GeneratedCodeInfo.Annotation"}],nestedType:[{name:"Annotation",field:[{name:"path",number:1,type:5,label:3,options:{packed:!0}},{name:"source_file",number:2,type:9,label:1},{name:"begin",number:3,type:5,label:1},{name:"end",number:4,type:5,label:1},{name:"semantic",number:5,type:14,label:1,typeName:".google.protobuf.GeneratedCodeInfo.Annotation.Semantic"}],enumType:[{name:"Semantic",value:[{name:"NONE",number:0},{name:"SET",number:1},{name:"ALIAS",number:2}]}]}]}],enumType:[{name:"Edition",value:[{name:"EDITION_UNKNOWN",number:0},{name:"EDITION_LEGACY",number:900},{name:"EDITION_PROTO2",number:998},{name:"EDITION_PROTO3",number:999},{name:"EDITION_2023",number:1e3},{name:"EDITION_2024",number:1001},{name:"EDITION_UNSTABLE",number:9999},{name:"EDITION_1_TEST_ONLY",number:1},{name:"EDITION_2_TEST_ONLY",number:2},{name:"EDITION_99997_TEST_ONLY",number:99997},{name:"EDITION_99998_TEST_ONLY",number:99998},{name:"EDITION_99999_TEST_ONLY",number:99999},{name:"EDITION_MAX",number:2147483647}]},{name:"SymbolVisibility",value:[{name:"VISIBILITY_UNSET",number:0},{name:"VISIBILITY_LOCAL",number:1},{name:"VISIBILITY_EXPORT",number:2}]}]});var Ua=B(bu,1);var ya;(function(e){e[e.DECLARATION=0]="DECLARATION",e[e.UNVERIFIED=1]="UNVERIFIED"})(ya||(ya={}));var ba;(function(e){e[e.DOUBLE=1]="DOUBLE",e[e.FLOAT=2]="FLOAT",e[e.INT64=3]="INT64",e[e.UINT64=4]="UINT64",e[e.INT32=5]="INT32",e[e.FIXED64=6]="FIXED64",e[e.FIXED32=7]="FIXED32",e[e.BOOL=8]="BOOL",e[e.STRING=9]="STRING",e[e.GROUP=10]="GROUP",e[e.MESSAGE=11]="MESSAGE",e[e.BYTES=12]="BYTES",e[e.UINT32=13]="UINT32",e[e.ENUM=14]="ENUM",e[e.SFIXED32=15]="SFIXED32",e[e.SFIXED64=16]="SFIXED64",e[e.SINT32=17]="SINT32",e[e.SINT64=18]="SINT64"})(ba||(ba={}));var ga;(function(e){e[e.OPTIONAL=1]="OPTIONAL",e[e.REPEATED=3]="REPEATED",e[e.REQUIRED=2]="REQUIRED"})(ga||(ga={}));var Ea;(function(e){e[e.SPEED=1]="SPEED",e[e.CODE_SIZE=2]="CODE_SIZE",e[e.LITE_RUNTIME=3]="LITE_RUNTIME"})(Ea||(Ea={}));var Na;(function(e){e[e.STRING=0]="STRING",e[e.CORD=1]="CORD",e[e.STRING_PIECE=2]="STRING_PIECE"})(Na||(Na={}));var wa;(function(e){e[e.JS_NORMAL=0]="JS_NORMAL",e[e.JS_STRING=1]="JS_STRING",e[e.JS_NUMBER=2]="JS_NUMBER"})(wa||(wa={}));var Sa;(function(e){e[e.RETENTION_UNKNOWN=0]="RETENTION_UNKNOWN",e[e.RETENTION_RUNTIME=1]="RETENTION_RUNTIME",e[e.RETENTION_SOURCE=2]="RETENTION_SOURCE"})(Sa||(Sa={}));var Ta;(function(e){e[e.TARGET_TYPE_UNKNOWN=0]="TARGET_TYPE_UNKNOWN",e[e.TARGET_TYPE_FILE=1]="TARGET_TYPE_FILE",e[e.TARGET_TYPE_EXTENSION_RANGE=2]="TARGET_TYPE_EXTENSION_RANGE",e[e.TARGET_TYPE_MESSAGE=3]="TARGET_TYPE_MESSAGE",e[e.TARGET_TYPE_FIELD=4]="TARGET_TYPE_FIELD",e[e.TARGET_TYPE_ONEOF=5]="TARGET_TYPE_ONEOF",e[e.TARGET_TYPE_ENUM=6]="TARGET_TYPE_ENUM",e[e.TARGET_TYPE_ENUM_ENTRY=7]="TARGET_TYPE_ENUM_ENTRY",e[e.TARGET_TYPE_SERVICE=8]="TARGET_TYPE_SERVICE",e[e.TARGET_TYPE_METHOD=9]="TARGET_TYPE_METHOD"})(Ta||(Ta={}));var jt;(function(e){e[e.IDEMPOTENCY_UNKNOWN=0]="IDEMPOTENCY_UNKNOWN",e[e.NO_SIDE_EFFECTS=1]="NO_SIDE_EFFECTS",e[e.IDEMPOTENT=2]="IDEMPOTENT"})(jt||(jt={}));var va;(function(e){e[e.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0]="DEFAULT_SYMBOL_VISIBILITY_UNKNOWN",e[e.EXPORT_ALL=1]="EXPORT_ALL",e[e.EXPORT_TOP_LEVEL=2]="EXPORT_TOP_LEVEL",e[e.LOCAL_ALL=3]="LOCAL_ALL",e[e.STRICT=4]="STRICT"})(va||(va={}));var Ia;(function(e){e[e.FIELD_PRESENCE_UNKNOWN=0]="FIELD_PRESENCE_UNKNOWN",e[e.EXPLICIT=1]="EXPLICIT",e[e.IMPLICIT=2]="IMPLICIT",e[e.LEGACY_REQUIRED=3]="LEGACY_REQUIRED"})(Ia||(Ia={}));var xa;(function(e){e[e.ENUM_TYPE_UNKNOWN=0]="ENUM_TYPE_UNKNOWN",e[e.OPEN=1]="OPEN",e[e.CLOSED=2]="CLOSED"})(xa||(xa={}));var Aa;(function(e){e[e.REPEATED_FIELD_ENCODING_UNKNOWN=0]="REPEATED_FIELD_ENCODING_UNKNOWN",e[e.PACKED=1]="PACKED",e[e.EXPANDED=2]="EXPANDED"})(Aa||(Aa={}));var _a;(function(e){e[e.UTF8_VALIDATION_UNKNOWN=0]="UTF8_VALIDATION_UNKNOWN",e[e.VERIFY=2]="VERIFY",e[e.NONE=3]="NONE"})(_a||(_a={}));var Ra;(function(e){e[e.MESSAGE_ENCODING_UNKNOWN=0]="MESSAGE_ENCODING_UNKNOWN",e[e.LENGTH_PREFIXED=1]="LENGTH_PREFIXED",e[e.DELIMITED=2]="DELIMITED"})(Ra||(Ra={}));var Oa;(function(e){e[e.JSON_FORMAT_UNKNOWN=0]="JSON_FORMAT_UNKNOWN",e[e.ALLOW=1]="ALLOW",e[e.LEGACY_BEST_EFFORT=2]="LEGACY_BEST_EFFORT"})(Oa||(Oa={}));var Ca;(function(e){e[e.ENFORCE_NAMING_STYLE_UNKNOWN=0]="ENFORCE_NAMING_STYLE_UNKNOWN",e[e.STYLE2024=1]="STYLE2024",e[e.STYLE_LEGACY=2]="STYLE_LEGACY"})(Ca||(Ca={}));var La;(function(e){e[e.NONE=0]="NONE",e[e.SET=1]="SET",e[e.ALIAS=2]="ALIAS"})(La||(La={}));var ka;(function(e){e[e.EDITION_UNKNOWN=0]="EDITION_UNKNOWN",e[e.EDITION_LEGACY=900]="EDITION_LEGACY",e[e.EDITION_PROTO2=998]="EDITION_PROTO2",e[e.EDITION_PROTO3=999]="EDITION_PROTO3",e[e.EDITION_2023=1e3]="EDITION_2023",e[e.EDITION_2024=1001]="EDITION_2024",e[e.EDITION_UNSTABLE=9999]="EDITION_UNSTABLE",e[e.EDITION_1_TEST_ONLY=1]="EDITION_1_TEST_ONLY",e[e.EDITION_2_TEST_ONLY=2]="EDITION_2_TEST_ONLY",e[e.EDITION_99997_TEST_ONLY=99997]="EDITION_99997_TEST_ONLY",e[e.EDITION_99998_TEST_ONLY=99998]="EDITION_99998_TEST_ONLY",e[e.EDITION_99999_TEST_ONLY=99999]="EDITION_99999_TEST_ONLY",e[e.EDITION_MAX=2147483647]="EDITION_MAX"})(ka||(ka={}));var Fa;(function(e){e[e.VISIBILITY_UNSET=0]="VISIBILITY_UNSET",e[e.VISIBILITY_LOCAL=1]="VISIBILITY_LOCAL",e[e.VISIBILITY_EXPORT=2]="VISIBILITY_EXPORT"})(Fa||(Fa={}));function cr(e){return Object.assign(Object.assign({readUnknownFields:!0,recursionLimit:100},e),{depth:0})}s(cr,"makeReadContext");function de(e,t,n){let r=L(e);return ur(e).read(r,new ve(t),cr(n),t.byteLength),r}s(de,"fromBinary");var Da=new WeakMap;function ur(e){let t=Da.get(e);return t===void 0&&(t=gu(e)),t}s(ur,"compiledReader");function gu(e){let t=String(e),n=new Map,r={read:Eu(t,n),readGroup:Nu(t,n)};Da.set(e,r);for(let o of e.fields)n.set(o.number,Ma(o));return r}s(gu,"compileMessage");function Eu(e,t){return(n,r,o,a)=>{var i;if(++o.depth>o.recursionLimit)throw new Error(`cannot decode ${e} from binary: maximum recursion depth of ${o.recursionLimit} reached`);let c=r.pos+a,u=(i=n.$unknown)!==null&&i!==void 0?i:[];for(;r.pos<c;){let[l,f]=r.tag(),d=t.get(l);if(d===void 0){let h=r.skip(f,l,o.recursionLimit-o.depth);o.readUnknownFields&&u.push({no:l,wireType:f,data:h});continue}d(n,r,o,f)}u.length>0&&(n.$unknown=u),o.depth--}}s(Eu,"compileMessageReader");function Nu(e,t){return(n,r,o,a)=>{var i;if(++o.depth>o.recursionLimit)throw new Error(`cannot decode ${e} from binary: maximum recursion depth of ${o.recursionLimit} reached`);let c,u,l=(i=n.$unknown)!==null&&i!==void 0?i:[];for(;r.pos<r.len&&([c,u]=r.tag(),u!=F.EndGroup);){let f=t.get(c);if(f===void 0){let d=r.skip(u,c,o.recursionLimit-o.depth);o.readUnknownFields&&l.push({no:c,wireType:u,data:d});continue}f(n,r,o,u)}if(u!=F.EndGroup||c!==a)throw new Error("invalid end group tag");l.length>0&&(n.$unknown=l),o.depth--}}s(Nu,"compileGroupReader");function Va(e,t,n,r,o){Ma(n)(e[M],t,o,r)}s(Va,"readField");function Ma(e){switch(e.fieldKind){case"scalar":return wu(e);case"enum":return Su(e);case"message":return Tu(e);case"list":return vu(e);case"map":return Iu(e)}}s(Ma,"compileFieldReader");function wu(e){let t=Qt(e.scalar,e.utf8Validation,e.longAsString),n=e.localName;if(e.oneof){let r=e.oneof.localName;return(o,a)=>{o[r]={case:n,value:t(a)}}}return(r,o)=>{r[n]=t(o)}}s(wu,"compileScalarFieldReader");function Su(e){var t;let n=e.localName,r=(t=e.oneof)===null||t===void 0?void 0:t.localName;if(e.enum.open)return r!==void 0?(i,c)=>{i[r]={case:n,value:c.int32()}}:(i,c)=>{i[n]=c.int32()};let o=e.enum.values,a=e.number;return(i,c,u,l)=>{var f;let d=c.int32();if(o.some(h=>h.number===d))r!==void 0?i[r]={case:n,value:d}:i[n]=d;else if(u.readUnknownFields){let h=[];No(d,h);let p=(f=i.$unknown)!==null&&f!==void 0?f:[];p.push({no:a,wireType:l,data:new Uint8Array(h)}),i.$unknown=p}}}s(Su,"compileEnumFieldReader");function Tu(e){let t=e.localName,{toMessage:n,toLocal:r}=$(e),o=Pa(e);if(e.oneof){let a=e.oneof.localName;return(i,c,u)=>{let l=i[a],f=n(l.case===t?l.value:void 0);o(f,c,u),i[a]={case:t,value:r(f)}}}return(a,i,c)=>{let u=n(a[t]);o(u,i,c),a[t]=r(u)}}s(Tu,"compileMessageFieldReader");function Pa(e){let t=ur(e.message);if(e.delimitedEncoding){let n=e.number;return(r,o,a)=>t.readGroup(r,o,a,n)}return(n,r,o)=>t.read(n,r,o,r.uint32())}s(Pa,"compileChildReader");function vu(e){let t=e.localName;if(e.listKind=="message"){let{toMessage:i,toLocal:c}=$(e),u=Pa(e);return(l,f,d)=>{let h=i(void 0);u(h,f,d),l[t].push(c(h))}}let n=e.listKind=="enum"?m.INT32:e.scalar,r=e.listKind=="scalar"?e.longAsString:!1,o=Qt(n,e.utf8Validation,r),a=n!=m.STRING&&n!=m.BYTES;return(i,c,u,l)=>{let f=i[t];if(l==F.LengthDelimited&&a){let d=c.uint32()+c.pos;for(;c.pos<d;)f.push(o(c))}else f.push(o(c))}}s(vu,"compileListFieldReader");function Iu(e){let t=e.localName,n=Qt(e.mapKey,e.utf8Validation,!1),r=G(e.mapKey,!1),o,a;switch(e.mapKind){case"scalar":{let i=e.scalar,c=Qt(i,e.utf8Validation,!1);if(o=s(u=>c(u),"readValue"),i==m.BYTES)a=s(()=>new Uint8Array(0),"valueDefault");else{let u=G(i,!1);a=s(()=>u,"valueDefault")}break}case"enum":{let i=e.enum.values[0].number;o=s(c=>c.int32(),"readValue"),a=s(()=>i,"valueDefault");break}case"message":{let{toMessage:i,toLocal:c}=$(e),u=ur(e.message).read;o=s((l,f)=>{let d=i(void 0);return u(d,l,f,l.uint32()),c(d)},"readValue"),a=s(()=>c(i(void 0)),"valueDefault");break}}return(i,c,u)=>{let l=i[t],f,d,h=c.uint32(),p=c.pos+h;for(;c.pos<p;){let[y]=c.tag();switch(y){case 1:f=n(c);break;case 2:d=o(c,u);break}}f===void 0&&(f=r),d===void 0&&(d=a()),l[f]=d}}s(Iu,"compileMapFieldReader");function Qt(e,t,n){switch(e){case m.STRING:return r=>r.string(t);case m.BOOL:return r=>r.bool();case m.DOUBLE:return r=>r.double();case m.FLOAT:return r=>r.float();case m.INT32:return r=>r.int32();case m.INT64:return n?r=>String(r.int64()):r=>r.int64();case m.UINT64:return n?r=>String(r.uint64()):r=>r.uint64();case m.FIXED64:return n?r=>String(r.fixed64()):r=>r.fixed64();case m.BYTES:return r=>r.bytes();case m.FIXED32:return r=>r.fixed32();case m.SFIXED32:return r=>r.sfixed32();case m.SFIXED64:return n?r=>String(r.sfixed64()):r=>r.sfixed64();case m.SINT64:return n?r=>String(r.sint64()):r=>r.sint64();case m.UINT32:return r=>r.uint32();case m.SINT32:return r=>r.sint32()}}s(Qt,"compileScalarReader");function V(e,t){var n;let r=de(Ua,Me(e));return r.messageType.forEach(bt),r.dependency=(n=t?.map(a=>a.proto.name))!==null&&n!==void 0?n:[],zt(r,a=>t?.find(i=>i.proto.name===a)).getFile(r.name)}s(V,"fileDesc");var xe=V("Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJvdG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MYAiABKAVChQEKE2NvbS5nb29nbGUucHJvdG9idWZCDlRpbWVzdGFtcFByb3RvUAFaMmdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL3RpbWVzdGFtcHBi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM"),Ya=B(xe,0);function Ba(e){return xu(e.getTime())}s(Ba,"timestampFromDate");function xu(e){let t=Math.floor(e/1e3);return L(Ya,{seconds:x.parse(t),nanos:(e-t*1e3)*1e6})}s(xu,"timestampFromMs");var lr=V("Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIgASgFQoMBChNjb20uZ29vZ2xlLnByb3RvYnVmQg1EdXJhdGlvblByb3RvUAFaMWdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL2R1cmF0aW9ucGL4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw"),Ga=B(lr,0);var Au=V("Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYiJgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQnYKE2NvbS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAFaLGdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL2FueXBiogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM"),Wa=B(Au,0);var _u=2,Ru=3,Xa={writeUnknownFields:!0};function Ou(e){return e?Object.assign(Object.assign({},Xa),e):Xa}s(Ou,"makeWriteOptions");function Ae(e,t,n){let r=new De;return fr(e)(r,Ou(n),t),r.finish()}s(Ae,"toBinary");var $a=new WeakMap;function fr(e){let t=$a.get(e);return t===void 0&&(t=Cu(e)),t}s(fr,"compiledWriter");function Cu(e){let t=e.typeName,n=e.fields.concat().sort((i,c)=>i.number-c.number),r=n[0],o=[],a=s((i,c,u)=>{if(u.$typeName!==t&&r!==void 0)throw new R(r,`cannot use ${r} with message ${u.$typeName}`,"ForeignFieldError");for(let f=0;f<o.length;f++)o[f](i,c,u);let l=u.$unknown;if(l!==void 0&&c.writeUnknownFields)for(let f=0;f<l.length;f++){let{no:d,wireType:h,data:p}=l[f];i.tag(d,h).raw(p)}},"compiled");$a.set(e,a);for(let i of n)o.push(Za(i));return a}s(Cu,"compileMessage");function Za(e){switch(e.fieldKind){case"message":case"scalar":case"enum":return Lu(e);case"list":return Fu(e);case"map":return Uu(e)}}s(Za,"compileField");function Lu(e){let t=ku(e),n=e.localName;if(e.oneof){let r=e.oneof.localName;return(o,a,i)=>{let c=i[r];c.case===n&&t(o,a,c.value)}}if(e.presence!=_u){let r=e.presence==Ru?`cannot encode ${e} to binary: required field not set`:void 0;return(o,a,i)=>{let c=i[n];if(c!==void 0&&Object.prototype.hasOwnProperty.call(i,n))t(o,a,c);else if(r!==void 0)throw new Error(r)}}if(e.fieldKind=="enum"){let r=e.enum.values[0].number;return(o,a,i)=>{let c=i[n];c!==r&&t(o,a,c)}}switch(e.scalar){case m.BOOL:return(r,o,a)=>{let i=a[n];i!==!1&&t(r,o,i)};case m.STRING:return(r,o,a)=>{let i=a[n];i!==""&&t(r,o,i)};case m.BYTES:return(r,o,a)=>{let i=a[n];(!(i instanceof Uint8Array)||i.byteLength>0)&&t(r,o,i)};case m.DOUBLE:case m.FLOAT:return(r,o,a)=>{let i=a[n];Object.is(i,0)||t(r,o,i)};default:return(r,o,a)=>{let i=a[n];i!=0&&t(r,o,i)}}}s(Lu,"compileSingularField");function ku(e){switch(e.fieldKind){case"message":{let{toMessage:t}=$(e),n=Ka(e);return(r,o,a)=>{n(r,o,t(a))}}case"scalar":case"enum":{let t=e.fieldKind=="enum"?m.INT32:e.scalar,n=e.number,r=en(t),o=qt(t,e.parent.typeName,e.name);return(a,i,c)=>{a.tag(n,r),o(a,c)}}}}s(ku,"compileSingularValue");function Fu(e){let t=e.localName,n=e.number;switch(e.listKind){case"message":{let{toMessage:r}=$(e),o=Ka(e);return(a,i,c)=>{let u=c[t];for(let l=0;l<u.length;l++)o(a,i,r(u[l]))}}case"scalar":case"enum":{let r=e.listKind=="enum"?m.INT32:e.scalar,o=qt(r,e.parent.typeName,e.name);if(e.packed)return(i,c,u)=>{let l=u[t];if(l.length!=0){i.tag(n,F.LengthDelimited).fork();for(let f=0;f<l.length;f++)o(i,l[f]);i.join()}};let a=en(r);return(i,c,u)=>{let l=u[t];for(let f=0;f<l.length;f++)i.tag(n,a),o(i,l[f])}}}}s(Fu,"compileListField");function Uu(e){let t=e.localName,n=e.number,r=Du(e);if(e.mapKind=="message"){let{toMessage:c}=$(e),u=fr(e.message);return(l,f,d)=>{let h=d[t],p=Object.keys(h);for(let y=0;y<p.length;y++){let g=p[y];l.tag(n,F.LengthDelimited).fork(),r(l,g),l.tag(2,F.LengthDelimited).fork(),u(l,f,c(h[g])),l.join(),l.join()}}}let o=e.mapKind=="enum"?m.INT32:e.scalar,a=en(o),i=qt(o,e.parent.typeName,e.name);return(c,u,l)=>{let f=l[t],d=Object.keys(f);for(let h=0;h<d.length;h++){let p=d[h];c.tag(n,F.LengthDelimited).fork(),r(c,p),c.tag(2,a),i(c,f[p]),c.join()}}}s(Uu,"compileMapField");function Du(e){let t=en(e.mapKey),n=qt(e.mapKey,e.parent.typeName,e.name),r=Vu(e.mapKey);return(o,a)=>{o.tag(1,t),n(o,r(a))}}s(Du,"compileMapKey");function Vu(e){switch(e){case m.STRING:return t=>t;case m.BOOL:return t=>t==="true"?!0:t==="false"?!1:t;case m.UINT64:case m.FIXED64:return t=>{try{return x.uParse(t)}catch{return t}};case m.INT64:case m.SFIXED64:case m.SINT64:return t=>{try{return x.parse(t)}catch{return t}};default:return t=>{let n=Number.parseInt(t);return Number.isFinite(n)?n:t}}}s(Vu,"compileMapKeyConverter");function qt(e,t,n){let r=Mu(e);return(o,a)=>{try{r(o,a)}catch(i){throw i instanceof Error?new Error(`cannot encode field ${t}.${n} to binary: ${i.message}`):i}}}s(qt,"compileScalarValue");function Mu(e){switch(e){case m.STRING:return(t,n)=>t.string(n);case m.BOOL:return(t,n)=>t.bool(n);case m.DOUBLE:return(t,n)=>t.double(n);case m.FLOAT:return(t,n)=>t.float(n);case m.INT32:return(t,n)=>t.int32(n);case m.INT64:return(t,n)=>t.int64(n);case m.UINT64:return(t,n)=>t.uint64(n);case m.FIXED64:return(t,n)=>t.fixed64(n);case m.BYTES:return(t,n)=>t.bytes(n);case m.FIXED32:return(t,n)=>t.fixed32(n);case m.SFIXED32:return(t,n)=>t.sfixed32(n);case m.SFIXED64:return(t,n)=>t.sfixed64(n);case m.SINT64:return(t,n)=>t.sint64(n);case m.UINT32:return(t,n)=>t.uint32(n);case m.SINT32:return(t,n)=>t.sint32(n)}}s(Mu,"compileScalarWrite");function Ja(e,t,n,r){Za(r)(e,t,n[M])}s(Ja,"writeField");function Ka(e){let t=e.number,n=fr(e.message);return e.delimitedEncoding?(r,o,a)=>{r.tag(t,F.StartGroup),n(r,o,a),r.tag(t,F.EndGroup)}:(r,o,a)=>{r.tag(t,F.LengthDelimited).fork(),n(r,o,a),r.join()}}s(Ka,"compileChildWriter");function en(e){switch(e){case m.BYTES:case m.STRING:return F.LengthDelimited;case m.DOUBLE:case m.FIXED64:case m.SFIXED64:return F.Bit64;case m.FIXED32:case m.SFIXED32:case m.FLOAT:return F.Bit32;default:return F.Varint}}s(en,"writeTypeOfScalar");function za(e,t,n){let r=!1;return n||(n=L(Wa),r=!0),n.value=Ae(e,t),n.typeUrl=Bu(t.$typeName),r?n:void 0}s(za,"anyPack");function Yu(e,t){if(e.typeUrl==="")return!1;let n=typeof t=="string"?t:t.typeName,r=ja(e.typeUrl);return n===r}s(Yu,"anyIs");function Ha(e,t){if(e.typeUrl==="")return;let n=t.kind=="message"?t:t.getMessage(ja(e.typeUrl));if(!(!n||!Yu(e,n)))return de(n,e.value)}s(Ha,"anyUnpack");function Bu(e){return`type.googleapis.com/${e}`}s(Bu,"typeNameToUrl");function ja(e){let t=e.lastIndexOf("/"),n=t>=0?e.substring(t+1):e;if(!n.length)throw new Error(`invalid type url: ${e}`);return n}s(ja,"typeUrlToName");var tn=V("Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIHCgVFbXB0eUJ9ChNjb20uZ29vZ2xlLnByb3RvYnVmQgpFbXB0eVByb3RvUAFaLmdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL2VtcHR5cGL4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw");var mr=V("Chxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvEg9nb29nbGUucHJvdG9idWYihAEKBlN0cnVjdBIzCgZmaWVsZHMYASADKAsyIy5nb29nbGUucHJvdG9idWYuU3RydWN0LkZpZWxkc0VudHJ5GkUKC0ZpZWxkc0VudHJ5EgsKA2tleRgBIAEoCRIlCgV2YWx1ZRgCIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZToCOAEi6gEKBVZhbHVlEjAKCm51bGxfdmFsdWUYASABKA4yGi5nb29nbGUucHJvdG9idWYuTnVsbFZhbHVlSAASFgoMbnVtYmVyX3ZhbHVlGAIgASgBSAASFgoMc3RyaW5nX3ZhbHVlGAMgASgJSAASFAoKYm9vbF92YWx1ZRgEIAEoCEgAEi8KDHN0cnVjdF92YWx1ZRgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RIABIwCgpsaXN0X3ZhbHVlGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RWYWx1ZUgAQgYKBGtpbmQiMwoJTGlzdFZhbHVlEiYKBnZhbHVlcxgBIAMoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSobCglOdWxsVmFsdWUSDgoKTlVMTF9WQUxVRRAAQn8KE2NvbS5nb29nbGUucHJvdG9idWZCC1N0cnVjdFByb3RvUAFaL2dvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL3N0cnVjdHBi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM"),Qa=B(mr,0),dr=B(mr,1),qa=B(mr,2),nn;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE"})(nn||(nn={}));function ei(e,t,n){ni(t,e);let r=Gu(e.$unknown,t),[o,a,i]=Be(t),c=cr(n);for(let u of r)Va(o,new ve(u.data),a,u.wireType,c);return i()}s(ei,"getExtension");function ti(e,t,n){var r;ni(t,e);let o=((r=e.$unknown)!==null&&r!==void 0?r:[]).filter(l=>l.no!==t.number),[a,i]=Be(t,n),c=new De;Ja(c,{writeUnknownFields:!0},a,i);let u=new ve(c.finish());for(;u.pos<u.len;){let[l,f]=u.tag(),d=u.skip(f,l);o.push({no:l,wireType:f,data:d})}e.$unknown=o}s(ti,"setExtension");function Gu(e,t){if(e===void 0)return[];if(t.fieldKind==="enum"||t.fieldKind==="scalar"){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.number)return[e[n]];return[]}return e.filter(n=>n.no===t.number)}s(Gu,"filterUnknownFields");function Be(e,t){let n=e.typeName,r=Object.assign(Object.assign({},e),{kind:"field",parent:e.extendee,localName:n}),o=Object.assign(Object.assign({},e.extendee),{fields:[r],members:[r],oneofs:[]}),a=L(o,t!==void 0?{[n]:t}:void 0);return[Qo(o,a),r,()=>{let i=a[n];if(i===void 0){let c=e.message;return J(c)?G(c.fields[0].scalar,c.fields[0].longAsString):L(c)}return i}]}s(Be,"createExtensionContainer");function ni(e,t){if(e.extendee.typeName!=t.$typeName)throw new Error(`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}s(ni,"assertExtendee");var rn=Date.parse("0001-01-01T00:00:00Z"),on=Date.parse("9999-12-31T23:59:59Z"),an=-315576e6,sn=315576e6;var Wu=3,Xu=2,ri={alwaysEmitImplicit:!1,enumAsInteger:!1,useProtoFieldName:!1};function $u(e){return e?Object.assign(Object.assign({},ri),e):ri}s($u,"makeWriteOptions");function hr(e,t,n){return cn(e)($u(n),t)}s(hr,"toJson");function ai(e,t,n){var r;let o=hr(e,t,n);return JSON.stringify(o,null,(r=n?.prettySpaces)!==null&&r!==void 0?r:0)}s(ai,"toJsonString");var pr=new WeakMap;function cn(e){let t=pr.get(e);return t===void 0&&(t=Zu(e)),t}s(cn,"compiledWriter");function Zu(e){let t=e.typeName,n=Ju(e);if(n!==void 0){let c=e.fields[0],u=s((l,f)=>{if(f.$typeName!==t&&c!==void 0)throw new R(c,`cannot use ${c} with message ${f.$typeName}`,"ForeignFieldError");return n(l,f)},"compiledWriter");return pr.set(e,u),u}let r=e.fields.concat().sort((c,u)=>c.number-u.number),o=r[0],a=[],i=s((c,u)=>{if(u.$typeName!==t&&o!==void 0)throw new R(o,`cannot use ${o} with message ${u.$typeName}`,"ForeignFieldError");let l={};for(let f=0;f<a.length;f++)a[f](c,u,l);return c.registry&&qu(l,c,c.registry,u,e),l},"compiledWriter");pr.set(e,i);for(let c of r)a.push(Ku(c));return i}s(Zu,"compileMessage");function Ju(e){if(e.typeName.startsWith("google.protobuf."))switch(e.typeName){case"google.protobuf.Any":return(t,n)=>el(n,t);case"google.protobuf.Timestamp":return(t,n)=>rl(n);case"google.protobuf.Duration":return(t,n)=>tl(n);case"google.protobuf.FieldMask":return(t,n)=>nl(n);case"google.protobuf.Struct":return(t,n)=>ui(n);case"google.protobuf.Value":return(t,n)=>gr(n);case"google.protobuf.ListValue":return(t,n)=>li(n);default:if(J(e)){let t=e.fields[0],n=t.localName,r=G(t.scalar,!1),o=un(t);return(a,i)=>{let c=i[n];return o(a,c===void 0?r:c)}}return}}s(Ju,"compileWkt");function Ku(e){switch(e.fieldKind){case"scalar":case"enum":case"message":return zu(e);case"list":case"map":{let t=e.fieldKind=="list"?si(e):ci(e),n=e.name,r=e.jsonName,o=e.localName;return(a,i,c)=>{let u=t(a,i[o]);u!==void 0&&(c[a.useProtoFieldName?n:r]=u)}}}}s(Ku,"compileField");function zu(e){let t=ii(e),n=e.name,r=e.jsonName,o=e.localName;if(e.oneof){let a=e.oneof.localName;return(i,c,u)=>{let l=c[a];l.case===o&&(u[i.useProtoFieldName?n:r]=t(i,l.value))}}if(e.presence!=Xu){let a=e.presence==Wu?`cannot encode ${e} to JSON: required field not set`:void 0;return(i,c,u)=>{let l=c[o];if(l!==void 0&&Object.prototype.hasOwnProperty.call(c,o))u[i.useProtoFieldName?n:r]=t(i,l);else if(a!==void 0)throw new Error(a)}}if(e.fieldKind=="enum"){let a=e.enum.values[0].number;return(i,c,u)=>{let l=c[o];(l!==a||i.alwaysEmitImplicit)&&(u[i.useProtoFieldName?n:r]=t(i,l))}}switch(e.scalar){case m.BOOL:return(a,i,c)=>{let u=i[o];(u!==!1||a.alwaysEmitImplicit)&&(c[a.useProtoFieldName?n:r]=t(a,u))};case m.STRING:return(a,i,c)=>{let u=i[o];(u!==""||a.alwaysEmitImplicit)&&(c[a.useProtoFieldName?n:r]=t(a,u))};case m.BYTES:return(a,i,c)=>{let u=i[o];(!(u instanceof Uint8Array)||u.byteLength>0||a.alwaysEmitImplicit)&&(c[a.useProtoFieldName?n:r]=t(a,u))};case m.DOUBLE:case m.FLOAT:return(a,i,c)=>{let u=i[o];(!Object.is(u,0)||a.alwaysEmitImplicit)&&(c[a.useProtoFieldName?n:r]=t(a,u))};default:return(a,i,c)=>{let u=i[o];(u!=0||a.alwaysEmitImplicit)&&(c[a.useProtoFieldName?n:r]=t(a,u))}}}s(zu,"compileSingularField");function Hu(e){switch(e.fieldKind){case"scalar":case"enum":case"message":return ii(e);case"list":return si(e);case"map":return ci(e)}}s(Hu,"compileFieldValue");function ii(e){switch(e.fieldKind){case"scalar":return un(e);case"enum":return br(e);case"message":return yr(e)}}s(ii,"compileSingularValue");function yr(e){let{toMessage:t}=$(e),n=cn(e.message);return(r,o)=>n(r,t(o))}s(yr,"compileMessageValue");function si(e){let t=ju(e);return(n,r)=>{let o=r;if(o.length==0&&!n.alwaysEmitImplicit)return;let a=[];for(let i=0;i<o.length;i++)a.push(t(n,o[i]));return a}}s(si,"compileListValue");function ju(e){switch(e.listKind){case"scalar":return un(e);case"enum":return br(e);case"message":return yr(e)}}s(ju,"compileListItemValue");function ci(e){let t=Qu(e);return(n,r)=>{let o=r,a=Object.keys(o);if(a.length==0&&!n.alwaysEmitImplicit)return;let i={};for(let c=0;c<a.length;c++){let u=a[c];i[u]=t(n,o[u])}return i}}s(ci,"compileMapValue");function Qu(e){switch(e.mapKind){case"scalar":return un(e);case"enum":return br(e);case"message":return yr(e)}}s(Qu,"compileMapEntryValue");function br(e){let t=e.enum;return t.typeName=="google.protobuf.NullValue"?(n,r)=>{if(typeof r!="number")throw oi(t,r);return null}:(n,r)=>{var o,a;if(typeof r!="number")throw oi(t,r);return n.enumAsInteger?r:(a=(o=t.value[r])===null||o===void 0?void 0:o.name)!==null&&a!==void 0?a:r}}s(br,"compileEnumValue");function oi(e,t){return new Error(`cannot encode ${e} to JSON: expected number, got ${D(t)}`)}s(oi,"errorEnumValue");function un(e){switch(e.scalar){case m.INT32:case m.SFIXED32:case m.SINT32:case m.FIXED32:case m.UINT32:return(t,n)=>{if(typeof n!="number")throw Ge(e,n);return n};case m.FLOAT:case m.DOUBLE:return(t,n)=>{if(typeof n!="number")throw Ge(e,n);return Number.isNaN(n)?"NaN":n===Number.POSITIVE_INFINITY?"Infinity":n===Number.NEGATIVE_INFINITY?"-Infinity":n};case m.STRING:return(t,n)=>{if(typeof n!="string")throw Ge(e,n);return n};case m.BOOL:return(t,n)=>{if(typeof n!="boolean")throw Ge(e,n);return n};case m.UINT64:case m.FIXED64:case m.INT64:case m.SFIXED64:case m.SINT64:return(t,n)=>{if(typeof n=="bigint"||typeof n=="string"||typeof n=="number"&&Number.isInteger(n))return n.toString();throw Ge(e,n)};case m.BYTES:return(t,n)=>{if(n instanceof Uint8Array)return Pe(n);throw Ge(e,n)}}}s(un,"compileScalarValue");function Ge(e,t){var n;return new Error(`cannot encode ${e} to JSON: ${(n=Bt(e,t))===null||n===void 0?void 0:n.message}`)}s(Ge,"errorScalarValue");function qu(e,t,n,r,o){let a=r.$unknown;if(a===void 0)return;let i=new Set;for(let c=0;c<a.length;c++){let{no:u}=a[c];if(!i.has(u)){i.add(u);let l=n.getExtensionFor(o,u);if(!l)continue;let f=ei(r,l),[d,h]=Be(l,f),p=d[M],y=Hu(h)(t,p[h.localName]);y!==void 0&&(e[l.jsonName]=y)}}}s(qu,"writeExtensions");function el(e,t){if(e.typeUrl==="")return{};let{registry:n}=t,r,o;if(n&&(r=Ha(e,n),r&&(o=n.getMessage(r.$typeName))),!o||!r)throw new Error(`cannot encode message ${e.$typeName} to JSON: "${e.typeUrl}" is not in the type registry`);let a=Pt(o)?{value:cn(o)(t,r)}:cn(o)(t,r);return a["@type"]=e.typeUrl,a}s(el,"anyToJson");function tl(e){let t=Number(e.seconds),n=e.nanos;if(t>sn||t<an)throw new Error(`cannot encode message ${e.$typeName} to JSON: value out of range`);if(t>0&&n<0||t<0&&n>0)throw new Error(`cannot encode message ${e.$typeName} to JSON: nanos sign must match seconds sign`);let r=e.seconds.toString();if(n!==0){let o=Math.abs(n).toString();o="0".repeat(9-o.length)+o,o.substring(3)==="000000"?o=o.substring(0,3):o.substring(6)==="000"&&(o=o.substring(0,6)),r+="."+o,n<0&&t==0&&(r="-"+r)}return r+"s"}s(tl,"durationToJson");function nl(e){return e.paths.map(t=>{if(Jt(fe(t))!==t)throw new Error(`cannot encode message ${e.$typeName} to JSON: lowerCamelCase of path name "${t}" is irreversible`);return fe(t)}).join(",")}s(nl,"fieldMaskToJson");function ui(e){let t={},n=Object.keys(e.fields);for(let r=0;r<n.length;r++){let o=n[r];t[o]=gr(e.fields[o])}return t}s(ui,"structToJson");function gr(e){switch(e.kind.case){case"nullValue":return null;case"numberValue":if(!Number.isFinite(e.kind.value))throw new Error(`${e.$typeName} cannot be NaN or Infinity`);return e.kind.value;case"boolValue":return e.kind.value;case"stringValue":return e.kind.value;case"structValue":return ui(e.kind.value);case"listValue":return li(e.kind.value);default:throw new Error(`${e.$typeName} must have a value`)}}s(gr,"valueToJson");function li(e){return e.values.map(gr)}s(li,"listValueToJson");function rl(e){let t=Number(e.seconds)*1e3;if(t<rn||t>on)throw new Error(`cannot encode message ${e.$typeName} to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);if(e.nanos<0)throw new Error(`cannot encode message ${e.$typeName} to JSON: nanos must not be negative`);if(e.nanos>999999999)throw new Error(`cannot encode message ${e.$typeName} to JSON: nanos must not be greater than 99999999`);let n="Z";if(e.nanos>0){let r=(e.nanos+1e9).toString().substring(1);r.substring(3)==="000000"?n="."+r.substring(0,3)+"Z":r.substring(6)==="000"?n="."+r.substring(0,6)+"Z":n="."+r+"Z"}return new Date(t).toISOString().replace(".000Z",n)}s(rl,"timestampToJson");var ol=2;function al(e){return Object.assign(Object.assign({ignoreUnknownFields:!1,recursionLimit:100},e),{depth:0})}s(al,"makeReadContext");function mi(e,t,n){return il(e,bl(t,e.typeName),n)}s(mi,"fromJsonString");function il(e,t,n){let r=L(e);return sl(e,r,t,n),r}s(il,"fromJson");function sl(e,t,n,r){try{We(e)(t,n,al(r))}catch(o){throw Po(o)?new Error(`cannot decode ${o.field()} from JSON: ${o.message}`,{cause:o}):o}}s(sl,"readMessage");var Er=new WeakMap;function We(e){let t=Er.get(e);return t===void 0&&(t=cl(e)),t}s(We,"compiledReader");function cl(e){let t=String(e),n=ul(e);if(n!==void 0){let i=s((c,u,l)=>{if(++l.depth>l.recursionLimit)throw new Error(`cannot decode ${t} from JSON: maximum recursion depth of ${l.recursionLimit} reached`);n(c,u,l),l.depth--},"compiled");return Er.set(e,i),i}let r=e.typeName,o=new Map,a=s((i,c,u)=>{var l;if(++u.depth>u.recursionLimit)throw new Error(`cannot decode ${t} from JSON: maximum recursion depth of ${u.recursionLimit} reached`);if(c==null||Array.isArray(c)||typeof c!="object")throw new Error(`cannot decode ${t} from JSON: ${D(c)}`);let f=new Map,d=new Set,h=Object.keys(c);for(let p=0;p<h.length;p++){let y=h[p],g=c[y],N=o.get(y);if(N!==void 0){let E=N.field;if(d.has(E))throw new R(E,"set multiple times");if(d.add(E),N.oneofScalarNullSkip&&g===null)continue;if(N.oneof){let S=f.get(N.oneof);if(S!==void 0)throw new R(N.oneof,`oneof set multiple times by ${S.name} and ${E.name}`);f.set(N.oneof,E)}N.read(i,g,u)}else{let E=y.startsWith("[")&&y.endsWith("]")?(l=u.registry)===null||l===void 0?void 0:l.getExtension(y.substring(1,y.length-1)):void 0;if(E?.extendee.typeName==r){let[S,T,I]=Be(E);fi(T)(S[M],g,u),ti(i,E,I())}if(E===void 0&&!u.ignoreUnknownFields)throw new Error(`cannot decode ${t} from JSON: key "${y}" is unknown`)}}u.depth--},"compiled");Er.set(e,a);for(let i of e.fields){let c={read:fi(i),field:i,oneof:i.oneof,oneofScalarNullSkip:i.oneof!==void 0&&i.fieldKind=="scalar"};o.set(i.name,c).set(i.jsonName,c)}return a}s(cl,"compileMessage");function ul(e){if(e.typeName.startsWith("google.protobuf."))switch(e.typeName){case"google.protobuf.Any":return(t,n,r)=>El(t,n,r);case"google.protobuf.Timestamp":return(t,n)=>Nl(t,n);case"google.protobuf.Duration":return(t,n)=>wl(t,n);case"google.protobuf.FieldMask":return(t,n)=>Sl(t,n);case"google.protobuf.Struct":return(t,n,r)=>yi(t,n,r);case"google.protobuf.Value":return(t,n,r)=>vr(t,n,r);case"google.protobuf.ListValue":return(t,n,r)=>bi(t,n,r);default:if(J(e)){let t=e.fields[0],n=t.localName,r=t.scalar,o=t.longAsString,a=pi(t);return(i,c)=>{c===null?i[n]=G(r,o):i[n]=a(c)}}return}}s(ul,"compileWkt");function fi(e){switch(e.fieldKind){case"scalar":return ll(e);case"enum":return fl(e);case"message":return ml(e);case"list":return dl(e);case"map":return hl(e)}}s(fi,"compileFieldReader");function ll(e){let t=pi(e),n=e.localName;if(e.oneof){let o=e.oneof.localName;return(a,i)=>{a[o]={case:n,value:t(i)}}}let r=di(e);return(o,a)=>{a===null?r(o):o[n]=t(a)}}s(ll,"compileScalarFieldReader");function di(e){let t=e.localName;if(e.presence!=ol)return o=>{delete o[t]};if(e.fieldKind=="enum"){let o=e.enum.values[0].number;return a=>{a[t]=o}}let n=e.scalar,r=e.longAsString;return o=>{o[t]=G(n,r)}}s(di,"compileClear");function fl(e){let t=Nr(e.enum),n=wr(e.enum),r=e.localName,o=e.enum.typeName!="google.protobuf.NullValue";if(e.oneof){let i=e.oneof.localName;return(c,u,l)=>{if(u===null&&o){c[i].case===r&&(c[i]={case:void 0});return}let f=t(u,l.ignoreUnknownFields);if(f===Xe)return;let d=n(f);if(d!==!0)throw new R(e,K(e,f,d));c[i]={case:r,value:f}}}let a=di(e);return(i,c,u)=>{if(c===null&&o){a(i);return}let l=t(c,u.ignoreUnknownFields);if(l===Xe)return;let f=n(l);if(f!==!0)throw new R(e,K(e,l,f));i[r]=l}}s(fl,"compileEnumFieldReader");function ml(e){let t=e.localName,{toMessage:n,toLocal:r}=$(e),o=We(e.message),a=e.message.typeName!="google.protobuf.Value";if(e.oneof){let i=e.oneof.localName;return(c,u,l)=>{let f=c[i];if(u===null&&a){f.case===t&&(c[i]={case:void 0});return}let d=n(f.case===t?f.value:void 0);o(d,u,l),c[i]={case:t,value:r(d)}}}return(i,c,u)=>{if(c===null&&a){delete i[t];return}let l=n(i[t]);o(l,c,u),i[t]=r(l)}}s(ml,"compileMessageFieldReader");function dl(e){let t=e.localName,n=pl(e);return(r,o,a)=>{if(o===null)return;if(!Array.isArray(o))throw new R(e,"expected Array, got "+D(o));let i=r[t];for(let c=0;c<o.length;c++){let u=n(o[c],a,i.length);u!==Xe&&i.push(u)}}}s(dl,"compileListFieldReader");function pl(e){switch(e.listKind){case"scalar":{let t=Sr(e),n=le(e.scalar),r=Tr(e);return(o,a,i)=>{if(o===null)throw new R(e,"list item must not be null");let c=t(o),u=n(c);if(u!==!0)throw new R(e,`list item #${i+1}: ${K(e,c,u)}`);return r(c)}}case"enum":{let t=Nr(e.enum),n=wr(e.enum),r=e.enum.typeName!="google.protobuf.NullValue";return(o,a,i)=>{if(o===null&&r)throw new R(e,"list item must not be null");let c=t(o,a.ignoreUnknownFields);if(c===Xe)return c;let u=n(c);if(u!==!0)throw new R(e,`list item #${i+1}: ${K(e,c,u)}`);return c}}case"message":{let{toMessage:t,toLocal:n}=$(e),r=We(e.message),o=e.message.typeName!="google.protobuf.Value";return(a,i)=>{if(a===null&&o)throw new R(e,"list item must not be null");let c=t(void 0);return r(c,a,i),n(c)}}}}s(pl,"compileListItemReader");function hl(e){let t=e.localName,n=e.mapKey,r=yl(n),o=le(n),a,i,c=s(l=>l,"toLocalValue"),u=!0;switch(e.mapKind){case"scalar":{a=Sr(e),i=le(e.scalar),c=Tr(e);break}case"enum":{let l=Nr(e.enum);a=s((f,d)=>l(f,d.ignoreUnknownFields),"parseValue"),i=wr(e.enum),u=e.enum.typeName!="google.protobuf.NullValue";break}case"message":{let{toMessage:l,toLocal:f}=$(e),d=We(e.message);u=e.message.typeName!="google.protobuf.Value",a=s((h,p)=>{let y=l(void 0);return d(y,h,p),f(y)},"parseValue");break}}return(l,f,d)=>{if(f===null)return;if(typeof f!="object"||Array.isArray(f))throw new R(e,"expected object, got "+D(f));let h=l[t],p=new Set,y=Object.keys(f);for(let g=0;g<y.length;g++){let N=y[g],E=f[N],S=r(N);if(p.has(S))throw new R(e,`duplicate map key "${N}"`);if(p.add(S),E===null&&u)throw new R(e,"map value must not be null");let T=a(E,d);if(T===Xe)continue;let I=o(S);if(I!==!0)throw new R(e,`invalid map key: ${K({scalar:n},S,I)}`);if(i!==void 0){let v=i(T);if(v!==!0)throw new R(e,`map entry ${D(S)}: ${K(e,T,v)}`)}h[S]=c(T)}}}s(hl,"compileMapFieldReader");var Xe=Symbol();function Nr(e){let t=e.values[0].number,n=e.values;return(r,o)=>{if(r===null)return t;switch(typeof r){case"number":if(Number.isInteger(r))return r;break;case"string":{let a=n.find(i=>i.name===r);if(a!==void 0)return a.number;if(o)return Xe;break}}throw new Error(`cannot decode ${e} from JSON: ${D(r)}`)}}s(Nr,"compileEnumConverter");function wr(e){if(e.open)return le(m.INT32);let t=e.values;return n=>t.some(r=>r.number===n)}s(wr,"compileEnumCheck");function pi(e){let t=Sr(e),n=le(e.scalar),r=Tr(e);return o=>{let a=t(o),i=n(a);if(i!==!0)throw new R(e,K(e,a,i));return r(a)}}s(pi,"compileScalarConverter");function Sr(e){switch(e.scalar){case m.DOUBLE:case m.FLOAT:return t=>{if(t==="NaN")return NaN;if(t==="Infinity")return Number.POSITIVE_INFINITY;if(t==="-Infinity")return Number.NEGATIVE_INFINITY;if(typeof t=="number"){if(Number.isNaN(t))throw new R(e,"unexpected NaN number");if(!Number.isFinite(t))throw new R(e,"unexpected infinite number");return t}if(typeof t=="string"){if(t===""||t.trim().length!==t.length)return t;let n=Number(t);return Number.isFinite(n)?n:t}return t};case m.INT32:case m.FIXED32:case m.SFIXED32:case m.SINT32:case m.UINT32:return hi;case m.BYTES:return t=>{if(typeof t=="string"){if(t==="")return new Uint8Array(0);try{return Me(t)}catch(n){let r=n instanceof Error?n.message:String(n);throw new R(e,r)}}return t};default:return t=>t}}s(Sr,"compileScalarParse");function Tr(e){let t=e.fieldKind!=="map"&&e.longAsString;switch(e.scalar){case m.INT64:case m.SFIXED64:case m.SINT64:return t?n=>String(n):n=>typeof n=="string"||typeof n=="number"?x.parse(n):n;case m.FIXED64:case m.UINT64:return t?n=>String(n):n=>typeof n=="string"||typeof n=="number"?x.uParse(n):n;default:return n=>n}}s(Tr,"compileScalarToLocal");function yl(e){switch(e){case m.BOOL:return t=>{switch(t){case"true":return!0;case"false":return!1}return t};case m.INT32:case m.FIXED32:case m.UINT32:case m.SFIXED32:case m.SINT32:return hi;case m.INT64:case m.SINT64:case m.SFIXED64:case m.UINT64:case m.FIXED64:return t=>/^-?0+$/.test(t)?"0":t.replace(/^(-?)0+(?=\d)/,"$1");default:return t=>t}}s(yl,"compileMapKeyParse");function hi(e){if(typeof e=="string"){if(e===""||e.trim().length!==e.length)return e;let t=Number(e);return Number.isNaN(t)?e:t}return e}s(hi,"int32FromJson");function bl(e,t){let n;try{n=JSON.parse(e)}catch(r){let o=r instanceof Error?r.message:String(r);throw new Error(`cannot decode message ${t} from JSON: ${o}`,{cause:r})}return gl(e,t),n}s(bl,"parseJsonString");function gl(e,t){let n=[],r=!1,o=0;for(;o<e.length;)switch(e[o]){case"{":n.push(new Set),r=!0,o++;break;case"[":n.push(null),r=!1,o++;break;case"}":case"]":n.pop(),r=!1,o++;break;case",":r=n[n.length-1]!=null,o++;break;case":":r=!1,o++;break;case'"':{let a=o++,i=!1;for(;o<e.length;){if(e[o]=="\\"){i=!0,o+=2;continue}if(e[o]=='"')break;o++}let c=o++,u=n[n.length-1];if(r&&u){let l=i?JSON.parse(e.substring(a,c+1)):e.substring(a+1,c);if(u.has(l))throw new Error(`cannot decode message ${t} from JSON: duplicate object key "${l}"`);u.add(l)}r=!1;break}default:o++;break}}s(gl,"checkDuplicateKeys");function El(e,t,n){var r;if(t===null||Array.isArray(t)||typeof t!="object")throw new Error(`cannot decode message ${e.$typeName} from JSON: expected object but got ${D(t)}`);if(Object.keys(t).length==0)return;let o=t["@type"];if(typeof o!="string"||o=="")throw new Error(`cannot decode message ${e.$typeName} from JSON: "@type" is empty`);let a=o.includes("/")?o.substring(o.lastIndexOf("/")+1):o;if(!a.length)throw new Error(`cannot decode message ${e.$typeName} from JSON: "@type" is invalid`);let i=(r=n.registry)===null||r===void 0?void 0:r.getMessage(a);if(!i)throw new Error(`cannot decode message ${e.$typeName} from JSON: ${o} is not in the type registry`);let c=L(i);if(Pt(i)&&Object.prototype.hasOwnProperty.call(t,"value"))We(i)(c,t.value,n);else{let u=Object.assign({},t);delete u["@type"],We(i)(c,u,n)}za(i,c,e)}s(El,"anyFromJson");function Nl(e,t){if(typeof t!="string")throw new Error(`cannot decode message ${e.$typeName} from JSON: ${D(t)}`);let n=t.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]{1,9}))?(?:Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw new Error(`cannot decode message ${e.$typeName} from JSON: invalid RFC 3339 string`);let r=Date.parse(n[1]+"-"+n[2]+"-"+n[3]+"T"+n[4]+":"+n[5]+":"+n[6]+(n[8]?n[8]:"Z"));if(Number.isNaN(r))throw new Error(`cannot decode message ${e.$typeName} from JSON: invalid RFC 3339 string`);if(r<rn||r>on)throw new Error(`cannot decode message ${e.$typeName} from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);e.seconds=x.parse(r/1e3),e.nanos=0,n[7]&&(e.nanos=parseInt("1"+n[7]+"0".repeat(9-n[7].length))-1e9)}s(Nl,"timestampFromJson");function wl(e,t){if(typeof t!="string")throw new Error(`cannot decode message ${e.$typeName} from JSON: ${D(t)}`);let n=t.match(/^(-?[0-9]+)(?:\.([0-9]+))?s/);if(n===null)throw new Error(`cannot decode message ${e.$typeName} from JSON: ${D(t)}`);let r=Number(n[1]);if(r>sn||r<an)throw new Error(`cannot decode message ${e.$typeName} from JSON: ${D(t)}`);if(e.seconds=x.parse(r),typeof n[2]!="string")return;let o=n[2]+"0".repeat(9-n[2].length);e.nanos=parseInt(o),(r<0||Object.is(r,-0))&&(e.nanos=-e.nanos)}s(wl,"durationFromJson");function Sl(e,t){if(typeof t!="string")throw new Error(`cannot decode message ${e.$typeName} from JSON: ${D(t)}`);t!==""&&(e.paths=t.split(",").map(n=>{if(n.includes("_"))throw new Error(`cannot decode message ${e.$typeName} from JSON: path names must be lowerCamelCase`);return Jt(n)}))}s(Sl,"fieldMaskFromJson");function yi(e,t,n){if(typeof t!="object"||t==null||Array.isArray(t))throw new Error(`cannot decode message ${e.$typeName} from JSON ${D(t)}`);let r=Object.keys(t);for(let o=0;o<r.length;o++){let a=r[o],i=L(dr);vr(i,t[a],n),e.fields[a]=i}}s(yi,"structFromJson");function vr(e,t,n){if(++n.depth>n.recursionLimit)throw new Error(`cannot decode ${e.$typeName} from JSON: maximum recursion depth of ${n.recursionLimit} reached`);switch(typeof t){case"number":e.kind={case:"numberValue",value:t};break;case"string":e.kind={case:"stringValue",value:t};break;case"boolean":e.kind={case:"boolValue",value:t};break;case"object":if(t===null)e.kind={case:"nullValue",value:nn.NULL_VALUE};else if(Array.isArray(t)){let r=L(qa);bi(r,t,n),e.kind={case:"listValue",value:r}}else{let r=L(Qa);yi(r,t,n),e.kind={case:"structValue",value:r}}break;default:throw new Error(`cannot decode message ${e.$typeName} from JSON ${D(t)}`)}return n.depth--,e}s(vr,"valueFromJson");function bi(e,t,n){if(!Array.isArray(t))throw new Error(`cannot decode message ${e.$typeName} from JSON ${D(t)}`);for(let r=0;r<t.length;r++){let o=L(dr);vr(o,t[r],n),e.values.push(o)}}s(bi,"listValueFromJson");function $e(e){let t=b[e];return typeof t!="string"?e.toString():t[0].toLowerCase()+t.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}s($e,"codeToString");var ln;function gi(e){if(!ln){ln={};for(let t of Object.values(b))typeof t!="string"&&(ln[$e(t)]=t)}return ln[e]}s(gi,"codeFromString");var w=class e extends Error{static{s(this,"ConnectError")}constructor(t,n=b.Unknown,r,o,a){super(Tl(t,n)),this.name="ConnectError",this.isWireError=!1,Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=t,this.code=n,this.metadata=new Headers(r??{}),this.details=o??[],this.cause=a}static from(t,n=b.Unknown){return t instanceof e?t:t instanceof Error?t.name=="AbortError"||t.name=="TimeoutError"?new e(t.message,b.Canceled):new e(t.message,n,void 0,void 0,t):new e(String(t),n,void 0,void 0,t)}static[Symbol.hasInstance](t){return t instanceof Error?Object.getPrototypeOf(t)===e.prototype?!0:t.name==="ConnectError"&&"code"in t&&typeof t.code=="number"&&"metadata"in t&&"details"in t&&Array.isArray(t.details)&&"rawMessage"in t&&typeof t.rawMessage=="string"&&"cause"in t:!1}findDetails(t){let n=t.kind==="message"?{getMessage:s(o=>o===t.typeName?t:void 0,"getMessage")}:t,r=[];for(let o of this.details){if("desc"in o){n.getMessage(o.desc.typeName)&&r.push(L(o.desc,o.value));continue}let a=n.getMessage(o.type);if(a)try{r.push(de(a,o.value))}catch{}}return r}};function Tl(e,t){return e.length?`[${$e(t)}] ${e}`:`[${$e(t)}]`}s(Tl,"createMessage");function Ei(...e){let t=new Headers;for(let n of e)n.forEach((r,o)=>{t.append(o,r)});return t}s(Ei,"appendHeaders");function Ni(e,t){let n={};for(let r of e.methods){let o=t(r);o!=null&&(n[r.localName]=o)}return n}s(Ni,"makeAnyClient");var _e=1;var fn=4294967295,Ir=fn,vl=1024;function xr(e,t,n){if(t??(t=Ir),e??(e=fn),n??(n=vl),t<1||t>Ir)throw new w(`writeMaxBytes ${t} must be >= 1 and <= ${Ir}`,b.Internal);if(e<1||e>fn)throw new w(`readMaxBytes ${e} must be >= 1 and <= ${fn}`,b.Internal);return{readMaxBytes:e,writeMaxBytes:t,compressMinBytes:n}}s(xr,"validateReadWriteMaxBytes");function wi(e,t){if(t>e)throw new w(`message size ${t} is larger than configured writeMaxBytes ${e}`,b.ResourceExhausted)}s(wi,"assertWriteMaxBytes");function Re(e,t,n=!1){if(t>e){let r=`message size is larger than configured readMaxBytes ${e}`;throw n&&(r=`message size ${t} is larger than configured readMaxBytes ${e}`),new w(r,b.ResourceExhausted)}}s(Re,"assertReadMaxBytes");function Si(e){return new Ar(e)}s(Si,"createEnvelopeDecoder");var Ar=class{static{s(this,"EnvelopeDecoderImpl")}constructor(t){this.readMaxBytes=t,this.header=new Uint8Array(5),this.headerView=new DataView(this.header.buffer),this.buf=[]}get byteLength(){return this.buf.reduce((t,n)=>t+n.byteLength,0)}decode(t){this.buf.push(t);let n=[];for(;;){let r=this.pop();if(!r)break;n.push(r)}return n}pop(){if(!(!this.env&&(this.env=this.head(),!this.env))&&this.cons(this.env.data)){let t=this.env;return this.env=void 0,t}}head(){if(!this.cons(this.header))return;let t=this.headerView.getUint8(0),n=this.headerView.getUint32(1);return Re(this.readMaxBytes,n,!0),{flags:t,data:new Uint8Array(n)}}cons(t){let n=t.byteLength;if(this.byteLength<n)return!1;let r=0;for(;r<n;){let o=this.buf.shift();o.byteLength>n-r?(t.set(o.subarray(0,n-r),r),this.buf.unshift(o.subarray(n-r)),r+=n-r):(t.set(o,r),r+=o.byteLength)}return!0}};async function Ti(e,t,n){let{flags:r,data:o}=e;if((r&_e)===_e)throw new w("invalid envelope, already compressed",b.Internal);return t&&o.byteLength>=n&&(o=await t.compress(o),r=r|_e),{data:o,flags:r}}s(Ti,"envelopeCompress");async function vi(e,t,n){let{flags:r,data:o}=e;if((r&_e)===_e){if(!t)throw new w("received compressed envelope, but do not know how to decompress",b.Internal);o=await t.decompress(o,n),r=r^_e}return{data:o,flags:r}}s(vi,"envelopeDecompress");function Ii(e,t){let n=new Uint8Array(t.length+5);n.set(t,5);let r=new DataView(n.buffer,n.byteOffset,n.byteLength);return r.setUint8(0,e),r.setUint32(1,t.length),n}s(Ii,"encodeEnvelope");var oe=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values=="function"?__values(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(a){n[a]=e[a]&&function(i){return new Promise(function(c,u){i=e[a](i),o(c,u,i.done,i.value)})}}function o(a,i,c,u){Promise.resolve(u).then(function(l){a({value:l,done:c})},i)}},A=function(e){return this instanceof A?(this.v=e,this):new A(e)},se=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),o,a=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(p){return function(y){return Promise.resolve(y).then(p,d)}}function c(p,y){r[p]&&(o[p]=function(g){return new Promise(function(N,E){a.push([p,g,N,E])>1||u(p,g)})},y&&(o[p]=y(o[p])))}function u(p,y){try{l(r[p](y))}catch(g){h(a[0][3],g)}}function l(p){p.value instanceof A?Promise.resolve(p.value.v).then(f,d):h(a[0][2],p)}function f(p){u("next",p)}function d(p){u("throw",p)}function h(p,y){p(y),a.shift(),a.length&&u(a[0][0],a[0][1])}},Il=function(e){var t,n;return t={},r("next"),r("throw",function(o){throw o}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(o,a){t[o]=e[o]?function(i){return(n=!n)?{value:A(e[o](i)),done:!1}:a?a(i):i}:a}};function xi(e,...t){let[n,r,o]=xl(t),a=e,i;return o?.propagateDownStreamError===!0&&(a=i=Fi(a)),a=mn(a,...n,{propagateDownStreamError:!1}),r(a).catch(c=>i?i.abort(c).then(()=>Promise.reject(c)):Promise.reject(c))}s(xi,"pipeTo");function xl(e){let t;typeof e[e.length-1]!="function"&&(t=e.pop());let n=e.pop();return[e,n,t]}s(xl,"pickTransformsAndSink");function Ai(e,t){return async n=>await _l(n,e,t)}s(Ai,"sinkAllBytes");function mn(e,...t){return se(this,arguments,s(function*(){var r;let[o,a]=Al(t),i,c=e[Symbol.asyncIterator](),l={[Symbol.asyncIterator](){return c}};a?.propagateDownStreamError===!0&&(l=i=Fi(l));for(let d of o)l=d(l);let f=l[Symbol.asyncIterator]();try{for(;;){let d=yield A(f.next());if(d.done===!0)break;if(!i){yield yield A(d.value);continue}try{yield yield A(d.value)}catch(h){throw yield A(i.abort(h)),h}}}finally{a?.propagateDownStreamError===!0&&((r=c.return)===null||r===void 0||r.call(c).catch(()=>{}))}},"pipe_1"))}s(mn,"pipe");function Al(e){let t;return typeof e[e.length-1]!="function"&&(t=e.pop()),[e,t]}s(Al,"pickTransforms");function _i(e,t,n){return t===void 0||n===void 0?function(r){return se(this,arguments,function*(){var o,a,i,c;try{for(var u=!0,l=oe(r),f;f=yield A(l.next()),o=f.done,!o;u=!0){c=f.value,u=!1;let d=c,h=e.serialize(d);yield yield A({flags:0,data:h})}}catch(d){a={error:d}}finally{try{!u&&!o&&(i=l.return)&&(yield A(i.call(l)))}finally{if(a)throw a.error}}})}:function(r){return se(this,arguments,function*(){var o,a,i,c;try{for(var u=!0,l=oe(r),f;f=yield A(l.next()),o=f.done,!o;u=!0){c=f.value,u=!1;let d=c,h,p=0;d.end?(p=p|t,h=n.serialize(d.value)):h=e.serialize(d.value),yield yield A({flags:p,data:h})}}catch(d){a={error:d}}finally{try{!u&&!o&&(i=l.return)&&(yield A(i.call(l)))}finally{if(a)throw a.error}}})}}s(_i,"transformSerializeEnvelope");function Ri(e,t,n){return n&&t!==void 0?function(r){return se(this,arguments,function*(){var o,a,i,c;try{for(var u=!0,l=oe(r),f;f=yield A(l.next()),o=f.done,!o;u=!0){c=f.value,u=!1;let{flags:d,data:h}=c;(d&t)===t?yield yield A({value:n.parse(h),end:!0}):yield yield A({value:e.parse(h),end:!1})}}catch(d){a={error:d}}finally{try{!u&&!o&&(i=l.return)&&(yield A(i.call(l)))}finally{if(a)throw a.error}}})}:function(r){return se(this,arguments,function*(){var o,a,i,c;try{for(var u=!0,l=oe(r),f;f=yield A(l.next()),o=f.done,!o;u=!0){c=f.value,u=!1;let{flags:d,data:h}=c;if(t!==void 0&&(d&t)===t){if(n===null)throw new w("unexpected end flag",b.InvalidArgument);continue}yield yield A(e.parse(h))}}catch(d){a={error:d}}finally{try{!u&&!o&&(i=l.return)&&(yield A(i.call(l)))}finally{if(a)throw a.error}}})}}s(Ri,"transformParseEnvelope");function Oi(e,t){return function(n){return se(this,arguments,function*(){var r,o,a,i;try{for(var c=!0,u=oe(n),l;l=yield A(u.next()),r=l.done,!r;c=!0)i=l.value,c=!1,yield yield A(yield A(Ti(i,e,t)))}catch(f){o={error:f}}finally{try{!c&&!r&&(a=u.return)&&(yield A(a.call(u)))}finally{if(o)throw o.error}}})}}s(Oi,"transformCompressEnvelope");function Ci(e,t){return function(n){return se(this,arguments,function*(){var r,o,a,i;try{for(var c=!0,u=oe(n),l;l=yield A(u.next()),r=l.done,!r;c=!0)i=l.value,c=!1,yield yield A(yield A(vi(i,e,t)))}catch(f){o={error:f}}finally{try{!c&&!r&&(a=u.return)&&(yield A(a.call(u)))}finally{if(o)throw o.error}}})}}s(Ci,"transformDecompressEnvelope");function Li(){return function(e){return se(this,arguments,function*(){var t,n,r,o;try{for(var a=!0,i=oe(e),c;c=yield A(i.next()),t=c.done,!t;a=!0){o=c.value,a=!1;let{flags:u,data:l}=o;yield yield A(Ii(u,l))}}catch(u){n={error:u}}finally{try{!a&&!t&&(r=i.return)&&(yield A(r.call(i)))}finally{if(n)throw n.error}}})}}s(Li,"transformJoinEnvelopes");function ki(e){return function(t){return se(this,arguments,function*(){var n,r,o,a;let i=Si(e);try{for(var c=!0,u=oe(t),l;l=yield A(u.next()),n=l.done,!n;c=!0){a=l.value,c=!1;let f=a;for(let d of i.decode(f))yield yield A(d)}}catch(f){r={error:f}}finally{try{!c&&!n&&(o=u.return)&&(yield A(o.call(u)))}finally{if(r)throw r.error}}if(i.byteLength>0)throw new w("protocol error: incomplete envelope",b.InvalidArgument)})}}s(ki,"transformSplitEnvelope");async function _l(e,t,n){var r,o,a,i,c,u,l,f;let[d,h]=Rl(n);if(d){h>t&&Re(t,h,!0);let _=new Uint8Array(h),O=0;try{for(var p=!0,y=oe(e),g;g=await y.next(),r=g.done,!r;p=!0){i=g.value,p=!1;let W=i;if(O+W.byteLength>h)throw new w(`protocol error: promised ${h} bytes, received ${O+W.byteLength}`,b.InvalidArgument);_.set(W,O),O+=W.byteLength}}catch(W){o={error:W}}finally{try{!p&&!r&&(a=y.return)&&await a.call(y)}finally{if(o)throw o.error}}if(O<h)throw new w(`protocol error: promised ${h} bytes, received ${O}`,b.InvalidArgument);return _}let N=[],E=0;try{for(var S=!0,T=oe(e),I;I=await T.next(),c=I.done,!c;S=!0){f=I.value,S=!1;let _=f;E+=_.byteLength,Re(t,E),N.push(_)}}catch(_){u={error:_}}finally{try{!S&&!c&&(l=T.return)&&await l.call(T)}finally{if(u)throw u.error}}let v=new Uint8Array(E),C=0;for(let _=N.shift();_;_=N.shift())v.set(_,C),C+=_.byteLength;return v}s(_l,"readAllBytes");function Rl(e){if(e==null)return[!1,0];let t=typeof e=="string"?parseInt(e,10):e;return!Number.isSafeInteger(t)||t<0?[!1,t]:[!0,t]}s(Rl,"parseLengthHint");function Fi(e){let t=e[Symbol.asyncIterator]();if(t.throw===void 0)throw new Error("AsyncIterable does not implement throw");let n=t,r,o,a={next(){return o=n.next().finally(()=>{o=void 0}),o},throw(c){return n.throw(c)}};t.return!==void 0&&(a=Object.assign(Object.assign({},a),{return(c){return n.return(c)}}));let i=!1;return{abort(c){if(r)return r.state;let u=s(()=>n.throw(c).then(l=>l.done===!0?"completed":"caught",()=>"rethrown"),"f");return o?(r={reason:c,state:o.then(u,u)},r.state):(r={reason:c,state:u()},r.state)},[Symbol.asyncIterator](){if(i)throw new Error("AsyncIterable cannot be re-used");return i=!0,a}}}s(Fi,"makeIterableAbortable");function dn(e){return se(this,arguments,s(function*(){yield A(yield*Il(oe(e)))},"createAsyncIterable_1"))}s(dn,"createAsyncIterable");var Ui=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values=="function"?__values(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(a){n[a]=e[a]&&function(i){return new Promise(function(c,u){i=e[a](i),o(c,u,i.done,i.value)})}}function o(a,i,c,u){Promise.resolve(u).then(function(l){a({value:l,done:c})},i)}},Ze=function(e){return this instanceof Ze?(this.v=e,this):new Ze(e)},Ol=function(e){var t,n;return t={},r("next"),r("throw",function(o){throw o}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(o,a){t[o]=e[o]?function(i){return(n=!n)?{value:Ze(e[o](i)),done:!1}:a?a(i):i}:a}},Cl=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),o,a=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(p){return function(y){return Promise.resolve(y).then(p,d)}}function c(p,y){r[p]&&(o[p]=function(g){return new Promise(function(N,E){a.push([p,g,N,E])>1||u(p,g)})},y&&(o[p]=y(o[p])))}function u(p,y){try{l(r[p](y))}catch(g){h(a[0][3],g)}}function l(p){p.value instanceof Ze?Promise.resolve(p.value.v).then(f,d):h(a[0][2],p)}function f(p){u("next",p)}function d(p){u("throw",p)}function h(p,y){p(y),a.shift(),a.length&&u(a[0][0],a[0][1])}};function Nt(e,t){return Ni(e,n=>{switch(n.methodKind){case"unary":return Ll(t,n);case"server_streaming":return kl(t,n);case"client_streaming":return Fl(t,n);case"bidi_streaming":return Ul(t,n);default:return null}})}s(Nt,"createClient");function Ll(e,t){return async(n,r)=>{var o,a;let i=await e.unary(t,r?.signal,r?.timeoutMs,r?.headers,n,r?.contextValues);return(o=r?.onHeader)===null||o===void 0||o.call(r,i.header),(a=r?.onTrailer)===null||a===void 0||a.call(r,i.trailer),i.message}}s(Ll,"createUnaryFn");function kl(e,t){return(n,r)=>Di(e.stream(t,r?.signal,r?.timeoutMs,r?.headers,dn([n]),r?.contextValues),r)}s(kl,"createServerStreamingFn");function Fl(e,t){return async(n,r)=>{var o,a,i,c,u,l;let f=await e.stream(t,r?.signal,r?.timeoutMs,r?.headers,n,r?.contextValues);(u=r?.onHeader)===null||u===void 0||u.call(r,f.header);let d,h=0;try{for(var p=!0,y=Ui(f.message),g;g=await y.next(),o=g.done,!o;p=!0)c=g.value,p=!1,d=c,h++}catch(N){a={error:N}}finally{try{!p&&!o&&(i=y.return)&&await i.call(y)}finally{if(a)throw a.error}}if(!d)throw new w("protocol error: missing response message",b.Unimplemented);if(h>1)throw new w("protocol error: received extra messages for client streaming method",b.Unimplemented);return(l=r?.onTrailer)===null||l===void 0||l.call(r,f.trailer),d}}s(Fl,"createClientStreamingFn");function Ul(e,t){return(n,r)=>Di(e.stream(t,r?.signal,r?.timeoutMs,r?.headers,n,r?.contextValues),r)}s(Ul,"createBiDiStreamingFn");function Di(e,t){let n=(function(){return Cl(this,arguments,function*(){var r,o;let a=yield Ze(e);(r=t?.onHeader)===null||r===void 0||r.call(t,a.header),yield Ze(yield*Ol(Ui(a.message))),(o=t?.onTrailer)===null||o===void 0||o.call(t,a.trailer)})})()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:s(()=>n.next(),"next")})}}s(Di,"handleStreamResponse");function _r(...e){let t=new AbortController,n=e.filter(o=>o!==void 0).concat(t.signal);for(let o of n){if(o.aborted){r.apply(o);break}o.addEventListener("abort",r)}function r(){t.signal.aborted||t.abort(Ee(this));for(let o of n)o.removeEventListener("abort",r)}return s(r,"onAbort"),t}s(_r,"createLinkedAbortController");function Rr(e){let t=new AbortController,n=s(()=>{t.abort(new w("the operation timed out",b.DeadlineExceeded))},"listener"),r;return e!==void 0&&(e<=0?n():r=setTimeout(n,e)),{signal:t.signal,cleanup:s(()=>clearTimeout(r),"cleanup")}}s(Rr,"createDeadlineSignal");function Ee(e){if(!e.aborted)return;if(e.reason!==void 0)return e.reason;let t=new Error("This operation was aborted");return t.name="AbortError",t}s(Ee,"getAbortSignalReason");function Or(){return{get(e){return e.id in this?this[e.id]:e.defaultValue},set(e,t){return this[e.id]=t,this},delete(e){return delete this[e.id],this}}}s(Or,"createContextValues");var Vi="Grpc-Encoding",Mi="Grpc-Accept-Encoding",Pi="Grpc-Timeout",Yi="Grpc-Status",Bi="Grpc-Message",Gi="Grpc-Status-Details-Bin";function pn(e,t,...n){if(n.length>0)throw new Error;return e.services[t]}s(pn,"serviceDesc");var pe="Content-Type",Je="Content-Length",z="Content-Encoding",Ke="Connect-Content-Encoding",ze="Accept-Encoding",hn="Connect-Accept-Encoding",yn="Connect-Timeout-Ms",He="Connect-Protocol-Version",Wi="Date",Xi="Host",$i="Trailer",wt="User-Agent",Zi="Trailer-";var Dl=new Set([pe,Je,z,Xi,wt,$i,Wi,ze,Zi,Ke,hn,yn,He,Vi,Mi,Pi,Yi,Bi,Gi].map(e=>e.toLowerCase()));function Ji(e,t){t.forEach((n,r)=>{Dl.has(r.toLowerCase())||e.append(r,n)})}s(Ji,"mergeNonProtocolHeaders");function Cr(e,t){return e.toString().replace(/\/?$/,`/${t.parent.typeName}/${t.name}`)}s(Cr,"createMethodUrl");function Lr(e,t){return L(e,t)}s(Lr,"normalize");function Ki(e,t){function n(r){return r.done===!0?r:{done:r.done,value:Lr(e,r.value)}}return s(n,"transform"),{[Symbol.asyncIterator](){let r=t[Symbol.asyncIterator](),o={next:s(()=>r.next().then(n),"next")};return r.throw!==void 0&&(o.throw=a=>r.throw(a).then(n)),r.return!==void 0&&(o.return=a=>r.return(a).then(n)),o}}}s(Ki,"normalizeIterable");function kr(e,t){if(!t)return e;for(let n of t.concat().reverse())e=n(e);return e}s(kr,"applyInterceptors");function Vl(e){var t;let n=Object.assign({},e);return(t=n.ignoreUnknownFields)!==null&&t!==void 0||(n.ignoreUnknownFields=!0),n}s(Vl,"getJsonOptions");function Fr(e,t,n,r){let o=bn(zi(e.input,t),r),a=bn(Hi(e.input,n),r),i=bn(zi(e.output,t),r),c=bn(Hi(e.output,n),r);return{getI(u){return u?o:a},getO(u){return u?i:c}}}s(Fr,"createMethodSerializationLookup");function bn(e,t){return{serialize(n){let r=e.serialize(n);return wi(t.writeMaxBytes,r.byteLength),r},parse(n){return Re(t.readMaxBytes,n.byteLength,!0),e.parse(n)}}}s(bn,"limitSerialization");function zi(e,t){return{parse(n){try{return de(e,n,t)}catch(r){let o=r instanceof Error?r.message:String(r);throw new w(`parse binary: ${o}`,b.Internal)}},serialize(n){try{return Ae(e,n,t)}catch(r){let o=r instanceof Error?r.message:String(r);throw new w(`serialize binary: ${o}`,b.Internal)}}}}s(zi,"createBinarySerialization");function Hi(e,t){var n,r;let o=(n=t?.textEncoder)!==null&&n!==void 0?n:new TextEncoder,a=(r=t?.textDecoder)!==null&&r!==void 0?r:new TextDecoder,i=Vl(t);return{parse(c){try{let u=a.decode(c);return mi(e,u,i)}catch(u){throw w.from(u,b.InvalidArgument)}},serialize(c){try{let u=ai(e,c,i);return o.encode(u)}catch(u){throw w.from(u,b.Internal)}}}}s(Hi,"createJsonSerialization");var Ml=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;var ji="application/proto",Qi="application/json",qi="application/connect+proto",es="application/connect+json";function ts(e){let t=e?.match(Ml);if(!t)return;let n=!!t[1],r=!!t[3];return{stream:n,binary:r}}s(ts,"parseContentType");var Pl=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};function Ur(e,t,n){var r;if(t&&new Headers(t).forEach((c,u)=>n.metadata.append(u,c)),typeof e!="object"||e==null||Array.isArray(e))throw n;let o=n.code;"code"in e&&typeof e.code=="string"&&(o=(r=gi(e.code))!==null&&r!==void 0?r:o);let a=e.message;if(a!=null&&typeof a!="string")throw n;let i=new w(a??"",o,t);if(i.isWireError=!0,"details"in e&&Array.isArray(e.details))for(let c of e.details){if(c===null||typeof c!="object"||Array.isArray(c)||typeof c.type!="string"||typeof c.value!="string")throw n;try{i.details.push({type:c.type,value:Me(c.value),debug:c.debug})}catch{throw n}}return i}s(Ur,"errorFromJson");function ns(e,t,n){let r;try{r=JSON.parse(new TextDecoder().decode(e))}catch{throw n}return Ur(r,t,n)}s(ns,"errorFromJsonBytes");function rs(e,t){let n={code:$e(e.code)};return e.rawMessage.length>0&&(n.message=e.rawMessage),e.details.length>0&&(n.details=e.details.map(r=>{if("desc"in r){let o=L(r.desc,r.value),a={type:r.desc.typeName,value:Ae(r.desc,o)};try{a.debug=hr(r.desc,o,t)}catch{}return a}return r}).map(r=>{var{value:o}=r,a=Pl(r,["value"]);return Object.assign(Object.assign({},a),{value:Pe(o,"std_raw")})})),n}s(rs,"errorToJson");var os=2;function Yl(e){let t=new w("invalid end stream",b.Unknown),n;try{n=JSON.parse(typeof e=="string"?e:new TextDecoder().decode(e))}catch{throw t}if(typeof n!="object"||n==null||Array.isArray(n))throw t;let r=new Headers;if("metadata"in n){if(typeof n.metadata!="object"||n.metadata==null||Array.isArray(n.metadata))throw t;for(let[a,i]of Object.entries(n.metadata)){if(!Array.isArray(i)||i.some(c=>typeof c!="string"))throw t;for(let c of i)r.append(a,c)}}let o="error"in n&&n.error!=null?Ur(n.error,r,t):void 0;return{metadata:r,error:o}}s(Yl,"endStreamFromJson");function Bl(e,t,n){let r={};t!==void 0&&(r.error=rs(t,n),t.isWireError||Ji(e,t.metadata));let o=!1,a={};return e.forEach((i,c)=>{o=!0,a[c]=[i]}),o&&(r.metadata=a),r}s(Bl,"endStreamToJson");function as(e){let t=new TextEncoder;return{serialize(n){try{let r=Bl(n.metadata,n.error,e),o=JSON.stringify(r);return t.encode(o)}catch(r){let o=r instanceof Error?r.message:String(r);throw new w(`failed to serialize EndStreamResponse: ${o}`,b.Internal)}},parse(n){try{return Yl(n)}catch(r){let o=r instanceof Error?r.message:String(r);throw new w(`failed to parse EndStreamResponse: ${o}`,b.InvalidArgument)}}}}s(as,"createEndStreamSerialization");function is(e){switch(e){case 400:return b.Internal;case 401:return b.Unauthenticated;case 403:return b.PermissionDenied;case 404:return b.Unimplemented;case 429:return b.Unavailable;case 502:return b.Unavailable;case 503:return b.Unavailable;case 504:return b.Unavailable;default:return b.Unknown}}s(is,"codeFromHttpStatus");function ss(e){let t=new Headers,n=new Headers;return e.forEach((r,o)=>{o.toLowerCase().startsWith("trailer-")?n.append(o.substring(8),r):t.append(o,r)}),[t,n]}s(ss,"trailerDemux");var gn="1";function Gl(e,t,n,r,o){let a=new Headers(r??{});return n!==void 0&&a.set(yn,`${n}`),a.set(pe,e=="unary"?t?ji:Qi:t?qi:es),a.set(He,gn),!a.has(wt)&&o&&a.set(wt,"connect-es/2.2.0"),a}s(Gl,"requestHeader");function Dr(e,t,n,r,o,a,i){let c=Gl(e,t,n,r,i);if(a!=null){let u=e=="unary"?z:Ke;c.set(u,a.name)}if(o.length>0){let u=e=="unary"?ze:hn;c.set(u,o.map(l=>l.name).join(","))}return c}s(Dr,"requestHeaderWithCompression");function Wl(e,t,n,r){let o=r.get(pe),a=ts(o);if(n!==200){let c=new w(`HTTP ${n}`,is(n),r);if(e=="unary"&&a&&!a.binary)return{isUnaryError:!0,unaryError:c};throw c}let i={binary:t,stream:e!=="unary"};if(a?.binary!==i.binary||a.stream!==i.stream)throw new w(`unsupported content type ${o}`,a===void 0?b.Unknown:b.Internal,r);return{isUnaryError:!1}}s(Wl,"validateResponse");function Vr(e,t,n,r,o){let a,i=o.get(e=="unary"?z:Ke);if(i!=null&&i.toLowerCase()!=="identity"&&(a=t.find(c=>c.name===i),!a))throw new w(`unsupported response encoding "${i}"`,b.Internal,o);return Object.assign({compression:a},Wl(e,n,r,o))}s(Vr,"validateResponseWithCompression");var cs="application/";function Xl(e,t){return t?Pe(e,"url"):encodeURIComponent(new TextDecoder().decode(e))}s(Xl,"encodeMessageForUrl");function us(e,t,n){let r=`?connect=v${gn}`,o="",a=e.header.get(z);a!==null&&a!=="identity"&&(o="&compression="+encodeURIComponent(a),n=!0),n&&(r+="&base64=1"),r+=o;let i=e.header.get(pe);i?.indexOf(cs)===0&&(r+="&encoding="+encodeURIComponent(i.slice(cs.length))),r+="&message="+Xl(t,n);let c=e.url+r,u=new Headers(e.header);for(let l of[He,pe,Je,z,ze])u.delete(l);return Object.assign(Object.assign({},e),{requestMethod:"GET",url:c,header:u})}s(us,"transformConnectPostToGetRequest");function ls(e){let t=kr(e.next,e.interceptors),[n,r,o]=ms(e),a=Object.assign(Object.assign({},e.req),{message:Lr(e.req.method.input,e.req.message),signal:n});return t(a).then(i=>(o(),i),r)}s(ls,"runUnaryCall");function fs(e){let t=kr(e.next,e.interceptors),[n,r,o]=ms(e),a=Object.assign(Object.assign({},e.req),{message:Ki(e.req.method.input,e.req.message),signal:n}),i=!1;return n.addEventListener("abort",function(){var c,u;let l=e.req.message[Symbol.asyncIterator]();i||(c=l.throw)===null||c===void 0||c.call(l,this.reason).catch(()=>{}),(u=l.return)===null||u===void 0||u.call(l).catch(()=>{})}),t(a).then(c=>Object.assign(Object.assign({},c),{message:{[Symbol.asyncIterator](){let u=c.message[Symbol.asyncIterator]();return{next(){return!i&&n.aborted?r(Ee(n)):u.next().then(l=>(l.done==!0&&(i=!0,o()),l),r)}}}}}),r)}s(fs,"runStreamingCall");function ms(e){let{signal:t,cleanup:n}=Rr(e.timeoutMs),r=_r(e.signal,t);return[r.signal,s(function(a){let i=r.signal.aborted?w.from(Ee(r.signal),b.Canceled):w.from(a);return r.abort(i),n(),Promise.reject(i)},"abort"),s(function(){n(),r.abort()},"done")]}s(ms,"setupSignal");var $l=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values=="function"?__values(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(a){n[a]=e[a]&&function(i){return new Promise(function(c,u){i=e[a](i),o(c,u,i.done,i.value)})}}function o(a,i,c,u){Promise.resolve(u).then(function(l){a({value:l,done:c})},i)}},je=function(e){return this instanceof je?(this.v=e,this):new je(e)},Zl=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),o,a=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(p){return function(y){return Promise.resolve(y).then(p,d)}}function c(p,y){r[p]&&(o[p]=function(g){return new Promise(function(N,E){a.push([p,g,N,E])>1||u(p,g)})},y&&(o[p]=y(o[p])))}function u(p,y){try{l(r[p](y))}catch(g){h(a[0][3],g)}}function l(p){p.value instanceof je?Promise.resolve(p.value.v).then(f,d):h(a[0][2],p)}function f(p){u("next",p)}function d(p){u("throw",p)}function h(p,y){p(y),a.shift(),a.length&&u(a[0][0],a[0][1])}};function Mr(e){return{async unary(t,n,r,o,a,i){let c=Fr(t,e.binaryOptions,e.jsonOptions,e);return r=r===void 0?e.defaultTimeoutMs:r<=0?void 0:r,await ls({interceptors:e.interceptors,signal:n,timeoutMs:r,req:{stream:!1,service:t.parent,method:t,requestMethod:"POST",url:Cr(e.baseUrl,t),header:Dr(t.methodKind,e.useBinaryFormat,r,o,e.acceptCompression,e.sendCompression,!0),contextValues:i??Or(),message:a},next:s(async u=>{let l=c.getI(e.useBinaryFormat).serialize(u.message);e.sendCompression&&l.byteLength>e.compressMinBytes?(l=await e.sendCompression.compress(l),u.header.set(z,e.sendCompression.name)):u.header.delete(z);let f=e.useHttpGet===!0&&t.idempotency===jt.NO_SIDE_EFFECTS,d;f?u=us(u,l,e.useBinaryFormat):d=dn([l]);let h=await e.httpClient({url:u.url,method:u.requestMethod,header:u.header,signal:u.signal,body:d}),{compression:p,isUnaryError:y,unaryError:g}=Vr(t.methodKind,e.acceptCompression,e.useBinaryFormat,h.status,h.header),[N,E]=ss(h.header),S=await xi(h.body,Ai(e.readMaxBytes,h.header.get(Je)),{propagateDownStreamError:!1});if(p&&(S=await p.decompress(S,e.readMaxBytes)),y)throw ns(S,Ei(N,E),g);return{stream:!1,service:t.parent,method:t,header:N,message:c.getO(e.useBinaryFormat).parse(S),trailer:E}},"next")})},async stream(t,n,r,o,a,i){let c=Fr(t,e.binaryOptions,e.jsonOptions,e),u=as(e.jsonOptions);return r=r===void 0?e.defaultTimeoutMs:r<=0?void 0:r,fs({interceptors:e.interceptors,signal:n,timeoutMs:r,req:{stream:!0,service:t.parent,method:t,requestMethod:"POST",url:Cr(e.baseUrl,t),header:Dr(t.methodKind,e.useBinaryFormat,r,o,e.acceptCompression,e.sendCompression,!0),contextValues:i??Or(),message:a},next:s(async l=>{let f=await e.httpClient({url:l.url,method:"POST",header:l.header,signal:l.signal,body:mn(l.message,_i(c.getI(e.useBinaryFormat)),Oi(e.sendCompression,e.compressMinBytes),Li(),{propagateDownStreamError:!0})}),{compression:d}=Vr(t.methodKind,e.acceptCompression,e.useBinaryFormat,f.status,f.header),h=Object.assign(Object.assign({},l),{header:f.header,trailer:new Headers,message:mn(f.body,ki(e.readMaxBytes),Ci(d??null,e.readMaxBytes),Ri(c.getO(e.useBinaryFormat),os,u),function(p){return Zl(this,arguments,function*(){var y,g,N,E;let S=!1;try{for(var T=!0,I=$l(p),v;v=yield je(I.next()),y=v.done,!y;T=!0){E=v.value,T=!1;let C=E;if(C.end){if(S)throw new w("protocol error: received extra EndStreamResponse",b.InvalidArgument);if(S=!0,C.value.error){let _=C.value.error;throw f.header.forEach((O,W)=>{_.metadata.append(W,O)}),_}C.value.metadata.forEach((_,O)=>h.trailer.set(O,_));continue}if(S)throw new w("protocol error: received extra message after EndStreamResponse",b.InvalidArgument);yield yield je(C.value)}}catch(C){g={error:C}}finally{try{!T&&!y&&(N=I.return)&&(yield je(N.call(I)))}finally{if(g)throw g.error}}if(!S)throw new w("protocol error: missing EndStreamResponse",b.InvalidArgument)})},{propagateDownStreamError:!0})});return h},"next")})}}}s(Mr,"createTransport");var Z=Object.freeze({Get:"get",Put:"put",Publish:"publish",Remote:"remote"}),k=Object.freeze({Local:"local",Artifact:"artifact",Miss:"miss",Error:"error",ReadOnly:"readonly",Policy:"policy",AlreadyPresent:"already-present",Unavailable:"unavailable",Corrupt:"corrupt",Overload:"overload"});function Oe(e){return e instanceof Error?e instanceof Y?"integrity":"code"in e&&typeof e.code=="string"&&/^(ENOENT|ENOSPC|EACCES|EPERM|ETIMEDOUT|ECONNRESET)$/.test(e.code)?e.code:"code"in e&&typeof e.code=="number"&&Number.isInteger(e.code)&&e.code>=0&&e.code<=b.Unauthenticated?`rpc-${e.code}`:e.name==="TimeoutError"||e.name==="AbortError"?"timeout":"cache-operation":"unknown"}s(Oe,"errorCode");var Jl=s(e=>process.stderr.write(`${JSON.stringify({cache:e})}
6
+ `),"writeEvent"),Kl={[Z.Get]:{[k.Local]:"localHits",[k.Artifact]:"artifactHits",[k.Miss]:"misses"},[Z.Put]:{[k.Local]:"localWrites"},[Z.Publish]:{[k.Artifact]:"publications"}},zl={[k.ReadOnly]:"readOnlySkips",[k.Policy]:"policySkips",[k.AlreadyPresent]:"alreadyPresent",[k.Unavailable]:"unavailable",[k.Corrupt]:"corrupt",[k.Overload]:"overload",[k.Error]:"errors"};function H(){return{count:0,bytes:0,durationMs:0}}s(H,"emptyTotal");function Hl(e,t){e.count+=1,e.bytes+=t.bytes??0,e.durationMs+=t.durationMs}s(Hl,"add");var En=class{constructor(t=Jl){this.emit=t}emit;static{s(this,"CacheMetrics")}#e={localHits:H(),artifactHits:H(),misses:H(),localWrites:H(),publications:H(),readOnlySkips:H(),policySkips:H(),alreadyPresent:H(),unavailable:H(),corrupt:H(),overload:H(),errors:H()};record=s(t=>{this.emit(t);let n=Kl[t.operation]?.[t.tier]??zl[t.tier];n&&Hl(this.#e[n],t)},"record");snapshot(){return structuredClone(this.#e)}};import{constants as ds}from"node:os";var X=Object.freeze({Interrupt:"SIGINT",Terminate:"SIGTERM",Kill:"SIGKILL"}),ps=0,hs=2,Nn=128,he=Object.freeze({Success:0,Failure:1,Interrupted:Nn+ds.signals.SIGINT,Terminated:Nn+ds.signals.SIGTERM});import{mkdtemp as ef,rm as tf}from"node:fs/promises";import{tmpdir as nf}from"node:os";import{join as Pr}from"node:path";import{spawn as jl}from"node:child_process";import{constants as Ql}from"node:os";var ys=3*1e3,bs=1e3/10,ql=ys/bs;async function wn(e,t,n){let r=process.platform!=="win32",o=jl(e,t,{env:n,stdio:"inherit",detached:r}),a;function i(f){if(o.pid)try{r?process.kill(-o.pid,f):o.kill(f)}catch(d){if(!(d instanceof Error&&"code"in d&&d.code==="ESRCH"))throw d}}s(i,"signal");function c(f){i(f),a??=setTimeout(()=>i(X.Kill),ys)}s(c,"terminate");let u=s(()=>c(X.Interrupt),"interrupt"),l=s(()=>c(X.Terminate),"stop");process.on(X.Interrupt,u),process.on(X.Terminate,l);try{let f=await new Promise((d,h)=>{o.once("error",h),o.once("exit",(p,y)=>d(p??(y?Nn+Ql.signals[y]:he.Failure)))});if(i(X.Terminate),r&&o.pid){let d=o.pid;for(let h=0;h<ql;h++){try{process.kill(-d,ps)}catch{return f}await new Promise(p=>setTimeout(p,bs))}i(X.Kill)}return f}finally{a&&clearTimeout(a),process.off(X.Interrupt,u),process.off(X.Terminate,l)}}s(wn,"execute");async function gs(e,t,n,r,o={}){let a=he.Success,i=s(()=>{a=he.Interrupted},"interrupt"),c=s(()=>{a=he.Terminated},"terminate");process.on(X.Interrupt,i),process.on(X.Terminate,c);try{try{let u=await wn(t,n,{...r,NX_SELF_HOSTED_REMOTE_CACHE_SERVER:e.url,NX_SELF_HOSTED_REMOTE_CACHE_ACCESS_TOKEN:e.token});a||=u}finally{try{await e.close()}catch{process.stderr.write(`Cache publication failed during shutdown
7
+ `),o.strictPublication!==!1&&(a||=he.Failure)}}return a}finally{process.off(X.Interrupt,i),process.off(X.Terminate,c)}}s(gs,"runCachedCommand");async function Es(e,t,n,r,o=!0){let a=await ef(Pr(nf(),"nx-namespace-run-")),i={...n,NX_DAEMON:"false",NX_NAMESPACE_CACHE_ACTIVE:"true",NX_WORKSPACE_DATA_DIRECTORY:Pr(a,"workspace-data"),NX_CACHE_DIRECTORY:Pr(a,"task-cache"),NX_MAX_CACHE_SIZE:n.NX_CACHE_EXTRACTION_BYTES??String(Ct)};delete i.NX_SELF_HOSTED_REMOTE_CACHE_SERVER,delete i.NX_SELF_HOSTED_REMOTE_CACHE_ACCESS_TOKEN;try{let c;try{c=await r()}catch{return process.stderr.write(`Cache startup failed; caching is disabled for this command
8
+ `),o?he.Failure:await wn(e,t,{...i,NX_SKIP_NX_CACHE:"true"})}return await gs(c,e,t,i,{strictPublication:o})}finally{await tf(a,{recursive:!0,force:!0})}}s(Es,"runWithCache");var Ce=Object.freeze({Get:"GET",Put:"PUT"}),P=Object.freeze({Ok:200,Unauthorized:401,Forbidden:403,NotFound:404,MethodNotAllowed:405,Conflict:409,PayloadTooLarge:413,InternalServerError:500,ServiceUnavailable:503});import*as Ne from"node:zlib";import{promisify as vn}from"node:util";function qe(e){let t=b.Internal,n=Sn(e).map(et);n.some(o=>o.code=="ERR_STREAM_WRITE_AFTER_END")?t=b.Aborted:n.some(o=>o.code=="ERR_STREAM_DESTROYED"||o.code=="ERR_HTTP2_INVALID_STREAM"||o.code=="ECONNRESET")?t=b.Aborted:n.some(o=>o.code=="ETIMEDOUT"||o.code=="ENOTFOUND"||o.code=="EAI_AGAIN"||o.code=="ECONNREFUSED")&&(t=b.Unavailable);let r=w.from(e,t);return r!==e&&(r.cause=e),r}s(qe,"connectErrorFromNodeReason");function Sn(e){let t=[];for(;!(!(e instanceof Error)||t.includes(e)||(t.push(e),!("cause"in e)));)e=e.cause;return t}s(Sn,"unwrapNodeErrorChain");function et(e){let t={};return e instanceof Error&&("code"in e&&typeof e.code=="string"&&(t.code=e.code),"syscall"in e&&typeof e.syscall=="string"&&(t.syscall=e.syscall)),t}s(et,"getNodeErrorProps");function Ns(e){switch(e){case U.PROTOCOL_ERROR:case U.INTERNAL_ERROR:case U.FLOW_CONTROL_ERROR:case U.SETTINGS_TIMEOUT:case U.FRAME_SIZE_ERROR:case U.COMPRESSION_ERROR:case U.CONNECT_ERROR:return new w(`http/2 stream closed with error code ${U[e]} (0x${e.toString(16)})`,b.Internal);case U.REFUSED_STREAM:return new w(`http/2 stream closed with error code ${U[e]} (0x${e.toString(16)})`,b.Unavailable);case U.CANCEL:return new w(`http/2 stream closed with error code ${U[e]} (0x${e.toString(16)})`,b.Canceled);case U.ENHANCE_YOUR_CALM:return new w(`http/2 stream closed with error code ${U[e]} (0x${e.toString(16)})`,b.ResourceExhausted);case U.INADEQUATE_SECURITY:return new w(`http/2 stream closed with error code ${U[e]} (0x${e.toString(16)})`,b.PermissionDenied);case U.HTTP_1_1_REQUIRED:return new w(`http/2 stream closed with error code ${U[e]} (0x${e.toString(16)})`,b.PermissionDenied);default:break}}s(Ns,"connectErrorFromH2ResetCode");var U;(function(e){e[e.PROTOCOL_ERROR=1]="PROTOCOL_ERROR",e[e.INTERNAL_ERROR=2]="INTERNAL_ERROR",e[e.FLOW_CONTROL_ERROR=3]="FLOW_CONTROL_ERROR",e[e.SETTINGS_TIMEOUT=4]="SETTINGS_TIMEOUT",e[e.STREAM_CLOSED=5]="STREAM_CLOSED",e[e.FRAME_SIZE_ERROR=6]="FRAME_SIZE_ERROR",e[e.REFUSED_STREAM=7]="REFUSED_STREAM",e[e.CANCEL=8]="CANCEL",e[e.COMPRESSION_ERROR=9]="COMPRESSION_ERROR",e[e.CONNECT_ERROR=10]="CONNECT_ERROR",e[e.ENHANCE_YOUR_CALM=11]="ENHANCE_YOUR_CALM",e[e.INADEQUATE_SECURITY=12]="INADEQUATE_SECURITY",e[e.HTTP_1_1_REQUIRED=13]="HTTP_1_1_REQUIRED"})(U||(U={}));var rf=vn(Ne.gzip),of=vn(Ne.gunzip),af=vn(Ne.brotliCompress),sf=vn(Ne.brotliDecompress),ws={name:"gzip",compress(e){return Tn(rf(e,{}))},decompress(e,t){return e.length==0?Promise.resolve(new Uint8Array(0)):Tn(Ts(of(e,{maxOutputLength:t}),t))}},Ss={name:"br",compress(e){return Tn(af(e,{}))},decompress(e,t){return e.length==0?Promise.resolve(new Uint8Array(0)):Tn(Ts(sf(e,{maxOutputLength:t}),t))}};function Tn(e){return e.then(t=>t.buffer instanceof ArrayBuffer?t:new Uint8Array(t))}s(Tn,"asUint8ArrayArrayBuffer");function Ts(e,t){return e.catch(n=>{var r;let o=et(n),a=b.Internal,i="decompression failed";switch(o.code){case"ERR_BUFFER_TOO_LARGE":a=b.ResourceExhausted,i=`message is larger than configured readMaxBytes ${t} after decompression`;break;case"Z_DATA_ERROR":case"ERR_PADDING_2":a=b.InvalidArgument;break;default:!((r=o.code)===null||r===void 0)&&r.startsWith("ERR__ERROR_FORMAT_")&&(a=b.InvalidArgument);break}return Promise.reject(new w(i,a,void 0,void 0,n))})}s(Ts,"wrapZLibErrors");import*as vs from"node:http";import*as Is from"node:https";function St(e){let t=new Headers;for(let[n,r]of Object.entries(e))if(!n.startsWith(":")&&r!==void 0)if(typeof r=="string")t.append(n,r);else if(typeof r=="number")t.append(n,String(r));else for(let o of r)t.append(n,o);return t}s(St,"nodeHeaderToWebHeader");function Br(e,t){if(e===void 0&&t===void 0)return;let n=Object.create(null);if(t!==void 0)if(Array.isArray(t))for(let r=0;r+1<t.length;r+=2){let o=t[r],a=t[r+1];Array.isArray(n[o])?n[o].push(a):typeof n[o]=="string"?n[o]=[n[o],a]:n[o]=a}else for(let[r,o]of Object.entries(t))Array.isArray(o)?n[r]=o.concat():o!==void 0&&(n[r]=o);if(e!==void 0)if(Array.isArray(e))for(let[r,o]of e)Yr(n,r,o);else if("forEach"in e)typeof e.forEach=="function"&&e.forEach((r,o)=>{Yr(n,o,r)});else for(let[r,o]of Object.entries(e))Yr(n,r,o);return n}s(Br,"webHeaderToNodeHeaders");function Yr(e,t,n){t=t.toLowerCase();let r=e[t];Array.isArray(r)?r.push(n):r===void 0?e[t]=n:e[t]=[r.toString(),n]}s(Yr,"appendWebHeader");import*as ce from"node:http2";var tt=class{static{s(this,"Http2SessionManager")}state(){return this.s.t=="ready"?this.verifying!==void 0?"verifying":this.s.streamCount()>0?"open":"idle":this.s.t}error(){if(this.s.t=="error")return this.s.reason}constructor(t,n,r){var o,a,i,c;this.s=Xr(),this.shuttingDown=[],this.authority=new URL(t).origin,this.http2SessionOptions=r,this.options={pingIntervalMs:(o=n?.pingIntervalMs)!==null&&o!==void 0?o:Number.POSITIVE_INFINITY,pingTimeoutMs:(a=n?.pingTimeoutMs)!==null&&a!==void 0?a:1e3*15,pingIdleConnection:(i=n?.pingIdleConnection)!==null&&i!==void 0?i:!1,idleConnectionTimeoutMs:(c=n?.idleConnectionTimeoutMs)!==null&&c!==void 0?c:1e3*60*15}}async connect(){try{return(await this.gotoReady()).streamCount()>0?"open":"idle"}catch{return"error"}}async request(t,n,r,o){for(;;){let a=await this.gotoReady();try{let i=a.conn.request(Object.assign(Object.assign({},r),{":method":t,":path":n}),o);return a.registerRequest(i),i}catch(i){if(a.conn.closed||a.conn.destroyed)continue;throw i}}}notifyResponseByteRead(t){this.s.t=="ready"&&this.s.responseByteRead(t);for(let n of this.shuttingDown)n.responseByteRead(t)}abort(t){var n,r,o;let a=t??new w("connection aborted",b.Canceled);(r=(n=this.s).abort)===null||r===void 0||r.call(n,a);for(let i of this.shuttingDown)(o=i.abort)===null||o===void 0||o.call(i,a);this.setState(In(a))}async gotoReady(){for(this.s.t=="ready"?this.s.isShuttingDown()||this.s.conn.closed||this.s.conn.destroyed?this.setState(Gr(this.authority,this.http2SessionOptions)):this.s.requiresVerify()&&await this.verify(this.s):(this.s.t=="closed"||this.s.t=="error")&&this.setState(Gr(this.authority,this.http2SessionOptions));this.s.t!=="ready";){if(this.s.t==="error")throw this.s.reason;this.s.t==="connecting"&&await this.s.conn}return this.s}setState(t){var n,r;if((r=(n=this.s).onExitState)===null||r===void 0||r.call(n),this.s.t=="ready"&&this.s.isShuttingDown()){let o=this.s;this.shuttingDown.push(o),o.onClose=o.onError=()=>{let a=this.shuttingDown.indexOf(o);a!==-1&&this.shuttingDown.splice(a,1)}}switch(t.t){case"connecting":t.conn.then(o=>{this.setState(uf(o,this.options))},o=>{this.setState(In(o))});break;case"ready":t.onClose=()=>this.setState(Xr()),t.onError=o=>this.setState(In(o));break;case"closed":break;case"error":break}this.s=t}verify(t){return this.verifying!==void 0?this.verifying:(this.verifying=t.verify().then(n=>{n||this.setState(Gr(this.authority,this.http2SessionOptions))},n=>{this.setState(In(n))}).finally(()=>{this.verifying=void 0}),this.verifying)}};function Xr(){return{t:"closed"}}s(Xr,"closed");function cf(e){return{t:"error",reason:e}}s(cf,"error");function In(e){return e instanceof w&&w.from(e).code==b.Canceled?Xr():cf(e)}s(In,"closedOrError");function Gr(e,t){let n,r,o=new Promise((l,f)=>{n=l,r=f}),a=ce.connect(e,t);a.on("connect",i),a.on("error",c);function i(){n?.(a),u()}s(i,"onConnect");function c(l){r?.(qe(l)),u()}s(c,"onError");function u(){a.off("connect",i),a.off("error",c)}return s(u,"cleanup"),{t:"connecting",conn:o,abort(l){a.destroyed||a.destroy(void 0,ce.constants.NGHTTP2_CANCEL),r?.(l)},onExitState(){u()}}}s(Gr,"connect");function uf(e,t){lf(e),e.unref();let n=Date.now(),r=0,o,a,i=!1,c=!1,u;g();let l={t:"ready",conn:e,streamCount(){return r},requiresVerify(){return Date.now()-n>t.pingIntervalMs},isShuttingDown(){return i},onClose:void 0,onError:void 0,registerRequest(v){r++,r==1&&(e.ref(),f(),y()),v.once("response",()=>{n=Date.now(),f()}),v.once("close",()=>{r--,r==0&&(e.unref(),f(),g())})},responseByteRead(v){v.session===e&&(e.closed||e.destroyed||r<=0||(n=Date.now(),f()))},verify(){return e.ref(),new Promise(v=>{let C=s(()=>{v(!1)},"onFailure");p(()=>{r==0&&e.unref(),e.off("error",C),e.off("close",C),v(!0)}),e.once("error",C),e.once("close",C)})},abort(v){e.destroyed||(e.once("error",()=>{}),e.destroy(v,ce.constants.NGHTTP2_CANCEL))},onExitState(){l.isShuttingDown()||(I(),this.onError=void 0,this.onClose=void 0)}};function f(){d(),(r>0||t.pingIdleConnection)&&(o=Wr(h,t.pingIntervalMs))}s(f,"resetPingInterval");function d(){clearTimeout(o),clearTimeout(a)}s(d,"stopPingInterval");function h(){p(f)}s(h,"onPingInterval");function p(v){clearTimeout(a),a=Wr(()=>{e.destroy(new w("PING timed out",b.Unavailable),ce.constants.NGHTTP2_CANCEL)},t.pingTimeoutMs),e.ping((C,_)=>{if(clearTimeout(a),C===null){if(_>t.pingTimeoutMs){e.destroy(new w("PING timed out",b.Unavailable),ce.constants.NGHTTP2_CANCEL);return}n=Date.now(),v()}})}s(p,"commonPing");function y(){clearTimeout(u)}s(y,"stopIdleTimeout");function g(){u=Wr(N,t.idleConnectionTimeoutMs)}s(g,"resetIdleTimeout");function N(){e.close(),S()}s(N,"onIdleTimeout");function E(v,C,_){if(v===ce.constants.NGHTTP2_NO_ERROR&&r===0){e.destroy(new w("received GOAWAY without any open streams",b.Canceled),ce.constants.NGHTTP2_NO_ERROR);return}i=!0;let O=Buffer.from("too_many_pings","ascii");_?.equals(O)&&(t.pingIntervalMs=t.pingIntervalMs*2,c=!0)}s(E,"onGoaway");function S(){var v;I(),(v=l.onClose)===null||v===void 0||v.call(l)}s(S,"onClose");function T(v){var C,_;if(I(),c){let O=new w(`http/2 connection closed with error code ENHANCE_YOUR_CALM (0x${ce.constants.NGHTTP2_ENHANCE_YOUR_CALM.toString(16)}), too_many_pings, doubled the interval`,b.ResourceExhausted);(C=l.onError)===null||C===void 0||C.call(l,O)}else(_=l.onError)===null||_===void 0||_.call(l,qe(v))}s(T,"onError");function I(){d(),y(),e.off("error",T),e.off("close",S),e.off("goaway",E)}return s(I,"cleanup"),e.on("error",T),e.on("close",S),e.on("goaway",E),l}s(uf,"ready");function Wr(e,t){if(!(t>2147483647))return setTimeout(e,t).unref()}s(Wr,"safeSetTimeout");function lf(e){if(e.connecting)throw new w("expected open session, but it is connecting",b.Internal);if(e.destroyed)throw new w("expected open session, but it is destroyed",b.Internal);if(e.closed)throw new w("expected open session, but it is closed",b.Internal)}s(lf,"assertSessionOpen");function $r(e){var t;if(e.httpVersion=="1.1")return ff(e.nodeOptions);let n=(t=e.sessionProvider)!==null&&t!==void 0?t:(r=>new tt(r));return mf(n)}s($r,"createNodeHttpClient");function ff(e){return s(async function(n){let r=As(n.signal);return new Promise((o,a)=>{r.onError(i=>{a(i)}),df(r,n.url,Object.assign(Object.assign({},e),{headers:Br(n.header,e?.headers),method:n.method}),i=>{xs(n,i,r),i.on("response",c=>{var u;c.on("error",r.error),r.onError(f=>c.destroy(f));let l=new Headers;o({status:(u=c.statusCode)!==null&&u!==void 0?u:0,header:St(c.headers),body:pf(r,c,l),trailer:l})})})})},"request")}s(ff,"createNodeHttp1Client");function mf(e){return s(function(n){let r=As(n.signal),o=e(n.url);return new Promise((a,i)=>{r.onError(c=>{i(c)}),hf(r,o,n.url,n.method,Br(n.header),{},c=>{xs(n,c,r),c.on("response",u=>{var l;let f={status:(l=u[":status"])!==null&&l!==void 0?l:0,header:St(u),body:bf(r,c,o),trailer:yf(c)};a(f)})})})},"request")}s(mf,"createNodeHttp2Client");function df(e,t,n,r){let o;new URL(t).protocol.startsWith("https")?o=Is.request(t,n):o=vs.request(t,n),e.onError(a=>o.destroy(a)),o.flushHeaders(),o.on("error",e.error),o.on("socket",s(function(i){function c(){i.off("connect",c),r(o)}s(c,"onSocketConnect"),i.readyState==="open"?r(o):i.on("connect",c)},"onRequestSocket"))}s(df,"h1Request");function pf(e,t,n){let r=t[Symbol.asyncIterator]();return{[Symbol.asyncIterator](){return{async next(){let o=await e.race(r.next());return o.done===!0&&(St(t.trailers).forEach((a,i)=>{n.set(i,a)}),e.close()),o},throw(o){throw e.error(o),o}}}}}s(pf,"h1ResponseIterable");function hf(e,t,n,r,o,a,i){let c=new URL(n);if(c.origin!==t.authority){let u=`cannot make a request to ${c.origin}: the http2 session is connected to ${t.authority}`;e.error(new w(u,b.Internal));return}t.request(r,c.pathname+c.search,o,{}).then(u=>{e.onError(l=>{if(u.closed)return;let f=l.code==b.Canceled?U.CANCEL:U.INTERNAL_ERROR;return new Promise(d=>u.close(f,d))}),u.on("error",s(function(f){u.writableEnded&&Sn(f).map(et).some(d=>d.code=="ERR_STREAM_WRITE_AFTER_END")||e.error(f)},"h2StreamError")),u.on("close",s(function(){let f=Ns(u.rstCode);f&&e.error(f)},"h2StreamClose")),i(u)},u=>{e.error(u)})}s(hf,"h2Request");function yf(e){let t=new Headers;return e.on("trailers",n=>{St(n).forEach((r,o)=>{t.set(o,r)})}),t}s(yf,"h2ResponseTrailer");function bf(e,t,n){let r=t[Symbol.asyncIterator]();return{[Symbol.asyncIterator](){return{async next(){let o=await e.race(r.next());return o.done===!0&&e.close(),n?.notifyResponseByteRead(t),o},throw(o){throw e.error(o),o}}}}}s(bf,"h2ResponseIterable");async function xs(e,t,n){if(e.body===void 0){await new Promise(o=>t.end(o));return}let r=e.body[Symbol.asyncIterator]();return new Promise(o=>{a();function a(){n.isClosed()||r.next().then(i=>{if(i.done===!0){t.end(o);return}t.write(i.value,"binary",c=>{if(c==null){a();return}r.throw!==void 0&&r.throw(qe(c)).catch(()=>{}),!(t.writableEnded&&Sn(c).map(et).some(u=>u.code=="ERR_STREAM_WRITE_AFTER_END"))&&n.error(c)})},i=>{n.error(i)})}s(a,"writeNext")})}s(xs,"sinkRequest");function As(e){let t,n=!1,r,o=[],a={error(u){if(!n){n=!0,r=u instanceof w?u:qe(u),t?.(r);for(let l of o)l(r);i()}},close(){n||(n=!0,t&&t(new w("sentinel completed early",b.Internal)),i())},isClosed(){return n},onError(u){n?r!==void 0&&u(r):o.push(u)},race(u){let l,f=new Promise((d,h)=>{l=d,t=h});return u.then(d=>{l?.(d)},d=>{t?.(d)}),n&&t?.(r??new w("sentinel completed early",b.Internal)),f}};function i(){e&&e.removeEventListener("abort",c),o=[],t=void 0}s(i,"cleanup");function c(){a.error(Ee(this))}return s(c,"onSignalAbort"),e&&(e.addEventListener("abort",c),e.aborted&&a.error(Ee(e))),a}s(As,"createSentinel");function _s(e){var t,n,r,o;let a;if(e.httpVersion=="2"){let i;e.sessionManager?i=e.sessionManager:i=new tt(e.baseUrl,{pingIntervalMs:e.pingIntervalMs,pingIdleConnection:e.pingIdleConnection,pingTimeoutMs:e.pingTimeoutMs,idleConnectionTimeoutMs:e.idleConnectionTimeoutMs},e.nodeOptions),a=$r({httpVersion:"2",sessionProvider:s(()=>i,"sessionProvider")})}else a=$r({httpVersion:"1.1",nodeOptions:e.nodeOptions});return Object.assign(Object.assign(Object.assign({},e),{httpClient:a,useBinaryFormat:(t=e.useBinaryFormat)!==null&&t!==void 0?t:!0,interceptors:(n=e.interceptors)!==null&&n!==void 0?n:[],sendCompression:(r=e.sendCompression)!==null&&r!==void 0?r:null,acceptCompression:(o=e.acceptCompression)!==null&&o!==void 0?o:[ws,Ss]}),xr(e.readMaxBytes,e.writeMaxBytes,e.compressMinBytes))}s(_s,"validateNodeTransportOptions");function Tt(e){return Mr(_s(e))}s(Tt,"createConnectTransport");function Rs(e,t=300*1e3){return n=>async r=>{let o=await e.issueToken(t);return r.header.set("Authorization",`Bearer ${o}`),await n(r)}}s(Rs,"bearerAuthInterceptor");function xn(e,t){let n=t.baseUrl||`https://${e}.compute.namespaceapis.com`;return Tt({httpVersion:"1.1",baseUrl:n,useBinaryFormat:!1,interceptors:[Rs(t.tokenSource)]})}s(xn,"createRegionTransport");var Cs=V("CiNwcm90by9uYW1lc3BhY2Uvc3RkbGliL2xhYmVscy5wcm90bxIQbmFtZXNwYWNlLnN0ZGxpYiIkCgVMYWJlbBIMCgRuYW1lGAEgASgJEg0KBXZhbHVlGAIgASgJIrABChBMYWJlbEZpbHRlckVudHJ5EgwKBG5hbWUYASABKAkSDQoFdmFsdWUYAiABKAkSPAoCb3AYAyABKA4yMC5uYW1lc3BhY2Uuc3RkbGliLkxhYmVsRmlsdGVyRW50cnkuTGFiZWxGaWx0ZXJPcCJBCg1MYWJlbEZpbHRlck9wEgsKB1VOS05PV04QABIJCgVFUVVBTBABEg0KCU5PVF9FUVVBTBACEgkKBUVYSVNUEANCPlo8bmFtZXNwYWNlbGFicy5kZXYvaW50ZXJuYWwvcHVibGljL2dlbi9wcm90by9uYW1lc3BhY2Uvc3RkbGliYgZwcm90bzM");var Os;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.EQUAL=1]="EQUAL",e[e.NOT_EQUAL=2]="NOT_EQUAL",e[e.EXIST=3]="EXIST"})(Os||(Os={}));var Fs=V("CiVwcm90by9uYW1lc3BhY2Uvc3RkbGliL21hdGNoZXJzLnByb3RvEhBuYW1lc3BhY2Uuc3RkbGliIpIBCg1TdHJpbmdNYXRjaGVyEg4KBnZhbHVlcxgBIAMoCRI0CgJvcBgCIAEoDjIoLm5hbWVzcGFjZS5zdGRsaWIuU3RyaW5nTWF0Y2hlci5PcGVyYXRvciI7CghPcGVyYXRvchIUChBPUEVSQVRPUl9VTktOT1dOEAASDQoJSVNfQU5ZX09GEAESCgoGSVNfTk9UEAIikAEKDEludDY0TWF0Y2hlchIOCgZ2YWx1ZXMYASADKAMSMwoCb3AYAiABKA4yJy5uYW1lc3BhY2Uuc3RkbGliLkludDY0TWF0Y2hlci5PcGVyYXRvciI7CghPcGVyYXRvchIUChBPUEVSQVRPUl9VTktOT1dOEAASDQoJSVNfQU5ZX09GEAESCgoGSVNfTk9UEAIiZwoOVGltZXN0YW1wUmFuZ2USKQoFYWZ0ZXIYASABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEioKBmJlZm9yZRgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXAiJwoKSW50NjRSYW5nZRILCgNsb3cYASABKAMSDAoEaGlnaBgCIAEoA0I+WjxuYW1lc3BhY2VsYWJzLmRldi9pbnRlcm5hbC9wdWJsaWMvZ2VuL3Byb3RvL25hbWVzcGFjZS9zdGRsaWJiBnByb3RvMw",[xe]);var Ls;(function(e){e[e.OPERATOR_UNKNOWN=0]="OPERATOR_UNKNOWN",e[e.IS_ANY_OF=1]="IS_ANY_OF",e[e.IS_NOT=2]="IS_NOT"})(Ls||(Ls={}));var ks;(function(e){e[e.OPERATOR_UNKNOWN=0]="OPERATOR_UNKNOWN",e[e.IS_ANY_OF=1]="IS_ANY_OF",e[e.IS_NOT=2]="IS_NOT"})(ks||(ks={}));var gf=V("CjNwcm90by9uYW1lc3BhY2UvY2xvdWQvc3RvcmFnZS92MWJldGEvYXJ0aWZhY3QucHJvdG8SHm5hbWVzcGFjZS5jbG91ZC5zdG9yYWdlLnYxYmV0YSLOAQoVQ3JlYXRlQXJ0aWZhY3RSZXF1ZXN0EgwKBHBhdGgYASABKAkSEQoJbmFtZXNwYWNlGAIgASgJEi4KCmV4cGlyZXNfYXQYAyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEicKBmxhYmVscxgFIAMoCzIXLm5hbWVzcGFjZS5zdGRsaWIuTGFiZWwSFQoJb3ZlcndyaXRlGAYgASgIQgIYARIkChxjcmVhdGVfbmV3X3ZlcnNpb25faWZfZXhpc3RzGAcgASgIInYKFkNyZWF0ZUFydGlmYWN0UmVzcG9uc2USGQoRc2lnbmVkX3VwbG9hZF91cmwYASABKAkSEQoJdXBsb2FkX2lkGAIgASgJEi4KCmV4cGlyZXNfYXQYAyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wIoIBChdGaW5hbGl6ZUFydGlmYWN0UmVxdWVzdBIRCgl1cGxvYWRfaWQYAyABKAkSKwoKYWRkX2xhYmVscxgEIAMoCzIXLm5hbWVzcGFjZS5zdGRsaWIuTGFiZWwSEAoEcGF0aBgBIAEoCUICGAESFQoJbmFtZXNwYWNlGAIgASgJQgIYASJZChhGaW5hbGl6ZUFydGlmYWN0UmVzcG9uc2USPQoLZGVzY3JpcHRpb24YASABKAsyKC5uYW1lc3BhY2UuY2xvdWQuc3RvcmFnZS52MWJldGEuQXJ0aWZhY3QiaQoWUmVzb2x2ZUFydGlmYWN0UmVxdWVzdBIMCgRwYXRoGAEgASgJEhEKCW5hbWVzcGFjZRgCIAEoCRIVCg1tZXRhZGF0YV9vbmx5GAMgASgIEhcKD2luY2x1ZGVfZXhwaXJlZBgEIAEoCCKlAQoXUmVzb2x2ZUFydGlmYWN0UmVzcG9uc2USPQoLZGVzY3JpcHRpb24YAyABKAsyKC5uYW1lc3BhY2UuY2xvdWQuc3RvcmFnZS52MWJldGEuQXJ0aWZhY3QSGwoTc2lnbmVkX2Rvd25sb2FkX3VybBgBIAEoCRIuCgpleHBpcmVzX2F0GAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcCI4ChVFeHBpcmVBcnRpZmFjdFJlcXVlc3QSDAoEcGF0aBgBIAEoCRIRCgluYW1lc3BhY2UYAiABKAki4QIKFExpc3RBcnRpZmFjdHNSZXF1ZXN0EhIKCm5hbWVzcGFjZXMYASADKAkSOAoMbGFiZWxfZmlsdGVyGAIgAygLMiIubmFtZXNwYWNlLnN0ZGxpYi5MYWJlbEZpbHRlckVudHJ5EhMKC21heF9lbnRyaWVzGAMgASgFEhQKDHNraXBfZXhwaXJlZBgFIAEoCBIZChFwYWdpbmF0aW9uX2N1cnNvchgEIAEoDBJOCghvcmRlcl9ieRgGIAEoDjI8Lm5hbWVzcGFjZS5jbG91ZC5zdG9yYWdlLnYxYmV0YS5MaXN0QXJ0aWZhY3RzUmVxdWVzdC5PcmRlckJ5EjAKCnNpemVfcmFuZ2UYByABKAsyHC5uYW1lc3BhY2Uuc3RkbGliLkludDY0UmFuZ2UiMwoHT3JkZXJCeRIUChBPUkRFUl9CWV9VTktOT1dOEAASEgoOQ3JlYXRlZEF0X0Rlc2MQASJvChVMaXN0QXJ0aWZhY3RzUmVzcG9uc2USOwoJYXJ0aWZhY3RzGAEgAygLMigubmFtZXNwYWNlLmNsb3VkLnN0b3JhZ2UudjFiZXRhLkFydGlmYWN0EhkKEXBhZ2luYXRpb25fY3Vyc29yGAIgASgMItQCCghBcnRpZmFjdBIKCgJpZBgKIAEoCRIMCgRwYXRoGAEgASgJEhEKCW5hbWVzcGFjZRgCIAEoCRIuCgpjcmVhdGVkX2F0GAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIuCgpleHBpcmVzX2F0GAMgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBInCgZsYWJlbHMYBSADKAsyFy5uYW1lc3BhY2Uuc3RkbGliLkxhYmVsEgwKBHNpemUYByABKAMSDwoHd2ViX3VybBgIIAEoCRI/CgZzdGF0dXMYCSABKA4yLy5uYW1lc3BhY2UuY2xvdWQuc3RvcmFnZS52MWJldGEuQXJ0aWZhY3QuU3RhdHVzIjIKBlN0YXR1cxIRCg1TVEFURV9VTktOT1dOEAASCAoETElWRRABEgsKB0VYUElSRUQQAjL/BAoQQXJ0aWZhY3RzU2VydmljZRJ/Cg5DcmVhdGVBcnRpZmFjdBI1Lm5hbWVzcGFjZS5jbG91ZC5zdG9yYWdlLnYxYmV0YS5DcmVhdGVBcnRpZmFjdFJlcXVlc3QaNi5uYW1lc3BhY2UuY2xvdWQuc3RvcmFnZS52MWJldGEuQ3JlYXRlQXJ0aWZhY3RSZXNwb25zZRKFAQoQRmluYWxpemVBcnRpZmFjdBI3Lm5hbWVzcGFjZS5jbG91ZC5zdG9yYWdlLnYxYmV0YS5GaW5hbGl6ZUFydGlmYWN0UmVxdWVzdBo4Lm5hbWVzcGFjZS5jbG91ZC5zdG9yYWdlLnYxYmV0YS5GaW5hbGl6ZUFydGlmYWN0UmVzcG9uc2USggEKD1Jlc29sdmVBcnRpZmFjdBI2Lm5hbWVzcGFjZS5jbG91ZC5zdG9yYWdlLnYxYmV0YS5SZXNvbHZlQXJ0aWZhY3RSZXF1ZXN0GjcubmFtZXNwYWNlLmNsb3VkLnN0b3JhZ2UudjFiZXRhLlJlc29sdmVBcnRpZmFjdFJlc3BvbnNlEnwKDUxpc3RBcnRpZmFjdHMSNC5uYW1lc3BhY2UuY2xvdWQuc3RvcmFnZS52MWJldGEuTGlzdEFydGlmYWN0c1JlcXVlc3QaNS5uYW1lc3BhY2UuY2xvdWQuc3RvcmFnZS52MWJldGEuTGlzdEFydGlmYWN0c1Jlc3BvbnNlEl8KDkV4cGlyZUFydGlmYWN0EjUubmFtZXNwYWNlLmNsb3VkLnN0b3JhZ2UudjFiZXRhLkV4cGlyZUFydGlmYWN0UmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eUJMWkpuYW1lc3BhY2VsYWJzLmRldi9pbnRlcm5hbC9wdWJsaWMvZ2VuL3Byb3RvL25hbWVzcGFjZS9jbG91ZC9zdG9yYWdlL3YxYmV0YWIGcHJvdG8z",[tn,xe,Cs,Fs]);var Us;(function(e){e[e.ORDER_BY_UNKNOWN=0]="ORDER_BY_UNKNOWN",e[e.CreatedAt_Desc=1]="CreatedAt_Desc"})(Us||(Us={}));var Ds;(function(e){e[e.STATE_UNKNOWN=0]="STATE_UNKNOWN",e[e.LIVE=1]="LIVE",e[e.EXPIRED=2]="EXPIRED"})(Ds||(Ds={}));var Vs=pn(gf,0);function Ms(e){let t=e.transport||xn(e.region||"us",{tokenSource:e.tokenSource});return{artifacts:Nt(Vs,t)}}s(Ms,"createStorageClient");import{createReadStream as Rf,openAsBlob as Of}from"node:fs";import{createHash as Js}from"node:crypto";import{existsSync as xf}from"node:fs";function vt(e){try{let n=Ef(e).split(".");if(n.length!==3)return null;let r=n[1],o=Buffer.from(r,"base64url").toString("utf8");return JSON.parse(o)}catch{return null}}s(vt,"extractClaims");function Ef(e){let t=["st_","nsct_","nscw_","oidc_","cognito_"];for(let n of t)if(e.startsWith(n))return e.substring(n.length);return e}s(Ef,"stripTokenPrefix");import*as Le from"fs/promises";import*as ye from"path";import*as nt from"os";var Ys=V("Ci5wcm90by9uYW1lc3BhY2UvcHJpdmF0ZS9zZXNzaW9ucy9zZXNzaW9uLnByb3RvEiFuYW1lc3BhY2UucHJpdmF0ZS5zZXNzaW9ucy52MWJldGEi3gMKD1JlcXVlc3RNZXRhZGF0YRISCgpyZXF1ZXN0X2lkGAEgASgJEhIKCnVzZXJfYWdlbnQYAiABKAkSDwoHdWFfbmFtZRgEIAEoCRISCgp1YV92ZXJzaW9uGAUgASgJEg0KBXVhX29zGAYgASgJEhUKDXVhX29zX3ZlcnNpb24YByABKAkSEQoJdWFfZGV2aWNlGAggASgJElcKDnVhX2RldmljZV9raW5kGAkgASgOMj8ubmFtZXNwYWNlLnByaXZhdGUuc2Vzc2lvbnMudjFiZXRhLlJlcXVlc3RNZXRhZGF0YS5VYURldmljZUtpbmQSEgoKaXBfYWRkcmVzcxgDIAEoCRISCgppcF9jaXR5X2lkGAogASgDEhIKCmlwX2NpdHlfZW4YCyABKAkSFgoOaXBfY291bnRyeV9pc28YDCABKAkSFQoNaXBfY291bnRyeV9lbhgNIAEoCSKAAQoMVWFEZXZpY2VLaW5kEhoKFlVBX0RFVklDRV9LSU5EX1VOS05PV04QABIUChBVQV9ERVZJQ0VfTU9CSUxFEAESFAoQVUFfREVWSUNFX1RBQkxFVBACEhUKEVVBX0RFVklDRV9ERVNLVE9QEAMSEQoNVUFfREVWSUNFX0JPVBAEIqIDCgdTZXNzaW9uEgoKAmlkGAEgASgJEhAKCG93bmVyX2lkGAIgASgJEhEKCXRlbmFudF9pZBgDIAEoCRIuCgpjcmVhdGVkX2F0GAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIuCgpleHBpcmVzX2F0GAUgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIyCg5pbnZhbGlkYXRlZF9hdBgGIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASMAoMbGFzdF91c2VkX2F0GAkgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBJNChFjcmVhdGlvbl9tZXRhZGF0YRgHIAEoCzIyLm5hbWVzcGFjZS5wcml2YXRlLnNlc3Npb25zLnYxYmV0YS5SZXF1ZXN0TWV0YWRhdGESUQoVaW52YWxpZGF0aW9uX21ldGFkYXRhGAggASgLMjIubmFtZXNwYWNlLnByaXZhdGUuc2Vzc2lvbnMudjFiZXRhLlJlcXVlc3RNZXRhZGF0YUJIWkZuYW1lc3BhY2VsYWJzLmRldi9pbnRlcm5hbC9wdWJsaWMvZ2VuL3Byb3RvL25hbWVzcGFjZS9wcml2YXRlL3Nlc3Npb25zYgZwcm90bzM",[xe]);var Ps;(function(e){e[e.UA_DEVICE_KIND_UNKNOWN=0]="UA_DEVICE_KIND_UNKNOWN",e[e.UA_DEVICE_MOBILE=1]="UA_DEVICE_MOBILE",e[e.UA_DEVICE_TABLET=2]="UA_DEVICE_TABLET",e[e.UA_DEVICE_DESKTOP=3]="UA_DEVICE_DESKTOP",e[e.UA_DEVICE_BOT=4]="UA_DEVICE_BOT"})(Ps||(Ps={}));var Nf=V("Cixwcm90by9uYW1lc3BhY2UvcHJpdmF0ZS9zZXNzaW9ucy91c2Vycy5wcm90bxIhbmFtZXNwYWNlLnByaXZhdGUuc2Vzc2lvbnMudjFiZXRhIlMKFExpc3RTZXNzaW9uc1Jlc3BvbnNlEjsKB3Nlc3Npb24YASADKAsyKi5uYW1lc3BhY2UucHJpdmF0ZS5zZXNzaW9ucy52MWJldGEuU2Vzc2lvbiIuChhJbnZhbGlkYXRlU2Vzc2lvblJlcXVlc3QSEgoKc2Vzc2lvbl9pZBgBIAEoCSIzCh1JbnZhbGlkYXRlQWxsU2Vzc2lvbnNSZXNwb25zZRISCgpzZXNzaW9uX2lkGAEgAygJIlcKIklzc3VlVGVuYW50VG9rZW5Gcm9tU2Vzc2lvblJlcXVlc3QSMQoOdG9rZW5fZHVyYXRpb24YASABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb24iOwojSXNzdWVUZW5hbnRUb2tlbkZyb21TZXNzaW9uUmVzcG9uc2USFAoMdGVuYW50X3Rva2VuGAEgASgJMoIEChNVc2VyU2Vzc2lvbnNTZXJ2aWNlEl8KDExpc3RTZXNzaW9ucxIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRo3Lm5hbWVzcGFjZS5wcml2YXRlLnNlc3Npb25zLnYxYmV0YS5MaXN0U2Vzc2lvbnNSZXNwb25zZRJoChFJbnZhbGlkYXRlU2Vzc2lvbhI7Lm5hbWVzcGFjZS5wcml2YXRlLnNlc3Npb25zLnYxYmV0YS5JbnZhbGlkYXRlU2Vzc2lvblJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkScQoVSW52YWxpZGF0ZUFsbFNlc3Npb25zEhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5GkAubmFtZXNwYWNlLnByaXZhdGUuc2Vzc2lvbnMudjFiZXRhLkludmFsaWRhdGVBbGxTZXNzaW9uc1Jlc3BvbnNlEqwBChtJc3N1ZVRlbmFudFRva2VuRnJvbVNlc3Npb24SRS5uYW1lc3BhY2UucHJpdmF0ZS5zZXNzaW9ucy52MWJldGEuSXNzdWVUZW5hbnRUb2tlbkZyb21TZXNzaW9uUmVxdWVzdBpGLm5hbWVzcGFjZS5wcml2YXRlLnNlc3Npb25zLnYxYmV0YS5Jc3N1ZVRlbmFudFRva2VuRnJvbVNlc3Npb25SZXNwb25zZWIGcHJvdG8z",[tn,lr,Ys]);var Bs=pn(Nf,0);function wf(){return process.env.NSC_IAM_ENDPOINT||process.env.NSC_GLOBAL_ENDPOINT||"https://private-api.global.namespaceapis.com"}s(wf,"getIAMEndpoint");function Gs(){let e=process.env.NSC_DEBUG;return e?new Set(e.split(",").map(t=>t.trim().toLowerCase())):new Set}s(Gs,"getDebugFlags");function Sf(){return Gs().has("auth")}s(Sf,"isAuthDebugEnabled");function Tf(){return Gs().has("force-auth-refresh")}s(Tf,"isForceAuthRefreshEnabled");function ae(e){Sf()&&console.error(`[nsc:auth] ${e}`)}s(ae,"debug");var Jr=class extends Error{static{s(this,"NotLoggedInError")}constructor(){super("you are not logged in to Namespace; try running `nsc login`"),this.name="NotLoggedInError"}};function vf(){let e=nt.platform();return e==="darwin"?ye.join(nt.homedir(),"Library/Application Support"):e==="win32"?process.env.APPDATA||ye.join(nt.homedir(),"AppData/Roaming"):process.env.XDG_CONFIG_HOME||ye.join(nt.homedir(),".config")}s(vf,"getUserConfigDir");async function An(e){try{let t=await Le.readFile(e,"utf8"),n=JSON.parse(t),r=ye.dirname(e);if(ae(`Loaded token from ${e}`),n.session_token)ae("Token type: session token (will refresh bearer tokens)");else if(n.bearer_token){let o=vt(n.bearer_token);if(o?.exp){let a=new Date(o.exp*1e3),i=new Date;if(a>i){let c=a.getTime()-i.getTime(),u=Math.floor(c/6e4);ae(`Token type: bearer token (valid for ${u} minutes)`)}else ae("Token type: bearer token (expired)")}else ae("Token type: bearer token (no expiration)")}return new It(n.bearer_token,n.session_token,r)}catch(t){throw t.code==="ENOENT"?new Jr:t}}s(An,"loadFromFile");async function Ws(){if(process.env.NSC_TOKEN_FILE)return await An(process.env.NSC_TOKEN_FILE);let e="/var/run/nsc/token.json";try{return await Le.access(e),await An(e)}catch{}return await If()}s(Ws,"loadDefaults");async function If(){let e=vf(),t=ye.join(e,"ns/token.json");return await An(t)}s(If,"loadUserToken");async function Xs(){let e=process.env.NSC_TOKEN_FILE||"/var/run/nsc/token.json",t=await An(e);if(!t.bearerToken)throw new Error("Workload token file does not contain a bearer token");return new It(t.bearerToken,void 0,void 0)}s(Xs,"loadWorkloadToken");function $s(e){return new It(e,void 0,void 0)}s($s,"fromBearerToken");var It=class{static{s(this,"LoadedToken")}constructor(t,n,r){this.bearerToken=t,this.sessionToken=n,this.cacheDir=r}getSessionsClient(){if(!this.sessionsClient){let t=Tt({httpVersion:"1.1",baseUrl:wf(),useBinaryFormat:!1,interceptors:[n=>async r=>(this.sessionToken&&r.header.set("Authorization",`Bearer ${this.sessionToken}`),await n(r))]});this.sessionsClient=Nt(Bs,t)}return this.sessionsClient}async issueToken(t,n=!1){if(this.sessionToken)return await this.issueFromSession(t,n);if(this.bearerToken)return this.bearerToken;throw new Error("No bearer token or session token available")}async issueFromSession(t,n){if(!this.sessionToken)throw new Error("No session token available");let r=s(async h=>{let p=this.getSessionsClient(),y=BigInt(Math.floor(h/1e3));return(await p.issueTenantTokenFromSession({tokenDuration:L(Ga,{seconds:y})})).tenantToken},"issueNewToken");if(n||Tf()){ae("Forcing new token issue");let h=Date.now(),p=await r(t);return ae(`Issued new bearer token from session (took ${Date.now()-h}ms)`),p}let a=vt(this.sessionToken);if(!a)throw new Error("Failed to extract claims from session token");if(this.cacheDir){let h=ye.join(this.cacheDir,"token.cache");try{let p=await Le.readFile(h,"utf8"),y=vt(p);if(y&&y.tenant_id===a.tenant_id){let g=Date.now(),N=(y.exp||0)*1e3;if(N>g+t){let E=Math.floor((N-g)/6e4);return ae(`Using cached bearer token (valid for ${E} minutes)`),p}}}catch{}}let i=t*2,c=3600*1e3;i>c&&(i=c),ae("Issuing new bearer token from session");let u=Date.now(),l=await r(i),f=Date.now()-u;if(this.cacheDir){let h=ye.join(this.cacheDir,"token.cache");try{await Le.writeFile(h,l,{mode:384})}catch{}}let d=vt(l);if(d?.exp){let h=Math.floor((d.exp*1e3-Date.now())/6e4);ae(`Issued new bearer token (valid for ${h} minutes, took ${f}ms)`)}else ae(`Issued new bearer token (took ${f}ms)`);return l}};var Af="/var/run/nsc/token.json";async function Zs(){return process.env.NX_NAMESPACE_TOKEN?$s(process.env.NX_NAMESPACE_TOKEN):xf(Af)?{async issueToken(e){return(await Xs()).issueToken(e)}}:Ws()}s(Zs,"credentials");var _n=30*1e3,Kr=6e4,zr="main",Cf="storage.namespaceapis.com",Lf=7*864e5;function kf(e=at){return`https://${e}.${Cf}`}s(kf,"artifactStorageBaseUrl");async function Ks(e,t=at,n,r){if(!/^[a-zA-Z0-9/_-]+$/.test(e)||e.includes(".."))throw new Error("Invalid artifact prefix");if(!/^[a-z0-9-]+$/.test(t))throw new Error("Invalid region");let o=await Zs(),a=xn(t,{tokenSource:o,baseUrl:kf(t)}),i=Ms({tokenSource:o,transport:a}).artifacts;async function c(f,d,h){let p=performance.now(),y=f==="resolve"?r?.begin("artifact.resolve"):f==="download-headers"?r?.begin("artifact.headers"):void 0;try{return await h()}finally{y?.(),n?.({operation:f,hash:d,durationMs:performance.now()-p})}}s(c,"timed");function u(f){return ct(f),`${e}/${f}`}s(u,"path");function l(f){return i.resolveArtifact({namespace:zr,path:u(f),metadataOnly:!0},{timeoutMs:_n})}return s(l,"resolveExisting"),{async get(f,d){let h;try{h=await c("resolve",f,()=>i.resolveArtifact({namespace:zr,path:u(f)},{timeoutMs:_n,...d?{signal:d}:{}}))}catch(N){if(N instanceof w&&N.code===b.NotFound)return null;throw N}let p=d?AbortSignal.any([d,AbortSignal.timeout(Kr)]):AbortSignal.timeout(Kr),y=await c("download-headers",f,()=>fetch(h.signedDownloadUrl,{signal:p}));if(!y.ok||!y.body)throw new Error(`Artifact download failed: HTTP ${y.status}`);let g=y.body.getReader();return(async function*(){let N=0n,E=Js("sha256"),S=r?.begin("artifact.body");try{for(;;){let I=await g.read();if(I.done)break;N+=BigInt(I.value.length),E.update(I.value),yield I.value}let T=h.description?.labels.find(I=>I.name==="artifact.digest.sha256")?.value;if(N!==h.description?.size||!T||E.digest("hex")!==T)throw new Error("Artifact integrity mismatch")}finally{await g.cancel(),g.releaseLock(),S?.({bytes:Number(N)})}})()},async put(f,d){let h;try{h=await c("create",f,()=>i.createArtifact({namespace:zr,path:u(f),createNewVersionIfExists:!1,expiresAt:Ba(new Date(Date.now()+Lf))},{timeoutMs:_n}))}catch(N){if(N instanceof w&&N.code===b.AlreadyExists)return await l(f),!1;throw N}let p=Js("sha256");for await(let N of Rf(d))p.update(N);let y=await Of(d),g=await c("upload",f,()=>fetch(h.signedUploadUrl,{method:Ce.Put,body:y,headers:{"Content-Length":String(y.size)},signal:AbortSignal.timeout(Kr)}));if(!g.ok)throw new Error(`Artifact upload failed: HTTP ${g.status}`);try{await c("finalize",f,()=>i.finalizeArtifact({uploadId:h.uploadId,addLabels:[{name:"artifact.digest.sha256",value:p.digest("hex")}]},{timeoutMs:_n}))}catch(N){if(!(N instanceof w&&N.code===b.AlreadyExists))throw N;return await l(f),!1}return!0}}}s(Ks,"createArtifactStore");import{createServer as Ff}from"node:http";import{createReadStream as Uf}from"node:fs";import{stat as zs}from"node:fs/promises";import{pipeline as Df}from"node:stream/promises";import{randomBytes as Vf,timingSafeEqual as Mf}from"node:crypto";var Rn=class{static{s(this,"PublicationQueue")}jobs=new Map;waiting=[];active=0;failed=!1;concurrency;constructor(t=10){if(!Number.isInteger(t)||t<1)throw new Error("Invalid publication concurrency");this.concurrency=t}async add(t,n){if(this.jobs.has(t))return;if(this.active>=this.concurrency?await new Promise(o=>this.waiting.push(o)):this.active++,this.jobs.has(t)){this.release();return}let r=Promise.resolve().then(n).catch(()=>{this.failed=!0}).finally(()=>{this.jobs.delete(t),this.release()});this.jobs.set(t,r)}release(){let t=this.waiting.shift();t?t():this.active--}async drain(){for(;this.jobs.size||this.waiting.length;)await Promise.all(this.jobs.values());if(this.failed)throw new Error("Cache publication failed")}};var Pf=32,Yf=128,Bf=2*6e4,Gf=2*6e4,Wf=2*6e4,Xf=10*1e3,$f=2*6e4,Zf=16,Jf=100,Kf=32;function xt(e,t){return new Promise((n,r)=>{let o=s(()=>{t.removeEventListener("abort",o),r(t.reason)},"abort");t.addEventListener("abort",o,{once:!0}),e.then(a=>{t.removeEventListener("abort",o),n(a)},a=>{t.removeEventListener("abort",o),r(a)}),t.aborted&&o()})}s(xt,"untilAbort");async function Hs(e){let t=e.maxConcurrentRequests??Pf,n=e.maxQueuedRequests??Yf,r=e.queueWaitMs??Bf,o=e.requestDeadlineMs??Gf;if(!Number.isSafeInteger(t)||t<1)throw new Error("Invalid request concurrency");if(!Number.isSafeInteger(n)||n<0)throw new Error("Invalid request queue capacity");if(!Number.isSafeInteger(r)||r<1)throw new Error("Invalid queue wait deadline");if(!Number.isSafeInteger(o)||o<1)throw new Error("Invalid request deadline");let a=Vf(Kf).toString("hex"),i=Buffer.from(`Bearer ${a}`),c=new Set,u=new Rn,l=0,f=[];function d(){for(l--;f.length;){let E=f.shift();if(E&&!E.cancelled){l++,E.admit("admitted");break}}}s(d,"release");function h(E,S){return l<t?(l++,Promise.resolve("admitted")):f.length>=n?Promise.resolve("overload"):new Promise(T=>{let I=!1,v={cancelled:!1,admit:s(W=>O(W),"admit")},C=setTimeout(()=>O("overload"),r),_=s(()=>O("cancelled"),"onClose");function O(W){if(!I){if(I=!0,v.cancelled=W!=="admitted",clearTimeout(C),E.off("aborted",_),S.off("close",_),v.cancelled){let we=f.indexOf(v);we>=0&&f.splice(we,1)}T(W)}}s(O,"finish"),E.once("aborted",_),S.once("close",_),f.push(v)})}s(h,"admit");async function p(E,S){let T=performance.now(),v=/^\/v1\/cache\/([a-zA-Z0-9_-]{1,128})$/.exec(E.url??"")?.[1];if(!v){S.writeHead(P.NotFound).end();return}let C=Buffer.from(E.headers.authorization??"");if(C.length!==i.length||!Mf(C,i)){S.writeHead(P.Unauthorized).end();return}return e.trace?e.trace.request(v,()=>y(E,S,v,T)):y(E,S,v,T)}s(p,"handle");async function y(E,S,T,I){let v=E.method===Ce.Get?Z.Get:Z.Put,C=e.trace?.begin("request.queue"),_=await h(E,S);if(C?.(),_!=="admitted"){_==="overload"&&(e.record({operation:v,tier:k.Overload,hash:T,durationMs:performance.now()-I}),S.destroyed||S.writeHead(e.failOpen?v===Z.Get?P.NotFound:P.Ok:P.ServiceUnavailable,{Connection:"close"}).end());return}let O=new AbortController,W=setTimeout(()=>O.abort(new DOMException("Cache request deadline","TimeoutError")),o),we=s(()=>{S.writableEnded||O.abort(new DOMException("Cache client disconnected","AbortError"))},"disconnected"),Hr=s(()=>{E.method===Ce.Put&&!E.complete&&E.destroy()},"stopUpload");E.once("aborted",we),S.once("close",we),O.signal.addEventListener("abort",Hr,{once:!0});try{if(E.method===Ce.Get){let Q=await xt(e.local.get(T,Se=>e.record({operation:v,tier:k.Corrupt,hash:T,errorCode:Oe(Se),durationMs:performance.now()-I})),O.signal),ie=Q?k.Local:k.Miss;if(!Q&&e.remote){let Se;try{Se=await xt(e.remote.get(T,O.signal),O.signal)}catch(ke){if(O.signal.aborted||(e.record({operation:Z.Remote,tier:k.Unavailable,hash:T,errorCode:Oe(ke),durationMs:performance.now()-I}),!e.failOpen))throw ke;S.writeHead(P.NotFound).end();return}Se&&(Q=(await xt(e.local.receive(T,Se,O.signal),O.signal)).file,ie=k.Artifact)}if(!Q){e.record({operation:v,tier:ie,hash:T,durationMs:performance.now()-I}),S.writeHead(P.NotFound).end();return}let q=await xt(zs(Q),O.signal);if(q.size<1)throw new Y("Empty archive");S.writeHead(P.Ok,{"Content-Type":"application/octet-stream","Content-Length":q.size});let be=e.trace?.begin("response.stream");try{await Df(Uf(Q,{end:q.size-1}),S,{signal:O.signal})}finally{be?.({bytes:q.size})}e.record({operation:v,tier:ie,hash:T,bytes:q.size,durationMs:performance.now()-I})}else if(E.method===Ce.Put){if(e.readOnly){e.record({operation:v,tier:k.ReadOnly,hash:T,durationMs:performance.now()-I}),S.writeHead(P.Forbidden,{Connection:"close"}).end();return}let Q=E.headers["content-length"];if(Q!==void 0&&Number(Q)>e.local.maxBytes){S.writeHead(P.PayloadTooLarge,{Connection:"close"}).end();return}let ie=await xt(e.local.receive(T,E,O.signal),O.signal),q=ie.created,be=e.remoteReadOnly?void 0:e.remote,Se=be?(await zs(ie.file)).size:0;e.remote&&e.remoteReadOnly&&e.record({operation:Z.Publish,tier:k.Policy,hash:T,durationMs:performance.now()-I});let ke=s(async()=>{let At=performance.now();if(be)try{if(q=await be.put(T,ie.file),!q&&ie.created){await e.local.remove(T);let ot=await be.get(T);if(!ot)throw new Error("Existing artifact is not finalized");await e.local.receive(T,ot)}}catch(ot){throw!e.failOpen&&ie.created&&await e.local.remove(T),e.record({operation:Z.Publish,tier:e.failOpen?k.Unavailable:k.Error,hash:T,errorCode:Oe(ot),durationMs:performance.now()-At}),ot}be&&e.record({operation:Z.Publish,tier:q?k.Artifact:k.AlreadyPresent,hash:T,bytes:q?Se:0,durationMs:performance.now()-At})},"publish");try{be&&e.backgroundPublication?await u.add(T,ke):await ke()}catch(At){if(!e.failOpen)throw At}e.record({operation:v,tier:k.Local,hash:T,bytes:ie.bytes,durationMs:performance.now()-I}),S.writeHead(q?P.Ok:P.Conflict).end()}else S.writeHead(P.MethodNotAllowed).end()}catch(Q){e.record({operation:v,tier:k.Error,hash:T,errorCode:Oe(Q),durationMs:performance.now()-I}),!S.destroyed&&!S.headersSent?S.writeHead(e.failOpen?v===Z.Get?P.NotFound:P.Ok:O.signal.aborted?P.ServiceUnavailable:P.InternalServerError).end():S.destroyed||S.destroy()}finally{clearTimeout(W),E.off("aborted",we),S.off("close",we),O.signal.removeEventListener("abort",Hr),d()}}s(y,"serve");let g=Ff((E,S)=>{let T=p(E,S);c.add(T),T.finally(()=>c.delete(T))});g.requestTimeout=Wf,g.headersTimeout=Xf,g.maxConnections=t+n+Zf,g.maxRequestsPerSocket=Jf,g.setTimeout($f,E=>E.destroy()),await new Promise((E,S)=>{g.once("error",S),g.listen(0,"127.0.0.1",E)});let N=g.address();if(!N||typeof N=="string")throw new Error("Missing listener address");return{url:`http://127.0.0.1:${N.port}`,token:a,drain:s(()=>u.drain(),"drain"),async close(){let E=new Promise((S,T)=>g.close(I=>I?T(I):S()));if(await Promise.all(c),g.closeIdleConnections(),await E,g.listening)throw new Error("Listener still running");await u.drain()}}}s(Hs,"startServer");import{AsyncLocalStorage as zf}from"node:async_hooks";var On=class{constructor(t){this.record=t}record;static{s(this,"CacheTrace")}context=new zf;sequence=0;async request(t,n){if(!/^[a-zA-Z0-9_-]{1,128}$/.test(t))throw new Error("Invalid trace identity");let r={requestId:`${process.pid}-${++this.sequence}`,hash:t};return this.context.run(r,async()=>{this.record({...r,stage:"request.start",pid:process.pid,startMs:performance.now(),durationMs:0});let o=this.begin("request");try{return await n()}finally{o?.()}})}begin(t){let n=this.context.getStore();if(!n)return;let r=performance.now(),o=!1;return a=>{if(o)return;o=!0;let i={};for(let c of["bytes","entries","chunks","reservedBytes"]){let u=a?.[c];u!==void 0&&Number.isSafeInteger(u)&&u>=0&&(i[c]=u)}this.record({...n,stage:t,pid:process.pid,startMs:r,durationMs:performance.now()-r,...Object.keys(i).length?{counters:i}:{}})}}};function js(e){process.stderr.write(`${JSON.stringify({cacheTrace:e})}
9
+ `)}s(js,"writeTrace");async function Qs(e,t,n){let r=oo(e),o=e.NX_CACHE_TRACE==="1"?new On(js):void 0,a=new Vt(r.directory,{...r,...o?{trace:o}:{}}),i,c=e.NX_ARTIFACT_PREFIX;if(c){let u=e.NX_ARTIFACT_REGION??at;try{i=await(n?n(c,u):Ks(c,u,void 0,o))}catch(l){if(r.strict)throw l;t({operation:Z.Remote,tier:k.Unavailable,hash:"startup",durationMs:0,errorCode:Oe(l)})}}return Hs({local:a,...i?{remote:i}:{},readOnly:r.readOnly,remoteReadOnly:r.remoteReadOnly,backgroundPublication:!0,failOpen:!r.strict,record:t,...o?{trace:o}:{}})}s(Qs,"startConfiguredServer");import{appendFile as Hf}from"node:fs/promises";function j(e,t){return`| ${e} | ${t.count} | ${t.bytes} | ${Math.round(t.durationMs)} ms |`}s(j,"row");function jf(e){return["### Nx cache operations","","Counts describe connector operations. Duration is connector I/O time, not Nx task count or wall time.","","| Operation | Count | Bytes | Duration |","| --- | ---: | ---: | ---: |",j("Local hits",e.localHits),j("Artifact hits",e.artifactHits),j("Misses",e.misses),j("Local writes",e.localWrites),j("Artifact publications",e.publications),j("Read-only skips",e.readOnlySkips),j("Remote policy skips",e.policySkips),j("Already present",e.alreadyPresent),j("Remote unavailable",e.unavailable),j("Corrupt local entries",e.corrupt),j("Request overload",e.overload),j("Errors",e.errors),""].join(`
10
+ `)}s(jf,"renderCacheSummary");async function qs(e,t,n=Hf,r=()=>process.stderr.write(`Cache summary could not be written
11
+ `)){if(!e)return!1;try{return await n(e,`${jf(t)}
12
+ `),!0}catch{return r(),!1}}s(qs,"appendCacheSummary");var ec=process.argv.slice(hs),tc=ec.shift();if(!tc)throw new Error("Expected command after nscloud-nx-cache-action");var Qf=process.env.NX_CACHE_FAILURE_MODE===Ue.Strict,nc=new En,qf=await Es(tc,ec,process.env,()=>Qs(process.env,nc.record),Qf);await qs(process.env.GITHUB_STEP_SUMMARY,nc.snapshot());process.exitCode=qf;