function randomString(length = 10, allowed = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
  let result = "";
  for (let i = 0; i < length; i++) {
    result += allowed.charAt(Math.floor(Math.random() * allowed.length));
  }
  return result;
}
function formDataToObject(formData) {
  const result = {};
  formData.forEach((value, key) => {
    result[key] = formData.getAll(key);
    if (result[key].length === 1) {
      result[key] = result[key][0];
    }
  });
  return result;
}
function cookieStrToObj(str) {
  return str.split(";").map((v) => v.split("=")).reduce((acc, v) => {
    const key = decodeURIComponent(v[0].trim());
    const value = v[1];
    if (!value) {
      acc[key] = value ?? true;
    } else {
      acc[key] = decodeURIComponent(value.trim());
    }
    return acc;
  }, {});
}
function formatNumber(num, { currency } = {}) {
  const options = {};
  if (currency) {
    options.style = "currency";
    options.currency = currency;
  }
  const formatter = new Intl.NumberFormat("en-US", options);
  return formatter.format(Number(num));
}

export { formatNumber as a, cookieStrToObj as c, formDataToObject as f, randomString as r };
//# sourceMappingURL=utils2-BNPuf_o4.js.map
