OverviewFilesCommitsIssuesDocsReleasesPeers

keet-cli / keet-core-4.14.4-pretty / schema / spec / contract / hyperdispatch / messages.js

3981 lines · javascript ref:
const { c: e } = require("hyperschema/runtime"),
  d = 20
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) }),
  },
  r = {
    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) }),
  },
  t = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.publicKey), e.fixed64.preencode(d, n.secretKey))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.publicKey), e.fixed64.encode(d, n.secretKey))
    },
    decode: (d) => ({ publicKey: e.fixed32.decode(d), secretKey: e.fixed64.decode(d) }),
  },
  i = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key),
        d.end++,
        n.encryptionKey && e.buffer.preencode(d, n.encryptionKey),
        n.fastForwardTo && e.fixed32.preencode(d, n.fastForwardTo))
    },
    encode(d, n) {
      const o = (n.encryptionKey ? 1 : 0) | (n.fastForwardTo ? 2 : 0)
      ;(e.fixed32.encode(d, n.key),
        e.uint.encode(d, o),
        n.encryptionKey && e.buffer.encode(d, n.encryptionKey),
        n.fastForwardTo && e.fixed32.encode(d, n.fastForwardTo))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        o = e.uint.decode(d)
      return {
        key: n,
        encryptionKey: 1 & o ? e.buffer.decode(d) : null,
        fastForwardTo: 2 & o ? e.fixed32.decode(d) : null,
      }
    },
  },
  a = {
    preencode(d, n) {
      e.uint.preencode(d, n.timestamp)
    },
    encode(d, n) {
      e.uint.encode(d, n.timestamp)
    },
    decode: (d) => ({ timestamp: e.uint.decode(d) }),
  },
  s = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.blockOffset),
        e.uint.preencode(d, n.blockLength),
        e.uint.preencode(d, n.byteOffset),
        e.uint.preencode(d, n.byteLength))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.blockOffset),
        e.uint.encode(d, n.blockLength),
        e.uint.encode(d, n.byteOffset),
        e.uint.encode(d, n.byteLength))
    },
    decode: (d) => ({
      blockOffset: e.uint.decode(d),
      blockLength: e.uint.decode(d),
      byteOffset: e.uint.decode(d),
      byteLength: e.uint.decode(d),
    }),
  },
  p = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.width), e.uint.preencode(d, n.height))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.width), e.uint.encode(d, n.height))
    },
    decode: (d) => ({ width: e.uint.decode(d), height: e.uint.decode(d) }),
  },
  u = e.frame(p),
  l = {
    preencode(d, n) {
      ;(d.end++,
        n.name && e.string.preencode(d, n.name),
        n.mimetype && e.string.preencode(d, n.mimetype),
        n.dimensions && u.preencode(d, n.dimensions),
        n.userdata && e.buffer.preencode(d, n.userdata),
        n.duration && e.uint.preencode(d, n.duration))
    },
    encode(d, n) {
      const o =
        (n.name ? 1 : 0) |
        (n.mimetype ? 2 : 0) |
        (n.dimensions ? 4 : 0) |
        (n.userdata ? 8 : 0) |
        (n.duration ? 16 : 0) |
        (n.isPreview ? 32 : 0)
      ;(e.uint.encode(d, o),
        n.name && e.string.encode(d, n.name),
        n.mimetype && e.string.encode(d, n.mimetype),
        n.dimensions && u.encode(d, n.dimensions),
        n.userdata && e.buffer.encode(d, n.userdata),
        n.duration && e.uint.encode(d, n.duration))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        name: 1 & n ? e.string.decode(d) : null,
        mimetype: 2 & n ? e.string.decode(d) : null,
        dimensions: 4 & n ? u.decode(d) : null,
        userdata: 8 & n ? e.buffer.decode(d) : null,
        duration: 16 & n ? e.uint.decode(d) : 0,
        isPreview: !!(32 & n),
      }
    },
  },
  f = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key),
        e.string.preencode(d, n.path),
        e.uint.preencode(d, n.version),
        e.uint.preencode(d, n.size))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.key),
        e.string.encode(d, n.path),
        e.uint.encode(d, n.version),
        e.uint.encode(d, n.size))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      path: e.string.decode(d),
      version: e.uint.decode(d),
      size: e.uint.decode(d),
    }),
  },
  m = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key), s.preencode(d, n.blob))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.key), s.encode(d, n.blob))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), blob: s.decode(d) }),
  },
  y = e.frame(m),
  x = e.frame(f),
  b = {
    preencode(d, n) {
      ;(d.end++,
        n.inlined && e.buffer.preencode(d, n.inlined),
        n.blob && s.preencode(d, n.blob),
        n.externalBlob && y.preencode(d, n.externalBlob),
        n.externalDrive && x.preencode(d, n.externalDrive))
    },
    encode(d, n) {
      const o =
        (n.inlined ? 1 : 0) |
        (n.blob ? 2 : 0) |
        (n.externalBlob ? 4 : 0) |
        (n.externalDrive ? 8 : 0)
      ;(e.uint.encode(d, o),
        n.inlined && e.buffer.encode(d, n.inlined),
        n.blob && s.encode(d, n.blob),
        n.externalBlob && y.encode(d, n.externalBlob),
        n.externalDrive && x.encode(d, n.externalDrive))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        inlined: 1 & n ? e.buffer.decode(d) : null,
        blob: 2 & n ? s.decode(d) : null,
        externalBlob: 4 & n ? y.decode(d) : null,
        externalDrive: 8 & n ? x.decode(d) : null,
      }
    },
  },
  k = e.frame(b),
  v = e.frame(l),
  g = {
    preencode(d, n) {
      ;(k.preencode(d, n.pointer),
        d.end++,
        n.metadata && v.preencode(d, n.metadata),
        n.preview && zr.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 && zr.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 ? zr.decode(d) : null,
        hash: 4 & o ? e.fixed32.decode(d) : null,
      }
    },
  },
  h = e.frame(g),
  K = h,
  w = h,
  T = {
    preencode(e, d) {
      ;(e.end++,
        d.small && h.preencode(e, d.small),
        d.medium && K.preencode(e, d.medium),
        d.large && w.preencode(e, d.large))
    },
    encode(d, n) {
      const o = (n.small ? 1 : 0) | (n.medium ? 2 : 0) | (n.large ? 4 : 0)
      ;(e.uint.encode(d, o),
        n.small && h.encode(d, n.small),
        n.medium && K.encode(d, n.medium),
        n.large && w.encode(d, n.large))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        small: 1 & n ? h.decode(d) : null,
        medium: 2 & n ? K.decode(d) : null,
        large: 4 & n ? w.decode(d) : null,
      }
    },
  },
  P = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      const o = n.isDeleted ? 1 : 0
      e.uint.encode(d, o)
    },
    decode: (d) => ({ isDeleted: !!(1 & e.uint.decode(d)) }),
  },
  A = e.frame(P),
  R = h,
  D = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.id),
        c.preencode(d, o.oplog),
        A.preencode(d, o.status),
        R.preencode(d, o.file),
        d.end++,
        n >= 14 && o.version && e.uint.preencode(d, o.version))
    },
    encode(d, o) {
      const r = n >= 14 && o.version ? 1 : 0
      ;(e.uint.encode(d, o.id),
        c.encode(d, o.oplog),
        A.encode(d, o.status),
        R.encode(d, o.file),
        e.uint.encode(d, r),
        n >= 14 && o.version && e.uint.encode(d, o.version))
    },
    decode(d) {
      const o = e.uint.decode(d),
        r = c.decode(d),
        t = A.decode(d),
        i = R.decode(d),
        a = d.start < d.end ? e.uint.decode(d) : 0
      return {
        id: o,
        oplog: r,
        status: t,
        file: i,
        version: n >= 14 && 1 & a ? e.uint.decode(d) : 0,
      }
    },
  },
  S = {
    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) }
    },
  },
  C = {
    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) }
    },
  },
  L = {
    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) }),
  },
  F = {
    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),
    }),
  },
  E = {
    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),
        r = e.uint.decode(d),
        t = e.uint.decode(d),
        i = d.start < d.end ? e.uint.decode(d) : 0
      return {
        clock: o,
        pinned: c,
        threads: r,
        timestamp: t,
        flagsClock: n >= 15 && 1 & i ? e.uint.decode(d) : 0,
      }
    },
  },
  B = {
    preencode(d, n) {
      e.uint.preencode(d, n.clock)
    },
    encode(d, n) {
      e.uint.encode(d, n.clock)
    },
    decode: (d) => ({ clock: e.uint.decode(d) }),
  },
  I = e.frame(q),
  N = e.frame(F),
  j = e.frame(E),
  O = e.frame(B),
  J = {
    preencode(e, d) {
      ;(I.preencode(e, d.devices),
        N.preencode(e, d.members),
        j.preencode(e, d.chat),
        O.preencode(e, d.files))
    },
    encode(e, d) {
      ;(I.encode(e, d.devices), N.encode(e, d.members), j.encode(e, d.chat), O.encode(e, d.files))
    },
    decode: (e) => ({
      devices: I.decode(e),
      members: N.decode(e),
      chat: j.decode(e),
      files: O.decode(e),
    }),
  },
  U = { Default: 1, Broadcast: 2, DirectMessage: 3 },
  V = {
    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 && V.preencode(d, o.roomType),
        n >= 20 && o.buildType && Or.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 && V.encode(d, o.roomType),
        n >= 20 && o.buildType && Or.encode(d, o.buildType))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        roomType: 1 & o ? V.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 ? Or.decode(d) : null,
      }
    },
  },
  z = e.frame(L),
  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) {
      ;(r.preencode(d, n.mailboxKeyPair),
        t.preencode(d, n.discoveryKeyPair),
        e.fixed32.preencode(d, n.wakeupTopic),
        e.fixed32.preencode(d, n.swarmTopic))
    },
    encode(d, n) {
      ;(r.encode(d, n.mailboxKeyPair),
        t.encode(d, n.discoveryKeyPair),
        e.fixed32.encode(d, n.wakeupTopic),
        e.fixed32.encode(d, n.swarmTopic))
    },
    decode: (d) => ({
      mailboxKeyPair: r.decode(d),
      discoveryKeyPair: t.decode(d),
      wakeupTopic: e.fixed32.decode(d),
      swarmTopic: e.fixed32.decode(d),
    }),
  },
  Y = e.array(e.fixed32),
  Z = {
    preencode(d, o) {
      ;(d.end++,
        o.title && e.string.preencode(d, o.title),
        o.avatar && Gr.preencode(d, o.avatar),
        o.description && e.string.preencode(d, o.description),
        n >= 11 && o.supportedLanguages && Qr.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 && Gr.encode(d, o.avatar),
        o.description && e.string.encode(d, o.description),
        n >= 11 && o.supportedLanguages && Qr.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 ? Gr.decode(d) : null,
        description: 4 & o ? e.string.decode(d) : null,
        supportedLanguages: n >= 11 && 8 & o ? Qr.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) }),
  },
  re = {
    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) }),
  },
  te = e.frame(S),
  ie = e.frame(re),
  ae = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key),
        e.fixed32.preencode(d, n.memberKey),
        te.preencode(d, n.status),
        Wr.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),
        te.encode(d, n.status),
        Wr.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: te.decode(d),
      profile: Wr.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 && Xr.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 && Xr.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 ? Xr.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 && Or.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 && Or.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 ? Or.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) {
      ;(Yr.preencode(e, d.profile), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(Yr.encode(e, d.profile), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: Yr.decode(e), attestation: ce.decode(e) }),
  },
  me = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.id),
        e.buffer.preencode(d, n.data),
        e.buffer.preencode(d, n.signature))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.id), e.buffer.encode(d, n.data), e.buffer.encode(d, n.signature))
    },
    decode: (d) => ({
      id: e.fixed32.decode(d),
      data: e.buffer.decode(d),
      signature: e.buffer.decode(d),
    }),
  },
  ye = {
    preencode(d, n) {
      e.fixed32.preencode(d, n.devicePublicKey)
    },
    encode(d, n) {
      e.fixed32.encode(d, n.devicePublicKey)
    },
    decode: (d) => ({ devicePublicKey: e.fixed32.decode(d) }),
  },
  xe = {
    preencode(d, n) {
      ;(ce.preencode(d, n.privateProfileIdentity), e.buffer.preencode(d, n.deviceProof))
    },
    encode(d, n) {
      ;(ce.encode(d, n.privateProfileIdentity), e.buffer.encode(d, n.deviceProof))
    },
    decode: (d) => ({ privateProfileIdentity: ce.decode(d), deviceProof: e.buffer.decode(d) }),
  },
  be = e.frame(fe),
  ke = e.frame(le),
  ve = e.frame(ye),
  ge = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.deviceKey),
        t.preencode(d, n.keyPair),
        be.preencode(d, n.device),
        ke.preencode(d, n.member),
        d.end++,
        n.identity && ve.preencode(d, n.identity))
    },
    encode(d, n) {
      const o = n.identity ? 1 : 0
      ;(e.fixed32.encode(d, n.deviceKey),
        t.encode(d, n.keyPair),
        be.encode(d, n.device),
        ke.encode(d, n.member),
        e.uint.encode(d, o),
        n.identity && ve.encode(d, n.identity))
    },
    decode: (d) => ({
      deviceKey: e.fixed32.decode(d),
      keyPair: t.decode(d),
      device: be.decode(d),
      member: ke.decode(d),
      identity: 1 & e.uint.decode(d) ? ve.decode(d) : null,
    }),
  },
  he = e.frame(ge),
  Ke = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.id),
        he.preencode(d, n.request),
        e.buffer.preencode(d, n.signature))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.id), he.encode(d, n.request), e.buffer.encode(d, n.signature))
    },
    decode: (d) => ({
      id: e.fixed32.decode(d),
      request: he.decode(d),
      signature: e.buffer.decode(d),
    }),
  },
  we = be,
  Te = ke,
  Pe = {
    preencode(e, d) {
      ;(we.preencode(e, d.device), e.end++, d.member && Te.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 && Te.encode(d, n.member))
    },
    decode: (d) => ({ device: we.decode(d), member: 1 & e.uint.decode(d) ? Te.decode(d) : null }),
  },
  Ae = e.frame(Ke),
  Re = e.frame(Pe),
  De = {
    preencode(e, d) {
      ;(e.end++,
        d.withInvitation && Ae.preencode(e, d.withInvitation),
        d.withMemberProof && Re.preencode(e, d.withMemberProof))
    },
    encode(d, n) {
      const o = (n.withInvitation ? 1 : 0) | (n.withMemberProof ? 2 : 0)
      ;(e.uint.encode(d, o),
        n.withInvitation && Ae.encode(d, n.withInvitation),
        n.withMemberProof && Re.encode(d, n.withMemberProof))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        withInvitation: 1 & n ? Ae.decode(d) : null,
        withMemberProof: 2 & n ? Re.decode(d) : null,
      }
    },
  },
  Se = e.frame(me),
  Ce = e.frame(xe),
  Me = {
    preencode(e, d) {
      ;(Se.preencode(e, d.signedKeys), e.end++, d.identity && Ce.preencode(e, d.identity))
    },
    encode(d, n) {
      const o = n.identity ? 1 : 0
      ;(Se.encode(d, n.signedKeys), e.uint.encode(d, o), n.identity && Ce.encode(d, n.identity))
    },
    decode: (d) => ({
      signedKeys: Se.decode(d),
      identity: 1 & e.uint.decode(d) ? Ce.decode(d) : null,
    }),
  },
  Le = {
    preencode(d, o) {
      ;(d.end++,
        o.expiration && e.uint.preencode(d, o.expiration),
        n >= 20 && o.buildType && Or.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 && Or.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 ? Or.decode(d) : null,
      }
    },
  },
  qe = Se,
  Fe = e.frame(Le),
  Ee = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.id),
        qe.preencode(d, n.response),
        Fe.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),
        Fe.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),
        r = Fe.decode(d),
        t = e.uint.decode(d)
      return {
        id: n,
        response: c,
        metadata: r,
        anchor: 1 & t ? o.decode(d) : null,
        isActive: !!(2 & t),
      }
    },
  },
  Be = _,
  Ie = e.frame(Ee),
  Ne = {
    preencode(e, d) {
      ;(Be.preencode(e, d.header), Ie.preencode(e, d.invitation))
    },
    encode(e, d) {
      ;(Be.encode(e, d.header), Ie.encode(e, d.invitation))
    },
    decode: (e) => ({ header: Be.decode(e), invitation: Ie.decode(e) }),
  },
  je = _,
  Oe = {
    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) }),
  },
  Je = {
    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),
    }),
  },
  Ue = {
    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),
    }),
  },
  Ve = {
    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(Je),
  ze = e.frame(Ue),
  Ge = e.frame(Ve),
  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 && Zr.preencode(e, d.readonly),
        n >= 11 && d.additionalNodes && Qe.preencode(e, d.additionalNodes),
        n >= 20 && d.buildType && Or.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 && Zr.encode(d, o.readonly),
        n >= 11 && o.additionalNodes && Qe.encode(d, o.additionalNodes),
        n >= 20 && o.buildType && Or.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 ? Zr.decode(d) : null,
        additionalNodes: n >= 11 && 16 & o ? Qe.decode(d) : null,
        buildType: n >= 20 && 32 & o ? Or.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 && $r.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 && $r.encode(d, n.profile))
    },
    decode: (d) => ({ header: Ze.decode(d), profile: 1 & e.uint.decode(d) ? $r.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 = Ce,
  rd = {
    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,
    }),
  },
  td = _,
  id = {
    preencode(d, n) {
      ;(td.preencode(d, n.header), e.fixed32.preencode(d, n.deviceKey))
    },
    encode(d, n) {
      ;(td.encode(d, n.header), e.fixed32.encode(d, n.deviceKey))
    },
    decode: (d) => ({ header: td.decode(d), deviceKey: e.fixed32.decode(d) }),
  },
  ad = e.frame(C),
  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 && _r.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 && _r.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) ? _r.decode(d) : null,
    }),
  },
  md = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key),
        d.end++,
        n.profileAttestation && e.buffer.preencode(d, n.profileAttestation),
        n.latestReceipt && e.buffer.preencode(d, n.latestReceipt))
    },
    encode(d, n) {
      const o = (n.profileAttestation ? 1 : 0) | (n.latestReceipt ? 2 : 0)
      ;(e.fixed32.encode(d, n.key),
        e.uint.encode(d, o),
        n.profileAttestation && e.buffer.encode(d, n.profileAttestation),
        n.latestReceipt && e.buffer.encode(d, n.latestReceipt))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        o = e.uint.decode(d)
      return {
        key: n,
        profileAttestation: 1 & o ? e.buffer.decode(d) : null,
        latestReceipt: 2 & o ? e.buffer.decode(d) : null,
      }
    },
  },
  yd = _,
  xd = ke,
  bd = {
    preencode(e, d) {
      ;(yd.preencode(e, d.header), xd.preencode(e, d.member))
    },
    encode(e, d) {
      ;(yd.encode(e, d.header), xd.encode(e, d.member))
    },
    decode: (e) => ({ header: yd.decode(e), member: xd.decode(e) }),
  },
  kd = _,
  vd = e.frame(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 = _,
  Td = {
    preencode(d, n) {
      ;(wd.preencode(d, n.header), e.fixed32.preencode(d, n.key))
    },
    encode(d, n) {
      ;(wd.encode(d, n.header), e.fixed32.encode(d, n.key))
    },
    decode: (d) => ({ header: wd.decode(d), key: e.fixed32.decode(d) }),
  },
  Pd = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key), e.uint.preencode(d, n.mentions))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.key), e.uint.encode(d, n.mentions))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), mentions: e.uint.decode(d) }),
  },
  Ad = {
    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 }),
  },
  Rd = Ad,
  Dd = {
    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 }
    },
  },
  Sd = e.frame(Ad),
  Cd = e.frame(Rd),
  Md = e.frame(Dd),
  Ld = {
    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 && Sd.preencode(d, o.memberJoined),
        o.memberLeft && Cd.preencode(d, o.memberLeft),
        o.titleChanged && Md.preencode(d, o.titleChanged),
        n >= 3 && o.memberRemoved && et.preencode(d, o.memberRemoved),
        n >= 18 && o.locationShared && dt.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 && Sd.encode(d, o.memberJoined),
        o.memberLeft && Cd.encode(d, o.memberLeft),
        o.titleChanged && Md.encode(d, o.titleChanged),
        n >= 3 && o.memberRemoved && et.encode(d, o.memberRemoved),
        n >= 18 && o.locationShared && dt.encode(d, o.locationShared))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        memberJoined: 1 & o ? Sd.decode(d) : null,
        memberLeft: 2 & o ? Cd.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 ? et.decode(d) : null,
        locationShared: n >= 18 && 512 & o ? dt.decode(d) : null,
      }
    },
  },
  qd = {
    preencode(e, d) {
      ;(e.end++, n >= 18 && d.locationShared && nt.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 && nt.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 ? nt.decode(d) : null,
      }
    },
  },
  Fd = {
    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) }),
  },
  Ed = e.frame(Fd),
  Bd = {
    preencode(d, n) {
      ;(Ed.preencode(d, n.range), e.string.preencode(d, n.content))
    },
    encode(d, n) {
      ;(Ed.encode(d, n.range), e.string.encode(d, n.content))
    },
    decode: (d) => ({ range: Ed.decode(d), content: e.string.decode(d) }),
  },
  Id = Ed,
  Nd = {
    preencode(d, n) {
      ;(Id.preencode(d, n.range), e.fixed32.preencode(d, n.memberKey))
    },
    encode(d, n) {
      ;(Id.encode(d, n.range), e.fixed32.encode(d, n.memberKey))
    },
    decode: (d) => ({ range: Id.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  jd = h,
  Od = e.array(e.uint),
  Jd = {
    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 && Od.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 && Od.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 ? Od.decode(d) : null,
      }
    },
  },
  Ud = Ed,
  Vd = e.frame(Jd),
  Hd = {
    preencode(d, n) {
      ;(Ud.preencode(d, n.range),
        e.string.preencode(d, n.url),
        d.end++,
        n.preview && Vd.preencode(d, n.preview))
    },
    encode(d, n) {
      const o = n.preview ? 1 : 0
      ;(Ud.encode(d, n.range),
        e.string.encode(d, n.url),
        e.uint.encode(d, o),
        n.preview && Vd.encode(d, n.preview))
    },
    decode: (d) => ({
      range: Ud.decode(d),
      url: e.string.decode(d),
      preview: 1 & e.uint.decode(d) ? Vd.decode(d) : null,
    }),
  },
  zd = e.array(e.frame(Nd)),
  Gd = e.array(e.frame(Hd)),
  Qd = Gd,
  Wd = e.array(e.frame(Fd)),
  Xd = Wd,
  Yd = Wd,
  Zd = e.array(e.frame(Bd)),
  $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 && ot.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 && ot.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 ? ot.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 r =
        (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, r),
        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),
      }
    },
  },
  rn = Od,
  tn = nn,
  an = {
    preencode(d, n) {
      ;(d.end++,
        n.text && e.string.preencode(d, n.text),
        n.files && rn.preencode(d, n.files),
        n.display && tn.preencode(d, n.display),
        n.replyTo && c.preencode(d, n.replyTo),
        n.parent && c.preencode(d, n.parent))
    },
    encode(d, o) {
      const r =
        (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, r),
        o.text && e.string.encode(d, o.text),
        o.files && rn.encode(d, o.files),
        o.display && tn.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 ? rn.decode(d) : null,
        display: 4 & o ? tn.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 r =
        (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, r),
        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(J),
  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),
        r = e.uint.decode(d)
      return {
        id: n,
        count: o,
        parent: 1 & r ? c.decode(d) : null,
        stats: 2 & r ? mn.decode(d) : null,
      }
    },
  },
  xn = e.frame(ln),
  bn = e.frame(an),
  kn = e.frame(Ld),
  vn = {
    preencode(d, n) {
      ;(fn.preencode(d, n.id),
        c.preencode(d, n.oplog),
        e.uint.preencode(d, n.clock),
        e.uint.preencode(d, n.timestamp),
        d.end++,
        n.editedAt && e.uint.preencode(d, n.editedAt),
        xn.preencode(d, n.status),
        n.message && bn.preencode(d, n.message),
        n.event && kn.preencode(d, n.event))
    },
    encode(d, n) {
      const o = (n.editedAt ? 1 : 0) | (n.message ? 2 : 0) | (n.event ? 4 : 0)
      ;(fn.encode(d, n.id),
        c.encode(d, n.oplog),
        e.uint.encode(d, n.clock),
        e.uint.encode(d, n.timestamp),
        e.uint.encode(d, o),
        n.editedAt && e.uint.encode(d, n.editedAt),
        xn.encode(d, n.status),
        n.message && bn.encode(d, n.message),
        n.event && kn.encode(d, n.event))
    },
    decode(d) {
      const n = fn.decode(d),
        o = c.decode(d),
        r = e.uint.decode(d),
        t = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        id: n,
        oplog: o,
        clock: r,
        timestamp: t,
        editedAt: 1 & i ? e.uint.decode(d) : 0,
        status: xn.decode(d),
        message: 2 & i ? bn.decode(d) : null,
        event: 4 & i ? kn.decode(d) : null,
      }
    },
  },
  gn = xn,
  hn = e.frame(un),
  Kn = kn,
  wn = {
    preencode(d, n) {
      ;(fn.preencode(d, n.id),
        c.preencode(d, n.oplog),
        e.uint.preencode(d, n.clock),
        e.uint.preencode(d, n.timestamp),
        d.end++,
        n.editedAt && e.uint.preencode(d, n.editedAt),
        gn.preencode(d, n.status),
        n.message && hn.preencode(d, n.message),
        n.event && Kn.preencode(d, n.event))
    },
    encode(d, n) {
      const o = (n.editedAt ? 1 : 0) | (n.message ? 2 : 0) | (n.event ? 4 : 0)
      ;(fn.encode(d, n.id),
        c.encode(d, n.oplog),
        e.uint.encode(d, n.clock),
        e.uint.encode(d, n.timestamp),
        e.uint.encode(d, o),
        n.editedAt && e.uint.encode(d, n.editedAt),
        gn.encode(d, n.status),
        n.message && hn.encode(d, n.message),
        n.event && Kn.encode(d, n.event))
    },
    decode(d) {
      const n = fn.decode(d),
        o = c.decode(d),
        r = e.uint.decode(d),
        t = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        id: n,
        oplog: o,
        clock: r,
        timestamp: t,
        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,
      }
    },
  },
  Tn = _,
  Pn = e.frame(cn),
  An = {
    preencode(e, d) {
      ;(Tn.preencode(e, d.header), Pn.preencode(e, d.message))
    },
    encode(e, d) {
      ;(Tn.encode(e, d.header), Pn.encode(e, d.message))
    },
    decode: (e) => ({ header: Tn.decode(e), message: Pn.decode(e) }),
  },
  Rn = _,
  Dn = {
    preencode(e, d) {
      ;(Rn.preencode(e, d.header), c.preencode(e, d.oplog))
    },
    encode(e, d) {
      ;(Rn.encode(e, d.header), c.encode(e, d.oplog))
    },
    decode: (e) => ({ header: Rn.decode(e), oplog: c.decode(e) }),
  },
  Sn = _,
  Cn = Pn,
  Mn = {
    preencode(e, d) {
      ;(Sn.preencode(e, d.header), c.preencode(e, d.oplog), Cn.preencode(e, d.message))
    },
    encode(e, d) {
      ;(Sn.encode(e, d.header), c.encode(e, d.oplog), Cn.encode(e, d.message))
    },
    decode: (e) => ({ header: Sn.decode(e), oplog: c.decode(e), message: Cn.decode(e) }),
  },
  Ln = _,
  qn = {
    preencode(e, d) {
      ;(Ln.preencode(e, d.header), c.preencode(e, d.oplog), e.end++)
    },
    encode(d, n) {
      const o = n.isPinned ? 1 : 0
      ;(Ln.encode(d, n.header), c.encode(d, n.oplog), e.uint.encode(d, o))
    },
    decode: (d) => ({
      header: Ln.decode(d),
      oplog: c.decode(d),
      isPinned: !!(1 & e.uint.decode(d)),
    }),
  },
  Fn = {
    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),
    }),
  },
  En = {
    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) }),
  },
  Bn = e.array(e.frame(En)),
  In = {
    preencode(d, o) {
      ;(fn.preencode(d, o.id),
        e.uint.preencode(d, o.total),
        Bn.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),
        Bn.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),
        r = Bn.decode(d),
        t = d.start < d.end ? e.uint.decode(d) : 0
      return { id: o, total: c, reactions: r, editedAt: n >= 11 && 1 & t ? 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) }),
  },
  On = _,
  Jn = {
    preencode(d, n) {
      ;(On.preencode(d, n.header), c.preencode(d, n.oplog), e.string.preencode(d, n.reaction))
    },
    encode(d, n) {
      ;(On.encode(d, n.header), c.encode(d, n.oplog), e.string.encode(d, n.reaction))
    },
    decode: (d) => ({ header: On.decode(d), oplog: c.decode(d), reaction: e.string.decode(d) }),
  },
  Un = _,
  Vn = e.frame(Z),
  Hn = {
    preencode(d, n) {
      ;(Un.preencode(d, n.header), e.uint.preencode(d, n.key), Vn.preencode(d, n.config))
    },
    encode(d, n) {
      ;(Un.encode(d, n.header), e.uint.encode(d, n.key), Vn.encode(d, n.config))
    },
    decode: (d) => ({ header: Un.decode(d), key: e.uint.decode(d), config: Vn.decode(d) }),
  },
  zn = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.memberKey),
        e.string.preencode(d, n.displayName),
        d.end++,
        n.avatar && ct.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 && ct.encode(d, n.avatar))
    },
    decode: (d) => ({
      memberKey: e.fixed32.decode(d),
      displayName: e.string.decode(d),
      avatar: 1 & e.uint.decode(d) ? ct.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 = Vn,
  _n = e.frame(Wn),
  eo = be,
  no = e.array(e.frame(le)),
  oo = {
    preencode(e, d) {
      ;(Xn.preencode(e, d.header),
        Yn.preencode(e, d.digest),
        Zn.preencode(e, d.capabilities),
        e.end++,
        d.config && $n.preencode(e, d.config),
        d.identity && _n.preencode(e, d.identity),
        d.bootstrapDevice && eo.preencode(e, d.bootstrapDevice),
        d.initialMembers && no.preencode(e, d.initialMembers))
    },
    encode(d, n) {
      const o =
        (n.config ? 1 : 0) |
        (n.identity ? 2 : 0) |
        (n.bootstrapDevice ? 4 : 0) |
        (n.initialMembers ? 8 : 0)
      ;(Xn.encode(d, n.header),
        Yn.encode(d, n.digest),
        Zn.encode(d, n.capabilities),
        e.uint.encode(d, o),
        n.config && $n.encode(d, n.config),
        n.identity && _n.encode(d, n.identity),
        n.bootstrapDevice && eo.encode(d, n.bootstrapDevice),
        n.initialMembers && no.encode(d, n.initialMembers))
    },
    decode(d) {
      const n = Xn.decode(d),
        o = Yn.decode(d),
        c = Zn.decode(d),
        r = e.uint.decode(d)
      return {
        header: n,
        digest: o,
        capabilities: c,
        config: 1 & r ? $n.decode(d) : null,
        identity: 2 & r ? _n.decode(d) : null,
        bootstrapDevice: 4 & r ? eo.decode(d) : null,
        initialMembers: 8 & r ? no.decode(d) : null,
      }
    },
  },
  co = _,
  ro = {
    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) }),
  },
  to = _,
  io = G,
  ao = {
    preencode(d, n) {
      ;(to.preencode(d, n.header), e.uint.preencode(d, n.key), io.preencode(d, n.settings))
    },
    encode(d, n) {
      ;(to.encode(d, n.header), e.uint.encode(d, n.key), io.encode(d, n.settings))
    },
    decode: (d) => ({ header: to.decode(d), key: e.uint.decode(d), settings: io.decode(d) }),
  },
  so = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.memberKey),
        rt.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),
        rt.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 = rt.decode(d),
        c = e.uint.decode(d)
      return {
        memberKey: n,
        status: o,
        mailbox: 1 & c ? e.fixed32.decode(d) : null,
        roomKey: 2 & c ? e.fixed32.decode(d) : null,
      }
    },
  },
  po = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.roomKey),
        e.buffer.preencode(d, n.encryptionKey),
        e.fixed32.preencode(d, n.seed),
        o.preencode(d, n.initiator),
        e.fixed32.preencode(d, n.fastForwardTo))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.roomKey),
        e.buffer.encode(d, n.encryptionKey),
        e.fixed32.encode(d, n.seed),
        o.encode(d, n.initiator),
        e.fixed32.encode(d, n.fastForwardTo))
    },
    decode: (d) => ({
      roomKey: e.fixed32.decode(d),
      encryptionKey: e.buffer.decode(d),
      seed: e.fixed32.decode(d),
      initiator: o.decode(d),
      fastForwardTo: e.fixed32.decode(d),
    }),
  },
  uo = e.array(e.frame(po)),
  lo = Y,
  fo = {
    preencode(e, d) {
      ;(uo.preencode(e, d.sharedRooms), lo.preencode(e, d.blockedContacts))
    },
    encode(e, d) {
      ;(uo.encode(e, d.sharedRooms), lo.encode(e, d.blockedContacts))
    },
    decode: (e) => ({ sharedRooms: uo.decode(e), blockedContacts: lo.decode(e) }),
  },
  mo = _n,
  yo = {
    preencode(e, d) {
      mo.preencode(e, d.identity)
    },
    encode(e, d) {
      mo.encode(e, d.identity)
    },
    decode: (e) => ({ identity: mo.decode(e) }),
  },
  xo = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.rooms), e.uint.preencode(d, n.contacts))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.rooms), e.uint.encode(d, n.contacts))
    },
    decode: (d) => ({ rooms: e.uint.decode(d), contacts: e.uint.decode(d) }),
  },
  bo = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.rooms), e.uint.preencode(d, n.contactRequests))
    },
    encode(d, n) {
      ;(e.uint.encode(d, n.rooms), e.uint.encode(d, n.contactRequests))
    },
    decode: (d) => ({ rooms: e.uint.decode(d), contactRequests: e.uint.decode(d) }),
  },
  ko = {
    preencode(d, n) {
      e.buffer.preencode(d, n.entropy)
    },
    encode(d, n) {
      e.buffer.encode(d, n.entropy)
    },
    decode: (d) => ({ entropy: e.buffer.decode(d) }),
  },
  vo = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.publicKey),
        e.fixed32.preencode(d, n.devicePublicKey),
        e.fixed32.preencode(d, n.writerKey))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.publicKey),
        e.fixed32.encode(d, n.devicePublicKey),
        e.fixed32.encode(d, n.writerKey))
    },
    decode: (d) => ({
      publicKey: e.fixed32.decode(d),
      devicePublicKey: e.fixed32.decode(d),
      writerKey: e.fixed32.decode(d),
    }),
  },
  go = e.frame(vo),
  ho = {
    preencode(d, c) {
      ;(e.fixed32.preencode(d, c.id),
        e.fixed32.preencode(d, c.invitationSeed),
        e.fixed32.preencode(d, c.mailbox),
        t.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 && Or.preencode(d, c.buildType))
    },
    encode(d, c) {
      const r = (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),
        t.encode(d, c.responseKeyPair),
        o.encode(d, c.initiator),
        o.encode(d, c.inviter),
        e.uint.encode(d, r),
        c.identity && go.encode(d, c.identity),
        n >= 20 && c.buildType && Or.encode(d, c.buildType))
    },
    decode(d) {
      const c = e.fixed32.decode(d),
        r = e.fixed32.decode(d),
        i = e.fixed32.decode(d),
        a = t.decode(d),
        s = o.decode(d),
        p = o.decode(d),
        u = e.uint.decode(d)
      return {
        id: c,
        invitationSeed: r,
        mailbox: i,
        responseKeyPair: a,
        initiator: s,
        inviter: p,
        identity: 1 & u ? go.decode(d) : null,
        buildType: n >= 20 && 2 & u ? Or.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) }),
  },
  To = _,
  Po = e.frame(ho),
  Ao = {
    preencode(e, d) {
      ;(To.preencode(e, d.header), Po.preencode(e, d.invitation))
    },
    encode(e, d) {
      ;(To.encode(e, d.header), Po.encode(e, d.invitation))
    },
    decode: (e) => ({ header: To.decode(e), invitation: Po.decode(e) }),
  },
  Ro = _,
  Do = {
    preencode(d, n) {
      ;(Ro.preencode(d, n.header), e.fixed32.preencode(d, n.id))
    },
    encode(d, n) {
      ;(Ro.encode(d, n.header), e.fixed32.encode(d, n.id))
    },
    decode: (d) => ({ header: Ro.decode(d), id: e.fixed32.decode(d) }),
  },
  So = {
    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 && t.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 && t.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 ? t.decode(d) : null,
        deviceProof: e.buffer.decode(d),
      }
    },
  },
  Co = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const c =
        (o.isActive ? 1 : 0) |
        (o.isFullyMuted ? 2 : 0) |
        (o.isMentionsOnlyMuted ? 4 : 0) |
        (n >= 9 && o.isReadOnly ? 8 : 0) |
        (n >= 18 && o.isFavorite ? 16 : 0)
      e.uint.encode(d, c)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        isActive: !!(1 & o),
        isFullyMuted: !!(2 & o),
        isMentionsOnlyMuted: !!(4 & o),
        isReadOnly: n >= 9 && !!(8 & o),
        isFavorite: n >= 18 && !!(16 & o),
      }
    },
  },
  Mo = e.frame(Co),
  Lo = e.frame(So),
  qo = go,
  Fo = {
    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 && Lo.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 r =
        (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, r),
        c.initiator && o.encode(d, c.initiator),
        c.fastForwardTo && e.fixed32.encode(d, c.fastForwardTo),
        c.identitySwap && Lo.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),
        r = e.buffer.decode(d),
        t = e.fixed32.decode(d),
        i = Mo.decode(d),
        a = e.uint.decode(d),
        s = e.uint.decode(d)
      return {
        roomKey: c,
        encryptionKey: r,
        mailbox: t,
        status: i,
        clock: a,
        initiator: 1 & s ? o.decode(d) : null,
        fastForwardTo: 2 & s ? e.fixed32.decode(d) : null,
        identitySwap: 4 & s ? Lo.decode(d) : null,
        identitySwapV2: n >= 6 && 8 & s ? qo.decode(d) : null,
        contact: n >= 10 && 16 & s ? e.fixed32.decode(d) : null,
      }
    },
  },
  Eo = _,
  Bo = {
    preencode(d, n) {
      ;(Eo.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 r =
        (c.fastForwardTo ? 1 : 0) |
        (c.initiator ? 2 : 0) |
        (c.dm ? 4 : 0) |
        (n >= 9 && c.isReadOnly ? 8 : 0)
      ;(Eo.encode(d, c.header),
        e.fixed32.encode(d, c.roomKey),
        e.buffer.encode(d, c.encryptionKey),
        e.fixed32.encode(d, c.mailbox),
        e.uint.encode(d, r),
        c.fastForwardTo && e.fixed32.encode(d, c.fastForwardTo),
        c.initiator && o.encode(d, c.initiator),
        c.dm && e.fixed32.encode(d, c.dm))
    },
    decode(d) {
      const c = Eo.decode(d),
        r = e.fixed32.decode(d),
        t = e.buffer.decode(d),
        i = e.fixed32.decode(d),
        a = e.uint.decode(d)
      return {
        header: c,
        roomKey: r,
        encryptionKey: t,
        mailbox: i,
        fastForwardTo: 1 & a ? e.fixed32.decode(d) : null,
        initiator: 2 & a ? o.decode(d) : null,
        dm: 4 & a ? e.fixed32.decode(d) : null,
        isReadOnly: n >= 9 && !!(8 & a),
      }
    },
  },
  Io = _,
  No = {
    preencode(d, n) {
      ;(Io.preencode(d, n.header), e.fixed32.preencode(d, n.discoveryKey))
    },
    encode(d, n) {
      ;(Io.encode(d, n.header), e.fixed32.encode(d, n.discoveryKey))
    },
    decode: (d) => ({ header: Io.decode(d), discoveryKey: e.fixed32.decode(d) }),
  },
  jo = _,
  Oo = Mo,
  Jo = {
    preencode(d, n) {
      ;(jo.preencode(d, n.header),
        e.fixed32.preencode(d, n.roomKey),
        e.uint.preencode(d, n.key),
        Oo.preencode(d, n.status))
    },
    encode(d, n) {
      ;(jo.encode(d, n.header),
        e.fixed32.encode(d, n.roomKey),
        e.uint.encode(d, n.key),
        Oo.encode(d, n.status))
    },
    decode: (d) => ({
      header: jo.decode(d),
      roomKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: Oo.decode(d),
    }),
  },
  Uo = {
    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)) }),
  },
  Vo = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.memberKey),
        e.uint.preencode(d, n.clock),
        tt.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),
        tt.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 = tt.decode(d),
        r = e.uint.decode(d)
      return {
        memberKey: n,
        clock: o,
        status: c,
        mailbox: 1 & r ? e.fixed32.decode(d) : null,
        roomKey: 2 & r ? 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),
        it.preencode(d, n.status))
    },
    encode(d, n) {
      ;(Qo.encode(d, n.header),
        e.fixed32.encode(d, n.memberKey),
        e.uint.encode(d, n.key),
        it.encode(d, n.status))
    },
    decode: (d) => ({
      header: Qo.decode(d),
      memberKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: it.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),
  rc = _o,
  tc = {
    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),
        rc.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),
        rc.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),
        r = oc.decode(d),
        t = cc.decode(d),
        i = rc.decode(d),
        a = e.fixed32.decode(d),
        s = e.uint.decode(d)
      return {
        memberKey: o,
        clock: c,
        sender: r,
        status: t,
        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),
        r = e.uint.decode(d),
        t = pc.decode(d),
        i = d.start < d.end ? e.uint.decode(d) : 0
      return {
        header: o,
        memberKey: c,
        key: r,
        status: t,
        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),
        at.preencode(d, o.preview),
        d.end++,
        n >= 7 && o.displayType && Rc.preencode(d, o.displayType))
    },
    encode(d, o) {
      const r = n >= 7 && o.displayType ? 1 : 0
      ;(mc.encode(d, o.header),
        c.encode(d, o.oplog),
        e.uint.encode(d, o.index),
        at.encode(d, o.preview),
        e.uint.encode(d, r),
        n >= 7 && o.displayType && Rc.encode(d, o.displayType))
    },
    decode(d) {
      const o = mc.decode(d),
        r = c.decode(d),
        t = e.uint.decode(d),
        i = at.decode(d),
        a = d.start < d.end ? e.uint.decode(d) : 0
      return {
        header: o,
        oplog: r,
        index: t,
        preview: i,
        displayType: n >= 7 && 1 & a ? Rc.decode(d) : 0,
      }
    },
  },
  xc = {
    preencode(d, o) {
      ;(d.end++, n >= 3 && o.memberKey && e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      const c = n >= 3 && o.memberKey ? 1 : 0
      ;(e.uint.encode(d, c), n >= 3 && o.memberKey && e.fixed32.encode(d, o.memberKey))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { memberKey: n >= 3 && 1 & o ? e.fixed32.decode(d) : null }
    },
  },
  bc = ue,
  kc = {
    preencode(e, d) {
      ;(bc.preencode(e, d.profile), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(bc.encode(e, d.profile), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: bc.decode(e), attestation: ce.decode(e) }),
  },
  vc = _,
  gc = {
    preencode(d, n) {
      ;(vc.preencode(d, n.header), e.fixed32.preencode(d, n.key))
    },
    encode(d, n) {
      ;(vc.encode(d, n.header), e.fixed32.encode(d, n.key))
    },
    decode: (d) => ({ header: vc.decode(d), key: e.fixed32.decode(d) }),
  },
  hc = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.deviceKey),
        ce.preencode(d, n.privateProfileIdentity),
        e.buffer.preencode(d, n.deviceProof))
    },
    encode(d, n) {
      ;(e.fixed32.encode(d, n.deviceKey),
        ce.encode(d, n.privateProfileIdentity),
        e.buffer.encode(d, n.deviceProof))
    },
    decode: (d) => ({
      deviceKey: e.fixed32.decode(d),
      privateProfileIdentity: ce.decode(d),
      deviceProof: e.buffer.decode(d),
    }),
  },
  Kc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.fixed32.preencode(d, o.encryptionKey),
        e.fixed32.preencode(d, o.seed),
        d.end++,
        n >= 6 && o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo))
    },
    encode(d, o) {
      const c = n >= 6 && o.fastForwardTo ? 1 : 0
      ;(e.fixed32.encode(d, o.roomKey),
        e.fixed32.encode(d, o.encryptionKey),
        e.fixed32.encode(d, o.seed),
        e.uint.encode(d, c),
        n >= 6 && o.fastForwardTo && e.fixed32.encode(d, o.fastForwardTo))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.fixed32.decode(d),
        r = e.fixed32.decode(d),
        t = e.uint.decode(d)
      return {
        roomKey: o,
        encryptionKey: c,
        seed: r,
        fastForwardTo: n >= 6 && 1 & t ? 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),
        r = e.fixed32.decode(d),
        t = e.uint.decode(d)
      return {
        publicKey: o,
        writerKey: c,
        devicePublicKey: r,
        privateProfileKey: n >= 6 && 1 & t ? e.fixed32.decode(d) : null,
      }
    },
  },
  Tc = _,
  Pc = {
    preencode(d, n) {
      ;(Tc.preencode(d, n.header), e.fixed32.preencode(d, n.memberKey))
    },
    encode(d, n) {
      ;(Tc.encode(d, n.header), e.fixed32.encode(d, n.memberKey))
    },
    decode: (d) => ({ header: Tc.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  Ac = { HttpLink: 1, PearLink: 2 },
  Rc = {
    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),
  },
  Dc = _,
  Sc = {
    preencode(d, n) {
      ;(Dc.preencode(d, n.header), e.uint.preencode(d, n.value))
    },
    encode(d, n) {
      ;(Dc.encode(d, n.header), e.uint.encode(d, n.value))
    },
    decode: (d) => ({ header: Dc.decode(d), value: e.uint.decode(d) }),
  },
  Cc = {
    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 = _,
  Lc = {
    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 && Or.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 && Or.encode(d, o.buildType))
    },
    decode(d) {
      const o = Mc.decode(d),
        c = e.uint.decode(d),
        r = e.uint.decode(d),
        t = d.start < d.end ? e.uint.decode(d) : 0
      return { header: o, from: c, to: r, buildType: n >= 20 && 1 & t ? Or.decode(d) : null }
    },
  },
  qc = {
    RoomType: 1,
    IsExperimental: 2,
    IsJoiningDisabled: 3,
    IsAppendingDisabled: 4,
    IsCallingDisabled: 5,
    IsMembershipEventsDisabled: 6,
    IsAttachmentsDisabled: 7,
    IsLinksDisabled: 8,
  },
  Fc = {
    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),
  },
  Ec = { en: "en", it: "it", ru: "ru", es: "es", de: "de" },
  Bc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      switch (n) {
        case "en":
          e.uint.encode(d, 1)
          break
        case "it":
          e.uint.encode(d, 2)
          break
        case "ru":
          e.uint.encode(d, 3)
          break
        case "es":
          e.uint.encode(d, 4)
          break
        case "de":
          e.uint.encode(d, 5)
          break
        default:
          throw new Error("Unknown enum")
      }
    },
    decode(d) {
      switch (e.uint.decode(d)) {
        case 1:
          return "en"
        case 2:
          return "it"
        case 3:
          return "ru"
        case 4:
          return "es"
        case 5:
          return "de"
        default:
          return null
      }
    },
  },
  Ic = Ed,
  Nc = {
    preencode(d, n) {
      ;(Ic.preencode(d, n.range), Bc.preencode(d, n.language), e.string.preencode(d, n.text))
    },
    encode(d, n) {
      ;(Ic.encode(d, n.range), Bc.encode(d, n.language), e.string.encode(d, n.text))
    },
    decode: (d) => ({ range: Ic.decode(d), language: Bc.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) }),
  },
  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) }),
  },
  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) }),
  },
  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),
        r = $c.decode(d),
        t = e.uint.decode(d),
        i = d.start < d.end ? e.uint.decode(d) : 0
      return {
        id: o,
        total: c,
        labels: r,
        editedAt: t,
        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),
      }
    },
  },
  er = _,
  dr = {
    preencode(d, n) {
      ;(er.preencode(d, n.header), e.uint.preencode(d, n.length))
    },
    encode(d, n) {
      ;(er.encode(d, n.header), e.uint.encode(d, n.length))
    },
    decode: (d) => ({ header: er.decode(d), length: e.uint.decode(d) }),
  },
  nr = {
    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) }),
  },
  or = $,
  cr = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const c = n >= 13 && o.disableReadReceipts ? 1 : 0
      e.uint.encode(d, c)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { disableReadReceipts: n >= 13 && !!(1 & o) }
    },
  },
  rr = { disableReadReceipts: "disableReadReceipts" },
  tr = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      if ("disableReadReceipts" !== n) throw new Error("Unknown enum")
      e.uint.encode(d, 1)
    },
    decode: (d) => (1 === e.uint.decode(d) ? "disableReadReceipts" : null),
  },
  ir = _,
  ar = e.frame(cr),
  sr = {
    preencode(e, d) {
      ;(ir.preencode(e, d.header), tr.preencode(e, d.key), ar.preencode(e, d.settings))
    },
    encode(e, d) {
      ;(ir.encode(e, d.header), tr.encode(e, d.key), ar.encode(e, d.settings))
    },
    decode: (e) => ({ header: ir.decode(e), key: tr.decode(e), settings: ar.decode(e) }),
  },
  pr = { Flag: 1 },
  ur = {
    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),
  },
  lr = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key),
        e.fixed32.preencode(d, n.sender),
        e.uint.preencode(d, n.clock),
        ur.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),
        ur.encode(d, n.label))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      sender: e.fixed32.decode(d),
      clock: e.uint.decode(d),
      label: ur.decode(d),
    }),
  },
  fr = _,
  mr = {
    preencode(d, n) {
      ;(fr.preencode(d, n.header), e.fixed32.preencode(d, n.key), ur.preencode(d, n.label))
    },
    encode(d, n) {
      ;(fr.encode(d, n.header), e.fixed32.encode(d, n.key), ur.encode(d, n.label))
    },
    decode: (d) => ({ header: fr.decode(d), key: e.fixed32.decode(d), label: ur.decode(d) }),
  },
  yr = {
    preencode(d, n) {
      ;(ur.preencode(d, n.label), e.uint.preencode(d, n.count))
    },
    encode(d, n) {
      ;(ur.encode(d, n.label), e.uint.encode(d, n.count))
    },
    decode: (d) => ({ label: ur.decode(d), count: e.uint.decode(d) }),
  },
  xr = e.array(e.frame(yr)),
  br = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.key),
        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.fixed32.encode(d, n.key),
        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: e.fixed32.decode(d),
      total: e.uint.decode(d),
      labels: xr.decode(d),
      editedAt: e.uint.decode(d),
      flagsClock: e.uint.decode(d),
    }),
  },
  kr = {
    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) }),
  },
  vr = _,
  gr = {
    preencode(d, n) {
      ;(vr.preencode(d, n.header),
        e.fixed32.preencode(d, n.deviceKey),
        e.fixed32.preencode(d, n.fromDeviceKey))
    },
    encode(d, n) {
      ;(vr.encode(d, n.header),
        e.fixed32.encode(d, n.deviceKey),
        e.fixed32.encode(d, n.fromDeviceKey))
    },
    decode: (d) => ({
      header: vr.decode(d),
      deviceKey: e.fixed32.decode(d),
      fromDeviceKey: e.fixed32.decode(d),
    }),
  },
  hr = _,
  Kr = Y,
  wr = {
    preencode(d, o) {
      ;(hr.preencode(d, o.header),
        e.fixed32.preencode(d, o.callKey),
        e.buffer.preencode(d, o.encryptionKey),
        d.end++,
        n >= 19 && o.streams && Kr.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)
      ;(hr.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 && Kr.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 = hr.decode(d),
        c = e.fixed32.decode(d),
        r = e.buffer.decode(d),
        t = e.uint.decode(d)
      return {
        header: o,
        callKey: c,
        encryptionKey: r,
        streams: n >= 19 && 1 & t ? Kr.decode(d) : null,
        discoveryKey: n >= 19 && 2 & t ? e.fixed32.decode(d) : null,
        version: n >= 19 && 4 & t ? e.uint.decode(d) : 0,
      }
    },
  },
  Tr = _,
  Pr = Y,
  Ar = {
    preencode(d, o) {
      ;(Tr.preencode(d, o.header),
        e.fixed32.preencode(d, o.callKey),
        d.end++,
        n >= 19 && o.streams && Pr.preencode(d, o.streams))
    },
    encode(d, o) {
      const c = n >= 19 && o.streams ? 1 : 0
      ;(Tr.encode(d, o.header),
        e.fixed32.encode(d, o.callKey),
        e.uint.encode(d, c),
        n >= 19 && o.streams && Pr.encode(d, o.streams))
    },
    decode(d) {
      const o = Tr.decode(d),
        c = e.fixed32.decode(d),
        r = e.uint.decode(d)
      return { header: o, callKey: c, streams: n >= 19 && 1 & r ? Pr.decode(d) : null }
    },
  },
  Rr = _,
  Dr = {
    preencode(d, n) {
      ;(Rr.preencode(d, n.header), e.fixed32.preencode(d, n.callKey))
    },
    encode(d, n) {
      ;(Rr.encode(d, n.header), e.fixed32.encode(d, n.callKey))
    },
    decode: (d) => ({ header: Rr.decode(d), callKey: e.fixed32.decode(d) }),
  },
  Sr = _,
  Cr = {
    preencode(d, n) {
      ;(Sr.preencode(d, n.header), e.fixed32.preencode(d, n.callKey))
    },
    encode(d, n) {
      ;(Sr.encode(d, n.header), e.fixed32.encode(d, n.callKey))
    },
    decode: (d) => ({ header: Sr.decode(d), callKey: e.fixed32.decode(d) }),
  },
  Mr = _,
  Lr = {
    preencode(d, n) {
      ;(Mr.preencode(d, n.header),
        e.fixed32.preencode(d, n.callKey),
        e.fixed32.preencode(d, n.streamKey))
    },
    encode(d, n) {
      ;(Mr.encode(d, n.header), e.fixed32.encode(d, n.callKey), e.fixed32.encode(d, n.streamKey))
    },
    decode: (d) => ({
      header: Mr.decode(d),
      callKey: e.fixed32.decode(d),
      streamKey: e.fixed32.decode(d),
    }),
  },
  qr = _,
  Fr = {
    preencode(d, n) {
      ;(qr.preencode(d, n.header),
        e.fixed32.preencode(d, n.callKey),
        e.fixed32.preencode(d, n.streamKey))
    },
    encode(d, n) {
      ;(qr.encode(d, n.header), e.fixed32.encode(d, n.callKey), e.fixed32.encode(d, n.streamKey))
    },
    decode: (d) => ({
      header: qr.decode(d),
      callKey: e.fixed32.decode(d),
      streamKey: e.fixed32.decode(d),
    }),
  },
  Er = {
    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),
        r = e.uint.decode(d),
        t = e.uint.decode(d)
      return {
        callKey: o,
        encryptionKey: c,
        createdAt: r,
        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,
      }
    },
  },
  Br = {
    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),
    }),
  },
  Ir = {
    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),
        r = e.fixed32.decode(d),
        t = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        callKey: o,
        deviceKey: c,
        memberKey: r,
        createdAt: t,
        swarmKey: n >= 19 && 1 & i ? e.fixed32.decode(d) : null,
      }
    },
  },
  Nr = {
    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),
    }),
  },
  jr = { Nightly: "Nightly", Internal: "Internal", Production: "Production" },
  Or = {
    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
      }
    },
  },
  Jr = _,
  Ur = {
    preencode(e, d) {
      Jr.preencode(e, d.header)
    },
    encode(e, d) {
      Jr.encode(e, d.header)
    },
    decode: (e) => ({ header: Jr.decode(e) }),
  },
  Vr = _,
  Hr = {
    preencode(e, d) {
      Vr.preencode(e, d.header)
    },
    encode(e, d) {
      Vr.encode(e, d.header)
    },
    decode: (e) => ({ header: Vr.decode(e) }),
  },
  zr = e.frame(T),
  Gr = zr,
  Qr = e.array(Bc),
  Wr = e.frame(pe),
  Xr = zr,
  Yr = Wr,
  Zr = e.frame(Kc),
  $r = Wr,
  _r = e.frame(md),
  et = e.frame(xc),
  dt = e.frame(kr),
  nt = dt,
  ot = e.array(e.frame(Nc)),
  ct = zr,
  rt = e.frame(Uo),
  tt = rt,
  it = rt,
  at = zr
