exports.default=function(e,t){void 0===t&&(t={});try{var r=function(){return n.download=t.fileName||"Untitled",Promise.resolve(o).then(function(e){n.href=URL.createObjectURL(e);var r=function(){"function"==typeof o&&o()},o=t.legacySetup&&t.legacySetup(r,function(){return o(reject)},n);return n.addEventListener("click",function(){setTimeout(function(){return URL.revokeObjectURL(n.href)},3e4),r()}),n.click(),null})};Array.isArray(t)&&(t=t[0]);var n=document.createElement("a"),o=e,c=function(){if("body"in e)return Promise.resolve(function(e,t){try{var r=e.getReader(),n=new ReadableStream({start:function(e){return function t(){try{return Promise.resolve(r.read().then(function(r){if(!r.done)return e.enqueue(r.value),t();e.close()}))}catch(e){return Promise.reject(e)}}()}}),o=new Response(n);return Promise.resolve(o.blob()).then(function(e){return r.releaseLock(),new Blob([e],{type:t})})}catch(e){return Promise.reject(e)}}(e.body,e.headers.get("content-type"))).then(function(e){o=e})}();return Promise.resolve(c&&c.then?c.then(r):r())}catch(e){return Promise.reject(e)}};
