@zetaloop/chappie 0.5.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,4752 @@
1
+ import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
+ import {
3
+ journalHistory
4
+ } from "./chunk-OWAAWZNT.js";
5
+ import {
6
+ ProviderOutput,
7
+ Session,
8
+ createMessage
9
+ } from "./chunk-5CKVVDZ2.js";
10
+ import {
11
+ localDeliveries,
12
+ localTools
13
+ } from "./chunk-DM523QRR.js";
14
+ import "./chunk-EIPDEA3I.js";
15
+ import "./chunk-GX4JWLHH.js";
16
+ import {
17
+ readConfig,
18
+ toJSONSchema,
19
+ transferDescription,
20
+ transferInput
21
+ } from "./chunk-GWYP7B66.js";
22
+ import {
23
+ __export
24
+ } from "./chunk-UOFCCHBS.js";
25
+
26
+ // src/pi.ts
27
+ import { access } from "node:fs/promises";
28
+ import { hostname as hostname2 } from "node:os";
29
+ import { resolve } from "node:path";
30
+ import {
31
+ createAssistantMessageEventStream,
32
+ createProvider
33
+ } from "@earendil-works/pi-ai";
34
+ import {
35
+ getAgentDir,
36
+ withFileMutationQueue
37
+ } from "@earendil-works/pi-coding-agent";
38
+ import { Text as Text2 } from "@earendil-works/pi-tui";
39
+
40
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/system/memory/memory.mjs
41
+ var memory_exports = {};
42
+ __export(memory_exports, {
43
+ Assign: () => Assign,
44
+ Clone: () => Clone,
45
+ Create: () => Create,
46
+ Discard: () => Discard,
47
+ Metrics: () => Metrics,
48
+ Update: () => Update
49
+ });
50
+
51
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/system/memory/metrics.mjs
52
+ var Metrics = {
53
+ assign: 0,
54
+ create: 0,
55
+ clone: 0,
56
+ discard: 0,
57
+ update: 0
58
+ };
59
+
60
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/system/settings/settings.mjs
61
+ var settings_exports = {};
62
+ __export(settings_exports, {
63
+ Get: () => Get,
64
+ Reset: () => Reset,
65
+ Set: () => Set2
66
+ });
67
+
68
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/guard/guard.mjs
69
+ var guard_exports = {};
70
+ __export(guard_exports, {
71
+ Counted: () => Counted,
72
+ Entries: () => Entries,
73
+ EntriesRegExp: () => EntriesRegExp,
74
+ Every: () => Every,
75
+ EveryAll: () => EveryAll,
76
+ GraphemeCount: () => GraphemeCount2,
77
+ HasPropertyKey: () => HasPropertyKey,
78
+ IsArray: () => IsArray,
79
+ IsBigInt: () => IsBigInt,
80
+ IsBoolean: () => IsBoolean,
81
+ IsClassInstance: () => IsClassInstance,
82
+ IsConstructor: () => IsConstructor,
83
+ IsDeepEqual: () => IsDeepEqual,
84
+ IsEqual: () => IsEqual,
85
+ IsFunction: () => IsFunction,
86
+ IsGreaterEqualThan: () => IsGreaterEqualThan,
87
+ IsGreaterThan: () => IsGreaterThan,
88
+ IsInteger: () => IsInteger,
89
+ IsLessEqualThan: () => IsLessEqualThan,
90
+ IsLessThan: () => IsLessThan,
91
+ IsMaxLength: () => IsMaxLength2,
92
+ IsMinLength: () => IsMinLength2,
93
+ IsMultipleOf: () => IsMultipleOf,
94
+ IsNull: () => IsNull,
95
+ IsNumber: () => IsNumber,
96
+ IsObject: () => IsObject,
97
+ IsObjectNotArray: () => IsObjectNotArray,
98
+ IsString: () => IsString,
99
+ IsSymbol: () => IsSymbol,
100
+ IsUndefined: () => IsUndefined,
101
+ IsUnsafePropertyKey: () => IsUnsafePropertyKey,
102
+ IsValueLike: () => IsValueLike,
103
+ Keys: () => Keys,
104
+ ShiftLeft: () => ShiftLeft,
105
+ Some: () => Some,
106
+ SomeAll: () => SomeAll,
107
+ Symbols: () => Symbols,
108
+ Values: () => Values
109
+ });
110
+
111
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/guard/string.mjs
112
+ function IsBetween(value, min, max) {
113
+ return value >= min && value <= max;
114
+ }
115
+ function IsZeroWidthJoiner(value) {
116
+ return value === 8205;
117
+ }
118
+ function IsHighSurrogate(value) {
119
+ return IsBetween(value, 55296, 56319);
120
+ }
121
+ function IsRegionalIndicator(value) {
122
+ return IsBetween(value, 127462, 127487);
123
+ }
124
+ function IsVariationSelector(value) {
125
+ return IsBetween(value, 65024, 65039);
126
+ }
127
+ function IsCombiningMark(value) {
128
+ return IsBetween(value, 768, 879) || IsBetween(value, 6832, 6911) || IsBetween(value, 7616, 7679) || IsBetween(value, 65056, 65071);
129
+ }
130
+ function CodePointLength(value) {
131
+ return value > 65535 ? 2 : 1;
132
+ }
133
+ function ConsumeModifiers(value, index) {
134
+ while (index < value.length) {
135
+ const point = value.codePointAt(index);
136
+ if (IsCombiningMark(point) || IsVariationSelector(point)) {
137
+ index += CodePointLength(point);
138
+ } else {
139
+ break;
140
+ }
141
+ }
142
+ return index;
143
+ }
144
+ function NextGraphemeClusterIndex(value, clusterStart) {
145
+ const startCP = value.codePointAt(clusterStart);
146
+ let clusterEnd = clusterStart + CodePointLength(startCP);
147
+ clusterEnd = ConsumeModifiers(value, clusterEnd);
148
+ while (clusterEnd < value.length - 1 && IsZeroWidthJoiner(value.codePointAt(clusterEnd))) {
149
+ const nextCP = value.codePointAt(clusterEnd + 1);
150
+ clusterEnd += 1 + CodePointLength(nextCP);
151
+ clusterEnd = ConsumeModifiers(value, clusterEnd);
152
+ }
153
+ if (IsRegionalIndicator(startCP) && clusterEnd < value.length && IsRegionalIndicator(value.codePointAt(clusterEnd))) {
154
+ clusterEnd += CodePointLength(value.codePointAt(clusterEnd));
155
+ }
156
+ return clusterEnd;
157
+ }
158
+ function IsGraphemeCodePoint(value) {
159
+ return value >= 768 && // above special range
160
+ (IsHighSurrogate(value) || IsCombiningMark(value) || IsVariationSelector(value) || IsZeroWidthJoiner(value));
161
+ }
162
+ function GraphemeCount(value) {
163
+ let count = 0;
164
+ let index = 0;
165
+ while (index < value.length) {
166
+ index = NextGraphemeClusterIndex(value, index);
167
+ count++;
168
+ }
169
+ return count;
170
+ }
171
+ function IsMinLengthSegmented(value, minLength) {
172
+ let count = 0;
173
+ let index = 0;
174
+ while (index < value.length) {
175
+ index = NextGraphemeClusterIndex(value, index);
176
+ if (++count >= minLength)
177
+ return true;
178
+ }
179
+ return false;
180
+ }
181
+ function IsMaxLengthSegmented(value, maxLength) {
182
+ let count = 0;
183
+ let index = 0;
184
+ while (index < value.length) {
185
+ index = NextGraphemeClusterIndex(value, index);
186
+ if (++count > maxLength)
187
+ return false;
188
+ }
189
+ return true;
190
+ }
191
+ function IsMinLength(value, minLength) {
192
+ if (minLength === 0)
193
+ return true;
194
+ if (value.length < minLength)
195
+ return false;
196
+ let index = 0;
197
+ while (true) {
198
+ if (IsGraphemeCodePoint(value.charCodeAt(index))) {
199
+ return IsMinLengthSegmented(value, minLength);
200
+ }
201
+ if (++index >= minLength)
202
+ return true;
203
+ }
204
+ }
205
+ function IsMaxLength(value, maxLength) {
206
+ if (value.length <= maxLength)
207
+ return true;
208
+ let index = 0;
209
+ while (true) {
210
+ if (IsGraphemeCodePoint(value.charCodeAt(index))) {
211
+ return IsMaxLengthSegmented(value, maxLength);
212
+ }
213
+ if (++index > maxLength)
214
+ return false;
215
+ }
216
+ }
217
+
218
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/guard/guard.mjs
219
+ function IsArray(value) {
220
+ return Array.isArray(value);
221
+ }
222
+ function IsBigInt(value) {
223
+ return IsEqual(typeof value, "bigint");
224
+ }
225
+ function IsBoolean(value) {
226
+ return IsEqual(typeof value, "boolean");
227
+ }
228
+ function IsConstructor(value) {
229
+ if (IsUndefined(value) || !IsFunction(value))
230
+ return false;
231
+ const result = Function.prototype.toString.call(value);
232
+ if (/^class\s/.test(result))
233
+ return true;
234
+ if (/\[native code\]/.test(result))
235
+ return true;
236
+ return false;
237
+ }
238
+ function IsFunction(value) {
239
+ return IsEqual(typeof value, "function");
240
+ }
241
+ function IsInteger(value) {
242
+ return Number.isInteger(value);
243
+ }
244
+ function IsNull(value) {
245
+ return IsEqual(value, null);
246
+ }
247
+ function IsNumber(value) {
248
+ return Number.isFinite(value);
249
+ }
250
+ function IsObjectNotArray(value) {
251
+ return IsObject(value) && !IsArray(value);
252
+ }
253
+ function IsObject(value) {
254
+ return IsEqual(typeof value, "object") && !IsNull(value);
255
+ }
256
+ function IsString(value) {
257
+ return IsEqual(typeof value, "string");
258
+ }
259
+ function IsSymbol(value) {
260
+ return IsEqual(typeof value, "symbol");
261
+ }
262
+ function IsUndefined(value) {
263
+ return IsEqual(value, void 0);
264
+ }
265
+ function IsEqual(left, right) {
266
+ return left === right;
267
+ }
268
+ function IsGreaterThan(left, right) {
269
+ return left > right;
270
+ }
271
+ function IsLessThan(left, right) {
272
+ return left < right;
273
+ }
274
+ function IsLessEqualThan(left, right) {
275
+ return left <= right;
276
+ }
277
+ function IsGreaterEqualThan(left, right) {
278
+ return left >= right;
279
+ }
280
+ function IsMultipleOf(dividend, divisor) {
281
+ if (IsBigInt(dividend) || IsBigInt(divisor)) {
282
+ return BigInt(dividend) % BigInt(divisor) === 0n;
283
+ }
284
+ const tolerance = 1e-10;
285
+ if (!IsNumber(dividend))
286
+ return true;
287
+ if (IsInteger(dividend) && 1 / divisor % 1 === 0)
288
+ return true;
289
+ const mod = dividend % divisor;
290
+ return Math.min(Math.abs(mod), Math.abs(mod - divisor), Math.abs(mod + divisor)) < tolerance;
291
+ }
292
+ function IsClassInstance(value) {
293
+ if (!IsObject(value))
294
+ return false;
295
+ const proto = globalThis.Object.getPrototypeOf(value);
296
+ if (IsNull(proto))
297
+ return false;
298
+ return IsEqual(typeof proto.constructor, "function") && !(IsEqual(proto.constructor, globalThis.Object) || IsEqual(proto.constructor.name, "Object"));
299
+ }
300
+ function IsValueLike(value) {
301
+ return IsBigInt(value) || IsBoolean(value) || IsNull(value) || IsNumber(value) || IsString(value) || IsUndefined(value);
302
+ }
303
+ function GraphemeCount2(value) {
304
+ return GraphemeCount(value);
305
+ }
306
+ function IsMaxLength2(value, length) {
307
+ return IsMaxLength(value, length);
308
+ }
309
+ function IsMinLength2(value, length) {
310
+ return IsMinLength(value, length);
311
+ }
312
+ function Every(value, offset, callback) {
313
+ return value.every((item, index) => index < offset || callback(item, index));
314
+ }
315
+ function EveryAll(value, offset, callback) {
316
+ let result = true;
317
+ value.forEach((item, index) => {
318
+ if (index >= offset && !callback(item, index))
319
+ result = false;
320
+ });
321
+ return result;
322
+ }
323
+ function Some(value, callback) {
324
+ return value.some((value2, index) => callback(value2, index));
325
+ }
326
+ function SomeAll(value, callback) {
327
+ let result = false;
328
+ value.forEach((item, index) => {
329
+ if (callback(item, index))
330
+ result = true;
331
+ });
332
+ return result;
333
+ }
334
+ function Counted(value, callback) {
335
+ return value.reduce((result, value2, index) => callback(value2, index) ? ++result : result, 0);
336
+ }
337
+ function ShiftLeft(array, true_, false_) {
338
+ return IsEqual(array.length, 0) ? false_() : true_(array[0], array.slice(1));
339
+ }
340
+ function IsUnsafePropertyKey(key) {
341
+ return IsEqual(key, "__proto__") || IsEqual(key, "constructor") || IsEqual(key, "prototype");
342
+ }
343
+ function HasPropertyKey(value, key) {
344
+ return IsUnsafePropertyKey(key) ? Object.prototype.hasOwnProperty.call(value, key) : key in value;
345
+ }
346
+ function EntriesRegExp(value) {
347
+ return Keys(value).map((key) => [new RegExp(`^${key}$`), value[key]]);
348
+ }
349
+ function Entries(value) {
350
+ return Object.entries(value);
351
+ }
352
+ function Keys(value) {
353
+ return Object.getOwnPropertyNames(value);
354
+ }
355
+ function Symbols(value) {
356
+ return Object.getOwnPropertySymbols(value);
357
+ }
358
+ function Values(value) {
359
+ return Object.values(value);
360
+ }
361
+ function DeepEqualObject(left, right) {
362
+ if (!IsObject(right))
363
+ return false;
364
+ const keys = Keys(left);
365
+ return IsEqual(keys.length, Keys(right).length) && keys.every((key) => IsDeepEqual(left[key], right[key]));
366
+ }
367
+ function DeepEqualArray(left, right) {
368
+ return IsArray(right) && IsEqual(left.length, right.length) && left.every((_, index) => IsDeepEqual(left[index], right[index]));
369
+ }
370
+ function IsDeepEqual(left, right) {
371
+ return IsArray(left) ? DeepEqualArray(left, right) : IsObject(left) ? DeepEqualObject(left, right) : IsEqual(left, right);
372
+ }
373
+
374
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/guard/globals.mjs
375
+ var globals_exports = {};
376
+ __export(globals_exports, {
377
+ IsBigInt64Array: () => IsBigInt64Array,
378
+ IsBigUint64Array: () => IsBigUint64Array,
379
+ IsBoolean: () => IsBoolean2,
380
+ IsDate: () => IsDate,
381
+ IsFloat32Array: () => IsFloat32Array,
382
+ IsFloat64Array: () => IsFloat64Array,
383
+ IsInt16Array: () => IsInt16Array,
384
+ IsInt32Array: () => IsInt32Array,
385
+ IsInt8Array: () => IsInt8Array,
386
+ IsMap: () => IsMap,
387
+ IsNumber: () => IsNumber2,
388
+ IsRegExp: () => IsRegExp,
389
+ IsSet: () => IsSet,
390
+ IsString: () => IsString2,
391
+ IsTypeArray: () => IsTypeArray,
392
+ IsUint16Array: () => IsUint16Array,
393
+ IsUint32Array: () => IsUint32Array,
394
+ IsUint8Array: () => IsUint8Array,
395
+ IsUint8ClampedArray: () => IsUint8ClampedArray
396
+ });
397
+ function IsBoolean2(value) {
398
+ return value instanceof Boolean;
399
+ }
400
+ function IsNumber2(value) {
401
+ return value instanceof Number;
402
+ }
403
+ function IsString2(value) {
404
+ return value instanceof String;
405
+ }
406
+ function IsTypeArray(value) {
407
+ return globalThis.ArrayBuffer.isView(value);
408
+ }
409
+ function IsInt8Array(value) {
410
+ return value instanceof globalThis.Int8Array;
411
+ }
412
+ function IsUint8Array(value) {
413
+ return value instanceof globalThis.Uint8Array;
414
+ }
415
+ function IsUint8ClampedArray(value) {
416
+ return value instanceof globalThis.Uint8ClampedArray;
417
+ }
418
+ function IsInt16Array(value) {
419
+ return value instanceof globalThis.Int16Array;
420
+ }
421
+ function IsUint16Array(value) {
422
+ return value instanceof globalThis.Uint16Array;
423
+ }
424
+ function IsInt32Array(value) {
425
+ return value instanceof globalThis.Int32Array;
426
+ }
427
+ function IsUint32Array(value) {
428
+ return value instanceof globalThis.Uint32Array;
429
+ }
430
+ function IsFloat32Array(value) {
431
+ return value instanceof globalThis.Float32Array;
432
+ }
433
+ function IsFloat64Array(value) {
434
+ return value instanceof globalThis.Float64Array;
435
+ }
436
+ function IsBigInt64Array(value) {
437
+ return value instanceof globalThis.BigInt64Array;
438
+ }
439
+ function IsBigUint64Array(value) {
440
+ return value instanceof globalThis.BigUint64Array;
441
+ }
442
+ function IsRegExp(value) {
443
+ return value instanceof globalThis.RegExp;
444
+ }
445
+ function IsDate(value) {
446
+ return value instanceof globalThis.Date;
447
+ }
448
+ function IsSet(value) {
449
+ return value instanceof globalThis.Set;
450
+ }
451
+ function IsMap(value) {
452
+ return value instanceof globalThis.Map;
453
+ }
454
+
455
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/system/settings/settings.mjs
456
+ var settings = {
457
+ immutableTypes: false,
458
+ maxErrors: 8,
459
+ maxInstantiationCount: 128,
460
+ useAcceleration: true,
461
+ exactOptionalPropertyTypes: false,
462
+ enumerableKind: false,
463
+ correctiveParse: false,
464
+ unionPrioritySort: true
465
+ };
466
+ function Reset() {
467
+ settings.immutableTypes = false;
468
+ settings.maxErrors = 8;
469
+ settings.maxInstantiationCount = 128;
470
+ settings.useAcceleration = true;
471
+ settings.exactOptionalPropertyTypes = false;
472
+ settings.enumerableKind = false;
473
+ settings.correctiveParse = false;
474
+ settings.unionPrioritySort = true;
475
+ }
476
+ function Set2(options) {
477
+ for (const key of guard_exports.Keys(options)) {
478
+ const value = options[key];
479
+ if (value !== void 0) {
480
+ Object.defineProperty(settings, key, { value });
481
+ }
482
+ }
483
+ }
484
+ function Get() {
485
+ return settings;
486
+ }
487
+
488
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/system/memory/freeze.mjs
489
+ function Freeze(value) {
490
+ return settings_exports.Get().immutableTypes ? Object.freeze(value) : value;
491
+ }
492
+
493
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/system/memory/assign.mjs
494
+ function Assign(left, right) {
495
+ Metrics.assign += 1;
496
+ return Freeze({ ...left, ...right });
497
+ }
498
+
499
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/system/memory/clone.mjs
500
+ function FromClassInstance(value) {
501
+ return value;
502
+ }
503
+ function IsSchemaObject(value) {
504
+ return guard_exports.HasPropertyKey(value, "~kind") || guard_exports.HasPropertyKey(value, "~unsafe");
505
+ }
506
+ function FromSchemaObject(value) {
507
+ const result = {};
508
+ for (const key of guard_exports.Keys(value)) {
509
+ if (guard_exports.IsUnsafePropertyKey(key))
510
+ continue;
511
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
512
+ descriptor.value = FromValue(descriptor.value);
513
+ if (guard_exports.IsEqual(descriptor.enumerable, true)) {
514
+ result[key] = descriptor.value;
515
+ } else {
516
+ Object.defineProperty(result, key, descriptor);
517
+ }
518
+ }
519
+ return result;
520
+ }
521
+ function FromPlainObject(value) {
522
+ const result = {};
523
+ for (const key of guard_exports.Keys(value)) {
524
+ if (guard_exports.IsUnsafePropertyKey(key))
525
+ continue;
526
+ result[key] = FromValue(value[key]);
527
+ }
528
+ for (const key of guard_exports.Symbols(value)) {
529
+ result[key] = FromValue(value[key]);
530
+ }
531
+ return result;
532
+ }
533
+ function FromObject(value) {
534
+ return guard_exports.IsClassInstance(value) ? FromClassInstance(value) : IsSchemaObject(value) ? FromSchemaObject(value) : FromPlainObject(value);
535
+ }
536
+ function FromArray(value) {
537
+ return value.map((element) => FromValue(element));
538
+ }
539
+ function FromTypedArray(value) {
540
+ return value.slice();
541
+ }
542
+ function FromRegExp(value) {
543
+ return new RegExp(value.source, value.flags);
544
+ }
545
+ function FromMap(value) {
546
+ return new Map(FromValue([...value.entries()]));
547
+ }
548
+ function FromSet(value) {
549
+ return new Set(FromValue([...value.values()]));
550
+ }
551
+ function FromValue(value) {
552
+ return globals_exports.IsTypeArray(value) ? FromTypedArray(value) : globals_exports.IsRegExp(value) ? FromRegExp(value) : globals_exports.IsMap(value) ? FromMap(value) : globals_exports.IsSet(value) ? FromSet(value) : guard_exports.IsArray(value) ? FromArray(value) : guard_exports.IsObject(value) ? FromObject(value) : value;
553
+ }
554
+ function Clone(value) {
555
+ Metrics.clone += 1;
556
+ return FromValue(value);
557
+ }
558
+
559
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/system/memory/create.mjs
560
+ function MergeHidden(left, right) {
561
+ for (const key of Object.keys(right)) {
562
+ Object.defineProperty(left, key, {
563
+ configurable: true,
564
+ writable: true,
565
+ enumerable: false,
566
+ value: right[key]
567
+ });
568
+ }
569
+ return left;
570
+ }
571
+ function Merge(left, right) {
572
+ return { ...left, ...right };
573
+ }
574
+ function Create(hidden, enumerable, options = {}) {
575
+ Metrics.create += 1;
576
+ const withOptions = Merge(enumerable, options);
577
+ const withHidden = settings_exports.Get().enumerableKind ? Merge(withOptions, hidden) : MergeHidden(withOptions, hidden);
578
+ return Freeze(withHidden);
579
+ }
580
+
581
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/system/memory/discard.mjs
582
+ function Discard(value, propertyKeys) {
583
+ Metrics.discard += 1;
584
+ const result = {};
585
+ for (const key of guard_exports.Keys(value)) {
586
+ if (propertyKeys.includes(key))
587
+ continue;
588
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
589
+ descriptor.value = Clone(descriptor.value);
590
+ Object.defineProperty(result, key, descriptor);
591
+ }
592
+ return Freeze(result);
593
+ }
594
+
595
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/system/memory/update.mjs
596
+ function Update(current, hidden, enumerable) {
597
+ Metrics.update += 1;
598
+ const settings2 = settings_exports.Get();
599
+ const result = Clone(current);
600
+ for (const key of Object.keys(hidden)) {
601
+ Object.defineProperty(result, key, {
602
+ configurable: true,
603
+ writable: true,
604
+ enumerable: settings2.enumerableKind,
605
+ value: hidden[key]
606
+ });
607
+ }
608
+ for (const key of Object.keys(enumerable)) {
609
+ Object.defineProperty(result, key, {
610
+ configurable: true,
611
+ enumerable: true,
612
+ writable: true,
613
+ value: enumerable[key]
614
+ });
615
+ }
616
+ return Freeze(result);
617
+ }
618
+
619
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/schema.mjs
620
+ function IsKind(value, kind) {
621
+ return guard_exports.IsObject(value) && guard_exports.HasPropertyKey(value, "~kind") && guard_exports.IsEqual(value["~kind"], kind);
622
+ }
623
+ function IsSchema(value) {
624
+ return guard_exports.IsObject(value);
625
+ }
626
+
627
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/deferred.mjs
628
+ function Deferred(action, parameters2, options) {
629
+ return memory_exports.Create({ "~kind": "Deferred" }, { type: "deferred", action, parameters: parameters2, options }, {});
630
+ }
631
+ function IsDeferred(value) {
632
+ return IsKind(value, "Deferred");
633
+ }
634
+
635
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs
636
+ function AddReadonlyOperation(type) {
637
+ return memory_exports.Update(type, { "~readonly": true }, {});
638
+ }
639
+ function AddReadonlyAction(type, options) {
640
+ const result = memory_exports.Update(AddReadonlyOperation(type), {}, options);
641
+ return result;
642
+ }
643
+ function AddReadonlyInstantiate(context, state, type, options) {
644
+ const instantiatedType = InstantiateType(context, state, type);
645
+ return AddReadonlyAction(instantiatedType, options);
646
+ }
647
+
648
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs
649
+ function AddOptionalOperation(type) {
650
+ return memory_exports.Update(type, { "~optional": true }, {});
651
+ }
652
+ function AddOptionalAction(type, options) {
653
+ const result = memory_exports.Update(AddOptionalOperation(type), {}, options);
654
+ return result;
655
+ }
656
+ function AddOptionalInstantiate(context, state, type, options) {
657
+ const instantiatedType = InstantiateType(context, state, type);
658
+ return AddOptionalAction(instantiatedType, options);
659
+ }
660
+
661
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/array.mjs
662
+ function _Array_(items, options) {
663
+ return memory_exports.Create({ "~kind": "Array" }, { type: "array", items }, options);
664
+ }
665
+ function IsArray2(value) {
666
+ return IsKind(value, "Array");
667
+ }
668
+ function ArrayOptions(type) {
669
+ return memory_exports.Discard(type, ["~kind", "type", "items"]);
670
+ }
671
+
672
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/constructor.mjs
673
+ function Constructor(parameters2, instanceType, options = {}) {
674
+ return memory_exports.Create({ "~kind": "Constructor" }, { type: "constructor", parameters: parameters2, instanceType }, options);
675
+ }
676
+ function IsConstructor2(value) {
677
+ return IsKind(value, "Constructor");
678
+ }
679
+ function ConstructorOptions(type) {
680
+ return memory_exports.Discard(type, ["~kind", "type", "parameters", "instanceType"]);
681
+ }
682
+
683
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/function.mjs
684
+ function _Function_(parameters2, returnType, options = {}) {
685
+ return memory_exports.Create({ ["~kind"]: "Function" }, { type: "function", parameters: parameters2, returnType }, options);
686
+ }
687
+ function IsFunction2(value) {
688
+ return IsKind(value, "Function");
689
+ }
690
+ function FunctionOptions(type) {
691
+ return memory_exports.Discard(type, ["~kind", "type", "parameters", "returnType"]);
692
+ }
693
+
694
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/ref.mjs
695
+ function Ref(ref, options) {
696
+ return memory_exports.Create({ ["~kind"]: "Ref" }, { $ref: ref }, options);
697
+ }
698
+ function IsRef(value) {
699
+ return IsKind(value, "Ref");
700
+ }
701
+
702
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/generic.mjs
703
+ function Generic(parameters2, expression) {
704
+ return memory_exports.Create({ "~kind": "Generic" }, { type: "generic", parameters: parameters2, expression });
705
+ }
706
+ function IsGeneric(value) {
707
+ return IsKind(value, "Generic");
708
+ }
709
+
710
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/any.mjs
711
+ function Any(options) {
712
+ return memory_exports.Create({ ["~kind"]: "Any" }, {}, options);
713
+ }
714
+ function IsAny(value) {
715
+ return IsKind(value, "Any");
716
+ }
717
+
718
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/never.mjs
719
+ var NeverPattern = "(?!)";
720
+ function Never(options) {
721
+ return memory_exports.Create({ "~kind": "Never" }, { not: {} }, options);
722
+ }
723
+ function IsNever(value) {
724
+ return IsKind(value, "Never");
725
+ }
726
+
727
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/_add_optional.mjs
728
+ function AddOptionalDeferred(type, options = {}) {
729
+ return Deferred("AddOptional", [type], options);
730
+ }
731
+ function AddOptional(type, options = {}) {
732
+ return AddOptionalAction(type, options);
733
+ }
734
+
735
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/_optional.mjs
736
+ function Optional(type) {
737
+ return AddOptional(type);
738
+ }
739
+ function IsOptional(value) {
740
+ return IsSchema(value) && guard_exports.HasPropertyKey(value, "~optional");
741
+ }
742
+
743
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/properties.mjs
744
+ function RequiredArray(properties) {
745
+ return guard_exports.Keys(properties).filter((key) => !IsOptional(properties[key]));
746
+ }
747
+ function PropertyKeys(properties) {
748
+ return guard_exports.Keys(properties);
749
+ }
750
+ function PropertyValues(properties) {
751
+ return guard_exports.Values(properties);
752
+ }
753
+
754
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/object.mjs
755
+ function _Object_(properties, options = {}) {
756
+ const requiredKeys = RequiredArray(properties);
757
+ const required = requiredKeys.length > 0 ? { required: requiredKeys } : {};
758
+ return memory_exports.Create({ "~kind": "Object" }, { type: "object", ...required, properties }, options);
759
+ }
760
+ function IsObject2(value) {
761
+ return IsKind(value, "Object");
762
+ }
763
+ function ObjectOptions(type) {
764
+ return memory_exports.Discard(type, ["~kind", "type", "properties", "required"]);
765
+ }
766
+
767
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/unknown.mjs
768
+ function Unknown(options) {
769
+ return memory_exports.Create({ ["~kind"]: "Unknown" }, {}, options);
770
+ }
771
+ function IsUnknown(value) {
772
+ return IsKind(value, "Unknown");
773
+ }
774
+
775
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/cyclic.mjs
776
+ function Cyclic($defs, $ref, options) {
777
+ const defs = guard_exports.Keys($defs).reduce((result, key) => {
778
+ return { ...result, [key]: memory_exports.Update($defs[key], {}, { $id: key }) };
779
+ }, {});
780
+ return memory_exports.Create({ ["~kind"]: "Cyclic" }, { $defs: defs, $ref }, options);
781
+ }
782
+ function IsCyclic(value) {
783
+ return IsKind(value, "Cyclic");
784
+ }
785
+
786
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/unsafe.mjs
787
+ function Unsafe(schema) {
788
+ return memory_exports.Update(schema, { ["~unsafe"]: null }, {});
789
+ }
790
+ function IsUnsafe(value) {
791
+ return guard_exports.IsObjectNotArray(value) && guard_exports.HasPropertyKey(value, "~unsafe") && guard_exports.IsNull(value["~unsafe"]);
792
+ }
793
+
794
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/system/arguments/arguments.mjs
795
+ var arguments_exports = {};
796
+ __export(arguments_exports, {
797
+ Match: () => Match
798
+ });
799
+ function Match(args, match) {
800
+ return match[args.length]?.(...args) ?? (() => {
801
+ throw Error("Invalid Arguments");
802
+ })();
803
+ }
804
+
805
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/infer.mjs
806
+ function Infer(...args) {
807
+ const [name, extends_] = arguments_exports.Match(args, {
808
+ 2: (name2, extends_2) => [name2, extends_2, extends_2],
809
+ 1: (name2) => [name2, Unknown(), Unknown()]
810
+ });
811
+ return memory_exports.Create({ ["~kind"]: "Infer" }, { type: "infer", name, extends: extends_ }, {});
812
+ }
813
+ function IsInfer(value) {
814
+ return IsKind(value, "Infer");
815
+ }
816
+
817
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/dependent.mjs
818
+ function Dependent(if_, then_, else_, options = {}) {
819
+ return memory_exports.Create({ "~kind": "Dependent" }, { if: if_, then: then_, else: else_ }, options);
820
+ }
821
+ function IsDependent(value) {
822
+ return IsKind(value, "Dependent");
823
+ }
824
+ function DependentOptions(type) {
825
+ return memory_exports.Discard(type, ["~kind", "if", "then", "else"]);
826
+ }
827
+
828
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/enum/typescript_enum_to_enum_values.mjs
829
+ function IsTypeScriptEnumLike(value) {
830
+ return guard_exports.IsObjectNotArray(value);
831
+ }
832
+ function TypeScriptEnumToEnumValues(type) {
833
+ const keys = guard_exports.Keys(type).filter((key) => isNaN(key));
834
+ return keys.reduce((result, key) => [...result, type[key]], []);
835
+ }
836
+
837
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/enum.mjs
838
+ function IsEnumValue(value) {
839
+ return guard_exports.IsString(value) || guard_exports.IsNumber(value);
840
+ }
841
+ function Enum(value, options) {
842
+ const values = IsTypeScriptEnumLike(value) ? TypeScriptEnumToEnumValues(value) : value;
843
+ return memory_exports.Create({ "~kind": "Enum" }, { enum: values }, options);
844
+ }
845
+ function IsEnum(value) {
846
+ return IsKind(value, "Enum");
847
+ }
848
+
849
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/intersect.mjs
850
+ function Intersect(types, options = {}) {
851
+ return memory_exports.Create({ "~kind": "Intersect" }, { allOf: types }, options);
852
+ }
853
+ function IsIntersect(value) {
854
+ return IsKind(value, "Intersect");
855
+ }
856
+ function IntersectOptions(type) {
857
+ return memory_exports.Discard(type, ["~kind", "allOf"]);
858
+ }
859
+
860
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/system/unreachable/unreachable.mjs
861
+ function Unreachable() {
862
+ throw new Error("Unreachable");
863
+ }
864
+
865
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/system/hashing/hash.mjs
866
+ var ByteMarker;
867
+ (function(ByteMarker2) {
868
+ ByteMarker2[ByteMarker2["Array"] = 0] = "Array";
869
+ ByteMarker2[ByteMarker2["BigInt"] = 1] = "BigInt";
870
+ ByteMarker2[ByteMarker2["Boolean"] = 2] = "Boolean";
871
+ ByteMarker2[ByteMarker2["Date"] = 3] = "Date";
872
+ ByteMarker2[ByteMarker2["Constructor"] = 4] = "Constructor";
873
+ ByteMarker2[ByteMarker2["Function"] = 5] = "Function";
874
+ ByteMarker2[ByteMarker2["Null"] = 6] = "Null";
875
+ ByteMarker2[ByteMarker2["Number"] = 7] = "Number";
876
+ ByteMarker2[ByteMarker2["Object"] = 8] = "Object";
877
+ ByteMarker2[ByteMarker2["RegExp"] = 9] = "RegExp";
878
+ ByteMarker2[ByteMarker2["String"] = 10] = "String";
879
+ ByteMarker2[ByteMarker2["Symbol"] = 11] = "Symbol";
880
+ ByteMarker2[ByteMarker2["TypeArray"] = 12] = "TypeArray";
881
+ ByteMarker2[ByteMarker2["Undefined"] = 13] = "Undefined";
882
+ })(ByteMarker || (ByteMarker = {}));
883
+ var Accumulator = BigInt("14695981039346656037");
884
+ var [Prime, Size] = [BigInt("1099511628211"), BigInt(
885
+ "18446744073709551616"
886
+ /* 2 ^ 64 */
887
+ )];
888
+ var Bytes = Array.from({ length: 256 }).map((_, i) => BigInt(i));
889
+ var F64 = new Float64Array(1);
890
+ var F64In = new DataView(F64.buffer);
891
+ var F64Out = new Uint8Array(F64.buffer);
892
+ var encoder = new TextEncoder();
893
+
894
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/_codec.mjs
895
+ var EncodeBuilder = class {
896
+ constructor(type, decode) {
897
+ this.type = type;
898
+ this.decode = decode;
899
+ }
900
+ Encode(callback) {
901
+ const type = this.type;
902
+ const decode = IsCodec(type) ? (value) => this.decode(type["~codec"].decode(value)) : this.decode;
903
+ const encode = IsCodec(type) ? (value) => type["~codec"].encode(callback(value)) : callback;
904
+ const codec = { decode, encode };
905
+ return memory_exports.Update(this.type, { "~codec": codec }, {});
906
+ }
907
+ };
908
+ var DecodeBuilder = class {
909
+ constructor(type) {
910
+ this.type = type;
911
+ }
912
+ Decode(callback) {
913
+ return new EncodeBuilder(this.type, callback);
914
+ }
915
+ };
916
+ function Codec(type) {
917
+ return new DecodeBuilder(type);
918
+ }
919
+ function Decode(type, callback) {
920
+ return Codec(type).Decode(callback).Encode(() => {
921
+ throw Error("Encode not implemented");
922
+ });
923
+ }
924
+ function Encode(type, callback) {
925
+ return Codec(type).Decode(() => {
926
+ throw Error("Decode not implemented");
927
+ }).Encode(callback);
928
+ }
929
+ function IsCodec(value) {
930
+ return IsSchema(value) && guard_exports.HasPropertyKey(value, "~codec") && guard_exports.IsObject(value["~codec"]) && guard_exports.HasPropertyKey(value["~codec"], "encode") && guard_exports.HasPropertyKey(value["~codec"], "decode");
931
+ }
932
+
933
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/_immutable.mjs
934
+ function Immutable(type) {
935
+ return AddImmutable(type);
936
+ }
937
+ function IsImmutable(value) {
938
+ return IsSchema(value) && guard_exports.HasPropertyKey(value, "~immutable");
939
+ }
940
+
941
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/_add_readonly.mjs
942
+ function AddReadonlyDeferred(type, options = {}) {
943
+ return Deferred("AddReadonly", [type], options);
944
+ }
945
+ function AddReadonly(type, options = {}) {
946
+ return AddReadonlyAction(type, options);
947
+ }
948
+
949
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/_readonly.mjs
950
+ function Readonly(type) {
951
+ return AddReadonly(type);
952
+ }
953
+ function IsReadonly(value) {
954
+ return IsSchema(value) && guard_exports.HasPropertyKey(value, "~readonly");
955
+ }
956
+
957
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/_refine.mjs
958
+ function RefineAdd(type, refinement) {
959
+ const refinements = IsRefine(type) ? [...type["~refine"], refinement] : [refinement];
960
+ return memory_exports.Update(type, { "~refine": refinements }, {});
961
+ }
962
+ function Refine(...args) {
963
+ const [type, check, error] = arguments_exports.Match(args, {
964
+ 3: (type2, check2, error2) => [type2, check2, error2],
965
+ 2: (type2, check2) => [type2, check2, () => "Refine Error"]
966
+ });
967
+ return RefineAdd(type, { check, error });
968
+ }
969
+ function IsRefinement(value) {
970
+ return guard_exports.IsObjectNotArray(value) && guard_exports.HasPropertyKey(value, "check") && guard_exports.HasPropertyKey(value, "error") && guard_exports.IsFunction(value.check) && guard_exports.IsFunction(value.error);
971
+ }
972
+ function IsRefine(value) {
973
+ return IsSchema(value) && guard_exports.HasPropertyKey(value, "~refine") && guard_exports.IsArray(value["~refine"]) && guard_exports.Every(value["~refine"], 0, (value2) => IsRefinement(value2));
974
+ }
975
+
976
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/bigint.mjs
977
+ var BigIntPattern = "-?(?:0|[1-9][0-9]*)n";
978
+ function BigInt2(options) {
979
+ return memory_exports.Create({ "~kind": "BigInt" }, { type: "bigint" }, options);
980
+ }
981
+ function IsBigInt2(value) {
982
+ return IsKind(value, "BigInt");
983
+ }
984
+
985
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/boolean.mjs
986
+ function Boolean2(options) {
987
+ return memory_exports.Create({ "~kind": "Boolean" }, { type: "boolean" }, options);
988
+ }
989
+ function IsBoolean3(value) {
990
+ return IsKind(value, "Boolean");
991
+ }
992
+
993
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/identifier.mjs
994
+ function Identifier(name) {
995
+ return memory_exports.Create({ "~kind": "Identifier" }, { name });
996
+ }
997
+ function IsIdentifier(value) {
998
+ return IsKind(value, "Identifier");
999
+ }
1000
+
1001
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/integer.mjs
1002
+ var IntegerPattern = "-?(?:0|[1-9][0-9]*)";
1003
+ function Integer(options) {
1004
+ return memory_exports.Create({ "~kind": "Integer" }, { type: "integer" }, options);
1005
+ }
1006
+ function IsInteger2(value) {
1007
+ return IsKind(value, "Integer");
1008
+ }
1009
+
1010
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/literal.mjs
1011
+ var InvalidLiteralValue = class extends Error {
1012
+ constructor(value) {
1013
+ super(`Invalid Literal value`);
1014
+ Object.defineProperty(this, "cause", {
1015
+ value: { value },
1016
+ writable: false,
1017
+ configurable: false,
1018
+ enumerable: false
1019
+ });
1020
+ }
1021
+ };
1022
+ function LiteralTypeName(value) {
1023
+ return guard_exports.IsBigInt(value) ? "bigint" : guard_exports.IsBoolean(value) ? "boolean" : guard_exports.IsNumber(value) ? "number" : guard_exports.IsString(value) ? "string" : (() => {
1024
+ throw new InvalidLiteralValue(value);
1025
+ })();
1026
+ }
1027
+ function Literal(value, options) {
1028
+ return memory_exports.Create({ "~kind": "Literal" }, { type: LiteralTypeName(value), const: value }, options);
1029
+ }
1030
+ function IsLiteralValue(value) {
1031
+ return guard_exports.IsBigInt(value) || guard_exports.IsBoolean(value) || guard_exports.IsNumber(value) || guard_exports.IsString(value);
1032
+ }
1033
+ function IsLiteralNumber(value) {
1034
+ return IsLiteral(value) && guard_exports.IsNumber(value.const);
1035
+ }
1036
+ function IsLiteralString(value) {
1037
+ return IsLiteral(value) && guard_exports.IsString(value.const);
1038
+ }
1039
+ function IsLiteral(value) {
1040
+ return IsKind(value, "Literal");
1041
+ }
1042
+
1043
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/null.mjs
1044
+ function Null(options) {
1045
+ return memory_exports.Create({ "~kind": "Null" }, { type: "null" }, options);
1046
+ }
1047
+ function IsNull2(value) {
1048
+ return IsKind(value, "Null");
1049
+ }
1050
+
1051
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/number.mjs
1052
+ var NumberPattern = "-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";
1053
+ function Number2(options) {
1054
+ return memory_exports.Create({ "~kind": "Number" }, { type: "number" }, options);
1055
+ }
1056
+ function IsNumber3(value) {
1057
+ return IsKind(value, "Number");
1058
+ }
1059
+
1060
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/symbol.mjs
1061
+ function Symbol(options) {
1062
+ return memory_exports.Create({ "~kind": "Symbol" }, { type: "symbol" }, options);
1063
+ }
1064
+ function IsSymbol2(value) {
1065
+ return IsKind(value, "Symbol");
1066
+ }
1067
+
1068
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/parameter.mjs
1069
+ function Parameter(...args) {
1070
+ const [name, extends_, equals] = arguments_exports.Match(args, {
1071
+ 3: (name2, extends_2, equals2) => [name2, extends_2, equals2],
1072
+ 2: (name2, extends_2) => [name2, extends_2, extends_2],
1073
+ 1: (name2) => [name2, Unknown(), Unknown()]
1074
+ });
1075
+ return memory_exports.Create({ "~kind": "Parameter" }, { name, extends: extends_, equals }, {});
1076
+ }
1077
+ function IsParameter(value) {
1078
+ return IsKind(value, "Parameter");
1079
+ }
1080
+
1081
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/string.mjs
1082
+ var StringPattern = ".*";
1083
+ function String2(options) {
1084
+ return memory_exports.Create({ "~kind": "String" }, { type: "string" }, options);
1085
+ }
1086
+ function IsString3(value) {
1087
+ return IsKind(value, "String");
1088
+ }
1089
+
1090
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/union.mjs
1091
+ function Union(anyOf, options = {}) {
1092
+ return memory_exports.Create({ "~kind": "Union" }, { anyOf }, options);
1093
+ }
1094
+ function IsUnion(value) {
1095
+ return IsKind(value, "Union");
1096
+ }
1097
+ function UnionOptions(type) {
1098
+ return memory_exports.Discard(type, ["~kind", "anyOf"]);
1099
+ }
1100
+
1101
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/patterns/pattern.mjs
1102
+ function ParsePatternIntoTypes(pattern) {
1103
+ const parsed = Pattern(pattern);
1104
+ const result = guard_exports.IsEqual(parsed.length, 2) ? parsed[0] : [];
1105
+ return result;
1106
+ }
1107
+
1108
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs
1109
+ function FromLiteral(_value) {
1110
+ return true;
1111
+ }
1112
+ function FromTypesReduce(types) {
1113
+ return guard_exports.ShiftLeft(types, (left, right) => FromType(left) ? FromTypesReduce(right) : false, () => true);
1114
+ }
1115
+ function FromTypes(types) {
1116
+ const result = guard_exports.IsEqual(types.length, 0) ? false : FromTypesReduce(types);
1117
+ return result;
1118
+ }
1119
+ function FromType(type) {
1120
+ return IsUnion(type) ? FromTypes(type.anyOf) : IsLiteral(type) ? FromLiteral(type.const) : false;
1121
+ }
1122
+ function IsTemplateLiteralFinite(types) {
1123
+ const result = FromTypes(types);
1124
+ return result;
1125
+ }
1126
+
1127
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/template_literal/create.mjs
1128
+ function TemplateLiteralCreate(pattern) {
1129
+ return memory_exports.Create({ ["~kind"]: "TemplateLiteral" }, { type: "string", pattern }, {});
1130
+ }
1131
+
1132
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/template_literal/decode.mjs
1133
+ function FromLiteralPush(variants, value, result = []) {
1134
+ return guard_exports.ShiftLeft(variants, (left, right) => FromLiteralPush(right, value, [...result, `${left}${value}`]), () => result);
1135
+ }
1136
+ function FromLiteral2(variants, value) {
1137
+ return guard_exports.IsEqual(variants.length, 0) ? [`${value}`] : FromLiteralPush(variants, value);
1138
+ }
1139
+ function FromUnion(variants, types, result = []) {
1140
+ return guard_exports.ShiftLeft(types, (left, right) => FromUnion(variants, right, [...result, ...FromType2(variants, left)]), () => result);
1141
+ }
1142
+ function FromType2(variants, type) {
1143
+ const result = IsUnion(type) ? FromUnion(variants, type.anyOf) : IsLiteral(type) ? FromLiteral2(variants, type.const) : Unreachable();
1144
+ return result;
1145
+ }
1146
+ function DecodeFromSpan(variants, types) {
1147
+ return guard_exports.ShiftLeft(types, (left, right) => DecodeFromSpan(FromType2(variants, left), right), () => variants);
1148
+ }
1149
+ function VariantsToLiterals(variants) {
1150
+ return variants.map((variant) => Literal(variant));
1151
+ }
1152
+ function DecodeTypesAsUnion(types) {
1153
+ const variants = DecodeFromSpan([], types);
1154
+ const literals = VariantsToLiterals(variants);
1155
+ const result = Union(literals);
1156
+ return result;
1157
+ }
1158
+ function DecodeTypes(types) {
1159
+ return guard_exports.IsEqual(types.length, 0) ? Unreachable() : (
1160
+ // Literal('') :
1161
+ guard_exports.IsEqual(types.length, 1) && IsLiteral(types[0]) ? types[0] : DecodeTypesAsUnion(types)
1162
+ );
1163
+ }
1164
+ function TemplateLiteralDecodeUnsafe(pattern) {
1165
+ const types = ParsePatternIntoTypes(pattern);
1166
+ const result = guard_exports.IsEqual(types.length, 0) ? String2() : IsTemplateLiteralFinite(types) ? DecodeTypes(types) : TemplateLiteralCreate(pattern);
1167
+ return result;
1168
+ }
1169
+ function TemplateLiteralDecode(pattern) {
1170
+ const decoded = TemplateLiteralDecodeUnsafe(pattern);
1171
+ const result = IsTemplateLiteral(decoded) ? String2() : decoded;
1172
+ return result;
1173
+ }
1174
+
1175
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/record/record_create.mjs
1176
+ function CreateRecord(key, value) {
1177
+ const type = "object";
1178
+ const patternProperties = { [key]: value };
1179
+ return memory_exports.Create({ ["~kind"]: "Record" }, { type, patternProperties });
1180
+ }
1181
+
1182
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/record/from_key_any.mjs
1183
+ function FromAnyKey(value) {
1184
+ return CreateRecord(StringKey, value);
1185
+ }
1186
+
1187
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/record/from_key_boolean.mjs
1188
+ function FromBooleanKey(value) {
1189
+ return _Object_({ true: value, false: value });
1190
+ }
1191
+
1192
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/tuple.mjs
1193
+ function Tuple(types, options = {}) {
1194
+ const [items, minItems, additionalItems] = [types, types.length, false];
1195
+ return memory_exports.Create({ ["~kind"]: "Tuple" }, { type: "array", additionalItems, items, minItems }, options);
1196
+ }
1197
+ function IsTuple(value) {
1198
+ return IsKind(value, "Tuple");
1199
+ }
1200
+ function TupleOptions(type) {
1201
+ return memory_exports.Discard(type, ["~kind", "type", "items", "minItems", "additionalItems"]);
1202
+ }
1203
+
1204
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs
1205
+ function RemoveReadonlyOperation(type) {
1206
+ return memory_exports.Discard(type, ["~readonly"]);
1207
+ }
1208
+ function RemoveReadonlyAction(type, options) {
1209
+ const result = memory_exports.Update(RemoveReadonlyOperation(type), {}, options);
1210
+ return result;
1211
+ }
1212
+ function RemoveReadonlyInstantiate(context, state, type, options) {
1213
+ const instantiatedType = InstantiateType(context, state, type);
1214
+ return RemoveReadonlyAction(instantiatedType, options);
1215
+ }
1216
+
1217
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/_remove_readonly.mjs
1218
+ function RemoveReadonlyDeferred(type, options = {}) {
1219
+ return Deferred("RemoveReadonly", [type], options);
1220
+ }
1221
+ function RemoveReadonly(type, options = {}) {
1222
+ return RemoveReadonlyAction(type, options);
1223
+ }
1224
+
1225
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs
1226
+ function RemoveOptionalOperation(type) {
1227
+ return memory_exports.Discard(type, ["~optional"]);
1228
+ }
1229
+ function RemoveOptionalAction(type, options) {
1230
+ const result = memory_exports.Update(RemoveOptionalOperation(type), {}, options);
1231
+ return result;
1232
+ }
1233
+ function RemoveOptionalInstantiate(context, state, type, options) {
1234
+ const instantiatedType = InstantiateType(context, state, type);
1235
+ return RemoveOptionalAction(instantiatedType, options);
1236
+ }
1237
+
1238
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/_remove_optional.mjs
1239
+ function RemoveOptionalDeferred(type, options = {}) {
1240
+ return Deferred("RemoveOptional", [type], options);
1241
+ }
1242
+ function RemoveOptional(type, options = {}) {
1243
+ return RemoveOptionalAction(type, options);
1244
+ }
1245
+
1246
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/tuple/to_object.mjs
1247
+ function TupleElementsToProperties(types) {
1248
+ const result = types.reduceRight((result2, right, index) => {
1249
+ return { [index]: right, ...result2 };
1250
+ }, {});
1251
+ return result;
1252
+ }
1253
+ function TupleToObject(type) {
1254
+ const properties = TupleElementsToProperties(type.items);
1255
+ const result = _Object_(properties);
1256
+ return result;
1257
+ }
1258
+
1259
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/evaluate/composite.mjs
1260
+ function CanComposite(type) {
1261
+ return IsObject2(type) || IsTuple(type);
1262
+ }
1263
+ function IsReadonlyProperty(left, right) {
1264
+ return IsReadonly(left) ? IsReadonly(right) ? true : false : false;
1265
+ }
1266
+ function IsOptionalProperty(left, right) {
1267
+ return IsOptional(left) ? IsOptional(right) ? true : false : false;
1268
+ }
1269
+ function CompositeProperty(left, right) {
1270
+ const isReadonly = IsReadonlyProperty(left, right);
1271
+ const isOptional = IsOptionalProperty(left, right);
1272
+ const evaluated = EvaluateIntersect([left, right]);
1273
+ const property = RemoveReadonly(RemoveOptional(evaluated));
1274
+ return isReadonly && isOptional ? AddReadonly(AddOptional(property)) : isReadonly && !isOptional ? AddReadonly(property) : !isReadonly && isOptional ? AddOptional(property) : property;
1275
+ }
1276
+ function CompositePropertyKey(left, right, key) {
1277
+ return key in left ? key in right ? CompositeProperty(left[key], right[key]) : left[key] : key in right ? right[key] : Never();
1278
+ }
1279
+ function CompositeProperties(left, right) {
1280
+ const keys = /* @__PURE__ */ new Set([...guard_exports.Keys(left), ...guard_exports.Keys(right)]);
1281
+ const result = [...keys].reduce((result2, key) => {
1282
+ return { ...result2, [key]: CompositePropertyKey(left, right, key) };
1283
+ }, {});
1284
+ return result;
1285
+ }
1286
+ function GetProperties(type) {
1287
+ const result = IsObject2(type) ? type.properties : IsTuple(type) ? TupleElementsToProperties(type.items) : {};
1288
+ return result;
1289
+ }
1290
+ function Composite(left, right) {
1291
+ const leftProperties = GetProperties(left);
1292
+ const rightProperties = GetProperties(right);
1293
+ const properties = CompositeProperties(leftProperties, rightProperties);
1294
+ const result = _Object_(properties);
1295
+ return result;
1296
+ }
1297
+
1298
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/evaluate/narrow.mjs
1299
+ function NarrowCompareRule(left, right) {
1300
+ const result = Compare(left, right);
1301
+ return guard_exports.IsEqual(result, CompareResultLeftInside) ? left : guard_exports.IsEqual(result, CompareResultRightInside) ? right : guard_exports.IsEqual(result, CompareResultEqual) ? right : Never();
1302
+ }
1303
+ function NarrowCompositeRule(left, right) {
1304
+ const canCompositeLeft = CanComposite(left);
1305
+ const canCompositeRight = CanComposite(right);
1306
+ return canCompositeLeft && canCompositeRight ? Composite(left, right) : canCompositeLeft && !canCompositeRight ? left : !canCompositeLeft && canCompositeRight ? right : NarrowCompareRule(left, right);
1307
+ }
1308
+ function Narrow(left, right) {
1309
+ return IsNever(left) ? left : IsAny(left) ? left : IsUnknown(left) ? right : IsNever(right) ? right : IsAny(right) ? right : IsUnknown(right) ? left : NarrowCompositeRule(left, right);
1310
+ }
1311
+
1312
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/evaluate/distribute.mjs
1313
+ function ShouldEvaluate(left, right) {
1314
+ const result = IsUnion(left) || IsUnion(right);
1315
+ return result;
1316
+ }
1317
+ function DistributeOperation(left, right) {
1318
+ const evaluatedLeft = EvaluateType(left);
1319
+ const evaluatedRight = EvaluateType(right);
1320
+ const shouldEvaluate = ShouldEvaluate(evaluatedLeft, evaluatedRight);
1321
+ const result = shouldEvaluate ? EvaluateIntersect([evaluatedLeft, evaluatedRight]) : Narrow(evaluatedLeft, evaluatedRight);
1322
+ return result;
1323
+ }
1324
+ function DistributeType(type, types, result = []) {
1325
+ return guard_exports.ShiftLeft(types, (left, right) => DistributeType(type, right, [...result, DistributeOperation(left, type)]), () => guard_exports.IsEqual(result.length, 0) ? [type] : result);
1326
+ }
1327
+ function DistributeUnion(types, distribution, result = []) {
1328
+ return guard_exports.ShiftLeft(types, (left, right) => DistributeUnion(right, distribution, [...result, ...Distribute([left], distribution)]), () => result);
1329
+ }
1330
+ function Distribute(types, result = []) {
1331
+ return guard_exports.ShiftLeft(types, (left, right) => IsUnion(left) ? Distribute(right, DistributeUnion(left.anyOf, result)) : Distribute(right, DistributeType(left, result)), () => result);
1332
+ }
1333
+
1334
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/exclude/operation.mjs
1335
+ function ExcludeType(left, right) {
1336
+ const check = Extends({}, left, right);
1337
+ const result = result_exports.IsExtendsTrueLike(check) ? [] : [left];
1338
+ return result;
1339
+ }
1340
+ function ExcludeUnion(left, right, result = []) {
1341
+ return guard_exports.ShiftLeft(left, (head, tail) => ExcludeUnion(tail, right, [...result, ...ExcludeType(head, right)]), () => result);
1342
+ }
1343
+ function ExcludeOperation(left, right) {
1344
+ const evaluated = EvaluateType(left);
1345
+ const canonical = IsUnion(evaluated) ? evaluated.anyOf : [evaluated];
1346
+ const remaining = ExcludeUnion(canonical, right);
1347
+ const result = EvaluateUnion(remaining);
1348
+ return result;
1349
+ }
1350
+
1351
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs
1352
+ function EvaluateDependent(if_, then_, else_) {
1353
+ const intersected = EvaluateIntersect([if_, then_]);
1354
+ const excluded = ExcludeOperation(else_, if_);
1355
+ const result = EvaluateUnion([intersected, excluded]);
1356
+ return result;
1357
+ }
1358
+ function EvaluateEnum(values, result = []) {
1359
+ return guard_exports.ShiftLeft(values, (left, right) => EvaluateEnum(right, [...result, Literal(left)]), () => EvaluateUnion(result));
1360
+ }
1361
+ function EvaluateIntersect(types) {
1362
+ const distribution = Distribute(types);
1363
+ const broadend = Broaden(distribution);
1364
+ const result = EvaluateUnion(broadend);
1365
+ return result;
1366
+ }
1367
+ function EvaluateTemplateLiteral(pattern) {
1368
+ const evaluated = TemplateLiteralDecode(pattern);
1369
+ const result = EvaluateType(evaluated);
1370
+ return result;
1371
+ }
1372
+ function EvaluateUnion(types) {
1373
+ const broadend = Broaden(types);
1374
+ const result = EvaluateUnionFast(broadend);
1375
+ return result;
1376
+ }
1377
+ function EvaluateType(type) {
1378
+ const result = IsDependent(type) ? EvaluateDependent(type.if, type.then, type.else) : IsEnum(type) ? EvaluateEnum(type.enum) : IsIntersect(type) ? EvaluateIntersect(type.allOf) : IsTemplateLiteral(type) ? EvaluateTemplateLiteral(type.pattern) : IsUnion(type) ? EvaluateUnion(type.anyOf) : type;
1379
+ return result;
1380
+ }
1381
+ function EvaluateUnionFast(types) {
1382
+ const result = guard_exports.IsEqual(types.length, 1) ? types[0] : guard_exports.IsEqual(types.length, 0) ? Never() : Union(types);
1383
+ return result;
1384
+ }
1385
+
1386
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/record/from_key_enum.mjs
1387
+ function FromEnumKey(values, value) {
1388
+ const unionKey = EvaluateEnum(values);
1389
+ const result = FromKey(unionKey, value);
1390
+ return result;
1391
+ }
1392
+
1393
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/record/from_key_integer.mjs
1394
+ function FromIntegerKey(_key, value) {
1395
+ const result = CreateRecord(IntegerKey, value);
1396
+ return result;
1397
+ }
1398
+
1399
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/record/from_key_intersect.mjs
1400
+ function FromIntersectKey(types, value) {
1401
+ const evaluatedKey = EvaluateIntersect(types);
1402
+ const result = FromKey(evaluatedKey, value);
1403
+ return result;
1404
+ }
1405
+
1406
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/record/from_key_literal.mjs
1407
+ function FromLiteralKey(key, value) {
1408
+ return guard_exports.IsString(key) || guard_exports.IsNumber(key) ? _Object_({ [key]: value }) : guard_exports.IsEqual(key, false) ? _Object_({ false: value }) : guard_exports.IsEqual(key, true) ? _Object_({ true: value }) : _Object_({});
1409
+ }
1410
+
1411
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/record/from_key_number.mjs
1412
+ function FromNumberKey(_key, value) {
1413
+ const result = CreateRecord(NumberKey, value);
1414
+ return result;
1415
+ }
1416
+
1417
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/record/from_key_string.mjs
1418
+ function FromStringKey(key, value) {
1419
+ return guard_exports.HasPropertyKey(key, "pattern") && (guard_exports.IsString(key.pattern) || key.pattern instanceof RegExp) ? CreateRecord(key.pattern.toString(), value) : CreateRecord(StringKey, value);
1420
+ }
1421
+
1422
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs
1423
+ function FromTemplateKey(pattern, value) {
1424
+ const types = ParsePatternIntoTypes(pattern);
1425
+ const finite = IsTemplateLiteralFinite(types);
1426
+ const result = finite ? FromKey(EvaluateTemplateLiteral(pattern), value) : CreateRecord(pattern, value);
1427
+ return result;
1428
+ }
1429
+
1430
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/evaluate/flatten.mjs
1431
+ function FlattenType(type) {
1432
+ const result = IsUnion(type) ? Flatten(type.anyOf) : [type];
1433
+ return result;
1434
+ }
1435
+ function Flatten(types, result = []) {
1436
+ return guard_exports.ShiftLeft(types, (left, right) => Flatten(right, [...result, ...FlattenType(left)]), () => result);
1437
+ }
1438
+
1439
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/record/from_key_union.mjs
1440
+ function StringOrNumberCheck(types) {
1441
+ return types.some((type) => IsString3(type) || IsNumber3(type) || IsInteger2(type));
1442
+ }
1443
+ function TryBuildRecord(types, value) {
1444
+ return guard_exports.IsEqual(StringOrNumberCheck(types), true) ? CreateRecord(StringKey, value) : void 0;
1445
+ }
1446
+ function CreateProperties(types, value) {
1447
+ return types.reduce((result, left) => {
1448
+ return IsLiteral(left) && (guard_exports.IsString(left.const) || guard_exports.IsNumber(left.const)) ? { ...result, [left.const]: value } : result;
1449
+ }, {});
1450
+ }
1451
+ function CreateObject(types, value) {
1452
+ const properties = CreateProperties(types, value);
1453
+ const result = _Object_(properties);
1454
+ return result;
1455
+ }
1456
+ function FromUnionKey(types, value) {
1457
+ const flattened = Flatten(types);
1458
+ const record = TryBuildRecord(flattened, value);
1459
+ return IsSchema(record) ? record : CreateObject(flattened, value);
1460
+ }
1461
+
1462
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/record/from_key.mjs
1463
+ function FromKey(key, value) {
1464
+ const result = IsAny(key) ? FromAnyKey(value) : IsBoolean3(key) ? FromBooleanKey(value) : IsEnum(key) ? FromEnumKey(key.enum, value) : IsInteger2(key) ? FromIntegerKey(key, value) : IsIntersect(key) ? FromIntersectKey(key.allOf, value) : IsLiteral(key) ? FromLiteralKey(key.const, value) : IsNumber3(key) ? FromNumberKey(key, value) : IsUnion(key) ? FromUnionKey(key.anyOf, value) : IsString3(key) ? FromStringKey(key, value) : IsTemplateLiteral(key) ? FromTemplateKey(key.pattern, value) : _Object_({});
1465
+ return result;
1466
+ }
1467
+
1468
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/record/instantiate.mjs
1469
+ function RecordAction(key, value, options) {
1470
+ const result = CanInstantiate([key]) ? memory_exports.Update(FromKey(key, value), {}, options) : RecordDeferred(key, value, options);
1471
+ return result;
1472
+ }
1473
+ function RecordInstantiate(context, state, key, value, options) {
1474
+ const instantiatedKey = InstantiateType(context, state, key);
1475
+ const instantiatedValue = InstantiateType(context, state, value);
1476
+ return RecordAction(instantiatedKey, instantiatedValue, options);
1477
+ }
1478
+
1479
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/record.mjs
1480
+ var IntegerKey = `^${IntegerPattern}$`;
1481
+ var NumberKey = `^${NumberPattern}$`;
1482
+ var StringKey = `^${StringPattern}$`;
1483
+ function RecordDeferred(key, value, options = {}) {
1484
+ return Deferred("Record", [key, value], options);
1485
+ }
1486
+ function Record(key, value, options = {}) {
1487
+ return RecordAction(key, value, options);
1488
+ }
1489
+ function RecordFromPattern(pattern, value) {
1490
+ return CreateRecord(pattern, value);
1491
+ }
1492
+ function RecordPatternToType(pattern) {
1493
+ const result = guard_exports.IsEqual(pattern, StringKey) ? String2() : guard_exports.IsEqual(pattern, IntegerKey) ? Integer() : guard_exports.IsEqual(pattern, NumberKey) ? Number2() : TemplateLiteralDecodeUnsafe(pattern);
1494
+ return result;
1495
+ }
1496
+ function RecordPattern(type) {
1497
+ return guard_exports.Keys(type.patternProperties)[0];
1498
+ }
1499
+ function RecordKey(type) {
1500
+ const pattern = RecordPattern(type);
1501
+ const result = RecordPatternToType(pattern);
1502
+ return result;
1503
+ }
1504
+ function RecordValue(type) {
1505
+ return type.patternProperties[RecordPattern(type)];
1506
+ }
1507
+ function IsRecord(value) {
1508
+ return IsKind(value, "Record");
1509
+ }
1510
+
1511
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/rest.mjs
1512
+ function Rest(type) {
1513
+ return memory_exports.Create({ "~kind": "Rest" }, { type: "rest", items: type }, {});
1514
+ }
1515
+ function IsRest(value) {
1516
+ return IsKind(value, "Rest");
1517
+ }
1518
+
1519
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/this.mjs
1520
+ function This(options) {
1521
+ return memory_exports.Create({ ["~kind"]: "This" }, { $ref: "#" }, options);
1522
+ }
1523
+ function IsThis(value) {
1524
+ return IsKind(value, "This");
1525
+ }
1526
+
1527
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/undefined.mjs
1528
+ function Undefined(options) {
1529
+ return memory_exports.Create({ "~kind": "Undefined" }, { type: "undefined" }, options);
1530
+ }
1531
+ function IsUndefined2(value) {
1532
+ return IsKind(value, "Undefined");
1533
+ }
1534
+
1535
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/void.mjs
1536
+ function Void(options) {
1537
+ return memory_exports.Create({ "~kind": "Void" }, { type: "void" }, options);
1538
+ }
1539
+ function IsVoid(value) {
1540
+ return IsKind(value, "Void");
1541
+ }
1542
+
1543
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/mapping.mjs
1544
+ function IntrinsicOrCall(ref, parameters2) {
1545
+ return guard_exports.IsEqual(ref, "Array") ? _Array_(parameters2[0]) : guard_exports.IsEqual(ref, "Capitalize") ? CapitalizeDeferred(parameters2[0]) : guard_exports.IsEqual(ref, "ConstructorParameters") ? ConstructorParametersDeferred(parameters2[0]) : guard_exports.IsEqual(ref, "Evaluate") ? EvaluateDeferred(parameters2[0]) : guard_exports.IsEqual(ref, "Exclude") ? ExcludeDeferred(parameters2[0], parameters2[1]) : guard_exports.IsEqual(ref, "Extract") ? ExtractDeferred(parameters2[0], parameters2[1]) : guard_exports.IsEqual(ref, "Index") ? IndexDeferred(parameters2[0], parameters2[1]) : guard_exports.IsEqual(ref, "InstanceType") ? InstanceTypeDeferred(parameters2[0]) : guard_exports.IsEqual(ref, "Lowercase") ? LowercaseDeferred(parameters2[0]) : guard_exports.IsEqual(ref, "NonNullable") ? NonNullableDeferred(parameters2[0]) : guard_exports.IsEqual(ref, "Omit") ? OmitDeferred(parameters2[0], parameters2[1]) : guard_exports.IsEqual(ref, "Parameters") ? ParametersDeferred(parameters2[0]) : guard_exports.IsEqual(ref, "Partial") ? PartialDeferred(parameters2[0]) : guard_exports.IsEqual(ref, "Pick") ? PickDeferred(parameters2[0], parameters2[1]) : guard_exports.IsEqual(ref, "Readonly") ? ReadonlyObjectDeferred(parameters2[0]) : guard_exports.IsEqual(ref, "KeyOf") ? KeyOfDeferred(parameters2[0]) : guard_exports.IsEqual(ref, "Record") ? RecordDeferred(parameters2[0], parameters2[1]) : guard_exports.IsEqual(ref, "Required") ? RequiredDeferred(parameters2[0]) : guard_exports.IsEqual(ref, "ReturnType") ? ReturnTypeDeferred(parameters2[0]) : guard_exports.IsEqual(ref, "Uncapitalize") ? UncapitalizeDeferred(parameters2[0]) : guard_exports.IsEqual(ref, "Uppercase") ? UppercaseDeferred(parameters2[0]) : CallConstruct(Ref(ref), parameters2);
1546
+ }
1547
+ function Unreachable2() {
1548
+ throw Error("Unreachable");
1549
+ }
1550
+ function DelimitedDecode(input, result = []) {
1551
+ return guard_exports.ShiftLeft(input, (left, right) => DelimitedDecode(right, [...result, left[1]]), () => result);
1552
+ }
1553
+ function Delimited(input) {
1554
+ return guard_exports.IsEqual(input.length, 3) ? [input[0], ...DelimitedDecode(input[1])] : [];
1555
+ }
1556
+ function GenericParameterExtendsEqualsMapping(input) {
1557
+ return Parameter(input[0], input[2], input[4]);
1558
+ }
1559
+ function GenericParameterExtendsMapping(input) {
1560
+ return Parameter(input[0], input[2], input[2]);
1561
+ }
1562
+ function GenericParameterEqualsMapping(input) {
1563
+ return Parameter(input[0], Unknown(), input[2]);
1564
+ }
1565
+ function GenericParameterIdentifierMapping(input) {
1566
+ return Parameter(input, Unknown(), Unknown());
1567
+ }
1568
+ function GenericParameterMapping(input) {
1569
+ return input;
1570
+ }
1571
+ function GenericParameterListMapping(input) {
1572
+ return Delimited(input);
1573
+ }
1574
+ function GenericParametersMapping(input) {
1575
+ return input[1];
1576
+ }
1577
+ function GenericCallArgumentListMapping(input) {
1578
+ return Delimited(input);
1579
+ }
1580
+ function GenericCallArgumentsMapping(input) {
1581
+ return input[1];
1582
+ }
1583
+ function GenericCallMapping(input) {
1584
+ return IntrinsicOrCall(input[0], input[1]);
1585
+ }
1586
+ function OptionalSemiColonMapping(input) {
1587
+ return null;
1588
+ }
1589
+ function KeywordStringMapping(input) {
1590
+ return String2();
1591
+ }
1592
+ function KeywordNumberMapping(input) {
1593
+ return Number2();
1594
+ }
1595
+ function KeywordBooleanMapping(input) {
1596
+ return Boolean2();
1597
+ }
1598
+ function KeywordUndefinedMapping(input) {
1599
+ return Undefined();
1600
+ }
1601
+ function KeywordNullMapping(input) {
1602
+ return Null();
1603
+ }
1604
+ function KeywordIntegerMapping(input) {
1605
+ return Integer();
1606
+ }
1607
+ function KeywordBigIntMapping(input) {
1608
+ return BigInt2();
1609
+ }
1610
+ function KeywordUnknownMapping(input) {
1611
+ return Unknown();
1612
+ }
1613
+ function KeywordAnyMapping(input) {
1614
+ return Any();
1615
+ }
1616
+ function KeywordObjectMapping(input) {
1617
+ return _Object_({});
1618
+ }
1619
+ function KeywordNeverMapping(input) {
1620
+ return Never();
1621
+ }
1622
+ function KeywordSymbolMapping(input) {
1623
+ return Symbol();
1624
+ }
1625
+ function KeywordVoidMapping(input) {
1626
+ return Void();
1627
+ }
1628
+ function KeywordThisMapping(input) {
1629
+ return This();
1630
+ }
1631
+ function LiteralBigIntMapping(input) {
1632
+ return Literal(BigInt(input));
1633
+ }
1634
+ function LiteralBooleanMapping(input) {
1635
+ return Literal(guard_exports.IsEqual(input, "true"));
1636
+ }
1637
+ function LiteralNumberMapping(input) {
1638
+ return Literal(parseFloat(input));
1639
+ }
1640
+ function LiteralStringMapping(input) {
1641
+ return Literal(input);
1642
+ }
1643
+ function TemplateInterpolateMapping(input) {
1644
+ return input[1];
1645
+ }
1646
+ function TemplateSpanMapping(input) {
1647
+ return Literal(input);
1648
+ }
1649
+ function TemplateBodyMapping(input) {
1650
+ return guard_exports.IsEqual(input.length, 3) ? [input[0], input[1], ...input[2]] : [input[0]];
1651
+ }
1652
+ function TemplateLiteralTypesMapping(input) {
1653
+ return input[1];
1654
+ }
1655
+ function TemplateLiteralMapping(input) {
1656
+ return TemplateLiteralDeferred(input);
1657
+ }
1658
+ function DependentMapping(input) {
1659
+ return guard_exports.IsEqual(input.length, 6) ? Dependent(input[1], input[3], input[5]) : Dependent(input[1], input[3], Unknown());
1660
+ }
1661
+ function KeyOfMapping(input) {
1662
+ return input.length > 0;
1663
+ }
1664
+ function IndexArrayMapping(input) {
1665
+ return input.reduce((result, current) => {
1666
+ return guard_exports.IsEqual(current.length, 3) ? [...result, [current[1]]] : [...result, []];
1667
+ }, []);
1668
+ }
1669
+ function ExtendsMapping(input) {
1670
+ return guard_exports.IsEqual(input.length, 6) ? [input[1], input[3], input[5]] : [];
1671
+ }
1672
+ function BaseMapping(input) {
1673
+ return guard_exports.IsArray(input) && guard_exports.IsEqual(input.length, 3) ? input[1] : input;
1674
+ }
1675
+ function WithMapping(input) {
1676
+ return guard_exports.IsEqual(input.length, 2) ? input[1] : [];
1677
+ }
1678
+ function FactorIndexArray(Type2, indexArray) {
1679
+ return indexArray.reduce((result, left) => {
1680
+ const _left = left;
1681
+ return guard_exports.IsEqual(_left.length, 1) ? IndexDeferred(result, _left[0]) : guard_exports.IsEqual(_left.length, 0) ? _Array_(result) : Unreachable2();
1682
+ }, Type2);
1683
+ }
1684
+ function FactorExtends(type, extend) {
1685
+ return guard_exports.IsEqual(extend.length, 3) ? ConditionalDeferred(type, extend[0], extend[1], extend[2]) : type;
1686
+ }
1687
+ function FactorWith(type, withClause) {
1688
+ return guard_exports.IsArray(withClause) && guard_exports.IsEqual(withClause.length, 0) ? type : WithDeferred(type, withClause);
1689
+ }
1690
+ function FactorMapping(input) {
1691
+ const [keyOf, type, indexArray, extend, withClause] = input;
1692
+ return FactorWith(keyOf ? FactorExtends(KeyOfDeferred(FactorIndexArray(type, indexArray)), extend) : FactorExtends(FactorIndexArray(type, indexArray), extend), withClause);
1693
+ }
1694
+ function ExprBinaryMapping(left, rest) {
1695
+ return guard_exports.IsEqual(rest.length, 3) ? (() => {
1696
+ const [operator, right, next] = rest;
1697
+ const Schema = ExprBinaryMapping(right, next);
1698
+ if (guard_exports.IsEqual(operator, "&")) {
1699
+ return IsIntersect(Schema) ? Intersect([left, ...Schema.allOf]) : Intersect([left, Schema]);
1700
+ }
1701
+ if (guard_exports.IsEqual(operator, "|")) {
1702
+ return IsUnion(Schema) ? Union([left, ...Schema.anyOf]) : Union([left, Schema]);
1703
+ }
1704
+ Unreachable2();
1705
+ })() : left;
1706
+ }
1707
+ function ExprTermTailMapping(input) {
1708
+ return input;
1709
+ }
1710
+ function ExprTermMapping(input) {
1711
+ const [left, rest] = input;
1712
+ return ExprBinaryMapping(left, rest);
1713
+ }
1714
+ function ExprTailMapping(input) {
1715
+ return input;
1716
+ }
1717
+ function ExprMapping(input) {
1718
+ const [left, rest] = input;
1719
+ return ExprBinaryMapping(left, rest);
1720
+ }
1721
+ function ExprReadonlyMapping(input) {
1722
+ return AddImmutableDeferred(input[1]);
1723
+ }
1724
+ function ExprPipeMapping(input) {
1725
+ return input[1];
1726
+ }
1727
+ function GenericTypeMapping(input) {
1728
+ return Generic(input[0], input[2]);
1729
+ }
1730
+ function InferTypeMapping(input) {
1731
+ return guard_exports.IsEqual(input.length, 4) ? Infer(input[1], input[3]) : guard_exports.IsEqual(input.length, 2) ? Infer(input[1], Unknown()) : Unreachable2();
1732
+ }
1733
+ function TypeMapping(input) {
1734
+ return input;
1735
+ }
1736
+ function PropertyKeyNumberMapping(input) {
1737
+ return `${input}`;
1738
+ }
1739
+ function PropertyKeyIdentMapping(input) {
1740
+ return input;
1741
+ }
1742
+ function PropertyKeyQuotedMapping(input) {
1743
+ return input;
1744
+ }
1745
+ function PropertyKeyIndexMapping(input) {
1746
+ return IsInteger2(input[3]) ? IntegerKey : IsNumber3(input[3]) ? NumberKey : IsSymbol2(input[3]) ? StringKey : IsString3(input[3]) ? StringKey : Unreachable2();
1747
+ }
1748
+ function PropertyKeyMapping(input) {
1749
+ return input;
1750
+ }
1751
+ function ReadonlyMapping(input) {
1752
+ return input.length > 0;
1753
+ }
1754
+ function OptionalMapping(input) {
1755
+ return input.length > 0;
1756
+ }
1757
+ function PropertyMapping(input) {
1758
+ const [isReadonly, key, isOptional, _colon, type] = input;
1759
+ return {
1760
+ [key]: isReadonly && isOptional ? AddReadonlyDeferred(AddOptionalDeferred(type)) : isReadonly && !isOptional ? AddReadonlyDeferred(type) : !isReadonly && isOptional ? AddOptionalDeferred(type) : type
1761
+ };
1762
+ }
1763
+ function PropertyDelimiterMapping(input) {
1764
+ return input;
1765
+ }
1766
+ function PropertyListMapping(input) {
1767
+ return Delimited(input);
1768
+ }
1769
+ function PropertiesReduce(propertyList) {
1770
+ return propertyList.reduce((result, left) => {
1771
+ const isPatternProperties = guard_exports.HasPropertyKey(left, IntegerKey) || guard_exports.HasPropertyKey(left, NumberKey) || guard_exports.HasPropertyKey(left, StringKey);
1772
+ return isPatternProperties ? [result[0], memory_exports.Assign(result[1], left)] : [memory_exports.Assign(result[0], left), result[1]];
1773
+ }, [{}, {}]);
1774
+ }
1775
+ function PropertiesMapping(input) {
1776
+ return PropertiesReduce(input[1]);
1777
+ }
1778
+ function _Object_Mapping(input) {
1779
+ const [properties, patternProperties] = input;
1780
+ const options = guard_exports.IsEqual(guard_exports.Keys(patternProperties).length, 0) ? {} : { patternProperties };
1781
+ return _Object_(properties, options);
1782
+ }
1783
+ function ElementNamedMapping(input) {
1784
+ return guard_exports.IsEqual(input.length, 5) ? AddReadonlyDeferred(AddOptionalDeferred(input[4])) : guard_exports.IsEqual(input.length, 3) ? input[2] : guard_exports.IsEqual(input.length, 4) ? guard_exports.IsEqual(input[2], "readonly") ? AddReadonlyDeferred(input[3]) : AddOptionalDeferred(input[3]) : Unreachable2();
1785
+ }
1786
+ function ElementBaseMapping(input) {
1787
+ if (!guard_exports.IsArray(input) || !guard_exports.IsEqual(input.length, 3))
1788
+ return input;
1789
+ const [isReadonly, type, isOptional] = input;
1790
+ return isReadonly && isOptional ? AddReadonlyDeferred(AddOptionalDeferred(type)) : isReadonly && !isOptional ? AddReadonlyDeferred(type) : !isReadonly && isOptional ? AddOptionalDeferred(type) : type;
1791
+ }
1792
+ function ElementMapping(input) {
1793
+ return guard_exports.IsEqual(input.length, 2) ? Rest(input[1]) : guard_exports.IsEqual(input.length, 1) ? input[0] : Unreachable2();
1794
+ }
1795
+ function ElementListMapping(input) {
1796
+ return Delimited(input);
1797
+ }
1798
+ function _Tuple_Mapping(input) {
1799
+ return Tuple(input[1]);
1800
+ }
1801
+ function ParameterReadonlyOptionalMapping(input) {
1802
+ return AddReadonlyDeferred(AddOptionalDeferred(input[4]));
1803
+ }
1804
+ function ParameterReadonlyMapping(input) {
1805
+ return AddReadonlyDeferred(input[3]);
1806
+ }
1807
+ function ParameterOptionalMapping(input) {
1808
+ return AddOptionalDeferred(input[3]);
1809
+ }
1810
+ function ParameterTypeMapping(input) {
1811
+ return input[2];
1812
+ }
1813
+ function ParameterBaseMapping(input) {
1814
+ return input;
1815
+ }
1816
+ function ParameterMapping(input) {
1817
+ return guard_exports.IsEqual(input.length, 2) ? Rest(input[1]) : guard_exports.IsEqual(input.length, 1) ? input[0] : Unreachable2();
1818
+ }
1819
+ function ParameterListMapping(input) {
1820
+ return Delimited(input);
1821
+ }
1822
+ function _Function_Mapping(input) {
1823
+ return _Function_(input[1], input[4]);
1824
+ }
1825
+ function _Constructor_Mapping(input) {
1826
+ return Constructor(input[2], input[5]);
1827
+ }
1828
+ function ApplyReadonly(state, type) {
1829
+ return guard_exports.IsEqual(state, "remove") ? RemoveReadonlyDeferred(type) : guard_exports.IsEqual(state, "add") ? AddReadonlyDeferred(type) : type;
1830
+ }
1831
+ function MappedReadonlyMapping(input) {
1832
+ return guard_exports.IsEqual(input.length, 2) && guard_exports.IsEqual(input[0], "-") ? "remove" : guard_exports.IsEqual(input.length, 2) && guard_exports.IsEqual(input[0], "+") ? "add" : guard_exports.IsEqual(input.length, 1) ? "add" : "none";
1833
+ }
1834
+ function ApplyOptional(state, type) {
1835
+ return guard_exports.IsEqual(state, "remove") ? RemoveOptionalDeferred(type) : guard_exports.IsEqual(state, "add") ? AddOptionalDeferred(type) : type;
1836
+ }
1837
+ function MappedOptionalMapping(input) {
1838
+ return guard_exports.IsEqual(input.length, 2) && guard_exports.IsEqual(input[0], "-") ? "remove" : guard_exports.IsEqual(input.length, 2) && guard_exports.IsEqual(input[0], "+") ? "add" : guard_exports.IsEqual(input.length, 1) ? "add" : "none";
1839
+ }
1840
+ function MappedAsMapping(input) {
1841
+ return guard_exports.IsEqual(input.length, 2) ? [input[1]] : [];
1842
+ }
1843
+ function _Mapped_Mapping(input) {
1844
+ return guard_exports.IsArray(input[6]) && guard_exports.IsEqual(input[6].length, 1) ? MappedDeferred(Identifier(input[3]), input[5], input[6][0], ApplyReadonly(input[1], ApplyOptional(input[8], input[10]))) : MappedDeferred(Identifier(input[3]), input[5], Ref(input[3]), ApplyReadonly(input[1], ApplyOptional(input[8], input[10])));
1845
+ }
1846
+ function ReferenceMapping(input) {
1847
+ return Ref(input);
1848
+ }
1849
+ function WithBigIntMapping(input) {
1850
+ return BigInt(input);
1851
+ }
1852
+ function WithNumberMapping(input) {
1853
+ return parseFloat(input);
1854
+ }
1855
+ function WithBooleanMapping(input) {
1856
+ return guard_exports.IsEqual(input, "true");
1857
+ }
1858
+ function WithStringMapping(input) {
1859
+ return input;
1860
+ }
1861
+ function WithNullMapping(input) {
1862
+ return null;
1863
+ }
1864
+ function WithUndefinedMapping(input) {
1865
+ return void 0;
1866
+ }
1867
+ function WithPropertyMapping(input) {
1868
+ return { [input[0]]: input[2] };
1869
+ }
1870
+ function WithPropertyListMapping(input) {
1871
+ return Delimited(input);
1872
+ }
1873
+ function WithObjectMappingReduce(propertyList) {
1874
+ return propertyList.reduce((result, left) => {
1875
+ return memory_exports.Assign(result, left);
1876
+ }, {});
1877
+ }
1878
+ function WithObjectMapping(input) {
1879
+ return WithObjectMappingReduce(input[1]);
1880
+ }
1881
+ function WithElementListMapping(input) {
1882
+ return Delimited(input);
1883
+ }
1884
+ function WithArrayMapping(input) {
1885
+ return input[1];
1886
+ }
1887
+ function WithValueMapping(input) {
1888
+ return input;
1889
+ }
1890
+ function PatternBigIntMapping(input) {
1891
+ return BigInt2();
1892
+ }
1893
+ function PatternStringMapping(input) {
1894
+ return String2();
1895
+ }
1896
+ function PatternNumberMapping(input) {
1897
+ return Number2();
1898
+ }
1899
+ function PatternIntegerMapping(input) {
1900
+ return Integer();
1901
+ }
1902
+ function PatternNeverMapping(input) {
1903
+ return Never();
1904
+ }
1905
+ function PatternTextMapping(input) {
1906
+ return Literal(input);
1907
+ }
1908
+ function PatternBaseMapping(input) {
1909
+ return input;
1910
+ }
1911
+ function PatternGroupMapping(input) {
1912
+ return Union(input[1]);
1913
+ }
1914
+ function PatternUnionMapping(input) {
1915
+ return input.length === 3 ? [...input[0], ...input[2]] : input.length === 1 ? [...input[0]] : [];
1916
+ }
1917
+ function PatternTermMapping(input) {
1918
+ return [input[0], ...input[1]];
1919
+ }
1920
+ function PatternBodyMapping(input) {
1921
+ return input;
1922
+ }
1923
+ function PatternMapping(input) {
1924
+ return input[1];
1925
+ }
1926
+ function InterfaceDeclarationHeritageListMapping(input) {
1927
+ return Delimited(input);
1928
+ }
1929
+ function InterfaceDeclarationHeritageMapping(input) {
1930
+ return guard_exports.IsEqual(input.length, 2) ? input[1] : [];
1931
+ }
1932
+ function InterfaceDeclarationGenericMapping(input) {
1933
+ const parameters2 = input[2];
1934
+ const heritage = input[3];
1935
+ const [properties, patternProperties] = input[4];
1936
+ const options = guard_exports.IsEqual(guard_exports.Keys(patternProperties).length, 0) ? {} : { patternProperties };
1937
+ return { [input[1]]: Generic(parameters2, InterfaceDeferred(heritage, properties, options)) };
1938
+ }
1939
+ function InterfaceDeclarationMapping(input) {
1940
+ const heritage = input[2];
1941
+ const [properties, patternProperties] = input[3];
1942
+ const options = guard_exports.IsEqual(guard_exports.Keys(patternProperties).length, 0) ? {} : { patternProperties };
1943
+ return { [input[1]]: InterfaceDeferred(heritage, properties, options) };
1944
+ }
1945
+ function TypeAliasDeclarationGenericMapping(input) {
1946
+ return { [input[1]]: Generic(input[2], input[4]) };
1947
+ }
1948
+ function TypeAliasDeclarationMapping(input) {
1949
+ return { [input[1]]: input[3] };
1950
+ }
1951
+ function ExportKeywordMapping(input) {
1952
+ return null;
1953
+ }
1954
+ function ModuleDeclarationDelimiterMapping(input) {
1955
+ return input;
1956
+ }
1957
+ function ModuleDeclarationListMapping(input) {
1958
+ return Delimited(input);
1959
+ }
1960
+ function ModuleDeclarationMapping(input) {
1961
+ return input[1];
1962
+ }
1963
+ function ModuleMapping(input) {
1964
+ const [moduleDeclaration, moduleDeclarationList] = [input[0], input[1]];
1965
+ return ModuleDeferred(memory_exports.Assign(moduleDeclaration, PropertiesReduce(moduleDeclarationList)[0]));
1966
+ }
1967
+ function ScriptMapping(input) {
1968
+ return input;
1969
+ }
1970
+
1971
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/internal/match.mjs
1972
+ function IsMatch(value) {
1973
+ return IsEqual(value.length, 2);
1974
+ }
1975
+ function Match2(input, ok, fail) {
1976
+ return IsMatch(input) ? ok(input[0], input[1]) : fail();
1977
+ }
1978
+
1979
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/internal/take.mjs
1980
+ function TakeVariant(variant, input) {
1981
+ return IsEqual(input.indexOf(variant), 0) ? [variant, input.slice(variant.length)] : [];
1982
+ }
1983
+ function Take(variants, input) {
1984
+ for (let i = 0; i < variants.length; i++) {
1985
+ const result = TakeVariant(variants[i], input);
1986
+ if (IsMatch(result))
1987
+ return result;
1988
+ }
1989
+ return [];
1990
+ }
1991
+
1992
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/internal/char.mjs
1993
+ function Range(start, end) {
1994
+ return Array.from({ length: end - start + 1 }, (_, i) => String.fromCharCode(start + i));
1995
+ }
1996
+ var Alpha = [
1997
+ ...Range(97, 122),
1998
+ // Lowercase
1999
+ ...Range(65, 90)
2000
+ // Uppercase
2001
+ ];
2002
+ var Zero = "0";
2003
+ var NonZero = Range(49, 57);
2004
+ var Digit = [Zero, ...NonZero];
2005
+ var WhiteSpace = " ";
2006
+ var NewLine = "\n";
2007
+ var UnderScore = "_";
2008
+ var Dot = ".";
2009
+ var DollarSign = "$";
2010
+ var Hyphen = "-";
2011
+
2012
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/internal/trim.mjs
2013
+ var LineComment = "//";
2014
+ var OpenComment = "/*";
2015
+ var CloseComment = "*/";
2016
+ function DiscardMultilineComment(input) {
2017
+ const index = input.indexOf(CloseComment);
2018
+ const result = IsEqual(index, -1) ? "" : input.slice(index + 2);
2019
+ return result;
2020
+ }
2021
+ function DiscardLineComment(input) {
2022
+ const index = input.indexOf(NewLine);
2023
+ const result = IsEqual(index, -1) ? "" : input.slice(index);
2024
+ return result;
2025
+ }
2026
+ function TrimStartUntilNewline(input) {
2027
+ return input.replace(/^[ \t\r\f\v]+/, "");
2028
+ }
2029
+ function TrimWhitespace(input) {
2030
+ const trimmed = TrimStartUntilNewline(input);
2031
+ return trimmed.startsWith(OpenComment) ? TrimWhitespace(DiscardMultilineComment(trimmed.slice(2))) : trimmed.startsWith(LineComment) ? TrimWhitespace(DiscardLineComment(trimmed.slice(2))) : trimmed;
2032
+ }
2033
+ function Trim(input) {
2034
+ const trimmed = input.trimStart();
2035
+ return trimmed.startsWith(OpenComment) ? Trim(DiscardMultilineComment(trimmed.slice(2))) : trimmed.startsWith(LineComment) ? Trim(DiscardLineComment(trimmed.slice(2))) : trimmed;
2036
+ }
2037
+
2038
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/internal/optional.mjs
2039
+ function Optional2(value, input) {
2040
+ return Match2(Take([value], input), (Optional4, Rest2) => [Optional4, Rest2], () => ["", input]);
2041
+ }
2042
+
2043
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/internal/many.mjs
2044
+ function IsDiscard(discard, input) {
2045
+ return discard.includes(input);
2046
+ }
2047
+ function Many(allowed, discard, input, result = "") {
2048
+ return Match2(Take(allowed, input), (Char, Rest2) => IsDiscard(discard, Char) ? Many(allowed, discard, Rest2, result) : Many(allowed, discard, Rest2, `${result}${Char}`), () => [result, input]);
2049
+ }
2050
+
2051
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/unsigned_integer.mjs
2052
+ function TakeNonZero(input) {
2053
+ return Take(NonZero, input);
2054
+ }
2055
+ var AllowedDigits = [...Digit, UnderScore];
2056
+ function TakeDigits(input) {
2057
+ return Many(AllowedDigits, [UnderScore], input);
2058
+ }
2059
+ function TakeUnsignedInteger(input) {
2060
+ return Match2(Take([Zero], input), (Zero2, ZeroRest) => [Zero2, ZeroRest], () => Match2(
2061
+ TakeNonZero(input),
2062
+ (NonZero2, NonZeroRest) => Match2(TakeDigits(NonZeroRest), (Digits, DigitsRest) => [`${NonZero2}${Digits}`, DigitsRest], () => []),
2063
+ // fail: did not match Digits
2064
+ () => []
2065
+ ));
2066
+ }
2067
+ function UnsignedInteger(input) {
2068
+ return TakeUnsignedInteger(Trim(input));
2069
+ }
2070
+
2071
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/integer.mjs
2072
+ function TakeSign(input) {
2073
+ return Optional2(Hyphen, input);
2074
+ }
2075
+ function TakeSignedInteger(input) {
2076
+ return Match2(
2077
+ TakeSign(input),
2078
+ (Sign, SignRest) => Match2(UnsignedInteger(SignRest), (UnsignedInteger2, UnsignedIntegerRest) => [`${Sign}${UnsignedInteger2}`, UnsignedIntegerRest], () => []),
2079
+ // fail: did not match unsigned integer
2080
+ () => []
2081
+ );
2082
+ }
2083
+ function Integer2(input) {
2084
+ return TakeSignedInteger(Trim(input));
2085
+ }
2086
+
2087
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/bigint.mjs
2088
+ function TakeBigInt(input) {
2089
+ return Match2(
2090
+ Integer2(input),
2091
+ (Integer3, IntegerRest) => Match2(Take(["n"], IntegerRest), (_N, NRest) => [`${Integer3}`, NRest], () => []),
2092
+ // fail: did not match 'n'
2093
+ () => []
2094
+ );
2095
+ }
2096
+ function BigInt3(input) {
2097
+ return TakeBigInt(input);
2098
+ }
2099
+
2100
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/const.mjs
2101
+ function TakeConst(const_, input) {
2102
+ return Take([const_], input);
2103
+ }
2104
+ function Const(const_, input) {
2105
+ return IsEqual(const_, "") ? ["", input] : const_.startsWith(NewLine) ? TakeConst(const_, TrimWhitespace(input)) : const_.startsWith(WhiteSpace) ? TakeConst(const_, input) : TakeConst(const_, Trim(input));
2106
+ }
2107
+
2108
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/ident.mjs
2109
+ var Initial = [...Alpha, UnderScore, DollarSign];
2110
+ function TakeInitial(input) {
2111
+ return Take(Initial, input);
2112
+ }
2113
+ var Remaining = [...Initial, ...Digit];
2114
+ function TakeRemaining(input, result = "") {
2115
+ return Match2(Take(Remaining, input), (Remaining2, RemainingRest) => TakeRemaining(RemainingRest, `${result}${Remaining2}`), () => [result, input]);
2116
+ }
2117
+ function TakeIdent(input) {
2118
+ return Match2(
2119
+ TakeInitial(input),
2120
+ (Initial2, InitialRest) => Match2(TakeRemaining(InitialRest), (Remaining2, RemainingRest) => [`${Initial2}${Remaining2}`, RemainingRest], () => []),
2121
+ // fail: did not match Remaining
2122
+ () => []
2123
+ );
2124
+ }
2125
+ function Ident(input) {
2126
+ return TakeIdent(Trim(input));
2127
+ }
2128
+
2129
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/unsigned_number.mjs
2130
+ var AllowedDigits2 = [...Digit, UnderScore];
2131
+ function IsLeadingDot(input) {
2132
+ return IsMatch(Take([Dot], input));
2133
+ }
2134
+ function TakeFractional(input) {
2135
+ return Match2(Many(AllowedDigits2, [UnderScore], input), (Digits, DigitsRest) => IsEqual(Digits, "") ? [] : [Digits, DigitsRest], () => []);
2136
+ }
2137
+ function LeadingDot(input) {
2138
+ return Match2(
2139
+ Take([Dot], input),
2140
+ (Dot2, DotRest) => Match2(TakeFractional(DotRest), (Fractional, FractionalRest) => [`0${Dot2}${Fractional}`, FractionalRest], () => []),
2141
+ // fail: did not match Fractional
2142
+ () => []
2143
+ );
2144
+ }
2145
+ function LeadingInteger(input) {
2146
+ return Match2(
2147
+ UnsignedInteger(input),
2148
+ (Integer3, IntegerRest) => Match2(
2149
+ Take([Dot], IntegerRest),
2150
+ (Dot2, DotRest) => Match2(TakeFractional(DotRest), (Fractional, FractionalRest) => [`${Integer3}${Dot2}${Fractional}`, FractionalRest], () => [`${Integer3}`, DotRest]),
2151
+ // fail: did not match Fractional, use Integer
2152
+ () => [`${Integer3}`, IntegerRest]
2153
+ ),
2154
+ // fail: did not match Dot, use Integer
2155
+ () => []
2156
+ );
2157
+ }
2158
+ function TakeUnsignedNumber(input) {
2159
+ return IsLeadingDot(input) ? LeadingDot(input) : LeadingInteger(input);
2160
+ }
2161
+ function UnsignedNumber(input) {
2162
+ return TakeUnsignedNumber(Trim(input));
2163
+ }
2164
+
2165
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/number.mjs
2166
+ function TakeSign2(input) {
2167
+ return Optional2(Hyphen, input);
2168
+ }
2169
+ function TakeSignedNumber(input) {
2170
+ return Match2(
2171
+ TakeSign2(input),
2172
+ (Sign, SignRest) => Match2(UnsignedNumber(SignRest), (UnsignedInteger2, UnsignedIntegerRest) => [`${Sign}${UnsignedInteger2}`, UnsignedIntegerRest], () => []),
2173
+ // fail: did not match unsigned integer
2174
+ () => []
2175
+ );
2176
+ }
2177
+ function Number3(input) {
2178
+ return TakeSignedNumber(Trim(input));
2179
+ }
2180
+
2181
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/until.mjs
2182
+ function TakeOne(input) {
2183
+ const result = IsEqual(input, "") ? [] : [input.slice(0, 1), input.slice(1)];
2184
+ return result;
2185
+ }
2186
+ function IsInputMatchSentinal(end, input) {
2187
+ return ShiftLeft(end, (left, right) => input.startsWith(left) ? true : IsInputMatchSentinal(right, input), () => false);
2188
+ }
2189
+ function Until(end, input, result = "") {
2190
+ return Match2(
2191
+ TakeOne(input),
2192
+ (One, Rest2) => IsInputMatchSentinal(end, input) ? [result, input] : Until(end, Rest2, `${result}${One}`),
2193
+ () => []
2194
+ );
2195
+ }
2196
+
2197
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/span.mjs
2198
+ function MultiLine(start, end, input) {
2199
+ return Match2(
2200
+ Take([start], input),
2201
+ (_, Rest2) => Match2(
2202
+ Until([end], Rest2),
2203
+ (Until2, UntilRest) => Match2(Take([end], UntilRest), (_2, Rest3) => [`${Until2}`, Rest3], () => []),
2204
+ // fail: did not match End
2205
+ () => []
2206
+ ),
2207
+ // fail: did not match Until
2208
+ () => []
2209
+ );
2210
+ }
2211
+ function SingleLine(start, end, input) {
2212
+ return Match2(
2213
+ Take([start], input),
2214
+ (_, Rest2) => Match2(
2215
+ Until([NewLine, end], Rest2),
2216
+ (Until2, UntilRest) => Match2(Take([end], UntilRest), (_2, EndRest) => [`${Until2}`, EndRest], () => []),
2217
+ // fail: did not match End
2218
+ () => []
2219
+ ),
2220
+ // fail: did not match Until
2221
+ () => []
2222
+ );
2223
+ }
2224
+ function Span(start, end, multiLine, input) {
2225
+ return multiLine ? MultiLine(start, end, Trim(input)) : SingleLine(start, end, Trim(input));
2226
+ }
2227
+
2228
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/string.mjs
2229
+ function TakeInitial2(quotes, input) {
2230
+ return Take(quotes, input);
2231
+ }
2232
+ function TakeSpan(quote, input) {
2233
+ return Span(quote, quote, false, input);
2234
+ }
2235
+ function TakeString(quotes, input) {
2236
+ return Match2(TakeInitial2(quotes, input), (Initial2, InitialRest) => TakeSpan(Initial2, `${Initial2}${InitialRest}`), () => []);
2237
+ }
2238
+ function String3(quotes, input) {
2239
+ return TakeString(quotes, Trim(input));
2240
+ }
2241
+
2242
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/token/until_1.mjs
2243
+ function Until_1(end, input) {
2244
+ return Match2(Until(end, input), (Until2, UntilRest) => IsEqual(Until2, "") ? [] : [Until2, UntilRest], () => []);
2245
+ }
2246
+
2247
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/parser.mjs
2248
+ var If = (result, left, right = () => []) => result.length === 2 ? left(result) : right();
2249
+ var GenericParameterExtendsEquals = (input) => If(If(Ident(input), ([_0, input2]) => If(Const("extends", input2), ([_1, input3]) => If(Type(input3), ([_2, input4]) => If(Const("=", input4), ([_3, input5]) => If(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [GenericParameterExtendsEqualsMapping(_0), input2]);
2250
+ var GenericParameterExtends = (input) => If(If(Ident(input), ([_0, input2]) => If(Const("extends", input2), ([_1, input3]) => If(Type(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [GenericParameterExtendsMapping(_0), input2]);
2251
+ var GenericParameterEquals = (input) => If(If(Ident(input), ([_0, input2]) => If(Const("=", input2), ([_1, input3]) => If(Type(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [GenericParameterEqualsMapping(_0), input2]);
2252
+ var GenericParameterIdentifier = (input) => If(Ident(input), ([_0, input2]) => [GenericParameterIdentifierMapping(_0), input2]);
2253
+ var GenericParameter = (input) => If(If(GenericParameterExtendsEquals(input), ([_0, input2]) => [_0, input2], () => If(GenericParameterExtends(input), ([_0, input2]) => [_0, input2], () => If(GenericParameterEquals(input), ([_0, input2]) => [_0, input2], () => If(GenericParameterIdentifier(input), ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [GenericParameterMapping(_0), input2]);
2254
+ var GenericParameterList_0 = (input, result = []) => If(If(Const(",", input), ([_0, input2]) => If(GenericParameter(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => GenericParameterList_0(input2, [...result, _0]), () => [result, input]);
2255
+ var GenericParameterList = (input) => If(If(If(GenericParameter(input), ([_0, input2]) => If(GenericParameterList_0(input2), ([_1, input3]) => If(If(Const(",", input3), ([_02, input4]) => [[_02], input4], () => [[], input3]), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [GenericParameterListMapping(_0), input2]);
2256
+ var GenericParameters = (input) => If(If(Const("<", input), ([_0, input2]) => If(GenericParameterList(input2), ([_1, input3]) => If(Const(">", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [GenericParametersMapping(_0), input2]);
2257
+ var GenericCallArgumentList_0 = (input, result = []) => If(If(Const(",", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => GenericCallArgumentList_0(input2, [...result, _0]), () => [result, input]);
2258
+ var GenericCallArgumentList = (input) => If(If(If(Type(input), ([_0, input2]) => If(GenericCallArgumentList_0(input2), ([_1, input3]) => If(If(Const(",", input3), ([_02, input4]) => [[_02], input4], () => [[], input3]), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [GenericCallArgumentListMapping(_0), input2]);
2259
+ var GenericCallArguments = (input) => If(If(Const("<", input), ([_0, input2]) => If(GenericCallArgumentList(input2), ([_1, input3]) => If(Const(">", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [GenericCallArgumentsMapping(_0), input2]);
2260
+ var GenericCall = (input) => If(If(Ident(input), ([_0, input2]) => If(GenericCallArguments(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [GenericCallMapping(_0), input2]);
2261
+ var OptionalSemiColon = (input) => If(If(If(Const(";", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [OptionalSemiColonMapping(_0), input2]);
2262
+ var KeywordString = (input) => If(Const("string", input), ([_0, input2]) => [KeywordStringMapping(_0), input2]);
2263
+ var KeywordNumber = (input) => If(Const("number", input), ([_0, input2]) => [KeywordNumberMapping(_0), input2]);
2264
+ var KeywordBoolean = (input) => If(Const("boolean", input), ([_0, input2]) => [KeywordBooleanMapping(_0), input2]);
2265
+ var KeywordUndefined = (input) => If(Const("undefined", input), ([_0, input2]) => [KeywordUndefinedMapping(_0), input2]);
2266
+ var KeywordNull = (input) => If(Const("null", input), ([_0, input2]) => [KeywordNullMapping(_0), input2]);
2267
+ var KeywordInteger = (input) => If(Const("integer", input), ([_0, input2]) => [KeywordIntegerMapping(_0), input2]);
2268
+ var KeywordBigInt = (input) => If(Const("bigint", input), ([_0, input2]) => [KeywordBigIntMapping(_0), input2]);
2269
+ var KeywordUnknown = (input) => If(Const("unknown", input), ([_0, input2]) => [KeywordUnknownMapping(_0), input2]);
2270
+ var KeywordAny = (input) => If(Const("any", input), ([_0, input2]) => [KeywordAnyMapping(_0), input2]);
2271
+ var KeywordObject = (input) => If(Const("object", input), ([_0, input2]) => [KeywordObjectMapping(_0), input2]);
2272
+ var KeywordNever = (input) => If(Const("never", input), ([_0, input2]) => [KeywordNeverMapping(_0), input2]);
2273
+ var KeywordSymbol = (input) => If(Const("symbol", input), ([_0, input2]) => [KeywordSymbolMapping(_0), input2]);
2274
+ var KeywordVoid = (input) => If(Const("void", input), ([_0, input2]) => [KeywordVoidMapping(_0), input2]);
2275
+ var KeywordThis = (input) => If(Const("this", input), ([_0, input2]) => [KeywordThisMapping(_0), input2]);
2276
+ var TemplateInterpolate = (input) => If(If(Const("${", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Const("}", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [TemplateInterpolateMapping(_0), input2]);
2277
+ var TemplateSpan = (input) => If(Until(["${", "`"], input), ([_0, input2]) => [TemplateSpanMapping(_0), input2]);
2278
+ var TemplateBody = (input) => If(If(If(TemplateSpan(input), ([_0, input2]) => If(TemplateInterpolate(input2), ([_1, input3]) => If(TemplateBody(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If(If(TemplateSpan(input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If(If(TemplateSpan(input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => []))), ([_0, input2]) => [TemplateBodyMapping(_0), input2]);
2279
+ var TemplateLiteralTypes = (input) => If(If(Const("`", input), ([_0, input2]) => If(TemplateBody(input2), ([_1, input3]) => If(Const("`", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [TemplateLiteralTypesMapping(_0), input2]);
2280
+ var TemplateLiteral = (input) => If(TemplateLiteralTypes(input), ([_0, input2]) => [TemplateLiteralMapping(_0), input2]);
2281
+ var Dependent2 = (input) => If(If(If(Const("if", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Const("then", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => If(Const("else", input5), ([_4, input6]) => If(Type(input6), ([_5, input7]) => [[_0, _1, _2, _3, _4, _5], input7])))))), ([_0, input2]) => [_0, input2], () => If(If(Const("if", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Const("then", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [DependentMapping(_0), input2]);
2282
+ var LiteralBigInt = (input) => If(BigInt3(input), ([_0, input2]) => [LiteralBigIntMapping(_0), input2]);
2283
+ var LiteralBoolean = (input) => If(If(Const("true", input), ([_0, input2]) => [_0, input2], () => If(Const("false", input), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [LiteralBooleanMapping(_0), input2]);
2284
+ var LiteralNumber = (input) => If(Number3(input), ([_0, input2]) => [LiteralNumberMapping(_0), input2]);
2285
+ var LiteralString = (input) => If(String3(["'", '"'], input), ([_0, input2]) => [LiteralStringMapping(_0), input2]);
2286
+ var KeyOf = (input) => If(If(If(Const("keyof", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [KeyOfMapping(_0), input2]);
2287
+ var IndexArray_0 = (input, result = []) => If(If(If(Const("[", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Const("]", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If(If(Const("[", input), ([_0, input2]) => If(Const("]", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => IndexArray_0(input2, [...result, _0]), () => [result, input]);
2288
+ var IndexArray = (input) => If(IndexArray_0(input), ([_0, input2]) => [IndexArrayMapping(_0), input2]);
2289
+ var Extends2 = (input) => If(If(If(Const("extends", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Const("?", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => If(Const(":", input5), ([_4, input6]) => If(Type(input6), ([_5, input7]) => [[_0, _1, _2, _3, _4, _5], input7])))))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ExtendsMapping(_0), input2]);
2290
+ var Base = (input) => If(If(If(Const("(", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Const(")", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If(KeywordString(input), ([_0, input2]) => [_0, input2], () => If(KeywordNumber(input), ([_0, input2]) => [_0, input2], () => If(KeywordBoolean(input), ([_0, input2]) => [_0, input2], () => If(KeywordUndefined(input), ([_0, input2]) => [_0, input2], () => If(KeywordNull(input), ([_0, input2]) => [_0, input2], () => If(KeywordInteger(input), ([_0, input2]) => [_0, input2], () => If(KeywordBigInt(input), ([_0, input2]) => [_0, input2], () => If(KeywordUnknown(input), ([_0, input2]) => [_0, input2], () => If(KeywordAny(input), ([_0, input2]) => [_0, input2], () => If(KeywordObject(input), ([_0, input2]) => [_0, input2], () => If(KeywordNever(input), ([_0, input2]) => [_0, input2], () => If(KeywordSymbol(input), ([_0, input2]) => [_0, input2], () => If(KeywordVoid(input), ([_0, input2]) => [_0, input2], () => If(KeywordThis(input), ([_0, input2]) => [_0, input2], () => If(LiteralBigInt(input), ([_0, input2]) => [_0, input2], () => If(LiteralBoolean(input), ([_0, input2]) => [_0, input2], () => If(LiteralNumber(input), ([_0, input2]) => [_0, input2], () => If(LiteralString(input), ([_0, input2]) => [_0, input2], () => If(TemplateLiteral(input), ([_0, input2]) => [_0, input2], () => If(Dependent2(input), ([_0, input2]) => [_0, input2], () => If(_Object_2(input), ([_0, input2]) => [_0, input2], () => If(_Tuple_(input), ([_0, input2]) => [_0, input2], () => If(_Constructor_(input), ([_0, input2]) => [_0, input2], () => If(_Function_2(input), ([_0, input2]) => [_0, input2], () => If(_Mapped_(input), ([_0, input2]) => [_0, input2], () => If(GenericCall(input), ([_0, input2]) => [_0, input2], () => If(Reference(input), ([_0, input2]) => [_0, input2], () => [])))))))))))))))))))))))))))), ([_0, input2]) => [BaseMapping(_0), input2]);
2291
+ var With = (input) => If(If(If(Const("with", input), ([_0, input2]) => If(WithObject(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [WithMapping(_0), input2]);
2292
+ var Factor = (input) => If(If(KeyOf(input), ([_0, input2]) => If(Base(input2), ([_1, input3]) => If(IndexArray(input3), ([_2, input4]) => If(Extends2(input4), ([_3, input5]) => If(With(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [FactorMapping(_0), input2]);
2293
+ var ExprTermTail = (input) => If(If(If(Const("&", input), ([_0, input2]) => If(Factor(input2), ([_1, input3]) => If(ExprTermTail(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ExprTermTailMapping(_0), input2]);
2294
+ var ExprTerm = (input) => If(If(Factor(input), ([_0, input2]) => If(ExprTermTail(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ExprTermMapping(_0), input2]);
2295
+ var ExprTail = (input) => If(If(If(Const("|", input), ([_0, input2]) => If(ExprTerm(input2), ([_1, input3]) => If(ExprTail(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ExprTailMapping(_0), input2]);
2296
+ var Expr = (input) => If(If(ExprTerm(input), ([_0, input2]) => If(ExprTail(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ExprMapping(_0), input2]);
2297
+ var ExprReadonly = (input) => If(If(Const("readonly", input), ([_0, input2]) => If(Expr(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ExprReadonlyMapping(_0), input2]);
2298
+ var ExprPipe = (input) => If(If(Const("|", input), ([_0, input2]) => If(Expr(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ExprPipeMapping(_0), input2]);
2299
+ var GenericType = (input) => If(If(GenericParameters(input), ([_0, input2]) => If(Const("=", input2), ([_1, input3]) => If(Type(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [GenericTypeMapping(_0), input2]);
2300
+ var InferType = (input) => If(If(If(Const("infer", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => If(Const("extends", input3), ([_2, input4]) => If(Expr(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [_0, input2], () => If(If(Const("infer", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [InferTypeMapping(_0), input2]);
2301
+ var Type = (input) => If(If(InferType(input), ([_0, input2]) => [_0, input2], () => If(ExprPipe(input), ([_0, input2]) => [_0, input2], () => If(ExprReadonly(input), ([_0, input2]) => [_0, input2], () => If(Expr(input), ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [TypeMapping(_0), input2]);
2302
+ var PropertyKeyNumber = (input) => If(Number3(input), ([_0, input2]) => [PropertyKeyNumberMapping(_0), input2]);
2303
+ var PropertyKeyIdent = (input) => If(Ident(input), ([_0, input2]) => [PropertyKeyIdentMapping(_0), input2]);
2304
+ var PropertyKeyQuoted = (input) => If(String3(["'", '"'], input), ([_0, input2]) => [PropertyKeyQuotedMapping(_0), input2]);
2305
+ var PropertyKeyIndex = (input) => If(If(Const("[", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => If(Const(":", input3), ([_2, input4]) => If(If(KeywordInteger(input4), ([_02, input5]) => [_02, input5], () => If(KeywordNumber(input4), ([_02, input5]) => [_02, input5], () => If(KeywordString(input4), ([_02, input5]) => [_02, input5], () => If(KeywordSymbol(input4), ([_02, input5]) => [_02, input5], () => [])))), ([_3, input5]) => If(Const("]", input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [PropertyKeyIndexMapping(_0), input2]);
2306
+ var PropertyKey = (input) => If(If(PropertyKeyNumber(input), ([_0, input2]) => [_0, input2], () => If(PropertyKeyIdent(input), ([_0, input2]) => [_0, input2], () => If(PropertyKeyQuoted(input), ([_0, input2]) => [_0, input2], () => If(PropertyKeyIndex(input), ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [PropertyKeyMapping(_0), input2]);
2307
+ var Readonly2 = (input) => If(If(If(Const("readonly", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ReadonlyMapping(_0), input2]);
2308
+ var Optional3 = (input) => If(If(If(Const("?", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [OptionalMapping(_0), input2]);
2309
+ var Property = (input) => If(If(Readonly2(input), ([_0, input2]) => If(PropertyKey(input2), ([_1, input3]) => If(Optional3(input3), ([_2, input4]) => If(Const(":", input4), ([_3, input5]) => If(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [PropertyMapping(_0), input2]);
2310
+ var PropertyDelimiter = (input) => If(If(If(Const(",", input), ([_0, input2]) => If(Const("\n", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const(";", input), ([_0, input2]) => If(Const("\n", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const(",", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If(If(Const(";", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If(If(Const("\n", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => []))))), ([_0, input2]) => [PropertyDelimiterMapping(_0), input2]);
2311
+ var PropertyList_0 = (input, result = []) => If(If(PropertyDelimiter(input), ([_0, input2]) => If(Property(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => PropertyList_0(input2, [...result, _0]), () => [result, input]);
2312
+ var PropertyList = (input) => If(If(If(Property(input), ([_0, input2]) => If(PropertyList_0(input2), ([_1, input3]) => If(If(PropertyDelimiter(input3), ([_02, input4]) => [[_02], input4], () => [[], input3]), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [PropertyListMapping(_0), input2]);
2313
+ var Properties = (input) => If(If(Const("{", input), ([_0, input2]) => If(PropertyList(input2), ([_1, input3]) => If(Const("}", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [PropertiesMapping(_0), input2]);
2314
+ var _Object_2 = (input) => If(Properties(input), ([_0, input2]) => [_Object_Mapping(_0), input2]);
2315
+ var ElementNamed = (input) => If(If(If(Ident(input), ([_0, input2]) => If(Const("?", input2), ([_1, input3]) => If(Const(":", input3), ([_2, input4]) => If(Const("readonly", input4), ([_3, input5]) => If(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [_0, input2], () => If(If(Ident(input), ([_0, input2]) => If(Const(":", input2), ([_1, input3]) => If(Const("readonly", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [_0, input2], () => If(If(Ident(input), ([_0, input2]) => If(Const("?", input2), ([_1, input3]) => If(Const(":", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [_0, input2], () => If(If(Ident(input), ([_0, input2]) => If(Const(":", input2), ([_1, input3]) => If(Type(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [ElementNamedMapping(_0), input2]);
2316
+ var ElementBase = (input) => If(If(ElementNamed(input), ([_0, input2]) => [_0, input2], () => If(If(Readonly2(input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Optional3(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ElementBaseMapping(_0), input2]);
2317
+ var Element = (input) => If(If(If(Const("...", input), ([_0, input2]) => If(ElementBase(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(ElementBase(input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ElementMapping(_0), input2]);
2318
+ var ElementList_0 = (input, result = []) => If(If(Const(",", input), ([_0, input2]) => If(Element(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => ElementList_0(input2, [...result, _0]), () => [result, input]);
2319
+ var ElementList = (input) => If(If(If(Element(input), ([_0, input2]) => If(ElementList_0(input2), ([_1, input3]) => If(If(Const(",", input3), ([_02, input4]) => [[_02], input4], () => [[], input3]), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ElementListMapping(_0), input2]);
2320
+ var _Tuple_ = (input) => If(If(Const("[", input), ([_0, input2]) => If(ElementList(input2), ([_1, input3]) => If(Const("]", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_Tuple_Mapping(_0), input2]);
2321
+ var ParameterReadonlyOptional = (input) => If(If(Ident(input), ([_0, input2]) => If(Const("?", input2), ([_1, input3]) => If(Const(":", input3), ([_2, input4]) => If(Const("readonly", input4), ([_3, input5]) => If(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [ParameterReadonlyOptionalMapping(_0), input2]);
2322
+ var ParameterReadonly = (input) => If(If(Ident(input), ([_0, input2]) => If(Const(":", input2), ([_1, input3]) => If(Const("readonly", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [ParameterReadonlyMapping(_0), input2]);
2323
+ var ParameterOptional = (input) => If(If(Ident(input), ([_0, input2]) => If(Const("?", input2), ([_1, input3]) => If(Const(":", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [ParameterOptionalMapping(_0), input2]);
2324
+ var ParameterType = (input) => If(If(Ident(input), ([_0, input2]) => If(Const(":", input2), ([_1, input3]) => If(Type(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [ParameterTypeMapping(_0), input2]);
2325
+ var ParameterBase = (input) => If(If(ParameterReadonlyOptional(input), ([_0, input2]) => [_0, input2], () => If(ParameterReadonly(input), ([_0, input2]) => [_0, input2], () => If(ParameterOptional(input), ([_0, input2]) => [_0, input2], () => If(ParameterType(input), ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [ParameterBaseMapping(_0), input2]);
2326
+ var Parameter2 = (input) => If(If(If(Const("...", input), ([_0, input2]) => If(ParameterBase(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(ParameterBase(input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ParameterMapping(_0), input2]);
2327
+ var ParameterList_0 = (input, result = []) => If(If(Const(",", input), ([_0, input2]) => If(Parameter2(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => ParameterList_0(input2, [...result, _0]), () => [result, input]);
2328
+ var ParameterList = (input) => If(If(If(Parameter2(input), ([_0, input2]) => If(ParameterList_0(input2), ([_1, input3]) => If(If(Const(",", input3), ([_02, input4]) => [[_02], input4], () => [[], input3]), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ParameterListMapping(_0), input2]);
2329
+ var _Function_2 = (input) => If(If(Const("(", input), ([_0, input2]) => If(ParameterList(input2), ([_1, input3]) => If(Const(")", input3), ([_2, input4]) => If(Const("=>", input4), ([_3, input5]) => If(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [_Function_Mapping(_0), input2]);
2330
+ var _Constructor_ = (input) => If(If(Const("new", input), ([_0, input2]) => If(Const("(", input2), ([_1, input3]) => If(ParameterList(input3), ([_2, input4]) => If(Const(")", input4), ([_3, input5]) => If(Const("=>", input5), ([_4, input6]) => If(Type(input6), ([_5, input7]) => [[_0, _1, _2, _3, _4, _5], input7])))))), ([_0, input2]) => [_Constructor_Mapping(_0), input2]);
2331
+ var MappedReadonly = (input) => If(If(If(Const("+", input), ([_0, input2]) => If(Const("readonly", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const("-", input), ([_0, input2]) => If(Const("readonly", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const("readonly", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [MappedReadonlyMapping(_0), input2]);
2332
+ var MappedOptional = (input) => If(If(If(Const("+", input), ([_0, input2]) => If(Const("?", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const("-", input), ([_0, input2]) => If(Const("?", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const("?", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [MappedOptionalMapping(_0), input2]);
2333
+ var MappedAs = (input) => If(If(If(Const("as", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [MappedAsMapping(_0), input2]);
2334
+ var _Mapped_ = (input) => If(If(Const("{", input), ([_0, input2]) => If(MappedReadonly(input2), ([_1, input3]) => If(Const("[", input3), ([_2, input4]) => If(Ident(input4), ([_3, input5]) => If(Const("in", input5), ([_4, input6]) => If(Type(input6), ([_5, input7]) => If(MappedAs(input7), ([_6, input8]) => If(Const("]", input8), ([_7, input9]) => If(MappedOptional(input9), ([_8, input10]) => If(Const(":", input10), ([_9, input11]) => If(Type(input11), ([_10, input12]) => If(OptionalSemiColon(input12), ([_11, input13]) => If(Const("}", input13), ([_12, input14]) => [[_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12], input14]))))))))))))), ([_0, input2]) => [_Mapped_Mapping(_0), input2]);
2335
+ var Reference = (input) => If(Ident(input), ([_0, input2]) => [ReferenceMapping(_0), input2]);
2336
+ var WithBigInt = (input) => If(BigInt3(input), ([_0, input2]) => [WithBigIntMapping(_0), input2]);
2337
+ var WithNumber = (input) => If(Number3(input), ([_0, input2]) => [WithNumberMapping(_0), input2]);
2338
+ var WithBoolean = (input) => If(If(Const("true", input), ([_0, input2]) => [_0, input2], () => If(Const("false", input), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [WithBooleanMapping(_0), input2]);
2339
+ var WithString = (input) => If(String3(['"', "'"], input), ([_0, input2]) => [WithStringMapping(_0), input2]);
2340
+ var WithNull = (input) => If(Const("null", input), ([_0, input2]) => [WithNullMapping(_0), input2]);
2341
+ var WithUndefined = (input) => If(Const("undefined", input), ([_0, input2]) => [WithUndefinedMapping(_0), input2]);
2342
+ var WithProperty = (input) => If(If(PropertyKey(input), ([_0, input2]) => If(Const(":", input2), ([_1, input3]) => If(WithValue(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [WithPropertyMapping(_0), input2]);
2343
+ var WithPropertyList_0 = (input, result = []) => If(If(PropertyDelimiter(input), ([_0, input2]) => If(WithProperty(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => WithPropertyList_0(input2, [...result, _0]), () => [result, input]);
2344
+ var WithPropertyList = (input) => If(If(If(WithProperty(input), ([_0, input2]) => If(WithPropertyList_0(input2), ([_1, input3]) => If(If(PropertyDelimiter(input3), ([_02, input4]) => [[_02], input4], () => [[], input3]), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [WithPropertyListMapping(_0), input2]);
2345
+ var WithObject = (input) => If(If(Const("{", input), ([_0, input2]) => If(WithPropertyList(input2), ([_1, input3]) => If(Const("}", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [WithObjectMapping(_0), input2]);
2346
+ var WithElementList_0 = (input, result = []) => If(If(Const(",", input), ([_0, input2]) => If(WithValue(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => WithElementList_0(input2, [...result, _0]), () => [result, input]);
2347
+ var WithElementList = (input) => If(If(If(WithValue(input), ([_0, input2]) => If(WithElementList_0(input2), ([_1, input3]) => If(If(Const(",", input3), ([_02, input4]) => [[_02], input4], () => [[], input3]), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [WithElementListMapping(_0), input2]);
2348
+ var WithArray = (input) => If(If(Const("[", input), ([_0, input2]) => If(WithElementList(input2), ([_1, input3]) => If(Const("]", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [WithArrayMapping(_0), input2]);
2349
+ var WithValue = (input) => If(If(WithBigInt(input), ([_0, input2]) => [_0, input2], () => If(WithNumber(input), ([_0, input2]) => [_0, input2], () => If(WithBoolean(input), ([_0, input2]) => [_0, input2], () => If(WithString(input), ([_0, input2]) => [_0, input2], () => If(WithNull(input), ([_0, input2]) => [_0, input2], () => If(WithUndefined(input), ([_0, input2]) => [_0, input2], () => If(WithObject(input), ([_0, input2]) => [_0, input2], () => If(WithArray(input), ([_0, input2]) => [_0, input2], () => [])))))))), ([_0, input2]) => [WithValueMapping(_0), input2]);
2350
+ var PatternBigInt = (input) => If(Const("-?(?:0|[1-9][0-9]*)n", input), ([_0, input2]) => [PatternBigIntMapping(_0), input2]);
2351
+ var PatternString = (input) => If(Const(".*", input), ([_0, input2]) => [PatternStringMapping(_0), input2]);
2352
+ var PatternNumber = (input) => If(Const("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?", input), ([_0, input2]) => [PatternNumberMapping(_0), input2]);
2353
+ var PatternInteger = (input) => If(Const("-?(?:0|[1-9][0-9]*)", input), ([_0, input2]) => [PatternIntegerMapping(_0), input2]);
2354
+ var PatternNever = (input) => If(Const("(?!)", input), ([_0, input2]) => [PatternNeverMapping(_0), input2]);
2355
+ var PatternText = (input) => If(Until_1(["-?(?:0|[1-9][0-9]*)n", ".*", "-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?", "-?(?:0|[1-9][0-9]*)", "(?!)", "(", ")", "$", "|"], input), ([_0, input2]) => [PatternTextMapping(_0), input2]);
2356
+ var PatternBase = (input) => If(If(PatternBigInt(input), ([_0, input2]) => [_0, input2], () => If(PatternString(input), ([_0, input2]) => [_0, input2], () => If(PatternNumber(input), ([_0, input2]) => [_0, input2], () => If(PatternInteger(input), ([_0, input2]) => [_0, input2], () => If(PatternNever(input), ([_0, input2]) => [_0, input2], () => If(PatternGroup(input), ([_0, input2]) => [_0, input2], () => If(PatternText(input), ([_0, input2]) => [_0, input2], () => []))))))), ([_0, input2]) => [PatternBaseMapping(_0), input2]);
2357
+ var PatternGroup = (input) => If(If(Const("(", input), ([_0, input2]) => If(PatternBody(input2), ([_1, input3]) => If(Const(")", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [PatternGroupMapping(_0), input2]);
2358
+ var PatternUnion = (input) => If(If(If(PatternTerm(input), ([_0, input2]) => If(Const("|", input2), ([_1, input3]) => If(PatternUnion(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If(If(PatternTerm(input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => []))), ([_0, input2]) => [PatternUnionMapping(_0), input2]);
2359
+ var PatternTerm = (input) => If(If(PatternBase(input), ([_0, input2]) => If(PatternBody(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [PatternTermMapping(_0), input2]);
2360
+ var PatternBody = (input) => If(If(PatternUnion(input), ([_0, input2]) => [_0, input2], () => If(PatternTerm(input), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [PatternBodyMapping(_0), input2]);
2361
+ var Pattern = (input) => If(If(Const("^", input), ([_0, input2]) => If(PatternBody(input2), ([_1, input3]) => If(Const("$", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [PatternMapping(_0), input2]);
2362
+ var InterfaceDeclarationHeritageList_0 = (input, result = []) => If(If(Const(",", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => InterfaceDeclarationHeritageList_0(input2, [...result, _0]), () => [result, input]);
2363
+ var InterfaceDeclarationHeritageList = (input) => If(If(If(Type(input), ([_0, input2]) => If(InterfaceDeclarationHeritageList_0(input2), ([_1, input3]) => If(If(Const(",", input3), ([_02, input4]) => [[_02], input4], () => [[], input3]), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [InterfaceDeclarationHeritageListMapping(_0), input2]);
2364
+ var InterfaceDeclarationHeritage = (input) => If(If(If(Const("extends", input), ([_0, input2]) => If(InterfaceDeclarationHeritageList(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [InterfaceDeclarationHeritageMapping(_0), input2]);
2365
+ var InterfaceDeclarationGeneric = (input) => If(If(Const("interface", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => If(GenericParameters(input3), ([_2, input4]) => If(InterfaceDeclarationHeritage(input4), ([_3, input5]) => If(Properties(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [InterfaceDeclarationGenericMapping(_0), input2]);
2366
+ var InterfaceDeclaration = (input) => If(If(Const("interface", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => If(InterfaceDeclarationHeritage(input3), ([_2, input4]) => If(Properties(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [InterfaceDeclarationMapping(_0), input2]);
2367
+ var TypeAliasDeclarationGeneric = (input) => If(If(Const("type", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => If(GenericParameters(input3), ([_2, input4]) => If(Const("=", input4), ([_3, input5]) => If(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [TypeAliasDeclarationGenericMapping(_0), input2]);
2368
+ var TypeAliasDeclaration = (input) => If(If(Const("type", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => If(Const("=", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [TypeAliasDeclarationMapping(_0), input2]);
2369
+ var ExportKeyword = (input) => If(If(If(Const("export", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ExportKeywordMapping(_0), input2]);
2370
+ var ModuleDeclarationDelimiter = (input) => If(If(If(Const(";", input), ([_0, input2]) => If(Const("\n", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const(";", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If(If(Const("\n", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => []))), ([_0, input2]) => [ModuleDeclarationDelimiterMapping(_0), input2]);
2371
+ var ModuleDeclarationList_0 = (input, result = []) => If(If(ModuleDeclarationDelimiter(input), ([_0, input2]) => If(ModuleDeclaration(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => ModuleDeclarationList_0(input2, [...result, _0]), () => [result, input]);
2372
+ var ModuleDeclarationList = (input) => If(If(If(ModuleDeclaration(input), ([_0, input2]) => If(ModuleDeclarationList_0(input2), ([_1, input3]) => If(If(ModuleDeclarationDelimiter(input3), ([_02, input4]) => [[_02], input4], () => [[], input3]), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ModuleDeclarationListMapping(_0), input2]);
2373
+ var ModuleDeclaration = (input) => If(If(ExportKeyword(input), ([_0, input2]) => If(If(InterfaceDeclarationGeneric(input2), ([_02, input3]) => [_02, input3], () => If(InterfaceDeclaration(input2), ([_02, input3]) => [_02, input3], () => If(TypeAliasDeclarationGeneric(input2), ([_02, input3]) => [_02, input3], () => If(TypeAliasDeclaration(input2), ([_02, input3]) => [_02, input3], () => [])))), ([_1, input3]) => If(OptionalSemiColon(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [ModuleDeclarationMapping(_0), input2]);
2374
+ var Module = (input) => If(If(ModuleDeclaration(input), ([_0, input2]) => If(ModuleDeclarationList(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ModuleMapping(_0), input2]);
2375
+ var Script = (input) => If(If(Module(input), ([_0, input2]) => [_0, input2], () => If(GenericType(input), ([_0, input2]) => [_0, input2], () => If(Type(input), ([_0, input2]) => [_0, input2], () => []))), ([_0, input2]) => [ScriptMapping(_0), input2]);
2376
+
2377
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/patterns/template.mjs
2378
+ function ParseTemplateIntoTypes(template) {
2379
+ const parsed = TemplateLiteralTypes(`\`${template}\``);
2380
+ const result = guard_exports.IsEqual(parsed.length, 2) ? parsed[0] : Unreachable();
2381
+ return result;
2382
+ }
2383
+
2384
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/template_literal/encode.mjs
2385
+ function JoinString(input) {
2386
+ return input.join("|");
2387
+ }
2388
+ function UnwrapTemplateLiteralPattern(pattern) {
2389
+ return pattern.slice(1, pattern.length - 1);
2390
+ }
2391
+ function EncodeLiteral(value, right, pattern) {
2392
+ return EncodeTypes(right, `${pattern}${value}`);
2393
+ }
2394
+ function EncodeBigInt(right, pattern) {
2395
+ return EncodeTypes(right, `${pattern}${BigIntPattern}`);
2396
+ }
2397
+ function EncodeInteger(right, pattern) {
2398
+ return EncodeTypes(right, `${pattern}${IntegerPattern}`);
2399
+ }
2400
+ function EncodeNumber(right, pattern) {
2401
+ return EncodeTypes(right, `${pattern}${NumberPattern}`);
2402
+ }
2403
+ function EncodeBoolean(right, pattern) {
2404
+ return EncodeType(Union([Literal("false"), Literal("true")]), right, pattern);
2405
+ }
2406
+ function EncodeString(right, pattern) {
2407
+ return EncodeTypes(right, `${pattern}${StringPattern}`);
2408
+ }
2409
+ function EncodeTemplateLiteral(templatePattern, right, pattern) {
2410
+ return EncodeTypes(right, `${pattern}${UnwrapTemplateLiteralPattern(templatePattern)}`);
2411
+ }
2412
+ function EncodeTemplateLiteralDeferred(types, right, pattern) {
2413
+ const templateLiteral = TemplateLiteralAction(types, {});
2414
+ const result = EncodeType(templateLiteral, right, pattern);
2415
+ return result;
2416
+ }
2417
+ function EncodeEnum(values, right, pattern) {
2418
+ const evaluated = EvaluateEnum(values);
2419
+ return EncodeType(evaluated, right, pattern);
2420
+ }
2421
+ function EncodeUnion(types, right, pattern, result = []) {
2422
+ return guard_exports.ShiftLeft(types, (head, tail) => EncodeUnion(tail, right, pattern, [...result, EncodeType(head, [], "")]), () => EncodeTypes(right, `${pattern}(${JoinString(result)})`));
2423
+ }
2424
+ function EncodeType(type, right, pattern) {
2425
+ return IsEnum(type) ? EncodeEnum(type.enum, right, pattern) : IsInteger2(type) ? EncodeInteger(right, pattern) : IsLiteral(type) ? EncodeLiteral(type.const, right, pattern) : IsBigInt2(type) ? EncodeBigInt(right, pattern) : IsBoolean3(type) ? EncodeBoolean(right, pattern) : IsNumber3(type) ? EncodeNumber(right, pattern) : IsString3(type) ? EncodeString(right, pattern) : IsTemplateLiteral(type) ? EncodeTemplateLiteral(type.pattern, right, pattern) : IsTemplateLiteralDeferred(type) ? EncodeTemplateLiteralDeferred(type.parameters[0], right, pattern) : IsUnion(type) ? EncodeUnion(type.anyOf, right, pattern) : NeverPattern;
2426
+ }
2427
+ function EncodeTypes(types, pattern) {
2428
+ return guard_exports.ShiftLeft(types, (left, right) => EncodeType(left, right, pattern), () => pattern);
2429
+ }
2430
+ function EncodePattern(types) {
2431
+ const encoded = EncodeTypes(types, "");
2432
+ const result = `^${encoded}$`;
2433
+ return result;
2434
+ }
2435
+ function TemplateLiteralEncode(types) {
2436
+ const pattern = EncodePattern(types);
2437
+ const result = TemplateLiteralCreate(pattern);
2438
+ return result;
2439
+ }
2440
+
2441
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/template_literal/instantiate.mjs
2442
+ function TemplateLiteralAction(types, options) {
2443
+ const result = CanInstantiate(types) ? memory_exports.Update(TemplateLiteralEncode(types), {}, options) : TemplateLiteralDeferred(types, options);
2444
+ return result;
2445
+ }
2446
+ function TemplateLiteralInstantiate(context, state, types, options) {
2447
+ const instantiatedTypes = InstantiateTypes(context, state, types);
2448
+ return TemplateLiteralAction(instantiatedTypes, options);
2449
+ }
2450
+
2451
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/template_literal.mjs
2452
+ function TemplateLiteralDeferred(types, options = {}) {
2453
+ return Deferred("TemplateLiteral", [types], options);
2454
+ }
2455
+ function IsTemplateLiteralDeferred(value) {
2456
+ return IsSchema(value) && guard_exports.HasPropertyKey(value, "action") && guard_exports.IsEqual(value.action, "TemplateLiteral");
2457
+ }
2458
+ function TemplateLiteralFromTypes(types) {
2459
+ return TemplateLiteralAction(types, {});
2460
+ }
2461
+ function TemplateLiteralFromString(template) {
2462
+ const types = ParseTemplateIntoTypes(template);
2463
+ return TemplateLiteralFromTypes(types);
2464
+ }
2465
+ function TemplateLiteral2(input, options = {}) {
2466
+ const type = guard_exports.IsString(input) ? TemplateLiteralFromString(input) : TemplateLiteralFromTypes(input);
2467
+ return memory_exports.Update(type, {}, options);
2468
+ }
2469
+ function IsTemplateLiteral(value) {
2470
+ return IsKind(value, "TemplateLiteral");
2471
+ }
2472
+
2473
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/result.mjs
2474
+ var result_exports = {};
2475
+ __export(result_exports, {
2476
+ ExtendsFalse: () => ExtendsFalse,
2477
+ ExtendsTrue: () => ExtendsTrue,
2478
+ ExtendsUnion: () => ExtendsUnion,
2479
+ IsExtendsFalse: () => IsExtendsFalse,
2480
+ IsExtendsTrue: () => IsExtendsTrue,
2481
+ IsExtendsTrueLike: () => IsExtendsTrueLike,
2482
+ IsExtendsUnion: () => IsExtendsUnion,
2483
+ Match: () => Match3
2484
+ });
2485
+ function ExtendsUnion(inferred) {
2486
+ return memory_exports.Create({ ["~kind"]: "ExtendsUnion" }, { inferred });
2487
+ }
2488
+ function IsExtendsUnion(value) {
2489
+ return guard_exports.IsObject(value) && guard_exports.HasPropertyKey(value, "~kind") && guard_exports.HasPropertyKey(value, "inferred") && guard_exports.IsEqual(value["~kind"], "ExtendsUnion") && guard_exports.IsObject(value.inferred);
2490
+ }
2491
+ function ExtendsTrue(inferred) {
2492
+ return memory_exports.Create({ ["~kind"]: "ExtendsTrue" }, { inferred });
2493
+ }
2494
+ function IsExtendsTrue(value) {
2495
+ return guard_exports.IsObject(value) && guard_exports.HasPropertyKey(value, "~kind") && guard_exports.HasPropertyKey(value, "inferred") && guard_exports.IsEqual(value["~kind"], "ExtendsTrue") && guard_exports.IsObject(value.inferred);
2496
+ }
2497
+ function ExtendsFalse() {
2498
+ return memory_exports.Create({ ["~kind"]: "ExtendsFalse" }, {});
2499
+ }
2500
+ function IsExtendsFalse(value) {
2501
+ return guard_exports.IsObject(value) && guard_exports.HasPropertyKey(value, "~kind") && guard_exports.IsEqual(value["~kind"], "ExtendsFalse");
2502
+ }
2503
+ function IsExtendsTrueLike(value) {
2504
+ return IsExtendsUnion(value) || IsExtendsTrue(value);
2505
+ }
2506
+ function Match3(result, true_, false_) {
2507
+ return IsExtendsTrueLike(result) ? true_(result.inferred) : false_();
2508
+ }
2509
+
2510
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/extends_right.mjs
2511
+ function ExtendsRightInfer(inferred, name, left, right) {
2512
+ return Match3(ExtendsLeft(inferred, left, right), (checkInferred) => ExtendsTrue(memory_exports.Assign(memory_exports.Assign(inferred, checkInferred), { [name]: left })), () => ExtendsFalse());
2513
+ }
2514
+ function ExtendsRightAny(inferred, _left) {
2515
+ return ExtendsTrue(inferred);
2516
+ }
2517
+ function ExtendsRightDependent(inferred, left, if_, then_, else_) {
2518
+ return Match3(ExtendsLeft(inferred, left, if_), (inferred2) => Match3(ExtendsLeft(inferred2, left, then_), (inferred3) => ExtendsTrue(inferred3), () => ExtendsFalse()), () => Match3(ExtendsLeft(inferred, left, else_), (inferred2) => ExtendsTrue(inferred2), () => ExtendsFalse()));
2519
+ }
2520
+ function ExtendsRightEnum(inferred, left, right) {
2521
+ const evaluated = EvaluateEnum(right);
2522
+ return ExtendsLeft(inferred, left, evaluated);
2523
+ }
2524
+ function ExtendsRightIntersect(inferred, left, right) {
2525
+ return guard_exports.ShiftLeft(right, (head, tail) => Match3(ExtendsLeft(inferred, left, head), (inferred2) => ExtendsRightIntersect(inferred2, left, tail), () => ExtendsFalse()), () => ExtendsTrue(inferred));
2526
+ }
2527
+ function ExtendsRightTemplateLiteral(inferred, left, right) {
2528
+ const evaluated = EvaluateTemplateLiteral(right);
2529
+ return ExtendsLeft(inferred, left, evaluated);
2530
+ }
2531
+ function ExtendsRightUnion(inferred, left, right) {
2532
+ return guard_exports.ShiftLeft(right, (head, tail) => Match3(ExtendsLeft(inferred, left, head), (inferred2) => ExtendsTrue(inferred2), () => ExtendsRightUnion(inferred, left, tail)), () => ExtendsFalse());
2533
+ }
2534
+ function ExtendsRight(inferred, left, right) {
2535
+ return IsAny(right) ? ExtendsRightAny(inferred, left) : IsDependent(right) ? ExtendsRightDependent(inferred, left, right.if, right.then, right.else) : IsEnum(right) ? ExtendsRightEnum(inferred, left, right.enum) : IsInfer(right) ? ExtendsRightInfer(inferred, right.name, left, right.extends) : IsIntersect(right) ? ExtendsRightIntersect(inferred, left, right.allOf) : IsTemplateLiteral(right) ? ExtendsRightTemplateLiteral(inferred, left, right.pattern) : IsUnion(right) ? ExtendsRightUnion(inferred, left, right.anyOf) : IsUnknown(right) ? ExtendsTrue(inferred) : ExtendsFalse();
2536
+ }
2537
+
2538
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/any.mjs
2539
+ function ExtendsAny(inferred, left, right) {
2540
+ return IsInfer(right) ? ExtendsRight(inferred, left, right) : IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : ExtendsUnion(inferred);
2541
+ }
2542
+
2543
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/array.mjs
2544
+ function ExtendsImmutable(left, right) {
2545
+ const isImmutableLeft = IsImmutable(left);
2546
+ const isImmutableRight = IsImmutable(right);
2547
+ return isImmutableLeft && isImmutableRight ? true : !isImmutableLeft && isImmutableRight ? true : isImmutableLeft && !isImmutableRight ? false : true;
2548
+ }
2549
+ function ExtendsArray(inferred, arrayLeft, left, right) {
2550
+ return IsArray2(right) ? ExtendsImmutable(arrayLeft, right) ? ExtendsLeft(inferred, left, right.items) : ExtendsFalse() : ExtendsRight(inferred, arrayLeft, right);
2551
+ }
2552
+
2553
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/bigint.mjs
2554
+ function ExtendsBigInt(inferred, left, right) {
2555
+ return IsBigInt2(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
2556
+ }
2557
+
2558
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/boolean.mjs
2559
+ function ExtendsBoolean(inferred, left, right) {
2560
+ return IsBoolean3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
2561
+ }
2562
+
2563
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/parameters.mjs
2564
+ function ParameterCompare(inferred, left, leftRest, right, rightRest) {
2565
+ const checkLeft = IsInfer(right) ? left : right;
2566
+ const checkRight = IsInfer(right) ? right : left;
2567
+ const isLeftOptional = IsOptional(left);
2568
+ const isRightOptional = IsOptional(right);
2569
+ return !isLeftOptional && isRightOptional ? ExtendsFalse() : Match3(ExtendsLeft(inferred, checkLeft, checkRight), (inferred2) => ExtendsParameters(inferred2, leftRest, rightRest), () => ExtendsFalse());
2570
+ }
2571
+ function ParameterRight(inferred, left, leftRest, rightRest) {
2572
+ return guard_exports.ShiftLeft(rightRest, (head, tail) => ParameterCompare(inferred, left, leftRest, head, tail), () => IsOptional(left) ? ExtendsTrue(inferred) : ExtendsFalse());
2573
+ }
2574
+ function ParametersLeft(inferred, left, rightRest) {
2575
+ return guard_exports.ShiftLeft(left, (head, tail) => ParameterRight(inferred, head, tail, rightRest), () => ExtendsTrue(inferred));
2576
+ }
2577
+ function ExtendsParameters(inferred, left, right) {
2578
+ return ParametersLeft(inferred, left, right);
2579
+ }
2580
+
2581
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/return_type.mjs
2582
+ function ExtendsReturnType(inferred, left, right) {
2583
+ return IsVoid(right) ? ExtendsTrue(inferred) : ExtendsLeft(inferred, left, right);
2584
+ }
2585
+
2586
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/constructor.mjs
2587
+ function ExtendsConstructor(inferred, parameters2, returnType, right) {
2588
+ return IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : IsConstructor2(right) ? Match3(ExtendsParameters(inferred, parameters2, right["parameters"]), (inferred2) => ExtendsReturnType(inferred2, returnType, right["instanceType"]), () => ExtendsFalse()) : ExtendsFalse();
2589
+ }
2590
+
2591
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/dependent.mjs
2592
+ function ExtendsDependent(inferred, if_, then_, else_, right) {
2593
+ return Match3(ExtendsLeft(inferred, if_, right), () => ExtendsLeft(inferred, then_, right), () => ExtendsLeft(inferred, else_, right));
2594
+ }
2595
+
2596
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/enum.mjs
2597
+ function ExtendsEnum(inferred, left, right) {
2598
+ const evaluated = EvaluateEnum(left);
2599
+ return ExtendsLeft(inferred, evaluated, right);
2600
+ }
2601
+
2602
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/function.mjs
2603
+ function ExtendsFunction(inferred, parameters2, returnType, right) {
2604
+ return IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : IsFunction2(right) ? Match3(ExtendsParameters(inferred, parameters2, right["parameters"]), (inferred2) => ExtendsReturnType(inferred2, returnType, right["returnType"]), () => ExtendsFalse()) : ExtendsFalse();
2605
+ }
2606
+
2607
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/integer.mjs
2608
+ function ExtendsInteger(inferred, left, right) {
2609
+ return IsInteger2(right) ? ExtendsTrue(inferred) : IsNumber3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
2610
+ }
2611
+
2612
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/intersect.mjs
2613
+ function ExtendsIntersect(inferred, left, right) {
2614
+ const evaluated = EvaluateIntersect(left);
2615
+ return ExtendsLeft(inferred, evaluated, right);
2616
+ }
2617
+
2618
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/literal.mjs
2619
+ function ExtendsLiteralValue(inferred, left, right) {
2620
+ return left === right ? ExtendsTrue(inferred) : ExtendsFalse();
2621
+ }
2622
+ function ExtendsLiteralBigInt(inferred, left, right) {
2623
+ return IsLiteral(right) ? ExtendsLiteralValue(inferred, left, right.const) : IsBigInt2(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, Literal(left), right);
2624
+ }
2625
+ function ExtendsLiteralBoolean(inferred, left, right) {
2626
+ return IsLiteral(right) ? ExtendsLiteralValue(inferred, left, right.const) : IsBoolean3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, Literal(left), right);
2627
+ }
2628
+ function ExtendsLiteralNumber(inferred, left, right) {
2629
+ return IsLiteral(right) ? ExtendsLiteralValue(inferred, left, right.const) : IsNumber3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, Literal(left), right);
2630
+ }
2631
+ function ExtendsLiteralString(inferred, left, right) {
2632
+ return IsLiteral(right) ? ExtendsLiteralValue(inferred, left, right.const) : IsString3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, Literal(left), right);
2633
+ }
2634
+ function ExtendsLiteral(inferred, left, right) {
2635
+ return guard_exports.IsBigInt(left.const) ? ExtendsLiteralBigInt(inferred, left.const, right) : guard_exports.IsBoolean(left.const) ? ExtendsLiteralBoolean(inferred, left.const, right) : guard_exports.IsNumber(left.const) ? ExtendsLiteralNumber(inferred, left.const, right) : guard_exports.IsString(left.const) ? ExtendsLiteralString(inferred, left.const, right) : Unreachable();
2636
+ }
2637
+
2638
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/never.mjs
2639
+ function ExtendsNever(inferred, left, right) {
2640
+ return IsInfer(right) ? ExtendsRight(inferred, left, right) : ExtendsTrue(inferred);
2641
+ }
2642
+
2643
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/null.mjs
2644
+ function ExtendsNull(inferred, left, right) {
2645
+ return IsNull2(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
2646
+ }
2647
+
2648
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/number.mjs
2649
+ function ExtendsNumber(inferred, left, right) {
2650
+ return IsNumber3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
2651
+ }
2652
+
2653
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/object.mjs
2654
+ function ExtendsPropertyOptional(inferred, left, right) {
2655
+ return IsOptional(left) ? IsOptional(right) ? ExtendsTrue(inferred) : ExtendsFalse() : ExtendsTrue(inferred);
2656
+ }
2657
+ function ExtendsProperty(inferred, left, right) {
2658
+ return (
2659
+ // Right TInfer<TNever> is TExtendsFalse
2660
+ IsInfer(right) && IsNever(right.extends) ? ExtendsFalse() : Match3(ExtendsLeft(inferred, left, right), (inferred2) => ExtendsPropertyOptional(inferred2, left, right), () => ExtendsFalse())
2661
+ );
2662
+ }
2663
+ function ExtractInferredProperties(keys, properties) {
2664
+ return keys.reduce((result, key) => {
2665
+ return key in properties ? IsExtendsTrueLike(properties[key]) ? { ...result, ...properties[key].inferred } : Unreachable() : Unreachable();
2666
+ }, {});
2667
+ }
2668
+ function ExtendsPropertiesComparer(inferred, left, right) {
2669
+ const properties = {};
2670
+ for (const rightKey of guard_exports.Keys(right)) {
2671
+ properties[rightKey] = rightKey in left ? ExtendsProperty({}, left[rightKey], right[rightKey]) : IsOptional(right[rightKey]) ? IsInfer(right[rightKey]) ? ExtendsTrue(memory_exports.Assign(inferred, { [right[rightKey].name]: right[rightKey].extends })) : ExtendsTrue(inferred) : ExtendsFalse();
2672
+ }
2673
+ const checked = guard_exports.Values(properties).every((result) => IsExtendsTrueLike(result));
2674
+ const extracted = checked ? ExtractInferredProperties(guard_exports.Keys(properties), properties) : {};
2675
+ return checked ? ExtendsTrue(extracted) : ExtendsFalse();
2676
+ }
2677
+ function ExtendsProperties(inferred, left, right) {
2678
+ const compared = ExtendsPropertiesComparer(inferred, left, right);
2679
+ return IsExtendsTrueLike(compared) ? ExtendsTrue(memory_exports.Assign(inferred, compared.inferred)) : ExtendsFalse();
2680
+ }
2681
+ function ExtendsObjectToObject(inferred, left, right) {
2682
+ return ExtendsProperties(inferred, left, right);
2683
+ }
2684
+ function RecordMergeInferred(left, right) {
2685
+ return guard_exports.Keys(right).reduce((result, key) => {
2686
+ return {
2687
+ ...result,
2688
+ [key]: guard_exports.HasPropertyKey(left, key) ? IsUnion(result[key]) ? Union([...result[key].anyOf, right[key]]) : Union([left[key], right[key]]) : right[key]
2689
+ };
2690
+ }, left);
2691
+ }
2692
+ function ExtendsRecordComparer(properties, keys, type, result) {
2693
+ return guard_exports.ShiftLeft(keys, (left, right) => Match3(ExtendsLeft({}, properties[left], type), (inferred) => ExtendsRecordComparer(properties, right, type, RecordMergeInferred(result, inferred)), () => ExtendsFalse()), () => ExtendsTrue(result));
2694
+ }
2695
+ function ExtendsObjectToRecord(inferred, properties, _pattern, value) {
2696
+ const keys = guard_exports.Keys(properties);
2697
+ const result = ExtendsRecordComparer(properties, keys, value, inferred);
2698
+ return result;
2699
+ }
2700
+ function ExtendsObject(inferred, left, right) {
2701
+ return IsRecord(right) ? ExtendsObjectToRecord(inferred, left, RecordPattern(right), RecordValue(right)) : IsObject2(right) ? ExtendsObjectToObject(inferred, left, right.properties) : ExtendsRight(inferred, _Object_(left), right);
2702
+ }
2703
+
2704
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/record.mjs
2705
+ function FromObject2(inferred, properties) {
2706
+ return guard_exports.IsEqual(guard_exports.Keys(properties).length, 0) ? ExtendsTrue(inferred) : ExtendsFalse();
2707
+ }
2708
+ function FromRecord(inferred, _leftKey, leftValue, _rightKey, rightValue) {
2709
+ return ExtendsLeft(inferred, leftValue, rightValue);
2710
+ }
2711
+ function ExtendsRecord(inferred, leftPattern, leftValue, right) {
2712
+ return IsRecord(right) ? FromRecord(inferred, RecordPatternToType(leftPattern), leftValue, RecordPatternToType(RecordPattern(right)), RecordValue(right)) : IsObject2(right) ? FromObject2(inferred, right.properties) : IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : ExtendsFalse();
2713
+ }
2714
+
2715
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/string.mjs
2716
+ function ExtendsString(inferred, left, right) {
2717
+ return IsString3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
2718
+ }
2719
+
2720
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/symbol.mjs
2721
+ function ExtendsSymbol(inferred, left, right) {
2722
+ return IsSymbol2(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
2723
+ }
2724
+
2725
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/template_literal.mjs
2726
+ function ExtendsTemplateLiteral(inferred, left, right) {
2727
+ const evaluated = EvaluateTemplateLiteral(left);
2728
+ return ExtendsLeft(inferred, evaluated, right);
2729
+ }
2730
+
2731
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/inference.mjs
2732
+ function Inferrable(name, type) {
2733
+ return memory_exports.Create({ "~kind": "Inferrable" }, { name, type }, {});
2734
+ }
2735
+ function IsInferable(value) {
2736
+ return guard_exports.IsObject(value) && guard_exports.HasPropertyKey(value, "~kind") && guard_exports.HasPropertyKey(value, "name") && guard_exports.HasPropertyKey(value, "type") && guard_exports.IsEqual(value["~kind"], "Inferrable") && guard_exports.IsString(value.name) && guard_exports.IsObject(value.type);
2737
+ }
2738
+ function TryRestInferable(type) {
2739
+ return IsRest(type) ? IsInfer(type.items) ? IsArray2(type.items.extends) ? Inferrable(type.items.name, type.items.extends.items) : IsUnknown(type.items.extends) ? Inferrable(type.items.name, type.items.extends) : void 0 : Unreachable() : void 0;
2740
+ }
2741
+ function TryInferable(type) {
2742
+ return IsInfer(type) ? Inferrable(type.name, type.extends) : void 0;
2743
+ }
2744
+ function TryInferResults(rest, right, result = []) {
2745
+ return guard_exports.ShiftLeft(rest, (head, tail) => Match3(ExtendsLeft({}, head, right), () => TryInferResults(tail, right, [...result, head]), () => void 0), () => result);
2746
+ }
2747
+ function InferTupleResult(inferred, name, left, right) {
2748
+ const results = TryInferResults(left, right);
2749
+ return guard_exports.IsArray(results) ? ExtendsTrue(memory_exports.Assign(inferred, { [name]: Tuple(results) })) : ExtendsFalse();
2750
+ }
2751
+ function InferUnionResult(inferred, name, left, right) {
2752
+ const results = TryInferResults(left, right);
2753
+ return guard_exports.IsArray(results) ? ExtendsTrue(memory_exports.Assign(inferred, { [name]: Union(results) })) : ExtendsFalse();
2754
+ }
2755
+
2756
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/tuple.mjs
2757
+ function Reverse(types) {
2758
+ return [...types].reverse();
2759
+ }
2760
+ function ApplyReverse(types, reversed) {
2761
+ return reversed ? Reverse(types) : types;
2762
+ }
2763
+ function Reversed(types) {
2764
+ const first = types.length > 0 ? types[0] : void 0;
2765
+ const inferrable = IsSchema(first) ? TryRestInferable(first) : void 0;
2766
+ return IsSchema(inferrable);
2767
+ }
2768
+ function ElementsCompare(inferred, reversed, left, leftRest, right, rightRest) {
2769
+ return Match3(ExtendsLeft(inferred, left, right), (checkInferred) => Elements(checkInferred, reversed, leftRest, rightRest), () => ExtendsFalse());
2770
+ }
2771
+ function ElementsLeft(inferred, reversed, leftRest, right, rightRest) {
2772
+ const inferable = TryRestInferable(right);
2773
+ return (
2774
+ // Rest Inferrable Right Means we delegate to TInferTupleResult to Generate a Result
2775
+ IsInferable(inferable) ? InferTupleResult(inferred, inferable["name"], ApplyReverse(leftRest, reversed), inferable["type"]) : guard_exports.ShiftLeft(leftRest, (head, tail) => ElementsCompare(inferred, reversed, head, tail, right, rightRest), () => ExtendsFalse())
2776
+ );
2777
+ }
2778
+ function ElementsRight(inferred, reversed, leftRest, rightRest) {
2779
+ return guard_exports.ShiftLeft(rightRest, (head, tail) => ElementsLeft(inferred, reversed, leftRest, head, tail), () => guard_exports.IsEqual(leftRest.length, 0) ? ExtendsTrue(inferred) : ExtendsFalse());
2780
+ }
2781
+ function Elements(inferred, reversed, leftRest, rightRest) {
2782
+ return ElementsRight(inferred, reversed, leftRest, rightRest);
2783
+ }
2784
+ function ExtendsTupleToTuple(inferred, left, right) {
2785
+ const instantiatedRight = InstantiateElements(inferred, State([], []), right);
2786
+ const reversed = Reversed(instantiatedRight);
2787
+ return Elements(inferred, reversed, ApplyReverse(left, reversed), ApplyReverse(instantiatedRight, reversed));
2788
+ }
2789
+ function ExtendsTupleToArray(inferred, left, right) {
2790
+ const inferrable = TryInferable(right);
2791
+ return IsInferable(inferrable) ? InferUnionResult(inferred, inferrable["name"], left, inferrable["type"]) : guard_exports.ShiftLeft(left, (head, tail) => Match3(ExtendsLeft(inferred, head, right), (inferred2) => ExtendsTupleToArray(inferred2, tail, right), () => ExtendsFalse()), () => ExtendsTrue(inferred));
2792
+ }
2793
+ function ExtendsTuple(inferred, left, right) {
2794
+ const instantiatedLeft = InstantiateElements(inferred, State([], []), left);
2795
+ return IsTuple(right) ? ExtendsTupleToTuple(inferred, instantiatedLeft, right.items) : IsArray2(right) ? ExtendsTupleToArray(inferred, instantiatedLeft, right.items) : ExtendsRight(inferred, Tuple(instantiatedLeft), right);
2796
+ }
2797
+
2798
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/undefined.mjs
2799
+ function ExtendsUndefined(inferred, left, right) {
2800
+ return IsVoid(right) ? ExtendsTrue(inferred) : IsUndefined2(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
2801
+ }
2802
+
2803
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/union.mjs
2804
+ function ExtendsUnionSome(inferred, type, unionTypes) {
2805
+ return guard_exports.ShiftLeft(unionTypes, (head, tail) => Match3(ExtendsLeft(inferred, type, head), (inferred2) => ExtendsTrue(inferred2), () => ExtendsUnionSome(inferred, type, tail)), () => ExtendsFalse());
2806
+ }
2807
+ function ExtendsUnionLeft(inferred, left, right) {
2808
+ return guard_exports.ShiftLeft(left, (head, tail) => Match3(ExtendsUnionSome(inferred, head, right), (inferred2) => ExtendsUnionLeft(inferred2, tail, right), () => ExtendsFalse()), () => ExtendsTrue(inferred));
2809
+ }
2810
+ function ExtendsUnion2(inferred, left, right) {
2811
+ const inferrable = TryInferable(right);
2812
+ return IsInferable(inferrable) ? InferUnionResult(inferred, inferrable.name, left, inferrable.type) : IsUnion(right) ? ExtendsUnionLeft(inferred, left, right.anyOf) : ExtendsUnionLeft(inferred, left, [right]);
2813
+ }
2814
+
2815
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/unknown.mjs
2816
+ function ExtendsUnknown(inferred, left, right) {
2817
+ return IsInfer(right) ? ExtendsRight(inferred, left, right) : IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : ExtendsFalse();
2818
+ }
2819
+
2820
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/void.mjs
2821
+ function ExtendsVoid(inferred, left, right) {
2822
+ return IsVoid(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
2823
+ }
2824
+
2825
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/extends_left.mjs
2826
+ function ExtendsLeft(inferred, left, right) {
2827
+ return IsAny(left) ? ExtendsAny(inferred, left, right) : IsArray2(left) ? ExtendsArray(inferred, left, left.items, right) : IsBigInt2(left) ? ExtendsBigInt(inferred, left, right) : IsBoolean3(left) ? ExtendsBoolean(inferred, left, right) : IsConstructor2(left) ? ExtendsConstructor(inferred, left.parameters, left.instanceType, right) : IsDependent(left) ? ExtendsDependent(inferred, left.if, left.then, left.else, right) : IsEnum(left) ? ExtendsEnum(inferred, left.enum, right) : IsFunction2(left) ? ExtendsFunction(inferred, left.parameters, left.returnType, right) : IsInteger2(left) ? ExtendsInteger(inferred, left, right) : IsIntersect(left) ? ExtendsIntersect(inferred, left.allOf, right) : IsLiteral(left) ? ExtendsLiteral(inferred, left, right) : IsNever(left) ? ExtendsNever(inferred, left, right) : IsNull2(left) ? ExtendsNull(inferred, left, right) : IsNumber3(left) ? ExtendsNumber(inferred, left, right) : IsObject2(left) ? ExtendsObject(inferred, left.properties, right) : IsRecord(left) ? ExtendsRecord(inferred, RecordPattern(left), RecordValue(left), right) : IsString3(left) ? ExtendsString(inferred, left, right) : IsSymbol2(left) ? ExtendsSymbol(inferred, left, right) : IsTemplateLiteral(left) ? ExtendsTemplateLiteral(inferred, left.pattern, right) : IsTuple(left) ? ExtendsTuple(inferred, left.items, right) : IsUndefined2(left) ? ExtendsUndefined(inferred, left, right) : IsUnion(left) ? ExtendsUnion2(inferred, left.anyOf, right) : IsUnknown(left) ? ExtendsUnknown(inferred, left, right) : IsVoid(left) ? ExtendsVoid(inferred, left, right) : ExtendsFalse();
2828
+ }
2829
+
2830
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/interface/instantiate.mjs
2831
+ function InterfaceOperation(heritage, properties) {
2832
+ const result = EvaluateIntersect([...heritage, _Object_(properties)]);
2833
+ return result;
2834
+ }
2835
+ function InterfaceAction(heritage, properties, options) {
2836
+ const result = CanInstantiate(heritage) ? memory_exports.Update(InterfaceOperation(heritage, properties), {}, options) : InterfaceDeferred(heritage, properties, options);
2837
+ return result;
2838
+ }
2839
+ function InterfaceInstantiate(context, state, heritage, properties, options) {
2840
+ const instantiatedHeritage = InstantiateTypes(context, state, heritage);
2841
+ const instantiatedProperties = InstantiateProperties(context, state, properties);
2842
+ return InterfaceAction(instantiatedHeritage, instantiatedProperties, options);
2843
+ }
2844
+
2845
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/interface.mjs
2846
+ function InterfaceDeferred(heritage, properties, options = {}) {
2847
+ return Deferred("Interface", [heritage, properties], options);
2848
+ }
2849
+ function IsInterfaceDeferred(value) {
2850
+ return IsSchema(value) && guard_exports.HasPropertyKey(value, "action") && guard_exports.IsEqual(value.action, "Interface");
2851
+ }
2852
+ function Interface(heritage, properties, options = {}) {
2853
+ return InterfaceAction(heritage, properties, options);
2854
+ }
2855
+
2856
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/cyclic/check.mjs
2857
+ function FromRef(stack, context, ref) {
2858
+ return stack.includes(ref) ? true : FromType3([...stack, ref], context, context[ref]);
2859
+ }
2860
+ function FromProperties(stack, context, properties) {
2861
+ const types = PropertyValues(properties);
2862
+ return FromTypes2(stack, context, types);
2863
+ }
2864
+ function FromTypes2(stack, context, types) {
2865
+ return guard_exports.ShiftLeft(types, (left, right) => FromType3(stack, context, left) ? true : FromTypes2(stack, context, right), () => false);
2866
+ }
2867
+ function FromType3(stack, context, type) {
2868
+ return IsRef(type) ? FromRef(stack, context, type.$ref) : IsArray2(type) ? FromType3(stack, context, type.items) : IsConstructor2(type) ? FromTypes2(stack, context, [...type.parameters, type.instanceType]) : IsFunction2(type) ? FromTypes2(stack, context, [...type.parameters, type.returnType]) : IsInterfaceDeferred(type) ? FromProperties(stack, context, type.parameters[1]) : IsIntersect(type) ? FromTypes2(stack, context, type.allOf) : IsObject2(type) ? FromProperties(stack, context, type.properties) : IsUnion(type) ? FromTypes2(stack, context, type.anyOf) : IsTuple(type) ? FromTypes2(stack, context, type.items) : IsRecord(type) ? FromType3(stack, context, RecordValue(type)) : false;
2869
+ }
2870
+ function CyclicCheck(stack, context, type) {
2871
+ const result = FromType3(stack, context, type);
2872
+ return result;
2873
+ }
2874
+
2875
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/cyclic/candidates.mjs
2876
+ function ResolveCandidateKeys(context, keys) {
2877
+ return keys.reduce((result, left) => {
2878
+ return CyclicCheck([left], context, context[left]) ? [...result, left] : result;
2879
+ }, []);
2880
+ }
2881
+ function CyclicCandidates(context) {
2882
+ const keys = PropertyKeys(context);
2883
+ const result = ResolveCandidateKeys(context, keys);
2884
+ return result;
2885
+ }
2886
+
2887
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs
2888
+ function FromRef2(context, ref, result) {
2889
+ return result.includes(ref) ? result : ref in context ? FromType4(context, context[ref], [...result, ref]) : Unreachable();
2890
+ }
2891
+ function FromProperties2(context, properties, result) {
2892
+ const types = PropertyValues(properties);
2893
+ return FromTypes3(context, types, result);
2894
+ }
2895
+ function FromTypes3(context, types, result) {
2896
+ return types.reduce((result2, left) => {
2897
+ return FromType4(context, left, result2);
2898
+ }, result);
2899
+ }
2900
+ function FromType4(context, type, result) {
2901
+ return IsRef(type) ? FromRef2(context, type.$ref, result) : IsArray2(type) ? FromType4(context, type.items, result) : IsConstructor2(type) ? FromTypes3(context, [...type.parameters, type.instanceType], result) : IsFunction2(type) ? FromTypes3(context, [...type.parameters, type.returnType], result) : IsInterfaceDeferred(type) ? FromProperties2(context, type.parameters[1], result) : IsIntersect(type) ? FromTypes3(context, type.allOf, result) : IsObject2(type) ? FromProperties2(context, type.properties, result) : IsUnion(type) ? FromTypes3(context, type.anyOf, result) : IsTuple(type) ? FromTypes3(context, type.items, result) : IsRecord(type) ? FromType4(context, RecordValue(type), result) : result;
2902
+ }
2903
+ function CyclicDependencies(context, key, type) {
2904
+ const result = FromType4(context, type, [key]);
2905
+ return result;
2906
+ }
2907
+
2908
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/cyclic/extends.mjs
2909
+ function FromRef3(_ref) {
2910
+ return Any();
2911
+ }
2912
+ function FromProperties3(properties) {
2913
+ return guard_exports.Keys(properties).reduce((result, key) => {
2914
+ return { ...result, [key]: FromType5(properties[key]) };
2915
+ }, {});
2916
+ }
2917
+ function FromTypes4(types) {
2918
+ return types.reduce((result, left) => {
2919
+ return [...result, FromType5(left)];
2920
+ }, []);
2921
+ }
2922
+ function FromType5(type) {
2923
+ return IsRef(type) ? FromRef3(type.$ref) : IsArray2(type) ? _Array_(FromType5(type.items), ArrayOptions(type)) : IsConstructor2(type) ? Constructor(FromTypes4(type.parameters), FromType5(type.instanceType)) : IsFunction2(type) ? _Function_(FromTypes4(type.parameters), FromType5(type.returnType)) : IsIntersect(type) ? Intersect(FromTypes4(type.allOf)) : IsObject2(type) ? _Object_(FromProperties3(type.properties)) : IsRecord(type) ? Record(RecordKey(type), FromType5(RecordValue(type))) : IsUnion(type) ? Union(FromTypes4(type.anyOf)) : IsTuple(type) ? Tuple(FromTypes4(type.items)) : type;
2924
+ }
2925
+ function CyclicAnyFromParameters(defs, ref) {
2926
+ return ref in defs ? FromType5(defs[ref]) : Unknown();
2927
+ }
2928
+ function CyclicExtends(type) {
2929
+ return CyclicAnyFromParameters(type.$defs, type.$ref);
2930
+ }
2931
+
2932
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs
2933
+ function CyclicInterface(context, heritage, properties) {
2934
+ const instantiatedHeritage = InstantiateTypes(context, State([], []), heritage);
2935
+ const instantiatedProperties = InstantiateProperties({}, State([], []), properties);
2936
+ const evaluatedInterface = EvaluateIntersect([...instantiatedHeritage, _Object_(instantiatedProperties)]);
2937
+ return evaluatedInterface;
2938
+ }
2939
+ function CyclicDefinitions(context, dependencies) {
2940
+ const keys = guard_exports.Keys(context).filter((key) => dependencies.includes(key));
2941
+ return keys.reduce((result, key) => {
2942
+ const type = context[key];
2943
+ const instantiatedType = IsInterfaceDeferred(type) ? CyclicInterface(context, type.parameters[0], type.parameters[1]) : type;
2944
+ return { ...result, [key]: instantiatedType };
2945
+ }, {});
2946
+ }
2947
+ function InstantiateCyclic(context, ref, type) {
2948
+ const dependencies = CyclicDependencies(context, ref, type);
2949
+ const definitions = CyclicDefinitions(context, dependencies);
2950
+ const result = Cyclic(definitions, ref);
2951
+ return result;
2952
+ }
2953
+
2954
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/cyclic/target.mjs
2955
+ function Resolve(defs, ref) {
2956
+ return ref in defs ? IsRef(defs[ref]) ? Resolve(defs, defs[ref].$ref) : defs[ref] : Never();
2957
+ }
2958
+ function CyclicTarget(defs, ref) {
2959
+ const result = Resolve(defs, ref);
2960
+ return result;
2961
+ }
2962
+
2963
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/extends/extends.mjs
2964
+ function Canonical(type) {
2965
+ return IsCyclic(type) ? CyclicExtends(type) : IsUnsafe(type) ? Unknown() : type;
2966
+ }
2967
+ function Extends(inferred, left, right) {
2968
+ const canonicalLeft = Canonical(left);
2969
+ const canonicalRight = Canonical(right);
2970
+ return ExtendsLeft(inferred, canonicalLeft, canonicalRight);
2971
+ }
2972
+
2973
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/evaluate/compare.mjs
2974
+ var CompareResultEqual = 0;
2975
+ var CompareResultDisjoint = 1;
2976
+ var CompareResultLeftInside = 2;
2977
+ var CompareResultRightInside = 3;
2978
+ function Compare(left, right) {
2979
+ const extendsCheck = [Extends({}, left, right), Extends({}, right, left)];
2980
+ return result_exports.IsExtendsTrueLike(extendsCheck[0]) && result_exports.IsExtendsTrueLike(extendsCheck[1]) ? CompareResultEqual : result_exports.IsExtendsTrueLike(extendsCheck[0]) && result_exports.IsExtendsFalse(extendsCheck[1]) ? CompareResultLeftInside : result_exports.IsExtendsFalse(extendsCheck[0]) && result_exports.IsExtendsTrueLike(extendsCheck[1]) ? CompareResultRightInside : CompareResultDisjoint;
2981
+ }
2982
+
2983
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/evaluate/broaden.mjs
2984
+ function BroadenFilter(type, types, result = [], all = types) {
2985
+ return guard_exports.ShiftLeft(types, (left, right) => {
2986
+ const compare = Compare(type, left);
2987
+ return guard_exports.IsEqual(compare, CompareResultLeftInside) || guard_exports.IsEqual(compare, CompareResultEqual) ? all : guard_exports.IsEqual(compare, CompareResultDisjoint) ? BroadenFilter(type, right, [...result, left], all) : BroadenFilter(type, right, result, all);
2988
+ }, () => [...result, type]);
2989
+ }
2990
+ function BroadenType(type, types, result) {
2991
+ const evaluated = EvaluateType(type);
2992
+ return IsAny(evaluated) ? [evaluated] : (
2993
+ // terminate (always the most broad)
2994
+ IsUnknown(evaluated) ? [evaluated] : (
2995
+ // terminate (always the most broad)
2996
+ IsNever(evaluated) ? BroadenTypes(types, result) : (
2997
+ // ignored: never is dropped
2998
+ IsObject2(evaluated) ? BroadenTypes(types, [...result, evaluated]) : (
2999
+ // objects are always considered (too expensive to compare)
3000
+ BroadenTypes(types, BroadenFilter(evaluated, result))
3001
+ )
3002
+ )
3003
+ )
3004
+ );
3005
+ }
3006
+ function BroadenTypes(types, result = []) {
3007
+ return guard_exports.ShiftLeft(types, (left, right) => BroadenType(left, right, result), () => result);
3008
+ }
3009
+ function Broaden(types) {
3010
+ const broadened = BroadenTypes(types);
3011
+ const flattened = Flatten(broadened);
3012
+ return flattened;
3013
+ }
3014
+
3015
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/evaluate/instantiate.mjs
3016
+ function EvaluateAction(type, options) {
3017
+ const result = memory_exports.Update(EvaluateType(type), {}, options);
3018
+ return result;
3019
+ }
3020
+ function EvaluateInstantiate(context, state, type, options) {
3021
+ const instantiatedType = InstantiateType(context, state, type);
3022
+ return EvaluateAction(instantiatedType, options);
3023
+ }
3024
+
3025
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs
3026
+ function CollectDistributionNames(expression, result = []) {
3027
+ return (
3028
+ // Conditional
3029
+ IsDeferred(expression) && guard_exports.IsEqual(expression.action, "Conditional") ? IsRef(expression.parameters[0]) ? CollectDistributionNames(expression.parameters[2], CollectDistributionNames(expression.parameters[3], [...result, expression.parameters[0]["$ref"]])) : CollectDistributionNames(expression.parameters[2], CollectDistributionNames(expression.parameters[3], result)) : IsDeferred(expression) && guard_exports.IsEqual(expression.action, "Mapped") ? IsDeferred(expression.parameters[1]) && guard_exports.IsEqual(expression.parameters[1].action, "KeyOf") && IsRef(expression.parameters[1].parameters[0]) ? [...result, expression.parameters[1].parameters[0]["$ref"]] : result : result
3030
+ );
3031
+ }
3032
+ function BuildDistributionArray(parameters2, names) {
3033
+ return parameters2.reduce((result, left) => [...result, names.includes(left.name)], []);
3034
+ }
3035
+ function ZipDistributionArray(arguments_, distributionArray, result = []) {
3036
+ return guard_exports.ShiftLeft(arguments_, (argumentLeft, argumentRight) => guard_exports.ShiftLeft(distributionArray, (booleanLeft, booleanRight) => ZipDistributionArray(argumentRight, booleanRight, [...result, [booleanLeft, argumentLeft]]), () => result), () => result);
3037
+ }
3038
+ function CanonicalArgument(type) {
3039
+ return IsTemplateLiteral(type) ? EvaluateTemplateLiteral(type.pattern) : IsEnum(type) ? EvaluateEnum(type.enum) : type;
3040
+ }
3041
+ function Expand(type) {
3042
+ const canonicalArgument = CanonicalArgument(type);
3043
+ return IsUnion(canonicalArgument) ? [...canonicalArgument.anyOf] : [canonicalArgument];
3044
+ }
3045
+ function Append(current, type) {
3046
+ return current.reduce((result, left) => [...result, [...left, type]], []);
3047
+ }
3048
+ function Cross(current, variants) {
3049
+ return variants.reduce((result, left) => {
3050
+ return [...result, ...Append(current, left)];
3051
+ }, []);
3052
+ }
3053
+ function Distribute2(zipped) {
3054
+ return zipped.reduce((result, left) => {
3055
+ return guard_exports.IsEqual(left[0], true) ? Cross(result, Expand(left[1])) : Cross(result, [left[1]]);
3056
+ }, [[]]);
3057
+ }
3058
+ function DistributeArguments(parameters2, arguments_, expression) {
3059
+ const distributionNames = CollectDistributionNames(expression);
3060
+ const distributionArray = BuildDistributionArray(parameters2, distributionNames);
3061
+ const zippedArguments = ZipDistributionArray(arguments_, distributionArray);
3062
+ return IsDeferred(expression) && guard_exports.IsEqual(expression.action, "Conditional") ? Distribute2(zippedArguments) : IsDeferred(expression) && guard_exports.IsEqual(expression.action, "Mapped") ? Distribute2(zippedArguments) : [arguments_];
3063
+ }
3064
+
3065
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/call/resolve_target.mjs
3066
+ function FromNotResolvable() {
3067
+ return ["(not-resolvable)", Never()];
3068
+ }
3069
+ function FromNotGeneric() {
3070
+ return ["(not-generic)", Never()];
3071
+ }
3072
+ function FromGeneric(name, parameters2, expression) {
3073
+ return [name, Generic(parameters2, expression)];
3074
+ }
3075
+ function FromRef4(context, ref, arguments_) {
3076
+ return ref in context ? FromType6(context, ref, context[ref], arguments_) : FromNotResolvable();
3077
+ }
3078
+ function FromType6(context, name, target, arguments_) {
3079
+ return IsGeneric(target) ? FromGeneric(name, target.parameters, target.expression) : IsRef(target) ? FromRef4(context, target.$ref, arguments_) : FromNotGeneric();
3080
+ }
3081
+ function ResolveTarget(context, target, arguments_) {
3082
+ return FromType6(context, "(anonymous)", target, arguments_);
3083
+ }
3084
+
3085
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs
3086
+ function AssertArgumentExtends(name, type, extends_) {
3087
+ if (IsInfer(type) || IsCall(type) || result_exports.IsExtendsTrueLike(Extends({}, type, extends_)))
3088
+ return;
3089
+ const cause = { parameter: name, expect: extends_, actual: type };
3090
+ throw new Error(`Argument for parameter ${name} does not satisfy constraint`, { cause });
3091
+ }
3092
+ function BindArgument(context, state, name, extends_, type) {
3093
+ const instantiatedArgument = InstantiateType(context, state, type);
3094
+ AssertArgumentExtends(name, instantiatedArgument, extends_);
3095
+ return memory_exports.Assign(context, { [name]: instantiatedArgument });
3096
+ }
3097
+ function BindArguments(context, state, parameterLeft, parameterRight, arguments_) {
3098
+ const instantiatedExtends = InstantiateType(context, state, parameterLeft.extends);
3099
+ const instantiatedEquals = InstantiateType(context, state, parameterLeft.equals);
3100
+ return guard_exports.ShiftLeft(arguments_, (left, right) => BindParameters(BindArgument(context, state, parameterLeft["name"], instantiatedExtends, left), state, parameterRight, right), () => BindParameters(BindArgument(context, state, parameterLeft["name"], instantiatedExtends, instantiatedEquals), state, parameterRight, []));
3101
+ }
3102
+ function BindParameters(context, state, parameters2, arguments_) {
3103
+ return guard_exports.ShiftLeft(parameters2, (left, right) => BindArguments(context, state, left, right, arguments_), () => context);
3104
+ }
3105
+ function ResolveArgumentsContext(context, state, parameters2, arguments_) {
3106
+ return BindParameters(context, state, parameters2, arguments_);
3107
+ }
3108
+
3109
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/call/instantiate.mjs
3110
+ var instantiationDepth = 0;
3111
+ var instantiationCount = 0;
3112
+ function InstantiationAssert() {
3113
+ if (guard_exports.IsLessThan(instantiationCount, settings_exports.Get().maxInstantiationCount))
3114
+ return;
3115
+ throw Error("Type instantiation is excessively deep and possibly infinite");
3116
+ }
3117
+ function InstantiationIncrement() {
3118
+ InstantiationAssert();
3119
+ instantiationCount++;
3120
+ instantiationDepth++;
3121
+ }
3122
+ function InstantiationDecrement() {
3123
+ instantiationDepth--;
3124
+ if (guard_exports.IsEqual(instantiationDepth, 0))
3125
+ instantiationCount = 0;
3126
+ }
3127
+ function Peek(state) {
3128
+ const result = guard_exports.IsGreaterThan(state.callstack.length, 0) ? state.callstack[state.callstack.length - 1] : "";
3129
+ return result;
3130
+ }
3131
+ function IsTailCall(state, name) {
3132
+ const result = guard_exports.IsEqual(Peek(state), name);
3133
+ return result;
3134
+ }
3135
+ function CallDispatch(context, state, target, parameters2, expression, arguments_) {
3136
+ InstantiationIncrement();
3137
+ try {
3138
+ const argumentsContext = ResolveArgumentsContext(context, state, parameters2, arguments_);
3139
+ const returnType = InstantiateType(argumentsContext, State([...state["callstack"], target["$ref"]], state["visited"]), expression);
3140
+ return InstantiateType(argumentsContext, State([], []), returnType);
3141
+ } finally {
3142
+ InstantiationDecrement();
3143
+ }
3144
+ }
3145
+ function CallDistributed(context, state, target, parameters2, expression, distributedArguments) {
3146
+ return distributedArguments.reduce((result, arguments_) => {
3147
+ const returnType = CallDispatch(context, state, target, parameters2, expression, arguments_);
3148
+ return [...result, returnType];
3149
+ }, []);
3150
+ }
3151
+ function CallImmediate(context, state, target, parameters2, expression, arguments_) {
3152
+ const distributedArguments = DistributeArguments(parameters2, arguments_, expression);
3153
+ const returnTypes = CallDistributed(context, state, target, parameters2, expression, distributedArguments);
3154
+ const result = guard_exports.IsEqual(returnTypes.length, 1) ? returnTypes[0] : EvaluateUnion(returnTypes);
3155
+ return result;
3156
+ }
3157
+ function CallInstantiate(context, state, target, arguments_) {
3158
+ const instantiatedArguments = InstantiateTypes(context, state, arguments_);
3159
+ const resolved = ResolveTarget(context, target, arguments_);
3160
+ const name = resolved[0];
3161
+ const type = resolved[1];
3162
+ const result = IsGeneric(type) ? IsTailCall(state, name) ? CallConstruct(Ref(name), instantiatedArguments) : CallImmediate(context, state, Ref(name), type.parameters, type.expression, instantiatedArguments) : CallConstruct(target, instantiatedArguments);
3163
+ return result;
3164
+ }
3165
+
3166
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/types/call.mjs
3167
+ function CallConstruct(target, arguments_) {
3168
+ return memory_exports.Create({ ["~kind"]: "Call" }, { type: "call", target, arguments: arguments_ }, {});
3169
+ }
3170
+ function Call(target, arguments_) {
3171
+ return CallInstantiate({}, State([], []), target, arguments_);
3172
+ }
3173
+ function IsCall(value) {
3174
+ return IsKind(value, "Call");
3175
+ }
3176
+
3177
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs
3178
+ function RemoveImmutableOperation(type) {
3179
+ return memory_exports.Discard(type, ["~immutable"]);
3180
+ }
3181
+ function RemoveImmutableAction(type, options) {
3182
+ const result = memory_exports.Update(RemoveImmutableOperation(type), {}, options);
3183
+ return result;
3184
+ }
3185
+ function RemoveImmutableInstantiate(context, state, type, options) {
3186
+ const instantiatedType = InstantiateType(context, state, type);
3187
+ return RemoveImmutableAction(instantiatedType, options);
3188
+ }
3189
+
3190
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/intrinsics/mapping.mjs
3191
+ function ApplyMapping(mapping, value) {
3192
+ return mapping(value);
3193
+ }
3194
+
3195
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/intrinsics/from_literal.mjs
3196
+ function FromLiteral3(mapping, value) {
3197
+ return guard_exports.IsString(value) ? Literal(ApplyMapping(mapping, value)) : Literal(value);
3198
+ }
3199
+
3200
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs
3201
+ function FromTemplateLiteral(mapping, pattern) {
3202
+ const evaluated = EvaluateTemplateLiteral(pattern);
3203
+ const result = FromType7(mapping, evaluated);
3204
+ return result;
3205
+ }
3206
+
3207
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/intrinsics/from_union.mjs
3208
+ function FromUnion2(mapping, types) {
3209
+ const result = types.map((type) => FromType7(mapping, type));
3210
+ return Union(result);
3211
+ }
3212
+
3213
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/intrinsics/from_type.mjs
3214
+ function FromType7(mapping, type) {
3215
+ return IsLiteral(type) ? FromLiteral3(mapping, type.const) : IsTemplateLiteral(type) ? FromTemplateLiteral(mapping, type.pattern) : IsUnion(type) ? FromUnion2(mapping, type.anyOf) : type;
3216
+ }
3217
+
3218
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/capitalize.mjs
3219
+ function CapitalizeDeferred(type, options = {}) {
3220
+ return Deferred("Capitalize", [type], options);
3221
+ }
3222
+ function Capitalize(type, options = {}) {
3223
+ return CapitalizeAction(type, options);
3224
+ }
3225
+
3226
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/lowercase.mjs
3227
+ function LowercaseDeferred(type, options = {}) {
3228
+ return Deferred("Lowercase", [type], options);
3229
+ }
3230
+ function Lowercase(type, options = {}) {
3231
+ return LowercaseAction(type, options);
3232
+ }
3233
+
3234
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/uncapitalize.mjs
3235
+ function UncapitalizeDeferred(type, options = {}) {
3236
+ return Deferred("Uncapitalize", [type], options);
3237
+ }
3238
+ function Uncapitalize(type, options = {}) {
3239
+ return UncapitalizeAction(type, options);
3240
+ }
3241
+
3242
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/uppercase.mjs
3243
+ function UppercaseDeferred(type, options = {}) {
3244
+ return Deferred("Uppercase", [type], options);
3245
+ }
3246
+ function Uppercase(type, options = {}) {
3247
+ return UppercaseAction(type, options);
3248
+ }
3249
+
3250
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/intrinsics/instantiate.mjs
3251
+ var CapitalizeMapping = (input) => input[0].toUpperCase() + input.slice(1);
3252
+ var LowercaseMapping = (input) => input.toLowerCase();
3253
+ var UncapitalizeMapping = (input) => input[0].toLowerCase() + input.slice(1);
3254
+ var UppercaseMapping = (input) => input.toUpperCase();
3255
+ function CapitalizeAction(type, options) {
3256
+ const result = CanInstantiate([type]) ? memory_exports.Update(FromType7(CapitalizeMapping, type), {}, options) : CapitalizeDeferred(type, options);
3257
+ return result;
3258
+ }
3259
+ function LowercaseAction(type, options) {
3260
+ const result = CanInstantiate([type]) ? memory_exports.Update(FromType7(LowercaseMapping, type), {}, options) : LowercaseDeferred(type, options);
3261
+ return result;
3262
+ }
3263
+ function UncapitalizeAction(type, options) {
3264
+ const result = CanInstantiate([type]) ? memory_exports.Update(FromType7(UncapitalizeMapping, type), {}, options) : UncapitalizeDeferred(type, options);
3265
+ return result;
3266
+ }
3267
+ function UppercaseAction(type, options) {
3268
+ const result = CanInstantiate([type]) ? memory_exports.Update(FromType7(UppercaseMapping, type), {}, options) : UppercaseDeferred(type, options);
3269
+ return result;
3270
+ }
3271
+ function CapitalizeInstantiate(context, state, type, options) {
3272
+ const instantiatedType = InstantiateType(context, state, type);
3273
+ return CapitalizeAction(instantiatedType, options);
3274
+ }
3275
+ function LowercaseInstantiate(context, state, type, options) {
3276
+ const instantiatedType = InstantiateType(context, state, type);
3277
+ return LowercaseAction(instantiatedType, options);
3278
+ }
3279
+ function UncapitalizeInstantiate(context, state, type, options) {
3280
+ const instantiatedType = InstantiateType(context, state, type);
3281
+ return UncapitalizeAction(instantiatedType, options);
3282
+ }
3283
+ function UppercaseInstantiate(context, state, type, options) {
3284
+ const instantiatedType = InstantiateType(context, state, type);
3285
+ return UppercaseAction(instantiatedType, options);
3286
+ }
3287
+
3288
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/conditional.mjs
3289
+ function ConditionalDeferred(left, right, true_, false_, options = {}) {
3290
+ return Deferred("Conditional", [left, right, true_, false_], options);
3291
+ }
3292
+ function Conditional(left, right, true_, false_, options = {}) {
3293
+ return ConditionalAction({}, State([], []), left, right, true_, false_, options);
3294
+ }
3295
+
3296
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/conditional/instantiate.mjs
3297
+ function ConditionalOperation(context, state, left, right, true_, false_) {
3298
+ const extendsResult = Extends(context, left, right);
3299
+ return result_exports.IsExtendsUnion(extendsResult) ? Union([InstantiateType(extendsResult.inferred, state, true_), InstantiateType(context, state, false_)]) : result_exports.IsExtendsTrue(extendsResult) ? InstantiateType(extendsResult.inferred, state, true_) : InstantiateType(context, state, false_);
3300
+ }
3301
+ function ConditionalAction(context, state, left, right, true_, false_, options) {
3302
+ const result = CanInstantiate([left, right]) ? memory_exports.Update(ConditionalOperation(context, state, left, right, true_, false_), {}, options) : ConditionalDeferred(left, right, true_, false_, options);
3303
+ return result;
3304
+ }
3305
+ function ConditionalInstantiate(context, state, left, right, true_, false_, options) {
3306
+ const instantiatedLeft = InstantiateType(context, state, left);
3307
+ const instantiatedRight = InstantiateType(context, state, right);
3308
+ return ConditionalAction(context, state, instantiatedLeft, instantiatedRight, true_, false_, options);
3309
+ }
3310
+
3311
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/constructor_parameters.mjs
3312
+ function ConstructorParametersDeferred(type, options = {}) {
3313
+ return Deferred("ConstructorParameters", [type], options);
3314
+ }
3315
+ function ConstructorParameters(type, options = {}) {
3316
+ return ConstructorParametersAction(type, options);
3317
+ }
3318
+
3319
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs
3320
+ function ConstructorParametersOperation(type) {
3321
+ const parameters2 = IsConstructor2(type) ? type["parameters"] : [];
3322
+ const instantiatedParameters = InstantiateElements({}, State([], []), parameters2);
3323
+ const result = Tuple(instantiatedParameters);
3324
+ return result;
3325
+ }
3326
+ function ConstructorParametersAction(type, options) {
3327
+ const result = CanInstantiate([type]) ? memory_exports.Update(ConstructorParametersOperation(type), {}, options) : ConstructorParametersDeferred(type, options);
3328
+ return result;
3329
+ }
3330
+ function ConstructorParametersInstantiate(context, state, type, options) {
3331
+ const instantiatedType = InstantiateType(context, state, type);
3332
+ return ConstructorParametersAction(instantiatedType, options);
3333
+ }
3334
+
3335
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/exclude.mjs
3336
+ function ExcludeDeferred(left, right, options = {}) {
3337
+ return Deferred("Exclude", [left, right], options);
3338
+ }
3339
+ function Exclude(left, right, options = {}) {
3340
+ return ExcludeAction(left, right, options);
3341
+ }
3342
+
3343
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/exclude/instantiate.mjs
3344
+ function ExcludeAction(left, right, options) {
3345
+ const result = CanInstantiate([left, right]) ? memory_exports.Update(ExcludeOperation(left, right), {}, options) : ExcludeDeferred(left, right, options);
3346
+ return result;
3347
+ }
3348
+ function ExcludeInstantiate(context, state, left, right, options) {
3349
+ const instantiatedLeft = InstantiateType(context, state, left);
3350
+ const instantiatedRight = InstantiateType(context, state, right);
3351
+ return ExcludeAction(instantiatedLeft, instantiatedRight, options);
3352
+ }
3353
+
3354
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/extract.mjs
3355
+ function ExtractDeferred(left, right, options = {}) {
3356
+ return Deferred("Extract", [left, right], options);
3357
+ }
3358
+ function Extract(left, right, options = {}) {
3359
+ return ExtractAction(left, right, options);
3360
+ }
3361
+
3362
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/extract/operation.mjs
3363
+ function ExtractType(left, right) {
3364
+ const check = Extends({}, left, right);
3365
+ const result = result_exports.IsExtendsTrueLike(check) ? [left] : [];
3366
+ return result;
3367
+ }
3368
+ function ExtractUnion(left, right, result = []) {
3369
+ return guard_exports.ShiftLeft(left, (head, tail) => ExtractUnion(tail, right, [...result, ...ExtractType(head, right)]), () => result);
3370
+ }
3371
+ function ExtractOperation(left, right) {
3372
+ const evaluated = EvaluateType(left);
3373
+ const canonical = IsUnion(evaluated) ? evaluated.anyOf : [evaluated];
3374
+ const remaining = ExtractUnion(canonical, right);
3375
+ const result = EvaluateUnion(remaining);
3376
+ return result;
3377
+ }
3378
+
3379
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/extract/instantiate.mjs
3380
+ function ExtractAction(left, right, options) {
3381
+ const result = CanInstantiate([left, right]) ? memory_exports.Update(ExtractOperation(left, right), {}, options) : ExtractDeferred(left, right, options);
3382
+ return result;
3383
+ }
3384
+ function ExtractInstantiate(context, state, left, right, options) {
3385
+ const instantiatedLeft = InstantiateType(context, state, left);
3386
+ const instantiatedRight = InstantiateType(context, state, right);
3387
+ return ExtractAction(instantiatedLeft, instantiatedRight, options);
3388
+ }
3389
+
3390
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/helpers/keys_to_indexer.mjs
3391
+ function KeysToLiterals(keys) {
3392
+ return keys.reduce((result, left) => {
3393
+ return IsLiteralValue(left) ? [...result, Literal(left)] : result;
3394
+ }, []);
3395
+ }
3396
+ function KeysToIndexer(keys) {
3397
+ const literals = KeysToLiterals(keys);
3398
+ const result = Union(literals);
3399
+ return result;
3400
+ }
3401
+
3402
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/indexed.mjs
3403
+ function IndexDeferred(type, indexer, options = {}) {
3404
+ return Deferred("Index", [type, indexer], options);
3405
+ }
3406
+ function Index(type, indexer_or_keys, options = {}) {
3407
+ const indexer = guard_exports.IsArray(indexer_or_keys) ? KeysToIndexer(indexer_or_keys) : indexer_or_keys;
3408
+ return IndexAction(type, indexer, options);
3409
+ }
3410
+
3411
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/object/from_cyclic.mjs
3412
+ function FromCyclic(defs, ref) {
3413
+ const target = CyclicTarget(defs, ref);
3414
+ const result = FromType8(target);
3415
+ return result;
3416
+ }
3417
+
3418
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/object/from_dependent.mjs
3419
+ function FromDependent(if_, then_, else_) {
3420
+ const evaluated = EvaluateDependent(if_, then_, else_);
3421
+ const result = FromType8(evaluated);
3422
+ return result;
3423
+ }
3424
+
3425
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/object/from_intersect.mjs
3426
+ function CollapseIntersectProperties(left, right) {
3427
+ const leftKeys = guard_exports.Keys(left).filter((key) => !guard_exports.HasPropertyKey(right, key));
3428
+ const rightKeys = guard_exports.Keys(right).filter((key) => !guard_exports.HasPropertyKey(left, key));
3429
+ const sharedKeys = guard_exports.Keys(left).filter((key) => guard_exports.HasPropertyKey(right, key));
3430
+ const leftProperties = leftKeys.reduce((result, key) => ({ ...result, [key]: left[key] }), {});
3431
+ const rightProperties = rightKeys.reduce((result, key) => ({ ...result, [key]: right[key] }), {});
3432
+ const sharedProperties = sharedKeys.reduce((result, key) => ({ ...result, [key]: EvaluateIntersect([left[key], right[key]]) }), {});
3433
+ const unique = memory_exports.Assign(leftProperties, rightProperties);
3434
+ const shared = memory_exports.Assign(unique, sharedProperties);
3435
+ return shared;
3436
+ }
3437
+ function FromIntersect(types) {
3438
+ return types.reduce((result, left) => {
3439
+ return CollapseIntersectProperties(result, FromType8(left));
3440
+ }, {});
3441
+ }
3442
+
3443
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/object/from_object.mjs
3444
+ function FromObject3(properties) {
3445
+ return properties;
3446
+ }
3447
+
3448
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/object/from_tuple.mjs
3449
+ function FromTuple(types) {
3450
+ const object = TupleToObject(Tuple(types));
3451
+ const result = FromType8(object);
3452
+ return result;
3453
+ }
3454
+
3455
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/object/from_union.mjs
3456
+ function CollapseUnionProperties(left, right) {
3457
+ const sharedKeys = guard_exports.Keys(left).filter((key) => key in right);
3458
+ const result = sharedKeys.reduce((result2, key) => {
3459
+ return { ...result2, [key]: EvaluateUnion([left[key], right[key]]) };
3460
+ }, {});
3461
+ return result;
3462
+ }
3463
+ function ReduceVariants(types, result) {
3464
+ return guard_exports.ShiftLeft(types, (left, right) => ReduceVariants(right, CollapseUnionProperties(result, FromType8(left))), () => result);
3465
+ }
3466
+ function FromUnion3(types) {
3467
+ return guard_exports.ShiftLeft(types, (left, right) => ReduceVariants(right, FromType8(left)), () => Unreachable());
3468
+ }
3469
+
3470
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/object/from_type.mjs
3471
+ function FromType8(type) {
3472
+ return IsCyclic(type) ? FromCyclic(type.$defs, type.$ref) : IsDependent(type) ? FromDependent(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect(type.allOf) : IsUnion(type) ? FromUnion3(type.anyOf) : IsTuple(type) ? FromTuple(type.items) : IsObject2(type) ? FromObject3(type.properties) : {};
3473
+ }
3474
+
3475
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/object/collapse.mjs
3476
+ function CollapseToObject(type) {
3477
+ const properties = FromType8(type);
3478
+ const result = _Object_(properties);
3479
+ return result;
3480
+ }
3481
+
3482
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/helpers/keys.mjs
3483
+ var integerKeyPattern = new RegExp("^(?:0|[1-9][0-9]*)$");
3484
+ function ConvertToIntegerKey(value) {
3485
+ const normal = `${value}`;
3486
+ return integerKeyPattern.test(normal) ? parseInt(normal) : value;
3487
+ }
3488
+
3489
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexed/from_array.mjs
3490
+ function NormalizeLiteral(value) {
3491
+ return Literal(ConvertToIntegerKey(value));
3492
+ }
3493
+ function NormalizeIndexerTypes(types) {
3494
+ return types.map((type) => NormalizeIndexer(type));
3495
+ }
3496
+ function NormalizeIndexer(type) {
3497
+ return IsIntersect(type) ? Intersect(NormalizeIndexerTypes(type.allOf)) : IsUnion(type) ? Union(NormalizeIndexerTypes(type.anyOf)) : IsLiteral(type) ? NormalizeLiteral(type.const) : type;
3498
+ }
3499
+ function FromArray2(type, indexer) {
3500
+ const normalizedIndexer = NormalizeIndexer(indexer);
3501
+ const check = Extends({}, normalizedIndexer, Number2());
3502
+ const result = (
3503
+ // indexer
3504
+ result_exports.IsExtendsTrueLike(check) ? type : IsLiteral(indexer) && guard_exports.IsEqual(indexer.const, "length") ? Number2() : Never()
3505
+ );
3506
+ return result;
3507
+ }
3508
+
3509
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexable/from_cyclic.mjs
3510
+ function FromCyclic2(defs, ref) {
3511
+ const target = CyclicTarget(defs, ref);
3512
+ const result = FromType9(target);
3513
+ return result;
3514
+ }
3515
+
3516
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs
3517
+ function FromDependent2(if_, then_, else_) {
3518
+ const evaluated = EvaluateDependent(if_, then_, else_);
3519
+ const result = FromType9(evaluated);
3520
+ return result;
3521
+ }
3522
+
3523
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexable/from_enum.mjs
3524
+ function FromEnum(values) {
3525
+ const evaluated = EvaluateEnum(values);
3526
+ const result = FromType9(evaluated);
3527
+ return result;
3528
+ }
3529
+
3530
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexable/from_intersect.mjs
3531
+ function FromIntersect2(types) {
3532
+ const evaluated = EvaluateIntersect(types);
3533
+ const result = FromType9(evaluated);
3534
+ return result;
3535
+ }
3536
+
3537
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexable/from_literal.mjs
3538
+ function FromLiteral4(value) {
3539
+ const result = [`${value}`];
3540
+ return result;
3541
+ }
3542
+
3543
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs
3544
+ function FromTemplateLiteral2(pattern) {
3545
+ const evaluated = EvaluateTemplateLiteral(pattern);
3546
+ const result = FromType9(evaluated);
3547
+ return result;
3548
+ }
3549
+
3550
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexable/from_union.mjs
3551
+ function FromUnion4(types) {
3552
+ return types.reduce((result, left) => {
3553
+ return [...result, ...FromType9(left)];
3554
+ }, []);
3555
+ }
3556
+
3557
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexable/from_type.mjs
3558
+ function FromType9(type) {
3559
+ return IsCyclic(type) ? FromCyclic2(type.$defs, type.$ref) : IsDependent(type) ? FromDependent2(type.if, type.then, type.else) : IsEnum(type) ? FromEnum(type.enum) : IsIntersect(type) ? FromIntersect2(type.allOf) : IsLiteral(type) ? FromLiteral4(type.const) : IsTemplateLiteral(type) ? FromTemplateLiteral2(type.pattern) : IsUnion(type) ? FromUnion4(type.anyOf) : [];
3560
+ }
3561
+
3562
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexable/to_indexable_keys.mjs
3563
+ function ToIndexableKeys(type) {
3564
+ const result = FromType9(type);
3565
+ return result;
3566
+ }
3567
+
3568
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/this/expand_this.mjs
3569
+ function FromTypes5(properties, types) {
3570
+ return types.map((type) => FromType10(properties, type));
3571
+ }
3572
+ function FromType10(properties, type) {
3573
+ return IsArray2(type) ? _Array_(FromType10(properties, type.items)) : IsConstructor2(type) ? Constructor(FromTypes5(properties, type.parameters), FromType10(properties, type.instanceType)) : IsFunction2(type) ? _Function_(FromTypes5(properties, type.parameters), FromType10(properties, type.returnType)) : IsTuple(type) ? Tuple(FromTypes5(properties, type.items)) : IsUnion(type) ? Union(FromTypes5(properties, type.anyOf)) : IsIntersect(type) ? Intersect(FromTypes5(properties, type.allOf)) : IsThis(type) ? _Object_(properties) : type;
3574
+ }
3575
+ function ExpandThis(properties, type) {
3576
+ const result = FromType10(properties, type);
3577
+ return result;
3578
+ }
3579
+
3580
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexed/from_object.mjs
3581
+ function IndexProperty(properties, key) {
3582
+ const selectedType = key in properties ? properties[key] : Never();
3583
+ const result = ExpandThis(properties, selectedType);
3584
+ return result;
3585
+ }
3586
+ function IndexProperties(properties, keys) {
3587
+ return keys.reduce((result, left) => {
3588
+ return [...result, IndexProperty(properties, left)];
3589
+ }, []);
3590
+ }
3591
+ function FromIndexer(properties, indexer) {
3592
+ const keys = ToIndexableKeys(indexer);
3593
+ const variants = IndexProperties(properties, keys);
3594
+ const result = EvaluateUnion(variants);
3595
+ return result;
3596
+ }
3597
+ var NumericKeyPattern = new RegExp(IntegerKey);
3598
+ function NumericKeys(keys) {
3599
+ const result = keys.filter((key) => NumericKeyPattern.test(key));
3600
+ return result;
3601
+ }
3602
+ function FromIndexerNumber(properties) {
3603
+ const keys = PropertyKeys(properties);
3604
+ const numericKeys = NumericKeys(keys);
3605
+ const variants = IndexProperties(properties, numericKeys);
3606
+ const result = EvaluateUnion(variants);
3607
+ return result;
3608
+ }
3609
+ function FromObject4(properties, indexer) {
3610
+ const result = IsNumber3(indexer) ? FromIndexerNumber(properties) : FromIndexer(properties, indexer);
3611
+ return result;
3612
+ }
3613
+
3614
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexed/array_indexer.mjs
3615
+ function ConvertLiteral(value) {
3616
+ return Literal(ConvertToIntegerKey(value));
3617
+ }
3618
+ function ArrayIndexerTypes(types) {
3619
+ return types.map((type) => FormatArrayIndexer(type));
3620
+ }
3621
+ function FormatArrayIndexer(type) {
3622
+ return IsIntersect(type) ? Intersect(ArrayIndexerTypes(type.allOf)) : IsUnion(type) ? Union(ArrayIndexerTypes(type.anyOf)) : IsLiteral(type) ? ConvertLiteral(type.const) : type;
3623
+ }
3624
+
3625
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexed/from_tuple.mjs
3626
+ function IndexElementsWithIndexer(types, indexer) {
3627
+ return types.reduceRight((result, right, index) => {
3628
+ const check = Extends({}, Literal(index), indexer);
3629
+ return result_exports.IsExtendsTrueLike(check) ? [right, ...result] : result;
3630
+ }, []);
3631
+ }
3632
+ function FromTupleWithIndexer(types, indexer) {
3633
+ const formattedArrayIndexer = FormatArrayIndexer(indexer);
3634
+ const elements = IndexElementsWithIndexer(types, formattedArrayIndexer);
3635
+ return EvaluateUnionFast(elements);
3636
+ }
3637
+ function FromTupleWithoutIndexer(types) {
3638
+ return EvaluateUnionFast(types);
3639
+ }
3640
+ function FromTuple2(types, indexer) {
3641
+ return (
3642
+ // length (intrinsic)
3643
+ IsLiteral(indexer) && guard_exports.IsEqual(indexer.const, "length") ? Literal(types.length) : IsNumber3(indexer) || IsInteger2(indexer) ? FromTupleWithoutIndexer(types) : FromTupleWithIndexer(types, indexer)
3644
+ );
3645
+ }
3646
+
3647
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexed/from_type.mjs
3648
+ function FromType11(type, indexer) {
3649
+ return IsArray2(type) ? FromArray2(type.items, indexer) : IsObject2(type) ? FromObject4(type.properties, indexer) : IsTuple(type) ? FromTuple2(type.items, indexer) : Never();
3650
+ }
3651
+
3652
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexed/instantiate.mjs
3653
+ function NormalizeType(type) {
3654
+ const result = IsCyclic(type) || IsDependent(type) || IsIntersect(type) || IsUnion(type) ? CollapseToObject(type) : type;
3655
+ return result;
3656
+ }
3657
+ function IndexAction(type, indexer, options) {
3658
+ const result = CanInstantiate([type, indexer]) ? memory_exports.Update(FromType11(NormalizeType(type), indexer), {}, options) : IndexDeferred(type, indexer, options);
3659
+ return result;
3660
+ }
3661
+ function IndexInstantiate(context, state, type, indexer, options) {
3662
+ const instantiatedType = InstantiateType(context, state, type);
3663
+ const instantiatedIndexer = InstantiateType(context, state, indexer);
3664
+ return IndexAction(instantiatedType, instantiatedIndexer, options);
3665
+ }
3666
+
3667
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/instance_type.mjs
3668
+ function InstanceTypeDeferred(type, options = {}) {
3669
+ return Deferred("InstanceType", [type], options);
3670
+ }
3671
+ function InstanceType(type, options = {}) {
3672
+ return InstanceTypeAction(type, options);
3673
+ }
3674
+
3675
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/instance_type/instantiate.mjs
3676
+ function InstanceTypeOperation(type) {
3677
+ return IsConstructor2(type) ? type["instanceType"] : Never();
3678
+ }
3679
+ function InstanceTypeAction(type, options) {
3680
+ const result = CanInstantiate([type]) ? memory_exports.Update(InstanceTypeOperation(type), {}, options) : InstanceTypeDeferred(type, options);
3681
+ return result;
3682
+ }
3683
+ function InstanceTypeInstantiate(context, state, type, options = {}) {
3684
+ const instantiatedType = InstantiateType(context, state, type);
3685
+ return InstanceTypeAction(instantiatedType, options);
3686
+ }
3687
+
3688
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/keyof.mjs
3689
+ function KeyOfDeferred(type, options = {}) {
3690
+ return Deferred("KeyOf", [type], options);
3691
+ }
3692
+ function KeyOf2(type, options = {}) {
3693
+ return KeyOfAction(type, options);
3694
+ }
3695
+
3696
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/keyof/from_any.mjs
3697
+ function FromAny() {
3698
+ return Union([Number2(), String2(), Symbol()]);
3699
+ }
3700
+
3701
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/keyof/from_array.mjs
3702
+ function FromArray3(_type) {
3703
+ return Number2();
3704
+ }
3705
+
3706
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/keyof/from_object.mjs
3707
+ function FromPropertyKeys(keys) {
3708
+ const result = keys.reduce((result2, left) => {
3709
+ return IsLiteralValue(left) ? [...result2, Literal(ConvertToIntegerKey(left))] : Unreachable();
3710
+ }, []);
3711
+ return result;
3712
+ }
3713
+ function FromObject5(properties) {
3714
+ const propertyKeys = guard_exports.Keys(properties);
3715
+ const variants = FromPropertyKeys(propertyKeys);
3716
+ const result = EvaluateUnionFast(variants);
3717
+ return result;
3718
+ }
3719
+
3720
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/keyof/from_record.mjs
3721
+ function FromRecord2(type) {
3722
+ return RecordKey(type);
3723
+ }
3724
+
3725
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/keyof/from_tuple.mjs
3726
+ function FromTuple3(types) {
3727
+ const result = types.map((_, index) => Literal(index));
3728
+ return EvaluateUnionFast(result);
3729
+ }
3730
+
3731
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/keyof/from_type.mjs
3732
+ function FromType12(type) {
3733
+ return IsAny(type) ? FromAny() : IsArray2(type) ? FromArray3(type.items) : IsObject2(type) ? FromObject5(type.properties) : IsRecord(type) ? FromRecord2(type) : IsTuple(type) ? FromTuple3(type.items) : Never();
3734
+ }
3735
+
3736
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/keyof/instantiate.mjs
3737
+ function NormalizeType2(type) {
3738
+ const result = IsCyclic(type) || IsDependent(type) || IsIntersect(type) || IsUnion(type) ? CollapseToObject(type) : type;
3739
+ return result;
3740
+ }
3741
+ function KeyOfAction(type, options) {
3742
+ return CanInstantiate([type]) ? memory_exports.Update(FromType12(NormalizeType2(type)), {}, options) : KeyOfDeferred(type, options);
3743
+ }
3744
+ function KeyOfInstantiate(context, state, type, options) {
3745
+ const instantiatedType = InstantiateType(context, state, type);
3746
+ return KeyOfAction(instantiatedType, options);
3747
+ }
3748
+
3749
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/mapped.mjs
3750
+ function MappedDeferred(identifier, type, as, property, options = {}) {
3751
+ return Deferred("Mapped", [identifier, type, as, property], options);
3752
+ }
3753
+ function Mapped(identifier, type, as, property, options = {}) {
3754
+ return MappedAction({}, State([], []), identifier, type, as, property, options);
3755
+ }
3756
+
3757
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs
3758
+ function FromTemplateLiteral3(pattern) {
3759
+ const evaluated = EvaluateTemplateLiteral(pattern);
3760
+ const result = FromType13(evaluated);
3761
+ return result;
3762
+ }
3763
+ function FromUnion5(types) {
3764
+ return types.reduce((result, left) => {
3765
+ return [...result, ...FromType13(left)];
3766
+ }, []);
3767
+ }
3768
+ function FromEnum2(values) {
3769
+ const evaluated = EvaluateEnum(values);
3770
+ const result = FromType13(evaluated);
3771
+ return result;
3772
+ }
3773
+ function FromLiteral5(value) {
3774
+ const result = guard_exports.IsNumber(value) ? [Literal(`${value}`)] : [Literal(value)];
3775
+ return result;
3776
+ }
3777
+ function FromType13(type) {
3778
+ const result = IsEnum(type) ? FromEnum2(type.enum) : IsLiteral(type) ? FromLiteral5(type.const) : IsTemplateLiteral(type) ? FromTemplateLiteral3(type.pattern) : IsUnion(type) ? FromUnion5(type.anyOf) : [type];
3779
+ return result;
3780
+ }
3781
+ function MappedVariants(type) {
3782
+ const result = FromType13(type);
3783
+ return result;
3784
+ }
3785
+
3786
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs
3787
+ function CanonicalAs(instantiatedAs) {
3788
+ const result = IsTemplateLiteral(instantiatedAs) ? EvaluateTemplateLiteral(instantiatedAs.pattern) : instantiatedAs;
3789
+ return result;
3790
+ }
3791
+ function MappedVariant(context, state, identifier, variant, as, property) {
3792
+ const variantContext = memory_exports.Assign(context, { [identifier["name"]]: variant });
3793
+ const instantiatedAs = InstantiateType(variantContext, state, as);
3794
+ const canonicalAs = CanonicalAs(instantiatedAs);
3795
+ const instantiatedProperty = InstantiateType(variantContext, state, property);
3796
+ return IsLiteralNumber(canonicalAs) || IsLiteralString(canonicalAs) ? { [canonicalAs.const]: instantiatedProperty } : {};
3797
+ }
3798
+ function MappedProperties(context, state, identifier, variants, as, property) {
3799
+ return variants.reduce((result, left) => {
3800
+ return [...result, MappedVariant(context, state, identifier, left, as, property)];
3801
+ }, []);
3802
+ }
3803
+ function MappedObjects(properties) {
3804
+ return properties.reduce((result, left) => {
3805
+ return [...result, _Object_(left)];
3806
+ }, []);
3807
+ }
3808
+ function MappedOperation(context, state, identifier, type, as, property) {
3809
+ const variants = MappedVariants(type);
3810
+ const mappedProperties = MappedProperties(context, state, identifier, variants, as, property);
3811
+ const mappedObjects = MappedObjects(mappedProperties);
3812
+ const result = EvaluateIntersect(mappedObjects);
3813
+ return result;
3814
+ }
3815
+
3816
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/mapped/instantiate.mjs
3817
+ function MappedAction(context, state, identifier, type, as, property, options) {
3818
+ const result = CanInstantiate([type]) ? memory_exports.Update(MappedOperation(context, state, identifier, type, as, property), {}, options) : MappedDeferred(identifier, type, as, property, options);
3819
+ return result;
3820
+ }
3821
+ function MappedInstantiate(context, state, identifier, type, as, property, options) {
3822
+ const instantiatedType = InstantiateType(context, state, type);
3823
+ return MappedAction(context, state, identifier, instantiatedType, as, property, options);
3824
+ }
3825
+
3826
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/module/instantiate.mjs
3827
+ function InstantiateCyclics(context, declarations, cyclicKeys) {
3828
+ const declarationContext = memory_exports.Assign(context, declarations);
3829
+ const declarationKeys = guard_exports.Keys(declarations).filter((key) => cyclicKeys.includes(key));
3830
+ return declarationKeys.reduce((result, key) => {
3831
+ return { ...result, [key]: InstantiateCyclic(declarationContext, key, declarations[key]) };
3832
+ }, {});
3833
+ }
3834
+ function InstantiateNonCyclics(context, declarations, cyclicKeys) {
3835
+ const declarationContext = memory_exports.Assign(context, declarations);
3836
+ const declarationKeys = guard_exports.Keys(declarations).filter((key) => !cyclicKeys.includes(key));
3837
+ return declarationKeys.reduce((result, key) => {
3838
+ return { ...result, [key]: InstantiateType(declarationContext, State([], []), declarations[key]) };
3839
+ }, {});
3840
+ }
3841
+ function InstantiateModule(context, declarations, options) {
3842
+ const cyclicCandidates = CyclicCandidates(declarations);
3843
+ const instantiatedCyclics = InstantiateCyclics(context, declarations, cyclicCandidates);
3844
+ const instantiatedNonCyclics = InstantiateNonCyclics(context, declarations, cyclicCandidates);
3845
+ const instantiatedModule = { ...instantiatedCyclics, ...instantiatedNonCyclics };
3846
+ return memory_exports.Update(instantiatedModule, {}, options);
3847
+ }
3848
+ function ModuleInstantiate(context, _state, declarations, options) {
3849
+ const instantiatedModule = InstantiateModule(context, declarations, options);
3850
+ return instantiatedModule;
3851
+ }
3852
+
3853
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/non_nullable.mjs
3854
+ function NonNullableDeferred(type, options = {}) {
3855
+ return Deferred("NonNullable", [type], options);
3856
+ }
3857
+ function NonNullable(type, options = {}) {
3858
+ return NonNullableAction(type, options);
3859
+ }
3860
+
3861
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/non_nullable/instantiate.mjs
3862
+ function NonNullableOperation(type) {
3863
+ const excluded = Union([Null(), Undefined()]);
3864
+ return ExcludeAction(type, excluded, {});
3865
+ }
3866
+ function NonNullableAction(type, options) {
3867
+ const result = CanInstantiate([type]) ? memory_exports.Update(NonNullableOperation(type), {}, options) : NonNullableDeferred(type, options);
3868
+ return result;
3869
+ }
3870
+ function NonNullableInstantiate(context, state, type, options) {
3871
+ const instantiatedType = InstantiateType(context, state, type);
3872
+ return NonNullableAction(instantiatedType, options);
3873
+ }
3874
+
3875
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/omit.mjs
3876
+ function OmitDeferred(type, indexer, options = {}) {
3877
+ return Deferred("Omit", [type, indexer], options);
3878
+ }
3879
+ function Omit(type, indexer_or_keys, options = {}) {
3880
+ const indexer = guard_exports.IsArray(indexer_or_keys) ? KeysToIndexer(indexer_or_keys) : indexer_or_keys;
3881
+ return OmitAction(type, indexer, options);
3882
+ }
3883
+
3884
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/indexable/to_indexable.mjs
3885
+ function ToIndexable(type) {
3886
+ const collapsed = CollapseToObject(type);
3887
+ const result = IsObject2(collapsed) ? collapsed.properties : Unreachable();
3888
+ return result;
3889
+ }
3890
+
3891
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/omit/from_type.mjs
3892
+ function FromKeys(properties, keys) {
3893
+ const result = guard_exports.Keys(properties).reduce((result2, key) => {
3894
+ return keys.includes(key) ? result2 : { ...result2, [key]: properties[key] };
3895
+ }, {});
3896
+ return result;
3897
+ }
3898
+ function FromType14(type, indexer) {
3899
+ const indexable = ToIndexable(type);
3900
+ const indexableKeys = ToIndexableKeys(indexer);
3901
+ const omitted = FromKeys(indexable, indexableKeys);
3902
+ const result = _Object_(omitted);
3903
+ return result;
3904
+ }
3905
+
3906
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/omit/instantiate.mjs
3907
+ function OmitAction(type, indexer, options) {
3908
+ const result = CanInstantiate([type, indexer]) ? memory_exports.Update(FromType14(type, indexer), {}, options) : OmitDeferred(type, indexer, options);
3909
+ return result;
3910
+ }
3911
+ function OmitInstantiate(context, state, type, indexer, options) {
3912
+ const instantiatedType = InstantiateType(context, state, type);
3913
+ const instantiatedIndexer = InstantiateType(context, state, indexer);
3914
+ return OmitAction(instantiatedType, instantiatedIndexer, options);
3915
+ }
3916
+
3917
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/parameters.mjs
3918
+ function ParametersDeferred(type, options = {}) {
3919
+ return Deferred("Parameters", [type], options);
3920
+ }
3921
+ function Parameters(type, options = {}) {
3922
+ return ParametersAction(type, options);
3923
+ }
3924
+
3925
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/parameters/instantiate.mjs
3926
+ function ParametersOperation(type) {
3927
+ const parameters2 = IsFunction2(type) ? type["parameters"] : [];
3928
+ const instantiatedParameters = InstantiateElements({}, State([], []), parameters2);
3929
+ const result = Tuple(instantiatedParameters);
3930
+ return result;
3931
+ }
3932
+ function ParametersAction(type, options) {
3933
+ const result = CanInstantiate([type]) ? memory_exports.Update(ParametersOperation(type), {}, options) : ParametersDeferred(type, options);
3934
+ return result;
3935
+ }
3936
+ function ParametersInstantiate(context, state, type, options) {
3937
+ const instantiatedType = InstantiateType(context, state, type);
3938
+ return ParametersAction(instantiatedType, options);
3939
+ }
3940
+
3941
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/partial.mjs
3942
+ function PartialDeferred(type, options = {}) {
3943
+ return Deferred("Partial", [type], options);
3944
+ }
3945
+ function Partial(type, options = {}) {
3946
+ return PartialAction(type, options);
3947
+ }
3948
+
3949
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/partial/from_cyclic.mjs
3950
+ function FromCyclic3(defs, ref) {
3951
+ const target = CyclicTarget(defs, ref);
3952
+ const partial = FromType15(target);
3953
+ const result = Cyclic(memory_exports.Assign(defs, { [ref]: partial }), ref);
3954
+ return result;
3955
+ }
3956
+
3957
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/partial/from_dependent.mjs
3958
+ function FromDependent3(if_, then_, else_) {
3959
+ const evaluated = EvaluateDependent(if_, then_, else_);
3960
+ const result = FromType15(evaluated);
3961
+ return result;
3962
+ }
3963
+
3964
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/partial/from_intersect.mjs
3965
+ function FromIntersect3(types) {
3966
+ const evaluated = EvaluateIntersect(types);
3967
+ const result = FromType15(evaluated);
3968
+ return result;
3969
+ }
3970
+
3971
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/partial/from_union.mjs
3972
+ function FromUnion6(types) {
3973
+ const result = types.map((type) => FromType15(type));
3974
+ return Union(result);
3975
+ }
3976
+
3977
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/partial/from_object.mjs
3978
+ function FromObject6(properties) {
3979
+ const mapped = guard_exports.Keys(properties).reduce((result2, left) => {
3980
+ return { ...result2, [left]: AddOptional(properties[left]) };
3981
+ }, {});
3982
+ const result = _Object_(mapped);
3983
+ return result;
3984
+ }
3985
+
3986
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/partial/from_type.mjs
3987
+ function FromType15(type) {
3988
+ return IsCyclic(type) ? FromCyclic3(type.$defs, type.$ref) : IsDependent(type) ? FromDependent3(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect3(type.allOf) : IsUnion(type) ? FromUnion6(type.anyOf) : IsObject2(type) ? FromObject6(type.properties) : _Object_({});
3989
+ }
3990
+
3991
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/partial/instantiate.mjs
3992
+ function PartialAction(type, options) {
3993
+ const result = CanInstantiate([type]) ? memory_exports.Update(FromType15(type), {}, options) : PartialDeferred(type, options);
3994
+ return result;
3995
+ }
3996
+ function PartialInstantiate(context, state, type, options) {
3997
+ const instantiatedType = InstantiateType(context, state, type);
3998
+ return PartialAction(instantiatedType, options);
3999
+ }
4000
+
4001
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/pick.mjs
4002
+ function PickDeferred(type, indexer, options = {}) {
4003
+ return Deferred("Pick", [type, indexer], options);
4004
+ }
4005
+ function Pick(type, indexer_or_keys, options = {}) {
4006
+ const indexer = guard_exports.IsArray(indexer_or_keys) ? KeysToIndexer(indexer_or_keys) : indexer_or_keys;
4007
+ return PickAction(type, indexer, options);
4008
+ }
4009
+
4010
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/pick/from_type.mjs
4011
+ function FromKeys2(properties, keys) {
4012
+ const result = guard_exports.Keys(properties).reduce((result2, key) => {
4013
+ return keys.includes(key) ? memory_exports.Assign(result2, { [key]: properties[key] }) : result2;
4014
+ }, {});
4015
+ return result;
4016
+ }
4017
+ function FromType16(type, indexer) {
4018
+ const indexable = ToIndexable(type);
4019
+ const keys = ToIndexableKeys(indexer);
4020
+ const applied = FromKeys2(indexable, keys);
4021
+ const result = _Object_(applied);
4022
+ return result;
4023
+ }
4024
+
4025
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/pick/instantiate.mjs
4026
+ function PickAction(type, indexer, options) {
4027
+ const result = CanInstantiate([type, indexer]) ? memory_exports.Update(FromType16(type, indexer), {}, options) : PickDeferred(type, indexer, options);
4028
+ return result;
4029
+ }
4030
+ function PickInstantiate(context, state, type, indexer, options) {
4031
+ const instantiatedType = InstantiateType(context, state, type);
4032
+ const instantiatedIndexer = InstantiateType(context, state, indexer);
4033
+ return PickAction(instantiatedType, instantiatedIndexer, options);
4034
+ }
4035
+
4036
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/readonly_object.mjs
4037
+ function ReadonlyObjectDeferred(type, options = {}) {
4038
+ return Deferred("ReadonlyObject", [type], options);
4039
+ }
4040
+ function ReadonlyObject(type, options = {}) {
4041
+ return ReadonlyObjectAction(type, options);
4042
+ }
4043
+ var ReadonlyType = ReadonlyObject;
4044
+
4045
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs
4046
+ function FromArray4(type) {
4047
+ const result = AddImmutable(_Array_(type));
4048
+ return result;
4049
+ }
4050
+
4051
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/readonly_object/from_cyclic.mjs
4052
+ function FromCyclic4(defs, ref) {
4053
+ const target = CyclicTarget(defs, ref);
4054
+ const partial = FromType17(target);
4055
+ const result = Cyclic(memory_exports.Assign(defs, { [ref]: partial }), ref);
4056
+ return result;
4057
+ }
4058
+
4059
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs
4060
+ function FromDependent4(if_, then_, else_) {
4061
+ const evaluated = EvaluateDependent(if_, then_, else_);
4062
+ const result = FromType17(evaluated);
4063
+ return result;
4064
+ }
4065
+
4066
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs
4067
+ function FromIntersect4(types) {
4068
+ const evaluated = EvaluateIntersect(types);
4069
+ const result = FromType17(evaluated);
4070
+ return result;
4071
+ }
4072
+
4073
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs
4074
+ function FromObject7(properties) {
4075
+ const mapped = guard_exports.Keys(properties).reduce((result2, left) => {
4076
+ return { ...result2, [left]: AddReadonly(properties[left]) };
4077
+ }, {});
4078
+ const result = _Object_(mapped);
4079
+ return result;
4080
+ }
4081
+
4082
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs
4083
+ function FromTuple4(types) {
4084
+ const result = AddImmutable(Tuple(types));
4085
+ return result;
4086
+ }
4087
+
4088
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/readonly_object/from_union.mjs
4089
+ function FromUnion7(types) {
4090
+ const result = types.map((type) => FromType17(type));
4091
+ return Union(result);
4092
+ }
4093
+
4094
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs
4095
+ function FromType17(type) {
4096
+ return IsArray2(type) ? FromArray4(type.items) : IsCyclic(type) ? FromCyclic4(type.$defs, type.$ref) : IsDependent(type) ? FromDependent4(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect4(type.allOf) : IsObject2(type) ? FromObject7(type.properties) : IsTuple(type) ? FromTuple4(type.items) : IsUnion(type) ? FromUnion7(type.anyOf) : type;
4097
+ }
4098
+
4099
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/readonly_object/instantiate.mjs
4100
+ function ReadonlyObjectAction(type, options) {
4101
+ const result = CanInstantiate([type]) ? memory_exports.Update(FromType17(type), {}, options) : ReadonlyObjectDeferred(type);
4102
+ return result;
4103
+ }
4104
+ function ReadonlyObjectInstantiate(context, state, type, options) {
4105
+ const instantiatedType = InstantiateType(context, state, type);
4106
+ return ReadonlyObjectAction(instantiatedType, options);
4107
+ }
4108
+
4109
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/ref/instantiate.mjs
4110
+ function RefInstantiate(context, state, type, ref) {
4111
+ return state.visited.includes(ref) ? type : ref in context ? InstantiateType(context, State(state["callstack"], [...state["visited"], ref]), context[ref]) : type;
4112
+ }
4113
+
4114
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/required/from_cyclic.mjs
4115
+ function FromCyclic5(defs, ref) {
4116
+ const target = CyclicTarget(defs, ref);
4117
+ const partial = FromType18(target);
4118
+ const result = Cyclic(memory_exports.Assign(defs, { [ref]: partial }), ref);
4119
+ return result;
4120
+ }
4121
+
4122
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/required/from_dependent.mjs
4123
+ function FromDependent5(if_, then_, else_) {
4124
+ const evaluated = EvaluateDependent(if_, then_, else_);
4125
+ const result = FromType18(evaluated);
4126
+ return result;
4127
+ }
4128
+
4129
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/required/from_intersect.mjs
4130
+ function FromIntersect5(types) {
4131
+ const evaluated = EvaluateIntersect(types);
4132
+ const result = FromType18(evaluated);
4133
+ return result;
4134
+ }
4135
+
4136
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/required/from_union.mjs
4137
+ function FromUnion8(types) {
4138
+ const result = types.map((type) => FromType18(type));
4139
+ return Union(result);
4140
+ }
4141
+
4142
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/required/from_object.mjs
4143
+ function FromObject8(properties) {
4144
+ const mapped = guard_exports.Keys(properties).reduce((result2, left) => {
4145
+ return { ...result2, [left]: RemoveOptional(properties[left]) };
4146
+ }, {});
4147
+ const result = _Object_(mapped);
4148
+ return result;
4149
+ }
4150
+
4151
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/required/from_type.mjs
4152
+ function FromType18(type) {
4153
+ return IsCyclic(type) ? FromCyclic5(type.$defs, type.$ref) : IsDependent(type) ? FromDependent5(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect5(type.allOf) : IsUnion(type) ? FromUnion8(type.anyOf) : IsObject2(type) ? FromObject8(type.properties) : _Object_({});
4154
+ }
4155
+
4156
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/required.mjs
4157
+ function RequiredDeferred(type, options = {}) {
4158
+ return Deferred("Required", [type], options);
4159
+ }
4160
+ function Required(type, options = {}) {
4161
+ return RequiredAction(type, options);
4162
+ }
4163
+
4164
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/required/instantiate.mjs
4165
+ function RequiredAction(type, options) {
4166
+ const result = CanInstantiate([type]) ? memory_exports.Update(FromType18(type), {}, options) : RequiredDeferred(type, options);
4167
+ return result;
4168
+ }
4169
+ function RequiredInstantiate(context, state, type, options) {
4170
+ const instaniatedType = InstantiateType(context, state, type);
4171
+ return RequiredAction(instaniatedType, options);
4172
+ }
4173
+
4174
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/return_type.mjs
4175
+ function ReturnTypeDeferred(type, options = {}) {
4176
+ return Deferred("ReturnType", [type], options);
4177
+ }
4178
+ function ReturnType(type, options = {}) {
4179
+ return ReturnTypeAction(type, options);
4180
+ }
4181
+
4182
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/return_type/instantiate.mjs
4183
+ function ReturnTypeOperation(type) {
4184
+ return IsFunction2(type) ? type["returnType"] : Never();
4185
+ }
4186
+ function ReturnTypeAction(type, options) {
4187
+ const result = CanInstantiate([type]) ? memory_exports.Update(ReturnTypeOperation(type), {}, options) : ReturnTypeDeferred(type, options);
4188
+ return result;
4189
+ }
4190
+ function ReturnTypeInstantiate(context, state, type, options = {}) {
4191
+ const instantiatedType = InstantiateType(context, state, type);
4192
+ return ReturnTypeAction(instantiatedType, options);
4193
+ }
4194
+
4195
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/with.mjs
4196
+ function WithDeferred(type, options) {
4197
+ return Deferred("With", [type, options], {});
4198
+ }
4199
+ function With2(type, options) {
4200
+ return WithAction(type, options);
4201
+ }
4202
+
4203
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/with/instantiate.mjs
4204
+ function WithAction(type, options) {
4205
+ const result = CanInstantiate([type]) ? memory_exports.Update(type, {}, options) : WithDeferred(type, options);
4206
+ return result;
4207
+ }
4208
+ function WithInstantiate(context, state, type, options) {
4209
+ const instaniatedType = InstantiateType(context, state, type);
4210
+ return WithAction(instaniatedType, options);
4211
+ }
4212
+
4213
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/rest/spread.mjs
4214
+ function SpreadElement(type) {
4215
+ const result = IsRest(type) ? IsTuple(type.items) ? RestSpread(type.items.items) : IsInfer(type.items) ? [type] : IsRef(type.items) ? [type] : [Never()] : [type];
4216
+ return result;
4217
+ }
4218
+ function RestSpread(types) {
4219
+ const result = types.reduce((result2, left) => {
4220
+ return [...result2, ...SpreadElement(left)];
4221
+ }, []);
4222
+ return result;
4223
+ }
4224
+
4225
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/instantiate.mjs
4226
+ function State(callstack, visited) {
4227
+ return { callstack, visited };
4228
+ }
4229
+ function CanInstantiate(types) {
4230
+ return guard_exports.ShiftLeft(types, (left, right) => IsRef(left) ? false : CanInstantiate(right), () => true);
4231
+ }
4232
+ function InstantiateProperties(context, state, properties) {
4233
+ return guard_exports.Keys(properties).reduce((result, key) => {
4234
+ return { ...result, [key]: InstantiateType(context, state, properties[key]) };
4235
+ }, {});
4236
+ }
4237
+ function InstantiateElements(context, state, types) {
4238
+ const elements = InstantiateTypes(context, state, types);
4239
+ const result = RestSpread(elements);
4240
+ return result;
4241
+ }
4242
+ function InstantiateTypes(context, state, types) {
4243
+ return types.map((type) => InstantiateType(context, state, type));
4244
+ }
4245
+ function WithModifiers(type, instantiatedType) {
4246
+ const withOptional = IsOptional(type) ? AddOptionalAction(instantiatedType, {}) : instantiatedType;
4247
+ const withReadonly = IsReadonly(type) ? AddReadonlyAction(withOptional, {}) : withOptional;
4248
+ const withImmutable = IsImmutable(type) ? AddImmutableAction(withReadonly, {}) : withReadonly;
4249
+ return withImmutable;
4250
+ }
4251
+ function InstantiateDeferred(context, state, action, parameters2, options) {
4252
+ return (
4253
+ // Modifiers
4254
+ guard_exports.IsEqual(action, "AddImmutable") ? AddImmutableInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "RemoveImmutable") ? RemoveImmutableInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "AddReadonly") ? AddReadonlyInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "RemoveReadonly") ? RemoveReadonlyInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "AddOptional") ? AddOptionalInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "RemoveOptional") ? RemoveOptionalInstantiate(context, state, parameters2[0], options) : (
4255
+ // Actions
4256
+ guard_exports.IsEqual(action, "Capitalize") ? CapitalizeInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "Conditional") ? ConditionalInstantiate(context, state, parameters2[0], parameters2[1], parameters2[2], parameters2[3], options) : guard_exports.IsEqual(action, "ConstructorParameters") ? ConstructorParametersInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "Evaluate") ? EvaluateInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "Exclude") ? ExcludeInstantiate(context, state, parameters2[0], parameters2[1], options) : guard_exports.IsEqual(action, "Extract") ? ExtractInstantiate(context, state, parameters2[0], parameters2[1], options) : guard_exports.IsEqual(action, "Index") ? IndexInstantiate(context, state, parameters2[0], parameters2[1], options) : guard_exports.IsEqual(action, "InstanceType") ? InstanceTypeInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "Interface") ? InterfaceInstantiate(context, state, parameters2[0], parameters2[1], options) : guard_exports.IsEqual(action, "KeyOf") ? KeyOfInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "Lowercase") ? LowercaseInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "Mapped") ? MappedInstantiate(context, state, parameters2[0], parameters2[1], parameters2[2], parameters2[3], options) : guard_exports.IsEqual(action, "Module") ? ModuleInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "NonNullable") ? NonNullableInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "Pick") ? PickInstantiate(context, state, parameters2[0], parameters2[1], options) : guard_exports.IsEqual(action, "Parameters") ? ParametersInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "Partial") ? PartialInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "Omit") ? OmitInstantiate(context, state, parameters2[0], parameters2[1], options) : guard_exports.IsEqual(action, "ReadonlyObject") ? ReadonlyObjectInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "Record") ? RecordInstantiate(context, state, parameters2[0], parameters2[1], options) : guard_exports.IsEqual(action, "Required") ? RequiredInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "ReturnType") ? ReturnTypeInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "TemplateLiteral") ? TemplateLiteralInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "Uncapitalize") ? UncapitalizeInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "Uppercase") ? UppercaseInstantiate(context, state, parameters2[0], options) : guard_exports.IsEqual(action, "With") ? WithInstantiate(context, state, parameters2[0], parameters2[1]) : Deferred(action, parameters2, options)
4257
+ )
4258
+ );
4259
+ }
4260
+ function InstantiateImmediate(context, state, type) {
4261
+ const instantiatedType = IsRef(type) ? RefInstantiate(context, state, type, type.$ref) : IsArray2(type) ? _Array_(InstantiateType(context, state, type.items), ArrayOptions(type)) : IsCall(type) ? CallInstantiate(context, state, type.target, type.arguments) : IsConstructor2(type) ? Constructor(InstantiateTypes(context, state, type.parameters), InstantiateType(context, state, type.instanceType), ConstructorOptions(type)) : IsFunction2(type) ? _Function_(InstantiateTypes(context, state, type.parameters), InstantiateType(context, state, type.returnType), FunctionOptions(type)) : IsDependent(type) ? Dependent(InstantiateType(context, state, type.if), InstantiateType(context, state, type.then), InstantiateType(context, state, type.else), DependentOptions(type)) : IsIntersect(type) ? Intersect(InstantiateTypes(context, state, type.allOf), IntersectOptions(type)) : IsObject2(type) ? _Object_(InstantiateProperties(context, state, type.properties), ObjectOptions(type)) : IsRecord(type) ? RecordFromPattern(RecordPattern(type), InstantiateType(context, state, RecordValue(type))) : IsRest(type) ? Rest(InstantiateType(context, state, type.items)) : IsTuple(type) ? Tuple(InstantiateElements(context, state, type.items), TupleOptions(type)) : IsUnion(type) ? Union(InstantiateTypes(context, state, type.anyOf), UnionOptions(type)) : type;
4262
+ const withModifiers = WithModifiers(type, instantiatedType);
4263
+ return withModifiers;
4264
+ }
4265
+ function InstantiateType(context, state, type) {
4266
+ const result = IsDeferred(type) ? InstantiateDeferred(context, state, type.action, type.parameters, type.options) : InstantiateImmediate(context, state, type);
4267
+ return result;
4268
+ }
4269
+ function Instantiate(context, type) {
4270
+ return InstantiateType(context, State([], []), type);
4271
+ }
4272
+
4273
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs
4274
+ function AddImmutableOperation(type) {
4275
+ return memory_exports.Update(type, { "~immutable": true }, {});
4276
+ }
4277
+ function AddImmutableAction(type, options) {
4278
+ const result = memory_exports.Update(AddImmutableOperation(type), {}, options);
4279
+ return result;
4280
+ }
4281
+ function AddImmutableInstantiate(context, state, type, options) {
4282
+ const instantiatedType = InstantiateType(context, state, type);
4283
+ return AddImmutableAction(instantiatedType, options);
4284
+ }
4285
+
4286
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/_add_immutable.mjs
4287
+ function AddImmutableDeferred(type, options = {}) {
4288
+ return Deferred("AddImmutable", [type], options);
4289
+ }
4290
+ function AddImmutable(type, options = {}) {
4291
+ return AddImmutableAction(type, options);
4292
+ }
4293
+
4294
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/evaluate.mjs
4295
+ function EvaluateDeferred(type, options = {}) {
4296
+ return Deferred("Evaluate", [type], options);
4297
+ }
4298
+ function Evaluate(type, options = {}) {
4299
+ return EvaluateAction(type, options);
4300
+ }
4301
+
4302
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/action/module.mjs
4303
+ function ModuleDeferred(declarations, options = {}) {
4304
+ return Deferred("Module", [declarations], options);
4305
+ }
4306
+ function Module2(declarations, options = {}) {
4307
+ return ModuleInstantiate({}, State([], []), declarations, options);
4308
+ }
4309
+
4310
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/type/script/script.mjs
4311
+ function Script2(...args) {
4312
+ const [context, input, options] = arguments_exports.Match(args, {
4313
+ 2: (script, options2) => guard_exports.IsString(script) ? [{}, script, options2] : [script, options2, {}],
4314
+ 3: (context2, script, options2) => [context2, script, options2],
4315
+ 1: (script) => [{}, script, {}]
4316
+ });
4317
+ const result = Script(input);
4318
+ const parsed = guard_exports.IsArray(result) && guard_exports.IsEqual(result.length, 2) ? InstantiateType(context, State([], []), result[0]) : Never();
4319
+ return memory_exports.Update(parsed, {}, options);
4320
+ }
4321
+
4322
+ // node_modules/.pnpm/typebox@1.3.30/node_modules/typebox/build/typebox.mjs
4323
+ var typebox_exports = {};
4324
+ __export(typebox_exports, {
4325
+ Any: () => Any,
4326
+ Array: () => _Array_,
4327
+ BigInt: () => BigInt2,
4328
+ Boolean: () => Boolean2,
4329
+ Call: () => Call,
4330
+ Capitalize: () => Capitalize,
4331
+ Codec: () => Codec,
4332
+ Conditional: () => Conditional,
4333
+ Constructor: () => Constructor,
4334
+ ConstructorParameters: () => ConstructorParameters,
4335
+ Cyclic: () => Cyclic,
4336
+ Decode: () => Decode,
4337
+ DecodeBuilder: () => DecodeBuilder,
4338
+ Dependent: () => Dependent,
4339
+ Encode: () => Encode,
4340
+ EncodeBuilder: () => EncodeBuilder,
4341
+ Enum: () => Enum,
4342
+ Evaluate: () => Evaluate,
4343
+ Exclude: () => Exclude,
4344
+ Extends: () => Extends,
4345
+ ExtendsResult: () => result_exports,
4346
+ Extract: () => Extract,
4347
+ Function: () => _Function_,
4348
+ Generic: () => Generic,
4349
+ Identifier: () => Identifier,
4350
+ Immutable: () => Immutable,
4351
+ Index: () => Index,
4352
+ Infer: () => Infer,
4353
+ InstanceType: () => InstanceType,
4354
+ Instantiate: () => Instantiate,
4355
+ Integer: () => Integer,
4356
+ Interface: () => Interface,
4357
+ Intersect: () => Intersect,
4358
+ IsAny: () => IsAny,
4359
+ IsArray: () => IsArray2,
4360
+ IsBigInt: () => IsBigInt2,
4361
+ IsBoolean: () => IsBoolean3,
4362
+ IsCall: () => IsCall,
4363
+ IsCodec: () => IsCodec,
4364
+ IsConstructor: () => IsConstructor2,
4365
+ IsCyclic: () => IsCyclic,
4366
+ IsDependent: () => IsDependent,
4367
+ IsEnum: () => IsEnum,
4368
+ IsEnumValue: () => IsEnumValue,
4369
+ IsFunction: () => IsFunction2,
4370
+ IsGeneric: () => IsGeneric,
4371
+ IsIdentifier: () => IsIdentifier,
4372
+ IsImmutable: () => IsImmutable,
4373
+ IsInfer: () => IsInfer,
4374
+ IsInteger: () => IsInteger2,
4375
+ IsIntersect: () => IsIntersect,
4376
+ IsKind: () => IsKind,
4377
+ IsLiteral: () => IsLiteral,
4378
+ IsNever: () => IsNever,
4379
+ IsNull: () => IsNull2,
4380
+ IsNumber: () => IsNumber3,
4381
+ IsObject: () => IsObject2,
4382
+ IsOptional: () => IsOptional,
4383
+ IsParameter: () => IsParameter,
4384
+ IsReadonly: () => IsReadonly,
4385
+ IsRecord: () => IsRecord,
4386
+ IsRef: () => IsRef,
4387
+ IsRefine: () => IsRefine,
4388
+ IsRest: () => IsRest,
4389
+ IsSchema: () => IsSchema,
4390
+ IsString: () => IsString3,
4391
+ IsSymbol: () => IsSymbol2,
4392
+ IsTemplateLiteral: () => IsTemplateLiteral,
4393
+ IsThis: () => IsThis,
4394
+ IsTuple: () => IsTuple,
4395
+ IsUndefined: () => IsUndefined2,
4396
+ IsUnion: () => IsUnion,
4397
+ IsUnknown: () => IsUnknown,
4398
+ IsUnsafe: () => IsUnsafe,
4399
+ IsVoid: () => IsVoid,
4400
+ KeyOf: () => KeyOf2,
4401
+ Literal: () => Literal,
4402
+ Lowercase: () => Lowercase,
4403
+ Mapped: () => Mapped,
4404
+ Module: () => Module2,
4405
+ Never: () => Never,
4406
+ NonNullable: () => NonNullable,
4407
+ Null: () => Null,
4408
+ Number: () => Number2,
4409
+ Object: () => _Object_,
4410
+ Omit: () => Omit,
4411
+ Optional: () => Optional,
4412
+ Parameter: () => Parameter,
4413
+ Parameters: () => Parameters,
4414
+ Partial: () => Partial,
4415
+ Pick: () => Pick,
4416
+ Readonly: () => Readonly,
4417
+ ReadonlyObject: () => ReadonlyObject,
4418
+ ReadonlyType: () => ReadonlyType,
4419
+ Record: () => Record,
4420
+ RecordKey: () => RecordKey,
4421
+ RecordPattern: () => RecordPattern,
4422
+ RecordValue: () => RecordValue,
4423
+ Ref: () => Ref,
4424
+ Refine: () => Refine,
4425
+ Required: () => Required,
4426
+ Rest: () => Rest,
4427
+ ReturnType: () => ReturnType,
4428
+ Script: () => Script2,
4429
+ String: () => String2,
4430
+ Symbol: () => Symbol,
4431
+ TemplateLiteral: () => TemplateLiteral2,
4432
+ This: () => This,
4433
+ Tuple: () => Tuple,
4434
+ Uncapitalize: () => Uncapitalize,
4435
+ Undefined: () => Undefined,
4436
+ Union: () => Union,
4437
+ Unknown: () => Unknown,
4438
+ Unsafe: () => Unsafe,
4439
+ Uppercase: () => Uppercase,
4440
+ Void: () => Void,
4441
+ With: () => With2
4442
+ });
4443
+
4444
+ // src/transfer.ts
4445
+ import { hostname } from "node:os";
4446
+ import { basename } from "node:path";
4447
+ import {
4448
+ formatSize
4449
+ } from "@earendil-works/pi-coding-agent";
4450
+ import { Text } from "@earendil-works/pi-tui";
4451
+ var parameters = typebox_exports.Unsafe(toJSONSchema(transferInput));
4452
+ var transfer = {
4453
+ name: "transfer",
4454
+ label: "transfer",
4455
+ description: transferDescription,
4456
+ parameters,
4457
+ renderCall(args, theme, context) {
4458
+ const device = context.state.device ?? hostname();
4459
+ const from = args.files ? "ChatGPT" : args.from ? context.state.from ?? "Session" : device;
4460
+ const to = args.files || args.from ? device : context.state.to ?? (args.to ? "Session" : "ChatGPT");
4461
+ const header = context.lastComponent instanceof Text ? context.lastComponent : new Text("", 0, 0);
4462
+ header.setText(theme.fg("toolTitle", theme.bold(`${from} \u2192 ${to}`)));
4463
+ context.state.header = header;
4464
+ return header;
4465
+ },
4466
+ renderResult(result, _options, theme, context) {
4467
+ const details = result.details;
4468
+ if (!details) {
4469
+ const text = result.content.flatMap((block) => block.type === "text" ? [block.text] : []).join("\n");
4470
+ return new Text(
4471
+ theme.fg(context.isError ? "error" : "toolOutput", text),
4472
+ 0,
4473
+ 0
4474
+ );
4475
+ }
4476
+ const args = context.args;
4477
+ context.state.device = details.device;
4478
+ context.state.to = details.to?.device ?? "ChatGPT";
4479
+ context.state.from = details.from?.device;
4480
+ const from = args.files ? "ChatGPT" : details.from?.device ?? details.device;
4481
+ const to = args.files || args.from ? details.device : details.to?.device ?? "ChatGPT";
4482
+ context.state.header?.setText(
4483
+ theme.fg("toolTitle", theme.bold(`${from} \u2192 ${to}`))
4484
+ );
4485
+ const lines = details.resources.length > 0 ? details.resources.map((resource, index) => {
4486
+ const source = displayPath(args.paths?.[index] ?? resource.name);
4487
+ const destination = args.to?.paths[index];
4488
+ return `${destination ? `${source} \u2192 ${destination}` : source} ${theme.fg("dim", formatSize(resource.size))}`;
4489
+ }) : details.files.length > 0 ? details.files.map((file, index) => {
4490
+ const source = args.to ? args.paths?.[index] : args.from?.paths[index] ?? args.files?.[index]?.file_name;
4491
+ const path = source ? `${displayPath(source)} \u2192 ${file.path}` : file.path;
4492
+ return "error" in file ? theme.fg("error", `${path}
4493
+ ${file.error}`) : `${path} ${theme.fg("dim", formatSize(file.bytes))}`;
4494
+ }) : (args.paths ?? []).map(
4495
+ (path, index) => args.to?.paths[index] ? `${displayPath(path)} \u2192 ${args.to.paths[index]}` : displayPath(path)
4496
+ );
4497
+ return new Text(lines.join("\n"), 0, 0);
4498
+ }
4499
+ };
4500
+ function displayPath(path) {
4501
+ return path.startsWith("chappie://") ? decodeURIComponent(basename(new URL(path).pathname)) : path;
4502
+ }
4503
+
4504
+ // src/pi.ts
4505
+ async function chappie(pi) {
4506
+ const config = await readConfig();
4507
+ let context;
4508
+ let model;
4509
+ let inputCursor = null;
4510
+ const requests = /* @__PURE__ */ new WeakMap();
4511
+ const current = () => {
4512
+ if (!context) throw new Error("Session has not started");
4513
+ return context;
4514
+ };
4515
+ const host = {
4516
+ describe() {
4517
+ const ctx = current();
4518
+ const name = pi.getSessionName();
4519
+ return {
4520
+ id: ctx.sessionManager.getSessionId(),
4521
+ agent: "pi",
4522
+ cwd: ctx.cwd,
4523
+ device: hostname2(),
4524
+ ...model ? { model: `${model.provider}/${model.id}` } : {},
4525
+ ...name ? { name } : {}
4526
+ };
4527
+ },
4528
+ active: () => model?.provider === "chappie",
4529
+ isIdle: () => current().isIdle(),
4530
+ async inspect() {
4531
+ const active = new Set(pi.getActiveTools());
4532
+ const path = resolve(getAgentDir(), "AGENTS.md");
4533
+ let globalAgents;
4534
+ try {
4535
+ await access(path);
4536
+ globalAgents = { path };
4537
+ } catch (error) {
4538
+ if (error.code !== "ENOENT") throw error;
4539
+ }
4540
+ return {
4541
+ tools: pi.getAllTools().filter((tool) => active.has(tool.name)).map((tool) => ({ ...tool, parameters: { ...tool.parameters } })),
4542
+ skills: pi.getCommands().filter((command) => command.source === "skill"),
4543
+ ...globalAgents ? { globalAgents } : {}
4544
+ };
4545
+ },
4546
+ async history(range) {
4547
+ const manager = current().sessionManager;
4548
+ return journalHistory(manager.getBranch(), manager.getSessionId(), range);
4549
+ },
4550
+ inputs() {
4551
+ const manager = current().sessionManager;
4552
+ const leafId = manager.getLeafId();
4553
+ if (leafId === inputCursor) return [];
4554
+ const entries = [];
4555
+ let entry = manager.getLeafEntry();
4556
+ while (entry && entry.id !== inputCursor) {
4557
+ entries.push(entry);
4558
+ entry = entry.parentId ? manager.getEntry(entry.parentId) : void 0;
4559
+ }
4560
+ const changedBranch = inputCursor !== null && !entry;
4561
+ inputCursor = leafId;
4562
+ if (changedBranch) {
4563
+ session.resetInputs();
4564
+ return [];
4565
+ }
4566
+ const inputs = [];
4567
+ for (const entry2 of entries.reverse()) {
4568
+ if (entry2.type !== "message" || entry2.message.role !== "user") continue;
4569
+ inputs.push({
4570
+ id: entry2.id,
4571
+ sessionId: manager.getSessionId(),
4572
+ message: entry2.message
4573
+ });
4574
+ }
4575
+ return inputs;
4576
+ },
4577
+ resetInputs() {
4578
+ inputCursor = context?.sessionManager.getLeafId() ?? null;
4579
+ },
4580
+ wake() {
4581
+ pi.sendMessage(
4582
+ { customType: "chappie.request", content: "", display: false },
4583
+ { triggerTurn: true }
4584
+ );
4585
+ },
4586
+ abort: () => current().abort(),
4587
+ notify(message, type, activity) {
4588
+ pi.appendEntry("chappie.notice", { message, type, ...activity });
4589
+ },
4590
+ mutate: withFileMutationQueue
4591
+ };
4592
+ const session = new Session(host, config);
4593
+ const tools = localTools(session);
4594
+ const names = new Set(tools.map((tool) => tool.name));
4595
+ function updateTools() {
4596
+ const desired = session.active ? ["transfer"] : session.localTools ? [...names] : [];
4597
+ const active = pi.getActiveTools();
4598
+ const enabled = active.filter((name) => names.has(name));
4599
+ if (enabled.length === desired.length && enabled.every((name) => desired.includes(name)))
4600
+ return;
4601
+ pi.setActiveTools([
4602
+ ...active.filter((name) => !names.has(name)),
4603
+ ...desired
4604
+ ]);
4605
+ }
4606
+ const update = (ctx, selected = ctx.model) => {
4607
+ context = ctx;
4608
+ model = selected;
4609
+ if (session.update()) updateTools();
4610
+ };
4611
+ pi.registerEntryRenderer(
4612
+ "chappie.notice",
4613
+ ({ data }, _options, theme) => {
4614
+ if (!data) return;
4615
+ return new Text2(
4616
+ theme.fg(data.type === "info" ? "dim" : data.type, data.message),
4617
+ 1,
4618
+ 0
4619
+ );
4620
+ }
4621
+ );
4622
+ pi.on("session_start", (_event, ctx) => update(ctx));
4623
+ pi.on("model_select", (event, ctx) => update(ctx, event.model));
4624
+ pi.on("session_info_changed", (_event, ctx) => update(ctx));
4625
+ pi.on("session_tree", (event, ctx) => {
4626
+ context = ctx;
4627
+ if (host.active()) {
4628
+ session.resetInputs();
4629
+ inputCursor = event.newLeafId;
4630
+ }
4631
+ session.historyChanged();
4632
+ });
4633
+ pi.on("message_start", (_event, ctx) => {
4634
+ context = ctx;
4635
+ session.historyChanged();
4636
+ });
4637
+ pi.on("tool_call", (_event, ctx) => {
4638
+ context = ctx;
4639
+ session.historyChanged();
4640
+ });
4641
+ pi.on("session_before_compact", (event) => {
4642
+ requests.set(event.signal, "compaction");
4643
+ });
4644
+ pi.on("session_before_tree", (event) => {
4645
+ requests.set(event.signal, "summary");
4646
+ });
4647
+ pi.on("session_compact", (_event, ctx) => {
4648
+ context = ctx;
4649
+ session.historyChanged();
4650
+ });
4651
+ pi.on("context", (event) => ({
4652
+ messages: host.active() ? [] : event.messages.filter(
4653
+ (message) => message.role !== "custom" || message.customType !== "chappie.request"
4654
+ )
4655
+ }));
4656
+ pi.on("turn_end", (event, ctx) => {
4657
+ context = ctx;
4658
+ session.complete(event.message, event.toolResults);
4659
+ });
4660
+ pi.on("agent_settled", async (_event, ctx) => {
4661
+ context = ctx;
4662
+ await session.settled();
4663
+ });
4664
+ pi.on("session_shutdown", () => session.close());
4665
+ for (const tool of tools) {
4666
+ if (tool.name === "transfer") continue;
4667
+ pi.registerTool({
4668
+ name: tool.name,
4669
+ label: tool.name,
4670
+ description: tool.description,
4671
+ parameters: typebox_exports.Unsafe(
4672
+ toJSONSchema(tool.parameters)
4673
+ ),
4674
+ async execute(_id, args, signal, update2) {
4675
+ const result = await tool.execute(
4676
+ args,
4677
+ signal,
4678
+ (result2) => update2?.({ ...result2, details: result2.details })
4679
+ );
4680
+ return { ...result, details: result.details };
4681
+ }
4682
+ });
4683
+ }
4684
+ pi.registerTool({
4685
+ ...transfer,
4686
+ async execute(_id, args, signal, update2) {
4687
+ const result = await session.transfer(
4688
+ args,
4689
+ signal,
4690
+ (details) => update2?.({ content: [], details })
4691
+ );
4692
+ return {
4693
+ ...result,
4694
+ content: [...result.content, ...localDeliveries(session)]
4695
+ };
4696
+ }
4697
+ });
4698
+ pi.registerProvider(
4699
+ createChappieProvider((output, input, options) => {
4700
+ const kind = options?.signal ? requests.get(options.signal) : void 0;
4701
+ return kind ? session.generate(output, { kind, input }) : session.start(output);
4702
+ })
4703
+ );
4704
+ }
4705
+ function createChappieProvider(start) {
4706
+ const stream = (model, context, options) => {
4707
+ const native = createAssistantMessageEventStream();
4708
+ const message = createMessage(
4709
+ model,
4710
+ "pending"
4711
+ );
4712
+ const output = new ProviderOutput(message, native, options?.signal);
4713
+ if (!output.closed) {
4714
+ queueMicrotask(() => {
4715
+ void start(output, context, options).catch(
4716
+ (error) => output.fail(error)
4717
+ );
4718
+ });
4719
+ }
4720
+ return native;
4721
+ };
4722
+ return createProvider({
4723
+ id: "chappie",
4724
+ name: "Chappie",
4725
+ auth: {
4726
+ apiKey: {
4727
+ name: "Local Chappie",
4728
+ async resolve() {
4729
+ return { auth: { headers: {} }, source: "local" };
4730
+ }
4731
+ }
4732
+ },
4733
+ models: [
4734
+ {
4735
+ id: "chatgpt",
4736
+ name: "ChatGPT",
4737
+ api: "chappie",
4738
+ provider: "chappie",
4739
+ baseUrl: "",
4740
+ reasoning: false,
4741
+ input: ["text", "image"],
4742
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
4743
+ contextWindow: 1e9,
4744
+ maxTokens: 1e9
4745
+ }
4746
+ ],
4747
+ api: { stream, streamSimple: stream }
4748
+ });
4749
+ }
4750
+ export {
4751
+ chappie as default
4752
+ };