module.exports=[23299,e=>{"use strict";var t=e.i(97153);e.i(47299),e.i(43698),e.i(27028),e.i(81111),e.i(51615),e.i(12057),e.i(16377),e.i(57764),e.i(61095),e.i(2157),e.i(50227);var a=Object.defineProperty,r=(e,t)=>a(e,"name",{value:t,configurable:!0});let n=0,i={START_BOUNDARY:n++,HEADER_FIELD_START:n++,HEADER_FIELD:n++,HEADER_VALUE_START:n++,HEADER_VALUE:n++,HEADER_VALUE_ALMOST_DONE:n++,HEADERS_ALMOST_DONE:n++,PART_DATA_START:n++,PART_DATA:n++,END:n++},o=1,s=2,d=r(e=>32|e,"lower"),E=r(()=>{},"noop"),l=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=E,this.onHeaderField=E,this.onHeadersEnd=E,this.onHeaderValue=E,this.onPartBegin=E,this.onPartData=E,this.onPartEnd=E,this.boundaryChars={};const t=new Uint8Array((e=`\r
--`+e).length);for(let a=0;a<e.length;a++)t[a]=e.charCodeAt(a),this.boundaryChars[t[a]]=!0;this.boundary=t,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=i.START_BOUNDARY}write(e){let t,a,n=0,E=e.length,l=this.index,{lookbehind:A,boundary:h,boundaryChars:D,index:T,state:f,flags:_}=this,c=this.boundary.length,u=c-1,R=e.length,b=r(e=>{this[e+"Mark"]=n},"mark"),H=r(e=>{delete this[e+"Mark"]},"clear"),P=r((e,t,a,r)=>{(void 0===t||t!==a)&&this[e](r&&r.subarray(t,a))},"callback"),p=r((t,a)=>{let r=t+"Mark";r in this&&(a?(P(t,this[r],n,e),delete this[r]):(P(t,this[r],e.length,e),this[r]=0))},"dataCallback");for(n=0;n<E;n++)switch(t=e[n],f){case i.START_BOUNDARY:if(T===h.length-2){if(45===t)_|=s;else if(13!==t)return;T++;break}if(T-1==h.length-2){if(_&s&&45===t)f=i.END,_=0;else{if(_&s||10!==t)return;T=0,P("onPartBegin"),f=i.HEADER_FIELD_START}break}t!==h[T+2]&&(T=-2),t===h[T+2]&&T++;break;case i.HEADER_FIELD_START:f=i.HEADER_FIELD,b("onHeaderField"),T=0;case i.HEADER_FIELD:if(13===t){H("onHeaderField"),f=i.HEADERS_ALMOST_DONE;break}if(T++,45===t)break;if(58===t){if(1===T)return;p("onHeaderField",!0),f=i.HEADER_VALUE_START;break}if((a=d(t))<97||a>122)return;break;case i.HEADER_VALUE_START:if(32===t)break;b("onHeaderValue"),f=i.HEADER_VALUE;case i.HEADER_VALUE:13===t&&(p("onHeaderValue",!0),P("onHeaderEnd"),f=i.HEADER_VALUE_ALMOST_DONE);break;case i.HEADER_VALUE_ALMOST_DONE:if(10!==t)return;f=i.HEADER_FIELD_START;break;case i.HEADERS_ALMOST_DONE:if(10!==t)return;P("onHeadersEnd"),f=i.PART_DATA_START;break;case i.PART_DATA_START:f=i.PART_DATA,b("onPartData");case i.PART_DATA:if(l=T,0===T){for(n+=u;n<R&&!(e[n]in D);)n+=c;n-=u,t=e[n]}if(T<h.length)h[T]===t?(0===T&&p("onPartData",!0),T++):T=0;else if(T===h.length)T++,13===t?_|=o:45===t?_|=s:T=0;else if(T-1===h.length)if(_&o){if(T=0,10===t){_&=~o,P("onPartEnd"),P("onPartBegin"),f=i.HEADER_FIELD_START;break}}else _&s&&45===t?(P("onPartEnd"),f=i.END,_=0):T=0;T>0?A[T-1]=t:l>0&&(P("onPartData",0,l,new Uint8Array(A.buffer,A.byteOffset,A.byteLength)),l=0,b("onPartData"),n--);break;case i.END:break;default:throw Error(`Unexpected state entered: ${f}`)}p("onHeaderField"),p("onHeaderValue"),p("onPartData"),this.index=T,this.state=f,this.flags=_}end(){if(this.state===i.HEADER_FIELD_START&&0===this.index||this.state===i.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==i.END)throw Error("MultipartParser.end(): stream ended unexpectedly")}};function A(e){let t=e.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!t)return;let a=t[2]||t[3]||"",r=a.slice(a.lastIndexOf("\\")+1);return(r=r.replace(/%22/g,'"')).replace(/&#(\d{4});/g,(e,t)=>String.fromCharCode(t))}async function h(e,a){let n,i,o,s,d,E;if(!/multipart/i.test(a))throw TypeError("Failed to fetch");let h=a.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!h)throw TypeError("no or bad content-type header, no multipart boundary");let D=new l(h[1]||h[2]),T=[],f=new t.FormData,_=r(e=>{o+=b.decode(e,{stream:!0})},"onPartData"),c=r(e=>{T.push(e)},"appendToFile"),u=r(()=>{let e=new t.File(T,E,{type:d});f.append(s,e)},"appendFileToFormData"),R=r(()=>{f.append(s,o)},"appendEntryToFormData"),b=new TextDecoder("utf-8");for await(let t of(b.decode(),D.onPartBegin=function(){D.onPartData=_,D.onPartEnd=R,n="",i="",o="",s="",d="",E=null,T.length=0},D.onHeaderField=function(e){n+=b.decode(e,{stream:!0})},D.onHeaderValue=function(e){i+=b.decode(e,{stream:!0})},D.onHeaderEnd=function(){if(i+=b.decode(),"content-disposition"===(n=n.toLowerCase())){let e=i.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);e&&(s=e[2]||e[3]||""),(E=A(i))&&(D.onPartData=c,D.onPartEnd=u)}else"content-type"===n&&(d=i);i="",n=""},e))D.write(t);return D.end(),f}r(l,"MultipartParser"),r(A,"_fileName"),r(h,"toFormData"),e.s(["toFormData",()=>h])}];

//# sourceMappingURL=node_modules_node-fetch-native_dist_chunks_multipart-parser_mjs_c0182f4f._.js.map