wilddragon-site/node_modules/next/dist/compiled/busboy/index.js

1 line
25 KiB
JavaScript
Raw Normal View History

2026-04-17 15:51:01 -04:00
(function(){"use strict";var e={900:function(e,t,i){const{parseContentType:s}=i(318);function getInstance(e){const t=e.headers;const i=s(t["content-type"]);if(!i)throw new Error("Malformed content type");for(const s of r){const r=s.detect(i);if(!r)continue;const n={limits:e.limits,headers:t,conType:i,highWaterMark:undefined,fileHwm:undefined,defCharset:undefined,defParamCharset:undefined,preservePath:false};if(e.highWaterMark)n.highWaterMark=e.highWaterMark;if(e.fileHwm)n.fileHwm=e.fileHwm;n.defCharset=e.defCharset;n.defParamCharset=e.defParamCharset;n.preservePath=e.preservePath;return new s(n)}throw new Error(`Unsupported content type: ${t["content-type"]}`)}const r=[i(104),i(506)].filter((function(e){return typeof e.detect==="function"}));e.exports=e=>{if(typeof e!=="object"||e===null)e={};if(typeof e.headers!=="object"||e.headers===null||typeof e.headers["content-type"]!=="string"){throw new Error("Missing Content-Type")}return getInstance(e)}},104:function(e,t,i){const{Readable:s,Writable:r}=i(781);const n=i(542);const{basename:a,convertToUTF8:o,getDecoder:f,parseContentType:l,parseDisposition:c}=i(318);const h=Buffer.from("\r\n");const u=Buffer.from("\r");const d=Buffer.from("-");function noop(){}const _=2e3;const b=16*1024;const p=0;const y=1;const m=2;class HeaderParser{constructor(e){this.header=Object.create(null);this.pairCount=0;this.byteCount=0;this.state=p;this.name="";this.value="";this.crlf=0;this.cb=e}reset(){this.header=Object.create(null);this.pairCount=0;this.byteCount=0;this.state=p;this.name="";this.value="";this.crlf=0}push(e,t,i){let s=t;while(t<i){switch(this.state){case p:{let r=false;for(;t<i;++t){if(this.byteCount===b)return-1;++this.byteCount;const i=e[t];if(g[i]!==1){if(i!==58)return-1;this.name+=e.latin1Slice(s,t);if(this.name.length===0)return-1;++t;r=true;this.state=y;break}}if(!r){this.name+=e.latin1Slice(s,t);break}}case y:{let r=false;for(;t<i;++t){if(this.byteCount===b)return-1;++this.byteCount;const i=e[t];if(i!==32&&i!==9){s=t;r=true;this.state=m;break}}if(!r)break}case m:switch(this.crlf){case 0:for(;t<i;++t){if(this.byteCount===b)return-1;++this.byteCount;const i=e[t];if(w[i]!==1){if(i!==13)return-1;++this.crlf;break}}this.value+=e.latin1Slice(s,t++);break;case 1:if(this.byteCount===b)return-1;++this.byteCount;if(e[t++]!==10)return-1;++this.crlf;break;case 2:{if(this.byteCount===b)return-1;++this.byteCount;const i=e[t];if(i===32||i===9){s=t;this.crlf=0}else{if(++this.pairCount<_){this.name=this.name.toLowerCase();if(this.header[this.name]===undefined)this.header[this.name]=[this.value];else this.header[this.name].push(this.value)}if(i===13){++this.crlf;++t}else{s=t;this.crlf=0;this.state=p;this.name="";this.value=""}}break}case 3:{if(this.byteCount===b)return-1;++this.byteCount;if(e[t++]!==10)return-1;const i=this.header;this.reset();this.cb(i);return t}}break}}return t}}class FileStream extends s{constructor(e,t){super(e);this.truncated=false;this._readcb=null;this.once("end",(()=>{this._read();if(--t._fileEndsLeft===0&&t._finalcb){const e=t._finalcb;t._finalcb=null;process.nextTick(e)}}))}_read(e){const t=this._readcb;if(t){this._readcb=null;t()}}}const k={push:(e,t)=>{},destroy:()=>{}};function callAndUnsetCb(e,t){const i=e._writecb;e._writecb=null;if(t)e.destroy(t);else if(i)i()}function nullDecoder(e,t){return e}class Multipart extends r{constructor(e){const t={autoDestroy:true,emitClose:true,highWaterMark:typeof e.highWaterMark==="number"?e.highWaterMark:undefined};super(t);if(!e.conType.params||typeof e.conType.params.boundary!=="string")throw new Error("Multipart: Boundary not found");const i=e.conType.params.boundary;const s=typeof e.defParamCharset==="string"&&e.defParamCharset?f(e.defParamCharset):nullDecoder;const r=e.defCharset||"utf8";const _=e.preservePath;const b={autoDestroy:true,emitClose:true,highWaterMark:typeof e.fileHwm==="number"?e.fileHwm:undefined};const p=e.limits;const y=p&&typeof p.fieldSize==="number"?p.fieldSize:1*1024*1024;const m=p&&typeof p.fileSize==="number"?p.fileSize:Infinity;const g=p&&typeof p.files==="number"?p.files:Infinity;const w=p&&typ