@powerlines/deepkit 0.6.166 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/deepkit-install.cjs +55 -90
- package/dist/capnp-BLx1WTBU.cjs +5175 -0
- package/dist/capnp-BiGNkOmV.mjs +4905 -0
- package/dist/capnp.cjs +47 -186
- package/dist/capnp.d.cts +78 -77
- package/dist/{capnp.d.ts → capnp.d.mts} +78 -77
- package/dist/capnp.mjs +3 -0
- package/dist/chunk-C0xms8kb.cjs +34 -0
- package/dist/esbuild-plugin.cjs +47 -11
- package/dist/esbuild-plugin.d.cts +20 -18
- package/dist/esbuild-plugin.d.mts +35 -0
- package/dist/esbuild-plugin.mjs +48 -0
- package/dist/index.cjs +69 -250
- package/dist/index.d.cts +10 -19
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +11 -0
- package/dist/reflect-type.cjs +24 -12
- package/dist/reflect-type.d.cts +7 -5
- package/dist/{reflect-type.d.ts → reflect-type.d.mts} +7 -5
- package/dist/reflect-type.mjs +24 -0
- package/dist/{reflection-9KUpjPqV.d.cts → reflection-BwdnCwaK.d.cts} +11 -17
- package/dist/{reflection-9KUpjPqV.d.ts → reflection-D9R8cdSo.d.mts} +26 -32
- package/dist/resolve-reflections.cjs +15 -9
- package/dist/resolve-reflections.d.cts +4 -2
- package/dist/{resolve-reflections.d.ts → resolve-reflections.d.mts} +4 -2
- package/dist/resolve-reflections.mjs +16 -0
- package/dist/rolldown-plugin.cjs +44 -11
- package/dist/rolldown-plugin.d.cts +5 -3
- package/dist/{rolldown-plugin.d.ts → rolldown-plugin.d.mts} +5 -3
- package/dist/rolldown-plugin.mjs +45 -0
- package/dist/transformer.cjs +52 -13
- package/dist/transformer.d.cts +6 -4
- package/dist/{transformer.d.ts → transformer.d.mts} +6 -4
- package/dist/transformer.mjs +51 -0
- package/dist/transpile.cjs +29 -10
- package/dist/transpile.d.cts +6 -4
- package/dist/{transpile.d.ts → transpile.d.mts} +6 -4
- package/dist/transpile.mjs +29 -0
- package/dist/types.cjs +0 -4
- package/dist/types.d.cts +9 -9
- package/dist/{types.d.ts → types.d.mts} +9 -9
- package/dist/types.mjs +1 -0
- package/dist/utilities.cjs +116 -33
- package/dist/utilities.d.cts +4 -2
- package/dist/{utilities.d.ts → utilities.d.mts} +4 -2
- package/dist/utilities.mjs +111 -0
- package/dist/vendor/core.cjs +1240 -513
- package/dist/vendor/core.mjs +1116 -0
- package/dist/vendor/string-BoXo0wS7.cjs +2983 -0
- package/dist/vendor/string-BuMgdahD.mjs +2467 -0
- package/dist/vendor/type-BMLjRtLY.cjs +202 -0
- package/dist/vendor/type-Dgeqs-rL.mjs +190 -0
- package/dist/vendor/type-compiler/compiler-BUrWMhGi.cjs +6792 -0
- package/dist/vendor/type-compiler/compiler-Bg8jX6qU.mjs +6739 -0
- package/dist/vendor/type-compiler/compiler-D1z5h1MK.d.cts +578 -0
- package/dist/vendor/type-compiler/compiler-Nkxc4PLJ.d.mts +578 -0
- package/dist/vendor/type-compiler/compiler.cjs +11 -43
- package/dist/vendor/type-compiler/compiler.d.cts +2 -3
- package/dist/vendor/type-compiler/compiler.d.mts +2 -0
- package/dist/vendor/type-compiler/compiler.mjs +3 -0
- package/dist/vendor/type-compiler/config-BEX924PC.cjs +3709 -0
- package/dist/vendor/type-compiler/config-B_cKkYZm.d.cts +116 -0
- package/dist/vendor/type-compiler/config-D9DM7Du_.d.mts +116 -0
- package/dist/vendor/type-compiler/config-y0HNkbCH.mjs +3640 -0
- package/dist/vendor/type-compiler/config.cjs +9 -34
- package/dist/vendor/type-compiler/config.d.cts +2 -1
- package/dist/vendor/type-compiler/config.d.mts +2 -0
- package/dist/vendor/type-compiler/config.mjs +3 -0
- package/dist/vendor/type-compiler/index.cjs +56 -129
- package/dist/vendor/type-compiler/index.d.cts +22 -3
- package/dist/vendor/type-compiler/index.d.mts +22 -0
- package/dist/vendor/type-compiler/index.mjs +50 -0
- package/dist/vendor/type-spec.cjs +11 -12
- package/dist/vendor/type-spec.mjs +3 -0
- package/dist/vendor/type.cjs +8407 -17892
- package/dist/vendor/type.d.cts +10 -196
- package/dist/vendor/{type.d.ts → type.d.mts} +10 -196
- package/dist/vendor/type.mjs +9109 -0
- package/package.json +43 -31
- package/schemas/reflection.cjs +4018 -4129
- package/schemas/reflection.d.cts +30 -38
- package/schemas/{reflection.d.ts → reflection.d.mts} +30 -38
- package/schemas/reflection.mjs +4036 -0
- package/dist/capnp.js +0 -2
- package/dist/chunk-23YNDVRG.js +0 -34
- package/dist/chunk-27RKMKSF.cjs +0 -50
- package/dist/chunk-2XDQUCXZ.js +0 -2392
- package/dist/chunk-34OFD7LS.cjs +0 -68
- package/dist/chunk-7FXYDYVQ.cjs +0 -5246
- package/dist/chunk-7QZGCBH7.cjs +0 -11
- package/dist/chunk-ALM6UMVU.js +0 -9
- package/dist/chunk-BLLXF42T.cjs +0 -41
- package/dist/chunk-H3Q3XL3D.js +0 -19
- package/dist/chunk-HPVJ6OV3.cjs +0 -31
- package/dist/chunk-JQUKKAFM.js +0 -48
- package/dist/chunk-KK7TQA7L.cjs +0 -25
- package/dist/chunk-NPV2346T.js +0 -25
- package/dist/chunk-ORA4UQMU.cjs +0 -2
- package/dist/chunk-OUGDFUKJ.cjs +0 -2400
- package/dist/chunk-OULCUN6I.js +0 -1
- package/dist/chunk-SHUYVCID.js +0 -4
- package/dist/chunk-TDYIUJGY.js +0 -5180
- package/dist/chunk-USNT2KNT.cjs +0 -6
- package/dist/chunk-WYEFKIRL.js +0 -66
- package/dist/esbuild-plugin.d.ts +0 -33
- package/dist/esbuild-plugin.js +0 -4
- package/dist/index.d.ts +0 -19
- package/dist/index.js +0 -10
- package/dist/reflect-type.js +0 -5
- package/dist/resolve-reflections.js +0 -2
- package/dist/rolldown-plugin.js +0 -4
- package/dist/transformer.js +0 -2
- package/dist/transpile.js +0 -3
- package/dist/types.js +0 -1
- package/dist/utilities.js +0 -2
- package/dist/vendor/chunk-5BKT4CS5.js +0 -28
- package/dist/vendor/chunk-BLN7QVCP.js +0 -3704
- package/dist/vendor/chunk-BR2FK5K7.js +0 -109
- package/dist/vendor/chunk-EPQZMVJO.cjs +0 -3859
- package/dist/vendor/chunk-IFK6AU6M.cjs +0 -42
- package/dist/vendor/chunk-SHDAXCXF.cjs +0 -115
- package/dist/vendor/core.js +0 -2
- package/dist/vendor/type-compiler/chunk-3LL3TSRJ.js +0 -3762
- package/dist/vendor/type-compiler/chunk-CUTGHVNY.js +0 -7100
- package/dist/vendor/type-compiler/chunk-IAWCLVUK.cjs +0 -3780
- package/dist/vendor/type-compiler/chunk-UIWPG352.cjs +0 -7114
- package/dist/vendor/type-compiler/compiler.d.ts +0 -3
- package/dist/vendor/type-compiler/compiler.js +0 -5
- package/dist/vendor/type-compiler/config.d.ts +0 -1
- package/dist/vendor/type-compiler/config.js +0 -5
- package/dist/vendor/type-compiler/index.d.ts +0 -3
- package/dist/vendor/type-compiler/index.js +0 -66
- package/dist/vendor/type-spec.js +0 -2
- package/dist/vendor/type.js +0 -18359
- package/schemas/reflection.js +0 -4153
- /package/dist/vendor/{core.d.ts → core.d.mts} +0 -0
- /package/dist/vendor/{type-spec.d.ts → type-spec.d.mts} +0 -0
|
@@ -0,0 +1,2467 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
14
|
+
__defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region ../../node_modules/.pnpm/is-obj@2.0.0/node_modules/is-obj/index.js
|
|
30
|
+
var require_is_obj = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31
|
+
module.exports = (value) => {
|
|
32
|
+
const type = typeof value;
|
|
33
|
+
return value !== null && (type === "object" || type === "function");
|
|
34
|
+
};
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region ../../node_modules/.pnpm/dot-prop@5.3.0/node_modules/dot-prop/index.js
|
|
39
|
+
var require_dot_prop = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
40
|
+
const isObj = require_is_obj();
|
|
41
|
+
const disallowedKeys = [
|
|
42
|
+
"__proto__",
|
|
43
|
+
"prototype",
|
|
44
|
+
"constructor"
|
|
45
|
+
];
|
|
46
|
+
const isValidPath = (pathSegments) => !pathSegments.some((segment) => disallowedKeys.includes(segment));
|
|
47
|
+
function getPathSegments(path) {
|
|
48
|
+
const pathArray = path.split(".");
|
|
49
|
+
const parts = [];
|
|
50
|
+
for (let i = 0; i < pathArray.length; i++) {
|
|
51
|
+
let p = pathArray[i];
|
|
52
|
+
while (p[p.length - 1] === "\\" && pathArray[i + 1] !== void 0) {
|
|
53
|
+
p = p.slice(0, -1) + ".";
|
|
54
|
+
p += pathArray[++i];
|
|
55
|
+
}
|
|
56
|
+
parts.push(p);
|
|
57
|
+
}
|
|
58
|
+
if (!isValidPath(parts)) return [];
|
|
59
|
+
return parts;
|
|
60
|
+
}
|
|
61
|
+
module.exports = {
|
|
62
|
+
get(object, path, value) {
|
|
63
|
+
if (!isObj(object) || typeof path !== "string") return value === void 0 ? object : value;
|
|
64
|
+
const pathArray = getPathSegments(path);
|
|
65
|
+
if (pathArray.length === 0) return;
|
|
66
|
+
for (let i = 0; i < pathArray.length; i++) {
|
|
67
|
+
if (!Object.prototype.propertyIsEnumerable.call(object, pathArray[i])) return value;
|
|
68
|
+
object = object[pathArray[i]];
|
|
69
|
+
if (object === void 0 || object === null) {
|
|
70
|
+
if (i !== pathArray.length - 1) return value;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return object;
|
|
75
|
+
},
|
|
76
|
+
set(object, path, value) {
|
|
77
|
+
if (!isObj(object) || typeof path !== "string") return object;
|
|
78
|
+
const root = object;
|
|
79
|
+
const pathArray = getPathSegments(path);
|
|
80
|
+
for (let i = 0; i < pathArray.length; i++) {
|
|
81
|
+
const p = pathArray[i];
|
|
82
|
+
if (!isObj(object[p])) object[p] = {};
|
|
83
|
+
if (i === pathArray.length - 1) object[p] = value;
|
|
84
|
+
object = object[p];
|
|
85
|
+
}
|
|
86
|
+
return root;
|
|
87
|
+
},
|
|
88
|
+
delete(object, path) {
|
|
89
|
+
if (!isObj(object) || typeof path !== "string") return false;
|
|
90
|
+
const pathArray = getPathSegments(path);
|
|
91
|
+
for (let i = 0; i < pathArray.length; i++) {
|
|
92
|
+
const p = pathArray[i];
|
|
93
|
+
if (i === pathArray.length - 1) {
|
|
94
|
+
delete object[p];
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
object = object[p];
|
|
98
|
+
if (!isObj(object)) return false;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
has(object, path) {
|
|
102
|
+
if (!isObj(object) || typeof path !== "string") return false;
|
|
103
|
+
const pathArray = getPathSegments(path);
|
|
104
|
+
if (pathArray.length === 0) return false;
|
|
105
|
+
for (let i = 0; i < pathArray.length; i++) if (isObj(object)) {
|
|
106
|
+
if (!(pathArray[i] in object)) return false;
|
|
107
|
+
object = object[pathArray[i]];
|
|
108
|
+
} else return false;
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}));
|
|
113
|
+
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region ../../node_modules/.pnpm/@deepkit+core@1.0.5_patch_hash=8c3beca4372c6a8941162780ddd0f977ef3d461c2018f0809f86f416260ba440/node_modules/@deepkit/core/dist/esm/src/iterators.js
|
|
116
|
+
const __ΩArrayLike = [
|
|
117
|
+
"T",
|
|
118
|
+
"length",
|
|
119
|
+
"ArrayLike",
|
|
120
|
+
"b!P'4\"9'e\"!LMw#y"
|
|
121
|
+
];
|
|
122
|
+
const __ΩIterableIterator$1 = [
|
|
123
|
+
"T",
|
|
124
|
+
"TReturn",
|
|
125
|
+
"TNext",
|
|
126
|
+
() => __ΩIterator$1,
|
|
127
|
+
0,
|
|
128
|
+
() => Symbol.iterator,
|
|
129
|
+
"IterableIterator",
|
|
130
|
+
"b!\"c\"\"c#Pe\"!e\"\"e\"#o$$Pe#!e#\"e##o%$1&Mw'y"
|
|
131
|
+
];
|
|
132
|
+
const __ΩIterator$1 = [
|
|
133
|
+
"T",
|
|
134
|
+
"TReturn",
|
|
135
|
+
"TNext",
|
|
136
|
+
"param0",
|
|
137
|
+
() => __ΩIteratorResult$1,
|
|
138
|
+
"next",
|
|
139
|
+
"value",
|
|
140
|
+
() => __ΩIteratorResult$1,
|
|
141
|
+
"return",
|
|
142
|
+
"e",
|
|
143
|
+
() => __ΩIteratorResult$1,
|
|
144
|
+
"throw",
|
|
145
|
+
"Iterator",
|
|
146
|
+
"b!\"c\"\"c#PPPPGPe%#GJ@2$e#!e#\"o%#1&Pe#\"2'8e#!e#\"o(#1)P\"2*8e#!e#\"o+#1,Mw-y"
|
|
147
|
+
];
|
|
148
|
+
const __ΩIteratorResult$1 = [
|
|
149
|
+
"T",
|
|
150
|
+
"TReturn",
|
|
151
|
+
() => __ΩIteratorYieldResult$1,
|
|
152
|
+
() => __ΩIteratorReturnResult$1,
|
|
153
|
+
"IteratorResult",
|
|
154
|
+
"b!\"c\"Pe\"!o#\"e\"\"o$\"Jw%y"
|
|
155
|
+
];
|
|
156
|
+
const __ΩIteratorYieldResult$1 = [
|
|
157
|
+
"TYield",
|
|
158
|
+
false,
|
|
159
|
+
"done",
|
|
160
|
+
"value",
|
|
161
|
+
"IteratorYieldResult",
|
|
162
|
+
"b!P.\"4#8e\"!4$Mw%y"
|
|
163
|
+
];
|
|
164
|
+
const __ΩIteratorReturnResult$1 = [
|
|
165
|
+
"TReturn",
|
|
166
|
+
true,
|
|
167
|
+
"done",
|
|
168
|
+
"value",
|
|
169
|
+
"IteratorReturnResult",
|
|
170
|
+
"b!P.\"4#e\"!4$Mw%y"
|
|
171
|
+
];
|
|
172
|
+
eachKey.__type = [
|
|
173
|
+
() => __ΩArrayLike,
|
|
174
|
+
"object",
|
|
175
|
+
() => __ΩIterableIterator$1,
|
|
176
|
+
"eachKey",
|
|
177
|
+
"P\"o!\"2\"'o#\"/$"
|
|
178
|
+
];
|
|
179
|
+
eachKey.__type = [
|
|
180
|
+
"object",
|
|
181
|
+
() => __ΩIterableIterator$1,
|
|
182
|
+
"eachKey",
|
|
183
|
+
"P\"2!&o\"\"/#"
|
|
184
|
+
];
|
|
185
|
+
/** @public */
|
|
186
|
+
function* eachKey(object) {
|
|
187
|
+
if (Array.isArray(object)) for (let i = 0; i < object.length; i++) yield i;
|
|
188
|
+
else for (const i in object) if (object.hasOwnProperty(i)) yield i;
|
|
189
|
+
}
|
|
190
|
+
eachKey.__type = [
|
|
191
|
+
() => __ΩArrayLike,
|
|
192
|
+
"object",
|
|
193
|
+
() => __ΩIterableIterator$1,
|
|
194
|
+
"eachKey",
|
|
195
|
+
"PP\"\"o!\"J2\"P&'Jo#\"/$"
|
|
196
|
+
];
|
|
197
|
+
/**
|
|
198
|
+
* Iterator for each value of an array or object.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```
|
|
202
|
+
* for (const v of each(['a', 'b']) {
|
|
203
|
+
* console.log(v); //a, b
|
|
204
|
+
* }
|
|
205
|
+
* ```
|
|
206
|
+
*
|
|
207
|
+
* @public
|
|
208
|
+
* @category iterator
|
|
209
|
+
*/
|
|
210
|
+
function* each(object) {
|
|
211
|
+
if (Array.isArray(object)) for (let i = 0; i < object.length; i++) yield object[i];
|
|
212
|
+
else for (const i in object) if (object.hasOwnProperty(i)) yield object[i];
|
|
213
|
+
}
|
|
214
|
+
each.__type = [
|
|
215
|
+
() => __ΩArrayLike,
|
|
216
|
+
"object",
|
|
217
|
+
() => __ΩIterableIterator$1,
|
|
218
|
+
"each",
|
|
219
|
+
"PPP&\"LM\"o!\"J2\"\"o#\"/$"
|
|
220
|
+
];
|
|
221
|
+
eachPair.__type = [
|
|
222
|
+
() => __ΩArrayLike,
|
|
223
|
+
"object",
|
|
224
|
+
() => __ΩIterableIterator$1,
|
|
225
|
+
"eachPair",
|
|
226
|
+
"P\"o!\"2\"P'\"Go#\"/$"
|
|
227
|
+
];
|
|
228
|
+
eachPair.__type = [
|
|
229
|
+
"object",
|
|
230
|
+
() => __ΩIterableIterator$1,
|
|
231
|
+
"eachPair",
|
|
232
|
+
"PP&\"LM2!P&\"Go\"\"/#"
|
|
233
|
+
];
|
|
234
|
+
/** @public */
|
|
235
|
+
function* eachPair(object) {
|
|
236
|
+
if (Array.isArray(object)) for (let i = 0; i < object.length; i++) yield [i, object[i]];
|
|
237
|
+
else for (const i in object) if (object.hasOwnProperty(i)) yield [i, object[i]];
|
|
238
|
+
}
|
|
239
|
+
eachPair.__type = [
|
|
240
|
+
() => __ΩArrayLike,
|
|
241
|
+
"object",
|
|
242
|
+
() => __ΩIterableIterator$1,
|
|
243
|
+
"eachPair",
|
|
244
|
+
"PPP&\"LM\"o!\"J2\"PP&\"GP'\"GJo#\"/$"
|
|
245
|
+
];
|
|
246
|
+
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region ../../node_modules/.pnpm/@deepkit+core@1.0.5_patch_hash=8c3beca4372c6a8941162780ddd0f977ef3d461c2018f0809f86f416260ba440/node_modules/@deepkit/core/dist/esm/src/core.js
|
|
249
|
+
var import_dot_prop = /* @__PURE__ */ __toESM(require_dot_prop(), 1);
|
|
250
|
+
const __ΩObject = [
|
|
251
|
+
() => Function,
|
|
252
|
+
"constructor",
|
|
253
|
+
"toString",
|
|
254
|
+
"toLocaleString",
|
|
255
|
+
0,
|
|
256
|
+
"valueOf",
|
|
257
|
+
() => __ΩPropertyKey,
|
|
258
|
+
"v",
|
|
259
|
+
"hasOwnProperty",
|
|
260
|
+
0,
|
|
261
|
+
"isPrototypeOf",
|
|
262
|
+
() => __ΩPropertyKey,
|
|
263
|
+
"propertyIsEnumerable",
|
|
264
|
+
"Object",
|
|
265
|
+
"PPu!4\"P&1#P&1$Pn%1&Pn'2()1)Pn*2()1+Pn,2()1-Mw.y"
|
|
266
|
+
];
|
|
267
|
+
const __ΩError = [
|
|
268
|
+
"name",
|
|
269
|
+
"message",
|
|
270
|
+
"stack",
|
|
271
|
+
"Error",
|
|
272
|
+
"P&4!&4\"&4#8Mw$y"
|
|
273
|
+
];
|
|
274
|
+
const __ΩIterableIterator = [
|
|
275
|
+
"T",
|
|
276
|
+
"TReturn",
|
|
277
|
+
"TNext",
|
|
278
|
+
() => __ΩIterator,
|
|
279
|
+
0,
|
|
280
|
+
() => Symbol.iterator,
|
|
281
|
+
"IterableIterator",
|
|
282
|
+
"b!\"c\"\"c#Pe\"!e\"\"e\"#o$$Pe#!e#\"e##o%$1&Mw'y"
|
|
283
|
+
];
|
|
284
|
+
const __ΩPropertyKey = ["PropertyKey", "P&'+Jw!y"];
|
|
285
|
+
const __ΩIterator = [
|
|
286
|
+
"T",
|
|
287
|
+
"TReturn",
|
|
288
|
+
"TNext",
|
|
289
|
+
"param0",
|
|
290
|
+
() => __ΩIteratorResult,
|
|
291
|
+
"next",
|
|
292
|
+
"value",
|
|
293
|
+
() => __ΩIteratorResult,
|
|
294
|
+
"return",
|
|
295
|
+
"e",
|
|
296
|
+
() => __ΩIteratorResult,
|
|
297
|
+
"throw",
|
|
298
|
+
"Iterator",
|
|
299
|
+
"b!\"c\"\"c#PPPPGPe%#GJ@2$e#!e#\"o%#1&Pe#\"2'8e#!e#\"o(#1)P\"2*8e#!e#\"o+#1,Mw-y"
|
|
300
|
+
];
|
|
301
|
+
const __ΩIteratorResult = [
|
|
302
|
+
"T",
|
|
303
|
+
"TReturn",
|
|
304
|
+
() => __ΩIteratorYieldResult,
|
|
305
|
+
() => __ΩIteratorReturnResult,
|
|
306
|
+
"IteratorResult",
|
|
307
|
+
"b!\"c\"Pe\"!o#\"e\"\"o$\"Jw%y"
|
|
308
|
+
];
|
|
309
|
+
const __ΩIteratorYieldResult = [
|
|
310
|
+
"TYield",
|
|
311
|
+
false,
|
|
312
|
+
"done",
|
|
313
|
+
"value",
|
|
314
|
+
"IteratorYieldResult",
|
|
315
|
+
"b!P.\"4#8e\"!4$Mw%y"
|
|
316
|
+
];
|
|
317
|
+
const __ΩIteratorReturnResult = [
|
|
318
|
+
"TReturn",
|
|
319
|
+
true,
|
|
320
|
+
"done",
|
|
321
|
+
"value",
|
|
322
|
+
"IteratorReturnResult",
|
|
323
|
+
"b!P.\"4#e\"!4$Mw%y"
|
|
324
|
+
];
|
|
325
|
+
function __assignType$2(fn, args) {
|
|
326
|
+
fn.__type = args;
|
|
327
|
+
return fn;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Makes sure the error once printed using console.log contains the actual class name.
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* ```
|
|
334
|
+
* class MyApiError extends CustomerError {}
|
|
335
|
+
*
|
|
336
|
+
* throw MyApiError() // prints MyApiError instead of simply "Error".
|
|
337
|
+
* ```
|
|
338
|
+
*
|
|
339
|
+
* @public
|
|
340
|
+
*/
|
|
341
|
+
var CustomError = class extends Error {
|
|
342
|
+
constructor(...args) {
|
|
343
|
+
super(...args);
|
|
344
|
+
this.name = this.constructor.name;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
CustomError.__type = [
|
|
348
|
+
() => Error,
|
|
349
|
+
"name",
|
|
350
|
+
"args",
|
|
351
|
+
"constructor",
|
|
352
|
+
"CustomError",
|
|
353
|
+
"P7!&3\"P\"@2#\"0$5w%"
|
|
354
|
+
];
|
|
355
|
+
const __ΩCustomError = [
|
|
356
|
+
"cause",
|
|
357
|
+
"CustomError",
|
|
358
|
+
"P#4!8Mw\"y"
|
|
359
|
+
];
|
|
360
|
+
const __ΩClassType = [
|
|
361
|
+
"T",
|
|
362
|
+
"args",
|
|
363
|
+
"new",
|
|
364
|
+
"ClassType",
|
|
365
|
+
"\"c!PP\"@2\"e#!1#Mw$y"
|
|
366
|
+
];
|
|
367
|
+
const __ΩAbstractClassType = [
|
|
368
|
+
"T",
|
|
369
|
+
"args",
|
|
370
|
+
"new",
|
|
371
|
+
"AbstractClassType",
|
|
372
|
+
"\"c!P\"@2\"e\"!/#w$y"
|
|
373
|
+
];
|
|
374
|
+
const __ΩExtractClassType = [
|
|
375
|
+
"T",
|
|
376
|
+
() => __ΩAbstractClassType,
|
|
377
|
+
"ExtractClassType",
|
|
378
|
+
"l:e\"!R!RPde#!h!!o\"\"qk#'QRb!Pde\"!p)w#y"
|
|
379
|
+
];
|
|
380
|
+
/**
|
|
381
|
+
* Returns the class name either of the class definition or of the class of an instance.
|
|
382
|
+
*
|
|
383
|
+
* Note when code is minimized/uglified this output will change. You should disable in your compile the
|
|
384
|
+
* className modification.
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* ```typescript
|
|
388
|
+
* class User {}
|
|
389
|
+
*
|
|
390
|
+
* expect(getClassName(User)).toBe('User');
|
|
391
|
+
* expect(getClassName(new User())).toBe('User');
|
|
392
|
+
* ```
|
|
393
|
+
*
|
|
394
|
+
* @public
|
|
395
|
+
*/
|
|
396
|
+
function getClassName(classTypeOrInstance) {
|
|
397
|
+
if (!classTypeOrInstance) return "undefined";
|
|
398
|
+
return (classTypeOrInstance["prototype"] ? classTypeOrInstance["prototype"] : classTypeOrInstance).constructor.name || "anonymous class";
|
|
399
|
+
}
|
|
400
|
+
getClassName.__type = [
|
|
401
|
+
() => __ΩClassType,
|
|
402
|
+
() => __ΩObject,
|
|
403
|
+
"classTypeOrInstance",
|
|
404
|
+
"getClassName",
|
|
405
|
+
"PP\"o!\"n\"J2#&/$"
|
|
406
|
+
];
|
|
407
|
+
/**
|
|
408
|
+
* Same as getClassName but appends the propertyName.
|
|
409
|
+
* @public
|
|
410
|
+
*/
|
|
411
|
+
function getClassPropertyName(classType, propertyName) {
|
|
412
|
+
return `${getClassName(classType)}.${propertyName}`;
|
|
413
|
+
}
|
|
414
|
+
getClassPropertyName.__type = [
|
|
415
|
+
() => __ΩClassType,
|
|
416
|
+
() => __ΩObject,
|
|
417
|
+
"classType",
|
|
418
|
+
"propertyName",
|
|
419
|
+
"getClassPropertyName",
|
|
420
|
+
"PP\"o!\"n\"J2#&2$&/%"
|
|
421
|
+
];
|
|
422
|
+
/**
|
|
423
|
+
* @public
|
|
424
|
+
*/
|
|
425
|
+
function applyDefaults(classType, target) {
|
|
426
|
+
const classInstance = new classType();
|
|
427
|
+
for (const [i, v] of eachPair(target)) classInstance[i] = v;
|
|
428
|
+
return classInstance;
|
|
429
|
+
}
|
|
430
|
+
applyDefaults.__type = [
|
|
431
|
+
() => __ΩClassType,
|
|
432
|
+
"classType",
|
|
433
|
+
"target",
|
|
434
|
+
"applyDefaults",
|
|
435
|
+
"P\"o!\"2\"P&\"LM2#\"/$"
|
|
436
|
+
];
|
|
437
|
+
/**
|
|
438
|
+
* Tries to identify the object by normalised result of Object.toString(obj).
|
|
439
|
+
*/
|
|
440
|
+
function identifyType(obj) {
|
|
441
|
+
return (({}.toString.call(obj).match(/\s([a-zA-Z]+)/) || [])[1] || "").toLowerCase();
|
|
442
|
+
}
|
|
443
|
+
identifyType.__type = [
|
|
444
|
+
"obj",
|
|
445
|
+
"identifyType",
|
|
446
|
+
"P\"2!\"/\""
|
|
447
|
+
];
|
|
448
|
+
/**
|
|
449
|
+
* Returns true if the given obj is a plain object, and no class instance.
|
|
450
|
+
*
|
|
451
|
+
* isPlainObject(\{\}) === true
|
|
452
|
+
* isPlainObject(new ClassXY) === false
|
|
453
|
+
*
|
|
454
|
+
* @public
|
|
455
|
+
*/
|
|
456
|
+
function isPlainObject(obj) {
|
|
457
|
+
return Boolean(obj && typeof obj === "object" && obj.constructor instanceof obj.constructor);
|
|
458
|
+
}
|
|
459
|
+
isPlainObject.__type = [
|
|
460
|
+
"obj",
|
|
461
|
+
"isPlainObject",
|
|
462
|
+
"P\"2!!/\""
|
|
463
|
+
];
|
|
464
|
+
/**
|
|
465
|
+
* Returns the ClassType for a given instance.
|
|
466
|
+
*/
|
|
467
|
+
function getClassTypeFromInstance(target) {
|
|
468
|
+
if (!isClassInstance(target)) throw new Error(`Value is not a class instance. Got ${stringifyValueWithType(target)}`);
|
|
469
|
+
return target["constructor"];
|
|
470
|
+
}
|
|
471
|
+
getClassTypeFromInstance.__type = [
|
|
472
|
+
"target",
|
|
473
|
+
() => __ΩClassType,
|
|
474
|
+
"getClassTypeFromInstance",
|
|
475
|
+
"P\"2!\"o\"\"/#"
|
|
476
|
+
];
|
|
477
|
+
/**
|
|
478
|
+
* Returns true when target is a class instance.
|
|
479
|
+
*/
|
|
480
|
+
function isClassInstance(target) {
|
|
481
|
+
return target !== void 0 && target !== null && target["constructor"] && Object.getPrototypeOf(target) === target["constructor"].prototype && !isPlainObject(target) && isObject(target);
|
|
482
|
+
}
|
|
483
|
+
isClassInstance.__type = [
|
|
484
|
+
"target",
|
|
485
|
+
"isClassInstance",
|
|
486
|
+
"P\"2!)/\""
|
|
487
|
+
];
|
|
488
|
+
/**
|
|
489
|
+
* Returns a human-readable string representation from the given value.
|
|
490
|
+
*/
|
|
491
|
+
function stringifyValueWithType(value, depth = 0) {
|
|
492
|
+
if ("string" === typeof value) return `string(${value})`;
|
|
493
|
+
if ("number" === typeof value) return `number(${value})`;
|
|
494
|
+
if ("boolean" === typeof value) return `boolean(${value})`;
|
|
495
|
+
if ("bigint" === typeof value) return `bigint(${value})`;
|
|
496
|
+
if (isPlainObject(value)) return `object ${depth < 2 ? prettyPrintObject(value, depth) : ""}`;
|
|
497
|
+
if (isArray(value)) return `Array`;
|
|
498
|
+
if (isClass(value)) return `${getClassName(value)}`;
|
|
499
|
+
if (isObject(value)) return `${getClassName(getClassTypeFromInstance(value))} ${depth < 2 ? prettyPrintObject(value, depth) : ""}`;
|
|
500
|
+
if ("function" === typeof value) return `function ${value.name}`;
|
|
501
|
+
if (null === value) return `null`;
|
|
502
|
+
return "undefined";
|
|
503
|
+
}
|
|
504
|
+
stringifyValueWithType.__type = [
|
|
505
|
+
"value",
|
|
506
|
+
"depth",
|
|
507
|
+
() => 0,
|
|
508
|
+
"stringifyValueWithType",
|
|
509
|
+
"P\"2!'2\">#&/$"
|
|
510
|
+
];
|
|
511
|
+
/**
|
|
512
|
+
* Changes the class of a given instance and returns the new object.
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
* ```typescript
|
|
516
|
+
*
|
|
517
|
+
* class Model1 {
|
|
518
|
+
* id: number = 0;
|
|
519
|
+
* }
|
|
520
|
+
*
|
|
521
|
+
* class Model2 {
|
|
522
|
+
* id: number = 0;
|
|
523
|
+
* }
|
|
524
|
+
*
|
|
525
|
+
* const model1 = new Model1();
|
|
526
|
+
* const model2 = changeClass(model1, Model2);
|
|
527
|
+
* model2 instanceof Model2; //true
|
|
528
|
+
* ```
|
|
529
|
+
*/
|
|
530
|
+
function changeClass(value, newClass) {
|
|
531
|
+
return Object.assign(Object.create(newClass.prototype), value);
|
|
532
|
+
}
|
|
533
|
+
changeClass.__type = [
|
|
534
|
+
"value",
|
|
535
|
+
() => __ΩClassType,
|
|
536
|
+
"newClass",
|
|
537
|
+
"changeClass",
|
|
538
|
+
"P%2!\"o\"\"2#\"/$"
|
|
539
|
+
];
|
|
540
|
+
function prettyPrintObject(object, depth = 0) {
|
|
541
|
+
const res = [];
|
|
542
|
+
for (const i in object) res.push(i + ": " + stringifyValueWithType(object[i], depth + 1));
|
|
543
|
+
return "{" + res.join(",") + "}";
|
|
544
|
+
}
|
|
545
|
+
prettyPrintObject.__type = [
|
|
546
|
+
"object",
|
|
547
|
+
"depth",
|
|
548
|
+
() => 0,
|
|
549
|
+
"prettyPrintObject",
|
|
550
|
+
"P%2!'2\">#&/$"
|
|
551
|
+
];
|
|
552
|
+
/**
|
|
553
|
+
* Returns true if given obj is a function.
|
|
554
|
+
*
|
|
555
|
+
* @public
|
|
556
|
+
*/
|
|
557
|
+
function isFunction(obj) {
|
|
558
|
+
if ("function" === typeof obj) return !obj.toString().startsWith("class ") && !obj.toString().startsWith("class{");
|
|
559
|
+
return false;
|
|
560
|
+
}
|
|
561
|
+
isFunction.__type = [
|
|
562
|
+
"obj",
|
|
563
|
+
"isFunction",
|
|
564
|
+
"P\"2!!/\""
|
|
565
|
+
];
|
|
566
|
+
const AsyncFunction = (async () => {}).constructor;
|
|
567
|
+
/**
|
|
568
|
+
* Returns true if given obj is a async function.
|
|
569
|
+
*
|
|
570
|
+
* @public
|
|
571
|
+
*/
|
|
572
|
+
function isAsyncFunction(obj) {
|
|
573
|
+
return obj instanceof AsyncFunction;
|
|
574
|
+
}
|
|
575
|
+
isAsyncFunction.__type = [
|
|
576
|
+
"obj",
|
|
577
|
+
"isAsyncFunction",
|
|
578
|
+
"P\"2!!/\""
|
|
579
|
+
];
|
|
580
|
+
/**
|
|
581
|
+
* Returns true if given obj is a promise like object.
|
|
582
|
+
*
|
|
583
|
+
* Note: There's not way to check if it's actually a Promise using instanceof since
|
|
584
|
+
* there are a lot of different implementations around.
|
|
585
|
+
*
|
|
586
|
+
* @public
|
|
587
|
+
*/
|
|
588
|
+
function isPromise(obj) {
|
|
589
|
+
return obj !== null && typeof obj === "object" && typeof obj.then === "function" && typeof obj.catch === "function" && typeof obj.finally === "function";
|
|
590
|
+
}
|
|
591
|
+
isPromise.__type = [
|
|
592
|
+
"obj",
|
|
593
|
+
"isPromise",
|
|
594
|
+
"PP\"\"`J2!!/\""
|
|
595
|
+
];
|
|
596
|
+
/**
|
|
597
|
+
* Returns true if given obj is a ES6 class (ES5 fake classes are not supported).
|
|
598
|
+
*
|
|
599
|
+
* @public
|
|
600
|
+
*/
|
|
601
|
+
function isClass(obj) {
|
|
602
|
+
if ("function" === typeof obj) return obj.toString().startsWith("class ") || obj.toString().startsWith("class{");
|
|
603
|
+
return false;
|
|
604
|
+
}
|
|
605
|
+
isClass.__type = [
|
|
606
|
+
"obj",
|
|
607
|
+
"isClass",
|
|
608
|
+
"P\"2!!/\""
|
|
609
|
+
];
|
|
610
|
+
function isGlobalClass(obj) {
|
|
611
|
+
if ("function" !== typeof obj) return false;
|
|
612
|
+
if ("undefined" !== typeof window) return window[getClassName(obj)] === obj;
|
|
613
|
+
if ("undefined" !== typeof global) return global[getClassName(obj)] === obj;
|
|
614
|
+
return false;
|
|
615
|
+
}
|
|
616
|
+
isGlobalClass.__type = [
|
|
617
|
+
"obj",
|
|
618
|
+
"isGlobalClass",
|
|
619
|
+
"P\"2!!/\""
|
|
620
|
+
];
|
|
621
|
+
/**
|
|
622
|
+
* Returns true for real objects: object literals ({}) or class instances (new MyClass).
|
|
623
|
+
*
|
|
624
|
+
* @public
|
|
625
|
+
*/
|
|
626
|
+
function isObject(obj) {
|
|
627
|
+
if (obj === null) return false;
|
|
628
|
+
return typeof obj === "object" && !isArray(obj);
|
|
629
|
+
}
|
|
630
|
+
isObject.__type = [
|
|
631
|
+
"obj",
|
|
632
|
+
"isObject",
|
|
633
|
+
"P\"2!!/\""
|
|
634
|
+
];
|
|
635
|
+
/**
|
|
636
|
+
* Returns true if given obj is a plain object, and no Date, Array, Map, Set, etc.
|
|
637
|
+
*
|
|
638
|
+
* This is different to isObject and used in the type system to differentiate
|
|
639
|
+
* between JS objects in general and what we define as ReflectionKind.objectLiteral.
|
|
640
|
+
* Since we have Date, Set, Map, etc. in the type system, we need to differentiate
|
|
641
|
+
* between them and all other object literals.
|
|
642
|
+
*/
|
|
643
|
+
function isObjectLiteral(obj) {
|
|
644
|
+
return isObject(obj) && !(obj instanceof Date) && !(obj instanceof Map) && !(obj instanceof Set);
|
|
645
|
+
}
|
|
646
|
+
isObjectLiteral.__type = [
|
|
647
|
+
"obj",
|
|
648
|
+
"isObjectLiteral",
|
|
649
|
+
"P\"2!!/\""
|
|
650
|
+
];
|
|
651
|
+
/**
|
|
652
|
+
* @public
|
|
653
|
+
*/
|
|
654
|
+
const isArray = Array.isArray;
|
|
655
|
+
/**
|
|
656
|
+
* @public
|
|
657
|
+
*/
|
|
658
|
+
function isNull(obj) {
|
|
659
|
+
return null === obj;
|
|
660
|
+
}
|
|
661
|
+
isNull.__type = [
|
|
662
|
+
"obj",
|
|
663
|
+
"isNull",
|
|
664
|
+
"P\"2!!/\""
|
|
665
|
+
];
|
|
666
|
+
/**
|
|
667
|
+
* @public
|
|
668
|
+
*/
|
|
669
|
+
function isUndefined(obj) {
|
|
670
|
+
return void 0 === obj;
|
|
671
|
+
}
|
|
672
|
+
isUndefined.__type = [
|
|
673
|
+
"obj",
|
|
674
|
+
"isUndefined",
|
|
675
|
+
"P\"2!!/\""
|
|
676
|
+
];
|
|
677
|
+
/**
|
|
678
|
+
* Checks if obj is not null and not undefined.
|
|
679
|
+
*
|
|
680
|
+
* @public
|
|
681
|
+
*/
|
|
682
|
+
function isSet(obj) {
|
|
683
|
+
return !isNull(obj) && !isUndefined(obj);
|
|
684
|
+
}
|
|
685
|
+
isSet.__type = [
|
|
686
|
+
"obj",
|
|
687
|
+
"isSet",
|
|
688
|
+
"P\"2!)/\""
|
|
689
|
+
];
|
|
690
|
+
/**
|
|
691
|
+
* @public
|
|
692
|
+
*/
|
|
693
|
+
function isNumber(obj) {
|
|
694
|
+
return "number" === identifyType(obj);
|
|
695
|
+
}
|
|
696
|
+
isNumber.__type = [
|
|
697
|
+
"obj",
|
|
698
|
+
"isNumber",
|
|
699
|
+
"P\"2!!/\""
|
|
700
|
+
];
|
|
701
|
+
/**
|
|
702
|
+
* Returns true if given value is strictly a numeric string value (or a number).
|
|
703
|
+
*
|
|
704
|
+
* ```typescript
|
|
705
|
+
* isNumeric(12); //true
|
|
706
|
+
* isNumeric('12'); //true
|
|
707
|
+
* isNumeric('12.3'); //true
|
|
708
|
+
* isNumeric('12.3 '); //false
|
|
709
|
+
* isNumeric('12px'); //false
|
|
710
|
+
* ```
|
|
711
|
+
* @public
|
|
712
|
+
*/
|
|
713
|
+
function isNumeric(s) {
|
|
714
|
+
if ("number" === typeof s) return true;
|
|
715
|
+
let points = 0;
|
|
716
|
+
for (let i = s.length - 1; i >= 0; i--) {
|
|
717
|
+
const d = s.charCodeAt(i);
|
|
718
|
+
if (d === 46) {
|
|
719
|
+
if (points++ > 0) return false;
|
|
720
|
+
continue;
|
|
721
|
+
}
|
|
722
|
+
if (d < 48 || d > 57) return false;
|
|
723
|
+
}
|
|
724
|
+
return true;
|
|
725
|
+
}
|
|
726
|
+
isNumeric.__type = [
|
|
727
|
+
"s",
|
|
728
|
+
"isNumeric",
|
|
729
|
+
"PP&'J2!)/\""
|
|
730
|
+
];
|
|
731
|
+
const isInteger = Number.isInteger || __assignType$2(function(obj) {
|
|
732
|
+
return obj % 1 === 0;
|
|
733
|
+
}, [
|
|
734
|
+
"obj",
|
|
735
|
+
"",
|
|
736
|
+
"P\"2!\"/\""
|
|
737
|
+
]);
|
|
738
|
+
/**
|
|
739
|
+
* @public
|
|
740
|
+
*/
|
|
741
|
+
function isString(obj) {
|
|
742
|
+
return "string" === identifyType(obj);
|
|
743
|
+
}
|
|
744
|
+
isString.__type = [
|
|
745
|
+
"obj",
|
|
746
|
+
"isString",
|
|
747
|
+
"P\"2!!/\""
|
|
748
|
+
];
|
|
749
|
+
/**
|
|
750
|
+
* @public
|
|
751
|
+
*/
|
|
752
|
+
function indexOf(array, item) {
|
|
753
|
+
if (!array) return -1;
|
|
754
|
+
return array.indexOf(item);
|
|
755
|
+
}
|
|
756
|
+
indexOf.__type = [
|
|
757
|
+
"array",
|
|
758
|
+
"item",
|
|
759
|
+
"indexOf",
|
|
760
|
+
"P\"F2!\"2\"'/#"
|
|
761
|
+
];
|
|
762
|
+
/**
|
|
763
|
+
* @public
|
|
764
|
+
*/
|
|
765
|
+
async function sleep(seconds) {
|
|
766
|
+
return Promise.Ω = [["$"]], new Promise(__assignType$2((resolve) => setTimeout(resolve, seconds * 1e3), [
|
|
767
|
+
"resolve",
|
|
768
|
+
"",
|
|
769
|
+
"P\"2!\"/\""
|
|
770
|
+
]));
|
|
771
|
+
}
|
|
772
|
+
sleep.__type = [
|
|
773
|
+
"seconds",
|
|
774
|
+
"sleep",
|
|
775
|
+
"P'2!$`/\""
|
|
776
|
+
];
|
|
777
|
+
/**
|
|
778
|
+
* Creates a shallow copy of given array.
|
|
779
|
+
*
|
|
780
|
+
* @public
|
|
781
|
+
*/
|
|
782
|
+
function copy(v) {
|
|
783
|
+
if (isArray(v)) return v.slice(0);
|
|
784
|
+
return v;
|
|
785
|
+
}
|
|
786
|
+
copy.__type = [
|
|
787
|
+
"v",
|
|
788
|
+
"copy",
|
|
789
|
+
"P\"F2!\"F/\""
|
|
790
|
+
];
|
|
791
|
+
/**
|
|
792
|
+
* Checks whether given array or object is empty (no keys). If given object is falsy, returns false.
|
|
793
|
+
*
|
|
794
|
+
* @public
|
|
795
|
+
*/
|
|
796
|
+
function empty(value) {
|
|
797
|
+
if (!value) return true;
|
|
798
|
+
if (isArray(value)) return value.length === 0;
|
|
799
|
+
else {
|
|
800
|
+
for (const i in value) if (value.hasOwnProperty(i)) return false;
|
|
801
|
+
return true;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
empty.__type = [
|
|
805
|
+
"value",
|
|
806
|
+
"empty",
|
|
807
|
+
"PP\"F%PMJ2!8)/\""
|
|
808
|
+
];
|
|
809
|
+
/**
|
|
810
|
+
* Returns the size of given array or object.
|
|
811
|
+
*
|
|
812
|
+
* @public
|
|
813
|
+
*/
|
|
814
|
+
function size(array) {
|
|
815
|
+
if (!array) return 0;
|
|
816
|
+
if (isArray(array)) return array.length;
|
|
817
|
+
else return getObjectKeysSize(array);
|
|
818
|
+
}
|
|
819
|
+
size.__type = [
|
|
820
|
+
"array",
|
|
821
|
+
"size",
|
|
822
|
+
"PP\"FP&\"LMJ2!'/\""
|
|
823
|
+
];
|
|
824
|
+
/**
|
|
825
|
+
* Returns the first key of a given object.
|
|
826
|
+
*
|
|
827
|
+
* @public
|
|
828
|
+
*/
|
|
829
|
+
function firstKey(v) {
|
|
830
|
+
return Object.keys(v)[0];
|
|
831
|
+
}
|
|
832
|
+
firstKey.__type = [
|
|
833
|
+
"v",
|
|
834
|
+
"firstKey",
|
|
835
|
+
"PPP&\"LM%J2!P&-J/\""
|
|
836
|
+
];
|
|
837
|
+
/**
|
|
838
|
+
* Returns the last key of a given object.
|
|
839
|
+
*
|
|
840
|
+
* @public
|
|
841
|
+
*/
|
|
842
|
+
function lastKey(v) {
|
|
843
|
+
const keys = Object.keys(v);
|
|
844
|
+
if (keys.length) return;
|
|
845
|
+
return keys[keys.length - 1];
|
|
846
|
+
}
|
|
847
|
+
lastKey.__type = [
|
|
848
|
+
"v",
|
|
849
|
+
"lastKey",
|
|
850
|
+
"PPP&\"LM%J2!P&-J/\""
|
|
851
|
+
];
|
|
852
|
+
/**
|
|
853
|
+
* Returns the first value of given array or object.
|
|
854
|
+
*
|
|
855
|
+
* @public
|
|
856
|
+
*/
|
|
857
|
+
function first(v) {
|
|
858
|
+
if (isArray(v)) return v[0];
|
|
859
|
+
const key = firstKey(v);
|
|
860
|
+
if (key) return v[key];
|
|
861
|
+
}
|
|
862
|
+
first.__type = [
|
|
863
|
+
"v",
|
|
864
|
+
"first",
|
|
865
|
+
"PPP&\"LM\"FJ2!P\"-J/\""
|
|
866
|
+
];
|
|
867
|
+
/**
|
|
868
|
+
* Returns the last value of given array or object.
|
|
869
|
+
*
|
|
870
|
+
* @public
|
|
871
|
+
*/
|
|
872
|
+
function last(v) {
|
|
873
|
+
if (isArray(v)) {
|
|
874
|
+
if (v.length > 0) return v[v.length - 1];
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
const key = firstKey(v);
|
|
878
|
+
if (key) return v[key];
|
|
879
|
+
}
|
|
880
|
+
last.__type = [
|
|
881
|
+
"v",
|
|
882
|
+
"last",
|
|
883
|
+
"PPP&\"LM\"FJ2!P\"-J/\""
|
|
884
|
+
];
|
|
885
|
+
/**
|
|
886
|
+
* Returns the average of a number array.
|
|
887
|
+
*
|
|
888
|
+
* @public
|
|
889
|
+
*/
|
|
890
|
+
function average(array) {
|
|
891
|
+
let sum = 0;
|
|
892
|
+
for (const n of array) sum += n;
|
|
893
|
+
return sum / array.length;
|
|
894
|
+
}
|
|
895
|
+
average.__type = [
|
|
896
|
+
"array",
|
|
897
|
+
"average",
|
|
898
|
+
"P'F2!'/\""
|
|
899
|
+
];
|
|
900
|
+
/**
|
|
901
|
+
* @public
|
|
902
|
+
*/
|
|
903
|
+
function prependObjectKeys(o, prependText) {
|
|
904
|
+
const converted = {};
|
|
905
|
+
for (const i in o) {
|
|
906
|
+
if (!o.hasOwnProperty(i)) continue;
|
|
907
|
+
converted[prependText + i] = o[i];
|
|
908
|
+
}
|
|
909
|
+
return converted;
|
|
910
|
+
}
|
|
911
|
+
prependObjectKeys.__type = [
|
|
912
|
+
"o",
|
|
913
|
+
"prependText",
|
|
914
|
+
"prependObjectKeys",
|
|
915
|
+
"PP&\"LM2!&2\"P&\"LM/#"
|
|
916
|
+
];
|
|
917
|
+
/**
|
|
918
|
+
* @public
|
|
919
|
+
*/
|
|
920
|
+
function appendObject(origin, extend, prependKeyName = "") {
|
|
921
|
+
const no = prependObjectKeys(extend, prependKeyName);
|
|
922
|
+
for (const [i, v] of eachPair(no)) origin[i] = v;
|
|
923
|
+
}
|
|
924
|
+
appendObject.__type = [
|
|
925
|
+
"origin",
|
|
926
|
+
"extend",
|
|
927
|
+
"prependKeyName",
|
|
928
|
+
() => "",
|
|
929
|
+
"appendObject",
|
|
930
|
+
"PP&\"LM2!P&\"LM2\"&2#>$\"/%"
|
|
931
|
+
];
|
|
932
|
+
/**
|
|
933
|
+
* A better alternative to "new Promise()" that supports error handling and maintains the stack trace for Error.stack.
|
|
934
|
+
*
|
|
935
|
+
* When you use `new Promise()` you need to wrap your code inside a try-catch to call `reject` on error.
|
|
936
|
+
* asyncOperation() does this automatically.
|
|
937
|
+
*
|
|
938
|
+
* When you use `new Promise()` you will lose the stack trace when `reject(new Error())` is called.
|
|
939
|
+
* asyncOperation() makes sure the error stack trace is the correct one.
|
|
940
|
+
*
|
|
941
|
+
* @example
|
|
942
|
+
* ```typescript
|
|
943
|
+
* await asyncOperation(async (resolve, reject) => {
|
|
944
|
+
* await doSomething(); //if this fails, reject() will automatically be called
|
|
945
|
+
* stream.on('data', (data) => {
|
|
946
|
+
* resolve(data); //at some point you MUST call resolve(data)
|
|
947
|
+
* });
|
|
948
|
+
* });
|
|
949
|
+
* ```
|
|
950
|
+
*
|
|
951
|
+
* @public
|
|
952
|
+
* @reflection never
|
|
953
|
+
*/
|
|
954
|
+
async function asyncOperation(executor) {
|
|
955
|
+
try {
|
|
956
|
+
return await (Promise.Ω = [void 0], new Promise(async (resolve, reject) => {
|
|
957
|
+
try {
|
|
958
|
+
await executor(resolve, reject);
|
|
959
|
+
} catch (e) {
|
|
960
|
+
reject(e);
|
|
961
|
+
}
|
|
962
|
+
}));
|
|
963
|
+
} catch (error) {
|
|
964
|
+
mergeStack(error, createStack());
|
|
965
|
+
throw error;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* When an API is called that returns a promise that loses the stack trace on error, you can use fixAsyncOperation().
|
|
970
|
+
*
|
|
971
|
+
* ```typescript
|
|
972
|
+
* cons storage = new BrokenPromiseStorage();
|
|
973
|
+
* const files = await fixAsyncOperation(storage.files('/'));
|
|
974
|
+
* ```
|
|
975
|
+
*/
|
|
976
|
+
function fixAsyncOperation(promise) {
|
|
977
|
+
return asyncOperation(__assignType$2(async (resolve, reject) => {
|
|
978
|
+
resolve(await promise);
|
|
979
|
+
}, [
|
|
980
|
+
"resolve",
|
|
981
|
+
"reject",
|
|
982
|
+
"",
|
|
983
|
+
"P\"2!\"2\"\"/#"
|
|
984
|
+
]));
|
|
985
|
+
}
|
|
986
|
+
fixAsyncOperation.__type = [
|
|
987
|
+
"promise",
|
|
988
|
+
"fixAsyncOperation",
|
|
989
|
+
"P\"`2!\"`/\""
|
|
990
|
+
];
|
|
991
|
+
/**
|
|
992
|
+
* @public
|
|
993
|
+
*/
|
|
994
|
+
function mergePromiseStack(promise, stack) {
|
|
995
|
+
stack = stack || createStack();
|
|
996
|
+
promise.then(() => {}, __assignType$2((error) => {
|
|
997
|
+
mergeStack(error, stack || "");
|
|
998
|
+
}, [
|
|
999
|
+
"error",
|
|
1000
|
+
"",
|
|
1001
|
+
"P\"2!\"/\""
|
|
1002
|
+
]));
|
|
1003
|
+
return promise;
|
|
1004
|
+
}
|
|
1005
|
+
mergePromiseStack.__type = [
|
|
1006
|
+
"promise",
|
|
1007
|
+
"stack",
|
|
1008
|
+
"mergePromiseStack",
|
|
1009
|
+
"P\"`2!&2\"8\"`/#"
|
|
1010
|
+
];
|
|
1011
|
+
/**
|
|
1012
|
+
* @beta
|
|
1013
|
+
*/
|
|
1014
|
+
function createStack(removeCallee = true) {
|
|
1015
|
+
if (Error.stackTraceLimit === 10) Error.stackTraceLimit = 100;
|
|
1016
|
+
let stack = (/* @__PURE__ */ new Error()).stack || "";
|
|
1017
|
+
stack = stack.slice(stack.indexOf(" at ") + 6);
|
|
1018
|
+
stack = stack.slice(stack.indexOf(" at ") - 1);
|
|
1019
|
+
if (removeCallee) {
|
|
1020
|
+
stack = stack.slice(stack.indexOf(" at ") + 6);
|
|
1021
|
+
stack = stack.slice(stack.indexOf(" at ") - 1);
|
|
1022
|
+
}
|
|
1023
|
+
return stack;
|
|
1024
|
+
}
|
|
1025
|
+
createStack.__type = [
|
|
1026
|
+
"removeCallee",
|
|
1027
|
+
() => true,
|
|
1028
|
+
"createStack",
|
|
1029
|
+
"P)2!>\"&/#"
|
|
1030
|
+
];
|
|
1031
|
+
/**
|
|
1032
|
+
* @beta
|
|
1033
|
+
*/
|
|
1034
|
+
function mergeStack(error, stack) {
|
|
1035
|
+
if (error instanceof Error && error.stack) error.stack += "\n" + stack;
|
|
1036
|
+
}
|
|
1037
|
+
mergeStack.__type = [
|
|
1038
|
+
() => __ΩError,
|
|
1039
|
+
"error",
|
|
1040
|
+
"stack",
|
|
1041
|
+
"mergeStack",
|
|
1042
|
+
"Pn!2\"&2#\"/$"
|
|
1043
|
+
];
|
|
1044
|
+
/**
|
|
1045
|
+
* Makes sure the given value is an error. If it's not an error, it creates a new error with the given value as message.
|
|
1046
|
+
*/
|
|
1047
|
+
function ensureError(error, classType = Error) {
|
|
1048
|
+
return error instanceof Error || error instanceof AggregateError ? error : new classType(error);
|
|
1049
|
+
}
|
|
1050
|
+
ensureError.__type = [
|
|
1051
|
+
"error",
|
|
1052
|
+
() => __ΩClassType,
|
|
1053
|
+
"classType",
|
|
1054
|
+
() => Error,
|
|
1055
|
+
() => __ΩError,
|
|
1056
|
+
"ensureError",
|
|
1057
|
+
"P\"2!8n\"2#>$n%/&"
|
|
1058
|
+
];
|
|
1059
|
+
function collectForMicrotask(callback) {
|
|
1060
|
+
let items = [];
|
|
1061
|
+
let taskScheduled = false;
|
|
1062
|
+
return __assignType$2((arg) => {
|
|
1063
|
+
items.push(arg);
|
|
1064
|
+
if (!taskScheduled) {
|
|
1065
|
+
taskScheduled = true;
|
|
1066
|
+
queueMicrotask(() => {
|
|
1067
|
+
taskScheduled = false;
|
|
1068
|
+
callback(items);
|
|
1069
|
+
items.length = 0;
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
}, [
|
|
1073
|
+
() => callback,
|
|
1074
|
+
"args",
|
|
1075
|
+
"",
|
|
1076
|
+
"arg",
|
|
1077
|
+
"PPdi!Ph\"!F2\"$/#qe!!!j2$\"/#"
|
|
1078
|
+
]);
|
|
1079
|
+
}
|
|
1080
|
+
collectForMicrotask.__type = [
|
|
1081
|
+
"args",
|
|
1082
|
+
"",
|
|
1083
|
+
"callback",
|
|
1084
|
+
"arg",
|
|
1085
|
+
"collectForMicrotask",
|
|
1086
|
+
"PP\"F2!$/\"2#P\"2$$/\"/%"
|
|
1087
|
+
];
|
|
1088
|
+
/**
|
|
1089
|
+
* Returns the current time as seconds.
|
|
1090
|
+
*
|
|
1091
|
+
* @public
|
|
1092
|
+
*/
|
|
1093
|
+
function time() {
|
|
1094
|
+
return Date.now() / 1e3;
|
|
1095
|
+
}
|
|
1096
|
+
time.__type = ["time", "P'/!"];
|
|
1097
|
+
/**
|
|
1098
|
+
* @public
|
|
1099
|
+
*/
|
|
1100
|
+
function getPathValue(bag, parameterPath, defaultValue) {
|
|
1101
|
+
if (parameterPath === "" || parameterPath === void 0) return bag;
|
|
1102
|
+
if (isSet(bag[parameterPath])) return bag[parameterPath];
|
|
1103
|
+
const result = import_dot_prop.default.get(bag, parameterPath);
|
|
1104
|
+
return isSet(result) ? result : defaultValue;
|
|
1105
|
+
}
|
|
1106
|
+
getPathValue.__type = [
|
|
1107
|
+
"bag",
|
|
1108
|
+
"parameterPath",
|
|
1109
|
+
"defaultValue",
|
|
1110
|
+
"getPathValue",
|
|
1111
|
+
"PP&\"LM2!&2\"\"2#8\"/$"
|
|
1112
|
+
];
|
|
1113
|
+
/**
|
|
1114
|
+
* @public
|
|
1115
|
+
*/
|
|
1116
|
+
function setPathValue(bag, parameterPath, value) {
|
|
1117
|
+
import_dot_prop.default.set(bag, parameterPath, value);
|
|
1118
|
+
}
|
|
1119
|
+
setPathValue.__type = [
|
|
1120
|
+
"bag",
|
|
1121
|
+
"parameterPath",
|
|
1122
|
+
"value",
|
|
1123
|
+
"setPathValue",
|
|
1124
|
+
"P%2!&2\"\"2#\"/$"
|
|
1125
|
+
];
|
|
1126
|
+
/**
|
|
1127
|
+
* @public
|
|
1128
|
+
*/
|
|
1129
|
+
function deletePathValue(bag, parameterPath) {
|
|
1130
|
+
import_dot_prop.default.delete(bag, parameterPath);
|
|
1131
|
+
}
|
|
1132
|
+
deletePathValue.__type = [
|
|
1133
|
+
"bag",
|
|
1134
|
+
"parameterPath",
|
|
1135
|
+
"deletePathValue",
|
|
1136
|
+
"P%2!&2\"\"/#"
|
|
1137
|
+
];
|
|
1138
|
+
/**
|
|
1139
|
+
* Returns the human-readable byte representation.
|
|
1140
|
+
*
|
|
1141
|
+
* @public
|
|
1142
|
+
*/
|
|
1143
|
+
function humanBytes(bytes, si = false) {
|
|
1144
|
+
const thresh = si ? 1e3 : 1024;
|
|
1145
|
+
if (Math.abs(bytes) < thresh) return bytes + " B";
|
|
1146
|
+
const units = si ? [
|
|
1147
|
+
"kB",
|
|
1148
|
+
"MB",
|
|
1149
|
+
"GB",
|
|
1150
|
+
"TB",
|
|
1151
|
+
"PB",
|
|
1152
|
+
"EB",
|
|
1153
|
+
"ZB",
|
|
1154
|
+
"YB"
|
|
1155
|
+
] : [
|
|
1156
|
+
"KiB",
|
|
1157
|
+
"MiB",
|
|
1158
|
+
"GiB",
|
|
1159
|
+
"TiB",
|
|
1160
|
+
"PiB",
|
|
1161
|
+
"EiB",
|
|
1162
|
+
"ZiB",
|
|
1163
|
+
"YiB"
|
|
1164
|
+
];
|
|
1165
|
+
let u = -1;
|
|
1166
|
+
do {
|
|
1167
|
+
bytes /= thresh;
|
|
1168
|
+
++u;
|
|
1169
|
+
} while (Math.abs(bytes) >= thresh && u < units.length - 1);
|
|
1170
|
+
return bytes.toFixed(2) + " " + units[u];
|
|
1171
|
+
}
|
|
1172
|
+
humanBytes.__type = [
|
|
1173
|
+
"bytes",
|
|
1174
|
+
"si",
|
|
1175
|
+
() => false,
|
|
1176
|
+
"humanBytes",
|
|
1177
|
+
"P'2!)2\">#&/$"
|
|
1178
|
+
];
|
|
1179
|
+
/**
|
|
1180
|
+
* Returns the number of properties on `obj`. This is 20x faster than Object.keys(obj).length.
|
|
1181
|
+
*/
|
|
1182
|
+
function getObjectKeysSize(obj) {
|
|
1183
|
+
let size = 0;
|
|
1184
|
+
for (let i in obj) if (obj.hasOwnProperty(i)) size++;
|
|
1185
|
+
return size;
|
|
1186
|
+
}
|
|
1187
|
+
getObjectKeysSize.__type = [
|
|
1188
|
+
"obj",
|
|
1189
|
+
"getObjectKeysSize",
|
|
1190
|
+
"P%2!'/\""
|
|
1191
|
+
];
|
|
1192
|
+
function isConstructable(fn) {
|
|
1193
|
+
try {
|
|
1194
|
+
new new Proxy(fn, { construct: () => ({}) })();
|
|
1195
|
+
return true;
|
|
1196
|
+
} catch (err) {
|
|
1197
|
+
return false;
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
isConstructable.__type = [
|
|
1201
|
+
"fn",
|
|
1202
|
+
"isConstructable",
|
|
1203
|
+
"P\"2!)/\""
|
|
1204
|
+
];
|
|
1205
|
+
function isPrototypeOfBase(prototype, base) {
|
|
1206
|
+
if (!prototype) return false;
|
|
1207
|
+
if (prototype === base) return true;
|
|
1208
|
+
let currentProto = Object.getPrototypeOf(prototype);
|
|
1209
|
+
while (currentProto && currentProto !== Object.prototype) {
|
|
1210
|
+
if (currentProto === base) return true;
|
|
1211
|
+
currentProto = Object.getPrototypeOf(currentProto);
|
|
1212
|
+
}
|
|
1213
|
+
return false;
|
|
1214
|
+
}
|
|
1215
|
+
isPrototypeOfBase.__type = [
|
|
1216
|
+
() => __ΩAbstractClassType,
|
|
1217
|
+
"prototype",
|
|
1218
|
+
() => __ΩClassType,
|
|
1219
|
+
"base",
|
|
1220
|
+
"isPrototypeOfBase",
|
|
1221
|
+
"PPn!-J2\"n#2$)/%"
|
|
1222
|
+
];
|
|
1223
|
+
function getParentClass(classType) {
|
|
1224
|
+
const parent = Object.getPrototypeOf(classType);
|
|
1225
|
+
if (parent === Object.prototype || Object.getPrototypeOf(parent) === Object.prototype) return;
|
|
1226
|
+
return parent;
|
|
1227
|
+
}
|
|
1228
|
+
getParentClass.__type = [
|
|
1229
|
+
() => __ΩClassType,
|
|
1230
|
+
"classType",
|
|
1231
|
+
() => __ΩClassType,
|
|
1232
|
+
"getParentClass",
|
|
1233
|
+
"Pn!2\"Pn#-J/$"
|
|
1234
|
+
];
|
|
1235
|
+
function getInheritanceChain(classType) {
|
|
1236
|
+
const chain = [classType];
|
|
1237
|
+
let current = classType;
|
|
1238
|
+
while (current = getParentClass(current)) chain.push(current);
|
|
1239
|
+
return chain;
|
|
1240
|
+
}
|
|
1241
|
+
getInheritanceChain.__type = [
|
|
1242
|
+
() => __ΩClassType,
|
|
1243
|
+
"classType",
|
|
1244
|
+
() => __ΩClassType,
|
|
1245
|
+
"getInheritanceChain",
|
|
1246
|
+
"Pn!2\"n#F/$"
|
|
1247
|
+
];
|
|
1248
|
+
function inDebugMode() {
|
|
1249
|
+
return typeof v8debug === "object" || typeof process !== "undefined" && /--debug|--inspect/.test(process.execArgv.join(" "));
|
|
1250
|
+
}
|
|
1251
|
+
inDebugMode.__type = ["inDebugMode", "P\"/!"];
|
|
1252
|
+
/**
|
|
1253
|
+
* Create a new class with the given name.
|
|
1254
|
+
* This is currently the only know way to make it workable in browsers too.
|
|
1255
|
+
*/
|
|
1256
|
+
function createDynamicClass(name, base) {
|
|
1257
|
+
if (base) {
|
|
1258
|
+
let baseName = getClassName(base);
|
|
1259
|
+
if (baseName === name) baseName += "Base";
|
|
1260
|
+
return new Function(baseName, `return class ${name} extends ${baseName} {}`)(base);
|
|
1261
|
+
}
|
|
1262
|
+
return new Function(`return class ${name} {}`)();
|
|
1263
|
+
}
|
|
1264
|
+
createDynamicClass.__type = [
|
|
1265
|
+
"name",
|
|
1266
|
+
() => __ΩClassType,
|
|
1267
|
+
"base",
|
|
1268
|
+
() => __ΩClassType,
|
|
1269
|
+
"createDynamicClass",
|
|
1270
|
+
"P&2!n\"2#8n$/%"
|
|
1271
|
+
];
|
|
1272
|
+
function isIterable(value) {
|
|
1273
|
+
return isArray(value) || value instanceof Set || value instanceof Map;
|
|
1274
|
+
}
|
|
1275
|
+
isIterable.__type = [
|
|
1276
|
+
"value",
|
|
1277
|
+
"isIterable",
|
|
1278
|
+
"P\"2!)/\""
|
|
1279
|
+
];
|
|
1280
|
+
function iterableSize(value) {
|
|
1281
|
+
return isArray(value) ? value.length : value.size || 0;
|
|
1282
|
+
}
|
|
1283
|
+
iterableSize.__type = [
|
|
1284
|
+
"value",
|
|
1285
|
+
"iterableSize",
|
|
1286
|
+
"PP#F#D##EJ2!'/\""
|
|
1287
|
+
];
|
|
1288
|
+
/**
|
|
1289
|
+
* Returns __filename, works in both cjs and esm.
|
|
1290
|
+
*/
|
|
1291
|
+
function getCurrentFileName() {
|
|
1292
|
+
const initiator = (/* @__PURE__ */ new Error()).stack.split("\n").slice(2, 3)[0];
|
|
1293
|
+
let path = /(?<path>[^(\s]+):[0-9]+:[0-9]+/.exec(initiator).groups.path;
|
|
1294
|
+
if (path.indexOf("file") >= 0) path = new URL(path).pathname;
|
|
1295
|
+
if (path[0] === "/" && process.platform === "win32") path = path.slice(1);
|
|
1296
|
+
return path;
|
|
1297
|
+
}
|
|
1298
|
+
getCurrentFileName.__type = ["getCurrentFileName", "P&/!"];
|
|
1299
|
+
/**
|
|
1300
|
+
* Escape special characters in a regex string, so it can be used as a literal string.
|
|
1301
|
+
*/
|
|
1302
|
+
function escapeRegExp(string) {
|
|
1303
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1304
|
+
}
|
|
1305
|
+
escapeRegExp.__type = [
|
|
1306
|
+
"string",
|
|
1307
|
+
"escapeRegExp",
|
|
1308
|
+
"P&2!&/\""
|
|
1309
|
+
];
|
|
1310
|
+
function hasProperty(object, property) {
|
|
1311
|
+
return Object.prototype.hasOwnProperty.call(object, property);
|
|
1312
|
+
}
|
|
1313
|
+
hasProperty.__type = [
|
|
1314
|
+
"object",
|
|
1315
|
+
"property",
|
|
1316
|
+
"hasProperty",
|
|
1317
|
+
"P\"2!\"2\")/#"
|
|
1318
|
+
];
|
|
1319
|
+
/**
|
|
1320
|
+
* Returns an iterator of numbers from start (inclusive) to stop (exclusive) by step.
|
|
1321
|
+
*/
|
|
1322
|
+
function* range(startOrLength, stop = 0, step = 1) {
|
|
1323
|
+
let i = startOrLength;
|
|
1324
|
+
let end = stop;
|
|
1325
|
+
if (stop === 0) {
|
|
1326
|
+
i = 0;
|
|
1327
|
+
end = startOrLength;
|
|
1328
|
+
}
|
|
1329
|
+
for (; i < end; i += step) yield i;
|
|
1330
|
+
}
|
|
1331
|
+
range.__type = [
|
|
1332
|
+
"startOrLength",
|
|
1333
|
+
"stop",
|
|
1334
|
+
() => 0,
|
|
1335
|
+
"step",
|
|
1336
|
+
() => 1,
|
|
1337
|
+
() => __ΩIterableIterator,
|
|
1338
|
+
"range",
|
|
1339
|
+
"P'2!'2\">#'2$>%'o&\"/'"
|
|
1340
|
+
];
|
|
1341
|
+
/**
|
|
1342
|
+
* Returns an array of numbers from start (inclusive) to stop (exclusive) by step.
|
|
1343
|
+
*
|
|
1344
|
+
* Works the same as python's range function.
|
|
1345
|
+
*/
|
|
1346
|
+
function rangeArray(startOrLength, stop = 0, step = 1) {
|
|
1347
|
+
return [...range(startOrLength, stop, step)];
|
|
1348
|
+
}
|
|
1349
|
+
rangeArray.__type = [
|
|
1350
|
+
"startOrLength",
|
|
1351
|
+
"stop",
|
|
1352
|
+
() => 0,
|
|
1353
|
+
"step",
|
|
1354
|
+
() => 1,
|
|
1355
|
+
"rangeArray",
|
|
1356
|
+
"P'2!'2\">#'2$>%'F/&"
|
|
1357
|
+
];
|
|
1358
|
+
/**
|
|
1359
|
+
* Returns a combined array of the given arrays.
|
|
1360
|
+
*
|
|
1361
|
+
* Works the same as python's zip function.
|
|
1362
|
+
*/
|
|
1363
|
+
function zip(...args) {
|
|
1364
|
+
const minLength = Math.min(...args.map(__assignType$2((arr) => arr.length, [
|
|
1365
|
+
"arr",
|
|
1366
|
+
"",
|
|
1367
|
+
"P\"2!\"/\""
|
|
1368
|
+
])));
|
|
1369
|
+
return Array.from({ length: minLength }).map(__assignType$2((_, i) => args.map(__assignType$2((arr) => arr[i], [
|
|
1370
|
+
"arr",
|
|
1371
|
+
"",
|
|
1372
|
+
"P\"2!\"/\""
|
|
1373
|
+
])), [
|
|
1374
|
+
"_",
|
|
1375
|
+
"i",
|
|
1376
|
+
"",
|
|
1377
|
+
"P\"2!\"2\"\"/#"
|
|
1378
|
+
]));
|
|
1379
|
+
}
|
|
1380
|
+
zip.__type = [
|
|
1381
|
+
"args",
|
|
1382
|
+
"zip",
|
|
1383
|
+
"l:e\"!R!RPd\"e#!fh!!Fqk#'QRP\"@2!Pd\"gN)!F/\""
|
|
1384
|
+
];
|
|
1385
|
+
/**
|
|
1386
|
+
* Forwards the runtime type arguments from function x to function y.
|
|
1387
|
+
* This is necessary when a generic function is overridden and forwarded to something else.
|
|
1388
|
+
*
|
|
1389
|
+
* ```typescript
|
|
1390
|
+
* let generic = <T>(type?: ReceiveType<T>) => undefined;
|
|
1391
|
+
*
|
|
1392
|
+
* let forwarded<T> = () => {
|
|
1393
|
+
* forwardTypeArguments(forwarded, generic); //all type arguments are forwarded to generic()
|
|
1394
|
+
* generic(); //call as usual
|
|
1395
|
+
* }
|
|
1396
|
+
*
|
|
1397
|
+
* forwarded<any>(); //generic receives any in runtime.
|
|
1398
|
+
* ```
|
|
1399
|
+
*
|
|
1400
|
+
* Note that generic.bind(this) will not work, as bind() creates a new function and forwarded type arguments can not
|
|
1401
|
+
* reach the original function anymore.
|
|
1402
|
+
*
|
|
1403
|
+
* ```typescript
|
|
1404
|
+
* let forwarded<T> = () => {
|
|
1405
|
+
* const bound = generic.bind(this);
|
|
1406
|
+
* forwardTypeArguments(forwarded, bound); //can not be forwarded anymore
|
|
1407
|
+
* bound(); //fails
|
|
1408
|
+
* }
|
|
1409
|
+
* ```
|
|
1410
|
+
*
|
|
1411
|
+
* This is a limitation of JavaScript. In this case you have to manually forward type arguments.
|
|
1412
|
+
*
|
|
1413
|
+
* ```typescript
|
|
1414
|
+
* let forwarded<T> = (type?: ReceiveType<T>) => {
|
|
1415
|
+
* const bound = generic.bind(this);
|
|
1416
|
+
* bound(type);
|
|
1417
|
+
* }
|
|
1418
|
+
* ```
|
|
1419
|
+
*/
|
|
1420
|
+
function forwardTypeArguments(x, y) {
|
|
1421
|
+
y.Ω = x.Ω;
|
|
1422
|
+
x.Ω = void 0;
|
|
1423
|
+
}
|
|
1424
|
+
forwardTypeArguments.__type = [
|
|
1425
|
+
"x",
|
|
1426
|
+
"y",
|
|
1427
|
+
"forwardTypeArguments",
|
|
1428
|
+
"P\"2!\"2\"$/#"
|
|
1429
|
+
];
|
|
1430
|
+
function formatError(error, withStack = false) {
|
|
1431
|
+
if (error && error.name === "AggregateError" && "errors" in error) return `${withStack && error.stack || `AggregateError: ${error.message}`}\nErrors:\n${error.errors.map(__assignType$2((v) => formatError(v), [
|
|
1432
|
+
"v",
|
|
1433
|
+
"",
|
|
1434
|
+
"P\"2!\"/\""
|
|
1435
|
+
])).join("\n")}`;
|
|
1436
|
+
if (error instanceof Error) {
|
|
1437
|
+
let current = error.cause;
|
|
1438
|
+
let errors = [withStack && error.stack || error.message || "Error"];
|
|
1439
|
+
while (current) {
|
|
1440
|
+
errors.push(`cause by ${formatError(current)}`);
|
|
1441
|
+
current = current.cause;
|
|
1442
|
+
}
|
|
1443
|
+
return errors.join("\n");
|
|
1444
|
+
}
|
|
1445
|
+
if (withStack && error.stack) return error.stack;
|
|
1446
|
+
return String(error);
|
|
1447
|
+
}
|
|
1448
|
+
formatError.__type = [
|
|
1449
|
+
"error",
|
|
1450
|
+
"withStack",
|
|
1451
|
+
() => false,
|
|
1452
|
+
"formatError",
|
|
1453
|
+
"P\"2!)2\">#&/$"
|
|
1454
|
+
];
|
|
1455
|
+
/**
|
|
1456
|
+
* Asserts that the given object is an instance of the given class.
|
|
1457
|
+
*/
|
|
1458
|
+
function assertInstanceOf(object, constructor) {
|
|
1459
|
+
if (!(object instanceof constructor)) throw new Error(`Object ${getClassName(object)} is not an instance of the expected class ${getClassName(constructor)}`);
|
|
1460
|
+
}
|
|
1461
|
+
assertInstanceOf.__type = [
|
|
1462
|
+
"object",
|
|
1463
|
+
"args",
|
|
1464
|
+
"new",
|
|
1465
|
+
"constructor",
|
|
1466
|
+
"assertInstanceOf",
|
|
1467
|
+
"P\"2!PP\"@2\"\"1#M2$!/%"
|
|
1468
|
+
];
|
|
1469
|
+
/**
|
|
1470
|
+
* Asserts that the given value is defined (not null and not undefined).
|
|
1471
|
+
*/
|
|
1472
|
+
function assertDefined(value) {
|
|
1473
|
+
if (value === null || value === void 0) throw new Error(`Value is not defined`);
|
|
1474
|
+
}
|
|
1475
|
+
assertDefined.__type = [
|
|
1476
|
+
"value",
|
|
1477
|
+
"assertDefined",
|
|
1478
|
+
"P\"2!!/\""
|
|
1479
|
+
];
|
|
1480
|
+
|
|
1481
|
+
//#endregion
|
|
1482
|
+
//#region ../../node_modules/.pnpm/to-fast-properties@3.0.1/node_modules/to-fast-properties/index.js
|
|
1483
|
+
var require_to_fast_properties = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1484
|
+
let fastProto = null;
|
|
1485
|
+
function FastObject(o) {
|
|
1486
|
+
if (fastProto !== null && typeof fastProto.property) {
|
|
1487
|
+
const result = fastProto;
|
|
1488
|
+
fastProto = FastObject.prototype = null;
|
|
1489
|
+
return result;
|
|
1490
|
+
}
|
|
1491
|
+
fastProto = FastObject.prototype = o == null ? Object.create(null) : o;
|
|
1492
|
+
return new FastObject();
|
|
1493
|
+
}
|
|
1494
|
+
const inlineCacheCutoff = 10;
|
|
1495
|
+
for (let i = 0; i <= inlineCacheCutoff; i++) FastObject();
|
|
1496
|
+
module.exports = function toFastproperties(o) {
|
|
1497
|
+
return FastObject(o);
|
|
1498
|
+
};
|
|
1499
|
+
}));
|
|
1500
|
+
|
|
1501
|
+
//#endregion
|
|
1502
|
+
//#region ../../node_modules/.pnpm/@deepkit+core@1.0.5_patch_hash=8c3beca4372c6a8941162780ddd0f977ef3d461c2018f0809f86f416260ba440/node_modules/@deepkit/core/dist/esm/src/perf.js
|
|
1503
|
+
var import_to_fast_properties = /* @__PURE__ */ __toESM(require_to_fast_properties(), 1);
|
|
1504
|
+
function toFastProperties(obj) {
|
|
1505
|
+
(0, import_to_fast_properties.default)(obj);
|
|
1506
|
+
}
|
|
1507
|
+
toFastProperties.__type = [
|
|
1508
|
+
"obj",
|
|
1509
|
+
"toFastProperties",
|
|
1510
|
+
"P\"2!\"/\""
|
|
1511
|
+
];
|
|
1512
|
+
|
|
1513
|
+
//#endregion
|
|
1514
|
+
//#region ../../node_modules/.pnpm/@deepkit+core@1.0.5_patch_hash=8c3beca4372c6a8941162780ddd0f977ef3d461c2018f0809f86f416260ba440/node_modules/@deepkit/core/dist/esm/src/array.js
|
|
1515
|
+
/**
|
|
1516
|
+
* @public
|
|
1517
|
+
*/
|
|
1518
|
+
function arrayHasItem(array, item) {
|
|
1519
|
+
return -1 !== array.indexOf(item);
|
|
1520
|
+
}
|
|
1521
|
+
arrayHasItem.__type = [
|
|
1522
|
+
"array",
|
|
1523
|
+
"item",
|
|
1524
|
+
"arrayHasItem",
|
|
1525
|
+
"P\"F2!\"2\")/#"
|
|
1526
|
+
];
|
|
1527
|
+
/**
|
|
1528
|
+
* Clears the array so its empty. Returns the amount of removed items.
|
|
1529
|
+
*
|
|
1530
|
+
* @public
|
|
1531
|
+
*/
|
|
1532
|
+
function arrayClear(array) {
|
|
1533
|
+
const found = array.length;
|
|
1534
|
+
array.length = 0;
|
|
1535
|
+
return found;
|
|
1536
|
+
}
|
|
1537
|
+
arrayClear.__type = [
|
|
1538
|
+
"array",
|
|
1539
|
+
"arrayClear",
|
|
1540
|
+
"P\"F2!'/\""
|
|
1541
|
+
];
|
|
1542
|
+
/**
|
|
1543
|
+
* Removes on particular item by reference of an array.
|
|
1544
|
+
*
|
|
1545
|
+
* @public
|
|
1546
|
+
*/
|
|
1547
|
+
function arrayRemoveItem(array, item) {
|
|
1548
|
+
const index = array.indexOf(item);
|
|
1549
|
+
if (-1 !== index) {
|
|
1550
|
+
array.splice(index, 1);
|
|
1551
|
+
return true;
|
|
1552
|
+
}
|
|
1553
|
+
return false;
|
|
1554
|
+
}
|
|
1555
|
+
arrayRemoveItem.__type = [
|
|
1556
|
+
"array",
|
|
1557
|
+
"item",
|
|
1558
|
+
"arrayRemoveItem",
|
|
1559
|
+
"P\"F2!\"2\")/#"
|
|
1560
|
+
];
|
|
1561
|
+
/**
|
|
1562
|
+
* Moves a particular item in an array up or down (move>0=down, move<0=up).
|
|
1563
|
+
* Changes the array itself.
|
|
1564
|
+
*
|
|
1565
|
+
* ```typescript
|
|
1566
|
+
* const array = ['a', 'b', 'c'];
|
|
1567
|
+
*
|
|
1568
|
+
* arrayMoveItem(array, 'a', +1); //['b', 'a', 'c']
|
|
1569
|
+
* arrayMoveItem(array, 'a', -1); //['a', 'b', 'c']
|
|
1570
|
+
*
|
|
1571
|
+
* arrayMoveItem(array, 'b', -1); //['b', 'a', 'c']
|
|
1572
|
+
* arrayMoveItem(array, 'b', +1); //['a', 'c', 'b']
|
|
1573
|
+
*
|
|
1574
|
+
* arrayMoveItem(array, 'c', -1); //['b', 'c', 'b']
|
|
1575
|
+
* arrayMoveItem(array, 'c', +1); //['a', 'b', 'c']
|
|
1576
|
+
*
|
|
1577
|
+
* ```
|
|
1578
|
+
*
|
|
1579
|
+
* @public
|
|
1580
|
+
*/
|
|
1581
|
+
function arrayMoveItem(array, item, move) {
|
|
1582
|
+
if (move === 0) return array;
|
|
1583
|
+
const index = array.indexOf(item);
|
|
1584
|
+
if (-1 !== index) {
|
|
1585
|
+
const newIndex = index + move;
|
|
1586
|
+
array.splice(index, 1);
|
|
1587
|
+
if (newIndex <= 0) array.unshift(item);
|
|
1588
|
+
else if (newIndex >= array.length) array.push(item);
|
|
1589
|
+
else array.splice(newIndex, 0, item);
|
|
1590
|
+
}
|
|
1591
|
+
return array;
|
|
1592
|
+
}
|
|
1593
|
+
arrayMoveItem.__type = [
|
|
1594
|
+
"array",
|
|
1595
|
+
"item",
|
|
1596
|
+
"move",
|
|
1597
|
+
"arrayMoveItem",
|
|
1598
|
+
"P\"2!\"2\"'2#\"/$"
|
|
1599
|
+
];
|
|
1600
|
+
|
|
1601
|
+
//#endregion
|
|
1602
|
+
//#region ../../node_modules/.pnpm/@deepkit+core@1.0.5_patch_hash=8c3beca4372c6a8941162780ddd0f977ef3d461c2018f0809f86f416260ba440/node_modules/@deepkit/core/dist/esm/src/indent.js
|
|
1603
|
+
function __assignType$1(fn, args) {
|
|
1604
|
+
fn.__type = args;
|
|
1605
|
+
return fn;
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* @reflection never
|
|
1609
|
+
*/
|
|
1610
|
+
const indent$1 = __assignType$1(function(n) {
|
|
1611
|
+
function t(n, t) {
|
|
1612
|
+
var e, r = [];
|
|
1613
|
+
for (e = 0; e < n.length; e++) r.push(t(n[e], e, n));
|
|
1614
|
+
return r;
|
|
1615
|
+
}
|
|
1616
|
+
t.__type = [
|
|
1617
|
+
"n",
|
|
1618
|
+
"t",
|
|
1619
|
+
"P\"2!\"2\"\"/\""
|
|
1620
|
+
];
|
|
1621
|
+
function e(n, t) {
|
|
1622
|
+
var e, r;
|
|
1623
|
+
for (e = 0; e < n.length; e++) if (r = t(n[e], e, n)) return r;
|
|
1624
|
+
return !1;
|
|
1625
|
+
}
|
|
1626
|
+
e.__type = [
|
|
1627
|
+
"n",
|
|
1628
|
+
"t",
|
|
1629
|
+
"e",
|
|
1630
|
+
"P\"2!\"2\"\"/#"
|
|
1631
|
+
];
|
|
1632
|
+
function r(n, t, e) {
|
|
1633
|
+
if (d[n]) return d[n];
|
|
1634
|
+
var r = [];
|
|
1635
|
+
d[n] = r, e = e || "";
|
|
1636
|
+
for (var a = 0; a < t.length; a++) t[a].a.indexOf(n.toLowerCase()) !== -1 && e.indexOf(t[a].b) === -1 && r.push(t[a]);
|
|
1637
|
+
return r;
|
|
1638
|
+
}
|
|
1639
|
+
r.__type = [
|
|
1640
|
+
"n",
|
|
1641
|
+
"t",
|
|
1642
|
+
"e",
|
|
1643
|
+
"r",
|
|
1644
|
+
"P\"2!\"2\"\"2#\"/$"
|
|
1645
|
+
];
|
|
1646
|
+
function a(n, a, o) {
|
|
1647
|
+
function h(n) {
|
|
1648
|
+
P = n.cursor;
|
|
1649
|
+
var t = n.rule, e = E + 1 + (t.c || 0);
|
|
1650
|
+
n.line = e, Z.push(n), t.d && z[e]++, t.e && (S = r(t.e, g)), t.f && F.push(null), t.callback && t.callback(n, z, O);
|
|
1651
|
+
}
|
|
1652
|
+
h.__type = [
|
|
1653
|
+
"n",
|
|
1654
|
+
"h",
|
|
1655
|
+
"P\"2!\"/\""
|
|
1656
|
+
];
|
|
1657
|
+
function d() {
|
|
1658
|
+
var n = Z.pop(), t = n.line, e = n.rule;
|
|
1659
|
+
if (e.d) {
|
|
1660
|
+
var a = ("function" == typeof e.g ? e.g(b) : e.g) || 0 !== b.matchIndex ? 1 : 0;
|
|
1661
|
+
O[E + a] && O[E + a].push(t);
|
|
1662
|
+
}
|
|
1663
|
+
e.e && (S = null), e.f && F.pop(), F[F.length - 1] = n;
|
|
1664
|
+
}
|
|
1665
|
+
d.__type = ["d", "P\"/!"];
|
|
1666
|
+
function m(n, r, a) {
|
|
1667
|
+
n = n.substring(a, n.length);
|
|
1668
|
+
for (var l, s, i, c = null, u = n.length, o = F[F.length - 1], h = o ? o.rule.b : "", d = t(Z, __assignType$1(function(n) {
|
|
1669
|
+
return n.rule.b;
|
|
1670
|
+
}, [
|
|
1671
|
+
"n",
|
|
1672
|
+
"",
|
|
1673
|
+
"P\"2!\"/\""
|
|
1674
|
+
])).join("\n"), m = 0; m < r.length; m++) i = r[m], i.h && e(i.h, __assignType$1(function(n) {
|
|
1675
|
+
return d.indexOf(n) != -1;
|
|
1676
|
+
}, [
|
|
1677
|
+
"n",
|
|
1678
|
+
"",
|
|
1679
|
+
"P\"2!\"/\""
|
|
1680
|
+
])) || (!i.i || h && i.i.indexOf(h) !== -1) && (s = f(n, i.j, i), s.matchIndex != -1 && s.matchIndex < u && (!i.k || 0 === a) && (u = s.matchIndex, l = s, c = i));
|
|
1681
|
+
return {
|
|
1682
|
+
rule: c,
|
|
1683
|
+
relativeIndex: c ? u : -1,
|
|
1684
|
+
matchIndex: c ? u + a : -1,
|
|
1685
|
+
cursor: c ? a + l.cursor : -1,
|
|
1686
|
+
state: l ? l.state : {},
|
|
1687
|
+
lastMatch: o
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
m.__type = [
|
|
1691
|
+
"n",
|
|
1692
|
+
"r",
|
|
1693
|
+
"a",
|
|
1694
|
+
"m",
|
|
1695
|
+
"P\"2!\"2\"\"2#\"/$"
|
|
1696
|
+
];
|
|
1697
|
+
function j(n, t, e, r) {
|
|
1698
|
+
n = n.substr(e, n.length);
|
|
1699
|
+
var a = t.rule, l = f(n, a.l, a, t.state, r), s = a.m ? l.cursor : l.matchIndex;
|
|
1700
|
+
return {
|
|
1701
|
+
endPatternIndex: l.endPatternIndex,
|
|
1702
|
+
matchIndex: l.matchIndex === -1 ? -1 : l.matchIndex + e,
|
|
1703
|
+
cursor: s === -1 ? -1 : s + e,
|
|
1704
|
+
state: l.state
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1707
|
+
j.__type = [
|
|
1708
|
+
"n",
|
|
1709
|
+
"t",
|
|
1710
|
+
"e",
|
|
1711
|
+
"r",
|
|
1712
|
+
"j",
|
|
1713
|
+
"P\"2!\"2\"\"2#\"2$\"/%"
|
|
1714
|
+
];
|
|
1715
|
+
n = n || "";
|
|
1716
|
+
var b, x, v, p, I, y = o && null != o.tabString ? o.tabString : " ", k = n.split(/[\r]?\n/gi), w = k.length, A = s(w), z = s(w), O = l(w), Z = [], F = [null], E = 0, P = 0, S = null;
|
|
1717
|
+
for (o && (o.debug = { buffers: {
|
|
1718
|
+
ignore: A,
|
|
1719
|
+
indent: z,
|
|
1720
|
+
dedent: O,
|
|
1721
|
+
active: Z
|
|
1722
|
+
} }); E < w;) {
|
|
1723
|
+
if (v = k[E].trim(), p = u(v) + "\r\n", I = Z[Z.length - 1], x = m(p, S || a, P), Z.length) {
|
|
1724
|
+
if (b = j(p, I, P, x), b.matchIndex === -1) {
|
|
1725
|
+
if (I.rule.n) {
|
|
1726
|
+
A[E] = 1, E++, P = 0;
|
|
1727
|
+
continue;
|
|
1728
|
+
}
|
|
1729
|
+
} else if (I.rule.n || x.matchIndex === -1 || b.matchIndex <= x.matchIndex) {
|
|
1730
|
+
d(), P = b.cursor;
|
|
1731
|
+
continue;
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
x.matchIndex !== -1 ? h(x) : (E++, P = 0);
|
|
1735
|
+
}
|
|
1736
|
+
var $, q, R, T, M, C, H = 0, L = i(z), _ = s(w), B = [];
|
|
1737
|
+
for (M = 0; M < w; M++) {
|
|
1738
|
+
for (q = O[M], T = 0, C = 0; C < q.length; C++) R = q[C], R < 0 ? -R !== M && (_[-R]++, T += 1) : L[R] > 0 && (L[R]--, T += R !== M);
|
|
1739
|
+
$ = L[M], _[M] = $ > T ? 1 : $ < T ? $ - T : 0, L[M] = $ > 0 ? 1 : 0;
|
|
1740
|
+
}
|
|
1741
|
+
for (M = 0; M < w; M++) 1 === A[M - 1] && 1 === A[M] ? B.push(k[M]) : (H += _[M] || 0, B.push((H > 0 ? c(y, H) : "") + k[M].trim()));
|
|
1742
|
+
return B.join("\r\n");
|
|
1743
|
+
}
|
|
1744
|
+
a.__type = [
|
|
1745
|
+
"n",
|
|
1746
|
+
"a",
|
|
1747
|
+
"o",
|
|
1748
|
+
"P\"2!\"2\"\"2#\"/\""
|
|
1749
|
+
];
|
|
1750
|
+
function l(n) {
|
|
1751
|
+
for (var t = new Array(n), e = 0; e < n; e++) t[e] = [];
|
|
1752
|
+
return t;
|
|
1753
|
+
}
|
|
1754
|
+
l.__type = [
|
|
1755
|
+
"n",
|
|
1756
|
+
"l",
|
|
1757
|
+
"P\"2!\"/\""
|
|
1758
|
+
];
|
|
1759
|
+
function s(t) {
|
|
1760
|
+
if (n.Int16Array) return new Int16Array(t);
|
|
1761
|
+
for (var e = new Array(t), r = 0; r < t; r++) e[r] = 0;
|
|
1762
|
+
return e;
|
|
1763
|
+
}
|
|
1764
|
+
s.__type = [
|
|
1765
|
+
"t",
|
|
1766
|
+
"s",
|
|
1767
|
+
"P\"2!\"/\""
|
|
1768
|
+
];
|
|
1769
|
+
function i(n) {
|
|
1770
|
+
for (var t = s(n.length), e = 0; e < n.length; e++) t[e] = n[e];
|
|
1771
|
+
return t;
|
|
1772
|
+
}
|
|
1773
|
+
i.__type = [
|
|
1774
|
+
"n",
|
|
1775
|
+
"i",
|
|
1776
|
+
"P\"2!\"/\""
|
|
1777
|
+
];
|
|
1778
|
+
function c(n, t) {
|
|
1779
|
+
return new Array(t + 1).join(n);
|
|
1780
|
+
}
|
|
1781
|
+
c.__type = [
|
|
1782
|
+
"n",
|
|
1783
|
+
"t",
|
|
1784
|
+
"c",
|
|
1785
|
+
"P\"2!\"2\"\"/#"
|
|
1786
|
+
];
|
|
1787
|
+
function u(n) {
|
|
1788
|
+
return n.replace(/\\(u[0-9A-Za-z]{4}|u\{[0-9A-Za-z]{1,6}]\}|x[0-9A-Za-z]{2}|.)/g, "0");
|
|
1789
|
+
}
|
|
1790
|
+
u.__type = [
|
|
1791
|
+
"n",
|
|
1792
|
+
"u",
|
|
1793
|
+
"P\"2!\"/\""
|
|
1794
|
+
];
|
|
1795
|
+
function o(n, t, e) {
|
|
1796
|
+
var r = n.lastMatch;
|
|
1797
|
+
r && "=" === r.rule.b && e[n.line].push(-r.line);
|
|
1798
|
+
}
|
|
1799
|
+
o.__type = [
|
|
1800
|
+
"n",
|
|
1801
|
+
"t",
|
|
1802
|
+
"e",
|
|
1803
|
+
"o",
|
|
1804
|
+
"P\"2!\"2\"\"2#\"/$"
|
|
1805
|
+
];
|
|
1806
|
+
function h(n, t, e, r) {
|
|
1807
|
+
var a;
|
|
1808
|
+
if (e.newline) {
|
|
1809
|
+
if (a = n.search(/[;,=]?\r*\n/), a !== -1) return {
|
|
1810
|
+
matchIndex: a,
|
|
1811
|
+
length: 1
|
|
1812
|
+
};
|
|
1813
|
+
} else a = n.search(/[^\s\r\n\{\(\[]/), e.newline = a !== -1 && (a <= r.relativeIndex || r.relativeIndex === -1);
|
|
1814
|
+
return null;
|
|
1815
|
+
}
|
|
1816
|
+
h.__type = [
|
|
1817
|
+
"n",
|
|
1818
|
+
"t",
|
|
1819
|
+
"e",
|
|
1820
|
+
"r",
|
|
1821
|
+
"h",
|
|
1822
|
+
"P\"2!\"2\"\"2#\"2$\"/%"
|
|
1823
|
+
];
|
|
1824
|
+
function f(n, t, e, r, a) {
|
|
1825
|
+
r = r || {};
|
|
1826
|
+
for (var l, s, i = -1, c = 0, u = 0; u < t.length; u++) if (s = t[u], "function" == typeof s) {
|
|
1827
|
+
if (l = s(n, e, r, a)) {
|
|
1828
|
+
i = l.matchIndex, c = l.length;
|
|
1829
|
+
break;
|
|
1830
|
+
}
|
|
1831
|
+
} else if (l = n.match(s)) {
|
|
1832
|
+
i = n.search(s), c = l[0].length;
|
|
1833
|
+
break;
|
|
1834
|
+
}
|
|
1835
|
+
return {
|
|
1836
|
+
endPatternIndex: u,
|
|
1837
|
+
matchIndex: i,
|
|
1838
|
+
cursor: i + c,
|
|
1839
|
+
state: r
|
|
1840
|
+
};
|
|
1841
|
+
}
|
|
1842
|
+
f.__type = [
|
|
1843
|
+
"n",
|
|
1844
|
+
"t",
|
|
1845
|
+
"e",
|
|
1846
|
+
"r",
|
|
1847
|
+
"a",
|
|
1848
|
+
"f",
|
|
1849
|
+
"P\"2!\"2\"\"2#\"2$\"2%\"/&"
|
|
1850
|
+
];
|
|
1851
|
+
var d = {};
|
|
1852
|
+
String.prototype.trim || (String.prototype.trim = function() {
|
|
1853
|
+
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
1854
|
+
});
|
|
1855
|
+
var m = /\r*\n/, j = [
|
|
1856
|
+
"tag",
|
|
1857
|
+
"void-tags",
|
|
1858
|
+
"html-tag"
|
|
1859
|
+
], g = [
|
|
1860
|
+
{
|
|
1861
|
+
a: "js html",
|
|
1862
|
+
b: "comment",
|
|
1863
|
+
j: [/\<\!\-\-/],
|
|
1864
|
+
l: [/\-\-\>/],
|
|
1865
|
+
n: !0,
|
|
1866
|
+
m: !0
|
|
1867
|
+
},
|
|
1868
|
+
{
|
|
1869
|
+
a: "html",
|
|
1870
|
+
b: "doctype",
|
|
1871
|
+
j: [/\<\!doctype html>/i],
|
|
1872
|
+
l: [m],
|
|
1873
|
+
n: !0,
|
|
1874
|
+
m: !0
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
a: "js html",
|
|
1878
|
+
b: "void-tags",
|
|
1879
|
+
j: [/\<(area|base|br|col|command|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)/i],
|
|
1880
|
+
l: [/>/],
|
|
1881
|
+
d: !0,
|
|
1882
|
+
m: !0
|
|
1883
|
+
},
|
|
1884
|
+
{
|
|
1885
|
+
a: "html",
|
|
1886
|
+
b: "mode switch js",
|
|
1887
|
+
j: [__assignType$1(function(n) {
|
|
1888
|
+
var t = /<script[\s>].*/i, e = /<\/script>/i, r = t.exec(n), a = e.exec(n);
|
|
1889
|
+
return r && (!a || a.index < r.index) ? {
|
|
1890
|
+
matchIndex: r.index,
|
|
1891
|
+
length: r[0].length
|
|
1892
|
+
} : null;
|
|
1893
|
+
}, [
|
|
1894
|
+
"n",
|
|
1895
|
+
"",
|
|
1896
|
+
"P\"2!\"/\""
|
|
1897
|
+
])],
|
|
1898
|
+
l: [/<\/script>/i],
|
|
1899
|
+
e: "js",
|
|
1900
|
+
m: !0,
|
|
1901
|
+
d: !0,
|
|
1902
|
+
f: !0
|
|
1903
|
+
},
|
|
1904
|
+
{
|
|
1905
|
+
a: "html",
|
|
1906
|
+
b: "mode switch css",
|
|
1907
|
+
j: [__assignType$1(function(n) {
|
|
1908
|
+
var t = /<style[\s>].*/i, e = /<\/style>/i, r = t.exec(n), a = e.exec(n);
|
|
1909
|
+
return r && (!a || a.index < r.index) ? {
|
|
1910
|
+
matchIndex: r.index,
|
|
1911
|
+
length: r[0].length
|
|
1912
|
+
} : null;
|
|
1913
|
+
}, [
|
|
1914
|
+
"n",
|
|
1915
|
+
"",
|
|
1916
|
+
"P\"2!\"/\""
|
|
1917
|
+
])],
|
|
1918
|
+
l: [/<\/style>/i],
|
|
1919
|
+
e: "css",
|
|
1920
|
+
m: !0,
|
|
1921
|
+
d: !0,
|
|
1922
|
+
f: !0
|
|
1923
|
+
},
|
|
1924
|
+
{
|
|
1925
|
+
a: "html",
|
|
1926
|
+
b: "html-tag",
|
|
1927
|
+
j: [/<html[^A-Za-z0-9]/i],
|
|
1928
|
+
l: [/<\/html>/i],
|
|
1929
|
+
m: !0
|
|
1930
|
+
},
|
|
1931
|
+
{
|
|
1932
|
+
a: "js html",
|
|
1933
|
+
b: "tag",
|
|
1934
|
+
j: [__assignType$1(function(n, t, e) {
|
|
1935
|
+
var a = n.match(/<([A-Za-z][A-Za-z0-9\-\.]*)/);
|
|
1936
|
+
return a ? (e.openingTag = a[1], {
|
|
1937
|
+
matchIndex: a.index,
|
|
1938
|
+
length: a[0].length
|
|
1939
|
+
}) : null;
|
|
1940
|
+
}, [
|
|
1941
|
+
"n",
|
|
1942
|
+
"t",
|
|
1943
|
+
"e",
|
|
1944
|
+
"",
|
|
1945
|
+
"P\"2!\"2\"\"2#\"/$"
|
|
1946
|
+
])],
|
|
1947
|
+
l: [__assignType$1(function(n, t, e) {
|
|
1948
|
+
var r = new RegExp("</" + e.openingTag + ">|\\s/>", "i"), a = n.match(r);
|
|
1949
|
+
return a ? {
|
|
1950
|
+
matchIndex: a.index,
|
|
1951
|
+
length: a[0].length
|
|
1952
|
+
} : null;
|
|
1953
|
+
}, [
|
|
1954
|
+
"n",
|
|
1955
|
+
"t",
|
|
1956
|
+
"e",
|
|
1957
|
+
"",
|
|
1958
|
+
"P\"2!\"2\"\"2#\"/$"
|
|
1959
|
+
])],
|
|
1960
|
+
d: !0,
|
|
1961
|
+
m: !0
|
|
1962
|
+
},
|
|
1963
|
+
{
|
|
1964
|
+
a: "js",
|
|
1965
|
+
b: "line-comment",
|
|
1966
|
+
j: [/\/\//],
|
|
1967
|
+
l: [m],
|
|
1968
|
+
n: !0
|
|
1969
|
+
},
|
|
1970
|
+
{
|
|
1971
|
+
a: "js css",
|
|
1972
|
+
b: "block-comment",
|
|
1973
|
+
j: [/\/\*/],
|
|
1974
|
+
l: [/\*\//],
|
|
1975
|
+
n: !0,
|
|
1976
|
+
m: !0
|
|
1977
|
+
},
|
|
1978
|
+
{
|
|
1979
|
+
a: "js",
|
|
1980
|
+
b: "regex",
|
|
1981
|
+
j: [__assignType$1(function(n, t) {
|
|
1982
|
+
var r = n.search(/[(,=:[!&|?{};][\s]*\/[^\/]|^[\s]*\/[^\/]/);
|
|
1983
|
+
if (r != -1) {
|
|
1984
|
+
r = n.indexOf("/", r);
|
|
1985
|
+
var a = n.substring(r + 1), l = f(a, t.l, t);
|
|
1986
|
+
if (l.matchIndex != -1) {
|
|
1987
|
+
a = a.substring(0, l.matchIndex);
|
|
1988
|
+
try {
|
|
1989
|
+
return new RegExp(a), {
|
|
1990
|
+
matchIndex: r,
|
|
1991
|
+
length: 1
|
|
1992
|
+
};
|
|
1993
|
+
} catch (s) {
|
|
1994
|
+
return null;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
return null;
|
|
1999
|
+
}, [
|
|
2000
|
+
"n",
|
|
2001
|
+
"t",
|
|
2002
|
+
"",
|
|
2003
|
+
"P\"2!\"2\"\"/#"
|
|
2004
|
+
])],
|
|
2005
|
+
l: [__assignType$1(function(n) {
|
|
2006
|
+
for (var t = 0, e = n.indexOf("/"); e != -1;) try {
|
|
2007
|
+
new RegExp(n.substring(0, e));
|
|
2008
|
+
break;
|
|
2009
|
+
} catch (r) {
|
|
2010
|
+
e = n.indexOf("/", t), t = e + 1;
|
|
2011
|
+
}
|
|
2012
|
+
return e === -1 ? null : {
|
|
2013
|
+
matchIndex: e,
|
|
2014
|
+
length: 1
|
|
2015
|
+
};
|
|
2016
|
+
}, [
|
|
2017
|
+
"n",
|
|
2018
|
+
"",
|
|
2019
|
+
"P\"2!\"/\""
|
|
2020
|
+
])],
|
|
2021
|
+
n: !0,
|
|
2022
|
+
m: !0
|
|
2023
|
+
},
|
|
2024
|
+
{
|
|
2025
|
+
a: "js html",
|
|
2026
|
+
b: "quotes",
|
|
2027
|
+
h: j,
|
|
2028
|
+
j: [/"/],
|
|
2029
|
+
l: [/"/, m],
|
|
2030
|
+
n: !0,
|
|
2031
|
+
m: !0
|
|
2032
|
+
},
|
|
2033
|
+
{
|
|
2034
|
+
a: "js html",
|
|
2035
|
+
b: "quotes",
|
|
2036
|
+
h: j,
|
|
2037
|
+
j: [/'/],
|
|
2038
|
+
l: [/'/, m],
|
|
2039
|
+
n: !0,
|
|
2040
|
+
m: !0
|
|
2041
|
+
},
|
|
2042
|
+
{
|
|
2043
|
+
a: "js css",
|
|
2044
|
+
b: "string",
|
|
2045
|
+
j: [/(''|""|``)/],
|
|
2046
|
+
l: [/./, m]
|
|
2047
|
+
},
|
|
2048
|
+
{
|
|
2049
|
+
a: "js css",
|
|
2050
|
+
b: "string",
|
|
2051
|
+
j: [/\"(?=[^"])/],
|
|
2052
|
+
l: [/[^\\]\"/, m],
|
|
2053
|
+
n: !0,
|
|
2054
|
+
m: !0
|
|
2055
|
+
},
|
|
2056
|
+
{
|
|
2057
|
+
a: "js css",
|
|
2058
|
+
b: "string",
|
|
2059
|
+
j: [/\'(?=[^'])/],
|
|
2060
|
+
l: [/[^\\]\'/, m],
|
|
2061
|
+
n: !0,
|
|
2062
|
+
m: !0
|
|
2063
|
+
},
|
|
2064
|
+
{
|
|
2065
|
+
a: "js css",
|
|
2066
|
+
b: "string",
|
|
2067
|
+
j: [/\`(?=[^`])/],
|
|
2068
|
+
l: [/[^\\]\`/],
|
|
2069
|
+
n: !0,
|
|
2070
|
+
m: !0
|
|
2071
|
+
},
|
|
2072
|
+
{
|
|
2073
|
+
a: "js",
|
|
2074
|
+
b: "if",
|
|
2075
|
+
j: [/^if\s*(?=\()/, /[\s]+if\s*(?=\()/],
|
|
2076
|
+
l: [
|
|
2077
|
+
/else[\s]+/,
|
|
2078
|
+
h,
|
|
2079
|
+
/[{;]/
|
|
2080
|
+
],
|
|
2081
|
+
d: !0
|
|
2082
|
+
},
|
|
2083
|
+
{
|
|
2084
|
+
a: "js",
|
|
2085
|
+
b: "for|while",
|
|
2086
|
+
j: [/^(for|while)\s*(?=\()/],
|
|
2087
|
+
l: [h, /[{;]/],
|
|
2088
|
+
d: !0
|
|
2089
|
+
},
|
|
2090
|
+
{
|
|
2091
|
+
a: "js",
|
|
2092
|
+
b: "else",
|
|
2093
|
+
j: [/else[\s]+/],
|
|
2094
|
+
l: [
|
|
2095
|
+
/if[^\w$]/,
|
|
2096
|
+
h,
|
|
2097
|
+
/[{;]/
|
|
2098
|
+
],
|
|
2099
|
+
d: !0
|
|
2100
|
+
},
|
|
2101
|
+
{
|
|
2102
|
+
a: "js css",
|
|
2103
|
+
b: "bracket",
|
|
2104
|
+
j: [/\(\s*(var|let|const)?\s*/],
|
|
2105
|
+
l: [/\)/],
|
|
2106
|
+
d: !0,
|
|
2107
|
+
m: !0,
|
|
2108
|
+
f: !0
|
|
2109
|
+
},
|
|
2110
|
+
{
|
|
2111
|
+
a: "js",
|
|
2112
|
+
b: "dot-chain",
|
|
2113
|
+
j: [/^\.[A-Za-z$_]/],
|
|
2114
|
+
l: [/[\.;]/, m],
|
|
2115
|
+
d: !0,
|
|
2116
|
+
k: !0,
|
|
2117
|
+
c: -1
|
|
2118
|
+
},
|
|
2119
|
+
{
|
|
2120
|
+
a: "js",
|
|
2121
|
+
b: "dot-chain",
|
|
2122
|
+
j: [/\.\s*\r*\n/],
|
|
2123
|
+
l: [/[\.;})\]]/, /[^\s]\s*\r*\n/],
|
|
2124
|
+
d: !0
|
|
2125
|
+
},
|
|
2126
|
+
{
|
|
2127
|
+
a: "js css",
|
|
2128
|
+
b: "array",
|
|
2129
|
+
j: [/\[/],
|
|
2130
|
+
l: [/\]/],
|
|
2131
|
+
d: !0,
|
|
2132
|
+
m: !0,
|
|
2133
|
+
f: !0
|
|
2134
|
+
},
|
|
2135
|
+
{
|
|
2136
|
+
a: "js css",
|
|
2137
|
+
b: "block",
|
|
2138
|
+
j: [/\{/],
|
|
2139
|
+
l: [/\}/],
|
|
2140
|
+
d: !0,
|
|
2141
|
+
m: !0,
|
|
2142
|
+
f: !0
|
|
2143
|
+
},
|
|
2144
|
+
{
|
|
2145
|
+
a: "js",
|
|
2146
|
+
b: "var/let/const",
|
|
2147
|
+
j: [/(var|let|const)[\s]*\r*\n/],
|
|
2148
|
+
l: [h],
|
|
2149
|
+
d: !0,
|
|
2150
|
+
g: !0
|
|
2151
|
+
},
|
|
2152
|
+
{
|
|
2153
|
+
a: "js",
|
|
2154
|
+
b: "var/let/const",
|
|
2155
|
+
j: [/(var|let|const)\s+(?=[\w$])/],
|
|
2156
|
+
l: [/[,;=]/, h],
|
|
2157
|
+
d: !0
|
|
2158
|
+
},
|
|
2159
|
+
{
|
|
2160
|
+
a: "js",
|
|
2161
|
+
b: "var/let/const",
|
|
2162
|
+
i: ["var/let/const", "="],
|
|
2163
|
+
j: [/,[\s]*\r*\n/],
|
|
2164
|
+
l: [/[,;]/, h],
|
|
2165
|
+
d: !0,
|
|
2166
|
+
callback: o
|
|
2167
|
+
},
|
|
2168
|
+
{
|
|
2169
|
+
a: "js",
|
|
2170
|
+
b: "var/let/const",
|
|
2171
|
+
i: ["var/let/const", "="],
|
|
2172
|
+
j: [/^,/],
|
|
2173
|
+
l: [/[,;]/, h],
|
|
2174
|
+
k: !0,
|
|
2175
|
+
d: !0,
|
|
2176
|
+
c: -1,
|
|
2177
|
+
callback: o
|
|
2178
|
+
},
|
|
2179
|
+
{
|
|
2180
|
+
a: "js",
|
|
2181
|
+
b: "equality",
|
|
2182
|
+
j: [/[=<>!]=(=)?/],
|
|
2183
|
+
l: [/./]
|
|
2184
|
+
},
|
|
2185
|
+
{
|
|
2186
|
+
a: "js",
|
|
2187
|
+
b: "=",
|
|
2188
|
+
h: j,
|
|
2189
|
+
j: [/=/],
|
|
2190
|
+
l: [/[,;\)\]}]/, m]
|
|
2191
|
+
},
|
|
2192
|
+
{
|
|
2193
|
+
a: "js",
|
|
2194
|
+
b: "?:",
|
|
2195
|
+
j: [/\?/],
|
|
2196
|
+
l: [/[:;]/],
|
|
2197
|
+
g: !0,
|
|
2198
|
+
d: !0
|
|
2199
|
+
},
|
|
2200
|
+
{
|
|
2201
|
+
a: "js",
|
|
2202
|
+
b: "case",
|
|
2203
|
+
j: [/^(case|default)[\s:]/],
|
|
2204
|
+
l: [
|
|
2205
|
+
/break[\s;\r\n]/,
|
|
2206
|
+
/^return[\s;\r\n]/,
|
|
2207
|
+
/^case[\s]+/,
|
|
2208
|
+
/^default[\s:]/,
|
|
2209
|
+
/}/
|
|
2210
|
+
],
|
|
2211
|
+
g: __assignType$1(function(n) {
|
|
2212
|
+
return n.endPatternIndex <= 1;
|
|
2213
|
+
}, [
|
|
2214
|
+
"n",
|
|
2215
|
+
"",
|
|
2216
|
+
"P\"2!\"/\""
|
|
2217
|
+
]),
|
|
2218
|
+
d: !0,
|
|
2219
|
+
f: !0
|
|
2220
|
+
},
|
|
2221
|
+
{
|
|
2222
|
+
a: "js",
|
|
2223
|
+
b: "semicolon",
|
|
2224
|
+
j: [/;/],
|
|
2225
|
+
l: [/./]
|
|
2226
|
+
}
|
|
2227
|
+
];
|
|
2228
|
+
return {
|
|
2229
|
+
css: __assignType$1(function(n, t) {
|
|
2230
|
+
return a(n, r("css", g), t);
|
|
2231
|
+
}, [
|
|
2232
|
+
"n",
|
|
2233
|
+
"t",
|
|
2234
|
+
"",
|
|
2235
|
+
"P\"2!\"2\"\"/#"
|
|
2236
|
+
]),
|
|
2237
|
+
js: __assignType$1(function(n, t) {
|
|
2238
|
+
return a(n, r("js", g), t);
|
|
2239
|
+
}, [
|
|
2240
|
+
"n",
|
|
2241
|
+
"t",
|
|
2242
|
+
"",
|
|
2243
|
+
"P\"2!\"2\"\"/#"
|
|
2244
|
+
]),
|
|
2245
|
+
ts: __assignType$1(function(n, t) {
|
|
2246
|
+
return a(n, r("js", g), t);
|
|
2247
|
+
}, [
|
|
2248
|
+
"n",
|
|
2249
|
+
"t",
|
|
2250
|
+
"",
|
|
2251
|
+
"P\"2!\"2\"\"/#"
|
|
2252
|
+
]),
|
|
2253
|
+
html: __assignType$1(function(n, t) {
|
|
2254
|
+
return a(n, t && t.indentHtmlTag ? r("html", g, "html-tag") : r("html", g), t);
|
|
2255
|
+
}, [
|
|
2256
|
+
"n",
|
|
2257
|
+
"t",
|
|
2258
|
+
"",
|
|
2259
|
+
"P\"2!\"2\"\"/#"
|
|
2260
|
+
])
|
|
2261
|
+
};
|
|
2262
|
+
}, [
|
|
2263
|
+
"n",
|
|
2264
|
+
"",
|
|
2265
|
+
"P\"2!\"/\""
|
|
2266
|
+
])(globalThis);
|
|
2267
|
+
|
|
2268
|
+
//#endregion
|
|
2269
|
+
//#region ../../node_modules/.pnpm/@deepkit+core@1.0.5_patch_hash=8c3beca4372c6a8941162780ddd0f977ef3d461c2018f0809f86f416260ba440/node_modules/@deepkit/core/dist/esm/src/compiler.js
|
|
2270
|
+
const __ΩPartial = [
|
|
2271
|
+
"T",
|
|
2272
|
+
"Partial",
|
|
2273
|
+
"l+e#!e\"!fRb!Pde\"!gN#\"w\"y"
|
|
2274
|
+
];
|
|
2275
|
+
const indentCode = ("undefined" !== typeof process && process.env?.DEBUG || "").includes("deepkit");
|
|
2276
|
+
var CompilerContext = class {
|
|
2277
|
+
constructor(config = {}) {
|
|
2278
|
+
this.context = (Map.Ω = [["&"], ["\""]], /* @__PURE__ */ new Map());
|
|
2279
|
+
this.constVariables = (Map.Ω = [["\""], ["&"]], /* @__PURE__ */ new Map());
|
|
2280
|
+
this.maxReservedVariable = 1e4;
|
|
2281
|
+
this.reservedNames = (Set.Ω = [["&"]], /* @__PURE__ */ new Set());
|
|
2282
|
+
this.variableContext = {};
|
|
2283
|
+
/**
|
|
2284
|
+
* Code that is executed in the context, but before the actual function is generated.
|
|
2285
|
+
* This helps for example to initialize dynamically some context variables.
|
|
2286
|
+
*/
|
|
2287
|
+
this.preCode = "";
|
|
2288
|
+
this.initialiseVariables = [];
|
|
2289
|
+
this.config = { indent: false };
|
|
2290
|
+
Object.assign(this.config, config);
|
|
2291
|
+
this.context.set("_context", this.variableContext);
|
|
2292
|
+
}
|
|
2293
|
+
reserveName(name) {
|
|
2294
|
+
for (let i = 0; i < this.maxReservedVariable; i++) {
|
|
2295
|
+
const candidate = name + "_" + i;
|
|
2296
|
+
if (!this.reservedNames.has(candidate)) {
|
|
2297
|
+
this.reservedNames.add(candidate);
|
|
2298
|
+
return candidate;
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
throw new Error(`Too many context variables (max ${this.maxReservedVariable})`);
|
|
2302
|
+
}
|
|
2303
|
+
set(values) {
|
|
2304
|
+
for (const i in values) {
|
|
2305
|
+
if (!hasProperty(values, i)) continue;
|
|
2306
|
+
this.context.set(i, values[i]);
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* Returns always the same variable name for the same value.
|
|
2311
|
+
* The variable name should not be set afterwards.
|
|
2312
|
+
*/
|
|
2313
|
+
reserveConst(value, name = "constVar") {
|
|
2314
|
+
if (value === void 0) throw new Error("Can not reserve const for undefined value");
|
|
2315
|
+
let constName = this.constVariables.get(value);
|
|
2316
|
+
if (!constName) {
|
|
2317
|
+
constName = this.reserveName(name);
|
|
2318
|
+
this.constVariables.set(value, constName);
|
|
2319
|
+
this.context.set(constName, value);
|
|
2320
|
+
}
|
|
2321
|
+
return constName;
|
|
2322
|
+
}
|
|
2323
|
+
reserveVariable(name = "var", value) {
|
|
2324
|
+
const freeName = this.reserveName(name);
|
|
2325
|
+
if (value === void 0) return "_context." + freeName;
|
|
2326
|
+
else {
|
|
2327
|
+
this.context.set(freeName, value);
|
|
2328
|
+
return freeName;
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
raw(functionCode) {
|
|
2332
|
+
try {
|
|
2333
|
+
return new Function(...this.context.keys(), `'use strict';\n` + functionCode)(...this.context.values());
|
|
2334
|
+
} catch (error) {
|
|
2335
|
+
throw new Error("Could not build function: " + error + functionCode);
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
format(code) {
|
|
2339
|
+
if (indentCode || this.config.indent) return indent$1.js(code, { tabString: " " });
|
|
2340
|
+
return code;
|
|
2341
|
+
}
|
|
2342
|
+
build(functionCode, ...args) {
|
|
2343
|
+
functionCode = this.format(`
|
|
2344
|
+
'use strict';
|
|
2345
|
+
${this.preCode}
|
|
2346
|
+
return function self(${args.join(", ")}){
|
|
2347
|
+
'use strict';
|
|
2348
|
+
${functionCode}
|
|
2349
|
+
};
|
|
2350
|
+
`);
|
|
2351
|
+
try {
|
|
2352
|
+
return new Function(...this.context.keys(), functionCode)(...this.context.values());
|
|
2353
|
+
} catch (error) {
|
|
2354
|
+
throw new Error(`Could not build function(${[...this.context.keys()].join(",")}): ` + error + functionCode);
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
buildAsync(functionCode, ...args) {
|
|
2358
|
+
functionCode = `
|
|
2359
|
+
'use strict';
|
|
2360
|
+
${this.preCode}
|
|
2361
|
+
return async function self(${args.join(", ")}){
|
|
2362
|
+
'use strict';
|
|
2363
|
+
${functionCode}
|
|
2364
|
+
};
|
|
2365
|
+
`;
|
|
2366
|
+
try {
|
|
2367
|
+
return new Function(...this.context.keys(), this.format(functionCode))(...this.context.values());
|
|
2368
|
+
} catch (error) {
|
|
2369
|
+
throw new Error("Could not build function: " + error + functionCode);
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
};
|
|
2373
|
+
CompilerContext.__type = [
|
|
2374
|
+
"context",
|
|
2375
|
+
function() {
|
|
2376
|
+
return Map.Ω = [["&"], ["\""]], /* @__PURE__ */ new Map();
|
|
2377
|
+
},
|
|
2378
|
+
"constVariables",
|
|
2379
|
+
function() {
|
|
2380
|
+
return Map.Ω = [["\""], ["&"]], /* @__PURE__ */ new Map();
|
|
2381
|
+
},
|
|
2382
|
+
"maxReservedVariable",
|
|
2383
|
+
function() {
|
|
2384
|
+
return 1e4;
|
|
2385
|
+
},
|
|
2386
|
+
"reservedNames",
|
|
2387
|
+
function() {
|
|
2388
|
+
return Set.Ω = [["&"]], /* @__PURE__ */ new Set();
|
|
2389
|
+
},
|
|
2390
|
+
"variableContext",
|
|
2391
|
+
function() {
|
|
2392
|
+
return {};
|
|
2393
|
+
},
|
|
2394
|
+
"preCode",
|
|
2395
|
+
function() {
|
|
2396
|
+
return "";
|
|
2397
|
+
},
|
|
2398
|
+
"initialiseVariables",
|
|
2399
|
+
function() {
|
|
2400
|
+
return [];
|
|
2401
|
+
},
|
|
2402
|
+
"indent",
|
|
2403
|
+
"config",
|
|
2404
|
+
function() {
|
|
2405
|
+
return { indent: false };
|
|
2406
|
+
},
|
|
2407
|
+
() => __ΩPartial,
|
|
2408
|
+
() => CompilerContext,
|
|
2409
|
+
"config",
|
|
2410
|
+
() => ({}),
|
|
2411
|
+
"constructor",
|
|
2412
|
+
"name",
|
|
2413
|
+
"reserveName",
|
|
2414
|
+
"values",
|
|
2415
|
+
"set",
|
|
2416
|
+
"value",
|
|
2417
|
+
() => "constVar",
|
|
2418
|
+
"reserveConst",
|
|
2419
|
+
() => "var",
|
|
2420
|
+
"reserveVariable",
|
|
2421
|
+
"functionCode",
|
|
2422
|
+
() => Function,
|
|
2423
|
+
"raw",
|
|
2424
|
+
"code",
|
|
2425
|
+
"format",
|
|
2426
|
+
"args",
|
|
2427
|
+
"build",
|
|
2428
|
+
() => Function,
|
|
2429
|
+
"buildAsync",
|
|
2430
|
+
"CompilerContext",
|
|
2431
|
+
"!3!9>\"!3#<>$'3%>&!3'<>(P&\"LM3)<>*&3+>,&F3->.P)4/M30>1PP73.4fo2\"20>5\"06P&27&08PP&\"LM29\"0:P\"2;&27><&0=P&27>>\"2;8&0?P&2@PuA0BP&2C&0D<P&2@&@2E\"0FP&2@&@2EPuG0H5wI"
|
|
2432
|
+
];
|
|
2433
|
+
|
|
2434
|
+
//#endregion
|
|
2435
|
+
//#region ../../node_modules/.pnpm/@deepkit+core@1.0.5_patch_hash=8c3beca4372c6a8941162780ddd0f977ef3d461c2018f0809f86f416260ba440/node_modules/@deepkit/core/dist/esm/src/string.js
|
|
2436
|
+
function __assignType(fn, args) {
|
|
2437
|
+
fn.__type = args;
|
|
2438
|
+
return fn;
|
|
2439
|
+
}
|
|
2440
|
+
function indent(indentation, prefix = "") {
|
|
2441
|
+
return __assignType((str = "") => {
|
|
2442
|
+
return " ".repeat(indentation) + str.replace(/\n/g, "\n" + " ".repeat(indentation) + prefix);
|
|
2443
|
+
}, [
|
|
2444
|
+
"str",
|
|
2445
|
+
() => "",
|
|
2446
|
+
"",
|
|
2447
|
+
"P&2!>\"\"/#"
|
|
2448
|
+
]);
|
|
2449
|
+
}
|
|
2450
|
+
indent.__type = [
|
|
2451
|
+
"indentation",
|
|
2452
|
+
"prefix",
|
|
2453
|
+
() => "",
|
|
2454
|
+
"indent",
|
|
2455
|
+
"P'2!&2\">#\"/$"
|
|
2456
|
+
];
|
|
2457
|
+
function capitalize(string) {
|
|
2458
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
2459
|
+
}
|
|
2460
|
+
capitalize.__type = [
|
|
2461
|
+
"string",
|
|
2462
|
+
"capitalize",
|
|
2463
|
+
"P&2!&/\""
|
|
2464
|
+
];
|
|
2465
|
+
|
|
2466
|
+
//#endregion
|
|
2467
|
+
export { isFunction as $, first as A, eachKey as At, getObjectKeysSize as B, copy as C, setPathValue as Ct, empty as D, time as Dt, deletePathValue as E, stringifyValueWithType as Et, getClassName as F, identifyType as G, getPathValue as H, getClassPropertyName as I, isArray as J, inDebugMode as K, getClassTypeFromInstance as L, fixAsyncOperation as M, formatError as N, ensureError as O, zip as Ot, forwardTypeArguments as P, isConstructable as Q, getCurrentFileName as R, collectForMicrotask as S, rangeArray as St, createStack as T, sleep as Tt, hasProperty as U, getParentClass as V, humanBytes as W, isClass as X, isAsyncFunction as Y, isClassInstance as Z, assertDefined as _, mergePromiseStack as _t, arrayHasItem as a, isNumeric as at, average as b, prettyPrintObject as bt, toFastProperties as c, isPlainObject as ct, __ΩAbstractClassType as d, isSet as dt, isGlobalClass as et, __ΩClassType as f, isString as ft, applyDefaults as g, lastKey as gt, appendObject as h, last as ht, arrayClear as i, isNumber as it, firstKey as j, eachPair as jt, escapeRegExp as k, each as kt, AsyncFunction as l, isPromise as lt, __ΩExtractClassType as m, iterableSize as mt, indent as n, isIterable as nt, arrayMoveItem as o, isObject as ot, __ΩCustomError as p, isUndefined as pt, indexOf as q, CompilerContext as r, isNull as rt, arrayRemoveItem as s, isObjectLiteral as st, capitalize as t, isInteger as tt, CustomError as u, isPrototypeOfBase as ut, assertInstanceOf as v, mergeStack as vt, createDynamicClass as w, size as wt, changeClass as x, range as xt, asyncOperation as y, prependObjectKeys as yt, getInheritanceChain as z };
|