@hot-updater/console 0.17.0 → 0.18.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.
Files changed (35) hide show
  1. package/dist/assets/index-B40KfAQR.css +1 -0
  2. package/dist/assets/index-ClfoMSQp.js +27 -0
  3. package/dist/index.cjs +1997 -2048
  4. package/dist/index.d.cts +154 -0
  5. package/dist/index.d.ts +154 -0
  6. package/dist/index.html +2 -2
  7. package/dist/index.js +1906 -1911
  8. package/package.json +6 -5
  9. package/dist/assets/index-C9l9iw4B.js +0 -27
  10. package/dist/assets/index-paAi6YFm.css +0 -1
  11. package/dist/src/App.d.ts +0 -2
  12. package/dist/src/components/spash-screen.d.ts +0 -1
  13. package/dist/src/components/ui/button.d.ts +0 -15
  14. package/dist/src/components/ui/label.d.ts +0 -3
  15. package/dist/src/components/ui/layout.d.ts +0 -4
  16. package/dist/src/components/ui/navigation-menu.d.ts +0 -35
  17. package/dist/src/components/ui/pagination.d.ts +0 -27
  18. package/dist/src/components/ui/sheet.d.ts +0 -26
  19. package/dist/src/components/ui/skeleton.d.ts +0 -8
  20. package/dist/src/components/ui/sonner.d.ts +0 -5
  21. package/dist/src/components/ui/switch.d.ts +0 -20
  22. package/dist/src/components/ui/table.d.ts +0 -10
  23. package/dist/src/components/ui/text-field.d.ts +0 -26
  24. package/dist/src/components/ui/toast.d.ts +0 -41
  25. package/dist/src/hooks/useFilter.d.ts +0 -9
  26. package/dist/src/index.d.ts +0 -1
  27. package/dist/src/lib/api.d.ts +0 -157
  28. package/dist/src/lib/extract-timestamp-from-uuidv7.d.ts +0 -1
  29. package/dist/src/lib/utils.d.ts +0 -3
  30. package/dist/src/routes/_components/columns.d.ts +0 -3
  31. package/dist/src/routes/_components/data-table.d.ts +0 -8
  32. package/dist/src/routes/_components/edit-bundle-sheet-content.d.ts +0 -5
  33. package/dist/src/routes/index.d.ts +0 -1
  34. package/dist/src-server/index.d.ts +0 -140
  35. package/dist/src-server/rpc.d.ts +0 -130
package/dist/index.js CHANGED
@@ -1,2008 +1,2003 @@
1
- import __rslib_shim_module__ from 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
4
- import * as __WEBPACK_EXTERNAL_MODULE_url__ from "url";
5
- import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
6
- import * as __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__ from "@hot-updater/plugin-core";
7
- var __webpack_modules__ = {
8
- "../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.3/node_modules/typia/lib/internal/_validateReport.js": function(__unused_webpack_module, exports) {
9
- exports._validateReport = void 0;
10
- const _validateReport = (array)=>{
11
- const reportable = (path)=>{
12
- if (0 === array.length) return true;
13
- const last = array[array.length - 1].path;
14
- return path.length > last.length || last.substring(0, path.length) !== path;
15
- };
16
- return (exceptable, error)=>{
17
- if (exceptable && reportable(error.path)) array.push(error);
18
- return false;
19
- };
20
- };
21
- exports._validateReport = _validateReport;
22
- }
1
+ import path from "path";
2
+ import { fileURLToPath } from "url";
3
+ import { createReadStream, lstatSync } from "fs";
4
+ import { getCwd, loadConfig } from "@hot-updater/plugin-core";
5
+
6
+ //#region rolldown:runtime
7
+ var __create = Object.create;
8
+ var __defProp = Object.defineProperty;
9
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
+ var __getOwnPropNames = Object.getOwnPropertyNames;
11
+ var __getProtoOf = Object.getPrototypeOf;
12
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
13
+ var __commonJS = (cb, mod) => function() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
23
15
  };
24
- var __webpack_module_cache__ = {};
25
- function __webpack_require__(moduleId) {
26
- var cachedModule = __webpack_module_cache__[moduleId];
27
- if (void 0 !== cachedModule) return cachedModule.exports;
28
- var module = __webpack_module_cache__[moduleId] = {
29
- exports: {}
30
- };
31
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
32
- return module.exports;
33
- }
34
- var getFilePath = (options)=>{
35
- let filename = options.filename;
36
- const defaultDocument = options.defaultDocument || "index.html";
37
- if (filename.endsWith("/")) filename = filename.concat(defaultDocument);
38
- else if (!filename.match(/\.[a-zA-Z0-9_-]+$/)) filename = filename.concat("/" + defaultDocument);
39
- const path = getFilePathWithoutDefaultDocument({
40
- root: options.root,
41
- filename
42
- });
43
- return path;
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
18
+ key = keys[i];
19
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
20
+ get: ((k) => from[k]).bind(null, key),
21
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
22
+ });
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
27
+ value: mod,
28
+ enumerable: true
29
+ }) : target, mod));
30
+
31
+ //#endregion
32
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/filepath.js
33
+ var getFilePath = (options) => {
34
+ let filename = options.filename;
35
+ const defaultDocument = options.defaultDocument || "index.html";
36
+ if (filename.endsWith("/")) filename = filename.concat(defaultDocument);
37
+ else if (!filename.match(/\.[a-zA-Z0-9_-]+$/)) filename = filename.concat("/" + defaultDocument);
38
+ const path$1 = getFilePathWithoutDefaultDocument({
39
+ root: options.root,
40
+ filename
41
+ });
42
+ return path$1;
44
43
  };
