-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathosm-read-pbf.js
63 lines (61 loc) · 116 KB
/
osm-read-pbf.js
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
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pbfParser = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
function readBlobHeaderSize(e,t,n,r){return r(null,new DataView(e).getInt32(t,!1))}function readPBFElement(e,t,n,r,o){var i=new Uint8Array(n);i.set(new Uint8Array(e,t,n)),setImmediate(function(){buf.readPBFElementFromBuffer(i,r,o)})}function getFileSize(e,t){return t(null,e.byteLength)}function get(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onerror=function(e){t(new Error(this.status+": "+this.statusText))},n.onload=function(e){t(null,this.response)},n.send()}function open(e,t){e.filePath?get(e.filePath,t):e.buffer?t(null,e.buffer):t(new Error('Use either the "filePath" option to pass an URL or the "buffer" option to pass an ArrayBuffer.'))}function close(e,t){t&&t(null)}var buf=require("../buffer.js");require("setimmediate"),module.exports={readBlobHeaderSize:readBlobHeaderSize,readPBFElement:readPBFElement,getFileSize:getFileSize,open:open,close:close};
},{"../buffer.js":4,"setimmediate":27}],2:[function(require,module,exports){
function readBlobHeaderSize(e,r,n,i){read(e,r,n,function(e,r){if(e)return i(e);var n=new DataView(r).getInt32(0,!1);return i(null,n)})}function readPBFElement(e,r,n,i,l){read(e,r,n,function(e,r){if(e)return l(e);buf.readPBFElementFromBuffer(r,i,l)})}function getFileSize(e,r){return r(null,e.size)}function read(e,r,n,i){var l,t;l=new FileReader,l.onerror=function(e){return i(new Error("Error reading file ("+l.error.code+")"))},l.onload=function(e){return i(null,l.result)},t=e.webkitSlice?e.webkitSlice(r,r+n):e.slice(r,r+n),l.readAsArrayBuffer(t)}function open(e,r){return r(null,e.file)}function close(e,r){if(r)return r(null)}var buf=require("../buffer.js");module.exports={readBlobHeaderSize:readBlobHeaderSize,readPBFElement:readPBFElement,getFileSize:getFileSize,open:open,close:close};
},{"../buffer.js":4}],3:[function(require,module,exports){
function inflateBlob(e,l){return l(null,new Zlib.Inflate(new Uint8Array(e.zlibData),{bufferSize:e.rawSize}).decompress())}var Zlib=require("../../node_modules/zlibjs/bin/inflate.min.js").Zlib;module.exports={inflateBlob:inflateBlob};
},{"../../node_modules/zlibjs/bin/inflate.min.js":28}],4:[function(require,module,exports){
function readPBFElementFromBuffer(e,r,f){return f(null,r(e))}module.exports={readPBFElementFromBuffer:readPBFElementFromBuffer};
},{}],5:[function(require,module,exports){
function bytesReadFail(e,r,n){return e(new Error("Expected "+r+" bytes but got "+n))}function readBlobHeaderSize(e,r,n,t){var f;f=new Buffer(n),fs.read(e,f,0,n,r,function(e,r,f){return r!==n?bytesReadFail(t,n,r):t(null,f.readInt32BE(0))})}function readPBFElement(e,r,n,t,f){var o;if(n>33554432)return f(new Error("PBF element too big: "+n+" bytes"));o=new Buffer(n),fs.read(e,o,0,n,r,function(e,r,o){return r!==n?bytesReadFail(f,n,r):buf.readPBFElementFromBuffer(o,t,f)})}function getFileSize(e,r){fs.fstat(e,function(e,n){return r(e,n.size)})}function open(e,r){fs.open(e.filePath,"r",r)}function close(e,r){return fs.close(e,r||function(){})}var fs=require("fs"),buf=require("../buffer.js");module.exports={readBlobHeaderSize:readBlobHeaderSize,readPBFElement:readPBFElement,getFileSize:getFileSize,open:open,close:close};
},{"../buffer.js":4,"fs":undefined}],6:[function(require,module,exports){
function inflateBlob(l,i){zlib.inflate(l.zlibData,i)}var zlib=require("zlib");module.exports={inflateBlob:inflateBlob};
},{"zlib":undefined}],7:[function(require,module,exports){
function parse(e){function r(){n=!0}function t(){n=!1,i&&i()}var n,i,o;return o=!1,n=!1,i=null,createPathParser({filePath:e.filePath,buffer:e.buffer,file:e.file,callback:function(r,t){function a(r){return t&&t.close(),e.error(r)}function s(){var r;if(!o&&!n){if(u>=t.fileBlocks.length)return o=!0,t.close(),void e.endDocument();r=t.fileBlocks[u],t.readBlock(r,function(t,n){if(t)return a(t);visitBlock(r,n,e),u+=1,s()})}}var u;if(r)return a(r);u=0,i=s,s()}}),{pause:r,resume:t}}function createPathParser(e){reader=getReader(e),reader.open(e,function(r,t){createFileParser(t,function(r,n){return r?e.callback(r):(n.close=function(e){return reader.close(t,e)},e.callback(null,n))})})}function getReader(e){return arrayBufferReader?e.file?fileReader:arrayBufferReader:reader}function visitBlock(e,r,t){BLOCK_VISITORS_BY_TYPE[e.blobHeader.type](r,t)}function visitOSMHeaderBlock(e,r){}function visitOSMDataBlock(e,r){var t;for(t=0;t<e.primitivegroup.length;++t)visitPrimitiveGroup(e.primitivegroup[t],r)}function visitPrimitiveGroup(e,r){var t;if(r.node)for(t=0;t<e.nodesView.length;++t)r.node(e.nodesView.get(t));if(r.way)for(t=0;t<e.waysView.length;++t)r.way(e.waysView.get(t));if(r.relation)for(t=0;t<e.relationsView.length;++t)r.relation(e.relationsView.get(t))}function readBlobHeaderContent(e,r,t,n){return reader.readPBFElement(e,r,t,proto.OSMPBF.BlobHeader.decode,n)}function readFileBlock(e,r,t){reader.readBlobHeaderSize(e,r,BLOB_HEADER_SIZE_SIZE,function(n,i){return n?t(n):readBlobHeaderContent(e,r+BLOB_HEADER_SIZE_SIZE,i,function(e,n){return e?t(e):(n.position=r+BLOB_HEADER_SIZE_SIZE+i,t(e,{position:r,size:BLOB_HEADER_SIZE_SIZE+i+n.datasize,blobHeader:n}))})})}function readFileBlocks(e,r){reader.getFileSize(e,function(t,n){function i(){readFileBlock(e,o,function(e,t){return e?r(e):(a.push(t),(o=t.position+t.size)<n?void i():r(null,a))})}var o,a;o=0,a=[],i()})}function getStringTableEntry(e){var r,t;return e in this.cache?t=this.cache[e]:(r=this.s[e],t=protobuf.util.utf8.read(r,0,r.length),this.cache[e]=t),t}function extendStringTable(e){e.cache={},e.getEntry=getStringTableEntry}function createNodesView(e,r){function t(t){var n,a;return a=o[t],n={id:""+a.id,lat:(toNumber(e.latOffset)+e.granularity*a.lat)/1e9,lon:(toNumber(e.lonOffset)+e.granularity*a.lon)/1e9,tags:i[t]},r.dense.denseinfo&&(n.version=r.dense.denseinfo.version[t],n.timestamp=a.timestamp,n.changeset=a.changeset,n.uid=""+a.uid,n.user=e.stringtable.getEntry(a.userIndex)),n}var n,i,o;if(0!==r.nodes.length)throw new Error("primitivegroup.nodes.length !== 0 not supported yet");return n=0,r.dense&&(n=r.dense.id.length),i=function(){var t,n,i,o,a,s,u,l;if(!r.dense)return null;for(a=r.dense.keysVals,i={},t=[],n=0;n<a.length;)o=a[n++],0!==o?(s=a[n++],u=e.stringtable.getEntry(o),l=e.stringtable.getEntry(s),i[u]=l):(t.push(i),i={});return t}(),o=function(){var t,i,o,a,s,u,l,d,f,c;if(!r.dense)return null;for(i=0,f=0,c=0,r.dense.denseinfo&&(o=0,a=0,s=0,u=0),l=[],t=0;t<n;++t)i+=toNumber(r.dense.id[t]),f+=toNumber(r.dense.lat[t]),c+=toNumber(r.dense.lon[t]),d={id:i,lat:f,lon:c},r.dense.denseinfo&&(o+=toNumber(r.dense.denseinfo.timestamp[t]),a+=toNumber(r.dense.denseinfo.changeset[t]),s+=r.dense.denseinfo.uid[t],u+=r.dense.denseinfo.userSid[t],d.timestamp=o*e.dateGranularity,d.changeset=a,d.uid=s,d.userIndex=u),l.push(d);return l}(),{length:n,get:t}}function createTagsObject(e,r){var t,n,i,o,a,s,u;for(t={},n=0,i=r.keys.length;n<i;++n)o=r.keys[n],a=r.vals[n],s=e.stringtable.getEntry(o),u=e.stringtable.getEntry(a),t[s]=u;return t}function addInfo(e,r,t){t&&(t.version&&(r.version=t.version),t.timestamp&&(r.timestamp=toNumber(t.timestamp)*e.dateGranularity),t.changeset&&(r.changeset=toNumber(t.changeset)),t.uid&&(r.uid=""+t.uid),t.userSid&&(r.user=e.stringtable.getEntry(t.userSid)))}function createWaysView(e,r){function t(t){var n,i;return n=r.ways[t],i={id:n.id.toString(),tags:createTagsObject(e,n),nodeRefs:function(){var e,r,t;for(e=[],r=0,t=0;t<n.refs.length;++t)r+=toNumber(n.refs[t]),e.push(""+r);return e}()},addInfo(e,i,n.info),i}var n;return n=r.ways.length,{length:n,get:t}}function createRelationsView(e,r){function t(t){var n,i;return n=r.relations[t],i={id:n.id.toString(),tags:createTagsObject(e,n),members:function(){var r,t,i,o,a,s;for(a=proto.OSMPBF.Relation.MemberType,r=[],i=0,o=0;o<n.memids.length;++o)t={},i+=toNumber(n.memids[o]),t.ref=""+i,t.role=e.stringtable.getEntry(n.rolesSid[o]),s=n.types[o],a.NODE===s?t.type="node":a.WAY===s?t.type="way":a.RELATION===s&&(t.type="relation"),r.push(t);return r}()},addInfo(e,i,n.info),i}var n;return n=r.relations.length,{length:n,get:t}}function toNumber(e){return"number"==typeof e?e:e.toNumber()}function extendPrimitiveGroup(e,r){r.nodesView=createNodesView(e,r),r.waysView=createWaysView(e,r),r.relationsView=createRelationsView(e,r)}function decodePrimitiveBlock(e){var r,t;for(r=proto.OSMPBF.PrimitiveBlock.decode(e),extendStringTable(r.stringtable),t=0;t<r.primitivegroup.length;++t)extendPrimitiveGroup(r,r.primitivegroup[t]);return r}function createFileParser(e,r){readFileBlocks(e,function(t,n){function i(e){var r,t,i;for(r=[],t=0;t<n.length;++t)i=n[t],i.blobHeader.type===e&&r.push(i);return r}function o(r,t){return reader.readPBFElement(e,r.blobHeader.position,r.blobHeader.datasize,proto.OSMPBF.Blob.decode,t)}function a(e,r){return o(e,function(t,n){return t?r(t):0===n.rawSize?r("Uncompressed pbfs are currently not supported."):void zlib.inflateBlob(n,function(t,n){return t?r(t):buf.readPBFElementFromBuffer(n,OSM_BLOB_DECODER_BY_TYPE[e.blobHeader.type],r)})})}return t?r(t):r(null,{fileBlocks:n,findFileBlocksByBlobType:i,readBlock:a})})}var protobuf=require("protobufjs/minimal"),proto=require("./proto"),buf=require("./buffer.js"),zlib,reader,arrayBufferReader,fileReader;"undefined"!=typeof self?(zlib=require("./browser/zlib.js"),arrayBufferReader=require("./browser/arrayBufferReader.js"),fileReader=require("./browser/fileReader.js")):(zlib=require("./nodejs/zlib.js"),reader=require("./nodejs/fsReader.js"));var BLOCK_VISITORS_BY_TYPE={OSMHeader:visitOSMHeaderBlock,OSMData:visitOSMDataBlock},BLOB_HEADER_SIZE_SIZE=4,OSM_BLOB_DECODER_BY_TYPE={OSMHeader:proto.OSMPBF.HeaderBlock.decode,OSMData:decodePrimitiveBlock};module.exports={parse:parse,createParser:createPathParser};
},{"./browser/arrayBufferReader.js":1,"./browser/fileReader.js":2,"./browser/zlib.js":3,"./buffer.js":4,"./nodejs/fsReader.js":5,"./nodejs/zlib.js":6,"./proto":8,"protobufjs/minimal":16}],8:[function(require,module,exports){
"use strict";var $protobuf=require("protobufjs/minimal"),$Reader=$protobuf.Reader,$Writer=$protobuf.Writer,$util=$protobuf.util,$root=$protobuf.roots.default||($protobuf.roots.default={});$root.OSMPBF=function(){var e={};return e.Blob=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.raw=$util.newBuffer([]),e.prototype.rawSize=0,e.prototype.zlibData=$util.newBuffer([]),e.prototype.lzmaData=$util.newBuffer([]),e.prototype.OBSOLETEBzip2Data=$util.newBuffer([]),e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=$Writer.create()),null!=e.raw&&e.hasOwnProperty("raw")&&t.uint32(10).bytes(e.raw),null!=e.rawSize&&e.hasOwnProperty("rawSize")&&t.uint32(16).int32(e.rawSize),null!=e.zlibData&&e.hasOwnProperty("zlibData")&&t.uint32(26).bytes(e.zlibData),null!=e.lzmaData&&e.hasOwnProperty("lzmaData")&&t.uint32(34).bytes(e.lzmaData),null!=e.OBSOLETEBzip2Data&&e.hasOwnProperty("OBSOLETEBzip2Data")&&t.uint32(42).bytes(e.OBSOLETEBzip2Data),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.Blob;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.raw=e.bytes();break;case 2:i.rawSize=e.int32();break;case 3:i.zlibData=e.bytes();break;case 4:i.lzmaData=e.bytes();break;case 5:i.OBSOLETEBzip2Data=e.bytes();break;default:e.skipType(7&n)}}return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.raw&&e.hasOwnProperty("raw")&&!(e.raw&&"number"==typeof e.raw.length||$util.isString(e.raw))?"raw: buffer expected":null!=e.rawSize&&e.hasOwnProperty("rawSize")&&!$util.isInteger(e.rawSize)?"rawSize: integer expected":null!=e.zlibData&&e.hasOwnProperty("zlibData")&&!(e.zlibData&&"number"==typeof e.zlibData.length||$util.isString(e.zlibData))?"zlibData: buffer expected":null!=e.lzmaData&&e.hasOwnProperty("lzmaData")&&!(e.lzmaData&&"number"==typeof e.lzmaData.length||$util.isString(e.lzmaData))?"lzmaData: buffer expected":null!=e.OBSOLETEBzip2Data&&e.hasOwnProperty("OBSOLETEBzip2Data")&&!(e.OBSOLETEBzip2Data&&"number"==typeof e.OBSOLETEBzip2Data.length||$util.isString(e.OBSOLETEBzip2Data))?"OBSOLETEBzip2Data: buffer expected":null},e.fromObject=function(e){if(e instanceof $root.OSMPBF.Blob)return e;var t=new $root.OSMPBF.Blob;return null!=e.raw&&("string"==typeof e.raw?$util.base64.decode(e.raw,t.raw=$util.newBuffer($util.base64.length(e.raw)),0):e.raw.length&&(t.raw=e.raw)),null!=e.rawSize&&(t.rawSize=0|e.rawSize),null!=e.zlibData&&("string"==typeof e.zlibData?$util.base64.decode(e.zlibData,t.zlibData=$util.newBuffer($util.base64.length(e.zlibData)),0):e.zlibData.length&&(t.zlibData=e.zlibData)),null!=e.lzmaData&&("string"==typeof e.lzmaData?$util.base64.decode(e.lzmaData,t.lzmaData=$util.newBuffer($util.base64.length(e.lzmaData)),0):e.lzmaData.length&&(t.lzmaData=e.lzmaData)),null!=e.OBSOLETEBzip2Data&&("string"==typeof e.OBSOLETEBzip2Data?$util.base64.decode(e.OBSOLETEBzip2Data,t.OBSOLETEBzip2Data=$util.newBuffer($util.base64.length(e.OBSOLETEBzip2Data)),0):e.OBSOLETEBzip2Data.length&&(t.OBSOLETEBzip2Data=e.OBSOLETEBzip2Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.raw="":(r.raw=[],t.bytes!==Array&&(r.raw=$util.newBuffer(r.raw))),r.rawSize=0,t.bytes===String?r.zlibData="":(r.zlibData=[],t.bytes!==Array&&(r.zlibData=$util.newBuffer(r.zlibData))),t.bytes===String?r.lzmaData="":(r.lzmaData=[],t.bytes!==Array&&(r.lzmaData=$util.newBuffer(r.lzmaData))),t.bytes===String?r.OBSOLETEBzip2Data="":(r.OBSOLETEBzip2Data=[],t.bytes!==Array&&(r.OBSOLETEBzip2Data=$util.newBuffer(r.OBSOLETEBzip2Data)))),null!=e.raw&&e.hasOwnProperty("raw")&&(r.raw=t.bytes===String?$util.base64.encode(e.raw,0,e.raw.length):t.bytes===Array?Array.prototype.slice.call(e.raw):e.raw),null!=e.rawSize&&e.hasOwnProperty("rawSize")&&(r.rawSize=e.rawSize),null!=e.zlibData&&e.hasOwnProperty("zlibData")&&(r.zlibData=t.bytes===String?$util.base64.encode(e.zlibData,0,e.zlibData.length):t.bytes===Array?Array.prototype.slice.call(e.zlibData):e.zlibData),null!=e.lzmaData&&e.hasOwnProperty("lzmaData")&&(r.lzmaData=t.bytes===String?$util.base64.encode(e.lzmaData,0,e.lzmaData.length):t.bytes===Array?Array.prototype.slice.call(e.lzmaData):e.lzmaData),null!=e.OBSOLETEBzip2Data&&e.hasOwnProperty("OBSOLETEBzip2Data")&&(r.OBSOLETEBzip2Data=t.bytes===String?$util.base64.encode(e.OBSOLETEBzip2Data,0,e.OBSOLETEBzip2Data.length):t.bytes===Array?Array.prototype.slice.call(e.OBSOLETEBzip2Data):e.OBSOLETEBzip2Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e}(),e.BlobHeader=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.type="",e.prototype.indexdata=$util.newBuffer([]),e.prototype.datasize=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=$Writer.create()),t.uint32(10).string(e.type),null!=e.indexdata&&e.hasOwnProperty("indexdata")&&t.uint32(18).bytes(e.indexdata),t.uint32(24).int32(e.datasize),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.BlobHeader;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.type=e.string();break;case 2:i.indexdata=e.bytes();break;case 3:i.datasize=e.int32();break;default:e.skipType(7&n)}}if(!i.hasOwnProperty("type"))throw $util.ProtocolError("missing required 'type'",{instance:i});if(!i.hasOwnProperty("datasize"))throw $util.ProtocolError("missing required 'datasize'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":$util.isString(e.type)?null!=e.indexdata&&e.hasOwnProperty("indexdata")&&!(e.indexdata&&"number"==typeof e.indexdata.length||$util.isString(e.indexdata))?"indexdata: buffer expected":$util.isInteger(e.datasize)?null:"datasize: integer expected":"type: string expected"},e.fromObject=function(e){if(e instanceof $root.OSMPBF.BlobHeader)return e;var t=new $root.OSMPBF.BlobHeader;return null!=e.type&&(t.type=String(e.type)),null!=e.indexdata&&("string"==typeof e.indexdata?$util.base64.decode(e.indexdata,t.indexdata=$util.newBuffer($util.base64.length(e.indexdata)),0):e.indexdata.length&&(t.indexdata=e.indexdata)),null!=e.datasize&&(t.datasize=0|e.datasize),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.type="",t.bytes===String?r.indexdata="":(r.indexdata=[],t.bytes!==Array&&(r.indexdata=$util.newBuffer(r.indexdata))),r.datasize=0),null!=e.type&&e.hasOwnProperty("type")&&(r.type=e.type),null!=e.indexdata&&e.hasOwnProperty("indexdata")&&(r.indexdata=t.bytes===String?$util.base64.encode(e.indexdata,0,e.indexdata.length):t.bytes===Array?Array.prototype.slice.call(e.indexdata):e.indexdata),null!=e.datasize&&e.hasOwnProperty("datasize")&&(r.datasize=e.datasize),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e}(),e.HeaderBlock=function(){function e(e){if(this.requiredFeatures=[],this.optionalFeatures=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.bbox=null,e.prototype.requiredFeatures=$util.emptyArray,e.prototype.optionalFeatures=$util.emptyArray,e.prototype.writingprogram="",e.prototype.source="",e.prototype.osmosisReplicationTimestamp=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.osmosisReplicationSequenceNumber=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.osmosisReplicationBaseUrl="",e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=$Writer.create()),null!=e.bbox&&e.hasOwnProperty("bbox")&&$root.OSMPBF.HeaderBBox.encode(e.bbox,t.uint32(10).fork()).ldelim(),null!=e.requiredFeatures&&e.requiredFeatures.length)for(var r=0;r<e.requiredFeatures.length;++r)t.uint32(34).string(e.requiredFeatures[r]);if(null!=e.optionalFeatures&&e.optionalFeatures.length)for(var r=0;r<e.optionalFeatures.length;++r)t.uint32(42).string(e.optionalFeatures[r]);return null!=e.writingprogram&&e.hasOwnProperty("writingprogram")&&t.uint32(130).string(e.writingprogram),null!=e.source&&e.hasOwnProperty("source")&&t.uint32(138).string(e.source),null!=e.osmosisReplicationTimestamp&&e.hasOwnProperty("osmosisReplicationTimestamp")&&t.uint32(256).int64(e.osmosisReplicationTimestamp),null!=e.osmosisReplicationSequenceNumber&&e.hasOwnProperty("osmosisReplicationSequenceNumber")&&t.uint32(264).int64(e.osmosisReplicationSequenceNumber),null!=e.osmosisReplicationBaseUrl&&e.hasOwnProperty("osmosisReplicationBaseUrl")&&t.uint32(274).string(e.osmosisReplicationBaseUrl),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.HeaderBlock;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.bbox=$root.OSMPBF.HeaderBBox.decode(e,e.uint32());break;case 4:i.requiredFeatures&&i.requiredFeatures.length||(i.requiredFeatures=[]),i.requiredFeatures.push(e.string());break;case 5:i.optionalFeatures&&i.optionalFeatures.length||(i.optionalFeatures=[]),i.optionalFeatures.push(e.string());break;case 16:i.writingprogram=e.string();break;case 17:i.source=e.string();break;case 32:i.osmosisReplicationTimestamp=e.int64();break;case 33:i.osmosisReplicationSequenceNumber=e.int64();break;case 34:i.osmosisReplicationBaseUrl=e.string();break;default:e.skipType(7&n)}}return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.bbox&&e.hasOwnProperty("bbox")){var t=$root.OSMPBF.HeaderBBox.verify(e.bbox);if(t)return"bbox."+t}if(null!=e.requiredFeatures&&e.hasOwnProperty("requiredFeatures")){if(!Array.isArray(e.requiredFeatures))return"requiredFeatures: array expected";for(var r=0;r<e.requiredFeatures.length;++r)if(!$util.isString(e.requiredFeatures[r]))return"requiredFeatures: string[] expected"}if(null!=e.optionalFeatures&&e.hasOwnProperty("optionalFeatures")){if(!Array.isArray(e.optionalFeatures))return"optionalFeatures: array expected";for(var r=0;r<e.optionalFeatures.length;++r)if(!$util.isString(e.optionalFeatures[r]))return"optionalFeatures: string[] expected"}return null!=e.writingprogram&&e.hasOwnProperty("writingprogram")&&!$util.isString(e.writingprogram)?"writingprogram: string expected":null!=e.source&&e.hasOwnProperty("source")&&!$util.isString(e.source)?"source: string expected":null!=e.osmosisReplicationTimestamp&&e.hasOwnProperty("osmosisReplicationTimestamp")&&!($util.isInteger(e.osmosisReplicationTimestamp)||e.osmosisReplicationTimestamp&&$util.isInteger(e.osmosisReplicationTimestamp.low)&&$util.isInteger(e.osmosisReplicationTimestamp.high))?"osmosisReplicationTimestamp: integer|Long expected":null!=e.osmosisReplicationSequenceNumber&&e.hasOwnProperty("osmosisReplicationSequenceNumber")&&!($util.isInteger(e.osmosisReplicationSequenceNumber)||e.osmosisReplicationSequenceNumber&&$util.isInteger(e.osmosisReplicationSequenceNumber.low)&&$util.isInteger(e.osmosisReplicationSequenceNumber.high))?"osmosisReplicationSequenceNumber: integer|Long expected":null!=e.osmosisReplicationBaseUrl&&e.hasOwnProperty("osmosisReplicationBaseUrl")&&!$util.isString(e.osmosisReplicationBaseUrl)?"osmosisReplicationBaseUrl: string expected":null},e.fromObject=function(e){if(e instanceof $root.OSMPBF.HeaderBlock)return e;var t=new $root.OSMPBF.HeaderBlock;if(null!=e.bbox){if("object"!=typeof e.bbox)throw TypeError(".OSMPBF.HeaderBlock.bbox: object expected");t.bbox=$root.OSMPBF.HeaderBBox.fromObject(e.bbox)}if(e.requiredFeatures){if(!Array.isArray(e.requiredFeatures))throw TypeError(".OSMPBF.HeaderBlock.requiredFeatures: array expected");t.requiredFeatures=[];for(var r=0;r<e.requiredFeatures.length;++r)t.requiredFeatures[r]=String(e.requiredFeatures[r])}if(e.optionalFeatures){if(!Array.isArray(e.optionalFeatures))throw TypeError(".OSMPBF.HeaderBlock.optionalFeatures: array expected");t.optionalFeatures=[];for(var r=0;r<e.optionalFeatures.length;++r)t.optionalFeatures[r]=String(e.optionalFeatures[r])}return null!=e.writingprogram&&(t.writingprogram=String(e.writingprogram)),null!=e.source&&(t.source=String(e.source)),null!=e.osmosisReplicationTimestamp&&($util.Long?(t.osmosisReplicationTimestamp=$util.Long.fromValue(e.osmosisReplicationTimestamp)).unsigned=!1:"string"==typeof e.osmosisReplicationTimestamp?t.osmosisReplicationTimestamp=parseInt(e.osmosisReplicationTimestamp,10):"number"==typeof e.osmosisReplicationTimestamp?t.osmosisReplicationTimestamp=e.osmosisReplicationTimestamp:"object"==typeof e.osmosisReplicationTimestamp&&(t.osmosisReplicationTimestamp=new $util.LongBits(e.osmosisReplicationTimestamp.low>>>0,e.osmosisReplicationTimestamp.high>>>0).toNumber())),null!=e.osmosisReplicationSequenceNumber&&($util.Long?(t.osmosisReplicationSequenceNumber=$util.Long.fromValue(e.osmosisReplicationSequenceNumber)).unsigned=!1:"string"==typeof e.osmosisReplicationSequenceNumber?t.osmosisReplicationSequenceNumber=parseInt(e.osmosisReplicationSequenceNumber,10):"number"==typeof e.osmosisReplicationSequenceNumber?t.osmosisReplicationSequenceNumber=e.osmosisReplicationSequenceNumber:"object"==typeof e.osmosisReplicationSequenceNumber&&(t.osmosisReplicationSequenceNumber=new $util.LongBits(e.osmosisReplicationSequenceNumber.low>>>0,e.osmosisReplicationSequenceNumber.high>>>0).toNumber())),null!=e.osmosisReplicationBaseUrl&&(t.osmosisReplicationBaseUrl=String(e.osmosisReplicationBaseUrl)),t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.requiredFeatures=[],r.optionalFeatures=[]),t.defaults){if(r.bbox=null,r.writingprogram="",r.source="",$util.Long){var i=new $util.Long(0,0,!1);r.osmosisReplicationTimestamp=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.osmosisReplicationTimestamp=t.longs===String?"0":0;if($util.Long){var i=new $util.Long(0,0,!1);r.osmosisReplicationSequenceNumber=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.osmosisReplicationSequenceNumber=t.longs===String?"0":0;r.osmosisReplicationBaseUrl=""}if(null!=e.bbox&&e.hasOwnProperty("bbox")&&(r.bbox=$root.OSMPBF.HeaderBBox.toObject(e.bbox,t)),e.requiredFeatures&&e.requiredFeatures.length){r.requiredFeatures=[];for(var n=0;n<e.requiredFeatures.length;++n)r.requiredFeatures[n]=e.requiredFeatures[n]}if(e.optionalFeatures&&e.optionalFeatures.length){r.optionalFeatures=[];for(var n=0;n<e.optionalFeatures.length;++n)r.optionalFeatures[n]=e.optionalFeatures[n]}return null!=e.writingprogram&&e.hasOwnProperty("writingprogram")&&(r.writingprogram=e.writingprogram),null!=e.source&&e.hasOwnProperty("source")&&(r.source=e.source),null!=e.osmosisReplicationTimestamp&&e.hasOwnProperty("osmosisReplicationTimestamp")&&("number"==typeof e.osmosisReplicationTimestamp?r.osmosisReplicationTimestamp=t.longs===String?String(e.osmosisReplicationTimestamp):e.osmosisReplicationTimestamp:r.osmosisReplicationTimestamp=t.longs===String?$util.Long.prototype.toString.call(e.osmosisReplicationTimestamp):t.longs===Number?new $util.LongBits(e.osmosisReplicationTimestamp.low>>>0,e.osmosisReplicationTimestamp.high>>>0).toNumber():e.osmosisReplicationTimestamp),null!=e.osmosisReplicationSequenceNumber&&e.hasOwnProperty("osmosisReplicationSequenceNumber")&&("number"==typeof e.osmosisReplicationSequenceNumber?r.osmosisReplicationSequenceNumber=t.longs===String?String(e.osmosisReplicationSequenceNumber):e.osmosisReplicationSequenceNumber:r.osmosisReplicationSequenceNumber=t.longs===String?$util.Long.prototype.toString.call(e.osmosisReplicationSequenceNumber):t.longs===Number?new $util.LongBits(e.osmosisReplicationSequenceNumber.low>>>0,e.osmosisReplicationSequenceNumber.high>>>0).toNumber():e.osmosisReplicationSequenceNumber),null!=e.osmosisReplicationBaseUrl&&e.hasOwnProperty("osmosisReplicationBaseUrl")&&(r.osmosisReplicationBaseUrl=e.osmosisReplicationBaseUrl),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e}(),e.HeaderBBox=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.left=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.right=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.top=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.bottom=$util.Long?$util.Long.fromBits(0,0,!1):0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=$Writer.create()),t.uint32(8).sint64(e.left),t.uint32(16).sint64(e.right),t.uint32(24).sint64(e.top),t.uint32(32).sint64(e.bottom),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.HeaderBBox;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.left=e.sint64();break;case 2:i.right=e.sint64();break;case 3:i.top=e.sint64();break;case 4:i.bottom=e.sint64();break;default:e.skipType(7&n)}}if(!i.hasOwnProperty("left"))throw $util.ProtocolError("missing required 'left'",{instance:i});if(!i.hasOwnProperty("right"))throw $util.ProtocolError("missing required 'right'",{instance:i});if(!i.hasOwnProperty("top"))throw $util.ProtocolError("missing required 'top'",{instance:i});if(!i.hasOwnProperty("bottom"))throw $util.ProtocolError("missing required 'bottom'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":$util.isInteger(e.left)||e.left&&$util.isInteger(e.left.low)&&$util.isInteger(e.left.high)?$util.isInteger(e.right)||e.right&&$util.isInteger(e.right.low)&&$util.isInteger(e.right.high)?$util.isInteger(e.top)||e.top&&$util.isInteger(e.top.low)&&$util.isInteger(e.top.high)?$util.isInteger(e.bottom)||e.bottom&&$util.isInteger(e.bottom.low)&&$util.isInteger(e.bottom.high)?null:"bottom: integer|Long expected":"top: integer|Long expected":"right: integer|Long expected":"left: integer|Long expected"},e.fromObject=function(e){if(e instanceof $root.OSMPBF.HeaderBBox)return e;var t=new $root.OSMPBF.HeaderBBox;return null!=e.left&&($util.Long?(t.left=$util.Long.fromValue(e.left)).unsigned=!1:"string"==typeof e.left?t.left=parseInt(e.left,10):"number"==typeof e.left?t.left=e.left:"object"==typeof e.left&&(t.left=new $util.LongBits(e.left.low>>>0,e.left.high>>>0).toNumber())),null!=e.right&&($util.Long?(t.right=$util.Long.fromValue(e.right)).unsigned=!1:"string"==typeof e.right?t.right=parseInt(e.right,10):"number"==typeof e.right?t.right=e.right:"object"==typeof e.right&&(t.right=new $util.LongBits(e.right.low>>>0,e.right.high>>>0).toNumber())),null!=e.top&&($util.Long?(t.top=$util.Long.fromValue(e.top)).unsigned=!1:"string"==typeof e.top?t.top=parseInt(e.top,10):"number"==typeof e.top?t.top=e.top:"object"==typeof e.top&&(t.top=new $util.LongBits(e.top.low>>>0,e.top.high>>>0).toNumber())),null!=e.bottom&&($util.Long?(t.bottom=$util.Long.fromValue(e.bottom)).unsigned=!1:"string"==typeof e.bottom?t.bottom=parseInt(e.bottom,10):"number"==typeof e.bottom?t.bottom=e.bottom:"object"==typeof e.bottom&&(t.bottom=new $util.LongBits(e.bottom.low>>>0,e.bottom.high>>>0).toNumber())),t},e.toObject=function(e,t){t||(t={});var r={};if(t.defaults){if($util.Long){var i=new $util.Long(0,0,!1);r.left=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.left=t.longs===String?"0":0;if($util.Long){var i=new $util.Long(0,0,!1);r.right=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.right=t.longs===String?"0":0;if($util.Long){var i=new $util.Long(0,0,!1);r.top=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.top=t.longs===String?"0":0;if($util.Long){var i=new $util.Long(0,0,!1);r.bottom=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.bottom=t.longs===String?"0":0}return null!=e.left&&e.hasOwnProperty("left")&&("number"==typeof e.left?r.left=t.longs===String?String(e.left):e.left:r.left=t.longs===String?$util.Long.prototype.toString.call(e.left):t.longs===Number?new $util.LongBits(e.left.low>>>0,e.left.high>>>0).toNumber():e.left),null!=e.right&&e.hasOwnProperty("right")&&("number"==typeof e.right?r.right=t.longs===String?String(e.right):e.right:r.right=t.longs===String?$util.Long.prototype.toString.call(e.right):t.longs===Number?new $util.LongBits(e.right.low>>>0,e.right.high>>>0).toNumber():e.right),null!=e.top&&e.hasOwnProperty("top")&&("number"==typeof e.top?r.top=t.longs===String?String(e.top):e.top:r.top=t.longs===String?$util.Long.prototype.toString.call(e.top):t.longs===Number?new $util.LongBits(e.top.low>>>0,e.top.high>>>0).toNumber():e.top),null!=e.bottom&&e.hasOwnProperty("bottom")&&("number"==typeof e.bottom?r.bottom=t.longs===String?String(e.bottom):e.bottom:r.bottom=t.longs===String?$util.Long.prototype.toString.call(e.bottom):t.longs===Number?new $util.LongBits(e.bottom.low>>>0,e.bottom.high>>>0).toNumber():e.bottom),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e}(),e.PrimitiveBlock=function(){function e(e){if(this.primitivegroup=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.stringtable=null,e.prototype.primitivegroup=$util.emptyArray,e.prototype.granularity=100,e.prototype.latOffset=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.lonOffset=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.dateGranularity=1e3,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=$Writer.create()),$root.OSMPBF.StringTable.encode(e.stringtable,t.uint32(10).fork()).ldelim(),null!=e.primitivegroup&&e.primitivegroup.length)for(var r=0;r<e.primitivegroup.length;++r)$root.OSMPBF.PrimitiveGroup.encode(e.primitivegroup[r],t.uint32(18).fork()).ldelim();return null!=e.granularity&&e.hasOwnProperty("granularity")&&t.uint32(136).int32(e.granularity),null!=e.dateGranularity&&e.hasOwnProperty("dateGranularity")&&t.uint32(144).int32(e.dateGranularity),null!=e.latOffset&&e.hasOwnProperty("latOffset")&&t.uint32(152).int64(e.latOffset),null!=e.lonOffset&&e.hasOwnProperty("lonOffset")&&t.uint32(160).int64(e.lonOffset),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.PrimitiveBlock;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.stringtable=$root.OSMPBF.StringTable.decode(e,e.uint32());break;case 2:i.primitivegroup&&i.primitivegroup.length||(i.primitivegroup=[]),i.primitivegroup.push($root.OSMPBF.PrimitiveGroup.decode(e,e.uint32()));break;case 17:i.granularity=e.int32();break;case 19:i.latOffset=e.int64();break;case 20:i.lonOffset=e.int64();break;case 18:i.dateGranularity=e.int32();break;default:e.skipType(7&n)}}if(!i.hasOwnProperty("stringtable"))throw $util.ProtocolError("missing required 'stringtable'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t=$root.OSMPBF.StringTable.verify(e.stringtable);if(t)return"stringtable."+t;if(null!=e.primitivegroup&&e.hasOwnProperty("primitivegroup")){if(!Array.isArray(e.primitivegroup))return"primitivegroup: array expected";for(var r=0;r<e.primitivegroup.length;++r){var t=$root.OSMPBF.PrimitiveGroup.verify(e.primitivegroup[r]);if(t)return"primitivegroup."+t}}return null!=e.granularity&&e.hasOwnProperty("granularity")&&!$util.isInteger(e.granularity)?"granularity: integer expected":null!=e.latOffset&&e.hasOwnProperty("latOffset")&&!($util.isInteger(e.latOffset)||e.latOffset&&$util.isInteger(e.latOffset.low)&&$util.isInteger(e.latOffset.high))?"latOffset: integer|Long expected":null!=e.lonOffset&&e.hasOwnProperty("lonOffset")&&!($util.isInteger(e.lonOffset)||e.lonOffset&&$util.isInteger(e.lonOffset.low)&&$util.isInteger(e.lonOffset.high))?"lonOffset: integer|Long expected":null!=e.dateGranularity&&e.hasOwnProperty("dateGranularity")&&!$util.isInteger(e.dateGranularity)?"dateGranularity: integer expected":null},e.fromObject=function(e){if(e instanceof $root.OSMPBF.PrimitiveBlock)return e;var t=new $root.OSMPBF.PrimitiveBlock;if(null!=e.stringtable){if("object"!=typeof e.stringtable)throw TypeError(".OSMPBF.PrimitiveBlock.stringtable: object expected");t.stringtable=$root.OSMPBF.StringTable.fromObject(e.stringtable)}if(e.primitivegroup){if(!Array.isArray(e.primitivegroup))throw TypeError(".OSMPBF.PrimitiveBlock.primitivegroup: array expected");t.primitivegroup=[];for(var r=0;r<e.primitivegroup.length;++r){if("object"!=typeof e.primitivegroup[r])throw TypeError(".OSMPBF.PrimitiveBlock.primitivegroup: object expected");t.primitivegroup[r]=$root.OSMPBF.PrimitiveGroup.fromObject(e.primitivegroup[r])}}return null!=e.granularity&&(t.granularity=0|e.granularity),null!=e.latOffset&&($util.Long?(t.latOffset=$util.Long.fromValue(e.latOffset)).unsigned=!1:"string"==typeof e.latOffset?t.latOffset=parseInt(e.latOffset,10):"number"==typeof e.latOffset?t.latOffset=e.latOffset:"object"==typeof e.latOffset&&(t.latOffset=new $util.LongBits(e.latOffset.low>>>0,e.latOffset.high>>>0).toNumber())),null!=e.lonOffset&&($util.Long?(t.lonOffset=$util.Long.fromValue(e.lonOffset)).unsigned=!1:"string"==typeof e.lonOffset?t.lonOffset=parseInt(e.lonOffset,10):"number"==typeof e.lonOffset?t.lonOffset=e.lonOffset:"object"==typeof e.lonOffset&&(t.lonOffset=new $util.LongBits(e.lonOffset.low>>>0,e.lonOffset.high>>>0).toNumber())),null!=e.dateGranularity&&(t.dateGranularity=0|e.dateGranularity),t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.primitivegroup=[]),t.defaults){if(r.stringtable=null,r.granularity=100,r.dateGranularity=1e3,$util.Long){var i=new $util.Long(0,0,!1);r.latOffset=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.latOffset=t.longs===String?"0":0;if($util.Long){var i=new $util.Long(0,0,!1);r.lonOffset=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.lonOffset=t.longs===String?"0":0}if(null!=e.stringtable&&e.hasOwnProperty("stringtable")&&(r.stringtable=$root.OSMPBF.StringTable.toObject(e.stringtable,t)),e.primitivegroup&&e.primitivegroup.length){r.primitivegroup=[];for(var n=0;n<e.primitivegroup.length;++n)r.primitivegroup[n]=$root.OSMPBF.PrimitiveGroup.toObject(e.primitivegroup[n],t)}return null!=e.granularity&&e.hasOwnProperty("granularity")&&(r.granularity=e.granularity),null!=e.dateGranularity&&e.hasOwnProperty("dateGranularity")&&(r.dateGranularity=e.dateGranularity),null!=e.latOffset&&e.hasOwnProperty("latOffset")&&("number"==typeof e.latOffset?r.latOffset=t.longs===String?String(e.latOffset):e.latOffset:r.latOffset=t.longs===String?$util.Long.prototype.toString.call(e.latOffset):t.longs===Number?new $util.LongBits(e.latOffset.low>>>0,e.latOffset.high>>>0).toNumber():e.latOffset),null!=e.lonOffset&&e.hasOwnProperty("lonOffset")&&("number"==typeof e.lonOffset?r.lonOffset=t.longs===String?String(e.lonOffset):e.lonOffset:r.lonOffset=t.longs===String?$util.Long.prototype.toString.call(e.lonOffset):t.longs===Number?new $util.LongBits(e.lonOffset.low>>>0,e.lonOffset.high>>>0).toNumber():e.lonOffset),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e}(),e.PrimitiveGroup=function(){function e(e){if(this.nodes=[],this.ways=[],this.relations=[],this.changesets=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.nodes=$util.emptyArray,e.prototype.dense=null,e.prototype.ways=$util.emptyArray,e.prototype.relations=$util.emptyArray,e.prototype.changesets=$util.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=$Writer.create()),null!=e.nodes&&e.nodes.length)for(var r=0;r<e.nodes.length;++r)$root.OSMPBF.Node.encode(e.nodes[r],t.uint32(10).fork()).ldelim();if(null!=e.dense&&e.hasOwnProperty("dense")&&$root.OSMPBF.DenseNodes.encode(e.dense,t.uint32(18).fork()).ldelim(),null!=e.ways&&e.ways.length)for(var r=0;r<e.ways.length;++r)$root.OSMPBF.Way.encode(e.ways[r],t.uint32(26).fork()).ldelim();if(null!=e.relations&&e.relations.length)for(var r=0;r<e.relations.length;++r)$root.OSMPBF.Relation.encode(e.relations[r],t.uint32(34).fork()).ldelim();if(null!=e.changesets&&e.changesets.length)for(var r=0;r<e.changesets.length;++r)$root.OSMPBF.ChangeSet.encode(e.changesets[r],t.uint32(42).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.PrimitiveGroup;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.nodes&&i.nodes.length||(i.nodes=[]),i.nodes.push($root.OSMPBF.Node.decode(e,e.uint32()));break;case 2:i.dense=$root.OSMPBF.DenseNodes.decode(e,e.uint32());break;case 3:i.ways&&i.ways.length||(i.ways=[]),i.ways.push($root.OSMPBF.Way.decode(e,e.uint32()));break;case 4:i.relations&&i.relations.length||(i.relations=[]),i.relations.push($root.OSMPBF.Relation.decode(e,e.uint32()));break;case 5:i.changesets&&i.changesets.length||(i.changesets=[]),i.changesets.push($root.OSMPBF.ChangeSet.decode(e,e.uint32()));break;default:e.skipType(7&n)}}return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.nodes&&e.hasOwnProperty("nodes")){if(!Array.isArray(e.nodes))return"nodes: array expected";for(var t=0;t<e.nodes.length;++t){var r=$root.OSMPBF.Node.verify(e.nodes[t]);if(r)return"nodes."+r}}if(null!=e.dense&&e.hasOwnProperty("dense")){var r=$root.OSMPBF.DenseNodes.verify(e.dense);if(r)return"dense."+r}if(null!=e.ways&&e.hasOwnProperty("ways")){if(!Array.isArray(e.ways))return"ways: array expected";for(var t=0;t<e.ways.length;++t){var r=$root.OSMPBF.Way.verify(e.ways[t]);if(r)return"ways."+r}}if(null!=e.relations&&e.hasOwnProperty("relations")){if(!Array.isArray(e.relations))return"relations: array expected";for(var t=0;t<e.relations.length;++t){var r=$root.OSMPBF.Relation.verify(e.relations[t]);if(r)return"relations."+r}}if(null!=e.changesets&&e.hasOwnProperty("changesets")){if(!Array.isArray(e.changesets))return"changesets: array expected";for(var t=0;t<e.changesets.length;++t){var r=$root.OSMPBF.ChangeSet.verify(e.changesets[t]);if(r)return"changesets."+r}}return null},e.fromObject=function(e){if(e instanceof $root.OSMPBF.PrimitiveGroup)return e;var t=new $root.OSMPBF.PrimitiveGroup;if(e.nodes){if(!Array.isArray(e.nodes))throw TypeError(".OSMPBF.PrimitiveGroup.nodes: array expected");t.nodes=[];for(var r=0;r<e.nodes.length;++r){if("object"!=typeof e.nodes[r])throw TypeError(".OSMPBF.PrimitiveGroup.nodes: object expected");t.nodes[r]=$root.OSMPBF.Node.fromObject(e.nodes[r])}}if(null!=e.dense){if("object"!=typeof e.dense)throw TypeError(".OSMPBF.PrimitiveGroup.dense: object expected");t.dense=$root.OSMPBF.DenseNodes.fromObject(e.dense)}if(e.ways){if(!Array.isArray(e.ways))throw TypeError(".OSMPBF.PrimitiveGroup.ways: array expected");t.ways=[];for(var r=0;r<e.ways.length;++r){if("object"!=typeof e.ways[r])throw TypeError(".OSMPBF.PrimitiveGroup.ways: object expected");t.ways[r]=$root.OSMPBF.Way.fromObject(e.ways[r])}}if(e.relations){if(!Array.isArray(e.relations))throw TypeError(".OSMPBF.PrimitiveGroup.relations: array expected");t.relations=[];for(var r=0;r<e.relations.length;++r){
if("object"!=typeof e.relations[r])throw TypeError(".OSMPBF.PrimitiveGroup.relations: object expected");t.relations[r]=$root.OSMPBF.Relation.fromObject(e.relations[r])}}if(e.changesets){if(!Array.isArray(e.changesets))throw TypeError(".OSMPBF.PrimitiveGroup.changesets: array expected");t.changesets=[];for(var r=0;r<e.changesets.length;++r){if("object"!=typeof e.changesets[r])throw TypeError(".OSMPBF.PrimitiveGroup.changesets: object expected");t.changesets[r]=$root.OSMPBF.ChangeSet.fromObject(e.changesets[r])}}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.nodes=[],r.ways=[],r.relations=[],r.changesets=[]),t.defaults&&(r.dense=null),e.nodes&&e.nodes.length){r.nodes=[];for(var i=0;i<e.nodes.length;++i)r.nodes[i]=$root.OSMPBF.Node.toObject(e.nodes[i],t)}if(null!=e.dense&&e.hasOwnProperty("dense")&&(r.dense=$root.OSMPBF.DenseNodes.toObject(e.dense,t)),e.ways&&e.ways.length){r.ways=[];for(var i=0;i<e.ways.length;++i)r.ways[i]=$root.OSMPBF.Way.toObject(e.ways[i],t)}if(e.relations&&e.relations.length){r.relations=[];for(var i=0;i<e.relations.length;++i)r.relations[i]=$root.OSMPBF.Relation.toObject(e.relations[i],t)}if(e.changesets&&e.changesets.length){r.changesets=[];for(var i=0;i<e.changesets.length;++i)r.changesets[i]=$root.OSMPBF.ChangeSet.toObject(e.changesets[i],t)}return r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e}(),e.StringTable=function(){function e(e){if(this.s=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.s=$util.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=$Writer.create()),null!=e.s&&e.s.length)for(var r=0;r<e.s.length;++r)t.uint32(10).bytes(e.s[r]);return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.StringTable;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.s&&i.s.length||(i.s=[]),i.s.push(e.bytes());break;default:e.skipType(7&n)}}return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.s&&e.hasOwnProperty("s")){if(!Array.isArray(e.s))return"s: array expected";for(var t=0;t<e.s.length;++t)if(!(e.s[t]&&"number"==typeof e.s[t].length||$util.isString(e.s[t])))return"s: buffer[] expected"}return null},e.fromObject=function(e){if(e instanceof $root.OSMPBF.StringTable)return e;var t=new $root.OSMPBF.StringTable;if(e.s){if(!Array.isArray(e.s))throw TypeError(".OSMPBF.StringTable.s: array expected");t.s=[];for(var r=0;r<e.s.length;++r)"string"==typeof e.s[r]?$util.base64.decode(e.s[r],t.s[r]=$util.newBuffer($util.base64.length(e.s[r])),0):e.s[r].length&&(t.s[r]=e.s[r])}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.s=[]),e.s&&e.s.length){r.s=[];for(var i=0;i<e.s.length;++i)r.s[i]=t.bytes===String?$util.base64.encode(e.s[i],0,e.s[i].length):t.bytes===Array?Array.prototype.slice.call(e.s[i]):e.s[i]}return r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e}(),e.Info=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.version=-1,e.prototype.timestamp=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.changeset=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.uid=0,e.prototype.userSid=0,e.prototype.visible=!1,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=$Writer.create()),null!=e.version&&e.hasOwnProperty("version")&&t.uint32(8).int32(e.version),null!=e.timestamp&&e.hasOwnProperty("timestamp")&&t.uint32(16).int64(e.timestamp),null!=e.changeset&&e.hasOwnProperty("changeset")&&t.uint32(24).int64(e.changeset),null!=e.uid&&e.hasOwnProperty("uid")&&t.uint32(32).int32(e.uid),null!=e.userSid&&e.hasOwnProperty("userSid")&&t.uint32(40).uint32(e.userSid),null!=e.visible&&e.hasOwnProperty("visible")&&t.uint32(48).bool(e.visible),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.Info;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.version=e.int32();break;case 2:i.timestamp=e.int64();break;case 3:i.changeset=e.int64();break;case 4:i.uid=e.int32();break;case 5:i.userSid=e.uint32();break;case 6:i.visible=e.bool();break;default:e.skipType(7&n)}}return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.version&&e.hasOwnProperty("version")&&!$util.isInteger(e.version)?"version: integer expected":null!=e.timestamp&&e.hasOwnProperty("timestamp")&&!($util.isInteger(e.timestamp)||e.timestamp&&$util.isInteger(e.timestamp.low)&&$util.isInteger(e.timestamp.high))?"timestamp: integer|Long expected":null!=e.changeset&&e.hasOwnProperty("changeset")&&!($util.isInteger(e.changeset)||e.changeset&&$util.isInteger(e.changeset.low)&&$util.isInteger(e.changeset.high))?"changeset: integer|Long expected":null!=e.uid&&e.hasOwnProperty("uid")&&!$util.isInteger(e.uid)?"uid: integer expected":null!=e.userSid&&e.hasOwnProperty("userSid")&&!$util.isInteger(e.userSid)?"userSid: integer expected":null!=e.visible&&e.hasOwnProperty("visible")&&"boolean"!=typeof e.visible?"visible: boolean expected":null},e.fromObject=function(e){if(e instanceof $root.OSMPBF.Info)return e;var t=new $root.OSMPBF.Info;return null!=e.version&&(t.version=0|e.version),null!=e.timestamp&&($util.Long?(t.timestamp=$util.Long.fromValue(e.timestamp)).unsigned=!1:"string"==typeof e.timestamp?t.timestamp=parseInt(e.timestamp,10):"number"==typeof e.timestamp?t.timestamp=e.timestamp:"object"==typeof e.timestamp&&(t.timestamp=new $util.LongBits(e.timestamp.low>>>0,e.timestamp.high>>>0).toNumber())),null!=e.changeset&&($util.Long?(t.changeset=$util.Long.fromValue(e.changeset)).unsigned=!1:"string"==typeof e.changeset?t.changeset=parseInt(e.changeset,10):"number"==typeof e.changeset?t.changeset=e.changeset:"object"==typeof e.changeset&&(t.changeset=new $util.LongBits(e.changeset.low>>>0,e.changeset.high>>>0).toNumber())),null!=e.uid&&(t.uid=0|e.uid),null!=e.userSid&&(t.userSid=e.userSid>>>0),null!=e.visible&&(t.visible=Boolean(e.visible)),t},e.toObject=function(e,t){t||(t={});var r={};if(t.defaults){if(r.version=-1,$util.Long){var i=new $util.Long(0,0,!1);r.timestamp=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.timestamp=t.longs===String?"0":0;if($util.Long){var i=new $util.Long(0,0,!1);r.changeset=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.changeset=t.longs===String?"0":0;r.uid=0,r.userSid=0,r.visible=!1}return null!=e.version&&e.hasOwnProperty("version")&&(r.version=e.version),null!=e.timestamp&&e.hasOwnProperty("timestamp")&&("number"==typeof e.timestamp?r.timestamp=t.longs===String?String(e.timestamp):e.timestamp:r.timestamp=t.longs===String?$util.Long.prototype.toString.call(e.timestamp):t.longs===Number?new $util.LongBits(e.timestamp.low>>>0,e.timestamp.high>>>0).toNumber():e.timestamp),null!=e.changeset&&e.hasOwnProperty("changeset")&&("number"==typeof e.changeset?r.changeset=t.longs===String?String(e.changeset):e.changeset:r.changeset=t.longs===String?$util.Long.prototype.toString.call(e.changeset):t.longs===Number?new $util.LongBits(e.changeset.low>>>0,e.changeset.high>>>0).toNumber():e.changeset),null!=e.uid&&e.hasOwnProperty("uid")&&(r.uid=e.uid),null!=e.userSid&&e.hasOwnProperty("userSid")&&(r.userSid=e.userSid),null!=e.visible&&e.hasOwnProperty("visible")&&(r.visible=e.visible),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e}(),e.DenseInfo=function(){function e(e){if(this.version=[],this.timestamp=[],this.changeset=[],this.uid=[],this.userSid=[],this.visible=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.version=$util.emptyArray,e.prototype.timestamp=$util.emptyArray,e.prototype.changeset=$util.emptyArray,e.prototype.uid=$util.emptyArray,e.prototype.userSid=$util.emptyArray,e.prototype.visible=$util.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=$Writer.create()),null!=e.version&&e.version.length){t.uint32(10).fork();for(var r=0;r<e.version.length;++r)t.int32(e.version[r]);t.ldelim()}if(null!=e.timestamp&&e.timestamp.length){t.uint32(18).fork();for(var r=0;r<e.timestamp.length;++r)t.sint64(e.timestamp[r]);t.ldelim()}if(null!=e.changeset&&e.changeset.length){t.uint32(26).fork();for(var r=0;r<e.changeset.length;++r)t.sint64(e.changeset[r]);t.ldelim()}if(null!=e.uid&&e.uid.length){t.uint32(34).fork();for(var r=0;r<e.uid.length;++r)t.sint32(e.uid[r]);t.ldelim()}if(null!=e.userSid&&e.userSid.length){t.uint32(42).fork();for(var r=0;r<e.userSid.length;++r)t.sint32(e.userSid[r]);t.ldelim()}if(null!=e.visible&&e.visible.length){t.uint32(50).fork();for(var r=0;r<e.visible.length;++r)t.bool(e.visible[r]);t.ldelim()}return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.DenseInfo;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:if(i.version&&i.version.length||(i.version=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.version.push(e.int32());else i.version.push(e.int32());break;case 2:if(i.timestamp&&i.timestamp.length||(i.timestamp=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.timestamp.push(e.sint64());else i.timestamp.push(e.sint64());break;case 3:if(i.changeset&&i.changeset.length||(i.changeset=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.changeset.push(e.sint64());else i.changeset.push(e.sint64());break;case 4:if(i.uid&&i.uid.length||(i.uid=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.uid.push(e.sint32());else i.uid.push(e.sint32());break;case 5:if(i.userSid&&i.userSid.length||(i.userSid=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.userSid.push(e.sint32());else i.userSid.push(e.sint32());break;case 6:if(i.visible&&i.visible.length||(i.visible=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.visible.push(e.bool());else i.visible.push(e.bool());break;default:e.skipType(7&n)}}return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.version&&e.hasOwnProperty("version")){if(!Array.isArray(e.version))return"version: array expected";for(var t=0;t<e.version.length;++t)if(!$util.isInteger(e.version[t]))return"version: integer[] expected"}if(null!=e.timestamp&&e.hasOwnProperty("timestamp")){if(!Array.isArray(e.timestamp))return"timestamp: array expected";for(var t=0;t<e.timestamp.length;++t)if(!($util.isInteger(e.timestamp[t])||e.timestamp[t]&&$util.isInteger(e.timestamp[t].low)&&$util.isInteger(e.timestamp[t].high)))return"timestamp: integer|Long[] expected"}if(null!=e.changeset&&e.hasOwnProperty("changeset")){if(!Array.isArray(e.changeset))return"changeset: array expected";for(var t=0;t<e.changeset.length;++t)if(!($util.isInteger(e.changeset[t])||e.changeset[t]&&$util.isInteger(e.changeset[t].low)&&$util.isInteger(e.changeset[t].high)))return"changeset: integer|Long[] expected"}if(null!=e.uid&&e.hasOwnProperty("uid")){if(!Array.isArray(e.uid))return"uid: array expected";for(var t=0;t<e.uid.length;++t)if(!$util.isInteger(e.uid[t]))return"uid: integer[] expected"}if(null!=e.userSid&&e.hasOwnProperty("userSid")){if(!Array.isArray(e.userSid))return"userSid: array expected";for(var t=0;t<e.userSid.length;++t)if(!$util.isInteger(e.userSid[t]))return"userSid: integer[] expected"}if(null!=e.visible&&e.hasOwnProperty("visible")){if(!Array.isArray(e.visible))return"visible: array expected";for(var t=0;t<e.visible.length;++t)if("boolean"!=typeof e.visible[t])return"visible: boolean[] expected"}return null},e.fromObject=function(e){if(e instanceof $root.OSMPBF.DenseInfo)return e;var t=new $root.OSMPBF.DenseInfo;if(e.version){if(!Array.isArray(e.version))throw TypeError(".OSMPBF.DenseInfo.version: array expected");t.version=[];for(var r=0;r<e.version.length;++r)t.version[r]=0|e.version[r]}if(e.timestamp){if(!Array.isArray(e.timestamp))throw TypeError(".OSMPBF.DenseInfo.timestamp: array expected");t.timestamp=[];for(var r=0;r<e.timestamp.length;++r)$util.Long?(t.timestamp[r]=$util.Long.fromValue(e.timestamp[r])).unsigned=!1:"string"==typeof e.timestamp[r]?t.timestamp[r]=parseInt(e.timestamp[r],10):"number"==typeof e.timestamp[r]?t.timestamp[r]=e.timestamp[r]:"object"==typeof e.timestamp[r]&&(t.timestamp[r]=new $util.LongBits(e.timestamp[r].low>>>0,e.timestamp[r].high>>>0).toNumber())}if(e.changeset){if(!Array.isArray(e.changeset))throw TypeError(".OSMPBF.DenseInfo.changeset: array expected");t.changeset=[];for(var r=0;r<e.changeset.length;++r)$util.Long?(t.changeset[r]=$util.Long.fromValue(e.changeset[r])).unsigned=!1:"string"==typeof e.changeset[r]?t.changeset[r]=parseInt(e.changeset[r],10):"number"==typeof e.changeset[r]?t.changeset[r]=e.changeset[r]:"object"==typeof e.changeset[r]&&(t.changeset[r]=new $util.LongBits(e.changeset[r].low>>>0,e.changeset[r].high>>>0).toNumber())}if(e.uid){if(!Array.isArray(e.uid))throw TypeError(".OSMPBF.DenseInfo.uid: array expected");t.uid=[];for(var r=0;r<e.uid.length;++r)t.uid[r]=0|e.uid[r]}if(e.userSid){if(!Array.isArray(e.userSid))throw TypeError(".OSMPBF.DenseInfo.userSid: array expected");t.userSid=[];for(var r=0;r<e.userSid.length;++r)t.userSid[r]=0|e.userSid[r]}if(e.visible){if(!Array.isArray(e.visible))throw TypeError(".OSMPBF.DenseInfo.visible: array expected");t.visible=[];for(var r=0;r<e.visible.length;++r)t.visible[r]=Boolean(e.visible[r])}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.version=[],r.timestamp=[],r.changeset=[],r.uid=[],r.userSid=[],r.visible=[]),e.version&&e.version.length){r.version=[];for(var i=0;i<e.version.length;++i)r.version[i]=e.version[i]}if(e.timestamp&&e.timestamp.length){r.timestamp=[];for(var i=0;i<e.timestamp.length;++i)"number"==typeof e.timestamp[i]?r.timestamp[i]=t.longs===String?String(e.timestamp[i]):e.timestamp[i]:r.timestamp[i]=t.longs===String?$util.Long.prototype.toString.call(e.timestamp[i]):t.longs===Number?new $util.LongBits(e.timestamp[i].low>>>0,e.timestamp[i].high>>>0).toNumber():e.timestamp[i]}if(e.changeset&&e.changeset.length){r.changeset=[];for(var i=0;i<e.changeset.length;++i)"number"==typeof e.changeset[i]?r.changeset[i]=t.longs===String?String(e.changeset[i]):e.changeset[i]:r.changeset[i]=t.longs===String?$util.Long.prototype.toString.call(e.changeset[i]):t.longs===Number?new $util.LongBits(e.changeset[i].low>>>0,e.changeset[i].high>>>0).toNumber():e.changeset[i]}if(e.uid&&e.uid.length){r.uid=[];for(var i=0;i<e.uid.length;++i)r.uid[i]=e.uid[i]}if(e.userSid&&e.userSid.length){r.userSid=[];for(var i=0;i<e.userSid.length;++i)r.userSid[i]=e.userSid[i]}if(e.visible&&e.visible.length){r.visible=[];for(var i=0;i<e.visible.length;++i)r.visible[i]=e.visible[i]}return r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e}(),e.ChangeSet=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.id=$util.Long?$util.Long.fromBits(0,0,!1):0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=$Writer.create()),t.uint32(8).int64(e.id),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.ChangeSet;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.id=e.int64();break;default:e.skipType(7&n)}}if(!i.hasOwnProperty("id"))throw $util.ProtocolError("missing required 'id'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":$util.isInteger(e.id)||e.id&&$util.isInteger(e.id.low)&&$util.isInteger(e.id.high)?null:"id: integer|Long expected"},e.fromObject=function(e){if(e instanceof $root.OSMPBF.ChangeSet)return e;var t=new $root.OSMPBF.ChangeSet;return null!=e.id&&($util.Long?(t.id=$util.Long.fromValue(e.id)).unsigned=!1:"string"==typeof e.id?t.id=parseInt(e.id,10):"number"==typeof e.id?t.id=e.id:"object"==typeof e.id&&(t.id=new $util.LongBits(e.id.low>>>0,e.id.high>>>0).toNumber())),t},e.toObject=function(e,t){t||(t={});var r={};if(t.defaults)if($util.Long){var i=new $util.Long(0,0,!1);r.id=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.id=t.longs===String?"0":0;return null!=e.id&&e.hasOwnProperty("id")&&("number"==typeof e.id?r.id=t.longs===String?String(e.id):e.id:r.id=t.longs===String?$util.Long.prototype.toString.call(e.id):t.longs===Number?new $util.LongBits(e.id.low>>>0,e.id.high>>>0).toNumber():e.id),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e}(),e.Node=function(){function e(e){if(this.keys=[],this.vals=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.id=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.keys=$util.emptyArray,e.prototype.vals=$util.emptyArray,e.prototype.info=null,e.prototype.lat=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.lon=$util.Long?$util.Long.fromBits(0,0,!1):0,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=$Writer.create()),t.uint32(8).sint64(e.id),null!=e.keys&&e.keys.length){t.uint32(18).fork();for(var r=0;r<e.keys.length;++r)t.uint32(e.keys[r]);t.ldelim()}if(null!=e.vals&&e.vals.length){t.uint32(26).fork();for(var r=0;r<e.vals.length;++r)t.uint32(e.vals[r]);t.ldelim()}return null!=e.info&&e.hasOwnProperty("info")&&$root.OSMPBF.Info.encode(e.info,t.uint32(34).fork()).ldelim(),t.uint32(64).sint64(e.lat),t.uint32(72).sint64(e.lon),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.Node;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.id=e.sint64();break;case 2:if(i.keys&&i.keys.length||(i.keys=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.keys.push(e.uint32());else i.keys.push(e.uint32());break;case 3:if(i.vals&&i.vals.length||(i.vals=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.vals.push(e.uint32());else i.vals.push(e.uint32());break;case 4:i.info=$root.OSMPBF.Info.decode(e,e.uint32());break;case 8:i.lat=e.sint64();break;case 9:i.lon=e.sint64();break;default:e.skipType(7&n)}}if(!i.hasOwnProperty("id"))throw $util.ProtocolError("missing required 'id'",{instance:i});if(!i.hasOwnProperty("lat"))throw $util.ProtocolError("missing required 'lat'",{instance:i});if(!i.hasOwnProperty("lon"))throw $util.ProtocolError("missing required 'lon'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(!($util.isInteger(e.id)||e.id&&$util.isInteger(e.id.low)&&$util.isInteger(e.id.high)))return"id: integer|Long expected";if(null!=e.keys&&e.hasOwnProperty("keys")){if(!Array.isArray(e.keys))return"keys: array expected";for(var t=0;t<e.keys.length;++t)if(!$util.isInteger(e.keys[t]))return"keys: integer[] expected"}if(null!=e.vals&&e.hasOwnProperty("vals")){if(!Array.isArray(e.vals))return"vals: array expected";for(var t=0;t<e.vals.length;++t)if(!$util.isInteger(e.vals[t]))return"vals: integer[] expected"}if(null!=e.info&&e.hasOwnProperty("info")){var r=$root.OSMPBF.Info.verify(e.info);if(r)return"info."+r}return $util.isInteger(e.lat)||e.lat&&$util.isInteger(e.lat.low)&&$util.isInteger(e.lat.high)?$util.isInteger(e.lon)||e.lon&&$util.isInteger(e.lon.low)&&$util.isInteger(e.lon.high)?null:"lon: integer|Long expected":"lat: integer|Long expected"},e.fromObject=function(e){if(e instanceof $root.OSMPBF.Node)return e;var t=new $root.OSMPBF.Node;if(null!=e.id&&($util.Long?(t.id=$util.Long.fromValue(e.id)).unsigned=!1:"string"==typeof e.id?t.id=parseInt(e.id,10):"number"==typeof e.id?t.id=e.id:"object"==typeof e.id&&(t.id=new $util.LongBits(e.id.low>>>0,e.id.high>>>0).toNumber())),e.keys){if(!Array.isArray(e.keys))throw TypeError(".OSMPBF.Node.keys: array expected");t.keys=[];for(var r=0;r<e.keys.length;++r)t.keys[r]=e.keys[r]>>>0}if(e.vals){if(!Array.isArray(e.vals))throw TypeError(".OSMPBF.Node.vals: array expected");t.vals=[];for(var r=0;r<e.vals.length;++r)t.vals[r]=e.vals[r]>>>0}if(null!=e.info){if("object"!=typeof e.info)throw TypeError(".OSMPBF.Node.info: object expected");t.info=$root.OSMPBF.Info.fromObject(e.info)}return null!=e.lat&&($util.Long?(t.lat=$util.Long.fromValue(e.lat)).unsigned=!1:"string"==typeof e.lat?t.lat=parseInt(e.lat,10):"number"==typeof e.lat?t.lat=e.lat:"object"==typeof e.lat&&(t.lat=new $util.LongBits(e.lat.low>>>0,e.lat.high>>>0).toNumber())),null!=e.lon&&($util.Long?(t.lon=$util.Long.fromValue(e.lon)).unsigned=!1:"string"==typeof e.lon?t.lon=parseInt(e.lon,10):"number"==typeof e.lon?t.lon=e.lon:"object"==typeof e.lon&&(t.lon=new $util.LongBits(e.lon.low>>>0,e.lon.high>>>0).toNumber())),t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.keys=[],r.vals=[]),t.defaults){if($util.Long){var i=new $util.Long(0,0,!1);r.id=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.id=t.longs===String?"0":0;if(r.info=null,$util.Long){var i=new $util.Long(0,0,!1);r.lat=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.lat=t.longs===String?"0":0;if($util.Long){var i=new $util.Long(0,0,!1);r.lon=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.lon=t.longs===String?"0":0}if(null!=e.id&&e.hasOwnProperty("id")&&("number"==typeof e.id?r.id=t.longs===String?String(e.id):e.id:r.id=t.longs===String?$util.Long.prototype.toString.call(e.id):t.longs===Number?new $util.LongBits(e.id.low>>>0,e.id.high>>>0).toNumber():e.id),e.keys&&e.keys.length){r.keys=[];for(var n=0;n<e.keys.length;++n)r.keys[n]=e.keys[n]}if(e.vals&&e.vals.length){r.vals=[];for(var n=0;n<e.vals.length;++n)r.vals[n]=e.vals[n]}return null!=e.info&&e.hasOwnProperty("info")&&(r.info=$root.OSMPBF.Info.toObject(e.info,t)),null!=e.lat&&e.hasOwnProperty("lat")&&("number"==typeof e.lat?r.lat=t.longs===String?String(e.lat):e.lat:r.lat=t.longs===String?$util.Long.prototype.toString.call(e.lat):t.longs===Number?new $util.LongBits(e.lat.low>>>0,e.lat.high>>>0).toNumber():e.lat),null!=e.lon&&e.hasOwnProperty("lon")&&("number"==typeof e.lon?r.lon=t.longs===String?String(e.lon):e.lon:r.lon=t.longs===String?$util.Long.prototype.toString.call(e.lon):t.longs===Number?new $util.LongBits(e.lon.low>>>0,e.lon.high>>>0).toNumber():e.lon),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e}(),e.DenseNodes=function(){function e(e){if(this.id=[],this.lat=[],this.lon=[],this.keysVals=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.id=$util.emptyArray,e.prototype.denseinfo=null,e.prototype.lat=$util.emptyArray,e.prototype.lon=$util.emptyArray,e.prototype.keysVals=$util.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=$Writer.create()),null!=e.id&&e.id.length){t.uint32(10).fork();for(var r=0;r<e.id.length;++r)t.sint64(e.id[r]);t.ldelim()}if(null!=e.denseinfo&&e.hasOwnProperty("denseinfo")&&$root.OSMPBF.DenseInfo.encode(e.denseinfo,t.uint32(42).fork()).ldelim(),null!=e.lat&&e.lat.length){t.uint32(66).fork();for(var r=0;r<e.lat.length;++r)t.sint64(e.lat[r]);t.ldelim()}if(null!=e.lon&&e.lon.length){t.uint32(74).fork();for(var r=0;r<e.lon.length;++r)t.sint64(e.lon[r]);t.ldelim()}if(null!=e.keysVals&&e.keysVals.length){t.uint32(82).fork();for(var r=0;r<e.keysVals.length;++r)t.int32(e.keysVals[r]);t.ldelim()}return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.DenseNodes;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:if(i.id&&i.id.length||(i.id=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.id.push(e.sint64());else i.id.push(e.sint64());break;case 5:i.denseinfo=$root.OSMPBF.DenseInfo.decode(e,e.uint32());break;case 8:if(i.lat&&i.lat.length||(i.lat=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.lat.push(e.sint64());else i.lat.push(e.sint64());break;case 9:if(i.lon&&i.lon.length||(i.lon=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.lon.push(e.sint64());else i.lon.push(e.sint64());break;case 10:if(i.keysVals&&i.keysVals.length||(i.keysVals=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.keysVals.push(e.int32());else i.keysVals.push(e.int32());break;default:e.skipType(7&n)}}return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.id&&e.hasOwnProperty("id")){if(!Array.isArray(e.id))return"id: array expected";for(var t=0;t<e.id.length;++t)if(!($util.isInteger(e.id[t])||e.id[t]&&$util.isInteger(e.id[t].low)&&$util.isInteger(e.id[t].high)))return"id: integer|Long[] expected"}if(null!=e.denseinfo&&e.hasOwnProperty("denseinfo")){var r=$root.OSMPBF.DenseInfo.verify(e.denseinfo);if(r)return"denseinfo."+r}if(null!=e.lat&&e.hasOwnProperty("lat")){if(!Array.isArray(e.lat))return"lat: array expected";for(var t=0;t<e.lat.length;++t)if(!($util.isInteger(e.lat[t])||e.lat[t]&&$util.isInteger(e.lat[t].low)&&$util.isInteger(e.lat[t].high)))return"lat: integer|Long[] expected"}if(null!=e.lon&&e.hasOwnProperty("lon")){if(!Array.isArray(e.lon))return"lon: array expected";for(var t=0;t<e.lon.length;++t)if(!($util.isInteger(e.lon[t])||e.lon[t]&&$util.isInteger(e.lon[t].low)&&$util.isInteger(e.lon[t].high)))return"lon: integer|Long[] expected"}if(null!=e.keysVals&&e.hasOwnProperty("keysVals")){if(!Array.isArray(e.keysVals))return"keysVals: array expected";for(var t=0;t<e.keysVals.length;++t)if(!$util.isInteger(e.keysVals[t]))return"keysVals: integer[] expected"}return null},e.fromObject=function(e){if(e instanceof $root.OSMPBF.DenseNodes)return e;var t=new $root.OSMPBF.DenseNodes;if(e.id){if(!Array.isArray(e.id))throw TypeError(".OSMPBF.DenseNodes.id: array expected");t.id=[];for(var r=0;r<e.id.length;++r)$util.Long?(t.id[r]=$util.Long.fromValue(e.id[r])).unsigned=!1:"string"==typeof e.id[r]?t.id[r]=parseInt(e.id[r],10):"number"==typeof e.id[r]?t.id[r]=e.id[r]:"object"==typeof e.id[r]&&(t.id[r]=new $util.LongBits(e.id[r].low>>>0,e.id[r].high>>>0).toNumber())}if(null!=e.denseinfo){if("object"!=typeof e.denseinfo)throw TypeError(".OSMPBF.DenseNodes.denseinfo: object expected");t.denseinfo=$root.OSMPBF.DenseInfo.fromObject(e.denseinfo)}if(e.lat){if(!Array.isArray(e.lat))throw TypeError(".OSMPBF.DenseNodes.lat: array expected");t.lat=[];for(var r=0;r<e.lat.length;++r)$util.Long?(t.lat[r]=$util.Long.fromValue(e.lat[r])).unsigned=!1:"string"==typeof e.lat[r]?t.lat[r]=parseInt(e.lat[r],10):"number"==typeof e.lat[r]?t.lat[r]=e.lat[r]:"object"==typeof e.lat[r]&&(t.lat[r]=new $util.LongBits(e.lat[r].low>>>0,e.lat[r].high>>>0).toNumber())}if(e.lon){if(!Array.isArray(e.lon))throw TypeError(".OSMPBF.DenseNodes.lon: array expected");t.lon=[];for(var r=0;r<e.lon.length;++r)$util.Long?(t.lon[r]=$util.Long.fromValue(e.lon[r])).unsigned=!1:"string"==typeof e.lon[r]?t.lon[r]=parseInt(e.lon[r],10):"number"==typeof e.lon[r]?t.lon[r]=e.lon[r]:"object"==typeof e.lon[r]&&(t.lon[r]=new $util.LongBits(e.lon[r].low>>>0,e.lon[r].high>>>0).toNumber())}if(e.keysVals){if(!Array.isArray(e.keysVals))throw TypeError(".OSMPBF.DenseNodes.keysVals: array expected");t.keysVals=[];for(var r=0;r<e.keysVals.length;++r)t.keysVals[r]=0|e.keysVals[r]}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.id=[],r.lat=[],r.lon=[],r.keysVals=[]),t.defaults&&(r.denseinfo=null),e.id&&e.id.length){r.id=[];for(var i=0;i<e.id.length;++i)"number"==typeof e.id[i]?r.id[i]=t.longs===String?String(e.id[i]):e.id[i]:r.id[i]=t.longs===String?$util.Long.prototype.toString.call(e.id[i]):t.longs===Number?new $util.LongBits(e.id[i].low>>>0,e.id[i].high>>>0).toNumber():e.id[i]}if(null!=e.denseinfo&&e.hasOwnProperty("denseinfo")&&(r.denseinfo=$root.OSMPBF.DenseInfo.toObject(e.denseinfo,t)),e.lat&&e.lat.length){r.lat=[];for(var i=0;i<e.lat.length;++i)"number"==typeof e.lat[i]?r.lat[i]=t.longs===String?String(e.lat[i]):e.lat[i]:r.lat[i]=t.longs===String?$util.Long.prototype.toString.call(e.lat[i]):t.longs===Number?new $util.LongBits(e.lat[i].low>>>0,e.lat[i].high>>>0).toNumber():e.lat[i]}if(e.lon&&e.lon.length){r.lon=[];for(var i=0;i<e.lon.length;++i)"number"==typeof e.lon[i]?r.lon[i]=t.longs===String?String(e.lon[i]):e.lon[i]:r.lon[i]=t.longs===String?$util.Long.prototype.toString.call(e.lon[i]):t.longs===Number?new $util.LongBits(e.lon[i].low>>>0,e.lon[i].high>>>0).toNumber():e.lon[i]}if(e.keysVals&&e.keysVals.length){r.keysVals=[];for(var i=0;i<e.keysVals.length;++i)r.keysVals[i]=e.keysVals[i]}return r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e}(),e.Way=function(){function e(e){if(this.keys=[],this.vals=[],this.refs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.id=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.keys=$util.emptyArray,e.prototype.vals=$util.emptyArray,e.prototype.info=null,e.prototype.refs=$util.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=$Writer.create()),t.uint32(8).int64(e.id),null!=e.keys&&e.keys.length){t.uint32(18).fork();for(var r=0;r<e.keys.length;++r)t.uint32(e.keys[r]);t.ldelim()}if(null!=e.vals&&e.vals.length){t.uint32(26).fork();for(var r=0;r<e.vals.length;++r)t.uint32(e.vals[r]);t.ldelim()}if(null!=e.info&&e.hasOwnProperty("info")&&$root.OSMPBF.Info.encode(e.info,t.uint32(34).fork()).ldelim(),null!=e.refs&&e.refs.length){t.uint32(66).fork();for(var r=0;r<e.refs.length;++r)t.sint64(e.refs[r]);t.ldelim()}return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.Way;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.id=e.int64();break;case 2:if(i.keys&&i.keys.length||(i.keys=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.keys.push(e.uint32());else i.keys.push(e.uint32());break;case 3:if(i.vals&&i.vals.length||(i.vals=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.vals.push(e.uint32());else i.vals.push(e.uint32());break;case 4:i.info=$root.OSMPBF.Info.decode(e,e.uint32());break;case 8:if(i.refs&&i.refs.length||(i.refs=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.refs.push(e.sint64());else i.refs.push(e.sint64());break;default:e.skipType(7&n)}}if(!i.hasOwnProperty("id"))throw $util.ProtocolError("missing required 'id'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(!($util.isInteger(e.id)||e.id&&$util.isInteger(e.id.low)&&$util.isInteger(e.id.high)))return"id: integer|Long expected";if(null!=e.keys&&e.hasOwnProperty("keys")){if(!Array.isArray(e.keys))return"keys: array expected";for(var t=0;t<e.keys.length;++t)if(!$util.isInteger(e.keys[t]))return"keys: integer[] expected"}if(null!=e.vals&&e.hasOwnProperty("vals")){
if(!Array.isArray(e.vals))return"vals: array expected";for(var t=0;t<e.vals.length;++t)if(!$util.isInteger(e.vals[t]))return"vals: integer[] expected"}if(null!=e.info&&e.hasOwnProperty("info")){var r=$root.OSMPBF.Info.verify(e.info);if(r)return"info."+r}if(null!=e.refs&&e.hasOwnProperty("refs")){if(!Array.isArray(e.refs))return"refs: array expected";for(var t=0;t<e.refs.length;++t)if(!($util.isInteger(e.refs[t])||e.refs[t]&&$util.isInteger(e.refs[t].low)&&$util.isInteger(e.refs[t].high)))return"refs: integer|Long[] expected"}return null},e.fromObject=function(e){if(e instanceof $root.OSMPBF.Way)return e;var t=new $root.OSMPBF.Way;if(null!=e.id&&($util.Long?(t.id=$util.Long.fromValue(e.id)).unsigned=!1:"string"==typeof e.id?t.id=parseInt(e.id,10):"number"==typeof e.id?t.id=e.id:"object"==typeof e.id&&(t.id=new $util.LongBits(e.id.low>>>0,e.id.high>>>0).toNumber())),e.keys){if(!Array.isArray(e.keys))throw TypeError(".OSMPBF.Way.keys: array expected");t.keys=[];for(var r=0;r<e.keys.length;++r)t.keys[r]=e.keys[r]>>>0}if(e.vals){if(!Array.isArray(e.vals))throw TypeError(".OSMPBF.Way.vals: array expected");t.vals=[];for(var r=0;r<e.vals.length;++r)t.vals[r]=e.vals[r]>>>0}if(null!=e.info){if("object"!=typeof e.info)throw TypeError(".OSMPBF.Way.info: object expected");t.info=$root.OSMPBF.Info.fromObject(e.info)}if(e.refs){if(!Array.isArray(e.refs))throw TypeError(".OSMPBF.Way.refs: array expected");t.refs=[];for(var r=0;r<e.refs.length;++r)$util.Long?(t.refs[r]=$util.Long.fromValue(e.refs[r])).unsigned=!1:"string"==typeof e.refs[r]?t.refs[r]=parseInt(e.refs[r],10):"number"==typeof e.refs[r]?t.refs[r]=e.refs[r]:"object"==typeof e.refs[r]&&(t.refs[r]=new $util.LongBits(e.refs[r].low>>>0,e.refs[r].high>>>0).toNumber())}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.keys=[],r.vals=[],r.refs=[]),t.defaults){if($util.Long){var i=new $util.Long(0,0,!1);r.id=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.id=t.longs===String?"0":0;r.info=null}if(null!=e.id&&e.hasOwnProperty("id")&&("number"==typeof e.id?r.id=t.longs===String?String(e.id):e.id:r.id=t.longs===String?$util.Long.prototype.toString.call(e.id):t.longs===Number?new $util.LongBits(e.id.low>>>0,e.id.high>>>0).toNumber():e.id),e.keys&&e.keys.length){r.keys=[];for(var n=0;n<e.keys.length;++n)r.keys[n]=e.keys[n]}if(e.vals&&e.vals.length){r.vals=[];for(var n=0;n<e.vals.length;++n)r.vals[n]=e.vals[n]}if(null!=e.info&&e.hasOwnProperty("info")&&(r.info=$root.OSMPBF.Info.toObject(e.info,t)),e.refs&&e.refs.length){r.refs=[];for(var n=0;n<e.refs.length;++n)"number"==typeof e.refs[n]?r.refs[n]=t.longs===String?String(e.refs[n]):e.refs[n]:r.refs[n]=t.longs===String?$util.Long.prototype.toString.call(e.refs[n]):t.longs===Number?new $util.LongBits(e.refs[n].low>>>0,e.refs[n].high>>>0).toNumber():e.refs[n]}return r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e}(),e.Relation=function(){function e(e){if(this.keys=[],this.vals=[],this.rolesSid=[],this.memids=[],this.types=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.id=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.keys=$util.emptyArray,e.prototype.vals=$util.emptyArray,e.prototype.info=null,e.prototype.rolesSid=$util.emptyArray,e.prototype.memids=$util.emptyArray,e.prototype.types=$util.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=$Writer.create()),t.uint32(8).int64(e.id),null!=e.keys&&e.keys.length){t.uint32(18).fork();for(var r=0;r<e.keys.length;++r)t.uint32(e.keys[r]);t.ldelim()}if(null!=e.vals&&e.vals.length){t.uint32(26).fork();for(var r=0;r<e.vals.length;++r)t.uint32(e.vals[r]);t.ldelim()}if(null!=e.info&&e.hasOwnProperty("info")&&$root.OSMPBF.Info.encode(e.info,t.uint32(34).fork()).ldelim(),null!=e.rolesSid&&e.rolesSid.length){t.uint32(66).fork();for(var r=0;r<e.rolesSid.length;++r)t.int32(e.rolesSid[r]);t.ldelim()}if(null!=e.memids&&e.memids.length){t.uint32(74).fork();for(var r=0;r<e.memids.length;++r)t.sint64(e.memids[r]);t.ldelim()}if(null!=e.types&&e.types.length){t.uint32(82).fork();for(var r=0;r<e.types.length;++r)t.int32(e.types[r]);t.ldelim()}return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new $root.OSMPBF.Relation;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.id=e.int64();break;case 2:if(i.keys&&i.keys.length||(i.keys=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.keys.push(e.uint32());else i.keys.push(e.uint32());break;case 3:if(i.vals&&i.vals.length||(i.vals=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.vals.push(e.uint32());else i.vals.push(e.uint32());break;case 4:i.info=$root.OSMPBF.Info.decode(e,e.uint32());break;case 8:if(i.rolesSid&&i.rolesSid.length||(i.rolesSid=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.rolesSid.push(e.int32());else i.rolesSid.push(e.int32());break;case 9:if(i.memids&&i.memids.length||(i.memids=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.memids.push(e.sint64());else i.memids.push(e.sint64());break;case 10:if(i.types&&i.types.length||(i.types=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.types.push(e.int32());else i.types.push(e.int32());break;default:e.skipType(7&n)}}if(!i.hasOwnProperty("id"))throw $util.ProtocolError("missing required 'id'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof $Reader||(e=new $Reader(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(!($util.isInteger(e.id)||e.id&&$util.isInteger(e.id.low)&&$util.isInteger(e.id.high)))return"id: integer|Long expected";if(null!=e.keys&&e.hasOwnProperty("keys")){if(!Array.isArray(e.keys))return"keys: array expected";for(var t=0;t<e.keys.length;++t)if(!$util.isInteger(e.keys[t]))return"keys: integer[] expected"}if(null!=e.vals&&e.hasOwnProperty("vals")){if(!Array.isArray(e.vals))return"vals: array expected";for(var t=0;t<e.vals.length;++t)if(!$util.isInteger(e.vals[t]))return"vals: integer[] expected"}if(null!=e.info&&e.hasOwnProperty("info")){var r=$root.OSMPBF.Info.verify(e.info);if(r)return"info."+r}if(null!=e.rolesSid&&e.hasOwnProperty("rolesSid")){if(!Array.isArray(e.rolesSid))return"rolesSid: array expected";for(var t=0;t<e.rolesSid.length;++t)if(!$util.isInteger(e.rolesSid[t]))return"rolesSid: integer[] expected"}if(null!=e.memids&&e.hasOwnProperty("memids")){if(!Array.isArray(e.memids))return"memids: array expected";for(var t=0;t<e.memids.length;++t)if(!($util.isInteger(e.memids[t])||e.memids[t]&&$util.isInteger(e.memids[t].low)&&$util.isInteger(e.memids[t].high)))return"memids: integer|Long[] expected"}if(null!=e.types&&e.hasOwnProperty("types")){if(!Array.isArray(e.types))return"types: array expected";for(var t=0;t<e.types.length;++t)switch(e.types[t]){default:return"types: enum value[] expected";case 0:case 1:case 2:}}return null},e.fromObject=function(e){if(e instanceof $root.OSMPBF.Relation)return e;var t=new $root.OSMPBF.Relation;if(null!=e.id&&($util.Long?(t.id=$util.Long.fromValue(e.id)).unsigned=!1:"string"==typeof e.id?t.id=parseInt(e.id,10):"number"==typeof e.id?t.id=e.id:"object"==typeof e.id&&(t.id=new $util.LongBits(e.id.low>>>0,e.id.high>>>0).toNumber())),e.keys){if(!Array.isArray(e.keys))throw TypeError(".OSMPBF.Relation.keys: array expected");t.keys=[];for(var r=0;r<e.keys.length;++r)t.keys[r]=e.keys[r]>>>0}if(e.vals){if(!Array.isArray(e.vals))throw TypeError(".OSMPBF.Relation.vals: array expected");t.vals=[];for(var r=0;r<e.vals.length;++r)t.vals[r]=e.vals[r]>>>0}if(null!=e.info){if("object"!=typeof e.info)throw TypeError(".OSMPBF.Relation.info: object expected");t.info=$root.OSMPBF.Info.fromObject(e.info)}if(e.rolesSid){if(!Array.isArray(e.rolesSid))throw TypeError(".OSMPBF.Relation.rolesSid: array expected");t.rolesSid=[];for(var r=0;r<e.rolesSid.length;++r)t.rolesSid[r]=0|e.rolesSid[r]}if(e.memids){if(!Array.isArray(e.memids))throw TypeError(".OSMPBF.Relation.memids: array expected");t.memids=[];for(var r=0;r<e.memids.length;++r)$util.Long?(t.memids[r]=$util.Long.fromValue(e.memids[r])).unsigned=!1:"string"==typeof e.memids[r]?t.memids[r]=parseInt(e.memids[r],10):"number"==typeof e.memids[r]?t.memids[r]=e.memids[r]:"object"==typeof e.memids[r]&&(t.memids[r]=new $util.LongBits(e.memids[r].low>>>0,e.memids[r].high>>>0).toNumber())}if(e.types){if(!Array.isArray(e.types))throw TypeError(".OSMPBF.Relation.types: array expected");t.types=[];for(var r=0;r<e.types.length;++r)switch(e.types[r]){default:case"NODE":case 0:t.types[r]=0;break;case"WAY":case 1:t.types[r]=1;break;case"RELATION":case 2:t.types[r]=2}}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.keys=[],r.vals=[],r.rolesSid=[],r.memids=[],r.types=[]),t.defaults){if($util.Long){var i=new $util.Long(0,0,!1);r.id=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.id=t.longs===String?"0":0;r.info=null}if(null!=e.id&&e.hasOwnProperty("id")&&("number"==typeof e.id?r.id=t.longs===String?String(e.id):e.id:r.id=t.longs===String?$util.Long.prototype.toString.call(e.id):t.longs===Number?new $util.LongBits(e.id.low>>>0,e.id.high>>>0).toNumber():e.id),e.keys&&e.keys.length){r.keys=[];for(var n=0;n<e.keys.length;++n)r.keys[n]=e.keys[n]}if(e.vals&&e.vals.length){r.vals=[];for(var n=0;n<e.vals.length;++n)r.vals[n]=e.vals[n]}if(null!=e.info&&e.hasOwnProperty("info")&&(r.info=$root.OSMPBF.Info.toObject(e.info,t)),e.rolesSid&&e.rolesSid.length){r.rolesSid=[];for(var n=0;n<e.rolesSid.length;++n)r.rolesSid[n]=e.rolesSid[n]}if(e.memids&&e.memids.length){r.memids=[];for(var n=0;n<e.memids.length;++n)"number"==typeof e.memids[n]?r.memids[n]=t.longs===String?String(e.memids[n]):e.memids[n]:r.memids[n]=t.longs===String?$util.Long.prototype.toString.call(e.memids[n]):t.longs===Number?new $util.LongBits(e.memids[n].low>>>0,e.memids[n].high>>>0).toNumber():e.memids[n]}if(e.types&&e.types.length){r.types=[];for(var n=0;n<e.types.length;++n)r.types[n]=t.enums===String?$root.OSMPBF.Relation.MemberType[e.types[n]]:e.types[n]}return r},e.prototype.toJSON=function(){return this.constructor.toObject(this,$protobuf.util.toJSONOptions)},e.MemberType=function(){var e={},t=Object.create(e);return t[e[0]="NODE"]=0,t[e[1]="WAY"]=1,t[e[2]="RELATION"]=2,t}(),e}(),e}(),module.exports=$root;
},{"protobufjs/minimal":16}],9:[function(require,module,exports){
"use strict";function asPromise(e,n){for(var r=new Array(arguments.length-1),t=0,l=2,o=!0;l<arguments.length;)r[t++]=arguments[l++];return new Promise(function(l,a){r[t]=function(e){if(o)if(o=!1,e)a(e);else{for(var n=new Array(arguments.length-1),r=0;r<n.length;)n[r++]=arguments[r];l.apply(null,n)}};try{e.apply(n||null,r)}catch(e){o&&(o=!1,a(e))}})}module.exports=asPromise;
},{}],10:[function(require,module,exports){
"use strict";var base64=exports;base64.length=function(r){var a=r.length;if(!a)return 0;for(var e=0;--a%4>1&&"="===r.charAt(a);)++e;return Math.ceil(3*r.length)/4-e};for(var b64=new Array(64),s64=new Array(123),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(r,a,e){for(var i,n=null,t=[],o=0,s=0;a<e;){var c=r[a++];switch(s){case 0:t[o++]=b64[c>>2],i=(3&c)<<4,s=1;break;case 1:t[o++]=b64[i|c>>4],i=(15&c)<<2,s=2;break;case 2:t[o++]=b64[i|c>>6],t[o++]=b64[63&c],s=0}o>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,t)),o=0)}return s&&(t[o++]=b64[i],t[o++]=61,1===s&&(t[o++]=61)),n?(o&&n.push(String.fromCharCode.apply(String,t.slice(0,o))),n.join("")):String.fromCharCode.apply(String,t.slice(0,o))};var invalidEncoding="invalid encoding";base64.decode=function(r,a,e){for(var i,n=e,t=0,o=0;o<r.length;){var s=r.charCodeAt(o++);if(61===s&&t>1)break;if(void 0===(s=s64[s]))throw Error(invalidEncoding);switch(t){case 0:i=s,t=1;break;case 1:a[e++]=i<<2|(48&s)>>4,i=s,t=2;break;case 2:a[e++]=(15&i)<<4|(60&s)>>2,i=s,t=3;break;case 3:a[e++]=(3&i)<<6|s,t=0}}if(1===t)throw Error(invalidEncoding);return e-n},base64.test=function(r){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(r)};
},{}],11:[function(require,module,exports){
"use strict";function EventEmitter(){this._listeners={}}module.exports=EventEmitter,EventEmitter.prototype.on=function(t,e,i){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:i||this}),this},EventEmitter.prototype.off=function(t,e){if(void 0===t)this._listeners={};else if(void 0===e)this._listeners[t]=[];else for(var i=this._listeners[t],s=0;s<i.length;)i[s].fn===e?i.splice(s,1):++s;return this},EventEmitter.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var i=[],s=1;s<arguments.length;)i.push(arguments[s++]);for(s=0;s<e.length;)e[s].fn.apply(e[s++].ctx,i)}return this};
},{}],12:[function(require,module,exports){
"use strict";function factory(n){return"undefined"!=typeof Float32Array?function(){function t(n,t,e){a[0]=n,t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3]}function e(n,t,e){a[0]=n,t[e]=o[3],t[e+1]=o[2],t[e+2]=o[1],t[e+3]=o[0]}function r(n,t){return o[0]=n[t],o[1]=n[t+1],o[2]=n[t+2],o[3]=n[t+3],a[0]}function i(n,t){return o[3]=n[t],o[2]=n[t+1],o[1]=n[t+2],o[0]=n[t+3],a[0]}var a=new Float32Array([-0]),o=new Uint8Array(a.buffer),u=128===o[3];n.writeFloatLE=u?t:e,n.writeFloatBE=u?e:t,n.readFloatLE=u?r:i,n.readFloatBE=u?i:r}():function(){function t(n,t,e,r){var i=t<0?1:0;if(i&&(t=-t),0===t)n(1/t>0?0:2147483648,e,r);else if(isNaN(t))n(2143289344,e,r);else if(t>3.4028234663852886e38)n((i<<31|2139095040)>>>0,e,r);else if(t<1.1754943508222875e-38)n((i<<31|Math.round(t/1.401298464324817e-45))>>>0,e,r);else{var a=Math.floor(Math.log(t)/Math.LN2),o=8388607&Math.round(t*Math.pow(2,-a)*8388608);n((i<<31|a+127<<23|o)>>>0,e,r)}}function e(n,t,e){var r=n(t,e),i=2*(r>>31)+1,a=r>>>23&255,o=8388607&r;return 255===a?o?NaN:i*(1/0):0===a?1.401298464324817e-45*i*o:i*Math.pow(2,a-150)*(o+8388608)}n.writeFloatLE=t.bind(null,writeUintLE),n.writeFloatBE=t.bind(null,writeUintBE),n.readFloatLE=e.bind(null,readUintLE),n.readFloatBE=e.bind(null,readUintBE)}(),"undefined"!=typeof Float64Array?function(){function t(n,t,e){a[0]=n,t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3],t[e+4]=o[4],t[e+5]=o[5],t[e+6]=o[6],t[e+7]=o[7]}function e(n,t,e){a[0]=n,t[e]=o[7],t[e+1]=o[6],t[e+2]=o[5],t[e+3]=o[4],t[e+4]=o[3],t[e+5]=o[2],t[e+6]=o[1],t[e+7]=o[0]}function r(n,t){return o[0]=n[t],o[1]=n[t+1],o[2]=n[t+2],o[3]=n[t+3],o[4]=n[t+4],o[5]=n[t+5],o[6]=n[t+6],o[7]=n[t+7],a[0]}function i(n,t){return o[7]=n[t],o[6]=n[t+1],o[5]=n[t+2],o[4]=n[t+3],o[3]=n[t+4],o[2]=n[t+5],o[1]=n[t+6],o[0]=n[t+7],a[0]}var a=new Float64Array([-0]),o=new Uint8Array(a.buffer),u=128===o[7];n.writeDoubleLE=u?t:e,n.writeDoubleBE=u?e:t,n.readDoubleLE=u?r:i,n.readDoubleBE=u?i:r}():function(){function t(n,t,e,r,i,a){var o=r<0?1:0;if(o&&(r=-r),0===r)n(0,i,a+t),n(1/r>0?0:2147483648,i,a+e);else if(isNaN(r))n(0,i,a+t),n(2146959360,i,a+e);else if(r>1.7976931348623157e308)n(0,i,a+t),n((o<<31|2146435072)>>>0,i,a+e);else{var u;if(r<2.2250738585072014e-308)u=r/5e-324,n(u>>>0,i,a+t),n((o<<31|u/4294967296)>>>0,i,a+e);else{var l=Math.floor(Math.log(r)/Math.LN2);1024===l&&(l=1023),u=r*Math.pow(2,-l),n(4503599627370496*u>>>0,i,a+t),n((o<<31|l+1023<<20|1048576*u&1048575)>>>0,i,a+e)}}}function e(n,t,e,r,i){var a=n(r,i+t),o=n(r,i+e),u=2*(o>>31)+1,l=o>>>20&2047,f=4294967296*(1048575&o)+a;return 2047===l?f?NaN:u*(1/0):0===l?5e-324*u*f:u*Math.pow(2,l-1075)*(f+4503599627370496)}n.writeDoubleLE=t.bind(null,writeUintLE,0,4),n.writeDoubleBE=t.bind(null,writeUintBE,4,0),n.readDoubleLE=e.bind(null,readUintLE,0,4),n.readDoubleBE=e.bind(null,readUintBE,4,0)}(),n}function writeUintLE(n,t,e){t[e]=255&n,t[e+1]=n>>>8&255,t[e+2]=n>>>16&255,t[e+3]=n>>>24}function writeUintBE(n,t,e){t[e]=n>>>24,t[e+1]=n>>>16&255,t[e+2]=n>>>8&255,t[e+3]=255&n}function readUintLE(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0}function readUintBE(n,t){return(n[t]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3])>>>0}module.exports=factory(factory);
},{}],13:[function(require,module,exports){
"use strict";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}module.exports=inquire;
},{}],14:[function(require,module,exports){
"use strict";function pool(r,n,o){var t=o||8192,u=t>>>1,l=null,e=t;return function(o){if(o<1||o>u)return r(o);e+o>t&&(l=r(t),e=0);var c=n.call(l,e,e+=o);return 7&e&&(e=1+(7|e)),c}}module.exports=pool;
},{}],15:[function(require,module,exports){
"use strict";var utf8=exports;utf8.length=function(r){for(var t=0,n=0,e=0;e<r.length;++e)n=r.charCodeAt(e),n<128?t+=1:n<2048?t+=2:55296==(64512&n)&&56320==(64512&r.charCodeAt(e+1))?(++e,t+=4):t+=3;return t},utf8.read=function(r,t,n){if(n-t<1)return"";for(var e,o=null,a=[],i=0;t<n;)e=r[t++],e<128?a[i++]=e:e>191&&e<224?a[i++]=(31&e)<<6|63&r[t++]:e>239&&e<365?(e=((7&e)<<18|(63&r[t++])<<12|(63&r[t++])<<6|63&r[t++])-65536,a[i++]=55296+(e>>10),a[i++]=56320+(1023&e)):a[i++]=(15&e)<<12|(63&r[t++])<<6|63&r[t++],i>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),i=0);return o?(i&&o.push(String.fromCharCode.apply(String,a.slice(0,i))),o.join("")):String.fromCharCode.apply(String,a.slice(0,i))},utf8.write=function(r,t,n){for(var e,o,a=n,i=0;i<r.length;++i)e=r.charCodeAt(i),e<128?t[n++]=e:e<2048?(t[n++]=e>>6|192,t[n++]=63&e|128):55296==(64512&e)&&56320==(64512&(o=r.charCodeAt(i+1)))?(e=65536+((1023&e)<<10)+(1023&o),++i,t[n++]=e>>18|240,t[n++]=e>>12&63|128,t[n++]=e>>6&63|128,t[n++]=63&e|128):(t[n++]=e>>12|224,t[n++]=e>>6&63|128,t[n++]=63&e|128);return n-a};
},{}],16:[function(require,module,exports){
"use strict";module.exports=require("./src/index-minimal");
},{"./src/index-minimal":17}],17:[function(require,module,exports){
"use strict";function configure(){protobuf.Reader._configure(protobuf.BufferReader),protobuf.util._configure()}var protobuf=exports;protobuf.build="minimal",protobuf.Writer=require("./writer"),protobuf.BufferWriter=require("./writer_buffer"),protobuf.Reader=require("./reader"),protobuf.BufferReader=require("./reader_buffer"),protobuf.util=require("./util/minimal"),protobuf.rpc=require("./rpc"),protobuf.roots=require("./roots"),protobuf.configure=configure,protobuf.Writer._configure(protobuf.BufferWriter),configure();
},{"./reader":18,"./reader_buffer":19,"./roots":20,"./rpc":21,"./util/minimal":24,"./writer":25,"./writer_buffer":26}],18:[function(require,module,exports){
"use strict";function indexOutOfRange(t,i){return RangeError("index out of range: "+t.pos+" + "+(i||1)+" > "+t.len)}function Reader(t){this.buf=t,this.pos=0,this.len=t.length}function readLongVarint(){var t=new LongBits(0,0),i=0;if(!(this.len-this.pos>4)){for(;i<3;++i){if(this.pos>=this.len)throw indexOutOfRange(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*i)>>>0,t}for(;i<4;++i)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(i=0,this.len-this.pos>4){for(;i<5;++i)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)return t}else for(;i<5;++i){if(this.pos>=this.len)throw indexOutOfRange(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function readFixed32_end(t,i){return(t[i-4]|t[i-3]<<8|t[i-2]<<16|t[i-1]<<24)>>>0}function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}module.exports=Reader;var util=require("./util/minimal"),BufferReader,LongBits=util.LongBits,utf8=util.utf8,create_array="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new Reader(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new Reader(t);throw Error("illegal buffer")};Reader.create=util.Buffer?function(t){return(Reader.create=function(t){return util.Buffer.isBuffer(t)?new BufferReader(t):create_array(t)})(t)}:create_array,Reader.prototype._slice=util.Array.prototype.subarray||util.Array.prototype.slice,Reader.prototype.uint32=function(){var t=4294967295;return function(){if(t=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return t;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return t}}(),Reader.prototype.int32=function(){return 0|this.uint32()},Reader.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},Reader.prototype.bool=function(){return 0!==this.uint32()},Reader.prototype.fixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.sfixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return 0|readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.float=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var t=util.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},Reader.prototype.double=function(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var t=util.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},Reader.prototype.bytes=function(){var t=this.uint32(),i=this.pos,e=this.pos+t;if(e>this.len)throw indexOutOfRange(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(i,e):i===e?new this.buf.constructor(0):this._slice.call(this.buf,i,e)},Reader.prototype.string=function(){var t=this.bytes();return utf8.read(t,0,t.length)},Reader.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw indexOutOfRange(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw indexOutOfRange(this)}while(128&this.buf[this.pos++]);return this},Reader.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},Reader._configure=function(t){BufferReader=t;var i=util.Long?"toLong":"toNumber";util.merge(Reader.prototype,{int64:function(){return readLongVarint.call(this)[i](!1)},uint64:function(){return readLongVarint.call(this)[i](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[i](!1)},fixed64:function(){return readFixed64.call(this)[i](!0)},sfixed64:function(){return readFixed64.call(this)[i](!1)}})};
},{"./util/minimal":24}],19:[function(require,module,exports){
"use strict";function BufferReader(e){Reader.call(this,e)}module.exports=BufferReader;var Reader=require("./reader");(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util=require("./util/minimal");util.Buffer&&(BufferReader.prototype._slice=util.Buffer.prototype.slice),BufferReader.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))};
},{"./reader":18,"./util/minimal":24}],20:[function(require,module,exports){
"use strict";module.exports={};
},{}],21:[function(require,module,exports){
"use strict";var rpc=exports;rpc.Service=require("./rpc/service");
},{"./rpc/service":22}],22:[function(require,module,exports){
"use strict";function Service(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");util.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}module.exports=Service;var util=require("../util/minimal");(Service.prototype=Object.create(util.EventEmitter.prototype)).constructor=Service,Service.prototype.rpcCall=function e(t,r,i,n,o){if(!n)throw TypeError("request must be specified");var l=this;if(!o)return util.asPromise(e,l,t,r,i,n);if(!l.rpcImpl)return void setTimeout(function(){o(Error("already ended"))},0);try{return l.rpcImpl(t,r[l.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(e,r){if(e)return l.emit("error",e,t),o(e);if(null===r)return void l.end(!0);if(!(r instanceof i))try{r=i[l.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return l.emit("error",e,t),o(e)}return l.emit("data",r,t),o(null,r)})}catch(e){return l.emit("error",e,t),void setTimeout(function(){o(e)},0)}},Service.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};
},{"../util/minimal":24}],23:[function(require,module,exports){
"use strict";function LongBits(t,o){this.lo=t>>>0,this.hi=o>>>0}module.exports=LongBits;var util=require("../util/minimal"),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(t){if(0===t)return zero;var o=t<0;o&&(t=-t);var i=t>>>0,r=(t-i)/4294967296>>>0;return o&&(r=~r>>>0,i=~i>>>0,++i>4294967295&&(i=0,++r>4294967295&&(r=0))),new LongBits(i,r)},LongBits.from=function(t){if("number"==typeof t)return LongBits.fromNumber(t);if(util.isString(t)){if(!util.Long)return LongBits.fromNumber(parseInt(t,10));t=util.Long.fromString(t)}return t.low||t.high?new LongBits(t.low>>>0,t.high>>>0):zero},LongBits.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var o=1+~this.lo>>>0,i=~this.hi>>>0;return o||(i=i+1>>>0),-(o+4294967296*i)}return this.lo+4294967296*this.hi},LongBits.prototype.toLong=function(t){return util.Long?new util.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var charCodeAt=String.prototype.charCodeAt;LongBits.fromHash=function(t){return t===zeroHash?zero:new LongBits((charCodeAt.call(t,0)|charCodeAt.call(t,1)<<8|charCodeAt.call(t,2)<<16|charCodeAt.call(t,3)<<24)>>>0,(charCodeAt.call(t,4)|charCodeAt.call(t,5)<<8|charCodeAt.call(t,6)<<16|charCodeAt.call(t,7)<<24)>>>0)},LongBits.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},LongBits.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},LongBits.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},LongBits.prototype.length=function(){var t=this.lo,o=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0===i?0===o?t<16384?t<128?1:2:t<2097152?3:4:o<16384?o<128?5:6:o<2097152?7:8:i<128?9:10};
},{"../util/minimal":24}],24:[function(require,module,exports){
"use strict";function merge(t,e,r){for(var i=Object.keys(e),o=0;o<i.length;++o)void 0!==t[i[o]]&&r||(t[i[o]]=e[i[o]]);return t}function newError(t){function e(t,r){if(!(this instanceof e))return new e(t,r);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&merge(this,r)}return(e.prototype=Object.create(Error.prototype)).constructor=e,Object.defineProperty(e.prototype,"name",{get:function(){return t}}),e.prototype.toString=function(){return this.name+": "+this.message},e}var util=exports;util.asPromise=require("@protobufjs/aspromise"),util.base64=require("@protobufjs/base64"),util.EventEmitter=require("@protobufjs/eventemitter"),util.float=require("@protobufjs/float"),util.inquire=require("@protobufjs/inquire"),util.utf8=require("@protobufjs/utf8"),util.pool=require("@protobufjs/pool"),util.LongBits=require("./longbits"),util.global="undefined"!=typeof window&&window||"undefined"!=typeof global&&global||"undefined"!=typeof self&&self||this,util.emptyArray=Object.freeze?Object.freeze([]):[],util.emptyObject=Object.freeze?Object.freeze({}):{},util.isNode=Boolean(util.global.process&&util.global.process.versions&&util.global.process.versions.node),util.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},util.isString=function(t){return"string"==typeof t||t instanceof String},util.isObject=function(t){return t&&"object"==typeof t},util.isset=util.isSet=function(t,e){var r=t[e];return!(null==r||!t.hasOwnProperty(e))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},util.Buffer=function(){try{var t=util.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(t){return null}}(),util._Buffer_from=null,util._Buffer_allocUnsafe=null,util.newBuffer=function(t){return"number"==typeof t?util.Buffer?util._Buffer_allocUnsafe(t):new util.Array(t):util.Buffer?util._Buffer_from(t):"undefined"==typeof Uint8Array?t:new Uint8Array(t)},util.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,util.Long=util.global.dcodeIO&&util.global.dcodeIO.Long||util.global.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(t){return t?util.LongBits.from(t).toHash():util.LongBits.zeroHash},util.longFromHash=function(t,e){var r=util.LongBits.fromHash(t);return util.Long?util.Long.fromBits(r.lo,r.hi,e):r.toNumber(Boolean(e))},util.merge=merge,util.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},util.newError=newError,util.ProtocolError=newError("ProtocolError"),util.oneOfGetter=function(t){for(var e={},r=0;r<t.length;++r)e[t[r]]=1;return function(){for(var t=Object.keys(this),r=t.length-1;r>-1;--r)if(1===e[t[r]]&&void 0!==this[t[r]]&&null!==this[t[r]])return t[r]}},util.oneOfSetter=function(t){return function(e){for(var r=0;r<t.length;++r)t[r]!==e&&delete this[t[r]]}},util.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},util._configure=function(){var t=util.Buffer;if(!t)return void(util._Buffer_from=util._Buffer_allocUnsafe=null);util._Buffer_from=t.from!==Uint8Array.from&&t.from||function(e,r){return new t(e,r)},util._Buffer_allocUnsafe=t.allocUnsafe||function(e){return new t(e)}};
},{"./longbits":23,"@protobufjs/aspromise":9,"@protobufjs/base64":10,"@protobufjs/eventemitter":11,"@protobufjs/float":12,"@protobufjs/inquire":13,"@protobufjs/pool":14,"@protobufjs/utf8":15}],25:[function(require,module,exports){
"use strict";function Op(t,i,r){this.fn=t,this.len=i,this.next=void 0,this.val=r}function noop(){}function State(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Writer(){this.len=0,this.head=new Op(noop,0,0),this.tail=this.head,this.states=null}function writeByte(t,i,r){i[r]=255&t}function writeVarint32(t,i,r){for(;t>127;)i[r++]=127&t|128,t>>>=7;i[r]=t}function VarintOp(t,i){this.len=t,this.next=void 0,this.val=i}function writeVarint64(t,i,r){for(;t.hi;)i[r++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)i[r++]=127&t.lo|128,t.lo=t.lo>>>7;i[r++]=t.lo}function writeFixed32(t,i,r){i[r]=255&t,i[r+1]=t>>>8&255,i[r+2]=t>>>16&255,i[r+3]=t>>>24}module.exports=Writer;var util=require("./util/minimal"),BufferWriter,LongBits=util.LongBits,base64=util.base64,utf8=util.utf8;Writer.create=util.Buffer?function(){return(Writer.create=function(){return new BufferWriter})()}:function(){return new Writer},Writer.alloc=function(t){return new util.Array(t)},util.Array!==Array&&(Writer.alloc=util.pool(Writer.alloc,util.Array.prototype.subarray)),Writer.prototype._push=function(t,i,r){return this.tail=this.tail.next=new Op(t,i,r),this.len+=i,this},VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new VarintOp((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},Writer.prototype.int32=function(t){return t<0?this._push(writeVarint64,10,LongBits.fromNumber(t)):this.uint32(t)},Writer.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},Writer.prototype.uint64=function(t){var i=LongBits.from(t);return this._push(writeVarint64,i.length(),i)},Writer.prototype.int64=Writer.prototype.uint64,Writer.prototype.sint64=function(t){var i=LongBits.from(t).zzEncode();return this._push(writeVarint64,i.length(),i)},Writer.prototype.bool=function(t){return this._push(writeByte,1,t?1:0)},Writer.prototype.fixed32=function(t){return this._push(writeFixed32,4,t>>>0)},Writer.prototype.sfixed32=Writer.prototype.fixed32,Writer.prototype.fixed64=function(t){var i=LongBits.from(t);return this._push(writeFixed32,4,i.lo)._push(writeFixed32,4,i.hi)},Writer.prototype.sfixed64=Writer.prototype.fixed64,Writer.prototype.float=function(t){return this._push(util.float.writeFloatLE,4,t)},Writer.prototype.double=function(t){return this._push(util.float.writeDoubleLE,8,t)};var writeBytes=util.Array.prototype.set?function(t,i,r){i.set(t,r)}:function(t,i,r){for(var e=0;e<t.length;++e)i[r+e]=t[e]};Writer.prototype.bytes=function(t){var i=t.length>>>0;if(!i)return this._push(writeByte,1,0);if(util.isString(t)){var r=Writer.alloc(i=base64.length(t));base64.decode(t,r,0),t=r}return this.uint32(i)._push(writeBytes,i,t)},Writer.prototype.string=function(t){var i=utf8.length(t);return i?this.uint32(i)._push(utf8.write,i,t):this._push(writeByte,1,0)},Writer.prototype.fork=function(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer.prototype.ldelim=function(){var t=this.head,i=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=t.next,this.tail=i,this.len+=r),this},Writer.prototype.finish=function(){for(var t=this.head.next,i=this.constructor.alloc(this.len),r=0;t;)t.fn(t.val,i,r),r+=t.len,t=t.next;return i},Writer._configure=function(t){BufferWriter=t};
},{"./util/minimal":24}],26:[function(require,module,exports){
"use strict";function BufferWriter(){Writer.call(this)}function writeStringBuffer(r,t,e){r.length<40?util.utf8.write(r,t,e):t.utf8Write(r,e)}module.exports=BufferWriter;var Writer=require("./writer");(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util=require("./util/minimal"),Buffer=util.Buffer;BufferWriter.alloc=function(r){return(BufferWriter.alloc=util._Buffer_allocUnsafe)(r)};var writeBytesBuffer=Buffer&&Buffer.prototype instanceof Uint8Array&&"set"===Buffer.prototype.set.name?function(r,t,e){t.set(r,e)}:function(r,t,e){if(r.copy)r.copy(t,e,0,r.length);else for(var f=0;f<r.length;)t[e++]=r[f++]};BufferWriter.prototype.bytes=function(r){util.isString(r)&&(r=util._Buffer_from(r,"base64"));var t=r.length>>>0;return this.uint32(t),t&&this._push(writeBytesBuffer,t,r),this},BufferWriter.prototype.string=function(r){var t=Buffer.byteLength(r);return this.uint32(t),t&&this._push(writeStringBuffer,t,r),this};
},{"./util/minimal":24,"./writer":25}],27:[function(require,module,exports){
!function(e,t){"use strict";function n(e){return c[i]=a.apply(t,e),i++}function a(e){var n=[].slice.call(arguments,1);return function(){"function"==typeof e?e.apply(t,n):new Function(""+e)()}}function o(e){if(u)setTimeout(a(o,e),0);else{var t=c[e];if(t){u=!0;try{t()}finally{r(e),u=!1}}}}function r(e){delete c[e]}if(!e.setImmediate){var s,i=1,c={},u=!1,f=e.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(e);l=l&&l.setTimeout?l:e,"[object process]"==={}.toString.call(e.process)?function(){s=function(){var e=n(arguments);return process.nextTick(a(o,e)),e}}():function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",a=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&o(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),s=function(){var a=n(arguments);return e.postMessage(t+a,"*"),a}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){o(e.data)},s=function(){var t=n(arguments);return e.port2.postMessage(t),t}}():f&&"onreadystatechange"in f.createElement("script")?function(){var e=f.documentElement;s=function(){var t=n(arguments),a=f.createElement("script");return a.onreadystatechange=function(){o(t),a.onreadystatechange=null,e.removeChild(a),a=null},e.appendChild(a),t}}():function(){s=function(){var e=n(arguments);return setTimeout(a(o,e),0),e}}(),l.setImmediate=s,l.clearImmediate=r}}(new Function("return this")());
},{}],28:[function(require,module,exports){
(function(){"use strict";function t(t,r){var i=t.split("."),e=a;!(i[0]in e)&&e.execScript&&e.execScript("var "+i[0]);for(var s;i.length&&(s=i.shift());)i.length||void 0===r?e=e[s]?e[s]:e[s]={}:e[s]=r}function r(t){var r,i,e,s,h,n,a,o,l,u,c=t.length,b=0,y=Number.POSITIVE_INFINITY;for(o=0;o<c;++o)t[o]>b&&(b=t[o]),t[o]<y&&(y=t[o]);for(r=1<<b,i=new(f?Uint32Array:Array)(r),e=1,s=0,h=2;e<=b;){for(o=0;o<c;++o)if(t[o]===e){for(n=0,a=s,l=0;l<e;++l)n=n<<1|1&a,a>>=1;for(u=e<<16|o,l=n;l<r;l+=h)i[l]=u;++s}++e,s<<=1,h<<=1}return[i,b,y]}function i(t,r){switch(this.g=[],this.h=32768,this.d=this.f=this.a=this.l=0,this.input=f?new Uint8Array(t):t,this.m=!1,this.i=l,this.s=!1,!r&&(r={})||(r.index&&(this.a=r.index),r.bufferSize&&(this.h=r.bufferSize),r.bufferType&&(this.i=r.bufferType),r.resize&&(this.s=r.resize)),this.i){case o:this.b=32768,this.c=new(f?Uint8Array:Array)(32768+this.h+258);break;case l:this.b=0,this.c=new(f?Uint8Array:Array)(this.h),this.e=this.A,this.n=this.w,this.j=this.z;break;default:throw Error("invalid inflate mode")}}function e(t,r){for(var i,e=t.f,s=t.d,h=t.input,n=t.a,a=h.length;s<r;){if(n>=a)throw Error("input buffer is broken");e|=h[n++]<<s,s+=8}return i=e&(1<<r)-1,t.f=e>>>r,t.d=s-r,t.a=n,i}function s(t,r){for(var i,e,s=t.f,h=t.d,n=t.input,a=t.a,f=n.length,o=r[0],l=r[1];h<l&&!(a>=f);)s|=n[a++]<<h,h+=8;return i=o[s&(1<<l)-1],e=i>>>16,t.f=s>>e,t.d=h-e,t.a=a,65535&i}function h(t){function i(t,r,i){var h,n,a,f=this.q;for(a=0;a<t;)switch(h=s(this,r)){case 16:for(n=3+e(this,2);n--;)i[a++]=f;break;case 17:for(n=3+e(this,3);n--;)i[a++]=0;f=0;break;case 18:for(n=11+e(this,7);n--;)i[a++]=0;f=0;break;default:f=i[a++]=h}return this.q=f,i}var h,n,a,o,l=e(t,5)+257,u=e(t,5)+1,c=e(t,4)+4,b=new(f?Uint8Array:Array)(p.length);for(o=0;o<c;++o)b[p[o]]=e(t,3);if(!f)for(o=c,c=b.length;o<c;++o)b[p[o]]=0;h=r(b),n=new(f?Uint8Array:Array)(l),a=new(f?Uint8Array:Array)(u),t.q=0,t.j(r(i.call(t,l,h,n)),r(i.call(t,u,h,a)))}function n(t,r){var e,s;switch(this.input=t,this.a=0,!r&&(r={})||(r.index&&(this.a=r.index),r.verify&&(this.B=r.verify)),e=t[this.a++],s=t[this.a++],15&e){case j:this.method=j;break;default:throw Error("unsupported compression method")}if(0!=((e<<8)+s)%31)throw Error("invalid fcheck flag:"+((e<<8)+s)%31);if(32&s)throw Error("fdict flag is not supported");this.r=new i(t,{index:this.a,bufferSize:r.bufferSize,bufferType:r.bufferType,resize:r.resize})}var a=this,f="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView,o=0,l=1,u={u:o,t:l};i.prototype.k=function(){for(;!this.m;){var t=e(this,3);switch(1&t&&(this.m=!0),t>>>=1){case 0:var r=this.input,i=this.a,s=this.c,n=this.b,a=r.length,u=void 0,c=void 0,b=s.length,y=void 0;if(this.d=this.f=0,i+1>=a)throw Error("invalid uncompressed block header: LEN");if(u=r[i++]|r[i++]<<8,i+1>=a)throw Error("invalid uncompressed block header: NLEN");if(c=r[i++]|r[i++]<<8,u===~c)throw Error("invalid uncompressed block header: length verify");if(i+u>r.length)throw Error("input buffer is broken");switch(this.i){case o:for(;n+u>s.length;){if(y=b-n,u-=y,f)s.set(r.subarray(i,i+y),n),n+=y,i+=y;else for(;y--;)s[n++]=r[i++];this.b=n,s=this.e(),n=this.b}break;case l:for(;n+u>s.length;)s=this.e({p:2});break;default:throw Error("invalid inflate mode")}if(f)s.set(r.subarray(i,i+u),n),n+=u,i+=u;else for(;u--;)s[n++]=r[i++];this.a=i,this.b=n,this.c=s;break;case 1:this.j(T,S);break;case 2:h(this);break;default:throw Error("unknown BTYPE: "+t)}}return this.n()};var c,b,y=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],p=f?new Uint16Array(y):y,d=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],v=f?new Uint16Array(d):d,g=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],w=f?new Uint8Array(g):g,A=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],k=f?new Uint16Array(A):A,U=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],E=f?new Uint8Array(U):U,m=new(f?Uint8Array:Array)(288);for(c=0,b=m.length;c<b;++c)m[c]=143>=c?8:255>=c?9:279>=c?7:8;var z,I,T=r(m),x=new(f?Uint8Array:Array)(30);for(z=0,I=x.length;z<I;++z)x[z]=5;var S=r(x);i.prototype.j=function(t,r){var i=this.c,h=this.b;this.o=t;for(var n,a,f,o,l=i.length-258;256!==(n=s(this,t));)if(256>n)h>=l&&(this.b=h,i=this.e(),h=this.b),i[h++]=n;else for(a=n-257,o=v[a],0<w[a]&&(o+=e(this,w[a])),n=s(this,r),f=k[n],0<E[n]&&(f+=e(this,E[n])),h>=l&&(this.b=h,i=this.e(),h=this.b);o--;)i[h]=i[h++-f];for(;8<=this.d;)this.d-=8,this.a--;this.b=h},i.prototype.z=function(t,r){var i=this.c,h=this.b;this.o=t;for(var n,a,f,o,l=i.length;256!==(n=s(this,t));)if(256>n)h>=l&&(i=this.e(),l=i.length),i[h++]=n;else for(a=n-257,o=v[a],0<w[a]&&(o+=e(this,w[a])),n=s(this,r),f=k[n],0<E[n]&&(f+=e(this,E[n])),h+o>l&&(i=this.e(),l=i.length);o--;)i[h]=i[h++-f];for(;8<=this.d;)this.d-=8,this.a--;this.b=h},i.prototype.e=function(){var t,r,i=new(f?Uint8Array:Array)(this.b-32768),e=this.b-32768,s=this.c;if(f)i.set(s.subarray(32768,i.length));else for(t=0,r=i.length;t<r;++t)i[t]=s[t+32768];if(this.g.push(i),this.l+=i.length,f)s.set(s.subarray(e,e+32768));else for(t=0;32768>t;++t)s[t]=s[e+t];return this.b=32768,s},i.prototype.A=function(t){var r,i,e,s,h=this.input.length/this.a+1|0,n=this.input,a=this.c;return t&&("number"==typeof t.p&&(h=t.p),"number"==typeof t.v&&(h+=t.v)),2>h?(i=(n.length-this.a)/this.o[2],s=i/2*258|0,e=s<a.length?a.length+s:a.length<<1):e=a.length*h,f?(r=new Uint8Array(e),r.set(a)):r=a,this.c=r},i.prototype.n=function(){var t,r,i,e,s,h=0,n=this.c,a=this.g,o=new(f?Uint8Array:Array)(this.l+(this.b-32768));if(0===a.length)return f?this.c.subarray(32768,this.b):this.c.slice(32768,this.b);for(r=0,i=a.length;r<i;++r)for(t=a[r],e=0,s=t.length;e<s;++e)o[h++]=t[e];for(r=32768,i=this.b;r<i;++r)o[h++]=n[r];return this.g=[],this.buffer=o},i.prototype.w=function(){var t,r=this.b;return f?this.s?(t=new Uint8Array(r),t.set(this.c.subarray(0,r))):t=this.c.subarray(0,r):(this.c.length>r&&(this.c.length=r),t=this.c),this.buffer=t},n.prototype.k=function(){var t,r,i=this.input;if(t=this.r.k(),this.a=this.r.a,this.B){r=(i[this.a++]<<24|i[this.a++]<<16|i[this.a++]<<8|i[this.a++])>>>0;var e=t;if("string"==typeof e){var s,h,n=e.split("");for(s=0,h=n.length;s<h;s++)n[s]=(255&n[s].charCodeAt(0))>>>0;e=n}for(var a,f=1,o=0,l=e.length,u=0;0<l;){a=1024<l?1024:l,l-=a;do{f+=e[u++],o+=f}while(--a);f%=65521,o%=65521}if(r!==(o<<16|f)>>>0)throw Error("invalid adler-32 checksum")}return t};var j=8;t("Zlib.Inflate",n),t("Zlib.Inflate.prototype.decompress",n.prototype.k);var N,B,O,q,L={ADAPTIVE:u.t,BLOCK:u.u};if(Object.keys)N=Object.keys(L);else for(B in N=[],O=0,L)N[O++]=B;for(O=0,q=N.length;O<q;++O)B=N[O],t("Zlib.Inflate.BufferType."+B,L[B])}).call(this);
},{}]},{},[7])(7)
});
//# sourceMappingURL=osm-read-pbf.map.json