const { c: e } = require("hyperschema/runtime"),
d = 1
let n = 1
const c = {
preencode(d, n) {
;(e.uint.preencode(d, n.version), e.fixed32.preencode(d, n.seed))
},
encode(d, n) {
;(e.uint.encode(d, n.version), e.fixed32.encode(d, n.seed))
},
decode: (d) => ({ version: e.uint.decode(d), seed: e.fixed32.decode(d) }),
},
o = {
preencode(d, n) {
;(e.fixed32.preencode(d, n.publicKey),
d.end++,
n.bumped && e.uint.preencode(d, n.bumped),
n.updated && e.uint.preencode(d, n.updated),
n.signature && e.fixed64.preencode(d, n.signature))
},
encode(d, n) {
const c = (n.bumped ? 1 : 0) | (n.updated ? 2 : 0) | (n.signature ? 4 : 0)
;(e.fixed32.encode(d, n.publicKey),
e.uint.encode(d, c),
n.bumped && e.uint.encode(d, n.bumped),
n.updated && e.uint.encode(d, n.updated),
n.signature && e.fixed64.encode(d, n.signature))
},
decode(d) {
const n = e.fixed32.decode(d),
c = e.uint.decode(d)
return {
publicKey: n,
bumped: 1 & c ? e.uint.decode(d) : 0,
updated: 2 & c ? e.uint.decode(d) : 0,
signature: 4 & c ? e.fixed64.decode(d) : null,
}
},
},
u = {
preencode(d, n) {
;(d.end++, n.bump && e.uint.preencode(d, n.bump))
},
encode(d, n) {
const c = n.bump ? 1 : 0
;(e.uint.encode(d, c), n.bump && e.uint.encode(d, n.bump))
},
decode: (d) => ({ bump: 1 & e.uint.decode(d) ? e.uint.decode(d) : 0 }),
},
r = e.frame(u),
i = {
preencode(d, n) {
;(e.fixed32.preencode(d, n.publicKey),
r.preencode(d, n.announce),
e.fixed64.preencode(d, n.signature))
},
encode(d, n) {
;(e.fixed32.encode(d, n.publicKey), r.encode(d, n.announce), e.fixed64.encode(d, n.signature))
},
decode: (d) => ({
publicKey: e.fixed32.decode(d),
announce: r.decode(d),
signature: e.fixed64.decode(d),
}),
},
t = {
preencode(d, n) {
;(e.fixed32.preencode(d, n.publicKey), e.uint.preencode(d, n.since))
},
encode(d, n) {
;(e.fixed32.encode(d, n.publicKey), e.uint.encode(d, n.since))
},
decode: (d) => ({ publicKey: e.fixed32.decode(d), since: e.uint.decode(d) }),
},
p = {
preencode(d, n) {
e.fixed32.preencode(d, n.publicKey)
},
encode(d, n) {
e.fixed32.encode(d, n.publicKey)
},
decode: (d) => ({ publicKey: e.fixed32.decode(d) }),
},
s = {
preencode(d, n) {
;(e.fixed32.preencode(d, n.publicKey), e.uint.preencode(d, n.bumped))
},
encode(d, n) {
;(e.fixed32.encode(d, n.publicKey), e.uint.encode(d, n.bumped))
},
decode: (d) => ({ publicKey: e.fixed32.decode(d), bumped: e.uint.decode(d) }),
}
function a(e) {
n = e
}
function f(d, c, o = 1) {
return ((n = o), e.encode(m(d), c))
}
function b(d, c, o = 1) {
return ((n = o), e.decode(m(d), c))
}
function y(e) {
throw new Error("Enum not found " + e)
}
function m(e) {
switch (e) {
case "@hyperdiscovery/manifest":
return c
case "@hyperdiscovery/swarm":
return o
case "@hyperdiscovery/announce":
return u
case "@hyperdiscovery/announce-to-swarm":
return i
case "@hyperdiscovery/subscribe-to-swarm":
return t
case "@hyperdiscovery/unsubscribe-to-swarm":
return p
case "@hyperdiscovery/bump-from-swarm":
return s
default:
throw new Error("Encoder not found " + e)
}
}
function x(e, d = 1) {
const c = m(e)
return {
preencode(e, o) {
;((n = d), c.preencode(e, o))
},
encode(e, o) {
;((n = d), c.encode(e, o))
},
decode: (e) => ((n = d), c.decode(e)),
}
}
const l = x
module.exports = {
resolveStruct: l,
getStruct: x,
getEnum: y,
getEncoding: m,
encode: f,
decode: b,
setVersion: a,
version: n,
}