wcz-test 6.14.0 → 6.20.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 (51) hide show
  1. package/dist/ApprovalStatus-C9HPyMiS.js.map +1 -1
  2. package/dist/DialogsHooks-Bi8dZoyu.js +338 -0
  3. package/dist/DialogsHooks-Bi8dZoyu.js.map +1 -0
  4. package/dist/FileHooks-hWKTwLCr.js +195 -0
  5. package/dist/FileHooks-hWKTwLCr.js.map +1 -0
  6. package/dist/FileMeta-G1oT3mYK.js.map +1 -1
  7. package/dist/{RouterListItemButton-Cx7rXEfm.js → RouterListItemButton-CHS7rofI.js} +4 -4
  8. package/dist/RouterListItemButton-CHS7rofI.js.map +1 -0
  9. package/dist/auth-client-B6cIXYDV.js +1417 -0
  10. package/dist/auth-client-B6cIXYDV.js.map +1 -0
  11. package/dist/client.d.ts +61 -49
  12. package/dist/client.js +7 -3
  13. package/dist/client.js.map +1 -1
  14. package/dist/components.js +68 -3405
  15. package/dist/components.js.map +1 -1
  16. package/dist/env-CoxTjaDr.js.map +1 -1
  17. package/dist/error-BhAKg8LX-X0sdNXNa.js +195 -0
  18. package/dist/error-BhAKg8LX-X0sdNXNa.js.map +1 -0
  19. package/dist/hooks.d.ts +6 -2
  20. package/dist/hooks.js +35 -1040
  21. package/dist/hooks.js.map +1 -1
  22. package/dist/index.js +90 -504
  23. package/dist/index.js.map +1 -1
  24. package/dist/manifest.webmanifest +18 -18
  25. package/dist/models.d.ts +10 -10
  26. package/dist/models.js +4 -4
  27. package/dist/models.js.map +1 -1
  28. package/dist/queries.d.ts +6 -6
  29. package/dist/queries.js +2 -2
  30. package/dist/queries.js.map +1 -1
  31. package/dist/server-mxQ3s5dx-CC81W42s.js +644 -0
  32. package/dist/server-mxQ3s5dx-CC81W42s.js.map +1 -0
  33. package/dist/server.d.ts +2 -0
  34. package/dist/server.js +8659 -5
  35. package/dist/server.js.map +1 -1
  36. package/dist/{utils-JYv9O0GI.js → utils-DKyKGba7.js} +2 -1
  37. package/dist/utils-DKyKGba7.js.map +1 -0
  38. package/dist/utils.d.ts +11 -0
  39. package/dist/utils.js +9 -0
  40. package/dist/utils.js.map +1 -0
  41. package/dist/vite.js +3 -0
  42. package/dist/vite.js.map +1 -1
  43. package/package.json +120 -116
  44. package/dist/DialogsHooks-BlUsVlfv.js +0 -39
  45. package/dist/DialogsHooks-BlUsVlfv.js.map +0 -1
  46. package/dist/FileHooks-41k6-RtZ.js +0 -3262
  47. package/dist/FileHooks-41k6-RtZ.js.map +0 -1
  48. package/dist/RouterListItemButton-Cx7rXEfm.js.map +0 -1
  49. package/dist/auth-client-o9U0_qmf.js +0 -79
  50. package/dist/auth-client-o9U0_qmf.js.map +0 -1
  51. package/dist/utils-JYv9O0GI.js.map +0 -1
