OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated / @holepunchto / keet-schemas / packages / schema / spec / api / hrpc / messages.js

6040 lines · javascript ref:
const { c: e } = require("hyperschema/runtime"),
  d = 4
let o = 4
const n = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), e.uint.preencode(d, o.length))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), e.uint.encode(d, o.length))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), length: e.uint.decode(d) }),
  },
  c = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), e.uint.preencode(d, o.seq))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), e.uint.encode(d, o.seq))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), seq: e.uint.decode(d) }),
  },
  r = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey), e.fixed32.preencode(d, o.secretKey))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.publicKey), e.fixed32.encode(d, o.secretKey))
    },
    decode: (d) => ({ publicKey: e.fixed32.decode(d), secretKey: e.fixed32.decode(d) }),
  },
  t = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey), e.fixed64.preencode(d, o.secretKey))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.publicKey), e.fixed64.encode(d, o.secretKey))
    },
    decode: (d) => ({ publicKey: e.fixed32.decode(d), secretKey: e.fixed64.decode(d) }),
  },
  i = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        d.end++,
        o.encryptionKey && e.buffer.preencode(d, o.encryptionKey),
        o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo))
    },
    encode(d, o) {
      const n = (o.encryptionKey ? 1 : 0) | (o.fastForwardTo ? 2 : 0)
      ;(e.fixed32.encode(d, o.key),
        e.uint.encode(d, n),
        o.encryptionKey && e.buffer.encode(d, o.encryptionKey),
        o.fastForwardTo && e.fixed32.encode(d, o.fastForwardTo))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d)
      return {
        key: o,
        encryptionKey: 1 & n ? e.buffer.decode(d) : null,
        fastForwardTo: 2 & n ? e.fixed32.decode(d) : null,
      }
    },
  },
  a = {
    preencode(d, o) {
      e.uint.preencode(d, o.timestamp)
    },
    encode(d, o) {
      e.uint.encode(d, o.timestamp)
    },
    decode: (d) => ({ timestamp: e.uint.decode(d) }),
  },
  s = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.blockOffset),
        e.uint.preencode(d, o.blockLength),
        e.uint.preencode(d, o.byteOffset),
        e.uint.preencode(d, o.byteLength))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.blockOffset),
        e.uint.encode(d, o.blockLength),
        e.uint.encode(d, o.byteOffset),
        e.uint.encode(d, o.byteLength))
    },
    decode: (d) => ({
      blockOffset: e.uint.decode(d),
      blockLength: e.uint.decode(d),
      byteOffset: e.uint.decode(d),
      byteLength: e.uint.decode(d),
    }),
  },
  p = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.width), e.uint.preencode(d, o.height))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.width), e.uint.encode(d, o.height))
    },
    decode: (d) => ({ width: e.uint.decode(d), height: e.uint.decode(d) }),
  },
  u = e.frame(p),
  l = {
    preencode(d, o) {
      ;(d.end++,
        o.name && e.string.preencode(d, o.name),
        o.mimetype && e.string.preencode(d, o.mimetype),
        o.dimensions && u.preencode(d, o.dimensions),
        o.userdata && e.buffer.preencode(d, o.userdata),
        o.duration && e.uint.preencode(d, o.duration))
    },
    encode(d, o) {
      const n =
        (o.name ? 1 : 0) |
        (o.mimetype ? 2 : 0) |
        (o.dimensions ? 4 : 0) |
        (o.userdata ? 8 : 0) |
        (o.duration ? 16 : 0) |
        (o.isPreview ? 32 : 0)
      ;(e.uint.encode(d, n),
        o.name && e.string.encode(d, o.name),
        o.mimetype && e.string.encode(d, o.mimetype),
        o.dimensions && u.encode(d, o.dimensions),
        o.userdata && e.buffer.encode(d, o.userdata),
        o.duration && e.uint.encode(d, o.duration))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        name: 1 & o ? e.string.decode(d) : null,
        mimetype: 2 & o ? e.string.decode(d) : null,
        dimensions: 4 & o ? u.decode(d) : null,
        userdata: 8 & o ? e.buffer.decode(d) : null,
        duration: 16 & o ? e.uint.decode(d) : 0,
        isPreview: !!(32 & o),
      }
    },
  },
  f = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        e.string.preencode(d, o.path),
        e.uint.preencode(d, o.version),
        e.uint.preencode(d, o.size))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key),
        e.string.encode(d, o.path),
        e.uint.encode(d, o.version),
        e.uint.encode(d, o.size))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      path: e.string.decode(d),
      version: e.uint.decode(d),
      size: e.uint.decode(d),
    }),
  },
  m = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), s.preencode(d, o.blob))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), s.encode(d, o.blob))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), blob: s.decode(d) }),
  },
  y = e.frame(m),
  x = e.frame(f),
  b = {
    preencode(d, o) {
      ;(d.end++,
        o.inlined && e.buffer.preencode(d, o.inlined),
        o.blob && s.preencode(d, o.blob),
        o.externalBlob && y.preencode(d, o.externalBlob),
        o.externalDrive && x.preencode(d, o.externalDrive))
    },
    encode(d, o) {
      const n =
        (o.inlined ? 1 : 0) |
        (o.blob ? 2 : 0) |
        (o.externalBlob ? 4 : 0) |
        (o.externalDrive ? 8 : 0)
      ;(e.uint.encode(d, n),
        o.inlined && e.buffer.encode(d, o.inlined),
        o.blob && s.encode(d, o.blob),
        o.externalBlob && y.encode(d, o.externalBlob),
        o.externalDrive && x.encode(d, o.externalDrive))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        inlined: 1 & o ? e.buffer.decode(d) : null,
        blob: 2 & o ? s.decode(d) : null,
        externalBlob: 4 & o ? y.decode(d) : null,
        externalDrive: 8 & o ? x.decode(d) : null,
      }
    },
  },
  v = e.frame(b),
  g = e.frame(l),
  k = {
    preencode(d, o) {
      ;(v.preencode(d, o.pointer),
        d.end++,
        o.metadata && g.preencode(d, o.metadata),
        o.preview && Cp.preencode(d, o.preview),
        o.hash && e.fixed32.preencode(d, o.hash))
    },
    encode(d, o) {
      const n = (o.metadata ? 1 : 0) | (o.preview ? 2 : 0) | (o.hash ? 4 : 0)
      ;(v.encode(d, o.pointer),
        e.uint.encode(d, n),
        o.metadata && g.encode(d, o.metadata),
        o.preview && Cp.encode(d, o.preview),
        o.hash && e.fixed32.encode(d, o.hash))
    },
    decode(d) {
      const o = v.decode(d),
        n = e.uint.decode(d)
      return {
        pointer: o,
        metadata: 1 & n ? g.decode(d) : null,
        preview: 2 & n ? Cp.decode(d) : null,
        hash: 4 & n ? e.fixed32.decode(d) : null,
      }
    },
  },
  K = e.frame(k),
  h = K,
  w = K,
  P = {
    preencode(e, d) {
      ;(e.end++,
        d.small && K.preencode(e, d.small),
        d.medium && h.preencode(e, d.medium),
        d.large && w.preencode(e, d.large))
    },
    encode(d, o) {
      const n = (o.small ? 1 : 0) | (o.medium ? 2 : 0) | (o.large ? 4 : 0)
      ;(e.uint.encode(d, n),
        o.small && K.encode(d, o.small),
        o.medium && h.encode(d, o.medium),
        o.large && w.encode(d, o.large))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        small: 1 & o ? K.decode(d) : null,
        medium: 2 & o ? h.decode(d) : null,
        large: 4 & o ? w.decode(d) : null,
      }
    },
  },
  R = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = o.isDeleted ? 1 : 0
      e.uint.encode(d, n)
    },
    decode: (d) => ({ isDeleted: !!(1 & e.uint.decode(d)) }),
  },
  T = e.frame(R),
  q = K,
  A = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.id),
        c.preencode(d, o.oplog),
        T.preencode(d, o.status),
        q.preencode(d, o.file),
        d.end++,
        o.version && e.uint.preencode(d, o.version))
    },
    encode(d, o) {
      const n = o.version ? 1 : 0
      ;(e.uint.encode(d, o.id),
        c.encode(d, o.oplog),
        T.encode(d, o.status),
        q.encode(d, o.file),
        e.uint.encode(d, n),
        o.version && e.uint.encode(d, o.version))
    },
    decode: (d) => ({
      id: e.uint.decode(d),
      oplog: c.decode(d),
      status: T.decode(d),
      file: q.decode(d),
      version: 1 & e.uint.decode(d) ? e.uint.decode(d) : 0,
    }),
  },
  M = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = (o.isActive ? 1 : 0) | (o.isIndexing ? 2 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { isActive: !!(1 & o), isIndexing: !!(2 & o) }
    },
  },
  S = {
    preencode(d, o) {
      const n =
        (o.isAdmin ? 1 : 0) |
        (o.isModerator ? 2 : 0) |
        (o.isPending ? 4 : 0) |
        (o.isActive ? 8 : 0) |
        (o.isMuted ? 16 : 0) |
        (o.isBanned ? 32 : 0) |
        (o.isShadowBanned ? 64 : 0) |
        (o.isRemoved ? 128 : 0)
      e.uint.preencode(d, n)
    },
    encode(d, o) {
      const n =
        (o.isAdmin ? 1 : 0) |
        (o.isModerator ? 2 : 0) |
        (o.isPending ? 4 : 0) |
        (o.isActive ? 8 : 0) |
        (o.isMuted ? 16 : 0) |
        (o.isBanned ? 32 : 0) |
        (o.isShadowBanned ? 64 : 0) |
        (o.isRemoved ? 128 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        isAdmin: !!(1 & o),
        isModerator: !!(2 & o),
        isPending: !!(4 & o),
        isActive: !!(8 & o),
        isMuted: !!(16 & o),
        isBanned: !!(32 & o),
        isShadowBanned: !!(64 & o),
        isRemoved: !!(128 & o),
      }
    },
  },
  C = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = (o.isMuted ? 1 : 0) | (o.isBanned ? 2 : 0) | (o.isShadowBanned ? 4 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { isMuted: !!(1 & o), isBanned: !!(2 & o), isShadowBanned: !!(4 & o) }
    },
  },
  I = {
    preencode(d, o) {
      e.uint.preencode(d, o.version)
    },
    encode(d, o) {
      e.uint.encode(d, o.version)
    },
    decode: (d) => ({ version: e.uint.decode(d) }),
  },
  F = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.total), e.uint.preencode(d, o.active))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.total), e.uint.encode(d, o.active))
    },
    decode: (d) => ({ total: e.uint.decode(d), active: e.uint.decode(d) }),
  },
  D = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.total), e.uint.preencode(d, o.active), e.uint.preencode(d, o.pending))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.total), e.uint.encode(d, o.active), e.uint.encode(d, o.pending))
    },
    decode: (d) => ({
      total: e.uint.decode(d),
      active: e.uint.decode(d),
      pending: e.uint.decode(d),
    }),
  },
  j = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.clock),
        e.uint.preencode(d, o.pinned),
        e.uint.preencode(d, o.threads),
        e.uint.preencode(d, o.timestamp),
        d.end++,
        o.flagsClock && e.uint.preencode(d, o.flagsClock))
    },
    encode(d, o) {
      const n = o.flagsClock ? 1 : 0
      ;(e.uint.encode(d, o.clock),
        e.uint.encode(d, o.pinned),
        e.uint.encode(d, o.threads),
        e.uint.encode(d, o.timestamp),
        e.uint.encode(d, n),
        o.flagsClock && e.uint.encode(d, o.flagsClock))
    },
    decode: (d) => ({
      clock: e.uint.decode(d),
      pinned: e.uint.decode(d),
      threads: e.uint.decode(d),
      timestamp: e.uint.decode(d),
      flagsClock: 1 & e.uint.decode(d) ? e.uint.decode(d) : 0,
    }),
  },
  L = {
    preencode(d, o) {
      e.uint.preencode(d, o.clock)
    },
    encode(d, o) {
      e.uint.encode(d, o.clock)
    },
    decode: (d) => ({ clock: e.uint.decode(d) }),
  },
  E = e.frame(F),
  B = e.frame(D),
  N = e.frame(j),
  V = e.frame(L),
  U = {
    preencode(e, d) {
      ;(E.preencode(e, d.devices),
        B.preencode(e, d.members),
        N.preencode(e, d.chat),
        V.preencode(e, d.files))
    },
    encode(e, d) {
      ;(E.encode(e, d.devices), B.encode(e, d.members), N.encode(e, d.chat), V.encode(e, d.files))
    },
    decode: (e) => ({
      devices: E.decode(e),
      members: B.decode(e),
      chat: N.decode(e),
      files: V.decode(e),
    }),
  },
  J = { Default: 1, Broadcast: 2, DirectMessage: 3 },
  O = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 3) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  z = {
    preencode(e, d) {
      ;(e.end++, d.roomType && O.preencode(e, d.roomType))
    },
    encode(d, o) {
      const n =
        (o.roomType ? 1 : 0) |
        (o.isExperimental ? 2 : 0) |
        (o.isJoiningDisabled ? 4 : 0) |
        (o.isAppendingDisabled ? 8 : 0) |
        (o.isCallingDisabled ? 16 : 0) |
        (o.isMembershipEventsDisabled ? 32 : 0)
      ;(e.uint.encode(d, n), o.roomType && O.encode(d, o.roomType))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        roomType: 1 & o ? O.decode(d) : 0,
        isExperimental: !!(2 & o),
        isJoiningDisabled: !!(4 & o),
        isAppendingDisabled: !!(8 & o),
        isCallingDisabled: !!(16 & o),
        isMembershipEventsDisabled: !!(32 & o),
      }
    },
  },
  W = e.frame(I),
  H = e.frame(z),
  G = {
    preencode(d, o) {
      ;(W.preencode(d, o.abi), H.preencode(d, o.settings), e.uint.preencode(d, o.creationTime))
    },
    encode(d, o) {
      ;(W.encode(d, o.abi), H.encode(d, o.settings), e.uint.encode(d, o.creationTime))
    },
    decode: (d) => ({ abi: W.decode(d), settings: H.decode(d), creationTime: e.uint.decode(d) }),
  },
  Q = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.seed)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.seed)
    },
    decode: (d) => ({ seed: e.fixed32.decode(d) }),
  },
  X = {
    preencode(d, o) {
      ;(r.preencode(d, o.mailboxKeyPair),
        t.preencode(d, o.discoveryKeyPair),
        e.fixed32.preencode(d, o.wakeupTopic),
        e.fixed32.preencode(d, o.swarmTopic))
    },
    encode(d, o) {
      ;(r.encode(d, o.mailboxKeyPair),
        t.encode(d, o.discoveryKeyPair),
        e.fixed32.encode(d, o.wakeupTopic),
        e.fixed32.encode(d, o.swarmTopic))
    },
    decode: (d) => ({
      mailboxKeyPair: r.decode(d),
      discoveryKeyPair: t.decode(d),
      wakeupTopic: e.fixed32.decode(d),
      swarmTopic: e.fixed32.decode(d),
    }),
  },
  Y = { en: "en", it: "it", ru: "ru", es: "es", de: "de" },
  Z = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      switch (o) {
        case "en":
          e.uint.encode(d, 1)
          break
        case "it":
          e.uint.encode(d, 2)
          break
        case "ru":
          e.uint.encode(d, 3)
          break
        case "es":
          e.uint.encode(d, 4)
          break
        case "de":
          e.uint.encode(d, 5)
          break
        default:
          throw new Error("Unknown enum")
      }
    },
    decode(d) {
      switch (e.uint.decode(d)) {
        case 1:
          return "en"
        case 2:
          return "it"
        case 3:
          return "ru"
        case 4:
          return "es"
        case 5:
          return "de"
        default:
          return null
      }
    },
  },
  $ = e.array(Z),
  _ = e.array(e.fixed32),
  ee = {
    preencode(d, o) {
      ;(d.end++,
        o.title && e.string.preencode(d, o.title),
        o.avatar && Ip.preencode(d, o.avatar),
        o.description && e.string.preencode(d, o.description),
        o.supportedLanguages && $.preencode(d, o.supportedLanguages),
        o.blindPeers && _.preencode(d, o.blindPeers))
    },
    encode(d, o) {
      const n =
        (o.title ? 1 : 0) |
        (o.avatar ? 2 : 0) |
        (o.description ? 4 : 0) |
        (o.supportedLanguages ? 8 : 0) |
        (o.blindPeers ? 16 : 0)
      ;(e.uint.encode(d, n),
        o.title && e.string.encode(d, o.title),
        o.avatar && Ip.encode(d, o.avatar),
        o.description && e.string.encode(d, o.description),
        o.supportedLanguages && $.encode(d, o.supportedLanguages),
        o.blindPeers && _.encode(d, o.blindPeers))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        title: 1 & o ? e.string.decode(d) : null,
        avatar: 2 & o ? Ip.decode(d) : null,
        description: 4 & o ? e.string.decode(d) : null,
        supportedLanguages: 8 & o ? $.decode(d) : null,
        blindPeers: 16 & o ? _.decode(d) : null,
      }
    },
  },
  de = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.key)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.key)
    },
    decode: (d) => ({ key: e.fixed32.decode(d) }),
  },
  oe = e.frame(a),
  ne = e.frame(de),
  ce = {
    preencode(e, d) {
      ;(oe.preencode(e, d.header), ne.preencode(e, d.peer))
    },
    encode(e, d) {
      ;(oe.encode(e, d.header), ne.encode(e, d.peer))
    },
    decode: (e) => ({ header: oe.decode(e), peer: ne.decode(e) }),
  },
  re = oe,
  te = {
    preencode(d, o) {
      ;(re.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(re.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: re.decode(d), key: e.fixed32.decode(d) }),
  },
  ie = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey), e.buffer.preencode(d, o.proof))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.memberKey), e.buffer.encode(d, o.proof))
    },
    decode: (d) => ({ memberKey: e.fixed32.decode(d), proof: e.buffer.decode(d) }),
  },
  ae = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id), e.buffer.preencode(d, o.response))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.id), e.buffer.encode(d, o.response))
    },
    decode: (d) => ({ id: e.fixed32.decode(d), response: e.buffer.decode(d) }),
  },
  se = e.frame(M),
  pe = e.frame(ae),
  ue = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        e.fixed32.preencode(d, o.memberKey),
        se.preencode(d, o.status),
        Fp.preencode(d, o.profile),
        d.end++,
        o.invitation && pe.preencode(d, o.invitation))
    },
    encode(d, o) {
      const n = o.invitation ? 1 : 0
      ;(e.fixed32.encode(d, o.key),
        e.fixed32.encode(d, o.memberKey),
        se.encode(d, o.status),
        Fp.encode(d, o.profile),
        e.uint.encode(d, n),
        o.invitation && pe.encode(d, o.invitation))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      memberKey: e.fixed32.decode(d),
      status: se.decode(d),
      profile: Fp.decode(d),
      invitation: 1 & e.uint.decode(d) ? pe.decode(d) : null,
    }),
  },
  le = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.timestamp),
        d.end++,
        o.mailbox && e.fixed32.preencode(d, o.mailbox),
        o.displayName && e.string.preencode(d, o.displayName),
        o.avatar && Dp.preencode(d, o.avatar),
        o.username && e.string.preencode(d, o.username))
    },
    encode(d, o) {
      const n =
        (o.mailbox ? 1 : 0) | (o.displayName ? 2 : 0) | (o.avatar ? 4 : 0) | (o.username ? 8 : 0)
      ;(e.uint.encode(d, o.timestamp),
        e.uint.encode(d, n),
        o.mailbox && e.fixed32.encode(d, o.mailbox),
        o.displayName && e.string.encode(d, o.displayName),
        o.avatar && Dp.encode(d, o.avatar),
        o.username && e.string.encode(d, o.username))
    },
    decode(d) {
      const o = e.uint.decode(d),
        n = e.uint.decode(d)
      return {
        timestamp: o,
        mailbox: 1 & n ? e.fixed32.decode(d) : null,
        displayName: 2 & n ? e.string.decode(d) : null,
        avatar: 4 & n ? Dp.decode(d) : null,
        username: 8 & n ? e.string.decode(d) : null,
      }
    },
  },
  fe = {
    preencode(d, o) {
      ;(d.end++,
        o.swarmKey && e.fixed32.preencode(d, o.swarmKey),
        o.name && e.string.preencode(d, o.name))
    },
    encode(d, o) {
      const n = (o.swarmKey ? 1 : 0) | (o.name ? 2 : 0) | (o.isMobile ? 4 : 0)
      ;(e.uint.encode(d, n),
        o.swarmKey && e.fixed32.encode(d, o.swarmKey),
        o.name && e.string.encode(d, o.name))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        swarmKey: 1 & o ? e.fixed32.decode(d) : null,
        name: 2 & o ? e.string.decode(d) : null,
        isMobile: !!(4 & o),
      }
    },
  },
  me = e.frame(le),
  ye = {
    preencode(e, d) {
      ;(me.preencode(e, d.profile), ie.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(me.encode(e, d.profile), ie.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: me.decode(e), attestation: ie.decode(e) }),
  },
  xe = {
    preencode(e, d) {
      ;(jp.preencode(e, d.profile), ie.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(jp.encode(e, d.profile), ie.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: jp.decode(e), attestation: ie.decode(e) }),
  },
  be = me,
  ve = {
    preencode(e, d) {
      ;(be.preencode(e, d.profile), ie.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(be.encode(e, d.profile), ie.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: be.decode(e), attestation: ie.decode(e) }),
  },
  ge = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id),
        e.buffer.preencode(d, o.data),
        e.buffer.preencode(d, o.signature))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.id), e.buffer.encode(d, o.data), e.buffer.encode(d, o.signature))
    },
    decode: (d) => ({
      id: e.fixed32.decode(d),
      data: e.buffer.decode(d),
      signature: e.buffer.decode(d),
    }),
  },
  ke = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.devicePublicKey)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.devicePublicKey)
    },
    decode: (d) => ({ devicePublicKey: e.fixed32.decode(d) }),
  },
  Ke = {
    preencode(d, o) {
      ;(ie.preencode(d, o.privateProfileIdentity), e.buffer.preencode(d, o.deviceProof))
    },
    encode(d, o) {
      ;(ie.encode(d, o.privateProfileIdentity), e.buffer.encode(d, o.deviceProof))
    },
    decode: (d) => ({ privateProfileIdentity: ie.decode(d), deviceProof: e.buffer.decode(d) }),
  },
  he = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.deviceKey),
        ie.preencode(d, o.privateProfileIdentity),
        e.buffer.preencode(d, o.deviceProof))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.deviceKey),
        ie.encode(d, o.privateProfileIdentity),
        e.buffer.encode(d, o.deviceProof))
    },
    decode: (d) => ({
      deviceKey: e.fixed32.decode(d),
      privateProfileIdentity: ie.decode(d),
      deviceProof: e.buffer.decode(d),
    }),
  },
  we = e.frame(xe),
  Pe = e.frame(ye),
  Re = e.frame(ke),
  Te = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.deviceKey),
        t.preencode(d, o.keyPair),
        we.preencode(d, o.device),
        Pe.preencode(d, o.member),
        d.end++,
        o.identity && Re.preencode(d, o.identity))
    },
    encode(d, o) {
      const n = o.identity ? 1 : 0
      ;(e.fixed32.encode(d, o.deviceKey),
        t.encode(d, o.keyPair),
        we.encode(d, o.device),
        Pe.encode(d, o.member),
        e.uint.encode(d, n),
        o.identity && Re.encode(d, o.identity))
    },
    decode: (d) => ({
      deviceKey: e.fixed32.decode(d),
      keyPair: t.decode(d),
      device: we.decode(d),
      member: Pe.decode(d),
      identity: 1 & e.uint.decode(d) ? Re.decode(d) : null,
    }),
  },
  qe = e.frame(Te),
  Ae = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id),
        qe.preencode(d, o.request),
        e.buffer.preencode(d, o.signature))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.id), qe.encode(d, o.request), e.buffer.encode(d, o.signature))
    },
    decode: (d) => ({
      id: e.fixed32.decode(d),
      request: qe.decode(d),
      signature: e.buffer.decode(d),
    }),
  },
  Me = we,
  Se = Pe,
  Ce = {
    preencode(e, d) {
      ;(Me.preencode(e, d.device), e.end++, d.member && Se.preencode(e, d.member))
    },
    encode(d, o) {
      const n = o.member ? 1 : 0
      ;(Me.encode(d, o.device), e.uint.encode(d, n), o.member && Se.encode(d, o.member))
    },
    decode: (d) => ({ device: Me.decode(d), member: 1 & e.uint.decode(d) ? Se.decode(d) : null }),
  },
  Ie = e.frame(Ae),
  Fe = e.frame(Ce),
  De = {
    preencode(e, d) {
      ;(e.end++,
        d.withInvitation && Ie.preencode(e, d.withInvitation),
        d.withMemberProof && Fe.preencode(e, d.withMemberProof))
    },
    encode(d, o) {
      const n = (o.withInvitation ? 1 : 0) | (o.withMemberProof ? 2 : 0)
      ;(e.uint.encode(d, n),
        o.withInvitation && Ie.encode(d, o.withInvitation),
        o.withMemberProof && Fe.encode(d, o.withMemberProof))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        withInvitation: 1 & o ? Ie.decode(d) : null,
        withMemberProof: 2 & o ? Fe.decode(d) : null,
      }
    },
  },
  je = e.frame(ge),
  Le = e.frame(Ke),
  Ee = {
    preencode(e, d) {
      ;(je.preencode(e, d.signedKeys), e.end++, d.identity && Le.preencode(e, d.identity))
    },
    encode(d, o) {
      const n = o.identity ? 1 : 0
      ;(je.encode(d, o.signedKeys), e.uint.encode(d, n), o.identity && Le.encode(d, o.identity))
    },
    decode: (d) => ({
      signedKeys: je.decode(d),
      identity: 1 & e.uint.decode(d) ? Le.decode(d) : null,
    }),
  },
  Be = {
    preencode(d, o) {
      ;(d.end++, o.expiration && e.uint.preencode(d, o.expiration))
    },
    encode(d, o) {
      const n =
        (o.expiration ? 1 : 0) |
        (o.requiresConfirmation ? 2 : 0) |
        (o.canModerate ? 4 : 0) |
        (o.canAdmin ? 8 : 0)
      ;(e.uint.encode(d, n), o.expiration && e.uint.encode(d, o.expiration))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        expiration: 1 & o ? e.uint.decode(d) : 0,
        requiresConfirmation: !!(2 & o),
        canModerate: !!(4 & o),
        canAdmin: !!(8 & o),
      }
    },
  },
  Ne = je,
  Ve = e.frame(Be),
  Ue = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id),
        Ne.preencode(d, o.response),
        Ve.preencode(d, o.metadata),
        d.end++,
        o.anchor && n.preencode(d, o.anchor))
    },
    encode(d, o) {
      const c = (o.anchor ? 1 : 0) | (o.isActive ? 2 : 0)
      ;(e.fixed32.encode(d, o.id),
        Ne.encode(d, o.response),
        Ve.encode(d, o.metadata),
        e.uint.encode(d, c),
        o.anchor && n.encode(d, o.anchor))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = Ne.decode(d),
        r = Ve.decode(d),
        t = e.uint.decode(d)
      return {
        id: o,
        response: c,
        metadata: r,
        anchor: 1 & t ? n.decode(d) : null,
        isActive: !!(2 & t),
      }
    },
  },
  Je = oe,
  Oe = e.frame(Ue),
  ze = {
    preencode(e, d) {
      ;(Je.preencode(e, d.header), Oe.preencode(e, d.invitation))
    },
    encode(e, d) {
      ;(Je.encode(e, d.header), Oe.encode(e, d.invitation))
    },
    decode: (e) => ({ header: Je.decode(e), invitation: Oe.decode(e) }),
  },
  We = oe,
  He = {
    preencode(d, o) {
      ;(We.preencode(d, o.header), e.fixed32.preencode(d, o.id))
    },
    encode(d, o) {
      ;(We.encode(d, o.header), e.fixed32.encode(d, o.id))
    },
    decode: (d) => ({ header: We.decode(d), id: e.fixed32.decode(d) }),
  },
  Ge = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.mailbox),
        e.fixed32.preencode(d, o.invitationSeed),
        n.preencode(d, o.anchor))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.mailbox),
        e.fixed32.encode(d, o.invitationSeed),
        n.encode(d, o.anchor))
    },
    decode: (d) => ({
      mailbox: e.fixed32.decode(d),
      invitationSeed: e.fixed32.decode(d),
      anchor: n.decode(d),
    }),
  },
  Qe = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.fixed32.preencode(d, o.encryptionKey),
        e.fixed32.preencode(d, o.seed),
        d.end++,
        o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo))
    },
    encode(d, o) {
      const n = o.fastForwardTo ? 1 : 0
      ;(e.fixed32.encode(d, o.roomKey),
        e.fixed32.encode(d, o.encryptionKey),
        e.fixed32.encode(d, o.seed),
        e.uint.encode(d, n),
        o.fastForwardTo && e.fixed32.encode(d, o.fastForwardTo))
    },
    decode: (d) => ({
      roomKey: e.fixed32.decode(d),
      encryptionKey: e.fixed32.decode(d),
      seed: e.fixed32.decode(d),
      fastForwardTo: 1 & e.uint.decode(d) ? e.fixed32.decode(d) : null,
    }),
  },
  Xe = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.mailbox),
        e.fixed32.preencode(d, o.invitationSeed),
        n.preencode(d, o.anchor),
        e.fixed32.preencode(d, o.identityPublicKey))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.mailbox),
        e.fixed32.encode(d, o.invitationSeed),
        n.encode(d, o.anchor),
        e.fixed32.encode(d, o.identityPublicKey))
    },
    decode: (d) => ({
      mailbox: e.fixed32.decode(d),
      invitationSeed: e.fixed32.decode(d),
      anchor: n.decode(d),
      identityPublicKey: e.fixed32.decode(d),
    }),
  },
  Ye = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.mailbox)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.mailbox)
    },
    decode: (d) => ({ mailbox: e.fixed32.decode(d) }),
  },
  Ze = e.frame(Ge),
  $e = e.frame(Xe),
  _e = e.frame(Ye),
  ed = e.frame(Qe),
  dd = e.array(e.ipv4Address),
  od = {
    preencode(e, d) {
      ;(e.end++,
        d.room && Ze.preencode(e, d.room),
        d.identity && $e.preencode(e, d.identity),
        d.contact && _e.preencode(e, d.contact),
        d.readonly && ed.preencode(e, d.readonly),
        d.additionalNodes && dd.preencode(e, d.additionalNodes))
    },
    encode(d, o) {
      const n =
        (o.room ? 1 : 0) |
        (o.identity ? 2 : 0) |
        (o.contact ? 4 : 0) |
        (o.readonly ? 8 : 0) |
        (o.additionalNodes ? 16 : 0)
      ;(e.uint.encode(d, n),
        o.room && Ze.encode(d, o.room),
        o.identity && $e.encode(d, o.identity),
        o.contact && _e.encode(d, o.contact),
        o.readonly && ed.encode(d, o.readonly),
        o.additionalNodes && dd.encode(d, o.additionalNodes))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        room: 1 & o ? Ze.decode(d) : null,
        identity: 2 & o ? $e.decode(d) : null,
        contact: 4 & o ? _e.decode(d) : null,
        readonly: 8 & o ? ed.decode(d) : null,
        additionalNodes: 16 & o ? dd.decode(d) : null,
      }
    },
  },
  nd = oe,
  cd = {
    preencode(d, o) {
      ;(nd.preencode(d, o.header), e.buffer.preencode(d, o.blindRequest))
    },
    encode(d, o) {
      ;(nd.encode(d, o.header), e.buffer.encode(d, o.blindRequest))
    },
    decode: (d) => ({ header: nd.decode(d), blindRequest: e.buffer.decode(d) }),
  },
  rd = oe,
  td = {
    preencode(e, d) {
      ;(rd.preencode(e, d.header), e.end++, d.profile && Lp.preencode(e, d.profile))
    },
    encode(d, o) {
      const n = o.profile ? 1 : 0
      ;(rd.encode(d, o.header), e.uint.encode(d, n), o.profile && Lp.encode(d, o.profile))
    },
    decode: (d) => ({ header: rd.decode(d), profile: 1 & e.uint.decode(d) ? Lp.decode(d) : null }),
  },
  id = oe,
  ad = {
    preencode(d, o) {
      ;(id.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(id.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: id.decode(d), key: e.fixed32.decode(d) }),
  },
  sd = { preencode(e, d) {}, encode(e, d) {}, decode: (e) => ({}) },
  pd = sd,
  ud = qe,
  ld = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.deviceKey),
        e.fixed32.preencode(d, o.id),
        ud.preencode(d, o.request))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.deviceKey), e.fixed32.encode(d, o.id), ud.encode(d, o.request))
    },
    decode: (d) => ({
      deviceKey: e.fixed32.decode(d),
      id: e.fixed32.decode(d),
      request: ud.decode(d),
    }),
  },
  fd = oe,
  md = Le,
  yd = {
    preencode(d, o) {
      ;(fd.preencode(d, o.header),
        e.fixed32.preencode(d, o.deviceKey),
        d.end++,
        o.identity && md.preencode(d, o.identity))
    },
    encode(d, o) {
      const n = o.identity ? 1 : 0
      ;(fd.encode(d, o.header),
        e.fixed32.encode(d, o.deviceKey),
        e.uint.encode(d, n),
        o.identity && md.encode(d, o.identity))
    },
    decode: (d) => ({
      header: fd.decode(d),
      deviceKey: e.fixed32.decode(d),
      identity: 1 & e.uint.decode(d) ? md.decode(d) : null,
    }),
  },
  xd = oe,
  bd = {
    preencode(d, o) {
      ;(xd.preencode(d, o.header), e.fixed32.preencode(d, o.deviceKey))
    },
    encode(d, o) {
      ;(xd.encode(d, o.header), e.fixed32.encode(d, o.deviceKey))
    },
    decode: (d) => ({ header: xd.decode(d), deviceKey: e.fixed32.decode(d) }),
  },
  vd = e.frame(S),
  gd = me,
  kd = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), vd.preencode(d, o.status), gd.preencode(d, o.profile))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), vd.encode(d, o.status), gd.encode(d, o.profile))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), status: vd.decode(d), profile: gd.decode(d) }),
  },
  Kd = vd,
  hd = me,
  wd = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        Kd.preencode(d, o.status),
        hd.preencode(d, o.profile),
        d.end++,
        o.proofs && Ep.preencode(d, o.proofs))
    },
    encode(d, o) {
      const n = o.proofs ? 1 : 0
      ;(e.fixed32.encode(d, o.key),
        Kd.encode(d, o.status),
        hd.encode(d, o.profile),
        e.uint.encode(d, n),
        o.proofs && Ep.encode(d, o.proofs))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      status: Kd.decode(d),
      profile: hd.decode(d),
      proofs: 1 & e.uint.decode(d) ? Ep.decode(d) : null,
    }),
  },
  Pd = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        d.end++,
        o.profileAttestation && e.buffer.preencode(d, o.profileAttestation),
        o.latestReceipt && e.buffer.preencode(d, o.latestReceipt))
    },
    encode(d, o) {
      const n = (o.profileAttestation ? 1 : 0) | (o.latestReceipt ? 2 : 0)
      ;(e.fixed32.encode(d, o.key),
        e.uint.encode(d, n),
        o.profileAttestation && e.buffer.encode(d, o.profileAttestation),
        o.latestReceipt && e.buffer.encode(d, o.latestReceipt))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d)
      return {
        key: o,
        profileAttestation: 1 & n ? e.buffer.decode(d) : null,
        latestReceipt: 2 & n ? e.buffer.decode(d) : null,
      }
    },
  },
  Rd = oe,
  Td = Pe,
  qd = {
    preencode(e, d) {
      ;(Rd.preencode(e, d.header), Td.preencode(e, d.member))
    },
    encode(e, d) {
      ;(Rd.encode(e, d.header), Td.encode(e, d.member))
    },
    decode: (e) => ({ header: Rd.decode(e), member: Td.decode(e) }),
  },
  Ad = oe,
  Md = e.frame(C),
  Sd = {
    preencode(d, o) {
      ;(Ad.preencode(d, o.header),
        e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.key),
        Md.preencode(d, o.status))
    },
    encode(d, o) {
      ;(Ad.encode(d, o.header),
        e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.key),
        Md.encode(d, o.status))
    },
    decode: (d) => ({
      header: Ad.decode(d),
      memberKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: Md.decode(d),
    }),
  },
  Cd = oe,
  Id = {
    preencode(d, o) {
      ;(Cd.preencode(d, o.header), e.fixed32.preencode(d, o.key), d.end++)
    },
    encode(d, o) {
      const n = (o.isModerator ? 1 : 0) | (o.isAdmin ? 2 : 0)
      ;(Cd.encode(d, o.header), e.fixed32.encode(d, o.key), e.uint.encode(d, n))
    },
    decode(d) {
      const o = Cd.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return { header: o, key: n, isModerator: !!(1 & c), isAdmin: !!(2 & c) }
    },
  },
  Fd = oe,
  Dd = {
    preencode(d, o) {
      ;(Fd.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(Fd.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: Fd.decode(d), key: e.fixed32.decode(d) }),
  },
  jd = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), e.uint.preencode(d, o.mentions))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), e.uint.encode(d, o.mentions))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), mentions: e.uint.decode(d) }),
  },
  Ld = {
    preencode(d, o) {
      ;(d.end++, o.memberKey && e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      const n = o.memberKey ? 1 : 0
      ;(e.uint.encode(d, n), o.memberKey && e.fixed32.encode(d, o.memberKey))
    },
    decode: (d) => ({ memberKey: 1 & e.uint.decode(d) ? e.fixed32.decode(d) : null }),
  },
  Ed = Ld,
  Bd = Ld,
  Nd = {
    preencode(d, o) {
      ;(d.end++, o.from && e.string.preencode(d, o.from), o.to && e.string.preencode(d, o.to))
    },
    encode(d, o) {
      const n = (o.from ? 1 : 0) | (o.to ? 2 : 0)
      ;(e.uint.encode(d, n), o.from && e.string.encode(d, o.from), o.to && e.string.encode(d, o.to))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { from: 1 & o ? e.string.decode(d) : null, to: 2 & o ? e.string.decode(d) : null }
    },
  },
  Vd = e.frame(Ld),
  Ud = e.frame(Ed),
  Jd = e.frame(Nd),
  Od = e.frame(Bd),
  zd = {
    preencode(d, n) {
      const c =
        (n.memberJoined ? 1 : 0) |
        (n.memberLeft ? 2 : 0) |
        (n.titleChanged ? 4 : 0) |
        (n.callStarted ? 8 : 0) |
        (n.callHangup ? 16 : 0) |
        (n.callMissed ? 32 : 0) |
        (n.roomAvatarChanged ? 64 : 0) |
        (n.invitationCreated ? 128 : 0) |
        (n.memberRemoved ? 256 : 0) |
        (o >= 3 && n.locationShared ? 512 : 0)
      ;(e.uint.preencode(d, c),
        n.memberJoined && Vd.preencode(d, n.memberJoined),
        n.memberLeft && Ud.preencode(d, n.memberLeft),
        n.titleChanged && Jd.preencode(d, n.titleChanged),
        n.memberRemoved && Od.preencode(d, n.memberRemoved),
        o >= 3 && n.locationShared && Bp.preencode(d, n.locationShared))
    },
    encode(d, n) {
      const c =
        (n.memberJoined ? 1 : 0) |
        (n.memberLeft ? 2 : 0) |
        (n.titleChanged ? 4 : 0) |
        (n.callStarted ? 8 : 0) |
        (n.callHangup ? 16 : 0) |
        (n.callMissed ? 32 : 0) |
        (n.roomAvatarChanged ? 64 : 0) |
        (n.invitationCreated ? 128 : 0) |
        (n.memberRemoved ? 256 : 0) |
        (o >= 3 && n.locationShared ? 512 : 0)
      ;(e.uint.encode(d, c),
        n.memberJoined && Vd.encode(d, n.memberJoined),
        n.memberLeft && Ud.encode(d, n.memberLeft),
        n.titleChanged && Jd.encode(d, n.titleChanged),
        n.memberRemoved && Od.encode(d, n.memberRemoved),
        o >= 3 && n.locationShared && Bp.encode(d, n.locationShared))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        memberJoined: 1 & n ? Vd.decode(d) : null,
        memberLeft: 2 & n ? Ud.decode(d) : null,
        titleChanged: 4 & n ? Jd.decode(d) : null,
        callStarted: !!(8 & n),
        callHangup: !!(16 & n),
        callMissed: !!(32 & n),
        roomAvatarChanged: !!(64 & n),
        invitationCreated: !!(128 & n),
        memberRemoved: 256 & n ? Od.decode(d) : null,
        locationShared: o >= 3 && 512 & n ? Bp.decode(d) : null,
      }
    },
  },
  Wd = {
    preencode(e, d) {
      ;(e.end++, o >= 3 && d.locationShared && Np.preencode(e, d.locationShared))
    },
    encode(d, n) {
      const c =
        (n.callStarted ? 1 : 0) |
        (n.callHangup ? 2 : 0) |
        (n.callMissed ? 4 : 0) |
        (o >= 3 && n.locationShared ? 8 : 0)
      ;(e.uint.encode(d, c), o >= 3 && n.locationShared && Np.encode(d, n.locationShared))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        callStarted: !!(1 & n),
        callHangup: !!(2 & n),
        callMissed: !!(4 & n),
        locationShared: o >= 3 && 8 & n ? Np.decode(d) : null,
      }
    },
  },
  Hd = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.start), e.uint.preencode(d, o.length))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.start), e.uint.encode(d, o.length))
    },
    decode: (d) => ({ start: e.uint.decode(d), length: e.uint.decode(d) }),
  },
  Gd = e.frame(Hd),
  Qd = {
    preencode(d, o) {
      ;(Gd.preencode(d, o.range), e.string.preencode(d, o.content))
    },
    encode(d, o) {
      ;(Gd.encode(d, o.range), e.string.encode(d, o.content))
    },
    decode: (d) => ({ range: Gd.decode(d), content: e.string.decode(d) }),
  },
  Xd = Gd,
  Yd = {
    preencode(d, o) {
      ;(Xd.preencode(d, o.range), e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      ;(Xd.encode(d, o.range), e.fixed32.encode(d, o.memberKey))
    },
    decode: (d) => ({ range: Xd.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  Zd = Gd,
  $d = {
    preencode(d, o) {
      ;(Zd.preencode(d, o.range), Z.preencode(d, o.language), e.string.preencode(d, o.text))
    },
    encode(d, o) {
      ;(Zd.encode(d, o.range), Z.encode(d, o.language), e.string.encode(d, o.text))
    },
    decode: (d) => ({ range: Zd.decode(d), language: Z.decode(d), text: e.string.decode(d) }),
  },
  _d = K,
  eo = e.array(e.uint),
  oo = {
    preencode(d, o) {
      ;(d.end++,
        o.title && e.string.preencode(d, o.title),
        o.description && e.string.preencode(d, o.description),
        o.file && _d.preencode(d, o.file),
        o.files && eo.preencode(d, o.files))
    },
    encode(d, o) {
      const n = (o.title ? 1 : 0) | (o.description ? 2 : 0) | (o.file ? 4 : 0) | (o.files ? 8 : 0)
      ;(e.uint.encode(d, n),
        o.title && e.string.encode(d, o.title),
        o.description && e.string.encode(d, o.description),
        o.file && _d.encode(d, o.file),
        o.files && eo.encode(d, o.files))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        title: 1 & o ? e.string.decode(d) : null,
        description: 2 & o ? e.string.decode(d) : null,
        file: 4 & o ? _d.decode(d) : null,
        files: 8 & o ? eo.decode(d) : null,
      }
    },
  },
  no = Gd,
  co = e.frame(oo),
  ro = {
    preencode(d, o) {
      ;(no.preencode(d, o.range),
        e.string.preencode(d, o.url),
        d.end++,
        o.preview && co.preencode(d, o.preview))
    },
    encode(d, o) {
      const n = o.preview ? 1 : 0
      ;(no.encode(d, o.range),
        e.string.encode(d, o.url),
        e.uint.encode(d, n),
        o.preview && co.encode(d, o.preview))
    },
    decode: (d) => ({
      range: no.decode(d),
      url: e.string.decode(d),
      preview: 1 & e.uint.decode(d) ? co.decode(d) : null,
    }),
  },
  to = e.array(e.frame(Yd)),
  io = e.array(e.frame(ro)),
  ao = io,
  so = e.array(e.frame(Hd)),
  po = so,
  uo = so,
  lo = e.array(e.frame(Qd)),
  fo = so,
  mo = so,
  yo = e.array(e.frame($d)),
  xo = {
    preencode(d, o) {
      const n =
        (o.mention ? 1 : 0) |
        (o.httpLink ? 2 : 0) |
        (o.pearLink ? 4 : 0) |
        (o.bold ? 8 : 0) |
        (o.italic ? 16 : 0) |
        (o.code ? 32 : 0) |
        (o.emoji ? 64 : 0) |
        (o.codeBlock ? 128 : 0) |
        (o.strike ? 256 : 0) |
        (o.translation ? 512 : 0)
      ;(e.uint.preencode(d, n),
        o.mention && to.preencode(d, o.mention),
        o.httpLink && io.preencode(d, o.httpLink),
        o.pearLink && ao.preencode(d, o.pearLink),
        o.bold && so.preencode(d, o.bold),
        o.italic && po.preencode(d, o.italic),
        o.code && uo.preencode(d, o.code),
        o.emoji && lo.preencode(d, o.emoji),
        o.codeBlock && fo.preencode(d, o.codeBlock),
        o.strike && mo.preencode(d, o.strike),
        o.translation && yo.preencode(d, o.translation))
    },
    encode(d, o) {
      const n =
        (o.mention ? 1 : 0) |
        (o.httpLink ? 2 : 0) |
        (o.pearLink ? 4 : 0) |
        (o.bold ? 8 : 0) |
        (o.italic ? 16 : 0) |
        (o.code ? 32 : 0) |
        (o.emoji ? 64 : 0) |
        (o.codeBlock ? 128 : 0) |
        (o.strike ? 256 : 0) |
        (o.translation ? 512 : 0)
      ;(e.uint.encode(d, n),
        o.mention && to.encode(d, o.mention),
        o.httpLink && io.encode(d, o.httpLink),
        o.pearLink && ao.encode(d, o.pearLink),
        o.bold && so.encode(d, o.bold),
        o.italic && po.encode(d, o.italic),
        o.code && uo.encode(d, o.code),
        o.emoji && lo.encode(d, o.emoji),
        o.codeBlock && fo.encode(d, o.codeBlock),
        o.strike && mo.encode(d, o.strike),
        o.translation && yo.encode(d, o.translation))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        mention: 1 & o ? to.decode(d) : null,
        httpLink: 2 & o ? io.decode(d) : null,
        pearLink: 4 & o ? ao.decode(d) : null,
        bold: 8 & o ? so.decode(d) : null,
        italic: 16 & o ? po.decode(d) : null,
        code: 32 & o ? uo.decode(d) : null,
        emoji: 64 & o ? lo.decode(d) : null,
        codeBlock: 128 & o ? fo.decode(d) : null,
        strike: 256 & o ? mo.decode(d) : null,
        translation: 512 & o ? yo.decode(d) : null,
      }
    },
  },
  bo = e.array(e.frame(k)),
  vo = e.frame(xo),
  go = e.frame(Wd),
  ko = {
    preencode(d, o) {
      ;(d.end++,
        o.text && e.string.preencode(d, o.text),
        o.files && bo.preencode(d, o.files),
        o.display && vo.preencode(d, o.display),
        o.replyTo && c.preencode(d, o.replyTo),
        o.parent && c.preencode(d, o.parent),
        o.event && go.preencode(d, o.event))
    },
    encode(d, n) {
      const r =
        (n.text ? 1 : 0) |
        (n.files ? 2 : 0) |
        (n.display ? 4 : 0) |
        (n.replyTo ? 8 : 0) |
        (n.parent ? 16 : 0) |
        (n.event ? 32 : 0) |
        (o >= 3 && n.forwarded ? 64 : 0)
      ;(e.uint.encode(d, r),
        n.text && e.string.encode(d, n.text),
        n.files && bo.encode(d, n.files),
        n.display && vo.encode(d, n.display),
        n.replyTo && c.encode(d, n.replyTo),
        n.parent && c.encode(d, n.parent),
        n.event && go.encode(d, n.event))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        text: 1 & n ? e.string.decode(d) : null,
        files: 2 & n ? bo.decode(d) : null,
        display: 4 & n ? vo.decode(d) : null,
        replyTo: 8 & n ? c.decode(d) : null,
        parent: 16 & n ? c.decode(d) : null,
        event: 32 & n ? go.decode(d) : null,
        forwarded: o >= 3 && !!(64 & n),
      }
    },
  },
  Ko = eo,
  ho = vo,
  wo = {
    preencode(d, o) {
      ;(d.end++,
        o.text && e.string.preencode(d, o.text),
        o.files && Ko.preencode(d, o.files),
        o.display && ho.preencode(d, o.display),
        o.replyTo && c.preencode(d, o.replyTo),
        o.parent && c.preencode(d, o.parent))
    },
    encode(d, n) {
      const r =
        (n.text ? 1 : 0) |
        (n.files ? 2 : 0) |
        (n.display ? 4 : 0) |
        (n.replyTo ? 8 : 0) |
        (n.parent ? 16 : 0) |
        (o >= 3 && n.forwarded ? 32 : 0)
      ;(e.uint.encode(d, r),
        n.text && e.string.encode(d, n.text),
        n.files && Ko.encode(d, n.files),
        n.display && ho.encode(d, n.display),
        n.replyTo && c.encode(d, n.replyTo),
        n.parent && c.encode(d, n.parent))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        text: 1 & n ? e.string.decode(d) : null,
        files: 2 & n ? Ko.decode(d) : null,
        display: 4 & n ? ho.decode(d) : null,
        replyTo: 8 & n ? c.decode(d) : null,
        parent: 16 & n ? c.decode(d) : null,
        forwarded: o >= 3 && !!(32 & n),
      }
    },
  },
  Po = bo,
  Ro = vo,
  To = {
    preencode(d, o) {
      ;(d.end++,
        o.text && e.string.preencode(d, o.text),
        o.files && Po.preencode(d, o.files),
        o.display && Ro.preencode(d, o.display),
        o.replyTo && c.preencode(d, o.replyTo),
        o.parent && c.preencode(d, o.parent))
    },
    encode(d, n) {
      const r =
        (n.text ? 1 : 0) |
        (n.files ? 2 : 0) |
        (n.display ? 4 : 0) |
        (n.replyTo ? 8 : 0) |
        (n.parent ? 16 : 0) |
        (o >= 3 && n.forwarded ? 32 : 0)
      ;(e.uint.encode(d, r),
        n.text && e.string.encode(d, n.text),
        n.files && Po.encode(d, n.files),
        n.display && Ro.encode(d, n.display),
        n.replyTo && c.encode(d, n.replyTo),
        n.parent && c.encode(d, n.parent))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        text: 1 & n ? e.string.decode(d) : null,
        files: 2 & n ? Po.decode(d) : null,
        display: 4 & n ? Ro.decode(d) : null,
        replyTo: 8 & n ? c.decode(d) : null,
        parent: 16 & n ? c.decode(d) : null,
        forwarded: o >= 3 && !!(32 & n),
      }
    },
  },
  qo = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = (o.isEdited ? 1 : 0) | (o.isDeleted ? 2 : 0) | (o.isPinned ? 4 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { isEdited: !!(1 & o), isDeleted: !!(2 & o), isPinned: !!(4 & o) }
    },
  },
  Ao = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.thread), e.uint.preencode(d, o.index))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.thread), e.uint.encode(d, o.index))
    },
    decode: (d) => ({ thread: e.uint.decode(d), index: e.uint.decode(d) }),
  },
  Mo = e.frame(U),
  So = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.id),
        e.uint.preencode(d, o.count),
        d.end++,
        o.parent && c.preencode(d, o.parent),
        o.stats && Mo.preencode(d, o.stats))
    },
    encode(d, o) {
      const n = (o.parent ? 1 : 0) | (o.stats ? 2 : 0)
      ;(e.uint.encode(d, o.id),
        e.uint.encode(d, o.count),
        e.uint.encode(d, n),
        o.parent && c.encode(d, o.parent),
        o.stats && Mo.encode(d, o.stats))
    },
    decode(d) {
      const o = e.uint.decode(d),
        n = e.uint.decode(d),
        r = e.uint.decode(d)
      return {
        id: o,
        count: n,
        parent: 1 & r ? c.decode(d) : null,
        stats: 2 & r ? Mo.decode(d) : null,
      }
    },
  },
  Co = e.frame(qo),
  Io = e.frame(wo),
  Fo = e.frame(zd),
  Do = {
    preencode(d, o) {
      ;(Ao.preencode(d, o.id),
        c.preencode(d, o.oplog),
        e.uint.preencode(d, o.clock),
        e.uint.preencode(d, o.timestamp),
        d.end++,
        o.editedAt && e.uint.preencode(d, o.editedAt),
        Co.preencode(d, o.status),
        o.message && Io.preencode(d, o.message),
        o.event && Fo.preencode(d, o.event))
    },
    encode(d, o) {
      const n = (o.editedAt ? 1 : 0) | (o.message ? 2 : 0) | (o.event ? 4 : 0)
      ;(Ao.encode(d, o.id),
        c.encode(d, o.oplog),
        e.uint.encode(d, o.clock),
        e.uint.encode(d, o.timestamp),
        e.uint.encode(d, n),
        o.editedAt && e.uint.encode(d, o.editedAt),
        Co.encode(d, o.status),
        o.message && Io.encode(d, o.message),
        o.event && Fo.encode(d, o.event))
    },
    decode(d) {
      const o = Ao.decode(d),
        n = c.decode(d),
        r = e.uint.decode(d),
        t = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        id: o,
        oplog: n,
        clock: r,
        timestamp: t,
        editedAt: 1 & i ? e.uint.decode(d) : 0,
        status: Co.decode(d),
        message: 2 & i ? Io.decode(d) : null,
        event: 4 & i ? Fo.decode(d) : null,
      }
    },
  },
  jo = Co,
  Lo = e.frame(To),
  Eo = Fo,
  Bo = {
    preencode(d, o) {
      ;(Ao.preencode(d, o.id),
        c.preencode(d, o.oplog),
        e.uint.preencode(d, o.clock),
        e.uint.preencode(d, o.timestamp),
        d.end++,
        o.editedAt && e.uint.preencode(d, o.editedAt),
        jo.preencode(d, o.status),
        o.message && Lo.preencode(d, o.message),
        o.event && Eo.preencode(d, o.event))
    },
    encode(d, o) {
      const n = (o.editedAt ? 1 : 0) | (o.message ? 2 : 0) | (o.event ? 4 : 0)
      ;(Ao.encode(d, o.id),
        c.encode(d, o.oplog),
        e.uint.encode(d, o.clock),
        e.uint.encode(d, o.timestamp),
        e.uint.encode(d, n),
        o.editedAt && e.uint.encode(d, o.editedAt),
        jo.encode(d, o.status),
        o.message && Lo.encode(d, o.message),
        o.event && Eo.encode(d, o.event))
    },
    decode(d) {
      const o = Ao.decode(d),
        n = c.decode(d),
        r = e.uint.decode(d),
        t = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        id: o,
        oplog: n,
        clock: r,
        timestamp: t,
        editedAt: 1 & i ? e.uint.decode(d) : 0,
        status: jo.decode(d),
        message: 2 & i ? Lo.decode(d) : null,
        event: 4 & i ? Eo.decode(d) : null,
      }
    },
  },
  No = oe,
  Vo = e.frame(ko),
  Uo = {
    preencode(e, d) {
      ;(No.preencode(e, d.header), Vo.preencode(e, d.message))
    },
    encode(e, d) {
      ;(No.encode(e, d.header), Vo.encode(e, d.message))
    },
    decode: (e) => ({ header: No.decode(e), message: Vo.decode(e) }),
  },
  Jo = oe,
  Oo = {
    preencode(e, d) {
      ;(Jo.preencode(e, d.header), c.preencode(e, d.oplog))
    },
    encode(e, d) {
      ;(Jo.encode(e, d.header), c.encode(e, d.oplog))
    },
    decode: (e) => ({ header: Jo.decode(e), oplog: c.decode(e) }),
  },
  zo = oe,
  Wo = Vo,
  Ho = {
    preencode(e, d) {
      ;(zo.preencode(e, d.header), c.preencode(e, d.oplog), Wo.preencode(e, d.message))
    },
    encode(e, d) {
      ;(zo.encode(e, d.header), c.encode(e, d.oplog), Wo.encode(e, d.message))
    },
    decode: (e) => ({ header: zo.decode(e), oplog: c.decode(e), message: Wo.decode(e) }),
  },
  Go = oe,
  Qo = {
    preencode(e, d) {
      ;(Go.preencode(e, d.header), c.preencode(e, d.oplog), e.end++)
    },
    encode(d, o) {
      const n = o.isPinned ? 1 : 0
      ;(Go.encode(d, o.header), c.encode(d, o.oplog), e.uint.encode(d, n))
    },
    decode: (d) => ({
      header: Go.decode(d),
      oplog: c.decode(d),
      isPinned: !!(1 & e.uint.decode(d)),
    }),
  },
  Xo = { HttpLink: 1, PearLink: 2 },
  Yo = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 2) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  Zo = oe,
  $o = {
    preencode(d, o) {
      ;(Zo.preencode(d, o.header),
        c.preencode(d, o.oplog),
        e.uint.preencode(d, o.index),
        Vp.preencode(d, o.preview),
        d.end++,
        o.displayType && Yo.preencode(d, o.displayType))
    },
    encode(d, o) {
      const n = o.displayType ? 1 : 0
      ;(Zo.encode(d, o.header),
        c.encode(d, o.oplog),
        e.uint.encode(d, o.index),
        Vp.encode(d, o.preview),
        e.uint.encode(d, n),
        o.displayType && Yo.encode(d, o.displayType))
    },
    decode: (d) => ({
      header: Zo.decode(d),
      oplog: c.decode(d),
      index: e.uint.decode(d),
      preview: Vp.decode(d),
      displayType: 1 & e.uint.decode(d) ? Yo.decode(d) : 0,
    }),
  },
  _o = {
    preencode(d, o) {
      ;(Ao.preencode(d, o.id),
        e.fixed32.preencode(d, o.sender),
        e.uint.preencode(d, o.clock),
        e.string.preencode(d, o.reaction))
    },
    encode(d, o) {
      ;(Ao.encode(d, o.id),
        e.fixed32.encode(d, o.sender),
        e.uint.encode(d, o.clock),
        e.string.encode(d, o.reaction))
    },
    decode: (d) => ({
      id: Ao.decode(d),
      sender: e.fixed32.decode(d),
      clock: e.uint.decode(d),
      reaction: e.string.decode(d),
    }),
  },
  en = {
    preencode(d, o) {
      ;(e.string.preencode(d, o.text), e.uint.preencode(d, o.count))
    },
    encode(d, o) {
      ;(e.string.encode(d, o.text), e.uint.encode(d, o.count))
    },
    decode: (d) => ({ text: e.string.decode(d), count: e.uint.decode(d) }),
  },
  dn = e.array(e.frame(en)),
  on = {
    preencode(d, o) {
      ;(Ao.preencode(d, o.id),
        e.uint.preencode(d, o.total),
        dn.preencode(d, o.reactions),
        d.end++,
        o.editedAt && e.uint.preencode(d, o.editedAt))
    },
    encode(d, o) {
      const n = o.editedAt ? 1 : 0
      ;(Ao.encode(d, o.id),
        e.uint.encode(d, o.total),
        dn.encode(d, o.reactions),
        e.uint.encode(d, n),
        o.editedAt && e.uint.encode(d, o.editedAt))
    },
    decode: (d) => ({
      id: Ao.decode(d),
      total: e.uint.decode(d),
      reactions: dn.decode(d),
      editedAt: 1 & e.uint.decode(d) ? e.uint.decode(d) : 0,
    }),
  },
  nn = oe,
  cn = {
    preencode(d, o) {
      ;(nn.preencode(d, o.header), c.preencode(d, o.oplog), e.string.preencode(d, o.reaction))
    },
    encode(d, o) {
      ;(nn.encode(d, o.header), c.encode(d, o.oplog), e.string.encode(d, o.reaction))
    },
    decode: (d) => ({ header: nn.decode(d), oplog: c.decode(d), reaction: e.string.decode(d) }),
  },
  rn = oe,
  tn = {
    preencode(d, o) {
      ;(rn.preencode(d, o.header), c.preencode(d, o.oplog), e.string.preencode(d, o.reaction))
    },
    encode(d, o) {
      ;(rn.encode(d, o.header), c.encode(d, o.oplog), e.string.encode(d, o.reaction))
    },
    decode: (d) => ({ header: rn.decode(d), oplog: c.decode(d), reaction: e.string.decode(d) }),
  },
  an = oe,
  sn = e.frame(ee),
  pn = {
    preencode(d, o) {
      ;(an.preencode(d, o.header), e.uint.preencode(d, o.key), sn.preencode(d, o.config))
    },
    encode(d, o) {
      ;(an.encode(d, o.header), e.uint.encode(d, o.key), sn.encode(d, o.config))
    },
    decode: (d) => ({ header: an.decode(d), key: e.uint.decode(d), config: sn.decode(d) }),
  },
  un = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey),
        e.string.preencode(d, o.displayName),
        d.end++,
        o.avatar && Up.preencode(d, o.avatar))
    },
    encode(d, o) {
      const n = o.avatar ? 1 : 0
      ;(e.fixed32.encode(d, o.memberKey),
        e.string.encode(d, o.displayName),
        e.uint.encode(d, n),
        o.avatar && Up.encode(d, o.avatar))
    },
    decode: (d) => ({
      memberKey: e.fixed32.decode(d),
      displayName: e.string.decode(d),
      avatar: 1 & e.uint.decode(d) ? Up.decode(d) : null,
    }),
  },
  ln = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), d.end++, o.username && e.string.preencode(d, o.username))
    },
    encode(d, o) {
      const n = o.username ? 1 : 0
      ;(e.fixed32.encode(d, o.key),
        e.uint.encode(d, n),
        o.username && e.string.encode(d, o.username))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      username: 1 & e.uint.decode(d) ? e.string.decode(d) : null,
    }),
  },
  fn = e.frame(ln),
  mn = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey),
        d.end++,
        o.discoveryCoreKey && e.fixed32.preencode(d, o.discoveryCoreKey),
        o.userRegistry && fn.preencode(d, o.userRegistry))
    },
    encode(d, o) {
      const n = (o.discoveryCoreKey ? 1 : 0) | (o.userRegistry ? 2 : 0)
      ;(e.fixed32.encode(d, o.publicKey),
        e.uint.encode(d, n),
        o.discoveryCoreKey && e.fixed32.encode(d, o.discoveryCoreKey),
        o.userRegistry && fn.encode(d, o.userRegistry))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d)
      return {
        publicKey: o,
        discoveryCoreKey: 1 & n ? e.fixed32.decode(d) : null,
        userRegistry: 2 & n ? fn.decode(d) : null,
      }
    },
  },
  yn = oe,
  xn = e.frame(G),
  bn = e.frame(Q),
  vn = sn,
  gn = e.frame(mn),
  kn = we,
  Kn = e.array(e.frame(ye)),
  hn = {
    preencode(e, d) {
      ;(yn.preencode(e, d.header),
        xn.preencode(e, d.digest),
        bn.preencode(e, d.capabilities),
        e.end++,
        d.config && vn.preencode(e, d.config),
        d.identity && gn.preencode(e, d.identity),
        d.bootstrapDevice && kn.preencode(e, d.bootstrapDevice),
        d.initialMembers && Kn.preencode(e, d.initialMembers))
    },
    encode(d, o) {
      const n =
        (o.config ? 1 : 0) |
        (o.identity ? 2 : 0) |
        (o.bootstrapDevice ? 4 : 0) |
        (o.initialMembers ? 8 : 0)
      ;(yn.encode(d, o.header),
        xn.encode(d, o.digest),
        bn.encode(d, o.capabilities),
        e.uint.encode(d, n),
        o.config && vn.encode(d, o.config),
        o.identity && gn.encode(d, o.identity),
        o.bootstrapDevice && kn.encode(d, o.bootstrapDevice),
        o.initialMembers && Kn.encode(d, o.initialMembers))
    },
    decode(d) {
      const o = yn.decode(d),
        n = xn.decode(d),
        c = bn.decode(d),
        r = e.uint.decode(d)
      return {
        header: o,
        digest: n,
        capabilities: c,
        config: 1 & r ? vn.decode(d) : null,
        identity: 2 & r ? gn.decode(d) : null,
        bootstrapDevice: 4 & r ? kn.decode(d) : null,
        initialMembers: 8 & r ? Kn.decode(d) : null,
      }
    },
  },
  wn = oe,
  Pn = {
    preencode(d, o) {
      ;(wn.preencode(d, o.header), e.uint.preencode(d, o.version))
    },
    encode(d, o) {
      ;(wn.encode(d, o.header), e.uint.encode(d, o.version))
    },
    decode: (d) => ({ header: wn.decode(d), version: e.uint.decode(d) }),
  },
  Rn = oe,
  Tn = {
    preencode(d, o) {
      ;(Rn.preencode(d, o.header), e.uint.preencode(d, o.from), e.uint.preencode(d, o.to))
    },
    encode(d, o) {
      ;(Rn.encode(d, o.header), e.uint.encode(d, o.from), e.uint.encode(d, o.to))
    },
    decode: (d) => ({ header: Rn.decode(d), from: e.uint.decode(d), to: e.uint.decode(d) }),
  },
  qn = {
    RoomType: 1,
    IsExperimental: 2,
    IsJoiningDisabled: 3,
    IsAppendingDisabled: 4,
    IsCallingDisabled: 5,
    IsMembershipEventsDisabled: 6,
  },
  An = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 6) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  Mn = oe,
  Sn = H,
  Cn = {
    preencode(d, o) {
      ;(Mn.preencode(d, o.header), e.uint.preencode(d, o.key), Sn.preencode(d, o.settings))
    },
    encode(d, o) {
      ;(Mn.encode(d, o.header), e.uint.encode(d, o.key), Sn.encode(d, o.settings))
    },
    decode: (d) => ({ header: Mn.decode(d), key: e.uint.decode(d), settings: Sn.decode(d) }),
  },
  In = oe,
  Fn = {
    preencode(d, o) {
      ;(In.preencode(d, o.header), e.uint.preencode(d, o.value))
    },
    encode(d, o) {
      ;(In.encode(d, o.header), e.uint.encode(d, o.value))
    },
    decode: (d) => ({ header: In.decode(d), value: e.uint.decode(d) }),
  },
  Dn = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.key), e.uint.preencode(d, o.value))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.key), e.uint.encode(d, o.value))
    },
    decode: (d) => ({ key: e.uint.decode(d), value: e.uint.decode(d) }),
  },
  jn = { Flag: 1 },
  Ln = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 1) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  En = {
    preencode(d, o) {
      ;(Ao.preencode(d, o.id),
        e.fixed32.preencode(d, o.sender),
        e.uint.preencode(d, o.clock),
        Ln.preencode(d, o.label))
    },
    encode(d, o) {
      ;(Ao.encode(d, o.id),
        e.fixed32.encode(d, o.sender),
        e.uint.encode(d, o.clock),
        Ln.encode(d, o.label))
    },
    decode: (d) => ({
      id: Ao.decode(d),
      sender: e.fixed32.decode(d),
      clock: e.uint.decode(d),
      label: Ln.decode(d),
    }),
  },
  Bn = oe,
  Nn = {
    preencode(e, d) {
      ;(Bn.preencode(e, d.header), c.preencode(e, d.oplog), Ln.preencode(e, d.label))
    },
    encode(e, d) {
      ;(Bn.encode(e, d.header), c.encode(e, d.oplog), Ln.encode(e, d.label))
    },
    decode: (e) => ({ header: Bn.decode(e), oplog: c.decode(e), label: Ln.decode(e) }),
  },
  Vn = oe,
  Un = {
    preencode(e, d) {
      ;(Vn.preencode(e, d.header), c.preencode(e, d.oplog), Ln.preencode(e, d.label))
    },
    encode(e, d) {
      ;(Vn.encode(e, d.header), c.encode(e, d.oplog), Ln.encode(e, d.label))
    },
    decode: (e) => ({ header: Vn.decode(e), oplog: c.decode(e), label: Ln.decode(e) }),
  },
  Jn = {
    preencode(d, o) {
      ;(Ln.preencode(d, o.label), e.uint.preencode(d, o.count))
    },
    encode(d, o) {
      ;(Ln.encode(d, o.label), e.uint.encode(d, o.count))
    },
    decode: (d) => ({ label: Ln.decode(d), count: e.uint.decode(d) }),
  },
  On = e.array(e.frame(Jn)),
  zn = {
    preencode(d, o) {
      ;(Ao.preencode(d, o.id),
        e.uint.preencode(d, o.total),
        On.preencode(d, o.labels),
        e.uint.preencode(d, o.editedAt),
        d.end++,
        o.flagsClock && e.uint.preencode(d, o.flagsClock),
        o.version && e.uint.preencode(d, o.version))
    },
    encode(d, o) {
      const n = (o.flagsClock ? 1 : 0) | (o.version ? 2 : 0) | (o.isDeleted ? 4 : 0)
      ;(Ao.encode(d, o.id),
        e.uint.encode(d, o.total),
        On.encode(d, o.labels),
        e.uint.encode(d, o.editedAt),
        e.uint.encode(d, n),
        o.flagsClock && e.uint.encode(d, o.flagsClock),
        o.version && e.uint.encode(d, o.version))
    },
    decode(d) {
      const o = Ao.decode(d),
        n = e.uint.decode(d),
        c = On.decode(d),
        r = e.uint.decode(d),
        t = e.uint.decode(d)
      return {
        id: o,
        total: n,
        labels: c,
        editedAt: r,
        flagsClock: 1 & t ? e.uint.decode(d) : 0,
        version: 2 & t ? e.uint.decode(d) : 0,
        isDeleted: !!(4 & t),
      }
    },
  },
  Wn = oe,
  Hn = {
    preencode(d, o) {
      ;(Wn.preencode(d, o.header), e.uint.preencode(d, o.length))
    },
    encode(d, o) {
      ;(Wn.encode(d, o.header), e.uint.encode(d, o.length))
    },
    decode: (d) => ({ header: Wn.decode(d), length: e.uint.decode(d) }),
  },
  Gn = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey), e.uint.preencode(d, o.length))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.memberKey), e.uint.encode(d, o.length))
    },
    decode: (d) => ({ memberKey: e.fixed32.decode(d), length: e.uint.decode(d) }),
  },
  Qn = de,
  Xn = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey),
        Jp.preencode(d, o.status),
        d.end++,
        o.mailbox && e.fixed32.preencode(d, o.mailbox),
        o.roomKey && e.fixed32.preencode(d, o.roomKey))
    },
    encode(d, o) {
      const n = (o.mailbox ? 1 : 0) | (o.roomKey ? 2 : 0)
      ;(e.fixed32.encode(d, o.memberKey),
        Jp.encode(d, o.status),
        e.uint.encode(d, n),
        o.mailbox && e.fixed32.encode(d, o.mailbox),
        o.roomKey && e.fixed32.encode(d, o.roomKey))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = Jp.decode(d),
        c = e.uint.decode(d)
      return {
        memberKey: o,
        status: n,
        mailbox: 1 & c ? e.fixed32.decode(d) : null,
        roomKey: 2 & c ? e.fixed32.decode(d) : null,
      }
    },
  },
  Yn = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.buffer.preencode(d, o.encryptionKey),
        e.fixed32.preencode(d, o.seed),
        n.preencode(d, o.initiator),
        e.fixed32.preencode(d, o.fastForwardTo))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.roomKey),
        e.buffer.encode(d, o.encryptionKey),
        e.fixed32.encode(d, o.seed),
        n.encode(d, o.initiator),
        e.fixed32.encode(d, o.fastForwardTo))
    },
    decode: (d) => ({
      roomKey: e.fixed32.decode(d),
      encryptionKey: e.buffer.decode(d),
      seed: e.fixed32.decode(d),
      initiator: n.decode(d),
      fastForwardTo: e.fixed32.decode(d),
    }),
  },
  Zn = e.array(e.frame(Yn)),
  $n = _,
  _n = {
    preencode(e, d) {
      ;(Zn.preencode(e, d.sharedRooms), $n.preencode(e, d.blockedContacts))
    },
    encode(e, d) {
      ;(Zn.encode(e, d.sharedRooms), $n.encode(e, d.blockedContacts))
    },
    decode: (e) => ({ sharedRooms: Zn.decode(e), blockedContacts: $n.decode(e) }),
  },
  ec = gn,
  dc = {
    preencode(e, d) {
      ec.preencode(e, d.identity)
    },
    encode(e, d) {
      ec.encode(e, d.identity)
    },
    decode: (e) => ({ identity: ec.decode(e) }),
  },
  oc = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.rooms), e.uint.preencode(d, o.contacts))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.rooms), e.uint.encode(d, o.contacts))
    },
    decode: (d) => ({ rooms: e.uint.decode(d), contacts: e.uint.decode(d) }),
  },
  nc = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.rooms), e.uint.preencode(d, o.contactRequests))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.rooms), e.uint.encode(d, o.contactRequests))
    },
    decode: (d) => ({ rooms: e.uint.decode(d), contactRequests: e.uint.decode(d) }),
  },
  cc = {
    preencode(d, o) {
      e.buffer.preencode(d, o.entropy)
    },
    encode(d, o) {
      e.buffer.encode(d, o.entropy)
    },
    decode: (d) => ({ entropy: e.buffer.decode(d) }),
  },
  rc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey),
        e.fixed32.preencode(d, o.devicePublicKey),
        e.fixed32.preencode(d, o.writerKey))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.publicKey),
        e.fixed32.encode(d, o.devicePublicKey),
        e.fixed32.encode(d, o.writerKey))
    },
    decode: (d) => ({
      publicKey: e.fixed32.decode(d),
      devicePublicKey: e.fixed32.decode(d),
      writerKey: e.fixed32.decode(d),
    }),
  },
  tc = e.frame(rc),
  ic = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id),
        e.fixed32.preencode(d, o.invitationSeed),
        e.fixed32.preencode(d, o.mailbox),
        t.preencode(d, o.responseKeyPair),
        n.preencode(d, o.initiator),
        n.preencode(d, o.inviter),
        d.end++,
        o.identity && tc.preencode(d, o.identity))
    },
    encode(d, o) {
      const c = o.identity ? 1 : 0
      ;(e.fixed32.encode(d, o.id),
        e.fixed32.encode(d, o.invitationSeed),
        e.fixed32.encode(d, o.mailbox),
        t.encode(d, o.responseKeyPair),
        n.encode(d, o.initiator),
        n.encode(d, o.inviter),
        e.uint.encode(d, c),
        o.identity && tc.encode(d, o.identity))
    },
    decode: (d) => ({
      id: e.fixed32.decode(d),
      invitationSeed: e.fixed32.decode(d),
      mailbox: e.fixed32.decode(d),
      responseKeyPair: t.decode(d),
      initiator: n.decode(d),
      inviter: n.decode(d),
      identity: 1 & e.uint.decode(d) ? tc.decode(d) : null,
    }),
  },
  ac = oe,
  sc = {
    preencode(d, o) {
      ;(ac.preencode(d, o.header), e.buffer.preencode(d, o.blindResponse))
    },
    encode(d, o) {
      ;(ac.encode(d, o.header), e.buffer.encode(d, o.blindResponse))
    },
    decode: (d) => ({ header: ac.decode(d), blindResponse: e.buffer.decode(d) }),
  },
  pc = oe,
  uc = e.frame(ic),
  lc = {
    preencode(e, d) {
      ;(pc.preencode(e, d.header), uc.preencode(e, d.invitation))
    },
    encode(e, d) {
      ;(pc.encode(e, d.header), uc.encode(e, d.invitation))
    },
    decode: (e) => ({ header: pc.decode(e), invitation: uc.decode(e) }),
  },
  fc = oe,
  mc = {
    preencode(d, o) {
      ;(fc.preencode(d, o.header), e.fixed32.preencode(d, o.id))
    },
    encode(d, o) {
      ;(fc.encode(d, o.header), e.fixed32.encode(d, o.id))
    },
    decode: (d) => ({ header: fc.decode(d), id: e.fixed32.decode(d) }),
  },
  yc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey),
        e.fixed32.preencode(d, o.devicePublicKey),
        d.end++,
        o.privateProfileKey && e.fixed32.preencode(d, o.privateProfileKey),
        o.deviceKeyPair && t.preencode(d, o.deviceKeyPair),
        e.buffer.preencode(d, o.deviceProof))
    },
    encode(d, o) {
      const n = (o.privateProfileKey ? 1 : 0) | (o.deviceKeyPair ? 2 : 0)
      ;(e.fixed32.encode(d, o.publicKey),
        e.fixed32.encode(d, o.devicePublicKey),
        e.uint.encode(d, n),
        o.privateProfileKey && e.fixed32.encode(d, o.privateProfileKey),
        o.deviceKeyPair && t.encode(d, o.deviceKeyPair),
        e.buffer.encode(d, o.deviceProof))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        publicKey: o,
        devicePublicKey: n,
        privateProfileKey: 1 & c ? e.fixed32.decode(d) : null,
        deviceKeyPair: 2 & c ? t.decode(d) : null,
        deviceProof: e.buffer.decode(d),
      }
    },
  },
  xc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey),
        e.fixed32.preencode(d, o.writerKey),
        e.fixed32.preencode(d, o.devicePublicKey),
        d.end++,
        o.privateProfileKey && e.fixed32.preencode(d, o.privateProfileKey))
    },
    encode(d, o) {
      const n = o.privateProfileKey ? 1 : 0
      ;(e.fixed32.encode(d, o.publicKey),
        e.fixed32.encode(d, o.writerKey),
        e.fixed32.encode(d, o.devicePublicKey),
        e.uint.encode(d, n),
        o.privateProfileKey && e.fixed32.encode(d, o.privateProfileKey))
    },
    decode: (d) => ({
      publicKey: e.fixed32.decode(d),
      writerKey: e.fixed32.decode(d),
      devicePublicKey: e.fixed32.decode(d),
      privateProfileKey: 1 & e.uint.decode(d) ? e.fixed32.decode(d) : null,
    }),
  },
  bc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      const c =
        (n.isActive ? 1 : 0) |
        (n.isFullyMuted ? 2 : 0) |
        (n.isMentionsOnlyMuted ? 4 : 0) |
        (n.isReadOnly ? 8 : 0) |
        (o >= 3 && n.isFavorite ? 16 : 0)
      e.uint.encode(d, c)
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        isActive: !!(1 & n),
        isFullyMuted: !!(2 & n),
        isMentionsOnlyMuted: !!(4 & n),
        isReadOnly: !!(8 & n),
        isFavorite: o >= 3 && !!(16 & n),
      }
    },
  },
  vc = e.frame(bc),
  gc = e.frame(yc),
  kc = tc,
  Kc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.buffer.preencode(d, o.encryptionKey),
        e.fixed32.preencode(d, o.mailbox),
        vc.preencode(d, o.status),
        e.uint.preencode(d, o.clock),
        d.end++,
        o.initiator && n.preencode(d, o.initiator),
        o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo),
        o.identitySwap && gc.preencode(d, o.identitySwap),
        o.identitySwapV2 && kc.preencode(d, o.identitySwapV2),
        o.contact && e.fixed32.preencode(d, o.contact))
    },
    encode(d, o) {
      const c =
        (o.initiator ? 1 : 0) |
        (o.fastForwardTo ? 2 : 0) |
        (o.identitySwap ? 4 : 0) |
        (o.identitySwapV2 ? 8 : 0) |
        (o.contact ? 16 : 0)
      ;(e.fixed32.encode(d, o.roomKey),
        e.buffer.encode(d, o.encryptionKey),
        e.fixed32.encode(d, o.mailbox),
        vc.encode(d, o.status),
        e.uint.encode(d, o.clock),
        e.uint.encode(d, c),
        o.initiator && n.encode(d, o.initiator),
        o.fastForwardTo && e.fixed32.encode(d, o.fastForwardTo),
        o.identitySwap && gc.encode(d, o.identitySwap),
        o.identitySwapV2 && kc.encode(d, o.identitySwapV2),
        o.contact && e.fixed32.encode(d, o.contact))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.buffer.decode(d),
        r = e.fixed32.decode(d),
        t = vc.decode(d),
        i = e.uint.decode(d),
        a = e.uint.decode(d)
      return {
        roomKey: o,
        encryptionKey: c,
        mailbox: r,
        status: t,
        clock: i,
        initiator: 1 & a ? n.decode(d) : null,
        fastForwardTo: 2 & a ? e.fixed32.decode(d) : null,
        identitySwap: 4 & a ? gc.decode(d) : null,
        identitySwapV2: 8 & a ? kc.decode(d) : null,
        contact: 16 & a ? e.fixed32.decode(d) : null,
      }
    },
  },
  hc = oe,
  wc = {
    preencode(d, o) {
      ;(hc.preencode(d, o.header),
        e.fixed32.preencode(d, o.roomKey),
        e.buffer.preencode(d, o.encryptionKey),
        e.fixed32.preencode(d, o.mailbox),
        d.end++,
        o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo),
        o.initiator && n.preencode(d, o.initiator),
        o.dm && e.fixed32.preencode(d, o.dm))
    },
    encode(d, o) {
      const c =
        (o.fastForwardTo ? 1 : 0) | (o.initiator ? 2 : 0) | (o.dm ? 4 : 0) | (o.isReadOnly ? 8 : 0)
      ;(hc.encode(d, o.header),
        e.fixed32.encode(d, o.roomKey),
        e.buffer.encode(d, o.encryptionKey),
        e.fixed32.encode(d, o.mailbox),
        e.uint.encode(d, c),
        o.fastForwardTo && e.fixed32.encode(d, o.fastForwardTo),
        o.initiator && n.encode(d, o.initiator),
        o.dm && e.fixed32.encode(d, o.dm))
    },
    decode(d) {
      const o = hc.decode(d),
        c = e.fixed32.decode(d),
        r = e.buffer.decode(d),
        t = e.fixed32.decode(d),
        i = e.uint.decode(d)
      return {
        header: o,
        roomKey: c,
        encryptionKey: r,
        mailbox: t,
        fastForwardTo: 1 & i ? e.fixed32.decode(d) : null,
        initiator: 2 & i ? n.decode(d) : null,
        dm: 4 & i ? e.fixed32.decode(d) : null,
        isReadOnly: !!(8 & i),
      }
    },
  },
  Pc = oe,
  Rc = {
    preencode(d, o) {
      ;(Pc.preencode(d, o.header), e.fixed32.preencode(d, o.discoveryKey))
    },
    encode(d, o) {
      ;(Pc.encode(d, o.header), e.fixed32.encode(d, o.discoveryKey))
    },
    decode: (d) => ({ header: Pc.decode(d), discoveryKey: e.fixed32.decode(d) }),
  },
  Tc = oe,
  qc = vc,
  Ac = {
    preencode(d, o) {
      ;(Tc.preencode(d, o.header),
        e.fixed32.preencode(d, o.roomKey),
        e.uint.preencode(d, o.key),
        qc.preencode(d, o.status))
    },
    encode(d, o) {
      ;(Tc.encode(d, o.header),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, o.key),
        qc.encode(d, o.status))
    },
    decode: (d) => ({
      header: Tc.decode(d),
      roomKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: qc.decode(d),
    }),
  },
  Mc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = o.isBlocked ? 1 : 0
      e.uint.encode(d, n)
    },
    decode: (d) => ({ isBlocked: !!(1 & e.uint.decode(d)) }),
  },
  Sc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.clock),
        Op.preencode(d, o.status),
        d.end++,
        o.mailbox && e.fixed32.preencode(d, o.mailbox),
        o.roomKey && e.fixed32.preencode(d, o.roomKey))
    },
    encode(d, o) {
      const n = (o.mailbox ? 1 : 0) | (o.roomKey ? 2 : 0)
      ;(e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.clock),
        Op.encode(d, o.status),
        e.uint.encode(d, n),
        o.mailbox && e.fixed32.encode(d, o.mailbox),
        o.roomKey && e.fixed32.encode(d, o.roomKey))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d),
        c = Op.decode(d),
        r = e.uint.decode(d)
      return {
        memberKey: o,
        clock: n,
        status: c,
        mailbox: 1 & r ? e.fixed32.decode(d) : null,
        roomKey: 2 & r ? e.fixed32.decode(d) : null,
      }
    },
  },
  Cc = oe,
  Ic = e.frame(Xn),
  Fc = {
    preencode(e, d) {
      ;(Cc.preencode(e, d.header), Ic.preencode(e, d.contact))
    },
    encode(e, d) {
      ;(Cc.encode(e, d.header), Ic.encode(e, d.contact))
    },
    decode: (e) => ({ header: Cc.decode(e), contact: Ic.decode(e) }),
  },
  Dc = oe,
  jc = {
    preencode(d, o) {
      ;(Dc.preencode(d, o.header),
        e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.key),
        zp.preencode(d, o.status))
    },
    encode(d, o) {
      ;(Dc.encode(d, o.header),
        e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.key),
        zp.encode(d, o.status))
    },
    decode: (d) => ({
      header: Dc.decode(d),
      memberKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: zp.decode(d),
    }),
  },
  Lc = oe,
  Ec = {
    preencode(d, o) {
      ;(Lc.preencode(d, o.header), e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      ;(Lc.encode(d, o.header), e.fixed32.encode(d, o.memberKey))
    },
    decode: (d) => ({ header: Lc.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  Bc = oe,
  Nc = {
    preencode(d, o) {
      ;(Bc.preencode(d, o.header), e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      ;(Bc.encode(d, o.header), e.fixed32.encode(d, o.memberKey))
    },
    decode: (d) => ({ header: Bc.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  Vc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n =
        (o.isPending ? 1 : 0) |
        (o.isAccepted ? 2 : 0) |
        (o.isRejected ? 4 : 0) |
        (o.isDiscarded ? 8 : 0) |
        (o.isSeen ? 16 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        isPending: !!(1 & o),
        isAccepted: !!(2 & o),
        isRejected: !!(4 & o),
        isDiscarded: !!(8 & o),
        isSeen: !!(16 & o),
      }
    },
  },
  Uc = Pe,
  Jc = e.frame(i),
  Oc = {
    preencode(d, o) {
      ;(Uc.preencode(d, o.sender),
        Jc.preencode(d, o.keys),
        e.fixed32.preencode(d, o.mailbox),
        d.end++,
        o.message && e.string.preencode(d, o.message))
    },
    encode(d, o) {
      const n = o.message ? 1 : 0
      ;(Uc.encode(d, o.sender),
        Jc.encode(d, o.keys),
        e.fixed32.encode(d, o.mailbox),
        e.uint.encode(d, n),
        o.message && e.string.encode(d, o.message))
    },
    decode: (d) => ({
      sender: Uc.decode(d),
      keys: Jc.decode(d),
      mailbox: e.fixed32.decode(d),
      message: 1 & e.uint.decode(d) ? e.string.decode(d) : null,
    }),
  },
  zc = e.frame(Oc),
  Wc = {
    preencode(e, d) {
      ;(zc.preencode(e, d.body), ie.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(zc.encode(e, d.body), ie.encode(e, d.attestation))
    },
    decode: (e) => ({ body: zc.decode(e), attestation: ie.decode(e) }),
  },
  Hc = me,
  Gc = e.frame(Vc),
  Qc = Jc,
  Xc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.clock),
        Hc.preencode(d, o.sender),
        Gc.preencode(d, o.status),
        Qc.preencode(d, o.keys),
        e.fixed32.preencode(d, o.mailbox),
        d.end++,
        o.message && e.string.preencode(d, o.message),
        o.sentAt && e.uint.preencode(d, o.sentAt))
    },
    encode(d, o) {
      const n = (o.message ? 1 : 0) | (o.sentAt ? 2 : 0)
      ;(e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.clock),
        Hc.encode(d, o.sender),
        Gc.encode(d, o.status),
        Qc.encode(d, o.keys),
        e.fixed32.encode(d, o.mailbox),
        e.uint.encode(d, n),
        o.message && e.string.encode(d, o.message),
        o.sentAt && e.uint.encode(d, o.sentAt))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d),
        c = Hc.decode(d),
        r = Gc.decode(d),
        t = Qc.decode(d),
        i = e.fixed32.decode(d),
        a = e.uint.decode(d)
      return {
        memberKey: o,
        clock: n,
        sender: c,
        status: r,
        keys: t,
        mailbox: i,
        message: 1 & a ? e.string.decode(d) : null,
        sentAt: 2 & a ? e.uint.decode(d) : 0,
      }
    },
  },
  Yc = oe,
  Zc = {
    preencode(d, o) {
      ;(Yc.preencode(d, o.header), e.buffer.preencode(d, o.blindRequest))
    },
    encode(d, o) {
      ;(Yc.encode(d, o.header), e.buffer.encode(d, o.blindRequest))
    },
    decode: (d) => ({ header: Yc.decode(d), blindRequest: e.buffer.decode(d) }),
  },
  $c = oe,
  _c = Gc,
  er = {
    preencode(d, o) {
      ;($c.preencode(d, o.header),
        e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.key),
        _c.preencode(d, o.status),
        d.end++,
        o.roomKey && e.fixed32.preencode(d, o.roomKey))
    },
    encode(d, o) {
      const n = o.roomKey ? 1 : 0
      ;($c.encode(d, o.header),
        e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.key),
        _c.encode(d, o.status),
        e.uint.encode(d, n),
        o.roomKey && e.fixed32.encode(d, o.roomKey))
    },
    decode: (d) => ({
      header: $c.decode(d),
      memberKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: _c.decode(d),
      roomKey: 1 & e.uint.decode(d) ? e.fixed32.decode(d) : null,
    }),
  },
  dr = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.timestamp),
        e.fixed32.preencode(d, o.key),
        e.fixed32.preencode(d, o.mailbox))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.timestamp), e.fixed32.encode(d, o.key), e.fixed32.encode(d, o.mailbox))
    },
    decode: (d) => ({
      version: e.uint.decode(d),
      timestamp: e.uint.decode(d),
      key: e.fixed32.decode(d),
      mailbox: e.fixed32.decode(d),
    }),
  },
  or = {
    preencode(d, o) {
      switch ((e.uint.preencode(d, o.version), o.version)) {
        case 0:
        case 1:
          dr.preencode(d, o)
          break
        default:
          throw new Error("Unsupported version")
      }
    },
    encode(d, o) {
      switch ((e.uint.encode(d, o.version), o.version)) {
        case 0:
        case 1:
          dr.encode(d, o)
          break
        default:
          throw new Error("Unsupported version")
      }
    },
    decode(d) {
      const o = d.start,
        n = e.uint.decode(d)
      switch (((d.start = o), n)) {
        case 0:
        case 1:
          return dr.decode(d)
        default:
          throw new Error("Unsupported version")
      }
    },
  },
  nr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.deviceKey), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.deviceKey), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ deviceKey: e.fixed32.decode(d), key: e.fixed32.decode(d) }),
  },
  cr = oe,
  rr = {
    preencode(d, o) {
      ;(cr.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(cr.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: cr.decode(d), key: e.fixed32.decode(d) }),
  },
  tr = oe,
  ir = {
    preencode(d, o) {
      ;(tr.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(tr.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: tr.decode(d), key: e.fixed32.decode(d) }),
  },
  ar = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = o.disableReadReceipts ? 1 : 0
      e.uint.encode(d, n)
    },
    decode: (d) => ({ disableReadReceipts: !!(1 & e.uint.decode(d)) }),
  },
  sr = { disableReadReceipts: "disableReadReceipts" },
  pr = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if ("disableReadReceipts" !== o) throw new Error("Unknown enum")
      e.uint.encode(d, 1)
    },
    decode: (d) => (1 === e.uint.decode(d) ? "disableReadReceipts" : null),
  },
  ur = oe,
  lr = e.frame(ar),
  fr = {
    preencode(e, d) {
      ;(ur.preencode(e, d.header), pr.preencode(e, d.key), lr.preencode(e, d.settings))
    },
    encode(e, d) {
      ;(ur.encode(e, d.header), pr.encode(e, d.key), lr.encode(e, d.settings))
    },
    decode: (e) => ({ header: ur.decode(e), key: pr.decode(e), settings: lr.decode(e) }),
  },
  mr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.discoveryPublicKey),
        e.uint.preencode(d, o.timestamp),
        d.end++,
        o.lastSynced && e.uint.preencode(d, o.lastSynced))
    },
    encode(d, o) {
      const n = (o.lastSynced ? 1 : 0) | (o.dirty ? 2 : 0)
      ;(e.fixed32.encode(d, o.discoveryPublicKey),
        e.uint.encode(d, o.timestamp),
        e.uint.encode(d, n),
        o.lastSynced && e.uint.encode(d, o.lastSynced))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d),
        c = e.uint.decode(d)
      return {
        discoveryPublicKey: o,
        timestamp: n,
        lastSynced: 1 & c ? e.uint.decode(d) : 0,
        dirty: !!(2 & c),
      }
    },
  },
  yr = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.rooms), e.uint.preencode(d, o.activeRooms))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.rooms), e.uint.encode(d, o.activeRooms))
    },
    decode: (d) => ({ rooms: e.uint.decode(d), activeRooms: e.uint.decode(d) }),
  },
  xr = I,
  br = _,
  vr = {
    preencode(e, d) {
      ;(e.end++, d.blockedMembers && br.preencode(e, d.blockedMembers))
    },
    encode(d, o) {
      const n = o.blockedMembers ? 1 : 0
      ;(e.uint.encode(d, n), o.blockedMembers && br.encode(d, o.blockedMembers))
    },
    decode: (d) => ({ blockedMembers: 1 & e.uint.decode(d) ? br.decode(d) : null }),
  },
  gr = e.frame(X),
  kr = e.frame(vr),
  Kr = {
    preencode(d, o) {
      ;(e.buffer.preencode(d, o.encryptionKey),
        e.fixed32.preencode(d, o.seed),
        gr.preencode(d, o.capabilities),
        n.preencode(d, o.initiator),
        e.fixed32.preencode(d, o.fastForwardTo),
        d.end++,
        o.privateProfile && kr.preencode(d, o.privateProfile))
    },
    encode(d, o) {
      const c = o.privateProfile ? 1 : 0
      ;(e.buffer.encode(d, o.encryptionKey),
        e.fixed32.encode(d, o.seed),
        gr.encode(d, o.capabilities),
        n.encode(d, o.initiator),
        e.fixed32.encode(d, o.fastForwardTo),
        e.uint.encode(d, c),
        o.privateProfile && kr.encode(d, o.privateProfile))
    },
    decode: (d) => ({
      encryptionKey: e.buffer.decode(d),
      seed: e.fixed32.decode(d),
      capabilities: gr.decode(d),
      initiator: n.decode(d),
      fastForwardTo: e.fixed32.decode(d),
      privateProfile: 1 & e.uint.decode(d) ? kr.decode(d) : null,
    }),
  },
  hr = {
    preencode(d, o) {
      ;(d.end++, o.count && e.uint.preencode(d, o.count))
    },
    encode(d, o) {
      const n = o.count ? 1 : 0
      ;(e.uint.encode(d, n), o.count && e.uint.encode(d, o.count))
    },
    decode: (d) => ({ count: 1 & e.uint.decode(d) ? e.uint.decode(d) : 0 }),
  },
  wr = e.frame(Kr),
  Pr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.uint.preencode(d, o.priority),
        d.end++,
        o.v3 && wr.preencode(d, o.v3),
        o.timestamp && e.uint.preencode(d, o.timestamp))
    },
    encode(d, o) {
      const n = (o.v3 ? 1 : 0) | (o.errored ? 2 : 0) | (o.timestamp ? 4 : 0)
      ;(e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, o.priority),
        e.uint.encode(d, n),
        o.v3 && wr.encode(d, o.v3),
        o.timestamp && e.uint.encode(d, o.timestamp))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d),
        c = e.uint.decode(d)
      return {
        roomKey: o,
        priority: n,
        v3: 1 & c ? wr.decode(d) : null,
        errored: !!(2 & c),
        timestamp: 4 & c ? e.uint.decode(d) : 0,
      }
    },
  },
  Rr = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = o.isConfirmed ? 1 : 0
      e.uint.encode(d, n)
    },
    decode: (d) => ({ isConfirmed: !!(1 & e.uint.decode(d)) }),
  },
  Tr = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.privateProfileKey)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.privateProfileKey)
    },
    decode: (d) => ({ privateProfileKey: e.fixed32.decode(d) }),
  },
  qr = e.frame(Rr),
  Ar = gc,
  Mr = e.frame(xc),
  Sr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey),
        e.fixed32.preencode(d, o.privateProfileKey),
        t.preencode(d, o.deviceKeyPair),
        e.buffer.preencode(d, o.deviceProof),
        qr.preencode(d, o.status),
        d.end++,
        o.entropy && e.buffer.preencode(d, o.entropy),
        o.swap && Ar.preencode(d, o.swap),
        o.swapV2 && Mr.preencode(d, o.swapV2))
    },
    encode(d, o) {
      const n = (o.entropy ? 1 : 0) | (o.swap ? 2 : 0) | (o.swapV2 ? 4 : 0)
      ;(e.fixed32.encode(d, o.publicKey),
        e.fixed32.encode(d, o.privateProfileKey),
        t.encode(d, o.deviceKeyPair),
        e.buffer.encode(d, o.deviceProof),
        qr.encode(d, o.status),
        e.uint.encode(d, n),
        o.entropy && e.buffer.encode(d, o.entropy),
        o.swap && Ar.encode(d, o.swap),
        o.swapV2 && Mr.encode(d, o.swapV2))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.fixed32.decode(d),
        c = t.decode(d),
        r = e.buffer.decode(d),
        i = qr.decode(d),
        a = e.uint.decode(d)
      return {
        publicKey: o,
        privateProfileKey: n,
        deviceKeyPair: c,
        deviceProof: r,
        status: i,
        entropy: 1 & a ? e.buffer.decode(d) : null,
        swap: 2 & a ? Ar.decode(d) : null,
        swapV2: 4 & a ? Mr.decode(d) : null,
      }
    },
  },
  Cr = {
    RestoreIdentity: 1,
    CreateRoom: 2,
    LeaveRoom: 3,
    ClearRoom: 4,
    JoinRoomInvitation: 5,
    JoinRoomKeys: 6,
    JoinRoomResponse: 7,
    SendContactRequest: 8,
    TestFastTask: 9,
    TestSlowTask: 10,
    TestErrorTask: 11,
  },
  Ir = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 11) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  Fr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.buffer.preencode(d, o.encryptionKey),
        d.end++,
        o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo),
        o.initiator && n.preencode(d, o.initiator))
    },
    encode(d, o) {
      const c = (o.fastForwardTo ? 1 : 0) | (o.initiator ? 2 : 0)
      ;(e.fixed32.encode(d, o.roomKey),
        e.buffer.encode(d, o.encryptionKey),
        e.uint.encode(d, c),
        o.fastForwardTo && e.fixed32.encode(d, o.fastForwardTo),
        o.initiator && n.encode(d, o.initiator))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.buffer.decode(d),
        r = e.uint.decode(d)
      return {
        roomKey: o,
        encryptionKey: c,
        fastForwardTo: 1 & r ? e.fixed32.decode(d) : null,
        initiator: 2 & r ? n.decode(d) : null,
      }
    },
  },
  Dr = uc,
  jr = {
    preencode(e, d) {
      Dr.preencode(e, d.invitation)
    },
    encode(e, d) {
      Dr.encode(e, d.invitation)
    },
    decode: (e) => ({ invitation: Dr.decode(e) }),
  },
  Lr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.mailbox),
        t.preencode(d, o.keyPair),
        e.buffer.preencode(d, o.response))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.mailbox), t.encode(d, o.keyPair), e.buffer.encode(d, o.response))
    },
    decode: (d) => ({
      mailbox: e.fixed32.decode(d),
      keyPair: t.decode(d),
      response: e.buffer.decode(d),
    }),
  },
  Er = de,
  Br = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.buffer.preencode(d, o.encryptionKey),
        d.end++,
        o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo),
        o.initiator && n.preencode(d, o.initiator),
        o.mailbox && e.fixed32.preencode(d, o.mailbox))
    },
    encode(d, o) {
      const c = (o.fastForwardTo ? 1 : 0) | (o.initiator ? 2 : 0) | (o.mailbox ? 4 : 0)
      ;(e.fixed32.encode(d, o.roomKey),
        e.buffer.encode(d, o.encryptionKey),
        e.uint.encode(d, c),
        o.fastForwardTo && e.fixed32.encode(d, o.fastForwardTo),
        o.initiator && n.encode(d, o.initiator),
        o.mailbox && e.fixed32.encode(d, o.mailbox))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.buffer.decode(d),
        r = e.uint.decode(d)
      return {
        roomKey: o,
        encryptionKey: c,
        fastForwardTo: 1 & r ? e.fixed32.decode(d) : null,
        initiator: 2 & r ? n.decode(d) : null,
        mailbox: 4 & r ? e.fixed32.decode(d) : null,
      }
    },
  },
  Nr = e.frame(Br),
  Vr = {
    preencode(e, d) {
      Nr.preencode(e, d.keys)
    },
    encode(e, d) {
      Nr.encode(e, d.keys)
    },
    decode: (e) => ({ keys: Nr.decode(e) }),
  },
  Ur = e.frame(hn),
  Jr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.buffer.preencode(d, o.encryptionKey),
        d.end++,
        o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo),
        o.initiator && n.preencode(d, o.initiator),
        o.mailbox && e.fixed32.preencode(d, o.mailbox),
        o.keyPair && t.preencode(d, o.keyPair),
        o.genesis && Ur.preencode(d, o.genesis))
    },
    encode(d, o) {
      const c =
        (o.fastForwardTo ? 1 : 0) |
        (o.initiator ? 2 : 0) |
        (o.mailbox ? 4 : 0) |
        (o.keyPair ? 8 : 0) |
        (o.genesis ? 16 : 0) |
        (o.isPrivateProfile ? 32 : 0)
      ;(e.fixed32.encode(d, o.roomKey),
        e.buffer.encode(d, o.encryptionKey),
        e.uint.encode(d, c),
        o.fastForwardTo && e.fixed32.encode(d, o.fastForwardTo),
        o.initiator && n.encode(d, o.initiator),
        o.mailbox && e.fixed32.encode(d, o.mailbox),
        o.keyPair && t.encode(d, o.keyPair),
        o.genesis && Ur.encode(d, o.genesis))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.buffer.decode(d),
        r = e.uint.decode(d)
      return {
        roomKey: o,
        encryptionKey: c,
        fastForwardTo: 1 & r ? e.fixed32.decode(d) : null,
        initiator: 2 & r ? n.decode(d) : null,
        mailbox: 4 & r ? e.fixed32.decode(d) : null,
        keyPair: 8 & r ? t.decode(d) : null,
        genesis: 16 & r ? Ur.decode(d) : null,
        isPrivateProfile: !!(32 & r),
      }
    },
  },
  Or = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), d.end++)
    },
    encode(d, o) {
      const n = o.isGossiped ? 1 : 0
      ;(e.fixed32.encode(d, o.roomKey), e.uint.encode(d, n))
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d), isGossiped: !!(1 & e.uint.decode(d)) }),
  },
  zr = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.roomKey)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.roomKey)
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d) }),
  },
  Wr = {
    preencode(d, o) {
      ;(e.string.preencode(d, o.mnemonic),
        d.end++,
        o.profileDiscoveryTimeout && e.uint.preencode(d, o.profileDiscoveryTimeout))
    },
    encode(d, o) {
      const n = (o.profileDiscoveryTimeout ? 1 : 0) | (o.recover ? 2 : 0)
      ;(e.string.encode(d, o.mnemonic),
        e.uint.encode(d, n),
        o.profileDiscoveryTimeout && e.uint.encode(d, o.profileDiscoveryTimeout))
    },
    decode(d) {
      const o = e.string.decode(d),
        n = e.uint.decode(d)
      return {
        mnemonic: o,
        profileDiscoveryTimeout: 1 & n ? e.uint.decode(d) : 0,
        recover: !!(2 & n),
      }
    },
  },
  Hr = e.frame(ve),
  Gr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.fixed32.preencode(d, o.memberKey),
        d.end++,
        o.message && e.string.preencode(d, o.message),
        o.contactInfo && Hr.preencode(d, o.contactInfo))
    },
    encode(d, o) {
      const n = (o.message ? 1 : 0) | (o.contactInfo ? 2 : 0)
      ;(e.fixed32.encode(d, o.roomKey),
        e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, n),
        o.message && e.string.encode(d, o.message),
        o.contactInfo && Hr.encode(d, o.contactInfo))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        roomKey: o,
        memberKey: n,
        message: 1 & c ? e.string.decode(d) : null,
        contactInfo: 2 & c ? Hr.decode(d) : null,
      }
    },
  },
  Qr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), d.end++)
    },
    encode(d, o) {
      const n = o.isPrivateProfile ? 1 : 0
      ;(e.fixed32.encode(d, o.key), e.uint.encode(d, n))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), isPrivateProfile: !!(1 & e.uint.decode(d)) }),
  },
  Xr = e.frame(Wr),
  Yr = e.frame(Jr),
  Zr = e.frame(Or),
  $r = e.frame(zr),
  _r = e.frame(jr),
  et = e.frame(Vr),
  dt = e.frame(Lr),
  ot = e.frame(Gr),
  nt = e.frame(Qr),
  ct = {
    preencode(d, o) {
      const n =
        (o.restoreIdentity ? 1 : 0) |
        (o.createRoom ? 2 : 0) |
        (o.leaveRoom ? 4 : 0) |
        (o.clearRoom ? 8 : 0) |
        (o.joinRoomInvitation ? 16 : 0) |
        (o.joinRoomKeys ? 32 : 0) |
        (o.joinRoomResponse ? 64 : 0) |
        (o.sendContactRequest ? 128 : 0) |
        (o.migrateV2Room ? 256 : 0)
      ;(e.fixed32.preencode(d, o.discoveryKey),
        e.uint.preencode(d, o.priority),
        e.uint.preencode(d, o.timestamp),
        e.uint.preencode(d, o.type),
        e.uint.preencode(d, n),
        o.restoreIdentity && Xr.preencode(d, o.restoreIdentity),
        o.createRoom && Yr.preencode(d, o.createRoom),
        o.leaveRoom && Zr.preencode(d, o.leaveRoom),
        o.clearRoom && $r.preencode(d, o.clearRoom),
        o.joinRoomInvitation && _r.preencode(d, o.joinRoomInvitation),
        o.joinRoomKeys && et.preencode(d, o.joinRoomKeys),
        o.joinRoomResponse && dt.preencode(d, o.joinRoomResponse),
        o.sendContactRequest && ot.preencode(d, o.sendContactRequest),
        o.migrateV2Room && nt.preencode(d, o.migrateV2Room))
    },
    encode(d, o) {
      const n =
        (o.restoreIdentity ? 1 : 0) |
        (o.createRoom ? 2 : 0) |
        (o.leaveRoom ? 4 : 0) |
        (o.clearRoom ? 8 : 0) |
        (o.joinRoomInvitation ? 16 : 0) |
        (o.joinRoomKeys ? 32 : 0) |
        (o.joinRoomResponse ? 64 : 0) |
        (o.sendContactRequest ? 128 : 0) |
        (o.migrateV2Room ? 256 : 0)
      ;(e.fixed32.encode(d, o.discoveryKey),
        e.uint.encode(d, o.priority),
        e.uint.encode(d, o.timestamp),
        e.uint.encode(d, o.type),
        e.uint.encode(d, n),
        o.restoreIdentity && Xr.encode(d, o.restoreIdentity),
        o.createRoom && Yr.encode(d, o.createRoom),
        o.leaveRoom && Zr.encode(d, o.leaveRoom),
        o.clearRoom && $r.encode(d, o.clearRoom),
        o.joinRoomInvitation && _r.encode(d, o.joinRoomInvitation),
        o.joinRoomKeys && et.encode(d, o.joinRoomKeys),
        o.joinRoomResponse && dt.encode(d, o.joinRoomResponse),
        o.sendContactRequest && ot.encode(d, o.sendContactRequest),
        o.migrateV2Room && nt.encode(d, o.migrateV2Room))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d),
        c = e.uint.decode(d),
        r = e.uint.decode(d),
        t = e.uint.decode(d)
      return {
        discoveryKey: o,
        priority: n,
        timestamp: c,
        type: r,
        restoreIdentity: 1 & t ? Xr.decode(d) : null,
        createRoom: 2 & t ? Yr.decode(d) : null,
        leaveRoom: 4 & t ? Zr.decode(d) : null,
        clearRoom: 8 & t ? $r.decode(d) : null,
        joinRoomInvitation: 16 & t ? _r.decode(d) : null,
        joinRoomKeys: 32 & t ? et.decode(d) : null,
        joinRoomResponse: 64 & t ? dt.decode(d) : null,
        sendContactRequest: 128 & t ? ot.decode(d) : null,
        migrateV2Room: 256 & t ? nt.decode(d) : null,
      }
    },
  },
  rt = Oe,
  tt = {
    preencode(d, o) {
      ;(e.buffer.preencode(d, o.seed), rt.preencode(d, o.invitation))
    },
    encode(d, o) {
      ;(e.buffer.encode(d, o.seed), rt.encode(d, o.invitation))
    },
    decode: (d) => ({ seed: e.buffer.decode(d), invitation: rt.decode(d) }),
  },
  it = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n =
        (o.isWritable ? 1 : 0) |
        (o.isReadable ? 2 : 0) |
        (o.isPrivateProfile ? 4 : 0) |
        (o.isRemoved ? 8 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        isWritable: !!(1 & o),
        isReadable: !!(2 & o),
        isPrivateProfile: !!(4 & o),
        isRemoved: !!(8 & o),
      }
    },
  },
  at = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.creation),
        e.uint.preencode(d, o.latestSync),
        e.uint.preencode(d, o.latestChatMessage))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.creation),
        e.uint.encode(d, o.latestSync),
        e.uint.encode(d, o.latestChatMessage))
    },
    decode: (d) => ({
      creation: e.uint.decode(d),
      latestSync: e.uint.decode(d),
      latestChatMessage: e.uint.decode(d),
    }),
  },
  st = xn,
  pt = Mo,
  ut = e.frame(at),
  lt = gr,
  ft = e.frame(it),
  mt = e.frame(ue),
  yt = e.frame(wd),
  xt = sn,
  bt = gn,
  vt = e.frame(Bo),
  gt = _,
  kt = e.array(e.frame(Gn)),
  Kt = e.frame(kd),
  ht = vc,
  wt = {
    preencode(d, n) {
      const c =
        (n.selfDevice ? 1 : 0) |
        (n.selfMember ? 2 : 0) |
        (n.config ? 4 : 0) |
        (n.identity ? 8 : 0) |
        (n.lastMessage ? 16 : 0) |
        (n.dm ? 32 : 0) |
        (n.readLengths ? 64 : 0) |
        (n.lastMember ? 128 : 0) |
        (n.version ? 256 : 0) |
        (o >= 3 && n.preferences ? 512 : 0)
      ;(e.fixed32.preencode(d, n.roomKey),
        e.fixed32.preencode(d, n.discoveryKey),
        e.buffer.preencode(d, n.encryptionKey),
        st.preencode(d, n.digest),
        pt.preencode(d, n.stats),
        ut.preencode(d, n.timestamps),
        e.uint.preencode(d, n.fork),
        e.uint.preencode(d, n.length),
        e.fixed32.preencode(d, n.seed),
        lt.preencode(d, n.capabilities),
        ft.preencode(d, n.status),
        e.uint.preencode(d, c),
        n.selfDevice && mt.preencode(d, n.selfDevice),
        n.selfMember && yt.preencode(d, n.selfMember),
        n.config && xt.preencode(d, n.config),
        n.identity && bt.preencode(d, n.identity),
        n.lastMessage && vt.preencode(d, n.lastMessage),
        n.dm && gt.preencode(d, n.dm),
        n.readLengths && kt.preencode(d, n.readLengths),
        n.lastMember && Kt.preencode(d, n.lastMember),
        n.version && e.uint.preencode(d, n.version),
        o >= 3 && n.preferences && ht.preencode(d, n.preferences))
    },
    encode(d, n) {
      const c =
        (n.selfDevice ? 1 : 0) |
        (n.selfMember ? 2 : 0) |
        (n.config ? 4 : 0) |
        (n.identity ? 8 : 0) |
        (n.lastMessage ? 16 : 0) |
        (n.dm ? 32 : 0) |
        (n.readLengths ? 64 : 0) |
        (n.lastMember ? 128 : 0) |
        (n.version ? 256 : 0) |
        (o >= 3 && n.preferences ? 512 : 0)
      ;(e.fixed32.encode(d, n.roomKey),
        e.fixed32.encode(d, n.discoveryKey),
        e.buffer.encode(d, n.encryptionKey),
        st.encode(d, n.digest),
        pt.encode(d, n.stats),
        ut.encode(d, n.timestamps),
        e.uint.encode(d, n.fork),
        e.uint.encode(d, n.length),
        e.fixed32.encode(d, n.seed),
        lt.encode(d, n.capabilities),
        ft.encode(d, n.status),
        e.uint.encode(d, c),
        n.selfDevice && mt.encode(d, n.selfDevice),
        n.selfMember && yt.encode(d, n.selfMember),
        n.config && xt.encode(d, n.config),
        n.identity && bt.encode(d, n.identity),
        n.lastMessage && vt.encode(d, n.lastMessage),
        n.dm && gt.encode(d, n.dm),
        n.readLengths && kt.encode(d, n.readLengths),
        n.lastMember && Kt.encode(d, n.lastMember),
        n.version && e.uint.encode(d, n.version),
        o >= 3 && n.preferences && ht.encode(d, n.preferences))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.fixed32.decode(d),
        r = e.buffer.decode(d),
        t = st.decode(d),
        i = pt.decode(d),
        a = ut.decode(d),
        s = e.uint.decode(d),
        p = e.uint.decode(d),
        u = e.fixed32.decode(d),
        l = lt.decode(d),
        f = ft.decode(d),
        m = e.uint.decode(d)
      return {
        roomKey: n,
        discoveryKey: c,
        encryptionKey: r,
        digest: t,
        stats: i,
        timestamps: a,
        fork: s,
        length: p,
        seed: u,
        capabilities: l,
        status: f,
        selfDevice: 1 & m ? mt.decode(d) : null,
        selfMember: 2 & m ? yt.decode(d) : null,
        config: 4 & m ? xt.decode(d) : null,
        identity: 8 & m ? bt.decode(d) : null,
        lastMessage: 16 & m ? vt.decode(d) : null,
        dm: 32 & m ? gt.decode(d) : null,
        readLengths: 64 & m ? kt.decode(d) : null,
        lastMember: 128 & m ? Kt.decode(d) : null,
        version: 256 & m ? e.uint.decode(d) : 0,
        preferences: o >= 3 && 512 & m ? ht.decode(d) : null,
      }
    },
  },
  Pt = vc,
  Rt = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), Pt.preencode(d, o.status))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.roomKey), Pt.encode(d, o.status))
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d), status: Pt.decode(d) }),
  },
  Tt = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), d.end++, o.repairs && e.uint.preencode(d, o.repairs))
    },
    encode(d, o) {
      const n = o.repairs ? 1 : 0
      ;(e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, n),
        o.repairs && e.uint.encode(d, o.repairs))
    },
    decode: (d) => ({
      roomKey: e.fixed32.decode(d),
      repairs: 1 & e.uint.decode(d) ? e.uint.decode(d) : 0,
    }),
  },
  qt = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.mailbox),
        e.fixed32.preencode(d, o.key),
        d.end++,
        o.roomKey && e.fixed32.preencode(d, o.roomKey),
        o.keyPair && t.preencode(d, o.keyPair),
        o.responseKeyPair && t.preencode(d, o.responseKeyPair))
    },
    encode(d, o) {
      const n = (o.roomKey ? 1 : 0) | (o.keyPair ? 2 : 0) | (o.responseKeyPair ? 4 : 0)
      ;(e.fixed32.encode(d, o.mailbox),
        e.fixed32.encode(d, o.key),
        e.uint.encode(d, n),
        o.roomKey && e.fixed32.encode(d, o.roomKey),
        o.keyPair && t.encode(d, o.keyPair),
        o.responseKeyPair && t.encode(d, o.responseKeyPair))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        mailbox: o,
        key: n,
        roomKey: 1 & c ? e.fixed32.decode(d) : null,
        keyPair: 2 & c ? t.decode(d) : null,
        responseKeyPair: 4 & c ? t.decode(d) : null,
      }
    },
  },
  At = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), e.fixed32.preencode(d, o.responsePublicKey))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), e.fixed32.encode(d, o.responsePublicKey))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), responsePublicKey: e.fixed32.decode(d) }),
  },
  Mt = me,
  St = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), Mt.preencode(d, o.profile))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), Mt.encode(d, o.profile))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), profile: Mt.decode(d) }),
  },
  Ct = mt,
  It = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), Ct.preencode(d, o.device))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.roomKey), Ct.encode(d, o.device))
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d), device: Ct.decode(d) }),
  },
  Ft = K,
  Dt = {
    preencode(d, o) {
      ;(Ft.preencode(d, o.file),
        e.fixed32.preencode(d, o.roomKey),
        d.end++,
        o.encryptionKey && e.buffer.preencode(d, o.encryptionKey))
    },
    encode(d, o) {
      const n = (o.encryptionKey ? 1 : 0) | (o.cleared ? 2 : 0) | (o.own ? 4 : 0)
      ;(Ft.encode(d, o.file),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, n),
        o.encryptionKey && e.buffer.encode(d, o.encryptionKey))
    },
    decode(d) {
      const o = Ft.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        file: o,
        roomKey: n,
        encryptionKey: 1 & c ? e.buffer.decode(d) : null,
        cleared: !!(2 & c),
        own: !!(4 & c),
      }
    },
  },
  jt = {
    preencode(d, o) {
      ;(d.end++,
        o.key && e.string.preencode(d, o.key),
        o.description && e.string.preencode(d, o.description))
    },
    encode(d, o) {
      const n = (o.key ? 1 : 0) | (o.value ? 2 : 0) | (o.description ? 4 : 0)
      ;(e.uint.encode(d, n),
        o.key && e.string.encode(d, o.key),
        o.description && e.string.encode(d, o.description))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        key: 1 & o ? e.string.decode(d) : null,
        value: !!(2 & o),
        description: 4 & o ? e.string.decode(d) : null,
      }
    },
  },
  Lt = e.array(e.frame(jt)),
  Et = {
    preencode(e, d) {
      ;(e.end++, d.flags && Lt.preencode(e, d.flags))
    },
    encode(d, o) {
      const n = o.flags ? 1 : 0
      ;(e.uint.encode(d, n), o.flags && Lt.encode(d, o.flags))
    },
    decode: (d) => ({ flags: 1 & e.uint.decode(d) ? Lt.decode(d) : null }),
  },
  Bt = dd,
  Nt = {
    preencode(d, o) {
      ;(d.end++,
        o.nodes && Bt.preencode(d, o.nodes),
        o.concurrency && e.uint.preencode(d, o.concurrency),
        o.maxWindow && e.uint.preencode(d, o.maxWindow),
        o.randomPunchInterval && e.uint.preencode(d, o.randomPunchInterval),
        o.connectionKeepAlive && e.uint.preencode(d, o.connectionKeepAlive))
    },
    encode(d, o) {
      const n =
        (o.nodes ? 1 : 0) |
        (o.concurrency ? 2 : 0) |
        (o.maxWindow ? 4 : 0) |
        (o.randomPunchInterval ? 8 : 0) |
        (o.connectionKeepAlive ? 16 : 0)
      ;(e.uint.encode(d, n),
        o.nodes && Bt.encode(d, o.nodes),
        o.concurrency && e.uint.encode(d, o.concurrency),
        o.maxWindow && e.uint.encode(d, o.maxWindow),
        o.randomPunchInterval && e.uint.encode(d, o.randomPunchInterval),
        o.connectionKeepAlive && e.uint.encode(d, o.connectionKeepAlive))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        nodes: 1 & o ? Bt.decode(d) : null,
        concurrency: 2 & o ? e.uint.decode(d) : 0,
        maxWindow: 4 & o ? e.uint.decode(d) : 0,
        randomPunchInterval: 8 & o ? e.uint.decode(d) : 0,
        connectionKeepAlive: 16 & o ? e.uint.decode(d) : 0,
      }
    },
  },
  Vt = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), e.uint.preencode(d, o.count))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.roomKey), e.uint.encode(d, o.count))
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d), count: e.uint.decode(d) }),
  },
  Ut = {
    preencode(d, o) {
      ;(d.end++,
        o.roomKey && e.fixed32.preencode(d, o.roomKey),
        o.coreKey && e.fixed32.preencode(d, o.coreKey))
    },
    encode(d, o) {
      const n = (o.roomKey ? 1 : 0) | (o.coreKey ? 2 : 0)
      ;(e.uint.encode(d, n),
        o.roomKey && e.fixed32.encode(d, o.roomKey),
        o.coreKey && e.fixed32.encode(d, o.coreKey))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        roomKey: 1 & o ? e.fixed32.decode(d) : null,
        coreKey: 2 & o ? e.fixed32.decode(d) : null,
      }
    },
  },
  Jt = e.frame(Ut),
  Ot = {
    preencode(d, o) {
      ;(e.string.preencode(d, o.code),
        e.string.preencode(d, o.message),
        e.string.preencode(d, o.stack),
        e.uint.preencode(d, o.timestamp),
        d.end++,
        o.details && Jt.preencode(d, o.details))
    },
    encode(d, o) {
      const n = o.details ? 1 : 0
      ;(e.string.encode(d, o.code),
        e.string.encode(d, o.message),
        e.string.encode(d, o.stack),
        e.uint.encode(d, o.timestamp),
        e.uint.encode(d, n),
        o.details && Jt.encode(d, o.details))
    },
    decode: (d) => ({
      code: e.string.decode(d),
      message: e.string.decode(d),
      stack: e.string.decode(d),
      timestamp: e.uint.decode(d),
      details: 1 & e.uint.decode(d) ? Jt.decode(d) : null,
    }),
  },
  zt = { RESUME: 1, WAKEUP: 2, PRESUSPEND: 3, SUSPEND: 4 },
  Wt = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 4) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  Ht = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), e.uint.preencode(d, o.total))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.roomKey), e.uint.encode(d, o.total))
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d), total: e.uint.decode(d) }),
  },
  Gt = a,
  Qt = {
    preencode(d, o) {
      e.uint.preencode(d, o.duration)
    },
    encode(d, o) {
      e.uint.encode(d, o.duration)
    },
    decode: (d) => ({ duration: e.uint.decode(d) }),
  },
  Xt = L,
  Yt = L,
  Zt = e.frame(Gt),
  $t = {
    preencode(e, d) {
      Zt.preencode(e, d.header)
    },
    encode(e, d) {
      Zt.encode(e, d.header)
    },
    decode: (e) => ({ header: Zt.decode(e) }),
  },
  _t = e.frame(Qt),
  ei = {
    preencode(e, d) {
      _t.preencode(e, d.header)
    },
    encode(e, d) {
      _t.encode(e, d.header)
    },
    decode: (e) => ({ header: _t.decode(e) }),
  },
  di = Zt,
  oi = {
    preencode(e, d) {
      di.preencode(e, d.header)
    },
    encode(e, d) {
      di.encode(e, d.header)
    },
    decode: (e) => ({ header: di.decode(e) }),
  },
  ni = L,
  ci = Zt,
  ri = sn,
  ti = H,
  ii = {
    preencode(e, d) {
      ;(ci.preencode(e, d.header),
        e.end++,
        d.config && ri.preencode(e, d.config),
        d.settings && ti.preencode(e, d.settings))
    },
    encode(d, o) {
      const n = (o.config ? 1 : 0) | (o.settings ? 2 : 0)
      ;(ci.encode(d, o.header),
        e.uint.encode(d, n),
        o.config && ri.encode(d, o.config),
        o.settings && ti.encode(d, o.settings))
    },
    decode(d) {
      const o = ci.decode(d),
        n = e.uint.decode(d)
      return {
        header: o,
        config: 1 & n ? ri.decode(d) : null,
        settings: 2 & n ? ti.decode(d) : null,
      }
    },
  },
  ai = _t,
  si = {
    preencode(d, o) {
      ;(ai.preencode(d, o.header), d.end++, o.roomKey && e.fixed32.preencode(d, o.roomKey))
    },
    encode(d, o) {
      const n = o.roomKey ? 1 : 0
      ;(ai.encode(d, o.header), e.uint.encode(d, n), o.roomKey && e.fixed32.encode(d, o.roomKey))
    },
    decode: (d) => ({
      header: ai.decode(d),
      roomKey: 1 & e.uint.decode(d) ? e.fixed32.decode(d) : null,
    }),
  },
  pi = Zt,
  ui = {
    preencode(d, o) {
      ;(pi.preencode(d, o.header), e.fixed32.preencode(d, o.roomKey))
    },
    encode(d, o) {
      ;(pi.encode(d, o.header), e.fixed32.encode(d, o.roomKey))
    },
    decode: (d) => ({ header: pi.decode(d), roomKey: e.fixed32.decode(d) }),
  },
  li = Zt,
  fi = {
    preencode(d, o) {
      ;(li.preencode(d, o.header), e.fixed32.preencode(d, o.roomKey))
    },
    encode(d, o) {
      ;(li.encode(d, o.header), e.fixed32.encode(d, o.roomKey))
    },
    decode: (d) => ({ header: li.decode(d), roomKey: e.fixed32.decode(d) }),
  },
  mi = Zt,
  yi = {
    preencode(d, o) {
      ;(mi.preencode(d, o.header), e.fixed32.preencode(d, o.roomKey))
    },
    encode(d, o) {
      ;(mi.encode(d, o.header), e.fixed32.encode(d, o.roomKey))
    },
    decode: (d) => ({ header: mi.decode(d), roomKey: e.fixed32.decode(d) }),
  },
  xi = _t,
  bi = {
    preencode(e, d) {
      xi.preencode(e, d.header)
    },
    encode(e, d) {
      xi.encode(e, d.header)
    },
    decode: (e) => ({ header: xi.decode(e) }),
  },
  vi = Zt,
  gi = sn,
  ki = {
    preencode(d, o) {
      ;(vi.preencode(d, o.header),
        e.fixed32.preencode(d, o.roomKey),
        e.uint.preencode(d, o.key),
        gi.preencode(d, o.config))
    },
    encode(d, o) {
      ;(vi.encode(d, o.header),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, o.key),
        gi.encode(d, o.config))
    },
    decode: (d) => ({
      header: vi.decode(d),
      roomKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      config: gi.decode(d),
    }),
  },
  Ki = Zt,
  hi = H,
  wi = {
    preencode(d, o) {
      ;(Ki.preencode(d, o.header),
        e.fixed32.preencode(d, o.roomKey),
        e.uint.preencode(d, o.key),
        hi.preencode(d, o.settings))
    },
    encode(d, o) {
      ;(Ki.encode(d, o.header),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, o.key),
        hi.encode(d, o.settings))
    },
    decode: (d) => ({
      header: Ki.decode(d),
      roomKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      settings: hi.decode(d),
    }),
  },
  Pi = Zt,
  Ri = vc,
  Ti = {
    preencode(d, o) {
      ;(Pi.preencode(d, o.header),
        e.fixed32.preencode(d, o.roomKey),
        e.uint.preencode(d, o.key),
        Ri.preencode(d, o.status))
    },
    encode(d, o) {
      ;(Pi.encode(d, o.header),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, o.key),
        Ri.encode(d, o.status))
    },
    decode: (d) => ({
      header: Pi.decode(d),
      roomKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: Ri.decode(d),
    }),
  },
  qi = Zt,
  Ai = Vo,
  Mi = {
    preencode(d, o) {
      ;(qi.preencode(d, o.header), e.fixed32.preencode(d, o.roomKey), Ai.preencode(d, o.message))
    },
    encode(d, o) {
      ;(qi.encode(d, o.header), e.fixed32.encode(d, o.roomKey), Ai.encode(d, o.message))
    },
    decode: (d) => ({ header: qi.decode(d), roomKey: e.fixed32.decode(d), message: Ai.decode(d) }),
  },
  Si = _t,
  Ci = {
    preencode(e, d) {
      Si.preencode(e, d.header)
    },
    encode(e, d) {
      Si.encode(e, d.header)
    },
    decode: (e) => ({ header: Si.decode(e) }),
  },
  Ii = Zt,
  Fi = Vo,
  Di = {
    preencode(d, o) {
      ;(Ii.preencode(d, o.header),
        e.fixed32.preencode(d, o.roomKey),
        c.preencode(d, o.id),
        Fi.preencode(d, o.message))
    },
    encode(d, o) {
      ;(Ii.encode(d, o.header),
        e.fixed32.encode(d, o.roomKey),
        c.encode(d, o.id),
        Fi.encode(d, o.message))
    },
    decode: (d) => ({
      header: Ii.decode(d),
      roomKey: e.fixed32.decode(d),
      id: c.decode(d),
      message: Fi.decode(d),
    }),
  },
  ji = _t,
  Li = {
    preencode(e, d) {
      ji.preencode(e, d.header)
    },
    encode(e, d) {
      ji.encode(e, d.header)
    },
    decode: (e) => ({ header: ji.decode(e) }),
  },
  Ei = Zt,
  Bi = {
    preencode(d, o) {
      ;(Ei.preencode(d, o.header), e.fixed32.preencode(d, o.roomKey), c.preencode(d, o.id))
    },
    encode(d, o) {
      ;(Ei.encode(d, o.header), e.fixed32.encode(d, o.roomKey), c.encode(d, o.id))
    },
    decode: (d) => ({ header: Ei.decode(d), roomKey: e.fixed32.decode(d), id: c.decode(d) }),
  },
  Ni = _t,
  Vi = {
    preencode(e, d) {
      Ni.preencode(e, d.header)
    },
    encode(e, d) {
      Ni.encode(e, d.header)
    },
    decode: (e) => ({ header: Ni.decode(e) }),
  },
  Ui = Zt,
  Ji = {
    preencode(d, o) {
      ;(Ui.preencode(d, o.header),
        e.fixed32.preencode(d, o.roomKey),
        c.preencode(d, o.id),
        e.string.preencode(d, o.reaction))
    },
    encode(d, o) {
      ;(Ui.encode(d, o.header),
        e.fixed32.encode(d, o.roomKey),
        c.encode(d, o.id),
        e.string.encode(d, o.reaction))
    },
    decode: (d) => ({
      header: Ui.decode(d),
      roomKey: e.fixed32.decode(d),
      id: c.decode(d),
      reaction: e.string.decode(d),
    }),
  },
  Oi = _t,
  zi = {
    preencode(e, d) {
      Oi.preencode(e, d.header)
    },
    encode(e, d) {
      Oi.encode(e, d.header)
    },
    decode: (e) => ({ header: Oi.decode(e) }),
  },
  Wi = Zt,
  Hi = {
    preencode(d, o) {
      ;(Wi.preencode(d, o.header),
        e.fixed32.preencode(d, o.roomKey),
        c.preencode(d, o.id),
        e.string.preencode(d, o.reaction))
    },
    encode(d, o) {
      ;(Wi.encode(d, o.header),
        e.fixed32.encode(d, o.roomKey),
        c.encode(d, o.id),
        e.string.encode(d, o.reaction))
    },
    decode: (d) => ({
      header: Wi.decode(d),
      roomKey: e.fixed32.decode(d),
      id: c.decode(d),
      reaction: e.string.decode(d),
    }),
  },
  Gi = _t,
  Qi = {
    preencode(e, d) {
      Gi.preencode(e, d.header)
    },
    encode(e, d) {
      Gi.encode(e, d.header)
    },
    decode: (e) => ({ header: Gi.decode(e) }),
  },
  Xi = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.clock), e.uint.preencode(d, o.start), e.uint.preencode(d, o.end))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.clock), e.uint.encode(d, o.start), e.uint.encode(d, o.end))
    },
    decode: (d) => ({ clock: e.uint.decode(d), start: e.uint.decode(d), end: e.uint.decode(d) }),
  },
  Yi = L,
  Zi = _,
  $i = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.clock), Zi.preencode(d, o.keys))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.clock), Zi.encode(d, o.keys))
    },
    decode: (d) => ({ clock: e.uint.decode(d), keys: Zi.decode(d) }),
  },
  _i = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.clock),
        e.fixed32.preencode(d, o.roomKey),
        d.end++,
        o.start && e.uint.preencode(d, o.start),
        o.size && e.uint.preencode(d, o.size))
    },
    encode(d, o) {
      const n = (o.start ? 1 : 0) | (o.size ? 2 : 0) | (o.isBottom ? 4 : 0)
      ;(e.uint.encode(d, o.clock),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, n),
        o.start && e.uint.encode(d, o.start),
        o.size && e.uint.encode(d, o.size))
    },
    decode(d) {
      const o = e.uint.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        clock: o,
        roomKey: n,
        start: 1 & c ? e.uint.decode(d) : 0,
        size: 2 & c ? e.uint.decode(d) : 0,
        isBottom: !!(4 & c),
      }
    },
  },
  ea = L,
  da = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.clock),
        e.fixed32.preencode(d, o.roomKey),
        d.end++,
        o.offset && e.fixed32.preencode(d, o.offset),
        o.count && e.uint.preencode(d, o.count))
    },
    encode(d, o) {
      const n = (o.offset ? 1 : 0) | (o.count ? 2 : 0)
      ;(e.uint.encode(d, o.clock),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, n),
        o.offset && e.fixed32.encode(d, o.offset),
        o.count && e.uint.encode(d, o.count))
    },
    decode(d) {
      const o = e.uint.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        clock: o,
        roomKey: n,
        offset: 1 & c ? e.fixed32.decode(d) : null,
        count: 2 & c ? e.uint.decode(d) : 0,
      }
    },
  },
  oa = L,
  na = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.timestamp), e.fixed32.preencode(d, o.id))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.timestamp), e.fixed32.encode(d, o.id))
    },
    decode: (d) => ({ timestamp: e.uint.decode(d), id: e.fixed32.decode(d) }),
  },
  ca = { Changed: 1, Removed: 2 },
  ra = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 2) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  ta = _,
  ia = {
    preencode(d, o) {
      ;(ta.preencode(d, o.keys),
        e.uint.preencode(d, o.start),
        e.uint.preencode(d, o.end),
        e.uint.preencode(d, o.total))
    },
    encode(d, o) {
      ;(ta.encode(d, o.keys),
        e.uint.encode(d, o.start),
        e.uint.encode(d, o.end),
        e.uint.encode(d, o.total))
    },
    decode: (d) => ({
      keys: ta.decode(d),
      start: e.uint.decode(d),
      end: e.uint.decode(d),
      total: e.uint.decode(d),
    }),
  },
  aa = {
    preencode(e, d) {
      ;(ra.preencode(e, d.type), na.preencode(e, d.room))
    },
    encode(e, d) {
      ;(ra.encode(e, d.type), na.encode(e, d.room))
    },
    decode: (e) => ({ type: ra.decode(e), room: na.decode(e) }),
  },
  sa = ft,
  pa = vd,
  ua = {
    preencode(e, d) {
      ;(sa.preencode(e, d.device), e.end++, d.member && pa.preencode(e, d.member))
    },
    encode(d, o) {
      const n = o.member ? 1 : 0
      ;(sa.encode(d, o.device), e.uint.encode(d, n), o.member && pa.encode(d, o.member))
    },
    decode: (d) => ({ device: sa.decode(d), member: 1 & e.uint.decode(d) ? pa.decode(d) : null }),
  },
  la = e.frame(ua),
  fa = xn,
  ma = sn,
  ya = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id),
        la.preencode(d, o.role),
        fa.preencode(d, o.digest),
        ma.preencode(d, o.config),
        d.end++,
        o.messageId && c.preencode(d, o.messageId))
    },
    encode(d, o) {
      const n = o.messageId ? 1 : 0
      ;(e.fixed32.encode(d, o.id),
        la.encode(d, o.role),
        fa.encode(d, o.digest),
        ma.encode(d, o.config),
        e.uint.encode(d, n),
        o.messageId && c.encode(d, o.messageId))
    },
    decode: (d) => ({
      id: e.fixed32.decode(d),
      role: la.decode(d),
      digest: fa.decode(d),
      config: ma.decode(d),
      messageId: 1 & e.uint.decode(d) ? c.decode(d) : null,
    }),
  },
  xa = ft,
  ba = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id), xa.preencode(d, o.status))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.id), xa.encode(d, o.status))
    },
    decode: (d) => ({ id: e.fixed32.decode(d), status: xa.decode(d) }),
  },
  va = xn,
  ga = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id), va.preencode(d, o.digest))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.id), va.encode(d, o.digest))
    },
    decode: (d) => ({ id: e.fixed32.decode(d), digest: va.decode(d) }),
  },
  ka = sn,
  Ka = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id), ka.preencode(d, o.config))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.id), ka.encode(d, o.config))
    },
    decode: (d) => ({ id: e.fixed32.decode(d), config: ka.decode(d) }),
  },
  ha = la,
  wa = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id), d.end++, o.role && ha.preencode(d, o.role))
    },
    encode(d, o) {
      const n = o.role ? 1 : 0
      ;(e.fixed32.encode(d, o.id), e.uint.encode(d, n), o.role && ha.encode(d, o.role))
    },
    decode: (d) => ({ id: e.fixed32.decode(d), role: 1 & e.uint.decode(d) ? ha.decode(d) : null }),
  },
  Pa = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id), c.preencode(d, o.lastMessage))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.id), c.encode(d, o.lastMessage))
    },
    decode: (d) => ({ id: e.fixed32.decode(d), lastMessage: c.decode(d) }),
  },
  Ra = me,
  Ta = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), Ra.preencode(d, o.profile))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), Ra.encode(d, o.profile))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), profile: Ra.decode(d) }),
  },
  qa = se,
  Aa = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), qa.preencode(d, o.status), Wp.preencode(d, o.profile))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), qa.encode(d, o.status), Wp.encode(d, o.profile))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), status: qa.decode(d), profile: Wp.decode(d) }),
  },
  Ma = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.roomKey), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d), key: e.fixed32.decode(d) }),
  },
  Sa = Ma,
  Ca = e.array(c),
  Ia = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.uint.preencode(d, o.start),
        e.uint.preencode(d, o.size),
        e.uint.preencode(d, o.total),
        Ca.preencode(d, o.ids),
        d.end++)
    },
    encode(d, o) {
      const n = o.isBottom ? 1 : 0
      ;(e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, o.start),
        e.uint.encode(d, o.size),
        e.uint.encode(d, o.total),
        Ca.encode(d, o.ids),
        e.uint.encode(d, n))
    },
    decode: (d) => ({
      roomKey: e.fixed32.decode(d),
      start: e.uint.decode(d),
      size: e.uint.decode(d),
      total: e.uint.decode(d),
      ids: Ca.decode(d),
      isBottom: !!(1 & e.uint.decode(d)),
    }),
  },
  Fa = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.sent), d.end++, o.edited && e.uint.preencode(d, o.edited))
    },
    encode(d, o) {
      const n = o.edited ? 1 : 0
      ;(e.uint.encode(d, o.sent), e.uint.encode(d, n), o.edited && e.uint.encode(d, o.edited))
    },
    decode: (d) => ({
      sent: e.uint.decode(d),
      edited: 1 & e.uint.decode(d) ? e.uint.decode(d) : 0,
    }),
  },
  Da = e.frame(Fa),
  ja = Co,
  La = Io,
  Ea = Fo,
  Ba = {
    preencode(d, o) {
      ;(c.preencode(d, o.id),
        e.uint.preencode(d, o.clock),
        Da.preencode(d, o.timestamps),
        ja.preencode(d, o.status),
        d.end++,
        o.message && La.preencode(d, o.message),
        o.event && Ea.preencode(d, o.event))
    },
    encode(d, o) {
      const n = (o.message ? 1 : 0) | (o.event ? 2 : 0)
      ;(c.encode(d, o.id),
        e.uint.encode(d, o.clock),
        Da.encode(d, o.timestamps),
        ja.encode(d, o.status),
        e.uint.encode(d, n),
        o.message && La.encode(d, o.message),
        o.event && Ea.encode(d, o.event))
    },
    decode(d) {
      const o = c.decode(d),
        n = e.uint.decode(d),
        r = Da.decode(d),
        t = ja.decode(d),
        i = e.uint.decode(d)
      return {
        id: o,
        clock: n,
        timestamps: r,
        status: t,
        message: 1 & i ? La.decode(d) : null,
        event: 2 & i ? Ea.decode(d) : null,
      }
    },
  },
  Na = e.frame(Ba),
  Va = vd,
  Ua = {
    preencode(d, o) {
      ;(Na.preencode(d, o.chat), e.fixed32.preencode(d, o.memberKey), Va.preencode(d, o.role))
    },
    encode(d, o) {
      ;(Na.encode(d, o.chat), e.fixed32.encode(d, o.memberKey), Va.encode(d, o.role))
    },
    decode: (d) => ({ chat: Na.decode(d), memberKey: e.fixed32.decode(d), role: Va.decode(d) }),
  },
  Ja = Na,
  Oa = {
    preencode(e, d) {
      Ja.preencode(e, d.chat)
    },
    encode(e, d) {
      Ja.encode(e, d.chat)
    },
    decode: (e) => ({ chat: Ja.decode(e) }),
  },
  za = Ca,
  Wa = {
    preencode(d, o) {
      ;(za.preencode(d, o.ids), e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      ;(za.encode(d, o.ids), e.fixed32.encode(d, o.memberKey))
    },
    decode: (d) => ({ ids: za.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  Ha = Ca,
  Ga = vd,
  Qa = {
    preencode(e, d) {
      ;(Ha.preencode(e, d.ids), Ga.preencode(e, d.role))
    },
    encode(e, d) {
      ;(Ha.encode(e, d.ids), Ga.encode(e, d.role))
    },
    decode: (e) => ({ ids: Ha.decode(e), role: Ga.decode(e) }),
  },
  Xa = e.frame(on),
  Ya = {
    preencode(e, d) {
      ;(c.preencode(e, d.id), Xa.preencode(e, d.reactions))
    },
    encode(e, d) {
      ;(c.encode(e, d.id), Xa.encode(e, d.reactions))
    },
    decode: (e) => ({ id: c.decode(e), reactions: Xa.decode(e) }),
  },
  Za = Xa,
  $a = {
    preencode(e, d) {
      ;(c.preencode(e, d.id), Za.preencode(e, d.digest))
    },
    encode(e, d) {
      ;(c.encode(e, d.id), Za.encode(e, d.digest))
    },
    decode: (e) => ({ id: c.decode(e), digest: Za.decode(e) }),
  },
  _a = L,
  es = L,
  ds = e.array(e.frame(ic)),
  os = {
    preencode(e, d) {
      ds.preencode(e, d.invitations)
    },
    encode(e, d) {
      ds.encode(e, d.invitations)
    },
    decode: (e) => ({ invitations: ds.decode(e) }),
  },
  ns = e.frame(ld),
  cs = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), ns.preencode(d, o.request))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.roomKey), ns.encode(d, o.request))
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d), request: ns.decode(d) }),
  },
  rs = e.array(e.frame(cs)),
  ts = {
    preencode(e, d) {
      rs.preencode(e, d.requests)
    },
    encode(e, d) {
      rs.encode(e, d.requests)
    },
    decode: (e) => ({ requests: rs.decode(e) }),
  },
  is = ds,
  as = e.array(e.frame(ld)),
  ss = {
    preencode(e, d) {
      ;(is.preencode(e, d.pendingInvitations), as.preencode(e, d.identityJoinRequests))
    },
    encode(e, d) {
      ;(is.encode(e, d.pendingInvitations), as.encode(e, d.identityJoinRequests))
    },
    decode: (e) => ({ pendingInvitations: is.decode(e), identityJoinRequests: as.decode(e) }),
  },
  ps = Zt,
  us = {
    preencode(d, o) {
      ;(ps.preencode(d, o.header), e.string.preencode(d, o.invitation), d.end++)
    },
    encode(d, o) {
      const n = o.isIdentity ? 1 : 0
      ;(ps.encode(d, o.header), e.string.encode(d, o.invitation), e.uint.encode(d, n))
    },
    decode: (d) => ({
      header: ps.decode(d),
      invitation: e.string.decode(d),
      isIdentity: !!(1 & e.uint.decode(d)),
    }),
  },
  ls = _t,
  fs = {
    preencode(e, d) {
      ls.preencode(e, d.header)
    },
    encode(e, d) {
      ls.encode(e, d.header)
    },
    decode: (e) => ({ header: ls.decode(e) }),
  },
  ms = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n =
        (o.canModerate ? 1 : 0) |
        (o.canAdmin ? 2 : 0) |
        (o.requiresConfirmation ? 4 : 0) |
        (o.isReadOnly ? 8 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        canModerate: !!(1 & o),
        canAdmin: !!(2 & o),
        requiresConfirmation: !!(4 & o),
        isReadOnly: !!(8 & o),
      }
    },
  },
  ys = Zt,
  xs = e.frame(ms),
  bs = {
    preencode(d, o) {
      ;(ys.preencode(d, o.header),
        e.fixed32.preencode(d, o.roomKey),
        d.end++,
        o.permissions && xs.preencode(d, o.permissions),
        o.expiration && e.uint.preencode(d, o.expiration))
    },
    encode(d, o) {
      const n = (o.permissions ? 1 : 0) | (o.expiration ? 2 : 0)
      ;(ys.encode(d, o.header),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, n),
        o.permissions && xs.encode(d, o.permissions),
        o.expiration && e.uint.encode(d, o.expiration))
    },
    decode(d) {
      const o = ys.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        header: o,
        roomKey: n,
        permissions: 1 & c ? xs.decode(d) : null,
        expiration: 2 & c ? e.uint.decode(d) : 0,
      }
    },
  },
  vs = _t,
  gs = {
    preencode(d, o) {
      ;(vs.preencode(d, o.header), e.string.preencode(d, o.invitation))
    },
    encode(d, o) {
      ;(vs.encode(d, o.header), e.string.encode(d, o.invitation))
    },
    decode: (d) => ({ header: vs.decode(d), invitation: e.string.decode(d) }),
  },
  ks = Zt,
  Ks = {
    preencode(e, d) {
      ks.preencode(e, d.header)
    },
    encode(e, d) {
      ks.encode(e, d.header)
    },
    decode: (e) => ({ header: ks.decode(e) }),
  },
  hs = _t,
  ws = {
    preencode(d, o) {
      ;(hs.preencode(d, o.header), e.string.preencode(d, o.invitation))
    },
    encode(d, o) {
      ;(hs.encode(d, o.header), e.string.encode(d, o.invitation))
    },
    decode: (d) => ({ header: hs.decode(d), invitation: e.string.decode(d) }),
  },
  Ps = Zt,
  Rs = ns,
  Ts = {
    preencode(d, o) {
      ;(Ps.preencode(d, o.header), e.fixed32.preencode(d, o.roomKey), Rs.preencode(d, o.request))
    },
    encode(d, o) {
      ;(Ps.encode(d, o.header), e.fixed32.encode(d, o.roomKey), Rs.encode(d, o.request))
    },
    decode: (d) => ({ header: Ps.decode(d), roomKey: e.fixed32.decode(d), request: Rs.decode(d) }),
  },
  qs = _t,
  As = {
    preencode(e, d) {
      qs.preencode(e, d.header)
    },
    encode(e, d) {
      qs.encode(e, d.header)
    },
    decode: (e) => ({ header: qs.decode(e) }),
  },
  Ms = Zt,
  Ss = ns,
  Cs = {
    preencode(d, o) {
      ;(Ms.preencode(d, o.header), e.fixed32.preencode(d, o.roomKey), Ss.preencode(d, o.request))
    },
    encode(d, o) {
      ;(Ms.encode(d, o.header), e.fixed32.encode(d, o.roomKey), Ss.encode(d, o.request))
    },
    decode: (d) => ({ header: Ms.decode(d), roomKey: e.fixed32.decode(d), request: Ss.decode(d) }),
  },
  Is = _t,
  Fs = {
    preencode(e, d) {
      Is.preencode(e, d.header)
    },
    encode(e, d) {
      Is.encode(e, d.header)
    },
    decode: (e) => ({ header: Is.decode(e) }),
  },
  Ds = Zt,
  js = {
    preencode(d, o) {
      ;(Ds.preencode(d, o.header), e.fixed32.preencode(d, o.id))
    },
    encode(d, o) {
      ;(Ds.encode(d, o.header), e.fixed32.encode(d, o.id))
    },
    decode: (d) => ({ header: Ds.decode(d), id: e.fixed32.decode(d) }),
  },
  Ls = _t,
  Es = {
    preencode(e, d) {
      Ls.preencode(e, d.header)
    },
    encode(e, d) {
      Ls.encode(e, d.header)
    },
    decode: (e) => ({ header: Ls.decode(e) }),
  },
  Bs = Zt,
  Ns = {
    preencode(d, o) {
      ;(Bs.preencode(d, o.header),
        e.string.preencode(d, o.displayName),
        d.end++,
        o.avatar && e.buffer.preencode(d, o.avatar))
    },
    encode(d, o) {
      const n = o.avatar ? 1 : 0
      ;(Bs.encode(d, o.header),
        e.string.encode(d, o.displayName),
        e.uint.encode(d, n),
        o.avatar && e.buffer.encode(d, o.avatar))
    },
    decode: (d) => ({
      header: Bs.decode(d),
      displayName: e.string.decode(d),
      avatar: 1 & e.uint.decode(d) ? e.buffer.decode(d) : null,
    }),
  },
  Vs = L,
  Us = L,
  Js = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = (o.isConfirmed ? 1 : 0) | (o.isLoggedOut ? 2 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { isConfirmed: !!(1 & o), isLoggedOut: !!(2 & o) }
    },
  },
  Os = e.frame(Js),
  zs = _,
  Ws = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey),
        Os.preencode(d, o.status),
        zs.preencode(d, o.deviceKeys))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.memberKey), Os.encode(d, o.status), zs.encode(d, o.deviceKeys))
    },
    decode: (d) => ({
      memberKey: e.fixed32.decode(d),
      status: Os.decode(d),
      deviceKeys: zs.decode(d),
    }),
  },
  Hs = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.memberKey)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.memberKey)
    },
    decode: (d) => ({ memberKey: e.fixed32.decode(d) }),
  },
  Gs = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.deviceKey)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.deviceKey)
    },
    decode: (d) => ({ deviceKey: e.fixed32.decode(d) }),
  },
  Qs = Zt,
  Xs = {
    preencode(d, o) {
      ;(Qs.preencode(d, o.header), e.string.preencode(d, o.password))
    },
    encode(d, o) {
      ;(Qs.encode(d, o.header), e.string.encode(d, o.password))
    },
    decode: (d) => ({ header: Qs.decode(d), password: e.string.decode(d) }),
  },
  Ys = _t,
  Zs = {
    preencode(d, o) {
      ;(Ys.preencode(d, o.header), e.string.preencode(d, o.inspector))
    },
    encode(d, o) {
      ;(Ys.encode(d, o.header), e.string.encode(d, o.inspector))
    },
    decode: (d) => ({ header: Ys.decode(d), inspector: e.string.decode(d) }),
  },
  $s = _t,
  _s = {
    preencode(e, d) {
      $s.preencode(e, d.header)
    },
    encode(e, d) {
      $s.encode(e, d.header)
    },
    decode: (e) => ({ header: $s.decode(e) }),
  },
  ep = _t,
  dp = {
    preencode(e, d) {
      ep.preencode(e, d.header)
    },
    encode(e, d) {
      ep.encode(e, d.header)
    },
    decode: (e) => ({ header: ep.decode(e) }),
  },
  op = { Flag: 1 },
  np = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 1) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  cp = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        e.fixed32.preencode(d, o.sender),
        e.uint.preencode(d, o.clock),
        np.preencode(d, o.label))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key),
        e.fixed32.encode(d, o.sender),
        e.uint.encode(d, o.clock),
        np.encode(d, o.label))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      sender: e.fixed32.decode(d),
      clock: e.uint.decode(d),
      label: np.decode(d),
    }),
  },
  rp = oe,
  tp = {
    preencode(d, o) {
      ;(rp.preencode(d, o.header), e.fixed32.preencode(d, o.key), np.preencode(d, o.label))
    },
    encode(d, o) {
      ;(rp.encode(d, o.header), e.fixed32.encode(d, o.key), np.encode(d, o.label))
    },
    decode: (d) => ({ header: rp.decode(d), key: e.fixed32.decode(d), label: np.decode(d) }),
  },
  ip = {
    preencode(d, o) {
      ;(np.preencode(d, o.label), e.uint.preencode(d, o.count))
    },
    encode(d, o) {
      ;(np.encode(d, o.label), e.uint.encode(d, o.count))
    },
    decode: (d) => ({ label: np.decode(d), count: e.uint.decode(d) }),
  },
  ap = e.array(e.frame(ip)),
  sp = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        e.uint.preencode(d, o.total),
        ap.preencode(d, o.labels),
        e.uint.preencode(d, o.editedAt),
        e.uint.preencode(d, o.flagsClock))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key),
        e.uint.encode(d, o.total),
        ap.encode(d, o.labels),
        e.uint.encode(d, o.editedAt),
        e.uint.encode(d, o.flagsClock))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      total: e.uint.decode(d),
      labels: ap.decode(d),
      editedAt: e.uint.decode(d),
      flagsClock: e.uint.decode(d),
    }),
  },
  pp = oe,
  up = {
    preencode(d, o) {
      ;(pp.preencode(d, o.header),
        e.fixed32.preencode(d, o.deviceKey),
        e.fixed32.preencode(d, o.fromDeviceKey))
    },
    encode(d, o) {
      ;(pp.encode(d, o.header),
        e.fixed32.encode(d, o.deviceKey),
        e.fixed32.encode(d, o.fromDeviceKey))
    },
    decode: (d) => ({
      header: pp.decode(d),
      deviceKey: e.fixed32.decode(d),
      fromDeviceKey: e.fixed32.decode(d),
    }),
  },
  lp = {
    preencode(d, o) {
      ;(e.float64.preencode(d, o.latitude), e.float64.preencode(d, o.longitude))
    },
    encode(d, o) {
      ;(e.float64.encode(d, o.latitude), e.float64.encode(d, o.longitude))
    },
    decode: (d) => ({ latitude: e.float64.decode(d), longitude: e.float64.decode(d) }),
  },
  fp = oe,
  mp = _,
  yp = {
    preencode(d, n) {
      ;(fp.preencode(d, n.header),
        e.fixed32.preencode(d, n.callKey),
        e.buffer.preencode(d, n.encryptionKey),
        d.end++,
        o >= 4 && n.streams && mp.preencode(d, n.streams),
        o >= 4 && n.discoveryKey && e.fixed32.preencode(d, n.discoveryKey),
        o >= 4 && n.version && e.uint.preencode(d, n.version))
    },
    encode(d, n) {
      const c =
        (o >= 4 && n.streams ? 1 : 0) |
        (o >= 4 && n.discoveryKey ? 2 : 0) |
        (o >= 4 && n.version ? 4 : 0)
      ;(fp.encode(d, n.header),
        e.fixed32.encode(d, n.callKey),
        e.buffer.encode(d, n.encryptionKey),
        e.uint.encode(d, c),
        o >= 4 && n.streams && mp.encode(d, n.streams),
        o >= 4 && n.discoveryKey && e.fixed32.encode(d, n.discoveryKey),
        o >= 4 && n.version && e.uint.encode(d, n.version))
    },
    decode(d) {
      const n = fp.decode(d),
        c = e.fixed32.decode(d),
        r = e.buffer.decode(d),
        t = e.uint.decode(d)
      return {
        header: n,
        callKey: c,
        encryptionKey: r,
        streams: o >= 4 && 1 & t ? mp.decode(d) : null,
        discoveryKey: o >= 4 && 2 & t ? e.fixed32.decode(d) : null,
        version: o >= 4 && 4 & t ? e.uint.decode(d) : 0,
      }
    },
  },
  xp = oe,
  bp = _,
  vp = {
    preencode(d, n) {
      ;(xp.preencode(d, n.header),
        e.fixed32.preencode(d, n.callKey),
        d.end++,
        o >= 4 && n.streams && bp.preencode(d, n.streams))
    },
    encode(d, n) {
      const c = o >= 4 && n.streams ? 1 : 0
      ;(xp.encode(d, n.header),
        e.fixed32.encode(d, n.callKey),
        e.uint.encode(d, c),
        o >= 4 && n.streams && bp.encode(d, n.streams))
    },
    decode(d) {
      const n = xp.decode(d),
        c = e.fixed32.decode(d),
        r = e.uint.decode(d)
      return { header: n, callKey: c, streams: o >= 4 && 1 & r ? bp.decode(d) : null }
    },
  },
  gp = oe,
  kp = {
    preencode(d, o) {
      ;(gp.preencode(d, o.header), e.fixed32.preencode(d, o.callKey))
    },
    encode(d, o) {
      ;(gp.encode(d, o.header), e.fixed32.encode(d, o.callKey))
    },
    decode: (d) => ({ header: gp.decode(d), callKey: e.fixed32.decode(d) }),
  },
  Kp = oe,
  hp = {
    preencode(d, o) {
      ;(Kp.preencode(d, o.header), e.fixed32.preencode(d, o.callKey))
    },
    encode(d, o) {
      ;(Kp.encode(d, o.header), e.fixed32.encode(d, o.callKey))
    },
    decode: (d) => ({ header: Kp.decode(d), callKey: e.fixed32.decode(d) }),
  },
  wp = oe,
  Pp = {
    preencode(d, o) {
      ;(wp.preencode(d, o.header),
        e.fixed32.preencode(d, o.callKey),
        e.fixed32.preencode(d, o.streamKey))
    },
    encode(d, o) {
      ;(wp.encode(d, o.header), e.fixed32.encode(d, o.callKey), e.fixed32.encode(d, o.streamKey))
    },
    decode: (d) => ({
      header: wp.decode(d),
      callKey: e.fixed32.decode(d),
      streamKey: e.fixed32.decode(d),
    }),
  },
  Rp = oe,
  Tp = {
    preencode(d, o) {
      ;(Rp.preencode(d, o.header),
        e.fixed32.preencode(d, o.callKey),
        e.fixed32.preencode(d, o.streamKey))
    },
    encode(d, o) {
      ;(Rp.encode(d, o.header), e.fixed32.encode(d, o.callKey), e.fixed32.encode(d, o.streamKey))
    },
    decode: (d) => ({
      header: Rp.decode(d),
      callKey: e.fixed32.decode(d),
      streamKey: e.fixed32.decode(d),
    }),
  },
  qp = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.callKey),
        e.buffer.preencode(d, n.encryptionKey),
        e.uint.preencode(d, n.createdAt),
        d.end++,
        o >= 4 && n.endedAt && e.uint.preencode(d, n.endedAt),
        o >= 4 && n.discoveryKey && e.fixed32.preencode(d, n.discoveryKey),
        o >= 4 && n.version && e.uint.preencode(d, n.version))
    },
    encode(d, n) {
      const c =
        (o >= 4 && n.endedAt ? 1 : 0) |
        (o >= 4 && n.discoveryKey ? 2 : 0) |
        (o >= 4 && n.version ? 4 : 0)
      ;(e.fixed32.encode(d, n.callKey),
        e.buffer.encode(d, n.encryptionKey),
        e.uint.encode(d, n.createdAt),
        e.uint.encode(d, c),
        o >= 4 && n.endedAt && e.uint.encode(d, n.endedAt),
        o >= 4 && n.discoveryKey && e.fixed32.encode(d, n.discoveryKey),
        o >= 4 && n.version && e.uint.encode(d, n.version))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.buffer.decode(d),
        r = e.uint.decode(d),
        t = e.uint.decode(d)
      return {
        callKey: n,
        encryptionKey: c,
        createdAt: r,
        endedAt: o >= 4 && 1 & t ? e.uint.decode(d) : 0,
        discoveryKey: o >= 4 && 2 & t ? e.fixed32.decode(d) : null,
        version: o >= 4 && 4 & t ? e.uint.decode(d) : 0,
      }
    },
  },
  Ap = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.callKey),
        e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.createdAt))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.callKey),
        e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.createdAt))
    },
    decode: (d) => ({
      callKey: e.fixed32.decode(d),
      memberKey: e.fixed32.decode(d),
      createdAt: e.uint.decode(d),
    }),
  },
  Mp = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.callKey),
        e.fixed32.preencode(d, n.deviceKey),
        e.fixed32.preencode(d, n.memberKey),
        e.uint.preencode(d, n.createdAt),
        d.end++,
        o >= 4 && n.swarmKey && e.fixed32.preencode(d, n.swarmKey))
    },
    encode(d, n) {
      const c = o >= 4 && n.swarmKey ? 1 : 0
      ;(e.fixed32.encode(d, n.callKey),
        e.fixed32.encode(d, n.deviceKey),
        e.fixed32.encode(d, n.memberKey),
        e.uint.encode(d, n.createdAt),
        e.uint.encode(d, c),
        o >= 4 && n.swarmKey && e.fixed32.encode(d, n.swarmKey))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.fixed32.decode(d),
        r = e.fixed32.decode(d),
        t = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        callKey: n,
        deviceKey: c,
        memberKey: r,
        createdAt: t,
        swarmKey: o >= 4 && 1 & i ? e.fixed32.decode(d) : null,
      }
    },
  },
  Sp = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.callKey),
        e.fixed32.preencode(d, o.deviceKey),
        e.buffer.preencode(d, o.streamKey),
        e.uint.preencode(d, o.createdAt))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.callKey),
        e.fixed32.encode(d, o.deviceKey),
        e.buffer.encode(d, o.streamKey),
        e.uint.encode(d, o.createdAt))
    },
    decode: (d) => ({
      callKey: e.fixed32.decode(d),
      deviceKey: e.fixed32.decode(d),
      streamKey: e.buffer.decode(d),
      createdAt: e.uint.decode(d),
    }),
  },
  Cp = e.frame(P),
  Ip = Cp,
  Fp = e.frame(fe),
  Dp = Cp,
  jp = Fp,
  Lp = Fp,
  Ep = e.frame(Pd),
  Bp = e.frame(lp),
  Np = Bp,
  Vp = Cp,
  Up = Cp,
  Jp = e.frame(Mc),
  Op = Jp,
  zp = Jp,
  Wp = Fp
