123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469 |
- var tmp = {};
- (function(global,undefined){"use strict";(function prelude(modules, cache, entries) {
-
-
-
-
- function $require(name) {
- var $module = cache[name];
- if (!$module)
- modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);
- return $module.exports;
- }
-
- var protobuf = global.protobuf = $require(entries[0]);
-
-
-
-
-
-
-
-
-
-
- })({1:[function(require,module,exports){
- "use strict";
- module.exports = asPromise;
- function asPromise(fn, ctx) {
- var params = [];
- for (var i = 2; i < arguments.length;)
- params.push(arguments[i++]);
- var pending = true;
- return new Promise(function asPromiseExecutor(resolve, reject) {
- params.push(function asPromiseCallback(err) {
- if (pending) {
- pending = false;
- if (err)
- reject(err);
- else {
- var args = [];
- for (var i = 1; i < arguments.length;)
- args.push(arguments[i++]);
- resolve.apply(null, args);
- }
- }
- });
- try {
- fn.apply(ctx || this, params);
- } catch (err) {
- if (pending) {
- pending = false;
- reject(err);
- }
- }
- });
- }
- },{}],2:[function(require,module,exports){
- "use strict";
- var base64 = exports;
- base64.length = function length(string) {
- var p = string.length;
- if (!p)
- return 0;
- var n = 0;
- while (--p % 4 > 1 && string.charAt(p) === "=")
- ++n;
- return Math.ceil(string.length * 3) / 4 - n;
- };
- var b64 = new Array(64);
- var s64 = new Array(123);
- for (var i = 0; i < 64;)
- s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
- base64.encode = function encode(buffer, start, end) {
- var string = [];
- var i = 0,
- j = 0,
- t;
- while (start < end) {
- var b = buffer[start++];
- switch (j) {
- case 0:
- string[i++] = b64[b >> 2];
- t = (b & 3) << 4;
- j = 1;
- break;
- case 1:
- string[i++] = b64[t | b >> 4];
- t = (b & 15) << 2;
- j = 2;
- break;
- case 2:
- string[i++] = b64[t | b >> 6];
- string[i++] = b64[b & 63];
- j = 0;
- break;
- }
- }
- if (j) {
- string[i++] = b64[t];
- string[i ] = 61;
- if (j === 1)
- string[i + 1] = 61;
- }
- return String.fromCharCode.apply(String, string);
- };
- var invalidEncoding = "invalid encoding";
- base64.decode = function decode(string, buffer, offset) {
- var start = offset;
- var j = 0,
- t;
- for (var i = 0; i < string.length;) {
- var c = string.charCodeAt(i++);
- if (c === 61 && j > 1)
- break;
- if ((c = s64[c]) === undefined)
- throw Error(invalidEncoding);
- switch (j) {
- case 0:
- t = c;
- j = 1;
- break;
- case 1:
- buffer[offset++] = t << 2 | (c & 48) >> 4;
- t = c;
- j = 2;
- break;
- case 2:
- buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
- t = c;
- j = 3;
- break;
- case 3:
- buffer[offset++] = (t & 3) << 6 | c;
- j = 0;
- break;
- }
- }
- if (j === 1)
- throw Error(invalidEncoding);
- return offset - start;
- };
- base64.test = function test(string) {
- return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);
- };
- },{}],3:[function(require,module,exports){
- "use strict";
- module.exports = EventEmitter;
- function EventEmitter() {
-
- this._listeners = {};
- }
- EventEmitter.prototype.on = function on(evt, fn, ctx) {
- (this._listeners[evt] || (this._listeners[evt] = [])).push({
- fn : fn,
- ctx : ctx || this
- });
- return this;
- };
- EventEmitter.prototype.off = function off(evt, fn) {
- if (evt === undefined)
- this._listeners = {};
- else {
- if (fn === undefined)
- this._listeners[evt] = [];
- else {
- var listeners = this._listeners[evt];
- for (var i = 0; i < listeners.length;)
- if (listeners[i].fn === fn)
- listeners.splice(i, 1);
- else
- ++i;
- }
- }
- return this;
- };
- EventEmitter.prototype.emit = function emit(evt) {
- var listeners = this._listeners[evt];
- if (listeners) {
- var args = [],
- i = 1;
- for (; i < arguments.length;)
- args.push(arguments[i++]);
- for (i = 0; i < listeners.length;)
- listeners[i].fn.apply(listeners[i++].ctx, args);
- }
- return this;
- };
- },{}],4:[function(require,module,exports){
- "use strict";
- module.exports = inquire;
- function inquire(moduleName) {
- try {
- var mod = eval("quire".replace(/^/,"re"))(moduleName);
- if (mod && (mod.length || Object.keys(mod).length))
- return mod;
- } catch (e) {}
- return null;
- }
- },{}],5:[function(require,module,exports){
- "use strict";
- module.exports = pool;
- function pool(alloc, slice, size) {
- var SIZE = size || 8192;
- var MAX = SIZE >>> 1;
- var slab = null;
- var offset = SIZE;
- return function pool_alloc(size) {
- if (size < 1 || size > MAX)
- return alloc(size);
- if (offset + size > SIZE) {
- slab = alloc(SIZE);
- offset = 0;
- }
- var buf = slice.call(slab, offset, offset += size);
- if (offset & 7)
- offset = (offset | 7) + 1;
- return buf;
- };
- }
- },{}],6:[function(require,module,exports){
- "use strict";
- var utf8 = exports;
- utf8.length = function utf8_length(string) {
- var len = 0,
- c = 0;
- for (var i = 0; i < string.length; ++i) {
- c = string.charCodeAt(i);
- if (c < 128)
- len += 1;
- else if (c < 2048)
- len += 2;
- else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {
- ++i;
- len += 4;
- } else
- len += 3;
- }
- return len;
- };
- utf8.read = function utf8_read(buffer, start, end) {
- var len = end - start;
- if (len < 1)
- return "";
- var parts = null,
- chunk = [],
- i = 0,
- t;
- while (start < end) {
- t = buffer[start++];
- if (t < 128)
- chunk[i++] = t;
- else if (t > 191 && t < 224)
- chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;
- else if (t > 239 && t < 365) {
- t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;
- chunk[i++] = 0xD800 + (t >> 10);
- chunk[i++] = 0xDC00 + (t & 1023);
- } else
- chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;
- if (i > 8191) {
- (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
- i = 0;
- }
- }
- if (parts) {
- if (i)
- parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
- return parts.join("");
- }
- return String.fromCharCode.apply(String, chunk.slice(0, i));
- };
- utf8.write = function utf8_write(string, buffer, offset) {
- var start = offset,
- c1,
- c2;
- for (var i = 0; i < string.length; ++i) {
- c1 = string.charCodeAt(i);
- if (c1 < 128) {
- buffer[offset++] = c1;
- } else if (c1 < 2048) {
- buffer[offset++] = c1 >> 6 | 192;
- buffer[offset++] = c1 & 63 | 128;
- } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {
- c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);
- ++i;
- buffer[offset++] = c1 >> 18 | 240;
- buffer[offset++] = c1 >> 12 & 63 | 128;
- buffer[offset++] = c1 >> 6 & 63 | 128;
- buffer[offset++] = c1 & 63 | 128;
- } else {
- buffer[offset++] = c1 >> 12 | 224;
- buffer[offset++] = c1 >> 6 & 63 | 128;
- buffer[offset++] = c1 & 63 | 128;
- }
- }
- return offset - start;
- };
- },{}],7:[function(require,module,exports){
- "use strict";
- var protobuf = exports;
- protobuf.build = "minimal";
- protobuf.roots = {};
- protobuf.Writer = require(14);
- protobuf.BufferWriter = require(15);
- protobuf.Reader = require(8);
- protobuf.BufferReader = require(9);
- protobuf.util = require(13);
- protobuf.rpc = require(10);
- protobuf.configure = configure;
- function configure() {
- protobuf.Reader._configure(protobuf.BufferReader);
- protobuf.util._configure();
- }
- protobuf.Writer._configure(protobuf.BufferWriter);
- configure();
- },{"10":10,"13":13,"14":14,"15":15,"8":8,"9":9}],8:[function(require,module,exports){
- "use strict";
- module.exports = Reader;
- var util = require(13);
- var BufferReader;
- var LongBits = util.LongBits,
- utf8 = util.utf8;
- function indexOutOfRange(reader, writeLength) {
- return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len);
- }
- function Reader(buffer) {
-
- this.buf = buffer;
-
- this.pos = 0;
-
- this.len = buffer.length;
- }
- var create_array = typeof Uint8Array !== "undefined"
- ? function create_typed_array(buffer) {
- if (buffer instanceof Uint8Array || Array.isArray(buffer))
- return new Reader(buffer);
- throw Error("illegal buffer");
- }
-
- : function create_array(buffer) {
- if (Array.isArray(buffer))
- return new Reader(buffer);
- throw Error("illegal buffer");
- };
- Reader.create = util.Buffer
- ? function create_buffer_setup(buffer) {
- return (Reader.create = function create_buffer(buffer) {
- return util.Buffer.isBuffer(buffer)
- ? new BufferReader(buffer)
-
- : create_array(buffer);
- })(buffer);
- }
-
- : create_array;
- Reader.prototype._slice = util.Array.prototype.subarray || util.Array.prototype.slice;
- Reader.prototype.uint32 = (function read_uint32_setup() {
- var value = 4294967295;
- return function read_uint32() {
- value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;
- value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;
- value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;
- value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;
- value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;
-
- if ((this.pos += 5) > this.len) {
- this.pos = this.len;
- throw indexOutOfRange(this, 10);
- }
- return value;
- };
- })();
- Reader.prototype.int32 = function read_int32() {
- return this.uint32() | 0;
- };
- Reader.prototype.sint32 = function read_sint32() {
- var value = this.uint32();
- return value >>> 1 ^ -(value & 1) | 0;
- };
- function readLongVarint() {
-
- var bits = new LongBits(0, 0);
- var i = 0;
- if (this.len - this.pos > 4) {
- for (; i < 4; ++i) {
-
- bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;
- if (this.buf[this.pos++] < 128)
- return bits;
- }
-
- bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;
- bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;
- if (this.buf[this.pos++] < 128)
- return bits;
- i = 0;
- } else {
- for (; i < 3; ++i) {
-
- if (this.pos >= this.len)
- throw indexOutOfRange(this);
-
- bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;
- if (this.buf[this.pos++] < 128)
- return bits;
- }
-
- bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;
- return bits;
- }
- if (this.len - this.pos > 4) {
- for (; i < 5; ++i) {
-
- bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;
- if (this.buf[this.pos++] < 128)
- return bits;
- }
- } else {
- for (; i < 5; ++i) {
-
- if (this.pos >= this.len)
- throw indexOutOfRange(this);
-
- bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;
- if (this.buf[this.pos++] < 128)
- return bits;
- }
- }
-
- throw Error("invalid varint encoding");
- }
- Reader.prototype.bool = function read_bool() {
- return this.uint32() !== 0;
- };
- function readFixed32(buf, end) {
- return (buf[end - 4]
- | buf[end - 3] << 8
- | buf[end - 2] << 16
- | buf[end - 1] << 24) >>> 0;
- }
- Reader.prototype.fixed32 = function read_fixed32() {
-
- if (this.pos + 4 > this.len)
- throw indexOutOfRange(this, 4);
- return readFixed32(this.buf, this.pos += 4);
- };
- Reader.prototype.sfixed32 = function read_sfixed32() {
-
- if (this.pos + 4 > this.len)
- throw indexOutOfRange(this, 4);
- return readFixed32(this.buf, this.pos += 4) | 0;
- };
- function readFixed64() {
-
- if (this.pos + 8 > this.len)
- throw indexOutOfRange(this, 8);
- return new LongBits(readFixed32(this.buf, this.pos += 4), readFixed32(this.buf, this.pos += 4));
- }
- var readFloat = typeof Float32Array !== "undefined"
- ? (function() {
- var f32 = new Float32Array(1),
- f8b = new Uint8Array(f32.buffer);
- f32[0] = -0;
- return f8b[3]
- ? function readFloat_f32(buf, pos) {
- f8b[0] = buf[pos ];
- f8b[1] = buf[pos + 1];
- f8b[2] = buf[pos + 2];
- f8b[3] = buf[pos + 3];
- return f32[0];
- }
-
- : function readFloat_f32_le(buf, pos) {
- f8b[0] = buf[pos + 3];
- f8b[1] = buf[pos + 2];
- f8b[2] = buf[pos + 1];
- f8b[3] = buf[pos ];
- return f32[0];
- };
- })()
-
- : function readFloat_ieee754(buf, pos) {
- var uint = readFixed32(buf, pos + 4),
- sign = (uint >> 31) * 2 + 1,
- exponent = uint >>> 23 & 255,
- mantissa = uint & 8388607;
- return exponent === 255
- ? mantissa
- ? NaN
- : sign * Infinity
- : exponent === 0
- ? sign * 1.401298464324817e-45 * mantissa
- : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);
- };
- Reader.prototype.float = function read_float() {
-
- if (this.pos + 4 > this.len)
- throw indexOutOfRange(this, 4);
- var value = readFloat(this.buf, this.pos);
- this.pos += 4;
- return value;
- };
- var readDouble = typeof Float64Array !== "undefined"
- ? (function() {
- var f64 = new Float64Array(1),
- f8b = new Uint8Array(f64.buffer);
- f64[0] = -0;
- return f8b[7]
- ? function readDouble_f64(buf, pos) {
- f8b[0] = buf[pos ];
- f8b[1] = buf[pos + 1];
- f8b[2] = buf[pos + 2];
- f8b[3] = buf[pos + 3];
- f8b[4] = buf[pos + 4];
- f8b[5] = buf[pos + 5];
- f8b[6] = buf[pos + 6];
- f8b[7] = buf[pos + 7];
- return f64[0];
- }
-
- : function readDouble_f64_le(buf, pos) {
- f8b[0] = buf[pos + 7];
- f8b[1] = buf[pos + 6];
- f8b[2] = buf[pos + 5];
- f8b[3] = buf[pos + 4];
- f8b[4] = buf[pos + 3];
- f8b[5] = buf[pos + 2];
- f8b[6] = buf[pos + 1];
- f8b[7] = buf[pos ];
- return f64[0];
- };
- })()
-
- : function readDouble_ieee754(buf, pos) {
- var lo = readFixed32(buf, pos + 4),
- hi = readFixed32(buf, pos + 8);
- var sign = (hi >> 31) * 2 + 1,
- exponent = hi >>> 20 & 2047,
- mantissa = 4294967296 * (hi & 1048575) + lo;
- return exponent === 2047
- ? mantissa
- ? NaN
- : sign * Infinity
- : exponent === 0
- ? sign * 5e-324 * mantissa
- : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);
- };
- Reader.prototype.double = function read_double() {
-
- if (this.pos + 8 > this.len)
- throw indexOutOfRange(this, 4);
- var value = readDouble(this.buf, this.pos);
- this.pos += 8;
- return value;
- };
- Reader.prototype.bytes = function read_bytes() {
- var length = this.uint32(),
- start = this.pos,
- end = this.pos + length;
-
- if (end > this.len)
- throw indexOutOfRange(this, length);
- this.pos += length;
- return start === end
- ? new this.buf.constructor(0)
- : this._slice.call(this.buf, start, end);
- };
- Reader.prototype.string = function read_string() {
- var bytes = this.bytes();
- return utf8.read(bytes, 0, bytes.length);
- };
- Reader.prototype.skip = function skip(length) {
- if (typeof length === "number") {
-
- if (this.pos + length > this.len)
- throw indexOutOfRange(this, length);
- this.pos += length;
- } else {
-
- do {
- if (this.pos >= this.len)
- throw indexOutOfRange(this);
- } while (this.buf[this.pos++] & 128);
- }
- return this;
- };
- Reader.prototype.skipType = function(wireType) {
- switch (wireType) {
- case 0:
- this.skip();
- break;
- case 1:
- this.skip(8);
- break;
- case 2:
- this.skip(this.uint32());
- break;
- case 3:
- do {
- if ((wireType = this.uint32() & 7) === 4)
- break;
- this.skipType(wireType);
- } while (true);
- break;
- case 5:
- this.skip(4);
- break;
-
- default:
- throw Error("invalid wire type " + wireType + " at offset " + this.pos);
- }
- return this;
- };
- Reader._configure = function(BufferReader_) {
- BufferReader = BufferReader_;
- var fn = util.Long ? "toLong" : "toNumber";
- util.merge(Reader.prototype, {
- int64: function read_int64() {
- return readLongVarint.call(this)[fn](false);
- },
- uint64: function read_uint64() {
- return readLongVarint.call(this)[fn](true);
- },
- sint64: function read_sint64() {
- return readLongVarint.call(this).zzDecode()[fn](false);
- },
- fixed64: function read_fixed64() {
- return readFixed64.call(this)[fn](true);
- },
- sfixed64: function read_sfixed64() {
- return readFixed64.call(this)[fn](false);
- }
- });
- };
- },{"13":13}],9:[function(require,module,exports){
- "use strict";
- module.exports = BufferReader;
- var Reader = require(8);
- (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
- var util = require(13);
- function BufferReader(buffer) {
- Reader.call(this, buffer);
-
- }
- if (util.Buffer)
- BufferReader.prototype._slice = util.Buffer.prototype.slice;
- BufferReader.prototype.string = function read_string_buffer() {
- var len = this.uint32();
- return this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len));
- };
- },{"13":13,"8":8}],10:[function(require,module,exports){
- "use strict";
- var rpc = exports;
- rpc.Service = require(11);
- },{"11":11}],11:[function(require,module,exports){
- "use strict";
- module.exports = Service;
- var util = require(13);
- (Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;
- function Service(rpcImpl, requestDelimited, responseDelimited) {
- if (typeof rpcImpl !== "function")
- throw TypeError("rpcImpl must be a function");
- util.EventEmitter.call(this);
-
- this.rpcImpl = rpcImpl;
-
- this.requestDelimited = Boolean(requestDelimited);
-
- this.responseDelimited = Boolean(responseDelimited);
- }
- Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {
- if (!request)
- throw TypeError("request must be specified");
- var self = this;
- if (!callback)
- return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);
- if (!self.rpcImpl) {
- setTimeout(function() { callback(Error("already ended")); }, 0);
- return undefined;
- }
- try {
- return self.rpcImpl(
- method,
- requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(),
- function rpcCallback(err, response) {
- if (err) {
- self.emit("error", err, method);
- return callback(err);
- }
- if (response === null) {
- self.end( true);
- return undefined;
- }
- if (!(response instanceof responseCtor)) {
- try {
- response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response);
- } catch (err) {
- self.emit("error", err, method);
- return callback(err);
- }
- }
- self.emit("data", response, method);
- return callback(null, response);
- }
- );
- } catch (err) {
- self.emit("error", err, method);
- setTimeout(function() { callback(err); }, 0);
- return undefined;
- }
- };
- Service.prototype.end = function end(endedByRPC) {
- if (this.rpcImpl) {
- if (!endedByRPC)
- this.rpcImpl(null, null, null);
- this.rpcImpl = null;
- this.emit("end").off();
- }
- return this;
- };
- },{"13":13}],12:[function(require,module,exports){
- "use strict";
- module.exports = LongBits;
- var util = require(13);
- function LongBits(lo, hi) {
-
-
-
- this.lo = lo >>> 0;
-
- this.hi = hi >>> 0;
- }
- var zero = LongBits.zero = new LongBits(0, 0);
- zero.toNumber = function() { return 0; };
- zero.zzEncode = zero.zzDecode = function() { return this; };
- zero.length = function() { return 1; };
- var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0";
- LongBits.fromNumber = function fromNumber(value) {
- if (value === 0)
- return zero;
- var sign = value < 0;
- if (sign)
- value = -value;
- var lo = value >>> 0,
- hi = (value - lo) / 4294967296 >>> 0;
- if (sign) {
- hi = ~hi >>> 0;
- lo = ~lo >>> 0;
- if (++lo > 4294967295) {
- lo = 0;
- if (++hi > 4294967295)
- hi = 0;
- }
- }
- return new LongBits(lo, hi);
- };
- LongBits.from = function from(value) {
- if (typeof value === "number")
- return LongBits.fromNumber(value);
- if (util.isString(value)) {
-
- if (util.Long)
- value = util.Long.fromString(value);
- else
- return LongBits.fromNumber(parseInt(value, 10));
- }
- return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;
- };
- LongBits.prototype.toNumber = function toNumber(unsigned) {
- if (!unsigned && this.hi >>> 31) {
- var lo = ~this.lo + 1 >>> 0,
- hi = ~this.hi >>> 0;
- if (!lo)
- hi = hi + 1 >>> 0;
- return -(lo + hi * 4294967296);
- }
- return this.lo + this.hi * 4294967296;
- };
- LongBits.prototype.toLong = function toLong(unsigned) {
- return util.Long
- ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))
-
- : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };
- };
- var charCodeAt = String.prototype.charCodeAt;
- LongBits.fromHash = function fromHash(hash) {
- if (hash === zeroHash)
- return zero;
- return new LongBits(
- ( charCodeAt.call(hash, 0)
- | charCodeAt.call(hash, 1) << 8
- | charCodeAt.call(hash, 2) << 16
- | charCodeAt.call(hash, 3) << 24) >>> 0
- ,
- ( charCodeAt.call(hash, 4)
- | charCodeAt.call(hash, 5) << 8
- | charCodeAt.call(hash, 6) << 16
- | charCodeAt.call(hash, 7) << 24) >>> 0
- );
- };
- LongBits.prototype.toHash = function toHash() {
- return String.fromCharCode(
- this.lo & 255,
- this.lo >>> 8 & 255,
- this.lo >>> 16 & 255,
- this.lo >>> 24 ,
- this.hi & 255,
- this.hi >>> 8 & 255,
- this.hi >>> 16 & 255,
- this.hi >>> 24
- );
- };
- LongBits.prototype.zzEncode = function zzEncode() {
- var mask = this.hi >> 31;
- this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;
- this.lo = ( this.lo << 1 ^ mask) >>> 0;
- return this;
- };
- LongBits.prototype.zzDecode = function zzDecode() {
- var mask = -(this.lo & 1);
- this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;
- this.hi = ( this.hi >>> 1 ^ mask) >>> 0;
- return this;
- };
- LongBits.prototype.length = function length() {
- var part0 = this.lo,
- part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,
- part2 = this.hi >>> 24;
- return part2 === 0
- ? part1 === 0
- ? part0 < 16384
- ? part0 < 128 ? 1 : 2
- : part0 < 2097152 ? 3 : 4
- : part1 < 16384
- ? part1 < 128 ? 5 : 6
- : part1 < 2097152 ? 7 : 8
- : part2 < 128 ? 9 : 10;
- };
- },{"13":13}],13:[function(require,module,exports){
- "use strict";
- var util = exports;
- util.asPromise = require(1);
- util.base64 = require(2);
- util.EventEmitter = require(3);
- util.inquire = require(4);
- util.utf8 = require(6);
- util.pool = require(5);
- util.LongBits = require(12);
- util.emptyArray = Object.freeze ? Object.freeze([]) : [];
- util.emptyObject = Object.freeze ? Object.freeze({}) : {};
- util.isNode = Boolean(global.process && global.process.versions && global.process.versions.node);
- util.isInteger = Number.isInteger || function isInteger(value) {
- return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
- };
- util.isString = function isString(value) {
- return typeof value === "string" || value instanceof String;
- };
- util.isObject = function isObject(value) {
- return value && typeof value === "object";
- };
- util.Buffer = (function() {
- try {
- var Buffer = util.inquire("buffer").Buffer;
-
- return Buffer.prototype.utf8Write ? Buffer : null;
- } catch (e) {
-
- return null;
- }
- })();
- util._Buffer_from = null;
- util._Buffer_allocUnsafe = null;
- util.newBuffer = function newBuffer(sizeOrArray) {
-
- return typeof sizeOrArray === "number"
- ? util.Buffer
- ? util._Buffer_allocUnsafe(sizeOrArray)
- : new util.Array(sizeOrArray)
- : util.Buffer
- ? util._Buffer_from(sizeOrArray)
- : typeof Uint8Array === "undefined"
- ? sizeOrArray
- : new Uint8Array(sizeOrArray);
- };
- util.Array = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
- util.Long = global.dcodeIO && global.dcodeIO.Long || util.inquire("long");
- util.key2Re = /^true|false|0|1$/;
- util.key32Re = /^-?(?:0|[1-9][0-9]*)$/;
- util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;
- util.longToHash = function longToHash(value) {
- return value
- ? util.LongBits.from(value).toHash()
- : util.LongBits.zeroHash;
- };
- util.longFromHash = function longFromHash(hash, unsigned) {
- var bits = util.LongBits.fromHash(hash);
- if (util.Long)
- return util.Long.fromBits(bits.lo, bits.hi, unsigned);
- return bits.toNumber(Boolean(unsigned));
- };
- function merge(dst, src, ifNotSet) {
- for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
- if (dst[keys[i]] === undefined || !ifNotSet)
- dst[keys[i]] = src[keys[i]];
- return dst;
- }
- util.merge = merge;
- util.lcFirst = function lcFirst(str) {
- return str.charAt(0).toLowerCase() + str.substring(1);
- };
- function newError(name) {
- function CustomError(message, properties) {
- if (!(this instanceof CustomError))
- return new CustomError(message, properties);
-
-
- Object.defineProperty(this, "message", { get: function() { return message; } });
-
- if (Error.captureStackTrace)
- Error.captureStackTrace(this, CustomError);
- else
- Object.defineProperty(this, "stack", { value: (new Error()).stack || "" });
- if (properties)
- merge(this, properties);
- }
- (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;
- Object.defineProperty(CustomError.prototype, "name", { get: function() { return name; } });
- CustomError.prototype.toString = function toString() {
- return this.name + ": " + this.message;
- };
- return CustomError;
- }
- util.newError = newError;
- util.ProtocolError = newError("ProtocolError");
- util.oneOfGetter = function getOneOf(fieldNames) {
- var fieldMap = {};
- for (var i = 0; i < fieldNames.length; ++i)
- fieldMap[fieldNames[i]] = 1;
-
- return function() {
- for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)
- if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)
- return keys[i];
- };
- };
- util.oneOfSetter = function setOneOf(fieldNames) {
-
- return function(name) {
- for (var i = 0; i < fieldNames.length; ++i)
- if (fieldNames[i] !== name)
- delete this[fieldNames[i]];
- };
- };
- util.lazyResolve = function lazyResolve(root, lazyTypes) {
- for (var i = 0; i < lazyTypes.length; ++i) {
- for (var keys = Object.keys(lazyTypes[i]), j = 0; j < keys.length; ++j) {
- var path = lazyTypes[i][keys[j]].split("."),
- ptr = root;
- while (path.length)
- ptr = ptr[path.shift()];
- lazyTypes[i][keys[j]] = ptr;
- }
- }
- };
- util.toJSONOptions = {
- longs: String,
- enums: String,
- bytes: String
- };
- util._configure = function() {
- var Buffer = util.Buffer;
-
- if (!Buffer) {
- util._Buffer_from = util._Buffer_allocUnsafe = null;
- return;
- }
-
-
- util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||
-
- function Buffer_from(value, encoding) {
- return new Buffer(value, encoding);
- };
- util._Buffer_allocUnsafe = Buffer.allocUnsafe ||
-
- function Buffer_allocUnsafe(size) {
- return new Buffer(size);
- };
- };
- },{"1":1,"12":12,"2":2,"3":3,"4":4,"5":5,"6":6}],14:[function(require,module,exports){
- "use strict";
- module.exports = Writer;
- var util = require(13);
- var BufferWriter;
- var LongBits = util.LongBits,
- base64 = util.base64,
- utf8 = util.utf8;
- function Op(fn, len, val) {
-
- this.fn = fn;
-
- this.len = len;
-
- this.next = undefined;
-
- this.val = val;
- }
- function noop() {}
- function State(writer) {
-
- this.head = writer.head;
-
- this.tail = writer.tail;
-
- this.len = writer.len;
-
- this.next = writer.states;
- }
- function Writer() {
-
- this.len = 0;
-
- this.head = new Op(noop, 0, 0);
-
- this.tail = this.head;
-
- this.states = null;
-
-
-
-
-
- }
- Writer.create = util.Buffer
- ? function create_buffer_setup() {
- return (Writer.create = function create_buffer() {
- return new BufferWriter();
- })();
- }
-
- : function create_array() {
- return new Writer();
- };
- Writer.alloc = function alloc(size) {
- return new util.Array(size);
- };
- if (util.Array !== Array)
- Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);
- Writer.prototype.push = function push(fn, len, val) {
- this.tail = this.tail.next = new Op(fn, len, val);
- this.len += len;
- return this;
- };
- function writeByte(val, buf, pos) {
- buf[pos] = val & 255;
- }
- function writeVarint32(val, buf, pos) {
- while (val > 127) {
- buf[pos++] = val & 127 | 128;
- val >>>= 7;
- }
- buf[pos] = val;
- }
- function VarintOp(len, val) {
- this.len = len;
- this.next = undefined;
- this.val = val;
- }
- VarintOp.prototype = Object.create(Op.prototype);
- VarintOp.prototype.fn = writeVarint32;
- Writer.prototype.uint32 = function write_uint32(value) {
-
-
- this.len += (this.tail = this.tail.next = new VarintOp(
- (value = value >>> 0)
- < 128 ? 1
- : value < 16384 ? 2
- : value < 2097152 ? 3
- : value < 268435456 ? 4
- : 5,
- value)).len;
- return this;
- };
- Writer.prototype.int32 = function write_int32(value) {
- return value < 0
- ? this.push(writeVarint64, 10, LongBits.fromNumber(value))
- : this.uint32(value);
- };
- Writer.prototype.sint32 = function write_sint32(value) {
- return this.uint32((value << 1 ^ value >> 31) >>> 0);
- };
- function writeVarint64(val, buf, pos) {
- while (val.hi) {
- buf[pos++] = val.lo & 127 | 128;
- val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;
- val.hi >>>= 7;
- }
- while (val.lo > 127) {
- buf[pos++] = val.lo & 127 | 128;
- val.lo = val.lo >>> 7;
- }
- buf[pos++] = val.lo;
- }
- Writer.prototype.uint64 = function write_uint64(value) {
- var bits = LongBits.from(value);
- return this.push(writeVarint64, bits.length(), bits);
- };
- Writer.prototype.int64 = Writer.prototype.uint64;
- Writer.prototype.sint64 = function write_sint64(value) {
- var bits = LongBits.from(value).zzEncode();
- return this.push(writeVarint64, bits.length(), bits);
- };
- Writer.prototype.bool = function write_bool(value) {
- return this.push(writeByte, 1, value ? 1 : 0);
- };
- function writeFixed32(val, buf, pos) {
- buf[pos++] = val & 255;
- buf[pos++] = val >>> 8 & 255;
- buf[pos++] = val >>> 16 & 255;
- buf[pos ] = val >>> 24;
- }
- Writer.prototype.fixed32 = function write_fixed32(value) {
- return this.push(writeFixed32, 4, value >>> 0);
- };
- Writer.prototype.sfixed32 = Writer.prototype.fixed32;
- Writer.prototype.fixed64 = function write_fixed64(value) {
- var bits = LongBits.from(value);
- return this.push(writeFixed32, 4, bits.lo).push(writeFixed32, 4, bits.hi);
- };
- Writer.prototype.sfixed64 = Writer.prototype.fixed64;
- var writeFloat = typeof Float32Array !== "undefined"
- ? (function() {
- var f32 = new Float32Array(1),
- f8b = new Uint8Array(f32.buffer);
- f32[0] = -0;
- return f8b[3]
- ? function writeFloat_f32(val, buf, pos) {
- f32[0] = val;
- buf[pos++] = f8b[0];
- buf[pos++] = f8b[1];
- buf[pos++] = f8b[2];
- buf[pos ] = f8b[3];
- }
-
- : function writeFloat_f32_le(val, buf, pos) {
- f32[0] = val;
- buf[pos++] = f8b[3];
- buf[pos++] = f8b[2];
- buf[pos++] = f8b[1];
- buf[pos ] = f8b[0];
- };
- })()
-
- : function writeFloat_ieee754(value, buf, pos) {
- var sign = value < 0 ? 1 : 0;
- if (sign)
- value = -value;
- if (value === 0)
- writeFixed32(1 / value > 0 ? 0 : 2147483648, buf, pos);
- else if (isNaN(value))
- writeFixed32(2147483647, buf, pos);
- else if (value > 3.4028234663852886e+38)
- writeFixed32((sign << 31 | 2139095040) >>> 0, buf, pos);
- else if (value < 1.1754943508222875e-38)
- writeFixed32((sign << 31 | Math.round(value / 1.401298464324817e-45)) >>> 0, buf, pos);
- else {
- var exponent = Math.floor(Math.log(value) / Math.LN2),
- mantissa = Math.round(value * Math.pow(2, -exponent) * 8388608) & 8388607;
- writeFixed32((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);
- }
- };
- Writer.prototype.float = function write_float(value) {
- return this.push(writeFloat, 4, value);
- };
- var writeDouble = typeof Float64Array !== "undefined"
- ? (function() {
- var f64 = new Float64Array(1),
- f8b = new Uint8Array(f64.buffer);
- f64[0] = -0;
- return f8b[7]
- ? function writeDouble_f64(val, buf, pos) {
- f64[0] = val;
- buf[pos++] = f8b[0];
- buf[pos++] = f8b[1];
- buf[pos++] = f8b[2];
- buf[pos++] = f8b[3];
- buf[pos++] = f8b[4];
- buf[pos++] = f8b[5];
- buf[pos++] = f8b[6];
- buf[pos ] = f8b[7];
- }
-
- : function writeDouble_f64_le(val, buf, pos) {
- f64[0] = val;
- buf[pos++] = f8b[7];
- buf[pos++] = f8b[6];
- buf[pos++] = f8b[5];
- buf[pos++] = f8b[4];
- buf[pos++] = f8b[3];
- buf[pos++] = f8b[2];
- buf[pos++] = f8b[1];
- buf[pos ] = f8b[0];
- };
- })()
-
- : function writeDouble_ieee754(value, buf, pos) {
- var sign = value < 0 ? 1 : 0;
- if (sign)
- value = -value;
- if (value === 0) {
- writeFixed32(0, buf, pos);
- writeFixed32(1 / value > 0 ? 0 : 2147483648, buf, pos + 4);
- } else if (isNaN(value)) {
- writeFixed32(4294967295, buf, pos);
- writeFixed32(2147483647, buf, pos + 4);
- } else if (value > 1.7976931348623157e+308) {
- writeFixed32(0, buf, pos);
- writeFixed32((sign << 31 | 2146435072) >>> 0, buf, pos + 4);
- } else {
- var mantissa;
- if (value < 2.2250738585072014e-308) {
- mantissa = value / 5e-324;
- writeFixed32(mantissa >>> 0, buf, pos);
- writeFixed32((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + 4);
- } else {
- var exponent = Math.floor(Math.log(value) / Math.LN2);
- if (exponent === 1024)
- exponent = 1023;
- mantissa = value * Math.pow(2, -exponent);
- writeFixed32(mantissa * 4503599627370496 >>> 0, buf, pos);
- writeFixed32((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + 4);
- }
- }
- };
- Writer.prototype.double = function write_double(value) {
- return this.push(writeDouble, 8, value);
- };
- var writeBytes = util.Array.prototype.set
- ? function writeBytes_set(val, buf, pos) {
- buf.set(val, pos);
- }
-
- : function writeBytes_for(val, buf, pos) {
- for (var i = 0; i < val.length; ++i)
- buf[pos + i] = val[i];
- };
- Writer.prototype.bytes = function write_bytes(value) {
- var len = value.length >>> 0;
- if (!len)
- return this.push(writeByte, 1, 0);
- if (util.isString(value)) {
- var buf = Writer.alloc(len = base64.length(value));
- base64.decode(value, buf, 0);
- value = buf;
- }
- return this.uint32(len).push(writeBytes, len, value);
- };
- Writer.prototype.string = function write_string(value) {
- var len = utf8.length(value);
- return len
- ? this.uint32(len).push(utf8.write, len, value)
- : this.push(writeByte, 1, 0);
- };
- Writer.prototype.fork = function fork() {
- this.states = new State(this);
- this.head = this.tail = new Op(noop, 0, 0);
- this.len = 0;
- return this;
- };
- Writer.prototype.reset = function reset() {
- if (this.states) {
- this.head = this.states.head;
- this.tail = this.states.tail;
- this.len = this.states.len;
- this.states = this.states.next;
- } else {
- this.head = this.tail = new Op(noop, 0, 0);
- this.len = 0;
- }
- return this;
- };
- Writer.prototype.ldelim = function ldelim() {
- var head = this.head,
- tail = this.tail,
- len = this.len;
- this.reset().uint32(len);
- if (len) {
- this.tail.next = head.next;
- this.tail = tail;
- this.len += len;
- }
- return this;
- };
- Writer.prototype.finish = function finish() {
- var head = this.head.next,
- buf = this.constructor.alloc(this.len),
- pos = 0;
- while (head) {
- head.fn(head.val, buf, pos);
- pos += head.len;
- head = head.next;
- }
-
- return buf;
- };
- Writer._configure = function(BufferWriter_) {
- BufferWriter = BufferWriter_;
- };
- },{"13":13}],15:[function(require,module,exports){
- "use strict";
- module.exports = BufferWriter;
- var Writer = require(14);
- (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
- var util = require(13);
- var Buffer = util.Buffer;
- function BufferWriter() {
- Writer.call(this);
- }
- BufferWriter.alloc = function alloc_buffer(size) {
- return (BufferWriter.alloc = util._Buffer_allocUnsafe)(size);
- };
- var writeBytesBuffer = Buffer && Buffer.prototype instanceof Uint8Array && Buffer.prototype.set.name === "set"
- ? function writeBytesBuffer_set(val, buf, pos) {
- buf.set(val, pos);
-
- }
-
- : function writeBytesBuffer_copy(val, buf, pos) {
- if (val.copy)
- val.copy(buf, pos, 0, val.length);
- else for (var i = 0; i < val.length;)
- buf[pos++] = val[i++];
- };
- BufferWriter.prototype.bytes = function write_bytes_buffer(value) {
- if (util.isString(value))
- value = util._Buffer_from(value, "base64");
- var len = value.length >>> 0;
- this.uint32(len);
- if (len)
- this.push(writeBytesBuffer, len, value);
- return this;
- };
- function writeStringBuffer(val, buf, pos) {
- if (val.length < 40)
- util.utf8.write(val, buf, pos);
- else
- buf.utf8Write(val, pos);
- }
- BufferWriter.prototype.string = function write_string_buffer(value) {
- var len = Buffer.byteLength(value);
- this.uint32(len);
- if (len)
- this.push(writeStringBuffer, len, value);
- return this;
- };
- },{"13":13,"14":14}]},{},[7])
- })(tmp);
- export default tmp.protobuf;
|