OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated / @holepunchto / keet-schemas / packages / schema / spec / contract / hyperdb / messages.js

4607 lines · javascript ref:
const { c: e } = require("hyperschema/runtime"),
  d = 19
let n = d
const o = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key), e.uint.preencode(d, n.length))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.key), e.uint.encode(d, n.length))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), length: e.uint.decode(d) }),
  },
  c = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key), e.uint.preencode(d, n.seq))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.key), e.uint.encode(d, n.seq))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), seq: e.uint.decode(d) }),
  },
  t = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.publicKey), e.fixed32.preencode(d, n.secretKey))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.publicKey), e.fixed32.encode(d, n.secretKey))
    },
    decode: (d) => ({ publicKey: e.fixed32.decode(d), secretKey: e.fixed32.decode(d) }),
  },
  r = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.publicKey), e.fixed64.preencode(d, n.secretKey))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.publicKey), e.fixed64.encode(d, n.secretKey))
    },
    decode: (d) => ({ publicKey: e.fixed32.decode(d), secretKey: e.fixed64.decode(d) }),
  },
  i = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key),
        d.end++,
        n.encryptionKey && e.buffer.preencode(d, n.encryptionKey),
        n.fastForwardTo && e.fixed32.preencode(d, n.fastForwardTo))
    },
    encode(d, n) {
      const o = (n.encryptionKey ? 1 : 0) | (n.fastForwardTo ? 2 : 0)
      ;(e.fixed32.encode(d, n.key),
        e.uint.encode(d, o),
        n.encryptionKey && e.buffer.encode(d, n.encryptionKey),
        n.fastForwardTo && e.fixed32.encode(d, n.fastForwardTo))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        o = e.uint.decode(d)
      return {
        key: n,
        encryptionKey: 1 & o ? e.buffer.decode(d) : null,
        fastForwardTo: 2 & o ? e.fixed32.decode(d) : null,
      }
    },
  },
  a = {
    preencode(d, n) {
      e.uint.preencode(d, n.timestamp)
    },
    encode(d, n) {
      e.uint.encode(d, n.timestamp)
    },
    decode: (d) => ({ timestamp: e.uint.decode(d) }),
  },
  s = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.blockOffset),
        e.uint.preencode(d, n.blockLength),
        e.uint.preencode(d, n.byteOffset),
        e.uint.preencode(d, n.byteLength))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.blockOffset),
        e.uint.encode(d, n.blockLength),
        e.uint.encode(d, n.byteOffset),
        e.uint.encode(d, n.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, n) {
      ;(e.uint.preencode(d, n.width), e.uint.preencode(d, n.height))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.width), e.uint.encode(d, n.height))
    },
    decode: (d) => ({ width: e.uint.decode(d), height: e.uint.decode(d) }),
  },
  u = e.frame(p),
  l = {
    preencode(d, n) {
      ;(d.end++,
        n.name && e.string.preencode(d, n.name),
        n.mimetype && e.string.preencode(d, n.mimetype),
        n.dimensions && u.preencode(d, n.dimensions),
        n.userdata && e.buffer.preencode(d, n.userdata),
        n.duration && e.uint.preencode(d, n.duration))
    },
    encode(d, n) {
      const o =
        (n.name ? 1 : 0) |
        (n.mimetype ? 2 : 0) |
        (n.dimensions ? 4 : 0) |
        (n.userdata ? 8 : 0) |
        (n.duration ? 16 : 0) |
        (n.isPreview ? 32 : 0)
      ;(e.uint.encode(d, o),
        n.name && e.string.encode(d, n.name),
        n.mimetype && e.string.encode(d, n.mimetype),
        n.dimensions && u.encode(d, n.dimensions),
        n.userdata && e.buffer.encode(d, n.userdata),
        n.duration && e.uint.encode(d, n.duration))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        name: 1 & n ? e.string.decode(d) : null,
        mimetype: 2 & n ? e.string.decode(d) : null,
        dimensions: 4 & n ? u.decode(d) : null,
        userdata: 8 & n ? e.buffer.decode(d) : null,
        duration: 16 & n ? e.uint.decode(d) : 0,
        isPreview: !!(32 & n),
      }
    },
  },
  f = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key),
        e.string.preencode(d, n.path),
        e.uint.preencode(d, n.version),
        e.uint.preencode(d, n.size))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.key),
        e.string.encode(d, n.path),
        e.uint.encode(d, n.version),
        e.uint.encode(d, n.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, n) {
      ;(e.fixed32.preencode(d, n.key), s.preencode(d, n.blob))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.key), s.encode(d, n.blob))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), blob: s.decode(d) }),
  },
  y = e.frame(m),
  x = e.frame(f),
  b = {
    preencode(d, n) {
      ;(d.end++,
        n.inlined && e.buffer.preencode(d, n.inlined),
        n.blob && s.preencode(d, n.blob),
        n.externalBlob && y.preencode(d, n.externalBlob),
        n.externalDrive && x.preencode(d, n.externalDrive))
    },
    encode(d, n) {
      const o =
        (n.inlined ? 1 : 0) |
        (n.blob ? 2 : 0) |
        (n.externalBlob ? 4 : 0) |
        (n.externalDrive ? 8 : 0)
      ;(e.uint.encode(d, o),
        n.inlined && e.buffer.encode(d, n.inlined),
        n.blob && s.encode(d, n.blob),
        n.externalBlob && y.encode(d, n.externalBlob),
        n.externalDrive && x.encode(d, n.externalDrive))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        inlined: 1 & n ? e.buffer.decode(d) : null,
        blob: 2 & n ? s.decode(d) : null,
        externalBlob: 4 & n ? y.decode(d) : null,
        externalDrive: 8 & n ? x.decode(d) : null,
      }
    },
  },
  k = e.frame(b),
  v = e.frame(l),
  g = {
    preencode(d, n) {
      ;(k.preencode(d, n.pointer),
        d.end++,
        n.metadata && v.preencode(d, n.metadata),
        n.preview && Qr.preencode(d, n.preview),
        n.hash && e.fixed32.preencode(d, n.hash))
    },
    encode(d, n) {
      const o = (n.metadata ? 1 : 0) | (n.preview ? 2 : 0) | (n.hash ? 4 : 0)
      ;(k.encode(d, n.pointer),
        e.uint.encode(d, o),
        n.metadata && v.encode(d, n.metadata),
        n.preview && Qr.encode(d, n.preview),
        n.hash && e.fixed32.encode(d, n.hash))
    },
    decode(d) {
      const n = k.decode(d),
        o = e.uint.decode(d)
      return {
        pointer: n,
        metadata: 1 & o ? v.decode(d) : null,
        preview: 2 & o ? Qr.decode(d) : null,
        hash: 4 & o ? e.fixed32.decode(d) : null,
      }
    },
  },
  h = e.frame(g),
  K = h,
  w = h,
  A = {
    preencode(e, d) {
      ;(e.end++,
        d.small && h.preencode(e, d.small),
        d.medium && K.preencode(e, d.medium),
        d.large && w.preencode(e, d.large))
    },
    encode(d, n) {
      const o = (n.small ? 1 : 0) | (n.medium ? 2 : 0) | (n.large ? 4 : 0)
      ;(e.uint.encode(d, o),
        n.small && h.encode(d, n.small),
        n.medium && K.encode(d, n.medium),
        n.large && w.encode(d, n.large))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        small: 1 & n ? h.decode(d) : null,
        medium: 2 & n ? K.decode(d) : null,
        large: 4 & n ? w.decode(d) : null,
      }
    },
  },
  P = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      const o = n.isDeleted ? 1 : 0
      e.uint.encode(d, o)
    },
    decode: (d) => ({ isDeleted: !!(1 & e.uint.decode(d)) }),
  },
  T = e.frame(P),
  S = h,
  R = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.id),
        c.preencode(d, o.oplog),
        T.preencode(d, o.status),
        S.preencode(d, o.file),
        d.end++,
        n >= 14 && o.version && e.uint.preencode(d, o.version))
    },
    encode(d, o) {
      const t = n >= 14 && o.version ? 1 : 0
      ;(e.uint.encode(d, o.id),
        c.encode(d, o.oplog),
        T.encode(d, o.status),
        S.encode(d, o.file),
        e.uint.encode(d, t),
        n >= 14 && o.version && e.uint.encode(d, o.version))
    },
    decode(d) {
      const o = e.uint.decode(d),
        t = c.decode(d),
        r = T.decode(d),
        i = S.decode(d),
        a = d.start < d.end ? e.uint.decode(d) : 0
      return {
        id: o,
        oplog: t,
        status: r,
        file: i,
        version: n >= 14 && 1 & a ? e.uint.decode(d) : 0,
      }
    },
  },
  C = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      const o = (n.isActive ? 1 : 0) | (n.isIndexing ? 2 : 0)
      e.uint.encode(d, o)
    },
    decode(d) {
      const n = e.uint.decode(d)
      return { isActive: !!(1 & n), isIndexing: !!(2 & n) }
    },
  },
  F = {
    preencode(d, o) {
      const c =
        (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) |
        (n >= 13 && o.isRemoved ? 128 : 0)
      e.uint.preencode(d, c)
    },
    encode(d, o) {
      const c =
        (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) |
        (n >= 13 && o.isRemoved ? 128 : 0)
      e.uint.encode(d, c)
    },
    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: n >= 13 && !!(128 & o),
      }
    },
  },
  q = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      const o = (n.isMuted ? 1 : 0) | (n.isBanned ? 2 : 0) | (n.isShadowBanned ? 4 : 0)
      e.uint.encode(d, o)
    },
    decode(d) {
      const n = e.uint.decode(d)
      return { isMuted: !!(1 & n), isBanned: !!(2 & n), isShadowBanned: !!(4 & n) }
    },
  },
  M = {
    preencode(d, n) {
      e.uint.preencode(d, n.version)
    },
    encode(d, n) {
      e.uint.encode(d, n.version)
    },
    decode: (d) => ({ version: e.uint.decode(d) }),
  },
  D = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.total), e.uint.preencode(d, n.active))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.total), e.uint.encode(d, n.active))
    },
    decode: (d) => ({ total: e.uint.decode(d), active: e.uint.decode(d) }),
  },
  L = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.total), e.uint.preencode(d, n.active), e.uint.preencode(d, n.pending))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.total), e.uint.encode(d, n.active), e.uint.encode(d, n.pending))
    },
    decode: (d) => ({
      total: e.uint.decode(d),
      active: e.uint.decode(d),
      pending: e.uint.decode(d),
    }),
  },
  B = {
    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++,
        n >= 15 && o.flagsClock && e.uint.preencode(d, o.flagsClock))
    },
    encode(d, o) {
      const c = n >= 15 && 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, c),
        n >= 15 && o.flagsClock && e.uint.encode(d, o.flagsClock))
    },
    decode(d) {
      const o = e.uint.decode(d),
        c = e.uint.decode(d),
        t = e.uint.decode(d),
        r = e.uint.decode(d),
        i = d.start < d.end ? e.uint.decode(d) : 0
      return {
        clock: o,
        pinned: c,
        threads: t,
        timestamp: r,
        flagsClock: n >= 15 && 1 & i ? e.uint.decode(d) : 0,
      }
    },
  },
  E = {
    preencode(d, n) {
      e.uint.preencode(d, n.clock)
    },
    encode(d, n) {
      e.uint.encode(d, n.clock)
    },
    decode: (d) => ({ clock: e.uint.decode(d) }),
  },
  I = e.frame(D),
  j = e.frame(L),
  N = e.frame(B),
  V = e.frame(E),
  O = {
    preencode(e, d) {
      ;(I.preencode(e, d.devices),
        j.preencode(e, d.members),
        N.preencode(e, d.chat),
        V.preencode(e, d.files))
    },
    encode(e, d) {
      ;(I.encode(e, d.devices), j.encode(e, d.members), N.encode(e, d.chat), V.encode(e, d.files))
    },
    decode: (e) => ({
      devices: I.decode(e),
      members: j.decode(e),
      chat: N.decode(e),
      files: V.decode(e),
    }),
  },
  J = { Default: 1, Broadcast: 2, DirectMessage: 3 },
  U = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      if (n > 3) throw new Error("Unknown enum")
      e.uint.encode(d, n)
    },
    decode: (d) => e.uint.decode(d),
  },
  H = {
    preencode(e, d) {
      ;(e.end++, d.roomType && U.preencode(e, d.roomType))
    },
    encode(d, n) {
      const o =
        (n.roomType ? 1 : 0) |
        (n.isExperimental ? 2 : 0) |
        (n.isJoiningDisabled ? 4 : 0) |
        (n.isAppendingDisabled ? 8 : 0) |
        (n.isCallingDisabled ? 16 : 0) |
        (n.isMembershipEventsDisabled ? 32 : 0)
      ;(e.uint.encode(d, o), n.roomType && U.encode(d, n.roomType))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        roomType: 1 & n ? U.decode(d) : 0,
        isExperimental: !!(2 & n),
        isJoiningDisabled: !!(4 & n),
        isAppendingDisabled: !!(8 & n),
        isCallingDisabled: !!(16 & n),
        isMembershipEventsDisabled: !!(32 & n),
      }
    },
  },
  z = e.frame(M),
  G = e.frame(H),
  Q = {
    preencode(d, n) {
      ;(z.preencode(d, n.abi), G.preencode(d, n.settings), e.uint.preencode(d, n.creationTime))
    },
    encode(d, n) {
      ;(z.encode(d, n.abi), G.encode(d, n.settings), e.uint.encode(d, n.creationTime))
    },
    decode: (d) => ({ abi: z.decode(d), settings: G.decode(d), creationTime: e.uint.decode(d) }),
  },
  W = {
    preencode(d, n) {
      e.fixed32.preencode(d, n.seed)
    },
    encode(d, n) {
      e.fixed32.encode(d, n.seed)
    },
    decode: (d) => ({ seed: e.fixed32.decode(d) }),
  },
  X = {
    preencode(d, n) {
      ;(t.preencode(d, n.mailboxKeyPair),
        r.preencode(d, n.discoveryKeyPair),
        e.fixed32.preencode(d, n.wakeupTopic),
        e.fixed32.preencode(d, n.swarmTopic))
    },
    encode(d, n) {
      ;(t.encode(d, n.mailboxKeyPair),
        r.encode(d, n.discoveryKeyPair),
        e.fixed32.encode(d, n.wakeupTopic),
        e.fixed32.encode(d, n.swarmTopic))
    },
    decode: (d) => ({
      mailboxKeyPair: t.decode(d),
      discoveryKeyPair: r.decode(d),
      wakeupTopic: e.fixed32.decode(d),
      swarmTopic: e.fixed32.decode(d),
    }),
  },
  Y = e.array(e.fixed32),
  Z = {
    preencode(d, o) {
      ;(d.end++,
        o.title && e.string.preencode(d, o.title),
        o.avatar && Wr.preencode(d, o.avatar),
        o.description && e.string.preencode(d, o.description),
        n >= 11 && o.supportedLanguages && Xr.preencode(d, o.supportedLanguages),
        n >= 13 && o.blindPeers && Y.preencode(d, o.blindPeers))
    },
    encode(d, o) {
      const c =
        (o.title ? 1 : 0) |
        (o.avatar ? 2 : 0) |
        (o.description ? 4 : 0) |
        (n >= 11 && o.supportedLanguages ? 8 : 0) |
        (n >= 13 && o.blindPeers ? 16 : 0)
      ;(e.uint.encode(d, c),
        o.title && e.string.encode(d, o.title),
        o.avatar && Wr.encode(d, o.avatar),
        o.description && e.string.encode(d, o.description),
        n >= 11 && o.supportedLanguages && Xr.encode(d, o.supportedLanguages),
        n >= 13 && o.blindPeers && Y.encode(d, o.blindPeers))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        title: 1 & o ? e.string.decode(d) : null,
        avatar: 2 & o ? Wr.decode(d) : null,
        description: 4 & o ? e.string.decode(d) : null,
        supportedLanguages: n >= 11 && 8 & o ? Xr.decode(d) : null,
        blindPeers: n >= 13 && 16 & o ? Y.decode(d) : null,
      }
    },
  },
  $ = {
    preencode(d, n) {
      e.fixed32.preencode(d, n.key)
    },
    encode(d, n) {
      e.fixed32.encode(d, n.key)
    },
    decode: (d) => ({ key: e.fixed32.decode(d) }),
  },
  _ = e.frame(a),
  ee = e.frame($),
  de = {
    preencode(e, d) {
      ;(_.preencode(e, d.header), ee.preencode(e, d.peer))
    },
    encode(e, d) {
      ;(_.encode(e, d.header), ee.encode(e, d.peer))
    },
    decode: (e) => ({ header: _.decode(e), peer: ee.decode(e) }),
  },
  ne = _,
  oe = {
    preencode(d, n) {
      ;(ne.preencode(d, n.header), e.fixed32.preencode(d, n.key))
    },
    encode(d, n) {
      ;(ne.encode(d, n.header), e.fixed32.encode(d, n.key))
    },
    decode: (d) => ({ header: ne.decode(d), key: e.fixed32.decode(d) }),
  },
  ce = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.memberKey), e.buffer.preencode(d, n.proof))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.memberKey), e.buffer.encode(d, n.proof))
    },
    decode: (d) => ({ memberKey: e.fixed32.decode(d), proof: e.buffer.decode(d) }),
  },
  te = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.id), e.buffer.preencode(d, n.response))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.id), e.buffer.encode(d, n.response))
    },
    decode: (d) => ({ id: e.fixed32.decode(d), response: e.buffer.decode(d) }),
  },
  re = e.frame(C),
  ie = e.frame(te),
  ae = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key),
        e.fixed32.preencode(d, n.memberKey),
        re.preencode(d, n.status),
        Yr.preencode(d, n.profile),
        d.end++,
        n.invitation && ie.preencode(d, n.invitation))
    },
    encode(d, n) {
      const o = n.invitation ? 1 : 0
      ;(e.fixed32.encode(d, n.key),
        e.fixed32.encode(d, n.memberKey),
        re.encode(d, n.status),
        Yr.encode(d, n.profile),
        e.uint.encode(d, o),
        n.invitation && ie.encode(d, n.invitation))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      memberKey: e.fixed32.decode(d),
      status: re.decode(d),
      profile: Yr.decode(d),
      invitation: 1 & e.uint.decode(d) ? ie.decode(d) : null,
    }),
  },
  se = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.timestamp),
        d.end++,
        n.mailbox && e.fixed32.preencode(d, n.mailbox),
        n.displayName && e.string.preencode(d, n.displayName),
        n.avatar && Zr.preencode(d, n.avatar),
        n.username && e.string.preencode(d, n.username))
    },
    encode(d, n) {
      const o =
        (n.mailbox ? 1 : 0) | (n.displayName ? 2 : 0) | (n.avatar ? 4 : 0) | (n.username ? 8 : 0)
      ;(e.uint.encode(d, n.timestamp),
        e.uint.encode(d, o),
        n.mailbox && e.fixed32.encode(d, n.mailbox),
        n.displayName && e.string.encode(d, n.displayName),
        n.avatar && Zr.encode(d, n.avatar),
        n.username && e.string.encode(d, n.username))
    },
    decode(d) {
      const n = e.uint.decode(d),
        o = e.uint.decode(d)
      return {
        timestamp: n,
        mailbox: 1 & o ? e.fixed32.decode(d) : null,
        displayName: 2 & o ? e.string.decode(d) : null,
        avatar: 4 & o ? Zr.decode(d) : null,
        username: 8 & o ? e.string.decode(d) : null,
      }
    },
  },
  pe = {
    preencode(d, n) {
      ;(d.end++,
        n.swarmKey && e.fixed32.preencode(d, n.swarmKey),
        n.name && e.string.preencode(d, n.name))
    },
    encode(d, n) {
      const o = (n.swarmKey ? 1 : 0) | (n.name ? 2 : 0) | (n.isMobile ? 4 : 0)
      ;(e.uint.encode(d, o),
        n.swarmKey && e.fixed32.encode(d, n.swarmKey),
        n.name && e.string.encode(d, n.name))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        swarmKey: 1 & n ? e.fixed32.decode(d) : null,
        name: 2 & n ? e.string.decode(d) : null,
        isMobile: !!(4 & n),
      }
    },
  },
  ue = e.frame(se),
  le = {
    preencode(e, d) {
      ;(ue.preencode(e, d.profile), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(ue.encode(e, d.profile), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: ue.decode(e), attestation: ce.decode(e) }),
  },
  fe = {
    preencode(e, d) {
      ;($r.preencode(e, d.profile), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;($r.encode(e, d.profile), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: $r.decode(e), attestation: ce.decode(e) }),
  },
  me = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.id),
        e.buffer.preencode(d, n.data),
        e.buffer.preencode(d, n.signature))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.id), e.buffer.encode(d, n.data), e.buffer.encode(d, n.signature))
    },
    decode: (d) => ({
      id: e.fixed32.decode(d),
      data: e.buffer.decode(d),
      signature: e.buffer.decode(d),
    }),
  },
  ye = {
    preencode(d, n) {
      e.fixed32.preencode(d, n.devicePublicKey)
    },
    encode(d, n) {
      e.fixed32.encode(d, n.devicePublicKey)
    },
    decode: (d) => ({ devicePublicKey: e.fixed32.decode(d) }),
  },
  xe = {
    preencode(d, n) {
      ;(ce.preencode(d, n.privateProfileIdentity), e.buffer.preencode(d, n.deviceProof))
    },
    encode(d, n) {
      ;(ce.encode(d, n.privateProfileIdentity), e.buffer.encode(d, n.deviceProof))
    },
    decode: (d) => ({ privateProfileIdentity: ce.decode(d), deviceProof: e.buffer.decode(d) }),
  },
  be = e.frame(fe),
  ke = e.frame(le),
  ve = e.frame(ye),
  ge = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.deviceKey),
        r.preencode(d, n.keyPair),
        be.preencode(d, n.device),
        ke.preencode(d, n.member),
        d.end++,
        n.identity && ve.preencode(d, n.identity))
    },
    encode(d, n) {
      const o = n.identity ? 1 : 0
      ;(e.fixed32.encode(d, n.deviceKey),
        r.encode(d, n.keyPair),
        be.encode(d, n.device),
        ke.encode(d, n.member),
        e.uint.encode(d, o),
        n.identity && ve.encode(d, n.identity))
    },
    decode: (d) => ({
      deviceKey: e.fixed32.decode(d),
      keyPair: r.decode(d),
      device: be.decode(d),
      member: ke.decode(d),
      identity: 1 & e.uint.decode(d) ? ve.decode(d) : null,
    }),
  },
  he = e.frame(ge),
  Ke = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.id),
        he.preencode(d, n.request),
        e.buffer.preencode(d, n.signature))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.id), he.encode(d, n.request), e.buffer.encode(d, n.signature))
    },
    decode: (d) => ({
      id: e.fixed32.decode(d),
      request: he.decode(d),
      signature: e.buffer.decode(d),
    }),
  },
  we = be,
  Ae = ke,
  Pe = {
    preencode(e, d) {
      ;(we.preencode(e, d.device), e.end++, d.member && Ae.preencode(e, d.member))
    },
    encode(d, n) {
      const o = n.member ? 1 : 0
      ;(we.encode(d, n.device), e.uint.encode(d, o), n.member && Ae.encode(d, n.member))
    },
    decode: (d) => ({ device: we.decode(d), member: 1 & e.uint.decode(d) ? Ae.decode(d) : null }),
  },
  Te = e.frame(Ke),
  Se = e.frame(Pe),
  Re = {
    preencode(e, d) {
      ;(e.end++,
        d.withInvitation && Te.preencode(e, d.withInvitation),
        d.withMemberProof && Se.preencode(e, d.withMemberProof))
    },
    encode(d, n) {
      const o = (n.withInvitation ? 1 : 0) | (n.withMemberProof ? 2 : 0)
      ;(e.uint.encode(d, o),
        n.withInvitation && Te.encode(d, n.withInvitation),
        n.withMemberProof && Se.encode(d, n.withMemberProof))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        withInvitation: 1 & n ? Te.decode(d) : null,
        withMemberProof: 2 & n ? Se.decode(d) : null,
      }
    },
  },
  Ce = e.frame(me),
  Fe = e.frame(xe),
  qe = {
    preencode(e, d) {
      ;(Ce.preencode(e, d.signedKeys), e.end++, d.identity && Fe.preencode(e, d.identity))
    },
    encode(d, n) {
      const o = n.identity ? 1 : 0
      ;(Ce.encode(d, n.signedKeys), e.uint.encode(d, o), n.identity && Fe.encode(d, n.identity))
    },
    decode: (d) => ({
      signedKeys: Ce.decode(d),
      identity: 1 & e.uint.decode(d) ? Fe.decode(d) : null,
    }),
  },
  Me = {
    preencode(d, n) {
      ;(d.end++, n.expiration && e.uint.preencode(d, n.expiration))
    },
    encode(d, n) {
      const o =
        (n.expiration ? 1 : 0) |
        (n.requiresConfirmation ? 2 : 0) |
        (n.canModerate ? 4 : 0) |
        (n.canAdmin ? 8 : 0)
      ;(e.uint.encode(d, o), n.expiration && e.uint.encode(d, n.expiration))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        expiration: 1 & n ? e.uint.decode(d) : 0,
        requiresConfirmation: !!(2 & n),
        canModerate: !!(4 & n),
        canAdmin: !!(8 & n),
      }
    },
  },
  De = Ce,
  Le = e.frame(Me),
  Be = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.id),
        De.preencode(d, n.response),
        Le.preencode(d, n.metadata),
        d.end++,
        n.anchor && o.preencode(d, n.anchor))
    },
    encode(d, n) {
      const c = (n.anchor ? 1 : 0) | (n.isActive ? 2 : 0)
      ;(e.fixed32.encode(d, n.id),
        De.encode(d, n.response),
        Le.encode(d, n.metadata),
        e.uint.encode(d, c),
        n.anchor && o.encode(d, n.anchor))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = De.decode(d),
        t = Le.decode(d),
        r = e.uint.decode(d)
      return {
        id: n,
        response: c,
        metadata: t,
        anchor: 1 & r ? o.decode(d) : null,
        isActive: !!(2 & r),
      }
    },
  },
  Ee = _,
  Ie = e.frame(Be),
  je = {
    preencode(e, d) {
      ;(Ee.preencode(e, d.header), Ie.preencode(e, d.invitation))
    },
    encode(e, d) {
      ;(Ee.encode(e, d.header), Ie.encode(e, d.invitation))
    },
    decode: (e) => ({ header: Ee.decode(e), invitation: Ie.decode(e) }),
  },
  Ne = _,
  Ve = {
    preencode(d, n) {
      ;(Ne.preencode(d, n.header), e.fixed32.preencode(d, n.id))
    },
    encode(d, n) {
      ;(Ne.encode(d, n.header), e.fixed32.encode(d, n.id))
    },
    decode: (d) => ({ header: Ne.decode(d), id: e.fixed32.decode(d) }),
  },
  Oe = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.mailbox),
        e.fixed32.preencode(d, n.invitationSeed),
        o.preencode(d, n.anchor))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.mailbox),
        e.fixed32.encode(d, n.invitationSeed),
        o.encode(d, n.anchor))
    },
    decode: (d) => ({
      mailbox: e.fixed32.decode(d),
      invitationSeed: e.fixed32.decode(d),
      anchor: o.decode(d),
    }),
  },
  Je = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.mailbox),
        e.fixed32.preencode(d, n.invitationSeed),
        o.preencode(d, n.anchor),
        e.fixed32.preencode(d, n.identityPublicKey))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.mailbox),
        e.fixed32.encode(d, n.invitationSeed),
        o.encode(d, n.anchor),
        e.fixed32.encode(d, n.identityPublicKey))
    },
    decode: (d) => ({
      mailbox: e.fixed32.decode(d),
      invitationSeed: e.fixed32.decode(d),
      anchor: o.decode(d),
      identityPublicKey: e.fixed32.decode(d),
    }),
  },
  Ue = {
    preencode(d, n) {
      e.fixed32.preencode(d, n.mailbox)
    },
    encode(d, n) {
      e.fixed32.encode(d, n.mailbox)
    },
    decode: (d) => ({ mailbox: e.fixed32.decode(d) }),
  },
  He = e.frame(Oe),
  ze = e.frame(Je),
  Ge = e.frame(Ue),
  Qe = e.array(e.ipv4Address),
  We = {
    preencode(e, d) {
      ;(e.end++,
        d.room && He.preencode(e, d.room),
        d.identity && ze.preencode(e, d.identity),
        d.contact && Ge.preencode(e, d.contact),
        n >= 6 && d.readonly && _r.preencode(e, d.readonly),
        n >= 11 && d.additionalNodes && Qe.preencode(e, d.additionalNodes))
    },
    encode(d, o) {
      const c =
        (o.room ? 1 : 0) |
        (o.identity ? 2 : 0) |
        (o.contact ? 4 : 0) |
        (n >= 6 && o.readonly ? 8 : 0) |
        (n >= 11 && o.additionalNodes ? 16 : 0)
      ;(e.uint.encode(d, c),
        o.room && He.encode(d, o.room),
        o.identity && ze.encode(d, o.identity),
        o.contact && Ge.encode(d, o.contact),
        n >= 6 && o.readonly && _r.encode(d, o.readonly),
        n >= 11 && o.additionalNodes && Qe.encode(d, o.additionalNodes))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        room: 1 & o ? He.decode(d) : null,
        identity: 2 & o ? ze.decode(d) : null,
        contact: 4 & o ? Ge.decode(d) : null,
        readonly: n >= 6 && 8 & o ? _r.decode(d) : null,
        additionalNodes: n >= 11 && 16 & o ? Qe.decode(d) : null,
      }
    },
  },
  Xe = _,
  Ye = {
    preencode(d, n) {
      ;(Xe.preencode(d, n.header), e.buffer.preencode(d, n.blindRequest))
    },
    encode(d, n) {
      ;(Xe.encode(d, n.header), e.buffer.encode(d, n.blindRequest))
    },
    decode: (d) => ({ header: Xe.decode(d), blindRequest: e.buffer.decode(d) }),
  },
  Ze = _,
  $e = {
    preencode(e, d) {
      ;(Ze.preencode(e, d.header), e.end++, d.profile && ei.preencode(e, d.profile))
    },
    encode(d, n) {
      const o = n.profile ? 1 : 0
      ;(Ze.encode(d, n.header), e.uint.encode(d, o), n.profile && ei.encode(d, n.profile))
    },
    decode: (d) => ({ header: Ze.decode(d), profile: 1 & e.uint.decode(d) ? ei.decode(d) : null }),
  },
  _e = { preencode(e, d) {}, encode(e, d) {}, decode: (e) => ({}) },
  ed = _e,
  dd = he,
  nd = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.deviceKey),
        e.fixed32.preencode(d, n.id),
        dd.preencode(d, n.request))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.deviceKey), e.fixed32.encode(d, n.id), dd.encode(d, n.request))
    },
    decode: (d) => ({
      deviceKey: e.fixed32.decode(d),
      id: e.fixed32.decode(d),
      request: dd.decode(d),
    }),
  },
  od = _,
  cd = Fe,
  td = {
    preencode(d, n) {
      ;(od.preencode(d, n.header),
        e.fixed32.preencode(d, n.deviceKey),
        d.end++,
        n.identity && cd.preencode(d, n.identity))
    },
    encode(d, n) {
      const o = n.identity ? 1 : 0
      ;(od.encode(d, n.header),
        e.fixed32.encode(d, n.deviceKey),
        e.uint.encode(d, o),
        n.identity && cd.encode(d, n.identity))
    },
    decode: (d) => ({
      header: od.decode(d),
      deviceKey: e.fixed32.decode(d),
      identity: 1 & e.uint.decode(d) ? cd.decode(d) : null,
    }),
  },
  rd = _,
  id = {
    preencode(d, n) {
      ;(rd.preencode(d, n.header), e.fixed32.preencode(d, n.deviceKey))
    },
    encode(d, n) {
      ;(rd.encode(d, n.header), e.fixed32.encode(d, n.deviceKey))
    },
    decode: (d) => ({ header: rd.decode(d), deviceKey: e.fixed32.decode(d) }),
  },
  ad = e.frame(F),
  sd = ue,
  pd = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key), ad.preencode(d, n.status), sd.preencode(d, n.profile))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.key), ad.encode(d, n.status), sd.encode(d, n.profile))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), status: ad.decode(d), profile: sd.decode(d) }),
  },
  ud = ad,
  ld = ue,
  fd = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key),
        ud.preencode(d, n.status),
        ld.preencode(d, n.profile),
        d.end++,
        n.proofs && di.preencode(d, n.proofs))
    },
    encode(d, n) {
      const o = n.proofs ? 1 : 0
      ;(e.fixed32.encode(d, n.key),
        ud.encode(d, n.status),
        ld.encode(d, n.profile),
        e.uint.encode(d, o),
        n.proofs && di.encode(d, n.proofs))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      status: ud.decode(d),
      profile: ld.decode(d),
      proofs: 1 & e.uint.decode(d) ? di.decode(d) : null,
    }),
  },
  md = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key),
        d.end++,
        n.profileAttestation && e.buffer.preencode(d, n.profileAttestation),
        n.latestReceipt && e.buffer.preencode(d, n.latestReceipt))
    },
    encode(d, n) {
      const o = (n.profileAttestation ? 1 : 0) | (n.latestReceipt ? 2 : 0)
      ;(e.fixed32.encode(d, n.key),
        e.uint.encode(d, o),
        n.profileAttestation && e.buffer.encode(d, n.profileAttestation),
        n.latestReceipt && e.buffer.encode(d, n.latestReceipt))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        o = e.uint.decode(d)
      return {
        key: n,
        profileAttestation: 1 & o ? e.buffer.decode(d) : null,
        latestReceipt: 2 & o ? e.buffer.decode(d) : null,
      }
    },
  },
  yd = _,
  xd = ke,
  bd = {
    preencode(e, d) {
      ;(yd.preencode(e, d.header), xd.preencode(e, d.member))
    },
    encode(e, d) {
      ;(yd.encode(e, d.header), xd.encode(e, d.member))
    },
    decode: (e) => ({ header: yd.decode(e), member: xd.decode(e) }),
  },
  kd = _,
  vd = e.frame(q),
  gd = {
    preencode(d, n) {
      ;(kd.preencode(d, n.header),
        e.fixed32.preencode(d, n.memberKey),
        e.uint.preencode(d, n.key),
        vd.preencode(d, n.status))
    },
    encode(d, n) {
      ;(kd.encode(d, n.header),
        e.fixed32.encode(d, n.memberKey),
        e.uint.encode(d, n.key),
        vd.encode(d, n.status))
    },
    decode: (d) => ({
      header: kd.decode(d),
      memberKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: vd.decode(d),
    }),
  },
  hd = _,
  Kd = {
    preencode(d, n) {
      ;(hd.preencode(d, n.header), e.fixed32.preencode(d, n.key), d.end++)
    },
    encode(d, n) {
      const o = (n.isModerator ? 1 : 0) | (n.isAdmin ? 2 : 0)
      ;(hd.encode(d, n.header), e.fixed32.encode(d, n.key), e.uint.encode(d, o))
    },
    decode(d) {
      const n = hd.decode(d),
        o = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return { header: n, key: o, isModerator: !!(1 & c), isAdmin: !!(2 & c) }
    },
  },
  wd = _,
  Ad = {
    preencode(d, n) {
      ;(wd.preencode(d, n.header), e.fixed32.preencode(d, n.key))
    },
    encode(d, n) {
      ;(wd.encode(d, n.header), e.fixed32.encode(d, n.key))
    },
    decode: (d) => ({ header: wd.decode(d), key: e.fixed32.decode(d) }),
  },
  Pd = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key), e.uint.preencode(d, n.mentions))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.key), e.uint.encode(d, n.mentions))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), mentions: e.uint.decode(d) }),
  },
  Td = {
    preencode(d, n) {
      ;(d.end++, n.memberKey && e.fixed32.preencode(d, n.memberKey))
    },
    encode(d, n) {
      const o = n.memberKey ? 1 : 0
      ;(e.uint.encode(d, o), n.memberKey && e.fixed32.encode(d, n.memberKey))
    },
    decode: (d) => ({ memberKey: 1 & e.uint.decode(d) ? e.fixed32.decode(d) : null }),
  },
  Sd = Td,
  Rd = {
    preencode(d, n) {
      ;(d.end++, n.from && e.string.preencode(d, n.from), n.to && e.string.preencode(d, n.to))
    },
    encode(d, n) {
      const o = (n.from ? 1 : 0) | (n.to ? 2 : 0)
      ;(e.uint.encode(d, o), n.from && e.string.encode(d, n.from), n.to && e.string.encode(d, n.to))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return { from: 1 & n ? e.string.decode(d) : null, to: 2 & n ? e.string.decode(d) : null }
    },
  },
  Cd = e.frame(Td),
  Fd = e.frame(Sd),
  qd = e.frame(Rd),
  Md = {
    preencode(d, o) {
      const c =
        (o.memberJoined ? 1 : 0) |
        (o.memberLeft ? 2 : 0) |
        (o.titleChanged ? 4 : 0) |
        (o.callStarted ? 8 : 0) |
        (o.callHangup ? 16 : 0) |
        (o.callMissed ? 32 : 0) |
        (n >= 3 && o.roomAvatarChanged ? 64 : 0) |
        (n >= 3 && o.invitationCreated ? 128 : 0) |
        (n >= 3 && o.memberRemoved ? 256 : 0) |
        (n >= 18 && o.locationShared ? 512 : 0)
      ;(e.uint.preencode(d, c),
        o.memberJoined && Cd.preencode(d, o.memberJoined),
        o.memberLeft && Fd.preencode(d, o.memberLeft),
        o.titleChanged && qd.preencode(d, o.titleChanged),
        n >= 3 && o.memberRemoved && ni.preencode(d, o.memberRemoved),
        n >= 18 && o.locationShared && oi.preencode(d, o.locationShared))
    },
    encode(d, o) {
      const c =
        (o.memberJoined ? 1 : 0) |
        (o.memberLeft ? 2 : 0) |
        (o.titleChanged ? 4 : 0) |
        (o.callStarted ? 8 : 0) |
        (o.callHangup ? 16 : 0) |
        (o.callMissed ? 32 : 0) |
        (n >= 3 && o.roomAvatarChanged ? 64 : 0) |
        (n >= 3 && o.invitationCreated ? 128 : 0) |
        (n >= 3 && o.memberRemoved ? 256 : 0) |
        (n >= 18 && o.locationShared ? 512 : 0)
      ;(e.uint.encode(d, c),
        o.memberJoined && Cd.encode(d, o.memberJoined),
        o.memberLeft && Fd.encode(d, o.memberLeft),
        o.titleChanged && qd.encode(d, o.titleChanged),
        n >= 3 && o.memberRemoved && ni.encode(d, o.memberRemoved),
        n >= 18 && o.locationShared && oi.encode(d, o.locationShared))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        memberJoined: 1 & o ? Cd.decode(d) : null,
        memberLeft: 2 & o ? Fd.decode(d) : null,
        titleChanged: 4 & o ? qd.decode(d) : null,
        callStarted: !!(8 & o),
        callHangup: !!(16 & o),
        callMissed: !!(32 & o),
        roomAvatarChanged: n >= 3 && !!(64 & o),
        invitationCreated: n >= 3 && !!(128 & o),
        memberRemoved: n >= 3 && 256 & o ? ni.decode(d) : null,
        locationShared: n >= 18 && 512 & o ? oi.decode(d) : null,
      }
    },
  },
  Dd = {
    preencode(e, d) {
      ;(e.end++, n >= 18 && d.locationShared && ci.preencode(e, d.locationShared))
    },
    encode(d, o) {
      const c =
        (o.callStarted ? 1 : 0) |
        (o.callHangup ? 2 : 0) |
        (o.callMissed ? 4 : 0) |
        (n >= 18 && o.locationShared ? 8 : 0)
      ;(e.uint.encode(d, c), n >= 18 && o.locationShared && ci.encode(d, o.locationShared))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        callStarted: !!(1 & o),
        callHangup: !!(2 & o),
        callMissed: !!(4 & o),
        locationShared: n >= 18 && 8 & o ? ci.decode(d) : null,
      }
    },
  },
  Ld = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.start), e.uint.preencode(d, n.length))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.start), e.uint.encode(d, n.length))
    },
    decode: (d) => ({ start: e.uint.decode(d), length: e.uint.decode(d) }),
  },
  Bd = e.frame(Ld),
  Ed = {
    preencode(d, n) {
      ;(Bd.preencode(d, n.range), e.string.preencode(d, n.content))
    },
    encode(d, n) {
      ;(Bd.encode(d, n.range), e.string.encode(d, n.content))
    },
    decode: (d) => ({ range: Bd.decode(d), content: e.string.decode(d) }),
  },
  Id = Bd,
  jd = {
    preencode(d, n) {
      ;(Id.preencode(d, n.range), e.fixed32.preencode(d, n.memberKey))
    },
    encode(d, n) {
      ;(Id.encode(d, n.range), e.fixed32.encode(d, n.memberKey))
    },
    decode: (d) => ({ range: Id.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  Nd = h,
  Vd = e.array(e.uint),
  Od = {
    preencode(d, o) {
      ;(d.end++,
        o.title && e.string.preencode(d, o.title),
        o.description && e.string.preencode(d, o.description),
        o.file && Nd.preencode(d, o.file),
        n >= 7 && o.files && Vd.preencode(d, o.files))
    },
    encode(d, o) {
      const c =
        (o.title ? 1 : 0) | (o.description ? 2 : 0) | (o.file ? 4 : 0) | (n >= 7 && o.files ? 8 : 0)
      ;(e.uint.encode(d, c),
        o.title && e.string.encode(d, o.title),
        o.description && e.string.encode(d, o.description),
        o.file && Nd.encode(d, o.file),
        n >= 7 && o.files && Vd.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 ? Nd.decode(d) : null,
        files: n >= 7 && 8 & o ? Vd.decode(d) : null,
      }
    },
  },
  Jd = Bd,
  Ud = e.frame(Od),
  Hd = {
    preencode(d, n) {
      ;(Jd.preencode(d, n.range),
        e.string.preencode(d, n.url),
        d.end++,
        n.preview && Ud.preencode(d, n.preview))
    },
    encode(d, n) {
      const o = n.preview ? 1 : 0
      ;(Jd.encode(d, n.range),
        e.string.encode(d, n.url),
        e.uint.encode(d, o),
        n.preview && Ud.encode(d, n.preview))
    },
    decode: (d) => ({
      range: Jd.decode(d),
      url: e.string.decode(d),
      preview: 1 & e.uint.decode(d) ? Ud.decode(d) : null,
    }),
  },
  zd = e.array(e.frame(jd)),
  Gd = e.array(e.frame(Hd)),
  Qd = Gd,
  Wd = e.array(e.frame(Ld)),
  Xd = Wd,
  Yd = Wd,
  Zd = e.array(e.frame(Ed)),
  $d = Wd,
  _d = Wd,
  en = {
    preencode(d, o) {
      const c =
        (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) |
        (n >= 11 && o.translation ? 512 : 0)
      ;(e.uint.preencode(d, c),
        o.mention && zd.preencode(d, o.mention),
        o.httpLink && Gd.preencode(d, o.httpLink),
        o.pearLink && Qd.preencode(d, o.pearLink),
        o.bold && Wd.preencode(d, o.bold),
        o.italic && Xd.preencode(d, o.italic),
        o.code && Yd.preencode(d, o.code),
        o.emoji && Zd.preencode(d, o.emoji),
        o.codeBlock && $d.preencode(d, o.codeBlock),
        o.strike && _d.preencode(d, o.strike),
        n >= 11 && o.translation && ti.preencode(d, o.translation))
    },
    encode(d, o) {
      const c =
        (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) |
        (n >= 11 && o.translation ? 512 : 0)
      ;(e.uint.encode(d, c),
        o.mention && zd.encode(d, o.mention),
        o.httpLink && Gd.encode(d, o.httpLink),
        o.pearLink && Qd.encode(d, o.pearLink),
        o.bold && Wd.encode(d, o.bold),
        o.italic && Xd.encode(d, o.italic),
        o.code && Yd.encode(d, o.code),
        o.emoji && Zd.encode(d, o.emoji),
        o.codeBlock && $d.encode(d, o.codeBlock),
        o.strike && _d.encode(d, o.strike),
        n >= 11 && o.translation && ti.encode(d, o.translation))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        mention: 1 & o ? zd.decode(d) : null,
        httpLink: 2 & o ? Gd.decode(d) : null,
        pearLink: 4 & o ? Qd.decode(d) : null,
        bold: 8 & o ? Wd.decode(d) : null,
        italic: 16 & o ? Xd.decode(d) : null,
        code: 32 & o ? Yd.decode(d) : null,
        emoji: 64 & o ? Zd.decode(d) : null,
        codeBlock: 128 & o ? $d.decode(d) : null,
        strike: 256 & o ? _d.decode(d) : null,
        translation: n >= 11 && 512 & o ? ti.decode(d) : null,
      }
    },
  },
  dn = e.array(e.frame(g)),
  nn = e.frame(en),
  on = e.frame(Dd),
  cn = {
    preencode(d, n) {
      ;(d.end++,
        n.text && e.string.preencode(d, n.text),
        n.files && dn.preencode(d, n.files),
        n.display && nn.preencode(d, n.display),
        n.replyTo && c.preencode(d, n.replyTo),
        n.parent && c.preencode(d, n.parent),
        n.event && on.preencode(d, n.event))
    },
    encode(d, o) {
      const t =
        (o.text ? 1 : 0) |
        (o.files ? 2 : 0) |
        (o.display ? 4 : 0) |
        (o.replyTo ? 8 : 0) |
        (o.parent ? 16 : 0) |
        (o.event ? 32 : 0) |
        (n >= 18 && o.forwarded ? 64 : 0)
      ;(e.uint.encode(d, t),
        o.text && e.string.encode(d, o.text),
        o.files && dn.encode(d, o.files),
        o.display && nn.encode(d, o.display),
        o.replyTo && c.encode(d, o.replyTo),
        o.parent && c.encode(d, o.parent),
        o.event && on.encode(d, o.event))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        text: 1 & o ? e.string.decode(d) : null,
        files: 2 & o ? dn.decode(d) : null,
        display: 4 & o ? nn.decode(d) : null,
        replyTo: 8 & o ? c.decode(d) : null,
        parent: 16 & o ? c.decode(d) : null,
        event: 32 & o ? on.decode(d) : null,
        forwarded: n >= 18 && !!(64 & o),
      }
    },
  },
  tn = Vd,
  rn = nn,
  an = {
    preencode(d, n) {
      ;(d.end++,
        n.text && e.string.preencode(d, n.text),
        n.files && tn.preencode(d, n.files),
        n.display && rn.preencode(d, n.display),
        n.replyTo && c.preencode(d, n.replyTo),
        n.parent && c.preencode(d, n.parent))
    },
    encode(d, o) {
      const t =
        (o.text ? 1 : 0) |
        (o.files ? 2 : 0) |
        (o.display ? 4 : 0) |
        (o.replyTo ? 8 : 0) |
        (o.parent ? 16 : 0) |
        (n >= 18 && o.forwarded ? 32 : 0)
      ;(e.uint.encode(d, t),
        o.text && e.string.encode(d, o.text),
        o.files && tn.encode(d, o.files),
        o.display && rn.encode(d, o.display),
        o.replyTo && c.encode(d, o.replyTo),
        o.parent && c.encode(d, o.parent))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        text: 1 & o ? e.string.decode(d) : null,
        files: 2 & o ? tn.decode(d) : null,
        display: 4 & o ? rn.decode(d) : null,
        replyTo: 8 & o ? c.decode(d) : null,
        parent: 16 & o ? c.decode(d) : null,
        forwarded: n >= 18 && !!(32 & o),
      }
    },
  },
  sn = dn,
  pn = nn,
  un = {
    preencode(d, n) {
      ;(d.end++,
        n.text && e.string.preencode(d, n.text),
        n.files && sn.preencode(d, n.files),
        n.display && pn.preencode(d, n.display),
        n.replyTo && c.preencode(d, n.replyTo),
        n.parent && c.preencode(d, n.parent))
    },
    encode(d, o) {
      const t =
        (o.text ? 1 : 0) |
        (o.files ? 2 : 0) |
        (o.display ? 4 : 0) |
        (o.replyTo ? 8 : 0) |
        (o.parent ? 16 : 0) |
        (n >= 18 && o.forwarded ? 32 : 0)
      ;(e.uint.encode(d, t),
        o.text && e.string.encode(d, o.text),
        o.files && sn.encode(d, o.files),
        o.display && pn.encode(d, o.display),
        o.replyTo && c.encode(d, o.replyTo),
        o.parent && c.encode(d, o.parent))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        text: 1 & o ? e.string.decode(d) : null,
        files: 2 & o ? sn.decode(d) : null,
        display: 4 & o ? pn.decode(d) : null,
        replyTo: 8 & o ? c.decode(d) : null,
        parent: 16 & o ? c.decode(d) : null,
        forwarded: n >= 18 && !!(32 & o),
      }
    },
  },
  ln = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      const o = (n.isEdited ? 1 : 0) | (n.isDeleted ? 2 : 0) | (n.isPinned ? 4 : 0)
      e.uint.encode(d, o)
    },
    decode(d) {
      const n = e.uint.decode(d)
      return { isEdited: !!(1 & n), isDeleted: !!(2 & n), isPinned: !!(4 & n) }
    },
  },
  fn = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.thread), e.uint.preencode(d, n.index))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.thread), e.uint.encode(d, n.index))
    },
    decode: (d) => ({ thread: e.uint.decode(d), index: e.uint.decode(d) }),
  },
  mn = e.frame(O),
  yn = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.id),
        e.uint.preencode(d, n.count),
        d.end++,
        n.parent && c.preencode(d, n.parent),
        n.stats && mn.preencode(d, n.stats))
    },
    encode(d, n) {
      const o = (n.parent ? 1 : 0) | (n.stats ? 2 : 0)
      ;(e.uint.encode(d, n.id),
        e.uint.encode(d, n.count),
        e.uint.encode(d, o),
        n.parent && c.encode(d, n.parent),
        n.stats && mn.encode(d, n.stats))
    },
    decode(d) {
      const n = e.uint.decode(d),
        o = e.uint.decode(d),
        t = e.uint.decode(d)
      return {
        id: n,
        count: o,
        parent: 1 & t ? c.decode(d) : null,
        stats: 2 & t ? mn.decode(d) : null,
      }
    },
  },
  xn = e.frame(ln),
  bn = e.frame(an),
  kn = e.frame(Md),
  vn = {
    preencode(d, n) {
      ;(fn.preencode(d, n.id),
        c.preencode(d, n.oplog),
        e.uint.preencode(d, n.clock),
        e.uint.preencode(d, n.timestamp),
        d.end++,
        n.editedAt && e.uint.preencode(d, n.editedAt),
        xn.preencode(d, n.status),
        n.message && bn.preencode(d, n.message),
        n.event && kn.preencode(d, n.event))
    },
    encode(d, n) {
      const o = (n.editedAt ? 1 : 0) | (n.message ? 2 : 0) | (n.event ? 4 : 0)
      ;(fn.encode(d, n.id),
        c.encode(d, n.oplog),
        e.uint.encode(d, n.clock),
        e.uint.encode(d, n.timestamp),
        e.uint.encode(d, o),
        n.editedAt && e.uint.encode(d, n.editedAt),
        xn.encode(d, n.status),
        n.message && bn.encode(d, n.message),
        n.event && kn.encode(d, n.event))
    },
    decode(d) {
      const n = fn.decode(d),
        o = c.decode(d),
        t = e.uint.decode(d),
        r = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        id: n,
        oplog: o,
        clock: t,
        timestamp: r,
        editedAt: 1 & i ? e.uint.decode(d) : 0,
        status: xn.decode(d),
        message: 2 & i ? bn.decode(d) : null,
        event: 4 & i ? kn.decode(d) : null,
      }
    },
  },
  gn = xn,
  hn = e.frame(un),
  Kn = kn,
  wn = {
    preencode(d, n) {
      ;(fn.preencode(d, n.id),
        c.preencode(d, n.oplog),
        e.uint.preencode(d, n.clock),
        e.uint.preencode(d, n.timestamp),
        d.end++,
        n.editedAt && e.uint.preencode(d, n.editedAt),
        gn.preencode(d, n.status),
        n.message && hn.preencode(d, n.message),
        n.event && Kn.preencode(d, n.event))
    },
    encode(d, n) {
      const o = (n.editedAt ? 1 : 0) | (n.message ? 2 : 0) | (n.event ? 4 : 0)
      ;(fn.encode(d, n.id),
        c.encode(d, n.oplog),
        e.uint.encode(d, n.clock),
        e.uint.encode(d, n.timestamp),
        e.uint.encode(d, o),
        n.editedAt && e.uint.encode(d, n.editedAt),
        gn.encode(d, n.status),
        n.message && hn.encode(d, n.message),
        n.event && Kn.encode(d, n.event))
    },
    decode(d) {
      const n = fn.decode(d),
        o = c.decode(d),
        t = e.uint.decode(d),
        r = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        id: n,
        oplog: o,
        clock: t,
        timestamp: r,
        editedAt: 1 & i ? e.uint.decode(d) : 0,
        status: gn.decode(d),
        message: 2 & i ? hn.decode(d) : null,
        event: 4 & i ? Kn.decode(d) : null,
      }
    },
  },
  An = _,
  Pn = e.frame(cn),
  Tn = {
    preencode(e, d) {
      ;(An.preencode(e, d.header), Pn.preencode(e, d.message))
    },
    encode(e, d) {
      ;(An.encode(e, d.header), Pn.encode(e, d.message))
    },
    decode: (e) => ({ header: An.decode(e), message: Pn.decode(e) }),
  },
  Sn = _,
  Rn = {
    preencode(e, d) {
      ;(Sn.preencode(e, d.header), c.preencode(e, d.oplog))
    },
    encode(e, d) {
      ;(Sn.encode(e, d.header), c.encode(e, d.oplog))
    },
    decode: (e) => ({ header: Sn.decode(e), oplog: c.decode(e) }),
  },
  Cn = _,
  Fn = Pn,
  qn = {
    preencode(e, d) {
      ;(Cn.preencode(e, d.header), c.preencode(e, d.oplog), Fn.preencode(e, d.message))
    },
    encode(e, d) {
      ;(Cn.encode(e, d.header), c.encode(e, d.oplog), Fn.encode(e, d.message))
    },
    decode: (e) => ({ header: Cn.decode(e), oplog: c.decode(e), message: Fn.decode(e) }),
  },
  Mn = _,
  Dn = {
    preencode(e, d) {
      ;(Mn.preencode(e, d.header), c.preencode(e, d.oplog), e.end++)
    },
    encode(d, n) {
      const o = n.isPinned ? 1 : 0
      ;(Mn.encode(d, n.header), c.encode(d, n.oplog), e.uint.encode(d, o))
    },
    decode: (d) => ({
      header: Mn.decode(d),
      oplog: c.decode(d),
      isPinned: !!(1 & e.uint.decode(d)),
    }),
  },
  Ln = {
    preencode(d, n) {
      ;(fn.preencode(d, n.id),
        e.fixed32.preencode(d, n.sender),
        e.uint.preencode(d, n.clock),
        e.string.preencode(d, n.reaction))
    },
    encode(d, n) {
      ;(fn.encode(d, n.id),
        e.fixed32.encode(d, n.sender),
        e.uint.encode(d, n.clock),
        e.string.encode(d, n.reaction))
    },
    decode: (d) => ({
      id: fn.decode(d),
      sender: e.fixed32.decode(d),
      clock: e.uint.decode(d),
      reaction: e.string.decode(d),
    }),
  },
  Bn = {
    preencode(d, n) {
      ;(e.string.preencode(d, n.text), e.uint.preencode(d, n.count))
    },
    encode(d, n) {
      ;(e.string.encode(d, n.text), e.uint.encode(d, n.count))
    },
    decode: (d) => ({ text: e.string.decode(d), count: e.uint.decode(d) }),
  },
  En = e.array(e.frame(Bn)),
  In = {
    preencode(d, o) {
      ;(fn.preencode(d, o.id),
        e.uint.preencode(d, o.total),
        En.preencode(d, o.reactions),
        d.end++,
        n >= 11 && o.editedAt && e.uint.preencode(d, o.editedAt))
    },
    encode(d, o) {
      const c = n >= 11 && o.editedAt ? 1 : 0
      ;(fn.encode(d, o.id),
        e.uint.encode(d, o.total),
        En.encode(d, o.reactions),
        e.uint.encode(d, c),
        n >= 11 && o.editedAt && e.uint.encode(d, o.editedAt))
    },
    decode(d) {
      const o = fn.decode(d),
        c = e.uint.decode(d),
        t = En.decode(d),
        r = d.start < d.end ? e.uint.decode(d) : 0
      return { id: o, total: c, reactions: t, editedAt: n >= 11 && 1 & r ? e.uint.decode(d) : 0 }
    },
  },
  jn = _,
  Nn = {
    preencode(d, n) {
      ;(jn.preencode(d, n.header), c.preencode(d, n.oplog), e.string.preencode(d, n.reaction))
    },
    encode(d, n) {
      ;(jn.encode(d, n.header), c.encode(d, n.oplog), e.string.encode(d, n.reaction))
    },
    decode: (d) => ({ header: jn.decode(d), oplog: c.decode(d), reaction: e.string.decode(d) }),
  },
  Vn = _,
  On = {
    preencode(d, n) {
      ;(Vn.preencode(d, n.header), c.preencode(d, n.oplog), e.string.preencode(d, n.reaction))
    },
    encode(d, n) {
      ;(Vn.encode(d, n.header), c.encode(d, n.oplog), e.string.encode(d, n.reaction))
    },
    decode: (d) => ({ header: Vn.decode(d), oplog: c.decode(d), reaction: e.string.decode(d) }),
  },
  Jn = _,
  Un = e.frame(Z),
  Hn = {
    preencode(d, n) {
      ;(Jn.preencode(d, n.header), e.uint.preencode(d, n.key), Un.preencode(d, n.config))
    },
    encode(d, n) {
      ;(Jn.encode(d, n.header), e.uint.encode(d, n.key), Un.encode(d, n.config))
    },
    decode: (d) => ({ header: Jn.decode(d), key: e.uint.decode(d), config: Un.decode(d) }),
  },
  zn = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.memberKey),
        e.string.preencode(d, n.displayName),
        d.end++,
        n.avatar && ri.preencode(d, n.avatar))
    },
    encode(d, n) {
      const o = n.avatar ? 1 : 0
      ;(e.fixed32.encode(d, n.memberKey),
        e.string.encode(d, n.displayName),
        e.uint.encode(d, o),
        n.avatar && ri.encode(d, n.avatar))
    },
    decode: (d) => ({
      memberKey: e.fixed32.decode(d),
      displayName: e.string.decode(d),
      avatar: 1 & e.uint.decode(d) ? ri.decode(d) : null,
    }),
  },
  Gn = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key), d.end++, n.username && e.string.preencode(d, n.username))
    },
    encode(d, n) {
      const o = n.username ? 1 : 0
      ;(e.fixed32.encode(d, n.key),
        e.uint.encode(d, o),
        n.username && e.string.encode(d, n.username))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      username: 1 & e.uint.decode(d) ? e.string.decode(d) : null,
    }),
  },
  Qn = e.frame(Gn),
  Wn = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.publicKey),
        d.end++,
        n.discoveryCoreKey && e.fixed32.preencode(d, n.discoveryCoreKey),
        n.userRegistry && Qn.preencode(d, n.userRegistry))
    },
    encode(d, n) {
      const o = (n.discoveryCoreKey ? 1 : 0) | (n.userRegistry ? 2 : 0)
      ;(e.fixed32.encode(d, n.publicKey),
        e.uint.encode(d, o),
        n.discoveryCoreKey && e.fixed32.encode(d, n.discoveryCoreKey),
        n.userRegistry && Qn.encode(d, n.userRegistry))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        o = e.uint.decode(d)
      return {
        publicKey: n,
        discoveryCoreKey: 1 & o ? e.fixed32.decode(d) : null,
        userRegistry: 2 & o ? Qn.decode(d) : null,
      }
    },
  },
  Xn = _,
  Yn = e.frame(Q),
  Zn = e.frame(W),
  $n = Un,
  _n = e.frame(Wn),
  eo = be,
  no = e.array(e.frame(le)),
  oo = {
    preencode(e, d) {
      ;(Xn.preencode(e, d.header),
        Yn.preencode(e, d.digest),
        Zn.preencode(e, d.capabilities),
        e.end++,
        d.config && $n.preencode(e, d.config),
        d.identity && _n.preencode(e, d.identity),
        d.bootstrapDevice && eo.preencode(e, d.bootstrapDevice),
        d.initialMembers && no.preencode(e, d.initialMembers))
    },
    encode(d, n) {
      const o =
        (n.config ? 1 : 0) |
        (n.identity ? 2 : 0) |
        (n.bootstrapDevice ? 4 : 0) |
        (n.initialMembers ? 8 : 0)
      ;(Xn.encode(d, n.header),
        Yn.encode(d, n.digest),
        Zn.encode(d, n.capabilities),
        e.uint.encode(d, o),
        n.config && $n.encode(d, n.config),
        n.identity && _n.encode(d, n.identity),
        n.bootstrapDevice && eo.encode(d, n.bootstrapDevice),
        n.initialMembers && no.encode(d, n.initialMembers))
    },
    decode(d) {
      const n = Xn.decode(d),
        o = Yn.decode(d),
        c = Zn.decode(d),
        t = e.uint.decode(d)
      return {
        header: n,
        digest: o,
        capabilities: c,
        config: 1 & t ? $n.decode(d) : null,
        identity: 2 & t ? _n.decode(d) : null,
        bootstrapDevice: 4 & t ? eo.decode(d) : null,
        initialMembers: 8 & t ? no.decode(d) : null,
      }
    },
  },
  co = _,
  to = {
    preencode(d, n) {
      ;(co.preencode(d, n.header), e.uint.preencode(d, n.version))
    },
    encode(d, n) {
      ;(co.encode(d, n.header), e.uint.encode(d, n.version))
    },
    decode: (d) => ({ header: co.decode(d), version: e.uint.decode(d) }),
  },
  ro = _,
  io = G,
  ao = {
    preencode(d, n) {
      ;(ro.preencode(d, n.header), e.uint.preencode(d, n.key), io.preencode(d, n.settings))
    },
    encode(d, n) {
      ;(ro.encode(d, n.header), e.uint.encode(d, n.key), io.encode(d, n.settings))
    },
    decode: (d) => ({ header: ro.decode(d), key: e.uint.decode(d), settings: io.decode(d) }),
  },
  so = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.memberKey),
        ii.preencode(d, n.status),
        d.end++,
        n.mailbox && e.fixed32.preencode(d, n.mailbox),
        n.roomKey && e.fixed32.preencode(d, n.roomKey))
    },
    encode(d, n) {
      const o = (n.mailbox ? 1 : 0) | (n.roomKey ? 2 : 0)
      ;(e.fixed32.encode(d, n.memberKey),
        ii.encode(d, n.status),
        e.uint.encode(d, o),
        n.mailbox && e.fixed32.encode(d, n.mailbox),
        n.roomKey && e.fixed32.encode(d, n.roomKey))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        o = ii.decode(d),
        c = e.uint.decode(d)
      return {
        memberKey: n,
        status: o,
        mailbox: 1 & c ? e.fixed32.decode(d) : null,
        roomKey: 2 & c ? e.fixed32.decode(d) : null,
      }
    },
  },
  po = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.roomKey),
        e.buffer.preencode(d, n.encryptionKey),
        e.fixed32.preencode(d, n.seed),
        o.preencode(d, n.initiator),
        e.fixed32.preencode(d, n.fastForwardTo))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.roomKey),
        e.buffer.encode(d, n.encryptionKey),
        e.fixed32.encode(d, n.seed),
        o.encode(d, n.initiator),
        e.fixed32.encode(d, n.fastForwardTo))
    },
    decode: (d) => ({
      roomKey: e.fixed32.decode(d),
      encryptionKey: e.buffer.decode(d),
      seed: e.fixed32.decode(d),
      initiator: o.decode(d),
      fastForwardTo: e.fixed32.decode(d),
    }),
  },
  uo = e.array(e.frame(po)),
  lo = Y,
  fo = {
    preencode(e, d) {
      ;(uo.preencode(e, d.sharedRooms), lo.preencode(e, d.blockedContacts))
    },
    encode(e, d) {
      ;(uo.encode(e, d.sharedRooms), lo.encode(e, d.blockedContacts))
    },
    decode: (e) => ({ sharedRooms: uo.decode(e), blockedContacts: lo.decode(e) }),
  },
  mo = _n,
  yo = {
    preencode(e, d) {
      mo.preencode(e, d.identity)
    },
    encode(e, d) {
      mo.encode(e, d.identity)
    },
    decode: (e) => ({ identity: mo.decode(e) }),
  },
  xo = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.rooms), e.uint.preencode(d, n.contacts))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.rooms), e.uint.encode(d, n.contacts))
    },
    decode: (d) => ({ rooms: e.uint.decode(d), contacts: e.uint.decode(d) }),
  },
  bo = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.rooms), e.uint.preencode(d, n.contactRequests))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.rooms), e.uint.encode(d, n.contactRequests))
    },
    decode: (d) => ({ rooms: e.uint.decode(d), contactRequests: e.uint.decode(d) }),
  },
  ko = {
    preencode(d, n) {
      e.buffer.preencode(d, n.entropy)
    },
    encode(d, n) {
      e.buffer.encode(d, n.entropy)
    },
    decode: (d) => ({ entropy: e.buffer.decode(d) }),
  },
  vo = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.publicKey),
        e.fixed32.preencode(d, n.devicePublicKey),
        e.fixed32.preencode(d, n.writerKey))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.publicKey),
        e.fixed32.encode(d, n.devicePublicKey),
        e.fixed32.encode(d, n.writerKey))
    },
    decode: (d) => ({
      publicKey: e.fixed32.decode(d),
      devicePublicKey: e.fixed32.decode(d),
      writerKey: e.fixed32.decode(d),
    }),
  },
  go = e.frame(vo),
  ho = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.id),
        e.fixed32.preencode(d, n.invitationSeed),
        e.fixed32.preencode(d, n.mailbox),
        r.preencode(d, n.responseKeyPair),
        o.preencode(d, n.initiator),
        o.preencode(d, n.inviter),
        d.end++,
        n.identity && go.preencode(d, n.identity))
    },
    encode(d, n) {
      const c = n.identity ? 1 : 0
      ;(e.fixed32.encode(d, n.id),
        e.fixed32.encode(d, n.invitationSeed),
        e.fixed32.encode(d, n.mailbox),
        r.encode(d, n.responseKeyPair),
        o.encode(d, n.initiator),
        o.encode(d, n.inviter),
        e.uint.encode(d, c),
        n.identity && go.encode(d, n.identity))
    },
    decode: (d) => ({
      id: e.fixed32.decode(d),
      invitationSeed: e.fixed32.decode(d),
      mailbox: e.fixed32.decode(d),
      responseKeyPair: r.decode(d),
      initiator: o.decode(d),
      inviter: o.decode(d),
      identity: 1 & e.uint.decode(d) ? go.decode(d) : null,
    }),
  },
  Ko = _,
  wo = {
    preencode(d, n) {
      ;(Ko.preencode(d, n.header), e.buffer.preencode(d, n.blindResponse))
    },
    encode(d, n) {
      ;(Ko.encode(d, n.header), e.buffer.encode(d, n.blindResponse))
    },
    decode: (d) => ({ header: Ko.decode(d), blindResponse: e.buffer.decode(d) }),
  },
  Ao = _,
  Po = e.frame(ho),
  To = {
    preencode(e, d) {
      ;(Ao.preencode(e, d.header), Po.preencode(e, d.invitation))
    },
    encode(e, d) {
      ;(Ao.encode(e, d.header), Po.encode(e, d.invitation))
    },
    decode: (e) => ({ header: Ao.decode(e), invitation: Po.decode(e) }),
  },
  So = _,
  Ro = {
    preencode(d, n) {
      ;(So.preencode(d, n.header), e.fixed32.preencode(d, n.id))
    },
    encode(d, n) {
      ;(So.encode(d, n.header), e.fixed32.encode(d, n.id))
    },
    decode: (d) => ({ header: So.decode(d), id: e.fixed32.decode(d) }),
  },
  Co = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.publicKey),
        e.fixed32.preencode(d, n.devicePublicKey),
        d.end++,
        n.privateProfileKey && e.fixed32.preencode(d, n.privateProfileKey),
        n.deviceKeyPair && r.preencode(d, n.deviceKeyPair),
        e.buffer.preencode(d, n.deviceProof))
    },
    encode(d, n) {
      const o = (n.privateProfileKey ? 1 : 0) | (n.deviceKeyPair ? 2 : 0)
      ;(e.fixed32.encode(d, n.publicKey),
        e.fixed32.encode(d, n.devicePublicKey),
        e.uint.encode(d, o),
        n.privateProfileKey && e.fixed32.encode(d, n.privateProfileKey),
        n.deviceKeyPair && r.encode(d, n.deviceKeyPair),
        e.buffer.encode(d, n.deviceProof))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        o = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        publicKey: n,
        devicePublicKey: o,
        privateProfileKey: 1 & c ? e.fixed32.decode(d) : null,
        deviceKeyPair: 2 & c ? r.decode(d) : null,
        deviceProof: e.buffer.decode(d),
      }
    },
  },
  Fo = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const c =
        (o.isActive ? 1 : 0) |
        (o.isFullyMuted ? 2 : 0) |
        (o.isMentionsOnlyMuted ? 4 : 0) |
        (n >= 9 && o.isReadOnly ? 8 : 0) |
        (n >= 18 && o.isFavorite ? 16 : 0)
      e.uint.encode(d, c)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        isActive: !!(1 & o),
        isFullyMuted: !!(2 & o),
        isMentionsOnlyMuted: !!(4 & o),
        isReadOnly: n >= 9 && !!(8 & o),
        isFavorite: n >= 18 && !!(16 & o),
      }
    },
  },
  qo = e.frame(Fo),
  Mo = e.frame(Co),
  Do = go,
  Lo = {
    preencode(d, c) {
      ;(e.fixed32.preencode(d, c.roomKey),
        e.buffer.preencode(d, c.encryptionKey),
        e.fixed32.preencode(d, c.mailbox),
        qo.preencode(d, c.status),
        e.uint.preencode(d, c.clock),
        d.end++,
        c.initiator && o.preencode(d, c.initiator),
        c.fastForwardTo && e.fixed32.preencode(d, c.fastForwardTo),
        c.identitySwap && Mo.preencode(d, c.identitySwap),
        n >= 6 && c.identitySwapV2 && Do.preencode(d, c.identitySwapV2),
        n >= 10 && c.contact && e.fixed32.preencode(d, c.contact))
    },
    encode(d, c) {
      const t =
        (c.initiator ? 1 : 0) |
        (c.fastForwardTo ? 2 : 0) |
        (c.identitySwap ? 4 : 0) |
        (n >= 6 && c.identitySwapV2 ? 8 : 0) |
        (n >= 10 && c.contact ? 16 : 0)
      ;(e.fixed32.encode(d, c.roomKey),
        e.buffer.encode(d, c.encryptionKey),
        e.fixed32.encode(d, c.mailbox),
        qo.encode(d, c.status),
        e.uint.encode(d, c.clock),
        e.uint.encode(d, t),
        c.initiator && o.encode(d, c.initiator),
        c.fastForwardTo && e.fixed32.encode(d, c.fastForwardTo),
        c.identitySwap && Mo.encode(d, c.identitySwap),
        n >= 6 && c.identitySwapV2 && Do.encode(d, c.identitySwapV2),
        n >= 10 && c.contact && e.fixed32.encode(d, c.contact))
    },
    decode(d) {
      const c = e.fixed32.decode(d),
        t = e.buffer.decode(d),
        r = e.fixed32.decode(d),
        i = qo.decode(d),
        a = e.uint.decode(d),
        s = e.uint.decode(d)
      return {
        roomKey: c,
        encryptionKey: t,
        mailbox: r,
        status: i,
        clock: a,
        initiator: 1 & s ? o.decode(d) : null,
        fastForwardTo: 2 & s ? e.fixed32.decode(d) : null,
        identitySwap: 4 & s ? Mo.decode(d) : null,
        identitySwapV2: n >= 6 && 8 & s ? Do.decode(d) : null,
        contact: n >= 10 && 16 & s ? e.fixed32.decode(d) : null,
      }
    },
  },
  Bo = _,
  Eo = {
    preencode(d, n) {
      ;(Bo.preencode(d, n.header),
        e.fixed32.preencode(d, n.roomKey),
        e.buffer.preencode(d, n.encryptionKey),
        e.fixed32.preencode(d, n.mailbox),
        d.end++,
        n.fastForwardTo && e.fixed32.preencode(d, n.fastForwardTo),
        n.initiator && o.preencode(d, n.initiator),
        n.dm && e.fixed32.preencode(d, n.dm))
    },
    encode(d, c) {
      const t =
        (c.fastForwardTo ? 1 : 0) |
        (c.initiator ? 2 : 0) |
        (c.dm ? 4 : 0) |
        (n >= 9 && c.isReadOnly ? 8 : 0)
      ;(Bo.encode(d, c.header),
        e.fixed32.encode(d, c.roomKey),
        e.buffer.encode(d, c.encryptionKey),
        e.fixed32.encode(d, c.mailbox),
        e.uint.encode(d, t),
        c.fastForwardTo && e.fixed32.encode(d, c.fastForwardTo),
        c.initiator && o.encode(d, c.initiator),
        c.dm && e.fixed32.encode(d, c.dm))
    },
    decode(d) {
      const c = Bo.decode(d),
        t = e.fixed32.decode(d),
        r = e.buffer.decode(d),
        i = e.fixed32.decode(d),
        a = e.uint.decode(d)
      return {
        header: c,
        roomKey: t,
        encryptionKey: r,
        mailbox: i,
        fastForwardTo: 1 & a ? e.fixed32.decode(d) : null,
        initiator: 2 & a ? o.decode(d) : null,
        dm: 4 & a ? e.fixed32.decode(d) : null,
        isReadOnly: n >= 9 && !!(8 & a),
      }
    },
  },
  Io = _,
  jo = {
    preencode(d, n) {
      ;(Io.preencode(d, n.header), e.fixed32.preencode(d, n.discoveryKey))
    },
    encode(d, n) {
      ;(Io.encode(d, n.header), e.fixed32.encode(d, n.discoveryKey))
    },
    decode: (d) => ({ header: Io.decode(d), discoveryKey: e.fixed32.decode(d) }),
  },
  No = _,
  Vo = qo,
  Oo = {
    preencode(d, n) {
      ;(No.preencode(d, n.header),
        e.fixed32.preencode(d, n.roomKey),
        e.uint.preencode(d, n.key),
        Vo.preencode(d, n.status))
    },
    encode(d, n) {
      ;(No.encode(d, n.header),
        e.fixed32.encode(d, n.roomKey),
        e.uint.encode(d, n.key),
        Vo.encode(d, n.status))
    },
    decode: (d) => ({
      header: No.decode(d),
      roomKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: Vo.decode(d),
    }),
  },
  Jo = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      const o = n.isBlocked ? 1 : 0
      e.uint.encode(d, o)
    },
    decode: (d) => ({ isBlocked: !!(1 & e.uint.decode(d)) }),
  },
  Uo = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.memberKey),
        e.uint.preencode(d, n.clock),
        ai.preencode(d, n.status),
        d.end++,
        n.mailbox && e.fixed32.preencode(d, n.mailbox),
        n.roomKey && e.fixed32.preencode(d, n.roomKey))
    },
    encode(d, n) {
      const o = (n.mailbox ? 1 : 0) | (n.roomKey ? 2 : 0)
      ;(e.fixed32.encode(d, n.memberKey),
        e.uint.encode(d, n.clock),
        ai.encode(d, n.status),
        e.uint.encode(d, o),
        n.mailbox && e.fixed32.encode(d, n.mailbox),
        n.roomKey && e.fixed32.encode(d, n.roomKey))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        o = e.uint.decode(d),
        c = ai.decode(d),
        t = e.uint.decode(d)
      return {
        memberKey: n,
        clock: o,
        status: c,
        mailbox: 1 & t ? e.fixed32.decode(d) : null,
        roomKey: 2 & t ? e.fixed32.decode(d) : null,
      }
    },
  },
  Ho = _,
  zo = e.frame(so),
  Go = {
    preencode(e, d) {
      ;(Ho.preencode(e, d.header), zo.preencode(e, d.contact))
    },
    encode(e, d) {
      ;(Ho.encode(e, d.header), zo.encode(e, d.contact))
    },
    decode: (e) => ({ header: Ho.decode(e), contact: zo.decode(e) }),
  },
  Qo = _,
  Wo = {
    preencode(d, n) {
      ;(Qo.preencode(d, n.header),
        e.fixed32.preencode(d, n.memberKey),
        e.uint.preencode(d, n.key),
        si.preencode(d, n.status))
    },
    encode(d, n) {
      ;(Qo.encode(d, n.header),
        e.fixed32.encode(d, n.memberKey),
        e.uint.encode(d, n.key),
        si.encode(d, n.status))
    },
    decode: (d) => ({
      header: Qo.decode(d),
      memberKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: si.decode(d),
    }),
  },
  Xo = _,
  Yo = {
    preencode(d, n) {
      ;(Xo.preencode(d, n.header), e.fixed32.preencode(d, n.memberKey))
    },
    encode(d, n) {
      ;(Xo.encode(d, n.header), e.fixed32.encode(d, n.memberKey))
    },
    decode: (d) => ({ header: Xo.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  Zo = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      const o =
        (n.isPending ? 1 : 0) |
        (n.isAccepted ? 2 : 0) |
        (n.isRejected ? 4 : 0) |
        (n.isDiscarded ? 8 : 0) |
        (n.isSeen ? 16 : 0)
      e.uint.encode(d, o)
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        isPending: !!(1 & n),
        isAccepted: !!(2 & n),
        isRejected: !!(4 & n),
        isDiscarded: !!(8 & n),
        isSeen: !!(16 & n),
      }
    },
  },
  $o = ke,
  _o = e.frame(i),
  ec = {
    preencode(d, n) {
      ;($o.preencode(d, n.sender),
        _o.preencode(d, n.keys),
        e.fixed32.preencode(d, n.mailbox),
        d.end++,
        n.message && e.string.preencode(d, n.message))
    },
    encode(d, n) {
      const o = n.message ? 1 : 0
      ;($o.encode(d, n.sender),
        _o.encode(d, n.keys),
        e.fixed32.encode(d, n.mailbox),
        e.uint.encode(d, o),
        n.message && e.string.encode(d, n.message))
    },
    decode: (d) => ({
      sender: $o.decode(d),
      keys: _o.decode(d),
      mailbox: e.fixed32.decode(d),
      message: 1 & e.uint.decode(d) ? e.string.decode(d) : null,
    }),
  },
  dc = e.frame(ec),
  nc = {
    preencode(e, d) {
      ;(dc.preencode(e, d.body), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(dc.encode(e, d.body), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ body: dc.decode(e), attestation: ce.decode(e) }),
  },
  oc = ue,
  cc = e.frame(Zo),
  tc = _o,
  rc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.clock),
        oc.preencode(d, o.sender),
        cc.preencode(d, o.status),
        tc.preencode(d, o.keys),
        e.fixed32.preencode(d, o.mailbox),
        d.end++,
        o.message && e.string.preencode(d, o.message),
        n >= 11 && o.sentAt && e.uint.preencode(d, o.sentAt))
    },
    encode(d, o) {
      const c = (o.message ? 1 : 0) | (n >= 11 && o.sentAt ? 2 : 0)
      ;(e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.clock),
        oc.encode(d, o.sender),
        cc.encode(d, o.status),
        tc.encode(d, o.keys),
        e.fixed32.encode(d, o.mailbox),
        e.uint.encode(d, c),
        o.message && e.string.encode(d, o.message),
        n >= 11 && o.sentAt && e.uint.encode(d, o.sentAt))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.uint.decode(d),
        t = oc.decode(d),
        r = cc.decode(d),
        i = tc.decode(d),
        a = e.fixed32.decode(d),
        s = e.uint.decode(d)
      return {
        memberKey: o,
        clock: c,
        sender: t,
        status: r,
        keys: i,
        mailbox: a,
        message: 1 & s ? e.string.decode(d) : null,
        sentAt: n >= 11 && 2 & s ? e.uint.decode(d) : 0,
      }
    },
  },
  ic = _,
  ac = {
    preencode(d, n) {
      ;(ic.preencode(d, n.header), e.buffer.preencode(d, n.blindRequest))
    },
    encode(d, n) {
      ;(ic.encode(d, n.header), e.buffer.encode(d, n.blindRequest))
    },
    decode: (d) => ({ header: ic.decode(d), blindRequest: e.buffer.decode(d) }),
  },
  sc = _,
  pc = cc,
  uc = {
    preencode(d, o) {
      ;(sc.preencode(d, o.header),
        e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.key),
        pc.preencode(d, o.status),
        d.end++,
        n >= 10 && o.roomKey && e.fixed32.preencode(d, o.roomKey))
    },
    encode(d, o) {
      const c = n >= 10 && o.roomKey ? 1 : 0
      ;(sc.encode(d, o.header),
        e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.key),
        pc.encode(d, o.status),
        e.uint.encode(d, c),
        n >= 10 && o.roomKey && e.fixed32.encode(d, o.roomKey))
    },
    decode(d) {
      const o = sc.decode(d),
        c = e.fixed32.decode(d),
        t = e.uint.decode(d),
        r = pc.decode(d),
        i = d.start < d.end ? e.uint.decode(d) : 0
      return {
        header: o,
        memberKey: c,
        key: t,
        status: r,
        roomKey: n >= 10 && 1 & i ? e.fixed32.decode(d) : null,
      }
    },
  },
  lc = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.timestamp),
        e.fixed32.preencode(d, n.key),
        e.fixed32.preencode(d, n.mailbox))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.timestamp), e.fixed32.encode(d, n.key), e.fixed32.encode(d, n.mailbox))
    },
    decode: (d) => ({
      version: e.uint.decode(d),
      timestamp: e.uint.decode(d),
      key: e.fixed32.decode(d),
      mailbox: e.fixed32.decode(d),
    }),
  },
  fc = {
    preencode(d, n) {
      switch ((e.uint.preencode(d, n.version), n.version)) {
        case 0:
        case 1:
          lc.preencode(d, n)
          break
        default:
          throw new Error("Unsupported version")
      }
    },
    encode(d, n) {
      switch ((e.uint.encode(d, n.version), n.version)) {
        case 0:
        case 1:
          lc.encode(d, n)
          break
        default:
          throw new Error("Unsupported version")
      }
    },
    decode(d) {
      const n = d.start,
        o = e.uint.decode(d)
      switch (((d.start = n), o)) {
        case 0:
        case 1:
          return lc.decode(d)
        default:
          throw new Error("Unsupported version")
      }
    },
  },
  mc = _,
  yc = {
    preencode(d, o) {
      ;(mc.preencode(d, o.header),
        c.preencode(d, o.oplog),
        e.uint.preencode(d, o.index),
        pi.preencode(d, o.preview),
        d.end++,
        n >= 7 && o.displayType && Sc.preencode(d, o.displayType))
    },
    encode(d, o) {
      const t = n >= 7 && o.displayType ? 1 : 0
      ;(mc.encode(d, o.header),
        c.encode(d, o.oplog),
        e.uint.encode(d, o.index),
        pi.encode(d, o.preview),
        e.uint.encode(d, t),
        n >= 7 && o.displayType && Sc.encode(d, o.displayType))
    },
    decode(d) {
      const o = mc.decode(d),
        t = c.decode(d),
        r = e.uint.decode(d),
        i = pi.decode(d),
        a = d.start < d.end ? e.uint.decode(d) : 0
      return {
        header: o,
        oplog: t,
        index: r,
        preview: i,
        displayType: n >= 7 && 1 & a ? Sc.decode(d) : 0,
      }
    },
  },
  xc = {
    preencode(d, o) {
      ;(d.end++, n >= 3 && o.memberKey && e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      const c = n >= 3 && o.memberKey ? 1 : 0
      ;(e.uint.encode(d, c), n >= 3 && o.memberKey && e.fixed32.encode(d, o.memberKey))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { memberKey: n >= 3 && 1 & o ? e.fixed32.decode(d) : null }
    },
  },
  bc = ue,
  kc = {
    preencode(e, d) {
      ;(bc.preencode(e, d.profile), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(bc.encode(e, d.profile), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: bc.decode(e), attestation: ce.decode(e) }),
  },
  vc = _,
  gc = {
    preencode(d, n) {
      ;(vc.preencode(d, n.header), e.fixed32.preencode(d, n.key))
    },
    encode(d, n) {
      ;(vc.encode(d, n.header), e.fixed32.encode(d, n.key))
    },
    decode: (d) => ({ header: vc.decode(d), key: e.fixed32.decode(d) }),
  },
  hc = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.deviceKey),
        ce.preencode(d, n.privateProfileIdentity),
        e.buffer.preencode(d, n.deviceProof))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.deviceKey),
        ce.encode(d, n.privateProfileIdentity),
        e.buffer.encode(d, n.deviceProof))
    },
    decode: (d) => ({
      deviceKey: e.fixed32.decode(d),
      privateProfileIdentity: ce.decode(d),
      deviceProof: e.buffer.decode(d),
    }),
  },
  Kc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.fixed32.preencode(d, o.encryptionKey),
        e.fixed32.preencode(d, o.seed),
        d.end++,
        n >= 6 && o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo))
    },
    encode(d, o) {
      const c = n >= 6 && 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, c),
        n >= 6 && o.fastForwardTo && e.fixed32.encode(d, o.fastForwardTo))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.fixed32.decode(d),
        t = e.fixed32.decode(d),
        r = e.uint.decode(d)
      return {
        roomKey: o,
        encryptionKey: c,
        seed: t,
        fastForwardTo: n >= 6 && 1 & r ? e.fixed32.decode(d) : null,
      }
    },
  },
  wc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey),
        e.fixed32.preencode(d, o.writerKey),
        e.fixed32.preencode(d, o.devicePublicKey),
        d.end++,
        n >= 6 && o.privateProfileKey && e.fixed32.preencode(d, o.privateProfileKey))
    },
    encode(d, o) {
      const c = n >= 6 && 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, c),
        n >= 6 && o.privateProfileKey && e.fixed32.encode(d, o.privateProfileKey))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.fixed32.decode(d),
        t = e.fixed32.decode(d),
        r = e.uint.decode(d)
      return {
        publicKey: o,
        writerKey: c,
        devicePublicKey: t,
        privateProfileKey: n >= 6 && 1 & r ? e.fixed32.decode(d) : null,
      }
    },
  },
  Ac = _,
  Pc = {
    preencode(d, n) {
      ;(Ac.preencode(d, n.header), e.fixed32.preencode(d, n.memberKey))
    },
    encode(d, n) {
      ;(Ac.encode(d, n.header), e.fixed32.encode(d, n.memberKey))
    },
    decode: (d) => ({ header: Ac.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  Tc = { HttpLink: 1, PearLink: 2 },
  Sc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      if (n > 2) throw new Error("Unknown enum")
      e.uint.encode(d, n)
    },
    decode: (d) => e.uint.decode(d),
  },
  Rc = _,
  Cc = {
    preencode(d, n) {
      ;(Rc.preencode(d, n.header), e.uint.preencode(d, n.value))
    },
    encode(d, n) {
      ;(Rc.encode(d, n.header), e.uint.encode(d, n.value))
    },
    decode: (d) => ({ header: Rc.decode(d), value: e.uint.decode(d) }),
  },
  Fc = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.key), e.uint.preencode(d, n.value))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.key), e.uint.encode(d, n.value))
    },
    decode: (d) => ({ key: e.uint.decode(d), value: e.uint.decode(d) }),
  },
  qc = _,
  Mc = {
    preencode(d, n) {
      ;(qc.preencode(d, n.header), e.uint.preencode(d, n.from), e.uint.preencode(d, n.to))
    },
    encode(d, n) {
      ;(qc.encode(d, n.header), e.uint.encode(d, n.from), e.uint.encode(d, n.to))
    },
    decode: (d) => ({ header: qc.decode(d), from: e.uint.decode(d), to: e.uint.decode(d) }),
  },
  Dc = {
    RoomType: 1,
    IsExperimental: 2,
    IsJoiningDisabled: 3,
    IsAppendingDisabled: 4,
    IsCallingDisabled: 5,
    IsMembershipEventsDisabled: 6,
  },
  Lc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      if (n > 6) throw new Error("Unknown enum")
      e.uint.encode(d, n)
    },
    decode: (d) => e.uint.decode(d),
  },
  Bc = { en: "en", it: "it", ru: "ru", es: "es", de: "de" },
  Ec = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      switch (n) {
        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
      }
    },
  },
  Ic = Bd,
  jc = {
    preencode(d, n) {
      ;(Ic.preencode(d, n.range), Ec.preencode(d, n.language), e.string.preencode(d, n.text))
    },
    encode(d, n) {
      ;(Ic.encode(d, n.range), Ec.encode(d, n.language), e.string.encode(d, n.text))
    },
    decode: (d) => ({ range: Ic.decode(d), language: Ec.decode(d), text: e.string.decode(d) }),
  },
  Nc = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.deviceKey), e.fixed32.preencode(d, n.key))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.deviceKey), e.fixed32.encode(d, n.key))
    },
    decode: (d) => ({ deviceKey: e.fixed32.decode(d), key: e.fixed32.decode(d) }),
  },
  Vc = _,
  Oc = {
    preencode(d, n) {
      ;(Vc.preencode(d, n.header), e.fixed32.preencode(d, n.key))
    },
    encode(d, n) {
      ;(Vc.encode(d, n.header), e.fixed32.encode(d, n.key))
    },
    decode: (d) => ({ header: Vc.decode(d), key: e.fixed32.decode(d) }),
  },
  Jc = _,
  Uc = {
    preencode(d, n) {
      ;(Jc.preencode(d, n.header), e.fixed32.preencode(d, n.key))
    },
    encode(d, n) {
      ;(Jc.encode(d, n.header), e.fixed32.encode(d, n.key))
    },
    decode: (d) => ({ header: Jc.decode(d), key: e.fixed32.decode(d) }),
  },
  Hc = { Flag: 1 },
  zc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      if (n > 1) throw new Error("Unknown enum")
      e.uint.encode(d, n)
    },
    decode: (d) => e.uint.decode(d),
  },
  Gc = {
    preencode(d, n) {
      ;(fn.preencode(d, n.id),
        e.fixed32.preencode(d, n.sender),
        e.uint.preencode(d, n.clock),
        zc.preencode(d, n.label))
    },
    encode(d, n) {
      ;(fn.encode(d, n.id),
        e.fixed32.encode(d, n.sender),
        e.uint.encode(d, n.clock),
        zc.encode(d, n.label))
    },
    decode: (d) => ({
      id: fn.decode(d),
      sender: e.fixed32.decode(d),
      clock: e.uint.decode(d),
      label: zc.decode(d),
    }),
  },
  Qc = _,
  Wc = {
    preencode(e, d) {
      ;(Qc.preencode(e, d.header), c.preencode(e, d.oplog), zc.preencode(e, d.label))
    },
    encode(e, d) {
      ;(Qc.encode(e, d.header), c.encode(e, d.oplog), zc.encode(e, d.label))
    },
    decode: (e) => ({ header: Qc.decode(e), oplog: c.decode(e), label: zc.decode(e) }),
  },
  Xc = _,
  Yc = {
    preencode(e, d) {
      ;(Xc.preencode(e, d.header), c.preencode(e, d.oplog), zc.preencode(e, d.label))
    },
    encode(e, d) {
      ;(Xc.encode(e, d.header), c.encode(e, d.oplog), zc.encode(e, d.label))
    },
    decode: (e) => ({ header: Xc.decode(e), oplog: c.decode(e), label: zc.decode(e) }),
  },
  Zc = {
    preencode(d, n) {
      ;(zc.preencode(d, n.label), e.uint.preencode(d, n.count))
    },
    encode(d, n) {
      ;(zc.encode(d, n.label), e.uint.encode(d, n.count))
    },
    decode: (d) => ({ label: zc.decode(d), count: e.uint.decode(d) }),
  },
  $c = e.array(e.frame(Zc)),
  _c = {
    preencode(d, o) {
      ;(fn.preencode(d, o.id),
        e.uint.preencode(d, o.total),
        $c.preencode(d, o.labels),
        e.uint.preencode(d, o.editedAt),
        d.end++,
        n >= 15 && o.flagsClock && e.uint.preencode(d, o.flagsClock),
        n >= 15 && o.version && e.uint.preencode(d, o.version))
    },
    encode(d, o) {
      const c =
        (n >= 15 && o.flagsClock ? 1 : 0) |
        (n >= 15 && o.version ? 2 : 0) |
        (n >= 16 && o.isDeleted ? 4 : 0)
      ;(fn.encode(d, o.id),
        e.uint.encode(d, o.total),
        $c.encode(d, o.labels),
        e.uint.encode(d, o.editedAt),
        e.uint.encode(d, c),
        n >= 15 && o.flagsClock && e.uint.encode(d, o.flagsClock),
        n >= 15 && o.version && e.uint.encode(d, o.version))
    },
    decode(d) {
      const o = fn.decode(d),
        c = e.uint.decode(d),
        t = $c.decode(d),
        r = e.uint.decode(d),
        i = d.start < d.end ? e.uint.decode(d) : 0
      return {
        id: o,
        total: c,
        labels: t,
        editedAt: r,
        flagsClock: n >= 15 && 1 & i ? e.uint.decode(d) : 0,
        version: n >= 15 && 2 & i ? e.uint.decode(d) : 0,
        isDeleted: n >= 16 && !!(4 & i),
      }
    },
  },
  et = _,
  dt = {
    preencode(d, n) {
      ;(et.preencode(d, n.header), e.uint.preencode(d, n.length))
    },
    encode(d, n) {
      ;(et.encode(d, n.header), e.uint.encode(d, n.length))
    },
    decode: (d) => ({ header: et.decode(d), length: e.uint.decode(d) }),
  },
  nt = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.memberKey), e.uint.preencode(d, n.length))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.memberKey), e.uint.encode(d, n.length))
    },
    decode: (d) => ({ memberKey: e.fixed32.decode(d), length: e.uint.decode(d) }),
  },
  ot = $,
  ct = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const c = n >= 13 && o.disableReadReceipts ? 1 : 0
      e.uint.encode(d, c)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { disableReadReceipts: n >= 13 && !!(1 & o) }
    },
  },
  tt = { disableReadReceipts: "disableReadReceipts" },
  rt = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      if ("disableReadReceipts" !== n) throw new Error("Unknown enum")
      e.uint.encode(d, 1)
    },
    decode: (d) => (1 === e.uint.decode(d) ? "disableReadReceipts" : null),
  },
  it = _,
  at = e.frame(ct),
  st = {
    preencode(e, d) {
      ;(it.preencode(e, d.header), rt.preencode(e, d.key), at.preencode(e, d.settings))
    },
    encode(e, d) {
      ;(it.encode(e, d.header), rt.encode(e, d.key), at.encode(e, d.settings))
    },
    decode: (e) => ({ header: it.decode(e), key: rt.decode(e), settings: at.decode(e) }),
  },
  pt = { Flag: 1 },
  ut = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      if (n > 1) throw new Error("Unknown enum")
      e.uint.encode(d, n)
    },
    decode: (d) => e.uint.decode(d),
  },
  lt = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key),
        e.fixed32.preencode(d, n.sender),
        e.uint.preencode(d, n.clock),
        ut.preencode(d, n.label))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.key),
        e.fixed32.encode(d, n.sender),
        e.uint.encode(d, n.clock),
        ut.encode(d, n.label))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      sender: e.fixed32.decode(d),
      clock: e.uint.decode(d),
      label: ut.decode(d),
    }),
  },
  ft = _,
  mt = {
    preencode(d, n) {
      ;(ft.preencode(d, n.header), e.fixed32.preencode(d, n.key), ut.preencode(d, n.label))
    },
    encode(d, n) {
      ;(ft.encode(d, n.header), e.fixed32.encode(d, n.key), ut.encode(d, n.label))
    },
    decode: (d) => ({ header: ft.decode(d), key: e.fixed32.decode(d), label: ut.decode(d) }),
  },
  yt = {
    preencode(d, n) {
      ;(ut.preencode(d, n.label), e.uint.preencode(d, n.count))
    },
    encode(d, n) {
      ;(ut.encode(d, n.label), e.uint.encode(d, n.count))
    },
    decode: (d) => ({ label: ut.decode(d), count: e.uint.decode(d) }),
  },
  xt = e.array(e.frame(yt)),
  bt = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key),
        e.uint.preencode(d, n.total),
        xt.preencode(d, n.labels),
        e.uint.preencode(d, n.editedAt),
        e.uint.preencode(d, n.flagsClock))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.key),
        e.uint.encode(d, n.total),
        xt.encode(d, n.labels),
        e.uint.encode(d, n.editedAt),
        e.uint.encode(d, n.flagsClock))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      total: e.uint.decode(d),
      labels: xt.decode(d),
      editedAt: e.uint.decode(d),
      flagsClock: e.uint.decode(d),
    }),
  },
  kt = {
    preencode(d, n) {
      ;(e.float64.preencode(d, n.latitude), e.float64.preencode(d, n.longitude))
    },
    encode(d, n) {
      ;(e.float64.encode(d, n.latitude), e.float64.encode(d, n.longitude))
    },
    decode: (d) => ({ latitude: e.float64.decode(d), longitude: e.float64.decode(d) }),
  },
  vt = _,
  gt = {
    preencode(d, n) {
      ;(vt.preencode(d, n.header),
        e.fixed32.preencode(d, n.deviceKey),
        e.fixed32.preencode(d, n.fromDeviceKey))
    },
    encode(d, n) {
      ;(vt.encode(d, n.header),
        e.fixed32.encode(d, n.deviceKey),
        e.fixed32.encode(d, n.fromDeviceKey))
    },
    decode: (d) => ({
      header: vt.decode(d),
      deviceKey: e.fixed32.decode(d),
      fromDeviceKey: e.fixed32.decode(d),
    }),
  },
  ht = _,
  Kt = Y,
  wt = {
    preencode(d, o) {
      ;(ht.preencode(d, o.header),
        e.fixed32.preencode(d, o.callKey),
        e.buffer.preencode(d, o.encryptionKey),
        d.end++,
        n >= 19 && o.streams && Kt.preencode(d, o.streams),
        n >= 19 && o.discoveryKey && e.fixed32.preencode(d, o.discoveryKey),
        n >= 19 && o.version && e.uint.preencode(d, o.version))
    },
    encode(d, o) {
      const c =
        (n >= 19 && o.streams ? 1 : 0) |
        (n >= 19 && o.discoveryKey ? 2 : 0) |
        (n >= 19 && o.version ? 4 : 0)
      ;(ht.encode(d, o.header),
        e.fixed32.encode(d, o.callKey),
        e.buffer.encode(d, o.encryptionKey),
        e.uint.encode(d, c),
        n >= 19 && o.streams && Kt.encode(d, o.streams),
        n >= 19 && o.discoveryKey && e.fixed32.encode(d, o.discoveryKey),
        n >= 19 && o.version && e.uint.encode(d, o.version))
    },
    decode(d) {
      const o = ht.decode(d),
        c = e.fixed32.decode(d),
        t = e.buffer.decode(d),
        r = e.uint.decode(d)
      return {
        header: o,
        callKey: c,
        encryptionKey: t,
        streams: n >= 19 && 1 & r ? Kt.decode(d) : null,
        discoveryKey: n >= 19 && 2 & r ? e.fixed32.decode(d) : null,
        version: n >= 19 && 4 & r ? e.uint.decode(d) : 0,
      }
    },
  },
  At = _,
  Pt = Y,
  Tt = {
    preencode(d, o) {
      ;(At.preencode(d, o.header),
        e.fixed32.preencode(d, o.callKey),
        d.end++,
        n >= 19 && o.streams && Pt.preencode(d, o.streams))
    },
    encode(d, o) {
      const c = n >= 19 && o.streams ? 1 : 0
      ;(At.encode(d, o.header),
        e.fixed32.encode(d, o.callKey),
        e.uint.encode(d, c),
        n >= 19 && o.streams && Pt.encode(d, o.streams))
    },
    decode(d) {
      const o = At.decode(d),
        c = e.fixed32.decode(d),
        t = e.uint.decode(d)
      return { header: o, callKey: c, streams: n >= 19 && 1 & t ? Pt.decode(d) : null }
    },
  },
  St = _,
  Rt = {
    preencode(d, n) {
      ;(St.preencode(d, n.header), e.fixed32.preencode(d, n.callKey))
    },
    encode(d, n) {
      ;(St.encode(d, n.header), e.fixed32.encode(d, n.callKey))
    },
    decode: (d) => ({ header: St.decode(d), callKey: e.fixed32.decode(d) }),
  },
  Ct = _,
  Ft = {
    preencode(d, n) {
      ;(Ct.preencode(d, n.header), e.fixed32.preencode(d, n.callKey))
    },
    encode(d, n) {
      ;(Ct.encode(d, n.header), e.fixed32.encode(d, n.callKey))
    },
    decode: (d) => ({ header: Ct.decode(d), callKey: e.fixed32.decode(d) }),
  },
  qt = _,
  Mt = {
    preencode(d, n) {
      ;(qt.preencode(d, n.header),
        e.fixed32.preencode(d, n.callKey),
        e.fixed32.preencode(d, n.streamKey))
    },
    encode(d, n) {
      ;(qt.encode(d, n.header), e.fixed32.encode(d, n.callKey), e.fixed32.encode(d, n.streamKey))
    },
    decode: (d) => ({
      header: qt.decode(d),
      callKey: e.fixed32.decode(d),
      streamKey: e.fixed32.decode(d),
    }),
  },
  Dt = _,
  Lt = {
    preencode(d, n) {
      ;(Dt.preencode(d, n.header),
        e.fixed32.preencode(d, n.callKey),
        e.fixed32.preencode(d, n.streamKey))
    },
    encode(d, n) {
      ;(Dt.encode(d, n.header), e.fixed32.encode(d, n.callKey), e.fixed32.encode(d, n.streamKey))
    },
    decode: (d) => ({
      header: Dt.decode(d),
      callKey: e.fixed32.decode(d),
      streamKey: e.fixed32.decode(d),
    }),
  },
  Bt = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.callKey),
        e.buffer.preencode(d, o.encryptionKey),
        e.uint.preencode(d, o.createdAt),
        d.end++,
        n >= 19 && o.endedAt && e.uint.preencode(d, o.endedAt),
        n >= 19 && o.discoveryKey && e.fixed32.preencode(d, o.discoveryKey),
        n >= 19 && o.version && e.uint.preencode(d, o.version))
    },
    encode(d, o) {
      const c =
        (n >= 19 && o.endedAt ? 1 : 0) |
        (n >= 19 && o.discoveryKey ? 2 : 0) |
        (n >= 19 && o.version ? 4 : 0)
      ;(e.fixed32.encode(d, o.callKey),
        e.buffer.encode(d, o.encryptionKey),
        e.uint.encode(d, o.createdAt),
        e.uint.encode(d, c),
        n >= 19 && o.endedAt && e.uint.encode(d, o.endedAt),
        n >= 19 && o.discoveryKey && e.fixed32.encode(d, o.discoveryKey),
        n >= 19 && o.version && e.uint.encode(d, o.version))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.buffer.decode(d),
        t = e.uint.decode(d),
        r = e.uint.decode(d)
      return {
        callKey: o,
        encryptionKey: c,
        createdAt: t,
        endedAt: n >= 19 && 1 & r ? e.uint.decode(d) : 0,
        discoveryKey: n >= 19 && 2 & r ? e.fixed32.decode(d) : null,
        version: n >= 19 && 4 & r ? e.uint.decode(d) : 0,
      }
    },
  },
  Et = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.callKey),
        e.fixed32.preencode(d, n.memberKey),
        e.uint.preencode(d, n.createdAt))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.callKey),
        e.fixed32.encode(d, n.memberKey),
        e.uint.encode(d, n.createdAt))
    },
    decode: (d) => ({
      callKey: e.fixed32.decode(d),
      memberKey: e.fixed32.decode(d),
      createdAt: e.uint.decode(d),
    }),
  },
  It = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.callKey),
        e.fixed32.preencode(d, o.deviceKey),
        e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.createdAt),
        d.end++,
        n >= 19 && o.swarmKey && e.fixed32.preencode(d, o.swarmKey))
    },
    encode(d, o) {
      const c = n >= 19 && o.swarmKey ? 1 : 0
      ;(e.fixed32.encode(d, o.callKey),
        e.fixed32.encode(d, o.deviceKey),
        e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.createdAt),
        e.uint.encode(d, c),
        n >= 19 && o.swarmKey && e.fixed32.encode(d, o.swarmKey))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.fixed32.decode(d),
        t = e.fixed32.decode(d),
        r = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        callKey: o,
        deviceKey: c,
        memberKey: t,
        createdAt: r,
        swarmKey: n >= 19 && 1 & i ? e.fixed32.decode(d) : null,
      }
    },
  },
  jt = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.callKey),
        e.fixed32.preencode(d, n.deviceKey),
        e.buffer.preencode(d, n.streamKey),
        e.uint.preencode(d, n.createdAt))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.callKey),
        e.fixed32.encode(d, n.deviceKey),
        e.buffer.encode(d, n.streamKey),
        e.uint.encode(d, n.createdAt))
    },
    decode: (d) => ({
      callKey: e.fixed32.decode(d),
      deviceKey: e.fixed32.decode(d),
      streamKey: e.buffer.decode(d),
      createdAt: e.uint.decode(d),
    }),
  },
  Nt = { preencode(e, d) {}, encode(e, d) {}, decode: (e) => ({ key: null }) },
  Vt = he,
  Ot = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.id), Vt.preencode(d, n.request))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.id), Vt.encode(d, n.request))
    },
    decode: (d) => ({ deviceKey: null, id: e.fixed32.decode(d), request: Vt.decode(d) }),
  },
  Jt = re,
  Ut = ie,
  Ht = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.memberKey),
        Jt.preencode(d, n.status),
        ui.preencode(d, n.profile),
        d.end++,
        n.invitation && Ut.preencode(d, n.invitation))
    },
    encode(d, n) {
      const o = n.invitation ? 1 : 0
      ;(e.fixed32.encode(d, n.memberKey),
        Jt.encode(d, n.status),
        ui.encode(d, n.profile),
        e.uint.encode(d, o),
        n.invitation && Ut.encode(d, n.invitation))
    },
    decode: (d) => ({
      key: null,
      memberKey: e.fixed32.decode(d),
      status: Jt.decode(d),
      profile: ui.decode(d),
      invitation: 1 & e.uint.decode(d) ? Ut.decode(d) : null,
    }),
  },
  zt = {
    preencode(d, n) {
      ;(d.end++,
        n.profileAttestation && e.buffer.preencode(d, n.profileAttestation),
        n.latestReceipt && e.buffer.preencode(d, n.latestReceipt))
    },
    encode(d, n) {
      const o = (n.profileAttestation ? 1 : 0) | (n.latestReceipt ? 2 : 0)
      ;(e.uint.encode(d, o),
        n.profileAttestation && e.buffer.encode(d, n.profileAttestation),
        n.latestReceipt && e.buffer.encode(d, n.latestReceipt))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        key: null,
        profileAttestation: 1 & n ? e.buffer.decode(d) : null,
        latestReceipt: 2 & n ? e.buffer.decode(d) : null,
      }
    },
  },
  Gt = ad,
  Qt = ue,
  Wt = {
    preencode(e, d) {
      ;(Gt.preencode(e, d.status), Qt.preencode(e, d.profile))
    },
    encode(e, d) {
      ;(Gt.encode(e, d.status), Qt.encode(e, d.profile))
    },
    decode: (e) => ({ key: null, status: Gt.decode(e), profile: Qt.decode(e) }),
  },
  Xt = {
    preencode(d, n) {
      e.uint.preencode(d, n.mentions)
    },
    encode(d, n) {
      e.uint.encode(d, n.mentions)
    },
    decode: (d) => ({ key: null, mentions: e.uint.decode(d) }),
  },
  Yt = Ce,
  Zt = Le,
  $t = {
    preencode(e, d) {
      ;(Yt.preencode(e, d.response),
        Zt.preencode(e, d.metadata),
        e.end++,
        d.anchor && o.preencode(e, d.anchor))
    },
    encode(d, n) {
      const c = (n.anchor ? 1 : 0) | (n.isActive ? 2 : 0)
      ;(Yt.encode(d, n.response),
        Zt.encode(d, n.metadata),
        e.uint.encode(d, c),
        n.anchor && o.encode(d, n.anchor))
    },
    decode(d) {
      const n = Yt.decode(d),
        c = Zt.decode(d),
        t = e.uint.decode(d)
      return {
        id: null,
        response: n,
        metadata: c,
        anchor: 1 & t ? o.decode(d) : null,
        isActive: !!(2 & t),
      }
    },
  },
  _t = mn,
  er = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.count),
        d.end++,
        n.parent && c.preencode(d, n.parent),
        n.stats && _t.preencode(d, n.stats))
    },
    encode(d, n) {
      const o = (n.parent ? 1 : 0) | (n.stats ? 2 : 0)
      ;(e.uint.encode(d, n.count),
        e.uint.encode(d, o),
        n.parent && c.encode(d, n.parent),
        n.stats && _t.encode(d, n.stats))
    },
    decode(d) {
      const n = e.uint.decode(d),
        o = e.uint.decode(d)
      return {
        id: 0,
        count: n,
        parent: 1 & o ? c.decode(d) : null,
        stats: 2 & o ? _t.decode(d) : null,
      }
    },
  },
  dr = { preencode(e, d) {}, encode(e, d) {}, decode: (e) => ({ thread: 0, index: 0 }) },
  nr = xn,
  or = bn,
  cr = kn,
  tr = {
    preencode(d, n) {
      ;(fn.preencode(d, n.id),
        c.preencode(d, n.oplog),
        e.uint.preencode(d, n.clock),
        e.uint.preencode(d, n.timestamp),
        d.end++,
        n.editedAt && e.uint.preencode(d, n.editedAt),
        nr.preencode(d, n.status),
        n.message && or.preencode(d, n.message),
        n.event && cr.preencode(d, n.event))
    },
    encode(d, n) {
      const o = (n.editedAt ? 1 : 0) | (n.message ? 2 : 0) | (n.event ? 4 : 0)
      ;(fn.encode(d, n.id),
        c.encode(d, n.oplog),
        e.uint.encode(d, n.clock),
        e.uint.encode(d, n.timestamp),
        e.uint.encode(d, o),
        n.editedAt && e.uint.encode(d, n.editedAt),
        nr.encode(d, n.status),
        n.message && or.encode(d, n.message),
        n.event && cr.encode(d, n.event))
    },
    decode(d) {
      const n = fn.decode(d),
        o = c.decode(d),
        t = e.uint.decode(d),
        r = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        id: n,
        oplog: o,
        clock: t,
        timestamp: r,
        editedAt: 1 & i ? e.uint.decode(d) : 0,
        status: nr.decode(d),
        message: 2 & i ? or.decode(d) : null,
        event: 4 & i ? cr.decode(d) : null,
      }
    },
  },
  rr = dr,
  ir = En,
  ar = {
    preencode(d, o) {
      ;(fn.preencode(d, o.id),
        e.uint.preencode(d, o.total),
        ir.preencode(d, o.reactions),
        d.end++,
        n >= 11 && o.editedAt && e.uint.preencode(d, o.editedAt))
    },
    encode(d, o) {
      const c = n >= 11 && o.editedAt ? 1 : 0
      ;(fn.encode(d, o.id),
        e.uint.encode(d, o.total),
        ir.encode(d, o.reactions),
        e.uint.encode(d, c),
        n >= 11 && o.editedAt && e.uint.encode(d, o.editedAt))
    },
    decode(d) {
      const o = fn.decode(d),
        c = e.uint.decode(d),
        t = ir.decode(d),
        r = d.start < d.end ? e.uint.decode(d) : 0
      return { id: o, total: c, reactions: t, editedAt: n >= 11 && 1 & r ? e.uint.decode(d) : 0 }
    },
  },
  sr = dr,
  pr = {
    preencode(d, n) {
      ;(fn.preencode(d, n.id), e.uint.preencode(d, n.clock))
    },
    encode(d, n) {
      ;(fn.encode(d, n.id), e.uint.encode(d, n.clock))
    },
    decode: (d) => ({ id: fn.decode(d), sender: null, clock: e.uint.decode(d), reaction: null }),
  },
  ur = T,
  lr = h,
  fr = {
    preencode(d, o) {
      ;(c.preencode(d, o.oplog),
        ur.preencode(d, o.status),
        lr.preencode(d, o.file),
        d.end++,
        n >= 14 && o.version && e.uint.preencode(d, o.version))
    },
    encode(d, o) {
      const t = n >= 14 && o.version ? 1 : 0
      ;(c.encode(d, o.oplog),
        ur.encode(d, o.status),
        lr.encode(d, o.file),
        e.uint.encode(d, t),
        n >= 14 && o.version && e.uint.encode(d, o.version))
    },
    decode(d) {
      const o = c.decode(d),
        t = ur.decode(d),
        r = lr.decode(d),
        i = d.start < d.end ? e.uint.decode(d) : 0
      return {
        id: 0,
        oplog: o,
        status: t,
        file: r,
        version: n >= 14 && 1 & i ? e.uint.decode(d) : 0,
      }
    },
  },
  mr = go,
  yr = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.invitationSeed),
        e.fixed32.preencode(d, n.mailbox),
        r.preencode(d, n.responseKeyPair),
        o.preencode(d, n.initiator),
        o.preencode(d, n.inviter),
        d.end++,
        n.identity && mr.preencode(d, n.identity))
    },
    encode(d, n) {
      const c = n.identity ? 1 : 0
      ;(e.fixed32.encode(d, n.invitationSeed),
        e.fixed32.encode(d, n.mailbox),
        r.encode(d, n.responseKeyPair),
        o.encode(d, n.initiator),
        o.encode(d, n.inviter),
        e.uint.encode(d, c),
        n.identity && mr.encode(d, n.identity))
    },
    decode: (d) => ({
      id: null,
      invitationSeed: e.fixed32.decode(d),
      mailbox: e.fixed32.decode(d),
      responseKeyPair: r.decode(d),
      initiator: o.decode(d),
      inviter: o.decode(d),
      identity: 1 & e.uint.decode(d) ? mr.decode(d) : null,
    }),
  },
  xr = qo,
  br = Mo,
  kr = go,
  vr = {
    preencode(d, c) {
      ;(e.buffer.preencode(d, c.encryptionKey),
        e.fixed32.preencode(d, c.mailbox),
        xr.preencode(d, c.status),
        e.uint.preencode(d, c.clock),
        d.end++,
        c.initiator && o.preencode(d, c.initiator),
        c.fastForwardTo && e.fixed32.preencode(d, c.fastForwardTo),
        c.identitySwap && br.preencode(d, c.identitySwap),
        n >= 6 && c.identitySwapV2 && kr.preencode(d, c.identitySwapV2),
        n >= 10 && c.contact && e.fixed32.preencode(d, c.contact))
    },
    encode(d, c) {
      const t =
        (c.initiator ? 1 : 0) |
        (c.fastForwardTo ? 2 : 0) |
        (c.identitySwap ? 4 : 0) |
        (n >= 6 && c.identitySwapV2 ? 8 : 0) |
        (n >= 10 && c.contact ? 16 : 0)
      ;(e.buffer.encode(d, c.encryptionKey),
        e.fixed32.encode(d, c.mailbox),
        xr.encode(d, c.status),
        e.uint.encode(d, c.clock),
        e.uint.encode(d, t),
        c.initiator && o.encode(d, c.initiator),
        c.fastForwardTo && e.fixed32.encode(d, c.fastForwardTo),
        c.identitySwap && br.encode(d, c.identitySwap),
        n >= 6 && c.identitySwapV2 && kr.encode(d, c.identitySwapV2),
        n >= 10 && c.contact && e.fixed32.encode(d, c.contact))
    },
    decode(d) {
      const c = e.buffer.decode(d),
        t = e.fixed32.decode(d),
        r = xr.decode(d),
        i = e.uint.decode(d),
        a = e.uint.decode(d)
      return {
        roomKey: null,
        encryptionKey: c,
        mailbox: t,
        status: r,
        clock: i,
        initiator: 1 & a ? o.decode(d) : null,
        fastForwardTo: 2 & a ? e.fixed32.decode(d) : null,
        identitySwap: 4 & a ? br.decode(d) : null,
        identitySwapV2: n >= 6 && 8 & a ? kr.decode(d) : null,
        contact: n >= 10 && 16 & a ? e.fixed32.decode(d) : null,
      }
    },
  },
  gr = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.clock),
        li.preencode(d, n.status),
        d.end++,
        n.mailbox && e.fixed32.preencode(d, n.mailbox),
        n.roomKey && e.fixed32.preencode(d, n.roomKey))
    },
    encode(d, n) {
      const o = (n.mailbox ? 1 : 0) | (n.roomKey ? 2 : 0)
      ;(e.uint.encode(d, n.clock),
        li.encode(d, n.status),
        e.uint.encode(d, o),
        n.mailbox && e.fixed32.encode(d, n.mailbox),
        n.roomKey && e.fixed32.encode(d, n.roomKey))
    },
    decode(d) {
      const n = e.uint.decode(d),
        o = li.decode(d),
        c = e.uint.decode(d)
      return {
        memberKey: null,
        clock: n,
        status: o,
        mailbox: 1 & c ? e.fixed32.decode(d) : null,
        roomKey: 2 & c ? e.fixed32.decode(d) : null,
      }
    },
  },
  hr = ue,
  Kr = cc,
  wr = _o,
  Ar = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.clock),
        hr.preencode(d, o.sender),
        Kr.preencode(d, o.status),
        wr.preencode(d, o.keys),
        e.fixed32.preencode(d, o.mailbox),
        d.end++,
        o.message && e.string.preencode(d, o.message),
        n >= 11 && o.sentAt && e.uint.preencode(d, o.sentAt))
    },
    encode(d, o) {
      const c = (o.message ? 1 : 0) | (n >= 11 && o.sentAt ? 2 : 0)
      ;(e.uint.encode(d, o.clock),
        hr.encode(d, o.sender),
        Kr.encode(d, o.status),
        wr.encode(d, o.keys),
        e.fixed32.encode(d, o.mailbox),
        e.uint.encode(d, c),
        o.message && e.string.encode(d, o.message),
        n >= 11 && o.sentAt && e.uint.encode(d, o.sentAt))
    },
    decode(d) {
      const o = e.uint.decode(d),
        c = hr.decode(d),
        t = Kr.decode(d),
        r = wr.decode(d),
        i = e.fixed32.decode(d),
        a = e.uint.decode(d)
      return {
        memberKey: null,
        clock: o,
        sender: c,
        status: t,
        keys: r,
        mailbox: i,
        message: 1 & a ? e.string.decode(d) : null,
        sentAt: n >= 11 && 2 & a ? e.uint.decode(d) : 0,
      }
    },
  },
  Pr = {
    preencode(d, n) {
      e.uint.preencode(d, n.value)
    },
    encode(d, n) {
      e.uint.encode(d, n.value)
    },
    decode: (d) => ({ key: 0, value: e.uint.decode(d) }),
  },
  Tr = {
    preencode(d, n) {
      ;(ce.preencode(d, n.privateProfileIdentity), e.buffer.preencode(d, n.deviceProof))
    },
    encode(d, n) {
      ;(ce.encode(d, n.privateProfileIdentity), e.buffer.encode(d, n.deviceProof))
    },
    decode: (d) => ({
      deviceKey: null,
      privateProfileIdentity: ce.decode(d),
      deviceProof: e.buffer.decode(d),
    }),
  },
  Sr = {
    preencode(d, n) {
      ;(d.end++,
        n.encryptionKey && e.buffer.preencode(d, n.encryptionKey),
        n.fastForwardTo && e.fixed32.preencode(d, n.fastForwardTo))
    },
    encode(d, n) {
      const o = (n.encryptionKey ? 1 : 0) | (n.fastForwardTo ? 2 : 0)
      ;(e.uint.encode(d, o),
        n.encryptionKey && e.buffer.encode(d, n.encryptionKey),
        n.fastForwardTo && e.fixed32.encode(d, n.fastForwardTo))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        key: null,
        encryptionKey: 1 & n ? e.buffer.decode(d) : null,
        fastForwardTo: 2 & n ? e.fixed32.decode(d) : null,
      }
    },
  },
  Rr = ue,
  Cr = cc,
  Fr = _o,
  qr = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.clock),
        Rr.preencode(d, o.sender),
        Cr.preencode(d, o.status),
        Fr.preencode(d, o.keys),
        e.fixed32.preencode(d, o.mailbox),
        d.end++,
        o.message && e.string.preencode(d, o.message),
        n >= 11 && o.sentAt && e.uint.preencode(d, o.sentAt))
    },
    encode(d, o) {
      const c = (o.message ? 1 : 0) | (n >= 11 && o.sentAt ? 2 : 0)
      ;(e.uint.encode(d, o.clock),
        Rr.encode(d, o.sender),
        Cr.encode(d, o.status),
        Fr.encode(d, o.keys),
        e.fixed32.encode(d, o.mailbox),
        e.uint.encode(d, c),
        o.message && e.string.encode(d, o.message),
        n >= 11 && o.sentAt && e.uint.encode(d, o.sentAt))
    },
    decode(d) {
      const o = e.uint.decode(d),
        c = Rr.decode(d),
        t = Cr.decode(d),
        r = Fr.decode(d),
        i = e.fixed32.decode(d),
        a = e.uint.decode(d)
      return {
        memberKey: null,
        clock: o,
        sender: c,
        status: t,
        keys: r,
        mailbox: i,
        message: 1 & a ? e.string.decode(d) : null,
        sentAt: n >= 11 && 2 & a ? e.uint.decode(d) : 0,
      }
    },
  },
  Mr = {
    preencode(d, n) {
      e.fixed32.preencode(d, n.key)
    },
    encode(d, n) {
      e.fixed32.encode(d, n.key)
    },
    decode: (d) => ({ deviceKey: null, key: e.fixed32.decode(d) }),
  },
  Dr = dr,
  Lr = {
    preencode(d, n) {
      ;(fn.preencode(d, n.id), e.uint.preencode(d, n.clock))
    },
    encode(d, n) {
      ;(fn.encode(d, n.id), e.uint.encode(d, n.clock))
    },
    decode: (d) => ({ id: fn.decode(d), sender: null, clock: e.uint.decode(d), label: 0 }),
  },
  Br = dr,
  Er = $c,
  Ir = {
    preencode(d, o) {
      ;(fn.preencode(d, o.id),
        e.uint.preencode(d, o.total),
        Er.preencode(d, o.labels),
        e.uint.preencode(d, o.editedAt),
        d.end++,
        n >= 15 && o.flagsClock && e.uint.preencode(d, o.flagsClock),
        n >= 15 && o.version && e.uint.preencode(d, o.version))
    },
    encode(d, o) {
      const c =
        (n >= 15 && o.flagsClock ? 1 : 0) |
        (n >= 15 && o.version ? 2 : 0) |
        (n >= 16 && o.isDeleted ? 4 : 0)
      ;(fn.encode(d, o.id),
        e.uint.encode(d, o.total),
        Er.encode(d, o.labels),
        e.uint.encode(d, o.editedAt),
        e.uint.encode(d, c),
        n >= 15 && o.flagsClock && e.uint.encode(d, o.flagsClock),
        n >= 15 && o.version && e.uint.encode(d, o.version))
    },
    decode(d) {
      const o = fn.decode(d),
        c = e.uint.decode(d),
        t = Er.decode(d),
        r = e.uint.decode(d),
        i = d.start < d.end ? e.uint.decode(d) : 0
      return {
        id: o,
        total: c,
        labels: t,
        editedAt: r,
        flagsClock: n >= 15 && 1 & i ? e.uint.decode(d) : 0,
        version: n >= 15 && 2 & i ? e.uint.decode(d) : 0,
        isDeleted: n >= 16 && !!(4 & i),
      }
    },
  },
  jr = {
    preencode(d, n) {
      e.uint.preencode(d, n.length)
    },
    encode(d, n) {
      e.uint.encode(d, n.length)
    },
    decode: (d) => ({ memberKey: null, length: e.uint.decode(d) }),
  },
  Nr = Nt,
  Vr = {
    preencode(d, n) {
      e.uint.preencode(d, n.clock)
    },
    encode(d, n) {
      e.uint.encode(d, n.clock)
    },
    decode: (d) => ({ key: null, sender: null, clock: e.uint.decode(d), label: 0 }),
  },
  Or = xt,
  Jr = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.total),
        Or.preencode(d, n.labels),
        e.uint.preencode(d, n.editedAt),
        e.uint.preencode(d, n.flagsClock))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.total),
        Or.encode(d, n.labels),
        e.uint.encode(d, n.editedAt),
        e.uint.encode(d, n.flagsClock))
    },
    decode: (d) => ({
      key: null,
      total: e.uint.decode(d),
      labels: Or.decode(d),
      editedAt: e.uint.decode(d),
      flagsClock: e.uint.decode(d),
    }),
  },
  Ur = {
    preencode(d, o) {
      ;(e.buffer.preencode(d, o.encryptionKey),
        e.uint.preencode(d, o.createdAt),
        d.end++,
        n >= 19 && o.endedAt && e.uint.preencode(d, o.endedAt),
        n >= 19 && o.discoveryKey && e.fixed32.preencode(d, o.discoveryKey),
        n >= 19 && o.version && e.uint.preencode(d, o.version))
    },
    encode(d, o) {
      const c =
        (n >= 19 && o.endedAt ? 1 : 0) |
        (n >= 19 && o.discoveryKey ? 2 : 0) |
        (n >= 19 && o.version ? 4 : 0)
      ;(e.buffer.encode(d, o.encryptionKey),
        e.uint.encode(d, o.createdAt),
        e.uint.encode(d, c),
        n >= 19 && o.endedAt && e.uint.encode(d, o.endedAt),
        n >= 19 && o.discoveryKey && e.fixed32.encode(d, o.discoveryKey),
        n >= 19 && o.version && e.uint.encode(d, o.version))
    },
    decode(d) {
      const o = e.buffer.decode(d),
        c = e.uint.decode(d),
        t = e.uint.decode(d)
      return {
        callKey: null,
        encryptionKey: o,
        createdAt: c,
        endedAt: n >= 19 && 1 & t ? e.uint.decode(d) : 0,
        discoveryKey: n >= 19 && 2 & t ? e.fixed32.decode(d) : null,
        version: n >= 19 && 4 & t ? e.uint.decode(d) : 0,
      }
    },
  },
  Hr = {
    preencode(d, n) {
      e.uint.preencode(d, n.createdAt)
    },
    encode(d, n) {
      e.uint.encode(d, n.createdAt)
    },
    decode: (d) => ({ callKey: null, memberKey: null, createdAt: e.uint.decode(d) }),
  },
  zr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.createdAt),
        d.end++,
        n >= 19 && o.swarmKey && e.fixed32.preencode(d, o.swarmKey))
    },
    encode(d, o) {
      const c = n >= 19 && o.swarmKey ? 1 : 0
      ;(e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.createdAt),
        e.uint.encode(d, c),
        n >= 19 && o.swarmKey && e.fixed32.encode(d, o.swarmKey))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.uint.decode(d),
        t = e.uint.decode(d)
      return {
        callKey: null,
        deviceKey: null,
        memberKey: o,
        createdAt: c,
        swarmKey: n >= 19 && 1 & t ? e.fixed32.decode(d) : null,
      }
    },
  },
  Gr = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.deviceKey), e.uint.preencode(d, n.createdAt))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.deviceKey), e.uint.encode(d, n.createdAt))
    },
    decode: (d) => ({
      callKey: null,
      deviceKey: e.fixed32.decode(d),
      streamKey: null,
      createdAt: e.uint.decode(d),
    }),
  },
  Qr = e.frame(A),
  Wr = Qr,
  Xr = e.array(Ec),
  Yr = e.frame(pe),
  Zr = Qr,
  $r = Yr,
  _r = e.frame(Kc),
  ei = Yr,
  di = e.frame(md),
  ni = e.frame(xc),
  oi = e.frame(kt),
  ci = oi,
  ti = e.array(e.frame(jc)),
  ri = Qr,
  ii = e.frame(Jo),
  ai = ii,
  si = ii,
  pi = Qr,
  ui = Yr,
  li = ii
