"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var w=async(n,e={})=>{Array.isArray(e)&&(e=e[0]);const t=document.createElement("a");let r=n;"body"in n&&(r=await(async function(u,i){const o=u.getReader(),s=new ReadableStream({start:l=>(async function b(){return o.read().then(({done:f,value:p})=>{if(!f)return l.enqueue(p),b();l.close()})})()}),d=new Response(s),y=await d.blob();return o.releaseLock(),new Blob([y],{type:i})})(n.body,n.headers.get("content-type"))),t.download=e.fileName||"Untitled",t.href=URL.createObjectURL(await r);const c=()=>{typeof a=="function"&&a()},a=e.legacySetup&&e.legacySetup(c,()=>a(reject),t);return t.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(t.href),3e4),c()}),t.click(),null};exports.default=w;
