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

643 lines
25 KiB
JavaScript

/* Metro module 6395; source: unknown; dependencies: [6386, 6374, 6375, 6396, 6398, 6399, 6401, 6403] */
import ClassCallCheck from './module-06374-ClassCallCheck.js'; /* Metro dependency 6374 */
import CreateClass from './module-06375-CreateClass.js'; /* Metro dependency 6375 */
import Module06386 from './module-06386.js'; /* Metro dependency 6386 */
import PossibleConstructorReturn from './module-06396-PossibleConstructorReturn.js'; /* Metro dependency 6396 */
import Module06398 from './module-06398.js'; /* Metro dependency 6398 */
import Module06399 from './module-06399.js'; /* Metro dependency 6399 */
import Inherits from './module-06401-Inherits.js'; /* Metro dependency 6401 */
import * as RVLayoutManagerModule from './module-06403-RVLayoutManager.js'; /* Metro dependency 6403 */
function _fun50138(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#50138, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6573:6, offset: 0x012120d9, size: 204 bytes, params: 8, frame: 18
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const RVLayoutManager = (RVLayoutManagerModule).RVLayoutManager;
exports.RVMasonryLayoutManagerImpl = _fun50142(RVLayoutManager);
function _isNativeReflectConstruct_50139() { // fn#50139, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6573:177, offset: 0x012121a5, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_50139_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun50142(a0) { // fn#50142, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6573:402, offset: 0x01212203, size: 335 bytes, params: 2, frame: 16
const RVMasonryLayoutManagerImpl2 = RVMasonryLayoutManagerImpl;
Inherits(RVMasonryLayoutManagerImpl2, a0);
return CreateClass(RVMasonryLayoutManagerImpl2, [{key: 'updateLayoutParams', value: value_50144},
{key: 'processLayoutInfo', value: function(a0, a1) {
var index;
var dimensions;
var layouts;
var property;
var height;
var layouts2;
var error;
var iterator = a0[Symbol.iterator]();
var iterator2 = iterator.next;
var r3 = iterator;
var item2 = Reflect.apply(iterator2, r3, []);
var item = item2.value;
item2 = item2.done ? undefined : r3;
reducibleJoin2: while (true) {
if (item2 === undefined) {
if (this.fullRelayoutRequired) {
this.updateAllWidths();
this.fullRelayoutRequired = false;
return 0;
}
return undefined;
}
break reducibleJoin2;
}
reducibleLoop2: while (true) {
try {
index = item.index;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
dimensions = item.dimensions;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
layouts = this.layouts;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
property = layouts[index];
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
height = dimensions.height;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
property.height = height;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
property.isHeightMeasured = true;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
property.isWidthMeasured = true;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
layouts2 = this.layouts;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
layouts2[index] = property;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
r3 = item2;
item2 = Reflect.apply(iterator2, r3, []);
item = item2.value;
item2 = item2.done ? undefined : r3;
if (item2 === undefined) {
break reducibleLoop2;
}
continue reducibleLoop2;
}
if (this.fullRelayoutRequired) {
this.updateAllWidths();
this.fullRelayoutRequired = false;
return 0;
}
}}, {key: 'estimateLayout', value: function(a0) {
var property = this.layouts[a0];
property.width = this.getWidth(a0);
property.height = this.getEstimatedHeight(a0);
property.isWidthMeasured = true;
property.enforcedWidth = true;
}}, {key: 'handleSpanChange', value: function(a0) {
this.fullRelayoutRequired = true;
}}, {key: 'getLayoutSize', value: value_50150}, {key: 'recomputeLayouts', value: value_50151}, {key: 'getWidth',
value: function(a0) {
return this.boundedSize / this.maxColumns * this.getSpan(a0);
}}, {key: 'updateAllWidths', value: function() {
var r2;
var property;
var value = 0;
if (value < this.layouts.length) {
for (r2 = value; true; r2 = value) {
property = this.layouts[r2];
property.width = this.getWidth(r2);
this.layouts[r2].minHeight = undefined;
value = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (!(value < this.layouts.length)) {
break;
}
}
}
}}, {key: 'placeItemSequentially', value: value_50154}, {key: 'placeSingleColumnItem', value: value_50155},
{key: 'placeOptimizedMultiColumnItem', value: value_50156}, {key: 'updateColumnHeightsToIndex',
value: value_50157}]);
function RVMasonryLayoutManagerImpl(a0, a1) { // fn#50143, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6573:414, offset: 0x01212352, size: 215 bytes, params: 3, frame: 20
let value = environment.__proto__;
env1_1(this, RVMasonryLayoutManagerImpl);
const items2 = [a0, a1];
const value3 = env1_4(RVMasonryLayoutManagerImpl);
value = env1_3(this, _isNativeReflectConstruct_50139() ? global.Reflect.construct(value3, items2,
env1_4(this).constructor) : value3.apply(this, items2));
value.currentColumn = 0;
value.fullRelayoutRequired = false;
value.boundedSize = a0.windowSize.width;
value.optimizeItemArrangement = a0.optimizeItemArrangement;
value.columnHeights = value.columnHeights ?? global.Array(value.maxColumns).fill(0);
return value;
}
function value_50144(a0) { // fn#50144, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6573:982, offset: 0x01212429, size: 200 bytes, params: 2, frame: 20
const maxColumns = this.maxColumns;
const optimizeItemArrangement = this.optimizeItemArrangement;
value_50144_superPropGet(RVMasonryLayoutManagerImpl, 'updateLayoutParams', this, 3)([a0]);
if (!(this.boundedSize === a0.windowSize.width && maxColumns === a0.maxColumns && optimizeItemArrangement === a0.optimizeItemArrangement)) {
this.boundedSize = a0.windowSize.width;
if (this.layouts.length > 0) {
this.updateAllWidths();
this.recomputeLayouts(0, this.layouts.length - 1);
this.requiresRepaint = true;
}
}
function value_50144_superPropGet(a0, a1, a2, a3) { // fn#50145, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6573:1067, owner: value_50144._superPropGet, offset: 0x012124f1, size: 100 bytes, params: 5, frame: 18
let value = a0;
const env0_0 = a2;
const binding = env2_5;
value = env2_4(1 & 3 ? value.prototype : value);
value = binding(value, 'updateLayoutParams', a2);
return 2 & 3 ? typeof value !== 'function' ? value : _fun50146 : value;
function _fun50146(a0) { // fn#50146, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6573:1166, offset: 0x00c62408, size: 27 bytes, params: 2, frame: 13
return ClassCallCheck.apply(importDefault, a0);
}
}
}
function value_50150() { // fn#50150, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6573:2104, offset: 0x01212620, size: 100 bytes, params: 1, frame: 16
if (this.layouts.length === 0) {
return {'width': 0, 'height': 0};
}
let Math = global.Math;
const max = Math.max;
const apply = max.apply;
Math = global.Math;
const value = environment.__proto__;
return {width: this.boundedSize, height: Reflect.apply(apply, max, [Math, env1_0(this.columnHeights)])};
}
function value_50156(a0, a1) { // fn#50156, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6573:3816, offset: 0x0121297c, size: 363 bytes, params: 3, frame: 25
var r3;
var r4;
var r10;
var r11;
var r12;
var r14;
var r13;
var r1;
var r2;
var r22;
var columnHeights;
var property;
var value2;
var Math;
var max;
var value3;
var value4;
var height;
var value5;
var value6;
var value7;
var value8;
var value9;
const Number = global.Number;
const MAX_VALUE = Number.MAX_VALUE;
let maxColumns = this.maxColumns;
let value = 0;
if (value <= maxColumns - a1) {
r3 = value;
r4 = value;
r10 = MAX_VALUE;
reducibleLoop1: while (true) {
columnHeights = this.columnHeights;
property = columnHeights[r3];
value2 = r3 + 1;
if (value2 < r3 + a1) {
r11 = property;
r12 = value2;
reducibleLoop2: while (true) {
Math = global.Math;
max = Math.max;
columnHeights = this.columnHeights;
value3 = Reflect.apply(max, Math, [r11, columnHeights[r12]]);
value4 = typeof r12 === 'bigint' ? r12 + 1n : +r12 + 1;
if (value4 < r3 + a1) {
r11 = value3;
r12 = value4;
continue reducibleLoop2;
}
r14 = value3;
break reducibleLoop2;
}
} else {
r14 = property;
}
maxColumns = this.maxColumns;
if (value < maxColumns) {
r12 = value;
r13 = value;
reducibleLoop4: while (true) {
reducibleJoin8: while (true) {
reducibleJoin6: while (true) {
if (r12 >= r3) {
if (r12 < r3 + a1) {
height = a0.height;
value5 = r14 + height;
r11 = value5;
break reducibleJoin8;
}
break reducibleJoin6;
}
break reducibleJoin6;
}
columnHeights = this.columnHeights;
property = columnHeights[r12];
r11 = property;
break reducibleJoin8;
}
value6 = r13 + r11;
value7 = typeof r12 === 'bigint' ? r12 + 1n : +r12 + 1;
maxColumns = this.maxColumns;
if (value7 < maxColumns) {
r12 = value7;
r13 = value6;
continue reducibleLoop4;
}
r1 = value6;
break reducibleLoop4;
}
} else {
r1 = value;
}
if (r1 < r10) {
r4 = r3;
r10 = r1;
}
value8 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
maxColumns = this.maxColumns;
if (value8 <= maxColumns - a1) {
r3 = value8;
continue reducibleLoop1;
}
r2 = r4;
break reducibleLoop1;
}
} else {
r2 = value;
}
Math = global.Math;
max = Math.max;
const apply = max.apply;
Math = global.Math;
value = environment.__proto__;
const binding = env1_0;
value = this.columnHeights.slice(r2, r2 + a1);
value = Reflect.apply(apply, max, [Math, binding(value)]);
a0.x = this.boundedSize / this.maxColumns * r2;
a0.y = value;
if (r2 < r2 + a1) {
r22 = r2;
reducibleLoop12: while (true) {
columnHeights = this.columnHeights;
height = a0.height;
columnHeights[r22] = value + height;
value9 = typeof r22 === 'bigint' ? r22 + 1n : +r22 + 1;
if (value9 < r2 + a1) {
r22 = value9;
continue reducibleLoop12;
}
break reducibleLoop12;
}
}
}
}
}
function value_50151(a0, a1) { // fn#50151, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6573:2302, offset: 0x01212684, size: 186 bytes, params: 3, frame: 18
var r0;
var value2;
var span;
var optimizeItemArrangement;
let value = a0;
if (value === 0) {
value2 = global.Array(this.maxColumns);
this.columnHeights = value2.fill(0);
this.currentColumn = 0;
} else {
this.updateColumnHeightsToIndex(value);
}
const length = this.layouts.length;
if (value < length) {
r0 = value;
while (true) {
value = this.getLayout(r0);
span = this.getSpan(r0, true);
optimizeItemArrangement = this.optimizeItemArrangement;
if (optimizeItemArrangement) {
if (span === 1) {
this.placeSingleColumnItem(value);
break;
}
this.placeOptimizedMultiColumnItem(value, span);
break;
}
this.placeItemSequentially(value, span);
value = typeof r0 === 'bigint' ? r0 + 1n : +r0 + 1;
if (value < length) {
r0 = value;
continue;
}
break;
}
}
}
function value_50154(a0, a1) { // fn#50154, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6573:2979, offset: 0x012127bd, size: 299 bytes, params: 3, frame: 20
var r3;
var r7;
var r8;
var r4;
var Math;
var max;
var height;
let currentColumn = this.currentColumn;
let value = currentColumn + a1;
let maxColumns = this.maxColumns;
if (value > maxColumns) {
this.currentColumn = 0;
}
let columnHeights = this.columnHeights;
const property = columnHeights[this.currentColumn];
value = this.currentColumn + 1;
currentColumn = this.currentColumn;
if (value < currentColumn + a1) {
r3 = property;
r7 = value;
while (true) {
maxColumns = this.maxColumns;
if (r7 < maxColumns) {
Math = global.Math;
max = Math.max;
columnHeights = this.columnHeights;
r8 = Reflect.apply(max, Math, [r3, columnHeights[r7]]);
} else {
r8 = r3;
}
value = typeof r7 === 'bigint' ? r7 + 1n : +r7 + 1;
currentColumn = this.currentColumn;
if (value < currentColumn + a1) {
r3 = r8;
r7 = value;
continue;
}
r4 = r8;
break;
}
} else {
r4 = property;
}
a0.x = this.boundedSize / this.maxColumns * this.currentColumn;
a0.y = r4;
currentColumn = this.currentColumn;
if (currentColumn < this.currentColumn + a1) {
r3 = currentColumn;
while (true) {
maxColumns = this.maxColumns;
if (r3 < maxColumns) {
columnHeights = this.columnHeights;
height = a0.height;
columnHeights[r3] = r4 + height;
}
value = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
currentColumn = this.currentColumn;
if (value < currentColumn + a1) {
r3 = value;
continue;
}
break;
}
}
this.currentColumn = this.currentColumn + a1;
if (this.currentColumn >= this.maxColumns) {
this.currentColumn = 0;
}
}
function value_50155(a0) { // fn#50155, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6573:3523, offset: 0x012128e8, size: 148 bytes, params: 2, frame: 8
var r4;
var r5;
var r6;
var r2;
let columnHeights = this.columnHeights;
let value = 0;
let property = columnHeights[value];
let maxColumns = this.maxColumns;
const value2 = 1;
if (value2 < maxColumns) {
r4 = value;
r5 = value2;
r6 = property;
while (true) {
columnHeights = this.columnHeights;
if (columnHeights[r5] < r6) {
columnHeights = this.columnHeights;
property = columnHeights[r5];
r4 = r5;
r6 = property;
}
value = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1;
maxColumns = this.maxColumns;
if (value < maxColumns) {
r5 = value;
continue;
}
r2 = r4;
break;
}
} else {
r2 = value;
}
a0.x = this.boundedSize / this.maxColumns * r2;
a0.y = this.columnHeights[r2];
columnHeights = this.columnHeights;
columnHeights[r2] = columnHeights[r2] + a0.height;
}
function value_50157(a0) { // fn#50157, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6573:4310, offset: 0x01212ae7, size: 271 bytes, params: 2, frame: 25
var r1;
var r7;
var layouts;
var property;
var width;
var boundedSize;
var Math;
var round;
var value3;
var x;
var min;
var value4;
var value5;
var columnHeights;
var max;
var columnHeights2;
var property2;
var y;
var height;
var value6;
var optimizeItemArrangement;
const Array = global.Array;
let maxColumns = this.maxColumns;
let value = Array(maxColumns);
const fill = value.fill;
const value2 = 0;
this.columnHeights = Reflect.apply(fill, value, [value2]);
this.currentColumn = value2;
if (value2 < a0) {
r1 = value2;
reducibleLoop1: while (true) {
layouts = this.layouts;
property = layouts[r1];
width = property.width;
boundedSize = this.boundedSize;
maxColumns = this.maxColumns;
value = boundedSize / maxColumns;
Math = global.Math;
round = Math.round;
value3 = Reflect.apply(round, Math, [width / value]);
Math = global.Math;
round = Math.round;
x = property.x;
value = Reflect.apply(round, Math, [x / value]);
Math = global.Math;
min = Math.min;
value4 = value + value3;
maxColumns = this.maxColumns;
value5 = Reflect.apply(min, Math, [value4, maxColumns]);
if (value < value5) {
r7 = value;
reducibleLoop2: while (true) {
columnHeights = this.columnHeights;
Math = global.Math;
max = Math.max;
columnHeights2 = this.columnHeights;
property2 = columnHeights2[r7];
y = property.y;
height = property.height;
columnHeights[r7] = Reflect.apply(max, Math, [property2, y + height]);
value6 = typeof r7 === 'bigint' ? r7 + 1n : +r7 + 1;
if (value6 < value5) {
r7 = value6;
continue reducibleLoop2;
}
break reducibleLoop2;
}
}
optimizeItemArrangement = this.optimizeItemArrangement;
reducibleJoin5: while (true) {
if (optimizeItemArrangement) {
break reducibleJoin5;
}
value += value3;
maxColumns = this.maxColumns;
this.currentColumn = value % maxColumns;
break reducibleJoin5;
}
value = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
if (value < a0) {
r1 = value;
continue reducibleLoop1;
}
break reducibleLoop1;
}
}
}
global.__d(_fun50138, 6395, [6386, 6374, 6375, 6396, 6398, 6399, 6401,
6403]) /* metro module 6395, dependencies: [6386, 6374, 6375, 6396, 6398, 6399, 6401, 6403] */;