Module 535384

21,611 characters · in 514.d733764d42c2ab66.js
Dependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{G:()=>R});var r=n(96326);class i{constructor(e){var t;this.fields=null!=(t=e.fields)?t:[]}prepare(){if(this.data)return;let e=[],t=[],n=[];for(let r of this.fields)if(r.oneof)n.includes(r.oneof)||(n.push(r.oneof),e.push(r.oneof),t.push(r.oneof));else switch(t.push(r.localName),r.kind){case"scalar":case"enum":(!r.opt||r.repeat)&&e.push(r.localName);break;case"message":r.repeat&&e.push(r.localName);break;case"map":e.push(r.localName)}this.data={req:e,known:t,oneofs:Object.values(n)}}is(e,t,n=!1){if(t<0)return!0;if(null==e||"object"!=typeof e)return!1;this.prepare();let r=Object.keys(e),i=this.data;if(r.length<i.req.length||i.req.some(e=>!r.includes(e))||!n&&r.some(e=>!i.known.includes(e)))return!1;if(t<1)return!0;for(let r of i.oneofs){let i=e[r];if(!function(e){if("object"!=typeof e||null===e||!e.hasOwnProperty("oneofKind"))return!1;switch(typeof e.oneofKind){case"string":if(void 0===e[e.oneofKind])return!1;return 2==Object.keys(e).length;case"undefined":return 1==Object.keys(e).length;default:return!1}}(i))return!1;if(void 0===i.oneofKind)continue;let a=this.fields.find(e=>e.localName===i.oneofKind);if(!a||!this.field(i[i.oneofKind],a,n,t))return!1}for(let r of this.fields)if(void 0===r.oneof&&!this.field(e[r.localName],r,n,t))return!1;return!0}field(e,t,n,i){let a=t.repeat;switch(t.kind){case"scalar":if(void 0===e)return t.opt;if(a)return this.scalars(e,t.T,i,t.L);return this.scalar(e,t.T,t.L);case"enum":if(void 0===e)return t.opt;if(a)return this.scalars(e,r.LN.INT32,i);return this.scalar(e,r.LN.INT32);case"message":if(void 0===e)break;if(a)return this.messages(e,t.T(),n,i);return this.message(e,t.T(),n,i);case"map":if("object"!=typeof e||null===e)return!1;if(i<2)break;if(!this.mapKeys(e,t.K,i))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,i,t.V.L);case"enum":return this.scalars(Object.values(e),r.LN.INT32,i);case"message":return this.messages(Object.values(e),t.V.T(),n,i)}}return!0}message(e,t,n,r){return n?t.isAssignable(e,r):t.is(e,r)}messages(e,t,n,r){if(!Array.isArray(e))return!1;if(r<2)return!0;if(n){for(let n=0;n<e.length&&n<r;n++)if(!t.isAssignable(e[n],r-1))return!1}else for(let n=0;n<e.length&&n<r;n++)if(!t.is(e[n],r-1))return!1;return!0}scalar(e,t,n){let i=typeof e;switch(t){case r.LN.UINT64:case r.LN.FIXED64:case r.LN.INT64:case r.LN.SFIXED64:case r.LN.SINT64:switch(n){case r.rO.BIGINT:return"bigint"==i;case r.rO.NUMBER:return"number"==i&&!isNaN(e);default:return"string"==i}case r.LN.BOOL:return"boolean"==i;case r.LN.STRING:return"string"==i;case r.LN.BYTES:return e instanceof Uint8Array;case r.LN.DOUBLE:case r.LN.FLOAT:return"number"==i&&!isNaN(e);default:return"number"==i&&Number.isInteger(e)}}scalars(e,t,n,r){if(!Array.isArray(e))return!1;if(n<2)return!0;if(Array.isArray(e)){for(let i=0;i<e.length&&i<n;i++)if(!this.scalar(e[i],t,r))return!1}return!0}mapKeys(e,t,n){let i=Object.keys(e);switch(t){case r.LN.INT32:case r.LN.FIXED32:case r.LN.SFIXED32:case r.LN.SINT32:case r.LN.UINT32:return this.scalars(i.slice(0,n).map(e=>parseInt(e)),t,n);case r.LN.BOOL:return this.scalars(i.slice(0,n).map(e=>"true"==e||"false"!=e&&e),t,n);default:return this.scalars(i,t,n,r.rO.STRING)}}}var a=n(467276),o=n(65412),s=n(82180);function l(e,t){if(!e)throw Error(t)}function u(e){if("number"!=typeof e)throw Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>0x7fffffff||e<-0x80000000)throw Error("invalid int 32: "+e)}function c(e){if("number"!=typeof e)throw Error("invalid uint 32: "+typeof e);if(!Number.isInteger(e)||e>0xffffffff||e<0)throw Error("invalid uint 32: "+e)}function d(e){if("number"!=typeof e)throw Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error("invalid float 32: "+e)}function f(e,t){switch(t){case r.rO.BIGINT:return e.toBigInt();case r.rO.NUMBER:return e.toNumber();default:return e.toString()}}class p{constructor(e){this.info=e}prepare(){var e;if(void 0===this.fMap)for(let t of(this.fMap={},null!=(e=this.info.fields)?e:[]))this.fMap[t.name]=t,this.fMap[t.jsonName]=t,this.fMap[t.localName]=t}assert(e,t,n){if(!e){let e=(0,a.V)(n);throw("number"==e||"boolean"==e)&&(e=n.toString()),Error(`Cannot parse JSON ${e} for ${this.info.typeName}#${t}`)}}read(e,t,n){this.prepare();let i=[];for(let[o,s]of Object.entries(e)){let e,l=this.fMap[o];if(!l){if(!n.ignoreUnknownFields)throw Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${o}`);continue}let u=l.localName;if(l.oneof){if(i.includes(l.oneof))throw Error(`Multiple members of the oneof group "${l.oneof}" of ${this.info.typeName} are present in JSON.`);i.push(l.oneof),e=t[l.oneof]={oneofKind:u}}else e=t;if("map"==l.kind){if(null===s)continue;this.assert((0,a.O)(s),l.name,s);let t=e[u];for(let[e,i]of Object.entries(s)){let a;switch(this.assert(null!==i,l.name+" map value",null),l.V.kind){case"message":a=l.V.T().internalJsonRead(i,n);break;case"enum":if(!1===(a=this.enum(l.V.T(),i,l.name,n.ignoreUnknownFields)))continue;break;case"scalar":a=this.scalar(i,l.V.T,l.V.L,l.name)}this.assert(void 0!==a,l.name+" map value",i);let o=e;l.K==r.LN.BOOL&&(o="true"==o||"false"!=o&&o),t[o=this.scalar(o,l.K,r.rO.STRING,l.name).toString()]=a}}else if(l.repeat){if(null===s)continue;this.assert(Array.isArray(s),l.name,s);let t=e[u];for(let e of s){let r;switch(this.assert(null!==e,l.name,null),l.kind){case"message":r=l.T().internalJsonRead(e,n);break;case"enum":if(!1===(r=this.enum(l.T(),e,l.name,n.ignoreUnknownFields)))continue;break;case"scalar":r=this.scalar(e,l.T,l.L,l.name)}this.assert(void 0!==r,l.name,s),t.push(r)}}else switch(l.kind){case"message":if(null===s&&"google.protobuf.Value"!=l.T().typeName){this.assert(void 0===l.oneof,l.name+" (oneof member)",null);continue}e[u]=l.T().internalJsonRead(s,n,e[u]);break;case"enum":let c=this.enum(l.T(),s,l.name,n.ignoreUnknownFields);if(!1===c)continue;e[u]=c;break;case"scalar":e[u]=this.scalar(s,l.T,l.L,l.name)}}}enum(e,t,n,r){if("google.protobuf.NullValue"==e[0]&&l(null===t,`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`),null===t)return 0;switch(typeof t){case"number":return l(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${t}.`),t;case"string":let i=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(i=t.substring(e[2].length));let a=e[1][i];if(void 0===a&&r)return!1;return l("number"==typeof a,`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`),a}l(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,n,i){let a;try{switch(t){case r.LN.DOUBLE:case r.LN.FLOAT:if(null===e)return 0;if("NaN"===e)return NaN;if("Infinity"===e)return 1/0;if("-Infinity"===e)return-1/0;if(""===e){a="empty string";break}if("string"==typeof e&&e.trim().length!==e.length){a="extra whitespace";break}if("string"!=typeof e&&"number"!=typeof e)break;let i=Number(e);if(Number.isNaN(i)){a="not a number";break}if(!Number.isFinite(i)){a="too large or small";break}return t==r.LN.FLOAT&&d(i),i;case r.LN.INT32:case r.LN.FIXED32:case r.LN.SFIXED32:case r.LN.SINT32:case r.LN.UINT32:let l;if(null===e)return 0;if("number"==typeof e?l=e:""===e?a="empty string":"string"==typeof e&&(e.trim().length!==e.length?a="extra whitespace":l=Number(e)),void 0===l)break;return t==r.LN.UINT32?c(l):u(l),l;case r.LN.INT64:case r.LN.SFIXED64:case r.LN.SINT64:if(null===e)return f(s.h.ZERO,n);if("number"!=typeof e&&"string"!=typeof e)break;return f(s.h.from(e),n);case r.LN.FIXED64:case r.LN.UINT64:if(null===e)return f(s.e.ZERO,n);if("number"!=typeof e&&"string"!=typeof e)break;return f(s.e.from(e),n);case r.LN.BOOL:if(null===e)return!1;if("boolean"!=typeof e)break;return e;case r.LN.STRING:if(null===e)return"";if("string"!=typeof e){a="extra whitespace";break}try{encodeURIComponent(e)}catch(e){break}return e;case r.LN.BYTES:if(null===e||""===e)return new Uint8Array(0);if("string"!=typeof e)break;return(0,o.A)(e)}}catch(e){a=e.message}this.assert(!1,i+(a?" - "+a:""),e)}}class h{constructor(e){var t;this.fields=null!=(t=e.fields)?t:[]}write(e,t){let n={};for(let r of this.fields){if(!r.oneof){let i=this.field(r,e[r.localName],t);void 0!==i&&(n[t.useProtoFieldName?r.name:r.jsonName]=i);continue}let i=e[r.oneof];if(i.oneofKind!==r.localName)continue;let a="scalar"==r.kind||"enum"==r.kind?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t,o=this.field(r,i[r.localName],a);l(void 0!==o),n[t.useProtoFieldName?r.name:r.jsonName]=o}return n}field(e,t,n){let r;if("map"==e.kind){l("object"==typeof t&&null!==t);let i={};switch(e.V.kind){case"scalar":for(let[n,r]of Object.entries(t)){let t=this.scalar(e.V.T,r,e.name,!1,!0);l(void 0!==t),i[n.toString()]=t}break;case"message":let a=e.V.T();for(let[r,o]of Object.entries(t)){let t=this.message(a,o,e.name,n);l(void 0!==t),i[r.toString()]=t}break;case"enum":let o=e.V.T();for(let[r,a]of Object.entries(t)){l(void 0===a||"number"==typeof a);let t=this.enum(o,a,e.name,!1,!0,n.enumAsInteger);l(void 0!==t),i[r.toString()]=t}}(n.emitDefaultValues||Object.keys(i).length>0)&&(r=i)}else if(e.repeat){l(Array.isArray(t));let i=[];switch(e.kind){case"scalar":for(let n=0;n<t.length;n++){let r=this.scalar(e.T,t[n],e.name,e.opt,!0);l(void 0!==r),i.push(r)}break;case"enum":let a=e.T();for(let r=0;r<t.length;r++){l(void 0===t[r]||"number"==typeof t[r]);let o=this.enum(a,t[r],e.name,e.opt,!0,n.enumAsInteger);l(void 0!==o),i.push(o)}break;case"message":let o=e.T();for(let r=0;r<t.length;r++){let a=this.message(o,t[r],e.name,n);l(void 0!==a),i.push(a)}}(n.emitDefaultValues||i.length>0||n.emitDefaultValues)&&(r=i)}else switch(e.kind){case"scalar":r=this.scalar(e.T,t,e.name,e.opt,n.emitDefaultValues);break;case"enum":r=this.enum(e.T(),t,e.name,e.opt,n.emitDefaultValues,n.enumAsInteger);break;case"message":r=this.message(e.T(),t,e.name,n)}return r}enum(e,t,n,r,i,a){return"google.protobuf.NullValue"==e[0]?null:void 0===t?void l(r):0!==t||i||r?(l("number"==typeof t),l(Number.isInteger(t)),a||!e[1].hasOwnProperty(t))?t:e[2]?e[2]+e[1][t]:e[1][t]:void 0}message(e,t,n,r){return void 0===t?r.emitDefaultValues?null:void 0:e.internalJsonWrite(t,r)}scalar(e,t,n,i,a){if(void 0===t)return void l(i);let f=a||i;switch(e){case r.LN.INT32:case r.LN.SFIXED32:case r.LN.SINT32:if(0===t)return f?0:void 0;return u(t),t;case r.LN.FIXED32:case r.LN.UINT32:if(0===t)return f?0:void 0;return c(t),t;case r.LN.FLOAT:d(t);case r.LN.DOUBLE:if(0===t)return f?0:void 0;if(l("number"==typeof t),Number.isNaN(t))return"NaN";if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";return t;case r.LN.STRING:if(""===t)return f?"":void 0;return l("string"==typeof t),t;case r.LN.BOOL:if(!1===t)return!f&&void 0;return l("boolean"==typeof t),t;case r.LN.UINT64:case r.LN.FIXED64:l("number"==typeof t||"string"==typeof t||"bigint"==typeof t);let p=s.e.from(t);if(p.isZero()&&!f)return;return p.toString();case r.LN.INT64:case r.LN.SFIXED64:case r.LN.SINT64:l("number"==typeof t||"string"==typeof t||"bigint"==typeof t);let h=s.h.from(t);if(h.isZero()&&!f)return;return h.toString();case r.LN.BYTES:if(l(t instanceof Uint8Array),!t.byteLength)return f?"":void 0;return(0,o.C)(t)}}}var m=n(852015);function g(e,t=r.rO.STRING){switch(e){case r.LN.BOOL:return!1;case r.LN.UINT64:case r.LN.FIXED64:return f(s.e.ZERO,t);case r.LN.INT64:case r.LN.SFIXED64:case r.LN.SINT64:return f(s.h.ZERO,t);case r.LN.DOUBLE:case r.LN.FLOAT:return 0;case r.LN.BYTES:return new Uint8Array(0);case r.LN.STRING:return"";default:return 0}}class v{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){let t=null!=(e=this.info.fields)?e:[];this.fieldNoToField=new Map(t.map(e=>[e.no,e]))}}read(e,t,n,i){this.prepare();let a=void 0===i?e.len:e.pos+i;for(;e.pos<a;){let[i,a]=e.tag(),o=this.fieldNoToField.get(i);if(!o){let r=n.readUnknownField;if("throw"==r)throw Error(`Unknown field ${i} (wire type ${a}) for ${this.info.typeName}`);let o=e.skip(a);!1!==r&&(!0===r?m.f$.onRead:r)(this.info.typeName,t,i,a,o);continue}let s=t,l=o.repeat,u=o.localName;switch(o.oneof&&(s=s[o.oneof]).oneofKind!==u&&(s=t[o.oneof]={oneofKind:u}),o.kind){case"scalar":case"enum":let c="enum"==o.kind?r.LN.INT32:o.T,d="scalar"==o.kind?o.L:void 0;if(l){let t=s[u];if(a==m.O0.LengthDelimited&&c!=r.LN.STRING&&c!=r.LN.BYTES){let n=e.uint32()+e.pos;for(;e.pos<n;)t.push(this.scalar(e,c,d))}else t.push(this.scalar(e,c,d))}else s[u]=this.scalar(e,c,d);break;case"message":if(l){let t=s[u],r=o.T().internalBinaryRead(e,e.uint32(),n);t.push(r)}else s[u]=o.T().internalBinaryRead(e,e.uint32(),n,s[u]);break;case"map":let[f,p]=this.mapEntry(o,e,n);s[u][f]=p}}}mapEntry(e,t,n){let i,a,o=t.uint32(),s=t.pos+o;for(;t.pos<s;){let[o,s]=t.tag();switch(o){case 1:i=e.K==r.LN.BOOL?t.bool().toString():this.scalar(t,e.K,r.rO.STRING);break;case 2:switch(e.V.kind){case"scalar":a=this.scalar(t,e.V.T,e.V.L);break;case"enum":a=t.int32();break;case"message":a=e.V.T().internalBinaryRead(t,t.uint32(),n)}break;default:throw Error(`Unknown field ${o} (wire type ${s}) in map entry for ${this.info.typeName}#${e.name}`)}}if(void 0===i){let t=g(e.K);i=e.K==r.LN.BOOL?t.toString():t}if(void 0===a)switch(e.V.kind){case"scalar":a=g(e.V.T,e.V.L);break;case"enum":a=0;break;case"message":a=e.V.T().create()}return[i,a]}scalar(e,t,n){switch(t){case r.LN.INT32:return e.int32();case r.LN.STRING:return e.string();case r.LN.BOOL:return e.bool();case r.LN.DOUBLE:return e.double();case r.LN.FLOAT:return e.float();case r.LN.INT64:return f(e.int64(),n);case r.LN.UINT64:return f(e.uint64(),n);case r.LN.FIXED64:return f(e.fixed64(),n);case r.LN.FIXED32:return e.fixed32();case r.LN.BYTES:return e.bytes();case r.LN.UINT32:return e.uint32();case r.LN.SFIXED32:return e.sfixed32();case r.LN.SFIXED64:return f(e.sfixed64(),n);case r.LN.SINT32:return e.sint32();case r.LN.SINT64:return f(e.sint64(),n)}}}class y{constructor(e){this.info=e}prepare(){if(!this.fields){let e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((e,t)=>e.no-t.no)}}write(e,t,n){for(let i of(this.prepare(),this.fields)){let a,o,s=i.repeat,u=i.localName;if(i.oneof){let t=e[i.oneof];if(t.oneofKind!==u)continue;a=t[u],o=!0}else a=e[u],o=!1;switch(i.kind){case"scalar":case"enum":let c="enum"==i.kind?r.LN.INT32:i.T;if(s)if(l(Array.isArray(a)),s==r.sA.PACKED)this.packed(t,c,i.no,a);else for(let e of a)this.scalar(t,c,i.no,e,!0);else void 0===a?l(i.opt):this.scalar(t,c,i.no,a,o||i.opt);break;case"message":if(s)for(let e of(l(Array.isArray(a)),a))this.message(t,n,i.T(),i.no,e);else this.message(t,n,i.T(),i.no,a);break;case"map":for(let[e,r]of(l("object"==typeof a&&null!==a),Object.entries(a)))this.mapEntry(t,n,i,e,r)}}let i=n.writeUnknownFields;!1!==i&&(!0===i?m.f$.onWrite:i)(this.info.typeName,e,t)}mapEntry(e,t,n,i,a){e.tag(n.no,m.O0.LengthDelimited),e.fork();let o=i;switch(n.K){case r.LN.INT32:case r.LN.FIXED32:case r.LN.UINT32:case r.LN.SFIXED32:case r.LN.SINT32:o=Number.parseInt(i);break;case r.LN.BOOL:l("true"==i||"false"==i),o="true"==i}switch(this.scalar(e,n.K,1,o,!0),n.V.kind){case"scalar":this.scalar(e,n.V.T,2,a,!0);break;case"enum":this.scalar(e,r.LN.INT32,2,a,!0);break;case"message":this.message(e,t,n.V.T(),2,a)}e.join()}message(e,t,n,r,i){void 0!==i&&(n.internalBinaryWrite(i,e.tag(r,m.O0.LengthDelimited).fork(),t),e.join())}scalar(e,t,n,r,i){let[a,o,s]=this.scalarInfo(t,r);(!s||i)&&(e.tag(n,a),e[o](r))}packed(e,t,n,i){if(!i.length)return;l(t!==r.LN.BYTES&&t!==r.LN.STRING),e.tag(n,m.O0.LengthDelimited),e.fork();let[,a]=this.scalarInfo(t);for(let t=0;t<i.length;t++)e[a](i[t]);e.join()}scalarInfo(e,t){let n,i=m.O0.Varint,a=void 0===t,o=0===t;switch(e){case r.LN.INT32:n="int32";break;case r.LN.STRING:o=a||!t.length,i=m.O0.LengthDelimited,n="string";break;case r.LN.BOOL:o=!1===t,n="bool";break;case r.LN.UINT32:n="uint32";break;case r.LN.DOUBLE:i=m.O0.Bit64,n="double";break;case r.LN.FLOAT:i=m.O0.Bit32,n="float";break;case r.LN.INT64:o=a||s.h.from(t).isZero(),n="int64";break;case r.LN.UINT64:o=a||s.e.from(t).isZero(),n="uint64";break;case r.LN.FIXED64:o=a||s.e.from(t).isZero(),i=m.O0.Bit64,n="fixed64";break;case r.LN.BYTES:o=a||!t.byteLength,i=m.O0.LengthDelimited,n="bytes";break;case r.LN.FIXED32:i=m.O0.Bit32,n="fixed32";break;case r.LN.SFIXED32:i=m.O0.Bit32,n="sfixed32";break;case r.LN.SFIXED64:o=a||s.h.from(t).isZero(),i=m.O0.Bit64,n="sfixed64";break;case r.LN.SINT32:n="sint32";break;case r.LN.SINT64:o=a||s.h.from(t).isZero(),n="sint64"}return[i,n,a||o]}}var b=n(428420),_=n(144367);let w={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},x={ignoreUnknownFields:!1},E=Object.values;function S(e,t,n){if(t===n)return!0;if(e!==r.LN.BYTES||t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!=n[e])return!1;return!0}function k(e,t,n){if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!S(e,t[r],n[r]))return!1;return!0}function T(e,t,n){if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e.equals(t[r],n[r]))return!1;return!0}var C=n(679314);let P={writeUnknownFields:!0,writerFactory:()=>new A};class A{constructor(e){this.stack=[],this.textEncoder=null!=e?e:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(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 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(c(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return u(e),(0,C.f7)(e,this.buf),this}bool(e){return this.buf.push(+!!e),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){d(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){c(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){u(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return u(e),e=(e<<1^e>>31)>>>0,(0,C.f7)(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=s.h.from(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=s.e.from(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=s.h.from(e);return(0,C.cV)(t.lo,t.hi,this.buf),this}sint64(e){let t=s.h.from(e),n=t.hi>>31,r=t.lo<<1^n,i=(t.hi<<1|t.lo>>>31)^n;return(0,C.cV)(r,i,this.buf),this}uint64(e){let t=s.e.from(e);return(0,C.cV)(t.lo,t.hi,this.buf),this}}var M=n(638504);class R{constructor(e,t,n){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(r.mS),this.options=null!=n?n:{},this.refTypeCheck=new i(this),this.refJsonReader=new p(this),this.refJsonWriter=new h(this),this.refBinReader=new v(this),this.refBinWriter=new y(this)}create(e){let t=function(e){let t={};for(let n of(Object.defineProperty(t,b.$,{enumerable:!1,value:e}),e.fields)){let e=n.localName;if(!n.opt)if(n.oneof)t[n.oneof]={oneofKind:void 0};else if(n.repeat)t[e]=[];else switch(n.kind){case"scalar":t[e]=g(n.T,n.L);break;case"enum":t[e]=0;break;case"map":t[e]={}}}return t}(this);return void 0!==e&&(0,_.x)(this,t,e),t}clone(e){let t=this.create();return(0,_.x)(this,t,e),t}equals(e,t){return function(e,t,n){if(t===n)return!0;if(!t||!n)return!1;for(let i of e.fields){let e=i.localName,a=i.oneof?t[i.oneof][e]:t[e],o=i.oneof?n[i.oneof][e]:n[e];switch(i.kind){case"enum":case"scalar":let s="enum"==i.kind?r.LN.INT32:i.T;if(!(i.repeat?k(s,a,o):S(s,a,o)))return!1;break;case"map":if(!("message"==i.V.kind?T(i.V.T(),E(a),E(o)):k("enum"==i.V.kind?r.LN.INT32:i.V.T,E(a),E(o))))return!1;break;case"message":let l=i.T();if(!(i.repeat?T(l,a,o):l.equals(a,o)))return!1}}return!0}(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){(0,_.x)(this,e,t)}fromBinary(e,t){let n=(0,M.e)(t);return this.internalBinaryRead(n.readerFactory(e),e.byteLength,n)}fromJson(e,t){return this.internalJsonRead(e,t?Object.assign(Object.assign({},x),t):x)}fromJsonString(e,t){let n=JSON.parse(e);return this.fromJson(n,t)}toJson(e,t){return this.internalJsonWrite(e,t?Object.assign(Object.assign({},w),t):w)}toJsonString(e,t){var n;return JSON.stringify(this.toJson(e,t),null,null!=(n=null==t?void 0:t.prettySpaces)?n:0)}toBinary(e,t){let n=t?Object.assign(Object.assign({},P),t):P;return this.internalBinaryWrite(e,n.writerFactory(),n).finish()}internalJsonRead(e,t,n){if(null!==e&&"object"==typeof e&&!Array.isArray(e)){let r=null!=n?n:this.create();return this.refJsonReader.read(e,r,t),r}throw Error(`Unable to parse message ${this.typeName} from JSON ${(0,a.V)(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,n){return this.refBinWriter.write(e,t,n),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create();return this.refBinReader.read(e,i,n,t),i}}}