!function(e,t){"function"===typeof define&&define.amd?define(["protobufjs/minimal"],t):"function"===typeof require&&"object"===typeof module&&module&&module.exports&&(module.exports=t(require("protobufjs/minimal")))}(0,(function(e){"use strict";var t=e.Reader,r=e.Writer,o=e.util,n=e.roots.default||(e.roots.default={});return n.RPC=function(){function s(e){if(this.subscriptions=[],this.messages=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:s.subscriptions&&s.subscriptions.length||(s.subscriptions=[]),s.subscriptions.push(n.RPC.SubOpts.decode(e,e.uint32()));break;case 2:s.messages&&s.messages.length||(s.messages=[]),s.messages.push(n.RPC.Message.decode(e,e.uint32()));break;case 3:s.control=n.RPC.ControlMessage.decode(e,e.uint32());break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC)return e;var t=new n.RPC;if(e.subscriptions){if(!Array.isArray(e.subscriptions))throw TypeError(".RPC.subscriptions: array expected");t.subscriptions=[];for(var r=0;r>>3){case 1:s.subscribe=e.bool();break;case 2:s.topic=e.string();break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.SubOpts)return e;var t=new n.RPC.SubOpts;return null!=e.subscribe&&(t.subscribe=Boolean(e.subscribe)),null!=e.topic&&(t.topic=String(e.topic)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.subscribe&&e.hasOwnProperty("subscribe")&&(r.subscribe=e.subscribe,t.oneofs&&(r._subscribe="subscribe")),null!=e.topic&&e.hasOwnProperty("topic")&&(r.topic=e.topic,t.oneofs&&(r._topic="topic")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.Message=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:a.from=e.bytes();break;case 2:a.data=e.bytes();break;case 3:a.seqno=e.bytes();break;case 4:a.topic=e.string();break;case 5:a.signature=e.bytes();break;case 6:a.key=e.bytes();break;default:e.skipType(7&i)}}if(!a.hasOwnProperty("topic"))throw o.ProtocolError("missing required 'topic'",{instance:a});return a},s.fromObject=function(e){if(e instanceof n.RPC.Message)return e;var t=new n.RPC.Message;return null!=e.from&&("string"===typeof e.from?o.base64.decode(e.from,t.from=o.newBuffer(o.base64.length(e.from)),0):e.from.length&&(t.from=e.from)),null!=e.data&&("string"===typeof e.data?o.base64.decode(e.data,t.data=o.newBuffer(o.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),null!=e.seqno&&("string"===typeof e.seqno?o.base64.decode(e.seqno,t.seqno=o.newBuffer(o.base64.length(e.seqno)),0):e.seqno.length&&(t.seqno=e.seqno)),null!=e.topic&&(t.topic=String(e.topic)),null!=e.signature&&("string"===typeof e.signature?o.base64.decode(e.signature,t.signature=o.newBuffer(o.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),null!=e.key&&("string"===typeof e.key?o.base64.decode(e.key,t.key=o.newBuffer(o.base64.length(e.key)),0):e.key.length&&(t.key=e.key)),t},s.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.topic=""),null!=e.from&&e.hasOwnProperty("from")&&(r.from=t.bytes===String?o.base64.encode(e.from,0,e.from.length):t.bytes===Array?Array.prototype.slice.call(e.from):e.from,t.oneofs&&(r._from="from")),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?o.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data,t.oneofs&&(r._data="data")),null!=e.seqno&&e.hasOwnProperty("seqno")&&(r.seqno=t.bytes===String?o.base64.encode(e.seqno,0,e.seqno.length):t.bytes===Array?Array.prototype.slice.call(e.seqno):e.seqno,t.oneofs&&(r._seqno="seqno")),null!=e.topic&&e.hasOwnProperty("topic")&&(r.topic=e.topic),null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?o.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature,t.oneofs&&(r._signature="signature")),null!=e.key&&e.hasOwnProperty("key")&&(r.key=t.bytes===String?o.base64.encode(e.key,0,e.key.length):t.bytes===Array?Array.prototype.slice.call(e.key):e.key,t.oneofs&&(r._key="key")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlMessage=function(){function s(e){if(this.ihave=[],this.iwant=[],this.graft=[],this.prune=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:s.ihave&&s.ihave.length||(s.ihave=[]),s.ihave.push(n.RPC.ControlIHave.decode(e,e.uint32()));break;case 2:s.iwant&&s.iwant.length||(s.iwant=[]),s.iwant.push(n.RPC.ControlIWant.decode(e,e.uint32()));break;case 3:s.graft&&s.graft.length||(s.graft=[]),s.graft.push(n.RPC.ControlGraft.decode(e,e.uint32()));break;case 4:s.prune&&s.prune.length||(s.prune=[]),s.prune.push(n.RPC.ControlPrune.decode(e,e.uint32()));break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlMessage)return e;var t=new n.RPC.ControlMessage;if(e.ihave){if(!Array.isArray(e.ihave))throw TypeError(".RPC.ControlMessage.ihave: array expected");t.ihave=[];for(var r=0;r>>3){case 1:s.topicID=e.string();break;case 2:s.messageIDs&&s.messageIDs.length||(s.messageIDs=[]),s.messageIDs.push(e.bytes());break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlIHave)return e;var t=new n.RPC.ControlIHave;if(null!=e.topicID&&(t.topicID=String(e.topicID)),e.messageIDs){if(!Array.isArray(e.messageIDs))throw TypeError(".RPC.ControlIHave.messageIDs: array expected");t.messageIDs=[];for(var r=0;r>>3===1)s.messageIDs&&s.messageIDs.length||(s.messageIDs=[]),s.messageIDs.push(e.bytes());else e.skipType(7&a)}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlIWant)return e;var t=new n.RPC.ControlIWant;if(e.messageIDs){if(!Array.isArray(e.messageIDs))throw TypeError(".RPC.ControlIWant.messageIDs: array expected");t.messageIDs=[];for(var r=0;r>>3===1)s.topicID=e.string();else e.skipType(7&a)}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlGraft)return e;var t=new n.RPC.ControlGraft;return null!=e.topicID&&(t.topicID=String(e.topicID)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlPrune=function(){function s(e){if(this.peers=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:s.topicID=e.string();break;case 2:s.peers&&s.peers.length||(s.peers=[]),s.peers.push(n.RPC.PeerInfo.decode(e,e.uint32()));break;case 3:s.backoff=e.uint64();break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlPrune)return e;var t=new n.RPC.ControlPrune;if(null!=e.topicID&&(t.topicID=String(e.topicID)),e.peers){if(!Array.isArray(e.peers))throw TypeError(".RPC.ControlPrune.peers: array expected");t.peers=[];for(var r=0;r>>0,e.backoff.high>>>0).toNumber(!0))),t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.peers=[]),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),e.peers&&e.peers.length){r.peers=[];for(var s=0;s>>0,e.backoff.high>>>0).toNumber(!0):e.backoff,t.oneofs&&(r._backoff="backoff")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.PeerInfo=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:s.peerID=e.bytes();break;case 2:s.signedPeerRecord=e.bytes();break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.PeerInfo)return e;var t=new n.RPC.PeerInfo;return null!=e.peerID&&("string"===typeof e.peerID?o.base64.decode(e.peerID,t.peerID=o.newBuffer(o.base64.length(e.peerID)),0):e.peerID.length&&(t.peerID=e.peerID)),null!=e.signedPeerRecord&&("string"===typeof e.signedPeerRecord?o.base64.decode(e.signedPeerRecord,t.signedPeerRecord=o.newBuffer(o.base64.length(e.signedPeerRecord)),0):e.signedPeerRecord.length&&(t.signedPeerRecord=e.signedPeerRecord)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.peerID&&e.hasOwnProperty("peerID")&&(r.peerID=t.bytes===String?o.base64.encode(e.peerID,0,e.peerID.length):t.bytes===Array?Array.prototype.slice.call(e.peerID):e.peerID,t.oneofs&&(r._peerID="peerID")),null!=e.signedPeerRecord&&e.hasOwnProperty("signedPeerRecord")&&(r.signedPeerRecord=t.bytes===String?o.base64.encode(e.signedPeerRecord,0,e.signedPeerRecord.length):t.bytes===Array?Array.prototype.slice.call(e.signedPeerRecord):e.signedPeerRecord,t.oneofs&&(r._signedPeerRecord="signedPeerRecord")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s}(),n}));