{"version":3,"file":"utils.mjs","names":[],"sources":["../../../../../src/components/MessageComposer/hooks/utils.ts"],"sourcesContent":["export function prettifyFileSize(bytes: number, precision = 3) {\n  const units = ['B', 'kB', 'MB', 'GB'];\n  const exponent =\n    bytes === 0\n      ? 0\n      : Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);\n  const mantissa = bytes / 1024 ** exponent;\n  const formattedMantissa =\n    // `toPrecision` switches to exponential notation (`1.00e+3`) when the value needs more integer\n    // digits than the requested significant digits, e.g. a mantissa of 1000 to 1023 at the default\n    // precision of 3. Such a mantissa has no fraction worth showing, so it is rounded instead.\n    precision === 0 || mantissa >= 10 ** precision\n      ? Math.round(mantissa).toString()\n      : mantissa.toPrecision(precision);\n  return `${formattedMantissa} ${units[exponent]}`;\n}\n"],"mappings":";AAAA,SAAgB,iBAAiB,OAAe,YAAY,GAAG;CAC7D,MAAM,QAAQ;EAAC;EAAK;EAAM;EAAM;CAAI;CACpC,MAAM,WACJ,UAAU,IACN,IACA,KAAK,IAAI,KAAK,MAAM,KAAK,IAAI,KAAK,IAAI,KAAK,IAAI,IAAI,CAAC,GAAG,MAAM,SAAS,CAAC;CAC7E,MAAM,WAAW,QAAQ,QAAQ;CAQjC,OAAO,GAHL,cAAc,KAAK,YAAY,MAAM,YACjC,KAAK,MAAM,QAAQ,CAAC,CAAC,SAAS,IAC9B,SAAS,YAAY,SAAS,EACR,GAAG,MAAM;AACvC"}