maxserver 0.8.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +183 -0
- package/bin/generate.js +142 -0
- package/devdocs/maxserver-docs.css +2 -0
- package/devdocs/maxserver-docs.js +7 -0
- package/package.json +21 -16
- package/src/cors.js +52 -0
- package/src/docs.js +169 -0
- package/src/errors.js +70 -0
- package/src/headers.js +32 -0
- package/src/index.js +94 -74
- package/src/jwt.js +107 -0
- package/src/routes.js +187 -0
- package/src/static.js +60 -0
- package/src/validate.js +90 -0
- package/{templates → template}/env +0 -1
- package/template/gitignore +3 -0
- package/template/package.json +14 -0
- package/{templates → template}/src/Test/hello.js +1 -1
- package/{templates → template}/src/Test/welcome.js +2 -2
- package/{templates → template}/src/Test/welcome.schema.js +1 -1
- package/.github/README.md +0 -263
- package/LICENSE +0 -21
- package/bin/init.js +0 -86
- package/bin/watcher.js +0 -48
- package/index.d.ts +0 -68
- package/src/devSounds.js +0 -37
- package/src/getAddress.js +0 -46
- package/src/setup.js +0 -104
- package/src/setupDocs.js +0 -78
- package/src/setupRoutes.js +0 -164
- package/templates/ai/BASE +0 -2
- package/templates/gitignore +0 -1
- package/templates/jsconfig.json +0 -31
- package/templates/package.json +0 -13
- package/templates/vscode/project.code-snippets.json +0 -18
- package/templates/vscode/tasks.json +0 -30
- /package/{templates → template}/server.js +0 -0
- /package/{templates → template}/src/Models/user.schema.js +0 -0
- /package/{templates → template}/src/Test/hello.schema.js +0 -0
package/bin/cli.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* maxserver CLI: new <name>, dev, build
|
|
5
|
+
* Runs on Node and Bun, starts Bun itself for dev and build.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import fs from "node:fs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
import { spawn, spawnSync, execSync } from "node:child_process";
|
|
12
|
+
import { generate } from "./generate.js";
|
|
13
|
+
|
|
14
|
+
const PKG_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
15
|
+
const VERSION = JSON.parse(fs.readFileSync(path.join(PKG_DIR, "package.json"), "utf8")).version;
|
|
16
|
+
|
|
17
|
+
const USAGE = `
|
|
18
|
+
maxserver new <name> create a new project
|
|
19
|
+
maxserver dev generate setup.js, watch src/, run bun --hot,
|
|
20
|
+
open /docs in the browser (--no-open: don't)
|
|
21
|
+
maxserver build generate setup.js, bundle to dist/bundle.js
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
function fail(message) {
|
|
26
|
+
console.error(`❌ ${message}`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
function hasBun() {
|
|
32
|
+
return spawnSync("bun", ["--version"], { stdio: "ignore" }).status === 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
function requireBun() {
|
|
37
|
+
if (!hasBun()) fail("Bun is not installed. maxserver runs on Bun: https://bun.sh");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
function loadEnv() {
|
|
42
|
+
try {
|
|
43
|
+
if (fs.existsSync(".env")) process.loadEnvFile?.(".env");
|
|
44
|
+
} catch { }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// ---------- new ----------
|
|
49
|
+
|
|
50
|
+
function cmdNew(name, args) {
|
|
51
|
+
if (!name) fail("Project name missing: maxserver new <name>");
|
|
52
|
+
|
|
53
|
+
const target = path.resolve(process.cwd(), name);
|
|
54
|
+
if (fs.existsSync(target)) fail(`Directory "${name}" already exists.`);
|
|
55
|
+
|
|
56
|
+
// 1. Copy template
|
|
57
|
+
console.log(`🚀 Setting up "${name}"`);
|
|
58
|
+
fs.cpSync(path.join(PKG_DIR, "template"), target, { recursive: true });
|
|
59
|
+
|
|
60
|
+
// 2. Dotfiles
|
|
61
|
+
for (const f of ["env", "gitignore"]) {
|
|
62
|
+
const src = path.join(target, f);
|
|
63
|
+
if (fs.existsSync(src)) fs.renameSync(src, path.join(target, "." + f));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// 3. Project name
|
|
67
|
+
const pkgPath = path.join(target, "package.json");
|
|
68
|
+
fs.writeFileSync(pkgPath, fs.readFileSync(pkgPath, "utf8").replace(/__NAME__/g, path.basename(name)));
|
|
69
|
+
|
|
70
|
+
// 4. Install
|
|
71
|
+
if (!args.includes("--no-install")) {
|
|
72
|
+
// The same version as this CLI, not @latest
|
|
73
|
+
const install = `npm install maxserver@${VERSION} && npm install -D @types/bun`;
|
|
74
|
+
console.log(`📦 Installing maxserver@${VERSION}`);
|
|
75
|
+
try {
|
|
76
|
+
execSync(install, { cwd: target, stdio: "inherit" });
|
|
77
|
+
} catch {
|
|
78
|
+
fail(`Install failed (see npm's message above). The project is in ${name}/, finish it with:\n\n\tcd ${name}\n\t${install}\n`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!hasBun()) console.warn("⚠️ Bun is not installed, install it before running: https://bun.sh");
|
|
83
|
+
console.log(`\n✅ Install complete\n\n->\n\tcd ${name}\n\tnpm run dev\n`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
// ---------- dev ----------
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Opens a URL in the default browser.
|
|
91
|
+
*/
|
|
92
|
+
function openBrowser(url) {
|
|
93
|
+
const cmd = process.platform === "darwin" ? ["open", url]
|
|
94
|
+
: process.platform === "win32" ? ["cmd", "/c", "start", "", url]
|
|
95
|
+
: ["xdg-open", url];
|
|
96
|
+
spawn(cmd[0], cmd.slice(1), { stdio: "ignore", detached: true }).on("error", () => { }).unref();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
function tryGenerate() {
|
|
101
|
+
try {
|
|
102
|
+
generate();
|
|
103
|
+
return true;
|
|
104
|
+
} catch (err) {
|
|
105
|
+
console.error(`❌ ${err.message}`);
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
function cmdDev(args) {
|
|
112
|
+
requireBun();
|
|
113
|
+
loadEnv();
|
|
114
|
+
const dir = process.env.ROUTESDIR || "src";
|
|
115
|
+
let child = null;
|
|
116
|
+
let opened = args.includes("--no-open");
|
|
117
|
+
|
|
118
|
+
// 1. Start bun --hot once setup.js is valid; open the docs once per run
|
|
119
|
+
const start = () => {
|
|
120
|
+
if (child || !tryGenerate()) return;
|
|
121
|
+
child = spawn("bun", ["--hot", "setup.js"], { stdio: ["inherit", "pipe", "inherit"] });
|
|
122
|
+
child.stdout.on("data", chunk => {
|
|
123
|
+
process.stdout.write(chunk);
|
|
124
|
+
const docs = !opened && String(chunk).match(/📚\s+(http\S+)/);
|
|
125
|
+
if (docs) {
|
|
126
|
+
opened = true;
|
|
127
|
+
openBrowser(docs[1]);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
child.on("exit", code => {
|
|
131
|
+
child = null;
|
|
132
|
+
if (code) console.error(`❌ server exited with code ${code}, waiting for changes`);
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// 2. Regenerate on src changes, bun --hot reloads setup.js
|
|
137
|
+
let timer;
|
|
138
|
+
fs.watch(dir, { recursive: true }, (event, file) => {
|
|
139
|
+
if (!file || !String(file).endsWith(".js")) return;
|
|
140
|
+
clearTimeout(timer);
|
|
141
|
+
timer = setTimeout(() => (child ? tryGenerate() : start()), 50);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
process.on("SIGINT", () => { child?.kill("SIGINT"); process.exit(0); });
|
|
145
|
+
process.on("SIGTERM", () => { child?.kill("SIGTERM"); process.exit(0); });
|
|
146
|
+
|
|
147
|
+
start();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
// ---------- build ----------
|
|
152
|
+
|
|
153
|
+
function cmdBuild() {
|
|
154
|
+
requireBun();
|
|
155
|
+
loadEnv();
|
|
156
|
+
if (!tryGenerate()) process.exit(1);
|
|
157
|
+
|
|
158
|
+
// NODE_ENV stays a runtime value, bun build would otherwise inline "development"
|
|
159
|
+
const result = spawnSync("bun", [
|
|
160
|
+
"build", "setup.js",
|
|
161
|
+
"--target=bun",
|
|
162
|
+
"--outdir=dist",
|
|
163
|
+
"--entry-naming=bundle.[ext]",
|
|
164
|
+
"--sourcemap=linked",
|
|
165
|
+
"--define", "process.env.NODE_ENV=globalThis.process.env.NODE_ENV",
|
|
166
|
+
], { stdio: "inherit" });
|
|
167
|
+
|
|
168
|
+
if (result.status !== 0) process.exit(result.status || 1);
|
|
169
|
+
console.log("✅ Built dist/bundle.js, run: bun dist/bundle.js");
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
// ---------- main ----------
|
|
174
|
+
|
|
175
|
+
const [cmd, ...args] = process.argv.slice(2);
|
|
176
|
+
|
|
177
|
+
if (cmd === "new") cmdNew(args[0], args.slice(1));
|
|
178
|
+
else if (cmd === "dev") cmdDev(args);
|
|
179
|
+
else if (cmd === "build") cmdBuild();
|
|
180
|
+
else {
|
|
181
|
+
console.log(USAGE);
|
|
182
|
+
if (cmd && cmd !== "help" && cmd !== "--help") process.exit(1);
|
|
183
|
+
}
|
package/bin/generate.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scans src/ for "// METHOD /path" comments and writes setup.js
|
|
3
|
+
* with plain static imports, so the app bundles normally.
|
|
4
|
+
* Runs on Node and Bun.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import fs from "node:fs";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
|
|
10
|
+
const ROUTE_REGEX = /^\/\/\s*(GET|POST|PUT|PATCH|DELETE)\s+(\S+)\s*$/gm;
|
|
11
|
+
const HEADER = "// Auto generated by maxserver, do not edit";
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* All .js files, sorted, without node_modules, dotfiles and tests.
|
|
16
|
+
*/
|
|
17
|
+
function walk(dir, out = []) {
|
|
18
|
+
if (!fs.existsSync(dir)) return out;
|
|
19
|
+
|
|
20
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
21
|
+
for (const e of entries) {
|
|
22
|
+
if (e.name === "node_modules" || e.name.startsWith(".")) continue;
|
|
23
|
+
|
|
24
|
+
const full = path.join(dir, e.name);
|
|
25
|
+
if (e.isDirectory()) walk(full, out);
|
|
26
|
+
else if (e.name.endsWith(".js") && !e.name.endsWith(".test.js")) out.push(full);
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
function hasDefaultExport(text) {
|
|
33
|
+
return /^\s*export\s+default\b/m.test(text);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Collects routes and models. Throws clear errors with file paths.
|
|
39
|
+
*/
|
|
40
|
+
export function collect(root, dir = "src") {
|
|
41
|
+
const rel = f => path.relative(root, f).split(path.sep).join("/");
|
|
42
|
+
const files = walk(path.resolve(root, dir));
|
|
43
|
+
const routes = [];
|
|
44
|
+
const models = [];
|
|
45
|
+
const seen = new Map();
|
|
46
|
+
|
|
47
|
+
for (const file of files) {
|
|
48
|
+
const text = fs.readFileSync(file, "utf8");
|
|
49
|
+
|
|
50
|
+
// 1. Models: .schema.js without sibling .js
|
|
51
|
+
if (file.endsWith(".schema.js")) {
|
|
52
|
+
if (fs.existsSync(file.replace(/\.schema\.js$/, ".js"))) continue;
|
|
53
|
+
if (!hasDefaultExport(text)) throw new Error(`${rel(file)}: model schema must use export default`);
|
|
54
|
+
models.push({ file: rel(file) });
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 2. Routes: exactly one magic comment
|
|
59
|
+
const matches = [...text.matchAll(ROUTE_REGEX)];
|
|
60
|
+
if (matches.length === 0) continue;
|
|
61
|
+
if (matches.length > 1) throw new Error(`${rel(file)}: only one route comment allowed per file, found ${matches.length}`);
|
|
62
|
+
if (!hasDefaultExport(text)) throw new Error(`${rel(file)}: route must export a default handler function`);
|
|
63
|
+
|
|
64
|
+
const method = matches[0][1];
|
|
65
|
+
const url = "/" + matches[0][2].replace(/^\/+/, "");
|
|
66
|
+
|
|
67
|
+
// 3. Duplicates
|
|
68
|
+
const key = `${method} ${url}`;
|
|
69
|
+
if (seen.has(key)) throw new Error(`Duplicate route "${key}" in ${seen.get(key)} and ${rel(file)}`);
|
|
70
|
+
seen.set(key, rel(file));
|
|
71
|
+
|
|
72
|
+
const schemaFile = file.replace(/\.js$/, ".schema.js");
|
|
73
|
+
const schema = fs.existsSync(schemaFile) ? rel(schemaFile) : null;
|
|
74
|
+
if (schema && !hasDefaultExport(fs.readFileSync(schemaFile, "utf8")))
|
|
75
|
+
throw new Error(`${schema}: schema must use export default`);
|
|
76
|
+
|
|
77
|
+
routes.push({ method, path: url, file: rel(file), schema });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return { routes, models };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
const str = JSON.stringify;
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* setup.js source code.
|
|
89
|
+
*/
|
|
90
|
+
export function render({ routes, models }) {
|
|
91
|
+
const imports = [];
|
|
92
|
+
const modelList = [];
|
|
93
|
+
const routeList = [];
|
|
94
|
+
|
|
95
|
+
models.forEach((m, i) => {
|
|
96
|
+
imports.push(`import m${i} from ${str("./" + m.file)};`);
|
|
97
|
+
modelList.push(`\t\t{ file: ${str(m.file)}, schema: m${i} },`);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
routes.forEach((r, i) => {
|
|
101
|
+
imports.push(`import h${i} from ${str("./" + r.file)};`);
|
|
102
|
+
if (r.schema) imports.push(`import s${i} from ${str("./" + r.schema)};`);
|
|
103
|
+
const schema = r.schema ? `, schema: s${i}` : "";
|
|
104
|
+
routeList.push(`\t\t{ method: "${r.method}", path: ${str(r.path)}, file: ${str(r.file)}, handler: h${i}${schema} },`);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
return [
|
|
108
|
+
HEADER,
|
|
109
|
+
`import { register } from "maxserver";`,
|
|
110
|
+
...imports,
|
|
111
|
+
"",
|
|
112
|
+
"register({",
|
|
113
|
+
"\tmodels: [",
|
|
114
|
+
...modelList,
|
|
115
|
+
"\t],",
|
|
116
|
+
"\troutes: [",
|
|
117
|
+
...routeList,
|
|
118
|
+
"\t],",
|
|
119
|
+
"});",
|
|
120
|
+
"",
|
|
121
|
+
"// server.js last: static imports above run first, so routes are registered before it starts",
|
|
122
|
+
`await import("./server.js");`,
|
|
123
|
+
"",
|
|
124
|
+
].join("\n");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Writes setup.js in root, only if content changed. Returns the collected routes.
|
|
130
|
+
*/
|
|
131
|
+
export function generate(root = process.cwd(), dir = process.env.ROUTESDIR || "src") {
|
|
132
|
+
if (!fs.existsSync(path.join(root, "server.js")))
|
|
133
|
+
throw new Error(`server.js not found in ${root}`);
|
|
134
|
+
|
|
135
|
+
const result = collect(root, dir);
|
|
136
|
+
const code = render(result);
|
|
137
|
+
const out = path.join(root, "setup.js");
|
|
138
|
+
|
|
139
|
+
const old = fs.existsSync(out) ? fs.readFileSync(out, "utf8") : null;
|
|
140
|
+
if (old !== code) fs.writeFileSync(out, code);
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
._bar_18yta_1{padding:12px 12px 4px}._input_18yta_5{border:var(--hairline);background:var(--surface);width:100%;height:30px;color:var(--text-muted);font-family:var(--font-mono);border-radius:6px;padding:0 8px;font-size:12px;display:block}._input_18yta_5:focus{outline:2px solid var(--accent);outline-offset:-1px;background:var(--background);color:var(--text)}._badge_687h8_1{font-family:var(--font-mono);text-transform:uppercase;color:var(--text-muted);font-size:14px}._short_687h8_8{margin-left:8px;font-size:10px;font-weight:600;line-height:14px}._get_687h8_15{color:var(--method-get)}._post_687h8_16{color:var(--method-post)}._put_687h8_17{color:var(--method-put)}._patch_687h8_18{color:var(--method-patch)}._delete_687h8_19{color:var(--method-delete)}._dark_687h8_21._get_687h8_15{color:var(--method-get-dark)}._dark_687h8_21._post_687h8_16{color:var(--method-post-dark)}._dark_687h8_21._put_687h8_17{color:var(--method-put-dark)}._dark_687h8_21._patch_687h8_18{color:var(--method-patch-dark)}._dark_687h8_21._delete_687h8_19{color:var(--method-delete-dark)}._group_313i3_1{flex-direction:column;gap:1px;display:flex}._header_313i3_7{width:100%;min-height:32px;color:var(--text-muted);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:3px;justify-content:space-between;align-items:center;padding:8px;font-size:14px;line-height:16px;display:flex}._header_313i3_7:hover{color:var(--text);background:var(--surface)}._header_313i3_7[aria-expanded=true]{color:var(--text)}._chevron_313i3_34{color:var(--text-muted)}._items_313i3_38{flex-direction:column;gap:1px;margin:0;padding:0;list-style:none;display:flex;position:relative}._items_313i3_38:before{content:"";border-left:var(--hairline);position:absolute;top:0;bottom:0;left:12px}._item_313i3_38{min-height:32px;color:var(--text-muted);border-radius:3px;justify-content:space-between;align-items:center;padding:8px 8px 8px 28px;font-size:14px;line-height:16px;text-decoration:none;display:flex}._item_313i3_38:hover{color:var(--text);background:var(--surface)}._active_313i3_75{color:var(--text);background:var(--surface);font-weight:500}._label_313i3_81{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}._header_313i3_7:focus-visible,._item_313i3_38:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}._sidebar_oqs2u_1{flex:1;min-height:0;padding:8px 12px 12px;overflow-y:auto}._list_oqs2u_8{flex-direction:column;gap:1px;margin:0;padding:0;list-style:none;display:flex}._link_oqs2u_17{min-height:32px;color:var(--text-muted);border-radius:3px;justify-content:space-between;align-items:center;padding:8px;font-size:14px;line-height:16px;text-decoration:none;display:flex}._link_oqs2u_17:hover{color:var(--text);background:var(--surface)}._active_oqs2u_35{color:var(--text);background:var(--surface);font-weight:500}._label_oqs2u_41{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}._link_oqs2u_17:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}._markdown_1u8a2_1{color:var(--text);font-size:16px;line-height:26px}._markdown_1u8a2_1 p,._markdown_1u8a2_1 ul,._markdown_1u8a2_1 ol,._pre_1u8a2_10{margin:0 0 12px}._markdown_1u8a2_1>:last-child{margin-bottom:0}._markdown_1u8a2_1 ul,._markdown_1u8a2_1 ol{padding-left:22px}._muted_1u8a2_23{color:var(--text-muted);font-size:14px;line-height:22px}._heading_1u8a2_29{font-weight:600}._code_1u8a2_33{background:var(--surface);border-radius:3px;padding:0 3px;font-size:12px}._link_1u8a2_40{color:var(--text);text-underline-offset:4px;-webkit-text-decoration:underline #1b1b1b4d;text-decoration:underline #1b1b1b4d}._link_1u8a2_40:hover{-webkit-text-decoration-color:var(--text);text-decoration-color:var(--text)}._pre_1u8a2_10{background:var(--surface);font-family:var(--font-mono);border-radius:8px;padding:8px 12px;font-size:13px;line-height:19px;overflow:auto}._field_opijr_1{align-items:center;gap:6px;min-height:36px;padding:0 8px 0 12px;font-size:14px;display:flex}._label_opijr_10{color:var(--text);flex:none}._input_opijr_15{min-width:0;height:32px;color:var(--text);font-family:var(--font-mono);background:0 0;border:0;flex:1;font-size:13px}._input_opijr_15::placeholder{font-family:var(--font-body);color:var(--text-faint);font-size:14px}._input_opijr_15:focus{outline:none}._field_opijr_1:focus-within{box-shadow:inset 0 0 0 2px var(--accent)}._eye_opijr_40{width:28px;height:28px;color:var(--text-muted);cursor:pointer;background:0 0;border:0;border-radius:3px;justify-content:center;align-items:center;padding:0;display:inline-flex}._eye_opijr_40:hover{color:var(--text)}._intro_1jvp6_1{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:32px 48px;padding:90px 0;display:grid}._auth_1jvp6_9{border:var(--hairline);border-radius:8px;align-self:end;overflow:hidden}._authTitle_1jvp6_16{border-bottom:var(--hairline);background:var(--surface);padding:8px 12px;font-size:14px;font-weight:500;line-height:20px}@media (max-width:1100px){._intro_1jvp6_1{grid-template-columns:minmax(0,1fr)}}._pills_1jvp6_31{gap:6px;margin-bottom:2px;display:flex}._pill_1jvp6_31{border:var(--hairline);background:var(--surface);color:var(--text-muted);border-radius:12px;padding:2px 6px;font-size:13px;line-height:15px;display:inline-block}._title_1jvp6_48{margin:0 0 9px;font-size:24px;font-weight:600;line-height:34.8px}._download_1jvp6_55{text-underline-offset:4px;font-size:16px;font-weight:500;line-height:26px;-webkit-text-decoration:underline #1b1b1b4d;text-decoration:underline #1b1b1b4d}._download_1jvp6_55:hover{-webkit-text-decoration-color:var(--text);text-decoration-color:var(--text)}._tag_wuduw_1{border-top:var(--hairline);grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px 48px;padding:90px 0;display:grid}._title_wuduw_10{margin:0 0 12px;font-size:24px;font-weight:600;line-height:34.8px}._card_wuduw_17{border:var(--hairline);background:var(--surface);border-radius:8px;align-self:start}._cardTitle_wuduw_24{border-bottom:var(--hairline);padding:7px 12px;font-size:14px;font-weight:500;line-height:22px}._list_wuduw_32{margin:0;padding:10px 12px;list-style:none}._item_wuduw_38{align-items:baseline;line-height:22px;text-decoration:none;display:flex}._item_wuduw_38:hover ._path_wuduw_45{text-underline-offset:3px;text-decoration:underline}._method_wuduw_50{text-align:right;flex:none;width:62px}._path_wuduw_45{color:var(--text);overflow-wrap:anywhere;margin-left:12px;font-size:14px}@media (max-width:1100px){._tag_wuduw_1{grid-template-columns:minmax(0,1fr);padding:56px 0}}._pill_fi44x_1{border:var(--hairline);white-space:nowrap;color:var(--text-muted);border-radius:16px;align-items:center;padding:2px 8px;font-size:12px;line-height:14px;display:inline-flex}._required_fi44x_13{color:var(--required)}._section_1lkso_1{margin-top:24px}._header_1lkso_5{border-bottom:var(--hairline);justify-content:space-between;align-items:center;gap:8px;padding-bottom:12px;display:flex}._title_1lkso_14{margin:0;font-size:16px;font-weight:500;line-height:18.4px}._badges_1lkso_21{flex-wrap:wrap;justify-content:flex-end;gap:8px;display:flex}._fields_1lkso_28{padding-top:0}._type_tj3j8_1{font-family:var(--font-mono);color:var(--text-muted);font-size:13px}._model_tj3j8_7{font-family:var(--font-mono);color:var(--text-muted);text-underline-offset:3px;font-size:13px;-webkit-text-decoration:underline #75757580;text-decoration:underline #75757580}._model_tj3j8_7:hover{color:var(--text)}._foldable_lceok_1{position:relative}._row_lceok_5{cursor:pointer;align-items:center;gap:10px;min-height:32px;padding:6px 0;display:flex;position:relative}._tall_lceok_15{min-height:36px;padding:10px 0;line-height:16px}._toggle_lceok_21{width:20px;height:20px;color:var(--text-muted);cursor:pointer;background:0 0;border:0;border-radius:3px;justify-content:center;align-items:center;margin-top:-10px;padding:0;display:inline-flex;position:absolute;top:50%;left:-25px}._row_lceok_5:hover ._toggle_lceok_21{color:var(--text)}._toggle_lceok_21:focus-visible{outline:2px solid var(--accent);outline-offset:1px}._title_lceok_48{flex:1;min-width:0}._right_lceok_53{flex:none}._body_lceok_57{border-left:var(--hairline);margin-bottom:6px;padding-left:16px}._field_pv3dl_1{display:block}._row_pv3dl_5{padding:6px 0}._head_pv3dl_9{flex-wrap:wrap;align-items:baseline;gap:2px 9px;min-height:20px;font-size:13px;line-height:20px;display:flex}._name_pv3dl_20{font-family:var(--font-mono);color:var(--text);word-break:break-word;font-size:13px;font-weight:600}._meta_pv3dl_28{color:var(--text-muted);font-size:13px}._required_pv3dl_33{color:var(--required);font-size:13px}._example_pv3dl_38{color:var(--text-faint);text-underline-offset:3px;cursor:help;font-size:13px;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}._preview_pv3dl_46{font-family:var(--font-mono);color:var(--text);font-size:13px}._description_pv3dl_52{margin:-2px 0 6px}._fields_bqq45_1{display:block}._type_bqq45_5{padding:6px 0 4px;line-height:20px}._responses_f1ur8_1{margin-top:24px}._title_f1ur8_5{border-bottom:var(--hairline);margin:0;padding-bottom:12px;font-size:16px;font-weight:500;line-height:23px}._head_f1ur8_14{align-items:baseline;gap:6px;font-size:13px;line-height:16px;display:flex}._status_f1ur8_22{font-family:var(--font-mono);font-weight:600}._summary_f1ur8_27{color:var(--text-muted)}._empty_f1ur8_31{color:var(--text-muted);margin:4px 0 6px;font-size:14px}._description_f1ur8_37{margin-top:4px}._button_fispn_1{height:26px;font-family:var(--font-body);white-space:nowrap;cursor:pointer;border:0;border-radius:4px;align-items:center;gap:5px;padding:0 10px;font-size:13px;font-weight:600;line-height:16px;display:inline-flex}._dark_fispn_17{background:var(--text);color:#fff}._dark_fispn_17:hover{background:#000}._dark_fispn_17:disabled{opacity:.6;cursor:default}._light_fispn_31{color:#1a1a1a;background:#fff;border-radius:3px;height:24px;padding:1px 8px 1px 6px;font-size:14px;font-weight:500;box-shadow:inset 0 0 0 1px #0000001a}._light_fispn_31:hover{background:#f0f0f0}._button_fispn_1:focus-visible{outline:2px solid var(--accent);outline-offset:2px}._bar_2kn4o_1{border:.5px solid var(--endpoint-border);background:var(--endpoint-background);border-radius:8px;align-items:center;min-height:41px;padding:8px 8px 8px 12px;display:flex;overflow-x:auto}._bar_2kn4o_1>span{margin-right:6px;line-height:19px}._path_2kn4o_18{min-width:0;color:var(--endpoint-path);white-space:nowrap;flex:1;font-size:14px;font-weight:500;line-height:19px}._param_2kn4o_28{color:var(--endpoint-param)}._test_2kn4o_32{flex:none;margin-left:8px}._tabs_1vlyl_1{align-self:stretch;gap:8px;min-width:0;display:flex;overflow-x:auto}._tab_1vlyl_1{font-family:var(--font-body);color:var(--text-muted);cursor:pointer;background:0 0;border:0;padding:0 1px;font-size:14px;line-height:22px;position:relative}._tab_1vlyl_1:hover{color:var(--text)}._active_1vlyl_25{color:var(--text);font-weight:500}._active_1vlyl_25:after{content:"";background:var(--text);height:1px;position:absolute;bottom:0;left:0;right:0}._tab_1vlyl_1:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}._checkbox_1ecj6_1{min-height:36px;color:var(--text-muted);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:6px;padding:7px 12px 7px 6px;font-size:14px;line-height:22px;display:inline-flex;position:relative}._checkbox_1ecj6_1:hover{color:var(--text)}._checkbox_1ecj6_1 input{opacity:0;width:1px;height:1px;position:absolute}._box_1ecj6_26{background:var(--surface-hover);width:16px;height:16px;color:var(--background);border-radius:3px;justify-content:center;align-items:center;display:inline-flex}._checkbox_1ecj6_1 input:checked+._box_1ecj6_26{background:var(--text)}._checkbox_1ecj6_1 input:focus-visible+._box_1ecj6_26{outline:2px solid var(--accent);outline-offset:2px}._code_pk0oo_1{font-family:var(--font-mono);color:var(--json-punct);tab-size:2;margin:0;padding:0;font-size:14px;line-height:19.6px;overflow:auto}._key_pk0oo_12{color:var(--text)}._string_pk0oo_13{color:var(--json-string)}._number_pk0oo_14{color:var(--json-number)}._literal_pk0oo_15{color:var(--json-literal)}._button_lse6e_1{width:24px;height:36px;color:var(--text-faint);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;margin-right:8px;padding:0;display:inline-flex}._button_lse6e_1:hover{color:var(--text)}._button_lse6e_1:focus-visible{outline:2px solid var(--accent);outline-offset:-4px}._card_1xtgd_1{border:var(--hairline);background:var(--surface);border-radius:8px;margin-top:12px;overflow:hidden}._header_1xtgd_9{border-bottom:var(--hairline);justify-content:space-between;align-items:center;gap:12px;min-height:36px;padding-left:12px;display:flex}._actions_1xtgd_19{flex:none;align-items:center;display:flex}._body_1xtgd_25{max-height:440px;padding:8px;overflow:auto}._empty_1xtgd_31{color:var(--text-muted);margin:0;padding:0 4px;font-size:14px;line-height:20px}._footer_1xtgd_39{border-top:var(--hairline);padding:7px 12px;font-size:14px;font-weight:500;line-height:22px}._overlay_pjga8_1{z-index:100;background:#1b1b1b59;position:fixed;inset:0}._dialog_pjga8_11{border:var(--hairline);background:var(--background);border-radius:8px;flex-direction:column;display:flex;position:absolute;inset:60px 24px;overflow:hidden;box-shadow:0 10px 40px #0000002e}._dialog_pjga8_11:focus{outline:none}._close_pjga8_30{background:var(--background);width:32px;height:32px;color:var(--text);cursor:pointer;border:0;border-radius:50%;justify-content:center;align-items:center;display:inline-flex;position:absolute;top:14px;right:16px}._close_pjga8_30:focus-visible{outline:2px solid var(--accent)}@media (max-width:900px){._dialog_pjga8_11{border-radius:0;inset:0}._close_pjga8_30{z-index:1;top:8px;right:8px}}._section_16tu7_1{border-bottom:var(--hairline)}._heading_16tu7_5{margin:0}._header_16tu7_9{background:var(--surface);width:100%;min-height:36px;color:var(--text);font-family:var(--font-body);text-align:left;cursor:pointer;border:0;align-items:center;gap:8px;padding:8px 12px;font-size:14px;font-weight:500;line-height:20px;display:flex}._header_16tu7_9:hover{background:var(--surface-hover)}._header_16tu7_9:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}._chevron_16tu7_36{color:var(--text-muted);flex:none}._title_16tu7_41{flex:none}._note_16tu7_45{color:var(--text-muted);font-weight:400}._right_16tu7_50{color:var(--text-muted);margin-left:auto;font-weight:400}._body_16tu7_56{border-top:var(--hairline)}._table_rhk4n_1{border-collapse:collapse;table-layout:fixed;width:100%}._table_rhk4n_1 tr+tr td{border-top:var(--hairline)}._check_rhk4n_11{border-right:var(--hairline);text-align:center;width:32px;padding:0}._cell_rhk4n_18{padding:0}._cell_rhk4n_18+._cell_rhk4n_18{border-left:var(--hairline)}._input_rhk4n_26{width:100%;height:32px;color:var(--text);font-family:var(--font-body);background:0 0;border:0;padding:0 8px;font-size:14px;display:block}._input_rhk4n_26::placeholder{color:var(--text-faint)}._input_rhk4n_26:read-only{color:var(--text-muted)}._input_rhk4n_26:focus{outline:2px solid var(--accent);outline-offset:-2px}._box_rhk4n_51{cursor:pointer;justify-content:center;align-items:center;width:32px;height:32px;display:inline-flex;position:relative}._box_rhk4n_51 input{opacity:0;width:1px;height:1px;position:absolute}._box_rhk4n_51 span{width:16px;height:16px;color:var(--text);border-radius:3px;justify-content:center;align-items:center;display:inline-flex}._box_rhk4n_51 input:focus-visible+span{outline:2px solid var(--accent)}._empty_k0qvo_1{color:var(--text-muted);text-align:center;margin:0;padding:48px 24px;font-size:14px}._error_k0qvo_9{color:var(--text-muted);padding:16px 12px;font-size:14px;line-height:20px}._error_k0qvo_9 strong{color:var(--method-delete)}._error_k0qvo_9 p{margin:6px 0 0}._summary_k0qvo_24{border-bottom:var(--hairline);min-height:40px;color:var(--text);align-items:center;gap:8px;padding:0 12px;font-size:14px;display:flex}._status_k0qvo_35{text-underline-offset:3px;text-decoration:underline}._dot_k0qvo_40{border-radius:50%;width:7px;height:7px}._ok_k0qvo_46{background:var(--method-post)}._bad_k0qvo_50{background:var(--method-delete)}._headers_k0qvo_54{margin:0;font-size:13px}._headerRow_k0qvo_59{grid-template-columns:minmax(0,2fr) minmax(0,3fr);display:grid}._headerRow_k0qvo_59+._headerRow_k0qvo_59{border-top:var(--hairline)}._headerRow_k0qvo_59 dt,._headerRow_k0qvo_59 dd{overflow-wrap:anywhere;margin:0;padding:7px 12px}._headerRow_k0qvo_59 dt{color:var(--text-muted);border-right:var(--hairline)}._views_k0qvo_80{justify-content:flex-end;gap:2px;padding:6px 12px 0;display:flex}._view_k0qvo_80{color:var(--text-muted);font-family:var(--font-body);cursor:pointer;background:0 0;border:0;border-radius:3px;padding:2px 8px;font-size:13px}._viewActive_k0qvo_98{background:var(--surface);color:var(--text)}._body_k0qvo_103{padding:8px 12px 12px}._raw_k0qvo_107{font-family:var(--font-mono);white-space:pre-wrap;overflow-wrap:anywhere;margin:0;font-size:13px;line-height:19px}._noBody_k0qvo_116{color:var(--text-muted);margin:0;font-size:14px}._top_dnzw1_1{border-bottom:var(--hairline);justify-content:center;padding:8px 12px;display:flex}._urlBar_dnzw1_8{width:100%;max-width:768px;min-height:32px;box-shadow:inset 0 0 0 .5px var(--border);background:#fafafa;border-radius:6px;align-items:center;gap:4px;padding:3px;display:flex}._method_dnzw1_21{padding:0 4px 0 8px}._method_dnzw1_21 span{font-size:12px;font-weight:600}._url_dnzw1_8{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-family:var(--font-mono);color:var(--text-muted);flex:1;padding:0 4px;font-size:14px;line-height:16px;overflow:hidden}._urlBar_dnzw1_8 button:last-child{flex:none}._panes_dnzw1_47{flex:1;grid-template-columns:minmax(0,1fr) minmax(0,1fr);min-height:0;display:grid}._pane_dnzw1_47{flex-direction:column;min-height:0;display:flex;position:relative;overflow-y:auto}._pane_dnzw1_47+._pane_dnzw1_47{border-left:var(--hairline)}._paneTitle_dnzw1_66{border-bottom:var(--hairline);margin:0;padding:12px;font-size:14px;font-weight:500;line-height:16px}._body_dnzw1_75{resize:vertical;background:var(--background);width:100%;color:var(--text);font-family:var(--font-mono);tab-size:2;border:0;padding:10px 12px;font-size:13px;line-height:19px;display:block}._body_dnzw1_75:focus{outline:2px solid var(--accent);outline-offset:-2px}._hint_dnzw1_94{color:var(--text-faint);text-align:right;margin:auto 0 0;padding:12px;font-size:13px}._hint_dnzw1_94 kbd{font-family:var(--font-body)}@media (max-width:900px){._top_dnzw1_1{padding-right:52px}._panes_dnzw1_47{grid-template-columns:minmax(0,1fr);overflow-y:auto}._pane_dnzw1_47{overflow:visible}._pane_dnzw1_47+._pane_dnzw1_47{border-left:0;border-top:var(--hairline)}}._operation_yif9z_1{border-top:var(--hairline);grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:48px;padding:90px 0;display:grid}._left_yif9z_9{min-width:0}._title_yif9z_13{margin:0 0 9px;font-size:24px;font-weight:600;line-height:34.8px}._right_yif9z_20{min-width:0}._sticky_yif9z_24{position:sticky;top:24px}._actions_yif9z_29{min-height:34px;color:var(--text);justify-content:flex-end;align-items:center;gap:6px;margin-bottom:11px;font-size:14px;display:flex}._actions_yif9z_29 svg{color:var(--text-muted)}@media (max-width:1100px){._operation_yif9z_1{grid-template-columns:minmax(0,1fr);row-gap:28px;padding:56px 0}._sticky_yif9z_24{position:static}._actions_yif9z_29{min-height:0;margin-bottom:8px}}._models_jw02e_1{border-top:1px solid var(--hairline);max-width:760px;padding:72px 0}._title_jw02e_7{margin:0 0 24px;font-size:24px;font-weight:600}._model_jw02e_1{border:1px solid var(--border);border-radius:8px;margin-bottom:16px;scroll-margin-top:24px}._name_jw02e_20{border-bottom:1px solid var(--border);background:var(--surface);font-family:var(--font-mono);border-radius:8px 8px 0 0;margin:0;padding:10px 16px;font-size:14px;font-weight:600}._body_jw02e_31{padding:4px 16px 6px 34px}._app_vr0g8_1{min-height:100vh}._sidebar_vr0g8_5{z-index:20;width:var(--sidebar-width);border-right:var(--hairline);background:var(--background);flex-direction:column;display:flex;position:fixed;top:0;bottom:0;left:0}._content_vr0g8_18{margin-left:var(--sidebar-width);max-width:calc(var(--sidebar-width) + 1152px);padding:0 60px 120px}._topbar_vr0g8_24,._backdrop_vr0g8_28{display:none}._message_vr0g8_32{max-width:560px;color:var(--text-muted);margin:80px auto;padding:0 24px;line-height:1.6}._message_vr0g8_32 strong{color:var(--text)}@media (max-width:900px){._topbar_vr0g8_24{z-index:30;border-bottom:var(--hairline);background:var(--background);align-items:center;gap:10px;height:52px;padding:0 12px;display:flex;position:sticky;top:0}._topbarTitle_vr0g8_58{text-overflow:ellipsis;white-space:nowrap;font-weight:600;overflow:hidden}._menuButton_vr0g8_65{width:36px;height:36px;color:var(--text);cursor:pointer;background:0 0;border:0;border-radius:3px;justify-content:center;align-items:center;display:inline-flex}._menuButton_vr0g8_65:hover{background:var(--surface)}._sidebar_vr0g8_5{transition:transform .2s;top:52px;transform:translate(-100%)}._sidebarOpen_vr0g8_88{transform:none}._backdrop_vr0g8_28{z-index:10;background:#1b1b1b4d;display:block;position:fixed;inset:52px 0 0}._content_vr0g8_18{margin-left:0;padding:0 28px 80px}._content_vr0g8_18 section[id]{scroll-margin-top:52px}}:root{--accent:#0082d0;--background:#fff;--surface:#f6f6f6;--surface-hover:#e7e7e7;--border:#dfdfdf;--hairline:.5px solid #dfdfdf;--text:#1b1b1b;--text-muted:#757575;--text-faint:#8e8e8e;--font-body:ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;--required:#ff6605;--method-get:#0082d0;--method-post:#069061;--method-put:#ff6605;--method-patch:#edbe20;--method-delete:#ef0006;--method-get-dark:#1ea7ff;--method-post-dark:#00b648;--method-put-dark:#ff8c3a;--method-patch-dark:#ffc93d;--method-delete-dark:#ff4d4f;--endpoint-background:#1a1a1a;--endpoint-border:#2d2d2d;--endpoint-path:#a4a4a4;--endpoint-param:#e7e7e7;--json-string:#0082d0;--json-number:#069061;--json-literal:#ff6605;--json-punct:#757575;--sidebar-width:288px}html{-webkit-text-size-adjust:100%}body{background:var(--background);color:var(--text);font-family:var(--font-body);-webkit-font-smoothing:antialiased;margin:0;font-size:16px;line-height:1.15}a{color:inherit}code{font-family:var(--font-mono)}*,:before,:after{box-sizing:border-box}
|
|
2
|
+
/*$vite$:1*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h={},g=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function y(e,t){for(var n in t)e[n]=t[n];return e}function ee(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function b(t,n,r){var i,a,o,s={};for(o in n)o==`key`?i=n[o]:o==`ref`?a=n[o]:s[o]=n[o];if(arguments.length>2&&(s.children=arguments.length>3?e.call(arguments,2):r),typeof t==`function`&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return x(t,s,i,a,null)}function x(e,r,i,a,o){var s={type:e,props:r,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++n,__i:-1,__u:0};return o==null&&t.vnode!=null&&t.vnode(s),s}function S(e){return e.children}function te(e,t){this.props=e,this.context=t}function C(e,t){if(t==null)return e.__?C(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?C(e):null}function w(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,i=[],a=[],o=y({},n);o.__v=n.__v+1,t.vnode&&t.vnode(o),se(e.__P,o,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,i,r??C(n),!!(32&n.__u),a),o.__v=n.__v,o.__.__k[o.__i]=o,le(i,o,a),n.__e=n.__=null,o.__e!=r&&T(o)}}function T(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),T(e)}function E(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!D.__r++||i!=t.debounceRendering)&&((i=t.debounceRendering)||a)(D)}function D(){try{for(var e,t=1;r.length;)r.length>t&&r.sort(o),e=r.shift(),t=r.length,w(e)}finally{r.length=D.__r=0}}function ne(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,_,v,y=r&&r.__k||g,ee=t.length;for(c=O(n,t,y,c,ee),d=0;d<ee;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&y[p.__i]||h,p.__i=d,v=se(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&fe(f.ref,null,p),u.push(p.ref,p.__c||m,p)),_==null&&m!=null&&(_=m),4&p.__u?(c=re(p,c,e),f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=_,c}function O(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=x(null,o,null,null,null):v(o)?o=e.__k[a]=x(S,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=x(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=ie(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=C(s)),pe(s,s));return r}function re(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=re(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=C(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ie(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ae(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||_.test(t)?n:n+`px`}function k(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ae(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ae(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(u,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[l]=r[l]:(n[l]=d,e.addEventListener(t,a?p:f,a)):e.removeEventListener(t,a?p:f,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function oe(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[c]==null)n[c]=d++;else if(n[c]<r[l])return;return r(t.event?t.event(n):n)}}}function se(e,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,_,b,x,w,T,E,D,O,re,ie,ae,k=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),o=[c=n.__e=r.__e]),(d=t.__b)&&d(n);n:if(typeof k==`function`){f=s.length;try{if(w=n.props,T=k.prototype&&k.prototype.render,E=(d=k.contextType)&&i[d.__c],D=d?E?E.props.value:d.__:i,r.__c?x=(p=n.__c=r.__c).__=p.__E:(T?n.__c=p=new k(w,D):(n.__c=p=new te(w,D),p.constructor=k,p.render=me),E&&E.sub(p),p.state||(p.state={}),p.__n=i,m=p.__d=!0,p.__h=[],p._sb=[]),T&&p.__s==null&&(p.__s=p.state),T&&k.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=y({},p.__s)),y(p.__s,k.getDerivedStateFromProps(w,p.__s))),h=p.props,_=p.state,p.__v=n,m)T&&k.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),T&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(T&&k.getDerivedStateFromProps==null&&w!==h&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(w,D),n.__v==r.__v||!p.__e&&p.shouldComponentUpdate!=null&&!1===p.shouldComponentUpdate(w,p.__s,D)){n.__v!=r.__v&&(p.props=w,p.state=p.__s,p.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(e){e&&(e.__=n)}),g.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p),c=C(r);break n}p.componentWillUpdate!=null&&p.componentWillUpdate(w,p.__s,D),T&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(h,_,b)})}if(p.context=D,p.props=w,p.__P=e,p.__e=!1,O=t.__r,re=0,T)p.state=p.__s,p.__d=!1,O&&O(n),d=p.render(p.props,p.state,p.context),g.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,O&&O(n),d=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++re<25);p.state=p.__s,p.getChildContext!=null&&(i=y(y({},i),p.getChildContext())),T&&!m&&p.getSnapshotBeforeUpdate!=null&&(b=p.getSnapshotBeforeUpdate(h,_)),ie=d!=null&&d.type===S&&d.key==null?ue(d.props.children):d,c=ne(e,v(ie)?ie:[ie],n,r,i,a,o,s,c,l,u),p.base=n.__e,n.__u&=-161,p.__h.length&&s.push(p),x&&(p.__E=p.__=null)}catch(e){if(s.length=f,n.__v=null,l||o!=null){if(e.then){for(n.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o!=null&&(o[o.indexOf(c)]=null),n.__e=c}else if(o!=null)for(ae=o.length;ae--;)ee(o[ae])}else n.__e=r.__e;n.__k??=r.__k||[],e.then||ce(n),t.__e(e,n,r)}}else o==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):c=n.__e=de(r.__e,n,r,i,a,o,s,l,u);return(d=t.diffed)&&d(n),128&n.__u?void 0:c}function ce(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ce))}function le(e,n,r){for(var i=0;i<r.length;i++)fe(r[i],r[++i],r[++i]);t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function ue(e){return typeof e!=`object`||!e||e.__b>0?e:v(e)?e.map(ue):e.constructor===void 0?y({},e):null}function de(n,r,i,a,o,s,c,l,u){var d,f,p,m,g,_,y,b=i.props||h,x=r.props,S=r.type;if(S==`svg`?o=`http://www.w3.org/2000/svg`:S==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((g=s[d])&&`setAttribute`in g==!!S&&(S?g.localName==S:g.nodeType==3)){n=g,s[d]=null;break}}if(n==null){if(S==null)return document.createTextNode(x);n=document.createElementNS(o,S,x.is&&x),l&&=(t.__m&&t.__m(r,s),!1),s=null}if(S==null)b===x||l&&n.data==x||(n.data=x);else{if(s=S==`textarea`&&x.defaultValue!=null?null:s&&e.call(n.childNodes),!l&&s!=null)for(b={},d=0;d<n.attributes.length;d++)b[(g=n.attributes[d]).name]=g.value;for(d in b)g=b[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in x||d==`value`&&`defaultValue`in x||d==`checked`&&`defaultChecked`in x||k(n,d,null,g,o);for(d in x)g=x[d],d==`children`?m=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?_=g:d==`checked`?y=g:l&&typeof g!=`function`||b[d]===g||k(n,d,g,b[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==n.innerHTML)||(n.innerHTML=f.__html),r.__k=[];else if(p&&(n.innerHTML=``),ne(r.type==`template`?n.content:n,v(m)?m:[m],r,i,a,S==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:i.__k&&C(i,0),l,u),s!=null)for(d=s.length;d--;)ee(s[d]);l&&S!=`textarea`||(d=`value`,S==`progress`&&_==null?n.removeAttribute(`value`):_!=null&&(_!==n[d]||S==`progress`&&!_||S==`option`&&_!=b[d])&&k(n,d,_,b[d],o),d=`checked`,y!=null&&y!=n[d]&&k(n,d,y,b[d],o))}return n}function fe(e,n,r){try{if(typeof e==`function`){var i=typeof e.__u==`function`;i&&e.__u(),i&&n==null||(e.__u=e(n))}else e.current=n}catch(e){t.__e(e,r)}}function pe(e,n,r){var i,a;if(t.unmount&&t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||fe(i,null,n)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){t.__e(e,n)}i.base=i.__P=i.__n=null}if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&pe(i[a],n,r||typeof e.type!=`function`);r||ee(e.__e),e.__c=e.__=e.__e=void 0}function me(e,t,n){return this.constructor(e,n)}function he(n,r,i){var a,o,s,c;r==document&&(r=document.documentElement),t.__&&t.__(n,r),o=(a=typeof i==`function`)?null:i&&i.__k||r.__k,s=[],c=[],se(r,n=(!a&&i||r).__k=b(S,null,[n]),o||h,h,r.namespaceURI,!a&&i?[i]:o?null:r.firstChild?e.call(r.childNodes):null,s,!a&&i?i:o?o.__e:r.firstChild,a,c),le(s,n,c),n.props.children=null}function ge(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,E(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c=`__cC`+m++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}e=g.slice,t={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},n=0,te.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=y({},this.state);typeof e==`function`&&(e=e(y({},n),this.props)),e&&y(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),E(this))},te.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),E(this))},te.prototype.render=S,r=[],a=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o=function(e,t){return e.__v.__b-t.__v.__b},D.__r=0,s=Math.random().toString(8),c=`__d`+s,l=`__a`+s,u=/(PointerCapture)$|Capture$/i,d=0,f=oe(!1),p=oe(!0),m=0;var A,j,_e,ve,ye=0,be=[],M=t,xe=M.__b,Se=M.__r,Ce=M.diffed,we=M.__c,Te=M.unmount,Ee=M.__;function De(e,t){M.__h&&M.__h(j,e,ye||t),ye=0;var n=j.__H||(j.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function N(e){return ye=1,Oe(ze,e)}function Oe(e,t,n){var r=De(A++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ze(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=j,!j.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};j.__f=!0;var a=j.shouldComponentUpdate,o=j.componentWillUpdate;j.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},j.shouldComponentUpdate=i}return r.__N||r.__}function ke(e,t){var n=De(A++,3);!M.__s&&Re(n.__H,t)&&(n.__=e,n.u=t,j.__H.__h.push(n))}function Ae(e){return ye=5,je(function(){return{current:e}},[])}function je(e,t){var n=De(A++,7);return Re(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Me(e){var t=j.context[e.__c],n=De(A++,9);return n.c=e,t?(n.__??(n.__=!0,t.sub(j)),t.props.value):e.__}function Ne(){for(var e;e=be.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ie),t.__h.some(Le),t.__h=[]}catch(n){t.__h=[],M.__e(n,e.__v)}}}M.__b=function(e){j=null,xe&&xe(e)},M.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ee&&Ee(e,t)},M.__r=function(e){Se&&Se(e),A=0;var t=(j=e.__c).__H;t&&(_e===j?(t.__h=[],j.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Ie),t.__h.some(Le),t.__h=[],A=0)),_e=j},M.diffed=function(e){Ce&&Ce(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(be.push(t)!==1&&ve===M.requestAnimationFrame||((ve=M.requestAnimationFrame)||Fe)(Ne)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),_e=j=null},M.__c=function(e,t){t.some(function(e){try{e.__h.some(Ie),e.__h=e.__h.filter(function(e){return!e.__||Le(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],M.__e(n,e.__v)}}),we&&we(e,t)},M.unmount=function(e){Te&&Te(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Ie(e)}catch(e){t=e}}),n.__H=void 0,t&&M.__e(t,n.__v))};var Pe=typeof requestAnimationFrame==`function`;function Fe(e){var t,n=function(){clearTimeout(r),Pe&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Pe&&(t=requestAnimationFrame(n))}function Ie(e){var t=j,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),j=t}function Le(e){var t=j;e.__c=e.__(),j=t}function Re(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function ze(e,t){return typeof t==`function`?t(e):t}var Be=[`get`,`put`,`post`,`delete`,`options`,`head`,`patch`,`trace`],Ve=/^#\/components\/schemas\/([^/]+)$/;function He(e,t){if(typeof t!=`string`||!t.startsWith(`#/`))return;let n=e;for(let e of t.slice(2).split(`/`)){let t=decodeURIComponent(e).replace(/~1/g,`/`).replace(/~0/g,`~`);if(typeof n!=`object`||!n)return;n=n[t]}return n}function Ue(e){let t=typeof e==`string`&&e.match(Ve);return t?decodeURIComponent(t[1]):null}function We(e,t,n=new Set){if(!t||typeof t!=`object`||!t.$ref||n.has(t.$ref))return t;n.add(t.$ref);let{$ref:r,...i}=t,a=We(e,He(e,r),n);return a&&typeof a==`object`?{...a,...i}:i}function Ge(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`default`}function Ke(e){if(!e||typeof e!=`object`)return null;let t=e[`application/json`]?`application/json`:Object.keys(e)[0];return t?{contentType:t,schema:e[t]?.schema??null}:null}function qe(e,t,n){let r=new Map;for(let i of[...t.parameters||[],...n.parameters||[]]){let t=We(e,i);t?.name&&t.in&&r.set(`${t.in}:${t.name}`,{name:t.name,in:t.in,required:t.in===`path`||!!t.required,description:t.description||``,schema:t.schema||{}})}let i={path:[],query:[],header:[],cookie:[]};for(let e of r.values())i[e.in]?.push(e);return i}function Je(e,t){let n=We(e,t.requestBody),r=n&&Ke(n.content);return r?{...r,required:!!n.required,description:n.description||``}:null}function Ye(e,t){return Object.entries(t.responses||{}).map(([t,n])=>{let r=We(e,n)||{},i=Ke(r.content);return{status:t,description:r.description||``,contentType:i?.contentType??null,schema:i?.schema??null}})}function Xe(e,t){return(t.security??e.security??[]).some(e=>e&&Object.keys(e).length>0)}function Ze(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`The document is not a JSON object.`);if(!e.openapi&&!e.swagger)throw Error(`The document has no "openapi" version field.`);if(e.paths&&typeof e.paths!=`object`)throw Error(`"paths" must be an object.`);let t=[];for(let[n,r]of Object.entries(e.paths||{}))if(r&&typeof r==`object`)for(let i of Object.keys(r).filter(e=>Be.includes(e))){let a=r[i];a&&typeof a==`object`&&t.push({method:i.toUpperCase(),path:n,tag:Array.isArray(a.tags)&&a.tags[0]?String(a.tags[0]):null,summary:a.summary||``,description:a.description||``,auth:Xe(e,a),params:qe(e,r,a),body:Je(e,a),responses:Ye(e,a)})}let n=new Map((e.tags||[]).filter(e=>e?.name).map(e=>[e.name,e])),r=[...n.keys()];for(let e of t)e.tag&&!r.includes(e.tag)&&r.push(e.tag);let i=r.map(e=>({name:e,id:`tag/${Ge(e)}`,description:n.get(e)?.description||``,operations:t.filter(t=>t.tag===e)})).filter(e=>e.operations.length);for(let e of t)e.id=e.tag?`tag/${Ge(e.tag)}/${e.method}${e.path}`:`operation/${e.method}${e.path}`,e.label=e.summary||`${e.method} ${e.path}`;let a=Object.entries(e.components?.schemas||{}).map(([e,t])=>({name:e,id:`model/${e}`,schema:t}));return{info:{title:e.info?.title||`API`,version:e.info?.version||``,description:e.info?.description||``},openapi:String(e.openapi||e.swagger),untagged:t.filter(e=>!e.tag),groups:i,models:a,operations:t}}var Qe=ge({}),$e=ge({base:``,token:``,setToken:()=>{}});function et(e,t){if(!t||typeof t!=`object`||!t.$ref)return{schema:t||{},model:null};let{$ref:n,...r}=t;return{schema:{...He(e,n)||{},...r},model:Ue(n)}}function tt(e,t){if(!Array.isArray(t?.allOf))return t;let{allOf:n,...r}=t,i={...r,properties:{...r.properties},required:[...r.required||[]]};for(let t of n){let n=tt(e,et(e,t).schema);Object.assign(i.properties,n.properties),i.required.push(...n.required||[]),!i.type&&n.type&&(i.type=n.type),!i.description&&n.description&&(i.description=n.description)}return Object.keys(i.properties).length||delete i.properties,i.required.length||delete i.required,i}function nt(e){let t=Array.isArray(e.type)?e.type:e.type?[e.type]:[],n=t.filter(e=>e!==`null`).join(` | `);return!n&&e.properties&&(n=`object`),!n&&e.items&&(n=`array`),!n&&e.enum&&(n=typeof e.enum[0]),{type:n,nullable:t.includes(`null`)||e.nullable===!0}}function rt(e){let t=[],n=(n,r)=>e[n]!==void 0&&t.push(`${r}: ${e[n]}`);return n(`minLength`,`min length`),n(`maxLength`,`max length`),n(`minimum`,`min`),n(`maximum`,`max`),n(`exclusiveMinimum`,`greater than`),n(`exclusiveMaximum`,`less than`),n(`minItems`,`min items`),n(`maxItems`,`max items`),n(`minProperties`,`min properties`),n(`maxProperties`,`max properties`),n(`pattern`,`pattern`),e.default!==void 0&&t.push(`default: ${JSON.stringify(e.default)}`),t}function it(e){if(Array.isArray(e.examples)&&e.examples.length)return e.examples[0];if(e.example!==void 0)return e.example}function at(e,t,n=new Set){let{schema:r,model:i}=et(e,t),a=tt(e,r),{type:o,nullable:s}=nt(a),c=!!i&&n.has(i),l=null;if(o===`array`&&a.items){let t=et(e,a.items);l={model:t.model,schema:tt(e,t.schema)}}let u=l?.schema.properties?l.schema:a.properties?a:null,d=a.oneOf||a.anyOf||null,f=l?.model||i,p=f?new Set([...n,f]):n;return{schema:a,model:i,type:o,nullable:s,items:l,inner:c?null:u,variants:c?null:d,nextSeen:p}}function ot(e){let{schema:t,nullable:n}=e,r=[];return t.format&&r.push(t.format),n&&r.push(`nullable`),r.push(...rt(t)),Array.isArray(t.enum)&&r.push(`enum: ${t.enum.map(e=>JSON.stringify(e)).join(`, `)}`),r}function st(e){let t=Object.keys(e?.properties||{});return t.length?`{ ${t.slice(0,4).join(`, `)}${t.length>4?`, …`:``} }`:``}var ct={"date-time":`2026-01-01T00:00:00Z`,date:`2026-01-01`,time:`00:00:00Z`,email:`user@example.com`,uri:`https://example.com`,url:`https://example.com`,uuid:`123e4567-e89b-12d3-a456-426614174000`,ipv4:`127.0.0.1`,ipv6:`::1`,hostname:`example.com`},lt=8;function P(e,t,n=0,r=new Set){let{schema:i,model:a}=et(e,t);if(a&&r.has(a))return{};let o=a?new Set([...r,a]):r,s=tt(e,i),c=it(s);if(c!==void 0)return c;if(s.default!==void 0)return s.default;if(s.const!==void 0)return s.const;if(Array.isArray(s.enum)&&s.enum.length)return s.enum[0];let l=s.oneOf||s.anyOf;if(Array.isArray(l)&&l.length)return P(e,l[0],n,o);if(n>lt)return null;let{type:u}=nt(s);if(u===`object`||s.properties){let t={};for(let[r,i]of Object.entries(s.properties||{}))t[r]=P(e,i,n+1,o);return t}return u===`array`?s.items?[P(e,s.items,n+1,o)]:[]:u===`string`?ct[s.format]??``:u===`integer`||u===`number`?s.minimum??1:u===`boolean`||null}function ut(e,t){let n=e.servers?.[0]?.url;return(n?new URL(n,t).href:new URL(t).origin).replace(/\/+$/,``)}function dt(e){return e==null?``:typeof e==`string`?e:JSON.stringify(e)}function ft(e,t){let n=(t,n)=>({key:t.name,value:dt(P(e,t.schema)),enabled:n}),r=[{key:`accept`,value:`application/json`,enabled:!0}];t.body&&r.push({key:`content-type`,value:t.body.contentType,enabled:!0}),r.push(...t.params.header.map(e=>n(e,e.required)));let i=t.body?t.body.contentType.includes(`json`)?JSON.stringify(P(e,t.body.schema),null,2):dt(P(e,t.body.schema)):null;return{path:t.params.path.map(e=>n(e,!0)),query:t.params.query.map(e=>n(e,e.required)),headers:r,body:i}}function pt(e,t,n,r){let i=Object.fromEntries(n.map(e=>[e.key,e.value])),a=t.replace(/\{([^}]+)\}/g,(e,t)=>i[t]?encodeURIComponent(i[t]):e),o=new URLSearchParams;for(let e of r)e.enabled&&e.key&&o.append(e.key,e.value);let s=o.toString();return e+a+(s?`?${s}`:``)}function mt({op:e,base:t,inputs:n,token:r}){let i=n.headers.filter(e=>e.enabled&&e.key).map(e=>[e.key,e.value]),a=i.some(([e])=>e.toLowerCase()===`authorization`);e.auth&&r&&!a&&i.push([`authorization`,`Bearer ${r}`]);let o=n.body!==null&&![`GET`,`HEAD`].includes(e.method);return{method:e.method,url:pt(t,e.path,n.path,n.query),headers:i,body:o?n.body:void 0}}function ht(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function gt(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return null}}var _t={200:`OK`,201:`Created`,202:`Accepted`,204:`No Content`,301:`Moved Permanently`,302:`Found`,304:`Not Modified`,400:`Bad Request`,401:`Unauthorized`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,409:`Conflict`,413:`Payload Too Large`,415:`Unsupported Media Type`,422:`Unprocessable Entity`,429:`Too Many Requests`,500:`Internal Server Error`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`};function vt(e,t){return t||_t[e]||``}var yt=`maxserver-docs:token`;function bt(){try{return localStorage.getItem(yt)||``}catch{return``}}function xt(){let[e,t]=N(bt);return[e,e=>{t(e);try{e?localStorage.setItem(yt,e):localStorage.removeItem(yt)}catch{}}]}var St=`maxserver-docs:specs`,Ct=5;function wt(e=globalThis.localStorage){try{let t=JSON.parse(e.getItem(St)||`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Tt(e,t=globalThis.localStorage){try{let n=[e,...wt(t).filter(t=>t!==e)].slice(0,Ct);t.setItem(St,JSON.stringify(n))}catch{}}var Et={bar:`_bar_18yta_1`,input:`_input_18yta_5`},Dt=0;Array.isArray;function F(e,n,r,i,a,o){n||={};var s,c,l=n;if(`ref`in l)for(c in l={},n)c==`ref`?s=n[c]:l[c]=n[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Dt,__i:-1,__u:0,__source:a,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return t.vnode&&t.vnode(u),u}function Ot({url:e}){return F(`form`,{class:Et.bar,onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget).get(`spec`).trim();t&&location.assign(`?spec=${encodeURIComponent(t)}`)},children:[F(`input`,{class:Et.input,name:`spec`,type:`url`,defaultValue:e,list:`maxserver-docs-recent-specs`,"aria-label":`OpenAPI spec URL`,placeholder:`https://…/openapi.json`,spellcheck:!1}),F(`datalist`,{id:`maxserver-docs-recent-specs`,children:wt().map(e=>F(`option`,{value:e},e))})]})}var kt=120;function At(e){let[t,n]=N(()=>decodeURIComponent(location.hash.slice(1))||`introduction`);return ke(()=>{if(!e)return;let t=decodeURIComponent(location.hash.slice(1));t&&document.getElementById(t)?.scrollIntoView({behavior:`instant`,block:`start`});let r=[...document.querySelectorAll(`[data-anchor]`)],i=0,a=()=>{i=0;let e=r[0]?.id;for(let t of r)if(t.getBoundingClientRect().top-kt<=0)e=t.id;else break;e&&(n(e),decodeURIComponent(location.hash.slice(1))!==e&&history.replaceState(null,``,`#${e}`))},o=()=>{i||=requestAnimationFrame(a)};return addEventListener(`scroll`,o,{passive:!0}),()=>{removeEventListener(`scroll`,o),cancelAnimationFrame(i)}},[e]),t}var jt={plus:`M8 3v10M3 8h10`,minus:`M3 8h10`,chevronRight:`M6 3l5 5-5 5`,chevronDown:`M3 6l5 5 5-5`,lock:`M4.5 7V5a3.5 3.5 0 0 1 7 0v2M3.5 7h9v6.5h-9z`,copy:`M5.5 5.5h7v7h-7zM3.5 10.5v-7h7`,check:`M3 8.5l3 3 7-7`,menu:`M2.5 4h11M2.5 8h11M2.5 12h11`,close:`M4 4l8 8M12 4l-8 8`,download:`M8 2.5v8M4.5 7L8 10.5 11.5 7M3 13.5h10`,play:`M5 3.5v9l7-4.5z`,eye:`M1.5 8s2.5-4.5 6.5-4.5S14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8zM8 10a2 2 0 1 0 0-4 2 2 0 0 0 0 4z`,eyeOff:`M2 2l12 12M6.5 4a6.6 6.6 0 0 1 1.5-.5c4 0 6.5 4.5 6.5 4.5a11 11 0 0 1-1.7 2.2M10 12.1a6.3 6.3 0 0 1-2 .4c-4 0-6.5-4.5-6.5-4.5a11 11 0 0 1 2.4-2.8`};function I({name:e,size:t=16,class:n}){return F(`svg`,{class:n,width:t,height:t,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:F(`path`,{d:jt[e]})})}var Mt={badge:`_badge_687h8_1`,short:`_short_687h8_8`,get:`_get_687h8_15`,post:`_post_687h8_16`,put:`_put_687h8_17`,patch:`_patch_687h8_18`,delete:`_delete_687h8_19`,dark:`_dark_687h8_21`},Nt={DELETE:`DEL`,OPTIONS:`OPT`};function Pt({method:e,short:t=!1,dark:n=!1}){let r=e.toUpperCase();return F(`span`,{class:`${Mt.badge} ${Mt[r.toLowerCase()]||``} ${n?Mt.dark:``} ${t?Mt.short:``}`,children:t&&Nt[r]||r})}var L={group:`_group_313i3_1`,header:`_header_313i3_7`,chevron:`_chevron_313i3_34`,items:`_items_313i3_38`,item:`_item_313i3_38`,active:`_active_313i3_75`,label:`_label_313i3_81`};function Ft({title:e,items:t,open:n,onToggle:r,activeId:i,onNavigate:a}){return F(`li`,{class:L.group,children:[F(`button`,{type:`button`,class:L.header,"aria-expanded":n,onClick:r,children:[F(`span`,{children:e}),F(I,{name:n?`chevronDown`:`chevronRight`,size:14,class:L.chevron})]}),n&&F(`ul`,{class:L.items,children:t.map(e=>F(`li`,{children:F(`a`,{href:`#${e.id}`,onClick:a,class:`${L.item} ${e.id===i?L.active:``}`,"aria-current":e.id===i?`location`:void 0,children:[F(`span`,{class:L.label,children:e.label}),e.method&&F(Pt,{method:e.method,short:!0})]})},e.id))})]})}var It={sidebar:`_sidebar_oqs2u_1`,list:`_list_oqs2u_8`,link:`_link_oqs2u_17`,active:`_active_oqs2u_35`,label:`_label_oqs2u_41`};function Lt({model:e,activeId:t,onNavigate:n}){let[r,i]=N(()=>new Set),a=t?.startsWith(`model/`)?`models`:e.groups.find(e=>t===e.id||t?.startsWith(`${e.id}/`))?.id;ke(()=>{a&&!r.has(a)&&i(new Set([...r,a]))},[a]);let o=e=>{let t=new Set(r);t.has(e)?t.delete(e):t.add(e),i(t)},s=(e,r,i)=>F(`li`,{children:F(`a`,{href:`#${e}`,onClick:n,class:`${It.link} ${e===t?It.active:``}`,"aria-current":e===t?`location`:void 0,children:[F(`span`,{class:It.label,children:r}),i&&F(Pt,{method:i,short:!0})]})},e);return F(`nav`,{class:It.sidebar,"aria-label":`API reference`,children:F(`ul`,{class:It.list,children:[s(`introduction`,`Introduction`),e.untagged.map(e=>s(e.id,e.label,e.method)),e.groups.map(e=>F(Ft,{title:e.name,open:r.has(e.id),onToggle:()=>o(e.id),items:e.operations.map(e=>({id:e.id,label:e.label,method:e.method})),activeId:t,onNavigate:n},e.id)),e.models.length>0&&F(Ft,{title:`Models`,open:r.has(`models`),onToggle:()=>o(`models`),items:e.models.map(e=>({id:e.id,label:e.name})),activeId:t,onNavigate:n})]})})}var Rt=/^(https?:|mailto:|#|\/|\.{0,2}\/|[^:]*$)/i;function zt(e){let t=String(e).trim();return Rt.test(t)?t:null}function R(e){let t=[],n=/`([^`]+)`|\*\*([^*]+)\*\*|\*([^*]+)\*|\[([^\]]+)\]\(([^)\s]+)\)|(https?:\/\/[^\s<)]+)|([\w.+-]+@[\w-]+\.[\w.-]*\w)/g,r=0,i;for(;i=n.exec(e);){if(i.index>r&&t.push({type:`text`,text:e.slice(r,i.index)}),i[1]!==void 0)t.push({type:`code`,text:i[1]});else if(i[2]!==void 0)t.push({type:`strong`,children:R(i[2])});else if(i[3]!==void 0)t.push({type:`em`,children:R(i[3])});else if(i[4]!==void 0){let e=zt(i[5]);t.push(e?{type:`link`,href:e,children:R(i[4])}:{type:`text`,text:i[4]})}else i[6]===void 0?t.push({type:`link`,href:`mailto:${i[7]}`,children:[{type:`text`,text:i[7]}]}):t.push({type:`link`,href:i[6],children:[{type:`text`,text:i[6]}]});r=n.lastIndex}return r<e.length&&t.push({type:`text`,text:e.slice(r)}),t}function Bt(e){let t=String(e||``).replace(/\r\n?/g,`
|
|
2
|
+
`).split(`
|
|
3
|
+
`),n=[],r=0;for(;r<t.length;){let e=t[r];if(!e.trim()){r++;continue}if(/^```/.test(e.trim())){let e=[];for(r++;r<t.length&&!/^```/.test(t[r].trim());)e.push(t[r++]);r++,n.push({type:`codeblock`,text:e.join(`
|
|
4
|
+
`)});continue}let i=e.match(/^(#{1,6})\s+(.*)$/);if(i){n.push({type:`heading`,level:i[1].length,children:R(i[2])}),r++;continue}let a=/^\s*([-*+]|\d+[.)])\s+/;if(a.test(e)){let i=/^\s*\d/.test(e),o=[];for(;r<t.length&&a.test(t[r]);)o.push(R(t[r++].replace(a,``)));n.push({type:`list`,ordered:i,items:o});continue}let o=[];for(;r<t.length&&t[r].trim()&&!a.test(t[r])&&!/^(#{1,6}\s|```)/.test(t[r].trim());)o.push(t[r++].trim());n.push({type:`paragraph`,children:R(o.join(` `))})}return n}var z={markdown:`_markdown_1u8a2_1`,pre:`_pre_1u8a2_10`,muted:`_muted_1u8a2_23`,heading:`_heading_1u8a2_29`,code:`_code_1u8a2_33`,link:`_link_1u8a2_40`};function B(e){return e.map((e,t)=>{if(e.type===`text`)return e.text;if(e.type===`code`)return F(`code`,{class:z.code,children:e.text},t);if(e.type===`strong`)return F(`strong`,{children:B(e.children)},t);if(e.type===`em`)return F(`em`,{children:B(e.children)},t);let n=/^https?:/.test(e.href);return F(`a`,{href:e.href,class:z.link,...n&&{target:`_blank`,rel:`noopener noreferrer`},children:B(e.children)},t)})}function V({text:e,muted:t=!1}){return e?F(`div`,{class:`${z.markdown} ${t?z.muted:``}`,children:Bt(e).map((e,t)=>e.type===`paragraph`?F(`p`,{children:B(e.children)},t):e.type===`heading`?F(`p`,{class:z.heading,children:B(e.children)},t):e.type===`codeblock`?F(`pre`,{class:z.pre,children:e.text},t):F(e.ordered?`ol`:`ul`,{children:e.items.map((e,t)=>F(`li`,{children:B(e)},t))},t))}):null}var Vt={field:`_field_opijr_1`,label:`_label_opijr_10`,input:`_input_opijr_15`,eye:`_eye_opijr_40`};function Ht(){let{token:e,setToken:t}=Me($e),[n,r]=N(!1);return F(`label`,{class:Vt.field,children:[F(`span`,{class:Vt.label,children:`Bearer Token:`}),F(`input`,{class:Vt.input,type:n?`text`:`password`,value:e,placeholder:`Token`,autocomplete:`off`,spellcheck:!1,onInput:e=>t(e.currentTarget.value.trim())}),F(`button`,{type:`button`,class:Vt.eye,"aria-label":n?`Hide token`:`Show token`,onClick:()=>r(!n),children:F(I,{name:n?`eyeOff`:`eye`,size:15})})]})}var H={intro:`_intro_1jvp6_1`,auth:`_auth_1jvp6_9`,authTitle:`_authTitle_1jvp6_16`,pills:`_pills_1jvp6_31`,pill:`_pill_1jvp6_31`,title:`_title_1jvp6_48`,download:`_download_1jvp6_55`};function Ut({info:e,openapi:t,url:n,auth:r}){return F(`section`,{id:`introduction`,"data-anchor":!0,class:H.intro,children:[F(`div`,{class:H.left,children:[F(`div`,{class:H.pills,children:[e.version&&F(`span`,{class:H.pill,children:[`v`,e.version]}),F(`span`,{class:H.pill,children:[`OpenAPI `,t]})]}),F(`h1`,{class:H.title,children:e.title}),F(V,{text:e.description}),F(`a`,{class:H.download,href:n,download:`openapi.json`,children:`Download OpenAPI Document`})]}),r&&F(`div`,{class:H.auth,children:[F(`div`,{class:H.authTitle,children:`Authentication`}),F(Ht,{})]})]})}var U={tag:`_tag_wuduw_1`,title:`_title_wuduw_10`,card:`_card_wuduw_17`,cardTitle:`_cardTitle_wuduw_24`,list:`_list_wuduw_32`,item:`_item_wuduw_38`,path:`_path_wuduw_45`,method:`_method_wuduw_50`};function Wt({group:e}){return F(`section`,{id:e.id,"data-anchor":!0,class:U.tag,children:[F(`div`,{class:U.left,children:[F(`h2`,{class:U.title,children:e.name}),F(V,{text:e.description})]}),F(`div`,{class:U.card,children:[F(`div`,{class:U.cardTitle,children:`Operations`}),F(`ul`,{class:U.list,children:e.operations.map(e=>F(`li`,{children:F(`a`,{class:U.item,href:`#${e.id}`,children:[F(`span`,{class:U.method,children:F(Pt,{method:e.method})}),F(`code`,{class:U.path,children:e.path})]})},e.id))})]})]})}var Gt={pill:`_pill_fi44x_1`,required:`_required_fi44x_13`};function Kt({children:e,tone:t=`plain`}){return F(`span`,{class:`${Gt.pill} ${Gt[t]}`,children:e})}var qt={section:`_section_1lkso_1`,header:`_header_1lkso_5`,title:`_title_1lkso_14`,badges:`_badges_1lkso_21`,fields:`_fields_1lkso_28`};function Jt({title:e,badges:t,children:n}){return F(`section`,{class:qt.section,children:[F(`header`,{class:qt.header,children:[F(`h4`,{class:qt.title,children:e}),t&&F(`span`,{class:qt.badges,children:t})]}),F(`div`,{class:qt.fields,children:n})]})}var Yt={type:`_type_tj3j8_1`,model:`_model_tj3j8_7`};function Xt({info:e}){let{model:t,type:n,items:r,variants:i}=e,a=e=>F(`a`,{class:Yt.model,href:`#model/${e}`,children:e});if(n===`array`){let e=r?.model?a(r.model):nt(r?.schema||{}).type||`any`;return F(`span`,{class:Yt.type,children:[`array `,e,`[]`]})}return t?a(t):F(`span`,{class:Yt.type,children:n||(i?`one of`:`any`)})}function Zt({info:e}){if(e.variants)return e.variants.map((t,n)=>F($t,{name:`option ${n+1}`,schema:t,seen:e.nextSeen},n));let t=e.inner.required||[];return Object.entries(e.inner.properties||{}).map(([n,r])=>F($t,{name:n,schema:r,required:t.includes(n),seen:e.nextSeen},n))}var W={foldable:`_foldable_lceok_1`,row:`_row_lceok_5`,tall:`_tall_lceok_15`,toggle:`_toggle_lceok_21`,title:`_title_lceok_48`,right:`_right_lceok_53`,body:`_body_lceok_57`};function Qt({title:e,right:t,children:n,defaultOpen:r=!1,label:i,tall:a=!1}){let[o,s]=N(r),c=()=>s(!o);return F(`div`,{class:W.foldable,children:[F(`div`,{class:`${W.row} ${a?W.tall:``}`,onClick:e=>{e.target.closest(`a, button`)||c()},children:[F(`button`,{type:`button`,class:W.toggle,"aria-expanded":o,"aria-label":i,onClick:c,children:F(I,{name:o?`minus`:`plus`,size:14})}),F(`span`,{class:W.title,children:typeof e==`function`?e(o):e}),t&&F(`span`,{class:W.right,children:typeof t==`function`?t(o):t})]}),o&&F(`div`,{class:W.body,children:n})]})}var G={field:`_field_pv3dl_1`,row:`_row_pv3dl_5`,head:`_head_pv3dl_9`,name:`_name_pv3dl_20`,meta:`_meta_pv3dl_28`,required:`_required_pv3dl_33`,example:`_example_pv3dl_38`,preview:`_preview_pv3dl_46`,description:`_description_pv3dl_52`};function $t({name:e,schema:t,required:n,seen:r=new Set}){let i=at(Me(Qe),t,r),a=it(i.schema),o=st(i.inner),s=F(`span`,{class:G.head,children:[e&&F(`span`,{class:G.name,children:e}),F(Xt,{info:i}),ot(i).map((e,t)=>F(`span`,{class:G.meta,children:[`· `,e]},t)),n&&F(`span`,{class:G.required,children:`required`}),a!==void 0&&F(`span`,{class:G.example,title:JSON.stringify(a,null,2),children:`Example`}),o&&F(`span`,{class:G.preview,children:o})]}),c=i.schema.description&&F(`div`,{class:G.description,children:F(V,{text:i.schema.description,muted:!0})});return!i.inner&&!i.variants?F(`div`,{class:G.field,children:[F(`div`,{class:G.row,children:s}),c]}):F(`div`,{class:G.field,children:[F(Qt,{title:s,label:`${e||`value`} fields`,children:F(Zt,{info:i})}),c]})}var en={fields:`_fields_bqq45_1`,type:`_type_bqq45_5`};function tn({schema:e,showType:t=!1}){let n=Me(Qe);if(!e)return null;let r=at(n,e,new Set),i=r.type===`object`&&!r.model&&!r.items;return F(`div`,{class:en.fields,children:[(t||!i)&&F(`div`,{class:en.type,children:F(Xt,{info:r})}),(r.inner||r.variants)&&F(Zt,{info:r})]})}var K={responses:`_responses_f1ur8_1`,title:`_title_f1ur8_5`,head:`_head_f1ur8_14`,status:`_status_f1ur8_22`,summary:`_summary_f1ur8_27`,empty:`_empty_f1ur8_31`,description:`_description_f1ur8_37`};function nn({responses:e}){return e.length?F(`section`,{class:K.responses,children:[F(`h4`,{class:K.title,children:`Responses`}),e.map(e=>F(`div`,{class:K.response,children:F(Qt,{tall:!0,label:`Response ${e.status}`,title:t=>F(`span`,{class:K.head,children:[F(`span`,{class:K.status,children:e.status}),!t&&F(`span`,{class:K.summary,children:e.description.split(`
|
|
5
|
+
`)[0]})]}),right:t=>t&&e.contentType&&F(Kt,{children:e.contentType}),children:[F(`div`,{class:K.description,children:F(V,{text:e.description,muted:!0})}),e.schema?F(tn,{schema:e.schema,showType:!0}):F(`p`,{class:K.empty,children:`No body`})]})},e.status))]}):null}var rn={button:`_button_fispn_1`,dark:`_dark_fispn_17`,light:`_light_fispn_31`};function an({variant:e=`dark`,children:t,...n}){return F(`button`,{type:`button`,class:`${rn.button} ${rn[e]}`,...n,children:t})}var on={bar:`_bar_2kn4o_1`,path:`_path_2kn4o_18`,param:`_param_2kn4o_28`,test:`_test_2kn4o_32`};function sn({method:e,path:t,onTest:n}){let r=t.split(/(\{[^}]+\})/);return F(`div`,{class:on.bar,children:[F(Pt,{method:e,dark:!0}),F(`code`,{class:on.path,children:r.map((e,t)=>e.startsWith(`{`)?F(`span`,{class:on.param,children:e},t):e)}),n&&F(`span`,{class:on.test,children:F(an,{variant:`light`,onClick:n,children:[F(I,{name:`play`,size:10}),` Test Request`]})})]})}var cn={tabs:`_tabs_1vlyl_1`,tab:`_tab_1vlyl_1`,active:`_active_1vlyl_25`};function ln({tabs:e,active:t,onChange:n,label:r}){return F(`div`,{class:cn.tabs,role:`tablist`,"aria-label":r,children:e.map(e=>F(`button`,{type:`button`,role:`tab`,"aria-selected":e===t,class:`${cn.tab} ${e===t?cn.active:``}`,onClick:()=>n(e),children:e},e))})}var un={checkbox:`_checkbox_1ecj6_1`,box:`_box_1ecj6_26`};function dn({label:e,checked:t,onChange:n}){return F(`label`,{class:un.checkbox,children:[F(`span`,{children:e}),F(`input`,{type:`checkbox`,checked:t,onChange:e=>n(e.currentTarget.checked)}),F(`span`,{class:un.box,"aria-hidden":`true`,children:t&&F(I,{name:`check`,size:12})})]})}function fn(e){let t=[],n=/("(?:\\.|[^"\\])*")(\s*:)?|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|\b(true|false|null)\b/g,r=0,i;for(;i=n.exec(e);)i.index>r&&t.push({type:`punct`,text:e.slice(r,i.index)}),i[1]===void 0?i[3]===void 0?t.push({type:`literal`,text:i[4]}):t.push({type:`number`,text:i[3]}):(t.push({type:i[2]?`key`:`string`,text:i[1]}),i[2]&&t.push({type:`punct`,text:i[2]})),r=n.lastIndex;return r<e.length&&t.push({type:`punct`,text:e.slice(r)}),t}var pn={code:`_code_pk0oo_1`,key:`_key_pk0oo_12`,string:`_string_pk0oo_13`,number:`_number_pk0oo_14`,literal:`_literal_pk0oo_15`};function mn({value:e}){let t=typeof e==`string`?e:JSON.stringify(e,null,2);return F(`pre`,{class:pn.code,children:F(`code`,{children:fn(t).map((e,t)=>e.type===`punct`?e.text:F(`span`,{class:pn[e.type],children:e.text},t))})})}var hn={button:`_button_lse6e_1`};function gn({text:e,label:t=`Copy`}){let[n,r]=N(!1);async function i(){try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1200)}catch{}}return F(`button`,{type:`button`,class:hn.button,onClick:i,"aria-label":t,title:t,children:F(I,{name:n?`check`:`copy`,size:15})})}var q={card:`_card_1xtgd_1`,header:`_header_1xtgd_9`,actions:`_actions_1xtgd_19`,body:`_body_1xtgd_25`,empty:`_empty_1xtgd_31`,footer:`_footer_1xtgd_39`};function _n({responses:e}){let t=Me(Qe),[n,r]=N(e[0]?.status),[i,a]=N(!1);if(!e.length)return null;let o=e.find(e=>e.status===n)||e[0],s=o.schema?i?o.schema:P(t,o.schema):null,c=s===null?``:JSON.stringify(s,null,2);return F(`div`,{class:q.card,children:[F(`div`,{class:q.header,children:[F(ln,{tabs:e.map(e=>e.status),active:o.status,onChange:r,label:`Response status`}),F(`span`,{class:q.actions,children:[c&&F(gn,{text:c,label:`Copy example`}),o.schema&&F(dn,{label:`Show Schema`,checked:i,onChange:a})]})]}),F(`div`,{class:q.body,children:c?F(mn,{value:c}):F(`p`,{class:q.empty,children:`No body`})}),o.description&&F(`div`,{class:q.footer,children:o.description.split(`
|
|
6
|
+
`)[0]})]})}var vn={overlay:`_overlay_pjga8_1`,dialog:`_dialog_pjga8_11`,close:`_close_pjga8_30`};function yn({label:e,onClose:t,onKeyDown:n,children:r}){let i=Ae(null);return ke(()=>{let e=document.activeElement,t=document.documentElement.style.overflow;return document.documentElement.style.overflow=`hidden`,i.current?.focus({preventScroll:!0}),()=>{document.documentElement.style.overflow=t,e?.focus?.({preventScroll:!0})}},[]),F(`div`,{class:vn.overlay,onClick:e=>e.target===e.currentTarget&&t(),children:[F(`button`,{type:`button`,class:vn.close,"aria-label":`Close`,onClick:t,children:F(I,{name:`close`,size:16})}),F(`div`,{ref:i,class:vn.dialog,role:`dialog`,"aria-modal":`true`,"aria-label":e,tabIndex:-1,onKeyDown:e=>{if(e.key===`Escape`){e.stopPropagation(),t();return}n?.(e)},children:r})]})}var J={section:`_section_16tu7_1`,heading:`_heading_16tu7_5`,header:`_header_16tu7_9`,chevron:`_chevron_16tu7_36`,title:`_title_16tu7_41`,note:`_note_16tu7_45`,right:`_right_16tu7_50`,body:`_body_16tu7_56`};function Y({title:e,note:t,right:n,defaultOpen:r=!0,children:i}){let[a,o]=N(r);return F(`section`,{class:J.section,children:[F(`h3`,{class:J.heading,children:F(`button`,{type:`button`,class:J.header,"aria-expanded":a,onClick:()=>o(!a),children:[F(I,{name:a?`chevronDown`:`chevronRight`,size:12,class:J.chevron}),F(`span`,{class:J.title,children:e}),t!==void 0&&F(`span`,{class:J.note,children:t}),n&&F(`span`,{class:J.right,children:n})]})}),a&&F(`div`,{class:J.body,children:i})]})}var X={table:`_table_rhk4n_1`,check:`_check_rhk4n_11`,cell:`_cell_rhk4n_18`,input:`_input_rhk4n_26`,box:`_box_rhk4n_51`};function bn({rows:e,onChange:t,fixedKeys:n=!1,label:r}){let i=n?e:[...e,{key:``,value:``,enabled:!1}],a=(r,a)=>{let o=i.map((e,t)=>t===r?{...e,...a}:e);!n&&r===e.length&&(`key`in a||`value`in a)&&(o[r].enabled=!0),t(o.filter((t,n)=>n<e.length||t.key||t.value))};return F(`table`,{class:X.table,"aria-label":r,children:F(`tbody`,{children:i.map((e,t)=>F(`tr`,{children:[F(`td`,{class:X.check,children:!n&&F(`label`,{class:X.box,children:[F(`input`,{type:`checkbox`,checked:e.enabled,"aria-label":`Send ${e.key||`row`}`,onChange:e=>a(t,{enabled:e.currentTarget.checked})}),F(`span`,{"aria-hidden":`true`,children:e.enabled&&F(I,{name:`check`,size:12})})]})}),F(`td`,{class:X.cell,children:F(`input`,{class:X.input,value:e.key,placeholder:`Key`,readOnly:n,"aria-label":`Key`,onInput:e=>a(t,{key:e.currentTarget.value})})}),F(`td`,{class:X.cell,children:F(`input`,{class:X.input,value:e.value,placeholder:`Value`,"aria-label":`${e.key||`Row`} value`,onInput:e=>a(t,{value:e.currentTarget.value})})})]},t))})})}var Z={empty:`_empty_k0qvo_1`,error:`_error_k0qvo_9`,summary:`_summary_k0qvo_24`,status:`_status_k0qvo_35`,dot:`_dot_k0qvo_40`,ok:`_ok_k0qvo_46`,bad:`_bad_k0qvo_50`,headers:`_headers_k0qvo_54`,headerRow:`_headerRow_k0qvo_59`,views:`_views_k0qvo_80`,view:`_view_k0qvo_80`,viewActive:`_viewActive_k0qvo_98`,body:`_body_k0qvo_103`,raw:`_raw_k0qvo_107`,noBody:`_noBody_k0qvo_116`};function xn(e){return F(`dl`,{class:Z.headers,children:e.map(([e,t],n)=>F(`div`,{class:Z.headerRow,children:[F(`dt`,{children:e}),F(`dd`,{children:t})]},n))})}function Sn({result:e}){let[t,n]=N(!1);if(!e)return F(`p`,{class:Z.empty,children:`Send the request to see the response.`});if(e.state===`loading`)return F(`p`,{class:Z.empty,children:`Sending…`});if(e.state===`error`)return F(`div`,{class:Z.error,role:`alert`,children:[F(`strong`,{children:`The request failed.`}),F(`p`,{children:e.message}),F(`p`,{children:`The server may be down, or it does not allow this page's origin (CORS).`})]});let r=gt(e.text),i=t||r===null?e.text:r;return F(`div`,{children:[F(`div`,{class:Z.summary,"aria-live":`polite`,children:[F(`span`,{children:[Math.round(e.time),`ms`]}),F(`span`,{children:ht(e.size)}),F(`span`,{class:Z.status,children:[e.code,` `,e.statusText]}),F(`span`,{class:`${Z.dot} ${e.code<400?Z.ok:Z.bad}`,"aria-hidden":`true`})]}),F(Y,{title:`Request Headers`,note:e.requestHeaders.length,defaultOpen:!1,children:xn(e.requestHeaders)}),F(Y,{title:`Response Headers`,note:e.responseHeaders.length,defaultOpen:!1,children:xn(e.responseHeaders)}),F(Y,{title:`Body`,right:e.contentType,children:[r!==null&&F(`div`,{class:Z.views,children:[F(`button`,{type:`button`,class:`${Z.view} ${t?``:Z.viewActive}`,onClick:()=>n(!1),children:`Preview`}),F(`button`,{type:`button`,class:`${Z.view} ${t?Z.viewActive:``}`,onClick:()=>n(!0),children:`Raw`})]}),F(`div`,{class:Z.body,children:e.text?r!==null&&!t?F(mn,{value:i}):F(`pre`,{class:Z.raw,children:i}):F(`p`,{class:Z.noBody,children:`No body`})})]})]})}var Q={top:`_top_dnzw1_1`,urlBar:`_urlBar_dnzw1_8`,method:`_method_dnzw1_21`,url:`_url_dnzw1_8`,panes:`_panes_dnzw1_47`,pane:`_pane_dnzw1_47`,paneTitle:`_paneTitle_dnzw1_66`,body:`_body_dnzw1_75`,hint:`_hint_dnzw1_94`},Cn=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform);function wn({op:e,onClose:t}){let n=Me(Qe),{base:r,token:i}=Me($e),[a,o]=N(()=>ft(n,e)),[s,c]=N(null),l=e=>t=>o({...a,[e]:t}),u=pt(r,e.path,a.path,a.query),d=u.startsWith(r)?u.slice(r.length)||`/`:u;async function f(){let t=mt({op:e,base:r,inputs:a,token:i});c({state:`loading`});let n=performance.now();try{let e=await fetch(t.url,{method:t.method,headers:t.headers,body:t.body,credentials:`include`}),r=await e.arrayBuffer();c({state:`done`,code:e.status,statusText:vt(e.status,e.statusText),time:performance.now()-n,size:r.byteLength,text:new TextDecoder().decode(r),contentType:e.headers.get(`content-type`)||``,requestHeaders:t.headers,responseHeaders:[...e.headers]})}catch(e){c({state:`error`,message:e.message})}}return F(yn,{label:`Test request: ${e.label}`,onClose:t,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())},children:[F(`header`,{class:Q.top,children:F(`div`,{class:Q.urlBar,children:[F(`span`,{class:Q.method,children:F(Pt,{method:e.method})}),F(`span`,{class:Q.url,title:u,children:d}),F(gn,{text:u,label:`Copy URL`}),F(an,{onClick:f,disabled:s?.state===`loading`,children:[F(I,{name:`play`,size:10}),` Send`]})]})}),F(`div`,{class:Q.panes,children:[F(`div`,{class:Q.pane,children:[F(`h2`,{class:Q.paneTitle,children:e.label}),e.auth&&F(Y,{title:`Authentication`,note:`Required`,right:`Bearer`,children:F(Ht,{})}),a.path.length>0&&F(Y,{title:`Path Parameters`,children:F(bn,{rows:a.path,onChange:l(`path`),fixedKeys:!0,label:`Path parameters`})}),F(Y,{title:`Query Parameters`,children:F(bn,{rows:a.query,onChange:l(`query`),label:`Query parameters`})}),F(Y,{title:`Headers`,children:F(bn,{rows:a.headers,onChange:l(`headers`),label:`Headers`})}),a.body!==null&&F(Y,{title:`Request Body`,right:e.body.contentType,children:F(`textarea`,{class:Q.body,value:a.body,spellcheck:!1,"aria-label":`Request body`,rows:Math.min(20,Math.max(6,a.body.split(`
|
|
7
|
+
`).length+1)),onInput:e=>l(`body`)(e.currentTarget.value)})})]}),F(`div`,{class:Q.pane,children:[F(`h2`,{class:Q.paneTitle,children:`Response`}),F(Sn,{result:s}),F(`p`,{class:Q.hint,children:[`Send Request `,F(`kbd`,{children:Cn?`⌘`:`Ctrl`}),` `,F(`kbd`,{children:`↵`})]})]})]})]})}var Tn={operation:`_operation_yif9z_1`,left:`_left_yif9z_9`,title:`_title_yif9z_13`,right:`_right_yif9z_20`,sticky:`_sticky_yif9z_24`,actions:`_actions_yif9z_29`},En=[[`path`,`Path Parameters`],[`query`,`Query Parameters`],[`header`,`Headers`],[`cookie`,`Cookies`]];function Dn({op:e}){let[t,n]=N(!1);return F(`section`,{id:e.id,"data-anchor":!0,class:Tn.operation,children:[F(`div`,{class:Tn.left,children:[F(`h3`,{class:Tn.title,children:e.label}),F(V,{text:e.description}),En.map(([t,n])=>e.params[t].length>0&&F(Jt,{title:n,children:e.params[t].map(e=>F($t,{name:e.name,required:e.required,schema:e.description?{...e.schema,description:e.description}:e.schema},e.name))},t)),e.body&&F(Jt,{title:`Body`,badges:F(S,{children:[e.body.required&&F(Kt,{tone:`required`,children:`required`}),F(Kt,{children:e.body.contentType})]}),children:[F(V,{text:e.body.description,muted:!0}),F(tn,{schema:e.body.schema})]}),F(nn,{responses:e.responses})]}),F(`div`,{class:Tn.right,children:F(`div`,{class:Tn.sticky,children:[F(`div`,{class:Tn.actions,children:e.auth&&F(S,{children:[F(I,{name:`lock`,size:14}),` Auth Required`]})}),F(sn,{method:e.method,path:e.path,onTest:()=>n(!0)}),F(_n,{responses:e.responses})]})}),t&&F(wn,{op:e,onClose:()=>n(!1)})]})}var On={models:`_models_jw02e_1`,title:`_title_jw02e_7`,model:`_model_jw02e_1`,name:`_name_jw02e_20`,body:`_body_jw02e_31`};function kn({models:e}){return e.length?F(`section`,{id:`models`,"data-anchor":!0,class:On.models,children:[F(`h2`,{class:On.title,children:`Models`}),e.map(e=>F(`article`,{id:e.id,"data-anchor":!0,class:On.model,children:[F(`h3`,{class:On.name,children:e.name}),F(`div`,{class:On.body,children:[F(V,{text:e.schema?.description,muted:!0}),F(tn,{schema:e.schema})]})]},e.id))]}):null}var $={app:`_app_vr0g8_1`,sidebar:`_sidebar_vr0g8_5`,content:`_content_vr0g8_18`,topbar:`_topbar_vr0g8_24`,backdrop:`_backdrop_vr0g8_28`,message:`_message_vr0g8_32`,topbarTitle:`_topbarTitle_vr0g8_58`,menuButton:`_menuButton_vr0g8_65`,sidebarOpen:`_sidebarOpen_vr0g8_88`};function An({url:e,specField:t=!0}){let[n,r]=N({status:`loading`}),[i,a]=N(!1),[o,s]=xt(),c=At(n.status===`ready`);if(ke(()=>{fetch(e).then(t=>{if(!t.ok)throw Error(`Could not load ${e} (HTTP ${t.status}).`);return t.json().catch(()=>{throw Error(`${e} is not valid JSON.`)})}).then(t=>{let n=Ze(t);Tt(e),document.title=`${n.info.title} – API Docs`,r({status:`ready`,doc:t,model:n})}).catch(e=>r({status:`error`,message:e.message}))},[e]),n.status===`loading`)return F(`p`,{class:$.message,children:`Loading API docs…`});if(n.status===`error`)return F(`div`,{class:$.message,role:`alert`,children:[F(`strong`,{children:`The API docs could not be shown.`}),F(`p`,{children:n.message}),t&&F(Ot,{url:e})]});let{doc:l,model:u}=n,d=()=>a(!1),f={base:ut(l,e),token:o,setToken:s};return F(Qe.Provider,{value:l,children:F($e.Provider,{value:f,children:F(`div`,{class:$.app,children:[F(`header`,{class:$.topbar,children:[F(`button`,{type:`button`,class:$.menuButton,"aria-label":i?`Close menu`:`Open menu`,"aria-expanded":i,onClick:()=>a(!i),children:F(I,{name:i?`close`:`menu`,size:18})}),F(`span`,{class:$.topbarTitle,children:u.info.title})]}),F(`aside`,{class:`${$.sidebar} ${i?$.sidebarOpen:``}`,children:[t&&F(Ot,{url:e}),F(Lt,{model:u,activeId:c,onNavigate:d})]}),i&&F(`div`,{class:$.backdrop,onClick:d}),F(`main`,{class:$.content,children:[F(Ut,{info:u.info,openapi:u.openapi,url:e,auth:u.operations.some(e=>e.auth)}),u.untagged.map(e=>F(Dn,{op:e},e.id)),u.groups.map(e=>F(`div`,{children:[F(Wt,{group:e}),e.operations.map(e=>F(Dn,{op:e},e.id))]},e.id)),F(kn,{models:u.models})]})]})})})}function jn(e,t,n){let r=new URLSearchParams(e.search).get(`spec`)||t?.dataset?.spec||n||t?.dataset?.defaultSpec||`./openapi.json`;return new URL(r,e.href).href}var Mn=document.getElementById(`app`)||document.body.appendChild(document.createElement(`div`));he(F(An,{url:jn(window.location,Mn,wt()[0]),specField:!Mn.dataset.spec}),Mn);
|
package/package.json
CHANGED
|
@@ -1,34 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maxserver",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Bun server setup",
|
|
5
5
|
"author": "Max Matinpalo",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"types": "index.d.ts",
|
|
9
8
|
"homepage": "https://github.com/max-matinpalo/maxserver#readme",
|
|
10
9
|
"repository": {
|
|
11
10
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/max-matinpalo/maxserver.git"
|
|
11
|
+
"url": "git+https://github.com/max-matinpalo/maxserver.git"
|
|
13
12
|
},
|
|
14
13
|
"bugs": {
|
|
15
14
|
"url": "https://github.com/max-matinpalo/maxserver/issues"
|
|
16
15
|
},
|
|
17
16
|
"main": "src/index.js",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": "./src/index.js"
|
|
19
|
+
},
|
|
18
20
|
"bin": {
|
|
19
|
-
"maxserver": "bin/
|
|
20
|
-
|
|
21
|
+
"maxserver": "bin/cli.js"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"src",
|
|
25
|
+
"bin",
|
|
26
|
+
"template",
|
|
27
|
+
"devdocs"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"test": "bun test ./test"
|
|
21
31
|
},
|
|
22
32
|
"dependencies": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"@
|
|
28
|
-
"@fastify/static": "^9",
|
|
29
|
-
"@fastify/swagger": "^9",
|
|
30
|
-
"@scalar/fastify-api-reference": "^1",
|
|
31
|
-
"@fastify/websocket": "^11",
|
|
32
|
-
"fastify": "^5"
|
|
33
|
+
"ajv": "^8",
|
|
34
|
+
"ajv-formats": "^3"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/bun": "latest"
|
|
33
38
|
}
|
|
34
39
|
}
|
package/src/cors.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const METHODS = "GET,POST,PUT,PATCH,DELETE,OPTIONS";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Normalizes the cors option: "*" or "https://a.com,https://b.com"
|
|
6
|
+
*/
|
|
7
|
+
export function setupCors(cors = "*", production) {
|
|
8
|
+
const list = String(cors).split(",").map(s => s.trim()).filter(Boolean);
|
|
9
|
+
|
|
10
|
+
if (list.includes("*")) {
|
|
11
|
+
if (production)
|
|
12
|
+
console.warn("⚠️ CORS: allowing all origins in production with credentials is risky");
|
|
13
|
+
return { any: true, reflect: !production };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return { any: false, list };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* CORS headers for a request, as in v1 (@fastify/cors with credentials).
|
|
22
|
+
*/
|
|
23
|
+
export function corsHeaders(req, cors) {
|
|
24
|
+
const origin = req.headers.get("origin");
|
|
25
|
+
const headers = { "Access-Control-Allow-Credentials": "true" };
|
|
26
|
+
|
|
27
|
+
// 1. Allowed origin
|
|
28
|
+
if (cors.any && !cors.reflect) headers["Access-Control-Allow-Origin"] = "*";
|
|
29
|
+
else if (origin && (cors.any || cors.list.includes(origin))) {
|
|
30
|
+
headers["Access-Control-Allow-Origin"] = origin;
|
|
31
|
+
headers["Vary"] = "Origin";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return headers;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Answers OPTIONS preflight requests.
|
|
40
|
+
*/
|
|
41
|
+
export function preflight(req, cors) {
|
|
42
|
+
const headers = corsHeaders(req, cors);
|
|
43
|
+
headers["Access-Control-Allow-Methods"] = METHODS;
|
|
44
|
+
|
|
45
|
+
const requested = req.headers.get("access-control-request-headers");
|
|
46
|
+
if (requested) {
|
|
47
|
+
headers["Access-Control-Allow-Headers"] = requested;
|
|
48
|
+
headers["Vary"] = headers["Vary"] ? "Origin, Access-Control-Request-Headers" : "Access-Control-Request-Headers";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return new Response(null, { status: 204, headers });
|
|
52
|
+
}
|