/* Metro module 4685; source: modules/media_uploads/ImageEncodingLadder.tsx; dependencies: [6, 7, 661, 2] */ import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ function _fun40550(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#40550, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4863:6, offset: 0x01104934, size: 211 bytes, params: 8, frame: 20 const getAdaptiveImageCompressionQuality2 = getAdaptiveImageCompressionQuality; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const value = _fun40552(); (FileImportTrackerModule).fileFinishedImporting('modules/media_uploads/ImageEncodingLadder.tsx'); exports.IMAGE_COMPRESSION_THRESHOLDS = {'SMALL': 921600, 'MEDIUM': 2073600, 'LARGE': 3686400, 'VERY_LARGE': 8294400}; exports.ADAPTIVE_COMPRESSION_CONFIG = {'useAdaptiveCompression': true, 'veryHighQuality': 0.8, 'highQuality': 0.7, 'mediumQuality': 0.6, 'lowQuality': 0.5, 'veryLowQuality': 0.4, 'useOriginalIfSmaller': true}; exports.getAdaptiveImageCompressionQuality = getAdaptiveImageCompressionQuality2; exports.ImageEncodingLadder = value; function getAdaptiveImageCompressionQuality(a0, a1) { // fn#40551, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4863:347, offset: 0x01104a07, size: 269 bytes, params: 3, frame: 6 var value; var width; var height; if (a1.useAdaptiveCompression) { width = a0.width; if (width == null) { return CompressionQuality.HIGH; } height = a0.height; if (height == null) { return CompressionQuality.HIGH; } width = a0.width; height = a0.height; value = width * height; return value <= env0_3.SMALL ? a1.veryHighQuality ?? CompressionQuality.HIGH : value <= env0_3.MEDIUM ? a1.highQuality ?? CompressionQuality.HIGH : value <= env0_3.LARGE ? a1.mediumQuality ?? CompressionQuality.HIGH : value <= env0_3.VERY_LARGE ? a1.lowQuality ?? CompressionQuality.HIGH : a1.veryLowQuality ?? CompressionQuality.HIGH; } return CompressionQuality.HIGH; } function _fun40552() { // fn#40552, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4863:755, offset: 0x01104b14, size: 85 bytes, params: 1, frame: 16 return CreateClass(ImageEncodingLadder, null, [{key: 'selectEncodingConfig', value: value_40554}, {key: 'clampDimensions', value: value_40555}]); function ImageEncodingLadder() { // fn#40553, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4863:766, offset: 0x00da1b5f, size: 27 bytes, params: 1, frame: 13 env1_0(this, ImageEncodingLadder); } function value_40554(a0) { // fn#40554, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4863:894, offset: 0x01104b69, size: 196 bytes, params: 2, frame: 19 var object2; var lowQuality; let value = ImageEncodingLadder.clampDimensions(a0.width, a0.height, 3840, 2160); const targetWidth = value.targetWidth; const targetHeight = value.targetHeight; if (a0.width !== targetWidth) { value = environment.__proto__; lowQuality = env1_4.lowQuality; value = 0.5; object2 = {compressionQuality: 100 * (lowQuality ?? value), targetWidth: targetWidth, targetHeight: targetHeight}; } else if (a0.height === targetHeight) { value = environment.__proto__; value = getAdaptiveImageCompressionQuality({width: targetWidth, height: targetHeight}, env1_4); object2 = {compressionQuality: 100 * value, targetWidth: targetWidth, targetHeight: targetHeight}; } else { value = environment.__proto__; lowQuality = env1_4.lowQuality; value = 0.5; object2 = {compressionQuality: 100 * (lowQuality ?? value), targetWidth: targetWidth, targetHeight: targetHeight}; } return object2; } } } function value_40555(a0, a1, a2, a3) { // fn#40555, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4863:1278, offset: 0x01104c2d, size: 220 bytes, params: 5, frame: 19 var object; let Math = global.Math; let max = Math.max; let value = Reflect.apply(max, Math, [a0, a1]); Math = global.Math; let min = Math.min; const value2 = Reflect.apply(min, Math, [a0, a1]); Math = global.Math; const value3 = Math.max(a2, a3); Math = global.Math; const value4 = Math.min(a2, a3); if (value <= value3) { if (value2 <= value4) { return {targetWidth: a0, targetHeight: a1}; } Math = global.Math; min = Math.min; value = value3 / value; value = Reflect.apply(min, Math, [value, value4 / value2]); object = {}; Math = global.Math; object.targetWidth = Math.max(1, global.Math.round(a0 * value)); } else { Math = global.Math; min = Math.min; value = value3 / value; value = Reflect.apply(min, Math, [value, value4 / value2]); object = {}; Math = global.Math; object.targetWidth = Math.max(1, global.Math.round(a0 * value)); } Math = global.Math; max = Math.max; const Math3 = global.Math; object.targetHeight = Reflect.apply(max, Math, [1, Math3.round(a1 * value)]); return object; } global.__d(_fun40550, 4685, [6, 7, 661, 2]) /* metro module 4685, dependencies: [6, 7, 661, 2] */;