protobuf-0.2.min.js
102.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
(function(){(function(t){function g(c,f,d){this.low=c|0;this.high=f|0;this.unsigned=!!d}g.isLong=function(c){return!0===(c&&c instanceof g)};var v={},l={};g.fromInt=function(c,f){var d;if(f){c>>>=0;if(0<=c&&256>c&&(d=l[c]))return d;d=new g(c,0>(c|0)?-1:0,!0);0<=c&&256>c&&(l[c]=d)}else{c|=0;if(-128<=c&&128>c&&(d=v[c]))return d;d=new g(c,0>c?-1:0,!1);-128<=c&&128>c&&(v[c]=d)}return d};g.fromNumber=function(c,f){f=!!f;return isNaN(c)||!isFinite(c)?g.ZERO:!f&&c<=-p?g.MIN_VALUE:!f&&c+1>=p?g.MAX_VALUE:
f&&c>=k?g.MAX_UNSIGNED_VALUE:0>c?g.fromNumber(-c,f).negate():new g(c%m|0,c/m|0,f)};g.fromBits=function(c,f,d){return new g(c,f,d)};g.fromString=function(c,f,d){if(0===c.length)throw Error("number format error: empty string");if("NaN"===c||"Infinity"===c||"+Infinity"===c||"-Infinity"===c)return g.ZERO;"number"===typeof f&&(d=f,f=!1);d=d||10;if(2>d||36<d)throw Error("radix out of range: "+d);var a;if(0<(a=c.indexOf("-")))throw Error('number format error: interior "-" character: '+c);if(0===a)return g.fromString(c.substring(1),
f,d).negate();a=g.fromNumber(Math.pow(d,8));for(var b=g.ZERO,e=0;e<c.length;e+=8){var h=Math.min(8,c.length-e),u=parseInt(c.substring(e,e+h),d);8>h?(h=g.fromNumber(Math.pow(d,h)),b=b.multiply(h).add(g.fromNumber(u))):(b=b.multiply(a),b=b.add(g.fromNumber(u)))}b.unsigned=f;return b};g.fromValue=function(c){return"number"===typeof c?g.fromNumber(c):"string"===typeof c?g.fromString(c):g.isLong(c)?c:new g(c.low,c.high,c.unsigned)};var m=4294967296,k=m*m,p=k/2,q=g.fromInt(16777216);g.ZERO=g.fromInt(0);
g.UZERO=g.fromInt(0,!0);g.ONE=g.fromInt(1);g.UONE=g.fromInt(1,!0);g.NEG_ONE=g.fromInt(-1);g.MAX_VALUE=g.fromBits(-1,2147483647,!1);g.MAX_UNSIGNED_VALUE=g.fromBits(-1,-1,!0);g.MIN_VALUE=g.fromBits(0,-2147483648,!1);g.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low};g.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*m+(this.low>>>0):this.high*m+(this.low>>>0)};g.prototype.toString=function(c){c=c||10;if(2>c||36<c)throw RangeError("radix out of range: "+c);if(this.isZero())return"0";
var f;if(this.isNegative()){if(this.equals(g.MIN_VALUE)){f=g.fromNumber(c);var d=this.div(f);f=d.multiply(f).subtract(this);return d.toString(c)+f.toInt().toString(c)}return"-"+this.negate().toString(c)}d=g.fromNumber(Math.pow(c,6),this.unsigned);f=this;for(var a="";;){var b=f.div(d),e=(f.subtract(b.multiply(d)).toInt()>>>0).toString(c);f=b;if(f.isZero())return e+a;for(;6>e.length;)e="0"+e;a=""+e+a}};g.prototype.getHighBits=function(){return this.high};g.prototype.getHighBitsUnsigned=function(){return this.high>>>
0};g.prototype.getLowBits=function(){return this.low};g.prototype.getLowBitsUnsigned=function(){return this.low>>>0};g.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(g.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var c=0!=this.high?this.high:this.low,f=31;0<f&&0==(c&1<<f);f--);return 0!=this.high?f+33:f+1};g.prototype.isZero=function(){return 0===this.high&&0===this.low};g.prototype.isNegative=function(){return!this.unsigned&&0>this.high};g.prototype.isPositive=function(){return this.unsigned||
0<=this.high};g.prototype.isOdd=function(){return 1===(this.low&1)};g.prototype.equals=function(c){g.isLong(c)||(c=g.fromValue(c));return this.unsigned!==c.unsigned&&this.high>>>31!==c.high>>>31?!1:this.high===c.high&&this.low===c.low};g.prototype.notEquals=function(c){g.isLong(c)||(c=g.fromValue(c));return!this.equals(c)};g.prototype.lessThan=function(c){g.isLong(c)||(c=g.fromValue(c));return 0>this.compare(c)};g.prototype.lessThanOrEqual=function(c){g.isLong(c)||(c=g.fromValue(c));return 0>=this.compare(c)};
g.prototype.greaterThan=function(c){g.isLong(c)||(c=g.fromValue(c));return 0<this.compare(c)};g.prototype.greaterThanOrEqual=function(c){return 0<=this.compare(c)};g.prototype.compare=function(c){if(this.equals(c))return 0;var f=this.isNegative(),d=c.isNegative();return f&&!d?-1:!f&&d?1:this.unsigned?c.high>>>0>this.high>>>0||c.high===this.high&&c.low>>>0>this.low>>>0?-1:1:this.subtract(c).isNegative()?-1:1};g.prototype.negate=function(){return!this.unsigned&&this.equals(g.MIN_VALUE)?g.MIN_VALUE:
this.not().add(g.ONE)};g.prototype.add=function(c){g.isLong(c)||(c=g.fromValue(c));var f=this.high>>>16,d=this.high&65535,a=this.low>>>16,b=c.high>>>16,e=c.high&65535,h=c.low>>>16,u;u=0+((this.low&65535)+(c.low&65535));c=0+(u>>>16)+(a+h);a=0+(c>>>16);a+=d+e;d=0+(a>>>16)+(f+b)&65535;return g.fromBits((c&65535)<<16|u&65535,d<<16|a&65535,this.unsigned)};g.prototype.subtract=function(c){g.isLong(c)||(c=g.fromValue(c));return this.add(c.negate())};g.prototype.multiply=function(c){if(this.isZero())return g.ZERO;
g.isLong(c)||(c=g.fromValue(c));if(c.isZero())return g.ZERO;if(this.equals(g.MIN_VALUE))return c.isOdd()?g.MIN_VALUE:g.ZERO;if(c.equals(g.MIN_VALUE))return this.isOdd()?g.MIN_VALUE:g.ZERO;if(this.isNegative())return c.isNegative()?this.negate().multiply(c.negate()):this.negate().multiply(c).negate();if(c.isNegative())return this.multiply(c.negate()).negate();if(this.lessThan(q)&&c.lessThan(q))return g.fromNumber(this.toNumber()*c.toNumber(),this.unsigned);var f=this.high>>>16,d=this.high&65535,a=
this.low>>>16,b=this.low&65535,e=c.high>>>16,h=c.high&65535,u=c.low>>>16;c=c.low&65535;var m,n,r,w;w=0+b*c;r=0+(w>>>16)+a*c;n=0+(r>>>16);r=(r&65535)+b*u;n+=r>>>16;r&=65535;n+=d*c;m=0+(n>>>16);n=(n&65535)+a*u;m+=n>>>16;n=(n&65535)+b*h;m+=n>>>16;n&=65535;return g.fromBits(r<<16|w&65535,(m+(f*c+d*u+a*h+b*e)&65535)<<16|n,this.unsigned)};g.prototype.div=function(c){g.isLong(c)||(c=g.fromValue(c));if(c.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g.UZERO:g.ZERO;var f,d,
a;if(this.equals(g.MIN_VALUE)){if(c.equals(g.ONE)||c.equals(g.NEG_ONE))return g.MIN_VALUE;if(c.equals(g.MIN_VALUE))return g.ONE;f=this.shiftRight(1).div(c).shiftLeft(1);if(f.equals(g.ZERO))return c.isNegative()?g.ONE:g.NEG_ONE;d=this.subtract(c.multiply(f));return f.add(d.div(c))}if(c.equals(g.MIN_VALUE))return this.unsigned?g.UZERO:g.ZERO;if(this.isNegative())return c.isNegative()?this.negate().div(c.negate()):this.negate().div(c).negate();if(c.isNegative())return this.div(c.negate()).negate();a=
g.ZERO;for(d=this;d.greaterThanOrEqual(c);){f=Math.max(1,Math.floor(d.toNumber()/c.toNumber()));for(var b=Math.ceil(Math.log(f)/Math.LN2),b=48>=b?1:Math.pow(2,b-48),e=g.fromNumber(f),h=e.multiply(c);h.isNegative()||h.greaterThan(d);)f-=b,e=g.fromNumber(f,this.unsigned),h=e.multiply(c);e.isZero()&&(e=g.ONE);a=a.add(e);d=d.subtract(h)}return a};g.prototype.modulo=function(c){g.isLong(c)||(c=g.fromValue(c));return this.subtract(this.div(c).multiply(c))};g.prototype.not=function(){return g.fromBits(~this.low,
~this.high,this.unsigned)};g.prototype.and=function(c){g.isLong(c)||(c=g.fromValue(c));return g.fromBits(this.low&c.low,this.high&c.high,this.unsigned)};g.prototype.or=function(c){g.isLong(c)||(c=g.fromValue(c));return g.fromBits(this.low|c.low,this.high|c.high,this.unsigned)};g.prototype.xor=function(c){g.isLong(c)||(c=g.fromValue(c));return g.fromBits(this.low^c.low,this.high^c.high,this.unsigned)};g.prototype.shiftLeft=function(c){g.isLong(c)&&(c=c.toInt());return 0===(c&=63)?this:32>c?g.fromBits(this.low<<
c,this.high<<c|this.low>>>32-c,this.unsigned):g.fromBits(0,this.low<<c-32,this.unsigned)};g.prototype.shiftRight=function(c){g.isLong(c)&&(c=c.toInt());return 0===(c&=63)?this:32>c?g.fromBits(this.low>>>c|this.high<<32-c,this.high>>c,this.unsigned):g.fromBits(this.high>>c-32,0<=this.high?0:-1,this.unsigned)};g.prototype.shiftRightUnsigned=function(c){g.isLong(c)&&(c=c.toInt());c&=63;if(0===c)return this;var f=this.high;return 32>c?g.fromBits(this.low>>>c|f<<32-c,f>>>c,this.unsigned):32===c?g.fromBits(f,
0,this.unsigned):g.fromBits(f>>>c-32,0,this.unsigned)};g.prototype.toSigned=function(){return this.unsigned?new g(this.low,this.high,!1):this};g.prototype.toUnsigned=function(){return this.unsigned?this:new g(this.low,this.high,!0)};"function"===typeof require&&"object"===typeof module&&module&&module.id&&"object"===typeof exports&&exports?module.exports=g:"function"===typeof define&&define.amd?define("Long",[],function(){return g}):(t.dcodeIO=t.dcodeIO||{}).Long=g})(this)})();
(function(t){function g(g){function l(a,b,e){"undefined"===typeof a&&(a=l.DEFAULT_CAPACITY);"undefined"===typeof b&&(b=l.DEFAULT_ENDIAN);"undefined"===typeof e&&(e=l.DEFAULT_NOASSERT);if(!e){a|=0;if(0>a)throw RangeError("Illegal capacity");b=!!b;e=!!e}this.buffer=0===a?q:new ArrayBuffer(a);this.view=0===a?null:new DataView(this.buffer);this.offset=0;this.markedOffset=-1;this.limit=a;this.littleEndian="undefined"!==typeof b?!!b:!1;this.noAssert=!!e}function m(a){var b=0;return function(){return b<
a.length?a.charCodeAt(b++):null}}function k(){var a=[],b=[];return function(){if(0===arguments.length)return b.join("")+c.apply(String,a);1024<a.length+arguments.length&&(b.push(c.apply(String,a)),a.length=0);Array.prototype.push.apply(a,arguments)}}l.VERSION="3.5.2";l.LITTLE_ENDIAN=!0;l.BIG_ENDIAN=!1;l.DEFAULT_CAPACITY=16;l.DEFAULT_ENDIAN=l.BIG_ENDIAN;l.DEFAULT_NOASSERT=!1;l.Long=g||null;var p=l.prototype,q=new ArrayBuffer(0),c=String.fromCharCode;l.allocate=function(a,b,e){return new l(a,b,e)};
l.concat=function(a,b,e,h){if("boolean"===typeof b||"string"!==typeof b)h=e,e=b,b=void 0;for(var d=0,c=0,n=a.length,f;c<n;++c)l.isByteBuffer(a[c])||(a[c]=l.wrap(a[c],b)),f=a[c].limit-a[c].offset,0<f&&(d+=f);if(0===d)return new l(0,e,h);b=new l(d,e,h);h=new Uint8Array(b.buffer);for(c=0;c<n;)e=a[c++],f=e.limit-e.offset,0>=f||(h.set((new Uint8Array(e.buffer)).subarray(e.offset,e.limit),b.offset),b.offset+=f);b.limit=b.offset;b.offset=0;return b};l.isByteBuffer=function(a){return!0===(a&&a instanceof
l)};l.type=function(){return ArrayBuffer};l.wrap=function(a,b,e,h){"string"!==typeof b&&(h=e,e=b,b=void 0);if("string"===typeof a)switch("undefined"===typeof b&&(b="utf8"),b){case "base64":return l.fromBase64(a,e);case "hex":return l.fromHex(a,e);case "binary":return l.fromBinary(a,e);case "utf8":return l.fromUTF8(a,e);case "debug":return l.fromDebug(a,e);default:throw Error("Unsupported encoding: "+b);}if(null===a||"object"!==typeof a)throw TypeError("Illegal buffer");if(l.isByteBuffer(a))return b=
p.clone.call(a),b.markedOffset=-1,b;if(a instanceof Uint8Array)b=new l(0,e,h),0<a.length&&(b.buffer=a.buffer,b.offset=a.byteOffset,b.limit=a.byteOffset+a.length,b.view=0<a.length?new DataView(a.buffer):null);else if(a instanceof ArrayBuffer)b=new l(0,e,h),0<a.byteLength&&(b.buffer=a,b.offset=0,b.limit=a.byteLength,b.view=0<a.byteLength?new DataView(a):null);else if("[object Array]"===Object.prototype.toString.call(a))for(b=new l(a.length,e,h),b.limit=a.length,i=0;i<a.length;++i)b.view.setUint8(i,
a[i]);else throw TypeError("Illegal buffer");return b};p.writeInt8=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=1;var h=this.buffer.byteLength;b>h&&this.resize((h*=
2)>b?h:b);this.view.setInt8(b-1,a);e&&(this.offset+=1);return this};p.writeByte=p.writeInt8;p.readInt8=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}a=this.view.getInt8(a);b&&(this.offset+=1);return a};p.readByte=p.readInt8;p.writeUint8=function(a,b){var e=
"undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=1;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);this.view.setUint8(b-1,a);e&&(this.offset+=1);return this};p.readUint8=
function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}a=this.view.getUint8(a);b&&(this.offset+=1);return a};p.writeInt16=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+
a+" (not an integer)");a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=2;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);this.view.setInt16(b-2,a,this.littleEndian);e&&(this.offset+=2);return this};p.writeShort=p.writeInt16;p.readInt16=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==
typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+2) <= "+this.buffer.byteLength);}a=this.view.getInt16(a,this.littleEndian);b&&(this.offset+=2);return a};p.readShort=p.readInt16;p.writeUint16=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a>>>=0;if("number"!==typeof b||
0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=2;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);this.view.setUint16(b-2,a,this.littleEndian);e&&(this.offset+=2);return this};p.readUint16=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");
a>>>=0;if(0>a||a+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+2) <= "+this.buffer.byteLength);}a=this.view.getUint16(a,this.littleEndian);b&&(this.offset+=2);return a};p.writeInt32=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+
b+" (+0) <= "+this.buffer.byteLength);}b+=4;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);this.view.setInt32(b-4,a,this.littleEndian);e&&(this.offset+=4);return this};p.writeInt=p.writeInt32;p.readInt32=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength);
}a=this.view.getInt32(a,this.littleEndian);b&&(this.offset+=4);return a};p.readInt=p.readInt32;p.writeUint32=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=
4;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);this.view.setUint32(b-4,a,this.littleEndian);e&&(this.offset+=4);return this};p.readUint32=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength);}a=this.view.getUint32(a,this.littleEndian);b&&(this.offset+=
4);return a};g&&(p.writeInt64=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("number"===typeof a)a=g.fromNumber(a);else if(!(a&&a instanceof g))throw TypeError("Illegal value: "+a+" (not an integer or Long)");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}"number"===typeof a&&(a=g.fromNumber(a));b+=
8;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);b-=8;this.littleEndian?(this.view.setInt32(b,a.low,!0),this.view.setInt32(b+4,a.high,!0)):(this.view.setInt32(b,a.high,!1),this.view.setInt32(b+4,a.low,!1));e&&(this.offset+=8);return this},p.writeLong=p.writeInt64,p.readInt64=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+
a+" (+8) <= "+this.buffer.byteLength);}a=this.littleEndian?new g(this.view.getInt32(a,!0),this.view.getInt32(a+4,!0),!1):new g(this.view.getInt32(a+4,!1),this.view.getInt32(a,!1),!1);b&&(this.offset+=8);return a},p.readLong=p.readInt64,p.writeUint64=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("number"===typeof a)a=g.fromNumber(a);else if(!(a&&a instanceof g))throw TypeError("Illegal value: "+a+" (not an integer or Long)");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+
b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}"number"===typeof a&&(a=g.fromNumber(a));b+=8;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);b-=8;this.littleEndian?(this.view.setInt32(b,a.low,!0),this.view.setInt32(b+4,a.high,!0)):(this.view.setInt32(b,a.high,!1),this.view.setInt32(b+4,a.low,!1));e&&(this.offset+=8);return this},p.readUint64=function(a){var b="undefined"===typeof a;b&&(a=
this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+8) <= "+this.buffer.byteLength);}a=this.littleEndian?new g(this.view.getInt32(a,!0),this.view.getInt32(a+4,!0),!0):new g(this.view.getInt32(a+4,!1),this.view.getInt32(a,!1),!0);b&&(this.offset+=8);return a});p.writeFloat32=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("number"!==
typeof a)throw TypeError("Illegal value: "+a+" (not a number)");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=4;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);this.view.setFloat32(b-4,a,this.littleEndian);e&&(this.offset+=4);return this};p.writeFloat=p.writeFloat32;p.readFloat32=function(a){var b="undefined"===typeof a;
b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength);}a=this.view.getFloat32(a,this.littleEndian);b&&(this.offset+=4);return a};p.readFloat=p.readFloat32;p.writeFloat64=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a)throw TypeError("Illegal value: "+
a+" (not a number)");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=8;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);this.view.setFloat64(b-8,a,this.littleEndian);e&&(this.offset+=8);return this};p.writeDouble=p.writeFloat64;p.readFloat64=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==
typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+8) <= "+this.buffer.byteLength);}a=this.view.getFloat64(a,this.littleEndian);b&&(this.offset+=8);return a};p.readDouble=p.readFloat64;l.MAX_VARINT32_BYTES=5;l.calculateVarint32=function(a){a>>>=0;return 128>a?1:16384>a?2:2097152>a?3:268435456>a?4:5};l.zigZagEncode32=function(a){return((a|=0)<<1^a>>31)>>>0};l.zigZagDecode32=function(a){return a>>>
1^-(a&1)|0};p.writeVarint32=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var h=l.calculateVarint32(a);b+=h;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>
b?d:b);b-=h;this.view.setUint8(b,h=a|128);a>>>=0;128<=a?(h=a>>7|128,this.view.setUint8(b+1,h),16384<=a?(h=a>>14|128,this.view.setUint8(b+2,h),2097152<=a?(h=a>>21|128,this.view.setUint8(b+3,h),268435456<=a?(this.view.setUint8(b+4,a>>28&15),h=5):(this.view.setUint8(b+3,h&127),h=4)):(this.view.setUint8(b+2,h&127),h=3)):(this.view.setUint8(b+1,h&127),h=2)):(this.view.setUint8(b,h&127),h=1);return e?(this.offset+=h,this):h};p.writeVarint32ZigZag=function(a,b){return this.writeVarint32(l.zigZagEncode32(a),
b)};p.readVarint32=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var e=0,h=0,d;do{d=a+e;if(!this.noAssert&&d>this.limit)throw a=Error("Truncated"),a.truncated=!0,a;d=this.view.getUint8(d);5>e&&(h|=(d&127)<<7*e>>>0);++e}while(128===(d&128));h|=0;return b?(this.offset+=
e,h):{value:h,length:e}};p.readVarint32ZigZag=function(a){a=this.readVarint32(a);"object"===typeof a?a.value=l.zigZagDecode32(a.value):a=l.zigZagDecode32(a);return a};g&&(l.MAX_VARINT64_BYTES=10,l.calculateVarint64=function(a){"number"===typeof a&&(a=g.fromNumber(a));var b=a.toInt()>>>0,e=a.shiftRightUnsigned(28).toInt()>>>0;a=a.shiftRightUnsigned(56).toInt()>>>0;return 0==a?0==e?16384>b?128>b?1:2:2097152>b?3:4:16384>e?128>e?5:6:2097152>e?7:8:128>a?9:10},l.zigZagEncode64=function(a){"number"===typeof a?
a=g.fromNumber(a,!1):!1!==a.unsigned&&(a=a.toSigned());return a.shiftLeft(1).xor(a.shiftRight(63)).toUnsigned()},l.zigZagDecode64=function(a){"number"===typeof a?a=g.fromNumber(a,!1):!1!==a.unsigned&&(a=a.toSigned());return a.shiftRightUnsigned(1).xor(a.and(g.ONE).toSigned().negate()).toSigned()},p.writeVarint64=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("number"===typeof a)a=g.fromNumber(a);else if(!(a&&a instanceof g))throw TypeError("Illegal value: "+a+
" (not an integer or Long)");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}"number"===typeof a?a=g.fromNumber(a,!1):!1!==a.unsigned&&(a=a.toSigned());var h=l.calculateVarint64(a),d=a.toInt()>>>0,c=a.shiftRightUnsigned(28).toInt()>>>0,n=a.shiftRightUnsigned(56).toInt()>>>0;b+=h;var f=this.buffer.byteLength;b>f&&this.resize((f*=2)>b?f:
b);b-=h;switch(h){case 10:this.view.setUint8(b+9,n>>>7&1);case 9:this.view.setUint8(b+8,9!==h?n|128:n&127);case 8:this.view.setUint8(b+7,8!==h?c>>>21|128:c>>>21&127);case 7:this.view.setUint8(b+6,7!==h?c>>>14|128:c>>>14&127);case 6:this.view.setUint8(b+5,6!==h?c>>>7|128:c>>>7&127);case 5:this.view.setUint8(b+4,5!==h?c|128:c&127);case 4:this.view.setUint8(b+3,4!==h?d>>>21|128:d>>>21&127);case 3:this.view.setUint8(b+2,3!==h?d>>>14|128:d>>>14&127);case 2:this.view.setUint8(b+1,2!==h?d>>>7|128:d>>>7&
127);case 1:this.view.setUint8(b,1!==h?d|128:d&127)}return e?(this.offset+=h,this):h},p.writeVarint64ZigZag=function(a,b){return this.writeVarint64(l.zigZagEncode64(a),b)},p.readVarint64=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var e=a,h=0,d=0,c=0,n=0,
n=this.view.getUint8(a++),h=n&127;if(n&128&&(n=this.view.getUint8(a++),h|=(n&127)<<7,n&128&&(n=this.view.getUint8(a++),h|=(n&127)<<14,n&128&&(n=this.view.getUint8(a++),h|=(n&127)<<21,n&128&&(n=this.view.getUint8(a++),d=n&127,n&128&&(n=this.view.getUint8(a++),d|=(n&127)<<7,n&128&&(n=this.view.getUint8(a++),d|=(n&127)<<14,n&128&&(n=this.view.getUint8(a++),d|=(n&127)<<21,n&128&&(n=this.view.getUint8(a++),c=n&127,n&128&&(n=this.view.getUint8(a++),c|=(n&127)<<7,n&128))))))))))throw Error("Buffer overrun");
h=g.fromBits(h|d<<28,d>>>4|c<<24,!1);return b?(this.offset=a,h):{value:h,length:a-e}},p.readVarint64ZigZag=function(a){(a=this.readVarint64(a))&&a.value instanceof g?a.value=l.zigZagDecode64(a.value):a=l.zigZagDecode64(a);return a});p.writeCString=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);var h,c=a.length;if(!this.noAssert){if("string"!==typeof a)throw TypeError("Illegal str: Not a string");for(h=0;h<c;++h)if(0===a.charCodeAt(h))throw RangeError("Illegal str: Contains NULL-characters");
if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}h=b;c=d.a(m(a))[1];b+=c+1;var f=this.buffer.byteLength;b>f&&this.resize((f*=2)>b?f:b);b-=c+1;d.c(m(a),function(a){this.view.setUint8(b++,a)}.bind(this));this.view.setUint8(b++,0);return e?(this.offset=b-h,this):c};p.readCString=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==
typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var e=a,h,c=-1;d.b(function(){if(0===c)return null;if(a>=this.limit)throw RangeError("Illegal range: Truncated data, "+a+" < "+this.limit);return 0===(c=this.view.getUint8(a++))?null:c}.bind(this),h=k(),!0);return b?(this.offset=a,h()):{string:h(),length:a-e}};p.writeIString=function(a,b){var e="undefined"===
typeof b;e&&(b=this.offset);if(!this.noAssert){if("string"!==typeof a)throw TypeError("Illegal str: Not a string");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var h=b,c;c=d.a(m(a),this.noAssert)[1];b+=4+c;var f=this.buffer.byteLength;b>f&&this.resize((f*=2)>b?f:b);b-=4+c;this.view.setUint32(b,c,this.littleEndian);b+=4;d.c(m(a),function(a){this.view.setUint8(b++,
a)}.bind(this));if(b!==h+4+c)throw RangeError("Illegal range: Truncated data, "+b+" == "+(b+4+c));return e?(this.offset=b,this):b-h};p.readIString=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength);}var e=0,h=a,e=this.view.getUint32(a,this.littleEndian);a+=4;var c=
a+e;d.b(function(){return a<c?this.view.getUint8(a++):null}.bind(this),e=k(),this.noAssert);e=e();return b?(this.offset=a,e):{string:e,length:a-h}};l.METRICS_CHARS="c";l.METRICS_BYTES="b";p.writeUTF8String=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var h,
c=b;h=d.a(m(a))[1];b+=h;var f=this.buffer.byteLength;b>f&&this.resize((f*=2)>b?f:b);b-=h;d.c(m(a),function(a){this.view.setUint8(b++,a)}.bind(this));return e?(this.offset=b,this):b-c};p.writeString=p.writeUTF8String;l.calculateUTF8Chars=function(a){return d.a(m(a))[0]};l.calculateUTF8Bytes=function(a){return d.a(m(a))[1]};p.readUTF8String=function(a,b,e){"number"===typeof b&&(e=b,b=void 0);var h="undefined"===typeof e;h&&(e=this.offset);"undefined"===typeof b&&(b=l.METRICS_CHARS);if(!this.noAssert){if("number"!==
typeof a||0!==a%1)throw TypeError("Illegal length: "+a+" (not an integer)");a|=0;if("number"!==typeof e||0!==e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");e>>>=0;if(0>e||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength);}var c=0,f=e,n;if(b===l.METRICS_CHARS){n=k();d.g(function(){return c<a&&e<this.limit?this.view.getUint8(e++):null}.bind(this),function(a){++c;d.e(a,n)}.bind(this));if(c!==a)throw RangeError("Illegal range: Truncated data, "+
c+" == "+a);return h?(this.offset=e,n()):{string:n(),length:e-f}}if(b===l.METRICS_BYTES){if(!this.noAssert){if("number"!==typeof e||0!==e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");e>>>=0;if(0>e||e+a>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+"+a+") <= "+this.buffer.byteLength);}var r=e+a;d.b(function(){return e<r?this.view.getUint8(e++):null}.bind(this),n=k(),this.noAssert);if(e!==r)throw RangeError("Illegal range: Truncated data, "+e+" == "+r);return h?
(this.offset=e,n()):{string:n(),length:e-f}}throw TypeError("Unsupported metrics: "+b);};p.readString=p.readUTF8String;p.writeVString=function(a,b){var e="undefined"===typeof b;e&&(b=this.offset);if(!this.noAssert){if("string"!==typeof a)throw TypeError("Illegal str: Not a string");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var h=
b,c,f;c=d.a(m(a),this.noAssert)[1];f=l.calculateVarint32(c);b+=f+c;var n=this.buffer.byteLength;b>n&&this.resize((n*=2)>b?n:b);b-=f+c;b+=this.writeVarint32(c,b);d.c(m(a),function(a){this.view.setUint8(b++,a)}.bind(this));if(b!==h+c+f)throw RangeError("Illegal range: Truncated data, "+b+" == "+(b+c+f));return e?(this.offset=b,this):b-h};p.readVString=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");
a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var e=this.readVarint32(a),h=a;a+=e.length;var e=e.value,c=a+e,e=k();d.b(function(){return a<c?this.view.getUint8(a++):null}.bind(this),e,this.noAssert);e=e();return b?(this.offset=a,e):{string:e,length:a-h}};p.append=function(a,b,e){if("number"===typeof b||"string"!==typeof b)e=b,b=void 0;var h="undefined"===typeof e;h&&(e=this.offset);if(!this.noAssert){if("number"!==typeof e||
0!==e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");e>>>=0;if(0>e||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength);}a instanceof l||(a=l.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;e+=b;var d=this.buffer.byteLength;e>d&&this.resize((d*=2)>e?d:e);(new Uint8Array(this.buffer,e-b)).set((new Uint8Array(a.buffer)).subarray(a.offset,a.limit));a.offset+=b;h&&(this.offset+=b);return this};p.appendTo=function(a,b){a.append(this,
b);return this};p.assert=function(a){this.noAssert=!a;return this};p.capacity=function(){return this.buffer.byteLength};p.clear=function(){this.offset=0;this.limit=this.buffer.byteLength;this.markedOffset=-1;return this};p.clone=function(a){var b=new l(0,this.littleEndian,this.noAssert);a?(a=new ArrayBuffer(this.buffer.byteLength),(new Uint8Array(a)).set(this.buffer),b.buffer=a,b.view=new DataView(a)):(b.buffer=this.buffer,b.view=this.view);b.offset=this.offset;b.markedOffset=this.markedOffset;b.limit=
this.limit;return b};p.compact=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}if(0===a&&b===this.buffer.byteLength)return this;var e=b-a;if(0===
e)return this.buffer=q,this.view=null,0<=this.markedOffset&&(this.markedOffset-=a),this.limit=this.offset=0,this;var d=new ArrayBuffer(e);(new Uint8Array(d)).set((new Uint8Array(this.buffer)).subarray(a,b));this.buffer=d;this.view=new DataView(d);0<=this.markedOffset&&(this.markedOffset-=a);this.offset=0;this.limit=e;return this};p.copy=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");
a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}if(a===b)return new l(0,this.littleEndian,this.noAssert);var e=b-a,d=new l(e,this.littleEndian,this.noAssert);d.offset=0;d.limit=e;0<=d.markedOffset&&(d.markedOffset-=a);this.copyTo(d,0,a,b);return d};p.copyTo=function(a,b,e,d){var c,f;if(!this.noAssert&&!l.isByteBuffer(a))throw TypeError("Illegal target: Not a ByteBuffer");
b=(f="undefined"===typeof b)?a.offset:b|0;e=(c="undefined"===typeof e)?this.offset:e|0;d="undefined"===typeof d?this.limit:d|0;if(0>b||b>a.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+b+" <= "+a.buffer.byteLength);if(0>e||d>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+e+" <= "+this.buffer.byteLength);var n=d-e;if(0===n)return a;a.ensureCapacity(b+n);(new Uint8Array(a.buffer)).set((new Uint8Array(this.buffer)).subarray(e,d),b);c&&(this.offset+=n);f&&(a.offset+=
n);return this};p.ensureCapacity=function(a){var b=this.buffer.byteLength;return b<a?this.resize((b*=2)>a?b:a):this};p.fill=function(a,b,e){var d="undefined"===typeof b;d&&(b=this.offset);"string"===typeof a&&0<a.length&&(a=a.charCodeAt(0));"undefined"===typeof b&&(b=this.offset);"undefined"===typeof e&&(e=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal begin: Not an integer");
b>>>=0;if("number"!==typeof e||0!==e%1)throw TypeError("Illegal end: Not an integer");e>>>=0;if(0>b||b>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+b+" <= "+e+" <= "+this.buffer.byteLength);}if(b>=e)return this;for(;b<e;)this.view.setUint8(b++,a);d&&(this.offset=b);return this};p.flip=function(){this.limit=this.offset;this.offset=0;return this};p.mark=function(a){a="undefined"===typeof a?this.offset:a;if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+
a+" (not an integer)");a>>>=0;if(0>a||a+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+0) <= "+this.buffer.byteLength);}this.markedOffset=a;return this};p.order=function(a){if(!this.noAssert&&"boolean"!==typeof a)throw TypeError("Illegal littleEndian: Not a boolean");this.littleEndian=!!a;return this};p.LE=function(a){this.littleEndian="undefined"!==typeof a?!!a:!0;return this};p.BE=function(a){this.littleEndian="undefined"!==typeof a?!a:!1;return this};p.prepend=function(a,
b,e){if("number"===typeof b||"string"!==typeof b)e=b,b=void 0;var d="undefined"===typeof e;d&&(e=this.offset);if(!this.noAssert){if("number"!==typeof e||0!==e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");e>>>=0;if(0>e||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength);}a instanceof l||(a=l.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;var c=b-e,f;if(0<c){var n=new ArrayBuffer(this.buffer.byteLength+c);f=new Uint8Array(n);f.set((new Uint8Array(this.buffer)).subarray(e,
this.buffer.byteLength),b);this.buffer=n;this.view=new DataView(n);this.offset+=c;0<=this.markedOffset&&(this.markedOffset+=c);this.limit+=c;e+=c}else f=new Uint8Array(this.buffer);f.set((new Uint8Array(a.buffer)).subarray(a.offset,a.limit),e-b);a.offset=a.limit;d&&(this.offset-=b);return this};p.prependTo=function(a,b){a.prepend(this,b);return this};p.printDebug=function(a){"function"!==typeof a&&(a=console.log.bind(console));a(this.toString()+"\n-------------------------------------------------------------------\n"+
this.toDebug(!0))};p.remaining=function(){return this.limit-this.offset};p.reset=function(){0<=this.markedOffset?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0;return this};p.resize=function(a){if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal capacity: "+a+" (not an integer)");a|=0;if(0>a)throw RangeError("Illegal capacity: 0 <= "+a);}this.buffer.byteLength<a&&(a=new ArrayBuffer(a),(new Uint8Array(a)).set(new Uint8Array(this.buffer)),this.buffer=a,this.view=
new DataView(a));return this};p.reverse=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}if(a===b)return this;Array.prototype.reverse.call((new Uint8Array(this.buffer)).subarray(a,
b));this.view=new DataView(this.buffer);return this};p.skip=function(a){if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal length: "+a+" (not an integer)");a|=0}var b=this.offset+a;if(!this.noAssert&&(0>b||b>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+a+" <= "+this.buffer.byteLength);this.offset=b;return this};p.slice=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==
typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}var e=this.clone();e.offset=a;e.limit=b;return e};p.toBuffer=function(a){var b=this.offset,e=this.limit;if(b>e)var d=b,b=e,e=d;if(!this.noAssert){if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: Not an integer");
b>>>=0;if("number"!==typeof e||0!==e%1)throw TypeError("Illegal limit: Not an integer");e>>>=0;if(0>b||b>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+b+" <= "+e+" <= "+this.buffer.byteLength);}if(!a&&0===b&&e===this.buffer.byteLength)return this.buffer;if(b===e)return q;a=new ArrayBuffer(e-b);(new Uint8Array(a)).set((new Uint8Array(this.buffer)).subarray(b,e),0);return a};p.toArrayBuffer=p.toBuffer;p.toString=function(a,b,e){if("undefined"===typeof a)return"ByteBufferAB(offset="+
this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";"number"===typeof a&&(e=b=a="utf8");switch(a){case "utf8":return this.toUTF8(b,e);case "base64":return this.toBase64(b,e);case "hex":return this.toHex(b,e);case "binary":return this.toBinary(b,e);case "debug":return this.toDebug();case "columns":return this.m();default:throw Error("Unsupported encoding: "+a);}};var f=function(){for(var a={},b=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,
83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],e=[],d=0,c=b.length;d<c;++d)e[b[d]]=d;a.i=function(a,e){for(var d,c;null!==(d=a());)e(b[d>>2&63]),c=(d&3)<<4,null!==(d=a())?(c|=d>>4&15,e(b[(c|d>>4&15)&63]),c=(d&15)<<2,null!==(d=a())?(e(b[(c|d>>6&3)&63]),e(b[d&63])):(e(b[c&63]),e(61))):(e(b[c&63]),e(61),e(61))};a.h=function(a,b){function d(a){throw Error("Illegal character code: "+a);}for(var c,
h,f;null!==(c=a());)if(h=e[c],"undefined"===typeof h&&d(c),null!==(c=a())&&(f=e[c],"undefined"===typeof f&&d(c),b(h<<2>>>0|(f&48)>>4),null!==(c=a()))){h=e[c];if("undefined"===typeof h)if(61===c)break;else d(c);b((f&15)<<4>>>0|(h&60)>>2);if(null!==(c=a())){f=e[c];if("undefined"===typeof f)if(61===c)break;else d(c);b((h&3)<<6>>>0|f)}}};a.test=function(a){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a)};return a}();p.toBase64=function(a,b){"undefined"===typeof a&&(a=
this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}var e;f.i(function(){return a<b?this.view.getUint8(a++):null}.bind(this),e=k());return e()};l.fromBase64=function(a,b,e){if(!e){if("string"!==
typeof a)throw TypeError("Illegal str: Not a string");if(0!==a.length%4)throw TypeError("Illegal str: Length not a multiple of 4");}var d=new l(a.length/4*3,b,e),c=0;f.h(m(a),function(a){d.view.setUint8(c++,a)});d.limit=c;return d};l.btoa=function(a){return l.fromBinary(a).toBase64()};l.atob=function(a){return l.fromBase64(a).toBinary()};p.toBinary=function(a,b){a="undefined"===typeof a?this.offset:a;b="undefined"===typeof b?this.limit:b;if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");
a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}if(a===b)return"";for(var e=[],d=[];a<b;)e.push(this.view.getUint8(a++)),1024<=e.length&&(d.push(String.fromCharCode.apply(String,e)),e=[]);return d.join("")+String.fromCharCode.apply(String,e)};l.fromBinary=function(a,b,e){if(!e&&"string"!==typeof a)throw TypeError("Illegal str: Not a string");
for(var d=0,c=a.length,f=new l(c,b,e);d<c;){b=a.charCodeAt(d);if(!e&&255<b)throw RangeError("Illegal charCode at "+d+": 0 <= "+b+" <= 255");f.view.setUint8(d++,b)}f.limit=c;return f};p.toDebug=function(a){for(var b=-1,e=this.buffer.byteLength,d,c="",f="",n="";b<e;){-1!==b&&(d=this.view.getUint8(b),c=16>d?c+("0"+d.toString(16).toUpperCase()):c+d.toString(16).toUpperCase(),a&&(f+=32<d&&127>d?String.fromCharCode(d):"."));++b;if(a&&0<b&&0===b%16&&b!==e){for(;51>c.length;)c+=" ";n+=c+f+"\n";c=f=""}c=b===
this.offset&&b===this.limit?c+(b===this.markedOffset?"!":"|"):b===this.offset?c+(b===this.markedOffset?"[":"<"):b===this.limit?c+(b===this.markedOffset?"]":">"):c+(b===this.markedOffset?"'":a||0!==b&&b!==e?" ":"")}if(a&&" "!==c){for(;51>c.length;)c+=" ";n+=c+f+"\n"}return a?n:c};l.fromDebug=function(a,b,e){var d=a.length;b=new l((d+1)/3|0,b,e);for(var c=0,f=0,n,r=!1,m=!1,g=!1,k=!1,p=!1;c<d;){switch(n=a.charAt(c++)){case "!":if(!e){if(m||g||k){p=!0;break}m=g=k=!0}b.offset=b.markedOffset=b.limit=f;
r=!1;break;case "|":if(!e){if(m||k){p=!0;break}m=k=!0}b.offset=b.limit=f;r=!1;break;case "[":if(!e){if(m||g){p=!0;break}m=g=!0}b.offset=b.markedOffset=f;r=!1;break;case "<":if(!e){if(m){p=!0;break}m=!0}b.offset=f;r=!1;break;case "]":if(!e){if(k||g){p=!0;break}k=g=!0}b.limit=b.markedOffset=f;r=!1;break;case ">":if(!e){if(k){p=!0;break}k=!0}b.limit=f;r=!1;break;case "'":if(!e){if(g){p=!0;break}g=!0}b.markedOffset=f;r=!1;break;case " ":r=!1;break;default:if(!e&&r){p=!0;break}n=parseInt(n+a.charAt(c++),
16);if(!e&&(isNaN(n)||0>n||255<n))throw TypeError("Illegal str: Not a debug encoded string");b.view.setUint8(f++,n);r=!0}if(p)throw TypeError("Illegal str: Invalid symbol at "+c);}if(!e){if(!m||!k)throw TypeError("Illegal str: Missing offset or limit");if(f<b.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+f+" < "+d);}return b};p.toHex=function(a,b){a="undefined"===typeof a?this.offset:a;b="undefined"===typeof b?this.limit:b;if(!this.noAssert){if("number"!==
typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}for(var e=Array(b-a),d;a<b;)d=this.view.getUint8(a++),16>d?e.push("0",d.toString(16)):e.push(d.toString(16));return e.join("")};l.fromHex=function(a,b,e){if(!e){if("string"!==typeof a)throw TypeError("Illegal str: Not a string");
if(0!==a.length%2)throw TypeError("Illegal str: Length not a multiple of 2");}var d=a.length;b=new l(d/2|0,b);for(var c,f=0,n=0;f<d;f+=2){c=parseInt(a.substring(f,f+2),16);if(!e&&(!isFinite(c)||0>c||255<c))throw TypeError("Illegal str: Contains non-hex characters");b.view.setUint8(n++,c)}b.limit=n;return b};var d=function(){var a={k:1114111,j:function(a,e){var d=null;for("number"===typeof a&&(d=a,a=function(){return null});null!==d||null!==(d=a());)128>d?e(d&127):(2048>d?e(d>>6&31|192):(65536>d?e(d>>
12&15|224):(e(d>>18&7|240),e(d>>12&63|128)),e(d>>6&63|128)),e(d&63|128)),d=null},g:function(a,d){function c(a){a=a.slice(0,a.indexOf(null));var b=Error(a.toString());b.name="TruncatedError";b.bytes=a;throw b;}for(var f,m,n,r;null!==(f=a());)if(0===(f&128))d(f);else if(192===(f&224))null===(m=a())&&c([f,m]),d((f&31)<<6|m&63);else if(224===(f&240))null!==(m=a())&&null!==(n=a())||c([f,m,n]),d((f&15)<<12|(m&63)<<6|n&63);else if(240===(f&248))null!==(m=a())&&null!==(n=a())&&null!==(r=a())||c([f,m,n,r]),
d((f&7)<<18|(m&63)<<12|(n&63)<<6|r&63);else throw RangeError("Illegal starting byte: "+f);},d:function(a,d){for(var c,f=null;null!==(c=null!==f?f:a());)55296<=c&&57343>=c&&null!==(f=a())&&56320<=f&&57343>=f?(d(1024*(c-55296)+f-56320+65536),f=null):d(c);null!==f&&d(f)},e:function(a,d){var c=null;for("number"===typeof a&&(c=a,a=function(){return null});null!==c||null!==(c=a());)65535>=c?d(c):(c-=65536,d((c>>10)+55296),d(c%1024+56320)),c=null},c:function(b,d){a.d(b,function(b){a.j(b,d)})},b:function(b,
d){a.g(b,function(b){a.e(b,d)})},f:function(a){return 128>a?1:2048>a?2:65536>a?3:4},l:function(b){for(var d,c=0;null!==(d=b());)c+=a.f(d);return c},a:function(b){var d=0,c=0;a.d(b,function(b){++d;c+=a.f(b)});return[d,c]}};return a}();p.toUTF8=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");
b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}var c;try{d.b(function(){return a<b?this.view.getUint8(a++):null}.bind(this),c=k())}catch(f){if(a!==b)throw RangeError("Illegal range: Truncated data, "+a+" != "+b);}return c()};l.fromUTF8=function(a,b,c){if(!c&&"string"!==typeof a)throw TypeError("Illegal str: Not a string");var f=new l(d.a(m(a),!0)[1],b,c),g=0;d.c(m(a),function(a){f.view.setUint8(g++,a)});f.limit=g;return f};
return l}"function"===typeof require&&"object"===typeof module&&module&&module.id&&"object"===typeof exports&&exports?module.exports=function(){var v;try{v=require("Long")}catch(l){}return g(v)}():"function"===typeof define&&define.amd?define("ByteBuffer",["Long"],function(v){return g(v)}):(t.dcodeIO=t.dcodeIO||{}).ByteBuffer=g(t.dcodeIO.Long)})(this);
(function(t){function g(g){var l={VERSION:"3.7.0",WIRE_TYPES:{}};l.WIRE_TYPES.VARINT=0;l.WIRE_TYPES.BITS64=1;l.WIRE_TYPES.LDELIM=2;l.WIRE_TYPES.STARTGROUP=3;l.WIRE_TYPES.ENDGROUP=4;l.WIRE_TYPES.BITS32=5;l.PACKABLE_WIRE_TYPES=[l.WIRE_TYPES.VARINT,l.WIRE_TYPES.BITS64,l.WIRE_TYPES.BITS32];l.TYPES={int32:{name:"int32",wireType:l.WIRE_TYPES.VARINT},uint32:{name:"uint32",wireType:l.WIRE_TYPES.VARINT},sint32:{name:"sint32",wireType:l.WIRE_TYPES.VARINT},int64:{name:"int64",wireType:l.WIRE_TYPES.VARINT},uint64:{name:"uint64",
wireType:l.WIRE_TYPES.VARINT},sint64:{name:"sint64",wireType:l.WIRE_TYPES.VARINT},bool:{name:"bool",wireType:l.WIRE_TYPES.VARINT},"double":{name:"double",wireType:l.WIRE_TYPES.BITS64},string:{name:"string",wireType:l.WIRE_TYPES.LDELIM},bytes:{name:"bytes",wireType:l.WIRE_TYPES.LDELIM},fixed32:{name:"fixed32",wireType:l.WIRE_TYPES.BITS32},sfixed32:{name:"sfixed32",wireType:l.WIRE_TYPES.BITS32},fixed64:{name:"fixed64",wireType:l.WIRE_TYPES.BITS64},sfixed64:{name:"sfixed64",wireType:l.WIRE_TYPES.BITS64},
"float":{name:"float",wireType:l.WIRE_TYPES.BITS32},"enum":{name:"enum",wireType:l.WIRE_TYPES.VARINT},message:{name:"message",wireType:l.WIRE_TYPES.LDELIM},group:{name:"group",wireType:l.WIRE_TYPES.STARTGROUP}};l.ID_MIN=1;l.ID_MAX=536870911;l.ByteBuffer=g;l.Long=g.Long||null;l.convertFieldsToCamelCase=!1;l.populateAccessors=!0;l.Util=function(){Object.create||(Object.create=function(g){function m(){}if(1<arguments.length)throw Error("Object.create polyfill only accepts the first parameter.");m.prototype=
g;return new m});var g={IS_NODE:!1};try{g.IS_NODE="function"===typeof require&&"function"===typeof require("fs").readFileSync&&"function"===typeof require("path").resolve}catch(k){}g.XHR=function(){for(var g=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],m=null,c=0;c<g.length;c++){try{m=g[c]()}catch(f){continue}break}if(!m)throw Error("XMLHttpRequest is not supported");
return m};g.fetch=function(k,l){l&&"function"!=typeof l&&(l=null);if(g.IS_NODE)if(l)require("fs").readFile(k,function(d,a){d?l(null):l(""+a)});else try{return require("fs").readFileSync(k)}catch(c){return null}else{var f=g.XHR();f.open("GET",k,l?!0:!1);f.setRequestHeader("Accept","text/plain");"function"===typeof f.overrideMimeType&&f.overrideMimeType("text/plain");if(l)f.onreadystatechange=function(){4==f.readyState&&(200==f.status||0==f.status&&"string"===typeof f.responseText?l(f.responseText):
l(null))},4!=f.readyState&&f.send(null);else return f.send(null),200==f.status||0==f.status&&"string"===typeof f.responseText?f.responseText:null}};g.isArray=Array.isArray||function(g){return"[object Array]"===Object.prototype.toString.call(g)};return g}();l.Lang={OPEN:"{",CLOSE:"}",OPTOPEN:"[",OPTCLOSE:"]",OPTEND:",",EQUAL:"=",END:";",STRINGOPEN:'"',STRINGCLOSE:'"',STRINGOPEN_SQ:"'",STRINGCLOSE_SQ:"'",COPTOPEN:"(",COPTCLOSE:")",DELIM:/[\s\{\}=;\[\],'"\(\)]/g,RULE:/^(?:required|optional|repeated)$/,
TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0x[0-9a-fA-F]+|0[0-7]+|([0-9]*\.[0-9]+([Ee][+-]?[0-9]+)?))$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0x[0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^[0-9]*\.[0-9]+([Ee][+-]?[0-9]+)?$/,ID:/^(?:[1-9][0-9]*|0|0x[0-9a-fA-F]+|0[0-7]+)$/,
NEGID:/^\-?(?:[1-9][0-9]*|0|0x[0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/['"]([^'"\\]*(\\.[^"\\]*)*)['"]/g,BOOL:/^(?:true|false)$/i};l.DotProto=function(g,k){var l={},q=function(d){this.source=""+d;this.index=0;this.line=1;this.stack=[];this.readingString=!1;this.stringEndsWith=k.STRINGCLOSE},c=q.prototype;c._readString=function(){k.STRING.lastIndex=this.index-1;var d;if(null!==(d=k.STRING.exec(this.source)))return d=d[1],this.index=k.STRING.lastIndex,this.stack.push(this.stringEndsWith),d;throw Error("Unterminated string at line "+
this.line+", index "+this.index);};c.next=function(){if(0<this.stack.length)return this.stack.shift();if(this.index>=this.source.length)return null;if(this.readingString)return this.readingString=!1,this._readString();var d,a;do{for(d=!1;k.WHITESPACE.test(a=this.source.charAt(this.index));)if(this.index++,"\n"===a&&this.line++,this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if("/"===this.source.charAt(++this.index)){for(;"\n"!==this.source.charAt(this.index);)if(this.index++,
this.index==this.source.length)return null;this.index++;this.line++;d=!0}else if("*"===this.source.charAt(this.index)){for(a="";"*/"!==a+(a=this.source.charAt(this.index));)if(this.index++,"\n"===a&&this.line++,this.index===this.source.length)return null;this.index++;d=!0}else throw Error("Unterminated comment at line "+this.line+": /"+this.source.charAt(this.index));}while(d);if(this.index===this.source.length)return null;d=this.index;k.DELIM.lastIndex=0;if(k.DELIM.test(this.source.charAt(d)))++d;
else for(++d;d<this.source.length&&!k.DELIM.test(this.source.charAt(d));)d++;d=this.source.substring(this.index,this.index=d);d===k.STRINGOPEN?(this.readingString=!0,this.stringEndsWith=k.STRINGCLOSE):d===k.STRINGOPEN_SQ&&(this.readingString=!0,this.stringEndsWith=k.STRINGCLOSE_SQ);return d};c.peek=function(){if(0===this.stack.length){var d=this.next();if(null===d)return null;this.stack.push(d)}return this.stack[0]};c.toString=function(){return"Tokenizer("+this.index+"/"+this.source.length+" at line "+
this.line+")"};l.Tokenizer=q;var c=function(d){this.tn=new q(d)},f=c.prototype;f.parse=function(){for(var d={name:"[ROOT]","package":null,messages:[],enums:[],imports:[],options:{},services:[]},a,b=!0;a=this.tn.next();)switch(a){case "package":if(!b||null!==d["package"])throw Error("Unexpected package at line "+this.tn.line);d["package"]=this._parsePackage(a);break;case "import":if(!b)throw Error("Unexpected import at line "+this.tn.line);d.imports.push(this._parseImport(a));break;case "message":this._parseMessage(d,
null,a);b=!1;break;case "enum":this._parseEnum(d,a);b=!1;break;case "option":if(!b)throw Error("Unexpected option at line "+this.tn.line);this._parseOption(d,a);break;case "service":this._parseService(d,a);break;case "extend":this._parseExtend(d,a);break;case "syntax":this._parseIgnoredStatement(d,a);break;default:throw Error("Unexpected token at line "+this.tn.line+": "+a);}delete d.name;return d};f._parseNumber=function(d){var a=1;"-"==d.charAt(0)&&(a=-1,d=d.substring(1));if(k.NUMBER_DEC.test(d))return a*
parseInt(d,10);if(k.NUMBER_HEX.test(d))return a*parseInt(d.substring(2),16);if(k.NUMBER_OCT.test(d))return a*parseInt(d.substring(1),8);if(k.NUMBER_FLT.test(d))return a*parseFloat(d);throw Error("Illegal number at line "+this.tn.line+": "+(0>a?"-":"")+d);};f._parseString=function(){var d="",a;do{this.tn.next();d+=this.tn.next();a=this.tn.next();if(a!==this.tn.stringEndsWith)throw Error("Illegal end of string at line "+this.tn.line+": "+a);a=this.tn.peek()}while(a===k.STRINGOPEN||a===k.STRINGOPEN_SQ);
return d};f._parseId=function(d,a){var b=-1,c=1;"-"==d.charAt(0)&&(c=-1,d=d.substring(1));if(k.NUMBER_DEC.test(d))b=parseInt(d);else if(k.NUMBER_HEX.test(d))b=parseInt(d.substring(2),16);else if(k.NUMBER_OCT.test(d))b=parseInt(d.substring(1),8);else throw Error("Illegal id at line "+this.tn.line+": "+(0>c?"-":"")+d);b=c*b|0;if(!a&&0>b)throw Error("Illegal id at line "+this.tn.line+": "+(0>c?"-":"")+d);return b};f._parsePackage=function(d){d=this.tn.next();if(!k.TYPEREF.test(d))throw Error("Illegal package name at line "+
this.tn.line+": "+d);var a=d;d=this.tn.next();if(d!=k.END)throw Error("Illegal end of package at line "+this.tn.line+": "+d);return a};f._parseImport=function(d){d=this.tn.peek();"public"===d&&(this.tn.next(),d=this.tn.peek());if(d!==k.STRINGOPEN&&d!==k.STRINGOPEN_SQ)throw Error("Illegal start of import at line "+this.tn.line+": "+d);var a=this._parseString();d=this.tn.next();if(d!==k.END)throw Error("Illegal end of import at line "+this.tn.line+": "+d);return a};f._parseOption=function(d,a){a=this.tn.next();
var b=!1;a==k.COPTOPEN&&(b=!0,a=this.tn.next());if(!k.TYPEREF.test(a)&&!/google\.protobuf\./.test(a))throw Error("Illegal option name in message "+d.name+" at line "+this.tn.line+": "+a);var c=a;a=this.tn.next();if(b){if(a!==k.COPTCLOSE)throw Error("Illegal end in message "+d.name+", option "+c+" at line "+this.tn.line+": "+a);c="("+c+")";a=this.tn.next();k.FQTYPEREF.test(a)&&(c+=a,a=this.tn.next())}if(a!==k.EQUAL)throw Error("Illegal operator in message "+d.name+", option "+c+" at line "+this.tn.line+
": "+a);a=this.tn.peek();if(a===k.STRINGOPEN||a===k.STRINGOPEN_SQ)b=this._parseString();else if(this.tn.next(),k.NUMBER.test(a))b=this._parseNumber(a,!0);else if(k.BOOL.test(a))b="true"===a;else if(k.TYPEREF.test(a))b=a;else throw Error("Illegal option value in message "+d.name+", option "+c+" at line "+this.tn.line+": "+a);a=this.tn.next();if(a!==k.END)throw Error("Illegal end of option in message "+d.name+", option "+c+" at line "+this.tn.line+": "+a);d.options[c]=b};f._parseIgnoredStatement=function(d,
a){var b;do{b=this.tn.next();if(null===b)throw Error("Unexpected EOF in "+d.name+", "+a+" at line "+this.tn.line);if(b===k.END)break}while(1)};f._parseService=function(d,a){a=this.tn.next();if(!k.NAME.test(a))throw Error("Illegal service name at line "+this.tn.line+": "+a);var b=a,c={name:b,rpc:{},options:{}};a=this.tn.next();if(a!==k.OPEN)throw Error("Illegal start of service "+b+" at line "+this.tn.line+": "+a);do if(a=this.tn.next(),"option"===a)this._parseOption(c,a);else if("rpc"===a)this._parseServiceRPC(c,
a);else if(a!==k.CLOSE)throw Error("Illegal type of service "+b+" at line "+this.tn.line+": "+a);while(a!==k.CLOSE);d.services.push(c)};f._parseServiceRPC=function(d,a){var b=a;a=this.tn.next();if(!k.NAME.test(a))throw Error("Illegal method name in service "+d.name+" at line "+this.tn.line+": "+a);var c=a,f={request:null,response:null,options:{}};a=this.tn.next();if(a!==k.COPTOPEN)throw Error("Illegal start of request type in service "+d.name+"#"+c+" at line "+this.tn.line+": "+a);a=this.tn.next();
if(!k.TYPEREF.test(a))throw Error("Illegal request type in service "+d.name+"#"+c+" at line "+this.tn.line+": "+a);f.request=a;a=this.tn.next();if(a!=k.COPTCLOSE)throw Error("Illegal end of request type in service "+d.name+"#"+c+" at line "+this.tn.line+": "+a);a=this.tn.next();if("returns"!==a.toLowerCase())throw Error("Illegal delimiter in service "+d.name+"#"+c+" at line "+this.tn.line+": "+a);a=this.tn.next();if(a!=k.COPTOPEN)throw Error("Illegal start of response type in service "+d.name+"#"+
c+" at line "+this.tn.line+": "+a);a=this.tn.next();f.response=a;a=this.tn.next();if(a!==k.COPTCLOSE)throw Error("Illegal end of response type in service "+d.name+"#"+c+" at line "+this.tn.line+": "+a);a=this.tn.next();if(a===k.OPEN){do if(a=this.tn.next(),"option"===a)this._parseOption(f,a);else if(a!==k.CLOSE)throw Error("Illegal start of option inservice "+d.name+"#"+c+" at line "+this.tn.line+": "+a);while(a!==k.CLOSE);this.tn.peek()===k.END&&this.tn.next()}else if(a!==k.END)throw Error("Illegal delimiter in service "+
d.name+"#"+c+" at line "+this.tn.line+": "+a);"undefined"===typeof d[b]&&(d[b]={});d[b][c]=f};f._parseMessage=function(c,a,b){var e={},f="group"===b;b=this.tn.next();if(!k.NAME.test(b))throw Error("Illegal "+(f?"group":"message")+" name"+(c?" in message "+c.name:"")+" at line "+this.tn.line+": "+b);e.name=b;if(f){b=this.tn.next();if(b!==k.EQUAL)throw Error("Illegal id assignment after group "+e.name+" at line "+this.tn.line+": "+b);b=this.tn.next();try{a.id=this._parseId(b)}catch(g){throw Error("Illegal field id value for group "+
e.name+"#"+a.name+" at line "+this.tn.line+": "+b);}e.isGroup=!0}e.fields=[];e.enums=[];e.messages=[];e.options={};e.oneofs={};b=this.tn.next();b===k.OPTOPEN&&a&&(this._parseFieldOptions(e,a,b),b=this.tn.next());if(b!==k.OPEN)throw Error("Illegal start of "+(f?"group":"message")+" "+e.name+" at line "+this.tn.line+": "+b);do if(b=this.tn.next(),b===k.CLOSE){b=this.tn.peek();b===k.END&&this.tn.next();break}else if(k.RULE.test(b))this._parseMessageField(e,b);else if("oneof"===b)this._parseMessageOneOf(e,
b);else if("enum"===b)this._parseEnum(e,b);else if("message"===b)this._parseMessage(e,null,b);else if("option"===b)this._parseOption(e,b);else if("extensions"===b)e.extensions=this._parseExtensions(e,b);else if("extend"===b)this._parseExtend(e,b);else throw Error("Illegal token in message "+e.name+" at line "+this.tn.line+": "+b);while(1);c.messages.push(e);return e};f._parseMessageField=function(c,a){var b={},e=null;b.rule=a;b.options={};a=this.tn.next();if("group"===a){e=this._parseMessage(c,b,
a);if(!/^[A-Z]/.test(e.name))throw Error("Group names must start with a capital letter");b.type=e.name;b.name=e.name.toLowerCase();a=this.tn.peek();a===k.END&&this.tn.next()}else{if(!k.TYPE.test(a)&&!k.TYPEREF.test(a))throw Error("Illegal field type in message "+c.name+" at line "+this.tn.line+": "+a);b.type=a;a=this.tn.next();if(!k.NAME.test(a))throw Error("Illegal field name in message "+c.name+" at line "+this.tn.line+": "+a);b.name=a;a=this.tn.next();if(a!==k.EQUAL)throw Error("Illegal token in field "+
c.name+"#"+b.name+" at line "+this.tn.line+": "+a);a=this.tn.next();try{b.id=this._parseId(a)}catch(f){throw Error("Illegal field id in message "+c.name+"#"+b.name+" at line "+this.tn.line+": "+a);}a=this.tn.next();a===k.OPTOPEN&&(this._parseFieldOptions(c,b,a),a=this.tn.next());if(a!==k.END)throw Error("Illegal delimiter in message "+c.name+"#"+b.name+" at line "+this.tn.line+": "+a);}c.fields.push(b);return b};f._parseMessageOneOf=function(c,a){a=this.tn.next();if(!k.NAME.test(a))throw Error("Illegal oneof name in message "+
c.name+" at line "+this.tn.line+": "+a);var b=a,e,f=[];a=this.tn.next();if(a!==k.OPEN)throw Error("Illegal start of oneof "+b+" at line "+this.tn.line+": "+a);for(;this.tn.peek()!==k.CLOSE;)e=this._parseMessageField(c,"optional"),e.oneof=b,f.push(e.id);this.tn.next();c.oneofs[b]=f};f._parseFieldOptions=function(c,a,b){var f=!0;do{b=this.tn.next();if(b===k.OPTCLOSE)break;else if(b===k.OPTEND){if(f)throw Error("Illegal start of options in message "+c.name+"#"+a.name+" at line "+this.tn.line+": "+b);
b=this.tn.next()}this._parseFieldOption(c,a,b);f=!1}while(1)};f._parseFieldOption=function(c,a,b){var f=!1;b===k.COPTOPEN&&(b=this.tn.next(),f=!0);if(!k.TYPEREF.test(b))throw Error("Illegal field option in "+c.name+"#"+a.name+" at line "+this.tn.line+": "+b);var g=b;b=this.tn.next();if(f){if(b!==k.COPTCLOSE)throw Error("Illegal delimiter in "+c.name+"#"+a.name+" at line "+this.tn.line+": "+b);g="("+g+")";b=this.tn.next();k.FQTYPEREF.test(b)&&(g+=b,b=this.tn.next())}if(b!==k.EQUAL)throw Error("Illegal token in "+
c.name+"#"+a.name+" at line "+this.tn.line+": "+b);b=this.tn.peek();if(b===k.STRINGOPEN||b===k.STRINGOPEN_SQ)c=this._parseString();else if(k.NUMBER.test(b,!0))c=this._parseNumber(this.tn.next(),!0);else if(k.BOOL.test(b))c="true"===this.tn.next().toLowerCase();else if(k.TYPEREF.test(b))c=this.tn.next();else throw Error("Illegal value in message "+c.name+"#"+a.name+", option "+g+" at line "+this.tn.line+": "+b);a.options[g]=c};f._parseEnum=function(c,a){var b={};a=this.tn.next();if(!k.NAME.test(a))throw Error("Illegal enum name in message "+
c.name+" at line "+this.tn.line+": "+a);b.name=a;a=this.tn.next();if(a!==k.OPEN)throw Error("Illegal start of enum "+b.name+" at line "+this.tn.line+": "+a);b.values=[];b.options={};do{a=this.tn.next();if(a===k.CLOSE){a=this.tn.peek();a===k.END&&this.tn.next();break}if("option"==a)this._parseOption(b,a);else{if(!k.NAME.test(a))throw Error("Illegal name in enum "+b.name+" at line "+this.tn.line+": "+a);this._parseEnumValue(b,a)}}while(1);c.enums.push(b)};f._parseEnumValue=function(c,a){var b={};b.name=
a;a=this.tn.next();if(a!==k.EQUAL)throw Error("Illegal token in enum "+c.name+" at line "+this.tn.line+": "+a);a=this.tn.next();try{b.id=this._parseId(a,!0)}catch(f){throw Error("Illegal id in enum "+c.name+" at line "+this.tn.line+": "+a);}c.values.push(b);a=this.tn.next();a===k.OPTOPEN&&(this._parseFieldOptions(c,{options:{}},a),a=this.tn.next());if(a!==k.END)throw Error("Illegal delimiter in enum "+c.name+" at line "+this.tn.line+": "+a);};f._parseExtensions=function(c,a){var b=[];a=this.tn.next();
"min"===a?b.push(g.ID_MIN):"max"===a?b.push(g.ID_MAX):b.push(this._parseNumber(a));a=this.tn.next();if("to"!==a)throw Error("Illegal extensions delimiter in message "+c.name+" at line "+this.tn.line+": "+a);a=this.tn.next();"min"===a?b.push(g.ID_MIN):"max"===a?b.push(g.ID_MAX):b.push(this._parseNumber(a));a=this.tn.next();if(a!==k.END)throw Error("Illegal extensions delimiter in message "+c.name+" at line "+this.tn.line+": "+a);return b};f._parseExtend=function(c,a){a=this.tn.next();if(!k.TYPEREF.test(a))throw Error("Illegal message name at line "+
this.tn.line+": "+a);var b={};b.ref=a;b.fields=[];a=this.tn.next();if(a!==k.OPEN)throw Error("Illegal start of extend "+b.name+" at line "+this.tn.line+": "+a);do if(a=this.tn.next(),a===k.CLOSE){a=this.tn.peek();a==k.END&&this.tn.next();break}else if(k.RULE.test(a))this._parseMessageField(b,a);else throw Error("Illegal token in extend "+b.name+" at line "+this.tn.line+": "+a);while(1);c.messages.push(b);return b};f.toString=function(){return"Parser"};l.Parser=c;return l}(l,l.Lang);l.Reflect=function(m){function k(a,
b){var c=b.readVarint32(),d=c&7,c=c>>3;switch(d){case m.WIRE_TYPES.VARINT:do c=b.readUint8();while(128===(c&128));break;case m.WIRE_TYPES.BITS64:b.offset+=8;break;case m.WIRE_TYPES.LDELIM:c=b.readVarint32();b.offset+=c;break;case m.WIRE_TYPES.STARTGROUP:k(c,b);break;case m.WIRE_TYPES.ENDGROUP:if(c===a)return!1;throw Error("Illegal GROUPEND after unknown group: "+c+" ("+a+" expected)");case m.WIRE_TYPES.BITS32:b.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+a+": "+d);}return!0}
function l(a,b){if(a&&"number"===typeof a.low&&"number"===typeof a.high&&"boolean"===typeof a.unsigned&&a.low===a.low&&a.high===a.high)return new m.Long(a.low,a.high,"undefined"===typeof b?a.unsigned:b);if("string"===typeof a)return m.Long.fromString(a,b||!1,10);if("number"===typeof a)return m.Long.fromNumber(a,b||!1);throw Error("not convertible to Long");}var q={},c=function(a,b,c){this.builder=a;this.parent=b;this.name=c},f=c.prototype;f.fqn=function(){var a=this.name,b=this;do{b=b.parent;if(null==
b)break;a=b.name+"."+a}while(1);return a};f.toString=function(a){return(a?this.className+" ":"")+this.fqn()};f.build=function(){throw Error(this.toString(!0)+" cannot be built directly");};q.T=c;var d=function(a,b,d,f){c.call(this,a,b,d);this.className="Namespace";this.children=[];this.options=f||{}},f=d.prototype=Object.create(c.prototype);f.getChildren=function(a){a=a||null;if(null==a)return this.children.slice();for(var b=[],c=0,d=this.children.length;c<d;++c)this.children[c]instanceof a&&b.push(this.children[c]);
return b};f.addChild=function(b){var c;if(c=this.getChild(b.name))if(c instanceof a.Field&&c.name!==c.originalName&&null===this.getChild(c.originalName))c.name=c.originalName;else if(b instanceof a.Field&&b.name!==b.originalName&&null===this.getChild(b.originalName))b.name=b.originalName;else throw Error("Duplicate name in namespace "+this.toString(!0)+": "+b.name);this.children.push(b)};f.getChild=function(a){for(var b="number"===typeof a?"id":"name",c=0,d=this.children.length;c<d;++c)if(this.children[c][b]===
a)return this.children[c];return null};f.resolve=function(a,b){var c=a.split("."),d=this,f=0;if(""===c[f]){for(;null!==d.parent;)d=d.parent;f++}do{do{d=d.getChild(c[f]);if(!(d&&d instanceof q.T)||b&&d instanceof q.Message.Field){d=null;break}f++}while(f<c.length);if(null!=d)break;if(null!==this.parent)return this.parent.resolve(a,b)}while(null!=d);return d};f.build=function(){for(var a={},b=this.children,c=0,f=b.length,e;c<f;++c)e=b[c],e instanceof d&&(a[e.name]=e.build());Object.defineProperty&&
Object.defineProperty(a,"$options",{value:this.buildOpt()});return a};f.buildOpt=function(){for(var a={},b=Object.keys(this.options),c=0,d=b.length;c<d;++c)a[b[c]]=this.options[b[c]];return a};f.getOption=function(a){return"undefined"===typeof a?this.options:"undefined"!==typeof this.options[a]?this.options[a]:null};q.Namespace=d;var a=function(a,b,c,f,e){d.call(this,a,b,c,f);this.className="Message";this.extensions=[m.ID_MIN,m.ID_MAX];this.clazz=null;this.isGroup=!!e;this._fieldsByName=this._fieldsById=
this._fields=null},b=a.prototype=Object.create(d.prototype);b.build=function(b){if(this.clazz&&!b)return this.clazz;b=function(a,b){function c(a,b){var d={},f;for(f in a)a.hasOwnProperty(f)&&(null===a[f]||"object"!==typeof a[f]?d[f]=a[f]:a[f]instanceof g?b&&(d[f]=a.toBuffer()):d[f]=c(a[f],b));return d}var d=b.getChildren(a.Reflect.Message.Field),f=b.getChildren(a.Reflect.Message.OneOf),e=function(b,c){a.Builder.Message.call(this);for(var e=0,n=f.length;e<n;++e)this[f[e].name]=null;e=0;for(n=d.length;e<
n;++e){var h=d[e];this[h.name]=h.repeated?[]:null;h.required&&null!==h.defaultValue&&(this[h.name]=h.defaultValue)}if(0<arguments.length)if(1!==arguments.length||"object"!==typeof b||"function"===typeof b.encode||a.Util.isArray(b)||b instanceof g||b instanceof ArrayBuffer||a.Long&&b instanceof a.Long)for(e=0,n=arguments.length;e<n;++e)this.$set(d[e].name,arguments[e]);else for(h=Object.keys(b),e=0,n=h.length;e<n;++e)this.$set(h[e],b[h[e]])},n=e.prototype=Object.create(a.Builder.Message.prototype);
n.add=function(c,d,f){var e=b._fieldsByName[c];if(!f){if(!e)throw Error(this+"#"+c+" is undefined");if(!(e instanceof a.Reflect.Message.Field))throw Error(this+"#"+c+" is not a field: "+e.toString(!0));if(!e.repeated)throw Error(this+"#"+c+" is not a repeated field");}null===this[e.name]&&(this[e.name]=[]);this[e.name].push(f?d:e.verifyValue(d,!0))};n.$add=n.add;n.set=function(c,d,f){if(c&&"object"===typeof c){for(var e in c)c.hasOwnProperty(e)&&this.$set(e,c[e],f);return this}e=b._fieldsByName[c];
if(f)this[e.name]=d;else{if(!e)throw Error(this+"#"+c+" is not a field: undefined");if(!(e instanceof a.Reflect.Message.Field))throw Error(this+"#"+c+" is not a field: "+e.toString(!0));this[e.name]=d=e.verifyValue(d)}e.oneof&&(null!==d?(null!==this[e.oneof.name]&&(this[this[e.oneof.name]]=null),this[e.oneof.name]=e.name):e.oneof.name===c&&(this[e.oneof.name]=null));return this};n.$set=n.set;n.get=function(c,d){if(d)return this[c];var f=b._fieldsByName[c];if(!(f&&f instanceof a.Reflect.Message.Field))throw Error(this+
"#"+c+" is not a field: undefined");if(!(f instanceof a.Reflect.Message.Field))throw Error(this+"#"+c+" is not a field: "+f.toString(!0));return this[f.name]};n.$get=n.get;for(var h=0;h<d.length;h++){var m=d[h];m instanceof a.Reflect.Message.ExtensionField||b.builder.options.populateAccessors&&function(a){var c=a.originalName.replace(/(_[a-zA-Z])/g,function(a){return a.toUpperCase().replace("_","")}),c=c.substring(0,1).toUpperCase()+c.substring(1),d=a.originalName.replace(/([A-Z])/g,function(a){return"_"+
a}),f=function(b,c){this[a.name]=c?b:a.verifyValue(b);return this},e=function(){return this[a.name]};null===b.getChild("set"+c)&&(n["set"+c]=f);null===b.getChild("set_"+d)&&(n["set_"+d]=f);null===b.getChild("get"+c)&&(n["get"+c]=e);null===b.getChild("get_"+d)&&(n["get_"+d]=e)}(m)}n.encode=function(a,c){"boolean"===typeof a&&(c=a,a=void 0);var d=!1;a||(a=new g,d=!0);var f=a.littleEndian;try{return b.encode(this,a.LE(),c),(d?a.flip():a).LE(f)}catch(e){throw a.LE(f),e;}};n.calculate=function(){return b.calculate(this)};
n.encodeDelimited=function(a){var c=!1;a||(a=new g,c=!0);var d=(new g).LE();b.encode(this,d).flip();a.writeVarint32(d.remaining());a.append(d);return c?a.flip():a};n.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(a){throw a.encoded&&(a.encoded=a.encoded.toArrayBuffer()),a;}};n.toArrayBuffer=n.encodeAB;n.encodeNB=function(){try{return this.encode().toBuffer()}catch(a){throw a.encoded&&(a.encoded=a.encoded.toBuffer()),a;}};n.toBuffer=n.encodeNB;n.encode64=function(){try{return this.encode().toBase64()}catch(a){throw a.encoded&&
(a.encoded=a.encoded.toBase64()),a;}};n.toBase64=n.encode64;n.encodeHex=function(){try{return this.encode().toHex()}catch(a){throw a.encoded&&(a.encoded=a.encoded.toHex()),a;}};n.toHex=n.encodeHex;n.toRaw=function(a){return c(this,!!a)};e.decode=function(a,c){"string"===typeof a&&(a=g.wrap(a,c?c:"base64"));a=a instanceof g?a:g.wrap(a);var d=a.littleEndian;try{var f=b.decode(a.LE());a.LE(d);return f}catch(e){throw a.LE(d),e;}};e.decodeDelimited=function(a,c){"string"===typeof a&&(a=g.wrap(a,c?c:"base64"));
a=a instanceof g?a:g.wrap(a);if(1>a.remaining())return null;var d=a.offset,f=a.readVarint32();if(a.remaining()<f)return a.offset=d,null;try{var e=b.decode(a.slice(a.offset,a.offset+f).LE());a.offset+=f;return e}catch(n){throw a.offset+=f,n;}};e.decode64=function(a){return e.decode(a,"base64")};e.decodeHex=function(a){return e.decode(a,"hex")};n.toString=function(){return b.toString()};Object.defineProperty&&(Object.defineProperty(e,"$options",{value:b.buildOpt()}),Object.defineProperty(n,"$type",
{get:function(){return b}}));return e}(m,this);this._fields=[];this._fieldsById={};this._fieldsByName={};for(var c=0,d=this.children.length,f;c<d;c++)if(f=this.children[c],f instanceof h)b[f.name]=f.build();else if(f instanceof a)b[f.name]=f.build();else if(f instanceof a.Field)f.build(),this._fields.push(f),this._fieldsById[f.id]=f,this._fieldsByName[f.name]=f;else if(!(f instanceof a.OneOf||f instanceof u))throw Error("Illegal reflect child of "+this.toString(!0)+": "+children[c].toString(!0));
return this.clazz=b};b.encode=function(a,b,c){for(var d=null,f,e=0,g=this._fields.length,h;e<g;++e)f=this._fields[e],h=a[f.name],f.required&&null===h?null===d&&(d=f):f.encode(c?h:f.verifyValue(h),b);if(null!==d)throw a=Error("Missing at least one required field for "+this.toString(!0)+": "+d),a.encoded=b,a;return b};b.calculate=function(a){for(var b=0,c=0,d=this._fields.length,f,e;c<d;++c){f=this._fields[c];e=a[f.name];if(f.required&&null===e)throw Error("Missing at least one required field for "+
this.toString(!0)+": "+f);b+=f.calculate(e)}return b};b.decode=function(a,b,c){b="number"===typeof b?b:-1;for(var d=a.offset,f=new this.clazz,e,g,h;a.offset<d+b||-1===b&&0<a.remaining();){e=a.readVarint32();g=e&7;h=e>>3;if(g===m.WIRE_TYPES.ENDGROUP){if(h!==c)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+h+" ("+(c?c+" expected":"not a group")+")");break}if(e=this._fieldsById[h])e.repeated&&!e.options.packed?f[e.name].push(e.decode(g,a)):(f[e.name]=e.decode(g,a),e.oneof&&(null!==
this[e.oneof.name]&&(this[this[e.oneof.name]]=null),f[e.oneof.name]=e.name));else switch(g){case m.WIRE_TYPES.VARINT:a.readVarint32();break;case m.WIRE_TYPES.BITS32:a.offset+=4;break;case m.WIRE_TYPES.BITS64:a.offset+=8;break;case m.WIRE_TYPES.LDELIM:e=a.readVarint32();a.offset+=e;break;case m.WIRE_TYPES.STARTGROUP:for(;k(h,a););break;default:throw Error("Illegal wire type for unknown field "+h+" in "+this.toString(!0)+"#decode: "+g);}}a=0;for(b=this._fields.length;a<b;++a)if(e=this._fields[a],null===
f[e.name]){if(e.required)throw a=Error("Missing at least one required field for "+this.toString(!0)+": "+e.name),a.decoded=f,a;null!==e.defaultValue&&(f[e.name]=e.defaultValue)}return f};q.Message=a;var e=function(b,d,f,g,h,m,k,l){c.call(this,b,d,h);this.className="Message.Field";this.required="required"===f;this.repeated="repeated"===f;this.type=g;this.resolvedType=null;this.id=m;this.options=k||{};this.defaultValue=null;this.oneof=l||null;this.originalName=this.name;!this.builder.options.convertFieldsToCamelCase||
this instanceof a.ExtensionField||(this.name=e._toCamelCase(this.name))};e._toCamelCase=function(a){return a.replace(/_([a-zA-Z])/g,function(a,b){return b.toUpperCase()})};b=e.prototype=Object.create(c.prototype);b.build=function(){this.defaultValue="undefined"!==typeof this.options["default"]?this.verifyValue(this.options["default"]):null};b.verifyValue=function(a,b){b=b||!1;var c=function(a,b){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+a+" ("+b+")");}.bind(this);
if(null===a)return this.required&&c(typeof a,"required"),null;var d;if(this.repeated&&!b){m.Util.isArray(a)||(a=[a]);c=[];for(d=0;d<a.length;d++)c.push(this.verifyValue(a[d],!0));return c}!this.repeated&&m.Util.isArray(a)&&c(typeof a,"no array expected");switch(this.type){case m.TYPES.int32:case m.TYPES.sint32:case m.TYPES.sfixed32:return("number"!==typeof a||a===a&&0!==a%1)&&c(typeof a,"not an integer"),4294967295<a?a|0:a;case m.TYPES.uint32:case m.TYPES.fixed32:return("number"!==typeof a||a===a&&
0!==a%1)&&c(typeof a,"not an integer"),0>a?a>>>0:a;case m.TYPES.int64:case m.TYPES.sint64:case m.TYPES.sfixed64:if(m.Long)try{return l(a,!1)}catch(f){c(typeof a,f.message)}else c(typeof a,"requires Long.js");case m.TYPES.uint64:case m.TYPES.fixed64:if(m.Long)try{return l(a,!0)}catch(e){c(typeof a,e.message)}else c(typeof a,"requires Long.js");case m.TYPES.bool:return"boolean"!==typeof a&&c(typeof a,"not a boolean"),a;case m.TYPES["float"]:case m.TYPES["double"]:return"number"!==typeof a&&c(typeof a,
"not a number"),a;case m.TYPES.string:return"string"===typeof a||a&&a instanceof String||c(typeof a,"not a string"),""+a;case m.TYPES.bytes:return a&&a instanceof g?a:g.wrap(a);case m.TYPES["enum"]:var k=this.resolvedType.getChildren(h.Value);for(d=0;d<k.length;d++)if(k[d].name==a||k[d].id==a)return k[d].id;c(a,"not a valid enum value");case m.TYPES.group:case m.TYPES.message:a&&"object"===typeof a||c(typeof a,"object expected");if(a instanceof this.resolvedType.clazz)return a;if(a instanceof m.Builder.Message){c=
{};for(d in a)a.hasOwnProperty(d)&&(c[d]=a[d]);a=c}return new this.resolvedType.clazz(a)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+a+" (undefined type "+this.type+")");};b.encode=function(a,b){if(null===this.type||"object"!==typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===a||this.repeated&&0==a.length)return b;try{if(this.repeated){var c;if(this.options.packed&&0<=m.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)){b.writeVarint32(this.id<<
3|m.WIRE_TYPES.LDELIM);b.ensureCapacity(b.offset+=1);var d=b.offset;for(c=0;c<a.length;c++)this.encodeValue(a[c],b);var f=b.offset-d,e=g.calculateVarint32(f);if(1<e){var h=b.slice(d,b.offset),d=d+(e-1);b.offset=d;b.append(h)}b.writeVarint32(f,d-e)}else for(c=0;c<a.length;c++)b.writeVarint32(this.id<<3|this.type.wireType),this.encodeValue(a[c],b)}else b.writeVarint32(this.id<<3|this.type.wireType),this.encodeValue(a,b)}catch(k){throw Error("Illegal value for "+this.toString(!0)+": "+a+" ("+k+")");
}return b};b.encodeValue=function(a,b){if(null===a)return b;switch(this.type){case m.TYPES.int32:0>a?b.writeVarint64(a):b.writeVarint32(a);break;case m.TYPES.uint32:b.writeVarint32(a);break;case m.TYPES.sint32:b.writeVarint32ZigZag(a);break;case m.TYPES.fixed32:b.writeUint32(a);break;case m.TYPES.sfixed32:b.writeInt32(a);break;case m.TYPES.int64:case m.TYPES.uint64:b.writeVarint64(a);break;case m.TYPES.sint64:b.writeVarint64ZigZag(a);break;case m.TYPES.fixed64:b.writeUint64(a);break;case m.TYPES.sfixed64:b.writeInt64(a);
break;case m.TYPES.bool:"string"===typeof a?b.writeVarint32("false"===a.toLowerCase()?0:!!a):b.writeVarint32(a?1:0);break;case m.TYPES["enum"]:b.writeVarint32(a);break;case m.TYPES["float"]:b.writeFloat32(a);break;case m.TYPES["double"]:b.writeFloat64(a);break;case m.TYPES.string:b.writeVString(a);break;case m.TYPES.bytes:if(0>a.remaining())throw Error("Illegal value for "+this.toString(!0)+": "+a.remaining()+" bytes remaining");var c=a.offset;b.writeVarint32(a.remaining());b.append(a);a.offset=c;
break;case m.TYPES.message:c=(new g).LE();this.resolvedType.encode(a,c);b.writeVarint32(c.offset);b.append(c.flip());break;case m.TYPES.group:this.resolvedType.encode(a,b);b.writeVarint32(this.id<<3|m.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+a+" (unknown type)");}return b};b.calculate=function(a){a=this.verifyValue(a);if(null===this.type||"object"!==typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+
": "+this.type);if(null===a||this.repeated&&0==a.length)return 0;var b=0;try{if(this.repeated){var c,d;if(this.options.packed&&0<=m.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)){b+=g.calculateVarint32(this.id<<3|m.WIRE_TYPES.LDELIM);for(c=d=0;c<a.length;c++)d+=this.calculateValue(a[c]);b+=g.calculateVarint32(d);b+=d}else for(c=0;c<a.length;c++)b+=g.calculateVarint32(this.id<<3|this.type.wireType),b+=this.calculateValue(a[c])}else b+=g.calculateVarint32(this.id<<3|this.type.wireType),b+=this.calculateValue(a)}catch(f){throw Error("Illegal value for "+
this.toString(!0)+": "+a+" ("+f+")");}return b};b.calculateValue=function(a){if(null===a)return 0;switch(this.type){case m.TYPES.int32:return 0>a?g.calculateVarint64(a):g.calculateVarint32(a);case m.TYPES.uint32:return g.calculateVarint32(a);case m.TYPES.sint32:return g.calculateVarint32(g.zigZagEncode32(a));case m.TYPES.fixed32:case m.TYPES.sfixed32:case m.TYPES["float"]:return 4;case m.TYPES.int64:case m.TYPES.uint64:return g.calculateVarint64(a);case m.TYPES.sint64:return g.calculateVarint64(g.zigZagEncode64(a));
case m.TYPES.fixed64:case m.TYPES.sfixed64:return 8;case m.TYPES.bool:return 1;case m.TYPES["enum"]:return g.calculateVarint32(a);case m.TYPES["double"]:return 8;case m.TYPES.string:return a=g.calculateUTF8Bytes(a),g.calculateVarint32(a)+a;case m.TYPES.bytes:if(0>a.remaining())throw Error("Illegal value for "+this.toString(!0)+": "+a.remaining()+" bytes remaining");return g.calculateVarint32(a.remaining())+a.remaining();case m.TYPES.message:return a=this.resolvedType.calculate(a),g.calculateVarint32(a)+
a;case m.TYPES.group:return a=this.resolvedType.calculate(a),a+g.calculateVarint32(this.id<<3|m.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+a+" (unknown type)");};b.decode=function(a,b,c){if(a!=this.type.wireType&&(c||a!=m.WIRE_TYPES.LDELIM||!this.repeated))throw Error("Illegal wire type for field "+this.toString(!0)+": "+a+" ("+this.type.wireType+" expected)");if(a==m.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&0<=m.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)&&
!c){a=b.readVarint32();a=b.offset+a;for(c=[];b.offset<a;)c.push(this.decode(this.type.wireType,b,!0));return c}switch(this.type){case m.TYPES.int32:return b.readVarint32()|0;case m.TYPES.uint32:return b.readVarint32()>>>0;case m.TYPES.sint32:return b.readVarint32ZigZag()|0;case m.TYPES.fixed32:return b.readUint32()>>>0;case m.TYPES.sfixed32:return b.readInt32()|0;case m.TYPES.int64:return b.readVarint64();case m.TYPES.uint64:return b.readVarint64().toUnsigned();case m.TYPES.sint64:return b.readVarint64ZigZag();
case m.TYPES.fixed64:return b.readUint64();case m.TYPES.sfixed64:return b.readInt64();case m.TYPES.bool:return!!b.readVarint32();case m.TYPES["enum"]:return b.readVarint32();case m.TYPES["float"]:return b.readFloat();case m.TYPES["double"]:return b.readDouble();case m.TYPES.string:return b.readVString();case m.TYPES.bytes:a=b.readVarint32();if(b.remaining()<a)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+a+" required but got only "+b.remaining());c=b.clone();c.limit=c.offset+a;
b.offset+=a;return c;case m.TYPES.message:return a=b.readVarint32(),this.resolvedType.decode(b,a);case m.TYPES.group:return this.resolvedType.decode(b,-1,this.id)}throw Error("[INTERNAL] Illegal wire type for "+this.toString(!0)+": "+a);};q.Message.Field=e;b=function(a,b,c,d,f,g,h){e.call(this,a,b,c,d,f,g,h)};b.prototype=Object.create(e.prototype);q.Message.ExtensionField=b;q.Message.OneOf=function(a,b,d){c.call(this,a,b,d);this.fields=[]};var h=function(a,b,c,f){d.call(this,a,b,c,f);this.className=
"Enum";this.object=null};(h.prototype=Object.create(d.prototype)).build=function(){for(var a={},b=this.getChildren(h.Value),c=0,d=b.length;c<d;++c)a[b[c].name]=b[c].id;Object.defineProperty&&Object.defineProperty(a,"$options",{value:this.buildOpt()});return this.object=a};q.Enum=h;b=function(a,b,d,f){c.call(this,a,b,d);this.className="Enum.Value";this.id=f};b.prototype=Object.create(c.prototype);q.Enum.Value=b;var u=function(a,b,d,f){c.call(this,a,b,d);this.field=f};u.prototype=Object.create(c.prototype);
q.Extension=u;b=function(a,b,c,f){d.call(this,a,b,c,f);this.className="Service";this.clazz=null};(b.prototype=Object.create(d.prototype)).build=function(a){return this.clazz&&!a?this.clazz:this.clazz=function(a,b){var c=function(b){a.Builder.Service.call(this);this.rpcImpl=b||function(a,b,c){setTimeout(c.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},d=c.prototype=Object.create(a.Builder.Service.prototype);Object.defineProperty&&(Object.defineProperty(c,
"$options",{value:b.buildOpt()}),Object.defineProperty(d,"$options",{value:c.$options}));for(var f=b.getChildren(a.Reflect.Service.RPCMethod),e=0;e<f.length;e++)(function(a){d[a.name]=function(c,d){try{c&&c instanceof a.resolvedRequestType.clazz?this.rpcImpl(a.fqn(),c,function(c,f){if(c)d(c);else{try{f=a.resolvedResponseType.clazz.decode(f)}catch(e){}f&&f instanceof a.resolvedResponseType.clazz?d(null,f):d(Error("Illegal response type received in service method "+b.name+"#"+a.name))}}):setTimeout(d.bind(this,
Error("Illegal request type provided to service method "+b.name+"#"+a.name)),0)}catch(f){setTimeout(d.bind(this,f),0)}};c[a.name]=function(b,d,f){(new c(b))[a.name](d,f)};Object.defineProperty&&(Object.defineProperty(c[a.name],"$options",{value:a.buildOpt()}),Object.defineProperty(d[a.name],"$options",{value:c[a.name].$options}))})(f[e]);return c}(m,this)};q.Service=b;var t=function(a,b,d,f){c.call(this,a,b,d);this.className="Service.Method";this.options=f||{}};(t.prototype=Object.create(c.prototype)).buildOpt=
f.buildOpt;q.Service.Method=t;f=function(a,b,c,d,f,e){t.call(this,a,b,c,e);this.className="Service.RPCMethod";this.requestName=d;this.responseName=f;this.resolvedResponseType=this.resolvedRequestType=null};f.prototype=Object.create(t.prototype);q.Service.RPCMethod=f;return q}(l);l.Builder=function(g,k,l){var q=function(c){this.ptr=this.ns=new l.Namespace(this,null,"");this.resolved=!1;this.result=null;this.files={};this.importRoot=null;this.options=c||{}},c=q.prototype;c.reset=function(){this.ptr=
this.ns};c.define=function(c,d){if("string"!==typeof c||!k.TYPEREF.test(c))throw Error("Illegal package: "+c);var a=c.split("."),b;for(b=0;b<a.length;b++)if(!k.NAME.test(a[b]))throw Error("Illegal package: "+a[b]);for(b=0;b<a.length;b++)null===this.ptr.getChild(a[b])&&this.ptr.addChild(new l.Namespace(this,this.ptr,a[b],d)),this.ptr=this.ptr.getChild(a[b]);return this};q.isValidMessage=function(c){if("string"!==typeof c.name||!k.NAME.test(c.name)||"undefined"!==typeof c.values||"undefined"!==typeof c.rpc)return!1;
var d;if("undefined"!==typeof c.fields){if(!g.Util.isArray(c.fields))return!1;var a=[],b;for(d=0;d<c.fields.length;d++){if(!q.isValidMessageField(c.fields[d]))return!1;b=parseInt(c.fields[d].id,10);if(0<=a.indexOf(b))return!1;a.push(b)}}if("undefined"!==typeof c.enums){if(!g.Util.isArray(c.enums))return!1;for(d=0;d<c.enums.length;d++)if(!q.isValidEnum(c.enums[d]))return!1}if("undefined"!==typeof c.messages){if(!g.Util.isArray(c.messages))return!1;for(d=0;d<c.messages.length;d++)if(!q.isValidMessage(c.messages[d])&&
!q.isValidExtend(c.messages[d]))return!1}return"undefined"===typeof c.extensions||g.Util.isArray(c.extensions)&&2===c.extensions.length&&"number"===typeof c.extensions[0]&&"number"===typeof c.extensions[1]?!0:!1};q.isValidMessageField=function(c){if("string"!==typeof c.rule||"string"!==typeof c.name||"string"!==typeof c.type||"undefined"===typeof c.id||!(k.RULE.test(c.rule)&&k.NAME.test(c.name)&&k.TYPEREF.test(c.type)&&k.ID.test(""+c.id)))return!1;if("undefined"!==typeof c.options){if("object"!==
typeof c.options)return!1;for(var d=Object.keys(c.options),a=0,b;a<d.length;a++)if("string"!==typeof(b=d[a])||"string"!==typeof c.options[b]&&"number"!==typeof c.options[b]&&"boolean"!==typeof c.options[b])return!1}return!0};q.isValidEnum=function(c){if("string"!==typeof c.name||!k.NAME.test(c.name)||"undefined"===typeof c.values||!g.Util.isArray(c.values)||0==c.values.length)return!1;for(var d=0;d<c.values.length;d++)if("object"!=typeof c.values[d]||"string"!==typeof c.values[d].name||"undefined"===
typeof c.values[d].id||!k.NAME.test(c.values[d].name)||!k.NEGID.test(""+c.values[d].id))return!1;return!0};c.create=function(c){if(!c)return this;g.Util.isArray(c)||(c=[c]);if(0==c.length)return this;var d=[];for(d.push(c);0<d.length;){c=d.pop();if(g.Util.isArray(c))for(;0<c.length;){var a=c.shift();if(q.isValidMessage(a)){var b=new l.Message(this,this.ptr,a.name,a.options,a.isGroup),e={};if(a.oneofs)for(var h=Object.keys(a.oneofs),k=0,t=h.length;k<t;++k)b.addChild(e[h[k]]=new l.Message.OneOf(this,
b,h[k]));if(a.fields&&0<a.fields.length)for(k=0,t=a.fields.length;k<t;++k){h=a.fields[k];if(null!==b.getChild(h.id))throw Error("Duplicate field id in message "+b.name+": "+h.id);if(h.options)for(var n=Object.keys(h.options),r=0,v=n.length;r<v;++r){if("string"!==typeof n[r])throw Error("Illegal field option name in message "+b.name+"#"+h.name+": "+n[r]);if("string"!==typeof h.options[n[r]]&&"number"!==typeof h.options[n[r]]&&"boolean"!==typeof h.options[n[r]])throw Error("Illegal field option value in message "+
b.name+"#"+h.name+"#"+n[r]+": "+h.options[n[r]]);}n=null;if("string"===typeof h.oneof&&(n=e[h.oneof],"undefined"===typeof n))throw Error("Illegal oneof in message "+b.name+"#"+h.name+": "+h.oneof);h=new l.Message.Field(this,b,h.rule,h.type,h.name,h.id,h.options,n);n&&n.fields.push(h);b.addChild(h)}e=[];if("undefined"!==typeof a.enums&&0<a.enums.length)for(k=0;k<a.enums.length;k++)e.push(a.enums[k]);if(a.messages&&0<a.messages.length)for(k=0;k<a.messages.length;k++)e.push(a.messages[k]);a.extensions&&
(b.extensions=a.extensions,b.extensions[0]<g.ID_MIN&&(b.extensions[0]=g.ID_MIN),b.extensions[1]>g.ID_MAX&&(b.extensions[1]=g.ID_MAX));this.ptr.addChild(b);0<e.length&&(d.push(c),c=e,this.ptr=b)}else if(q.isValidEnum(a)){b=new l.Enum(this,this.ptr,a.name,a.options);for(k=0;k<a.values.length;k++)b.addChild(new l.Enum.Value(this,b,a.values[k].name,a.values[k].id));this.ptr.addChild(b)}else if(q.isValidService(a)){b=new l.Service(this,this.ptr,a.name,a.options);for(k in a.rpc)a.rpc.hasOwnProperty(k)&&
b.addChild(new l.Service.RPCMethod(this,b,k,a.rpc[k].request,a.rpc[k].response,a.rpc[k].options));this.ptr.addChild(b)}else if(q.isValidExtend(a))if(b=this.ptr.resolve(a.ref))for(k=0;k<a.fields.length;k++){if(null!==b.getChild(a.fields[k].id))throw Error("Duplicate extended field id in message "+b.name+": "+a.fields[k].id);if(a.fields[k].id<b.extensions[0]||a.fields[k].id>b.extensions[1])throw Error("Illegal extended field id in message "+b.name+": "+a.fields[k].id+" ("+b.extensions.join(" to ")+
" expected)");e=a.fields[k].name;this.options.convertFieldsToCamelCase&&(e=l.Message.Field._toCamelCase(a.fields[k].name));h=new l.Message.ExtensionField(this,b,a.fields[k].rule,a.fields[k].type,this.ptr.fqn()+"."+e,a.fields[k].id,a.fields[k].options);e=new l.Extension(this,this.ptr,a.fields[k].name,h);h.extension=e;this.ptr.addChild(e);b.addChild(h)}else{if(!/\.?google\.protobuf\./.test(a.ref))throw Error("Extended message "+a.ref+" is not defined");}else throw Error("Not a valid definition: "+JSON.stringify(a));
}else throw Error("Not a valid namespace: "+JSON.stringify(c));this.ptr=this.ptr.parent}this.resolved=!1;this.result=null;return this};c["import"]=function(c,d){if("string"===typeof d){g.Util.IS_NODE&&(d=require("path").resolve(d));if(!0===this.files[d])return this.reset(),this;this.files[d]=!0}if(c.imports&&0<c.imports.length){var a,b="/",e=!1;if("object"===typeof d){if(this.importRoot=d.root,e=!0,a=this.importRoot,d=d.file,0<=a.indexOf("\\")||0<=d.indexOf("\\"))b="\\"}else"string"===typeof d?this.importRoot?
a=this.importRoot:0<=d.indexOf("/")?(a=d.replace(/\/[^\/]*$/,""),""===a&&(a="/")):0<=d.indexOf("\\")?(a=d.replace(/\\[^\\]*$/,""),b="\\"):a=".":a=null;for(var h=0;h<c.imports.length;h++)if("string"===typeof c.imports[h]){if(!a)throw Error("Cannot determine import root: File name is unknown");var k=c.imports[h];if(!/^google\/protobuf\//.test(k)&&(k=a+b+k,!0!==this.files[k])){/\.proto$/i.test(k)&&!g.DotProto&&(k=k.replace(/\.proto$/,".json"));var l=g.Util.fetch(k);if(null===l)throw Error("Failed to import '"+
k+"' in '"+d+"': File not found");if(/\.json$/i.test(k))this["import"](JSON.parse(l+""),k);else this["import"]((new g.DotProto.Parser(l+"")).parse(),k)}}else if(d)if(/\.(\w+)$/.test(d))this["import"](c.imports[h],d.replace(/^(.+)\.(\w+)$/,function(a,b,c){return b+"_import"+h+"."+c}));else this["import"](c.imports[h],d+"_import"+h);else this["import"](c.imports[h]);e&&(this.importRoot=null)}c.messages&&(c["package"]&&this.define(c["package"],c.options),this.create(c.messages),this.reset());c.enums&&
(c["package"]&&this.define(c["package"],c.options),this.create(c.enums),this.reset());c.services&&(c["package"]&&this.define(c["package"],c.options),this.create(c.services),this.reset());c["extends"]&&(c["package"]&&this.define(c["package"],c.options),this.create(c["extends"]),this.reset());return this};q.isValidService=function(c){return!("string"!==typeof c.name||!k.NAME.test(c.name)||"object"!==typeof c.rpc)};q.isValidExtend=function(c){if("string"!==typeof c.ref||!k.TYPEREF.test(c.ref))return!1;
var d;if("undefined"!==typeof c.fields){if(!g.Util.isArray(c.fields))return!1;var a=[],b;for(d=0;d<c.fields.length;d++){if(!q.isValidMessageField(c.fields[d]))return!1;b=parseInt(c.id,10);if(0<=a.indexOf(b))return!1;a.push(b)}}return!0};c.resolveAll=function(){var c;if(null!=this.ptr&&"object"!==typeof this.ptr.type){if(this.ptr instanceof l.Namespace){c=this.ptr.children;for(var d=0,a=c.length;d<a;++d)this.ptr=c[d],this.resolveAll()}else if(this.ptr instanceof l.Message.Field)if(k.TYPE.test(this.ptr.type))this.ptr.type=
g.TYPES[this.ptr.type];else{if(!k.TYPEREF.test(this.ptr.type))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);c=(this.ptr instanceof l.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0);if(!c)throw Error("Unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.resolvedType=c;if(c instanceof l.Enum)this.ptr.type=g.TYPES["enum"];else if(c instanceof l.Message)this.ptr.type=c.isGroup?g.TYPES.group:
g.TYPES.message;else throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);}else if(!(this.ptr instanceof g.Reflect.Enum.Value))if(this.ptr instanceof g.Reflect.Service.Method)if(this.ptr instanceof g.Reflect.Service.RPCMethod){c=this.ptr.parent.resolve(this.ptr.requestName);if(!(c&&c instanceof g.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);this.ptr.resolvedRequestType=c;c=this.ptr.parent.resolve(this.ptr.responseName);
if(!(c&&c instanceof g.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=c}else throw Error("Illegal service type in "+this.ptr.toString(!0));else if(!(this.ptr instanceof g.Reflect.Message.OneOf||this.ptr instanceof g.Reflect.Extension))throw Error("Illegal object in namespace: "+typeof this.ptr+":"+this.ptr);this.reset()}};c.build=function(c){this.reset();this.resolved||(this.resolveAll(),this.resolved=!0,this.result=
null);null==this.result&&(this.result=this.ns.build());if(c){c=c.split(".");for(var d=this.result,a=0;a<c.length;a++)if(d[c[a]])d=d[c[a]];else{d=null;break}return d}return this.result};c.lookup=function(c){return c?this.ns.resolve(c):this.ns};c.toString=function(){return"Builder"};q.Message=function(){};q.Service=function(){};return q}(l,l.Lang,l.Reflect);l.loadProto=function(g,k,p){if("string"===typeof k||k&&"string"===typeof k.file&&"string"===typeof k.root)p=k,k=void 0;return l.loadJson((new l.DotProto.Parser(g)).parse(),
k,p)};l.protoFromString=l.loadProto;l.loadProtoFile=function(){return l.loadProto(this.ByteBuffer.atob("cGFja2FnZSBNb2R1bGVzOwptZXNzYWdlIHByb2J1ZiB7CgltZXNzYWdlIE5vdGlmeU1zZyB7CgkJcmVxdWlyZWQgaW50MzIgdHlwZSA9IDE7CgkJb3B0aW9uYWwgaW50NjQgdGltZSA9IDI7Cgl9CgltZXNzYWdlIFN5bmNSZXF1ZXN0TXNnIHsKCQlyZXF1aXJlZCBpbnQ2NCBzeW5jVGltZSA9IDE7CgkJcmVxdWlyZWQgYm9vbCBpc3BvbGxpbmcgPSAyOwoJfQoJbWVzc2FnZSBVcFN0cmVhbU1lc3NhZ2UgewoJCXJlcXVpcmVkIGludDMyIHNlc3Npb25JZCA9IDE7CgkJcmVxdWlyZWQgc3RyaW5nIGNsYXNzbmFtZSA9IDI7CgkJcmVxdWlyZWQgYnl0ZXMgY29udGVudCA9IDM7CgkJb3B0aW9uYWwgc3RyaW5nIHB1c2hUZXh0ID0gNDsKCQlvcHRpb25hbCBzdHJpbmcgYXBwRGF0YSA9IDU7Cgl9CgltZXNzYWdlIERvd25TdHJlYW1NZXNzYWdlcyB7CgkJcmVwZWF0ZWQgRG93blN0cmVhbU1lc3NhZ2UgbGlzdCA9IDE7CgkJcmVxdWlyZWQgaW50NjQgc3luY1RpbWUgPSAyOwoJfQoJbWVzc2FnZSBEb3duU3RyZWFtTWVzc2FnZSB7CgkJcmVxdWlyZWQgc3RyaW5nIGZyb21Vc2VySWQgPSAxOwoJCXJlcXVpcmVkIENoYW5uZWxUeXBlIHR5cGUgPSAyOwoJCW9wdGlvbmFsIHN0cmluZyBncm91cElkID0gMzsKCQlyZXF1aXJlZCBzdHJpbmcgY2xhc3NuYW1lID0gNDsKCQlyZXF1aXJlZCBieXRlcyBjb250ZW50ID0gNTsKCQlyZXF1aXJlZCBpbnQ2NCBkYXRhVGltZSA9IDY7CgkJcmVxdWlyZWQgaW50NjQgc3RhdHVzID0gNzsKCX0KCWVudW0gQ2hhbm5lbFR5cGUgewoJCVBFUlNPTiA9IDE7CgkJUEVSU09OUyA9IDI7CgkJR1JPVVAgPSAzOwoJCVRFTVBHUk9VUCA9IDQ7CgkJQ1VTVE9NRVJTRVJWSUNFID0gNTsKCQlOT1RJRlkgPSA2OwoJfQoJbWVzc2FnZSBDcmVhdGVEaXNjdXNzaW9uSW5wdXQgewoJCW9wdGlvbmFsIHN0cmluZyBuYW1lID0gMTsKCX0KCW1lc3NhZ2UgQ3JlYXRlRGlzY3Vzc2lvbk91dHB1dCB7CgkJcmVxdWlyZWQgc3RyaW5nIGlkID0gMTsKCX0KCW1lc3NhZ2UgQ2hhbm5lbEludml0YXRpb25JbnB1dCB7CgkJcmVwZWF0ZWQgc3RyaW5nIHVzZXJzID0gMTsKCX0KCW1lc3NhZ2UgTGVhdmVDaGFubmVsSW5wdXQgewoJCXJlcXVpcmVkIGludDMyIG5vdGhpbmcgPSAxOwoJfQoJbWVzc2FnZSBDaGFubmVsRXZpY3Rpb25JbnB1dCB7CgkJcmVxdWlyZWQgc3RyaW5nIHVzZXIgPSAxOwoJfQoJbWVzc2FnZSBSZW5hbWVDaGFubmVsSW5wdXQgewoJCXJlcXVpcmVkIHN0cmluZyBuYW1lID0gMTsKCX0KCW1lc3NhZ2UgQ2hhbm5lbEluZm9JbnB1dCB7CgkJcmVxdWlyZWQgaW50MzIgbm90aGluZyA9IDE7Cgl9CgltZXNzYWdlIENoYW5uZWxJbmZvT3V0cHV0IHsKCQlyZXF1aXJlZCBDaGFubmVsVHlwZSB0eXBlID0gMTsKCQlyZXF1aXJlZCBzdHJpbmcgY2hhbm5lbElkID0gMjsKCQlyZXF1aXJlZCBzdHJpbmcgY2hhbm5lbE5hbWUgPSAzOwoJCXJlcXVpcmVkIHN0cmluZyBhZG1pblVzZXJJZCA9IDQ7CgkJcmVwZWF0ZWQgc3RyaW5nIGZpcnN0VGVuVXNlcklkcyA9IDU7CgkJcmVxdWlyZWQgaW50MzIgb3BlblN0YXR1cyA9IDY7Cgl9CgltZXNzYWdlIENoYW5uZWxJbmZvc0lucHV0IHsKCQlyZXF1aXJlZCBpbnQzMiBwYWdlID0gMTsKCQlvcHRpb25hbCBpbnQzMiBudW1iZXIgPSAyOwoJfQoJbWVzc2FnZSBDaGFubmVsSW5mb3NPdXRwdXQgewoJCXJlcGVhdGVkIENoYW5uZWxJbmZvT3V0cHV0IGNoYW5uZWxzID0gMTsKCQlyZXF1aXJlZCBpbnQzMiB0b3RhbCA9IDI7Cgl9CgltZXNzYWdlIE1lbWJlckluZm8gewoJCXJlcXVpcmVkIHN0cmluZyB1c2VySWQgPSAxOwoJCXJlcXVpcmVkIHN0cmluZyB1c2VyTmFtZSA9IDI7CgkJcmVxdWlyZWQgc3RyaW5nIHVzZXJQb3J0cmFpdCA9IDM7CgkJcmVxdWlyZWQgc3RyaW5nIGV4dGVuc2lvbiA9IDQ7Cgl9CgltZXNzYWdlIEdyb3VwTWVtYmVyc0lucHV0IHsKCQlyZXF1aXJlZCBpbnQzMiBwYWdlID0gMTsKCQlvcHRpb25hbCBpbnQzMiBudW1iZXIgPSAyOwoJfQoJbWVzc2FnZSBHcm91cE1lbWJlcnNPdXRwdXQgewoJCXJlcGVhdGVkIE1lbWJlckluZm8gbWVtYmVycyA9IDE7CgkJcmVxdWlyZWQgaW50MzIgdG90YWwgPSAyOwoJfQoJbWVzc2FnZSBHZXRVc2VySW5mb0lucHV0IHsKCQlyZXF1aXJlZCBpbnQzMiBub3RoaW5nID0gMTsKCX0KCW1lc3NhZ2UgR2V0VXNlckluZm9PdXRwdXQgewoJCXJlcXVpcmVkIHN0cmluZyB1c2VySWQgPSAxOwoJCXJlcXVpcmVkIHN0cmluZyB1c2VyTmFtZSA9IDI7CgkJcmVxdWlyZWQgc3RyaW5nIHVzZXJQb3J0cmFpdCA9IDM7Cgl9CgltZXNzYWdlIEdldFNlc3Npb25JZElucHV0IHsKCQlyZXF1aXJlZCBpbnQzMiBub3RoaW5nID0gMTsKCX0KCW1lc3NhZ2UgR2V0U2Vzc2lvbklkT3V0cHV0IHsKCQlyZXF1aXJlZCBpbnQzMiBzZXNzaW9uSWQgPSAxOwoJfQoJZW51bSBGaWxlVHlwZSB7CgkJaW1hZ2UgPSAxOwoJCWF1ZGlvID0gMjsKCQl2aWRlbyA9IDM7Cgl9CgltZXNzYWdlIEdldFFOdXBUb2tlbklucHV0IHsKCQlyZXF1aXJlZCBGaWxlVHlwZSB0eXBlID0gMTsKCX0KCW1lc3NhZ2UgR2V0UU5kb3dubG9hZFVybElucHV0IHsKCQlyZXF1aXJlZCBGaWxlVHlwZSB0eXBlID0gMTsKCQlyZXF1aXJlZCBzdHJpbmcga2V5ID0gMjsKCX0KCW1lc3NhZ2UgR2V0UU51cFRva2VuT3V0cHV0IHsKCQlyZXF1aXJlZCBpbnQ2NCBkZWFkbGluZSA9IDE7CgkJcmVxdWlyZWQgc3RyaW5nIHRva2VuID0gMjsKCX0KCW1lc3NhZ2UgR2V0UU5kb3dubG9hZFVybE91dHB1dCB7CgkJcmVxdWlyZWQgc3RyaW5nIGRvd25sb2FkVXJsID0gMTsKCX0KCW1lc3NhZ2UgQWRkMkJsYWNrTGlzdElucHV0IHsKCQlyZXF1aXJlZCBzdHJpbmcgdXNlcklkID0gMTsKCX0KCW1lc3NhZ2UgUmVtb3ZlRnJvbUJsYWNrTGlzdElucHV0IHsKCQlyZXF1aXJlZCBzdHJpbmcgdXNlcklkID0gMTsKCX0KCW1lc3NhZ2UgUXVlcnlCbGFja0xpc3RJbnB1dCB7CgkJcmVxdWlyZWQgaW50MzIgbm90aGluZyA9IDE7Cgl9CgltZXNzYWdlIFF1ZXJ5QmxhY2tMaXN0T3V0cHV0IHsKCQlyZXBlYXRlZCBzdHJpbmcgdXNlcklkcyA9IDE7Cgl9CgltZXNzYWdlIEJsYWNrTGlzdFN0YXR1c0lucHV0IHsKCQlyZXF1aXJlZCBzdHJpbmcgdXNlcklkID0gMTsKCX0KCW1lc3NhZ2UgQmxvY2tQdXNoSW5wdXQgewoJCXJlcXVpcmVkIHN0cmluZyBibG9ja2VlSWQgPSAxOwoJfQoJbWVzc2FnZSBNb2RpZnlQZXJtaXNzaW9uSW5wdXQgewoJCXJlcXVpcmVkIGludDMyIG9wZW5TdGF0dXMgPSAxOwoJfQoJbWVzc2FnZSBHcm91cElucHV0IHsKCQlyZXBlYXRlZCBHcm91cEluZm8gZ3JvdXBJbmZvID0gMTsKCX0KCW1lc3NhZ2UgR3JvdXBPdXRwdXQgewoJCXJlcXVpcmVkIGludDMyIG5vdGhpbmcgPSAxOwoJfQoJbWVzc2FnZSBHcm91cEluZm8gewoJCXJlcXVpcmVkIHN0cmluZyBpZCA9IDE7CgkJcmVxdWlyZWQgc3RyaW5nIG5hbWUgPSAyOwoJfQoJbWVzc2FnZSBHcm91cEhhc2hJbnB1dCB7CgkJcmVxdWlyZWQgc3RyaW5nIHVzZXJJZCA9IDE7CgkJcmVxdWlyZWQgc3RyaW5nIGdyb3VwSGFzaENvZGUgPSAyOwoJfQoJbWVzc2FnZSBHcm91cEhhc2hPdXRwdXQgewoJCXJlcXVpcmVkIEdyb3VwSGFzaFR5cGUgcmVzdWx0ID0gMTsKCX0KCWVudW0gR3JvdXBIYXNoVHlwZSB7CgkJZ3JvdXBfc3VjY2VzcyA9IDB4MDA7CgkJZ3JvdXBfZmFpbHVyZSA9IDB4MDE7Cgl9CgltZXNzYWdlIENocm1JbnB1dCB7CgkJcmVxdWlyZWQgaW50MzIgbm90aGluZyA9IDE7Cgl9CgltZXNzYWdlIENocm1PdXRwdXQgewoJCXJlcXVpcmVkIGludDMyIG5vdGhpbmcgPSAxOwoJfQoJbWVzc2FnZSBDaHJtUHVsbE1zZyB7CgkJcmVxdWlyZWQgaW50NjQgc3luY1RpbWUgPSAxOwoJCXJlcXVpcmVkIGludDMyIGNvdW50ID0gMjsKCX0KCW1lc3NhZ2UgUmVsYXRpb25zSW5wdXQKCXsKCQlyZXF1aXJlZCBDaGFubmVsVHlwZSB0eXBlID0gMTsKCX0KCW1lc3NhZ2UgUmVsYXRpb25zT3V0cHV0Cgl7CgkJcmVwZWF0ZWQgUmVsYXRpb25JbmZvIGluZm8gPSAxOwoJfQoJbWVzc2FnZSBSZWxhdGlvbkluZm8KCXsKCQlyZXF1aXJlZCBDaGFubmVsVHlwZSB0eXBlID0gMTsKCQlyZXF1aXJlZCBzdHJpbmcgdXNlcklkID0gMjsKCX0KCW1lc3NhZ2UgSGlzdG9yeU1lc3NhZ2VJbnB1dCAKCXsKCQlyZXF1aXJlZCBzdHJpbmcgdGFyZ2V0SWQgPSAxOyAKCQlyZXF1aXJlZCBpbnQ2NCBkYXRhVGltZSA9MjsgCgkJcmVxdWlyZWQgaW50MzIgc2l6ZSAgPSAzOwoJfQoKCW1lc3NhZ2UgSGlzdG9yeU1lc3NhZ2VzT3VwdXQgIAoJewoJCXJlcGVhdGVkIERvd25TdHJlYW1NZXNzYWdlIGxpc3QgPSAxOwoJCXJlcXVpcmVkIGludDY0IHN5bmNUaW1lID0gMjsKCQlyZXF1aXJlZCBpbnQzMiBoYXNNc2cgPSAzOyAKCX0KfQ=="),
void 0,"")};l.protoFromFile=l.loadProtoFile;l.newBuilder=function(g){g=g||{};"undefined"===typeof g.convertFieldsToCamelCase&&(g.convertFieldsToCamelCase=l.convertFieldsToCamelCase);"undefined"===typeof g.populateAccessors&&(g.populateAccessors=l.populateAccessors);return new l.Builder(g)};l.loadJson=function(g,k,p){if("string"===typeof k||k&&"string"===typeof k.file&&"string"===typeof k.root)p=k,k=null;k&&"object"===typeof k||(k=l.newBuilder());"string"===typeof g&&(g=JSON.parse(g));k["import"](g,
p);k.resolveAll();k.build();return k};l.loadJsonFile=function(g,k,p){k&&"object"===typeof k?(p=k,k=null):k&&"function"===typeof k||(k=null);if(k)return l.Util.fetch("string"===typeof g?g:g.root+"/"+g.file,function(c){if(null===c)k(Error("Failed to fetch file"));else try{k(null,l.loadJson(JSON.parse(c),p,g))}catch(f){k(f)}});var q=l.Util.fetch("object"===typeof g?g.root+"/"+g.file:g);return null===q?null:l.loadJson(JSON.parse(q),p,g)};return l}"function"===typeof require&&"object"===typeof module&&
module&&module.id&&"object"===typeof exports&&exports?module.exports=g(require("ByteBuffer")):"function"===typeof define&&define.amd?define("ProtoBuf",["ByteBuffer"],function(t){return g(t)}):(t.dcodeIO=t.dcodeIO||{}).ProtoBuf=g(t.dcodeIO.ByteBuffer)})(this);
(function(t){t.dcodeIO&&t.RongIMClient?(t.Modules=t.dcodeIO.ProtoBuf.loadProtoFile().build("Modules").probuf,RongIMClient.connect.token&&RongIMClient.getInstance().connect(RongIMClient.connect.token,RongIMClient.connect.callback)):(require(["ProtoBuf"],function(g){t.Modules=g.loadProtoFile().build("Modules").probuf}),require(["RongIMClient"],function(g){g.connect.token&&g.getInstance().connect(g.connect.token,g.connect.callback)}))})(this);