Files
discord-decomp/sources/modules/phone/native/CountryCallingCodeSelect.tsx
T
2026-07-27 16:20:00 +03:00

308 lines
12 KiB
TypeScript

/* Metro module 9019; source: modules/phone/native/CountryCallingCodeSelect.tsx; dependencies: [57, 31, 27, 3837, 33, 4501, 697, 8973, 3838, 7705, 6590, 6238, 4573, 6984, 9020, 9021, 1244, 8671, 2] */
function _fun70176(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#70176, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:6, offset: 0x01cf1608, size: 265 bytes, params: 8, frame: 19
const env0_0 = require;
const _arrayLikeToArray_70179 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(57) /* metro dependency 57 */;
const env0_4 = importAll(31) /* metro dependency 31 */;
const env0_5 = (require(27) /* metro dependency 27 */).View;
const env0_6 = (require(3837) /* metro dependency 3837: CountryCodeUtils */).getI18NCountryName;
let value = require(33) /* metro dependency 33 */;
const env0_7 = value.jsx;
const env0_8 = value.jsxs;
const env0_9 = (require(4501) /* metro dependency 4501: createStyles */).createStyles(_fun70180);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/phone/native/CountryCallingCodeSelect.tsx');
exports.default = CountryCallingCodeSelect;
}
function _createForOfIteratorHelperLoose_70177(a0, a1) { // fn#70177, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:197, offset: 0x01cf1711, size: 372 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun70178;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_70179(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_70179(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_70179(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun70178;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
}
function _fun70180(a0) { // fn#70180, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:1136, offset: 0x01cf1885, size: 217 bytes, params: 2, frame: 17
const object3 = {};
const object4 = {};
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
object4.backgroundColor = BACKGROUND_BASE_LOW;
let space = (importDefault(697) /* metro dependency 697: native */).space;
object4.paddingHorizontal = a0 ? space.PX_24 : space.PX_12;
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object4.paddingTop = PX_16;
space = (importDefault(697) /* metro dependency 697: native */).space;
object4.paddingBottom = a0 ? space.PX_24 : space.PX_16;
object4.flex = 1;
object3.container = object4;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object3.searchFieldContainer = {paddingBottom: PX_16};
return object3;
}
function CountryCallingCodeSelect({onCountrySelected, onClose}) { // fn#70181, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:1522, offset: 0x01cf195e, size: 530 bytes, params: 2, frame: 27
var r5;
var ViewEmptyState;
var object;
var intl;
var value;
const styles = useStyles((importDefault(8973) /* metro dependency 8973: useWideAuthView */)());
const binding = env0_4;
const [property, property2] = env0_3(binding.useState(''), 2);
const value5 = binding.useMemo(_fun70182, []);
const value6 = (importDefault(7705) /* metro dependency 7705: useScaledRowHeight */)();
const {rows, sections} = binding.useMemo(_fun70185, [value5, property]);
const value8 = binding.useCallback(_fun70186, [onClose, onCountrySelected, rows]);
const SearchField = (require(6984) /* metro dependency 6984: SearchFieldNative */).SearchField;
const view = <View style={styles.searchFieldContainer}><SearchField size="md" onChange={property2} /></View>;
if (property === '') {
value = importDefault(8671) /* metro dependency 8671: FastestListAndroid */;
value = ((Component) => <Component sections={sections} renderItem={value8} itemSize={value6} estimatedListSize="windowSize" keyboardShouldPersistTaps="always" />)(value);
r5 = value;
} else if (rows.length === 0) {
ViewEmptyState = importDefault(9020) /* metro dependency 9020: ViewEmptyState */;
object = {source: importDefault(9021) /* metro dependency 9021 */};
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
object.text = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.wEHnxW);
r5 = <ViewEmptyState {...object} />;
} else {
value = importDefault(8671) /* metro dependency 8671: FastestListAndroid */;
value = ((Component) => <Component sections={sections} renderItem={value8} itemSize={value6} estimatedListSize="windowSize" keyboardShouldPersistTaps="always" />)(value);
r5 = value;
}
return (
<View style={styles.container}>
{view}
{r5}
</View>
);
}
function _fun70182() { // fn#70182, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:1666, offset: 0x01cf1b70, size: 47 bytes, params: 1, frame: 11
var environment;
const value = environment.__proto__;
return (importDefault(3838) /* metro dependency 3838: Countries */).flatMap(function(a0, a1) {
var alpha2 = a0.alpha2;
var env0_0 = alpha2;
var phoneCountryCodes = a0.phoneCountryCodes;
var env0_1 = a0.name;
var env0_2 = a1;
var env0_3 = getI18NCountryName(alpha2);
return phoneCountryCodes.map(_fun70184);
});
}
function _fun70185() { // fn#70185, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:1866, offset: 0x01cf1c3c, size: 321 bytes, params: 1, frame: 25
var r2;
var r0;
var value5;
var length;
var value6;
var country;
var code;
var replace;
var value7;
var startsWith;
var binding;
var value8;
var defaultImport;
var toLowerCase;
var value9;
var name;
var value10;
var defaultImport2;
var value11;
var translatedName;
var value12;
var value13;
let items2 = [];
const value3 = _createForOfIteratorHelperLoose_70177(env0_3);
const value4 = value3();
let done = value4.done;
if (!done) {
r2 = value4;
while (true) {
value5 = r2.value;
length = env0_2.length;
value6 = length === 0;
if (value6) {
r0 = value6;
} else {
code = value5.country.code;
value7 = code.replace(RegExp('\\+|\\s', 'g'), '');
startsWith = value7.startsWith;
binding = env0_2;
replace = binding.replace;
value8 = Reflect.apply(startsWith, value7, [Reflect.apply(replace, binding, [RegExp('\\+|\\s', 'g'),
''])]);
r0 = value8;
}
if (r0) {
continue;
}
defaultImport = importDefault(6590) /* metro dependency 6590 */;
binding = env0_2;
value9 = binding.toLowerCase();
country = value5.country;
name = country.name;
toLowerCase = name.toLowerCase;
value10 = defaultImport(value9, Reflect.apply(toLowerCase, name, []));
r0 = value10;
if (r0) {
continue;
}
defaultImport2 = importDefault(6590) /* metro dependency 6590 */;
binding = env0_2;
value11 = binding.toLowerCase();
translatedName = value5.translatedName;
toLowerCase = translatedName.toLowerCase;
value12 = defaultImport2(value11, Reflect.apply(toLowerCase, translatedName, []));
r0 = value12;
if (!r0) {
continue;
}
items2.push(value5);
value13 = value3();
done = value13.done;
if (done) {
break;
}
r2 = value13;
continue;
}
}
const object2 = {rows: items2};
items2 = [items2.length];
object2.sections = items2;
return object2;
}
function _fun70186(a0, a1) { // fn#70186, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:2250, offset: 0x01cf1d7d, size: 169 bytes, params: 3, frame: 21
const rowsBinding = rows;
const {translatedName, country} = rowsBinding[a1];
const TableRow = (require(6238) /* metro dependency 6238: TableRowNative */).TableRow;
const length = rowsBinding.length;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
return (
<TableRow
start={a1 === 0}
end={a1 === length - 1}
label={translatedName}
trailing={<Text variant="text-md/semibold">{country.code}</Text>}
onPress={function() {
onCountrySelected(country);
if (onClose != null) {
onClose();
}
}}
/>
);
}
function _fun70183({alpha2, phoneCountryCodes, name}, a1) { // fn#70183, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:1688, offset: 0x01cf1b9f, size: 74 bytes, params: 3, frame: 13
const env0_2 = a1;
const env0_3 = getI18NCountryName(alpha2);
return phoneCountryCodes.map(_fun70184);
}
function _fun70184(a0) { // fn#70184, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:1757, offset: 0x01cf1be9, size: 83 bytes, params: 2, frame: 17
return {translatedName: env0_3, key: '' + require + '-' + a0, country: {code: a0, alpha2: alpha2, name: name}};
}