/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/modal@0.7.4/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
import{ClientError as ClientError11,Status as Status11}from"nice-grpc";function varint64read(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(127&r)<<n,!(128&r))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(15&n)<<28,t=(112&n)>>4,!(128&n))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(127&r)<<n,!(128&r))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function varint64write(e,t,n){for(let r=0;r<28;r+=7){const a=e>>>r,o=!(a>>>7==0&&0==t),i=255&(o?128|a:a);if(n.push(i),!o)return}const r=e>>>28&15|(7&t)<<4,a=!!(t>>3);if(n.push(255&(a?128|r:r)),a){for(let e=3;e<31;e+=7){const r=t>>>e,a=!(r>>>7==0),o=255&(a?128|r:r);if(n.push(o),!a)return}n.push(t>>>31&1)}}var TWO_PWR_32_DBL=4294967296;function int64FromString(e){const t="-"===e[0];t&&(e=e.slice(1));const n=1e6;let r=0,a=0;function o(t,o){const i=Number(e.slice(t,o));a*=n,r=r*n+i,r>=TWO_PWR_32_DBL&&(a+=r/TWO_PWR_32_DBL|0,r%=TWO_PWR_32_DBL)}return o(-24,-18),o(-18,-12),o(-12,-6),o(-6),t?negate(r,a):newBits(r,a)}function int64ToString(e,t){let n=newBits(e,t);const r=2147483648&n.hi;r&&(n=negate(n.lo,n.hi));const a=uInt64ToString(n.lo,n.hi);return r?"-"+a:a}function uInt64ToString(e,t){if(({lo:e,hi:t}=toUnsigned(e,t)),t<=2097151)return String(TWO_PWR_32_DBL*t+e);const n=16777215&(e>>>24|t<<8),r=t>>16&65535;let a=(16777215&e)+6777216*n+6710656*r,o=n+8147497*r,i=2*r;const s=1e7;return a>=s&&(o+=Math.floor(a/s),a%=s),o>=s&&(i+=Math.floor(o/s),o%=s),i.toString()+decimalFrom1e7WithLeadingZeros(o)+decimalFrom1e7WithLeadingZeros(a)}function toUnsigned(e,t){return{lo:e>>>0,hi:t>>>0}}function newBits(e,t){return{lo:0|e,hi:0|t}}function negate(e,t){return t=~t,e?e=1+~e:t+=1,newBits(e,t)}var decimalFrom1e7WithLeadingZeros=e=>{const t=String(e);return"0000000".slice(t.length)+t};function varint32write(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(127&e|128),e>>=7;t.push(1)}}function varint32read(){let e=this.buf[this.pos++],t=127&e;if(!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,!(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let t=5;128&e&&t<10;t++)e=this.buf[this.pos++];if(128&e)throw new Error("invalid varint");return this.assertBounds(),t>>>0}var protoInt64=makeInt64Support();function makeInt64Support(){const e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&("object"!=typeof process||"object"!=typeof process.env||"1"!==process.env.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),r=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const r="bigint"==typeof e?e:BigInt(e);if(r>n||r<t)throw new Error(`invalid int64: ${e}`);return r},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>a||t<r)throw new Error(`invalid uint64: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)),uDec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0))}}return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),assertInt64String(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),assertUInt64String(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),assertInt64String(e),int64FromString(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),assertUInt64String(e),int64FromString(e)),dec:(e,t)=>int64ToString(e,t),uDec:(e,t)=>uInt64ToString(e,t)}}function assertInt64String(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function assertUInt64String(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}var WireType,symbol=Symbol.for("@bufbuild/protobuf/text-encoding");function getTextEncoding(){if(null==globalThis[symbol]){const e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;globalThis[symbol]={encodeUtf8:t=>e.encode(t),decodeUtf8:e=>t.decode(e),checkUtf8(e){try{return encodeURIComponent(e),!0}catch(e){return!1}}}}return globalThis[symbol]}!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"}(WireType||(WireType={}));var FLOAT32_MAX=34028234663852886e22,FLOAT32_MIN=-34028234663852886e22,UINT32_MAX=4294967295,INT32_MAX=2147483647,INT32_MIN=-2147483648,BinaryWriter=class{constructor(e=getTextEncoding().encodeUtf8){this.encodeUtf8=e,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),n=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],n),n+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(assertUInt32(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return assertInt32(e),varint32write(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.encodeUtf8(e);return this.uint32(t.byteLength),this.raw(t)}float(e){assertFloat32(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){assertUInt32(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){assertInt32(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return assertInt32(e),varint32write(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=protoInt64.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=protoInt64.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=protoInt64.enc(e);return varint64write(t.lo,t.hi,this.buf),this}sint64(e){let t=protoInt64.enc(e),n=t.hi>>31;return varint64write(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=protoInt64.uEnc(e);return varint64write(t.lo,t.hi,this.buf),this}},BinaryReader=class{constructor(e,t=getTextEncoding().decodeUtf8){this.decodeUtf8=t,this.varint64=varint64read,this.uint32=varint32read,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.uint32(),t=e>>>3,n=7&e;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case WireType.Varint:for(;128&this.buf[this.pos++];);break;case WireType.Bit64:this.pos+=4;case WireType.Bit32:this.pos+=4;break;case WireType.LengthDelimited:let n=this.uint32();this.pos+=n;break;case WireType.StartGroup:for(;;){const[e,n]=this.tag();if(n===WireType.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(n,e)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return protoInt64.dec(...this.varint64())}uint64(){return protoInt64.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(1&e);return e=(e>>>1|(1&t)<<31)^n,t=t>>>1^n,protoInt64.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return protoInt64.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return protoInt64.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 e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.decodeUtf8(this.bytes())}};function assertInt32(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>INT32_MAX||e<INT32_MIN)throw new Error("invalid int32: "+e)}function assertUInt32(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>UINT32_MAX||e<0)throw new Error("invalid uint32: "+e)}function assertFloat32(e){if("string"==typeof e){const t=e;if(e=Number(e),isNaN(e)&&"NaN"!==t)throw new Error("invalid float32: "+t)}else if("number"!=typeof e)throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>FLOAT32_MAX||e<FLOAT32_MIN))throw new Error("invalid float32: "+e)}function createBaseEmpty(){return{}}var Empty={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseEmpty();for(;n.pos<r;){const e=n.uint32();if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({}),toJSON:e=>({}),create:e=>Empty.fromPartial(e??{}),fromPartial:e=>createBaseEmpty()};function nullValueFromJSON(e){switch(e){case 0:case"NULL_VALUE":return 0;default:return-1}}function nullValueToJSON(e){return 0===e?"NULL_VALUE":"UNRECOGNIZED"}function createBaseStruct(){return{fields:{}}}var Struct={encode:(e,t=new BinaryWriter)=>(Object.entries(e.fields).forEach((([e,n])=>{void 0!==n&&Struct_FieldsEntry.encode({key:e,value:n},t.uint32(10).fork()).join()})),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseStruct();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:{if(10!==e)break;const t=Struct_FieldsEntry.decode(n,n.uint32());void 0!==t.value&&(a.fields[t.key]=t.value);continue}}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({fields:isObject(e.fields)?Object.entries(e.fields).reduce(((e,[t,n])=>(e[t]=n,e)),{}):{}}),toJSON(e){const t={};if(e.fields){const n=Object.entries(e.fields);n.length>0&&(t.fields={},n.forEach((([e,n])=>{t.fields[e]=n})))}return t},create:e=>Struct.fromPartial(e??{}),fromPartial(e){const t=createBaseStruct();return t.fields=Object.entries(e.fields??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=n),e)),{}),t},wrap(e){const t=createBaseStruct();if(void 0!==e)for(const n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){const t={};if(e.fields)for(const n of Object.keys(e.fields))t[n]=e.fields[n];return t}};function createBaseStruct_FieldsEntry(){return{key:"",value:void 0}}var Struct_FieldsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),void 0!==e.value&&Value.encode(Value.wrap(e.value),t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseStruct_FieldsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=Value.unwrap(Value.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet(e.key)?globalThis.String(e.key):"",value:isSet(e?.value)?e.value:void 0}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),void 0!==e.value&&(t.value=e.value),t},create:e=>Struct_FieldsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseStruct_FieldsEntry();return t.key=e.key??"",t.value=e.value??void 0,t}};function createBaseValue(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Value={encode:(e,t=new BinaryWriter)=>(void 0!==e.nullValue&&t.uint32(8).int32(e.nullValue),void 0!==e.numberValue&&t.uint32(17).double(e.numberValue),void 0!==e.stringValue&&t.uint32(26).string(e.stringValue),void 0!==e.boolValue&&t.uint32(32).bool(e.boolValue),void 0!==e.structValue&&Struct.encode(Struct.wrap(e.structValue),t.uint32(42).fork()).join(),void 0!==e.listValue&&ListValue.encode(ListValue.wrap(e.listValue),t.uint32(50).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseValue();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.nullValue=n.int32();continue;case 2:if(17!==e)break;a.numberValue=n.double();continue;case 3:if(26!==e)break;a.stringValue=n.string();continue;case 4:if(32!==e)break;a.boolValue=n.bool();continue;case 5:if(42!==e)break;a.structValue=Struct.unwrap(Struct.decode(n,n.uint32()));continue;case 6:if(50!==e)break;a.listValue=ListValue.unwrap(ListValue.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({nullValue:isSet(e.nullValue)?nullValueFromJSON(e.nullValue):void 0,numberValue:isSet(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:isSet(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:isSet(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:isObject(e.structValue)?e.structValue:void 0,listValue:globalThis.Array.isArray(e.listValue)?[...e.listValue]:void 0}),toJSON(e){const t={};return void 0!==e.nullValue&&(t.nullValue=nullValueToJSON(e.nullValue)),void 0!==e.numberValue&&(t.numberValue=e.numberValue),void 0!==e.stringValue&&(t.stringValue=e.stringValue),void 0!==e.boolValue&&(t.boolValue=e.boolValue),void 0!==e.structValue&&(t.structValue=e.structValue),void 0!==e.listValue&&(t.listValue=e.listValue),t},create:e=>Value.fromPartial(e??{}),fromPartial(e){const t=createBaseValue();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){const t=createBaseValue();if(null===e)t.nullValue=0;else if("boolean"==typeof e)t.boolValue=e;else if("number"==typeof e)t.numberValue=e;else if("string"==typeof e)t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if("object"==typeof e)t.structValue=e;else if(void 0!==e)throw new globalThis.Error("Unsupported any value type: "+typeof e);return t},unwrap:e=>void 0!==e.stringValue?e.stringValue:void 0!==e?.numberValue?e.numberValue:void 0!==e?.boolValue?e.boolValue:void 0!==e?.structValue?e.structValue:void 0!==e?.listValue?e.listValue:void 0!==e?.nullValue?null:void 0};function createBaseListValue(){return{values:[]}}var ListValue={encode(e,t=new BinaryWriter){for(const n of e.values)Value.encode(Value.wrap(n),t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseListValue();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.values.push(Value.unwrap(Value.decode(n,n.uint32())));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({values:globalThis.Array.isArray(e?.values)?[...e.values]:[]}),toJSON(e){const t={};return e.values?.length&&(t.values=e.values),t},create:e=>ListValue.fromPartial(e??{}),fromPartial(e){const t=createBaseListValue();return t.values=e.values?.map((e=>e))||[],t},wrap(e){const t=createBaseListValue();return t.values=e??[],t},unwrap:e=>e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e};function isObject(e){return"object"==typeof e&&null!==e}function isSet(e){return null!=e}function createBaseTimestamp(){return{seconds:0,nanos:0}}var Timestamp={encode:(e,t=new BinaryWriter)=>(0!==e.seconds&&t.uint32(8).int64(e.seconds),0!==e.nanos&&t.uint32(16).int32(e.nanos),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTimestamp();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.seconds=longToNumber(n.int64());continue;case 2:if(16!==e)break;a.nanos=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({seconds:isSet2(e.seconds)?globalThis.Number(e.seconds):0,nanos:isSet2(e.nanos)?globalThis.Number(e.nanos):0}),toJSON(e){const t={};return 0!==e.seconds&&(t.seconds=Math.round(e.seconds)),0!==e.nanos&&(t.nanos=Math.round(e.nanos)),t},create:e=>Timestamp.fromPartial(e??{}),fromPartial(e){const t=createBaseTimestamp();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};function longToNumber(e){const t=globalThis.Number(e.toString());if(t>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<globalThis.Number.MIN_SAFE_INTEGER)throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}function isSet2(e){return null!=e}function createBaseStringValue(){return{value:""}}var StringValue={encode:(e,t=new BinaryWriter)=>(""!==e.value&&t.uint32(10).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseStringValue();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({value:isSet3(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.value&&(t.value=e.value),t},create:e=>StringValue.fromPartial(e??{}),fromPartial(e){const t=createBaseStringValue();return t.value=e.value??"",t}};function isSet3(e){return null!=e}function appDeployVisibilityFromJSON(e){switch(e){case 0:case"APP_DEPLOY_VISIBILITY_UNSPECIFIED":return 0;case 1:case"APP_DEPLOY_VISIBILITY_WORKSPACE":return 1;case 2:case"APP_DEPLOY_VISIBILITY_PUBLIC":return 2;default:return-1}}function appDeployVisibilityToJSON(e){switch(e){case 0:return"APP_DEPLOY_VISIBILITY_UNSPECIFIED";case 1:return"APP_DEPLOY_VISIBILITY_WORKSPACE";case 2:return"APP_DEPLOY_VISIBILITY_PUBLIC";default:return"UNRECOGNIZED"}}function appDisconnectReasonFromJSON(e){switch(e){case 0:case"APP_DISCONNECT_REASON_UNSPECIFIED":return 0;case 1:case"APP_DISCONNECT_REASON_LOCAL_EXCEPTION":return 1;case 2:case"APP_DISCONNECT_REASON_KEYBOARD_INTERRUPT":return 2;case 3:case"APP_DISCONNECT_REASON_ENTRYPOINT_COMPLETED":return 3;case 4:case"APP_DISCONNECT_REASON_DEPLOYMENT_EXCEPTION":return 4;case 5:case"APP_DISCONNECT_REASON_REMOTE_EXCEPTION":return 5;default:return-1}}function appDisconnectReasonToJSON(e){switch(e){case 0:return"APP_DISCONNECT_REASON_UNSPECIFIED";case 1:return"APP_DISCONNECT_REASON_LOCAL_EXCEPTION";case 2:return"APP_DISCONNECT_REASON_KEYBOARD_INTERRUPT";case 3:return"APP_DISCONNECT_REASON_ENTRYPOINT_COMPLETED";case 4:return"APP_DISCONNECT_REASON_DEPLOYMENT_EXCEPTION";case 5:return"APP_DISCONNECT_REASON_REMOTE_EXCEPTION";default:return"UNRECOGNIZED"}}function appStateFromJSON(e){switch(e){case 0:case"APP_STATE_UNSPECIFIED":return 0;case 1:case"APP_STATE_EPHEMERAL":return 1;case 2:case"APP_STATE_DETACHED":return 2;case 3:case"APP_STATE_DEPLOYED":return 3;case 4:case"APP_STATE_STOPPING":return 4;case 5:case"APP_STATE_STOPPED":return 5;case 6:case"APP_STATE_INITIALIZING":return 6;case 7:case"APP_STATE_DISABLED":return 7;case 8:case"APP_STATE_DETACHED_DISCONNECTED":return 8;case 9:case"APP_STATE_DERIVED":return 9;default:return-1}}function appStateToJSON(e){switch(e){case 0:return"APP_STATE_UNSPECIFIED";case 1:return"APP_STATE_EPHEMERAL";case 2:return"APP_STATE_DETACHED";case 3:return"APP_STATE_DEPLOYED";case 4:return"APP_STATE_STOPPING";case 5:return"APP_STATE_STOPPED";case 6:return"APP_STATE_INITIALIZING";case 7:return"APP_STATE_DISABLED";case 8:return"APP_STATE_DETACHED_DISCONNECTED";case 9:return"APP_STATE_DERIVED";default:return"UNRECOGNIZED"}}function appStopSourceFromJSON(e){switch(e){case 0:case"APP_STOP_SOURCE_UNSPECIFIED":return 0;case 1:case"APP_STOP_SOURCE_CLI":return 1;case 2:case"APP_STOP_SOURCE_PYTHON_CLIENT":return 2;case 3:case"APP_STOP_SOURCE_WEB":return 3;default:return-1}}function appStopSourceToJSON(e){switch(e){case 0:return"APP_STOP_SOURCE_UNSPECIFIED";case 1:return"APP_STOP_SOURCE_CLI";case 2:return"APP_STOP_SOURCE_PYTHON_CLIENT";case 3:return"APP_STOP_SOURCE_WEB";default:return"UNRECOGNIZED"}}function certificateStatusFromJSON(e){switch(e){case 0:case"CERTIFICATE_STATUS_PENDING":return 0;case 1:case"CERTIFICATE_STATUS_ISSUED":return 1;case 2:case"CERTIFICATE_STATUS_FAILED":return 2;case 3:case"CERTIFICATE_STATUS_REVOKED":return 3;default:return-1}}function certificateStatusToJSON(e){switch(e){case 0:return"CERTIFICATE_STATUS_PENDING";case 1:return"CERTIFICATE_STATUS_ISSUED";case 2:return"CERTIFICATE_STATUS_FAILED";case 3:return"CERTIFICATE_STATUS_REVOKED";default:return"UNRECOGNIZED"}}function checkpointStatusFromJSON(e){switch(e){case 0:case"CHECKPOINT_STATUS_UNSPECIFIED":return 0;case 1:case"CHECKPOINT_STATUS_PENDING":return 1;case 2:case"CHECKPOINT_STATUS_PROCESSING":return 2;case 3:case"CHECKPOINT_STATUS_READY":return 3;case 4:case"CHECKPOINT_STATUS_FAILED":return 4;default:return-1}}function checkpointStatusToJSON(e){switch(e){case 0:return"CHECKPOINT_STATUS_UNSPECIFIED";case 1:return"CHECKPOINT_STATUS_PENDING";case 2:return"CHECKPOINT_STATUS_PROCESSING";case 3:return"CHECKPOINT_STATUS_READY";case 4:return"CHECKPOINT_STATUS_FAILED";default:return"UNRECOGNIZED"}}function cloudProviderFromJSON(e){switch(e){case 0:case"CLOUD_PROVIDER_UNSPECIFIED":return 0;case 1:case"CLOUD_PROVIDER_AWS":return 1;case 2:case"CLOUD_PROVIDER_GCP":return 2;case 3:case"CLOUD_PROVIDER_AUTO":return 3;case 4:case"CLOUD_PROVIDER_OCI":return 4;default:return-1}}function cloudProviderToJSON(e){switch(e){case 0:return"CLOUD_PROVIDER_UNSPECIFIED";case 1:return"CLOUD_PROVIDER_AWS";case 2:return"CLOUD_PROVIDER_GCP";case 3:return"CLOUD_PROVIDER_AUTO";case 4:return"CLOUD_PROVIDER_OCI";default:return"UNRECOGNIZED"}}function dNSRecordTypeFromJSON(e){switch(e){case 0:case"DNS_RECORD_TYPE_A":return 0;case 1:case"DNS_RECORD_TYPE_TXT":return 1;case 2:case"DNS_RECORD_TYPE_CNAME":return 2;default:return-1}}function dNSRecordTypeToJSON(e){switch(e){case 0:return"DNS_RECORD_TYPE_A";case 1:return"DNS_RECORD_TYPE_TXT";case 2:return"DNS_RECORD_TYPE_CNAME";default:return"UNRECOGNIZED"}}function dataFormatFromJSON(e){switch(e){case 0:case"DATA_FORMAT_UNSPECIFIED":return 0;case 1:case"DATA_FORMAT_PICKLE":return 1;case 2:case"DATA_FORMAT_ASGI":return 2;case 3:case"DATA_FORMAT_GENERATOR_DONE":return 3;case 4:case"DATA_FORMAT_CBOR":return 4;default:return-1}}function dataFormatToJSON(e){switch(e){case 0:return"DATA_FORMAT_UNSPECIFIED";case 1:return"DATA_FORMAT_PICKLE";case 2:return"DATA_FORMAT_ASGI";case 3:return"DATA_FORMAT_GENERATOR_DONE";case 4:return"DATA_FORMAT_CBOR";default:return"UNRECOGNIZED"}}function deploymentNamespaceFromJSON(e){switch(e){case 0:case"DEPLOYMENT_NAMESPACE_UNSPECIFIED":return 0;case 1:case"DEPLOYMENT_NAMESPACE_WORKSPACE":return 1;case 3:case"DEPLOYMENT_NAMESPACE_GLOBAL":return 3;default:return-1}}function deploymentNamespaceToJSON(e){switch(e){case 0:return"DEPLOYMENT_NAMESPACE_UNSPECIFIED";case 1:return"DEPLOYMENT_NAMESPACE_WORKSPACE";case 3:return"DEPLOYMENT_NAMESPACE_GLOBAL";default:return"UNRECOGNIZED"}}function execOutputOptionFromJSON(e){switch(e){case 0:case"EXEC_OUTPUT_OPTION_UNSPECIFIED":return 0;case 1:case"EXEC_OUTPUT_OPTION_DEVNULL":return 1;case 2:case"EXEC_OUTPUT_OPTION_PIPE":return 2;case 3:case"EXEC_OUTPUT_OPTION_STDOUT":return 3;default:return-1}}function execOutputOptionToJSON(e){switch(e){case 0:return"EXEC_OUTPUT_OPTION_UNSPECIFIED";case 1:return"EXEC_OUTPUT_OPTION_DEVNULL";case 2:return"EXEC_OUTPUT_OPTION_PIPE";case 3:return"EXEC_OUTPUT_OPTION_STDOUT";default:return"UNRECOGNIZED"}}function fileDescriptorFromJSON(e){switch(e){case 0:case"FILE_DESCRIPTOR_UNSPECIFIED":return 0;case 1:case"FILE_DESCRIPTOR_STDOUT":return 1;case 2:case"FILE_DESCRIPTOR_STDERR":return 2;case 3:case"FILE_DESCRIPTOR_INFO":return 3;default:return-1}}function fileDescriptorToJSON(e){switch(e){case 0:return"FILE_DESCRIPTOR_UNSPECIFIED";case 1:return"FILE_DESCRIPTOR_STDOUT";case 2:return"FILE_DESCRIPTOR_STDERR";case 3:return"FILE_DESCRIPTOR_INFO";default:return"UNRECOGNIZED"}}function functionCallInvocationTypeFromJSON(e){switch(e){case 0:case"FUNCTION_CALL_INVOCATION_TYPE_UNSPECIFIED":return 0;case 1:case"FUNCTION_CALL_INVOCATION_TYPE_SYNC_LEGACY":return 1;case 2:case"FUNCTION_CALL_INVOCATION_TYPE_ASYNC_LEGACY":return 2;case 3:case"FUNCTION_CALL_INVOCATION_TYPE_ASYNC":return 3;case 4:case"FUNCTION_CALL_INVOCATION_TYPE_SYNC":return 4;default:return-1}}function functionCallInvocationTypeToJSON(e){switch(e){case 0:return"FUNCTION_CALL_INVOCATION_TYPE_UNSPECIFIED";case 1:return"FUNCTION_CALL_INVOCATION_TYPE_SYNC_LEGACY";case 2:return"FUNCTION_CALL_INVOCATION_TYPE_ASYNC_LEGACY";case 3:return"FUNCTION_CALL_INVOCATION_TYPE_ASYNC";case 4:return"FUNCTION_CALL_INVOCATION_TYPE_SYNC";default:return"UNRECOGNIZED"}}function functionCallTypeFromJSON(e){switch(e){case 0:case"FUNCTION_CALL_TYPE_UNSPECIFIED":return 0;case 1:case"FUNCTION_CALL_TYPE_UNARY":return 1;case 2:case"FUNCTION_CALL_TYPE_MAP":return 2;default:return-1}}function functionCallTypeToJSON(e){switch(e){case 0:return"FUNCTION_CALL_TYPE_UNSPECIFIED";case 1:return"FUNCTION_CALL_TYPE_UNARY";case 2:return"FUNCTION_CALL_TYPE_MAP";default:return"UNRECOGNIZED"}}function gPUTypeFromJSON(e){switch(e){case 0:case"GPU_TYPE_UNSPECIFIED":return 0;case 1:case"GPU_TYPE_T4":return 1;case 2:case"GPU_TYPE_A100":return 2;case 3:case"GPU_TYPE_A10G":return 3;case 4:case"GPU_TYPE_ANY":return 4;case 8:case"GPU_TYPE_A100_80GB":return 8;case 9:case"GPU_TYPE_L4":return 9;case 10:case"GPU_TYPE_H100":return 10;case 11:case"GPU_TYPE_L40S":return 11;case 12:case"GPU_TYPE_H200":return 12;default:return-1}}function gPUTypeToJSON(e){switch(e){case 0:return"GPU_TYPE_UNSPECIFIED";case 1:return"GPU_TYPE_T4";case 2:return"GPU_TYPE_A100";case 3:return"GPU_TYPE_A10G";case 4:return"GPU_TYPE_ANY";case 8:return"GPU_TYPE_A100_80GB";case 9:return"GPU_TYPE_L4";case 10:return"GPU_TYPE_H100";case 11:return"GPU_TYPE_L40S";case 12:return"GPU_TYPE_H200";default:return"UNRECOGNIZED"}}function objectCreationTypeFromJSON(e){switch(e){case 0:case"OBJECT_CREATION_TYPE_UNSPECIFIED":return 0;case 1:case"OBJECT_CREATION_TYPE_CREATE_IF_MISSING":return 1;case 2:case"OBJECT_CREATION_TYPE_CREATE_FAIL_IF_EXISTS":return 2;case 3:case"OBJECT_CREATION_TYPE_CREATE_OVERWRITE_IF_EXISTS":return 3;case 4:case"OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP":return 4;case 5:case"OBJECT_CREATION_TYPE_EPHEMERAL":return 5;default:return-1}}function objectCreationTypeToJSON(e){switch(e){case 0:return"OBJECT_CREATION_TYPE_UNSPECIFIED";case 1:return"OBJECT_CREATION_TYPE_CREATE_IF_MISSING";case 2:return"OBJECT_CREATION_TYPE_CREATE_FAIL_IF_EXISTS";case 3:return"OBJECT_CREATION_TYPE_CREATE_OVERWRITE_IF_EXISTS";case 4:return"OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP";case 5:return"OBJECT_CREATION_TYPE_EPHEMERAL";default:return"UNRECOGNIZED"}}function parameterTypeFromJSON(e){switch(e){case 0:case"PARAM_TYPE_UNSPECIFIED":return 0;case 1:case"PARAM_TYPE_STRING":return 1;case 2:case"PARAM_TYPE_INT":return 2;case 3:case"PARAM_TYPE_PICKLE":return 3;case 4:case"PARAM_TYPE_BYTES":return 4;case 5:case"PARAM_TYPE_UNKNOWN":return 5;case 6:case"PARAM_TYPE_LIST":return 6;case 7:case"PARAM_TYPE_DICT":return 7;case 8:case"PARAM_TYPE_NONE":return 8;case 9:case"PARAM_TYPE_BOOL":return 9;default:return-1}}function parameterTypeToJSON(e){switch(e){case 0:return"PARAM_TYPE_UNSPECIFIED";case 1:return"PARAM_TYPE_STRING";case 2:return"PARAM_TYPE_INT";case 3:return"PARAM_TYPE_PICKLE";case 4:return"PARAM_TYPE_BYTES";case 5:return"PARAM_TYPE_UNKNOWN";case 6:return"PARAM_TYPE_LIST";case 7:return"PARAM_TYPE_DICT";case 8:return"PARAM_TYPE_NONE";case 9:return"PARAM_TYPE_BOOL";default:return"UNRECOGNIZED"}}function progressTypeFromJSON(e){switch(e){case 0:case"IMAGE_SNAPSHOT_UPLOAD":return 0;case 1:case"FUNCTION_QUEUED":return 1;default:return-1}}function progressTypeToJSON(e){switch(e){case 0:return"IMAGE_SNAPSHOT_UPLOAD";case 1:return"FUNCTION_QUEUED";default:return"UNRECOGNIZED"}}function proxyIpStatusFromJSON(e){switch(e){case 0:case"PROXY_IP_STATUS_UNSPECIFIED":return 0;case 1:case"PROXY_IP_STATUS_CREATING":return 1;case 2:case"PROXY_IP_STATUS_ONLINE":return 2;case 3:case"PROXY_IP_STATUS_TERMINATED":return 3;case 4:case"PROXY_IP_STATUS_UNHEALTHY":return 4;default:return-1}}function proxyIpStatusToJSON(e){switch(e){case 0:return"PROXY_IP_STATUS_UNSPECIFIED";case 1:return"PROXY_IP_STATUS_CREATING";case 2:return"PROXY_IP_STATUS_ONLINE";case 3:return"PROXY_IP_STATUS_TERMINATED";case 4:return"PROXY_IP_STATUS_UNHEALTHY";default:return"UNRECOGNIZED"}}function rateLimitIntervalFromJSON(e){switch(e){case 0:case"RATE_LIMIT_INTERVAL_UNSPECIFIED":return 0;case 1:case"RATE_LIMIT_INTERVAL_SECOND":return 1;case 2:case"RATE_LIMIT_INTERVAL_MINUTE":return 2;default:return-1}}function rateLimitIntervalToJSON(e){switch(e){case 0:return"RATE_LIMIT_INTERVAL_UNSPECIFIED";case 1:return"RATE_LIMIT_INTERVAL_SECOND";case 2:return"RATE_LIMIT_INTERVAL_MINUTE";default:return"UNRECOGNIZED"}}function registryAuthTypeFromJSON(e){switch(e){case 0:case"REGISTRY_AUTH_TYPE_UNSPECIFIED":return 0;case 1:case"REGISTRY_AUTH_TYPE_AWS":return 1;case 2:case"REGISTRY_AUTH_TYPE_GCP":return 2;case 3:case"REGISTRY_AUTH_TYPE_PUBLIC":return 3;case 4:case"REGISTRY_AUTH_TYPE_STATIC_CREDS":return 4;default:return-1}}function registryAuthTypeToJSON(e){switch(e){case 0:return"REGISTRY_AUTH_TYPE_UNSPECIFIED";case 1:return"REGISTRY_AUTH_TYPE_AWS";case 2:return"REGISTRY_AUTH_TYPE_GCP";case 3:return"REGISTRY_AUTH_TYPE_PUBLIC";case 4:return"REGISTRY_AUTH_TYPE_STATIC_CREDS";default:return"UNRECOGNIZED"}}function seekWhenceFromJSON(e){switch(e){case 0:case"SEEK_SET":return 0;case 1:case"SEEK_CUR":return 1;case 2:case"SEEK_END":return 2;default:return-1}}function seekWhenceToJSON(e){switch(e){case 0:return"SEEK_SET";case 1:return"SEEK_CUR";case 2:return"SEEK_END";default:return"UNRECOGNIZED"}}function systemErrorCodeFromJSON(e){switch(e){case 0:case"SYSTEM_ERROR_CODE_UNSPECIFIED":return 0;case 1:case"SYSTEM_ERROR_CODE_PERM":return 1;case 2:case"SYSTEM_ERROR_CODE_NOENT":return 2;case 5:case"SYSTEM_ERROR_CODE_IO":return 5;case 6:case"SYSTEM_ERROR_CODE_NXIO":return 6;case 12:case"SYSTEM_ERROR_CODE_NOMEM":return 12;case 13:case"SYSTEM_ERROR_CODE_ACCES":return 13;case 17:case"SYSTEM_ERROR_CODE_EXIST":return 17;case 20:case"SYSTEM_ERROR_CODE_NOTDIR":return 20;case 21:case"SYSTEM_ERROR_CODE_ISDIR":return 21;case 22:case"SYSTEM_ERROR_CODE_INVAL":return 22;case 24:case"SYSTEM_ERROR_CODE_MFILE":return 24;case 27:case"SYSTEM_ERROR_CODE_FBIG":return 27;case 28:case"SYSTEM_ERROR_CODE_NOSPC":return 28;default:return-1}}function systemErrorCodeToJSON(e){switch(e){case 0:return"SYSTEM_ERROR_CODE_UNSPECIFIED";case 1:return"SYSTEM_ERROR_CODE_PERM";case 2:return"SYSTEM_ERROR_CODE_NOENT";case 5:return"SYSTEM_ERROR_CODE_IO";case 6:return"SYSTEM_ERROR_CODE_NXIO";case 12:return"SYSTEM_ERROR_CODE_NOMEM";case 13:return"SYSTEM_ERROR_CODE_ACCES";case 17:return"SYSTEM_ERROR_CODE_EXIST";case 20:return"SYSTEM_ERROR_CODE_NOTDIR";case 21:return"SYSTEM_ERROR_CODE_ISDIR";case 22:return"SYSTEM_ERROR_CODE_INVAL";case 24:return"SYSTEM_ERROR_CODE_MFILE";case 27:return"SYSTEM_ERROR_CODE_FBIG";case 28:return"SYSTEM_ERROR_CODE_NOSPC";default:return"UNRECOGNIZED"}}function taskSnapshotBehaviorFromJSON(e){switch(e){case 0:case"TASK_SNAPSHOT_BEHAVIOR_UNSPECIFIED":return 0;case 1:case"TASK_SNAPSHOT_BEHAVIOR_SNAPSHOT":return 1;case 2:case"TASK_SNAPSHOT_BEHAVIOR_RESTORE":return 2;case 3:case"TASK_SNAPSHOT_BEHAVIOR_NONE":return 3;default:return-1}}function taskSnapshotBehaviorToJSON(e){switch(e){case 0:return"TASK_SNAPSHOT_BEHAVIOR_UNSPECIFIED";case 1:return"TASK_SNAPSHOT_BEHAVIOR_SNAPSHOT";case 2:return"TASK_SNAPSHOT_BEHAVIOR_RESTORE";case 3:return"TASK_SNAPSHOT_BEHAVIOR_NONE";default:return"UNRECOGNIZED"}}function taskStateFromJSON(e){switch(e){case 0:case"TASK_STATE_UNSPECIFIED":return 0;case 6:case"TASK_STATE_CREATED":return 6;case 1:case"TASK_STATE_QUEUED":return 1;case 2:case"TASK_STATE_WORKER_ASSIGNED":return 2;case 3:case"TASK_STATE_LOADING_IMAGE":return 3;case 4:case"TASK_STATE_ACTIVE":return 4;case 5:case"TASK_STATE_COMPLETED":return 5;case 7:case"TASK_STATE_CREATING_CONTAINER":return 7;case 8:case"TASK_STATE_IDLE":return 8;case 9:case"TASK_STATE_PREEMPTIBLE":return 9;case 10:case"TASK_STATE_PREEMPTED":return 10;case 11:case"TASK_STATE_LOADING_CHECKPOINT_IMAGE":return 11;default:return-1}}function taskStateToJSON(e){switch(e){case 0:return"TASK_STATE_UNSPECIFIED";case 6:return"TASK_STATE_CREATED";case 1:return"TASK_STATE_QUEUED";case 2:return"TASK_STATE_WORKER_ASSIGNED";case 3:return"TASK_STATE_LOADING_IMAGE";case 4:return"TASK_STATE_ACTIVE";case 5:return"TASK_STATE_COMPLETED";case 7:return"TASK_STATE_CREATING_CONTAINER";case 8:return"TASK_STATE_IDLE";case 9:return"TASK_STATE_PREEMPTIBLE";case 10:return"TASK_STATE_PREEMPTED";case 11:return"TASK_STATE_LOADING_CHECKPOINT_IMAGE";default:return"UNRECOGNIZED"}}function tunnelTypeFromJSON(e){switch(e){case 0:case"TUNNEL_TYPE_UNSPECIFIED":return 0;case 1:case"TUNNEL_TYPE_H2":return 1;default:return-1}}function tunnelTypeToJSON(e){switch(e){case 0:return"TUNNEL_TYPE_UNSPECIFIED";case 1:return"TUNNEL_TYPE_H2";default:return"UNRECOGNIZED"}}function volumeFsVersionFromJSON(e){switch(e){case 0:case"VOLUME_FS_VERSION_UNSPECIFIED":return 0;case 1:case"VOLUME_FS_VERSION_V1":return 1;case 2:case"VOLUME_FS_VERSION_V2":return 2;default:return-1}}function volumeFsVersionToJSON(e){switch(e){case 0:return"VOLUME_FS_VERSION_UNSPECIFIED";case 1:return"VOLUME_FS_VERSION_V1";case 2:return"VOLUME_FS_VERSION_V2";default:return"UNRECOGNIZED"}}function webhookAsyncModeFromJSON(e){switch(e){case 0:case"WEBHOOK_ASYNC_MODE_UNSPECIFIED":return 0;case 2:case"WEBHOOK_ASYNC_MODE_DISABLED":return 2;case 3:case"WEBHOOK_ASYNC_MODE_TRIGGER":return 3;case 4:case"WEBHOOK_ASYNC_MODE_AUTO":return 4;default:return-1}}function webhookAsyncModeToJSON(e){switch(e){case 0:return"WEBHOOK_ASYNC_MODE_UNSPECIFIED";case 2:return"WEBHOOK_ASYNC_MODE_DISABLED";case 3:return"WEBHOOK_ASYNC_MODE_TRIGGER";case 4:return"WEBHOOK_ASYNC_MODE_AUTO";default:return"UNRECOGNIZED"}}function webhookTypeFromJSON(e){switch(e){case 0:case"WEBHOOK_TYPE_UNSPECIFIED":return 0;case 1:case"WEBHOOK_TYPE_ASGI_APP":return 1;case 2:case"WEBHOOK_TYPE_FUNCTION":return 2;case 3:case"WEBHOOK_TYPE_WSGI_APP":return 3;case 4:case"WEBHOOK_TYPE_WEB_SERVER":return 4;default:return-1}}function webhookTypeToJSON(e){switch(e){case 0:return"WEBHOOK_TYPE_UNSPECIFIED";case 1:return"WEBHOOK_TYPE_ASGI_APP";case 2:return"WEBHOOK_TYPE_FUNCTION";case 3:return"WEBHOOK_TYPE_WSGI_APP";case 4:return"WEBHOOK_TYPE_WEB_SERVER";default:return"UNRECOGNIZED"}}function classParameterInfo_ParameterSerializationFormatFromJSON(e){switch(e){case 0:case"PARAM_SERIALIZATION_FORMAT_UNSPECIFIED":return 0;case 1:case"PARAM_SERIALIZATION_FORMAT_PICKLE":return 1;case 2:case"PARAM_SERIALIZATION_FORMAT_PROTO":return 2;default:return-1}}function classParameterInfo_ParameterSerializationFormatToJSON(e){switch(e){case 0:return"PARAM_SERIALIZATION_FORMAT_UNSPECIFIED";case 1:return"PARAM_SERIALIZATION_FORMAT_PICKLE";case 2:return"PARAM_SERIALIZATION_FORMAT_PROTO";default:return"UNRECOGNIZED"}}function cloudBucketMount_BucketTypeFromJSON(e){switch(e){case 0:case"UNSPECIFIED":return 0;case 1:case"S3":return 1;case 2:case"R2":return 2;case 3:case"GCP":return 3;default:return-1}}function cloudBucketMount_BucketTypeToJSON(e){switch(e){case 0:return"UNSPECIFIED";case 1:return"S3";case 2:return"R2";case 3:return"GCP";default:return"UNRECOGNIZED"}}function cloudBucketMount_MetadataTTLTypeFromJSON(e){switch(e){case 0:case"METADATA_TTL_TYPE_UNSPECIFIED":return 0;case 1:case"METADATA_TTL_TYPE_MINIMAL":return 1;case 2:case"METADATA_TTL_TYPE_INDEFINITE":return 2;default:return-1}}function cloudBucketMount_MetadataTTLTypeToJSON(e){switch(e){case 0:return"METADATA_TTL_TYPE_UNSPECIFIED";case 1:return"METADATA_TTL_TYPE_MINIMAL";case 2:return"METADATA_TTL_TYPE_INDEFINITE";default:return"UNRECOGNIZED"}}function fileEntry_FileTypeFromJSON(e){switch(e){case 0:case"UNSPECIFIED":return 0;case 1:case"FILE":return 1;case 2:case"DIRECTORY":return 2;case 3:case"SYMLINK":return 3;case 4:case"FIFO":return 4;case 5:case"SOCKET":return 5;default:return-1}}function fileEntry_FileTypeToJSON(e){switch(e){case 0:return"UNSPECIFIED";case 1:return"FILE";case 2:return"DIRECTORY";case 3:return"SYMLINK";case 4:return"FIFO";case 5:return"SOCKET";default:return"UNRECOGNIZED"}}function function_DefinitionTypeFromJSON(e){switch(e){case 0:case"DEFINITION_TYPE_UNSPECIFIED":return 0;case 1:case"DEFINITION_TYPE_SERIALIZED":return 1;case 2:case"DEFINITION_TYPE_FILE":return 2;default:return-1}}function function_DefinitionTypeToJSON(e){switch(e){case 0:return"DEFINITION_TYPE_UNSPECIFIED";case 1:return"DEFINITION_TYPE_SERIALIZED";case 2:return"DEFINITION_TYPE_FILE";default:return"UNRECOGNIZED"}}function function_FunctionTypeFromJSON(e){switch(e){case 0:case"FUNCTION_TYPE_UNSPECIFIED":return 0;case 1:case"FUNCTION_TYPE_GENERATOR":return 1;case 2:case"FUNCTION_TYPE_FUNCTION":return 2;default:return-1}}function function_FunctionTypeToJSON(e){switch(e){case 0:return"FUNCTION_TYPE_UNSPECIFIED";case 1:return"FUNCTION_TYPE_GENERATOR";case 2:return"FUNCTION_TYPE_FUNCTION";default:return"UNRECOGNIZED"}}function functionSchema_FunctionSchemaTypeFromJSON(e){switch(e){case 0:case"FUNCTION_SCHEMA_UNSPECIFIED":return 0;case 1:case"FUNCTION_SCHEMA_V1":return 1;default:return-1}}function functionSchema_FunctionSchemaTypeToJSON(e){switch(e){case 0:return"FUNCTION_SCHEMA_UNSPECIFIED";case 1:return"FUNCTION_SCHEMA_V1";default:return"UNRECOGNIZED"}}function genericResult_GenericStatusFromJSON(e){switch(e){case 0:case"GENERIC_STATUS_UNSPECIFIED":return 0;case 1:case"GENERIC_STATUS_SUCCESS":return 1;case 2:case"GENERIC_STATUS_FAILURE":return 2;case 3:case"GENERIC_STATUS_TERMINATED":return 3;case 4:case"GENERIC_STATUS_TIMEOUT":return 4;case 5:case"GENERIC_STATUS_INIT_FAILURE":return 5;case 6:case"GENERIC_STATUS_INTERNAL_FAILURE":return 6;case 7:case"GENERIC_STATUS_IDLE_TIMEOUT":return 7;default:return-1}}function genericResult_GenericStatusToJSON(e){switch(e){case 0:return"GENERIC_STATUS_UNSPECIFIED";case 1:return"GENERIC_STATUS_SUCCESS";case 2:return"GENERIC_STATUS_FAILURE";case 3:return"GENERIC_STATUS_TERMINATED";case 4:return"GENERIC_STATUS_TIMEOUT";case 5:return"GENERIC_STATUS_INIT_FAILURE";case 6:return"GENERIC_STATUS_INTERNAL_FAILURE";case 7:return"GENERIC_STATUS_IDLE_TIMEOUT";default:return"UNRECOGNIZED"}}function networkAccess_NetworkAccessTypeFromJSON(e){switch(e){case 0:case"UNSPECIFIED":return 0;case 1:case"OPEN":return 1;case 2:case"BLOCKED":return 2;case 3:case"ALLOWLIST":return 3;default:return-1}}function networkAccess_NetworkAccessTypeToJSON(e){switch(e){case 0:return"UNSPECIFIED";case 1:return"OPEN";case 2:return"BLOCKED";case 3:return"ALLOWLIST";default:return"UNRECOGNIZED"}}function pTYInfo_PTYTypeFromJSON(e){switch(e){case 0:case"PTY_TYPE_UNSPECIFIED":return 0;case 1:case"PTY_TYPE_FUNCTION":return 1;case 2:case"PTY_TYPE_SHELL":return 2;default:return-1}}function pTYInfo_PTYTypeToJSON(e){switch(e){case 0:return"PTY_TYPE_UNSPECIFIED";case 1:return"PTY_TYPE_FUNCTION";case 2:return"PTY_TYPE_SHELL";default:return"UNRECOGNIZED"}}function sandboxRestoreRequest_SandboxNameOverrideTypeFromJSON(e){switch(e){case 0:case"SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED":return 0;case 1:case"SANDBOX_NAME_OVERRIDE_TYPE_NONE":return 1;case 2:case"SANDBOX_NAME_OVERRIDE_TYPE_STRING":return 2;default:return-1}}function sandboxRestoreRequest_SandboxNameOverrideTypeToJSON(e){switch(e){case 0:return"SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED";case 1:return"SANDBOX_NAME_OVERRIDE_TYPE_NONE";case 2:return"SANDBOX_NAME_OVERRIDE_TYPE_STRING";default:return"UNRECOGNIZED"}}function warning_WarningTypeFromJSON(e){switch(e){case 0:case"WARNING_TYPE_UNSPECIFIED":return 0;case 1:case"WARNING_TYPE_CLIENT_DEPRECATION":return 1;case 2:case"WARNING_TYPE_RESOURCE_LIMIT":return 2;case 3:case"WARNING_TYPE_FUNCTION_CONFIGURATION":return 3;default:return-1}}function warning_WarningTypeToJSON(e){switch(e){case 0:return"WARNING_TYPE_UNSPECIFIED";case 1:return"WARNING_TYPE_CLIENT_DEPRECATION";case 2:return"WARNING_TYPE_RESOURCE_LIMIT";case 3:return"WARNING_TYPE_FUNCTION_CONFIGURATION";default:return"UNRECOGNIZED"}}function createBaseAppClientDisconnectRequest(){return{appId:"",reason:0,exception:""}}var AppClientDisconnectRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),0!==e.reason&&t.uint32(16).int32(e.reason),""!==e.exception&&t.uint32(26).string(e.exception),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppClientDisconnectRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(16!==e)break;a.reason=n.int32();continue;case 3:if(26!==e)break;a.exception=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",reason:isSet4(e.reason)?appDisconnectReasonFromJSON(e.reason):0,exception:isSet4(e.exception)?globalThis.String(e.exception):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),0!==e.reason&&(t.reason=appDisconnectReasonToJSON(e.reason)),""!==e.exception&&(t.exception=e.exception),t},create:e=>AppClientDisconnectRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppClientDisconnectRequest();return t.appId=e.appId??"",t.reason=e.reason??0,t.exception=e.exception??"",t}};function createBaseAppCountLogsRequest(){return{appId:"",taskId:"",functionId:"",functionCallId:"",sandboxId:"",searchText:"",since:void 0,until:void 0,bucketSecs:0,source:0}}var AppCountLogsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),""!==e.taskId&&t.uint32(18).string(e.taskId),""!==e.functionId&&t.uint32(26).string(e.functionId),""!==e.functionCallId&&t.uint32(34).string(e.functionCallId),""!==e.sandboxId&&t.uint32(42).string(e.sandboxId),""!==e.searchText&&t.uint32(50).string(e.searchText),void 0!==e.since&&Timestamp.encode(toTimestamp(e.since),t.uint32(58).fork()).join(),void 0!==e.until&&Timestamp.encode(toTimestamp(e.until),t.uint32(66).fork()).join(),0!==e.bucketSecs&&t.uint32(72).uint32(e.bucketSecs),0!==e.source&&t.uint32(80).int32(e.source),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppCountLogsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(18!==e)break;a.taskId=n.string();continue;case 3:if(26!==e)break;a.functionId=n.string();continue;case 4:if(34!==e)break;a.functionCallId=n.string();continue;case 5:if(42!==e)break;a.sandboxId=n.string();continue;case 6:if(50!==e)break;a.searchText=n.string();continue;case 7:if(58!==e)break;a.since=fromTimestamp(Timestamp.decode(n,n.uint32()));continue;case 8:if(66!==e)break;a.until=fromTimestamp(Timestamp.decode(n,n.uint32()));continue;case 9:if(72!==e)break;a.bucketSecs=n.uint32();continue;case 10:if(80!==e)break;a.source=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",taskId:isSet4(e.taskId)?globalThis.String(e.taskId):"",functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",searchText:isSet4(e.searchText)?globalThis.String(e.searchText):"",since:isSet4(e.since)?fromJsonTimestamp(e.since):void 0,until:isSet4(e.until)?fromJsonTimestamp(e.until):void 0,bucketSecs:isSet4(e.bucketSecs)?globalThis.Number(e.bucketSecs):0,source:isSet4(e.source)?fileDescriptorFromJSON(e.source):0}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),""!==e.taskId&&(t.taskId=e.taskId),""!==e.functionId&&(t.functionId=e.functionId),""!==e.functionCallId&&(t.functionCallId=e.functionCallId),""!==e.sandboxId&&(t.sandboxId=e.sandboxId),""!==e.searchText&&(t.searchText=e.searchText),void 0!==e.since&&(t.since=e.since.toISOString()),void 0!==e.until&&(t.until=e.until.toISOString()),0!==e.bucketSecs&&(t.bucketSecs=Math.round(e.bucketSecs)),0!==e.source&&(t.source=fileDescriptorToJSON(e.source)),t},create:e=>AppCountLogsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppCountLogsRequest();return t.appId=e.appId??"",t.taskId=e.taskId??"",t.functionId=e.functionId??"",t.functionCallId=e.functionCallId??"",t.sandboxId=e.sandboxId??"",t.searchText=e.searchText??"",t.since=e.since??void 0,t.until=e.until??void 0,t.bucketSecs=e.bucketSecs??0,t.source=e.source??0,t}};function createBaseAppCountLogsResponse(){return{appId:"",buckets:[]}}var AppCountLogsResponse={encode(e,t=new BinaryWriter){""!==e.appId&&t.uint32(10).string(e.appId);for(const n of e.buckets)AppCountLogsResponse_LogBucket.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppCountLogsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(18!==e)break;a.buckets.push(AppCountLogsResponse_LogBucket.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",buckets:globalThis.Array.isArray(e?.buckets)?e.buckets.map((e=>AppCountLogsResponse_LogBucket.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),e.buckets?.length&&(t.buckets=e.buckets.map((e=>AppCountLogsResponse_LogBucket.toJSON(e)))),t},create:e=>AppCountLogsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppCountLogsResponse();return t.appId=e.appId??"",t.buckets=e.buckets?.map((e=>AppCountLogsResponse_LogBucket.fromPartial(e)))||[],t}};function createBaseAppCountLogsResponse_LogBucket(){return{bucketStartAt:void 0,stdoutLogs:0,stderrLogs:0,systemLogs:0}}var AppCountLogsResponse_LogBucket={encode:(e,t=new BinaryWriter)=>(void 0!==e.bucketStartAt&&Timestamp.encode(toTimestamp(e.bucketStartAt),t.uint32(10).fork()).join(),0!==e.stdoutLogs&&t.uint32(16).uint64(e.stdoutLogs),0!==e.stderrLogs&&t.uint32(24).uint64(e.stderrLogs),0!==e.systemLogs&&t.uint32(32).uint64(e.systemLogs),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppCountLogsResponse_LogBucket();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.bucketStartAt=fromTimestamp(Timestamp.decode(n,n.uint32()));continue;case 2:if(16!==e)break;a.stdoutLogs=longToNumber2(n.uint64());continue;case 3:if(24!==e)break;a.stderrLogs=longToNumber2(n.uint64());continue;case 4:if(32!==e)break;a.systemLogs=longToNumber2(n.uint64());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({bucketStartAt:isSet4(e.bucketStartAt)?fromJsonTimestamp(e.bucketStartAt):void 0,stdoutLogs:isSet4(e.stdoutLogs)?globalThis.Number(e.stdoutLogs):0,stderrLogs:isSet4(e.stderrLogs)?globalThis.Number(e.stderrLogs):0,systemLogs:isSet4(e.systemLogs)?globalThis.Number(e.systemLogs):0}),toJSON(e){const t={};return void 0!==e.bucketStartAt&&(t.bucketStartAt=e.bucketStartAt.toISOString()),0!==e.stdoutLogs&&(t.stdoutLogs=Math.round(e.stdoutLogs)),0!==e.stderrLogs&&(t.stderrLogs=Math.round(e.stderrLogs)),0!==e.systemLogs&&(t.systemLogs=Math.round(e.systemLogs)),t},create:e=>AppCountLogsResponse_LogBucket.fromPartial(e??{}),fromPartial(e){const t=createBaseAppCountLogsResponse_LogBucket();return t.bucketStartAt=e.bucketStartAt??void 0,t.stdoutLogs=e.stdoutLogs??0,t.stderrLogs=e.stderrLogs??0,t.systemLogs=e.systemLogs??0,t}};function createBaseAppCreateRequest(){return{clientId:"",description:"",environmentName:"",appState:0,tags:{}}}var AppCreateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.clientId&&t.uint32(10).string(e.clientId),""!==e.description&&t.uint32(18).string(e.description),""!==e.environmentName&&t.uint32(42).string(e.environmentName),0!==e.appState&&t.uint32(48).int32(e.appState),Object.entries(e.tags).forEach((([e,n])=>{AppCreateRequest_TagsEntry.encode({key:e,value:n},t.uint32(58).fork()).join()})),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.clientId=n.string();continue;case 2:if(18!==e)break;a.description=n.string();continue;case 5:if(42!==e)break;a.environmentName=n.string();continue;case 6:if(48!==e)break;a.appState=n.int32();continue;case 7:{if(58!==e)break;const t=AppCreateRequest_TagsEntry.decode(n,n.uint32());void 0!==t.value&&(a.tags[t.key]=t.value);continue}}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({clientId:isSet4(e.clientId)?globalThis.String(e.clientId):"",description:isSet4(e.description)?globalThis.String(e.description):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",appState:isSet4(e.appState)?appStateFromJSON(e.appState):0,tags:isObject2(e.tags)?Object.entries(e.tags).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{}}),toJSON(e){const t={};if(""!==e.clientId&&(t.clientId=e.clientId),""!==e.description&&(t.description=e.description),""!==e.environmentName&&(t.environmentName=e.environmentName),0!==e.appState&&(t.appState=appStateToJSON(e.appState)),e.tags){const n=Object.entries(e.tags);n.length>0&&(t.tags={},n.forEach((([e,n])=>{t.tags[e]=n})))}return t},create:e=>AppCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppCreateRequest();return t.clientId=e.clientId??"",t.description=e.description??"",t.environmentName=e.environmentName??"",t.appState=e.appState??0,t.tags=Object.entries(e.tags??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t}};function createBaseAppCreateRequest_TagsEntry(){return{key:"",value:""}}var AppCreateRequest_TagsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppCreateRequest_TagsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>AppCreateRequest_TagsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseAppCreateRequest_TagsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseAppCreateResponse(){return{appId:"",appPageUrl:"",appLogsUrl:""}}var AppCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),""!==e.appPageUrl&&t.uint32(18).string(e.appPageUrl),""!==e.appLogsUrl&&t.uint32(26).string(e.appLogsUrl),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(18!==e)break;a.appPageUrl=n.string();continue;case 3:if(26!==e)break;a.appLogsUrl=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",appPageUrl:isSet4(e.appPageUrl)?globalThis.String(e.appPageUrl):"",appLogsUrl:isSet4(e.appLogsUrl)?globalThis.String(e.appLogsUrl):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),""!==e.appPageUrl&&(t.appPageUrl=e.appPageUrl),""!==e.appLogsUrl&&(t.appLogsUrl=e.appLogsUrl),t},create:e=>AppCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppCreateResponse();return t.appId=e.appId??"",t.appPageUrl=e.appPageUrl??"",t.appLogsUrl=e.appLogsUrl??"",t}};function createBaseAppDeployRequest(){return{appId:"",name:"",objectEntity:"",visibility:0,tag:""}}var AppDeployRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),""!==e.name&&t.uint32(26).string(e.name),""!==e.objectEntity&&t.uint32(34).string(e.objectEntity),0!==e.visibility&&t.uint32(40).int32(e.visibility),""!==e.tag&&t.uint32(50).string(e.tag),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppDeployRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 3:if(26!==e)break;a.name=n.string();continue;case 4:if(34!==e)break;a.objectEntity=n.string();continue;case 5:if(40!==e)break;a.visibility=n.int32();continue;case 6:if(50!==e)break;a.tag=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",name:isSet4(e.name)?globalThis.String(e.name):"",objectEntity:isSet4(e.objectEntity)?globalThis.String(e.objectEntity):"",visibility:isSet4(e.visibility)?appDeployVisibilityFromJSON(e.visibility):0,tag:isSet4(e.tag)?globalThis.String(e.tag):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),""!==e.name&&(t.name=e.name),""!==e.objectEntity&&(t.objectEntity=e.objectEntity),0!==e.visibility&&(t.visibility=appDeployVisibilityToJSON(e.visibility)),""!==e.tag&&(t.tag=e.tag),t},create:e=>AppDeployRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppDeployRequest();return t.appId=e.appId??"",t.name=e.name??"",t.objectEntity=e.objectEntity??"",t.visibility=e.visibility??0,t.tag=e.tag??"",t}};function createBaseAppDeployResponse(){return{url:""}}var AppDeployResponse={encode:(e,t=new BinaryWriter)=>(""!==e.url&&t.uint32(10).string(e.url),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppDeployResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.url=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({url:isSet4(e.url)?globalThis.String(e.url):""}),toJSON(e){const t={};return""!==e.url&&(t.url=e.url),t},create:e=>AppDeployResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppDeployResponse();return t.url=e.url??"",t}};function createBaseAppDeploymentHistory(){return{appId:"",version:0,clientVersion:"",deployedAt:0,deployedBy:"",deployedByAvatarUrl:"",tag:"",rollbackVersion:0,rollbackAllowed:!1,commitInfo:void 0}}var AppDeploymentHistory={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),0!==e.version&&t.uint32(16).uint32(e.version),""!==e.clientVersion&&t.uint32(26).string(e.clientVersion),0!==e.deployedAt&&t.uint32(33).double(e.deployedAt),""!==e.deployedBy&&t.uint32(42).string(e.deployedBy),""!==e.deployedByAvatarUrl&&t.uint32(74).string(e.deployedByAvatarUrl),""!==e.tag&&t.uint32(50).string(e.tag),0!==e.rollbackVersion&&t.uint32(56).uint32(e.rollbackVersion),!1!==e.rollbackAllowed&&t.uint32(64).bool(e.rollbackAllowed),void 0!==e.commitInfo&&CommitInfo.encode(e.commitInfo,t.uint32(82).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppDeploymentHistory();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(16!==e)break;a.version=n.uint32();continue;case 3:if(26!==e)break;a.clientVersion=n.string();continue;case 4:if(33!==e)break;a.deployedAt=n.double();continue;case 5:if(42!==e)break;a.deployedBy=n.string();continue;case 9:if(74!==e)break;a.deployedByAvatarUrl=n.string();continue;case 6:if(50!==e)break;a.tag=n.string();continue;case 7:if(56!==e)break;a.rollbackVersion=n.uint32();continue;case 8:if(64!==e)break;a.rollbackAllowed=n.bool();continue;case 10:if(82!==e)break;a.commitInfo=CommitInfo.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",version:isSet4(e.version)?globalThis.Number(e.version):0,clientVersion:isSet4(e.clientVersion)?globalThis.String(e.clientVersion):"",deployedAt:isSet4(e.deployedAt)?globalThis.Number(e.deployedAt):0,deployedBy:isSet4(e.deployedBy)?globalThis.String(e.deployedBy):"",deployedByAvatarUrl:isSet4(e.deployedByAvatarUrl)?globalThis.String(e.deployedByAvatarUrl):"",tag:isSet4(e.tag)?globalThis.String(e.tag):"",rollbackVersion:isSet4(e.rollbackVersion)?globalThis.Number(e.rollbackVersion):0,rollbackAllowed:!!isSet4(e.rollbackAllowed)&&globalThis.Boolean(e.rollbackAllowed),commitInfo:isSet4(e.commitInfo)?CommitInfo.fromJSON(e.commitInfo):void 0}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),0!==e.version&&(t.version=Math.round(e.version)),""!==e.clientVersion&&(t.clientVersion=e.clientVersion),0!==e.deployedAt&&(t.deployedAt=e.deployedAt),""!==e.deployedBy&&(t.deployedBy=e.deployedBy),""!==e.deployedByAvatarUrl&&(t.deployedByAvatarUrl=e.deployedByAvatarUrl),""!==e.tag&&(t.tag=e.tag),0!==e.rollbackVersion&&(t.rollbackVersion=Math.round(e.rollbackVersion)),!1!==e.rollbackAllowed&&(t.rollbackAllowed=e.rollbackAllowed),void 0!==e.commitInfo&&(t.commitInfo=CommitInfo.toJSON(e.commitInfo)),t},create:e=>AppDeploymentHistory.fromPartial(e??{}),fromPartial(e){const t=createBaseAppDeploymentHistory();return t.appId=e.appId??"",t.version=e.version??0,t.clientVersion=e.clientVersion??"",t.deployedAt=e.deployedAt??0,t.deployedBy=e.deployedBy??"",t.deployedByAvatarUrl=e.deployedByAvatarUrl??"",t.tag=e.tag??"",t.rollbackVersion=e.rollbackVersion??0,t.rollbackAllowed=e.rollbackAllowed??!1,t.commitInfo=void 0!==e.commitInfo&&null!==e.commitInfo?CommitInfo.fromPartial(e.commitInfo):void 0,t}};function createBaseAppDeploymentHistoryRequest(){return{appId:""}}var AppDeploymentHistoryRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppDeploymentHistoryRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),t},create:e=>AppDeploymentHistoryRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppDeploymentHistoryRequest();return t.appId=e.appId??"",t}};function createBaseAppDeploymentHistoryResponse(){return{appDeploymentHistories:[]}}var AppDeploymentHistoryResponse={encode(e,t=new BinaryWriter){for(const n of e.appDeploymentHistories)AppDeploymentHistory.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppDeploymentHistoryResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appDeploymentHistories.push(AppDeploymentHistory.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appDeploymentHistories:globalThis.Array.isArray(e?.appDeploymentHistories)?e.appDeploymentHistories.map((e=>AppDeploymentHistory.fromJSON(e))):[]}),toJSON(e){const t={};return e.appDeploymentHistories?.length&&(t.appDeploymentHistories=e.appDeploymentHistories.map((e=>AppDeploymentHistory.toJSON(e)))),t},create:e=>AppDeploymentHistoryResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppDeploymentHistoryResponse();return t.appDeploymentHistories=e.appDeploymentHistories?.map((e=>AppDeploymentHistory.fromPartial(e)))||[],t}};function createBaseAppFetchLogsRequest(){return{appId:"",since:void 0,until:void 0,limit:0,source:0,functionId:"",functionCallId:"",taskId:"",sandboxId:"",searchText:""}}var AppFetchLogsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),void 0!==e.since&&Timestamp.encode(toTimestamp(e.since),t.uint32(18).fork()).join(),void 0!==e.until&&Timestamp.encode(toTimestamp(e.until),t.uint32(26).fork()).join(),0!==e.limit&&t.uint32(32).uint32(e.limit),0!==e.source&&t.uint32(40).int32(e.source),""!==e.functionId&&t.uint32(50).string(e.functionId),""!==e.functionCallId&&t.uint32(58).string(e.functionCallId),""!==e.taskId&&t.uint32(66).string(e.taskId),""!==e.sandboxId&&t.uint32(74).string(e.sandboxId),""!==e.searchText&&t.uint32(82).string(e.searchText),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppFetchLogsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(18!==e)break;a.since=fromTimestamp(Timestamp.decode(n,n.uint32()));continue;case 3:if(26!==e)break;a.until=fromTimestamp(Timestamp.decode(n,n.uint32()));continue;case 4:if(32!==e)break;a.limit=n.uint32();continue;case 5:if(40!==e)break;a.source=n.int32();continue;case 6:if(50!==e)break;a.functionId=n.string();continue;case 7:if(58!==e)break;a.functionCallId=n.string();continue;case 8:if(66!==e)break;a.taskId=n.string();continue;case 9:if(74!==e)break;a.sandboxId=n.string();continue;case 10:if(82!==e)break;a.searchText=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",since:isSet4(e.since)?fromJsonTimestamp(e.since):void 0,until:isSet4(e.until)?fromJsonTimestamp(e.until):void 0,limit:isSet4(e.limit)?globalThis.Number(e.limit):0,source:isSet4(e.source)?fileDescriptorFromJSON(e.source):0,functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",taskId:isSet4(e.taskId)?globalThis.String(e.taskId):"",sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",searchText:isSet4(e.searchText)?globalThis.String(e.searchText):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),void 0!==e.since&&(t.since=e.since.toISOString()),void 0!==e.until&&(t.until=e.until.toISOString()),0!==e.limit&&(t.limit=Math.round(e.limit)),0!==e.source&&(t.source=fileDescriptorToJSON(e.source)),""!==e.functionId&&(t.functionId=e.functionId),""!==e.functionCallId&&(t.functionCallId=e.functionCallId),""!==e.taskId&&(t.taskId=e.taskId),""!==e.sandboxId&&(t.sandboxId=e.sandboxId),""!==e.searchText&&(t.searchText=e.searchText),t},create:e=>AppFetchLogsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppFetchLogsRequest();return t.appId=e.appId??"",t.since=e.since??void 0,t.until=e.until??void 0,t.limit=e.limit??0,t.source=e.source??0,t.functionId=e.functionId??"",t.functionCallId=e.functionCallId??"",t.taskId=e.taskId??"",t.sandboxId=e.sandboxId??"",t.searchText=e.searchText??"",t}};function createBaseAppFetchLogsResponse(){return{batches:[]}}var AppFetchLogsResponse={encode(e,t=new BinaryWriter){for(const n of e.batches)TaskLogsBatch.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppFetchLogsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.batches.push(TaskLogsBatch.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({batches:globalThis.Array.isArray(e?.batches)?e.batches.map((e=>TaskLogsBatch.fromJSON(e))):[]}),toJSON(e){const t={};return e.batches?.length&&(t.batches=e.batches.map((e=>TaskLogsBatch.toJSON(e)))),t},create:e=>AppFetchLogsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppFetchLogsResponse();return t.batches=e.batches?.map((e=>TaskLogsBatch.fromPartial(e)))||[],t}};function createBaseAppGetByDeploymentNameRequest(){return{name:"",environmentName:""}}var AppGetByDeploymentNameRequest={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(18).string(e.name),""!==e.environmentName&&t.uint32(34).string(e.environmentName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetByDeploymentNameRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 2:if(18!==e)break;a.name=n.string();continue;case 4:if(34!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>AppGetByDeploymentNameRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetByDeploymentNameRequest();return t.name=e.name??"",t.environmentName=e.environmentName??"",t}};function createBaseAppGetByDeploymentNameResponse(){return{appId:""}}var AppGetByDeploymentNameResponse={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetByDeploymentNameResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),t},create:e=>AppGetByDeploymentNameResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetByDeploymentNameResponse();return t.appId=e.appId??"",t}};function createBaseAppGetLayoutRequest(){return{appId:""}}var AppGetLayoutRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetLayoutRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),t},create:e=>AppGetLayoutRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetLayoutRequest();return t.appId=e.appId??"",t}};function createBaseAppGetLayoutResponse(){return{appLayout:void 0}}var AppGetLayoutResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.appLayout&&AppLayout.encode(e.appLayout,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetLayoutResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appLayout=AppLayout.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appLayout:isSet4(e.appLayout)?AppLayout.fromJSON(e.appLayout):void 0}),toJSON(e){const t={};return void 0!==e.appLayout&&(t.appLayout=AppLayout.toJSON(e.appLayout)),t},create:e=>AppGetLayoutResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetLayoutResponse();return t.appLayout=void 0!==e.appLayout&&null!==e.appLayout?AppLayout.fromPartial(e.appLayout):void 0,t}};function createBaseAppGetLifecycleRequest(){return{appId:""}}var AppGetLifecycleRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetLifecycleRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),t},create:e=>AppGetLifecycleRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetLifecycleRequest();return t.appId=e.appId??"",t}};function createBaseAppGetLifecycleResponse(){return{lifecycle:void 0}}var AppGetLifecycleResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.lifecycle&&AppLifecycle.encode(e.lifecycle,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetLifecycleResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.lifecycle=AppLifecycle.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({lifecycle:isSet4(e.lifecycle)?AppLifecycle.fromJSON(e.lifecycle):void 0}),toJSON(e){const t={};return void 0!==e.lifecycle&&(t.lifecycle=AppLifecycle.toJSON(e.lifecycle)),t},create:e=>AppGetLifecycleResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetLifecycleResponse();return t.lifecycle=void 0!==e.lifecycle&&null!==e.lifecycle?AppLifecycle.fromPartial(e.lifecycle):void 0,t}};function createBaseAppGetLogsRequest(){return{appId:"",timeout:0,lastEntryId:"",functionId:"",parametrizedFunctionId:"",inputId:"",taskId:"",functionCallId:"",fileDescriptor:0,sandboxId:"",searchText:""}}var AppGetLogsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),0!==e.timeout&&t.uint32(21).float(e.timeout),""!==e.lastEntryId&&t.uint32(34).string(e.lastEntryId),""!==e.functionId&&t.uint32(42).string(e.functionId),""!==e.parametrizedFunctionId&&t.uint32(90).string(e.parametrizedFunctionId),""!==e.inputId&&t.uint32(50).string(e.inputId),""!==e.taskId&&t.uint32(58).string(e.taskId),""!==e.functionCallId&&t.uint32(74).string(e.functionCallId),0!==e.fileDescriptor&&t.uint32(64).int32(e.fileDescriptor),""!==e.sandboxId&&t.uint32(82).string(e.sandboxId),""!==e.searchText&&t.uint32(98).string(e.searchText),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetLogsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(21!==e)break;a.timeout=n.float();continue;case 4:if(34!==e)break;a.lastEntryId=n.string();continue;case 5:if(42!==e)break;a.functionId=n.string();continue;case 11:if(90!==e)break;a.parametrizedFunctionId=n.string();continue;case 6:if(50!==e)break;a.inputId=n.string();continue;case 7:if(58!==e)break;a.taskId=n.string();continue;case 9:if(74!==e)break;a.functionCallId=n.string();continue;case 8:if(64!==e)break;a.fileDescriptor=n.int32();continue;case 10:if(82!==e)break;a.sandboxId=n.string();continue;case 12:if(98!==e)break;a.searchText=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0,lastEntryId:isSet4(e.lastEntryId)?globalThis.String(e.lastEntryId):"",functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",parametrizedFunctionId:isSet4(e.parametrizedFunctionId)?globalThis.String(e.parametrizedFunctionId):"",inputId:isSet4(e.inputId)?globalThis.String(e.inputId):"",taskId:isSet4(e.taskId)?globalThis.String(e.taskId):"",functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",fileDescriptor:isSet4(e.fileDescriptor)?fileDescriptorFromJSON(e.fileDescriptor):0,sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",searchText:isSet4(e.searchText)?globalThis.String(e.searchText):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),0!==e.timeout&&(t.timeout=e.timeout),""!==e.lastEntryId&&(t.lastEntryId=e.lastEntryId),""!==e.functionId&&(t.functionId=e.functionId),""!==e.parametrizedFunctionId&&(t.parametrizedFunctionId=e.parametrizedFunctionId),""!==e.inputId&&(t.inputId=e.inputId),""!==e.taskId&&(t.taskId=e.taskId),""!==e.functionCallId&&(t.functionCallId=e.functionCallId),0!==e.fileDescriptor&&(t.fileDescriptor=fileDescriptorToJSON(e.fileDescriptor)),""!==e.sandboxId&&(t.sandboxId=e.sandboxId),""!==e.searchText&&(t.searchText=e.searchText),t},create:e=>AppGetLogsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetLogsRequest();return t.appId=e.appId??"",t.timeout=e.timeout??0,t.lastEntryId=e.lastEntryId??"",t.functionId=e.functionId??"",t.parametrizedFunctionId=e.parametrizedFunctionId??"",t.inputId=e.inputId??"",t.taskId=e.taskId??"",t.functionCallId=e.functionCallId??"",t.fileDescriptor=e.fileDescriptor??0,t.sandboxId=e.sandboxId??"",t.searchText=e.searchText??"",t}};function createBaseAppGetObjectsItem(){return{tag:"",object:void 0}}var AppGetObjectsItem={encode:(e,t=new BinaryWriter)=>(""!==e.tag&&t.uint32(10).string(e.tag),void 0!==e.object&&Object_.encode(e.object,t.uint32(50).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetObjectsItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.tag=n.string();continue;case 6:if(50!==e)break;a.object=Object_.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({tag:isSet4(e.tag)?globalThis.String(e.tag):"",object:isSet4(e.object)?Object_.fromJSON(e.object):void 0}),toJSON(e){const t={};return""!==e.tag&&(t.tag=e.tag),void 0!==e.object&&(t.object=Object_.toJSON(e.object)),t},create:e=>AppGetObjectsItem.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetObjectsItem();return t.tag=e.tag??"",t.object=void 0!==e.object&&null!==e.object?Object_.fromPartial(e.object):void 0,t}};function createBaseAppGetObjectsRequest(){return{appId:"",includeUnindexed:!1,onlyClassFunction:!1}}var AppGetObjectsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),!1!==e.includeUnindexed&&t.uint32(16).bool(e.includeUnindexed),!1!==e.onlyClassFunction&&t.uint32(24).bool(e.onlyClassFunction),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetObjectsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(16!==e)break;a.includeUnindexed=n.bool();continue;case 3:if(24!==e)break;a.onlyClassFunction=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",includeUnindexed:!!isSet4(e.includeUnindexed)&&globalThis.Boolean(e.includeUnindexed),onlyClassFunction:!!isSet4(e.onlyClassFunction)&&globalThis.Boolean(e.onlyClassFunction)}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),!1!==e.includeUnindexed&&(t.includeUnindexed=e.includeUnindexed),!1!==e.onlyClassFunction&&(t.onlyClassFunction=e.onlyClassFunction),t},create:e=>AppGetObjectsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetObjectsRequest();return t.appId=e.appId??"",t.includeUnindexed=e.includeUnindexed??!1,t.onlyClassFunction=e.onlyClassFunction??!1,t}};function createBaseAppGetObjectsResponse(){return{items:[]}}var AppGetObjectsResponse={encode(e,t=new BinaryWriter){for(const n of e.items)AppGetObjectsItem.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetObjectsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 2:if(18!==e)break;a.items.push(AppGetObjectsItem.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({items:globalThis.Array.isArray(e?.items)?e.items.map((e=>AppGetObjectsItem.fromJSON(e))):[]}),toJSON(e){const t={};return e.items?.length&&(t.items=e.items.map((e=>AppGetObjectsItem.toJSON(e)))),t},create:e=>AppGetObjectsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetObjectsResponse();return t.items=e.items?.map((e=>AppGetObjectsItem.fromPartial(e)))||[],t}};function createBaseAppGetOrCreateRequest(){return{appName:"",environmentName:"",objectCreationType:0}}var AppGetOrCreateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appName&&t.uint32(10).string(e.appName),""!==e.environmentName&&t.uint32(18).string(e.environmentName),0!==e.objectCreationType&&t.uint32(24).int32(e.objectCreationType),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetOrCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appName=n.string();continue;case 2:if(18!==e)break;a.environmentName=n.string();continue;case 3:if(24!==e)break;a.objectCreationType=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appName:isSet4(e.appName)?globalThis.String(e.appName):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",objectCreationType:isSet4(e.objectCreationType)?objectCreationTypeFromJSON(e.objectCreationType):0}),toJSON(e){const t={};return""!==e.appName&&(t.appName=e.appName),""!==e.environmentName&&(t.environmentName=e.environmentName),0!==e.objectCreationType&&(t.objectCreationType=objectCreationTypeToJSON(e.objectCreationType)),t},create:e=>AppGetOrCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetOrCreateRequest();return t.appName=e.appName??"",t.environmentName=e.environmentName??"",t.objectCreationType=e.objectCreationType??0,t}};function createBaseAppGetOrCreateResponse(){return{appId:""}}var AppGetOrCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetOrCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),t},create:e=>AppGetOrCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetOrCreateResponse();return t.appId=e.appId??"",t}};function createBaseAppGetTagsRequest(){return{appId:""}}var AppGetTagsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetTagsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),t},create:e=>AppGetTagsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetTagsRequest();return t.appId=e.appId??"",t}};function createBaseAppGetTagsResponse(){return{tags:{}}}var AppGetTagsResponse={encode:(e,t=new BinaryWriter)=>(Object.entries(e.tags).forEach((([e,n])=>{AppGetTagsResponse_TagsEntry.encode({key:e,value:n},t.uint32(10).fork()).join()})),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetTagsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:{if(10!==e)break;const t=AppGetTagsResponse_TagsEntry.decode(n,n.uint32());void 0!==t.value&&(a.tags[t.key]=t.value);continue}}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({tags:isObject2(e.tags)?Object.entries(e.tags).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{}}),toJSON(e){const t={};if(e.tags){const n=Object.entries(e.tags);n.length>0&&(t.tags={},n.forEach((([e,n])=>{t.tags[e]=n})))}return t},create:e=>AppGetTagsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetTagsResponse();return t.tags=Object.entries(e.tags??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t}};function createBaseAppGetTagsResponse_TagsEntry(){return{key:"",value:""}}var AppGetTagsResponse_TagsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppGetTagsResponse_TagsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>AppGetTagsResponse_TagsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseAppGetTagsResponse_TagsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseAppHeartbeatRequest(){return{appId:""}}var AppHeartbeatRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppHeartbeatRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),t},create:e=>AppHeartbeatRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppHeartbeatRequest();return t.appId=e.appId??"",t}};function createBaseAppLayout(){return{objects:[],functionIds:{},classIds:{}}}var AppLayout={encode(e,t=new BinaryWriter){for(const n of e.objects)Object_.encode(n,t.uint32(10).fork()).join();return Object.entries(e.functionIds).forEach((([e,n])=>{AppLayout_FunctionIdsEntry.encode({key:e,value:n},t.uint32(18).fork()).join()})),Object.entries(e.classIds).forEach((([e,n])=>{AppLayout_ClassIdsEntry.encode({key:e,value:n},t.uint32(26).fork()).join()})),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppLayout();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.objects.push(Object_.decode(n,n.uint32()));continue;case 2:{if(18!==e)break;const t=AppLayout_FunctionIdsEntry.decode(n,n.uint32());void 0!==t.value&&(a.functionIds[t.key]=t.value);continue}case 3:{if(26!==e)break;const t=AppLayout_ClassIdsEntry.decode(n,n.uint32());void 0!==t.value&&(a.classIds[t.key]=t.value);continue}}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({objects:globalThis.Array.isArray(e?.objects)?e.objects.map((e=>Object_.fromJSON(e))):[],functionIds:isObject2(e.functionIds)?Object.entries(e.functionIds).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{},classIds:isObject2(e.classIds)?Object.entries(e.classIds).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{}}),toJSON(e){const t={};if(e.objects?.length&&(t.objects=e.objects.map((e=>Object_.toJSON(e)))),e.functionIds){const n=Object.entries(e.functionIds);n.length>0&&(t.functionIds={},n.forEach((([e,n])=>{t.functionIds[e]=n})))}if(e.classIds){const n=Object.entries(e.classIds);n.length>0&&(t.classIds={},n.forEach((([e,n])=>{t.classIds[e]=n})))}return t},create:e=>AppLayout.fromPartial(e??{}),fromPartial(e){const t=createBaseAppLayout();return t.objects=e.objects?.map((e=>Object_.fromPartial(e)))||[],t.functionIds=Object.entries(e.functionIds??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t.classIds=Object.entries(e.classIds??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t}};function createBaseAppLayout_FunctionIdsEntry(){return{key:"",value:""}}var AppLayout_FunctionIdsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppLayout_FunctionIdsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>AppLayout_FunctionIdsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseAppLayout_FunctionIdsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseAppLayout_ClassIdsEntry(){return{key:"",value:""}}var AppLayout_ClassIdsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppLayout_ClassIdsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>AppLayout_ClassIdsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseAppLayout_ClassIdsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseAppLifecycle(){return{appState:0,createdAt:0,createdBy:"",deployedAt:0,deployedBy:"",version:0,stoppedAt:0,stoppedBy:""}}var AppLifecycle={encode:(e,t=new BinaryWriter)=>(0!==e.appState&&t.uint32(8).int32(e.appState),0!==e.createdAt&&t.uint32(17).double(e.createdAt),""!==e.createdBy&&t.uint32(26).string(e.createdBy),0!==e.deployedAt&&t.uint32(33).double(e.deployedAt),""!==e.deployedBy&&t.uint32(42).string(e.deployedBy),0!==e.version&&t.uint32(48).int32(e.version),0!==e.stoppedAt&&t.uint32(57).double(e.stoppedAt),""!==e.stoppedBy&&t.uint32(66).string(e.stoppedBy),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppLifecycle();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.appState=n.int32();continue;case 2:if(17!==e)break;a.createdAt=n.double();continue;case 3:if(26!==e)break;a.createdBy=n.string();continue;case 4:if(33!==e)break;a.deployedAt=n.double();continue;case 5:if(42!==e)break;a.deployedBy=n.string();continue;case 6:if(48!==e)break;a.version=n.int32();continue;case 7:if(57!==e)break;a.stoppedAt=n.double();continue;case 8:if(66!==e)break;a.stoppedBy=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appState:isSet4(e.appState)?appStateFromJSON(e.appState):0,createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,createdBy:isSet4(e.createdBy)?globalThis.String(e.createdBy):"",deployedAt:isSet4(e.deployedAt)?globalThis.Number(e.deployedAt):0,deployedBy:isSet4(e.deployedBy)?globalThis.String(e.deployedBy):"",version:isSet4(e.version)?globalThis.Number(e.version):0,stoppedAt:isSet4(e.stoppedAt)?globalThis.Number(e.stoppedAt):0,stoppedBy:isSet4(e.stoppedBy)?globalThis.String(e.stoppedBy):""}),toJSON(e){const t={};return 0!==e.appState&&(t.appState=appStateToJSON(e.appState)),0!==e.createdAt&&(t.createdAt=e.createdAt),""!==e.createdBy&&(t.createdBy=e.createdBy),0!==e.deployedAt&&(t.deployedAt=e.deployedAt),""!==e.deployedBy&&(t.deployedBy=e.deployedBy),0!==e.version&&(t.version=Math.round(e.version)),0!==e.stoppedAt&&(t.stoppedAt=e.stoppedAt),""!==e.stoppedBy&&(t.stoppedBy=e.stoppedBy),t},create:e=>AppLifecycle.fromPartial(e??{}),fromPartial(e){const t=createBaseAppLifecycle();return t.appState=e.appState??0,t.createdAt=e.createdAt??0,t.createdBy=e.createdBy??"",t.deployedAt=e.deployedAt??0,t.deployedBy=e.deployedBy??"",t.version=e.version??0,t.stoppedAt=e.stoppedAt??0,t.stoppedBy=e.stoppedBy??"",t}};function createBaseAppListRequest(){return{environmentName:""}}var AppListRequest={encode:(e,t=new BinaryWriter)=>(""!==e.environmentName&&t.uint32(10).string(e.environmentName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppListRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>AppListRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppListRequest();return t.environmentName=e.environmentName??"",t}};function createBaseAppListResponse(){return{apps:[]}}var AppListResponse={encode(e,t=new BinaryWriter){for(const n of e.apps)AppListResponse_AppListItem.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.apps.push(AppListResponse_AppListItem.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({apps:globalThis.Array.isArray(e?.apps)?e.apps.map((e=>AppListResponse_AppListItem.fromJSON(e))):[]}),toJSON(e){const t={};return e.apps?.length&&(t.apps=e.apps.map((e=>AppListResponse_AppListItem.toJSON(e)))),t},create:e=>AppListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppListResponse();return t.apps=e.apps?.map((e=>AppListResponse_AppListItem.fromPartial(e)))||[],t}};function createBaseAppListResponse_AppListItem(){return{appId:"",description:"",state:0,createdAt:0,stoppedAt:0,nRunningTasks:0,name:""}}var AppListResponse_AppListItem={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),""!==e.description&&t.uint32(26).string(e.description),0!==e.state&&t.uint32(32).int32(e.state),0!==e.createdAt&&t.uint32(41).double(e.createdAt),0!==e.stoppedAt&&t.uint32(49).double(e.stoppedAt),0!==e.nRunningTasks&&t.uint32(64).int32(e.nRunningTasks),""!==e.name&&t.uint32(82).string(e.name),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppListResponse_AppListItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 3:if(26!==e)break;a.description=n.string();continue;case 4:if(32!==e)break;a.state=n.int32();continue;case 5:if(41!==e)break;a.createdAt=n.double();continue;case 6:if(49!==e)break;a.stoppedAt=n.double();continue;case 8:if(64!==e)break;a.nRunningTasks=n.int32();continue;case 10:if(82!==e)break;a.name=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",description:isSet4(e.description)?globalThis.String(e.description):"",state:isSet4(e.state)?appStateFromJSON(e.state):0,createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,stoppedAt:isSet4(e.stoppedAt)?globalThis.Number(e.stoppedAt):0,nRunningTasks:isSet4(e.nRunningTasks)?globalThis.Number(e.nRunningTasks):0,name:isSet4(e.name)?globalThis.String(e.name):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),""!==e.description&&(t.description=e.description),0!==e.state&&(t.state=appStateToJSON(e.state)),0!==e.createdAt&&(t.createdAt=e.createdAt),0!==e.stoppedAt&&(t.stoppedAt=e.stoppedAt),0!==e.nRunningTasks&&(t.nRunningTasks=Math.round(e.nRunningTasks)),""!==e.name&&(t.name=e.name),t},create:e=>AppListResponse_AppListItem.fromPartial(e??{}),fromPartial(e){const t=createBaseAppListResponse_AppListItem();return t.appId=e.appId??"",t.description=e.description??"",t.state=e.state??0,t.createdAt=e.createdAt??0,t.stoppedAt=e.stoppedAt??0,t.nRunningTasks=e.nRunningTasks??0,t.name=e.name??"",t}};function createBaseAppLookupRequest(){return{appName:"",environmentName:""}}var AppLookupRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appName&&t.uint32(18).string(e.appName),""!==e.environmentName&&t.uint32(26).string(e.environmentName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppLookupRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 2:if(18!==e)break;a.appName=n.string();continue;case 3:if(26!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appName:isSet4(e.appName)?globalThis.String(e.appName):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return""!==e.appName&&(t.appName=e.appName),""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>AppLookupRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppLookupRequest();return t.appName=e.appName??"",t.environmentName=e.environmentName??"",t}};function createBaseAppLookupResponse(){return{appId:""}}var AppLookupResponse={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppLookupResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),t},create:e=>AppLookupResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppLookupResponse();return t.appId=e.appId??"",t}};function createBaseAppPublishRequest(){return{appId:"",name:"",deploymentTag:"",appState:0,functionIds:{},classIds:{},definitionIds:{},rollbackVersion:0,clientVersion:"",commitInfo:void 0,tags:{}}}var AppPublishRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),""!==e.name&&t.uint32(18).string(e.name),""!==e.deploymentTag&&t.uint32(26).string(e.deploymentTag),0!==e.appState&&t.uint32(32).int32(e.appState),Object.entries(e.functionIds).forEach((([e,n])=>{AppPublishRequest_FunctionIdsEntry.encode({key:e,value:n},t.uint32(42).fork()).join()})),Object.entries(e.classIds).forEach((([e,n])=>{AppPublishRequest_ClassIdsEntry.encode({key:e,value:n},t.uint32(50).fork()).join()})),Object.entries(e.definitionIds).forEach((([e,n])=>{AppPublishRequest_DefinitionIdsEntry.encode({key:e,value:n},t.uint32(58).fork()).join()})),0!==e.rollbackVersion&&t.uint32(64).uint32(e.rollbackVersion),""!==e.clientVersion&&t.uint32(74).string(e.clientVersion),void 0!==e.commitInfo&&CommitInfo.encode(e.commitInfo,t.uint32(82).fork()).join(),Object.entries(e.tags).forEach((([e,n])=>{AppPublishRequest_TagsEntry.encode({key:e,value:n},t.uint32(90).fork()).join()})),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppPublishRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(18!==e)break;a.name=n.string();continue;case 3:if(26!==e)break;a.deploymentTag=n.string();continue;case 4:if(32!==e)break;a.appState=n.int32();continue;case 5:{if(42!==e)break;const t=AppPublishRequest_FunctionIdsEntry.decode(n,n.uint32());void 0!==t.value&&(a.functionIds[t.key]=t.value);continue}case 6:{if(50!==e)break;const t=AppPublishRequest_ClassIdsEntry.decode(n,n.uint32());void 0!==t.value&&(a.classIds[t.key]=t.value);continue}case 7:{if(58!==e)break;const t=AppPublishRequest_DefinitionIdsEntry.decode(n,n.uint32());void 0!==t.value&&(a.definitionIds[t.key]=t.value);continue}case 8:if(64!==e)break;a.rollbackVersion=n.uint32();continue;case 9:if(74!==e)break;a.clientVersion=n.string();continue;case 10:if(82!==e)break;a.commitInfo=CommitInfo.decode(n,n.uint32());continue;case 11:{if(90!==e)break;const t=AppPublishRequest_TagsEntry.decode(n,n.uint32());void 0!==t.value&&(a.tags[t.key]=t.value);continue}}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",name:isSet4(e.name)?globalThis.String(e.name):"",deploymentTag:isSet4(e.deploymentTag)?globalThis.String(e.deploymentTag):"",appState:isSet4(e.appState)?appStateFromJSON(e.appState):0,functionIds:isObject2(e.functionIds)?Object.entries(e.functionIds).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{},classIds:isObject2(e.classIds)?Object.entries(e.classIds).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{},definitionIds:isObject2(e.definitionIds)?Object.entries(e.definitionIds).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{},rollbackVersion:isSet4(e.rollbackVersion)?globalThis.Number(e.rollbackVersion):0,clientVersion:isSet4(e.clientVersion)?globalThis.String(e.clientVersion):"",commitInfo:isSet4(e.commitInfo)?CommitInfo.fromJSON(e.commitInfo):void 0,tags:isObject2(e.tags)?Object.entries(e.tags).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{}}),toJSON(e){const t={};if(""!==e.appId&&(t.appId=e.appId),""!==e.name&&(t.name=e.name),""!==e.deploymentTag&&(t.deploymentTag=e.deploymentTag),0!==e.appState&&(t.appState=appStateToJSON(e.appState)),e.functionIds){const n=Object.entries(e.functionIds);n.length>0&&(t.functionIds={},n.forEach((([e,n])=>{t.functionIds[e]=n})))}if(e.classIds){const n=Object.entries(e.classIds);n.length>0&&(t.classIds={},n.forEach((([e,n])=>{t.classIds[e]=n})))}if(e.definitionIds){const n=Object.entries(e.definitionIds);n.length>0&&(t.definitionIds={},n.forEach((([e,n])=>{t.definitionIds[e]=n})))}if(0!==e.rollbackVersion&&(t.rollbackVersion=Math.round(e.rollbackVersion)),""!==e.clientVersion&&(t.clientVersion=e.clientVersion),void 0!==e.commitInfo&&(t.commitInfo=CommitInfo.toJSON(e.commitInfo)),e.tags){const n=Object.entries(e.tags);n.length>0&&(t.tags={},n.forEach((([e,n])=>{t.tags[e]=n})))}return t},create:e=>AppPublishRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppPublishRequest();return t.appId=e.appId??"",t.name=e.name??"",t.deploymentTag=e.deploymentTag??"",t.appState=e.appState??0,t.functionIds=Object.entries(e.functionIds??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t.classIds=Object.entries(e.classIds??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t.definitionIds=Object.entries(e.definitionIds??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t.rollbackVersion=e.rollbackVersion??0,t.clientVersion=e.clientVersion??"",t.commitInfo=void 0!==e.commitInfo&&null!==e.commitInfo?CommitInfo.fromPartial(e.commitInfo):void 0,t.tags=Object.entries(e.tags??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t}};function createBaseAppPublishRequest_FunctionIdsEntry(){return{key:"",value:""}}var AppPublishRequest_FunctionIdsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppPublishRequest_FunctionIdsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>AppPublishRequest_FunctionIdsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseAppPublishRequest_FunctionIdsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseAppPublishRequest_ClassIdsEntry(){return{key:"",value:""}}var AppPublishRequest_ClassIdsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppPublishRequest_ClassIdsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>AppPublishRequest_ClassIdsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseAppPublishRequest_ClassIdsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseAppPublishRequest_DefinitionIdsEntry(){return{key:"",value:""}}var AppPublishRequest_DefinitionIdsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppPublishRequest_DefinitionIdsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>AppPublishRequest_DefinitionIdsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseAppPublishRequest_DefinitionIdsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseAppPublishRequest_TagsEntry(){return{key:"",value:""}}var AppPublishRequest_TagsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppPublishRequest_TagsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>AppPublishRequest_TagsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseAppPublishRequest_TagsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseAppPublishResponse(){return{url:"",serverWarnings:[],deployedAt:0}}var AppPublishResponse={encode(e,t=new BinaryWriter){""!==e.url&&t.uint32(10).string(e.url);for(const n of e.serverWarnings)Warning.encode(n,t.uint32(26).fork()).join();return 0!==e.deployedAt&&t.uint32(33).double(e.deployedAt),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppPublishResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.url=n.string();continue;case 3:if(26!==e)break;a.serverWarnings.push(Warning.decode(n,n.uint32()));continue;case 4:if(33!==e)break;a.deployedAt=n.double();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({url:isSet4(e.url)?globalThis.String(e.url):"",serverWarnings:globalThis.Array.isArray(e?.serverWarnings)?e.serverWarnings.map((e=>Warning.fromJSON(e))):[],deployedAt:isSet4(e.deployedAt)?globalThis.Number(e.deployedAt):0}),toJSON(e){const t={};return""!==e.url&&(t.url=e.url),e.serverWarnings?.length&&(t.serverWarnings=e.serverWarnings.map((e=>Warning.toJSON(e)))),0!==e.deployedAt&&(t.deployedAt=e.deployedAt),t},create:e=>AppPublishResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppPublishResponse();return t.url=e.url??"",t.serverWarnings=e.serverWarnings?.map((e=>Warning.fromPartial(e)))||[],t.deployedAt=e.deployedAt??0,t}};function createBaseAppRollbackRequest(){return{appId:"",version:0}}var AppRollbackRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),0!==e.version&&t.uint32(16).int32(e.version),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppRollbackRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(16!==e)break;a.version=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",version:isSet4(e.version)?globalThis.Number(e.version):0}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),0!==e.version&&(t.version=Math.round(e.version)),t},create:e=>AppRollbackRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppRollbackRequest();return t.appId=e.appId??"",t.version=e.version??0,t}};function createBaseAppRolloverRequest(){return{appId:""}}var AppRolloverRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppRolloverRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),t},create:e=>AppRolloverRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppRolloverRequest();return t.appId=e.appId??"",t}};function createBaseAppRolloverResponse(){return{url:"",serverWarnings:[],deployedAt:0}}var AppRolloverResponse={encode(e,t=new BinaryWriter){""!==e.url&&t.uint32(10).string(e.url);for(const n of e.serverWarnings)Warning.encode(n,t.uint32(26).fork()).join();return 0!==e.deployedAt&&t.uint32(33).double(e.deployedAt),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppRolloverResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.url=n.string();continue;case 3:if(26!==e)break;a.serverWarnings.push(Warning.decode(n,n.uint32()));continue;case 4:if(33!==e)break;a.deployedAt=n.double();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({url:isSet4(e.url)?globalThis.String(e.url):"",serverWarnings:globalThis.Array.isArray(e?.serverWarnings)?e.serverWarnings.map((e=>Warning.fromJSON(e))):[],deployedAt:isSet4(e.deployedAt)?globalThis.Number(e.deployedAt):0}),toJSON(e){const t={};return""!==e.url&&(t.url=e.url),e.serverWarnings?.length&&(t.serverWarnings=e.serverWarnings.map((e=>Warning.toJSON(e)))),0!==e.deployedAt&&(t.deployedAt=e.deployedAt),t},create:e=>AppRolloverResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAppRolloverResponse();return t.url=e.url??"",t.serverWarnings=e.serverWarnings?.map((e=>Warning.fromPartial(e)))||[],t.deployedAt=e.deployedAt??0,t}};function createBaseAppSetObjectsRequest(){return{appId:"",indexedObjectIds:{},clientId:"",unindexedObjectIds:[],newAppState:0}}var AppSetObjectsRequest={encode(e,t=new BinaryWriter){""!==e.appId&&t.uint32(10).string(e.appId),Object.entries(e.indexedObjectIds).forEach((([e,n])=>{AppSetObjectsRequest_IndexedObjectIdsEntry.encode({key:e,value:n},t.uint32(18).fork()).join()})),""!==e.clientId&&t.uint32(26).string(e.clientId);for(const n of e.unindexedObjectIds)t.uint32(34).string(n);return 0!==e.newAppState&&t.uint32(40).int32(e.newAppState),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppSetObjectsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:{if(18!==e)break;const t=AppSetObjectsRequest_IndexedObjectIdsEntry.decode(n,n.uint32());void 0!==t.value&&(a.indexedObjectIds[t.key]=t.value);continue}case 3:if(26!==e)break;a.clientId=n.string();continue;case 4:if(34!==e)break;a.unindexedObjectIds.push(n.string());continue;case 5:if(40!==e)break;a.newAppState=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",indexedObjectIds:isObject2(e.indexedObjectIds)?Object.entries(e.indexedObjectIds).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{},clientId:isSet4(e.clientId)?globalThis.String(e.clientId):"",unindexedObjectIds:globalThis.Array.isArray(e?.unindexedObjectIds)?e.unindexedObjectIds.map((e=>globalThis.String(e))):[],newAppState:isSet4(e.newAppState)?appStateFromJSON(e.newAppState):0}),toJSON(e){const t={};if(""!==e.appId&&(t.appId=e.appId),e.indexedObjectIds){const n=Object.entries(e.indexedObjectIds);n.length>0&&(t.indexedObjectIds={},n.forEach((([e,n])=>{t.indexedObjectIds[e]=n})))}return""!==e.clientId&&(t.clientId=e.clientId),e.unindexedObjectIds?.length&&(t.unindexedObjectIds=e.unindexedObjectIds),0!==e.newAppState&&(t.newAppState=appStateToJSON(e.newAppState)),t},create:e=>AppSetObjectsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppSetObjectsRequest();return t.appId=e.appId??"",t.indexedObjectIds=Object.entries(e.indexedObjectIds??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t.clientId=e.clientId??"",t.unindexedObjectIds=e.unindexedObjectIds?.map((e=>e))||[],t.newAppState=e.newAppState??0,t}};function createBaseAppSetObjectsRequest_IndexedObjectIdsEntry(){return{key:"",value:""}}var AppSetObjectsRequest_IndexedObjectIdsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppSetObjectsRequest_IndexedObjectIdsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>AppSetObjectsRequest_IndexedObjectIdsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseAppSetObjectsRequest_IndexedObjectIdsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseAppSetTagsRequest(){return{appId:"",tags:{}}}var AppSetTagsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),Object.entries(e.tags).forEach((([e,n])=>{AppSetTagsRequest_TagsEntry.encode({key:e,value:n},t.uint32(18).fork()).join()})),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppSetTagsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:{if(18!==e)break;const t=AppSetTagsRequest_TagsEntry.decode(n,n.uint32());void 0!==t.value&&(a.tags[t.key]=t.value);continue}}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",tags:isObject2(e.tags)?Object.entries(e.tags).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{}}),toJSON(e){const t={};if(""!==e.appId&&(t.appId=e.appId),e.tags){const n=Object.entries(e.tags);n.length>0&&(t.tags={},n.forEach((([e,n])=>{t.tags[e]=n})))}return t},create:e=>AppSetTagsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppSetTagsRequest();return t.appId=e.appId??"",t.tags=Object.entries(e.tags??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t}};function createBaseAppSetTagsRequest_TagsEntry(){return{key:"",value:""}}var AppSetTagsRequest_TagsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppSetTagsRequest_TagsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>AppSetTagsRequest_TagsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseAppSetTagsRequest_TagsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseAppStopRequest(){return{appId:"",source:0}}var AppStopRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),0!==e.source&&t.uint32(16).int32(e.source),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAppStopRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(16!==e)break;a.source=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",source:isSet4(e.source)?appStopSourceFromJSON(e.source):0}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),0!==e.source&&(t.source=appStopSourceToJSON(e.source)),t},create:e=>AppStopRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAppStopRequest();return t.appId=e.appId??"",t.source=e.source??0,t}};function createBaseAttemptAwaitRequest(){return{attemptToken:"",requestedAt:0,timeoutSecs:0}}var AttemptAwaitRequest={encode:(e,t=new BinaryWriter)=>(""!==e.attemptToken&&t.uint32(10).string(e.attemptToken),0!==e.requestedAt&&t.uint32(17).double(e.requestedAt),0!==e.timeoutSecs&&t.uint32(29).float(e.timeoutSecs),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAttemptAwaitRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.attemptToken=n.string();continue;case 2:if(17!==e)break;a.requestedAt=n.double();continue;case 3:if(29!==e)break;a.timeoutSecs=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({attemptToken:isSet4(e.attemptToken)?globalThis.String(e.attemptToken):"",requestedAt:isSet4(e.requestedAt)?globalThis.Number(e.requestedAt):0,timeoutSecs:isSet4(e.timeoutSecs)?globalThis.Number(e.timeoutSecs):0}),toJSON(e){const t={};return""!==e.attemptToken&&(t.attemptToken=e.attemptToken),0!==e.requestedAt&&(t.requestedAt=e.requestedAt),0!==e.timeoutSecs&&(t.timeoutSecs=e.timeoutSecs),t},create:e=>AttemptAwaitRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAttemptAwaitRequest();return t.attemptToken=e.attemptToken??"",t.requestedAt=e.requestedAt??0,t.timeoutSecs=e.timeoutSecs??0,t}};function createBaseAttemptAwaitResponse(){return{output:void 0}}var AttemptAwaitResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.output&&FunctionGetOutputsItem.encode(e.output,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAttemptAwaitResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.output=FunctionGetOutputsItem.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({output:isSet4(e.output)?FunctionGetOutputsItem.fromJSON(e.output):void 0}),toJSON(e){const t={};return void 0!==e.output&&(t.output=FunctionGetOutputsItem.toJSON(e.output)),t},create:e=>AttemptAwaitResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAttemptAwaitResponse();return t.output=void 0!==e.output&&null!==e.output?FunctionGetOutputsItem.fromPartial(e.output):void 0,t}};function createBaseAttemptRetryRequest(){return{functionId:"",parentInputId:"",input:void 0,attemptToken:""}}var AttemptRetryRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),""!==e.parentInputId&&t.uint32(18).string(e.parentInputId),void 0!==e.input&&FunctionPutInputsItem.encode(e.input,t.uint32(26).fork()).join(),""!==e.attemptToken&&t.uint32(34).string(e.attemptToken),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAttemptRetryRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(18!==e)break;a.parentInputId=n.string();continue;case 3:if(26!==e)break;a.input=FunctionPutInputsItem.decode(n,n.uint32());continue;case 4:if(34!==e)break;a.attemptToken=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",parentInputId:isSet4(e.parentInputId)?globalThis.String(e.parentInputId):"",input:isSet4(e.input)?FunctionPutInputsItem.fromJSON(e.input):void 0,attemptToken:isSet4(e.attemptToken)?globalThis.String(e.attemptToken):""}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),""!==e.parentInputId&&(t.parentInputId=e.parentInputId),void 0!==e.input&&(t.input=FunctionPutInputsItem.toJSON(e.input)),""!==e.attemptToken&&(t.attemptToken=e.attemptToken),t},create:e=>AttemptRetryRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAttemptRetryRequest();return t.functionId=e.functionId??"",t.parentInputId=e.parentInputId??"",t.input=void 0!==e.input&&null!==e.input?FunctionPutInputsItem.fromPartial(e.input):void 0,t.attemptToken=e.attemptToken??"",t}};function createBaseAttemptRetryResponse(){return{attemptToken:""}}var AttemptRetryResponse={encode:(e,t=new BinaryWriter)=>(""!==e.attemptToken&&t.uint32(10).string(e.attemptToken),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAttemptRetryResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.attemptToken=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({attemptToken:isSet4(e.attemptToken)?globalThis.String(e.attemptToken):""}),toJSON(e){const t={};return""!==e.attemptToken&&(t.attemptToken=e.attemptToken),t},create:e=>AttemptRetryResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAttemptRetryResponse();return t.attemptToken=e.attemptToken??"",t}};function createBaseAttemptStartRequest(){return{functionId:"",parentInputId:"",input:void 0}}var AttemptStartRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),""!==e.parentInputId&&t.uint32(18).string(e.parentInputId),void 0!==e.input&&FunctionPutInputsItem.encode(e.input,t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAttemptStartRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(18!==e)break;a.parentInputId=n.string();continue;case 3:if(26!==e)break;a.input=FunctionPutInputsItem.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",parentInputId:isSet4(e.parentInputId)?globalThis.String(e.parentInputId):"",input:isSet4(e.input)?FunctionPutInputsItem.fromJSON(e.input):void 0}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),""!==e.parentInputId&&(t.parentInputId=e.parentInputId),void 0!==e.input&&(t.input=FunctionPutInputsItem.toJSON(e.input)),t},create:e=>AttemptStartRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAttemptStartRequest();return t.functionId=e.functionId??"",t.parentInputId=e.parentInputId??"",t.input=void 0!==e.input&&null!==e.input?FunctionPutInputsItem.fromPartial(e.input):void 0,t}};function createBaseAttemptStartResponse(){return{attemptToken:"",retryPolicy:void 0}}var AttemptStartResponse={encode:(e,t=new BinaryWriter)=>(""!==e.attemptToken&&t.uint32(10).string(e.attemptToken),void 0!==e.retryPolicy&&FunctionRetryPolicy.encode(e.retryPolicy,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAttemptStartResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.attemptToken=n.string();continue;case 2:if(18!==e)break;a.retryPolicy=FunctionRetryPolicy.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({attemptToken:isSet4(e.attemptToken)?globalThis.String(e.attemptToken):"",retryPolicy:isSet4(e.retryPolicy)?FunctionRetryPolicy.fromJSON(e.retryPolicy):void 0}),toJSON(e){const t={};return""!==e.attemptToken&&(t.attemptToken=e.attemptToken),void 0!==e.retryPolicy&&(t.retryPolicy=FunctionRetryPolicy.toJSON(e.retryPolicy)),t},create:e=>AttemptStartResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAttemptStartResponse();return t.attemptToken=e.attemptToken??"",t.retryPolicy=void 0!==e.retryPolicy&&null!==e.retryPolicy?FunctionRetryPolicy.fromPartial(e.retryPolicy):void 0,t}};function createBaseAuthTokenGetRequest(){return{}}var AuthTokenGetRequest={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAuthTokenGetRequest();for(;n.pos<r;){const e=n.uint32();if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({}),toJSON:e=>({}),create:e=>AuthTokenGetRequest.fromPartial(e??{}),fromPartial:e=>createBaseAuthTokenGetRequest()};function createBaseAuthTokenGetResponse(){return{token:""}}var AuthTokenGetResponse={encode:(e,t=new BinaryWriter)=>(""!==e.token&&t.uint32(10).string(e.token),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAuthTokenGetResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.token=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({token:isSet4(e.token)?globalThis.String(e.token):""}),toJSON(e){const t={};return""!==e.token&&(t.token=e.token),t},create:e=>AuthTokenGetResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAuthTokenGetResponse();return t.token=e.token??"",t}};function createBaseAutoscalerSettings(){return{minContainers:void 0,maxContainers:void 0,bufferContainers:void 0,scaleupWindow:void 0,scaledownWindow:void 0}}var AutoscalerSettings={encode:(e,t=new BinaryWriter)=>(void 0!==e.minContainers&&t.uint32(8).uint32(e.minContainers),void 0!==e.maxContainers&&t.uint32(16).uint32(e.maxContainers),void 0!==e.bufferContainers&&t.uint32(24).uint32(e.bufferContainers),void 0!==e.scaleupWindow&&t.uint32(32).uint32(e.scaleupWindow),void 0!==e.scaledownWindow&&t.uint32(40).uint32(e.scaledownWindow),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseAutoscalerSettings();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.minContainers=n.uint32();continue;case 2:if(16!==e)break;a.maxContainers=n.uint32();continue;case 3:if(24!==e)break;a.bufferContainers=n.uint32();continue;case 4:if(32!==e)break;a.scaleupWindow=n.uint32();continue;case 5:if(40!==e)break;a.scaledownWindow=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({minContainers:isSet4(e.minContainers)?globalThis.Number(e.minContainers):void 0,maxContainers:isSet4(e.maxContainers)?globalThis.Number(e.maxContainers):void 0,bufferContainers:isSet4(e.bufferContainers)?globalThis.Number(e.bufferContainers):void 0,scaleupWindow:isSet4(e.scaleupWindow)?globalThis.Number(e.scaleupWindow):void 0,scaledownWindow:isSet4(e.scaledownWindow)?globalThis.Number(e.scaledownWindow):void 0}),toJSON(e){const t={};return void 0!==e.minContainers&&(t.minContainers=Math.round(e.minContainers)),void 0!==e.maxContainers&&(t.maxContainers=Math.round(e.maxContainers)),void 0!==e.bufferContainers&&(t.bufferContainers=Math.round(e.bufferContainers)),void 0!==e.scaleupWindow&&(t.scaleupWindow=Math.round(e.scaleupWindow)),void 0!==e.scaledownWindow&&(t.scaledownWindow=Math.round(e.scaledownWindow)),t},create:e=>AutoscalerSettings.fromPartial(e??{}),fromPartial(e){const t=createBaseAutoscalerSettings();return t.minContainers=e.minContainers??void 0,t.maxContainers=e.maxContainers??void 0,t.bufferContainers=e.bufferContainers??void 0,t.scaleupWindow=e.scaleupWindow??void 0,t.scaledownWindow=e.scaledownWindow??void 0,t}};function createBaseBaseImage(){return{imageId:"",dockerTag:""}}var BaseImage={encode:(e,t=new BinaryWriter)=>(""!==e.imageId&&t.uint32(10).string(e.imageId),""!==e.dockerTag&&t.uint32(18).string(e.dockerTag),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseBaseImage();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.imageId=n.string();continue;case 2:if(18!==e)break;a.dockerTag=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({imageId:isSet4(e.imageId)?globalThis.String(e.imageId):"",dockerTag:isSet4(e.dockerTag)?globalThis.String(e.dockerTag):""}),toJSON(e){const t={};return""!==e.imageId&&(t.imageId=e.imageId),""!==e.dockerTag&&(t.dockerTag=e.dockerTag),t},create:e=>BaseImage.fromPartial(e??{}),fromPartial(e){const t=createBaseBaseImage();return t.imageId=e.imageId??"",t.dockerTag=e.dockerTag??"",t}};function createBaseBlobCreateRequest(){return{contentMd5:"",contentSha256Base64:"",contentLength:0}}var BlobCreateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.contentMd5&&t.uint32(10).string(e.contentMd5),""!==e.contentSha256Base64&&t.uint32(18).string(e.contentSha256Base64),0!==e.contentLength&&t.uint32(24).int64(e.contentLength),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseBlobCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.contentMd5=n.string();continue;case 2:if(18!==e)break;a.contentSha256Base64=n.string();continue;case 3:if(24!==e)break;a.contentLength=longToNumber2(n.int64());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({contentMd5:isSet4(e.contentMd5)?globalThis.String(e.contentMd5):"",contentSha256Base64:isSet4(e.contentSha256Base64)?globalThis.String(e.contentSha256Base64):"",contentLength:isSet4(e.contentLength)?globalThis.Number(e.contentLength):0}),toJSON(e){const t={};return""!==e.contentMd5&&(t.contentMd5=e.contentMd5),""!==e.contentSha256Base64&&(t.contentSha256Base64=e.contentSha256Base64),0!==e.contentLength&&(t.contentLength=Math.round(e.contentLength)),t},create:e=>BlobCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseBlobCreateRequest();return t.contentMd5=e.contentMd5??"",t.contentSha256Base64=e.contentSha256Base64??"",t.contentLength=e.contentLength??0,t}};function createBaseBlobCreateResponse(){return{blobId:"",uploadUrl:void 0,multipart:void 0,blobIds:[],uploadUrls:void 0,multiparts:void 0}}var BlobCreateResponse={encode(e,t=new BinaryWriter){""!==e.blobId&&t.uint32(18).string(e.blobId),void 0!==e.uploadUrl&&t.uint32(10).string(e.uploadUrl),void 0!==e.multipart&&MultiPartUpload.encode(e.multipart,t.uint32(26).fork()).join();for(const n of e.blobIds)t.uint32(34).string(n);return void 0!==e.uploadUrls&&UploadUrlList.encode(e.uploadUrls,t.uint32(42).fork()).join(),void 0!==e.multiparts&&MultiPartUploadList.encode(e.multiparts,t.uint32(50).fork()).join(),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseBlobCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 2:if(18!==e)break;a.blobId=n.string();continue;case 1:if(10!==e)break;a.uploadUrl=n.string();continue;case 3:if(26!==e)break;a.multipart=MultiPartUpload.decode(n,n.uint32());continue;case 4:if(34!==e)break;a.blobIds.push(n.string());continue;case 5:if(42!==e)break;a.uploadUrls=UploadUrlList.decode(n,n.uint32());continue;case 6:if(50!==e)break;a.multiparts=MultiPartUploadList.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({blobId:isSet4(e.blobId)?globalThis.String(e.blobId):"",uploadUrl:isSet4(e.uploadUrl)?globalThis.String(e.uploadUrl):void 0,multipart:isSet4(e.multipart)?MultiPartUpload.fromJSON(e.multipart):void 0,blobIds:globalThis.Array.isArray(e?.blobIds)?e.blobIds.map((e=>globalThis.String(e))):[],uploadUrls:isSet4(e.uploadUrls)?UploadUrlList.fromJSON(e.uploadUrls):void 0,multiparts:isSet4(e.multiparts)?MultiPartUploadList.fromJSON(e.multiparts):void 0}),toJSON(e){const t={};return""!==e.blobId&&(t.blobId=e.blobId),void 0!==e.uploadUrl&&(t.uploadUrl=e.uploadUrl),void 0!==e.multipart&&(t.multipart=MultiPartUpload.toJSON(e.multipart)),e.blobIds?.length&&(t.blobIds=e.blobIds),void 0!==e.uploadUrls&&(t.uploadUrls=UploadUrlList.toJSON(e.uploadUrls)),void 0!==e.multiparts&&(t.multiparts=MultiPartUploadList.toJSON(e.multiparts)),t},create:e=>BlobCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseBlobCreateResponse();return t.blobId=e.blobId??"",t.uploadUrl=e.uploadUrl??void 0,t.multipart=void 0!==e.multipart&&null!==e.multipart?MultiPartUpload.fromPartial(e.multipart):void 0,t.blobIds=e.blobIds?.map((e=>e))||[],t.uploadUrls=void 0!==e.uploadUrls&&null!==e.uploadUrls?UploadUrlList.fromPartial(e.uploadUrls):void 0,t.multiparts=void 0!==e.multiparts&&null!==e.multiparts?MultiPartUploadList.fromPartial(e.multiparts):void 0,t}};function createBaseBlobGetRequest(){return{blobId:""}}var BlobGetRequest={encode:(e,t=new BinaryWriter)=>(""!==e.blobId&&t.uint32(10).string(e.blobId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseBlobGetRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.blobId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({blobId:isSet4(e.blobId)?globalThis.String(e.blobId):""}),toJSON(e){const t={};return""!==e.blobId&&(t.blobId=e.blobId),t},create:e=>BlobGetRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseBlobGetRequest();return t.blobId=e.blobId??"",t}};function createBaseBlobGetResponse(){return{downloadUrl:""}}var BlobGetResponse={encode:(e,t=new BinaryWriter)=>(""!==e.downloadUrl&&t.uint32(10).string(e.downloadUrl),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseBlobGetResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.downloadUrl=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({downloadUrl:isSet4(e.downloadUrl)?globalThis.String(e.downloadUrl):""}),toJSON(e){const t={};return""!==e.downloadUrl&&(t.downloadUrl=e.downloadUrl),t},create:e=>BlobGetResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseBlobGetResponse();return t.downloadUrl=e.downloadUrl??"",t}};function createBaseBuildFunction(){return{definition:"",globals:new Uint8Array(0),input:void 0}}var BuildFunction={encode:(e,t=new BinaryWriter)=>(""!==e.definition&&t.uint32(10).string(e.definition),0!==e.globals.length&&t.uint32(18).bytes(e.globals),void 0!==e.input&&FunctionInput.encode(e.input,t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseBuildFunction();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.definition=n.string();continue;case 2:if(18!==e)break;a.globals=n.bytes();continue;case 3:if(26!==e)break;a.input=FunctionInput.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({definition:isSet4(e.definition)?globalThis.String(e.definition):"",globals:isSet4(e.globals)?bytesFromBase64(e.globals):new Uint8Array(0),input:isSet4(e.input)?FunctionInput.fromJSON(e.input):void 0}),toJSON(e){const t={};return""!==e.definition&&(t.definition=e.definition),0!==e.globals.length&&(t.globals=base64FromBytes(e.globals)),void 0!==e.input&&(t.input=FunctionInput.toJSON(e.input)),t},create:e=>BuildFunction.fromPartial(e??{}),fromPartial(e){const t=createBaseBuildFunction();return t.definition=e.definition??"",t.globals=e.globals??new Uint8Array(0),t.input=void 0!==e.input&&null!==e.input?FunctionInput.fromPartial(e.input):void 0,t}};function createBaseCancelInputEvent(){return{inputIds:[],terminateContainers:!1,cancellationReason:""}}var CancelInputEvent={encode(e,t=new BinaryWriter){for(const n of e.inputIds)t.uint32(10).string(n);return!1!==e.terminateContainers&&t.uint32(16).bool(e.terminateContainers),""!==e.cancellationReason&&t.uint32(26).string(e.cancellationReason),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseCancelInputEvent();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.inputIds.push(n.string());continue;case 2:if(16!==e)break;a.terminateContainers=n.bool();continue;case 3:if(26!==e)break;a.cancellationReason=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({inputIds:globalThis.Array.isArray(e?.inputIds)?e.inputIds.map((e=>globalThis.String(e))):[],terminateContainers:!!isSet4(e.terminateContainers)&&globalThis.Boolean(e.terminateContainers),cancellationReason:isSet4(e.cancellationReason)?globalThis.String(e.cancellationReason):""}),toJSON(e){const t={};return e.inputIds?.length&&(t.inputIds=e.inputIds),!1!==e.terminateContainers&&(t.terminateContainers=e.terminateContainers),""!==e.cancellationReason&&(t.cancellationReason=e.cancellationReason),t},create:e=>CancelInputEvent.fromPartial(e??{}),fromPartial(e){const t=createBaseCancelInputEvent();return t.inputIds=e.inputIds?.map((e=>e))||[],t.terminateContainers=e.terminateContainers??!1,t.cancellationReason=e.cancellationReason??"",t}};function createBaseCheckpointInfo(){return{checksum:"",status:0,checkpointId:"",runtimeFingerprint:"",size:0,checksumIsFileIndex:!1,originalTaskId:"",runscRuntimeVersion:""}}var CheckpointInfo={encode:(e,t=new BinaryWriter)=>(""!==e.checksum&&t.uint32(10).string(e.checksum),0!==e.status&&t.uint32(16).int32(e.status),""!==e.checkpointId&&t.uint32(26).string(e.checkpointId),""!==e.runtimeFingerprint&&t.uint32(34).string(e.runtimeFingerprint),0!==e.size&&t.uint32(40).int64(e.size),!1!==e.checksumIsFileIndex&&t.uint32(48).bool(e.checksumIsFileIndex),""!==e.originalTaskId&&t.uint32(58).string(e.originalTaskId),""!==e.runscRuntimeVersion&&t.uint32(74).string(e.runscRuntimeVersion),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseCheckpointInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.checksum=n.string();continue;case 2:if(16!==e)break;a.status=n.int32();continue;case 3:if(26!==e)break;a.checkpointId=n.string();continue;case 4:if(34!==e)break;a.runtimeFingerprint=n.string();continue;case 5:if(40!==e)break;a.size=longToNumber2(n.int64());continue;case 6:if(48!==e)break;a.checksumIsFileIndex=n.bool();continue;case 7:if(58!==e)break;a.originalTaskId=n.string();continue;case 9:if(74!==e)break;a.runscRuntimeVersion=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({checksum:isSet4(e.checksum)?globalThis.String(e.checksum):"",status:isSet4(e.status)?checkpointStatusFromJSON(e.status):0,checkpointId:isSet4(e.checkpointId)?globalThis.String(e.checkpointId):"",runtimeFingerprint:isSet4(e.runtimeFingerprint)?globalThis.String(e.runtimeFingerprint):"",size:isSet4(e.size)?globalThis.Number(e.size):0,checksumIsFileIndex:!!isSet4(e.checksumIsFileIndex)&&globalThis.Boolean(e.checksumIsFileIndex),originalTaskId:isSet4(e.originalTaskId)?globalThis.String(e.originalTaskId):"",runscRuntimeVersion:isSet4(e.runscRuntimeVersion)?globalThis.String(e.runscRuntimeVersion):""}),toJSON(e){const t={};return""!==e.checksum&&(t.checksum=e.checksum),0!==e.status&&(t.status=checkpointStatusToJSON(e.status)),""!==e.checkpointId&&(t.checkpointId=e.checkpointId),""!==e.runtimeFingerprint&&(t.runtimeFingerprint=e.runtimeFingerprint),0!==e.size&&(t.size=Math.round(e.size)),!1!==e.checksumIsFileIndex&&(t.checksumIsFileIndex=e.checksumIsFileIndex),""!==e.originalTaskId&&(t.originalTaskId=e.originalTaskId),""!==e.runscRuntimeVersion&&(t.runscRuntimeVersion=e.runscRuntimeVersion),t},create:e=>CheckpointInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseCheckpointInfo();return t.checksum=e.checksum??"",t.status=e.status??0,t.checkpointId=e.checkpointId??"",t.runtimeFingerprint=e.runtimeFingerprint??"",t.size=e.size??0,t.checksumIsFileIndex=e.checksumIsFileIndex??!1,t.originalTaskId=e.originalTaskId??"",t.runscRuntimeVersion=e.runscRuntimeVersion??"",t}};function createBaseClassCreateRequest(){return{appId:"",existingClassId:"",methods:[],onlyClassFunction:!1}}var ClassCreateRequest={encode(e,t=new BinaryWriter){""!==e.appId&&t.uint32(10).string(e.appId),""!==e.existingClassId&&t.uint32(18).string(e.existingClassId);for(const n of e.methods)ClassMethod.encode(n,t.uint32(26).fork()).join();return!1!==e.onlyClassFunction&&t.uint32(40).bool(e.onlyClassFunction),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClassCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(18!==e)break;a.existingClassId=n.string();continue;case 3:if(26!==e)break;a.methods.push(ClassMethod.decode(n,n.uint32()));continue;case 5:if(40!==e)break;a.onlyClassFunction=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",existingClassId:isSet4(e.existingClassId)?globalThis.String(e.existingClassId):"",methods:globalThis.Array.isArray(e?.methods)?e.methods.map((e=>ClassMethod.fromJSON(e))):[],onlyClassFunction:!!isSet4(e.onlyClassFunction)&&globalThis.Boolean(e.onlyClassFunction)}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),""!==e.existingClassId&&(t.existingClassId=e.existingClassId),e.methods?.length&&(t.methods=e.methods.map((e=>ClassMethod.toJSON(e)))),!1!==e.onlyClassFunction&&(t.onlyClassFunction=e.onlyClassFunction),t},create:e=>ClassCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseClassCreateRequest();return t.appId=e.appId??"",t.existingClassId=e.existingClassId??"",t.methods=e.methods?.map((e=>ClassMethod.fromPartial(e)))||[],t.onlyClassFunction=e.onlyClassFunction??!1,t}};function createBaseClassCreateResponse(){return{classId:"",handleMetadata:void 0}}var ClassCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.classId&&t.uint32(10).string(e.classId),void 0!==e.handleMetadata&&ClassHandleMetadata.encode(e.handleMetadata,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClassCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.classId=n.string();continue;case 2:if(18!==e)break;a.handleMetadata=ClassHandleMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({classId:isSet4(e.classId)?globalThis.String(e.classId):"",handleMetadata:isSet4(e.handleMetadata)?ClassHandleMetadata.fromJSON(e.handleMetadata):void 0}),toJSON(e){const t={};return""!==e.classId&&(t.classId=e.classId),void 0!==e.handleMetadata&&(t.handleMetadata=ClassHandleMetadata.toJSON(e.handleMetadata)),t},create:e=>ClassCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseClassCreateResponse();return t.classId=e.classId??"",t.handleMetadata=void 0!==e.handleMetadata&&null!==e.handleMetadata?ClassHandleMetadata.fromPartial(e.handleMetadata):void 0,t}};function createBaseClassGetRequest(){return{appName:"",objectTag:"",environmentName:"",onlyClassFunction:!1}}var ClassGetRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appName&&t.uint32(10).string(e.appName),""!==e.objectTag&&t.uint32(18).string(e.objectTag),""!==e.environmentName&&t.uint32(34).string(e.environmentName),!1!==e.onlyClassFunction&&t.uint32(80).bool(e.onlyClassFunction),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClassGetRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appName=n.string();continue;case 2:if(18!==e)break;a.objectTag=n.string();continue;case 4:if(34!==e)break;a.environmentName=n.string();continue;case 10:if(80!==e)break;a.onlyClassFunction=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appName:isSet4(e.appName)?globalThis.String(e.appName):"",objectTag:isSet4(e.objectTag)?globalThis.String(e.objectTag):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",onlyClassFunction:!!isSet4(e.onlyClassFunction)&&globalThis.Boolean(e.onlyClassFunction)}),toJSON(e){const t={};return""!==e.appName&&(t.appName=e.appName),""!==e.objectTag&&(t.objectTag=e.objectTag),""!==e.environmentName&&(t.environmentName=e.environmentName),!1!==e.onlyClassFunction&&(t.onlyClassFunction=e.onlyClassFunction),t},create:e=>ClassGetRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseClassGetRequest();return t.appName=e.appName??"",t.objectTag=e.objectTag??"",t.environmentName=e.environmentName??"",t.onlyClassFunction=e.onlyClassFunction??!1,t}};function createBaseClassGetResponse(){return{classId:"",handleMetadata:void 0,serverWarnings:[]}}var ClassGetResponse={encode(e,t=new BinaryWriter){""!==e.classId&&t.uint32(10).string(e.classId),void 0!==e.handleMetadata&&ClassHandleMetadata.encode(e.handleMetadata,t.uint32(18).fork()).join();for(const n of e.serverWarnings)Warning.encode(n,t.uint32(26).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClassGetResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.classId=n.string();continue;case 2:if(18!==e)break;a.handleMetadata=ClassHandleMetadata.decode(n,n.uint32());continue;case 3:if(26!==e)break;a.serverWarnings.push(Warning.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({classId:isSet4(e.classId)?globalThis.String(e.classId):"",handleMetadata:isSet4(e.handleMetadata)?ClassHandleMetadata.fromJSON(e.handleMetadata):void 0,serverWarnings:globalThis.Array.isArray(e?.serverWarnings)?e.serverWarnings.map((e=>Warning.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.classId&&(t.classId=e.classId),void 0!==e.handleMetadata&&(t.handleMetadata=ClassHandleMetadata.toJSON(e.handleMetadata)),e.serverWarnings?.length&&(t.serverWarnings=e.serverWarnings.map((e=>Warning.toJSON(e)))),t},create:e=>ClassGetResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseClassGetResponse();return t.classId=e.classId??"",t.handleMetadata=void 0!==e.handleMetadata&&null!==e.handleMetadata?ClassHandleMetadata.fromPartial(e.handleMetadata):void 0,t.serverWarnings=e.serverWarnings?.map((e=>Warning.fromPartial(e)))||[],t}};function createBaseClassHandleMetadata(){return{methods:[],classFunctionId:"",classFunctionMetadata:void 0}}var ClassHandleMetadata={encode(e,t=new BinaryWriter){for(const n of e.methods)ClassMethod.encode(n,t.uint32(10).fork()).join();return""!==e.classFunctionId&&t.uint32(18).string(e.classFunctionId),void 0!==e.classFunctionMetadata&&FunctionHandleMetadata.encode(e.classFunctionMetadata,t.uint32(26).fork()).join(),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClassHandleMetadata();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.methods.push(ClassMethod.decode(n,n.uint32()));continue;case 2:if(18!==e)break;a.classFunctionId=n.string();continue;case 3:if(26!==e)break;a.classFunctionMetadata=FunctionHandleMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({methods:globalThis.Array.isArray(e?.methods)?e.methods.map((e=>ClassMethod.fromJSON(e))):[],classFunctionId:isSet4(e.classFunctionId)?globalThis.String(e.classFunctionId):"",classFunctionMetadata:isSet4(e.classFunctionMetadata)?FunctionHandleMetadata.fromJSON(e.classFunctionMetadata):void 0}),toJSON(e){const t={};return e.methods?.length&&(t.methods=e.methods.map((e=>ClassMethod.toJSON(e)))),""!==e.classFunctionId&&(t.classFunctionId=e.classFunctionId),void 0!==e.classFunctionMetadata&&(t.classFunctionMetadata=FunctionHandleMetadata.toJSON(e.classFunctionMetadata)),t},create:e=>ClassHandleMetadata.fromPartial(e??{}),fromPartial(e){const t=createBaseClassHandleMetadata();return t.methods=e.methods?.map((e=>ClassMethod.fromPartial(e)))||[],t.classFunctionId=e.classFunctionId??"",t.classFunctionMetadata=void 0!==e.classFunctionMetadata&&null!==e.classFunctionMetadata?FunctionHandleMetadata.fromPartial(e.classFunctionMetadata):void 0,t}};function createBaseClassMethod(){return{functionName:"",functionId:"",functionHandleMetadata:void 0}}var ClassMethod={encode:(e,t=new BinaryWriter)=>(""!==e.functionName&&t.uint32(10).string(e.functionName),""!==e.functionId&&t.uint32(18).string(e.functionId),void 0!==e.functionHandleMetadata&&FunctionHandleMetadata.encode(e.functionHandleMetadata,t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClassMethod();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionName=n.string();continue;case 2:if(18!==e)break;a.functionId=n.string();continue;case 3:if(26!==e)break;a.functionHandleMetadata=FunctionHandleMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionName:isSet4(e.functionName)?globalThis.String(e.functionName):"",functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",functionHandleMetadata:isSet4(e.functionHandleMetadata)?FunctionHandleMetadata.fromJSON(e.functionHandleMetadata):void 0}),toJSON(e){const t={};return""!==e.functionName&&(t.functionName=e.functionName),""!==e.functionId&&(t.functionId=e.functionId),void 0!==e.functionHandleMetadata&&(t.functionHandleMetadata=FunctionHandleMetadata.toJSON(e.functionHandleMetadata)),t},create:e=>ClassMethod.fromPartial(e??{}),fromPartial(e){const t=createBaseClassMethod();return t.functionName=e.functionName??"",t.functionId=e.functionId??"",t.functionHandleMetadata=void 0!==e.functionHandleMetadata&&null!==e.functionHandleMetadata?FunctionHandleMetadata.fromPartial(e.functionHandleMetadata):void 0,t}};function createBaseClassParameterInfo(){return{format:0,schema:[]}}var ClassParameterInfo={encode(e,t=new BinaryWriter){0!==e.format&&t.uint32(8).int32(e.format);for(const n of e.schema)ClassParameterSpec.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClassParameterInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.format=n.int32();continue;case 2:if(18!==e)break;a.schema.push(ClassParameterSpec.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({format:isSet4(e.format)?classParameterInfo_ParameterSerializationFormatFromJSON(e.format):0,schema:globalThis.Array.isArray(e?.schema)?e.schema.map((e=>ClassParameterSpec.fromJSON(e))):[]}),toJSON(e){const t={};return 0!==e.format&&(t.format=classParameterInfo_ParameterSerializationFormatToJSON(e.format)),e.schema?.length&&(t.schema=e.schema.map((e=>ClassParameterSpec.toJSON(e)))),t},create:e=>ClassParameterInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseClassParameterInfo();return t.format=e.format??0,t.schema=e.schema?.map((e=>ClassParameterSpec.fromPartial(e)))||[],t}};function createBaseClassParameterSet(){return{parameters:[]}}var ClassParameterSet={encode(e,t=new BinaryWriter){for(const n of e.parameters)ClassParameterValue.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClassParameterSet();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.parameters.push(ClassParameterValue.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({parameters:globalThis.Array.isArray(e?.parameters)?e.parameters.map((e=>ClassParameterValue.fromJSON(e))):[]}),toJSON(e){const t={};return e.parameters?.length&&(t.parameters=e.parameters.map((e=>ClassParameterValue.toJSON(e)))),t},create:e=>ClassParameterSet.fromPartial(e??{}),fromPartial(e){const t=createBaseClassParameterSet();return t.parameters=e.parameters?.map((e=>ClassParameterValue.fromPartial(e)))||[],t}};function createBaseClassParameterSpec(){return{name:"",type:0,hasDefault:!1,stringDefault:void 0,intDefault:void 0,pickleDefault:void 0,bytesDefault:void 0,boolDefault:void 0,fullType:void 0}}var ClassParameterSpec={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),0!==e.type&&t.uint32(16).int32(e.type),!1!==e.hasDefault&&t.uint32(24).bool(e.hasDefault),void 0!==e.stringDefault&&t.uint32(34).string(e.stringDefault),void 0!==e.intDefault&&t.uint32(40).int64(e.intDefault),void 0!==e.pickleDefault&&t.uint32(50).bytes(e.pickleDefault),void 0!==e.bytesDefault&&t.uint32(58).bytes(e.bytesDefault),void 0!==e.boolDefault&&t.uint32(72).bool(e.boolDefault),void 0!==e.fullType&&GenericPayloadType.encode(e.fullType,t.uint32(66).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClassParameterSpec();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(16!==e)break;a.type=n.int32();continue;case 3:if(24!==e)break;a.hasDefault=n.bool();continue;case 4:if(34!==e)break;a.stringDefault=n.string();continue;case 5:if(40!==e)break;a.intDefault=longToNumber2(n.int64());continue;case 6:if(50!==e)break;a.pickleDefault=n.bytes();continue;case 7:if(58!==e)break;a.bytesDefault=n.bytes();continue;case 9:if(72!==e)break;a.boolDefault=n.bool();continue;case 8:if(66!==e)break;a.fullType=GenericPayloadType.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",type:isSet4(e.type)?parameterTypeFromJSON(e.type):0,hasDefault:!!isSet4(e.hasDefault)&&globalThis.Boolean(e.hasDefault),stringDefault:isSet4(e.stringDefault)?globalThis.String(e.stringDefault):void 0,intDefault:isSet4(e.intDefault)?globalThis.Number(e.intDefault):void 0,pickleDefault:isSet4(e.pickleDefault)?bytesFromBase64(e.pickleDefault):void 0,bytesDefault:isSet4(e.bytesDefault)?bytesFromBase64(e.bytesDefault):void 0,boolDefault:isSet4(e.boolDefault)?globalThis.Boolean(e.boolDefault):void 0,fullType:isSet4(e.fullType)?GenericPayloadType.fromJSON(e.fullType):void 0}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),0!==e.type&&(t.type=parameterTypeToJSON(e.type)),!1!==e.hasDefault&&(t.hasDefault=e.hasDefault),void 0!==e.stringDefault&&(t.stringDefault=e.stringDefault),void 0!==e.intDefault&&(t.intDefault=Math.round(e.intDefault)),void 0!==e.pickleDefault&&(t.pickleDefault=base64FromBytes(e.pickleDefault)),void 0!==e.bytesDefault&&(t.bytesDefault=base64FromBytes(e.bytesDefault)),void 0!==e.boolDefault&&(t.boolDefault=e.boolDefault),void 0!==e.fullType&&(t.fullType=GenericPayloadType.toJSON(e.fullType)),t},create:e=>ClassParameterSpec.fromPartial(e??{}),fromPartial(e){const t=createBaseClassParameterSpec();return t.name=e.name??"",t.type=e.type??0,t.hasDefault=e.hasDefault??!1,t.stringDefault=e.stringDefault??void 0,t.intDefault=e.intDefault??void 0,t.pickleDefault=e.pickleDefault??void 0,t.bytesDefault=e.bytesDefault??void 0,t.boolDefault=e.boolDefault??void 0,t.fullType=void 0!==e.fullType&&null!==e.fullType?GenericPayloadType.fromPartial(e.fullType):void 0,t}};function createBaseClassParameterValue(){return{name:"",type:0,stringValue:void 0,intValue:void 0,pickleValue:void 0,bytesValue:void 0,boolValue:void 0}}var ClassParameterValue={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),0!==e.type&&t.uint32(16).int32(e.type),void 0!==e.stringValue&&t.uint32(26).string(e.stringValue),void 0!==e.intValue&&t.uint32(32).int64(e.intValue),void 0!==e.pickleValue&&t.uint32(42).bytes(e.pickleValue),void 0!==e.bytesValue&&t.uint32(50).bytes(e.bytesValue),void 0!==e.boolValue&&t.uint32(56).bool(e.boolValue),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClassParameterValue();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(16!==e)break;a.type=n.int32();continue;case 3:if(26!==e)break;a.stringValue=n.string();continue;case 4:if(32!==e)break;a.intValue=longToNumber2(n.int64());continue;case 5:if(42!==e)break;a.pickleValue=n.bytes();continue;case 6:if(50!==e)break;a.bytesValue=n.bytes();continue;case 7:if(56!==e)break;a.boolValue=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",type:isSet4(e.type)?parameterTypeFromJSON(e.type):0,stringValue:isSet4(e.stringValue)?globalThis.String(e.stringValue):void 0,intValue:isSet4(e.intValue)?globalThis.Number(e.intValue):void 0,pickleValue:isSet4(e.pickleValue)?bytesFromBase64(e.pickleValue):void 0,bytesValue:isSet4(e.bytesValue)?bytesFromBase64(e.bytesValue):void 0,boolValue:isSet4(e.boolValue)?globalThis.Boolean(e.boolValue):void 0}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),0!==e.type&&(t.type=parameterTypeToJSON(e.type)),void 0!==e.stringValue&&(t.stringValue=e.stringValue),void 0!==e.intValue&&(t.intValue=Math.round(e.intValue)),void 0!==e.pickleValue&&(t.pickleValue=base64FromBytes(e.pickleValue)),void 0!==e.bytesValue&&(t.bytesValue=base64FromBytes(e.bytesValue)),void 0!==e.boolValue&&(t.boolValue=e.boolValue),t},create:e=>ClassParameterValue.fromPartial(e??{}),fromPartial(e){const t=createBaseClassParameterValue();return t.name=e.name??"",t.type=e.type??0,t.stringValue=e.stringValue??void 0,t.intValue=e.intValue??void 0,t.pickleValue=e.pickleValue??void 0,t.bytesValue=e.bytesValue??void 0,t.boolValue=e.boolValue??void 0,t}};function createBaseClientHelloResponse(){return{warning:"",imageBuilderVersion:"",serverWarnings:[]}}var ClientHelloResponse={encode(e,t=new BinaryWriter){""!==e.warning&&t.uint32(10).string(e.warning),""!==e.imageBuilderVersion&&t.uint32(18).string(e.imageBuilderVersion);for(const n of e.serverWarnings)Warning.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClientHelloResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.warning=n.string();continue;case 2:if(18!==e)break;a.imageBuilderVersion=n.string();continue;case 4:if(34!==e)break;a.serverWarnings.push(Warning.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({warning:isSet4(e.warning)?globalThis.String(e.warning):"",imageBuilderVersion:isSet4(e.imageBuilderVersion)?globalThis.String(e.imageBuilderVersion):"",serverWarnings:globalThis.Array.isArray(e?.serverWarnings)?e.serverWarnings.map((e=>Warning.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.warning&&(t.warning=e.warning),""!==e.imageBuilderVersion&&(t.imageBuilderVersion=e.imageBuilderVersion),e.serverWarnings?.length&&(t.serverWarnings=e.serverWarnings.map((e=>Warning.toJSON(e)))),t},create:e=>ClientHelloResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseClientHelloResponse();return t.warning=e.warning??"",t.imageBuilderVersion=e.imageBuilderVersion??"",t.serverWarnings=e.serverWarnings?.map((e=>Warning.fromPartial(e)))||[],t}};function createBaseCloudBucketMount(){return{bucketName:"",mountPath:"",credentialsSecretId:"",readOnly:!1,bucketType:0,requesterPays:!1,bucketEndpointUrl:void 0,keyPrefix:void 0,oidcAuthRoleArn:void 0,forcePathStyle:!1,metadataTtlType:void 0,metadataTtlSeconds:void 0}}var CloudBucketMount={encode:(e,t=new BinaryWriter)=>(""!==e.bucketName&&t.uint32(10).string(e.bucketName),""!==e.mountPath&&t.uint32(18).string(e.mountPath),""!==e.credentialsSecretId&&t.uint32(26).string(e.credentialsSecretId),!1!==e.readOnly&&t.uint32(32).bool(e.readOnly),0!==e.bucketType&&t.uint32(40).int32(e.bucketType),!1!==e.requesterPays&&t.uint32(48).bool(e.requesterPays),void 0!==e.bucketEndpointUrl&&t.uint32(58).string(e.bucketEndpointUrl),void 0!==e.keyPrefix&&t.uint32(66).string(e.keyPrefix),void 0!==e.oidcAuthRoleArn&&t.uint32(74).string(e.oidcAuthRoleArn),!1!==e.forcePathStyle&&t.uint32(80).bool(e.forcePathStyle),void 0!==e.metadataTtlType&&t.uint32(88).int32(e.metadataTtlType),void 0!==e.metadataTtlSeconds&&t.uint32(96).uint64(e.metadataTtlSeconds),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseCloudBucketMount();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.bucketName=n.string();continue;case 2:if(18!==e)break;a.mountPath=n.string();continue;case 3:if(26!==e)break;a.credentialsSecretId=n.string();continue;case 4:if(32!==e)break;a.readOnly=n.bool();continue;case 5:if(40!==e)break;a.bucketType=n.int32();continue;case 6:if(48!==e)break;a.requesterPays=n.bool();continue;case 7:if(58!==e)break;a.bucketEndpointUrl=n.string();continue;case 8:if(66!==e)break;a.keyPrefix=n.string();continue;case 9:if(74!==e)break;a.oidcAuthRoleArn=n.string();continue;case 10:if(80!==e)break;a.forcePathStyle=n.bool();continue;case 11:if(88!==e)break;a.metadataTtlType=n.int32();continue;case 12:if(96!==e)break;a.metadataTtlSeconds=longToNumber2(n.uint64());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({bucketName:isSet4(e.bucketName)?globalThis.String(e.bucketName):"",mountPath:isSet4(e.mountPath)?globalThis.String(e.mountPath):"",credentialsSecretId:isSet4(e.credentialsSecretId)?globalThis.String(e.credentialsSecretId):"",readOnly:!!isSet4(e.readOnly)&&globalThis.Boolean(e.readOnly),bucketType:isSet4(e.bucketType)?cloudBucketMount_BucketTypeFromJSON(e.bucketType):0,requesterPays:!!isSet4(e.requesterPays)&&globalThis.Boolean(e.requesterPays),bucketEndpointUrl:isSet4(e.bucketEndpointUrl)?globalThis.String(e.bucketEndpointUrl):void 0,keyPrefix:isSet4(e.keyPrefix)?globalThis.String(e.keyPrefix):void 0,oidcAuthRoleArn:isSet4(e.oidcAuthRoleArn)?globalThis.String(e.oidcAuthRoleArn):void 0,forcePathStyle:!!isSet4(e.forcePathStyle)&&globalThis.Boolean(e.forcePathStyle),metadataTtlType:isSet4(e.metadataTtlType)?cloudBucketMount_MetadataTTLTypeFromJSON(e.metadataTtlType):void 0,metadataTtlSeconds:isSet4(e.metadataTtlSeconds)?globalThis.Number(e.metadataTtlSeconds):void 0}),toJSON(e){const t={};return""!==e.bucketName&&(t.bucketName=e.bucketName),""!==e.mountPath&&(t.mountPath=e.mountPath),""!==e.credentialsSecretId&&(t.credentialsSecretId=e.credentialsSecretId),!1!==e.readOnly&&(t.readOnly=e.readOnly),0!==e.bucketType&&(t.bucketType=cloudBucketMount_BucketTypeToJSON(e.bucketType)),!1!==e.requesterPays&&(t.requesterPays=e.requesterPays),void 0!==e.bucketEndpointUrl&&(t.bucketEndpointUrl=e.bucketEndpointUrl),void 0!==e.keyPrefix&&(t.keyPrefix=e.keyPrefix),void 0!==e.oidcAuthRoleArn&&(t.oidcAuthRoleArn=e.oidcAuthRoleArn),!1!==e.forcePathStyle&&(t.forcePathStyle=e.forcePathStyle),void 0!==e.metadataTtlType&&(t.metadataTtlType=cloudBucketMount_MetadataTTLTypeToJSON(e.metadataTtlType)),void 0!==e.metadataTtlSeconds&&(t.metadataTtlSeconds=Math.round(e.metadataTtlSeconds)),t},create:e=>CloudBucketMount.fromPartial(e??{}),fromPartial(e){const t=createBaseCloudBucketMount();return t.bucketName=e.bucketName??"",t.mountPath=e.mountPath??"",t.credentialsSecretId=e.credentialsSecretId??"",t.readOnly=e.readOnly??!1,t.bucketType=e.bucketType??0,t.requesterPays=e.requesterPays??!1,t.bucketEndpointUrl=e.bucketEndpointUrl??void 0,t.keyPrefix=e.keyPrefix??void 0,t.oidcAuthRoleArn=e.oidcAuthRoleArn??void 0,t.forcePathStyle=e.forcePathStyle??!1,t.metadataTtlType=e.metadataTtlType??void 0,t.metadataTtlSeconds=e.metadataTtlSeconds??void 0,t}};function createBaseClusterGetRequest(){return{clusterId:""}}var ClusterGetRequest={encode:(e,t=new BinaryWriter)=>(""!==e.clusterId&&t.uint32(10).string(e.clusterId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClusterGetRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.clusterId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({clusterId:isSet4(e.clusterId)?globalThis.String(e.clusterId):""}),toJSON(e){const t={};return""!==e.clusterId&&(t.clusterId=e.clusterId),t},create:e=>ClusterGetRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseClusterGetRequest();return t.clusterId=e.clusterId??"",t}};function createBaseClusterGetResponse(){return{cluster:void 0}}var ClusterGetResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.cluster&&ClusterStats.encode(e.cluster,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClusterGetResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.cluster=ClusterStats.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({cluster:isSet4(e.cluster)?ClusterStats.fromJSON(e.cluster):void 0}),toJSON(e){const t={};return void 0!==e.cluster&&(t.cluster=ClusterStats.toJSON(e.cluster)),t},create:e=>ClusterGetResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseClusterGetResponse();return t.cluster=void 0!==e.cluster&&null!==e.cluster?ClusterStats.fromPartial(e.cluster):void 0,t}};function createBaseClusterListRequest(){return{environmentName:""}}var ClusterListRequest={encode:(e,t=new BinaryWriter)=>(""!==e.environmentName&&t.uint32(10).string(e.environmentName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClusterListRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>ClusterListRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseClusterListRequest();return t.environmentName=e.environmentName??"",t}};function createBaseClusterListResponse(){return{clusters:[]}}var ClusterListResponse={encode(e,t=new BinaryWriter){for(const n of e.clusters)ClusterStats.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClusterListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.clusters.push(ClusterStats.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({clusters:globalThis.Array.isArray(e?.clusters)?e.clusters.map((e=>ClusterStats.fromJSON(e))):[]}),toJSON(e){const t={};return e.clusters?.length&&(t.clusters=e.clusters.map((e=>ClusterStats.toJSON(e)))),t},create:e=>ClusterListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseClusterListResponse();return t.clusters=e.clusters?.map((e=>ClusterStats.fromPartial(e)))||[],t}};function createBaseClusterStats(){return{appId:"",taskIds:[],clusterId:"",startedAt:0}}var ClusterStats={encode(e,t=new BinaryWriter){""!==e.appId&&t.uint32(10).string(e.appId);for(const n of e.taskIds)t.uint32(18).string(n);return""!==e.clusterId&&t.uint32(26).string(e.clusterId),0!==e.startedAt&&t.uint32(33).double(e.startedAt),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseClusterStats();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(18!==e)break;a.taskIds.push(n.string());continue;case 3:if(26!==e)break;a.clusterId=n.string();continue;case 4:if(33!==e)break;a.startedAt=n.double();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",taskIds:globalThis.Array.isArray(e?.taskIds)?e.taskIds.map((e=>globalThis.String(e))):[],clusterId:isSet4(e.clusterId)?globalThis.String(e.clusterId):"",startedAt:isSet4(e.startedAt)?globalThis.Number(e.startedAt):0}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),e.taskIds?.length&&(t.taskIds=e.taskIds),""!==e.clusterId&&(t.clusterId=e.clusterId),0!==e.startedAt&&(t.startedAt=e.startedAt),t},create:e=>ClusterStats.fromPartial(e??{}),fromPartial(e){const t=createBaseClusterStats();return t.appId=e.appId??"",t.taskIds=e.taskIds?.map((e=>e))||[],t.clusterId=e.clusterId??"",t.startedAt=e.startedAt??0,t}};function createBaseCommitInfo(){return{vcs:"",branch:"",commitHash:"",commitTimestamp:0,dirty:!1,authorName:"",authorEmail:"",repoUrl:""}}var CommitInfo={encode:(e,t=new BinaryWriter)=>(""!==e.vcs&&t.uint32(10).string(e.vcs),""!==e.branch&&t.uint32(18).string(e.branch),""!==e.commitHash&&t.uint32(26).string(e.commitHash),0!==e.commitTimestamp&&t.uint32(32).int64(e.commitTimestamp),!1!==e.dirty&&t.uint32(40).bool(e.dirty),""!==e.authorName&&t.uint32(50).string(e.authorName),""!==e.authorEmail&&t.uint32(58).string(e.authorEmail),""!==e.repoUrl&&t.uint32(66).string(e.repoUrl),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseCommitInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.vcs=n.string();continue;case 2:if(18!==e)break;a.branch=n.string();continue;case 3:if(26!==e)break;a.commitHash=n.string();continue;case 4:if(32!==e)break;a.commitTimestamp=longToNumber2(n.int64());continue;case 5:if(40!==e)break;a.dirty=n.bool();continue;case 6:if(50!==e)break;a.authorName=n.string();continue;case 7:if(58!==e)break;a.authorEmail=n.string();continue;case 8:if(66!==e)break;a.repoUrl=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({vcs:isSet4(e.vcs)?globalThis.String(e.vcs):"",branch:isSet4(e.branch)?globalThis.String(e.branch):"",commitHash:isSet4(e.commitHash)?globalThis.String(e.commitHash):"",commitTimestamp:isSet4(e.commitTimestamp)?globalThis.Number(e.commitTimestamp):0,dirty:!!isSet4(e.dirty)&&globalThis.Boolean(e.dirty),authorName:isSet4(e.authorName)?globalThis.String(e.authorName):"",authorEmail:isSet4(e.authorEmail)?globalThis.String(e.authorEmail):"",repoUrl:isSet4(e.repoUrl)?globalThis.String(e.repoUrl):""}),toJSON(e){const t={};return""!==e.vcs&&(t.vcs=e.vcs),""!==e.branch&&(t.branch=e.branch),""!==e.commitHash&&(t.commitHash=e.commitHash),0!==e.commitTimestamp&&(t.commitTimestamp=Math.round(e.commitTimestamp)),!1!==e.dirty&&(t.dirty=e.dirty),""!==e.authorName&&(t.authorName=e.authorName),""!==e.authorEmail&&(t.authorEmail=e.authorEmail),""!==e.repoUrl&&(t.repoUrl=e.repoUrl),t},create:e=>CommitInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseCommitInfo();return t.vcs=e.vcs??"",t.branch=e.branch??"",t.commitHash=e.commitHash??"",t.commitTimestamp=e.commitTimestamp??0,t.dirty=e.dirty??!1,t.authorName=e.authorName??"",t.authorEmail=e.authorEmail??"",t.repoUrl=e.repoUrl??"",t}};function createBaseContainerCheckpointRequest(){return{checkpointId:""}}var ContainerCheckpointRequest={encode:(e,t=new BinaryWriter)=>(""!==e.checkpointId&&t.uint32(10).string(e.checkpointId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerCheckpointRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.checkpointId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({checkpointId:isSet4(e.checkpointId)?globalThis.String(e.checkpointId):""}),toJSON(e){const t={};return""!==e.checkpointId&&(t.checkpointId=e.checkpointId),t},create:e=>ContainerCheckpointRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerCheckpointRequest();return t.checkpointId=e.checkpointId??"",t}};function createBaseContainerExecGetOutputRequest(){return{execId:"",timeout:0,lastBatchIndex:0,fileDescriptor:0,getRawBytes:!1}}var ContainerExecGetOutputRequest={encode:(e,t=new BinaryWriter)=>(""!==e.execId&&t.uint32(10).string(e.execId),0!==e.timeout&&t.uint32(21).float(e.timeout),0!==e.lastBatchIndex&&t.uint32(24).uint64(e.lastBatchIndex),0!==e.fileDescriptor&&t.uint32(32).int32(e.fileDescriptor),!1!==e.getRawBytes&&t.uint32(40).bool(e.getRawBytes),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerExecGetOutputRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.execId=n.string();continue;case 2:if(21!==e)break;a.timeout=n.float();continue;case 3:if(24!==e)break;a.lastBatchIndex=longToNumber2(n.uint64());continue;case 4:if(32!==e)break;a.fileDescriptor=n.int32();continue;case 5:if(40!==e)break;a.getRawBytes=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({execId:isSet4(e.execId)?globalThis.String(e.execId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0,lastBatchIndex:isSet4(e.lastBatchIndex)?globalThis.Number(e.lastBatchIndex):0,fileDescriptor:isSet4(e.fileDescriptor)?fileDescriptorFromJSON(e.fileDescriptor):0,getRawBytes:!!isSet4(e.getRawBytes)&&globalThis.Boolean(e.getRawBytes)}),toJSON(e){const t={};return""!==e.execId&&(t.execId=e.execId),0!==e.timeout&&(t.timeout=e.timeout),0!==e.lastBatchIndex&&(t.lastBatchIndex=Math.round(e.lastBatchIndex)),0!==e.fileDescriptor&&(t.fileDescriptor=fileDescriptorToJSON(e.fileDescriptor)),!1!==e.getRawBytes&&(t.getRawBytes=e.getRawBytes),t},create:e=>ContainerExecGetOutputRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerExecGetOutputRequest();return t.execId=e.execId??"",t.timeout=e.timeout??0,t.lastBatchIndex=e.lastBatchIndex??0,t.fileDescriptor=e.fileDescriptor??0,t.getRawBytes=e.getRawBytes??!1,t}};function createBaseContainerExecPutInputRequest(){return{execId:"",input:void 0}}var ContainerExecPutInputRequest={encode:(e,t=new BinaryWriter)=>(""!==e.execId&&t.uint32(10).string(e.execId),void 0!==e.input&&RuntimeInputMessage.encode(e.input,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerExecPutInputRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.execId=n.string();continue;case 2:if(18!==e)break;a.input=RuntimeInputMessage.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({execId:isSet4(e.execId)?globalThis.String(e.execId):"",input:isSet4(e.input)?RuntimeInputMessage.fromJSON(e.input):void 0}),toJSON(e){const t={};return""!==e.execId&&(t.execId=e.execId),void 0!==e.input&&(t.input=RuntimeInputMessage.toJSON(e.input)),t},create:e=>ContainerExecPutInputRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerExecPutInputRequest();return t.execId=e.execId??"",t.input=void 0!==e.input&&null!==e.input?RuntimeInputMessage.fromPartial(e.input):void 0,t}};function createBaseContainerExecRequest(){return{taskId:"",command:[],ptyInfo:void 0,terminateContainerOnExit:!1,runtimeDebug:!1,stdoutOutput:0,stderrOutput:0,timeoutSecs:0,workdir:void 0,secretIds:[]}}var ContainerExecRequest={encode(e,t=new BinaryWriter){""!==e.taskId&&t.uint32(10).string(e.taskId);for(const n of e.command)t.uint32(18).string(n);void 0!==e.ptyInfo&&PTYInfo.encode(e.ptyInfo,t.uint32(26).fork()).join(),!1!==e.terminateContainerOnExit&&t.uint32(32).bool(e.terminateContainerOnExit),!1!==e.runtimeDebug&&t.uint32(40).bool(e.runtimeDebug),0!==e.stdoutOutput&&t.uint32(48).int32(e.stdoutOutput),0!==e.stderrOutput&&t.uint32(56).int32(e.stderrOutput),0!==e.timeoutSecs&&t.uint32(64).uint32(e.timeoutSecs),void 0!==e.workdir&&t.uint32(74).string(e.workdir);for(const n of e.secretIds)t.uint32(82).string(n);return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerExecRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.command.push(n.string());continue;case 3:if(26!==e)break;a.ptyInfo=PTYInfo.decode(n,n.uint32());continue;case 4:if(32!==e)break;a.terminateContainerOnExit=n.bool();continue;case 5:if(40!==e)break;a.runtimeDebug=n.bool();continue;case 6:if(48!==e)break;a.stdoutOutput=n.int32();continue;case 7:if(56!==e)break;a.stderrOutput=n.int32();continue;case 8:if(64!==e)break;a.timeoutSecs=n.uint32();continue;case 9:if(74!==e)break;a.workdir=n.string();continue;case 10:if(82!==e)break;a.secretIds.push(n.string());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet4(e.taskId)?globalThis.String(e.taskId):"",command:globalThis.Array.isArray(e?.command)?e.command.map((e=>globalThis.String(e))):[],ptyInfo:isSet4(e.ptyInfo)?PTYInfo.fromJSON(e.ptyInfo):void 0,terminateContainerOnExit:!!isSet4(e.terminateContainerOnExit)&&globalThis.Boolean(e.terminateContainerOnExit),runtimeDebug:!!isSet4(e.runtimeDebug)&&globalThis.Boolean(e.runtimeDebug),stdoutOutput:isSet4(e.stdoutOutput)?execOutputOptionFromJSON(e.stdoutOutput):0,stderrOutput:isSet4(e.stderrOutput)?execOutputOptionFromJSON(e.stderrOutput):0,timeoutSecs:isSet4(e.timeoutSecs)?globalThis.Number(e.timeoutSecs):0,workdir:isSet4(e.workdir)?globalThis.String(e.workdir):void 0,secretIds:globalThis.Array.isArray(e?.secretIds)?e.secretIds.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),e.command?.length&&(t.command=e.command),void 0!==e.ptyInfo&&(t.ptyInfo=PTYInfo.toJSON(e.ptyInfo)),!1!==e.terminateContainerOnExit&&(t.terminateContainerOnExit=e.terminateContainerOnExit),!1!==e.runtimeDebug&&(t.runtimeDebug=e.runtimeDebug),0!==e.stdoutOutput&&(t.stdoutOutput=execOutputOptionToJSON(e.stdoutOutput)),0!==e.stderrOutput&&(t.stderrOutput=execOutputOptionToJSON(e.stderrOutput)),0!==e.timeoutSecs&&(t.timeoutSecs=Math.round(e.timeoutSecs)),void 0!==e.workdir&&(t.workdir=e.workdir),e.secretIds?.length&&(t.secretIds=e.secretIds),t},create:e=>ContainerExecRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerExecRequest();return t.taskId=e.taskId??"",t.command=e.command?.map((e=>e))||[],t.ptyInfo=void 0!==e.ptyInfo&&null!==e.ptyInfo?PTYInfo.fromPartial(e.ptyInfo):void 0,t.terminateContainerOnExit=e.terminateContainerOnExit??!1,t.runtimeDebug=e.runtimeDebug??!1,t.stdoutOutput=e.stdoutOutput??0,t.stderrOutput=e.stderrOutput??0,t.timeoutSecs=e.timeoutSecs??0,t.workdir=e.workdir??void 0,t.secretIds=e.secretIds?.map((e=>e))||[],t}};function createBaseContainerExecResponse(){return{execId:""}}var ContainerExecResponse={encode:(e,t=new BinaryWriter)=>(""!==e.execId&&t.uint32(10).string(e.execId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerExecResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.execId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({execId:isSet4(e.execId)?globalThis.String(e.execId):""}),toJSON(e){const t={};return""!==e.execId&&(t.execId=e.execId),t},create:e=>ContainerExecResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerExecResponse();return t.execId=e.execId??"",t}};function createBaseContainerExecWaitRequest(){return{execId:"",timeout:0}}var ContainerExecWaitRequest={encode:(e,t=new BinaryWriter)=>(""!==e.execId&&t.uint32(10).string(e.execId),0!==e.timeout&&t.uint32(21).float(e.timeout),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerExecWaitRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.execId=n.string();continue;case 2:if(21!==e)break;a.timeout=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({execId:isSet4(e.execId)?globalThis.String(e.execId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0}),toJSON(e){const t={};return""!==e.execId&&(t.execId=e.execId),0!==e.timeout&&(t.timeout=e.timeout),t},create:e=>ContainerExecWaitRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerExecWaitRequest();return t.execId=e.execId??"",t.timeout=e.timeout??0,t}};function createBaseContainerExecWaitResponse(){return{exitCode:void 0,completed:!1}}var ContainerExecWaitResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.exitCode&&t.uint32(8).int32(e.exitCode),!1!==e.completed&&t.uint32(16).bool(e.completed),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerExecWaitResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.exitCode=n.int32();continue;case 2:if(16!==e)break;a.completed=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({exitCode:isSet4(e.exitCode)?globalThis.Number(e.exitCode):void 0,completed:!!isSet4(e.completed)&&globalThis.Boolean(e.completed)}),toJSON(e){const t={};return void 0!==e.exitCode&&(t.exitCode=Math.round(e.exitCode)),!1!==e.completed&&(t.completed=e.completed),t},create:e=>ContainerExecWaitResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerExecWaitResponse();return t.exitCode=e.exitCode??void 0,t.completed=e.completed??!1,t}};function createBaseContainerFileCloseRequest(){return{fileDescriptor:""}}var ContainerFileCloseRequest={encode:(e,t=new BinaryWriter)=>(""!==e.fileDescriptor&&t.uint32(10).string(e.fileDescriptor),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFileCloseRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.fileDescriptor=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({fileDescriptor:isSet4(e.fileDescriptor)?globalThis.String(e.fileDescriptor):""}),toJSON(e){const t={};return""!==e.fileDescriptor&&(t.fileDescriptor=e.fileDescriptor),t},create:e=>ContainerFileCloseRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFileCloseRequest();return t.fileDescriptor=e.fileDescriptor??"",t}};function createBaseContainerFileDeleteBytesRequest(){return{fileDescriptor:"",startInclusive:void 0,endExclusive:void 0}}var ContainerFileDeleteBytesRequest={encode:(e,t=new BinaryWriter)=>(""!==e.fileDescriptor&&t.uint32(10).string(e.fileDescriptor),void 0!==e.startInclusive&&t.uint32(16).uint32(e.startInclusive),void 0!==e.endExclusive&&t.uint32(24).uint32(e.endExclusive),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFileDeleteBytesRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.fileDescriptor=n.string();continue;case 2:if(16!==e)break;a.startInclusive=n.uint32();continue;case 3:if(24!==e)break;a.endExclusive=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({fileDescriptor:isSet4(e.fileDescriptor)?globalThis.String(e.fileDescriptor):"",startInclusive:isSet4(e.startInclusive)?globalThis.Number(e.startInclusive):void 0,endExclusive:isSet4(e.endExclusive)?globalThis.Number(e.endExclusive):void 0}),toJSON(e){const t={};return""!==e.fileDescriptor&&(t.fileDescriptor=e.fileDescriptor),void 0!==e.startInclusive&&(t.startInclusive=Math.round(e.startInclusive)),void 0!==e.endExclusive&&(t.endExclusive=Math.round(e.endExclusive)),t},create:e=>ContainerFileDeleteBytesRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFileDeleteBytesRequest();return t.fileDescriptor=e.fileDescriptor??"",t.startInclusive=e.startInclusive??void 0,t.endExclusive=e.endExclusive??void 0,t}};function createBaseContainerFileFlushRequest(){return{fileDescriptor:""}}var ContainerFileFlushRequest={encode:(e,t=new BinaryWriter)=>(""!==e.fileDescriptor&&t.uint32(10).string(e.fileDescriptor),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFileFlushRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.fileDescriptor=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({fileDescriptor:isSet4(e.fileDescriptor)?globalThis.String(e.fileDescriptor):""}),toJSON(e){const t={};return""!==e.fileDescriptor&&(t.fileDescriptor=e.fileDescriptor),t},create:e=>ContainerFileFlushRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFileFlushRequest();return t.fileDescriptor=e.fileDescriptor??"",t}};function createBaseContainerFileLsRequest(){return{path:""}}var ContainerFileLsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.path&&t.uint32(10).string(e.path),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFileLsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.path=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({path:isSet4(e.path)?globalThis.String(e.path):""}),toJSON(e){const t={};return""!==e.path&&(t.path=e.path),t},create:e=>ContainerFileLsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFileLsRequest();return t.path=e.path??"",t}};function createBaseContainerFileMkdirRequest(){return{path:"",makeParents:!1}}var ContainerFileMkdirRequest={encode:(e,t=new BinaryWriter)=>(""!==e.path&&t.uint32(10).string(e.path),!1!==e.makeParents&&t.uint32(16).bool(e.makeParents),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFileMkdirRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.path=n.string();continue;case 2:if(16!==e)break;a.makeParents=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({path:isSet4(e.path)?globalThis.String(e.path):"",makeParents:!!isSet4(e.makeParents)&&globalThis.Boolean(e.makeParents)}),toJSON(e){const t={};return""!==e.path&&(t.path=e.path),!1!==e.makeParents&&(t.makeParents=e.makeParents),t},create:e=>ContainerFileMkdirRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFileMkdirRequest();return t.path=e.path??"",t.makeParents=e.makeParents??!1,t}};function createBaseContainerFileOpenRequest(){return{fileDescriptor:void 0,path:"",mode:""}}var ContainerFileOpenRequest={encode:(e,t=new BinaryWriter)=>(void 0!==e.fileDescriptor&&t.uint32(10).string(e.fileDescriptor),""!==e.path&&t.uint32(18).string(e.path),""!==e.mode&&t.uint32(26).string(e.mode),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFileOpenRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.fileDescriptor=n.string();continue;case 2:if(18!==e)break;a.path=n.string();continue;case 3:if(26!==e)break;a.mode=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({fileDescriptor:isSet4(e.fileDescriptor)?globalThis.String(e.fileDescriptor):void 0,path:isSet4(e.path)?globalThis.String(e.path):"",mode:isSet4(e.mode)?globalThis.String(e.mode):""}),toJSON(e){const t={};return void 0!==e.fileDescriptor&&(t.fileDescriptor=e.fileDescriptor),""!==e.path&&(t.path=e.path),""!==e.mode&&(t.mode=e.mode),t},create:e=>ContainerFileOpenRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFileOpenRequest();return t.fileDescriptor=e.fileDescriptor??void 0,t.path=e.path??"",t.mode=e.mode??"",t}};function createBaseContainerFileReadLineRequest(){return{fileDescriptor:""}}var ContainerFileReadLineRequest={encode:(e,t=new BinaryWriter)=>(""!==e.fileDescriptor&&t.uint32(10).string(e.fileDescriptor),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFileReadLineRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.fileDescriptor=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({fileDescriptor:isSet4(e.fileDescriptor)?globalThis.String(e.fileDescriptor):""}),toJSON(e){const t={};return""!==e.fileDescriptor&&(t.fileDescriptor=e.fileDescriptor),t},create:e=>ContainerFileReadLineRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFileReadLineRequest();return t.fileDescriptor=e.fileDescriptor??"",t}};function createBaseContainerFileReadRequest(){return{fileDescriptor:"",n:void 0}}var ContainerFileReadRequest={encode:(e,t=new BinaryWriter)=>(""!==e.fileDescriptor&&t.uint32(10).string(e.fileDescriptor),void 0!==e.n&&t.uint32(16).uint32(e.n),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFileReadRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.fileDescriptor=n.string();continue;case 2:if(16!==e)break;a.n=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({fileDescriptor:isSet4(e.fileDescriptor)?globalThis.String(e.fileDescriptor):"",n:isSet4(e.n)?globalThis.Number(e.n):void 0}),toJSON(e){const t={};return""!==e.fileDescriptor&&(t.fileDescriptor=e.fileDescriptor),void 0!==e.n&&(t.n=Math.round(e.n)),t},create:e=>ContainerFileReadRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFileReadRequest();return t.fileDescriptor=e.fileDescriptor??"",t.n=e.n??void 0,t}};function createBaseContainerFileRmRequest(){return{path:"",recursive:!1}}var ContainerFileRmRequest={encode:(e,t=new BinaryWriter)=>(""!==e.path&&t.uint32(10).string(e.path),!1!==e.recursive&&t.uint32(16).bool(e.recursive),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFileRmRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.path=n.string();continue;case 2:if(16!==e)break;a.recursive=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({path:isSet4(e.path)?globalThis.String(e.path):"",recursive:!!isSet4(e.recursive)&&globalThis.Boolean(e.recursive)}),toJSON(e){const t={};return""!==e.path&&(t.path=e.path),!1!==e.recursive&&(t.recursive=e.recursive),t},create:e=>ContainerFileRmRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFileRmRequest();return t.path=e.path??"",t.recursive=e.recursive??!1,t}};function createBaseContainerFileSeekRequest(){return{fileDescriptor:"",offset:0,whence:0}}var ContainerFileSeekRequest={encode:(e,t=new BinaryWriter)=>(""!==e.fileDescriptor&&t.uint32(10).string(e.fileDescriptor),0!==e.offset&&t.uint32(16).int32(e.offset),0!==e.whence&&t.uint32(24).int32(e.whence),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFileSeekRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.fileDescriptor=n.string();continue;case 2:if(16!==e)break;a.offset=n.int32();continue;case 3:if(24!==e)break;a.whence=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({fileDescriptor:isSet4(e.fileDescriptor)?globalThis.String(e.fileDescriptor):"",offset:isSet4(e.offset)?globalThis.Number(e.offset):0,whence:isSet4(e.whence)?seekWhenceFromJSON(e.whence):0}),toJSON(e){const t={};return""!==e.fileDescriptor&&(t.fileDescriptor=e.fileDescriptor),0!==e.offset&&(t.offset=Math.round(e.offset)),0!==e.whence&&(t.whence=seekWhenceToJSON(e.whence)),t},create:e=>ContainerFileSeekRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFileSeekRequest();return t.fileDescriptor=e.fileDescriptor??"",t.offset=e.offset??0,t.whence=e.whence??0,t}};function createBaseContainerFileWatchRequest(){return{path:"",recursive:!1,timeoutSecs:void 0}}var ContainerFileWatchRequest={encode:(e,t=new BinaryWriter)=>(""!==e.path&&t.uint32(10).string(e.path),!1!==e.recursive&&t.uint32(16).bool(e.recursive),void 0!==e.timeoutSecs&&t.uint32(24).uint64(e.timeoutSecs),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFileWatchRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.path=n.string();continue;case 2:if(16!==e)break;a.recursive=n.bool();continue;case 3:if(24!==e)break;a.timeoutSecs=longToNumber2(n.uint64());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({path:isSet4(e.path)?globalThis.String(e.path):"",recursive:!!isSet4(e.recursive)&&globalThis.Boolean(e.recursive),timeoutSecs:isSet4(e.timeoutSecs)?globalThis.Number(e.timeoutSecs):void 0}),toJSON(e){const t={};return""!==e.path&&(t.path=e.path),!1!==e.recursive&&(t.recursive=e.recursive),void 0!==e.timeoutSecs&&(t.timeoutSecs=Math.round(e.timeoutSecs)),t},create:e=>ContainerFileWatchRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFileWatchRequest();return t.path=e.path??"",t.recursive=e.recursive??!1,t.timeoutSecs=e.timeoutSecs??void 0,t}};function createBaseContainerFileWriteReplaceBytesRequest(){return{fileDescriptor:"",data:new Uint8Array(0),startInclusive:void 0,endExclusive:void 0}}var ContainerFileWriteReplaceBytesRequest={encode:(e,t=new BinaryWriter)=>(""!==e.fileDescriptor&&t.uint32(10).string(e.fileDescriptor),0!==e.data.length&&t.uint32(18).bytes(e.data),void 0!==e.startInclusive&&t.uint32(24).uint32(e.startInclusive),void 0!==e.endExclusive&&t.uint32(32).uint32(e.endExclusive),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFileWriteReplaceBytesRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.fileDescriptor=n.string();continue;case 2:if(18!==e)break;a.data=n.bytes();continue;case 3:if(24!==e)break;a.startInclusive=n.uint32();continue;case 4:if(32!==e)break;a.endExclusive=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({fileDescriptor:isSet4(e.fileDescriptor)?globalThis.String(e.fileDescriptor):"",data:isSet4(e.data)?bytesFromBase64(e.data):new Uint8Array(0),startInclusive:isSet4(e.startInclusive)?globalThis.Number(e.startInclusive):void 0,endExclusive:isSet4(e.endExclusive)?globalThis.Number(e.endExclusive):void 0}),toJSON(e){const t={};return""!==e.fileDescriptor&&(t.fileDescriptor=e.fileDescriptor),0!==e.data.length&&(t.data=base64FromBytes(e.data)),void 0!==e.startInclusive&&(t.startInclusive=Math.round(e.startInclusive)),void 0!==e.endExclusive&&(t.endExclusive=Math.round(e.endExclusive)),t},create:e=>ContainerFileWriteReplaceBytesRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFileWriteReplaceBytesRequest();return t.fileDescriptor=e.fileDescriptor??"",t.data=e.data??new Uint8Array(0),t.startInclusive=e.startInclusive??void 0,t.endExclusive=e.endExclusive??void 0,t}};function createBaseContainerFileWriteRequest(){return{fileDescriptor:"",data:new Uint8Array(0)}}var ContainerFileWriteRequest={encode:(e,t=new BinaryWriter)=>(""!==e.fileDescriptor&&t.uint32(10).string(e.fileDescriptor),0!==e.data.length&&t.uint32(18).bytes(e.data),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFileWriteRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.fileDescriptor=n.string();continue;case 2:if(18!==e)break;a.data=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({fileDescriptor:isSet4(e.fileDescriptor)?globalThis.String(e.fileDescriptor):"",data:isSet4(e.data)?bytesFromBase64(e.data):new Uint8Array(0)}),toJSON(e){const t={};return""!==e.fileDescriptor&&(t.fileDescriptor=e.fileDescriptor),0!==e.data.length&&(t.data=base64FromBytes(e.data)),t},create:e=>ContainerFileWriteRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFileWriteRequest();return t.fileDescriptor=e.fileDescriptor??"",t.data=e.data??new Uint8Array(0),t}};function createBaseContainerFilesystemExecGetOutputRequest(){return{execId:"",timeout:0}}var ContainerFilesystemExecGetOutputRequest={encode:(e,t=new BinaryWriter)=>(""!==e.execId&&t.uint32(10).string(e.execId),0!==e.timeout&&t.uint32(21).float(e.timeout),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFilesystemExecGetOutputRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.execId=n.string();continue;case 2:if(21!==e)break;a.timeout=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({execId:isSet4(e.execId)?globalThis.String(e.execId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0}),toJSON(e){const t={};return""!==e.execId&&(t.execId=e.execId),0!==e.timeout&&(t.timeout=e.timeout),t},create:e=>ContainerFilesystemExecGetOutputRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFilesystemExecGetOutputRequest();return t.execId=e.execId??"",t.timeout=e.timeout??0,t}};function createBaseContainerFilesystemExecRequest(){return{fileOpenRequest:void 0,fileWriteRequest:void 0,fileReadRequest:void 0,fileFlushRequest:void 0,fileReadLineRequest:void 0,fileSeekRequest:void 0,fileDeleteBytesRequest:void 0,fileWriteReplaceBytesRequest:void 0,fileCloseRequest:void 0,fileLsRequest:void 0,fileMkdirRequest:void 0,fileRmRequest:void 0,fileWatchRequest:void 0,taskId:""}}var ContainerFilesystemExecRequest={encode:(e,t=new BinaryWriter)=>(void 0!==e.fileOpenRequest&&ContainerFileOpenRequest.encode(e.fileOpenRequest,t.uint32(10).fork()).join(),void 0!==e.fileWriteRequest&&ContainerFileWriteRequest.encode(e.fileWriteRequest,t.uint32(18).fork()).join(),void 0!==e.fileReadRequest&&ContainerFileReadRequest.encode(e.fileReadRequest,t.uint32(26).fork()).join(),void 0!==e.fileFlushRequest&&ContainerFileFlushRequest.encode(e.fileFlushRequest,t.uint32(34).fork()).join(),void 0!==e.fileReadLineRequest&&ContainerFileReadLineRequest.encode(e.fileReadLineRequest,t.uint32(42).fork()).join(),void 0!==e.fileSeekRequest&&ContainerFileSeekRequest.encode(e.fileSeekRequest,t.uint32(50).fork()).join(),void 0!==e.fileDeleteBytesRequest&&ContainerFileDeleteBytesRequest.encode(e.fileDeleteBytesRequest,t.uint32(58).fork()).join(),void 0!==e.fileWriteReplaceBytesRequest&&ContainerFileWriteReplaceBytesRequest.encode(e.fileWriteReplaceBytesRequest,t.uint32(66).fork()).join(),void 0!==e.fileCloseRequest&&ContainerFileCloseRequest.encode(e.fileCloseRequest,t.uint32(74).fork()).join(),void 0!==e.fileLsRequest&&ContainerFileLsRequest.encode(e.fileLsRequest,t.uint32(90).fork()).join(),void 0!==e.fileMkdirRequest&&ContainerFileMkdirRequest.encode(e.fileMkdirRequest,t.uint32(98).fork()).join(),void 0!==e.fileRmRequest&&ContainerFileRmRequest.encode(e.fileRmRequest,t.uint32(106).fork()).join(),void 0!==e.fileWatchRequest&&ContainerFileWatchRequest.encode(e.fileWatchRequest,t.uint32(114).fork()).join(),""!==e.taskId&&t.uint32(82).string(e.taskId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFilesystemExecRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.fileOpenRequest=ContainerFileOpenRequest.decode(n,n.uint32());continue;case 2:if(18!==e)break;a.fileWriteRequest=ContainerFileWriteRequest.decode(n,n.uint32());continue;case 3:if(26!==e)break;a.fileReadRequest=ContainerFileReadRequest.decode(n,n.uint32());continue;case 4:if(34!==e)break;a.fileFlushRequest=ContainerFileFlushRequest.decode(n,n.uint32());continue;case 5:if(42!==e)break;a.fileReadLineRequest=ContainerFileReadLineRequest.decode(n,n.uint32());continue;case 6:if(50!==e)break;a.fileSeekRequest=ContainerFileSeekRequest.decode(n,n.uint32());continue;case 7:if(58!==e)break;a.fileDeleteBytesRequest=ContainerFileDeleteBytesRequest.decode(n,n.uint32());continue;case 8:if(66!==e)break;a.fileWriteReplaceBytesRequest=ContainerFileWriteReplaceBytesRequest.decode(n,n.uint32());continue;case 9:if(74!==e)break;a.fileCloseRequest=ContainerFileCloseRequest.decode(n,n.uint32());continue;case 11:if(90!==e)break;a.fileLsRequest=ContainerFileLsRequest.decode(n,n.uint32());continue;case 12:if(98!==e)break;a.fileMkdirRequest=ContainerFileMkdirRequest.decode(n,n.uint32());continue;case 13:if(106!==e)break;a.fileRmRequest=ContainerFileRmRequest.decode(n,n.uint32());continue;case 14:if(114!==e)break;a.fileWatchRequest=ContainerFileWatchRequest.decode(n,n.uint32());continue;case 10:if(82!==e)break;a.taskId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({fileOpenRequest:isSet4(e.fileOpenRequest)?ContainerFileOpenRequest.fromJSON(e.fileOpenRequest):void 0,fileWriteRequest:isSet4(e.fileWriteRequest)?ContainerFileWriteRequest.fromJSON(e.fileWriteRequest):void 0,fileReadRequest:isSet4(e.fileReadRequest)?ContainerFileReadRequest.fromJSON(e.fileReadRequest):void 0,fileFlushRequest:isSet4(e.fileFlushRequest)?ContainerFileFlushRequest.fromJSON(e.fileFlushRequest):void 0,fileReadLineRequest:isSet4(e.fileReadLineRequest)?ContainerFileReadLineRequest.fromJSON(e.fileReadLineRequest):void 0,fileSeekRequest:isSet4(e.fileSeekRequest)?ContainerFileSeekRequest.fromJSON(e.fileSeekRequest):void 0,fileDeleteBytesRequest:isSet4(e.fileDeleteBytesRequest)?ContainerFileDeleteBytesRequest.fromJSON(e.fileDeleteBytesRequest):void 0,fileWriteReplaceBytesRequest:isSet4(e.fileWriteReplaceBytesRequest)?ContainerFileWriteReplaceBytesRequest.fromJSON(e.fileWriteReplaceBytesRequest):void 0,fileCloseRequest:isSet4(e.fileCloseRequest)?ContainerFileCloseRequest.fromJSON(e.fileCloseRequest):void 0,fileLsRequest:isSet4(e.fileLsRequest)?ContainerFileLsRequest.fromJSON(e.fileLsRequest):void 0,fileMkdirRequest:isSet4(e.fileMkdirRequest)?ContainerFileMkdirRequest.fromJSON(e.fileMkdirRequest):void 0,fileRmRequest:isSet4(e.fileRmRequest)?ContainerFileRmRequest.fromJSON(e.fileRmRequest):void 0,fileWatchRequest:isSet4(e.fileWatchRequest)?ContainerFileWatchRequest.fromJSON(e.fileWatchRequest):void 0,taskId:isSet4(e.taskId)?globalThis.String(e.taskId):""}),toJSON(e){const t={};return void 0!==e.fileOpenRequest&&(t.fileOpenRequest=ContainerFileOpenRequest.toJSON(e.fileOpenRequest)),void 0!==e.fileWriteRequest&&(t.fileWriteRequest=ContainerFileWriteRequest.toJSON(e.fileWriteRequest)),void 0!==e.fileReadRequest&&(t.fileReadRequest=ContainerFileReadRequest.toJSON(e.fileReadRequest)),void 0!==e.fileFlushRequest&&(t.fileFlushRequest=ContainerFileFlushRequest.toJSON(e.fileFlushRequest)),void 0!==e.fileReadLineRequest&&(t.fileReadLineRequest=ContainerFileReadLineRequest.toJSON(e.fileReadLineRequest)),void 0!==e.fileSeekRequest&&(t.fileSeekRequest=ContainerFileSeekRequest.toJSON(e.fileSeekRequest)),void 0!==e.fileDeleteBytesRequest&&(t.fileDeleteBytesRequest=ContainerFileDeleteBytesRequest.toJSON(e.fileDeleteBytesRequest)),void 0!==e.fileWriteReplaceBytesRequest&&(t.fileWriteReplaceBytesRequest=ContainerFileWriteReplaceBytesRequest.toJSON(e.fileWriteReplaceBytesRequest)),void 0!==e.fileCloseRequest&&(t.fileCloseRequest=ContainerFileCloseRequest.toJSON(e.fileCloseRequest)),void 0!==e.fileLsRequest&&(t.fileLsRequest=ContainerFileLsRequest.toJSON(e.fileLsRequest)),void 0!==e.fileMkdirRequest&&(t.fileMkdirRequest=ContainerFileMkdirRequest.toJSON(e.fileMkdirRequest)),void 0!==e.fileRmRequest&&(t.fileRmRequest=ContainerFileRmRequest.toJSON(e.fileRmRequest)),void 0!==e.fileWatchRequest&&(t.fileWatchRequest=ContainerFileWatchRequest.toJSON(e.fileWatchRequest)),""!==e.taskId&&(t.taskId=e.taskId),t},create:e=>ContainerFilesystemExecRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFilesystemExecRequest();return t.fileOpenRequest=void 0!==e.fileOpenRequest&&null!==e.fileOpenRequest?ContainerFileOpenRequest.fromPartial(e.fileOpenRequest):void 0,t.fileWriteRequest=void 0!==e.fileWriteRequest&&null!==e.fileWriteRequest?ContainerFileWriteRequest.fromPartial(e.fileWriteRequest):void 0,t.fileReadRequest=void 0!==e.fileReadRequest&&null!==e.fileReadRequest?ContainerFileReadRequest.fromPartial(e.fileReadRequest):void 0,t.fileFlushRequest=void 0!==e.fileFlushRequest&&null!==e.fileFlushRequest?ContainerFileFlushRequest.fromPartial(e.fileFlushRequest):void 0,t.fileReadLineRequest=void 0!==e.fileReadLineRequest&&null!==e.fileReadLineRequest?ContainerFileReadLineRequest.fromPartial(e.fileReadLineRequest):void 0,t.fileSeekRequest=void 0!==e.fileSeekRequest&&null!==e.fileSeekRequest?ContainerFileSeekRequest.fromPartial(e.fileSeekRequest):void 0,t.fileDeleteBytesRequest=void 0!==e.fileDeleteBytesRequest&&null!==e.fileDeleteBytesRequest?ContainerFileDeleteBytesRequest.fromPartial(e.fileDeleteBytesRequest):void 0,t.fileWriteReplaceBytesRequest=void 0!==e.fileWriteReplaceBytesRequest&&null!==e.fileWriteReplaceBytesRequest?ContainerFileWriteReplaceBytesRequest.fromPartial(e.fileWriteReplaceBytesRequest):void 0,t.fileCloseRequest=void 0!==e.fileCloseRequest&&null!==e.fileCloseRequest?ContainerFileCloseRequest.fromPartial(e.fileCloseRequest):void 0,t.fileLsRequest=void 0!==e.fileLsRequest&&null!==e.fileLsRequest?ContainerFileLsRequest.fromPartial(e.fileLsRequest):void 0,t.fileMkdirRequest=void 0!==e.fileMkdirRequest&&null!==e.fileMkdirRequest?ContainerFileMkdirRequest.fromPartial(e.fileMkdirRequest):void 0,t.fileRmRequest=void 0!==e.fileRmRequest&&null!==e.fileRmRequest?ContainerFileRmRequest.fromPartial(e.fileRmRequest):void 0,t.fileWatchRequest=void 0!==e.fileWatchRequest&&null!==e.fileWatchRequest?ContainerFileWatchRequest.fromPartial(e.fileWatchRequest):void 0,t.taskId=e.taskId??"",t}};function createBaseContainerFilesystemExecResponse(){return{execId:"",fileDescriptor:void 0}}var ContainerFilesystemExecResponse={encode:(e,t=new BinaryWriter)=>(""!==e.execId&&t.uint32(10).string(e.execId),void 0!==e.fileDescriptor&&t.uint32(18).string(e.fileDescriptor),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerFilesystemExecResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.execId=n.string();continue;case 2:if(18!==e)break;a.fileDescriptor=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({execId:isSet4(e.execId)?globalThis.String(e.execId):"",fileDescriptor:isSet4(e.fileDescriptor)?globalThis.String(e.fileDescriptor):void 0}),toJSON(e){const t={};return""!==e.execId&&(t.execId=e.execId),void 0!==e.fileDescriptor&&(t.fileDescriptor=e.fileDescriptor),t},create:e=>ContainerFilesystemExecResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerFilesystemExecResponse();return t.execId=e.execId??"",t.fileDescriptor=e.fileDescriptor??void 0,t}};function createBaseContainerHeartbeatRequest(){return{canceledInputsReturnOutputs:!1,canceledInputsReturnOutputsV2:!1}}var ContainerHeartbeatRequest={encode:(e,t=new BinaryWriter)=>(!1!==e.canceledInputsReturnOutputs&&t.uint32(32).bool(e.canceledInputsReturnOutputs),!1!==e.canceledInputsReturnOutputsV2&&t.uint32(40).bool(e.canceledInputsReturnOutputsV2),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerHeartbeatRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 4:if(32!==e)break;a.canceledInputsReturnOutputs=n.bool();continue;case 5:if(40!==e)break;a.canceledInputsReturnOutputsV2=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({canceledInputsReturnOutputs:!!isSet4(e.canceledInputsReturnOutputs)&&globalThis.Boolean(e.canceledInputsReturnOutputs),canceledInputsReturnOutputsV2:!!isSet4(e.canceledInputsReturnOutputsV2)&&globalThis.Boolean(e.canceledInputsReturnOutputsV2)}),toJSON(e){const t={};return!1!==e.canceledInputsReturnOutputs&&(t.canceledInputsReturnOutputs=e.canceledInputsReturnOutputs),!1!==e.canceledInputsReturnOutputsV2&&(t.canceledInputsReturnOutputsV2=e.canceledInputsReturnOutputsV2),t},create:e=>ContainerHeartbeatRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerHeartbeatRequest();return t.canceledInputsReturnOutputs=e.canceledInputsReturnOutputs??!1,t.canceledInputsReturnOutputsV2=e.canceledInputsReturnOutputsV2??!1,t}};function createBaseContainerHeartbeatResponse(){return{cancelInputEvent:void 0}}var ContainerHeartbeatResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.cancelInputEvent&&CancelInputEvent.encode(e.cancelInputEvent,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerHeartbeatResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.cancelInputEvent=CancelInputEvent.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({cancelInputEvent:isSet4(e.cancelInputEvent)?CancelInputEvent.fromJSON(e.cancelInputEvent):void 0}),toJSON(e){const t={};return void 0!==e.cancelInputEvent&&(t.cancelInputEvent=CancelInputEvent.toJSON(e.cancelInputEvent)),t},create:e=>ContainerHeartbeatResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerHeartbeatResponse();return t.cancelInputEvent=void 0!==e.cancelInputEvent&&null!==e.cancelInputEvent?CancelInputEvent.fromPartial(e.cancelInputEvent):void 0,t}};function createBaseContainerLogRequest(){return{logs:[]}}var ContainerLogRequest={encode(e,t=new BinaryWriter){for(const n of e.logs)TaskLogs.encode(n,t.uint32(26).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerLogRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 3:if(26!==e)break;a.logs.push(TaskLogs.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({logs:globalThis.Array.isArray(e?.logs)?e.logs.map((e=>TaskLogs.fromJSON(e))):[]}),toJSON(e){const t={};return e.logs?.length&&(t.logs=e.logs.map((e=>TaskLogs.toJSON(e)))),t},create:e=>ContainerLogRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerLogRequest();return t.logs=e.logs?.map((e=>TaskLogs.fromPartial(e)))||[],t}};function createBaseContainerReloadVolumesRequest(){return{taskId:""}}var ContainerReloadVolumesRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerReloadVolumesRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet4(e.taskId)?globalThis.String(e.taskId):""}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),t},create:e=>ContainerReloadVolumesRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerReloadVolumesRequest();return t.taskId=e.taskId??"",t}};function createBaseContainerReloadVolumesResponse(){return{}}var ContainerReloadVolumesResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerReloadVolumesResponse();for(;n.pos<r;){const e=n.uint32();if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({}),toJSON:e=>({}),create:e=>ContainerReloadVolumesResponse.fromPartial(e??{}),fromPartial:e=>createBaseContainerReloadVolumesResponse()};function createBaseContainerStopRequest(){return{taskId:""}}var ContainerStopRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerStopRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet4(e.taskId)?globalThis.String(e.taskId):""}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),t},create:e=>ContainerStopRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseContainerStopRequest();return t.taskId=e.taskId??"",t}};function createBaseContainerStopResponse(){return{}}var ContainerStopResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseContainerStopResponse();for(;n.pos<r;){const e=n.uint32();if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({}),toJSON:e=>({}),create:e=>ContainerStopResponse.fromPartial(e??{}),fromPartial:e=>createBaseContainerStopResponse()};function createBaseCreationInfo(){return{createdAt:0,createdBy:""}}var CreationInfo={encode:(e,t=new BinaryWriter)=>(0!==e.createdAt&&t.uint32(9).double(e.createdAt),""!==e.createdBy&&t.uint32(18).string(e.createdBy),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseCreationInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(9!==e)break;a.createdAt=n.double();continue;case 2:if(18!==e)break;a.createdBy=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,createdBy:isSet4(e.createdBy)?globalThis.String(e.createdBy):""}),toJSON(e){const t={};return 0!==e.createdAt&&(t.createdAt=e.createdAt),""!==e.createdBy&&(t.createdBy=e.createdBy),t},create:e=>CreationInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseCreationInfo();return t.createdAt=e.createdAt??0,t.createdBy=e.createdBy??"",t}};function createBaseCustomDomainConfig(){return{name:""}}var CustomDomainConfig={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseCustomDomainConfig();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):""}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),t},create:e=>CustomDomainConfig.fromPartial(e??{}),fromPartial(e){const t=createBaseCustomDomainConfig();return t.name=e.name??"",t}};function createBaseCustomDomainInfo(){return{url:""}}var CustomDomainInfo={encode:(e,t=new BinaryWriter)=>(""!==e.url&&t.uint32(10).string(e.url),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseCustomDomainInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.url=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({url:isSet4(e.url)?globalThis.String(e.url):""}),toJSON(e){const t={};return""!==e.url&&(t.url=e.url),t},create:e=>CustomDomainInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseCustomDomainInfo();return t.url=e.url??"",t}};function createBaseDNSRecord(){return{type:0,name:"",value:""}}var DNSRecord={encode:(e,t=new BinaryWriter)=>(0!==e.type&&t.uint32(8).int32(e.type),""!==e.name&&t.uint32(18).string(e.name),""!==e.value&&t.uint32(26).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDNSRecord();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.type=n.int32();continue;case 2:if(18!==e)break;a.name=n.string();continue;case 3:if(26!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({type:isSet4(e.type)?dNSRecordTypeFromJSON(e.type):0,name:isSet4(e.name)?globalThis.String(e.name):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return 0!==e.type&&(t.type=dNSRecordTypeToJSON(e.type)),""!==e.name&&(t.name=e.name),""!==e.value&&(t.value=e.value),t},create:e=>DNSRecord.fromPartial(e??{}),fromPartial(e){const t=createBaseDNSRecord();return t.type=e.type??0,t.name=e.name??"",t.value=e.value??"",t}};function createBaseDataChunk(){return{dataFormat:0,data:void 0,dataBlobId:void 0,index:0}}var DataChunk={encode:(e,t=new BinaryWriter)=>(0!==e.dataFormat&&t.uint32(8).int32(e.dataFormat),void 0!==e.data&&t.uint32(18).bytes(e.data),void 0!==e.dataBlobId&&t.uint32(26).string(e.dataBlobId),0!==e.index&&t.uint32(32).uint64(e.index),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDataChunk();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.dataFormat=n.int32();continue;case 2:if(18!==e)break;a.data=n.bytes();continue;case 3:if(26!==e)break;a.dataBlobId=n.string();continue;case 4:if(32!==e)break;a.index=longToNumber2(n.uint64());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dataFormat:isSet4(e.dataFormat)?dataFormatFromJSON(e.dataFormat):0,data:isSet4(e.data)?bytesFromBase64(e.data):void 0,dataBlobId:isSet4(e.dataBlobId)?globalThis.String(e.dataBlobId):void 0,index:isSet4(e.index)?globalThis.Number(e.index):0}),toJSON(e){const t={};return 0!==e.dataFormat&&(t.dataFormat=dataFormatToJSON(e.dataFormat)),void 0!==e.data&&(t.data=base64FromBytes(e.data)),void 0!==e.dataBlobId&&(t.dataBlobId=e.dataBlobId),0!==e.index&&(t.index=Math.round(e.index)),t},create:e=>DataChunk.fromPartial(e??{}),fromPartial(e){const t=createBaseDataChunk();return t.dataFormat=e.dataFormat??0,t.data=e.data??void 0,t.dataBlobId=e.dataBlobId??void 0,t.index=e.index??0,t}};function createBaseDictClearRequest(){return{dictId:""}}var DictClearRequest={encode:(e,t=new BinaryWriter)=>(""!==e.dictId&&t.uint32(10).string(e.dictId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictClearRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.dictId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dictId:isSet4(e.dictId)?globalThis.String(e.dictId):""}),toJSON(e){const t={};return""!==e.dictId&&(t.dictId=e.dictId),t},create:e=>DictClearRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDictClearRequest();return t.dictId=e.dictId??"",t}};function createBaseDictContainsRequest(){return{dictId:"",key:new Uint8Array(0)}}var DictContainsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.dictId&&t.uint32(10).string(e.dictId),0!==e.key.length&&t.uint32(18).bytes(e.key),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictContainsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.dictId=n.string();continue;case 2:if(18!==e)break;a.key=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dictId:isSet4(e.dictId)?globalThis.String(e.dictId):"",key:isSet4(e.key)?bytesFromBase64(e.key):new Uint8Array(0)}),toJSON(e){const t={};return""!==e.dictId&&(t.dictId=e.dictId),0!==e.key.length&&(t.key=base64FromBytes(e.key)),t},create:e=>DictContainsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDictContainsRequest();return t.dictId=e.dictId??"",t.key=e.key??new Uint8Array(0),t}};function createBaseDictContainsResponse(){return{found:!1}}var DictContainsResponse={encode:(e,t=new BinaryWriter)=>(!1!==e.found&&t.uint32(8).bool(e.found),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictContainsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.found=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({found:!!isSet4(e.found)&&globalThis.Boolean(e.found)}),toJSON(e){const t={};return!1!==e.found&&(t.found=e.found),t},create:e=>DictContainsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseDictContainsResponse();return t.found=e.found??!1,t}};function createBaseDictContentsRequest(){return{dictId:"",keys:!1,values:!1}}var DictContentsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.dictId&&t.uint32(10).string(e.dictId),!1!==e.keys&&t.uint32(16).bool(e.keys),!1!==e.values&&t.uint32(24).bool(e.values),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictContentsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.dictId=n.string();continue;case 2:if(16!==e)break;a.keys=n.bool();continue;case 3:if(24!==e)break;a.values=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dictId:isSet4(e.dictId)?globalThis.String(e.dictId):"",keys:!!isSet4(e.keys)&&globalThis.Boolean(e.keys),values:!!isSet4(e.values)&&globalThis.Boolean(e.values)}),toJSON(e){const t={};return""!==e.dictId&&(t.dictId=e.dictId),!1!==e.keys&&(t.keys=e.keys),!1!==e.values&&(t.values=e.values),t},create:e=>DictContentsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDictContentsRequest();return t.dictId=e.dictId??"",t.keys=e.keys??!1,t.values=e.values??!1,t}};function createBaseDictDeleteRequest(){return{dictId:""}}var DictDeleteRequest={encode:(e,t=new BinaryWriter)=>(""!==e.dictId&&t.uint32(10).string(e.dictId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictDeleteRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.dictId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dictId:isSet4(e.dictId)?globalThis.String(e.dictId):""}),toJSON(e){const t={};return""!==e.dictId&&(t.dictId=e.dictId),t},create:e=>DictDeleteRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDictDeleteRequest();return t.dictId=e.dictId??"",t}};function createBaseDictEntry(){return{key:new Uint8Array(0),value:new Uint8Array(0)}}var DictEntry={encode:(e,t=new BinaryWriter)=>(0!==e.key.length&&t.uint32(10).bytes(e.key),0!==e.value.length&&t.uint32(18).bytes(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.bytes();continue;case 2:if(18!==e)break;a.value=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?bytesFromBase64(e.key):new Uint8Array(0),value:isSet4(e.value)?bytesFromBase64(e.value):new Uint8Array(0)}),toJSON(e){const t={};return 0!==e.key.length&&(t.key=base64FromBytes(e.key)),0!==e.value.length&&(t.value=base64FromBytes(e.value)),t},create:e=>DictEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseDictEntry();return t.key=e.key??new Uint8Array(0),t.value=e.value??new Uint8Array(0),t}};function createBaseDictGetByIdRequest(){return{dictId:""}}var DictGetByIdRequest={encode:(e,t=new BinaryWriter)=>(""!==e.dictId&&t.uint32(10).string(e.dictId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictGetByIdRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.dictId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dictId:isSet4(e.dictId)?globalThis.String(e.dictId):""}),toJSON(e){const t={};return""!==e.dictId&&(t.dictId=e.dictId),t},create:e=>DictGetByIdRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDictGetByIdRequest();return t.dictId=e.dictId??"",t}};function createBaseDictGetByIdResponse(){return{dictId:"",metadata:void 0}}var DictGetByIdResponse={encode:(e,t=new BinaryWriter)=>(""!==e.dictId&&t.uint32(10).string(e.dictId),void 0!==e.metadata&&DictMetadata.encode(e.metadata,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictGetByIdResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.dictId=n.string();continue;case 2:if(18!==e)break;a.metadata=DictMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dictId:isSet4(e.dictId)?globalThis.String(e.dictId):"",metadata:isSet4(e.metadata)?DictMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.dictId&&(t.dictId=e.dictId),void 0!==e.metadata&&(t.metadata=DictMetadata.toJSON(e.metadata)),t},create:e=>DictGetByIdResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseDictGetByIdResponse();return t.dictId=e.dictId??"",t.metadata=void 0!==e.metadata&&null!==e.metadata?DictMetadata.fromPartial(e.metadata):void 0,t}};function createBaseDictGetOrCreateRequest(){return{deploymentName:"",environmentName:"",objectCreationType:0,data:[]}}var DictGetOrCreateRequest={encode(e,t=new BinaryWriter){""!==e.deploymentName&&t.uint32(10).string(e.deploymentName),""!==e.environmentName&&t.uint32(26).string(e.environmentName),0!==e.objectCreationType&&t.uint32(32).int32(e.objectCreationType);for(const n of e.data)DictEntry.encode(n,t.uint32(42).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictGetOrCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.deploymentName=n.string();continue;case 3:if(26!==e)break;a.environmentName=n.string();continue;case 4:if(32!==e)break;a.objectCreationType=n.int32();continue;case 5:if(42!==e)break;a.data.push(DictEntry.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({deploymentName:isSet4(e.deploymentName)?globalThis.String(e.deploymentName):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",objectCreationType:isSet4(e.objectCreationType)?objectCreationTypeFromJSON(e.objectCreationType):0,data:globalThis.Array.isArray(e?.data)?e.data.map((e=>DictEntry.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.deploymentName&&(t.deploymentName=e.deploymentName),""!==e.environmentName&&(t.environmentName=e.environmentName),0!==e.objectCreationType&&(t.objectCreationType=objectCreationTypeToJSON(e.objectCreationType)),e.data?.length&&(t.data=e.data.map((e=>DictEntry.toJSON(e)))),t},create:e=>DictGetOrCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDictGetOrCreateRequest();return t.deploymentName=e.deploymentName??"",t.environmentName=e.environmentName??"",t.objectCreationType=e.objectCreationType??0,t.data=e.data?.map((e=>DictEntry.fromPartial(e)))||[],t}};function createBaseDictGetOrCreateResponse(){return{dictId:"",metadata:void 0}}var DictGetOrCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.dictId&&t.uint32(10).string(e.dictId),void 0!==e.metadata&&DictMetadata.encode(e.metadata,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictGetOrCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.dictId=n.string();continue;case 2:if(18!==e)break;a.metadata=DictMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dictId:isSet4(e.dictId)?globalThis.String(e.dictId):"",metadata:isSet4(e.metadata)?DictMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.dictId&&(t.dictId=e.dictId),void 0!==e.metadata&&(t.metadata=DictMetadata.toJSON(e.metadata)),t},create:e=>DictGetOrCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseDictGetOrCreateResponse();return t.dictId=e.dictId??"",t.metadata=void 0!==e.metadata&&null!==e.metadata?DictMetadata.fromPartial(e.metadata):void 0,t}};function createBaseDictGetRequest(){return{dictId:"",key:new Uint8Array(0)}}var DictGetRequest={encode:(e,t=new BinaryWriter)=>(""!==e.dictId&&t.uint32(10).string(e.dictId),0!==e.key.length&&t.uint32(18).bytes(e.key),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictGetRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.dictId=n.string();continue;case 2:if(18!==e)break;a.key=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dictId:isSet4(e.dictId)?globalThis.String(e.dictId):"",key:isSet4(e.key)?bytesFromBase64(e.key):new Uint8Array(0)}),toJSON(e){const t={};return""!==e.dictId&&(t.dictId=e.dictId),0!==e.key.length&&(t.key=base64FromBytes(e.key)),t},create:e=>DictGetRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDictGetRequest();return t.dictId=e.dictId??"",t.key=e.key??new Uint8Array(0),t}};function createBaseDictGetResponse(){return{found:!1,value:void 0}}var DictGetResponse={encode:(e,t=new BinaryWriter)=>(!1!==e.found&&t.uint32(8).bool(e.found),void 0!==e.value&&t.uint32(18).bytes(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictGetResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.found=n.bool();continue;case 2:if(18!==e)break;a.value=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({found:!!isSet4(e.found)&&globalThis.Boolean(e.found),value:isSet4(e.value)?bytesFromBase64(e.value):void 0}),toJSON(e){const t={};return!1!==e.found&&(t.found=e.found),void 0!==e.value&&(t.value=base64FromBytes(e.value)),t},create:e=>DictGetResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseDictGetResponse();return t.found=e.found??!1,t.value=e.value??void 0,t}};function createBaseDictHeartbeatRequest(){return{dictId:""}}var DictHeartbeatRequest={encode:(e,t=new BinaryWriter)=>(""!==e.dictId&&t.uint32(10).string(e.dictId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictHeartbeatRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.dictId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dictId:isSet4(e.dictId)?globalThis.String(e.dictId):""}),toJSON(e){const t={};return""!==e.dictId&&(t.dictId=e.dictId),t},create:e=>DictHeartbeatRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDictHeartbeatRequest();return t.dictId=e.dictId??"",t}};function createBaseDictLenRequest(){return{dictId:""}}var DictLenRequest={encode:(e,t=new BinaryWriter)=>(""!==e.dictId&&t.uint32(10).string(e.dictId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictLenRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.dictId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dictId:isSet4(e.dictId)?globalThis.String(e.dictId):""}),toJSON(e){const t={};return""!==e.dictId&&(t.dictId=e.dictId),t},create:e=>DictLenRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDictLenRequest();return t.dictId=e.dictId??"",t}};function createBaseDictLenResponse(){return{len:0}}var DictLenResponse={encode:(e,t=new BinaryWriter)=>(0!==e.len&&t.uint32(8).int32(e.len),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictLenResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.len=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({len:isSet4(e.len)?globalThis.Number(e.len):0}),toJSON(e){const t={};return 0!==e.len&&(t.len=Math.round(e.len)),t},create:e=>DictLenResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseDictLenResponse();return t.len=e.len??0,t}};function createBaseDictListRequest(){return{environmentName:"",pagination:void 0}}var DictListRequest={encode:(e,t=new BinaryWriter)=>(""!==e.environmentName&&t.uint32(10).string(e.environmentName),void 0!==e.pagination&&ListPagination.encode(e.pagination,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictListRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.environmentName=n.string();continue;case 2:if(18!==e)break;a.pagination=ListPagination.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",pagination:isSet4(e.pagination)?ListPagination.fromJSON(e.pagination):void 0}),toJSON(e){const t={};return""!==e.environmentName&&(t.environmentName=e.environmentName),void 0!==e.pagination&&(t.pagination=ListPagination.toJSON(e.pagination)),t},create:e=>DictListRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDictListRequest();return t.environmentName=e.environmentName??"",t.pagination=void 0!==e.pagination&&null!==e.pagination?ListPagination.fromPartial(e.pagination):void 0,t}};function createBaseDictListResponse(){return{dicts:[],environmentName:""}}var DictListResponse={encode(e,t=new BinaryWriter){for(const n of e.dicts)DictListResponse_DictInfo.encode(n,t.uint32(10).fork()).join();return""!==e.environmentName&&t.uint32(18).string(e.environmentName),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.dicts.push(DictListResponse_DictInfo.decode(n,n.uint32()));continue;case 2:if(18!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dicts:globalThis.Array.isArray(e?.dicts)?e.dicts.map((e=>DictListResponse_DictInfo.fromJSON(e))):[],environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return e.dicts?.length&&(t.dicts=e.dicts.map((e=>DictListResponse_DictInfo.toJSON(e)))),""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>DictListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseDictListResponse();return t.dicts=e.dicts?.map((e=>DictListResponse_DictInfo.fromPartial(e)))||[],t.environmentName=e.environmentName??"",t}};function createBaseDictListResponse_DictInfo(){return{name:"",createdAt:0,dictId:"",metadata:void 0}}var DictListResponse_DictInfo={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),0!==e.createdAt&&t.uint32(17).double(e.createdAt),""!==e.dictId&&t.uint32(26).string(e.dictId),void 0!==e.metadata&&DictMetadata.encode(e.metadata,t.uint32(34).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictListResponse_DictInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(17!==e)break;a.createdAt=n.double();continue;case 3:if(26!==e)break;a.dictId=n.string();continue;case 4:if(34!==e)break;a.metadata=DictMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,dictId:isSet4(e.dictId)?globalThis.String(e.dictId):"",metadata:isSet4(e.metadata)?DictMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),0!==e.createdAt&&(t.createdAt=e.createdAt),""!==e.dictId&&(t.dictId=e.dictId),void 0!==e.metadata&&(t.metadata=DictMetadata.toJSON(e.metadata)),t},create:e=>DictListResponse_DictInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseDictListResponse_DictInfo();return t.name=e.name??"",t.createdAt=e.createdAt??0,t.dictId=e.dictId??"",t.metadata=void 0!==e.metadata&&null!==e.metadata?DictMetadata.fromPartial(e.metadata):void 0,t}};function createBaseDictMetadata(){return{name:"",creationInfo:void 0}}var DictMetadata={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),void 0!==e.creationInfo&&CreationInfo.encode(e.creationInfo,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictMetadata();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(18!==e)break;a.creationInfo=CreationInfo.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",creationInfo:isSet4(e.creationInfo)?CreationInfo.fromJSON(e.creationInfo):void 0}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),void 0!==e.creationInfo&&(t.creationInfo=CreationInfo.toJSON(e.creationInfo)),t},create:e=>DictMetadata.fromPartial(e??{}),fromPartial(e){const t=createBaseDictMetadata();return t.name=e.name??"",t.creationInfo=void 0!==e.creationInfo&&null!==e.creationInfo?CreationInfo.fromPartial(e.creationInfo):void 0,t}};function createBaseDictPopRequest(){return{dictId:"",key:new Uint8Array(0)}}var DictPopRequest={encode:(e,t=new BinaryWriter)=>(""!==e.dictId&&t.uint32(10).string(e.dictId),0!==e.key.length&&t.uint32(18).bytes(e.key),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictPopRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.dictId=n.string();continue;case 2:if(18!==e)break;a.key=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dictId:isSet4(e.dictId)?globalThis.String(e.dictId):"",key:isSet4(e.key)?bytesFromBase64(e.key):new Uint8Array(0)}),toJSON(e){const t={};return""!==e.dictId&&(t.dictId=e.dictId),0!==e.key.length&&(t.key=base64FromBytes(e.key)),t},create:e=>DictPopRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDictPopRequest();return t.dictId=e.dictId??"",t.key=e.key??new Uint8Array(0),t}};function createBaseDictPopResponse(){return{found:!1,value:void 0}}var DictPopResponse={encode:(e,t=new BinaryWriter)=>(!1!==e.found&&t.uint32(8).bool(e.found),void 0!==e.value&&t.uint32(18).bytes(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictPopResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.found=n.bool();continue;case 2:if(18!==e)break;a.value=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({found:!!isSet4(e.found)&&globalThis.Boolean(e.found),value:isSet4(e.value)?bytesFromBase64(e.value):void 0}),toJSON(e){const t={};return!1!==e.found&&(t.found=e.found),void 0!==e.value&&(t.value=base64FromBytes(e.value)),t},create:e=>DictPopResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseDictPopResponse();return t.found=e.found??!1,t.value=e.value??void 0,t}};function createBaseDictUpdateRequest(){return{dictId:"",updates:[],ifNotExists:!1}}var DictUpdateRequest={encode(e,t=new BinaryWriter){""!==e.dictId&&t.uint32(10).string(e.dictId);for(const n of e.updates)DictEntry.encode(n,t.uint32(18).fork()).join();return!1!==e.ifNotExists&&t.uint32(24).bool(e.ifNotExists),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictUpdateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.dictId=n.string();continue;case 2:if(18!==e)break;a.updates.push(DictEntry.decode(n,n.uint32()));continue;case 3:if(24!==e)break;a.ifNotExists=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({dictId:isSet4(e.dictId)?globalThis.String(e.dictId):"",updates:globalThis.Array.isArray(e?.updates)?e.updates.map((e=>DictEntry.fromJSON(e))):[],ifNotExists:!!isSet4(e.ifNotExists)&&globalThis.Boolean(e.ifNotExists)}),toJSON(e){const t={};return""!==e.dictId&&(t.dictId=e.dictId),e.updates?.length&&(t.updates=e.updates.map((e=>DictEntry.toJSON(e)))),!1!==e.ifNotExists&&(t.ifNotExists=e.ifNotExists),t},create:e=>DictUpdateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDictUpdateRequest();return t.dictId=e.dictId??"",t.updates=e.updates?.map((e=>DictEntry.fromPartial(e)))||[],t.ifNotExists=e.ifNotExists??!1,t}};function createBaseDictUpdateResponse(){return{created:!1}}var DictUpdateResponse={encode:(e,t=new BinaryWriter)=>(!1!==e.created&&t.uint32(8).bool(e.created),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDictUpdateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.created=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({created:!!isSet4(e.created)&&globalThis.Boolean(e.created)}),toJSON(e){const t={};return!1!==e.created&&(t.created=e.created),t},create:e=>DictUpdateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseDictUpdateResponse();return t.created=e.created??!1,t}};function createBaseDomain(){return{domainId:"",domainName:"",createdAt:0,certificateStatus:0,dnsRecords:[]}}var Domain={encode(e,t=new BinaryWriter){""!==e.domainId&&t.uint32(10).string(e.domainId),""!==e.domainName&&t.uint32(18).string(e.domainName),0!==e.createdAt&&t.uint32(25).double(e.createdAt),0!==e.certificateStatus&&t.uint32(32).int32(e.certificateStatus);for(const n of e.dnsRecords)DNSRecord.encode(n,t.uint32(42).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDomain();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.domainId=n.string();continue;case 2:if(18!==e)break;a.domainName=n.string();continue;case 3:if(25!==e)break;a.createdAt=n.double();continue;case 4:if(32!==e)break;a.certificateStatus=n.int32();continue;case 5:if(42!==e)break;a.dnsRecords.push(DNSRecord.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({domainId:isSet4(e.domainId)?globalThis.String(e.domainId):"",domainName:isSet4(e.domainName)?globalThis.String(e.domainName):"",createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,certificateStatus:isSet4(e.certificateStatus)?certificateStatusFromJSON(e.certificateStatus):0,dnsRecords:globalThis.Array.isArray(e?.dnsRecords)?e.dnsRecords.map((e=>DNSRecord.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.domainId&&(t.domainId=e.domainId),""!==e.domainName&&(t.domainName=e.domainName),0!==e.createdAt&&(t.createdAt=e.createdAt),0!==e.certificateStatus&&(t.certificateStatus=certificateStatusToJSON(e.certificateStatus)),e.dnsRecords?.length&&(t.dnsRecords=e.dnsRecords.map((e=>DNSRecord.toJSON(e)))),t},create:e=>Domain.fromPartial(e??{}),fromPartial(e){const t=createBaseDomain();return t.domainId=e.domainId??"",t.domainName=e.domainName??"",t.createdAt=e.createdAt??0,t.certificateStatus=e.certificateStatus??0,t.dnsRecords=e.dnsRecords?.map((e=>DNSRecord.fromPartial(e)))||[],t}};function createBaseDomainCertificateVerifyRequest(){return{domainId:""}}var DomainCertificateVerifyRequest={encode:(e,t=new BinaryWriter)=>(""!==e.domainId&&t.uint32(10).string(e.domainId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDomainCertificateVerifyRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.domainId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({domainId:isSet4(e.domainId)?globalThis.String(e.domainId):""}),toJSON(e){const t={};return""!==e.domainId&&(t.domainId=e.domainId),t},create:e=>DomainCertificateVerifyRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDomainCertificateVerifyRequest();return t.domainId=e.domainId??"",t}};function createBaseDomainCertificateVerifyResponse(){return{domain:void 0}}var DomainCertificateVerifyResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.domain&&Domain.encode(e.domain,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDomainCertificateVerifyResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.domain=Domain.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({domain:isSet4(e.domain)?Domain.fromJSON(e.domain):void 0}),toJSON(e){const t={};return void 0!==e.domain&&(t.domain=Domain.toJSON(e.domain)),t},create:e=>DomainCertificateVerifyResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseDomainCertificateVerifyResponse();return t.domain=void 0!==e.domain&&null!==e.domain?Domain.fromPartial(e.domain):void 0,t}};function createBaseDomainCreateRequest(){return{domainName:""}}var DomainCreateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.domainName&&t.uint32(10).string(e.domainName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDomainCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.domainName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({domainName:isSet4(e.domainName)?globalThis.String(e.domainName):""}),toJSON(e){const t={};return""!==e.domainName&&(t.domainName=e.domainName),t},create:e=>DomainCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseDomainCreateRequest();return t.domainName=e.domainName??"",t}};function createBaseDomainCreateResponse(){return{domainId:"",dnsRecords:[]}}var DomainCreateResponse={encode(e,t=new BinaryWriter){""!==e.domainId&&t.uint32(10).string(e.domainId);for(const n of e.dnsRecords)DNSRecord.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDomainCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.domainId=n.string();continue;case 2:if(18!==e)break;a.dnsRecords.push(DNSRecord.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({domainId:isSet4(e.domainId)?globalThis.String(e.domainId):"",dnsRecords:globalThis.Array.isArray(e?.dnsRecords)?e.dnsRecords.map((e=>DNSRecord.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.domainId&&(t.domainId=e.domainId),e.dnsRecords?.length&&(t.dnsRecords=e.dnsRecords.map((e=>DNSRecord.toJSON(e)))),t},create:e=>DomainCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseDomainCreateResponse();return t.domainId=e.domainId??"",t.dnsRecords=e.dnsRecords?.map((e=>DNSRecord.fromPartial(e)))||[],t}};function createBaseDomainListRequest(){return{}}var DomainListRequest={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDomainListRequest();for(;n.pos<r;){const e=n.uint32();if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({}),toJSON:e=>({}),create:e=>DomainListRequest.fromPartial(e??{}),fromPartial:e=>createBaseDomainListRequest()};function createBaseDomainListResponse(){return{domains:[]}}var DomainListResponse={encode(e,t=new BinaryWriter){for(const n of e.domains)Domain.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseDomainListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.domains.push(Domain.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({domains:globalThis.Array.isArray(e?.domains)?e.domains.map((e=>Domain.fromJSON(e))):[]}),toJSON(e){const t={};return e.domains?.length&&(t.domains=e.domains.map((e=>Domain.toJSON(e)))),t},create:e=>DomainListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseDomainListResponse();return t.domains=e.domains?.map((e=>Domain.fromPartial(e)))||[],t}};function createBaseEnvironmentCreateRequest(){return{name:""}}var EnvironmentCreateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseEnvironmentCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):""}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),t},create:e=>EnvironmentCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseEnvironmentCreateRequest();return t.name=e.name??"",t}};function createBaseEnvironmentDeleteRequest(){return{name:""}}var EnvironmentDeleteRequest={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseEnvironmentDeleteRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):""}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),t},create:e=>EnvironmentDeleteRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseEnvironmentDeleteRequest();return t.name=e.name??"",t}};function createBaseEnvironmentGetOrCreateRequest(){return{deploymentName:"",objectCreationType:0}}var EnvironmentGetOrCreateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.deploymentName&&t.uint32(10).string(e.deploymentName),0!==e.objectCreationType&&t.uint32(16).int32(e.objectCreationType),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseEnvironmentGetOrCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.deploymentName=n.string();continue;case 2:if(16!==e)break;a.objectCreationType=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({deploymentName:isSet4(e.deploymentName)?globalThis.String(e.deploymentName):"",objectCreationType:isSet4(e.objectCreationType)?objectCreationTypeFromJSON(e.objectCreationType):0}),toJSON(e){const t={};return""!==e.deploymentName&&(t.deploymentName=e.deploymentName),0!==e.objectCreationType&&(t.objectCreationType=objectCreationTypeToJSON(e.objectCreationType)),t},create:e=>EnvironmentGetOrCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseEnvironmentGetOrCreateRequest();return t.deploymentName=e.deploymentName??"",t.objectCreationType=e.objectCreationType??0,t}};function createBaseEnvironmentGetOrCreateResponse(){return{environmentId:"",metadata:void 0}}var EnvironmentGetOrCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.environmentId&&t.uint32(10).string(e.environmentId),void 0!==e.metadata&&EnvironmentMetadata.encode(e.metadata,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseEnvironmentGetOrCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.environmentId=n.string();continue;case 2:if(18!==e)break;a.metadata=EnvironmentMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({environmentId:isSet4(e.environmentId)?globalThis.String(e.environmentId):"",metadata:isSet4(e.metadata)?EnvironmentMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.environmentId&&(t.environmentId=e.environmentId),void 0!==e.metadata&&(t.metadata=EnvironmentMetadata.toJSON(e.metadata)),t},create:e=>EnvironmentGetOrCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseEnvironmentGetOrCreateResponse();return t.environmentId=e.environmentId??"",t.metadata=void 0!==e.metadata&&null!==e.metadata?EnvironmentMetadata.fromPartial(e.metadata):void 0,t}};function createBaseEnvironmentListItem(){return{name:"",webhookSuffix:"",createdAt:0,default:!1,isManaged:!1,environmentId:"",maxConcurrentTasks:void 0,maxConcurrentGpus:void 0,currentConcurrentTasks:0,currentConcurrentGpus:0}}var EnvironmentListItem={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),""!==e.webhookSuffix&&t.uint32(18).string(e.webhookSuffix),0!==e.createdAt&&t.uint32(25).double(e.createdAt),!1!==e.default&&t.uint32(32).bool(e.default),!1!==e.isManaged&&t.uint32(40).bool(e.isManaged),""!==e.environmentId&&t.uint32(50).string(e.environmentId),void 0!==e.maxConcurrentTasks&&t.uint32(56).int32(e.maxConcurrentTasks),void 0!==e.maxConcurrentGpus&&t.uint32(64).int32(e.maxConcurrentGpus),0!==e.currentConcurrentTasks&&t.uint32(72).int32(e.currentConcurrentTasks),0!==e.currentConcurrentGpus&&t.uint32(80).int32(e.currentConcurrentGpus),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseEnvironmentListItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(18!==e)break;a.webhookSuffix=n.string();continue;case 3:if(25!==e)break;a.createdAt=n.double();continue;case 4:if(32!==e)break;a.default=n.bool();continue;case 5:if(40!==e)break;a.isManaged=n.bool();continue;case 6:if(50!==e)break;a.environmentId=n.string();continue;case 7:if(56!==e)break;a.maxConcurrentTasks=n.int32();continue;case 8:if(64!==e)break;a.maxConcurrentGpus=n.int32();continue;case 9:if(72!==e)break;a.currentConcurrentTasks=n.int32();continue;case 10:if(80!==e)break;a.currentConcurrentGpus=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",webhookSuffix:isSet4(e.webhookSuffix)?globalThis.String(e.webhookSuffix):"",createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,default:!!isSet4(e.default)&&globalThis.Boolean(e.default),isManaged:!!isSet4(e.isManaged)&&globalThis.Boolean(e.isManaged),environmentId:isSet4(e.environmentId)?globalThis.String(e.environmentId):"",maxConcurrentTasks:isSet4(e.maxConcurrentTasks)?globalThis.Number(e.maxConcurrentTasks):void 0,maxConcurrentGpus:isSet4(e.maxConcurrentGpus)?globalThis.Number(e.maxConcurrentGpus):void 0,currentConcurrentTasks:isSet4(e.currentConcurrentTasks)?globalThis.Number(e.currentConcurrentTasks):0,currentConcurrentGpus:isSet4(e.currentConcurrentGpus)?globalThis.Number(e.currentConcurrentGpus):0}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),""!==e.webhookSuffix&&(t.webhookSuffix=e.webhookSuffix),0!==e.createdAt&&(t.createdAt=e.createdAt),!1!==e.default&&(t.default=e.default),!1!==e.isManaged&&(t.isManaged=e.isManaged),""!==e.environmentId&&(t.environmentId=e.environmentId),void 0!==e.maxConcurrentTasks&&(t.maxConcurrentTasks=Math.round(e.maxConcurrentTasks)),void 0!==e.maxConcurrentGpus&&(t.maxConcurrentGpus=Math.round(e.maxConcurrentGpus)),0!==e.currentConcurrentTasks&&(t.currentConcurrentTasks=Math.round(e.currentConcurrentTasks)),0!==e.currentConcurrentGpus&&(t.currentConcurrentGpus=Math.round(e.currentConcurrentGpus)),t},create:e=>EnvironmentListItem.fromPartial(e??{}),fromPartial(e){const t=createBaseEnvironmentListItem();return t.name=e.name??"",t.webhookSuffix=e.webhookSuffix??"",t.createdAt=e.createdAt??0,t.default=e.default??!1,t.isManaged=e.isManaged??!1,t.environmentId=e.environmentId??"",t.maxConcurrentTasks=e.maxConcurrentTasks??void 0,t.maxConcurrentGpus=e.maxConcurrentGpus??void 0,t.currentConcurrentTasks=e.currentConcurrentTasks??0,t.currentConcurrentGpus=e.currentConcurrentGpus??0,t}};function createBaseEnvironmentListResponse(){return{items:[]}}var EnvironmentListResponse={encode(e,t=new BinaryWriter){for(const n of e.items)EnvironmentListItem.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseEnvironmentListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 2:if(18!==e)break;a.items.push(EnvironmentListItem.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({items:globalThis.Array.isArray(e?.items)?e.items.map((e=>EnvironmentListItem.fromJSON(e))):[]}),toJSON(e){const t={};return e.items?.length&&(t.items=e.items.map((e=>EnvironmentListItem.toJSON(e)))),t},create:e=>EnvironmentListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseEnvironmentListResponse();return t.items=e.items?.map((e=>EnvironmentListItem.fromPartial(e)))||[],t}};function createBaseEnvironmentMetadata(){return{name:"",settings:void 0}}var EnvironmentMetadata={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),void 0!==e.settings&&EnvironmentSettings.encode(e.settings,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseEnvironmentMetadata();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(18!==e)break;a.settings=EnvironmentSettings.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",settings:isSet4(e.settings)?EnvironmentSettings.fromJSON(e.settings):void 0}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),void 0!==e.settings&&(t.settings=EnvironmentSettings.toJSON(e.settings)),t},create:e=>EnvironmentMetadata.fromPartial(e??{}),fromPartial(e){const t=createBaseEnvironmentMetadata();return t.name=e.name??"",t.settings=void 0!==e.settings&&null!==e.settings?EnvironmentSettings.fromPartial(e.settings):void 0,t}};function createBaseEnvironmentSettings(){return{imageBuilderVersion:"",webhookSuffix:""}}var EnvironmentSettings={encode:(e,t=new BinaryWriter)=>(""!==e.imageBuilderVersion&&t.uint32(10).string(e.imageBuilderVersion),""!==e.webhookSuffix&&t.uint32(18).string(e.webhookSuffix),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseEnvironmentSettings();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.imageBuilderVersion=n.string();continue;case 2:if(18!==e)break;a.webhookSuffix=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({imageBuilderVersion:isSet4(e.imageBuilderVersion)?globalThis.String(e.imageBuilderVersion):"",webhookSuffix:isSet4(e.webhookSuffix)?globalThis.String(e.webhookSuffix):""}),toJSON(e){const t={};return""!==e.imageBuilderVersion&&(t.imageBuilderVersion=e.imageBuilderVersion),""!==e.webhookSuffix&&(t.webhookSuffix=e.webhookSuffix),t},create:e=>EnvironmentSettings.fromPartial(e??{}),fromPartial(e){const t=createBaseEnvironmentSettings();return t.imageBuilderVersion=e.imageBuilderVersion??"",t.webhookSuffix=e.webhookSuffix??"",t}};function createBaseEnvironmentUpdateRequest(){return{currentName:"",name:void 0,webSuffix:void 0,maxConcurrentTasks:void 0,maxConcurrentGpus:void 0}}var EnvironmentUpdateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.currentName&&t.uint32(10).string(e.currentName),void 0!==e.name&&StringValue.encode({value:e.name},t.uint32(18).fork()).join(),void 0!==e.webSuffix&&StringValue.encode({value:e.webSuffix},t.uint32(26).fork()).join(),void 0!==e.maxConcurrentTasks&&t.uint32(32).int32(e.maxConcurrentTasks),void 0!==e.maxConcurrentGpus&&t.uint32(40).int32(e.maxConcurrentGpus),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseEnvironmentUpdateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.currentName=n.string();continue;case 2:if(18!==e)break;a.name=StringValue.decode(n,n.uint32()).value;continue;case 3:if(26!==e)break;a.webSuffix=StringValue.decode(n,n.uint32()).value;continue;case 4:if(32!==e)break;a.maxConcurrentTasks=n.int32();continue;case 5:if(40!==e)break;a.maxConcurrentGpus=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({currentName:isSet4(e.currentName)?globalThis.String(e.currentName):"",name:isSet4(e.name)?String(e.name):void 0,webSuffix:isSet4(e.webSuffix)?String(e.webSuffix):void 0,maxConcurrentTasks:isSet4(e.maxConcurrentTasks)?globalThis.Number(e.maxConcurrentTasks):void 0,maxConcurrentGpus:isSet4(e.maxConcurrentGpus)?globalThis.Number(e.maxConcurrentGpus):void 0}),toJSON(e){const t={};return""!==e.currentName&&(t.currentName=e.currentName),void 0!==e.name&&(t.name=e.name),void 0!==e.webSuffix&&(t.webSuffix=e.webSuffix),void 0!==e.maxConcurrentTasks&&(t.maxConcurrentTasks=Math.round(e.maxConcurrentTasks)),void 0!==e.maxConcurrentGpus&&(t.maxConcurrentGpus=Math.round(e.maxConcurrentGpus)),t},create:e=>EnvironmentUpdateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseEnvironmentUpdateRequest();return t.currentName=e.currentName??"",t.name=e.name??void 0,t.webSuffix=e.webSuffix??void 0,t.maxConcurrentTasks=e.maxConcurrentTasks??void 0,t.maxConcurrentGpus=e.maxConcurrentGpus??void 0,t}};function createBaseFileEntry(){return{path:"",type:0,mtime:0,size:0}}var FileEntry={encode:(e,t=new BinaryWriter)=>(""!==e.path&&t.uint32(10).string(e.path),0!==e.type&&t.uint32(16).int32(e.type),0!==e.mtime&&t.uint32(24).uint64(e.mtime),0!==e.size&&t.uint32(32).uint64(e.size),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFileEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.path=n.string();continue;case 2:if(16!==e)break;a.type=n.int32();continue;case 3:if(24!==e)break;a.mtime=longToNumber2(n.uint64());continue;case 4:if(32!==e)break;a.size=longToNumber2(n.uint64());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({path:isSet4(e.path)?globalThis.String(e.path):"",type:isSet4(e.type)?fileEntry_FileTypeFromJSON(e.type):0,mtime:isSet4(e.mtime)?globalThis.Number(e.mtime):0,size:isSet4(e.size)?globalThis.Number(e.size):0}),toJSON(e){const t={};return""!==e.path&&(t.path=e.path),0!==e.type&&(t.type=fileEntry_FileTypeToJSON(e.type)),0!==e.mtime&&(t.mtime=Math.round(e.mtime)),0!==e.size&&(t.size=Math.round(e.size)),t},create:e=>FileEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseFileEntry();return t.path=e.path??"",t.type=e.type??0,t.mtime=e.mtime??0,t.size=e.size??0,t}};function createBaseFilesystemRuntimeOutputBatch(){return{output:[],error:void 0,batchIndex:0,eof:!1}}var FilesystemRuntimeOutputBatch={encode(e,t=new BinaryWriter){for(const n of e.output)t.uint32(10).bytes(n);return void 0!==e.error&&SystemErrorMessage.encode(e.error,t.uint32(18).fork()).join(),0!==e.batchIndex&&t.uint32(24).uint64(e.batchIndex),!1!==e.eof&&t.uint32(32).bool(e.eof),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFilesystemRuntimeOutputBatch();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.output.push(n.bytes());continue;case 2:if(18!==e)break;a.error=SystemErrorMessage.decode(n,n.uint32());continue;case 3:if(24!==e)break;a.batchIndex=longToNumber2(n.uint64());continue;case 4:if(32!==e)break;a.eof=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({output:globalThis.Array.isArray(e?.output)?e.output.map((e=>bytesFromBase64(e))):[],error:isSet4(e.error)?SystemErrorMessage.fromJSON(e.error):void 0,batchIndex:isSet4(e.batchIndex)?globalThis.Number(e.batchIndex):0,eof:!!isSet4(e.eof)&&globalThis.Boolean(e.eof)}),toJSON(e){const t={};return e.output?.length&&(t.output=e.output.map((e=>base64FromBytes(e)))),void 0!==e.error&&(t.error=SystemErrorMessage.toJSON(e.error)),0!==e.batchIndex&&(t.batchIndex=Math.round(e.batchIndex)),!1!==e.eof&&(t.eof=e.eof),t},create:e=>FilesystemRuntimeOutputBatch.fromPartial(e??{}),fromPartial(e){const t=createBaseFilesystemRuntimeOutputBatch();return t.output=e.output?.map((e=>e))||[],t.error=void 0!==e.error&&null!==e.error?SystemErrorMessage.fromPartial(e.error):void 0,t.batchIndex=e.batchIndex??0,t.eof=e.eof??!1,t}};function createBaseFlashContainerDeregisterRequest(){return{serviceName:""}}var FlashContainerDeregisterRequest={encode:(e,t=new BinaryWriter)=>(""!==e.serviceName&&t.uint32(10).string(e.serviceName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFlashContainerDeregisterRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.serviceName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({serviceName:isSet4(e.serviceName)?globalThis.String(e.serviceName):""}),toJSON(e){const t={};return""!==e.serviceName&&(t.serviceName=e.serviceName),t},create:e=>FlashContainerDeregisterRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFlashContainerDeregisterRequest();return t.serviceName=e.serviceName??"",t}};function createBaseFlashContainerListRequest(){return{functionId:""}}var FlashContainerListRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFlashContainerListRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):""}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),t},create:e=>FlashContainerListRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFlashContainerListRequest();return t.functionId=e.functionId??"",t}};function createBaseFlashContainerListResponse(){return{containers:[]}}var FlashContainerListResponse={encode(e,t=new BinaryWriter){for(const n of e.containers)FlashContainerListResponse_Container.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFlashContainerListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.containers.push(FlashContainerListResponse_Container.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({containers:globalThis.Array.isArray(e?.containers)?e.containers.map((e=>FlashContainerListResponse_Container.fromJSON(e))):[]}),toJSON(e){const t={};return e.containers?.length&&(t.containers=e.containers.map((e=>FlashContainerListResponse_Container.toJSON(e)))),t},create:e=>FlashContainerListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFlashContainerListResponse();return t.containers=e.containers?.map((e=>FlashContainerListResponse_Container.fromPartial(e)))||[],t}};function createBaseFlashContainerListResponse_Container(){return{taskId:"",host:"",port:0}}var FlashContainerListResponse_Container={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),""!==e.host&&t.uint32(18).string(e.host),0!==e.port&&t.uint32(24).uint32(e.port),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFlashContainerListResponse_Container();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.host=n.string();continue;case 3:if(24!==e)break;a.port=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet4(e.taskId)?globalThis.String(e.taskId):"",host:isSet4(e.host)?globalThis.String(e.host):"",port:isSet4(e.port)?globalThis.Number(e.port):0}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),""!==e.host&&(t.host=e.host),0!==e.port&&(t.port=Math.round(e.port)),t},create:e=>FlashContainerListResponse_Container.fromPartial(e??{}),fromPartial(e){const t=createBaseFlashContainerListResponse_Container();return t.taskId=e.taskId??"",t.host=e.host??"",t.port=e.port??0,t}};function createBaseFlashContainerRegisterRequest(){return{serviceName:"",priority:0,weight:0,host:"",port:0}}var FlashContainerRegisterRequest={encode:(e,t=new BinaryWriter)=>(""!==e.serviceName&&t.uint32(10).string(e.serviceName),0!==e.priority&&t.uint32(16).uint32(e.priority),0!==e.weight&&t.uint32(24).uint32(e.weight),""!==e.host&&t.uint32(34).string(e.host),0!==e.port&&t.uint32(40).uint32(e.port),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFlashContainerRegisterRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.serviceName=n.string();continue;case 2:if(16!==e)break;a.priority=n.uint32();continue;case 3:if(24!==e)break;a.weight=n.uint32();continue;case 4:if(34!==e)break;a.host=n.string();continue;case 5:if(40!==e)break;a.port=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({serviceName:isSet4(e.serviceName)?globalThis.String(e.serviceName):"",priority:isSet4(e.priority)?globalThis.Number(e.priority):0,weight:isSet4(e.weight)?globalThis.Number(e.weight):0,host:isSet4(e.host)?globalThis.String(e.host):"",port:isSet4(e.port)?globalThis.Number(e.port):0}),toJSON(e){const t={};return""!==e.serviceName&&(t.serviceName=e.serviceName),0!==e.priority&&(t.priority=Math.round(e.priority)),0!==e.weight&&(t.weight=Math.round(e.weight)),""!==e.host&&(t.host=e.host),0!==e.port&&(t.port=Math.round(e.port)),t},create:e=>FlashContainerRegisterRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFlashContainerRegisterRequest();return t.serviceName=e.serviceName??"",t.priority=e.priority??0,t.weight=e.weight??0,t.host=e.host??"",t.port=e.port??0,t}};function createBaseFlashContainerRegisterResponse(){return{url:""}}var FlashContainerRegisterResponse={encode:(e,t=new BinaryWriter)=>(""!==e.url&&t.uint32(10).string(e.url),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFlashContainerRegisterResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.url=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({url:isSet4(e.url)?globalThis.String(e.url):""}),toJSON(e){const t={};return""!==e.url&&(t.url=e.url),t},create:e=>FlashContainerRegisterResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFlashContainerRegisterResponse();return t.url=e.url??"",t}};function createBaseFlashSetTargetSlotsMetricsRequest(){return{functionId:"",targetSlots:0}}var FlashSetTargetSlotsMetricsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),0!==e.targetSlots&&t.uint32(16).uint32(e.targetSlots),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFlashSetTargetSlotsMetricsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(16!==e)break;a.targetSlots=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",targetSlots:isSet4(e.targetSlots)?globalThis.Number(e.targetSlots):0}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),0!==e.targetSlots&&(t.targetSlots=Math.round(e.targetSlots)),t},create:e=>FlashSetTargetSlotsMetricsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFlashSetTargetSlotsMetricsRequest();return t.functionId=e.functionId??"",t.targetSlots=e.targetSlots??0,t}};function createBaseFlashSetTargetSlotsMetricsResponse(){return{}}var FlashSetTargetSlotsMetricsResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFlashSetTargetSlotsMetricsResponse();for(;n.pos<r;){const e=n.uint32();if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({}),toJSON:e=>({}),create:e=>FlashSetTargetSlotsMetricsResponse.fromPartial(e??{}),fromPartial:e=>createBaseFlashSetTargetSlotsMetricsResponse()};function createBaseFunctionMessage(){return{moduleName:"",functionName:"",mountIds:[],imageId:"",functionSerialized:new Uint8Array(0),definitionType:0,functionType:0,resources:void 0,secretIds:[],rateLimit:void 0,webhookConfig:void 0,sharedVolumeMounts:[],proxyId:void 0,retryPolicy:void 0,concurrencyLimit:0,timeoutSecs:0,ptyInfo:void 0,classSerialized:new Uint8Array(0),taskIdleTimeoutSecs:0,cloudProvider:void 0,warmPoolSize:0,webUrl:"",webUrlInfo:void 0,runtime:"",appName:"",volumeMounts:[],maxConcurrentInputs:0,customDomainInfo:[],workerId:"",runtimeDebug:!1,isBuilderFunction:!1,isAutoSnapshot:!1,isMethod:!1,isCheckpointingFunction:!1,checkpointingEnabled:!1,checkpoint:void 0,objectDependencies:[],blockNetwork:!1,maxInputs:0,s3Mounts:[],cloudBucketMounts:[],schedulerPlacement:void 0,isClass:!1,useFunctionId:"",useMethodName:"",classParameterInfo:void 0,batchMaxSize:0,batchLingerMs:0,i6pnEnabled:!1,ExperimentalConcurrentCancellations:!1,targetConcurrentInputs:0,ExperimentalTaskTemplatesEnabled:!1,ExperimentalTaskTemplates:[],ExperimentalGroupSize:0,untrusted:!1,ExperimentalBufferContainers:0,ExperimentalProxyIp:void 0,runtimePerfRecord:!1,schedule:void 0,snapshotDebug:!1,methodDefinitions:{},methodDefinitionsSet:!1,ExperimentalCustomScaling:!1,cloudProviderStr:"",ExperimentalEnableGpuSnapshot:!1,autoscalerSettings:void 0,functionSchema:void 0,experimentalOptions:{},mountClientDependencies:!1,flashServiceUrls:[],flashServiceLabel:"",enableGpuSnapshot:!1,startupTimeoutSecs:0,supportedInputFormats:[],supportedOutputFormats:[],httpConfig:void 0,implementationName:"",singleUseContainers:!1,isServer:!1}}var FunctionMessage={encode(e,t=new BinaryWriter){""!==e.moduleName&&t.uint32(10).string(e.moduleName),""!==e.functionName&&t.uint32(18).string(e.functionName);for(const n of e.mountIds)t.uint32(26).string(n);""!==e.imageId&&t.uint32(34).string(e.imageId),0!==e.functionSerialized.length&&t.uint32(50).bytes(e.functionSerialized),0!==e.definitionType&&t.uint32(56).int32(e.definitionType),0!==e.functionType&&t.uint32(64).int32(e.functionType),void 0!==e.resources&&Resources.encode(e.resources,t.uint32(74).fork()).join();for(const n of e.secretIds)t.uint32(82).string(n);void 0!==e.rateLimit&&RateLimit.encode(e.rateLimit,t.uint32(90).fork()).join(),void 0!==e.webhookConfig&&WebhookConfig.encode(e.webhookConfig,t.uint32(122).fork()).join();for(const n of e.sharedVolumeMounts)SharedVolumeMount.encode(n,t.uint32(130).fork()).join();void 0!==e.proxyId&&t.uint32(138).string(e.proxyId),void 0!==e.retryPolicy&&FunctionRetryPolicy.encode(e.retryPolicy,t.uint32(146).fork()).join(),0!==e.concurrencyLimit&&t.uint32(152).uint32(e.concurrencyLimit),0!==e.timeoutSecs&&t.uint32(168).uint32(e.timeoutSecs),void 0!==e.ptyInfo&&PTYInfo.encode(e.ptyInfo,t.uint32(178).fork()).join(),0!==e.classSerialized.length&&t.uint32(186).bytes(e.classSerialized),0!==e.taskIdleTimeoutSecs&&t.uint32(200).uint32(e.taskIdleTimeoutSecs),void 0!==e.cloudProvider&&t.uint32(208).int32(e.cloudProvider),0!==e.warmPoolSize&&t.uint32(216).uint32(e.warmPoolSize),""!==e.webUrl&&t.uint32(226).string(e.webUrl),void 0!==e.webUrlInfo&&WebUrlInfo.encode(e.webUrlInfo,t.uint32(234).fork()).join(),""!==e.runtime&&t.uint32(242).string(e.runtime),""!==e.appName&&t.uint32(250).string(e.appName);for(const n of e.volumeMounts)VolumeMount.encode(n,t.uint32(266).fork()).join();0!==e.maxConcurrentInputs&&t.uint32(272).uint32(e.maxConcurrentInputs);for(const n of e.customDomainInfo)CustomDomainInfo.encode(n,t.uint32(282).fork()).join();""!==e.workerId&&t.uint32(290).string(e.workerId),!1!==e.runtimeDebug&&t.uint32(296).bool(e.runtimeDebug),!1!==e.isBuilderFunction&&t.uint32(256).bool(e.isBuilderFunction),!1!==e.isAutoSnapshot&&t.uint32(304).bool(e.isAutoSnapshot),!1!==e.isMethod&&t.uint32(312).bool(e.isMethod),!1!==e.isCheckpointingFunction&&t.uint32(320).bool(e.isCheckpointingFunction),!1!==e.checkpointingEnabled&&t.uint32(328).bool(e.checkpointingEnabled),void 0!==e.checkpoint&&CheckpointInfo.encode(e.checkpoint,t.uint32(338).fork()).join();for(const n of e.objectDependencies)ObjectDependency.encode(n,t.uint32(346).fork()).join();!1!==e.blockNetwork&&t.uint32(352).bool(e.blockNetwork),0!==e.maxInputs&&t.uint32(368).uint32(e.maxInputs);for(const n of e.s3Mounts)S3Mount.encode(n,t.uint32(378).fork()).join();for(const n of e.cloudBucketMounts)CloudBucketMount.encode(n,t.uint32(410).fork()).join();void 0!==e.schedulerPlacement&&SchedulerPlacement.encode(e.schedulerPlacement,t.uint32(402).fork()).join(),!1!==e.isClass&&t.uint32(424).bool(e.isClass),""!==e.useFunctionId&&t.uint32(434).string(e.useFunctionId),""!==e.useMethodName&&t.uint32(442).string(e.useMethodName),void 0!==e.classParameterInfo&&ClassParameterInfo.encode(e.classParameterInfo,t.uint32(450).fork()).join(),0!==e.batchMaxSize&&t.uint32(480).uint32(e.batchMaxSize),0!==e.batchLingerMs&&t.uint32(488).uint64(e.batchLingerMs),!1!==e.i6pnEnabled&&t.uint32(496).bool(e.i6pnEnabled),!1!==e.ExperimentalConcurrentCancellations&&t.uint32(504).bool(e.ExperimentalConcurrentCancellations),0!==e.targetConcurrentInputs&&t.uint32(512).uint32(e.targetConcurrentInputs),!1!==e.ExperimentalTaskTemplatesEnabled&&t.uint32(520).bool(e.ExperimentalTaskTemplatesEnabled);for(const n of e.ExperimentalTaskTemplates)TaskTemplate.encode(n,t.uint32(530).fork()).join();0!==e.ExperimentalGroupSize&&t.uint32(536).uint32(e.ExperimentalGroupSize),!1!==e.untrusted&&t.uint32(544).bool(e.untrusted),0!==e.ExperimentalBufferContainers&&t.uint32(552).uint32(e.ExperimentalBufferContainers),void 0!==e.ExperimentalProxyIp&&t.uint32(562).string(e.ExperimentalProxyIp),!1!==e.runtimePerfRecord&&t.uint32(568).bool(e.runtimePerfRecord),void 0!==e.schedule&&Schedule.encode(e.schedule,t.uint32(578).fork()).join(),!1!==e.snapshotDebug&&t.uint32(584).bool(e.snapshotDebug),Object.entries(e.methodDefinitions).forEach((([e,n])=>{Function_MethodDefinitionsEntry.encode({key:e,value:n},t.uint32(594).fork()).join()})),!1!==e.methodDefinitionsSet&&t.uint32(600).bool(e.methodDefinitionsSet),!1!==e.ExperimentalCustomScaling&&t.uint32(608).bool(e.ExperimentalCustomScaling),""!==e.cloudProviderStr&&t.uint32(618).string(e.cloudProviderStr),!1!==e.ExperimentalEnableGpuSnapshot&&t.uint32(624).bool(e.ExperimentalEnableGpuSnapshot),void 0!==e.autoscalerSettings&&AutoscalerSettings.encode(e.autoscalerSettings,t.uint32(634).fork()).join(),void 0!==e.functionSchema&&FunctionSchema.encode(e.functionSchema,t.uint32(642).fork()).join(),Object.entries(e.experimentalOptions).forEach((([e,n])=>{Function_ExperimentalOptionsEntry.encode({key:e,value:n},t.uint32(650).fork()).join()})),!1!==e.mountClientDependencies&&t.uint32(656).bool(e.mountClientDependencies);for(const n of e.flashServiceUrls)t.uint32(666).string(n);""!==e.flashServiceLabel&&t.uint32(674).string(e.flashServiceLabel),!1!==e.enableGpuSnapshot&&t.uint32(680).bool(e.enableGpuSnapshot),0!==e.startupTimeoutSecs&&t.uint32(688).uint32(e.startupTimeoutSecs),t.uint32(698).fork();for(const n of e.supportedInputFormats)t.int32(n);t.join(),t.uint32(706).fork();for(const n of e.supportedOutputFormats)t.int32(n);return t.join(),void 0!==e.httpConfig&&HTTPConfig.encode(e.httpConfig,t.uint32(714).fork()).join(),""!==e.implementationName&&t.uint32(722).string(e.implementationName),!1!==e.singleUseContainers&&t.uint32(728).bool(e.singleUseContainers),!1!==e.isServer&&t.uint32(736).bool(e.isServer),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionMessage();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.moduleName=n.string();continue;case 2:if(18!==e)break;a.functionName=n.string();continue;case 3:if(26!==e)break;a.mountIds.push(n.string());continue;case 4:if(34!==e)break;a.imageId=n.string();continue;case 6:if(50!==e)break;a.functionSerialized=n.bytes();continue;case 7:if(56!==e)break;a.definitionType=n.int32();continue;case 8:if(64!==e)break;a.functionType=n.int32();continue;case 9:if(74!==e)break;a.resources=Resources.decode(n,n.uint32());continue;case 10:if(82!==e)break;a.secretIds.push(n.string());continue;case 11:if(90!==e)break;a.rateLimit=RateLimit.decode(n,n.uint32());continue;case 15:if(122!==e)break;a.webhookConfig=WebhookConfig.decode(n,n.uint32());continue;case 16:if(130!==e)break;a.sharedVolumeMounts.push(SharedVolumeMount.decode(n,n.uint32()));continue;case 17:if(138!==e)break;a.proxyId=n.string();continue;case 18:if(146!==e)break;a.retryPolicy=FunctionRetryPolicy.decode(n,n.uint32());continue;case 19:if(152!==e)break;a.concurrencyLimit=n.uint32();continue;case 21:if(168!==e)break;a.timeoutSecs=n.uint32();continue;case 22:if(178!==e)break;a.ptyInfo=PTYInfo.decode(n,n.uint32());continue;case 23:if(186!==e)break;a.classSerialized=n.bytes();continue;case 25:if(200!==e)break;a.taskIdleTimeoutSecs=n.uint32();continue;case 26:if(208!==e)break;a.cloudProvider=n.int32();continue;case 27:if(216!==e)break;a.warmPoolSize=n.uint32();continue;case 28:if(226!==e)break;a.webUrl=n.string();continue;case 29:if(234!==e)break;a.webUrlInfo=WebUrlInfo.decode(n,n.uint32());continue;case 30:if(242!==e)break;a.runtime=n.string();continue;case 31:if(250!==e)break;a.appName=n.string();continue;case 33:if(266!==e)break;a.volumeMounts.push(VolumeMount.decode(n,n.uint32()));continue;case 34:if(272!==e)break;a.maxConcurrentInputs=n.uint32();continue;case 35:if(282!==e)break;a.customDomainInfo.push(CustomDomainInfo.decode(n,n.uint32()));continue;case 36:if(290!==e)break;a.workerId=n.string();continue;case 37:if(296!==e)break;a.runtimeDebug=n.bool();continue;case 32:if(256!==e)break;a.isBuilderFunction=n.bool();continue;case 38:if(304!==e)break;a.isAutoSnapshot=n.bool();continue;case 39:if(312!==e)break;a.isMethod=n.bool();continue;case 40:if(320!==e)break;a.isCheckpointingFunction=n.bool();continue;case 41:if(328!==e)break;a.checkpointingEnabled=n.bool();continue;case 42:if(338!==e)break;a.checkpoint=CheckpointInfo.decode(n,n.uint32());continue;case 43:if(346!==e)break;a.objectDependencies.push(ObjectDependency.decode(n,n.uint32()));continue;case 44:if(352!==e)break;a.blockNetwork=n.bool();continue;case 46:if(368!==e)break;a.maxInputs=n.uint32();continue;case 47:if(378!==e)break;a.s3Mounts.push(S3Mount.decode(n,n.uint32()));continue;case 51:if(410!==e)break;a.cloudBucketMounts.push(CloudBucketMount.decode(n,n.uint32()));continue;case 50:if(402!==e)break;a.schedulerPlacement=SchedulerPlacement.decode(n,n.uint32());continue;case 53:if(424!==e)break;a.isClass=n.bool();continue;case 54:if(434!==e)break;a.useFunctionId=n.string();continue;case 55:if(442!==e)break;a.useMethodName=n.string();continue;case 56:if(450!==e)break;a.classParameterInfo=ClassParameterInfo.decode(n,n.uint32());continue;case 60:if(480!==e)break;a.batchMaxSize=n.uint32();continue;case 61:if(488!==e)break;a.batchLingerMs=longToNumber2(n.uint64());continue;case 62:if(496!==e)break;a.i6pnEnabled=n.bool();continue;case 63:if(504!==e)break;a.ExperimentalConcurrentCancellations=n.bool();continue;case 64:if(512!==e)break;a.targetConcurrentInputs=n.uint32();continue;case 65:if(520!==e)break;a.ExperimentalTaskTemplatesEnabled=n.bool();continue;case 66:if(530!==e)break;a.ExperimentalTaskTemplates.push(TaskTemplate.decode(n,n.uint32()));continue;case 67:if(536!==e)break;a.ExperimentalGroupSize=n.uint32();continue;case 68:if(544!==e)break;a.untrusted=n.bool();continue;case 69:if(552!==e)break;a.ExperimentalBufferContainers=n.uint32();continue;case 70:if(562!==e)break;a.ExperimentalProxyIp=n.string();continue;case 71:if(568!==e)break;a.runtimePerfRecord=n.bool();continue;case 72:if(578!==e)break;a.schedule=Schedule.decode(n,n.uint32());continue;case 73:if(584!==e)break;a.snapshotDebug=n.bool();continue;case 74:{if(594!==e)break;const t=Function_MethodDefinitionsEntry.decode(n,n.uint32());void 0!==t.value&&(a.methodDefinitions[t.key]=t.value);continue}case 75:if(600!==e)break;a.methodDefinitionsSet=n.bool();continue;case 76:if(608!==e)break;a.ExperimentalCustomScaling=n.bool();continue;case 77:if(618!==e)break;a.cloudProviderStr=n.string();continue;case 78:if(624!==e)break;a.ExperimentalEnableGpuSnapshot=n.bool();continue;case 79:if(634!==e)break;a.autoscalerSettings=AutoscalerSettings.decode(n,n.uint32());continue;case 80:if(642!==e)break;a.functionSchema=FunctionSchema.decode(n,n.uint32());continue;case 81:{if(650!==e)break;const t=Function_ExperimentalOptionsEntry.decode(n,n.uint32());void 0!==t.value&&(a.experimentalOptions[t.key]=t.value);continue}case 82:if(656!==e)break;a.mountClientDependencies=n.bool();continue;case 83:if(666!==e)break;a.flashServiceUrls.push(n.string());continue;case 84:if(674!==e)break;a.flashServiceLabel=n.string();continue;case 85:if(680!==e)break;a.enableGpuSnapshot=n.bool();continue;case 86:if(688!==e)break;a.startupTimeoutSecs=n.uint32();continue;case 87:if(696===e){a.supportedInputFormats.push(n.int32());continue}if(698===e){const e=n.uint32()+n.pos;for(;n.pos<e;)a.supportedInputFormats.push(n.int32());continue}break;case 88:if(704===e){a.supportedOutputFormats.push(n.int32());continue}if(706===e){const e=n.uint32()+n.pos;for(;n.pos<e;)a.supportedOutputFormats.push(n.int32());continue}break;case 89:if(714!==e)break;a.httpConfig=HTTPConfig.decode(n,n.uint32());continue;case 90:if(722!==e)break;a.implementationName=n.string();continue;case 91:if(728!==e)break;a.singleUseContainers=n.bool();continue;case 92:if(736!==e)break;a.isServer=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({moduleName:isSet4(e.moduleName)?globalThis.String(e.moduleName):"",functionName:isSet4(e.functionName)?globalThis.String(e.functionName):"",mountIds:globalThis.Array.isArray(e?.mountIds)?e.mountIds.map((e=>globalThis.String(e))):[],imageId:isSet4(e.imageId)?globalThis.String(e.imageId):"",functionSerialized:isSet4(e.functionSerialized)?bytesFromBase64(e.functionSerialized):new Uint8Array(0),definitionType:isSet4(e.definitionType)?function_DefinitionTypeFromJSON(e.definitionType):0,functionType:isSet4(e.functionType)?function_FunctionTypeFromJSON(e.functionType):0,resources:isSet4(e.resources)?Resources.fromJSON(e.resources):void 0,secretIds:globalThis.Array.isArray(e?.secretIds)?e.secretIds.map((e=>globalThis.String(e))):[],rateLimit:isSet4(e.rateLimit)?RateLimit.fromJSON(e.rateLimit):void 0,webhookConfig:isSet4(e.webhookConfig)?WebhookConfig.fromJSON(e.webhookConfig):void 0,sharedVolumeMounts:globalThis.Array.isArray(e?.sharedVolumeMounts)?e.sharedVolumeMounts.map((e=>SharedVolumeMount.fromJSON(e))):[],proxyId:isSet4(e.proxyId)?globalThis.String(e.proxyId):void 0,retryPolicy:isSet4(e.retryPolicy)?FunctionRetryPolicy.fromJSON(e.retryPolicy):void 0,concurrencyLimit:isSet4(e.concurrencyLimit)?globalThis.Number(e.concurrencyLimit):0,timeoutSecs:isSet4(e.timeoutSecs)?globalThis.Number(e.timeoutSecs):0,ptyInfo:isSet4(e.ptyInfo)?PTYInfo.fromJSON(e.ptyInfo):void 0,classSerialized:isSet4(e.classSerialized)?bytesFromBase64(e.classSerialized):new Uint8Array(0),taskIdleTimeoutSecs:isSet4(e.taskIdleTimeoutSecs)?globalThis.Number(e.taskIdleTimeoutSecs):0,cloudProvider:isSet4(e.cloudProvider)?cloudProviderFromJSON(e.cloudProvider):void 0,warmPoolSize:isSet4(e.warmPoolSize)?globalThis.Number(e.warmPoolSize):0,webUrl:isSet4(e.webUrl)?globalThis.String(e.webUrl):"",webUrlInfo:isSet4(e.webUrlInfo)?WebUrlInfo.fromJSON(e.webUrlInfo):void 0,runtime:isSet4(e.runtime)?globalThis.String(e.runtime):"",appName:isSet4(e.appName)?globalThis.String(e.appName):"",volumeMounts:globalThis.Array.isArray(e?.volumeMounts)?e.volumeMounts.map((e=>VolumeMount.fromJSON(e))):[],maxConcurrentInputs:isSet4(e.maxConcurrentInputs)?globalThis.Number(e.maxConcurrentInputs):0,customDomainInfo:globalThis.Array.isArray(e?.customDomainInfo)?e.customDomainInfo.map((e=>CustomDomainInfo.fromJSON(e))):[],workerId:isSet4(e.workerId)?globalThis.String(e.workerId):"",runtimeDebug:!!isSet4(e.runtimeDebug)&&globalThis.Boolean(e.runtimeDebug),isBuilderFunction:!!isSet4(e.isBuilderFunction)&&globalThis.Boolean(e.isBuilderFunction),isAutoSnapshot:!!isSet4(e.isAutoSnapshot)&&globalThis.Boolean(e.isAutoSnapshot),isMethod:!!isSet4(e.isMethod)&&globalThis.Boolean(e.isMethod),isCheckpointingFunction:!!isSet4(e.isCheckpointingFunction)&&globalThis.Boolean(e.isCheckpointingFunction),checkpointingEnabled:!!isSet4(e.checkpointingEnabled)&&globalThis.Boolean(e.checkpointingEnabled),checkpoint:isSet4(e.checkpoint)?CheckpointInfo.fromJSON(e.checkpoint):void 0,objectDependencies:globalThis.Array.isArray(e?.objectDependencies)?e.objectDependencies.map((e=>ObjectDependency.fromJSON(e))):[],blockNetwork:!!isSet4(e.blockNetwork)&&globalThis.Boolean(e.blockNetwork),maxInputs:isSet4(e.maxInputs)?globalThis.Number(e.maxInputs):0,s3Mounts:globalThis.Array.isArray(e?.s3Mounts)?e.s3Mounts.map((e=>S3Mount.fromJSON(e))):[],cloudBucketMounts:globalThis.Array.isArray(e?.cloudBucketMounts)?e.cloudBucketMounts.map((e=>CloudBucketMount.fromJSON(e))):[],schedulerPlacement:isSet4(e.schedulerPlacement)?SchedulerPlacement.fromJSON(e.schedulerPlacement):void 0,isClass:!!isSet4(e.isClass)&&globalThis.Boolean(e.isClass),useFunctionId:isSet4(e.useFunctionId)?globalThis.String(e.useFunctionId):"",useMethodName:isSet4(e.useMethodName)?globalThis.String(e.useMethodName):"",classParameterInfo:isSet4(e.classParameterInfo)?ClassParameterInfo.fromJSON(e.classParameterInfo):void 0,batchMaxSize:isSet4(e.batchMaxSize)?globalThis.Number(e.batchMaxSize):0,batchLingerMs:isSet4(e.batchLingerMs)?globalThis.Number(e.batchLingerMs):0,i6pnEnabled:!!isSet4(e.i6pnEnabled)&&globalThis.Boolean(e.i6pnEnabled),ExperimentalConcurrentCancellations:!!isSet4(e.ExperimentalConcurrentCancellations)&&globalThis.Boolean(e.ExperimentalConcurrentCancellations),targetConcurrentInputs:isSet4(e.targetConcurrentInputs)?globalThis.Number(e.targetConcurrentInputs):0,ExperimentalTaskTemplatesEnabled:!!isSet4(e.ExperimentalTaskTemplatesEnabled)&&globalThis.Boolean(e.ExperimentalTaskTemplatesEnabled),ExperimentalTaskTemplates:globalThis.Array.isArray(e?.ExperimentalTaskTemplates)?e.ExperimentalTaskTemplates.map((e=>TaskTemplate.fromJSON(e))):[],ExperimentalGroupSize:isSet4(e.ExperimentalGroupSize)?globalThis.Number(e.ExperimentalGroupSize):0,untrusted:!!isSet4(e.untrusted)&&globalThis.Boolean(e.untrusted),ExperimentalBufferContainers:isSet4(e.ExperimentalBufferContainers)?globalThis.Number(e.ExperimentalBufferContainers):0,ExperimentalProxyIp:isSet4(e.ExperimentalProxyIp)?globalThis.String(e.ExperimentalProxyIp):void 0,runtimePerfRecord:!!isSet4(e.runtimePerfRecord)&&globalThis.Boolean(e.runtimePerfRecord),schedule:isSet4(e.schedule)?Schedule.fromJSON(e.schedule):void 0,snapshotDebug:!!isSet4(e.snapshotDebug)&&globalThis.Boolean(e.snapshotDebug),methodDefinitions:isObject2(e.methodDefinitions)?Object.entries(e.methodDefinitions).reduce(((e,[t,n])=>(e[t]=MethodDefinition.fromJSON(n),e)),{}):{},methodDefinitionsSet:!!isSet4(e.methodDefinitionsSet)&&globalThis.Boolean(e.methodDefinitionsSet),ExperimentalCustomScaling:!!isSet4(e.ExperimentalCustomScaling)&&globalThis.Boolean(e.ExperimentalCustomScaling),cloudProviderStr:isSet4(e.cloudProviderStr)?globalThis.String(e.cloudProviderStr):"",ExperimentalEnableGpuSnapshot:!!isSet4(e.ExperimentalEnableGpuSnapshot)&&globalThis.Boolean(e.ExperimentalEnableGpuSnapshot),autoscalerSettings:isSet4(e.autoscalerSettings)?AutoscalerSettings.fromJSON(e.autoscalerSettings):void 0,functionSchema:isSet4(e.functionSchema)?FunctionSchema.fromJSON(e.functionSchema):void 0,experimentalOptions:isObject2(e.experimentalOptions)?Object.entries(e.experimentalOptions).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{},mountClientDependencies:!!isSet4(e.mountClientDependencies)&&globalThis.Boolean(e.mountClientDependencies),flashServiceUrls:globalThis.Array.isArray(e?.flashServiceUrls)?e.flashServiceUrls.map((e=>globalThis.String(e))):[],flashServiceLabel:isSet4(e.flashServiceLabel)?globalThis.String(e.flashServiceLabel):"",enableGpuSnapshot:!!isSet4(e.enableGpuSnapshot)&&globalThis.Boolean(e.enableGpuSnapshot),startupTimeoutSecs:isSet4(e.startupTimeoutSecs)?globalThis.Number(e.startupTimeoutSecs):0,supportedInputFormats:globalThis.Array.isArray(e?.supportedInputFormats)?e.supportedInputFormats.map((e=>dataFormatFromJSON(e))):[],supportedOutputFormats:globalThis.Array.isArray(e?.supportedOutputFormats)?e.supportedOutputFormats.map((e=>dataFormatFromJSON(e))):[],httpConfig:isSet4(e.httpConfig)?HTTPConfig.fromJSON(e.httpConfig):void 0,implementationName:isSet4(e.implementationName)?globalThis.String(e.implementationName):"",singleUseContainers:!!isSet4(e.singleUseContainers)&&globalThis.Boolean(e.singleUseContainers),isServer:!!isSet4(e.isServer)&&globalThis.Boolean(e.isServer)}),toJSON(e){const t={};if(""!==e.moduleName&&(t.moduleName=e.moduleName),""!==e.functionName&&(t.functionName=e.functionName),e.mountIds?.length&&(t.mountIds=e.mountIds),""!==e.imageId&&(t.imageId=e.imageId),0!==e.functionSerialized.length&&(t.functionSerialized=base64FromBytes(e.functionSerialized)),0!==e.definitionType&&(t.definitionType=function_DefinitionTypeToJSON(e.definitionType)),0!==e.functionType&&(t.functionType=function_FunctionTypeToJSON(e.functionType)),void 0!==e.resources&&(t.resources=Resources.toJSON(e.resources)),e.secretIds?.length&&(t.secretIds=e.secretIds),void 0!==e.rateLimit&&(t.rateLimit=RateLimit.toJSON(e.rateLimit)),void 0!==e.webhookConfig&&(t.webhookConfig=WebhookConfig.toJSON(e.webhookConfig)),e.sharedVolumeMounts?.length&&(t.sharedVolumeMounts=e.sharedVolumeMounts.map((e=>SharedVolumeMount.toJSON(e)))),void 0!==e.proxyId&&(t.proxyId=e.proxyId),void 0!==e.retryPolicy&&(t.retryPolicy=FunctionRetryPolicy.toJSON(e.retryPolicy)),0!==e.concurrencyLimit&&(t.concurrencyLimit=Math.round(e.concurrencyLimit)),0!==e.timeoutSecs&&(t.timeoutSecs=Math.round(e.timeoutSecs)),void 0!==e.ptyInfo&&(t.ptyInfo=PTYInfo.toJSON(e.ptyInfo)),0!==e.classSerialized.length&&(t.classSerialized=base64FromBytes(e.classSerialized)),0!==e.taskIdleTimeoutSecs&&(t.taskIdleTimeoutSecs=Math.round(e.taskIdleTimeoutSecs)),void 0!==e.cloudProvider&&(t.cloudProvider=cloudProviderToJSON(e.cloudProvider)),0!==e.warmPoolSize&&(t.warmPoolSize=Math.round(e.warmPoolSize)),""!==e.webUrl&&(t.webUrl=e.webUrl),void 0!==e.webUrlInfo&&(t.webUrlInfo=WebUrlInfo.toJSON(e.webUrlInfo)),""!==e.runtime&&(t.runtime=e.runtime),""!==e.appName&&(t.appName=e.appName),e.volumeMounts?.length&&(t.volumeMounts=e.volumeMounts.map((e=>VolumeMount.toJSON(e)))),0!==e.maxConcurrentInputs&&(t.maxConcurrentInputs=Math.round(e.maxConcurrentInputs)),e.customDomainInfo?.length&&(t.customDomainInfo=e.customDomainInfo.map((e=>CustomDomainInfo.toJSON(e)))),""!==e.workerId&&(t.workerId=e.workerId),!1!==e.runtimeDebug&&(t.runtimeDebug=e.runtimeDebug),!1!==e.isBuilderFunction&&(t.isBuilderFunction=e.isBuilderFunction),!1!==e.isAutoSnapshot&&(t.isAutoSnapshot=e.isAutoSnapshot),!1!==e.isMethod&&(t.isMethod=e.isMethod),!1!==e.isCheckpointingFunction&&(t.isCheckpointingFunction=e.isCheckpointingFunction),!1!==e.checkpointingEnabled&&(t.checkpointingEnabled=e.checkpointingEnabled),void 0!==e.checkpoint&&(t.checkpoint=CheckpointInfo.toJSON(e.checkpoint)),e.objectDependencies?.length&&(t.objectDependencies=e.objectDependencies.map((e=>ObjectDependency.toJSON(e)))),!1!==e.blockNetwork&&(t.blockNetwork=e.blockNetwork),0!==e.maxInputs&&(t.maxInputs=Math.round(e.maxInputs)),e.s3Mounts?.length&&(t.s3Mounts=e.s3Mounts.map((e=>S3Mount.toJSON(e)))),e.cloudBucketMounts?.length&&(t.cloudBucketMounts=e.cloudBucketMounts.map((e=>CloudBucketMount.toJSON(e)))),void 0!==e.schedulerPlacement&&(t.schedulerPlacement=SchedulerPlacement.toJSON(e.schedulerPlacement)),!1!==e.isClass&&(t.isClass=e.isClass),""!==e.useFunctionId&&(t.useFunctionId=e.useFunctionId),""!==e.useMethodName&&(t.useMethodName=e.useMethodName),void 0!==e.classParameterInfo&&(t.classParameterInfo=ClassParameterInfo.toJSON(e.classParameterInfo)),0!==e.batchMaxSize&&(t.batchMaxSize=Math.round(e.batchMaxSize)),0!==e.batchLingerMs&&(t.batchLingerMs=Math.round(e.batchLingerMs)),!1!==e.i6pnEnabled&&(t.i6pnEnabled=e.i6pnEnabled),!1!==e.ExperimentalConcurrentCancellations&&(t.ExperimentalConcurrentCancellations=e.ExperimentalConcurrentCancellations),0!==e.targetConcurrentInputs&&(t.targetConcurrentInputs=Math.round(e.targetConcurrentInputs)),!1!==e.ExperimentalTaskTemplatesEnabled&&(t.ExperimentalTaskTemplatesEnabled=e.ExperimentalTaskTemplatesEnabled),e.ExperimentalTaskTemplates?.length&&(t.ExperimentalTaskTemplates=e.ExperimentalTaskTemplates.map((e=>TaskTemplate.toJSON(e)))),0!==e.ExperimentalGroupSize&&(t.ExperimentalGroupSize=Math.round(e.ExperimentalGroupSize)),!1!==e.untrusted&&(t.untrusted=e.untrusted),0!==e.ExperimentalBufferContainers&&(t.ExperimentalBufferContainers=Math.round(e.ExperimentalBufferContainers)),void 0!==e.ExperimentalProxyIp&&(t.ExperimentalProxyIp=e.ExperimentalProxyIp),!1!==e.runtimePerfRecord&&(t.runtimePerfRecord=e.runtimePerfRecord),void 0!==e.schedule&&(t.schedule=Schedule.toJSON(e.schedule)),!1!==e.snapshotDebug&&(t.snapshotDebug=e.snapshotDebug),e.methodDefinitions){const n=Object.entries(e.methodDefinitions);n.length>0&&(t.methodDefinitions={},n.forEach((([e,n])=>{t.methodDefinitions[e]=MethodDefinition.toJSON(n)})))}if(!1!==e.methodDefinitionsSet&&(t.methodDefinitionsSet=e.methodDefinitionsSet),!1!==e.ExperimentalCustomScaling&&(t.ExperimentalCustomScaling=e.ExperimentalCustomScaling),""!==e.cloudProviderStr&&(t.cloudProviderStr=e.cloudProviderStr),!1!==e.ExperimentalEnableGpuSnapshot&&(t.ExperimentalEnableGpuSnapshot=e.ExperimentalEnableGpuSnapshot),void 0!==e.autoscalerSettings&&(t.autoscalerSettings=AutoscalerSettings.toJSON(e.autoscalerSettings)),void 0!==e.functionSchema&&(t.functionSchema=FunctionSchema.toJSON(e.functionSchema)),e.experimentalOptions){const n=Object.entries(e.experimentalOptions);n.length>0&&(t.experimentalOptions={},n.forEach((([e,n])=>{t.experimentalOptions[e]=n})))}return!1!==e.mountClientDependencies&&(t.mountClientDependencies=e.mountClientDependencies),e.flashServiceUrls?.length&&(t.flashServiceUrls=e.flashServiceUrls),""!==e.flashServiceLabel&&(t.flashServiceLabel=e.flashServiceLabel),!1!==e.enableGpuSnapshot&&(t.enableGpuSnapshot=e.enableGpuSnapshot),0!==e.startupTimeoutSecs&&(t.startupTimeoutSecs=Math.round(e.startupTimeoutSecs)),e.supportedInputFormats?.length&&(t.supportedInputFormats=e.supportedInputFormats.map((e=>dataFormatToJSON(e)))),e.supportedOutputFormats?.length&&(t.supportedOutputFormats=e.supportedOutputFormats.map((e=>dataFormatToJSON(e)))),void 0!==e.httpConfig&&(t.httpConfig=HTTPConfig.toJSON(e.httpConfig)),""!==e.implementationName&&(t.implementationName=e.implementationName),!1!==e.singleUseContainers&&(t.singleUseContainers=e.singleUseContainers),!1!==e.isServer&&(t.isServer=e.isServer),t},create:e=>FunctionMessage.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionMessage();return t.moduleName=e.moduleName??"",t.functionName=e.functionName??"",t.mountIds=e.mountIds?.map((e=>e))||[],t.imageId=e.imageId??"",t.functionSerialized=e.functionSerialized??new Uint8Array(0),t.definitionType=e.definitionType??0,t.functionType=e.functionType??0,t.resources=void 0!==e.resources&&null!==e.resources?Resources.fromPartial(e.resources):void 0,t.secretIds=e.secretIds?.map((e=>e))||[],t.rateLimit=void 0!==e.rateLimit&&null!==e.rateLimit?RateLimit.fromPartial(e.rateLimit):void 0,t.webhookConfig=void 0!==e.webhookConfig&&null!==e.webhookConfig?WebhookConfig.fromPartial(e.webhookConfig):void 0,t.sharedVolumeMounts=e.sharedVolumeMounts?.map((e=>SharedVolumeMount.fromPartial(e)))||[],t.proxyId=e.proxyId??void 0,t.retryPolicy=void 0!==e.retryPolicy&&null!==e.retryPolicy?FunctionRetryPolicy.fromPartial(e.retryPolicy):void 0,t.concurrencyLimit=e.concurrencyLimit??0,t.timeoutSecs=e.timeoutSecs??0,t.ptyInfo=void 0!==e.ptyInfo&&null!==e.ptyInfo?PTYInfo.fromPartial(e.ptyInfo):void 0,t.classSerialized=e.classSerialized??new Uint8Array(0),t.taskIdleTimeoutSecs=e.taskIdleTimeoutSecs??0,t.cloudProvider=e.cloudProvider??void 0,t.warmPoolSize=e.warmPoolSize??0,t.webUrl=e.webUrl??"",t.webUrlInfo=void 0!==e.webUrlInfo&&null!==e.webUrlInfo?WebUrlInfo.fromPartial(e.webUrlInfo):void 0,t.runtime=e.runtime??"",t.appName=e.appName??"",t.volumeMounts=e.volumeMounts?.map((e=>VolumeMount.fromPartial(e)))||[],t.maxConcurrentInputs=e.maxConcurrentInputs??0,t.customDomainInfo=e.customDomainInfo?.map((e=>CustomDomainInfo.fromPartial(e)))||[],t.workerId=e.workerId??"",t.runtimeDebug=e.runtimeDebug??!1,t.isBuilderFunction=e.isBuilderFunction??!1,t.isAutoSnapshot=e.isAutoSnapshot??!1,t.isMethod=e.isMethod??!1,t.isCheckpointingFunction=e.isCheckpointingFunction??!1,t.checkpointingEnabled=e.checkpointingEnabled??!1,t.checkpoint=void 0!==e.checkpoint&&null!==e.checkpoint?CheckpointInfo.fromPartial(e.checkpoint):void 0,t.objectDependencies=e.objectDependencies?.map((e=>ObjectDependency.fromPartial(e)))||[],t.blockNetwork=e.blockNetwork??!1,t.maxInputs=e.maxInputs??0,t.s3Mounts=e.s3Mounts?.map((e=>S3Mount.fromPartial(e)))||[],t.cloudBucketMounts=e.cloudBucketMounts?.map((e=>CloudBucketMount.fromPartial(e)))||[],t.schedulerPlacement=void 0!==e.schedulerPlacement&&null!==e.schedulerPlacement?SchedulerPlacement.fromPartial(e.schedulerPlacement):void 0,t.isClass=e.isClass??!1,t.useFunctionId=e.useFunctionId??"",t.useMethodName=e.useMethodName??"",t.classParameterInfo=void 0!==e.classParameterInfo&&null!==e.classParameterInfo?ClassParameterInfo.fromPartial(e.classParameterInfo):void 0,t.batchMaxSize=e.batchMaxSize??0,t.batchLingerMs=e.batchLingerMs??0,t.i6pnEnabled=e.i6pnEnabled??!1,t.ExperimentalConcurrentCancellations=e.ExperimentalConcurrentCancellations??!1,t.targetConcurrentInputs=e.targetConcurrentInputs??0,t.ExperimentalTaskTemplatesEnabled=e.ExperimentalTaskTemplatesEnabled??!1,t.ExperimentalTaskTemplates=e.ExperimentalTaskTemplates?.map((e=>TaskTemplate.fromPartial(e)))||[],t.ExperimentalGroupSize=e.ExperimentalGroupSize??0,t.untrusted=e.untrusted??!1,t.ExperimentalBufferContainers=e.ExperimentalBufferContainers??0,t.ExperimentalProxyIp=e.ExperimentalProxyIp??void 0,t.runtimePerfRecord=e.runtimePerfRecord??!1,t.schedule=void 0!==e.schedule&&null!==e.schedule?Schedule.fromPartial(e.schedule):void 0,t.snapshotDebug=e.snapshotDebug??!1,t.methodDefinitions=Object.entries(e.methodDefinitions??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=MethodDefinition.fromPartial(n)),e)),{}),t.methodDefinitionsSet=e.methodDefinitionsSet??!1,t.ExperimentalCustomScaling=e.ExperimentalCustomScaling??!1,t.cloudProviderStr=e.cloudProviderStr??"",t.ExperimentalEnableGpuSnapshot=e.ExperimentalEnableGpuSnapshot??!1,t.autoscalerSettings=void 0!==e.autoscalerSettings&&null!==e.autoscalerSettings?AutoscalerSettings.fromPartial(e.autoscalerSettings):void 0,t.functionSchema=void 0!==e.functionSchema&&null!==e.functionSchema?FunctionSchema.fromPartial(e.functionSchema):void 0,t.experimentalOptions=Object.entries(e.experimentalOptions??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t.mountClientDependencies=e.mountClientDependencies??!1,t.flashServiceUrls=e.flashServiceUrls?.map((e=>e))||[],t.flashServiceLabel=e.flashServiceLabel??"",t.enableGpuSnapshot=e.enableGpuSnapshot??!1,t.startupTimeoutSecs=e.startupTimeoutSecs??0,t.supportedInputFormats=e.supportedInputFormats?.map((e=>e))||[],t.supportedOutputFormats=e.supportedOutputFormats?.map((e=>e))||[],t.httpConfig=void 0!==e.httpConfig&&null!==e.httpConfig?HTTPConfig.fromPartial(e.httpConfig):void 0,t.implementationName=e.implementationName??"",t.singleUseContainers=e.singleUseContainers??!1,t.isServer=e.isServer??!1,t}};function createBaseFunction_MethodDefinitionsEntry(){return{key:"",value:void 0}}var Function_MethodDefinitionsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),void 0!==e.value&&MethodDefinition.encode(e.value,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunction_MethodDefinitionsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=MethodDefinition.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?MethodDefinition.fromJSON(e.value):void 0}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),void 0!==e.value&&(t.value=MethodDefinition.toJSON(e.value)),t},create:e=>Function_MethodDefinitionsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseFunction_MethodDefinitionsEntry();return t.key=e.key??"",t.value=void 0!==e.value&&null!==e.value?MethodDefinition.fromPartial(e.value):void 0,t}};function createBaseFunction_ExperimentalOptionsEntry(){return{key:"",value:""}}var Function_ExperimentalOptionsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunction_ExperimentalOptionsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>Function_ExperimentalOptionsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseFunction_ExperimentalOptionsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseFunctionAsyncInvokeRequest(){return{functionId:"",parentInputId:"",input:void 0}}var FunctionAsyncInvokeRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),""!==e.parentInputId&&t.uint32(18).string(e.parentInputId),void 0!==e.input&&FunctionInput.encode(e.input,t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionAsyncInvokeRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(18!==e)break;a.parentInputId=n.string();continue;case 3:if(26!==e)break;a.input=FunctionInput.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",parentInputId:isSet4(e.parentInputId)?globalThis.String(e.parentInputId):"",input:isSet4(e.input)?FunctionInput.fromJSON(e.input):void 0}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),""!==e.parentInputId&&(t.parentInputId=e.parentInputId),void 0!==e.input&&(t.input=FunctionInput.toJSON(e.input)),t},create:e=>FunctionAsyncInvokeRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionAsyncInvokeRequest();return t.functionId=e.functionId??"",t.parentInputId=e.parentInputId??"",t.input=void 0!==e.input&&null!==e.input?FunctionInput.fromPartial(e.input):void 0,t}};function createBaseFunctionAsyncInvokeResponse(){return{retryWithBlobUpload:!1,functionCallId:""}}var FunctionAsyncInvokeResponse={encode:(e,t=new BinaryWriter)=>(!1!==e.retryWithBlobUpload&&t.uint32(8).bool(e.retryWithBlobUpload),""!==e.functionCallId&&t.uint32(18).string(e.functionCallId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionAsyncInvokeResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.retryWithBlobUpload=n.bool();continue;case 2:if(18!==e)break;a.functionCallId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({retryWithBlobUpload:!!isSet4(e.retryWithBlobUpload)&&globalThis.Boolean(e.retryWithBlobUpload),functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):""}),toJSON(e){const t={};return!1!==e.retryWithBlobUpload&&(t.retryWithBlobUpload=e.retryWithBlobUpload),""!==e.functionCallId&&(t.functionCallId=e.functionCallId),t},create:e=>FunctionAsyncInvokeResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionAsyncInvokeResponse();return t.retryWithBlobUpload=e.retryWithBlobUpload??!1,t.functionCallId=e.functionCallId??"",t}};function createBaseFunctionBindParamsRequest(){return{functionId:"",serializedParams:new Uint8Array(0),functionOptions:void 0,environmentName:"",authSecret:""}}var FunctionBindParamsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),0!==e.serializedParams.length&&t.uint32(18).bytes(e.serializedParams),void 0!==e.functionOptions&&FunctionOptions.encode(e.functionOptions,t.uint32(26).fork()).join(),""!==e.environmentName&&t.uint32(34).string(e.environmentName),""!==e.authSecret&&t.uint32(42).string(e.authSecret),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionBindParamsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(18!==e)break;a.serializedParams=n.bytes();continue;case 3:if(26!==e)break;a.functionOptions=FunctionOptions.decode(n,n.uint32());continue;case 4:if(34!==e)break;a.environmentName=n.string();continue;case 5:if(42!==e)break;a.authSecret=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",serializedParams:isSet4(e.serializedParams)?bytesFromBase64(e.serializedParams):new Uint8Array(0),functionOptions:isSet4(e.functionOptions)?FunctionOptions.fromJSON(e.functionOptions):void 0,environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",authSecret:isSet4(e.authSecret)?globalThis.String(e.authSecret):""}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),0!==e.serializedParams.length&&(t.serializedParams=base64FromBytes(e.serializedParams)),void 0!==e.functionOptions&&(t.functionOptions=FunctionOptions.toJSON(e.functionOptions)),""!==e.environmentName&&(t.environmentName=e.environmentName),""!==e.authSecret&&(t.authSecret=e.authSecret),t},create:e=>FunctionBindParamsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionBindParamsRequest();return t.functionId=e.functionId??"",t.serializedParams=e.serializedParams??new Uint8Array(0),t.functionOptions=void 0!==e.functionOptions&&null!==e.functionOptions?FunctionOptions.fromPartial(e.functionOptions):void 0,t.environmentName=e.environmentName??"",t.authSecret=e.authSecret??"",t}};function createBaseFunctionBindParamsResponse(){return{boundFunctionId:"",handleMetadata:void 0}}var FunctionBindParamsResponse={encode:(e,t=new BinaryWriter)=>(""!==e.boundFunctionId&&t.uint32(10).string(e.boundFunctionId),void 0!==e.handleMetadata&&FunctionHandleMetadata.encode(e.handleMetadata,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionBindParamsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.boundFunctionId=n.string();continue;case 2:if(18!==e)break;a.handleMetadata=FunctionHandleMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({boundFunctionId:isSet4(e.boundFunctionId)?globalThis.String(e.boundFunctionId):"",handleMetadata:isSet4(e.handleMetadata)?FunctionHandleMetadata.fromJSON(e.handleMetadata):void 0}),toJSON(e){const t={};return""!==e.boundFunctionId&&(t.boundFunctionId=e.boundFunctionId),void 0!==e.handleMetadata&&(t.handleMetadata=FunctionHandleMetadata.toJSON(e.handleMetadata)),t},create:e=>FunctionBindParamsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionBindParamsResponse();return t.boundFunctionId=e.boundFunctionId??"",t.handleMetadata=void 0!==e.handleMetadata&&null!==e.handleMetadata?FunctionHandleMetadata.fromPartial(e.handleMetadata):void 0,t}};function createBaseFunctionCallCallGraphInfo(){return{functionCallId:"",parentInputId:"",functionName:"",moduleName:""}}var FunctionCallCallGraphInfo={encode:(e,t=new BinaryWriter)=>(""!==e.functionCallId&&t.uint32(10).string(e.functionCallId),""!==e.parentInputId&&t.uint32(18).string(e.parentInputId),""!==e.functionName&&t.uint32(26).string(e.functionName),""!==e.moduleName&&t.uint32(34).string(e.moduleName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionCallCallGraphInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionCallId=n.string();continue;case 2:if(18!==e)break;a.parentInputId=n.string();continue;case 3:if(26!==e)break;a.functionName=n.string();continue;case 4:if(34!==e)break;a.moduleName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",parentInputId:isSet4(e.parentInputId)?globalThis.String(e.parentInputId):"",functionName:isSet4(e.functionName)?globalThis.String(e.functionName):"",moduleName:isSet4(e.moduleName)?globalThis.String(e.moduleName):""}),toJSON(e){const t={};return""!==e.functionCallId&&(t.functionCallId=e.functionCallId),""!==e.parentInputId&&(t.parentInputId=e.parentInputId),""!==e.functionName&&(t.functionName=e.functionName),""!==e.moduleName&&(t.moduleName=e.moduleName),t},create:e=>FunctionCallCallGraphInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionCallCallGraphInfo();return t.functionCallId=e.functionCallId??"",t.parentInputId=e.parentInputId??"",t.functionName=e.functionName??"",t.moduleName=e.moduleName??"",t}};function createBaseFunctionCallCancelRequest(){return{functionCallId:"",terminateContainers:!1,functionId:void 0}}var FunctionCallCancelRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionCallId&&t.uint32(10).string(e.functionCallId),!1!==e.terminateContainers&&t.uint32(16).bool(e.terminateContainers),void 0!==e.functionId&&t.uint32(26).string(e.functionId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionCallCancelRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionCallId=n.string();continue;case 2:if(16!==e)break;a.terminateContainers=n.bool();continue;case 3:if(26!==e)break;a.functionId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",terminateContainers:!!isSet4(e.terminateContainers)&&globalThis.Boolean(e.terminateContainers),functionId:isSet4(e.functionId)?globalThis.String(e.functionId):void 0}),toJSON(e){const t={};return""!==e.functionCallId&&(t.functionCallId=e.functionCallId),!1!==e.terminateContainers&&(t.terminateContainers=e.terminateContainers),void 0!==e.functionId&&(t.functionId=e.functionId),t},create:e=>FunctionCallCancelRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionCallCancelRequest();return t.functionCallId=e.functionCallId??"",t.terminateContainers=e.terminateContainers??!1,t.functionId=e.functionId??void 0,t}};function createBaseFunctionCallFromIdRequest(){return{functionCallId:""}}var FunctionCallFromIdRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionCallId&&t.uint32(10).string(e.functionCallId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionCallFromIdRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionCallId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):""}),toJSON(e){const t={};return""!==e.functionCallId&&(t.functionCallId=e.functionCallId),t},create:e=>FunctionCallFromIdRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionCallFromIdRequest();return t.functionCallId=e.functionCallId??"",t}};function createBaseFunctionCallFromIdResponse(){return{functionCallId:"",numInputs:0}}var FunctionCallFromIdResponse={encode:(e,t=new BinaryWriter)=>(""!==e.functionCallId&&t.uint32(10).string(e.functionCallId),0!==e.numInputs&&t.uint32(16).int32(e.numInputs),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionCallFromIdResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionCallId=n.string();continue;case 2:if(16!==e)break;a.numInputs=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",numInputs:isSet4(e.numInputs)?globalThis.Number(e.numInputs):0}),toJSON(e){const t={};return""!==e.functionCallId&&(t.functionCallId=e.functionCallId),0!==e.numInputs&&(t.numInputs=Math.round(e.numInputs)),t},create:e=>FunctionCallFromIdResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionCallFromIdResponse();return t.functionCallId=e.functionCallId??"",t.numInputs=e.numInputs??0,t}};function createBaseFunctionCallGetDataRequest(){return{functionCallId:void 0,attemptToken:void 0,lastIndex:0,useGaplessRead:!1}}var FunctionCallGetDataRequest={encode:(e,t=new BinaryWriter)=>(void 0!==e.functionCallId&&t.uint32(10).string(e.functionCallId),void 0!==e.attemptToken&&t.uint32(26).string(e.attemptToken),0!==e.lastIndex&&t.uint32(16).uint64(e.lastIndex),!1!==e.useGaplessRead&&t.uint32(32).bool(e.useGaplessRead),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionCallGetDataRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionCallId=n.string();continue;case 3:if(26!==e)break;a.attemptToken=n.string();continue;case 2:if(16!==e)break;a.lastIndex=longToNumber2(n.uint64());continue;case 4:if(32!==e)break;a.useGaplessRead=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):void 0,attemptToken:isSet4(e.attemptToken)?globalThis.String(e.attemptToken):void 0,lastIndex:isSet4(e.lastIndex)?globalThis.Number(e.lastIndex):0,useGaplessRead:!!isSet4(e.useGaplessRead)&&globalThis.Boolean(e.useGaplessRead)}),toJSON(e){const t={};return void 0!==e.functionCallId&&(t.functionCallId=e.functionCallId),void 0!==e.attemptToken&&(t.attemptToken=e.attemptToken),0!==e.lastIndex&&(t.lastIndex=Math.round(e.lastIndex)),!1!==e.useGaplessRead&&(t.useGaplessRead=e.useGaplessRead),t},create:e=>FunctionCallGetDataRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionCallGetDataRequest();return t.functionCallId=e.functionCallId??void 0,t.attemptToken=e.attemptToken??void 0,t.lastIndex=e.lastIndex??0,t.useGaplessRead=e.useGaplessRead??!1,t}};function createBaseFunctionCallInfo(){return{functionCallId:"",idx:0,createdAt:0,scheduledAt:0,pendingInputs:void 0,failedInputs:void 0,succeededInputs:void 0,timeoutInputs:void 0,cancelledInputs:void 0,totalInputs:0}}var FunctionCallInfo={encode:(e,t=new BinaryWriter)=>(""!==e.functionCallId&&t.uint32(10).string(e.functionCallId),0!==e.idx&&t.uint32(16).int32(e.idx),0!==e.createdAt&&t.uint32(49).double(e.createdAt),0!==e.scheduledAt&&t.uint32(57).double(e.scheduledAt),void 0!==e.pendingInputs&&InputCategoryInfo.encode(e.pendingInputs,t.uint32(98).fork()).join(),void 0!==e.failedInputs&&InputCategoryInfo.encode(e.failedInputs,t.uint32(106).fork()).join(),void 0!==e.succeededInputs&&InputCategoryInfo.encode(e.succeededInputs,t.uint32(114).fork()).join(),void 0!==e.timeoutInputs&&InputCategoryInfo.encode(e.timeoutInputs,t.uint32(122).fork()).join(),void 0!==e.cancelledInputs&&InputCategoryInfo.encode(e.cancelledInputs,t.uint32(130).fork()).join(),0!==e.totalInputs&&t.uint32(136).int32(e.totalInputs),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionCallInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionCallId=n.string();continue;case 2:if(16!==e)break;a.idx=n.int32();continue;case 6:if(49!==e)break;a.createdAt=n.double();continue;case 7:if(57!==e)break;a.scheduledAt=n.double();continue;case 12:if(98!==e)break;a.pendingInputs=InputCategoryInfo.decode(n,n.uint32());continue;case 13:if(106!==e)break;a.failedInputs=InputCategoryInfo.decode(n,n.uint32());continue;case 14:if(114!==e)break;a.succeededInputs=InputCategoryInfo.decode(n,n.uint32());continue;case 15:if(122!==e)break;a.timeoutInputs=InputCategoryInfo.decode(n,n.uint32());continue;case 16:if(130!==e)break;a.cancelledInputs=InputCategoryInfo.decode(n,n.uint32());continue;case 17:if(136!==e)break;a.totalInputs=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",idx:isSet4(e.idx)?globalThis.Number(e.idx):0,createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,scheduledAt:isSet4(e.scheduledAt)?globalThis.Number(e.scheduledAt):0,pendingInputs:isSet4(e.pendingInputs)?InputCategoryInfo.fromJSON(e.pendingInputs):void 0,failedInputs:isSet4(e.failedInputs)?InputCategoryInfo.fromJSON(e.failedInputs):void 0,succeededInputs:isSet4(e.succeededInputs)?InputCategoryInfo.fromJSON(e.succeededInputs):void 0,timeoutInputs:isSet4(e.timeoutInputs)?InputCategoryInfo.fromJSON(e.timeoutInputs):void 0,cancelledInputs:isSet4(e.cancelledInputs)?InputCategoryInfo.fromJSON(e.cancelledInputs):void 0,totalInputs:isSet4(e.totalInputs)?globalThis.Number(e.totalInputs):0}),toJSON(e){const t={};return""!==e.functionCallId&&(t.functionCallId=e.functionCallId),0!==e.idx&&(t.idx=Math.round(e.idx)),0!==e.createdAt&&(t.createdAt=e.createdAt),0!==e.scheduledAt&&(t.scheduledAt=e.scheduledAt),void 0!==e.pendingInputs&&(t.pendingInputs=InputCategoryInfo.toJSON(e.pendingInputs)),void 0!==e.failedInputs&&(t.failedInputs=InputCategoryInfo.toJSON(e.failedInputs)),void 0!==e.succeededInputs&&(t.succeededInputs=InputCategoryInfo.toJSON(e.succeededInputs)),void 0!==e.timeoutInputs&&(t.timeoutInputs=InputCategoryInfo.toJSON(e.timeoutInputs)),void 0!==e.cancelledInputs&&(t.cancelledInputs=InputCategoryInfo.toJSON(e.cancelledInputs)),0!==e.totalInputs&&(t.totalInputs=Math.round(e.totalInputs)),t},create:e=>FunctionCallInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionCallInfo();return t.functionCallId=e.functionCallId??"",t.idx=e.idx??0,t.createdAt=e.createdAt??0,t.scheduledAt=e.scheduledAt??0,t.pendingInputs=void 0!==e.pendingInputs&&null!==e.pendingInputs?InputCategoryInfo.fromPartial(e.pendingInputs):void 0,t.failedInputs=void 0!==e.failedInputs&&null!==e.failedInputs?InputCategoryInfo.fromPartial(e.failedInputs):void 0,t.succeededInputs=void 0!==e.succeededInputs&&null!==e.succeededInputs?InputCategoryInfo.fromPartial(e.succeededInputs):void 0,t.timeoutInputs=void 0!==e.timeoutInputs&&null!==e.timeoutInputs?InputCategoryInfo.fromPartial(e.timeoutInputs):void 0,t.cancelledInputs=void 0!==e.cancelledInputs&&null!==e.cancelledInputs?InputCategoryInfo.fromPartial(e.cancelledInputs):void 0,t.totalInputs=e.totalInputs??0,t}};function createBaseFunctionCallListRequest(){return{functionId:""}}var FunctionCallListRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionCallListRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):""}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),t},create:e=>FunctionCallListRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionCallListRequest();return t.functionId=e.functionId??"",t}};function createBaseFunctionCallListResponse(){return{functionCalls:[]}}var FunctionCallListResponse={encode(e,t=new BinaryWriter){for(const n of e.functionCalls)FunctionCallInfo.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionCallListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionCalls.push(FunctionCallInfo.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionCalls:globalThis.Array.isArray(e?.functionCalls)?e.functionCalls.map((e=>FunctionCallInfo.fromJSON(e))):[]}),toJSON(e){const t={};return e.functionCalls?.length&&(t.functionCalls=e.functionCalls.map((e=>FunctionCallInfo.toJSON(e)))),t},create:e=>FunctionCallListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionCallListResponse();return t.functionCalls=e.functionCalls?.map((e=>FunctionCallInfo.fromPartial(e)))||[],t}};function createBaseFunctionCallPutDataRequest(){return{functionCallId:void 0,attemptToken:void 0,dataChunks:[]}}var FunctionCallPutDataRequest={encode(e,t=new BinaryWriter){void 0!==e.functionCallId&&t.uint32(10).string(e.functionCallId),void 0!==e.attemptToken&&t.uint32(26).string(e.attemptToken);for(const n of e.dataChunks)DataChunk.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionCallPutDataRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionCallId=n.string();continue;case 3:if(26!==e)break;a.attemptToken=n.string();continue;case 2:if(18!==e)break;a.dataChunks.push(DataChunk.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):void 0,attemptToken:isSet4(e.attemptToken)?globalThis.String(e.attemptToken):void 0,dataChunks:globalThis.Array.isArray(e?.dataChunks)?e.dataChunks.map((e=>DataChunk.fromJSON(e))):[]}),toJSON(e){const t={};return void 0!==e.functionCallId&&(t.functionCallId=e.functionCallId),void 0!==e.attemptToken&&(t.attemptToken=e.attemptToken),e.dataChunks?.length&&(t.dataChunks=e.dataChunks.map((e=>DataChunk.toJSON(e)))),t},create:e=>FunctionCallPutDataRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionCallPutDataRequest();return t.functionCallId=e.functionCallId??void 0,t.attemptToken=e.attemptToken??void 0,t.dataChunks=e.dataChunks?.map((e=>DataChunk.fromPartial(e)))||[],t}};function createBaseFunctionCreateRequest(){return{function:void 0,appId:"",schedule:void 0,existingFunctionId:"",functionData:void 0}}var FunctionCreateRequest={encode:(e,t=new BinaryWriter)=>(void 0!==e.function&&FunctionMessage.encode(e.function,t.uint32(10).fork()).join(),""!==e.appId&&t.uint32(18).string(e.appId),void 0!==e.schedule&&Schedule.encode(e.schedule,t.uint32(50).fork()).join(),""!==e.existingFunctionId&&t.uint32(58).string(e.existingFunctionId),void 0!==e.functionData&&FunctionData.encode(e.functionData,t.uint32(74).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.function=FunctionMessage.decode(n,n.uint32());continue;case 2:if(18!==e)break;a.appId=n.string();continue;case 6:if(50!==e)break;a.schedule=Schedule.decode(n,n.uint32());continue;case 7:if(58!==e)break;a.existingFunctionId=n.string();continue;case 9:if(74!==e)break;a.functionData=FunctionData.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({function:isSet4(e.function)?FunctionMessage.fromJSON(e.function):void 0,appId:isSet4(e.appId)?globalThis.String(e.appId):"",schedule:isSet4(e.schedule)?Schedule.fromJSON(e.schedule):void 0,existingFunctionId:isSet4(e.existingFunctionId)?globalThis.String(e.existingFunctionId):"",functionData:isSet4(e.functionData)?FunctionData.fromJSON(e.functionData):void 0}),toJSON(e){const t={};return void 0!==e.function&&(t.function=FunctionMessage.toJSON(e.function)),""!==e.appId&&(t.appId=e.appId),void 0!==e.schedule&&(t.schedule=Schedule.toJSON(e.schedule)),""!==e.existingFunctionId&&(t.existingFunctionId=e.existingFunctionId),void 0!==e.functionData&&(t.functionData=FunctionData.toJSON(e.functionData)),t},create:e=>FunctionCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionCreateRequest();return t.function=void 0!==e.function&&null!==e.function?FunctionMessage.fromPartial(e.function):void 0,t.appId=e.appId??"",t.schedule=void 0!==e.schedule&&null!==e.schedule?Schedule.fromPartial(e.schedule):void 0,t.existingFunctionId=e.existingFunctionId??"",t.functionData=void 0!==e.functionData&&null!==e.functionData?FunctionData.fromPartial(e.functionData):void 0,t}};function createBaseFunctionCreateResponse(){return{functionId:"",DeprecatedWebUrl:"",function:void 0,handleMetadata:void 0,serverWarnings:[]}}var FunctionCreateResponse={encode(e,t=new BinaryWriter){""!==e.functionId&&t.uint32(10).string(e.functionId),""!==e.DeprecatedWebUrl&&t.uint32(18).string(e.DeprecatedWebUrl),void 0!==e.function&&FunctionMessage.encode(e.function,t.uint32(34).fork()).join(),void 0!==e.handleMetadata&&FunctionHandleMetadata.encode(e.handleMetadata,t.uint32(42).fork()).join();for(const n of e.serverWarnings)Warning.encode(n,t.uint32(50).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(18!==e)break;a.DeprecatedWebUrl=n.string();continue;case 4:if(34!==e)break;a.function=FunctionMessage.decode(n,n.uint32());continue;case 5:if(42!==e)break;a.handleMetadata=FunctionHandleMetadata.decode(n,n.uint32());continue;case 6:if(50!==e)break;a.serverWarnings.push(Warning.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",DeprecatedWebUrl:isSet4(e.DeprecatedWebUrl)?globalThis.String(e.DeprecatedWebUrl):"",function:isSet4(e.function)?FunctionMessage.fromJSON(e.function):void 0,handleMetadata:isSet4(e.handleMetadata)?FunctionHandleMetadata.fromJSON(e.handleMetadata):void 0,serverWarnings:globalThis.Array.isArray(e?.serverWarnings)?e.serverWarnings.map((e=>Warning.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),""!==e.DeprecatedWebUrl&&(t.DeprecatedWebUrl=e.DeprecatedWebUrl),void 0!==e.function&&(t.function=FunctionMessage.toJSON(e.function)),void 0!==e.handleMetadata&&(t.handleMetadata=FunctionHandleMetadata.toJSON(e.handleMetadata)),e.serverWarnings?.length&&(t.serverWarnings=e.serverWarnings.map((e=>Warning.toJSON(e)))),t},create:e=>FunctionCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionCreateResponse();return t.functionId=e.functionId??"",t.DeprecatedWebUrl=e.DeprecatedWebUrl??"",t.function=void 0!==e.function&&null!==e.function?FunctionMessage.fromPartial(e.function):void 0,t.handleMetadata=void 0!==e.handleMetadata&&null!==e.handleMetadata?FunctionHandleMetadata.fromPartial(e.handleMetadata):void 0,t.serverWarnings=e.serverWarnings?.map((e=>Warning.fromPartial(e)))||[],t}};function createBaseFunctionData(){return{moduleName:"",functionName:"",functionType:0,warmPoolSize:0,concurrencyLimit:0,taskIdleTimeoutSecs:0,ExperimentalGroupSize:0,ExperimentalBufferContainers:0,ExperimentalCustomScaling:!1,ExperimentalEnableGpuSnapshot:!1,workerId:"",timeoutSecs:0,webUrl:"",webUrlInfo:void 0,webhookConfig:void 0,customDomainInfo:[],ExperimentalProxyIp:void 0,methodDefinitions:{},methodDefinitionsSet:!1,isClass:!1,classParameterInfo:void 0,isMethod:!1,useFunctionId:"",useMethodName:"",rankedFunctions:[],schedule:void 0,untrusted:!1,snapshotDebug:!1,runtimePerfRecord:!1,autoscalerSettings:void 0,functionSchema:void 0,experimentalOptions:{},flashServiceUrls:[],flashServiceLabel:"",startupTimeoutSecs:0,supportedInputFormats:[],supportedOutputFormats:[],httpConfig:void 0,implementationName:"",isServer:!1}}var FunctionData={encode(e,t=new BinaryWriter){""!==e.moduleName&&t.uint32(10).string(e.moduleName),""!==e.functionName&&t.uint32(18).string(e.functionName),0!==e.functionType&&t.uint32(24).int32(e.functionType),0!==e.warmPoolSize&&t.uint32(32).uint32(e.warmPoolSize),0!==e.concurrencyLimit&&t.uint32(40).uint32(e.concurrencyLimit),0!==e.taskIdleTimeoutSecs&&t.uint32(48).uint32(e.taskIdleTimeoutSecs),0!==e.ExperimentalGroupSize&&t.uint32(152).uint32(e.ExperimentalGroupSize),0!==e.ExperimentalBufferContainers&&t.uint32(176).uint32(e.ExperimentalBufferContainers),!1!==e.ExperimentalCustomScaling&&t.uint32(184).bool(e.ExperimentalCustomScaling),!1!==e.ExperimentalEnableGpuSnapshot&&t.uint32(240).bool(e.ExperimentalEnableGpuSnapshot),""!==e.workerId&&t.uint32(58).string(e.workerId),0!==e.timeoutSecs&&t.uint32(64).uint32(e.timeoutSecs),""!==e.webUrl&&t.uint32(74).string(e.webUrl),void 0!==e.webUrlInfo&&WebUrlInfo.encode(e.webUrlInfo,t.uint32(82).fork()).join(),void 0!==e.webhookConfig&&WebhookConfig.encode(e.webhookConfig,t.uint32(90).fork()).join();for(const n of e.customDomainInfo)CustomDomainInfo.encode(n,t.uint32(98).fork()).join();void 0!==e.ExperimentalProxyIp&&t.uint32(194).string(e.ExperimentalProxyIp),Object.entries(e.methodDefinitions).forEach((([e,n])=>{FunctionData_MethodDefinitionsEntry.encode({key:e,value:n},t.uint32(202).fork()).join()})),!1!==e.methodDefinitionsSet&&t.uint32(208).bool(e.methodDefinitionsSet),!1!==e.isClass&&t.uint32(104).bool(e.isClass),void 0!==e.classParameterInfo&&ClassParameterInfo.encode(e.classParameterInfo,t.uint32(114).fork()).join(),!1!==e.isMethod&&t.uint32(120).bool(e.isMethod),""!==e.useFunctionId&&t.uint32(130).string(e.useFunctionId),""!==e.useMethodName&&t.uint32(138).string(e.useMethodName);for(const n of e.rankedFunctions)FunctionData_RankedFunction.encode(n,t.uint32(146).fork()).join();void 0!==e.schedule&&Schedule.encode(e.schedule,t.uint32(162).fork()).join(),!1!==e.untrusted&&t.uint32(216).bool(e.untrusted),!1!==e.snapshotDebug&&t.uint32(224).bool(e.snapshotDebug),!1!==e.runtimePerfRecord&&t.uint32(232).bool(e.runtimePerfRecord),void 0!==e.autoscalerSettings&&AutoscalerSettings.encode(e.autoscalerSettings,t.uint32(250).fork()).join(),void 0!==e.functionSchema&&FunctionSchema.encode(e.functionSchema,t.uint32(258).fork()).join(),Object.entries(e.experimentalOptions).forEach((([e,n])=>{FunctionData_ExperimentalOptionsEntry.encode({key:e,value:n},t.uint32(266).fork()).join()}));for(const n of e.flashServiceUrls)t.uint32(274).string(n);""!==e.flashServiceLabel&&t.uint32(282).string(e.flashServiceLabel),0!==e.startupTimeoutSecs&&t.uint32(288).uint32(e.startupTimeoutSecs),t.uint32(298).fork();for(const n of e.supportedInputFormats)t.int32(n);t.join(),t.uint32(306).fork();for(const n of e.supportedOutputFormats)t.int32(n);return t.join(),void 0!==e.httpConfig&&HTTPConfig.encode(e.httpConfig,t.uint32(314).fork()).join(),""!==e.implementationName&&t.uint32(322).string(e.implementationName),!1!==e.isServer&&t.uint32(328).bool(e.isServer),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionData();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.moduleName=n.string();continue;case 2:if(18!==e)break;a.functionName=n.string();continue;case 3:if(24!==e)break;a.functionType=n.int32();continue;case 4:if(32!==e)break;a.warmPoolSize=n.uint32();continue;case 5:if(40!==e)break;a.concurrencyLimit=n.uint32();continue;case 6:if(48!==e)break;a.taskIdleTimeoutSecs=n.uint32();continue;case 19:if(152!==e)break;a.ExperimentalGroupSize=n.uint32();continue;case 22:if(176!==e)break;a.ExperimentalBufferContainers=n.uint32();continue;case 23:if(184!==e)break;a.ExperimentalCustomScaling=n.bool();continue;case 30:if(240!==e)break;a.ExperimentalEnableGpuSnapshot=n.bool();continue;case 7:if(58!==e)break;a.workerId=n.string();continue;case 8:if(64!==e)break;a.timeoutSecs=n.uint32();continue;case 9:if(74!==e)break;a.webUrl=n.string();continue;case 10:if(82!==e)break;a.webUrlInfo=WebUrlInfo.decode(n,n.uint32());continue;case 11:if(90!==e)break;a.webhookConfig=WebhookConfig.decode(n,n.uint32());continue;case 12:if(98!==e)break;a.customDomainInfo.push(CustomDomainInfo.decode(n,n.uint32()));continue;case 24:if(194!==e)break;a.ExperimentalProxyIp=n.string();continue;case 25:{if(202!==e)break;const t=FunctionData_MethodDefinitionsEntry.decode(n,n.uint32());void 0!==t.value&&(a.methodDefinitions[t.key]=t.value);continue}case 26:if(208!==e)break;a.methodDefinitionsSet=n.bool();continue;case 13:if(104!==e)break;a.isClass=n.bool();continue;case 14:if(114!==e)break;a.classParameterInfo=ClassParameterInfo.decode(n,n.uint32());continue;case 15:if(120!==e)break;a.isMethod=n.bool();continue;case 16:if(130!==e)break;a.useFunctionId=n.string();continue;case 17:if(138!==e)break;a.useMethodName=n.string();continue;case 18:if(146!==e)break;a.rankedFunctions.push(FunctionData_RankedFunction.decode(n,n.uint32()));continue;case 20:if(162!==e)break;a.schedule=Schedule.decode(n,n.uint32());continue;case 27:if(216!==e)break;a.untrusted=n.bool();continue;case 28:if(224!==e)break;a.snapshotDebug=n.bool();continue;case 29:if(232!==e)break;a.runtimePerfRecord=n.bool();continue;case 31:if(250!==e)break;a.autoscalerSettings=AutoscalerSettings.decode(n,n.uint32());continue;case 32:if(258!==e)break;a.functionSchema=FunctionSchema.decode(n,n.uint32());continue;case 33:{if(266!==e)break;const t=FunctionData_ExperimentalOptionsEntry.decode(n,n.uint32());void 0!==t.value&&(a.experimentalOptions[t.key]=t.value);continue}case 34:if(274!==e)break;a.flashServiceUrls.push(n.string());continue;case 35:if(282!==e)break;a.flashServiceLabel=n.string();continue;case 36:if(288!==e)break;a.startupTimeoutSecs=n.uint32();continue;case 37:if(296===e){a.supportedInputFormats.push(n.int32());continue}if(298===e){const e=n.uint32()+n.pos;for(;n.pos<e;)a.supportedInputFormats.push(n.int32());continue}break;case 38:if(304===e){a.supportedOutputFormats.push(n.int32());continue}if(306===e){const e=n.uint32()+n.pos;for(;n.pos<e;)a.supportedOutputFormats.push(n.int32());continue}break;case 39:if(314!==e)break;a.httpConfig=HTTPConfig.decode(n,n.uint32());continue;case 40:if(322!==e)break;a.implementationName=n.string();continue;case 41:if(328!==e)break;a.isServer=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({moduleName:isSet4(e.moduleName)?globalThis.String(e.moduleName):"",functionName:isSet4(e.functionName)?globalThis.String(e.functionName):"",functionType:isSet4(e.functionType)?function_FunctionTypeFromJSON(e.functionType):0,warmPoolSize:isSet4(e.warmPoolSize)?globalThis.Number(e.warmPoolSize):0,concurrencyLimit:isSet4(e.concurrencyLimit)?globalThis.Number(e.concurrencyLimit):0,taskIdleTimeoutSecs:isSet4(e.taskIdleTimeoutSecs)?globalThis.Number(e.taskIdleTimeoutSecs):0,ExperimentalGroupSize:isSet4(e.ExperimentalGroupSize)?globalThis.Number(e.ExperimentalGroupSize):0,ExperimentalBufferContainers:isSet4(e.ExperimentalBufferContainers)?globalThis.Number(e.ExperimentalBufferContainers):0,ExperimentalCustomScaling:!!isSet4(e.ExperimentalCustomScaling)&&globalThis.Boolean(e.ExperimentalCustomScaling),ExperimentalEnableGpuSnapshot:!!isSet4(e.ExperimentalEnableGpuSnapshot)&&globalThis.Boolean(e.ExperimentalEnableGpuSnapshot),workerId:isSet4(e.workerId)?globalThis.String(e.workerId):"",timeoutSecs:isSet4(e.timeoutSecs)?globalThis.Number(e.timeoutSecs):0,webUrl:isSet4(e.webUrl)?globalThis.String(e.webUrl):"",webUrlInfo:isSet4(e.webUrlInfo)?WebUrlInfo.fromJSON(e.webUrlInfo):void 0,webhookConfig:isSet4(e.webhookConfig)?WebhookConfig.fromJSON(e.webhookConfig):void 0,customDomainInfo:globalThis.Array.isArray(e?.customDomainInfo)?e.customDomainInfo.map((e=>CustomDomainInfo.fromJSON(e))):[],ExperimentalProxyIp:isSet4(e.ExperimentalProxyIp)?globalThis.String(e.ExperimentalProxyIp):void 0,methodDefinitions:isObject2(e.methodDefinitions)?Object.entries(e.methodDefinitions).reduce(((e,[t,n])=>(e[t]=MethodDefinition.fromJSON(n),e)),{}):{},methodDefinitionsSet:!!isSet4(e.methodDefinitionsSet)&&globalThis.Boolean(e.methodDefinitionsSet),isClass:!!isSet4(e.isClass)&&globalThis.Boolean(e.isClass),classParameterInfo:isSet4(e.classParameterInfo)?ClassParameterInfo.fromJSON(e.classParameterInfo):void 0,isMethod:!!isSet4(e.isMethod)&&globalThis.Boolean(e.isMethod),useFunctionId:isSet4(e.useFunctionId)?globalThis.String(e.useFunctionId):"",useMethodName:isSet4(e.useMethodName)?globalThis.String(e.useMethodName):"",rankedFunctions:globalThis.Array.isArray(e?.rankedFunctions)?e.rankedFunctions.map((e=>FunctionData_RankedFunction.fromJSON(e))):[],schedule:isSet4(e.schedule)?Schedule.fromJSON(e.schedule):void 0,untrusted:!!isSet4(e.untrusted)&&globalThis.Boolean(e.untrusted),snapshotDebug:!!isSet4(e.snapshotDebug)&&globalThis.Boolean(e.snapshotDebug),runtimePerfRecord:!!isSet4(e.runtimePerfRecord)&&globalThis.Boolean(e.runtimePerfRecord),autoscalerSettings:isSet4(e.autoscalerSettings)?AutoscalerSettings.fromJSON(e.autoscalerSettings):void 0,functionSchema:isSet4(e.functionSchema)?FunctionSchema.fromJSON(e.functionSchema):void 0,experimentalOptions:isObject2(e.experimentalOptions)?Object.entries(e.experimentalOptions).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{},flashServiceUrls:globalThis.Array.isArray(e?.flashServiceUrls)?e.flashServiceUrls.map((e=>globalThis.String(e))):[],flashServiceLabel:isSet4(e.flashServiceLabel)?globalThis.String(e.flashServiceLabel):"",startupTimeoutSecs:isSet4(e.startupTimeoutSecs)?globalThis.Number(e.startupTimeoutSecs):0,supportedInputFormats:globalThis.Array.isArray(e?.supportedInputFormats)?e.supportedInputFormats.map((e=>dataFormatFromJSON(e))):[],supportedOutputFormats:globalThis.Array.isArray(e?.supportedOutputFormats)?e.supportedOutputFormats.map((e=>dataFormatFromJSON(e))):[],httpConfig:isSet4(e.httpConfig)?HTTPConfig.fromJSON(e.httpConfig):void 0,implementationName:isSet4(e.implementationName)?globalThis.String(e.implementationName):"",isServer:!!isSet4(e.isServer)&&globalThis.Boolean(e.isServer)}),toJSON(e){const t={};if(""!==e.moduleName&&(t.moduleName=e.moduleName),""!==e.functionName&&(t.functionName=e.functionName),0!==e.functionType&&(t.functionType=function_FunctionTypeToJSON(e.functionType)),0!==e.warmPoolSize&&(t.warmPoolSize=Math.round(e.warmPoolSize)),0!==e.concurrencyLimit&&(t.concurrencyLimit=Math.round(e.concurrencyLimit)),0!==e.taskIdleTimeoutSecs&&(t.taskIdleTimeoutSecs=Math.round(e.taskIdleTimeoutSecs)),0!==e.ExperimentalGroupSize&&(t.ExperimentalGroupSize=Math.round(e.ExperimentalGroupSize)),0!==e.ExperimentalBufferContainers&&(t.ExperimentalBufferContainers=Math.round(e.ExperimentalBufferContainers)),!1!==e.ExperimentalCustomScaling&&(t.ExperimentalCustomScaling=e.ExperimentalCustomScaling),!1!==e.ExperimentalEnableGpuSnapshot&&(t.ExperimentalEnableGpuSnapshot=e.ExperimentalEnableGpuSnapshot),""!==e.workerId&&(t.workerId=e.workerId),0!==e.timeoutSecs&&(t.timeoutSecs=Math.round(e.timeoutSecs)),""!==e.webUrl&&(t.webUrl=e.webUrl),void 0!==e.webUrlInfo&&(t.webUrlInfo=WebUrlInfo.toJSON(e.webUrlInfo)),void 0!==e.webhookConfig&&(t.webhookConfig=WebhookConfig.toJSON(e.webhookConfig)),e.customDomainInfo?.length&&(t.customDomainInfo=e.customDomainInfo.map((e=>CustomDomainInfo.toJSON(e)))),void 0!==e.ExperimentalProxyIp&&(t.ExperimentalProxyIp=e.ExperimentalProxyIp),e.methodDefinitions){const n=Object.entries(e.methodDefinitions);n.length>0&&(t.methodDefinitions={},n.forEach((([e,n])=>{t.methodDefinitions[e]=MethodDefinition.toJSON(n)})))}if(!1!==e.methodDefinitionsSet&&(t.methodDefinitionsSet=e.methodDefinitionsSet),!1!==e.isClass&&(t.isClass=e.isClass),void 0!==e.classParameterInfo&&(t.classParameterInfo=ClassParameterInfo.toJSON(e.classParameterInfo)),!1!==e.isMethod&&(t.isMethod=e.isMethod),""!==e.useFunctionId&&(t.useFunctionId=e.useFunctionId),""!==e.useMethodName&&(t.useMethodName=e.useMethodName),e.rankedFunctions?.length&&(t.rankedFunctions=e.rankedFunctions.map((e=>FunctionData_RankedFunction.toJSON(e)))),void 0!==e.schedule&&(t.schedule=Schedule.toJSON(e.schedule)),!1!==e.untrusted&&(t.untrusted=e.untrusted),!1!==e.snapshotDebug&&(t.snapshotDebug=e.snapshotDebug),!1!==e.runtimePerfRecord&&(t.runtimePerfRecord=e.runtimePerfRecord),void 0!==e.autoscalerSettings&&(t.autoscalerSettings=AutoscalerSettings.toJSON(e.autoscalerSettings)),void 0!==e.functionSchema&&(t.functionSchema=FunctionSchema.toJSON(e.functionSchema)),e.experimentalOptions){const n=Object.entries(e.experimentalOptions);n.length>0&&(t.experimentalOptions={},n.forEach((([e,n])=>{t.experimentalOptions[e]=n})))}return e.flashServiceUrls?.length&&(t.flashServiceUrls=e.flashServiceUrls),""!==e.flashServiceLabel&&(t.flashServiceLabel=e.flashServiceLabel),0!==e.startupTimeoutSecs&&(t.startupTimeoutSecs=Math.round(e.startupTimeoutSecs)),e.supportedInputFormats?.length&&(t.supportedInputFormats=e.supportedInputFormats.map((e=>dataFormatToJSON(e)))),e.supportedOutputFormats?.length&&(t.supportedOutputFormats=e.supportedOutputFormats.map((e=>dataFormatToJSON(e)))),void 0!==e.httpConfig&&(t.httpConfig=HTTPConfig.toJSON(e.httpConfig)),""!==e.implementationName&&(t.implementationName=e.implementationName),!1!==e.isServer&&(t.isServer=e.isServer),t},create:e=>FunctionData.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionData();return t.moduleName=e.moduleName??"",t.functionName=e.functionName??"",t.functionType=e.functionType??0,t.warmPoolSize=e.warmPoolSize??0,t.concurrencyLimit=e.concurrencyLimit??0,t.taskIdleTimeoutSecs=e.taskIdleTimeoutSecs??0,t.ExperimentalGroupSize=e.ExperimentalGroupSize??0,t.ExperimentalBufferContainers=e.ExperimentalBufferContainers??0,t.ExperimentalCustomScaling=e.ExperimentalCustomScaling??!1,t.ExperimentalEnableGpuSnapshot=e.ExperimentalEnableGpuSnapshot??!1,t.workerId=e.workerId??"",t.timeoutSecs=e.timeoutSecs??0,t.webUrl=e.webUrl??"",t.webUrlInfo=void 0!==e.webUrlInfo&&null!==e.webUrlInfo?WebUrlInfo.fromPartial(e.webUrlInfo):void 0,t.webhookConfig=void 0!==e.webhookConfig&&null!==e.webhookConfig?WebhookConfig.fromPartial(e.webhookConfig):void 0,t.customDomainInfo=e.customDomainInfo?.map((e=>CustomDomainInfo.fromPartial(e)))||[],t.ExperimentalProxyIp=e.ExperimentalProxyIp??void 0,t.methodDefinitions=Object.entries(e.methodDefinitions??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=MethodDefinition.fromPartial(n)),e)),{}),t.methodDefinitionsSet=e.methodDefinitionsSet??!1,t.isClass=e.isClass??!1,t.classParameterInfo=void 0!==e.classParameterInfo&&null!==e.classParameterInfo?ClassParameterInfo.fromPartial(e.classParameterInfo):void 0,t.isMethod=e.isMethod??!1,t.useFunctionId=e.useFunctionId??"",t.useMethodName=e.useMethodName??"",t.rankedFunctions=e.rankedFunctions?.map((e=>FunctionData_RankedFunction.fromPartial(e)))||[],t.schedule=void 0!==e.schedule&&null!==e.schedule?Schedule.fromPartial(e.schedule):void 0,t.untrusted=e.untrusted??!1,t.snapshotDebug=e.snapshotDebug??!1,t.runtimePerfRecord=e.runtimePerfRecord??!1,t.autoscalerSettings=void 0!==e.autoscalerSettings&&null!==e.autoscalerSettings?AutoscalerSettings.fromPartial(e.autoscalerSettings):void 0,t.functionSchema=void 0!==e.functionSchema&&null!==e.functionSchema?FunctionSchema.fromPartial(e.functionSchema):void 0,t.experimentalOptions=Object.entries(e.experimentalOptions??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t.flashServiceUrls=e.flashServiceUrls?.map((e=>e))||[],t.flashServiceLabel=e.flashServiceLabel??"",t.startupTimeoutSecs=e.startupTimeoutSecs??0,t.supportedInputFormats=e.supportedInputFormats?.map((e=>e))||[],t.supportedOutputFormats=e.supportedOutputFormats?.map((e=>e))||[],t.httpConfig=void 0!==e.httpConfig&&null!==e.httpConfig?HTTPConfig.fromPartial(e.httpConfig):void 0,t.implementationName=e.implementationName??"",t.isServer=e.isServer??!1,t}};function createBaseFunctionData_MethodDefinitionsEntry(){return{key:"",value:void 0}}var FunctionData_MethodDefinitionsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),void 0!==e.value&&MethodDefinition.encode(e.value,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionData_MethodDefinitionsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=MethodDefinition.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?MethodDefinition.fromJSON(e.value):void 0}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),void 0!==e.value&&(t.value=MethodDefinition.toJSON(e.value)),t},create:e=>FunctionData_MethodDefinitionsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionData_MethodDefinitionsEntry();return t.key=e.key??"",t.value=void 0!==e.value&&null!==e.value?MethodDefinition.fromPartial(e.value):void 0,t}};function createBaseFunctionData_RankedFunction(){return{rank:0,function:void 0}}var FunctionData_RankedFunction={encode:(e,t=new BinaryWriter)=>(0!==e.rank&&t.uint32(8).uint32(e.rank),void 0!==e.function&&FunctionMessage.encode(e.function,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionData_RankedFunction();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.rank=n.uint32();continue;case 2:if(18!==e)break;a.function=FunctionMessage.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({rank:isSet4(e.rank)?globalThis.Number(e.rank):0,function:isSet4(e.function)?FunctionMessage.fromJSON(e.function):void 0}),toJSON(e){const t={};return 0!==e.rank&&(t.rank=Math.round(e.rank)),void 0!==e.function&&(t.function=FunctionMessage.toJSON(e.function)),t},create:e=>FunctionData_RankedFunction.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionData_RankedFunction();return t.rank=e.rank??0,t.function=void 0!==e.function&&null!==e.function?FunctionMessage.fromPartial(e.function):void 0,t}};function createBaseFunctionData_ExperimentalOptionsEntry(){return{key:"",value:""}}var FunctionData_ExperimentalOptionsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionData_ExperimentalOptionsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>FunctionData_ExperimentalOptionsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionData_ExperimentalOptionsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseFunctionFinishInputsRequest(){return{functionId:"",functionCallId:"",numInputs:0}}var FunctionFinishInputsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),""!==e.functionCallId&&t.uint32(18).string(e.functionCallId),0!==e.numInputs&&t.uint32(24).uint32(e.numInputs),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionFinishInputsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(18!==e)break;a.functionCallId=n.string();continue;case 3:if(24!==e)break;a.numInputs=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",numInputs:isSet4(e.numInputs)?globalThis.Number(e.numInputs):0}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),""!==e.functionCallId&&(t.functionCallId=e.functionCallId),0!==e.numInputs&&(t.numInputs=Math.round(e.numInputs)),t},create:e=>FunctionFinishInputsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionFinishInputsRequest();return t.functionId=e.functionId??"",t.functionCallId=e.functionCallId??"",t.numInputs=e.numInputs??0,t}};function createBaseFunctionGetCallGraphRequest(){return{functionCallId:""}}var FunctionGetCallGraphRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionCallId&&t.uint32(18).string(e.functionCallId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetCallGraphRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 2:if(18!==e)break;a.functionCallId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):""}),toJSON(e){const t={};return""!==e.functionCallId&&(t.functionCallId=e.functionCallId),t},create:e=>FunctionGetCallGraphRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetCallGraphRequest();return t.functionCallId=e.functionCallId??"",t}};function createBaseFunctionGetCallGraphResponse(){return{inputs:[],functionCalls:[]}}var FunctionGetCallGraphResponse={encode(e,t=new BinaryWriter){for(const n of e.inputs)InputCallGraphInfo.encode(n,t.uint32(10).fork()).join();for(const n of e.functionCalls)FunctionCallCallGraphInfo.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetCallGraphResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.inputs.push(InputCallGraphInfo.decode(n,n.uint32()));continue;case 2:if(18!==e)break;a.functionCalls.push(FunctionCallCallGraphInfo.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({inputs:globalThis.Array.isArray(e?.inputs)?e.inputs.map((e=>InputCallGraphInfo.fromJSON(e))):[],functionCalls:globalThis.Array.isArray(e?.functionCalls)?e.functionCalls.map((e=>FunctionCallCallGraphInfo.fromJSON(e))):[]}),toJSON(e){const t={};return e.inputs?.length&&(t.inputs=e.inputs.map((e=>InputCallGraphInfo.toJSON(e)))),e.functionCalls?.length&&(t.functionCalls=e.functionCalls.map((e=>FunctionCallCallGraphInfo.toJSON(e)))),t},create:e=>FunctionGetCallGraphResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetCallGraphResponse();return t.inputs=e.inputs?.map((e=>InputCallGraphInfo.fromPartial(e)))||[],t.functionCalls=e.functionCalls?.map((e=>FunctionCallCallGraphInfo.fromPartial(e)))||[],t}};function createBaseFunctionGetCurrentStatsRequest(){return{functionId:""}}var FunctionGetCurrentStatsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetCurrentStatsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):""}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),t},create:e=>FunctionGetCurrentStatsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetCurrentStatsRequest();return t.functionId=e.functionId??"",t}};function createBaseFunctionGetDynamicConcurrencyRequest(){return{functionId:"",targetConcurrency:0,maxConcurrency:0}}var FunctionGetDynamicConcurrencyRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),0!==e.targetConcurrency&&t.uint32(16).uint32(e.targetConcurrency),0!==e.maxConcurrency&&t.uint32(24).uint32(e.maxConcurrency),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetDynamicConcurrencyRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(16!==e)break;a.targetConcurrency=n.uint32();continue;case 3:if(24!==e)break;a.maxConcurrency=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",targetConcurrency:isSet4(e.targetConcurrency)?globalThis.Number(e.targetConcurrency):0,maxConcurrency:isSet4(e.maxConcurrency)?globalThis.Number(e.maxConcurrency):0}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),0!==e.targetConcurrency&&(t.targetConcurrency=Math.round(e.targetConcurrency)),0!==e.maxConcurrency&&(t.maxConcurrency=Math.round(e.maxConcurrency)),t},create:e=>FunctionGetDynamicConcurrencyRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetDynamicConcurrencyRequest();return t.functionId=e.functionId??"",t.targetConcurrency=e.targetConcurrency??0,t.maxConcurrency=e.maxConcurrency??0,t}};function createBaseFunctionGetDynamicConcurrencyResponse(){return{concurrency:0}}var FunctionGetDynamicConcurrencyResponse={encode:(e,t=new BinaryWriter)=>(0!==e.concurrency&&t.uint32(8).uint32(e.concurrency),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetDynamicConcurrencyResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.concurrency=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({concurrency:isSet4(e.concurrency)?globalThis.Number(e.concurrency):0}),toJSON(e){const t={};return 0!==e.concurrency&&(t.concurrency=Math.round(e.concurrency)),t},create:e=>FunctionGetDynamicConcurrencyResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetDynamicConcurrencyResponse();return t.concurrency=e.concurrency??0,t}};function createBaseFunctionGetInputsItem(){return{inputId:"",input:void 0,killSwitch:!1,functionCallId:"",functionCallInvocationType:0,retryCount:0,functionMapIdx:void 0,attemptToken:""}}var FunctionGetInputsItem={encode:(e,t=new BinaryWriter)=>(""!==e.inputId&&t.uint32(10).string(e.inputId),void 0!==e.input&&FunctionInput.encode(e.input,t.uint32(18).fork()).join(),!1!==e.killSwitch&&t.uint32(24).bool(e.killSwitch),""!==e.functionCallId&&t.uint32(42).string(e.functionCallId),0!==e.functionCallInvocationType&&t.uint32(48).int32(e.functionCallInvocationType),0!==e.retryCount&&t.uint32(56).uint32(e.retryCount),void 0!==e.functionMapIdx&&t.uint32(64).int32(e.functionMapIdx),""!==e.attemptToken&&t.uint32(74).string(e.attemptToken),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetInputsItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.inputId=n.string();continue;case 2:if(18!==e)break;a.input=FunctionInput.decode(n,n.uint32());continue;case 3:if(24!==e)break;a.killSwitch=n.bool();continue;case 5:if(42!==e)break;a.functionCallId=n.string();continue;case 6:if(48!==e)break;a.functionCallInvocationType=n.int32();continue;case 7:if(56!==e)break;a.retryCount=n.uint32();continue;case 8:if(64!==e)break;a.functionMapIdx=n.int32();continue;case 9:if(74!==e)break;a.attemptToken=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({inputId:isSet4(e.inputId)?globalThis.String(e.inputId):"",input:isSet4(e.input)?FunctionInput.fromJSON(e.input):void 0,killSwitch:!!isSet4(e.killSwitch)&&globalThis.Boolean(e.killSwitch),functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",functionCallInvocationType:isSet4(e.functionCallInvocationType)?functionCallInvocationTypeFromJSON(e.functionCallInvocationType):0,retryCount:isSet4(e.retryCount)?globalThis.Number(e.retryCount):0,functionMapIdx:isSet4(e.functionMapIdx)?globalThis.Number(e.functionMapIdx):void 0,attemptToken:isSet4(e.attemptToken)?globalThis.String(e.attemptToken):""}),toJSON(e){const t={};return""!==e.inputId&&(t.inputId=e.inputId),void 0!==e.input&&(t.input=FunctionInput.toJSON(e.input)),!1!==e.killSwitch&&(t.killSwitch=e.killSwitch),""!==e.functionCallId&&(t.functionCallId=e.functionCallId),0!==e.functionCallInvocationType&&(t.functionCallInvocationType=functionCallInvocationTypeToJSON(e.functionCallInvocationType)),0!==e.retryCount&&(t.retryCount=Math.round(e.retryCount)),void 0!==e.functionMapIdx&&(t.functionMapIdx=Math.round(e.functionMapIdx)),""!==e.attemptToken&&(t.attemptToken=e.attemptToken),t},create:e=>FunctionGetInputsItem.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetInputsItem();return t.inputId=e.inputId??"",t.input=void 0!==e.input&&null!==e.input?FunctionInput.fromPartial(e.input):void 0,t.killSwitch=e.killSwitch??!1,t.functionCallId=e.functionCallId??"",t.functionCallInvocationType=e.functionCallInvocationType??0,t.retryCount=e.retryCount??0,t.functionMapIdx=e.functionMapIdx??void 0,t.attemptToken=e.attemptToken??"",t}};function createBaseFunctionGetInputsRequest(){return{functionId:"",maxValues:0,averageCallTime:0,inputConcurrency:0,batchMaxSize:0,batchLingerMs:0}}var FunctionGetInputsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),0!==e.maxValues&&t.uint32(24).int32(e.maxValues),0!==e.averageCallTime&&t.uint32(45).float(e.averageCallTime),0!==e.inputConcurrency&&t.uint32(48).int32(e.inputConcurrency),0!==e.batchMaxSize&&t.uint32(88).uint32(e.batchMaxSize),0!==e.batchLingerMs&&t.uint32(96).uint64(e.batchLingerMs),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetInputsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 3:if(24!==e)break;a.maxValues=n.int32();continue;case 5:if(45!==e)break;a.averageCallTime=n.float();continue;case 6:if(48!==e)break;a.inputConcurrency=n.int32();continue;case 11:if(88!==e)break;a.batchMaxSize=n.uint32();continue;case 12:if(96!==e)break;a.batchLingerMs=longToNumber2(n.uint64());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",maxValues:isSet4(e.maxValues)?globalThis.Number(e.maxValues):0,averageCallTime:isSet4(e.averageCallTime)?globalThis.Number(e.averageCallTime):0,inputConcurrency:isSet4(e.inputConcurrency)?globalThis.Number(e.inputConcurrency):0,batchMaxSize:isSet4(e.batchMaxSize)?globalThis.Number(e.batchMaxSize):0,batchLingerMs:isSet4(e.batchLingerMs)?globalThis.Number(e.batchLingerMs):0}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),0!==e.maxValues&&(t.maxValues=Math.round(e.maxValues)),0!==e.averageCallTime&&(t.averageCallTime=e.averageCallTime),0!==e.inputConcurrency&&(t.inputConcurrency=Math.round(e.inputConcurrency)),0!==e.batchMaxSize&&(t.batchMaxSize=Math.round(e.batchMaxSize)),0!==e.batchLingerMs&&(t.batchLingerMs=Math.round(e.batchLingerMs)),t},create:e=>FunctionGetInputsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetInputsRequest();return t.functionId=e.functionId??"",t.maxValues=e.maxValues??0,t.averageCallTime=e.averageCallTime??0,t.inputConcurrency=e.inputConcurrency??0,t.batchMaxSize=e.batchMaxSize??0,t.batchLingerMs=e.batchLingerMs??0,t}};function createBaseFunctionGetInputsResponse(){return{inputs:[],rateLimitSleepDuration:0}}var FunctionGetInputsResponse={encode(e,t=new BinaryWriter){for(const n of e.inputs)FunctionGetInputsItem.encode(n,t.uint32(26).fork()).join();return 0!==e.rateLimitSleepDuration&&t.uint32(37).float(e.rateLimitSleepDuration),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetInputsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 3:if(26!==e)break;a.inputs.push(FunctionGetInputsItem.decode(n,n.uint32()));continue;case 4:if(37!==e)break;a.rateLimitSleepDuration=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({inputs:globalThis.Array.isArray(e?.inputs)?e.inputs.map((e=>FunctionGetInputsItem.fromJSON(e))):[],rateLimitSleepDuration:isSet4(e.rateLimitSleepDuration)?globalThis.Number(e.rateLimitSleepDuration):0}),toJSON(e){const t={};return e.inputs?.length&&(t.inputs=e.inputs.map((e=>FunctionGetInputsItem.toJSON(e)))),0!==e.rateLimitSleepDuration&&(t.rateLimitSleepDuration=e.rateLimitSleepDuration),t},create:e=>FunctionGetInputsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetInputsResponse();return t.inputs=e.inputs?.map((e=>FunctionGetInputsItem.fromPartial(e)))||[],t.rateLimitSleepDuration=e.rateLimitSleepDuration??0,t}};function createBaseFunctionGetOutputsItem(){return{result:void 0,idx:0,inputId:"",dataFormat:0,taskId:"",inputStartedAt:0,outputCreatedAt:0,retryCount:0,fcTraceTag:""}}var FunctionGetOutputsItem={encode:(e,t=new BinaryWriter)=>(void 0!==e.result&&GenericResult.encode(e.result,t.uint32(10).fork()).join(),0!==e.idx&&t.uint32(16).int32(e.idx),""!==e.inputId&&t.uint32(26).string(e.inputId),0!==e.dataFormat&&t.uint32(40).int32(e.dataFormat),""!==e.taskId&&t.uint32(50).string(e.taskId),0!==e.inputStartedAt&&t.uint32(57).double(e.inputStartedAt),0!==e.outputCreatedAt&&t.uint32(65).double(e.outputCreatedAt),0!==e.retryCount&&t.uint32(72).uint32(e.retryCount),""!==e.fcTraceTag&&t.uint32(82).string(e.fcTraceTag),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetOutputsItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.result=GenericResult.decode(n,n.uint32());continue;case 2:if(16!==e)break;a.idx=n.int32();continue;case 3:if(26!==e)break;a.inputId=n.string();continue;case 5:if(40!==e)break;a.dataFormat=n.int32();continue;case 6:if(50!==e)break;a.taskId=n.string();continue;case 7:if(57!==e)break;a.inputStartedAt=n.double();continue;case 8:if(65!==e)break;a.outputCreatedAt=n.double();continue;case 9:if(72!==e)break;a.retryCount=n.uint32();continue;case 10:if(82!==e)break;a.fcTraceTag=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({result:isSet4(e.result)?GenericResult.fromJSON(e.result):void 0,idx:isSet4(e.idx)?globalThis.Number(e.idx):0,inputId:isSet4(e.inputId)?globalThis.String(e.inputId):"",dataFormat:isSet4(e.dataFormat)?dataFormatFromJSON(e.dataFormat):0,taskId:isSet4(e.taskId)?globalThis.String(e.taskId):"",inputStartedAt:isSet4(e.inputStartedAt)?globalThis.Number(e.inputStartedAt):0,outputCreatedAt:isSet4(e.outputCreatedAt)?globalThis.Number(e.outputCreatedAt):0,retryCount:isSet4(e.retryCount)?globalThis.Number(e.retryCount):0,fcTraceTag:isSet4(e.fcTraceTag)?globalThis.String(e.fcTraceTag):""}),toJSON(e){const t={};return void 0!==e.result&&(t.result=GenericResult.toJSON(e.result)),0!==e.idx&&(t.idx=Math.round(e.idx)),""!==e.inputId&&(t.inputId=e.inputId),0!==e.dataFormat&&(t.dataFormat=dataFormatToJSON(e.dataFormat)),""!==e.taskId&&(t.taskId=e.taskId),0!==e.inputStartedAt&&(t.inputStartedAt=e.inputStartedAt),0!==e.outputCreatedAt&&(t.outputCreatedAt=e.outputCreatedAt),0!==e.retryCount&&(t.retryCount=Math.round(e.retryCount)),""!==e.fcTraceTag&&(t.fcTraceTag=e.fcTraceTag),t},create:e=>FunctionGetOutputsItem.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetOutputsItem();return t.result=void 0!==e.result&&null!==e.result?GenericResult.fromPartial(e.result):void 0,t.idx=e.idx??0,t.inputId=e.inputId??"",t.dataFormat=e.dataFormat??0,t.taskId=e.taskId??"",t.inputStartedAt=e.inputStartedAt??0,t.outputCreatedAt=e.outputCreatedAt??0,t.retryCount=e.retryCount??0,t.fcTraceTag=e.fcTraceTag??"",t}};function createBaseFunctionGetOutputsRequest(){return{functionCallId:"",maxValues:0,timeout:0,lastEntryId:"",clearOnSuccess:!1,requestedAt:0,inputJwts:[],startIdx:void 0,endIdx:void 0}}var FunctionGetOutputsRequest={encode(e,t=new BinaryWriter){""!==e.functionCallId&&t.uint32(10).string(e.functionCallId),0!==e.maxValues&&t.uint32(16).int32(e.maxValues),0!==e.timeout&&t.uint32(29).float(e.timeout),""!==e.lastEntryId&&t.uint32(50).string(e.lastEntryId),!1!==e.clearOnSuccess&&t.uint32(56).bool(e.clearOnSuccess),0!==e.requestedAt&&t.uint32(65).double(e.requestedAt);for(const n of e.inputJwts)t.uint32(74).string(n);return void 0!==e.startIdx&&t.uint32(80).int32(e.startIdx),void 0!==e.endIdx&&t.uint32(88).int32(e.endIdx),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetOutputsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionCallId=n.string();continue;case 2:if(16!==e)break;a.maxValues=n.int32();continue;case 3:if(29!==e)break;a.timeout=n.float();continue;case 6:if(50!==e)break;a.lastEntryId=n.string();continue;case 7:if(56!==e)break;a.clearOnSuccess=n.bool();continue;case 8:if(65!==e)break;a.requestedAt=n.double();continue;case 9:if(74!==e)break;a.inputJwts.push(n.string());continue;case 10:if(80!==e)break;a.startIdx=n.int32();continue;case 11:if(88!==e)break;a.endIdx=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",maxValues:isSet4(e.maxValues)?globalThis.Number(e.maxValues):0,timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0,lastEntryId:isSet4(e.lastEntryId)?globalThis.String(e.lastEntryId):"",clearOnSuccess:!!isSet4(e.clearOnSuccess)&&globalThis.Boolean(e.clearOnSuccess),requestedAt:isSet4(e.requestedAt)?globalThis.Number(e.requestedAt):0,inputJwts:globalThis.Array.isArray(e?.inputJwts)?e.inputJwts.map((e=>globalThis.String(e))):[],startIdx:isSet4(e.startIdx)?globalThis.Number(e.startIdx):void 0,endIdx:isSet4(e.endIdx)?globalThis.Number(e.endIdx):void 0}),toJSON(e){const t={};return""!==e.functionCallId&&(t.functionCallId=e.functionCallId),0!==e.maxValues&&(t.maxValues=Math.round(e.maxValues)),0!==e.timeout&&(t.timeout=e.timeout),""!==e.lastEntryId&&(t.lastEntryId=e.lastEntryId),!1!==e.clearOnSuccess&&(t.clearOnSuccess=e.clearOnSuccess),0!==e.requestedAt&&(t.requestedAt=e.requestedAt),e.inputJwts?.length&&(t.inputJwts=e.inputJwts),void 0!==e.startIdx&&(t.startIdx=Math.round(e.startIdx)),void 0!==e.endIdx&&(t.endIdx=Math.round(e.endIdx)),t},create:e=>FunctionGetOutputsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetOutputsRequest();return t.functionCallId=e.functionCallId??"",t.maxValues=e.maxValues??0,t.timeout=e.timeout??0,t.lastEntryId=e.lastEntryId??"",t.clearOnSuccess=e.clearOnSuccess??!1,t.requestedAt=e.requestedAt??0,t.inputJwts=e.inputJwts?.map((e=>e))||[],t.startIdx=e.startIdx??void 0,t.endIdx=e.endIdx??void 0,t}};function createBaseFunctionGetOutputsResponse(){return{idxs:[],outputs:[],lastEntryId:"",numUnfinishedInputs:0}}var FunctionGetOutputsResponse={encode(e,t=new BinaryWriter){t.uint32(26).fork();for(const n of e.idxs)t.int32(n);t.join();for(const n of e.outputs)FunctionGetOutputsItem.encode(n,t.uint32(34).fork()).join();return""!==e.lastEntryId&&t.uint32(42).string(e.lastEntryId),0!==e.numUnfinishedInputs&&t.uint32(48).int32(e.numUnfinishedInputs),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetOutputsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 3:if(24===e){a.idxs.push(n.int32());continue}if(26===e){const e=n.uint32()+n.pos;for(;n.pos<e;)a.idxs.push(n.int32());continue}break;case 4:if(34!==e)break;a.outputs.push(FunctionGetOutputsItem.decode(n,n.uint32()));continue;case 5:if(42!==e)break;a.lastEntryId=n.string();continue;case 6:if(48!==e)break;a.numUnfinishedInputs=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({idxs:globalThis.Array.isArray(e?.idxs)?e.idxs.map((e=>globalThis.Number(e))):[],outputs:globalThis.Array.isArray(e?.outputs)?e.outputs.map((e=>FunctionGetOutputsItem.fromJSON(e))):[],lastEntryId:isSet4(e.lastEntryId)?globalThis.String(e.lastEntryId):"",numUnfinishedInputs:isSet4(e.numUnfinishedInputs)?globalThis.Number(e.numUnfinishedInputs):0}),toJSON(e){const t={};return e.idxs?.length&&(t.idxs=e.idxs.map((e=>Math.round(e)))),e.outputs?.length&&(t.outputs=e.outputs.map((e=>FunctionGetOutputsItem.toJSON(e)))),""!==e.lastEntryId&&(t.lastEntryId=e.lastEntryId),0!==e.numUnfinishedInputs&&(t.numUnfinishedInputs=Math.round(e.numUnfinishedInputs)),t},create:e=>FunctionGetOutputsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetOutputsResponse();return t.idxs=e.idxs?.map((e=>e))||[],t.outputs=e.outputs?.map((e=>FunctionGetOutputsItem.fromPartial(e)))||[],t.lastEntryId=e.lastEntryId??"",t.numUnfinishedInputs=e.numUnfinishedInputs??0,t}};function createBaseFunctionGetRequest(){return{appName:"",objectTag:"",environmentName:""}}var FunctionGetRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appName&&t.uint32(10).string(e.appName),""!==e.objectTag&&t.uint32(18).string(e.objectTag),""!==e.environmentName&&t.uint32(34).string(e.environmentName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appName=n.string();continue;case 2:if(18!==e)break;a.objectTag=n.string();continue;case 4:if(34!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appName:isSet4(e.appName)?globalThis.String(e.appName):"",objectTag:isSet4(e.objectTag)?globalThis.String(e.objectTag):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return""!==e.appName&&(t.appName=e.appName),""!==e.objectTag&&(t.objectTag=e.objectTag),""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>FunctionGetRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetRequest();return t.appName=e.appName??"",t.objectTag=e.objectTag??"",t.environmentName=e.environmentName??"",t}};function createBaseFunctionGetResponse(){return{functionId:"",handleMetadata:void 0,serverWarnings:[]}}var FunctionGetResponse={encode(e,t=new BinaryWriter){""!==e.functionId&&t.uint32(10).string(e.functionId),void 0!==e.handleMetadata&&FunctionHandleMetadata.encode(e.handleMetadata,t.uint32(18).fork()).join();for(const n of e.serverWarnings)Warning.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(18!==e)break;a.handleMetadata=FunctionHandleMetadata.decode(n,n.uint32());continue;case 4:if(34!==e)break;a.serverWarnings.push(Warning.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",handleMetadata:isSet4(e.handleMetadata)?FunctionHandleMetadata.fromJSON(e.handleMetadata):void 0,serverWarnings:globalThis.Array.isArray(e?.serverWarnings)?e.serverWarnings.map((e=>Warning.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),void 0!==e.handleMetadata&&(t.handleMetadata=FunctionHandleMetadata.toJSON(e.handleMetadata)),e.serverWarnings?.length&&(t.serverWarnings=e.serverWarnings.map((e=>Warning.toJSON(e)))),t},create:e=>FunctionGetResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetResponse();return t.functionId=e.functionId??"",t.handleMetadata=void 0!==e.handleMetadata&&null!==e.handleMetadata?FunctionHandleMetadata.fromPartial(e.handleMetadata):void 0,t.serverWarnings=e.serverWarnings?.map((e=>Warning.fromPartial(e)))||[],t}};function createBaseFunctionGetSerializedRequest(){return{functionId:""}}var FunctionGetSerializedRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetSerializedRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):""}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),t},create:e=>FunctionGetSerializedRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetSerializedRequest();return t.functionId=e.functionId??"",t}};function createBaseFunctionGetSerializedResponse(){return{functionSerialized:new Uint8Array(0),classSerialized:new Uint8Array(0)}}var FunctionGetSerializedResponse={encode:(e,t=new BinaryWriter)=>(0!==e.functionSerialized.length&&t.uint32(10).bytes(e.functionSerialized),0!==e.classSerialized.length&&t.uint32(18).bytes(e.classSerialized),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionGetSerializedResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionSerialized=n.bytes();continue;case 2:if(18!==e)break;a.classSerialized=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionSerialized:isSet4(e.functionSerialized)?bytesFromBase64(e.functionSerialized):new Uint8Array(0),classSerialized:isSet4(e.classSerialized)?bytesFromBase64(e.classSerialized):new Uint8Array(0)}),toJSON(e){const t={};return 0!==e.functionSerialized.length&&(t.functionSerialized=base64FromBytes(e.functionSerialized)),0!==e.classSerialized.length&&(t.classSerialized=base64FromBytes(e.classSerialized)),t},create:e=>FunctionGetSerializedResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionGetSerializedResponse();return t.functionSerialized=e.functionSerialized??new Uint8Array(0),t.classSerialized=e.classSerialized??new Uint8Array(0),t}};function createBaseFunctionHandleMetadata(){return{functionName:"",functionType:0,webUrl:"",isMethod:!1,useFunctionId:"",useMethodName:"",definitionId:"",classParameterInfo:void 0,methodHandleMetadata:{},functionSchema:void 0,inputPlaneUrl:void 0,inputPlaneRegion:void 0,maxObjectSizeBytes:void 0,ExperimentalFlashUrls:[],supportedInputFormats:[],supportedOutputFormats:[]}}var FunctionHandleMetadata={encode(e,t=new BinaryWriter){""!==e.functionName&&t.uint32(18).string(e.functionName),0!==e.functionType&&t.uint32(64).int32(e.functionType),""!==e.webUrl&&t.uint32(226).string(e.webUrl),!1!==e.isMethod&&t.uint32(312).bool(e.isMethod),""!==e.useFunctionId&&t.uint32(322).string(e.useFunctionId),""!==e.useMethodName&&t.uint32(330).string(e.useMethodName),""!==e.definitionId&&t.uint32(338).string(e.definitionId),void 0!==e.classParameterInfo&&ClassParameterInfo.encode(e.classParameterInfo,t.uint32(346).fork()).join(),Object.entries(e.methodHandleMetadata).forEach((([e,n])=>{FunctionHandleMetadata_MethodHandleMetadataEntry.encode({key:e,value:n},t.uint32(354).fork()).join()})),void 0!==e.functionSchema&&FunctionSchema.encode(e.functionSchema,t.uint32(362).fork()).join(),void 0!==e.inputPlaneUrl&&t.uint32(370).string(e.inputPlaneUrl),void 0!==e.inputPlaneRegion&&t.uint32(378).string(e.inputPlaneRegion),void 0!==e.maxObjectSizeBytes&&t.uint32(384).uint64(e.maxObjectSizeBytes);for(const n of e.ExperimentalFlashUrls)t.uint32(394).string(n);t.uint32(402).fork();for(const n of e.supportedInputFormats)t.int32(n);t.join(),t.uint32(410).fork();for(const n of e.supportedOutputFormats)t.int32(n);return t.join(),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionHandleMetadata();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 2:if(18!==e)break;a.functionName=n.string();continue;case 8:if(64!==e)break;a.functionType=n.int32();continue;case 28:if(226!==e)break;a.webUrl=n.string();continue;case 39:if(312!==e)break;a.isMethod=n.bool();continue;case 40:if(322!==e)break;a.useFunctionId=n.string();continue;case 41:if(330!==e)break;a.useMethodName=n.string();continue;case 42:if(338!==e)break;a.definitionId=n.string();continue;case 43:if(346!==e)break;a.classParameterInfo=ClassParameterInfo.decode(n,n.uint32());continue;case 44:{if(354!==e)break;const t=FunctionHandleMetadata_MethodHandleMetadataEntry.decode(n,n.uint32());void 0!==t.value&&(a.methodHandleMetadata[t.key]=t.value);continue}case 45:if(362!==e)break;a.functionSchema=FunctionSchema.decode(n,n.uint32());continue;case 46:if(370!==e)break;a.inputPlaneUrl=n.string();continue;case 47:if(378!==e)break;a.inputPlaneRegion=n.string();continue;case 48:if(384!==e)break;a.maxObjectSizeBytes=longToNumber2(n.uint64());continue;case 49:if(394!==e)break;a.ExperimentalFlashUrls.push(n.string());continue;case 50:if(400===e){a.supportedInputFormats.push(n.int32());continue}if(402===e){const e=n.uint32()+n.pos;for(;n.pos<e;)a.supportedInputFormats.push(n.int32());continue}break;case 51:if(408===e){a.supportedOutputFormats.push(n.int32());continue}if(410===e){const e=n.uint32()+n.pos;for(;n.pos<e;)a.supportedOutputFormats.push(n.int32());continue}}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionName:isSet4(e.functionName)?globalThis.String(e.functionName):"",functionType:isSet4(e.functionType)?function_FunctionTypeFromJSON(e.functionType):0,webUrl:isSet4(e.webUrl)?globalThis.String(e.webUrl):"",isMethod:!!isSet4(e.isMethod)&&globalThis.Boolean(e.isMethod),useFunctionId:isSet4(e.useFunctionId)?globalThis.String(e.useFunctionId):"",useMethodName:isSet4(e.useMethodName)?globalThis.String(e.useMethodName):"",definitionId:isSet4(e.definitionId)?globalThis.String(e.definitionId):"",classParameterInfo:isSet4(e.classParameterInfo)?ClassParameterInfo.fromJSON(e.classParameterInfo):void 0,methodHandleMetadata:isObject2(e.methodHandleMetadata)?Object.entries(e.methodHandleMetadata).reduce(((e,[t,n])=>(e[t]=FunctionHandleMetadata.fromJSON(n),e)),{}):{},functionSchema:isSet4(e.functionSchema)?FunctionSchema.fromJSON(e.functionSchema):void 0,inputPlaneUrl:isSet4(e.inputPlaneUrl)?globalThis.String(e.inputPlaneUrl):void 0,inputPlaneRegion:isSet4(e.inputPlaneRegion)?globalThis.String(e.inputPlaneRegion):void 0,maxObjectSizeBytes:isSet4(e.maxObjectSizeBytes)?globalThis.Number(e.maxObjectSizeBytes):void 0,ExperimentalFlashUrls:globalThis.Array.isArray(e?.ExperimentalFlashUrls)?e.ExperimentalFlashUrls.map((e=>globalThis.String(e))):[],supportedInputFormats:globalThis.Array.isArray(e?.supportedInputFormats)?e.supportedInputFormats.map((e=>dataFormatFromJSON(e))):[],supportedOutputFormats:globalThis.Array.isArray(e?.supportedOutputFormats)?e.supportedOutputFormats.map((e=>dataFormatFromJSON(e))):[]}),toJSON(e){const t={};if(""!==e.functionName&&(t.functionName=e.functionName),0!==e.functionType&&(t.functionType=function_FunctionTypeToJSON(e.functionType)),""!==e.webUrl&&(t.webUrl=e.webUrl),!1!==e.isMethod&&(t.isMethod=e.isMethod),""!==e.useFunctionId&&(t.useFunctionId=e.useFunctionId),""!==e.useMethodName&&(t.useMethodName=e.useMethodName),""!==e.definitionId&&(t.definitionId=e.definitionId),void 0!==e.classParameterInfo&&(t.classParameterInfo=ClassParameterInfo.toJSON(e.classParameterInfo)),e.methodHandleMetadata){const n=Object.entries(e.methodHandleMetadata);n.length>0&&(t.methodHandleMetadata={},n.forEach((([e,n])=>{t.methodHandleMetadata[e]=FunctionHandleMetadata.toJSON(n)})))}return void 0!==e.functionSchema&&(t.functionSchema=FunctionSchema.toJSON(e.functionSchema)),void 0!==e.inputPlaneUrl&&(t.inputPlaneUrl=e.inputPlaneUrl),void 0!==e.inputPlaneRegion&&(t.inputPlaneRegion=e.inputPlaneRegion),void 0!==e.maxObjectSizeBytes&&(t.maxObjectSizeBytes=Math.round(e.maxObjectSizeBytes)),e.ExperimentalFlashUrls?.length&&(t.ExperimentalFlashUrls=e.ExperimentalFlashUrls),e.supportedInputFormats?.length&&(t.supportedInputFormats=e.supportedInputFormats.map((e=>dataFormatToJSON(e)))),e.supportedOutputFormats?.length&&(t.supportedOutputFormats=e.supportedOutputFormats.map((e=>dataFormatToJSON(e)))),t},create:e=>FunctionHandleMetadata.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionHandleMetadata();return t.functionName=e.functionName??"",t.functionType=e.functionType??0,t.webUrl=e.webUrl??"",t.isMethod=e.isMethod??!1,t.useFunctionId=e.useFunctionId??"",t.useMethodName=e.useMethodName??"",t.definitionId=e.definitionId??"",t.classParameterInfo=void 0!==e.classParameterInfo&&null!==e.classParameterInfo?ClassParameterInfo.fromPartial(e.classParameterInfo):void 0,t.methodHandleMetadata=Object.entries(e.methodHandleMetadata??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=FunctionHandleMetadata.fromPartial(n)),e)),{}),t.functionSchema=void 0!==e.functionSchema&&null!==e.functionSchema?FunctionSchema.fromPartial(e.functionSchema):void 0,t.inputPlaneUrl=e.inputPlaneUrl??void 0,t.inputPlaneRegion=e.inputPlaneRegion??void 0,t.maxObjectSizeBytes=e.maxObjectSizeBytes??void 0,t.ExperimentalFlashUrls=e.ExperimentalFlashUrls?.map((e=>e))||[],t.supportedInputFormats=e.supportedInputFormats?.map((e=>e))||[],t.supportedOutputFormats=e.supportedOutputFormats?.map((e=>e))||[],t}};function createBaseFunctionHandleMetadata_MethodHandleMetadataEntry(){return{key:"",value:void 0}}var FunctionHandleMetadata_MethodHandleMetadataEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),void 0!==e.value&&FunctionHandleMetadata.encode(e.value,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionHandleMetadata_MethodHandleMetadataEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=FunctionHandleMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?FunctionHandleMetadata.fromJSON(e.value):void 0}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),void 0!==e.value&&(t.value=FunctionHandleMetadata.toJSON(e.value)),t},create:e=>FunctionHandleMetadata_MethodHandleMetadataEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionHandleMetadata_MethodHandleMetadataEntry();return t.key=e.key??"",t.value=void 0!==e.value&&null!==e.value?FunctionHandleMetadata.fromPartial(e.value):void 0,t}};function createBaseFunctionInput(){return{args:void 0,argsBlobId:void 0,finalInput:!1,dataFormat:0,methodName:void 0}}var FunctionInput={encode:(e,t=new BinaryWriter)=>(void 0!==e.args&&t.uint32(10).bytes(e.args),void 0!==e.argsBlobId&&t.uint32(58).string(e.argsBlobId),!1!==e.finalInput&&t.uint32(72).bool(e.finalInput),0!==e.dataFormat&&t.uint32(80).int32(e.dataFormat),void 0!==e.methodName&&t.uint32(90).string(e.methodName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionInput();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.args=n.bytes();continue;case 7:if(58!==e)break;a.argsBlobId=n.string();continue;case 9:if(72!==e)break;a.finalInput=n.bool();continue;case 10:if(80!==e)break;a.dataFormat=n.int32();continue;case 11:if(90!==e)break;a.methodName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({args:isSet4(e.args)?bytesFromBase64(e.args):void 0,argsBlobId:isSet4(e.argsBlobId)?globalThis.String(e.argsBlobId):void 0,finalInput:!!isSet4(e.finalInput)&&globalThis.Boolean(e.finalInput),dataFormat:isSet4(e.dataFormat)?dataFormatFromJSON(e.dataFormat):0,methodName:isSet4(e.methodName)?globalThis.String(e.methodName):void 0}),toJSON(e){const t={};return void 0!==e.args&&(t.args=base64FromBytes(e.args)),void 0!==e.argsBlobId&&(t.argsBlobId=e.argsBlobId),!1!==e.finalInput&&(t.finalInput=e.finalInput),0!==e.dataFormat&&(t.dataFormat=dataFormatToJSON(e.dataFormat)),void 0!==e.methodName&&(t.methodName=e.methodName),t},create:e=>FunctionInput.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionInput();return t.args=e.args??void 0,t.argsBlobId=e.argsBlobId??void 0,t.finalInput=e.finalInput??!1,t.dataFormat=e.dataFormat??0,t.methodName=e.methodName??void 0,t}};function createBaseFunctionMapRequest(){return{functionId:"",parentInputId:"",returnExceptions:!1,functionCallType:0,pipelinedInputs:[],functionCallInvocationType:0,fromSpawnMap:!1}}var FunctionMapRequest={encode(e,t=new BinaryWriter){""!==e.functionId&&t.uint32(10).string(e.functionId),""!==e.parentInputId&&t.uint32(18).string(e.parentInputId),!1!==e.returnExceptions&&t.uint32(24).bool(e.returnExceptions),0!==e.functionCallType&&t.uint32(32).int32(e.functionCallType);for(const n of e.pipelinedInputs)FunctionPutInputsItem.encode(n,t.uint32(42).fork()).join();return 0!==e.functionCallInvocationType&&t.uint32(48).int32(e.functionCallInvocationType),!1!==e.fromSpawnMap&&t.uint32(56).bool(e.fromSpawnMap),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionMapRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(18!==e)break;a.parentInputId=n.string();continue;case 3:if(24!==e)break;a.returnExceptions=n.bool();continue;case 4:if(32!==e)break;a.functionCallType=n.int32();continue;case 5:if(42!==e)break;a.pipelinedInputs.push(FunctionPutInputsItem.decode(n,n.uint32()));continue;case 6:if(48!==e)break;a.functionCallInvocationType=n.int32();continue;case 7:if(56!==e)break;a.fromSpawnMap=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",parentInputId:isSet4(e.parentInputId)?globalThis.String(e.parentInputId):"",returnExceptions:!!isSet4(e.returnExceptions)&&globalThis.Boolean(e.returnExceptions),functionCallType:isSet4(e.functionCallType)?functionCallTypeFromJSON(e.functionCallType):0,pipelinedInputs:globalThis.Array.isArray(e?.pipelinedInputs)?e.pipelinedInputs.map((e=>FunctionPutInputsItem.fromJSON(e))):[],functionCallInvocationType:isSet4(e.functionCallInvocationType)?functionCallInvocationTypeFromJSON(e.functionCallInvocationType):0,fromSpawnMap:!!isSet4(e.fromSpawnMap)&&globalThis.Boolean(e.fromSpawnMap)}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),""!==e.parentInputId&&(t.parentInputId=e.parentInputId),!1!==e.returnExceptions&&(t.returnExceptions=e.returnExceptions),0!==e.functionCallType&&(t.functionCallType=functionCallTypeToJSON(e.functionCallType)),e.pipelinedInputs?.length&&(t.pipelinedInputs=e.pipelinedInputs.map((e=>FunctionPutInputsItem.toJSON(e)))),0!==e.functionCallInvocationType&&(t.functionCallInvocationType=functionCallInvocationTypeToJSON(e.functionCallInvocationType)),!1!==e.fromSpawnMap&&(t.fromSpawnMap=e.fromSpawnMap),t},create:e=>FunctionMapRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionMapRequest();return t.functionId=e.functionId??"",t.parentInputId=e.parentInputId??"",t.returnExceptions=e.returnExceptions??!1,t.functionCallType=e.functionCallType??0,t.pipelinedInputs=e.pipelinedInputs?.map((e=>FunctionPutInputsItem.fromPartial(e)))||[],t.functionCallInvocationType=e.functionCallInvocationType??0,t.fromSpawnMap=e.fromSpawnMap??!1,t}};function createBaseFunctionMapResponse(){return{functionCallId:"",pipelinedInputs:[],retryPolicy:void 0,functionCallJwt:"",syncClientRetriesEnabled:!1,maxInputsOutstanding:0}}var FunctionMapResponse={encode(e,t=new BinaryWriter){""!==e.functionCallId&&t.uint32(10).string(e.functionCallId);for(const n of e.pipelinedInputs)FunctionPutInputsResponseItem.encode(n,t.uint32(18).fork()).join();return void 0!==e.retryPolicy&&FunctionRetryPolicy.encode(e.retryPolicy,t.uint32(26).fork()).join(),""!==e.functionCallJwt&&t.uint32(34).string(e.functionCallJwt),!1!==e.syncClientRetriesEnabled&&t.uint32(40).bool(e.syncClientRetriesEnabled),0!==e.maxInputsOutstanding&&t.uint32(48).uint32(e.maxInputsOutstanding),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionMapResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionCallId=n.string();continue;case 2:if(18!==e)break;a.pipelinedInputs.push(FunctionPutInputsResponseItem.decode(n,n.uint32()));continue;case 3:if(26!==e)break;a.retryPolicy=FunctionRetryPolicy.decode(n,n.uint32());continue;case 4:if(34!==e)break;a.functionCallJwt=n.string();continue;case 5:if(40!==e)break;a.syncClientRetriesEnabled=n.bool();continue;case 6:if(48!==e)break;a.maxInputsOutstanding=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",pipelinedInputs:globalThis.Array.isArray(e?.pipelinedInputs)?e.pipelinedInputs.map((e=>FunctionPutInputsResponseItem.fromJSON(e))):[],retryPolicy:isSet4(e.retryPolicy)?FunctionRetryPolicy.fromJSON(e.retryPolicy):void 0,functionCallJwt:isSet4(e.functionCallJwt)?globalThis.String(e.functionCallJwt):"",syncClientRetriesEnabled:!!isSet4(e.syncClientRetriesEnabled)&&globalThis.Boolean(e.syncClientRetriesEnabled),maxInputsOutstanding:isSet4(e.maxInputsOutstanding)?globalThis.Number(e.maxInputsOutstanding):0}),toJSON(e){const t={};return""!==e.functionCallId&&(t.functionCallId=e.functionCallId),e.pipelinedInputs?.length&&(t.pipelinedInputs=e.pipelinedInputs.map((e=>FunctionPutInputsResponseItem.toJSON(e)))),void 0!==e.retryPolicy&&(t.retryPolicy=FunctionRetryPolicy.toJSON(e.retryPolicy)),""!==e.functionCallJwt&&(t.functionCallJwt=e.functionCallJwt),!1!==e.syncClientRetriesEnabled&&(t.syncClientRetriesEnabled=e.syncClientRetriesEnabled),0!==e.maxInputsOutstanding&&(t.maxInputsOutstanding=Math.round(e.maxInputsOutstanding)),t},create:e=>FunctionMapResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionMapResponse();return t.functionCallId=e.functionCallId??"",t.pipelinedInputs=e.pipelinedInputs?.map((e=>FunctionPutInputsResponseItem.fromPartial(e)))||[],t.retryPolicy=void 0!==e.retryPolicy&&null!==e.retryPolicy?FunctionRetryPolicy.fromPartial(e.retryPolicy):void 0,t.functionCallJwt=e.functionCallJwt??"",t.syncClientRetriesEnabled=e.syncClientRetriesEnabled??!1,t.maxInputsOutstanding=e.maxInputsOutstanding??0,t}};function createBaseFunctionOptions(){return{secretIds:[],mountIds:[],resources:void 0,retryPolicy:void 0,concurrencyLimit:void 0,timeoutSecs:void 0,taskIdleTimeoutSecs:void 0,warmPoolSize:void 0,volumeMounts:[],targetConcurrentInputs:void 0,replaceVolumeMounts:!1,replaceSecretIds:!1,bufferContainers:void 0,maxConcurrentInputs:void 0,batchMaxSize:void 0,batchLingerMs:void 0,schedulerPlacement:void 0,cloudProviderStr:void 0,replaceCloudBucketMounts:!1,cloudBucketMounts:[]}}var FunctionOptions={encode(e,t=new BinaryWriter){for(const n of e.secretIds)t.uint32(10).string(n);for(const n of e.mountIds)t.uint32(18).string(n);void 0!==e.resources&&Resources.encode(e.resources,t.uint32(26).fork()).join(),void 0!==e.retryPolicy&&FunctionRetryPolicy.encode(e.retryPolicy,t.uint32(34).fork()).join(),void 0!==e.concurrencyLimit&&t.uint32(40).uint32(e.concurrencyLimit),void 0!==e.timeoutSecs&&t.uint32(48).uint32(e.timeoutSecs),void 0!==e.taskIdleTimeoutSecs&&t.uint32(56).uint32(e.taskIdleTimeoutSecs),void 0!==e.warmPoolSize&&t.uint32(64).uint32(e.warmPoolSize);for(const n of e.volumeMounts)VolumeMount.encode(n,t.uint32(74).fork()).join();void 0!==e.targetConcurrentInputs&&t.uint32(80).uint32(e.targetConcurrentInputs),!1!==e.replaceVolumeMounts&&t.uint32(88).bool(e.replaceVolumeMounts),!1!==e.replaceSecretIds&&t.uint32(96).bool(e.replaceSecretIds),void 0!==e.bufferContainers&&t.uint32(104).uint32(e.bufferContainers),void 0!==e.maxConcurrentInputs&&t.uint32(112).uint32(e.maxConcurrentInputs),void 0!==e.batchMaxSize&&t.uint32(120).uint32(e.batchMaxSize),void 0!==e.batchLingerMs&&t.uint32(128).uint64(e.batchLingerMs),void 0!==e.schedulerPlacement&&SchedulerPlacement.encode(e.schedulerPlacement,t.uint32(138).fork()).join(),void 0!==e.cloudProviderStr&&t.uint32(146).string(e.cloudProviderStr),!1!==e.replaceCloudBucketMounts&&t.uint32(152).bool(e.replaceCloudBucketMounts);for(const n of e.cloudBucketMounts)CloudBucketMount.encode(n,t.uint32(162).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionOptions();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.secretIds.push(n.string());continue;case 2:if(18!==e)break;a.mountIds.push(n.string());continue;case 3:if(26!==e)break;a.resources=Resources.decode(n,n.uint32());continue;case 4:if(34!==e)break;a.retryPolicy=FunctionRetryPolicy.decode(n,n.uint32());continue;case 5:if(40!==e)break;a.concurrencyLimit=n.uint32();continue;case 6:if(48!==e)break;a.timeoutSecs=n.uint32();continue;case 7:if(56!==e)break;a.taskIdleTimeoutSecs=n.uint32();continue;case 8:if(64!==e)break;a.warmPoolSize=n.uint32();continue;case 9:if(74!==e)break;a.volumeMounts.push(VolumeMount.decode(n,n.uint32()));continue;case 10:if(80!==e)break;a.targetConcurrentInputs=n.uint32();continue;case 11:if(88!==e)break;a.replaceVolumeMounts=n.bool();continue;case 12:if(96!==e)break;a.replaceSecretIds=n.bool();continue;case 13:if(104!==e)break;a.bufferContainers=n.uint32();continue;case 14:if(112!==e)break;a.maxConcurrentInputs=n.uint32();continue;case 15:if(120!==e)break;a.batchMaxSize=n.uint32();continue;case 16:if(128!==e)break;a.batchLingerMs=longToNumber2(n.uint64());continue;case 17:if(138!==e)break;a.schedulerPlacement=SchedulerPlacement.decode(n,n.uint32());continue;case 18:if(146!==e)break;a.cloudProviderStr=n.string();continue;case 19:if(152!==e)break;a.replaceCloudBucketMounts=n.bool();continue;case 20:if(162!==e)break;a.cloudBucketMounts.push(CloudBucketMount.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({secretIds:globalThis.Array.isArray(e?.secretIds)?e.secretIds.map((e=>globalThis.String(e))):[],mountIds:globalThis.Array.isArray(e?.mountIds)?e.mountIds.map((e=>globalThis.String(e))):[],resources:isSet4(e.resources)?Resources.fromJSON(e.resources):void 0,retryPolicy:isSet4(e.retryPolicy)?FunctionRetryPolicy.fromJSON(e.retryPolicy):void 0,concurrencyLimit:isSet4(e.concurrencyLimit)?globalThis.Number(e.concurrencyLimit):void 0,timeoutSecs:isSet4(e.timeoutSecs)?globalThis.Number(e.timeoutSecs):void 0,taskIdleTimeoutSecs:isSet4(e.taskIdleTimeoutSecs)?globalThis.Number(e.taskIdleTimeoutSecs):void 0,warmPoolSize:isSet4(e.warmPoolSize)?globalThis.Number(e.warmPoolSize):void 0,volumeMounts:globalThis.Array.isArray(e?.volumeMounts)?e.volumeMounts.map((e=>VolumeMount.fromJSON(e))):[],targetConcurrentInputs:isSet4(e.targetConcurrentInputs)?globalThis.Number(e.targetConcurrentInputs):void 0,replaceVolumeMounts:!!isSet4(e.replaceVolumeMounts)&&globalThis.Boolean(e.replaceVolumeMounts),replaceSecretIds:!!isSet4(e.replaceSecretIds)&&globalThis.Boolean(e.replaceSecretIds),bufferContainers:isSet4(e.bufferContainers)?globalThis.Number(e.bufferContainers):void 0,maxConcurrentInputs:isSet4(e.maxConcurrentInputs)?globalThis.Number(e.maxConcurrentInputs):void 0,batchMaxSize:isSet4(e.batchMaxSize)?globalThis.Number(e.batchMaxSize):void 0,batchLingerMs:isSet4(e.batchLingerMs)?globalThis.Number(e.batchLingerMs):void 0,schedulerPlacement:isSet4(e.schedulerPlacement)?SchedulerPlacement.fromJSON(e.schedulerPlacement):void 0,cloudProviderStr:isSet4(e.cloudProviderStr)?globalThis.String(e.cloudProviderStr):void 0,replaceCloudBucketMounts:!!isSet4(e.replaceCloudBucketMounts)&&globalThis.Boolean(e.replaceCloudBucketMounts),cloudBucketMounts:globalThis.Array.isArray(e?.cloudBucketMounts)?e.cloudBucketMounts.map((e=>CloudBucketMount.fromJSON(e))):[]}),toJSON(e){const t={};return e.secretIds?.length&&(t.secretIds=e.secretIds),e.mountIds?.length&&(t.mountIds=e.mountIds),void 0!==e.resources&&(t.resources=Resources.toJSON(e.resources)),void 0!==e.retryPolicy&&(t.retryPolicy=FunctionRetryPolicy.toJSON(e.retryPolicy)),void 0!==e.concurrencyLimit&&(t.concurrencyLimit=Math.round(e.concurrencyLimit)),void 0!==e.timeoutSecs&&(t.timeoutSecs=Math.round(e.timeoutSecs)),void 0!==e.taskIdleTimeoutSecs&&(t.taskIdleTimeoutSecs=Math.round(e.taskIdleTimeoutSecs)),void 0!==e.warmPoolSize&&(t.warmPoolSize=Math.round(e.warmPoolSize)),e.volumeMounts?.length&&(t.volumeMounts=e.volumeMounts.map((e=>VolumeMount.toJSON(e)))),void 0!==e.targetConcurrentInputs&&(t.targetConcurrentInputs=Math.round(e.targetConcurrentInputs)),!1!==e.replaceVolumeMounts&&(t.replaceVolumeMounts=e.replaceVolumeMounts),!1!==e.replaceSecretIds&&(t.replaceSecretIds=e.replaceSecretIds),void 0!==e.bufferContainers&&(t.bufferContainers=Math.round(e.bufferContainers)),void 0!==e.maxConcurrentInputs&&(t.maxConcurrentInputs=Math.round(e.maxConcurrentInputs)),void 0!==e.batchMaxSize&&(t.batchMaxSize=Math.round(e.batchMaxSize)),void 0!==e.batchLingerMs&&(t.batchLingerMs=Math.round(e.batchLingerMs)),void 0!==e.schedulerPlacement&&(t.schedulerPlacement=SchedulerPlacement.toJSON(e.schedulerPlacement)),void 0!==e.cloudProviderStr&&(t.cloudProviderStr=e.cloudProviderStr),!1!==e.replaceCloudBucketMounts&&(t.replaceCloudBucketMounts=e.replaceCloudBucketMounts),e.cloudBucketMounts?.length&&(t.cloudBucketMounts=e.cloudBucketMounts.map((e=>CloudBucketMount.toJSON(e)))),t},create:e=>FunctionOptions.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionOptions();return t.secretIds=e.secretIds?.map((e=>e))||[],t.mountIds=e.mountIds?.map((e=>e))||[],t.resources=void 0!==e.resources&&null!==e.resources?Resources.fromPartial(e.resources):void 0,t.retryPolicy=void 0!==e.retryPolicy&&null!==e.retryPolicy?FunctionRetryPolicy.fromPartial(e.retryPolicy):void 0,t.concurrencyLimit=e.concurrencyLimit??void 0,t.timeoutSecs=e.timeoutSecs??void 0,t.taskIdleTimeoutSecs=e.taskIdleTimeoutSecs??void 0,t.warmPoolSize=e.warmPoolSize??void 0,t.volumeMounts=e.volumeMounts?.map((e=>VolumeMount.fromPartial(e)))||[],t.targetConcurrentInputs=e.targetConcurrentInputs??void 0,t.replaceVolumeMounts=e.replaceVolumeMounts??!1,t.replaceSecretIds=e.replaceSecretIds??!1,t.bufferContainers=e.bufferContainers??void 0,t.maxConcurrentInputs=e.maxConcurrentInputs??void 0,t.batchMaxSize=e.batchMaxSize??void 0,t.batchLingerMs=e.batchLingerMs??void 0,t.schedulerPlacement=void 0!==e.schedulerPlacement&&null!==e.schedulerPlacement?SchedulerPlacement.fromPartial(e.schedulerPlacement):void 0,t.cloudProviderStr=e.cloudProviderStr??void 0,t.replaceCloudBucketMounts=e.replaceCloudBucketMounts??!1,t.cloudBucketMounts=e.cloudBucketMounts?.map((e=>CloudBucketMount.fromPartial(e)))||[],t}};function createBaseFunctionPrecreateRequest(){return{appId:"",functionName:"",existingFunctionId:"",functionType:0,webhookConfig:void 0,useFunctionId:"",useMethodName:"",methodDefinitions:{},functionSchema:void 0,supportedInputFormats:[],supportedOutputFormats:[]}}var FunctionPrecreateRequest={encode(e,t=new BinaryWriter){""!==e.appId&&t.uint32(10).string(e.appId),""!==e.functionName&&t.uint32(18).string(e.functionName),""!==e.existingFunctionId&&t.uint32(26).string(e.existingFunctionId),0!==e.functionType&&t.uint32(32).int32(e.functionType),void 0!==e.webhookConfig&&WebhookConfig.encode(e.webhookConfig,t.uint32(42).fork()).join(),""!==e.useFunctionId&&t.uint32(50).string(e.useFunctionId),""!==e.useMethodName&&t.uint32(58).string(e.useMethodName),Object.entries(e.methodDefinitions).forEach((([e,n])=>{FunctionPrecreateRequest_MethodDefinitionsEntry.encode({key:e,value:n},t.uint32(66).fork()).join()})),void 0!==e.functionSchema&&FunctionSchema.encode(e.functionSchema,t.uint32(74).fork()).join(),t.uint32(82).fork();for(const n of e.supportedInputFormats)t.int32(n);t.join(),t.uint32(90).fork();for(const n of e.supportedOutputFormats)t.int32(n);return t.join(),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionPrecreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(18!==e)break;a.functionName=n.string();continue;case 3:if(26!==e)break;a.existingFunctionId=n.string();continue;case 4:if(32!==e)break;a.functionType=n.int32();continue;case 5:if(42!==e)break;a.webhookConfig=WebhookConfig.decode(n,n.uint32());continue;case 6:if(50!==e)break;a.useFunctionId=n.string();continue;case 7:if(58!==e)break;a.useMethodName=n.string();continue;case 8:{if(66!==e)break;const t=FunctionPrecreateRequest_MethodDefinitionsEntry.decode(n,n.uint32());void 0!==t.value&&(a.methodDefinitions[t.key]=t.value);continue}case 9:if(74!==e)break;a.functionSchema=FunctionSchema.decode(n,n.uint32());continue;case 10:if(80===e){a.supportedInputFormats.push(n.int32());continue}if(82===e){const e=n.uint32()+n.pos;for(;n.pos<e;)a.supportedInputFormats.push(n.int32());continue}break;case 11:if(88===e){a.supportedOutputFormats.push(n.int32());continue}if(90===e){const e=n.uint32()+n.pos;for(;n.pos<e;)a.supportedOutputFormats.push(n.int32());continue}}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",functionName:isSet4(e.functionName)?globalThis.String(e.functionName):"",existingFunctionId:isSet4(e.existingFunctionId)?globalThis.String(e.existingFunctionId):"",functionType:isSet4(e.functionType)?function_FunctionTypeFromJSON(e.functionType):0,webhookConfig:isSet4(e.webhookConfig)?WebhookConfig.fromJSON(e.webhookConfig):void 0,useFunctionId:isSet4(e.useFunctionId)?globalThis.String(e.useFunctionId):"",useMethodName:isSet4(e.useMethodName)?globalThis.String(e.useMethodName):"",methodDefinitions:isObject2(e.methodDefinitions)?Object.entries(e.methodDefinitions).reduce(((e,[t,n])=>(e[t]=MethodDefinition.fromJSON(n),e)),{}):{},functionSchema:isSet4(e.functionSchema)?FunctionSchema.fromJSON(e.functionSchema):void 0,supportedInputFormats:globalThis.Array.isArray(e?.supportedInputFormats)?e.supportedInputFormats.map((e=>dataFormatFromJSON(e))):[],supportedOutputFormats:globalThis.Array.isArray(e?.supportedOutputFormats)?e.supportedOutputFormats.map((e=>dataFormatFromJSON(e))):[]}),toJSON(e){const t={};if(""!==e.appId&&(t.appId=e.appId),""!==e.functionName&&(t.functionName=e.functionName),""!==e.existingFunctionId&&(t.existingFunctionId=e.existingFunctionId),0!==e.functionType&&(t.functionType=function_FunctionTypeToJSON(e.functionType)),void 0!==e.webhookConfig&&(t.webhookConfig=WebhookConfig.toJSON(e.webhookConfig)),""!==e.useFunctionId&&(t.useFunctionId=e.useFunctionId),""!==e.useMethodName&&(t.useMethodName=e.useMethodName),e.methodDefinitions){const n=Object.entries(e.methodDefinitions);n.length>0&&(t.methodDefinitions={},n.forEach((([e,n])=>{t.methodDefinitions[e]=MethodDefinition.toJSON(n)})))}return void 0!==e.functionSchema&&(t.functionSchema=FunctionSchema.toJSON(e.functionSchema)),e.supportedInputFormats?.length&&(t.supportedInputFormats=e.supportedInputFormats.map((e=>dataFormatToJSON(e)))),e.supportedOutputFormats?.length&&(t.supportedOutputFormats=e.supportedOutputFormats.map((e=>dataFormatToJSON(e)))),t},create:e=>FunctionPrecreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionPrecreateRequest();return t.appId=e.appId??"",t.functionName=e.functionName??"",t.existingFunctionId=e.existingFunctionId??"",t.functionType=e.functionType??0,t.webhookConfig=void 0!==e.webhookConfig&&null!==e.webhookConfig?WebhookConfig.fromPartial(e.webhookConfig):void 0,t.useFunctionId=e.useFunctionId??"",t.useMethodName=e.useMethodName??"",t.methodDefinitions=Object.entries(e.methodDefinitions??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=MethodDefinition.fromPartial(n)),e)),{}),t.functionSchema=void 0!==e.functionSchema&&null!==e.functionSchema?FunctionSchema.fromPartial(e.functionSchema):void 0,t.supportedInputFormats=e.supportedInputFormats?.map((e=>e))||[],t.supportedOutputFormats=e.supportedOutputFormats?.map((e=>e))||[],t}};function createBaseFunctionPrecreateRequest_MethodDefinitionsEntry(){return{key:"",value:void 0}}var FunctionPrecreateRequest_MethodDefinitionsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),void 0!==e.value&&MethodDefinition.encode(e.value,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionPrecreateRequest_MethodDefinitionsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=MethodDefinition.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?MethodDefinition.fromJSON(e.value):void 0}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),void 0!==e.value&&(t.value=MethodDefinition.toJSON(e.value)),t},create:e=>FunctionPrecreateRequest_MethodDefinitionsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionPrecreateRequest_MethodDefinitionsEntry();return t.key=e.key??"",t.value=void 0!==e.value&&null!==e.value?MethodDefinition.fromPartial(e.value):void 0,t}};function createBaseFunctionPrecreateResponse(){return{functionId:"",handleMetadata:void 0}}var FunctionPrecreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),void 0!==e.handleMetadata&&FunctionHandleMetadata.encode(e.handleMetadata,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionPrecreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(18!==e)break;a.handleMetadata=FunctionHandleMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",handleMetadata:isSet4(e.handleMetadata)?FunctionHandleMetadata.fromJSON(e.handleMetadata):void 0}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),void 0!==e.handleMetadata&&(t.handleMetadata=FunctionHandleMetadata.toJSON(e.handleMetadata)),t},create:e=>FunctionPrecreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionPrecreateResponse();return t.functionId=e.functionId??"",t.handleMetadata=void 0!==e.handleMetadata&&null!==e.handleMetadata?FunctionHandleMetadata.fromPartial(e.handleMetadata):void 0,t}};function createBaseFunctionPutInputsItem(){return{idx:0,input:void 0,r2Failed:!1,r2ThroughputBytesS:0}}var FunctionPutInputsItem={encode:(e,t=new BinaryWriter)=>(0!==e.idx&&t.uint32(8).int32(e.idx),void 0!==e.input&&FunctionInput.encode(e.input,t.uint32(18).fork()).join(),!1!==e.r2Failed&&t.uint32(24).bool(e.r2Failed),0!==e.r2ThroughputBytesS&&t.uint32(40).uint64(e.r2ThroughputBytesS),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionPutInputsItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.idx=n.int32();continue;case 2:if(18!==e)break;a.input=FunctionInput.decode(n,n.uint32());continue;case 3:if(24!==e)break;a.r2Failed=n.bool();continue;case 5:if(40!==e)break;a.r2ThroughputBytesS=longToNumber2(n.uint64());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({idx:isSet4(e.idx)?globalThis.Number(e.idx):0,input:isSet4(e.input)?FunctionInput.fromJSON(e.input):void 0,r2Failed:!!isSet4(e.r2Failed)&&globalThis.Boolean(e.r2Failed),r2ThroughputBytesS:isSet4(e.r2ThroughputBytesS)?globalThis.Number(e.r2ThroughputBytesS):0}),toJSON(e){const t={};return 0!==e.idx&&(t.idx=Math.round(e.idx)),void 0!==e.input&&(t.input=FunctionInput.toJSON(e.input)),!1!==e.r2Failed&&(t.r2Failed=e.r2Failed),0!==e.r2ThroughputBytesS&&(t.r2ThroughputBytesS=Math.round(e.r2ThroughputBytesS)),t},create:e=>FunctionPutInputsItem.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionPutInputsItem();return t.idx=e.idx??0,t.input=void 0!==e.input&&null!==e.input?FunctionInput.fromPartial(e.input):void 0,t.r2Failed=e.r2Failed??!1,t.r2ThroughputBytesS=e.r2ThroughputBytesS??0,t}};function createBaseFunctionPutInputsRequest(){return{functionId:"",functionCallId:"",inputs:[]}}var FunctionPutInputsRequest={encode(e,t=new BinaryWriter){""!==e.functionId&&t.uint32(10).string(e.functionId),""!==e.functionCallId&&t.uint32(26).string(e.functionCallId);for(const n of e.inputs)FunctionPutInputsItem.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionPutInputsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 3:if(26!==e)break;a.functionCallId=n.string();continue;case 4:if(34!==e)break;a.inputs.push(FunctionPutInputsItem.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",inputs:globalThis.Array.isArray(e?.inputs)?e.inputs.map((e=>FunctionPutInputsItem.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),""!==e.functionCallId&&(t.functionCallId=e.functionCallId),e.inputs?.length&&(t.inputs=e.inputs.map((e=>FunctionPutInputsItem.toJSON(e)))),t},create:e=>FunctionPutInputsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionPutInputsRequest();return t.functionId=e.functionId??"",t.functionCallId=e.functionCallId??"",t.inputs=e.inputs?.map((e=>FunctionPutInputsItem.fromPartial(e)))||[],t}};function createBaseFunctionPutInputsResponse(){return{inputs:[]}}var FunctionPutInputsResponse={encode(e,t=new BinaryWriter){for(const n of e.inputs)FunctionPutInputsResponseItem.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionPutInputsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.inputs.push(FunctionPutInputsResponseItem.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({inputs:globalThis.Array.isArray(e?.inputs)?e.inputs.map((e=>FunctionPutInputsResponseItem.fromJSON(e))):[]}),toJSON(e){const t={};return e.inputs?.length&&(t.inputs=e.inputs.map((e=>FunctionPutInputsResponseItem.toJSON(e)))),t},create:e=>FunctionPutInputsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionPutInputsResponse();return t.inputs=e.inputs?.map((e=>FunctionPutInputsResponseItem.fromPartial(e)))||[],t}};function createBaseFunctionPutInputsResponseItem(){return{idx:0,inputId:"",inputJwt:""}}var FunctionPutInputsResponseItem={encode:(e,t=new BinaryWriter)=>(0!==e.idx&&t.uint32(8).int32(e.idx),""!==e.inputId&&t.uint32(18).string(e.inputId),""!==e.inputJwt&&t.uint32(26).string(e.inputJwt),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionPutInputsResponseItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.idx=n.int32();continue;case 2:if(18!==e)break;a.inputId=n.string();continue;case 3:if(26!==e)break;a.inputJwt=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({idx:isSet4(e.idx)?globalThis.Number(e.idx):0,inputId:isSet4(e.inputId)?globalThis.String(e.inputId):"",inputJwt:isSet4(e.inputJwt)?globalThis.String(e.inputJwt):""}),toJSON(e){const t={};return 0!==e.idx&&(t.idx=Math.round(e.idx)),""!==e.inputId&&(t.inputId=e.inputId),""!==e.inputJwt&&(t.inputJwt=e.inputJwt),t},create:e=>FunctionPutInputsResponseItem.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionPutInputsResponseItem();return t.idx=e.idx??0,t.inputId=e.inputId??"",t.inputJwt=e.inputJwt??"",t}};function createBaseFunctionPutOutputsItem(){return{inputId:"",result:void 0,inputStartedAt:0,outputCreatedAt:0,dataFormat:0,retryCount:0,functionCallId:"",functionMapIdx:void 0}}var FunctionPutOutputsItem={encode:(e,t=new BinaryWriter)=>(""!==e.inputId&&t.uint32(10).string(e.inputId),void 0!==e.result&&GenericResult.encode(e.result,t.uint32(18).fork()).join(),0!==e.inputStartedAt&&t.uint32(25).double(e.inputStartedAt),0!==e.outputCreatedAt&&t.uint32(33).double(e.outputCreatedAt),0!==e.dataFormat&&t.uint32(56).int32(e.dataFormat),0!==e.retryCount&&t.uint32(64).uint32(e.retryCount),""!==e.functionCallId&&t.uint32(74).string(e.functionCallId),void 0!==e.functionMapIdx&&t.uint32(80).int32(e.functionMapIdx),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionPutOutputsItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.inputId=n.string();continue;case 2:if(18!==e)break;a.result=GenericResult.decode(n,n.uint32());continue;case 3:if(25!==e)break;a.inputStartedAt=n.double();continue;case 4:if(33!==e)break;a.outputCreatedAt=n.double();continue;case 7:if(56!==e)break;a.dataFormat=n.int32();continue;case 8:if(64!==e)break;a.retryCount=n.uint32();continue;case 9:if(74!==e)break;a.functionCallId=n.string();continue;case 10:if(80!==e)break;a.functionMapIdx=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({inputId:isSet4(e.inputId)?globalThis.String(e.inputId):"",result:isSet4(e.result)?GenericResult.fromJSON(e.result):void 0,inputStartedAt:isSet4(e.inputStartedAt)?globalThis.Number(e.inputStartedAt):0,outputCreatedAt:isSet4(e.outputCreatedAt)?globalThis.Number(e.outputCreatedAt):0,dataFormat:isSet4(e.dataFormat)?dataFormatFromJSON(e.dataFormat):0,retryCount:isSet4(e.retryCount)?globalThis.Number(e.retryCount):0,functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",functionMapIdx:isSet4(e.functionMapIdx)?globalThis.Number(e.functionMapIdx):void 0}),toJSON(e){const t={};return""!==e.inputId&&(t.inputId=e.inputId),void 0!==e.result&&(t.result=GenericResult.toJSON(e.result)),0!==e.inputStartedAt&&(t.inputStartedAt=e.inputStartedAt),0!==e.outputCreatedAt&&(t.outputCreatedAt=e.outputCreatedAt),0!==e.dataFormat&&(t.dataFormat=dataFormatToJSON(e.dataFormat)),0!==e.retryCount&&(t.retryCount=Math.round(e.retryCount)),""!==e.functionCallId&&(t.functionCallId=e.functionCallId),void 0!==e.functionMapIdx&&(t.functionMapIdx=Math.round(e.functionMapIdx)),t},create:e=>FunctionPutOutputsItem.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionPutOutputsItem();return t.inputId=e.inputId??"",t.result=void 0!==e.result&&null!==e.result?GenericResult.fromPartial(e.result):void 0,t.inputStartedAt=e.inputStartedAt??0,t.outputCreatedAt=e.outputCreatedAt??0,t.dataFormat=e.dataFormat??0,t.retryCount=e.retryCount??0,t.functionCallId=e.functionCallId??"",t.functionMapIdx=e.functionMapIdx??void 0,t}};function createBaseFunctionPutOutputsRequest(){return{outputs:[],requestedAt:0}}var FunctionPutOutputsRequest={encode(e,t=new BinaryWriter){for(const n of e.outputs)FunctionPutOutputsItem.encode(n,t.uint32(34).fork()).join();return 0!==e.requestedAt&&t.uint32(41).double(e.requestedAt),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionPutOutputsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 4:if(34!==e)break;a.outputs.push(FunctionPutOutputsItem.decode(n,n.uint32()));continue;case 5:if(41!==e)break;a.requestedAt=n.double();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({outputs:globalThis.Array.isArray(e?.outputs)?e.outputs.map((e=>FunctionPutOutputsItem.fromJSON(e))):[],requestedAt:isSet4(e.requestedAt)?globalThis.Number(e.requestedAt):0}),toJSON(e){const t={};return e.outputs?.length&&(t.outputs=e.outputs.map((e=>FunctionPutOutputsItem.toJSON(e)))),0!==e.requestedAt&&(t.requestedAt=e.requestedAt),t},create:e=>FunctionPutOutputsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionPutOutputsRequest();return t.outputs=e.outputs?.map((e=>FunctionPutOutputsItem.fromPartial(e)))||[],t.requestedAt=e.requestedAt??0,t}};function createBaseFunctionRetryInputsItem(){return{inputJwt:"",input:void 0,retryCount:0}}var FunctionRetryInputsItem={encode:(e,t=new BinaryWriter)=>(""!==e.inputJwt&&t.uint32(10).string(e.inputJwt),void 0!==e.input&&FunctionInput.encode(e.input,t.uint32(18).fork()).join(),0!==e.retryCount&&t.uint32(24).uint32(e.retryCount),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionRetryInputsItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.inputJwt=n.string();continue;case 2:if(18!==e)break;a.input=FunctionInput.decode(n,n.uint32());continue;case 3:if(24!==e)break;a.retryCount=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({inputJwt:isSet4(e.inputJwt)?globalThis.String(e.inputJwt):"",input:isSet4(e.input)?FunctionInput.fromJSON(e.input):void 0,retryCount:isSet4(e.retryCount)?globalThis.Number(e.retryCount):0}),toJSON(e){const t={};return""!==e.inputJwt&&(t.inputJwt=e.inputJwt),void 0!==e.input&&(t.input=FunctionInput.toJSON(e.input)),0!==e.retryCount&&(t.retryCount=Math.round(e.retryCount)),t},create:e=>FunctionRetryInputsItem.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionRetryInputsItem();return t.inputJwt=e.inputJwt??"",t.input=void 0!==e.input&&null!==e.input?FunctionInput.fromPartial(e.input):void 0,t.retryCount=e.retryCount??0,t}};function createBaseFunctionRetryInputsRequest(){return{functionCallJwt:"",inputs:[]}}var FunctionRetryInputsRequest={encode(e,t=new BinaryWriter){""!==e.functionCallJwt&&t.uint32(10).string(e.functionCallJwt);for(const n of e.inputs)FunctionRetryInputsItem.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionRetryInputsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionCallJwt=n.string();continue;case 2:if(18!==e)break;a.inputs.push(FunctionRetryInputsItem.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionCallJwt:isSet4(e.functionCallJwt)?globalThis.String(e.functionCallJwt):"",inputs:globalThis.Array.isArray(e?.inputs)?e.inputs.map((e=>FunctionRetryInputsItem.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.functionCallJwt&&(t.functionCallJwt=e.functionCallJwt),e.inputs?.length&&(t.inputs=e.inputs.map((e=>FunctionRetryInputsItem.toJSON(e)))),t},create:e=>FunctionRetryInputsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionRetryInputsRequest();return t.functionCallJwt=e.functionCallJwt??"",t.inputs=e.inputs?.map((e=>FunctionRetryInputsItem.fromPartial(e)))||[],t}};function createBaseFunctionRetryInputsResponse(){return{inputJwts:[]}}var FunctionRetryInputsResponse={encode(e,t=new BinaryWriter){for(const n of e.inputJwts)t.uint32(10).string(n);return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionRetryInputsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.inputJwts.push(n.string());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({inputJwts:globalThis.Array.isArray(e?.inputJwts)?e.inputJwts.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return e.inputJwts?.length&&(t.inputJwts=e.inputJwts),t},create:e=>FunctionRetryInputsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionRetryInputsResponse();return t.inputJwts=e.inputJwts?.map((e=>e))||[],t}};function createBaseFunctionRetryPolicy(){return{backoffCoefficient:0,initialDelayMs:0,maxDelayMs:0,retries:0}}var FunctionRetryPolicy={encode:(e,t=new BinaryWriter)=>(0!==e.backoffCoefficient&&t.uint32(13).float(e.backoffCoefficient),0!==e.initialDelayMs&&t.uint32(16).uint32(e.initialDelayMs),0!==e.maxDelayMs&&t.uint32(24).uint32(e.maxDelayMs),0!==e.retries&&t.uint32(144).uint32(e.retries),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionRetryPolicy();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(13!==e)break;a.backoffCoefficient=n.float();continue;case 2:if(16!==e)break;a.initialDelayMs=n.uint32();continue;case 3:if(24!==e)break;a.maxDelayMs=n.uint32();continue;case 18:if(144!==e)break;a.retries=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({backoffCoefficient:isSet4(e.backoffCoefficient)?globalThis.Number(e.backoffCoefficient):0,initialDelayMs:isSet4(e.initialDelayMs)?globalThis.Number(e.initialDelayMs):0,maxDelayMs:isSet4(e.maxDelayMs)?globalThis.Number(e.maxDelayMs):0,retries:isSet4(e.retries)?globalThis.Number(e.retries):0}),toJSON(e){const t={};return 0!==e.backoffCoefficient&&(t.backoffCoefficient=e.backoffCoefficient),0!==e.initialDelayMs&&(t.initialDelayMs=Math.round(e.initialDelayMs)),0!==e.maxDelayMs&&(t.maxDelayMs=Math.round(e.maxDelayMs)),0!==e.retries&&(t.retries=Math.round(e.retries)),t},create:e=>FunctionRetryPolicy.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionRetryPolicy();return t.backoffCoefficient=e.backoffCoefficient??0,t.initialDelayMs=e.initialDelayMs??0,t.maxDelayMs=e.maxDelayMs??0,t.retries=e.retries??0,t}};function createBaseFunctionSchema(){return{schemaType:0,arguments:[],returnType:void 0}}var FunctionSchema={encode(e,t=new BinaryWriter){0!==e.schemaType&&t.uint32(8).int32(e.schemaType);for(const n of e.arguments)ClassParameterSpec.encode(n,t.uint32(18).fork()).join();return void 0!==e.returnType&&GenericPayloadType.encode(e.returnType,t.uint32(26).fork()).join(),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionSchema();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.schemaType=n.int32();continue;case 2:if(18!==e)break;a.arguments.push(ClassParameterSpec.decode(n,n.uint32()));continue;case 3:if(26!==e)break;a.returnType=GenericPayloadType.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({schemaType:isSet4(e.schemaType)?functionSchema_FunctionSchemaTypeFromJSON(e.schemaType):0,arguments:globalThis.Array.isArray(e?.arguments)?e.arguments.map((e=>ClassParameterSpec.fromJSON(e))):[],returnType:isSet4(e.returnType)?GenericPayloadType.fromJSON(e.returnType):void 0}),toJSON(e){const t={};return 0!==e.schemaType&&(t.schemaType=functionSchema_FunctionSchemaTypeToJSON(e.schemaType)),e.arguments?.length&&(t.arguments=e.arguments.map((e=>ClassParameterSpec.toJSON(e)))),void 0!==e.returnType&&(t.returnType=GenericPayloadType.toJSON(e.returnType)),t},create:e=>FunctionSchema.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionSchema();return t.schemaType=e.schemaType??0,t.arguments=e.arguments?.map((e=>ClassParameterSpec.fromPartial(e)))||[],t.returnType=void 0!==e.returnType&&null!==e.returnType?GenericPayloadType.fromPartial(e.returnType):void 0,t}};function createBaseFunctionStats(){return{backlog:0,numTotalTasks:0,numRunningInputs:0}}var FunctionStats={encode:(e,t=new BinaryWriter)=>(0!==e.backlog&&t.uint32(8).uint32(e.backlog),0!==e.numTotalTasks&&t.uint32(24).uint32(e.numTotalTasks),0!==e.numRunningInputs&&t.uint32(32).uint32(e.numRunningInputs),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionStats();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.backlog=n.uint32();continue;case 3:if(24!==e)break;a.numTotalTasks=n.uint32();continue;case 4:if(32!==e)break;a.numRunningInputs=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({backlog:isSet4(e.backlog)?globalThis.Number(e.backlog):0,numTotalTasks:isSet4(e.numTotalTasks)?globalThis.Number(e.numTotalTasks):0,numRunningInputs:isSet4(e.numRunningInputs)?globalThis.Number(e.numRunningInputs):0}),toJSON(e){const t={};return 0!==e.backlog&&(t.backlog=Math.round(e.backlog)),0!==e.numTotalTasks&&(t.numTotalTasks=Math.round(e.numTotalTasks)),0!==e.numRunningInputs&&(t.numRunningInputs=Math.round(e.numRunningInputs)),t},create:e=>FunctionStats.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionStats();return t.backlog=e.backlog??0,t.numTotalTasks=e.numTotalTasks??0,t.numRunningInputs=e.numRunningInputs??0,t}};function createBaseFunctionUpdateSchedulingParamsRequest(){return{functionId:"",warmPoolSizeOverride:0,settings:void 0}}var FunctionUpdateSchedulingParamsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.functionId&&t.uint32(10).string(e.functionId),0!==e.warmPoolSizeOverride&&t.uint32(16).uint32(e.warmPoolSizeOverride),void 0!==e.settings&&AutoscalerSettings.encode(e.settings,t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionUpdateSchedulingParamsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(16!==e)break;a.warmPoolSizeOverride=n.uint32();continue;case 3:if(26!==e)break;a.settings=AutoscalerSettings.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",warmPoolSizeOverride:isSet4(e.warmPoolSizeOverride)?globalThis.Number(e.warmPoolSizeOverride):0,settings:isSet4(e.settings)?AutoscalerSettings.fromJSON(e.settings):void 0}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),0!==e.warmPoolSizeOverride&&(t.warmPoolSizeOverride=Math.round(e.warmPoolSizeOverride)),void 0!==e.settings&&(t.settings=AutoscalerSettings.toJSON(e.settings)),t},create:e=>FunctionUpdateSchedulingParamsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseFunctionUpdateSchedulingParamsRequest();return t.functionId=e.functionId??"",t.warmPoolSizeOverride=e.warmPoolSizeOverride??0,t.settings=void 0!==e.settings&&null!==e.settings?AutoscalerSettings.fromPartial(e.settings):void 0,t}};function createBaseFunctionUpdateSchedulingParamsResponse(){return{}}var FunctionUpdateSchedulingParamsResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseFunctionUpdateSchedulingParamsResponse();for(;n.pos<r;){const e=n.uint32();if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({}),toJSON:e=>({}),create:e=>FunctionUpdateSchedulingParamsResponse.fromPartial(e??{}),fromPartial:e=>createBaseFunctionUpdateSchedulingParamsResponse()};function createBaseGPUConfig(){return{type:0,count:0,gpuType:""}}var GPUConfig={encode:(e,t=new BinaryWriter)=>(0!==e.type&&t.uint32(8).int32(e.type),0!==e.count&&t.uint32(16).uint32(e.count),""!==e.gpuType&&t.uint32(34).string(e.gpuType),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseGPUConfig();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.type=n.int32();continue;case 2:if(16!==e)break;a.count=n.uint32();continue;case 4:if(34!==e)break;a.gpuType=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({type:isSet4(e.type)?gPUTypeFromJSON(e.type):0,count:isSet4(e.count)?globalThis.Number(e.count):0,gpuType:isSet4(e.gpuType)?globalThis.String(e.gpuType):""}),toJSON(e){const t={};return 0!==e.type&&(t.type=gPUTypeToJSON(e.type)),0!==e.count&&(t.count=Math.round(e.count)),""!==e.gpuType&&(t.gpuType=e.gpuType),t},create:e=>GPUConfig.fromPartial(e??{}),fromPartial(e){const t=createBaseGPUConfig();return t.type=e.type??0,t.count=e.count??0,t.gpuType=e.gpuType??"",t}};function createBaseGeneratorDone(){return{itemsTotal:0}}var GeneratorDone={encode:(e,t=new BinaryWriter)=>(0!==e.itemsTotal&&t.uint32(8).uint64(e.itemsTotal),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseGeneratorDone();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.itemsTotal=longToNumber2(n.uint64());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({itemsTotal:isSet4(e.itemsTotal)?globalThis.Number(e.itemsTotal):0}),toJSON(e){const t={};return 0!==e.itemsTotal&&(t.itemsTotal=Math.round(e.itemsTotal)),t},create:e=>GeneratorDone.fromPartial(e??{}),fromPartial(e){const t=createBaseGeneratorDone();return t.itemsTotal=e.itemsTotal??0,t}};function createBaseGenericPayloadType(){return{baseType:0,subTypes:[]}}var GenericPayloadType={encode(e,t=new BinaryWriter){0!==e.baseType&&t.uint32(8).int32(e.baseType);for(const n of e.subTypes)GenericPayloadType.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseGenericPayloadType();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.baseType=n.int32();continue;case 2:if(18!==e)break;a.subTypes.push(GenericPayloadType.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({baseType:isSet4(e.baseType)?parameterTypeFromJSON(e.baseType):0,subTypes:globalThis.Array.isArray(e?.subTypes)?e.subTypes.map((e=>GenericPayloadType.fromJSON(e))):[]}),toJSON(e){const t={};return 0!==e.baseType&&(t.baseType=parameterTypeToJSON(e.baseType)),e.subTypes?.length&&(t.subTypes=e.subTypes.map((e=>GenericPayloadType.toJSON(e)))),t},create:e=>GenericPayloadType.fromPartial(e??{}),fromPartial(e){const t=createBaseGenericPayloadType();return t.baseType=e.baseType??0,t.subTypes=e.subTypes?.map((e=>GenericPayloadType.fromPartial(e)))||[],t}};function createBaseGenericResult(){return{status:0,exception:"",exitcode:0,traceback:"",serializedTb:new Uint8Array(0),tbLineCache:new Uint8Array(0),data:void 0,dataBlobId:void 0,propagationReason:""}}var GenericResult={encode:(e,t=new BinaryWriter)=>(0!==e.status&&t.uint32(8).int32(e.status),""!==e.exception&&t.uint32(18).string(e.exception),0!==e.exitcode&&t.uint32(24).int32(e.exitcode),""!==e.traceback&&t.uint32(34).string(e.traceback),0!==e.serializedTb.length&&t.uint32(90).bytes(e.serializedTb),0!==e.tbLineCache.length&&t.uint32(98).bytes(e.tbLineCache),void 0!==e.data&&t.uint32(42).bytes(e.data),void 0!==e.dataBlobId&&t.uint32(82).string(e.dataBlobId),""!==e.propagationReason&&t.uint32(106).string(e.propagationReason),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseGenericResult();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.status=n.int32();continue;case 2:if(18!==e)break;a.exception=n.string();continue;case 3:if(24!==e)break;a.exitcode=n.int32();continue;case 4:if(34!==e)break;a.traceback=n.string();continue;case 11:if(90!==e)break;a.serializedTb=n.bytes();continue;case 12:if(98!==e)break;a.tbLineCache=n.bytes();continue;case 5:if(42!==e)break;a.data=n.bytes();continue;case 10:if(82!==e)break;a.dataBlobId=n.string();continue;case 13:if(106!==e)break;a.propagationReason=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({status:isSet4(e.status)?genericResult_GenericStatusFromJSON(e.status):0,exception:isSet4(e.exception)?globalThis.String(e.exception):"",exitcode:isSet4(e.exitcode)?globalThis.Number(e.exitcode):0,traceback:isSet4(e.traceback)?globalThis.String(e.traceback):"",serializedTb:isSet4(e.serializedTb)?bytesFromBase64(e.serializedTb):new Uint8Array(0),tbLineCache:isSet4(e.tbLineCache)?bytesFromBase64(e.tbLineCache):new Uint8Array(0),data:isSet4(e.data)?bytesFromBase64(e.data):void 0,dataBlobId:isSet4(e.dataBlobId)?globalThis.String(e.dataBlobId):void 0,propagationReason:isSet4(e.propagationReason)?globalThis.String(e.propagationReason):""}),toJSON(e){const t={};return 0!==e.status&&(t.status=genericResult_GenericStatusToJSON(e.status)),""!==e.exception&&(t.exception=e.exception),0!==e.exitcode&&(t.exitcode=Math.round(e.exitcode)),""!==e.traceback&&(t.traceback=e.traceback),0!==e.serializedTb.length&&(t.serializedTb=base64FromBytes(e.serializedTb)),0!==e.tbLineCache.length&&(t.tbLineCache=base64FromBytes(e.tbLineCache)),void 0!==e.data&&(t.data=base64FromBytes(e.data)),void 0!==e.dataBlobId&&(t.dataBlobId=e.dataBlobId),""!==e.propagationReason&&(t.propagationReason=e.propagationReason),t},create:e=>GenericResult.fromPartial(e??{}),fromPartial(e){const t=createBaseGenericResult();return t.status=e.status??0,t.exception=e.exception??"",t.exitcode=e.exitcode??0,t.traceback=e.traceback??"",t.serializedTb=e.serializedTb??new Uint8Array(0),t.tbLineCache=e.tbLineCache??new Uint8Array(0),t.data=e.data??void 0,t.dataBlobId=e.dataBlobId??void 0,t.propagationReason=e.propagationReason??"",t}};function createBaseHTTPConfig(){return{port:0,proxyRegions:[],startupTimeout:0,exitGracePeriod:0,h2Enabled:!1,targetConcurrency:0}}var HTTPConfig={encode(e,t=new BinaryWriter){0!==e.port&&t.uint32(8).uint32(e.port);for(const n of e.proxyRegions)t.uint32(18).string(n);return 0!==e.startupTimeout&&t.uint32(24).uint32(e.startupTimeout),0!==e.exitGracePeriod&&t.uint32(32).uint32(e.exitGracePeriod),!1!==e.h2Enabled&&t.uint32(40).bool(e.h2Enabled),0!==e.targetConcurrency&&t.uint32(48).uint32(e.targetConcurrency),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseHTTPConfig();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.port=n.uint32();continue;case 2:if(18!==e)break;a.proxyRegions.push(n.string());continue;case 3:if(24!==e)break;a.startupTimeout=n.uint32();continue;case 4:if(32!==e)break;a.exitGracePeriod=n.uint32();continue;case 5:if(40!==e)break;a.h2Enabled=n.bool();continue;case 6:if(48!==e)break;a.targetConcurrency=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({port:isSet4(e.port)?globalThis.Number(e.port):0,proxyRegions:globalThis.Array.isArray(e?.proxyRegions)?e.proxyRegions.map((e=>globalThis.String(e))):[],startupTimeout:isSet4(e.startupTimeout)?globalThis.Number(e.startupTimeout):0,exitGracePeriod:isSet4(e.exitGracePeriod)?globalThis.Number(e.exitGracePeriod):0,h2Enabled:!!isSet4(e.h2Enabled)&&globalThis.Boolean(e.h2Enabled),targetConcurrency:isSet4(e.targetConcurrency)?globalThis.Number(e.targetConcurrency):0}),toJSON(e){const t={};return 0!==e.port&&(t.port=Math.round(e.port)),e.proxyRegions?.length&&(t.proxyRegions=e.proxyRegions),0!==e.startupTimeout&&(t.startupTimeout=Math.round(e.startupTimeout)),0!==e.exitGracePeriod&&(t.exitGracePeriod=Math.round(e.exitGracePeriod)),!1!==e.h2Enabled&&(t.h2Enabled=e.h2Enabled),0!==e.targetConcurrency&&(t.targetConcurrency=Math.round(e.targetConcurrency)),t},create:e=>HTTPConfig.fromPartial(e??{}),fromPartial(e){const t=createBaseHTTPConfig();return t.port=e.port??0,t.proxyRegions=e.proxyRegions?.map((e=>e))||[],t.startupTimeout=e.startupTimeout??0,t.exitGracePeriod=e.exitGracePeriod??0,t.h2Enabled=e.h2Enabled??!1,t.targetConcurrency=e.targetConcurrency??0,t}};function createBaseImage(){return{baseImages:[],dockerfileCommands:[],contextFiles:[],version:"",secretIds:[],contextMountId:"",gpuConfig:void 0,imageRegistryConfig:void 0,buildFunctionDef:"",buildFunctionGlobals:new Uint8Array(0),runtime:"",runtimeDebug:!1,buildFunction:void 0,buildArgs:{},volumeMounts:[]}}var Image={encode(e,t=new BinaryWriter){for(const n of e.baseImages)BaseImage.encode(n,t.uint32(42).fork()).join();for(const n of e.dockerfileCommands)t.uint32(50).string(n);for(const n of e.contextFiles)ImageContextFile.encode(n,t.uint32(58).fork()).join();""!==e.version&&t.uint32(90).string(e.version);for(const n of e.secretIds)t.uint32(98).string(n);""!==e.contextMountId&&t.uint32(122).string(e.contextMountId),void 0!==e.gpuConfig&&GPUConfig.encode(e.gpuConfig,t.uint32(130).fork()).join(),void 0!==e.imageRegistryConfig&&ImageRegistryConfig.encode(e.imageRegistryConfig,t.uint32(138).fork()).join(),""!==e.buildFunctionDef&&t.uint32(114).string(e.buildFunctionDef),0!==e.buildFunctionGlobals.length&&t.uint32(146).bytes(e.buildFunctionGlobals),""!==e.runtime&&t.uint32(154).string(e.runtime),!1!==e.runtimeDebug&&t.uint32(160).bool(e.runtimeDebug),void 0!==e.buildFunction&&BuildFunction.encode(e.buildFunction,t.uint32(170).fork()).join(),Object.entries(e.buildArgs).forEach((([e,n])=>{Image_BuildArgsEntry.encode({key:e,value:n},t.uint32(178).fork()).join()}));for(const n of e.volumeMounts)VolumeMount.encode(n,t.uint32(186).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseImage();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 5:if(42!==e)break;a.baseImages.push(BaseImage.decode(n,n.uint32()));continue;case 6:if(50!==e)break;a.dockerfileCommands.push(n.string());continue;case 7:if(58!==e)break;a.contextFiles.push(ImageContextFile.decode(n,n.uint32()));continue;case 11:if(90!==e)break;a.version=n.string();continue;case 12:if(98!==e)break;a.secretIds.push(n.string());continue;case 15:if(122!==e)break;a.contextMountId=n.string();continue;case 16:if(130!==e)break;a.gpuConfig=GPUConfig.decode(n,n.uint32());continue;case 17:if(138!==e)break;a.imageRegistryConfig=ImageRegistryConfig.decode(n,n.uint32());continue;case 14:if(114!==e)break;a.buildFunctionDef=n.string();continue;case 18:if(146!==e)break;a.buildFunctionGlobals=n.bytes();continue;case 19:if(154!==e)break;a.runtime=n.string();continue;case 20:if(160!==e)break;a.runtimeDebug=n.bool();continue;case 21:if(170!==e)break;a.buildFunction=BuildFunction.decode(n,n.uint32());continue;case 22:{if(178!==e)break;const t=Image_BuildArgsEntry.decode(n,n.uint32());void 0!==t.value&&(a.buildArgs[t.key]=t.value);continue}case 23:if(186!==e)break;a.volumeMounts.push(VolumeMount.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({baseImages:globalThis.Array.isArray(e?.baseImages)?e.baseImages.map((e=>BaseImage.fromJSON(e))):[],dockerfileCommands:globalThis.Array.isArray(e?.dockerfileCommands)?e.dockerfileCommands.map((e=>globalThis.String(e))):[],contextFiles:globalThis.Array.isArray(e?.contextFiles)?e.contextFiles.map((e=>ImageContextFile.fromJSON(e))):[],version:isSet4(e.version)?globalThis.String(e.version):"",secretIds:globalThis.Array.isArray(e?.secretIds)?e.secretIds.map((e=>globalThis.String(e))):[],contextMountId:isSet4(e.contextMountId)?globalThis.String(e.contextMountId):"",gpuConfig:isSet4(e.gpuConfig)?GPUConfig.fromJSON(e.gpuConfig):void 0,imageRegistryConfig:isSet4(e.imageRegistryConfig)?ImageRegistryConfig.fromJSON(e.imageRegistryConfig):void 0,buildFunctionDef:isSet4(e.buildFunctionDef)?globalThis.String(e.buildFunctionDef):"",buildFunctionGlobals:isSet4(e.buildFunctionGlobals)?bytesFromBase64(e.buildFunctionGlobals):new Uint8Array(0),runtime:isSet4(e.runtime)?globalThis.String(e.runtime):"",runtimeDebug:!!isSet4(e.runtimeDebug)&&globalThis.Boolean(e.runtimeDebug),buildFunction:isSet4(e.buildFunction)?BuildFunction.fromJSON(e.buildFunction):void 0,buildArgs:isObject2(e.buildArgs)?Object.entries(e.buildArgs).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{},volumeMounts:globalThis.Array.isArray(e?.volumeMounts)?e.volumeMounts.map((e=>VolumeMount.fromJSON(e))):[]}),toJSON(e){const t={};if(e.baseImages?.length&&(t.baseImages=e.baseImages.map((e=>BaseImage.toJSON(e)))),e.dockerfileCommands?.length&&(t.dockerfileCommands=e.dockerfileCommands),e.contextFiles?.length&&(t.contextFiles=e.contextFiles.map((e=>ImageContextFile.toJSON(e)))),""!==e.version&&(t.version=e.version),e.secretIds?.length&&(t.secretIds=e.secretIds),""!==e.contextMountId&&(t.contextMountId=e.contextMountId),void 0!==e.gpuConfig&&(t.gpuConfig=GPUConfig.toJSON(e.gpuConfig)),void 0!==e.imageRegistryConfig&&(t.imageRegistryConfig=ImageRegistryConfig.toJSON(e.imageRegistryConfig)),""!==e.buildFunctionDef&&(t.buildFunctionDef=e.buildFunctionDef),0!==e.buildFunctionGlobals.length&&(t.buildFunctionGlobals=base64FromBytes(e.buildFunctionGlobals)),""!==e.runtime&&(t.runtime=e.runtime),!1!==e.runtimeDebug&&(t.runtimeDebug=e.runtimeDebug),void 0!==e.buildFunction&&(t.buildFunction=BuildFunction.toJSON(e.buildFunction)),e.buildArgs){const n=Object.entries(e.buildArgs);n.length>0&&(t.buildArgs={},n.forEach((([e,n])=>{t.buildArgs[e]=n})))}return e.volumeMounts?.length&&(t.volumeMounts=e.volumeMounts.map((e=>VolumeMount.toJSON(e)))),t},create:e=>Image.fromPartial(e??{}),fromPartial(e){const t=createBaseImage();return t.baseImages=e.baseImages?.map((e=>BaseImage.fromPartial(e)))||[],t.dockerfileCommands=e.dockerfileCommands?.map((e=>e))||[],t.contextFiles=e.contextFiles?.map((e=>ImageContextFile.fromPartial(e)))||[],t.version=e.version??"",t.secretIds=e.secretIds?.map((e=>e))||[],t.contextMountId=e.contextMountId??"",t.gpuConfig=void 0!==e.gpuConfig&&null!==e.gpuConfig?GPUConfig.fromPartial(e.gpuConfig):void 0,t.imageRegistryConfig=void 0!==e.imageRegistryConfig&&null!==e.imageRegistryConfig?ImageRegistryConfig.fromPartial(e.imageRegistryConfig):void 0,t.buildFunctionDef=e.buildFunctionDef??"",t.buildFunctionGlobals=e.buildFunctionGlobals??new Uint8Array(0),t.runtime=e.runtime??"",t.runtimeDebug=e.runtimeDebug??!1,t.buildFunction=void 0!==e.buildFunction&&null!==e.buildFunction?BuildFunction.fromPartial(e.buildFunction):void 0,t.buildArgs=Object.entries(e.buildArgs??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t.volumeMounts=e.volumeMounts?.map((e=>VolumeMount.fromPartial(e)))||[],t}};function createBaseImage_BuildArgsEntry(){return{key:"",value:""}}var Image_BuildArgsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseImage_BuildArgsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>Image_BuildArgsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseImage_BuildArgsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseImageContextFile(){return{filename:"",data:new Uint8Array(0)}}var ImageContextFile={encode:(e,t=new BinaryWriter)=>(""!==e.filename&&t.uint32(10).string(e.filename),0!==e.data.length&&t.uint32(18).bytes(e.data),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseImageContextFile();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.filename=n.string();continue;case 2:if(18!==e)break;a.data=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({filename:isSet4(e.filename)?globalThis.String(e.filename):"",data:isSet4(e.data)?bytesFromBase64(e.data):new Uint8Array(0)}),toJSON(e){const t={};return""!==e.filename&&(t.filename=e.filename),0!==e.data.length&&(t.data=base64FromBytes(e.data)),t},create:e=>ImageContextFile.fromPartial(e??{}),fromPartial(e){const t=createBaseImageContextFile();return t.filename=e.filename??"",t.data=e.data??new Uint8Array(0),t}};function createBaseImageDeleteRequest(){return{imageId:""}}var ImageDeleteRequest={encode:(e,t=new BinaryWriter)=>(""!==e.imageId&&t.uint32(10).string(e.imageId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseImageDeleteRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.imageId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({imageId:isSet4(e.imageId)?globalThis.String(e.imageId):""}),toJSON(e){const t={};return""!==e.imageId&&(t.imageId=e.imageId),t},create:e=>ImageDeleteRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseImageDeleteRequest();return t.imageId=e.imageId??"",t}};function createBaseImageFromIdRequest(){return{imageId:""}}var ImageFromIdRequest={encode:(e,t=new BinaryWriter)=>(""!==e.imageId&&t.uint32(10).string(e.imageId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseImageFromIdRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.imageId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({imageId:isSet4(e.imageId)?globalThis.String(e.imageId):""}),toJSON(e){const t={};return""!==e.imageId&&(t.imageId=e.imageId),t},create:e=>ImageFromIdRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseImageFromIdRequest();return t.imageId=e.imageId??"",t}};function createBaseImageFromIdResponse(){return{imageId:"",metadata:void 0}}var ImageFromIdResponse={encode:(e,t=new BinaryWriter)=>(""!==e.imageId&&t.uint32(10).string(e.imageId),void 0!==e.metadata&&ImageMetadata.encode(e.metadata,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseImageFromIdResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.imageId=n.string();continue;case 2:if(18!==e)break;a.metadata=ImageMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({imageId:isSet4(e.imageId)?globalThis.String(e.imageId):"",metadata:isSet4(e.metadata)?ImageMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.imageId&&(t.imageId=e.imageId),void 0!==e.metadata&&(t.metadata=ImageMetadata.toJSON(e.metadata)),t},create:e=>ImageFromIdResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseImageFromIdResponse();return t.imageId=e.imageId??"",t.metadata=void 0!==e.metadata&&null!==e.metadata?ImageMetadata.fromPartial(e.metadata):void 0,t}};function createBaseImageGetOrCreateRequest(){return{image:void 0,appId:"",existingImageId:"",buildFunctionId:"",forceBuild:!1,namespace:0,builderVersion:"",allowGlobalDeployment:!1,ignoreCache:!1}}var ImageGetOrCreateRequest={encode:(e,t=new BinaryWriter)=>(void 0!==e.image&&Image.encode(e.image,t.uint32(18).fork()).join(),""!==e.appId&&t.uint32(34).string(e.appId),""!==e.existingImageId&&t.uint32(42).string(e.existingImageId),""!==e.buildFunctionId&&t.uint32(50).string(e.buildFunctionId),!1!==e.forceBuild&&t.uint32(56).bool(e.forceBuild),0!==e.namespace&&t.uint32(64).int32(e.namespace),""!==e.builderVersion&&t.uint32(74).string(e.builderVersion),!1!==e.allowGlobalDeployment&&t.uint32(80).bool(e.allowGlobalDeployment),!1!==e.ignoreCache&&t.uint32(88).bool(e.ignoreCache),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseImageGetOrCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 2:if(18!==e)break;a.image=Image.decode(n,n.uint32());continue;case 4:if(34!==e)break;a.appId=n.string();continue;case 5:if(42!==e)break;a.existingImageId=n.string();continue;case 6:if(50!==e)break;a.buildFunctionId=n.string();continue;case 7:if(56!==e)break;a.forceBuild=n.bool();continue;case 8:if(64!==e)break;a.namespace=n.int32();continue;case 9:if(74!==e)break;a.builderVersion=n.string();continue;case 10:if(80!==e)break;a.allowGlobalDeployment=n.bool();continue;case 11:if(88!==e)break;a.ignoreCache=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({image:isSet4(e.image)?Image.fromJSON(e.image):void 0,appId:isSet4(e.appId)?globalThis.String(e.appId):"",existingImageId:isSet4(e.existingImageId)?globalThis.String(e.existingImageId):"",buildFunctionId:isSet4(e.buildFunctionId)?globalThis.String(e.buildFunctionId):"",forceBuild:!!isSet4(e.forceBuild)&&globalThis.Boolean(e.forceBuild),namespace:isSet4(e.namespace)?deploymentNamespaceFromJSON(e.namespace):0,builderVersion:isSet4(e.builderVersion)?globalThis.String(e.builderVersion):"",allowGlobalDeployment:!!isSet4(e.allowGlobalDeployment)&&globalThis.Boolean(e.allowGlobalDeployment),ignoreCache:!!isSet4(e.ignoreCache)&&globalThis.Boolean(e.ignoreCache)}),toJSON(e){const t={};return void 0!==e.image&&(t.image=Image.toJSON(e.image)),""!==e.appId&&(t.appId=e.appId),""!==e.existingImageId&&(t.existingImageId=e.existingImageId),""!==e.buildFunctionId&&(t.buildFunctionId=e.buildFunctionId),!1!==e.forceBuild&&(t.forceBuild=e.forceBuild),0!==e.namespace&&(t.namespace=deploymentNamespaceToJSON(e.namespace)),""!==e.builderVersion&&(t.builderVersion=e.builderVersion),!1!==e.allowGlobalDeployment&&(t.allowGlobalDeployment=e.allowGlobalDeployment),!1!==e.ignoreCache&&(t.ignoreCache=e.ignoreCache),t},create:e=>ImageGetOrCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseImageGetOrCreateRequest();return t.image=void 0!==e.image&&null!==e.image?Image.fromPartial(e.image):void 0,t.appId=e.appId??"",t.existingImageId=e.existingImageId??"",t.buildFunctionId=e.buildFunctionId??"",t.forceBuild=e.forceBuild??!1,t.namespace=e.namespace??0,t.builderVersion=e.builderVersion??"",t.allowGlobalDeployment=e.allowGlobalDeployment??!1,t.ignoreCache=e.ignoreCache??!1,t}};function createBaseImageGetOrCreateResponse(){return{imageId:"",result:void 0,metadata:void 0}}var ImageGetOrCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.imageId&&t.uint32(10).string(e.imageId),void 0!==e.result&&GenericResult.encode(e.result,t.uint32(18).fork()).join(),void 0!==e.metadata&&ImageMetadata.encode(e.metadata,t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseImageGetOrCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.imageId=n.string();continue;case 2:if(18!==e)break;a.result=GenericResult.decode(n,n.uint32());continue;case 3:if(26!==e)break;a.metadata=ImageMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({imageId:isSet4(e.imageId)?globalThis.String(e.imageId):"",result:isSet4(e.result)?GenericResult.fromJSON(e.result):void 0,metadata:isSet4(e.metadata)?ImageMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.imageId&&(t.imageId=e.imageId),void 0!==e.result&&(t.result=GenericResult.toJSON(e.result)),void 0!==e.metadata&&(t.metadata=ImageMetadata.toJSON(e.metadata)),t},create:e=>ImageGetOrCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseImageGetOrCreateResponse();return t.imageId=e.imageId??"",t.result=void 0!==e.result&&null!==e.result?GenericResult.fromPartial(e.result):void 0,t.metadata=void 0!==e.metadata&&null!==e.metadata?ImageMetadata.fromPartial(e.metadata):void 0,t}};function createBaseImageJoinStreamingRequest(){return{imageId:"",timeout:0,lastEntryId:"",includeLogsForFinished:!1}}var ImageJoinStreamingRequest={encode:(e,t=new BinaryWriter)=>(""!==e.imageId&&t.uint32(10).string(e.imageId),0!==e.timeout&&t.uint32(21).float(e.timeout),""!==e.lastEntryId&&t.uint32(26).string(e.lastEntryId),!1!==e.includeLogsForFinished&&t.uint32(32).bool(e.includeLogsForFinished),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseImageJoinStreamingRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.imageId=n.string();continue;case 2:if(21!==e)break;a.timeout=n.float();continue;case 3:if(26!==e)break;a.lastEntryId=n.string();continue;case 4:if(32!==e)break;a.includeLogsForFinished=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({imageId:isSet4(e.imageId)?globalThis.String(e.imageId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0,lastEntryId:isSet4(e.lastEntryId)?globalThis.String(e.lastEntryId):"",includeLogsForFinished:!!isSet4(e.includeLogsForFinished)&&globalThis.Boolean(e.includeLogsForFinished)}),toJSON(e){const t={};return""!==e.imageId&&(t.imageId=e.imageId),0!==e.timeout&&(t.timeout=e.timeout),""!==e.lastEntryId&&(t.lastEntryId=e.lastEntryId),!1!==e.includeLogsForFinished&&(t.includeLogsForFinished=e.includeLogsForFinished),t},create:e=>ImageJoinStreamingRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseImageJoinStreamingRequest();return t.imageId=e.imageId??"",t.timeout=e.timeout??0,t.lastEntryId=e.lastEntryId??"",t.includeLogsForFinished=e.includeLogsForFinished??!1,t}};function createBaseImageJoinStreamingResponse(){return{result:void 0,taskLogs:[],entryId:"",eof:!1,metadata:void 0}}var ImageJoinStreamingResponse={encode(e,t=new BinaryWriter){void 0!==e.result&&GenericResult.encode(e.result,t.uint32(10).fork()).join();for(const n of e.taskLogs)TaskLogs.encode(n,t.uint32(18).fork()).join();return""!==e.entryId&&t.uint32(26).string(e.entryId),!1!==e.eof&&t.uint32(32).bool(e.eof),void 0!==e.metadata&&ImageMetadata.encode(e.metadata,t.uint32(42).fork()).join(),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseImageJoinStreamingResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.result=GenericResult.decode(n,n.uint32());continue;case 2:if(18!==e)break;a.taskLogs.push(TaskLogs.decode(n,n.uint32()));continue;case 3:if(26!==e)break;a.entryId=n.string();continue;case 4:if(32!==e)break;a.eof=n.bool();continue;case 5:if(42!==e)break;a.metadata=ImageMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({result:isSet4(e.result)?GenericResult.fromJSON(e.result):void 0,taskLogs:globalThis.Array.isArray(e?.taskLogs)?e.taskLogs.map((e=>TaskLogs.fromJSON(e))):[],entryId:isSet4(e.entryId)?globalThis.String(e.entryId):"",eof:!!isSet4(e.eof)&&globalThis.Boolean(e.eof),metadata:isSet4(e.metadata)?ImageMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return void 0!==e.result&&(t.result=GenericResult.toJSON(e.result)),e.taskLogs?.length&&(t.taskLogs=e.taskLogs.map((e=>TaskLogs.toJSON(e)))),""!==e.entryId&&(t.entryId=e.entryId),!1!==e.eof&&(t.eof=e.eof),void 0!==e.metadata&&(t.metadata=ImageMetadata.toJSON(e.metadata)),t},create:e=>ImageJoinStreamingResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseImageJoinStreamingResponse();return t.result=void 0!==e.result&&null!==e.result?GenericResult.fromPartial(e.result):void 0,t.taskLogs=e.taskLogs?.map((e=>TaskLogs.fromPartial(e)))||[],t.entryId=e.entryId??"",t.eof=e.eof??!1,t.metadata=void 0!==e.metadata&&null!==e.metadata?ImageMetadata.fromPartial(e.metadata):void 0,t}};function createBaseImageMetadata(){return{pythonVersionInfo:void 0,pythonPackages:{},workdir:void 0,libcVersionInfo:void 0,imageBuilderVersion:void 0}}var ImageMetadata={encode:(e,t=new BinaryWriter)=>(void 0!==e.pythonVersionInfo&&t.uint32(10).string(e.pythonVersionInfo),Object.entries(e.pythonPackages).forEach((([e,n])=>{ImageMetadata_PythonPackagesEntry.encode({key:e,value:n},t.uint32(18).fork()).join()})),void 0!==e.workdir&&t.uint32(26).string(e.workdir),void 0!==e.libcVersionInfo&&t.uint32(34).string(e.libcVersionInfo),void 0!==e.imageBuilderVersion&&t.uint32(42).string(e.imageBuilderVersion),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseImageMetadata();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.pythonVersionInfo=n.string();continue;case 2:{if(18!==e)break;const t=ImageMetadata_PythonPackagesEntry.decode(n,n.uint32());void 0!==t.value&&(a.pythonPackages[t.key]=t.value);continue}case 3:if(26!==e)break;a.workdir=n.string();continue;case 4:if(34!==e)break;a.libcVersionInfo=n.string();continue;case 5:if(42!==e)break;a.imageBuilderVersion=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({pythonVersionInfo:isSet4(e.pythonVersionInfo)?globalThis.String(e.pythonVersionInfo):void 0,pythonPackages:isObject2(e.pythonPackages)?Object.entries(e.pythonPackages).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{},workdir:isSet4(e.workdir)?globalThis.String(e.workdir):void 0,libcVersionInfo:isSet4(e.libcVersionInfo)?globalThis.String(e.libcVersionInfo):void 0,imageBuilderVersion:isSet4(e.imageBuilderVersion)?globalThis.String(e.imageBuilderVersion):void 0}),toJSON(e){const t={};if(void 0!==e.pythonVersionInfo&&(t.pythonVersionInfo=e.pythonVersionInfo),e.pythonPackages){const n=Object.entries(e.pythonPackages);n.length>0&&(t.pythonPackages={},n.forEach((([e,n])=>{t.pythonPackages[e]=n})))}return void 0!==e.workdir&&(t.workdir=e.workdir),void 0!==e.libcVersionInfo&&(t.libcVersionInfo=e.libcVersionInfo),void 0!==e.imageBuilderVersion&&(t.imageBuilderVersion=e.imageBuilderVersion),t},create:e=>ImageMetadata.fromPartial(e??{}),fromPartial(e){const t=createBaseImageMetadata();return t.pythonVersionInfo=e.pythonVersionInfo??void 0,t.pythonPackages=Object.entries(e.pythonPackages??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t.workdir=e.workdir??void 0,t.libcVersionInfo=e.libcVersionInfo??void 0,t.imageBuilderVersion=e.imageBuilderVersion??void 0,t}};function createBaseImageMetadata_PythonPackagesEntry(){return{key:"",value:""}}var ImageMetadata_PythonPackagesEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseImageMetadata_PythonPackagesEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>ImageMetadata_PythonPackagesEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseImageMetadata_PythonPackagesEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseImageRegistryConfig(){return{registryAuthType:0,secretId:""}}var ImageRegistryConfig={encode:(e,t=new BinaryWriter)=>(0!==e.registryAuthType&&t.uint32(8).int32(e.registryAuthType),""!==e.secretId&&t.uint32(18).string(e.secretId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseImageRegistryConfig();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.registryAuthType=n.int32();continue;case 2:if(18!==e)break;a.secretId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({registryAuthType:isSet4(e.registryAuthType)?registryAuthTypeFromJSON(e.registryAuthType):0,secretId:isSet4(e.secretId)?globalThis.String(e.secretId):""}),toJSON(e){const t={};return 0!==e.registryAuthType&&(t.registryAuthType=registryAuthTypeToJSON(e.registryAuthType)),""!==e.secretId&&(t.secretId=e.secretId),t},create:e=>ImageRegistryConfig.fromPartial(e??{}),fromPartial(e){const t=createBaseImageRegistryConfig();return t.registryAuthType=e.registryAuthType??0,t.secretId=e.secretId??"",t}};function createBaseInputCallGraphInfo(){return{inputId:"",status:0,functionCallId:"",taskId:""}}var InputCallGraphInfo={encode:(e,t=new BinaryWriter)=>(""!==e.inputId&&t.uint32(10).string(e.inputId),0!==e.status&&t.uint32(16).int32(e.status),""!==e.functionCallId&&t.uint32(26).string(e.functionCallId),""!==e.taskId&&t.uint32(34).string(e.taskId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseInputCallGraphInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.inputId=n.string();continue;case 2:if(16!==e)break;a.status=n.int32();continue;case 3:if(26!==e)break;a.functionCallId=n.string();continue;case 4:if(34!==e)break;a.taskId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({inputId:isSet4(e.inputId)?globalThis.String(e.inputId):"",status:isSet4(e.status)?genericResult_GenericStatusFromJSON(e.status):0,functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",taskId:isSet4(e.taskId)?globalThis.String(e.taskId):""}),toJSON(e){const t={};return""!==e.inputId&&(t.inputId=e.inputId),0!==e.status&&(t.status=genericResult_GenericStatusToJSON(e.status)),""!==e.functionCallId&&(t.functionCallId=e.functionCallId),""!==e.taskId&&(t.taskId=e.taskId),t},create:e=>InputCallGraphInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseInputCallGraphInfo();return t.inputId=e.inputId??"",t.status=e.status??0,t.functionCallId=e.functionCallId??"",t.taskId=e.taskId??"",t}};function createBaseInputCategoryInfo(){return{total:0,latest:[]}}var InputCategoryInfo={encode(e,t=new BinaryWriter){0!==e.total&&t.uint32(8).int32(e.total);for(const n of e.latest)InputInfo.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseInputCategoryInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.total=n.int32();continue;case 2:if(18!==e)break;a.latest.push(InputInfo.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({total:isSet4(e.total)?globalThis.Number(e.total):0,latest:globalThis.Array.isArray(e?.latest)?e.latest.map((e=>InputInfo.fromJSON(e))):[]}),toJSON(e){const t={};return 0!==e.total&&(t.total=Math.round(e.total)),e.latest?.length&&(t.latest=e.latest.map((e=>InputInfo.toJSON(e)))),t},create:e=>InputCategoryInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseInputCategoryInfo();return t.total=e.total??0,t.latest=e.latest?.map((e=>InputInfo.fromPartial(e)))||[],t}};function createBaseInputInfo(){return{inputId:"",idx:0,taskId:"",startedAt:0,finishedAt:0,taskStartupTime:0,taskFirstInput:!1}}var InputInfo={encode:(e,t=new BinaryWriter)=>(""!==e.inputId&&t.uint32(10).string(e.inputId),0!==e.idx&&t.uint32(16).int32(e.idx),""!==e.taskId&&t.uint32(26).string(e.taskId),0!==e.startedAt&&t.uint32(33).double(e.startedAt),0!==e.finishedAt&&t.uint32(41).double(e.finishedAt),0!==e.taskStartupTime&&t.uint32(49).double(e.taskStartupTime),!1!==e.taskFirstInput&&t.uint32(56).bool(e.taskFirstInput),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseInputInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.inputId=n.string();continue;case 2:if(16!==e)break;a.idx=n.int32();continue;case 3:if(26!==e)break;a.taskId=n.string();continue;case 4:if(33!==e)break;a.startedAt=n.double();continue;case 5:if(41!==e)break;a.finishedAt=n.double();continue;case 6:if(49!==e)break;a.taskStartupTime=n.double();continue;case 7:if(56!==e)break;a.taskFirstInput=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({inputId:isSet4(e.inputId)?globalThis.String(e.inputId):"",idx:isSet4(e.idx)?globalThis.Number(e.idx):0,taskId:isSet4(e.taskId)?globalThis.String(e.taskId):"",startedAt:isSet4(e.startedAt)?globalThis.Number(e.startedAt):0,finishedAt:isSet4(e.finishedAt)?globalThis.Number(e.finishedAt):0,taskStartupTime:isSet4(e.taskStartupTime)?globalThis.Number(e.taskStartupTime):0,taskFirstInput:!!isSet4(e.taskFirstInput)&&globalThis.Boolean(e.taskFirstInput)}),toJSON(e){const t={};return""!==e.inputId&&(t.inputId=e.inputId),0!==e.idx&&(t.idx=Math.round(e.idx)),""!==e.taskId&&(t.taskId=e.taskId),0!==e.startedAt&&(t.startedAt=e.startedAt),0!==e.finishedAt&&(t.finishedAt=e.finishedAt),0!==e.taskStartupTime&&(t.taskStartupTime=e.taskStartupTime),!1!==e.taskFirstInput&&(t.taskFirstInput=e.taskFirstInput),t},create:e=>InputInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseInputInfo();return t.inputId=e.inputId??"",t.idx=e.idx??0,t.taskId=e.taskId??"",t.startedAt=e.startedAt??0,t.finishedAt=e.finishedAt??0,t.taskStartupTime=e.taskStartupTime??0,t.taskFirstInput=e.taskFirstInput??!1,t}};function createBaseListPagination(){return{maxObjects:0,createdBefore:0}}var ListPagination={encode:(e,t=new BinaryWriter)=>(0!==e.maxObjects&&t.uint32(8).int32(e.maxObjects),0!==e.createdBefore&&t.uint32(17).double(e.createdBefore),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseListPagination();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.maxObjects=n.int32();continue;case 2:if(17!==e)break;a.createdBefore=n.double();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({maxObjects:isSet4(e.maxObjects)?globalThis.Number(e.maxObjects):0,createdBefore:isSet4(e.createdBefore)?globalThis.Number(e.createdBefore):0}),toJSON(e){const t={};return 0!==e.maxObjects&&(t.maxObjects=Math.round(e.maxObjects)),0!==e.createdBefore&&(t.createdBefore=e.createdBefore),t},create:e=>ListPagination.fromPartial(e??{}),fromPartial(e){const t=createBaseListPagination();return t.maxObjects=e.maxObjects??0,t.createdBefore=e.createdBefore??0,t}};function createBaseMapAwaitRequest(){return{functionCallId:void 0,mapToken:void 0,lastEntryId:"",requestedAt:0,timeout:0}}var MapAwaitRequest={encode:(e,t=new BinaryWriter)=>(void 0!==e.functionCallId&&t.uint32(10).string(e.functionCallId),void 0!==e.mapToken&&t.uint32(42).string(e.mapToken),""!==e.lastEntryId&&t.uint32(18).string(e.lastEntryId),0!==e.requestedAt&&t.uint32(25).double(e.requestedAt),0!==e.timeout&&t.uint32(37).float(e.timeout),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMapAwaitRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionCallId=n.string();continue;case 5:if(42!==e)break;a.mapToken=n.string();continue;case 2:if(18!==e)break;a.lastEntryId=n.string();continue;case 3:if(25!==e)break;a.requestedAt=n.double();continue;case 4:if(37!==e)break;a.timeout=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):void 0,mapToken:isSet4(e.mapToken)?globalThis.String(e.mapToken):void 0,lastEntryId:isSet4(e.lastEntryId)?globalThis.String(e.lastEntryId):"",requestedAt:isSet4(e.requestedAt)?globalThis.Number(e.requestedAt):0,timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0}),toJSON(e){const t={};return void 0!==e.functionCallId&&(t.functionCallId=e.functionCallId),void 0!==e.mapToken&&(t.mapToken=e.mapToken),""!==e.lastEntryId&&(t.lastEntryId=e.lastEntryId),0!==e.requestedAt&&(t.requestedAt=e.requestedAt),0!==e.timeout&&(t.timeout=e.timeout),t},create:e=>MapAwaitRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseMapAwaitRequest();return t.functionCallId=e.functionCallId??void 0,t.mapToken=e.mapToken??void 0,t.lastEntryId=e.lastEntryId??"",t.requestedAt=e.requestedAt??0,t.timeout=e.timeout??0,t}};function createBaseMapAwaitResponse(){return{outputs:[],lastEntryId:""}}var MapAwaitResponse={encode(e,t=new BinaryWriter){for(const n of e.outputs)FunctionGetOutputsItem.encode(n,t.uint32(10).fork()).join();return""!==e.lastEntryId&&t.uint32(18).string(e.lastEntryId),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMapAwaitResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.outputs.push(FunctionGetOutputsItem.decode(n,n.uint32()));continue;case 2:if(18!==e)break;a.lastEntryId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({outputs:globalThis.Array.isArray(e?.outputs)?e.outputs.map((e=>FunctionGetOutputsItem.fromJSON(e))):[],lastEntryId:isSet4(e.lastEntryId)?globalThis.String(e.lastEntryId):""}),toJSON(e){const t={};return e.outputs?.length&&(t.outputs=e.outputs.map((e=>FunctionGetOutputsItem.toJSON(e)))),""!==e.lastEntryId&&(t.lastEntryId=e.lastEntryId),t},create:e=>MapAwaitResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseMapAwaitResponse();return t.outputs=e.outputs?.map((e=>FunctionGetOutputsItem.fromPartial(e)))||[],t.lastEntryId=e.lastEntryId??"",t}};function createBaseMapCheckInputsRequest(){return{lastEntryId:"",timeout:0,attemptTokens:[]}}var MapCheckInputsRequest={encode(e,t=new BinaryWriter){""!==e.lastEntryId&&t.uint32(10).string(e.lastEntryId),0!==e.timeout&&t.uint32(21).float(e.timeout);for(const n of e.attemptTokens)t.uint32(26).string(n);return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMapCheckInputsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.lastEntryId=n.string();continue;case 2:if(21!==e)break;a.timeout=n.float();continue;case 3:if(26!==e)break;a.attemptTokens.push(n.string());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({lastEntryId:isSet4(e.lastEntryId)?globalThis.String(e.lastEntryId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0,attemptTokens:globalThis.Array.isArray(e?.attemptTokens)?e.attemptTokens.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return""!==e.lastEntryId&&(t.lastEntryId=e.lastEntryId),0!==e.timeout&&(t.timeout=e.timeout),e.attemptTokens?.length&&(t.attemptTokens=e.attemptTokens),t},create:e=>MapCheckInputsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseMapCheckInputsRequest();return t.lastEntryId=e.lastEntryId??"",t.timeout=e.timeout??0,t.attemptTokens=e.attemptTokens?.map((e=>e))||[],t}};function createBaseMapCheckInputsResponse(){return{lost:[]}}var MapCheckInputsResponse={encode(e,t=new BinaryWriter){t.uint32(10).fork();for(const n of e.lost)t.bool(n);return t.join(),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMapCheckInputsResponse();for(;n.pos<r;){const e=n.uint32();if(e>>>3==1){if(8===e){a.lost.push(n.bool());continue}if(10===e){const e=n.uint32()+n.pos;for(;n.pos<e;)a.lost.push(n.bool());continue}}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({lost:globalThis.Array.isArray(e?.lost)?e.lost.map((e=>globalThis.Boolean(e))):[]}),toJSON(e){const t={};return e.lost?.length&&(t.lost=e.lost),t},create:e=>MapCheckInputsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseMapCheckInputsResponse();return t.lost=e.lost?.map((e=>e))||[],t}};function createBaseMapStartOrContinueItem(){return{input:void 0,attemptToken:void 0}}var MapStartOrContinueItem={encode:(e,t=new BinaryWriter)=>(void 0!==e.input&&FunctionPutInputsItem.encode(e.input,t.uint32(10).fork()).join(),void 0!==e.attemptToken&&t.uint32(18).string(e.attemptToken),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMapStartOrContinueItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.input=FunctionPutInputsItem.decode(n,n.uint32());continue;case 2:if(18!==e)break;a.attemptToken=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({input:isSet4(e.input)?FunctionPutInputsItem.fromJSON(e.input):void 0,attemptToken:isSet4(e.attemptToken)?globalThis.String(e.attemptToken):void 0}),toJSON(e){const t={};return void 0!==e.input&&(t.input=FunctionPutInputsItem.toJSON(e.input)),void 0!==e.attemptToken&&(t.attemptToken=e.attemptToken),t},create:e=>MapStartOrContinueItem.fromPartial(e??{}),fromPartial(e){const t=createBaseMapStartOrContinueItem();return t.input=void 0!==e.input&&null!==e.input?FunctionPutInputsItem.fromPartial(e.input):void 0,t.attemptToken=e.attemptToken??void 0,t}};function createBaseMapStartOrContinueRequest(){return{functionId:"",parentInputId:"",functionCallId:void 0,mapToken:void 0,items:[]}}var MapStartOrContinueRequest={encode(e,t=new BinaryWriter){""!==e.functionId&&t.uint32(10).string(e.functionId),""!==e.parentInputId&&t.uint32(18).string(e.parentInputId),void 0!==e.functionCallId&&t.uint32(26).string(e.functionCallId),void 0!==e.mapToken&&t.uint32(42).string(e.mapToken);for(const n of e.items)MapStartOrContinueItem.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMapStartOrContinueRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(18!==e)break;a.parentInputId=n.string();continue;case 3:if(26!==e)break;a.functionCallId=n.string();continue;case 5:if(42!==e)break;a.mapToken=n.string();continue;case 4:if(34!==e)break;a.items.push(MapStartOrContinueItem.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",parentInputId:isSet4(e.parentInputId)?globalThis.String(e.parentInputId):"",functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):void 0,mapToken:isSet4(e.mapToken)?globalThis.String(e.mapToken):void 0,items:globalThis.Array.isArray(e?.items)?e.items.map((e=>MapStartOrContinueItem.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.functionId&&(t.functionId=e.functionId),""!==e.parentInputId&&(t.parentInputId=e.parentInputId),void 0!==e.functionCallId&&(t.functionCallId=e.functionCallId),void 0!==e.mapToken&&(t.mapToken=e.mapToken),e.items?.length&&(t.items=e.items.map((e=>MapStartOrContinueItem.toJSON(e)))),t},create:e=>MapStartOrContinueRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseMapStartOrContinueRequest();return t.functionId=e.functionId??"",t.parentInputId=e.parentInputId??"",t.functionCallId=e.functionCallId??void 0,t.mapToken=e.mapToken??void 0,t.items=e.items?.map((e=>MapStartOrContinueItem.fromPartial(e)))||[],t}};function createBaseMapStartOrContinueResponse(){return{mapToken:"",functionId:"",functionCallId:"",maxInputsOutstanding:0,attemptTokens:[],retryPolicy:void 0}}var MapStartOrContinueResponse={encode(e,t=new BinaryWriter){""!==e.mapToken&&t.uint32(50).string(e.mapToken),""!==e.functionId&&t.uint32(10).string(e.functionId),""!==e.functionCallId&&t.uint32(18).string(e.functionCallId),0!==e.maxInputsOutstanding&&t.uint32(24).uint32(e.maxInputsOutstanding);for(const n of e.attemptTokens)t.uint32(34).string(n);return void 0!==e.retryPolicy&&FunctionRetryPolicy.encode(e.retryPolicy,t.uint32(42).fork()).join(),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMapStartOrContinueResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 6:if(50!==e)break;a.mapToken=n.string();continue;case 1:if(10!==e)break;a.functionId=n.string();continue;case 2:if(18!==e)break;a.functionCallId=n.string();continue;case 3:if(24!==e)break;a.maxInputsOutstanding=n.uint32();continue;case 4:if(34!==e)break;a.attemptTokens.push(n.string());continue;case 5:if(42!==e)break;a.retryPolicy=FunctionRetryPolicy.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({mapToken:isSet4(e.mapToken)?globalThis.String(e.mapToken):"",functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",maxInputsOutstanding:isSet4(e.maxInputsOutstanding)?globalThis.Number(e.maxInputsOutstanding):0,attemptTokens:globalThis.Array.isArray(e?.attemptTokens)?e.attemptTokens.map((e=>globalThis.String(e))):[],retryPolicy:isSet4(e.retryPolicy)?FunctionRetryPolicy.fromJSON(e.retryPolicy):void 0}),toJSON(e){const t={};return""!==e.mapToken&&(t.mapToken=e.mapToken),""!==e.functionId&&(t.functionId=e.functionId),""!==e.functionCallId&&(t.functionCallId=e.functionCallId),0!==e.maxInputsOutstanding&&(t.maxInputsOutstanding=Math.round(e.maxInputsOutstanding)),e.attemptTokens?.length&&(t.attemptTokens=e.attemptTokens),void 0!==e.retryPolicy&&(t.retryPolicy=FunctionRetryPolicy.toJSON(e.retryPolicy)),t},create:e=>MapStartOrContinueResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseMapStartOrContinueResponse();return t.mapToken=e.mapToken??"",t.functionId=e.functionId??"",t.functionCallId=e.functionCallId??"",t.maxInputsOutstanding=e.maxInputsOutstanding??0,t.attemptTokens=e.attemptTokens?.map((e=>e))||[],t.retryPolicy=void 0!==e.retryPolicy&&null!==e.retryPolicy?FunctionRetryPolicy.fromPartial(e.retryPolicy):void 0,t}};function createBaseMethodDefinition(){return{functionName:"",functionType:0,webhookConfig:void 0,webUrl:"",webUrlInfo:void 0,customDomainInfo:[],functionSchema:void 0,supportedInputFormats:[],supportedOutputFormats:[]}}var MethodDefinition={encode(e,t=new BinaryWriter){""!==e.functionName&&t.uint32(10).string(e.functionName),0!==e.functionType&&t.uint32(16).int32(e.functionType),void 0!==e.webhookConfig&&WebhookConfig.encode(e.webhookConfig,t.uint32(26).fork()).join(),""!==e.webUrl&&t.uint32(34).string(e.webUrl),void 0!==e.webUrlInfo&&WebUrlInfo.encode(e.webUrlInfo,t.uint32(42).fork()).join();for(const n of e.customDomainInfo)CustomDomainInfo.encode(n,t.uint32(50).fork()).join();void 0!==e.functionSchema&&FunctionSchema.encode(e.functionSchema,t.uint32(58).fork()).join(),t.uint32(66).fork();for(const n of e.supportedInputFormats)t.int32(n);t.join(),t.uint32(74).fork();for(const n of e.supportedOutputFormats)t.int32(n);return t.join(),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMethodDefinition();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.functionName=n.string();continue;case 2:if(16!==e)break;a.functionType=n.int32();continue;case 3:if(26!==e)break;a.webhookConfig=WebhookConfig.decode(n,n.uint32());continue;case 4:if(34!==e)break;a.webUrl=n.string();continue;case 5:if(42!==e)break;a.webUrlInfo=WebUrlInfo.decode(n,n.uint32());continue;case 6:if(50!==e)break;a.customDomainInfo.push(CustomDomainInfo.decode(n,n.uint32()));continue;case 7:if(58!==e)break;a.functionSchema=FunctionSchema.decode(n,n.uint32());continue;case 8:if(64===e){a.supportedInputFormats.push(n.int32());continue}if(66===e){const e=n.uint32()+n.pos;for(;n.pos<e;)a.supportedInputFormats.push(n.int32());continue}break;case 9:if(72===e){a.supportedOutputFormats.push(n.int32());continue}if(74===e){const e=n.uint32()+n.pos;for(;n.pos<e;)a.supportedOutputFormats.push(n.int32());continue}}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({functionName:isSet4(e.functionName)?globalThis.String(e.functionName):"",functionType:isSet4(e.functionType)?function_FunctionTypeFromJSON(e.functionType):0,webhookConfig:isSet4(e.webhookConfig)?WebhookConfig.fromJSON(e.webhookConfig):void 0,webUrl:isSet4(e.webUrl)?globalThis.String(e.webUrl):"",webUrlInfo:isSet4(e.webUrlInfo)?WebUrlInfo.fromJSON(e.webUrlInfo):void 0,customDomainInfo:globalThis.Array.isArray(e?.customDomainInfo)?e.customDomainInfo.map((e=>CustomDomainInfo.fromJSON(e))):[],functionSchema:isSet4(e.functionSchema)?FunctionSchema.fromJSON(e.functionSchema):void 0,supportedInputFormats:globalThis.Array.isArray(e?.supportedInputFormats)?e.supportedInputFormats.map((e=>dataFormatFromJSON(e))):[],supportedOutputFormats:globalThis.Array.isArray(e?.supportedOutputFormats)?e.supportedOutputFormats.map((e=>dataFormatFromJSON(e))):[]}),toJSON(e){const t={};return""!==e.functionName&&(t.functionName=e.functionName),0!==e.functionType&&(t.functionType=function_FunctionTypeToJSON(e.functionType)),void 0!==e.webhookConfig&&(t.webhookConfig=WebhookConfig.toJSON(e.webhookConfig)),""!==e.webUrl&&(t.webUrl=e.webUrl),void 0!==e.webUrlInfo&&(t.webUrlInfo=WebUrlInfo.toJSON(e.webUrlInfo)),e.customDomainInfo?.length&&(t.customDomainInfo=e.customDomainInfo.map((e=>CustomDomainInfo.toJSON(e)))),void 0!==e.functionSchema&&(t.functionSchema=FunctionSchema.toJSON(e.functionSchema)),e.supportedInputFormats?.length&&(t.supportedInputFormats=e.supportedInputFormats.map((e=>dataFormatToJSON(e)))),e.supportedOutputFormats?.length&&(t.supportedOutputFormats=e.supportedOutputFormats.map((e=>dataFormatToJSON(e)))),t},create:e=>MethodDefinition.fromPartial(e??{}),fromPartial(e){const t=createBaseMethodDefinition();return t.functionName=e.functionName??"",t.functionType=e.functionType??0,t.webhookConfig=void 0!==e.webhookConfig&&null!==e.webhookConfig?WebhookConfig.fromPartial(e.webhookConfig):void 0,t.webUrl=e.webUrl??"",t.webUrlInfo=void 0!==e.webUrlInfo&&null!==e.webUrlInfo?WebUrlInfo.fromPartial(e.webUrlInfo):void 0,t.customDomainInfo=e.customDomainInfo?.map((e=>CustomDomainInfo.fromPartial(e)))||[],t.functionSchema=void 0!==e.functionSchema&&null!==e.functionSchema?FunctionSchema.fromPartial(e.functionSchema):void 0,t.supportedInputFormats=e.supportedInputFormats?.map((e=>e))||[],t.supportedOutputFormats=e.supportedOutputFormats?.map((e=>e))||[],t}};function createBaseMountFile(){return{filename:"",sha256Hex:"",size:void 0,mode:void 0}}var MountFile={encode:(e,t=new BinaryWriter)=>(""!==e.filename&&t.uint32(10).string(e.filename),""!==e.sha256Hex&&t.uint32(26).string(e.sha256Hex),void 0!==e.size&&t.uint32(32).uint64(e.size),void 0!==e.mode&&t.uint32(40).uint32(e.mode),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMountFile();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.filename=n.string();continue;case 3:if(26!==e)break;a.sha256Hex=n.string();continue;case 4:if(32!==e)break;a.size=longToNumber2(n.uint64());continue;case 5:if(40!==e)break;a.mode=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({filename:isSet4(e.filename)?globalThis.String(e.filename):"",sha256Hex:isSet4(e.sha256Hex)?globalThis.String(e.sha256Hex):"",size:isSet4(e.size)?globalThis.Number(e.size):void 0,mode:isSet4(e.mode)?globalThis.Number(e.mode):void 0}),toJSON(e){const t={};return""!==e.filename&&(t.filename=e.filename),""!==e.sha256Hex&&(t.sha256Hex=e.sha256Hex),void 0!==e.size&&(t.size=Math.round(e.size)),void 0!==e.mode&&(t.mode=Math.round(e.mode)),t},create:e=>MountFile.fromPartial(e??{}),fromPartial(e){const t=createBaseMountFile();return t.filename=e.filename??"",t.sha256Hex=e.sha256Hex??"",t.size=e.size??void 0,t.mode=e.mode??void 0,t}};function createBaseMountGetOrCreateRequest(){return{deploymentName:"",namespace:0,environmentName:"",objectCreationType:0,files:[],appId:""}}var MountGetOrCreateRequest={encode(e,t=new BinaryWriter){""!==e.deploymentName&&t.uint32(10).string(e.deploymentName),0!==e.namespace&&t.uint32(16).int32(e.namespace),""!==e.environmentName&&t.uint32(26).string(e.environmentName),0!==e.objectCreationType&&t.uint32(32).int32(e.objectCreationType);for(const n of e.files)MountFile.encode(n,t.uint32(42).fork()).join();return""!==e.appId&&t.uint32(50).string(e.appId),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMountGetOrCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.deploymentName=n.string();continue;case 2:if(16!==e)break;a.namespace=n.int32();continue;case 3:if(26!==e)break;a.environmentName=n.string();continue;case 4:if(32!==e)break;a.objectCreationType=n.int32();continue;case 5:if(42!==e)break;a.files.push(MountFile.decode(n,n.uint32()));continue;case 6:if(50!==e)break;a.appId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({deploymentName:isSet4(e.deploymentName)?globalThis.String(e.deploymentName):"",namespace:isSet4(e.namespace)?deploymentNamespaceFromJSON(e.namespace):0,environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",objectCreationType:isSet4(e.objectCreationType)?objectCreationTypeFromJSON(e.objectCreationType):0,files:globalThis.Array.isArray(e?.files)?e.files.map((e=>MountFile.fromJSON(e))):[],appId:isSet4(e.appId)?globalThis.String(e.appId):""}),toJSON(e){const t={};return""!==e.deploymentName&&(t.deploymentName=e.deploymentName),0!==e.namespace&&(t.namespace=deploymentNamespaceToJSON(e.namespace)),""!==e.environmentName&&(t.environmentName=e.environmentName),0!==e.objectCreationType&&(t.objectCreationType=objectCreationTypeToJSON(e.objectCreationType)),e.files?.length&&(t.files=e.files.map((e=>MountFile.toJSON(e)))),""!==e.appId&&(t.appId=e.appId),t},create:e=>MountGetOrCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseMountGetOrCreateRequest();return t.deploymentName=e.deploymentName??"",t.namespace=e.namespace??0,t.environmentName=e.environmentName??"",t.objectCreationType=e.objectCreationType??0,t.files=e.files?.map((e=>MountFile.fromPartial(e)))||[],t.appId=e.appId??"",t}};function createBaseMountGetOrCreateResponse(){return{mountId:"",handleMetadata:void 0}}var MountGetOrCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.mountId&&t.uint32(10).string(e.mountId),void 0!==e.handleMetadata&&MountHandleMetadata.encode(e.handleMetadata,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMountGetOrCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.mountId=n.string();continue;case 2:if(18!==e)break;a.handleMetadata=MountHandleMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({mountId:isSet4(e.mountId)?globalThis.String(e.mountId):"",handleMetadata:isSet4(e.handleMetadata)?MountHandleMetadata.fromJSON(e.handleMetadata):void 0}),toJSON(e){const t={};return""!==e.mountId&&(t.mountId=e.mountId),void 0!==e.handleMetadata&&(t.handleMetadata=MountHandleMetadata.toJSON(e.handleMetadata)),t},create:e=>MountGetOrCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseMountGetOrCreateResponse();return t.mountId=e.mountId??"",t.handleMetadata=void 0!==e.handleMetadata&&null!==e.handleMetadata?MountHandleMetadata.fromPartial(e.handleMetadata):void 0,t}};function createBaseMountHandleMetadata(){return{contentChecksumSha256Hex:""}}var MountHandleMetadata={encode:(e,t=new BinaryWriter)=>(""!==e.contentChecksumSha256Hex&&t.uint32(10).string(e.contentChecksumSha256Hex),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMountHandleMetadata();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.contentChecksumSha256Hex=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({contentChecksumSha256Hex:isSet4(e.contentChecksumSha256Hex)?globalThis.String(e.contentChecksumSha256Hex):""}),toJSON(e){const t={};return""!==e.contentChecksumSha256Hex&&(t.contentChecksumSha256Hex=e.contentChecksumSha256Hex),t},create:e=>MountHandleMetadata.fromPartial(e??{}),fromPartial(e){const t=createBaseMountHandleMetadata();return t.contentChecksumSha256Hex=e.contentChecksumSha256Hex??"",t}};function createBaseMountPutFileRequest(){return{sha256Hex:"",data:void 0,dataBlobId:void 0}}var MountPutFileRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sha256Hex&&t.uint32(18).string(e.sha256Hex),void 0!==e.data&&t.uint32(26).bytes(e.data),void 0!==e.dataBlobId&&t.uint32(42).string(e.dataBlobId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMountPutFileRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 2:if(18!==e)break;a.sha256Hex=n.string();continue;case 3:if(26!==e)break;a.data=n.bytes();continue;case 5:if(42!==e)break;a.dataBlobId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sha256Hex:isSet4(e.sha256Hex)?globalThis.String(e.sha256Hex):"",data:isSet4(e.data)?bytesFromBase64(e.data):void 0,dataBlobId:isSet4(e.dataBlobId)?globalThis.String(e.dataBlobId):void 0}),toJSON(e){const t={};return""!==e.sha256Hex&&(t.sha256Hex=e.sha256Hex),void 0!==e.data&&(t.data=base64FromBytes(e.data)),void 0!==e.dataBlobId&&(t.dataBlobId=e.dataBlobId),t},create:e=>MountPutFileRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseMountPutFileRequest();return t.sha256Hex=e.sha256Hex??"",t.data=e.data??void 0,t.dataBlobId=e.dataBlobId??void 0,t}};function createBaseMountPutFileResponse(){return{exists:!1}}var MountPutFileResponse={encode:(e,t=new BinaryWriter)=>(!1!==e.exists&&t.uint32(16).bool(e.exists),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMountPutFileResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 2:if(16!==e)break;a.exists=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({exists:!!isSet4(e.exists)&&globalThis.Boolean(e.exists)}),toJSON(e){const t={};return!1!==e.exists&&(t.exists=e.exists),t},create:e=>MountPutFileResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseMountPutFileResponse();return t.exists=e.exists??!1,t}};function createBaseMultiPartUpload(){return{partLength:0,uploadUrls:[],completionUrl:""}}var MultiPartUpload={encode(e,t=new BinaryWriter){0!==e.partLength&&t.uint32(8).int64(e.partLength);for(const n of e.uploadUrls)t.uint32(18).string(n);return""!==e.completionUrl&&t.uint32(26).string(e.completionUrl),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMultiPartUpload();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.partLength=longToNumber2(n.int64());continue;case 2:if(18!==e)break;a.uploadUrls.push(n.string());continue;case 3:if(26!==e)break;a.completionUrl=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({partLength:isSet4(e.partLength)?globalThis.Number(e.partLength):0,uploadUrls:globalThis.Array.isArray(e?.uploadUrls)?e.uploadUrls.map((e=>globalThis.String(e))):[],completionUrl:isSet4(e.completionUrl)?globalThis.String(e.completionUrl):""}),toJSON(e){const t={};return 0!==e.partLength&&(t.partLength=Math.round(e.partLength)),e.uploadUrls?.length&&(t.uploadUrls=e.uploadUrls),""!==e.completionUrl&&(t.completionUrl=e.completionUrl),t},create:e=>MultiPartUpload.fromPartial(e??{}),fromPartial(e){const t=createBaseMultiPartUpload();return t.partLength=e.partLength??0,t.uploadUrls=e.uploadUrls?.map((e=>e))||[],t.completionUrl=e.completionUrl??"",t}};function createBaseMultiPartUploadList(){return{items:[]}}var MultiPartUploadList={encode(e,t=new BinaryWriter){for(const n of e.items)MultiPartUpload.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseMultiPartUploadList();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.items.push(MultiPartUpload.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({items:globalThis.Array.isArray(e?.items)?e.items.map((e=>MultiPartUpload.fromJSON(e))):[]}),toJSON(e){const t={};return e.items?.length&&(t.items=e.items.map((e=>MultiPartUpload.toJSON(e)))),t},create:e=>MultiPartUploadList.fromPartial(e??{}),fromPartial(e){const t=createBaseMultiPartUploadList();return t.items=e.items?.map((e=>MultiPartUpload.fromPartial(e)))||[],t}};function createBaseNetworkAccess(){return{networkAccessType:0,allowedCidrs:[]}}var NetworkAccess={encode(e,t=new BinaryWriter){0!==e.networkAccessType&&t.uint32(8).int32(e.networkAccessType);for(const n of e.allowedCidrs)t.uint32(18).string(n);return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseNetworkAccess();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.networkAccessType=n.int32();continue;case 2:if(18!==e)break;a.allowedCidrs.push(n.string());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({networkAccessType:isSet4(e.networkAccessType)?networkAccess_NetworkAccessTypeFromJSON(e.networkAccessType):0,allowedCidrs:globalThis.Array.isArray(e?.allowedCidrs)?e.allowedCidrs.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return 0!==e.networkAccessType&&(t.networkAccessType=networkAccess_NetworkAccessTypeToJSON(e.networkAccessType)),e.allowedCidrs?.length&&(t.allowedCidrs=e.allowedCidrs),t},create:e=>NetworkAccess.fromPartial(e??{}),fromPartial(e){const t=createBaseNetworkAccess();return t.networkAccessType=e.networkAccessType??0,t.allowedCidrs=e.allowedCidrs?.map((e=>e))||[],t}};function createBaseNotebookKernelPublishResultsRequest(){return{notebookId:"",results:[]}}var NotebookKernelPublishResultsRequest={encode(e,t=new BinaryWriter){""!==e.notebookId&&t.uint32(10).string(e.notebookId);for(const n of e.results)NotebookKernelPublishResultsRequest_CellResult.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseNotebookKernelPublishResultsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.notebookId=n.string();continue;case 2:if(18!==e)break;a.results.push(NotebookKernelPublishResultsRequest_CellResult.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({notebookId:isSet4(e.notebookId)?globalThis.String(e.notebookId):"",results:globalThis.Array.isArray(e?.results)?e.results.map((e=>NotebookKernelPublishResultsRequest_CellResult.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.notebookId&&(t.notebookId=e.notebookId),e.results?.length&&(t.results=e.results.map((e=>NotebookKernelPublishResultsRequest_CellResult.toJSON(e)))),t},create:e=>NotebookKernelPublishResultsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseNotebookKernelPublishResultsRequest();return t.notebookId=e.notebookId??"",t.results=e.results?.map((e=>NotebookKernelPublishResultsRequest_CellResult.fromPartial(e)))||[],t}};function createBaseNotebookKernelPublishResultsRequest_ExecuteReply(){return{status:"",executionCount:0,duration:0}}var NotebookKernelPublishResultsRequest_ExecuteReply={encode:(e,t=new BinaryWriter)=>(""!==e.status&&t.uint32(10).string(e.status),0!==e.executionCount&&t.uint32(16).uint32(e.executionCount),0!==e.duration&&t.uint32(25).double(e.duration),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseNotebookKernelPublishResultsRequest_ExecuteReply();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.status=n.string();continue;case 2:if(16!==e)break;a.executionCount=n.uint32();continue;case 3:if(25!==e)break;a.duration=n.double();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({status:isSet4(e.status)?globalThis.String(e.status):"",executionCount:isSet4(e.executionCount)?globalThis.Number(e.executionCount):0,duration:isSet4(e.duration)?globalThis.Number(e.duration):0}),toJSON(e){const t={};return""!==e.status&&(t.status=e.status),0!==e.executionCount&&(t.executionCount=Math.round(e.executionCount)),0!==e.duration&&(t.duration=e.duration),t},create:e=>NotebookKernelPublishResultsRequest_ExecuteReply.fromPartial(e??{}),fromPartial(e){const t=createBaseNotebookKernelPublishResultsRequest_ExecuteReply();return t.status=e.status??"",t.executionCount=e.executionCount??0,t.duration=e.duration??0,t}};function createBaseNotebookKernelPublishResultsRequest_CellResult(){return{cellId:"",output:void 0,clearOutput:void 0,executeReply:void 0}}var NotebookKernelPublishResultsRequest_CellResult={encode:(e,t=new BinaryWriter)=>(""!==e.cellId&&t.uint32(10).string(e.cellId),void 0!==e.output&&NotebookOutput.encode(e.output,t.uint32(18).fork()).join(),void 0!==e.clearOutput&&t.uint32(24).bool(e.clearOutput),void 0!==e.executeReply&&NotebookKernelPublishResultsRequest_ExecuteReply.encode(e.executeReply,t.uint32(34).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseNotebookKernelPublishResultsRequest_CellResult();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.cellId=n.string();continue;case 2:if(18!==e)break;a.output=NotebookOutput.decode(n,n.uint32());continue;case 3:if(24!==e)break;a.clearOutput=n.bool();continue;case 4:if(34!==e)break;a.executeReply=NotebookKernelPublishResultsRequest_ExecuteReply.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({cellId:isSet4(e.cellId)?globalThis.String(e.cellId):"",output:isSet4(e.output)?NotebookOutput.fromJSON(e.output):void 0,clearOutput:isSet4(e.clearOutput)?globalThis.Boolean(e.clearOutput):void 0,executeReply:isSet4(e.executeReply)?NotebookKernelPublishResultsRequest_ExecuteReply.fromJSON(e.executeReply):void 0}),toJSON(e){const t={};return""!==e.cellId&&(t.cellId=e.cellId),void 0!==e.output&&(t.output=NotebookOutput.toJSON(e.output)),void 0!==e.clearOutput&&(t.clearOutput=e.clearOutput),void 0!==e.executeReply&&(t.executeReply=NotebookKernelPublishResultsRequest_ExecuteReply.toJSON(e.executeReply)),t},create:e=>NotebookKernelPublishResultsRequest_CellResult.fromPartial(e??{}),fromPartial(e){const t=createBaseNotebookKernelPublishResultsRequest_CellResult();return t.cellId=e.cellId??"",t.output=void 0!==e.output&&null!==e.output?NotebookOutput.fromPartial(e.output):void 0,t.clearOutput=e.clearOutput??void 0,t.executeReply=void 0!==e.executeReply&&null!==e.executeReply?NotebookKernelPublishResultsRequest_ExecuteReply.fromPartial(e.executeReply):void 0,t}};function createBaseNotebookOutput(){return{executeResult:void 0,displayData:void 0,stream:void 0,error:void 0}}var NotebookOutput={encode:(e,t=new BinaryWriter)=>(void 0!==e.executeResult&&NotebookOutput_ExecuteResult.encode(e.executeResult,t.uint32(10).fork()).join(),void 0!==e.displayData&&NotebookOutput_DisplayData.encode(e.displayData,t.uint32(18).fork()).join(),void 0!==e.stream&&NotebookOutput_Stream.encode(e.stream,t.uint32(26).fork()).join(),void 0!==e.error&&NotebookOutput_Error.encode(e.error,t.uint32(34).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseNotebookOutput();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.executeResult=NotebookOutput_ExecuteResult.decode(n,n.uint32());continue;case 2:if(18!==e)break;a.displayData=NotebookOutput_DisplayData.decode(n,n.uint32());continue;case 3:if(26!==e)break;a.stream=NotebookOutput_Stream.decode(n,n.uint32());continue;case 4:if(34!==e)break;a.error=NotebookOutput_Error.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({executeResult:isSet4(e.executeResult)?NotebookOutput_ExecuteResult.fromJSON(e.executeResult):void 0,displayData:isSet4(e.displayData)?NotebookOutput_DisplayData.fromJSON(e.displayData):void 0,stream:isSet4(e.stream)?NotebookOutput_Stream.fromJSON(e.stream):void 0,error:isSet4(e.error)?NotebookOutput_Error.fromJSON(e.error):void 0}),toJSON(e){const t={};return void 0!==e.executeResult&&(t.executeResult=NotebookOutput_ExecuteResult.toJSON(e.executeResult)),void 0!==e.displayData&&(t.displayData=NotebookOutput_DisplayData.toJSON(e.displayData)),void 0!==e.stream&&(t.stream=NotebookOutput_Stream.toJSON(e.stream)),void 0!==e.error&&(t.error=NotebookOutput_Error.toJSON(e.error)),t},create:e=>NotebookOutput.fromPartial(e??{}),fromPartial(e){const t=createBaseNotebookOutput();return t.executeResult=void 0!==e.executeResult&&null!==e.executeResult?NotebookOutput_ExecuteResult.fromPartial(e.executeResult):void 0,t.displayData=void 0!==e.displayData&&null!==e.displayData?NotebookOutput_DisplayData.fromPartial(e.displayData):void 0,t.stream=void 0!==e.stream&&null!==e.stream?NotebookOutput_Stream.fromPartial(e.stream):void 0,t.error=void 0!==e.error&&null!==e.error?NotebookOutput_Error.fromPartial(e.error):void 0,t}};function createBaseNotebookOutput_ExecuteResult(){return{executionCount:0,data:void 0,metadata:void 0}}var NotebookOutput_ExecuteResult={encode:(e,t=new BinaryWriter)=>(0!==e.executionCount&&t.uint32(8).uint32(e.executionCount),void 0!==e.data&&Struct.encode(Struct.wrap(e.data),t.uint32(18).fork()).join(),void 0!==e.metadata&&Struct.encode(Struct.wrap(e.metadata),t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseNotebookOutput_ExecuteResult();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.executionCount=n.uint32();continue;case 2:if(18!==e)break;a.data=Struct.unwrap(Struct.decode(n,n.uint32()));continue;case 3:if(26!==e)break;a.metadata=Struct.unwrap(Struct.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({executionCount:isSet4(e.executionCount)?globalThis.Number(e.executionCount):0,data:isObject2(e.data)?e.data:void 0,metadata:isObject2(e.metadata)?e.metadata:void 0}),toJSON(e){const t={};return 0!==e.executionCount&&(t.executionCount=Math.round(e.executionCount)),void 0!==e.data&&(t.data=e.data),void 0!==e.metadata&&(t.metadata=e.metadata),t},create:e=>NotebookOutput_ExecuteResult.fromPartial(e??{}),fromPartial(e){const t=createBaseNotebookOutput_ExecuteResult();return t.executionCount=e.executionCount??0,t.data=e.data??void 0,t.metadata=e.metadata??void 0,t}};function createBaseNotebookOutput_DisplayData(){return{data:void 0,metadata:void 0,transientDisplayId:void 0}}var NotebookOutput_DisplayData={encode:(e,t=new BinaryWriter)=>(void 0!==e.data&&Struct.encode(Struct.wrap(e.data),t.uint32(10).fork()).join(),void 0!==e.metadata&&Struct.encode(Struct.wrap(e.metadata),t.uint32(18).fork()).join(),void 0!==e.transientDisplayId&&t.uint32(26).string(e.transientDisplayId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseNotebookOutput_DisplayData();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.data=Struct.unwrap(Struct.decode(n,n.uint32()));continue;case 2:if(18!==e)break;a.metadata=Struct.unwrap(Struct.decode(n,n.uint32()));continue;case 3:if(26!==e)break;a.transientDisplayId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({data:isObject2(e.data)?e.data:void 0,metadata:isObject2(e.metadata)?e.metadata:void 0,transientDisplayId:isSet4(e.transientDisplayId)?globalThis.String(e.transientDisplayId):void 0}),toJSON(e){const t={};return void 0!==e.data&&(t.data=e.data),void 0!==e.metadata&&(t.metadata=e.metadata),void 0!==e.transientDisplayId&&(t.transientDisplayId=e.transientDisplayId),t},create:e=>NotebookOutput_DisplayData.fromPartial(e??{}),fromPartial(e){const t=createBaseNotebookOutput_DisplayData();return t.data=e.data??void 0,t.metadata=e.metadata??void 0,t.transientDisplayId=e.transientDisplayId??void 0,t}};function createBaseNotebookOutput_Stream(){return{name:"",text:""}}var NotebookOutput_Stream={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),""!==e.text&&t.uint32(18).string(e.text),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseNotebookOutput_Stream();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(18!==e)break;a.text=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",text:isSet4(e.text)?globalThis.String(e.text):""}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),""!==e.text&&(t.text=e.text),t},create:e=>NotebookOutput_Stream.fromPartial(e??{}),fromPartial(e){const t=createBaseNotebookOutput_Stream();return t.name=e.name??"",t.text=e.text??"",t}};function createBaseNotebookOutput_Error(){return{ename:"",evalue:"",traceback:[]}}var NotebookOutput_Error={encode(e,t=new BinaryWriter){""!==e.ename&&t.uint32(10).string(e.ename),""!==e.evalue&&t.uint32(18).string(e.evalue);for(const n of e.traceback)t.uint32(26).string(n);return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseNotebookOutput_Error();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.ename=n.string();continue;case 2:if(18!==e)break;a.evalue=n.string();continue;case 3:if(26!==e)break;a.traceback.push(n.string());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({ename:isSet4(e.ename)?globalThis.String(e.ename):"",evalue:isSet4(e.evalue)?globalThis.String(e.evalue):"",traceback:globalThis.Array.isArray(e?.traceback)?e.traceback.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return""!==e.ename&&(t.ename=e.ename),""!==e.evalue&&(t.evalue=e.evalue),e.traceback?.length&&(t.traceback=e.traceback),t},create:e=>NotebookOutput_Error.fromPartial(e??{}),fromPartial(e){const t=createBaseNotebookOutput_Error();return t.ename=e.ename??"",t.evalue=e.evalue??"",t.traceback=e.traceback?.map((e=>e))||[],t}};function createBaseObject(){return{objectId:"",functionHandleMetadata:void 0,mountHandleMetadata:void 0,classHandleMetadata:void 0,sandboxHandleMetadata:void 0,volumeMetadata:void 0}}var Object_={encode:(e,t=new BinaryWriter)=>(""!==e.objectId&&t.uint32(10).string(e.objectId),void 0!==e.functionHandleMetadata&&FunctionHandleMetadata.encode(e.functionHandleMetadata,t.uint32(26).fork()).join(),void 0!==e.mountHandleMetadata&&MountHandleMetadata.encode(e.mountHandleMetadata,t.uint32(34).fork()).join(),void 0!==e.classHandleMetadata&&ClassHandleMetadata.encode(e.classHandleMetadata,t.uint32(42).fork()).join(),void 0!==e.sandboxHandleMetadata&&SandboxHandleMetadata.encode(e.sandboxHandleMetadata,t.uint32(50).fork()).join(),void 0!==e.volumeMetadata&&VolumeMetadata.encode(e.volumeMetadata,t.uint32(58).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseObject();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.objectId=n.string();continue;case 3:if(26!==e)break;a.functionHandleMetadata=FunctionHandleMetadata.decode(n,n.uint32());continue;case 4:if(34!==e)break;a.mountHandleMetadata=MountHandleMetadata.decode(n,n.uint32());continue;case 5:if(42!==e)break;a.classHandleMetadata=ClassHandleMetadata.decode(n,n.uint32());continue;case 6:if(50!==e)break;a.sandboxHandleMetadata=SandboxHandleMetadata.decode(n,n.uint32());continue;case 7:if(58!==e)break;a.volumeMetadata=VolumeMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({objectId:isSet4(e.objectId)?globalThis.String(e.objectId):"",functionHandleMetadata:isSet4(e.functionHandleMetadata)?FunctionHandleMetadata.fromJSON(e.functionHandleMetadata):void 0,mountHandleMetadata:isSet4(e.mountHandleMetadata)?MountHandleMetadata.fromJSON(e.mountHandleMetadata):void 0,classHandleMetadata:isSet4(e.classHandleMetadata)?ClassHandleMetadata.fromJSON(e.classHandleMetadata):void 0,sandboxHandleMetadata:isSet4(e.sandboxHandleMetadata)?SandboxHandleMetadata.fromJSON(e.sandboxHandleMetadata):void 0,volumeMetadata:isSet4(e.volumeMetadata)?VolumeMetadata.fromJSON(e.volumeMetadata):void 0}),toJSON(e){const t={};return""!==e.objectId&&(t.objectId=e.objectId),void 0!==e.functionHandleMetadata&&(t.functionHandleMetadata=FunctionHandleMetadata.toJSON(e.functionHandleMetadata)),void 0!==e.mountHandleMetadata&&(t.mountHandleMetadata=MountHandleMetadata.toJSON(e.mountHandleMetadata)),void 0!==e.classHandleMetadata&&(t.classHandleMetadata=ClassHandleMetadata.toJSON(e.classHandleMetadata)),void 0!==e.sandboxHandleMetadata&&(t.sandboxHandleMetadata=SandboxHandleMetadata.toJSON(e.sandboxHandleMetadata)),void 0!==e.volumeMetadata&&(t.volumeMetadata=VolumeMetadata.toJSON(e.volumeMetadata)),t},create:e=>Object_.fromPartial(e??{}),fromPartial(e){const t=createBaseObject();return t.objectId=e.objectId??"",t.functionHandleMetadata=void 0!==e.functionHandleMetadata&&null!==e.functionHandleMetadata?FunctionHandleMetadata.fromPartial(e.functionHandleMetadata):void 0,t.mountHandleMetadata=void 0!==e.mountHandleMetadata&&null!==e.mountHandleMetadata?MountHandleMetadata.fromPartial(e.mountHandleMetadata):void 0,t.classHandleMetadata=void 0!==e.classHandleMetadata&&null!==e.classHandleMetadata?ClassHandleMetadata.fromPartial(e.classHandleMetadata):void 0,t.sandboxHandleMetadata=void 0!==e.sandboxHandleMetadata&&null!==e.sandboxHandleMetadata?SandboxHandleMetadata.fromPartial(e.sandboxHandleMetadata):void 0,t.volumeMetadata=void 0!==e.volumeMetadata&&null!==e.volumeMetadata?VolumeMetadata.fromPartial(e.volumeMetadata):void 0,t}};function createBaseObjectDependency(){return{objectId:""}}var ObjectDependency={encode:(e,t=new BinaryWriter)=>(""!==e.objectId&&t.uint32(10).string(e.objectId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseObjectDependency();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.objectId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({objectId:isSet4(e.objectId)?globalThis.String(e.objectId):""}),toJSON(e){const t={};return""!==e.objectId&&(t.objectId=e.objectId),t},create:e=>ObjectDependency.fromPartial(e??{}),fromPartial(e){const t=createBaseObjectDependency();return t.objectId=e.objectId??"",t}};function createBasePTYInfo(){return{enabled:!1,winszRows:0,winszCols:0,envTerm:"",envColorterm:"",envTermProgram:"",ptyType:0,noTerminateOnIdleStdin:!1}}var PTYInfo={encode:(e,t=new BinaryWriter)=>(!1!==e.enabled&&t.uint32(8).bool(e.enabled),0!==e.winszRows&&t.uint32(16).uint32(e.winszRows),0!==e.winszCols&&t.uint32(24).uint32(e.winszCols),""!==e.envTerm&&t.uint32(34).string(e.envTerm),""!==e.envColorterm&&t.uint32(42).string(e.envColorterm),""!==e.envTermProgram&&t.uint32(50).string(e.envTermProgram),0!==e.ptyType&&t.uint32(56).int32(e.ptyType),!1!==e.noTerminateOnIdleStdin&&t.uint32(64).bool(e.noTerminateOnIdleStdin),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBasePTYInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.enabled=n.bool();continue;case 2:if(16!==e)break;a.winszRows=n.uint32();continue;case 3:if(24!==e)break;a.winszCols=n.uint32();continue;case 4:if(34!==e)break;a.envTerm=n.string();continue;case 5:if(42!==e)break;a.envColorterm=n.string();continue;case 6:if(50!==e)break;a.envTermProgram=n.string();continue;case 7:if(56!==e)break;a.ptyType=n.int32();continue;case 8:if(64!==e)break;a.noTerminateOnIdleStdin=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({enabled:!!isSet4(e.enabled)&&globalThis.Boolean(e.enabled),winszRows:isSet4(e.winszRows)?globalThis.Number(e.winszRows):0,winszCols:isSet4(e.winszCols)?globalThis.Number(e.winszCols):0,envTerm:isSet4(e.envTerm)?globalThis.String(e.envTerm):"",envColorterm:isSet4(e.envColorterm)?globalThis.String(e.envColorterm):"",envTermProgram:isSet4(e.envTermProgram)?globalThis.String(e.envTermProgram):"",ptyType:isSet4(e.ptyType)?pTYInfo_PTYTypeFromJSON(e.ptyType):0,noTerminateOnIdleStdin:!!isSet4(e.noTerminateOnIdleStdin)&&globalThis.Boolean(e.noTerminateOnIdleStdin)}),toJSON(e){const t={};return!1!==e.enabled&&(t.enabled=e.enabled),0!==e.winszRows&&(t.winszRows=Math.round(e.winszRows)),0!==e.winszCols&&(t.winszCols=Math.round(e.winszCols)),""!==e.envTerm&&(t.envTerm=e.envTerm),""!==e.envColorterm&&(t.envColorterm=e.envColorterm),""!==e.envTermProgram&&(t.envTermProgram=e.envTermProgram),0!==e.ptyType&&(t.ptyType=pTYInfo_PTYTypeToJSON(e.ptyType)),!1!==e.noTerminateOnIdleStdin&&(t.noTerminateOnIdleStdin=e.noTerminateOnIdleStdin),t},create:e=>PTYInfo.fromPartial(e??{}),fromPartial(e){const t=createBasePTYInfo();return t.enabled=e.enabled??!1,t.winszRows=e.winszRows??0,t.winszCols=e.winszCols??0,t.envTerm=e.envTerm??"",t.envColorterm=e.envColorterm??"",t.envTermProgram=e.envTermProgram??"",t.ptyType=e.ptyType??0,t.noTerminateOnIdleStdin=e.noTerminateOnIdleStdin??!1,t}};function createBasePortSpec(){return{port:0,unencrypted:!1,tunnelType:void 0}}var PortSpec={encode:(e,t=new BinaryWriter)=>(0!==e.port&&t.uint32(8).uint32(e.port),!1!==e.unencrypted&&t.uint32(16).bool(e.unencrypted),void 0!==e.tunnelType&&t.uint32(24).int32(e.tunnelType),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBasePortSpec();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.port=n.uint32();continue;case 2:if(16!==e)break;a.unencrypted=n.bool();continue;case 3:if(24!==e)break;a.tunnelType=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({port:isSet4(e.port)?globalThis.Number(e.port):0,unencrypted:!!isSet4(e.unencrypted)&&globalThis.Boolean(e.unencrypted),tunnelType:isSet4(e.tunnelType)?tunnelTypeFromJSON(e.tunnelType):void 0}),toJSON(e){const t={};return 0!==e.port&&(t.port=Math.round(e.port)),!1!==e.unencrypted&&(t.unencrypted=e.unencrypted),void 0!==e.tunnelType&&(t.tunnelType=tunnelTypeToJSON(e.tunnelType)),t},create:e=>PortSpec.fromPartial(e??{}),fromPartial(e){const t=createBasePortSpec();return t.port=e.port??0,t.unencrypted=e.unencrypted??!1,t.tunnelType=e.tunnelType??void 0,t}};function createBasePortSpecs(){return{ports:[]}}var PortSpecs={encode(e,t=new BinaryWriter){for(const n of e.ports)PortSpec.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBasePortSpecs();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.ports.push(PortSpec.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({ports:globalThis.Array.isArray(e?.ports)?e.ports.map((e=>PortSpec.fromJSON(e))):[]}),toJSON(e){const t={};return e.ports?.length&&(t.ports=e.ports.map((e=>PortSpec.toJSON(e)))),t},create:e=>PortSpecs.fromPartial(e??{}),fromPartial(e){const t=createBasePortSpecs();return t.ports=e.ports?.map((e=>PortSpec.fromPartial(e)))||[],t}};function createBaseProbe(){return{tcpPort:void 0,execCommand:void 0,intervalMs:void 0}}var Probe={encode:(e,t=new BinaryWriter)=>(void 0!==e.tcpPort&&t.uint32(8).uint32(e.tcpPort),void 0!==e.execCommand&&Probe_ExecCommand.encode(e.execCommand,t.uint32(18).fork()).join(),void 0!==e.intervalMs&&t.uint32(24).uint32(e.intervalMs),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProbe();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.tcpPort=n.uint32();continue;case 2:if(18!==e)break;a.execCommand=Probe_ExecCommand.decode(n,n.uint32());continue;case 3:if(24!==e)break;a.intervalMs=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({tcpPort:isSet4(e.tcpPort)?globalThis.Number(e.tcpPort):void 0,execCommand:isSet4(e.execCommand)?Probe_ExecCommand.fromJSON(e.execCommand):void 0,intervalMs:isSet4(e.intervalMs)?globalThis.Number(e.intervalMs):void 0}),toJSON(e){const t={};return void 0!==e.tcpPort&&(t.tcpPort=Math.round(e.tcpPort)),void 0!==e.execCommand&&(t.execCommand=Probe_ExecCommand.toJSON(e.execCommand)),void 0!==e.intervalMs&&(t.intervalMs=Math.round(e.intervalMs)),t},create:e=>Probe.fromPartial(e??{}),fromPartial(e){const t=createBaseProbe();return t.tcpPort=e.tcpPort??void 0,t.execCommand=void 0!==e.execCommand&&null!==e.execCommand?Probe_ExecCommand.fromPartial(e.execCommand):void 0,t.intervalMs=e.intervalMs??void 0,t}};function createBaseProbe_ExecCommand(){return{argv:[]}}var Probe_ExecCommand={encode(e,t=new BinaryWriter){for(const n of e.argv)t.uint32(10).string(n);return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProbe_ExecCommand();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.argv.push(n.string());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({argv:globalThis.Array.isArray(e?.argv)?e.argv.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return e.argv?.length&&(t.argv=e.argv),t},create:e=>Probe_ExecCommand.fromPartial(e??{}),fromPartial(e){const t=createBaseProbe_ExecCommand();return t.argv=e.argv?.map((e=>e))||[],t}};function createBaseProxy(){return{name:"",createdAt:0,environmentName:"",proxyIps:[],proxyId:"",region:""}}var Proxy2={encode(e,t=new BinaryWriter){""!==e.name&&t.uint32(10).string(e.name),0!==e.createdAt&&t.uint32(17).double(e.createdAt),""!==e.environmentName&&t.uint32(26).string(e.environmentName);for(const n of e.proxyIps)ProxyIp.encode(n,t.uint32(34).fork()).join();return""!==e.proxyId&&t.uint32(42).string(e.proxyId),""!==e.region&&t.uint32(50).string(e.region),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProxy();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(17!==e)break;a.createdAt=n.double();continue;case 3:if(26!==e)break;a.environmentName=n.string();continue;case 4:if(34!==e)break;a.proxyIps.push(ProxyIp.decode(n,n.uint32()));continue;case 5:if(42!==e)break;a.proxyId=n.string();continue;case 6:if(50!==e)break;a.region=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",proxyIps:globalThis.Array.isArray(e?.proxyIps)?e.proxyIps.map((e=>ProxyIp.fromJSON(e))):[],proxyId:isSet4(e.proxyId)?globalThis.String(e.proxyId):"",region:isSet4(e.region)?globalThis.String(e.region):""}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),0!==e.createdAt&&(t.createdAt=e.createdAt),""!==e.environmentName&&(t.environmentName=e.environmentName),e.proxyIps?.length&&(t.proxyIps=e.proxyIps.map((e=>ProxyIp.toJSON(e)))),""!==e.proxyId&&(t.proxyId=e.proxyId),""!==e.region&&(t.region=e.region),t},create:e=>Proxy2.fromPartial(e??{}),fromPartial(e){const t=createBaseProxy();return t.name=e.name??"",t.createdAt=e.createdAt??0,t.environmentName=e.environmentName??"",t.proxyIps=e.proxyIps?.map((e=>ProxyIp.fromPartial(e)))||[],t.proxyId=e.proxyId??"",t.region=e.region??"",t}};function createBaseProxyAddIpRequest(){return{proxyId:""}}var ProxyAddIpRequest={encode:(e,t=new BinaryWriter)=>(""!==e.proxyId&&t.uint32(10).string(e.proxyId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProxyAddIpRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.proxyId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({proxyId:isSet4(e.proxyId)?globalThis.String(e.proxyId):""}),toJSON(e){const t={};return""!==e.proxyId&&(t.proxyId=e.proxyId),t},create:e=>ProxyAddIpRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseProxyAddIpRequest();return t.proxyId=e.proxyId??"",t}};function createBaseProxyAddIpResponse(){return{proxyIp:void 0}}var ProxyAddIpResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.proxyIp&&ProxyIp.encode(e.proxyIp,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProxyAddIpResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.proxyIp=ProxyIp.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({proxyIp:isSet4(e.proxyIp)?ProxyIp.fromJSON(e.proxyIp):void 0}),toJSON(e){const t={};return void 0!==e.proxyIp&&(t.proxyIp=ProxyIp.toJSON(e.proxyIp)),t},create:e=>ProxyAddIpResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseProxyAddIpResponse();return t.proxyIp=void 0!==e.proxyIp&&null!==e.proxyIp?ProxyIp.fromPartial(e.proxyIp):void 0,t}};function createBaseProxyCreateRequest(){return{name:"",environmentName:"",region:""}}var ProxyCreateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),""!==e.environmentName&&t.uint32(18).string(e.environmentName),""!==e.region&&t.uint32(26).string(e.region),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProxyCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(18!==e)break;a.environmentName=n.string();continue;case 3:if(26!==e)break;a.region=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",region:isSet4(e.region)?globalThis.String(e.region):""}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),""!==e.environmentName&&(t.environmentName=e.environmentName),""!==e.region&&(t.region=e.region),t},create:e=>ProxyCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseProxyCreateRequest();return t.name=e.name??"",t.environmentName=e.environmentName??"",t.region=e.region??"",t}};function createBaseProxyCreateResponse(){return{proxy:void 0}}var ProxyCreateResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.proxy&&Proxy2.encode(e.proxy,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProxyCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.proxy=Proxy2.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({proxy:isSet4(e.proxy)?Proxy2.fromJSON(e.proxy):void 0}),toJSON(e){const t={};return void 0!==e.proxy&&(t.proxy=Proxy2.toJSON(e.proxy)),t},create:e=>ProxyCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseProxyCreateResponse();return t.proxy=void 0!==e.proxy&&null!==e.proxy?Proxy2.fromPartial(e.proxy):void 0,t}};function createBaseProxyDeleteRequest(){return{proxyId:""}}var ProxyDeleteRequest={encode:(e,t=new BinaryWriter)=>(""!==e.proxyId&&t.uint32(10).string(e.proxyId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProxyDeleteRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.proxyId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({proxyId:isSet4(e.proxyId)?globalThis.String(e.proxyId):""}),toJSON(e){const t={};return""!==e.proxyId&&(t.proxyId=e.proxyId),t},create:e=>ProxyDeleteRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseProxyDeleteRequest();return t.proxyId=e.proxyId??"",t}};function createBaseProxyGetOrCreateRequest(){return{deploymentName:"",environmentName:"",objectCreationType:0}}var ProxyGetOrCreateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.deploymentName&&t.uint32(10).string(e.deploymentName),""!==e.environmentName&&t.uint32(26).string(e.environmentName),0!==e.objectCreationType&&t.uint32(32).int32(e.objectCreationType),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProxyGetOrCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.deploymentName=n.string();continue;case 3:if(26!==e)break;a.environmentName=n.string();continue;case 4:if(32!==e)break;a.objectCreationType=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({deploymentName:isSet4(e.deploymentName)?globalThis.String(e.deploymentName):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",objectCreationType:isSet4(e.objectCreationType)?objectCreationTypeFromJSON(e.objectCreationType):0}),toJSON(e){const t={};return""!==e.deploymentName&&(t.deploymentName=e.deploymentName),""!==e.environmentName&&(t.environmentName=e.environmentName),0!==e.objectCreationType&&(t.objectCreationType=objectCreationTypeToJSON(e.objectCreationType)),t},create:e=>ProxyGetOrCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseProxyGetOrCreateRequest();return t.deploymentName=e.deploymentName??"",t.environmentName=e.environmentName??"",t.objectCreationType=e.objectCreationType??0,t}};function createBaseProxyGetOrCreateResponse(){return{proxyId:""}}var ProxyGetOrCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.proxyId&&t.uint32(10).string(e.proxyId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProxyGetOrCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.proxyId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({proxyId:isSet4(e.proxyId)?globalThis.String(e.proxyId):""}),toJSON(e){const t={};return""!==e.proxyId&&(t.proxyId=e.proxyId),t},create:e=>ProxyGetOrCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseProxyGetOrCreateResponse();return t.proxyId=e.proxyId??"",t}};function createBaseProxyGetRequest(){return{name:"",environmentName:""}}var ProxyGetRequest={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),""!==e.environmentName&&t.uint32(18).string(e.environmentName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProxyGetRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(18!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>ProxyGetRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseProxyGetRequest();return t.name=e.name??"",t.environmentName=e.environmentName??"",t}};function createBaseProxyGetResponse(){return{proxy:void 0}}var ProxyGetResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.proxy&&Proxy2.encode(e.proxy,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProxyGetResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.proxy=Proxy2.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({proxy:isSet4(e.proxy)?Proxy2.fromJSON(e.proxy):void 0}),toJSON(e){const t={};return void 0!==e.proxy&&(t.proxy=Proxy2.toJSON(e.proxy)),t},create:e=>ProxyGetResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseProxyGetResponse();return t.proxy=void 0!==e.proxy&&null!==e.proxy?Proxy2.fromPartial(e.proxy):void 0,t}};function createBaseProxyIp(){return{proxyIp:"",status:0,createdAt:0,environmentName:""}}var ProxyIp={encode:(e,t=new BinaryWriter)=>(""!==e.proxyIp&&t.uint32(10).string(e.proxyIp),0!==e.status&&t.uint32(16).int32(e.status),0!==e.createdAt&&t.uint32(25).double(e.createdAt),""!==e.environmentName&&t.uint32(34).string(e.environmentName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProxyIp();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.proxyIp=n.string();continue;case 2:if(16!==e)break;a.status=n.int32();continue;case 3:if(25!==e)break;a.createdAt=n.double();continue;case 4:if(34!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({proxyIp:isSet4(e.proxyIp)?globalThis.String(e.proxyIp):"",status:isSet4(e.status)?proxyIpStatusFromJSON(e.status):0,createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return""!==e.proxyIp&&(t.proxyIp=e.proxyIp),0!==e.status&&(t.status=proxyIpStatusToJSON(e.status)),0!==e.createdAt&&(t.createdAt=e.createdAt),""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>ProxyIp.fromPartial(e??{}),fromPartial(e){const t=createBaseProxyIp();return t.proxyIp=e.proxyIp??"",t.status=e.status??0,t.createdAt=e.createdAt??0,t.environmentName=e.environmentName??"",t}};function createBaseProxyListResponse(){return{proxies:[]}}var ProxyListResponse={encode(e,t=new BinaryWriter){for(const n of e.proxies)Proxy2.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProxyListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.proxies.push(Proxy2.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({proxies:globalThis.Array.isArray(e?.proxies)?e.proxies.map((e=>Proxy2.fromJSON(e))):[]}),toJSON(e){const t={};return e.proxies?.length&&(t.proxies=e.proxies.map((e=>Proxy2.toJSON(e)))),t},create:e=>ProxyListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseProxyListResponse();return t.proxies=e.proxies?.map((e=>Proxy2.fromPartial(e)))||[],t}};function createBaseProxyRemoveIpRequest(){return{proxyIp:""}}var ProxyRemoveIpRequest={encode:(e,t=new BinaryWriter)=>(""!==e.proxyIp&&t.uint32(10).string(e.proxyIp),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseProxyRemoveIpRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.proxyIp=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({proxyIp:isSet4(e.proxyIp)?globalThis.String(e.proxyIp):""}),toJSON(e){const t={};return""!==e.proxyIp&&(t.proxyIp=e.proxyIp),t},create:e=>ProxyRemoveIpRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseProxyRemoveIpRequest();return t.proxyIp=e.proxyIp??"",t}};function createBaseQueueClearRequest(){return{queueId:"",partitionKey:new Uint8Array(0),allPartitions:!1}}var QueueClearRequest={encode:(e,t=new BinaryWriter)=>(""!==e.queueId&&t.uint32(10).string(e.queueId),0!==e.partitionKey.length&&t.uint32(18).bytes(e.partitionKey),!1!==e.allPartitions&&t.uint32(24).bool(e.allPartitions),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueClearRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.queueId=n.string();continue;case 2:if(18!==e)break;a.partitionKey=n.bytes();continue;case 3:if(24!==e)break;a.allPartitions=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({queueId:isSet4(e.queueId)?globalThis.String(e.queueId):"",partitionKey:isSet4(e.partitionKey)?bytesFromBase64(e.partitionKey):new Uint8Array(0),allPartitions:!!isSet4(e.allPartitions)&&globalThis.Boolean(e.allPartitions)}),toJSON(e){const t={};return""!==e.queueId&&(t.queueId=e.queueId),0!==e.partitionKey.length&&(t.partitionKey=base64FromBytes(e.partitionKey)),!1!==e.allPartitions&&(t.allPartitions=e.allPartitions),t},create:e=>QueueClearRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueClearRequest();return t.queueId=e.queueId??"",t.partitionKey=e.partitionKey??new Uint8Array(0),t.allPartitions=e.allPartitions??!1,t}};function createBaseQueueDeleteRequest(){return{queueId:""}}var QueueDeleteRequest={encode:(e,t=new BinaryWriter)=>(""!==e.queueId&&t.uint32(10).string(e.queueId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueDeleteRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.queueId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({queueId:isSet4(e.queueId)?globalThis.String(e.queueId):""}),toJSON(e){const t={};return""!==e.queueId&&(t.queueId=e.queueId),t},create:e=>QueueDeleteRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueDeleteRequest();return t.queueId=e.queueId??"",t}};function createBaseQueueGetByIdRequest(){return{queueId:""}}var QueueGetByIdRequest={encode:(e,t=new BinaryWriter)=>(""!==e.queueId&&t.uint32(10).string(e.queueId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueGetByIdRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.queueId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({queueId:isSet4(e.queueId)?globalThis.String(e.queueId):""}),toJSON(e){const t={};return""!==e.queueId&&(t.queueId=e.queueId),t},create:e=>QueueGetByIdRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueGetByIdRequest();return t.queueId=e.queueId??"",t}};function createBaseQueueGetByIdResponse(){return{queueId:"",metadata:void 0}}var QueueGetByIdResponse={encode:(e,t=new BinaryWriter)=>(""!==e.queueId&&t.uint32(10).string(e.queueId),void 0!==e.metadata&&QueueMetadata.encode(e.metadata,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueGetByIdResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.queueId=n.string();continue;case 2:if(18!==e)break;a.metadata=QueueMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({queueId:isSet4(e.queueId)?globalThis.String(e.queueId):"",metadata:isSet4(e.metadata)?QueueMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.queueId&&(t.queueId=e.queueId),void 0!==e.metadata&&(t.metadata=QueueMetadata.toJSON(e.metadata)),t},create:e=>QueueGetByIdResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueGetByIdResponse();return t.queueId=e.queueId??"",t.metadata=void 0!==e.metadata&&null!==e.metadata?QueueMetadata.fromPartial(e.metadata):void 0,t}};function createBaseQueueGetOrCreateRequest(){return{deploymentName:"",environmentName:"",objectCreationType:0}}var QueueGetOrCreateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.deploymentName&&t.uint32(10).string(e.deploymentName),""!==e.environmentName&&t.uint32(26).string(e.environmentName),0!==e.objectCreationType&&t.uint32(32).int32(e.objectCreationType),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueGetOrCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.deploymentName=n.string();continue;case 3:if(26!==e)break;a.environmentName=n.string();continue;case 4:if(32!==e)break;a.objectCreationType=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({deploymentName:isSet4(e.deploymentName)?globalThis.String(e.deploymentName):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",objectCreationType:isSet4(e.objectCreationType)?objectCreationTypeFromJSON(e.objectCreationType):0}),toJSON(e){const t={};return""!==e.deploymentName&&(t.deploymentName=e.deploymentName),""!==e.environmentName&&(t.environmentName=e.environmentName),0!==e.objectCreationType&&(t.objectCreationType=objectCreationTypeToJSON(e.objectCreationType)),t},create:e=>QueueGetOrCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueGetOrCreateRequest();return t.deploymentName=e.deploymentName??"",t.environmentName=e.environmentName??"",t.objectCreationType=e.objectCreationType??0,t}};function createBaseQueueGetOrCreateResponse(){return{queueId:"",metadata:void 0}}var QueueGetOrCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.queueId&&t.uint32(10).string(e.queueId),void 0!==e.metadata&&QueueMetadata.encode(e.metadata,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueGetOrCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.queueId=n.string();continue;case 2:if(18!==e)break;a.metadata=QueueMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({queueId:isSet4(e.queueId)?globalThis.String(e.queueId):"",metadata:isSet4(e.metadata)?QueueMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.queueId&&(t.queueId=e.queueId),void 0!==e.metadata&&(t.metadata=QueueMetadata.toJSON(e.metadata)),t},create:e=>QueueGetOrCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueGetOrCreateResponse();return t.queueId=e.queueId??"",t.metadata=void 0!==e.metadata&&null!==e.metadata?QueueMetadata.fromPartial(e.metadata):void 0,t}};function createBaseQueueGetRequest(){return{queueId:"",timeout:0,nValues:0,partitionKey:new Uint8Array(0)}}var QueueGetRequest={encode:(e,t=new BinaryWriter)=>(""!==e.queueId&&t.uint32(10).string(e.queueId),0!==e.timeout&&t.uint32(29).float(e.timeout),0!==e.nValues&&t.uint32(32).int32(e.nValues),0!==e.partitionKey.length&&t.uint32(42).bytes(e.partitionKey),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueGetRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.queueId=n.string();continue;case 3:if(29!==e)break;a.timeout=n.float();continue;case 4:if(32!==e)break;a.nValues=n.int32();continue;case 5:if(42!==e)break;a.partitionKey=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({queueId:isSet4(e.queueId)?globalThis.String(e.queueId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0,nValues:isSet4(e.nValues)?globalThis.Number(e.nValues):0,partitionKey:isSet4(e.partitionKey)?bytesFromBase64(e.partitionKey):new Uint8Array(0)}),toJSON(e){const t={};return""!==e.queueId&&(t.queueId=e.queueId),0!==e.timeout&&(t.timeout=e.timeout),0!==e.nValues&&(t.nValues=Math.round(e.nValues)),0!==e.partitionKey.length&&(t.partitionKey=base64FromBytes(e.partitionKey)),t},create:e=>QueueGetRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueGetRequest();return t.queueId=e.queueId??"",t.timeout=e.timeout??0,t.nValues=e.nValues??0,t.partitionKey=e.partitionKey??new Uint8Array(0),t}};function createBaseQueueGetResponse(){return{values:[]}}var QueueGetResponse={encode(e,t=new BinaryWriter){for(const n of e.values)t.uint32(18).bytes(n);return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueGetResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 2:if(18!==e)break;a.values.push(n.bytes());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({values:globalThis.Array.isArray(e?.values)?e.values.map((e=>bytesFromBase64(e))):[]}),toJSON(e){const t={};return e.values?.length&&(t.values=e.values.map((e=>base64FromBytes(e)))),t},create:e=>QueueGetResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueGetResponse();return t.values=e.values?.map((e=>e))||[],t}};function createBaseQueueHeartbeatRequest(){return{queueId:""}}var QueueHeartbeatRequest={encode:(e,t=new BinaryWriter)=>(""!==e.queueId&&t.uint32(10).string(e.queueId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueHeartbeatRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.queueId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({queueId:isSet4(e.queueId)?globalThis.String(e.queueId):""}),toJSON(e){const t={};return""!==e.queueId&&(t.queueId=e.queueId),t},create:e=>QueueHeartbeatRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueHeartbeatRequest();return t.queueId=e.queueId??"",t}};function createBaseQueueItem(){return{value:new Uint8Array(0),entryId:""}}var QueueItem={encode:(e,t=new BinaryWriter)=>(0!==e.value.length&&t.uint32(10).bytes(e.value),""!==e.entryId&&t.uint32(18).string(e.entryId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.value=n.bytes();continue;case 2:if(18!==e)break;a.entryId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({value:isSet4(e.value)?bytesFromBase64(e.value):new Uint8Array(0),entryId:isSet4(e.entryId)?globalThis.String(e.entryId):""}),toJSON(e){const t={};return 0!==e.value.length&&(t.value=base64FromBytes(e.value)),""!==e.entryId&&(t.entryId=e.entryId),t},create:e=>QueueItem.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueItem();return t.value=e.value??new Uint8Array(0),t.entryId=e.entryId??"",t}};function createBaseQueueLenRequest(){return{queueId:"",partitionKey:new Uint8Array(0),total:!1}}var QueueLenRequest={encode:(e,t=new BinaryWriter)=>(""!==e.queueId&&t.uint32(10).string(e.queueId),0!==e.partitionKey.length&&t.uint32(18).bytes(e.partitionKey),!1!==e.total&&t.uint32(24).bool(e.total),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueLenRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.queueId=n.string();continue;case 2:if(18!==e)break;a.partitionKey=n.bytes();continue;case 3:if(24!==e)break;a.total=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({queueId:isSet4(e.queueId)?globalThis.String(e.queueId):"",partitionKey:isSet4(e.partitionKey)?bytesFromBase64(e.partitionKey):new Uint8Array(0),total:!!isSet4(e.total)&&globalThis.Boolean(e.total)}),toJSON(e){const t={};return""!==e.queueId&&(t.queueId=e.queueId),0!==e.partitionKey.length&&(t.partitionKey=base64FromBytes(e.partitionKey)),!1!==e.total&&(t.total=e.total),t},create:e=>QueueLenRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueLenRequest();return t.queueId=e.queueId??"",t.partitionKey=e.partitionKey??new Uint8Array(0),t.total=e.total??!1,t}};function createBaseQueueLenResponse(){return{len:0}}var QueueLenResponse={encode:(e,t=new BinaryWriter)=>(0!==e.len&&t.uint32(8).int32(e.len),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueLenResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.len=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({len:isSet4(e.len)?globalThis.Number(e.len):0}),toJSON(e){const t={};return 0!==e.len&&(t.len=Math.round(e.len)),t},create:e=>QueueLenResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueLenResponse();return t.len=e.len??0,t}};function createBaseQueueListRequest(){return{environmentName:"",totalSizeLimit:0,pagination:void 0}}var QueueListRequest={encode:(e,t=new BinaryWriter)=>(""!==e.environmentName&&t.uint32(10).string(e.environmentName),0!==e.totalSizeLimit&&t.uint32(16).int32(e.totalSizeLimit),void 0!==e.pagination&&ListPagination.encode(e.pagination,t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueListRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.environmentName=n.string();continue;case 2:if(16!==e)break;a.totalSizeLimit=n.int32();continue;case 3:if(26!==e)break;a.pagination=ListPagination.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",totalSizeLimit:isSet4(e.totalSizeLimit)?globalThis.Number(e.totalSizeLimit):0,pagination:isSet4(e.pagination)?ListPagination.fromJSON(e.pagination):void 0}),toJSON(e){const t={};return""!==e.environmentName&&(t.environmentName=e.environmentName),0!==e.totalSizeLimit&&(t.totalSizeLimit=Math.round(e.totalSizeLimit)),void 0!==e.pagination&&(t.pagination=ListPagination.toJSON(e.pagination)),t},create:e=>QueueListRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueListRequest();return t.environmentName=e.environmentName??"",t.totalSizeLimit=e.totalSizeLimit??0,t.pagination=void 0!==e.pagination&&null!==e.pagination?ListPagination.fromPartial(e.pagination):void 0,t}};function createBaseQueueListResponse(){return{queues:[],environmentName:""}}var QueueListResponse={encode(e,t=new BinaryWriter){for(const n of e.queues)QueueListResponse_QueueInfo.encode(n,t.uint32(10).fork()).join();return""!==e.environmentName&&t.uint32(18).string(e.environmentName),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.queues.push(QueueListResponse_QueueInfo.decode(n,n.uint32()));continue;case 2:if(18!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({queues:globalThis.Array.isArray(e?.queues)?e.queues.map((e=>QueueListResponse_QueueInfo.fromJSON(e))):[],environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return e.queues?.length&&(t.queues=e.queues.map((e=>QueueListResponse_QueueInfo.toJSON(e)))),""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>QueueListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueListResponse();return t.queues=e.queues?.map((e=>QueueListResponse_QueueInfo.fromPartial(e)))||[],t.environmentName=e.environmentName??"",t}};function createBaseQueueListResponse_QueueInfo(){return{name:"",createdAt:0,numPartitions:0,totalSize:0,queueId:"",metadata:void 0}}var QueueListResponse_QueueInfo={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),0!==e.createdAt&&t.uint32(17).double(e.createdAt),0!==e.numPartitions&&t.uint32(24).int32(e.numPartitions),0!==e.totalSize&&t.uint32(32).int32(e.totalSize),""!==e.queueId&&t.uint32(42).string(e.queueId),void 0!==e.metadata&&QueueMetadata.encode(e.metadata,t.uint32(50).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueListResponse_QueueInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(17!==e)break;a.createdAt=n.double();continue;case 3:if(24!==e)break;a.numPartitions=n.int32();continue;case 4:if(32!==e)break;a.totalSize=n.int32();continue;case 5:if(42!==e)break;a.queueId=n.string();continue;case 6:if(50!==e)break;a.metadata=QueueMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,numPartitions:isSet4(e.numPartitions)?globalThis.Number(e.numPartitions):0,totalSize:isSet4(e.totalSize)?globalThis.Number(e.totalSize):0,queueId:isSet4(e.queueId)?globalThis.String(e.queueId):"",metadata:isSet4(e.metadata)?QueueMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),0!==e.createdAt&&(t.createdAt=e.createdAt),0!==e.numPartitions&&(t.numPartitions=Math.round(e.numPartitions)),0!==e.totalSize&&(t.totalSize=Math.round(e.totalSize)),""!==e.queueId&&(t.queueId=e.queueId),void 0!==e.metadata&&(t.metadata=QueueMetadata.toJSON(e.metadata)),t},create:e=>QueueListResponse_QueueInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueListResponse_QueueInfo();return t.name=e.name??"",t.createdAt=e.createdAt??0,t.numPartitions=e.numPartitions??0,t.totalSize=e.totalSize??0,t.queueId=e.queueId??"",t.metadata=void 0!==e.metadata&&null!==e.metadata?QueueMetadata.fromPartial(e.metadata):void 0,t}};function createBaseQueueMetadata(){return{name:"",creationInfo:void 0}}var QueueMetadata={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),void 0!==e.creationInfo&&CreationInfo.encode(e.creationInfo,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueMetadata();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(18!==e)break;a.creationInfo=CreationInfo.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",creationInfo:isSet4(e.creationInfo)?CreationInfo.fromJSON(e.creationInfo):void 0}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),void 0!==e.creationInfo&&(t.creationInfo=CreationInfo.toJSON(e.creationInfo)),t},create:e=>QueueMetadata.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueMetadata();return t.name=e.name??"",t.creationInfo=void 0!==e.creationInfo&&null!==e.creationInfo?CreationInfo.fromPartial(e.creationInfo):void 0,t}};function createBaseQueueNextItemsRequest(){return{queueId:"",partitionKey:new Uint8Array(0),lastEntryId:"",itemPollTimeout:0}}var QueueNextItemsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.queueId&&t.uint32(10).string(e.queueId),0!==e.partitionKey.length&&t.uint32(18).bytes(e.partitionKey),""!==e.lastEntryId&&t.uint32(26).string(e.lastEntryId),0!==e.itemPollTimeout&&t.uint32(37).float(e.itemPollTimeout),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueNextItemsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.queueId=n.string();continue;case 2:if(18!==e)break;a.partitionKey=n.bytes();continue;case 3:if(26!==e)break;a.lastEntryId=n.string();continue;case 4:if(37!==e)break;a.itemPollTimeout=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({queueId:isSet4(e.queueId)?globalThis.String(e.queueId):"",partitionKey:isSet4(e.partitionKey)?bytesFromBase64(e.partitionKey):new Uint8Array(0),lastEntryId:isSet4(e.lastEntryId)?globalThis.String(e.lastEntryId):"",itemPollTimeout:isSet4(e.itemPollTimeout)?globalThis.Number(e.itemPollTimeout):0}),toJSON(e){const t={};return""!==e.queueId&&(t.queueId=e.queueId),0!==e.partitionKey.length&&(t.partitionKey=base64FromBytes(e.partitionKey)),""!==e.lastEntryId&&(t.lastEntryId=e.lastEntryId),0!==e.itemPollTimeout&&(t.itemPollTimeout=e.itemPollTimeout),t},create:e=>QueueNextItemsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueNextItemsRequest();return t.queueId=e.queueId??"",t.partitionKey=e.partitionKey??new Uint8Array(0),t.lastEntryId=e.lastEntryId??"",t.itemPollTimeout=e.itemPollTimeout??0,t}};function createBaseQueueNextItemsResponse(){return{items:[]}}var QueueNextItemsResponse={encode(e,t=new BinaryWriter){for(const n of e.items)QueueItem.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueueNextItemsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.items.push(QueueItem.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({items:globalThis.Array.isArray(e?.items)?e.items.map((e=>QueueItem.fromJSON(e))):[]}),toJSON(e){const t={};return e.items?.length&&(t.items=e.items.map((e=>QueueItem.toJSON(e)))),t},create:e=>QueueNextItemsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseQueueNextItemsResponse();return t.items=e.items?.map((e=>QueueItem.fromPartial(e)))||[],t}};function createBaseQueuePutRequest(){return{queueId:"",values:[],partitionKey:new Uint8Array(0),partitionTtlSeconds:0}}var QueuePutRequest={encode(e,t=new BinaryWriter){""!==e.queueId&&t.uint32(10).string(e.queueId);for(const n of e.values)t.uint32(34).bytes(n);return 0!==e.partitionKey.length&&t.uint32(42).bytes(e.partitionKey),0!==e.partitionTtlSeconds&&t.uint32(48).int32(e.partitionTtlSeconds),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseQueuePutRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.queueId=n.string();continue;case 4:if(34!==e)break;a.values.push(n.bytes());continue;case 5:if(42!==e)break;a.partitionKey=n.bytes();continue;case 6:if(48!==e)break;a.partitionTtlSeconds=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({queueId:isSet4(e.queueId)?globalThis.String(e.queueId):"",values:globalThis.Array.isArray(e?.values)?e.values.map((e=>bytesFromBase64(e))):[],partitionKey:isSet4(e.partitionKey)?bytesFromBase64(e.partitionKey):new Uint8Array(0),partitionTtlSeconds:isSet4(e.partitionTtlSeconds)?globalThis.Number(e.partitionTtlSeconds):0}),toJSON(e){const t={};return""!==e.queueId&&(t.queueId=e.queueId),e.values?.length&&(t.values=e.values.map((e=>base64FromBytes(e)))),0!==e.partitionKey.length&&(t.partitionKey=base64FromBytes(e.partitionKey)),0!==e.partitionTtlSeconds&&(t.partitionTtlSeconds=Math.round(e.partitionTtlSeconds)),t},create:e=>QueuePutRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseQueuePutRequest();return t.queueId=e.queueId??"",t.values=e.values?.map((e=>e))||[],t.partitionKey=e.partitionKey??new Uint8Array(0),t.partitionTtlSeconds=e.partitionTtlSeconds??0,t}};function createBaseRateLimit(){return{limit:0,interval:0}}var RateLimit={encode:(e,t=new BinaryWriter)=>(0!==e.limit&&t.uint32(8).int32(e.limit),0!==e.interval&&t.uint32(16).int32(e.interval),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseRateLimit();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.limit=n.int32();continue;case 2:if(16!==e)break;a.interval=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({limit:isSet4(e.limit)?globalThis.Number(e.limit):0,interval:isSet4(e.interval)?rateLimitIntervalFromJSON(e.interval):0}),toJSON(e){const t={};return 0!==e.limit&&(t.limit=Math.round(e.limit)),0!==e.interval&&(t.interval=rateLimitIntervalToJSON(e.interval)),t},create:e=>RateLimit.fromPartial(e??{}),fromPartial(e){const t=createBaseRateLimit();return t.limit=e.limit??0,t.interval=e.interval??0,t}};function createBaseResourceInfo(){return{memoryMb:void 0,milliCpu:void 0,gpuType:"",memoryMbMax:0,ephemeralDiskMb:0,milliCpuMax:0}}var ResourceInfo={encode:(e,t=new BinaryWriter)=>(void 0!==e.memoryMb&&ResourceInfo_ResourceValue.encode(e.memoryMb,t.uint32(10).fork()).join(),void 0!==e.milliCpu&&ResourceInfo_ResourceValue.encode(e.milliCpu,t.uint32(18).fork()).join(),""!==e.gpuType&&t.uint32(26).string(e.gpuType),0!==e.memoryMbMax&&t.uint32(32).uint32(e.memoryMbMax),0!==e.ephemeralDiskMb&&t.uint32(40).uint32(e.ephemeralDiskMb),0!==e.milliCpuMax&&t.uint32(48).uint32(e.milliCpuMax),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseResourceInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.memoryMb=ResourceInfo_ResourceValue.decode(n,n.uint32());continue;case 2:if(18!==e)break;a.milliCpu=ResourceInfo_ResourceValue.decode(n,n.uint32());continue;case 3:if(26!==e)break;a.gpuType=n.string();continue;case 4:if(32!==e)break;a.memoryMbMax=n.uint32();continue;case 5:if(40!==e)break;a.ephemeralDiskMb=n.uint32();continue;case 6:if(48!==e)break;a.milliCpuMax=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({memoryMb:isSet4(e.memoryMb)?ResourceInfo_ResourceValue.fromJSON(e.memoryMb):void 0,milliCpu:isSet4(e.milliCpu)?ResourceInfo_ResourceValue.fromJSON(e.milliCpu):void 0,gpuType:isSet4(e.gpuType)?globalThis.String(e.gpuType):"",memoryMbMax:isSet4(e.memoryMbMax)?globalThis.Number(e.memoryMbMax):0,ephemeralDiskMb:isSet4(e.ephemeralDiskMb)?globalThis.Number(e.ephemeralDiskMb):0,milliCpuMax:isSet4(e.milliCpuMax)?globalThis.Number(e.milliCpuMax):0}),toJSON(e){const t={};return void 0!==e.memoryMb&&(t.memoryMb=ResourceInfo_ResourceValue.toJSON(e.memoryMb)),void 0!==e.milliCpu&&(t.milliCpu=ResourceInfo_ResourceValue.toJSON(e.milliCpu)),""!==e.gpuType&&(t.gpuType=e.gpuType),0!==e.memoryMbMax&&(t.memoryMbMax=Math.round(e.memoryMbMax)),0!==e.ephemeralDiskMb&&(t.ephemeralDiskMb=Math.round(e.ephemeralDiskMb)),0!==e.milliCpuMax&&(t.milliCpuMax=Math.round(e.milliCpuMax)),t},create:e=>ResourceInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseResourceInfo();return t.memoryMb=void 0!==e.memoryMb&&null!==e.memoryMb?ResourceInfo_ResourceValue.fromPartial(e.memoryMb):void 0,t.milliCpu=void 0!==e.milliCpu&&null!==e.milliCpu?ResourceInfo_ResourceValue.fromPartial(e.milliCpu):void 0,t.gpuType=e.gpuType??"",t.memoryMbMax=e.memoryMbMax??0,t.ephemeralDiskMb=e.ephemeralDiskMb??0,t.milliCpuMax=e.milliCpuMax??0,t}};function createBaseResourceInfo_ResourceValue(){return{value:0,isDefault:!1}}var ResourceInfo_ResourceValue={encode:(e,t=new BinaryWriter)=>(0!==e.value&&t.uint32(8).uint32(e.value),!1!==e.isDefault&&t.uint32(16).bool(e.isDefault),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseResourceInfo_ResourceValue();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.value=n.uint32();continue;case 2:if(16!==e)break;a.isDefault=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({value:isSet4(e.value)?globalThis.Number(e.value):0,isDefault:!!isSet4(e.isDefault)&&globalThis.Boolean(e.isDefault)}),toJSON(e){const t={};return 0!==e.value&&(t.value=Math.round(e.value)),!1!==e.isDefault&&(t.isDefault=e.isDefault),t},create:e=>ResourceInfo_ResourceValue.fromPartial(e??{}),fromPartial(e){const t=createBaseResourceInfo_ResourceValue();return t.value=e.value??0,t.isDefault=e.isDefault??!1,t}};function createBaseResources(){return{memoryMb:0,milliCpu:0,gpuConfig:void 0,memoryMbMax:0,ephemeralDiskMb:0,milliCpuMax:0,rdma:!1}}var Resources={encode:(e,t=new BinaryWriter)=>(0!==e.memoryMb&&t.uint32(16).uint32(e.memoryMb),0!==e.milliCpu&&t.uint32(24).uint32(e.milliCpu),void 0!==e.gpuConfig&&GPUConfig.encode(e.gpuConfig,t.uint32(34).fork()).join(),0!==e.memoryMbMax&&t.uint32(40).uint32(e.memoryMbMax),0!==e.ephemeralDiskMb&&t.uint32(48).uint32(e.ephemeralDiskMb),0!==e.milliCpuMax&&t.uint32(56).uint32(e.milliCpuMax),!1!==e.rdma&&t.uint32(64).bool(e.rdma),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseResources();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 2:if(16!==e)break;a.memoryMb=n.uint32();continue;case 3:if(24!==e)break;a.milliCpu=n.uint32();continue;case 4:if(34!==e)break;a.gpuConfig=GPUConfig.decode(n,n.uint32());continue;case 5:if(40!==e)break;a.memoryMbMax=n.uint32();continue;case 6:if(48!==e)break;a.ephemeralDiskMb=n.uint32();continue;case 7:if(56!==e)break;a.milliCpuMax=n.uint32();continue;case 8:if(64!==e)break;a.rdma=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({memoryMb:isSet4(e.memoryMb)?globalThis.Number(e.memoryMb):0,milliCpu:isSet4(e.milliCpu)?globalThis.Number(e.milliCpu):0,gpuConfig:isSet4(e.gpuConfig)?GPUConfig.fromJSON(e.gpuConfig):void 0,memoryMbMax:isSet4(e.memoryMbMax)?globalThis.Number(e.memoryMbMax):0,ephemeralDiskMb:isSet4(e.ephemeralDiskMb)?globalThis.Number(e.ephemeralDiskMb):0,milliCpuMax:isSet4(e.milliCpuMax)?globalThis.Number(e.milliCpuMax):0,rdma:!!isSet4(e.rdma)&&globalThis.Boolean(e.rdma)}),toJSON(e){const t={};return 0!==e.memoryMb&&(t.memoryMb=Math.round(e.memoryMb)),0!==e.milliCpu&&(t.milliCpu=Math.round(e.milliCpu)),void 0!==e.gpuConfig&&(t.gpuConfig=GPUConfig.toJSON(e.gpuConfig)),0!==e.memoryMbMax&&(t.memoryMbMax=Math.round(e.memoryMbMax)),0!==e.ephemeralDiskMb&&(t.ephemeralDiskMb=Math.round(e.ephemeralDiskMb)),0!==e.milliCpuMax&&(t.milliCpuMax=Math.round(e.milliCpuMax)),!1!==e.rdma&&(t.rdma=e.rdma),t},create:e=>Resources.fromPartial(e??{}),fromPartial(e){const t=createBaseResources();return t.memoryMb=e.memoryMb??0,t.milliCpu=e.milliCpu??0,t.gpuConfig=void 0!==e.gpuConfig&&null!==e.gpuConfig?GPUConfig.fromPartial(e.gpuConfig):void 0,t.memoryMbMax=e.memoryMbMax??0,t.ephemeralDiskMb=e.ephemeralDiskMb??0,t.milliCpuMax=e.milliCpuMax??0,t.rdma=e.rdma??!1,t}};function createBaseRuntimeInputMessage(){return{message:new Uint8Array(0),messageIndex:0,eof:!1}}var RuntimeInputMessage={encode:(e,t=new BinaryWriter)=>(0!==e.message.length&&t.uint32(10).bytes(e.message),0!==e.messageIndex&&t.uint32(16).uint64(e.messageIndex),!1!==e.eof&&t.uint32(24).bool(e.eof),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseRuntimeInputMessage();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.message=n.bytes();continue;case 2:if(16!==e)break;a.messageIndex=longToNumber2(n.uint64());continue;case 3:if(24!==e)break;a.eof=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({message:isSet4(e.message)?bytesFromBase64(e.message):new Uint8Array(0),messageIndex:isSet4(e.messageIndex)?globalThis.Number(e.messageIndex):0,eof:!!isSet4(e.eof)&&globalThis.Boolean(e.eof)}),toJSON(e){const t={};return 0!==e.message.length&&(t.message=base64FromBytes(e.message)),0!==e.messageIndex&&(t.messageIndex=Math.round(e.messageIndex)),!1!==e.eof&&(t.eof=e.eof),t},create:e=>RuntimeInputMessage.fromPartial(e??{}),fromPartial(e){const t=createBaseRuntimeInputMessage();return t.message=e.message??new Uint8Array(0),t.messageIndex=e.messageIndex??0,t.eof=e.eof??!1,t}};function createBaseRuntimeOutputBatch(){return{items:[],batchIndex:0,exitCode:void 0,stdout:[],stderr:[],info:[]}}var RuntimeOutputBatch={encode(e,t=new BinaryWriter){for(const n of e.items)RuntimeOutputMessage.encode(n,t.uint32(10).fork()).join();0!==e.batchIndex&&t.uint32(16).uint64(e.batchIndex),void 0!==e.exitCode&&t.uint32(24).int32(e.exitCode);for(const n of e.stdout)RuntimeOutputMessage.encode(n,t.uint32(34).fork()).join();for(const n of e.stderr)RuntimeOutputMessage.encode(n,t.uint32(42).fork()).join();for(const n of e.info)RuntimeOutputMessage.encode(n,t.uint32(50).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseRuntimeOutputBatch();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.items.push(RuntimeOutputMessage.decode(n,n.uint32()));continue;case 2:if(16!==e)break;a.batchIndex=longToNumber2(n.uint64());continue;case 3:if(24!==e)break;a.exitCode=n.int32();continue;case 4:if(34!==e)break;a.stdout.push(RuntimeOutputMessage.decode(n,n.uint32()));continue;case 5:if(42!==e)break;a.stderr.push(RuntimeOutputMessage.decode(n,n.uint32()));continue;case 6:if(50!==e)break;a.info.push(RuntimeOutputMessage.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({items:globalThis.Array.isArray(e?.items)?e.items.map((e=>RuntimeOutputMessage.fromJSON(e))):[],batchIndex:isSet4(e.batchIndex)?globalThis.Number(e.batchIndex):0,exitCode:isSet4(e.exitCode)?globalThis.Number(e.exitCode):void 0,stdout:globalThis.Array.isArray(e?.stdout)?e.stdout.map((e=>RuntimeOutputMessage.fromJSON(e))):[],stderr:globalThis.Array.isArray(e?.stderr)?e.stderr.map((e=>RuntimeOutputMessage.fromJSON(e))):[],info:globalThis.Array.isArray(e?.info)?e.info.map((e=>RuntimeOutputMessage.fromJSON(e))):[]}),toJSON(e){const t={};return e.items?.length&&(t.items=e.items.map((e=>RuntimeOutputMessage.toJSON(e)))),0!==e.batchIndex&&(t.batchIndex=Math.round(e.batchIndex)),void 0!==e.exitCode&&(t.exitCode=Math.round(e.exitCode)),e.stdout?.length&&(t.stdout=e.stdout.map((e=>RuntimeOutputMessage.toJSON(e)))),e.stderr?.length&&(t.stderr=e.stderr.map((e=>RuntimeOutputMessage.toJSON(e)))),e.info?.length&&(t.info=e.info.map((e=>RuntimeOutputMessage.toJSON(e)))),t},create:e=>RuntimeOutputBatch.fromPartial(e??{}),fromPartial(e){const t=createBaseRuntimeOutputBatch();return t.items=e.items?.map((e=>RuntimeOutputMessage.fromPartial(e)))||[],t.batchIndex=e.batchIndex??0,t.exitCode=e.exitCode??void 0,t.stdout=e.stdout?.map((e=>RuntimeOutputMessage.fromPartial(e)))||[],t.stderr=e.stderr?.map((e=>RuntimeOutputMessage.fromPartial(e)))||[],t.info=e.info?.map((e=>RuntimeOutputMessage.fromPartial(e)))||[],t}};function createBaseRuntimeOutputMessage(){return{fileDescriptor:0,message:"",messageBytes:new Uint8Array(0)}}var RuntimeOutputMessage={encode:(e,t=new BinaryWriter)=>(0!==e.fileDescriptor&&t.uint32(8).int32(e.fileDescriptor),""!==e.message&&t.uint32(18).string(e.message),0!==e.messageBytes.length&&t.uint32(26).bytes(e.messageBytes),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseRuntimeOutputMessage();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.fileDescriptor=n.int32();continue;case 2:if(18!==e)break;a.message=n.string();continue;case 3:if(26!==e)break;a.messageBytes=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({fileDescriptor:isSet4(e.fileDescriptor)?fileDescriptorFromJSON(e.fileDescriptor):0,message:isSet4(e.message)?globalThis.String(e.message):"",messageBytes:isSet4(e.messageBytes)?bytesFromBase64(e.messageBytes):new Uint8Array(0)}),toJSON(e){const t={};return 0!==e.fileDescriptor&&(t.fileDescriptor=fileDescriptorToJSON(e.fileDescriptor)),""!==e.message&&(t.message=e.message),0!==e.messageBytes.length&&(t.messageBytes=base64FromBytes(e.messageBytes)),t},create:e=>RuntimeOutputMessage.fromPartial(e??{}),fromPartial(e){const t=createBaseRuntimeOutputMessage();return t.fileDescriptor=e.fileDescriptor??0,t.message=e.message??"",t.messageBytes=e.messageBytes??new Uint8Array(0),t}};function createBaseS3Mount(){return{bucketName:"",mountPath:"",credentialsSecretId:"",readOnly:!1}}var S3Mount={encode:(e,t=new BinaryWriter)=>(""!==e.bucketName&&t.uint32(10).string(e.bucketName),""!==e.mountPath&&t.uint32(18).string(e.mountPath),""!==e.credentialsSecretId&&t.uint32(26).string(e.credentialsSecretId),!1!==e.readOnly&&t.uint32(32).bool(e.readOnly),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseS3Mount();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.bucketName=n.string();continue;case 2:if(18!==e)break;a.mountPath=n.string();continue;case 3:if(26!==e)break;a.credentialsSecretId=n.string();continue;case 4:if(32!==e)break;a.readOnly=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({bucketName:isSet4(e.bucketName)?globalThis.String(e.bucketName):"",mountPath:isSet4(e.mountPath)?globalThis.String(e.mountPath):"",credentialsSecretId:isSet4(e.credentialsSecretId)?globalThis.String(e.credentialsSecretId):"",readOnly:!!isSet4(e.readOnly)&&globalThis.Boolean(e.readOnly)}),toJSON(e){const t={};return""!==e.bucketName&&(t.bucketName=e.bucketName),""!==e.mountPath&&(t.mountPath=e.mountPath),""!==e.credentialsSecretId&&(t.credentialsSecretId=e.credentialsSecretId),!1!==e.readOnly&&(t.readOnly=e.readOnly),t},create:e=>S3Mount.fromPartial(e??{}),fromPartial(e){const t=createBaseS3Mount();return t.bucketName=e.bucketName??"",t.mountPath=e.mountPath??"",t.credentialsSecretId=e.credentialsSecretId??"",t.readOnly=e.readOnly??!1,t}};function createBaseSandbox(){return{entrypointArgs:[],mountIds:[],imageId:"",secretIds:[],resources:void 0,cloudProvider:0,timeoutSecs:0,workdir:void 0,nfsMounts:[],runtimeDebug:!1,blockNetwork:!1,s3Mounts:[],cloudBucketMounts:[],volumeMounts:[],ptyInfo:void 0,schedulerPlacement:void 0,workerId:"",openPorts:void 0,i6pnEnabled:!1,networkAccess:void 0,proxyId:void 0,enableSnapshot:!1,snapshotVersion:void 0,cloudProviderStr:"",runscRuntimeVersion:void 0,runtime:void 0,verbose:!1,name:void 0,experimentalOptions:{},preloadPathPrefixes:[],idleTimeoutSecs:void 0,directSandboxCommandsEnabled:!1,RestoreInstanceType:"",customDomain:"",includeOidcIdentityToken:!1,readinessProbe:void 0}}var Sandbox={encode(e,t=new BinaryWriter){for(const n of e.entrypointArgs)t.uint32(10).string(n);for(const n of e.mountIds)t.uint32(18).string(n);""!==e.imageId&&t.uint32(26).string(e.imageId);for(const n of e.secretIds)t.uint32(34).string(n);void 0!==e.resources&&Resources.encode(e.resources,t.uint32(42).fork()).join(),0!==e.cloudProvider&&t.uint32(48).int32(e.cloudProvider),0!==e.timeoutSecs&&t.uint32(56).uint32(e.timeoutSecs),void 0!==e.workdir&&t.uint32(66).string(e.workdir);for(const n of e.nfsMounts)SharedVolumeMount.encode(n,t.uint32(74).fork()).join();!1!==e.runtimeDebug&&t.uint32(80).bool(e.runtimeDebug),!1!==e.blockNetwork&&t.uint32(88).bool(e.blockNetwork);for(const n of e.s3Mounts)S3Mount.encode(n,t.uint32(98).fork()).join();for(const n of e.cloudBucketMounts)CloudBucketMount.encode(n,t.uint32(114).fork()).join();for(const n of e.volumeMounts)VolumeMount.encode(n,t.uint32(106).fork()).join();void 0!==e.ptyInfo&&PTYInfo.encode(e.ptyInfo,t.uint32(122).fork()).join(),void 0!==e.schedulerPlacement&&SchedulerPlacement.encode(e.schedulerPlacement,t.uint32(138).fork()).join(),""!==e.workerId&&t.uint32(154).string(e.workerId),void 0!==e.openPorts&&PortSpecs.encode(e.openPorts,t.uint32(162).fork()).join(),!1!==e.i6pnEnabled&&t.uint32(168).bool(e.i6pnEnabled),void 0!==e.networkAccess&&NetworkAccess.encode(e.networkAccess,t.uint32(178).fork()).join(),void 0!==e.proxyId&&t.uint32(186).string(e.proxyId),!1!==e.enableSnapshot&&t.uint32(192).bool(e.enableSnapshot),void 0!==e.snapshotVersion&&t.uint32(200).uint32(e.snapshotVersion),""!==e.cloudProviderStr&&t.uint32(210).string(e.cloudProviderStr),void 0!==e.runscRuntimeVersion&&t.uint32(218).string(e.runscRuntimeVersion),void 0!==e.runtime&&t.uint32(226).string(e.runtime),!1!==e.verbose&&t.uint32(232).bool(e.verbose),void 0!==e.name&&t.uint32(242).string(e.name),Object.entries(e.experimentalOptions).forEach((([e,n])=>{Sandbox_ExperimentalOptionsEntry.encode({key:e,value:n},t.uint32(250).fork()).join()}));for(const n of e.preloadPathPrefixes)t.uint32(258).string(n);return void 0!==e.idleTimeoutSecs&&t.uint32(264).uint32(e.idleTimeoutSecs),!1!==e.directSandboxCommandsEnabled&&t.uint32(272).bool(e.directSandboxCommandsEnabled),""!==e.RestoreInstanceType&&t.uint32(282).string(e.RestoreInstanceType),""!==e.customDomain&&t.uint32(290).string(e.customDomain),!1!==e.includeOidcIdentityToken&&t.uint32(296).bool(e.includeOidcIdentityToken),void 0!==e.readinessProbe&&Probe.encode(e.readinessProbe,t.uint32(306).fork()).join(),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandbox();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.entrypointArgs.push(n.string());continue;case 2:if(18!==e)break;a.mountIds.push(n.string());continue;case 3:if(26!==e)break;a.imageId=n.string();continue;case 4:if(34!==e)break;a.secretIds.push(n.string());continue;case 5:if(42!==e)break;a.resources=Resources.decode(n,n.uint32());continue;case 6:if(48!==e)break;a.cloudProvider=n.int32();continue;case 7:if(56!==e)break;a.timeoutSecs=n.uint32();continue;case 8:if(66!==e)break;a.workdir=n.string();continue;case 9:if(74!==e)break;a.nfsMounts.push(SharedVolumeMount.decode(n,n.uint32()));continue;case 10:if(80!==e)break;a.runtimeDebug=n.bool();continue;case 11:if(88!==e)break;a.blockNetwork=n.bool();continue;case 12:if(98!==e)break;a.s3Mounts.push(S3Mount.decode(n,n.uint32()));continue;case 14:if(114!==e)break;a.cloudBucketMounts.push(CloudBucketMount.decode(n,n.uint32()));continue;case 13:if(106!==e)break;a.volumeMounts.push(VolumeMount.decode(n,n.uint32()));continue;case 15:if(122!==e)break;a.ptyInfo=PTYInfo.decode(n,n.uint32());continue;case 17:if(138!==e)break;a.schedulerPlacement=SchedulerPlacement.decode(n,n.uint32());continue;case 19:if(154!==e)break;a.workerId=n.string();continue;case 20:if(162!==e)break;a.openPorts=PortSpecs.decode(n,n.uint32());continue;case 21:if(168!==e)break;a.i6pnEnabled=n.bool();continue;case 22:if(178!==e)break;a.networkAccess=NetworkAccess.decode(n,n.uint32());continue;case 23:if(186!==e)break;a.proxyId=n.string();continue;case 24:if(192!==e)break;a.enableSnapshot=n.bool();continue;case 25:if(200!==e)break;a.snapshotVersion=n.uint32();continue;case 26:if(210!==e)break;a.cloudProviderStr=n.string();continue;case 27:if(218!==e)break;a.runscRuntimeVersion=n.string();continue;case 28:if(226!==e)break;a.runtime=n.string();continue;case 29:if(232!==e)break;a.verbose=n.bool();continue;case 30:if(242!==e)break;a.name=n.string();continue;case 31:{if(250!==e)break;const t=Sandbox_ExperimentalOptionsEntry.decode(n,n.uint32());void 0!==t.value&&(a.experimentalOptions[t.key]=t.value);continue}case 32:if(258!==e)break;a.preloadPathPrefixes.push(n.string());continue;case 33:if(264!==e)break;a.idleTimeoutSecs=n.uint32();continue;case 34:if(272!==e)break;a.directSandboxCommandsEnabled=n.bool();continue;case 35:if(282!==e)break;a.RestoreInstanceType=n.string();continue;case 36:if(290!==e)break;a.customDomain=n.string();continue;case 37:if(296!==e)break;a.includeOidcIdentityToken=n.bool();continue;case 38:if(306!==e)break;a.readinessProbe=Probe.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({entrypointArgs:globalThis.Array.isArray(e?.entrypointArgs)?e.entrypointArgs.map((e=>globalThis.String(e))):[],mountIds:globalThis.Array.isArray(e?.mountIds)?e.mountIds.map((e=>globalThis.String(e))):[],imageId:isSet4(e.imageId)?globalThis.String(e.imageId):"",secretIds:globalThis.Array.isArray(e?.secretIds)?e.secretIds.map((e=>globalThis.String(e))):[],resources:isSet4(e.resources)?Resources.fromJSON(e.resources):void 0,cloudProvider:isSet4(e.cloudProvider)?cloudProviderFromJSON(e.cloudProvider):0,timeoutSecs:isSet4(e.timeoutSecs)?globalThis.Number(e.timeoutSecs):0,workdir:isSet4(e.workdir)?globalThis.String(e.workdir):void 0,nfsMounts:globalThis.Array.isArray(e?.nfsMounts)?e.nfsMounts.map((e=>SharedVolumeMount.fromJSON(e))):[],runtimeDebug:!!isSet4(e.runtimeDebug)&&globalThis.Boolean(e.runtimeDebug),blockNetwork:!!isSet4(e.blockNetwork)&&globalThis.Boolean(e.blockNetwork),s3Mounts:globalThis.Array.isArray(e?.s3Mounts)?e.s3Mounts.map((e=>S3Mount.fromJSON(e))):[],cloudBucketMounts:globalThis.Array.isArray(e?.cloudBucketMounts)?e.cloudBucketMounts.map((e=>CloudBucketMount.fromJSON(e))):[],volumeMounts:globalThis.Array.isArray(e?.volumeMounts)?e.volumeMounts.map((e=>VolumeMount.fromJSON(e))):[],ptyInfo:isSet4(e.ptyInfo)?PTYInfo.fromJSON(e.ptyInfo):void 0,schedulerPlacement:isSet4(e.schedulerPlacement)?SchedulerPlacement.fromJSON(e.schedulerPlacement):void 0,workerId:isSet4(e.workerId)?globalThis.String(e.workerId):"",openPorts:isSet4(e.openPorts)?PortSpecs.fromJSON(e.openPorts):void 0,i6pnEnabled:!!isSet4(e.i6pnEnabled)&&globalThis.Boolean(e.i6pnEnabled),networkAccess:isSet4(e.networkAccess)?NetworkAccess.fromJSON(e.networkAccess):void 0,proxyId:isSet4(e.proxyId)?globalThis.String(e.proxyId):void 0,enableSnapshot:!!isSet4(e.enableSnapshot)&&globalThis.Boolean(e.enableSnapshot),snapshotVersion:isSet4(e.snapshotVersion)?globalThis.Number(e.snapshotVersion):void 0,cloudProviderStr:isSet4(e.cloudProviderStr)?globalThis.String(e.cloudProviderStr):"",runscRuntimeVersion:isSet4(e.runscRuntimeVersion)?globalThis.String(e.runscRuntimeVersion):void 0,runtime:isSet4(e.runtime)?globalThis.String(e.runtime):void 0,verbose:!!isSet4(e.verbose)&&globalThis.Boolean(e.verbose),name:isSet4(e.name)?globalThis.String(e.name):void 0,experimentalOptions:isObject2(e.experimentalOptions)?Object.entries(e.experimentalOptions).reduce(((e,[t,n])=>(e[t]=Boolean(n),e)),{}):{},preloadPathPrefixes:globalThis.Array.isArray(e?.preloadPathPrefixes)?e.preloadPathPrefixes.map((e=>globalThis.String(e))):[],idleTimeoutSecs:isSet4(e.idleTimeoutSecs)?globalThis.Number(e.idleTimeoutSecs):void 0,directSandboxCommandsEnabled:!!isSet4(e.directSandboxCommandsEnabled)&&globalThis.Boolean(e.directSandboxCommandsEnabled),RestoreInstanceType:isSet4(e.RestoreInstanceType)?globalThis.String(e.RestoreInstanceType):"",customDomain:isSet4(e.customDomain)?globalThis.String(e.customDomain):"",includeOidcIdentityToken:!!isSet4(e.includeOidcIdentityToken)&&globalThis.Boolean(e.includeOidcIdentityToken),readinessProbe:isSet4(e.readinessProbe)?Probe.fromJSON(e.readinessProbe):void 0}),toJSON(e){const t={};if(e.entrypointArgs?.length&&(t.entrypointArgs=e.entrypointArgs),e.mountIds?.length&&(t.mountIds=e.mountIds),""!==e.imageId&&(t.imageId=e.imageId),e.secretIds?.length&&(t.secretIds=e.secretIds),void 0!==e.resources&&(t.resources=Resources.toJSON(e.resources)),0!==e.cloudProvider&&(t.cloudProvider=cloudProviderToJSON(e.cloudProvider)),0!==e.timeoutSecs&&(t.timeoutSecs=Math.round(e.timeoutSecs)),void 0!==e.workdir&&(t.workdir=e.workdir),e.nfsMounts?.length&&(t.nfsMounts=e.nfsMounts.map((e=>SharedVolumeMount.toJSON(e)))),!1!==e.runtimeDebug&&(t.runtimeDebug=e.runtimeDebug),!1!==e.blockNetwork&&(t.blockNetwork=e.blockNetwork),e.s3Mounts?.length&&(t.s3Mounts=e.s3Mounts.map((e=>S3Mount.toJSON(e)))),e.cloudBucketMounts?.length&&(t.cloudBucketMounts=e.cloudBucketMounts.map((e=>CloudBucketMount.toJSON(e)))),e.volumeMounts?.length&&(t.volumeMounts=e.volumeMounts.map((e=>VolumeMount.toJSON(e)))),void 0!==e.ptyInfo&&(t.ptyInfo=PTYInfo.toJSON(e.ptyInfo)),void 0!==e.schedulerPlacement&&(t.schedulerPlacement=SchedulerPlacement.toJSON(e.schedulerPlacement)),""!==e.workerId&&(t.workerId=e.workerId),void 0!==e.openPorts&&(t.openPorts=PortSpecs.toJSON(e.openPorts)),!1!==e.i6pnEnabled&&(t.i6pnEnabled=e.i6pnEnabled),void 0!==e.networkAccess&&(t.networkAccess=NetworkAccess.toJSON(e.networkAccess)),void 0!==e.proxyId&&(t.proxyId=e.proxyId),!1!==e.enableSnapshot&&(t.enableSnapshot=e.enableSnapshot),void 0!==e.snapshotVersion&&(t.snapshotVersion=Math.round(e.snapshotVersion)),""!==e.cloudProviderStr&&(t.cloudProviderStr=e.cloudProviderStr),void 0!==e.runscRuntimeVersion&&(t.runscRuntimeVersion=e.runscRuntimeVersion),void 0!==e.runtime&&(t.runtime=e.runtime),!1!==e.verbose&&(t.verbose=e.verbose),void 0!==e.name&&(t.name=e.name),e.experimentalOptions){const n=Object.entries(e.experimentalOptions);n.length>0&&(t.experimentalOptions={},n.forEach((([e,n])=>{t.experimentalOptions[e]=n})))}return e.preloadPathPrefixes?.length&&(t.preloadPathPrefixes=e.preloadPathPrefixes),void 0!==e.idleTimeoutSecs&&(t.idleTimeoutSecs=Math.round(e.idleTimeoutSecs)),!1!==e.directSandboxCommandsEnabled&&(t.directSandboxCommandsEnabled=e.directSandboxCommandsEnabled),""!==e.RestoreInstanceType&&(t.RestoreInstanceType=e.RestoreInstanceType),""!==e.customDomain&&(t.customDomain=e.customDomain),!1!==e.includeOidcIdentityToken&&(t.includeOidcIdentityToken=e.includeOidcIdentityToken),void 0!==e.readinessProbe&&(t.readinessProbe=Probe.toJSON(e.readinessProbe)),t},create:e=>Sandbox.fromPartial(e??{}),fromPartial(e){const t=createBaseSandbox();return t.entrypointArgs=e.entrypointArgs?.map((e=>e))||[],t.mountIds=e.mountIds?.map((e=>e))||[],t.imageId=e.imageId??"",t.secretIds=e.secretIds?.map((e=>e))||[],t.resources=void 0!==e.resources&&null!==e.resources?Resources.fromPartial(e.resources):void 0,t.cloudProvider=e.cloudProvider??0,t.timeoutSecs=e.timeoutSecs??0,t.workdir=e.workdir??void 0,t.nfsMounts=e.nfsMounts?.map((e=>SharedVolumeMount.fromPartial(e)))||[],t.runtimeDebug=e.runtimeDebug??!1,t.blockNetwork=e.blockNetwork??!1,t.s3Mounts=e.s3Mounts?.map((e=>S3Mount.fromPartial(e)))||[],t.cloudBucketMounts=e.cloudBucketMounts?.map((e=>CloudBucketMount.fromPartial(e)))||[],t.volumeMounts=e.volumeMounts?.map((e=>VolumeMount.fromPartial(e)))||[],t.ptyInfo=void 0!==e.ptyInfo&&null!==e.ptyInfo?PTYInfo.fromPartial(e.ptyInfo):void 0,t.schedulerPlacement=void 0!==e.schedulerPlacement&&null!==e.schedulerPlacement?SchedulerPlacement.fromPartial(e.schedulerPlacement):void 0,t.workerId=e.workerId??"",t.openPorts=void 0!==e.openPorts&&null!==e.openPorts?PortSpecs.fromPartial(e.openPorts):void 0,t.i6pnEnabled=e.i6pnEnabled??!1,t.networkAccess=void 0!==e.networkAccess&&null!==e.networkAccess?NetworkAccess.fromPartial(e.networkAccess):void 0,t.proxyId=e.proxyId??void 0,t.enableSnapshot=e.enableSnapshot??!1,t.snapshotVersion=e.snapshotVersion??void 0,t.cloudProviderStr=e.cloudProviderStr??"",t.runscRuntimeVersion=e.runscRuntimeVersion??void 0,t.runtime=e.runtime??void 0,t.verbose=e.verbose??!1,t.name=e.name??void 0,t.experimentalOptions=Object.entries(e.experimentalOptions??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.Boolean(n)),e)),{}),t.preloadPathPrefixes=e.preloadPathPrefixes?.map((e=>e))||[],t.idleTimeoutSecs=e.idleTimeoutSecs??void 0,t.directSandboxCommandsEnabled=e.directSandboxCommandsEnabled??!1,t.RestoreInstanceType=e.RestoreInstanceType??"",t.customDomain=e.customDomain??"",t.includeOidcIdentityToken=e.includeOidcIdentityToken??!1,t.readinessProbe=void 0!==e.readinessProbe&&null!==e.readinessProbe?Probe.fromPartial(e.readinessProbe):void 0,t}};function createBaseSandbox_ExperimentalOptionsEntry(){return{key:"",value:!1}}var Sandbox_ExperimentalOptionsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),!1!==e.value&&t.uint32(16).bool(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandbox_ExperimentalOptionsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(16!==e)break;a.value=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:!!isSet4(e.value)&&globalThis.Boolean(e.value)}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),!1!==e.value&&(t.value=e.value),t},create:e=>Sandbox_ExperimentalOptionsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseSandbox_ExperimentalOptionsEntry();return t.key=e.key??"",t.value=e.value??!1,t}};function createBaseSandboxCreateConnectTokenRequest(){return{sandboxId:"",userMetadata:""}}var SandboxCreateConnectTokenRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),""!==e.userMetadata&&t.uint32(18).string(e.userMetadata),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxCreateConnectTokenRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue;case 2:if(18!==e)break;a.userMetadata=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",userMetadata:isSet4(e.userMetadata)?globalThis.String(e.userMetadata):""}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),""!==e.userMetadata&&(t.userMetadata=e.userMetadata),t},create:e=>SandboxCreateConnectTokenRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxCreateConnectTokenRequest();return t.sandboxId=e.sandboxId??"",t.userMetadata=e.userMetadata??"",t}};function createBaseSandboxCreateConnectTokenResponse(){return{url:"",token:""}}var SandboxCreateConnectTokenResponse={encode:(e,t=new BinaryWriter)=>(""!==e.url&&t.uint32(10).string(e.url),""!==e.token&&t.uint32(18).string(e.token),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxCreateConnectTokenResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.url=n.string();continue;case 2:if(18!==e)break;a.token=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({url:isSet4(e.url)?globalThis.String(e.url):"",token:isSet4(e.token)?globalThis.String(e.token):""}),toJSON(e){const t={};return""!==e.url&&(t.url=e.url),""!==e.token&&(t.token=e.token),t},create:e=>SandboxCreateConnectTokenResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxCreateConnectTokenResponse();return t.url=e.url??"",t.token=e.token??"",t}};function createBaseSandboxCreateRequest(){return{appId:"",definition:void 0,environmentName:""}}var SandboxCreateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),void 0!==e.definition&&Sandbox.encode(e.definition,t.uint32(18).fork()).join(),""!==e.environmentName&&t.uint32(26).string(e.environmentName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(18!==e)break;a.definition=Sandbox.decode(n,n.uint32());continue;case 3:if(26!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",definition:isSet4(e.definition)?Sandbox.fromJSON(e.definition):void 0,environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),void 0!==e.definition&&(t.definition=Sandbox.toJSON(e.definition)),""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>SandboxCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxCreateRequest();return t.appId=e.appId??"",t.definition=void 0!==e.definition&&null!==e.definition?Sandbox.fromPartial(e.definition):void 0,t.environmentName=e.environmentName??"",t}};function createBaseSandboxCreateResponse(){return{sandboxId:""}}var SandboxCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):""}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),t},create:e=>SandboxCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxCreateResponse();return t.sandboxId=e.sandboxId??"",t}};function createBaseSandboxCreateV2Request(){return{appId:"",definition:void 0}}var SandboxCreateV2Request={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),void 0!==e.definition&&Sandbox.encode(e.definition,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxCreateV2Request();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(18!==e)break;a.definition=Sandbox.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",definition:isSet4(e.definition)?Sandbox.fromJSON(e.definition):void 0}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),void 0!==e.definition&&(t.definition=Sandbox.toJSON(e.definition)),t},create:e=>SandboxCreateV2Request.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxCreateV2Request();return t.appId=e.appId??"",t.definition=void 0!==e.definition&&null!==e.definition?Sandbox.fromPartial(e.definition):void 0,t}};function createBaseSandboxCreateV2Response(){return{sandboxId:"",tunnels:[],taskId:""}}var SandboxCreateV2Response={encode(e,t=new BinaryWriter){""!==e.sandboxId&&t.uint32(10).string(e.sandboxId);for(const n of e.tunnels)TunnelData.encode(n,t.uint32(18).fork()).join();return""!==e.taskId&&t.uint32(26).string(e.taskId),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxCreateV2Response();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue;case 2:if(18!==e)break;a.tunnels.push(TunnelData.decode(n,n.uint32()));continue;case 3:if(26!==e)break;a.taskId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",tunnels:globalThis.Array.isArray(e?.tunnels)?e.tunnels.map((e=>TunnelData.fromJSON(e))):[],taskId:isSet4(e.taskId)?globalThis.String(e.taskId):""}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),e.tunnels?.length&&(t.tunnels=e.tunnels.map((e=>TunnelData.toJSON(e)))),""!==e.taskId&&(t.taskId=e.taskId),t},create:e=>SandboxCreateV2Response.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxCreateV2Response();return t.sandboxId=e.sandboxId??"",t.tunnels=e.tunnels?.map((e=>TunnelData.fromPartial(e)))||[],t.taskId=e.taskId??"",t}};function createBaseSandboxGetCommandRouterAccessRequest(){return{sandboxId:""}}var SandboxGetCommandRouterAccessRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxGetCommandRouterAccessRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):""}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),t},create:e=>SandboxGetCommandRouterAccessRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxGetCommandRouterAccessRequest();return t.sandboxId=e.sandboxId??"",t}};function createBaseSandboxGetCommandRouterAccessResponse(){return{jwt:"",url:""}}var SandboxGetCommandRouterAccessResponse={encode:(e,t=new BinaryWriter)=>(""!==e.jwt&&t.uint32(10).string(e.jwt),""!==e.url&&t.uint32(18).string(e.url),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxGetCommandRouterAccessResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.jwt=n.string();continue;case 2:if(18!==e)break;a.url=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({jwt:isSet4(e.jwt)?globalThis.String(e.jwt):"",url:isSet4(e.url)?globalThis.String(e.url):""}),toJSON(e){const t={};return""!==e.jwt&&(t.jwt=e.jwt),""!==e.url&&(t.url=e.url),t},create:e=>SandboxGetCommandRouterAccessResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxGetCommandRouterAccessResponse();return t.jwt=e.jwt??"",t.url=e.url??"",t}};function createBaseSandboxGetFromNameRequest(){return{sandboxName:"",environmentName:"",appName:""}}var SandboxGetFromNameRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxName&&t.uint32(10).string(e.sandboxName),""!==e.environmentName&&t.uint32(18).string(e.environmentName),""!==e.appName&&t.uint32(26).string(e.appName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxGetFromNameRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxName=n.string();continue;case 2:if(18!==e)break;a.environmentName=n.string();continue;case 3:if(26!==e)break;a.appName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxName:isSet4(e.sandboxName)?globalThis.String(e.sandboxName):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",appName:isSet4(e.appName)?globalThis.String(e.appName):""}),toJSON(e){const t={};return""!==e.sandboxName&&(t.sandboxName=e.sandboxName),""!==e.environmentName&&(t.environmentName=e.environmentName),""!==e.appName&&(t.appName=e.appName),t},create:e=>SandboxGetFromNameRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxGetFromNameRequest();return t.sandboxName=e.sandboxName??"",t.environmentName=e.environmentName??"",t.appName=e.appName??"",t}};function createBaseSandboxGetFromNameResponse(){return{sandboxId:""}}var SandboxGetFromNameResponse={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxGetFromNameResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):""}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),t},create:e=>SandboxGetFromNameResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxGetFromNameResponse();return t.sandboxId=e.sandboxId??"",t}};function createBaseSandboxGetLogsRequest(){return{sandboxId:"",fileDescriptor:0,timeout:0,lastEntryId:""}}var SandboxGetLogsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),0!==e.fileDescriptor&&t.uint32(16).int32(e.fileDescriptor),0!==e.timeout&&t.uint32(29).float(e.timeout),""!==e.lastEntryId&&t.uint32(34).string(e.lastEntryId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxGetLogsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue;case 2:if(16!==e)break;a.fileDescriptor=n.int32();continue;case 3:if(29!==e)break;a.timeout=n.float();continue;case 4:if(34!==e)break;a.lastEntryId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",fileDescriptor:isSet4(e.fileDescriptor)?fileDescriptorFromJSON(e.fileDescriptor):0,timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0,lastEntryId:isSet4(e.lastEntryId)?globalThis.String(e.lastEntryId):""}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),0!==e.fileDescriptor&&(t.fileDescriptor=fileDescriptorToJSON(e.fileDescriptor)),0!==e.timeout&&(t.timeout=e.timeout),""!==e.lastEntryId&&(t.lastEntryId=e.lastEntryId),t},create:e=>SandboxGetLogsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxGetLogsRequest();return t.sandboxId=e.sandboxId??"",t.fileDescriptor=e.fileDescriptor??0,t.timeout=e.timeout??0,t.lastEntryId=e.lastEntryId??"",t}};function createBaseSandboxGetResourceUsageRequest(){return{sandboxId:""}}var SandboxGetResourceUsageRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxGetResourceUsageRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):""}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),t},create:e=>SandboxGetResourceUsageRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxGetResourceUsageRequest();return t.sandboxId=e.sandboxId??"",t}};function createBaseSandboxGetResourceUsageResponse(){return{cpuCoreNanosecs:0,memGibNanosecs:0,gpuNanosecs:0,gpuType:void 0}}var SandboxGetResourceUsageResponse={encode:(e,t=new BinaryWriter)=>(0!==e.cpuCoreNanosecs&&t.uint32(8).uint64(e.cpuCoreNanosecs),0!==e.memGibNanosecs&&t.uint32(16).uint64(e.memGibNanosecs),0!==e.gpuNanosecs&&t.uint32(24).uint64(e.gpuNanosecs),void 0!==e.gpuType&&t.uint32(34).string(e.gpuType),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxGetResourceUsageResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.cpuCoreNanosecs=longToNumber2(n.uint64());continue;case 2:if(16!==e)break;a.memGibNanosecs=longToNumber2(n.uint64());continue;case 3:if(24!==e)break;a.gpuNanosecs=longToNumber2(n.uint64());continue;case 4:if(34!==e)break;a.gpuType=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({cpuCoreNanosecs:isSet4(e.cpuCoreNanosecs)?globalThis.Number(e.cpuCoreNanosecs):0,memGibNanosecs:isSet4(e.memGibNanosecs)?globalThis.Number(e.memGibNanosecs):0,gpuNanosecs:isSet4(e.gpuNanosecs)?globalThis.Number(e.gpuNanosecs):0,gpuType:isSet4(e.gpuType)?globalThis.String(e.gpuType):void 0}),toJSON(e){const t={};return 0!==e.cpuCoreNanosecs&&(t.cpuCoreNanosecs=Math.round(e.cpuCoreNanosecs)),0!==e.memGibNanosecs&&(t.memGibNanosecs=Math.round(e.memGibNanosecs)),0!==e.gpuNanosecs&&(t.gpuNanosecs=Math.round(e.gpuNanosecs)),void 0!==e.gpuType&&(t.gpuType=e.gpuType),t},create:e=>SandboxGetResourceUsageResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxGetResourceUsageResponse();return t.cpuCoreNanosecs=e.cpuCoreNanosecs??0,t.memGibNanosecs=e.memGibNanosecs??0,t.gpuNanosecs=e.gpuNanosecs??0,t.gpuType=e.gpuType??void 0,t}};function createBaseSandboxGetTaskIdRequest(){return{sandboxId:"",timeout:void 0,waitUntilReady:!1}}var SandboxGetTaskIdRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),void 0!==e.timeout&&t.uint32(21).float(e.timeout),!1!==e.waitUntilReady&&t.uint32(24).bool(e.waitUntilReady),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxGetTaskIdRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue;case 2:if(21!==e)break;a.timeout=n.float();continue;case 3:if(24!==e)break;a.waitUntilReady=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):void 0,waitUntilReady:!!isSet4(e.waitUntilReady)&&globalThis.Boolean(e.waitUntilReady)}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),void 0!==e.timeout&&(t.timeout=e.timeout),!1!==e.waitUntilReady&&(t.waitUntilReady=e.waitUntilReady),t},create:e=>SandboxGetTaskIdRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxGetTaskIdRequest();return t.sandboxId=e.sandboxId??"",t.timeout=e.timeout??void 0,t.waitUntilReady=e.waitUntilReady??!1,t}};function createBaseSandboxGetTaskIdResponse(){return{taskId:void 0,taskResult:void 0}}var SandboxGetTaskIdResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.taskId&&t.uint32(10).string(e.taskId),void 0!==e.taskResult&&GenericResult.encode(e.taskResult,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxGetTaskIdResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.taskResult=GenericResult.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet4(e.taskId)?globalThis.String(e.taskId):void 0,taskResult:isSet4(e.taskResult)?GenericResult.fromJSON(e.taskResult):void 0}),toJSON(e){const t={};return void 0!==e.taskId&&(t.taskId=e.taskId),void 0!==e.taskResult&&(t.taskResult=GenericResult.toJSON(e.taskResult)),t},create:e=>SandboxGetTaskIdResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxGetTaskIdResponse();return t.taskId=e.taskId??void 0,t.taskResult=void 0!==e.taskResult&&null!==e.taskResult?GenericResult.fromPartial(e.taskResult):void 0,t}};function createBaseSandboxGetTunnelsRequest(){return{sandboxId:"",timeout:0}}var SandboxGetTunnelsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),0!==e.timeout&&t.uint32(21).float(e.timeout),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxGetTunnelsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue;case 2:if(21!==e)break;a.timeout=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),0!==e.timeout&&(t.timeout=e.timeout),t},create:e=>SandboxGetTunnelsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxGetTunnelsRequest();return t.sandboxId=e.sandboxId??"",t.timeout=e.timeout??0,t}};function createBaseSandboxGetTunnelsResponse(){return{result:void 0,tunnels:[]}}var SandboxGetTunnelsResponse={encode(e,t=new BinaryWriter){void 0!==e.result&&GenericResult.encode(e.result,t.uint32(10).fork()).join();for(const n of e.tunnels)TunnelData.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxGetTunnelsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.result=GenericResult.decode(n,n.uint32());continue;case 2:if(18!==e)break;a.tunnels.push(TunnelData.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({result:isSet4(e.result)?GenericResult.fromJSON(e.result):void 0,tunnels:globalThis.Array.isArray(e?.tunnels)?e.tunnels.map((e=>TunnelData.fromJSON(e))):[]}),toJSON(e){const t={};return void 0!==e.result&&(t.result=GenericResult.toJSON(e.result)),e.tunnels?.length&&(t.tunnels=e.tunnels.map((e=>TunnelData.toJSON(e)))),t},create:e=>SandboxGetTunnelsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxGetTunnelsResponse();return t.result=void 0!==e.result&&null!==e.result?GenericResult.fromPartial(e.result):void 0,t.tunnels=e.tunnels?.map((e=>TunnelData.fromPartial(e)))||[],t}};function createBaseSandboxHandleMetadata(){return{result:void 0}}var SandboxHandleMetadata={encode:(e,t=new BinaryWriter)=>(void 0!==e.result&&GenericResult.encode(e.result,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxHandleMetadata();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.result=GenericResult.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({result:isSet4(e.result)?GenericResult.fromJSON(e.result):void 0}),toJSON(e){const t={};return void 0!==e.result&&(t.result=GenericResult.toJSON(e.result)),t},create:e=>SandboxHandleMetadata.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxHandleMetadata();return t.result=void 0!==e.result&&null!==e.result?GenericResult.fromPartial(e.result):void 0,t}};function createBaseSandboxInfo(){return{id:"",createdAt:0,taskInfo:void 0,appId:"",tags:[],name:"",imageId:"",resourceInfo:void 0,regions:[],timeoutSecs:0,idleTimeoutSecs:void 0,readyAt:void 0}}var SandboxInfo={encode(e,t=new BinaryWriter){""!==e.id&&t.uint32(10).string(e.id),0!==e.createdAt&&t.uint32(25).double(e.createdAt),void 0!==e.taskInfo&&TaskInfo.encode(e.taskInfo,t.uint32(34).fork()).join(),""!==e.appId&&t.uint32(42).string(e.appId);for(const n of e.tags)SandboxTag.encode(n,t.uint32(50).fork()).join();""!==e.name&&t.uint32(58).string(e.name),""!==e.imageId&&t.uint32(66).string(e.imageId),void 0!==e.resourceInfo&&ResourceInfo.encode(e.resourceInfo,t.uint32(74).fork()).join();for(const n of e.regions)t.uint32(82).string(n);return 0!==e.timeoutSecs&&t.uint32(88).uint32(e.timeoutSecs),void 0!==e.idleTimeoutSecs&&t.uint32(96).uint32(e.idleTimeoutSecs),void 0!==e.readyAt&&t.uint32(105).double(e.readyAt),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.id=n.string();continue;case 3:if(25!==e)break;a.createdAt=n.double();continue;case 4:if(34!==e)break;a.taskInfo=TaskInfo.decode(n,n.uint32());continue;case 5:if(42!==e)break;a.appId=n.string();continue;case 6:if(50!==e)break;a.tags.push(SandboxTag.decode(n,n.uint32()));continue;case 7:if(58!==e)break;a.name=n.string();continue;case 8:if(66!==e)break;a.imageId=n.string();continue;case 9:if(74!==e)break;a.resourceInfo=ResourceInfo.decode(n,n.uint32());continue;case 10:if(82!==e)break;a.regions.push(n.string());continue;case 11:if(88!==e)break;a.timeoutSecs=n.uint32();continue;case 12:if(96!==e)break;a.idleTimeoutSecs=n.uint32();continue;case 13:if(105!==e)break;a.readyAt=n.double();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({id:isSet4(e.id)?globalThis.String(e.id):"",createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,taskInfo:isSet4(e.taskInfo)?TaskInfo.fromJSON(e.taskInfo):void 0,appId:isSet4(e.appId)?globalThis.String(e.appId):"",tags:globalThis.Array.isArray(e?.tags)?e.tags.map((e=>SandboxTag.fromJSON(e))):[],name:isSet4(e.name)?globalThis.String(e.name):"",imageId:isSet4(e.imageId)?globalThis.String(e.imageId):"",resourceInfo:isSet4(e.resourceInfo)?ResourceInfo.fromJSON(e.resourceInfo):void 0,regions:globalThis.Array.isArray(e?.regions)?e.regions.map((e=>globalThis.String(e))):[],timeoutSecs:isSet4(e.timeoutSecs)?globalThis.Number(e.timeoutSecs):0,idleTimeoutSecs:isSet4(e.idleTimeoutSecs)?globalThis.Number(e.idleTimeoutSecs):void 0,readyAt:isSet4(e.readyAt)?globalThis.Number(e.readyAt):void 0}),toJSON(e){const t={};return""!==e.id&&(t.id=e.id),0!==e.createdAt&&(t.createdAt=e.createdAt),void 0!==e.taskInfo&&(t.taskInfo=TaskInfo.toJSON(e.taskInfo)),""!==e.appId&&(t.appId=e.appId),e.tags?.length&&(t.tags=e.tags.map((e=>SandboxTag.toJSON(e)))),""!==e.name&&(t.name=e.name),""!==e.imageId&&(t.imageId=e.imageId),void 0!==e.resourceInfo&&(t.resourceInfo=ResourceInfo.toJSON(e.resourceInfo)),e.regions?.length&&(t.regions=e.regions),0!==e.timeoutSecs&&(t.timeoutSecs=Math.round(e.timeoutSecs)),void 0!==e.idleTimeoutSecs&&(t.idleTimeoutSecs=Math.round(e.idleTimeoutSecs)),void 0!==e.readyAt&&(t.readyAt=e.readyAt),t},create:e=>SandboxInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxInfo();return t.id=e.id??"",t.createdAt=e.createdAt??0,t.taskInfo=void 0!==e.taskInfo&&null!==e.taskInfo?TaskInfo.fromPartial(e.taskInfo):void 0,t.appId=e.appId??"",t.tags=e.tags?.map((e=>SandboxTag.fromPartial(e)))||[],t.name=e.name??"",t.imageId=e.imageId??"",t.resourceInfo=void 0!==e.resourceInfo&&null!==e.resourceInfo?ResourceInfo.fromPartial(e.resourceInfo):void 0,t.regions=e.regions?.map((e=>e))||[],t.timeoutSecs=e.timeoutSecs??0,t.idleTimeoutSecs=e.idleTimeoutSecs??void 0,t.readyAt=e.readyAt??void 0,t}};function createBaseSandboxListRequest(){return{appId:"",beforeTimestamp:0,environmentName:"",includeFinished:!1,tags:[]}}var SandboxListRequest={encode(e,t=new BinaryWriter){""!==e.appId&&t.uint32(10).string(e.appId),0!==e.beforeTimestamp&&t.uint32(17).double(e.beforeTimestamp),""!==e.environmentName&&t.uint32(26).string(e.environmentName),!1!==e.includeFinished&&t.uint32(32).bool(e.includeFinished);for(const n of e.tags)SandboxTag.encode(n,t.uint32(42).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxListRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(17!==e)break;a.beforeTimestamp=n.double();continue;case 3:if(26!==e)break;a.environmentName=n.string();continue;case 4:if(32!==e)break;a.includeFinished=n.bool();continue;case 5:if(42!==e)break;a.tags.push(SandboxTag.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",beforeTimestamp:isSet4(e.beforeTimestamp)?globalThis.Number(e.beforeTimestamp):0,environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",includeFinished:!!isSet4(e.includeFinished)&&globalThis.Boolean(e.includeFinished),tags:globalThis.Array.isArray(e?.tags)?e.tags.map((e=>SandboxTag.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),0!==e.beforeTimestamp&&(t.beforeTimestamp=e.beforeTimestamp),""!==e.environmentName&&(t.environmentName=e.environmentName),!1!==e.includeFinished&&(t.includeFinished=e.includeFinished),e.tags?.length&&(t.tags=e.tags.map((e=>SandboxTag.toJSON(e)))),t},create:e=>SandboxListRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxListRequest();return t.appId=e.appId??"",t.beforeTimestamp=e.beforeTimestamp??0,t.environmentName=e.environmentName??"",t.includeFinished=e.includeFinished??!1,t.tags=e.tags?.map((e=>SandboxTag.fromPartial(e)))||[],t}};function createBaseSandboxListResponse(){return{sandboxes:[]}}var SandboxListResponse={encode(e,t=new BinaryWriter){for(const n of e.sandboxes)SandboxInfo.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxes.push(SandboxInfo.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxes:globalThis.Array.isArray(e?.sandboxes)?e.sandboxes.map((e=>SandboxInfo.fromJSON(e))):[]}),toJSON(e){const t={};return e.sandboxes?.length&&(t.sandboxes=e.sandboxes.map((e=>SandboxInfo.toJSON(e)))),t},create:e=>SandboxListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxListResponse();return t.sandboxes=e.sandboxes?.map((e=>SandboxInfo.fromPartial(e)))||[],t}};function createBaseSandboxRestoreRequest(){return{snapshotId:"",sandboxNameOverride:"",sandboxNameOverrideType:0}}var SandboxRestoreRequest={encode:(e,t=new BinaryWriter)=>(""!==e.snapshotId&&t.uint32(10).string(e.snapshotId),""!==e.sandboxNameOverride&&t.uint32(18).string(e.sandboxNameOverride),0!==e.sandboxNameOverrideType&&t.uint32(24).int32(e.sandboxNameOverrideType),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxRestoreRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.snapshotId=n.string();continue;case 2:if(18!==e)break;a.sandboxNameOverride=n.string();continue;case 3:if(24!==e)break;a.sandboxNameOverrideType=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({snapshotId:isSet4(e.snapshotId)?globalThis.String(e.snapshotId):"",sandboxNameOverride:isSet4(e.sandboxNameOverride)?globalThis.String(e.sandboxNameOverride):"",sandboxNameOverrideType:isSet4(e.sandboxNameOverrideType)?sandboxRestoreRequest_SandboxNameOverrideTypeFromJSON(e.sandboxNameOverrideType):0}),toJSON(e){const t={};return""!==e.snapshotId&&(t.snapshotId=e.snapshotId),""!==e.sandboxNameOverride&&(t.sandboxNameOverride=e.sandboxNameOverride),0!==e.sandboxNameOverrideType&&(t.sandboxNameOverrideType=sandboxRestoreRequest_SandboxNameOverrideTypeToJSON(e.sandboxNameOverrideType)),t},create:e=>SandboxRestoreRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxRestoreRequest();return t.snapshotId=e.snapshotId??"",t.sandboxNameOverride=e.sandboxNameOverride??"",t.sandboxNameOverrideType=e.sandboxNameOverrideType??0,t}};function createBaseSandboxRestoreResponse(){return{sandboxId:""}}var SandboxRestoreResponse={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxRestoreResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):""}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),t},create:e=>SandboxRestoreResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxRestoreResponse();return t.sandboxId=e.sandboxId??"",t}};function createBaseSandboxSnapshotFsAsyncGetRequest(){return{imageId:"",timeout:0}}var SandboxSnapshotFsAsyncGetRequest={encode:(e,t=new BinaryWriter)=>(""!==e.imageId&&t.uint32(10).string(e.imageId),0!==e.timeout&&t.uint32(21).float(e.timeout),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxSnapshotFsAsyncGetRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.imageId=n.string();continue;case 2:if(21!==e)break;a.timeout=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({imageId:isSet4(e.imageId)?globalThis.String(e.imageId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0}),toJSON(e){const t={};return""!==e.imageId&&(t.imageId=e.imageId),0!==e.timeout&&(t.timeout=e.timeout),t},create:e=>SandboxSnapshotFsAsyncGetRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxSnapshotFsAsyncGetRequest();return t.imageId=e.imageId??"",t.timeout=e.timeout??0,t}};function createBaseSandboxSnapshotFsAsyncRequest(){return{sandboxId:""}}var SandboxSnapshotFsAsyncRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxSnapshotFsAsyncRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):""}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),t},create:e=>SandboxSnapshotFsAsyncRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxSnapshotFsAsyncRequest();return t.sandboxId=e.sandboxId??"",t}};function createBaseSandboxSnapshotFsAsyncResponse(){return{imageId:""}}var SandboxSnapshotFsAsyncResponse={encode:(e,t=new BinaryWriter)=>(""!==e.imageId&&t.uint32(10).string(e.imageId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxSnapshotFsAsyncResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.imageId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({imageId:isSet4(e.imageId)?globalThis.String(e.imageId):""}),toJSON(e){const t={};return""!==e.imageId&&(t.imageId=e.imageId),t},create:e=>SandboxSnapshotFsAsyncResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxSnapshotFsAsyncResponse();return t.imageId=e.imageId??"",t}};function createBaseSandboxSnapshotFsRequest(){return{sandboxId:"",timeout:0}}var SandboxSnapshotFsRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),0!==e.timeout&&t.uint32(21).float(e.timeout),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxSnapshotFsRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue;case 2:if(21!==e)break;a.timeout=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),0!==e.timeout&&(t.timeout=e.timeout),t},create:e=>SandboxSnapshotFsRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxSnapshotFsRequest();return t.sandboxId=e.sandboxId??"",t.timeout=e.timeout??0,t}};function createBaseSandboxSnapshotFsResponse(){return{imageId:"",result:void 0,imageMetadata:void 0}}var SandboxSnapshotFsResponse={encode:(e,t=new BinaryWriter)=>(""!==e.imageId&&t.uint32(10).string(e.imageId),void 0!==e.result&&GenericResult.encode(e.result,t.uint32(18).fork()).join(),void 0!==e.imageMetadata&&ImageMetadata.encode(e.imageMetadata,t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxSnapshotFsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.imageId=n.string();continue;case 2:if(18!==e)break;a.result=GenericResult.decode(n,n.uint32());continue;case 3:if(26!==e)break;a.imageMetadata=ImageMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({imageId:isSet4(e.imageId)?globalThis.String(e.imageId):"",result:isSet4(e.result)?GenericResult.fromJSON(e.result):void 0,imageMetadata:isSet4(e.imageMetadata)?ImageMetadata.fromJSON(e.imageMetadata):void 0}),toJSON(e){const t={};return""!==e.imageId&&(t.imageId=e.imageId),void 0!==e.result&&(t.result=GenericResult.toJSON(e.result)),void 0!==e.imageMetadata&&(t.imageMetadata=ImageMetadata.toJSON(e.imageMetadata)),t},create:e=>SandboxSnapshotFsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxSnapshotFsResponse();return t.imageId=e.imageId??"",t.result=void 0!==e.result&&null!==e.result?GenericResult.fromPartial(e.result):void 0,t.imageMetadata=void 0!==e.imageMetadata&&null!==e.imageMetadata?ImageMetadata.fromPartial(e.imageMetadata):void 0,t}};function createBaseSandboxSnapshotGetRequest(){return{snapshotId:""}}var SandboxSnapshotGetRequest={encode:(e,t=new BinaryWriter)=>(""!==e.snapshotId&&t.uint32(10).string(e.snapshotId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxSnapshotGetRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.snapshotId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({snapshotId:isSet4(e.snapshotId)?globalThis.String(e.snapshotId):""}),toJSON(e){const t={};return""!==e.snapshotId&&(t.snapshotId=e.snapshotId),t},create:e=>SandboxSnapshotGetRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxSnapshotGetRequest();return t.snapshotId=e.snapshotId??"",t}};function createBaseSandboxSnapshotGetResponse(){return{snapshotId:""}}var SandboxSnapshotGetResponse={encode:(e,t=new BinaryWriter)=>(""!==e.snapshotId&&t.uint32(10).string(e.snapshotId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxSnapshotGetResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.snapshotId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({snapshotId:isSet4(e.snapshotId)?globalThis.String(e.snapshotId):""}),toJSON(e){const t={};return""!==e.snapshotId&&(t.snapshotId=e.snapshotId),t},create:e=>SandboxSnapshotGetResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxSnapshotGetResponse();return t.snapshotId=e.snapshotId??"",t}};function createBaseSandboxSnapshotRequest(){return{sandboxId:""}}var SandboxSnapshotRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxSnapshotRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):""}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),t},create:e=>SandboxSnapshotRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxSnapshotRequest();return t.sandboxId=e.sandboxId??"",t}};function createBaseSandboxSnapshotResponse(){return{snapshotId:""}}var SandboxSnapshotResponse={encode:(e,t=new BinaryWriter)=>(""!==e.snapshotId&&t.uint32(10).string(e.snapshotId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxSnapshotResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.snapshotId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({snapshotId:isSet4(e.snapshotId)?globalThis.String(e.snapshotId):""}),toJSON(e){const t={};return""!==e.snapshotId&&(t.snapshotId=e.snapshotId),t},create:e=>SandboxSnapshotResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxSnapshotResponse();return t.snapshotId=e.snapshotId??"",t}};function createBaseSandboxSnapshotWaitRequest(){return{snapshotId:"",timeout:0}}var SandboxSnapshotWaitRequest={encode:(e,t=new BinaryWriter)=>(""!==e.snapshotId&&t.uint32(10).string(e.snapshotId),0!==e.timeout&&t.uint32(21).float(e.timeout),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxSnapshotWaitRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.snapshotId=n.string();continue;case 2:if(21!==e)break;a.timeout=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({snapshotId:isSet4(e.snapshotId)?globalThis.String(e.snapshotId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0}),toJSON(e){const t={};return""!==e.snapshotId&&(t.snapshotId=e.snapshotId),0!==e.timeout&&(t.timeout=e.timeout),t},create:e=>SandboxSnapshotWaitRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxSnapshotWaitRequest();return t.snapshotId=e.snapshotId??"",t.timeout=e.timeout??0,t}};function createBaseSandboxSnapshotWaitResponse(){return{result:void 0}}var SandboxSnapshotWaitResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.result&&GenericResult.encode(e.result,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxSnapshotWaitResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.result=GenericResult.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({result:isSet4(e.result)?GenericResult.fromJSON(e.result):void 0}),toJSON(e){const t={};return void 0!==e.result&&(t.result=GenericResult.toJSON(e.result)),t},create:e=>SandboxSnapshotWaitResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxSnapshotWaitResponse();return t.result=void 0!==e.result&&null!==e.result?GenericResult.fromPartial(e.result):void 0,t}};function createBaseSandboxStdinWriteRequest(){return{sandboxId:"",input:new Uint8Array(0),index:0,eof:!1}}var SandboxStdinWriteRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),0!==e.input.length&&t.uint32(18).bytes(e.input),0!==e.index&&t.uint32(24).uint32(e.index),!1!==e.eof&&t.uint32(32).bool(e.eof),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxStdinWriteRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue;case 2:if(18!==e)break;a.input=n.bytes();continue;case 3:if(24!==e)break;a.index=n.uint32();continue;case 4:if(32!==e)break;a.eof=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",input:isSet4(e.input)?bytesFromBase64(e.input):new Uint8Array(0),index:isSet4(e.index)?globalThis.Number(e.index):0,eof:!!isSet4(e.eof)&&globalThis.Boolean(e.eof)}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),0!==e.input.length&&(t.input=base64FromBytes(e.input)),0!==e.index&&(t.index=Math.round(e.index)),!1!==e.eof&&(t.eof=e.eof),t},create:e=>SandboxStdinWriteRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxStdinWriteRequest();return t.sandboxId=e.sandboxId??"",t.input=e.input??new Uint8Array(0),t.index=e.index??0,t.eof=e.eof??!1,t}};function createBaseSandboxStdinWriteResponse(){return{}}var SandboxStdinWriteResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxStdinWriteResponse();for(;n.pos<r;){const e=n.uint32();if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({}),toJSON:e=>({}),create:e=>SandboxStdinWriteResponse.fromPartial(e??{}),fromPartial:e=>createBaseSandboxStdinWriteResponse()};function createBaseSandboxTag(){return{tagName:"",tagValue:""}}var SandboxTag={encode:(e,t=new BinaryWriter)=>(""!==e.tagName&&t.uint32(10).string(e.tagName),""!==e.tagValue&&t.uint32(18).string(e.tagValue),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxTag();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.tagName=n.string();continue;case 2:if(18!==e)break;a.tagValue=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({tagName:isSet4(e.tagName)?globalThis.String(e.tagName):"",tagValue:isSet4(e.tagValue)?globalThis.String(e.tagValue):""}),toJSON(e){const t={};return""!==e.tagName&&(t.tagName=e.tagName),""!==e.tagValue&&(t.tagValue=e.tagValue),t},create:e=>SandboxTag.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxTag();return t.tagName=e.tagName??"",t.tagValue=e.tagValue??"",t}};function createBaseSandboxTagsGetRequest(){return{sandboxId:""}}var SandboxTagsGetRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxTagsGetRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):""}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),t},create:e=>SandboxTagsGetRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxTagsGetRequest();return t.sandboxId=e.sandboxId??"",t}};function createBaseSandboxTagsGetResponse(){return{tags:[]}}var SandboxTagsGetResponse={encode(e,t=new BinaryWriter){for(const n of e.tags)SandboxTag.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxTagsGetResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.tags.push(SandboxTag.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({tags:globalThis.Array.isArray(e?.tags)?e.tags.map((e=>SandboxTag.fromJSON(e))):[]}),toJSON(e){const t={};return e.tags?.length&&(t.tags=e.tags.map((e=>SandboxTag.toJSON(e)))),t},create:e=>SandboxTagsGetResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxTagsGetResponse();return t.tags=e.tags?.map((e=>SandboxTag.fromPartial(e)))||[],t}};function createBaseSandboxTagsSetRequest(){return{environmentName:"",sandboxId:"",tags:[]}}var SandboxTagsSetRequest={encode(e,t=new BinaryWriter){""!==e.environmentName&&t.uint32(10).string(e.environmentName),""!==e.sandboxId&&t.uint32(18).string(e.sandboxId);for(const n of e.tags)SandboxTag.encode(n,t.uint32(26).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxTagsSetRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.environmentName=n.string();continue;case 2:if(18!==e)break;a.sandboxId=n.string();continue;case 3:if(26!==e)break;a.tags.push(SandboxTag.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",tags:globalThis.Array.isArray(e?.tags)?e.tags.map((e=>SandboxTag.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.environmentName&&(t.environmentName=e.environmentName),""!==e.sandboxId&&(t.sandboxId=e.sandboxId),e.tags?.length&&(t.tags=e.tags.map((e=>SandboxTag.toJSON(e)))),t},create:e=>SandboxTagsSetRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxTagsSetRequest();return t.environmentName=e.environmentName??"",t.sandboxId=e.sandboxId??"",t.tags=e.tags?.map((e=>SandboxTag.fromPartial(e)))||[],t}};function createBaseSandboxTerminateRequest(){return{sandboxId:""}}var SandboxTerminateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxTerminateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):""}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),t},create:e=>SandboxTerminateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxTerminateRequest();return t.sandboxId=e.sandboxId??"",t}};function createBaseSandboxTerminateResponse(){return{existingResult:void 0}}var SandboxTerminateResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.existingResult&&GenericResult.encode(e.existingResult,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxTerminateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.existingResult=GenericResult.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({existingResult:isSet4(e.existingResult)?GenericResult.fromJSON(e.existingResult):void 0}),toJSON(e){const t={};return void 0!==e.existingResult&&(t.existingResult=GenericResult.toJSON(e.existingResult)),t},create:e=>SandboxTerminateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxTerminateResponse();return t.existingResult=void 0!==e.existingResult&&null!==e.existingResult?GenericResult.fromPartial(e.existingResult):void 0,t}};function createBaseSandboxWaitRequest(){return{sandboxId:"",timeout:0}}var SandboxWaitRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),0!==e.timeout&&t.uint32(21).float(e.timeout),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxWaitRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue;case 2:if(21!==e)break;a.timeout=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),0!==e.timeout&&(t.timeout=e.timeout),t},create:e=>SandboxWaitRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxWaitRequest();return t.sandboxId=e.sandboxId??"",t.timeout=e.timeout??0,t}};function createBaseSandboxWaitResponse(){return{result:void 0}}var SandboxWaitResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.result&&GenericResult.encode(e.result,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxWaitResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.result=GenericResult.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({result:isSet4(e.result)?GenericResult.fromJSON(e.result):void 0}),toJSON(e){const t={};return void 0!==e.result&&(t.result=GenericResult.toJSON(e.result)),t},create:e=>SandboxWaitResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxWaitResponse();return t.result=void 0!==e.result&&null!==e.result?GenericResult.fromPartial(e.result):void 0,t}};function createBaseSandboxWaitUntilReadyRequest(){return{sandboxId:"",timeout:0}}var SandboxWaitUntilReadyRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sandboxId&&t.uint32(10).string(e.sandboxId),0!==e.timeout&&t.uint32(21).float(e.timeout),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxWaitUntilReadyRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sandboxId=n.string();continue;case 2:if(21!==e)break;a.timeout=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0}),toJSON(e){const t={};return""!==e.sandboxId&&(t.sandboxId=e.sandboxId),0!==e.timeout&&(t.timeout=e.timeout),t},create:e=>SandboxWaitUntilReadyRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxWaitUntilReadyRequest();return t.sandboxId=e.sandboxId??"",t.timeout=e.timeout??0,t}};function createBaseSandboxWaitUntilReadyResponse(){return{readyAt:0}}var SandboxWaitUntilReadyResponse={encode:(e,t=new BinaryWriter)=>(0!==e.readyAt&&t.uint32(9).double(e.readyAt),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSandboxWaitUntilReadyResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(9!==e)break;a.readyAt=n.double();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({readyAt:isSet4(e.readyAt)?globalThis.Number(e.readyAt):0}),toJSON(e){const t={};return 0!==e.readyAt&&(t.readyAt=e.readyAt),t},create:e=>SandboxWaitUntilReadyResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSandboxWaitUntilReadyResponse();return t.readyAt=e.readyAt??0,t}};function createBaseSchedule(){return{cron:void 0,period:void 0}}var Schedule={encode:(e,t=new BinaryWriter)=>(void 0!==e.cron&&Schedule_Cron.encode(e.cron,t.uint32(10).fork()).join(),void 0!==e.period&&Schedule_Period.encode(e.period,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSchedule();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.cron=Schedule_Cron.decode(n,n.uint32());continue;case 2:if(18!==e)break;a.period=Schedule_Period.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({cron:isSet4(e.cron)?Schedule_Cron.fromJSON(e.cron):void 0,period:isSet4(e.period)?Schedule_Period.fromJSON(e.period):void 0}),toJSON(e){const t={};return void 0!==e.cron&&(t.cron=Schedule_Cron.toJSON(e.cron)),void 0!==e.period&&(t.period=Schedule_Period.toJSON(e.period)),t},create:e=>Schedule.fromPartial(e??{}),fromPartial(e){const t=createBaseSchedule();return t.cron=void 0!==e.cron&&null!==e.cron?Schedule_Cron.fromPartial(e.cron):void 0,t.period=void 0!==e.period&&null!==e.period?Schedule_Period.fromPartial(e.period):void 0,t}};function createBaseSchedule_Cron(){return{cronString:"",timezone:""}}var Schedule_Cron={encode:(e,t=new BinaryWriter)=>(""!==e.cronString&&t.uint32(10).string(e.cronString),""!==e.timezone&&t.uint32(18).string(e.timezone),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSchedule_Cron();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.cronString=n.string();continue;case 2:if(18!==e)break;a.timezone=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({cronString:isSet4(e.cronString)?globalThis.String(e.cronString):"",timezone:isSet4(e.timezone)?globalThis.String(e.timezone):""}),toJSON(e){const t={};return""!==e.cronString&&(t.cronString=e.cronString),""!==e.timezone&&(t.timezone=e.timezone),t},create:e=>Schedule_Cron.fromPartial(e??{}),fromPartial(e){const t=createBaseSchedule_Cron();return t.cronString=e.cronString??"",t.timezone=e.timezone??"",t}};function createBaseSchedule_Period(){return{years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0}}var Schedule_Period={encode:(e,t=new BinaryWriter)=>(0!==e.years&&t.uint32(8).int32(e.years),0!==e.months&&t.uint32(16).int32(e.months),0!==e.weeks&&t.uint32(24).int32(e.weeks),0!==e.days&&t.uint32(32).int32(e.days),0!==e.hours&&t.uint32(40).int32(e.hours),0!==e.minutes&&t.uint32(48).int32(e.minutes),0!==e.seconds&&t.uint32(61).float(e.seconds),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSchedule_Period();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.years=n.int32();continue;case 2:if(16!==e)break;a.months=n.int32();continue;case 3:if(24!==e)break;a.weeks=n.int32();continue;case 4:if(32!==e)break;a.days=n.int32();continue;case 5:if(40!==e)break;a.hours=n.int32();continue;case 6:if(48!==e)break;a.minutes=n.int32();continue;case 7:if(61!==e)break;a.seconds=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({years:isSet4(e.years)?globalThis.Number(e.years):0,months:isSet4(e.months)?globalThis.Number(e.months):0,weeks:isSet4(e.weeks)?globalThis.Number(e.weeks):0,days:isSet4(e.days)?globalThis.Number(e.days):0,hours:isSet4(e.hours)?globalThis.Number(e.hours):0,minutes:isSet4(e.minutes)?globalThis.Number(e.minutes):0,seconds:isSet4(e.seconds)?globalThis.Number(e.seconds):0}),toJSON(e){const t={};return 0!==e.years&&(t.years=Math.round(e.years)),0!==e.months&&(t.months=Math.round(e.months)),0!==e.weeks&&(t.weeks=Math.round(e.weeks)),0!==e.days&&(t.days=Math.round(e.days)),0!==e.hours&&(t.hours=Math.round(e.hours)),0!==e.minutes&&(t.minutes=Math.round(e.minutes)),0!==e.seconds&&(t.seconds=e.seconds),t},create:e=>Schedule_Period.fromPartial(e??{}),fromPartial(e){const t=createBaseSchedule_Period();return t.years=e.years??0,t.months=e.months??0,t.weeks=e.weeks??0,t.days=e.days??0,t.hours=e.hours??0,t.minutes=e.minutes??0,t.seconds=e.seconds??0,t}};function createBaseSchedulerPlacement(){return{regions:[],Zone:void 0,Lifecycle:void 0,InstanceTypes:[],nonpreemptible:!1}}var SchedulerPlacement={encode(e,t=new BinaryWriter){for(const n of e.regions)t.uint32(34).string(n);void 0!==e.Zone&&t.uint32(18).string(e.Zone),void 0!==e.Lifecycle&&t.uint32(26).string(e.Lifecycle);for(const n of e.InstanceTypes)t.uint32(42).string(n);return!1!==e.nonpreemptible&&t.uint32(48).bool(e.nonpreemptible),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSchedulerPlacement();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 4:if(34!==e)break;a.regions.push(n.string());continue;case 2:if(18!==e)break;a.Zone=n.string();continue;case 3:if(26!==e)break;a.Lifecycle=n.string();continue;case 5:if(42!==e)break;a.InstanceTypes.push(n.string());continue;case 6:if(48!==e)break;a.nonpreemptible=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({regions:globalThis.Array.isArray(e?.regions)?e.regions.map((e=>globalThis.String(e))):[],Zone:isSet4(e.Zone)?globalThis.String(e.Zone):void 0,Lifecycle:isSet4(e.Lifecycle)?globalThis.String(e.Lifecycle):void 0,InstanceTypes:globalThis.Array.isArray(e?.InstanceTypes)?e.InstanceTypes.map((e=>globalThis.String(e))):[],nonpreemptible:!!isSet4(e.nonpreemptible)&&globalThis.Boolean(e.nonpreemptible)}),toJSON(e){const t={};return e.regions?.length&&(t.regions=e.regions),void 0!==e.Zone&&(t.Zone=e.Zone),void 0!==e.Lifecycle&&(t.Lifecycle=e.Lifecycle),e.InstanceTypes?.length&&(t.InstanceTypes=e.InstanceTypes),!1!==e.nonpreemptible&&(t.nonpreemptible=e.nonpreemptible),t},create:e=>SchedulerPlacement.fromPartial(e??{}),fromPartial(e){const t=createBaseSchedulerPlacement();return t.regions=e.regions?.map((e=>e))||[],t.Zone=e.Zone??void 0,t.Lifecycle=e.Lifecycle??void 0,t.InstanceTypes=e.InstanceTypes?.map((e=>e))||[],t.nonpreemptible=e.nonpreemptible??!1,t}};function createBaseSecretDeleteRequest(){return{secretId:""}}var SecretDeleteRequest={encode:(e,t=new BinaryWriter)=>(""!==e.secretId&&t.uint32(10).string(e.secretId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSecretDeleteRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.secretId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({secretId:isSet4(e.secretId)?globalThis.String(e.secretId):""}),toJSON(e){const t={};return""!==e.secretId&&(t.secretId=e.secretId),t},create:e=>SecretDeleteRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSecretDeleteRequest();return t.secretId=e.secretId??"",t}};function createBaseSecretGetOrCreateRequest(){return{deploymentName:"",environmentName:"",objectCreationType:0,envDict:{},appId:"",requiredKeys:[]}}var SecretGetOrCreateRequest={encode(e,t=new BinaryWriter){""!==e.deploymentName&&t.uint32(10).string(e.deploymentName),""!==e.environmentName&&t.uint32(26).string(e.environmentName),0!==e.objectCreationType&&t.uint32(32).int32(e.objectCreationType),Object.entries(e.envDict).forEach((([e,n])=>{SecretGetOrCreateRequest_EnvDictEntry.encode({key:e,value:n},t.uint32(42).fork()).join()})),""!==e.appId&&t.uint32(50).string(e.appId);for(const n of e.requiredKeys)t.uint32(58).string(n);return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSecretGetOrCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.deploymentName=n.string();continue;case 3:if(26!==e)break;a.environmentName=n.string();continue;case 4:if(32!==e)break;a.objectCreationType=n.int32();continue;case 5:{if(42!==e)break;const t=SecretGetOrCreateRequest_EnvDictEntry.decode(n,n.uint32());void 0!==t.value&&(a.envDict[t.key]=t.value);continue}case 6:if(50!==e)break;a.appId=n.string();continue;case 7:if(58!==e)break;a.requiredKeys.push(n.string());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({deploymentName:isSet4(e.deploymentName)?globalThis.String(e.deploymentName):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",objectCreationType:isSet4(e.objectCreationType)?objectCreationTypeFromJSON(e.objectCreationType):0,envDict:isObject2(e.envDict)?Object.entries(e.envDict).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{},appId:isSet4(e.appId)?globalThis.String(e.appId):"",requiredKeys:globalThis.Array.isArray(e?.requiredKeys)?e.requiredKeys.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};if(""!==e.deploymentName&&(t.deploymentName=e.deploymentName),""!==e.environmentName&&(t.environmentName=e.environmentName),0!==e.objectCreationType&&(t.objectCreationType=objectCreationTypeToJSON(e.objectCreationType)),e.envDict){const n=Object.entries(e.envDict);n.length>0&&(t.envDict={},n.forEach((([e,n])=>{t.envDict[e]=n})))}return""!==e.appId&&(t.appId=e.appId),e.requiredKeys?.length&&(t.requiredKeys=e.requiredKeys),t},create:e=>SecretGetOrCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSecretGetOrCreateRequest();return t.deploymentName=e.deploymentName??"",t.environmentName=e.environmentName??"",t.objectCreationType=e.objectCreationType??0,t.envDict=Object.entries(e.envDict??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t.appId=e.appId??"",t.requiredKeys=e.requiredKeys?.map((e=>e))||[],t}};function createBaseSecretGetOrCreateRequest_EnvDictEntry(){return{key:"",value:""}}var SecretGetOrCreateRequest_EnvDictEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSecretGetOrCreateRequest_EnvDictEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>SecretGetOrCreateRequest_EnvDictEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseSecretGetOrCreateRequest_EnvDictEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseSecretGetOrCreateResponse(){return{secretId:"",metadata:void 0}}var SecretGetOrCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.secretId&&t.uint32(10).string(e.secretId),void 0!==e.metadata&&SecretMetadata.encode(e.metadata,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSecretGetOrCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.secretId=n.string();continue;case 2:if(18!==e)break;a.metadata=SecretMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({secretId:isSet4(e.secretId)?globalThis.String(e.secretId):"",metadata:isSet4(e.metadata)?SecretMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.secretId&&(t.secretId=e.secretId),void 0!==e.metadata&&(t.metadata=SecretMetadata.toJSON(e.metadata)),t},create:e=>SecretGetOrCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSecretGetOrCreateResponse();return t.secretId=e.secretId??"",t.metadata=void 0!==e.metadata&&null!==e.metadata?SecretMetadata.fromPartial(e.metadata):void 0,t}};function createBaseSecretListItem(){return{label:"",createdAt:0,lastUsedAt:0,environmentName:"",secretId:"",metadata:void 0}}var SecretListItem={encode:(e,t=new BinaryWriter)=>(""!==e.label&&t.uint32(10).string(e.label),0!==e.createdAt&&t.uint32(17).double(e.createdAt),0!==e.lastUsedAt&&t.uint32(25).double(e.lastUsedAt),""!==e.environmentName&&t.uint32(34).string(e.environmentName),""!==e.secretId&&t.uint32(42).string(e.secretId),void 0!==e.metadata&&SecretMetadata.encode(e.metadata,t.uint32(50).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSecretListItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.label=n.string();continue;case 2:if(17!==e)break;a.createdAt=n.double();continue;case 3:if(25!==e)break;a.lastUsedAt=n.double();continue;case 4:if(34!==e)break;a.environmentName=n.string();continue;case 5:if(42!==e)break;a.secretId=n.string();continue;case 6:if(50!==e)break;a.metadata=SecretMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({label:isSet4(e.label)?globalThis.String(e.label):"",createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,lastUsedAt:isSet4(e.lastUsedAt)?globalThis.Number(e.lastUsedAt):0,environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",secretId:isSet4(e.secretId)?globalThis.String(e.secretId):"",metadata:isSet4(e.metadata)?SecretMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.label&&(t.label=e.label),0!==e.createdAt&&(t.createdAt=e.createdAt),0!==e.lastUsedAt&&(t.lastUsedAt=e.lastUsedAt),""!==e.environmentName&&(t.environmentName=e.environmentName),""!==e.secretId&&(t.secretId=e.secretId),void 0!==e.metadata&&(t.metadata=SecretMetadata.toJSON(e.metadata)),t},create:e=>SecretListItem.fromPartial(e??{}),fromPartial(e){const t=createBaseSecretListItem();return t.label=e.label??"",t.createdAt=e.createdAt??0,t.lastUsedAt=e.lastUsedAt??0,t.environmentName=e.environmentName??"",t.secretId=e.secretId??"",t.metadata=void 0!==e.metadata&&null!==e.metadata?SecretMetadata.fromPartial(e.metadata):void 0,t}};function createBaseSecretListRequest(){return{environmentName:"",pagination:void 0}}var SecretListRequest={encode:(e,t=new BinaryWriter)=>(""!==e.environmentName&&t.uint32(10).string(e.environmentName),void 0!==e.pagination&&ListPagination.encode(e.pagination,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSecretListRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.environmentName=n.string();continue;case 2:if(18!==e)break;a.pagination=ListPagination.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",pagination:isSet4(e.pagination)?ListPagination.fromJSON(e.pagination):void 0}),toJSON(e){const t={};return""!==e.environmentName&&(t.environmentName=e.environmentName),void 0!==e.pagination&&(t.pagination=ListPagination.toJSON(e.pagination)),t},create:e=>SecretListRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSecretListRequest();return t.environmentName=e.environmentName??"",t.pagination=void 0!==e.pagination&&null!==e.pagination?ListPagination.fromPartial(e.pagination):void 0,t}};function createBaseSecretListResponse(){return{items:[],environmentName:""}}var SecretListResponse={encode(e,t=new BinaryWriter){for(const n of e.items)SecretListItem.encode(n,t.uint32(10).fork()).join();return""!==e.environmentName&&t.uint32(18).string(e.environmentName),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSecretListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.items.push(SecretListItem.decode(n,n.uint32()));continue;case 2:if(18!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({items:globalThis.Array.isArray(e?.items)?e.items.map((e=>SecretListItem.fromJSON(e))):[],environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return e.items?.length&&(t.items=e.items.map((e=>SecretListItem.toJSON(e)))),""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>SecretListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSecretListResponse();return t.items=e.items?.map((e=>SecretListItem.fromPartial(e)))||[],t.environmentName=e.environmentName??"",t}};function createBaseSecretMetadata(){return{name:"",creationInfo:void 0}}var SecretMetadata={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),void 0!==e.creationInfo&&CreationInfo.encode(e.creationInfo,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSecretMetadata();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(18!==e)break;a.creationInfo=CreationInfo.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",creationInfo:isSet4(e.creationInfo)?CreationInfo.fromJSON(e.creationInfo):void 0}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),void 0!==e.creationInfo&&(t.creationInfo=CreationInfo.toJSON(e.creationInfo)),t},create:e=>SecretMetadata.fromPartial(e??{}),fromPartial(e){const t=createBaseSecretMetadata();return t.name=e.name??"",t.creationInfo=void 0!==e.creationInfo&&null!==e.creationInfo?CreationInfo.fromPartial(e.creationInfo):void 0,t}};function createBaseSecretUpdateRequest(){return{secretId:"",updates:[]}}var SecretUpdateRequest={encode(e,t=new BinaryWriter){""!==e.secretId&&t.uint32(10).string(e.secretId);for(const n of e.updates)SecretUpdateRequest_Update.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSecretUpdateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.secretId=n.string();continue;case 2:if(18!==e)break;a.updates.push(SecretUpdateRequest_Update.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({secretId:isSet4(e.secretId)?globalThis.String(e.secretId):"",updates:globalThis.Array.isArray(e?.updates)?e.updates.map((e=>SecretUpdateRequest_Update.fromJSON(e))):[]}),toJSON(e){const t={};return""!==e.secretId&&(t.secretId=e.secretId),e.updates?.length&&(t.updates=e.updates.map((e=>SecretUpdateRequest_Update.toJSON(e)))),t},create:e=>SecretUpdateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSecretUpdateRequest();return t.secretId=e.secretId??"",t.updates=e.updates?.map((e=>SecretUpdateRequest_Update.fromPartial(e)))||[],t}};function createBaseSecretUpdateRequest_Update(){return{key:"",value:void 0}}var SecretUpdateRequest_Update={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),void 0!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSecretUpdateRequest_Update();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):void 0}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),void 0!==e.value&&(t.value=e.value),t},create:e=>SecretUpdateRequest_Update.fromPartial(e??{}),fromPartial(e){const t=createBaseSecretUpdateRequest_Update();return t.key=e.key??"",t.value=e.value??void 0,t}};function createBaseServiceUserIdentity(){return{serviceUserId:"",serviceUserName:"",createdBy:void 0}}var ServiceUserIdentity={encode:(e,t=new BinaryWriter)=>(""!==e.serviceUserId&&t.uint32(10).string(e.serviceUserId),""!==e.serviceUserName&&t.uint32(18).string(e.serviceUserName),void 0!==e.createdBy&&UserIdentity.encode(e.createdBy,t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseServiceUserIdentity();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.serviceUserId=n.string();continue;case 2:if(18!==e)break;a.serviceUserName=n.string();continue;case 3:if(26!==e)break;a.createdBy=UserIdentity.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({serviceUserId:isSet4(e.serviceUserId)?globalThis.String(e.serviceUserId):"",serviceUserName:isSet4(e.serviceUserName)?globalThis.String(e.serviceUserName):"",createdBy:isSet4(e.createdBy)?UserIdentity.fromJSON(e.createdBy):void 0}),toJSON(e){const t={};return""!==e.serviceUserId&&(t.serviceUserId=e.serviceUserId),""!==e.serviceUserName&&(t.serviceUserName=e.serviceUserName),void 0!==e.createdBy&&(t.createdBy=UserIdentity.toJSON(e.createdBy)),t},create:e=>ServiceUserIdentity.fromPartial(e??{}),fromPartial(e){const t=createBaseServiceUserIdentity();return t.serviceUserId=e.serviceUserId??"",t.serviceUserName=e.serviceUserName??"",t.createdBy=void 0!==e.createdBy&&null!==e.createdBy?UserIdentity.fromPartial(e.createdBy):void 0,t}};function createBaseSharedVolumeDeleteRequest(){return{sharedVolumeId:""}}var SharedVolumeDeleteRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sharedVolumeId&&t.uint32(10).string(e.sharedVolumeId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumeDeleteRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sharedVolumeId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sharedVolumeId:isSet4(e.sharedVolumeId)?globalThis.String(e.sharedVolumeId):""}),toJSON(e){const t={};return""!==e.sharedVolumeId&&(t.sharedVolumeId=e.sharedVolumeId),t},create:e=>SharedVolumeDeleteRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumeDeleteRequest();return t.sharedVolumeId=e.sharedVolumeId??"",t}};function createBaseSharedVolumeGetFileRequest(){return{sharedVolumeId:"",path:""}}var SharedVolumeGetFileRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sharedVolumeId&&t.uint32(10).string(e.sharedVolumeId),""!==e.path&&t.uint32(18).string(e.path),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumeGetFileRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sharedVolumeId=n.string();continue;case 2:if(18!==e)break;a.path=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sharedVolumeId:isSet4(e.sharedVolumeId)?globalThis.String(e.sharedVolumeId):"",path:isSet4(e.path)?globalThis.String(e.path):""}),toJSON(e){const t={};return""!==e.sharedVolumeId&&(t.sharedVolumeId=e.sharedVolumeId),""!==e.path&&(t.path=e.path),t},create:e=>SharedVolumeGetFileRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumeGetFileRequest();return t.sharedVolumeId=e.sharedVolumeId??"",t.path=e.path??"",t}};function createBaseSharedVolumeGetFileResponse(){return{data:void 0,dataBlobId:void 0}}var SharedVolumeGetFileResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.data&&t.uint32(10).bytes(e.data),void 0!==e.dataBlobId&&t.uint32(18).string(e.dataBlobId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumeGetFileResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.data=n.bytes();continue;case 2:if(18!==e)break;a.dataBlobId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({data:isSet4(e.data)?bytesFromBase64(e.data):void 0,dataBlobId:isSet4(e.dataBlobId)?globalThis.String(e.dataBlobId):void 0}),toJSON(e){const t={};return void 0!==e.data&&(t.data=base64FromBytes(e.data)),void 0!==e.dataBlobId&&(t.dataBlobId=e.dataBlobId),t},create:e=>SharedVolumeGetFileResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumeGetFileResponse();return t.data=e.data??void 0,t.dataBlobId=e.dataBlobId??void 0,t}};function createBaseSharedVolumeGetOrCreateRequest(){return{deploymentName:"",environmentName:"",objectCreationType:0,appId:""}}var SharedVolumeGetOrCreateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.deploymentName&&t.uint32(10).string(e.deploymentName),""!==e.environmentName&&t.uint32(26).string(e.environmentName),0!==e.objectCreationType&&t.uint32(32).int32(e.objectCreationType),""!==e.appId&&t.uint32(42).string(e.appId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumeGetOrCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.deploymentName=n.string();continue;case 3:if(26!==e)break;a.environmentName=n.string();continue;case 4:if(32!==e)break;a.objectCreationType=n.int32();continue;case 5:if(42!==e)break;a.appId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({deploymentName:isSet4(e.deploymentName)?globalThis.String(e.deploymentName):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",objectCreationType:isSet4(e.objectCreationType)?objectCreationTypeFromJSON(e.objectCreationType):0,appId:isSet4(e.appId)?globalThis.String(e.appId):""}),toJSON(e){const t={};return""!==e.deploymentName&&(t.deploymentName=e.deploymentName),""!==e.environmentName&&(t.environmentName=e.environmentName),0!==e.objectCreationType&&(t.objectCreationType=objectCreationTypeToJSON(e.objectCreationType)),""!==e.appId&&(t.appId=e.appId),t},create:e=>SharedVolumeGetOrCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumeGetOrCreateRequest();return t.deploymentName=e.deploymentName??"",t.environmentName=e.environmentName??"",t.objectCreationType=e.objectCreationType??0,t.appId=e.appId??"",t}};function createBaseSharedVolumeGetOrCreateResponse(){return{sharedVolumeId:""}}var SharedVolumeGetOrCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.sharedVolumeId&&t.uint32(10).string(e.sharedVolumeId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumeGetOrCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sharedVolumeId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sharedVolumeId:isSet4(e.sharedVolumeId)?globalThis.String(e.sharedVolumeId):""}),toJSON(e){const t={};return""!==e.sharedVolumeId&&(t.sharedVolumeId=e.sharedVolumeId),t},create:e=>SharedVolumeGetOrCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumeGetOrCreateResponse();return t.sharedVolumeId=e.sharedVolumeId??"",t}};function createBaseSharedVolumeHeartbeatRequest(){return{sharedVolumeId:""}}var SharedVolumeHeartbeatRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sharedVolumeId&&t.uint32(10).string(e.sharedVolumeId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumeHeartbeatRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sharedVolumeId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sharedVolumeId:isSet4(e.sharedVolumeId)?globalThis.String(e.sharedVolumeId):""}),toJSON(e){const t={};return""!==e.sharedVolumeId&&(t.sharedVolumeId=e.sharedVolumeId),t},create:e=>SharedVolumeHeartbeatRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumeHeartbeatRequest();return t.sharedVolumeId=e.sharedVolumeId??"",t}};function createBaseSharedVolumeListFilesRequest(){return{sharedVolumeId:"",path:""}}var SharedVolumeListFilesRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sharedVolumeId&&t.uint32(10).string(e.sharedVolumeId),""!==e.path&&t.uint32(18).string(e.path),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumeListFilesRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sharedVolumeId=n.string();continue;case 2:if(18!==e)break;a.path=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sharedVolumeId:isSet4(e.sharedVolumeId)?globalThis.String(e.sharedVolumeId):"",path:isSet4(e.path)?globalThis.String(e.path):""}),toJSON(e){const t={};return""!==e.sharedVolumeId&&(t.sharedVolumeId=e.sharedVolumeId),""!==e.path&&(t.path=e.path),t},create:e=>SharedVolumeListFilesRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumeListFilesRequest();return t.sharedVolumeId=e.sharedVolumeId??"",t.path=e.path??"",t}};function createBaseSharedVolumeListFilesResponse(){return{entries:[]}}var SharedVolumeListFilesResponse={encode(e,t=new BinaryWriter){for(const n of e.entries)FileEntry.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumeListFilesResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.entries.push(FileEntry.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({entries:globalThis.Array.isArray(e?.entries)?e.entries.map((e=>FileEntry.fromJSON(e))):[]}),toJSON(e){const t={};return e.entries?.length&&(t.entries=e.entries.map((e=>FileEntry.toJSON(e)))),t},create:e=>SharedVolumeListFilesResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumeListFilesResponse();return t.entries=e.entries?.map((e=>FileEntry.fromPartial(e)))||[],t}};function createBaseSharedVolumeListItem(){return{label:"",sharedVolumeId:"",createdAt:0,cloudProvider:0}}var SharedVolumeListItem={encode:(e,t=new BinaryWriter)=>(""!==e.label&&t.uint32(10).string(e.label),""!==e.sharedVolumeId&&t.uint32(18).string(e.sharedVolumeId),0!==e.createdAt&&t.uint32(25).double(e.createdAt),0!==e.cloudProvider&&t.uint32(32).int32(e.cloudProvider),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumeListItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.label=n.string();continue;case 2:if(18!==e)break;a.sharedVolumeId=n.string();continue;case 3:if(25!==e)break;a.createdAt=n.double();continue;case 4:if(32!==e)break;a.cloudProvider=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({label:isSet4(e.label)?globalThis.String(e.label):"",sharedVolumeId:isSet4(e.sharedVolumeId)?globalThis.String(e.sharedVolumeId):"",createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,cloudProvider:isSet4(e.cloudProvider)?cloudProviderFromJSON(e.cloudProvider):0}),toJSON(e){const t={};return""!==e.label&&(t.label=e.label),""!==e.sharedVolumeId&&(t.sharedVolumeId=e.sharedVolumeId),0!==e.createdAt&&(t.createdAt=e.createdAt),0!==e.cloudProvider&&(t.cloudProvider=cloudProviderToJSON(e.cloudProvider)),t},create:e=>SharedVolumeListItem.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumeListItem();return t.label=e.label??"",t.sharedVolumeId=e.sharedVolumeId??"",t.createdAt=e.createdAt??0,t.cloudProvider=e.cloudProvider??0,t}};function createBaseSharedVolumeListRequest(){return{environmentName:""}}var SharedVolumeListRequest={encode:(e,t=new BinaryWriter)=>(""!==e.environmentName&&t.uint32(10).string(e.environmentName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumeListRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>SharedVolumeListRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumeListRequest();return t.environmentName=e.environmentName??"",t}};function createBaseSharedVolumeListResponse(){return{items:[],environmentName:""}}var SharedVolumeListResponse={encode(e,t=new BinaryWriter){for(const n of e.items)SharedVolumeListItem.encode(n,t.uint32(10).fork()).join();return""!==e.environmentName&&t.uint32(18).string(e.environmentName),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumeListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.items.push(SharedVolumeListItem.decode(n,n.uint32()));continue;case 2:if(18!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({items:globalThis.Array.isArray(e?.items)?e.items.map((e=>SharedVolumeListItem.fromJSON(e))):[],environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return e.items?.length&&(t.items=e.items.map((e=>SharedVolumeListItem.toJSON(e)))),""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>SharedVolumeListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumeListResponse();return t.items=e.items?.map((e=>SharedVolumeListItem.fromPartial(e)))||[],t.environmentName=e.environmentName??"",t}};function createBaseSharedVolumeMount(){return{mountPath:"",sharedVolumeId:"",cloudProvider:0}}var SharedVolumeMount={encode:(e,t=new BinaryWriter)=>(""!==e.mountPath&&t.uint32(10).string(e.mountPath),""!==e.sharedVolumeId&&t.uint32(18).string(e.sharedVolumeId),0!==e.cloudProvider&&t.uint32(24).int32(e.cloudProvider),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumeMount();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.mountPath=n.string();continue;case 2:if(18!==e)break;a.sharedVolumeId=n.string();continue;case 3:if(24!==e)break;a.cloudProvider=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({mountPath:isSet4(e.mountPath)?globalThis.String(e.mountPath):"",sharedVolumeId:isSet4(e.sharedVolumeId)?globalThis.String(e.sharedVolumeId):"",cloudProvider:isSet4(e.cloudProvider)?cloudProviderFromJSON(e.cloudProvider):0}),toJSON(e){const t={};return""!==e.mountPath&&(t.mountPath=e.mountPath),""!==e.sharedVolumeId&&(t.sharedVolumeId=e.sharedVolumeId),0!==e.cloudProvider&&(t.cloudProvider=cloudProviderToJSON(e.cloudProvider)),t},create:e=>SharedVolumeMount.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumeMount();return t.mountPath=e.mountPath??"",t.sharedVolumeId=e.sharedVolumeId??"",t.cloudProvider=e.cloudProvider??0,t}};function createBaseSharedVolumePutFileRequest(){return{sharedVolumeId:"",path:"",sha256Hex:"",data:void 0,dataBlobId:void 0,resumable:!1}}var SharedVolumePutFileRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sharedVolumeId&&t.uint32(10).string(e.sharedVolumeId),""!==e.path&&t.uint32(18).string(e.path),""!==e.sha256Hex&&t.uint32(26).string(e.sha256Hex),void 0!==e.data&&t.uint32(34).bytes(e.data),void 0!==e.dataBlobId&&t.uint32(42).string(e.dataBlobId),!1!==e.resumable&&t.uint32(48).bool(e.resumable),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumePutFileRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sharedVolumeId=n.string();continue;case 2:if(18!==e)break;a.path=n.string();continue;case 3:if(26!==e)break;a.sha256Hex=n.string();continue;case 4:if(34!==e)break;a.data=n.bytes();continue;case 5:if(42!==e)break;a.dataBlobId=n.string();continue;case 6:if(48!==e)break;a.resumable=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sharedVolumeId:isSet4(e.sharedVolumeId)?globalThis.String(e.sharedVolumeId):"",path:isSet4(e.path)?globalThis.String(e.path):"",sha256Hex:isSet4(e.sha256Hex)?globalThis.String(e.sha256Hex):"",data:isSet4(e.data)?bytesFromBase64(e.data):void 0,dataBlobId:isSet4(e.dataBlobId)?globalThis.String(e.dataBlobId):void 0,resumable:!!isSet4(e.resumable)&&globalThis.Boolean(e.resumable)}),toJSON(e){const t={};return""!==e.sharedVolumeId&&(t.sharedVolumeId=e.sharedVolumeId),""!==e.path&&(t.path=e.path),""!==e.sha256Hex&&(t.sha256Hex=e.sha256Hex),void 0!==e.data&&(t.data=base64FromBytes(e.data)),void 0!==e.dataBlobId&&(t.dataBlobId=e.dataBlobId),!1!==e.resumable&&(t.resumable=e.resumable),t},create:e=>SharedVolumePutFileRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumePutFileRequest();return t.sharedVolumeId=e.sharedVolumeId??"",t.path=e.path??"",t.sha256Hex=e.sha256Hex??"",t.data=e.data??void 0,t.dataBlobId=e.dataBlobId??void 0,t.resumable=e.resumable??!1,t}};function createBaseSharedVolumePutFileResponse(){return{exists:!1}}var SharedVolumePutFileResponse={encode:(e,t=new BinaryWriter)=>(!1!==e.exists&&t.uint32(8).bool(e.exists),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumePutFileResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.exists=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({exists:!!isSet4(e.exists)&&globalThis.Boolean(e.exists)}),toJSON(e){const t={};return!1!==e.exists&&(t.exists=e.exists),t},create:e=>SharedVolumePutFileResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumePutFileResponse();return t.exists=e.exists??!1,t}};function createBaseSharedVolumeRemoveFileRequest(){return{sharedVolumeId:"",path:"",recursive:!1}}var SharedVolumeRemoveFileRequest={encode:(e,t=new BinaryWriter)=>(""!==e.sharedVolumeId&&t.uint32(10).string(e.sharedVolumeId),""!==e.path&&t.uint32(18).string(e.path),!1!==e.recursive&&t.uint32(24).bool(e.recursive),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSharedVolumeRemoveFileRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.sharedVolumeId=n.string();continue;case 2:if(18!==e)break;a.path=n.string();continue;case 3:if(24!==e)break;a.recursive=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({sharedVolumeId:isSet4(e.sharedVolumeId)?globalThis.String(e.sharedVolumeId):"",path:isSet4(e.path)?globalThis.String(e.path):"",recursive:!!isSet4(e.recursive)&&globalThis.Boolean(e.recursive)}),toJSON(e){const t={};return""!==e.sharedVolumeId&&(t.sharedVolumeId=e.sharedVolumeId),""!==e.path&&(t.path=e.path),!1!==e.recursive&&(t.recursive=e.recursive),t},create:e=>SharedVolumeRemoveFileRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseSharedVolumeRemoveFileRequest();return t.sharedVolumeId=e.sharedVolumeId??"",t.path=e.path??"",t.recursive=e.recursive??!1,t}};function createBaseSystemErrorMessage(){return{errorCode:0,errorMessage:""}}var SystemErrorMessage={encode:(e,t=new BinaryWriter)=>(0!==e.errorCode&&t.uint32(8).int32(e.errorCode),""!==e.errorMessage&&t.uint32(18).string(e.errorMessage),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseSystemErrorMessage();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.errorCode=n.int32();continue;case 2:if(18!==e)break;a.errorMessage=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({errorCode:isSet4(e.errorCode)?systemErrorCodeFromJSON(e.errorCode):0,errorMessage:isSet4(e.errorMessage)?globalThis.String(e.errorMessage):""}),toJSON(e){const t={};return 0!==e.errorCode&&(t.errorCode=systemErrorCodeToJSON(e.errorCode)),""!==e.errorMessage&&(t.errorMessage=e.errorMessage),t},create:e=>SystemErrorMessage.fromPartial(e??{}),fromPartial(e){const t=createBaseSystemErrorMessage();return t.errorCode=e.errorCode??0,t.errorMessage=e.errorMessage??"",t}};function createBaseTaskClusterHelloRequest(){return{taskId:"",containerIp:""}}var TaskClusterHelloRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),""!==e.containerIp&&t.uint32(18).string(e.containerIp),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskClusterHelloRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.containerIp=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet4(e.taskId)?globalThis.String(e.taskId):"",containerIp:isSet4(e.containerIp)?globalThis.String(e.containerIp):""}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),""!==e.containerIp&&(t.containerIp=e.containerIp),t},create:e=>TaskClusterHelloRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskClusterHelloRequest();return t.taskId=e.taskId??"",t.containerIp=e.containerIp??"",t}};function createBaseTaskClusterHelloResponse(){return{clusterId:"",clusterRank:0,containerIps:[],containerIpv4Ips:[]}}var TaskClusterHelloResponse={encode(e,t=new BinaryWriter){""!==e.clusterId&&t.uint32(10).string(e.clusterId),0!==e.clusterRank&&t.uint32(16).uint32(e.clusterRank);for(const n of e.containerIps)t.uint32(26).string(n);for(const n of e.containerIpv4Ips)t.uint32(34).string(n);return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskClusterHelloResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.clusterId=n.string();continue;case 2:if(16!==e)break;a.clusterRank=n.uint32();continue;case 3:if(26!==e)break;a.containerIps.push(n.string());continue;case 4:if(34!==e)break;a.containerIpv4Ips.push(n.string());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({clusterId:isSet4(e.clusterId)?globalThis.String(e.clusterId):"",clusterRank:isSet4(e.clusterRank)?globalThis.Number(e.clusterRank):0,containerIps:globalThis.Array.isArray(e?.containerIps)?e.containerIps.map((e=>globalThis.String(e))):[],containerIpv4Ips:globalThis.Array.isArray(e?.containerIpv4Ips)?e.containerIpv4Ips.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return""!==e.clusterId&&(t.clusterId=e.clusterId),0!==e.clusterRank&&(t.clusterRank=Math.round(e.clusterRank)),e.containerIps?.length&&(t.containerIps=e.containerIps),e.containerIpv4Ips?.length&&(t.containerIpv4Ips=e.containerIpv4Ips),t},create:e=>TaskClusterHelloResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskClusterHelloResponse();return t.clusterId=e.clusterId??"",t.clusterRank=e.clusterRank??0,t.containerIps=e.containerIps?.map((e=>e))||[],t.containerIpv4Ips=e.containerIpv4Ips?.map((e=>e))||[],t}};function createBaseTaskCurrentInputsResponse(){return{inputIds:[]}}var TaskCurrentInputsResponse={encode(e,t=new BinaryWriter){for(const n of e.inputIds)t.uint32(10).string(n);return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskCurrentInputsResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.inputIds.push(n.string());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({inputIds:globalThis.Array.isArray(e?.inputIds)?e.inputIds.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return e.inputIds?.length&&(t.inputIds=e.inputIds),t},create:e=>TaskCurrentInputsResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskCurrentInputsResponse();return t.inputIds=e.inputIds?.map((e=>e))||[],t}};function createBaseTaskGetCommandRouterAccessRequest(){return{taskId:""}}var TaskGetCommandRouterAccessRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskGetCommandRouterAccessRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet4(e.taskId)?globalThis.String(e.taskId):""}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),t},create:e=>TaskGetCommandRouterAccessRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskGetCommandRouterAccessRequest();return t.taskId=e.taskId??"",t}};function createBaseTaskGetCommandRouterAccessResponse(){return{jwt:"",url:""}}var TaskGetCommandRouterAccessResponse={encode:(e,t=new BinaryWriter)=>(""!==e.jwt&&t.uint32(10).string(e.jwt),""!==e.url&&t.uint32(18).string(e.url),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskGetCommandRouterAccessResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.jwt=n.string();continue;case 2:if(18!==e)break;a.url=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({jwt:isSet4(e.jwt)?globalThis.String(e.jwt):"",url:isSet4(e.url)?globalThis.String(e.url):""}),toJSON(e){const t={};return""!==e.jwt&&(t.jwt=e.jwt),""!==e.url&&(t.url=e.url),t},create:e=>TaskGetCommandRouterAccessResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskGetCommandRouterAccessResponse();return t.jwt=e.jwt??"",t.url=e.url??"",t}};function createBaseTaskGetInfoRequest(){return{taskId:""}}var TaskGetInfoRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskGetInfoRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet4(e.taskId)?globalThis.String(e.taskId):""}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),t},create:e=>TaskGetInfoRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskGetInfoRequest();return t.taskId=e.taskId??"",t}};function createBaseTaskGetInfoResponse(){return{appId:"",info:void 0}}var TaskGetInfoResponse={encode:(e,t=new BinaryWriter)=>(""!==e.appId&&t.uint32(10).string(e.appId),void 0!==e.info&&TaskInfo.encode(e.info,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskGetInfoResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.appId=n.string();continue;case 2:if(18!==e)break;a.info=TaskInfo.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({appId:isSet4(e.appId)?globalThis.String(e.appId):"",info:isSet4(e.info)?TaskInfo.fromJSON(e.info):void 0}),toJSON(e){const t={};return""!==e.appId&&(t.appId=e.appId),void 0!==e.info&&(t.info=TaskInfo.toJSON(e.info)),t},create:e=>TaskGetInfoResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskGetInfoResponse();return t.appId=e.appId??"",t.info=void 0!==e.info&&null!==e.info?TaskInfo.fromPartial(e.info):void 0,t}};function createBaseTaskInfo(){return{id:"",startedAt:0,finishedAt:0,result:void 0,enqueuedAt:0,gpuType:"",sandboxId:"",snapshotBehavior:0,gpuConfig:void 0}}var TaskInfo={encode:(e,t=new BinaryWriter)=>(""!==e.id&&t.uint32(10).string(e.id),0!==e.startedAt&&t.uint32(17).double(e.startedAt),0!==e.finishedAt&&t.uint32(25).double(e.finishedAt),void 0!==e.result&&GenericResult.encode(e.result,t.uint32(34).fork()).join(),0!==e.enqueuedAt&&t.uint32(41).double(e.enqueuedAt),""!==e.gpuType&&t.uint32(50).string(e.gpuType),""!==e.sandboxId&&t.uint32(58).string(e.sandboxId),0!==e.snapshotBehavior&&t.uint32(64).int32(e.snapshotBehavior),void 0!==e.gpuConfig&&GPUConfig.encode(e.gpuConfig,t.uint32(74).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.id=n.string();continue;case 2:if(17!==e)break;a.startedAt=n.double();continue;case 3:if(25!==e)break;a.finishedAt=n.double();continue;case 4:if(34!==e)break;a.result=GenericResult.decode(n,n.uint32());continue;case 5:if(41!==e)break;a.enqueuedAt=n.double();continue;case 6:if(50!==e)break;a.gpuType=n.string();continue;case 7:if(58!==e)break;a.sandboxId=n.string();continue;case 8:if(64!==e)break;a.snapshotBehavior=n.int32();continue;case 9:if(74!==e)break;a.gpuConfig=GPUConfig.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({id:isSet4(e.id)?globalThis.String(e.id):"",startedAt:isSet4(e.startedAt)?globalThis.Number(e.startedAt):0,finishedAt:isSet4(e.finishedAt)?globalThis.Number(e.finishedAt):0,result:isSet4(e.result)?GenericResult.fromJSON(e.result):void 0,enqueuedAt:isSet4(e.enqueuedAt)?globalThis.Number(e.enqueuedAt):0,gpuType:isSet4(e.gpuType)?globalThis.String(e.gpuType):"",sandboxId:isSet4(e.sandboxId)?globalThis.String(e.sandboxId):"",snapshotBehavior:isSet4(e.snapshotBehavior)?taskSnapshotBehaviorFromJSON(e.snapshotBehavior):0,gpuConfig:isSet4(e.gpuConfig)?GPUConfig.fromJSON(e.gpuConfig):void 0}),toJSON(e){const t={};return""!==e.id&&(t.id=e.id),0!==e.startedAt&&(t.startedAt=e.startedAt),0!==e.finishedAt&&(t.finishedAt=e.finishedAt),void 0!==e.result&&(t.result=GenericResult.toJSON(e.result)),0!==e.enqueuedAt&&(t.enqueuedAt=e.enqueuedAt),""!==e.gpuType&&(t.gpuType=e.gpuType),""!==e.sandboxId&&(t.sandboxId=e.sandboxId),0!==e.snapshotBehavior&&(t.snapshotBehavior=taskSnapshotBehaviorToJSON(e.snapshotBehavior)),void 0!==e.gpuConfig&&(t.gpuConfig=GPUConfig.toJSON(e.gpuConfig)),t},create:e=>TaskInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskInfo();return t.id=e.id??"",t.startedAt=e.startedAt??0,t.finishedAt=e.finishedAt??0,t.result=void 0!==e.result&&null!==e.result?GenericResult.fromPartial(e.result):void 0,t.enqueuedAt=e.enqueuedAt??0,t.gpuType=e.gpuType??"",t.sandboxId=e.sandboxId??"",t.snapshotBehavior=e.snapshotBehavior??0,t.gpuConfig=void 0!==e.gpuConfig&&null!==e.gpuConfig?GPUConfig.fromPartial(e.gpuConfig):void 0,t}};function createBaseTaskListRequest(){return{environmentName:"",appId:""}}var TaskListRequest={encode:(e,t=new BinaryWriter)=>(""!==e.environmentName&&t.uint32(10).string(e.environmentName),""!==e.appId&&t.uint32(18).string(e.appId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskListRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.environmentName=n.string();continue;case 2:if(18!==e)break;a.appId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",appId:isSet4(e.appId)?globalThis.String(e.appId):""}),toJSON(e){const t={};return""!==e.environmentName&&(t.environmentName=e.environmentName),""!==e.appId&&(t.appId=e.appId),t},create:e=>TaskListRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskListRequest();return t.environmentName=e.environmentName??"",t.appId=e.appId??"",t}};function createBaseTaskListResponse(){return{tasks:[]}}var TaskListResponse={encode(e,t=new BinaryWriter){for(const n of e.tasks)TaskStats.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.tasks.push(TaskStats.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({tasks:globalThis.Array.isArray(e?.tasks)?e.tasks.map((e=>TaskStats.fromJSON(e))):[]}),toJSON(e){const t={};return e.tasks?.length&&(t.tasks=e.tasks.map((e=>TaskStats.toJSON(e)))),t},create:e=>TaskListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskListResponse();return t.tasks=e.tasks?.map((e=>TaskStats.fromPartial(e)))||[],t}};function createBaseTaskLogs(){return{data:"",taskState:0,timestamp:0,fileDescriptor:0,taskProgress:void 0,functionCallId:"",inputId:"",timestampNs:0,containerId:"",containerName:""}}var TaskLogs={encode:(e,t=new BinaryWriter)=>(""!==e.data&&t.uint32(10).string(e.data),0!==e.taskState&&t.uint32(48).int32(e.taskState),0!==e.timestamp&&t.uint32(57).double(e.timestamp),0!==e.fileDescriptor&&t.uint32(64).int32(e.fileDescriptor),void 0!==e.taskProgress&&TaskProgress.encode(e.taskProgress,t.uint32(74).fork()).join(),""!==e.functionCallId&&t.uint32(82).string(e.functionCallId),""!==e.inputId&&t.uint32(90).string(e.inputId),0!==e.timestampNs&&t.uint32(96).uint64(e.timestampNs),""!==e.containerId&&t.uint32(106).string(e.containerId),""!==e.containerName&&t.uint32(114).string(e.containerName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskLogs();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.data=n.string();continue;case 6:if(48!==e)break;a.taskState=n.int32();continue;case 7:if(57!==e)break;a.timestamp=n.double();continue;case 8:if(64!==e)break;a.fileDescriptor=n.int32();continue;case 9:if(74!==e)break;a.taskProgress=TaskProgress.decode(n,n.uint32());continue;case 10:if(82!==e)break;a.functionCallId=n.string();continue;case 11:if(90!==e)break;a.inputId=n.string();continue;case 12:if(96!==e)break;a.timestampNs=longToNumber2(n.uint64());continue;case 13:if(106!==e)break;a.containerId=n.string();continue;case 14:if(114!==e)break;a.containerName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({data:isSet4(e.data)?globalThis.String(e.data):"",taskState:isSet4(e.taskState)?taskStateFromJSON(e.taskState):0,timestamp:isSet4(e.timestamp)?globalThis.Number(e.timestamp):0,fileDescriptor:isSet4(e.fileDescriptor)?fileDescriptorFromJSON(e.fileDescriptor):0,taskProgress:isSet4(e.taskProgress)?TaskProgress.fromJSON(e.taskProgress):void 0,functionCallId:isSet4(e.functionCallId)?globalThis.String(e.functionCallId):"",inputId:isSet4(e.inputId)?globalThis.String(e.inputId):"",timestampNs:isSet4(e.timestampNs)?globalThis.Number(e.timestampNs):0,containerId:isSet4(e.containerId)?globalThis.String(e.containerId):"",containerName:isSet4(e.containerName)?globalThis.String(e.containerName):""}),toJSON(e){const t={};return""!==e.data&&(t.data=e.data),0!==e.taskState&&(t.taskState=taskStateToJSON(e.taskState)),0!==e.timestamp&&(t.timestamp=e.timestamp),0!==e.fileDescriptor&&(t.fileDescriptor=fileDescriptorToJSON(e.fileDescriptor)),void 0!==e.taskProgress&&(t.taskProgress=TaskProgress.toJSON(e.taskProgress)),""!==e.functionCallId&&(t.functionCallId=e.functionCallId),""!==e.inputId&&(t.inputId=e.inputId),0!==e.timestampNs&&(t.timestampNs=Math.round(e.timestampNs)),""!==e.containerId&&(t.containerId=e.containerId),""!==e.containerName&&(t.containerName=e.containerName),t},create:e=>TaskLogs.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskLogs();return t.data=e.data??"",t.taskState=e.taskState??0,t.timestamp=e.timestamp??0,t.fileDescriptor=e.fileDescriptor??0,t.taskProgress=void 0!==e.taskProgress&&null!==e.taskProgress?TaskProgress.fromPartial(e.taskProgress):void 0,t.functionCallId=e.functionCallId??"",t.inputId=e.inputId??"",t.timestampNs=e.timestampNs??0,t.containerId=e.containerId??"",t.containerName=e.containerName??"",t}};function createBaseTaskLogsBatch(){return{taskId:"",items:[],entryId:"",appDone:!1,functionId:"",inputId:"",imageId:"",eof:!1,ptyExecId:"",rootFunctionId:"",ttlDays:0}}var TaskLogsBatch={encode(e,t=new BinaryWriter){""!==e.taskId&&t.uint32(10).string(e.taskId);for(const n of e.items)TaskLogs.encode(n,t.uint32(18).fork()).join();return""!==e.entryId&&t.uint32(42).string(e.entryId),!1!==e.appDone&&t.uint32(80).bool(e.appDone),""!==e.functionId&&t.uint32(90).string(e.functionId),""!==e.inputId&&t.uint32(98).string(e.inputId),""!==e.imageId&&t.uint32(106).string(e.imageId),!1!==e.eof&&t.uint32(112).bool(e.eof),""!==e.ptyExecId&&t.uint32(122).string(e.ptyExecId),""!==e.rootFunctionId&&t.uint32(130).string(e.rootFunctionId),0!==e.ttlDays&&t.uint32(136).uint32(e.ttlDays),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskLogsBatch();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.items.push(TaskLogs.decode(n,n.uint32()));continue;case 5:if(42!==e)break;a.entryId=n.string();continue;case 10:if(80!==e)break;a.appDone=n.bool();continue;case 11:if(90!==e)break;a.functionId=n.string();continue;case 12:if(98!==e)break;a.inputId=n.string();continue;case 13:if(106!==e)break;a.imageId=n.string();continue;case 14:if(112!==e)break;a.eof=n.bool();continue;case 15:if(122!==e)break;a.ptyExecId=n.string();continue;case 16:if(130!==e)break;a.rootFunctionId=n.string();continue;case 17:if(136!==e)break;a.ttlDays=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet4(e.taskId)?globalThis.String(e.taskId):"",items:globalThis.Array.isArray(e?.items)?e.items.map((e=>TaskLogs.fromJSON(e))):[],entryId:isSet4(e.entryId)?globalThis.String(e.entryId):"",appDone:!!isSet4(e.appDone)&&globalThis.Boolean(e.appDone),functionId:isSet4(e.functionId)?globalThis.String(e.functionId):"",inputId:isSet4(e.inputId)?globalThis.String(e.inputId):"",imageId:isSet4(e.imageId)?globalThis.String(e.imageId):"",eof:!!isSet4(e.eof)&&globalThis.Boolean(e.eof),ptyExecId:isSet4(e.ptyExecId)?globalThis.String(e.ptyExecId):"",rootFunctionId:isSet4(e.rootFunctionId)?globalThis.String(e.rootFunctionId):"",ttlDays:isSet4(e.ttlDays)?globalThis.Number(e.ttlDays):0}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),e.items?.length&&(t.items=e.items.map((e=>TaskLogs.toJSON(e)))),""!==e.entryId&&(t.entryId=e.entryId),!1!==e.appDone&&(t.appDone=e.appDone),""!==e.functionId&&(t.functionId=e.functionId),""!==e.inputId&&(t.inputId=e.inputId),""!==e.imageId&&(t.imageId=e.imageId),!1!==e.eof&&(t.eof=e.eof),""!==e.ptyExecId&&(t.ptyExecId=e.ptyExecId),""!==e.rootFunctionId&&(t.rootFunctionId=e.rootFunctionId),0!==e.ttlDays&&(t.ttlDays=Math.round(e.ttlDays)),t},create:e=>TaskLogsBatch.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskLogsBatch();return t.taskId=e.taskId??"",t.items=e.items?.map((e=>TaskLogs.fromPartial(e)))||[],t.entryId=e.entryId??"",t.appDone=e.appDone??!1,t.functionId=e.functionId??"",t.inputId=e.inputId??"",t.imageId=e.imageId??"",t.eof=e.eof??!1,t.ptyExecId=e.ptyExecId??"",t.rootFunctionId=e.rootFunctionId??"",t.ttlDays=e.ttlDays??0,t}};function createBaseTaskProgress(){return{len:0,pos:0,progressType:0,description:""}}var TaskProgress={encode:(e,t=new BinaryWriter)=>(0!==e.len&&t.uint32(8).uint64(e.len),0!==e.pos&&t.uint32(16).uint64(e.pos),0!==e.progressType&&t.uint32(24).int32(e.progressType),""!==e.description&&t.uint32(34).string(e.description),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskProgress();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.len=longToNumber2(n.uint64());continue;case 2:if(16!==e)break;a.pos=longToNumber2(n.uint64());continue;case 3:if(24!==e)break;a.progressType=n.int32();continue;case 4:if(34!==e)break;a.description=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({len:isSet4(e.len)?globalThis.Number(e.len):0,pos:isSet4(e.pos)?globalThis.Number(e.pos):0,progressType:isSet4(e.progressType)?progressTypeFromJSON(e.progressType):0,description:isSet4(e.description)?globalThis.String(e.description):""}),toJSON(e){const t={};return 0!==e.len&&(t.len=Math.round(e.len)),0!==e.pos&&(t.pos=Math.round(e.pos)),0!==e.progressType&&(t.progressType=progressTypeToJSON(e.progressType)),""!==e.description&&(t.description=e.description),t},create:e=>TaskProgress.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskProgress();return t.len=e.len??0,t.pos=e.pos??0,t.progressType=e.progressType??0,t.description=e.description??"",t}};function createBaseTaskResultRequest(){return{result:void 0}}var TaskResultRequest={encode:(e,t=new BinaryWriter)=>(void 0!==e.result&&GenericResult.encode(e.result,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskResultRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 2:if(18!==e)break;a.result=GenericResult.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({result:isSet4(e.result)?GenericResult.fromJSON(e.result):void 0}),toJSON(e){const t={};return void 0!==e.result&&(t.result=GenericResult.toJSON(e.result)),t},create:e=>TaskResultRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskResultRequest();return t.result=void 0!==e.result&&null!==e.result?GenericResult.fromPartial(e.result):void 0,t}};function createBaseTaskStats(){return{taskId:"",appId:"",appDescription:"",startedAt:0,enqueuedAt:0}}var TaskStats={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),""!==e.appId&&t.uint32(18).string(e.appId),""!==e.appDescription&&t.uint32(26).string(e.appDescription),0!==e.startedAt&&t.uint32(33).double(e.startedAt),0!==e.enqueuedAt&&t.uint32(41).double(e.enqueuedAt),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskStats();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.appId=n.string();continue;case 3:if(26!==e)break;a.appDescription=n.string();continue;case 4:if(33!==e)break;a.startedAt=n.double();continue;case 5:if(41!==e)break;a.enqueuedAt=n.double();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet4(e.taskId)?globalThis.String(e.taskId):"",appId:isSet4(e.appId)?globalThis.String(e.appId):"",appDescription:isSet4(e.appDescription)?globalThis.String(e.appDescription):"",startedAt:isSet4(e.startedAt)?globalThis.Number(e.startedAt):0,enqueuedAt:isSet4(e.enqueuedAt)?globalThis.Number(e.enqueuedAt):0}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),""!==e.appId&&(t.appId=e.appId),""!==e.appDescription&&(t.appDescription=e.appDescription),0!==e.startedAt&&(t.startedAt=e.startedAt),0!==e.enqueuedAt&&(t.enqueuedAt=e.enqueuedAt),t},create:e=>TaskStats.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskStats();return t.taskId=e.taskId??"",t.appId=e.appId??"",t.appDescription=e.appDescription??"",t.startedAt=e.startedAt??0,t.enqueuedAt=e.enqueuedAt??0,t}};function createBaseTaskTemplate(){return{rank:0,resources:void 0,targetConcurrentInputs:0,maxConcurrentInputs:0,index:0}}var TaskTemplate={encode:(e,t=new BinaryWriter)=>(0!==e.rank&&t.uint32(8).uint32(e.rank),void 0!==e.resources&&Resources.encode(e.resources,t.uint32(18).fork()).join(),0!==e.targetConcurrentInputs&&t.uint32(24).uint32(e.targetConcurrentInputs),0!==e.maxConcurrentInputs&&t.uint32(32).uint32(e.maxConcurrentInputs),0!==e.index&&t.uint32(40).uint32(e.index),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskTemplate();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.rank=n.uint32();continue;case 2:if(18!==e)break;a.resources=Resources.decode(n,n.uint32());continue;case 3:if(24!==e)break;a.targetConcurrentInputs=n.uint32();continue;case 4:if(32!==e)break;a.maxConcurrentInputs=n.uint32();continue;case 5:if(40!==e)break;a.index=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({rank:isSet4(e.rank)?globalThis.Number(e.rank):0,resources:isSet4(e.resources)?Resources.fromJSON(e.resources):void 0,targetConcurrentInputs:isSet4(e.targetConcurrentInputs)?globalThis.Number(e.targetConcurrentInputs):0,maxConcurrentInputs:isSet4(e.maxConcurrentInputs)?globalThis.Number(e.maxConcurrentInputs):0,index:isSet4(e.index)?globalThis.Number(e.index):0}),toJSON(e){const t={};return 0!==e.rank&&(t.rank=Math.round(e.rank)),void 0!==e.resources&&(t.resources=Resources.toJSON(e.resources)),0!==e.targetConcurrentInputs&&(t.targetConcurrentInputs=Math.round(e.targetConcurrentInputs)),0!==e.maxConcurrentInputs&&(t.maxConcurrentInputs=Math.round(e.maxConcurrentInputs)),0!==e.index&&(t.index=Math.round(e.index)),t},create:e=>TaskTemplate.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskTemplate();return t.rank=e.rank??0,t.resources=void 0!==e.resources&&null!==e.resources?Resources.fromPartial(e.resources):void 0,t.targetConcurrentInputs=e.targetConcurrentInputs??0,t.maxConcurrentInputs=e.maxConcurrentInputs??0,t.index=e.index??0,t}};function createBaseTemplateListRequest(){return{}}var TemplateListRequest={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTemplateListRequest();for(;n.pos<r;){const e=n.uint32();if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({}),toJSON:e=>({}),create:e=>TemplateListRequest.fromPartial(e??{}),fromPartial:e=>createBaseTemplateListRequest()};function createBaseTemplateListResponse(){return{items:[]}}var TemplateListResponse={encode(e,t=new BinaryWriter){for(const n of e.items)TemplateListResponse_TemplateListItem.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTemplateListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.items.push(TemplateListResponse_TemplateListItem.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({items:globalThis.Array.isArray(e?.items)?e.items.map((e=>TemplateListResponse_TemplateListItem.fromJSON(e))):[]}),toJSON(e){const t={};return e.items?.length&&(t.items=e.items.map((e=>TemplateListResponse_TemplateListItem.toJSON(e)))),t},create:e=>TemplateListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTemplateListResponse();return t.items=e.items?.map((e=>TemplateListResponse_TemplateListItem.fromPartial(e)))||[],t}};function createBaseTemplateListResponse_TemplateListItem(){return{name:"",repo:"",ref:""}}var TemplateListResponse_TemplateListItem={encode:(e,t=new BinaryWriter)=>(""!==e.name&&t.uint32(10).string(e.name),""!==e.repo&&t.uint32(18).string(e.repo),""!==e.ref&&t.uint32(26).string(e.ref),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTemplateListResponse_TemplateListItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.name=n.string();continue;case 2:if(18!==e)break;a.repo=n.string();continue;case 3:if(26!==e)break;a.ref=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({name:isSet4(e.name)?globalThis.String(e.name):"",repo:isSet4(e.repo)?globalThis.String(e.repo):"",ref:isSet4(e.ref)?globalThis.String(e.ref):""}),toJSON(e){const t={};return""!==e.name&&(t.name=e.name),""!==e.repo&&(t.repo=e.repo),""!==e.ref&&(t.ref=e.ref),t},create:e=>TemplateListResponse_TemplateListItem.fromPartial(e??{}),fromPartial(e){const t=createBaseTemplateListResponse_TemplateListItem();return t.name=e.name??"",t.repo=e.repo??"",t.ref=e.ref??"",t}};function createBaseTokenFlowCreateRequest(){return{utmSource:"",localhostPort:0,nextUrl:""}}var TokenFlowCreateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.utmSource&&t.uint32(26).string(e.utmSource),0!==e.localhostPort&&t.uint32(32).int32(e.localhostPort),""!==e.nextUrl&&t.uint32(42).string(e.nextUrl),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTokenFlowCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 3:if(26!==e)break;a.utmSource=n.string();continue;case 4:if(32!==e)break;a.localhostPort=n.int32();continue;case 5:if(42!==e)break;a.nextUrl=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({utmSource:isSet4(e.utmSource)?globalThis.String(e.utmSource):"",localhostPort:isSet4(e.localhostPort)?globalThis.Number(e.localhostPort):0,nextUrl:isSet4(e.nextUrl)?globalThis.String(e.nextUrl):""}),toJSON(e){const t={};return""!==e.utmSource&&(t.utmSource=e.utmSource),0!==e.localhostPort&&(t.localhostPort=Math.round(e.localhostPort)),""!==e.nextUrl&&(t.nextUrl=e.nextUrl),t},create:e=>TokenFlowCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTokenFlowCreateRequest();return t.utmSource=e.utmSource??"",t.localhostPort=e.localhostPort??0,t.nextUrl=e.nextUrl??"",t}};function createBaseTokenFlowCreateResponse(){return{tokenFlowId:"",webUrl:"",code:"",waitSecret:""}}var TokenFlowCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.tokenFlowId&&t.uint32(10).string(e.tokenFlowId),""!==e.webUrl&&t.uint32(18).string(e.webUrl),""!==e.code&&t.uint32(26).string(e.code),""!==e.waitSecret&&t.uint32(34).string(e.waitSecret),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTokenFlowCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.tokenFlowId=n.string();continue;case 2:if(18!==e)break;a.webUrl=n.string();continue;case 3:if(26!==e)break;a.code=n.string();continue;case 4:if(34!==e)break;a.waitSecret=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({tokenFlowId:isSet4(e.tokenFlowId)?globalThis.String(e.tokenFlowId):"",webUrl:isSet4(e.webUrl)?globalThis.String(e.webUrl):"",code:isSet4(e.code)?globalThis.String(e.code):"",waitSecret:isSet4(e.waitSecret)?globalThis.String(e.waitSecret):""}),toJSON(e){const t={};return""!==e.tokenFlowId&&(t.tokenFlowId=e.tokenFlowId),""!==e.webUrl&&(t.webUrl=e.webUrl),""!==e.code&&(t.code=e.code),""!==e.waitSecret&&(t.waitSecret=e.waitSecret),t},create:e=>TokenFlowCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTokenFlowCreateResponse();return t.tokenFlowId=e.tokenFlowId??"",t.webUrl=e.webUrl??"",t.code=e.code??"",t.waitSecret=e.waitSecret??"",t}};function createBaseTokenFlowWaitRequest(){return{timeout:0,tokenFlowId:"",waitSecret:""}}var TokenFlowWaitRequest={encode:(e,t=new BinaryWriter)=>(0!==e.timeout&&t.uint32(13).float(e.timeout),""!==e.tokenFlowId&&t.uint32(18).string(e.tokenFlowId),""!==e.waitSecret&&t.uint32(26).string(e.waitSecret),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTokenFlowWaitRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(13!==e)break;a.timeout=n.float();continue;case 2:if(18!==e)break;a.tokenFlowId=n.string();continue;case 3:if(26!==e)break;a.waitSecret=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({timeout:isSet4(e.timeout)?globalThis.Number(e.timeout):0,tokenFlowId:isSet4(e.tokenFlowId)?globalThis.String(e.tokenFlowId):"",waitSecret:isSet4(e.waitSecret)?globalThis.String(e.waitSecret):""}),toJSON(e){const t={};return 0!==e.timeout&&(t.timeout=e.timeout),""!==e.tokenFlowId&&(t.tokenFlowId=e.tokenFlowId),""!==e.waitSecret&&(t.waitSecret=e.waitSecret),t},create:e=>TokenFlowWaitRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTokenFlowWaitRequest();return t.timeout=e.timeout??0,t.tokenFlowId=e.tokenFlowId??"",t.waitSecret=e.waitSecret??"",t}};function createBaseTokenFlowWaitResponse(){return{tokenId:"",tokenSecret:"",timeout:!1,workspaceUsername:""}}var TokenFlowWaitResponse={encode:(e,t=new BinaryWriter)=>(""!==e.tokenId&&t.uint32(10).string(e.tokenId),""!==e.tokenSecret&&t.uint32(18).string(e.tokenSecret),!1!==e.timeout&&t.uint32(24).bool(e.timeout),""!==e.workspaceUsername&&t.uint32(34).string(e.workspaceUsername),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTokenFlowWaitResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.tokenId=n.string();continue;case 2:if(18!==e)break;a.tokenSecret=n.string();continue;case 3:if(24!==e)break;a.timeout=n.bool();continue;case 4:if(34!==e)break;a.workspaceUsername=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({tokenId:isSet4(e.tokenId)?globalThis.String(e.tokenId):"",tokenSecret:isSet4(e.tokenSecret)?globalThis.String(e.tokenSecret):"",timeout:!!isSet4(e.timeout)&&globalThis.Boolean(e.timeout),workspaceUsername:isSet4(e.workspaceUsername)?globalThis.String(e.workspaceUsername):""}),toJSON(e){const t={};return""!==e.tokenId&&(t.tokenId=e.tokenId),""!==e.tokenSecret&&(t.tokenSecret=e.tokenSecret),!1!==e.timeout&&(t.timeout=e.timeout),""!==e.workspaceUsername&&(t.workspaceUsername=e.workspaceUsername),t},create:e=>TokenFlowWaitResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTokenFlowWaitResponse();return t.tokenId=e.tokenId??"",t.tokenSecret=e.tokenSecret??"",t.timeout=e.timeout??!1,t.workspaceUsername=e.workspaceUsername??"",t}};function createBaseTokenInfoGetRequest(){return{}}var TokenInfoGetRequest={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTokenInfoGetRequest();for(;n.pos<r;){const e=n.uint32();if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({}),toJSON:e=>({}),create:e=>TokenInfoGetRequest.fromPartial(e??{}),fromPartial:e=>createBaseTokenInfoGetRequest()};function createBaseTokenInfoGetResponse(){return{tokenId:"",workspaceId:"",workspaceName:"",userIdentity:void 0,serviceUserIdentity:void 0,createdAt:void 0,expiresAt:void 0,tokenName:""}}var TokenInfoGetResponse={encode:(e,t=new BinaryWriter)=>(""!==e.tokenId&&t.uint32(10).string(e.tokenId),""!==e.workspaceId&&t.uint32(18).string(e.workspaceId),""!==e.workspaceName&&t.uint32(26).string(e.workspaceName),void 0!==e.userIdentity&&UserIdentity.encode(e.userIdentity,t.uint32(34).fork()).join(),void 0!==e.serviceUserIdentity&&ServiceUserIdentity.encode(e.serviceUserIdentity,t.uint32(42).fork()).join(),void 0!==e.createdAt&&Timestamp.encode(toTimestamp(e.createdAt),t.uint32(50).fork()).join(),void 0!==e.expiresAt&&Timestamp.encode(toTimestamp(e.expiresAt),t.uint32(58).fork()).join(),""!==e.tokenName&&t.uint32(66).string(e.tokenName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTokenInfoGetResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.tokenId=n.string();continue;case 2:if(18!==e)break;a.workspaceId=n.string();continue;case 3:if(26!==e)break;a.workspaceName=n.string();continue;case 4:if(34!==e)break;a.userIdentity=UserIdentity.decode(n,n.uint32());continue;case 5:if(42!==e)break;a.serviceUserIdentity=ServiceUserIdentity.decode(n,n.uint32());continue;case 6:if(50!==e)break;a.createdAt=fromTimestamp(Timestamp.decode(n,n.uint32()));continue;case 7:if(58!==e)break;a.expiresAt=fromTimestamp(Timestamp.decode(n,n.uint32()));continue;case 8:if(66!==e)break;a.tokenName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({tokenId:isSet4(e.tokenId)?globalThis.String(e.tokenId):"",workspaceId:isSet4(e.workspaceId)?globalThis.String(e.workspaceId):"",workspaceName:isSet4(e.workspaceName)?globalThis.String(e.workspaceName):"",userIdentity:isSet4(e.userIdentity)?UserIdentity.fromJSON(e.userIdentity):void 0,serviceUserIdentity:isSet4(e.serviceUserIdentity)?ServiceUserIdentity.fromJSON(e.serviceUserIdentity):void 0,createdAt:isSet4(e.createdAt)?fromJsonTimestamp(e.createdAt):void 0,expiresAt:isSet4(e.expiresAt)?fromJsonTimestamp(e.expiresAt):void 0,tokenName:isSet4(e.tokenName)?globalThis.String(e.tokenName):""}),toJSON(e){const t={};return""!==e.tokenId&&(t.tokenId=e.tokenId),""!==e.workspaceId&&(t.workspaceId=e.workspaceId),""!==e.workspaceName&&(t.workspaceName=e.workspaceName),void 0!==e.userIdentity&&(t.userIdentity=UserIdentity.toJSON(e.userIdentity)),void 0!==e.serviceUserIdentity&&(t.serviceUserIdentity=ServiceUserIdentity.toJSON(e.serviceUserIdentity)),void 0!==e.createdAt&&(t.createdAt=e.createdAt.toISOString()),void 0!==e.expiresAt&&(t.expiresAt=e.expiresAt.toISOString()),""!==e.tokenName&&(t.tokenName=e.tokenName),t},create:e=>TokenInfoGetResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTokenInfoGetResponse();return t.tokenId=e.tokenId??"",t.workspaceId=e.workspaceId??"",t.workspaceName=e.workspaceName??"",t.userIdentity=void 0!==e.userIdentity&&null!==e.userIdentity?UserIdentity.fromPartial(e.userIdentity):void 0,t.serviceUserIdentity=void 0!==e.serviceUserIdentity&&null!==e.serviceUserIdentity?ServiceUserIdentity.fromPartial(e.serviceUserIdentity):void 0,t.createdAt=e.createdAt??void 0,t.expiresAt=e.expiresAt??void 0,t.tokenName=e.tokenName??"",t}};function createBaseTunnelData(){return{host:"",port:0,unencryptedHost:void 0,unencryptedPort:void 0,containerPort:0}}var TunnelData={encode:(e,t=new BinaryWriter)=>(""!==e.host&&t.uint32(10).string(e.host),0!==e.port&&t.uint32(16).uint32(e.port),void 0!==e.unencryptedHost&&t.uint32(26).string(e.unencryptedHost),void 0!==e.unencryptedPort&&t.uint32(32).uint32(e.unencryptedPort),0!==e.containerPort&&t.uint32(40).uint32(e.containerPort),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTunnelData();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.host=n.string();continue;case 2:if(16!==e)break;a.port=n.uint32();continue;case 3:if(26!==e)break;a.unencryptedHost=n.string();continue;case 4:if(32!==e)break;a.unencryptedPort=n.uint32();continue;case 5:if(40!==e)break;a.containerPort=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({host:isSet4(e.host)?globalThis.String(e.host):"",port:isSet4(e.port)?globalThis.Number(e.port):0,unencryptedHost:isSet4(e.unencryptedHost)?globalThis.String(e.unencryptedHost):void 0,unencryptedPort:isSet4(e.unencryptedPort)?globalThis.Number(e.unencryptedPort):void 0,containerPort:isSet4(e.containerPort)?globalThis.Number(e.containerPort):0}),toJSON(e){const t={};return""!==e.host&&(t.host=e.host),0!==e.port&&(t.port=Math.round(e.port)),void 0!==e.unencryptedHost&&(t.unencryptedHost=e.unencryptedHost),void 0!==e.unencryptedPort&&(t.unencryptedPort=Math.round(e.unencryptedPort)),0!==e.containerPort&&(t.containerPort=Math.round(e.containerPort)),t},create:e=>TunnelData.fromPartial(e??{}),fromPartial(e){const t=createBaseTunnelData();return t.host=e.host??"",t.port=e.port??0,t.unencryptedHost=e.unencryptedHost??void 0,t.unencryptedPort=e.unencryptedPort??void 0,t.containerPort=e.containerPort??0,t}};function createBaseTunnelStartRequest(){return{port:0,unencrypted:!1,tunnelType:void 0}}var TunnelStartRequest={encode:(e,t=new BinaryWriter)=>(0!==e.port&&t.uint32(8).uint32(e.port),!1!==e.unencrypted&&t.uint32(16).bool(e.unencrypted),void 0!==e.tunnelType&&t.uint32(24).int32(e.tunnelType),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTunnelStartRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.port=n.uint32();continue;case 2:if(16!==e)break;a.unencrypted=n.bool();continue;case 3:if(24!==e)break;a.tunnelType=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({port:isSet4(e.port)?globalThis.Number(e.port):0,unencrypted:!!isSet4(e.unencrypted)&&globalThis.Boolean(e.unencrypted),tunnelType:isSet4(e.tunnelType)?tunnelTypeFromJSON(e.tunnelType):void 0}),toJSON(e){const t={};return 0!==e.port&&(t.port=Math.round(e.port)),!1!==e.unencrypted&&(t.unencrypted=e.unencrypted),void 0!==e.tunnelType&&(t.tunnelType=tunnelTypeToJSON(e.tunnelType)),t},create:e=>TunnelStartRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTunnelStartRequest();return t.port=e.port??0,t.unencrypted=e.unencrypted??!1,t.tunnelType=e.tunnelType??void 0,t}};function createBaseTunnelStartResponse(){return{host:"",port:0,unencryptedHost:void 0,unencryptedPort:void 0}}var TunnelStartResponse={encode:(e,t=new BinaryWriter)=>(""!==e.host&&t.uint32(10).string(e.host),0!==e.port&&t.uint32(16).uint32(e.port),void 0!==e.unencryptedHost&&t.uint32(26).string(e.unencryptedHost),void 0!==e.unencryptedPort&&t.uint32(32).uint32(e.unencryptedPort),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTunnelStartResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.host=n.string();continue;case 2:if(16!==e)break;a.port=n.uint32();continue;case 3:if(26!==e)break;a.unencryptedHost=n.string();continue;case 4:if(32!==e)break;a.unencryptedPort=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({host:isSet4(e.host)?globalThis.String(e.host):"",port:isSet4(e.port)?globalThis.Number(e.port):0,unencryptedHost:isSet4(e.unencryptedHost)?globalThis.String(e.unencryptedHost):void 0,unencryptedPort:isSet4(e.unencryptedPort)?globalThis.Number(e.unencryptedPort):void 0}),toJSON(e){const t={};return""!==e.host&&(t.host=e.host),0!==e.port&&(t.port=Math.round(e.port)),void 0!==e.unencryptedHost&&(t.unencryptedHost=e.unencryptedHost),void 0!==e.unencryptedPort&&(t.unencryptedPort=Math.round(e.unencryptedPort)),t},create:e=>TunnelStartResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTunnelStartResponse();return t.host=e.host??"",t.port=e.port??0,t.unencryptedHost=e.unencryptedHost??void 0,t.unencryptedPort=e.unencryptedPort??void 0,t}};function createBaseTunnelStopRequest(){return{port:0}}var TunnelStopRequest={encode:(e,t=new BinaryWriter)=>(0!==e.port&&t.uint32(8).uint32(e.port),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTunnelStopRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.port=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({port:isSet4(e.port)?globalThis.Number(e.port):0}),toJSON(e){const t={};return 0!==e.port&&(t.port=Math.round(e.port)),t},create:e=>TunnelStopRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTunnelStopRequest();return t.port=e.port??0,t}};function createBaseTunnelStopResponse(){return{exists:!1}}var TunnelStopResponse={encode:(e,t=new BinaryWriter)=>(!1!==e.exists&&t.uint32(8).bool(e.exists),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTunnelStopResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.exists=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({exists:!!isSet4(e.exists)&&globalThis.Boolean(e.exists)}),toJSON(e){const t={};return!1!==e.exists&&(t.exists=e.exists),t},create:e=>TunnelStopResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTunnelStopResponse();return t.exists=e.exists??!1,t}};function createBaseUploadUrlList(){return{items:[]}}var UploadUrlList={encode(e,t=new BinaryWriter){for(const n of e.items)t.uint32(10).string(n);return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseUploadUrlList();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.items.push(n.string());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({items:globalThis.Array.isArray(e?.items)?e.items.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return e.items?.length&&(t.items=e.items),t},create:e=>UploadUrlList.fromPartial(e??{}),fromPartial(e){const t=createBaseUploadUrlList();return t.items=e.items?.map((e=>e))||[],t}};function createBaseUserIdentity(){return{userId:"",username:""}}var UserIdentity={encode:(e,t=new BinaryWriter)=>(""!==e.userId&&t.uint32(10).string(e.userId),""!==e.username&&t.uint32(18).string(e.username),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseUserIdentity();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.userId=n.string();continue;case 2:if(18!==e)break;a.username=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({userId:isSet4(e.userId)?globalThis.String(e.userId):"",username:isSet4(e.username)?globalThis.String(e.username):""}),toJSON(e){const t={};return""!==e.userId&&(t.userId=e.userId),""!==e.username&&(t.username=e.username),t},create:e=>UserIdentity.fromPartial(e??{}),fromPartial(e){const t=createBaseUserIdentity();return t.userId=e.userId??"",t.username=e.username??"",t}};function createBaseVolumeCommitRequest(){return{volumeId:""}}var VolumeCommitRequest={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeCommitRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):""}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),t},create:e=>VolumeCommitRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeCommitRequest();return t.volumeId=e.volumeId??"",t}};function createBaseVolumeCommitResponse(){return{skipReload:!1}}var VolumeCommitResponse={encode:(e,t=new BinaryWriter)=>(!1!==e.skipReload&&t.uint32(8).bool(e.skipReload),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeCommitResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.skipReload=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({skipReload:!!isSet4(e.skipReload)&&globalThis.Boolean(e.skipReload)}),toJSON(e){const t={};return!1!==e.skipReload&&(t.skipReload=e.skipReload),t},create:e=>VolumeCommitResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeCommitResponse();return t.skipReload=e.skipReload??!1,t}};function createBaseVolumeCopyFiles2Request(){return{volumeId:"",srcPaths:[],dstPath:"",recursive:!1}}var VolumeCopyFiles2Request={encode(e,t=new BinaryWriter){""!==e.volumeId&&t.uint32(10).string(e.volumeId);for(const n of e.srcPaths)t.uint32(18).string(n);return""!==e.dstPath&&t.uint32(26).string(e.dstPath),!1!==e.recursive&&t.uint32(32).bool(e.recursive),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeCopyFiles2Request();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.srcPaths.push(n.string());continue;case 3:if(26!==e)break;a.dstPath=n.string();continue;case 4:if(32!==e)break;a.recursive=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",srcPaths:globalThis.Array.isArray(e?.srcPaths)?e.srcPaths.map((e=>globalThis.String(e))):[],dstPath:isSet4(e.dstPath)?globalThis.String(e.dstPath):"",recursive:!!isSet4(e.recursive)&&globalThis.Boolean(e.recursive)}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),e.srcPaths?.length&&(t.srcPaths=e.srcPaths),""!==e.dstPath&&(t.dstPath=e.dstPath),!1!==e.recursive&&(t.recursive=e.recursive),t},create:e=>VolumeCopyFiles2Request.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeCopyFiles2Request();return t.volumeId=e.volumeId??"",t.srcPaths=e.srcPaths?.map((e=>e))||[],t.dstPath=e.dstPath??"",t.recursive=e.recursive??!1,t}};function createBaseVolumeCopyFilesRequest(){return{volumeId:"",srcPaths:[],dstPath:"",recursive:!1}}var VolumeCopyFilesRequest={encode(e,t=new BinaryWriter){""!==e.volumeId&&t.uint32(10).string(e.volumeId);for(const n of e.srcPaths)t.uint32(18).string(n);return""!==e.dstPath&&t.uint32(26).string(e.dstPath),!1!==e.recursive&&t.uint32(32).bool(e.recursive),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeCopyFilesRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.srcPaths.push(n.string());continue;case 3:if(26!==e)break;a.dstPath=n.string();continue;case 4:if(32!==e)break;a.recursive=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",srcPaths:globalThis.Array.isArray(e?.srcPaths)?e.srcPaths.map((e=>globalThis.String(e))):[],dstPath:isSet4(e.dstPath)?globalThis.String(e.dstPath):"",recursive:!!isSet4(e.recursive)&&globalThis.Boolean(e.recursive)}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),e.srcPaths?.length&&(t.srcPaths=e.srcPaths),""!==e.dstPath&&(t.dstPath=e.dstPath),!1!==e.recursive&&(t.recursive=e.recursive),t},create:e=>VolumeCopyFilesRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeCopyFilesRequest();return t.volumeId=e.volumeId??"",t.srcPaths=e.srcPaths?.map((e=>e))||[],t.dstPath=e.dstPath??"",t.recursive=e.recursive??!1,t}};function createBaseVolumeDeleteRequest(){return{volumeId:"",environmentName:""}}var VolumeDeleteRequest={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),""!==e.environmentName&&t.uint32(18).string(e.environmentName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeDeleteRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>VolumeDeleteRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeDeleteRequest();return t.volumeId=e.volumeId??"",t.environmentName=e.environmentName??"",t}};function createBaseVolumeGetByIdRequest(){return{volumeId:""}}var VolumeGetByIdRequest={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeGetByIdRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):""}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),t},create:e=>VolumeGetByIdRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeGetByIdRequest();return t.volumeId=e.volumeId??"",t}};function createBaseVolumeGetByIdResponse(){return{volumeId:"",metadata:void 0}}var VolumeGetByIdResponse={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),void 0!==e.metadata&&VolumeMetadata.encode(e.metadata,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeGetByIdResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.metadata=VolumeMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",metadata:isSet4(e.metadata)?VolumeMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),void 0!==e.metadata&&(t.metadata=VolumeMetadata.toJSON(e.metadata)),t},create:e=>VolumeGetByIdResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeGetByIdResponse();return t.volumeId=e.volumeId??"",t.metadata=void 0!==e.metadata&&null!==e.metadata?VolumeMetadata.fromPartial(e.metadata):void 0,t}};function createBaseVolumeGetFile2Request(){return{volumeId:"",path:"",start:0,len:0}}var VolumeGetFile2Request={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),""!==e.path&&t.uint32(18).string(e.path),0!==e.start&&t.uint32(24).uint64(e.start),0!==e.len&&t.uint32(32).uint64(e.len),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeGetFile2Request();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.path=n.string();continue;case 3:if(24!==e)break;a.start=longToNumber2(n.uint64());continue;case 4:if(32!==e)break;a.len=longToNumber2(n.uint64());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",path:isSet4(e.path)?globalThis.String(e.path):"",start:isSet4(e.start)?globalThis.Number(e.start):0,len:isSet4(e.len)?globalThis.Number(e.len):0}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),""!==e.path&&(t.path=e.path),0!==e.start&&(t.start=Math.round(e.start)),0!==e.len&&(t.len=Math.round(e.len)),t},create:e=>VolumeGetFile2Request.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeGetFile2Request();return t.volumeId=e.volumeId??"",t.path=e.path??"",t.start=e.start??0,t.len=e.len??0,t}};function createBaseVolumeGetFile2Response(){return{getUrls:[],size:0,start:0,len:0}}var VolumeGetFile2Response={encode(e,t=new BinaryWriter){for(const n of e.getUrls)t.uint32(10).string(n);return 0!==e.size&&t.uint32(16).uint64(e.size),0!==e.start&&t.uint32(24).uint64(e.start),0!==e.len&&t.uint32(32).uint64(e.len),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeGetFile2Response();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.getUrls.push(n.string());continue;case 2:if(16!==e)break;a.size=longToNumber2(n.uint64());continue;case 3:if(24!==e)break;a.start=longToNumber2(n.uint64());continue;case 4:if(32!==e)break;a.len=longToNumber2(n.uint64());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({getUrls:globalThis.Array.isArray(e?.getUrls)?e.getUrls.map((e=>globalThis.String(e))):[],size:isSet4(e.size)?globalThis.Number(e.size):0,start:isSet4(e.start)?globalThis.Number(e.start):0,len:isSet4(e.len)?globalThis.Number(e.len):0}),toJSON(e){const t={};return e.getUrls?.length&&(t.getUrls=e.getUrls),0!==e.size&&(t.size=Math.round(e.size)),0!==e.start&&(t.start=Math.round(e.start)),0!==e.len&&(t.len=Math.round(e.len)),t},create:e=>VolumeGetFile2Response.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeGetFile2Response();return t.getUrls=e.getUrls?.map((e=>e))||[],t.size=e.size??0,t.start=e.start??0,t.len=e.len??0,t}};function createBaseVolumeGetFileRequest(){return{volumeId:"",path:"",start:0,len:0}}var VolumeGetFileRequest={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),""!==e.path&&t.uint32(18).string(e.path),0!==e.start&&t.uint32(24).uint64(e.start),0!==e.len&&t.uint32(32).uint64(e.len),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeGetFileRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.path=n.string();continue;case 3:if(24!==e)break;a.start=longToNumber2(n.uint64());continue;case 4:if(32!==e)break;a.len=longToNumber2(n.uint64());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",path:isSet4(e.path)?globalThis.String(e.path):"",start:isSet4(e.start)?globalThis.Number(e.start):0,len:isSet4(e.len)?globalThis.Number(e.len):0}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),""!==e.path&&(t.path=e.path),0!==e.start&&(t.start=Math.round(e.start)),0!==e.len&&(t.len=Math.round(e.len)),t},create:e=>VolumeGetFileRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeGetFileRequest();return t.volumeId=e.volumeId??"",t.path=e.path??"",t.start=e.start??0,t.len=e.len??0,t}};function createBaseVolumeGetFileResponse(){return{data:void 0,dataBlobId:void 0,size:0,start:0,len:0}}var VolumeGetFileResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.data&&t.uint32(10).bytes(e.data),void 0!==e.dataBlobId&&t.uint32(18).string(e.dataBlobId),0!==e.size&&t.uint32(24).uint64(e.size),0!==e.start&&t.uint32(32).uint64(e.start),0!==e.len&&t.uint32(40).uint64(e.len),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeGetFileResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.data=n.bytes();continue;case 2:if(18!==e)break;a.dataBlobId=n.string();continue;case 3:if(24!==e)break;a.size=longToNumber2(n.uint64());continue;case 4:if(32!==e)break;a.start=longToNumber2(n.uint64());continue;case 5:if(40!==e)break;a.len=longToNumber2(n.uint64());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({data:isSet4(e.data)?bytesFromBase64(e.data):void 0,dataBlobId:isSet4(e.dataBlobId)?globalThis.String(e.dataBlobId):void 0,size:isSet4(e.size)?globalThis.Number(e.size):0,start:isSet4(e.start)?globalThis.Number(e.start):0,len:isSet4(e.len)?globalThis.Number(e.len):0}),toJSON(e){const t={};return void 0!==e.data&&(t.data=base64FromBytes(e.data)),void 0!==e.dataBlobId&&(t.dataBlobId=e.dataBlobId),0!==e.size&&(t.size=Math.round(e.size)),0!==e.start&&(t.start=Math.round(e.start)),0!==e.len&&(t.len=Math.round(e.len)),t},create:e=>VolumeGetFileResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeGetFileResponse();return t.data=e.data??void 0,t.dataBlobId=e.dataBlobId??void 0,t.size=e.size??0,t.start=e.start??0,t.len=e.len??0,t}};function createBaseVolumeGetOrCreateRequest(){return{deploymentName:"",environmentName:"",objectCreationType:0,appId:"",version:0}}var VolumeGetOrCreateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.deploymentName&&t.uint32(10).string(e.deploymentName),""!==e.environmentName&&t.uint32(26).string(e.environmentName),0!==e.objectCreationType&&t.uint32(32).int32(e.objectCreationType),""!==e.appId&&t.uint32(42).string(e.appId),0!==e.version&&t.uint32(48).int32(e.version),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeGetOrCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.deploymentName=n.string();continue;case 3:if(26!==e)break;a.environmentName=n.string();continue;case 4:if(32!==e)break;a.objectCreationType=n.int32();continue;case 5:if(42!==e)break;a.appId=n.string();continue;case 6:if(48!==e)break;a.version=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({deploymentName:isSet4(e.deploymentName)?globalThis.String(e.deploymentName):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",objectCreationType:isSet4(e.objectCreationType)?objectCreationTypeFromJSON(e.objectCreationType):0,appId:isSet4(e.appId)?globalThis.String(e.appId):"",version:isSet4(e.version)?volumeFsVersionFromJSON(e.version):0}),toJSON(e){const t={};return""!==e.deploymentName&&(t.deploymentName=e.deploymentName),""!==e.environmentName&&(t.environmentName=e.environmentName),0!==e.objectCreationType&&(t.objectCreationType=objectCreationTypeToJSON(e.objectCreationType)),""!==e.appId&&(t.appId=e.appId),0!==e.version&&(t.version=volumeFsVersionToJSON(e.version)),t},create:e=>VolumeGetOrCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeGetOrCreateRequest();return t.deploymentName=e.deploymentName??"",t.environmentName=e.environmentName??"",t.objectCreationType=e.objectCreationType??0,t.appId=e.appId??"",t.version=e.version??0,t}};function createBaseVolumeGetOrCreateResponse(){return{volumeId:"",version:0,metadata:void 0}}var VolumeGetOrCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),0!==e.version&&t.uint32(16).int32(e.version),void 0!==e.metadata&&VolumeMetadata.encode(e.metadata,t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeGetOrCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(16!==e)break;a.version=n.int32();continue;case 3:if(26!==e)break;a.metadata=VolumeMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",version:isSet4(e.version)?volumeFsVersionFromJSON(e.version):0,metadata:isSet4(e.metadata)?VolumeMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),0!==e.version&&(t.version=volumeFsVersionToJSON(e.version)),void 0!==e.metadata&&(t.metadata=VolumeMetadata.toJSON(e.metadata)),t},create:e=>VolumeGetOrCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeGetOrCreateResponse();return t.volumeId=e.volumeId??"",t.version=e.version??0,t.metadata=void 0!==e.metadata&&null!==e.metadata?VolumeMetadata.fromPartial(e.metadata):void 0,t}};function createBaseVolumeHeartbeatRequest(){return{volumeId:""}}var VolumeHeartbeatRequest={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeHeartbeatRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):""}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),t},create:e=>VolumeHeartbeatRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeHeartbeatRequest();return t.volumeId=e.volumeId??"",t}};function createBaseVolumeListFiles2Request(){return{volumeId:"",path:"",recursive:!1,maxEntries:void 0}}var VolumeListFiles2Request={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),""!==e.path&&t.uint32(18).string(e.path),!1!==e.recursive&&t.uint32(32).bool(e.recursive),void 0!==e.maxEntries&&t.uint32(24).uint32(e.maxEntries),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeListFiles2Request();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.path=n.string();continue;case 4:if(32!==e)break;a.recursive=n.bool();continue;case 3:if(24!==e)break;a.maxEntries=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",path:isSet4(e.path)?globalThis.String(e.path):"",recursive:!!isSet4(e.recursive)&&globalThis.Boolean(e.recursive),maxEntries:isSet4(e.maxEntries)?globalThis.Number(e.maxEntries):void 0}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),""!==e.path&&(t.path=e.path),!1!==e.recursive&&(t.recursive=e.recursive),void 0!==e.maxEntries&&(t.maxEntries=Math.round(e.maxEntries)),t},create:e=>VolumeListFiles2Request.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeListFiles2Request();return t.volumeId=e.volumeId??"",t.path=e.path??"",t.recursive=e.recursive??!1,t.maxEntries=e.maxEntries??void 0,t}};function createBaseVolumeListFiles2Response(){return{entries:[]}}var VolumeListFiles2Response={encode(e,t=new BinaryWriter){for(const n of e.entries)FileEntry.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeListFiles2Response();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.entries.push(FileEntry.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({entries:globalThis.Array.isArray(e?.entries)?e.entries.map((e=>FileEntry.fromJSON(e))):[]}),toJSON(e){const t={};return e.entries?.length&&(t.entries=e.entries.map((e=>FileEntry.toJSON(e)))),t},create:e=>VolumeListFiles2Response.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeListFiles2Response();return t.entries=e.entries?.map((e=>FileEntry.fromPartial(e)))||[],t}};function createBaseVolumeListFilesRequest(){return{volumeId:"",path:"",recursive:!1,maxEntries:void 0}}var VolumeListFilesRequest={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),""!==e.path&&t.uint32(18).string(e.path),!1!==e.recursive&&t.uint32(32).bool(e.recursive),void 0!==e.maxEntries&&t.uint32(24).uint32(e.maxEntries),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeListFilesRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.path=n.string();continue;case 4:if(32!==e)break;a.recursive=n.bool();continue;case 3:if(24!==e)break;a.maxEntries=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",path:isSet4(e.path)?globalThis.String(e.path):"",recursive:!!isSet4(e.recursive)&&globalThis.Boolean(e.recursive),maxEntries:isSet4(e.maxEntries)?globalThis.Number(e.maxEntries):void 0}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),""!==e.path&&(t.path=e.path),!1!==e.recursive&&(t.recursive=e.recursive),void 0!==e.maxEntries&&(t.maxEntries=Math.round(e.maxEntries)),t},create:e=>VolumeListFilesRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeListFilesRequest();return t.volumeId=e.volumeId??"",t.path=e.path??"",t.recursive=e.recursive??!1,t.maxEntries=e.maxEntries??void 0,t}};function createBaseVolumeListFilesResponse(){return{entries:[]}}var VolumeListFilesResponse={encode(e,t=new BinaryWriter){for(const n of e.entries)FileEntry.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeListFilesResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.entries.push(FileEntry.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({entries:globalThis.Array.isArray(e?.entries)?e.entries.map((e=>FileEntry.fromJSON(e))):[]}),toJSON(e){const t={};return e.entries?.length&&(t.entries=e.entries.map((e=>FileEntry.toJSON(e)))),t},create:e=>VolumeListFilesResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeListFilesResponse();return t.entries=e.entries?.map((e=>FileEntry.fromPartial(e)))||[],t}};function createBaseVolumeListItem(){return{label:"",volumeId:"",createdAt:0,metadata:void 0}}var VolumeListItem={encode:(e,t=new BinaryWriter)=>(""!==e.label&&t.uint32(10).string(e.label),""!==e.volumeId&&t.uint32(18).string(e.volumeId),0!==e.createdAt&&t.uint32(25).double(e.createdAt),void 0!==e.metadata&&VolumeMetadata.encode(e.metadata,t.uint32(34).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeListItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.label=n.string();continue;case 2:if(18!==e)break;a.volumeId=n.string();continue;case 3:if(25!==e)break;a.createdAt=n.double();continue;case 4:if(34!==e)break;a.metadata=VolumeMetadata.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({label:isSet4(e.label)?globalThis.String(e.label):"",volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",createdAt:isSet4(e.createdAt)?globalThis.Number(e.createdAt):0,metadata:isSet4(e.metadata)?VolumeMetadata.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return""!==e.label&&(t.label=e.label),""!==e.volumeId&&(t.volumeId=e.volumeId),0!==e.createdAt&&(t.createdAt=e.createdAt),void 0!==e.metadata&&(t.metadata=VolumeMetadata.toJSON(e.metadata)),t},create:e=>VolumeListItem.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeListItem();return t.label=e.label??"",t.volumeId=e.volumeId??"",t.createdAt=e.createdAt??0,t.metadata=void 0!==e.metadata&&null!==e.metadata?VolumeMetadata.fromPartial(e.metadata):void 0,t}};function createBaseVolumeListRequest(){return{environmentName:"",pagination:void 0}}var VolumeListRequest={encode:(e,t=new BinaryWriter)=>(""!==e.environmentName&&t.uint32(10).string(e.environmentName),void 0!==e.pagination&&ListPagination.encode(e.pagination,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeListRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.environmentName=n.string();continue;case 2:if(18!==e)break;a.pagination=ListPagination.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",pagination:isSet4(e.pagination)?ListPagination.fromJSON(e.pagination):void 0}),toJSON(e){const t={};return""!==e.environmentName&&(t.environmentName=e.environmentName),void 0!==e.pagination&&(t.pagination=ListPagination.toJSON(e.pagination)),t},create:e=>VolumeListRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeListRequest();return t.environmentName=e.environmentName??"",t.pagination=void 0!==e.pagination&&null!==e.pagination?ListPagination.fromPartial(e.pagination):void 0,t}};function createBaseVolumeListResponse(){return{items:[],environmentName:""}}var VolumeListResponse={encode(e,t=new BinaryWriter){for(const n of e.items)VolumeListItem.encode(n,t.uint32(10).fork()).join();return""!==e.environmentName&&t.uint32(18).string(e.environmentName),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.items.push(VolumeListItem.decode(n,n.uint32()));continue;case 2:if(18!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({items:globalThis.Array.isArray(e?.items)?e.items.map((e=>VolumeListItem.fromJSON(e))):[],environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return e.items?.length&&(t.items=e.items.map((e=>VolumeListItem.toJSON(e)))),""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>VolumeListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeListResponse();return t.items=e.items?.map((e=>VolumeListItem.fromPartial(e)))||[],t.environmentName=e.environmentName??"",t}};function createBaseVolumeMetadata(){return{version:0,name:"",creationInfo:void 0}}var VolumeMetadata={encode:(e,t=new BinaryWriter)=>(0!==e.version&&t.uint32(8).int32(e.version),""!==e.name&&t.uint32(18).string(e.name),void 0!==e.creationInfo&&CreationInfo.encode(e.creationInfo,t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeMetadata();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.version=n.int32();continue;case 2:if(18!==e)break;a.name=n.string();continue;case 3:if(26!==e)break;a.creationInfo=CreationInfo.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({version:isSet4(e.version)?volumeFsVersionFromJSON(e.version):0,name:isSet4(e.name)?globalThis.String(e.name):"",creationInfo:isSet4(e.creationInfo)?CreationInfo.fromJSON(e.creationInfo):void 0}),toJSON(e){const t={};return 0!==e.version&&(t.version=volumeFsVersionToJSON(e.version)),""!==e.name&&(t.name=e.name),void 0!==e.creationInfo&&(t.creationInfo=CreationInfo.toJSON(e.creationInfo)),t},create:e=>VolumeMetadata.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeMetadata();return t.version=e.version??0,t.name=e.name??"",t.creationInfo=void 0!==e.creationInfo&&null!==e.creationInfo?CreationInfo.fromPartial(e.creationInfo):void 0,t}};function createBaseVolumeMount(){return{volumeId:"",mountPath:"",allowBackgroundCommits:!1,readOnly:!1}}var VolumeMount={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),""!==e.mountPath&&t.uint32(18).string(e.mountPath),!1!==e.allowBackgroundCommits&&t.uint32(24).bool(e.allowBackgroundCommits),!1!==e.readOnly&&t.uint32(32).bool(e.readOnly),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeMount();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.mountPath=n.string();continue;case 3:if(24!==e)break;a.allowBackgroundCommits=n.bool();continue;case 4:if(32!==e)break;a.readOnly=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",mountPath:isSet4(e.mountPath)?globalThis.String(e.mountPath):"",allowBackgroundCommits:!!isSet4(e.allowBackgroundCommits)&&globalThis.Boolean(e.allowBackgroundCommits),readOnly:!!isSet4(e.readOnly)&&globalThis.Boolean(e.readOnly)}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),""!==e.mountPath&&(t.mountPath=e.mountPath),!1!==e.allowBackgroundCommits&&(t.allowBackgroundCommits=e.allowBackgroundCommits),!1!==e.readOnly&&(t.readOnly=e.readOnly),t},create:e=>VolumeMount.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeMount();return t.volumeId=e.volumeId??"",t.mountPath=e.mountPath??"",t.allowBackgroundCommits=e.allowBackgroundCommits??!1,t.readOnly=e.readOnly??!1,t}};function createBaseVolumePutFiles2Request(){return{volumeId:"",files:[],disallowOverwriteExistingFiles:!1}}var VolumePutFiles2Request={encode(e,t=new BinaryWriter){""!==e.volumeId&&t.uint32(10).string(e.volumeId);for(const n of e.files)VolumePutFiles2Request_File.encode(n,t.uint32(18).fork()).join();return!1!==e.disallowOverwriteExistingFiles&&t.uint32(24).bool(e.disallowOverwriteExistingFiles),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumePutFiles2Request();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.files.push(VolumePutFiles2Request_File.decode(n,n.uint32()));continue;case 3:if(24!==e)break;a.disallowOverwriteExistingFiles=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",files:globalThis.Array.isArray(e?.files)?e.files.map((e=>VolumePutFiles2Request_File.fromJSON(e))):[],disallowOverwriteExistingFiles:!!isSet4(e.disallowOverwriteExistingFiles)&&globalThis.Boolean(e.disallowOverwriteExistingFiles)}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),e.files?.length&&(t.files=e.files.map((e=>VolumePutFiles2Request_File.toJSON(e)))),!1!==e.disallowOverwriteExistingFiles&&(t.disallowOverwriteExistingFiles=e.disallowOverwriteExistingFiles),t},create:e=>VolumePutFiles2Request.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumePutFiles2Request();return t.volumeId=e.volumeId??"",t.files=e.files?.map((e=>VolumePutFiles2Request_File.fromPartial(e)))||[],t.disallowOverwriteExistingFiles=e.disallowOverwriteExistingFiles??!1,t}};function createBaseVolumePutFiles2Request_File(){return{path:"",size:0,blocks:[],mode:void 0}}var VolumePutFiles2Request_File={encode(e,t=new BinaryWriter){""!==e.path&&t.uint32(10).string(e.path),0!==e.size&&t.uint32(16).uint64(e.size);for(const n of e.blocks)VolumePutFiles2Request_Block.encode(n,t.uint32(26).fork()).join();return void 0!==e.mode&&t.uint32(32).uint32(e.mode),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumePutFiles2Request_File();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.path=n.string();continue;case 2:if(16!==e)break;a.size=longToNumber2(n.uint64());continue;case 3:if(26!==e)break;a.blocks.push(VolumePutFiles2Request_Block.decode(n,n.uint32()));continue;case 4:if(32!==e)break;a.mode=n.uint32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({path:isSet4(e.path)?globalThis.String(e.path):"",size:isSet4(e.size)?globalThis.Number(e.size):0,blocks:globalThis.Array.isArray(e?.blocks)?e.blocks.map((e=>VolumePutFiles2Request_Block.fromJSON(e))):[],mode:isSet4(e.mode)?globalThis.Number(e.mode):void 0}),toJSON(e){const t={};return""!==e.path&&(t.path=e.path),0!==e.size&&(t.size=Math.round(e.size)),e.blocks?.length&&(t.blocks=e.blocks.map((e=>VolumePutFiles2Request_Block.toJSON(e)))),void 0!==e.mode&&(t.mode=Math.round(e.mode)),t},create:e=>VolumePutFiles2Request_File.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumePutFiles2Request_File();return t.path=e.path??"",t.size=e.size??0,t.blocks=e.blocks?.map((e=>VolumePutFiles2Request_Block.fromPartial(e)))||[],t.mode=e.mode??void 0,t}};function createBaseVolumePutFiles2Request_Block(){return{contentsSha256:new Uint8Array(0),putResponse:void 0}}var VolumePutFiles2Request_Block={encode:(e,t=new BinaryWriter)=>(0!==e.contentsSha256.length&&t.uint32(10).bytes(e.contentsSha256),void 0!==e.putResponse&&t.uint32(18).bytes(e.putResponse),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumePutFiles2Request_Block();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.contentsSha256=n.bytes();continue;case 2:if(18!==e)break;a.putResponse=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({contentsSha256:isSet4(e.contentsSha256)?bytesFromBase64(e.contentsSha256):new Uint8Array(0),putResponse:isSet4(e.putResponse)?bytesFromBase64(e.putResponse):void 0}),toJSON(e){const t={};return 0!==e.contentsSha256.length&&(t.contentsSha256=base64FromBytes(e.contentsSha256)),void 0!==e.putResponse&&(t.putResponse=base64FromBytes(e.putResponse)),t},create:e=>VolumePutFiles2Request_Block.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumePutFiles2Request_Block();return t.contentsSha256=e.contentsSha256??new Uint8Array(0),t.putResponse=e.putResponse??void 0,t}};function createBaseVolumePutFiles2Response(){return{missingBlocks:[]}}var VolumePutFiles2Response={encode(e,t=new BinaryWriter){for(const n of e.missingBlocks)VolumePutFiles2Response_MissingBlock.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumePutFiles2Response();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.missingBlocks.push(VolumePutFiles2Response_MissingBlock.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({missingBlocks:globalThis.Array.isArray(e?.missingBlocks)?e.missingBlocks.map((e=>VolumePutFiles2Response_MissingBlock.fromJSON(e))):[]}),toJSON(e){const t={};return e.missingBlocks?.length&&(t.missingBlocks=e.missingBlocks.map((e=>VolumePutFiles2Response_MissingBlock.toJSON(e)))),t},create:e=>VolumePutFiles2Response.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumePutFiles2Response();return t.missingBlocks=e.missingBlocks?.map((e=>VolumePutFiles2Response_MissingBlock.fromPartial(e)))||[],t}};function createBaseVolumePutFiles2Response_MissingBlock(){return{fileIndex:0,blockIndex:0,putUrl:""}}var VolumePutFiles2Response_MissingBlock={encode:(e,t=new BinaryWriter)=>(0!==e.fileIndex&&t.uint32(8).uint64(e.fileIndex),0!==e.blockIndex&&t.uint32(16).uint64(e.blockIndex),""!==e.putUrl&&t.uint32(26).string(e.putUrl),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumePutFiles2Response_MissingBlock();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.fileIndex=longToNumber2(n.uint64());continue;case 2:if(16!==e)break;a.blockIndex=longToNumber2(n.uint64());continue;case 3:if(26!==e)break;a.putUrl=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({fileIndex:isSet4(e.fileIndex)?globalThis.Number(e.fileIndex):0,blockIndex:isSet4(e.blockIndex)?globalThis.Number(e.blockIndex):0,putUrl:isSet4(e.putUrl)?globalThis.String(e.putUrl):""}),toJSON(e){const t={};return 0!==e.fileIndex&&(t.fileIndex=Math.round(e.fileIndex)),0!==e.blockIndex&&(t.blockIndex=Math.round(e.blockIndex)),""!==e.putUrl&&(t.putUrl=e.putUrl),t},create:e=>VolumePutFiles2Response_MissingBlock.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumePutFiles2Response_MissingBlock();return t.fileIndex=e.fileIndex??0,t.blockIndex=e.blockIndex??0,t.putUrl=e.putUrl??"",t}};function createBaseVolumePutFilesRequest(){return{volumeId:"",files:[],disallowOverwriteExistingFiles:!1}}var VolumePutFilesRequest={encode(e,t=new BinaryWriter){""!==e.volumeId&&t.uint32(10).string(e.volumeId);for(const n of e.files)MountFile.encode(n,t.uint32(18).fork()).join();return!1!==e.disallowOverwriteExistingFiles&&t.uint32(24).bool(e.disallowOverwriteExistingFiles),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumePutFilesRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.files.push(MountFile.decode(n,n.uint32()));continue;case 3:if(24!==e)break;a.disallowOverwriteExistingFiles=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",files:globalThis.Array.isArray(e?.files)?e.files.map((e=>MountFile.fromJSON(e))):[],disallowOverwriteExistingFiles:!!isSet4(e.disallowOverwriteExistingFiles)&&globalThis.Boolean(e.disallowOverwriteExistingFiles)}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),e.files?.length&&(t.files=e.files.map((e=>MountFile.toJSON(e)))),!1!==e.disallowOverwriteExistingFiles&&(t.disallowOverwriteExistingFiles=e.disallowOverwriteExistingFiles),t},create:e=>VolumePutFilesRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumePutFilesRequest();return t.volumeId=e.volumeId??"",t.files=e.files?.map((e=>MountFile.fromPartial(e)))||[],t.disallowOverwriteExistingFiles=e.disallowOverwriteExistingFiles??!1,t}};function createBaseVolumeReloadRequest(){return{volumeId:""}}var VolumeReloadRequest={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeReloadRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):""}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),t},create:e=>VolumeReloadRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeReloadRequest();return t.volumeId=e.volumeId??"",t}};function createBaseVolumeRemoveFile2Request(){return{volumeId:"",path:"",recursive:!1}}var VolumeRemoveFile2Request={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),""!==e.path&&t.uint32(18).string(e.path),!1!==e.recursive&&t.uint32(24).bool(e.recursive),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeRemoveFile2Request();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.path=n.string();continue;case 3:if(24!==e)break;a.recursive=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",path:isSet4(e.path)?globalThis.String(e.path):"",recursive:!!isSet4(e.recursive)&&globalThis.Boolean(e.recursive)}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),""!==e.path&&(t.path=e.path),!1!==e.recursive&&(t.recursive=e.recursive),t},create:e=>VolumeRemoveFile2Request.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeRemoveFile2Request();return t.volumeId=e.volumeId??"",t.path=e.path??"",t.recursive=e.recursive??!1,t}};function createBaseVolumeRemoveFileRequest(){return{volumeId:"",path:"",recursive:!1}}var VolumeRemoveFileRequest={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),""!==e.path&&t.uint32(18).string(e.path),!1!==e.recursive&&t.uint32(24).bool(e.recursive),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeRemoveFileRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.path=n.string();continue;case 3:if(24!==e)break;a.recursive=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",path:isSet4(e.path)?globalThis.String(e.path):"",recursive:!!isSet4(e.recursive)&&globalThis.Boolean(e.recursive)}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),""!==e.path&&(t.path=e.path),!1!==e.recursive&&(t.recursive=e.recursive),t},create:e=>VolumeRemoveFileRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeRemoveFileRequest();return t.volumeId=e.volumeId??"",t.path=e.path??"",t.recursive=e.recursive??!1,t}};function createBaseVolumeRenameRequest(){return{volumeId:"",name:""}}var VolumeRenameRequest={encode:(e,t=new BinaryWriter)=>(""!==e.volumeId&&t.uint32(10).string(e.volumeId),""!==e.name&&t.uint32(18).string(e.name),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseVolumeRenameRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.volumeId=n.string();continue;case 2:if(18!==e)break;a.name=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({volumeId:isSet4(e.volumeId)?globalThis.String(e.volumeId):"",name:isSet4(e.name)?globalThis.String(e.name):""}),toJSON(e){const t={};return""!==e.volumeId&&(t.volumeId=e.volumeId),""!==e.name&&(t.name=e.name),t},create:e=>VolumeRenameRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseVolumeRenameRequest();return t.volumeId=e.volumeId??"",t.name=e.name??"",t}};function createBaseWarning(){return{type:0,message:""}}var Warning={encode:(e,t=new BinaryWriter)=>(0!==e.type&&t.uint32(8).int32(e.type),""!==e.message&&t.uint32(18).string(e.message),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseWarning();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.type=n.int32();continue;case 2:if(18!==e)break;a.message=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({type:isSet4(e.type)?warning_WarningTypeFromJSON(e.type):0,message:isSet4(e.message)?globalThis.String(e.message):""}),toJSON(e){const t={};return 0!==e.type&&(t.type=warning_WarningTypeToJSON(e.type)),""!==e.message&&(t.message=e.message),t},create:e=>Warning.fromPartial(e??{}),fromPartial(e){const t=createBaseWarning();return t.type=e.type??0,t.message=e.message??"",t}};function createBaseWebUrlInfo(){return{truncated:!1,hasUniqueHash:!1,labelStolen:!1}}var WebUrlInfo={encode:(e,t=new BinaryWriter)=>(!1!==e.truncated&&t.uint32(8).bool(e.truncated),!1!==e.hasUniqueHash&&t.uint32(16).bool(e.hasUniqueHash),!1!==e.labelStolen&&t.uint32(24).bool(e.labelStolen),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseWebUrlInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.truncated=n.bool();continue;case 2:if(16!==e)break;a.hasUniqueHash=n.bool();continue;case 3:if(24!==e)break;a.labelStolen=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({truncated:!!isSet4(e.truncated)&&globalThis.Boolean(e.truncated),hasUniqueHash:!!isSet4(e.hasUniqueHash)&&globalThis.Boolean(e.hasUniqueHash),labelStolen:!!isSet4(e.labelStolen)&&globalThis.Boolean(e.labelStolen)}),toJSON(e){const t={};return!1!==e.truncated&&(t.truncated=e.truncated),!1!==e.hasUniqueHash&&(t.hasUniqueHash=e.hasUniqueHash),!1!==e.labelStolen&&(t.labelStolen=e.labelStolen),t},create:e=>WebUrlInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseWebUrlInfo();return t.truncated=e.truncated??!1,t.hasUniqueHash=e.hasUniqueHash??!1,t.labelStolen=e.labelStolen??!1,t}};function createBaseWebhookConfig(){return{type:0,method:"",requestedSuffix:"",asyncMode:0,customDomains:[],webServerPort:0,webServerStartupTimeout:0,webEndpointDocs:!1,requiresProxyAuth:!1,ephemeralSuffix:""}}var WebhookConfig={encode(e,t=new BinaryWriter){0!==e.type&&t.uint32(8).int32(e.type),""!==e.method&&t.uint32(18).string(e.method),""!==e.requestedSuffix&&t.uint32(34).string(e.requestedSuffix),0!==e.asyncMode&&t.uint32(40).int32(e.asyncMode);for(const n of e.customDomains)CustomDomainConfig.encode(n,t.uint32(50).fork()).join();return 0!==e.webServerPort&&t.uint32(56).uint32(e.webServerPort),0!==e.webServerStartupTimeout&&t.uint32(69).float(e.webServerStartupTimeout),!1!==e.webEndpointDocs&&t.uint32(72).bool(e.webEndpointDocs),!1!==e.requiresProxyAuth&&t.uint32(80).bool(e.requiresProxyAuth),""!==e.ephemeralSuffix&&t.uint32(90).string(e.ephemeralSuffix),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseWebhookConfig();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.type=n.int32();continue;case 2:if(18!==e)break;a.method=n.string();continue;case 4:if(34!==e)break;a.requestedSuffix=n.string();continue;case 5:if(40!==e)break;a.asyncMode=n.int32();continue;case 6:if(50!==e)break;a.customDomains.push(CustomDomainConfig.decode(n,n.uint32()));continue;case 7:if(56!==e)break;a.webServerPort=n.uint32();continue;case 8:if(69!==e)break;a.webServerStartupTimeout=n.float();continue;case 9:if(72!==e)break;a.webEndpointDocs=n.bool();continue;case 10:if(80!==e)break;a.requiresProxyAuth=n.bool();continue;case 11:if(90!==e)break;a.ephemeralSuffix=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({type:isSet4(e.type)?webhookTypeFromJSON(e.type):0,method:isSet4(e.method)?globalThis.String(e.method):"",requestedSuffix:isSet4(e.requestedSuffix)?globalThis.String(e.requestedSuffix):"",asyncMode:isSet4(e.asyncMode)?webhookAsyncModeFromJSON(e.asyncMode):0,customDomains:globalThis.Array.isArray(e?.customDomains)?e.customDomains.map((e=>CustomDomainConfig.fromJSON(e))):[],webServerPort:isSet4(e.webServerPort)?globalThis.Number(e.webServerPort):0,webServerStartupTimeout:isSet4(e.webServerStartupTimeout)?globalThis.Number(e.webServerStartupTimeout):0,webEndpointDocs:!!isSet4(e.webEndpointDocs)&&globalThis.Boolean(e.webEndpointDocs),requiresProxyAuth:!!isSet4(e.requiresProxyAuth)&&globalThis.Boolean(e.requiresProxyAuth),ephemeralSuffix:isSet4(e.ephemeralSuffix)?globalThis.String(e.ephemeralSuffix):""}),toJSON(e){const t={};return 0!==e.type&&(t.type=webhookTypeToJSON(e.type)),""!==e.method&&(t.method=e.method),""!==e.requestedSuffix&&(t.requestedSuffix=e.requestedSuffix),0!==e.asyncMode&&(t.asyncMode=webhookAsyncModeToJSON(e.asyncMode)),e.customDomains?.length&&(t.customDomains=e.customDomains.map((e=>CustomDomainConfig.toJSON(e)))),0!==e.webServerPort&&(t.webServerPort=Math.round(e.webServerPort)),0!==e.webServerStartupTimeout&&(t.webServerStartupTimeout=e.webServerStartupTimeout),!1!==e.webEndpointDocs&&(t.webEndpointDocs=e.webEndpointDocs),!1!==e.requiresProxyAuth&&(t.requiresProxyAuth=e.requiresProxyAuth),""!==e.ephemeralSuffix&&(t.ephemeralSuffix=e.ephemeralSuffix),t},create:e=>WebhookConfig.fromPartial(e??{}),fromPartial(e){const t=createBaseWebhookConfig();return t.type=e.type??0,t.method=e.method??"",t.requestedSuffix=e.requestedSuffix??"",t.asyncMode=e.asyncMode??0,t.customDomains=e.customDomains?.map((e=>CustomDomainConfig.fromPartial(e)))||[],t.webServerPort=e.webServerPort??0,t.webServerStartupTimeout=e.webServerStartupTimeout??0,t.webEndpointDocs=e.webEndpointDocs??!1,t.requiresProxyAuth=e.requiresProxyAuth??!1,t.ephemeralSuffix=e.ephemeralSuffix??"",t}};function createBaseWorkspaceBillingReportItem(){return{objectId:"",description:"",environmentName:"",interval:void 0,cost:"",tags:{}}}var WorkspaceBillingReportItem={encode:(e,t=new BinaryWriter)=>(""!==e.objectId&&t.uint32(10).string(e.objectId),""!==e.description&&t.uint32(18).string(e.description),""!==e.environmentName&&t.uint32(26).string(e.environmentName),void 0!==e.interval&&Timestamp.encode(toTimestamp(e.interval),t.uint32(34).fork()).join(),""!==e.cost&&t.uint32(42).string(e.cost),Object.entries(e.tags).forEach((([e,n])=>{WorkspaceBillingReportItem_TagsEntry.encode({key:e,value:n},t.uint32(50).fork()).join()})),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseWorkspaceBillingReportItem();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.objectId=n.string();continue;case 2:if(18!==e)break;a.description=n.string();continue;case 3:if(26!==e)break;a.environmentName=n.string();continue;case 4:if(34!==e)break;a.interval=fromTimestamp(Timestamp.decode(n,n.uint32()));continue;case 5:if(42!==e)break;a.cost=n.string();continue;case 6:{if(50!==e)break;const t=WorkspaceBillingReportItem_TagsEntry.decode(n,n.uint32());void 0!==t.value&&(a.tags[t.key]=t.value);continue}}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({objectId:isSet4(e.objectId)?globalThis.String(e.objectId):"",description:isSet4(e.description)?globalThis.String(e.description):"",environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):"",interval:isSet4(e.interval)?fromJsonTimestamp(e.interval):void 0,cost:isSet4(e.cost)?globalThis.String(e.cost):"",tags:isObject2(e.tags)?Object.entries(e.tags).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{}}),toJSON(e){const t={};if(""!==e.objectId&&(t.objectId=e.objectId),""!==e.description&&(t.description=e.description),""!==e.environmentName&&(t.environmentName=e.environmentName),void 0!==e.interval&&(t.interval=e.interval.toISOString()),""!==e.cost&&(t.cost=e.cost),e.tags){const n=Object.entries(e.tags);n.length>0&&(t.tags={},n.forEach((([e,n])=>{t.tags[e]=n})))}return t},create:e=>WorkspaceBillingReportItem.fromPartial(e??{}),fromPartial(e){const t=createBaseWorkspaceBillingReportItem();return t.objectId=e.objectId??"",t.description=e.description??"",t.environmentName=e.environmentName??"",t.interval=e.interval??void 0,t.cost=e.cost??"",t.tags=Object.entries(e.tags??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t}};function createBaseWorkspaceBillingReportItem_TagsEntry(){return{key:"",value:""}}var WorkspaceBillingReportItem_TagsEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseWorkspaceBillingReportItem_TagsEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet4(e.key)?globalThis.String(e.key):"",value:isSet4(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>WorkspaceBillingReportItem_TagsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseWorkspaceBillingReportItem_TagsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseWorkspaceBillingReportRequest(){return{startTimestamp:void 0,endTimestamp:void 0,resolution:"",tagNames:[]}}var WorkspaceBillingReportRequest={encode(e,t=new BinaryWriter){void 0!==e.startTimestamp&&Timestamp.encode(toTimestamp(e.startTimestamp),t.uint32(10).fork()).join(),void 0!==e.endTimestamp&&Timestamp.encode(toTimestamp(e.endTimestamp),t.uint32(18).fork()).join(),""!==e.resolution&&t.uint32(26).string(e.resolution);for(const n of e.tagNames)t.uint32(34).string(n);return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseWorkspaceBillingReportRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.startTimestamp=fromTimestamp(Timestamp.decode(n,n.uint32()));continue;case 2:if(18!==e)break;a.endTimestamp=fromTimestamp(Timestamp.decode(n,n.uint32()));continue;case 3:if(26!==e)break;a.resolution=n.string();continue;case 4:if(34!==e)break;a.tagNames.push(n.string());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({startTimestamp:isSet4(e.startTimestamp)?fromJsonTimestamp(e.startTimestamp):void 0,endTimestamp:isSet4(e.endTimestamp)?fromJsonTimestamp(e.endTimestamp):void 0,resolution:isSet4(e.resolution)?globalThis.String(e.resolution):"",tagNames:globalThis.Array.isArray(e?.tagNames)?e.tagNames.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return void 0!==e.startTimestamp&&(t.startTimestamp=e.startTimestamp.toISOString()),void 0!==e.endTimestamp&&(t.endTimestamp=e.endTimestamp.toISOString()),""!==e.resolution&&(t.resolution=e.resolution),e.tagNames?.length&&(t.tagNames=e.tagNames),t},create:e=>WorkspaceBillingReportRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseWorkspaceBillingReportRequest();return t.startTimestamp=e.startTimestamp??void 0,t.endTimestamp=e.endTimestamp??void 0,t.resolution=e.resolution??"",t.tagNames=e.tagNames?.map((e=>e))||[],t}};function createBaseWorkspaceDashboardUrlRequest(){return{environmentName:""}}var WorkspaceDashboardUrlRequest={encode:(e,t=new BinaryWriter)=>(""!==e.environmentName&&t.uint32(10).string(e.environmentName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseWorkspaceDashboardUrlRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.environmentName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({environmentName:isSet4(e.environmentName)?globalThis.String(e.environmentName):""}),toJSON(e){const t={};return""!==e.environmentName&&(t.environmentName=e.environmentName),t},create:e=>WorkspaceDashboardUrlRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseWorkspaceDashboardUrlRequest();return t.environmentName=e.environmentName??"",t}};function createBaseWorkspaceDashboardUrlResponse(){return{url:""}}var WorkspaceDashboardUrlResponse={encode:(e,t=new BinaryWriter)=>(""!==e.url&&t.uint32(10).string(e.url),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseWorkspaceDashboardUrlResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.url=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({url:isSet4(e.url)?globalThis.String(e.url):""}),toJSON(e){const t={};return""!==e.url&&(t.url=e.url),t},create:e=>WorkspaceDashboardUrlResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseWorkspaceDashboardUrlResponse();return t.url=e.url??"",t}};function createBaseWorkspaceNameLookupResponse(){return{workspaceName:"",username:""}}var WorkspaceNameLookupResponse={encode:(e,t=new BinaryWriter)=>(""!==e.workspaceName&&t.uint32(10).string(e.workspaceName),""!==e.username&&t.uint32(18).string(e.username),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseWorkspaceNameLookupResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.workspaceName=n.string();continue;case 2:if(18!==e)break;a.username=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({workspaceName:isSet4(e.workspaceName)?globalThis.String(e.workspaceName):"",username:isSet4(e.username)?globalThis.String(e.username):""}),toJSON(e){const t={};return""!==e.workspaceName&&(t.workspaceName=e.workspaceName),""!==e.username&&(t.username=e.username),t},create:e=>WorkspaceNameLookupResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseWorkspaceNameLookupResponse();return t.workspaceName=e.workspaceName??"",t.username=e.username??"",t}},ModalClientDefinition={name:"ModalClient",fullName:"modal.client.ModalClient",methods:{appClientDisconnect:{name:"AppClientDisconnect",requestType:AppClientDisconnectRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},appCountLogs:{name:"AppCountLogs",requestType:AppCountLogsRequest,requestStream:!1,responseType:AppCountLogsResponse,responseStream:!1,options:{}},appCreate:{name:"AppCreate",requestType:AppCreateRequest,requestStream:!1,responseType:AppCreateResponse,responseStream:!1,options:{}},appDeploy:{name:"AppDeploy",requestType:AppDeployRequest,requestStream:!1,responseType:AppDeployResponse,responseStream:!1,options:{}},appDeploymentHistory:{name:"AppDeploymentHistory",requestType:AppDeploymentHistoryRequest,requestStream:!1,responseType:AppDeploymentHistoryResponse,responseStream:!1,options:{}},appFetchLogs:{name:"AppFetchLogs",requestType:AppFetchLogsRequest,requestStream:!1,responseType:AppFetchLogsResponse,responseStream:!1,options:{}},appGetByDeploymentName:{name:"AppGetByDeploymentName",requestType:AppGetByDeploymentNameRequest,requestStream:!1,responseType:AppGetByDeploymentNameResponse,responseStream:!1,options:{}},appGetLayout:{name:"AppGetLayout",requestType:AppGetLayoutRequest,requestStream:!1,responseType:AppGetLayoutResponse,responseStream:!1,options:{}},appGetLifecycle:{name:"AppGetLifecycle",requestType:AppGetLifecycleRequest,requestStream:!1,responseType:AppGetLifecycleResponse,responseStream:!1,options:{}},appGetLogs:{name:"AppGetLogs",requestType:AppGetLogsRequest,requestStream:!1,responseType:TaskLogsBatch,responseStream:!0,options:{}},appGetObjects:{name:"AppGetObjects",requestType:AppGetObjectsRequest,requestStream:!1,responseType:AppGetObjectsResponse,responseStream:!1,options:{}},appGetOrCreate:{name:"AppGetOrCreate",requestType:AppGetOrCreateRequest,requestStream:!1,responseType:AppGetOrCreateResponse,responseStream:!1,options:{}},appGetTags:{name:"AppGetTags",requestType:AppGetTagsRequest,requestStream:!1,responseType:AppGetTagsResponse,responseStream:!1,options:{}},appHeartbeat:{name:"AppHeartbeat",requestType:AppHeartbeatRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},appList:{name:"AppList",requestType:AppListRequest,requestStream:!1,responseType:AppListResponse,responseStream:!1,options:{}},appLookup:{name:"AppLookup",requestType:AppLookupRequest,requestStream:!1,responseType:AppLookupResponse,responseStream:!1,options:{}},appPublish:{name:"AppPublish",requestType:AppPublishRequest,requestStream:!1,responseType:AppPublishResponse,responseStream:!1,options:{}},appRollback:{name:"AppRollback",requestType:AppRollbackRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},appRollover:{name:"AppRollover",requestType:AppRolloverRequest,requestStream:!1,responseType:AppRolloverResponse,responseStream:!1,options:{}},appSetObjects:{name:"AppSetObjects",requestType:AppSetObjectsRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},appSetTags:{name:"AppSetTags",requestType:AppSetTagsRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},appStop:{name:"AppStop",requestType:AppStopRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},attemptAwait:{name:"AttemptAwait",requestType:AttemptAwaitRequest,requestStream:!1,responseType:AttemptAwaitResponse,responseStream:!1,options:{}},attemptRetry:{name:"AttemptRetry",requestType:AttemptRetryRequest,requestStream:!1,responseType:AttemptRetryResponse,responseStream:!1,options:{}},attemptStart:{name:"AttemptStart",requestType:AttemptStartRequest,requestStream:!1,responseType:AttemptStartResponse,responseStream:!1,options:{}},authTokenGet:{name:"AuthTokenGet",requestType:AuthTokenGetRequest,requestStream:!1,responseType:AuthTokenGetResponse,responseStream:!1,options:{}},blobCreate:{name:"BlobCreate",requestType:BlobCreateRequest,requestStream:!1,responseType:BlobCreateResponse,responseStream:!1,options:{}},blobGet:{name:"BlobGet",requestType:BlobGetRequest,requestStream:!1,responseType:BlobGetResponse,responseStream:!1,options:{}},classCreate:{name:"ClassCreate",requestType:ClassCreateRequest,requestStream:!1,responseType:ClassCreateResponse,responseStream:!1,options:{}},classGet:{name:"ClassGet",requestType:ClassGetRequest,requestStream:!1,responseType:ClassGetResponse,responseStream:!1,options:{}},clientHello:{name:"ClientHello",requestType:Empty,requestStream:!1,responseType:ClientHelloResponse,responseStream:!1,options:{}},clusterGet:{name:"ClusterGet",requestType:ClusterGetRequest,requestStream:!1,responseType:ClusterGetResponse,responseStream:!1,options:{}},clusterList:{name:"ClusterList",requestType:ClusterListRequest,requestStream:!1,responseType:ClusterListResponse,responseStream:!1,options:{}},containerCheckpoint:{name:"ContainerCheckpoint",requestType:ContainerCheckpointRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},containerExec:{name:"ContainerExec",requestType:ContainerExecRequest,requestStream:!1,responseType:ContainerExecResponse,responseStream:!1,options:{}},containerExecGetOutput:{name:"ContainerExecGetOutput",requestType:ContainerExecGetOutputRequest,requestStream:!1,responseType:RuntimeOutputBatch,responseStream:!0,options:{}},containerExecPutInput:{name:"ContainerExecPutInput",requestType:ContainerExecPutInputRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},containerExecWait:{name:"ContainerExecWait",requestType:ContainerExecWaitRequest,requestStream:!1,responseType:ContainerExecWaitResponse,responseStream:!1,options:{}},containerFilesystemExec:{name:"ContainerFilesystemExec",requestType:ContainerFilesystemExecRequest,requestStream:!1,responseType:ContainerFilesystemExecResponse,responseStream:!1,options:{}},containerFilesystemExecGetOutput:{name:"ContainerFilesystemExecGetOutput",requestType:ContainerFilesystemExecGetOutputRequest,requestStream:!1,responseType:FilesystemRuntimeOutputBatch,responseStream:!0,options:{}},containerHeartbeat:{name:"ContainerHeartbeat",requestType:ContainerHeartbeatRequest,requestStream:!1,responseType:ContainerHeartbeatResponse,responseStream:!1,options:{}},containerHello:{name:"ContainerHello",requestType:Empty,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},containerLog:{name:"ContainerLog",requestType:ContainerLogRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},containerReloadVolumes:{name:"ContainerReloadVolumes",requestType:ContainerReloadVolumesRequest,requestStream:!1,responseType:ContainerReloadVolumesResponse,responseStream:!1,options:{}},containerStop:{name:"ContainerStop",requestType:ContainerStopRequest,requestStream:!1,responseType:ContainerStopResponse,responseStream:!1,options:{}},dictClear:{name:"DictClear",requestType:DictClearRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},dictContains:{name:"DictContains",requestType:DictContainsRequest,requestStream:!1,responseType:DictContainsResponse,responseStream:!1,options:{}},dictContents:{name:"DictContents",requestType:DictContentsRequest,requestStream:!1,responseType:DictEntry,responseStream:!0,options:{}},dictDelete:{name:"DictDelete",requestType:DictDeleteRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},dictGet:{name:"DictGet",requestType:DictGetRequest,requestStream:!1,responseType:DictGetResponse,responseStream:!1,options:{}},dictGetById:{name:"DictGetById",requestType:DictGetByIdRequest,requestStream:!1,responseType:DictGetByIdResponse,responseStream:!1,options:{}},dictGetOrCreate:{name:"DictGetOrCreate",requestType:DictGetOrCreateRequest,requestStream:!1,responseType:DictGetOrCreateResponse,responseStream:!1,options:{}},dictHeartbeat:{name:"DictHeartbeat",requestType:DictHeartbeatRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},dictLen:{name:"DictLen",requestType:DictLenRequest,requestStream:!1,responseType:DictLenResponse,responseStream:!1,options:{}},dictList:{name:"DictList",requestType:DictListRequest,requestStream:!1,responseType:DictListResponse,responseStream:!1,options:{}},dictPop:{name:"DictPop",requestType:DictPopRequest,requestStream:!1,responseType:DictPopResponse,responseStream:!1,options:{}},dictUpdate:{name:"DictUpdate",requestType:DictUpdateRequest,requestStream:!1,responseType:DictUpdateResponse,responseStream:!1,options:{}},domainCertificateVerify:{name:"DomainCertificateVerify",requestType:DomainCertificateVerifyRequest,requestStream:!1,responseType:DomainCertificateVerifyResponse,responseStream:!1,options:{}},domainCreate:{name:"DomainCreate",requestType:DomainCreateRequest,requestStream:!1,responseType:DomainCreateResponse,responseStream:!1,options:{}},domainList:{name:"DomainList",requestType:DomainListRequest,requestStream:!1,responseType:DomainListResponse,responseStream:!1,options:{}},environmentCreate:{name:"EnvironmentCreate",requestType:EnvironmentCreateRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},environmentDelete:{name:"EnvironmentDelete",requestType:EnvironmentDeleteRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},environmentGetOrCreate:{name:"EnvironmentGetOrCreate",requestType:EnvironmentGetOrCreateRequest,requestStream:!1,responseType:EnvironmentGetOrCreateResponse,responseStream:!1,options:{}},environmentList:{name:"EnvironmentList",requestType:Empty,requestStream:!1,responseType:EnvironmentListResponse,responseStream:!1,options:{}},environmentUpdate:{name:"EnvironmentUpdate",requestType:EnvironmentUpdateRequest,requestStream:!1,responseType:EnvironmentListItem,responseStream:!1,options:{}},flashContainerDeregister:{name:"FlashContainerDeregister",requestType:FlashContainerDeregisterRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},flashContainerList:{name:"FlashContainerList",requestType:FlashContainerListRequest,requestStream:!1,responseType:FlashContainerListResponse,responseStream:!1,options:{}},flashContainerRegister:{name:"FlashContainerRegister",requestType:FlashContainerRegisterRequest,requestStream:!1,responseType:FlashContainerRegisterResponse,responseStream:!1,options:{}},flashSetTargetSlotsMetrics:{name:"FlashSetTargetSlotsMetrics",requestType:FlashSetTargetSlotsMetricsRequest,requestStream:!1,responseType:FlashSetTargetSlotsMetricsResponse,responseStream:!1,options:{}},functionAsyncInvoke:{name:"FunctionAsyncInvoke",requestType:FunctionAsyncInvokeRequest,requestStream:!1,responseType:FunctionAsyncInvokeResponse,responseStream:!1,options:{}},functionBindParams:{name:"FunctionBindParams",requestType:FunctionBindParamsRequest,requestStream:!1,responseType:FunctionBindParamsResponse,responseStream:!1,options:{}},functionCallCancel:{name:"FunctionCallCancel",requestType:FunctionCallCancelRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},functionCallFromId:{name:"FunctionCallFromId",requestType:FunctionCallFromIdRequest,requestStream:!1,responseType:FunctionCallFromIdResponse,responseStream:!1,options:{}},functionCallGetDataIn:{name:"FunctionCallGetDataIn",requestType:FunctionCallGetDataRequest,requestStream:!1,responseType:DataChunk,responseStream:!0,options:{}},functionCallGetDataOut:{name:"FunctionCallGetDataOut",requestType:FunctionCallGetDataRequest,requestStream:!1,responseType:DataChunk,responseStream:!0,options:{}},functionCallList:{name:"FunctionCallList",requestType:FunctionCallListRequest,requestStream:!1,responseType:FunctionCallListResponse,responseStream:!1,options:{}},functionCallPutDataOut:{name:"FunctionCallPutDataOut",requestType:FunctionCallPutDataRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},functionCreate:{name:"FunctionCreate",requestType:FunctionCreateRequest,requestStream:!1,responseType:FunctionCreateResponse,responseStream:!1,options:{}},functionFinishInputs:{name:"FunctionFinishInputs",requestType:FunctionFinishInputsRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},functionGet:{name:"FunctionGet",requestType:FunctionGetRequest,requestStream:!1,responseType:FunctionGetResponse,responseStream:!1,options:{}},functionGetCallGraph:{name:"FunctionGetCallGraph",requestType:FunctionGetCallGraphRequest,requestStream:!1,responseType:FunctionGetCallGraphResponse,responseStream:!1,options:{}},functionGetCurrentStats:{name:"FunctionGetCurrentStats",requestType:FunctionGetCurrentStatsRequest,requestStream:!1,responseType:FunctionStats,responseStream:!1,options:{}},functionGetDynamicConcurrency:{name:"FunctionGetDynamicConcurrency",requestType:FunctionGetDynamicConcurrencyRequest,requestStream:!1,responseType:FunctionGetDynamicConcurrencyResponse,responseStream:!1,options:{}},functionGetInputs:{name:"FunctionGetInputs",requestType:FunctionGetInputsRequest,requestStream:!1,responseType:FunctionGetInputsResponse,responseStream:!1,options:{}},functionGetOutputs:{name:"FunctionGetOutputs",requestType:FunctionGetOutputsRequest,requestStream:!1,responseType:FunctionGetOutputsResponse,responseStream:!1,options:{}},functionGetSerialized:{name:"FunctionGetSerialized",requestType:FunctionGetSerializedRequest,requestStream:!1,responseType:FunctionGetSerializedResponse,responseStream:!1,options:{}},functionMap:{name:"FunctionMap",requestType:FunctionMapRequest,requestStream:!1,responseType:FunctionMapResponse,responseStream:!1,options:{}},functionPrecreate:{name:"FunctionPrecreate",requestType:FunctionPrecreateRequest,requestStream:!1,responseType:FunctionPrecreateResponse,responseStream:!1,options:{}},functionPutInputs:{name:"FunctionPutInputs",requestType:FunctionPutInputsRequest,requestStream:!1,responseType:FunctionPutInputsResponse,responseStream:!1,options:{}},functionPutOutputs:{name:"FunctionPutOutputs",requestType:FunctionPutOutputsRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},functionRetryInputs:{name:"FunctionRetryInputs",requestType:FunctionRetryInputsRequest,requestStream:!1,responseType:FunctionRetryInputsResponse,responseStream:!1,options:{}},functionStartPtyShell:{name:"FunctionStartPtyShell",requestType:Empty,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},functionUpdateSchedulingParams:{name:"FunctionUpdateSchedulingParams",requestType:FunctionUpdateSchedulingParamsRequest,requestStream:!1,responseType:FunctionUpdateSchedulingParamsResponse,responseStream:!1,options:{}},imageDelete:{name:"ImageDelete",requestType:ImageDeleteRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},imageFromId:{name:"ImageFromId",requestType:ImageFromIdRequest,requestStream:!1,responseType:ImageFromIdResponse,responseStream:!1,options:{}},imageGetOrCreate:{name:"ImageGetOrCreate",requestType:ImageGetOrCreateRequest,requestStream:!1,responseType:ImageGetOrCreateResponse,responseStream:!1,options:{}},imageJoinStreaming:{name:"ImageJoinStreaming",requestType:ImageJoinStreamingRequest,requestStream:!1,responseType:ImageJoinStreamingResponse,responseStream:!0,options:{}},mapAwait:{name:"MapAwait",requestType:MapAwaitRequest,requestStream:!1,responseType:MapAwaitResponse,responseStream:!1,options:{}},mapCheckInputs:{name:"MapCheckInputs",requestType:MapCheckInputsRequest,requestStream:!1,responseType:MapCheckInputsResponse,responseStream:!1,options:{}},mapStartOrContinue:{name:"MapStartOrContinue",requestType:MapStartOrContinueRequest,requestStream:!1,responseType:MapStartOrContinueResponse,responseStream:!1,options:{}},mountGetOrCreate:{name:"MountGetOrCreate",requestType:MountGetOrCreateRequest,requestStream:!1,responseType:MountGetOrCreateResponse,responseStream:!1,options:{}},mountPutFile:{name:"MountPutFile",requestType:MountPutFileRequest,requestStream:!1,responseType:MountPutFileResponse,responseStream:!1,options:{}},notebookKernelPublishResults:{name:"NotebookKernelPublishResults",requestType:NotebookKernelPublishResultsRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},proxyAddIp:{name:"ProxyAddIp",requestType:ProxyAddIpRequest,requestStream:!1,responseType:ProxyAddIpResponse,responseStream:!1,options:{}},proxyCreate:{name:"ProxyCreate",requestType:ProxyCreateRequest,requestStream:!1,responseType:ProxyCreateResponse,responseStream:!1,options:{}},proxyDelete:{name:"ProxyDelete",requestType:ProxyDeleteRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},proxyGet:{name:"ProxyGet",requestType:ProxyGetRequest,requestStream:!1,responseType:ProxyGetResponse,responseStream:!1,options:{}},proxyGetOrCreate:{name:"ProxyGetOrCreate",requestType:ProxyGetOrCreateRequest,requestStream:!1,responseType:ProxyGetOrCreateResponse,responseStream:!1,options:{}},proxyList:{name:"ProxyList",requestType:Empty,requestStream:!1,responseType:ProxyListResponse,responseStream:!1,options:{}},proxyRemoveIp:{name:"ProxyRemoveIp",requestType:ProxyRemoveIpRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},queueClear:{name:"QueueClear",requestType:QueueClearRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},queueDelete:{name:"QueueDelete",requestType:QueueDeleteRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},queueGet:{name:"QueueGet",requestType:QueueGetRequest,requestStream:!1,responseType:QueueGetResponse,responseStream:!1,options:{}},queueGetById:{name:"QueueGetById",requestType:QueueGetByIdRequest,requestStream:!1,responseType:QueueGetByIdResponse,responseStream:!1,options:{}},queueGetOrCreate:{name:"QueueGetOrCreate",requestType:QueueGetOrCreateRequest,requestStream:!1,responseType:QueueGetOrCreateResponse,responseStream:!1,options:{}},queueHeartbeat:{name:"QueueHeartbeat",requestType:QueueHeartbeatRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},queueLen:{name:"QueueLen",requestType:QueueLenRequest,requestStream:!1,responseType:QueueLenResponse,responseStream:!1,options:{}},queueList:{name:"QueueList",requestType:QueueListRequest,requestStream:!1,responseType:QueueListResponse,responseStream:!1,options:{}},queueNextItems:{name:"QueueNextItems",requestType:QueueNextItemsRequest,requestStream:!1,responseType:QueueNextItemsResponse,responseStream:!1,options:{}},queuePut:{name:"QueuePut",requestType:QueuePutRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},sandboxCreate:{name:"SandboxCreate",requestType:SandboxCreateRequest,requestStream:!1,responseType:SandboxCreateResponse,responseStream:!1,options:{}},sandboxCreateConnectToken:{name:"SandboxCreateConnectToken",requestType:SandboxCreateConnectTokenRequest,requestStream:!1,responseType:SandboxCreateConnectTokenResponse,responseStream:!1,options:{}},sandboxCreateV2:{name:"SandboxCreateV2",requestType:SandboxCreateV2Request,requestStream:!1,responseType:SandboxCreateV2Response,responseStream:!1,options:{}},sandboxGetCommandRouterAccess:{name:"SandboxGetCommandRouterAccess",requestType:SandboxGetCommandRouterAccessRequest,requestStream:!1,responseType:SandboxGetCommandRouterAccessResponse,responseStream:!1,options:{}},sandboxGetFromName:{name:"SandboxGetFromName",requestType:SandboxGetFromNameRequest,requestStream:!1,responseType:SandboxGetFromNameResponse,responseStream:!1,options:{}},sandboxGetLogs:{name:"SandboxGetLogs",requestType:SandboxGetLogsRequest,requestStream:!1,responseType:TaskLogsBatch,responseStream:!0,options:{}},sandboxGetResourceUsage:{name:"SandboxGetResourceUsage",requestType:SandboxGetResourceUsageRequest,requestStream:!1,responseType:SandboxGetResourceUsageResponse,responseStream:!1,options:{}},sandboxGetTaskId:{name:"SandboxGetTaskId",requestType:SandboxGetTaskIdRequest,requestStream:!1,responseType:SandboxGetTaskIdResponse,responseStream:!1,options:{}},sandboxGetTaskIdV2:{name:"SandboxGetTaskIdV2",requestType:SandboxGetTaskIdRequest,requestStream:!1,responseType:SandboxGetTaskIdResponse,responseStream:!1,options:{}},sandboxGetTunnels:{name:"SandboxGetTunnels",requestType:SandboxGetTunnelsRequest,requestStream:!1,responseType:SandboxGetTunnelsResponse,responseStream:!1,options:{}},sandboxGetTunnelsV2:{name:"SandboxGetTunnelsV2",requestType:SandboxGetTunnelsRequest,requestStream:!1,responseType:SandboxGetTunnelsResponse,responseStream:!1,options:{}},sandboxList:{name:"SandboxList",requestType:SandboxListRequest,requestStream:!1,responseType:SandboxListResponse,responseStream:!1,options:{}},sandboxRestore:{name:"SandboxRestore",requestType:SandboxRestoreRequest,requestStream:!1,responseType:SandboxRestoreResponse,responseStream:!1,options:{}},sandboxSnapshot:{name:"SandboxSnapshot",requestType:SandboxSnapshotRequest,requestStream:!1,responseType:SandboxSnapshotResponse,responseStream:!1,options:{}},sandboxSnapshotFs:{name:"SandboxSnapshotFs",requestType:SandboxSnapshotFsRequest,requestStream:!1,responseType:SandboxSnapshotFsResponse,responseStream:!1,options:{}},sandboxSnapshotFsAsync:{name:"SandboxSnapshotFsAsync",requestType:SandboxSnapshotFsAsyncRequest,requestStream:!1,responseType:SandboxSnapshotFsAsyncResponse,responseStream:!1,options:{}},sandboxSnapshotFsAsyncGet:{name:"SandboxSnapshotFsAsyncGet",requestType:SandboxSnapshotFsAsyncGetRequest,requestStream:!1,responseType:SandboxSnapshotFsResponse,responseStream:!1,options:{}},sandboxSnapshotGet:{name:"SandboxSnapshotGet",requestType:SandboxSnapshotGetRequest,requestStream:!1,responseType:SandboxSnapshotGetResponse,responseStream:!1,options:{}},sandboxSnapshotWait:{name:"SandboxSnapshotWait",requestType:SandboxSnapshotWaitRequest,requestStream:!1,responseType:SandboxSnapshotWaitResponse,responseStream:!1,options:{}},sandboxStdinWrite:{name:"SandboxStdinWrite",requestType:SandboxStdinWriteRequest,requestStream:!1,responseType:SandboxStdinWriteResponse,responseStream:!1,options:{}},sandboxTagsGet:{name:"SandboxTagsGet",requestType:SandboxTagsGetRequest,requestStream:!1,responseType:SandboxTagsGetResponse,responseStream:!1,options:{}},sandboxTagsSet:{name:"SandboxTagsSet",requestType:SandboxTagsSetRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},sandboxTerminate:{name:"SandboxTerminate",requestType:SandboxTerminateRequest,requestStream:!1,responseType:SandboxTerminateResponse,responseStream:!1,options:{}},sandboxTerminateV2:{name:"SandboxTerminateV2",requestType:SandboxTerminateRequest,requestStream:!1,responseType:SandboxTerminateResponse,responseStream:!1,options:{}},sandboxWait:{name:"SandboxWait",requestType:SandboxWaitRequest,requestStream:!1,responseType:SandboxWaitResponse,responseStream:!1,options:{}},sandboxWaitUntilReady:{name:"SandboxWaitUntilReady",requestType:SandboxWaitUntilReadyRequest,requestStream:!1,responseType:SandboxWaitUntilReadyResponse,responseStream:!1,options:{}},sandboxWaitV2:{name:"SandboxWaitV2",requestType:SandboxWaitRequest,requestStream:!1,responseType:SandboxWaitResponse,responseStream:!1,options:{}},secretDelete:{name:"SecretDelete",requestType:SecretDeleteRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},secretGetOrCreate:{name:"SecretGetOrCreate",requestType:SecretGetOrCreateRequest,requestStream:!1,responseType:SecretGetOrCreateResponse,responseStream:!1,options:{}},secretList:{name:"SecretList",requestType:SecretListRequest,requestStream:!1,responseType:SecretListResponse,responseStream:!1,options:{}},secretUpdate:{name:"SecretUpdate",requestType:SecretUpdateRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},sharedVolumeDelete:{name:"SharedVolumeDelete",requestType:SharedVolumeDeleteRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},sharedVolumeGetFile:{name:"SharedVolumeGetFile",requestType:SharedVolumeGetFileRequest,requestStream:!1,responseType:SharedVolumeGetFileResponse,responseStream:!1,options:{}},sharedVolumeGetOrCreate:{name:"SharedVolumeGetOrCreate",requestType:SharedVolumeGetOrCreateRequest,requestStream:!1,responseType:SharedVolumeGetOrCreateResponse,responseStream:!1,options:{}},sharedVolumeHeartbeat:{name:"SharedVolumeHeartbeat",requestType:SharedVolumeHeartbeatRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},sharedVolumeList:{name:"SharedVolumeList",requestType:SharedVolumeListRequest,requestStream:!1,responseType:SharedVolumeListResponse,responseStream:!1,options:{}},sharedVolumeListFiles:{name:"SharedVolumeListFiles",requestType:SharedVolumeListFilesRequest,requestStream:!1,responseType:SharedVolumeListFilesResponse,responseStream:!1,options:{}},sharedVolumeListFilesStream:{name:"SharedVolumeListFilesStream",requestType:SharedVolumeListFilesRequest,requestStream:!1,responseType:SharedVolumeListFilesResponse,responseStream:!0,options:{}},sharedVolumePutFile:{name:"SharedVolumePutFile",requestType:SharedVolumePutFileRequest,requestStream:!1,responseType:SharedVolumePutFileResponse,responseStream:!1,options:{}},sharedVolumeRemoveFile:{name:"SharedVolumeRemoveFile",requestType:SharedVolumeRemoveFileRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},taskClusterHello:{name:"TaskClusterHello",requestType:TaskClusterHelloRequest,requestStream:!1,responseType:TaskClusterHelloResponse,responseStream:!1,options:{}},taskCurrentInputs:{name:"TaskCurrentInputs",requestType:Empty,requestStream:!1,responseType:TaskCurrentInputsResponse,responseStream:!1,options:{}},taskGetCommandRouterAccess:{name:"TaskGetCommandRouterAccess",requestType:TaskGetCommandRouterAccessRequest,requestStream:!1,responseType:TaskGetCommandRouterAccessResponse,responseStream:!1,options:{}},taskGetInfo:{name:"TaskGetInfo",requestType:TaskGetInfoRequest,requestStream:!1,responseType:TaskGetInfoResponse,responseStream:!1,options:{}},taskList:{name:"TaskList",requestType:TaskListRequest,requestStream:!1,responseType:TaskListResponse,responseStream:!1,options:{}},taskResult:{name:"TaskResult",requestType:TaskResultRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},templateList:{name:"TemplateList",requestType:TemplateListRequest,requestStream:!1,responseType:TemplateListResponse,responseStream:!1,options:{}},tokenFlowCreate:{name:"TokenFlowCreate",requestType:TokenFlowCreateRequest,requestStream:!1,responseType:TokenFlowCreateResponse,responseStream:!1,options:{}},tokenFlowWait:{name:"TokenFlowWait",requestType:TokenFlowWaitRequest,requestStream:!1,responseType:TokenFlowWaitResponse,responseStream:!1,options:{}},tokenInfoGet:{name:"TokenInfoGet",requestType:TokenInfoGetRequest,requestStream:!1,responseType:TokenInfoGetResponse,responseStream:!1,options:{}},tunnelStart:{name:"TunnelStart",requestType:TunnelStartRequest,requestStream:!1,responseType:TunnelStartResponse,responseStream:!1,options:{}},tunnelStop:{name:"TunnelStop",requestType:TunnelStopRequest,requestStream:!1,responseType:TunnelStopResponse,responseStream:!1,options:{}},volumeCommit:{name:"VolumeCommit",requestType:VolumeCommitRequest,requestStream:!1,responseType:VolumeCommitResponse,responseStream:!1,options:{}},volumeCopyFiles:{name:"VolumeCopyFiles",requestType:VolumeCopyFilesRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},volumeCopyFiles2:{name:"VolumeCopyFiles2",requestType:VolumeCopyFiles2Request,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},volumeDelete:{name:"VolumeDelete",requestType:VolumeDeleteRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},volumeGetById:{name:"VolumeGetById",requestType:VolumeGetByIdRequest,requestStream:!1,responseType:VolumeGetByIdResponse,responseStream:!1,options:{}},volumeGetFile:{name:"VolumeGetFile",requestType:VolumeGetFileRequest,requestStream:!1,responseType:VolumeGetFileResponse,responseStream:!1,options:{}},volumeGetFile2:{name:"VolumeGetFile2",requestType:VolumeGetFile2Request,requestStream:!1,responseType:VolumeGetFile2Response,responseStream:!1,options:{}},volumeGetOrCreate:{name:"VolumeGetOrCreate",requestType:VolumeGetOrCreateRequest,requestStream:!1,responseType:VolumeGetOrCreateResponse,responseStream:!1,options:{}},volumeHeartbeat:{name:"VolumeHeartbeat",requestType:VolumeHeartbeatRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},volumeList:{name:"VolumeList",requestType:VolumeListRequest,requestStream:!1,responseType:VolumeListResponse,responseStream:!1,options:{}},volumeListFiles:{name:"VolumeListFiles",requestType:VolumeListFilesRequest,requestStream:!1,responseType:VolumeListFilesResponse,responseStream:!0,options:{}},volumeListFiles2:{name:"VolumeListFiles2",requestType:VolumeListFiles2Request,requestStream:!1,responseType:VolumeListFiles2Response,responseStream:!0,options:{}},volumePutFiles:{name:"VolumePutFiles",requestType:VolumePutFilesRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},volumePutFiles2:{name:"VolumePutFiles2",requestType:VolumePutFiles2Request,requestStream:!1,responseType:VolumePutFiles2Response,responseStream:!1,options:{}},volumeReload:{name:"VolumeReload",requestType:VolumeReloadRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},volumeRemoveFile:{name:"VolumeRemoveFile",requestType:VolumeRemoveFileRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},volumeRemoveFile2:{name:"VolumeRemoveFile2",requestType:VolumeRemoveFile2Request,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},volumeRename:{name:"VolumeRename",requestType:VolumeRenameRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},workspaceBillingReport:{name:"WorkspaceBillingReport",requestType:WorkspaceBillingReportRequest,requestStream:!1,responseType:WorkspaceBillingReportItem,responseStream:!0,options:{}},workspaceDashboardUrlGet:{name:"WorkspaceDashboardUrlGet",requestType:WorkspaceDashboardUrlRequest,requestStream:!1,responseType:WorkspaceDashboardUrlResponse,responseStream:!1,options:{}},workspaceNameLookup:{name:"WorkspaceNameLookup",requestType:Empty,requestStream:!1,responseType:WorkspaceNameLookupResponse,responseStream:!1,options:{}}}};function bytesFromBase64(e){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(e,"base64"));{const t=globalThis.atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}}function base64FromBytes(e){if(globalThis.Buffer)return globalThis.Buffer.from(e).toString("base64");{const t=[];return e.forEach((e=>{t.push(globalThis.String.fromCharCode(e))})),globalThis.btoa(t.join(""))}}function toTimestamp(e){return{seconds:Math.trunc(e.getTime()/1e3),nanos:e.getTime()%1e3*1e6}}function fromTimestamp(e){let t=1e3*(e.seconds||0);return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function fromJsonTimestamp(e){return e instanceof globalThis.Date?e:"string"==typeof e?new globalThis.Date(e):fromTimestamp(Timestamp.fromJSON(e))}function longToNumber2(e){const t=globalThis.Number(e.toString());if(t>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<globalThis.Number.MIN_SAFE_INTEGER)throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}function isObject2(e){return"object"==typeof e&&null!==e}function isSet4(e){return null!=e}import{v4 as uuidv42}from"uuid";import{ClientError as ClientError10,createChannel as createChannel2,createClientFactory as createClientFactory2,Metadata as Metadata2,Status as Status10}from"nice-grpc";var CloudBucketMountService=class{#e;constructor(e){this.#e=e}create(e,t={}){let n=1;if(t.bucketEndpointUrl){const e=new URL(t.bucketEndpointUrl);e.hostname.endsWith("r2.cloudflarestorage.com")?n=2:e.hostname.endsWith("storage.googleapis.com")?n=3:(n=1,this.#e.logger.debug("CloudBucketMount received unrecognized bucket endpoint URL. Assuming AWS S3 configuration as fallback.","bucketEndpointUrl",t.bucketEndpointUrl))}if(t.requesterPays&&!t.secret)throw new Error("Credentials required in order to use Requester Pays.");if(t.keyPrefix&&!t.keyPrefix.endsWith("/"))throw new Error("keyPrefix will be prefixed to all object paths, so it must end in a '/'");return new CloudBucketMount2(e,t.secret,t.readOnly??!1,t.requesterPays??!1,t.bucketEndpointUrl,t.keyPrefix,t.oidcAuthRoleArn,n)}},CloudBucketMount2=class{bucketName;secret;readOnly;requesterPays;bucketEndpointUrl;keyPrefix;oidcAuthRoleArn;#t;constructor(e,t,n,r,a,o,i,s){if(void 0===s){const n=void 0===t?{}:t;return getDefaultClient().cloudBucketMounts.create(e,n)}this.bucketName=e,this.secret=t,this.readOnly=n,this.requesterPays=r,this.bucketEndpointUrl=a,this.keyPrefix=o,this.oidcAuthRoleArn=i,this.#t=s}toProto(e){return CloudBucketMount.create({bucketName:this.bucketName,mountPath:e,credentialsSecretId:this.secret?.secretId??"",readOnly:this.readOnly,bucketType:this.#t,requesterPays:this.requesterPays,bucketEndpointUrl:this.bucketEndpointUrl,keyPrefix:this.keyPrefix,oidcAuthRoleArn:this.oidcAuthRoleArn})}};import{ClientError as ClientError3,Status as Status3}from"nice-grpc";var TimeoutError=class extends Error{constructor(e="Operation timed out"){super(e),this.name="TimeoutError"}},FunctionTimeoutError=class extends Error{constructor(e){super(e),this.name="FunctionTimeoutError"}},RemoteError=class extends Error{constructor(e){super(e),this.name="RemoteError"}},InternalFailure=class extends Error{constructor(e){super(e),this.name="InternalFailure"}},NotFoundError=class extends Error{constructor(e){super(e),this.name="NotFoundError"}},AlreadyExistsError=class extends Error{constructor(e){super(e),this.name="AlreadyExistsError"}},InvalidError=class extends Error{constructor(e){super(e),this.name="InvalidError"}},QueueEmptyError=class extends Error{constructor(e){super(e),this.name="QueueEmptyError"}},QueueFullError=class extends Error{constructor(e){super(e),this.name="QueueFullError"}},SandboxFilesystemError=class extends Error{constructor(e){super(e),this.name="SandboxFilesystemError"}},SandboxTimeoutError=class extends Error{constructor(e="Sandbox operation timed out"){super(e),this.name="SandboxTimeoutError"}},ClientClosedError=class extends Error{constructor(e="Unable to perform operation on a detached sandbox"){super(e),this.name="ClientClosedError"}};import{createHash}from"node:crypto";import{Encoder,Decoder}from"cbor-x";var encoderOptions={mapsAsObjects:!0,useRecords:!1,tagUint8Array:!1,useTag259ForMaps:!1},decoderOptions={mapsAsObjects:!0,useRecords:!1,tagUint8Array:!1,useTag259ForMaps:!1},encoder=new Encoder(encoderOptions),decoder=new Decoder(decoderOptions);function cborEncode(e){return encoder.encode(e)}function cborDecode(e){return decoder.decode(e)}var outputsTimeoutMs=55e3,ControlPlaneInvocation=class e{cpClient;functionCallId;input;functionCallJwt;inputJwt;constructor(e,t,n,r,a){this.cpClient=e,this.functionCallId=t,this.input=n,this.functionCallJwt=r,this.inputJwt=a}static async create(t,n,r,a){const o=FunctionPutInputsItem.create({idx:0,input:r}),i=await t.cpClient.functionMap({functionId:n,functionCallType:1,functionCallInvocationType:a,pipelinedInputs:[o]});return new e(t.cpClient,i.functionCallId,r,i.functionCallJwt,i.pipelinedInputs[0].inputJwt)}static fromFunctionCallId(t,n){return new e(t.cpClient,n)}async awaitOutput(e){return await pollFunctionOutput(this.cpClient,(e=>this.#n(e)),e)}async#n(e){const t=await this.cpClient.functionGetOutputs({functionCallId:this.functionCallId,maxValues:1,timeout:e/1e3,lastEntryId:"0-0",clearOnSuccess:!0,requestedAt:timeNowSeconds()});return t.outputs?t.outputs[0]:void 0}async retry(e){if(!this.input)throw new Error("Cannot retry Function invocation - input missing");const t={inputJwt:this.inputJwt,input:this.input,retryCount:e},n=await this.cpClient.functionRetryInputs({functionCallJwt:this.functionCallJwt,inputs:[t]});this.inputJwt=n.inputJwts[0]}},InputPlaneInvocation=class e{cpClient;ipClient;functionId;input;attemptToken;constructor(e,t,n,r,a){this.cpClient=e,this.ipClient=t,this.functionId=n,this.input=r,this.attemptToken=a}static async create(t,n,r,a){const o=FunctionPutInputsItem.create({idx:0,input:a}),i=t.ipClient(n),s=await i.attemptStart({functionId:r,input:o});return new e(t.cpClient,i,r,o,s.attemptToken)}async awaitOutput(e){return await pollFunctionOutput(this.cpClient,(e=>this.#n(e)),e)}async#n(e){return(await this.ipClient.attemptAwait({attemptToken:this.attemptToken,requestedAt:timeNowSeconds(),timeoutSecs:e/1e3})).output}async retry(e){const t=await this.ipClient.attemptRetry({functionId:this.functionId,input:this.input,attemptToken:this.attemptToken});this.attemptToken=t.attemptToken}};function timeNowSeconds(){return Date.now()/1e3}async function pollFunctionOutput(e,t,n){const r=Date.now();let a=outputsTimeoutMs;for(void 0!==n&&(a=Math.min(n,outputsTimeoutMs));;){const o=await t(a);if(o)return await processResult(e,o.result,o.dataFormat);if(void 0!==n){const e=n-(Date.now()-r);if(e<=0){throw new FunctionTimeoutError(`Timeout exceeded: ${n}ms`)}a=Math.min(outputsTimeoutMs,e)}}}async function processResult(e,t,n){if(!t)throw new Error("Received null result from invocation");let r=new Uint8Array;switch(void 0!==t.data?r=t.data:t.dataBlobId&&(r=await blobDownload(e,t.dataBlobId)),t.status){case 4:throw new FunctionTimeoutError(`Timeout: ${t.exception}`);case 6:throw new InternalFailure(`Internal failure: ${t.exception}`);case 1:break;default:throw new RemoteError(`Remote error: ${t.exception}`)}return deserializeDataFormat(r,n)}async function blobDownload(e,t){const n=await e.blobGet({blobId:t}),r=await fetch(n.downloadUrl);if(!r.ok)throw new Error(`Failed to download blob: ${r.statusText}`);const a=await r.arrayBuffer();return new Uint8Array(a)}function deserializeDataFormat(e,t){if(!e)return null;switch(t){case 1:throw new Error("PICKLE output format is not supported - remote function must return CBOR format");case 4:return cborDecode(e);case 2:throw new Error("ASGI data format is not supported in modal-js");case 3:return GeneratorDone.decode(e);default:throw new Error(`Unsupported data format: ${t}`)}}function checkForRenamedParams(e,t){if(e)for(const[n,r]of Object.entries(t))if(n in e)throw new Error(`Parameter '${n}' has been renamed to '${r}'.`)}var FunctionCallService=class{#e;constructor(e){this.#e=e}async fromId(e){return new FunctionCall(this.#e,e)}},FunctionCall=class e{functionCallId;#e;constructor(e,t){this.#e=e,this.functionCallId=t}static fromId(t){return new e(void 0,t)}async get(e={}){checkForRenamedParams(e,{timeout:"timeoutMs"});return ControlPlaneInvocation.fromFunctionCallId(this.#e||getDefaultClient(),this.functionCallId).awaitOutput(e.timeoutMs)}async cancel(e={}){const t=this.#e?.cpClient||getDefaultClient().cpClient;await t.functionCallCancel({functionCallId:this.functionCallId,terminateContainers:e.terminateContainers})}};import{ClientError,Status}from"nice-grpc";var maxObjectSizeBytes=2097152,maxSystemRetries=8,FunctionService=class{#e;constructor(e){this.#e=e}async fromName(e,t,n={}){if(t.includes(".")){const[n,r]=t.split(".",2);throw new Error(`Cannot retrieve Cls methods using 'functions.fromName()'. Use:\n  const cls = await client.cls.fromName("${e}", "${n}");\n  const instance = await cls.instance();\n  const m = instance.method("${r}");`)}try{const r=await this.#e.cpClient.functionGet({appName:e,objectTag:t,environmentName:this.#e.environmentName(n.environment)});return this.#e.logger.debug("Retrieved Function","function_id",r.functionId,"app_name",e,"function_name",t),new Function_(this.#e,r.functionId,void 0,r.handleMetadata)}catch(n){if(n instanceof ClientError&&n.code===Status.NOT_FOUND)throw new NotFoundError(`Function '${e}/${t}' not found`);throw n}}},Function_=class{functionId;methodName;#e;#r;constructor(e,t,n,r){this.functionId=t,this.methodName=n,this.#e=e,this.#r=r}static async lookup(e,t,n={}){return await getDefaultClient().functions.fromName(e,t,n)}#a(e){if(this.#r?.webUrl)throw new InvalidError(`A webhook Function cannot be invoked for remote execution with '.${e}'. Invoke this Function via its web url '${this.#r.webUrl}' instead.`)}async remote(e=[],t={}){this.#e.logger.debug("Executing function call","function_id",this.functionId),this.#a("remote");const n=await this.#o(e,t),r=await this.#i(n);let a=0;for(;;)try{const e=await r.awaitOutput();return this.#e.logger.debug("Function call completed","function_id",this.functionId),e}catch(e){if(!(e instanceof InternalFailure&&a<=maxSystemRetries))throw e;this.#e.logger.debug("Retrying function call due to internal failure","function_id",this.functionId,"retry_count",a),await r.retry(a),a++}}async#i(e){return this.#r?.inputPlaneUrl?await InputPlaneInvocation.create(this.#e,this.#r.inputPlaneUrl,this.functionId,e):await ControlPlaneInvocation.create(this.#e,this.functionId,e,4)}async spawn(e=[],t={}){this.#e.logger.debug("Spawning function call","function_id",this.functionId),this.#a("spawn");const n=await this.#o(e,t),r=await ControlPlaneInvocation.create(this.#e,this.functionId,n,3);return this.#e.logger.debug("Function call spawned","function_id",this.functionId,"function_call_id",r.functionCallId),new FunctionCall(this.#e,r.functionCallId)}async getCurrentStats(){const e=await this.#e.cpClient.functionGetCurrentStats({functionId:this.functionId},{timeoutMs:1e4});return{backlog:e.backlog,numTotalRunners:e.numTotalTasks}}async updateAutoscaler(e){checkForRenamedParams(e,{scaledownWindow:"scaledownWindowMs"}),await this.#e.cpClient.functionUpdateSchedulingParams({functionId:this.functionId,warmPoolSizeOverride:0,settings:{minContainers:e.minContainers,maxContainers:e.maxContainers,bufferContainers:e.bufferContainers,scaledownWindow:void 0!==e.scaledownWindowMs?Math.trunc(e.scaledownWindowMs/1e3):void 0}})}async getWebUrl(){return this.#r?.webUrl||void 0}async#o(e=[],t={}){if(!(this.#r?.supportedInputFormats?.length?this.#r.supportedInputFormats:[1]).includes(4))throw new InvalidError("cannot call Modal Function from JS SDK since it was deployed with an incompatible Python SDK version. Redeploy with Modal Python SDK >= 1.2");const n=cborEncode([e,t]);let r;return n.length>maxObjectSizeBytes&&(r=await blobUpload(this.#e.cpClient,n)),{args:r?void 0:n,argsBlobId:r,dataFormat:4,methodName:this.methodName,finalInput:!1}}};async function blobUpload(e,t){const n=createHash("md5").update(t).digest("base64"),r=createHash("sha256").update(t).digest("base64"),a=await e.blobCreate({contentMd5:n,contentSha256Base64:r,contentLength:t.length});if(a.multipart)throw new Error("Function input size exceeds multipart upload threshold, unsupported by this SDK version");if(a.uploadUrl){const e=await fetch(a.uploadUrl,{method:"PUT",headers:{"Content-Type":"application/octet-stream","Content-MD5":n},body:t});if(e.status<200||e.status>=300)throw new Error(`Failed blob upload: ${e.statusText}`);return a.blobId}throw new Error("Missing upload URL in BlobCreate response")}import{ClientError as ClientError2,Status as Status2}from"nice-grpc";var SecretService=class{#e;constructor(e){this.#e=e}async fromName(e,t){try{const n=await this.#e.cpClient.secretGetOrCreate({deploymentName:e,environmentName:this.#e.environmentName(t?.environment),requiredKeys:t?.requiredKeys??[]});return this.#e.logger.debug("Retrieved Secret","secret_id",n.secretId,"secret_name",e),new Secret(n.secretId,e)}catch(e){if(e instanceof ClientError2&&e.code===Status2.NOT_FOUND)throw new NotFoundError(e.details);if(e instanceof ClientError2&&e.code===Status2.FAILED_PRECONDITION&&e.details.includes("Secret is missing key"))throw new NotFoundError(e.details);throw e}}async fromObject(e,t){for(const[,t]of Object.entries(e))if(null==t||"string"!=typeof t)throw new InvalidError("entries must be an object mapping string keys to string values, but got:\n"+JSON.stringify(e));try{const n=await this.#e.cpClient.secretGetOrCreate({objectCreationType:5,envDict:e,environmentName:this.#e.environmentName(t?.environment)});return this.#e.logger.debug("Created ephemeral Secret","secret_id",n.secretId),new Secret(n.secretId)}catch(e){if(e instanceof ClientError2&&(e.code===Status2.INVALID_ARGUMENT||e.code===Status2.FAILED_PRECONDITION))throw new InvalidError(e.details);throw e}}async delete(e,t){try{const n=await this.fromName(e,{environment:t?.environment});await this.#e.cpClient.secretDelete({secretId:n.secretId}),this.#e.logger.debug("Deleted Secret","secret_name",e,"secret_id",n.secretId)}catch(e){if((e instanceof NotFoundError||e instanceof ClientError2&&e.code===Status2.NOT_FOUND)&&t?.allowMissing)return;throw e}}},Secret=class{secretId;name;constructor(e,t){this.secretId=e,this.name=t}static async fromName(e,t){return getDefaultClient().secrets.fromName(e,t)}static async fromObject(e,t){return getDefaultClient().secrets.fromObject(e,t)}};async function mergeEnvIntoSecrets(e,t,n){const r=[...n||[]];return t&&Object.keys(t).length>0&&r.push(await e.secrets.fromObject(t)),r}var Retries=class{maxRetries;backoffCoefficient;initialDelayMs;maxDelayMs;constructor(e){const{maxRetries:t,backoffCoefficient:n=2,initialDelayMs:r=1e3,maxDelayMs:a=6e4}=e;if(t<0||t>10)throw new Error(`Invalid maxRetries: ${t}. Must be between 0 and 10.`);if(n<1||n>10)throw new Error(`Invalid backoffCoefficient: ${n}. Must be between 1.0 and 10.0`);if(r<0||r>6e4)throw new Error(`Invalid initialDelayMs: ${r}. Must be between 0 and 60000 ms.`);if(a<1e3||a>6e4)throw new Error(`Invalid maxDelayMs: ${a}. Must be between 1000 and 60000 ms.`);this.maxRetries=t,this.backoffCoefficient=n,this.initialDelayMs=r,this.maxDelayMs=a}};function parseRetries(e){if(void 0!==e){if("number"==typeof e){if(!Number.isInteger(e)||e<0||e>10)throw new Error(`Retries parameter must be an integer between 0 and 10. Found: ${e}`);return new Retries({maxRetries:e,backoffCoefficient:1,initialDelayMs:1e3})}if(e instanceof Retries)return e;throw new Error(`Retries parameter must be an integer or instance of Retries. Found: ${typeof e}.`)}}var ClsService=class{#e;constructor(e){this.#e=e}async fromName(e,t,n={}){try{const r=`${t}.*`,a=await this.#e.cpClient.functionGet({appName:e,objectTag:r,environmentName:this.#e.environmentName(n.environment)}),o=a.handleMetadata?.classParameterInfo;if((o?.schema??[]).length>0&&2!==o?.format)throw new Error(`Unsupported parameter format: ${o?.format}`);return this.#e.logger.debug("Retrieved Cls","function_id",a.functionId,"app_name",e,"cls_name",t),new Cls(this.#e,a.functionId,a.handleMetadata,void 0)}catch(n){if(n instanceof ClientError3&&n.code===Status3.NOT_FOUND)throw new NotFoundError(`Class '${e}/${t}' not found`);throw n}}},Cls=class e{#e;#s;#u;#c;constructor(e,t,n,r){this.#e=e,this.#s=t,this.#u=n,this.#c=r}get#d(){return this.#u.classParameterInfo?.schema??[]}static async lookup(e,t,n={}){return getDefaultClient().cls.fromName(e,t,n)}async instance(e={}){let t;t=0===this.#d.length&&void 0===this.#c?this.#s:await this.#l(e);const n=new Map;for(const[e,r]of Object.entries(this.#u.methodHandleMetadata))n.set(e,new Function_(this.#e,t,e,r));return new ClsInstance(n)}withOptions(t){const n=mergeServiceOptions(this.#c,t);return new e(this.#e,this.#s,this.#u,n)}withConcurrency(t){const n=mergeServiceOptions(this.#c,{maxConcurrentInputs:t.maxInputs,targetConcurrentInputs:t.targetInputs});return new e(this.#e,this.#s,this.#u,n)}withBatching(t){const n=mergeServiceOptions(this.#c,{batchMaxSize:t.maxBatchSize,batchWaitMs:t.waitMs});return new e(this.#e,this.#s,this.#u,n)}async#l(e){const t=await mergeEnvIntoSecrets(this.#e,this.#c?.env,this.#c?.secrets),n=mergeServiceOptions(this.#c,{secrets:t,env:void 0}),r=encodeParameterSet(this.#d,e),a=await buildFunctionOptionsProto(n);return(await this.#e.cpClient.functionBindParams({functionId:this.#s,serializedParams:r,functionOptions:a,environmentName:this.#e.environmentName()})).boundFunctionId}};function encodeParameterSet(e,t){const n=[];for(const r of e){const e=encodeParameter(r,t[r.name]);n.push(e)}return n.sort(((e,t)=>e.name.localeCompare(t.name))),ClassParameterSet.encode({parameters:n}).finish()}function mergeServiceOptions(e,t){const n={...e??{},...Object.fromEntries(Object.entries(t).filter((([,e])=>void 0!==e)))};return 0===Object.keys(n).length?void 0:n}async function buildFunctionOptionsProto(e){if(!e)return;const t=e??{};checkForRenamedParams(t,{memory:"memoryMiB",memoryLimit:"memoryLimitMiB",scaledownWindow:"scaledownWindowMs",timeout:"timeoutMs"});const n=parseGpuConfig(t.gpu);let r,a,o,i;if(void 0===t.cpu&&void 0!==t.cpuLimit)throw new Error("must also specify cpu when cpuLimit is specified");if(void 0!==t.cpu){if(t.cpu<=0)throw new Error(`cpu (${t.cpu}) must be a positive number`);if(r=Math.trunc(1e3*t.cpu),void 0!==t.cpuLimit){if(t.cpuLimit<t.cpu)throw new Error(`cpu (${t.cpu}) cannot be higher than cpuLimit (${t.cpuLimit})`);a=Math.trunc(1e3*t.cpuLimit)}}if(void 0===t.memoryMiB&&void 0!==t.memoryLimitMiB)throw new Error("must also specify memoryMiB when memoryLimitMiB is specified");if(void 0!==t.memoryMiB){if(t.memoryMiB<=0)throw new Error(`memoryMiB (${t.memoryMiB}) must be a positive number`);if(o=t.memoryMiB,void 0!==t.memoryLimitMiB){if(t.memoryLimitMiB<t.memoryMiB)throw new Error(`memoryMiB (${t.memoryMiB}) cannot be higher than memoryLimitMiB (${t.memoryLimitMiB})`);i=t.memoryLimitMiB}}const s=void 0!==r||void 0!==a||void 0!==o||void 0!==i||n?{milliCpu:r,milliCpuMax:a,memoryMb:o,memoryMbMax:i,gpuConfig:n}:void 0,u=(t.secrets||[]).map((e=>e.secretId)),c=t.volumes?Object.entries(t.volumes).map((([e,t])=>({volumeId:t.volumeId,mountPath:e,allowBackgroundCommits:!0,readOnly:t.isReadOnly}))):[],d=parseRetries(t.retries),l=d?{retries:d.maxRetries,backoffCoefficient:d.backoffCoefficient,initialDelayMs:d.initialDelayMs,maxDelayMs:d.maxDelayMs}:void 0;if(void 0!==t.scaledownWindowMs&&t.scaledownWindowMs%1e3!=0)throw new Error(`scaledownWindowMs must be a multiple of 1000ms, got ${t.scaledownWindowMs}`);if(void 0!==t.timeoutMs&&t.timeoutMs%1e3!=0)throw new Error(`timeoutMs must be a multiple of 1000ms, got ${t.timeoutMs}`);return FunctionOptions.create({secretIds:u,replaceSecretIds:u.length>0,replaceVolumeMounts:c.length>0,volumeMounts:c,resources:s,retryPolicy:l,concurrencyLimit:t.maxContainers,bufferContainers:t.bufferContainers,taskIdleTimeoutSecs:void 0!==t.scaledownWindowMs?t.scaledownWindowMs/1e3:void 0,timeoutSecs:void 0!==t.timeoutMs?t.timeoutMs/1e3:void 0,maxConcurrentInputs:t.maxConcurrentInputs,targetConcurrentInputs:t.targetConcurrentInputs,batchMaxSize:t.batchMaxSize,batchLingerMs:t.batchWaitMs})}function encodeParameter(e,t){const n=e.name,r=e.type,a={name:n,type:r};switch(r){case 1:if(null==t&&e.hasDefault&&(t=e.stringDefault??""),"string"!=typeof t)throw new Error(`Parameter '${n}' must be a string`);a.stringValue=t;break;case 2:if(null==t&&e.hasDefault&&(t=e.intDefault??0),"number"!=typeof t)throw new Error(`Parameter '${n}' must be an integer`);a.intValue=t;break;case 9:if(null==t&&e.hasDefault&&(t=e.boolDefault??!1),"boolean"!=typeof t)throw new Error(`Parameter '${n}' must be a boolean`);a.boolValue=t;break;case 4:if(null==t&&e.hasDefault&&(t=e.bytesDefault??new Uint8Array),!(t instanceof Uint8Array))throw new Error(`Parameter '${n}' must be a byte array`);a.bytesValue=t;break;default:throw new Error(`Unsupported parameter type: ${r}`)}return a}var ClsInstance=class{#p;constructor(e){this.#p=e}method(e){const t=this.#p.get(e);if(!t)throw new NotFoundError(`Method '${e}' not found on class`);return t}};import{ClientError as ClientError4}from"nice-grpc";import{Status as Status4}from"nice-grpc";var ImageService=class{#e;constructor(e){this.#e=e}async fromId(e){try{const t=await this.#e.cpClient.imageFromId({imageId:e});return new Image2(this.#e,t.imageId,"")}catch(e){if(e instanceof ClientError4&&e.code===Status4.NOT_FOUND)throw new NotFoundError(e.details);if(e instanceof ClientError4&&e.code===Status4.FAILED_PRECONDITION&&e.details.includes("Could not find image with ID"))throw new NotFoundError(e.details);throw e}}fromRegistry(e,t){let n;if(t){if(!(t instanceof Secret))throw new TypeError("secret must be a reference to an existing Secret, e.g. `await Secret.fromName('my_secret')`");n={registryAuthType:4,secretId:t.secretId}}return new Image2(this.#e,"",e,n)}fromAwsEcr(e,t){let n;if(t){if(!(t instanceof Secret))throw new TypeError("secret must be a reference to an existing Secret, e.g. `await Secret.fromName('my_secret')`");n={registryAuthType:1,secretId:t.secretId}}return new Image2(this.#e,"",e,n)}fromGcpArtifactRegistry(e,t){let n;if(t){if(!(t instanceof Secret))throw new TypeError("secret must be a reference to an existing Secret, e.g. `await Secret.fromName('my_secret')`");n={registryAuthType:2,secretId:t.secretId}}return new Image2(this.#e,"",e,n)}async delete(e,t={}){try{await this.#e.cpClient.imageDelete({imageId:e})}catch(e){if(e instanceof ClientError4&&e.code===Status4.NOT_FOUND)throw new NotFoundError(e.details);if(e instanceof ClientError4&&e.code===Status4.FAILED_PRECONDITION&&e.details.includes("Could not find image with ID"))throw new NotFoundError(e.details);throw e}}},Image2=class e{#e;#m;#f;#b;#S;constructor(e,t,n,r,a){this.#e=e,this.#m=t,this.#f=n,this.#b=r,this.#S=a||[{commands:[],env:void 0,secrets:void 0,gpuConfig:void 0,forceBuild:!1}]}get imageId(){return this.#m}static async fromId(e){return getDefaultClient().images.fromId(e)}static fromRegistry(e,t){return getDefaultClient().images.fromRegistry(e,t)}static fromAwsEcr(e,t){return getDefaultClient().images.fromAwsEcr(e,t)}static fromGcpArtifactRegistry(e,t){return getDefaultClient().images.fromGcpArtifactRegistry(e,t)}static validateDockerfileCommands(e){for(const t of e){const e=t.trim().toUpperCase();if(e.startsWith("COPY ")&&!e.startsWith("COPY --FROM="))throw new InvalidError("COPY commands that copy from local context are not yet supported.")}}dockerfileCommands(t,n){if(0===t.length)return this;e.validateDockerfileCommands(t);const r={commands:[...t],env:n?.env,secrets:n?.secrets,gpuConfig:n?.gpu?parseGpuConfig(n.gpu):void 0,forceBuild:n?.forceBuild};return new e(this.#e,"",this.#f,this.#b,[...this.#S,r])}async build(e){if(""!==this.imageId)return this;let t;this.#e.logger.debug("Building image","app_id",e.appId);for(let n=0;n<this.#S.length;n++){const r=this.#S[n],a=(await mergeEnvIntoSecrets(this.#e,r.env,r.secrets)).map((e=>e.secretId)),o=r.gpuConfig;let i,s;0===n?(i=[`FROM ${this.#f}`,...r.commands],s=[]):(i=["FROM base",...r.commands],s=[{dockerTag:"base",imageId:t}]);const u=await this.#e.cpClient.imageGetOrCreate({appId:e.appId,image:Image.create({dockerfileCommands:i,imageRegistryConfig:this.#b,secretIds:a,gpuConfig:o,contextFiles:[],baseImages:s}),builderVersion:this.#e.imageBuilderVersion(),forceBuild:r.forceBuild||!1});let c;if(u.result?.status)c=u.result;else{let e,t="";for(;!e;)for await(const n of this.#e.cpClient.imageJoinStreaming({imageId:u.imageId,timeout:55,lastEntryId:t}))if(n.entryId&&(t=n.entryId),n.result?.status){e=n.result;break}c=e}if(2===c.status)throw new Error(`Image build for ${u.imageId} failed with the exception:\n${c.exception}`);if(3===c.status)throw new Error(`Image build for ${u.imageId} terminated due to external shut-down. Please try again.`);if(4===c.status)throw new Error(`Image build for ${u.imageId} timed out. Please try again with a larger timeout parameter.`);if(1!==c.status)throw new Error(`Image build for ${u.imageId} failed with unknown status: ${c.status}`);t=u.imageId}return this.#m=t,this.#e.logger.debug("Image build completed","image_id",t),this}static async delete(e,t={}){return getDefaultClient().images.delete(e)}};import{ClientError as ClientError5,Status as Status5}from"nice-grpc";var ProxyService=class{#e;constructor(e){this.#e=e}async fromName(e,t){try{const n=await this.#e.cpClient.proxyGet({name:e,environmentName:this.#e.environmentName(t?.environment)});if(!n.proxy?.proxyId)throw new NotFoundError(`Proxy '${e}' not found`);return new Proxy3(n.proxy.proxyId)}catch(t){if(t instanceof ClientError5&&t.code===Status5.NOT_FOUND)throw new NotFoundError(`Proxy '${e}' not found`);throw t}}},Proxy3=class{proxyId;constructor(e){this.proxyId=e}static async fromName(e,t){return getDefaultClient().proxies.fromName(e,t)}},PickleError=class extends Error{constructor(e){super(e),this.name="PickleError"}},Writer=class{out=[];byte(e){this.out.push(255&e)}bytes(e){for(const t of e)this.byte(t)}uint32LE(e){this.byte(e),this.byte(e>>>8),this.byte(e>>>16),this.byte(e>>>24)}uint64LE(e){let t=BigInt(e);for(let e=0;e<8;e++)this.byte(Number(0xffn&t)),t>>=8n}float64BE(e){const t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e,!1),this.bytes(new Uint8Array(t.buffer))}toUint8(){return new Uint8Array(this.out)}},Reader=class{constructor(e,t=0){this.buf=e,this.pos=t}eof(){return this.pos>=this.buf.length}byte(){return this.buf[this.pos++]}take(e){const t=this.buf.subarray(this.pos,this.pos+e);return this.pos+=e,t}uint32LE(){return this.byte()|this.byte()<<8|this.byte()<<16|this.byte()<<24}uint64LE(){const e=this.uint32LE()>>>0;return(this.uint32LE()>>>0)*2**32+e}int32LE(){const e=new DataView(this.buf.buffer,this.buf.byteOffset+this.pos,4).getInt32(0,!0);return this.pos+=4,e}float64BE(){const e=new DataView(this.buf.buffer,this.buf.byteOffset+this.pos,8).getFloat64(0,!1);return this.pos+=8,e}};function encodeValue(e,t,n){if(null!=e)if("boolean"!=typeof e){if("number"==typeof e)return Number.isInteger(e)?e>=0&&e<=255?(t.byte(75),t.byte(e)):e>=0&&e<=65535?(t.byte(77),t.byte(255&e),t.byte(e>>8&255)):(t.byte(74),t.uint32LE(e>>>0)):(t.byte(71),t.float64BE(e)),void maybeMemoize(t,n);if("string"==typeof e){const r=(new TextEncoder).encode(e);return n>=4&&r.length<256?(t.byte(140),t.byte(r.length)):n>=4&&r.length>4294967295?(t.byte(141),t.uint64LE(r.length)):(t.byte(88),t.uint32LE(r.length)),t.bytes(r),void maybeMemoize(t,n)}if(e instanceof Uint8Array){const r=e.length;return n>=4&&r<256?(t.byte(67),t.byte(r)):n>=4&&r>4294967295?(t.byte(142),t.uint64LE(r)):(t.byte(66),t.uint32LE(r)),t.bytes(e),void maybeMemoize(t,n)}if(Array.isArray(e)){t.byte(93),maybeMemoize(t,n);for(const r of e)encodeValue(r,t,n),t.byte(97)}else{if("object"!=typeof e)throw new PickleError("The JS Modal SDK does not support encoding/pickling data of type "+typeof e);t.byte(125),maybeMemoize(t,n);for(const[r,a]of Object.entries(e))encodeValue(r,t,n),encodeValue(a,t,n),t.byte(115)}}else t.byte(e?136:137);else t.byte(78)}function maybeMemoize(e,t){t>=4&&e.byte(148)}function dumps(e,t=4){if(![3,4,5].includes(t))throw new PickleError(`The JS Modal SDK does not support pickle protocol version ${t}`);const n=new Writer;return n.byte(128),n.byte(t),5===t&&(n.byte(149),n.uint64LE(0)),encodeValue(e,n,t),n.byte(46),n.toUint8()}function loads(e){const t=new Reader(e);if(128!==t.byte())throw new PickleError("pickle missing PROTO header");const n=t.byte();if(![3,4,5].includes(n))throw new PickleError(`The JS Modal SDK does not support pickle protocol version ${n}`);const r=[],a=[],o=new TextDecoder;function i(e){r.push(e)}function s(){return r.pop()}if(5===n&&149===e[t.pos]){t.byte();t.uint64LE()}const u=Symbol("pickle-mark");for(;!t.eof();){const e=t.byte();switch(e){case 46:return r.pop();case 78:i(null);break;case 136:i(!0);break;case 137:i(!1);break;case 75:i(t.byte());break;case 77:{const e=t.byte();i(t.byte()<<8|e);break}case 74:i(t.int32LE());break;case 71:i(t.float64BE());break;case 140:{const e=t.byte();i(o.decode(t.take(e)));break}case 88:{const e=t.uint32LE();i(o.decode(t.take(e)));break}case 141:{const e=t.uint64LE();i(o.decode(t.take(e)));break}case 67:{const e=t.byte();i(t.take(e));break}case 66:{const e=t.uint32LE();i(t.take(e));break}case 142:{const e=t.uint64LE();i(t.take(e));break}case 93:i([]);break;case 97:{const e=s(),t=s();t.push(e),i(t);break}case 125:i({});break;case 115:{const e=s(),t=s(),n=s();n[t]=e,i(n);break}case 148:a.push(r[r.length-1]);break;case 113:a[t.byte()]=r[r.length-1];break;case 114:a[t.uint32LE()]=r[r.length-1];break;case 104:i(a[t.byte()]);break;case 106:i(a[t.uint32LE()]);break;case 149:t.uint64LE();break;case 40:i(u);break;case 101:{const e=r.lastIndexOf(u);if(-1===e)throw new PickleError("APPENDS without MARK");const t=r[e-1];if(!Array.isArray(t))throw new PickleError("APPENDS expects a list below MARK");const n=r.slice(e+1);t.push(...n),r.length=e-1,i(t);break}case 117:{const e=r.lastIndexOf(u);if(-1===e)throw new PickleError("SETITEMS without MARK");const t=r[e-1];if("object"!=typeof t||null===t||Array.isArray(t))throw new PickleError("SETITEMS expects a dict below MARK");const n=r.slice(e+1);for(let e=0;e<n.length;e+=2)e+1<n.length&&(t[n[e]]=n[e+1]);r.length=e-1,i(t);break}default:throw new PickleError(`The JS Modal SDK does not support decoding/unpickling this kind of data. Error: unsupported opcode 0x${e.toString(16)}`)}}throw new PickleError("pickle stream ended without STOP")}import{ClientError as ClientError6,Status as Status6}from"nice-grpc";var ephemeralObjectHeartbeatSleep=3e5,EphemeralHeartbeatManager=class{heartbeatFn;abortController;constructor(e){this.heartbeatFn=e,this.abortController=new AbortController,this.start()}start(){const e=this.abortController.signal;(async()=>{for(;!e.aborted;)await this.heartbeatFn(),await Promise.race([new Promise((e=>{setTimeout(e,ephemeralObjectHeartbeatSleep).unref()})),new Promise((t=>{e.addEventListener("abort",t,{once:!0})}))])})()}stop(){this.abortController.abort()}},queueInitialPutBackoffMs=100,queueDefaultPartitionTtlMs=864e5,QueueService=class{#e;constructor(e){this.#e=e}async ephemeral(e={}){const t=await this.#e.cpClient.queueGetOrCreate({objectCreationType:5,environmentName:this.#e.environmentName(e.environment)});this.#e.logger.debug("Created ephemeral Queue","queue_id",t.queueId);const n=new EphemeralHeartbeatManager((()=>this.#e.cpClient.queueHeartbeat({queueId:t.queueId})));return new Queue(this.#e,t.queueId,void 0,n)}async fromName(e,t={}){try{const n=await this.#e.cpClient.queueGetOrCreate({deploymentName:e,objectCreationType:t.createIfMissing?1:void 0,environmentName:this.#e.environmentName(t.environment)});return this.#e.logger.debug("Retrieved Queue","queue_id",n.queueId,"queue_name",e),new Queue(this.#e,n.queueId,e)}catch(e){if(e instanceof ClientError6&&e.code===Status6.NOT_FOUND)throw new NotFoundError(e.details);throw e}}async delete(e,t={}){try{const n=await this.fromName(e,{environment:t.environment,createIfMissing:!1});await this.#e.cpClient.queueDelete({queueId:n.queueId}),this.#e.logger.debug("Deleted Queue","queue_name",e,"queue_id",n.queueId)}catch(e){if((e instanceof NotFoundError||e instanceof ClientError6&&e.code===Status6.NOT_FOUND)&&t.allowMissing)return;throw e}}},Queue=class e{#e;queueId;name;#I;constructor(e,t,n,r){this.#e=e,this.queueId=t,this.name=n,this.#I=r}static#g(e){if(e){const t=(new TextEncoder).encode(e);if(0===t.length||t.length>64)throw new InvalidError("Queue partition key must be between 1 and 64 bytes.");return t}return new Uint8Array}static async ephemeral(e={}){return getDefaultClient().queues.ephemeral(e)}closeEphemeral(){if(!this.#I)throw new InvalidError("Queue is not ephemeral.");this.#I.stop()}static async lookup(e,t={}){return getDefaultClient().queues.fromName(e,t)}static async delete(e,t={}){return getDefaultClient().queues.delete(e,t)}async clear(t={}){if(t.partition&&t.all)throw new InvalidError("Partition must be null when requesting to clear all.");await this.#e.cpClient.queueClear({queueId:this.queueId,partitionKey:e.#g(t.partition),allPartitions:t.all})}async#y(t,n,r){const a=e.#g(n),o=Date.now();let i=5e4;for(void 0!==r&&(i=Math.min(i,r));;){const e=await this.#e.cpClient.queueGet({queueId:this.queueId,partitionKey:a,timeout:i/1e3,nValues:t});if(e.values&&e.values.length>0)return e.values.map((e=>loads(e)));if(void 0!==r){const e=r-(Date.now()-o);if(e<=0){const e=`Queue ${this.queueId} did not return values within ${r}ms.`;throw new QueueEmptyError(e)}i=Math.min(i,e)}}}async get(e={}){checkForRenamedParams(e,{timeout:"timeoutMs"});return(await this.#y(1,e.partition,e.timeoutMs))[0]}async getMany(e,t={}){return checkForRenamedParams(t,{timeout:"timeoutMs"}),await this.#y(e,t.partition,t.timeoutMs)}async#h(t,n,r,a){const o=t.map((e=>dumps(e))),i=e.#g(r);let s=queueInitialPutBackoffMs;const u=n?Date.now()+n:void 0;for(;;)try{await this.#e.cpClient.queuePut({queueId:this.queueId,values:o,partitionKey:i,partitionTtlSeconds:(a||queueDefaultPartitionTtlMs)/1e3});break}catch(e){if(!(e instanceof ClientError6&&e.code===Status6.RESOURCE_EXHAUSTED))throw e;if(s=Math.min(2*s,3e4),void 0!==u){const e=u-Date.now();if(e<=0)throw new QueueFullError(`Put failed on ${this.queueId}.`);s=Math.min(s,e)}await new Promise((e=>setTimeout(e,s)))}}async put(e,t={}){checkForRenamedParams(t,{timeout:"timeoutMs",partitionTtl:"partitionTtlMs"}),await this.#h([e],t.timeoutMs,t.partition,t.partitionTtlMs)}async putMany(e,t={}){checkForRenamedParams(t,{timeout:"timeoutMs",partitionTtl:"partitionTtlMs"}),await this.#h(e,t.timeoutMs,t.partition,t.partitionTtlMs)}async len(t={}){if(t.partition&&t.total)throw new InvalidError("Partition must be null when requesting total length.");return(await this.#e.cpClient.queueLen({queueId:this.queueId,partitionKey:e.#g(t.partition),total:t.total})).len}async*iterate(t={}){checkForRenamedParams(t,{itemPollTimeout:"itemPollTimeoutMs"});const{partition:n,itemPollTimeoutMs:r=0}=t;let a;const o=e.#g(n);let i=Date.now()+r;for(;;){const e=Math.max(0,Math.min(3e4,i-Date.now())),t={queueId:this.queueId,partitionKey:o,itemPollTimeout:e/1e3,lastEntryId:a||""},n=await this.#e.cpClient.queueNextItems(t);if(n.items&&n.items.length>0){for(const e of n.items)yield loads(e.value),a=e.entryId;i=Date.now()+r}else if(Date.now()>i)break}}};import{ClientError as ClientError8,Status as Status8}from"nice-grpc";import{setTimeout as setTimeout3}from"timers/promises";function taskExecStderrConfigFromJSON(e){switch(e){case 0:case"TASK_EXEC_STDERR_CONFIG_DEVNULL":return 0;case 1:case"TASK_EXEC_STDERR_CONFIG_PIPE":return 1;case 2:case"TASK_EXEC_STDERR_CONFIG_STDOUT":return 2;default:return-1}}function taskExecStderrConfigToJSON(e){switch(e){case 0:return"TASK_EXEC_STDERR_CONFIG_DEVNULL";case 1:return"TASK_EXEC_STDERR_CONFIG_PIPE";case 2:return"TASK_EXEC_STDERR_CONFIG_STDOUT";default:return"UNRECOGNIZED"}}function taskExecStdioFileDescriptorFromJSON(e){switch(e){case 0:case"TASK_EXEC_STDIO_FILE_DESCRIPTOR_STDOUT":return 0;case 1:case"TASK_EXEC_STDIO_FILE_DESCRIPTOR_STDERR":return 1;default:return-1}}function taskExecStdioFileDescriptorToJSON(e){switch(e){case 0:return"TASK_EXEC_STDIO_FILE_DESCRIPTOR_STDOUT";case 1:return"TASK_EXEC_STDIO_FILE_DESCRIPTOR_STDERR";default:return"UNRECOGNIZED"}}function taskExecStdoutConfigFromJSON(e){switch(e){case 0:case"TASK_EXEC_STDOUT_CONFIG_DEVNULL":return 0;case 1:case"TASK_EXEC_STDOUT_CONFIG_PIPE":return 1;default:return-1}}function taskExecStdoutConfigToJSON(e){switch(e){case 0:return"TASK_EXEC_STDOUT_CONFIG_DEVNULL";case 1:return"TASK_EXEC_STDOUT_CONFIG_PIPE";default:return"UNRECOGNIZED"}}function createBaseTaskContainerCreateRequest(){return{taskId:"",containerName:"",imageId:"",args:[],env:{},workdir:"",secretIds:[]}}var TaskContainerCreateRequest={encode(e,t=new BinaryWriter){""!==e.taskId&&t.uint32(10).string(e.taskId),""!==e.containerName&&t.uint32(18).string(e.containerName),""!==e.imageId&&t.uint32(26).string(e.imageId);for(const n of e.args)t.uint32(42).string(n);Object.entries(e.env).forEach((([e,n])=>{TaskContainerCreateRequest_EnvEntry.encode({key:e,value:n},t.uint32(50).fork()).join()})),""!==e.workdir&&t.uint32(58).string(e.workdir);for(const n of e.secretIds)t.uint32(66).string(n);return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskContainerCreateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.containerName=n.string();continue;case 3:if(26!==e)break;a.imageId=n.string();continue;case 5:if(42!==e)break;a.args.push(n.string());continue;case 6:{if(50!==e)break;const t=TaskContainerCreateRequest_EnvEntry.decode(n,n.uint32());void 0!==t.value&&(a.env[t.key]=t.value);continue}case 7:if(58!==e)break;a.workdir=n.string();continue;case 8:if(66!==e)break;a.secretIds.push(n.string());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet5(e.taskId)?globalThis.String(e.taskId):"",containerName:isSet5(e.containerName)?globalThis.String(e.containerName):"",imageId:isSet5(e.imageId)?globalThis.String(e.imageId):"",args:globalThis.Array.isArray(e?.args)?e.args.map((e=>globalThis.String(e))):[],env:isObject3(e.env)?Object.entries(e.env).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{},workdir:isSet5(e.workdir)?globalThis.String(e.workdir):"",secretIds:globalThis.Array.isArray(e?.secretIds)?e.secretIds.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};if(""!==e.taskId&&(t.taskId=e.taskId),""!==e.containerName&&(t.containerName=e.containerName),""!==e.imageId&&(t.imageId=e.imageId),e.args?.length&&(t.args=e.args),e.env){const n=Object.entries(e.env);n.length>0&&(t.env={},n.forEach((([e,n])=>{t.env[e]=n})))}return""!==e.workdir&&(t.workdir=e.workdir),e.secretIds?.length&&(t.secretIds=e.secretIds),t},create:e=>TaskContainerCreateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskContainerCreateRequest();return t.taskId=e.taskId??"",t.containerName=e.containerName??"",t.imageId=e.imageId??"",t.args=e.args?.map((e=>e))||[],t.env=Object.entries(e.env??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t.workdir=e.workdir??"",t.secretIds=e.secretIds?.map((e=>e))||[],t}};function createBaseTaskContainerCreateRequest_EnvEntry(){return{key:"",value:""}}var TaskContainerCreateRequest_EnvEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskContainerCreateRequest_EnvEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet5(e.key)?globalThis.String(e.key):"",value:isSet5(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>TaskContainerCreateRequest_EnvEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskContainerCreateRequest_EnvEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseTaskContainerCreateResponse(){return{containerId:"",containerName:""}}var TaskContainerCreateResponse={encode:(e,t=new BinaryWriter)=>(""!==e.containerId&&t.uint32(10).string(e.containerId),""!==e.containerName&&t.uint32(18).string(e.containerName),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskContainerCreateResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.containerId=n.string();continue;case 2:if(18!==e)break;a.containerName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({containerId:isSet5(e.containerId)?globalThis.String(e.containerId):"",containerName:isSet5(e.containerName)?globalThis.String(e.containerName):""}),toJSON(e){const t={};return""!==e.containerId&&(t.containerId=e.containerId),""!==e.containerName&&(t.containerName=e.containerName),t},create:e=>TaskContainerCreateResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskContainerCreateResponse();return t.containerId=e.containerId??"",t.containerName=e.containerName??"",t}};function createBaseTaskContainerGetRequest(){return{taskId:"",containerName:"",includeTerminated:!1}}var TaskContainerGetRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),""!==e.containerName&&t.uint32(18).string(e.containerName),!1!==e.includeTerminated&&t.uint32(24).bool(e.includeTerminated),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskContainerGetRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.containerName=n.string();continue;case 3:if(24!==e)break;a.includeTerminated=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet5(e.taskId)?globalThis.String(e.taskId):"",containerName:isSet5(e.containerName)?globalThis.String(e.containerName):"",includeTerminated:!!isSet5(e.includeTerminated)&&globalThis.Boolean(e.includeTerminated)}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),""!==e.containerName&&(t.containerName=e.containerName),!1!==e.includeTerminated&&(t.includeTerminated=e.includeTerminated),t},create:e=>TaskContainerGetRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskContainerGetRequest();return t.taskId=e.taskId??"",t.containerName=e.containerName??"",t.includeTerminated=e.includeTerminated??!1,t}};function createBaseTaskContainerGetResponse(){return{container:void 0}}var TaskContainerGetResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.container&&TaskContainerInfo.encode(e.container,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskContainerGetResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.container=TaskContainerInfo.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({container:isSet5(e.container)?TaskContainerInfo.fromJSON(e.container):void 0}),toJSON(e){const t={};return void 0!==e.container&&(t.container=TaskContainerInfo.toJSON(e.container)),t},create:e=>TaskContainerGetResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskContainerGetResponse();return t.container=void 0!==e.container&&null!==e.container?TaskContainerInfo.fromPartial(e.container):void 0,t}};function createBaseTaskContainerInfo(){return{containerId:"",containerName:"",status:"",result:void 0}}var TaskContainerInfo={encode:(e,t=new BinaryWriter)=>(""!==e.containerId&&t.uint32(10).string(e.containerId),""!==e.containerName&&t.uint32(18).string(e.containerName),""!==e.status&&t.uint32(26).string(e.status),void 0!==e.result&&GenericResult.encode(e.result,t.uint32(34).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskContainerInfo();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.containerId=n.string();continue;case 2:if(18!==e)break;a.containerName=n.string();continue;case 3:if(26!==e)break;a.status=n.string();continue;case 4:if(34!==e)break;a.result=GenericResult.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({containerId:isSet5(e.containerId)?globalThis.String(e.containerId):"",containerName:isSet5(e.containerName)?globalThis.String(e.containerName):"",status:isSet5(e.status)?globalThis.String(e.status):"",result:isSet5(e.result)?GenericResult.fromJSON(e.result):void 0}),toJSON(e){const t={};return""!==e.containerId&&(t.containerId=e.containerId),""!==e.containerName&&(t.containerName=e.containerName),""!==e.status&&(t.status=e.status),void 0!==e.result&&(t.result=GenericResult.toJSON(e.result)),t},create:e=>TaskContainerInfo.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskContainerInfo();return t.containerId=e.containerId??"",t.containerName=e.containerName??"",t.status=e.status??"",t.result=void 0!==e.result&&null!==e.result?GenericResult.fromPartial(e.result):void 0,t}};function createBaseTaskContainerListRequest(){return{taskId:"",includeTerminated:!1}}var TaskContainerListRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),!1!==e.includeTerminated&&t.uint32(16).bool(e.includeTerminated),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskContainerListRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(16!==e)break;a.includeTerminated=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet5(e.taskId)?globalThis.String(e.taskId):"",includeTerminated:!!isSet5(e.includeTerminated)&&globalThis.Boolean(e.includeTerminated)}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),!1!==e.includeTerminated&&(t.includeTerminated=e.includeTerminated),t},create:e=>TaskContainerListRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskContainerListRequest();return t.taskId=e.taskId??"",t.includeTerminated=e.includeTerminated??!1,t}};function createBaseTaskContainerListResponse(){return{containers:[]}}var TaskContainerListResponse={encode(e,t=new BinaryWriter){for(const n of e.containers)TaskContainerInfo.encode(n,t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskContainerListResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.containers.push(TaskContainerInfo.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({containers:globalThis.Array.isArray(e?.containers)?e.containers.map((e=>TaskContainerInfo.fromJSON(e))):[]}),toJSON(e){const t={};return e.containers?.length&&(t.containers=e.containers.map((e=>TaskContainerInfo.toJSON(e)))),t},create:e=>TaskContainerListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskContainerListResponse();return t.containers=e.containers?.map((e=>TaskContainerInfo.fromPartial(e)))||[],t}};function createBaseTaskContainerTerminateRequest(){return{taskId:"",containerId:""}}var TaskContainerTerminateRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),""!==e.containerId&&t.uint32(18).string(e.containerId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskContainerTerminateRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.containerId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet5(e.taskId)?globalThis.String(e.taskId):"",containerId:isSet5(e.containerId)?globalThis.String(e.containerId):""}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),""!==e.containerId&&(t.containerId=e.containerId),t},create:e=>TaskContainerTerminateRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskContainerTerminateRequest();return t.taskId=e.taskId??"",t.containerId=e.containerId??"",t}};function createBaseTaskContainerTerminateResponse(){return{}}var TaskContainerTerminateResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskContainerTerminateResponse();for(;n.pos<r;){const e=n.uint32();if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({}),toJSON:e=>({}),create:e=>TaskContainerTerminateResponse.fromPartial(e??{}),fromPartial:e=>createBaseTaskContainerTerminateResponse()};function createBaseTaskContainerWaitRequest(){return{taskId:"",containerId:"",timeout:0}}var TaskContainerWaitRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),""!==e.containerId&&t.uint32(18).string(e.containerId),0!==e.timeout&&t.uint32(29).float(e.timeout),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskContainerWaitRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.containerId=n.string();continue;case 3:if(29!==e)break;a.timeout=n.float();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet5(e.taskId)?globalThis.String(e.taskId):"",containerId:isSet5(e.containerId)?globalThis.String(e.containerId):"",timeout:isSet5(e.timeout)?globalThis.Number(e.timeout):0}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),""!==e.containerId&&(t.containerId=e.containerId),0!==e.timeout&&(t.timeout=e.timeout),t},create:e=>TaskContainerWaitRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskContainerWaitRequest();return t.taskId=e.taskId??"",t.containerId=e.containerId??"",t.timeout=e.timeout??0,t}};function createBaseTaskContainerWaitResponse(){return{result:void 0}}var TaskContainerWaitResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.result&&GenericResult.encode(e.result,t.uint32(10).fork()).join(),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskContainerWaitResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.result=GenericResult.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({result:isSet5(e.result)?GenericResult.fromJSON(e.result):void 0}),toJSON(e){const t={};return void 0!==e.result&&(t.result=GenericResult.toJSON(e.result)),t},create:e=>TaskContainerWaitResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskContainerWaitResponse();return t.result=void 0!==e.result&&null!==e.result?GenericResult.fromPartial(e.result):void 0,t}};function createBaseTaskExecPollRequest(){return{taskId:"",execId:""}}var TaskExecPollRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),""!==e.execId&&t.uint32(18).string(e.execId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskExecPollRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.execId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet5(e.taskId)?globalThis.String(e.taskId):"",execId:isSet5(e.execId)?globalThis.String(e.execId):""}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),""!==e.execId&&(t.execId=e.execId),t},create:e=>TaskExecPollRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskExecPollRequest();return t.taskId=e.taskId??"",t.execId=e.execId??"",t}};function createBaseTaskExecPollResponse(){return{code:void 0,signal:void 0}}var TaskExecPollResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.code&&t.uint32(8).int32(e.code),void 0!==e.signal&&t.uint32(16).int32(e.signal),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskExecPollResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.code=n.int32();continue;case 2:if(16!==e)break;a.signal=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({code:isSet5(e.code)?globalThis.Number(e.code):void 0,signal:isSet5(e.signal)?globalThis.Number(e.signal):void 0}),toJSON(e){const t={};return void 0!==e.code&&(t.code=Math.round(e.code)),void 0!==e.signal&&(t.signal=Math.round(e.signal)),t},create:e=>TaskExecPollResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskExecPollResponse();return t.code=e.code??void 0,t.signal=e.signal??void 0,t}};function createBaseTaskExecStartRequest(){return{taskId:"",execId:"",commandArgs:[],stdoutConfig:0,stderrConfig:0,timeoutSecs:void 0,workdir:void 0,secretIds:[],ptyInfo:void 0,runtimeDebug:!1,containerId:"",env:{}}}var TaskExecStartRequest={encode(e,t=new BinaryWriter){""!==e.taskId&&t.uint32(10).string(e.taskId),""!==e.execId&&t.uint32(18).string(e.execId);for(const n of e.commandArgs)t.uint32(26).string(n);0!==e.stdoutConfig&&t.uint32(32).int32(e.stdoutConfig),0!==e.stderrConfig&&t.uint32(40).int32(e.stderrConfig),void 0!==e.timeoutSecs&&t.uint32(48).uint32(e.timeoutSecs),void 0!==e.workdir&&t.uint32(58).string(e.workdir);for(const n of e.secretIds)t.uint32(66).string(n);return void 0!==e.ptyInfo&&PTYInfo.encode(e.ptyInfo,t.uint32(74).fork()).join(),!1!==e.runtimeDebug&&t.uint32(80).bool(e.runtimeDebug),""!==e.containerId&&t.uint32(90).string(e.containerId),Object.entries(e.env).forEach((([e,n])=>{TaskExecStartRequest_EnvEntry.encode({key:e,value:n},t.uint32(98).fork()).join()})),t},decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskExecStartRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.execId=n.string();continue;case 3:if(26!==e)break;a.commandArgs.push(n.string());continue;case 4:if(32!==e)break;a.stdoutConfig=n.int32();continue;case 5:if(40!==e)break;a.stderrConfig=n.int32();continue;case 6:if(48!==e)break;a.timeoutSecs=n.uint32();continue;case 7:if(58!==e)break;a.workdir=n.string();continue;case 8:if(66!==e)break;a.secretIds.push(n.string());continue;case 9:if(74!==e)break;a.ptyInfo=PTYInfo.decode(n,n.uint32());continue;case 10:if(80!==e)break;a.runtimeDebug=n.bool();continue;case 11:if(90!==e)break;a.containerId=n.string();continue;case 12:{if(98!==e)break;const t=TaskExecStartRequest_EnvEntry.decode(n,n.uint32());void 0!==t.value&&(a.env[t.key]=t.value);continue}}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet5(e.taskId)?globalThis.String(e.taskId):"",execId:isSet5(e.execId)?globalThis.String(e.execId):"",commandArgs:globalThis.Array.isArray(e?.commandArgs)?e.commandArgs.map((e=>globalThis.String(e))):[],stdoutConfig:isSet5(e.stdoutConfig)?taskExecStdoutConfigFromJSON(e.stdoutConfig):0,stderrConfig:isSet5(e.stderrConfig)?taskExecStderrConfigFromJSON(e.stderrConfig):0,timeoutSecs:isSet5(e.timeoutSecs)?globalThis.Number(e.timeoutSecs):void 0,workdir:isSet5(e.workdir)?globalThis.String(e.workdir):void 0,secretIds:globalThis.Array.isArray(e?.secretIds)?e.secretIds.map((e=>globalThis.String(e))):[],ptyInfo:isSet5(e.ptyInfo)?PTYInfo.fromJSON(e.ptyInfo):void 0,runtimeDebug:!!isSet5(e.runtimeDebug)&&globalThis.Boolean(e.runtimeDebug),containerId:isSet5(e.containerId)?globalThis.String(e.containerId):"",env:isObject3(e.env)?Object.entries(e.env).reduce(((e,[t,n])=>(e[t]=String(n),e)),{}):{}}),toJSON(e){const t={};if(""!==e.taskId&&(t.taskId=e.taskId),""!==e.execId&&(t.execId=e.execId),e.commandArgs?.length&&(t.commandArgs=e.commandArgs),0!==e.stdoutConfig&&(t.stdoutConfig=taskExecStdoutConfigToJSON(e.stdoutConfig)),0!==e.stderrConfig&&(t.stderrConfig=taskExecStderrConfigToJSON(e.stderrConfig)),void 0!==e.timeoutSecs&&(t.timeoutSecs=Math.round(e.timeoutSecs)),void 0!==e.workdir&&(t.workdir=e.workdir),e.secretIds?.length&&(t.secretIds=e.secretIds),void 0!==e.ptyInfo&&(t.ptyInfo=PTYInfo.toJSON(e.ptyInfo)),!1!==e.runtimeDebug&&(t.runtimeDebug=e.runtimeDebug),""!==e.containerId&&(t.containerId=e.containerId),e.env){const n=Object.entries(e.env);n.length>0&&(t.env={},n.forEach((([e,n])=>{t.env[e]=n})))}return t},create:e=>TaskExecStartRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskExecStartRequest();return t.taskId=e.taskId??"",t.execId=e.execId??"",t.commandArgs=e.commandArgs?.map((e=>e))||[],t.stdoutConfig=e.stdoutConfig??0,t.stderrConfig=e.stderrConfig??0,t.timeoutSecs=e.timeoutSecs??void 0,t.workdir=e.workdir??void 0,t.secretIds=e.secretIds?.map((e=>e))||[],t.ptyInfo=void 0!==e.ptyInfo&&null!==e.ptyInfo?PTYInfo.fromPartial(e.ptyInfo):void 0,t.runtimeDebug=e.runtimeDebug??!1,t.containerId=e.containerId??"",t.env=Object.entries(e.env??{}).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=globalThis.String(n)),e)),{}),t}};function createBaseTaskExecStartRequest_EnvEntry(){return{key:"",value:""}}var TaskExecStartRequest_EnvEntry={encode:(e,t=new BinaryWriter)=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskExecStartRequest_EnvEntry();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.key=n.string();continue;case 2:if(18!==e)break;a.value=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({key:isSet5(e.key)?globalThis.String(e.key):"",value:isSet5(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>TaskExecStartRequest_EnvEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskExecStartRequest_EnvEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseTaskExecStartResponse(){return{}}var TaskExecStartResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskExecStartResponse();for(;n.pos<r;){const e=n.uint32();if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({}),toJSON:e=>({}),create:e=>TaskExecStartResponse.fromPartial(e??{}),fromPartial:e=>createBaseTaskExecStartResponse()};function createBaseTaskExecStdinWriteRequest(){return{taskId:"",execId:"",offset:0,data:new Uint8Array(0),eof:!1}}var TaskExecStdinWriteRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),""!==e.execId&&t.uint32(18).string(e.execId),0!==e.offset&&t.uint32(24).uint64(e.offset),0!==e.data.length&&t.uint32(34).bytes(e.data),!1!==e.eof&&t.uint32(40).bool(e.eof),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskExecStdinWriteRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.execId=n.string();continue;case 3:if(24!==e)break;a.offset=longToNumber3(n.uint64());continue;case 4:if(34!==e)break;a.data=n.bytes();continue;case 5:if(40!==e)break;a.eof=n.bool();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet5(e.taskId)?globalThis.String(e.taskId):"",execId:isSet5(e.execId)?globalThis.String(e.execId):"",offset:isSet5(e.offset)?globalThis.Number(e.offset):0,data:isSet5(e.data)?bytesFromBase642(e.data):new Uint8Array(0),eof:!!isSet5(e.eof)&&globalThis.Boolean(e.eof)}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),""!==e.execId&&(t.execId=e.execId),0!==e.offset&&(t.offset=Math.round(e.offset)),0!==e.data.length&&(t.data=base64FromBytes2(e.data)),!1!==e.eof&&(t.eof=e.eof),t},create:e=>TaskExecStdinWriteRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskExecStdinWriteRequest();return t.taskId=e.taskId??"",t.execId=e.execId??"",t.offset=e.offset??0,t.data=e.data??new Uint8Array(0),t.eof=e.eof??!1,t}};function createBaseTaskExecStdinWriteResponse(){return{}}var TaskExecStdinWriteResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskExecStdinWriteResponse();for(;n.pos<r;){const e=n.uint32();if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({}),toJSON:e=>({}),create:e=>TaskExecStdinWriteResponse.fromPartial(e??{}),fromPartial:e=>createBaseTaskExecStdinWriteResponse()};function createBaseTaskExecStdioReadRequest(){return{taskId:"",execId:"",offset:0,fileDescriptor:0}}var TaskExecStdioReadRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),""!==e.execId&&t.uint32(18).string(e.execId),0!==e.offset&&t.uint32(24).uint64(e.offset),0!==e.fileDescriptor&&t.uint32(32).int32(e.fileDescriptor),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskExecStdioReadRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.execId=n.string();continue;case 3:if(24!==e)break;a.offset=longToNumber3(n.uint64());continue;case 4:if(32!==e)break;a.fileDescriptor=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet5(e.taskId)?globalThis.String(e.taskId):"",execId:isSet5(e.execId)?globalThis.String(e.execId):"",offset:isSet5(e.offset)?globalThis.Number(e.offset):0,fileDescriptor:isSet5(e.fileDescriptor)?taskExecStdioFileDescriptorFromJSON(e.fileDescriptor):0}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),""!==e.execId&&(t.execId=e.execId),0!==e.offset&&(t.offset=Math.round(e.offset)),0!==e.fileDescriptor&&(t.fileDescriptor=taskExecStdioFileDescriptorToJSON(e.fileDescriptor)),t},create:e=>TaskExecStdioReadRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskExecStdioReadRequest();return t.taskId=e.taskId??"",t.execId=e.execId??"",t.offset=e.offset??0,t.fileDescriptor=e.fileDescriptor??0,t}};function createBaseTaskExecStdioReadResponse(){return{data:new Uint8Array(0)}}var TaskExecStdioReadResponse={encode:(e,t=new BinaryWriter)=>(0!==e.data.length&&t.uint32(10).bytes(e.data),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskExecStdioReadResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.data=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({data:isSet5(e.data)?bytesFromBase642(e.data):new Uint8Array(0)}),toJSON(e){const t={};return 0!==e.data.length&&(t.data=base64FromBytes2(e.data)),t},create:e=>TaskExecStdioReadResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskExecStdioReadResponse();return t.data=e.data??new Uint8Array(0),t}};function createBaseTaskExecWaitRequest(){return{taskId:"",execId:""}}var TaskExecWaitRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),""!==e.execId&&t.uint32(18).string(e.execId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskExecWaitRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.execId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet5(e.taskId)?globalThis.String(e.taskId):"",execId:isSet5(e.execId)?globalThis.String(e.execId):""}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),""!==e.execId&&(t.execId=e.execId),t},create:e=>TaskExecWaitRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskExecWaitRequest();return t.taskId=e.taskId??"",t.execId=e.execId??"",t}};function createBaseTaskExecWaitResponse(){return{code:void 0,signal:void 0}}var TaskExecWaitResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.code&&t.uint32(8).int32(e.code),void 0!==e.signal&&t.uint32(16).int32(e.signal),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskExecWaitResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;a.code=n.int32();continue;case 2:if(16!==e)break;a.signal=n.int32();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({code:isSet5(e.code)?globalThis.Number(e.code):void 0,signal:isSet5(e.signal)?globalThis.Number(e.signal):void 0}),toJSON(e){const t={};return void 0!==e.code&&(t.code=Math.round(e.code)),void 0!==e.signal&&(t.signal=Math.round(e.signal)),t},create:e=>TaskExecWaitResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskExecWaitResponse();return t.code=e.code??void 0,t.signal=e.signal??void 0,t}};function createBaseTaskMountDirectoryRequest(){return{taskId:"",path:new Uint8Array(0),imageId:""}}var TaskMountDirectoryRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),0!==e.path.length&&t.uint32(18).bytes(e.path),""!==e.imageId&&t.uint32(26).string(e.imageId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskMountDirectoryRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.path=n.bytes();continue;case 3:if(26!==e)break;a.imageId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet5(e.taskId)?globalThis.String(e.taskId):"",path:isSet5(e.path)?bytesFromBase642(e.path):new Uint8Array(0),imageId:isSet5(e.imageId)?globalThis.String(e.imageId):""}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),0!==e.path.length&&(t.path=base64FromBytes2(e.path)),""!==e.imageId&&(t.imageId=e.imageId),t},create:e=>TaskMountDirectoryRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskMountDirectoryRequest();return t.taskId=e.taskId??"",t.path=e.path??new Uint8Array(0),t.imageId=e.imageId??"",t}};function createBaseTaskSnapshotDirectoryRequest(){return{taskId:"",path:new Uint8Array(0)}}var TaskSnapshotDirectoryRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),0!==e.path.length&&t.uint32(18).bytes(e.path),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskSnapshotDirectoryRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.path=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet5(e.taskId)?globalThis.String(e.taskId):"",path:isSet5(e.path)?bytesFromBase642(e.path):new Uint8Array(0)}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),0!==e.path.length&&(t.path=base64FromBytes2(e.path)),t},create:e=>TaskSnapshotDirectoryRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskSnapshotDirectoryRequest();return t.taskId=e.taskId??"",t.path=e.path??new Uint8Array(0),t}};function createBaseTaskSnapshotDirectoryResponse(){return{imageId:""}}var TaskSnapshotDirectoryResponse={encode:(e,t=new BinaryWriter)=>(""!==e.imageId&&t.uint32(10).string(e.imageId),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskSnapshotDirectoryResponse();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.imageId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({imageId:isSet5(e.imageId)?globalThis.String(e.imageId):""}),toJSON(e){const t={};return""!==e.imageId&&(t.imageId=e.imageId),t},create:e=>TaskSnapshotDirectoryResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskSnapshotDirectoryResponse();return t.imageId=e.imageId??"",t}};function createBaseTaskUnmountDirectoryRequest(){return{taskId:"",path:new Uint8Array(0)}}var TaskUnmountDirectoryRequest={encode:(e,t=new BinaryWriter)=>(""!==e.taskId&&t.uint32(10).string(e.taskId),0!==e.path.length&&t.uint32(18).bytes(e.path),t),decode(e,t){const n=e instanceof BinaryReader?e:new BinaryReader(e);let r=void 0===t?n.len:n.pos+t;const a=createBaseTaskUnmountDirectoryRequest();for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;a.taskId=n.string();continue;case 2:if(18!==e)break;a.path=n.bytes();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return a},fromJSON:e=>({taskId:isSet5(e.taskId)?globalThis.String(e.taskId):"",path:isSet5(e.path)?bytesFromBase642(e.path):new Uint8Array(0)}),toJSON(e){const t={};return""!==e.taskId&&(t.taskId=e.taskId),0!==e.path.length&&(t.path=base64FromBytes2(e.path)),t},create:e=>TaskUnmountDirectoryRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseTaskUnmountDirectoryRequest();return t.taskId=e.taskId??"",t.path=e.path??new Uint8Array(0),t}},TaskCommandRouterDefinition={name:"TaskCommandRouter",fullName:"modal.task_command_router.TaskCommandRouter",methods:{taskContainerCreate:{name:"TaskContainerCreate",requestType:TaskContainerCreateRequest,requestStream:!1,responseType:TaskContainerCreateResponse,responseStream:!1,options:{}},taskContainerGet:{name:"TaskContainerGet",requestType:TaskContainerGetRequest,requestStream:!1,responseType:TaskContainerGetResponse,responseStream:!1,options:{}},taskContainerList:{name:"TaskContainerList",requestType:TaskContainerListRequest,requestStream:!1,responseType:TaskContainerListResponse,responseStream:!1,options:{}},taskContainerTerminate:{name:"TaskContainerTerminate",requestType:TaskContainerTerminateRequest,requestStream:!1,responseType:TaskContainerTerminateResponse,responseStream:!1,options:{}},taskContainerWait:{name:"TaskContainerWait",requestType:TaskContainerWaitRequest,requestStream:!1,responseType:TaskContainerWaitResponse,responseStream:!1,options:{}},taskExecPoll:{name:"TaskExecPoll",requestType:TaskExecPollRequest,requestStream:!1,responseType:TaskExecPollResponse,responseStream:!1,options:{}},taskExecStart:{name:"TaskExecStart",requestType:TaskExecStartRequest,requestStream:!1,responseType:TaskExecStartResponse,responseStream:!1,options:{}},taskExecStdinWrite:{name:"TaskExecStdinWrite",requestType:TaskExecStdinWriteRequest,requestStream:!1,responseType:TaskExecStdinWriteResponse,responseStream:!1,options:{}},taskExecStdioRead:{name:"TaskExecStdioRead",requestType:TaskExecStdioReadRequest,requestStream:!1,responseType:TaskExecStdioReadResponse,responseStream:!0,options:{}},taskExecWait:{name:"TaskExecWait",requestType:TaskExecWaitRequest,requestStream:!1,responseType:TaskExecWaitResponse,responseStream:!1,options:{}},taskMountDirectory:{name:"TaskMountDirectory",requestType:TaskMountDirectoryRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}},taskSnapshotDirectory:{name:"TaskSnapshotDirectory",requestType:TaskSnapshotDirectoryRequest,requestStream:!1,responseType:TaskSnapshotDirectoryResponse,responseStream:!1,options:{}},taskUnmountDirectory:{name:"TaskUnmountDirectory",requestType:TaskUnmountDirectoryRequest,requestStream:!1,responseType:Empty,responseStream:!1,options:{}}}};function bytesFromBase642(e){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(e,"base64"));{const t=globalThis.atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}}function base64FromBytes2(e){if(globalThis.Buffer)return globalThis.Buffer.from(e).toString("base64");{const t=[];return e.forEach((e=>{t.push(globalThis.String.fromCharCode(e))})),globalThis.btoa(t.join(""))}}function longToNumber3(e){const t=globalThis.Number(e.toString());if(t>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<globalThis.Number.MIN_SAFE_INTEGER)throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}function isObject3(e){return"object"==typeof e&&null!==e}function isSet5(e){return null!=e}import{setTimeout as setTimeout2}from"timers/promises";import{ClientError as ClientError7,ChannelCredentials,createChannel,createClientFactory,Metadata,Status as Status7}from"nice-grpc";import{readFileSync}from"node:fs";import{homedir}from"node:os";import path from"node:path";import{parse as parseToml}from"smol-toml";function isLocalhost(e){const t=new URL(e.serverUrl).hostname;return"localhost"===t||"127.0.0.1"===t||"::1"===t||"172.21.0.1"===t}function configFilePath(){const e=process.env.MODAL_CONFIG_PATH;return e&&""!==e?e:path.join(homedir(),".modal.toml")}function readConfigFile(){try{const e=configFilePath(),t=readFileSync(e,{encoding:"utf-8"});return parseToml(t)}catch(e){return e.code,{}}}var config=readConfigFile();function getProfile(e){if(!e)for(const[t,n]of Object.entries(config))if(n.active){e=t;break}const t=e&&Object.hasOwn(config,e)?config[e]:{};return{serverUrl:process.env.MODAL_SERVER_URL||t.server_url||"https://api.modal.com:443",tokenId:process.env.MODAL_TOKEN_ID||t.token_id,tokenSecret:process.env.MODAL_TOKEN_SECRET||t.token_secret,environment:process.env.MODAL_ENVIRONMENT||t.environment,imageBuilderVersion:process.env.MODAL_IMAGE_BUILDER_VERSION||t.imageBuilderVersion,logLevel:process.env.MODAL_LOGLEVEL||t.loglevel}}function parseJwtExpiration(e,t){try{const t=e.split(".");if(3!==t.length)return null;const n=t[1],r="=".repeat((4-n.length%4)%4),a=Buffer.from(n+r,"base64").toString("utf8"),o=JSON.parse(a).exp;if("number"==typeof o)return o}catch(e){t.warn("Failed to parse JWT expiration","error",e)}return null}async function callWithRetriesOnTransientErrors(e,t=10,n=2,r=10,a=null,o){let i=t,s=0;const u=new Set([Status7.DEADLINE_EXCEEDED,Status7.UNAVAILABLE,Status7.CANCELLED,Status7.INTERNAL,Status7.UNKNOWN]);for(;;){if(null!==a&&Date.now()>=a)throw new Error("Deadline exceeded");try{return await e()}catch(e){if(e instanceof ClientError7&&e.code===Status7.CANCELLED&&o?.())throw new ClientClosedError;if(!(e instanceof ClientError7&&u.has(e.code)&&(null===r||s<r)))throw e;if(null!==a&&Date.now()+i>=a)throw new Error("Deadline exceeded");await setTimeout2(i),i*=n,s++}}}var TaskCommandRouterClientImpl=class e{stub;channel;serverClient;taskId;serverUrl;jwt;jwtExp;jwtRefreshLock=Promise.resolve();logger;closed=!1;static async tryInit(t,n,r,a){let o;try{o=await t.taskGetCommandRouterAccess(TaskGetCommandRouterAccessRequest.create({taskId:n}))}catch(e){if(e instanceof ClientError7&&e.code===Status7.FAILED_PRECONDITION)return r.debug("Command router access is not enabled for task","task_id",n),null;throw e}r.debug("Using command router access for task","task_id",n,"url",o.url);const i=new URL(o.url);if("https:"!==i.protocol)throw new Error(`Task router URL must be https, got: ${o.url}`);const s=`${i.hostname}:${i.port?parseInt(i.port):443}`,u={"grpc.max_receive_message_length":104857600,"grpc.max_send_message_length":104857600,"grpc-node.flow_control_window":67108864,"grpc.keepalive_time_ms":3e4,"grpc.keepalive_timeout_ms":1e4,"grpc.keepalive_permit_without_calls":1};let c;isLocalhost(a)?(r.warn("Using insecure TLS (skip certificate verification) for task command router"),c=createChannel(s,ChannelCredentials.createInsecure(),u)):c=createChannel(s,ChannelCredentials.createSsl(),u);const d=new e(t,n,o.url,o.jwt,c,r);return r.debug("Successfully initialized command router client","task_id",n),d}constructor(e,t,n,r,a,o){this.serverClient=e,this.taskId=t,this.serverUrl=n,this.jwt=r,this.jwtExp=parseJwtExpiration(r,o),this.logger=o,this.channel=a;const i=this,s=createClientFactory().use(timeoutMiddleware).use((async function*(e,t){return t.metadata??=new Metadata,t.metadata.set("authorization",`Bearer ${i.jwt}`),yield*e.next(e.request,t)}));this.stub=s.create(TaskCommandRouterDefinition,a)}close(){this.closed||(this.closed=!0,this.channel.close())}async execStart(e){return await callWithRetriesOnTransientErrors((()=>this.callWithAuthRetry((()=>this.stub.taskExecStart(e)))),10,2,10,null,(()=>this.closed))}async*execStdioRead(e,t,n,r=null){let a;if(1===n)a=0;else{if(2!==n)throw 3===n||0===n?new Error(`Unsupported file descriptor: ${n}`):new Error(`Invalid file descriptor: ${n}`);a=1}yield*this.streamStdio(e,t,a,r)}async execStdinWrite(e,t,n,r,a){const o=TaskExecStdinWriteRequest.create({taskId:e,execId:t,offset:n,data:r,eof:a});return await callWithRetriesOnTransientErrors((()=>this.callWithAuthRetry((()=>this.stub.taskExecStdinWrite(o)))),10,2,10,null,(()=>this.closed))}async execPoll(e,t,n=null){const r=TaskExecPollRequest.create({taskId:e,execId:t});if(n&&n<=Date.now())throw new Error(`Deadline exceeded while polling for exec ${t}`);try{return await callWithRetriesOnTransientErrors((()=>this.callWithAuthRetry((()=>this.stub.taskExecPoll(r)))),10,2,10,n,(()=>this.closed))}catch(e){if(e instanceof ClientError7&&e.code===Status7.DEADLINE_EXCEEDED)throw new Error(`Deadline exceeded while polling for exec ${t}`);throw e}}async execWait(e,t,n=null){const r=TaskExecWaitRequest.create({taskId:e,execId:t});if(n&&n<=Date.now())throw new Error(`Deadline exceeded while waiting for exec ${t}`);try{return await callWithRetriesOnTransientErrors((()=>this.callWithAuthRetry((()=>this.stub.taskExecWait(r,{timeoutMs:6e4})))),1e3,1,null,n,(()=>this.closed))}catch(e){if(e instanceof ClientError7&&e.code===Status7.DEADLINE_EXCEEDED)throw new Error(`Deadline exceeded while waiting for exec ${t}`);throw e}}async mountDirectory(e){await callWithRetriesOnTransientErrors((()=>this.callWithAuthRetry((()=>this.stub.taskMountDirectory(e)))),10,2,10,null,(()=>this.closed))}async snapshotDirectory(e){return await callWithRetriesOnTransientErrors((()=>this.callWithAuthRetry((()=>this.stub.taskSnapshotDirectory(e)))),10,2,10,null,(()=>this.closed))}async refreshJwt(){let e;if(this.jwtRefreshLock=this.jwtRefreshLock.then((async()=>{if(!this.closed)if(null!==this.jwtExp&&this.jwtExp-Date.now()/1e3>30)this.logger.debug("Skipping JWT refresh because expiration is far enough in the future","task_id",this.taskId);else try{const e=await this.serverClient.taskGetCommandRouterAccess(TaskGetCommandRouterAccessRequest.create({taskId:this.taskId}));if(e.url!==this.serverUrl)throw new Error("Task router URL changed during session");this.jwt=e.jwt,this.jwtExp=parseJwtExpiration(e.jwt,this.logger)}catch(t){e=t}})),await this.jwtRefreshLock,e)throw e}async callWithAuthRetry(e){try{return await e()}catch(t){if(t instanceof ClientError7&&t.code===Status7.UNAUTHENTICATED)return await this.refreshJwt(),await e();throw t}}async*streamStdio(e,t,n,r){let a=0,o=10;let i=10,s=!1;const u=new Set([Status7.DEADLINE_EXCEEDED,Status7.UNAVAILABLE,Status7.CANCELLED,Status7.INTERNAL,Status7.UNKNOWN]);for(;;)try{const i=null!==r?Math.max(0,r-Date.now()):void 0,u=TaskExecStdioReadRequest.create({taskId:e,execId:t,offset:a,fileDescriptor:n}),c=this.stub.taskExecStdioRead(u,{timeoutMs:i});try{for await(const e of c)s&&(s=!1),o=10,a+=e.data.length,yield e;return}catch(e){if(e instanceof ClientError7&&e.code===Status7.UNAUTHENTICATED&&!s){await this.refreshJwt(),s=!0;continue}throw e}}catch(e){if(e instanceof ClientError7&&e.code===Status7.CANCELLED&&this.closed)throw new ClientClosedError;if(!(e instanceof ClientError7&&u.has(e.code)&&i>0))throw e;if(r&&r-Date.now()<=o)throw new Error(`Deadline exceeded while streaming stdio for exec ${t}`);this.logger.debug("Retrying stdio read with delay","delay_ms",o,"error",e),await setTimeout2(o),o*=2,i--}}};import{v4 as uuidv4}from"uuid";var SandboxFile=class{#e;#k;#v;constructor(e,t,n){this.#e=e,this.#k=t,this.#v=n}async read(){const e=(await runFilesystemExec(this.#e.cpClient,{fileReadRequest:{fileDescriptor:this.#k},taskId:this.#v})).chunks,t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return n}async write(e){await runFilesystemExec(this.#e.cpClient,{fileWriteRequest:{fileDescriptor:this.#k,data:e},taskId:this.#v})}async flush(){await runFilesystemExec(this.#e.cpClient,{fileFlushRequest:{fileDescriptor:this.#k},taskId:this.#v})}async close(){await runFilesystemExec(this.#e.cpClient,{fileCloseRequest:{fileDescriptor:this.#k},taskId:this.#v})}};async function runFilesystemExec(e,t){const n=await e.containerFilesystemExec(t),r=[];let a=10,o=!1;for(;!o;)try{const t=e.containerFilesystemExecGetOutput({execId:n.execId,timeout:55});for await(const e of t){if(r.push(...e.output),e.eof){o=!0;break}if(void 0!==e.error){if(a>0){a--;break}throw new SandboxFilesystemError(e.error.errorMessage)}}}catch(e){if(!(isRetryableGrpc(e)&&a>0))throw e;a--}return{chunks:r,response:n}}function toModalReadStream(e){return Object.assign(e,readMixin)}function toModalWriteStream(e){return Object.assign(e,writeMixin)}var readMixin={async readText(){const e=this.getReader();try{const t=new TextDecoder("utf-8"),n=[];for(;;){const{value:r,done:a}=await e.read();if(r&&("string"==typeof r?n.push(r):n.push(t.decode(r.buffer,{stream:!0}))),a){n.push(t.decode(void 0,{stream:!1}));break}}return n.join("")}finally{e.releaseLock()}},async readBytes(){const e=[],t=this.getReader();try{for(;;){const{value:n,done:r}=await t.read();if(n&&("string"==typeof n?e.push((new TextEncoder).encode(n)):e.push(n)),r)break}}finally{t.releaseLock()}let n=0;for(const t of e)n+=t.length;const r=new Uint8Array(n);let a=0;for(const t of e)r.set(t,a),a+=t.length;return r}},writeMixin={async writeText(e){const t=this.getWriter();try{await t.write(e)}finally{t.releaseLock()}},async writeBytes(e){const t=this.getWriter();try{await t.write(e)}finally{t.releaseLock()}}};function streamConsumingIter(e,t){const n=e[Symbol.asyncIterator]();return new ReadableStream({async pull(e){const{done:t,value:r}=await n.next();r&&e.enqueue(r),t&&e.close()},async cancel(){try{t?.()}finally{"function"==typeof n.return&&await n.return()}}},new ByteLengthQueuingStrategy({highWaterMark:65536}))}var SB_LOGS_INITIAL_DELAY_MS=10,SB_LOGS_DELAY_FACTOR=2,SB_LOGS_MAX_RETRIES=10,Probe2=class e{#R;#T;#N;constructor(e){const{tcpPort:t,execArgv:n,intervalMs:r}=e;if(void 0===t==(void 0===n))throw new InvalidError("Probe must be created with Probe.withTcp(...) or Probe.withExec(...)");this.#R=t,this.#T=n,this.#N=r}static withTcp(t,n={intervalMs:100}){if(!Number.isInteger(t))throw new InvalidError("Probe.withTcp() expects an integer `port`");if(t<=0||t>65535)throw new InvalidError(`Probe.withTcp() expects \`port\` in [1, 65535], got ${t}`);const{intervalMs:r}=n;return e.#B("Probe.withTcp",r),new e({tcpPort:t,intervalMs:r})}static withExec(t,n={intervalMs:100}){if(!Array.isArray(t)||0===t.length)throw new InvalidError("Probe.withExec() requires at least one argument");if(!t.every((e=>"string"==typeof e)))throw new InvalidError("Probe.withExec() expects all arguments to be strings");const{intervalMs:r}=n;return e.#B("Probe.withExec",r),new e({execArgv:[...t],intervalMs:r})}toProto(){if(void 0!==this.#R)return Probe.create({tcpPort:this.#R,intervalMs:this.#N});if(void 0!==this.#T)return Probe.create({execCommand:{argv:this.#T},intervalMs:this.#N});throw new InvalidError("Probe must be created with Probe.withTcp(...) or Probe.withExec(...)")}static#B(e,t){if(!Number.isInteger(t))throw new InvalidError(`${e}() expects an integer \`intervalMs\``);if(t<=0)throw new InvalidError(`${e}() expects \`intervalMs\` > 0, got ${t}`)}};async function buildSandboxCreateRequestProto(e,t,n={}){checkForRenamedParams(n,{memory:"memoryMiB",memoryLimit:"memoryLimitMiB",timeout:"timeoutMs",idleTimeout:"idleTimeoutMs"});const r=parseGpuConfig(n.gpu);if(null!=n.timeoutMs&&n.timeoutMs<=0)throw new Error(`timeoutMs must be positive, got ${n.timeoutMs}`);if(n.timeoutMs&&n.timeoutMs%1e3!=0)throw new Error(`timeoutMs must be a multiple of 1000ms, got ${n.timeoutMs}`);if(null!=n.idleTimeoutMs&&n.idleTimeoutMs<=0)throw new Error(`idleTimeoutMs must be positive, got ${n.idleTimeoutMs}`);if(n.idleTimeoutMs&&n.idleTimeoutMs%1e3!=0)throw new Error(`idleTimeoutMs must be a multiple of 1000ms, got ${n.idleTimeoutMs}`);if(n.workdir&&!n.workdir.startsWith("/"))throw new Error(`workdir must be an absolute path, got: ${n.workdir}`);const a=n.volumes?Object.entries(n.volumes).map((([e,t])=>({volumeId:t.volumeId,mountPath:e,allowBackgroundCommits:!0,readOnly:t.isReadOnly}))):[],o=n.cloudBucketMounts?Object.entries(n.cloudBucketMounts).map((([e,t])=>t.toProto(e))):[],i=[];n.encryptedPorts&&i.push(...n.encryptedPorts.map((e=>PortSpec.create({port:e,unencrypted:!1})))),n.h2Ports&&i.push(...n.h2Ports.map((e=>PortSpec.create({port:e,unencrypted:!1,tunnelType:1})))),n.unencryptedPorts&&i.push(...n.unencryptedPorts.map((e=>PortSpec.create({port:e,unencrypted:!0}))));const s=(n.secrets||[]).map((e=>e.secretId));let u;if(n.blockNetwork){if(n.cidrAllowlist)throw new Error("cidrAllowlist cannot be used when blockNetwork is enabled");u={networkAccessType:2,allowedCidrs:[]}}else u=n.cidrAllowlist?{networkAccessType:3,allowedCidrs:n.cidrAllowlist}:{networkAccessType:1,allowedCidrs:[]};const c=n.regions?.length?SchedulerPlacement.create({regions:n.regions}):void 0;let d,l,p,m,f;if(n.pty&&(d=defaultSandboxPTYInfo()),void 0===n.cpu&&void 0!==n.cpuLimit)throw new Error("must also specify cpu when cpuLimit is specified");if(void 0!==n.cpu){if(n.cpu<=0)throw new Error(`cpu (${n.cpu}) must be a positive number`);if(l=Math.trunc(1e3*n.cpu),void 0!==n.cpuLimit){if(n.cpuLimit<n.cpu)throw new Error(`cpu (${n.cpu}) cannot be higher than cpuLimit (${n.cpuLimit})`);p=Math.trunc(1e3*n.cpuLimit)}}if(void 0===n.memoryMiB&&void 0!==n.memoryLimitMiB)throw new Error("must also specify memoryMiB when memoryLimitMiB is specified");if(void 0!==n.memoryMiB){if(n.memoryMiB<=0)throw new Error(`the memoryMiB request (${n.memoryMiB}) must be a positive number`);if(m=n.memoryMiB,void 0!==n.memoryLimitMiB){if(n.memoryLimitMiB<n.memoryMiB)throw new Error(`the memoryMiB request (${n.memoryMiB}) cannot be higher than memoryLimitMiB (${n.memoryLimitMiB})`);f=n.memoryLimitMiB}}const b=n.experimentalOptions?Object.entries(n.experimentalOptions).reduce(((e,[t,n])=>{if("boolean"!=typeof n)throw new Error(`experimental option '${t}' must be a boolean, got ${n}`);return e[t]=Boolean(n),e}),{}):{};return SandboxCreateRequest.create({appId:e,definition:{entrypointArgs:n.command??[],imageId:t,timeoutSecs:null!=n.timeoutMs?n.timeoutMs/1e3:300,idleTimeoutSecs:null!=n.idleTimeoutMs?n.idleTimeoutMs/1e3:void 0,workdir:n.workdir??void 0,networkAccess:u,resources:Resources.create({milliCpu:l,milliCpuMax:p,memoryMb:m,memoryMbMax:f,gpuConfig:r}),volumeMounts:a,cloudBucketMounts:o,ptyInfo:d,secretIds:s,openPorts:PortSpecs.create({ports:i}),cloudProviderStr:n.cloud??"",schedulerPlacement:c,verbose:n.verbose??!1,proxyId:n.proxy?.proxyId,readinessProbe:n.readinessProbe?.toProto(),name:n.name,experimentalOptions:b,customDomain:n.customDomain,includeOidcIdentityToken:n.includeOidcIdentityToken??!1}})}var SandboxService=class{#e;constructor(e){this.#e=e}async create(e,t,n={}){await t.build(e);const r=await mergeEnvIntoSecrets(this.#e,n.env,n.secrets),a={...n,secrets:r,env:void 0},o=await buildSandboxCreateRequestProto(e.appId,t.imageId,a);let i;try{i=await this.#e.cpClient.sandboxCreate(o)}catch(e){if(e instanceof ClientError8&&e.code===Status8.ALREADY_EXISTS)throw new AlreadyExistsError(e.details||e.message);throw e}return this.#e.logger.debug("Created Sandbox","sandbox_id",i.sandboxId),new Sandbox2(this.#e,i.sandboxId)}async fromId(e){try{await this.#e.cpClient.sandboxWait({sandboxId:e,timeout:0})}catch(t){if(t instanceof ClientError8&&t.code===Status8.NOT_FOUND)throw new NotFoundError(`Sandbox with id: '${e}' not found`);throw t}return new Sandbox2(this.#e,e)}async fromName(e,t,n){try{const r=await this.#e.cpClient.sandboxGetFromName({sandboxName:t,appName:e,environmentName:this.#e.environmentName(n?.environment)});return new Sandbox2(this.#e,r.sandboxId)}catch(n){if(n instanceof ClientError8&&n.code===Status8.NOT_FOUND)throw new NotFoundError(`Sandbox with name '${t}' not found in App '${e}'`);throw n}}async*list(e={}){const t=this.#e.environmentName(e.environment),n=e.tags?Object.entries(e.tags).map((([e,t])=>({tagName:e,tagValue:t}))):[];let r;for(;;)try{const a=await this.#e.cpClient.sandboxList({appId:e.appId,beforeTimestamp:r,environmentName:t,includeFinished:!1,tags:n});if(!a.sandboxes||0===a.sandboxes.length)return;for(const e of a.sandboxes)yield new Sandbox2(this.#e,e.id);r=a.sandboxes[a.sandboxes.length-1].createdAt}catch(e){if(e instanceof ClientError8&&e.code===Status8.INVALID_ARGUMENT)throw new InvalidError(e.details||e.message);throw e}}},Tunnel=class{constructor(e,t,n,r){this.host=e,this.port=t,this.unencryptedHost=n,this.unencryptedPort=r}get url(){let e=`https://${this.host}`;return 443!==this.port&&(e+=`:${this.port}`),e}get tlsSocket(){return[this.host,this.port]}get tcpSocket(){if(!this.unencryptedHost||void 0===this.unencryptedPort)throw new InvalidError("This tunnel is not configured for unencrypted TCP.");return[this.unencryptedHost,this.unencryptedPort]}};function defaultSandboxPTYInfo(){return PTYInfo.create({enabled:!0,winszRows:24,winszCols:80,envTerm:"xterm-256color",envColorterm:"truecolor",envTermProgram:"",ptyType:2,noTerminateOnIdleStdin:!0})}function validateExecArgs(e){const t=e.reduce(((e,t)=>e+t.length),0);if(t>65536)throw new InvalidError(`Total length of CMD arguments must be less than 65536 bytes (ARG_MAX). Got ${t} bytes.`)}function buildTaskExecStartRequestProto(e,t,n,r){if(checkForRenamedParams(r,{timeout:"timeoutMs"}),null!=r?.timeoutMs&&r.timeoutMs<=0)throw new Error(`timeoutMs must be positive, got ${r.timeoutMs}`);if(r?.timeoutMs&&r.timeoutMs%1e3!=0)throw new Error(`timeoutMs must be a multiple of 1000ms, got ${r.timeoutMs}`);const a=(r?.secrets||[]).map((e=>e.secretId)),o=r?.stdout??"pipe",i=r?.stderr??"pipe";let s,u,c;if("pipe"===o)s=1;else{if("ignore"!==o)throw new Error(`Unsupported stdout behavior: ${o}`);s=0}if("pipe"===i)u=1;else{if("ignore"!==i)throw new Error(`Unsupported stderr behavior: ${i}`);u=0}return r?.pty&&(c=defaultSandboxPTYInfo()),TaskExecStartRequest.create({taskId:e,execId:t,commandArgs:n,stdoutConfig:s,stderrConfig:u,timeoutSecs:r?.timeoutMs?r.timeoutMs/1e3:void 0,workdir:r?.workdir,secretIds:a,ptyInfo:c,runtimeDebug:!1})}var Sandbox2=class e{#e;sandboxId;#C;#w;#O;#P;#x;#v;#E;#F;#A;#q=!0;constructor(e,t){this.#e=e,this.sandboxId=t}get stdin(){return this.#C||(this.#C=toModalWriteStream(inputStreamSb(this.#e.cpClient,this.sandboxId))),this.#C}get stdout(){if(!this.#w){this.#P=new AbortController;const e=streamConsumingIter(outputStreamSb(this.#e.cpClient,this.sandboxId,1,this.#P.signal),(()=>this.#P?.abort()));this.#w=toModalReadStream(e.pipeThrough(new TextDecoderStream))}return this.#w}get stderr(){if(!this.#O){this.#x=new AbortController;const e=streamConsumingIter(outputStreamSb(this.#e.cpClient,this.sandboxId,2,this.#x.signal),(()=>this.#x?.abort()));this.#O=toModalReadStream(e.pipeThrough(new TextDecoderStream))}return this.#O}async setTags(e){this.#M();const t=Object.entries(e).map((([e,t])=>({tagName:e,tagValue:t})));try{await this.#e.cpClient.sandboxTagsSet({environmentName:this.#e.environmentName(),sandboxId:this.sandboxId,tags:t})}catch(e){if(e instanceof ClientError8&&e.code===Status8.INVALID_ARGUMENT)throw new InvalidError(e.details||e.message);throw e}}async getTags(){let e;this.#M();try{e=await this.#e.cpClient.sandboxTagsGet({sandboxId:this.sandboxId})}catch(e){if(e instanceof ClientError8&&e.code===Status8.INVALID_ARGUMENT)throw new InvalidError(e.details||e.message);throw e}const t={};for(const n of e.tags)t[n.tagName]=n.tagValue;return t}static async fromId(e){return getDefaultClient().sandboxes.fromId(e)}static async fromName(e,t,n){return getDefaultClient().sandboxes.fromName(e,t,{environment:n})}async open(e,t="r"){this.#M();const n=await this.#D(),r=(await runFilesystemExec(this.#e.cpClient,{fileOpenRequest:{path:e,mode:t},taskId:n})).response.fileDescriptor;return new SandboxFile(this.#e,r,n)}async exec(e,t){this.#M(),validateExecArgs(e);const n=await this.#D(),r=await mergeEnvIntoSecrets(this.#e,t?.env,t?.secrets),a={...t,secrets:r,env:void 0},o=await this.#J(n),i=uuidv4(),s=buildTaskExecStartRequestProto(n,i,e,a);await o.execStart(s),this.#e.logger.debug("Created ContainerProcess","exec_id",i,"sandbox_id",this.sandboxId,"command",e);const u=a?.timeoutMs?Date.now()+a.timeoutMs:null;return new ContainerProcess(n,i,o,a,u)}#M(){if(!this.#q)throw new ClientClosedError}static#_=600;async#D(){if(void 0!==this.#v)return this.#v;for(let t=0;t<e.#_;t++){const e=await this.#e.cpClient.sandboxGetTaskId({sandboxId:this.sandboxId});if(e.taskResult){if(1===e.taskResult.status||!e.taskResult.exception)throw new Error(`Sandbox ${this.sandboxId} has already completed`);throw new Error(`Sandbox ${this.sandboxId} has already completed with result: exception:"${e.taskResult.exception}"`)}if(e.taskId)return this.#v=e.taskId,this.#v;await setTimeout3(500)}throw new Error(`Timed out waiting for task ID for Sandbox ${this.sandboxId}`)}async#J(e){if(void 0!==this.#F)return this.#F;if(void 0!==this.#A)return this.#A;const t=(async()=>{const t=await TaskCommandRouterClientImpl.tryInit(this.#e.cpClient,e,this.#e.logger,this.#e.profile);if(!t)throw new Error("Command router access is not available for this sandbox");if(!this.#q)throw t.close(),new ClientClosedError;return this.#F=t,t})();this.#A=t;try{return await t}catch(e){throw this.#A===t&&(this.#A=void 0),e}}async createConnectToken(e){this.#M();const t=await this.#e.cpClient.sandboxCreateConnectToken({sandboxId:this.sandboxId,userMetadata:e?.userMetadata});return{url:t.url,token:t.token}}async terminate(e){let t;return this.#M(),await this.#e.cpClient.sandboxTerminate({sandboxId:this.sandboxId}),e?.wait&&(t=await this.wait()),this.#v=void 0,this.detach(),t}detach(){this.#F?.close(),this.#q=!1,this.#F=void 0,this.#A=void 0}async wait(){for(;;){const t=await this.#e.cpClient.sandboxWait({sandboxId:this.sandboxId,timeout:10});if(t.result){const n=e.#L(t.result);return this.#e.logger.debug("Sandbox wait completed","sandbox_id",this.sandboxId,"status",t.result.status,"return_code",n),n}}}async waitUntilReady(e=3e5){if(this.#M(),e<=0)throw new InvalidError(`timeoutMs must be positive, got ${e}`);const t=Date.now()+e;for(;;){const e=t-Date.now();if(e<=0)throw new TimeoutError("Sandbox operation timed out");const n=Math.min(e,5e4);try{if((await this.#e.cpClient.sandboxWaitUntilReady({sandboxId:this.sandboxId,timeout:n/1e3})).readyAt>0)return}catch(e){if(e instanceof ClientError8&&e.code===Status8.DEADLINE_EXCEEDED)continue;throw e}}}async tunnels(e=5e4){if(this.#M(),this.#E)return this.#E;const t=await this.#e.cpClient.sandboxGetTunnels({sandboxId:this.sandboxId,timeout:e/1e3});if(4===t.result?.status)throw new SandboxTimeoutError;this.#E={};for(const e of t.tunnels)this.#E[e.containerPort]=new Tunnel(e.host,e.port,e.unencryptedHost,e.unencryptedPort);return this.#E}async snapshotFilesystem(e=55e3){this.#M();const t=await this.#e.cpClient.sandboxSnapshotFs({sandboxId:this.sandboxId,timeout:e/1e3});if(1!==t.result?.status)throw new Error(`Sandbox snapshot failed: ${t.result?.exception||"Unknown error"}`);if(!t.imageId)throw new Error("Sandbox snapshot response missing `imageId`");return new Image2(this.#e,t.imageId,"")}async mountImage(e,t){this.#M();const n=await this.#D(),r=await this.#J(n);if(t&&!t.imageId)throw new Error("Image must be built before mounting. Call `image.build(app)` first.");const a=(new TextEncoder).encode(e),o=t?.imageId??"",i=TaskMountDirectoryRequest.create({taskId:n,path:a,imageId:o});await r.mountDirectory(i)}async snapshotDirectory(e){this.#M();const t=await this.#D(),n=await this.#J(t),r=(new TextEncoder).encode(e),a=TaskSnapshotDirectoryRequest.create({taskId:t,path:r}),o=await n.snapshotDirectory(a);if(!o.imageId)throw new Error("Sandbox snapshot directory response missing `imageId`");return new Image2(this.#e,o.imageId,"")}async poll(){this.#M();const t=await this.#e.cpClient.sandboxWait({sandboxId:this.sandboxId,timeout:0});return e.#L(t.result)}static async*list(e={}){yield*getDefaultClient().sandboxes.list(e)}static#L(e){return void 0===e||0===e.status?null:4===e.status?124:3===e.status?137:e.exitcode}},ContainerProcess=class{stdin;stdout;stderr;#v;#G;#F;#U;constructor(e,t,n,r,a){this.#v=e,this.#G=t,this.#F=n,this.#U=a??null;const o=r?.mode??"text",i=r?.stdout??"pipe",s=r?.stderr??"pipe";this.stdin=toModalWriteStream(inputStreamCp(n,e,t));const u="ignore"===i?ReadableStream.from([]):streamConsumingIter(outputStreamCp(n,e,t,1,this.#U)),c="ignore"===s?ReadableStream.from([]):streamConsumingIter(outputStreamCp(n,e,t,2,this.#U));"text"===o?(this.stdout=toModalReadStream(u.pipeThrough(new TextDecoderStream)),this.stderr=toModalReadStream(c.pipeThrough(new TextDecoderStream))):(this.stdout=toModalReadStream(u),this.stderr=toModalReadStream(c))}async wait(){const e=await this.#F.execWait(this.#v,this.#G,this.#U);if(void 0!==e.code)return e.code;if(void 0!==e.signal)return 128+e.signal;throw new InvalidError("Unexpected exit status")}};async function*outputStreamSb(e,t,n,r){let a="0-0",o=!1,i=SB_LOGS_MAX_RETRIES,s=SB_LOGS_INITIAL_DELAY_MS;for(;!o;)try{const u=e.sandboxGetLogs({sandboxId:t,fileDescriptor:n,timeout:55,lastEntryId:a},{signal:r});for await(const e of u){if(s=SB_LOGS_INITIAL_DELAY_MS,i=SB_LOGS_MAX_RETRIES,a=e.entryId,yield*e.items.map((e=>(new TextEncoder).encode(e.data))),e.eof){o=!0;break}if(r?.aborted)return}}catch(e){if(r?.aborted)return;if(isRetryableGrpc(e)&&i>0){try{await setTimeout3(s,void 0,{signal:r})}catch{return}s*=SB_LOGS_DELAY_FACTOR,i--;continue}throw e}}function inputStreamSb(e,t){let n=1;return new WritableStream({async write(r){await e.sandboxStdinWrite({sandboxId:t,input:encodeIfString(r),index:n}),n++},async close(){await e.sandboxStdinWrite({sandboxId:t,index:n,eof:!0})}})}async function*outputStreamCp(e,t,n,r,a){for await(const o of e.execStdioRead(t,n,r,a))yield o.data}function inputStreamCp(e,t,n){let r=0;return new WritableStream({async write(a){const o=encodeIfString(a);await e.execStdinWrite(t,n,r,o,!1),r+=o.length},async close(){await e.execStdinWrite(t,n,r,new Uint8Array(0),!0)}})}function encodeIfString(e){return"string"==typeof e?(new TextEncoder).encode(e):e}import{ClientError as ClientError9,Status as Status9}from"nice-grpc";var VolumeService=class{#e;constructor(e){this.#e=e}async fromName(e,t){try{const n=await this.#e.cpClient.volumeGetOrCreate({deploymentName:e,environmentName:this.#e.environmentName(t?.environment),objectCreationType:t?.createIfMissing?1:0});return this.#e.logger.debug("Retrieved Volume","volume_id",n.volumeId,"volume_name",e),new Volume(n.volumeId,e)}catch(e){if(e instanceof ClientError9&&e.code===Status9.NOT_FOUND)throw new NotFoundError(e.details);throw e}}async ephemeral(e={}){const t=await this.#e.cpClient.volumeGetOrCreate({objectCreationType:5,environmentName:this.#e.environmentName(e.environment)});this.#e.logger.debug("Created ephemeral Volume","volume_id",t.volumeId);const n=new EphemeralHeartbeatManager((()=>this.#e.cpClient.volumeHeartbeat({volumeId:t.volumeId})));return new Volume(t.volumeId,void 0,!1,n)}async delete(e,t){try{const n=await this.fromName(e,{environment:t?.environment,createIfMissing:!1});await this.#e.cpClient.volumeDelete({volumeId:n.volumeId}),this.#e.logger.debug("Deleted Volume","volume_name",e,"volume_id",n.volumeId)}catch(e){if((e instanceof NotFoundError||e instanceof ClientError9&&e.code===Status9.NOT_FOUND)&&t?.allowMissing)return;throw e}}},Volume=class e{volumeId;name;_readOnly=!1;#I;constructor(e,t,n=!1,r){this.volumeId=e,this.name=t,this._readOnly=n,this.#I=r}static async fromName(e,t){return getDefaultClient().volumes.fromName(e,t)}readOnly(){return new e(this.volumeId,this.name,!0,this.#I)}get isReadOnly(){return this._readOnly}static async ephemeral(e={}){return getDefaultClient().volumes.ephemeral(e)}closeEphemeral(){if(!this.#I)throw new InvalidError("Volume is not ephemeral.");this.#I.stop()}},REFRESH_WINDOW=300,DEFAULT_EXPIRY_OFFSET=1200,AuthTokenManager=class{client;logger;currentToken="";tokenExpiry=0;refreshPromise=null;constructor(e,t){this.client=e,this.logger=t}async getToken(){if(!this.currentToken||this.isExpired())return this.lockedRefreshToken();if(this.needsRefresh()&&!this.refreshPromise)try{await this.lockedRefreshToken()}catch(e){this.logger.error("refreshing auth token","error",e)}return this.currentToken}async lockedRefreshToken(){return this.refreshPromise||(this.refreshPromise=(async()=>{try{if(this.currentToken&&!this.needsRefresh())return;await this.fetchToken()}finally{this.refreshPromise=null}})()),await this.refreshPromise,this.currentToken}async fetchToken(){const e=(await this.client.authTokenGet({})).token;if(!e)throw new Error("Internal error: did not receive auth token from server, please contact Modal support");this.currentToken=e;const t=this.decodeJWT(e);t>0?this.tokenExpiry=t:(this.logger.warn("x-modal-auth-token does not contain exp field"),this.tokenExpiry=Math.floor(Date.now()/1e3)+DEFAULT_EXPIRY_OFFSET);const n=Math.floor(Date.now()/1e3),r=this.tokenExpiry-n,a=this.tokenExpiry-n-REFRESH_WINDOW;this.logger.debug("Fetched auth token","expires_in",`${r}s`,"refresh_in",`${a}s`)}decodeJWT(e){try{const t=e.split(".");if(3!==t.length)return 0;let n=t[1];for(;n.length%4!=0;)n+="=";const r=atob(n);return JSON.parse(r).exp||0}catch{return 0}}isExpired(){return Math.floor(Date.now()/1e3)>=this.tokenExpiry}needsRefresh(){return Math.floor(Date.now()/1e3)>=this.tokenExpiry-REFRESH_WINDOW}getCurrentToken(){return this.currentToken}setToken(e,t){this.currentToken=e,this.tokenExpiry=t}};function getSDKVersion(){return"0.7.4"}var LOG_LEVELS={debug:0,info:1,warn:2,error:3};function parseLogLevel(e){if(!e)return"warn";const t=e.toLowerCase();if("debug"===t||"info"===t||"warn"===t||"warning"===t||"error"===t)return"warning"===t?"warn":t;throw new Error(`Invalid log level value: "${e}" (must be debug, info, warn, or error)`)}var DefaultLogger=class{levelValue;constructor(e="warn"){this.levelValue=LOG_LEVELS[e]}debug(e,...t){this.levelValue<=LOG_LEVELS.debug&&console.log(this.formatMessage("DEBUG",e,t))}info(e,...t){this.levelValue<=LOG_LEVELS.info&&console.log(this.formatMessage("INFO",e,t))}warn(e,...t){this.levelValue<=LOG_LEVELS.warn&&console.warn(this.formatMessage("WARN",e,t))}error(e,...t){this.levelValue<=LOG_LEVELS.error&&console.error(this.formatMessage("ERROR",e,t))}formatMessage(e,t,n){let r=`time=${(new Date).toISOString()} level=${e} msg="${t}"`;if(n.length>0)for(let e=0;e<n.length;e+=2)if(e+1<n.length){const t=n[e],a=n[e+1];r+=` ${t}=${this.formatValue(a)}`}return r}formatValue(e){return"string"==typeof e?e.includes(" ")?`"${e}"`:e:e instanceof Error?`"${e.message}"`:Array.isArray(e)?`[${e.join(",")}]`:String(e)}},FilteredLogger=class{constructor(e,t){this.logger=e,this.levelValue=LOG_LEVELS[t]}levelValue;debug(e,...t){this.levelValue<=LOG_LEVELS.debug&&this.logger.debug(e,...t)}info(e,...t){this.levelValue<=LOG_LEVELS.info&&this.logger.info(e,...t)}warn(e,...t){this.levelValue<=LOG_LEVELS.warn&&this.logger.warn(e,...t)}error(e,...t){this.levelValue<=LOG_LEVELS.error&&this.logger.error(e,...t)}};function createLogger(e,t=""){const n=parseLogLevel(t);return e?new FilteredLogger(e,n):new DefaultLogger(n)}var ModalClient2=class{apps;cloudBucketMounts;cls;functions;functionCalls;images;proxies;queues;sandboxes;secrets;volumes;cpClient;profile;logger;ipClients;authTokenManager=null;customMiddleware;constructor(e){checkForRenamedParams(e,{timeout:"timeoutMs"});const t=getProfile(process.env.MODAL_PROFILE);this.profile={...t,...e?.tokenId&&{tokenId:e.tokenId},...e?.tokenSecret&&{tokenSecret:e.tokenSecret},...e?.environment&&{environment:e.environment}};const n=e?.logLevel||this.profile.logLevel||"";this.logger=createLogger(e?.logger,n),this.logger.debug("Initializing Modal client","version",getSDKVersion(),"server_url",this.profile.serverUrl),this.customMiddleware=e?.grpcMiddleware??[],this.ipClients=new Map,this.cpClient=e?.cpClient??this.createClient(this.profile),this.logger.debug("Modal client initialized successfully"),this.apps=new AppService(this),this.cloudBucketMounts=new CloudBucketMountService(this),this.cls=new ClsService(this),this.functions=new FunctionService(this),this.functionCalls=new FunctionCallService(this),this.images=new ImageService(this),this.proxies=new ProxyService(this),this.queues=new QueueService(this),this.sandboxes=new SandboxService(this),this.secrets=new SecretService(this),this.volumes=new VolumeService(this)}environmentName(e){return e||this.profile.environment||""}imageBuilderVersion(e){return e||this.profile.imageBuilderVersion||"2024.10"}ipClient(e){const t=this.ipClients.get(e);if(t)return t;this.logger.debug("Creating input plane client","server_url",e);const n={...this.profile,serverUrl:e},r=this.createClient(n);return this.ipClients.set(e,r),r}close(){this.logger.debug("Closing Modal client"),this.authTokenManager=null,this.logger.debug("Modal client closed")}version(){return getSDKVersion()}createClient(e){const t=createChannel2(e.serverUrl,void 0,{"grpc.max_receive_message_length":104857600,"grpc.max_send_message_length":104857600,"grpc-node.flow_control_window":67108864,"grpc.keepalive_time_ms":3e4,"grpc.keepalive_timeout_ms":1e4,"grpc.keepalive_permit_without_calls":1});let n=createClientFactory2().use(this.authMiddleware(e)).use(this.retryMiddleware()).use(timeoutMiddleware);for(const e of this.customMiddleware)n=n.use(e);return n.create(ModalClientDefinition,t)}retryMiddleware(){const e=this.logger;return async function*(t,n){const{retries:r=3,baseDelay:a=100,maxDelay:o=1e3,delayFactor:i=2,additionalStatusCodes:s=[],signal:u,...c}=n;if(t.requestStream||t.responseStream||!r)return yield*t.next(t.request,c);const d=new Set([...retryableGrpcStatusCodes,...s]),l=uuidv42(),p=Date.now();let m=0,f=a;for(e.debug("Sending gRPC request","method",t.method.path);;){const n=new Metadata2(c.metadata??{});n.set("x-idempotency-key",l),n.set("x-retry-attempt",String(m)),m>0&&n.set("x-retry-delay",((Date.now()-p)/1e3).toFixed(3));try{return yield*t.next(t.request,{...c,metadata:n,signal:u})}catch(n){if(!(n instanceof ClientError10)||!d.has(n.code)||m>=r)throw m===r&&m>0&&e.debug("Final retry attempt failed","error",n,"retries",m,"delay",f,"method",t.method.path,"idempotency_key",l.substring(0,8)),n;m>0&&e.debug("Retryable failure","error",n,"retries",m,"delay",f,"method",t.method.path,"idempotency_key",l.substring(0,8)),await sleep(f,u),f=Math.min(f*i,o),m+=1}}}}authMiddleware(e){const t=()=>(this.authTokenManager||(this.authTokenManager=new AuthTokenManager(this.cpClient,this.logger)),this.authTokenManager);return async function*(n,r){if(!e.tokenId||!e.tokenSecret)throw new Error("Profile is missing token_id or token_secret. Please set them in .modal.toml, or as environment variables, or via ModalClient constructor.");const{tokenId:a,tokenSecret:o}=e;if(r.metadata??=new Metadata2,r.metadata.set("x-modal-client-type",String(8)),r.metadata.set("x-modal-client-version","1.0.0"),r.metadata.set("x-modal-libmodal-version",`modal-js/${getSDKVersion()}`),r.metadata.set("x-modal-token-id",a),r.metadata.set("x-modal-token-secret",o),"/modal.client.ModalClient/AuthTokenGet"!==n.method.path){const e=t(),n=await e.getToken();n&&r.metadata.set("x-modal-auth-token",n)}return yield*n.next(n.request,r)}}},timeoutMiddleware=async function*(e,t){if(!t.timeoutMs||t.signal?.aborted)return yield*e.next(e.request,t);const{timeoutMs:n,signal:r,...a}=t,o=new AbortController,i=()=>o.abort();r?.addEventListener("abort",i);let s=!1;const u=setTimeout((()=>{s=!0,o.abort()}),n);try{return yield*e.next(e.request,{...a,signal:o.signal})}finally{if(r?.removeEventListener("abort",i),clearTimeout(u),s)throw new ClientError10(e.method.path,Status10.DEADLINE_EXCEEDED,`Timed out after ${n}ms`)}},retryableGrpcStatusCodes=new Set([Status10.DEADLINE_EXCEEDED,Status10.UNAVAILABLE,Status10.CANCELLED,Status10.INTERNAL,Status10.UNKNOWN]);function isRetryableGrpc(e){return e instanceof ClientError10&&retryableGrpcStatusCodes.has(e.code)}var defaultClient,defaultClientOptions,sleep=(e,t)=>new Promise(((n,r)=>{if(t?.aborted)return r(t.reason);const a=setTimeout(n,e);t?.addEventListener("abort",(()=>{clearTimeout(a),r(t.reason)}),{once:!0})}));function getDefaultClient(){return defaultClient||(defaultClient=new ModalClient2(defaultClientOptions)),defaultClient}var client=new Proxy({},{get:(e,t)=>getDefaultClient().cpClient[t]});function initializeClient(e){defaultClientOptions={tokenId:e.tokenId,tokenSecret:e.tokenSecret,environment:e.environment},defaultClient=new ModalClient2(defaultClientOptions)}function close(){defaultClient&&defaultClient.close()}var AppService=class{#e;constructor(e){this.#e=e}async fromName(e,t={}){try{const n=await this.#e.cpClient.appGetOrCreate({appName:e,environmentName:this.#e.environmentName(t.environment),objectCreationType:t.createIfMissing?1:0});return this.#e.logger.debug("Retrieved App","app_id",n.appId,"app_name",e),new App2(n.appId,e)}catch(t){if(t instanceof ClientError11&&t.code===Status11.NOT_FOUND)throw new NotFoundError(`App '${e}' not found`);throw t}}};function parseGpuConfig(e){if(!e)return GPUConfig.create({});let t=e,n=1;if(e.includes(":")){const[r,a]=e.split(":",2);if(t=r,n=parseInt(a,10),isNaN(n)||n<1)throw new Error(`Invalid GPU count: ${a}. Value must be a positive integer.`)}return GPUConfig.create({count:n,gpuType:t.toUpperCase()})}var App2=class{appId;name;constructor(e,t){this.appId=e,this.name=t}static async lookup(e,t={}){return getDefaultClient().apps.fromName(e,t)}async createSandbox(e,t={}){return getDefaultClient().sandboxes.create(this,e,t)}async imageFromRegistry(e,t){return getDefaultClient().images.fromRegistry(e,t).build(this)}async imageFromAwsEcr(e,t){return getDefaultClient().images.fromAwsEcr(e,t).build(this)}async imageFromGcpArtifactRegistry(e,t){return getDefaultClient().images.fromGcpArtifactRegistry(e,t).build(this)}};export{AlreadyExistsError,App2 as App,AppService,ClientClosedError,CloudBucketMount2 as CloudBucketMount,CloudBucketMountService,Cls,ClsInstance,ClsService,ContainerProcess,FunctionCall,FunctionCallService,FunctionService,FunctionTimeoutError,Function_,Image2 as Image,ImageService,InternalFailure,InvalidError,ModalClient2 as ModalClient,NotFoundError,Probe2 as Probe,Proxy3 as Proxy,ProxyService,Queue,QueueEmptyError,QueueFullError,QueueService,RemoteError,Retries,Sandbox2 as Sandbox,SandboxFile,SandboxService,SandboxTimeoutError,Secret,SecretService,TimeoutError,Volume,VolumeService,checkForRenamedParams,close,initializeClient};
//# sourceMappingURL=/sm/0e7796d17bc7b3c6135474ddbae8dbefaa59b0e7c2914a79b54a9be4377f054a.map