Files
discord-decomp/sources/by-id/module-00226.js
T
2026-07-28 01:06:53 +03:00

177 lines
8.7 KiB
JavaScript

/* Metro module 226; source: unknown; dependencies: [6, 7, 195, 227] */
import ClassCallCheck from './module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from './module-00007-CreateClass.js'; /* Metro dependency 7 */
import * as URLSearchParamsModule from './module-00227-URLSearchParams.js'; /* Metro dependency 227 */
function _fun3116(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#3116, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:251:6, offset: 0x00c91198, size: 280 bytes, params: 8, frame: 19
var value;
const validateBaseUrl = function(a0) {
return RegExp('^(?:(?:(?:https?|ftp):)?\\/\\/)(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)*(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$',
'').test(a0);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
var env0_2;
if (importDefault(195) /* metro dependency 195 */) {
value = importDefault(195) /* metro dependency 195 */;
if (typeof value.getConstants().BLOB_URI_SCHEME === 'string') {
value = importDefault(195) /* metro dependency 195 */;
value = value.getConstants();
if (typeof value.BLOB_URI_HOST === 'string') {
env0_2 = value.BLOB_URI_SCHEME + ':' + ('//' + value.BLOB_URI_HOST + '/');
}
}
}
value = _fun3118();
const URLSearchParams = (URLSearchParamsModule).URLSearchParams;
exports.URLSearchParams = URLSearchParams;
exports.URL = value;
function _fun3118() { // fn#3118, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:251:646, offset: 0x00c912cd, size: 405 bytes, params: 1, frame: 17
return CreateClass(URL, [{key: 'hash', get: function() {
var value = this._url.match(RegExp('#([^/]*)', ''));
return value ? '#' + value[1] : '';
}}, {key: 'host', get: function() {
var value = this._url.match(RegExp('^https?:\\/\\/(?:[^@]+@)?([^:/?#]+)', ''));
var value2 = this._url.match(RegExp(':(\\d+)(?=[/?#]|$)', ''));
var value3 = '';
return value ? value[1] + (value2 ? ':' + value2[1] : value3) : value3;
}}, {key: 'hostname', get: function() {
var value = this._url.match(RegExp('^https?:\\/\\/(?:[^@]+@)?([^:/?#]+)', ''));
return value ? value[1] : '';
}}, {key: 'href', get: function() {
return this.toString();
}}, {key: 'origin', get: function() {
var value = this._url.match(RegExp('^(https?:\\/\\/[^/]+)', ''));
return value ? value[1] : '';
}}, {key: 'password', get: function() {
var value = this._url.match(RegExp('https?:\\/\\/.*:(.*)@', ''));
return value ? value[1] : '';
}}, {key: 'pathname', get: function() {
var r0;
var value = this._url.match(RegExp('https?:\\/\\/[^/]+(\\/[^?#]*)?', ''));
r0 = value && value[1];
r0 = !r0 ? '/' : r0;
return r0;
}}, {key: 'port', get: function() {
var value = this._url.match(RegExp(':(\\d+)(?=[/?#]|$)', ''));
return value ? value[1] : '';
}}, {key: 'protocol', get: function() {
var value = this._url.match(RegExp('^([a-zA-Z][a-zA-Z\\d+\\-.]*):', ''));
return value ? value[1] + ':' : '';
}}, {key: 'search', get: function() {
var value = this._url.match(RegExp('\\?([^#]*)', ''));
return value ? '?' + value[1] : '';
}}, {key: 'searchParams', get: function() {
var URLSearchParams;
var search;
if (this._searchParamsInstance == null) {
URLSearchParams = global.URLSearchParams;
search = this.search;
this._searchParamsInstance = new URLSearchParams();
}
return this._searchParamsInstance;
}}, {key: 'toJSON', value: function() {
return this.toString();
}}, {key: 'toString', value: function() {
if (this._searchParamsInstance === null) {
return this._url;
}
var property = this._searchParamsInstance;
var value = property.toString();
property = this._url;
var value2 = '?';
return this._url + (property.indexOf(value2) > -1 ? '&' : value2) + value;
}}, {key: 'username', get: function() {
var value = this._url.match(RegExp('^https?:\\/\\/([^:@]+)(?::[^@]*)?@', ''));
return value ? value[1] : '';
}}], [{key: 'createObjectURL', value: value_3134}, {key: 'revokeObjectURL', value: function(a0) {
}}]);
function URL(a0, a1) { // fn#3119, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:251:667, offset: 0x00c91462, size: 487 bytes, params: 3, frame: 18
var r4;
var r6;
var r1;
var TypeError;
var endsWith;
var _url;
var property;
let value = a0;
const value2 = a1;
env1_0(this, URL);
this._searchParamsInstance = null;
if (value2) {
if (validateBaseUrl(value)) {
this._url = value;
_url = this._url;
if (_url.includes('#')) {
value = this._url.split('#');
property = value[0];
property = property.split('://')[1];
if (!property.includes('/')) {
this._url = value.join('/#');
}
}
_url = this._url;
value = _url.endsWith('/');
r1 = value || this._url.includes('?');
r1 = !r1 ? this._url.includes('#') : r1;
if (!r1) {
this._url = this._url + '/';
}
return undefined;
}
if (typeof value2 === 'string') {
if (validateBaseUrl(value2)) {
r4 = value2;
endsWith = r4.endsWith;
r6 = Reflect.apply(endsWith, r4, ['/']) ? r4.slice(0, r4.length - 1) : r4;
r4 = value.startsWith('/') ? value : '/' + value;
endsWith = r6.endsWith;
this._url = '' + r6 + (Reflect.apply(endsWith, r6, [r4]) ? '' : r4);
return undefined;
}
TypeError = global.TypeError;
value = 'Invalid base URL: ' + value2;
throw new TypeError(value);
}
r4 = value2.toString();
endsWith = r4.endsWith;
r6 = Reflect.apply(endsWith, r4, ['/']) ? r4.slice(0, r4.length - 1) : r4;
r4 = value.startsWith('/') ? value : '/' + value;
endsWith = r6.endsWith;
this._url = '' + r6 + (Reflect.apply(endsWith, r6, [r4]) ? '' : r4);
} else {
this._url = value;
_url = this._url;
if (_url.includes('#')) {
value = this._url.split('#');
property = value[0];
property = property.split('://')[1];
if (!property.includes('/')) {
this._url = value.join('/#');
}
}
_url = this._url;
value = _url.endsWith('/');
r1 = value || this._url.includes('?');
r1 = !r1 ? this._url.includes('#') : r1;
if (!r1) {
this._url = this._url + '/';
}
}
}
function value_3134(a0) { // fn#3134, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:251:2831, offset: 0x00c91959, size: 118 bytes, params: 2, frame: 21
const value = environment.__proto__;
if (env1_2 === null) {
throw new global.Error('Cannot create URL for blob!');
}
return '' + env1_2 + a0.data.blobId + '?offset=' + a0.data.offset + '&size=' + a0.size;
}
}
}
global.__d(_fun3116, 226, [6, 7, 195, 227]) /* metro module 226, dependencies: [6, 7, 195, 227] */;