{ "version": 3, "sources": ["../src/multipart-parser.node.ts", "../../headers/src/lib/param-values.ts", "../../headers/src/lib/utils.ts", "../../headers/src/lib/accept.ts", "../../headers/src/lib/accept-encoding.ts", "../../headers/src/lib/accept-language.ts", "../../headers/src/lib/cache-control.ts", "../../headers/src/lib/content-disposition.ts", "../../headers/src/lib/content-type.ts", "../../headers/src/lib/cookie.ts", "../../headers/src/lib/if-none-match.ts", "../../headers/src/lib/set-cookie.ts", "../../headers/src/lib/header-names.ts", "../../headers/src/lib/super-headers.ts", "../src/lib/read-stream.ts", "../src/lib/buffer-search.ts", "../src/lib/multipart.ts", "../src/lib/multipart-request.ts", "../src/lib/multipart.node.ts"], "sourcesContent": ["// Re-export all core functionality\nexport type { ParseMultipartOptions, MultipartParserOptions } from './lib/multipart.ts';\nexport {\n MultipartParseError,\n MaxHeaderSizeExceededError,\n MaxFileSizeExceededError,\n MultipartParser,\n MultipartPart,\n} from './lib/multipart.ts';\n\nexport { getMultipartBoundary } from './lib/multipart-request.ts';\n\n// Export Node.js-specific functionality\nexport { isMultipartRequest, parseMultipartRequest, parseMultipart, parseMultipartStream } from './lib/multipart.node.ts';\n", "export function parseParams(\n input: string,\n delimiter: ';' | ',' = ';',\n): [string, string | undefined][] {\n // This parser splits on the delimiter and unquotes any quoted values\n // like `filename=\"the\\\\ filename.txt\"`.\n let parser =\n delimiter === ';'\n ? /(?:^|;)\\s*([^=;\\s]+)(\\s*=\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|((?:[^;]|\\\\\\;)+))?)?/g\n : /(?:^|,)\\s*([^=,\\s]+)(\\s*=\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|((?:[^,]|\\\\\\,)+))?)?/g;\n\n let params: [string, string | undefined][] = [];\n\n let match;\n while ((match = parser.exec(input)) !== null) {\n let key = match[1].trim();\n\n let value: string | undefined;\n if (match[2]) {\n value = (match[3] || match[4] || '').replace(/\\\\(.)/g, '$1').trim();\n }\n\n params.push([key, value]);\n }\n\n return params;\n}\n\nexport function quote(value: string): string {\n if (value.includes('\"') || value.includes(';') || value.includes(' ')) {\n return `\"${value.replace(/\"/g, '\\\\\"')}\"`;\n }\n return value;\n}\n", "export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\n}\n\nexport function isIterable(value: any): value is Iterable {\n return value != null && typeof value[Symbol.iterator] === 'function';\n}\n\nexport function isValidDate(date: unknown): boolean {\n return date instanceof Date && !isNaN(date.getTime());\n}\n\nexport function quoteEtag(tag: string): string {\n return tag === '*' ? tag : /^(W\\/)?\".*\"$/.test(tag) ? tag : `\"${tag}\"`;\n}\n", "import { type HeaderValue } from './header-value.ts';\nimport { parseParams } from './param-values.ts';\nimport { isIterable } from './utils.ts';\n\nexport type AcceptInit = Iterable | Record;\n\n/**\n * The value of a `Accept` HTTP header.\n *\n * [MDN `Accept` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2)\n */\nexport class Accept implements HeaderValue, Iterable<[string, number]> {\n #map: Map;\n\n constructor(init?: string | AcceptInit) {\n this.#map = new Map();\n\n if (init) {\n if (typeof init === 'string') {\n for (let piece of init.split(/\\s*,\\s*/)) {\n let params = parseParams(piece);\n if (params.length < 1) continue;\n\n let mediaType = params[0][0];\n let weight = 1;\n\n for (let i = 1; i < params.length; i++) {\n let [key, value] = params[i];\n if (key === 'q') {\n weight = Number(value);\n break;\n }\n }\n\n this.#map.set(mediaType.toLowerCase(), weight);\n }\n } else if (isIterable(init)) {\n for (let mediaType of init) {\n if (Array.isArray(mediaType)) {\n this.#map.set(mediaType[0].toLowerCase(), mediaType[1]);\n } else {\n this.#map.set(mediaType.toLowerCase(), 1);\n }\n }\n } else {\n for (let mediaType of Object.getOwnPropertyNames(init)) {\n this.#map.set(mediaType.toLowerCase(), init[mediaType]);\n }\n }\n\n this.#sort();\n }\n }\n\n #sort() {\n this.#map = new Map([...this.#map].sort((a, b) => b[1] - a[1]));\n }\n\n /**\n * An array of all media types in the header.\n */\n get mediaTypes(): string[] {\n return Array.from(this.#map.keys());\n }\n\n /**\n * An array of all weights (q values) in the header.\n */\n get weights(): number[] {\n return Array.from(this.#map.values());\n }\n\n /**\n * The number of media types in the `Accept` header.\n */\n get size(): number {\n return this.#map.size;\n }\n\n /**\n * Returns `true` if the header matches the given media type (i.e. it is \"acceptable\").\n * @param mediaType The media type to check.\n * @returns `true` if the media type is acceptable, `false` otherwise.\n */\n accepts(mediaType: string): boolean {\n return this.getWeight(mediaType) > 0;\n }\n\n /**\n * Gets the weight of a given media type. Also supports wildcards, so e.g. `text/*` will match `text/html`.\n * @param mediaType The media type to get the weight of.\n * @returns The weight of the media type.\n */\n getWeight(mediaType: string): number {\n let [type, subtype] = mediaType.toLowerCase().split('/');\n\n for (let [key, value] of this) {\n let [t, s] = key.split('/');\n if (\n (t === type || t === '*' || type === '*') &&\n (s === subtype || s === '*' || subtype === '*')\n ) {\n return value;\n }\n }\n\n return 0;\n }\n\n /**\n * Returns the most preferred media type from the given list of media types.\n * @param mediaTypes The list of media types to choose from.\n * @returns The most preferred media type or `null` if none match.\n */\n getPreferred(mediaTypes: string[]): string | null {\n let sorted = mediaTypes\n .map((mediaType) => [mediaType, this.getWeight(mediaType)] as const)\n .sort((a, b) => b[1] - a[1]);\n\n let first = sorted[0];\n\n return first !== undefined && first[1] > 0 ? first[0] : null;\n }\n\n /**\n * Returns the weight of a media type. If it is not in the header verbatim, this returns `null`.\n * @param mediaType The media type to get the weight of.\n * @returns The weight of the media type, or `null` if it is not in the header.\n */\n get(mediaType: string): number | null {\n return this.#map.get(mediaType.toLowerCase()) ?? null;\n }\n\n /**\n * Sets a media type with the given weight.\n * @param mediaType The media type to set.\n * @param weight The weight of the media type. Defaults to 1.\n */\n set(mediaType: string, weight = 1): void {\n this.#map.set(mediaType.toLowerCase(), weight);\n this.#sort();\n }\n\n /**\n * Removes the given media type from the header.\n * @param mediaType The media type to remove.\n */\n delete(mediaType: string): void {\n this.#map.delete(mediaType.toLowerCase());\n }\n\n /**\n * Checks if a media type is in the header.\n * @param mediaType The media type to check.\n * @returns `true` if the media type is in the header (verbatim), `false` otherwise.\n */\n has(mediaType: string): boolean {\n return this.#map.has(mediaType.toLowerCase());\n }\n\n /**\n * Removes all media types from the header.\n */\n clear(): void {\n this.#map.clear();\n }\n\n entries(): IterableIterator<[string, number]> {\n return this.#map.entries();\n }\n\n [Symbol.iterator](): IterableIterator<[string, number]> {\n return this.entries();\n }\n\n forEach(\n callback: (mediaType: string, weight: number, header: Accept) => void,\n thisArg?: any,\n ): void {\n for (let [mediaType, weight] of this) {\n callback.call(thisArg, mediaType, weight, this);\n }\n }\n\n toString(): string {\n let pairs: string[] = [];\n\n for (let [mediaType, weight] of this.#map) {\n pairs.push(`${mediaType}${weight === 1 ? '' : `;q=${weight}`}`);\n }\n\n return pairs.join(',');\n }\n}\n", "import { type HeaderValue } from './header-value.ts';\nimport { parseParams } from './param-values.ts';\nimport { isIterable } from './utils.ts';\n\nexport type AcceptEncodingInit = Iterable | Record;\n\n/**\n * The value of a `Accept-Encoding` HTTP header.\n *\n * [MDN `Accept-Encoding` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.4)\n */\nexport class AcceptEncoding implements HeaderValue, Iterable<[string, number]> {\n #map: Map;\n\n constructor(init?: string | AcceptEncodingInit) {\n this.#map = new Map();\n\n if (init) {\n if (typeof init === 'string') {\n for (let piece of init.split(/\\s*,\\s*/)) {\n let params = parseParams(piece);\n if (params.length < 1) continue;\n\n let encoding = params[0][0];\n let weight = 1;\n\n for (let i = 1; i < params.length; i++) {\n let [key, value] = params[i];\n if (key === 'q') {\n weight = Number(value);\n break;\n }\n }\n\n this.#map.set(encoding.toLowerCase(), weight);\n }\n } else if (isIterable(init)) {\n for (let value of init) {\n if (Array.isArray(value)) {\n this.#map.set(value[0].toLowerCase(), value[1]);\n } else {\n this.#map.set(value.toLowerCase(), 1);\n }\n }\n } else {\n for (let encoding of Object.getOwnPropertyNames(init)) {\n this.#map.set(encoding.toLowerCase(), init[encoding]);\n }\n }\n\n this.#sort();\n }\n }\n\n #sort() {\n this.#map = new Map([...this.#map].sort((a, b) => b[1] - a[1]));\n }\n\n /**\n * An array of all encodings in the header.\n */\n get encodings(): string[] {\n return Array.from(this.#map.keys());\n }\n\n /**\n * An array of all weights (q values) in the header.\n */\n get weights(): number[] {\n return Array.from(this.#map.values());\n }\n\n /**\n * The number of encodings in the header.\n */\n get size(): number {\n return this.#map.size;\n }\n\n /**\n * Returns `true` if the header matches the given encoding (i.e. it is \"acceptable\").\n * @param encoding The encoding to check.\n * @returns `true` if the encoding is acceptable, `false` otherwise.\n */\n accepts(encoding: string): boolean {\n return encoding.toLowerCase() === 'identity' || this.getWeight(encoding) > 0;\n }\n\n /**\n * Gets the weight an encoding. Performs wildcard matching so `*` matches all encodings.\n * @param encoding The encoding to get.\n * @returns The weight of the encoding, or `0` if it is not in the header.\n */\n getWeight(encoding: string): number {\n let lower = encoding.toLowerCase();\n\n for (let [enc, weight] of this) {\n if (enc === lower || enc === '*' || lower === '*') {\n return weight;\n }\n }\n\n return 0;\n }\n\n /**\n * Returns the most preferred encoding from the given list of encodings.\n * @param encodings The encodings to choose from.\n * @returns The most preferred encoding or `null` if none match.\n */\n getPreferred(encodings: string[]): string | null {\n let sorted = encodings\n .map((encoding) => [encoding, this.getWeight(encoding)] as const)\n .sort((a, b) => b[1] - a[1]);\n\n let first = sorted[0];\n\n return first !== undefined && first[1] > 0 ? first[0] : null;\n }\n\n /**\n * Gets the weight of an encoding. If it is not in the header verbatim, this returns `null`.\n * @param encoding The encoding to get.\n * @returns The weight of the encoding, or `null` if it is not in the header.\n */\n get(encoding: string): number | null {\n return this.#map.get(encoding.toLowerCase()) ?? null;\n }\n\n /**\n * Sets an encoding with the given weight.\n * @param encoding The encoding to set.\n * @param weight The weight of the encoding. Defaults to 1.\n */\n set(encoding: string, weight = 1): void {\n this.#map.set(encoding.toLowerCase(), weight);\n this.#sort();\n }\n\n /**\n * Removes the given encoding from the header.\n * @param encoding The encoding to remove.\n */\n delete(encoding: string): void {\n this.#map.delete(encoding.toLowerCase());\n }\n\n /**\n * Checks if the header contains a given encoding.\n * @param encoding The encoding to check.\n * @returns `true` if the encoding is in the header, `false` otherwise.\n */\n has(encoding: string): boolean {\n return this.#map.has(encoding.toLowerCase());\n }\n\n /**\n * Removes all encodings from the header.\n */\n clear(): void {\n this.#map.clear();\n }\n\n entries(): IterableIterator<[string, number]> {\n return this.#map.entries();\n }\n\n [Symbol.iterator](): IterableIterator<[string, number]> {\n return this.entries();\n }\n\n forEach(\n callback: (encoding: string, weight: number, header: AcceptEncoding) => void,\n thisArg?: any,\n ): void {\n for (let [encoding, weight] of this) {\n callback.call(thisArg, encoding, weight, this);\n }\n }\n\n toString(): string {\n let pairs: string[] = [];\n\n for (let [encoding, weight] of this.#map) {\n pairs.push(`${encoding}${weight === 1 ? '' : `;q=${weight}`}`);\n }\n\n return pairs.join(',');\n }\n}\n", "import { type HeaderValue } from './header-value.ts';\nimport { parseParams } from './param-values.ts';\nimport { isIterable } from './utils.ts';\n\nexport type AcceptLanguageInit = Iterable | Record;\n\n/**\n * The value of a `Accept-Language` HTTP header.\n *\n * [MDN `Accept-Language` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.5)\n */\nexport class AcceptLanguage implements HeaderValue, Iterable<[string, number]> {\n #map: Map;\n\n constructor(init?: string | AcceptLanguageInit) {\n this.#map = new Map();\n\n if (init) {\n if (typeof init === 'string') {\n for (let piece of init.split(/\\s*,\\s*/)) {\n let params = parseParams(piece);\n if (params.length < 1) continue;\n\n let language = params[0][0];\n let weight = 1;\n\n for (let i = 1; i < params.length; i++) {\n let [key, value] = params[i];\n if (key === 'q') {\n weight = Number(value);\n break;\n }\n }\n\n this.#map.set(language.toLowerCase(), weight);\n }\n } else if (isIterable(init)) {\n for (let value of init) {\n if (Array.isArray(value)) {\n this.#map.set(value[0].toLowerCase(), value[1]);\n } else {\n this.#map.set(value.toLowerCase(), 1);\n }\n }\n } else {\n for (let language of Object.getOwnPropertyNames(init)) {\n this.#map.set(language.toLowerCase(), init[language]);\n }\n }\n\n this.#sort();\n }\n }\n\n #sort() {\n this.#map = new Map([...this.#map].sort((a, b) => b[1] - a[1]));\n }\n\n /**\n * An array of all languages in the header.\n */\n get languages(): string[] {\n return Array.from(this.#map.keys());\n }\n\n /**\n * An array of all weights (q values) in the header.\n */\n get weights(): number[] {\n return Array.from(this.#map.values());\n }\n\n /**\n * The number of languages in the header.\n */\n get size(): number {\n return this.#map.size;\n }\n\n /**\n * Returns `true` if the header matches the given language (i.e. it is \"acceptable\").\n * @param language The locale identifier of the language to check.\n * @returns `true` if the language is acceptable, `false` otherwise.\n */\n accepts(language: string): boolean {\n return this.getWeight(language) > 0;\n }\n\n /**\n * Gets the weight of a language with the given locale identifier. Performs wildcard and subtype\n * matching, so `en` matches `en-US` and `en-GB`, and `*` matches all languages.\n * @param language The locale identifier of the language to get.\n * @returns The weight of the language, or `0` if it is not in the header.\n */\n getWeight(language: string): number {\n let [base, subtype] = language.toLowerCase().split('-');\n\n for (let [key, value] of this) {\n let [b, s] = key.split('-');\n if (\n (b === base || b === '*' || base === '*') &&\n (s === subtype || s === undefined || subtype === undefined)\n ) {\n return value;\n }\n }\n\n return 0;\n }\n\n /**\n * Returns the most preferred language from the given list of languages.\n * @param languages The locale identifiers of the languages to choose from.\n * @returns The most preferred language or `null` if none match.\n */\n getPreferred(languages: string[]): string | null {\n let sorted = languages\n .map((language) => [language, this.getWeight(language)] as const)\n .sort((a, b) => b[1] - a[1]);\n\n let first = sorted[0];\n\n return first !== undefined && first[1] > 0 ? first[0] : null;\n }\n\n /**\n * Gets the weight of a language with the given locale identifier. If it is not in the header\n * verbatim, this returns `null`.\n * @param language The locale identifier of the language to get.\n * @returns The weight of the language, or `null` if it is not in the header.\n */\n get(language: string): number | null {\n return this.#map.get(language.toLowerCase()) ?? null;\n }\n\n /**\n * Sets a language with the given weight.\n * @param language The locale identifier of the language to set.\n * @param weight The weight of the language. Defaults to 1.\n */\n set(language: string, weight = 1): void {\n this.#map.set(language.toLowerCase(), weight);\n this.#sort();\n }\n\n /**\n * Removes a language with the given locale identifier.\n * @param language The locale identifier of the language to remove.\n */\n delete(language: string): void {\n this.#map.delete(language.toLowerCase());\n }\n\n /**\n * Checks if the header contains a language with the given locale identifier.\n * @param language The locale identifier of the language to check.\n * @returns `true` if the language is in the header, `false` otherwise.\n */\n has(language: string): boolean {\n return this.#map.has(language.toLowerCase());\n }\n\n /**\n * Removes all languages from the header.\n */\n clear(): void {\n this.#map.clear();\n }\n\n entries(): IterableIterator<[string, number]> {\n return this.#map.entries();\n }\n\n [Symbol.iterator](): IterableIterator<[string, number]> {\n return this.entries();\n }\n\n forEach(\n callback: (language: string, weight: number, header: AcceptLanguage) => void,\n thisArg?: any,\n ): void {\n for (let [language, weight] of this) {\n callback.call(thisArg, language, weight, this);\n }\n }\n\n toString(): string {\n let pairs: string[] = [];\n\n for (let [language, weight] of this.#map) {\n pairs.push(`${language}${weight === 1 ? '' : `;q=${weight}`}`);\n }\n\n return pairs.join(',');\n }\n}\n", "import { type HeaderValue } from './header-value.ts';\nimport { parseParams } from './param-values.ts';\n\n// Taken from https://github.com/jjenzz/pretty-cache-header by jjenzz\n// License: MIT https://github.com/jjenzz/pretty-cache-header/blob/main/LICENSE\nexport interface CacheControlInit {\n /**\n * The `max-age=N` **request directive** indicates that the client allows a stored response that\n * is generated on the origin server within _N_ seconds \u2014 where _N_ may be any non-negative\n * integer (including `0`).\n *\n * The `max-age=N` **response directive** indicates that the response remains\n * [fresh](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age)\n * until _N_ seconds after the response is generated.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#max-age)\n */\n maxAge?: number;\n /**\n * The `max-stale=N` **request directive** indicates that the client allows a stored response\n * that is [stale](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age)\n * within _N_ seconds.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#max-stale)\n */\n maxStale?: number;\n /**\n * The `min-fresh=N` **request directive** indicates that the client allows a stored response\n * that is [fresh](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age)\n * for at least _N_ seconds.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#min-fresh)\n */\n minFresh?: number;\n /**\n * The `s-maxage` **response directive** also indicates how long the response is\n * [fresh](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age) for (similar to `max-age`) \u2014\n * but it is specific to shared caches, and they will ignore `max-age` when it is present.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#s-maxage)\n */\n sMaxage?: number;\n /**\n * The `no-cache` **request directive** asks caches to validate the response with the origin\n * server before reuse. If you want caches to always check for content updates while reusing\n * stored content, `no-cache` is the directive to use.\n *\n * The `no-cache` **response directive** indicates that the response can be stored in caches, but\n * the response must be validated with the origin server before each reuse, even when the cache\n * is disconnected from the origin server.\n *\n * `no-cache` allows clients to request the most up-to-date response even if the cache has a\n * [fresh](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age)\n * response.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#no-cache)\n */\n noCache?: true;\n /**\n * The `no-store` **request directive** allows a client to request that caches refrain from\n * storing the request and corresponding response \u2014 even if the origin server's response could\n * be stored.\n *\n * The `no-store` **response directive** indicates that any caches of any kind (private or shared)\n * should not store this response.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#no-store)\n */\n noStore?: true;\n /**\n * `no-transform` indicates that any intermediary (regardless of whether it implements a cache)\n * shouldn't transform the response contents.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#no-transform)\n */\n noTransform?: true;\n /**\n * The client indicates that cache should obtain an already-cached response. If a cache has\n * stored a response, it's reused.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#only-if-cached)\n */\n onlyIfCached?: true;\n /**\n * The `must-revalidate` **response directive** indicates that the response can be stored in\n * caches and can be reused while [fresh](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age).\n * If the response becomes [stale](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age),\n * it must be validated with the origin server before reuse.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#must-revalidate)\n */\n mustRevalidate?: true;\n /**\n * The `proxy-revalidate` **response directive** is the equivalent of `must-revalidate`, but\n * specifically for shared caches only.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#proxy-revalidate)\n */\n proxyRevalidate?: true;\n /**\n * The `must-understand` **response directive** indicates that a cache should store the response\n * only if it understands the requirements for caching based on status code.\n *\n * `must-understand` should be coupled with `no-store` for fallback behavior.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#must-understand)\n */\n mustUnderstand?: true;\n /**\n * The `private` **response directive** indicates that the response can be stored only in a\n * private cache (e.g. local caches in browsers).\n *\n * You should add the `private` directive for user-personalized content, especially for responses\n * received after login and for sessions managed via cookies.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#private)\n */\n private?: true;\n /**\n * The `public` **response directive** indicates that the response can be stored in a shared\n * cache. Responses for requests with `Authorization` header fields must not be stored in a\n * shared cache; however, the `public` directive will cause such responses to be stored in a\n * shared cache.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#public)\n */\n public?: true;\n /**\n * The `immutable` **response directive** indicates that the response will not be updated while\n * it's [fresh](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age).\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#public)\n */\n immutable?: true;\n /**\n * The `stale-while-revalidate` **response directive** indicates that the cache could reuse a\n * stale response while it revalidates it to a cache.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#stale-while-revalidate)\n */\n staleWhileRevalidate?: number;\n /**\n * The `stale-if-error` **response directive** indicates that the cache can reuse a\n * [stale response](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age)\n * when an upstream server generates an error, or when the error is generated locally. Here, an\n * error is considered any response with a status code of 500, 502, 503, or 504.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#stale-if-error)\n */\n staleIfError?: number;\n}\n\n/**\n * The value of a `Cache-Control` HTTP header.\n *\n * [MDN `Cache-Control` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7234#section-5.2)\n */\nexport class CacheControl implements HeaderValue, CacheControlInit {\n maxAge?: number;\n maxStale?: number;\n minFresh?: number;\n sMaxage?: number;\n noCache?: true;\n noStore?: true;\n noTransform?: true;\n onlyIfCached?: true;\n mustRevalidate?: true;\n proxyRevalidate?: true;\n mustUnderstand?: true;\n private?: true;\n public?: true;\n immutable?: true;\n staleWhileRevalidate?: number;\n staleIfError?: number;\n\n constructor(init?: string | CacheControlInit) {\n if (init) {\n if (typeof init === 'string') {\n let params = parseParams(init, ',');\n if (params.length > 0) {\n for (let [name, value] of params) {\n switch (name) {\n case 'max-age':\n this.maxAge = Number(value);\n break;\n case 'max-stale':\n this.maxStale = Number(value);\n break;\n case 'min-fresh':\n this.minFresh = Number(value);\n break;\n case 's-maxage':\n this.sMaxage = Number(value);\n break;\n case 'no-cache':\n this.noCache = true;\n break;\n case 'no-store':\n this.noStore = true;\n break;\n case 'no-transform':\n this.noTransform = true;\n break;\n case 'only-if-cached':\n this.onlyIfCached = true;\n break;\n case 'must-revalidate':\n this.mustRevalidate = true;\n break;\n case 'proxy-revalidate':\n this.proxyRevalidate = true;\n break;\n case 'must-understand':\n this.mustUnderstand = true;\n break;\n case 'private':\n this.private = true;\n break;\n case 'public':\n this.public = true;\n break;\n case 'immutable':\n this.immutable = true;\n break;\n case 'stale-while-revalidate':\n this.staleWhileRevalidate = Number(value);\n break;\n case 'stale-if-error':\n this.staleIfError = Number(value);\n break;\n }\n }\n }\n } else {\n this.maxAge = init.maxAge;\n this.maxStale = init.maxStale;\n this.minFresh = init.minFresh;\n this.sMaxage = init.sMaxage;\n this.noCache = init.noCache;\n this.noStore = init.noStore;\n this.noTransform = init.noTransform;\n this.onlyIfCached = init.onlyIfCached;\n this.mustRevalidate = init.mustRevalidate;\n this.proxyRevalidate = init.proxyRevalidate;\n this.mustUnderstand = init.mustUnderstand;\n this.private = init.private;\n this.public = init.public;\n this.immutable = init.immutable;\n this.staleWhileRevalidate = init.staleWhileRevalidate;\n this.staleIfError = init.staleIfError;\n }\n }\n }\n\n toString(): string {\n let parts = [];\n\n if (this.public) {\n parts.push('public');\n }\n if (this.private) {\n parts.push('private');\n }\n if (typeof this.maxAge === 'number') {\n parts.push(`max-age=${this.maxAge}`);\n }\n if (typeof this.sMaxage === 'number') {\n parts.push(`s-maxage=${this.sMaxage}`);\n }\n if (this.noCache) {\n parts.push('no-cache');\n }\n if (this.noStore) {\n parts.push('no-store');\n }\n if (this.noTransform) {\n parts.push('no-transform');\n }\n if (this.onlyIfCached) {\n parts.push('only-if-cached');\n }\n if (this.mustRevalidate) {\n parts.push('must-revalidate');\n }\n if (this.proxyRevalidate) {\n parts.push('proxy-revalidate');\n }\n if (this.mustUnderstand) {\n parts.push('must-understand');\n }\n if (this.immutable) {\n parts.push('immutable');\n }\n if (typeof this.staleWhileRevalidate === 'number') {\n parts.push(`stale-while-revalidate=${this.staleWhileRevalidate}`);\n }\n if (typeof this.staleIfError === 'number') {\n parts.push(`stale-if-error=${this.staleIfError}`);\n }\n if (typeof this.maxStale === 'number') {\n parts.push(`max-stale=${this.maxStale}`);\n }\n if (typeof this.minFresh === 'number') {\n parts.push(`min-fresh=${this.minFresh}`);\n }\n\n return parts.join(', ');\n }\n}\n", "import { type HeaderValue } from './header-value.ts';\nimport { parseParams, quote } from './param-values.ts';\n\nexport interface ContentDispositionInit {\n /**\n * For file uploads, the name of the file that the user selected.\n */\n filename?: string;\n /**\n * For file uploads, the name of the file that the user selected, encoded as a [RFC 8187](https://tools.ietf.org/html/rfc8187) `filename*` parameter.\n * This parameter allows non-ASCII characters in filenames, and specifies the character encoding.\n */\n filenameSplat?: string;\n /**\n * For `multipart/form-data` requests, the name of the `` field associated with this content.\n */\n name?: string;\n /**\n * The disposition type of the content, such as `attachment` or `inline`.\n */\n type?: string;\n}\n\n/**\n * The value of a `Content-Disposition` HTTP header.\n *\n * [MDN `Content-Disposition` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition)\n *\n * [RFC 6266](https://tools.ietf.org/html/rfc6266)\n */\nexport class ContentDisposition implements HeaderValue, ContentDispositionInit {\n filename?: string;\n filenameSplat?: string;\n name?: string;\n type?: string;\n\n constructor(init?: string | ContentDispositionInit) {\n if (init) {\n if (typeof init === 'string') {\n let params = parseParams(init);\n if (params.length > 0) {\n this.type = params[0][0];\n for (let [name, value] of params.slice(1)) {\n if (name === 'filename') {\n this.filename = value;\n } else if (name === 'filename*') {\n this.filenameSplat = value;\n } else if (name === 'name') {\n this.name = value;\n }\n }\n }\n } else {\n this.filename = init.filename;\n this.filenameSplat = init.filenameSplat;\n this.name = init.name;\n this.type = init.type;\n }\n }\n }\n\n /**\n * The preferred filename for the content, using the `filename*` parameter if present, falling back to the `filename` parameter.\n *\n * From [RFC 6266](https://tools.ietf.org/html/rfc6266):\n *\n * Many user agent implementations predating this specification do not understand the \"filename*\" parameter.\n * Therefore, when both \"filename\" and \"filename*\" are present in a single header field value, recipients SHOULD\n * pick \"filename*\" and ignore \"filename\". This way, senders can avoid special-casing specific user agents by\n * sending both the more expressive \"filename*\" parameter, and the \"filename\" parameter as fallback for legacy recipients.\n */\n get preferredFilename(): string | undefined {\n let filenameSplat = this.filenameSplat;\n if (filenameSplat) {\n let decodedFilename = decodeFilenameSplat(filenameSplat);\n if (decodedFilename) return decodedFilename;\n }\n\n return this.filename;\n }\n\n toString(): string {\n if (!this.type) {\n return '';\n }\n\n let parts = [this.type];\n\n if (this.name) {\n parts.push(`name=${quote(this.name)}`);\n }\n if (this.filename) {\n parts.push(`filename=${quote(this.filename)}`);\n }\n if (this.filenameSplat) {\n parts.push(`filename*=${quote(this.filenameSplat)}`);\n }\n\n return parts.join('; ');\n }\n}\n\nfunction decodeFilenameSplat(value: string): string | null {\n let match = value.match(/^([\\w-]+)'([^']*)'(.+)$/);\n if (!match) return null;\n\n let [, charset, , encodedFilename] = match;\n\n let decodedFilename = percentDecode(encodedFilename);\n\n try {\n let decoder = new TextDecoder(charset);\n let bytes = new Uint8Array(decodedFilename.split('').map((char) => char.charCodeAt(0)));\n return decoder.decode(bytes);\n } catch (error) {\n console.warn(`Failed to decode filename from charset ${charset}:`, error);\n return decodedFilename;\n }\n}\n\nfunction percentDecode(value: string): string {\n return value.replace(/\\+/g, ' ').replace(/%([0-9A-Fa-f]{2})/g, (_, hex) => {\n return String.fromCharCode(parseInt(hex, 16));\n });\n}\n", "import { type HeaderValue } from './header-value.ts';\nimport { parseParams, quote } from './param-values.ts';\n\nexport interface ContentTypeInit {\n /**\n * For multipart entities, the boundary that separates the different parts of the message.\n */\n boundary?: string;\n /**\n * Indicates the [character encoding](https://developer.mozilla.org/en-US/docs/Glossary/Character_encoding) of the content.\n *\n * For example, `utf-8`, `iso-8859-1`.\n */\n charset?: string;\n /**\n * The media type (or MIME type) of the content. This consists of a type and subtype, separated by a slash.\n *\n * For example, `text/html`, `application/json`, `image/png`.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types)\n */\n mediaType?: string;\n}\n\n/**\n * The value of a `Content-Type` HTTP header.\n *\n * [MDN `Content-Type` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.1.5)\n */\nexport class ContentType implements HeaderValue, ContentTypeInit {\n boundary?: string;\n charset?: string;\n mediaType?: string;\n\n constructor(init?: string | ContentTypeInit) {\n if (init) {\n if (typeof init === 'string') {\n let params = parseParams(init);\n if (params.length > 0) {\n this.mediaType = params[0][0];\n for (let [name, value] of params.slice(1)) {\n if (name === 'boundary') {\n this.boundary = value;\n } else if (name === 'charset') {\n this.charset = value;\n }\n }\n }\n } else {\n this.boundary = init.boundary;\n this.charset = init.charset;\n this.mediaType = init.mediaType;\n }\n }\n }\n\n toString(): string {\n if (!this.mediaType) {\n return '';\n }\n\n let parts = [this.mediaType];\n\n if (this.charset) {\n parts.push(`charset=${quote(this.charset)}`);\n }\n if (this.boundary) {\n parts.push(`boundary=${quote(this.boundary)}`);\n }\n\n return parts.join('; ');\n }\n}\n", "import { type HeaderValue } from './header-value.ts';\nimport { parseParams, quote } from './param-values.ts';\nimport { isIterable } from './utils.ts';\n\nexport type CookieInit = Iterable<[string, string]> | Record;\n\n/**\n * The value of a `Cookie` HTTP header.\n *\n * [MDN `Cookie` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc6265#section-4.2)\n */\nexport class Cookie implements HeaderValue, Iterable<[string, string]> {\n #map: Map;\n\n constructor(init?: string | CookieInit) {\n this.#map = new Map();\n if (init) {\n if (typeof init === 'string') {\n let params = parseParams(init);\n for (let [name, value] of params) {\n this.#map.set(name, value ?? '');\n }\n } else if (isIterable(init)) {\n for (let [name, value] of init) {\n this.#map.set(name, value);\n }\n } else {\n for (let name of Object.getOwnPropertyNames(init)) {\n this.#map.set(name, init[name]);\n }\n }\n }\n }\n\n /**\n * An array of the names of the cookies in the header.\n */\n get names(): string[] {\n return Array.from(this.#map.keys());\n }\n\n /**\n * An array of the values of the cookies in the header.\n */\n get values(): string[] {\n return Array.from(this.#map.values());\n }\n\n /**\n * The number of cookies in the header.\n */\n get size(): number {\n return this.#map.size;\n }\n\n /**\n * Gets the value of a cookie with the given name from the header.\n * @param name The name of the cookie.\n * @returns The value of the cookie, or `null` if the cookie does not exist.\n */\n get(name: string): string | null {\n return this.#map.get(name) ?? null;\n }\n\n /**\n * Sets a cookie with the given name and value in the header.\n * @param name The name of the cookie.\n * @param value The value of the cookie.\n */\n set(name: string, value: string): void {\n this.#map.set(name, value);\n }\n\n /**\n * Removes a cookie with the given name from the header.\n * @param name The name of the cookie.\n */\n delete(name: string): void {\n this.#map.delete(name);\n }\n\n /**\n * True if a cookie with the given name exists in the header.\n * @param name The name of the cookie.\n * @returns True if a cookie with the given name exists in the header.\n */\n has(name: string): boolean {\n return this.#map.has(name);\n }\n\n /**\n * Removes all cookies from the header.\n */\n clear(): void {\n this.#map.clear();\n }\n\n entries(): IterableIterator<[string, string]> {\n return this.#map.entries();\n }\n\n [Symbol.iterator](): IterableIterator<[string, string]> {\n return this.entries();\n }\n\n forEach(callback: (name: string, value: string, header: Cookie) => void, thisArg?: any): void {\n for (let [name, value] of this) {\n callback.call(thisArg, name, value, this);\n }\n }\n\n toString(): string {\n let pairs: string[] = [];\n\n for (let [name, value] of this.#map) {\n pairs.push(`${name}=${quote(value)}`);\n }\n\n return pairs.join('; ');\n }\n}\n", "import { type HeaderValue } from './header-value.ts';\nimport { quoteEtag } from './utils.ts';\n\nexport interface IfNoneMatchInit {\n /**\n * The entity tags to compare against the current entity.\n */\n tags: string[];\n}\n\n/**\n * The value of an `If-None-Match` HTTP header.\n *\n * [MDN `If-None-Match` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7232#section-3.2)\n */\nexport class IfNoneMatch implements HeaderValue, IfNoneMatchInit {\n tags: string[] = [];\n\n constructor(init?: string | string[] | IfNoneMatchInit) {\n if (init) {\n if (typeof init === 'string') {\n this.tags.push(...init.split(/\\s*,\\s*/).map(quoteEtag));\n } else if (Array.isArray(init)) {\n this.tags.push(...init.map(quoteEtag));\n } else {\n this.tags.push(...init.tags.map(quoteEtag));\n }\n }\n }\n\n /**\n * Checks if the header contains the given entity tag.\n *\n * Note: This method checks only for exact matches and does not consider wildcards.\n *\n * @param tag The entity tag to check for.\n * @returns `true` if the tag is present in the header, `false` otherwise.\n */\n has(tag: string): boolean {\n return this.tags.includes(quoteEtag(tag));\n }\n\n /**\n * Checks if this header matches the given entity tag.\n *\n * @param tag The entity tag to check for.\n * @returns `true` if the tag is present in the header (or the header contains a wildcard), `false` otherwise.\n */\n matches(tag: string): boolean {\n return this.has(tag) || this.tags.includes('*');\n }\n\n toString() {\n return this.tags.join(', ');\n }\n}\n", "import { type HeaderValue } from './header-value.ts';\nimport { parseParams, quote } from './param-values.ts';\nimport { capitalize, isValidDate } from './utils.ts';\n\ntype SameSiteValue = 'Strict' | 'Lax' | 'None';\n\nexport interface SetCookieInit {\n /**\n * The domain of the cookie. For example, `example.com`.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#domaindomain-value)\n */\n domain?: string;\n /**\n * The expiration date of the cookie. If not specified, the cookie is a session cookie.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#expiresdate)\n */\n expires?: Date;\n /**\n * Indicates this cookie should not be accessible via JavaScript.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#httponly)\n */\n httpOnly?: true;\n /**\n * The maximum age of the cookie in seconds.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#max-age)\n */\n maxAge?: number;\n /**\n * The name of the cookie.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#cookie-namecookie-value)\n */\n name?: string;\n /**\n * The path of the cookie. For example, `/` or `/admin`.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#pathpath-value)\n */\n path?: string;\n /**\n * The `SameSite` attribute of the cookie. This attribute lets servers require that a cookie shouldn't be sent with\n * cross-site requests, which provides some protection against cross-site request forgery attacks.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value)\n */\n sameSite?: SameSiteValue;\n /**\n * Indicates the cookie should only be sent over HTTPS.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#secure)\n */\n secure?: true;\n /**\n * The value of the cookie.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#cookie-namecookie-value)\n */\n value?: string;\n}\n\n/**\n * The value of a `Set-Cookie` HTTP header.\n *\n * [MDN `Set-Cookie` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1)\n */\nexport class SetCookie implements HeaderValue, SetCookieInit {\n domain?: string;\n expires?: Date;\n httpOnly?: true;\n maxAge?: number;\n name?: string;\n path?: string;\n sameSite?: SameSiteValue;\n secure?: true;\n value?: string;\n\n constructor(init?: string | SetCookieInit) {\n if (init) {\n if (typeof init === 'string') {\n let params = parseParams(init);\n if (params.length > 0) {\n this.name = params[0][0];\n this.value = params[0][1];\n\n for (let [key, value] of params.slice(1)) {\n switch (key.toLowerCase()) {\n case 'domain':\n this.domain = value;\n break;\n case 'expires': {\n if (typeof value === 'string') {\n let date = new Date(value);\n if (isValidDate(date)) {\n this.expires = date;\n }\n }\n break;\n }\n case 'httponly':\n this.httpOnly = true;\n break;\n case 'max-age': {\n if (typeof value === 'string') {\n let v = parseInt(value, 10);\n if (!isNaN(v)) this.maxAge = v;\n }\n break;\n }\n case 'path':\n this.path = value;\n break;\n case 'samesite':\n if (typeof value === 'string' && /strict|lax|none/i.test(value)) {\n this.sameSite = capitalize(value) as SameSiteValue;\n }\n break;\n case 'secure':\n this.secure = true;\n break;\n }\n }\n }\n } else {\n this.domain = init.domain;\n this.expires = init.expires;\n this.httpOnly = init.httpOnly;\n this.maxAge = init.maxAge;\n this.name = init.name;\n this.path = init.path;\n this.sameSite = init.sameSite;\n this.secure = init.secure;\n this.value = init.value;\n }\n }\n }\n\n toString(): string {\n if (!this.name) {\n return '';\n }\n\n let parts = [`${this.name}=${quote(this.value || '')}`];\n\n if (this.domain) {\n parts.push(`Domain=${this.domain}`);\n }\n if (this.path) {\n parts.push(`Path=${this.path}`);\n }\n if (this.expires) {\n parts.push(`Expires=${this.expires.toUTCString()}`);\n }\n if (this.maxAge) {\n parts.push(`Max-Age=${this.maxAge}`);\n }\n if (this.secure) {\n parts.push('Secure');\n }\n if (this.httpOnly) {\n parts.push('HttpOnly');\n }\n if (this.sameSite) {\n parts.push(`SameSite=${this.sameSite}`);\n }\n\n return parts.join('; ');\n }\n}\n", "const HeaderWordCasingExceptions: Record = {\n ct: 'CT',\n etag: 'ETag',\n te: 'TE',\n www: 'WWW',\n x: 'X',\n xss: 'XSS',\n};\n\nexport function canonicalHeaderName(name: string): string {\n return name\n .toLowerCase()\n .split('-')\n .map((word) => HeaderWordCasingExceptions[word] || word.charAt(0).toUpperCase() + word.slice(1))\n .join('-');\n}\n", "import { type AcceptInit, Accept } from './accept.ts';\nimport { type AcceptEncodingInit, AcceptEncoding } from './accept-encoding.ts';\nimport { type AcceptLanguageInit, AcceptLanguage } from './accept-language.ts';\nimport { type CacheControlInit, CacheControl } from './cache-control.ts';\nimport { type ContentDispositionInit, ContentDisposition } from './content-disposition.ts';\nimport { type ContentTypeInit, ContentType } from './content-type.ts';\nimport { type CookieInit, Cookie } from './cookie.ts';\nimport { canonicalHeaderName } from './header-names.ts';\nimport { type HeaderValue } from './header-value.ts';\nimport { type IfNoneMatchInit, IfNoneMatch } from './if-none-match.ts';\nimport { type SetCookieInit, SetCookie } from './set-cookie.ts';\nimport { isIterable, quoteEtag } from './utils.ts';\n\ntype DateInit = number | Date;\n\ninterface SuperHeadersPropertyInit {\n /**\n * The [`Accept`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept) header value.\n */\n accept?: string | AcceptInit;\n /**\n * The [`Accept-Encoding`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) header value.\n */\n acceptEncoding?: string | AcceptEncodingInit;\n /**\n * The [`Accept-Language`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language) header value.\n */\n acceptLanguage?: string | AcceptLanguageInit;\n /**\n * The [`Accept-Ranges`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Ranges) header value.\n */\n acceptRanges?: string;\n /**\n * The [`Age`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Age) header value.\n */\n age?: string | number;\n /**\n * The [`Cache-Control`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) header value.\n */\n cacheControl?: string | CacheControlInit;\n /**\n * The [`Connection`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection) header value.\n */\n connection?: string;\n /**\n * The [`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) header value.\n */\n contentDisposition?: string | ContentDispositionInit;\n /**\n * The [`Content-Encoding`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding) header value.\n */\n contentEncoding?: string | string[];\n /**\n * The [`Content-Language`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Language) header value.\n */\n contentLanguage?: string | string[];\n /**\n * The [`Content-Length`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length) header value.\n */\n contentLength?: string | number;\n /**\n * The [`Content-Type`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) header value.\n */\n contentType?: string | ContentTypeInit;\n /**\n * The [`Cookie`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie) header value.\n */\n cookie?: string | CookieInit;\n /**\n * The [`Date`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Date) header value.\n */\n date?: string | DateInit;\n /**\n * The [`ETag`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) header value.\n */\n etag?: string;\n /**\n * The [`Expires`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires) header value.\n */\n expires?: string | DateInit;\n /**\n * The [`Host`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host) header value.\n */\n host?: string;\n /**\n * The [`If-Modified-Since`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since) header value.\n */\n ifModifiedSince?: string | DateInit;\n /**\n * The [`If-None-Match`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match) header value.\n */\n ifNoneMatch?: string | string[] | IfNoneMatchInit;\n /**\n * The [`If-Unmodified-Since`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since) header value.\n */\n ifUnmodifiedSince?: string | DateInit;\n /**\n * The [`Last-Modified`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified) header value.\n */\n lastModified?: string | DateInit;\n /**\n * The [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header value.\n */\n location?: string;\n /**\n * The [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer) header value.\n */\n referer?: string;\n /**\n * The [`Set-Cookie`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) header value(s).\n */\n setCookie?: string | (string | SetCookieInit)[];\n}\n\nexport type SuperHeadersInit =\n | Iterable<[string, string]>\n | (SuperHeadersPropertyInit & Record);\n\nconst CRLF = '\\r\\n';\n\nconst AcceptKey = 'accept';\nconst AcceptEncodingKey = 'accept-encoding';\nconst AcceptLanguageKey = 'accept-language';\nconst AcceptRangesKey = 'accept-ranges';\nconst AgeKey = 'age';\nconst CacheControlKey = 'cache-control';\nconst ConnectionKey = 'connection';\nconst ContentDispositionKey = 'content-disposition';\nconst ContentEncodingKey = 'content-encoding';\nconst ContentLanguageKey = 'content-language';\nconst ContentLengthKey = 'content-length';\nconst ContentTypeKey = 'content-type';\nconst CookieKey = 'cookie';\nconst DateKey = 'date';\nconst ETagKey = 'etag';\nconst ExpiresKey = 'expires';\nconst HostKey = 'host';\nconst IfModifiedSinceKey = 'if-modified-since';\nconst IfNoneMatchKey = 'if-none-match';\nconst IfUnmodifiedSinceKey = 'if-unmodified-since';\nconst LastModifiedKey = 'last-modified';\nconst LocationKey = 'location';\nconst RefererKey = 'referer';\nconst SetCookieKey = 'set-cookie';\n\n/**\n * An enhanced JavaScript `Headers` interface with type-safe access.\n *\n * [API Reference](https://github.com/mjackson/remix-the-web/tree/main/packages/headers)\n *\n * [MDN `Headers` Base Class Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers)\n */\nexport class SuperHeaders extends Headers {\n #map: Map;\n #setCookies: (string | SetCookie)[] = [];\n\n constructor(init?: string | SuperHeadersInit | Headers) {\n super();\n\n this.#map = new Map();\n\n if (init) {\n if (typeof init === 'string') {\n let lines = init.split(CRLF);\n for (let line of lines) {\n let match = line.match(/^([^:]+):(.*)/);\n if (match) {\n this.append(match[1].trim(), match[2].trim());\n }\n }\n } else if (isIterable(init)) {\n for (let [name, value] of init) {\n this.append(name, value);\n }\n } else if (typeof init === 'object') {\n for (let name of Object.getOwnPropertyNames(init)) {\n let value = init[name];\n\n let descriptor = Object.getOwnPropertyDescriptor(SuperHeaders.prototype, name);\n if (descriptor?.set) {\n descriptor.set.call(this, value);\n } else {\n this.set(name, value.toString());\n }\n }\n }\n }\n }\n\n /**\n * Appends a new header value to the existing set of values for a header,\n * or adds the header if it does not already exist.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/append)\n */\n append(name: string, value: string): void {\n let key = name.toLowerCase();\n if (key === SetCookieKey) {\n this.#setCookies.push(value);\n } else {\n let existingValue = this.#map.get(key);\n this.#map.set(key, existingValue ? `${existingValue}, ${value}` : value);\n }\n }\n\n /**\n * Removes a header.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/delete)\n */\n delete(name: string): void {\n let key = name.toLowerCase();\n if (key === SetCookieKey) {\n this.#setCookies = [];\n } else {\n this.#map.delete(key);\n }\n }\n\n /**\n * Returns a string of all the values for a header, or `null` if the header does not exist.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/get)\n */\n get(name: string): string | null {\n let key = name.toLowerCase();\n if (key === SetCookieKey) {\n return this.getSetCookie().join(', ');\n } else {\n let value = this.#map.get(key);\n if (typeof value === 'string') {\n return value;\n } else if (value != null) {\n let str = value.toString();\n return str === '' ? null : str;\n } else {\n return null;\n }\n }\n }\n\n /**\n * Returns an array of all values associated with the `Set-Cookie` header. This is\n * useful when building headers for a HTTP response since multiple `Set-Cookie` headers\n * must be sent on separate lines.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/getSetCookie)\n */\n getSetCookie(): string[] {\n return this.#setCookies.map((v) => (typeof v === 'string' ? v : v.toString()));\n }\n\n /**\n * Returns `true` if the header is present in the list of headers.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/has)\n */\n has(name: string): boolean {\n let key = name.toLowerCase();\n return key === SetCookieKey ? this.#setCookies.length > 0 : this.get(key) != null;\n }\n\n /**\n * Sets a new value for the given header. If the header already exists, the new value\n * will replace the existing value.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/set)\n */\n set(name: string, value: string): void {\n let key = name.toLowerCase();\n if (key === SetCookieKey) {\n this.#setCookies = [value];\n } else {\n this.#map.set(key, value);\n }\n }\n\n /**\n * Returns an iterator of all header keys (lowercase).\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/keys)\n */\n *keys(): IterableIterator {\n for (let [key] of this) yield key;\n }\n\n /**\n * Returns an iterator of all header values.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/values)\n */\n *values(): IterableIterator {\n for (let [, value] of this) yield value;\n }\n\n /**\n * Returns an iterator of all header key/value pairs.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/entries)\n */\n *entries(): IterableIterator<[string, string]> {\n for (let [key] of this.#map) {\n let str = this.get(key);\n if (str) yield [key, str];\n }\n\n for (let value of this.getSetCookie()) {\n yield [SetCookieKey, value];\n }\n }\n\n [Symbol.iterator](): IterableIterator<[string, string]> {\n return this.entries();\n }\n\n /**\n * Invokes the `callback` for each header key/value pair.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/forEach)\n */\n forEach(\n callback: (value: string, key: string, headers: SuperHeaders) => void,\n thisArg?: any,\n ): void {\n for (let [key, value] of this) {\n callback.call(thisArg, value, key, this);\n }\n }\n\n /**\n * Returns a string representation of the headers suitable for use in a HTTP message.\n */\n toString(): string {\n let lines: string[] = [];\n\n for (let [key, value] of this) {\n lines.push(`${canonicalHeaderName(key)}: ${value}`);\n }\n\n return lines.join(CRLF);\n }\n\n // Header-specific getters and setters\n\n /**\n * The `Accept` header is used by clients to indicate the media types that are acceptable\n * in the response.\n *\n * [MDN `Accept` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2)\n */\n get accept(): Accept {\n return this.#getHeaderValue(AcceptKey, Accept);\n }\n\n set accept(value: string | AcceptInit | undefined | null) {\n this.#setHeaderValue(AcceptKey, Accept, value);\n }\n\n /**\n * The `Accept-Encoding` header contains information about the content encodings that the client\n * is willing to accept in the response.\n *\n * [MDN `Accept-Encoding` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.4)\n */\n get acceptEncoding(): AcceptEncoding {\n return this.#getHeaderValue(AcceptEncodingKey, AcceptEncoding);\n }\n\n set acceptEncoding(value: string | AcceptEncodingInit | undefined | null) {\n this.#setHeaderValue(AcceptEncodingKey, AcceptEncoding, value);\n }\n\n /**\n * The `Accept-Language` header contains information about preferred natural language for the\n * response.\n *\n * [MDN `Accept-Language` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.5)\n */\n get acceptLanguage(): AcceptLanguage {\n return this.#getHeaderValue(AcceptLanguageKey, AcceptLanguage);\n }\n\n set acceptLanguage(value: string | AcceptLanguageInit | undefined | null) {\n this.#setHeaderValue(AcceptLanguageKey, AcceptLanguage, value);\n }\n\n /**\n * The `Accept-Ranges` header indicates the server's acceptance of range requests.\n *\n * [MDN `Accept-Ranges` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Ranges)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7233#section-2.3)\n */\n get acceptRanges(): string | null {\n return this.#getStringValue(AcceptRangesKey);\n }\n\n set acceptRanges(value: string | undefined | null) {\n this.#setStringValue(AcceptRangesKey, value);\n }\n\n /**\n * The `Age` header contains the time in seconds an object was in a proxy cache.\n *\n * [MDN `Age` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Age)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7234#section-5.1)\n */\n get age(): number | null {\n return this.#getNumberValue(AgeKey);\n }\n\n set age(value: string | number | undefined | null) {\n this.#setNumberValue(AgeKey, value);\n }\n\n /**\n * The `Cache-Control` header contains directives for caching mechanisms in both requests and responses.\n *\n * [MDN `Cache-Control` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7234#section-5.2)\n */\n get cacheControl(): CacheControl {\n return this.#getHeaderValue(CacheControlKey, CacheControl);\n }\n\n set cacheControl(value: string | CacheControlInit | undefined | null) {\n this.#setHeaderValue(CacheControlKey, CacheControl, value);\n }\n\n /**\n * The `Connection` header controls whether the network connection stays open after the current\n * transaction finishes.\n *\n * [MDN `Connection` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7230#section-6.1)\n */\n get connection(): string | null {\n return this.#getStringValue(ConnectionKey);\n }\n\n set connection(value: string | undefined | null) {\n this.#setStringValue(ConnectionKey, value);\n }\n\n /**\n * The `Content-Disposition` header is a response-type header that describes how the payload is displayed.\n *\n * [MDN `Content-Disposition` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition)\n *\n * [RFC 6266](https://datatracker.ietf.org/doc/html/rfc6266)\n */\n get contentDisposition(): ContentDisposition {\n return this.#getHeaderValue(ContentDispositionKey, ContentDisposition);\n }\n\n set contentDisposition(value: string | ContentDispositionInit | undefined | null) {\n this.#setHeaderValue(ContentDispositionKey, ContentDisposition, value);\n }\n\n /**\n * The `Content-Encoding` header specifies the encoding of the resource.\n *\n * Note: If multiple encodings have been used, this value may be a comma-separated list. However, most often this\n * header will only contain a single value.\n *\n * [MDN `Content-Encoding` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding)\n *\n * [HTTP/1.1 Specification](https://httpwg.org/specs/rfc9110.html#field.content-encoding)\n */\n get contentEncoding(): string | null {\n return this.#getStringValue(ContentEncodingKey);\n }\n\n set contentEncoding(value: string | string[] | undefined | null) {\n this.#setStringValue(ContentEncodingKey, Array.isArray(value) ? value.join(', ') : value);\n }\n\n /**\n * The `Content-Language` header describes the natural language(s) of the intended audience for the response content.\n *\n * Note: If the response content is intended for multiple audiences, this value may be a comma-separated list. However,\n * most often this header will only contain a single value.\n *\n * [MDN `Content-Language` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Language)\n *\n * [HTTP/1.1 Specification](https://httpwg.org/specs/rfc9110.html#field.content-language)\n */\n get contentLanguage(): string | null {\n return this.#getStringValue(ContentLanguageKey);\n }\n\n set contentLanguage(value: string | string[] | undefined | null) {\n this.#setStringValue(ContentLanguageKey, Array.isArray(value) ? value.join(', ') : value);\n }\n\n /**\n * The `Content-Length` header indicates the size of the entity-body in bytes.\n *\n * [MDN `Content-Length` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2)\n */\n get contentLength(): number | null {\n return this.#getNumberValue(ContentLengthKey);\n }\n\n set contentLength(value: string | number | undefined | null) {\n this.#setNumberValue(ContentLengthKey, value);\n }\n\n /**\n * The `Content-Type` header indicates the media type of the resource.\n *\n * [MDN `Content-Type` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.1.5)\n */\n get contentType(): ContentType {\n return this.#getHeaderValue(ContentTypeKey, ContentType);\n }\n\n set contentType(value: string | ContentTypeInit | undefined | null) {\n this.#setHeaderValue(ContentTypeKey, ContentType, value);\n }\n\n /**\n * The `Cookie` request header contains stored HTTP cookies previously sent by the server with\n * the `Set-Cookie` header.\n *\n * [MDN `Cookie` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc6265#section-5.4)\n */\n get cookie(): Cookie {\n return this.#getHeaderValue(CookieKey, Cookie);\n }\n\n set cookie(value: string | CookieInit | undefined | null) {\n this.#setHeaderValue(CookieKey, Cookie, value);\n }\n\n /**\n * The `Date` header contains the date and time at which the message was sent.\n *\n * [MDN `Date` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Date)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.1.2)\n */\n get date(): Date | null {\n return this.#getDateValue(DateKey);\n }\n\n set date(value: string | DateInit | undefined | null) {\n this.#setDateValue(DateKey, value);\n }\n\n /**\n * The `ETag` header provides a unique identifier for the current version of the resource.\n *\n * [MDN `ETag` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7232#section-2.3)\n */\n get etag(): string | null {\n return this.#getStringValue(ETagKey);\n }\n\n set etag(value: string | undefined | null) {\n this.#setStringValue(ETagKey, typeof value === 'string' ? quoteEtag(value) : value);\n }\n\n /**\n * The `Expires` header contains the date/time after which the response is considered stale.\n *\n * [MDN `Expires` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7234#section-5.3)\n */\n get expires(): Date | null {\n return this.#getDateValue(ExpiresKey);\n }\n\n set expires(value: string | DateInit | undefined | null) {\n this.#setDateValue(ExpiresKey, value);\n }\n\n /**\n * The `Host` header specifies the domain name of the server and (optionally) the TCP port number.\n *\n * [MDN `Host` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7230#section-5.4)\n */\n get host(): string | null {\n return this.#getStringValue(HostKey);\n }\n\n set host(value: string | undefined | null) {\n this.#setStringValue(HostKey, value);\n }\n\n /**\n * The `If-Modified-Since` header makes a request conditional on the last modification date of the\n * requested resource.\n *\n * [MDN `If-Modified-Since` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7232#section-3.3)\n */\n get ifModifiedSince(): Date | null {\n return this.#getDateValue(IfModifiedSinceKey);\n }\n\n set ifModifiedSince(value: string | DateInit | undefined | null) {\n this.#setDateValue(IfModifiedSinceKey, value);\n }\n\n /**\n * The `If-None-Match` header makes a request conditional on the absence of a matching ETag.\n *\n * [MDN `If-None-Match` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7232#section-3.2)\n */\n get ifNoneMatch(): IfNoneMatch {\n return this.#getHeaderValue(IfNoneMatchKey, IfNoneMatch);\n }\n\n set ifNoneMatch(value: string | string[] | IfNoneMatchInit | undefined | null) {\n this.#setHeaderValue(IfNoneMatchKey, IfNoneMatch, value);\n }\n\n /**\n * The `If-Unmodified-Since` header makes a request conditional on the last modification date of the\n * requested resource.\n *\n * [MDN `If-Unmodified-Since` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7232#section-3.4)\n */\n get ifUnmodifiedSince(): Date | null {\n return this.#getDateValue(IfUnmodifiedSinceKey);\n }\n\n set ifUnmodifiedSince(value: string | DateInit | undefined | null) {\n this.#setDateValue(IfUnmodifiedSinceKey, value);\n }\n\n /**\n * The `Last-Modified` header contains the date and time at which the resource was last modified.\n *\n * [MDN `Last-Modified` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7232#section-2.2)\n */\n get lastModified(): Date | null {\n return this.#getDateValue(LastModifiedKey);\n }\n\n set lastModified(value: string | DateInit | undefined | null) {\n this.#setDateValue(LastModifiedKey, value);\n }\n\n /**\n * The `Location` header indicates the URL to redirect to.\n *\n * [MDN `Location` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.2)\n */\n get location(): string | null {\n return this.#getStringValue(LocationKey);\n }\n\n set location(value: string | undefined | null) {\n this.#setStringValue(LocationKey, value);\n }\n\n /**\n * The `Referer` header contains the address of the previous web page from which a link to the\n * currently requested page was followed.\n *\n * [MDN `Referer` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.5.2)\n */\n get referer(): string | null {\n return this.#getStringValue(RefererKey);\n }\n\n set referer(value: string | undefined | null) {\n this.#setStringValue(RefererKey, value);\n }\n\n /**\n * The `Set-Cookie` header is used to send cookies from the server to the user agent.\n *\n * [MDN `Set-Cookie` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1)\n */\n get setCookie(): SetCookie[] {\n let setCookies = this.#setCookies;\n\n for (let i = 0; i < setCookies.length; ++i) {\n if (typeof setCookies[i] === 'string') {\n setCookies[i] = new SetCookie(setCookies[i]);\n }\n }\n\n return setCookies as SetCookie[];\n }\n\n set setCookie(value: (string | SetCookieInit)[] | string | SetCookieInit | undefined | null) {\n if (value != null) {\n this.#setCookies = (Array.isArray(value) ? value : [value]).map((v) =>\n typeof v === 'string' ? v : new SetCookie(v),\n );\n } else {\n this.#setCookies = [];\n }\n }\n\n // Helpers\n\n #getHeaderValue(key: string, ctor: new (init?: any) => T): T {\n let value = this.#map.get(key);\n\n if (value !== undefined) {\n if (typeof value === 'string') {\n let obj = new ctor(value);\n this.#map.set(key, obj); // cache the new object\n return obj;\n } else {\n return value as T;\n }\n }\n\n let obj = new ctor();\n this.#map.set(key, obj); // cache the new object\n return obj;\n }\n\n #setHeaderValue(key: string, ctor: new (init?: string) => HeaderValue, value: any): void {\n if (value != null) {\n this.#map.set(key, typeof value === 'string' ? value : new ctor(value));\n } else {\n this.#map.delete(key);\n }\n }\n\n #getDateValue(key: string): Date | null {\n let value = this.#map.get(key);\n return value === undefined ? null : new Date(value as string);\n }\n\n #setDateValue(key: string, value: string | DateInit | undefined | null): void {\n if (value != null) {\n this.#map.set(\n key,\n typeof value === 'string'\n ? value\n : (typeof value === 'number' ? new Date(value) : value).toUTCString(),\n );\n } else {\n this.#map.delete(key);\n }\n }\n\n #getNumberValue(key: string): number | null {\n let value = this.#map.get(key);\n return value === undefined ? null : parseInt(value as string, 10);\n }\n\n #setNumberValue(key: string, value: string | number | undefined | null): void {\n if (value != null) {\n this.#map.set(key, typeof value === 'string' ? value : value.toString());\n } else {\n this.#map.delete(key);\n }\n }\n\n #getStringValue(key: string): string | null {\n let value = this.#map.get(key);\n return value === undefined ? null : (value as string);\n }\n\n #setStringValue(key: string, value: string | undefined | null): void {\n if (value != null) {\n this.#map.set(key, value);\n } else {\n this.#map.delete(key);\n }\n }\n}\n", "// We need this little helper for environments that do not support\n// ReadableStream.prototype[Symbol.asyncIterator] yet. See #46\nexport async function* readStream(stream: ReadableStream): AsyncIterable {\n let reader = stream.getReader();\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n yield value;\n }\n } finally {\n reader.releaseLock();\n }\n}\n", "export interface SearchFunction {\n (haystack: Uint8Array, start?: number): number;\n}\n\nexport function createSearch(pattern: string): SearchFunction {\n let needle = new TextEncoder().encode(pattern);\n\n let search: SearchFunction;\n if ('Buffer' in globalThis && !('Bun' in globalThis || 'Deno' in globalThis)) {\n // Use the built-in Buffer.indexOf method on Node.js for better perf.\n search = (haystack, start = 0) => Buffer.prototype.indexOf.call(haystack, needle, start);\n } else {\n let needleEnd = needle.length - 1;\n let skipTable = new Uint8Array(256).fill(needle.length);\n for (let i = 0; i < needleEnd; ++i) {\n skipTable[needle[i]] = needleEnd - i;\n }\n\n search = (haystack, start = 0) => {\n let haystackLength = haystack.length;\n let i = start + needleEnd;\n\n while (i < haystackLength) {\n for (let j = needleEnd, k = i; j >= 0 && haystack[k] === needle[j]; --j, --k) {\n if (j === 0) return k;\n }\n\n i += skipTable[haystack[i]];\n }\n\n return -1;\n };\n }\n\n return search;\n}\n\nexport interface PartialTailSearchFunction {\n (haystack: Uint8Array): number;\n}\n\nexport function createPartialTailSearch(pattern: string): PartialTailSearchFunction {\n let needle = new TextEncoder().encode(pattern);\n\n let byteIndexes: Record = {};\n for (let i = 0; i < needle.length; ++i) {\n let byte = needle[i];\n if (byteIndexes[byte] === undefined) byteIndexes[byte] = [];\n byteIndexes[byte].push(i);\n }\n\n return function (haystack: Uint8Array): number {\n let haystackEnd = haystack.length - 1;\n\n if (haystack[haystackEnd] in byteIndexes) {\n let indexes = byteIndexes[haystack[haystackEnd]];\n\n for (let i = indexes.length - 1; i >= 0; --i) {\n for (let j = indexes[i], k = haystackEnd; j >= 0 && haystack[k] === needle[j]; --j, --k) {\n if (j === 0) return k;\n }\n }\n }\n\n return -1;\n };\n}\n", "import Headers from '@mjackson/headers';\n\nimport { readStream } from './read-stream.ts';\nimport type { SearchFunction, PartialTailSearchFunction } from './buffer-search.ts';\nimport { createSearch, createPartialTailSearch } from './buffer-search.ts';\n\n/**\n * The base class for errors thrown by the multipart parser.\n */\nexport class MultipartParseError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'MultipartParseError';\n }\n}\n\n/**\n * An error thrown when the maximum allowed size of a header is exceeded.\n */\nexport class MaxHeaderSizeExceededError extends MultipartParseError {\n constructor(maxHeaderSize: number) {\n super(`Multipart header size exceeds maximum allowed size of ${maxHeaderSize} bytes`);\n this.name = 'MaxHeaderSizeExceededError';\n }\n}\n\n/**\n * An error thrown when the maximum allowed size of a file is exceeded.\n */\nexport class MaxFileSizeExceededError extends MultipartParseError {\n constructor(maxFileSize: number) {\n super(`File size exceeds maximum allowed size of ${maxFileSize} bytes`);\n this.name = 'MaxFileSizeExceededError';\n }\n}\n\nexport interface ParseMultipartOptions {\n /**\n * The boundary string used to separate parts in the multipart message,\n * e.g. the `boundary` parameter in the `Content-Type` header.\n */\n boundary: string;\n /**\n * The maximum allowed size of a header in bytes. If an individual part's header\n * exceeds this size, a `MaxHeaderSizeExceededError` will be thrown.\n *\n * Default: 8 KiB\n */\n maxHeaderSize?: number;\n /**\n * The maximum allowed size of a file in bytes. If an individual part's content\n * exceeds this size, a `MaxFileSizeExceededError` will be thrown.\n *\n * Default: 2 MiB\n */\n maxFileSize?: number;\n}\n\n/**\n * Parse a `multipart/*` message from a buffer/iterable and yield each part as a `MultipartPart` object.\n *\n * Note: This is a low-level API that requires manual handling of the content and boundary. If you're\n * building a web server, consider using `parseMultipartRequest(request)` instead.\n *\n * @param message The multipart message as a `Uint8Array` or an iterable of `Uint8Array` chunks\n * @param options Options for the parser\n * @return A generator that yields `MultipartPart` objects\n */\nexport function* parseMultipart(\n message: Uint8Array | Iterable,\n options: ParseMultipartOptions,\n): Generator {\n let parser = new MultipartParser(options.boundary, {\n maxHeaderSize: options.maxHeaderSize,\n maxFileSize: options.maxFileSize,\n });\n\n if (message instanceof Uint8Array) {\n if (message.length === 0) {\n return; // No data to parse\n }\n\n yield* parser.write(message);\n } else {\n for (let chunk of message) {\n yield* parser.write(chunk);\n }\n }\n\n parser.finish();\n}\n\n/**\n * Parse a `multipart/*` message stream and yield each part as a `MultipartPart` object.\n *\n * Note: This is a low-level API that requires manual handling of the content and boundary. If you're\n * building a web server, consider using `parseMultipartRequest(request)` instead.\n *\n * @param stream A stream containing multipart data as a `ReadableStream`\n * @param options Options for the parser\n * @return An async generator that yields `MultipartPart` objects\n */\nexport async function* parseMultipartStream(\n stream: ReadableStream,\n options: ParseMultipartOptions,\n): AsyncGenerator {\n let parser = new MultipartParser(options.boundary, {\n maxHeaderSize: options.maxHeaderSize,\n maxFileSize: options.maxFileSize,\n });\n\n for await (let chunk of readStream(stream)) {\n if (chunk.length === 0) {\n continue; // No data to parse\n }\n\n yield* parser.write(chunk);\n }\n\n parser.finish();\n}\n\nexport type MultipartParserOptions = Omit;\n\nconst MultipartParserStateStart = 0;\nconst MultipartParserStateAfterBoundary = 1;\nconst MultipartParserStateHeader = 2;\nconst MultipartParserStateBody = 3;\nconst MultipartParserStateDone = 4;\n\nconst findDoubleNewline = createSearch('\\r\\n\\r\\n');\n\nconst oneKb = 1024;\nconst oneMb = 1024 * oneKb;\n\n/**\n * A streaming parser for `multipart/*` HTTP messages.\n */\nexport class MultipartParser {\n readonly boundary: string;\n readonly maxHeaderSize: number;\n readonly maxFileSize: number;\n\n #findOpeningBoundary: SearchFunction;\n #openingBoundaryLength: number;\n #findBoundary: SearchFunction;\n #findPartialTailBoundary: PartialTailSearchFunction;\n #boundaryLength: number;\n\n #state = MultipartParserStateStart;\n #buffer: Uint8Array | null = null;\n #currentPart: MultipartPart | null = null;\n #contentLength = 0;\n\n constructor(boundary: string, options?: MultipartParserOptions) {\n this.boundary = boundary;\n this.maxHeaderSize = options?.maxHeaderSize ?? 8 * oneKb;\n this.maxFileSize = options?.maxFileSize ?? 2 * oneMb;\n\n this.#findOpeningBoundary = createSearch(`--${boundary}`);\n this.#openingBoundaryLength = 2 + boundary.length; // length of '--' + boundary\n this.#findBoundary = createSearch(`\\r\\n--${boundary}`);\n this.#findPartialTailBoundary = createPartialTailSearch(`\\r\\n--${boundary}`);\n this.#boundaryLength = 4 + boundary.length; // length of '\\r\\n--' + boundary\n }\n\n /**\n * Write a chunk of data to the parser.\n *\n * @param chunk A chunk of data to write to the parser\n * @return A generator yielding `MultipartPart` objects as they are parsed\n */\n *write(chunk: Uint8Array): Generator {\n if (this.#state === MultipartParserStateDone) {\n throw new MultipartParseError('Unexpected data after end of stream');\n }\n\n let index = 0;\n let chunkLength = chunk.length;\n\n if (this.#buffer !== null) {\n let newChunk = new Uint8Array(this.#buffer.length + chunkLength);\n newChunk.set(this.#buffer, 0);\n newChunk.set(chunk, this.#buffer.length);\n chunk = newChunk;\n chunkLength = chunk.length;\n this.#buffer = null;\n }\n\n while (true) {\n if (this.#state === MultipartParserStateBody) {\n if (chunkLength - index < this.#boundaryLength) {\n this.#buffer = chunk.subarray(index);\n break;\n }\n\n let boundaryIndex = this.#findBoundary(chunk, index);\n\n if (boundaryIndex === -1) {\n // No boundary found, but there may be a partial match at the end of the chunk.\n let partialTailIndex = this.#findPartialTailBoundary(chunk);\n\n if (partialTailIndex === -1) {\n this.#append(index === 0 ? chunk : chunk.subarray(index));\n } else {\n this.#append(chunk.subarray(index, partialTailIndex));\n this.#buffer = chunk.subarray(partialTailIndex);\n }\n\n break;\n }\n\n this.#append(chunk.subarray(index, boundaryIndex));\n\n yield this.#currentPart!;\n\n index = boundaryIndex + this.#boundaryLength;\n\n this.#state = MultipartParserStateAfterBoundary;\n }\n\n if (this.#state === MultipartParserStateAfterBoundary) {\n if (chunkLength - index < 2) {\n this.#buffer = chunk.subarray(index);\n break;\n }\n\n if (chunk[index] === 45 && chunk[index + 1] === 45) {\n this.#state = MultipartParserStateDone;\n break;\n }\n\n index += 2; // Skip \\r\\n after boundary\n\n this.#state = MultipartParserStateHeader;\n }\n\n if (this.#state === MultipartParserStateHeader) {\n if (chunkLength - index < 4) {\n this.#buffer = chunk.subarray(index);\n break;\n }\n\n let headerEndIndex = findDoubleNewline(chunk, index);\n\n if (headerEndIndex === -1) {\n if (chunkLength - index > this.maxHeaderSize) {\n throw new MaxHeaderSizeExceededError(this.maxHeaderSize);\n }\n\n this.#buffer = chunk.subarray(index);\n break;\n }\n\n if (headerEndIndex - index > this.maxHeaderSize) {\n throw new MaxHeaderSizeExceededError(this.maxHeaderSize);\n }\n\n this.#currentPart = new MultipartPart(chunk.subarray(index, headerEndIndex), []);\n this.#contentLength = 0;\n\n index = headerEndIndex + 4; // Skip header + \\r\\n\\r\\n\n\n this.#state = MultipartParserStateBody;\n\n continue;\n }\n\n if (this.#state === MultipartParserStateStart) {\n if (chunkLength < this.#openingBoundaryLength) {\n this.#buffer = chunk;\n break;\n }\n\n if (this.#findOpeningBoundary(chunk) !== 0) {\n throw new MultipartParseError('Invalid multipart stream: missing initial boundary');\n }\n\n index = this.#openingBoundaryLength;\n\n this.#state = MultipartParserStateAfterBoundary;\n }\n }\n }\n\n #append(chunk: Uint8Array): void {\n if (this.#contentLength + chunk.length > this.maxFileSize) {\n throw new MaxFileSizeExceededError(this.maxFileSize);\n }\n\n this.#currentPart!.content.push(chunk);\n this.#contentLength += chunk.length;\n }\n\n /**\n * Should be called after all data has been written to the parser.\n *\n * Note: This will throw if the multipart message is incomplete or\n * wasn't properly terminated.\n *\n * @return void\n */\n finish(): void {\n if (this.#state !== MultipartParserStateDone) {\n throw new MultipartParseError('Multipart stream not finished');\n }\n }\n}\n\nconst decoder = new TextDecoder('utf-8', { fatal: true });\n\n/**\n * A part of a `multipart/*` HTTP message.\n */\nexport class MultipartPart {\n /**\n * The raw content of this part as an array of `Uint8Array` chunks.\n */\n readonly content: Uint8Array[];\n\n #header: Uint8Array;\n #headers?: Headers;\n\n constructor(header: Uint8Array, content: Uint8Array[]) {\n this.#header = header;\n this.content = content;\n }\n\n /**\n * The content of this part as an `ArrayBuffer`.\n */\n get arrayBuffer(): ArrayBuffer {\n return this.bytes.buffer as ArrayBuffer;\n }\n\n /**\n * The content of this part as a single `Uint8Array`. In `multipart/form-data` messages, this is useful\n * for reading the value of files that were uploaded using `` fields.\n */\n get bytes(): Uint8Array {\n let buffer = new Uint8Array(this.size);\n\n let offset = 0;\n for (let chunk of this.content) {\n buffer.set(chunk, offset);\n offset += chunk.length;\n }\n\n return buffer;\n }\n\n /**\n * The headers associated with this part.\n */\n get headers(): Headers {\n if (!this.#headers) {\n this.#headers = new Headers(decoder.decode(this.#header));\n }\n\n return this.#headers;\n }\n\n /**\n * True if this part originated from a file upload.\n */\n get isFile(): boolean {\n return this.filename !== undefined || this.mediaType === 'application/octet-stream';\n }\n\n /**\n * True if this part originated from a text input field in a form submission.\n */\n get isText(): boolean {\n return !this.isFile;\n }\n\n /**\n * The filename of the part, if it is a file upload.\n */\n get filename(): string | undefined {\n return this.headers.contentDisposition.preferredFilename;\n }\n\n /**\n * The media type of the part.\n */\n get mediaType(): string | undefined {\n return this.headers.contentType.mediaType;\n }\n\n /**\n * The name of the part, usually the `name` of the field in the `
` that submitted the request.\n */\n get name(): string | undefined {\n return this.headers.contentDisposition.name;\n }\n\n /**\n * The size of the content in bytes.\n */\n get size(): number {\n let size = 0;\n\n for (let chunk of this.content) {\n size += chunk.length;\n }\n\n return size;\n }\n\n /**\n * The content of this part as a string. In `multipart/form-data` messages, this is useful for\n * reading the value of parts that originated from `` fields.\n *\n * Note: Do not use this for binary data, use `part.bytes` or `part.arrayBuffer` instead.\n */\n get text(): string {\n return decoder.decode(this.bytes);\n }\n}\n", "import type { MultipartParserOptions, MultipartPart } from './multipart.ts';\nimport { MultipartParseError, parseMultipartStream } from './multipart.ts';\n\n/**\n * Extracts the boundary string from a `multipart/*` content type.\n *\n * @param contentType The `Content-Type` header value from the request\n * @return The boundary string if found, or null if not present\n */\nexport function getMultipartBoundary(contentType: string): string | null {\n let match = /boundary=(?:\"([^\"]+)\"|([^;]+))/i.exec(contentType);\n return match ? (match[1] ?? match[2]) : null;\n}\n\n/**\n * Returns true if the given request contains multipart data.\n *\n * @param request The `Request` object to check\n * @return `true` if the request is a multipart request, `false` otherwise\n */\nexport function isMultipartRequest(request: Request): boolean {\n let contentType = request.headers.get('Content-Type');\n return contentType != null && contentType.startsWith('multipart/');\n}\n\n/**\n * Parse a multipart [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) and yield each part as\n * a `MultipartPart` object. Useful in HTTP server contexts for handling incoming `multipart/*` requests.\n *\n * @param request The `Request` object containing multipart data\n * @param options Optional parser options, such as `maxHeaderSize` and `maxFileSize`\n * @return An async generator yielding `MultipartPart` objects\n */\nexport async function* parseMultipartRequest(\n request: Request,\n options?: MultipartParserOptions,\n): AsyncGenerator {\n if (!isMultipartRequest(request)) {\n throw new MultipartParseError('Request is not a multipart request');\n }\n if (!request.body) {\n throw new MultipartParseError('Request body is empty');\n }\n\n let boundary = getMultipartBoundary(request.headers.get('Content-Type')!);\n if (!boundary) {\n throw new MultipartParseError('Invalid Content-Type header: missing boundary');\n }\n\n yield* parseMultipartStream(request.body, {\n boundary,\n maxHeaderSize: options?.maxHeaderSize,\n maxFileSize: options?.maxFileSize,\n });\n}\n", "import type * as http from 'node:http';\nimport { Readable } from 'node:stream';\n\nimport type { ParseMultipartOptions, MultipartParserOptions, MultipartPart } from './multipart.ts';\nimport {\n MultipartParseError,\n parseMultipart as parseMultipartWeb,\n parseMultipartStream as parseMultipartStreamWeb,\n} from './multipart.ts';\nimport { getMultipartBoundary } from './multipart-request.ts';\n\n/**\n * Parse a `multipart/*` Node.js `Buffer` and yield each part as a `MultipartPart` object.\n *\n * Note: This is a low-level API that requires manual handling of the content and boundary. If you're\n * building a web server, consider using `parseMultipartRequest(request)` instead.\n *\n * @param message The multipart message as a `Buffer` or an iterable of `Buffer` chunks\n * @param options Options for the parser\n * @return A generator yielding `MultipartPart` objects\n */\nexport function* parseMultipart(\n message: Buffer | Iterable,\n options: ParseMultipartOptions,\n): Generator {\n yield* parseMultipartWeb(message as Uint8Array | Iterable, options);\n}\n\n/**\n * Parse a `multipart/*` Node.js `Readable` stream and yield each part as a `MultipartPart` object.\n *\n * Note: This is a low-level API that requires manual handling of the stream and boundary. If you're\n * building a web server, consider using `parseMultipartRequest(request)` instead.\n *\n * @param stream A Node.js `Readable` stream containing multipart data\n * @param options Options for the parser\n * @return An async generator yielding `MultipartPart` objects\n */\nexport async function* parseMultipartStream(\n stream: Readable,\n options: ParseMultipartOptions,\n): AsyncGenerator {\n yield* parseMultipartStreamWeb(Readable.toWeb(stream) as ReadableStream, options);\n}\n\n/**\n * Returns true if the given request is a multipart request.\n *\n * @param req The Node.js `http.IncomingMessage` object to check\n * @return `true` if the request is a multipart request, `false` otherwise\n */\nexport function isMultipartRequest(req: http.IncomingMessage): boolean {\n let contentType = req.headers['content-type'];\n return contentType != null && /^multipart\\//i.test(contentType);\n}\n\n/**\n * Parse a multipart Node.js request and yield each part as a `MultipartPart` object.\n *\n * @param req The Node.js `http.IncomingMessage` object containing multipart data\n * @param options Options for the parser\n * @return An async generator yielding `MultipartPart` objects\n */\nexport async function* parseMultipartRequest(\n req: http.IncomingMessage,\n options?: MultipartParserOptions,\n): AsyncGenerator {\n if (!isMultipartRequest(req)) {\n throw new MultipartParseError('Request is not a multipart request');\n }\n\n let boundary = getMultipartBoundary(req.headers['content-type']!);\n if (!boundary) {\n throw new MultipartParseError('Invalid Content-Type header: missing boundary');\n }\n\n yield* parseMultipartStream(req, {\n boundary,\n maxHeaderSize: options?.maxHeaderSize,\n maxFileSize: options?.maxFileSize,\n });\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAAA;AAAA,EAAA;AAAA,8BAAAC;AAAA;AAAA;;;ACAO,SAAS,YACd,OACA,YAAuB,KACS;AAGhC,MAAI,SACF,cAAc,MACV,6EACA;AAEN,MAAI,SAAyC,CAAC;AAE9C,MAAI;AACJ,UAAQ,QAAQ,OAAO,KAAK,KAAK,OAAO,MAAM;AAC5C,QAAI,MAAM,MAAM,CAAC,EAAE,KAAK;AAExB,QAAI;AACJ,QAAI,MAAM,CAAC,GAAG;AACZ,eAAS,MAAM,CAAC,KAAK,MAAM,CAAC,KAAK,IAAI,QAAQ,UAAU,IAAI,EAAE,KAAK;I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