45
- var getFilePathWithoutDefaultDocument = (options)=>{
46
- let root = options.root || "";
47
- let filename = options.filename;
48
- if (/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(filename)) return;
49
- filename = filename.replace(/^\.?[\/\\]/, "");
50
- filename = filename.replace(/\\/, "/");
51
- root = root.replace(/\/$/, "");
52
- let path = root ? root + "/" + filename : filename;
53
- path = path.replace(/^\.?\//, "");
54
- if ("/" !== root[0] && "/" === path[0]) return;
55
- return path;
44
+ var getFilePathWithoutDefaultDocument = (options) => {
45
+ let root = options.root || "";
46
+ let filename = options.filename;
47
+ if (/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(filename)) return;
48
+ filename = filename.replace(/^\.?[\/\\]/, "");
49
+ filename = filename.replace(/\\/, "/");
50
+ root = root.replace(/\/$/, "");
51
+ let path$1 = root ? root + "/" + filename : filename;
52
+ path$1 = path$1.replace(/^\.?\//, "");
53
+ if (root[0] !== "/" && path$1[0] === "/") return;
54
+ return path$1;
56
55
  };
57
- var getMimeType = (filename, mimes = baseMimes)=>{
58
- const regexp = /\.([a-zA-Z0-9]+?)$/;
59
- const match = filename.match(regexp);
60
- if (!match) return;
61
- let mimeType = mimes[match[1]];
62
- if (mimeType && mimeType.startsWith("text") || "application/json" === mimeType) mimeType += "; charset=utf-8";
63
- return mimeType;
56
+
57
+ //#endregion
58
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/mime.js
59
+ var getMimeType = (filename, mimes = baseMimes) => {
60
+ const regexp = /\.([a-zA-Z0-9]+?)$/;
61
+ const match = filename.match(regexp);
62
+ if (!match) return;
63
+ let mimeType = mimes[match[1]];
64
+ if (mimeType && mimeType.startsWith("text") || mimeType === "application/json") mimeType += "; charset=utf-8";
65
+ return mimeType;
64
66
  };
65
67
  var baseMimes = {
66
- aac: "audio/aac",
67
- avi: "video/x-msvideo",
68
- avif: "image/avif",
69
- av1: "video/av1",
70
- bin: "application/octet-stream",
71
- bmp: "image/bmp",
72
- css: "text/css",
73
- csv: "text/csv",
74
- eot: "application/vnd.ms-fontobject",
75
- epub: "application/epub+zip",
76
- gif: "image/gif",
77
- gz: "application/gzip",
78
- htm: "text/html",
79
- html: "text/html",
80
- ico: "image/x-icon",
81
- ics: "text/calendar",
82
- jpeg: "image/jpeg",
83
- jpg: "image/jpeg",
84
- js: "text/javascript",
85
- json: "application/json",
86
- jsonld: "application/ld+json",
87
- map: "application/json",
88
- mid: "audio/x-midi",
89
- midi: "audio/x-midi",
90
- mjs: "text/javascript",
91
- mp3: "audio/mpeg",
92
- mp4: "video/mp4",
93
- mpeg: "video/mpeg",
94
- oga: "audio/ogg",
95
- ogv: "video/ogg",
96
- ogx: "application/ogg",
97
- opus: "audio/opus",
98
- otf: "font/otf",
99
- pdf: "application/pdf",
100
- png: "image/png",
101
- rtf: "application/rtf",
102
- svg: "image/svg+xml",
103
- tif: "image/tiff",
104
- tiff: "image/tiff",
105
- ts: "video/mp2t",
106
- ttf: "font/ttf",
107
- txt: "text/plain",
108
- wasm: "application/wasm",
109
- webm: "video/webm",
110
- weba: "audio/webm",
111
- webp: "image/webp",
112
- woff: "font/woff",
113
- woff2: "font/woff2",
114
- xhtml: "application/xhtml+xml",
115
- xml: "application/xml",
116
- zip: "application/zip",
117
- "3gp": "video/3gpp",
118
- "3g2": "video/3gpp2",
119
- gltf: "model/gltf+json",
120
- glb: "model/gltf-binary"
68
+ aac: "audio/aac",
69
+ avi: "video/x-msvideo",
70
+ avif: "image/avif",
71
+ av1: "video/av1",
72
+ bin: "application/octet-stream",
73
+ bmp: "image/bmp",
74
+ css: "text/css",
75
+ csv: "text/csv",
76
+ eot: "application/vnd.ms-fontobject",
77
+ epub: "application/epub+zip",
78
+ gif: "image/gif",
79
+ gz: "application/gzip",
80
+ htm: "text/html",
81
+ html: "text/html",
82
+ ico: "image/x-icon",
83
+ ics: "text/calendar",
84
+ jpeg: "image/jpeg",
85
+ jpg: "image/jpeg",
86
+ js: "text/javascript",
87
+ json: "application/json",
88
+ jsonld: "application/ld+json",
89
+ map: "application/json",
90
+ mid: "audio/x-midi",
91
+ midi: "audio/x-midi",
92
+ mjs: "text/javascript",
93
+ mp3: "audio/mpeg",
94
+ mp4: "video/mp4",
95
+ mpeg: "video/mpeg",
96
+ oga: "audio/ogg",
97
+ ogv: "video/ogg",
98
+ ogx: "application/ogg",
99
+ opus: "audio/opus",
100
+ otf: "font/otf",
101
+ pdf: "application/pdf",
102
+ png: "image/png",
103
+ rtf: "application/rtf",
104
+ svg: "image/svg+xml",
105
+ tif: "image/tiff",
106
+ tiff: "image/tiff",
107
+ ts: "video/mp2t",
108
+ ttf: "font/ttf",
109
+ txt: "text/plain",
110
+ wasm: "application/wasm",
111
+ webm: "video/webm",
112
+ weba: "audio/webm",
113
+ webp: "image/webp",
114
+ woff: "font/woff",
115
+ woff2: "font/woff2",
116
+ xhtml: "application/xhtml+xml",
117
+ xml: "application/xml",
118
+ zip: "application/zip",
119
+ "3gp": "video/3gpp",
120
+ "3g2": "video/3gpp2",
121
+ gltf: "model/gltf+json",
122
+ glb: "model/gltf-binary"
121
123
  };
124
+
125
+ //#endregion
126
+ //#region ../../node_modules/.pnpm/@hono+node-server@1.13.4_hono@4.6.3/node_modules/@hono/node-server/dist/serve-static.mjs
122
127
  var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
123
128
  var ENCODINGS = {
124
- br: ".br",
125
- zstd: ".zst",
126
- gzip: ".gz"
129
+ br: ".br",
130
+ zstd: ".zst",
131
+ gzip: ".gz"
127
132
  };
128
133
  var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
129
- var createStreamBody = (stream)=>{
130
- const body = new ReadableStream({
131
- start (controller) {
132
- stream.on("data", (chunk)=>{
133
- controller.enqueue(chunk);
134
- });
135
- stream.on("end", ()=>{
136
- controller.close();
137
- });
138
- },
139
- cancel () {
140
- stream.destroy();
141
- }
142
- });
143
- return body;
134
+ var createStreamBody = (stream) => {
135
+ const body = new ReadableStream({
136
+ start(controller) {
137
+ stream.on("data", (chunk) => {
138
+ controller.enqueue(chunk);
139
+ });
140
+ stream.on("end", () => {
141
+ controller.close();
142
+ });
143
+ },
144
+ cancel() {
145
+ stream.destroy();
146
+ }
147
+ });
148
+ return body;
149
+ };
150
+ var addCurrentDirPrefix = (path$1) => {
151
+ return `./${path$1}`;
144
152
  };
145
- var addCurrentDirPrefix = (path)=>`./${path}`;
146
- var getStats = (path)=>{
147
- let stats;
148
- try {
149
- stats = (0, __WEBPACK_EXTERNAL_MODULE_fs__.lstatSync)(path);
150
- } catch {}
151
- return stats;
153
+ var getStats = (path$1) => {
154
+ let stats;
155
+ try {
156
+ stats = lstatSync(path$1);
157
+ } catch {}
158
+ return stats;
152
159
  };
153
- var serveStatic = (options = {
154
- root: ""
155
- })=>async (c, next)=>{
156
- if (c.finalized) return next();
157
- let filename;
158
- try {
159
- filename = options.path ?? decodeURIComponent(c.req.path);
160
- } catch {
161
- await options.onNotFound?.(c.req.path, c);
162
- return next();
163
- }
164
- let path = getFilePathWithoutDefaultDocument({
165
- filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
166
- root: options.root
167
- });
168
- if (!path) return next();
169
- path = addCurrentDirPrefix(path);
170
- let stats = getStats(path);
171
- if (stats && stats.isDirectory()) {
172
- path = getFilePath({
173
- filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
174
- root: options.root,
175
- defaultDocument: options.index ?? "index.html"
176
- });
177
- if (!path) return next();
178
- path = addCurrentDirPrefix(path);
179
- stats = getStats(path);
180
- }
181
- if (!stats) {
182
- await options.onNotFound?.(path, c);
183
- return next();
184
- }
185
- await options.onFound?.(path, c);
186
- const mimeType = getMimeType(path);
187
- c.header("Content-Type", mimeType || "application/octet-stream");
188
- if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {
189
- const acceptEncodingSet = new Set(c.req.header("Accept-Encoding")?.split(",").map((encoding)=>encoding.trim()));
190
- for (const encoding of ENCODINGS_ORDERED_KEYS){
191
- if (!acceptEncodingSet.has(encoding)) continue;
192
- const precompressedStats = getStats(path + ENCODINGS[encoding]);
193
- if (precompressedStats) {
194
- c.header("Content-Encoding", encoding);
195
- c.header("Vary", "Accept-Encoding", {
196
- append: true
197
- });
198
- stats = precompressedStats;
199
- path += ENCODINGS[encoding];
200
- break;
201
- }
202
- }
203
- }
204
- const size = stats.size;
205
- if ("HEAD" == c.req.method || "OPTIONS" == c.req.method) {
206
- c.header("Content-Length", size.toString());
207
- c.status(200);
208
- return c.body(null);
209
- }
210
- const range = c.req.header("range") || "";
211
- if (!range) {
212
- c.header("Content-Length", size.toString());
213
- return c.body(createStreamBody((0, __WEBPACK_EXTERNAL_MODULE_fs__.createReadStream)(path)), 200);
214
- }
215
- c.header("Accept-Ranges", "bytes");
216
- c.header("Date", stats.birthtime.toUTCString());
217
- const parts = range.replace(/bytes=/, "").split("-", 2);
218
- const start = parts[0] ? parseInt(parts[0], 10) : 0;
219
- let end = parts[1] ? parseInt(parts[1], 10) : stats.size - 1;
220
- if (size < end - start + 1) end = size - 1;
221
- const chunksize = end - start + 1;
222
- const stream = (0, __WEBPACK_EXTERNAL_MODULE_fs__.createReadStream)(path, {
223
- start,
224
- end
225
- });
226
- c.header("Content-Length", chunksize.toString());
227
- c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
228
- return c.body(createStreamBody(stream), 206);
229
- };
230
- var parseBody = async (request, options = /* @__PURE__ */ Object.create(null))=>{
231
- const { all = false, dot = false } = options;
232
- const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
233
- const contentType = headers.get("Content-Type");
234
- if (contentType?.startsWith("multipart/form-data") || contentType?.startsWith("application/x-www-form-urlencoded")) return parseFormData(request, {
235
- all,
236
- dot
237
- });
238
- return {};
160
+ var serveStatic = (options = { root: "" }) => {
161
+ return async (c, next) => {
162
+ if (c.finalized) return next();
163
+ let filename;
164
+ try {
165
+ filename = options.path ?? decodeURIComponent(c.req.path);
166
+ } catch {
167
+ await options.onNotFound?.(c.req.path, c);
168
+ return next();
169
+ }
170
+ let path$1 = getFilePathWithoutDefaultDocument({
171
+ filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
172
+ root: options.root
173
+ });
174
+ if (path$1) path$1 = addCurrentDirPrefix(path$1);
175
+ else return next();
176
+ let stats = getStats(path$1);
177
+ if (stats && stats.isDirectory()) {
178
+ path$1 = getFilePath({
179
+ filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
180
+ root: options.root,
181
+ defaultDocument: options.index ?? "index.html"
182
+ });
183
+ if (path$1) path$1 = addCurrentDirPrefix(path$1);
184
+ else return next();
185
+ stats = getStats(path$1);
186
+ }
187
+ if (!stats) {
188
+ await options.onNotFound?.(path$1, c);
189
+ return next();
190
+ }
191
+ await options.onFound?.(path$1, c);
192
+ const mimeType = getMimeType(path$1);
193
+ c.header("Content-Type", mimeType || "application/octet-stream");
194
+ if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {
195
+ const acceptEncodingSet = new Set(c.req.header("Accept-Encoding")?.split(",").map((encoding) => encoding.trim()));
196
+ for (const encoding of ENCODINGS_ORDERED_KEYS) {
197
+ if (!acceptEncodingSet.has(encoding)) continue;
198
+ const precompressedStats = getStats(path$1 + ENCODINGS[encoding]);
199
+ if (precompressedStats) {
200
+ c.header("Content-Encoding", encoding);
201
+ c.header("Vary", "Accept-Encoding", { append: true });
202
+ stats = precompressedStats;
203
+ path$1 = path$1 + ENCODINGS[encoding];
204
+ break;
205
+ }
206
+ }
207
+ }
208
+ const size = stats.size;
209
+ if (c.req.method == "HEAD" || c.req.method == "OPTIONS") {
210
+ c.header("Content-Length", size.toString());
211
+ c.status(200);
212
+ return c.body(null);
213
+ }
214
+ const range = c.req.header("range") || "";
215
+ if (!range) {
216
+ c.header("Content-Length", size.toString());
217
+ return c.body(createStreamBody(createReadStream(path$1)), 200);
218
+ }
219
+ c.header("Accept-Ranges", "bytes");
220
+ c.header("Date", stats.birthtime.toUTCString());
221
+ const parts = range.replace(/bytes=/, "").split("-", 2);
222
+ const start = parts[0] ? parseInt(parts[0], 10) : 0;
223
+ let end = parts[1] ? parseInt(parts[1], 10) : stats.size - 1;
224
+ if (size < end - start + 1) end = size - 1;
225
+ const chunksize = end - start + 1;
226
+ const stream = createReadStream(path$1, {
227
+ start,
228
+ end
229
+ });
230
+ c.header("Content-Length", chunksize.toString());
231
+ c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
232
+ return c.body(createStreamBody(stream), 206);
233
+ };
234
+ };
235
+
236
+ //#endregion
237
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/body.js
238
+ var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
239
+ const { all = false, dot = false } = options;
240
+ const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
241
+ const contentType = headers.get("Content-Type");
242
+ if (contentType?.startsWith("multipart/form-data") || contentType?.startsWith("application/x-www-form-urlencoded")) return parseFormData(request, {
243
+ all,
244
+ dot
245
+ });
246
+ return {};
239
247
  };
240
248
  async function parseFormData(request, options) {
241
- const formData = await request.formData();
242
- if (formData) return convertFormDataToBodyData(formData, options);
243
- return {};
249
+ const formData = await request.formData();
250
+ if (formData) return convertFormDataToBodyData(formData, options);
251
+ return {};
244
252
  }
245
253
  function convertFormDataToBodyData(formData, options) {
246
- const form = /* @__PURE__ */ Object.create(null);
247
- formData.forEach((value, key)=>{
248
- const shouldParseAllValues = options.all || key.endsWith("[]");
249
- if (shouldParseAllValues) handleParsingAllValues(form, key, value);
250
- else form[key] = value;
251
- });
252
- if (options.dot) Object.entries(form).forEach(([key, value])=>{
253
- const shouldParseDotValues = key.includes(".");
254
- if (shouldParseDotValues) {
255
- handleParsingNestedValues(form, key, value);
256
- delete form[key];
257
- }
258
- });
259
- return form;
254
+ const form = /* @__PURE__ */ Object.create(null);
255
+ formData.forEach((value, key) => {
256
+ const shouldParseAllValues = options.all || key.endsWith("[]");
257
+ if (!shouldParseAllValues) form[key] = value;
258
+ else handleParsingAllValues(form, key, value);
259
+ });
260
+ if (options.dot) Object.entries(form).forEach(([key, value]) => {
261
+ const shouldParseDotValues = key.includes(".");
262
+ if (shouldParseDotValues) {
263
+ handleParsingNestedValues(form, key, value);
264
+ delete form[key];
265
+ }
266
+ });
267
+ return form;
260
268
  }
261
- var handleParsingAllValues = (form, key, value)=>{
262
- if (void 0 !== form[key]) if (Array.isArray(form[key])) form[key].push(value);
263
- else form[key] = [
264
- form[key],
265
- value
266
- ];
267
- else form[key] = value;
269
+ var handleParsingAllValues = (form, key, value) => {
270
+ if (form[key] !== void 0) if (Array.isArray(form[key])) form[key].push(value);
271
+ else form[key] = [form[key], value];
272
+ else form[key] = value;
268
273
  };
269
- var handleParsingNestedValues = (form, key, value)=>{
270
- let nestedForm = form;
271
- const keys = key.split(".");
272
- keys.forEach((key2, index)=>{
273
- if (index === keys.length - 1) nestedForm[key2] = value;
274
- else {
275
- if (!nestedForm[key2] || "object" != typeof nestedForm[key2] || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) nestedForm[key2] = /* @__PURE__ */ Object.create(null);
276
- nestedForm = nestedForm[key2];
277
- }
278
- });
274
+ var handleParsingNestedValues = (form, key, value) => {
275
+ let nestedForm = form;
276
+ const keys = key.split(".");
277
+ keys.forEach((key2, index) => {
278
+ if (index === keys.length - 1) nestedForm[key2] = value;
279
+ else {
280
+ if (!nestedForm[key2] || typeof nestedForm[key2] !== "object" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) nestedForm[key2] = /* @__PURE__ */ Object.create(null);
281
+ nestedForm = nestedForm[key2];
282
+ }
283
+ });
279
284
  };
280
- var splitPath = (path)=>{
281
- const paths = path.split("/");
282
- if ("" === paths[0]) paths.shift();
283
- return paths;
285
+
286
+ //#endregion
287
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/url.js
288
+ var splitPath = (path$1) => {
289
+ const paths = path$1.split("/");
290
+ if (paths[0] === "") paths.shift();
291
+ return paths;
284
292
  };
285
- var splitRoutingPath = (routePath)=>{
286
- const { groups, path } = extractGroupsFromPath(routePath);
287
- const paths = splitPath(path);
288
- return replaceGroupMarks(paths, groups);
293
+ var splitRoutingPath = (routePath) => {
294
+ const { groups, path: path$1 } = extractGroupsFromPath(routePath);
295
+ const paths = splitPath(path$1);
296
+ return replaceGroupMarks(paths, groups);
289
297
  };
290
- var extractGroupsFromPath = (path)=>{
291
- const groups = [];
292
- path = path.replace(/\{[^}]+\}/g, (match, index)=>{
293
- const mark = `@${index}`;
294
- groups.push([
295
- mark,
296
- match
297
- ]);
298
- return mark;
299
- });
300
- return {
301
- groups,
302
- path
303
- };
298
+ var extractGroupsFromPath = (path$1) => {
299
+ const groups = [];
300
+ path$1 = path$1.replace(/\{[^}]+\}/g, (match, index) => {
301
+ const mark = `@${index}`;
302
+ groups.push([mark, match]);
303
+ return mark;
304
+ });
305
+ return {
306
+ groups,
307
+ path: path$1
308
+ };
304
309
  };
305
- var replaceGroupMarks = (paths, groups)=>{
306
- for(let i = groups.length - 1; i >= 0; i--){
307
- const [mark] = groups[i];
308
- for(let j = paths.length - 1; j >= 0; j--)if (paths[j].includes(mark)) {
309
- paths[j] = paths[j].replace(mark, groups[i][1]);
310
- break;
311
- }
312
- }
313
- return paths;
310
+ var replaceGroupMarks = (paths, groups) => {
311
+ for (let i = groups.length - 1; i >= 0; i--) {
312
+ const [mark] = groups[i];
313
+ for (let j = paths.length - 1; j >= 0; j--) if (paths[j].includes(mark)) {
314
+ paths[j] = paths[j].replace(mark, groups[i][1]);
315
+ break;
316
+ }
317
+ }
318
+ return paths;
314
319
  };
315
320
  var patternCache = {};
316
- var getPattern = (label)=>{
317
- if ("*" === label) return "*";
318
- const match = label.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
319
- if (match) {
320
- if (!patternCache[label]) if (match[2]) patternCache[label] = [
321
- label,
322
- match[1],
323
- new RegExp("^" + match[2] + "$")
324
- ];
325
- else patternCache[label] = [
326
- label,
327
- match[1],
328
- true
329
- ];
330
- return patternCache[label];
331
- }
332
- return null;
321
+ var getPattern = (label) => {
322
+ if (label === "*") return "*";
323
+ const match = label.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
324
+ if (match) {
325
+ if (!patternCache[label]) if (match[2]) patternCache[label] = [
326
+ label,
327
+ match[1],
328
+ new RegExp("^" + match[2] + "$")
329
+ ];
330
+ else patternCache[label] = [
331
+ label,
332
+ match[1],
333
+ true
334
+ ];
335
+ return patternCache[label];
336
+ }
337
+ return null;
333
338
  };
334
- var tryDecodeURI = (str)=>{
335
- try {
336
- return decodeURI(str);
337
- } catch {
338
- return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match)=>{
339
- try {
340
- return decodeURI(match);
341
- } catch {
342
- return match;
343
- }
344
- });
345
- }
339
+ var tryDecodeURI = (str) => {
340
+ try {
341
+ return decodeURI(str);
342
+ } catch {
343
+ return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => {
344
+ try {
345
+ return decodeURI(match);
346
+ } catch {
347
+ return match;
348
+ }
349
+ });
350
+ }
346
351
  };
347
- var getPath = (request)=>{
348
- const url = request.url;
349
- const start = url.indexOf("/", 8);
350
- let i = start;
351
- for(; i < url.length; i++){
352
- const charCode = url.charCodeAt(i);
353
- if (37 === charCode) {
354
- const queryIndex = url.indexOf("?", i);
355
- const path = url.slice(start, -1 === queryIndex ? void 0 : queryIndex);
356
- return tryDecodeURI(path.includes("%25") ? path.replace(/%25/g, "%2525") : path);
357
- }
358
- if (63 === charCode) break;
359
- }
360
- return url.slice(start, i);
352
+ var getPath = (request) => {
353
+ const url = request.url;
354
+ const start = url.indexOf("/", 8);
355
+ let i = start;
356
+ for (; i < url.length; i++) {
357
+ const charCode = url.charCodeAt(i);
358
+ if (charCode === 37) {
359
+ const queryIndex = url.indexOf("?", i);
360
+ const path$1 = url.slice(start, queryIndex === -1 ? void 0 : queryIndex);
361
+ return tryDecodeURI(path$1.includes("%25") ? path$1.replace(/%25/g, "%2525") : path$1);
362
+ } else if (charCode === 63) break;
363
+ }
364
+ return url.slice(start, i);
361
365
  };
362
- var getPathNoStrict = (request)=>{
363
- const result = getPath(request);
364
- return result.length > 1 && "/" === result[result.length - 1] ? result.slice(0, -1) : result;
366
+ var getPathNoStrict = (request) => {
367
+ const result = getPath(request);
368
+ return result.length > 1 && result[result.length - 1] === "/" ? result.slice(0, -1) : result;
365
369
  };
366
- var mergePath = (...paths)=>{
367
- let p = "";
368
- let endsWithSlash = false;
369
- for (let path of paths){
370
- if ("/" === p[p.length - 1]) {
371
- p = p.slice(0, -1);
372
- endsWithSlash = true;
373
- }
374
- if ("/" !== path[0]) path = `/${path}`;
375
- if ("/" === path && endsWithSlash) p = `${p}/`;
376
- else if ("/" !== path) p = `${p}${path}`;
377
- if ("/" === path && "" === p) p = "/";
378
- }
379
- return p;
370
+ var mergePath = (...paths) => {
371
+ let p = "";
372
+ let endsWithSlash = false;
373
+ for (let path$1 of paths) {
374
+ if (p[p.length - 1] === "/") {
375
+ p = p.slice(0, -1);
376
+ endsWithSlash = true;
377
+ }
378
+ if (path$1[0] !== "/") path$1 = `/${path$1}`;
379
+ if (path$1 === "/" && endsWithSlash) p = `${p}/`;
380
+ else if (path$1 !== "/") p = `${p}${path$1}`;
381
+ if (path$1 === "/" && p === "") p = "/";
382
+ }
383
+ return p;
380
384
  };
381
- var checkOptionalParameter = (path)=>{
382
- if (!path.match(/\:.+\?$/)) return null;
383
- const segments = path.split("/");
384
- const results = [];
385
- let basePath = "";
386
- segments.forEach((segment)=>{
387
- if ("" === segment || /\:/.test(segment)) {
388
- if (/\:/.test(segment)) if (/\?/.test(segment)) {
389
- if (0 === results.length && "" === basePath) results.push("/");
390
- else results.push(basePath);
391
- const optionalSegment = segment.replace("?", "");
392
- basePath += "/" + optionalSegment;
393
- results.push(basePath);
394
- } else basePath += "/" + segment;
395
- } else basePath += "/" + segment;
396
- });
397
- return results.filter((v, i, a)=>a.indexOf(v) === i);
385
+ var checkOptionalParameter = (path$1) => {
386
+ if (!path$1.match(/\:.+\?$/)) return null;
387
+ const segments = path$1.split("/");
388
+ const results = [];
389
+ let basePath = "";
390
+ segments.forEach((segment) => {
391
+ if (segment !== "" && !/\:/.test(segment)) basePath += "/" + segment;
392
+ else if (/\:/.test(segment)) if (/\?/.test(segment)) {
393
+ if (results.length === 0 && basePath === "") results.push("/");
394
+ else results.push(basePath);
395
+ const optionalSegment = segment.replace("?", "");
396
+ basePath += "/" + optionalSegment;
397
+ results.push(basePath);
398
+ } else basePath += "/" + segment;
399
+ });
400
+ return results.filter((v, i, a) => a.indexOf(v) === i);
398
401
  };
399
- var _decodeURI = (value)=>{
400
- if (!/[%+]/.test(value)) return value;
401
- if (-1 !== value.indexOf("+")) value = value.replace(/\+/g, " ");
402
- return /%/.test(value) ? decodeURIComponent_(value) : value;
402
+ var _decodeURI = (value) => {
403
+ if (!/[%+]/.test(value)) return value;
404
+ if (value.indexOf("+") !== -1) value = value.replace(/\+/g, " ");
405
+ return /%/.test(value) ? decodeURIComponent_(value) : value;
403
406
  };
404
- var _getQueryParam = (url, key, multiple)=>{
405
- let encoded;
406
- if (!multiple && key && !/[%+]/.test(key)) {
407
- let keyIndex2 = url.indexOf(`?${key}`, 8);
408
- if (-1 === keyIndex2) keyIndex2 = url.indexOf(`&${key}`, 8);
409
- while(-1 !== keyIndex2){
410
- const trailingKeyCode = url.charCodeAt(keyIndex2 + key.length + 1);
411
- if (61 === trailingKeyCode) {
412
- const valueIndex = keyIndex2 + key.length + 2;
413
- const endIndex = url.indexOf("&", valueIndex);
414
- return _decodeURI(url.slice(valueIndex, -1 === endIndex ? void 0 : endIndex));
415
- }
416
- if (38 == trailingKeyCode || isNaN(trailingKeyCode)) return "";
417
- keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);
418
- }
419
- encoded = /[%+]/.test(url);
420
- if (!encoded) return;
421
- }
422
- const results = {};
423
- encoded ??= /[%+]/.test(url);
424
- let keyIndex = url.indexOf("?", 8);
425
- while(-1 !== keyIndex){
426
- const nextKeyIndex = url.indexOf("&", keyIndex + 1);
427
- let valueIndex = url.indexOf("=", keyIndex);
428
- if (valueIndex > nextKeyIndex && -1 !== nextKeyIndex) valueIndex = -1;
429
- let name = url.slice(keyIndex + 1, -1 === valueIndex ? -1 === nextKeyIndex ? void 0 : nextKeyIndex : valueIndex);
430
- if (encoded) name = _decodeURI(name);
431
- keyIndex = nextKeyIndex;
432
- if ("" === name) continue;
433
- let value;
434
- if (-1 === valueIndex) value = "";
435
- else {
436
- value = url.slice(valueIndex + 1, -1 === nextKeyIndex ? void 0 : nextKeyIndex);
437
- if (encoded) value = _decodeURI(value);
438
- }
439
- if (multiple) {
440
- if (!(results[name] && Array.isArray(results[name]))) results[name] = [];
441
- results[name].push(value);
442
- } else results[name] ??= value;
443
- }
444
- return key ? results[key] : results;
407
+ var _getQueryParam = (url, key, multiple) => {
408
+ let encoded;
409
+ if (!multiple && key && !/[%+]/.test(key)) {
410
+ let keyIndex2 = url.indexOf(`?${key}`, 8);
411
+ if (keyIndex2 === -1) keyIndex2 = url.indexOf(`&${key}`, 8);
412
+ while (keyIndex2 !== -1) {
413
+ const trailingKeyCode = url.charCodeAt(keyIndex2 + key.length + 1);
414
+ if (trailingKeyCode === 61) {
415
+ const valueIndex = keyIndex2 + key.length + 2;
416
+ const endIndex = url.indexOf("&", valueIndex);
417
+ return _decodeURI(url.slice(valueIndex, endIndex === -1 ? void 0 : endIndex));
418
+ } else if (trailingKeyCode == 38 || isNaN(trailingKeyCode)) return "";
419
+ keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);
420
+ }
421
+ encoded = /[%+]/.test(url);
422
+ if (!encoded) return void 0;
423
+ }
424
+ const results = {};
425
+ encoded ??= /[%+]/.test(url);
426
+ let keyIndex = url.indexOf("?", 8);
427
+ while (keyIndex !== -1) {
428
+ const nextKeyIndex = url.indexOf("&", keyIndex + 1);
429
+ let valueIndex = url.indexOf("=", keyIndex);
430
+ if (valueIndex > nextKeyIndex && nextKeyIndex !== -1) valueIndex = -1;
431
+ let name = url.slice(keyIndex + 1, valueIndex === -1 ? nextKeyIndex === -1 ? void 0 : nextKeyIndex : valueIndex);
432
+ if (encoded) name = _decodeURI(name);
433
+ keyIndex = nextKeyIndex;
434
+ if (name === "") continue;
435
+ let value;
436
+ if (valueIndex === -1) value = "";
437
+ else {
438
+ value = url.slice(valueIndex + 1, nextKeyIndex === -1 ? void 0 : nextKeyIndex);
439
+ if (encoded) value = _decodeURI(value);
440
+ }
441
+ if (multiple) {
442
+ if (!(results[name] && Array.isArray(results[name]))) results[name] = [];
443
+ results[name].push(value);
444
+ } else results[name] ??= value;
445
+ }
446
+ return key ? results[key] : results;
445
447
  };
446
448
  var getQueryParam = _getQueryParam;
447
- var getQueryParams = (url, key)=>_getQueryParam(url, key, true);
449
+ var getQueryParams = (url, key) => {
450
+ return _getQueryParam(url, key, true);
451
+ };
448
452
  var decodeURIComponent_ = decodeURIComponent;
453
+
454
+ //#endregion
455
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/request.js
449
456
  var HonoRequest = class {
450
- raw;
451
- #validatedData;
452
- #matchResult;
453
- routeIndex = 0;
454
- path;
455
- bodyCache = {};
456
- constructor(request, path = "/", matchResult = [
457
- []
458
- ]){
459
- this.raw = request;
460
- this.path = path;
461
- this.#matchResult = matchResult;
462
- this.#validatedData = {};
463
- }
464
- param(key) {
465
- return key ? this.getDecodedParam(key) : this.getAllDecodedParams();
466
- }
467
- getDecodedParam(key) {
468
- const paramKey = this.#matchResult[0][this.routeIndex][1][key];
469
- const param = this.getParamValue(paramKey);
470
- return param ? /\%/.test(param) ? decodeURIComponent_(param) : param : void 0;
471
- }
472
- getAllDecodedParams() {
473
- const decoded = {};
474
- const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);
475
- for (const key of keys){
476
- const value = this.getParamValue(this.#matchResult[0][this.routeIndex][1][key]);
477
- if (value && "string" == typeof value) decoded[key] = /\%/.test(value) ? decodeURIComponent_(value) : value;
478
- }
479
- return decoded;
480
- }
481
- getParamValue(paramKey) {
482
- return this.#matchResult[1] ? this.#matchResult[1][paramKey] : paramKey;
483
- }
484
- query(key) {
485
- return getQueryParam(this.url, key);
486
- }
487
- queries(key) {
488
- return getQueryParams(this.url, key);
489
- }
490
- header(name) {
491
- if (name) return this.raw.headers.get(name.toLowerCase()) ?? void 0;
492
- const headerData = {};
493
- this.raw.headers.forEach((value, key)=>{
494
- headerData[key] = value;
495
- });
496
- return headerData;
497
- }
498
- async parseBody(options) {
499
- return this.bodyCache.parsedBody ??= await parseBody(this, options);
500
- }
501
- cachedBody = (key)=>{
502
- const { bodyCache, raw } = this;
503
- const cachedBody = bodyCache[key];
504
- if (cachedBody) return cachedBody;
505
- const anyCachedKey = Object.keys(bodyCache)[0];
506
- if (anyCachedKey) return bodyCache[anyCachedKey].then((body)=>{
507
- if ("json" === anyCachedKey) body = JSON.stringify(body);
508
- return new Response(body)[key]();
509
- });
510
- return bodyCache[key] = raw[key]();
511
- };
512
- json() {
513
- return this.cachedBody("json");
514
- }
515
- text() {
516
- return this.cachedBody("text");
517
- }
518
- arrayBuffer() {
519
- return this.cachedBody("arrayBuffer");
520
- }
521
- blob() {
522
- return this.cachedBody("blob");
523
- }
524
- formData() {
525
- return this.cachedBody("formData");
526
- }
527
- addValidatedData(target, data) {
528
- this.#validatedData[target] = data;
529
- }
530
- valid(target) {
531
- return this.#validatedData[target];
532
- }
533
- get url() {
534
- return this.raw.url;
535
- }
536
- get method() {
537
- return this.raw.method;
538
- }
539
- get matchedRoutes() {
540
- return this.#matchResult[0].map(([[, route]])=>route);
541
- }
542
- get routePath() {
543
- return this.#matchResult[0].map(([[, route]])=>route)[this.routeIndex].path;
544
- }
457
+ raw;
458
+ #validatedData;
459
+ #matchResult;
460
+ routeIndex = 0;
461
+ path;
462
+ bodyCache = {};
463
+ constructor(request, path$1 = "/", matchResult = [[]]) {
464
+ this.raw = request;
465
+ this.path = path$1;
466
+ this.#matchResult = matchResult;
467
+ this.#validatedData = {};
468
+ }
469
+ param(key) {
470
+ return key ? this.getDecodedParam(key) : this.getAllDecodedParams();
471
+ }
472
+ getDecodedParam(key) {
473
+ const paramKey = this.#matchResult[0][this.routeIndex][1][key];
474
+ const param = this.getParamValue(paramKey);
475
+ return param ? /\%/.test(param) ? decodeURIComponent_(param) : param : void 0;
476
+ }
477
+ getAllDecodedParams() {
478
+ const decoded = {};
479
+ const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);
480
+ for (const key of keys) {
481
+ const value = this.getParamValue(this.#matchResult[0][this.routeIndex][1][key]);
482
+ if (value && typeof value === "string") decoded[key] = /\%/.test(value) ? decodeURIComponent_(value) : value;
483
+ }
484
+ return decoded;
485
+ }
486
+ getParamValue(paramKey) {
487
+ return this.#matchResult[1] ? this.#matchResult[1][paramKey] : paramKey;
488
+ }
489
+ query(key) {
490
+ return getQueryParam(this.url, key);
491
+ }
492
+ queries(key) {
493
+ return getQueryParams(this.url, key);
494
+ }
495
+ header(name) {
496
+ if (name) return this.raw.headers.get(name.toLowerCase()) ?? void 0;
497
+ const headerData = {};
498
+ this.raw.headers.forEach((value, key) => {
499
+ headerData[key] = value;
500
+ });
501
+ return headerData;
502
+ }
503
+ async parseBody(options) {
504
+ return this.bodyCache.parsedBody ??= await parseBody(this, options);
505
+ }
506
+ cachedBody = (key) => {
507
+ const { bodyCache, raw: raw$1 } = this;
508
+ const cachedBody = bodyCache[key];
509
+ if (cachedBody) return cachedBody;
510
+ const anyCachedKey = Object.keys(bodyCache)[0];
511
+ if (anyCachedKey) return bodyCache[anyCachedKey].then((body) => {
512
+ if (anyCachedKey === "json") body = JSON.stringify(body);
513
+ return new Response(body)[key]();
514
+ });
515
+ return bodyCache[key] = raw$1[key]();
516
+ };
517
+ json() {
518
+ return this.cachedBody("json");
519
+ }
520
+ text() {
521
+ return this.cachedBody("text");
522
+ }
523
+ arrayBuffer() {
524
+ return this.cachedBody("arrayBuffer");
525
+ }
526
+ blob() {
527
+ return this.cachedBody("blob");
528
+ }
529
+ formData() {
530
+ return this.cachedBody("formData");
531
+ }
532
+ addValidatedData(target, data) {
533
+ this.#validatedData[target] = data;
534
+ }
535
+ valid(target) {
536
+ return this.#validatedData[target];
537
+ }
538
+ get url() {
539
+ return this.raw.url;
540
+ }
541
+ get method() {
542
+ return this.raw.method;
543
+ }
544
+ get matchedRoutes() {
545
+ return this.#matchResult[0].map(([[, route]]) => route);
546
+ }
547
+ get routePath() {
548
+ return this.#matchResult[0].map(([[, route]]) => route)[this.routeIndex].path;
549
+ }
545
550
  };
551
+
552
+ //#endregion
553
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/html.js
546
554
  var HtmlEscapedCallbackPhase = {
547
- Stringify: 1,
548
- BeforeStream: 2,
549
- Stream: 3
555
+ Stringify: 1,
556
+ BeforeStream: 2,
557
+ Stream: 3
550
558
  };
551
- var html_raw = (value, callbacks)=>{
552
- const escapedString = new String(value);
553
- escapedString.isEscaped = true;
554
- escapedString.callbacks = callbacks;
555
- return escapedString;
559
+ var raw = (value, callbacks) => {
560
+ const escapedString = new String(value);
561
+ escapedString.isEscaped = true;
562
+ escapedString.callbacks = callbacks;
563
+ return escapedString;
556
564
  };
557
- var resolveCallback = async (str, phase, preserveCallbacks, context, buffer)=>{
558
- if ("object" == typeof str && !(str instanceof String)) {
559
- if (!(str instanceof Promise)) str = str.toString();
560
- if (str instanceof Promise) str = await str;
561
- }
562
- const callbacks = str.callbacks;
563
- if (!callbacks?.length) return Promise.resolve(str);
564
- if (buffer) buffer[0] += str;
565
- else buffer = [
566
- str
567
- ];
568
- const resStr = Promise.all(callbacks.map((c)=>c({
569
- phase,
570
- buffer,
571
- context
572
- }))).then((res)=>Promise.all(res.filter(Boolean).map((str2)=>resolveCallback(str2, phase, false, context, buffer))).then(()=>buffer[0]));
573
- if (preserveCallbacks) return html_raw(await resStr, callbacks);
574
- return resStr;
565
+ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
566
+ if (typeof str === "object" && !(str instanceof String)) {
567
+ if (!(str instanceof Promise)) str = str.toString();
568
+ if (str instanceof Promise) str = await str;
569
+ }
570
+ const callbacks = str.callbacks;
571
+ if (!callbacks?.length) return Promise.resolve(str);
572
+ if (buffer) buffer[0] += str;
573
+ else buffer = [str];
574
+ const resStr = Promise.all(callbacks.map((c) => c({
575
+ phase,
576
+ buffer,
577
+ context
578
+ }))).then((res) => Promise.all(res.filter(Boolean).map((str2) => resolveCallback(str2, phase, false, context, buffer))).then(() => buffer[0]));
579
+ if (preserveCallbacks) return raw(await resStr, callbacks);
580
+ else return resStr;
575
581
  };
582
+
583
+ //#endregion
584
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/context.js
576
585
  var TEXT_PLAIN = "text/plain; charset=UTF-8";
577
- var setHeaders = (headers, map = {})=>{
578
- Object.entries(map).forEach(([key, value])=>headers.set(key, value));
579
- return headers;
586
+ var setHeaders = (headers, map = {}) => {
587
+ Object.entries(map).forEach(([key, value]) => headers.set(key, value));
588
+ return headers;
580
589
  };
581
590
  var Context = class {
582
- #rawRequest;
583
- #req;
584
- env = {};
585
- #var;
586
- finalized = false;
587
- error;
588
- #status = 200;
589
- #executionCtx;
590
- #headers;
591
- #preparedHeaders;
592
- #res;
593
- #isFresh = true;
594
- #layout;
595
- #renderer;
596
- #notFoundHandler;
597
- #matchResult;
598
- #path;
599
- constructor(req, options){
600
- this.#rawRequest = req;
601
- if (options) {
602
- this.#executionCtx = options.executionCtx;
603
- this.env = options.env;
604
- this.#notFoundHandler = options.notFoundHandler;
605
- this.#path = options.path;
606
- this.#matchResult = options.matchResult;
607
- }
608
- }
609
- get req() {
610
- this.#req ??= new HonoRequest(this.#rawRequest, this.#path, this.#matchResult);
611
- return this.#req;
612
- }
613
- get event() {
614
- if (this.#executionCtx && "respondWith" in this.#executionCtx) return this.#executionCtx;
615
- throw Error("This context has no FetchEvent");
616
- }
617
- get executionCtx() {
618
- if (this.#executionCtx) return this.#executionCtx;
619
- throw Error("This context has no ExecutionContext");
620
- }
621
- get res() {
622
- this.#isFresh = false;
623
- return this.#res ||= new Response("404 Not Found", {
624
- status: 404
625
- });
626
- }
627
- set res(_res) {
628
- this.#isFresh = false;
629
- if (this.#res && _res) try {
630
- for (const [k, v] of this.#res.headers.entries())if ("content-type" !== k) if ("set-cookie" === k) {
631
- const cookies = this.#res.headers.getSetCookie();
632
- _res.headers.delete("set-cookie");
633
- for (const cookie of cookies)_res.headers.append("set-cookie", cookie);
634
- } else _res.headers.set(k, v);
635
- } catch (e) {
636
- if (e instanceof TypeError && e.message.includes("immutable")) {
637
- this.res = new Response(_res.body, {
638
- headers: _res.headers,
639
- status: _res.status
640
- });
641
- return;
642
- }
643
- throw e;
644
- }
645
- this.#res = _res;
646
- this.finalized = true;
647
- }
648
- render = (...args)=>{
649
- this.#renderer ??= (content)=>this.html(content);
650
- return this.#renderer(...args);
651
- };
652
- setLayout = (layout)=>this.#layout = layout;
653
- getLayout = ()=>this.#layout;
654
- setRenderer = (renderer)=>{
655
- this.#renderer = renderer;
656
- };
657
- header = (name, value, options)=>{
658
- if (void 0 === value) {
659
- if (this.#headers) this.#headers.delete(name);
660
- else if (this.#preparedHeaders) delete this.#preparedHeaders[name.toLocaleLowerCase()];
661
- if (this.finalized) this.res.headers.delete(name);
662
- return;
663
- }
664
- if (options?.append) {
665
- if (!this.#headers) {
666
- this.#isFresh = false;
667
- this.#headers = new Headers(this.#preparedHeaders);
668
- this.#preparedHeaders = {};
669
- }
670
- this.#headers.append(name, value);
671
- } else if (this.#headers) this.#headers.set(name, value);
672
- else {
673
- this.#preparedHeaders ??= {};
674
- this.#preparedHeaders[name.toLowerCase()] = value;
675
- }
676
- if (this.finalized) if (options?.append) this.res.headers.append(name, value);
677
- else this.res.headers.set(name, value);
678
- };
679
- status = (status)=>{
680
- this.#isFresh = false;
681
- this.#status = status;
682
- };
683
- set = (key, value)=>{
684
- this.#var ??= /* @__PURE__ */ new Map();
685
- this.#var.set(key, value);
686
- };
687
- get = (key)=>this.#var ? this.#var.get(key) : void 0;
688
- get var() {
689
- if (!this.#var) return {};
690
- return Object.fromEntries(this.#var);
691
- }
692
- newResponse = (data, arg, headers)=>{
693
- if (this.#isFresh && !headers && !arg && 200 === this.#status) return new Response(data, {
694
- headers: this.#preparedHeaders
695
- });
696
- if (arg && "number" != typeof arg) {
697
- const header = new Headers(arg.headers);
698
- if (this.#headers) this.#headers.forEach((v, k)=>{
699
- if ("set-cookie" === k) header.append(k, v);
700
- else header.set(k, v);
701
- });
702
- const headers2 = setHeaders(header, this.#preparedHeaders);
703
- return new Response(data, {
704
- headers: headers2,
705
- status: arg.status ?? this.#status
706
- });
707
- }
708
- const status = "number" == typeof arg ? arg : this.#status;
709
- this.#preparedHeaders ??= {};
710
- this.#headers ??= new Headers();
711
- setHeaders(this.#headers, this.#preparedHeaders);
712
- if (this.#res) {
713
- this.#res.headers.forEach((v, k)=>{
714
- if ("set-cookie" === k) this.#headers?.append(k, v);
715
- else this.#headers?.set(k, v);
716
- });
717
- setHeaders(this.#headers, this.#preparedHeaders);
718
- }
719
- headers ??= {};
720
- for (const [k, v] of Object.entries(headers))if ("string" == typeof v) this.#headers.set(k, v);
721
- else {
722
- this.#headers.delete(k);
723
- for (const v2 of v)this.#headers.append(k, v2);
724
- }
725
- return new Response(data, {
726
- status,
727
- headers: this.#headers
728
- });
729
- };
730
- body = (data, arg, headers)=>"number" == typeof arg ? this.newResponse(data, arg, headers) : this.newResponse(data, arg);
731
- text = (text, arg, headers)=>{
732
- if (!this.#preparedHeaders) {
733
- if (this.#isFresh && !headers && !arg) return new Response(text);
734
- this.#preparedHeaders = {};
735
- }
736
- this.#preparedHeaders["content-type"] = TEXT_PLAIN;
737
- return "number" == typeof arg ? this.newResponse(text, arg, headers) : this.newResponse(text, arg);
738
- };
739
- json = (object, arg, headers)=>{
740
- const body = JSON.stringify(object);
741
- this.#preparedHeaders ??= {};
742
- this.#preparedHeaders["content-type"] = "application/json; charset=UTF-8";
743
- return "number" == typeof arg ? this.newResponse(body, arg, headers) : this.newResponse(body, arg);
744
- };
745
- html = (html, arg, headers)=>{
746
- this.#preparedHeaders ??= {};
747
- this.#preparedHeaders["content-type"] = "text/html; charset=UTF-8";
748
- if ("object" == typeof html) return resolveCallback(html, HtmlEscapedCallbackPhase.Stringify, false, {}).then((html2)=>"number" == typeof arg ? this.newResponse(html2, arg, headers) : this.newResponse(html2, arg));
749
- return "number" == typeof arg ? this.newResponse(html, arg, headers) : this.newResponse(html, arg);
750
- };
751
- redirect = (location, status)=>{
752
- this.#headers ??= new Headers();
753
- this.#headers.set("Location", location);
754
- return this.newResponse(null, status ?? 302);
755
- };
756
- notFound = ()=>{
757
- this.#notFoundHandler ??= ()=>new Response();
758
- return this.#notFoundHandler(this);
759
- };
591
+ #rawRequest;
592
+ #req;
593
+ env = {};
594
+ #var;
595
+ finalized = false;
596
+ error;
597
+ #status = 200;
598
+ #executionCtx;
599
+ #headers;
600
+ #preparedHeaders;
601
+ #res;
602
+ #isFresh = true;
603
+ #layout;
604
+ #renderer;
605
+ #notFoundHandler;
606
+ #matchResult;
607
+ #path;
608
+ constructor(req, options) {
609
+ this.#rawRequest = req;
610
+ if (options) {
611
+ this.#executionCtx = options.executionCtx;
612
+ this.env = options.env;
613
+ this.#notFoundHandler = options.notFoundHandler;
614
+ this.#path = options.path;
615
+ this.#matchResult = options.matchResult;
616
+ }
617
+ }
618
+ get req() {
619
+ this.#req ??= new HonoRequest(this.#rawRequest, this.#path, this.#matchResult);
620
+ return this.#req;
621
+ }
622
+ get event() {
623
+ if (this.#executionCtx && "respondWith" in this.#executionCtx) return this.#executionCtx;
624
+ else throw Error("This context has no FetchEvent");
625
+ }
626
+ get executionCtx() {
627
+ if (this.#executionCtx) return this.#executionCtx;
628
+ else throw Error("This context has no ExecutionContext");
629
+ }
630
+ get res() {
631
+ this.#isFresh = false;
632
+ return this.#res ||= new Response("404 Not Found", { status: 404 });
633
+ }
634
+ set res(_res) {
635
+ this.#isFresh = false;
636
+ if (this.#res && _res) try {
637
+ for (const [k, v] of this.#res.headers.entries()) {
638
+ if (k === "content-type") continue;
639
+ if (k === "set-cookie") {
640
+ const cookies = this.#res.headers.getSetCookie();
641
+ _res.headers.delete("set-cookie");
642
+ for (const cookie of cookies) _res.headers.append("set-cookie", cookie);
643
+ } else _res.headers.set(k, v);
644
+ }
645
+ } catch (e) {
646
+ if (e instanceof TypeError && e.message.includes("immutable")) {
647
+ this.res = new Response(_res.body, {
648
+ headers: _res.headers,
649
+ status: _res.status
650
+ });
651
+ return;
652
+ } else throw e;
653
+ }
654
+ this.#res = _res;
655
+ this.finalized = true;
656
+ }
657
+ render = (...args) => {
658
+ this.#renderer ??= (content) => this.html(content);
659
+ return this.#renderer(...args);
660
+ };
661
+ setLayout = (layout) => this.#layout = layout;
662
+ getLayout = () => this.#layout;
663
+ setRenderer = (renderer) => {
664
+ this.#renderer = renderer;
665
+ };
666
+ header = (name, value, options) => {
667
+ if (value === void 0) {
668
+ if (this.#headers) this.#headers.delete(name);
669
+ else if (this.#preparedHeaders) delete this.#preparedHeaders[name.toLocaleLowerCase()];
670
+ if (this.finalized) this.res.headers.delete(name);
671
+ return;
672
+ }
673
+ if (options?.append) {
674
+ if (!this.#headers) {
675
+ this.#isFresh = false;
676
+ this.#headers = new Headers(this.#preparedHeaders);
677
+ this.#preparedHeaders = {};
678
+ }
679
+ this.#headers.append(name, value);
680
+ } else if (this.#headers) this.#headers.set(name, value);
681
+ else {
682
+ this.#preparedHeaders ??= {};
683
+ this.#preparedHeaders[name.toLowerCase()] = value;
684
+ }
685
+ if (this.finalized) if (options?.append) this.res.headers.append(name, value);
686
+ else this.res.headers.set(name, value);
687
+ };
688
+ status = (status) => {
689
+ this.#isFresh = false;
690
+ this.#status = status;
691
+ };
692
+ set = (key, value) => {
693
+ this.#var ??= /* @__PURE__ */ new Map();
694
+ this.#var.set(key, value);
695
+ };
696
+ get = (key) => {
697
+ return this.#var ? this.#var.get(key) : void 0;
698
+ };
699
+ get var() {
700
+ if (!this.#var) return {};
701
+ return Object.fromEntries(this.#var);
702
+ }
703
+ newResponse = (data, arg, headers) => {
704
+ if (this.#isFresh && !headers && !arg && this.#status === 200) return new Response(data, { headers: this.#preparedHeaders });
705
+ if (arg && typeof arg !== "number") {
706
+ const header = new Headers(arg.headers);
707
+ if (this.#headers) this.#headers.forEach((v, k) => {
708
+ if (k === "set-cookie") header.append(k, v);
709
+ else header.set(k, v);
710
+ });
711
+ const headers2 = setHeaders(header, this.#preparedHeaders);
712
+ return new Response(data, {
713
+ headers: headers2,
714
+ status: arg.status ?? this.#status
715
+ });
716
+ }
717
+ const status = typeof arg === "number" ? arg : this.#status;
718
+ this.#preparedHeaders ??= {};
719
+ this.#headers ??= new Headers();
720
+ setHeaders(this.#headers, this.#preparedHeaders);
721
+ if (this.#res) {
722
+ this.#res.headers.forEach((v, k) => {
723
+ if (k === "set-cookie") this.#headers?.append(k, v);
724
+ else this.#headers?.set(k, v);
725
+ });
726
+ setHeaders(this.#headers, this.#preparedHeaders);
727
+ }
728
+ headers ??= {};
729
+ for (const [k, v] of Object.entries(headers)) if (typeof v === "string") this.#headers.set(k, v);
730
+ else {
731
+ this.#headers.delete(k);
732
+ for (const v2 of v) this.#headers.append(k, v2);
733
+ }
734
+ return new Response(data, {
735
+ status,
736
+ headers: this.#headers
737
+ });
738
+ };
739
+ body = (data, arg, headers) => {
740
+ return typeof arg === "number" ? this.newResponse(data, arg, headers) : this.newResponse(data, arg);
741
+ };
742
+ text = (text, arg, headers) => {
743
+ if (!this.#preparedHeaders) {
744
+ if (this.#isFresh && !headers && !arg) return new Response(text);
745
+ this.#preparedHeaders = {};
746
+ }
747
+ this.#preparedHeaders["content-type"] = TEXT_PLAIN;
748
+ return typeof arg === "number" ? this.newResponse(text, arg, headers) : this.newResponse(text, arg);
749
+ };
750
+ json = (object, arg, headers) => {
751
+ const body = JSON.stringify(object);
752
+ this.#preparedHeaders ??= {};
753
+ this.#preparedHeaders["content-type"] = "application/json; charset=UTF-8";
754
+ return typeof arg === "number" ? this.newResponse(body, arg, headers) : this.newResponse(body, arg);
755
+ };
756
+ html = (html, arg, headers) => {
757
+ this.#preparedHeaders ??= {};
758
+ this.#preparedHeaders["content-type"] = "text/html; charset=UTF-8";
759
+ if (typeof html === "object") return resolveCallback(html, HtmlEscapedCallbackPhase.Stringify, false, {}).then((html2) => {
760
+ return typeof arg === "number" ? this.newResponse(html2, arg, headers) : this.newResponse(html2, arg);
761
+ });
762
+ return typeof arg === "number" ? this.newResponse(html, arg, headers) : this.newResponse(html, arg);
763
+ };
764
+ redirect = (location, status) => {
765
+ this.#headers ??= new Headers();
766
+ this.#headers.set("Location", location);
767
+ return this.newResponse(null, status ?? 302);
768
+ };
769
+ notFound = () => {
770
+ this.#notFoundHandler ??= () => new Response();
771
+ return this.#notFoundHandler(this);
772
+ };
773
+ };
774
+
775
+ //#endregion
776
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/compose.js
777
+ var compose = (middleware, onError, onNotFound) => {
778
+ return (context, next) => {
779
+ let index = -1;
780
+ return dispatch(0);
781
+ async function dispatch(i) {
782
+ if (i <= index) throw new Error("next() called multiple times");
783
+ index = i;
784
+ let res;
785
+ let isError = false;
786
+ let handler;
787
+ if (middleware[i]) {
788
+ handler = middleware[i][0][0];
789
+ if (context instanceof Context) context.req.routeIndex = i;
790
+ } else handler = i === middleware.length && next || void 0;
791
+ if (!handler) {
792
+ if (context instanceof Context && context.finalized === false && onNotFound) res = await onNotFound(context);
793
+ } else try {
794
+ res = await handler(context, () => {
795
+ return dispatch(i + 1);
796
+ });
797
+ } catch (err) {
798
+ if (err instanceof Error && context instanceof Context && onError) {
799
+ context.error = err;
800
+ res = await onError(err, context);
801
+ isError = true;
802
+ } else throw err;
803
+ }
804
+ if (res && (context.finalized === false || isError)) context.res = res;
805
+ return context;
806
+ }
807
+ };
760
808
  };
761
- var compose = (middleware, onError, onNotFound)=>(context, next)=>{
762
- let index = -1;
763
- return dispatch(0);
764
- async function dispatch(i) {
765
- if (i <= index) throw new Error("next() called multiple times");
766
- index = i;
767
- let res;
768
- let isError = false;
769
- let handler;
770
- if (middleware[i]) {
771
- handler = middleware[i][0][0];
772
- if (context instanceof Context) context.req.routeIndex = i;
773
- } else handler = i === middleware.length && next || void 0;
774
- if (handler) try {
775
- res = await handler(context, ()=>dispatch(i + 1));
776
- } catch (err) {
777
- if (err instanceof Error && context instanceof Context && onError) {
778
- context.error = err;
779
- res = await onError(err, context);
780
- isError = true;
781
- } else throw err;
782
- }
783
- else if (context instanceof Context && false === context.finalized && onNotFound) res = await onNotFound(context);
784
- if (res && (false === context.finalized || isError)) context.res = res;
785
- return context;
786
- }
787
- };
809
+
810
+ //#endregion
811
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router.js
788
812
  var METHOD_NAME_ALL = "ALL";
789
813
  var METHOD_NAME_ALL_LOWERCASE = "all";
790
814
  var METHODS = [
791
- "get",
792
- "post",
793
- "put",
794
- "delete",
795
- "options",
796
- "patch"
815
+ "get",
816
+ "post",
817
+ "put",
818
+ "delete",
819
+ "options",
820
+ "patch"
797
821
  ];
798
822
  var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built.";
799
- var UnsupportedPathError = class extends Error {
800
- };
823
+ var UnsupportedPathError = class extends Error {};
824
+
825
+ //#endregion
826
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/hono-base.js
801
827
  var COMPOSED_HANDLER = Symbol("composedHandler");
802
- var notFoundHandler = (c)=>c.text("404 Not Found", 404);
803
- var errorHandler = (err, c)=>{
804
- if ("getResponse" in err) return err.getResponse();
805
- console.error(err);
806
- return c.text("Internal Server Error", 500);
828
+ var notFoundHandler = (c) => {
829
+ return c.text("404 Not Found", 404);
830
+ };
831
+ var errorHandler = (err, c) => {
832
+ if ("getResponse" in err) return err.getResponse();
833
+ console.error(err);
834
+ return c.text("Internal Server Error", 500);
807
835
  };
808
- var Hono = class {
809
- get;
810
- post;
811
- put;
812
- delete;
813
- options;
814
- patch;
815
- all;
816
- on;
817
- use;
818
- router;
819
- getPath;
820
- _basePath = "/";
821
- #path = "/";
822
- routes = [];
823
- constructor(options = {}){
824
- const allMethods = [
825
- ...METHODS,
826
- METHOD_NAME_ALL_LOWERCASE
827
- ];
828
- allMethods.forEach((method)=>{
829
- this[method] = (args1, ...args)=>{
830
- if ("string" == typeof args1) this.#path = args1;
831
- else this.addRoute(method, this.#path, args1);
832
- args.forEach((handler)=>{
833
- if ("string" != typeof handler) this.addRoute(method, this.#path, handler);
834
- });
835
- return this;
836
- };
837
- });
838
- this.on = (method, path, ...handlers)=>{
839
- for (const p of [
840
- path
841
- ].flat()){
842
- this.#path = p;
843
- for (const m of [
844
- method
845
- ].flat())handlers.map((handler)=>{
846
- this.addRoute(m.toUpperCase(), this.#path, handler);
847
- });
848
- }
849
- return this;
850
- };
851
- this.use = (arg1, ...handlers)=>{
852
- if ("string" == typeof arg1) this.#path = arg1;
853
- else {
854
- this.#path = "*";
855
- handlers.unshift(arg1);
856
- }
857
- handlers.forEach((handler)=>{
858
- this.addRoute(METHOD_NAME_ALL, this.#path, handler);
859
- });
860
- return this;
861
- };
862
- const strict = options.strict ?? true;
863
- delete options.strict;
864
- Object.assign(this, options);
865
- this.getPath = strict ? options.getPath ?? getPath : getPathNoStrict;
866
- }
867
- clone() {
868
- const clone = new Hono({
869
- router: this.router,
870
- getPath: this.getPath
871
- });
872
- clone.routes = this.routes;
873
- return clone;
874
- }
875
- notFoundHandler = notFoundHandler;
876
- errorHandler = errorHandler;
877
- route(path, app) {
878
- const subApp = this.basePath(path);
879
- app.routes.map((r)=>{
880
- let handler;
881
- if (app.errorHandler === errorHandler) handler = r.handler;
882
- else {
883
- handler = async (c, next)=>(await compose([], app.errorHandler)(c, ()=>r.handler(c, next))).res;
884
- handler[COMPOSED_HANDLER] = r.handler;
885
- }
886
- subApp.addRoute(r.method, r.path, handler);
887
- });
888
- return this;
889
- }
890
- basePath(path) {
891
- const subApp = this.clone();
892
- subApp._basePath = mergePath(this._basePath, path);
893
- return subApp;
894
- }
895
- onError = (handler)=>{
896
- this.errorHandler = handler;
897
- return this;
898
- };
899
- notFound = (handler)=>{
900
- this.notFoundHandler = handler;
901
- return this;
902
- };
903
- mount(path, applicationHandler, options) {
904
- let replaceRequest;
905
- let optionHandler;
906
- if (options) if ("function" == typeof options) optionHandler = options;
907
- else {
908
- optionHandler = options.optionHandler;
909
- replaceRequest = options.replaceRequest;
910
- }
911
- const getOptions = optionHandler ? (c)=>{
912
- const options2 = optionHandler(c);
913
- return Array.isArray(options2) ? options2 : [
914
- options2
915
- ];
916
- } : (c)=>{
917
- let executionContext;
918
- try {
919
- executionContext = c.executionCtx;
920
- } catch {}
921
- return [
922
- c.env,
923
- executionContext
924
- ];
925
- };
926
- replaceRequest ||= (()=>{
927
- const mergedPath = mergePath(this._basePath, path);
928
- const pathPrefixLength = "/" === mergedPath ? 0 : mergedPath.length;
929
- return (request)=>{
930
- const url = new URL(request.url);
931
- url.pathname = url.pathname.slice(pathPrefixLength) || "/";
932
- return new Request(url, request);
933
- };
934
- })();
935
- const handler = async (c, next)=>{
936
- const res = await applicationHandler(replaceRequest(c.req.raw), ...getOptions(c));
937
- if (res) return res;
938
- await next();
939
- };
940
- this.addRoute(METHOD_NAME_ALL, mergePath(path, "*"), handler);
941
- return this;
942
- }
943
- addRoute(method, path, handler) {
944
- method = method.toUpperCase();
945
- path = mergePath(this._basePath, path);
946
- const r = {
947
- path,
948
- method,
949
- handler
950
- };
951
- this.router.add(method, path, [
952
- handler,
953
- r
954
- ]);
955
- this.routes.push(r);
956
- }
957
- matchRoute(method, path) {
958
- return this.router.match(method, path);
959
- }
960
- handleError(err, c) {
961
- if (err instanceof Error) return this.errorHandler(err, c);
962
- throw err;
963
- }
964
- dispatch(request, executionCtx, env, method) {
965
- if ("HEAD" === method) return (async ()=>new Response(null, await this.dispatch(request, executionCtx, env, "GET")))();
966
- const path = this.getPath(request, {
967
- env
968
- });
969
- const matchResult = this.matchRoute(method, path);
970
- const c = new Context(request, {
971
- path,
972
- matchResult,
973
- env,
974
- executionCtx,
975
- notFoundHandler: this.notFoundHandler
976
- });
977
- if (1 === matchResult[0].length) {
978
- let res;
979
- try {
980
- res = matchResult[0][0][0][0](c, async ()=>{
981
- c.res = await this.notFoundHandler(c);
982
- });
983
- } catch (err) {
984
- return this.handleError(err, c);
985
- }
986
- return res instanceof Promise ? res.then((resolved)=>resolved || (c.finalized ? c.res : this.notFoundHandler(c))).catch((err)=>this.handleError(err, c)) : res ?? this.notFoundHandler(c);
987
- }
988
- const composed = compose(matchResult[0], this.errorHandler, this.notFoundHandler);
989
- return (async ()=>{
990
- try {
991
- const context = await composed(c);
992
- if (!context.finalized) throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");
993
- return context.res;
994
- } catch (err) {
995
- return this.handleError(err, c);
996
- }
997
- })();
998
- }
999
- fetch = (request, ...rest)=>this.dispatch(request, rest[1], rest[0], request.method);
1000
- request = (input, requestInit, Env, executionCtx)=>{
1001
- if (input instanceof Request) {
1002
- if (void 0 !== requestInit) input = new Request(input, requestInit);
1003
- return this.fetch(input, Env, executionCtx);
1004
- }
1005
- input = input.toString();
1006
- const path = /^https?:\/\//.test(input) ? input : `http://localhost${mergePath("/", input)}`;
1007
- const req = new Request(path, requestInit);
1008
- return this.fetch(req, Env, executionCtx);
1009
- };
1010
- fire = ()=>{
1011
- addEventListener("fetch", (event)=>{
1012
- event.respondWith(this.dispatch(event.request, event, void 0, event.request.method));
1013
- });
1014
- };
836
+ var Hono$1 = class {
837
+ get;
838
+ post;
839
+ put;
840
+ delete;
841
+ options;
842
+ patch;
843
+ all;
844
+ on;
845
+ use;
846
+ router;
847
+ getPath;
848
+ _basePath = "/";
849
+ #path = "/";
850
+ routes = [];
851
+ constructor(options = {}) {
852
+ const allMethods = [...METHODS, METHOD_NAME_ALL_LOWERCASE];
853
+ allMethods.forEach((method) => {
854
+ this[method] = (args1, ...args) => {
855
+ if (typeof args1 === "string") this.#path = args1;
856
+ else this.addRoute(method, this.#path, args1);
857
+ args.forEach((handler) => {
858
+ if (typeof handler !== "string") this.addRoute(method, this.#path, handler);
859
+ });
860
+ return this;
861
+ };
862
+ });
863
+ this.on = (method, path$1, ...handlers) => {
864
+ for (const p of [path$1].flat()) {
865
+ this.#path = p;
866
+ for (const m of [method].flat()) handlers.map((handler) => {
867
+ this.addRoute(m.toUpperCase(), this.#path, handler);
868
+ });
869
+ }
870
+ return this;
871
+ };
872
+ this.use = (arg1, ...handlers) => {
873
+ if (typeof arg1 === "string") this.#path = arg1;
874
+ else {
875
+ this.#path = "*";
876
+ handlers.unshift(arg1);
877
+ }
878
+ handlers.forEach((handler) => {
879
+ this.addRoute(METHOD_NAME_ALL, this.#path, handler);
880
+ });
881
+ return this;
882
+ };
883
+ const strict = options.strict ?? true;
884
+ delete options.strict;
885
+ Object.assign(this, options);
886
+ this.getPath = strict ? options.getPath ?? getPath : getPathNoStrict;
887
+ }
888
+ clone() {
889
+ const clone = new Hono$1({
890
+ router: this.router,
891
+ getPath: this.getPath
892
+ });
893
+ clone.routes = this.routes;
894
+ return clone;
895
+ }
896
+ notFoundHandler = notFoundHandler;
897
+ errorHandler = errorHandler;
898
+ route(path$1, app$1) {
899
+ const subApp = this.basePath(path$1);
900
+ app$1.routes.map((r) => {
901
+ let handler;
902
+ if (app$1.errorHandler === errorHandler) handler = r.handler;
903
+ else {
904
+ handler = async (c, next) => (await compose([], app$1.errorHandler)(c, () => r.handler(c, next))).res;
905
+ handler[COMPOSED_HANDLER] = r.handler;
906
+ }
907
+ subApp.addRoute(r.method, r.path, handler);
908
+ });
909
+ return this;
910
+ }
911
+ basePath(path$1) {
912
+ const subApp = this.clone();
913
+ subApp._basePath = mergePath(this._basePath, path$1);
914
+ return subApp;
915
+ }
916
+ onError = (handler) => {
917
+ this.errorHandler = handler;
918
+ return this;
919
+ };
920
+ notFound = (handler) => {
921
+ this.notFoundHandler = handler;
922
+ return this;
923
+ };
924
+ mount(path$1, applicationHandler, options) {
925
+ let replaceRequest;
926
+ let optionHandler;
927
+ if (options) if (typeof options === "function") optionHandler = options;
928
+ else {
929
+ optionHandler = options.optionHandler;
930
+ replaceRequest = options.replaceRequest;
931
+ }
932
+ const getOptions = optionHandler ? (c) => {
933
+ const options2 = optionHandler(c);
934
+ return Array.isArray(options2) ? options2 : [options2];
935
+ } : (c) => {
936
+ let executionContext = void 0;
937
+ try {
938
+ executionContext = c.executionCtx;
939
+ } catch {}
940
+ return [c.env, executionContext];
941
+ };
942
+ replaceRequest ||= (() => {
943
+ const mergedPath = mergePath(this._basePath, path$1);
944
+ const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
945
+ return (request) => {
946
+ const url = new URL(request.url);
947
+ url.pathname = url.pathname.slice(pathPrefixLength) || "/";
948
+ return new Request(url, request);
949
+ };
950
+ })();
951
+ const handler = async (c, next) => {
952
+ const res = await applicationHandler(replaceRequest(c.req.raw), ...getOptions(c));
953
+ if (res) return res;
954
+ await next();
955
+ };
956
+ this.addRoute(METHOD_NAME_ALL, mergePath(path$1, "*"), handler);
957
+ return this;
958
+ }
959
+ addRoute(method, path$1, handler) {
960
+ method = method.toUpperCase();
961
+ path$1 = mergePath(this._basePath, path$1);
962
+ const r = {
963
+ path: path$1,
964
+ method,
965
+ handler
966
+ };
967
+ this.router.add(method, path$1, [handler, r]);
968
+ this.routes.push(r);
969
+ }
970
+ matchRoute(method, path$1) {
971
+ return this.router.match(method, path$1);
972
+ }
973
+ handleError(err, c) {
974
+ if (err instanceof Error) return this.errorHandler(err, c);
975
+ throw err;
976
+ }
977
+ dispatch(request, executionCtx, env, method) {
978
+ if (method === "HEAD") return (async () => new Response(null, await this.dispatch(request, executionCtx, env, "GET")))();
979
+ const path$1 = this.getPath(request, { env });
980
+ const matchResult = this.matchRoute(method, path$1);
981
+ const c = new Context(request, {
982
+ path: path$1,
983
+ matchResult,
984
+ env,
985
+ executionCtx,
986
+ notFoundHandler: this.notFoundHandler
987
+ });
988
+ if (matchResult[0].length === 1) {
989
+ let res;
990
+ try {
991
+ res = matchResult[0][0][0][0](c, async () => {
992
+ c.res = await this.notFoundHandler(c);
993
+ });
994
+ } catch (err) {
995
+ return this.handleError(err, c);
996
+ }
997
+ return res instanceof Promise ? res.then((resolved) => resolved || (c.finalized ? c.res : this.notFoundHandler(c))).catch((err) => this.handleError(err, c)) : res ?? this.notFoundHandler(c);
998
+ }
999
+ const composed = compose(matchResult[0], this.errorHandler, this.notFoundHandler);
1000
+ return (async () => {
1001
+ try {
1002
+ const context = await composed(c);
1003
+ if (!context.finalized) throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");
1004
+ return context.res;
1005
+ } catch (err) {
1006
+ return this.handleError(err, c);
1007
+ }
1008
+ })();
1009
+ }
1010
+ fetch = (request, ...rest) => {
1011
+ return this.dispatch(request, rest[1], rest[0], request.method);
1012
+ };
1013
+ request = (input, requestInit, Env, executionCtx) => {
1014
+ if (input instanceof Request) {
1015
+ if (requestInit !== void 0) input = new Request(input, requestInit);
1016
+ return this.fetch(input, Env, executionCtx);
1017
+ }
1018
+ input = input.toString();
1019
+ const path$1 = /^https?:\/\//.test(input) ? input : `http://localhost${mergePath("/", input)}`;
1020
+ const req = new Request(path$1, requestInit);
1021
+ return this.fetch(req, Env, executionCtx);
1022
+ };
1023
+ fire = () => {
1024
+ addEventListener("fetch", (event) => {
1025
+ event.respondWith(this.dispatch(event.request, event, void 0, event.request.method));
1026
+ });
1027
+ };
1015
1028
  };
1029
+
1030
+ //#endregion
1031
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/reg-exp-router/node.js
1016
1032
  var LABEL_REG_EXP_STR = "[^/]+";
1017
1033
  var ONLY_WILDCARD_REG_EXP_STR = ".*";
1018
1034
  var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
1019
1035
  var PATH_ERROR = Symbol();
1020
1036
  var regExpMetaChars = new Set(".\\+*[^]$()");
1021
1037
  function compareKey(a, b) {
1022
- if (1 === a.length) return 1 === b.length ? a < b ? -1 : 1 : -1;
1023
- if (1 === b.length) return 1;
1024
- if (a === ONLY_WILDCARD_REG_EXP_STR || a === TAIL_WILDCARD_REG_EXP_STR) return 1;
1025
- if (b === ONLY_WILDCARD_REG_EXP_STR || b === TAIL_WILDCARD_REG_EXP_STR) return -1;
1026
- if (a === LABEL_REG_EXP_STR) return 1;
1027
- if (b === LABEL_REG_EXP_STR) return -1;
1028
- return a.length === b.length ? a < b ? -1 : 1 : b.length - a.length;
1038
+ if (a.length === 1) return b.length === 1 ? a < b ? -1 : 1 : -1;
1039
+ if (b.length === 1) return 1;
1040
+ if (a === ONLY_WILDCARD_REG_EXP_STR || a === TAIL_WILDCARD_REG_EXP_STR) return 1;
1041
+ else if (b === ONLY_WILDCARD_REG_EXP_STR || b === TAIL_WILDCARD_REG_EXP_STR) return -1;
1042
+ if (a === LABEL_REG_EXP_STR) return 1;
1043
+ else if (b === LABEL_REG_EXP_STR) return -1;
1044
+ return a.length === b.length ? a < b ? -1 : 1 : b.length - a.length;
1029
1045
  }
1030
- var Node = class {
1031
- index;
1032
- varIndex;
1033
- children = /* @__PURE__ */ Object.create(null);
1034
- insert(tokens, index, paramMap, context, pathErrorCheckOnly) {
1035
- if (0 === tokens.length) {
1036
- if (void 0 !== this.index) throw PATH_ERROR;
1037
- if (pathErrorCheckOnly) return;
1038
- this.index = index;
1039
- return;
1040
- }
1041
- const [token, ...restTokens] = tokens;
1042
- const pattern = "*" === token ? 0 === restTokens.length ? [
1043
- "",
1044
- "",
1045
- ONLY_WILDCARD_REG_EXP_STR
1046
- ] : [
1047
- "",
1048
- "",
1049
- LABEL_REG_EXP_STR
1050
- ] : "/*" === token ? [
1051
- "",
1052
- "",
1053
- TAIL_WILDCARD_REG_EXP_STR
1054
- ] : token.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
1055
- let node;
1056
- if (pattern) {
1057
- const name = pattern[1];
1058
- let regexpStr = pattern[2] || LABEL_REG_EXP_STR;
1059
- if (name && pattern[2]) {
1060
- regexpStr = regexpStr.replace(/^\((?!\?:)(?=[^)]+\)$)/, "(?:");
1061
- if (/\((?!\?:)/.test(regexpStr)) throw PATH_ERROR;
1062
- }
1063
- node = this.children[regexpStr];
1064
- if (!node) {
1065
- if (Object.keys(this.children).some((k)=>k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR)) throw PATH_ERROR;
1066
- if (pathErrorCheckOnly) return;
1067
- node = this.children[regexpStr] = new Node();
1068
- if ("" !== name) node.varIndex = context.varIndex++;
1069
- }
1070
- if (!pathErrorCheckOnly && "" !== name) paramMap.push([
1071
- name,
1072
- node.varIndex
1073
- ]);
1074
- } else {
1075
- node = this.children[token];
1076
- if (!node) {
1077
- if (Object.keys(this.children).some((k)=>k.length > 1 && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR)) throw PATH_ERROR;
1078
- if (pathErrorCheckOnly) return;
1079
- node = this.children[token] = new Node();
1080
- }
1081
- }
1082
- node.insert(restTokens, index, paramMap, context, pathErrorCheckOnly);
1083
- }
1084
- buildRegExpStr() {
1085
- const childKeys = Object.keys(this.children).sort(compareKey);
1086
- const strList = childKeys.map((k)=>{
1087
- const c = this.children[k];
1088
- return ("number" == typeof c.varIndex ? `(${k})@${c.varIndex}` : regExpMetaChars.has(k) ? `\\${k}` : k) + c.buildRegExpStr();
1089
- });
1090
- if ("number" == typeof this.index) strList.unshift(`#${this.index}`);
1091
- if (0 === strList.length) return "";
1092
- if (1 === strList.length) return strList[0];
1093
- return "(?:" + strList.join("|") + ")";
1094
- }
1046
+ var Node$1 = class {
1047
+ index;
1048
+ varIndex;
1049
+ children = /* @__PURE__ */ Object.create(null);
1050
+ insert(tokens, index, paramMap, context, pathErrorCheckOnly) {
1051
+ if (tokens.length === 0) {
1052
+ if (this.index !== void 0) throw PATH_ERROR;
1053
+ if (pathErrorCheckOnly) return;
1054
+ this.index = index;
1055
+ return;
1056
+ }
1057
+ const [token, ...restTokens] = tokens;
1058
+ const pattern = token === "*" ? restTokens.length === 0 ? [
1059
+ "",
1060
+ "",
1061
+ ONLY_WILDCARD_REG_EXP_STR
1062
+ ] : [
1063
+ "",
1064
+ "",
1065
+ LABEL_REG_EXP_STR
1066
+ ] : token === "/*" ? [
1067
+ "",
1068
+ "",
1069
+ TAIL_WILDCARD_REG_EXP_STR
1070
+ ] : token.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
1071
+ let node;
1072
+ if (pattern) {
1073
+ const name = pattern[1];
1074
+ let regexpStr = pattern[2] || LABEL_REG_EXP_STR;
1075
+ if (name && pattern[2]) {
1076
+ regexpStr = regexpStr.replace(/^\((?!\?:)(?=[^)]+\)$)/, "(?:");
1077
+ if (/\((?!\?:)/.test(regexpStr)) throw PATH_ERROR;
1078
+ }
1079
+ node = this.children[regexpStr];
1080
+ if (!node) {
1081
+ if (Object.keys(this.children).some((k) => k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR)) throw PATH_ERROR;
1082
+ if (pathErrorCheckOnly) return;
1083
+ node = this.children[regexpStr] = new Node$1();
1084
+ if (name !== "") node.varIndex = context.varIndex++;
1085
+ }
1086
+ if (!pathErrorCheckOnly && name !== "") paramMap.push([name, node.varIndex]);
1087
+ } else {
1088
+ node = this.children[token];
1089
+ if (!node) {
1090
+ if (Object.keys(this.children).some((k) => k.length > 1 && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR)) throw PATH_ERROR;
1091
+ if (pathErrorCheckOnly) return;
1092
+ node = this.children[token] = new Node$1();
1093
+ }
1094
+ }
1095
+ node.insert(restTokens, index, paramMap, context, pathErrorCheckOnly);
1096
+ }
1097
+ buildRegExpStr() {
1098
+ const childKeys = Object.keys(this.children).sort(compareKey);
1099
+ const strList = childKeys.map((k) => {
1100
+ const c = this.children[k];
1101
+ return (typeof c.varIndex === "number" ? `(${k})@${c.varIndex}` : regExpMetaChars.has(k) ? `\\${k}` : k) + c.buildRegExpStr();
1102
+ });
1103
+ if (typeof this.index === "number") strList.unshift(`#${this.index}`);
1104
+ if (strList.length === 0) return "";
1105
+ if (strList.length === 1) return strList[0];
1106
+ return "(?:" + strList.join("|") + ")";
1107
+ }
1095
1108
  };
1109
+
1110
+ //#endregion
1111
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/reg-exp-router/trie.js
1096
1112
  var Trie = class {
1097
- context = {
1098
- varIndex: 0
1099
- };
1100
- root = new Node();
1101
- insert(path, index, pathErrorCheckOnly) {
1102
- const paramAssoc = [];
1103
- const groups = [];
1104
- for(let i = 0;;){
1105
- let replaced = false;
1106
- path = path.replace(/\{[^}]+\}/g, (m)=>{
1107
- const mark = `@\\${i}`;
1108
- groups[i] = [
1109
- mark,
1110
- m
1111
- ];
1112
- i++;
1113
- replaced = true;
1114
- return mark;
1115
- });
1116
- if (!replaced) break;
1117
- }
1118
- const tokens = path.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
1119
- for(let i = groups.length - 1; i >= 0; i--){
1120
- const [mark] = groups[i];
1121
- for(let j = tokens.length - 1; j >= 0; j--)if (-1 !== tokens[j].indexOf(mark)) {
1122
- tokens[j] = tokens[j].replace(mark, groups[i][1]);
1123
- break;
1124
- }
1125
- }
1126
- this.root.insert(tokens, index, paramAssoc, this.context, pathErrorCheckOnly);
1127
- return paramAssoc;
1128
- }
1129
- buildRegExp() {
1130
- let regexp = this.root.buildRegExpStr();
1131
- if ("" === regexp) return [
1132
- /^$/,
1133
- [],
1134
- []
1135
- ];
1136
- let captureIndex = 0;
1137
- const indexReplacementMap = [];
1138
- const paramReplacementMap = [];
1139
- regexp = regexp.replace(/#(\d+)|@(\d+)|\.\*\$/g, (_, handlerIndex, paramIndex)=>{
1140
- if (void 0 !== handlerIndex) {
1141
- indexReplacementMap[++captureIndex] = Number(handlerIndex);
1142
- return "$()";
1143
- }
1144
- if (void 0 !== paramIndex) paramReplacementMap[Number(paramIndex)] = ++captureIndex;
1145
- return "";
1146
- });
1147
- return [
1148
- new RegExp(`^${regexp}`),
1149
- indexReplacementMap,
1150
- paramReplacementMap
1151
- ];
1152
- }
1113
+ context = { varIndex: 0 };
1114
+ root = new Node$1();
1115
+ insert(path$1, index, pathErrorCheckOnly) {
1116
+ const paramAssoc = [];
1117
+ const groups = [];
1118
+ for (let i = 0;;) {
1119
+ let replaced = false;
1120
+ path$1 = path$1.replace(/\{[^}]+\}/g, (m) => {
1121
+ const mark = `@\\${i}`;
1122
+ groups[i] = [mark, m];
1123
+ i++;
1124
+ replaced = true;
1125
+ return mark;
1126
+ });
1127
+ if (!replaced) break;
1128
+ }
1129
+ const tokens = path$1.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
1130
+ for (let i = groups.length - 1; i >= 0; i--) {
1131
+ const [mark] = groups[i];
1132
+ for (let j = tokens.length - 1; j >= 0; j--) if (tokens[j].indexOf(mark) !== -1) {
1133
+ tokens[j] = tokens[j].replace(mark, groups[i][1]);
1134
+ break;
1135
+ }
1136
+ }
1137
+ this.root.insert(tokens, index, paramAssoc, this.context, pathErrorCheckOnly);
1138
+ return paramAssoc;
1139
+ }
1140
+ buildRegExp() {
1141
+ let regexp = this.root.buildRegExpStr();
1142
+ if (regexp === "") return [
1143
+ /^$/,
1144
+ [],
1145
+ []
1146
+ ];
1147
+ let captureIndex = 0;
1148
+ const indexReplacementMap = [];
1149
+ const paramReplacementMap = [];
1150
+ regexp = regexp.replace(/#(\d+)|@(\d+)|\.\*\$/g, (_, handlerIndex, paramIndex) => {
1151
+ if (typeof handlerIndex !== "undefined") {
1152
+ indexReplacementMap[++captureIndex] = Number(handlerIndex);
1153
+ return "$()";
1154
+ }
1155
+ if (typeof paramIndex !== "undefined") {
1156
+ paramReplacementMap[Number(paramIndex)] = ++captureIndex;
1157
+ return "";
1158
+ }
1159
+ return "";
1160
+ });
1161
+ return [
1162
+ new RegExp(`^${regexp}`),
1163
+ indexReplacementMap,
1164
+ paramReplacementMap
1165
+ ];
1166
+ }
1153
1167
  };
1168
+
1169
+ //#endregion
1170
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/reg-exp-router/router.js
1154
1171
  var emptyParam = [];
1155
1172
  var nullMatcher = [
1156
- /^$/,
1157
- [],
1158
- /* @__PURE__ */ Object.create(null)
1173
+ /^$/,
1174
+ [],
1175
+ /* @__PURE__ */ Object.create(null)
1159
1176
  ];
1160
1177
  var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
1161
- function buildWildcardRegExp(path) {
1162
- return wildcardRegExpCache[path] ??= new RegExp("*" === path ? "" : `^${path.replace(/\/\*$|([.\\+*[^\]$()])/g, (_, metaChar)=>metaChar ? `\\${metaChar}` : "(?:|/.*)")}$`);
1178
+ function buildWildcardRegExp(path$1) {
1179
+ return wildcardRegExpCache[path$1] ??= new RegExp(path$1 === "*" ? "" : `^${path$1.replace(/\/\*$|([.\\+*[^\]$()])/g, (_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)")}$`);
1163
1180
  }
1164
1181
  function clearWildcardRegExpCache() {
1165
- wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
1182
+ wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
1166
1183
  }
1167
1184
  function buildMatcherFromPreprocessedRoutes(routes) {
1168
- const trie = new Trie();
1169
- const handlerData = [];
1170
- if (0 === routes.length) return nullMatcher;
1171
- const routesWithStaticPathFlag = routes.map((route)=>[
1172
- !/\*|\/:/.test(route[0]),
1173
- ...route
1174
- ]).sort(([isStaticA, pathA], [isStaticB, pathB])=>isStaticA ? 1 : isStaticB ? -1 : pathA.length - pathB.length);
1175
- const staticMap = /* @__PURE__ */ Object.create(null);
1176
- for(let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++){
1177
- const [pathErrorCheckOnly, path, handlers] = routesWithStaticPathFlag[i];
1178
- if (pathErrorCheckOnly) staticMap[path] = [
1179
- handlers.map(([h])=>[
1180
- h,
1181
- /* @__PURE__ */ Object.create(null)
1182
- ]),
1183
- emptyParam
1184
- ];
1185
- else j++;
1186
- let paramAssoc;
1187
- try {
1188
- paramAssoc = trie.insert(path, j, pathErrorCheckOnly);
1189
- } catch (e) {
1190
- throw e === PATH_ERROR ? new UnsupportedPathError(path) : e;
1191
- }
1192
- if (!pathErrorCheckOnly) handlerData[j] = handlers.map(([h, paramCount])=>{
1193
- const paramIndexMap = /* @__PURE__ */ Object.create(null);
1194
- paramCount -= 1;
1195
- for(; paramCount >= 0; paramCount--){
1196
- const [key, value] = paramAssoc[paramCount];
1197
- paramIndexMap[key] = value;
1198
- }
1199
- return [
1200
- h,
1201
- paramIndexMap
1202
- ];
1203
- });
1204
- }
1205
- const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
1206
- for(let i = 0, len = handlerData.length; i < len; i++)for(let j = 0, len2 = handlerData[i].length; j < len2; j++){
1207
- const map = handlerData[i][j]?.[1];
1208
- if (!map) continue;
1209
- const keys = Object.keys(map);
1210
- for(let k = 0, len3 = keys.length; k < len3; k++)map[keys[k]] = paramReplacementMap[map[keys[k]]];
1211
- }
1212
- const handlerMap = [];
1213
- for(const i in indexReplacementMap)handlerMap[i] = handlerData[indexReplacementMap[i]];
1214
- return [
1215
- regexp,
1216
- handlerMap,
1217
- staticMap
1218
- ];
1185
+ const trie = new Trie();
1186
+ const handlerData = [];
1187
+ if (routes.length === 0) return nullMatcher;
1188
+ const routesWithStaticPathFlag = routes.map((route) => [!/\*|\/:/.test(route[0]), ...route]).sort(([isStaticA, pathA], [isStaticB, pathB]) => isStaticA ? 1 : isStaticB ? -1 : pathA.length - pathB.length);
1189
+ const staticMap = /* @__PURE__ */ Object.create(null);
1190
+ for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
1191
+ const [pathErrorCheckOnly, path$1, handlers] = routesWithStaticPathFlag[i];
1192
+ if (pathErrorCheckOnly) staticMap[path$1] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
1193
+ else j++;
1194
+ let paramAssoc;
1195
+ try {
1196
+ paramAssoc = trie.insert(path$1, j, pathErrorCheckOnly);
1197
+ } catch (e) {
1198
+ throw e === PATH_ERROR ? new UnsupportedPathError(path$1) : e;
1199
+ }
1200
+ if (pathErrorCheckOnly) continue;
1201
+ handlerData[j] = handlers.map(([h, paramCount]) => {
1202
+ const paramIndexMap = /* @__PURE__ */ Object.create(null);
1203
+ paramCount -= 1;
1204
+ for (; paramCount >= 0; paramCount--) {
1205
+ const [key, value] = paramAssoc[paramCount];
1206
+ paramIndexMap[key] = value;
1207
+ }
1208
+ return [h, paramIndexMap];
1209
+ });
1210
+ }
1211
+ const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
1212
+ for (let i = 0, len = handlerData.length; i < len; i++) for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {
1213
+ const map = handlerData[i][j]?.[1];
1214
+ if (!map) continue;
1215
+ const keys = Object.keys(map);
1216
+ for (let k = 0, len3 = keys.length; k < len3; k++) map[keys[k]] = paramReplacementMap[map[keys[k]]];
1217
+ }
1218
+ const handlerMap = [];
1219
+ for (const i in indexReplacementMap) handlerMap[i] = handlerData[indexReplacementMap[i]];
1220
+ return [
1221
+ regexp,
1222
+ handlerMap,
1223
+ staticMap
1224
+ ];
1219
1225
  }
1220
- function findMiddleware(middleware, path) {
1221
- if (!middleware) return;
1222
- for (const k of Object.keys(middleware).sort((a, b)=>b.length - a.length))if (buildWildcardRegExp(k).test(path)) return [
1223
- ...middleware[k]
1224
- ];
1226
+ function findMiddleware(middleware, path$1) {
1227
+ if (!middleware) return void 0;
1228
+ for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) if (buildWildcardRegExp(k).test(path$1)) return [...middleware[k]];
1229
+ return void 0;
1225
1230
  }
1226
1231
  var RegExpRouter = class {
1227
- name = "RegExpRouter";
1228
- middleware;
1229
- routes;
1230
- constructor(){
1231
- this.middleware = {
1232
- [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null)
1233
- };
1234
- this.routes = {
1235
- [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null)
1236
- };
1237
- }
1238
- add(method, path, handler) {
1239
- const { middleware, routes } = this;
1240
- if (!middleware || !routes) throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
1241
- if (!middleware[method]) [
1242
- middleware,
1243
- routes
1244
- ].forEach((handlerMap)=>{
1245
- handlerMap[method] = /* @__PURE__ */ Object.create(null);
1246
- Object.keys(handlerMap[METHOD_NAME_ALL]).forEach((p)=>{
1247
- handlerMap[method][p] = [
1248
- ...handlerMap[METHOD_NAME_ALL][p]
1249
- ];
1250
- });
1251
- });
1252
- if ("/*" === path) path = "*";
1253
- const paramCount = (path.match(/\/:/g) || []).length;
1254
- if (/\*$/.test(path)) {
1255
- const re = buildWildcardRegExp(path);
1256
- if (method === METHOD_NAME_ALL) Object.keys(middleware).forEach((m)=>{
1257
- middleware[m][path] ||= findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
1258
- });
1259
- else middleware[method][path] ||= findMiddleware(middleware[method], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
1260
- Object.keys(middleware).forEach((m)=>{
1261
- if (method === METHOD_NAME_ALL || method === m) Object.keys(middleware[m]).forEach((p)=>{
1262
- re.test(p) && middleware[m][p].push([
1263
- handler,
1264
- paramCount
1265
- ]);
1266
- });
1267
- });
1268
- Object.keys(routes).forEach((m)=>{
1269
- if (method === METHOD_NAME_ALL || method === m) Object.keys(routes[m]).forEach((p)=>re.test(p) && routes[m][p].push([
1270
- handler,
1271
- paramCount
1272
- ]));
1273
- });
1274
- return;
1275
- }
1276
- const paths = checkOptionalParameter(path) || [
1277
- path
1278
- ];
1279
- for(let i = 0, len = paths.length; i < len; i++){
1280
- const path2 = paths[i];
1281
- Object.keys(routes).forEach((m)=>{
1282
- if (method === METHOD_NAME_ALL || method === m) {
1283
- routes[m][path2] ||= [
1284
- ...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []
1285
- ];
1286
- routes[m][path2].push([
1287
- handler,
1288
- paramCount - len + i + 1
1289
- ]);
1290
- }
1291
- });
1292
- }
1293
- }
1294
- match(method, path) {
1295
- clearWildcardRegExpCache();
1296
- const matchers = this.buildAllMatchers();
1297
- this.match = (method2, path2)=>{
1298
- const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
1299
- const staticMatch = matcher[2][path2];
1300
- if (staticMatch) return staticMatch;
1301
- const match = path2.match(matcher[0]);
1302
- if (!match) return [
1303
- [],
1304
- emptyParam
1305
- ];
1306
- const index = match.indexOf("", 1);
1307
- return [
1308
- matcher[1][index],
1309
- match
1310
- ];
1311
- };
1312
- return this.match(method, path);
1313
- }
1314
- buildAllMatchers() {
1315
- const matchers = /* @__PURE__ */ Object.create(null);
1316
- [
1317
- ...Object.keys(this.routes),
1318
- ...Object.keys(this.middleware)
1319
- ].forEach((method)=>{
1320
- matchers[method] ||= this.buildMatcher(method);
1321
- });
1322
- this.middleware = this.routes = void 0;
1323
- return matchers;
1324
- }
1325
- buildMatcher(method) {
1326
- const routes = [];
1327
- let hasOwnRoute = method === METHOD_NAME_ALL;
1328
- [
1329
- this.middleware,
1330
- this.routes
1331
- ].forEach((r)=>{
1332
- const ownRoute = r[method] ? Object.keys(r[method]).map((path)=>[
1333
- path,
1334
- r[method][path]
1335
- ]) : [];
1336
- if (0 !== ownRoute.length) {
1337
- hasOwnRoute ||= true;
1338
- routes.push(...ownRoute);
1339
- } else if (method !== METHOD_NAME_ALL) routes.push(...Object.keys(r[METHOD_NAME_ALL]).map((path)=>[
1340
- path,
1341
- r[METHOD_NAME_ALL][path]
1342
- ]));
1343
- });
1344
- if (!hasOwnRoute) return null;
1345
- return buildMatcherFromPreprocessedRoutes(routes);
1346
- }
1232
+ name = "RegExpRouter";
1233
+ middleware;
1234
+ routes;
1235
+ constructor() {
1236
+ this.middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
1237
+ this.routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
1238
+ }
1239
+ add(method, path$1, handler) {
1240
+ const { middleware, routes } = this;
1241
+ if (!middleware || !routes) throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
1242
+ if (!middleware[method]) [middleware, routes].forEach((handlerMap) => {
1243
+ handlerMap[method] = /* @__PURE__ */ Object.create(null);
1244
+ Object.keys(handlerMap[METHOD_NAME_ALL]).forEach((p) => {
1245
+ handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]];
1246
+ });
1247
+ });
1248
+ if (path$1 === "/*") path$1 = "*";
1249
+ const paramCount = (path$1.match(/\/:/g) || []).length;
1250
+ if (/\*$/.test(path$1)) {
1251
+ const re = buildWildcardRegExp(path$1);
1252
+ if (method === METHOD_NAME_ALL) Object.keys(middleware).forEach((m) => {
1253
+ middleware[m][path$1] ||= findMiddleware(middleware[m], path$1) || findMiddleware(middleware[METHOD_NAME_ALL], path$1) || [];
1254
+ });
1255
+ else middleware[method][path$1] ||= findMiddleware(middleware[method], path$1) || findMiddleware(middleware[METHOD_NAME_ALL], path$1) || [];
1256
+ Object.keys(middleware).forEach((m) => {
1257
+ if (method === METHOD_NAME_ALL || method === m) Object.keys(middleware[m]).forEach((p) => {
1258
+ re.test(p) && middleware[m][p].push([handler, paramCount]);
1259
+ });
1260
+ });
1261
+ Object.keys(routes).forEach((m) => {
1262
+ if (method === METHOD_NAME_ALL || method === m) Object.keys(routes[m]).forEach((p) => re.test(p) && routes[m][p].push([handler, paramCount]));
1263
+ });
1264
+ return;
1265
+ }
1266
+ const paths = checkOptionalParameter(path$1) || [path$1];
1267
+ for (let i = 0, len = paths.length; i < len; i++) {
1268
+ const path2 = paths[i];
1269
+ Object.keys(routes).forEach((m) => {
1270
+ if (method === METHOD_NAME_ALL || method === m) {
1271
+ routes[m][path2] ||= [...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []];
1272
+ routes[m][path2].push([handler, paramCount - len + i + 1]);
1273
+ }
1274
+ });
1275
+ }
1276
+ }
1277
+ match(method, path$1) {
1278
+ clearWildcardRegExpCache();
1279
+ const matchers = this.buildAllMatchers();
1280
+ this.match = (method2, path2) => {
1281
+ const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
1282
+ const staticMatch = matcher[2][path2];
1283
+ if (staticMatch) return staticMatch;
1284
+ const match = path2.match(matcher[0]);
1285
+ if (!match) return [[], emptyParam];
1286
+ const index = match.indexOf("", 1);
1287
+ return [matcher[1][index], match];
1288
+ };
1289
+ return this.match(method, path$1);
1290
+ }
1291
+ buildAllMatchers() {
1292
+ const matchers = /* @__PURE__ */ Object.create(null);
1293
+ [...Object.keys(this.routes), ...Object.keys(this.middleware)].forEach((method) => {
1294
+ matchers[method] ||= this.buildMatcher(method);
1295
+ });
1296
+ this.middleware = this.routes = void 0;
1297
+ return matchers;
1298
+ }
1299
+ buildMatcher(method) {
1300
+ const routes = [];
1301
+ let hasOwnRoute = method === METHOD_NAME_ALL;
1302
+ [this.middleware, this.routes].forEach((r) => {
1303
+ const ownRoute = r[method] ? Object.keys(r[method]).map((path$1) => [path$1, r[method][path$1]]) : [];
1304
+ if (ownRoute.length !== 0) {
1305
+ hasOwnRoute ||= true;
1306
+ routes.push(...ownRoute);
1307
+ } else if (method !== METHOD_NAME_ALL) routes.push(...Object.keys(r[METHOD_NAME_ALL]).map((path$1) => [path$1, r[METHOD_NAME_ALL][path$1]]));
1308
+ });
1309
+ if (!hasOwnRoute) return null;
1310
+ else return buildMatcherFromPreprocessedRoutes(routes);
1311
+ }
1347
1312
  };
1313
+
1314
+ //#endregion
1315
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/smart-router/router.js
1348
1316
  var SmartRouter = class {
1349
- name = "SmartRouter";
1350
- routers = [];
1351
- routes = [];
1352
- constructor(init){
1353
- Object.assign(this, init);
1354
- }
1355
- add(method, path, handler) {
1356
- if (!this.routes) throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
1357
- this.routes.push([
1358
- method,
1359
- path,
1360
- handler
1361
- ]);
1362
- }
1363
- match(method, path) {
1364
- if (!this.routes) throw new Error("Fatal error");
1365
- const { routers, routes } = this;
1366
- const len = routers.length;
1367
- let i = 0;
1368
- let res;
1369
- for(; i < len; i++){
1370
- const router = routers[i];
1371
- try {
1372
- routes.forEach((args)=>{
1373
- router.add(...args);
1374
- });
1375
- res = router.match(method, path);
1376
- } catch (e) {
1377
- if (e instanceof UnsupportedPathError) continue;
1378
- throw e;
1379
- }
1380
- this.match = router.match.bind(router);
1381
- this.routers = [
1382
- router
1383
- ];
1384
- this.routes = void 0;
1385
- break;
1386
- }
1387
- if (i === len) throw new Error("Fatal error");
1388
- this.name = `SmartRouter + ${this.activeRouter.name}`;
1389
- return res;
1390
- }
1391
- get activeRouter() {
1392
- if (this.routes || 1 !== this.routers.length) throw new Error("No active router has been determined yet.");
1393
- return this.routers[0];
1394
- }
1317
+ name = "SmartRouter";
1318
+ routers = [];
1319
+ routes = [];
1320
+ constructor(init) {
1321
+ Object.assign(this, init);
1322
+ }
1323
+ add(method, path$1, handler) {
1324
+ if (!this.routes) throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
1325
+ this.routes.push([
1326
+ method,
1327
+ path$1,
1328
+ handler
1329
+ ]);
1330
+ }
1331
+ match(method, path$1) {
1332
+ if (!this.routes) throw new Error("Fatal error");
1333
+ const { routers, routes } = this;
1334
+ const len = routers.length;
1335
+ let i = 0;
1336
+ let res;
1337
+ for (; i < len; i++) {
1338
+ const router = routers[i];
1339
+ try {
1340
+ routes.forEach((args) => {
1341
+ router.add(...args);
1342
+ });
1343
+ res = router.match(method, path$1);
1344
+ } catch (e) {
1345
+ if (e instanceof UnsupportedPathError) continue;
1346
+ throw e;
1347
+ }
1348
+ this.match = router.match.bind(router);
1349
+ this.routers = [router];
1350
+ this.routes = void 0;
1351
+ break;
1352
+ }
1353
+ if (i === len) throw new Error("Fatal error");
1354
+ this.name = `SmartRouter + ${this.activeRouter.name}`;
1355
+ return res;
1356
+ }
1357
+ get activeRouter() {
1358
+ if (this.routes || this.routers.length !== 1) throw new Error("No active router has been determined yet.");
1359
+ return this.routers[0];
1360
+ }
1395
1361
  };
1396
- var node_Node = class {
1397
- methods;
1398
- children;
1399
- patterns;
1400
- order = 0;
1401
- name;
1402
- params = /* @__PURE__ */ Object.create(null);
1403
- constructor(method, handler, children){
1404
- this.children = children || /* @__PURE__ */ Object.create(null);
1405
- this.methods = [];
1406
- this.name = "";
1407
- if (method && handler) {
1408
- const m = /* @__PURE__ */ Object.create(null);
1409
- m[method] = {
1410
- handler,
1411
- possibleKeys: [],
1412
- score: 0,
1413
- name: this.name
1414
- };
1415
- this.methods = [
1416
- m
1417
- ];
1418
- }
1419
- this.patterns = [];
1420
- }
1421
- insert(method, path, handler) {
1422
- this.name = `${method} ${path}`;
1423
- this.order = ++this.order;
1424
- let curNode = this;
1425
- const parts = splitRoutingPath(path);
1426
- const possibleKeys = [];
1427
- for(let i = 0, len = parts.length; i < len; i++){
1428
- const p = parts[i];
1429
- if (Object.keys(curNode.children).includes(p)) {
1430
- curNode = curNode.children[p];
1431
- const pattern2 = getPattern(p);
1432
- if (pattern2) possibleKeys.push(pattern2[1]);
1433
- continue;
1434
- }
1435
- curNode.children[p] = new node_Node();
1436
- const pattern = getPattern(p);
1437
- if (pattern) {
1438
- curNode.patterns.push(pattern);
1439
- possibleKeys.push(pattern[1]);
1440
- }
1441
- curNode = curNode.children[p];
1442
- }
1443
- if (!curNode.methods.length) curNode.methods = [];
1444
- const m = /* @__PURE__ */ Object.create(null);
1445
- const handlerSet = {
1446
- handler,
1447
- possibleKeys: possibleKeys.filter((v, i, a)=>a.indexOf(v) === i),
1448
- name: this.name,
1449
- score: this.order
1450
- };
1451
- m[method] = handlerSet;
1452
- curNode.methods.push(m);
1453
- return curNode;
1454
- }
1455
- gHSets(node, method, nodeParams, params) {
1456
- const handlerSets = [];
1457
- for(let i = 0, len = node.methods.length; i < len; i++){
1458
- const m = node.methods[i];
1459
- const handlerSet = m[method] || m[METHOD_NAME_ALL];
1460
- const processedSet = /* @__PURE__ */ Object.create(null);
1461
- if (void 0 !== handlerSet) {
1462
- handlerSet.params = /* @__PURE__ */ Object.create(null);
1463
- handlerSet.possibleKeys.forEach((key)=>{
1464
- const processed = processedSet[handlerSet.name];
1465
- handlerSet.params[key] = params[key] && !processed ? params[key] : nodeParams[key] ?? params[key];
1466
- processedSet[handlerSet.name] = true;
1467
- });
1468
- handlerSets.push(handlerSet);
1469
- }
1470
- }
1471
- return handlerSets;
1472
- }
1473
- search(method, path) {
1474
- const handlerSets = [];
1475
- this.params = /* @__PURE__ */ Object.create(null);
1476
- const curNode = this;
1477
- let curNodes = [
1478
- curNode
1479
- ];
1480
- const parts = splitPath(path);
1481
- for(let i = 0, len = parts.length; i < len; i++){
1482
- const part = parts[i];
1483
- const isLast = i === len - 1;
1484
- const tempNodes = [];
1485
- for(let j = 0, len2 = curNodes.length; j < len2; j++){
1486
- const node = curNodes[j];
1487
- const nextNode = node.children[part];
1488
- if (nextNode) {
1489
- nextNode.params = node.params;
1490
- if (true === isLast) {
1491
- if (nextNode.children["*"]) handlerSets.push(...this.gHSets(nextNode.children["*"], method, node.params, /* @__PURE__ */ Object.create(null)));
1492
- handlerSets.push(...this.gHSets(nextNode, method, node.params, /* @__PURE__ */ Object.create(null)));
1493
- } else tempNodes.push(nextNode);
1494
- }
1495
- for(let k = 0, len3 = node.patterns.length; k < len3; k++){
1496
- const pattern = node.patterns[k];
1497
- const params = {
1498
- ...node.params
1499
- };
1500
- if ("*" === pattern) {
1501
- const astNode = node.children["*"];
1502
- if (astNode) {
1503
- handlerSets.push(...this.gHSets(astNode, method, node.params, /* @__PURE__ */ Object.create(null)));
1504
- tempNodes.push(astNode);
1505
- }
1506
- continue;
1507
- }
1508
- if ("" === part) continue;
1509
- const [key, name, matcher] = pattern;
1510
- const child = node.children[key];
1511
- const restPathString = parts.slice(i).join("/");
1512
- if (matcher instanceof RegExp && matcher.test(restPathString)) {
1513
- params[name] = restPathString;
1514
- handlerSets.push(...this.gHSets(child, method, node.params, params));
1515
- continue;
1516
- }
1517
- if (true === matcher || matcher instanceof RegExp && matcher.test(part)) {
1518
- if ("string" == typeof key) {
1519
- params[name] = part;
1520
- if (true === isLast) {
1521
- handlerSets.push(...this.gHSets(child, method, params, node.params));
1522
- if (child.children["*"]) handlerSets.push(...this.gHSets(child.children["*"], method, params, node.params));
1523
- } else {
1524
- child.params = params;
1525
- tempNodes.push(child);
1526
- }
1527
- }
1528
- }
1529
- }
1530
- }
1531
- curNodes = tempNodes;
1532
- }
1533
- const results = handlerSets.sort((a, b)=>a.score - b.score);
1534
- return [
1535
- results.map(({ handler, params })=>[
1536
- handler,
1537
- params
1538
- ])
1539
- ];
1540
- }
1362
+
1363
+ //#endregion
1364
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/trie-router/node.js
1365
+ var Node = class {
1366
+ methods;
1367
+ children;
1368
+ patterns;
1369
+ order = 0;
1370
+ name;
1371
+ params = /* @__PURE__ */ Object.create(null);
1372
+ constructor(method, handler, children) {
1373
+ this.children = children || /* @__PURE__ */ Object.create(null);
1374
+ this.methods = [];
1375
+ this.name = "";
1376
+ if (method && handler) {
1377
+ const m = /* @__PURE__ */ Object.create(null);
1378
+ m[method] = {
1379
+ handler,
1380
+ possibleKeys: [],
1381
+ score: 0,
1382
+ name: this.name
1383
+ };
1384
+ this.methods = [m];
1385
+ }
1386
+ this.patterns = [];
1387
+ }
1388
+ insert(method, path$1, handler) {
1389
+ this.name = `${method} ${path$1}`;
1390
+ this.order = ++this.order;
1391
+ let curNode = this;
1392
+ const parts = splitRoutingPath(path$1);
1393
+ const possibleKeys = [];
1394
+ for (let i = 0, len = parts.length; i < len; i++) {
1395
+ const p = parts[i];
1396
+ if (Object.keys(curNode.children).includes(p)) {
1397
+ curNode = curNode.children[p];
1398
+ const pattern2 = getPattern(p);
1399
+ if (pattern2) possibleKeys.push(pattern2[1]);
1400
+ continue;
1401
+ }
1402
+ curNode.children[p] = new Node();
1403
+ const pattern = getPattern(p);
1404
+ if (pattern) {
1405
+ curNode.patterns.push(pattern);
1406
+ possibleKeys.push(pattern[1]);
1407
+ }
1408
+ curNode = curNode.children[p];
1409
+ }
1410
+ if (!curNode.methods.length) curNode.methods = [];
1411
+ const m = /* @__PURE__ */ Object.create(null);
1412
+ const handlerSet = {
1413
+ handler,
1414
+ possibleKeys: possibleKeys.filter((v, i, a) => a.indexOf(v) === i),
1415
+ name: this.name,
1416
+ score: this.order
1417
+ };
1418
+ m[method] = handlerSet;
1419
+ curNode.methods.push(m);
1420
+ return curNode;
1421
+ }
1422
+ gHSets(node, method, nodeParams, params) {
1423
+ const handlerSets = [];
1424
+ for (let i = 0, len = node.methods.length; i < len; i++) {
1425
+ const m = node.methods[i];
1426
+ const handlerSet = m[method] || m[METHOD_NAME_ALL];
1427
+ const processedSet = /* @__PURE__ */ Object.create(null);
1428
+ if (handlerSet !== void 0) {
1429
+ handlerSet.params = /* @__PURE__ */ Object.create(null);
1430
+ handlerSet.possibleKeys.forEach((key) => {
1431
+ const processed = processedSet[handlerSet.name];
1432
+ handlerSet.params[key] = params[key] && !processed ? params[key] : nodeParams[key] ?? params[key];
1433
+ processedSet[handlerSet.name] = true;
1434
+ });
1435
+ handlerSets.push(handlerSet);
1436
+ }
1437
+ }
1438
+ return handlerSets;
1439
+ }
1440
+ search(method, path$1) {
1441
+ const handlerSets = [];
1442
+ this.params = /* @__PURE__ */ Object.create(null);
1443
+ const curNode = this;
1444
+ let curNodes = [curNode];
1445
+ const parts = splitPath(path$1);
1446
+ for (let i = 0, len = parts.length; i < len; i++) {
1447
+ const part = parts[i];
1448
+ const isLast = i === len - 1;
1449
+ const tempNodes = [];
1450
+ for (let j = 0, len2 = curNodes.length; j < len2; j++) {
1451
+ const node = curNodes[j];
1452
+ const nextNode = node.children[part];
1453
+ if (nextNode) {
1454
+ nextNode.params = node.params;
1455
+ if (isLast === true) {
1456
+ if (nextNode.children["*"]) handlerSets.push(...this.gHSets(nextNode.children["*"], method, node.params, /* @__PURE__ */ Object.create(null)));
1457
+ handlerSets.push(...this.gHSets(nextNode, method, node.params, /* @__PURE__ */ Object.create(null)));
1458
+ } else tempNodes.push(nextNode);
1459
+ }
1460
+ for (let k = 0, len3 = node.patterns.length; k < len3; k++) {
1461
+ const pattern = node.patterns[k];
1462
+ const params = { ...node.params };
1463
+ if (pattern === "*") {
1464
+ const astNode = node.children["*"];
1465
+ if (astNode) {
1466
+ handlerSets.push(...this.gHSets(astNode, method, node.params, /* @__PURE__ */ Object.create(null)));
1467
+ tempNodes.push(astNode);
1468
+ }
1469
+ continue;
1470
+ }
1471
+ if (part === "") continue;
1472
+ const [key, name, matcher] = pattern;
1473
+ const child = node.children[key];
1474
+ const restPathString = parts.slice(i).join("/");
1475
+ if (matcher instanceof RegExp && matcher.test(restPathString)) {
1476
+ params[name] = restPathString;
1477
+ handlerSets.push(...this.gHSets(child, method, node.params, params));
1478
+ continue;
1479
+ }
1480
+ if (matcher === true || matcher instanceof RegExp && matcher.test(part)) {
1481
+ if (typeof key === "string") {
1482
+ params[name] = part;
1483
+ if (isLast === true) {
1484
+ handlerSets.push(...this.gHSets(child, method, params, node.params));
1485
+ if (child.children["*"]) handlerSets.push(...this.gHSets(child.children["*"], method, params, node.params));
1486
+ } else {
1487
+ child.params = params;
1488
+ tempNodes.push(child);
1489
+ }
1490
+ }
1491
+ }
1492
+ }
1493
+ }
1494
+ curNodes = tempNodes;
1495
+ }
1496
+ const results = handlerSets.sort((a, b) => {
1497
+ return a.score - b.score;
1498
+ });
1499
+ return [results.map(({ handler, params }) => [handler, params])];
1500
+ }
1541
1501
  };
1502
+
1503
+ //#endregion
1504
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/trie-router/router.js
1542
1505
  var TrieRouter = class {
1543
- name = "TrieRouter";
1544
- node;
1545
- constructor(){
1546
- this.node = new node_Node();
1547
- }
1548
- add(method, path, handler) {
1549
- const results = checkOptionalParameter(path);
1550
- if (results) {
1551
- for (const p of results)this.node.insert(method, p, handler);
1552
- return;
1553
- }
1554
- this.node.insert(method, path, handler);
1555
- }
1556
- match(method, path) {
1557
- return this.node.search(method, path);
1558
- }
1506
+ name = "TrieRouter";
1507
+ node;
1508
+ constructor() {
1509
+ this.node = new Node();
1510
+ }
1511
+ add(method, path$1, handler) {
1512
+ const results = checkOptionalParameter(path$1);
1513
+ if (results) {
1514
+ for (const p of results) this.node.insert(method, p, handler);
1515
+ return;
1516
+ }
1517
+ this.node.insert(method, path$1, handler);
1518
+ }
1519
+ match(method, path$1) {
1520
+ return this.node.search(method, path$1);
1521
+ }
1559
1522
  };
1560
- var hono_Hono = class extends Hono {
1561
- constructor(options = {}){
1562
- super(options);
1563
- this.router = options.router ?? new SmartRouter({
1564
- routers: [
1565
- new RegExpRouter(),
1566
- new TrieRouter()
1567
- ]
1568
- });
1569
- }
1523
+
1524
+ //#endregion
1525
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/hono.js
1526
+ var Hono = class extends Hono$1 {
1527
+ constructor(options = {}) {
1528
+ super(options);
1529
+ this.router = options.router ?? new SmartRouter({ routers: [new RegExpRouter(), new TrieRouter()] });
1530
+ }
1570
1531
  };
1571
- var _validateReport = __webpack_require__("../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.3/node_modules/typia/lib/internal/_validateReport.js");
1532
+
1533
+ //#endregion
1534
+ //#region ../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.3/node_modules/typia/lib/internal/_validateReport.js
1535
+ var require__validateReport = __commonJS({ "../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.3/node_modules/typia/lib/internal/_validateReport.js"(exports) {
1536
+ Object.defineProperty(exports, "__esModule", { value: true });
1537
+ exports._validateReport = void 0;
1538
+ const _validateReport = (array) => {
1539
+ const reportable = (path$1) => {
1540
+ if (array.length === 0) return true;
1541
+ const last = array[array.length - 1].path;
1542
+ return path$1.length > last.length || last.substring(0, path$1.length) !== path$1;
1543
+ };
1544
+ return (exceptable, error) => {
1545
+ if (exceptable && reportable(error.path)) array.push(error);
1546
+ return false;
1547
+ };
1548
+ };
1549
+ exports._validateReport = _validateReport;
1550
+ } });
1551
+
1552
+ //#endregion
1553
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/cookie.js
1572
1554
  var validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
1573
1555
  var validCookieValueRegEx = /^[ !#-:<-[\]-~]*$/;
1574
- var parse = (cookie, name)=>{
1575
- const pairs = cookie.trim().split(";");
1576
- return pairs.reduce((parsedCookie, pairStr)=>{
1577
- pairStr = pairStr.trim();
1578
- const valueStartPos = pairStr.indexOf("=");
1579
- if (-1 === valueStartPos) return parsedCookie;
1580
- const cookieName = pairStr.substring(0, valueStartPos).trim();
1581
- if (name && name !== cookieName || !validCookieNameRegEx.test(cookieName)) return parsedCookie;
1582
- let cookieValue = pairStr.substring(valueStartPos + 1).trim();
1583
- if (cookieValue.startsWith('"') && cookieValue.endsWith('"')) cookieValue = cookieValue.slice(1, -1);
1584
- if (validCookieValueRegEx.test(cookieValue)) parsedCookie[cookieName] = decodeURIComponent_(cookieValue);
1585
- return parsedCookie;
1586
- }, {});
1556
+ var parse = (cookie, name) => {
1557
+ const pairs = cookie.trim().split(";");
1558
+ return pairs.reduce((parsedCookie, pairStr) => {
1559
+ pairStr = pairStr.trim();
1560
+ const valueStartPos = pairStr.indexOf("=");
1561
+ if (valueStartPos === -1) return parsedCookie;
1562
+ const cookieName = pairStr.substring(0, valueStartPos).trim();
1563
+ if (name && name !== cookieName || !validCookieNameRegEx.test(cookieName)) return parsedCookie;
1564
+ let cookieValue = pairStr.substring(valueStartPos + 1).trim();
1565
+ if (cookieValue.startsWith("\"") && cookieValue.endsWith("\"")) cookieValue = cookieValue.slice(1, -1);
1566
+ if (validCookieValueRegEx.test(cookieValue)) parsedCookie[cookieName] = decodeURIComponent_(cookieValue);
1567
+ return parsedCookie;
1568
+ }, {});
1587
1569
  };
1588
- var getCookie = (c, key, prefix)=>{
1589
- const cookie = c.req.raw.headers.get("Cookie");
1590
- if ("string" == typeof key) {
1591
- if (!cookie) return;
1592
- let finalKey = key;
1593
- if ("secure" === prefix) finalKey = "__Secure-" + key;
1594
- else if ("host" === prefix) finalKey = "__Host-" + key;
1595
- const obj2 = parse(cookie, finalKey);
1596
- return obj2[finalKey];
1597
- }
1598
- if (!cookie) return {};
1599
- const obj = parse(cookie);
1600
- return obj;
1570
+
1571
+ //#endregion
1572
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/helper/cookie/index.js
1573
+ var getCookie = (c, key, prefix) => {
1574
+ const cookie = c.req.raw.headers.get("Cookie");
1575
+ if (typeof key === "string") {
1576
+ if (!cookie) return void 0;
1577
+ let finalKey = key;
1578
+ if (prefix === "secure") finalKey = "__Secure-" + key;
1579
+ else if (prefix === "host") finalKey = "__Host-" + key;
1580
+ const obj2 = parse(cookie, finalKey);
1581
+ return obj2[finalKey];
1582
+ }
1583
+ if (!cookie) return {};
1584
+ const obj = parse(cookie);
1585
+ return obj;
1601
1586
  };
1587
+
1588
+ //#endregion
1589
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/http-exception.js
1602
1590
  var HTTPException = class extends Error {
1603
- res;
1604
- status;
1605
- constructor(status = 500, options){
1606
- super(options?.message, {
1607
- cause: options?.cause
1608
- });
1609
- this.res = options?.res;
1610
- this.status = status;
1611
- }
1612
- getResponse() {
1613
- if (this.res) {
1614
- const newResponse = new Response(this.res.body, {
1615
- status: this.status,
1616
- headers: this.res.headers
1617
- });
1618
- return newResponse;
1619
- }
1620
- return new Response(this.message, {
1621
- status: this.status
1622
- });
1623
- }
1591
+ res;
1592
+ status;
1593
+ constructor(status = 500, options) {
1594
+ super(options?.message, { cause: options?.cause });
1595
+ this.res = options?.res;
1596
+ this.status = status;
1597
+ }
1598
+ getResponse() {
1599
+ if (this.res) {
1600
+ const newResponse = new Response(this.res.body, {
1601
+ status: this.status,
1602
+ headers: this.res.headers
1603
+ });
1604
+ return newResponse;
1605
+ }
1606
+ return new Response(this.message, { status: this.status });
1607
+ }
1624
1608
  };
1625
- var bufferToFormData = (arrayBuffer, contentType)=>{
1626
- const response = new Response(arrayBuffer, {
1627
- headers: {
1628
- "Content-Type": contentType
1629
- }
1630
- });
1631
- return response.formData();
1609
+
1610
+ //#endregion
1611
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/buffer.js
1612
+ var bufferToFormData = (arrayBuffer, contentType) => {
1613
+ const response = new Response(arrayBuffer, { headers: { "Content-Type": contentType } });
1614
+ return response.formData();
1632
1615
  };
1616
+
1617
+ //#endregion
1618
+ //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/validator/validator.js
1633
1619
  var jsonRegex = /^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
1634
1620
  var multipartRegex = /^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/;
1635
1621
  var urlencodedRegex = /^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
1636
- var validator = (target, validationFunc)=>async (c, next)=>{
1637
- let value = {};
1638
- const contentType = c.req.header("Content-Type");
1639
- switch(target){
1640
- case "json":
1641
- if (!contentType || !jsonRegex.test(contentType)) break;
1642
- try {
1643
- value = await c.req.json();
1644
- } catch {
1645
- const message = "Malformed JSON in request body";
1646
- throw new HTTPException(400, {
1647
- message
1648
- });
1649
- }
1650
- break;
1651
- case "form":
1652
- {
1653
- if (!contentType || !(multipartRegex.test(contentType) || urlencodedRegex.test(contentType))) break;
1654
- let formData;
1655
- if (c.req.bodyCache.formData) formData = await c.req.bodyCache.formData;
1656
- else try {
1657
- const arrayBuffer = await c.req.arrayBuffer();
1658
- formData = await bufferToFormData(arrayBuffer, contentType);
1659
- c.req.bodyCache.formData = formData;
1660
- } catch (e) {
1661
- let message = "Malformed FormData request.";
1662
- message += e instanceof Error ? ` ${e.message}` : ` ${String(e)}`;
1663
- throw new HTTPException(400, {
1664
- message
1665
- });
1666
- }
1667
- const form = {};
1668
- formData.forEach((value2, key)=>{
1669
- if (key.endsWith("[]")) (form[key] ??= []).push(value2);
1670
- else if (Array.isArray(form[key])) form[key].push(value2);
1671
- else if (key in form) form[key] = [
1672
- form[key],
1673
- value2
1674
- ];
1675
- else form[key] = value2;
1676
- });
1677
- value = form;
1678
- break;
1679
- }
1680
- case "query":
1681
- value = Object.fromEntries(Object.entries(c.req.queries()).map(([k, v])=>1 === v.length ? [
1682
- k,
1683
- v[0]
1684
- ] : [
1685
- k,
1686
- v
1687
- ]));
1688
- break;
1689
- case "param":
1690
- value = c.req.param();
1691
- break;
1692
- case "header":
1693
- value = c.req.header();
1694
- break;
1695
- case "cookie":
1696
- value = getCookie(c);
1697
- break;
1698
- }
1699
- const res = await validationFunc(value, c);
1700
- if (res instanceof Response) return res;
1701
- c.req.addValidatedData(target, res);
1702
- await next();
1703
- };
1704
- const typiaValidator = (target, validate, hook)=>validator(target, async (value, c)=>{
1705
- const result = validate(value);
1706
- if (hook) {
1707
- const hookResult = await hook({
1708
- ...result,
1709
- data: value
1710
- }, c);
1711
- if (hookResult) {
1712
- if (hookResult instanceof Response || hookResult instanceof Promise) return hookResult;
1713
- if ('response' in hookResult) return hookResult.response;
1714
- }
1715
- }
1716
- if (!result.success) return c.json({
1717
- success: false,
1718
- error: result.errors
1719
- }, 400);
1720
- return result.data;
1721
- });
1722
- const queryBundlesSchema = (()=>{
1723
- const _io0 = (input)=>(void 0 === input.channel || "string" == typeof input.channel) && (void 0 === input.platform || "ios" === input.platform || "android" === input.platform) && (void 0 === input.limit || "string" == typeof input.limit) && (void 0 === input.offset || "string" == typeof input.offset);
1724
- const _vo0 = (input, _path, _exceptionable = true)=>[
1725
- void 0 === input.channel || "string" == typeof input.channel || _report(_exceptionable, {
1726
- path: _path + ".channel",
1727
- expected: "(string | undefined)",
1728
- value: input.channel
1729
- }),
1730
- void 0 === input.platform || "ios" === input.platform || "android" === input.platform || _report(_exceptionable, {
1731
- path: _path + ".platform",
1732
- expected: "(\"android\" | \"ios\" | undefined)",
1733
- value: input.platform
1734
- }),
1735
- void 0 === input.limit || "string" == typeof input.limit || _report(_exceptionable, {
1736
- path: _path + ".limit",
1737
- expected: "(string | undefined)",
1738
- value: input.limit
1739
- }),
1740
- void 0 === input.offset || "string" == typeof input.offset || _report(_exceptionable, {
1741
- path: _path + ".offset",
1742
- expected: "(string | undefined)",
1743
- value: input.offset
1744
- })
1745
- ].every((flag)=>flag);
1746
- const __is = (input)=>"object" == typeof input && null !== input && false === Array.isArray(input) && _io0(input);
1747
- let errors;
1748
- let _report;
1749
- return (input)=>{
1750
- if (false === __is(input)) {
1751
- errors = [];
1752
- _report = _validateReport._validateReport(errors);
1753
- ((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input && false === Array.isArray(input) || _report(true, {
1754
- path: _path + "",
1755
- expected: "__type",
1756
- value: input
1757
- })) && _vo0(input, _path + "", true) || _report(true, {
1758
- path: _path + "",
1759
- expected: "__type",
1760
- value: input
1761
- }))(input, "$input", true);
1762
- const success = 0 === errors.length;
1763
- return success ? {
1764
- success,
1765
- data: input
1766
- } : {
1767
- success,
1768
- errors,
1769
- data: input
1770
- };
1771
- }
1772
- return {
1773
- success: true,
1774
- data: input
1775
- };
1776
- };
1622
+ var validator = (target, validationFunc) => {
1623
+ return async (c, next) => {
1624
+ let value = {};
1625
+ const contentType = c.req.header("Content-Type");
1626
+ switch (target) {
1627
+ case "json":
1628
+ if (!contentType || !jsonRegex.test(contentType)) break;
1629
+ try {
1630
+ value = await c.req.json();
1631
+ } catch {
1632
+ const message = "Malformed JSON in request body";
1633
+ throw new HTTPException(400, { message });
1634
+ }
1635
+ break;
1636
+ case "form": {
1637
+ if (!contentType || !(multipartRegex.test(contentType) || urlencodedRegex.test(contentType))) break;
1638
+ let formData;
1639
+ if (c.req.bodyCache.formData) formData = await c.req.bodyCache.formData;
1640
+ else try {
1641
+ const arrayBuffer = await c.req.arrayBuffer();
1642
+ formData = await bufferToFormData(arrayBuffer, contentType);
1643
+ c.req.bodyCache.formData = formData;
1644
+ } catch (e) {
1645
+ let message = "Malformed FormData request.";
1646
+ message += e instanceof Error ? ` ${e.message}` : ` ${String(e)}`;
1647
+ throw new HTTPException(400, { message });
1648
+ }
1649
+ const form = {};
1650
+ formData.forEach((value2, key) => {
1651
+ if (key.endsWith("[]")) (form[key] ??= []).push(value2);
1652
+ else if (Array.isArray(form[key])) form[key].push(value2);
1653
+ else if (key in form) form[key] = [form[key], value2];
1654
+ else form[key] = value2;
1655
+ });
1656
+ value = form;
1657
+ break;
1658
+ }
1659
+ case "query":
1660
+ value = Object.fromEntries(Object.entries(c.req.queries()).map(([k, v]) => {
1661
+ return v.length === 1 ? [k, v[0]] : [k, v];
1662
+ }));
1663
+ break;
1664
+ case "param":
1665
+ value = c.req.param();
1666
+ break;
1667
+ case "header":
1668
+ value = c.req.header();
1669
+ break;
1670
+ case "cookie":
1671
+ value = getCookie(c);
1672
+ break;
1673
+ }
1674
+ const res = await validationFunc(value, c);
1675
+ if (res instanceof Response) return res;
1676
+ c.req.addValidatedData(target, res);
1677
+ await next();
1678
+ };
1679
+ };
1680
+
1681
+ //#endregion
1682
+ //#region ../../node_modules/.pnpm/@hono+typia-validator@0.1.2_hono@4.6.3_typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.3_/node_modules/@hono/typia-validator/dist/esm/index.js
1683
+ const typiaValidator = (target, validate, hook) => validator(target, async (value, c) => {
1684
+ const result = validate(value);
1685
+ if (hook) {
1686
+ const hookResult = await hook({
1687
+ ...result,
1688
+ data: value
1689
+ }, c);
1690
+ if (hookResult) {
1691
+ if (hookResult instanceof Response || hookResult instanceof Promise) return hookResult;
1692
+ if ("response" in hookResult) return hookResult.response;
1693
+ }
1694
+ }
1695
+ if (!result.success) return c.json({
1696
+ success: false,
1697
+ error: result.errors
1698
+ }, 400);
1699
+ return result.data;
1700
+ });
1701
+
1702
+ //#endregion
1703
+ //#region src-server/rpc.ts
1704
+ var import__validateReport = __toESM(require__validateReport(), 1);
1705
+ const queryBundlesSchema = (() => {
1706
+ const _io0 = (input) => (void 0 === input.channel || "string" === typeof input.channel) && (void 0 === input.platform || "ios" === input.platform || "android" === input.platform) && (void 0 === input.limit || "string" === typeof input.limit) && (void 0 === input.offset || "string" === typeof input.offset);
1707
+ const _vo0 = (input, _path, _exceptionable = true) => [
1708
+ void 0 === input.channel || "string" === typeof input.channel || _report(_exceptionable, {
1709
+ path: _path + ".channel",
1710
+ expected: "(string | undefined)",
1711
+ value: input.channel
1712
+ }),
1713
+ void 0 === input.platform || "ios" === input.platform || "android" === input.platform || _report(_exceptionable, {
1714
+ path: _path + ".platform",
1715
+ expected: "(\"android\" | \"ios\" | undefined)",
1716
+ value: input.platform
1717
+ }),
1718
+ void 0 === input.limit || "string" === typeof input.limit || _report(_exceptionable, {
1719
+ path: _path + ".limit",
1720
+ expected: "(string | undefined)",
1721
+ value: input.limit
1722
+ }),
1723
+ void 0 === input.offset || "string" === typeof input.offset || _report(_exceptionable, {
1724
+ path: _path + ".offset",
1725
+ expected: "(string | undefined)",
1726
+ value: input.offset
1727
+ })
1728
+ ].every((flag) => flag);
1729
+ const __is = (input) => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
1730
+ let errors;
1731
+ let _report;
1732
+ return (input) => {
1733
+ if (false === __is(input)) {
1734
+ errors = [];
1735
+ _report = import__validateReport._validateReport(errors);
1736
+ ((input$1, _path, _exceptionable = true) => ("object" === typeof input$1 && null !== input$1 && false === Array.isArray(input$1) || _report(true, {
1737
+ path: _path + "",
1738
+ expected: "__type",
1739
+ value: input$1
1740
+ })) && _vo0(input$1, _path + "", true) || _report(true, {
1741
+ path: _path + "",
1742
+ expected: "__type",
1743
+ value: input$1
1744
+ }))(input, "$input", true);
1745
+ const success = 0 === errors.length;
1746
+ return success ? {
1747
+ success,
1748
+ data: input
1749
+ } : {
1750
+ success,
1751
+ errors,
1752
+ data: input
1753
+ };
1754
+ }
1755
+ return {
1756
+ success: true,
1757
+ data: input
1758
+ };
1759
+ };
1777
1760
  })();
1778
- const paramBundleIdSchema = (()=>{
1779
- const _io0 = (input)=>"string" == typeof input.bundleId;
1780
- const _vo0 = (input, _path, _exceptionable = true)=>[
1781
- "string" == typeof input.bundleId || _report(_exceptionable, {
1782
- path: _path + ".bundleId",
1783
- expected: "string",
1784
- value: input.bundleId
1785
- })
1786
- ].every((flag)=>flag);
1787
- const __is = (input)=>"object" == typeof input && null !== input && _io0(input);
1788
- let errors;
1789
- let _report;
1790
- return (input)=>{
1791
- if (false === __is(input)) {
1792
- errors = [];
1793
- _report = _validateReport._validateReport(errors);
1794
- ((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input || _report(true, {
1795
- path: _path + "",
1796
- expected: "__type",
1797
- value: input
1798
- })) && _vo0(input, _path + "", true) || _report(true, {
1799
- path: _path + "",
1800
- expected: "__type",
1801
- value: input
1802
- }))(input, "$input", true);
1803
- const success = 0 === errors.length;
1804
- return success ? {
1805
- success,
1806
- data: input
1807
- } : {
1808
- success,
1809
- errors,
1810
- data: input
1811
- };
1812
- }
1813
- return {
1814
- success: true,
1815
- data: input
1816
- };
1817
- };
1761
+ const paramBundleIdSchema = (() => {
1762
+ const _io0 = (input) => "string" === typeof input.bundleId;
1763
+ const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.bundleId || _report(_exceptionable, {
1764
+ path: _path + ".bundleId",
1765
+ expected: "string",
1766
+ value: input.bundleId
1767
+ })].every((flag) => flag);
1768
+ const __is = (input) => "object" === typeof input && null !== input && _io0(input);
1769
+ let errors;
1770
+ let _report;
1771
+ return (input) => {
1772
+ if (false === __is(input)) {
1773
+ errors = [];
1774
+ _report = import__validateReport._validateReport(errors);
1775
+ ((input$1, _path, _exceptionable = true) => ("object" === typeof input$1 && null !== input$1 || _report(true, {
1776
+ path: _path + "",
1777
+ expected: "__type",
1778
+ value: input$1
1779
+ })) && _vo0(input$1, _path + "", true) || _report(true, {
1780
+ path: _path + "",
1781
+ expected: "__type",
1782
+ value: input$1
1783
+ }))(input, "$input", true);
1784
+ const success = 0 === errors.length;
1785
+ return success ? {
1786
+ success,
1787
+ data: input
1788
+ } : {
1789
+ success,
1790
+ errors,
1791
+ data: input
1792
+ };
1793
+ }
1794
+ return {
1795
+ success: true,
1796
+ data: input
1797
+ };
1798
+ };
1818
1799
  })();
1819
- const updateBundleSchema = (()=>{
1820
- const _io0 = (input)=>(void 0 === input.id || "string" == typeof input.id) && (void 0 === input.platform || "ios" === input.platform || "android" === input.platform) && (void 0 === input.targetAppVersion || "string" == typeof input.targetAppVersion) && (void 0 === input.shouldForceUpdate || "boolean" == typeof input.shouldForceUpdate) && (void 0 === input.enabled || "boolean" == typeof input.enabled) && (void 0 === input.fileHash || "string" == typeof input.fileHash) && (null === input.gitCommitHash || void 0 === input.gitCommitHash || "string" == typeof input.gitCommitHash) && (null === input.message || void 0 === input.message || "string" == typeof input.message) && (void 0 === input.channel || "string" == typeof input.channel);
1821
- const _vo0 = (input, _path, _exceptionable = true)=>[
1822
- void 0 === input.id || "string" == typeof input.id || _report(_exceptionable, {
1823
- path: _path + ".id",
1824
- expected: "(string | undefined)",
1825
- value: input.id
1826
- }),
1827
- void 0 === input.platform || "ios" === input.platform || "android" === input.platform || _report(_exceptionable, {
1828
- path: _path + ".platform",
1829
- expected: "(\"android\" | \"ios\" | undefined)",
1830
- value: input.platform
1831
- }),
1832
- void 0 === input.targetAppVersion || "string" == typeof input.targetAppVersion || _report(_exceptionable, {
1833
- path: _path + ".targetAppVersion",
1834
- expected: "(string | undefined)",
1835
- value: input.targetAppVersion
1836
- }),
1837
- void 0 === input.shouldForceUpdate || "boolean" == typeof input.shouldForceUpdate || _report(_exceptionable, {
1838
- path: _path + ".shouldForceUpdate",
1839
- expected: "(boolean | undefined)",
1840
- value: input.shouldForceUpdate
1841
- }),
1842
- void 0 === input.enabled || "boolean" == typeof input.enabled || _report(_exceptionable, {
1843
- path: _path + ".enabled",
1844
- expected: "(boolean | undefined)",
1845
- value: input.enabled
1846
- }),
1847
- void 0 === input.fileHash || "string" == typeof input.fileHash || _report(_exceptionable, {
1848
- path: _path + ".fileHash",
1849
- expected: "(string | undefined)",
1850
- value: input.fileHash
1851
- }),
1852
- null === input.gitCommitHash || void 0 === input.gitCommitHash || "string" == typeof input.gitCommitHash || _report(_exceptionable, {
1853
- path: _path + ".gitCommitHash",
1854
- expected: "(null | string | undefined)",
1855
- value: input.gitCommitHash
1856
- }),
1857
- null === input.message || void 0 === input.message || "string" == typeof input.message || _report(_exceptionable, {
1858
- path: _path + ".message",
1859
- expected: "(null | string | undefined)",
1860
- value: input.message
1861
- }),
1862
- void 0 === input.channel || "string" == typeof input.channel || _report(_exceptionable, {
1863
- path: _path + ".channel",
1864
- expected: "(string | undefined)",
1865
- value: input.channel
1866
- })
1867
- ].every((flag)=>flag);
1868
- const __is = (input)=>"object" == typeof input && null !== input && false === Array.isArray(input) && _io0(input);
1869
- let errors;
1870
- let _report;
1871
- return (input)=>{
1872
- if (false === __is(input)) {
1873
- errors = [];
1874
- _report = _validateReport._validateReport(errors);
1875
- ((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input && false === Array.isArray(input) || _report(true, {
1876
- path: _path + "",
1877
- expected: "Partial<Bundle>",
1878
- value: input
1879
- })) && _vo0(input, _path + "", true) || _report(true, {
1880
- path: _path + "",
1881
- expected: "Partial<Bundle>",
1882
- value: input
1883
- }))(input, "$input", true);
1884
- const success = 0 === errors.length;
1885
- return success ? {
1886
- success,
1887
- data: input
1888
- } : {
1889
- success,
1890
- errors,
1891
- data: input
1892
- };
1893
- }
1894
- return {
1895
- success: true,
1896
- data: input
1897
- };
1898
- };
1800
+ const updateBundleSchema = (() => {
1801
+ const _io0 = (input) => (void 0 === input.id || "string" === typeof input.id) && (void 0 === input.platform || "ios" === input.platform || "android" === input.platform) && (void 0 === input.shouldForceUpdate || "boolean" === typeof input.shouldForceUpdate) && (void 0 === input.enabled || "boolean" === typeof input.enabled) && (void 0 === input.fileHash || "string" === typeof input.fileHash) && (void 0 === input.storageUri || "string" === typeof input.storageUri) && (null === input.gitCommitHash || void 0 === input.gitCommitHash || "string" === typeof input.gitCommitHash) && (null === input.message || void 0 === input.message || "string" === typeof input.message) && (void 0 === input.channel || "string" === typeof input.channel) && (null === input.targetAppVersion || void 0 === input.targetAppVersion || "string" === typeof input.targetAppVersion) && (null === input.fingerprintHash || void 0 === input.fingerprintHash || "string" === typeof input.fingerprintHash) && (void 0 === input.metadata || "object" === typeof input.metadata && null !== input.metadata && false === Array.isArray(input.metadata) && _io1(input.metadata));
1802
+ const _io1 = (input) => void 0 === input.app_version || "string" === typeof input.app_version;
1803
+ const _vo0 = (input, _path, _exceptionable = true) => [
1804
+ void 0 === input.id || "string" === typeof input.id || _report(_exceptionable, {
1805
+ path: _path + ".id",
1806
+ expected: "(string | undefined)",
1807
+ value: input.id
1808
+ }),
1809
+ void 0 === input.platform || "ios" === input.platform || "android" === input.platform || _report(_exceptionable, {
1810
+ path: _path + ".platform",
1811
+ expected: "(\"android\" | \"ios\" | undefined)",
1812
+ value: input.platform
1813
+ }),
1814
+ void 0 === input.shouldForceUpdate || "boolean" === typeof input.shouldForceUpdate || _report(_exceptionable, {
1815
+ path: _path + ".shouldForceUpdate",
1816
+ expected: "(boolean | undefined)",
1817
+ value: input.shouldForceUpdate
1818
+ }),
1819
+ void 0 === input.enabled || "boolean" === typeof input.enabled || _report(_exceptionable, {
1820
+ path: _path + ".enabled",
1821
+ expected: "(boolean | undefined)",
1822
+ value: input.enabled
1823
+ }),
1824
+ void 0 === input.fileHash || "string" === typeof input.fileHash || _report(_exceptionable, {
1825
+ path: _path + ".fileHash",
1826
+ expected: "(string | undefined)",
1827
+ value: input.fileHash
1828
+ }),
1829
+ void 0 === input.storageUri || "string" === typeof input.storageUri || _report(_exceptionable, {
1830
+ path: _path + ".storageUri",
1831
+ expected: "(string | undefined)",
1832
+ value: input.storageUri
1833
+ }),
1834
+ null === input.gitCommitHash || void 0 === input.gitCommitHash || "string" === typeof input.gitCommitHash || _report(_exceptionable, {
1835
+ path: _path + ".gitCommitHash",
1836
+ expected: "(null | string | undefined)",
1837
+ value: input.gitCommitHash
1838
+ }),
1839
+ null === input.message || void 0 === input.message || "string" === typeof input.message || _report(_exceptionable, {
1840
+ path: _path + ".message",
1841
+ expected: "(null | string | undefined)",
1842
+ value: input.message
1843
+ }),
1844
+ void 0 === input.channel || "string" === typeof input.channel || _report(_exceptionable, {
1845
+ path: _path + ".channel",
1846
+ expected: "(string | undefined)",
1847
+ value: input.channel
1848
+ }),
1849
+ null === input.targetAppVersion || void 0 === input.targetAppVersion || "string" === typeof input.targetAppVersion || _report(_exceptionable, {
1850
+ path: _path + ".targetAppVersion",
1851
+ expected: "(null | string | undefined)",
1852
+ value: input.targetAppVersion
1853
+ }),
1854
+ null === input.fingerprintHash || void 0 === input.fingerprintHash || "string" === typeof input.fingerprintHash || _report(_exceptionable, {
1855
+ path: _path + ".fingerprintHash",
1856
+ expected: "(null | string | undefined)",
1857
+ value: input.fingerprintHash
1858
+ }),
1859
+ void 0 === input.metadata || ("object" === typeof input.metadata && null !== input.metadata && false === Array.isArray(input.metadata) || _report(_exceptionable, {
1860
+ path: _path + ".metadata",
1861
+ expected: "(BundleMetadata | undefined)",
1862
+ value: input.metadata
1863
+ })) && _vo1(input.metadata, _path + ".metadata", _exceptionable) || _report(_exceptionable, {
1864
+ path: _path + ".metadata",
1865
+ expected: "(BundleMetadata | undefined)",
1866
+ value: input.metadata
1867
+ })
1868
+ ].every((flag) => flag);
1869
+ const _vo1 = (input, _path, _exceptionable = true) => [void 0 === input.app_version || "string" === typeof input.app_version || _report(_exceptionable, {
1870
+ path: _path + ".app_version",
1871
+ expected: "(string | undefined)",
1872
+ value: input.app_version
1873
+ })].every((flag) => flag);
1874
+ const __is = (input) => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
1875
+ let errors;
1876
+ let _report;
1877
+ return (input) => {
1878
+ if (false === __is(input)) {
1879
+ errors = [];
1880
+ _report = import__validateReport._validateReport(errors);
1881
+ ((input$1, _path, _exceptionable = true) => ("object" === typeof input$1 && null !== input$1 && false === Array.isArray(input$1) || _report(true, {
1882
+ path: _path + "",
1883
+ expected: "Partial<Bundle>",
1884
+ value: input$1
1885
+ })) && _vo0(input$1, _path + "", true) || _report(true, {
1886
+ path: _path + "",
1887
+ expected: "Partial<Bundle>",
1888
+ value: input$1
1889
+ }))(input, "$input", true);
1890
+ const success = 0 === errors.length;
1891
+ return success ? {
1892
+ success,
1893
+ data: input
1894
+ } : {
1895
+ success,
1896
+ errors,
1897
+ data: input
1898
+ };
1899
+ }
1900
+ return {
1901
+ success: true,
1902
+ data: input
1903
+ };
1904
+ };
1899
1905
  })();
1900
1906
  let configPromise = null;
1901
- const prepareConfig = async ()=>{
1902
- if (!configPromise) configPromise = (async ()=>{
1903
- try {
1904
- const config = await (0, __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__.loadConfig)(null);
1905
- const databasePlugin = await config?.database({
1906
- cwd: (0, __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__.getCwd)()
1907
- }) ?? null;
1908
- if (!databasePlugin) throw new Error("Database plugin initialization failed");
1909
- return {
1910
- config,
1911
- databasePlugin
1912
- };
1913
- } catch (error) {
1914
- console.error("Error during configuration initialization:", error);
1915
- throw error;
1916
- }
1917
- })();
1918
- return configPromise;
1907
+ const prepareConfig = async () => {
1908
+ if (!configPromise) configPromise = (async () => {
1909
+ try {
1910
+ const config = await loadConfig(null);
1911
+ const databasePlugin = await config?.database({ cwd: getCwd() }) ?? null;
1912
+ if (!databasePlugin) throw new Error("Database plugin initialization failed");
1913
+ return {
1914
+ config,
1915
+ databasePlugin
1916
+ };
1917
+ } catch (error) {
1918
+ console.error("Error during configuration initialization:", error);
1919
+ throw error;
1920
+ }
1921
+ })();
1922
+ return configPromise;
1919
1923
  };
1920
- const rpc = new hono_Hono().get("/config", async (c)=>{
1921
- try {
1922
- const { config } = await prepareConfig();
1923
- return c.json({
1924
- console: config.console
1925
- });
1926
- } catch (error) {
1927
- console.error("Error during config retrieval:", error);
1928
- throw error;
1929
- }
1930
- }).get("/channels", async (c)=>{
1931
- try {
1932
- const { databasePlugin } = await prepareConfig();
1933
- const channels = await databasePlugin.getChannels();
1934
- return c.json(channels ?? []);
1935
- } catch (error) {
1936
- console.error("Error during channel retrieval:", error);
1937
- throw error;
1938
- }
1939
- }).get("/config-loaded", (c)=>{
1940
- try {
1941
- const isLoaded = !!configPromise;
1942
- return c.json({
1943
- configLoaded: isLoaded
1944
- });
1945
- } catch (error) {
1946
- console.error("Error during config loaded retrieval:", error);
1947
- throw error;
1948
- }
1949
- }).get("/bundles", typiaValidator("query", queryBundlesSchema), async (c)=>{
1950
- try {
1951
- const query = c.req.valid("query");
1952
- const { databasePlugin } = await prepareConfig();
1953
- const bundles = await databasePlugin.getBundles({
1954
- where: {
1955
- channel: query.channel ?? void 0,
1956
- platform: query.platform ?? void 0
1957
- },
1958
- limit: query.limit ? Number(query.limit) : void 0,
1959
- offset: query.offset ? Number(query.offset) : void 0
1960
- });
1961
- return c.json(bundles ?? []);
1962
- } catch (error) {
1963
- console.error("Error during bundle retrieval:", error);
1964
- throw error;
1965
- }
1966
- }).get("/bundles/:bundleId", typiaValidator("param", paramBundleIdSchema), async (c)=>{
1967
- try {
1968
- const { bundleId } = c.req.valid("param");
1969
- const { databasePlugin } = await prepareConfig();
1970
- const bundle = await databasePlugin.getBundleById(bundleId);
1971
- return c.json(bundle ?? null);
1972
- } catch (error) {
1973
- console.error("Error during bundle retrieval:", error);
1974
- throw error;
1975
- }
1976
- }).patch("/bundles/:bundleId", typiaValidator("json", updateBundleSchema), async (c)=>{
1977
- try {
1978
- const bundleId = c.req.param("bundleId");
1979
- const partialBundle = c.req.valid("json");
1980
- if (!bundleId) return c.json({
1981
- error: "Target bundle ID is required"
1982
- }, 400);
1983
- const { databasePlugin } = await prepareConfig();
1984
- await databasePlugin.updateBundle(bundleId, partialBundle);
1985
- await databasePlugin.commitBundle();
1986
- return c.json({
1987
- success: true
1988
- });
1989
- } catch (error) {
1990
- console.error("Error during bundle update:", error);
1991
- if (error && "object" == typeof error && "message" in error) return c.json({
1992
- error: error.message
1993
- }, 500);
1994
- return c.json({
1995
- error: "Unknown error"
1996
- }, 500);
1997
- }
1924
+ const rpc = new Hono().get("/config", async (c) => {
1925
+ try {
1926
+ const { config } = await prepareConfig();
1927
+ return c.json({ console: config.console });
1928
+ } catch (error) {
1929
+ console.error("Error during config retrieval:", error);
1930
+ throw error;
1931
+ }
1932
+ }).get("/channels", async (c) => {
1933
+ try {
1934
+ const { databasePlugin } = await prepareConfig();
1935
+ const channels = await databasePlugin.getChannels();
1936
+ return c.json(channels ?? []);
1937
+ } catch (error) {
1938
+ console.error("Error during channel retrieval:", error);
1939
+ throw error;
1940
+ }
1941
+ }).get("/config-loaded", (c) => {
1942
+ try {
1943
+ const isLoaded = !!configPromise;
1944
+ return c.json({ configLoaded: isLoaded });
1945
+ } catch (error) {
1946
+ console.error("Error during config loaded retrieval:", error);
1947
+ throw error;
1948
+ }
1949
+ }).get("/bundles", typiaValidator("query", queryBundlesSchema), async (c) => {
1950
+ try {
1951
+ const query = c.req.valid("query");
1952
+ const { databasePlugin } = await prepareConfig();
1953
+ const bundles = await databasePlugin.getBundles({
1954
+ where: {
1955
+ channel: query.channel ?? void 0,
1956
+ platform: query.platform ?? void 0
1957
+ },
1958
+ limit: query.limit ? Number(query.limit) : void 0,
1959
+ offset: query.offset ? Number(query.offset) : void 0
1960
+ });
1961
+ return c.json(bundles ?? []);
1962
+ } catch (error) {
1963
+ console.error("Error during bundle retrieval:", error);
1964
+ throw error;
1965
+ }
1966
+ }).get("/bundles/:bundleId", typiaValidator("param", paramBundleIdSchema), async (c) => {
1967
+ try {
1968
+ const { bundleId } = c.req.valid("param");
1969
+ const { databasePlugin } = await prepareConfig();
1970
+ const bundle = await databasePlugin.getBundleById(bundleId);
1971
+ return c.json(bundle ?? null);
1972
+ } catch (error) {
1973
+ console.error("Error during bundle retrieval:", error);
1974
+ throw error;
1975
+ }
1976
+ }).patch("/bundles/:bundleId", typiaValidator("json", updateBundleSchema), async (c) => {
1977
+ try {
1978
+ const bundleId = c.req.param("bundleId");
1979
+ const partialBundle = c.req.valid("json");
1980
+ if (!bundleId) return c.json({ error: "Target bundle ID is required" }, 400);
1981
+ const { databasePlugin } = await prepareConfig();
1982
+ await databasePlugin.updateBundle(bundleId, partialBundle);
1983
+ await databasePlugin.commitBundle();
1984
+ return c.json({ success: true });
1985
+ } catch (error) {
1986
+ console.error("Error during bundle update:", error);
1987
+ if (error && typeof error === "object" && "message" in error) return c.json({ error: error.message }, 500);
1988
+ return c.json({ error: "Unknown error" }, 500);
1989
+ }
1998
1990
  });
1999
- const src_server_dirname = __WEBPACK_EXTERNAL_MODULE_path__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_url__.fileURLToPath)(import.meta.url));
2000
- const relativePathToScript = __WEBPACK_EXTERNAL_MODULE_path__["default"].relative(process.cwd(), src_server_dirname);
2001
- const src_server_app = new hono_Hono().get("/ping", (c)=>c.text("pong")).route("/rpc", rpc).use("/assets/*", serveStatic({
2002
- root: relativePathToScript
2003
- })).get("*", serveStatic({
2004
- root: relativePathToScript,
2005
- path: "index.html"
1991
+
1992
+ //#endregion
1993
+ //#region src-server/index.ts
1994
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
1995
+ const relativePathToScript = path.relative(process.cwd(), __dirname);
1996
+ const app = new Hono().get("/ping", (c) => c.text("pong")).route("/rpc", rpc).use("/assets/*", serveStatic({ root: relativePathToScript })).get("*", serveStatic({
1997
+ root: relativePathToScript,
1998
+ path: "index.html"
2006
1999
  }));
2007
- const src_server = src_server_app;
2008
- export { src_server as default };
2000
+ var src_server_default = app;
2001
+
2002
+ //#endregion
2003
+ export { src_server_default as default };