function st(e) {
  n = e
}
function pt(d, o, c = 20) {
  return ((n = c), e.encode(ft(d), o))
}
function ut(d, o, c = 20) {
  return ((n = c), e.decode(ft(d), o))
}
function lt(e) {
  switch (e) {
    case "@keet/room-type":
      return U
    case "@keet/display-type":
      return Ac
    case "@keet/system-settings-keys":
      return qc
    case "@keet/room-supported-language":
      return Ec
    case "@keet/label-type":
      return Hc
    case "@keet-private-id/user-settings-key":
      return rr
    case "@keet/member-label-type":
      return pr
    case "@keet/build-type":
      return jr
    default:
      throw new Error("Enum not found " + e)
  }
}
function ft(e) {
  switch (e) {
    case "@keet/head":
      return o
    case "@keet/oplog-id":
      return c
    case "@keet/encryption-keypair":
      return r
    case "@keet/signing-keypair":
      return t
    case "@keet/room-keys":
      return i
    case "@keet/operation-header":
      return a
    case "@keet/blob-pointer":
      return s
    case "@keet/file-dimensions":
      return p
    case "@keet/file-metadata":
      return l
    case "@keet/external-drive-pointer":
      return f
    case "@keet/external-blob-pointer":
      return m
    case "@keet/file-pointer":
      return b
    case "@keet/file":
      return g
    case "@keet/image-file":
      return T
    case "@keet/file-status":
      return P
    case "@keet/file-record":
      return D
    case "@keet/device-status":
      return S
    case "@keet/member-status":
      return C
    case "@keet/member-moderation-status":
      return M
    case "@keet/abi":
      return L
    case "@keet/device-stats":
      return q
    case "@keet/member-stats":
      return F
    case "@keet/chat-stats":
      return E
    case "@keet/file-stats":
      return B
    case "@keet/stats":
      return J
    case "@keet/room-type":
      return V
    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 re
    case "@keet/device":
      return ae
    case "@keet/member-profile":
      return se
    case "@keet/device-profile":
      return pe
    case "@keet/member-update":
      return le
    case "@keet/device-update":
      return fe
    case "@keet/signed-pairing-data":
      return me
    case "@keet/device-request-identity":
      return ye
    case "@keet/device-response-identity":
      return xe
    case "@keet/device-request-with-invitation":
      return ge
    case "@keet/device-request-with-invitation-and-proof":
      return Ke
    case "@keet/device-request-with-member-proof":
      return Pe
    case "@keet/device-request":
      return De
    case "@keet/device-response":
      return Me
    case "@keet/invitation-metadata":
      return Le
    case "@keet/invitation":
      return Ee
    case "@keet/add-invitation-operation":
      return Ne
    case "@keet/remove-invitation-operation":
      return Oe
    case "@keet/sendable-room-invitation":
      return Je
    case "@keet/sendable-identity-invitation":
      return Ue
    case "@keet/sendable-contact-invitation":
      return Ve
    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 rd
    case "@keet/reject-join-request-operation":
      return id
    case "@keet/member":
      return pd
    case "@keet/full-member":
      return fd
    case "@keet/member-proofs":
      return md
    case "@keet/update-member-operation":
      return bd
    case "@keet/change-member-status-operation":
      return gd
    case "@keet/change-member-role-operation":
      return Kd
    case "@keet/remove-member-operation":
      return Td
    case "@keet/member-activity":
      return Pd
    case "@keet/member-joined-event":
      return Ad
    case "@keet/member-left-event":
      return Rd
    case "@keet/title-changed-chat-event":
      return Dd
    case "@keet/chat-event":
      return Ld
    case "@keet/sendable-event":
      return qd
    case "@keet/display-range":
      return Fd
    case "@keet/display-content-range":
      return Bd
    case "@keet/mention-display-item":
      return Nd
    case "@keet/link-preview":
      return Jd
    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 An
    case "@keet/remove-chat-message-operation":
      return Dn
    case "@keet/update-chat-message-operation":
      return Mn
    case "@keet/pin-chat-message-operation":
      return qn
    case "@keet/reaction":
      return Fn
    case "@keet/reactions-summary":
      return En
    case "@keet/reactions-digest":
      return In
    case "@keet/add-reaction-operation":
      return jn
    case "@keet/remove-reaction-operation":
      return Jn
    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 ro
    case "@keet/update-system-settings-operation":
      return ao
    case "@keet-private-id/contact":
      return so
    case "@keet-private-id/v3-room-migration-info":
      return po
    case "@keet-private-id/run-v3-migration-operation":
      return fo
    case "@keet-private-id/update-identity-operation":
      return yo
    case "@keet-private-id/counters":
      return xo
    case "@keet-private-id/stats":
      return bo
    case "@keet-private-id/add-entropy-operation":
      return ko
    case "@keet-private-id/pending-invitation-identity":
      return vo
    case "@keet-private-id/pending-invitation":
      return ho
    case "@keet-private-id/resolve-pending-invitation-operation":
      return wo
    case "@keet-private-id/add-pending-invitation-operation":
      return Ao
    case "@keet-private-id/remove-pending-invitation-operation":
      return Do
    case "@keet-private-id/identity-swap":
      return So
    case "@keet-private-id/room-status":
      return Co
    case "@keet-private-id/room":
      return Fo
    case "@keet-private-id/add-room-operation":
      return Bo
    case "@keet-private-id/remove-room-operation":
      return No
    case "@keet-private-id/update-room-status-operation":
      return Jo
    case "@keet-private-id/contact-status":
      return Uo
    case "@keet-private-id/contact-record":
      return Vo
    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 tc
    case "@keet-private-id/add-contact-request-operation":
      return ac
    case "@keet-private-id/update-contact-request-status-operation":
      return uc
    case "@keet-private-id/profile-discovery-record-v1":
      return lc
    case "@keet-private-id/profile-discovery-record":
      return fc
    case "@keet/add-file-preview-operation":
      return yc
    case "@keet/member-removed-event":
      return xc
    case "@keet/member-contact-info":
      return kc
    case "@keet/remove-device-operation":
      return gc
    case "@keet/device-identity":
      return hc
    case "@keet/readonly-room-invitation":
      return Kc
    case "@keet-private-id/identity-swap-v2":
      return wc
    case "@keet-private-id/activate-contact-room-operation":
      return Pc
    case "@keet/display-type":
      return Rc
    case "@keet/test-increment-operation":
      return Sc
    case "@keet/test-collection-record-1":
      return Cc
    case "@keet/migrate-abi-operation":
      return Lc
    case "@keet/system-settings-keys":
      return Fc
    case "@keet/room-supported-language":
      return Bc
    case "@keet/translation-display-item":
      return Nc
    case "@keet-private-id/unreads":
      return jc
    case "@keet-private-id/add-unreads-key-operation":
      return Jc
    case "@keet-private-id/remove-unreads-key-operation":
      return Vc
    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 dr
    case "@keet/read-length":
      return nr
    case "@keet/tmp-removed-member":
      return or
    case "@keet-private-id/settings":
      return cr
    case "@keet-private-id/user-settings-key":
      return tr
    case "@keet-private-id/update-settings-operation":
      return sr
    case "@keet/member-label-type":
      return ur
    case "@keet/member-label":
      return lr
    case "@keet/add-member-label-operation":
      return mr
    case "@keet/member-label-summary":
      return yr
    case "@keet/member-label-digest":
      return br
    case "@keet/location-shared-event":
      return kr
    case "@keet/move-indexer-operation":
      return gr
    case "@keet/start-call":
      return wr
    case "@keet/join-call":
      return Ar
    case "@keet/leave-call":
      return Dr
    case "@keet/end-call":
      return Cr
    case "@keet/add-call-stream":
      return Lr
    case "@keet/remove-call-stream":
      return Fr
    case "@keet/call-record":
      return Er
    case "@keet/call-member-record":
      return Br
    case "@keet/call-device-record":
      return Ir
    case "@keet/call-stream-record":
      return Nr
    case "@keet/build-type":
      return Or
    case "@keet/test-crash-operation":
      return Ur
    case "@keet/test-dispatch-error-operation":
      return Hr
    default:
      throw new Error("Encoder not found " + e)
  }
}
function mt(e, d = 20) {
  const o = ft(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 yt = mt
module.exports = {
  resolveStruct: yt,
  getStruct: mt,
  getEnum: lt,
  getEncoding: ft,
  encode: pt,
  decode: ut,
  setVersion: st,
  version: n,
}