@noya-app/noya-multiplayer-react 0.1.48 → 0.1.50

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 CHANGED
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
8
11
  var __export = (target, all) => {
9
12
  for (var name in all)
10
13
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -28,6 +31,886 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
31
  ));
29
32
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
33
 
34
+ // ../../node_modules/tree-visit/lib/access.js
35
+ var require_access = __commonJS({
36
+ "../../node_modules/tree-visit/lib/access.js"(exports2) {
37
+ "use strict";
38
+ Object.defineProperty(exports2, "__esModule", { value: true });
39
+ exports2.accessPath = exports2.access = void 0;
40
+ function access(node, indexPath, options) {
41
+ if (options.includeTraversalContext) {
42
+ const accessed = accessPath(node, indexPath, options);
43
+ return accessed[accessed.length - 1];
44
+ }
45
+ let path = indexPath.slice();
46
+ while (path.length > 0) {
47
+ let index = path.shift();
48
+ node = options.getChildren(node, path)[index];
49
+ }
50
+ return node;
51
+ }
52
+ exports2.access = access;
53
+ function accessPath(node, indexPath, options) {
54
+ let path = indexPath.slice();
55
+ let result = [node];
56
+ while (path.length > 0) {
57
+ let index = path.shift();
58
+ const context = options.includeTraversalContext ? {
59
+ getRoot: () => result[0],
60
+ getParent: () => result[result.length - 2],
61
+ getAncestors: () => result.slice(0, -1)
62
+ } : void 0;
63
+ node = options.getChildren(node, path, context)[index];
64
+ result.push(node);
65
+ }
66
+ return result;
67
+ }
68
+ exports2.accessPath = accessPath;
69
+ }
70
+ });
71
+
72
+ // ../../node_modules/tree-visit/lib/sort.js
73
+ var require_sort = __commonJS({
74
+ "../../node_modules/tree-visit/lib/sort.js"(exports2) {
75
+ "use strict";
76
+ Object.defineProperty(exports2, "__esModule", { value: true });
77
+ exports2.sortIndexPaths = exports2.compareIndexPaths = void 0;
78
+ function compareIndexPaths(a, b) {
79
+ for (let i = 0; i < Math.min(a.length, b.length); i++) {
80
+ if (a[i] < b[i])
81
+ return -1;
82
+ if (a[i] > b[i])
83
+ return 1;
84
+ }
85
+ return a.length - b.length;
86
+ }
87
+ exports2.compareIndexPaths = compareIndexPaths;
88
+ function sortIndexPaths(indexPaths) {
89
+ return indexPaths.sort(compareIndexPaths);
90
+ }
91
+ exports2.sortIndexPaths = sortIndexPaths;
92
+ }
93
+ });
94
+
95
+ // ../../node_modules/tree-visit/lib/ancestors.js
96
+ var require_ancestors = __commonJS({
97
+ "../../node_modules/tree-visit/lib/ancestors.js"(exports2) {
98
+ "use strict";
99
+ Object.defineProperty(exports2, "__esModule", { value: true });
100
+ exports2.ancestorIndexPaths = void 0;
101
+ var sort_1 = require_sort();
102
+ function ancestorIndexPaths(indexPaths) {
103
+ const paths = /* @__PURE__ */ new Map();
104
+ const sortedIndexPaths = (0, sort_1.sortIndexPaths)(indexPaths);
105
+ for (const indexPath of sortedIndexPaths) {
106
+ const foundParent = indexPath.some((_, index) => {
107
+ const parentKey = indexPath.slice(0, index).join();
108
+ return paths.has(parentKey);
109
+ });
110
+ if (foundParent)
111
+ continue;
112
+ paths.set(indexPath.join(), indexPath);
113
+ }
114
+ return Array.from(paths.values());
115
+ }
116
+ exports2.ancestorIndexPaths = ancestorIndexPaths;
117
+ }
118
+ });
119
+
120
+ // ../../node_modules/tree-visit/lib/diagram/boxDiagram.js
121
+ var require_boxDiagram = __commonJS({
122
+ "../../node_modules/tree-visit/lib/diagram/boxDiagram.js"(exports2) {
123
+ "use strict";
124
+ Object.defineProperty(exports2, "__esModule", { value: true });
125
+ exports2.boxDiagram = void 0;
126
+ var BoxDrawing;
127
+ (function(BoxDrawing2) {
128
+ BoxDrawing2["TopLeft"] = "\u250C";
129
+ BoxDrawing2["TopRight"] = "\u2510";
130
+ BoxDrawing2["BottomLeft"] = "\u2514";
131
+ BoxDrawing2["BottomRight"] = "\u2518";
132
+ BoxDrawing2["Horizontal"] = "\u2500";
133
+ BoxDrawing2["Vertical"] = "\u2502";
134
+ BoxDrawing2["BottomConnectorDown"] = "\u252C";
135
+ BoxDrawing2["BottomConnectorUp"] = "\u2534";
136
+ BoxDrawing2["TopConnectorUp"] = "\u2534";
137
+ })(BoxDrawing || (BoxDrawing = {}));
138
+ function wrapLabelInBox(label) {
139
+ const lines = label.split("\n");
140
+ const length = Math.max(...lines.map((line) => line.length));
141
+ const horizontalMargin = 1;
142
+ const width = length + horizontalMargin * 2 + 2;
143
+ const height = 2 + lines.length;
144
+ const diagram = [
145
+ [
146
+ BoxDrawing.TopLeft,
147
+ BoxDrawing.Horizontal.repeat(length + horizontalMargin * 2),
148
+ BoxDrawing.TopRight
149
+ ],
150
+ ...lines.map((line) => [
151
+ BoxDrawing.Vertical,
152
+ " ".repeat(horizontalMargin),
153
+ line + (line.length < length ? " ".repeat(length - line.length) : ""),
154
+ " ".repeat(horizontalMargin),
155
+ BoxDrawing.Vertical
156
+ ]),
157
+ [
158
+ BoxDrawing.BottomLeft,
159
+ BoxDrawing.Horizontal.repeat(length + horizontalMargin * 2),
160
+ BoxDrawing.BottomRight
161
+ ]
162
+ ];
163
+ return {
164
+ width,
165
+ height,
166
+ contents: diagram.map((parts) => parts.join(""))
167
+ };
168
+ }
169
+ function mergeBoxesHorizontal(boxes) {
170
+ const horizontalMargin = 1;
171
+ if (boxes.length === 0) {
172
+ throw new Error("Can't merge empty array of boxes");
173
+ }
174
+ return boxes.slice(1).reduce((result, box) => {
175
+ const height = Math.max(result.height, box.height);
176
+ const width = result.width + horizontalMargin + box.width;
177
+ const contents = [];
178
+ for (let i = 0; i < height; i++) {
179
+ contents.push((result.contents[i] || " ".repeat(result.width)) + " ".repeat(horizontalMargin) + (box.contents[i] || " ".repeat(box.width)));
180
+ }
181
+ return { height, width, contents: centerBlock(contents, width) };
182
+ }, boxes[0]);
183
+ }
184
+ function mergeBoxesVertical(boxes) {
185
+ const verticalMargin = 1;
186
+ if (boxes.length === 0) {
187
+ throw new Error("Can't merge empty array of boxes");
188
+ }
189
+ const width = Math.max(...boxes.map((box) => box.width));
190
+ return boxes.slice(1).reduce((result, box) => {
191
+ const height = result.height + verticalMargin + box.height;
192
+ const contents = [];
193
+ for (let i = 0; i < height; i++) {
194
+ if (i < result.height) {
195
+ contents.push(result.contents[i]);
196
+ } else if (i === result.height) {
197
+ contents.push(" ".repeat(width));
198
+ } else {
199
+ contents.push(box.contents[i - result.height - 1]);
200
+ }
201
+ }
202
+ return { height, width, contents: centerBlock(contents, width) };
203
+ }, boxes[0]);
204
+ }
205
+ function nodeDiagram(node, indexPath, options) {
206
+ const label = options.getLabel(node, indexPath);
207
+ const box = wrapLabelInBox(label);
208
+ const children = options.getChildren(node, indexPath);
209
+ if (children.length === 0)
210
+ return box;
211
+ const childBoxes = children.map((child, index) => {
212
+ const childBox = nodeDiagram(child, [...indexPath, index], options);
213
+ childBox.contents[0] = insertSubstring(childBox.contents[0], centerIndex(childBox.contents[0].length), BoxDrawing.TopConnectorUp);
214
+ return childBox;
215
+ });
216
+ const result = mergeBoxesVertical([box, mergeBoxesHorizontal(childBoxes)]);
217
+ const contents = result.contents;
218
+ const mid = centerIndex(result.width);
219
+ contents[box.height - 1] = insertSubstring(contents[box.height - 1], mid, BoxDrawing.BottomConnectorDown);
220
+ let min = contents[box.height + 1].indexOf(BoxDrawing.TopConnectorUp);
221
+ let max = contents[box.height + 1].lastIndexOf(BoxDrawing.TopConnectorUp);
222
+ for (let i = min; i <= max; i++) {
223
+ let character;
224
+ if (i === mid) {
225
+ character = childBoxes.length > 1 ? BoxDrawing.BottomConnectorUp : BoxDrawing.Vertical;
226
+ } else if (i === min) {
227
+ character = BoxDrawing.TopLeft;
228
+ } else if (i === max) {
229
+ character = BoxDrawing.TopRight;
230
+ } else {
231
+ character = BoxDrawing.Horizontal;
232
+ }
233
+ result.contents[box.height] = insertSubstring(result.contents[box.height], i, character);
234
+ }
235
+ return result;
236
+ }
237
+ function boxDiagram(node, options) {
238
+ return nodeDiagram(node, [], options).contents.join("\n");
239
+ }
240
+ exports2.boxDiagram = boxDiagram;
241
+ function centerIndex(width) {
242
+ return Math.floor(width / 2);
243
+ }
244
+ function centerLine(line, width) {
245
+ const remainder = width - line.length;
246
+ if (remainder <= 0)
247
+ return line;
248
+ const prefixLength = centerIndex(remainder);
249
+ const suffixLength = centerIndex(remainder);
250
+ const result = " ".repeat(prefixLength) + line + " ".repeat(suffixLength);
251
+ return prefixLength + suffixLength + result.length < width ? result + " " : result;
252
+ }
253
+ function centerBlock(lines, width) {
254
+ return lines.map((line) => centerLine(line, width));
255
+ }
256
+ function insertSubstring(string, index, substring) {
257
+ if (index > string.length - 1)
258
+ return string;
259
+ return string.substring(0, index) + substring + string.substring(index + 1);
260
+ }
261
+ }
262
+ });
263
+
264
+ // ../../node_modules/tree-visit/lib/diagram/directoryDiagram.js
265
+ var require_directoryDiagram = __commonJS({
266
+ "../../node_modules/tree-visit/lib/diagram/directoryDiagram.js"(exports2) {
267
+ "use strict";
268
+ Object.defineProperty(exports2, "__esModule", { value: true });
269
+ exports2.prefixBlock = exports2.isMultiline = exports2.directoryDiagram = void 0;
270
+ var LinePrefix;
271
+ (function(LinePrefix2) {
272
+ LinePrefix2["Child"] = "\u251C\u2500\u2500 ";
273
+ LinePrefix2["LastChild"] = "\u2514\u2500\u2500 ";
274
+ LinePrefix2["NestedChild"] = "\u2502 ";
275
+ LinePrefix2["LastNestedChild"] = " ";
276
+ })(LinePrefix || (LinePrefix = {}));
277
+ function nodeDiagram(node, indexPath, options) {
278
+ const label = options.getLabel(node, indexPath);
279
+ const depth = indexPath.length;
280
+ let rootLine = { label, depth, prefix: "", multilinePrefix: "" };
281
+ const children = options.getChildren(node, indexPath);
282
+ if (children.length === 0)
283
+ return [rootLine];
284
+ if (options.flattenSingleChildNodes && children.length === 1 && !isMultiline(label)) {
285
+ const [line] = nodeDiagram(children[0], [...indexPath, 0], options);
286
+ const hideRoot = indexPath.length === 0 && label === "";
287
+ rootLine.label = hideRoot ? `/ ${line.label}` : `${rootLine.label} / ${line.label}`;
288
+ return [rootLine];
289
+ }
290
+ const nestedLines = children.flatMap((file, index, array) => {
291
+ const childIsLast = index === array.length - 1;
292
+ const childLines = nodeDiagram(file, [...indexPath, index], options);
293
+ const childPrefix = childIsLast ? LinePrefix.LastChild : LinePrefix.Child;
294
+ const childMultilinePrefix = childIsLast ? LinePrefix.LastNestedChild : LinePrefix.NestedChild;
295
+ childLines.forEach((line) => {
296
+ if (line.depth === depth + 1) {
297
+ line.prefix = childPrefix + line.prefix;
298
+ line.multilinePrefix = childMultilinePrefix + line.multilinePrefix;
299
+ } else if (childIsLast) {
300
+ line.prefix = LinePrefix.LastNestedChild + line.prefix;
301
+ line.multilinePrefix = LinePrefix.LastNestedChild + line.multilinePrefix;
302
+ } else {
303
+ line.prefix = LinePrefix.NestedChild + line.prefix;
304
+ line.multilinePrefix = LinePrefix.NestedChild + line.multilinePrefix;
305
+ }
306
+ });
307
+ return childLines;
308
+ });
309
+ return [rootLine, ...nestedLines];
310
+ }
311
+ function directoryDiagram(node, options) {
312
+ const lines = nodeDiagram(node, [], options);
313
+ const strings = lines.map((line) => prefixBlock(line.label, line.prefix, line.multilinePrefix));
314
+ return strings.join("\n");
315
+ }
316
+ exports2.directoryDiagram = directoryDiagram;
317
+ function isMultiline(line) {
318
+ return line.includes("\n");
319
+ }
320
+ exports2.isMultiline = isMultiline;
321
+ function prefixBlock(block, prefix, multilinePrefix) {
322
+ if (!isMultiline(block))
323
+ return prefix + block;
324
+ return block.split("\n").map((line, index) => (index === 0 ? prefix : multilinePrefix) + line).join("\n");
325
+ }
326
+ exports2.prefixBlock = prefixBlock;
327
+ }
328
+ });
329
+
330
+ // ../../node_modules/tree-visit/lib/diagram.js
331
+ var require_diagram = __commonJS({
332
+ "../../node_modules/tree-visit/lib/diagram.js"(exports2) {
333
+ "use strict";
334
+ Object.defineProperty(exports2, "__esModule", { value: true });
335
+ exports2.diagram = void 0;
336
+ var boxDiagram_1 = require_boxDiagram();
337
+ var directoryDiagram_1 = require_directoryDiagram();
338
+ function diagram(node, options) {
339
+ if (options.type === "box") {
340
+ return (0, boxDiagram_1.boxDiagram)(node, options);
341
+ }
342
+ return (0, directoryDiagram_1.directoryDiagram)(node, options);
343
+ }
344
+ exports2.diagram = diagram;
345
+ }
346
+ });
347
+
348
+ // ../../node_modules/tree-visit/lib/visit.js
349
+ var require_visit = __commonJS({
350
+ "../../node_modules/tree-visit/lib/visit.js"(exports2) {
351
+ "use strict";
352
+ Object.defineProperty(exports2, "__esModule", { value: true });
353
+ exports2.visit = exports2.STOP = exports2.SKIP = void 0;
354
+ exports2.SKIP = "skip";
355
+ exports2.STOP = "stop";
356
+ function visit(node, options) {
357
+ const { onEnter, onLeave, getChildren, onDetectCycle, getIdentifier } = options;
358
+ let indexPath = [];
359
+ let stack = [{ node }];
360
+ const visited = onDetectCycle ? /* @__PURE__ */ new Set() : void 0;
361
+ const context = options.includeTraversalContext ? {
362
+ getRoot() {
363
+ return node;
364
+ },
365
+ getParent() {
366
+ var _a;
367
+ return (_a = stack[stack.length - 2]) === null || _a === void 0 ? void 0 : _a.node;
368
+ },
369
+ getAncestors() {
370
+ return stack.slice(0, -1).map((wrapper) => wrapper.node);
371
+ }
372
+ } : void 0;
373
+ const getIndexPath = options.reuseIndexPath ? () => indexPath : () => indexPath.slice();
374
+ while (stack.length > 0) {
375
+ let wrapper = stack[stack.length - 1];
376
+ if (wrapper.state === void 0) {
377
+ if (visited) {
378
+ const id = getIdentifier ? getIdentifier(wrapper.node) : wrapper.node;
379
+ if (visited.has(id)) {
380
+ const action = typeof onDetectCycle === "function" ? onDetectCycle(wrapper.node, getIndexPath(), context) : onDetectCycle;
381
+ if (action === "error") {
382
+ throw new Error("Cycle detected in tree");
383
+ } else {
384
+ wrapper.state = -1;
385
+ continue;
386
+ }
387
+ }
388
+ visited.add(id);
389
+ }
390
+ const enterResult = onEnter === null || onEnter === void 0 ? void 0 : onEnter(wrapper.node, getIndexPath());
391
+ if (enterResult === exports2.STOP)
392
+ return;
393
+ wrapper.state = enterResult === exports2.SKIP ? -1 : 0;
394
+ }
395
+ const children = wrapper.children || getChildren(wrapper.node, getIndexPath(), context);
396
+ if (!wrapper.children) {
397
+ wrapper.children = children;
398
+ }
399
+ if (wrapper.state !== -1) {
400
+ if (wrapper.state < children.length) {
401
+ let currentIndex = wrapper.state;
402
+ indexPath.push(currentIndex);
403
+ stack.push({ node: children[currentIndex] });
404
+ wrapper.state = currentIndex + 1;
405
+ continue;
406
+ }
407
+ const leaveResult = onLeave === null || onLeave === void 0 ? void 0 : onLeave(wrapper.node, getIndexPath());
408
+ if (leaveResult === exports2.STOP)
409
+ return;
410
+ }
411
+ if (visited) {
412
+ const id = getIdentifier ? getIdentifier(wrapper.node) : wrapper.node;
413
+ visited.delete(id);
414
+ }
415
+ indexPath.pop();
416
+ stack.pop();
417
+ }
418
+ }
419
+ exports2.visit = visit;
420
+ }
421
+ });
422
+
423
+ // ../../node_modules/tree-visit/lib/find.js
424
+ var require_find = __commonJS({
425
+ "../../node_modules/tree-visit/lib/find.js"(exports2) {
426
+ "use strict";
427
+ Object.defineProperty(exports2, "__esModule", { value: true });
428
+ exports2.findAllIndexPaths = exports2.findIndexPath = exports2.findAll = exports2.find = void 0;
429
+ var visit_1 = require_visit();
430
+ function find(node, options) {
431
+ let found;
432
+ (0, visit_1.visit)(node, Object.assign(Object.assign({}, options), { onEnter: (child, indexPath) => {
433
+ if (options.predicate(child, indexPath)) {
434
+ found = child;
435
+ return visit_1.STOP;
436
+ }
437
+ } }));
438
+ return found;
439
+ }
440
+ exports2.find = find;
441
+ function findAll(node, options) {
442
+ let found = [];
443
+ (0, visit_1.visit)(node, {
444
+ onEnter: (child, indexPath) => {
445
+ if (options.predicate(child, indexPath)) {
446
+ found.push(child);
447
+ }
448
+ },
449
+ getChildren: options.getChildren
450
+ });
451
+ return found;
452
+ }
453
+ exports2.findAll = findAll;
454
+ function findIndexPath(node, options) {
455
+ let found;
456
+ (0, visit_1.visit)(node, {
457
+ onEnter: (child, indexPath) => {
458
+ if (options.predicate(child, indexPath)) {
459
+ found = [...indexPath];
460
+ return visit_1.STOP;
461
+ }
462
+ },
463
+ getChildren: options.getChildren
464
+ });
465
+ return found;
466
+ }
467
+ exports2.findIndexPath = findIndexPath;
468
+ function findAllIndexPaths(node, options) {
469
+ let found = [];
470
+ (0, visit_1.visit)(node, {
471
+ onEnter: (child, indexPath) => {
472
+ if (options.predicate(child, indexPath)) {
473
+ found.push([...indexPath]);
474
+ }
475
+ },
476
+ getChildren: options.getChildren
477
+ });
478
+ return found;
479
+ }
480
+ exports2.findAllIndexPaths = findAllIndexPaths;
481
+ }
482
+ });
483
+
484
+ // ../../node_modules/tree-visit/lib/reduce.js
485
+ var require_reduce = __commonJS({
486
+ "../../node_modules/tree-visit/lib/reduce.js"(exports2) {
487
+ "use strict";
488
+ Object.defineProperty(exports2, "__esModule", { value: true });
489
+ exports2.reduce = void 0;
490
+ var visit_1 = require_visit();
491
+ function reduce(node, options) {
492
+ let result = options.initialResult;
493
+ (0, visit_1.visit)(node, Object.assign(Object.assign({}, options), { onEnter: (child, indexPath) => {
494
+ result = options.nextResult(result, child, indexPath);
495
+ } }));
496
+ return result;
497
+ }
498
+ exports2.reduce = reduce;
499
+ }
500
+ });
501
+
502
+ // ../../node_modules/tree-visit/lib/flat.js
503
+ var require_flat = __commonJS({
504
+ "../../node_modules/tree-visit/lib/flat.js"(exports2) {
505
+ "use strict";
506
+ Object.defineProperty(exports2, "__esModule", { value: true });
507
+ exports2.flat = void 0;
508
+ var reduce_1 = require_reduce();
509
+ function flat(node, options) {
510
+ return (0, reduce_1.reduce)(node, Object.assign(Object.assign({}, options), { initialResult: [], nextResult: (result, child) => {
511
+ result.push(child);
512
+ return result;
513
+ } }));
514
+ }
515
+ exports2.flat = flat;
516
+ }
517
+ });
518
+
519
+ // ../../node_modules/tree-visit/lib/flatMap.js
520
+ var require_flatMap = __commonJS({
521
+ "../../node_modules/tree-visit/lib/flatMap.js"(exports2) {
522
+ "use strict";
523
+ Object.defineProperty(exports2, "__esModule", { value: true });
524
+ exports2.flatMap = void 0;
525
+ var reduce_1 = require_reduce();
526
+ function flatMap(node, options) {
527
+ return (0, reduce_1.reduce)(node, Object.assign(Object.assign({}, options), { initialResult: [], nextResult: (result, child, indexPath) => {
528
+ result.push(...options.transform(child, indexPath));
529
+ return result;
530
+ } }));
531
+ }
532
+ exports2.flatMap = flatMap;
533
+ }
534
+ });
535
+
536
+ // ../../node_modules/tree-visit/lib/map.js
537
+ var require_map = __commonJS({
538
+ "../../node_modules/tree-visit/lib/map.js"(exports2) {
539
+ "use strict";
540
+ Object.defineProperty(exports2, "__esModule", { value: true });
541
+ exports2.map = void 0;
542
+ var visit_1 = require_visit();
543
+ function map3(node, options) {
544
+ const childrenMap = {};
545
+ (0, visit_1.visit)(node, Object.assign(Object.assign({}, options), { onLeave: (child, indexPath) => {
546
+ var _a, _b;
547
+ const keyIndexPath = [0, ...indexPath];
548
+ const key = keyIndexPath.join();
549
+ const transformed = options.transform(child, (_a = childrenMap[key]) !== null && _a !== void 0 ? _a : [], indexPath);
550
+ const parentKey = keyIndexPath.slice(0, -1).join();
551
+ const parentChildren = (_b = childrenMap[parentKey]) !== null && _b !== void 0 ? _b : [];
552
+ parentChildren.push(transformed);
553
+ childrenMap[parentKey] = parentChildren;
554
+ } }));
555
+ return childrenMap[""][0];
556
+ }
557
+ exports2.map = map3;
558
+ }
559
+ });
560
+
561
+ // ../../node_modules/tree-visit/lib/operation.js
562
+ var require_operation = __commonJS({
563
+ "../../node_modules/tree-visit/lib/operation.js"(exports2) {
564
+ "use strict";
565
+ Object.defineProperty(exports2, "__esModule", { value: true });
566
+ exports2.splice = exports2.applyOperations = exports2.getReplaceOperations = exports2.getRemovalOperations = exports2.getInsertionOperations = exports2.replaceOperation = exports2.removeOperation = exports2.insertOperation = void 0;
567
+ var ancestors_1 = require_ancestors();
568
+ var map_1 = require_map();
569
+ function insertOperation(index, nodes) {
570
+ return {
571
+ type: "insert",
572
+ index,
573
+ nodes
574
+ };
575
+ }
576
+ exports2.insertOperation = insertOperation;
577
+ function removeOperation(indexes) {
578
+ return {
579
+ type: "remove",
580
+ indexes
581
+ };
582
+ }
583
+ exports2.removeOperation = removeOperation;
584
+ function replaceOperation() {
585
+ return {
586
+ type: "replace"
587
+ };
588
+ }
589
+ exports2.replaceOperation = replaceOperation;
590
+ function splitIndexPath(indexPath) {
591
+ return [indexPath.slice(0, -1), indexPath[indexPath.length - 1]];
592
+ }
593
+ function getInsertionOperations(indexPath, nodes, operations = /* @__PURE__ */ new Map()) {
594
+ var _a;
595
+ const [parentIndexPath, index] = splitIndexPath(indexPath);
596
+ for (let i = parentIndexPath.length - 1; i >= 0; i--) {
597
+ const parentKey = parentIndexPath.slice(0, i).join();
598
+ switch ((_a = operations.get(parentKey)) === null || _a === void 0 ? void 0 : _a.type) {
599
+ case "remove":
600
+ continue;
601
+ }
602
+ operations.set(parentKey, replaceOperation());
603
+ }
604
+ const operation = operations.get(parentIndexPath.join());
605
+ switch (operation === null || operation === void 0 ? void 0 : operation.type) {
606
+ case "remove":
607
+ operations.set(parentIndexPath.join(), {
608
+ type: "removeThenInsert",
609
+ removeIndexes: operation.indexes,
610
+ insertIndex: index,
611
+ insertNodes: nodes
612
+ });
613
+ break;
614
+ default:
615
+ operations.set(parentIndexPath.join(), insertOperation(index, nodes));
616
+ }
617
+ return operations;
618
+ }
619
+ exports2.getInsertionOperations = getInsertionOperations;
620
+ function getRemovalOperations(indexPaths) {
621
+ var _a, _b;
622
+ const _ancestorIndexPaths = (0, ancestors_1.ancestorIndexPaths)(indexPaths);
623
+ const indexesToRemove = /* @__PURE__ */ new Map();
624
+ for (const indexPath of _ancestorIndexPaths) {
625
+ const parentKey = indexPath.slice(0, -1).join();
626
+ const value = (_a = indexesToRemove.get(parentKey)) !== null && _a !== void 0 ? _a : [];
627
+ value.push(indexPath[indexPath.length - 1]);
628
+ indexesToRemove.set(parentKey, value);
629
+ }
630
+ const operations = /* @__PURE__ */ new Map();
631
+ for (const indexPath of _ancestorIndexPaths) {
632
+ for (let i = indexPath.length - 1; i >= 0; i--) {
633
+ const parentKey = indexPath.slice(0, i).join();
634
+ operations.set(parentKey, replaceOperation());
635
+ }
636
+ }
637
+ for (const indexPath of _ancestorIndexPaths) {
638
+ const parentKey = indexPath.slice(0, -1).join();
639
+ operations.set(parentKey, removeOperation((_b = indexesToRemove.get(parentKey)) !== null && _b !== void 0 ? _b : []));
640
+ }
641
+ return operations;
642
+ }
643
+ exports2.getRemovalOperations = getRemovalOperations;
644
+ function getReplaceOperations(indexPath, node) {
645
+ const operations = /* @__PURE__ */ new Map();
646
+ const [parentIndexPath, index] = splitIndexPath(indexPath);
647
+ for (let i = parentIndexPath.length - 1; i >= 0; i--) {
648
+ const parentKey = parentIndexPath.slice(0, i).join();
649
+ operations.set(parentKey, replaceOperation());
650
+ }
651
+ operations.set(parentIndexPath.join(), {
652
+ type: "removeThenInsert",
653
+ removeIndexes: [index],
654
+ insertIndex: index,
655
+ insertNodes: [node]
656
+ });
657
+ return operations;
658
+ }
659
+ exports2.getReplaceOperations = getReplaceOperations;
660
+ function applyOperations(node, operations, options) {
661
+ return (0, map_1.map)(node, Object.assign(Object.assign({}, options), {
662
+ // Avoid calling `getChildren` for every node in the tree.
663
+ // Return [] if we're just going to return the original node anyway.
664
+ getChildren: (node2, indexPath) => {
665
+ const key = indexPath.join();
666
+ const operation = operations.get(key);
667
+ switch (operation === null || operation === void 0 ? void 0 : operation.type) {
668
+ case "replace":
669
+ case "remove":
670
+ case "removeThenInsert":
671
+ case "insert":
672
+ return options.getChildren(node2, indexPath);
673
+ default:
674
+ return [];
675
+ }
676
+ },
677
+ transform: (node2, children, indexPath) => {
678
+ const key = indexPath.join();
679
+ const operation = operations.get(key);
680
+ switch (operation === null || operation === void 0 ? void 0 : operation.type) {
681
+ case "remove":
682
+ return options.create(node2, children.filter((_, index) => !operation.indexes.includes(index)), indexPath);
683
+ case "removeThenInsert":
684
+ const updatedChildren = children.filter((_, index) => !operation.removeIndexes.includes(index));
685
+ const adjustedIndex = operation.removeIndexes.reduce((index, removedIndex) => removedIndex < index ? index - 1 : index, operation.insertIndex);
686
+ return options.create(node2, splice(updatedChildren, adjustedIndex, 0, ...operation.insertNodes), indexPath);
687
+ case "insert":
688
+ return options.create(node2, splice(children, operation.index, 0, ...operation.nodes), indexPath);
689
+ case "replace":
690
+ return options.create(node2, children, indexPath);
691
+ default:
692
+ return node2;
693
+ }
694
+ }
695
+ }));
696
+ }
697
+ exports2.applyOperations = applyOperations;
698
+ function splice(array, start, deleteCount, ...items) {
699
+ return [
700
+ ...array.slice(0, start),
701
+ ...items,
702
+ ...array.slice(start + deleteCount)
703
+ ];
704
+ }
705
+ exports2.splice = splice;
706
+ }
707
+ });
708
+
709
+ // ../../node_modules/tree-visit/lib/insert.js
710
+ var require_insert = __commonJS({
711
+ "../../node_modules/tree-visit/lib/insert.js"(exports2) {
712
+ "use strict";
713
+ Object.defineProperty(exports2, "__esModule", { value: true });
714
+ exports2.insert = void 0;
715
+ var operation_1 = require_operation();
716
+ function insert(node, options) {
717
+ const { nodes, at } = options;
718
+ if (at.length === 0) {
719
+ throw new Error(`Can't insert nodes at the root`);
720
+ }
721
+ const state = (0, operation_1.getInsertionOperations)(at, nodes);
722
+ return (0, operation_1.applyOperations)(node, state, options);
723
+ }
724
+ exports2.insert = insert;
725
+ }
726
+ });
727
+
728
+ // ../../node_modules/tree-visit/lib/move.js
729
+ var require_move = __commonJS({
730
+ "../../node_modules/tree-visit/lib/move.js"(exports2) {
731
+ "use strict";
732
+ Object.defineProperty(exports2, "__esModule", { value: true });
733
+ exports2.move = void 0;
734
+ var access_1 = require_access();
735
+ var ancestors_1 = require_ancestors();
736
+ var operation_1 = require_operation();
737
+ function move(node, options) {
738
+ if (options.indexPaths.length === 0)
739
+ return node;
740
+ for (const indexPath of options.indexPaths) {
741
+ if (indexPath.length === 0) {
742
+ throw new Error(`Can't move the root node`);
743
+ }
744
+ }
745
+ if (options.to.length === 0) {
746
+ throw new Error(`Can't move nodes to the root`);
747
+ }
748
+ const _ancestorIndexPaths = (0, ancestors_1.ancestorIndexPaths)(options.indexPaths);
749
+ const nodesToInsert = _ancestorIndexPaths.map((indexPath) => (0, access_1.access)(node, indexPath, options));
750
+ const operations = (0, operation_1.getInsertionOperations)(options.to, nodesToInsert, (0, operation_1.getRemovalOperations)(_ancestorIndexPaths));
751
+ return (0, operation_1.applyOperations)(node, operations, options);
752
+ }
753
+ exports2.move = move;
754
+ }
755
+ });
756
+
757
+ // ../../node_modules/tree-visit/lib/remove.js
758
+ var require_remove = __commonJS({
759
+ "../../node_modules/tree-visit/lib/remove.js"(exports2) {
760
+ "use strict";
761
+ Object.defineProperty(exports2, "__esModule", { value: true });
762
+ exports2.remove = void 0;
763
+ var operation_1 = require_operation();
764
+ function remove(node, options) {
765
+ if (options.indexPaths.length === 0)
766
+ return node;
767
+ for (const indexPath of options.indexPaths) {
768
+ if (indexPath.length === 0) {
769
+ throw new Error(`Can't remove the root node`);
770
+ }
771
+ }
772
+ const operations = (0, operation_1.getRemovalOperations)(options.indexPaths);
773
+ return (0, operation_1.applyOperations)(node, operations, options);
774
+ }
775
+ exports2.remove = remove;
776
+ }
777
+ });
778
+
779
+ // ../../node_modules/tree-visit/lib/replace.js
780
+ var require_replace = __commonJS({
781
+ "../../node_modules/tree-visit/lib/replace.js"(exports2) {
782
+ "use strict";
783
+ Object.defineProperty(exports2, "__esModule", { value: true });
784
+ exports2.replace = void 0;
785
+ var operation_1 = require_operation();
786
+ function replace(node, options) {
787
+ if (options.at.length === 0)
788
+ return options.node;
789
+ const operations = (0, operation_1.getReplaceOperations)(options.at, options.node);
790
+ return (0, operation_1.applyOperations)(node, operations, options);
791
+ }
792
+ exports2.replace = replace;
793
+ }
794
+ });
795
+
796
+ // ../../node_modules/tree-visit/lib/defineTree.js
797
+ var require_defineTree = __commonJS({
798
+ "../../node_modules/tree-visit/lib/defineTree.js"(exports2) {
799
+ "use strict";
800
+ Object.defineProperty(exports2, "__esModule", { value: true });
801
+ exports2.defineTree = void 0;
802
+ var access_1 = require_access();
803
+ var diagram_1 = require_diagram();
804
+ var find_1 = require_find();
805
+ var flat_1 = require_flat();
806
+ var flatMap_1 = require_flatMap();
807
+ var insert_1 = require_insert();
808
+ var map_1 = require_map();
809
+ var move_1 = require_move();
810
+ var reduce_1 = require_reduce();
811
+ var remove_1 = require_remove();
812
+ var replace_1 = require_replace();
813
+ var visit_1 = require_visit();
814
+ var Tree = class _Tree {
815
+ constructor(getChildrenOrBaseOptions, appliedOptions) {
816
+ this.appliedOptions = appliedOptions;
817
+ this.getChildren = (node, indexPath, context) => {
818
+ return this._getChildren(node, indexPath, context);
819
+ };
820
+ this.mergeOptions = (options) => Object.assign(Object.assign(Object.assign({}, this.baseOptions), this.appliedOptions), options);
821
+ this.withOptions = (newOptions) => new _Tree(this.baseOptions, Object.assign(Object.assign({}, this.appliedOptions), newOptions));
822
+ this.access = (node, indexPath) => (0, access_1.access)(node, indexPath, this.mergeOptions({}));
823
+ this.accessPath = (node, indexPath) => (0, access_1.accessPath)(node, indexPath, this.mergeOptions({}));
824
+ this.diagram = (node, options) => typeof options === "function" ? (0, diagram_1.diagram)(node, this.mergeOptions({ getLabel: options })) : (0, diagram_1.diagram)(node, this.mergeOptions(options));
825
+ this.find = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.find)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.find)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
826
+ this.findAll = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.findAll)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.findAll)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
827
+ this.findIndexPath = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.findIndexPath)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.findIndexPath)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
828
+ this.findAllIndexPaths = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.findAllIndexPaths)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.findAllIndexPaths)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
829
+ this.flat = (node) => (0, flat_1.flat)(node, this.mergeOptions({}));
830
+ this.flatMap = (node, transform) => (0, flatMap_1.flatMap)(node, this.mergeOptions({ transform }));
831
+ this.reduce = (node, nextResult, initialResult) => (0, reduce_1.reduce)(node, this.mergeOptions({ nextResult, initialResult }));
832
+ this.map = (node, transform) => (0, map_1.map)(node, this.mergeOptions({ transform }));
833
+ this.visit = (node, onEnterOrOptions) => typeof onEnterOrOptions === "function" ? (0, visit_1.visit)(node, this.mergeOptions({ onEnter: onEnterOrOptions })) : (0, visit_1.visit)(node, this.mergeOptions(Object.assign({}, onEnterOrOptions)));
834
+ this.insert = (node, options) => (0, insert_1.insert)(node, this.mergeOptions(options));
835
+ this.remove = (node, options) => (0, remove_1.remove)(node, this.mergeOptions(options));
836
+ this.move = (node, options) => (0, move_1.move)(node, this.mergeOptions(options));
837
+ this.replace = (node, options) => (0, replace_1.replace)(node, this.mergeOptions(options));
838
+ this.baseOptions = typeof getChildrenOrBaseOptions === "function" ? { getChildren: getChildrenOrBaseOptions } : getChildrenOrBaseOptions;
839
+ this._getChildren = this.baseOptions.getChildren;
840
+ }
841
+ };
842
+ function defineTree2(getChildren) {
843
+ return new Tree(getChildren, {});
844
+ }
845
+ exports2.defineTree = defineTree2;
846
+ }
847
+ });
848
+
849
+ // ../../node_modules/tree-visit/lib/indexPath.js
850
+ var require_indexPath = __commonJS({
851
+ "../../node_modules/tree-visit/lib/indexPath.js"(exports2) {
852
+ "use strict";
853
+ Object.defineProperty(exports2, "__esModule", { value: true });
854
+ }
855
+ });
856
+
857
+ // ../../node_modules/tree-visit/lib/options.js
858
+ var require_options = __commonJS({
859
+ "../../node_modules/tree-visit/lib/options.js"(exports2) {
860
+ "use strict";
861
+ Object.defineProperty(exports2, "__esModule", { value: true });
862
+ }
863
+ });
864
+
865
+ // ../../node_modules/tree-visit/lib/withOptions.js
866
+ var require_withOptions = __commonJS({
867
+ "../../node_modules/tree-visit/lib/withOptions.js"(exports2) {
868
+ "use strict";
869
+ Object.defineProperty(exports2, "__esModule", { value: true });
870
+ exports2.withOptions = void 0;
871
+ var defineTree_1 = require_defineTree();
872
+ exports2.withOptions = defineTree_1.defineTree;
873
+ }
874
+ });
875
+
876
+ // ../../node_modules/tree-visit/lib/index.js
877
+ var require_lib = __commonJS({
878
+ "../../node_modules/tree-visit/lib/index.js"(exports2) {
879
+ "use strict";
880
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
881
+ if (k2 === void 0) k2 = k;
882
+ Object.defineProperty(o, k2, { enumerable: true, get: function() {
883
+ return m[k];
884
+ } });
885
+ } : function(o, m, k, k2) {
886
+ if (k2 === void 0) k2 = k;
887
+ o[k2] = m[k];
888
+ });
889
+ var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
890
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
891
+ };
892
+ Object.defineProperty(exports2, "__esModule", { value: true });
893
+ __exportStar(require_access(), exports2);
894
+ __exportStar(require_ancestors(), exports2);
895
+ __exportStar(require_defineTree(), exports2);
896
+ __exportStar(require_diagram(), exports2);
897
+ __exportStar(require_find(), exports2);
898
+ __exportStar(require_flat(), exports2);
899
+ __exportStar(require_flatMap(), exports2);
900
+ __exportStar(require_indexPath(), exports2);
901
+ __exportStar(require_insert(), exports2);
902
+ __exportStar(require_map(), exports2);
903
+ __exportStar(require_move(), exports2);
904
+ __exportStar(require_options(), exports2);
905
+ __exportStar(require_reduce(), exports2);
906
+ __exportStar(require_remove(), exports2);
907
+ __exportStar(require_replace(), exports2);
908
+ __exportStar(require_sort(), exports2);
909
+ __exportStar(require_visit(), exports2);
910
+ __exportStar(require_withOptions(), exports2);
911
+ }
912
+ });
913
+
31
914
  // src/index.ts