function fi(e) {
  n = e
}
function mi(d, o, c = 19) {
  return ((n = c), e.encode(bi(d), o))
}
function yi(d, o, c = 19) {
  return ((n = c), e.decode(bi(d), o))
}
function xi(e) {
  switch (e) {
    case "@keet/room-type":
      return J
    case "@keet/display-type":
      return Tc
    case "@keet/system-settings-keys":
      return Dc
    case "@keet/room-supported-language":
      return Bc
    case "@keet/label-type":
      return Hc
    case "@keet-private-id/user-settings-key":
      return tt
    case "@keet/member-label-type":
      return pt
    default:
      throw new Error("Enum not found " + e)
  }
}
function bi(e) {
  switch (e) {
    case "@keet/head":
      return o
    case "@keet/oplog-id":
      return c
    case "@keet/encryption-keypair":
      return t
    case "@keet/signing-keypair":
      return r
    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 g
    case "@keet/image-file":
      return A
    case "@keet/file-status":
      return P
    case "@keet/file-record":
      return R
    case "@keet/device-status":
      return C
    case "@keet/member-status":
      return F
    case "@keet/member-moderation-status":
      return q
    case "@keet/abi":
      return M
    case "@keet/device-stats":
      return D
    case "@keet/member-stats":
      return L
    case "@keet/chat-stats":
      return B
    case "@keet/file-stats":
      return E
    case "@keet/stats":
      return O
    case "@keet/room-type":
      return U
    case "@keet/system-settings":
      return H
    case "@keet/system-digest":
      return Q
    case "@keet/room-seed":
      return W
    case "@keet/room-capabilities":
      return X
    case "@keet/room-config":
      return Z
    case "@keet/blind-peer":
      return $
    case "@keet/add-blind-peer-operation":
      return de
    case "@keet/remove-blind-peer-operation":
      return oe
    case "@keet/identity-attestation":
      return ce
    case "@keet/device-invitation":
      return te
    case "@keet/device":
      return ae
    case "@keet/member-profile":
      return se
    case "@keet/device-profile":
      return pe
    case "@keet/member-update":
      return le
    case "@keet/device-update":
      return fe
    case "@keet/signed-pairing-data":
      return me
    case "@keet/device-request-identity":
      return ye
    case "@keet/device-response-identity":
      return xe
    case "@keet/device-request-with-invitation":
      return ge
    case "@keet/device-request-with-invitation-and-proof":
      return Ke
    case "@keet/device-request-with-member-proof":
      return Pe
    case "@keet/device-request":
      return Re
    case "@keet/device-response":
      return qe
    case "@keet/invitation-metadata":
      return Me
    case "@keet/invitation":
      return Be
    case "@keet/add-invitation-operation":
      return je
    case "@keet/remove-invitation-operation":
      return Ve
    case "@keet/sendable-room-invitation":
      return Oe
    case "@keet/sendable-identity-invitation":
      return Je
    case "@keet/sendable-contact-invitation":
      return Ue
    case "@keet/sendable-invitation":
      return We
    case "@keet/add-device-operation":
      return Ye
    case "@keet/update-device-operation":
      return $e
    case "@keet/start-indexing-operation":
      return _e
    case "@keet/stop-indexing-operation":
      return ed
    case "@keet/join-request":
      return nd
    case "@keet/accept-join-request-operation":
      return td
    case "@keet/reject-join-request-operation":
      return id
    case "@keet/member":
      return pd
    case "@keet/full-member":
      return fd
    case "@keet/member-proofs":
      return md
    case "@keet/update-member-operation":
      return bd
    case "@keet/change-member-status-operation":
      return gd
    case "@keet/change-member-role-operation":
      return Kd
    case "@keet/remove-member-operation":
      return Ad
    case "@keet/member-activity":
      return Pd
    case "@keet/member-joined-event":
      return Td
    case "@keet/member-left-event":
      return Sd
    case "@keet/title-changed-chat-event":
      return Rd
    case "@keet/chat-event":
      return Md
    case "@keet/sendable-event":
      return Dd
    case "@keet/display-range":
      return Ld
    case "@keet/display-content-range":
      return Ed
    case "@keet/mention-display-item":
      return jd
    case "@keet/link-preview":
      return Od
    case "@keet/display-link-item":
      return Hd
    case "@keet/display":
      return en
    case "@keet/oplog-message":
      return cn
    case "@keet/index-message":
      return an
    case "@keet/full-index-message":
      return un
    case "@keet/message-status":
      return ln
    case "@keet/message-index-id":
      return fn
    case "@keet/thread":
      return yn
    case "@keet/chat-message-record":
      return vn
    case "@keet/full-chat-message-record":
      return wn
    case "@keet/add-chat-message-operation":
      return Tn
    case "@keet/remove-chat-message-operation":
      return Rn
    case "@keet/update-chat-message-operation":
      return qn
    case "@keet/pin-chat-message-operation":
      return Dn
    case "@keet/reaction":
      return Ln
    case "@keet/reactions-summary":
      return Bn
    case "@keet/reactions-digest":
      return In
    case "@keet/add-reaction-operation":
      return Nn
    case "@keet/remove-reaction-operation":
      return On
    case "@keet/update-room-config-operation":
      return Hn
    case "@keet/group-member":
      return zn
    case "@keet/user-registry-info":
      return Gn
    case "@keet/room-identity":
      return Wn
    case "@keet/genesis-operation":
      return oo
    case "@keet/upgrade-operation":
      return to
    case "@keet/update-system-settings-operation":
      return ao
    case "@keet-private-id/contact":
      return so
    case "@keet-private-id/v3-room-migration-info":
      return po
    case "@keet-private-id/run-v3-migration-operation":
      return fo
    case "@keet-private-id/update-identity-operation":
      return yo
    case "@keet-private-id/counters":
      return xo
    case "@keet-private-id/stats":
      return bo
    case "@keet-private-id/add-entropy-operation":
      return ko
    case "@keet-private-id/pending-invitation-identity":
      return vo
    case "@keet-private-id/pending-invitation":
      return ho
    case "@keet-private-id/resolve-pending-invitation-operation":
      return wo
    case "@keet-private-id/add-pending-invitation-operation":
      return To
    case "@keet-private-id/remove-pending-invitation-operation":
      return Ro
    case "@keet-private-id/identity-swap":
      return Co
    case "@keet-private-id/room-status":
      return Fo
    case "@keet-private-id/room":
      return Lo
    case "@keet-private-id/add-room-operation":
      return Eo
    case "@keet-private-id/remove-room-operation":
      return jo
    case "@keet-private-id/update-room-status-operation":
      return Oo
    case "@keet-private-id/contact-status":
      return Jo
    case "@keet-private-id/contact-record":
      return Uo
    case "@keet-private-id/add-contact-operation":
      return Go
    case "@keet-private-id/update-contact-status-operation":
      return Wo
    case "@keet-private-id/remove-contact-operation":
      return Yo
    case "@keet-private-id/contact-request-status":
      return Zo
    case "@keet-private-id/contact-request-body":
      return ec
    case "@keet-private-id/contact-request":
      return nc
    case "@keet-private-id/contact-request-record":
      return rc
    case "@keet-private-id/add-contact-request-operation":
      return ac
    case "@keet-private-id/update-contact-request-status-operation":
      return uc
    case "@keet-private-id/profile-discovery-record-v1":
      return lc
    case "@keet-private-id/profile-discovery-record":
      return fc
    case "@keet/add-file-preview-operation":
      return yc
    case "@keet/member-removed-event":
      return xc
    case "@keet/member-contact-info":
      return kc
    case "@keet/remove-device-operation":
      return gc
    case "@keet/device-identity":
      return hc
    case "@keet/readonly-room-invitation":
      return Kc
    case "@keet-private-id/identity-swap-v2":
      return wc
    case "@keet-private-id/activate-contact-room-operation":
      return Pc
    case "@keet/display-type":
      return Sc
    case "@keet/test-increment-operation":
      return Cc
    case "@keet/test-collection-record-1":
      return Fc
    case "@keet/migrate-abi-operation":
      return Mc
    case "@keet/system-settings-keys":
      return Lc
    case "@keet/room-supported-language":
      return Ec
    case "@keet/translation-display-item":
      return jc
    case "@keet-private-id/unreads":
      return Nc
    case "@keet-private-id/add-unreads-key-operation":
      return Oc
    case "@keet-private-id/remove-unreads-key-operation":
      return Uc
    case "@keet/label-type":
      return zc
    case "@keet/chat-label":
      return Gc
    case "@keet/add-chat-label-operation":
      return Wc
    case "@keet/remove-chat-label-operation":
      return Yc
    case "@keet/chat-label-summary":
      return Zc
    case "@keet/chat-label-digest":
      return _c
    case "@keet/update-read-length-operation":
      return dt
    case "@keet/read-length":
      return nt
    case "@keet/tmp-removed-member":
      return ot
    case "@keet-private-id/settings":
      return ct
    case "@keet-private-id/user-settings-key":
      return rt
    case "@keet-private-id/update-settings-operation":
      return st
    case "@keet/member-label-type":
      return ut
    case "@keet/member-label":
      return lt
    case "@keet/add-member-label-operation":
      return mt
    case "@keet/member-label-summary":
      return yt
    case "@keet/member-label-digest":
      return bt
    case "@keet/location-shared-event":
      return kt
    case "@keet/move-indexer-operation":
      return gt
    case "@keet/start-call":
      return wt
    case "@keet/join-call":
      return Tt
    case "@keet/leave-call":
      return Rt
    case "@keet/end-call":
      return Ft
    case "@keet/add-call-stream":
      return Mt
    case "@keet/remove-call-stream":
      return Lt
    case "@keet/call-record":
      return Bt
    case "@keet/call-member-record":
      return Et
    case "@keet/call-device-record":
      return It
    case "@keet/call-stream-record":
      return jt
    case "@keet/blind-peer/hyperdb#1":
      return Nt
    case "@keet/join-request/hyperdb#4":
      return Ot
    case "@keet/device/hyperdb#5":
      return Ht
    case "@keet/member-proofs/hyperdb#10":
      return zt
    case "@keet/member/hyperdb#11":
      return Wt
    case "@keet/member-activity/hyperdb#17":
      return Xt
    case "@keet/invitation/hyperdb#18":
      return $t
    case "@keet/thread/hyperdb#19":
      return er
    case "@keet/message-index-id/hyperdb#21":
      return dr
    case "@keet/chat-message-record/hyperdb#21":
      return tr
    case "@keet/message-index-id/hyperdb#25":
      return rr
    case "@keet/reactions-digest/hyperdb#25":
      return ar
    case "@keet/message-index-id/hyperdb#26":
      return sr
    case "@keet/reaction/hyperdb#26":
      return pr
    case "@keet/file-record/hyperdb#28":
      return fr
    case "@keet-private-id/pending-invitation/hyperdb#35":
      return yr
    case "@keet-private-id/room/hyperdb#36":
      return vr
    case "@keet-private-id/contact-record/hyperdb#38":
      return gr
    case "@keet-private-id/contact-request-record/hyperdb#40":
      return Ar
    case "@keet/test-collection-record-1/hyperdb#46":
      return Pr
    case "@keet/device-identity/hyperdb#50":
      return Tr
    case "@keet/room-keys/hyperdb#51":
      return Sr
    case "@keet-private-id/contact-request-record/hyperdb#51":
      return qr
    case "@keet-private-id/unreads/hyperdb#59":
      return Mr
    case "@keet/message-index-id/hyperdb#60":
      return Dr
    case "@keet/chat-label/hyperdb#60":
      return Lr
    case "@keet/message-index-id/hyperdb#61":
      return Br
    case "@keet/chat-label-digest/hyperdb#61":
      return Ir
    case "@keet/read-length/hyperdb#62":
      return jr
    case "@keet/tmp-removed-member/hyperdb#63":
      return Nr
    case "@keet/member-label/hyperdb#66":
      return Vr
    case "@keet/member-label-digest/hyperdb#67":
      return Jr
    case "@keet/call-record/hyperdb#69":
      return Ur
    case "@keet/call-member-record/hyperdb#72":
      return Hr
    case "@keet/call-device-record/hyperdb#73":
      return zr
    case "@keet/call-stream-record/hyperdb#75":
      return Gr
    default:
      throw new Error("Encoder not found " + e)
  }
}
function ki(e, d = 19) {
  const o = bi(e)
  return {
    preencode(e, c) {
      ;((n = d), o.preencode(e, c))
    },
    encode(e, c) {
      ;((n = d), o.encode(e, c))
    },
    decode: (e) => ((n = d), o.decode(e)),
  }
}
const vi = ki
module.exports = {
  resolveStruct: vi,
  getStruct: ki,
  getEnum: xi,
  getEncoding: bi,
  encode: mi,
  decode: yi,
  setVersion: fi,
  version: n,
}