var A = Object.defineProperty; var j = (r, e, t) => e in r ? A(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t; var W = (r, e, t) => j(r, typeof e != "symbol" ? e + "" : e, t); import { ScalarType as o, RepeatType as y, MessageType as I, BinaryReader as C, WireType as d } from "@protobuf-ts/runtime"; class s { constructor(e, t, a, p) { W(this, "_value"); W(this, "_fieldId"); W(this, "_opt"); W(this, "_callback"); this._value = t, this._fieldId = e, this._opt = a, this._callback = p; } get value() { return this._value; } set value(e) { this._value = e; } getTypeName() { return this.constructor.name; } getFieldId() { return this._fieldId; } getField(e) { return L(e, this); } } class F extends s { getTypeName() { return "DoubleWrapper"; } } class B extends s { getTypeName() { return "FloatWrapper"; } } class T extends s { getTypeName() { return "StringWrapper"; } } class S extends s { getTypeName() { return "UInt32Wrapper"; } } class w extends s { getTypeName() { return "Int32Wrapper"; } } class h extends s { getTypeName() { return "Int64Wrapper"; } } class m extends s { getTypeName() { return "UInt64Wrapper"; } } class b extends s { getTypeName() { return "ArrayWrapper"; } } class N extends s { getTypeName() { return "BoolWrapper"; } } class U extends s { getTypeName() { return "BytesWrapper"; } } class P extends s { getTypeName() { return "Fixed64Wrapper"; } } class k extends s { getTypeName() { return "Fixed32Wrapper"; } } class D extends s { getTypeName() { return "SFixed32Wrapper"; } } class _ extends s { getTypeName() { return "SFixed64Wrapper"; } } class O extends s { getTypeName() { return "SInt32Wrapper"; } } class v extends s { getTypeName() { return "SInt64Wrapper"; } } class E extends s { getTypeName() { return "UnknownWrapper"; } } const n = { UInt32Wrapper: "UInt32Wrapper", Int32Wrapper: "Int32Wrapper", Int64Wrapper: "Int64Wrapper", UInt64Wrapper: "UInt64Wrapper", StringWrapper: "StringWrapper", ArrayWrapper: "ArrayWrapper", BoolWrapper: "BoolWrapper", BytesWrapper: "BytesWrapper", DoubleWrapper: "DoubleWrapper", FloatWrapper: "FloatWrapper", Fixed64Wrapper: "Fixed64Wrapper", Fixed32Wrapper: "Fixed32Wrapper", SFixed32Wrapper: "SFixed32Wrapper", SFixed64Wrapper: "SFixed64Wrapper", SInt32Wrapper: "SInt32Wrapper", SInt64Wrapper: "SInt64Wrapper", UnknownWrapper: "UnknownWrapper" }, K = { [n.UInt32Wrapper]: S, [n.Int32Wrapper]: w, [n.Int64Wrapper]: h, [n.UInt64Wrapper]: m, [n.StringWrapper]: T, [n.ArrayWrapper]: b, [n.BoolWrapper]: N, [n.BytesWrapper]: U, [n.DoubleWrapper]: F, [n.FloatWrapper]: B, [n.Fixed64Wrapper]: P, [n.Fixed32Wrapper]: k, [n.SFixed32Wrapper]: D, [n.SFixed64Wrapper]: _, [n.SInt32Wrapper]: O, [n.SInt64Wrapper]: v, [n.UnknownWrapper]: E }, M = { [n.UInt32Wrapper]: o.UINT32, [n.Int32Wrapper]: o.INT32, [n.Int64Wrapper]: o.INT64, [n.UInt64Wrapper]: o.UINT64, [n.StringWrapper]: o.STRING, [n.BytesWrapper]: o.BYTES, [n.BoolWrapper]: o.BOOL, [n.DoubleWrapper]: o.DOUBLE, [n.FloatWrapper]: o.FLOAT, [n.Fixed64Wrapper]: o.FIXED64, [n.Fixed32Wrapper]: o.FIXED32, [n.SFixed32Wrapper]: o.SFIXED32, [n.SFixed64Wrapper]: o.SFIXED64, [n.SInt32Wrapper]: o.SINT32, [n.SInt64Wrapper]: o.SINT64, [n.UnknownWrapper]: o.BYTES }; function $(r) { return K[r] || E; } function x(r) { return M[r] || o.BYTES; } function z(r = 0, e, t = !1, a = []) { return new b(r, a, t, () => e); } function H(r = 0, e = !1, t = 0) { return new F(r, t, e); } function J(r = 0, e = !1, t = 0) { return new B(r, t, e); } function Z(r = 0, e = !1, t = "") { return new T(r, t, e); } function ee(r = 0, e = !1, t = 0) { return new S(r, t, e); } function re(r = 0, e = !1, t = 0) { return new w(r, t, e); } function te(r = 0, e = !1, t = BigInt(0)) { return new h(r, t, e); } function ne(r = 0, e = !1, t = BigInt(0)) { return new m(r, t, e); } function ae(r = 0, e = !1, t = !1) { return new N(r, t, e); } function pe(r = 0, e = !1, t = new Uint8Array()) { return new U(r, t, e); } function se(r = 0, e = !1, t = BigInt(0)) { return new P(r, t, e); } function ie(r = 0, e = !1, t = 0) { return new k(r, t, e); } function oe(r = 0, e = !1, t = 0) { return new D(r, t, e); } function ce(r = 0, e = !1, t = BigInt(0)) { return new _(r, t, e); } function ue(r = 0, e = !1, t = 0) { return new O(r, t, e); } function le(r = 0, e = !1, t = BigInt(0)) { return new v(r, t, e); } function L(r, e) { var c; const t = e.getTypeName(), a = e.getFieldId(), p = e._opt; if (t === n.ArrayWrapper) { const i = (c = e._callback) == null ? void 0 : c.call(e); if (i instanceof l) return { no: a, name: r, kind: "message", T: () => new I(r, i.generateFields()), opt: p || !1, repeat: y.PACKED }; if (i instanceof s) { const u = i.getTypeName(); return { no: a, name: r, kind: "scalar", T: x(u), opt: p || !1, repeat: u === n.StringWrapper || u === n.BytesWrapper ? y.UNPACKED : y.PACKED }; } throw new Error("ArrayWrapper item type error"); } return { no: a, name: r, kind: "scalar", T: x(t), opt: p || !1, repeat: y.NO }; } class l { constructor() { W(this, "_fieldId", 0); } //默认标记类 generateFields() { const e = []; for (const t of Object.keys(this)) { const a = "_" + t, p = this[a]; p instanceof s && e.push(p.getField(t)), p instanceof l && e.push({ no: p._fieldId, name: t, kind: "message", T: () => new I(a, p.generateFields()), repeat: y.NO, opt: !1 }); } return e; } assignFields(e) { for (const t of Object.keys(this)) { const a = "_" + t; let p = this[a]; if (p instanceof s) { const c = e[t]; c !== void 0 && (p.value = c); } else if (p instanceof l) { const c = e[t]; c !== void 0 && p.assignFields(c); } else { const c = e[t]; c !== void 0 && (this[a] = c); } } } toObject() { const e = {}; for (const t of Object.keys(this)) { const a = "_" + t, p = this[a]; p && (p instanceof s && (e[t] = p.value), p instanceof l && (e[t] = p.toObject())); } return e; } encode() { return new I("message", this.generateFields()).toBinary(this.toObject()); } decode(e) { const t = new I("message", this.generateFields()).fromBinary(e); return this.assignFields(t), this; } then(e) { e(this); } } function g(r) { return new Proxy(r, { set(e, t, a) { return e[t] instanceof s ? (e[t].value = a, !0) : (e[t] = a, !0); }, get(e, t) { if (typeof t == "string" && t.startsWith("_")) { const p = t.slice(1); if (e[p]) return e[p]; } const a = e[t]; return a instanceof s ? a.value : a; } }); } function X(r, e) { const t = g(e ? new e() : new r()); return t._fieldId = typeof r == "number" ? r : 0, t; } function fe(r, e) { const t = g(new r()); return e && t.assignFields(e), t; } function We(r, e) { const a = X(class extends l { }); return Object.assign(a, r), a.assignFields(e), a; } function de(r, e) { if (typeof r == "number") { let t = new class extends l { constructor() { super(), Object.assign(this, e); } }(); return t._fieldId = r, g(t); } return g(new class extends l { constructor() { super(), Object.assign(this, r); } }()); } function ye(r) { return r.value; } function G(r, e, t, a, p, c) { let i; const u = new C(p); switch (a) { case d.Varint: i = u.uint64(), i = i.hi > 0 ? i.toBigInt() : Number(i.lo); break; case d.Bit64: i = u.fixed64(); break; case d.LengthDelimited: let f = u.bytes(); try { i = R(f); } catch { try { if (i = new TextDecoder().decode(f), i.indexOf("�") !== -1) throw new Error("Invalid UTF-8 sequence in input"); } catch { c ? i = c(f) : i = f; } } break; case d.StartGroup: case d.EndGroup: break; case d.Bit32: i = u.fixed32(); break; default: throw new Error(`Unknown wire type: ${a}`); } e[t] ? e[t] instanceof Array ? e[t].push(i) : e[t] = [e[t], i] : e[t] = i; } function R(r, e) { return new I("message", []).fromBinary(r, { readUnknownField: (p, c, i, u, f) => G(p, c, i, u, f, e) }); } class Ie extends l { push(e) { return Object.assign(this, e), this; } } export { b as ArrayWrapper, N as BoolWrapper, U as BytesWrapper, Ie as ChainProto, F as DoubleWrapper, k as Fixed32Wrapper, P as Fixed64Wrapper, B as FloatWrapper, w as Int32Wrapper, h as Int64Wrapper, z as PBArray, ae as PBBool, pe as PBBytes, H as PBDouble, ie as PBFixed32, se as PBFixed64, J as PBFloat, re as PBInt32, te as PBInt64, oe as PBSFixed32, ce as PBSFixed64, ue as PBSInt32, le as PBSInt64, Z as PBString, ee as PBUint32, ne as PBUint64, X as ProtoBuf, l as ProtoBufBase, R as ProtoBufDecode, fe as ProtoBufEx, de as ProtoBufIn, We as ProtoBufQuick, D as SFixed32Wrapper, _ as SFixed64Wrapper, O as SInt32Wrapper, v as SInt64Wrapper, T as StringWrapper, S as UInt32Wrapper, m as UInt64Wrapper, ye as UnWrap, E as UnknownWrapper, s as ValueWrapper, $ as autoTypeToClass, L as autoTypeToField, G as decodeProtoBuf, g as proxyClassProtobuf }; //# sourceMappingURL=protobuf.js.map