next-rest-framework
Version:
Next REST Framework - Type-safe, self-documenting APIs for Next.js
1,302 lines (1,281 loc) • 777 kB
JavaScript
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export2 = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// package.json
var require_package = __commonJS({
"package.json"(exports2, module2) {
module2.exports = {
name: "next-rest-framework",
version: "6.1.1",
description: "Next REST Framework - Type-safe, self-documenting APIs for Next.js",
keywords: [
"nextjs",
"rest",
"api",
"next-rest-framework"
],
homepage: "https://next-rest-framework.vercel.app",
bugs: {
url: "https://github.com/blomqma/next-rest-framework/issues",
email: "blomqma@omg.lol"
},
license: "ISC",
author: "Markus Blomqvist <blomqma@omg.lol>",
files: [
"dist"
],
main: "dist/index.js",
module: "dist/index.mjs",
types: "dist/index.d.ts",
repository: {
type: "git",
url: "https://github.com/blomqma/next-rest-framework.git",
directory: "packages/next-rest-framework"
},
scripts: {
lint: "tsc",
test: "jest",
"test:watch": "jest --watch",
build: "tsup --dts"
},
bin: {
"next-rest-framework": "./dist/cli/index.js"
},
dependencies: {
chalk: "4.1.2",
commander: "10.0.1",
formidable: "^3.5.1",
lodash: "4.17.21",
prettier: "3.0.2",
qs: "6.14.1"
},
devDependencies: {
"@types/formidable": "^3.4.5",
"@types/jest": "29.5.4",
"@types/lodash": "4.14.197",
"@types/qs": "6.9.11",
esbuild: "0.19.11",
jest: "29.6.4",
next: "*",
"node-mocks-http": "1.13.0",
"openapi-types": "12.1.3",
"ts-jest": "29.1.1",
"ts-node": "10.9.1",
tsup: "8.0.1",
typescript: "*",
zod: "^4.1.13",
"zod-form-data": "3.0.1"
}
};
}
});
// src/shared/form-data.ts
var form_data_exports = {};
__export2(form_data_exports, {
parseMultiPartFormData: () => parseMultiPartFormData
});
var import_formidable, import_fs, parseMultiPartFormData;
var init_form_data = __esm({
"src/shared/form-data.ts"() {
"use strict";
import_formidable = require("formidable");
import_fs = require("fs");
parseMultiPartFormData = async (req) => await new Promise((resolve, reject) => {
const form = new import_formidable.Formidable();
setTimeout(() => {
reject(new Error("Form parsing timeout."));
}, 1e4);
form.parse(req, (err, fields, files) => {
if (err) {
reject(err);
return;
}
const formData = new FormData();
Object.entries(fields).forEach(([key, value]) => {
if (value?.[0]) {
formData.append(key, value[0]);
}
});
Object.entries(files).forEach(([key, fileArray]) => {
if (fileArray && fileArray.length > 0) {
fileArray.forEach((file2) => {
const fileContent = (0, import_fs.readFileSync)(file2.filepath);
const blob = new Blob([fileContent], {
type: file2.mimetype ?? ""
});
formData.append(key, blob, file2.originalFilename ?? "");
});
}
});
resolve(formData);
});
});
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/i18n/detect-domain-locale.js
var require_detect_domain_locale = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/i18n/detect-domain-locale.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
Object.defineProperty(exports2, "detectDomainLocale", {
enumerable: true,
get: function() {
return detectDomainLocale;
}
});
function detectDomainLocale(domainItems, hostname3, detectedLocale) {
if (!domainItems)
return;
if (detectedLocale) {
detectedLocale = detectedLocale.toLowerCase();
}
for (const item of domainItems) {
var _item_domain, _item_locales;
const domainHostname = (_item_domain = item.domain) == null ? void 0 : _item_domain.split(":", 1)[0].toLowerCase();
if (hostname3 === domainHostname || detectedLocale === item.defaultLocale.toLowerCase() || ((_item_locales = item.locales) == null ? void 0 : _item_locales.some((locale) => locale.toLowerCase() === detectedLocale))) {
return item;
}
}
}
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js
var require_remove_trailing_slash = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
Object.defineProperty(exports2, "removeTrailingSlash", {
enumerable: true,
get: function() {
return removeTrailingSlash;
}
});
function removeTrailingSlash(route2) {
return route2.replace(/\/$/, "") || "/";
}
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/parse-path.js
var require_parse_path = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/parse-path.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
Object.defineProperty(exports2, "parsePath", {
enumerable: true,
get: function() {
return parsePath;
}
});
function parsePath(path) {
const hashIndex = path.indexOf("#");
const queryIndex = path.indexOf("?");
const hasQuery = queryIndex > -1 && (hashIndex < 0 || queryIndex < hashIndex);
if (hasQuery || hashIndex > -1) {
return {
pathname: path.substring(0, hasQuery ? queryIndex : hashIndex),
query: hasQuery ? path.substring(queryIndex, hashIndex > -1 ? hashIndex : void 0) : "",
hash: hashIndex > -1 ? path.slice(hashIndex) : ""
};
}
return {
pathname: path,
query: "",
hash: ""
};
}
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/add-path-prefix.js
var require_add_path_prefix = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/add-path-prefix.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
Object.defineProperty(exports2, "addPathPrefix", {
enumerable: true,
get: function() {
return addPathPrefix;
}
});
var _parsepath = require_parse_path();
function addPathPrefix(path, prefix) {
if (!path.startsWith("/") || !prefix) {
return path;
}
const { pathname, query, hash: hash2 } = (0, _parsepath.parsePath)(path);
return "" + prefix + pathname + query + hash2;
}
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/add-path-suffix.js
var require_add_path_suffix = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/add-path-suffix.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
Object.defineProperty(exports2, "addPathSuffix", {
enumerable: true,
get: function() {
return addPathSuffix;
}
});
var _parsepath = require_parse_path();
function addPathSuffix(path, suffix) {
if (!path.startsWith("/") || !suffix) {
return path;
}
const { pathname, query, hash: hash2 } = (0, _parsepath.parsePath)(path);
return "" + pathname + suffix + query + hash2;
}
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/path-has-prefix.js
var require_path_has_prefix = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/path-has-prefix.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
Object.defineProperty(exports2, "pathHasPrefix", {
enumerable: true,
get: function() {
return pathHasPrefix;
}
});
var _parsepath = require_parse_path();
function pathHasPrefix(path, prefix) {
if (typeof path !== "string") {
return false;
}
const { pathname } = (0, _parsepath.parsePath)(path);
return pathname === prefix || pathname.startsWith(prefix + "/");
}
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/add-locale.js
var require_add_locale = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/add-locale.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
Object.defineProperty(exports2, "addLocale", {
enumerable: true,
get: function() {
return addLocale;
}
});
var _addpathprefix = require_add_path_prefix();
var _pathhasprefix = require_path_has_prefix();
function addLocale(path, locale, defaultLocale, ignorePrefix) {
if (!locale || locale === defaultLocale)
return path;
const lower = path.toLowerCase();
if (!ignorePrefix) {
if ((0, _pathhasprefix.pathHasPrefix)(lower, "/api"))
return path;
if ((0, _pathhasprefix.pathHasPrefix)(lower, "/" + locale.toLowerCase()))
return path;
}
return (0, _addpathprefix.addPathPrefix)(path, "/" + locale);
}
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.js
var require_format_next_pathname_info = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
Object.defineProperty(exports2, "formatNextPathnameInfo", {
enumerable: true,
get: function() {
return formatNextPathnameInfo;
}
});
var _removetrailingslash = require_remove_trailing_slash();
var _addpathprefix = require_add_path_prefix();
var _addpathsuffix = require_add_path_suffix();
var _addlocale = require_add_locale();
function formatNextPathnameInfo(info) {
let pathname = (0, _addlocale.addLocale)(info.pathname, info.locale, info.buildId ? void 0 : info.defaultLocale, info.ignorePrefix);
if (info.buildId || !info.trailingSlash) {
pathname = (0, _removetrailingslash.removeTrailingSlash)(pathname);
}
if (info.buildId) {
pathname = (0, _addpathsuffix.addPathSuffix)((0, _addpathprefix.addPathPrefix)(pathname, "/_next/data/" + info.buildId), info.pathname === "/" ? "index.json" : ".json");
}
pathname = (0, _addpathprefix.addPathPrefix)(pathname, info.basePath);
return !info.buildId && info.trailingSlash ? !pathname.endsWith("/") ? (0, _addpathsuffix.addPathSuffix)(pathname, "/") : pathname : (0, _removetrailingslash.removeTrailingSlash)(pathname);
}
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/get-hostname.js
var require_get_hostname = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/get-hostname.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
Object.defineProperty(exports2, "getHostname", {
enumerable: true,
get: function() {
return getHostname;
}
});
function getHostname(parsed, headers) {
let hostname3;
if ((headers == null ? void 0 : headers.host) && !Array.isArray(headers.host)) {
hostname3 = headers.host.toString().split(":", 1)[0];
} else if (parsed.hostname) {
hostname3 = parsed.hostname;
} else
return;
return hostname3.toLowerCase();
}
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/i18n/normalize-locale-path.js
var require_normalize_locale_path = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/i18n/normalize-locale-path.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
Object.defineProperty(exports2, "normalizeLocalePath", {
enumerable: true,
get: function() {
return normalizeLocalePath;
}
});
var cache = /* @__PURE__ */ new WeakMap();
function normalizeLocalePath(pathname, locales) {
if (!locales)
return {
pathname
};
let lowercasedLocales = cache.get(locales);
if (!lowercasedLocales) {
lowercasedLocales = locales.map((locale) => locale.toLowerCase());
cache.set(locales, lowercasedLocales);
}
let detectedLocale;
const segments = pathname.split("/", 2);
if (!segments[1])
return {
pathname
};
const segment = segments[1].toLowerCase();
const index = lowercasedLocales.indexOf(segment);
if (index < 0)
return {
pathname
};
detectedLocale = locales[index];
pathname = pathname.slice(detectedLocale.length + 1) || "/";
return {
pathname,
detectedLocale
};
}
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.js
var require_remove_path_prefix = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
Object.defineProperty(exports2, "removePathPrefix", {
enumerable: true,
get: function() {
return removePathPrefix;
}
});
var _pathhasprefix = require_path_has_prefix();
function removePathPrefix(path, prefix) {
if (!(0, _pathhasprefix.pathHasPrefix)(path, prefix)) {
return path;
}
const withoutPrefix = path.slice(prefix.length);
if (withoutPrefix.startsWith("/")) {
return withoutPrefix;
}
return "/" + withoutPrefix;
}
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.js
var require_get_next_pathname_info = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
Object.defineProperty(exports2, "getNextPathnameInfo", {
enumerable: true,
get: function() {
return getNextPathnameInfo;
}
});
var _normalizelocalepath = require_normalize_locale_path();
var _removepathprefix = require_remove_path_prefix();
var _pathhasprefix = require_path_has_prefix();
function getNextPathnameInfo(pathname, options) {
var _options_nextConfig;
const { basePath, i18n, trailingSlash } = (_options_nextConfig = options.nextConfig) != null ? _options_nextConfig : {};
const info = {
pathname,
trailingSlash: pathname !== "/" ? pathname.endsWith("/") : trailingSlash
};
if (basePath && (0, _pathhasprefix.pathHasPrefix)(info.pathname, basePath)) {
info.pathname = (0, _removepathprefix.removePathPrefix)(info.pathname, basePath);
info.basePath = basePath;
}
let pathnameNoDataPrefix = info.pathname;
if (info.pathname.startsWith("/_next/data/") && info.pathname.endsWith(".json")) {
const paths = info.pathname.replace(/^\/_next\/data\//, "").replace(/\.json$/, "").split("/");
const buildId = paths[0];
info.buildId = buildId;
pathnameNoDataPrefix = paths[1] !== "index" ? "/" + paths.slice(1).join("/") : "/";
if (options.parseData === true) {
info.pathname = pathnameNoDataPrefix;
}
}
if (i18n) {
let result = options.i18nProvider ? options.i18nProvider.analyze(info.pathname) : (0, _normalizelocalepath.normalizeLocalePath)(info.pathname, i18n.locales);
info.locale = result.detectedLocale;
var _result_pathname;
info.pathname = (_result_pathname = result.pathname) != null ? _result_pathname : info.pathname;
if (!result.detectedLocale && info.buildId) {
result = options.i18nProvider ? options.i18nProvider.analyze(pathnameNoDataPrefix) : (0, _normalizelocalepath.normalizeLocalePath)(pathnameNoDataPrefix, i18n.locales);
if (result.detectedLocale) {
info.locale = result.detectedLocale;
}
}
}
return info;
}
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/server/web/next-url.js
var require_next_url = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/server/web/next-url.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
Object.defineProperty(exports2, "NextURL", {
enumerable: true,
get: function() {
return NextURL;
}
});
var _detectdomainlocale = require_detect_domain_locale();
var _formatnextpathnameinfo = require_format_next_pathname_info();
var _gethostname = require_get_hostname();
var _getnextpathnameinfo = require_get_next_pathname_info();
var REGEX_LOCALHOST_HOSTNAME = /(?!^https?:\/\/)(127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|\[::1\]|localhost)/;
function parseURL(url2, base) {
return new URL(String(url2).replace(REGEX_LOCALHOST_HOSTNAME, "localhost"), base && String(base).replace(REGEX_LOCALHOST_HOSTNAME, "localhost"));
}
var Internal = Symbol("NextURLInternal");
var NextURL = class _NextURL {
constructor(input, baseOrOpts, opts) {
let base;
let options;
if (typeof baseOrOpts === "object" && "pathname" in baseOrOpts || typeof baseOrOpts === "string") {
base = baseOrOpts;
options = opts || {};
} else {
options = opts || baseOrOpts || {};
}
this[Internal] = {
url: parseURL(input, base ?? options.base),
options,
basePath: ""
};
this.analyze();
}
analyze() {
var _this_Internal_options_nextConfig_i18n, _this_Internal_options_nextConfig, _this_Internal_domainLocale, _this_Internal_options_nextConfig_i18n1, _this_Internal_options_nextConfig1;
const info = (0, _getnextpathnameinfo.getNextPathnameInfo)(this[Internal].url.pathname, {
nextConfig: this[Internal].options.nextConfig,
parseData: !process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE,
i18nProvider: this[Internal].options.i18nProvider
});
const hostname3 = (0, _gethostname.getHostname)(this[Internal].url, this[Internal].options.headers);
this[Internal].domainLocale = this[Internal].options.i18nProvider ? this[Internal].options.i18nProvider.detectDomainLocale(hostname3) : (0, _detectdomainlocale.detectDomainLocale)((_this_Internal_options_nextConfig = this[Internal].options.nextConfig) == null ? void 0 : (_this_Internal_options_nextConfig_i18n = _this_Internal_options_nextConfig.i18n) == null ? void 0 : _this_Internal_options_nextConfig_i18n.domains, hostname3);
const defaultLocale = ((_this_Internal_domainLocale = this[Internal].domainLocale) == null ? void 0 : _this_Internal_domainLocale.defaultLocale) || ((_this_Internal_options_nextConfig1 = this[Internal].options.nextConfig) == null ? void 0 : (_this_Internal_options_nextConfig_i18n1 = _this_Internal_options_nextConfig1.i18n) == null ? void 0 : _this_Internal_options_nextConfig_i18n1.defaultLocale);
this[Internal].url.pathname = info.pathname;
this[Internal].defaultLocale = defaultLocale;
this[Internal].basePath = info.basePath ?? "";
this[Internal].buildId = info.buildId;
this[Internal].locale = info.locale ?? defaultLocale;
this[Internal].trailingSlash = info.trailingSlash;
}
formatPathname() {
return (0, _formatnextpathnameinfo.formatNextPathnameInfo)({
basePath: this[Internal].basePath,
buildId: this[Internal].buildId,
defaultLocale: !this[Internal].options.forceLocale ? this[Internal].defaultLocale : void 0,
locale: this[Internal].locale,
pathname: this[Internal].url.pathname,
trailingSlash: this[Internal].trailingSlash
});
}
formatSearch() {
return this[Internal].url.search;
}
get buildId() {
return this[Internal].buildId;
}
set buildId(buildId) {
this[Internal].buildId = buildId;
}
get locale() {
return this[Internal].locale ?? "";
}
set locale(locale) {
var _this_Internal_options_nextConfig_i18n, _this_Internal_options_nextConfig;
if (!this[Internal].locale || !((_this_Internal_options_nextConfig = this[Internal].options.nextConfig) == null ? void 0 : (_this_Internal_options_nextConfig_i18n = _this_Internal_options_nextConfig.i18n) == null ? void 0 : _this_Internal_options_nextConfig_i18n.locales.includes(locale))) {
throw Object.defineProperty(new TypeError(`The NextURL configuration includes no locale "${locale}"`), "__NEXT_ERROR_CODE", {
value: "E597",
enumerable: false,
configurable: true
});
}
this[Internal].locale = locale;
}
get defaultLocale() {
return this[Internal].defaultLocale;
}
get domainLocale() {
return this[Internal].domainLocale;
}
get searchParams() {
return this[Internal].url.searchParams;
}
get host() {
return this[Internal].url.host;
}
set host(value) {
this[Internal].url.host = value;
}
get hostname() {
return this[Internal].url.hostname;
}
set hostname(value) {
this[Internal].url.hostname = value;
}
get port() {
return this[Internal].url.port;
}
set port(value) {
this[Internal].url.port = value;
}
get protocol() {
return this[Internal].url.protocol;
}
set protocol(value) {
this[Internal].url.protocol = value;
}
get href() {
const pathname = this.formatPathname();
const search = this.formatSearch();
return `${this.protocol}//${this.host}${pathname}${search}${this.hash}`;
}
set href(url2) {
this[Internal].url = parseURL(url2);
this.analyze();
}
get origin() {
return this[Internal].url.origin;
}
get pathname() {
return this[Internal].url.pathname;
}
set pathname(value) {
this[Internal].url.pathname = value;
}
get hash() {
return this[Internal].url.hash;
}
set hash(value) {
this[Internal].url.hash = value;
}
get search() {
return this[Internal].url.search;
}
set search(value) {
this[Internal].url.search = value;
}
get password() {
return this[Internal].url.password;
}
set password(value) {
this[Internal].url.password = value;
}
get username() {
return this[Internal].url.username;
}
set username(value) {
this[Internal].url.username = value;
}
get basePath() {
return this[Internal].basePath;
}
set basePath(value) {
this[Internal].basePath = value.startsWith("/") ? value : `/${value}`;
}
toString() {
return this.href;
}
toJSON() {
return this.href;
}
[Symbol.for("edge-runtime.inspect.custom")]() {
return {
href: this.href,
origin: this.origin,
protocol: this.protocol,
username: this.username,
password: this.password,
host: this.host,
hostname: this.hostname,
port: this.port,
pathname: this.pathname,
search: this.search,
searchParams: this.searchParams,
hash: this.hash
};
}
clone() {
return new _NextURL(String(this), this[Internal].options);
}
};
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/lib/constants.js
var require_constants = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/lib/constants.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
function _export(target, all) {
for (var name in all)
Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports2, {
ACTION_SUFFIX: function() {
return ACTION_SUFFIX;
},
APP_DIR_ALIAS: function() {
return APP_DIR_ALIAS;
},
CACHE_ONE_YEAR: function() {
return CACHE_ONE_YEAR;
},
DOT_NEXT_ALIAS: function() {
return DOT_NEXT_ALIAS;
},
ESLINT_DEFAULT_DIRS: function() {
return ESLINT_DEFAULT_DIRS;
},
GSP_NO_RETURNED_VALUE: function() {
return GSP_NO_RETURNED_VALUE;
},
GSSP_COMPONENT_MEMBER_ERROR: function() {
return GSSP_COMPONENT_MEMBER_ERROR;
},
GSSP_NO_RETURNED_VALUE: function() {
return GSSP_NO_RETURNED_VALUE;
},
INFINITE_CACHE: function() {
return INFINITE_CACHE;
},
INSTRUMENTATION_HOOK_FILENAME: function() {
return INSTRUMENTATION_HOOK_FILENAME;
},
MATCHED_PATH_HEADER: function() {
return MATCHED_PATH_HEADER;
},
MIDDLEWARE_FILENAME: function() {
return MIDDLEWARE_FILENAME;
},
MIDDLEWARE_LOCATION_REGEXP: function() {
return MIDDLEWARE_LOCATION_REGEXP;
},
NEXT_BODY_SUFFIX: function() {
return NEXT_BODY_SUFFIX;
},
NEXT_CACHE_IMPLICIT_TAG_ID: function() {
return NEXT_CACHE_IMPLICIT_TAG_ID;
},
NEXT_CACHE_REVALIDATED_TAGS_HEADER: function() {
return NEXT_CACHE_REVALIDATED_TAGS_HEADER;
},
NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER: function() {
return NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER;
},
NEXT_CACHE_SOFT_TAG_MAX_LENGTH: function() {
return NEXT_CACHE_SOFT_TAG_MAX_LENGTH;
},
NEXT_CACHE_TAGS_HEADER: function() {
return NEXT_CACHE_TAGS_HEADER;
},
NEXT_CACHE_TAG_MAX_ITEMS: function() {
return NEXT_CACHE_TAG_MAX_ITEMS;
},
NEXT_CACHE_TAG_MAX_LENGTH: function() {
return NEXT_CACHE_TAG_MAX_LENGTH;
},
NEXT_DATA_SUFFIX: function() {
return NEXT_DATA_SUFFIX;
},
NEXT_INTERCEPTION_MARKER_PREFIX: function() {
return NEXT_INTERCEPTION_MARKER_PREFIX;
},
NEXT_META_SUFFIX: function() {
return NEXT_META_SUFFIX;
},
NEXT_QUERY_PARAM_PREFIX: function() {
return NEXT_QUERY_PARAM_PREFIX;
},
NEXT_RESUME_HEADER: function() {
return NEXT_RESUME_HEADER;
},
NON_STANDARD_NODE_ENV: function() {
return NON_STANDARD_NODE_ENV;
},
PAGES_DIR_ALIAS: function() {
return PAGES_DIR_ALIAS;
},
PRERENDER_REVALIDATE_HEADER: function() {
return PRERENDER_REVALIDATE_HEADER;
},
PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER: function() {
return PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER;
},
PUBLIC_DIR_MIDDLEWARE_CONFLICT: function() {
return PUBLIC_DIR_MIDDLEWARE_CONFLICT;
},
ROOT_DIR_ALIAS: function() {
return ROOT_DIR_ALIAS;
},
RSC_ACTION_CLIENT_WRAPPER_ALIAS: function() {
return RSC_ACTION_CLIENT_WRAPPER_ALIAS;
},
RSC_ACTION_ENCRYPTION_ALIAS: function() {
return RSC_ACTION_ENCRYPTION_ALIAS;
},
RSC_ACTION_PROXY_ALIAS: function() {
return RSC_ACTION_PROXY_ALIAS;
},
RSC_ACTION_VALIDATE_ALIAS: function() {
return RSC_ACTION_VALIDATE_ALIAS;
},
RSC_CACHE_WRAPPER_ALIAS: function() {
return RSC_CACHE_WRAPPER_ALIAS;
},
RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS: function() {
return RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS;
},
RSC_MOD_REF_PROXY_ALIAS: function() {
return RSC_MOD_REF_PROXY_ALIAS;
},
RSC_PREFETCH_SUFFIX: function() {
return RSC_PREFETCH_SUFFIX;
},
RSC_SEGMENTS_DIR_SUFFIX: function() {
return RSC_SEGMENTS_DIR_SUFFIX;
},
RSC_SEGMENT_SUFFIX: function() {
return RSC_SEGMENT_SUFFIX;
},
RSC_SUFFIX: function() {
return RSC_SUFFIX;
},
SERVER_PROPS_EXPORT_ERROR: function() {
return SERVER_PROPS_EXPORT_ERROR;
},
SERVER_PROPS_GET_INIT_PROPS_CONFLICT: function() {
return SERVER_PROPS_GET_INIT_PROPS_CONFLICT;
},
SERVER_PROPS_SSG_CONFLICT: function() {
return SERVER_PROPS_SSG_CONFLICT;
},
SERVER_RUNTIME: function() {
return SERVER_RUNTIME;
},
SSG_FALLBACK_EXPORT_ERROR: function() {
return SSG_FALLBACK_EXPORT_ERROR;
},
SSG_GET_INITIAL_PROPS_CONFLICT: function() {
return SSG_GET_INITIAL_PROPS_CONFLICT;
},
STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR: function() {
return STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR;
},
UNSTABLE_REVALIDATE_RENAME_ERROR: function() {
return UNSTABLE_REVALIDATE_RENAME_ERROR;
},
WEBPACK_LAYERS: function() {
return WEBPACK_LAYERS;
},
WEBPACK_RESOURCE_QUERIES: function() {
return WEBPACK_RESOURCE_QUERIES;
}
});
var NEXT_QUERY_PARAM_PREFIX = "nxtP";
var NEXT_INTERCEPTION_MARKER_PREFIX = "nxtI";
var MATCHED_PATH_HEADER = "x-matched-path";
var PRERENDER_REVALIDATE_HEADER = "x-prerender-revalidate";
var PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER = "x-prerender-revalidate-if-generated";
var RSC_PREFETCH_SUFFIX = ".prefetch.rsc";
var RSC_SEGMENTS_DIR_SUFFIX = ".segments";
var RSC_SEGMENT_SUFFIX = ".segment.rsc";
var RSC_SUFFIX = ".rsc";
var ACTION_SUFFIX = ".action";
var NEXT_DATA_SUFFIX = ".json";
var NEXT_META_SUFFIX = ".meta";
var NEXT_BODY_SUFFIX = ".body";
var NEXT_CACHE_TAGS_HEADER = "x-next-cache-tags";
var NEXT_CACHE_REVALIDATED_TAGS_HEADER = "x-next-revalidated-tags";
var NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER = "x-next-revalidate-tag-token";
var NEXT_RESUME_HEADER = "next-resume";
var NEXT_CACHE_TAG_MAX_ITEMS = 128;
var NEXT_CACHE_TAG_MAX_LENGTH = 256;
var NEXT_CACHE_SOFT_TAG_MAX_LENGTH = 1024;
var NEXT_CACHE_IMPLICIT_TAG_ID = "_N_T_";
var CACHE_ONE_YEAR = 31536e3;
var INFINITE_CACHE = 4294967294;
var MIDDLEWARE_FILENAME = "middleware";
var MIDDLEWARE_LOCATION_REGEXP = `(?:src/)?${MIDDLEWARE_FILENAME}`;
var INSTRUMENTATION_HOOK_FILENAME = "instrumentation";
var PAGES_DIR_ALIAS = "private-next-pages";
var DOT_NEXT_ALIAS = "private-dot-next";
var ROOT_DIR_ALIAS = "private-next-root-dir";
var APP_DIR_ALIAS = "private-next-app-dir";
var RSC_MOD_REF_PROXY_ALIAS = "private-next-rsc-mod-ref-proxy";
var RSC_ACTION_VALIDATE_ALIAS = "private-next-rsc-action-validate";
var RSC_ACTION_PROXY_ALIAS = "private-next-rsc-server-reference";
var RSC_CACHE_WRAPPER_ALIAS = "private-next-rsc-cache-wrapper";
var RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS = "private-next-rsc-track-dynamic-import";
var RSC_ACTION_ENCRYPTION_ALIAS = "private-next-rsc-action-encryption";
var RSC_ACTION_CLIENT_WRAPPER_ALIAS = "private-next-rsc-action-client-wrapper";
var PUBLIC_DIR_MIDDLEWARE_CONFLICT = `You can not have a '_next' folder inside of your public folder. This conflicts with the internal '/_next' route. https://nextjs.org/docs/messages/public-next-folder-conflict`;
var SSG_GET_INITIAL_PROPS_CONFLICT = `You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps`;
var SERVER_PROPS_GET_INIT_PROPS_CONFLICT = `You can not use getInitialProps with getServerSideProps. Please remove getInitialProps.`;
var SERVER_PROPS_SSG_CONFLICT = `You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps`;
var STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR = `can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props`;
var SERVER_PROPS_EXPORT_ERROR = `pages with \`getServerSideProps\` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export`;
var GSP_NO_RETURNED_VALUE = "Your `getStaticProps` function did not return an object. Did you forget to add a `return`?";
var GSSP_NO_RETURNED_VALUE = "Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?";
var UNSTABLE_REVALIDATE_RENAME_ERROR = "The `unstable_revalidate` property is available for general use.\nPlease use `revalidate` instead.";
var GSSP_COMPONENT_MEMBER_ERROR = `can not be attached to a page's component and must be exported from the page. See more info here: https://nextjs.org/docs/messages/gssp-component-member`;
var NON_STANDARD_NODE_ENV = `You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env`;
var SSG_FALLBACK_EXPORT_ERROR = `Pages with \`fallback\` enabled in \`getStaticPaths\` can not be exported. See more info here: https://nextjs.org/docs/messages/ssg-fallback-true-export`;
var ESLINT_DEFAULT_DIRS = [
"app",
"pages",
"components",
"lib",
"src"
];
var SERVER_RUNTIME = {
edge: "edge",
experimentalEdge: "experimental-edge",
nodejs: "nodejs"
};
var WEBPACK_LAYERS_NAMES = {
/**
* The layer for the shared code between the client and server bundles.
*/
shared: "shared",
/**
* The layer for server-only runtime and picking up `react-server` export conditions.
* Including app router RSC pages and app router custom routes and metadata routes.
*/
reactServerComponents: "rsc",
/**
* Server Side Rendering layer for app (ssr).
*/
serverSideRendering: "ssr",
/**
* The browser client bundle layer for actions.
*/
actionBrowser: "action-browser",
/**
* The Node.js bundle layer for the API routes.
*/
apiNode: "api-node",
/**
* The Edge Lite bundle layer for the API routes.
*/
apiEdge: "api-edge",
/**
* The layer for the middleware code.
*/
middleware: "middleware",
/**
* The layer for the instrumentation hooks.
*/
instrument: "instrument",
/**
* The layer for assets on the edge.
*/
edgeAsset: "edge-asset",
/**
* The browser client bundle layer for App directory.
*/
appPagesBrowser: "app-pages-browser",
/**
* The browser client bundle layer for Pages directory.
*/
pagesDirBrowser: "pages-dir-browser",
/**
* The Edge Lite bundle layer for Pages directory.
*/
pagesDirEdge: "pages-dir-edge",
/**
* The Node.js bundle layer for Pages directory.
*/
pagesDirNode: "pages-dir-node"
};
var WEBPACK_LAYERS = {
...WEBPACK_LAYERS_NAMES,
GROUP: {
builtinReact: [
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.actionBrowser
],
serverOnly: [
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.actionBrowser,
WEBPACK_LAYERS_NAMES.instrument,
WEBPACK_LAYERS_NAMES.middleware
],
neutralTarget: [
// pages api
WEBPACK_LAYERS_NAMES.apiNode,
WEBPACK_LAYERS_NAMES.apiEdge
],
clientOnly: [
WEBPACK_LAYERS_NAMES.serverSideRendering,
WEBPACK_LAYERS_NAMES.appPagesBrowser
],
bundled: [
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.actionBrowser,
WEBPACK_LAYERS_NAMES.serverSideRendering,
WEBPACK_LAYERS_NAMES.appPagesBrowser,
WEBPACK_LAYERS_NAMES.shared,
WEBPACK_LAYERS_NAMES.instrument,
WEBPACK_LAYERS_NAMES.middleware
],
appPages: [
// app router pages and layouts
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.serverSideRendering,
WEBPACK_LAYERS_NAMES.appPagesBrowser,
WEBPACK_LAYERS_NAMES.actionBrowser
]
}
};
var WEBPACK_RESOURCE_QUERIES = {
edgeSSREntry: "__next_edge_ssr_entry__",
metadata: "__next_metadata__",
metadataRoute: "__next_metadata_route__",
metadataImageMeta: "__next_metadata_image_meta__"
};
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/server/web/utils.js
var require_utils = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/server/web/utils.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
function _export(target, all) {
for (var name in all)
Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports2, {
fromNodeOutgoingHttpHeaders: function() {
return fromNodeOutgoingHttpHeaders;
},
normalizeNextQueryParam: function() {
return normalizeNextQueryParam;
},
splitCookiesString: function() {
return splitCookiesString;
},
toNodeOutgoingHttpHeaders: function() {
return toNodeOutgoingHttpHeaders;
},
validateURL: function() {
return validateURL;
}
});
var _constants = require_constants();
function fromNodeOutgoingHttpHeaders(nodeHeaders) {
const headers = new Headers();
for (let [key, value] of Object.entries(nodeHeaders)) {
const values = Array.isArray(value) ? value : [
value
];
for (let v of values) {
if (typeof v === "undefined")
continue;
if (typeof v === "number") {
v = v.toString();
}
headers.append(key, v);
}
}
return headers;
}
function splitCookiesString(cookiesString) {
var cookiesStrings = [];
var pos = 0;
var start;
var ch;
var lastComma;
var nextStart;
var cookiesSeparatorFound;
function skipWhitespace() {
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
pos += 1;
}
return pos < cookiesString.length;
}
function notSpecialChar() {
ch = cookiesString.charAt(pos);
return ch !== "=" && ch !== ";" && ch !== ",";
}
while (pos < cookiesString.length) {
start = pos;
cookiesSeparatorFound = false;
while (skipWhitespace()) {
ch = cookiesString.charAt(pos);
if (ch === ",") {
lastComma = pos;
pos += 1;
skipWhitespace();
nextStart = pos;
while (pos < cookiesString.length && notSpecialChar()) {
pos += 1;
}
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
cookiesSeparatorFound = true;
pos = nextStart;
cookiesStrings.push(cookiesString.substring(start, lastComma));
start = pos;
} else {
pos = lastComma + 1;
}
} else {
pos += 1;
}
}
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
}
}
return cookiesStrings;
}
function toNodeOutgoingHttpHeaders(headers) {
const nodeHeaders = {};
const cookies = [];
if (headers) {
for (const [key, value] of headers.entries()) {
if (key.toLowerCase() === "set-cookie") {
cookies.push(...splitCookiesString(value));
nodeHeaders[key] = cookies.length === 1 ? cookies[0] : cookies;
} else {
nodeHeaders[key] = value;
}
}
}
return nodeHeaders;
}
function validateURL(url2) {
try {
return String(new URL(String(url2)));
} catch (error46) {
throw Object.defineProperty(new Error(`URL is malformed "${String(url2)}". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls`, {
cause: error46
}), "__NEXT_ERROR_CODE", {
value: "E61",
enumerable: false,
configurable: true
});
}
}
function normalizeNextQueryParam(key) {
const prefixes = [
_constants.NEXT_QUERY_PARAM_PREFIX,
_constants.NEXT_INTERCEPTION_MARKER_PREFIX
];
for (const prefix of prefixes) {
if (key !== prefix && key.startsWith(prefix)) {
return key.substring(prefix.length);
}
}
return null;
}
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/server/web/error.js
var require_error = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/server/web/error.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
function _export(target, all) {
for (var name in all)
Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports2, {
PageSignatureError: function() {
return PageSignatureError;
},
RemovedPageError: function() {
return RemovedPageError;
},
RemovedUAError: function() {
return RemovedUAError;
}
});
var PageSignatureError = class extends Error {
constructor({ page }) {
super(`The middleware "${page}" accepts an async API directly with the form:
export function middleware(request, event) {
return NextResponse.redirect('/new-location')
}
Read more: https://nextjs.org/docs/messages/middleware-new-signature
`);
}
};
var RemovedPageError = class extends Error {
constructor() {
super(`The request.page has been deprecated in favour of \`URLPattern\`.
Read more: https://nextjs.org/docs/messages/middleware-request-page
`);
}
};
var RemovedUAError = class extends Error {
constructor() {
super(`The request.ua has been removed in favour of \`userAgent\` function.
Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent
`);
}
};
}
});
// ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/compiled/@edge-runtime/cookies/index.js
var require_cookies = __commonJS({
"../../node_modules/.pnpm/next@15.4.8_@babel+core@7.22.11_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/next/dist/compiled/@edge-runtime/cookies/index.js"(exports2, module2) {
"use strict";
var __defProp2 = Object.defineProperty;
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
var __getOwnPropNames2 = Object.getOwnPropertyNames;
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
var __export3 = (target, all) => {
for (var name in all)
__defProp2(target, name, { get: all[name], enumerable: true });
};
var __copyProps2 = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames2(from))
if (!__hasOwnProp2.call(to, key) && key !== except)
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
var src_exports2 = {};
__export3(src_exports2, {
RequestCookies: () => RequestCookies,
ResponseCookies: () => ResponseCookies,
parseCookie: () => parseCookie,
parseSetCookie: () => parseSetCookie,
stringifyCookie: () => stringifyCookie
});
module2.exports = __toCommonJS2(src_exports2);
function stringifyCookie(c) {
var _a2;
const attrs = [
"path" in c && c.path && `Path=${c.path}`,
"expires" in c && (c.expires || c.expires === 0) && `Expires=${(typeof c.expires === "number" ? new Date(c.expires) : c.expires).toUTCString()}`,
"maxAge" in c && typeof c.maxAge === "number" && `Max-Age=${c.maxAge}`,
"domain" in c && c.domain && `Domain=${c.domain}`,
"secure" in c && c.secure && "Secure",
"httpOnly" in c && c.httpOnly && "HttpOnly",
"sameSite" in c && c.sameSite && `SameSite=${c.sameSite}`,
"partitioned" in c && c.partitioned && "Partitioned",
"priority" in c && c.priority && `Priority=${c.priority}`
].filter(Boolean);
const stringified = `${c.name}=${encodeURIComponent((_a2 = c.value) != null ? _a2 : "")}`;
return attrs.length === 0 ? stringified : `${stringified}; ${attrs.join("; ")}`;
}
function parseCookie(cookie) {
const map2 = /* @__PURE__ */ new Map();
for (const pair of cookie.split(/; */)) {
if (!pair)
continue;
const s