Files
discord-decomp/_bundle/Module6270.js
T
2026-11-01 12:12:55 +02:00

171 lines
4.9 KiB
JavaScript

// Metro module 6270 (f6271).
import { MessageType, MESSAGE_TYPE, reflectionMergePartial, UnknownFieldHandler, WireType } from "./Module1307";
import { LocalizedString } from "./Module6268";
import { UInt64Value } from "./Module1337";
import { $callWithNewTarget } from "../_hermes/prelude";
function $mk78168($env) {
return () => ["discord_protos.premium_marketing.v1.ButtonAction", c3986_3, "BUTTON_ACTION_"];
}
function $mk78169($env) {
return () => LocalizedString;
}
function $mk78170($env) {
return () => UInt64Value;
}
let c3986_4;
let env3986;
const r4 = env3986 = {};
const c3986_3 = {
UNSPECIFIED: 0,
0: "UNSPECIFIED",
OPEN_MARKETING_PAGE: 1,
1: "OPEN_MARKETING_PAGE",
OPEN_TIER_2_PAYMENT_MODAL: 2,
2: "OPEN_TIER_2_PAYMENT_MODAL",
OPEN_TIER_1_PAYMENT_MODAL: 3,
3: "OPEN_TIER_1_PAYMENT_MODAL",
OPEN_TIER_2_PAYMENT_MODAL_CUSTOM_CONFIRMATION_FOOTER: 4,
4: "OPEN_TIER_2_PAYMENT_MODAL_CUSTOM_CONFIRMATION_FOOTER",
OPEN_PLAN_SELECTION_MODAL: 5,
5: "OPEN_PLAN_SELECTION_MODAL",
OPEN_PREMIUM_GROUP_PAYMENT_MODAL: 6,
6: "OPEN_PREMIUM_GROUP_PAYMENT_MODAL",
OPEN_SOCIAL_LAYER_STOREFRONT: 7,
7: "OPEN_SOCIAL_LAYER_STOREFRONT"
};
class CTAButton$Type extends MessageType {
constructor() {
const r1 = env3986;
const r2 = [{
no: 1,
name: "copy",
kind: "scalar",
T: 9
}, {
no: 2,
name: "button_action",
kind: "enum",
T: $mk78168(r1)
}, {
no: 3,
name: "deeplink_section",
kind: "scalar",
T: 9
}, {
no: 4,
name: "copy_localized",
kind: "message",
T: $mk78169(r1)
}, {
no: 5,
name: "navigable_storefront_application_id",
kind: "message",
T: $mk78170(r1)
}];
super("discord_protos.premium_marketing.v1.CTAButton", r2);
}
create(a0) {
const r1 = {
copy: "",
buttonAction: 0,
deeplinkSection: ""
};
globalThis.globalThis.Object.defineProperty(r1, MESSAGE_TYPE, {
enumerable: false,
value: this
});
if (a0 !== void 0) {
reflectionMergePartial(this, r1, a0);
}
return r1;
}
internalBinaryRead(a0, a1, a2, a3) {
const r8 = a3 == null ? this.create() : a3;
const r11 = a0.pos + a1;
while (a0.pos < r11) {
const [r22, r21] = a0.tag();
if (r22 === 1) {
r8.copy = a0.string();
} else if (r22 === 2) {
r8.buttonAction = a0.int32();
} else if (r22 === 3) {
r8.deeplinkSection = a0.string();
} else if (r22 === 4) {
r8.copyLocalized = LocalizedString.internalBinaryRead(a0, a0.uint32(), a2, r8.copyLocalized);
} else if (r22 === 5) {
r8.navigableStorefrontApplicationId = UInt64Value.internalBinaryRead(a0, a0.uint32(), a2, r8.navigableStorefrontApplicationId);
} else {
let readUnknownField = a2.readUnknownField;
if (readUnknownField === "throw") {
throw new globalThis.globalThis.Error(`Unknown field ${r22} (wire type ${r21}) for ${this.typeName}`);
}
const r37 = a0.skip(r21);
if (readUnknownField !== false) {
if (readUnknownField === true) {
readUnknownField = UnknownFieldHandler.onRead;
}
readUnknownField(this.typeName, r8, r22, r21, r37);
}
}
}
return r8;
}
internalBinaryWrite(a0, a1, a2) {
if (a0.copy !== "") {
a1.tag(1, WireType.LengthDelimited).string(a0.copy);
}
if (a0.buttonAction !== 0) {
a1.tag(2, WireType.Varint).int32(a0.buttonAction);
}
if (a0.deeplinkSection !== "") {
a1.tag(3, WireType.LengthDelimited).string(a0.deeplinkSection);
}
if (a0.copyLocalized) {
LocalizedString.internalBinaryWrite(a0.copyLocalized, a1.tag(4, WireType.LengthDelimited).fork(), a2).join();
}
if (a0.navigableStorefrontApplicationId) {
UInt64Value.internalBinaryWrite(a0.navigableStorefrontApplicationId, a1.tag(5, WireType.LengthDelimited).fork(), a2).join();
}
let writeUnknownFields = a2.writeUnknownFields;
if (writeUnknownFields !== false) {
if (writeUnknownFields == 1) {
writeUnknownFields = UnknownFieldHandler.onWrite;
}
writeUnknownFields(this.typeName, a0, a1);
}
return a1;
}
}
c3986_4 = CTAButton$Type;
const prototypeOf = Object.getPrototypeOf(CTAButton$Type);
const r50 = [{
no: 1,
name: "copy",
kind: "scalar",
T: 9
}, {
no: 2,
name: "button_action",
kind: "enum",
T: $mk78168(r4)
}, {
no: 3,
name: "deeplink_section",
kind: "scalar",
T: 9
}, {
no: 4,
name: "copy_localized",
kind: "message",
T: $mk78169(r4)
}, {
no: 5,
name: "navigable_storefront_application_id",
kind: "message",
T: $mk78170(r4)
}];
const r57 = Object.create(CTAButton$Type.prototype);
const r58 = $callWithNewTarget(prototypeOf, r57, CTAButton$Type, "discord_protos.premium_marketing.v1.CTAButton", r50);
export { c3986_3 as ButtonAction };
export const CTAButton = r58 instanceof Object ? r58 : r57;