text: // This file is auto generated by the protocol-buffers compiler
  
  /* eslint-disable quotes */
  /* eslint-disable indent */
  /* eslint-disable no-redeclare */
  /* eslint-disable camelcase */
  
  // Remember to `npm install --save protocol-buffers-encodings`
  var encodings = require('protocol-buffers-encodings')
  var varint = encodings.varint
  var skip = encodings.skip
  
  var Header = exports.Header = {
    buffer: true,
    encodingLength: null,
    encode: null,
    decode: null
  }
  
  var Node = exports.Node = {
    buffer: true,
    encodingLength: null,
    encode: null,
    decode: null
  }
  
  var Extension = exports.Extension = {
    buffer: true,
    encodingLength: null,
    encode: null,
    decode: null
  }
  
  defineHeader()
  defineNode()
  defineExtension()
  
  function defineHeader () {
    Header.encodingLength = encodingLength
    Header.encode = encode
    Header.decode = decode
  
    function encodingLength (obj) {
      var length = 0
      if (!defined(obj.type)) throw new Error("type is required")
      var len = encodings.string.encodingLength(obj.type)
      length += 1 + len
      if (defined(obj.metadata)) {
        var len = encodings.bytes.encodingLength(obj.metadata)
        length += 1 + len
      }
      if (defined(obj.subtype)) {
        var len = encodings.string.encodingLength(obj.subtype)
        length += 1 + len
      }
      return length
    }
  
    function encode (obj, buf, offset) {
      if (!offset) offset = 0
      if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj))
      var oldOffset = offset
      if (!defined(obj.type)) throw new Error("type is required")
      buf[offset++] = 10
      encodings.string.encode(obj.type, buf, offset)
      offset += encodings.string.encode.bytes
      if (defined(obj.metadata)) {
        buf[offset++] = 18
        encodings.bytes.encode(obj.metadata, buf, offset)
        offset += encodings.bytes.encode.bytes
      }
      if (defined(obj.subtype)) {
        buf[offset++] = 26
        encodings.string.encode(obj.subtype, buf, offset)
        offset += encodings.string.encode.bytes
      }
      encode.bytes = offset - oldOffset
      return buf
    }
  
    function decode (buf, offset, end) {
      if (!offset) offset = 0
      if (!end) end = buf.length
      if (!(end <= buf.length && offset <= buf.length)) throw new Error("Decoded message is not valid")
      var oldOffset = offset
      var obj = {
        type: "",
        metadata: null,
        subtype: ""
      }
      var found0 = false
      while (true) {
        if (end <= offset) {
          if (!found0) throw new Error("Decoded message is not valid")
          decode.bytes = offset - oldOffset
          return obj
        }
        var prefix = varint.decode(buf, offset)
        offset += varint.decode.bytes
        var tag = prefix >> 3
        switch (tag) {
          case 1:
          obj.type = encodings.string.decode(buf, offset)
          offset += encodings.string.decode.bytes
          found0 = true
          break
          case 2:
          obj.metadata = encodings.bytes.decode(buf, offset)
          offset += encodings.bytes.decode.bytes
          break
          case 3:
          obj.subtype = encodings.string.decode(buf, offset)
          offset += encodings.string.decode.bytes
          break
          default:
          offset = skip(prefix & 7, buf, offset)
        }
      }
    }
  }
  
  function defineNode () {
    Node.encodingLength = encodingLength
    Node.encode = encode
    Node.decode = decode
  
    function encodingLength (obj) {
      var length = 0
      if (!defined(obj.key)) throw new Error("key is required")
      var len = encodings.string.encodingLength(obj.key)
      length += 1 + len
      if (defined(obj.valueBuffer)) {
        var len = encodings.bytes.encodingLength(obj.valueBuffer)
        length += 1 + len
      }
      if (defined(obj.trieBuffer)) {
        var len = encodings.bytes.encodingLength(obj.trieBuffer)
        length += 1 + len
      }
      if (defined(obj.seq)) {
        var len = encodings.varint.encodingLength(obj.seq)
        length += 1 + len
      }
      if (defined(obj.flags)) {
        var len = encodings.varint.encodingLength(obj.flags)
        length += 1 + len
      }
      return length
    }
  
    function encode (obj, buf, offset) {
      if (!offset) offset = 0
      if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj))
      var oldOffset = offset
      if (!defined(obj.key)) throw new Error("key is required")
      buf[offset++] = 10
      encodings.string.encode(obj.key, buf, offset)
      offset += encodings.string.encode.bytes
      if (defined(obj.valueBuffer)) {
        buf[offset++] = 18
        encodings.bytes.encode(obj.valueBuffer, buf, offset)
        offset += encodings.bytes.encode.bytes
      }
      if (defined(obj.trieBuffer)) {
        buf[offset++] = 26
        encodings.bytes.encode(obj.trieBuffer, buf, offset)
        offset += encodings.bytes.encode.bytes
      }
      if (defined(obj.seq)) {
        buf[offset++] = 32
        encodings.varint.encode(obj.seq, buf, offset)
        offset += encodings.varint.encode.bytes
      }
      if (defined(obj.flags)) {
        buf[offset++] = 40
        encodings.varint.encode(obj.flags, buf, offset)
        offset += encodings.varint.encode.bytes
      }
      encode.bytes = offset - oldOffset
      return buf
    }
  
    function decode (buf, offset, end) {
      if (!offset) offset = 0
      if (!end) end = buf.length
      if (!(end <= buf.length && offset <= buf.length)) throw new Error("Decoded message is not valid")
      var oldOffset = offset
      var obj = {
        key: "",
        valueBuffer: null,
        trieBuffer: null,
        seq: 0,
        flags: 0
      }
      var found0 = false
      while (true) {
        if (end <= offset) {
          if (!found0) throw new Error("Decoded message is not valid")
          decode.bytes = offset - oldOffset
          return obj
        }
        var prefix = varint.decode(buf, offset)
        offset += varint.decode.bytes
        var tag = prefix >> 3
        switch (tag) {
          case 1:
          obj.key = encodings.string.decode(buf, offset)
          offset += encodings.string.decode.bytes
          found0 = true
          break
          case 2:
          obj.valueBuffer = encodings.bytes.decode(buf, offset)
          offset += encodings.bytes.decode.bytes
          break
          case 3:
          obj.trieBuffer = encodings.bytes.decode(buf, offset)
          offset += encodings.bytes.decode.bytes
          break
          case 4:
          obj.seq = encodings.varint.decode(buf, offset)
          offset += encodings.varint.decode.bytes
          break
          case 5:
          obj.flags = encodings.varint.decode(buf, offset)
          offset += encodings.varint.decode.bytes
          break
          default:
          offset = skip(prefix & 7, buf, offset)
        }
      }
    }
  }
  
  function defineExtension () {
    var Get = Extension.Get = {
      buffer: true,
      encodingLength: null,
      encode: null,
      decode: null
    }
  
    var Iterator = Extension.Iterator = {
      buffer: true,
      encodingLength: null,
      encode: null,
      decode: null
    }
  
    var Cache = Extension.Cache = {
      buffer: true,
      encodingLength: null,
      encode: null,
      decode: null
    }
  
    defineGet()
    defineIterator()
    defineCache()
  
    function defineGet () {
      Get.encodingLength = encodingLength
      Get.encode = encode
      Get.decode = decode
  
      function encodingLength (obj) {
        var length = 0
        if (defined(obj.head)) {
          var len = encodings.varint.encodingLength(obj.head)
          length += 1 + len
        }
        if (defined(obj.key)) {
          var len = encodings.string.encodingLength(obj.key)
          length += 1 + len
        }
        return length
      }
  
      function encode (obj, buf, offset) {
        if (!offset) offset = 0
        if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj))
        var oldOffset = offset
        if (defined(obj.head)) {
          buf[offset++] = 8
          encodings.varint.encode(obj.head, buf, offset)
          offset += encodings.varint.encode.bytes
        }
        if (defined(obj.key)) {
          buf[offset++] = 18
          encodings.string.encode(obj.key, buf, offset)
          offset += encodings.string.encode.bytes
        }
        encode.bytes = offset - oldOffset
        return buf
      }
  
      function decode (buf, offset, end) {
        if (!offset) offset = 0
        if (!end) end = buf.length
        if (!(end <= buf.length && offset <= buf.length)) throw new Error("Decoded message is not valid")
        var oldOffset = offset
        var obj = {
          head: 0,
          key: ""
        }
        while (true) {
          if (end <= offset) {
            decode.bytes = offset - oldOffset
            return obj
          }
          var prefix = varint.decode(buf, offset)
          offset += varint.decode.bytes
          var tag = prefix >> 3
          switch (tag) {
            case 1:
            obj.head = encodings.varint.decode(buf, offset)
            offset += encodings.varint.decode.bytes
            break
            case 2:
            obj.key = encodings.string.decode(buf, offset)
            offset += encodings.string.decode.bytes
            break
            default:
            offset = skip(prefix & 7, buf, offset)
          }
        }
      }
    }
  
    function defineIterator () {
      Iterator.encodingLength = encodingLength
      Iterator.encode = encode
      Iterator.decode = decode
  
      function encodingLength (obj) {
        var length = 0
        if (defined(obj.head)) {
          var len = encodings.varint.encodingLength(obj.head)
          length += 1 + len
        }
        if (defined(obj.key)) {
          var len = encodings.string.encodingLength(obj.key)
          length += 1 + len
        }
        if (defined(obj.flags)) {
          var len = encodings.varint.encodingLength(obj.flags)
          length += 1 + len
        }
        if (defined(obj.checkpoint)) {
          var len = encodings.bytes.encodingLength(obj.checkpoint)
          length += 1 + len
        }
        return length
      }
  
      function encode (obj, buf, offset) {
        if (!offset) offset = 0
        if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj))
        var oldOffset = offset
        if (defined(obj.head)) {
          buf[offset++] = 8
          encodings.varint.encode(obj.head, buf, offset)
          offset += encodings.varint.encode.bytes
        }
        if (defined(obj.key)) {
          buf[offset++] = 18
          encodings.string.encode(obj.key, buf, offset)
          offset += encodings.string.encode.bytes
        }
        if (defined(obj.flags)) {
          buf[offset++] = 24
          encodings.varint.encode(obj.flags, buf, offset)
          offset += encodings.varint.encode.bytes
        }
        if (defined(obj.checkpoint)) {
          buf[offset++] = 34
          encodings.bytes.encode(obj.checkpoint, buf, offset)
          offset += encodings.bytes.encode.bytes
        }
        encode.bytes = offset - oldOffset
        return buf
      }
  
      function decode (buf, offset, end) {
        if (!offset) offset = 0
        if (!end) end = buf.length
        if (!(end <= buf.length && offset <= buf.length)) throw new Error("Decoded message is not valid")
        var oldOffset = offset
        var obj = {
          head: 0,
          key: "",
          flags: 0,
          checkpoint: null
        }
        while (true) {
          if (end <= offset) {
            decode.bytes = offset - oldOffset
            return obj
          }
          var prefix = varint.decode(buf, offset)
          offset += varint.decode.bytes
          var tag = prefix >> 3
          switch (tag) {
            case 1:
            obj.head = encodings.varint.decode(buf, offset)
            offset += encodings.varint.decode.bytes
            break
            case 2:
            obj.key = encodings.string.decode(buf, offset)
            offset += encodings.string.decode.bytes
            break
            case 3:
            obj.flags = encodings.varint.decode(buf, offset)
            offset += encodings.varint.decode.bytes
            break
            case 4:
            obj.checkpoint = encodings.bytes.decode(buf, offset)
            offset += encodings.bytes.decode.bytes
            break
            default:
            offset = skip(prefix & 7, buf, offset)
          }
        }
      }
    }
  
    function defineCache () {
      Cache.encodingLength = encodingLength
      Cache.encode = encode
      Cache.decode = decode
  
      function encodingLength (obj) {
        var length = 0
        if (!defined(obj.start)) throw new Error("start is required")
        var len = encodings.varint.encodingLength(obj.start)
        length += 1 + len
        if (!defined(obj.end)) throw new Error("end is required")
        var len = encodings.varint.encodingLength(obj.end)
        length += 1 + len
        if (defined(obj.blocks)) {
          var packedLen = 0
          for (var i = 0; i < obj.blocks.length; i++) {
            if (!defined(obj.blocks[i])) continue
            var len = encodings.varint.encodingLength(obj.blocks[i])
            packedLen += len
          }
          if (packedLen) {
            length += 1 + packedLen + varint.encodingLength(packedLen)
          }
        }
        return length
      }
  
      function encode (obj, buf, offset) {
        if (!offset) offset = 0
        if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj))
        var oldOffset = offset
        if (!defined(obj.start)) throw new Error("start is required")
        buf[offset++] = 8
        encodings.varint.encode(obj.start, buf, offset)
        offset += encodings.varint.encode.bytes
        if (!defined(obj.end)) throw new Error("end is required")
        buf[offset++] = 16
        encodings.varint.encode(obj.end, buf, offset)
        offset += encodings.varint.encode.bytes
        if (defined(obj.blocks)) {
          var packedLen = 0
          for (var i = 0; i < obj.blocks.length; i++) {
            if (!defined(obj.blocks[i])) continue
            packedLen += encodings.varint.encodingLength(obj.blocks[i])
          }
          if (packedLen) {
            buf[offset++] = 26
            varint.encode(packedLen, buf, offset)
            offset += varint.encode.bytes
          }
          for (var i = 0; i < obj.blocks.length; i++) {
            if (!defined(obj.blocks[i])) continue
            encodings.varint.encode(obj.blocks[i], buf, offset)
            offset += encodings.varint.encode.bytes
          }
        }
        encode.bytes = offset - oldOffset
        return buf
      }
  
      function decode (buf, offset, end) {
        if (!offset) offset = 0
        if (!end) end = buf.length
        if (!(end <= buf.length && offset <= buf.length)) throw new Error("Decoded message is not valid")
        var oldOffset = offset
        var obj = {
          start: 0,
          end: 0,
          blocks: []
        }
        var found0 = false
        var found1 = false
        while (true) {
          if (end <= offset) {
            if (!found0 || !found1) throw new Error("Decoded message is not valid")
            decode.bytes = offset - oldOffset
            return obj
          }
          var prefix = varint.decode(buf, offset)
          offset += varint.decode.bytes
          var tag = prefix >> 3
          switch (tag) {
            case 1:
            obj.start = encodings.varint.decode(buf, offset)
            offset += encodings.varint.decode.bytes
            found0 = true
            break
            case 2:
            obj.end = encodings.varint.decode(buf, offset)
            offset += encodings.varint.decode.bytes
            found1 = true
            break
            case 3:
            var packedEnd = varint.decode(buf, offset)
            offset += varint.decode.bytes
            packedEnd += offset
            while (offset < packedEnd) {
              obj.blocks.push(encodings.varint.decode(buf, offset))
              offset += encodings.varint.decode.bytes
            }
            break
            default:
            offset = skip(prefix & 7, buf, offset)
          }
        }
      }
    }
  
    Extension.encodingLength = encodingLength
    Extension.encode = encode
    Extension.decode = decode
  
    function encodingLength (obj) {
      var length = 0
      if (defined(obj.cache)) {
        var len = Cache.encodingLength(obj.cache)
        length += varint.encodingLength(len)
        length += 1 + len
      }
      if (defined(obj.iterator)) {
        var len = Iterator.encodingLength(obj.iterator)
        length += varint.encodingLength(len)
        length += 1 + len
      }
      if (defined(obj.get)) {
        var len = Get.encodingLength(obj.get)
        length += varint.encodingLength(len)
        length += 1 + len
      }
      return length
    }
  
    function encode (obj, buf, offset) {
      if (!offset) offset = 0
      if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj))
      var oldOffset = offset
      if (defined(obj.cache)) {
        buf[offset++] = 10
        varint.encode(Cache.encodingLength(obj.cache), buf, offset)
        offset += varint.encode.bytes
        Cache.encode(obj.cache, buf, offset)
        offset += Cache.encode.bytes
      }
      if (defined(obj.iterator)) {
        buf[offset++] = 18
        varint.encode(Iterator.encodingLength(obj.iterator), buf, offset)
        offset += varint.encode.bytes
        Iterator.encode(obj.iterator, buf, offset)
        offset += Iterator.encode.bytes
      }
      if (defined(obj.get)) {
        buf[offset++] = 26
        varint.encode(Get.encodingLength(obj.get), buf, offset)
        offset += varint.encode.bytes
        Get.encode(obj.get, buf, offset)
        offset += Get.encode.bytes
      }
      encode.bytes = offset - oldOffset
      return buf
    }
  
    function decode (buf, offset, end) {
      if (!offset) offset = 0
      if (!end) end = buf.length
      if (!(end <= buf.length && offset <= buf.length)) throw new Error("Decoded message is not valid")
      var oldOffset = offset
      var obj = {
        cache: null,
        iterator: null,
        get: null
      }
      while (true) {
        if (end <= offset) {
          decode.bytes = offset - oldOffset
          return obj
        }
        var prefix = varint.decode(buf, offset)
        offset += varint.decode.bytes
        var tag = prefix >> 3
        switch (tag) {
          case 1:
          var len = varint.decode(buf, offset)
          offset += varint.decode.bytes
          obj.cache = Cache.decode(buf, offset, offset + len)
          offset += Cache.decode.bytes
          break
          case 2:
          var len = varint.decode(buf, offset)
          offset += varint.decode.bytes
          obj.iterator = Iterator.decode(buf, offset, offset + len)
          offset += Iterator.decode.bytes
          break
          case 3:
          var len = varint.decode(buf, offset)
          offset += varint.decode.bytes
          obj.get = Get.decode(buf, offset, offset + len)
          offset += Get.decode.bytes
          break
          default:
          offset = skip(prefix & 7, buf, offset)
        }
      }
    }
  }
  
  function defined (val) {
    return val !== null && val !== undefined && (typeof val !== 'number' || !isNaN(val))
  }
  