OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated / @holepunchto / keet-core / schema / spec / local / hyperdb / messages.js

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