function Hp(e) {
  o = e
}
function Gp(d, n, c = 4) {
  return ((o = c), e.encode(Yp(d), n))
}
function Qp(d, n, c = 4) {
  return ((o = c), e.decode(Yp(d), n))
}
function Xp(e) {
  switch (e) {
    case "@keet/room-type":
      return J
    case "@keet/room-supported-language":
      return Y
    case "@keet/display-type":
      return Xo
    case "@keet/system-settings-keys":
      return qn
    case "@keet/label-type":
      return jn
    case "@keet-private-id/user-settings-key":
      return sr
    case "@local/tasks":
      return Cr
    case "@local/keet-state":
      return zt
    case "@api/core/lobby-record-change-type":
      return ca
    case "@keet/member-label-type":
      return op
    default:
      throw new Error("Enum not found " + e)
  }
}
function Yp(e) {
  switch (e) {
    case "@keet/head":
      return n
    case "@keet/oplog-id":
      return c
    case "@keet/encryption-keypair":
      return r
    case "@keet/signing-keypair":
      return t
    case "@keet/room-keys":
      return i
    case "@keet/operation-header":
      return a
    case "@keet/blob-pointer":
      return s
    case "@keet/file-dimensions":
      return p
    case "@keet/file-metadata":
      return l
    case "@keet/external-drive-pointer":
      return f
    case "@keet/external-blob-pointer":
      return m
    case "@keet/file-pointer":
      return b
    case "@keet/file":
      return k
    case "@keet/image-file":
      return P
    case "@keet/file-status":
      return R
    case "@keet/file-record":
      return A
    case "@keet/device-status":
      return M
    case "@keet/member-status":
      return S
    case "@keet/member-moderation-status":
      return C
    case "@keet/abi":
      return I
    case "@keet/device-stats":
      return F
    case "@keet/member-stats":
      return D
    case "@keet/chat-stats":
      return j
    case "@keet/file-stats":
      return L
    case "@keet/stats":
      return U
    case "@keet/room-type":
      return O
    case "@keet/system-settings":
      return z
    case "@keet/system-digest":
      return G
    case "@keet/room-seed":
      return Q
    case "@keet/room-capabilities":
      return X
    case "@keet/room-supported-language":
      return Z
    case "@keet/room-config":
      return ee
    case "@keet/blind-peer":
      return de
    case "@keet/add-blind-peer-operation":
      return ce
    case "@keet/remove-blind-peer-operation":
      return te
    case "@keet/identity-attestation":
      return ie
    case "@keet/device-invitation":
      return ae
    case "@keet/device":
      return ue
    case "@keet/member-profile":
      return le
    case "@keet/device-profile":
      return fe
    case "@keet/member-update":
      return ye
    case "@keet/device-update":
      return xe
    case "@keet/member-contact-info":
      return ve
    case "@keet/signed-pairing-data":
      return ge
    case "@keet/device-request-identity":
      return ke
    case "@keet/device-response-identity":
      return Ke
    case "@keet/device-identity":
      return he
    case "@keet/device-request-with-invitation":
      return Te
    case "@keet/device-request-with-invitation-and-proof":
      return Ae
    case "@keet/device-request-with-member-proof":
      return Ce
    case "@keet/device-request":
      return De
    case "@keet/device-response":
      return Ee
    case "@keet/invitation-metadata":
      return Be
    case "@keet/invitation":
      return Ue
    case "@keet/add-invitation-operation":
      return ze
    case "@keet/remove-invitation-operation":
      return He
    case "@keet/sendable-room-invitation":
      return Ge
    case "@keet/readonly-room-invitation":
      return Qe
    case "@keet/sendable-identity-invitation":
      return Xe
    case "@keet/sendable-contact-invitation":
      return Ye
    case "@keet/sendable-invitation":
      return od
    case "@keet/add-device-operation":
      return cd
    case "@keet/update-device-operation":
      return td
    case "@keet/remove-device-operation":
      return ad
    case "@keet/start-indexing-operation":
      return sd
    case "@keet/stop-indexing-operation":
      return pd
    case "@keet/join-request":
      return ld
    case "@keet/accept-join-request-operation":
      return yd
    case "@keet/reject-join-request-operation":
      return bd
    case "@keet/member":
      return kd
    case "@keet/full-member":
      return wd
    case "@keet/member-proofs":
      return Pd
    case "@keet/update-member-operation":
      return qd
    case "@keet/change-member-status-operation":
      return Sd
    case "@keet/change-member-role-operation":
      return Id
    case "@keet/remove-member-operation":
      return Dd
    case "@keet/member-activity":
      return jd
    case "@keet/member-joined-event":
      return Ld
    case "@keet/member-left-event":
      return Ed
    case "@keet/member-removed-event":
      return Bd
    case "@keet/title-changed-chat-event":
      return Nd
    case "@keet/chat-event":
      return zd
    case "@keet/sendable-event":
      return Wd
    case "@keet/display-range":
      return Hd
    case "@keet/display-content-range":
      return Qd
    case "@keet/mention-display-item":
      return Yd
    case "@keet/translation-display-item":
      return $d
    case "@keet/link-preview":
      return oo
    case "@keet/display-link-item":
      return ro
    case "@keet/display":
      return xo
    case "@keet/oplog-message":
      return ko
    case "@keet/index-message":
      return wo
    case "@keet/full-index-message":
      return To
    case "@keet/message-status":
      return qo
    case "@keet/message-index-id":
      return Ao
    case "@keet/thread":
      return So
    case "@keet/chat-message-record":
      return Do
    case "@keet/full-chat-message-record":
      return Bo
    case "@keet/add-chat-message-operation":
      return Uo
    case "@keet/remove-chat-message-operation":
      return Oo
    case "@keet/update-chat-message-operation":
      return Ho
    case "@keet/pin-chat-message-operation":
      return Qo
    case "@keet/display-type":
      return Yo
    case "@keet/add-file-preview-operation":
      return $o
    case "@keet/reaction":
      return _o
    case "@keet/reactions-summary":
      return en
    case "@keet/reactions-digest":
      return on
    case "@keet/add-reaction-operation":
      return cn
    case "@keet/remove-reaction-operation":
      return tn
    case "@keet/update-room-config-operation":
      return pn
    case "@keet/group-member":
      return un
    case "@keet/user-registry-info":
      return ln
    case "@keet/room-identity":
      return mn
    case "@keet/genesis-operation":
      return hn
    case "@keet/upgrade-operation":
      return Pn
    case "@keet/migrate-abi-operation":
      return Tn
    case "@keet/system-settings-keys":
      return An
    case "@keet/update-system-settings-operation":
      return Cn
    case "@keet/test-increment-operation":
      return Fn
    case "@keet/test-collection-record-1":
      return Dn
    case "@keet/label-type":
      return Ln
    case "@keet/chat-label":
      return En
    case "@keet/add-chat-label-operation":
      return Nn
    case "@keet/remove-chat-label-operation":
      return Un
    case "@keet/chat-label-summary":
      return Jn
    case "@keet/chat-label-digest":
      return zn
    case "@keet/update-read-length-operation":
      return Hn
    case "@keet/read-length":
      return Gn
    case "@keet/tmp-removed-member":
      return Qn
    case "@keet-private-id/contact":
      return Xn
    case "@keet-private-id/v3-room-migration-info":
      return Yn
    case "@keet-private-id/run-v3-migration-operation":
      return _n
    case "@keet-private-id/update-identity-operation":
      return dc
    case "@keet-private-id/counters":
      return oc
    case "@keet-private-id/stats":
      return nc
    case "@keet-private-id/add-entropy-operation":
      return cc
    case "@keet-private-id/pending-invitation-identity":
      return rc
    case "@keet-private-id/pending-invitation":
      return ic
    case "@keet-private-id/resolve-pending-invitation-operation":
      return sc
    case "@keet-private-id/add-pending-invitation-operation":
      return lc
    case "@keet-private-id/remove-pending-invitation-operation":
      return mc
    case "@keet-private-id/identity-swap":
      return yc
    case "@keet-private-id/identity-swap-v2":
      return xc
    case "@keet-private-id/room-status":
      return bc
    case "@keet-private-id/room":
      return Kc
    case "@keet-private-id/add-room-operation":
      return wc
    case "@keet-private-id/remove-room-operation":
      return Rc
    case "@keet-private-id/update-room-status-operation":
      return Ac
    case "@keet-private-id/contact-status":
      return Mc
    case "@keet-private-id/contact-record":
      return Sc
    case "@keet-private-id/add-contact-operation":
      return Fc
    case "@keet-private-id/update-contact-status-operation":
      return jc
    case "@keet-private-id/remove-contact-operation":
      return Ec
    case "@keet-private-id/activate-contact-room-operation":
      return Nc
    case "@keet-private-id/contact-request-status":
      return Vc
    case "@keet-private-id/contact-request-body":
      return Oc
    case "@keet-private-id/contact-request":
      return Wc
    case "@keet-private-id/contact-request-record":
      return Xc
    case "@keet-private-id/add-contact-request-operation":
      return Zc
    case "@keet-private-id/update-contact-request-status-operation":
      return er
    case "@keet-private-id/profile-discovery-record-v1":
      return dr
    case "@keet-private-id/profile-discovery-record":
      return or
    case "@keet-private-id/unreads":
      return nr
    case "@keet-private-id/add-unreads-key-operation":
      return rr
    case "@keet-private-id/remove-unreads-key-operation":
      return ir
    case "@keet-private-id/settings":
      return ar
    case "@keet-private-id/user-settings-key":
      return pr
    case "@keet-private-id/update-settings-operation":
      return fr
    case "@local/background-sync-room":
      return mr
    case "@local/stats":
      return yr
    case "@local/migration-status":
      return xr
    case "@local/v3-private-profile-migration":
      return vr
    case "@local/v3-room-migration":
      return Kr
    case "@local/room-migration-stats":
      return hr
    case "@local/room-migration":
      return Pr
    case "@local/identity-status":
      return Rr
    case "@local/identity-swap":
      return Tr
    case "@local/identity-record":
      return Sr
    case "@local/tasks":
      return Ir
    case "@local/room-keys":
      return Fr
    case "@local/join-room-invitation-task":
      return jr
    case "@local/join-room-response-task":
      return Lr
    case "@local/fast-forward-to":
      return Er
    case "@local/add-room-fields":
      return Br
    case "@local/join-room-keys-task":
      return Vr
    case "@local/create-room-task":
      return Jr
    case "@local/leave-room-task":
      return Or
    case "@local/clear-room-task":
      return zr
    case "@local/restore-identity-task":
      return Wr
    case "@local/send-contact-request-task":
      return Gr
    case "@local/migrate-v2-room-task":
      return Qr
    case "@local/task":
      return ct
    case "@local/shared-invitation":
      return tt
    case "@local/room-status":
      return it
    case "@local/room-timestamps":
      return at
    case "@local/room":
      return wt
    case "@local/room-preferences":
      return Rt
    case "@local/room-metadata":
      return Tt
    case "@local/writer":
      return qt
    case "@local/writer-append":
      return At
    case "@local/member":
      return St
    case "@local/device":
      return It
    case "@local/file":
      return Dt
    case "@local/debug-flag":
      return jt
    case "@local/debug":
      return Et
    case "@local/hyperdht-record":
      return Nt
    case "@local/unread":
      return Vt
    case "@local/error-record-details":
      return Ut
    case "@local/error-record":
      return Ot
    case "@local/keet-state":
      return Wt
    case "@local/file-stats":
      return Ht
    case "@api/request-header":
      return Gt
    case "@api/response-header":
      return Qt
    case "@api/subscription-request-header":
      return Xt
    case "@api/subscription-response-header":
      return Yt
    case "@api/boot-request":
      return $t
    case "@api/boot-response":
      return ei
    case "@api/self-destruct-request":
      return oi
    case "@api/core/have":
      return ni
    case "@api/core/create-room-request":
      return ii
    case "@api/core/create-room-response":
      return si
    case "@api/core/activate-room-request":
      return ui
    case "@api/core/deactivate-room-request":
      return fi
    case "@api/core/leave-room-request":
      return yi
    case "@api/core/leave-room-response":
      return bi
    case "@api/core/update-room-config-request":
      return ki
    case "@api/core/update-room-settings-request":
      return wi
    case "@api/core/update-room-status-request":
      return Ti
    case "@api/core/add-chat-message-request":
      return Mi
    case "@api/core/add-chat-message-response":
      return Ci
    case "@api/core/edit-chat-message-request":
      return Di
    case "@api/core/edit-chat-message-response":
      return Li
    case "@api/core/remove-chat-message-request":
      return Bi
    case "@api/core/remove-chat-message-response":
      return Vi
    case "@api/core/add-chat-reaction-request":
      return Ji
    case "@api/core/add-chat-reaction-response":
      return zi
    case "@api/core/remove-chat-reaction-request":
      return Hi
    case "@api/core/remove-chat-reaction-response":
      return Qi
    case "@api/core/want-lobby":
      return Xi
    case "@api/core/unwant-lobby":
      return Yi
    case "@api/core/want-room-info":
      return $i
    case "@api/core/want-chat":
      return _i
    case "@api/core/unwant-chat":
      return ea
    case "@api/core/want-members":
      return da
    case "@api/core/unwant-members":
      return oa
    case "@api/core/lobby-record":
      return na
    case "@api/core/lobby-record-change-type":
      return ra
    case "@api/core/lobby":
      return ia
    case "@api/core/lobby-room":
      return aa
    case "@api/core/room-role":
      return ua
    case "@api/core/room-info":
      return ya
    case "@api/core/room-info-status":
      return ba
    case "@api/core/room-info-digest":
      return ga
    case "@api/core/room-info-config":
      return Ka
    case "@api/core/room-info-role":
      return wa
    case "@api/core/room-info-last-message":
      return Pa
    case "@api/core/member":
      return Ta
    case "@api/core/device":
      return Aa
    case "@api/core/member-list-add":
      return Ma
    case "@api/core/member-list-remove":
      return Sa
    case "@api/core/chat-reset":
      return Ia
    case "@api/core/message-timestamps":
      return Fa
    case "@api/core/message":
      return Ba
    case "@api/core/message-info":
      return Ua
    case "@api/core/message-info-chat":
      return Oa
    case "@api/core/message-info-member":
      return Wa
    case "@api/core/message-info-role":
      return Qa
    case "@api/core/message-info-reactions":
      return Ya
    case "@api/core/reactions":
      return $a
    case "@api/core/want-pairing":
      return _a
    case "@api/core/unwant-pairing":
      return es
    case "@api/core/pending-invitations":
      return os
    case "@api/core/join-request":
      return cs
    case "@api/core/join-requests":
      return ts
    case "@api/core/pairing":
      return ss
    case "@api/core/start-pairing-request":
      return us
    case "@api/core/start-pairing-response":
      return fs
    case "@api/core/invitation-permissions":
      return ms
    case "@api/core/create-room-invitation-request":
      return bs
    case "@api/core/create-room-invitation-response":
      return gs
    case "@api/core/create-identity-invitation-request":
      return Ks
    case "@api/core/create-identity-invitation-response":
      return ws
    case "@api/core/accept-join-request-request":
      return Ts
    case "@api/core/accept-join-request-response":
      return As
    case "@api/core/reject-join-request-request":
      return Cs
    case "@api/core/reject-join-request-response":
      return Fs
    case "@api/core/stop-pairing-request":
      return js
    case "@api/core/stop-pairing-response":
      return Es
    case "@api/core/update-profile-request":
      return Ns
    case "@api/core/want-identity":
      return Vs
    case "@api/core/unwant-identity":
      return Us
    case "@api/core/identity-status":
      return Js
    case "@api/core/identity":
      return Ws
    case "@api/core/identity-member":
      return Hs
    case "@api/core/identity-device":
      return Gs
    case "@api/debug/enable-request":
      return Xs
    case "@api/debug/enable-response":
      return Zs
    case "@api/debug/disable-request":
      return _s
    case "@api/debug/disable-response":
      return dp
    case "@keet/member-label-type":
      return np
    case "@keet/member-label":
      return cp
    case "@keet/add-member-label-operation":
      return tp
    case "@keet/member-label-summary":
      return ip
    case "@keet/member-label-digest":
      return sp
    case "@keet/move-indexer-operation":
      return up
    case "@keet/location-shared-event":
      return lp
    case "@keet/start-call":
      return yp
    case "@keet/join-call":
      return vp
    case "@keet/leave-call":
      return kp
    case "@keet/end-call":
      return hp
    case "@keet/add-call-stream":
      return Pp
    case "@keet/remove-call-stream":
      return Tp
    case "@keet/call-record":
      return qp
    case "@keet/call-member-record":
      return Ap
    case "@keet/call-device-record":
      return Mp
    case "@keet/call-stream-record":
      return Sp
    default:
      throw new Error("Encoder not found " + e)
  }
}
function Zp(e, d = 4) {
  const n = Yp(e)
  return {
    preencode(e, c) {
      ;((o = d), n.preencode(e, c))
    },
    encode(e, c) {
      ;((o = d), n.encode(e, c))
    },
    decode: (e) => ((o = d), n.decode(e)),
  }
}
const $p = Zp
module.exports = {
  resolveStruct: $p,
  getStruct: Zp,
  getEnum: Xp,
  getEncoding: Yp,
  encode: Gp,
  decode: Qp,
  setVersion: Hp,
  version: o,
}