const n = (o, l) => {
  let r;
  if (o instanceof Blob)
    r = o;
  else if (o instanceof File)
    r = o;
  else if (Array.isArray(o) && o.length === 2) {
    const [e, t] = o;
    if (typeof e == "string")
      r = new Blob([e], { type: t });
    else if (e instanceof ArrayBuffer || ArrayBuffer.isView(e))
      r = new Blob([e], { type: t });
    else if (e instanceof Blob)
      r = new Blob([e], { type: t });
    else
      throw new Error(`Unsupported data type for download. Received data of type ${typeof e}.`);
  } else
    throw new Error("Invalid content type. Content must be a Blob, File, or [data, mimeType] tuple.");
  const a = URL.createObjectURL(r);
  try {
    const e = document.createElement("a");
    e.href = a, e.download = l, document.body.appendChild(e), e.click(), document.body.removeChild(e);
  } catch (e) {
    throw new Error(`Failed to download ${l}`, { cause: e });
  } finally {
    URL.revokeObjectURL(a);
  }
};
export {
  n as downloadContent
};
//# sourceMappingURL=downloadContent.js.map
