var e=new TextDecoder;async function t(t,n){if(!t.ok||!t.body||t.bodyUsed)return t;let i=t.headers.get("content-type");if(!i||!~i.indexOf("multipart/"))return t;let l=i.indexOf("boundary="),r="-";if(~l){let e=l+9,t=i.indexOf(";",e);r=i.slice(e,t>-1?t:void 0).trim().replace(/"/g,"")}return async function*(t,n,i){let l,r,d,o=t.getReader(),a=!i||!i.multiple,f=n.length,s="",c=[];try{let t;e:for(;!(t=await o.read()).done;){let i=e.decode(t.value);l=s.length,s+=i;let o=i.indexOf(n);for(~o?l+=o:l=s.indexOf(n),c=[];~l;){let e=s.slice(0,l),t=s.slice(l+f);if(r){let n=e.indexOf("\r\n\r\n")+4,i=e.lastIndexOf("\r\n",n),l=!1,r=e.slice(n,i>-1?void 0:i),o=String(e.slice(0,n)).trim().split("\r\n"),f={},s=o.length;for(;d=o[--s];d=d.split(": "),f[d.shift().toLowerCase()]=d.join(": "));if(d=f["content-type"],d&&~d.indexOf("application/json"))try{r=JSON.parse(r),l=!0}catch(e){}if(d={headers:f,body:r,json:l},a?yield d:c.push(d),"--"===t.slice(0,2))break e}else n="\r\n"+n,r=f+=2;s=t,l=s.indexOf(n)}c.length&&(yield c)}}finally{c.length&&(yield c),await o.cancel()}}(t.body,`--${r}`,n)}exports.meros=t;