@luna-park/plugin 1.2.0 → 1.2.1
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/README.md +6 -6
- package/bin/preview.js +1 -1
- package/dist/chunk-rCEYsGS8.cjs +1 -0
- package/dist/dist-BUZt4gnZ.js +421 -0
- package/dist/dist-BkSFkjuo.cjs +5 -0
- package/dist/extractor.cjs +9 -11
- package/dist/extractor.d.ts +17 -17
- package/dist/extractor.js +483 -548
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +702 -231
- package/dist/index.js +2961 -34
- package/dist/plugin.css +2 -0
- package/dist/preview.cjs +1 -1
- package/dist/preview.js +27 -37
- package/package.json +20 -18
- package/dist/index-CWrYVK_G.cjs +0 -5
- package/dist/index-Dv9uuje9.js +0 -410
package/dist/index.js
CHANGED
|
@@ -1,35 +1,2962 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
import { a as LogicUtil, i as LogicType, n as ELogicType, o as makeLogicNode, r as EVarType, t as ELogicScope, u as cloneWithFunctions } from "./dist-BUZt4gnZ.js";
|
|
2
|
+
import { createElementBlock, openBlock, renderSlot } from "vue";
|
|
3
|
+
var __defProp$1 = Object.defineProperty, __export$1 = (y, J) => {
|
|
4
|
+
let Y = {};
|
|
5
|
+
for (var X in y) __defProp$1(Y, X, {
|
|
6
|
+
get: y[X],
|
|
7
|
+
enumerable: !0
|
|
8
|
+
});
|
|
9
|
+
return J && __defProp$1(Y, Symbol.toStringTag, { value: "Module" }), Y;
|
|
10
|
+
}, __plugin_vue_export_helper_default = (y, J) => {
|
|
11
|
+
let Y = y.__vccOpts || y;
|
|
12
|
+
for (let [y, X] of J) Y[y] = X;
|
|
13
|
+
return Y;
|
|
14
|
+
}, _sfc_main = {}, _hoisted_1 = { class: "story-wrapper" };
|
|
15
|
+
function _sfc_render(y, J) {
|
|
16
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(y.$slots, "default", {}, void 0, !0)]);
|
|
17
|
+
}
|
|
18
|
+
var LSettingsStoryWrapper_default = /* @__PURE__ */ __plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-8d6cff07"]]);
|
|
19
|
+
let EInjectionKey = /* @__PURE__ */ function(y) {
|
|
20
|
+
return y.ViteImport = "viteImport", y.VitePlugin = "vitePlugin", y.AppImport = "appImport", y.AppBody = "appBody", y.AppSetup = "appSetup", y.Style = "style", y.ServerImport = "serverImport", y.ServerBody = "serverBody", y;
|
|
21
|
+
}({}), ETokenType = /* @__PURE__ */ function(y) {
|
|
22
|
+
return y.Color = "color", y.FontSize = "font-size", y.FontWeight = "font-weight", y.FontFamily = "font-family", y.Length = "length", y.Time = "time", y;
|
|
23
|
+
}({});
|
|
24
|
+
function IsAsyncIterator(y) {
|
|
25
|
+
return IsObject$1(y) && !IsArray(y) && !IsUint8Array(y) && Symbol.asyncIterator in y;
|
|
26
|
+
}
|
|
27
|
+
function IsArray(y) {
|
|
28
|
+
return Array.isArray(y);
|
|
29
|
+
}
|
|
30
|
+
function IsBigInt(y) {
|
|
31
|
+
return typeof y == "bigint";
|
|
32
|
+
}
|
|
33
|
+
function IsBoolean$1(y) {
|
|
34
|
+
return typeof y == "boolean";
|
|
35
|
+
}
|
|
36
|
+
function IsDate(y) {
|
|
37
|
+
return y instanceof globalThis.Date;
|
|
38
|
+
}
|
|
39
|
+
function IsFunction(y) {
|
|
40
|
+
return typeof y == "function";
|
|
41
|
+
}
|
|
42
|
+
function IsIterator(y) {
|
|
43
|
+
return IsObject$1(y) && !IsArray(y) && !IsUint8Array(y) && Symbol.iterator in y;
|
|
44
|
+
}
|
|
45
|
+
function IsNull(y) {
|
|
46
|
+
return y === null;
|
|
47
|
+
}
|
|
48
|
+
function IsNumber$1(y) {
|
|
49
|
+
return typeof y == "number";
|
|
50
|
+
}
|
|
51
|
+
function IsObject$1(y) {
|
|
52
|
+
return typeof y == "object" && !!y;
|
|
53
|
+
}
|
|
54
|
+
function IsRegExp$2(y) {
|
|
55
|
+
return y instanceof globalThis.RegExp;
|
|
56
|
+
}
|
|
57
|
+
function IsString(y) {
|
|
58
|
+
return typeof y == "string";
|
|
59
|
+
}
|
|
60
|
+
function IsSymbol(y) {
|
|
61
|
+
return typeof y == "symbol";
|
|
62
|
+
}
|
|
63
|
+
function IsUint8Array(y) {
|
|
64
|
+
return y instanceof globalThis.Uint8Array;
|
|
65
|
+
}
|
|
66
|
+
function IsUndefined(y) {
|
|
67
|
+
return y === void 0;
|
|
68
|
+
}
|
|
69
|
+
function ArrayType(y) {
|
|
70
|
+
return y.map((y) => Visit$2(y));
|
|
71
|
+
}
|
|
72
|
+
function DateType(y) {
|
|
73
|
+
return new Date(y.getTime());
|
|
74
|
+
}
|
|
75
|
+
function Uint8ArrayType(y) {
|
|
76
|
+
return new Uint8Array(y);
|
|
77
|
+
}
|
|
78
|
+
function RegExpType(y) {
|
|
79
|
+
return new RegExp(y.source, y.flags);
|
|
80
|
+
}
|
|
81
|
+
function ObjectType(y) {
|
|
82
|
+
let J = {};
|
|
83
|
+
for (let Y of Object.getOwnPropertyNames(y)) J[Y] = Visit$2(y[Y]);
|
|
84
|
+
for (let Y of Object.getOwnPropertySymbols(y)) J[Y] = Visit$2(y[Y]);
|
|
85
|
+
return J;
|
|
86
|
+
}
|
|
87
|
+
function Visit$2(y) {
|
|
88
|
+
return IsArray(y) ? ArrayType(y) : IsDate(y) ? DateType(y) : IsUint8Array(y) ? Uint8ArrayType(y) : IsRegExp$2(y) ? RegExpType(y) : IsObject$1(y) ? ObjectType(y) : y;
|
|
89
|
+
}
|
|
90
|
+
function Clone(y) {
|
|
91
|
+
return Visit$2(y);
|
|
92
|
+
}
|
|
93
|
+
function CloneType(y, J) {
|
|
94
|
+
return Clone(J === void 0 ? y : {
|
|
95
|
+
...J,
|
|
96
|
+
...y
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function IsObject$3(y) {
|
|
100
|
+
return typeof y == "object" && !!y;
|
|
101
|
+
}
|
|
102
|
+
function IsArray$3(y) {
|
|
103
|
+
return globalThis.Array.isArray(y) && !globalThis.ArrayBuffer.isView(y);
|
|
104
|
+
}
|
|
105
|
+
function IsUndefined$3(y) {
|
|
106
|
+
return y === void 0;
|
|
107
|
+
}
|
|
108
|
+
function IsNumber$3(y) {
|
|
109
|
+
return typeof y == "number";
|
|
110
|
+
}
|
|
111
|
+
var TypeSystemPolicy;
|
|
112
|
+
(function(y) {
|
|
113
|
+
y.InstanceMode = "default", y.ExactOptionalPropertyTypes = !1, y.AllowArrayObject = !1, y.AllowNaN = !1, y.AllowNullVoid = !1;
|
|
114
|
+
function J(J, Y) {
|
|
115
|
+
return y.ExactOptionalPropertyTypes ? Y in J : J[Y] !== void 0;
|
|
116
|
+
}
|
|
117
|
+
y.IsExactOptionalProperty = J;
|
|
118
|
+
function Y(J) {
|
|
119
|
+
let Y = IsObject$3(J);
|
|
120
|
+
return y.AllowArrayObject ? Y : Y && !IsArray$3(J);
|
|
121
|
+
}
|
|
122
|
+
y.IsObjectLike = Y;
|
|
123
|
+
function X(y) {
|
|
124
|
+
return Y(y) && !(y instanceof Date) && !(y instanceof Uint8Array);
|
|
125
|
+
}
|
|
126
|
+
y.IsRecordLike = X;
|
|
127
|
+
function Z(J) {
|
|
128
|
+
return y.AllowNaN ? IsNumber$3(J) : Number.isFinite(J);
|
|
129
|
+
}
|
|
130
|
+
y.IsNumberLike = Z;
|
|
131
|
+
function Q(J) {
|
|
132
|
+
let Y = IsUndefined$3(J);
|
|
133
|
+
return y.AllowNullVoid ? Y || J === null : Y;
|
|
134
|
+
}
|
|
135
|
+
y.IsVoidLike = Q;
|
|
136
|
+
})(TypeSystemPolicy ||= {});
|
|
137
|
+
function ImmutableArray(y) {
|
|
138
|
+
return globalThis.Object.freeze(y).map((y) => Immutable(y));
|
|
139
|
+
}
|
|
140
|
+
function ImmutableDate(y) {
|
|
141
|
+
return y;
|
|
142
|
+
}
|
|
143
|
+
function ImmutableUint8Array(y) {
|
|
144
|
+
return y;
|
|
145
|
+
}
|
|
146
|
+
function ImmutableRegExp(y) {
|
|
147
|
+
return y;
|
|
148
|
+
}
|
|
149
|
+
function ImmutableObject(y) {
|
|
150
|
+
let J = {};
|
|
151
|
+
for (let Y of Object.getOwnPropertyNames(y)) J[Y] = Immutable(y[Y]);
|
|
152
|
+
for (let Y of Object.getOwnPropertySymbols(y)) J[Y] = Immutable(y[Y]);
|
|
153
|
+
return globalThis.Object.freeze(J);
|
|
154
|
+
}
|
|
155
|
+
function Immutable(y) {
|
|
156
|
+
return IsArray(y) ? ImmutableArray(y) : IsDate(y) ? ImmutableDate(y) : IsUint8Array(y) ? ImmutableUint8Array(y) : IsRegExp$2(y) ? ImmutableRegExp(y) : IsObject$1(y) ? ImmutableObject(y) : y;
|
|
157
|
+
}
|
|
158
|
+
function CreateType(y, J) {
|
|
159
|
+
let Y = J === void 0 ? y : {
|
|
160
|
+
...J,
|
|
161
|
+
...y
|
|
162
|
+
};
|
|
163
|
+
switch (TypeSystemPolicy.InstanceMode) {
|
|
164
|
+
case "freeze": return Immutable(Y);
|
|
165
|
+
case "clone": return Clone(Y);
|
|
166
|
+
default: return Y;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
var TypeBoxError = class extends Error {
|
|
170
|
+
constructor(y) {
|
|
171
|
+
super(y);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const TransformKind = Symbol.for("TypeBox.Transform"), ReadonlyKind = Symbol.for("TypeBox.Readonly"), OptionalKind = Symbol.for("TypeBox.Optional"), Hint = Symbol.for("TypeBox.Hint"), Kind = Symbol.for("TypeBox.Kind");
|
|
175
|
+
function IsReadonly(y) {
|
|
176
|
+
return IsObject$1(y) && y[ReadonlyKind] === "Readonly";
|
|
177
|
+
}
|
|
178
|
+
function IsOptional(y) {
|
|
179
|
+
return IsObject$1(y) && y[OptionalKind] === "Optional";
|
|
180
|
+
}
|
|
181
|
+
function IsAny(y) {
|
|
182
|
+
return IsKindOf$1(y, "Any");
|
|
183
|
+
}
|
|
184
|
+
function IsArgument$1(y) {
|
|
185
|
+
return IsKindOf$1(y, "Argument");
|
|
186
|
+
}
|
|
187
|
+
function IsArray$1(y) {
|
|
188
|
+
return IsKindOf$1(y, "Array");
|
|
189
|
+
}
|
|
190
|
+
function IsAsyncIterator$1(y) {
|
|
191
|
+
return IsKindOf$1(y, "AsyncIterator");
|
|
192
|
+
}
|
|
193
|
+
function IsBigInt$1(y) {
|
|
194
|
+
return IsKindOf$1(y, "BigInt");
|
|
195
|
+
}
|
|
196
|
+
function IsBoolean(y) {
|
|
197
|
+
return IsKindOf$1(y, "Boolean");
|
|
198
|
+
}
|
|
199
|
+
function IsComputed(y) {
|
|
200
|
+
return IsKindOf$1(y, "Computed");
|
|
201
|
+
}
|
|
202
|
+
function IsConstructor(y) {
|
|
203
|
+
return IsKindOf$1(y, "Constructor");
|
|
204
|
+
}
|
|
205
|
+
function IsDate$2(y) {
|
|
206
|
+
return IsKindOf$1(y, "Date");
|
|
207
|
+
}
|
|
208
|
+
function IsFunction$1(y) {
|
|
209
|
+
return IsKindOf$1(y, "Function");
|
|
210
|
+
}
|
|
211
|
+
function IsInteger(y) {
|
|
212
|
+
return IsKindOf$1(y, "Integer");
|
|
213
|
+
}
|
|
214
|
+
function IsIntersect(y) {
|
|
215
|
+
return IsKindOf$1(y, "Intersect");
|
|
216
|
+
}
|
|
217
|
+
function IsIterator$1(y) {
|
|
218
|
+
return IsKindOf$1(y, "Iterator");
|
|
219
|
+
}
|
|
220
|
+
function IsKindOf$1(y, J) {
|
|
221
|
+
return IsObject$1(y) && Kind in y && y[Kind] === J;
|
|
222
|
+
}
|
|
223
|
+
function IsLiteralValue(y) {
|
|
224
|
+
return IsBoolean$1(y) || IsNumber$1(y) || IsString(y);
|
|
225
|
+
}
|
|
226
|
+
function IsLiteral(y) {
|
|
227
|
+
return IsKindOf$1(y, "Literal");
|
|
228
|
+
}
|
|
229
|
+
function IsMappedKey(y) {
|
|
230
|
+
return IsKindOf$1(y, "MappedKey");
|
|
231
|
+
}
|
|
232
|
+
function IsMappedResult(y) {
|
|
233
|
+
return IsKindOf$1(y, "MappedResult");
|
|
234
|
+
}
|
|
235
|
+
function IsNever(y) {
|
|
236
|
+
return IsKindOf$1(y, "Never");
|
|
237
|
+
}
|
|
238
|
+
function IsNot$1(y) {
|
|
239
|
+
return IsKindOf$1(y, "Not");
|
|
240
|
+
}
|
|
241
|
+
function IsNull$2(y) {
|
|
242
|
+
return IsKindOf$1(y, "Null");
|
|
243
|
+
}
|
|
244
|
+
function IsNumber(y) {
|
|
245
|
+
return IsKindOf$1(y, "Number");
|
|
246
|
+
}
|
|
247
|
+
function IsObject(y) {
|
|
248
|
+
return IsKindOf$1(y, "Object");
|
|
249
|
+
}
|
|
250
|
+
function IsPromise(y) {
|
|
251
|
+
return IsKindOf$1(y, "Promise");
|
|
252
|
+
}
|
|
253
|
+
function IsRecord(y) {
|
|
254
|
+
return IsKindOf$1(y, "Record");
|
|
255
|
+
}
|
|
256
|
+
function IsRef(y) {
|
|
257
|
+
return IsKindOf$1(y, "Ref");
|
|
258
|
+
}
|
|
259
|
+
function IsRegExp(y) {
|
|
260
|
+
return IsKindOf$1(y, "RegExp");
|
|
261
|
+
}
|
|
262
|
+
function IsString$1(y) {
|
|
263
|
+
return IsKindOf$1(y, "String");
|
|
264
|
+
}
|
|
265
|
+
function IsSymbol$2(y) {
|
|
266
|
+
return IsKindOf$1(y, "Symbol");
|
|
267
|
+
}
|
|
268
|
+
function IsTemplateLiteral(y) {
|
|
269
|
+
return IsKindOf$1(y, "TemplateLiteral");
|
|
270
|
+
}
|
|
271
|
+
function IsThis$1(y) {
|
|
272
|
+
return IsKindOf$1(y, "This");
|
|
273
|
+
}
|
|
274
|
+
function IsTransform(y) {
|
|
275
|
+
return IsObject$1(y) && TransformKind in y;
|
|
276
|
+
}
|
|
277
|
+
function IsTuple(y) {
|
|
278
|
+
return IsKindOf$1(y, "Tuple");
|
|
279
|
+
}
|
|
280
|
+
function IsUndefined$2(y) {
|
|
281
|
+
return IsKindOf$1(y, "Undefined");
|
|
282
|
+
}
|
|
283
|
+
function IsUnion(y) {
|
|
284
|
+
return IsKindOf$1(y, "Union");
|
|
285
|
+
}
|
|
286
|
+
function IsUint8Array$2(y) {
|
|
287
|
+
return IsKindOf$1(y, "Uint8Array");
|
|
288
|
+
}
|
|
289
|
+
function IsUnknown$1(y) {
|
|
290
|
+
return IsKindOf$1(y, "Unknown");
|
|
291
|
+
}
|
|
292
|
+
function IsUnsafe$1(y) {
|
|
293
|
+
return IsKindOf$1(y, "Unsafe");
|
|
294
|
+
}
|
|
295
|
+
function IsVoid$1(y) {
|
|
296
|
+
return IsKindOf$1(y, "Void");
|
|
297
|
+
}
|
|
298
|
+
function IsKind$1(y) {
|
|
299
|
+
return IsObject$1(y) && Kind in y && IsString(y[Kind]);
|
|
300
|
+
}
|
|
301
|
+
function IsSchema(y) {
|
|
302
|
+
return IsAny(y) || IsArgument$1(y) || IsArray$1(y) || IsBoolean(y) || IsBigInt$1(y) || IsAsyncIterator$1(y) || IsComputed(y) || IsConstructor(y) || IsDate$2(y) || IsFunction$1(y) || IsInteger(y) || IsIntersect(y) || IsIterator$1(y) || IsLiteral(y) || IsMappedKey(y) || IsMappedResult(y) || IsNever(y) || IsNot$1(y) || IsNull$2(y) || IsNumber(y) || IsObject(y) || IsPromise(y) || IsRecord(y) || IsRef(y) || IsRegExp(y) || IsString$1(y) || IsSymbol$2(y) || IsTemplateLiteral(y) || IsThis$1(y) || IsTuple(y) || IsUndefined$2(y) || IsUnion(y) || IsUint8Array$2(y) || IsUnknown$1(y) || IsUnsafe$1(y) || IsVoid$1(y) || IsKind$1(y);
|
|
303
|
+
}
|
|
304
|
+
var KnownTypes = /* @__PURE__ */ "Argument.Any.Array.AsyncIterator.BigInt.Boolean.Computed.Constructor.Date.Enum.Function.Integer.Intersect.Iterator.Literal.MappedKey.MappedResult.Not.Null.Number.Object.Promise.Record.Ref.RegExp.String.Symbol.TemplateLiteral.This.Tuple.Undefined.Union.Uint8Array.Unknown.Void".split(".");
|
|
305
|
+
function IsPattern(y) {
|
|
306
|
+
try {
|
|
307
|
+
return new RegExp(y), !0;
|
|
308
|
+
} catch {
|
|
309
|
+
return !1;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function IsControlCharacterFree(y) {
|
|
313
|
+
if (!IsString(y)) return !1;
|
|
314
|
+
for (let J = 0; J < y.length; J++) {
|
|
315
|
+
let Y = y.charCodeAt(J);
|
|
316
|
+
if (Y >= 7 && Y <= 13 || Y === 27 || Y === 127) return !1;
|
|
317
|
+
}
|
|
318
|
+
return !0;
|
|
319
|
+
}
|
|
320
|
+
function IsAdditionalProperties(y) {
|
|
321
|
+
return IsOptionalBoolean(y) || IsSchema$1(y);
|
|
322
|
+
}
|
|
323
|
+
function IsOptionalBigInt(y) {
|
|
324
|
+
return IsUndefined(y) || IsBigInt(y);
|
|
325
|
+
}
|
|
326
|
+
function IsOptionalNumber(y) {
|
|
327
|
+
return IsUndefined(y) || IsNumber$1(y);
|
|
328
|
+
}
|
|
329
|
+
function IsOptionalBoolean(y) {
|
|
330
|
+
return IsUndefined(y) || IsBoolean$1(y);
|
|
331
|
+
}
|
|
332
|
+
function IsOptionalString(y) {
|
|
333
|
+
return IsUndefined(y) || IsString(y);
|
|
334
|
+
}
|
|
335
|
+
function IsOptionalPattern(y) {
|
|
336
|
+
return IsUndefined(y) || IsString(y) && IsControlCharacterFree(y) && IsPattern(y);
|
|
337
|
+
}
|
|
338
|
+
function IsOptionalFormat(y) {
|
|
339
|
+
return IsUndefined(y) || IsString(y) && IsControlCharacterFree(y);
|
|
340
|
+
}
|
|
341
|
+
function IsOptionalSchema(y) {
|
|
342
|
+
return IsUndefined(y) || IsSchema$1(y);
|
|
343
|
+
}
|
|
344
|
+
function IsOptional$1(y) {
|
|
345
|
+
return IsObject$1(y) && y[OptionalKind] === "Optional";
|
|
346
|
+
}
|
|
347
|
+
function IsAny$1(y) {
|
|
348
|
+
return IsKindOf(y, "Any") && IsOptionalString(y.$id);
|
|
349
|
+
}
|
|
350
|
+
function IsArgument(y) {
|
|
351
|
+
return IsKindOf(y, "Argument") && IsNumber$1(y.index);
|
|
352
|
+
}
|
|
353
|
+
function IsArray$2(y) {
|
|
354
|
+
return IsKindOf(y, "Array") && y.type === "array" && IsOptionalString(y.$id) && IsSchema$1(y.items) && IsOptionalNumber(y.minItems) && IsOptionalNumber(y.maxItems) && IsOptionalBoolean(y.uniqueItems) && IsOptionalSchema(y.contains) && IsOptionalNumber(y.minContains) && IsOptionalNumber(y.maxContains);
|
|
355
|
+
}
|
|
356
|
+
function IsAsyncIterator$2(y) {
|
|
357
|
+
return IsKindOf(y, "AsyncIterator") && y.type === "AsyncIterator" && IsOptionalString(y.$id) && IsSchema$1(y.items);
|
|
358
|
+
}
|
|
359
|
+
function IsBigInt$2(y) {
|
|
360
|
+
return IsKindOf(y, "BigInt") && y.type === "bigint" && IsOptionalString(y.$id) && IsOptionalBigInt(y.exclusiveMaximum) && IsOptionalBigInt(y.exclusiveMinimum) && IsOptionalBigInt(y.maximum) && IsOptionalBigInt(y.minimum) && IsOptionalBigInt(y.multipleOf);
|
|
361
|
+
}
|
|
362
|
+
function IsBoolean$2(y) {
|
|
363
|
+
return IsKindOf(y, "Boolean") && y.type === "boolean" && IsOptionalString(y.$id);
|
|
364
|
+
}
|
|
365
|
+
function IsComputed$1(y) {
|
|
366
|
+
return IsKindOf(y, "Computed") && IsString(y.target) && IsArray(y.parameters) && y.parameters.every((y) => IsSchema$1(y));
|
|
367
|
+
}
|
|
368
|
+
function IsConstructor$1(y) {
|
|
369
|
+
return IsKindOf(y, "Constructor") && y.type === "Constructor" && IsOptionalString(y.$id) && IsArray(y.parameters) && y.parameters.every((y) => IsSchema$1(y)) && IsSchema$1(y.returns);
|
|
370
|
+
}
|
|
371
|
+
function IsDate$1(y) {
|
|
372
|
+
return IsKindOf(y, "Date") && y.type === "Date" && IsOptionalString(y.$id) && IsOptionalNumber(y.exclusiveMaximumTimestamp) && IsOptionalNumber(y.exclusiveMinimumTimestamp) && IsOptionalNumber(y.maximumTimestamp) && IsOptionalNumber(y.minimumTimestamp) && IsOptionalNumber(y.multipleOfTimestamp);
|
|
373
|
+
}
|
|
374
|
+
function IsFunction$2(y) {
|
|
375
|
+
return IsKindOf(y, "Function") && y.type === "Function" && IsOptionalString(y.$id) && IsArray(y.parameters) && y.parameters.every((y) => IsSchema$1(y)) && IsSchema$1(y.returns);
|
|
376
|
+
}
|
|
377
|
+
function IsInteger$1(y) {
|
|
378
|
+
return IsKindOf(y, "Integer") && y.type === "integer" && IsOptionalString(y.$id) && IsOptionalNumber(y.exclusiveMaximum) && IsOptionalNumber(y.exclusiveMinimum) && IsOptionalNumber(y.maximum) && IsOptionalNumber(y.minimum) && IsOptionalNumber(y.multipleOf);
|
|
379
|
+
}
|
|
380
|
+
function IsProperties(y) {
|
|
381
|
+
return IsObject$1(y) && Object.entries(y).every(([y, J]) => IsControlCharacterFree(y) && IsSchema$1(J));
|
|
382
|
+
}
|
|
383
|
+
function IsIntersect$1(y) {
|
|
384
|
+
return IsKindOf(y, "Intersect") && !(IsString(y.type) && y.type !== "object") && IsArray(y.allOf) && y.allOf.every((y) => IsSchema$1(y) && !IsTransform$1(y)) && IsOptionalString(y.type) && (IsOptionalBoolean(y.unevaluatedProperties) || IsOptionalSchema(y.unevaluatedProperties)) && IsOptionalString(y.$id);
|
|
385
|
+
}
|
|
386
|
+
function IsIterator$2(y) {
|
|
387
|
+
return IsKindOf(y, "Iterator") && y.type === "Iterator" && IsOptionalString(y.$id) && IsSchema$1(y.items);
|
|
388
|
+
}
|
|
389
|
+
function IsKindOf(y, J) {
|
|
390
|
+
return IsObject$1(y) && Kind in y && y[Kind] === J;
|
|
391
|
+
}
|
|
392
|
+
function IsLiteralString(y) {
|
|
393
|
+
return IsLiteral$1(y) && IsString(y.const);
|
|
394
|
+
}
|
|
395
|
+
function IsLiteralNumber(y) {
|
|
396
|
+
return IsLiteral$1(y) && IsNumber$1(y.const);
|
|
397
|
+
}
|
|
398
|
+
function IsLiteralBoolean(y) {
|
|
399
|
+
return IsLiteral$1(y) && IsBoolean$1(y.const);
|
|
400
|
+
}
|
|
401
|
+
function IsLiteral$1(y) {
|
|
402
|
+
return IsKindOf(y, "Literal") && IsOptionalString(y.$id) && IsLiteralValue$1(y.const);
|
|
403
|
+
}
|
|
404
|
+
function IsLiteralValue$1(y) {
|
|
405
|
+
return IsBoolean$1(y) || IsNumber$1(y) || IsString(y);
|
|
406
|
+
}
|
|
407
|
+
function IsMappedKey$1(y) {
|
|
408
|
+
return IsKindOf(y, "MappedKey") && IsArray(y.keys) && y.keys.every((y) => IsNumber$1(y) || IsString(y));
|
|
409
|
+
}
|
|
410
|
+
function IsMappedResult$1(y) {
|
|
411
|
+
return IsKindOf(y, "MappedResult") && IsProperties(y.properties);
|
|
412
|
+
}
|
|
413
|
+
function IsNever$1(y) {
|
|
414
|
+
return IsKindOf(y, "Never") && IsObject$1(y.not) && Object.getOwnPropertyNames(y.not).length === 0;
|
|
415
|
+
}
|
|
416
|
+
function IsNot(y) {
|
|
417
|
+
return IsKindOf(y, "Not") && IsSchema$1(y.not);
|
|
418
|
+
}
|
|
419
|
+
function IsNull$1(y) {
|
|
420
|
+
return IsKindOf(y, "Null") && y.type === "null" && IsOptionalString(y.$id);
|
|
421
|
+
}
|
|
422
|
+
function IsNumber$2(y) {
|
|
423
|
+
return IsKindOf(y, "Number") && y.type === "number" && IsOptionalString(y.$id) && IsOptionalNumber(y.exclusiveMaximum) && IsOptionalNumber(y.exclusiveMinimum) && IsOptionalNumber(y.maximum) && IsOptionalNumber(y.minimum) && IsOptionalNumber(y.multipleOf);
|
|
424
|
+
}
|
|
425
|
+
function IsObject$2(y) {
|
|
426
|
+
return IsKindOf(y, "Object") && y.type === "object" && IsOptionalString(y.$id) && IsProperties(y.properties) && IsAdditionalProperties(y.additionalProperties) && IsOptionalNumber(y.minProperties) && IsOptionalNumber(y.maxProperties);
|
|
427
|
+
}
|
|
428
|
+
function IsPromise$1(y) {
|
|
429
|
+
return IsKindOf(y, "Promise") && y.type === "Promise" && IsOptionalString(y.$id) && IsSchema$1(y.item);
|
|
430
|
+
}
|
|
431
|
+
function IsRecord$1(y) {
|
|
432
|
+
return IsKindOf(y, "Record") && y.type === "object" && IsOptionalString(y.$id) && IsAdditionalProperties(y.additionalProperties) && IsObject$1(y.patternProperties) && ((y) => {
|
|
433
|
+
let J = Object.getOwnPropertyNames(y.patternProperties);
|
|
434
|
+
return J.length === 1 && IsPattern(J[0]) && IsObject$1(y.patternProperties) && IsSchema$1(y.patternProperties[J[0]]);
|
|
435
|
+
})(y);
|
|
436
|
+
}
|
|
437
|
+
function IsRef$1(y) {
|
|
438
|
+
return IsKindOf(y, "Ref") && IsOptionalString(y.$id) && IsString(y.$ref);
|
|
439
|
+
}
|
|
440
|
+
function IsRegExp$1(y) {
|
|
441
|
+
return IsKindOf(y, "RegExp") && IsOptionalString(y.$id) && IsString(y.source) && IsString(y.flags) && IsOptionalNumber(y.maxLength) && IsOptionalNumber(y.minLength);
|
|
442
|
+
}
|
|
443
|
+
function IsString$2(y) {
|
|
444
|
+
return IsKindOf(y, "String") && y.type === "string" && IsOptionalString(y.$id) && IsOptionalNumber(y.minLength) && IsOptionalNumber(y.maxLength) && IsOptionalPattern(y.pattern) && IsOptionalFormat(y.format);
|
|
445
|
+
}
|
|
446
|
+
function IsSymbol$1(y) {
|
|
447
|
+
return IsKindOf(y, "Symbol") && y.type === "symbol" && IsOptionalString(y.$id);
|
|
448
|
+
}
|
|
449
|
+
function IsTemplateLiteral$1(y) {
|
|
450
|
+
return IsKindOf(y, "TemplateLiteral") && y.type === "string" && IsString(y.pattern) && y.pattern[0] === "^" && y.pattern[y.pattern.length - 1] === "$";
|
|
451
|
+
}
|
|
452
|
+
function IsThis(y) {
|
|
453
|
+
return IsKindOf(y, "This") && IsOptionalString(y.$id) && IsString(y.$ref);
|
|
454
|
+
}
|
|
455
|
+
function IsTransform$1(y) {
|
|
456
|
+
return IsObject$1(y) && TransformKind in y;
|
|
457
|
+
}
|
|
458
|
+
function IsTuple$1(y) {
|
|
459
|
+
return IsKindOf(y, "Tuple") && y.type === "array" && IsOptionalString(y.$id) && IsNumber$1(y.minItems) && IsNumber$1(y.maxItems) && y.minItems === y.maxItems && (IsUndefined(y.items) && IsUndefined(y.additionalItems) && y.minItems === 0 || IsArray(y.items) && y.items.every((y) => IsSchema$1(y)));
|
|
460
|
+
}
|
|
461
|
+
function IsUndefined$1(y) {
|
|
462
|
+
return IsKindOf(y, "Undefined") && y.type === "undefined" && IsOptionalString(y.$id);
|
|
463
|
+
}
|
|
464
|
+
function IsUnion$1(y) {
|
|
465
|
+
return IsKindOf(y, "Union") && IsOptionalString(y.$id) && IsObject$1(y) && IsArray(y.anyOf) && y.anyOf.every((y) => IsSchema$1(y));
|
|
466
|
+
}
|
|
467
|
+
function IsUint8Array$1(y) {
|
|
468
|
+
return IsKindOf(y, "Uint8Array") && y.type === "Uint8Array" && IsOptionalString(y.$id) && IsOptionalNumber(y.minByteLength) && IsOptionalNumber(y.maxByteLength);
|
|
469
|
+
}
|
|
470
|
+
function IsUnknown(y) {
|
|
471
|
+
return IsKindOf(y, "Unknown") && IsOptionalString(y.$id);
|
|
472
|
+
}
|
|
473
|
+
function IsUnsafe(y) {
|
|
474
|
+
return IsKindOf(y, "Unsafe");
|
|
475
|
+
}
|
|
476
|
+
function IsVoid(y) {
|
|
477
|
+
return IsKindOf(y, "Void") && y.type === "void" && IsOptionalString(y.$id);
|
|
478
|
+
}
|
|
479
|
+
function IsKind(y) {
|
|
480
|
+
return IsObject$1(y) && Kind in y && IsString(y[Kind]) && !KnownTypes.includes(y[Kind]);
|
|
481
|
+
}
|
|
482
|
+
function IsSchema$1(y) {
|
|
483
|
+
return IsObject$1(y) && (IsAny$1(y) || IsArgument(y) || IsArray$2(y) || IsBoolean$2(y) || IsBigInt$2(y) || IsAsyncIterator$2(y) || IsComputed$1(y) || IsConstructor$1(y) || IsDate$1(y) || IsFunction$2(y) || IsInteger$1(y) || IsIntersect$1(y) || IsIterator$2(y) || IsLiteral$1(y) || IsMappedKey$1(y) || IsMappedResult$1(y) || IsNever$1(y) || IsNot(y) || IsNull$1(y) || IsNumber$2(y) || IsObject$2(y) || IsPromise$1(y) || IsRecord$1(y) || IsRef$1(y) || IsRegExp$1(y) || IsString$2(y) || IsSymbol$1(y) || IsTemplateLiteral$1(y) || IsThis(y) || IsTuple$1(y) || IsUndefined$1(y) || IsUnion$1(y) || IsUint8Array$1(y) || IsUnknown(y) || IsUnsafe(y) || IsVoid(y) || IsKind(y));
|
|
484
|
+
}
|
|
485
|
+
const PatternBoolean = "(true|false)", PatternNumber = "(0|[1-9][0-9]*)", PatternString = "(.*)";
|
|
486
|
+
`${PatternBoolean}`;
|
|
487
|
+
const PatternNumberExact = `^${PatternNumber}$`, PatternStringExact = `^${PatternString}$`;
|
|
488
|
+
function SetIncludes(y, J) {
|
|
489
|
+
return y.includes(J);
|
|
490
|
+
}
|
|
491
|
+
function SetDistinct(y) {
|
|
492
|
+
return [...new Set(y)];
|
|
493
|
+
}
|
|
494
|
+
function SetIntersect(y, J) {
|
|
495
|
+
return y.filter((y) => J.includes(y));
|
|
496
|
+
}
|
|
497
|
+
function SetIntersectManyResolve(y, J) {
|
|
498
|
+
return y.reduce((y, J) => SetIntersect(y, J), J);
|
|
499
|
+
}
|
|
500
|
+
function SetIntersectMany(y) {
|
|
501
|
+
return y.length === 1 ? y[0] : y.length > 1 ? SetIntersectManyResolve(y.slice(1), y[0]) : [];
|
|
502
|
+
}
|
|
503
|
+
function SetUnionMany(y) {
|
|
504
|
+
let J = [];
|
|
505
|
+
for (let Y of y) J.push(...Y);
|
|
506
|
+
return J;
|
|
507
|
+
}
|
|
508
|
+
function Any(y) {
|
|
509
|
+
return CreateType({ [Kind]: "Any" }, y);
|
|
510
|
+
}
|
|
511
|
+
function Array$1(y, J) {
|
|
512
|
+
return CreateType({
|
|
513
|
+
[Kind]: "Array",
|
|
514
|
+
type: "array",
|
|
515
|
+
items: y
|
|
516
|
+
}, J);
|
|
517
|
+
}
|
|
518
|
+
function Argument(y) {
|
|
519
|
+
return CreateType({
|
|
520
|
+
[Kind]: "Argument",
|
|
521
|
+
index: y
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
function AsyncIterator(y, J) {
|
|
525
|
+
return CreateType({
|
|
526
|
+
[Kind]: "AsyncIterator",
|
|
527
|
+
type: "AsyncIterator",
|
|
528
|
+
items: y
|
|
529
|
+
}, J);
|
|
530
|
+
}
|
|
531
|
+
function Computed(y, J, Y) {
|
|
532
|
+
return CreateType({
|
|
533
|
+
[Kind]: "Computed",
|
|
534
|
+
target: y,
|
|
535
|
+
parameters: J
|
|
536
|
+
}, Y);
|
|
537
|
+
}
|
|
538
|
+
function DiscardKey(y, J) {
|
|
539
|
+
let { [J]: Y, ...X } = y;
|
|
540
|
+
return X;
|
|
541
|
+
}
|
|
542
|
+
function Discard(y, J) {
|
|
543
|
+
return J.reduce((y, J) => DiscardKey(y, J), y);
|
|
544
|
+
}
|
|
545
|
+
function Never(y) {
|
|
546
|
+
return CreateType({
|
|
547
|
+
[Kind]: "Never",
|
|
548
|
+
not: {}
|
|
549
|
+
}, y);
|
|
550
|
+
}
|
|
551
|
+
function MappedResult(y) {
|
|
552
|
+
return CreateType({
|
|
553
|
+
[Kind]: "MappedResult",
|
|
554
|
+
properties: y
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
function Constructor(y, J, Y) {
|
|
558
|
+
return CreateType({
|
|
559
|
+
[Kind]: "Constructor",
|
|
560
|
+
type: "Constructor",
|
|
561
|
+
parameters: y,
|
|
562
|
+
returns: J
|
|
563
|
+
}, Y);
|
|
564
|
+
}
|
|
565
|
+
function Function(y, J, Y) {
|
|
566
|
+
return CreateType({
|
|
567
|
+
[Kind]: "Function",
|
|
568
|
+
type: "Function",
|
|
569
|
+
parameters: y,
|
|
570
|
+
returns: J
|
|
571
|
+
}, Y);
|
|
572
|
+
}
|
|
573
|
+
function UnionCreate(y, J) {
|
|
574
|
+
return CreateType({
|
|
575
|
+
[Kind]: "Union",
|
|
576
|
+
anyOf: y
|
|
577
|
+
}, J);
|
|
578
|
+
}
|
|
579
|
+
function IsUnionOptional(y) {
|
|
580
|
+
return y.some((y) => IsOptional(y));
|
|
581
|
+
}
|
|
582
|
+
function RemoveOptionalFromRest$1(y) {
|
|
583
|
+
return y.map((y) => IsOptional(y) ? RemoveOptionalFromType$1(y) : y);
|
|
584
|
+
}
|
|
585
|
+
function RemoveOptionalFromType$1(y) {
|
|
586
|
+
return Discard(y, [OptionalKind]);
|
|
587
|
+
}
|
|
588
|
+
function ResolveUnion(y, J) {
|
|
589
|
+
return IsUnionOptional(y) ? Optional(UnionCreate(RemoveOptionalFromRest$1(y), J)) : UnionCreate(RemoveOptionalFromRest$1(y), J);
|
|
590
|
+
}
|
|
591
|
+
function UnionEvaluated(y, J) {
|
|
592
|
+
return y.length === 1 ? CreateType(y[0], J) : y.length === 0 ? Never(J) : ResolveUnion(y, J);
|
|
593
|
+
}
|
|
594
|
+
function Union(y, J) {
|
|
595
|
+
return y.length === 0 ? Never(J) : y.length === 1 ? CreateType(y[0], J) : UnionCreate(y, J);
|
|
596
|
+
}
|
|
597
|
+
var TemplateLiteralParserError = class extends TypeBoxError {};
|
|
598
|
+
function Unescape(y) {
|
|
599
|
+
return y.replace(/\\\$/g, "$").replace(/\\\*/g, "*").replace(/\\\^/g, "^").replace(/\\\|/g, "|").replace(/\\\(/g, "(").replace(/\\\)/g, ")");
|
|
600
|
+
}
|
|
601
|
+
function IsNonEscaped(y, J, Y) {
|
|
602
|
+
return y[J] === Y && y.charCodeAt(J - 1) !== 92;
|
|
603
|
+
}
|
|
604
|
+
function IsOpenParen(y, J) {
|
|
605
|
+
return IsNonEscaped(y, J, "(");
|
|
606
|
+
}
|
|
607
|
+
function IsCloseParen(y, J) {
|
|
608
|
+
return IsNonEscaped(y, J, ")");
|
|
609
|
+
}
|
|
610
|
+
function IsSeparator(y, J) {
|
|
611
|
+
return IsNonEscaped(y, J, "|");
|
|
612
|
+
}
|
|
613
|
+
function IsGroup(y) {
|
|
614
|
+
if (!(IsOpenParen(y, 0) && IsCloseParen(y, y.length - 1))) return !1;
|
|
615
|
+
let J = 0;
|
|
616
|
+
for (let Y = 0; Y < y.length; Y++) if (IsOpenParen(y, Y) && (J += 1), IsCloseParen(y, Y) && --J, J === 0 && Y !== y.length - 1) return !1;
|
|
617
|
+
return !0;
|
|
618
|
+
}
|
|
619
|
+
function InGroup(y) {
|
|
620
|
+
return y.slice(1, y.length - 1);
|
|
621
|
+
}
|
|
622
|
+
function IsPrecedenceOr(y) {
|
|
623
|
+
let J = 0;
|
|
624
|
+
for (let Y = 0; Y < y.length; Y++) if (IsOpenParen(y, Y) && (J += 1), IsCloseParen(y, Y) && --J, IsSeparator(y, Y) && J === 0) return !0;
|
|
625
|
+
return !1;
|
|
626
|
+
}
|
|
627
|
+
function IsPrecedenceAnd(y) {
|
|
628
|
+
for (let J = 0; J < y.length; J++) if (IsOpenParen(y, J)) return !0;
|
|
629
|
+
return !1;
|
|
630
|
+
}
|
|
631
|
+
function Or(y) {
|
|
632
|
+
let [J, Y] = [0, 0], X = [];
|
|
633
|
+
for (let Z = 0; Z < y.length; Z++) if (IsOpenParen(y, Z) && (J += 1), IsCloseParen(y, Z) && --J, IsSeparator(y, Z) && J === 0) {
|
|
634
|
+
let J = y.slice(Y, Z);
|
|
635
|
+
J.length > 0 && X.push(TemplateLiteralParse(J)), Y = Z + 1;
|
|
636
|
+
}
|
|
637
|
+
let Z = y.slice(Y);
|
|
638
|
+
return Z.length > 0 && X.push(TemplateLiteralParse(Z)), X.length === 0 ? {
|
|
639
|
+
type: "const",
|
|
640
|
+
const: ""
|
|
641
|
+
} : X.length === 1 ? X[0] : {
|
|
642
|
+
type: "or",
|
|
643
|
+
expr: X
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
function And(y) {
|
|
647
|
+
function J(y, J) {
|
|
648
|
+
if (!IsOpenParen(y, J)) throw new TemplateLiteralParserError("TemplateLiteralParser: Index must point to open parens");
|
|
649
|
+
let Y = 0;
|
|
650
|
+
for (let X = J; X < y.length; X++) if (IsOpenParen(y, X) && (Y += 1), IsCloseParen(y, X) && --Y, Y === 0) return [J, X];
|
|
651
|
+
throw new TemplateLiteralParserError("TemplateLiteralParser: Unclosed group parens in expression");
|
|
652
|
+
}
|
|
653
|
+
function Y(y, J) {
|
|
654
|
+
for (let Y = J; Y < y.length; Y++) if (IsOpenParen(y, Y)) return [J, Y];
|
|
655
|
+
return [J, y.length];
|
|
656
|
+
}
|
|
657
|
+
let X = [];
|
|
658
|
+
for (let Z = 0; Z < y.length; Z++) if (IsOpenParen(y, Z)) {
|
|
659
|
+
let [Y, Q] = J(y, Z), $ = y.slice(Y, Q + 1);
|
|
660
|
+
X.push(TemplateLiteralParse($)), Z = Q;
|
|
661
|
+
} else {
|
|
662
|
+
let [J, Q] = Y(y, Z), $ = y.slice(J, Q);
|
|
663
|
+
$.length > 0 && X.push(TemplateLiteralParse($)), Z = Q - 1;
|
|
664
|
+
}
|
|
665
|
+
return X.length === 0 ? {
|
|
666
|
+
type: "const",
|
|
667
|
+
const: ""
|
|
668
|
+
} : X.length === 1 ? X[0] : {
|
|
669
|
+
type: "and",
|
|
670
|
+
expr: X
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
function TemplateLiteralParse(y) {
|
|
674
|
+
return IsGroup(y) ? TemplateLiteralParse(InGroup(y)) : IsPrecedenceOr(y) ? Or(y) : IsPrecedenceAnd(y) ? And(y) : {
|
|
675
|
+
type: "const",
|
|
676
|
+
const: Unescape(y)
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
function TemplateLiteralParseExact(y) {
|
|
680
|
+
return TemplateLiteralParse(y.slice(1, y.length - 1));
|
|
681
|
+
}
|
|
682
|
+
var TemplateLiteralFiniteError = class extends TypeBoxError {};
|
|
683
|
+
function IsNumberExpression(y) {
|
|
684
|
+
return y.type === "or" && y.expr.length === 2 && y.expr[0].type === "const" && y.expr[0].const === "0" && y.expr[1].type === "const" && y.expr[1].const === "[1-9][0-9]*";
|
|
685
|
+
}
|
|
686
|
+
function IsBooleanExpression(y) {
|
|
687
|
+
return y.type === "or" && y.expr.length === 2 && y.expr[0].type === "const" && y.expr[0].const === "true" && y.expr[1].type === "const" && y.expr[1].const === "false";
|
|
688
|
+
}
|
|
689
|
+
function IsStringExpression(y) {
|
|
690
|
+
return y.type === "const" && y.const === ".*";
|
|
691
|
+
}
|
|
692
|
+
function IsTemplateLiteralExpressionFinite(y) {
|
|
693
|
+
return IsNumberExpression(y) || IsStringExpression(y) ? !1 : IsBooleanExpression(y) ? !0 : y.type === "and" || y.type === "or" ? y.expr.every((y) => IsTemplateLiteralExpressionFinite(y)) : y.type === "const" ? !0 : (() => {
|
|
694
|
+
throw new TemplateLiteralFiniteError("Unknown expression type");
|
|
695
|
+
})();
|
|
696
|
+
}
|
|
697
|
+
function IsTemplateLiteralFinite(y) {
|
|
698
|
+
return IsTemplateLiteralExpressionFinite(TemplateLiteralParseExact(y.pattern));
|
|
699
|
+
}
|
|
700
|
+
var TemplateLiteralGenerateError = class extends TypeBoxError {};
|
|
701
|
+
function* GenerateReduce(y) {
|
|
702
|
+
if (y.length === 1) return yield* y[0];
|
|
703
|
+
for (let J of y[0]) for (let Y of GenerateReduce(y.slice(1))) yield `${J}${Y}`;
|
|
704
|
+
}
|
|
705
|
+
function* GenerateAnd(y) {
|
|
706
|
+
return yield* GenerateReduce(y.expr.map((y) => [...TemplateLiteralExpressionGenerate(y)]));
|
|
707
|
+
}
|
|
708
|
+
function* GenerateOr(y) {
|
|
709
|
+
for (let J of y.expr) yield* TemplateLiteralExpressionGenerate(J);
|
|
710
|
+
}
|
|
711
|
+
function* GenerateConst(y) {
|
|
712
|
+
return yield y.const;
|
|
713
|
+
}
|
|
714
|
+
function* TemplateLiteralExpressionGenerate(y) {
|
|
715
|
+
return y.type === "and" ? yield* GenerateAnd(y) : y.type === "or" ? yield* GenerateOr(y) : y.type === "const" ? yield* GenerateConst(y) : (() => {
|
|
716
|
+
throw new TemplateLiteralGenerateError("Unknown expression");
|
|
717
|
+
})();
|
|
718
|
+
}
|
|
719
|
+
function TemplateLiteralGenerate(y) {
|
|
720
|
+
let J = TemplateLiteralParseExact(y.pattern);
|
|
721
|
+
return IsTemplateLiteralExpressionFinite(J) ? [...TemplateLiteralExpressionGenerate(J)] : [];
|
|
722
|
+
}
|
|
723
|
+
function Literal(y, J) {
|
|
724
|
+
return CreateType({
|
|
725
|
+
[Kind]: "Literal",
|
|
726
|
+
const: y,
|
|
727
|
+
type: typeof y
|
|
728
|
+
}, J);
|
|
729
|
+
}
|
|
730
|
+
function Boolean(y) {
|
|
731
|
+
return CreateType({
|
|
732
|
+
[Kind]: "Boolean",
|
|
733
|
+
type: "boolean"
|
|
734
|
+
}, y);
|
|
735
|
+
}
|
|
736
|
+
function BigInt(y) {
|
|
737
|
+
return CreateType({
|
|
738
|
+
[Kind]: "BigInt",
|
|
739
|
+
type: "bigint"
|
|
740
|
+
}, y);
|
|
741
|
+
}
|
|
742
|
+
function Number$1(y) {
|
|
743
|
+
return CreateType({
|
|
744
|
+
[Kind]: "Number",
|
|
745
|
+
type: "number"
|
|
746
|
+
}, y);
|
|
747
|
+
}
|
|
748
|
+
function String(y) {
|
|
749
|
+
return CreateType({
|
|
750
|
+
[Kind]: "String",
|
|
751
|
+
type: "string"
|
|
752
|
+
}, y);
|
|
753
|
+
}
|
|
754
|
+
function* FromUnion$9(y) {
|
|
755
|
+
let J = y.trim().replace(/"|'/g, "");
|
|
756
|
+
return J === "boolean" ? yield Boolean() : J === "number" ? yield Number$1() : J === "bigint" ? yield BigInt() : J === "string" ? yield String() : yield (() => {
|
|
757
|
+
let y = J.split("|").map((y) => Literal(y.trim()));
|
|
758
|
+
return y.length === 0 ? Never() : y.length === 1 ? y[0] : UnionEvaluated(y);
|
|
759
|
+
})();
|
|
760
|
+
}
|
|
761
|
+
function* FromTerminal(y) {
|
|
762
|
+
if (y[1] !== "{") return yield* [Literal("$"), ...FromSyntax(y.slice(1))];
|
|
763
|
+
for (let J = 2; J < y.length; J++) if (y[J] === "}") {
|
|
764
|
+
let Y = FromUnion$9(y.slice(2, J)), X = FromSyntax(y.slice(J + 1));
|
|
765
|
+
return yield* [...Y, ...X];
|
|
766
|
+
}
|
|
767
|
+
yield Literal(y);
|
|
768
|
+
}
|
|
769
|
+
function* FromSyntax(y) {
|
|
770
|
+
for (let J = 0; J < y.length; J++) if (y[J] === "$") return yield* [Literal(y.slice(0, J)), ...FromTerminal(y.slice(J))];
|
|
771
|
+
yield Literal(y);
|
|
772
|
+
}
|
|
773
|
+
function TemplateLiteralSyntax(y) {
|
|
774
|
+
return [...FromSyntax(y)];
|
|
775
|
+
}
|
|
776
|
+
var TemplateLiteralPatternError = class extends TypeBoxError {};
|
|
777
|
+
function Escape(y) {
|
|
778
|
+
return y.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
779
|
+
}
|
|
780
|
+
function Visit$1(y, J) {
|
|
781
|
+
return IsTemplateLiteral(y) ? y.pattern.slice(1, y.pattern.length - 1) : IsUnion(y) ? `(${y.anyOf.map((y) => Visit$1(y, J)).join("|")})` : IsNumber(y) || IsInteger(y) || IsBigInt$1(y) ? `${J}${PatternNumber}` : IsString$1(y) ? `${J}${PatternString}` : IsLiteral(y) ? `${J}${Escape(y.const.toString())}` : IsBoolean(y) ? `${J}${PatternBoolean}` : (() => {
|
|
782
|
+
throw new TemplateLiteralPatternError(`Unexpected Kind '${y[Kind]}'`);
|
|
783
|
+
})();
|
|
784
|
+
}
|
|
785
|
+
function TemplateLiteralPattern(y) {
|
|
786
|
+
return `^${y.map((y) => Visit$1(y, "")).join("")}\$`;
|
|
787
|
+
}
|
|
788
|
+
function TemplateLiteralToUnion(y) {
|
|
789
|
+
return UnionEvaluated(TemplateLiteralGenerate(y).map((y) => Literal(y)));
|
|
790
|
+
}
|
|
791
|
+
function TemplateLiteral(y, J) {
|
|
792
|
+
let Y = IsString(y) ? TemplateLiteralPattern(TemplateLiteralSyntax(y)) : TemplateLiteralPattern(y);
|
|
793
|
+
return CreateType({
|
|
794
|
+
[Kind]: "TemplateLiteral",
|
|
795
|
+
type: "string",
|
|
796
|
+
pattern: Y
|
|
797
|
+
}, J);
|
|
798
|
+
}
|
|
799
|
+
function FromTemplateLiteral$2(y) {
|
|
800
|
+
return TemplateLiteralGenerate(y).map((y) => y.toString());
|
|
801
|
+
}
|
|
802
|
+
function FromUnion$8(y) {
|
|
803
|
+
let J = [];
|
|
804
|
+
for (let Y of y) J.push(...IndexPropertyKeys(Y));
|
|
805
|
+
return J;
|
|
806
|
+
}
|
|
807
|
+
function FromLiteral$1(y) {
|
|
808
|
+
return [y.toString()];
|
|
809
|
+
}
|
|
810
|
+
function IndexPropertyKeys(y) {
|
|
811
|
+
return [...new Set(IsTemplateLiteral(y) ? FromTemplateLiteral$2(y) : IsUnion(y) ? FromUnion$8(y.anyOf) : IsLiteral(y) ? FromLiteral$1(y.const) : IsNumber(y) || IsInteger(y) ? ["[number]"] : [])];
|
|
812
|
+
}
|
|
813
|
+
function FromProperties$18(y, J, Y) {
|
|
814
|
+
let X = {};
|
|
815
|
+
for (let Z of Object.getOwnPropertyNames(J)) X[Z] = Index(y, IndexPropertyKeys(J[Z]), Y);
|
|
816
|
+
return X;
|
|
817
|
+
}
|
|
818
|
+
function FromMappedResult$11(y, J, Y) {
|
|
819
|
+
return FromProperties$18(y, J.properties, Y);
|
|
820
|
+
}
|
|
821
|
+
function IndexFromMappedResult(y, J, Y) {
|
|
822
|
+
return MappedResult(FromMappedResult$11(y, J, Y));
|
|
823
|
+
}
|
|
824
|
+
function FromRest$6(y, J) {
|
|
825
|
+
return y.map((y) => IndexFromPropertyKey(y, J));
|
|
826
|
+
}
|
|
827
|
+
function FromIntersectRest(y) {
|
|
828
|
+
return y.filter((y) => !IsNever(y));
|
|
829
|
+
}
|
|
830
|
+
function FromIntersect$7(y, J) {
|
|
831
|
+
return IntersectEvaluated(FromIntersectRest(FromRest$6(y, J)));
|
|
832
|
+
}
|
|
833
|
+
function FromUnionRest(y) {
|
|
834
|
+
return y.some((y) => IsNever(y)) ? [] : y;
|
|
835
|
+
}
|
|
836
|
+
function FromUnion$7(y, J) {
|
|
837
|
+
return UnionEvaluated(FromUnionRest(FromRest$6(y, J)));
|
|
838
|
+
}
|
|
839
|
+
function FromTuple$4(y, J) {
|
|
840
|
+
return J in y ? y[J] : J === "[number]" ? UnionEvaluated(y) : Never();
|
|
841
|
+
}
|
|
842
|
+
function FromArray$5(y, J) {
|
|
843
|
+
return J === "[number]" ? y : Never();
|
|
844
|
+
}
|
|
845
|
+
function FromProperty$2(y, J) {
|
|
846
|
+
return J in y ? y[J] : Never();
|
|
847
|
+
}
|
|
848
|
+
function IndexFromPropertyKey(y, J) {
|
|
849
|
+
return IsIntersect(y) ? FromIntersect$7(y.allOf, J) : IsUnion(y) ? FromUnion$7(y.anyOf, J) : IsTuple(y) ? FromTuple$4(y.items ?? [], J) : IsArray$1(y) ? FromArray$5(y.items, J) : IsObject(y) ? FromProperty$2(y.properties, J) : Never();
|
|
850
|
+
}
|
|
851
|
+
function IndexFromPropertyKeys(y, J) {
|
|
852
|
+
return J.map((J) => IndexFromPropertyKey(y, J));
|
|
853
|
+
}
|
|
854
|
+
function FromSchema(y, J) {
|
|
855
|
+
return UnionEvaluated(IndexFromPropertyKeys(y, J));
|
|
856
|
+
}
|
|
857
|
+
function Index(y, J, Y) {
|
|
858
|
+
if (IsRef(y) || IsRef(J)) {
|
|
859
|
+
if (!IsSchema(y) || !IsSchema(J)) throw new TypeBoxError("Index types using Ref parameters require both Type and Key to be of TSchema");
|
|
860
|
+
return Computed("Index", [y, J]);
|
|
861
|
+
}
|
|
862
|
+
return IsMappedResult(J) ? IndexFromMappedResult(y, J, Y) : IsMappedKey(J) ? IndexFromMappedKey(y, J, Y) : CreateType(IsSchema(J) ? FromSchema(y, IndexPropertyKeys(J)) : FromSchema(y, J), Y);
|
|
863
|
+
}
|
|
864
|
+
function MappedIndexPropertyKey(y, J, Y) {
|
|
865
|
+
return { [J]: Index(y, [J], Clone(Y)) };
|
|
866
|
+
}
|
|
867
|
+
function MappedIndexPropertyKeys(y, J, Y) {
|
|
868
|
+
return J.reduce((J, X) => ({
|
|
869
|
+
...J,
|
|
870
|
+
...MappedIndexPropertyKey(y, X, Y)
|
|
871
|
+
}), {});
|
|
872
|
+
}
|
|
873
|
+
function MappedIndexProperties(y, J, Y) {
|
|
874
|
+
return MappedIndexPropertyKeys(y, J.keys, Y);
|
|
875
|
+
}
|
|
876
|
+
function IndexFromMappedKey(y, J, Y) {
|
|
877
|
+
return MappedResult(MappedIndexProperties(y, J, Y));
|
|
878
|
+
}
|
|
879
|
+
function Iterator(y, J) {
|
|
880
|
+
return CreateType({
|
|
881
|
+
[Kind]: "Iterator",
|
|
882
|
+
type: "Iterator",
|
|
883
|
+
items: y
|
|
884
|
+
}, J);
|
|
885
|
+
}
|
|
886
|
+
function RequiredArray(y) {
|
|
887
|
+
return globalThis.Object.keys(y).filter((J) => !IsOptional(y[J]));
|
|
888
|
+
}
|
|
889
|
+
function _Object(y, J) {
|
|
890
|
+
let Y = RequiredArray(y);
|
|
891
|
+
return CreateType(Y.length > 0 ? {
|
|
892
|
+
[Kind]: "Object",
|
|
893
|
+
type: "object",
|
|
894
|
+
required: Y,
|
|
895
|
+
properties: y
|
|
896
|
+
} : {
|
|
897
|
+
[Kind]: "Object",
|
|
898
|
+
type: "object",
|
|
899
|
+
properties: y
|
|
900
|
+
}, J);
|
|
901
|
+
}
|
|
902
|
+
var Object$1 = _Object;
|
|
903
|
+
function Promise$1(y, J) {
|
|
904
|
+
return CreateType({
|
|
905
|
+
[Kind]: "Promise",
|
|
906
|
+
type: "Promise",
|
|
907
|
+
item: y
|
|
908
|
+
}, J);
|
|
909
|
+
}
|
|
910
|
+
function RemoveReadonly(y) {
|
|
911
|
+
return CreateType(Discard(y, [ReadonlyKind]));
|
|
912
|
+
}
|
|
913
|
+
function AddReadonly(y) {
|
|
914
|
+
return CreateType({
|
|
915
|
+
...y,
|
|
916
|
+
[ReadonlyKind]: "Readonly"
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
function ReadonlyWithFlag(y, J) {
|
|
920
|
+
return J === !1 ? RemoveReadonly(y) : AddReadonly(y);
|
|
921
|
+
}
|
|
922
|
+
function Readonly(y, J) {
|
|
923
|
+
let Y = J ?? !0;
|
|
924
|
+
return IsMappedResult(y) ? ReadonlyFromMappedResult(y, Y) : ReadonlyWithFlag(y, Y);
|
|
925
|
+
}
|
|
926
|
+
function FromProperties$17(y, J) {
|
|
927
|
+
let Y = {};
|
|
928
|
+
for (let X of globalThis.Object.getOwnPropertyNames(y)) Y[X] = Readonly(y[X], J);
|
|
929
|
+
return Y;
|
|
930
|
+
}
|
|
931
|
+
function FromMappedResult$10(y, J) {
|
|
932
|
+
return FromProperties$17(y.properties, J);
|
|
933
|
+
}
|
|
934
|
+
function ReadonlyFromMappedResult(y, J) {
|
|
935
|
+
return MappedResult(FromMappedResult$10(y, J));
|
|
936
|
+
}
|
|
937
|
+
function Tuple(y, J) {
|
|
938
|
+
return CreateType(y.length > 0 ? {
|
|
939
|
+
[Kind]: "Tuple",
|
|
940
|
+
type: "array",
|
|
941
|
+
items: y,
|
|
942
|
+
additionalItems: !1,
|
|
943
|
+
minItems: y.length,
|
|
944
|
+
maxItems: y.length
|
|
945
|
+
} : {
|
|
946
|
+
[Kind]: "Tuple",
|
|
947
|
+
type: "array",
|
|
948
|
+
minItems: y.length,
|
|
949
|
+
maxItems: y.length
|
|
950
|
+
}, J);
|
|
951
|
+
}
|
|
952
|
+
function FromMappedResult$9(y, J) {
|
|
953
|
+
return y in J ? FromSchemaType(y, J[y]) : MappedResult(J);
|
|
954
|
+
}
|
|
955
|
+
function MappedKeyToKnownMappedResultProperties(y) {
|
|
956
|
+
return { [y]: Literal(y) };
|
|
957
|
+
}
|
|
958
|
+
function MappedKeyToUnknownMappedResultProperties(y) {
|
|
959
|
+
let J = {};
|
|
960
|
+
for (let Y of y) J[Y] = Literal(Y);
|
|
961
|
+
return J;
|
|
962
|
+
}
|
|
963
|
+
function MappedKeyToMappedResultProperties(y, J) {
|
|
964
|
+
return SetIncludes(J, y) ? MappedKeyToKnownMappedResultProperties(y) : MappedKeyToUnknownMappedResultProperties(J);
|
|
965
|
+
}
|
|
966
|
+
function FromMappedKey$3(y, J) {
|
|
967
|
+
return FromMappedResult$9(y, MappedKeyToMappedResultProperties(y, J));
|
|
968
|
+
}
|
|
969
|
+
function FromRest$5(y, J) {
|
|
970
|
+
return J.map((J) => FromSchemaType(y, J));
|
|
971
|
+
}
|
|
972
|
+
function FromProperties$16(y, J) {
|
|
973
|
+
let Y = {};
|
|
974
|
+
for (let X of globalThis.Object.getOwnPropertyNames(J)) Y[X] = FromSchemaType(y, J[X]);
|
|
975
|
+
return Y;
|
|
976
|
+
}
|
|
977
|
+
function FromSchemaType(y, J) {
|
|
978
|
+
let Y = { ...J };
|
|
979
|
+
return IsOptional(J) ? Optional(FromSchemaType(y, Discard(J, [OptionalKind]))) : IsReadonly(J) ? Readonly(FromSchemaType(y, Discard(J, [ReadonlyKind]))) : IsMappedResult(J) ? FromMappedResult$9(y, J.properties) : IsMappedKey(J) ? FromMappedKey$3(y, J.keys) : IsConstructor(J) ? Constructor(FromRest$5(y, J.parameters), FromSchemaType(y, J.returns), Y) : IsFunction$1(J) ? Function(FromRest$5(y, J.parameters), FromSchemaType(y, J.returns), Y) : IsAsyncIterator$1(J) ? AsyncIterator(FromSchemaType(y, J.items), Y) : IsIterator$1(J) ? Iterator(FromSchemaType(y, J.items), Y) : IsIntersect(J) ? Intersect(FromRest$5(y, J.allOf), Y) : IsUnion(J) ? Union(FromRest$5(y, J.anyOf), Y) : IsTuple(J) ? Tuple(FromRest$5(y, J.items ?? []), Y) : IsObject(J) ? Object$1(FromProperties$16(y, J.properties), Y) : IsArray$1(J) ? Array$1(FromSchemaType(y, J.items), Y) : IsPromise(J) ? Promise$1(FromSchemaType(y, J.item), Y) : J;
|
|
980
|
+
}
|
|
981
|
+
function MappedFunctionReturnType(y, J) {
|
|
982
|
+
let Y = {};
|
|
983
|
+
for (let X of y) Y[X] = FromSchemaType(X, J);
|
|
984
|
+
return Y;
|
|
985
|
+
}
|
|
986
|
+
function Mapped(y, J, Y) {
|
|
987
|
+
let X = IsSchema(y) ? IndexPropertyKeys(y) : y;
|
|
988
|
+
return Object$1(MappedFunctionReturnType(X, J({
|
|
989
|
+
[Kind]: "MappedKey",
|
|
990
|
+
keys: X
|
|
991
|
+
})), Y);
|
|
992
|
+
}
|
|
993
|
+
function RemoveOptional(y) {
|
|
994
|
+
return CreateType(Discard(y, [OptionalKind]));
|
|
995
|
+
}
|
|
996
|
+
function AddOptional(y) {
|
|
997
|
+
return CreateType({
|
|
998
|
+
...y,
|
|
999
|
+
[OptionalKind]: "Optional"
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
function OptionalWithFlag(y, J) {
|
|
1003
|
+
return J === !1 ? RemoveOptional(y) : AddOptional(y);
|
|
1004
|
+
}
|
|
1005
|
+
function Optional(y, J) {
|
|
1006
|
+
let Y = J ?? !0;
|
|
1007
|
+
return IsMappedResult(y) ? OptionalFromMappedResult(y, Y) : OptionalWithFlag(y, Y);
|
|
1008
|
+
}
|
|
1009
|
+
function FromProperties$15(y, J) {
|
|
1010
|
+
let Y = {};
|
|
1011
|
+
for (let X of globalThis.Object.getOwnPropertyNames(y)) Y[X] = Optional(y[X], J);
|
|
1012
|
+
return Y;
|
|
1013
|
+
}
|
|
1014
|
+
function FromMappedResult$8(y, J) {
|
|
1015
|
+
return FromProperties$15(y.properties, J);
|
|
1016
|
+
}
|
|
1017
|
+
function OptionalFromMappedResult(y, J) {
|
|
1018
|
+
return MappedResult(FromMappedResult$8(y, J));
|
|
1019
|
+
}
|
|
1020
|
+
function IntersectCreate(y, J = {}) {
|
|
1021
|
+
let Y = y.every((y) => IsObject(y)), X = IsSchema(J.unevaluatedProperties) ? { unevaluatedProperties: J.unevaluatedProperties } : {};
|
|
1022
|
+
return CreateType(J.unevaluatedProperties === !1 || IsSchema(J.unevaluatedProperties) || Y ? {
|
|
1023
|
+
...X,
|
|
1024
|
+
[Kind]: "Intersect",
|
|
1025
|
+
type: "object",
|
|
1026
|
+
allOf: y
|
|
1027
|
+
} : {
|
|
1028
|
+
...X,
|
|
1029
|
+
[Kind]: "Intersect",
|
|
1030
|
+
allOf: y
|
|
1031
|
+
}, J);
|
|
1032
|
+
}
|
|
1033
|
+
function IsIntersectOptional(y) {
|
|
1034
|
+
return y.every((y) => IsOptional(y));
|
|
1035
|
+
}
|
|
1036
|
+
function RemoveOptionalFromType(y) {
|
|
1037
|
+
return Discard(y, [OptionalKind]);
|
|
1038
|
+
}
|
|
1039
|
+
function RemoveOptionalFromRest(y) {
|
|
1040
|
+
return y.map((y) => IsOptional(y) ? RemoveOptionalFromType(y) : y);
|
|
1041
|
+
}
|
|
1042
|
+
function ResolveIntersect(y, J) {
|
|
1043
|
+
return IsIntersectOptional(y) ? Optional(IntersectCreate(RemoveOptionalFromRest(y), J)) : IntersectCreate(RemoveOptionalFromRest(y), J);
|
|
1044
|
+
}
|
|
1045
|
+
function IntersectEvaluated(y, J = {}) {
|
|
1046
|
+
if (y.length === 1) return CreateType(y[0], J);
|
|
1047
|
+
if (y.length === 0) return Never(J);
|
|
1048
|
+
if (y.some((y) => IsTransform(y))) throw Error("Cannot intersect transform types");
|
|
1049
|
+
return ResolveIntersect(y, J);
|
|
1050
|
+
}
|
|
1051
|
+
function Intersect(y, J) {
|
|
1052
|
+
if (y.length === 1) return CreateType(y[0], J);
|
|
1053
|
+
if (y.length === 0) return Never(J);
|
|
1054
|
+
if (y.some((y) => IsTransform(y))) throw Error("Cannot intersect transform types");
|
|
1055
|
+
return IntersectCreate(y, J);
|
|
1056
|
+
}
|
|
1057
|
+
function Ref(...y) {
|
|
1058
|
+
let [J, Y] = typeof y[0] == "string" ? [y[0], y[1]] : [y[0].$id, y[1]];
|
|
1059
|
+
if (typeof J != "string") throw new TypeBoxError("Ref: $ref must be a string");
|
|
1060
|
+
return CreateType({
|
|
1061
|
+
[Kind]: "Ref",
|
|
1062
|
+
$ref: J
|
|
1063
|
+
}, Y);
|
|
1064
|
+
}
|
|
1065
|
+
function FromComputed$4(y, J) {
|
|
1066
|
+
return Computed("Awaited", [Computed(y, J)]);
|
|
1067
|
+
}
|
|
1068
|
+
function FromRef$3(y) {
|
|
1069
|
+
return Computed("Awaited", [Ref(y)]);
|
|
1070
|
+
}
|
|
1071
|
+
function FromIntersect$6(y) {
|
|
1072
|
+
return Intersect(FromRest$4(y));
|
|
1073
|
+
}
|
|
1074
|
+
function FromUnion$6(y) {
|
|
1075
|
+
return Union(FromRest$4(y));
|
|
1076
|
+
}
|
|
1077
|
+
function FromPromise$2(y) {
|
|
1078
|
+
return Awaited(y);
|
|
1079
|
+
}
|
|
1080
|
+
function FromRest$4(y) {
|
|
1081
|
+
return y.map((y) => Awaited(y));
|
|
1082
|
+
}
|
|
1083
|
+
function Awaited(y, J) {
|
|
1084
|
+
return CreateType(IsComputed(y) ? FromComputed$4(y.target, y.parameters) : IsIntersect(y) ? FromIntersect$6(y.allOf) : IsUnion(y) ? FromUnion$6(y.anyOf) : IsPromise(y) ? FromPromise$2(y.item) : IsRef(y) ? FromRef$3(y.$ref) : y, J);
|
|
1085
|
+
}
|
|
1086
|
+
function FromRest$3(y) {
|
|
1087
|
+
let J = [];
|
|
1088
|
+
for (let Y of y) J.push(KeyOfPropertyKeys(Y));
|
|
1089
|
+
return J;
|
|
1090
|
+
}
|
|
1091
|
+
function FromIntersect$5(y) {
|
|
1092
|
+
return SetUnionMany(FromRest$3(y));
|
|
1093
|
+
}
|
|
1094
|
+
function FromUnion$5(y) {
|
|
1095
|
+
return SetIntersectMany(FromRest$3(y));
|
|
1096
|
+
}
|
|
1097
|
+
function FromTuple$3(y) {
|
|
1098
|
+
return y.map((y, J) => J.toString());
|
|
1099
|
+
}
|
|
1100
|
+
function FromArray$4(y) {
|
|
1101
|
+
return ["[number]"];
|
|
1102
|
+
}
|
|
1103
|
+
function FromProperties$14(y) {
|
|
1104
|
+
return globalThis.Object.getOwnPropertyNames(y);
|
|
1105
|
+
}
|
|
1106
|
+
function FromPatternProperties(y) {
|
|
1107
|
+
return includePatternProperties ? globalThis.Object.getOwnPropertyNames(y).map((y) => y[0] === "^" && y[y.length - 1] === "$" ? y.slice(1, y.length - 1) : y) : [];
|
|
1108
|
+
}
|
|
1109
|
+
function KeyOfPropertyKeys(y) {
|
|
1110
|
+
return IsIntersect(y) ? FromIntersect$5(y.allOf) : IsUnion(y) ? FromUnion$5(y.anyOf) : IsTuple(y) ? FromTuple$3(y.items ?? []) : IsArray$1(y) ? FromArray$4(y.items) : IsObject(y) ? FromProperties$14(y.properties) : IsRecord(y) ? FromPatternProperties(y.patternProperties) : [];
|
|
1111
|
+
}
|
|
1112
|
+
var includePatternProperties = !1;
|
|
1113
|
+
function FromComputed$3(y, J) {
|
|
1114
|
+
return Computed("KeyOf", [Computed(y, J)]);
|
|
1115
|
+
}
|
|
1116
|
+
function FromRef$2(y) {
|
|
1117
|
+
return Computed("KeyOf", [Ref(y)]);
|
|
1118
|
+
}
|
|
1119
|
+
function KeyOfFromType(y, J) {
|
|
1120
|
+
return CreateType(UnionEvaluated(KeyOfPropertyKeysToRest(KeyOfPropertyKeys(y))), J);
|
|
1121
|
+
}
|
|
1122
|
+
function KeyOfPropertyKeysToRest(y) {
|
|
1123
|
+
return y.map((y) => y === "[number]" ? Number$1() : Literal(y));
|
|
1124
|
+
}
|
|
1125
|
+
function KeyOf(y, J) {
|
|
1126
|
+
return IsComputed(y) ? FromComputed$3(y.target, y.parameters) : IsRef(y) ? FromRef$2(y.$ref) : IsMappedResult(y) ? KeyOfFromMappedResult(y, J) : KeyOfFromType(y, J);
|
|
1127
|
+
}
|
|
1128
|
+
function FromProperties$13(y, J) {
|
|
1129
|
+
let Y = {};
|
|
1130
|
+
for (let X of globalThis.Object.getOwnPropertyNames(y)) Y[X] = KeyOf(y[X], Clone(J));
|
|
1131
|
+
return Y;
|
|
1132
|
+
}
|
|
1133
|
+
function FromMappedResult$7(y, J) {
|
|
1134
|
+
return FromProperties$13(y.properties, J);
|
|
1135
|
+
}
|
|
1136
|
+
function KeyOfFromMappedResult(y, J) {
|
|
1137
|
+
return MappedResult(FromMappedResult$7(y, J));
|
|
1138
|
+
}
|
|
1139
|
+
function CompositeKeys(y) {
|
|
1140
|
+
let J = [];
|
|
1141
|
+
for (let Y of y) J.push(...KeyOfPropertyKeys(Y));
|
|
1142
|
+
return SetDistinct(J);
|
|
1143
|
+
}
|
|
1144
|
+
function FilterNever(y) {
|
|
1145
|
+
return y.filter((y) => !IsNever(y));
|
|
1146
|
+
}
|
|
1147
|
+
function CompositeProperty(y, J) {
|
|
1148
|
+
let Y = [];
|
|
1149
|
+
for (let X of y) Y.push(...IndexFromPropertyKeys(X, [J]));
|
|
1150
|
+
return FilterNever(Y);
|
|
1151
|
+
}
|
|
1152
|
+
function CompositeProperties(y, J) {
|
|
1153
|
+
let Y = {};
|
|
1154
|
+
for (let X of J) Y[X] = IntersectEvaluated(CompositeProperty(y, X));
|
|
1155
|
+
return Y;
|
|
1156
|
+
}
|
|
1157
|
+
function Composite(y, J) {
|
|
1158
|
+
return Object$1(CompositeProperties(y, CompositeKeys(y)), J);
|
|
1159
|
+
}
|
|
1160
|
+
function Date$1(y) {
|
|
1161
|
+
return CreateType({
|
|
1162
|
+
[Kind]: "Date",
|
|
1163
|
+
type: "Date"
|
|
1164
|
+
}, y);
|
|
1165
|
+
}
|
|
1166
|
+
function Null(y) {
|
|
1167
|
+
return CreateType({
|
|
1168
|
+
[Kind]: "Null",
|
|
1169
|
+
type: "null"
|
|
1170
|
+
}, y);
|
|
1171
|
+
}
|
|
1172
|
+
function Symbol$1(y) {
|
|
1173
|
+
return CreateType({
|
|
1174
|
+
[Kind]: "Symbol",
|
|
1175
|
+
type: "symbol"
|
|
1176
|
+
}, y);
|
|
1177
|
+
}
|
|
1178
|
+
function Undefined(y) {
|
|
1179
|
+
return CreateType({
|
|
1180
|
+
[Kind]: "Undefined",
|
|
1181
|
+
type: "undefined"
|
|
1182
|
+
}, y);
|
|
1183
|
+
}
|
|
1184
|
+
function Uint8Array$1(y) {
|
|
1185
|
+
return CreateType({
|
|
1186
|
+
[Kind]: "Uint8Array",
|
|
1187
|
+
type: "Uint8Array"
|
|
1188
|
+
}, y);
|
|
1189
|
+
}
|
|
1190
|
+
function Unknown(y) {
|
|
1191
|
+
return CreateType({ [Kind]: "Unknown" }, y);
|
|
1192
|
+
}
|
|
1193
|
+
function FromArray$3(y) {
|
|
1194
|
+
return y.map((y) => FromValue(y, !1));
|
|
1195
|
+
}
|
|
1196
|
+
function FromProperties$12(y) {
|
|
1197
|
+
let J = {};
|
|
1198
|
+
for (let Y of globalThis.Object.getOwnPropertyNames(y)) J[Y] = Readonly(FromValue(y[Y], !1));
|
|
1199
|
+
return J;
|
|
1200
|
+
}
|
|
1201
|
+
function ConditionalReadonly(y, J) {
|
|
1202
|
+
return J === !0 ? y : Readonly(y);
|
|
1203
|
+
}
|
|
1204
|
+
function FromValue(y, J) {
|
|
1205
|
+
return IsAsyncIterator(y) || IsIterator(y) ? ConditionalReadonly(Any(), J) : IsArray(y) ? Readonly(Tuple(FromArray$3(y))) : IsUint8Array(y) ? Uint8Array$1() : IsDate(y) ? Date$1() : IsObject$1(y) ? ConditionalReadonly(Object$1(FromProperties$12(y)), J) : IsFunction(y) ? ConditionalReadonly(Function([], Unknown()), J) : IsUndefined(y) ? Undefined() : IsNull(y) ? Null() : IsSymbol(y) ? Symbol$1() : IsBigInt(y) ? BigInt() : IsNumber$1(y) || IsBoolean$1(y) || IsString(y) ? Literal(y) : Object$1({});
|
|
1206
|
+
}
|
|
1207
|
+
function Const(y, J) {
|
|
1208
|
+
return CreateType(FromValue(y, !0), J);
|
|
1209
|
+
}
|
|
1210
|
+
function ConstructorParameters(y, J) {
|
|
1211
|
+
return IsConstructor(y) ? Tuple(y.parameters, J) : Never(J);
|
|
1212
|
+
}
|
|
1213
|
+
function Enum(y, J) {
|
|
1214
|
+
if (IsUndefined(y)) throw Error("Enum undefined or empty");
|
|
1215
|
+
let Y = globalThis.Object.getOwnPropertyNames(y).filter((y) => isNaN(y)).map((J) => y[J]);
|
|
1216
|
+
return Union([...new Set(Y)].map((y) => Literal(y)), {
|
|
1217
|
+
...J,
|
|
1218
|
+
[Hint]: "Enum"
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
var ExtendsResolverError = class extends TypeBoxError {}, ExtendsResult;
|
|
1222
|
+
(function(y) {
|
|
1223
|
+
y[y.Union = 0] = "Union", y[y.True = 1] = "True", y[y.False = 2] = "False";
|
|
1224
|
+
})(ExtendsResult ||= {});
|
|
1225
|
+
function IntoBooleanResult(y) {
|
|
1226
|
+
return y === ExtendsResult.False ? y : ExtendsResult.True;
|
|
1227
|
+
}
|
|
1228
|
+
function Throw(y) {
|
|
1229
|
+
throw new ExtendsResolverError(y);
|
|
1230
|
+
}
|
|
1231
|
+
function IsStructuralRight(y) {
|
|
1232
|
+
return IsNever$1(y) || IsIntersect$1(y) || IsUnion$1(y) || IsUnknown(y) || IsAny$1(y);
|
|
1233
|
+
}
|
|
1234
|
+
function StructuralRight(y, J) {
|
|
1235
|
+
return IsNever$1(J) ? FromNeverRight(y, J) : IsIntersect$1(J) ? FromIntersectRight(y, J) : IsUnion$1(J) ? FromUnionRight(y, J) : IsUnknown(J) ? FromUnknownRight(y, J) : IsAny$1(J) ? FromAnyRight(y, J) : Throw("StructuralRight");
|
|
1236
|
+
}
|
|
1237
|
+
function FromAnyRight(y, J) {
|
|
1238
|
+
return ExtendsResult.True;
|
|
1239
|
+
}
|
|
1240
|
+
function FromAny(y, J) {
|
|
1241
|
+
return IsIntersect$1(J) ? FromIntersectRight(y, J) : IsUnion$1(J) && J.anyOf.some((y) => IsAny$1(y) || IsUnknown(y)) ? ExtendsResult.True : IsUnion$1(J) ? ExtendsResult.Union : IsUnknown(J) || IsAny$1(J) ? ExtendsResult.True : ExtendsResult.Union;
|
|
1242
|
+
}
|
|
1243
|
+
function FromArrayRight(y, J) {
|
|
1244
|
+
return IsUnknown(y) ? ExtendsResult.False : IsAny$1(y) ? ExtendsResult.Union : IsNever$1(y) ? ExtendsResult.True : ExtendsResult.False;
|
|
1245
|
+
}
|
|
1246
|
+
function FromArray$2(y, J) {
|
|
1247
|
+
return IsObject$2(J) && IsObjectArrayLike(J) ? ExtendsResult.True : IsStructuralRight(J) ? StructuralRight(y, J) : IsArray$2(J) ? IntoBooleanResult(Visit(y.items, J.items)) : ExtendsResult.False;
|
|
1248
|
+
}
|
|
1249
|
+
function FromAsyncIterator$2(y, J) {
|
|
1250
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsAsyncIterator$2(J) ? IntoBooleanResult(Visit(y.items, J.items)) : ExtendsResult.False;
|
|
1251
|
+
}
|
|
1252
|
+
function FromBigInt(y, J) {
|
|
1253
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsRecord$1(J) ? FromRecordRight(y, J) : IsBigInt$2(J) ? ExtendsResult.True : ExtendsResult.False;
|
|
1254
|
+
}
|
|
1255
|
+
function FromBooleanRight(y, J) {
|
|
1256
|
+
return IsLiteralBoolean(y) || IsBoolean$2(y) ? ExtendsResult.True : ExtendsResult.False;
|
|
1257
|
+
}
|
|
1258
|
+
function FromBoolean(y, J) {
|
|
1259
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsRecord$1(J) ? FromRecordRight(y, J) : IsBoolean$2(J) ? ExtendsResult.True : ExtendsResult.False;
|
|
1260
|
+
}
|
|
1261
|
+
function FromConstructor$2(y, J) {
|
|
1262
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsConstructor$1(J) ? y.parameters.length > J.parameters.length ? ExtendsResult.False : y.parameters.every((y, Y) => IntoBooleanResult(Visit(J.parameters[Y], y)) === ExtendsResult.True) ? IntoBooleanResult(Visit(y.returns, J.returns)) : ExtendsResult.False : ExtendsResult.False;
|
|
1263
|
+
}
|
|
1264
|
+
function FromDate(y, J) {
|
|
1265
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsRecord$1(J) ? FromRecordRight(y, J) : IsDate$1(J) ? ExtendsResult.True : ExtendsResult.False;
|
|
1266
|
+
}
|
|
1267
|
+
function FromFunction$2(y, J) {
|
|
1268
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsFunction$2(J) ? y.parameters.length > J.parameters.length ? ExtendsResult.False : y.parameters.every((y, Y) => IntoBooleanResult(Visit(J.parameters[Y], y)) === ExtendsResult.True) ? IntoBooleanResult(Visit(y.returns, J.returns)) : ExtendsResult.False : ExtendsResult.False;
|
|
1269
|
+
}
|
|
1270
|
+
function FromIntegerRight(y, J) {
|
|
1271
|
+
return IsLiteral$1(y) && IsNumber$1(y.const) || IsNumber$2(y) || IsInteger$1(y) ? ExtendsResult.True : ExtendsResult.False;
|
|
1272
|
+
}
|
|
1273
|
+
function FromInteger(y, J) {
|
|
1274
|
+
return IsInteger$1(J) || IsNumber$2(J) ? ExtendsResult.True : IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsRecord$1(J) ? FromRecordRight(y, J) : ExtendsResult.False;
|
|
1275
|
+
}
|
|
1276
|
+
function FromIntersectRight(y, J) {
|
|
1277
|
+
return J.allOf.every((J) => Visit(y, J) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
1278
|
+
}
|
|
1279
|
+
function FromIntersect$4(y, J) {
|
|
1280
|
+
return y.allOf.some((y) => Visit(y, J) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
1281
|
+
}
|
|
1282
|
+
function FromIterator$2(y, J) {
|
|
1283
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsIterator$2(J) ? IntoBooleanResult(Visit(y.items, J.items)) : ExtendsResult.False;
|
|
1284
|
+
}
|
|
1285
|
+
function FromLiteral(y, J) {
|
|
1286
|
+
return IsLiteral$1(J) && J.const === y.const ? ExtendsResult.True : IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsRecord$1(J) ? FromRecordRight(y, J) : IsString$2(J) ? FromStringRight(y, J) : IsNumber$2(J) ? FromNumberRight(y, J) : IsInteger$1(J) ? FromIntegerRight(y, J) : IsBoolean$2(J) ? FromBooleanRight(y, J) : ExtendsResult.False;
|
|
1287
|
+
}
|
|
1288
|
+
function FromNeverRight(y, J) {
|
|
1289
|
+
return ExtendsResult.False;
|
|
1290
|
+
}
|
|
1291
|
+
function FromNever(y, J) {
|
|
1292
|
+
return ExtendsResult.True;
|
|
1293
|
+
}
|
|
1294
|
+
function UnwrapTNot(y) {
|
|
1295
|
+
let [J, Y] = [y, 0];
|
|
1296
|
+
for (; IsNot(J);) J = J.not, Y += 1;
|
|
1297
|
+
return Y % 2 == 0 ? J : Unknown();
|
|
1298
|
+
}
|
|
1299
|
+
function FromNot(y, J) {
|
|
1300
|
+
return IsNot(y) ? Visit(UnwrapTNot(y), J) : IsNot(J) ? Visit(y, UnwrapTNot(J)) : Throw("Invalid fallthrough for Not");
|
|
1301
|
+
}
|
|
1302
|
+
function FromNull(y, J) {
|
|
1303
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsRecord$1(J) ? FromRecordRight(y, J) : IsNull$1(J) ? ExtendsResult.True : ExtendsResult.False;
|
|
1304
|
+
}
|
|
1305
|
+
function FromNumberRight(y, J) {
|
|
1306
|
+
return IsLiteralNumber(y) || IsNumber$2(y) || IsInteger$1(y) ? ExtendsResult.True : ExtendsResult.False;
|
|
1307
|
+
}
|
|
1308
|
+
function FromNumber(y, J) {
|
|
1309
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsRecord$1(J) ? FromRecordRight(y, J) : IsInteger$1(J) || IsNumber$2(J) ? ExtendsResult.True : ExtendsResult.False;
|
|
1310
|
+
}
|
|
1311
|
+
function IsObjectPropertyCount(y, J) {
|
|
1312
|
+
return Object.getOwnPropertyNames(y.properties).length === J;
|
|
1313
|
+
}
|
|
1314
|
+
function IsObjectStringLike(y) {
|
|
1315
|
+
return IsObjectArrayLike(y);
|
|
1316
|
+
}
|
|
1317
|
+
function IsObjectSymbolLike(y) {
|
|
1318
|
+
return IsObjectPropertyCount(y, 0) || IsObjectPropertyCount(y, 1) && "description" in y.properties && IsUnion$1(y.properties.description) && y.properties.description.anyOf.length === 2 && (IsString$2(y.properties.description.anyOf[0]) && IsUndefined$1(y.properties.description.anyOf[1]) || IsString$2(y.properties.description.anyOf[1]) && IsUndefined$1(y.properties.description.anyOf[0]));
|
|
1319
|
+
}
|
|
1320
|
+
function IsObjectNumberLike(y) {
|
|
1321
|
+
return IsObjectPropertyCount(y, 0);
|
|
1322
|
+
}
|
|
1323
|
+
function IsObjectBooleanLike(y) {
|
|
1324
|
+
return IsObjectPropertyCount(y, 0);
|
|
1325
|
+
}
|
|
1326
|
+
function IsObjectBigIntLike(y) {
|
|
1327
|
+
return IsObjectPropertyCount(y, 0);
|
|
1328
|
+
}
|
|
1329
|
+
function IsObjectDateLike(y) {
|
|
1330
|
+
return IsObjectPropertyCount(y, 0);
|
|
1331
|
+
}
|
|
1332
|
+
function IsObjectUint8ArrayLike(y) {
|
|
1333
|
+
return IsObjectArrayLike(y);
|
|
1334
|
+
}
|
|
1335
|
+
function IsObjectFunctionLike(y) {
|
|
1336
|
+
let J = Number$1();
|
|
1337
|
+
return IsObjectPropertyCount(y, 0) || IsObjectPropertyCount(y, 1) && "length" in y.properties && IntoBooleanResult(Visit(y.properties.length, J)) === ExtendsResult.True;
|
|
1338
|
+
}
|
|
1339
|
+
function IsObjectConstructorLike(y) {
|
|
1340
|
+
return IsObjectPropertyCount(y, 0);
|
|
1341
|
+
}
|
|
1342
|
+
function IsObjectArrayLike(y) {
|
|
1343
|
+
let J = Number$1();
|
|
1344
|
+
return IsObjectPropertyCount(y, 0) || IsObjectPropertyCount(y, 1) && "length" in y.properties && IntoBooleanResult(Visit(y.properties.length, J)) === ExtendsResult.True;
|
|
1345
|
+
}
|
|
1346
|
+
function IsObjectPromiseLike(y) {
|
|
1347
|
+
let J = Function([Any()], Any());
|
|
1348
|
+
return IsObjectPropertyCount(y, 0) || IsObjectPropertyCount(y, 1) && "then" in y.properties && IntoBooleanResult(Visit(y.properties.then, J)) === ExtendsResult.True;
|
|
1349
|
+
}
|
|
1350
|
+
function Property(y, J) {
|
|
1351
|
+
return Visit(y, J) === ExtendsResult.False || IsOptional$1(y) && !IsOptional$1(J) ? ExtendsResult.False : ExtendsResult.True;
|
|
1352
|
+
}
|
|
1353
|
+
function FromObjectRight(y, J) {
|
|
1354
|
+
return IsUnknown(y) ? ExtendsResult.False : IsAny$1(y) ? ExtendsResult.Union : IsNever$1(y) || IsLiteralString(y) && IsObjectStringLike(J) || IsLiteralNumber(y) && IsObjectNumberLike(J) || IsLiteralBoolean(y) && IsObjectBooleanLike(J) || IsSymbol$1(y) && IsObjectSymbolLike(J) || IsBigInt$2(y) && IsObjectBigIntLike(J) || IsString$2(y) && IsObjectStringLike(J) || IsSymbol$1(y) && IsObjectSymbolLike(J) || IsNumber$2(y) && IsObjectNumberLike(J) || IsInteger$1(y) && IsObjectNumberLike(J) || IsBoolean$2(y) && IsObjectBooleanLike(J) || IsUint8Array$1(y) && IsObjectUint8ArrayLike(J) || IsDate$1(y) && IsObjectDateLike(J) || IsConstructor$1(y) && IsObjectConstructorLike(J) || IsFunction$2(y) && IsObjectFunctionLike(J) ? ExtendsResult.True : IsRecord$1(y) && IsString$2(RecordKey$1(y)) ? (() => J[Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False)() : IsRecord$1(y) && IsNumber$2(RecordKey$1(y)) ? (() => IsObjectPropertyCount(J, 0) ? ExtendsResult.True : ExtendsResult.False)() : ExtendsResult.False;
|
|
1355
|
+
}
|
|
1356
|
+
function FromObject$6(y, J) {
|
|
1357
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsRecord$1(J) ? FromRecordRight(y, J) : IsObject$2(J) ? (() => {
|
|
1358
|
+
for (let Y of Object.getOwnPropertyNames(J.properties)) {
|
|
1359
|
+
if (!(Y in y.properties) && !IsOptional$1(J.properties[Y])) return ExtendsResult.False;
|
|
1360
|
+
if (IsOptional$1(J.properties[Y])) return ExtendsResult.True;
|
|
1361
|
+
if (Property(y.properties[Y], J.properties[Y]) === ExtendsResult.False) return ExtendsResult.False;
|
|
1362
|
+
}
|
|
1363
|
+
return ExtendsResult.True;
|
|
1364
|
+
})() : ExtendsResult.False;
|
|
1365
|
+
}
|
|
1366
|
+
function FromPromise$1(y, J) {
|
|
1367
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) && IsObjectPromiseLike(J) ? ExtendsResult.True : IsPromise$1(J) ? IntoBooleanResult(Visit(y.item, J.item)) : ExtendsResult.False;
|
|
1368
|
+
}
|
|
1369
|
+
function RecordKey$1(y) {
|
|
1370
|
+
return PatternNumberExact in y.patternProperties ? Number$1() : PatternStringExact in y.patternProperties ? String() : Throw("Unknown record key pattern");
|
|
1371
|
+
}
|
|
1372
|
+
function RecordValue$1(y) {
|
|
1373
|
+
return PatternNumberExact in y.patternProperties ? y.patternProperties[PatternNumberExact] : PatternStringExact in y.patternProperties ? y.patternProperties[PatternStringExact] : Throw("Unable to get record value schema");
|
|
1374
|
+
}
|
|
1375
|
+
function FromRecordRight(y, J) {
|
|
1376
|
+
let [Y, X] = [RecordKey$1(J), RecordValue$1(J)];
|
|
1377
|
+
return IsLiteralString(y) && IsNumber$2(Y) && IntoBooleanResult(Visit(y, X)) === ExtendsResult.True ? ExtendsResult.True : IsUint8Array$1(y) && IsNumber$2(Y) || IsString$2(y) && IsNumber$2(Y) || IsArray$2(y) && IsNumber$2(Y) ? Visit(y, X) : IsObject$2(y) ? (() => {
|
|
1378
|
+
for (let J of Object.getOwnPropertyNames(y.properties)) if (Property(X, y.properties[J]) === ExtendsResult.False) return ExtendsResult.False;
|
|
1379
|
+
return ExtendsResult.True;
|
|
1380
|
+
})() : ExtendsResult.False;
|
|
1381
|
+
}
|
|
1382
|
+
function FromRecord$2(y, J) {
|
|
1383
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsRecord$1(J) ? Visit(RecordValue$1(y), RecordValue$1(J)) : ExtendsResult.False;
|
|
1384
|
+
}
|
|
1385
|
+
function FromRegExp(y, J) {
|
|
1386
|
+
return Visit(IsRegExp$1(y) ? String() : y, IsRegExp$1(J) ? String() : J);
|
|
1387
|
+
}
|
|
1388
|
+
function FromStringRight(y, J) {
|
|
1389
|
+
return IsLiteral$1(y) && IsString(y.const) || IsString$2(y) ? ExtendsResult.True : ExtendsResult.False;
|
|
1390
|
+
}
|
|
1391
|
+
function FromString(y, J) {
|
|
1392
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsRecord$1(J) ? FromRecordRight(y, J) : IsString$2(J) ? ExtendsResult.True : ExtendsResult.False;
|
|
1393
|
+
}
|
|
1394
|
+
function FromSymbol(y, J) {
|
|
1395
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsRecord$1(J) ? FromRecordRight(y, J) : IsSymbol$1(J) ? ExtendsResult.True : ExtendsResult.False;
|
|
1396
|
+
}
|
|
1397
|
+
function FromTemplateLiteral$1(y, J) {
|
|
1398
|
+
return IsTemplateLiteral$1(y) ? Visit(TemplateLiteralToUnion(y), J) : IsTemplateLiteral$1(J) ? Visit(y, TemplateLiteralToUnion(J)) : Throw("Invalid fallthrough for TemplateLiteral");
|
|
1399
|
+
}
|
|
1400
|
+
function IsArrayOfTuple(y, J) {
|
|
1401
|
+
return IsArray$2(J) && y.items !== void 0 && y.items.every((y) => Visit(y, J.items) === ExtendsResult.True);
|
|
1402
|
+
}
|
|
1403
|
+
function FromTupleRight(y, J) {
|
|
1404
|
+
return IsNever$1(y) ? ExtendsResult.True : IsUnknown(y) ? ExtendsResult.False : IsAny$1(y) ? ExtendsResult.Union : ExtendsResult.False;
|
|
1405
|
+
}
|
|
1406
|
+
function FromTuple$2(y, J) {
|
|
1407
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) && IsObjectArrayLike(J) || IsArray$2(J) && IsArrayOfTuple(y, J) ? ExtendsResult.True : IsTuple$1(J) ? IsUndefined(y.items) && !IsUndefined(J.items) || !IsUndefined(y.items) && IsUndefined(J.items) ? ExtendsResult.False : IsUndefined(y.items) && !IsUndefined(J.items) || y.items.every((y, Y) => Visit(y, J.items[Y]) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False : ExtendsResult.False;
|
|
1408
|
+
}
|
|
1409
|
+
function FromUint8Array(y, J) {
|
|
1410
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsRecord$1(J) ? FromRecordRight(y, J) : IsUint8Array$1(J) ? ExtendsResult.True : ExtendsResult.False;
|
|
1411
|
+
}
|
|
1412
|
+
function FromUndefined(y, J) {
|
|
1413
|
+
return IsStructuralRight(J) ? StructuralRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsRecord$1(J) ? FromRecordRight(y, J) : IsVoid(J) ? FromVoidRight(y, J) : IsUndefined$1(J) ? ExtendsResult.True : ExtendsResult.False;
|
|
1414
|
+
}
|
|
1415
|
+
function FromUnionRight(y, J) {
|
|
1416
|
+
return J.anyOf.some((J) => Visit(y, J) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
1417
|
+
}
|
|
1418
|
+
function FromUnion$4(y, J) {
|
|
1419
|
+
return y.anyOf.every((y) => Visit(y, J) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
1420
|
+
}
|
|
1421
|
+
function FromUnknownRight(y, J) {
|
|
1422
|
+
return ExtendsResult.True;
|
|
1423
|
+
}
|
|
1424
|
+
function FromUnknown(y, J) {
|
|
1425
|
+
return IsNever$1(J) ? FromNeverRight(y, J) : IsIntersect$1(J) ? FromIntersectRight(y, J) : IsUnion$1(J) ? FromUnionRight(y, J) : IsAny$1(J) ? FromAnyRight(y, J) : IsString$2(J) ? FromStringRight(y, J) : IsNumber$2(J) ? FromNumberRight(y, J) : IsInteger$1(J) ? FromIntegerRight(y, J) : IsBoolean$2(J) ? FromBooleanRight(y, J) : IsArray$2(J) ? FromArrayRight(y, J) : IsTuple$1(J) ? FromTupleRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsUnknown(J) ? ExtendsResult.True : ExtendsResult.False;
|
|
1426
|
+
}
|
|
1427
|
+
function FromVoidRight(y, J) {
|
|
1428
|
+
return IsUndefined$1(y) || IsUndefined$1(y) ? ExtendsResult.True : ExtendsResult.False;
|
|
1429
|
+
}
|
|
1430
|
+
function FromVoid(y, J) {
|
|
1431
|
+
return IsIntersect$1(J) ? FromIntersectRight(y, J) : IsUnion$1(J) ? FromUnionRight(y, J) : IsUnknown(J) ? FromUnknownRight(y, J) : IsAny$1(J) ? FromAnyRight(y, J) : IsObject$2(J) ? FromObjectRight(y, J) : IsVoid(J) ? ExtendsResult.True : ExtendsResult.False;
|
|
1432
|
+
}
|
|
1433
|
+
function Visit(y, J) {
|
|
1434
|
+
return IsTemplateLiteral$1(y) || IsTemplateLiteral$1(J) ? FromTemplateLiteral$1(y, J) : IsRegExp$1(y) || IsRegExp$1(J) ? FromRegExp(y, J) : IsNot(y) || IsNot(J) ? FromNot(y, J) : IsAny$1(y) ? FromAny(y, J) : IsArray$2(y) ? FromArray$2(y, J) : IsBigInt$2(y) ? FromBigInt(y, J) : IsBoolean$2(y) ? FromBoolean(y, J) : IsAsyncIterator$2(y) ? FromAsyncIterator$2(y, J) : IsConstructor$1(y) ? FromConstructor$2(y, J) : IsDate$1(y) ? FromDate(y, J) : IsFunction$2(y) ? FromFunction$2(y, J) : IsInteger$1(y) ? FromInteger(y, J) : IsIntersect$1(y) ? FromIntersect$4(y, J) : IsIterator$2(y) ? FromIterator$2(y, J) : IsLiteral$1(y) ? FromLiteral(y, J) : IsNever$1(y) ? FromNever(y, J) : IsNull$1(y) ? FromNull(y, J) : IsNumber$2(y) ? FromNumber(y, J) : IsObject$2(y) ? FromObject$6(y, J) : IsRecord$1(y) ? FromRecord$2(y, J) : IsString$2(y) ? FromString(y, J) : IsSymbol$1(y) ? FromSymbol(y, J) : IsTuple$1(y) ? FromTuple$2(y, J) : IsPromise$1(y) ? FromPromise$1(y, J) : IsUint8Array$1(y) ? FromUint8Array(y, J) : IsUndefined$1(y) ? FromUndefined(y, J) : IsUnion$1(y) ? FromUnion$4(y, J) : IsUnknown(y) ? FromUnknown(y, J) : IsVoid(y) ? FromVoid(y, J) : Throw(`Unknown left type operand '${y[Kind]}'`);
|
|
1435
|
+
}
|
|
1436
|
+
function ExtendsCheck(y, J) {
|
|
1437
|
+
return Visit(y, J);
|
|
1438
|
+
}
|
|
1439
|
+
function FromProperties$11(y, J, Y, X, Z) {
|
|
1440
|
+
let Q = {};
|
|
1441
|
+
for (let $ of globalThis.Object.getOwnPropertyNames(y)) Q[$] = Extends(y[$], J, Y, X, Clone(Z));
|
|
1442
|
+
return Q;
|
|
1443
|
+
}
|
|
1444
|
+
function FromMappedResult$6(y, J, Y, X, Z) {
|
|
1445
|
+
return FromProperties$11(y.properties, J, Y, X, Z);
|
|
1446
|
+
}
|
|
1447
|
+
function ExtendsFromMappedResult(y, J, Y, X, Z) {
|
|
1448
|
+
return MappedResult(FromMappedResult$6(y, J, Y, X, Z));
|
|
1449
|
+
}
|
|
1450
|
+
function ExtendsResolve(y, J, Y, X) {
|
|
1451
|
+
let Z = ExtendsCheck(y, J);
|
|
1452
|
+
return Z === ExtendsResult.Union ? Union([Y, X]) : Z === ExtendsResult.True ? Y : X;
|
|
1453
|
+
}
|
|
1454
|
+
function Extends(y, J, Y, X, Z) {
|
|
1455
|
+
return IsMappedResult(y) ? ExtendsFromMappedResult(y, J, Y, X, Z) : IsMappedKey(y) ? CreateType(ExtendsFromMappedKey(y, J, Y, X, Z)) : CreateType(ExtendsResolve(y, J, Y, X), Z);
|
|
1456
|
+
}
|
|
1457
|
+
function FromPropertyKey$2(y, J, Y, X, Z) {
|
|
1458
|
+
return { [y]: Extends(Literal(y), J, Y, X, Clone(Z)) };
|
|
1459
|
+
}
|
|
1460
|
+
function FromPropertyKeys$2(y, J, Y, X, Z) {
|
|
1461
|
+
return y.reduce((y, Q) => ({
|
|
1462
|
+
...y,
|
|
1463
|
+
...FromPropertyKey$2(Q, J, Y, X, Z)
|
|
1464
|
+
}), {});
|
|
1465
|
+
}
|
|
1466
|
+
function FromMappedKey$2(y, J, Y, X, Z) {
|
|
1467
|
+
return FromPropertyKeys$2(y.keys, J, Y, X, Z);
|
|
1468
|
+
}
|
|
1469
|
+
function ExtendsFromMappedKey(y, J, Y, X, Z) {
|
|
1470
|
+
return MappedResult(FromMappedKey$2(y, J, Y, X, Z));
|
|
1471
|
+
}
|
|
1472
|
+
function ExcludeFromTemplateLiteral(y, J) {
|
|
1473
|
+
return Exclude(TemplateLiteralToUnion(y), J);
|
|
1474
|
+
}
|
|
1475
|
+
function ExcludeRest(y, J) {
|
|
1476
|
+
let Y = y.filter((y) => ExtendsCheck(y, J) === ExtendsResult.False);
|
|
1477
|
+
return Y.length === 1 ? Y[0] : Union(Y);
|
|
1478
|
+
}
|
|
1479
|
+
function Exclude(y, J, Y = {}) {
|
|
1480
|
+
return IsTemplateLiteral(y) ? CreateType(ExcludeFromTemplateLiteral(y, J), Y) : IsMappedResult(y) ? CreateType(ExcludeFromMappedResult(y, J), Y) : CreateType(IsUnion(y) ? ExcludeRest(y.anyOf, J) : ExtendsCheck(y, J) === ExtendsResult.False ? y : Never(), Y);
|
|
1481
|
+
}
|
|
1482
|
+
function FromProperties$10(y, J) {
|
|
1483
|
+
let Y = {};
|
|
1484
|
+
for (let X of globalThis.Object.getOwnPropertyNames(y)) Y[X] = Exclude(y[X], J);
|
|
1485
|
+
return Y;
|
|
1486
|
+
}
|
|
1487
|
+
function FromMappedResult$5(y, J) {
|
|
1488
|
+
return FromProperties$10(y.properties, J);
|
|
1489
|
+
}
|
|
1490
|
+
function ExcludeFromMappedResult(y, J) {
|
|
1491
|
+
return MappedResult(FromMappedResult$5(y, J));
|
|
1492
|
+
}
|
|
1493
|
+
function ExtractFromTemplateLiteral(y, J) {
|
|
1494
|
+
return Extract(TemplateLiteralToUnion(y), J);
|
|
1495
|
+
}
|
|
1496
|
+
function ExtractRest(y, J) {
|
|
1497
|
+
let Y = y.filter((y) => ExtendsCheck(y, J) !== ExtendsResult.False);
|
|
1498
|
+
return Y.length === 1 ? Y[0] : Union(Y);
|
|
1499
|
+
}
|
|
1500
|
+
function Extract(y, J, Y) {
|
|
1501
|
+
return IsTemplateLiteral(y) ? CreateType(ExtractFromTemplateLiteral(y, J), Y) : IsMappedResult(y) ? CreateType(ExtractFromMappedResult(y, J), Y) : CreateType(IsUnion(y) ? ExtractRest(y.anyOf, J) : ExtendsCheck(y, J) === ExtendsResult.False ? Never() : y, Y);
|
|
1502
|
+
}
|
|
1503
|
+
function FromProperties$9(y, J) {
|
|
1504
|
+
let Y = {};
|
|
1505
|
+
for (let X of globalThis.Object.getOwnPropertyNames(y)) Y[X] = Extract(y[X], J);
|
|
1506
|
+
return Y;
|
|
1507
|
+
}
|
|
1508
|
+
function FromMappedResult$4(y, J) {
|
|
1509
|
+
return FromProperties$9(y.properties, J);
|
|
1510
|
+
}
|
|
1511
|
+
function ExtractFromMappedResult(y, J) {
|
|
1512
|
+
return MappedResult(FromMappedResult$4(y, J));
|
|
1513
|
+
}
|
|
1514
|
+
function InstanceType(y, J) {
|
|
1515
|
+
return IsConstructor(y) ? CreateType(y.returns, J) : Never(J);
|
|
1516
|
+
}
|
|
1517
|
+
function ReadonlyOptional(y) {
|
|
1518
|
+
return Readonly(Optional(y));
|
|
1519
|
+
}
|
|
1520
|
+
function RecordCreateFromPattern(y, J, Y) {
|
|
1521
|
+
return CreateType({
|
|
1522
|
+
[Kind]: "Record",
|
|
1523
|
+
type: "object",
|
|
1524
|
+
patternProperties: { [y]: J }
|
|
1525
|
+
}, Y);
|
|
1526
|
+
}
|
|
1527
|
+
function RecordCreateFromKeys(y, J, Y) {
|
|
1528
|
+
let X = {};
|
|
1529
|
+
for (let Y of y) X[Y] = J;
|
|
1530
|
+
return Object$1(X, {
|
|
1531
|
+
...Y,
|
|
1532
|
+
[Hint]: "Record"
|
|
1533
|
+
});
|
|
1534
|
+
}
|
|
1535
|
+
function FromTemplateLiteralKey(y, J, Y) {
|
|
1536
|
+
return IsTemplateLiteralFinite(y) ? RecordCreateFromKeys(IndexPropertyKeys(y), J, Y) : RecordCreateFromPattern(y.pattern, J, Y);
|
|
1537
|
+
}
|
|
1538
|
+
function FromUnionKey(y, J, Y) {
|
|
1539
|
+
return RecordCreateFromKeys(IndexPropertyKeys(Union(y)), J, Y);
|
|
1540
|
+
}
|
|
1541
|
+
function FromLiteralKey(y, J, Y) {
|
|
1542
|
+
return RecordCreateFromKeys([y.toString()], J, Y);
|
|
1543
|
+
}
|
|
1544
|
+
function FromRegExpKey(y, J, Y) {
|
|
1545
|
+
return RecordCreateFromPattern(y.source, J, Y);
|
|
1546
|
+
}
|
|
1547
|
+
function FromStringKey(y, J, Y) {
|
|
1548
|
+
return RecordCreateFromPattern(IsUndefined(y.pattern) ? PatternStringExact : y.pattern, J, Y);
|
|
1549
|
+
}
|
|
1550
|
+
function FromAnyKey(y, J, Y) {
|
|
1551
|
+
return RecordCreateFromPattern(PatternStringExact, J, Y);
|
|
1552
|
+
}
|
|
1553
|
+
function FromNeverKey(y, J, Y) {
|
|
1554
|
+
return RecordCreateFromPattern("^(?!.*)$", J, Y);
|
|
1555
|
+
}
|
|
1556
|
+
function FromBooleanKey(y, J, Y) {
|
|
1557
|
+
return Object$1({
|
|
1558
|
+
true: J,
|
|
1559
|
+
false: J
|
|
1560
|
+
}, Y);
|
|
1561
|
+
}
|
|
1562
|
+
function FromIntegerKey(y, J, Y) {
|
|
1563
|
+
return RecordCreateFromPattern(PatternNumberExact, J, Y);
|
|
1564
|
+
}
|
|
1565
|
+
function FromNumberKey(y, J, Y) {
|
|
1566
|
+
return RecordCreateFromPattern(PatternNumberExact, J, Y);
|
|
1567
|
+
}
|
|
1568
|
+
function Record(y, J, Y = {}) {
|
|
1569
|
+
return IsUnion(y) ? FromUnionKey(y.anyOf, J, Y) : IsTemplateLiteral(y) ? FromTemplateLiteralKey(y, J, Y) : IsLiteral(y) ? FromLiteralKey(y.const, J, Y) : IsBoolean(y) ? FromBooleanKey(y, J, Y) : IsInteger(y) ? FromIntegerKey(y, J, Y) : IsNumber(y) ? FromNumberKey(y, J, Y) : IsRegExp(y) ? FromRegExpKey(y, J, Y) : IsString$1(y) ? FromStringKey(y, J, Y) : IsAny(y) ? FromAnyKey(y, J, Y) : IsNever(y) ? FromNeverKey(y, J, Y) : Never(Y);
|
|
1570
|
+
}
|
|
1571
|
+
function RecordPattern(y) {
|
|
1572
|
+
return globalThis.Object.getOwnPropertyNames(y.patternProperties)[0];
|
|
1573
|
+
}
|
|
1574
|
+
function RecordKey(y) {
|
|
1575
|
+
let J = RecordPattern(y);
|
|
1576
|
+
return J === PatternStringExact ? String() : J === PatternNumberExact ? Number$1() : String({ pattern: J });
|
|
1577
|
+
}
|
|
1578
|
+
function RecordValue(y) {
|
|
1579
|
+
return y.patternProperties[RecordPattern(y)];
|
|
1580
|
+
}
|
|
1581
|
+
function FromConstructor$1(y, J) {
|
|
1582
|
+
return J.parameters = FromTypes$1(y, J.parameters), J.returns = FromType$1(y, J.returns), J;
|
|
1583
|
+
}
|
|
1584
|
+
function FromFunction$1(y, J) {
|
|
1585
|
+
return J.parameters = FromTypes$1(y, J.parameters), J.returns = FromType$1(y, J.returns), J;
|
|
1586
|
+
}
|
|
1587
|
+
function FromIntersect$3(y, J) {
|
|
1588
|
+
return J.allOf = FromTypes$1(y, J.allOf), J;
|
|
1589
|
+
}
|
|
1590
|
+
function FromUnion$3(y, J) {
|
|
1591
|
+
return J.anyOf = FromTypes$1(y, J.anyOf), J;
|
|
1592
|
+
}
|
|
1593
|
+
function FromTuple$1(y, J) {
|
|
1594
|
+
return IsUndefined(J.items) || (J.items = FromTypes$1(y, J.items)), J;
|
|
1595
|
+
}
|
|
1596
|
+
function FromArray$1(y, J) {
|
|
1597
|
+
return J.items = FromType$1(y, J.items), J;
|
|
1598
|
+
}
|
|
1599
|
+
function FromAsyncIterator$1(y, J) {
|
|
1600
|
+
return J.items = FromType$1(y, J.items), J;
|
|
1601
|
+
}
|
|
1602
|
+
function FromIterator$1(y, J) {
|
|
1603
|
+
return J.items = FromType$1(y, J.items), J;
|
|
1604
|
+
}
|
|
1605
|
+
function FromPromise(y, J) {
|
|
1606
|
+
return J.item = FromType$1(y, J.item), J;
|
|
1607
|
+
}
|
|
1608
|
+
function FromObject$5(y, J) {
|
|
1609
|
+
let Y = FromProperties$8(y, J.properties);
|
|
1610
|
+
return {
|
|
1611
|
+
...J,
|
|
1612
|
+
...Object$1(Y)
|
|
1613
|
+
};
|
|
1614
|
+
}
|
|
1615
|
+
function FromRecord$1(y, J) {
|
|
1616
|
+
let Y = Record(FromType$1(y, RecordKey(J)), FromType$1(y, RecordValue(J)));
|
|
1617
|
+
return {
|
|
1618
|
+
...J,
|
|
1619
|
+
...Y
|
|
1620
|
+
};
|
|
1621
|
+
}
|
|
1622
|
+
function FromArgument(y, J) {
|
|
1623
|
+
return J.index in y ? y[J.index] : Unknown();
|
|
1624
|
+
}
|
|
1625
|
+
function FromProperty$1(y, J) {
|
|
1626
|
+
let Y = IsReadonly(J), X = IsOptional(J), Z = FromType$1(y, J);
|
|
1627
|
+
return Y && X ? ReadonlyOptional(Z) : Y && !X ? Readonly(Z) : !Y && X ? Optional(Z) : Z;
|
|
1628
|
+
}
|
|
1629
|
+
function FromProperties$8(y, J) {
|
|
1630
|
+
return globalThis.Object.getOwnPropertyNames(J).reduce((Y, X) => ({
|
|
1631
|
+
...Y,
|
|
1632
|
+
[X]: FromProperty$1(y, J[X])
|
|
1633
|
+
}), {});
|
|
1634
|
+
}
|
|
1635
|
+
function FromTypes$1(y, J) {
|
|
1636
|
+
return J.map((J) => FromType$1(y, J));
|
|
1637
|
+
}
|
|
1638
|
+
function FromType$1(y, J) {
|
|
1639
|
+
return IsConstructor(J) ? FromConstructor$1(y, J) : IsFunction$1(J) ? FromFunction$1(y, J) : IsIntersect(J) ? FromIntersect$3(y, J) : IsUnion(J) ? FromUnion$3(y, J) : IsTuple(J) ? FromTuple$1(y, J) : IsArray$1(J) ? FromArray$1(y, J) : IsAsyncIterator$1(J) ? FromAsyncIterator$1(y, J) : IsIterator$1(J) ? FromIterator$1(y, J) : IsPromise(J) ? FromPromise(y, J) : IsObject(J) ? FromObject$5(y, J) : IsRecord(J) ? FromRecord$1(y, J) : IsArgument$1(J) ? FromArgument(y, J) : J;
|
|
1640
|
+
}
|
|
1641
|
+
function Instantiate(y, J) {
|
|
1642
|
+
return FromType$1(J, CloneType(y));
|
|
1643
|
+
}
|
|
1644
|
+
function Integer(y) {
|
|
1645
|
+
return CreateType({
|
|
1646
|
+
[Kind]: "Integer",
|
|
1647
|
+
type: "integer"
|
|
1648
|
+
}, y);
|
|
1649
|
+
}
|
|
1650
|
+
function MappedIntrinsicPropertyKey(y, J, Y) {
|
|
1651
|
+
return { [y]: Intrinsic(Literal(y), J, Clone(Y)) };
|
|
1652
|
+
}
|
|
1653
|
+
function MappedIntrinsicPropertyKeys(y, J, Y) {
|
|
1654
|
+
return y.reduce((y, X) => ({
|
|
1655
|
+
...y,
|
|
1656
|
+
...MappedIntrinsicPropertyKey(X, J, Y)
|
|
1657
|
+
}), {});
|
|
1658
|
+
}
|
|
1659
|
+
function MappedIntrinsicProperties(y, J, Y) {
|
|
1660
|
+
return MappedIntrinsicPropertyKeys(y.keys, J, Y);
|
|
1661
|
+
}
|
|
1662
|
+
function IntrinsicFromMappedKey(y, J, Y) {
|
|
1663
|
+
return MappedResult(MappedIntrinsicProperties(y, J, Y));
|
|
1664
|
+
}
|
|
1665
|
+
function ApplyUncapitalize(y) {
|
|
1666
|
+
let [J, Y] = [y.slice(0, 1), y.slice(1)];
|
|
1667
|
+
return [J.toLowerCase(), Y].join("");
|
|
1668
|
+
}
|
|
1669
|
+
function ApplyCapitalize(y) {
|
|
1670
|
+
let [J, Y] = [y.slice(0, 1), y.slice(1)];
|
|
1671
|
+
return [J.toUpperCase(), Y].join("");
|
|
1672
|
+
}
|
|
1673
|
+
function ApplyUppercase(y) {
|
|
1674
|
+
return y.toUpperCase();
|
|
1675
|
+
}
|
|
1676
|
+
function ApplyLowercase(y) {
|
|
1677
|
+
return y.toLowerCase();
|
|
1678
|
+
}
|
|
1679
|
+
function FromTemplateLiteral(y, J, Y) {
|
|
1680
|
+
let X = TemplateLiteralParseExact(y.pattern);
|
|
1681
|
+
return IsTemplateLiteralExpressionFinite(X) ? TemplateLiteral([Union(FromRest$2([...TemplateLiteralExpressionGenerate(X)].map((y) => Literal(y)), J))], Y) : {
|
|
1682
|
+
...y,
|
|
1683
|
+
pattern: FromLiteralValue(y.pattern, J)
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1686
|
+
function FromLiteralValue(y, J) {
|
|
1687
|
+
return typeof y == "string" ? J === "Uncapitalize" ? ApplyUncapitalize(y) : J === "Capitalize" ? ApplyCapitalize(y) : J === "Uppercase" ? ApplyUppercase(y) : J === "Lowercase" ? ApplyLowercase(y) : y : y.toString();
|
|
1688
|
+
}
|
|
1689
|
+
function FromRest$2(y, J) {
|
|
1690
|
+
return y.map((y) => Intrinsic(y, J));
|
|
1691
|
+
}
|
|
1692
|
+
function Intrinsic(y, J, Y = {}) {
|
|
1693
|
+
return IsMappedKey(y) ? IntrinsicFromMappedKey(y, J, Y) : IsTemplateLiteral(y) ? FromTemplateLiteral(y, J, Y) : IsUnion(y) ? Union(FromRest$2(y.anyOf, J), Y) : IsLiteral(y) ? Literal(FromLiteralValue(y.const, J), Y) : CreateType(y, Y);
|
|
1694
|
+
}
|
|
1695
|
+
function Capitalize(y, J = {}) {
|
|
1696
|
+
return Intrinsic(y, "Capitalize", J);
|
|
1697
|
+
}
|
|
1698
|
+
function Lowercase(y, J = {}) {
|
|
1699
|
+
return Intrinsic(y, "Lowercase", J);
|
|
1700
|
+
}
|
|
1701
|
+
function Uncapitalize(y, J = {}) {
|
|
1702
|
+
return Intrinsic(y, "Uncapitalize", J);
|
|
1703
|
+
}
|
|
1704
|
+
function Uppercase(y, J = {}) {
|
|
1705
|
+
return Intrinsic(y, "Uppercase", J);
|
|
1706
|
+
}
|
|
1707
|
+
function FromProperties$7(y, J, Y) {
|
|
1708
|
+
let X = {};
|
|
1709
|
+
for (let Z of globalThis.Object.getOwnPropertyNames(y)) X[Z] = Omit(y[Z], J, Clone(Y));
|
|
1710
|
+
return X;
|
|
1711
|
+
}
|
|
1712
|
+
function FromMappedResult$3(y, J, Y) {
|
|
1713
|
+
return FromProperties$7(y.properties, J, Y);
|
|
1714
|
+
}
|
|
1715
|
+
function OmitFromMappedResult(y, J, Y) {
|
|
1716
|
+
return MappedResult(FromMappedResult$3(y, J, Y));
|
|
1717
|
+
}
|
|
1718
|
+
function FromIntersect$2(y, J) {
|
|
1719
|
+
return y.map((y) => OmitResolve(y, J));
|
|
1720
|
+
}
|
|
1721
|
+
function FromUnion$2(y, J) {
|
|
1722
|
+
return y.map((y) => OmitResolve(y, J));
|
|
1723
|
+
}
|
|
1724
|
+
function FromProperty(y, J) {
|
|
1725
|
+
let { [J]: Y, ...X } = y;
|
|
1726
|
+
return X;
|
|
1727
|
+
}
|
|
1728
|
+
function FromProperties$6(y, J) {
|
|
1729
|
+
return J.reduce((y, J) => FromProperty(y, J), y);
|
|
1730
|
+
}
|
|
1731
|
+
function FromObject$4(y, J, Y) {
|
|
1732
|
+
let X = Discard(y, [
|
|
1733
|
+
TransformKind,
|
|
1734
|
+
"$id",
|
|
1735
|
+
"required",
|
|
1736
|
+
"properties"
|
|
1737
|
+
]);
|
|
1738
|
+
return Object$1(FromProperties$6(Y, J), X);
|
|
1739
|
+
}
|
|
1740
|
+
function UnionFromPropertyKeys$1(y) {
|
|
1741
|
+
return Union(y.reduce((y, J) => IsLiteralValue(J) ? [...y, Literal(J)] : y, []));
|
|
1742
|
+
}
|
|
1743
|
+
function OmitResolve(y, J) {
|
|
1744
|
+
return IsIntersect(y) ? Intersect(FromIntersect$2(y.allOf, J)) : IsUnion(y) ? Union(FromUnion$2(y.anyOf, J)) : IsObject(y) ? FromObject$4(y, J, y.properties) : Object$1({});
|
|
1745
|
+
}
|
|
1746
|
+
function Omit(y, J, Y) {
|
|
1747
|
+
let X = IsArray(J) ? UnionFromPropertyKeys$1(J) : J, Z = IsSchema(J) ? IndexPropertyKeys(J) : J, Q = IsRef(y), $ = IsRef(J);
|
|
1748
|
+
return IsMappedResult(y) ? OmitFromMappedResult(y, Z, Y) : IsMappedKey(J) ? OmitFromMappedKey(y, J, Y) : Q && $ || !Q && $ || Q && !$ ? Computed("Omit", [y, X], Y) : CreateType({
|
|
1749
|
+
...OmitResolve(y, Z),
|
|
1750
|
+
...Y
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
function FromPropertyKey$1(y, J, Y) {
|
|
1754
|
+
return { [J]: Omit(y, [J], Clone(Y)) };
|
|
1755
|
+
}
|
|
1756
|
+
function FromPropertyKeys$1(y, J, Y) {
|
|
1757
|
+
return J.reduce((J, X) => ({
|
|
1758
|
+
...J,
|
|
1759
|
+
...FromPropertyKey$1(y, X, Y)
|
|
1760
|
+
}), {});
|
|
1761
|
+
}
|
|
1762
|
+
function FromMappedKey$1(y, J, Y) {
|
|
1763
|
+
return FromPropertyKeys$1(y, J.keys, Y);
|
|
1764
|
+
}
|
|
1765
|
+
function OmitFromMappedKey(y, J, Y) {
|
|
1766
|
+
return MappedResult(FromMappedKey$1(y, J, Y));
|
|
1767
|
+
}
|
|
1768
|
+
function FromProperties$5(y, J, Y) {
|
|
1769
|
+
let X = {};
|
|
1770
|
+
for (let Z of globalThis.Object.getOwnPropertyNames(y)) X[Z] = Pick(y[Z], J, Clone(Y));
|
|
1771
|
+
return X;
|
|
1772
|
+
}
|
|
1773
|
+
function FromMappedResult$2(y, J, Y) {
|
|
1774
|
+
return FromProperties$5(y.properties, J, Y);
|
|
1775
|
+
}
|
|
1776
|
+
function PickFromMappedResult(y, J, Y) {
|
|
1777
|
+
return MappedResult(FromMappedResult$2(y, J, Y));
|
|
1778
|
+
}
|
|
1779
|
+
function FromIntersect$1(y, J) {
|
|
1780
|
+
return y.map((y) => PickResolve(y, J));
|
|
1781
|
+
}
|
|
1782
|
+
function FromUnion$1(y, J) {
|
|
1783
|
+
return y.map((y) => PickResolve(y, J));
|
|
1784
|
+
}
|
|
1785
|
+
function FromProperties$4(y, J) {
|
|
1786
|
+
let Y = {};
|
|
1787
|
+
for (let X of J) X in y && (Y[X] = y[X]);
|
|
1788
|
+
return Y;
|
|
1789
|
+
}
|
|
1790
|
+
function FromObject$3(y, J, Y) {
|
|
1791
|
+
let X = Discard(y, [
|
|
1792
|
+
TransformKind,
|
|
1793
|
+
"$id",
|
|
1794
|
+
"required",
|
|
1795
|
+
"properties"
|
|
1796
|
+
]);
|
|
1797
|
+
return Object$1(FromProperties$4(Y, J), X);
|
|
1798
|
+
}
|
|
1799
|
+
function UnionFromPropertyKeys(y) {
|
|
1800
|
+
return Union(y.reduce((y, J) => IsLiteralValue(J) ? [...y, Literal(J)] : y, []));
|
|
1801
|
+
}
|
|
1802
|
+
function PickResolve(y, J) {
|
|
1803
|
+
return IsIntersect(y) ? Intersect(FromIntersect$1(y.allOf, J)) : IsUnion(y) ? Union(FromUnion$1(y.anyOf, J)) : IsObject(y) ? FromObject$3(y, J, y.properties) : Object$1({});
|
|
1804
|
+
}
|
|
1805
|
+
function Pick(y, J, Y) {
|
|
1806
|
+
let X = IsArray(J) ? UnionFromPropertyKeys(J) : J, Z = IsSchema(J) ? IndexPropertyKeys(J) : J, Q = IsRef(y), $ = IsRef(J);
|
|
1807
|
+
return IsMappedResult(y) ? PickFromMappedResult(y, Z, Y) : IsMappedKey(J) ? PickFromMappedKey(y, J, Y) : Q && $ || !Q && $ || Q && !$ ? Computed("Pick", [y, X], Y) : CreateType({
|
|
1808
|
+
...PickResolve(y, Z),
|
|
1809
|
+
...Y
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
function FromPropertyKey(y, J, Y) {
|
|
1813
|
+
return { [J]: Pick(y, [J], Clone(Y)) };
|
|
1814
|
+
}
|
|
1815
|
+
function FromPropertyKeys(y, J, Y) {
|
|
1816
|
+
return J.reduce((J, X) => ({
|
|
1817
|
+
...J,
|
|
1818
|
+
...FromPropertyKey(y, X, Y)
|
|
1819
|
+
}), {});
|
|
1820
|
+
}
|
|
1821
|
+
function FromMappedKey(y, J, Y) {
|
|
1822
|
+
return FromPropertyKeys(y, J.keys, Y);
|
|
1823
|
+
}
|
|
1824
|
+
function PickFromMappedKey(y, J, Y) {
|
|
1825
|
+
return MappedResult(FromMappedKey(y, J, Y));
|
|
1826
|
+
}
|
|
1827
|
+
function FromComputed$2(y, J) {
|
|
1828
|
+
return Computed("Partial", [Computed(y, J)]);
|
|
1829
|
+
}
|
|
1830
|
+
function FromRef$1(y) {
|
|
1831
|
+
return Computed("Partial", [Ref(y)]);
|
|
1832
|
+
}
|
|
1833
|
+
function FromProperties$3(y) {
|
|
1834
|
+
let J = {};
|
|
1835
|
+
for (let Y of globalThis.Object.getOwnPropertyNames(y)) J[Y] = Optional(y[Y]);
|
|
1836
|
+
return J;
|
|
1837
|
+
}
|
|
1838
|
+
function FromObject$2(y, J) {
|
|
1839
|
+
let Y = Discard(y, [
|
|
1840
|
+
TransformKind,
|
|
1841
|
+
"$id",
|
|
1842
|
+
"required",
|
|
1843
|
+
"properties"
|
|
1844
|
+
]);
|
|
1845
|
+
return Object$1(FromProperties$3(J), Y);
|
|
1846
|
+
}
|
|
1847
|
+
function FromRest$1(y) {
|
|
1848
|
+
return y.map((y) => PartialResolve(y));
|
|
1849
|
+
}
|
|
1850
|
+
function PartialResolve(y) {
|
|
1851
|
+
return IsComputed(y) ? FromComputed$2(y.target, y.parameters) : IsRef(y) ? FromRef$1(y.$ref) : IsIntersect(y) ? Intersect(FromRest$1(y.allOf)) : IsUnion(y) ? Union(FromRest$1(y.anyOf)) : IsObject(y) ? FromObject$2(y, y.properties) : IsBigInt$1(y) || IsBoolean(y) || IsInteger(y) || IsLiteral(y) || IsNull$2(y) || IsNumber(y) || IsString$1(y) || IsSymbol$2(y) || IsUndefined$2(y) ? y : Object$1({});
|
|
1852
|
+
}
|
|
1853
|
+
function Partial(y, J) {
|
|
1854
|
+
return IsMappedResult(y) ? PartialFromMappedResult(y, J) : CreateType({
|
|
1855
|
+
...PartialResolve(y),
|
|
1856
|
+
...J
|
|
1857
|
+
});
|
|
1858
|
+
}
|
|
1859
|
+
function FromProperties$2(y, J) {
|
|
1860
|
+
let Y = {};
|
|
1861
|
+
for (let X of globalThis.Object.getOwnPropertyNames(y)) Y[X] = Partial(y[X], Clone(J));
|
|
1862
|
+
return Y;
|
|
1863
|
+
}
|
|
1864
|
+
function FromMappedResult$1(y, J) {
|
|
1865
|
+
return FromProperties$2(y.properties, J);
|
|
1866
|
+
}
|
|
1867
|
+
function PartialFromMappedResult(y, J) {
|
|
1868
|
+
return MappedResult(FromMappedResult$1(y, J));
|
|
1869
|
+
}
|
|
1870
|
+
function FromComputed$1(y, J) {
|
|
1871
|
+
return Computed("Required", [Computed(y, J)]);
|
|
1872
|
+
}
|
|
1873
|
+
function FromRef(y) {
|
|
1874
|
+
return Computed("Required", [Ref(y)]);
|
|
1875
|
+
}
|
|
1876
|
+
function FromProperties$1(y) {
|
|
1877
|
+
let J = {};
|
|
1878
|
+
for (let Y of globalThis.Object.getOwnPropertyNames(y)) J[Y] = Discard(y[Y], [OptionalKind]);
|
|
1879
|
+
return J;
|
|
1880
|
+
}
|
|
1881
|
+
function FromObject$1(y, J) {
|
|
1882
|
+
let Y = Discard(y, [
|
|
1883
|
+
TransformKind,
|
|
1884
|
+
"$id",
|
|
1885
|
+
"required",
|
|
1886
|
+
"properties"
|
|
1887
|
+
]);
|
|
1888
|
+
return Object$1(FromProperties$1(J), Y);
|
|
1889
|
+
}
|
|
1890
|
+
function FromRest(y) {
|
|
1891
|
+
return y.map((y) => RequiredResolve(y));
|
|
1892
|
+
}
|
|
1893
|
+
function RequiredResolve(y) {
|
|
1894
|
+
return IsComputed(y) ? FromComputed$1(y.target, y.parameters) : IsRef(y) ? FromRef(y.$ref) : IsIntersect(y) ? Intersect(FromRest(y.allOf)) : IsUnion(y) ? Union(FromRest(y.anyOf)) : IsObject(y) ? FromObject$1(y, y.properties) : IsBigInt$1(y) || IsBoolean(y) || IsInteger(y) || IsLiteral(y) || IsNull$2(y) || IsNumber(y) || IsString$1(y) || IsSymbol$2(y) || IsUndefined$2(y) ? y : Object$1({});
|
|
1895
|
+
}
|
|
1896
|
+
function Required(y, J) {
|
|
1897
|
+
return IsMappedResult(y) ? RequiredFromMappedResult(y, J) : CreateType({
|
|
1898
|
+
...RequiredResolve(y),
|
|
1899
|
+
...J
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1902
|
+
function FromProperties(y, J) {
|
|
1903
|
+
let Y = {};
|
|
1904
|
+
for (let X of globalThis.Object.getOwnPropertyNames(y)) Y[X] = Required(y[X], J);
|
|
1905
|
+
return Y;
|
|
1906
|
+
}
|
|
1907
|
+
function FromMappedResult(y, J) {
|
|
1908
|
+
return FromProperties(y.properties, J);
|
|
1909
|
+
}
|
|
1910
|
+
function RequiredFromMappedResult(y, J) {
|
|
1911
|
+
return MappedResult(FromMappedResult(y, J));
|
|
1912
|
+
}
|
|
1913
|
+
function DereferenceParameters(y, J) {
|
|
1914
|
+
return J.map((J) => IsRef(J) ? Dereference(y, J.$ref) : FromType(y, J));
|
|
1915
|
+
}
|
|
1916
|
+
function Dereference(y, J) {
|
|
1917
|
+
return J in y ? IsRef(y[J]) ? Dereference(y, y[J].$ref) : FromType(y, y[J]) : Never();
|
|
1918
|
+
}
|
|
1919
|
+
function FromAwaited(y) {
|
|
1920
|
+
return Awaited(y[0]);
|
|
1921
|
+
}
|
|
1922
|
+
function FromIndex(y) {
|
|
1923
|
+
return Index(y[0], y[1]);
|
|
1924
|
+
}
|
|
1925
|
+
function FromKeyOf(y) {
|
|
1926
|
+
return KeyOf(y[0]);
|
|
1927
|
+
}
|
|
1928
|
+
function FromPartial(y) {
|
|
1929
|
+
return Partial(y[0]);
|
|
1930
|
+
}
|
|
1931
|
+
function FromOmit(y) {
|
|
1932
|
+
return Omit(y[0], y[1]);
|
|
1933
|
+
}
|
|
1934
|
+
function FromPick(y) {
|
|
1935
|
+
return Pick(y[0], y[1]);
|
|
1936
|
+
}
|
|
1937
|
+
function FromRequired(y) {
|
|
1938
|
+
return Required(y[0]);
|
|
1939
|
+
}
|
|
1940
|
+
function FromComputed(y, J, Y) {
|
|
1941
|
+
let X = DereferenceParameters(y, Y);
|
|
1942
|
+
return J === "Awaited" ? FromAwaited(X) : J === "Index" ? FromIndex(X) : J === "KeyOf" ? FromKeyOf(X) : J === "Partial" ? FromPartial(X) : J === "Omit" ? FromOmit(X) : J === "Pick" ? FromPick(X) : J === "Required" ? FromRequired(X) : Never();
|
|
1943
|
+
}
|
|
1944
|
+
function FromArray(y, J) {
|
|
1945
|
+
return Array$1(FromType(y, J));
|
|
1946
|
+
}
|
|
1947
|
+
function FromAsyncIterator(y, J) {
|
|
1948
|
+
return AsyncIterator(FromType(y, J));
|
|
1949
|
+
}
|
|
1950
|
+
function FromConstructor(y, J, Y) {
|
|
1951
|
+
return Constructor(FromTypes(y, J), FromType(y, Y));
|
|
1952
|
+
}
|
|
1953
|
+
function FromFunction(y, J, Y) {
|
|
1954
|
+
return Function(FromTypes(y, J), FromType(y, Y));
|
|
1955
|
+
}
|
|
1956
|
+
function FromIntersect(y, J) {
|
|
1957
|
+
return Intersect(FromTypes(y, J));
|
|
1958
|
+
}
|
|
1959
|
+
function FromIterator(y, J) {
|
|
1960
|
+
return Iterator(FromType(y, J));
|
|
1961
|
+
}
|
|
1962
|
+
function FromObject(y, J) {
|
|
1963
|
+
return Object$1(globalThis.Object.keys(J).reduce((Y, X) => ({
|
|
1964
|
+
...Y,
|
|
1965
|
+
[X]: FromType(y, J[X])
|
|
1966
|
+
}), {}));
|
|
1967
|
+
}
|
|
1968
|
+
function FromRecord(y, J) {
|
|
1969
|
+
let [Y, X] = [FromType(y, RecordValue(J)), RecordPattern(J)], Z = CloneType(J);
|
|
1970
|
+
return Z.patternProperties[X] = Y, Z;
|
|
1971
|
+
}
|
|
1972
|
+
function FromTransform(y, J) {
|
|
1973
|
+
return IsRef(J) ? {
|
|
1974
|
+
...Dereference(y, J.$ref),
|
|
1975
|
+
[TransformKind]: J[TransformKind]
|
|
1976
|
+
} : J;
|
|
1977
|
+
}
|
|
1978
|
+
function FromTuple(y, J) {
|
|
1979
|
+
return Tuple(FromTypes(y, J));
|
|
1980
|
+
}
|
|
1981
|
+
function FromUnion(y, J) {
|
|
1982
|
+
return Union(FromTypes(y, J));
|
|
1983
|
+
}
|
|
1984
|
+
function FromTypes(y, J) {
|
|
1985
|
+
return J.map((J) => FromType(y, J));
|
|
1986
|
+
}
|
|
1987
|
+
function FromType(y, J) {
|
|
1988
|
+
return IsOptional(J) ? CreateType(FromType(y, Discard(J, [OptionalKind])), J) : IsReadonly(J) ? CreateType(FromType(y, Discard(J, [ReadonlyKind])), J) : IsTransform(J) ? CreateType(FromTransform(y, J), J) : IsArray$1(J) ? CreateType(FromArray(y, J.items), J) : IsAsyncIterator$1(J) ? CreateType(FromAsyncIterator(y, J.items), J) : IsComputed(J) ? CreateType(FromComputed(y, J.target, J.parameters)) : IsConstructor(J) ? CreateType(FromConstructor(y, J.parameters, J.returns), J) : IsFunction$1(J) ? CreateType(FromFunction(y, J.parameters, J.returns), J) : IsIntersect(J) ? CreateType(FromIntersect(y, J.allOf), J) : IsIterator$1(J) ? CreateType(FromIterator(y, J.items), J) : IsObject(J) ? CreateType(FromObject(y, J.properties), J) : IsRecord(J) ? CreateType(FromRecord(y, J)) : IsTuple(J) ? CreateType(FromTuple(y, J.items || []), J) : IsUnion(J) ? CreateType(FromUnion(y, J.anyOf), J) : J;
|
|
1989
|
+
}
|
|
1990
|
+
function ComputeType(y, J) {
|
|
1991
|
+
return J in y ? FromType(y, y[J]) : Never();
|
|
1992
|
+
}
|
|
1993
|
+
function ComputeModuleProperties(y) {
|
|
1994
|
+
return globalThis.Object.getOwnPropertyNames(y).reduce((J, Y) => ({
|
|
1995
|
+
...J,
|
|
1996
|
+
[Y]: ComputeType(y, Y)
|
|
1997
|
+
}), {});
|
|
1998
|
+
}
|
|
1999
|
+
var TModule = class {
|
|
2000
|
+
constructor(y) {
|
|
2001
|
+
let J = ComputeModuleProperties(y);
|
|
2002
|
+
this.$defs = this.WithIdentifiers(J);
|
|
2003
|
+
}
|
|
2004
|
+
Import(y, J) {
|
|
2005
|
+
let Y = {
|
|
2006
|
+
...this.$defs,
|
|
2007
|
+
[y]: CreateType(this.$defs[y], J)
|
|
2008
|
+
};
|
|
2009
|
+
return CreateType({
|
|
2010
|
+
[Kind]: "Import",
|
|
2011
|
+
$defs: Y,
|
|
2012
|
+
$ref: y
|
|
2013
|
+
});
|
|
2014
|
+
}
|
|
2015
|
+
WithIdentifiers(y) {
|
|
2016
|
+
return globalThis.Object.getOwnPropertyNames(y).reduce((J, Y) => ({
|
|
2017
|
+
...J,
|
|
2018
|
+
[Y]: {
|
|
2019
|
+
...y[Y],
|
|
2020
|
+
$id: Y
|
|
2021
|
+
}
|
|
2022
|
+
}), {});
|
|
2023
|
+
}
|
|
2024
|
+
};
|
|
2025
|
+
function Module(y) {
|
|
2026
|
+
return new TModule(y);
|
|
2027
|
+
}
|
|
2028
|
+
function Not(y, J) {
|
|
2029
|
+
return CreateType({
|
|
2030
|
+
[Kind]: "Not",
|
|
2031
|
+
not: y
|
|
2032
|
+
}, J);
|
|
2033
|
+
}
|
|
2034
|
+
function Parameters(y, J) {
|
|
2035
|
+
return IsFunction$1(y) ? Tuple(y.parameters, J) : Never();
|
|
2036
|
+
}
|
|
2037
|
+
var Ordinal = 0;
|
|
2038
|
+
function Recursive(y, J = {}) {
|
|
2039
|
+
IsUndefined(J.$id) && (J.$id = `T${Ordinal++}`);
|
|
2040
|
+
let Y = CloneType(y({
|
|
2041
|
+
[Kind]: "This",
|
|
2042
|
+
$ref: `${J.$id}`
|
|
2043
|
+
}));
|
|
2044
|
+
return Y.$id = J.$id, CreateType({
|
|
2045
|
+
[Hint]: "Recursive",
|
|
2046
|
+
...Y
|
|
2047
|
+
}, J);
|
|
2048
|
+
}
|
|
2049
|
+
function RegExp$1(y, J) {
|
|
2050
|
+
let Y = IsString(y) ? new globalThis.RegExp(y) : y;
|
|
2051
|
+
return CreateType({
|
|
2052
|
+
[Kind]: "RegExp",
|
|
2053
|
+
type: "RegExp",
|
|
2054
|
+
source: Y.source,
|
|
2055
|
+
flags: Y.flags
|
|
2056
|
+
}, J);
|
|
2057
|
+
}
|
|
2058
|
+
function RestResolve(y) {
|
|
2059
|
+
return IsIntersect(y) ? y.allOf : IsUnion(y) ? y.anyOf : IsTuple(y) ? y.items ?? [] : [];
|
|
2060
|
+
}
|
|
2061
|
+
function Rest(y) {
|
|
2062
|
+
return RestResolve(y);
|
|
2063
|
+
}
|
|
2064
|
+
function ReturnType(y, J) {
|
|
2065
|
+
return IsFunction$1(y) ? CreateType(y.returns, J) : Never(J);
|
|
2066
|
+
}
|
|
2067
|
+
var TransformDecodeBuilder = class {
|
|
2068
|
+
constructor(y) {
|
|
2069
|
+
this.schema = y;
|
|
2070
|
+
}
|
|
2071
|
+
Decode(y) {
|
|
2072
|
+
return new TransformEncodeBuilder(this.schema, y);
|
|
2073
|
+
}
|
|
2074
|
+
}, TransformEncodeBuilder = class {
|
|
2075
|
+
constructor(y, J) {
|
|
2076
|
+
this.schema = y, this.decode = J;
|
|
2077
|
+
}
|
|
2078
|
+
EncodeTransform(y, J) {
|
|
2079
|
+
let Y = {
|
|
2080
|
+
Encode: (Y) => J[TransformKind].Encode(y(Y)),
|
|
2081
|
+
Decode: (y) => this.decode(J[TransformKind].Decode(y))
|
|
2082
|
+
};
|
|
2083
|
+
return {
|
|
2084
|
+
...J,
|
|
2085
|
+
[TransformKind]: Y
|
|
2086
|
+
};
|
|
2087
|
+
}
|
|
2088
|
+
EncodeSchema(y, J) {
|
|
2089
|
+
let Y = {
|
|
2090
|
+
Decode: this.decode,
|
|
2091
|
+
Encode: y
|
|
2092
|
+
};
|
|
2093
|
+
return {
|
|
2094
|
+
...J,
|
|
2095
|
+
[TransformKind]: Y
|
|
2096
|
+
};
|
|
2097
|
+
}
|
|
2098
|
+
Encode(y) {
|
|
2099
|
+
return IsTransform(this.schema) ? this.EncodeTransform(y, this.schema) : this.EncodeSchema(y, this.schema);
|
|
2100
|
+
}
|
|
2101
|
+
};
|
|
2102
|
+
function Transform(y) {
|
|
2103
|
+
return new TransformDecodeBuilder(y);
|
|
2104
|
+
}
|
|
2105
|
+
function Unsafe(y = {}) {
|
|
2106
|
+
return CreateType({ [Kind]: y[Kind] ?? "Unsafe" }, y);
|
|
2107
|
+
}
|
|
2108
|
+
function Void(y) {
|
|
2109
|
+
return CreateType({
|
|
2110
|
+
[Kind]: "Void",
|
|
2111
|
+
type: "void"
|
|
2112
|
+
}, y);
|
|
2113
|
+
}
|
|
2114
|
+
var Type = /* @__PURE__ */ __export$1({
|
|
2115
|
+
Any: () => Any,
|
|
2116
|
+
Argument: () => Argument,
|
|
2117
|
+
Array: () => Array$1,
|
|
2118
|
+
AsyncIterator: () => AsyncIterator,
|
|
2119
|
+
Awaited: () => Awaited,
|
|
2120
|
+
BigInt: () => BigInt,
|
|
2121
|
+
Boolean: () => Boolean,
|
|
2122
|
+
Capitalize: () => Capitalize,
|
|
2123
|
+
Composite: () => Composite,
|
|
2124
|
+
Const: () => Const,
|
|
2125
|
+
Constructor: () => Constructor,
|
|
2126
|
+
ConstructorParameters: () => ConstructorParameters,
|
|
2127
|
+
Date: () => Date$1,
|
|
2128
|
+
Enum: () => Enum,
|
|
2129
|
+
Exclude: () => Exclude,
|
|
2130
|
+
Extends: () => Extends,
|
|
2131
|
+
Extract: () => Extract,
|
|
2132
|
+
Function: () => Function,
|
|
2133
|
+
Index: () => Index,
|
|
2134
|
+
InstanceType: () => InstanceType,
|
|
2135
|
+
Instantiate: () => Instantiate,
|
|
2136
|
+
Integer: () => Integer,
|
|
2137
|
+
Intersect: () => Intersect,
|
|
2138
|
+
Iterator: () => Iterator,
|
|
2139
|
+
KeyOf: () => KeyOf,
|
|
2140
|
+
Literal: () => Literal,
|
|
2141
|
+
Lowercase: () => Lowercase,
|
|
2142
|
+
Mapped: () => Mapped,
|
|
2143
|
+
Module: () => Module,
|
|
2144
|
+
Never: () => Never,
|
|
2145
|
+
Not: () => Not,
|
|
2146
|
+
Null: () => Null,
|
|
2147
|
+
Number: () => Number$1,
|
|
2148
|
+
Object: () => Object$1,
|
|
2149
|
+
Omit: () => Omit,
|
|
2150
|
+
Optional: () => Optional,
|
|
2151
|
+
Parameters: () => Parameters,
|
|
2152
|
+
Partial: () => Partial,
|
|
2153
|
+
Pick: () => Pick,
|
|
2154
|
+
Promise: () => Promise$1,
|
|
2155
|
+
Readonly: () => Readonly,
|
|
2156
|
+
ReadonlyOptional: () => ReadonlyOptional,
|
|
2157
|
+
Record: () => Record,
|
|
2158
|
+
Recursive: () => Recursive,
|
|
2159
|
+
Ref: () => Ref,
|
|
2160
|
+
RegExp: () => RegExp$1,
|
|
2161
|
+
Required: () => Required,
|
|
2162
|
+
Rest: () => Rest,
|
|
2163
|
+
ReturnType: () => ReturnType,
|
|
2164
|
+
String: () => String,
|
|
2165
|
+
Symbol: () => Symbol$1,
|
|
2166
|
+
TemplateLiteral: () => TemplateLiteral,
|
|
2167
|
+
Transform: () => Transform,
|
|
2168
|
+
Tuple: () => Tuple,
|
|
2169
|
+
Uint8Array: () => Uint8Array$1,
|
|
2170
|
+
Uncapitalize: () => Uncapitalize,
|
|
2171
|
+
Undefined: () => Undefined,
|
|
2172
|
+
Union: () => Union,
|
|
2173
|
+
Unknown: () => Unknown,
|
|
2174
|
+
Unsafe: () => Unsafe,
|
|
2175
|
+
Uppercase: () => Uppercase,
|
|
2176
|
+
Void: () => Void
|
|
2177
|
+
}, 1), __defProp = Object.defineProperty, __export = (y, J) => {
|
|
2178
|
+
let Y = {};
|
|
2179
|
+
for (var X in y) __defProp(Y, X, {
|
|
2180
|
+
get: y[X],
|
|
2181
|
+
enumerable: !0
|
|
2182
|
+
});
|
|
2183
|
+
return J && __defProp(Y, Symbol.toStringTag, { value: "Module" }), Y;
|
|
2184
|
+
}, config = {
|
|
2185
|
+
backendUrl: "https://luna-park.app",
|
|
2186
|
+
hostUrl: "https://host.luna-park.app"
|
|
2187
|
+
}, baseConfig = {
|
|
2188
|
+
credentials: "include",
|
|
2189
|
+
headers: {
|
|
2190
|
+
Accept: "application/json, text/plain",
|
|
2191
|
+
"Content-Type": "application/json"
|
|
2192
|
+
},
|
|
2193
|
+
mode: "cors"
|
|
2194
|
+
}, baseMultiConfig = {
|
|
2195
|
+
credentials: "include",
|
|
2196
|
+
headers: { Accept: "application/json, text/plain" },
|
|
2197
|
+
mode: "cors"
|
|
2198
|
+
}, api_default$1 = {
|
|
2199
|
+
async delete(y, J) {
|
|
2200
|
+
let Y = {
|
|
2201
|
+
...baseConfig,
|
|
2202
|
+
method: "DELETE",
|
|
2203
|
+
...J
|
|
2204
|
+
};
|
|
2205
|
+
return Y.body || (Y.headers = { ...Y.headers }, delete Y.headers?.["Content-Type"]), fetch(y, Y);
|
|
2206
|
+
},
|
|
2207
|
+
async get(y, J) {
|
|
2208
|
+
return await fetch(y, {
|
|
2209
|
+
...baseConfig,
|
|
2210
|
+
method: "GET",
|
|
2211
|
+
...J
|
|
2212
|
+
});
|
|
2213
|
+
},
|
|
2214
|
+
getBaseUrl({ dev: y } = { dev: !1 }) {
|
|
2215
|
+
return `${config.backendUrl}/${y ? "dev" : "api"}`;
|
|
2216
|
+
},
|
|
2217
|
+
async multipart(y, J, Y) {
|
|
2218
|
+
return await fetch(y, {
|
|
2219
|
+
...baseMultiConfig,
|
|
2220
|
+
body: J,
|
|
2221
|
+
method: "POST",
|
|
2222
|
+
...Y
|
|
2223
|
+
});
|
|
2224
|
+
},
|
|
2225
|
+
async post(y, J, Y) {
|
|
2226
|
+
return await fetch(y, {
|
|
2227
|
+
...baseConfig,
|
|
2228
|
+
body: JSON.stringify(J) || "{}",
|
|
2229
|
+
method: "POST",
|
|
2230
|
+
...Y
|
|
2231
|
+
});
|
|
2232
|
+
},
|
|
2233
|
+
async put(y, J, Y) {
|
|
2234
|
+
return await fetch(y, {
|
|
2235
|
+
...baseConfig,
|
|
2236
|
+
body: JSON.stringify(J) || "{}",
|
|
2237
|
+
method: "PUT",
|
|
2238
|
+
...Y
|
|
2239
|
+
});
|
|
2240
|
+
}
|
|
2241
|
+
}, ERouteType = /* @__PURE__ */ function(y) {
|
|
2242
|
+
return y.Get = "get", y.Post = "post", y.Delete = "delete", y.Put = "put", y;
|
|
2243
|
+
}({}), TypeDate = Type.String({ format: "date-time" }), ai_exports = /* @__PURE__ */ __export({
|
|
2244
|
+
component: () => component,
|
|
2245
|
+
logic: () => logic
|
|
2246
|
+
}, 1), component = {
|
|
2247
|
+
type: ERouteType.Post,
|
|
2248
|
+
body: Type.Object({
|
|
2249
|
+
instruction: Type.String(),
|
|
2250
|
+
layout: Type.Optional(Type.Unknown())
|
|
2251
|
+
}),
|
|
2252
|
+
response: { 200: Type.Object({ layout: Type.Unknown() }) },
|
|
2253
|
+
url: "/ai/component"
|
|
2254
|
+
}, logic = {
|
|
2255
|
+
type: ERouteType.Post,
|
|
2256
|
+
body: Type.Object({
|
|
2257
|
+
instruction: Type.String(),
|
|
2258
|
+
prototype: Type.Optional(Type.String())
|
|
2259
|
+
}),
|
|
2260
|
+
response: { 200: Type.Object({
|
|
2261
|
+
code: Type.String(),
|
|
2262
|
+
prototype: Type.Optional(Type.String())
|
|
2263
|
+
}) },
|
|
2264
|
+
url: "/ai/logic"
|
|
2265
|
+
}, app_exports$1 = /* @__PURE__ */ __export({
|
|
2266
|
+
app: () => app,
|
|
2267
|
+
appEdits: () => appEdits
|
|
2268
|
+
}, 1), app = Type.Object({
|
|
2269
|
+
name: Type.String(),
|
|
2270
|
+
config: Type.Record(Type.String(), Type.Unknown()),
|
|
2271
|
+
tree: Type.Unknown(),
|
|
2272
|
+
version: Type.Optional(Type.Number())
|
|
2273
|
+
}), appEdits = Type.Array(Type.Object({
|
|
2274
|
+
file: Type.Unknown(),
|
|
2275
|
+
path: Type.String()
|
|
2276
|
+
})), keyConfig = Type.Object({
|
|
2277
|
+
id: Type.Optional(Type.String()),
|
|
2278
|
+
domain: Type.String(),
|
|
2279
|
+
owner: Type.String(),
|
|
2280
|
+
private: Type.String(),
|
|
2281
|
+
public: Type.String()
|
|
2282
|
+
}), project = Type.Object({
|
|
2283
|
+
id: Type.String(),
|
|
2284
|
+
app: Type.Object({
|
|
2285
|
+
name: Type.String(),
|
|
2286
|
+
config: Type.Unknown()
|
|
2287
|
+
}),
|
|
2288
|
+
createdAt: TypeDate,
|
|
2289
|
+
icon: Type.String(),
|
|
2290
|
+
owner: Type.Unknown(),
|
|
2291
|
+
updatedAt: TypeDate,
|
|
2292
|
+
visibility: Type.Object({
|
|
2293
|
+
liked: Type.Boolean(),
|
|
2294
|
+
public: Type.Boolean(),
|
|
2295
|
+
shareKey: Type.Optional(Type.String()),
|
|
2296
|
+
starsCount: Type.Number()
|
|
2297
|
+
})
|
|
2298
|
+
}), publicProject = Type.Object({ ...project.properties }), privateProject = Type.Object({
|
|
2299
|
+
...project.properties,
|
|
2300
|
+
app: Type.Unknown()
|
|
2301
|
+
}), EPlanKey = /* @__PURE__ */ function(y) {
|
|
2302
|
+
return y.Free = "free", y.Edu = "edu", y.Pro = "pro", y.Org = "org", y;
|
|
2303
|
+
}({}), flags = {
|
|
2304
|
+
free: {
|
|
2305
|
+
compilation: {
|
|
2306
|
+
desktop: !1,
|
|
2307
|
+
export: !0,
|
|
2308
|
+
mobile: !1,
|
|
2309
|
+
source: !1,
|
|
2310
|
+
web: !0
|
|
2311
|
+
},
|
|
2312
|
+
editor: {
|
|
2313
|
+
desktop: !1,
|
|
2314
|
+
web: !0
|
|
2315
|
+
},
|
|
2316
|
+
watermark: !0
|
|
2317
|
+
},
|
|
2318
|
+
pro: {
|
|
2319
|
+
compilation: {
|
|
2320
|
+
desktop: !0,
|
|
2321
|
+
export: !0,
|
|
2322
|
+
mobile: !0,
|
|
2323
|
+
source: !0,
|
|
2324
|
+
web: !0
|
|
2325
|
+
},
|
|
2326
|
+
editor: {
|
|
2327
|
+
desktop: !0,
|
|
2328
|
+
web: !0
|
|
2329
|
+
},
|
|
2330
|
+
watermark: !1
|
|
2331
|
+
}
|
|
35
2332
|
};
|
|
2333
|
+
EPlanKey.Org, flags.pro, {
|
|
2334
|
+
BASE_URL: "/",
|
|
2335
|
+
DEV: !1,
|
|
2336
|
+
MODE: "production",
|
|
2337
|
+
PROD: !0,
|
|
2338
|
+
SSR: !1,
|
|
2339
|
+
"VITE_STRIPE.LP_PRO.PRICE_ID": "price_1OqeY1JFBGA2uuxte3UGjLCv",
|
|
2340
|
+
"VITE_STRIPE.LP_PRO.PRODUCT_ID": "prod_Pg0Z4ompDLdXVM",
|
|
2341
|
+
"VITE_STRIPE.LP_TEAM.PRICE_ID": "price_1OqeYcJFBGA2uuxtzaNN5WKS",
|
|
2342
|
+
"VITE_STRIPE.LP_TEAM.PRODUCT_ID": "prod_Pg0ZH8QzIjUoVj"
|
|
2343
|
+
}["VITE_STRIPE.LP_TEAM.PRICE_ID"], {
|
|
2344
|
+
BASE_URL: "/",
|
|
2345
|
+
DEV: !1,
|
|
2346
|
+
MODE: "production",
|
|
2347
|
+
PROD: !0,
|
|
2348
|
+
SSR: !1,
|
|
2349
|
+
"VITE_STRIPE.LP_PRO.PRICE_ID": "price_1OqeY1JFBGA2uuxte3UGjLCv",
|
|
2350
|
+
"VITE_STRIPE.LP_PRO.PRODUCT_ID": "prod_Pg0Z4ompDLdXVM",
|
|
2351
|
+
"VITE_STRIPE.LP_TEAM.PRICE_ID": "price_1OqeYcJFBGA2uuxtzaNN5WKS",
|
|
2352
|
+
"VITE_STRIPE.LP_TEAM.PRODUCT_ID": "prod_Pg0ZH8QzIjUoVj"
|
|
2353
|
+
}["VITE_STRIPE.LP_TEAM.PRODUCT_ID"], EPlanKey.Pro, flags.pro, {
|
|
2354
|
+
BASE_URL: "/",
|
|
2355
|
+
DEV: !1,
|
|
2356
|
+
MODE: "production",
|
|
2357
|
+
PROD: !0,
|
|
2358
|
+
SSR: !1,
|
|
2359
|
+
"VITE_STRIPE.LP_PRO.PRICE_ID": "price_1OqeY1JFBGA2uuxte3UGjLCv",
|
|
2360
|
+
"VITE_STRIPE.LP_PRO.PRODUCT_ID": "prod_Pg0Z4ompDLdXVM",
|
|
2361
|
+
"VITE_STRIPE.LP_TEAM.PRICE_ID": "price_1OqeYcJFBGA2uuxtzaNN5WKS",
|
|
2362
|
+
"VITE_STRIPE.LP_TEAM.PRODUCT_ID": "prod_Pg0ZH8QzIjUoVj"
|
|
2363
|
+
}["VITE_STRIPE.LP_PRO.PRICE_ID"], {
|
|
2364
|
+
BASE_URL: "/",
|
|
2365
|
+
DEV: !1,
|
|
2366
|
+
MODE: "production",
|
|
2367
|
+
PROD: !0,
|
|
2368
|
+
SSR: !1,
|
|
2369
|
+
"VITE_STRIPE.LP_PRO.PRICE_ID": "price_1OqeY1JFBGA2uuxte3UGjLCv",
|
|
2370
|
+
"VITE_STRIPE.LP_PRO.PRODUCT_ID": "prod_Pg0Z4ompDLdXVM",
|
|
2371
|
+
"VITE_STRIPE.LP_TEAM.PRICE_ID": "price_1OqeYcJFBGA2uuxtzaNN5WKS",
|
|
2372
|
+
"VITE_STRIPE.LP_TEAM.PRODUCT_ID": "prod_Pg0ZH8QzIjUoVj"
|
|
2373
|
+
}["VITE_STRIPE.LP_PRO.PRODUCT_ID"], EPlanKey.Edu, flags.pro, EPlanKey.Free, flags.free;
|
|
2374
|
+
var user = Type.Object({
|
|
2375
|
+
id: Type.Optional(Type.String()),
|
|
2376
|
+
auth: Type.Optional(Type.Object({})),
|
|
2377
|
+
mail: Type.String(),
|
|
2378
|
+
plan: Type.Object({ name: Type.String({ enum: Object.values(EPlanKey) }) }),
|
|
2379
|
+
profile: Type.Object({
|
|
2380
|
+
other: Type.Object({
|
|
2381
|
+
avatar: Type.String(),
|
|
2382
|
+
bio: Type.String(),
|
|
2383
|
+
referral: Type.String()
|
|
2384
|
+
}),
|
|
2385
|
+
public: Type.Object({
|
|
2386
|
+
company: Type.String(),
|
|
2387
|
+
location: Type.String(),
|
|
2388
|
+
url: Type.String(),
|
|
2389
|
+
username: Type.String()
|
|
2390
|
+
}),
|
|
2391
|
+
social: Type.Object({
|
|
2392
|
+
discord: Type.String(),
|
|
2393
|
+
github: Type.String(),
|
|
2394
|
+
linkedin: Type.String(),
|
|
2395
|
+
twitter: Type.String()
|
|
2396
|
+
})
|
|
2397
|
+
}),
|
|
2398
|
+
settings: Type.Object({ newsletter: Type.Boolean() })
|
|
2399
|
+
}), EElementType = /* @__PURE__ */ function(y) {
|
|
2400
|
+
return y.Script = "script", y.Standalone = "standalone", y.Folder = "folder", y.MainLogic = "main", y.Logic = "logic", y.Config = "config", y.Text = "text", y.Store = "store", y.Database = "database", y.Component = "component", y.Route = "route", y.Type = "type", y.Cron = "cron", y.Media = "media", y;
|
|
2401
|
+
}({}), types = {
|
|
2402
|
+
...app_exports$1,
|
|
2403
|
+
keyConfig,
|
|
2404
|
+
privateProject,
|
|
2405
|
+
project,
|
|
2406
|
+
publicProject,
|
|
2407
|
+
user
|
|
2408
|
+
}, app_exports = /* @__PURE__ */ __export({
|
|
2409
|
+
edit: () => edit$1,
|
|
2410
|
+
get: () => get$2
|
|
2411
|
+
}, 1), get$2 = {
|
|
2412
|
+
type: ERouteType.Get,
|
|
2413
|
+
params: Type.Object({ id: Type.String() }),
|
|
2414
|
+
response: { 200: Type.Object({
|
|
2415
|
+
app: types.app,
|
|
2416
|
+
readOnly: Type.Boolean()
|
|
2417
|
+
}) },
|
|
2418
|
+
url: "/app/:id"
|
|
2419
|
+
}, edit$1 = {
|
|
2420
|
+
type: ERouteType.Post,
|
|
2421
|
+
body: Type.Object({
|
|
2422
|
+
app: Type.Optional(types.app),
|
|
2423
|
+
deletes: Type.Optional(Type.Array(Type.String())),
|
|
2424
|
+
edits: Type.Optional(types.appEdits)
|
|
2425
|
+
}),
|
|
2426
|
+
params: Type.Object({ id: Type.String() }),
|
|
2427
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2428
|
+
url: "/app/:id"
|
|
2429
|
+
}, auth_exports = /* @__PURE__ */ __export({
|
|
2430
|
+
authorize: () => authorize,
|
|
2431
|
+
client: () => client,
|
|
2432
|
+
me: () => me,
|
|
2433
|
+
token: () => token
|
|
2434
|
+
}, 1), authorize = {
|
|
2435
|
+
type: ERouteType.Post,
|
|
2436
|
+
body: Type.Object({
|
|
2437
|
+
client_id: Type.String(),
|
|
2438
|
+
redirect_uri: Type.String(),
|
|
2439
|
+
response_type: Type.Literal("code"),
|
|
2440
|
+
scope: Type.Optional(Type.String())
|
|
2441
|
+
}),
|
|
2442
|
+
response: { 200: Type.Object({ authorization_code: Type.String() }) },
|
|
2443
|
+
url: "/auth/authorize"
|
|
2444
|
+
}, token = {
|
|
2445
|
+
type: ERouteType.Post,
|
|
2446
|
+
body: Type.Union([Type.Object({
|
|
2447
|
+
client_id: Type.String(),
|
|
2448
|
+
client_secret: Type.String(),
|
|
2449
|
+
code: Type.String(),
|
|
2450
|
+
grant_type: Type.Literal("authorization_code"),
|
|
2451
|
+
redirect_uri: Type.String()
|
|
2452
|
+
}), Type.Object({
|
|
2453
|
+
client_id: Type.String(),
|
|
2454
|
+
client_secret: Type.String(),
|
|
2455
|
+
grant_type: Type.Literal("refresh_token"),
|
|
2456
|
+
refresh_token: Type.String()
|
|
2457
|
+
})]),
|
|
2458
|
+
response: { 200: Type.Object({
|
|
2459
|
+
access_token: Type.String(),
|
|
2460
|
+
expires_in: Type.Number(),
|
|
2461
|
+
refresh_token: Type.String(),
|
|
2462
|
+
token_type: Type.Literal("Bearer")
|
|
2463
|
+
}) },
|
|
2464
|
+
url: "/auth/token"
|
|
2465
|
+
}, me = {
|
|
2466
|
+
type: ERouteType.Get,
|
|
2467
|
+
headers: Type.Object({ authorization: Type.String() }),
|
|
2468
|
+
response: { 200: Type.Object({
|
|
2469
|
+
id: Type.String(),
|
|
2470
|
+
mail: Type.String()
|
|
2471
|
+
}) },
|
|
2472
|
+
url: "/auth/me"
|
|
2473
|
+
}, client = {
|
|
2474
|
+
type: ERouteType.Get,
|
|
2475
|
+
querystring: Type.Object({
|
|
2476
|
+
client_id: Type.String(),
|
|
2477
|
+
redirect_uri: Type.String()
|
|
2478
|
+
}),
|
|
2479
|
+
response: { 200: Type.Object({ client_name: Type.String() }) },
|
|
2480
|
+
url: "/auth/client"
|
|
2481
|
+
}, integrations_exports = /* @__PURE__ */ __export({ googleAuth: () => googleAuth }, 1), googleAuth = {
|
|
2482
|
+
type: ERouteType.Get,
|
|
2483
|
+
querystring: Type.Object({
|
|
2484
|
+
code: Type.Optional(Type.String()),
|
|
2485
|
+
scope: Type.Optional(Type.String()),
|
|
2486
|
+
state: Type.Optional(Type.String())
|
|
2487
|
+
}),
|
|
2488
|
+
response: { 200: Type.Object({ token: Type.Optional(Type.String()) }) },
|
|
2489
|
+
url: "/integrations/google/auth"
|
|
2490
|
+
}, compiler_exports = /* @__PURE__ */ __export({
|
|
2491
|
+
build: () => build,
|
|
2492
|
+
compile: () => compile$1,
|
|
2493
|
+
download: () => download
|
|
2494
|
+
}, 1), build = {
|
|
2495
|
+
type: ERouteType.Post,
|
|
2496
|
+
body: Type.Object({
|
|
2497
|
+
entry: Type.Optional(Type.String()),
|
|
2498
|
+
key: Type.String(),
|
|
2499
|
+
script: Type.Unknown()
|
|
2500
|
+
}),
|
|
2501
|
+
params: Type.Object({ type: Type.Union([Type.Literal("main"), Type.Literal("logic")]) }),
|
|
2502
|
+
response: { 200: Type.Object({
|
|
2503
|
+
code: Type.String(),
|
|
2504
|
+
message: Type.String()
|
|
2505
|
+
}) },
|
|
2506
|
+
url: "/compiler/build/:type"
|
|
2507
|
+
}, compile$1 = {
|
|
2508
|
+
type: ERouteType.Post,
|
|
2509
|
+
body: Type.Object({
|
|
2510
|
+
platform: Type.Optional(Type.Union([
|
|
2511
|
+
Type.Literal("win32"),
|
|
2512
|
+
Type.Literal("darwin"),
|
|
2513
|
+
Type.Literal("linux")
|
|
2514
|
+
])),
|
|
2515
|
+
target: Type.Union([
|
|
2516
|
+
Type.Literal("source"),
|
|
2517
|
+
Type.Literal("export"),
|
|
2518
|
+
Type.Literal("web"),
|
|
2519
|
+
Type.Literal("desktop")
|
|
2520
|
+
])
|
|
2521
|
+
}),
|
|
2522
|
+
params: Type.Object({ id: Type.String() }),
|
|
2523
|
+
response: { 200: Type.Object({
|
|
2524
|
+
message: Type.String(),
|
|
2525
|
+
target: Type.String()
|
|
2526
|
+
}) },
|
|
2527
|
+
url: "/compiler/compile/:id"
|
|
2528
|
+
}, download = {
|
|
2529
|
+
type: ERouteType.Get,
|
|
2530
|
+
params: Type.Object({
|
|
2531
|
+
id: Type.String(),
|
|
2532
|
+
platform: Type.Optional(Type.Union([
|
|
2533
|
+
Type.Literal("win32-installer"),
|
|
2534
|
+
Type.Literal("darwin-installer"),
|
|
2535
|
+
Type.Literal("linux-installer"),
|
|
2536
|
+
Type.Literal("win32-portable"),
|
|
2537
|
+
Type.Literal("darwin-portable"),
|
|
2538
|
+
Type.Literal("linux-portable")
|
|
2539
|
+
])),
|
|
2540
|
+
target: Type.Union([
|
|
2541
|
+
Type.Literal("source"),
|
|
2542
|
+
Type.Literal("export"),
|
|
2543
|
+
Type.Literal("desktop")
|
|
2544
|
+
])
|
|
2545
|
+
}),
|
|
2546
|
+
response: { 200: Type.Unknown() },
|
|
2547
|
+
url: "/compiler/download/:id/:target/:platform?"
|
|
2548
|
+
}, desktop_exports = /* @__PURE__ */ __export({ latest: () => latest }, 1), latest = {
|
|
2549
|
+
type: ERouteType.Get,
|
|
2550
|
+
dev: !0,
|
|
2551
|
+
querystring: Type.Object({
|
|
2552
|
+
arch: Type.Union([
|
|
2553
|
+
Type.Literal("x86_64"),
|
|
2554
|
+
Type.Literal("i686"),
|
|
2555
|
+
Type.Literal("aarch64"),
|
|
2556
|
+
Type.Literal("armv7")
|
|
2557
|
+
]),
|
|
2558
|
+
target: Type.Union([
|
|
2559
|
+
Type.Literal("windows"),
|
|
2560
|
+
Type.Literal("linux"),
|
|
2561
|
+
Type.Literal("darwin")
|
|
2562
|
+
]),
|
|
2563
|
+
version: Type.Optional(Type.String())
|
|
2564
|
+
}),
|
|
2565
|
+
response: { 200: Type.Object({
|
|
2566
|
+
notes: Type.String(),
|
|
2567
|
+
pub_date: Type.String(),
|
|
2568
|
+
signature: Type.String(),
|
|
2569
|
+
url: Type.String(),
|
|
2570
|
+
version: Type.String()
|
|
2571
|
+
}) },
|
|
2572
|
+
url: "/desktop/release/latest"
|
|
2573
|
+
}, keyConfig_exports = /* @__PURE__ */ __export({
|
|
2574
|
+
check: () => check$1,
|
|
2575
|
+
create: () => create$2,
|
|
2576
|
+
list: () => list$3,
|
|
2577
|
+
remove: () => remove$2
|
|
2578
|
+
}, 1), create$2 = {
|
|
2579
|
+
type: ERouteType.Post,
|
|
2580
|
+
body: Type.Object({ domain: Type.String() }),
|
|
2581
|
+
response: { 200: Type.Object({
|
|
2582
|
+
key: types.keyConfig,
|
|
2583
|
+
message: Type.String()
|
|
2584
|
+
}) },
|
|
2585
|
+
url: "/key-config"
|
|
2586
|
+
}, list$3 = {
|
|
2587
|
+
type: ERouteType.Get,
|
|
2588
|
+
response: { 200: Type.Array(types.keyConfig) },
|
|
2589
|
+
url: "/key-config"
|
|
2590
|
+
}, remove$2 = {
|
|
2591
|
+
type: ERouteType.Delete,
|
|
2592
|
+
params: Type.Object({ id: Type.String() }),
|
|
2593
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2594
|
+
url: "/key-config/:id"
|
|
2595
|
+
}, check$1 = {
|
|
2596
|
+
type: ERouteType.Post,
|
|
2597
|
+
body: Type.Object({
|
|
2598
|
+
domain: Type.String(),
|
|
2599
|
+
key: Type.String()
|
|
2600
|
+
}),
|
|
2601
|
+
dev: !0,
|
|
2602
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2603
|
+
url: "/key-config/check"
|
|
2604
|
+
}, license_exports = /* @__PURE__ */ __export({
|
|
2605
|
+
check: () => check,
|
|
2606
|
+
link: () => link,
|
|
2607
|
+
list: () => list$2,
|
|
2608
|
+
reset: () => reset
|
|
2609
|
+
}, 1), reset = {
|
|
2610
|
+
type: ERouteType.Post,
|
|
2611
|
+
body: Type.Object({ id: Type.String() }),
|
|
2612
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2613
|
+
url: "/license/reset"
|
|
2614
|
+
}, link = {
|
|
2615
|
+
type: ERouteType.Post,
|
|
2616
|
+
body: Type.Object({
|
|
2617
|
+
name: Type.String(),
|
|
2618
|
+
fingerprint: Type.String(),
|
|
2619
|
+
key: Type.String()
|
|
2620
|
+
}),
|
|
2621
|
+
dev: !0,
|
|
2622
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2623
|
+
url: "/license/link"
|
|
2624
|
+
}, check = {
|
|
2625
|
+
type: ERouteType.Post,
|
|
2626
|
+
body: Type.Object({
|
|
2627
|
+
fingerprint: Type.String(),
|
|
2628
|
+
key: Type.String()
|
|
2629
|
+
}),
|
|
2630
|
+
dev: !0,
|
|
2631
|
+
response: { 200: Type.Object({
|
|
2632
|
+
mail: Type.Optional(Type.String()),
|
|
2633
|
+
valid: Type.Boolean(),
|
|
2634
|
+
version: Type.Optional(Type.String())
|
|
2635
|
+
}) },
|
|
2636
|
+
url: "/license/check"
|
|
2637
|
+
}, list$2 = {
|
|
2638
|
+
type: ERouteType.Get,
|
|
2639
|
+
response: { 200: Type.Array(Type.Object({
|
|
2640
|
+
id: Type.String(),
|
|
2641
|
+
name: Type.String(),
|
|
2642
|
+
expirationDate: TypeDate,
|
|
2643
|
+
key: Type.String(),
|
|
2644
|
+
lastUsed: TypeDate,
|
|
2645
|
+
version: Type.String()
|
|
2646
|
+
})) },
|
|
2647
|
+
url: "/license/list"
|
|
2648
|
+
}, magiclink_exports = /* @__PURE__ */ __export({
|
|
2649
|
+
activate: () => activate,
|
|
2650
|
+
create: () => create$1,
|
|
2651
|
+
signup: () => signup
|
|
2652
|
+
}, 1), activate = {
|
|
2653
|
+
type: ERouteType.Get,
|
|
2654
|
+
params: Type.Object({
|
|
2655
|
+
id: Type.String(),
|
|
2656
|
+
token: Type.String()
|
|
2657
|
+
}),
|
|
2658
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2659
|
+
url: "/magiclink/activate/:id/:token"
|
|
2660
|
+
}, create$1 = {
|
|
2661
|
+
type: ERouteType.Post,
|
|
2662
|
+
body: Type.Object({ mail: Type.String({ format: "email" }) }),
|
|
2663
|
+
response: { 200: Type.Object({
|
|
2664
|
+
expirationDate: Type.String(),
|
|
2665
|
+
message: Type.String()
|
|
2666
|
+
}) },
|
|
2667
|
+
url: "/magiclink/create"
|
|
2668
|
+
}, signup = {
|
|
2669
|
+
type: ERouteType.Post,
|
|
2670
|
+
body: Type.Object({ mail: Type.String({ format: "email" }) }),
|
|
2671
|
+
response: { 200: Type.Object({
|
|
2672
|
+
expirationDate: Type.String(),
|
|
2673
|
+
message: Type.String()
|
|
2674
|
+
}) },
|
|
2675
|
+
url: "/magiclink/signup"
|
|
2676
|
+
}, payment_exports = /* @__PURE__ */ __export({
|
|
2677
|
+
checkout: () => checkout,
|
|
2678
|
+
portal: () => portal
|
|
2679
|
+
}, 1), checkout = {
|
|
2680
|
+
type: ERouteType.Post,
|
|
2681
|
+
body: Type.Object({ plan: Type.Union([Type.Literal(EPlanKey.Pro), Type.Literal(EPlanKey.Org)]) }),
|
|
2682
|
+
response: { 200: Type.Object({
|
|
2683
|
+
message: Type.String(),
|
|
2684
|
+
redirection: Type.String()
|
|
2685
|
+
}) },
|
|
2686
|
+
url: "/payment/checkout"
|
|
2687
|
+
}, portal = {
|
|
2688
|
+
type: ERouteType.Post,
|
|
2689
|
+
response: { 200: Type.Object({
|
|
2690
|
+
message: Type.String(),
|
|
2691
|
+
redirection: Type.String()
|
|
2692
|
+
}) },
|
|
2693
|
+
url: "/payment/portal"
|
|
2694
|
+
}, project_exports = /* @__PURE__ */ __export({
|
|
2695
|
+
create: () => create,
|
|
2696
|
+
edit: () => edit,
|
|
2697
|
+
list: () => list$1,
|
|
2698
|
+
proxy: () => proxy,
|
|
2699
|
+
remove: () => remove$1,
|
|
2700
|
+
star: () => star
|
|
2701
|
+
}, 1), create = {
|
|
2702
|
+
type: ERouteType.Post,
|
|
2703
|
+
body: Type.Object({
|
|
2704
|
+
title: Type.String(),
|
|
2705
|
+
icon: Type.String(),
|
|
2706
|
+
template: Type.Union([
|
|
2707
|
+
Type.Literal("default"),
|
|
2708
|
+
Type.Literal("empty"),
|
|
2709
|
+
Type.Literal("frontend"),
|
|
2710
|
+
Type.Literal("backend"),
|
|
2711
|
+
Type.Literal("database"),
|
|
2712
|
+
Type.Literal("testing")
|
|
2713
|
+
])
|
|
2714
|
+
}),
|
|
2715
|
+
response: { 200: Type.Object({
|
|
2716
|
+
message: Type.String(),
|
|
2717
|
+
project: types.publicProject
|
|
2718
|
+
}) },
|
|
2719
|
+
url: "/project/create"
|
|
2720
|
+
}, list$1 = {
|
|
2721
|
+
type: ERouteType.Get,
|
|
2722
|
+
params: Type.Object({ type: Type.Union([
|
|
2723
|
+
Type.Literal("mine"),
|
|
2724
|
+
Type.Literal("popular"),
|
|
2725
|
+
Type.Literal("newest"),
|
|
2726
|
+
Type.Literal("random"),
|
|
2727
|
+
Type.Literal("search")
|
|
2728
|
+
]) }),
|
|
2729
|
+
querystring: Type.Object({
|
|
2730
|
+
limit: Type.Optional(Type.Number()),
|
|
2731
|
+
search: Type.Optional(Type.String()),
|
|
2732
|
+
skip: Type.Optional(Type.Number())
|
|
2733
|
+
}),
|
|
2734
|
+
response: { 200: Type.Object({ projects: Type.Array(types.publicProject) }) },
|
|
2735
|
+
url: "/project/list/:type"
|
|
2736
|
+
}, remove$1 = {
|
|
2737
|
+
type: ERouteType.Delete,
|
|
2738
|
+
params: Type.Object({ id: Type.String() }),
|
|
2739
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2740
|
+
url: "/project/remove/:id"
|
|
2741
|
+
}, edit = {
|
|
2742
|
+
type: ERouteType.Post,
|
|
2743
|
+
body: types.privateProject,
|
|
2744
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2745
|
+
url: "/project/edit"
|
|
2746
|
+
}, star = {
|
|
2747
|
+
type: ERouteType.Post,
|
|
2748
|
+
body: Type.Object({
|
|
2749
|
+
id: Type.String(),
|
|
2750
|
+
like: Type.Boolean()
|
|
2751
|
+
}),
|
|
2752
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2753
|
+
url: "/project/star"
|
|
2754
|
+
}, proxy = {
|
|
2755
|
+
type: ERouteType.Post,
|
|
2756
|
+
body: Type.Object({
|
|
2757
|
+
body: Type.Optional(Type.Unknown()),
|
|
2758
|
+
headers: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
2759
|
+
method: Type.Optional(Type.Union([
|
|
2760
|
+
Type.Literal("GET"),
|
|
2761
|
+
Type.Literal("POST"),
|
|
2762
|
+
Type.Literal("PUT"),
|
|
2763
|
+
Type.Literal("DELETE")
|
|
2764
|
+
])),
|
|
2765
|
+
url: Type.String({ format: "uri" })
|
|
2766
|
+
}),
|
|
2767
|
+
response: { 200: Type.Unknown() },
|
|
2768
|
+
url: "/project/proxy"
|
|
2769
|
+
}, script_exports = /* @__PURE__ */ __export({
|
|
2770
|
+
compile: () => compile,
|
|
2771
|
+
get: () => get$1,
|
|
2772
|
+
update: () => update$1
|
|
2773
|
+
}, 1), get$1 = {
|
|
2774
|
+
type: ERouteType.Get,
|
|
2775
|
+
params: Type.Object({
|
|
2776
|
+
id: Type.String(),
|
|
2777
|
+
script: Type.String()
|
|
2778
|
+
}),
|
|
2779
|
+
response: { 200: Type.String() },
|
|
2780
|
+
url: "/script/:id/:script"
|
|
2781
|
+
}, compile = {
|
|
2782
|
+
type: ERouteType.Post,
|
|
2783
|
+
params: Type.Object({
|
|
2784
|
+
id: Type.String(),
|
|
2785
|
+
script: Type.String()
|
|
2786
|
+
}),
|
|
2787
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2788
|
+
url: "/script/:id/:script/compile"
|
|
2789
|
+
}, update$1 = {
|
|
2790
|
+
type: ERouteType.Post,
|
|
2791
|
+
body: Type.Object({ autoReload: Type.Optional(Type.Boolean()) }),
|
|
2792
|
+
params: Type.Object({
|
|
2793
|
+
id: Type.String(),
|
|
2794
|
+
script: Type.String()
|
|
2795
|
+
}),
|
|
2796
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2797
|
+
url: "/script/:id/:script/update"
|
|
2798
|
+
}, file_exports = /* @__PURE__ */ __export({
|
|
2799
|
+
list: () => list,
|
|
2800
|
+
remove: () => remove,
|
|
2801
|
+
status: () => status,
|
|
2802
|
+
upload: () => upload
|
|
2803
|
+
}, 1), upload = {
|
|
2804
|
+
type: ERouteType.Post,
|
|
2805
|
+
body: Type.Object({
|
|
2806
|
+
file: Type.Object({
|
|
2807
|
+
filename: Type.String(),
|
|
2808
|
+
mimetype: Type.String()
|
|
2809
|
+
}),
|
|
2810
|
+
project: Type.Object({ value: Type.String() })
|
|
2811
|
+
}),
|
|
2812
|
+
multipart: !0,
|
|
2813
|
+
response: { 200: Type.Object({
|
|
2814
|
+
name: Type.String(),
|
|
2815
|
+
mimeType: Type.String(),
|
|
2816
|
+
target: Type.String()
|
|
2817
|
+
}) },
|
|
2818
|
+
url: "/file/upload"
|
|
2819
|
+
}, remove = {
|
|
2820
|
+
type: ERouteType.Post,
|
|
2821
|
+
body: Type.Object({ target: Type.String() }),
|
|
2822
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2823
|
+
url: "/file/remove"
|
|
2824
|
+
}, list = {
|
|
2825
|
+
type: ERouteType.Get,
|
|
2826
|
+
querystring: Type.Object({
|
|
2827
|
+
limit: Type.Optional(Type.String()),
|
|
2828
|
+
search: Type.Optional(Type.String()),
|
|
2829
|
+
skip: Type.Optional(Type.String())
|
|
2830
|
+
}),
|
|
2831
|
+
response: { 200: Type.Object({
|
|
2832
|
+
result: Type.Array(Type.Object({
|
|
2833
|
+
id: Type.String(),
|
|
2834
|
+
name: Type.String(),
|
|
2835
|
+
mimeType: Type.String(),
|
|
2836
|
+
project: Type.Object({
|
|
2837
|
+
id: Type.String(),
|
|
2838
|
+
name: Type.String(),
|
|
2839
|
+
icon: Type.String()
|
|
2840
|
+
}),
|
|
2841
|
+
size: Type.Number(),
|
|
2842
|
+
target: Type.String()
|
|
2843
|
+
})),
|
|
2844
|
+
total: Type.Number()
|
|
2845
|
+
}) },
|
|
2846
|
+
url: "/file/list"
|
|
2847
|
+
}, status = {
|
|
2848
|
+
type: ERouteType.Get,
|
|
2849
|
+
response: { 200: Type.Object({
|
|
2850
|
+
limit: Type.Number(),
|
|
2851
|
+
total: Type.Number()
|
|
2852
|
+
}) },
|
|
2853
|
+
url: "/file/status"
|
|
2854
|
+
}, turnstile_exports = /* @__PURE__ */ __export({ tick: () => tick }, 1), tick = {
|
|
2855
|
+
type: ERouteType.Post,
|
|
2856
|
+
body: Type.Object({
|
|
2857
|
+
data: Type.Optional(Type.Unknown()),
|
|
2858
|
+
scope: Type.String()
|
|
2859
|
+
}),
|
|
2860
|
+
response: { 200: Type.Object({}) },
|
|
2861
|
+
url: "/turnstile/tick"
|
|
2862
|
+
}, user_exports = /* @__PURE__ */ __export({
|
|
2863
|
+
disconnect: () => disconnect,
|
|
2864
|
+
get: () => get,
|
|
2865
|
+
ping: () => ping,
|
|
2866
|
+
unsubscribe: () => unsubscribe,
|
|
2867
|
+
update: () => update,
|
|
2868
|
+
waitlist: () => waitlist
|
|
2869
|
+
}, 1), ping = {
|
|
2870
|
+
type: ERouteType.Get,
|
|
2871
|
+
response: { 200: Type.Object({
|
|
2872
|
+
message: Type.String(),
|
|
2873
|
+
user: Type.Optional(types.user)
|
|
2874
|
+
}) },
|
|
2875
|
+
url: "/user/ping"
|
|
2876
|
+
}, get = {
|
|
2877
|
+
type: ERouteType.Get,
|
|
2878
|
+
response: { 200: types.user },
|
|
2879
|
+
url: "/user"
|
|
2880
|
+
}, update = {
|
|
2881
|
+
type: ERouteType.Post,
|
|
2882
|
+
body: Type.Partial(types.user),
|
|
2883
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2884
|
+
url: "/user"
|
|
2885
|
+
}, disconnect = {
|
|
2886
|
+
type: ERouteType.Get,
|
|
2887
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2888
|
+
url: "/user/disconnect"
|
|
2889
|
+
}, waitlist = {
|
|
2890
|
+
type: ERouteType.Post,
|
|
2891
|
+
body: Type.Object({ mail: Type.String({ format: "email" }) }),
|
|
2892
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2893
|
+
url: "/user/waitlist"
|
|
2894
|
+
}, unsubscribe = {
|
|
2895
|
+
type: ERouteType.Post,
|
|
2896
|
+
body: Type.Object({ id: Type.String() }),
|
|
2897
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
2898
|
+
url: "/user/unsubscribe"
|
|
2899
|
+
}, routes = {
|
|
2900
|
+
ai: ai_exports,
|
|
2901
|
+
app: app_exports,
|
|
2902
|
+
auth: auth_exports,
|
|
2903
|
+
compiler: compiler_exports,
|
|
2904
|
+
desktop: desktop_exports,
|
|
2905
|
+
file: file_exports,
|
|
2906
|
+
integrations: integrations_exports,
|
|
2907
|
+
keyConfig: keyConfig_exports,
|
|
2908
|
+
license: license_exports,
|
|
2909
|
+
magiclink: magiclink_exports,
|
|
2910
|
+
payment: payment_exports,
|
|
2911
|
+
project: project_exports,
|
|
2912
|
+
script: script_exports,
|
|
2913
|
+
turnstile: turnstile_exports,
|
|
2914
|
+
user: user_exports
|
|
2915
|
+
}, api = {};
|
|
2916
|
+
for (let y of Object.keys(routes)) {
|
|
2917
|
+
api[y] = {};
|
|
2918
|
+
for (let J of Object.keys(routes[y])) {
|
|
2919
|
+
let Y = routes[y][J];
|
|
2920
|
+
api[y][J] = async (y = {}) => {
|
|
2921
|
+
let J = new URL(api_default$1.getBaseUrl({ dev: Y.dev }) + Y.url);
|
|
2922
|
+
if (Y.params && y.params) for (let X of Object.keys(Y.params.properties)) J.href = J.href.replace(`:${X}`, y.params[X]);
|
|
2923
|
+
if (y.querystring) for (let Y of Object.keys(y.querystring)) y.querystring[Y] && J.searchParams.append(Y, y.querystring[Y].toString());
|
|
2924
|
+
let X = api_default$1[Y.type];
|
|
2925
|
+
Y.multipart && (X = api_default$1.multipart);
|
|
2926
|
+
let Z = await X(J.href, y.body), Q = await getContent(Z);
|
|
2927
|
+
if (Z.status >= 400) throw Error(`Error ${Z.status} (${Z.statusText}): ${Q.message || Q}`);
|
|
2928
|
+
return Q;
|
|
2929
|
+
};
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
function getContent(y) {
|
|
2933
|
+
return y.headers.get("Content-Type")?.startsWith("application/json") ? y.json() : y.text();
|
|
2934
|
+
}
|
|
2935
|
+
function makePlugin(y) {
|
|
2936
|
+
return y;
|
|
2937
|
+
}
|
|
2938
|
+
function makeComponent(y) {
|
|
2939
|
+
return y;
|
|
2940
|
+
}
|
|
2941
|
+
async function loadPlugin(y, J) {
|
|
2942
|
+
let Y = cloneWithFunctions(y), X = J.app?.config?.plugins?.[y.id]?.config;
|
|
2943
|
+
for (let y of [
|
|
2944
|
+
"build",
|
|
2945
|
+
"editor",
|
|
2946
|
+
"inject"
|
|
2947
|
+
]) if (Y[y]) for (let Z in Y[y]) Y[y][Z] = await getPluginParam(Y[y][Z], {
|
|
2948
|
+
...J,
|
|
2949
|
+
config: X
|
|
2950
|
+
});
|
|
2951
|
+
return Y;
|
|
2952
|
+
}
|
|
2953
|
+
async function getPluginParam(y, J) {
|
|
2954
|
+
return typeof y == "function" ? y({
|
|
2955
|
+
addFile: J.addFile,
|
|
2956
|
+
app: J.app,
|
|
2957
|
+
config: J.config,
|
|
2958
|
+
internals: J.internals,
|
|
2959
|
+
mode: J.mode || "editor"
|
|
2960
|
+
}) : y;
|
|
2961
|
+
}
|
|
2962
|
+
export { EElementType, EInjectionKey, ELogicScope, ELogicType, ETokenType, EVarType, LSettingsStoryWrapper_default as LSettingsStoryWrapper, LogicType, LogicUtil, getPluginParam, loadPlugin, makeComponent, makeLogicNode, makePlugin };
|