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

960 lines
24 KiB
JavaScript

// Metro module 12083 (f12084).
import * as __createClass from "./_createClass";
import * as _classCallCheck from "./_classCallCheck";
function $mk88782($env) {
return function() {
const value = (0, $env[0])();
Object.defineProperty(this, "value", {
value
});
return value;
};
}
let c8315_0;
let c8314_1, isPlainObject, Class;
const mergeDefs = function mergeDefs(...args) {
const r3 = {};
for (const item of args) {
Object.assign(r3, Object.getOwnPropertyDescriptors(item));
}
return Object.defineProperties({}, r3);
};
isPlainObject = function isPlainObject(a0) {
if (((typeof a0 === "object" ? a0 !== null : typeof a0 === "object") && !Array.isArray(a0)) === false) {
return false;
}
const constructor = a0.constructor;
if (constructor === void 0) {
return true;
}
if (typeof constructor !== "function") {
return true;
}
const prototype = constructor.prototype;
return ((typeof prototype === "object" ? prototype !== null : typeof prototype === "object") && !Array.isArray(prototype)) !== false && Object.prototype.hasOwnProperty.call(prototype, "isPrototypeOf") !== false;
};
export function assertEqual(a0) {
return a0;
}
export function assertNotEqual(a0) {
return a0;
}
export function assertIs(a0) {}
export function assertNever(a0) {
throw new Error("Unexpected value in exhaustive check");
}
export function assert(a0) {}
export function getEnumValues(a0) {
let c19418_0 = Object.values(a0).filter((item) => typeof item === "number");
return Object.entries(a0).filter((item) => {
const [r21, , ] = item;
return c19418_0.indexOf(+r21) === -1;
}).map((item) => {
const [, r13] = item;
return r13;
});
}
export function joinValues(a0, r3 = "|") {
return a0.map((item) => typeof item === "bigint" ? item.toString() + "n" : typeof item === "string" ? `"${item}"` : `${item}`).join(r3);
}
export function jsonStringifyReplacer(a0, a1) {
return typeof a1 === "bigint" ? a1.toString() : a1;
}
export function cached(a0) {
let env19417;
const r2 = env19417 = {};
env19417[0] = a0;
const r4 = {};
Object.defineProperty(r4, "value", {
get: $mk88782(r2),
set: void 0,
enumerable: true,
configurable: true
});
return r4;
}
export function nullish(a0) {
return a0 == null;
}
export function cleanRegex(a0) {
const r0 = a0.startsWith("^") ? 1 : 0;
const r8 = a0.endsWith("$");
const length = a0.length;
return a0.slice(r0, r8 ? length - 1 : length);
}
export function floatSafeRemainder(a0, a1) {
const length2 = (a0.toString().split(".")[1] || "").length;
const r10 = a1.toString();
const length = (r10.split(".")[1] || "").length;
let r21 = length;
if (r21 === 0) {
const r22 = /\d?e-\d?/.test(r10);
r21 = length;
if (r22) {
const r25 = r10.match(/\d?e-(\d?)/);
r21 = (r25 == null ? void 0 : r25[1]) ? Number.parseInt(r25[1]) : length;
}
}
if (length2 > r21) {
r21 = length2;
}
return Number.parseInt(a0.toFixed(r21).replace(".", "")) % Number.parseInt(a1.toFixed(r21).replace(".", "")) / 10 ** r21;
}
export function defineLazy(a0, a1, c19419_2) {
let c19419_3;
let c19419_0 = a0;
Object.defineProperty(a0, a1, {
get: () => {
let r1 = c19419_3;
if (r1 !== c8314_1) {
if (r1 === void 0) {
c19419_3 = c8314_1;
const r7 = c19419_2();
c19419_3 = r7;
r1 = r7;
}
return r1;
}
},
set: (a0) => {
Object.defineProperty(c19419_0, a1, {
value: a0
});
},
configurable: true
});
}
export function objectClone(a0) {
return Object.create(Object.getPrototypeOf(a0), Object.getOwnPropertyDescriptors(a0));
}
export function assignProp(a0, a1, a2) {
Object.defineProperty(a0, a1, {
value: a2,
writable: true,
enumerable: true,
configurable: true
});
}
export { mergeDefs };
export function cloneDef(a0) {
return mergeDefs(a0._zod.def);
}
export function getElementAtPath(a0, a1) {
return a1 ? a1.reduce((acc, item) => acc == null ? void 0 : acc[item], a0) : a0;
}
export function promiseAllObject(a0) {
const r5 = Object.keys(a0);
let c19420_1 = r5;
return Promise.all(r5.map((item) => a0[item])).then((result) => {
let r11;
const r4 = {};
const length = c19420_1.length;
let r0 = 0;
if (0 < length) {
do {
r11 = c19420_1;
r4[r11[r0]] = result[r0];
r0 = r0 + 1;
} while (r0 < r11.length);
}
return r4;
});
}
export function randomString(r9 = 10) {
let r0 = 0;
const r14 = 0 < r9;
let r6 = "";
let r5 = "";
if (r14) {
do {
r6 = r6 + "abcdefghijklmnopqrstuvwxyz"[Math.floor(26 * Math.random())];
r0 = r0 + 1;
r5 = r6;
} while (r0 < r9);
}
return r5;
}
export function esc(a0) {
return JSON.stringify(a0);
}
export function slugify(a0) {
return a0.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
}
export function isObject(a0) {
return (typeof a0 === "object" ? a0 !== null : typeof a0 === "object") && !Array.isArray(a0);
}
export { isPlainObject };
export function shallowClone(a0) {
return isPlainObject(a0) ? {
...a0
} : Array.isArray(a0) ? [...a0] : a0;
}
export function numKeys(a0) {
let r1;
let r0 = 0;
let r2 = 0;
for (const key in a0) {
r1 = r0;
r2 = r1;
r0 = Object.prototype.hasOwnProperty.call(a0, key) ? r1 + 1 : r1;
}
r1 = r0;
r2 = r1;
return r2;
}
export function escapeRegex(a0) {
return a0.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
export function clone(a0, a1, a2) {
let r2 = a1;
const constr = new a0._zod.constr(a1 == null ? a0._zod.def : a1);
if (a1) {
r2 = !a2?.parent;
}
if (!r2) {
constr._zod.parent = a0;
}
return constr;
}
export function normalizeParams(a0) {
if (a0) {
if (typeof a0 === "string") {
return {
error: () => a0
};
}
if (a0?.message !== void 0) {
if (a0?.error !== void 0) {
throw new Error("Cannot specify both `message` and `error` params");
}
a0.error = a0.message;
}
delete a0["message"];
return typeof a0.error === "string" ? {
...a0,
error: () => a0.error
} : a0;
}
return {};
}
export function createTransparentProxy(c19422_0) {
let c19422_1;
return new Proxy({}, {
get: (a0, a1, a2) => {
if (c19422_1 == null) {
c19422_1 = c19422_0();
}
return Reflect.get(c19422_1, a1, a2);
},
set: (a0, a1, a2, a3) => {
if (c19422_1 == null) {
c19422_1 = c19422_0();
}
return Reflect.set(c19422_1, a1, a2, a3);
},
has: (a0, a1) => {
if (c19422_1 == null) {
c19422_1 = c19422_0();
}
return Reflect.has(c19422_1, a1);
},
deleteProperty: (a0, a1) => {
if (c19422_1 == null) {
c19422_1 = c19422_0();
}
return Reflect.deleteProperty(c19422_1, a1);
},
ownKeys: (a0) => {
if (c19422_1 == null) {
c19422_1 = c19422_0();
}
return Reflect.ownKeys(c19422_1);
},
getOwnPropertyDescriptor: (a0, a1) => {
if (c19422_1 == null) {
c19422_1 = c19422_0();
}
return Reflect.getOwnPropertyDescriptor(c19422_1, a1);
},
defineProperty: (a0, a1, a2) => {
if (c19422_1 == null) {
c19422_1 = c19422_0();
}
return Reflect.defineProperty(c19422_1, a1, a2);
}
});
}
export function stringifyPrimitive(a0) {
return typeof a0 === "bigint" ? a0.toString() + "n" : typeof a0 === "string" ? `"${a0}"` : `${a0}`;
}
export function optionalKeys(a0) {
return Object.keys(a0).filter((item) => a0[item]._zod.optin === "optional" && a0[item]._zod.optout === "optional");
}
export function pick(a0, c19424_0) {
const def = a0._zod.def;
const checks = def.checks;
if (checks && checks.length > 0) {
throw new Error(".pick() cannot be used on object schemas containing refinements");
}
const def3 = a0._zod.def;
const r17 = {};
Object.defineProperty(r17, "shape", {
get: function() {
const value = {};
for (const key in c19424_0) {
if (!(key in def.shape)) {
throw new Error(`Unrecognized key: "${key}"`);
}
if (c19424_0[key]) {
value[key] = def.shape[key];
}
}
Object.defineProperty(this, "shape", {
value,
writable: true,
enumerable: true,
configurable: true
});
return value;
},
set: void 0,
enumerable: true,
configurable: true
});
r17.checks = [];
let r20 = mergeDefs(def3, r17);
const constr = new a0._zod.constr(r20 == null ? a0._zod.def : r20);
if (r20) {
r20 = true;
}
if (!r20) {
constr._zod.parent = a0;
}
return constr;
}
export function omit(a0, c19425_1) {
const def2 = a0._zod.def;
const checks = def2.checks;
if (checks && checks.length > 0) {
throw new Error(".omit() cannot be used on object schemas containing refinements");
}
const def3 = a0._zod.def;
const r17 = {};
Object.defineProperty(r17, "shape", {
get: function() {
const value = {
...a0._zod.def.shape
};
for (const key in c19425_1) {
if (!(key in def2.shape)) {
throw new Error(`Unrecognized key: "${key}"`);
}
if (c19425_1[key]) {
delete value[key];
}
}
Object.defineProperty(this, "shape", {
value,
writable: true,
enumerable: true,
configurable: true
});
return value;
},
set: void 0,
enumerable: true,
configurable: true
});
r17.checks = [];
let r20 = mergeDefs(def3, r17);
const constr = new a0._zod.constr(r20 == null ? a0._zod.def : r20);
if (r20) {
r20 = true;
}
if (!r20) {
constr._zod.parent = a0;
}
return constr;
}
export function extend(a0, a1) {
if (isPlainObject(a1)) {
const checks = a0._zod.def.checks;
if (checks && checks.length > 0) {
const shape = a0._zod.def.shape;
for (const key in a1) {
if (Object.getOwnPropertyDescriptor(shape, key) !== void 0) {
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
}
}
}
const def3 = a0._zod.def;
const r42 = {};
Object.defineProperty(r42, "shape", {
get: function() {
const value = {
...a0._zod.def.shape,
...a1
};
Object.defineProperty(this, "shape", {
value,
writable: true,
enumerable: true,
configurable: true
});
return value;
},
set: void 0,
enumerable: true,
configurable: true
});
let r45 = mergeDefs(def3, r42);
const constr = new a0._zod.constr(r45 == null ? a0._zod.def : r45);
if (r45) {
r45 = true;
}
if (!r45) {
constr._zod.parent = a0;
}
return constr;
}
throw new Error("Invalid input to extend: expected a plain object");
}
export function safeExtend(a0, a1) {
if (isPlainObject(a1)) {
const def3 = a0._zod.def;
const r18 = {};
Object.defineProperty(r18, "shape", {
get: function() {
const value = {
...a0._zod.def.shape,
...a1
};
Object.defineProperty(this, "shape", {
value,
writable: true,
enumerable: true,
configurable: true
});
return value;
},
set: void 0,
enumerable: true,
configurable: true
});
let r21 = mergeDefs(def3, r18);
const constr = new a0._zod.constr(r21 == null ? a0._zod.def : r21);
if (r21) {
r21 = true;
}
if (!r21) {
constr._zod.parent = a0;
}
return constr;
}
throw new Error("Invalid input to safeExtend: expected a plain object");
}
export function merge(a0, c19428_1) {
const def3 = a0._zod.def;
const r13 = {};
Object.defineProperty(r13, "shape", {
get: function() {
const value = {
...a0._zod.def.shape,
...c19428_1._zod.def.shape
};
Object.defineProperty(this, "shape", {
value,
writable: true,
enumerable: true,
configurable: true
});
return value;
},
set: void 0,
enumerable: true,
configurable: true
});
Object.defineProperty(r13, "catchall", {
get: function() {
return c19428_1._zod.def.catchall;
},
set: void 0,
enumerable: true,
configurable: true
});
r13.checks = [];
let r17 = mergeDefs(def3, r13);
const constr = new a0._zod.constr(r17 == null ? a0._zod.def : r17);
if (r17) {
r17 = true;
}
if (!r17) {
constr._zod.parent = a0;
}
return constr;
}
export function partial(c19429_0, a1, c19429_2) {
const checks = a1._zod.def.checks;
if (checks && checks.length > 0) {
throw new Error(".partial() cannot be used on object schemas containing refinements");
}
const def3 = a1._zod.def;
const r18 = {};
Object.defineProperty(r18, "shape", {
get: function() {
const shape = a1._zod.def.shape;
const value = {
...shape
};
if (c19429_2) {
for (const key2 in c19429_2) {
if (!(key2 in shape)) {
throw new Error(`Unrecognized key: "${key2}"`);
}
if (c19429_2[key2]) {
const innerType2 = shape[key2];
value[key2] = c19429_0 ? new c19429_0({
type: "optional",
innerType: innerType2
}) : innerType2;
}
}
} else {
for (const key in shape) {
const innerType = shape[key];
value[key] = c19429_0 ? new c19429_0({
type: "optional",
innerType
}) : innerType;
}
}
Object.defineProperty(this, "shape", {
value,
writable: true,
enumerable: true,
configurable: true
});
return value;
},
set: void 0,
enumerable: true,
configurable: true
});
r18.checks = [];
let r21 = mergeDefs(def3, r18);
const constr = new a1._zod.constr(r21 == null ? a1._zod.def : r21);
if (r21) {
r21 = true;
}
if (!r21) {
constr._zod.parent = a1;
}
return constr;
}
export function required(c19430_0, a1, c19430_2) {
const def3 = a1._zod.def;
const r13 = {};
Object.defineProperty(r13, "shape", {
get: function() {
const shape = a1._zod.def.shape;
const value = {
...shape
};
if (c19430_2) {
for (const key2 in c19430_2) {
if (!(key2 in value)) {
throw new Error(`Unrecognized key: "${key2}"`);
}
if (c19430_2[key2]) {
value[key2] = new c19430_0({
type: "nonoptional",
innerType: shape[key2]
});
}
}
} else {
for (const key in shape) {
value[key] = new c19430_0({
type: "nonoptional",
innerType: shape[key]
});
}
}
Object.defineProperty(this, "shape", {
value,
writable: true,
enumerable: true,
configurable: true
});
return value;
},
set: void 0,
enumerable: true,
configurable: true
});
let r15 = mergeDefs(def3, r13);
const constr = new a1._zod.constr(r15 == null ? a1._zod.def : r15);
if (r15) {
r15 = true;
}
if (!r15) {
constr._zod.parent = a1;
}
return constr;
}
export function aborted(a0, r7 = 0) {
if (a0.aborted === true) {
return true;
}
while (r7 < a0.issues.length) {
const r9 = a0.issues[r7];
const r3 = r9 == null;
const r13 = r7;
if ((r3 ? void 0 : r9.continue) !== true) {
return true;
}
r7 = r13 + 1;
}
return false;
}
export function prefixIssues(c19431_0, a1) {
return a1.map((item) => {
if (item.path == null) {
item.path = [];
}
item.path.unshift(c19431_0);
return item;
});
}
export function unwrapMessage(a0) {
return typeof a0 !== "string" ? a0?.message : a0;
}
export function finalizeIssue(a0, a1, a2) {
let path = a0.path;
if (path == null) {
path = [];
}
const r2 = {
...a0,
path
};
if (!a0.message) {
const inst = a0.inst;
const r1 = inst == null;
let r7 = void 0;
if (!r1) {
const def3 = inst._zod.def;
const r17 = def3 == null;
r7 = void 0;
if (!r17) {
const error2 = def3.error;
r7 = error2 == null ? void 0 : error2.call(def3, a0);
}
}
let message = r7;
if (typeof message !== "string") {
message = r7?.message;
}
if (message == null) {
const r23 = a1 == null;
let r8 = void 0;
if (!r23) {
const error3 = a1.error;
r8 = error3 == null ? void 0 : error3.call(a1, a0);
}
let r26 = r8;
if (typeof r26 !== "string") {
r26 = r8?.message;
}
message = r26;
}
if (message == null) {
const customError = a2.customError;
const r10 = customError == null ? void 0 : customError.call(a2, a0);
let r32 = r10;
if (typeof r32 !== "string") {
r32 = r10?.message;
}
message = r32;
}
if (message == null) {
const localeError = a2.localeError;
const r37 = localeError == null ? void 0 : localeError.call(a2, a0);
let r38 = r37;
if (typeof r38 !== "string") {
r38 = r37?.message;
}
message = r38;
}
if (message == null) {
message = "Invalid input";
}
r2.message = message;
}
delete r2["inst"];
delete r2["continue"];
if (!a1?.reportInput) {
delete r2["input"];
}
return r2;
}
export function getSizableOrigin(a0) {
return a0 instanceof Set ? "set" : a0 instanceof Map ? "map" : a0 instanceof File ? "file" : "unknown";
}
export function getLengthableOrigin(a0) {
return Array.isArray(a0) ? "array" : typeof a0 === "string" ? "string" : "unknown";
}
export function parsedType(a0) {
const r2 = typeof a0;
let r1 = "number";
if (r2 === "number") {
if (Number.isNaN(a0)) {
r1 = "nan";
}
return r1;
}
if (r2 === "object") {
if (a0 === null) {
return "null";
}
if (Array.isArray(a0)) {
return "array";
}
if (a0 && Object.getPrototypeOf(a0) !== Object.prototype && "constructor" in a0 && a0.constructor) {
return a0.constructor.name;
}
}
return r2;
}
export function issue(...args) {
const message = args[0];
const input = args[1];
const inst = args[2];
if (typeof message === "string") {
return {
message,
code: "custom",
input,
inst
};
}
return {
...message
};
}
export function cleanEnum(a0) {
return Object.entries(a0).filter((item) => {
const [r7, , ] = item;
return Number.isNaN(Number.parseInt(r7, 10));
}).map((item) => item[1]);
}
export function base64ToUint8Array(a0) {
const r10 = atob(a0);
const uint8Array = new Uint8Array(r10.length);
const length = r10.length;
let r0 = 0;
if (0 < length) {
do {
uint8Array[r0] = r10.charCodeAt(r0);
r0 = r0 + 1;
} while (r0 < r10.length);
}
return uint8Array;
}
export function uint8ArrayToBase64(a0) {
let length2;
const length = a0.length;
let r0 = 0;
const r3 = 0 < length;
let r7 = "";
let r5 = "";
if (r3) {
do {
r7 = r7 + String.fromCharCode(a0[r0]);
r0 = r0 + 1;
length2 = a0.length;
r5 = r7;
} while (r0 < length2);
}
return btoa(r5);
}
export function base64urlToUint8Array(a0) {
const r15 = a0.replace(/-/g, "+").replace(/_/g, "/");
const r25 = atob(r15 + "=".repeat((4 - r15.length % 4) % 4));
const uint8Array = new Uint8Array(r25.length);
const length = r25.length;
let r31 = 0;
if (0 < length) {
do {
uint8Array[r31] = r25.charCodeAt(r31);
r31 = r31 + 1;
} while (r31 < r25.length);
}
return uint8Array;
}
export function uint8ArrayToBase64url(a0) {
let length2;
const length = a0.length;
let r0 = 0;
const r3 = 0 < length;
let r8 = "";
let r5 = "";
if (r3) {
do {
r8 = r8 + String.fromCharCode(a0[r0]);
r0 = r0 + 1;
length2 = a0.length;
r5 = r8;
} while (r0 < length2);
}
return btoa(r5).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
}
export function hexToUint8Array(a0) {
let length;
const r15 = a0.replace(/^0x/, "");
if (r15.length % 2 !== 0) {
throw new Error("Invalid hex string length");
}
const uint8Array = new Uint8Array(r15.length / 2);
const r5 = 0 < r15.length;
let r25 = 0;
if (r5) {
do {
const r11 = Number;
const r1 = r25 + 2;
uint8Array[r25 / 2] = r11.parseInt(r15.slice(r25, r1), 16);
length = r15.length;
r25 = r1;
} while (r25 < length);
}
return uint8Array;
}
export function uint8ArrayToHex(a0) {
return Array.from(a0).map((item) => item.toString(16).padStart(2, "0")).join("");
}
c8314_1 = Symbol("evaluating");
const r80 = "captureStackTrace" in Error ? Error.captureStackTrace : function() {
Array.prototype.slice.call(arguments, 0);
};
let env8315;
export { r80 as captureStackTrace };
const r82 = env8315 = {};
c8315_0 = () => {
if (typeof globalThis.navigator !== "undefined") {
const r4 = navigator;
const r5 = r4 == null;
let r8 = void 0;
if (!r5) {
const userAgent = r4.userAgent;
r8 = userAgent == null ? void 0 : userAgent.includes("Cloudflare");
}
if (r8) {
return false;
}
}
try {
new Function("");
} catch ($e) {
return false;
}
return true;
};
const r84 = {};
Object.defineProperty(r84, "value", {
get: $mk88782(r82),
set: void 0,
enumerable: true,
configurable: true
});
export { r84 as allowsEval };
export const getParsedType = (a0) => {
let r35, r39, r42;
const r12 = typeof a0;
if (r12 === "undefined") {
return "undefined";
}
if (r12 === "string") {
return "string";
}
let r3 = "number";
if (r12 === "number") {
if (Number.isNaN(a0)) {
r3 = "nan";
}
return r3;
}
if (r12 === "boolean") {
return "boolean";
}
if (r12 === "function") {
return "function";
}
if (r12 === "bigint") {
return "bigint";
}
if (r12 === "symbol") {
return "symbol";
}
if (r12 === "object") {
const isArray = Array.isArray(a0);
let r29 = "array";
if (!isArray) {
let r30 = "null";
if (a0 !== null) {
L28: {
if (a0.then && typeof a0.then === "function" && a0.catch) {
const catch2 = a0.catch;
r35 = "promise";
if (typeof catch2 === "function") {
break L28;
}
}
L27: {
if (typeof globalThis.Map !== "undefined") {
const r38 = a0 instanceof Map;
r39 = "map";
if (r38) {
break L27;
}
}
L26: {
if (typeof globalThis.Set !== "undefined") {
const r41 = a0 instanceof Set;
r42 = "set";
if (r41) {
break L26;
}
}
r42 = typeof globalThis.Date !== "undefined" ? a0 instanceof Date ? "date" : typeof globalThis.File !== "undefined" ? a0 instanceof File ? "file" : "object" : "object" : typeof globalThis.File !== "undefined" ? a0 instanceof File ? "file" : "object" : "object";
}
r39 = r42;
}
r35 = r39;
}
r30 = r35;
}
r29 = r30;
}
return r29;
}
throw new Error(`Unknown data type: ${r12}`);
};
export const propertyKeyTypes = new Set(["string", "number", "symbol"]);
export const primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
export const NUMBER_FORMAT_RANGES = {
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
int32: [-2147483648, 2147483647],
uint32: [0, 4294967295],
float32: [-3.4028234663852886e38, 3.4028234663852886e38],
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
};
export const BIGINT_FORMAT_RANGES = {
int64: [BigInt("-9223372036854775808"), BigInt("9223372036854775807")],
uint64: [BigInt(0), BigInt("18446744073709551615")]
};
Class = function Class() {
Array.prototype.slice.call(arguments, 0);
_classCallCheck(this, Class);
};
exports.Class = __createClass(Class);