"use strict";Object.defineProperty(exports, "__esModule", {value: true});

var _chunkGNRTDXICcjs = require('./chunk-GNRTDXIC.cjs');

// src/hooks/useNumberInput/utils/parseAbbrValue.ts
var abbrValue = (value, decimalSeparator = ".", _decimalPlaces = 10) => {
  if (value > 999) {
    let valueLength = ("" + value).length;
    const p = Math.pow;
    const d = p(10, _decimalPlaces);
    valueLength -= valueLength % 3;
    const abbrValue2 = Math.round(value * d / p(10, valueLength)) / d + " kMGTPE"[valueLength / 3];
    return abbrValue2.replace(".", decimalSeparator);
  }
  return String(value);
};
var abbrMap = { k: 1e3, m: 1e6, b: 1e9 };
var parseAbbrValue = (value, decimalSeparator = ".") => {
  const reg = new RegExp(
    `(\\d+(${_chunkGNRTDXICcjs.escapeRegExp.call(void 0, decimalSeparator)}\\d*)?)([kmb])$`,
    "i"
  );
  const match = value.match(reg);
  if (match) {
    const [, digits, , abbr] = match;
    const multiplier = abbrMap[abbr.toLowerCase()];
    return Number(digits.replace(decimalSeparator, ".")) * multiplier;
  }
  return void 0;
};




exports.abbrValue = abbrValue; exports.parseAbbrValue = parseAbbrValue;
