OverviewFilesCommitsIssuesDocsReleasesPeers

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

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