32
915
  var src_exports = {};
33
916
  __export(src_exports, {
@@ -44,21 +927,28 @@ __export(src_exports, {
44
927
  parseAppDataParameter: () => parseAppDataParameter,
45
928
  useAIManager: () => useAIManager,
46
929
  useAnyEphemeralUserData: () => useAnyEphemeralUserData,
930
+ useAnyNoyaManager: () => useAnyNoyaManager,
931
+ useAnyNoyaStateContext: () => useAnyNoyaStateContext,
47
932
  useAsset: () => useAsset,
48
933
  useAssetManager: () => useAssetManager,
49
934
  useAssets: () => useAssets,
935
+ useColorScheme: () => useColorScheme,
50
936
  useConnectedUsersManager: () => useConnectedUsersManager,
51
937
  useCurrentUserId: () => useCurrentUserId,
938
+ useIOManager: () => useIOManager,
939
+ useInputs: () => useInputs,
52
940
  useIsInitialized: () => useIsInitialized,
53
941
  useManagedHistory: () => useManagedHistory,
54
942
  useManagedState: () => useManagedState,
55
943
  useMultiplayerState: () => useMultiplayerState,
56
944
  useNoyaState: () => useNoyaState,
57
945
  useObservable: () => useObservable,
946
+ useOutputTransforms: () => useOutputTransforms,
58
947
  useSecret: () => useSecret,
59
948
  useSecretManager: () => useSecretManager,
60
949
  useSecrets: () => useSecrets,
61
950
  useSyncStateManager: () => useSyncStateManager,
951
+ useViewType: () => useViewType,
62
952
  useWorkflowManager: () => useWorkflowManager
63
953
  });
64
954
  module.exports = __toCommonJS(src_exports);
@@ -455,10 +1345,13 @@ var StateInspector = (0, import_react_utils2.memoGeneric)(function StateInspecto
455
1345
  secretManager,
456
1346
  ephemeralUserDataManager,
457
1347
  connectionEventManager,
458
- taskManager
1348
+ taskManager,
1349
+ ioManager
459
1350
  } = noyaManager;
460
1351
  const [didMount, setDidMount] = import_react4.default.useState(false);
461
1352
  const tasks = useObservable(taskManager.tasks$);
1353
+ const inputs = useObservable(ioManager.inputs$);
1354
+ const outputTransforms = useObservable(ioManager.outputTransforms$);
462
1355
  (0, import_react4.useLayoutEffect)(() => {
463
1356
  setDidMount(true);
464
1357
  }, []);
@@ -500,6 +1393,14 @@ var StateInspector = (0, import_react_utils2.memoGeneric)(function StateInspecto
500
1393
  "noya-multiplayer-react-show-secrets",
501
1394
  false
502
1395
  );
1396
+ const [showInputs, setShowInputs] = useLocalStorageState(
1397
+ "noya-multiplayer-react-show-inputs",
1398
+ false
1399
+ );
1400
+ const [showOutputTransforms, setShowOutputTransforms] = useLocalStorageState(
1401
+ "noya-multiplayer-react-show-output-transforms",
1402
+ false
1403
+ );
503
1404
  const connectionEvents = useObservable(connectionEventManager.events$);
504
1405
  (0, import_react4.useEffect)(() => {
505
1406
  if (eventsContainerRef.current) {
@@ -518,6 +1419,10 @@ var StateInspector = (0, import_react_utils2.memoGeneric)(function StateInspecto
518
1419
  const connectedUsers = useObservable(connectedUsersManager.connectedUsers$);
519
1420
  const userId = useObservable(connectedUsersManager.currentUserId$);
520
1421
  const state = useObservable(multiplayerStateManager.optimisticState$);
1422
+ const inputsInitialized = useObservable(ioManager.inputsInitialized$);
1423
+ const outputTransformsInitialized = useObservable(
1424
+ ioManager.outputTransformsInitialized$
1425
+ );
521
1426
  (0, import_react4.useEffect)(() => {
522
1427
  if (historyContainerRef.current) {
523
1428
  historyContainerRef.current.scrollTop = historyContainerRef.current.scrollHeight;
@@ -891,33 +1796,6 @@ var StateInspector = (0, import_react_utils2.memoGeneric)(function StateInspecto
891
1796
  "Delete"
892
1797
  ))))
893
1798
  ),
894
- /* @__PURE__ */ import_react4.default.createElement(
895
- DisclosureSection,
896
- {
897
- title: "Tasks",
898
- colorScheme,
899
- open: showTasks,
900
- setOpen: setShowTasks
901
- },
902
- /* @__PURE__ */ import_react4.default.createElement("div", { style: styles.sectionInner }, tasks?.map((task) => /* @__PURE__ */ import_react4.default.createElement(
903
- InspectorRow,
904
- {
905
- key: task.id,
906
- colorScheme,
907
- style: {
908
- backgroundColor: task.status === "done" ? "rgba(0,255,0,0.2)" : task.status === "error" ? "rgba(255,0,0,0.2)" : void 0
909
- }
910
- },
911
- /* @__PURE__ */ import_react4.default.createElement(
912
- import_react_inspector.ObjectInspector,
913
- {
914
- name: task.name,
915
- data: task.payload,
916
- theme
917
- }
918
- )
919
- )))
920
- ),
921
1799
  /* @__PURE__ */ import_react4.default.createElement(
922
1800
  DisclosureSection,
923
1801
  {
@@ -949,47 +1827,124 @@ var StateInspector = (0, import_react_utils2.memoGeneric)(function StateInspecto
949
1827
  "Delete"
950
1828
  ))))
951
1829
  ),
1830
+ " ",
952
1831
  /* @__PURE__ */ import_react4.default.createElement(
953
1832
  DisclosureSection,
954
1833
  {
955
- open: showEphemeral,
956
- setOpen: setShowEphemeral,
957
- title: "Ephemeral User Data",
1834
+ open: showInputs,
1835
+ setOpen: setShowInputs,
1836
+ title: /* @__PURE__ */ import_react4.default.createElement(TitleLabel, null, "Inputs", /* @__PURE__ */ import_react4.default.createElement(ColoredDot, { type: inputsInitialized ? "success" : "error" })),
958
1837
  colorScheme
959
1838
  },
960
- /* @__PURE__ */ import_react4.default.createElement("div", { style: styles.sectionInner }, Object.entries(ephemeral).map(([key, value]) => /* @__PURE__ */ import_react4.default.createElement(InspectorRow, { key, colorScheme }, /* @__PURE__ */ import_react4.default.createElement(
961
- import_react_inspector.ObjectInspector,
1839
+ /* @__PURE__ */ import_react4.default.createElement("div", { style: styles.sectionInner }, inputs?.map((input) => /* @__PURE__ */ import_react4.default.createElement(InspectorRow, { key: input.id, colorScheme }, /* @__PURE__ */ import_react4.default.createElement(import_react_inspector.ObjectInspector, { data: input, theme }))), !inputs?.length && /* @__PURE__ */ import_react4.default.createElement(
1840
+ "div",
962
1841
  {
963
- name: key,
964
- data: value,
965
- theme,
966
- expandLevel: 10
967
- }
968
- ))))
1842
+ style: {
1843
+ padding: "12px",
1844
+ fontSize: "12px",
1845
+ display: "flex",
1846
+ flexDirection: "column",
1847
+ gap: "4px"
1848
+ }
1849
+ },
1850
+ /* @__PURE__ */ import_react4.default.createElement("span", null, "No inputs")
1851
+ ))
969
1852
  ),
970
1853
  /* @__PURE__ */ import_react4.default.createElement(
971
1854
  DisclosureSection,
972
1855
  {
973
- open: showEvents,
974
- setOpen: setShowEvents,
975
- title: "Events",
1856
+ open: showOutputTransforms,
1857
+ setOpen: setShowOutputTransforms,
1858
+ title: /* @__PURE__ */ import_react4.default.createElement(TitleLabel, null, "Output Transforms", /* @__PURE__ */ import_react4.default.createElement(
1859
+ ColoredDot,
1860
+ {
1861
+ type: outputTransformsInitialized ? "success" : "error"
1862
+ }
1863
+ )),
976
1864
  colorScheme
977
1865
  },
978
- /* @__PURE__ */ import_react4.default.createElement("div", { ref: eventsContainerRef, style: styles.sectionInner }, connectionEvents?.map(
979
- (event, index) => event.type === "stateChange" ? /* @__PURE__ */ import_react4.default.createElement(InspectorRow, { key: index, colorScheme }, "connection:", " ", /* @__PURE__ */ import_react4.default.createElement("span", { style: { fontStyle: "italic" } }, event.state.toLowerCase())) : /* @__PURE__ */ import_react4.default.createElement(
980
- InspectorRow,
981
- {
982
- key: index,
983
- colorScheme,
984
- variant: event.type === "send" ? "up" : "down",
985
- style: {
986
- padding: "0px 12px 1px"
987
- }
988
- },
989
- /* @__PURE__ */ import_react4.default.createElement(
990
- import_react_inspector.ObjectInspector,
991
- {
992
- data: event.type === "error" ? event.error : event.message,
1866
+ /* @__PURE__ */ import_react4.default.createElement("div", { style: styles.sectionInner }, outputTransforms?.map((transform) => /* @__PURE__ */ import_react4.default.createElement(InspectorRow, { key: transform.id, colorScheme }, /* @__PURE__ */ import_react4.default.createElement(import_react_inspector.ObjectInspector, { data: transform, theme }))), !outputTransforms?.length && /* @__PURE__ */ import_react4.default.createElement(
1867
+ "div",
1868
+ {
1869
+ style: {
1870
+ padding: "12px",
1871
+ fontSize: "12px",
1872
+ display: "flex",
1873
+ flexDirection: "column",
1874
+ gap: "4px"
1875
+ }
1876
+ },
1877
+ /* @__PURE__ */ import_react4.default.createElement("span", null, "No output transforms")
1878
+ ))
1879
+ ),
1880
+ /* @__PURE__ */ import_react4.default.createElement(
1881
+ DisclosureSection,
1882
+ {
1883
+ title: "Tasks",
1884
+ colorScheme,
1885
+ open: showTasks,
1886
+ setOpen: setShowTasks
1887
+ },
1888
+ /* @__PURE__ */ import_react4.default.createElement("div", { style: styles.sectionInner }, tasks?.map((task) => /* @__PURE__ */ import_react4.default.createElement(
1889
+ InspectorRow,
1890
+ {
1891
+ key: task.id,
1892
+ colorScheme,
1893
+ style: {
1894
+ backgroundColor: task.status === "done" ? "rgba(0,255,0,0.2)" : task.status === "error" ? "rgba(255,0,0,0.2)" : void 0
1895
+ }
1896
+ },
1897
+ /* @__PURE__ */ import_react4.default.createElement(
1898
+ import_react_inspector.ObjectInspector,
1899
+ {
1900
+ name: task.name,
1901
+ data: task.payload,
1902
+ theme
1903
+ }
1904
+ )
1905
+ )))
1906
+ ),
1907
+ /* @__PURE__ */ import_react4.default.createElement(
1908
+ DisclosureSection,
1909
+ {
1910
+ open: showEphemeral,
1911
+ setOpen: setShowEphemeral,
1912
+ title: "Ephemeral User Data",
1913
+ colorScheme
1914
+ },
1915
+ /* @__PURE__ */ import_react4.default.createElement("div", { style: styles.sectionInner }, Object.entries(ephemeral).map(([key, value]) => /* @__PURE__ */ import_react4.default.createElement(InspectorRow, { key, colorScheme }, /* @__PURE__ */ import_react4.default.createElement(
1916
+ import_react_inspector.ObjectInspector,
1917
+ {
1918
+ name: key,
1919
+ data: value,
1920
+ theme,
1921
+ expandLevel: 10
1922
+ }
1923
+ ))))
1924
+ ),
1925
+ /* @__PURE__ */ import_react4.default.createElement(
1926
+ DisclosureSection,
1927
+ {
1928
+ open: showEvents,
1929
+ setOpen: setShowEvents,
1930
+ title: "Events",
1931
+ colorScheme
1932
+ },
1933
+ /* @__PURE__ */ import_react4.default.createElement("div", { ref: eventsContainerRef, style: styles.sectionInner }, connectionEvents?.map(
1934
+ (event, index) => event.type === "stateChange" ? /* @__PURE__ */ import_react4.default.createElement(InspectorRow, { key: index, colorScheme }, "connection:", " ", /* @__PURE__ */ import_react4.default.createElement("span", { style: { fontStyle: "italic" } }, event.state.toLowerCase())) : /* @__PURE__ */ import_react4.default.createElement(
1935
+ InspectorRow,
1936
+ {
1937
+ key: index,
1938
+ colorScheme,
1939
+ variant: event.type === "send" ? "up" : "down",
1940
+ style: {
1941
+ padding: "0px 12px 1px"
1942
+ }
1943
+ },
1944
+ /* @__PURE__ */ import_react4.default.createElement(
1945
+ import_react_inspector.ObjectInspector,
1946
+ {
1947
+ data: event.type === "error" ? event.error : event.message,
993
1948
  theme,
994
1949
  nodeRenderer: ({
995
1950
  depth,
@@ -1313,179 +2268,2936 @@ function useErrorOverlay(noyaManager) {
1313
2268
  });
1314
2269
  }
1315
2270
 
1316
- // src/noyaApp.ts
1317
- var import_state_manager2 = require("@noya-app/state-manager");
1318
- var import_react7 = require("react");
1319
- function createDefaultAppData(initialState) {
2271
+ // ../../node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
2272
+ var TransformKind = Symbol.for("TypeBox.Transform");
2273
+ var ReadonlyKind = Symbol.for("TypeBox.Readonly");
2274
+ var OptionalKind = Symbol.for("TypeBox.Optional");
2275
+ var Hint = Symbol.for("TypeBox.Hint");
2276
+ var Kind = Symbol.for("TypeBox.Kind");
2277
+
2278
+ // ../../node_modules/@sinclair/typebox/build/esm/type/any/any.mjs
2279
+ function Any(options = {}) {
2280
+ return { ...options, [Kind]: "Any" };
2281
+ }
2282
+
2283
+ // ../../node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
2284
+ var value_exports = {};
2285
+ __export(value_exports, {
2286
+ IsArray: () => IsArray,
2287
+ IsAsyncIterator: () => IsAsyncIterator,
2288
+ IsBigInt: () => IsBigInt,
2289
+ IsBoolean: () => IsBoolean,
2290
+ IsDate: () => IsDate,
2291
+ IsFunction: () => IsFunction,
2292
+ IsIterator: () => IsIterator,
2293
+ IsNull: () => IsNull,
2294
+ IsNumber: () => IsNumber,
2295
+ IsObject: () => IsObject,
2296
+ IsRegExp: () => IsRegExp,
2297
+ IsString: () => IsString,
2298
+ IsSymbol: () => IsSymbol,
2299
+ IsUint8Array: () => IsUint8Array,
2300
+ IsUndefined: () => IsUndefined
2301
+ });
2302
+ function IsAsyncIterator(value) {
2303
+ return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.asyncIterator in value;
2304
+ }
2305
+ function IsArray(value) {
2306
+ return Array.isArray(value);
2307
+ }
2308
+ function IsBigInt(value) {
2309
+ return typeof value === "bigint";
2310
+ }
2311
+ function IsBoolean(value) {
2312
+ return typeof value === "boolean";
2313
+ }
2314
+ function IsDate(value) {
2315
+ return value instanceof globalThis.Date;
2316
+ }
2317
+ function IsFunction(value) {
2318
+ return typeof value === "function";
2319
+ }
2320
+ function IsIterator(value) {
2321
+ return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.iterator in value;
2322
+ }
2323
+ function IsNull(value) {
2324
+ return value === null;
2325
+ }
2326
+ function IsNumber(value) {
2327
+ return typeof value === "number";
2328
+ }
2329
+ function IsObject(value) {
2330
+ return typeof value === "object" && value !== null;
2331
+ }
2332
+ function IsRegExp(value) {
2333
+ return value instanceof globalThis.RegExp;
2334
+ }
2335
+ function IsString(value) {
2336
+ return typeof value === "string";
2337
+ }
2338
+ function IsSymbol(value) {
2339
+ return typeof value === "symbol";
2340
+ }
2341
+ function IsUint8Array(value) {
2342
+ return value instanceof globalThis.Uint8Array;
2343
+ }
2344
+ function IsUndefined(value) {
2345
+ return value === void 0;
2346
+ }
2347
+
2348
+ // ../../node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs
2349
+ function ArrayType(value) {
2350
+ return value.map((value2) => Visit(value2));
2351
+ }
2352
+ function DateType(value) {
2353
+ return new Date(value.getTime());
2354
+ }
2355
+ function Uint8ArrayType(value) {
2356
+ return new Uint8Array(value);
2357
+ }
2358
+ function RegExpType(value) {
2359
+ return new RegExp(value.source, value.flags);
2360
+ }
2361
+ function ObjectType(value) {
2362
+ const result = {};
2363
+ for (const key of Object.getOwnPropertyNames(value)) {
2364
+ result[key] = Visit(value[key]);
2365
+ }
2366
+ for (const key of Object.getOwnPropertySymbols(value)) {
2367
+ result[key] = Visit(value[key]);
2368
+ }
2369
+ return result;
2370
+ }
2371
+ function Visit(value) {
2372
+ return IsArray(value) ? ArrayType(value) : IsDate(value) ? DateType(value) : IsUint8Array(value) ? Uint8ArrayType(value) : IsRegExp(value) ? RegExpType(value) : IsObject(value) ? ObjectType(value) : value;
2373
+ }
2374
+ function Clone(value) {
2375
+ return Visit(value);
2376
+ }
2377
+
2378
+ // ../../node_modules/@sinclair/typebox/build/esm/type/clone/type.mjs
2379
+ function CloneRest(schemas) {
2380
+ return schemas.map((schema) => CloneType(schema));
2381
+ }
2382
+ function CloneType(schema, options = {}) {
2383
+ return { ...Clone(schema), ...options };
2384
+ }
2385
+
2386
+ // ../../node_modules/@sinclair/typebox/build/esm/type/array/array.mjs
2387
+ function Array2(schema, options = {}) {
1320
2388
  return {
1321
- theme: "light",
1322
- viewType: "editable",
1323
- initialState,
1324
- inspector: false
2389
+ ...options,
2390
+ [Kind]: "Array",
2391
+ type: "array",
2392
+ items: CloneType(schema)
1325
2393
  };
1326
2394
  }
1327
- function enforceSchema(initialState, schema) {
1328
- return schema ? (0, import_state_manager2.createOrCastValue)({
1329
- schema,
1330
- value: initialState,
1331
- defs: (0, import_state_manager2.findAllDefs)(schema)
1332
- }) : initialState;
2395
+
2396
+ // ../../node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.mjs
2397
+ function AsyncIterator(items, options = {}) {
2398
+ return {
2399
+ ...options,
2400
+ [Kind]: "AsyncIterator",
2401
+ type: "AsyncIterator",
2402
+ items: CloneType(items)
2403
+ };
1333
2404
  }
1334
- function parseAppDataParameter(options) {
1335
- const window2 = options?.window ?? globalThis;
1336
- const location = window2.location;
1337
- if (!location) return null;
1338
- const urlHash = (location.hash || "").replace(/^#/, "");
1339
- const params = new URLSearchParams(urlHash);
1340
- const data = params.get("data");
1341
- if (!data) return null;
1342
- try {
1343
- return JSON.parse(data);
1344
- } catch (e) {
1345
- return null;
1346
- }
2405
+
2406
+ // ../../node_modules/@sinclair/typebox/build/esm/type/discard/discard.mjs
2407
+ function DiscardKey(value, key) {
2408
+ const { [key]: _, ...rest } = value;
2409
+ return rest;
1347
2410
  }
1348
- function getAppData(initialState, schema, options) {
1349
- const resolvedInitialState = initialState instanceof Function ? initialState() : initialState;
1350
- let appData = parseAppDataParameter(options) ?? createDefaultAppData(resolvedInitialState);
1351
- if (options?.overrideExistingState) {
1352
- appData.initialState = resolvedInitialState;
1353
- }
1354
- appData.initialState = enforceSchema(appData.initialState, schema);
1355
- return appData;
2411
+ function Discard(value, keys) {
2412
+ return keys.reduce((acc, key) => DiscardKey(acc, key), value);
1356
2413
  }
1357
- function useNoyaState(...args) {
1358
- const [initialState, options] = typeof args[0] === "object" && args[0] !== null && "schema" in args[0] && import_state_manager2.TypeGuard.IsSchema(args[0].schema) ? [null, args[0]] : [args[0], args[1]];
1359
- const [
1360
- {
1361
- multiplayerUrl,
1362
- inspector,
1363
- initialState: noyaAppInitialState,
1364
- theme,
1365
- viewType
1366
- }
1367
- ] = (0, import_react7.useState)(() => {
1368
- return getAppData(initialState, options?.schema, {
1369
- overrideExistingState: options?.overrideExistingState
1370
- });
1371
- });
1372
- const sync = (0, import_react7.useMemo)(() => {
1373
- return (0, import_state_manager2.isEmbeddedApp)() ? (0, import_state_manager2.parentFrameSync)({ debug: options?.debug }) : multiplayerUrl ? (0, import_state_manager2.webSocketSync)({
1374
- url: multiplayerUrl,
1375
- debug: options?.debug
1376
- }) : options?.offlineStorageKey ? (0, import_state_manager2.localStorageSync)({ key: options.offlineStorageKey }) : (0, import_state_manager2.stubSync)();
1377
- }, [multiplayerUrl, options?.offlineStorageKey, options?.debug]);
1378
- const result = useMultiplayerState(noyaAppInitialState, {
2414
+
2415
+ // ../../node_modules/@sinclair/typebox/build/esm/type/never/never.mjs
2416
+ function Never(options = {}) {
2417
+ return {
1379
2418
  ...options,
1380
- inspector: options?.inspector ?? inspector,
1381
- sync: options?.sync ?? sync
1382
- });
1383
- const [, , extras] = result;
1384
- const mergedExtras = (0, import_react7.useMemo)(() => {
1385
- return { ...extras, theme, viewType };
1386
- }, [extras, theme, viewType]);
1387
- return [result[0], result[1], mergedExtras];
2419
+ [Kind]: "Never",
2420
+ not: {}
2421
+ };
1388
2422
  }
1389
2423
 
1390
- // src/NoyaStateContext.tsx
1391
- var import_observable = require("@noya-app/observable");
1392
- var import_react8 = __toESM(require("react"));
1393
- var AnyNoyaStateContext = (0, import_react8.createContext)(void 0);
1394
- function useAnyNoyaStateContext() {
1395
- const value = (0, import_react8.useContext)(AnyNoyaStateContext);
1396
- if (!value) {
1397
- throw new Error(
1398
- "useNoyaStateContext must be used within a NoyaStateProvider"
1399
- );
1400
- }
1401
- return value;
2424
+ // ../../node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.mjs
2425
+ function MappedResult(properties) {
2426
+ return {
2427
+ [Kind]: "MappedResult",
2428
+ properties
2429
+ };
1402
2430
  }
1403
- function useAssets() {
1404
- const { assetManager } = useAnyNoyaStateContext();
1405
- return useObservable(assetManager.assets$);
2431
+
2432
+ // ../../node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.mjs
2433
+ function Constructor(parameters, returns, options) {
2434
+ return {
2435
+ ...options,
2436
+ [Kind]: "Constructor",
2437
+ type: "Constructor",
2438
+ parameters: CloneRest(parameters),
2439
+ returns: CloneType(returns)
2440
+ };
1406
2441
  }
1407
- function useAsset(id) {
1408
- const { assetManager } = useAnyNoyaStateContext();
1409
- const observable = (0, import_react8.useMemo)(
1410
- () => assetManager.assets$.map((assets) => assets.find((a) => a.id === id)),
1411
- [assetManager, id]
1412
- );
1413
- return useObservable(observable);
2442
+
2443
+ // ../../node_modules/@sinclair/typebox/build/esm/type/function/function.mjs
2444
+ function Function2(parameters, returns, options) {
2445
+ return {
2446
+ ...options,
2447
+ [Kind]: "Function",
2448
+ type: "Function",
2449
+ parameters: CloneRest(parameters),
2450
+ returns: CloneType(returns)
2451
+ };
1414
2452
  }
1415
- function useAssetManager() {
1416
- const { assetManager } = useAnyNoyaStateContext();
1417
- return (0, import_react8.useMemo)(
1418
- () => ({
1419
- create: assetManager.create,
1420
- delete: assetManager.delete
1421
- }),
1422
- [assetManager]
1423
- );
2453
+
2454
+ // ../../node_modules/@sinclair/typebox/build/esm/type/union/union-create.mjs
2455
+ function UnionCreate(T, options) {
2456
+ return { ...options, [Kind]: "Union", anyOf: CloneRest(T) };
1424
2457
  }
1425
- function useAIManager() {
1426
- const { aiManager } = useAnyNoyaStateContext();
1427
- return aiManager;
2458
+
2459
+ // ../../node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
2460
+ function IsReadonly(value) {
2461
+ return IsObject(value) && value[ReadonlyKind] === "Readonly";
1428
2462
  }
1429
- function useSecretManager() {
1430
- const { secretManager } = useAnyNoyaStateContext();
1431
- return secretManager;
2463
+ function IsOptional(value) {
2464
+ return IsObject(value) && value[OptionalKind] === "Optional";
1432
2465
  }
1433
- function useSecrets() {
1434
- const { secretManager } = useAnyNoyaStateContext();
1435
- return useObservable(secretManager.secrets$);
2466
+ function IsAny(value) {
2467
+ return IsKindOf(value, "Any");
1436
2468
  }
1437
- function useSecret(name) {
1438
- const { secretManager } = useAnyNoyaStateContext();
1439
- return useObservable(
1440
- secretManager.secrets$,
1441
- (0, import_react8.useCallback)((secrets) => secrets.find((s) => s.name === name), [name])
1442
- );
2469
+ function IsArray2(value) {
2470
+ return IsKindOf(value, "Array");
1443
2471
  }
1444
- function useIsInitialized() {
1445
- const {
1446
- multiplayerStateManager: ms,
1447
- secretManager,
1448
- assetManager
1449
- } = useAnyNoyaStateContext();
1450
- const isInitializedObservable = (0, import_react8.useMemo)(
1451
- () => import_observable.Observable.combine(
1452
- [
1453
- ms.isInitialized$,
1454
- secretManager.isInitialized$,
1455
- assetManager.isInitialized$
1456
- ],
1457
- (values) => values.every((v) => v)
1458
- ),
1459
- [ms, secretManager, assetManager]
1460
- );
1461
- return useObservable(isInitializedObservable);
2472
+ function IsAsyncIterator2(value) {
2473
+ return IsKindOf(value, "AsyncIterator");
1462
2474
  }
1463
- function useWorkflowManager() {
1464
- const { workflowManager } = useAnyNoyaStateContext();
1465
- return workflowManager;
2475
+ function IsBigInt2(value) {
2476
+ return IsKindOf(value, "BigInt");
1466
2477
  }
1467
- var ConnectedUsersContext = (0, import_react8.createContext)(void 0);
1468
- function useConnectedUsersManager() {
1469
- return (0, import_react8.useContext)(ConnectedUsersContext);
2478
+ function IsBoolean2(value) {
2479
+ return IsKindOf(value, "Boolean");
1470
2480
  }
1471
- var AnyEphemeralUserDataManagerContext = (0, import_react8.createContext)(void 0);
1472
- function useAnyEphemeralUserData() {
1473
- return (0, import_react8.useContext)(AnyEphemeralUserDataManagerContext);
2481
+ function IsConstructor(value) {
2482
+ return IsKindOf(value, "Constructor");
1474
2483
  }
1475
- function useCurrentUserId() {
1476
- const connectedUsersManager = useConnectedUsersManager();
1477
- return useObservable(connectedUsersManager?.currentUserId$);
2484
+ function IsDate2(value) {
2485
+ return IsKindOf(value, "Date");
1478
2486
  }
1479
- var FallbackUntilInitialized = ({
1480
- children,
1481
- fallback
1482
- }) => {
1483
- const isInitialized = useIsInitialized();
1484
- return isInitialized ? children : fallback ?? null;
1485
- };
1486
- function createNoyaContext({
2487
+ function IsFunction2(value) {
2488
+ return IsKindOf(value, "Function");
2489
+ }
2490
+ function IsInteger(value) {
2491
+ return IsKindOf(value, "Integer");
2492
+ }
2493
+ function IsIntersect(value) {
2494
+ return IsKindOf(value, "Intersect");
2495
+ }
2496
+ function IsIterator2(value) {
2497
+ return IsKindOf(value, "Iterator");
2498
+ }
2499
+ function IsKindOf(value, kind) {
2500
+ return IsObject(value) && Kind in value && value[Kind] === kind;
2501
+ }
2502
+ function IsLiteral(value) {
2503
+ return IsKindOf(value, "Literal");
2504
+ }
2505
+ function IsMappedKey(value) {
2506
+ return IsKindOf(value, "MappedKey");
2507
+ }
2508
+ function IsMappedResult(value) {
2509
+ return IsKindOf(value, "MappedResult");
2510
+ }
2511
+ function IsNever(value) {
2512
+ return IsKindOf(value, "Never");
2513
+ }
2514
+ function IsNot(value) {
2515
+ return IsKindOf(value, "Not");
2516
+ }
2517
+ function IsNull2(value) {
2518
+ return IsKindOf(value, "Null");
2519
+ }
2520
+ function IsNumber2(value) {
2521
+ return IsKindOf(value, "Number");
2522
+ }
2523
+ function IsObject2(value) {
2524
+ return IsKindOf(value, "Object");
2525
+ }
2526
+ function IsPromise(value) {
2527
+ return IsKindOf(value, "Promise");
2528
+ }
2529
+ function IsRecord(value) {
2530
+ return IsKindOf(value, "Record");
2531
+ }
2532
+ function IsRef(value) {
2533
+ return IsKindOf(value, "Ref");
2534
+ }
2535
+ function IsRegExp2(value) {
2536
+ return IsKindOf(value, "RegExp");
2537
+ }
2538
+ function IsString2(value) {
2539
+ return IsKindOf(value, "String");
2540
+ }
2541
+ function IsSymbol2(value) {
2542
+ return IsKindOf(value, "Symbol");
2543
+ }
2544
+ function IsTemplateLiteral(value) {
2545
+ return IsKindOf(value, "TemplateLiteral");
2546
+ }
2547
+ function IsThis(value) {
2548
+ return IsKindOf(value, "This");
2549
+ }
2550
+ function IsTransform(value) {
2551
+ return IsObject(value) && TransformKind in value;
2552
+ }
2553
+ function IsTuple(value) {
2554
+ return IsKindOf(value, "Tuple");
2555
+ }
2556
+ function IsUndefined2(value) {
2557
+ return IsKindOf(value, "Undefined");
2558
+ }
2559
+ function IsUnion(value) {
2560
+ return IsKindOf(value, "Union");
2561
+ }
2562
+ function IsUint8Array2(value) {
2563
+ return IsKindOf(value, "Uint8Array");
2564
+ }
2565
+ function IsUnknown(value) {
2566
+ return IsKindOf(value, "Unknown");
2567
+ }
2568
+ function IsUnsafe(value) {
2569
+ return IsKindOf(value, "Unsafe");
2570
+ }
2571
+ function IsVoid(value) {
2572
+ return IsKindOf(value, "Void");
2573
+ }
2574
+ function IsKind(value) {
2575
+ return IsObject(value) && Kind in value && IsString(value[Kind]);
2576
+ }
2577
+ function IsSchema(value) {
2578
+ return IsAny(value) || IsArray2(value) || IsBoolean2(value) || IsBigInt2(value) || IsAsyncIterator2(value) || IsConstructor(value) || IsDate2(value) || IsFunction2(value) || IsInteger(value) || IsIntersect(value) || IsIterator2(value) || IsLiteral(value) || IsMappedKey(value) || IsMappedResult(value) || IsNever(value) || IsNot(value) || IsNull2(value) || IsNumber2(value) || IsObject2(value) || IsPromise(value) || IsRecord(value) || IsRef(value) || IsRegExp2(value) || IsString2(value) || IsSymbol2(value) || IsTemplateLiteral(value) || IsThis(value) || IsTuple(value) || IsUndefined2(value) || IsUnion(value) || IsUint8Array2(value) || IsUnknown(value) || IsUnsafe(value) || IsVoid(value) || IsKind(value);
2579
+ }
2580
+
2581
+ // ../../node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs
2582
+ function IsUnionOptional(T) {
2583
+ return T.some((L) => IsOptional(L));
2584
+ }
2585
+ function RemoveOptionalFromRest(T) {
2586
+ return T.map((L) => IsOptional(L) ? RemoveOptionalFromType(L) : L);
2587
+ }
2588
+ function RemoveOptionalFromType(T) {
2589
+ return Discard(T, [OptionalKind]);
2590
+ }
2591
+ function ResolveUnion(T, options) {
2592
+ return IsUnionOptional(T) ? Optional(UnionCreate(RemoveOptionalFromRest(T), options)) : UnionCreate(RemoveOptionalFromRest(T), options);
2593
+ }
2594
+ function UnionEvaluated(T, options = {}) {
2595
+ return T.length === 0 ? Never(options) : T.length === 1 ? CloneType(T[0], options) : ResolveUnion(T, options);
2596
+ }
2597
+
2598
+ // ../../node_modules/@sinclair/typebox/build/esm/type/union/union.mjs
2599
+ function Union(T, options = {}) {
2600
+ return T.length === 0 ? Never(options) : T.length === 1 ? CloneType(T[0], options) : UnionCreate(T, options);
2601
+ }
2602
+
2603
+ // ../../node_modules/@sinclair/typebox/build/esm/type/error/error.mjs
2604
+ var TypeBoxError = class extends Error {
2605
+ constructor(message) {
2606
+ super(message);
2607
+ }
2608
+ };
2609
+
2610
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.mjs
2611
+ var TemplateLiteralParserError = class extends TypeBoxError {
2612
+ };
2613
+ function Unescape(pattern) {
2614
+ return pattern.replace(/\\\$/g, "$").replace(/\\\*/g, "*").replace(/\\\^/g, "^").replace(/\\\|/g, "|").replace(/\\\(/g, "(").replace(/\\\)/g, ")");
2615
+ }
2616
+ function IsNonEscaped(pattern, index, char) {
2617
+ return pattern[index] === char && pattern.charCodeAt(index - 1) !== 92;
2618
+ }
2619
+ function IsOpenParen(pattern, index) {
2620
+ return IsNonEscaped(pattern, index, "(");
2621
+ }
2622
+ function IsCloseParen(pattern, index) {
2623
+ return IsNonEscaped(pattern, index, ")");
2624
+ }
2625
+ function IsSeparator(pattern, index) {
2626
+ return IsNonEscaped(pattern, index, "|");
2627
+ }
2628
+ function IsGroup(pattern) {
2629
+ if (!(IsOpenParen(pattern, 0) && IsCloseParen(pattern, pattern.length - 1)))
2630
+ return false;
2631
+ let count = 0;
2632
+ for (let index = 0; index < pattern.length; index++) {
2633
+ if (IsOpenParen(pattern, index))
2634
+ count += 1;
2635
+ if (IsCloseParen(pattern, index))
2636
+ count -= 1;
2637
+ if (count === 0 && index !== pattern.length - 1)
2638
+ return false;
2639
+ }
2640
+ return true;
2641
+ }
2642
+ function InGroup(pattern) {
2643
+ return pattern.slice(1, pattern.length - 1);
2644
+ }
2645
+ function IsPrecedenceOr(pattern) {
2646
+ let count = 0;
2647
+ for (let index = 0; index < pattern.length; index++) {
2648
+ if (IsOpenParen(pattern, index))
2649
+ count += 1;
2650
+ if (IsCloseParen(pattern, index))
2651
+ count -= 1;
2652
+ if (IsSeparator(pattern, index) && count === 0)
2653
+ return true;
2654
+ }
2655
+ return false;
2656
+ }
2657
+ function IsPrecedenceAnd(pattern) {
2658
+ for (let index = 0; index < pattern.length; index++) {
2659
+ if (IsOpenParen(pattern, index))
2660
+ return true;
2661
+ }
2662
+ return false;
2663
+ }
2664
+ function Or(pattern) {
2665
+ let [count, start] = [0, 0];
2666
+ const expressions = [];
2667
+ for (let index = 0; index < pattern.length; index++) {
2668
+ if (IsOpenParen(pattern, index))
2669
+ count += 1;
2670
+ if (IsCloseParen(pattern, index))
2671
+ count -= 1;
2672
+ if (IsSeparator(pattern, index) && count === 0) {
2673
+ const range2 = pattern.slice(start, index);
2674
+ if (range2.length > 0)
2675
+ expressions.push(TemplateLiteralParse(range2));
2676
+ start = index + 1;
2677
+ }
2678
+ }
2679
+ const range = pattern.slice(start);
2680
+ if (range.length > 0)
2681
+ expressions.push(TemplateLiteralParse(range));
2682
+ if (expressions.length === 0)
2683
+ return { type: "const", const: "" };
2684
+ if (expressions.length === 1)
2685
+ return expressions[0];
2686
+ return { type: "or", expr: expressions };
2687
+ }
2688
+ function And(pattern) {
2689
+ function Group(value, index) {
2690
+ if (!IsOpenParen(value, index))
2691
+ throw new TemplateLiteralParserError(`TemplateLiteralParser: Index must point to open parens`);
2692
+ let count = 0;
2693
+ for (let scan = index; scan < value.length; scan++) {
2694
+ if (IsOpenParen(value, scan))
2695
+ count += 1;
2696
+ if (IsCloseParen(value, scan))
2697
+ count -= 1;
2698
+ if (count === 0)
2699
+ return [index, scan];
2700
+ }
2701
+ throw new TemplateLiteralParserError(`TemplateLiteralParser: Unclosed group parens in expression`);
2702
+ }
2703
+ function Range(pattern2, index) {
2704
+ for (let scan = index; scan < pattern2.length; scan++) {
2705
+ if (IsOpenParen(pattern2, scan))
2706
+ return [index, scan];
2707
+ }
2708
+ return [index, pattern2.length];
2709
+ }
2710
+ const expressions = [];
2711
+ for (let index = 0; index < pattern.length; index++) {
2712
+ if (IsOpenParen(pattern, index)) {
2713
+ const [start, end] = Group(pattern, index);
2714
+ const range = pattern.slice(start, end + 1);
2715
+ expressions.push(TemplateLiteralParse(range));
2716
+ index = end;
2717
+ } else {
2718
+ const [start, end] = Range(pattern, index);
2719
+ const range = pattern.slice(start, end);
2720
+ if (range.length > 0)
2721
+ expressions.push(TemplateLiteralParse(range));
2722
+ index = end - 1;
2723
+ }
2724
+ }
2725
+ return expressions.length === 0 ? { type: "const", const: "" } : expressions.length === 1 ? expressions[0] : { type: "and", expr: expressions };
2726
+ }
2727
+ function TemplateLiteralParse(pattern) {
2728
+ return IsGroup(pattern) ? TemplateLiteralParse(InGroup(pattern)) : IsPrecedenceOr(pattern) ? Or(pattern) : IsPrecedenceAnd(pattern) ? And(pattern) : { type: "const", const: Unescape(pattern) };
2729
+ }
2730
+ function TemplateLiteralParseExact(pattern) {
2731
+ return TemplateLiteralParse(pattern.slice(1, pattern.length - 1));
2732
+ }
2733
+
2734
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.mjs
2735
+ var TemplateLiteralFiniteError = class extends TypeBoxError {
2736
+ };
2737
+ function IsNumberExpression(expression) {
2738
+ return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "0" && expression.expr[1].type === "const" && expression.expr[1].const === "[1-9][0-9]*";
2739
+ }
2740
+ function IsBooleanExpression(expression) {
2741
+ return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "true" && expression.expr[1].type === "const" && expression.expr[1].const === "false";
2742
+ }
2743
+ function IsStringExpression(expression) {
2744
+ return expression.type === "const" && expression.const === ".*";
2745
+ }
2746
+ function IsTemplateLiteralExpressionFinite(expression) {
2747
+ return IsNumberExpression(expression) || IsStringExpression(expression) ? false : IsBooleanExpression(expression) ? true : expression.type === "and" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "or" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "const" ? true : (() => {
2748
+ throw new TemplateLiteralFiniteError(`Unknown expression type`);
2749
+ })();
2750
+ }
2751
+ function IsTemplateLiteralFinite(schema) {
2752
+ const expression = TemplateLiteralParseExact(schema.pattern);
2753
+ return IsTemplateLiteralExpressionFinite(expression);
2754
+ }
2755
+
2756
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.mjs
2757
+ var TemplateLiteralGenerateError = class extends TypeBoxError {
2758
+ };
2759
+ function* GenerateReduce(buffer) {
2760
+ if (buffer.length === 1)
2761
+ return yield* buffer[0];
2762
+ for (const left of buffer[0]) {
2763
+ for (const right of GenerateReduce(buffer.slice(1))) {
2764
+ yield `${left}${right}`;
2765
+ }
2766
+ }
2767
+ }
2768
+ function* GenerateAnd(expression) {
2769
+ return yield* GenerateReduce(expression.expr.map((expr) => [...TemplateLiteralExpressionGenerate(expr)]));
2770
+ }
2771
+ function* GenerateOr(expression) {
2772
+ for (const expr of expression.expr)
2773
+ yield* TemplateLiteralExpressionGenerate(expr);
2774
+ }
2775
+ function* GenerateConst(expression) {
2776
+ return yield expression.const;
2777
+ }
2778
+ function* TemplateLiteralExpressionGenerate(expression) {
2779
+ return expression.type === "and" ? yield* GenerateAnd(expression) : expression.type === "or" ? yield* GenerateOr(expression) : expression.type === "const" ? yield* GenerateConst(expression) : (() => {
2780
+ throw new TemplateLiteralGenerateError("Unknown expression");
2781
+ })();
2782
+ }
2783
+ function TemplateLiteralGenerate(schema) {
2784
+ const expression = TemplateLiteralParseExact(schema.pattern);
2785
+ return IsTemplateLiteralExpressionFinite(expression) ? [...TemplateLiteralExpressionGenerate(expression)] : [];
2786
+ }
2787
+
2788
+ // ../../node_modules/@sinclair/typebox/build/esm/type/literal/literal.mjs
2789
+ function Literal(value, options = {}) {
2790
+ return {
2791
+ ...options,
2792
+ [Kind]: "Literal",
2793
+ const: value,
2794
+ type: typeof value
2795
+ };
2796
+ }
2797
+
2798
+ // ../../node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.mjs
2799
+ function Boolean(options = {}) {
2800
+ return {
2801
+ ...options,
2802
+ [Kind]: "Boolean",
2803
+ type: "boolean"
2804
+ };
2805
+ }
2806
+
2807
+ // ../../node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs
2808
+ function BigInt2(options = {}) {
2809
+ return {
2810
+ ...options,
2811
+ [Kind]: "BigInt",
2812
+ type: "bigint"
2813
+ };
2814
+ }
2815
+
2816
+ // ../../node_modules/@sinclair/typebox/build/esm/type/number/number.mjs
2817
+ function Number2(options = {}) {
2818
+ return {
2819
+ ...options,
2820
+ [Kind]: "Number",
2821
+ type: "number"
2822
+ };
2823
+ }
2824
+
2825
+ // ../../node_modules/@sinclair/typebox/build/esm/type/string/string.mjs
2826
+ function String(options = {}) {
2827
+ return { ...options, [Kind]: "String", type: "string" };
2828
+ }
2829
+
2830
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs
2831
+ function* FromUnion(syntax) {
2832
+ const trim = syntax.trim().replace(/"|'/g, "");
2833
+ return trim === "boolean" ? yield Boolean() : trim === "number" ? yield Number2() : trim === "bigint" ? yield BigInt2() : trim === "string" ? yield String() : yield (() => {
2834
+ const literals = trim.split("|").map((literal) => Literal(literal.trim()));
2835
+ return literals.length === 0 ? Never() : literals.length === 1 ? literals[0] : UnionEvaluated(literals);
2836
+ })();
2837
+ }
2838
+ function* FromTerminal(syntax) {
2839
+ if (syntax[1] !== "{") {
2840
+ const L = Literal("$");
2841
+ const R = FromSyntax(syntax.slice(1));
2842
+ return yield* [L, ...R];
2843
+ }
2844
+ for (let i = 2; i < syntax.length; i++) {
2845
+ if (syntax[i] === "}") {
2846
+ const L = FromUnion(syntax.slice(2, i));
2847
+ const R = FromSyntax(syntax.slice(i + 1));
2848
+ return yield* [...L, ...R];
2849
+ }
2850
+ }
2851
+ yield Literal(syntax);
2852
+ }
2853
+ function* FromSyntax(syntax) {
2854
+ for (let i = 0; i < syntax.length; i++) {
2855
+ if (syntax[i] === "$") {
2856
+ const L = Literal(syntax.slice(0, i));
2857
+ const R = FromTerminal(syntax.slice(i));
2858
+ return yield* [L, ...R];
2859
+ }
2860
+ }
2861
+ yield Literal(syntax);
2862
+ }
2863
+ function TemplateLiteralSyntax(syntax) {
2864
+ return [...FromSyntax(syntax)];
2865
+ }
2866
+
2867
+ // ../../node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs
2868
+ var PatternBoolean = "(true|false)";
2869
+ var PatternNumber = "(0|[1-9][0-9]*)";
2870
+ var PatternString = "(.*)";
2871
+ var PatternBooleanExact = `^${PatternBoolean}$`;
2872
+ var PatternNumberExact = `^${PatternNumber}$`;
2873
+ var PatternStringExact = `^${PatternString}$`;
2874
+
2875
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.mjs
2876
+ var TemplateLiteralPatternError = class extends TypeBoxError {
2877
+ };
2878
+ function Escape(value) {
2879
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2880
+ }
2881
+ function Visit2(schema, acc) {
2882
+ return IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion(schema) ? `(${schema.anyOf.map((schema2) => Visit2(schema2, acc)).join("|")})` : IsNumber2(schema) ? `${acc}${PatternNumber}` : IsInteger(schema) ? `${acc}${PatternNumber}` : IsBigInt2(schema) ? `${acc}${PatternNumber}` : IsString2(schema) ? `${acc}${PatternString}` : IsLiteral(schema) ? `${acc}${Escape(schema.const.toString())}` : IsBoolean2(schema) ? `${acc}${PatternBoolean}` : (() => {
2883
+ throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[Kind]}'`);
2884
+ })();
2885
+ }
2886
+ function TemplateLiteralPattern(kinds) {
2887
+ return `^${kinds.map((schema) => Visit2(schema, "")).join("")}$`;
2888
+ }
2889
+
2890
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/union.mjs
2891
+ function TemplateLiteralToUnion(schema) {
2892
+ const R = TemplateLiteralGenerate(schema);
2893
+ const L = R.map((S) => Literal(S));
2894
+ return UnionEvaluated(L);
2895
+ }
2896
+
2897
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.mjs
2898
+ function TemplateLiteral(unresolved, options = {}) {
2899
+ const pattern = IsString(unresolved) ? TemplateLiteralPattern(TemplateLiteralSyntax(unresolved)) : TemplateLiteralPattern(unresolved);
2900
+ return { ...options, [Kind]: "TemplateLiteral", type: "string", pattern };
2901
+ }
2902
+
2903
+ // ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.mjs
2904
+ function FromTemplateLiteral(T) {
2905
+ const R = TemplateLiteralGenerate(T);
2906
+ return R.map((S) => S.toString());
2907
+ }
2908
+ function FromUnion2(T) {
2909
+ const Acc = [];
2910
+ for (const L of T)
2911
+ Acc.push(...IndexPropertyKeys(L));
2912
+ return Acc;
2913
+ }
2914
+ function FromLiteral(T) {
2915
+ return [T.toString()];
2916
+ }
2917
+ function IndexPropertyKeys(T) {
2918
+ return [...new Set(IsTemplateLiteral(T) ? FromTemplateLiteral(T) : IsUnion(T) ? FromUnion2(T.anyOf) : IsLiteral(T) ? FromLiteral(T.const) : IsNumber2(T) ? ["[number]"] : IsInteger(T) ? ["[number]"] : [])];
2919
+ }
2920
+
2921
+ // ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs
2922
+ function FromProperties(T, P, options) {
2923
+ const Acc = {};
2924
+ for (const K2 of Object.getOwnPropertyNames(P)) {
2925
+ Acc[K2] = Index(T, IndexPropertyKeys(P[K2]), options);
2926
+ }
2927
+ return Acc;
2928
+ }
2929
+ function FromMappedResult(T, R, options) {
2930
+ return FromProperties(T, R.properties, options);
2931
+ }
2932
+ function IndexFromMappedResult(T, R, options) {
2933
+ const P = FromMappedResult(T, R, options);
2934
+ return MappedResult(P);
2935
+ }
2936
+
2937
+ // ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.mjs
2938
+ function FromRest(T, K) {
2939
+ return T.map((L) => IndexFromPropertyKey(L, K));
2940
+ }
2941
+ function FromIntersectRest(T) {
2942
+ return T.filter((L) => !IsNever(L));
2943
+ }
2944
+ function FromIntersect(T, K) {
2945
+ return IntersectEvaluated(FromIntersectRest(FromRest(T, K)));
2946
+ }
2947
+ function FromUnionRest(T) {
2948
+ return T.some((L) => IsNever(L)) ? [] : T;
2949
+ }
2950
+ function FromUnion3(T, K) {
2951
+ return UnionEvaluated(FromUnionRest(FromRest(T, K)));
2952
+ }
2953
+ function FromTuple(T, K) {
2954
+ return K in T ? T[K] : K === "[number]" ? UnionEvaluated(T) : Never();
2955
+ }
2956
+ function FromArray(T, K) {
2957
+ return K === "[number]" ? T : Never();
2958
+ }
2959
+ function FromProperty(T, K) {
2960
+ return K in T ? T[K] : Never();
2961
+ }
2962
+ function IndexFromPropertyKey(T, K) {
2963
+ return IsIntersect(T) ? FromIntersect(T.allOf, K) : IsUnion(T) ? FromUnion3(T.anyOf, K) : IsTuple(T) ? FromTuple(T.items ?? [], K) : IsArray2(T) ? FromArray(T.items, K) : IsObject2(T) ? FromProperty(T.properties, K) : Never();
2964
+ }
2965
+ function IndexFromPropertyKeys(T, K) {
2966
+ return K.map((L) => IndexFromPropertyKey(T, L));
2967
+ }
2968
+ function FromSchema(T, K) {
2969
+ return UnionEvaluated(IndexFromPropertyKeys(T, K));
2970
+ }
2971
+ function Index(T, K, options = {}) {
2972
+ return IsMappedResult(K) ? CloneType(IndexFromMappedResult(T, K, options)) : IsMappedKey(K) ? CloneType(IndexFromMappedKey(T, K, options)) : IsSchema(K) ? CloneType(FromSchema(T, IndexPropertyKeys(K)), options) : CloneType(FromSchema(T, K), options);
2973
+ }
2974
+
2975
+ // ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs
2976
+ function MappedIndexPropertyKey(T, K, options) {
2977
+ return { [K]: Index(T, [K], options) };
2978
+ }
2979
+ function MappedIndexPropertyKeys(T, K, options) {
2980
+ return K.reduce((Acc, L) => {
2981
+ return { ...Acc, ...MappedIndexPropertyKey(T, L, options) };
2982
+ }, {});
2983
+ }
2984
+ function MappedIndexProperties(T, K, options) {
2985
+ return MappedIndexPropertyKeys(T, K.keys, options);
2986
+ }
2987
+ function IndexFromMappedKey(T, K, options) {
2988
+ const P = MappedIndexProperties(T, K, options);
2989
+ return MappedResult(P);
2990
+ }
2991
+
2992
+ // ../../node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.mjs
2993
+ function Iterator(items, options = {}) {
2994
+ return {
2995
+ ...options,
2996
+ [Kind]: "Iterator",
2997
+ type: "Iterator",
2998
+ items: CloneType(items)
2999
+ };
3000
+ }
3001
+
3002
+ // ../../node_modules/@sinclair/typebox/build/esm/type/object/object.mjs
3003
+ function _Object(properties, options = {}) {
3004
+ const propertyKeys = globalThis.Object.getOwnPropertyNames(properties);
3005
+ const optionalKeys = propertyKeys.filter((key) => IsOptional(properties[key]));
3006
+ const requiredKeys = propertyKeys.filter((name) => !optionalKeys.includes(name));
3007
+ const clonedAdditionalProperties = IsSchema(options.additionalProperties) ? { additionalProperties: CloneType(options.additionalProperties) } : {};
3008
+ const clonedProperties = {};
3009
+ for (const key of propertyKeys)
3010
+ clonedProperties[key] = CloneType(properties[key]);
3011
+ return requiredKeys.length > 0 ? { ...options, ...clonedAdditionalProperties, [Kind]: "Object", type: "object", properties: clonedProperties, required: requiredKeys } : { ...options, ...clonedAdditionalProperties, [Kind]: "Object", type: "object", properties: clonedProperties };
3012
+ }
3013
+ var Object2 = _Object;
3014
+
3015
+ // ../../node_modules/@sinclair/typebox/build/esm/type/promise/promise.mjs
3016
+ function Promise2(item, options = {}) {
3017
+ return {
3018
+ ...options,
3019
+ [Kind]: "Promise",
3020
+ type: "Promise",
3021
+ item: CloneType(item)
3022
+ };
3023
+ }
3024
+
3025
+ // ../../node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.mjs
3026
+ function RemoveReadonly(schema) {
3027
+ return Discard(CloneType(schema), [ReadonlyKind]);
3028
+ }
3029
+ function AddReadonly(schema) {
3030
+ return { ...CloneType(schema), [ReadonlyKind]: "Readonly" };
3031
+ }
3032
+ function ReadonlyWithFlag(schema, F) {
3033
+ return F === false ? RemoveReadonly(schema) : AddReadonly(schema);
3034
+ }
3035
+ function Readonly(schema, enable) {
3036
+ const F = enable ?? true;
3037
+ return IsMappedResult(schema) ? ReadonlyFromMappedResult(schema, F) : ReadonlyWithFlag(schema, F);
3038
+ }
3039
+
3040
+ // ../../node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs
3041
+ function FromProperties2(K, F) {
3042
+ const Acc = {};
3043
+ for (const K2 of globalThis.Object.getOwnPropertyNames(K))
3044
+ Acc[K2] = Readonly(K[K2], F);
3045
+ return Acc;
3046
+ }
3047
+ function FromMappedResult2(R, F) {
3048
+ return FromProperties2(R.properties, F);
3049
+ }
3050
+ function ReadonlyFromMappedResult(R, F) {
3051
+ const P = FromMappedResult2(R, F);
3052
+ return MappedResult(P);
3053
+ }
3054
+
3055
+ // ../../node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.mjs
3056
+ function Tuple(items, options = {}) {
3057
+ const [additionalItems, minItems, maxItems] = [false, items.length, items.length];
3058
+ return items.length > 0 ? { ...options, [Kind]: "Tuple", type: "array", items: CloneRest(items), additionalItems, minItems, maxItems } : { ...options, [Kind]: "Tuple", type: "array", minItems, maxItems };
3059
+ }
3060
+
3061
+ // ../../node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs
3062
+ function SetIncludes(T, S) {
3063
+ return T.includes(S);
3064
+ }
3065
+ function SetDistinct(T) {
3066
+ return [...new Set(T)];
3067
+ }
3068
+ function SetIntersect(T, S) {
3069
+ return T.filter((L) => S.includes(L));
3070
+ }
3071
+ function SetIntersectManyResolve(T, Init) {
3072
+ return T.reduce((Acc, L) => {
3073
+ return SetIntersect(Acc, L);
3074
+ }, Init);
3075
+ }
3076
+ function SetIntersectMany(T) {
3077
+ return T.length === 1 ? T[0] : T.length > 1 ? SetIntersectManyResolve(T.slice(1), T[0]) : [];
3078
+ }
3079
+ function SetUnionMany(T) {
3080
+ const Acc = [];
3081
+ for (const L of T)
3082
+ Acc.push(...L);
3083
+ return Acc;
3084
+ }
3085
+
3086
+ // ../../node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs
3087
+ function FromMappedResult3(K, P) {
3088
+ return K in P ? FromSchemaType(K, P[K]) : MappedResult(P);
3089
+ }
3090
+ function MappedKeyToKnownMappedResultProperties(K) {
3091
+ return { [K]: Literal(K) };
3092
+ }
3093
+ function MappedKeyToUnknownMappedResultProperties(P) {
3094
+ const Acc = {};
3095
+ for (const L of P)
3096
+ Acc[L] = Literal(L);
3097
+ return Acc;
3098
+ }
3099
+ function MappedKeyToMappedResultProperties(K, P) {
3100
+ return SetIncludes(P, K) ? MappedKeyToKnownMappedResultProperties(K) : MappedKeyToUnknownMappedResultProperties(P);
3101
+ }
3102
+ function FromMappedKey(K, P) {
3103
+ const R = MappedKeyToMappedResultProperties(K, P);
3104
+ return FromMappedResult3(K, R);
3105
+ }
3106
+ function FromRest2(K, T) {
3107
+ return T.map((L) => FromSchemaType(K, L));
3108
+ }
3109
+ function FromProperties3(K, T) {
3110
+ const Acc = {};
3111
+ for (const K2 of globalThis.Object.getOwnPropertyNames(T))
3112
+ Acc[K2] = FromSchemaType(K, T[K2]);
3113
+ return Acc;
3114
+ }
3115
+ function FromSchemaType(K, T) {
3116
+ return (
3117
+ // unevaluated modifier types
3118
+ IsOptional(T) ? Optional(FromSchemaType(K, Discard(T, [OptionalKind]))) : IsReadonly(T) ? Readonly(FromSchemaType(K, Discard(T, [ReadonlyKind]))) : (
3119
+ // unevaluated mapped types
3120
+ IsMappedResult(T) ? FromMappedResult3(K, T.properties) : IsMappedKey(T) ? FromMappedKey(K, T.keys) : (
3121
+ // unevaluated types
3122
+ IsConstructor(T) ? Constructor(FromRest2(K, T.parameters), FromSchemaType(K, T.returns)) : IsFunction2(T) ? Function2(FromRest2(K, T.parameters), FromSchemaType(K, T.returns)) : IsAsyncIterator2(T) ? AsyncIterator(FromSchemaType(K, T.items)) : IsIterator2(T) ? Iterator(FromSchemaType(K, T.items)) : IsIntersect(T) ? Intersect(FromRest2(K, T.allOf)) : IsUnion(T) ? Union(FromRest2(K, T.anyOf)) : IsTuple(T) ? Tuple(FromRest2(K, T.items ?? [])) : IsObject2(T) ? Object2(FromProperties3(K, T.properties)) : IsArray2(T) ? Array2(FromSchemaType(K, T.items)) : IsPromise(T) ? Promise2(FromSchemaType(K, T.item)) : T
3123
+ )
3124
+ )
3125
+ );
3126
+ }
3127
+ function MappedFunctionReturnType(K, T) {
3128
+ const Acc = {};
3129
+ for (const L of K)
3130
+ Acc[L] = FromSchemaType(L, T);
3131
+ return Acc;
3132
+ }
3133
+ function Mapped(key, map3, options = {}) {
3134
+ const K = IsSchema(key) ? IndexPropertyKeys(key) : key;
3135
+ const RT = map3({ [Kind]: "MappedKey", keys: K });
3136
+ const R = MappedFunctionReturnType(K, RT);
3137
+ return CloneType(Object2(R), options);
3138
+ }
3139
+
3140
+ // ../../node_modules/@sinclair/typebox/build/esm/type/optional/optional.mjs
3141
+ function RemoveOptional(schema) {
3142
+ return Discard(CloneType(schema), [OptionalKind]);
3143
+ }
3144
+ function AddOptional(schema) {
3145
+ return { ...CloneType(schema), [OptionalKind]: "Optional" };
3146
+ }
3147
+ function OptionalWithFlag(schema, F) {
3148
+ return F === false ? RemoveOptional(schema) : AddOptional(schema);
3149
+ }
3150
+ function Optional(schema, enable) {
3151
+ const F = enable ?? true;
3152
+ return IsMappedResult(schema) ? OptionalFromMappedResult(schema, F) : OptionalWithFlag(schema, F);
3153
+ }
3154
+
3155
+ // ../../node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs
3156
+ function FromProperties4(P, F) {
3157
+ const Acc = {};
3158
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
3159
+ Acc[K2] = Optional(P[K2], F);
3160
+ return Acc;
3161
+ }
3162
+ function FromMappedResult4(R, F) {
3163
+ return FromProperties4(R.properties, F);
3164
+ }
3165
+ function OptionalFromMappedResult(R, F) {
3166
+ const P = FromMappedResult4(R, F);
3167
+ return MappedResult(P);
3168
+ }
3169
+
3170
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs
3171
+ function IntersectCreate(T, options) {
3172
+ const allObjects = T.every((schema) => IsObject2(schema));
3173
+ const clonedUnevaluatedProperties = IsSchema(options.unevaluatedProperties) ? { unevaluatedProperties: CloneType(options.unevaluatedProperties) } : {};
3174
+ return options.unevaluatedProperties === false || IsSchema(options.unevaluatedProperties) || allObjects ? { ...options, ...clonedUnevaluatedProperties, [Kind]: "Intersect", type: "object", allOf: CloneRest(T) } : { ...options, ...clonedUnevaluatedProperties, [Kind]: "Intersect", allOf: CloneRest(T) };
3175
+ }
3176
+
3177
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs
3178
+ function IsIntersectOptional(T) {
3179
+ return T.every((L) => IsOptional(L));
3180
+ }
3181
+ function RemoveOptionalFromType2(T) {
3182
+ return Discard(T, [OptionalKind]);
3183
+ }
3184
+ function RemoveOptionalFromRest2(T) {
3185
+ return T.map((L) => IsOptional(L) ? RemoveOptionalFromType2(L) : L);
3186
+ }
3187
+ function ResolveIntersect(T, options) {
3188
+ return IsIntersectOptional(T) ? Optional(IntersectCreate(RemoveOptionalFromRest2(T), options)) : IntersectCreate(RemoveOptionalFromRest2(T), options);
3189
+ }
3190
+ function IntersectEvaluated(T, options = {}) {
3191
+ if (T.length === 0)
3192
+ return Never(options);
3193
+ if (T.length === 1)
3194
+ return CloneType(T[0], options);
3195
+ if (T.some((schema) => IsTransform(schema)))
3196
+ throw new Error("Cannot intersect transform types");
3197
+ return ResolveIntersect(T, options);
3198
+ }
3199
+
3200
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.mjs
3201
+ function Intersect(T, options = {}) {
3202
+ if (T.length === 0)
3203
+ return Never(options);
3204
+ if (T.length === 1)
3205
+ return CloneType(T[0], options);
3206
+ if (T.some((schema) => IsTransform(schema)))
3207
+ throw new Error("Cannot intersect transform types");
3208
+ return IntersectCreate(T, options);
3209
+ }
3210
+
3211
+ // ../../node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.mjs
3212
+ function FromRest3(T) {
3213
+ return T.map((L) => AwaitedResolve(L));
3214
+ }
3215
+ function FromIntersect2(T) {
3216
+ return Intersect(FromRest3(T));
3217
+ }
3218
+ function FromUnion4(T) {
3219
+ return Union(FromRest3(T));
3220
+ }
3221
+ function FromPromise(T) {
3222
+ return AwaitedResolve(T);
3223
+ }
3224
+ function AwaitedResolve(T) {
3225
+ return IsIntersect(T) ? FromIntersect2(T.allOf) : IsUnion(T) ? FromUnion4(T.anyOf) : IsPromise(T) ? FromPromise(T.item) : T;
3226
+ }
3227
+ function Awaited(T, options = {}) {
3228
+ return CloneType(AwaitedResolve(T), options);
3229
+ }
3230
+
3231
+ // ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs
3232
+ function FromRest4(T) {
3233
+ const Acc = [];
3234
+ for (const L of T)
3235
+ Acc.push(KeyOfPropertyKeys(L));
3236
+ return Acc;
3237
+ }
3238
+ function FromIntersect3(T) {
3239
+ const C = FromRest4(T);
3240
+ const R = SetUnionMany(C);
3241
+ return R;
3242
+ }
3243
+ function FromUnion5(T) {
3244
+ const C = FromRest4(T);
3245
+ const R = SetIntersectMany(C);
3246
+ return R;
3247
+ }
3248
+ function FromTuple2(T) {
3249
+ return T.map((_, I) => I.toString());
3250
+ }
3251
+ function FromArray2(_) {
3252
+ return ["[number]"];
3253
+ }
3254
+ function FromProperties5(T) {
3255
+ return globalThis.Object.getOwnPropertyNames(T);
3256
+ }
3257
+ function FromPatternProperties(patternProperties) {
3258
+ if (!includePatternProperties)
3259
+ return [];
3260
+ const patternPropertyKeys = globalThis.Object.getOwnPropertyNames(patternProperties);
3261
+ return patternPropertyKeys.map((key) => {
3262
+ return key[0] === "^" && key[key.length - 1] === "$" ? key.slice(1, key.length - 1) : key;
3263
+ });
3264
+ }
3265
+ function KeyOfPropertyKeys(T) {
3266
+ return IsIntersect(T) ? FromIntersect3(T.allOf) : IsUnion(T) ? FromUnion5(T.anyOf) : IsTuple(T) ? FromTuple2(T.items ?? []) : IsArray2(T) ? FromArray2(T.items) : IsObject2(T) ? FromProperties5(T.properties) : IsRecord(T) ? FromPatternProperties(T.patternProperties) : [];
3267
+ }
3268
+ var includePatternProperties = false;
3269
+
3270
+ // ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs
3271
+ function KeyOfPropertyKeysToRest(T) {
3272
+ return T.map((L) => L === "[number]" ? Number2() : Literal(L));
3273
+ }
3274
+ function KeyOf(T, options = {}) {
3275
+ if (IsMappedResult(T)) {
3276
+ return KeyOfFromMappedResult(T, options);
3277
+ } else {
3278
+ const K = KeyOfPropertyKeys(T);
3279
+ const S = KeyOfPropertyKeysToRest(K);
3280
+ const U = UnionEvaluated(S);
3281
+ return CloneType(U, options);
3282
+ }
3283
+ }
3284
+
3285
+ // ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs
3286
+ function FromProperties6(K, options) {
3287
+ const Acc = {};
3288
+ for (const K2 of globalThis.Object.getOwnPropertyNames(K))
3289
+ Acc[K2] = KeyOf(K[K2], options);
3290
+ return Acc;
3291
+ }
3292
+ function FromMappedResult5(R, options) {
3293
+ return FromProperties6(R.properties, options);
3294
+ }
3295
+ function KeyOfFromMappedResult(R, options) {
3296
+ const P = FromMappedResult5(R, options);
3297
+ return MappedResult(P);
3298
+ }
3299
+
3300
+ // ../../node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs
3301
+ function CompositeKeys(T) {
3302
+ const Acc = [];
3303
+ for (const L of T)
3304
+ Acc.push(...KeyOfPropertyKeys(L));
3305
+ return SetDistinct(Acc);
3306
+ }
3307
+ function FilterNever(T) {
3308
+ return T.filter((L) => !IsNever(L));
3309
+ }
3310
+ function CompositeProperty(T, K) {
3311
+ const Acc = [];
3312
+ for (const L of T)
3313
+ Acc.push(...IndexFromPropertyKeys(L, [K]));
3314
+ return FilterNever(Acc);
3315
+ }
3316
+ function CompositeProperties(T, K) {
3317
+ const Acc = {};
3318
+ for (const L of K) {
3319
+ Acc[L] = IntersectEvaluated(CompositeProperty(T, L));
3320
+ }
3321
+ return Acc;
3322
+ }
3323
+ function Composite(T, options = {}) {
3324
+ const K = CompositeKeys(T);
3325
+ const P = CompositeProperties(T, K);
3326
+ const R = Object2(P, options);
3327
+ return R;
3328
+ }
3329
+
3330
+ // ../../node_modules/@sinclair/typebox/build/esm/type/date/date.mjs
3331
+ function Date2(options = {}) {
3332
+ return {
3333
+ ...options,
3334
+ [Kind]: "Date",
3335
+ type: "Date"
3336
+ };
3337
+ }
3338
+
3339
+ // ../../node_modules/@sinclair/typebox/build/esm/type/null/null.mjs
3340
+ function Null(options = {}) {
3341
+ return {
3342
+ ...options,
3343
+ [Kind]: "Null",
3344
+ type: "null"
3345
+ };
3346
+ }
3347
+
3348
+ // ../../node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.mjs
3349
+ function Symbol2(options) {
3350
+ return { ...options, [Kind]: "Symbol", type: "symbol" };
3351
+ }
3352
+
3353
+ // ../../node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.mjs
3354
+ function Undefined(options = {}) {
3355
+ return { ...options, [Kind]: "Undefined", type: "undefined" };
3356
+ }
3357
+
3358
+ // ../../node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.mjs
3359
+ function Uint8Array2(options = {}) {
3360
+ return { ...options, [Kind]: "Uint8Array", type: "Uint8Array" };
3361
+ }
3362
+
3363
+ // ../../node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.mjs
3364
+ function Unknown(options = {}) {
3365
+ return {
3366
+ ...options,
3367
+ [Kind]: "Unknown"
3368
+ };
3369
+ }
3370
+
3371
+ // ../../node_modules/@sinclair/typebox/build/esm/type/const/const.mjs
3372
+ function FromArray3(T) {
3373
+ return T.map((L) => FromValue(L, false));
3374
+ }
3375
+ function FromProperties7(value) {
3376
+ const Acc = {};
3377
+ for (const K of globalThis.Object.getOwnPropertyNames(value))
3378
+ Acc[K] = Readonly(FromValue(value[K], false));
3379
+ return Acc;
3380
+ }
3381
+ function ConditionalReadonly(T, root) {
3382
+ return root === true ? T : Readonly(T);
3383
+ }
3384
+ function FromValue(value, root) {
3385
+ return IsAsyncIterator(value) ? ConditionalReadonly(Any(), root) : IsIterator(value) ? ConditionalReadonly(Any(), root) : IsArray(value) ? Readonly(Tuple(FromArray3(value))) : IsUint8Array(value) ? Uint8Array2() : IsDate(value) ? Date2() : IsObject(value) ? ConditionalReadonly(Object2(FromProperties7(value)), root) : IsFunction(value) ? ConditionalReadonly(Function2([], Unknown()), root) : IsUndefined(value) ? Undefined() : IsNull(value) ? Null() : IsSymbol(value) ? Symbol2() : IsBigInt(value) ? BigInt2() : IsNumber(value) ? Literal(value) : IsBoolean(value) ? Literal(value) : IsString(value) ? Literal(value) : Object2({});
3386
+ }
3387
+ function Const(T, options = {}) {
3388
+ return CloneType(FromValue(T, true), options);
3389
+ }
3390
+
3391
+ // ../../node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs
3392
+ function ConstructorParameters(schema, options = {}) {
3393
+ return Tuple(CloneRest(schema.parameters), { ...options });
3394
+ }
3395
+
3396
+ // ../../node_modules/@sinclair/typebox/build/esm/type/deref/deref.mjs
3397
+ function FromRest5(schema, references) {
3398
+ return schema.map((schema2) => Deref(schema2, references));
3399
+ }
3400
+ function FromProperties8(properties, references) {
3401
+ const Acc = {};
3402
+ for (const K of globalThis.Object.getOwnPropertyNames(properties)) {
3403
+ Acc[K] = Deref(properties[K], references);
3404
+ }
3405
+ return Acc;
3406
+ }
3407
+ function FromConstructor(schema, references) {
3408
+ schema.parameters = FromRest5(schema.parameters, references);
3409
+ schema.returns = Deref(schema.returns, references);
3410
+ return schema;
3411
+ }
3412
+ function FromFunction(schema, references) {
3413
+ schema.parameters = FromRest5(schema.parameters, references);
3414
+ schema.returns = Deref(schema.returns, references);
3415
+ return schema;
3416
+ }
3417
+ function FromIntersect4(schema, references) {
3418
+ schema.allOf = FromRest5(schema.allOf, references);
3419
+ return schema;
3420
+ }
3421
+ function FromUnion6(schema, references) {
3422
+ schema.anyOf = FromRest5(schema.anyOf, references);
3423
+ return schema;
3424
+ }
3425
+ function FromTuple3(schema, references) {
3426
+ if (IsUndefined(schema.items))
3427
+ return schema;
3428
+ schema.items = FromRest5(schema.items, references);
3429
+ return schema;
3430
+ }
3431
+ function FromArray4(schema, references) {
3432
+ schema.items = Deref(schema.items, references);
3433
+ return schema;
3434
+ }
3435
+ function FromObject(schema, references) {
3436
+ schema.properties = FromProperties8(schema.properties, references);
3437
+ return schema;
3438
+ }
3439
+ function FromPromise2(schema, references) {
3440
+ schema.item = Deref(schema.item, references);
3441
+ return schema;
3442
+ }
3443
+ function FromAsyncIterator(schema, references) {
3444
+ schema.items = Deref(schema.items, references);
3445
+ return schema;
3446
+ }
3447
+ function FromIterator(schema, references) {
3448
+ schema.items = Deref(schema.items, references);
3449
+ return schema;
3450
+ }
3451
+ function FromRef(schema, references) {
3452
+ const target = references.find((remote) => remote.$id === schema.$ref);
3453
+ if (target === void 0)
3454
+ throw Error(`Unable to dereference schema with $id ${schema.$ref}`);
3455
+ const discard = Discard(target, ["$id"]);
3456
+ return Deref(discard, references);
3457
+ }
3458
+ function DerefResolve(schema, references) {
3459
+ return IsConstructor(schema) ? FromConstructor(schema, references) : IsFunction2(schema) ? FromFunction(schema, references) : IsIntersect(schema) ? FromIntersect4(schema, references) : IsUnion(schema) ? FromUnion6(schema, references) : IsTuple(schema) ? FromTuple3(schema, references) : IsArray2(schema) ? FromArray4(schema, references) : IsObject2(schema) ? FromObject(schema, references) : IsPromise(schema) ? FromPromise2(schema, references) : IsAsyncIterator2(schema) ? FromAsyncIterator(schema, references) : IsIterator2(schema) ? FromIterator(schema, references) : IsRef(schema) ? FromRef(schema, references) : schema;
3460
+ }
3461
+ function Deref(schema, references) {
3462
+ return DerefResolve(CloneType(schema), CloneRest(references));
3463
+ }
3464
+
3465
+ // ../../node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs
3466
+ function Enum(item, options = {}) {
3467
+ if (IsUndefined(item))
3468
+ throw new Error("Enum undefined or empty");
3469
+ const values1 = globalThis.Object.getOwnPropertyNames(item).filter((key) => isNaN(key)).map((key) => item[key]);
3470
+ const values2 = [...new Set(values1)];
3471
+ const anyOf = values2.map((value) => Literal(value));
3472
+ return Union(anyOf, { ...options, [Hint]: "Enum" });
3473
+ }
3474
+
3475
+ // ../../node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
3476
+ var type_exports = {};
3477
+ __export(type_exports, {
3478
+ IsAny: () => IsAny2,
3479
+ IsArray: () => IsArray3,
3480
+ IsAsyncIterator: () => IsAsyncIterator3,
3481
+ IsBigInt: () => IsBigInt3,
3482
+ IsBoolean: () => IsBoolean3,
3483
+ IsConstructor: () => IsConstructor2,
3484
+ IsDate: () => IsDate3,
3485
+ IsFunction: () => IsFunction3,
3486
+ IsInteger: () => IsInteger2,
3487
+ IsIntersect: () => IsIntersect2,
3488
+ IsIterator: () => IsIterator3,
3489
+ IsKind: () => IsKind2,
3490
+ IsKindOf: () => IsKindOf2,
3491
+ IsLiteral: () => IsLiteral2,
3492
+ IsLiteralBoolean: () => IsLiteralBoolean,
3493
+ IsLiteralNumber: () => IsLiteralNumber,
3494
+ IsLiteralString: () => IsLiteralString,
3495
+ IsLiteralValue: () => IsLiteralValue,
3496
+ IsMappedKey: () => IsMappedKey2,
3497
+ IsMappedResult: () => IsMappedResult2,
3498
+ IsNever: () => IsNever2,
3499
+ IsNot: () => IsNot2,
3500
+ IsNull: () => IsNull3,
3501
+ IsNumber: () => IsNumber3,
3502
+ IsObject: () => IsObject3,
3503
+ IsOptional: () => IsOptional2,
3504
+ IsPromise: () => IsPromise2,
3505
+ IsProperties: () => IsProperties,
3506
+ IsReadonly: () => IsReadonly2,
3507
+ IsRecord: () => IsRecord2,
3508
+ IsRecursive: () => IsRecursive,
3509
+ IsRef: () => IsRef2,
3510
+ IsRegExp: () => IsRegExp3,
3511
+ IsSchema: () => IsSchema2,
3512
+ IsString: () => IsString3,
3513
+ IsSymbol: () => IsSymbol3,
3514
+ IsTemplateLiteral: () => IsTemplateLiteral2,
3515
+ IsThis: () => IsThis2,
3516
+ IsTransform: () => IsTransform2,
3517
+ IsTuple: () => IsTuple2,
3518
+ IsUint8Array: () => IsUint8Array3,
3519
+ IsUndefined: () => IsUndefined3,
3520
+ IsUnion: () => IsUnion2,
3521
+ IsUnionLiteral: () => IsUnionLiteral,
3522
+ IsUnknown: () => IsUnknown2,
3523
+ IsUnsafe: () => IsUnsafe2,
3524
+ IsVoid: () => IsVoid2,
3525
+ TypeGuardUnknownTypeError: () => TypeGuardUnknownTypeError
3526
+ });
3527
+ var TypeGuardUnknownTypeError = class extends TypeBoxError {
3528
+ };
3529
+ var KnownTypes = [
3530
+ "Any",
3531
+ "Array",
3532
+ "AsyncIterator",
3533
+ "BigInt",
3534
+ "Boolean",
3535
+ "Constructor",
3536
+ "Date",
3537
+ "Enum",
3538
+ "Function",
3539
+ "Integer",
3540
+ "Intersect",
3541
+ "Iterator",
3542
+ "Literal",
3543
+ "MappedKey",
3544
+ "MappedResult",
3545
+ "Not",
3546
+ "Null",
3547
+ "Number",
3548
+ "Object",
3549
+ "Promise",
3550
+ "Record",
3551
+ "Ref",
3552
+ "RegExp",
3553
+ "String",
3554
+ "Symbol",
3555
+ "TemplateLiteral",
3556
+ "This",
3557
+ "Tuple",
3558
+ "Undefined",
3559
+ "Union",
3560
+ "Uint8Array",
3561
+ "Unknown",
3562
+ "Void"
3563
+ ];
3564
+ function IsPattern(value) {
3565
+ try {
3566
+ new RegExp(value);
3567
+ return true;
3568
+ } catch {
3569
+ return false;
3570
+ }
3571
+ }
3572
+ function IsControlCharacterFree(value) {
3573
+ if (!IsString(value))
3574
+ return false;
3575
+ for (let i = 0; i < value.length; i++) {
3576
+ const code = value.charCodeAt(i);
3577
+ if (code >= 7 && code <= 13 || code === 27 || code === 127) {
3578
+ return false;
3579
+ }
3580
+ }
3581
+ return true;
3582
+ }
3583
+ function IsAdditionalProperties(value) {
3584
+ return IsOptionalBoolean(value) || IsSchema2(value);
3585
+ }
3586
+ function IsOptionalBigInt(value) {
3587
+ return IsUndefined(value) || IsBigInt(value);
3588
+ }
3589
+ function IsOptionalNumber(value) {
3590
+ return IsUndefined(value) || IsNumber(value);
3591
+ }
3592
+ function IsOptionalBoolean(value) {
3593
+ return IsUndefined(value) || IsBoolean(value);
3594
+ }
3595
+ function IsOptionalString(value) {
3596
+ return IsUndefined(value) || IsString(value);
3597
+ }
3598
+ function IsOptionalPattern(value) {
3599
+ return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value) && IsPattern(value);
3600
+ }
3601
+ function IsOptionalFormat(value) {
3602
+ return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value);
3603
+ }
3604
+ function IsOptionalSchema(value) {
3605
+ return IsUndefined(value) || IsSchema2(value);
3606
+ }
3607
+ function IsReadonly2(value) {
3608
+ return IsObject(value) && value[ReadonlyKind] === "Readonly";
3609
+ }
3610
+ function IsOptional2(value) {
3611
+ return IsObject(value) && value[OptionalKind] === "Optional";
3612
+ }
3613
+ function IsAny2(value) {
3614
+ return IsKindOf2(value, "Any") && IsOptionalString(value.$id);
3615
+ }
3616
+ function IsArray3(value) {
3617
+ return IsKindOf2(value, "Array") && value.type === "array" && IsOptionalString(value.$id) && IsSchema2(value.items) && IsOptionalNumber(value.minItems) && IsOptionalNumber(value.maxItems) && IsOptionalBoolean(value.uniqueItems) && IsOptionalSchema(value.contains) && IsOptionalNumber(value.minContains) && IsOptionalNumber(value.maxContains);
3618
+ }
3619
+ function IsAsyncIterator3(value) {
3620
+ return IsKindOf2(value, "AsyncIterator") && value.type === "AsyncIterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
3621
+ }
3622
+ function IsBigInt3(value) {
3623
+ return IsKindOf2(value, "BigInt") && value.type === "bigint" && IsOptionalString(value.$id) && IsOptionalBigInt(value.exclusiveMaximum) && IsOptionalBigInt(value.exclusiveMinimum) && IsOptionalBigInt(value.maximum) && IsOptionalBigInt(value.minimum) && IsOptionalBigInt(value.multipleOf);
3624
+ }
3625
+ function IsBoolean3(value) {
3626
+ return IsKindOf2(value, "Boolean") && value.type === "boolean" && IsOptionalString(value.$id);
3627
+ }
3628
+ function IsConstructor2(value) {
3629
+ return IsKindOf2(value, "Constructor") && value.type === "Constructor" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
3630
+ }
3631
+ function IsDate3(value) {
3632
+ return IsKindOf2(value, "Date") && value.type === "Date" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximumTimestamp) && IsOptionalNumber(value.exclusiveMinimumTimestamp) && IsOptionalNumber(value.maximumTimestamp) && IsOptionalNumber(value.minimumTimestamp) && IsOptionalNumber(value.multipleOfTimestamp);
3633
+ }
3634
+ function IsFunction3(value) {
3635
+ return IsKindOf2(value, "Function") && value.type === "Function" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
3636
+ }
3637
+ function IsInteger2(value) {
3638
+ return IsKindOf2(value, "Integer") && value.type === "integer" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
3639
+ }
3640
+ function IsProperties(value) {
3641
+ return IsObject(value) && Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && IsSchema2(schema));
3642
+ }
3643
+ function IsIntersect2(value) {
3644
+ return IsKindOf2(value, "Intersect") && (IsString(value.type) && value.type !== "object" ? false : true) && IsArray(value.allOf) && value.allOf.every((schema) => IsSchema2(schema) && !IsTransform2(schema)) && IsOptionalString(value.type) && (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) && IsOptionalString(value.$id);
3645
+ }
3646
+ function IsIterator3(value) {
3647
+ return IsKindOf2(value, "Iterator") && value.type === "Iterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
3648
+ }
3649
+ function IsKindOf2(value, kind) {
3650
+ return IsObject(value) && Kind in value && value[Kind] === kind;
3651
+ }
3652
+ function IsLiteralString(value) {
3653
+ return IsLiteral2(value) && IsString(value.const);
3654
+ }
3655
+ function IsLiteralNumber(value) {
3656
+ return IsLiteral2(value) && IsNumber(value.const);
3657
+ }
3658
+ function IsLiteralBoolean(value) {
3659
+ return IsLiteral2(value) && IsBoolean(value.const);
3660
+ }
3661
+ function IsLiteral2(value) {
3662
+ return IsKindOf2(value, "Literal") && IsOptionalString(value.$id) && IsLiteralValue(value.const);
3663
+ }
3664
+ function IsLiteralValue(value) {
3665
+ return IsBoolean(value) || IsNumber(value) || IsString(value);
3666
+ }
3667
+ function IsMappedKey2(value) {
3668
+ return IsKindOf2(value, "MappedKey") && IsArray(value.keys) && value.keys.every((key) => IsNumber(key) || IsString(key));
3669
+ }
3670
+ function IsMappedResult2(value) {
3671
+ return IsKindOf2(value, "MappedResult") && IsProperties(value.properties);
3672
+ }
3673
+ function IsNever2(value) {
3674
+ return IsKindOf2(value, "Never") && IsObject(value.not) && Object.getOwnPropertyNames(value.not).length === 0;
3675
+ }
3676
+ function IsNot2(value) {
3677
+ return IsKindOf2(value, "Not") && IsSchema2(value.not);
3678
+ }
3679
+ function IsNull3(value) {
3680
+ return IsKindOf2(value, "Null") && value.type === "null" && IsOptionalString(value.$id);
3681
+ }
3682
+ function IsNumber3(value) {
3683
+ return IsKindOf2(value, "Number") && value.type === "number" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
3684
+ }
3685
+ function IsObject3(value) {
3686
+ return IsKindOf2(value, "Object") && value.type === "object" && IsOptionalString(value.$id) && IsProperties(value.properties) && IsAdditionalProperties(value.additionalProperties) && IsOptionalNumber(value.minProperties) && IsOptionalNumber(value.maxProperties);
3687
+ }
3688
+ function IsPromise2(value) {
3689
+ return IsKindOf2(value, "Promise") && value.type === "Promise" && IsOptionalString(value.$id) && IsSchema2(value.item);
3690
+ }
3691
+ function IsRecord2(value) {
3692
+ return IsKindOf2(value, "Record") && value.type === "object" && IsOptionalString(value.$id) && IsAdditionalProperties(value.additionalProperties) && IsObject(value.patternProperties) && ((schema) => {
3693
+ const keys = Object.getOwnPropertyNames(schema.patternProperties);
3694
+ return keys.length === 1 && IsPattern(keys[0]) && IsObject(schema.patternProperties) && IsSchema2(schema.patternProperties[keys[0]]);
3695
+ })(value);
3696
+ }
3697
+ function IsRecursive(value) {
3698
+ return IsObject(value) && Hint in value && value[Hint] === "Recursive";
3699
+ }
3700
+ function IsRef2(value) {
3701
+ return IsKindOf2(value, "Ref") && IsOptionalString(value.$id) && IsString(value.$ref);
3702
+ }
3703
+ function IsRegExp3(value) {
3704
+ return IsKindOf2(value, "RegExp") && IsOptionalString(value.$id) && IsString(value.source) && IsString(value.flags) && IsOptionalNumber(value.maxLength) && IsOptionalNumber(value.minLength);
3705
+ }
3706
+ function IsString3(value) {
3707
+ return IsKindOf2(value, "String") && value.type === "string" && IsOptionalString(value.$id) && IsOptionalNumber(value.minLength) && IsOptionalNumber(value.maxLength) && IsOptionalPattern(value.pattern) && IsOptionalFormat(value.format);
3708
+ }
3709
+ function IsSymbol3(value) {
3710
+ return IsKindOf2(value, "Symbol") && value.type === "symbol" && IsOptionalString(value.$id);
3711
+ }
3712
+ function IsTemplateLiteral2(value) {
3713
+ return IsKindOf2(value, "TemplateLiteral") && value.type === "string" && IsString(value.pattern) && value.pattern[0] === "^" && value.pattern[value.pattern.length - 1] === "$";
3714
+ }
3715
+ function IsThis2(value) {
3716
+ return IsKindOf2(value, "This") && IsOptionalString(value.$id) && IsString(value.$ref);
3717
+ }
3718
+ function IsTransform2(value) {
3719
+ return IsObject(value) && TransformKind in value;
3720
+ }
3721
+ function IsTuple2(value) {
3722
+ return IsKindOf2(value, "Tuple") && value.type === "array" && IsOptionalString(value.$id) && IsNumber(value.minItems) && IsNumber(value.maxItems) && value.minItems === value.maxItems && // empty
3723
+ (IsUndefined(value.items) && IsUndefined(value.additionalItems) && value.minItems === 0 || IsArray(value.items) && value.items.every((schema) => IsSchema2(schema)));
3724
+ }
3725
+ function IsUndefined3(value) {
3726
+ return IsKindOf2(value, "Undefined") && value.type === "undefined" && IsOptionalString(value.$id);
3727
+ }
3728
+ function IsUnionLiteral(value) {
3729
+ return IsUnion2(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema));
3730
+ }
3731
+ function IsUnion2(value) {
3732
+ return IsKindOf2(value, "Union") && IsOptionalString(value.$id) && IsObject(value) && IsArray(value.anyOf) && value.anyOf.every((schema) => IsSchema2(schema));
3733
+ }
3734
+ function IsUint8Array3(value) {
3735
+ return IsKindOf2(value, "Uint8Array") && value.type === "Uint8Array" && IsOptionalString(value.$id) && IsOptionalNumber(value.minByteLength) && IsOptionalNumber(value.maxByteLength);
3736
+ }
3737
+ function IsUnknown2(value) {
3738
+ return IsKindOf2(value, "Unknown") && IsOptionalString(value.$id);
3739
+ }
3740
+ function IsUnsafe2(value) {
3741
+ return IsKindOf2(value, "Unsafe");
3742
+ }
3743
+ function IsVoid2(value) {
3744
+ return IsKindOf2(value, "Void") && value.type === "void" && IsOptionalString(value.$id);
3745
+ }
3746
+ function IsKind2(value) {
3747
+ return IsObject(value) && Kind in value && IsString(value[Kind]) && !KnownTypes.includes(value[Kind]);
3748
+ }
3749
+ function IsSchema2(value) {
3750
+ return IsObject(value) && (IsAny2(value) || IsArray3(value) || IsBoolean3(value) || IsBigInt3(value) || IsAsyncIterator3(value) || IsConstructor2(value) || IsDate3(value) || IsFunction3(value) || IsInteger2(value) || IsIntersect2(value) || IsIterator3(value) || IsLiteral2(value) || IsMappedKey2(value) || IsMappedResult2(value) || IsNever2(value) || IsNot2(value) || IsNull3(value) || IsNumber3(value) || IsObject3(value) || IsPromise2(value) || IsRecord2(value) || IsRef2(value) || IsRegExp3(value) || IsString3(value) || IsSymbol3(value) || IsTemplateLiteral2(value) || IsThis2(value) || IsTuple2(value) || IsUndefined3(value) || IsUnion2(value) || IsUint8Array3(value) || IsUnknown2(value) || IsUnsafe2(value) || IsVoid2(value) || IsKind2(value));
3751
+ }
3752
+
3753
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.mjs
3754
+ var ExtendsResolverError = class extends TypeBoxError {
3755
+ };
3756
+ var ExtendsResult;
3757
+ (function(ExtendsResult2) {
3758
+ ExtendsResult2[ExtendsResult2["Union"] = 0] = "Union";
3759
+ ExtendsResult2[ExtendsResult2["True"] = 1] = "True";
3760
+ ExtendsResult2[ExtendsResult2["False"] = 2] = "False";
3761
+ })(ExtendsResult || (ExtendsResult = {}));
3762
+ function IntoBooleanResult(result) {
3763
+ return result === ExtendsResult.False ? result : ExtendsResult.True;
3764
+ }
3765
+ function Throw(message) {
3766
+ throw new ExtendsResolverError(message);
3767
+ }
3768
+ function IsStructuralRight(right) {
3769
+ return type_exports.IsNever(right) || type_exports.IsIntersect(right) || type_exports.IsUnion(right) || type_exports.IsUnknown(right) || type_exports.IsAny(right);
3770
+ }
3771
+ function StructuralRight(left, right) {
3772
+ return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : Throw("StructuralRight");
3773
+ }
3774
+ function FromAnyRight(left, right) {
3775
+ return ExtendsResult.True;
3776
+ }
3777
+ function FromAny(left, right) {
3778
+ return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) && right.anyOf.some((schema) => type_exports.IsAny(schema) || type_exports.IsUnknown(schema)) ? ExtendsResult.True : type_exports.IsUnion(right) ? ExtendsResult.Union : type_exports.IsUnknown(right) ? ExtendsResult.True : type_exports.IsAny(right) ? ExtendsResult.True : ExtendsResult.Union;
3779
+ }
3780
+ function FromArrayRight(left, right) {
3781
+ return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) ? ExtendsResult.True : ExtendsResult.False;
3782
+ }
3783
+ function FromArray5(left, right) {
3784
+ return type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsArray(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
3785
+ }
3786
+ function FromAsyncIterator2(left, right) {
3787
+ return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsAsyncIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
3788
+ }
3789
+ function FromBigInt(left, right) {
3790
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBigInt(right) ? ExtendsResult.True : ExtendsResult.False;
3791
+ }
3792
+ function FromBooleanRight(left, right) {
3793
+ return type_exports.IsLiteralBoolean(left) ? ExtendsResult.True : type_exports.IsBoolean(left) ? ExtendsResult.True : ExtendsResult.False;
3794
+ }
3795
+ function FromBoolean(left, right) {
3796
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBoolean(right) ? ExtendsResult.True : ExtendsResult.False;
3797
+ }
3798
+ function FromConstructor2(left, right) {
3799
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsConstructor(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit3(right.parameters[index], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
3800
+ }
3801
+ function FromDate(left, right) {
3802
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsDate(right) ? ExtendsResult.True : ExtendsResult.False;
3803
+ }
3804
+ function FromFunction2(left, right) {
3805
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsFunction(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit3(right.parameters[index], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
3806
+ }
3807
+ function FromIntegerRight(left, right) {
3808
+ return type_exports.IsLiteral(left) && value_exports.IsNumber(left.const) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
3809
+ }
3810
+ function FromInteger(left, right) {
3811
+ return type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : ExtendsResult.False;
3812
+ }
3813
+ function FromIntersectRight(left, right) {
3814
+ return right.allOf.every((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3815
+ }
3816
+ function FromIntersect5(left, right) {
3817
+ return left.allOf.some((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3818
+ }
3819
+ function FromIterator2(left, right) {
3820
+ return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
3821
+ }
3822
+ function FromLiteral2(left, right) {
3823
+ return type_exports.IsLiteral(right) && right.const === left.const ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : ExtendsResult.False;
3824
+ }
3825
+ function FromNeverRight(left, right) {
3826
+ return ExtendsResult.False;
3827
+ }
3828
+ function FromNever(left, right) {
3829
+ return ExtendsResult.True;
3830
+ }
3831
+ function UnwrapTNot(schema) {
3832
+ let [current, depth] = [schema, 0];
3833
+ while (true) {
3834
+ if (!type_exports.IsNot(current))
3835
+ break;
3836
+ current = current.not;
3837
+ depth += 1;
3838
+ }
3839
+ return depth % 2 === 0 ? current : Unknown();
3840
+ }
3841
+ function FromNot(left, right) {
3842
+ return type_exports.IsNot(left) ? Visit3(UnwrapTNot(left), right) : type_exports.IsNot(right) ? Visit3(left, UnwrapTNot(right)) : Throw("Invalid fallthrough for Not");
3843
+ }
3844
+ function FromNull(left, right) {
3845
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsNull(right) ? ExtendsResult.True : ExtendsResult.False;
3846
+ }
3847
+ function FromNumberRight(left, right) {
3848
+ return type_exports.IsLiteralNumber(left) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
3849
+ }
3850
+ function FromNumber(left, right) {
3851
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : ExtendsResult.False;
3852
+ }
3853
+ function IsObjectPropertyCount(schema, count) {
3854
+ return Object.getOwnPropertyNames(schema.properties).length === count;
3855
+ }
3856
+ function IsObjectStringLike(schema) {
3857
+ return IsObjectArrayLike(schema);
3858
+ }
3859
+ function IsObjectSymbolLike(schema) {
3860
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "description" in schema.properties && type_exports.IsUnion(schema.properties.description) && schema.properties.description.anyOf.length === 2 && (type_exports.IsString(schema.properties.description.anyOf[0]) && type_exports.IsUndefined(schema.properties.description.anyOf[1]) || type_exports.IsString(schema.properties.description.anyOf[1]) && type_exports.IsUndefined(schema.properties.description.anyOf[0]));
3861
+ }
3862
+ function IsObjectNumberLike(schema) {
3863
+ return IsObjectPropertyCount(schema, 0);
3864
+ }
3865
+ function IsObjectBooleanLike(schema) {
3866
+ return IsObjectPropertyCount(schema, 0);
3867
+ }
3868
+ function IsObjectBigIntLike(schema) {
3869
+ return IsObjectPropertyCount(schema, 0);
3870
+ }
3871
+ function IsObjectDateLike(schema) {
3872
+ return IsObjectPropertyCount(schema, 0);
3873
+ }
3874
+ function IsObjectUint8ArrayLike(schema) {
3875
+ return IsObjectArrayLike(schema);
3876
+ }
3877
+ function IsObjectFunctionLike(schema) {
3878
+ const length = Number2();
3879
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
3880
+ }
3881
+ function IsObjectConstructorLike(schema) {
3882
+ return IsObjectPropertyCount(schema, 0);
3883
+ }
3884
+ function IsObjectArrayLike(schema) {
3885
+ const length = Number2();
3886
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
3887
+ }
3888
+ function IsObjectPromiseLike(schema) {
3889
+ const then = Function2([Any()], Any());
3890
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "then" in schema.properties && IntoBooleanResult(Visit3(schema.properties["then"], then)) === ExtendsResult.True;
3891
+ }
3892
+ function Property(left, right) {
3893
+ return Visit3(left, right) === ExtendsResult.False ? ExtendsResult.False : type_exports.IsOptional(left) && !type_exports.IsOptional(right) ? ExtendsResult.False : ExtendsResult.True;
3894
+ }
3895
+ function FromObjectRight(left, right) {
3896
+ return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) || type_exports.IsLiteralString(left) && IsObjectStringLike(right) || type_exports.IsLiteralNumber(left) && IsObjectNumberLike(right) || type_exports.IsLiteralBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsBigInt(left) && IsObjectBigIntLike(right) || type_exports.IsString(left) && IsObjectStringLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsNumber(left) && IsObjectNumberLike(right) || type_exports.IsInteger(left) && IsObjectNumberLike(right) || type_exports.IsBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsUint8Array(left) && IsObjectUint8ArrayLike(right) || type_exports.IsDate(left) && IsObjectDateLike(right) || type_exports.IsConstructor(left) && IsObjectConstructorLike(right) || type_exports.IsFunction(left) && IsObjectFunctionLike(right) ? ExtendsResult.True : type_exports.IsRecord(left) && type_exports.IsString(RecordKey(left)) ? (() => {
3897
+ return right[Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False;
3898
+ })() : type_exports.IsRecord(left) && type_exports.IsNumber(RecordKey(left)) ? (() => {
3899
+ return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False;
3900
+ })() : ExtendsResult.False;
3901
+ }
3902
+ function FromObject2(left, right) {
3903
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : !type_exports.IsObject(right) ? ExtendsResult.False : (() => {
3904
+ for (const key of Object.getOwnPropertyNames(right.properties)) {
3905
+ if (!(key in left.properties) && !type_exports.IsOptional(right.properties[key])) {
3906
+ return ExtendsResult.False;
3907
+ }
3908
+ if (type_exports.IsOptional(right.properties[key])) {
3909
+ return ExtendsResult.True;
3910
+ }
3911
+ if (Property(left.properties[key], right.properties[key]) === ExtendsResult.False) {
3912
+ return ExtendsResult.False;
3913
+ }
3914
+ }
3915
+ return ExtendsResult.True;
3916
+ })();
3917
+ }
3918
+ function FromPromise3(left, right) {
3919
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectPromiseLike(right) ? ExtendsResult.True : !type_exports.IsPromise(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.item, right.item));
3920
+ }
3921
+ function RecordKey(schema) {
3922
+ return PatternNumberExact in schema.patternProperties ? Number2() : PatternStringExact in schema.patternProperties ? String() : Throw("Unknown record key pattern");
3923
+ }
3924
+ function RecordValue(schema) {
3925
+ return PatternNumberExact in schema.patternProperties ? schema.patternProperties[PatternNumberExact] : PatternStringExact in schema.patternProperties ? schema.patternProperties[PatternStringExact] : Throw("Unable to get record value schema");
3926
+ }
3927
+ function FromRecordRight(left, right) {
3928
+ const [Key, Value] = [RecordKey(right), RecordValue(right)];
3929
+ return type_exports.IsLiteralString(left) && type_exports.IsNumber(Key) && IntoBooleanResult(Visit3(left, Value)) === ExtendsResult.True ? ExtendsResult.True : type_exports.IsUint8Array(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsString(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsArray(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsObject(left) ? (() => {
3930
+ for (const key of Object.getOwnPropertyNames(left.properties)) {
3931
+ if (Property(Value, left.properties[key]) === ExtendsResult.False) {
3932
+ return ExtendsResult.False;
3933
+ }
3934
+ }
3935
+ return ExtendsResult.True;
3936
+ })() : ExtendsResult.False;
3937
+ }
3938
+ function FromRecord(left, right) {
3939
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsRecord(right) ? ExtendsResult.False : Visit3(RecordValue(left), RecordValue(right));
3940
+ }
3941
+ function FromRegExp(left, right) {
3942
+ const L = type_exports.IsRegExp(left) ? String() : left;
3943
+ const R = type_exports.IsRegExp(right) ? String() : right;
3944
+ return Visit3(L, R);
3945
+ }
3946
+ function FromStringRight(left, right) {
3947
+ return type_exports.IsLiteral(left) && value_exports.IsString(left.const) ? ExtendsResult.True : type_exports.IsString(left) ? ExtendsResult.True : ExtendsResult.False;
3948
+ }
3949
+ function FromString(left, right) {
3950
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? ExtendsResult.True : ExtendsResult.False;
3951
+ }
3952
+ function FromSymbol(left, right) {
3953
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsSymbol(right) ? ExtendsResult.True : ExtendsResult.False;
3954
+ }
3955
+ function FromTemplateLiteral2(left, right) {
3956
+ return type_exports.IsTemplateLiteral(left) ? Visit3(TemplateLiteralToUnion(left), right) : type_exports.IsTemplateLiteral(right) ? Visit3(left, TemplateLiteralToUnion(right)) : Throw("Invalid fallthrough for TemplateLiteral");
3957
+ }
3958
+ function IsArrayOfTuple(left, right) {
3959
+ return type_exports.IsArray(right) && left.items !== void 0 && left.items.every((schema) => Visit3(schema, right.items) === ExtendsResult.True);
3960
+ }
3961
+ function FromTupleRight(left, right) {
3962
+ return type_exports.IsNever(left) ? ExtendsResult.True : type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : ExtendsResult.False;
3963
+ }
3964
+ function FromTuple4(left, right) {
3965
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : type_exports.IsArray(right) && IsArrayOfTuple(left, right) ? ExtendsResult.True : !type_exports.IsTuple(right) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) || !value_exports.IsUndefined(left.items) && value_exports.IsUndefined(right.items) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) ? ExtendsResult.True : left.items.every((schema, index) => Visit3(schema, right.items[index]) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3966
+ }
3967
+ function FromUint8Array(left, right) {
3968
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsUint8Array(right) ? ExtendsResult.True : ExtendsResult.False;
3969
+ }
3970
+ function FromUndefined(left, right) {
3971
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsVoid(right) ? FromVoidRight(left, right) : type_exports.IsUndefined(right) ? ExtendsResult.True : ExtendsResult.False;
3972
+ }
3973
+ function FromUnionRight(left, right) {
3974
+ return right.anyOf.some((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3975
+ }
3976
+ function FromUnion7(left, right) {
3977
+ return left.anyOf.every((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3978
+ }
3979
+ function FromUnknownRight(left, right) {
3980
+ return ExtendsResult.True;
3981
+ }
3982
+ function FromUnknown(left, right) {
3983
+ return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : type_exports.IsArray(right) ? FromArrayRight(left, right) : type_exports.IsTuple(right) ? FromTupleRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsUnknown(right) ? ExtendsResult.True : ExtendsResult.False;
3984
+ }
3985
+ function FromVoidRight(left, right) {
3986
+ return type_exports.IsUndefined(left) ? ExtendsResult.True : type_exports.IsUndefined(left) ? ExtendsResult.True : ExtendsResult.False;
3987
+ }
3988
+ function FromVoid(left, right) {
3989
+ return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsVoid(right) ? ExtendsResult.True : ExtendsResult.False;
3990
+ }
3991
+ function Visit3(left, right) {
3992
+ return (
3993
+ // resolvable
3994
+ type_exports.IsTemplateLiteral(left) || type_exports.IsTemplateLiteral(right) ? FromTemplateLiteral2(left, right) : type_exports.IsRegExp(left) || type_exports.IsRegExp(right) ? FromRegExp(left, right) : type_exports.IsNot(left) || type_exports.IsNot(right) ? FromNot(left, right) : (
3995
+ // standard
3996
+ type_exports.IsAny(left) ? FromAny(left, right) : type_exports.IsArray(left) ? FromArray5(left, right) : type_exports.IsBigInt(left) ? FromBigInt(left, right) : type_exports.IsBoolean(left) ? FromBoolean(left, right) : type_exports.IsAsyncIterator(left) ? FromAsyncIterator2(left, right) : type_exports.IsConstructor(left) ? FromConstructor2(left, right) : type_exports.IsDate(left) ? FromDate(left, right) : type_exports.IsFunction(left) ? FromFunction2(left, right) : type_exports.IsInteger(left) ? FromInteger(left, right) : type_exports.IsIntersect(left) ? FromIntersect5(left, right) : type_exports.IsIterator(left) ? FromIterator2(left, right) : type_exports.IsLiteral(left) ? FromLiteral2(left, right) : type_exports.IsNever(left) ? FromNever(left, right) : type_exports.IsNull(left) ? FromNull(left, right) : type_exports.IsNumber(left) ? FromNumber(left, right) : type_exports.IsObject(left) ? FromObject2(left, right) : type_exports.IsRecord(left) ? FromRecord(left, right) : type_exports.IsString(left) ? FromString(left, right) : type_exports.IsSymbol(left) ? FromSymbol(left, right) : type_exports.IsTuple(left) ? FromTuple4(left, right) : type_exports.IsPromise(left) ? FromPromise3(left, right) : type_exports.IsUint8Array(left) ? FromUint8Array(left, right) : type_exports.IsUndefined(left) ? FromUndefined(left, right) : type_exports.IsUnion(left) ? FromUnion7(left, right) : type_exports.IsUnknown(left) ? FromUnknown(left, right) : type_exports.IsVoid(left) ? FromVoid(left, right) : Throw(`Unknown left type operand '${left[Kind]}'`)
3997
+ )
3998
+ );
3999
+ }
4000
+ function ExtendsCheck(left, right) {
4001
+ return Visit3(left, right);
4002
+ }
4003
+
4004
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.mjs
4005
+ function FromProperties9(P, Right, True, False, options) {
4006
+ const Acc = {};
4007
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4008
+ Acc[K2] = Extends(P[K2], Right, True, False, options);
4009
+ return Acc;
4010
+ }
4011
+ function FromMappedResult6(Left, Right, True, False, options) {
4012
+ return FromProperties9(Left.properties, Right, True, False, options);
4013
+ }
4014
+ function ExtendsFromMappedResult(Left, Right, True, False, options) {
4015
+ const P = FromMappedResult6(Left, Right, True, False, options);
4016
+ return MappedResult(P);
4017
+ }
4018
+
4019
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends.mjs
4020
+ function ExtendsResolve(left, right, trueType, falseType) {
4021
+ const R = ExtendsCheck(left, right);
4022
+ return R === ExtendsResult.Union ? Union([trueType, falseType]) : R === ExtendsResult.True ? trueType : falseType;
4023
+ }
4024
+ function Extends(L, R, T, F, options = {}) {
4025
+ return IsMappedResult(L) ? ExtendsFromMappedResult(L, R, T, F, options) : IsMappedKey(L) ? CloneType(ExtendsFromMappedKey(L, R, T, F, options)) : CloneType(ExtendsResolve(L, R, T, F), options);
4026
+ }
4027
+
4028
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs
4029
+ function FromPropertyKey(K, U, L, R, options) {
4030
+ return {
4031
+ [K]: Extends(Literal(K), U, L, R, options)
4032
+ };
4033
+ }
4034
+ function FromPropertyKeys(K, U, L, R, options) {
4035
+ return K.reduce((Acc, LK) => {
4036
+ return { ...Acc, ...FromPropertyKey(LK, U, L, R, options) };
4037
+ }, {});
4038
+ }
4039
+ function FromMappedKey2(K, U, L, R, options) {
4040
+ return FromPropertyKeys(K.keys, U, L, R, options);
4041
+ }
4042
+ function ExtendsFromMappedKey(T, U, L, R, options) {
4043
+ const P = FromMappedKey2(T, U, L, R, options);
4044
+ return MappedResult(P);
4045
+ }
4046
+
4047
+ // ../../node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs
4048
+ function ExcludeFromTemplateLiteral(L, R) {
4049
+ return Exclude(TemplateLiteralToUnion(L), R);
4050
+ }
4051
+
4052
+ // ../../node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.mjs
4053
+ function ExcludeRest(L, R) {
4054
+ const excluded = L.filter((inner) => ExtendsCheck(inner, R) === ExtendsResult.False);
4055
+ return excluded.length === 1 ? excluded[0] : Union(excluded);
4056
+ }
4057
+ function Exclude(L, R, options = {}) {
4058
+ if (IsTemplateLiteral(L))
4059
+ return CloneType(ExcludeFromTemplateLiteral(L, R), options);
4060
+ if (IsMappedResult(L))
4061
+ return CloneType(ExcludeFromMappedResult(L, R), options);
4062
+ return CloneType(IsUnion(L) ? ExcludeRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? Never() : L, options);
4063
+ }
4064
+
4065
+ // ../../node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs
4066
+ function FromProperties10(P, U) {
4067
+ const Acc = {};
4068
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4069
+ Acc[K2] = Exclude(P[K2], U);
4070
+ return Acc;
4071
+ }
4072
+ function FromMappedResult7(R, T) {
4073
+ return FromProperties10(R.properties, T);
4074
+ }
4075
+ function ExcludeFromMappedResult(R, T) {
4076
+ const P = FromMappedResult7(R, T);
4077
+ return MappedResult(P);
4078
+ }
4079
+
4080
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.mjs
4081
+ function ExtractFromTemplateLiteral(L, R) {
4082
+ return Extract(TemplateLiteralToUnion(L), R);
4083
+ }
4084
+
4085
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extract/extract.mjs
4086
+ function ExtractRest(L, R) {
4087
+ const extracted = L.filter((inner) => ExtendsCheck(inner, R) !== ExtendsResult.False);
4088
+ return extracted.length === 1 ? extracted[0] : Union(extracted);
4089
+ }
4090
+ function Extract(L, R, options = {}) {
4091
+ if (IsTemplateLiteral(L))
4092
+ return CloneType(ExtractFromTemplateLiteral(L, R), options);
4093
+ if (IsMappedResult(L))
4094
+ return CloneType(ExtractFromMappedResult(L, R), options);
4095
+ return CloneType(IsUnion(L) ? ExtractRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? L : Never(), options);
4096
+ }
4097
+
4098
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs
4099
+ function FromProperties11(P, T) {
4100
+ const Acc = {};
4101
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4102
+ Acc[K2] = Extract(P[K2], T);
4103
+ return Acc;
4104
+ }
4105
+ function FromMappedResult8(R, T) {
4106
+ return FromProperties11(R.properties, T);
4107
+ }
4108
+ function ExtractFromMappedResult(R, T) {
4109
+ const P = FromMappedResult8(R, T);
4110
+ return MappedResult(P);
4111
+ }
4112
+
4113
+ // ../../node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs
4114
+ function InstanceType(schema, options = {}) {
4115
+ return CloneType(schema.returns, options);
4116
+ }
4117
+
4118
+ // ../../node_modules/@sinclair/typebox/build/esm/type/integer/integer.mjs
4119
+ function Integer(options = {}) {
4120
+ return {
4121
+ ...options,
4122
+ [Kind]: "Integer",
4123
+ type: "integer"
4124
+ };
4125
+ }
4126
+
4127
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs
4128
+ function MappedIntrinsicPropertyKey(K, M, options) {
4129
+ return {
4130
+ [K]: Intrinsic(Literal(K), M, options)
4131
+ };
4132
+ }
4133
+ function MappedIntrinsicPropertyKeys(K, M, options) {
4134
+ return K.reduce((Acc, L) => {
4135
+ return { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) };
4136
+ }, {});
4137
+ }
4138
+ function MappedIntrinsicProperties(T, M, options) {
4139
+ return MappedIntrinsicPropertyKeys(T["keys"], M, options);
4140
+ }
4141
+ function IntrinsicFromMappedKey(T, M, options) {
4142
+ const P = MappedIntrinsicProperties(T, M, options);
4143
+ return MappedResult(P);
4144
+ }
4145
+
4146
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.mjs
4147
+ function ApplyUncapitalize(value) {
4148
+ const [first, rest] = [value.slice(0, 1), value.slice(1)];
4149
+ return [first.toLowerCase(), rest].join("");
4150
+ }
4151
+ function ApplyCapitalize(value) {
4152
+ const [first, rest] = [value.slice(0, 1), value.slice(1)];
4153
+ return [first.toUpperCase(), rest].join("");
4154
+ }
4155
+ function ApplyUppercase(value) {
4156
+ return value.toUpperCase();
4157
+ }
4158
+ function ApplyLowercase(value) {
4159
+ return value.toLowerCase();
4160
+ }
4161
+ function FromTemplateLiteral3(schema, mode, options) {
4162
+ const expression = TemplateLiteralParseExact(schema.pattern);
4163
+ const finite = IsTemplateLiteralExpressionFinite(expression);
4164
+ if (!finite)
4165
+ return { ...schema, pattern: FromLiteralValue(schema.pattern, mode) };
4166
+ const strings = [...TemplateLiteralExpressionGenerate(expression)];
4167
+ const literals = strings.map((value) => Literal(value));
4168
+ const mapped = FromRest6(literals, mode);
4169
+ const union = Union(mapped);
4170
+ return TemplateLiteral([union], options);
4171
+ }
4172
+ function FromLiteralValue(value, mode) {
4173
+ return typeof value === "string" ? mode === "Uncapitalize" ? ApplyUncapitalize(value) : mode === "Capitalize" ? ApplyCapitalize(value) : mode === "Uppercase" ? ApplyUppercase(value) : mode === "Lowercase" ? ApplyLowercase(value) : value : value.toString();
4174
+ }
4175
+ function FromRest6(T, M) {
4176
+ return T.map((L) => Intrinsic(L, M));
4177
+ }
4178
+ function Intrinsic(schema, mode, options = {}) {
4179
+ return (
4180
+ // Intrinsic-Mapped-Inference
4181
+ IsMappedKey(schema) ? IntrinsicFromMappedKey(schema, mode, options) : (
4182
+ // Standard-Inference
4183
+ IsTemplateLiteral(schema) ? FromTemplateLiteral3(schema, mode, schema) : IsUnion(schema) ? Union(FromRest6(schema.anyOf, mode), options) : IsLiteral(schema) ? Literal(FromLiteralValue(schema.const, mode), options) : schema
4184
+ )
4185
+ );
4186
+ }
4187
+
4188
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs
4189
+ function Capitalize(T, options = {}) {
4190
+ return Intrinsic(T, "Capitalize", options);
4191
+ }
4192
+
4193
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.mjs
4194
+ function Lowercase(T, options = {}) {
4195
+ return Intrinsic(T, "Lowercase", options);
4196
+ }
4197
+
4198
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.mjs
4199
+ function Uncapitalize(T, options = {}) {
4200
+ return Intrinsic(T, "Uncapitalize", options);
4201
+ }
4202
+
4203
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.mjs
4204
+ function Uppercase(T, options = {}) {
4205
+ return Intrinsic(T, "Uppercase", options);
4206
+ }
4207
+
4208
+ // ../../node_modules/@sinclair/typebox/build/esm/type/not/not.mjs
4209
+ function Not(schema, options) {
4210
+ return {
4211
+ ...options,
4212
+ [Kind]: "Not",
4213
+ not: CloneType(schema)
4214
+ };
4215
+ }
4216
+
4217
+ // ../../node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.mjs
4218
+ function FromProperties12(P, K, options) {
4219
+ const Acc = {};
4220
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4221
+ Acc[K2] = Omit(P[K2], K, options);
4222
+ return Acc;
4223
+ }
4224
+ function FromMappedResult9(R, K, options) {
4225
+ return FromProperties12(R.properties, K, options);
4226
+ }
4227
+ function OmitFromMappedResult(R, K, options) {
4228
+ const P = FromMappedResult9(R, K, options);
4229
+ return MappedResult(P);
4230
+ }
4231
+
4232
+ // ../../node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs
4233
+ function FromIntersect6(T, K) {
4234
+ return T.map((T2) => OmitResolve(T2, K));
4235
+ }
4236
+ function FromUnion8(T, K) {
4237
+ return T.map((T2) => OmitResolve(T2, K));
4238
+ }
4239
+ function FromProperty2(T, K) {
4240
+ const { [K]: _, ...R } = T;
4241
+ return R;
4242
+ }
4243
+ function FromProperties13(T, K) {
4244
+ return K.reduce((T2, K2) => FromProperty2(T2, K2), T);
4245
+ }
4246
+ function OmitResolve(T, K) {
4247
+ return IsIntersect(T) ? Intersect(FromIntersect6(T.allOf, K)) : IsUnion(T) ? Union(FromUnion8(T.anyOf, K)) : IsObject2(T) ? Object2(FromProperties13(T.properties, K)) : Object2({});
4248
+ }
4249
+ function Omit(T, K, options = {}) {
4250
+ if (IsMappedKey(K))
4251
+ return OmitFromMappedKey(T, K, options);
4252
+ if (IsMappedResult(T))
4253
+ return OmitFromMappedResult(T, K, options);
4254
+ const I = IsSchema(K) ? IndexPropertyKeys(K) : K;
4255
+ const D = Discard(T, [TransformKind, "$id", "required"]);
4256
+ const R = CloneType(OmitResolve(T, I), options);
4257
+ return { ...D, ...R };
4258
+ }
4259
+
4260
+ // ../../node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs
4261
+ function FromPropertyKey2(T, K, options) {
4262
+ return {
4263
+ [K]: Omit(T, [K], options)
4264
+ };
4265
+ }
4266
+ function FromPropertyKeys2(T, K, options) {
4267
+ return K.reduce((Acc, LK) => {
4268
+ return { ...Acc, ...FromPropertyKey2(T, LK, options) };
4269
+ }, {});
4270
+ }
4271
+ function FromMappedKey3(T, K, options) {
4272
+ return FromPropertyKeys2(T, K.keys, options);
4273
+ }
4274
+ function OmitFromMappedKey(T, K, options) {
4275
+ const P = FromMappedKey3(T, K, options);
4276
+ return MappedResult(P);
4277
+ }
4278
+
4279
+ // ../../node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs
4280
+ function Parameters(schema, options = {}) {
4281
+ return Tuple(CloneRest(schema.parameters), { ...options });
4282
+ }
4283
+
4284
+ // ../../node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs
4285
+ function FromRest7(T) {
4286
+ return T.map((L) => PartialResolve(L));
4287
+ }
4288
+ function FromProperties14(T) {
4289
+ const Acc = {};
4290
+ for (const K of globalThis.Object.getOwnPropertyNames(T))
4291
+ Acc[K] = Optional(T[K]);
4292
+ return Acc;
4293
+ }
4294
+ function PartialResolve(T) {
4295
+ return IsIntersect(T) ? Intersect(FromRest7(T.allOf)) : IsUnion(T) ? Union(FromRest7(T.anyOf)) : IsObject2(T) ? Object2(FromProperties14(T.properties)) : Object2({});
4296
+ }
4297
+ function Partial(T, options = {}) {
4298
+ if (IsMappedResult(T))
4299
+ return PartialFromMappedResult(T, options);
4300
+ const D = Discard(T, [TransformKind, "$id", "required"]);
4301
+ const R = CloneType(PartialResolve(T), options);
4302
+ return { ...D, ...R };
4303
+ }
4304
+
4305
+ // ../../node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.mjs
4306
+ function FromProperties15(K, options) {
4307
+ const Acc = {};
4308
+ for (const K2 of globalThis.Object.getOwnPropertyNames(K))
4309
+ Acc[K2] = Partial(K[K2], options);
4310
+ return Acc;
4311
+ }
4312
+ function FromMappedResult10(R, options) {
4313
+ return FromProperties15(R.properties, options);
4314
+ }
4315
+ function PartialFromMappedResult(R, options) {
4316
+ const P = FromMappedResult10(R, options);
4317
+ return MappedResult(P);
4318
+ }
4319
+
4320
+ // ../../node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.mjs
4321
+ function FromProperties16(P, K, options) {
4322
+ const Acc = {};
4323
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4324
+ Acc[K2] = Pick(P[K2], K, options);
4325
+ return Acc;
4326
+ }
4327
+ function FromMappedResult11(R, K, options) {
4328
+ return FromProperties16(R.properties, K, options);
4329
+ }
4330
+ function PickFromMappedResult(R, K, options) {
4331
+ const P = FromMappedResult11(R, K, options);
4332
+ return MappedResult(P);
4333
+ }
4334
+
4335
+ // ../../node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs
4336
+ function FromIntersect7(T, K) {
4337
+ return T.map((T2) => PickResolve(T2, K));
4338
+ }
4339
+ function FromUnion9(T, K) {
4340
+ return T.map((T2) => PickResolve(T2, K));
4341
+ }
4342
+ function FromProperties17(T, K) {
4343
+ const Acc = {};
4344
+ for (const K2 of K)
4345
+ if (K2 in T)
4346
+ Acc[K2] = T[K2];
4347
+ return Acc;
4348
+ }
4349
+ function PickResolve(T, K) {
4350
+ return IsIntersect(T) ? Intersect(FromIntersect7(T.allOf, K)) : IsUnion(T) ? Union(FromUnion9(T.anyOf, K)) : IsObject2(T) ? Object2(FromProperties17(T.properties, K)) : Object2({});
4351
+ }
4352
+ function Pick(T, K, options = {}) {
4353
+ if (IsMappedKey(K))
4354
+ return PickFromMappedKey(T, K, options);
4355
+ if (IsMappedResult(T))
4356
+ return PickFromMappedResult(T, K, options);
4357
+ const I = IsSchema(K) ? IndexPropertyKeys(K) : K;
4358
+ const D = Discard(T, [TransformKind, "$id", "required"]);
4359
+ const R = CloneType(PickResolve(T, I), options);
4360
+ return { ...D, ...R };
4361
+ }
4362
+
4363
+ // ../../node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs
4364
+ function FromPropertyKey3(T, K, options) {
4365
+ return {
4366
+ [K]: Pick(T, [K], options)
4367
+ };
4368
+ }
4369
+ function FromPropertyKeys3(T, K, options) {
4370
+ return K.reduce((Acc, LK) => {
4371
+ return { ...Acc, ...FromPropertyKey3(T, LK, options) };
4372
+ }, {});
4373
+ }
4374
+ function FromMappedKey4(T, K, options) {
4375
+ return FromPropertyKeys3(T, K.keys, options);
4376
+ }
4377
+ function PickFromMappedKey(T, K, options) {
4378
+ const P = FromMappedKey4(T, K, options);
4379
+ return MappedResult(P);
4380
+ }
4381
+
4382
+ // ../../node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs
4383
+ function ReadonlyOptional(schema) {
4384
+ return Readonly(Optional(schema));
4385
+ }
4386
+
4387
+ // ../../node_modules/@sinclair/typebox/build/esm/type/record/record.mjs
4388
+ function RecordCreateFromPattern(pattern, T, options) {
4389
+ return {
4390
+ ...options,
4391
+ [Kind]: "Record",
4392
+ type: "object",
4393
+ patternProperties: { [pattern]: CloneType(T) }
4394
+ };
4395
+ }
4396
+ function RecordCreateFromKeys(K, T, options) {
4397
+ const Acc = {};
4398
+ for (const K2 of K)
4399
+ Acc[K2] = CloneType(T);
4400
+ return Object2(Acc, { ...options, [Hint]: "Record" });
4401
+ }
4402
+ function FromTemplateLiteralKey(K, T, options) {
4403
+ return IsTemplateLiteralFinite(K) ? RecordCreateFromKeys(IndexPropertyKeys(K), T, options) : RecordCreateFromPattern(K.pattern, T, options);
4404
+ }
4405
+ function FromUnionKey(K, T, options) {
4406
+ return RecordCreateFromKeys(IndexPropertyKeys(Union(K)), T, options);
4407
+ }
4408
+ function FromLiteralKey(K, T, options) {
4409
+ return RecordCreateFromKeys([K.toString()], T, options);
4410
+ }
4411
+ function FromRegExpKey(K, T, options) {
4412
+ return RecordCreateFromPattern(K.source, T, options);
4413
+ }
4414
+ function FromStringKey(K, T, options) {
4415
+ const pattern = IsUndefined(K.pattern) ? PatternStringExact : K.pattern;
4416
+ return RecordCreateFromPattern(pattern, T, options);
4417
+ }
4418
+ function FromIntegerKey(_, T, options) {
4419
+ return RecordCreateFromPattern(PatternNumberExact, T, options);
4420
+ }
4421
+ function FromNumberKey(_, T, options) {
4422
+ return RecordCreateFromPattern(PatternNumberExact, T, options);
4423
+ }
4424
+ function Record(K, T, options = {}) {
4425
+ return IsUnion(K) ? FromUnionKey(K.anyOf, T, options) : IsTemplateLiteral(K) ? FromTemplateLiteralKey(K, T, options) : IsLiteral(K) ? FromLiteralKey(K.const, T, options) : IsInteger(K) ? FromIntegerKey(K, T, options) : IsNumber2(K) ? FromNumberKey(K, T, options) : IsRegExp2(K) ? FromRegExpKey(K, T, options) : IsString2(K) ? FromStringKey(K, T, options) : Never(options);
4426
+ }
4427
+
4428
+ // ../../node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs
4429
+ var Ordinal = 0;
4430
+ function Recursive(callback, options = {}) {
4431
+ if (IsUndefined(options.$id))
4432
+ options.$id = `T${Ordinal++}`;
4433
+ const thisType = callback({ [Kind]: "This", $ref: `${options.$id}` });
4434
+ thisType.$id = options.$id;
4435
+ return CloneType({ ...options, [Hint]: "Recursive", ...thisType });
4436
+ }
4437
+
4438
+ // ../../node_modules/@sinclair/typebox/build/esm/type/ref/ref.mjs
4439
+ function Ref(unresolved, options = {}) {
4440
+ if (IsString(unresolved))
4441
+ return { ...options, [Kind]: "Ref", $ref: unresolved };
4442
+ if (IsUndefined(unresolved.$id))
4443
+ throw new Error("Reference target type must specify an $id");
4444
+ return {
4445
+ ...options,
4446
+ [Kind]: "Ref",
4447
+ $ref: unresolved.$id
4448
+ };
4449
+ }
4450
+
4451
+ // ../../node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.mjs
4452
+ function RegExp2(unresolved, options = {}) {
4453
+ const expr = IsString(unresolved) ? new globalThis.RegExp(unresolved) : unresolved;
4454
+ return { ...options, [Kind]: "RegExp", type: "RegExp", source: expr.source, flags: expr.flags };
4455
+ }
4456
+
4457
+ // ../../node_modules/@sinclair/typebox/build/esm/type/registry/format.mjs
4458
+ var format_exports = {};
4459
+ __export(format_exports, {
4460
+ Clear: () => Clear,
4461
+ Delete: () => Delete,
4462
+ Entries: () => Entries,
4463
+ Get: () => Get,
4464
+ Has: () => Has,
4465
+ Set: () => Set2
4466
+ });
4467
+ var map = /* @__PURE__ */ new Map();
4468
+ function Entries() {
4469
+ return new Map(map);
4470
+ }
4471
+ function Clear() {
4472
+ return map.clear();
4473
+ }
4474
+ function Delete(format) {
4475
+ return map.delete(format);
4476
+ }
4477
+ function Has(format) {
4478
+ return map.has(format);
4479
+ }
4480
+ function Set2(format, func) {
4481
+ map.set(format, func);
4482
+ }
4483
+ function Get(format) {
4484
+ return map.get(format);
4485
+ }
4486
+
4487
+ // ../../node_modules/@sinclair/typebox/build/esm/type/registry/type.mjs
4488
+ var type_exports2 = {};
4489
+ __export(type_exports2, {
4490
+ Clear: () => Clear2,
4491
+ Delete: () => Delete2,
4492
+ Entries: () => Entries2,
4493
+ Get: () => Get2,
4494
+ Has: () => Has2,
4495
+ Set: () => Set3
4496
+ });
4497
+ var map2 = /* @__PURE__ */ new Map();
4498
+ function Entries2() {
4499
+ return new Map(map2);
4500
+ }
4501
+ function Clear2() {
4502
+ return map2.clear();
4503
+ }
4504
+ function Delete2(kind) {
4505
+ return map2.delete(kind);
4506
+ }
4507
+ function Has2(kind) {
4508
+ return map2.has(kind);
4509
+ }
4510
+ function Set3(kind, func) {
4511
+ map2.set(kind, func);
4512
+ }
4513
+ function Get2(kind) {
4514
+ return map2.get(kind);
4515
+ }
4516
+
4517
+ // ../../node_modules/@sinclair/typebox/build/esm/type/required/required.mjs
4518
+ function FromRest8(T) {
4519
+ return T.map((L) => RequiredResolve(L));
4520
+ }
4521
+ function FromProperties18(T) {
4522
+ const Acc = {};
4523
+ for (const K of globalThis.Object.getOwnPropertyNames(T))
4524
+ Acc[K] = Discard(T[K], [OptionalKind]);
4525
+ return Acc;
4526
+ }
4527
+ function RequiredResolve(T) {
4528
+ return IsIntersect(T) ? Intersect(FromRest8(T.allOf)) : IsUnion(T) ? Union(FromRest8(T.anyOf)) : IsObject2(T) ? Object2(FromProperties18(T.properties)) : Object2({});
4529
+ }
4530
+ function Required(T, options = {}) {
4531
+ if (IsMappedResult(T)) {
4532
+ return RequiredFromMappedResult(T, options);
4533
+ } else {
4534
+ const D = Discard(T, [TransformKind, "$id", "required"]);
4535
+ const R = CloneType(RequiredResolve(T), options);
4536
+ return { ...D, ...R };
4537
+ }
4538
+ }
4539
+
4540
+ // ../../node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.mjs
4541
+ function FromProperties19(P, options) {
4542
+ const Acc = {};
4543
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4544
+ Acc[K2] = Required(P[K2], options);
4545
+ return Acc;
4546
+ }
4547
+ function FromMappedResult12(R, options) {
4548
+ return FromProperties19(R.properties, options);
4549
+ }
4550
+ function RequiredFromMappedResult(R, options) {
4551
+ const P = FromMappedResult12(R, options);
4552
+ return MappedResult(P);
4553
+ }
4554
+
4555
+ // ../../node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs
4556
+ function RestResolve(T) {
4557
+ return IsIntersect(T) ? CloneRest(T.allOf) : IsUnion(T) ? CloneRest(T.anyOf) : IsTuple(T) ? CloneRest(T.items ?? []) : [];
4558
+ }
4559
+ function Rest(T) {
4560
+ return CloneRest(RestResolve(T));
4561
+ }
4562
+
4563
+ // ../../node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs
4564
+ function ReturnType(schema, options = {}) {
4565
+ return CloneType(schema.returns, options);
4566
+ }
4567
+
4568
+ // ../../node_modules/@sinclair/typebox/build/esm/type/strict/strict.mjs
4569
+ function Strict(schema) {
4570
+ return JSON.parse(JSON.stringify(schema));
4571
+ }
4572
+
4573
+ // ../../node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs
4574
+ var TransformDecodeBuilder = class {
4575
+ schema;
4576
+ constructor(schema) {
4577
+ this.schema = schema;
4578
+ }
4579
+ Decode(decode) {
4580
+ return new TransformEncodeBuilder(this.schema, decode);
4581
+ }
4582
+ };
4583
+ var TransformEncodeBuilder = class {
4584
+ schema;
4585
+ decode;
4586
+ constructor(schema, decode) {
4587
+ this.schema = schema;
4588
+ this.decode = decode;
4589
+ }
4590
+ EncodeTransform(encode, schema) {
4591
+ const Encode = (value) => schema[TransformKind].Encode(encode(value));
4592
+ const Decode = (value) => this.decode(schema[TransformKind].Decode(value));
4593
+ const Codec = { Encode, Decode };
4594
+ return { ...schema, [TransformKind]: Codec };
4595
+ }
4596
+ EncodeSchema(encode, schema) {
4597
+ const Codec = { Decode: this.decode, Encode: encode };
4598
+ return { ...schema, [TransformKind]: Codec };
4599
+ }
4600
+ Encode(encode) {
4601
+ const schema = CloneType(this.schema);
4602
+ return IsTransform(schema) ? this.EncodeTransform(encode, schema) : this.EncodeSchema(encode, schema);
4603
+ }
4604
+ };
4605
+ function Transform(schema) {
4606
+ return new TransformDecodeBuilder(schema);
4607
+ }
4608
+
4609
+ // ../../node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.mjs
4610
+ function Unsafe(options = {}) {
4611
+ return {
4612
+ ...options,
4613
+ [Kind]: options[Kind] ?? "Unsafe"
4614
+ };
4615
+ }
4616
+
4617
+ // ../../node_modules/@sinclair/typebox/build/esm/type/type/type.mjs
4618
+ var type_exports3 = {};
4619
+ __export(type_exports3, {
4620
+ Any: () => Any,
4621
+ Array: () => Array2,
4622
+ AsyncIterator: () => AsyncIterator,
4623
+ Awaited: () => Awaited,
4624
+ BigInt: () => BigInt2,
4625
+ Boolean: () => Boolean,
4626
+ Capitalize: () => Capitalize,
4627
+ Composite: () => Composite,
4628
+ Const: () => Const,
4629
+ Constructor: () => Constructor,
4630
+ ConstructorParameters: () => ConstructorParameters,
4631
+ Date: () => Date2,
4632
+ Deref: () => Deref,
4633
+ Enum: () => Enum,
4634
+ Exclude: () => Exclude,
4635
+ Extends: () => Extends,
4636
+ Extract: () => Extract,
4637
+ Function: () => Function2,
4638
+ Index: () => Index,
4639
+ InstanceType: () => InstanceType,
4640
+ Integer: () => Integer,
4641
+ Intersect: () => Intersect,
4642
+ Iterator: () => Iterator,
4643
+ KeyOf: () => KeyOf,
4644
+ Literal: () => Literal,
4645
+ Lowercase: () => Lowercase,
4646
+ Mapped: () => Mapped,
4647
+ Never: () => Never,
4648
+ Not: () => Not,
4649
+ Null: () => Null,
4650
+ Number: () => Number2,
4651
+ Object: () => Object2,
4652
+ Omit: () => Omit,
4653
+ Optional: () => Optional,
4654
+ Parameters: () => Parameters,
4655
+ Partial: () => Partial,
4656
+ Pick: () => Pick,
4657
+ Promise: () => Promise2,
4658
+ Readonly: () => Readonly,
4659
+ ReadonlyOptional: () => ReadonlyOptional,
4660
+ Record: () => Record,
4661
+ Recursive: () => Recursive,
4662
+ Ref: () => Ref,
4663
+ RegExp: () => RegExp2,
4664
+ Required: () => Required,
4665
+ Rest: () => Rest,
4666
+ ReturnType: () => ReturnType,
4667
+ Strict: () => Strict,
4668
+ String: () => String,
4669
+ Symbol: () => Symbol2,
4670
+ TemplateLiteral: () => TemplateLiteral,
4671
+ Transform: () => Transform,
4672
+ Tuple: () => Tuple,
4673
+ Uint8Array: () => Uint8Array2,
4674
+ Uncapitalize: () => Uncapitalize,
4675
+ Undefined: () => Undefined,
4676
+ Union: () => Union,
4677
+ Unknown: () => Unknown,
4678
+ Unsafe: () => Unsafe,
4679
+ Uppercase: () => Uppercase,
4680
+ Void: () => Void
4681
+ });
4682
+
4683
+ // ../../node_modules/@sinclair/typebox/build/esm/type/void/void.mjs
4684
+ function Void(options = {}) {
4685
+ return {
4686
+ ...options,
4687
+ [Kind]: "Void",
4688
+ type: "void"
4689
+ };
4690
+ }
4691
+
4692
+ // ../../node_modules/@sinclair/typebox/build/esm/type/type/index.mjs
4693
+ var Type = type_exports3;
4694
+
4695
+ // ../noya-schemas/src/jsonSchema.ts
4696
+ var jsonSchema = Type.Recursive(
4697
+ (This) => Type.Union(
4698
+ [
4699
+ Type.Object({
4700
+ type: Type.Literal("string"),
4701
+ default: Type.Optional(Type.String()),
4702
+ _kind: Type.Literal("String")
4703
+ }),
4704
+ Type.Object({
4705
+ type: Type.Literal("number"),
4706
+ default: Type.Optional(Type.Number()),
4707
+ minimum: Type.Optional(Type.Number()),
4708
+ maximum: Type.Optional(Type.Number()),
4709
+ _kind: Type.Literal("Number")
4710
+ }),
4711
+ Type.Object({
4712
+ type: Type.Literal("boolean"),
4713
+ default: Type.Optional(Type.Boolean()),
4714
+ _kind: Type.Literal("Boolean")
4715
+ }),
4716
+ Type.Object({
4717
+ type: Type.Literal("null"),
4718
+ _kind: Type.Literal("Null")
4719
+ }),
4720
+ Type.Object({
4721
+ type: Type.Literal("array"),
4722
+ items: This,
4723
+ // default: Type.Optional(Type.Array(Type.Any())),
4724
+ // minItems: Type.Optional(Type.Number()),
4725
+ // maxItems: Type.Optional(Type.Number()),
4726
+ _kind: Type.Literal("Array")
4727
+ }),
4728
+ Type.Object({
4729
+ type: Type.Literal("object"),
4730
+ properties: Type.Record(Type.String(), This),
4731
+ required: Type.Optional(Type.Array(Type.String())),
4732
+ // default: Type.Optional(Type.Record(Type.String(), Type.Any())),
4733
+ _kind: Type.Literal("Object")
4734
+ })
4735
+ ],
4736
+ {
4737
+ discriminator: "type"
4738
+ }
4739
+ ),
4740
+ {
4741
+ $id: "jsonSchema"
4742
+ }
4743
+ );
4744
+
4745
+ // ../noya-schemas/src/input.ts
4746
+ function Nullable(type) {
4747
+ return Type.Union([type, Type.Null()]);
4748
+ }
4749
+ var inputSchemaBase = {
4750
+ id: Type.String({ format: "uuid", default: "" }),
4751
+ name: Type.String(),
4752
+ description: Nullable(Type.String()),
4753
+ required: Type.Boolean({ default: false })
4754
+ };
4755
+ var fileInputSchema = Type.Object({
4756
+ ...inputSchemaBase,
4757
+ kind: Type.Literal("file"),
4758
+ toolId: Nullable(Type.String())
4759
+ });
4760
+ var dataInputSchema = Type.Object({
4761
+ ...inputSchemaBase,
4762
+ kind: Type.Literal("data"),
4763
+ schema: Nullable(jsonSchema)
4764
+ });
4765
+ var inputSchema = Type.Union([fileInputSchema, dataInputSchema], {
4766
+ discriminator: "kind"
4767
+ });
4768
+ var outputTransformSchemaBase = {
4769
+ id: Type.String({ format: "uuid", default: "" }),
4770
+ order: Type.Number()
4771
+ };
4772
+ var scriptOutputTransformSchema = Type.Object({
4773
+ ...outputTransformSchemaBase,
4774
+ kind: Type.Literal("script"),
4775
+ location: Type.Union([Type.Literal("state"), Type.Literal("url")]),
4776
+ value: Type.String()
4777
+ });
4778
+ var jsonPointerOutputTransformSchema = Type.Object({
4779
+ ...outputTransformSchemaBase,
4780
+ kind: Type.Literal("jsonPointer"),
4781
+ value: Type.String()
4782
+ });
4783
+ var outputTransformSchema = Type.Union(
4784
+ [scriptOutputTransformSchema, jsonPointerOutputTransformSchema],
4785
+ { discriminator: "kind" }
4786
+ );
4787
+
4788
+ // ../../node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs
4789
+ function IsObject4(value) {
4790
+ return value !== null && typeof value === "object";
4791
+ }
4792
+ function IsArray4(value) {
4793
+ return Array.isArray(value) && !ArrayBuffer.isView(value);
4794
+ }
4795
+ function IsUndefined4(value) {
4796
+ return value === void 0;
4797
+ }
4798
+ function IsNumber4(value) {
4799
+ return typeof value === "number";
4800
+ }
4801
+
4802
+ // ../../node_modules/@sinclair/typebox/build/esm/system/policy.mjs
4803
+ var TypeSystemPolicy;
4804
+ (function(TypeSystemPolicy2) {
4805
+ TypeSystemPolicy2.ExactOptionalPropertyTypes = false;
4806
+ TypeSystemPolicy2.AllowArrayObject = false;
4807
+ TypeSystemPolicy2.AllowNaN = false;
4808
+ TypeSystemPolicy2.AllowNullVoid = false;
4809
+ function IsExactOptionalProperty(value, key) {
4810
+ return TypeSystemPolicy2.ExactOptionalPropertyTypes ? key in value : value[key] !== void 0;
4811
+ }
4812
+ TypeSystemPolicy2.IsExactOptionalProperty = IsExactOptionalProperty;
4813
+ function IsObjectLike(value) {
4814
+ const isObject = IsObject4(value);
4815
+ return TypeSystemPolicy2.AllowArrayObject ? isObject : isObject && !IsArray4(value);
4816
+ }
4817
+ TypeSystemPolicy2.IsObjectLike = IsObjectLike;
4818
+ function IsRecordLike(value) {
4819
+ return IsObjectLike(value) && !(value instanceof Date) && !(value instanceof Uint8Array);
4820
+ }
4821
+ TypeSystemPolicy2.IsRecordLike = IsRecordLike;
4822
+ function IsNumberLike(value) {
4823
+ return TypeSystemPolicy2.AllowNaN ? IsNumber4(value) : Number.isFinite(value);
4824
+ }
4825
+ TypeSystemPolicy2.IsNumberLike = IsNumberLike;
4826
+ function IsVoidLike(value) {
4827
+ const isUndefined = IsUndefined4(value);
4828
+ return TypeSystemPolicy2.AllowNullVoid ? isUndefined || value === null : isUndefined;
4829
+ }
4830
+ TypeSystemPolicy2.IsVoidLike = IsVoidLike;
4831
+ })(TypeSystemPolicy || (TypeSystemPolicy = {}));
4832
+
4833
+ // ../../node_modules/@sinclair/typebox/build/esm/system/system.mjs
4834
+ var TypeSystemDuplicateTypeKind = class extends TypeBoxError {
4835
+ constructor(kind) {
4836
+ super(`Duplicate type kind '${kind}' detected`);
4837
+ }
4838
+ };
4839
+ var TypeSystemDuplicateFormat = class extends TypeBoxError {
4840
+ constructor(kind) {
4841
+ super(`Duplicate string format '${kind}' detected`);
4842
+ }
4843
+ };
4844
+ var TypeSystem;
4845
+ (function(TypeSystem2) {
4846
+ function Type2(kind, check) {
4847
+ if (type_exports2.Has(kind))
4848
+ throw new TypeSystemDuplicateTypeKind(kind);
4849
+ type_exports2.Set(kind, check);
4850
+ return (options = {}) => Unsafe({ ...options, [Kind]: kind });
4851
+ }
4852
+ TypeSystem2.Type = Type2;
4853
+ function Format(format, check) {
4854
+ if (format_exports.Has(format))
4855
+ throw new TypeSystemDuplicateFormat(format);
4856
+ format_exports.Set(format, check);
4857
+ return format;
4858
+ }
4859
+ TypeSystem2.Format = Format;
4860
+ })(TypeSystem || (TypeSystem = {}));
4861
+
4862
+ // ../../node_modules/@sinclair/typebox/build/esm/value/hash/hash.mjs
4863
+ var ByteMarker;
4864
+ (function(ByteMarker2) {
4865
+ ByteMarker2[ByteMarker2["Undefined"] = 0] = "Undefined";
4866
+ ByteMarker2[ByteMarker2["Null"] = 1] = "Null";
4867
+ ByteMarker2[ByteMarker2["Boolean"] = 2] = "Boolean";
4868
+ ByteMarker2[ByteMarker2["Number"] = 3] = "Number";
4869
+ ByteMarker2[ByteMarker2["String"] = 4] = "String";
4870
+ ByteMarker2[ByteMarker2["Object"] = 5] = "Object";
4871
+ ByteMarker2[ByteMarker2["Array"] = 6] = "Array";
4872
+ ByteMarker2[ByteMarker2["Date"] = 7] = "Date";
4873
+ ByteMarker2[ByteMarker2["Uint8Array"] = 8] = "Uint8Array";
4874
+ ByteMarker2[ByteMarker2["Symbol"] = 9] = "Symbol";
4875
+ ByteMarker2[ByteMarker2["BigInt"] = 10] = "BigInt";
4876
+ })(ByteMarker || (ByteMarker = {}));
4877
+ var Accumulator = BigInt("14695981039346656037");
4878
+ var [Prime, Size] = [BigInt("1099511628211"), BigInt("2") ** BigInt("64")];
4879
+ var Bytes = Array.from({ length: 256 }).map((_, i) => BigInt(i));
4880
+ var F64 = new Float64Array(1);
4881
+ var F64In = new DataView(F64.buffer);
4882
+ var F64Out = new Uint8Array(F64.buffer);
4883
+
4884
+ // ../../node_modules/@sinclair/typebox/build/esm/errors/errors.mjs
4885
+ var ValueErrorType;
4886
+ (function(ValueErrorType2) {
4887
+ ValueErrorType2[ValueErrorType2["ArrayContains"] = 0] = "ArrayContains";
4888
+ ValueErrorType2[ValueErrorType2["ArrayMaxContains"] = 1] = "ArrayMaxContains";
4889
+ ValueErrorType2[ValueErrorType2["ArrayMaxItems"] = 2] = "ArrayMaxItems";
4890
+ ValueErrorType2[ValueErrorType2["ArrayMinContains"] = 3] = "ArrayMinContains";
4891
+ ValueErrorType2[ValueErrorType2["ArrayMinItems"] = 4] = "ArrayMinItems";
4892
+ ValueErrorType2[ValueErrorType2["ArrayUniqueItems"] = 5] = "ArrayUniqueItems";
4893
+ ValueErrorType2[ValueErrorType2["Array"] = 6] = "Array";
4894
+ ValueErrorType2[ValueErrorType2["AsyncIterator"] = 7] = "AsyncIterator";
4895
+ ValueErrorType2[ValueErrorType2["BigIntExclusiveMaximum"] = 8] = "BigIntExclusiveMaximum";
4896
+ ValueErrorType2[ValueErrorType2["BigIntExclusiveMinimum"] = 9] = "BigIntExclusiveMinimum";
4897
+ ValueErrorType2[ValueErrorType2["BigIntMaximum"] = 10] = "BigIntMaximum";
4898
+ ValueErrorType2[ValueErrorType2["BigIntMinimum"] = 11] = "BigIntMinimum";
4899
+ ValueErrorType2[ValueErrorType2["BigIntMultipleOf"] = 12] = "BigIntMultipleOf";
4900
+ ValueErrorType2[ValueErrorType2["BigInt"] = 13] = "BigInt";
4901
+ ValueErrorType2[ValueErrorType2["Boolean"] = 14] = "Boolean";
4902
+ ValueErrorType2[ValueErrorType2["DateExclusiveMaximumTimestamp"] = 15] = "DateExclusiveMaximumTimestamp";
4903
+ ValueErrorType2[ValueErrorType2["DateExclusiveMinimumTimestamp"] = 16] = "DateExclusiveMinimumTimestamp";
4904
+ ValueErrorType2[ValueErrorType2["DateMaximumTimestamp"] = 17] = "DateMaximumTimestamp";
4905
+ ValueErrorType2[ValueErrorType2["DateMinimumTimestamp"] = 18] = "DateMinimumTimestamp";
4906
+ ValueErrorType2[ValueErrorType2["DateMultipleOfTimestamp"] = 19] = "DateMultipleOfTimestamp";
4907
+ ValueErrorType2[ValueErrorType2["Date"] = 20] = "Date";
4908
+ ValueErrorType2[ValueErrorType2["Function"] = 21] = "Function";
4909
+ ValueErrorType2[ValueErrorType2["IntegerExclusiveMaximum"] = 22] = "IntegerExclusiveMaximum";
4910
+ ValueErrorType2[ValueErrorType2["IntegerExclusiveMinimum"] = 23] = "IntegerExclusiveMinimum";
4911
+ ValueErrorType2[ValueErrorType2["IntegerMaximum"] = 24] = "IntegerMaximum";
4912
+ ValueErrorType2[ValueErrorType2["IntegerMinimum"] = 25] = "IntegerMinimum";
4913
+ ValueErrorType2[ValueErrorType2["IntegerMultipleOf"] = 26] = "IntegerMultipleOf";
4914
+ ValueErrorType2[ValueErrorType2["Integer"] = 27] = "Integer";
4915
+ ValueErrorType2[ValueErrorType2["IntersectUnevaluatedProperties"] = 28] = "IntersectUnevaluatedProperties";
4916
+ ValueErrorType2[ValueErrorType2["Intersect"] = 29] = "Intersect";
4917
+ ValueErrorType2[ValueErrorType2["Iterator"] = 30] = "Iterator";
4918
+ ValueErrorType2[ValueErrorType2["Kind"] = 31] = "Kind";
4919
+ ValueErrorType2[ValueErrorType2["Literal"] = 32] = "Literal";
4920
+ ValueErrorType2[ValueErrorType2["Never"] = 33] = "Never";
4921
+ ValueErrorType2[ValueErrorType2["Not"] = 34] = "Not";
4922
+ ValueErrorType2[ValueErrorType2["Null"] = 35] = "Null";
4923
+ ValueErrorType2[ValueErrorType2["NumberExclusiveMaximum"] = 36] = "NumberExclusiveMaximum";
4924
+ ValueErrorType2[ValueErrorType2["NumberExclusiveMinimum"] = 37] = "NumberExclusiveMinimum";
4925
+ ValueErrorType2[ValueErrorType2["NumberMaximum"] = 38] = "NumberMaximum";
4926
+ ValueErrorType2[ValueErrorType2["NumberMinimum"] = 39] = "NumberMinimum";
4927
+ ValueErrorType2[ValueErrorType2["NumberMultipleOf"] = 40] = "NumberMultipleOf";
4928
+ ValueErrorType2[ValueErrorType2["Number"] = 41] = "Number";
4929
+ ValueErrorType2[ValueErrorType2["ObjectAdditionalProperties"] = 42] = "ObjectAdditionalProperties";
4930
+ ValueErrorType2[ValueErrorType2["ObjectMaxProperties"] = 43] = "ObjectMaxProperties";
4931
+ ValueErrorType2[ValueErrorType2["ObjectMinProperties"] = 44] = "ObjectMinProperties";
4932
+ ValueErrorType2[ValueErrorType2["ObjectRequiredProperty"] = 45] = "ObjectRequiredProperty";
4933
+ ValueErrorType2[ValueErrorType2["Object"] = 46] = "Object";
4934
+ ValueErrorType2[ValueErrorType2["Promise"] = 47] = "Promise";
4935
+ ValueErrorType2[ValueErrorType2["RegExp"] = 48] = "RegExp";
4936
+ ValueErrorType2[ValueErrorType2["StringFormatUnknown"] = 49] = "StringFormatUnknown";
4937
+ ValueErrorType2[ValueErrorType2["StringFormat"] = 50] = "StringFormat";
4938
+ ValueErrorType2[ValueErrorType2["StringMaxLength"] = 51] = "StringMaxLength";
4939
+ ValueErrorType2[ValueErrorType2["StringMinLength"] = 52] = "StringMinLength";
4940
+ ValueErrorType2[ValueErrorType2["StringPattern"] = 53] = "StringPattern";
4941
+ ValueErrorType2[ValueErrorType2["String"] = 54] = "String";
4942
+ ValueErrorType2[ValueErrorType2["Symbol"] = 55] = "Symbol";
4943
+ ValueErrorType2[ValueErrorType2["TupleLength"] = 56] = "TupleLength";
4944
+ ValueErrorType2[ValueErrorType2["Tuple"] = 57] = "Tuple";
4945
+ ValueErrorType2[ValueErrorType2["Uint8ArrayMaxByteLength"] = 58] = "Uint8ArrayMaxByteLength";
4946
+ ValueErrorType2[ValueErrorType2["Uint8ArrayMinByteLength"] = 59] = "Uint8ArrayMinByteLength";
4947
+ ValueErrorType2[ValueErrorType2["Uint8Array"] = 60] = "Uint8Array";
4948
+ ValueErrorType2[ValueErrorType2["Undefined"] = 61] = "Undefined";
4949
+ ValueErrorType2[ValueErrorType2["Union"] = 62] = "Union";
4950
+ ValueErrorType2[ValueErrorType2["Void"] = 63] = "Void";
4951
+ })(ValueErrorType || (ValueErrorType = {}));
4952
+
4953
+ // ../../node_modules/@sinclair/typebox/build/esm/value/delta/delta.mjs
4954
+ var Insert = Object2({
4955
+ type: Literal("insert"),
4956
+ path: String(),
4957
+ value: Unknown()
4958
+ });
4959
+ var Update = Object2({
4960
+ type: Literal("update"),
4961
+ path: String(),
4962
+ value: Unknown()
4963
+ });
4964
+ var Delete3 = Object2({
4965
+ type: Literal("delete"),
4966
+ path: String()
4967
+ });
4968
+ var Edit = Union([Insert, Update, Delete3]);
4969
+
4970
+ // ../noya-schemas/src/SchemaTree.ts
4971
+ var import_tree_visit = __toESM(require_lib());
4972
+ var SchemaTree = (0, import_tree_visit.defineTree)((schema) => {
4973
+ if (type_exports.IsUnion(schema)) {
4974
+ return schema.anyOf;
4975
+ } else if (type_exports.IsObject(schema)) {
4976
+ return Object.values(schema.properties);
4977
+ } else if (type_exports.IsArray(schema)) {
4978
+ return [schema.items];
4979
+ }
4980
+ return [];
4981
+ }).withOptions({
4982
+ getLabel(node) {
4983
+ return node[Kind] ?? "<UnknownKind>";
4984
+ }
4985
+ });
4986
+ function findAllDefs(schema) {
4987
+ if (!schema) return [];
4988
+ return SchemaTree.flatMap(schema, (node) => {
4989
+ return node.$id ? [node] : [];
4990
+ });
4991
+ }
4992
+
4993
+ // ../noya-schemas/src/index.ts
4994
+ function validateUUID(value) {
4995
+ return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
4996
+ value
4997
+ );
4998
+ }
4999
+ format_exports.Set("color", () => true);
5000
+ format_exports.Set("uuid", validateUUID);
5001
+
5002
+ // src/noyaApp.ts
5003
+ var import_state_manager2 = require("@noya-app/state-manager");
5004
+ var import_react7 = require("react");
5005
+ function createDefaultAppData(initialState) {
5006
+ return {
5007
+ theme: "light",
5008
+ viewType: "editable",
5009
+ initialState,
5010
+ inspector: false
5011
+ };
5012
+ }
5013
+ function enforceSchema(initialState, schema) {
5014
+ return schema ? (0, import_state_manager2.createOrCastValue)({
5015
+ schema,
5016
+ value: initialState,
5017
+ defs: findAllDefs(schema)
5018
+ }) : initialState;
5019
+ }
5020
+ function parseAppDataParameter(options) {
5021
+ const window2 = options?.window ?? globalThis;
5022
+ const location = window2.location;
5023
+ if (!location) return null;
5024
+ const urlHash = (location.hash || "").replace(/^#/, "");
5025
+ const params = new URLSearchParams(urlHash);
5026
+ const data = params.get("data");
5027
+ if (!data) return null;
5028
+ try {
5029
+ return JSON.parse(data);
5030
+ } catch (e) {
5031
+ return null;
5032
+ }
5033
+ }
5034
+ function getAppData(initialState, schema, options) {
5035
+ const resolvedInitialState = initialState instanceof Function ? initialState() : initialState;
5036
+ let appData = parseAppDataParameter(options) ?? createDefaultAppData(resolvedInitialState);
5037
+ if (options?.overrideExistingState) {
5038
+ appData.initialState = resolvedInitialState;
5039
+ }
5040
+ appData.initialState = enforceSchema(appData.initialState, schema);
5041
+ return appData;
5042
+ }
5043
+ function useNoyaState(...args) {
5044
+ const [initialState, options] = typeof args[0] === "object" && args[0] !== null && "schema" in args[0] && import_state_manager2.TypeGuard.IsSchema(args[0].schema) ? [null, args[0]] : [args[0], args[1]];
5045
+ const [
5046
+ {
5047
+ multiplayerUrl,
5048
+ inspector,
5049
+ initialState: noyaAppInitialState,
5050
+ theme,
5051
+ viewType
5052
+ }
5053
+ ] = (0, import_react7.useState)(() => {
5054
+ return getAppData(initialState, options?.schema, {
5055
+ overrideExistingState: options?.overrideExistingState
5056
+ });
5057
+ });
5058
+ const sync = (0, import_react7.useMemo)(() => {
5059
+ return (0, import_state_manager2.isEmbeddedApp)() ? (0, import_state_manager2.parentFrameSync)({ debug: options?.debug }) : multiplayerUrl ? (0, import_state_manager2.webSocketSync)({
5060
+ url: multiplayerUrl,
5061
+ debug: options?.debug
5062
+ }) : options?.offlineStorageKey ? (0, import_state_manager2.localStorageSync)({ key: options.offlineStorageKey }) : (0, import_state_manager2.stubSync)();
5063
+ }, [multiplayerUrl, options?.offlineStorageKey, options?.debug]);
5064
+ const result = useMultiplayerState(noyaAppInitialState, {
5065
+ ...options,
5066
+ inspector: options?.inspector ?? inspector,
5067
+ sync: options?.sync ?? sync
5068
+ });
5069
+ const [, , extras] = result;
5070
+ const mergedExtras = (0, import_react7.useMemo)(() => {
5071
+ return { ...extras, theme, viewType };
5072
+ }, [extras, theme, viewType]);
5073
+ return [result[0], result[1], mergedExtras];
5074
+ }
5075
+
5076
+ // src/NoyaStateContext.tsx
5077
+ var import_observable = require("@noya-app/observable");
5078
+ var import_react8 = __toESM(require("react"));
5079
+ var AnyNoyaStateContext = (0, import_react8.createContext)(void 0);
5080
+ function useAnyNoyaStateContext() {
5081
+ const value = (0, import_react8.useContext)(AnyNoyaStateContext);
5082
+ if (!value) {
5083
+ throw new Error(
5084
+ "useNoyaStateContext must be used within a NoyaStateProvider"
5085
+ );
5086
+ }
5087
+ return value;
5088
+ }
5089
+ function useAnyNoyaManager() {
5090
+ const { noyaManager } = useAnyNoyaStateContext();
5091
+ return noyaManager;
5092
+ }
5093
+ function useColorScheme() {
5094
+ const { theme } = useAnyNoyaStateContext();
5095
+ return theme;
5096
+ }
5097
+ function useViewType() {
5098
+ const { viewType } = useAnyNoyaStateContext();
5099
+ return viewType;
5100
+ }
5101
+ function useAssets() {
5102
+ const { noyaManager } = useAnyNoyaStateContext();
5103
+ return useObservable(noyaManager.assetManager.assets$);
5104
+ }
5105
+ function useAsset(id) {
5106
+ const { noyaManager } = useAnyNoyaStateContext();
5107
+ const observable = (0, import_react8.useMemo)(
5108
+ () => noyaManager.assetManager.assets$.map(
5109
+ (assets) => assets.find((a) => a.id === id)
5110
+ ),
5111
+ [noyaManager, id]
5112
+ );
5113
+ return useObservable(observable);
5114
+ }
5115
+ function useAssetManager() {
5116
+ const { noyaManager } = useAnyNoyaStateContext();
5117
+ const isInitialized = useObservable(noyaManager.assetManager.isInitialized$);
5118
+ return (0, import_react8.useMemo)(
5119
+ () => ({
5120
+ create: noyaManager.assetManager.create,
5121
+ delete: noyaManager.assetManager.delete,
5122
+ isInitialized
5123
+ }),
5124
+ [noyaManager, isInitialized]
5125
+ );
5126
+ }
5127
+ function useAIManager() {
5128
+ const { noyaManager } = useAnyNoyaStateContext();
5129
+ return noyaManager.aiManager;
5130
+ }
5131
+ function useSecretManager() {
5132
+ const { noyaManager } = useAnyNoyaStateContext();
5133
+ return noyaManager.secretManager;
5134
+ }
5135
+ function useSecrets() {
5136
+ const { noyaManager } = useAnyNoyaStateContext();
5137
+ return useObservable(noyaManager.secretManager.secrets$);
5138
+ }
5139
+ function useSecret(name) {
5140
+ const { noyaManager } = useAnyNoyaStateContext();
5141
+ return useObservable(
5142
+ noyaManager.secretManager.secrets$,
5143
+ (0, import_react8.useCallback)((secrets) => secrets.find((s) => s.name === name), [name])
5144
+ );
5145
+ }
5146
+ function useInputs() {
5147
+ const { noyaManager } = useAnyNoyaStateContext();
5148
+ return useObservable(noyaManager.ioManager.inputs$);
5149
+ }
5150
+ function useOutputTransforms() {
5151
+ const { noyaManager } = useAnyNoyaStateContext();
5152
+ return useObservable(noyaManager.ioManager.outputTransforms$);
5153
+ }
5154
+ function useIOManager() {
5155
+ const { noyaManager } = useAnyNoyaStateContext();
5156
+ return noyaManager.ioManager;
5157
+ }
5158
+ function useIsInitialized() {
5159
+ const { noyaManager, viewType } = useAnyNoyaStateContext();
5160
+ const isInitializedObservable = (0, import_react8.useMemo)(
5161
+ () => import_observable.Observable.combine(
5162
+ [
5163
+ ...viewType === "preview" ? [] : [noyaManager.multiplayerStateManager.isInitialized$],
5164
+ noyaManager.secretManager.isInitialized$,
5165
+ noyaManager.assetManager.isInitialized$
5166
+ ],
5167
+ (values) => values.every((v) => v)
5168
+ ),
5169
+ [noyaManager, viewType]
5170
+ );
5171
+ return useObservable(isInitializedObservable);
5172
+ }
5173
+ function useWorkflowManager() {
5174
+ const { noyaManager } = useAnyNoyaStateContext();
5175
+ return noyaManager.workflowManager;
5176
+ }
5177
+ var ConnectedUsersContext = (0, import_react8.createContext)(void 0);
5178
+ function useConnectedUsersManager() {
5179
+ return (0, import_react8.useContext)(ConnectedUsersContext);
5180
+ }
5181
+ var AnyEphemeralUserDataManagerContext = (0, import_react8.createContext)(void 0);
5182
+ function useAnyEphemeralUserData() {
5183
+ return (0, import_react8.useContext)(AnyEphemeralUserDataManagerContext);
5184
+ }
5185
+ function useCurrentUserId() {
5186
+ const connectedUsersManager = useConnectedUsersManager();
5187
+ return useObservable(connectedUsersManager?.currentUserId$);
5188
+ }
5189
+ var FallbackUntilInitialized = ({
5190
+ children,
5191
+ fallback
5192
+ }) => {
5193
+ const isInitialized = useIsInitialized();
5194
+ return isInitialized ? children : fallback ?? null;
5195
+ };
5196
+ function createNoyaContext({
1487
5197
  schema,
1488
- mergeHistoryEntries
5198
+ mergeHistoryEntries,
5199
+ outputTransforms,
5200
+ inputs
1489
5201
  }) {
1490
5202
  const NoyaStateContext = AnyNoyaStateContext;
1491
5203
  const EphemeralUserDataManagerContext = AnyEphemeralUserDataManagerContext;
@@ -1494,12 +5206,25 @@ function createNoyaContext({
1494
5206
  initialState,
1495
5207
  ...options
1496
5208
  }) {
1497
- const [, , { noyaManager }] = useNoyaState(initialState, {
1498
- ...options,
1499
- schema,
1500
- mergeHistoryEntries
1501
- });
1502
- return /* @__PURE__ */ import_react8.default.createElement(AnyNoyaStateContext.Provider, { value: noyaManager }, /* @__PURE__ */ import_react8.default.createElement(
5209
+ const [, , { noyaManager, theme, viewType }] = useNoyaState(
5210
+ initialState,
5211
+ {
5212
+ schema,
5213
+ mergeHistoryEntries,
5214
+ outputTransforms,
5215
+ inputs,
5216
+ ...options
5217
+ }
5218
+ );
5219
+ const contextValue = (0, import_react8.useMemo)(
5220
+ () => ({
5221
+ noyaManager,
5222
+ theme,
5223
+ viewType
5224
+ }),
5225
+ [noyaManager, theme, viewType]
5226
+ );
5227
+ return /* @__PURE__ */ import_react8.default.createElement(AnyNoyaStateContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react8.default.createElement(
1503
5228
  ConnectedUsersContext.Provider,
1504
5229
  {
1505
5230
  value: noyaManager.connectedUsersManager
@@ -1514,25 +5239,31 @@ function createNoyaContext({
1514
5239
  ));
1515
5240
  }
1516
5241
  function useValue(path, options) {
1517
- const { multiplayerStateManager: ms } = useAnyNoyaStateContext();
5242
+ const { noyaManager } = useAnyNoyaStateContext();
1518
5243
  let actualPath = typeof path === "function" || !path ? "" : path;
1519
5244
  const mappedObservable = (0, import_react8.useMemo)(() => {
1520
5245
  if (typeof path === "function") {
1521
- return ms.optimisticState$.map(path, { isEqual: options?.isEqual });
5246
+ return noyaManager.multiplayerStateManager.optimisticState$.map(path, {
5247
+ isEqual: options?.isEqual
5248
+ });
1522
5249
  }
1523
- return ms.optimisticState$;
1524
- }, [ms, path, options?.isEqual]);
5250
+ return noyaManager.multiplayerStateManager.optimisticState$;
5251
+ }, [noyaManager, path, options?.isEqual]);
1525
5252
  const value = useObservable(mappedObservable, actualPath);
1526
5253
  return value;
1527
5254
  }
1528
5255
  function useSetValue(path) {
1529
- const { multiplayerStateManager: ms } = useAnyNoyaStateContext();
5256
+ const { noyaManager } = useAnyNoyaStateContext();
1530
5257
  const setValue = (0, import_react8.useCallback)(
1531
5258
  (...args) => {
1532
5259
  const [metadata, value] = args.length === 2 ? args : [{}, args[0]];
1533
- ms.setStateAtPath(metadata, path ?? "", value);
5260
+ noyaManager.multiplayerStateManager.setStateAtPath(
5261
+ metadata,
5262
+ path ?? "",
5263
+ value
5264
+ );
1534
5265
  },
1535
- [ms, path]
5266
+ [noyaManager, path]
1536
5267
  );
1537
5268
  return setValue;
1538
5269
  }
@@ -1543,8 +5274,8 @@ function createNoyaContext({
1543
5274
  return [value, setValue];
1544
5275
  }
1545
5276
  function useStateManager() {
1546
- const { multiplayerStateManager: ms } = useAnyNoyaStateContext();
1547
- return ms;
5277
+ const { noyaManager } = useAnyNoyaStateContext();
5278
+ return noyaManager.multiplayerStateManager;
1548
5279
  }
1549
5280
  function useEphemeralUserDataManager() {
1550
5281
  const ephemeralUserData = (0, import_react8.useContext)(EphemeralUserDataManagerContext);
@@ -1556,16 +5287,32 @@ function createNoyaContext({
1556
5287
  return ephemeralUserData;
1557
5288
  }
1558
5289
  function useNoyaManager() {
1559
- return useAnyNoyaStateContext();
5290
+ return useAnyNoyaStateContext().noyaManager;
1560
5291
  }
1561
5292
  function useLeftMenuItems() {
1562
5293
  const { menuManager } = useNoyaManager();
1563
5294
  return useObservable(menuManager.leftMenuItems$);
1564
5295
  }
5296
+ function useSetLeftMenuItems(leftMenuItems) {
5297
+ const { menuManager } = useNoyaManager();
5298
+ (0, import_react8.useEffect)(() => {
5299
+ if (leftMenuItems) {
5300
+ menuManager.setLeftMenuItems(leftMenuItems);
5301
+ }
5302
+ }, [menuManager, leftMenuItems]);
5303
+ }
1565
5304
  function useRightMenuItems() {
1566
5305
  const { menuManager } = useNoyaManager();
1567
5306
  return useObservable(menuManager.rightMenuItems$);
1568
5307
  }
5308
+ function useSetRightMenuItems(rightMenuItems) {
5309
+ const { menuManager } = useNoyaManager();
5310
+ (0, import_react8.useEffect)(() => {
5311
+ if (rightMenuItems) {
5312
+ menuManager.setRightMenuItems(rightMenuItems);
5313
+ }
5314
+ }, [menuManager, rightMenuItems]);
5315
+ }
1569
5316
  function useHandleMenuItem(callback) {
1570
5317
  const { menuManager } = useNoyaManager();
1571
5318
  (0, import_react8.useEffect)(() => {
@@ -1576,6 +5323,14 @@ function createNoyaContext({
1576
5323
  const { menuManager } = useNoyaManager();
1577
5324
  return (0, import_react8.useCallback)((type) => menuManager.emit(type), [menuManager]);
1578
5325
  }
5326
+ function useMenu(options) {
5327
+ const { leftMenuItems, rightMenuItems, onSelectMenuItem } = options;
5328
+ useSetLeftMenuItems(leftMenuItems);
5329
+ useSetRightMenuItems(rightMenuItems);
5330
+ const noop = (0, import_react8.useCallback)(() => {
5331
+ }, []);
5332
+ useHandleMenuItem(onSelectMenuItem ?? noop);
5333
+ }
1579
5334
  return {
1580
5335
  Context: NoyaStateContext,
1581
5336
  Provider: NoyaStateProvider,
@@ -1585,10 +5340,13 @@ function createNoyaContext({
1585
5340
  useStateManager,
1586
5341
  useEphemeralUserDataManager,
1587
5342
  useLeftMenuItems,
5343
+ useSetLeftMenuItems,
1588
5344
  useRightMenuItems,
5345
+ useSetRightMenuItems,
1589
5346
  useHandleMenuItem,
1590
5347
  useOnSelectMenuItemCallback,
1591
- useNoyaManager
5348
+ useNoyaManager,
5349
+ useMenu
1592
5350
  };
1593
5351
  }
1594
5352
 
@@ -1702,21 +5460,28 @@ var WebSocketConnection = class {
1702
5460
  parseAppDataParameter,
1703
5461
  useAIManager,
1704
5462
  useAnyEphemeralUserData,
5463
+ useAnyNoyaManager,
5464
+ useAnyNoyaStateContext,
1705
5465
  useAsset,
1706
5466
  useAssetManager,
1707
5467
  useAssets,
5468
+ useColorScheme,
1708
5469
  useConnectedUsersManager,
1709
5470
  useCurrentUserId,
5471
+ useIOManager,
5472
+ useInputs,
1710
5473
  useIsInitialized,
1711
5474
  useManagedHistory,
1712
5475
  useManagedState,
1713
5476
  useMultiplayerState,
1714
5477
  useNoyaState,
1715
5478
  useObservable,
5479
+ useOutputTransforms,
1716
5480
  useSecret,
1717
5481
  useSecretManager,
1718
5482
  useSecrets,
1719
5483
  useSyncStateManager,
5484
+ useViewType,
1720
5485
  useWorkflowManager,
1721
5486
  ...require("@noya-app/state-manager")
1722
5487
  });