@@ -0,0 +1,644 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ import nodeCrypto from "node:crypto";
3
+ function parse(str, options) {
4
+ if (typeof str !== "string") throw new TypeError("argument str must be a string");
5
+ const obj = {};
6
+ const opt = {};
7
+ const dec = opt.decode || decode$1;
8
+ let index = 0;
9
+ while (index < str.length) {
10
+ const eqIdx = str.indexOf("=", index);
11
+ if (eqIdx === -1) break;
12
+ let endIdx = str.indexOf(";", index);
13
+ if (endIdx === -1) endIdx = str.length;
14
+ else if (endIdx < eqIdx) {
15
+ index = str.lastIndexOf(";", eqIdx - 1) + 1;
16
+ continue;
17
+ }
18
+ const key = str.slice(index, eqIdx).trim();
19
+ if (opt?.filter && !opt?.filter(key)) {
20
+ index = endIdx + 1;
21
+ continue;
22
+ }
23
+ if (void 0 === obj[key]) {
24
+ let val = str.slice(eqIdx + 1, endIdx).trim();
25
+ if (val.codePointAt(0) === 34) val = val.slice(1, -1);
26
+ obj[key] = tryDecode(val, dec);
27
+ }
28
+ index = endIdx + 1;
29
+ }
30
+ return obj;
31
+ }
32
+ function decode$1(str) {
33
+ return str.includes("%") ? decodeURIComponent(str) : str;
34
+ }
35
+ function tryDecode(str, decode2) {
36
+ try {
37
+ return decode2(str);
38
+ } catch {
39
+ return str;
40
+ }
41
+ }
42
+ const fieldContentRegExp = /^[\u0009\u0020-\u007E\u0080-\u00FF]+$/;
43
+ function serialize(name, value, options) {
44
+ const opt = options || {};
45
+ const enc = opt.encode || encodeURIComponent;
46
+ if (typeof enc !== "function") throw new TypeError("option encode is invalid");
47
+ if (!fieldContentRegExp.test(name)) throw new TypeError("argument name is invalid");
48
+ const encodedValue = enc(value);
49
+ if (encodedValue && !fieldContentRegExp.test(encodedValue)) throw new TypeError("argument val is invalid");
50
+ let str = name + "=" + encodedValue;
51
+ if (void 0 !== opt.maxAge && opt.maxAge !== null) {
52
+ const maxAge = opt.maxAge - 0;
53
+ if (Number.isNaN(maxAge) || !Number.isFinite(maxAge)) throw new TypeError("option maxAge is invalid");
54
+ str += "; Max-Age=" + Math.floor(maxAge);
55
+ }
56
+ if (opt.domain) {
57
+ if (!fieldContentRegExp.test(opt.domain)) throw new TypeError("option domain is invalid");
58
+ str += "; Domain=" + opt.domain;
59
+ }
60
+ if (opt.path) {
61
+ if (!fieldContentRegExp.test(opt.path)) throw new TypeError("option path is invalid");
62
+ str += "; Path=" + opt.path;
63
+ }
64
+ if (opt.expires) {
65
+ if (!isDate(opt.expires) || Number.isNaN(opt.expires.valueOf())) throw new TypeError("option expires is invalid");
66
+ str += "; Expires=" + opt.expires.toUTCString();
67
+ }
68
+ if (opt.httpOnly) str += "; HttpOnly";
69
+ if (opt.secure) str += "; Secure";
70
+ if (opt.priority) switch (typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority) {
71
+ case "low":
72
+ str += "; Priority=Low";
73
+ break;
74
+ case "medium":
75
+ str += "; Priority=Medium";
76
+ break;
77
+ case "high":
78
+ str += "; Priority=High";
79
+ break;
80
+ default:
81
+ throw new TypeError("option priority is invalid");
82
+ }
83
+ if (opt.sameSite) switch (typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite) {
84
+ case true:
85
+ str += "; SameSite=Strict";
86
+ break;
87
+ case "lax":
88
+ str += "; SameSite=Lax";
89
+ break;
90
+ case "strict":
91
+ str += "; SameSite=Strict";
92
+ break;
93
+ case "none":
94
+ str += "; SameSite=None";
95
+ break;
96
+ default:
97
+ throw new TypeError("option sameSite is invalid");
98
+ }
99
+ if (opt.partitioned) str += "; Partitioned";
100
+ return str;
101
+ }
102
+ function isDate(val) {
103
+ return Object.prototype.toString.call(val) === "[object Date]" || val instanceof Date;
104
+ }
105
+ const defaults$1 = Object.freeze({
106
+ ignoreUnknown: false,
107
+ respectType: false,
108
+ respectFunctionNames: false,
109
+ respectFunctionProperties: false,
110
+ unorderedObjects: true,
111
+ unorderedArrays: false,
112
+ unorderedSets: false,
113
+ excludeKeys: void 0,
114
+ excludeValues: void 0,
115
+ replacer: void 0
116
+ });
117
+ function objectHash(object, options) {
118
+ if (options) options = {
119
+ ...defaults$1,
120
+ ...options
121
+ };
122
+ else options = defaults$1;
123
+ const hasher = createHasher(options);
124
+ hasher.dispatch(object);
125
+ return hasher.toString();
126
+ }
127
+ const defaultPrototypesKeys = Object.freeze([
128
+ "prototype",
129
+ "__proto__",
130
+ "constructor"
131
+ ]);
132
+ function createHasher(options) {
133
+ let buff = "";
134
+ let context = /* @__PURE__ */ new Map();
135
+ const write = (str) => {
136
+ buff += str;
137
+ };
138
+ return {
139
+ toString() {
140
+ return buff;
141
+ },
142
+ getContext() {
143
+ return context;
144
+ },
145
+ dispatch(value) {
146
+ if (options.replacer) value = options.replacer(value);
147
+ return this[value === null ? "null" : typeof value](value);
148
+ },
149
+ object(object) {
150
+ if (object && typeof object.toJSON === "function") return this.object(object.toJSON());
151
+ const objString = Object.prototype.toString.call(object);
152
+ let objType = "";
153
+ const objectLength = objString.length;
154
+ if (objectLength < 10) objType = "unknown:[" + objString + "]";
155
+ else objType = objString.slice(8, objectLength - 1);
156
+ objType = objType.toLowerCase();
157
+ let objectNumber = null;
158
+ if ((objectNumber = context.get(object)) === void 0) context.set(object, context.size);
159
+ else return this.dispatch("[CIRCULAR:" + objectNumber + "]");
160
+ if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object)) {
161
+ write("buffer:");
162
+ return write(object.toString("utf8"));
163
+ }
164
+ if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
165
+ if (this[objType]) this[objType](object);
166
+ else if (!options.ignoreUnknown) this.unkown(object, objType);
167
+ } else {
168
+ let keys = Object.keys(object);
169
+ if (options.unorderedObjects) keys = keys.sort();
170
+ let extraKeys = [];
171
+ if (options.respectType !== false && !isNativeFunction(object)) extraKeys = defaultPrototypesKeys;
172
+ if (options.excludeKeys) {
173
+ keys = keys.filter((key) => {
174
+ return !options.excludeKeys(key);
175
+ });
176
+ extraKeys = extraKeys.filter((key) => {
177
+ return !options.excludeKeys(key);
178
+ });
179
+ }
180
+ write("object:" + (keys.length + extraKeys.length) + ":");
181
+ const dispatchForKey = (key) => {
182
+ this.dispatch(key);
183
+ write(":");
184
+ if (!options.excludeValues) this.dispatch(object[key]);
185
+ write(",");
186
+ };
187
+ for (const key of keys) dispatchForKey(key);
188
+ for (const key of extraKeys) dispatchForKey(key);
189
+ }
190
+ },
191
+ array(arr, unordered) {
192
+ unordered = unordered === void 0 ? options.unorderedArrays !== false : unordered;
193
+ write("array:" + arr.length + ":");
194
+ if (!unordered || arr.length <= 1) {
195
+ for (const entry of arr) this.dispatch(entry);
196
+ return;
197
+ }
198
+ const contextAdditions = /* @__PURE__ */ new Map();
199
+ const entries = arr.map((entry) => {
200
+ const hasher = createHasher(options);
201
+ hasher.dispatch(entry);
202
+ for (const [key, value] of hasher.getContext()) contextAdditions.set(key, value);
203
+ return hasher.toString();
204
+ });
205
+ context = contextAdditions;
206
+ entries.sort();
207
+ return this.array(entries, false);
208
+ },
209
+ date(date) {
210
+ return write("date:" + date.toJSON());
211
+ },
212
+ symbol(sym) {
213
+ return write("symbol:" + sym.toString());
214
+ },
215
+ unkown(value, type) {
216
+ write(type);
217
+ if (!value) return;
218
+ write(":");
219
+ if (value && typeof value.entries === "function") return this.array(Array.from(value.entries()), true);
220
+ },
221
+ error(err) {
222
+ return write("error:" + err.toString());
223
+ },
224
+ boolean(bool) {
225
+ return write("bool:" + bool);
226
+ },
227
+ string(string) {
228
+ write("string:" + string.length + ":");
229
+ write(string);
230
+ },
231
+ function(fn) {
232
+ write("fn:");
233
+ if (isNativeFunction(fn)) this.dispatch("[native]");
234
+ else this.dispatch(fn.toString());
235
+ if (options.respectFunctionNames !== false) this.dispatch("function-name:" + String(fn.name));
236
+ if (options.respectFunctionProperties) this.object(fn);
237
+ },
238
+ number(number) {
239
+ return write("number:" + number);
240
+ },
241
+ xml(xml) {
242
+ return write("xml:" + xml.toString());
243
+ },
244
+ null() {
245
+ return write("Null");
246
+ },
247
+ undefined() {
248
+ return write("Undefined");
249
+ },
250
+ regexp(regex) {
251
+ return write("regex:" + regex.toString());
252
+ },
253
+ uint8array(arr) {
254
+ write("uint8array:");
255
+ return this.dispatch(Array.prototype.slice.call(arr));
256
+ },
257
+ uint8clampedarray(arr) {
258
+ write("uint8clampedarray:");
259
+ return this.dispatch(Array.prototype.slice.call(arr));
260
+ },
261
+ int8array(arr) {
262
+ write("int8array:");
263
+ return this.dispatch(Array.prototype.slice.call(arr));
264
+ },
265
+ uint16array(arr) {
266
+ write("uint16array:");
267
+ return this.dispatch(Array.prototype.slice.call(arr));
268
+ },
269
+ int16array(arr) {
270
+ write("int16array:");
271
+ return this.dispatch(Array.prototype.slice.call(arr));
272
+ },
273
+ uint32array(arr) {
274
+ write("uint32array:");
275
+ return this.dispatch(Array.prototype.slice.call(arr));
276
+ },
277
+ int32array(arr) {
278
+ write("int32array:");
279
+ return this.dispatch(Array.prototype.slice.call(arr));
280
+ },
281
+ float32array(arr) {
282
+ write("float32array:");
283
+ return this.dispatch(Array.prototype.slice.call(arr));
284
+ },
285
+ float64array(arr) {
286
+ write("float64array:");
287
+ return this.dispatch(Array.prototype.slice.call(arr));
288
+ },
289
+ arraybuffer(arr) {
290
+ write("arraybuffer:");
291
+ return this.dispatch(new Uint8Array(arr));
292
+ },
293
+ url(url) {
294
+ return write("url:" + url.toString());
295
+ },
296
+ map(map) {
297
+ write("map:");
298
+ const arr = [...map];
299
+ return this.array(arr, options.unorderedSets !== false);
300
+ },
301
+ set(set) {
302
+ write("set:");
303
+ const arr = [...set];
304
+ return this.array(arr, options.unorderedSets !== false);
305
+ },
306
+ file(file) {
307
+ write("file:");
308
+ return this.dispatch([
309
+ file.name,
310
+ file.size,
311
+ file.type,
312
+ file.lastModfied
313
+ ]);
314
+ },
315
+ blob() {
316
+ if (options.ignoreUnknown) return write("[blob]");
317
+ throw new Error('Hashing Blob objects is currently not supported\nUse "options.replacer" or "options.ignoreUnknown"\n');
318
+ },
319
+ domwindow() {
320
+ return write("domwindow");
321
+ },
322
+ bigint(number) {
323
+ return write("bigint:" + number.toString());
324
+ },
325
+ process() {
326
+ return write("process");
327
+ },
328
+ timer() {
329
+ return write("timer");
330
+ },
331
+ pipe() {
332
+ return write("pipe");
333
+ },
334
+ tcp() {
335
+ return write("tcp");
336
+ },
337
+ udp() {
338
+ return write("udp");
339
+ },
340
+ tty() {
341
+ return write("tty");
342
+ },
343
+ statwatcher() {
344
+ return write("statwatcher");
345
+ },
346
+ securecontext() {
347
+ return write("securecontext");
348
+ },
349
+ connection() {
350
+ return write("connection");
351
+ },
352
+ zlib() {
353
+ return write("zlib");
354
+ },
355
+ context() {
356
+ return write("context");
357
+ },
358
+ nodescript() {
359
+ return write("nodescript");
360
+ },
361
+ httpparser() {
362
+ return write("httpparser");
363
+ },
364
+ dataview() {
365
+ return write("dataview");
366
+ },
367
+ signal() {
368
+ return write("signal");
369
+ },
370
+ fsevent() {
371
+ return write("fsevent");
372
+ },
373
+ tlswrap() {
374
+ return write("tlswrap");
375
+ }
376
+ };
377
+ }
378
+ const nativeFunc = "[native code] }";
379
+ function isNativeFunction(f) {
380
+ if (typeof f !== "function") return false;
381
+ return Function.prototype.toString.call(f).slice(-15) === nativeFunc;
382
+ }
383
+ nodeCrypto.webcrypto?.subtle || {};
384
+ var alphabetByEncoding = {};
385
+ var alphabetByValue = Array.from({ length: 64 });
386
+ for (let i = 0, start = "A".charCodeAt(0), limit = "Z".charCodeAt(0); i + start <= limit; i++) {
387
+ const char = String.fromCharCode(i + start);
388
+ alphabetByEncoding[char] = i;
389
+ alphabetByValue[i] = char;
390
+ }
391
+ for (let i = 0, start = "a".charCodeAt(0), limit = "z".charCodeAt(0); i + start <= limit; i++) {
392
+ const char = String.fromCharCode(i + start);
393
+ const index = i + 26;
394
+ alphabetByEncoding[char] = index;
395
+ alphabetByValue[index] = char;
396
+ }
397
+ for (let i = 0; i < 10; i++) {
398
+ alphabetByEncoding[i.toString(10)] = i + 52;
399
+ const char = i.toString(10);
400
+ const index = i + 52;
401
+ alphabetByEncoding[char] = index;
402
+ alphabetByValue[index] = char;
403
+ }
404
+ alphabetByEncoding["-"] = 62;
405
+ alphabetByValue[62] = "-";
406
+ alphabetByEncoding["_"] = 63;
407
+ alphabetByValue[63] = "_";
408
+ function hasProp(obj, prop) {
409
+ try {
410
+ return prop in obj;
411
+ } catch {
412
+ return false;
413
+ }
414
+ }
415
+ var __defProp$2 = Object.defineProperty;
416
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
417
+ enumerable: true,
418
+ configurable: true,
419
+ writable: true,
420
+ value
421
+ }) : obj[key] = value;
422
+ var __publicField$2 = (obj, key, value) => {
423
+ __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
424
+ return value;
425
+ };
426
+ var H3Error = class extends Error {
427
+ constructor(message, opts = {}) {
428
+ super(message, opts);
429
+ __publicField$2(this, "statusCode", 500);
430
+ __publicField$2(this, "fatal", false);
431
+ __publicField$2(this, "unhandled", false);
432
+ __publicField$2(this, "statusMessage");
433
+ __publicField$2(this, "data");
434
+ __publicField$2(this, "cause");
435
+ if (opts.cause && !this.cause) this.cause = opts.cause;
436
+ }
437
+ toJSON() {
438
+ const obj = {
439
+ message: this.message,
440
+ statusCode: sanitizeStatusCode(this.statusCode, 500)
441
+ };
442
+ if (this.statusMessage) obj.statusMessage = sanitizeStatusMessage(this.statusMessage);
443
+ if (this.data !== void 0) obj.data = this.data;
444
+ return obj;
445
+ }
446
+ };
447
+ __publicField$2(H3Error, "__h3_error__", true);
448
+ const DISALLOWED_STATUS_CHARS = /[^\u0009\u0020-\u007E]/g;
449
+ function sanitizeStatusMessage(statusMessage = "") {
450
+ return statusMessage.replace(DISALLOWED_STATUS_CHARS, "");
451
+ }
452
+ function sanitizeStatusCode(statusCode, defaultStatusCode = 200) {
453
+ if (!statusCode) return defaultStatusCode;
454
+ if (typeof statusCode === "string") statusCode = Number.parseInt(statusCode, 10);
455
+ if (statusCode < 100 || statusCode > 999) return defaultStatusCode;
456
+ return statusCode;
457
+ }
458
+ function setCookie$1(event, name, value, serializeOptions) {
459
+ serializeOptions = {
460
+ path: "/",
461
+ ...serializeOptions
462
+ };
463
+ const cookieStr = serialize(name, value, serializeOptions);
464
+ let setCookies = event.node.res.getHeader("set-cookie");
465
+ if (!Array.isArray(setCookies)) setCookies = [setCookies];
466
+ const _optionsHash = objectHash(serializeOptions);
467
+ setCookies = setCookies.filter((cookieValue) => {
468
+ return cookieValue && _optionsHash !== objectHash(parse(cookieValue));
469
+ });
470
+ event.node.res.setHeader("set-cookie", [...setCookies, cookieStr]);
471
+ }
472
+ function splitCookiesString(cookiesString) {
473
+ if (Array.isArray(cookiesString)) return cookiesString.flatMap((c) => splitCookiesString(c));
474
+ if (typeof cookiesString !== "string") return [];
475
+ const cookiesStrings = [];
476
+ let pos = 0;
477
+ let start;
478
+ let ch;
479
+ let lastComma;
480
+ let nextStart;
481
+ let cookiesSeparatorFound;
482
+ const skipWhitespace = () => {
483
+ while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) pos += 1;
484
+ return pos < cookiesString.length;
485
+ };
486
+ const notSpecialChar = () => {
487
+ ch = cookiesString.charAt(pos);
488
+ return ch !== "=" && ch !== ";" && ch !== ",";
489
+ };
490
+ while (pos < cookiesString.length) {
491
+ start = pos;
492
+ cookiesSeparatorFound = false;
493
+ while (skipWhitespace()) {
494
+ ch = cookiesString.charAt(pos);
495
+ if (ch === ",") {
496
+ lastComma = pos;
497
+ pos += 1;
498
+ skipWhitespace();
499
+ nextStart = pos;
500
+ while (pos < cookiesString.length && notSpecialChar()) pos += 1;
501
+ if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
502
+ cookiesSeparatorFound = true;
503
+ pos = nextStart;
504
+ cookiesStrings.push(cookiesString.slice(start, lastComma));
505
+ start = pos;
506
+ } else pos = lastComma + 1;
507
+ } else pos += 1;
508
+ }
509
+ if (!cookiesSeparatorFound || pos >= cookiesString.length) cookiesStrings.push(cookiesString.slice(start));
510
+ }
511
+ return cookiesStrings;
512
+ }
513
+ typeof setImmediate === "undefined" ? (fn) => fn() : setImmediate;
514
+ function sendStream(event, stream) {
515
+ if (!stream || typeof stream !== "object") throw new Error("[h3] Invalid stream provided.");
516
+ event.node.res._data = stream;
517
+ if (!event.node.res.socket) {
518
+ event._handled = true;
519
+ return Promise.resolve();
520
+ }
521
+ if (hasProp(stream, "pipeTo") && typeof stream.pipeTo === "function") return stream.pipeTo(new WritableStream({ write(chunk) {
522
+ event.node.res.write(chunk);
523
+ } })).then(() => {
524
+ event.node.res.end();
525
+ });
526
+ if (hasProp(stream, "pipe") && typeof stream.pipe === "function") return new Promise((resolve, reject) => {
527
+ stream.pipe(event.node.res);
528
+ if (stream.on) {
529
+ stream.on("end", () => {
530
+ event.node.res.end();
531
+ resolve();
532
+ });
533
+ stream.on("error", (error) => {
534
+ reject(error);
535
+ });
536
+ }
537
+ event.node.res.on("close", () => {
538
+ if (stream.abort) stream.abort();
539
+ });
540
+ });
541
+ throw new Error("[h3] Invalid or incompatible stream provided.");
542
+ }
543
+ function sendWebResponse(event, response) {
544
+ for (const [key, value] of response.headers) if (key === "set-cookie") event.node.res.appendHeader(key, splitCookiesString(value));
545
+ else event.node.res.setHeader(key, value);
546
+ if (response.status) event.node.res.statusCode = sanitizeStatusCode(response.status, event.node.res.statusCode);
547
+ if (response.statusText) event.node.res.statusMessage = sanitizeStatusMessage(response.statusText);
548
+ if (response.redirected) event.node.res.setHeader("location", response.url);
549
+ if (!response.body) {
550
+ event.node.res.end();
551
+ return;
552
+ }
553
+ return sendStream(event, response.body);
554
+ }
555
+ var __defProp = Object.defineProperty;
556
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
557
+ enumerable: true,
558
+ configurable: true,
559
+ writable: true,
560
+ value
561
+ }) : obj[key] = value;
562
+ var __publicField = (obj, key, value) => {
563
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
564
+ return value;
565
+ };
566
+ var H3Event = class {
567
+ constructor(req, res) {
568
+ __publicField(this, "__is_event__", true);
569
+ __publicField(this, "node");
570
+ __publicField(this, "web");
571
+ __publicField(this, "context", {});
572
+ __publicField(this, "_method");
573
+ __publicField(this, "_path");
574
+ __publicField(this, "_headers");
575
+ __publicField(this, "_requestBody");
576
+ __publicField(this, "_handled", false);
577
+ __publicField(this, "_onBeforeResponseCalled");
578
+ __publicField(this, "_onAfterResponseCalled");
579
+ this.node = {
580
+ req,
581
+ res
582
+ };
583
+ }
584
+ get method() {
585
+ if (!this._method) this._method = (this.node.req.method || "GET").toUpperCase();
586
+ return this._method;
587
+ }
588
+ get path() {
589
+ return this._path || this.node.req.url || "/";
590
+ }
591
+ get headers() {
592
+ if (!this._headers) this._headers = _normalizeNodeHeaders(this.node.req.headers);
593
+ return this._headers;
594
+ }
595
+ get handled() {
596
+ return this._handled || this.node.res.writableEnded || this.node.res.headersSent;
597
+ }
598
+ respondWith(response) {
599
+ return Promise.resolve(response).then((_response) => sendWebResponse(this, _response));
600
+ }
601
+ toString() {
602
+ return `[${this.method}] ${this.path}`;
603
+ }
604
+ toJSON() {
605
+ return this.toString();
606
+ }
607
+ /** @deprecated Please use `event.node.req` instead. */
608
+ get req() {
609
+ return this.node.req;
610
+ }
611
+ /** @deprecated Please use `event.node.res` instead. */
612
+ get res() {
613
+ return this.node.res;
614
+ }
615
+ };
616
+ function _normalizeNodeHeaders(nodeHeaders) {
617
+ const headers = new Headers();
618
+ for (const [name, value] of Object.entries(nodeHeaders)) if (Array.isArray(value)) for (const item of value) headers.append(name, item);
619
+ else if (value) headers.set(name, value);
620
+ return headers;
621
+ }
622
+ const eventStorage = new AsyncLocalStorage();
623
+ function getEvent() {
624
+ const event = eventStorage.getStore();
625
+ if (!event) throw new Error(`No HTTPEvent found in AsyncLocalStorage. Make sure you are using the function within the server runtime.`);
626
+ return event;
627
+ }
628
+ const HTTPEventSymbol = Symbol("$HTTPEvent");
629
+ function isEvent(obj) {
630
+ return typeof obj === "object" && (obj instanceof H3Event || (obj == null ? void 0 : obj[HTTPEventSymbol]) instanceof H3Event || (obj == null ? void 0 : obj.__is_event__) === true);
631
+ }
632
+ function createWrapperFunction(h3Function) {
633
+ return function(...args) {
634
+ const event = args[0];
635
+ if (!isEvent(event)) args.unshift(getEvent());
636
+ else args[0] = event instanceof H3Event || event.__is_event__ ? event : event[HTTPEventSymbol];
637
+ return h3Function(...args);
638
+ };
639
+ }
640
+ const setCookie = createWrapperFunction(setCookie$1);
641
+ export {
642
+ setCookie
643
+ };
644
+ //# sourceMappingURL=server-mxQ3s5dx-CC81W42s.js.map