import { P as Papa } from "./papaparse.min-Ds9XhCoe.js";
const base64ToBlob = async (file) => {
  const blob = await (await fetch(file)).blob();
  return blob;
};
const downloadCsv = (userData, columnsData) => {
  const csv = Papa.unparse({
    fields: columnsData.filter((column) => !column.hideColumn).map((column) => column.dataIndex),
    data: userData.map((user) => {
      const userRow = {};
      columnsData.filter((column) => !column.hideColumn).forEach((column) => {
        const renderValue = column.render && column.render(user) ? column.render(user) : "";
        const currentValue = renderValue ? renderValue : user[column.dataIndex];
        userRow[column.dataIndex] = currentValue;
      });
      return userRow;
    })
  });
  const blob = new Blob([csv], {
    type: "text/csv;charset=utf-8;"
  });
  const url = URL.createObjectURL(blob);
  const link = document.createElement("a");
  link.setAttribute("href", url);
  link.setAttribute("download", "users.csv");
  link.style.visibility = "hidden";
  document.body.appendChild(link);
  link.click();
  document.body.removeChild(link);
};
export {
  base64ToBlob as b,
  downloadCsv as d
};
//# sourceMappingURL=index-zpOhy7mV.js.map
