"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var y=async(e,t=[{}],s=null,p=!1,o=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const n=[];let a=null;if(e instanceof Blob&&e.type?a=e.type:e.headers&&e.headers.get("content-type")&&(a=e.headers.get("content-type")),t.forEach((i,r)=>{n[r]={description:i.description||"",accept:{}},i.mimeTypes?(r===0&&a&&i.mimeTypes.push(a),i.mimeTypes.map(d=>{n[r].accept[d]=i.extensions||[]})):a&&(n[r].accept[a]=i.extensions||[])}),s)try{await s.getFile()}catch(i){if(s=null,p)throw i}const c=s||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:n,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!s&&o&&o();const l=await c.createWritable();return"stream"in e?(await e.stream().pipeTo(l),c):"body"in e?(await e.body.pipeTo(l),c):(await l.write(await e),await l.close(),c)};exports.default=y;
