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

454 lines
15 KiB
JavaScript

// Metro module 13449 (f13450).
let _defineProperties, canonicalizeLocaleList;
let env9327 = {};
env9327[0] = function _typeof(a0) {
const r6 = typeof globalThis.Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(a0) {
return typeof a0;
} : function(a0) {
return a0 && typeof globalThis.Symbol === "function" && a0.constructor === Symbol ? a0 === Symbol.prototype ? typeof a0 : "symbol" : typeof a0;
};
env9327[0] = r6;
return r6(a0);
};
_defineProperties = function _defineProperties(a0, a1) {
const length = a1.length;
let r0 = 0;
if (0 < length) {
do {
const r16 = a1[r0];
let enumerable = r16.enumerable;
const r1 = r0;
if (!enumerable) {
enumerable = false;
}
r16.enumerable = enumerable;
r16.configurable = true;
if ("value" in r16) {
r16.writable = true;
}
const r15 = Object;
const key = r16.key;
let r18 = key;
if (typeof key === "object") {
r18 = key;
if (r18 !== null) {
const r17 = key[Symbol.toPrimitive];
if (r17 !== void 0) {
r18 = r17.call(key, "string");
if (typeof r18 === "object") {
throw new TypeError("@@toPrimitive must return a primitive value.");
}
} else {
r18 = String(key);
}
}
}
let r35 = r18;
if (typeof r35 !== "symbol") {
r35 = String(r18);
}
r15.defineProperty(a0, r35, r16);
r0 = r1 + 1;
} while (r0 < a1.length);
}
};
canonicalizeLocaleList = function canonicalizeLocaleList(a0) {
if (a0) {
const r14 = Array.isArray(a0) ? a0 : [a0];
const r26 = {};
const r5 = 0 < r14.length;
let r0 = 0;
if (r5) {
do {
const r16 = r14[r0];
const r1 = r0;
const r31 = (r16 ? (0, env9327[0])(r16) === "object" : r16) ? String(r16) : r16;
if (typeof r31 !== "string") {
throw new TypeError("Locales should be strings, ".concat(JSON.stringify(r31), " isn't."));
}
const r34 = r31.split("-");
if (!r34.every(function(item) {
return /[a-z0-9]+/i.test(item);
})) {
throw new RangeError("The locale ".concat(JSON.stringify(r31), " is not a structurally valid BCP 47 language tag."));
}
const r47 = r34[0].toLowerCase();
const r49 = ({
in: "id",
iw: "he",
ji: "yi"
})[r47];
r34[0] = r49 !== null ? r49 !== void 0 ? r49 : r47 : r47;
r26[r34.join("-")] = true;
r0 = r1 + 1;
} while (r0 < r14.length);
}
return Object.keys(r26);
}
return [];
};
module.exports = function getPluralRules(a0, a1, a2, a3) {
let PluralRules2;
let env20463 = {
$parent: env9327
};
env20463[0] = a0;
env20463[1] = a1;
env20463[2] = a2;
env20463[3] = a3;
env20463[4] = function findLocale(r3) {
while (true) {
const r5 = (0, env20463[1])(r3);
const r7 = r3;
if (r5) {
return r7;
}
r3 = r7.replace(/-?[^-]*$/, "");
if (!r3) {
return null;
}
}
};
env20463[5] = new WeakMap();
env20463[6] = new WeakMap();
env20463[7] = new WeakMap();
env20463[8] = new WeakMap();
env20463[9] = new WeakMap();
PluralRules2 = function PluralRules() {
let r71, value;
const r9 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
const r12 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
if (this instanceof PluralRules2) {
const r11 = env20463[5];
if (r11.has(this)) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
r11.set(this, {
writable: true,
value: void 0
});
const r13 = env20463[6];
if (r13.has(this)) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
r13.set(this, {
writable: true,
value: void 0
});
const r44 = env20463[7];
if (r44.has(this)) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
r44.set(this, {
writable: true,
value: void 0
});
const r50 = env20463[8];
if (r50.has(this)) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
r50.set(this, {
writable: true,
value: void 0
});
const r56 = env20463[9];
if (r56.has(this)) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
L25: {
L21: {
r56.set(this, {
writable: true,
value: void 0
});
const r64 = canonicalizeLocaleList(r9);
const r5 = 0 < r64.length;
let r66 = 0;
if (r5) {
loop16: while (true) {
let r67 = r64[r66];
const r1 = r66;
while (true) {
const r68 = env20463[1];
const r14 = r68(r67);
value = r67;
if (!r14) {
r67 = value.replace(/-?[^-]*$/, "");
value = null;
if (r67) {
continue;
}
}
r71 = r68;
if (value) {
break L25;
}
r66 = r1 + 1;
if (r66 < r64.length) {
continue loop16;
}
break L21;
}
}
}
}
let locale = new env20463[0]().resolvedOptions().locale;
while (true) {
const r81 = env20463[1];
const r82 = r81(locale);
let r83 = locale;
if (!r82) {
locale = locale.replace(/-?[^-]*$/, "");
r83 = null;
if (locale) {
continue;
}
}
value = r83;
r71 = r81;
break;
}
}
if (r11.has(this)) {
const r96 = r11.get(this);
if (r96.set) {
r96.set.call(this, value);
} else {
if (!r96.writable) {
throw new TypeError("attempted to set read only private field");
}
r96.value = value;
}
const r110 = env20463[7];
const r111 = env20463[5];
if (r111.has(this)) {
const r122 = r111.get(this);
const value2 = r71(r122.get ? r122.get.call(this) : r122.value);
if (r110.has(this)) {
const r139 = r110.get(this);
if (r139.set) {
r139.set.call(this, value2);
} else {
if (!r139.writable) {
throw new TypeError("attempted to set read only private field");
}
r139.value = value2;
}
const r153 = env20463[6];
const r154 = env20463[3];
if (r111.has(this)) {
const r165 = r111.get(this);
const value3 = r154(r165.get ? r165.get.call(this) : r165.value);
if (r153.has(this)) {
const r182 = r153.get(this);
if (r182.set) {
r182.set.call(this, value3);
} else {
if (!r182.writable) {
throw new TypeError("attempted to set read only private field");
}
r182.value = value3;
}
const r196 = env20463[8];
const r203 = Object.prototype.hasOwnProperty.call(r12, "type") && r12.type;
let value4 = "cardinal";
if (r203) {
value4 = r203;
if (r203 !== "cardinal") {
value4 = r203;
if (value4 !== "ordinal") {
throw new RangeError("Not a valid plural type: " + JSON.stringify(r203));
}
}
}
if (r196.has(this)) {
const r227 = r196.get(this);
if (r227.set) {
r227.set.call(this, value4);
} else {
if (!r227.writable) {
throw new TypeError("attempted to set read only private field");
}
r227.value = value4;
}
const r240 = env20463[9];
const r245 = new env20463[0]("en", r12);
if (r240.has(this)) {
const value5 = r245;
const r256 = r240.get(this);
if (r256.set) {
r256.set.call(this, value5);
} else {
if (!r256.writable) {
throw new TypeError("attempted to set read only private field");
}
r256.value = value5;
}
return void 0;
}
throw new TypeError("attempted to set private field on non-instance");
}
throw new TypeError("attempted to set private field on non-instance");
}
throw new TypeError("attempted to set private field on non-instance");
}
throw new TypeError("attempted to get private field on non-instance");
}
throw new TypeError("attempted to set private field on non-instance");
}
throw new TypeError("attempted to get private field on non-instance");
}
throw new TypeError("attempted to set private field on non-instance");
}
throw new TypeError("Cannot call a class as a function");
};
const r43 = [{
key: "resolvedOptions",
value: function resolvedOptions() {
const r4 = env20463[9];
if (r4.has(this)) {
const r25 = r4.get(this);
const r32 = (r25.get ? r25.get.call(this) : r25.value).resolvedOptions();
const { minimumIntegerDigits, minimumFractionDigits, maximumFractionDigits, minimumSignificantDigits, maximumSignificantDigits } = r32;
let roundingPriority = r32.roundingPriority;
const r35 = env20463[5];
if (r35.has(this)) {
const r44 = r35.get(this);
const r50 = {
locale: r44.get ? r44.get.call(this) : r44.value,
type: null,
minimumIntegerDigits: null,
minimumFractionDigits: null,
maximumFractionDigits: null
};
const r51 = env20463[8];
if (r51.has(this)) {
const r60 = r51.get(this);
r50.type = r60.get ? r60.get.call(this) : r60.value;
r50.minimumIntegerDigits = minimumIntegerDigits;
r50.minimumFractionDigits = minimumFractionDigits;
r50.maximumFractionDigits = maximumFractionDigits;
if (typeof minimumSignificantDigits === "number") {
r50.minimumSignificantDigits = minimumSignificantDigits;
r50.maximumSignificantDigits = maximumSignificantDigits;
}
const r66 = env20463[2];
if (r35.has(this)) {
const r77 = r35.get(this);
const r79 = r77.get ? r77.get.call(this) : r77.value;
if (r51.has(this)) {
const r93 = r51.get(this);
r50.pluralCategories = r66(r79, (r93.get ? r93.get.call(this) : r93.value) === "ordinal").slice(0);
if (!roundingPriority) {
roundingPriority = "auto";
}
r50.roundingPriority = roundingPriority;
return r50;
}
throw new TypeError("attempted to get private field on non-instance");
}
throw new TypeError("attempted to get private field on non-instance");
}
throw new TypeError("attempted to get private field on non-instance");
}
throw new TypeError("attempted to get private field on non-instance");
}
throw new TypeError("attempted to get private field on non-instance");
}
}, {
key: "select",
value: function select(a0) {
if (this instanceof PluralRules2) {
const r20 = typeof a0 !== "number" ? Number(a0) : a0;
const isFinite2 = isFinite(r20);
if (isFinite2) {
const r28 = env20463[9];
if (r28.has(this)) {
const r37 = r28.get(this);
const r47 = (r37.get ? r37.get.call(this) : r37.value).format(Math.abs(r20));
const r48 = env20463[7];
if (r48.has(this)) {
const r58 = r48.get(this);
const r60 = r58.get ? r58.get.call(this) : r58.value;
const r65 = env20463[8];
if (r65.has(this)) {
const r75 = r65.get(this);
return r60.call(this, r47, (r75.get ? r75.get.call(this) : r75.value) === "ordinal");
}
throw new TypeError("attempted to get private field on non-instance");
}
throw new TypeError("attempted to get private field on non-instance");
}
throw new TypeError("attempted to get private field on non-instance");
}
return "other";
}
throw new TypeError("select() called on incompatible ".concat(this));
}
}, {
key: "selectRange",
value: function selectRange(a0, a1) {
if (this instanceof PluralRules2) {
if (a0 === void 0) {
throw new TypeError("start is undefined");
}
if (a1 === void 0) {
throw new TypeError("end is undefined");
}
const r8 = (0, env9327[0])(a0);
let r23 = a0;
if (r8 !== "number") {
if (r8 === "bigint") {
throw new TypeError("Cannot convert a BigInt value to a number");
}
r23 = Number(a0);
}
const r34 = (0, env9327[0])(a1);
let r35 = a1;
if (r34 !== "number") {
if (r34 === "bigint") {
throw new TypeError("Cannot convert a BigInt value to a number");
}
r35 = Number(a1);
}
if (isFinite(r23)) {
if (isFinite(r35)) {
const r64 = env20463[6];
if (r64.has(this)) {
const r74 = r64.get(this);
return (r74.get ? r74.get.call(this) : r74.value).call(this, this.select(r23), this.select(r35));
}
throw new TypeError("attempted to get private field on non-instance");
}
throw new RangeError("end must be finite");
}
throw new RangeError("start must be finite");
}
throw new TypeError("selectRange() called on incompatible ".concat(this));
}
}];
const r49 = [{
key: "supportedLocalesOf",
value: function supportedLocalesOf(a0) {
return canonicalizeLocaleList(a0).filter(env20463[4]);
}
}];
_defineProperties(PluralRules2.prototype, r43);
_defineProperties(PluralRules2, r49);
Object.defineProperty(PluralRules2, "prototype", {
writable: false
});
const Symbol2 = globalThis.Symbol;
if (typeof Symbol2 !== "undefined" ? Symbol.toStringTag : typeof Symbol2 !== "undefined") {
Object.defineProperty(PluralRules2.prototype, Symbol.toStringTag, {
value: "Intl.PluralRules",
writable: false,
configurable: true
});
}
Object.defineProperty(PluralRules2, "prototype", {
writable: false
});
return PluralRules2;
};