/* protobuf.js (c) 2013 Daniel Wirtz Released under the Apache License, Version 2.0 see: https://github.com/dcodeIO/protobuf.js for details */ var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(e,p,d){if(d.get||d.set)throw new TypeError("ES3 does not support getters and setters.");e!=Array.prototype&&e!=Object.prototype&&(e[p]=d.value)};$jscomp.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_"; $jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(e){return $jscomp.SYMBOL_PREFIX+(e||"")+$jscomp.symbolCounter_++}; $jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var e=$jscomp.global.Symbol.iterator;e||(e=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[e]&&$jscomp.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(e){var p=0;return $jscomp.iteratorPrototype(function(){return p]/g,RULE:/^(?:required|optional|repeated|map)$/, 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]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,FQTYPEREF:/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/, BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g};d.Reflect=function(c){function d(a,g){if(a&&"number"===typeof a.low&&"number"===typeof a.high&&"boolean"===typeof a.unsigned&&a.low===a.low&&a.high===a.high)return new c.Long(a.low,a.high,"undefined"=== typeof g?a.unsigned:g);if("string"===typeof a)return c.Long.fromString(a,g||!1,10);if("number"===typeof a)return c.Long.fromNumber(a,g||!1);throw Error("not convertible to Long");}function z(a,g){var h=g.readVarint32(),b=h&7,h=h>>>3;switch(b){case c.WIRE_TYPES.VARINT:do h=g.readUint8();while(128===(h&128));break;case c.WIRE_TYPES.BITS64:g.offset+=8;break;case c.WIRE_TYPES.LDELIM:h=g.readVarint32();g.offset+=h;break;case c.WIRE_TYPES.STARTGROUP:z(h,g);break;case c.WIRE_TYPES.ENDGROUP:if(h===a)return!1; throw Error("Illegal GROUPEND after unknown group: "+h+" ("+a+" expected)");case c.WIRE_TYPES.BITS32:g.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+a+": "+b);}return!0}var r={},k=function(a,g,c){this.builder=a;this.parent=g;this.name=c},l=k.prototype;l.fqn=function(){var a=this.name,g=this;do{g=g.parent;if(null==g)break;a=g.name+"."+a}while(1);return a};l.toString=function(a){return(a?this.className+" ":"")+this.fqn()};l.build=function(){throw Error(this.toString(!0)+ " cannot be built directly");};r.T=k;var b=function(a,g,c,b,e){k.call(this,a,g,c);this.className="Namespace";this.children=[];this.options=b||{};this.syntax=e||"proto2"},l=b.prototype=Object.create(k.prototype);l.getChildren=function(a){a=a||null;if(null==a)return this.children.slice();for(var g=[],c=0,b=this.children.length;cc.MAP_KEY_TYPES.indexOf(a))throw Error("Invalid map key type: "+a.name);},f=m.prototype;m.defaultFieldValue=function(a){"string"===typeof a&&(a=c.TYPES[a]);if("undefined"===typeof a.defaultValue)throw Error("default value for type "+a.name+" is not supported");return a==c.TYPES.bytes?new e(0):a.defaultValue};f.toString=function(){return(this.name||"")+(this.isMapKey?"map":"value")+" element"};f.verifyValue=function(a){function g(a, c){throw Error("Illegal value for "+b.toString(!0)+" of type "+b.type.name+": "+a+" ("+c+")");}var b=this;switch(this.type){case c.TYPES.int32:case c.TYPES.sint32:case c.TYPES.sfixed32:return("number"!==typeof a||a===a&&0!==a%1)&&g(typeof a,"not an integer"),4294967295a?a>>>0:a;case c.TYPES.int64:case c.TYPES.sint64:case c.TYPES.sfixed64:if(c.Long)try{return d(a,!1)}catch(w){g(typeof a, w.message)}else g(typeof a,"requires Long.js");case c.TYPES.uint64:case c.TYPES.fixed64:if(c.Long)try{return d(a,!0)}catch(w){g(typeof a,w.message)}else g(typeof a,"requires Long.js");case c.TYPES.bool:return"boolean"!==typeof a&&g(typeof a,"not a boolean"),a;case c.TYPES["float"]:case c.TYPES["double"]:return"number"!==typeof a&&g(typeof a,"not a number"),a;case c.TYPES.string:return"string"===typeof a||a&&a instanceof String||g(typeof a,"not a string"),""+a;case c.TYPES.bytes:return e.isByteBuffer(a)? a:e.wrap(a,"base64");case c.TYPES["enum"]:for(var v=this.resolvedType.getChildren(c.Reflect.Enum.Value),q=0;qa)&&g(typeof a,"not in range for uint32"),a;g(a,"not a valid enum value");case c.TYPES.group:case c.TYPES.message:a&&"object"===typeof a||g(typeof a,"object expected");if(a instanceof this.resolvedType.clazz)return a;if(a instanceof c.Builder.Message){var v={},q;for(q in a)a.hasOwnProperty(q)&&(v[q]=a[q]);a=v}return new this.resolvedType.clazz(a)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+a+" (undefined type "+this.type+")");};f.calculateLength=function(a,g){if(null===g)return 0;var b;switch(this.type){case c.TYPES.int32:return 0>g?e.calculateVarint64(g):e.calculateVarint32(g);case c.TYPES.uint32:return e.calculateVarint32(g);case c.TYPES.sint32:return e.calculateVarint32(e.zigZagEncode32(g));case c.TYPES.fixed32:case c.TYPES.sfixed32:case c.TYPES["float"]:return 4; case c.TYPES.int64:case c.TYPES.uint64:return e.calculateVarint64(g);case c.TYPES.sint64:return e.calculateVarint64(e.zigZagEncode64(g));case c.TYPES.fixed64:case c.TYPES.sfixed64:return 8;case c.TYPES.bool:return 1;case c.TYPES["enum"]:return e.calculateVarint32(g);case c.TYPES["double"]:return 8;case c.TYPES.string:return b=e.calculateUTF8Bytes(g),e.calculateVarint32(b)+b;case c.TYPES.bytes:if(0>g.remaining())throw Error("Illegal value for "+this.toString(!0)+": "+g.remaining()+" bytes remaining"); return e.calculateVarint32(g.remaining())+g.remaining();case c.TYPES.message:return b=this.resolvedType.calculate(g),e.calculateVarint32(b)+b;case c.TYPES.group:return b=this.resolvedType.calculate(g),b+e.calculateVarint32(a<<3|c.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+g+" (unknown type)");};f.encodeValue=function(a,g,b){if(null===g)return b;switch(this.type){case c.TYPES.int32:0>g?b.writeVarint64(g):b.writeVarint32(g);break;case c.TYPES.uint32:b.writeVarint32(g); break;case c.TYPES.sint32:b.writeVarint32ZigZag(g);break;case c.TYPES.fixed32:b.writeUint32(g);break;case c.TYPES.sfixed32:b.writeInt32(g);break;case c.TYPES.int64:case c.TYPES.uint64:b.writeVarint64(g);break;case c.TYPES.sint64:b.writeVarint64ZigZag(g);break;case c.TYPES.fixed64:b.writeUint64(g);break;case c.TYPES.sfixed64:b.writeInt64(g);break;case c.TYPES.bool:"string"===typeof g?b.writeVarint32("false"===g.toLowerCase()?0:!!g):b.writeVarint32(g?1:0);break;case c.TYPES["enum"]:b.writeVarint32(g); break;case c.TYPES["float"]:b.writeFloat32(g);break;case c.TYPES["double"]:b.writeFloat64(g);break;case c.TYPES.string:b.writeVString(g);break;case c.TYPES.bytes:if(0>g.remaining())throw Error("Illegal value for "+this.toString(!0)+": "+g.remaining()+" bytes remaining");a=g.offset;b.writeVarint32(g.remaining());b.append(g);g.offset=a;break;case c.TYPES.message:a=(new e).LE();this.resolvedType.encode(g,a);b.writeVarint32(a.offset);b.append(a.flip());break;case c.TYPES.group:this.resolvedType.encode(g, b);b.writeVarint32(a<<3|c.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+g+" (unknown type)");}return b};f.decode=function(a,b,e){if(b!=this.type.wireType)throw Error("Unexpected wire type for element");switch(this.type){case c.TYPES.int32:return a.readVarint32()|0;case c.TYPES.uint32:return a.readVarint32()>>>0;case c.TYPES.sint32:return a.readVarint32ZigZag()|0;case c.TYPES.fixed32:return a.readUint32()>>>0;case c.TYPES.sfixed32:return a.readInt32()| 0;case c.TYPES.int64:return a.readVarint64();case c.TYPES.uint64:return a.readVarint64().toUnsigned();case c.TYPES.sint64:return a.readVarint64ZigZag();case c.TYPES.fixed64:return a.readUint64();case c.TYPES.sfixed64:return a.readInt64();case c.TYPES.bool:return!!a.readVarint32();case c.TYPES["enum"]:return a.readVarint32();case c.TYPES["float"]:return a.readFloat();case c.TYPES["double"]:return a.readDouble();case c.TYPES.string:return a.readVString();case c.TYPES.bytes:e=a.readVarint32();if(a.remaining()< e)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+e+" required but got only "+a.remaining());b=a.clone();b.limit=b.offset+e;a.offset+=e;return b;case c.TYPES.message:return e=a.readVarint32(),this.resolvedType.decode(a,e);case c.TYPES.group:return this.resolvedType.decode(a,-1,e)}throw Error("[INTERNAL] Illegal decode type");};f.valueFromString=function(a){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case c.TYPES.int32:case c.TYPES.sint32:case c.TYPES.sfixed32:case c.TYPES.uint32:case c.TYPES.fixed32:return this.verifyValue(parseInt(a)); case c.TYPES.int64:case c.TYPES.sint64:case c.TYPES.sfixed64:case c.TYPES.uint64:case c.TYPES.fixed64:return this.verifyValue(a);case c.TYPES.bool:return"true"===a;case c.TYPES.string:return this.verifyValue(a);case c.TYPES.bytes:return e.fromBinary(a)}};f.valueToString=function(a){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===c.TYPES.bytes?a.toString("binary"):a.toString()};r.Element=m;var u=function(a,c,e,d,q,f){b.call(this,a,c,e,d,f);this.className= "Message";this.extensions=void 0;this.clazz=null;this.isGroup=!!q;this._fieldsByName=this._fieldsById=this._fields=null},f=u.prototype=Object.create(b.prototype);f.build=function(a){if(this.clazz&&!a)return this.clazz;a=function(a,c){function b(c,g,f,d){if(null===c||"object"!==typeof c){if(d&&d instanceof a.Reflect.Enum){var h=a.Reflect.Enum.getName(d.object,c);if(null!==h)return h}return c}if(e.isByteBuffer(c))return g?c.toBase64():c.toBuffer();if(a.Long.isLong(c))return f?c.toString():a.Long.fromValue(c); var n;if(Array.isArray(c))return n=[],c.forEach(function(a,c){n[c]=b(a,g,f,d)}),n;n={};if(c instanceof a.Map){for(var h=c.entries(),m=h.next();!m.done;m=h.next())n[c.keyElem.valueToString(m.value[0])]=b(m.value[1],g,f,c.valueElem.resolvedType);return n}var h=c.$type,m=void 0,q;for(q in c)c.hasOwnProperty(q)&&(h&&(m=h.getChild(q))?n[q]=b(c[q],g,f,m.resolvedType):n[q]=b(c[q],g,f));return n}var g=c.getChildren(a.Reflect.Message.Field),d=c.getChildren(a.Reflect.Message.OneOf),f=function(b,h){a.Builder.Message.call(this); for(var n=0,m=d.length;na.remaining())return null;var g=a.offset, f=a.readVarint32();if(a.remaining()>>3;if(h===c.WIRE_TYPES.ENDGROUP){if(m!==f)throw Error("Illegal group end indicator for "+ this.toString(!0)+": "+m+" ("+(f?f+" expected":"not a group")+")");break}if(d=this._fieldsById[m])d.repeated&&!d.options.packed?e[d.name].push(d.decode(h,a)):d.map?(h=d.decode(h,a),e[d.name].set(h[0],h[1])):(e[d.name]=d.decode(h,a),d.oneof&&(h=e[d.oneof.name],null!==h&&h!==d.name&&(e[h]=null),e[d.oneof.name]=d.name));else switch(h){case c.WIRE_TYPES.VARINT:a.readVarint32();break;case c.WIRE_TYPES.BITS32:a.offset+=4;break;case c.WIRE_TYPES.BITS64:a.offset+=8;break;case c.WIRE_TYPES.LDELIM:d=a.readVarint32(); a.offset+=d;break;case c.WIRE_TYPES.STARTGROUP:for(;z(m,a););break;default:throw Error("Illegal wire type for unknown field "+m+" in "+this.toString(!0)+"#decode: "+h);}}a=0;for(b=this._fields.length;a>>=3,1===b)g=this.keyElement.decode(d,a,b);else if(2===b)f= this.element.decode(d,a,b);else throw Error("Unexpected tag in map field key/value submessage");return[g,f]}return this.element.decode(b,a,this.id)};r.Message.Field=p;f=function(a,b,c,f,d,e,m){p.call(this,a,b,c,null,f,d,e,m)};f.prototype=Object.create(p.prototype);r.Message.ExtensionField=f;r.Message.OneOf=function(a,b,c){k.call(this,a,b,c);this.fields=[]};var x=function(a,c,f,d,e){b.call(this,a,c,f,d,e);this.className="Enum";this.object=null};x.getName=function(a,b){for(var c=Object.keys(a),f=0, g;f=a[0]&&b.id<=a[1]&&(f=!0)});if(!f)throw Error("illegal extended field id in "+l.name+": "+b.id+" (not within valid ranges)");}var d=b.name;this.options.convertFieldsToCamelCase&&(d=c.Util.toCamelCase(d));var d=new e.Message.ExtensionField(this,l,b.rule,b.type,this.ptr.fqn()+"."+d,b.id,b.options), a=new e.Extension(this,this.ptr,b.name,d);d.extension=a;this.ptr.addChild(a);l.addChild(d)},this);else{if(!/\.?google\.protobuf\./.test(f.ref))throw Error("extended message "+f.ref+" is not defined");}else throw Error("not a valid definition: "+JSON.stringify(f));l=f=null}b=null;this.ptr=this.ptr.parent}this.resolved=!1;this.result=null;return this};l["import"]=function(b,d){var f="/";if("string"===typeof d){c.Util.IS_NODE&&(d=require("path").resolve(d));if(!0===this.files[d])return this.reset(); this.files[d]=!0}else if("object"===typeof d){var e=d.root;c.Util.IS_NODE&&(e=require("path").resolve(e));if(0<=e.indexOf("\\")||0<=d.file.indexOf("\\"))f="\\";e=c.Util.IS_NODE?require("path").join(e,d.file):e+f+d.file;if(!0===this.files[e])return this.reset();this.files[e]=!0}if(b.imports&&0