@markw65/monkeyc-optimizer 1.1.18 → 1.1.19

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.
@@ -1,4858 +0,0 @@
1
- "use strict";
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 __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_TM6GLTGC_exports = {};
30
- __export(chunk_TM6GLTGC_exports, {
31
- buildOptimizedProject: () => buildOptimizedProject,
32
- defaultConfig: () => defaultConfig,
33
- generateApiMirTests: () => generateApiMirTests,
34
- generateOneConfig: () => generateOneConfig,
35
- generateOptimizedProject: () => generateOptimizedProject,
36
- getConfig: () => getConfig,
37
- getProjectAnalysis: () => getProjectAnalysis,
38
- get_jungle: () => get_jungle,
39
- init_optimizer: () => init_optimizer,
40
- init_worker_pool: () => init_worker_pool,
41
- init_worker_task: () => init_worker_task,
42
- isErrorWithLocation: () => isErrorWithLocation,
43
- launchSimulator: () => launchSimulator,
44
- manifestProducts: () => manifestProducts,
45
- mctree: () => import_prettier_plugin_monkeyc.mctree,
46
- performTask: () => performTask,
47
- runTaskInPool: () => runTaskInPool,
48
- simulateProgram: () => simulateProgram,
49
- startPool: () => startPool,
50
- stopPool: () => stopPool
51
- });
52
- module.exports = __toCommonJS(chunk_TM6GLTGC_exports);
53
- var import_chunk_YCLY27QH = require("./chunk-YCLY27QH.cjs");
54
- var import_chunk_IAUHYWVN = require("./chunk-IAUHYWVN.cjs");
55
- var path = __toESM(require("path"));
56
- var fs = __toESM(require("fs/promises"));
57
- var crypto = __toESM(require("crypto"));
58
- var fs2 = __toESM(require("fs/promises"));
59
- var path2 = __toESM(require("path"));
60
- var net = __toESM(require("net"));
61
- var path3 = __toESM(require("path"));
62
- var import_child_process = require("child_process");
63
- var import_prettier_plugin_monkeyc = require("@markw65/prettier-plugin-monkeyc");
64
- var crypto2 = __toESM(require("crypto"));
65
- var fs3 = __toESM(require("fs/promises"));
66
- var path4 = __toESM(require("path"));
67
- var Prettier = __toESM(require("prettier"));
68
- var import_node_async_hooks = require("node:async_hooks");
69
- var import_node_events = require("node:events");
70
- var import_node_worker_threads = require("node:worker_threads");
71
- var os = __toESM(require("node:os"));
72
- async function build_project(product, options, lineCallback) {
73
- const {
74
- workspace,
75
- program,
76
- jungleFiles,
77
- developerKeyPath,
78
- simulatorBuild,
79
- releaseBuild,
80
- testBuild,
81
- compilerOptions,
82
- compilerWarnings,
83
- typeCheckLevel,
84
- returnCommand
85
- } = options;
86
- const sdk = await (0, import_chunk_YCLY27QH.getSdkPath)();
87
- const extraArgs = [];
88
- if (compilerOptions) {
89
- extraArgs.push(...compilerOptions.split(/\s+/));
90
- }
91
- if (compilerWarnings) {
92
- extraArgs.push("-w");
93
- }
94
- if (testBuild) {
95
- extraArgs.push("-t");
96
- } else if (releaseBuild) {
97
- extraArgs.push("-r");
98
- }
99
- if (!product) {
100
- extraArgs.push("-e");
101
- }
102
- switch (typeCheckLevel?.toLowerCase()) {
103
- case "off":
104
- extraArgs.push("-l", "0");
105
- break;
106
- case "gradual":
107
- extraArgs.push("-l", "1");
108
- break;
109
- case "informative":
110
- extraArgs.push("-l", "2");
111
- break;
112
- case "strict":
113
- extraArgs.push("-l", "3");
114
- break;
115
- }
116
- if (product) {
117
- extraArgs.push(
118
- "-d",
119
- testBuild || simulatorBuild !== false ? `${product}_sim` : product
120
- );
121
- } else if (testBuild) {
122
- throw new Error("Building for tests requires a device to build for!");
123
- }
124
- if (!program || !jungleFiles || !developerKeyPath || !workspace) {
125
- throw new Error("Required arguments were missing!");
126
- }
127
- const exe = "java";
128
- const args = [
129
- ["-Xms1g", "-Dfile.encoding=UTF-8", "-Dapple.awt.UIElement=true"],
130
- ["-cp", path.resolve(sdk, "bin", "monkeybrains.jar")],
131
- ["com.garmin.monkeybrains.Monkeybrains"],
132
- ["-o", program],
133
- ["-f", jungleFiles],
134
- ["-y", developerKeyPath],
135
- extraArgs
136
- ].flat();
137
- if (!returnCommand) {
138
- const handlers = [
139
- lineCallback || ((line) => console.log(line)),
140
- (line) => console.error(line)
141
- ];
142
- await (0, import_chunk_IAUHYWVN.spawnByLine)(exe, args, handlers, {
143
- cwd: workspace
144
- });
145
- }
146
- return { exe, args, program: path.resolve(workspace, program), product };
147
- }
148
- var init_build = (0, import_chunk_IAUHYWVN.__esm)({
149
- "src/build.ts"() {
150
- "use strict";
151
- (0, import_chunk_YCLY27QH.init_sdk_util)();
152
- (0, import_chunk_IAUHYWVN.init_util)();
153
- }
154
- });
155
- var require_ms = (0, import_chunk_IAUHYWVN.__commonJS)({
156
- "node_modules/ms/index.js"(exports, module2) {
157
- var s = 1e3;
158
- var m = s * 60;
159
- var h = m * 60;
160
- var d = h * 24;
161
- var w = d * 7;
162
- var y = d * 365.25;
163
- module2.exports = function(val, options) {
164
- options = options || {};
165
- var type = typeof val;
166
- if (type === "string" && val.length > 0) {
167
- return parse(val);
168
- } else if (type === "number" && isFinite(val)) {
169
- return options.long ? fmtLong(val) : fmtShort(val);
170
- }
171
- throw new Error(
172
- "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
173
- );
174
- };
175
- function parse(str) {
176
- str = String(str);
177
- if (str.length > 100) {
178
- return;
179
- }
180
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
181
- str
182
- );
183
- if (!match) {
184
- return;
185
- }
186
- var n = parseFloat(match[1]);
187
- var type = (match[2] || "ms").toLowerCase();
188
- switch (type) {
189
- case "years":
190
- case "year":
191
- case "yrs":
192
- case "yr":
193
- case "y":
194
- return n * y;
195
- case "weeks":
196
- case "week":
197
- case "w":
198
- return n * w;
199
- case "days":
200
- case "day":
201
- case "d":
202
- return n * d;
203
- case "hours":
204
- case "hour":
205
- case "hrs":
206
- case "hr":
207
- case "h":
208
- return n * h;
209
- case "minutes":
210
- case "minute":
211
- case "mins":
212
- case "min":
213
- case "m":
214
- return n * m;
215
- case "seconds":
216
- case "second":
217
- case "secs":
218
- case "sec":
219
- case "s":
220
- return n * s;
221
- case "milliseconds":
222
- case "millisecond":
223
- case "msecs":
224
- case "msec":
225
- case "ms":
226
- return n;
227
- default:
228
- return void 0;
229
- }
230
- }
231
- function fmtShort(ms) {
232
- var msAbs = Math.abs(ms);
233
- if (msAbs >= d) {
234
- return Math.round(ms / d) + "d";
235
- }
236
- if (msAbs >= h) {
237
- return Math.round(ms / h) + "h";
238
- }
239
- if (msAbs >= m) {
240
- return Math.round(ms / m) + "m";
241
- }
242
- if (msAbs >= s) {
243
- return Math.round(ms / s) + "s";
244
- }
245
- return ms + "ms";
246
- }
247
- function fmtLong(ms) {
248
- var msAbs = Math.abs(ms);
249
- if (msAbs >= d) {
250
- return plural(ms, msAbs, d, "day");
251
- }
252
- if (msAbs >= h) {
253
- return plural(ms, msAbs, h, "hour");
254
- }
255
- if (msAbs >= m) {
256
- return plural(ms, msAbs, m, "minute");
257
- }
258
- if (msAbs >= s) {
259
- return plural(ms, msAbs, s, "second");
260
- }
261
- return ms + " ms";
262
- }
263
- function plural(ms, msAbs, n, name) {
264
- var isPlural = msAbs >= n * 1.5;
265
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
266
- }
267
- }
268
- });
269
- var require_common = (0, import_chunk_IAUHYWVN.__commonJS)({
270
- "node_modules/debug/src/common.js"(exports, module2) {
271
- function setup(env) {
272
- createDebug.debug = createDebug;
273
- createDebug.default = createDebug;
274
- createDebug.coerce = coerce;
275
- createDebug.disable = disable;
276
- createDebug.enable = enable;
277
- createDebug.enabled = enabled;
278
- createDebug.humanize = require_ms();
279
- createDebug.destroy = destroy;
280
- Object.keys(env).forEach((key) => {
281
- createDebug[key] = env[key];
282
- });
283
- createDebug.names = [];
284
- createDebug.skips = [];
285
- createDebug.formatters = {};
286
- function selectColor(namespace) {
287
- let hash = 0;
288
- for (let i = 0; i < namespace.length; i++) {
289
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
290
- hash |= 0;
291
- }
292
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
293
- }
294
- createDebug.selectColor = selectColor;
295
- function createDebug(namespace) {
296
- let prevTime;
297
- let enableOverride = null;
298
- let namespacesCache;
299
- let enabledCache;
300
- function debug(...args) {
301
- if (!debug.enabled) {
302
- return;
303
- }
304
- const self = debug;
305
- const curr = Number(/* @__PURE__ */ new Date());
306
- const ms = curr - (prevTime || curr);
307
- self.diff = ms;
308
- self.prev = prevTime;
309
- self.curr = curr;
310
- prevTime = curr;
311
- args[0] = createDebug.coerce(args[0]);
312
- if (typeof args[0] !== "string") {
313
- args.unshift("%O");
314
- }
315
- let index = 0;
316
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
317
- if (match === "%%") {
318
- return "%";
319
- }
320
- index++;
321
- const formatter = createDebug.formatters[format];
322
- if (typeof formatter === "function") {
323
- const val = args[index];
324
- match = formatter.call(self, val);
325
- args.splice(index, 1);
326
- index--;
327
- }
328
- return match;
329
- });
330
- createDebug.formatArgs.call(self, args);
331
- const logFn = self.log || createDebug.log;
332
- logFn.apply(self, args);
333
- }
334
- debug.namespace = namespace;
335
- debug.useColors = createDebug.useColors();
336
- debug.color = createDebug.selectColor(namespace);
337
- debug.extend = extend;
338
- debug.destroy = createDebug.destroy;
339
- Object.defineProperty(debug, "enabled", {
340
- enumerable: true,
341
- configurable: false,
342
- get: () => {
343
- if (enableOverride !== null) {
344
- return enableOverride;
345
- }
346
- if (namespacesCache !== createDebug.namespaces) {
347
- namespacesCache = createDebug.namespaces;
348
- enabledCache = createDebug.enabled(namespace);
349
- }
350
- return enabledCache;
351
- },
352
- set: (v) => {
353
- enableOverride = v;
354
- }
355
- });
356
- if (typeof createDebug.init === "function") {
357
- createDebug.init(debug);
358
- }
359
- return debug;
360
- }
361
- function extend(namespace, delimiter) {
362
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
363
- newDebug.log = this.log;
364
- return newDebug;
365
- }
366
- function enable(namespaces) {
367
- createDebug.save(namespaces);
368
- createDebug.namespaces = namespaces;
369
- createDebug.names = [];
370
- createDebug.skips = [];
371
- let i;
372
- const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
373
- const len = split.length;
374
- for (i = 0; i < len; i++) {
375
- if (!split[i]) {
376
- continue;
377
- }
378
- namespaces = split[i].replace(/\*/g, ".*?");
379
- if (namespaces[0] === "-") {
380
- createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
381
- } else {
382
- createDebug.names.push(new RegExp("^" + namespaces + "$"));
383
- }
384
- }
385
- }
386
- function disable() {
387
- const namespaces = [
388
- ...createDebug.names.map(toNamespace),
389
- ...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace)
390
- ].join(",");
391
- createDebug.enable("");
392
- return namespaces;
393
- }
394
- function enabled(name) {
395
- if (name[name.length - 1] === "*") {
396
- return true;
397
- }
398
- let i;
399
- let len;
400
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
401
- if (createDebug.skips[i].test(name)) {
402
- return false;
403
- }
404
- }
405
- for (i = 0, len = createDebug.names.length; i < len; i++) {
406
- if (createDebug.names[i].test(name)) {
407
- return true;
408
- }
409
- }
410
- return false;
411
- }
412
- function toNamespace(regexp) {
413
- return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
414
- }
415
- function coerce(val) {
416
- if (val instanceof Error) {
417
- return val.stack || val.message;
418
- }
419
- return val;
420
- }
421
- function destroy() {
422
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
423
- }
424
- createDebug.enable(createDebug.load());
425
- return createDebug;
426
- }
427
- module2.exports = setup;
428
- }
429
- });
430
- var require_browser = (0, import_chunk_IAUHYWVN.__commonJS)({
431
- "node_modules/debug/src/browser.js"(exports, module2) {
432
- exports.formatArgs = formatArgs;
433
- exports.save = save;
434
- exports.load = load;
435
- exports.useColors = useColors;
436
- exports.storage = localstorage();
437
- exports.destroy = (() => {
438
- let warned = false;
439
- return () => {
440
- if (!warned) {
441
- warned = true;
442
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
443
- }
444
- };
445
- })();
446
- exports.colors = [
447
- "#0000CC",
448
- "#0000FF",
449
- "#0033CC",
450
- "#0033FF",
451
- "#0066CC",
452
- "#0066FF",
453
- "#0099CC",
454
- "#0099FF",
455
- "#00CC00",
456
- "#00CC33",
457
- "#00CC66",
458
- "#00CC99",
459
- "#00CCCC",
460
- "#00CCFF",
461
- "#3300CC",
462
- "#3300FF",
463
- "#3333CC",
464
- "#3333FF",
465
- "#3366CC",
466
- "#3366FF",
467
- "#3399CC",
468
- "#3399FF",
469
- "#33CC00",
470
- "#33CC33",
471
- "#33CC66",
472
- "#33CC99",
473
- "#33CCCC",
474
- "#33CCFF",
475
- "#6600CC",
476
- "#6600FF",
477
- "#6633CC",
478
- "#6633FF",
479
- "#66CC00",
480
- "#66CC33",
481
- "#9900CC",
482
- "#9900FF",
483
- "#9933CC",
484
- "#9933FF",
485
- "#99CC00",
486
- "#99CC33",
487
- "#CC0000",
488
- "#CC0033",
489
- "#CC0066",
490
- "#CC0099",
491
- "#CC00CC",
492
- "#CC00FF",
493
- "#CC3300",
494
- "#CC3333",
495
- "#CC3366",
496
- "#CC3399",
497
- "#CC33CC",
498
- "#CC33FF",
499
- "#CC6600",
500
- "#CC6633",
501
- "#CC9900",
502
- "#CC9933",
503
- "#CCCC00",
504
- "#CCCC33",
505
- "#FF0000",
506
- "#FF0033",
507
- "#FF0066",
508
- "#FF0099",
509
- "#FF00CC",
510
- "#FF00FF",
511
- "#FF3300",
512
- "#FF3333",
513
- "#FF3366",
514
- "#FF3399",
515
- "#FF33CC",
516
- "#FF33FF",
517
- "#FF6600",
518
- "#FF6633",
519
- "#FF9900",
520
- "#FF9933",
521
- "#FFCC00",
522
- "#FFCC33"
523
- ];
524
- function useColors() {
525
- if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
526
- return true;
527
- }
528
- if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
529
- return false;
530
- }
531
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
532
- typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
533
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
534
- typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
535
- typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
536
- }
537
- function formatArgs(args) {
538
- args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff);
539
- if (!this.useColors) {
540
- return;
541
- }
542
- const c = "color: " + this.color;
543
- args.splice(1, 0, c, "color: inherit");
544
- let index = 0;
545
- let lastC = 0;
546
- args[0].replace(/%[a-zA-Z%]/g, (match) => {
547
- if (match === "%%") {
548
- return;
549
- }
550
- index++;
551
- if (match === "%c") {
552
- lastC = index;
553
- }
554
- });
555
- args.splice(lastC, 0, c);
556
- }
557
- exports.log = console.debug || console.log || (() => {
558
- });
559
- function save(namespaces) {
560
- try {
561
- if (namespaces) {
562
- exports.storage.setItem("debug", namespaces);
563
- } else {
564
- exports.storage.removeItem("debug");
565
- }
566
- } catch (error) {
567
- }
568
- }
569
- function load() {
570
- let r;
571
- try {
572
- r = exports.storage.getItem("debug");
573
- } catch (error) {
574
- }
575
- if (!r && typeof process !== "undefined" && "env" in process) {
576
- r = process.env.DEBUG;
577
- }
578
- return r;
579
- }
580
- function localstorage() {
581
- try {
582
- return localStorage;
583
- } catch (error) {
584
- }
585
- }
586
- module2.exports = require_common()(exports);
587
- var { formatters } = module2.exports;
588
- formatters.j = function(v) {
589
- try {
590
- return JSON.stringify(v);
591
- } catch (error) {
592
- return "[UnexpectedJSONParseError]: " + error.message;
593
- }
594
- };
595
- }
596
- });
597
- var require_has_flag = (0, import_chunk_IAUHYWVN.__commonJS)({
598
- "node_modules/has-flag/index.js"(exports, module2) {
599
- "use strict";
600
- module2.exports = (flag, argv = process.argv) => {
601
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
602
- const position = argv.indexOf(prefix + flag);
603
- const terminatorPosition = argv.indexOf("--");
604
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
605
- };
606
- }
607
- });
608
- var require_supports_color = (0, import_chunk_IAUHYWVN.__commonJS)({
609
- "node_modules/supports-color/index.js"(exports, module2) {
610
- "use strict";
611
- var os2 = (0, import_chunk_IAUHYWVN.__require)("os");
612
- var tty = (0, import_chunk_IAUHYWVN.__require)("tty");
613
- var hasFlag = require_has_flag();
614
- var { env } = process;
615
- var forceColor;
616
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
617
- forceColor = 0;
618
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
619
- forceColor = 1;
620
- }
621
- if ("FORCE_COLOR" in env) {
622
- if (env.FORCE_COLOR === "true") {
623
- forceColor = 1;
624
- } else if (env.FORCE_COLOR === "false") {
625
- forceColor = 0;
626
- } else {
627
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
628
- }
629
- }
630
- function translateLevel(level) {
631
- if (level === 0) {
632
- return false;
633
- }
634
- return {
635
- level,
636
- hasBasic: true,
637
- has256: level >= 2,
638
- has16m: level >= 3
639
- };
640
- }
641
- function supportsColor(haveStream, streamIsTTY) {
642
- if (forceColor === 0) {
643
- return 0;
644
- }
645
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
646
- return 3;
647
- }
648
- if (hasFlag("color=256")) {
649
- return 2;
650
- }
651
- if (haveStream && !streamIsTTY && forceColor === void 0) {
652
- return 0;
653
- }
654
- const min = forceColor || 0;
655
- if (env.TERM === "dumb") {
656
- return min;
657
- }
658
- if (process.platform === "win32") {
659
- const osRelease = os2.release().split(".");
660
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
661
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
662
- }
663
- return 1;
664
- }
665
- if ("CI" in env) {
666
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
667
- return 1;
668
- }
669
- return min;
670
- }
671
- if ("TEAMCITY_VERSION" in env) {
672
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
673
- }
674
- if (env.COLORTERM === "truecolor") {
675
- return 3;
676
- }
677
- if ("TERM_PROGRAM" in env) {
678
- const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
679
- switch (env.TERM_PROGRAM) {
680
- case "iTerm.app":
681
- return version >= 3 ? 3 : 2;
682
- case "Apple_Terminal":
683
- return 2;
684
- }
685
- }
686
- if (/-256(color)?$/i.test(env.TERM)) {
687
- return 2;
688
- }
689
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
690
- return 1;
691
- }
692
- if ("COLORTERM" in env) {
693
- return 1;
694
- }
695
- return min;
696
- }
697
- function getSupportLevel(stream) {
698
- const level = supportsColor(stream, stream && stream.isTTY);
699
- return translateLevel(level);
700
- }
701
- module2.exports = {
702
- supportsColor: getSupportLevel,
703
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
704
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
705
- };
706
- }
707
- });
708
- var require_node = (0, import_chunk_IAUHYWVN.__commonJS)({
709
- "node_modules/debug/src/node.js"(exports, module2) {
710
- var tty = (0, import_chunk_IAUHYWVN.__require)("tty");
711
- var util = (0, import_chunk_IAUHYWVN.__require)("util");
712
- exports.init = init;
713
- exports.log = log;
714
- exports.formatArgs = formatArgs;
715
- exports.save = save;
716
- exports.load = load;
717
- exports.useColors = useColors;
718
- exports.destroy = util.deprecate(
719
- () => {
720
- },
721
- "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
722
- );
723
- exports.colors = [6, 2, 3, 4, 5, 1];
724
- try {
725
- const supportsColor = require_supports_color();
726
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
727
- exports.colors = [
728
- 20,
729
- 21,
730
- 26,
731
- 27,
732
- 32,
733
- 33,
734
- 38,
735
- 39,
736
- 40,
737
- 41,
738
- 42,
739
- 43,
740
- 44,
741
- 45,
742
- 56,
743
- 57,
744
- 62,
745
- 63,
746
- 68,
747
- 69,
748
- 74,
749
- 75,
750
- 76,
751
- 77,
752
- 78,
753
- 79,
754
- 80,
755
- 81,
756
- 92,
757
- 93,
758
- 98,
759
- 99,
760
- 112,
761
- 113,
762
- 128,
763
- 129,
764
- 134,
765
- 135,
766
- 148,
767
- 149,
768
- 160,
769
- 161,
770
- 162,
771
- 163,
772
- 164,
773
- 165,
774
- 166,
775
- 167,
776
- 168,
777
- 169,
778
- 170,
779
- 171,
780
- 172,
781
- 173,
782
- 178,
783
- 179,
784
- 184,
785
- 185,
786
- 196,
787
- 197,
788
- 198,
789
- 199,
790
- 200,
791
- 201,
792
- 202,
793
- 203,
794
- 204,
795
- 205,
796
- 206,
797
- 207,
798
- 208,
799
- 209,
800
- 214,
801
- 215,
802
- 220,
803
- 221
804
- ];
805
- }
806
- } catch (error) {
807
- }
808
- exports.inspectOpts = Object.keys(process.env).filter((key) => {
809
- return /^debug_/i.test(key);
810
- }).reduce((obj, key) => {
811
- const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
812
- return k.toUpperCase();
813
- });
814
- let val = process.env[key];
815
- if (/^(yes|on|true|enabled)$/i.test(val)) {
816
- val = true;
817
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
818
- val = false;
819
- } else if (val === "null") {
820
- val = null;
821
- } else {
822
- val = Number(val);
823
- }
824
- obj[prop] = val;
825
- return obj;
826
- }, {});
827
- function useColors() {
828
- return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
829
- }
830
- function formatArgs(args) {
831
- const { namespace: name, useColors: useColors2 } = this;
832
- if (useColors2) {
833
- const c = this.color;
834
- const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
835
- const prefix = ` ${colorCode};1m${name} \x1B[0m`;
836
- args[0] = prefix + args[0].split("\n").join("\n" + prefix);
837
- args.push(colorCode + "m+" + module2.exports.humanize(this.diff) + "\x1B[0m");
838
- } else {
839
- args[0] = getDate() + name + " " + args[0];
840
- }
841
- }
842
- function getDate() {
843
- if (exports.inspectOpts.hideDate) {
844
- return "";
845
- }
846
- return (/* @__PURE__ */ new Date()).toISOString() + " ";
847
- }
848
- function log(...args) {
849
- return process.stderr.write(util.format(...args) + "\n");
850
- }
851
- function save(namespaces) {
852
- if (namespaces) {
853
- process.env.DEBUG = namespaces;
854
- } else {
855
- delete process.env.DEBUG;
856
- }
857
- }
858
- function load() {
859
- return process.env.DEBUG;
860
- }
861
- function init(debug) {
862
- debug.inspectOpts = {};
863
- const keys = Object.keys(exports.inspectOpts);
864
- for (let i = 0; i < keys.length; i++) {
865
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
866
- }
867
- }
868
- module2.exports = require_common()(exports);
869
- var { formatters } = module2.exports;
870
- formatters.o = function(v) {
871
- this.inspectOpts.colors = this.useColors;
872
- return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
873
- };
874
- formatters.O = function(v) {
875
- this.inspectOpts.colors = this.useColors;
876
- return util.inspect(v, this.inspectOpts);
877
- };
878
- }
879
- });
880
- var require_src = (0, import_chunk_IAUHYWVN.__commonJS)({
881
- "node_modules/debug/src/index.js"(exports, module2) {
882
- if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
883
- module2.exports = require_browser();
884
- } else {
885
- module2.exports = require_node();
886
- }
887
- }
888
- });
889
- var require_wrappy = (0, import_chunk_IAUHYWVN.__commonJS)({
890
- "node_modules/wrappy/wrappy.js"(exports, module2) {
891
- module2.exports = wrappy;
892
- function wrappy(fn, cb) {
893
- if (fn && cb)
894
- return wrappy(fn)(cb);
895
- if (typeof fn !== "function")
896
- throw new TypeError("need wrapper function");
897
- Object.keys(fn).forEach(function(k) {
898
- wrapper[k] = fn[k];
899
- });
900
- return wrapper;
901
- function wrapper() {
902
- var args = new Array(arguments.length);
903
- for (var i = 0; i < args.length; i++) {
904
- args[i] = arguments[i];
905
- }
906
- var ret = fn.apply(this, args);
907
- var cb2 = args[args.length - 1];
908
- if (typeof ret === "function" && ret !== cb2) {
909
- Object.keys(cb2).forEach(function(k) {
910
- ret[k] = cb2[k];
911
- });
912
- }
913
- return ret;
914
- }
915
- }
916
- }
917
- });
918
- var require_once = (0, import_chunk_IAUHYWVN.__commonJS)({
919
- "node_modules/once/once.js"(exports, module2) {
920
- var wrappy = require_wrappy();
921
- module2.exports = wrappy(once);
922
- module2.exports.strict = wrappy(onceStrict);
923
- once.proto = once(function() {
924
- Object.defineProperty(Function.prototype, "once", {
925
- value: function() {
926
- return once(this);
927
- },
928
- configurable: true
929
- });
930
- Object.defineProperty(Function.prototype, "onceStrict", {
931
- value: function() {
932
- return onceStrict(this);
933
- },
934
- configurable: true
935
- });
936
- });
937
- function once(fn) {
938
- var f = function() {
939
- if (f.called)
940
- return f.value;
941
- f.called = true;
942
- return f.value = fn.apply(this, arguments);
943
- };
944
- f.called = false;
945
- return f;
946
- }
947
- function onceStrict(fn) {
948
- var f = function() {
949
- if (f.called)
950
- throw new Error(f.onceError);
951
- f.called = true;
952
- return f.value = fn.apply(this, arguments);
953
- };
954
- var name = fn.name || "Function wrapped with `once`";
955
- f.onceError = name + " shouldn't be called more than once";
956
- f.called = false;
957
- return f;
958
- }
959
- }
960
- });
961
- var require_end_of_stream = (0, import_chunk_IAUHYWVN.__commonJS)({
962
- "node_modules/end-of-stream/index.js"(exports, module2) {
963
- var once = require_once();
964
- var noop = function() {
965
- };
966
- var isRequest = function(stream) {
967
- return stream.setHeader && typeof stream.abort === "function";
968
- };
969
- var isChildProcess = function(stream) {
970
- return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3;
971
- };
972
- var eos = function(stream, opts, callback) {
973
- if (typeof opts === "function")
974
- return eos(stream, null, opts);
975
- if (!opts)
976
- opts = {};
977
- callback = once(callback || noop);
978
- var ws = stream._writableState;
979
- var rs = stream._readableState;
980
- var readable = opts.readable || opts.readable !== false && stream.readable;
981
- var writable = opts.writable || opts.writable !== false && stream.writable;
982
- var cancelled = false;
983
- var onlegacyfinish = function() {
984
- if (!stream.writable)
985
- onfinish();
986
- };
987
- var onfinish = function() {
988
- writable = false;
989
- if (!readable)
990
- callback.call(stream);
991
- };
992
- var onend = function() {
993
- readable = false;
994
- if (!writable)
995
- callback.call(stream);
996
- };
997
- var onexit = function(exitCode) {
998
- callback.call(stream, exitCode ? new Error("exited with error code: " + exitCode) : null);
999
- };
1000
- var onerror = function(err) {
1001
- callback.call(stream, err);
1002
- };
1003
- var onclose = function() {
1004
- process.nextTick(onclosenexttick);
1005
- };
1006
- var onclosenexttick = function() {
1007
- if (cancelled)
1008
- return;
1009
- if (readable && !(rs && (rs.ended && !rs.destroyed)))
1010
- return callback.call(stream, new Error("premature close"));
1011
- if (writable && !(ws && (ws.ended && !ws.destroyed)))
1012
- return callback.call(stream, new Error("premature close"));
1013
- };
1014
- var onrequest = function() {
1015
- stream.req.on("finish", onfinish);
1016
- };
1017
- if (isRequest(stream)) {
1018
- stream.on("complete", onfinish);
1019
- stream.on("abort", onclose);
1020
- if (stream.req)
1021
- onrequest();
1022
- else
1023
- stream.on("request", onrequest);
1024
- } else if (writable && !ws) {
1025
- stream.on("end", onlegacyfinish);
1026
- stream.on("close", onlegacyfinish);
1027
- }
1028
- if (isChildProcess(stream))
1029
- stream.on("exit", onexit);
1030
- stream.on("end", onend);
1031
- stream.on("finish", onfinish);
1032
- if (opts.error !== false)
1033
- stream.on("error", onerror);
1034
- stream.on("close", onclose);
1035
- return function() {
1036
- cancelled = true;
1037
- stream.removeListener("complete", onfinish);
1038
- stream.removeListener("abort", onclose);
1039
- stream.removeListener("request", onrequest);
1040
- if (stream.req)
1041
- stream.req.removeListener("finish", onfinish);
1042
- stream.removeListener("end", onlegacyfinish);
1043
- stream.removeListener("close", onlegacyfinish);
1044
- stream.removeListener("finish", onfinish);
1045
- stream.removeListener("exit", onexit);
1046
- stream.removeListener("end", onend);
1047
- stream.removeListener("error", onerror);
1048
- stream.removeListener("close", onclose);
1049
- };
1050
- };
1051
- module2.exports = eos;
1052
- }
1053
- });
1054
- var require_pump = (0, import_chunk_IAUHYWVN.__commonJS)({
1055
- "node_modules/pump/index.js"(exports, module2) {
1056
- var once = require_once();
1057
- var eos = require_end_of_stream();
1058
- var fs4 = (0, import_chunk_IAUHYWVN.__require)("fs");
1059
- var noop = function() {
1060
- };
1061
- var ancient = /^v?\.0/.test(process.version);
1062
- var isFn = function(fn) {
1063
- return typeof fn === "function";
1064
- };
1065
- var isFS = function(stream) {
1066
- if (!ancient)
1067
- return false;
1068
- if (!fs4)
1069
- return false;
1070
- return (stream instanceof (fs4.ReadStream || noop) || stream instanceof (fs4.WriteStream || noop)) && isFn(stream.close);
1071
- };
1072
- var isRequest = function(stream) {
1073
- return stream.setHeader && isFn(stream.abort);
1074
- };
1075
- var destroyer = function(stream, reading, writing, callback) {
1076
- callback = once(callback);
1077
- var closed = false;
1078
- stream.on("close", function() {
1079
- closed = true;
1080
- });
1081
- eos(stream, { readable: reading, writable: writing }, function(err) {
1082
- if (err)
1083
- return callback(err);
1084
- closed = true;
1085
- callback();
1086
- });
1087
- var destroyed = false;
1088
- return function(err) {
1089
- if (closed)
1090
- return;
1091
- if (destroyed)
1092
- return;
1093
- destroyed = true;
1094
- if (isFS(stream))
1095
- return stream.close(noop);
1096
- if (isRequest(stream))
1097
- return stream.abort();
1098
- if (isFn(stream.destroy))
1099
- return stream.destroy();
1100
- callback(err || new Error("stream was destroyed"));
1101
- };
1102
- };
1103
- var call = function(fn) {
1104
- fn();
1105
- };
1106
- var pipe = function(from, to) {
1107
- return from.pipe(to);
1108
- };
1109
- var pump = function() {
1110
- var streams = Array.prototype.slice.call(arguments);
1111
- var callback = isFn(streams[streams.length - 1] || noop) && streams.pop() || noop;
1112
- if (Array.isArray(streams[0]))
1113
- streams = streams[0];
1114
- if (streams.length < 2)
1115
- throw new Error("pump requires two streams per minimum");
1116
- var error;
1117
- var destroys = streams.map(function(stream, i) {
1118
- var reading = i < streams.length - 1;
1119
- var writing = i > 0;
1120
- return destroyer(stream, reading, writing, function(err) {
1121
- if (!error)
1122
- error = err;
1123
- if (err)
1124
- destroys.forEach(call);
1125
- if (reading)
1126
- return;
1127
- destroys.forEach(call);
1128
- callback(error);
1129
- });
1130
- });
1131
- return streams.reduce(pipe);
1132
- };
1133
- module2.exports = pump;
1134
- }
1135
- });
1136
- var require_buffer_stream = (0, import_chunk_IAUHYWVN.__commonJS)({
1137
- "node_modules/get-stream/buffer-stream.js"(exports, module2) {
1138
- "use strict";
1139
- var { PassThrough: PassThroughStream } = (0, import_chunk_IAUHYWVN.__require)("stream");
1140
- module2.exports = (options) => {
1141
- options = { ...options };
1142
- const { array } = options;
1143
- let { encoding } = options;
1144
- const isBuffer = encoding === "buffer";
1145
- let objectMode = false;
1146
- if (array) {
1147
- objectMode = !(encoding || isBuffer);
1148
- } else {
1149
- encoding = encoding || "utf8";
1150
- }
1151
- if (isBuffer) {
1152
- encoding = null;
1153
- }
1154
- const stream = new PassThroughStream({ objectMode });
1155
- if (encoding) {
1156
- stream.setEncoding(encoding);
1157
- }
1158
- let length = 0;
1159
- const chunks = [];
1160
- stream.on("data", (chunk) => {
1161
- chunks.push(chunk);
1162
- if (objectMode) {
1163
- length = chunks.length;
1164
- } else {
1165
- length += chunk.length;
1166
- }
1167
- });
1168
- stream.getBufferedValue = () => {
1169
- if (array) {
1170
- return chunks;
1171
- }
1172
- return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
1173
- };
1174
- stream.getBufferedLength = () => length;
1175
- return stream;
1176
- };
1177
- }
1178
- });
1179
- var require_get_stream = (0, import_chunk_IAUHYWVN.__commonJS)({
1180
- "node_modules/get-stream/index.js"(exports, module2) {
1181
- "use strict";
1182
- var { constants: BufferConstants } = (0, import_chunk_IAUHYWVN.__require)("buffer");
1183
- var pump = require_pump();
1184
- var bufferStream = require_buffer_stream();
1185
- var MaxBufferError = class extends Error {
1186
- constructor() {
1187
- super("maxBuffer exceeded");
1188
- this.name = "MaxBufferError";
1189
- }
1190
- };
1191
- async function getStream(inputStream, options) {
1192
- if (!inputStream) {
1193
- return Promise.reject(new Error("Expected a stream"));
1194
- }
1195
- options = {
1196
- maxBuffer: Infinity,
1197
- ...options
1198
- };
1199
- const { maxBuffer } = options;
1200
- let stream;
1201
- await new Promise((resolve5, reject) => {
1202
- const rejectPromise = (error) => {
1203
- if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
1204
- error.bufferedData = stream.getBufferedValue();
1205
- }
1206
- reject(error);
1207
- };
1208
- stream = pump(inputStream, bufferStream(options), (error) => {
1209
- if (error) {
1210
- rejectPromise(error);
1211
- return;
1212
- }
1213
- resolve5();
1214
- });
1215
- stream.on("data", () => {
1216
- if (stream.getBufferedLength() > maxBuffer) {
1217
- rejectPromise(new MaxBufferError());
1218
- }
1219
- });
1220
- });
1221
- return stream.getBufferedValue();
1222
- }
1223
- module2.exports = getStream;
1224
- module2.exports.default = getStream;
1225
- module2.exports.buffer = (stream, options) => getStream(stream, { ...options, encoding: "buffer" });
1226
- module2.exports.array = (stream, options) => getStream(stream, { ...options, array: true });
1227
- module2.exports.MaxBufferError = MaxBufferError;
1228
- }
1229
- });
1230
- var require_extract_zip = (0, import_chunk_IAUHYWVN.__commonJS)({
1231
- "node_modules/extract-zip/index.js"(exports, module2) {
1232
- var debug = require_src()("extract-zip");
1233
- var { createWriteStream, promises: fs4 } = (0, import_chunk_IAUHYWVN.__require)("fs");
1234
- var getStream = require_get_stream();
1235
- var path5 = (0, import_chunk_IAUHYWVN.__require)("path");
1236
- var { promisify } = (0, import_chunk_IAUHYWVN.__require)("util");
1237
- var stream = (0, import_chunk_IAUHYWVN.__require)("stream");
1238
- var yauzl = (0, import_chunk_YCLY27QH.require_yauzl)();
1239
- var openZip = promisify(yauzl.open);
1240
- var pipeline = promisify(stream.pipeline);
1241
- var Extractor = class {
1242
- constructor(zipPath, opts) {
1243
- this.zipPath = zipPath;
1244
- this.opts = opts;
1245
- }
1246
- async extract() {
1247
- debug("opening", this.zipPath, "with opts", this.opts);
1248
- this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
1249
- this.canceled = false;
1250
- return new Promise((resolve5, reject) => {
1251
- this.zipfile.on("error", (err) => {
1252
- this.canceled = true;
1253
- reject(err);
1254
- });
1255
- this.zipfile.readEntry();
1256
- this.zipfile.on("close", () => {
1257
- if (!this.canceled) {
1258
- debug("zip extraction complete");
1259
- resolve5();
1260
- }
1261
- });
1262
- this.zipfile.on("entry", async (entry) => {
1263
- if (this.canceled) {
1264
- debug("skipping entry", entry.fileName, { cancelled: this.canceled });
1265
- return;
1266
- }
1267
- debug("zipfile entry", entry.fileName);
1268
- if (entry.fileName.startsWith("__MACOSX/")) {
1269
- this.zipfile.readEntry();
1270
- return;
1271
- }
1272
- const destDir = path5.dirname(path5.join(this.opts.dir, entry.fileName));
1273
- try {
1274
- await fs4.mkdir(destDir, { recursive: true });
1275
- const canonicalDestDir = await fs4.realpath(destDir);
1276
- const relativeDestDir = path5.relative(this.opts.dir, canonicalDestDir);
1277
- if (relativeDestDir.split(path5.sep).includes("..")) {
1278
- throw new Error(`Out of bound path "${canonicalDestDir}" found while processing file ${entry.fileName}`);
1279
- }
1280
- await this.extractEntry(entry);
1281
- debug("finished processing", entry.fileName);
1282
- this.zipfile.readEntry();
1283
- } catch (err) {
1284
- this.canceled = true;
1285
- this.zipfile.close();
1286
- reject(err);
1287
- }
1288
- });
1289
- });
1290
- }
1291
- async extractEntry(entry) {
1292
- if (this.canceled) {
1293
- debug("skipping entry extraction", entry.fileName, { cancelled: this.canceled });
1294
- return;
1295
- }
1296
- if (this.opts.onEntry) {
1297
- this.opts.onEntry(entry, this.zipfile);
1298
- }
1299
- const dest = path5.join(this.opts.dir, entry.fileName);
1300
- const mode = entry.externalFileAttributes >> 16 & 65535;
1301
- const IFMT = 61440;
1302
- const IFDIR = 16384;
1303
- const IFLNK = 40960;
1304
- const symlink = (mode & IFMT) === IFLNK;
1305
- let isDir = (mode & IFMT) === IFDIR;
1306
- if (!isDir && entry.fileName.endsWith("/")) {
1307
- isDir = true;
1308
- }
1309
- const madeBy = entry.versionMadeBy >> 8;
1310
- if (!isDir)
1311
- isDir = madeBy === 0 && entry.externalFileAttributes === 16;
1312
- debug("extracting entry", { filename: entry.fileName, isDir, isSymlink: symlink });
1313
- const procMode = this.getExtractedMode(mode, isDir) & 511;
1314
- const destDir = isDir ? dest : path5.dirname(dest);
1315
- const mkdirOptions = { recursive: true };
1316
- if (isDir) {
1317
- mkdirOptions.mode = procMode;
1318
- }
1319
- debug("mkdir", { dir: destDir, ...mkdirOptions });
1320
- await fs4.mkdir(destDir, mkdirOptions);
1321
- if (isDir)
1322
- return;
1323
- debug("opening read stream", dest);
1324
- const readStream = await promisify(this.zipfile.openReadStream.bind(this.zipfile))(entry);
1325
- if (symlink) {
1326
- const link = await getStream(readStream);
1327
- debug("creating symlink", link, dest);
1328
- await fs4.symlink(link, dest);
1329
- } else {
1330
- await pipeline(readStream, createWriteStream(dest, { mode: procMode }));
1331
- }
1332
- }
1333
- getExtractedMode(entryMode, isDir) {
1334
- let mode = entryMode;
1335
- if (mode === 0) {
1336
- if (isDir) {
1337
- if (this.opts.defaultDirMode) {
1338
- mode = parseInt(this.opts.defaultDirMode, 10);
1339
- }
1340
- if (!mode) {
1341
- mode = 493;
1342
- }
1343
- } else {
1344
- if (this.opts.defaultFileMode) {
1345
- mode = parseInt(this.opts.defaultFileMode, 10);
1346
- }
1347
- if (!mode) {
1348
- mode = 420;
1349
- }
1350
- }
1351
- }
1352
- return mode;
1353
- }
1354
- };
1355
- module2.exports = async function(zipPath, opts) {
1356
- debug("creating target directory", opts.dir);
1357
- if (!path5.isAbsolute(opts.dir)) {
1358
- throw new Error("Target directory is expected to be absolute");
1359
- }
1360
- await fs4.mkdir(opts.dir, { recursive: true });
1361
- opts.dir = await fs4.realpath(opts.dir);
1362
- return new Extractor(zipPath, opts).extract();
1363
- };
1364
- }
1365
- });
1366
- function peg$subclass(child, parent) {
1367
- function C() {
1368
- this.constructor = child;
1369
- }
1370
- C.prototype = parent.prototype;
1371
- child.prototype = new C();
1372
- }
1373
- function peg$SyntaxError(message, expected, found, location) {
1374
- var self = Error.call(this, message);
1375
- if (Object.setPrototypeOf) {
1376
- Object.setPrototypeOf(self, peg$SyntaxError.prototype);
1377
- }
1378
- self.expected = expected;
1379
- self.found = found;
1380
- self.location = location;
1381
- self.name = "SyntaxError";
1382
- return self;
1383
- }
1384
- function peg$padEnd(str, targetLength, padString) {
1385
- padString = padString || " ";
1386
- if (str.length > targetLength) {
1387
- return str;
1388
- }
1389
- targetLength -= str.length;
1390
- padString += padString.repeat(targetLength);
1391
- return str + padString.slice(0, targetLength);
1392
- }
1393
- function peg$parse(input, options) {
1394
- options = options !== void 0 ? options : {};
1395
- var peg$FAILED = {};
1396
- var peg$source = options.grammarSource;
1397
- var peg$startRuleFunctions = { Jungle: peg$parseJungle };
1398
- var peg$startRuleFunction = peg$parseJungle;
1399
- var peg$c0 = "=";
1400
- var peg$c1 = ".";
1401
- var peg$c2 = ";";
1402
- var peg$c3 = "$(";
1403
- var peg$c4 = ")";
1404
- var peg$c5 = '"';
1405
- var peg$c6 = "[";
1406
- var peg$c7 = "]";
1407
- var peg$c8 = " ";
1408
- var peg$c9 = " ";
1409
- var peg$c10 = "\\";
1410
- var peg$c11 = "_";
1411
- var peg$c12 = "$";
1412
- var peg$c13 = "-";
1413
- var peg$c14 = "\u200C";
1414
- var peg$c15 = "\u200D";
1415
- var peg$c16 = "/";
1416
- var peg$c17 = "*";
1417
- var peg$c18 = "\v";
1418
- var peg$c19 = "\f";
1419
- var peg$c20 = "\xA0";
1420
- var peg$c21 = "\uFEFF";
1421
- var peg$c22 = "\n";
1422
- var peg$c23 = "\r\n";
1423
- var peg$c24 = "\r";
1424
- var peg$c25 = "\u2028";
1425
- var peg$c26 = "\u2029";
1426
- var peg$c27 = "#";
1427
- var peg$r0 = /^[\n\r\u2028\u2029]/;
1428
- var peg$r1 = /^[a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137-\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148-\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C-\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA-\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9-\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC-\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF-\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F-\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0-\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB-\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE-\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0560-\u0588\u10D0-\u10FA\u10FD-\u10FF\u13F8-\u13FD\u1C80-\u1C88\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6-\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FC7\u1FD0-\u1FD3\u1FD6-\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6-\u1FF7\u210A\u210E-\u210F\u2113\u212F\u2134\u2139\u213C-\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65-\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73-\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3-\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7AF\uA7B5\uA7B7\uA7B9\uA7FA\uAB30-\uAB5A\uAB60-\uAB65\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A]/;
1429
- var peg$r2 = /^[\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5-\u06E6\u07F4-\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C-\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D-\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA69C-\uA69D\uA717-\uA71F\uA770\uA788\uA7F8-\uA7F9\uA9CF\uA9E6\uAA70\uAADD\uAAF3-\uAAF4\uAB5C-\uAB5F\uFF70\uFF9E-\uFF9F]/;
1430
- var peg$r3 = /^[\xAA\xBA\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05EF-\u05F2\u0620-\u063F\u0641-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u09FC\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60-\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E45\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u1100-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u2135-\u2138\u2D30-\u2D67\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A-\uA62B\uA66E\uA6A0-\uA6E5\uA78F\uA7F7\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD-\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9E0-\uA9E4\uA9E7-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADC\uAAE0-\uAAEA\uAAF2\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/;
1431
- var peg$r4 = /^[\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC]/;
1432
- var peg$r5 = /^[A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178-\u0179\u017B\u017D\u0181-\u0182\u0184\u0186-\u0187\u0189-\u018B\u018E-\u0191\u0193-\u0194\u0196-\u0198\u019C-\u019D\u019F-\u01A0\u01A2\u01A4\u01A6-\u01A7\u01A9\u01AC\u01AE-\u01AF\u01B1-\u01B3\u01B5\u01B7-\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A-\u023B\u023D-\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E-\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9-\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0-\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1C90-\u1CBA\u1CBD-\u1CBF\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E-\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D-\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uA7B8\uFF21-\uFF3A]/;
1433
- var peg$r6 = /^[\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E-\u094F\u0982-\u0983\u09BE-\u09C0\u09C7-\u09C8\u09CB-\u09CC\u09D7\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB-\u0ACC\u0B02-\u0B03\u0B3E\u0B40\u0B47-\u0B48\u0B4B-\u0B4C\u0B57\u0BBE-\u0BBF\u0BC1-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD7\u0C01-\u0C03\u0C41-\u0C44\u0C82-\u0C83\u0CBE\u0CC0-\u0CC4\u0CC7-\u0CC8\u0CCA-\u0CCB\u0CD5-\u0CD6\u0D02-\u0D03\u0D3E-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D57\u0D82-\u0D83\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DF2-\u0DF3\u0F3E-\u0F3F\u0F7F\u102B-\u102C\u1031\u1038\u103B-\u103C\u1056-\u1057\u1062-\u1064\u1067-\u106D\u1083-\u1084\u1087-\u108C\u108F\u109A-\u109C\u17B6\u17BE-\u17C5\u17C7-\u17C8\u1923-\u1926\u1929-\u192B\u1930-\u1931\u1933-\u1938\u1A19-\u1A1A\u1A55\u1A57\u1A61\u1A63-\u1A64\u1A6D-\u1A72\u1B04\u1B35\u1B3B\u1B3D-\u1B41\u1B43-\u1B44\u1B82\u1BA1\u1BA6-\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2-\u1BF3\u1C24-\u1C2B\u1C34-\u1C35\u1CE1\u1CF2-\u1CF3\u1CF7\u302E-\u302F\uA823-\uA824\uA827\uA880-\uA881\uA8B4-\uA8C3\uA952-\uA953\uA983\uA9B4-\uA9B5\uA9BA-\uA9BB\uA9BD-\uA9C0\uAA2F-\uAA30\uAA33-\uAA34\uAA4D\uAA7B\uAA7D\uAAEB\uAAEE-\uAAEF\uAAF5\uABE3-\uABE4\uABE6-\uABE7\uABE9-\uABEA\uABEC]/;
1434
- var peg$r7 = /^[\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962-\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2-\u09E3\u09FE\u0A01-\u0A02\u0A3C\u0A41-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A70-\u0A71\u0A75\u0A81-\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7-\u0AC8\u0ACD\u0AE2-\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B62-\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C62-\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC-\u0CCD\u0CE2-\u0CE3\u0D00-\u0D01\u0D3B-\u0D3C\u0D41-\u0D44\u0D4D\u0D62-\u0D63\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0F18-\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039-\u103A\u103D-\u103E\u1058-\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u1885-\u1886\u18A9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193B\u1A17-\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80-\u1B81\u1BA2-\u1BA5\u1BA8-\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8-\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099-\u309A\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA825-\uA826\uA8C4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9E5\uAA29-\uAA2E\uAA31-\uAA32\uAA35-\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1\uAAEC-\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/;
1435
- var peg$r8 = /^[0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]/;
1436
- var peg$r9 = /^[\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF]/;
1437
- var peg$r10 = /^[_\u203F-\u2040\u2054\uFE33-\uFE34\uFE4D-\uFE4F\uFF3F]/;
1438
- var peg$r11 = /^[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;
1439
- var peg$e0 = peg$anyExpectation();
1440
- var peg$e1 = peg$literalExpectation("=", false);
1441
- var peg$e2 = peg$literalExpectation(".", false);
1442
- var peg$e3 = peg$literalExpectation(";", false);
1443
- var peg$e4 = peg$literalExpectation("$(", false);
1444
- var peg$e5 = peg$literalExpectation(")", false);
1445
- var peg$e6 = peg$otherExpectation("raw string");
1446
- var peg$e7 = peg$otherExpectation("quoted string");
1447
- var peg$e8 = peg$literalExpectation('"', false);
1448
- var peg$e9 = peg$literalExpectation("[", false);
1449
- var peg$e10 = peg$literalExpectation("]", false);
1450
- var peg$e11 = peg$literalExpectation(" ", false);
1451
- var peg$e12 = peg$literalExpectation(" ", false);
1452
- var peg$e13 = peg$literalExpectation("\\", false);
1453
- var peg$e14 = peg$otherExpectation("identifier");
1454
- var peg$e15 = peg$literalExpectation("_", false);
1455
- var peg$e16 = peg$literalExpectation("$", false);
1456
- var peg$e17 = peg$literalExpectation("-", false);
1457
- var peg$e18 = peg$literalExpectation("\u200C", false);
1458
- var peg$e19 = peg$literalExpectation("\u200D", false);
1459
- var peg$e20 = peg$literalExpectation("/", false);
1460
- var peg$e21 = peg$literalExpectation("*", false);
1461
- var peg$e22 = peg$otherExpectation("whitespace");
1462
- var peg$e23 = peg$literalExpectation("\v", false);
1463
- var peg$e24 = peg$literalExpectation("\f", false);
1464
- var peg$e25 = peg$literalExpectation("\xA0", false);
1465
- var peg$e26 = peg$literalExpectation("\uFEFF", false);
1466
- var peg$e27 = peg$classExpectation(["\n", "\r", "\u2028", "\u2029"], false, false);
1467
- var peg$e28 = peg$otherExpectation("end of line");
1468
- var peg$e29 = peg$literalExpectation("\n", false);
1469
- var peg$e30 = peg$literalExpectation("\r\n", false);
1470
- var peg$e31 = peg$literalExpectation("\r", false);
1471
- var peg$e32 = peg$literalExpectation("\u2028", false);
1472
- var peg$e33 = peg$literalExpectation("\u2029", false);
1473
- var peg$e34 = peg$otherExpectation("comment");
1474
- var peg$e35 = peg$literalExpectation("#", false);
1475
- var peg$e36 = peg$classExpectation([["a", "z"], "\xB5", ["\xDF", "\xF6"], ["\xF8", "\xFF"], "\u0101", "\u0103", "\u0105", "\u0107", "\u0109", "\u010B", "\u010D", "\u010F", "\u0111", "\u0113", "\u0115", "\u0117", "\u0119", "\u011B", "\u011D", "\u011F", "\u0121", "\u0123", "\u0125", "\u0127", "\u0129", "\u012B", "\u012D", "\u012F", "\u0131", "\u0133", "\u0135", ["\u0137", "\u0138"], "\u013A", "\u013C", "\u013E", "\u0140", "\u0142", "\u0144", "\u0146", ["\u0148", "\u0149"], "\u014B", "\u014D", "\u014F", "\u0151", "\u0153", "\u0155", "\u0157", "\u0159", "\u015B", "\u015D", "\u015F", "\u0161", "\u0163", "\u0165", "\u0167", "\u0169", "\u016B", "\u016D", "\u016F", "\u0171", "\u0173", "\u0175", "\u0177", "\u017A", "\u017C", ["\u017E", "\u0180"], "\u0183", "\u0185", "\u0188", ["\u018C", "\u018D"], "\u0192", "\u0195", ["\u0199", "\u019B"], "\u019E", "\u01A1", "\u01A3", "\u01A5", "\u01A8", ["\u01AA", "\u01AB"], "\u01AD", "\u01B0", "\u01B4", "\u01B6", ["\u01B9", "\u01BA"], ["\u01BD", "\u01BF"], "\u01C6", "\u01C9", "\u01CC", "\u01CE", "\u01D0", "\u01D2", "\u01D4", "\u01D6", "\u01D8", "\u01DA", ["\u01DC", "\u01DD"], "\u01DF", "\u01E1", "\u01E3", "\u01E5", "\u01E7", "\u01E9", "\u01EB", "\u01ED", ["\u01EF", "\u01F0"], "\u01F3", "\u01F5", "\u01F9", "\u01FB", "\u01FD", "\u01FF", "\u0201", "\u0203", "\u0205", "\u0207", "\u0209", "\u020B", "\u020D", "\u020F", "\u0211", "\u0213", "\u0215", "\u0217", "\u0219", "\u021B", "\u021D", "\u021F", "\u0221", "\u0223", "\u0225", "\u0227", "\u0229", "\u022B", "\u022D", "\u022F", "\u0231", ["\u0233", "\u0239"], "\u023C", ["\u023F", "\u0240"], "\u0242", "\u0247", "\u0249", "\u024B", "\u024D", ["\u024F", "\u0293"], ["\u0295", "\u02AF"], "\u0371", "\u0373", "\u0377", ["\u037B", "\u037D"], "\u0390", ["\u03AC", "\u03CE"], ["\u03D0", "\u03D1"], ["\u03D5", "\u03D7"], "\u03D9", "\u03DB", "\u03DD", "\u03DF", "\u03E1", "\u03E3", "\u03E5", "\u03E7", "\u03E9", "\u03EB", "\u03ED", ["\u03EF", "\u03F3"], "\u03F5", "\u03F8", ["\u03FB", "\u03FC"], ["\u0430", "\u045F"], "\u0461", "\u0463", "\u0465", "\u0467", "\u0469", "\u046B", "\u046D", "\u046F", "\u0471", "\u0473", "\u0475", "\u0477", "\u0479", "\u047B", "\u047D", "\u047F", "\u0481", "\u048B", "\u048D", "\u048F", "\u0491", "\u0493", "\u0495", "\u0497", "\u0499", "\u049B", "\u049D", "\u049F", "\u04A1", "\u04A3", "\u04A5", "\u04A7", "\u04A9", "\u04AB", "\u04AD", "\u04AF", "\u04B1", "\u04B3", "\u04B5", "\u04B7", "\u04B9", "\u04BB", "\u04BD", "\u04BF", "\u04C2", "\u04C4", "\u04C6", "\u04C8", "\u04CA", "\u04CC", ["\u04CE", "\u04CF"], "\u04D1", "\u04D3", "\u04D5", "\u04D7", "\u04D9", "\u04DB", "\u04DD", "\u04DF", "\u04E1", "\u04E3", "\u04E5", "\u04E7", "\u04E9", "\u04EB", "\u04ED", "\u04EF", "\u04F1", "\u04F3", "\u04F5", "\u04F7", "\u04F9", "\u04FB", "\u04FD", "\u04FF", "\u0501", "\u0503", "\u0505", "\u0507", "\u0509", "\u050B", "\u050D", "\u050F", "\u0511", "\u0513", "\u0515", "\u0517", "\u0519", "\u051B", "\u051D", "\u051F", "\u0521", "\u0523", "\u0525", "\u0527", "\u0529", "\u052B", "\u052D", "\u052F", ["\u0560", "\u0588"], ["\u10D0", "\u10FA"], ["\u10FD", "\u10FF"], ["\u13F8", "\u13FD"], ["\u1C80", "\u1C88"], ["\u1D00", "\u1D2B"], ["\u1D6B", "\u1D77"], ["\u1D79", "\u1D9A"], "\u1E01", "\u1E03", "\u1E05", "\u1E07", "\u1E09", "\u1E0B", "\u1E0D", "\u1E0F", "\u1E11", "\u1E13", "\u1E15", "\u1E17", "\u1E19", "\u1E1B", "\u1E1D", "\u1E1F", "\u1E21", "\u1E23", "\u1E25", "\u1E27", "\u1E29", "\u1E2B", "\u1E2D", "\u1E2F", "\u1E31", "\u1E33", "\u1E35", "\u1E37", "\u1E39", "\u1E3B", "\u1E3D", "\u1E3F", "\u1E41", "\u1E43", "\u1E45", "\u1E47", "\u1E49", "\u1E4B", "\u1E4D", "\u1E4F", "\u1E51", "\u1E53", "\u1E55", "\u1E57", "\u1E59", "\u1E5B", "\u1E5D", "\u1E5F", "\u1E61", "\u1E63", "\u1E65", "\u1E67", "\u1E69", "\u1E6B", "\u1E6D", "\u1E6F", "\u1E71", "\u1E73", "\u1E75", "\u1E77", "\u1E79", "\u1E7B", "\u1E7D", "\u1E7F", "\u1E81", "\u1E83", "\u1E85", "\u1E87", "\u1E89", "\u1E8B", "\u1E8D", "\u1E8F", "\u1E91", "\u1E93", ["\u1E95", "\u1E9D"], "\u1E9F", "\u1EA1", "\u1EA3", "\u1EA5", "\u1EA7", "\u1EA9", "\u1EAB", "\u1EAD", "\u1EAF", "\u1EB1", "\u1EB3", "\u1EB5", "\u1EB7", "\u1EB9", "\u1EBB", "\u1EBD", "\u1EBF", "\u1EC1", "\u1EC3", "\u1EC5", "\u1EC7", "\u1EC9", "\u1ECB", "\u1ECD", "\u1ECF", "\u1ED1", "\u1ED3", "\u1ED5", "\u1ED7", "\u1ED9", "\u1EDB", "\u1EDD", "\u1EDF", "\u1EE1", "\u1EE3", "\u1EE5", "\u1EE7", "\u1EE9", "\u1EEB", "\u1EED", "\u1EEF", "\u1EF1", "\u1EF3", "\u1EF5", "\u1EF7", "\u1EF9", "\u1EFB", "\u1EFD", ["\u1EFF", "\u1F07"], ["\u1F10", "\u1F15"], ["\u1F20", "\u1F27"], ["\u1F30", "\u1F37"], ["\u1F40", "\u1F45"], ["\u1F50", "\u1F57"], ["\u1F60", "\u1F67"], ["\u1F70", "\u1F7D"], ["\u1F80", "\u1F87"], ["\u1F90", "\u1F97"], ["\u1FA0", "\u1FA7"], ["\u1FB0", "\u1FB4"], ["\u1FB6", "\u1FB7"], "\u1FBE", ["\u1FC2", "\u1FC4"], ["\u1FC6", "\u1FC7"], ["\u1FD0", "\u1FD3"], ["\u1FD6", "\u1FD7"], ["\u1FE0", "\u1FE7"], ["\u1FF2", "\u1FF4"], ["\u1FF6", "\u1FF7"], "\u210A", ["\u210E", "\u210F"], "\u2113", "\u212F", "\u2134", "\u2139", ["\u213C", "\u213D"], ["\u2146", "\u2149"], "\u214E", "\u2184", ["\u2C30", "\u2C5E"], "\u2C61", ["\u2C65", "\u2C66"], "\u2C68", "\u2C6A", "\u2C6C", "\u2C71", ["\u2C73", "\u2C74"], ["\u2C76", "\u2C7B"], "\u2C81", "\u2C83", "\u2C85", "\u2C87", "\u2C89", "\u2C8B", "\u2C8D", "\u2C8F", "\u2C91", "\u2C93", "\u2C95", "\u2C97", "\u2C99", "\u2C9B", "\u2C9D", "\u2C9F", "\u2CA1", "\u2CA3", "\u2CA5", "\u2CA7", "\u2CA9", "\u2CAB", "\u2CAD", "\u2CAF", "\u2CB1", "\u2CB3", "\u2CB5", "\u2CB7", "\u2CB9", "\u2CBB", "\u2CBD", "\u2CBF", "\u2CC1", "\u2CC3", "\u2CC5", "\u2CC7", "\u2CC9", "\u2CCB", "\u2CCD", "\u2CCF", "\u2CD1", "\u2CD3", "\u2CD5", "\u2CD7", "\u2CD9", "\u2CDB", "\u2CDD", "\u2CDF", "\u2CE1", ["\u2CE3", "\u2CE4"], "\u2CEC", "\u2CEE", "\u2CF3", ["\u2D00", "\u2D25"], "\u2D27", "\u2D2D", "\uA641", "\uA643", "\uA645", "\uA647", "\uA649", "\uA64B", "\uA64D", "\uA64F", "\uA651", "\uA653", "\uA655", "\uA657", "\uA659", "\uA65B", "\uA65D", "\uA65F", "\uA661", "\uA663", "\uA665", "\uA667", "\uA669", "\uA66B", "\uA66D", "\uA681", "\uA683", "\uA685", "\uA687", "\uA689", "\uA68B", "\uA68D", "\uA68F", "\uA691", "\uA693", "\uA695", "\uA697", "\uA699", "\uA69B", "\uA723", "\uA725", "\uA727", "\uA729", "\uA72B", "\uA72D", ["\uA72F", "\uA731"], "\uA733", "\uA735", "\uA737", "\uA739", "\uA73B", "\uA73D", "\uA73F", "\uA741", "\uA743", "\uA745", "\uA747", "\uA749", "\uA74B", "\uA74D", "\uA74F", "\uA751", "\uA753", "\uA755", "\uA757", "\uA759", "\uA75B", "\uA75D", "\uA75F", "\uA761", "\uA763", "\uA765", "\uA767", "\uA769", "\uA76B", "\uA76D", "\uA76F", ["\uA771", "\uA778"], "\uA77A", "\uA77C", "\uA77F", "\uA781", "\uA783", "\uA785", "\uA787", "\uA78C", "\uA78E", "\uA791", ["\uA793", "\uA795"], "\uA797", "\uA799", "\uA79B", "\uA79D", "\uA79F", "\uA7A1", "\uA7A3", "\uA7A5", "\uA7A7", "\uA7A9", "\uA7AF", "\uA7B5", "\uA7B7", "\uA7B9", "\uA7FA", ["\uAB30", "\uAB5A"], ["\uAB60", "\uAB65"], ["\uAB70", "\uABBF"], ["\uFB00", "\uFB06"], ["\uFB13", "\uFB17"], ["\uFF41", "\uFF5A"]], false, false);
1476
- var peg$e37 = peg$classExpectation([["\u02B0", "\u02C1"], ["\u02C6", "\u02D1"], ["\u02E0", "\u02E4"], "\u02EC", "\u02EE", "\u0374", "\u037A", "\u0559", "\u0640", ["\u06E5", "\u06E6"], ["\u07F4", "\u07F5"], "\u07FA", "\u081A", "\u0824", "\u0828", "\u0971", "\u0E46", "\u0EC6", "\u10FC", "\u17D7", "\u1843", "\u1AA7", ["\u1C78", "\u1C7D"], ["\u1D2C", "\u1D6A"], "\u1D78", ["\u1D9B", "\u1DBF"], "\u2071", "\u207F", ["\u2090", "\u209C"], ["\u2C7C", "\u2C7D"], "\u2D6F", "\u2E2F", "\u3005", ["\u3031", "\u3035"], "\u303B", ["\u309D", "\u309E"], ["\u30FC", "\u30FE"], "\uA015", ["\uA4F8", "\uA4FD"], "\uA60C", "\uA67F", ["\uA69C", "\uA69D"], ["\uA717", "\uA71F"], "\uA770", "\uA788", ["\uA7F8", "\uA7F9"], "\uA9CF", "\uA9E6", "\uAA70", "\uAADD", ["\uAAF3", "\uAAF4"], ["\uAB5C", "\uAB5F"], "\uFF70", ["\uFF9E", "\uFF9F"]], false, false);
1477
- var peg$e38 = peg$classExpectation(["\xAA", "\xBA", "\u01BB", ["\u01C0", "\u01C3"], "\u0294", ["\u05D0", "\u05EA"], ["\u05EF", "\u05F2"], ["\u0620", "\u063F"], ["\u0641", "\u064A"], ["\u066E", "\u066F"], ["\u0671", "\u06D3"], "\u06D5", ["\u06EE", "\u06EF"], ["\u06FA", "\u06FC"], "\u06FF", "\u0710", ["\u0712", "\u072F"], ["\u074D", "\u07A5"], "\u07B1", ["\u07CA", "\u07EA"], ["\u0800", "\u0815"], ["\u0840", "\u0858"], ["\u0860", "\u086A"], ["\u08A0", "\u08B4"], ["\u08B6", "\u08BD"], ["\u0904", "\u0939"], "\u093D", "\u0950", ["\u0958", "\u0961"], ["\u0972", "\u0980"], ["\u0985", "\u098C"], ["\u098F", "\u0990"], ["\u0993", "\u09A8"], ["\u09AA", "\u09B0"], "\u09B2", ["\u09B6", "\u09B9"], "\u09BD", "\u09CE", ["\u09DC", "\u09DD"], ["\u09DF", "\u09E1"], ["\u09F0", "\u09F1"], "\u09FC", ["\u0A05", "\u0A0A"], ["\u0A0F", "\u0A10"], ["\u0A13", "\u0A28"], ["\u0A2A", "\u0A30"], ["\u0A32", "\u0A33"], ["\u0A35", "\u0A36"], ["\u0A38", "\u0A39"], ["\u0A59", "\u0A5C"], "\u0A5E", ["\u0A72", "\u0A74"], ["\u0A85", "\u0A8D"], ["\u0A8F", "\u0A91"], ["\u0A93", "\u0AA8"], ["\u0AAA", "\u0AB0"], ["\u0AB2", "\u0AB3"], ["\u0AB5", "\u0AB9"], "\u0ABD", "\u0AD0", ["\u0AE0", "\u0AE1"], "\u0AF9", ["\u0B05", "\u0B0C"], ["\u0B0F", "\u0B10"], ["\u0B13", "\u0B28"], ["\u0B2A", "\u0B30"], ["\u0B32", "\u0B33"], ["\u0B35", "\u0B39"], "\u0B3D", ["\u0B5C", "\u0B5D"], ["\u0B5F", "\u0B61"], "\u0B71", "\u0B83", ["\u0B85", "\u0B8A"], ["\u0B8E", "\u0B90"], ["\u0B92", "\u0B95"], ["\u0B99", "\u0B9A"], "\u0B9C", ["\u0B9E", "\u0B9F"], ["\u0BA3", "\u0BA4"], ["\u0BA8", "\u0BAA"], ["\u0BAE", "\u0BB9"], "\u0BD0", ["\u0C05", "\u0C0C"], ["\u0C0E", "\u0C10"], ["\u0C12", "\u0C28"], ["\u0C2A", "\u0C39"], "\u0C3D", ["\u0C58", "\u0C5A"], ["\u0C60", "\u0C61"], "\u0C80", ["\u0C85", "\u0C8C"], ["\u0C8E", "\u0C90"], ["\u0C92", "\u0CA8"], ["\u0CAA", "\u0CB3"], ["\u0CB5", "\u0CB9"], "\u0CBD", "\u0CDE", ["\u0CE0", "\u0CE1"], ["\u0CF1", "\u0CF2"], ["\u0D05", "\u0D0C"], ["\u0D0E", "\u0D10"], ["\u0D12", "\u0D3A"], "\u0D3D", "\u0D4E", ["\u0D54", "\u0D56"], ["\u0D5F", "\u0D61"], ["\u0D7A", "\u0D7F"], ["\u0D85", "\u0D96"], ["\u0D9A", "\u0DB1"], ["\u0DB3", "\u0DBB"], "\u0DBD", ["\u0DC0", "\u0DC6"], ["\u0E01", "\u0E30"], ["\u0E32", "\u0E33"], ["\u0E40", "\u0E45"], ["\u0E81", "\u0E82"], "\u0E84", ["\u0E87", "\u0E88"], "\u0E8A", "\u0E8D", ["\u0E94", "\u0E97"], ["\u0E99", "\u0E9F"], ["\u0EA1", "\u0EA3"], "\u0EA5", "\u0EA7", ["\u0EAA", "\u0EAB"], ["\u0EAD", "\u0EB0"], ["\u0EB2", "\u0EB3"], "\u0EBD", ["\u0EC0", "\u0EC4"], ["\u0EDC", "\u0EDF"], "\u0F00", ["\u0F40", "\u0F47"], ["\u0F49", "\u0F6C"], ["\u0F88", "\u0F8C"], ["\u1000", "\u102A"], "\u103F", ["\u1050", "\u1055"], ["\u105A", "\u105D"], "\u1061", ["\u1065", "\u1066"], ["\u106E", "\u1070"], ["\u1075", "\u1081"], "\u108E", ["\u1100", "\u1248"], ["\u124A", "\u124D"], ["\u1250", "\u1256"], "\u1258", ["\u125A", "\u125D"], ["\u1260", "\u1288"], ["\u128A", "\u128D"], ["\u1290", "\u12B0"], ["\u12B2", "\u12B5"], ["\u12B8", "\u12BE"], "\u12C0", ["\u12C2", "\u12C5"], ["\u12C8", "\u12D6"], ["\u12D8", "\u1310"], ["\u1312", "\u1315"], ["\u1318", "\u135A"], ["\u1380", "\u138F"], ["\u1401", "\u166C"], ["\u166F", "\u167F"], ["\u1681", "\u169A"], ["\u16A0", "\u16EA"], ["\u16F1", "\u16F8"], ["\u1700", "\u170C"], ["\u170E", "\u1711"], ["\u1720", "\u1731"], ["\u1740", "\u1751"], ["\u1760", "\u176C"], ["\u176E", "\u1770"], ["\u1780", "\u17B3"], "\u17DC", ["\u1820", "\u1842"], ["\u1844", "\u1878"], ["\u1880", "\u1884"], ["\u1887", "\u18A8"], "\u18AA", ["\u18B0", "\u18F5"], ["\u1900", "\u191E"], ["\u1950", "\u196D"], ["\u1970", "\u1974"], ["\u1980", "\u19AB"], ["\u19B0", "\u19C9"], ["\u1A00", "\u1A16"], ["\u1A20", "\u1A54"], ["\u1B05", "\u1B33"], ["\u1B45", "\u1B4B"], ["\u1B83", "\u1BA0"], ["\u1BAE", "\u1BAF"], ["\u1BBA", "\u1BE5"], ["\u1C00", "\u1C23"], ["\u1C4D", "\u1C4F"], ["\u1C5A", "\u1C77"], ["\u1CE9", "\u1CEC"], ["\u1CEE", "\u1CF1"], ["\u1CF5", "\u1CF6"], ["\u2135", "\u2138"], ["\u2D30", "\u2D67"], ["\u2D80", "\u2D96"], ["\u2DA0", "\u2DA6"], ["\u2DA8", "\u2DAE"], ["\u2DB0", "\u2DB6"], ["\u2DB8", "\u2DBE"], ["\u2DC0", "\u2DC6"], ["\u2DC8", "\u2DCE"], ["\u2DD0", "\u2DD6"], ["\u2DD8", "\u2DDE"], "\u3006", "\u303C", ["\u3041", "\u3096"], "\u309F", ["\u30A1", "\u30FA"], "\u30FF", ["\u3105", "\u312F"], ["\u3131", "\u318E"], ["\u31A0", "\u31BA"], ["\u31F0", "\u31FF"], ["\u3400", "\u4DB5"], ["\u4E00", "\u9FEF"], ["\uA000", "\uA014"], ["\uA016", "\uA48C"], ["\uA4D0", "\uA4F7"], ["\uA500", "\uA60B"], ["\uA610", "\uA61F"], ["\uA62A", "\uA62B"], "\uA66E", ["\uA6A0", "\uA6E5"], "\uA78F", "\uA7F7", ["\uA7FB", "\uA801"], ["\uA803", "\uA805"], ["\uA807", "\uA80A"], ["\uA80C", "\uA822"], ["\uA840", "\uA873"], ["\uA882", "\uA8B3"], ["\uA8F2", "\uA8F7"], "\uA8FB", ["\uA8FD", "\uA8FE"], ["\uA90A", "\uA925"], ["\uA930", "\uA946"], ["\uA960", "\uA97C"], ["\uA984", "\uA9B2"], ["\uA9E0", "\uA9E4"], ["\uA9E7", "\uA9EF"], ["\uA9FA", "\uA9FE"], ["\uAA00", "\uAA28"], ["\uAA40", "\uAA42"], ["\uAA44", "\uAA4B"], ["\uAA60", "\uAA6F"], ["\uAA71", "\uAA76"], "\uAA7A", ["\uAA7E", "\uAAAF"], "\uAAB1", ["\uAAB5", "\uAAB6"], ["\uAAB9", "\uAABD"], "\uAAC0", "\uAAC2", ["\uAADB", "\uAADC"], ["\uAAE0", "\uAAEA"], "\uAAF2", ["\uAB01", "\uAB06"], ["\uAB09", "\uAB0E"], ["\uAB11", "\uAB16"], ["\uAB20", "\uAB26"], ["\uAB28", "\uAB2E"], ["\uABC0", "\uABE2"], ["\uAC00", "\uD7A3"], ["\uD7B0", "\uD7C6"], ["\uD7CB", "\uD7FB"], ["\uF900", "\uFA6D"], ["\uFA70", "\uFAD9"], "\uFB1D", ["\uFB1F", "\uFB28"], ["\uFB2A", "\uFB36"], ["\uFB38", "\uFB3C"], "\uFB3E", ["\uFB40", "\uFB41"], ["\uFB43", "\uFB44"], ["\uFB46", "\uFBB1"], ["\uFBD3", "\uFD3D"], ["\uFD50", "\uFD8F"], ["\uFD92", "\uFDC7"], ["\uFDF0", "\uFDFB"], ["\uFE70", "\uFE74"], ["\uFE76", "\uFEFC"], ["\uFF66", "\uFF6F"], ["\uFF71", "\uFF9D"], ["\uFFA0", "\uFFBE"], ["\uFFC2", "\uFFC7"], ["\uFFCA", "\uFFCF"], ["\uFFD2", "\uFFD7"], ["\uFFDA", "\uFFDC"]], false, false);
1478
- var peg$e39 = peg$classExpectation(["\u01C5", "\u01C8", "\u01CB", "\u01F2", ["\u1F88", "\u1F8F"], ["\u1F98", "\u1F9F"], ["\u1FA8", "\u1FAF"], "\u1FBC", "\u1FCC", "\u1FFC"], false, false);
1479
- var peg$e40 = peg$classExpectation([["A", "Z"], ["\xC0", "\xD6"], ["\xD8", "\xDE"], "\u0100", "\u0102", "\u0104", "\u0106", "\u0108", "\u010A", "\u010C", "\u010E", "\u0110", "\u0112", "\u0114", "\u0116", "\u0118", "\u011A", "\u011C", "\u011E", "\u0120", "\u0122", "\u0124", "\u0126", "\u0128", "\u012A", "\u012C", "\u012E", "\u0130", "\u0132", "\u0134", "\u0136", "\u0139", "\u013B", "\u013D", "\u013F", "\u0141", "\u0143", "\u0145", "\u0147", "\u014A", "\u014C", "\u014E", "\u0150", "\u0152", "\u0154", "\u0156", "\u0158", "\u015A", "\u015C", "\u015E", "\u0160", "\u0162", "\u0164", "\u0166", "\u0168", "\u016A", "\u016C", "\u016E", "\u0170", "\u0172", "\u0174", "\u0176", ["\u0178", "\u0179"], "\u017B", "\u017D", ["\u0181", "\u0182"], "\u0184", ["\u0186", "\u0187"], ["\u0189", "\u018B"], ["\u018E", "\u0191"], ["\u0193", "\u0194"], ["\u0196", "\u0198"], ["\u019C", "\u019D"], ["\u019F", "\u01A0"], "\u01A2", "\u01A4", ["\u01A6", "\u01A7"], "\u01A9", "\u01AC", ["\u01AE", "\u01AF"], ["\u01B1", "\u01B3"], "\u01B5", ["\u01B7", "\u01B8"], "\u01BC", "\u01C4", "\u01C7", "\u01CA", "\u01CD", "\u01CF", "\u01D1", "\u01D3", "\u01D5", "\u01D7", "\u01D9", "\u01DB", "\u01DE", "\u01E0", "\u01E2", "\u01E4", "\u01E6", "\u01E8", "\u01EA", "\u01EC", "\u01EE", "\u01F1", "\u01F4", ["\u01F6", "\u01F8"], "\u01FA", "\u01FC", "\u01FE", "\u0200", "\u0202", "\u0204", "\u0206", "\u0208", "\u020A", "\u020C", "\u020E", "\u0210", "\u0212", "\u0214", "\u0216", "\u0218", "\u021A", "\u021C", "\u021E", "\u0220", "\u0222", "\u0224", "\u0226", "\u0228", "\u022A", "\u022C", "\u022E", "\u0230", "\u0232", ["\u023A", "\u023B"], ["\u023D", "\u023E"], "\u0241", ["\u0243", "\u0246"], "\u0248", "\u024A", "\u024C", "\u024E", "\u0370", "\u0372", "\u0376", "\u037F", "\u0386", ["\u0388", "\u038A"], "\u038C", ["\u038E", "\u038F"], ["\u0391", "\u03A1"], ["\u03A3", "\u03AB"], "\u03CF", ["\u03D2", "\u03D4"], "\u03D8", "\u03DA", "\u03DC", "\u03DE", "\u03E0", "\u03E2", "\u03E4", "\u03E6", "\u03E8", "\u03EA", "\u03EC", "\u03EE", "\u03F4", "\u03F7", ["\u03F9", "\u03FA"], ["\u03FD", "\u042F"], "\u0460", "\u0462", "\u0464", "\u0466", "\u0468", "\u046A", "\u046C", "\u046E", "\u0470", "\u0472", "\u0474", "\u0476", "\u0478", "\u047A", "\u047C", "\u047E", "\u0480", "\u048A", "\u048C", "\u048E", "\u0490", "\u0492", "\u0494", "\u0496", "\u0498", "\u049A", "\u049C", "\u049E", "\u04A0", "\u04A2", "\u04A4", "\u04A6", "\u04A8", "\u04AA", "\u04AC", "\u04AE", "\u04B0", "\u04B2", "\u04B4", "\u04B6", "\u04B8", "\u04BA", "\u04BC", "\u04BE", ["\u04C0", "\u04C1"], "\u04C3", "\u04C5", "\u04C7", "\u04C9", "\u04CB", "\u04CD", "\u04D0", "\u04D2", "\u04D4", "\u04D6", "\u04D8", "\u04DA", "\u04DC", "\u04DE", "\u04E0", "\u04E2", "\u04E4", "\u04E6", "\u04E8", "\u04EA", "\u04EC", "\u04EE", "\u04F0", "\u04F2", "\u04F4", "\u04F6", "\u04F8", "\u04FA", "\u04FC", "\u04FE", "\u0500", "\u0502", "\u0504", "\u0506", "\u0508", "\u050A", "\u050C", "\u050E", "\u0510", "\u0512", "\u0514", "\u0516", "\u0518", "\u051A", "\u051C", "\u051E", "\u0520", "\u0522", "\u0524", "\u0526", "\u0528", "\u052A", "\u052C", "\u052E", ["\u0531", "\u0556"], ["\u10A0", "\u10C5"], "\u10C7", "\u10CD", ["\u13A0", "\u13F5"], ["\u1C90", "\u1CBA"], ["\u1CBD", "\u1CBF"], "\u1E00", "\u1E02", "\u1E04", "\u1E06", "\u1E08", "\u1E0A", "\u1E0C", "\u1E0E", "\u1E10", "\u1E12", "\u1E14", "\u1E16", "\u1E18", "\u1E1A", "\u1E1C", "\u1E1E", "\u1E20", "\u1E22", "\u1E24", "\u1E26", "\u1E28", "\u1E2A", "\u1E2C", "\u1E2E", "\u1E30", "\u1E32", "\u1E34", "\u1E36", "\u1E38", "\u1E3A", "\u1E3C", "\u1E3E", "\u1E40", "\u1E42", "\u1E44", "\u1E46", "\u1E48", "\u1E4A", "\u1E4C", "\u1E4E", "\u1E50", "\u1E52", "\u1E54", "\u1E56", "\u1E58", "\u1E5A", "\u1E5C", "\u1E5E", "\u1E60", "\u1E62", "\u1E64", "\u1E66", "\u1E68", "\u1E6A", "\u1E6C", "\u1E6E", "\u1E70", "\u1E72", "\u1E74", "\u1E76", "\u1E78", "\u1E7A", "\u1E7C", "\u1E7E", "\u1E80", "\u1E82", "\u1E84", "\u1E86", "\u1E88", "\u1E8A", "\u1E8C", "\u1E8E", "\u1E90", "\u1E92", "\u1E94", "\u1E9E", "\u1EA0", "\u1EA2", "\u1EA4", "\u1EA6", "\u1EA8", "\u1EAA", "\u1EAC", "\u1EAE", "\u1EB0", "\u1EB2", "\u1EB4", "\u1EB6", "\u1EB8", "\u1EBA", "\u1EBC", "\u1EBE", "\u1EC0", "\u1EC2", "\u1EC4", "\u1EC6", "\u1EC8", "\u1ECA", "\u1ECC", "\u1ECE", "\u1ED0", "\u1ED2", "\u1ED4", "\u1ED6", "\u1ED8", "\u1EDA", "\u1EDC", "\u1EDE", "\u1EE0", "\u1EE2", "\u1EE4", "\u1EE6", "\u1EE8", "\u1EEA", "\u1EEC", "\u1EEE", "\u1EF0", "\u1EF2", "\u1EF4", "\u1EF6", "\u1EF8", "\u1EFA", "\u1EFC", "\u1EFE", ["\u1F08", "\u1F0F"], ["\u1F18", "\u1F1D"], ["\u1F28", "\u1F2F"], ["\u1F38", "\u1F3F"], ["\u1F48", "\u1F4D"], "\u1F59", "\u1F5B", "\u1F5D", "\u1F5F", ["\u1F68", "\u1F6F"], ["\u1FB8", "\u1FBB"], ["\u1FC8", "\u1FCB"], ["\u1FD8", "\u1FDB"], ["\u1FE8", "\u1FEC"], ["\u1FF8", "\u1FFB"], "\u2102", "\u2107", ["\u210B", "\u210D"], ["\u2110", "\u2112"], "\u2115", ["\u2119", "\u211D"], "\u2124", "\u2126", "\u2128", ["\u212A", "\u212D"], ["\u2130", "\u2133"], ["\u213E", "\u213F"], "\u2145", "\u2183", ["\u2C00", "\u2C2E"], "\u2C60", ["\u2C62", "\u2C64"], "\u2C67", "\u2C69", "\u2C6B", ["\u2C6D", "\u2C70"], "\u2C72", "\u2C75", ["\u2C7E", "\u2C80"], "\u2C82", "\u2C84", "\u2C86", "\u2C88", "\u2C8A", "\u2C8C", "\u2C8E", "\u2C90", "\u2C92", "\u2C94", "\u2C96", "\u2C98", "\u2C9A", "\u2C9C", "\u2C9E", "\u2CA0", "\u2CA2", "\u2CA4", "\u2CA6", "\u2CA8", "\u2CAA", "\u2CAC", "\u2CAE", "\u2CB0", "\u2CB2", "\u2CB4", "\u2CB6", "\u2CB8", "\u2CBA", "\u2CBC", "\u2CBE", "\u2CC0", "\u2CC2", "\u2CC4", "\u2CC6", "\u2CC8", "\u2CCA", "\u2CCC", "\u2CCE", "\u2CD0", "\u2CD2", "\u2CD4", "\u2CD6", "\u2CD8", "\u2CDA", "\u2CDC", "\u2CDE", "\u2CE0", "\u2CE2", "\u2CEB", "\u2CED", "\u2CF2", "\uA640", "\uA642", "\uA644", "\uA646", "\uA648", "\uA64A", "\uA64C", "\uA64E", "\uA650", "\uA652", "\uA654", "\uA656", "\uA658", "\uA65A", "\uA65C", "\uA65E", "\uA660", "\uA662", "\uA664", "\uA666", "\uA668", "\uA66A", "\uA66C", "\uA680", "\uA682", "\uA684", "\uA686", "\uA688", "\uA68A", "\uA68C", "\uA68E", "\uA690", "\uA692", "\uA694", "\uA696", "\uA698", "\uA69A", "\uA722", "\uA724", "\uA726", "\uA728", "\uA72A", "\uA72C", "\uA72E", "\uA732", "\uA734", "\uA736", "\uA738", "\uA73A", "\uA73C", "\uA73E", "\uA740", "\uA742", "\uA744", "\uA746", "\uA748", "\uA74A", "\uA74C", "\uA74E", "\uA750", "\uA752", "\uA754", "\uA756", "\uA758", "\uA75A", "\uA75C", "\uA75E", "\uA760", "\uA762", "\uA764", "\uA766", "\uA768", "\uA76A", "\uA76C", "\uA76E", "\uA779", "\uA77B", ["\uA77D", "\uA77E"], "\uA780", "\uA782", "\uA784", "\uA786", "\uA78B", "\uA78D", "\uA790", "\uA792", "\uA796", "\uA798", "\uA79A", "\uA79C", "\uA79E", "\uA7A0", "\uA7A2", "\uA7A4", "\uA7A6", "\uA7A8", ["\uA7AA", "\uA7AE"], ["\uA7B0", "\uA7B4"], "\uA7B6", "\uA7B8", ["\uFF21", "\uFF3A"]], false, false);
1480
- var peg$e41 = peg$classExpectation(["\u0903", "\u093B", ["\u093E", "\u0940"], ["\u0949", "\u094C"], ["\u094E", "\u094F"], ["\u0982", "\u0983"], ["\u09BE", "\u09C0"], ["\u09C7", "\u09C8"], ["\u09CB", "\u09CC"], "\u09D7", "\u0A03", ["\u0A3E", "\u0A40"], "\u0A83", ["\u0ABE", "\u0AC0"], "\u0AC9", ["\u0ACB", "\u0ACC"], ["\u0B02", "\u0B03"], "\u0B3E", "\u0B40", ["\u0B47", "\u0B48"], ["\u0B4B", "\u0B4C"], "\u0B57", ["\u0BBE", "\u0BBF"], ["\u0BC1", "\u0BC2"], ["\u0BC6", "\u0BC8"], ["\u0BCA", "\u0BCC"], "\u0BD7", ["\u0C01", "\u0C03"], ["\u0C41", "\u0C44"], ["\u0C82", "\u0C83"], "\u0CBE", ["\u0CC0", "\u0CC4"], ["\u0CC7", "\u0CC8"], ["\u0CCA", "\u0CCB"], ["\u0CD5", "\u0CD6"], ["\u0D02", "\u0D03"], ["\u0D3E", "\u0D40"], ["\u0D46", "\u0D48"], ["\u0D4A", "\u0D4C"], "\u0D57", ["\u0D82", "\u0D83"], ["\u0DCF", "\u0DD1"], ["\u0DD8", "\u0DDF"], ["\u0DF2", "\u0DF3"], ["\u0F3E", "\u0F3F"], "\u0F7F", ["\u102B", "\u102C"], "\u1031", "\u1038", ["\u103B", "\u103C"], ["\u1056", "\u1057"], ["\u1062", "\u1064"], ["\u1067", "\u106D"], ["\u1083", "\u1084"], ["\u1087", "\u108C"], "\u108F", ["\u109A", "\u109C"], "\u17B6", ["\u17BE", "\u17C5"], ["\u17C7", "\u17C8"], ["\u1923", "\u1926"], ["\u1929", "\u192B"], ["\u1930", "\u1931"], ["\u1933", "\u1938"], ["\u1A19", "\u1A1A"], "\u1A55", "\u1A57", "\u1A61", ["\u1A63", "\u1A64"], ["\u1A6D", "\u1A72"], "\u1B04", "\u1B35", "\u1B3B", ["\u1B3D", "\u1B41"], ["\u1B43", "\u1B44"], "\u1B82", "\u1BA1", ["\u1BA6", "\u1BA7"], "\u1BAA", "\u1BE7", ["\u1BEA", "\u1BEC"], "\u1BEE", ["\u1BF2", "\u1BF3"], ["\u1C24", "\u1C2B"], ["\u1C34", "\u1C35"], "\u1CE1", ["\u1CF2", "\u1CF3"], "\u1CF7", ["\u302E", "\u302F"], ["\uA823", "\uA824"], "\uA827", ["\uA880", "\uA881"], ["\uA8B4", "\uA8C3"], ["\uA952", "\uA953"], "\uA983", ["\uA9B4", "\uA9B5"], ["\uA9BA", "\uA9BB"], ["\uA9BD", "\uA9C0"], ["\uAA2F", "\uAA30"], ["\uAA33", "\uAA34"], "\uAA4D", "\uAA7B", "\uAA7D", "\uAAEB", ["\uAAEE", "\uAAEF"], "\uAAF5", ["\uABE3", "\uABE4"], ["\uABE6", "\uABE7"], ["\uABE9", "\uABEA"], "\uABEC"], false, false);
1481
- var peg$e42 = peg$classExpectation([["\u0300", "\u036F"], ["\u0483", "\u0487"], ["\u0591", "\u05BD"], "\u05BF", ["\u05C1", "\u05C2"], ["\u05C4", "\u05C5"], "\u05C7", ["\u0610", "\u061A"], ["\u064B", "\u065F"], "\u0670", ["\u06D6", "\u06DC"], ["\u06DF", "\u06E4"], ["\u06E7", "\u06E8"], ["\u06EA", "\u06ED"], "\u0711", ["\u0730", "\u074A"], ["\u07A6", "\u07B0"], ["\u07EB", "\u07F3"], "\u07FD", ["\u0816", "\u0819"], ["\u081B", "\u0823"], ["\u0825", "\u0827"], ["\u0829", "\u082D"], ["\u0859", "\u085B"], ["\u08D3", "\u08E1"], ["\u08E3", "\u0902"], "\u093A", "\u093C", ["\u0941", "\u0948"], "\u094D", ["\u0951", "\u0957"], ["\u0962", "\u0963"], "\u0981", "\u09BC", ["\u09C1", "\u09C4"], "\u09CD", ["\u09E2", "\u09E3"], "\u09FE", ["\u0A01", "\u0A02"], "\u0A3C", ["\u0A41", "\u0A42"], ["\u0A47", "\u0A48"], ["\u0A4B", "\u0A4D"], "\u0A51", ["\u0A70", "\u0A71"], "\u0A75", ["\u0A81", "\u0A82"], "\u0ABC", ["\u0AC1", "\u0AC5"], ["\u0AC7", "\u0AC8"], "\u0ACD", ["\u0AE2", "\u0AE3"], ["\u0AFA", "\u0AFF"], "\u0B01", "\u0B3C", "\u0B3F", ["\u0B41", "\u0B44"], "\u0B4D", "\u0B56", ["\u0B62", "\u0B63"], "\u0B82", "\u0BC0", "\u0BCD", "\u0C00", "\u0C04", ["\u0C3E", "\u0C40"], ["\u0C46", "\u0C48"], ["\u0C4A", "\u0C4D"], ["\u0C55", "\u0C56"], ["\u0C62", "\u0C63"], "\u0C81", "\u0CBC", "\u0CBF", "\u0CC6", ["\u0CCC", "\u0CCD"], ["\u0CE2", "\u0CE3"], ["\u0D00", "\u0D01"], ["\u0D3B", "\u0D3C"], ["\u0D41", "\u0D44"], "\u0D4D", ["\u0D62", "\u0D63"], "\u0DCA", ["\u0DD2", "\u0DD4"], "\u0DD6", "\u0E31", ["\u0E34", "\u0E3A"], ["\u0E47", "\u0E4E"], "\u0EB1", ["\u0EB4", "\u0EB9"], ["\u0EBB", "\u0EBC"], ["\u0EC8", "\u0ECD"], ["\u0F18", "\u0F19"], "\u0F35", "\u0F37", "\u0F39", ["\u0F71", "\u0F7E"], ["\u0F80", "\u0F84"], ["\u0F86", "\u0F87"], ["\u0F8D", "\u0F97"], ["\u0F99", "\u0FBC"], "\u0FC6", ["\u102D", "\u1030"], ["\u1032", "\u1037"], ["\u1039", "\u103A"], ["\u103D", "\u103E"], ["\u1058", "\u1059"], ["\u105E", "\u1060"], ["\u1071", "\u1074"], "\u1082", ["\u1085", "\u1086"], "\u108D", "\u109D", ["\u135D", "\u135F"], ["\u1712", "\u1714"], ["\u1732", "\u1734"], ["\u1752", "\u1753"], ["\u1772", "\u1773"], ["\u17B4", "\u17B5"], ["\u17B7", "\u17BD"], "\u17C6", ["\u17C9", "\u17D3"], "\u17DD", ["\u180B", "\u180D"], ["\u1885", "\u1886"], "\u18A9", ["\u1920", "\u1922"], ["\u1927", "\u1928"], "\u1932", ["\u1939", "\u193B"], ["\u1A17", "\u1A18"], "\u1A1B", "\u1A56", ["\u1A58", "\u1A5E"], "\u1A60", "\u1A62", ["\u1A65", "\u1A6C"], ["\u1A73", "\u1A7C"], "\u1A7F", ["\u1AB0", "\u1ABD"], ["\u1B00", "\u1B03"], "\u1B34", ["\u1B36", "\u1B3A"], "\u1B3C", "\u1B42", ["\u1B6B", "\u1B73"], ["\u1B80", "\u1B81"], ["\u1BA2", "\u1BA5"], ["\u1BA8", "\u1BA9"], ["\u1BAB", "\u1BAD"], "\u1BE6", ["\u1BE8", "\u1BE9"], "\u1BED", ["\u1BEF", "\u1BF1"], ["\u1C2C", "\u1C33"], ["\u1C36", "\u1C37"], ["\u1CD0", "\u1CD2"], ["\u1CD4", "\u1CE0"], ["\u1CE2", "\u1CE8"], "\u1CED", "\u1CF4", ["\u1CF8", "\u1CF9"], ["\u1DC0", "\u1DF9"], ["\u1DFB", "\u1DFF"], ["\u20D0", "\u20DC"], "\u20E1", ["\u20E5", "\u20F0"], ["\u2CEF", "\u2CF1"], "\u2D7F", ["\u2DE0", "\u2DFF"], ["\u302A", "\u302D"], ["\u3099", "\u309A"], "\uA66F", ["\uA674", "\uA67D"], ["\uA69E", "\uA69F"], ["\uA6F0", "\uA6F1"], "\uA802", "\uA806", "\uA80B", ["\uA825", "\uA826"], ["\uA8C4", "\uA8C5"], ["\uA8E0", "\uA8F1"], "\uA8FF", ["\uA926", "\uA92D"], ["\uA947", "\uA951"], ["\uA980", "\uA982"], "\uA9B3", ["\uA9B6", "\uA9B9"], "\uA9BC", "\uA9E5", ["\uAA29", "\uAA2E"], ["\uAA31", "\uAA32"], ["\uAA35", "\uAA36"], "\uAA43", "\uAA4C", "\uAA7C", "\uAAB0", ["\uAAB2", "\uAAB4"], ["\uAAB7", "\uAAB8"], ["\uAABE", "\uAABF"], "\uAAC1", ["\uAAEC", "\uAAED"], "\uAAF6", "\uABE5", "\uABE8", "\uABED", "\uFB1E", ["\uFE00", "\uFE0F"], ["\uFE20", "\uFE2F"]], false, false);
1482
- var peg$e43 = peg$classExpectation([["0", "9"], ["\u0660", "\u0669"], ["\u06F0", "\u06F9"], ["\u07C0", "\u07C9"], ["\u0966", "\u096F"], ["\u09E6", "\u09EF"], ["\u0A66", "\u0A6F"], ["\u0AE6", "\u0AEF"], ["\u0B66", "\u0B6F"], ["\u0BE6", "\u0BEF"], ["\u0C66", "\u0C6F"], ["\u0CE6", "\u0CEF"], ["\u0D66", "\u0D6F"], ["\u0DE6", "\u0DEF"], ["\u0E50", "\u0E59"], ["\u0ED0", "\u0ED9"], ["\u0F20", "\u0F29"], ["\u1040", "\u1049"], ["\u1090", "\u1099"], ["\u17E0", "\u17E9"], ["\u1810", "\u1819"], ["\u1946", "\u194F"], ["\u19D0", "\u19D9"], ["\u1A80", "\u1A89"], ["\u1A90", "\u1A99"], ["\u1B50", "\u1B59"], ["\u1BB0", "\u1BB9"], ["\u1C40", "\u1C49"], ["\u1C50", "\u1C59"], ["\uA620", "\uA629"], ["\uA8D0", "\uA8D9"], ["\uA900", "\uA909"], ["\uA9D0", "\uA9D9"], ["\uA9F0", "\uA9F9"], ["\uAA50", "\uAA59"], ["\uABF0", "\uABF9"], ["\uFF10", "\uFF19"]], false, false);
1483
- var peg$e44 = peg$classExpectation([["\u16EE", "\u16F0"], ["\u2160", "\u2182"], ["\u2185", "\u2188"], "\u3007", ["\u3021", "\u3029"], ["\u3038", "\u303A"], ["\uA6E6", "\uA6EF"]], false, false);
1484
- var peg$e45 = peg$classExpectation(["_", ["\u203F", "\u2040"], "\u2054", ["\uFE33", "\uFE34"], ["\uFE4D", "\uFE4F"], "\uFF3F"], false, false);
1485
- var peg$e46 = peg$classExpectation([" ", "\xA0", "\u1680", ["\u2000", "\u200A"], "\u202F", "\u205F", "\u3000"], false, false);
1486
- var peg$f0 = function(lhs, values) {
1487
- return wrap({
1488
- names: lhs.names,
1489
- values
1490
- });
1491
- };
1492
- var peg$f1 = function(head, tail) {
1493
- return wrap({
1494
- type: "QualifiedName",
1495
- names: [head, ...tail]
1496
- });
1497
- };
1498
- var peg$f2 = function(head, tail) {
1499
- return [head, ...tail];
1500
- };
1501
- var peg$f3 = function(head, tail) {
1502
- return wrap({ type: "Literal", value: head + tail.join("") });
1503
- };
1504
- var peg$f4 = function(value) {
1505
- return wrap({ type: "Literal", value });
1506
- };
1507
- var peg$f5 = function(values) {
1508
- return wrap({ type: "SubList", values });
1509
- };
1510
- var peg$f6 = function(head, tail) {
1511
- return head + tail.join("");
1512
- };
1513
- var peg$f7 = function() {
1514
- return "/";
1515
- };
1516
- var peg$currPos = 0;
1517
- var peg$savedPos = 0;
1518
- var peg$posDetailsCache = [{ line: 1, column: 1 }];
1519
- var peg$maxFailPos = 0;
1520
- var peg$maxFailExpected = [];
1521
- var peg$silentFails = 0;
1522
- var peg$result;
1523
- if ("startRule" in options) {
1524
- if (!(options.startRule in peg$startRuleFunctions)) {
1525
- throw new Error(`Can't start parsing from rule "` + options.startRule + '".');
1526
- }
1527
- peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
1528
- }
1529
- function text() {
1530
- return input.substring(peg$savedPos, peg$currPos);
1531
- }
1532
- function offset() {
1533
- return peg$savedPos;
1534
- }
1535
- function range() {
1536
- return {
1537
- source: peg$source,
1538
- start: peg$savedPos,
1539
- end: peg$currPos
1540
- };
1541
- }
1542
- function location() {
1543
- return peg$computeLocation(peg$savedPos, peg$currPos);
1544
- }
1545
- function expected(description, location2) {
1546
- location2 = location2 !== void 0 ? location2 : peg$computeLocation(peg$savedPos, peg$currPos);
1547
- throw peg$buildStructuredError(
1548
- [peg$otherExpectation(description)],
1549
- input.substring(peg$savedPos, peg$currPos),
1550
- location2
1551
- );
1552
- }
1553
- function error(message, location2) {
1554
- location2 = location2 !== void 0 ? location2 : peg$computeLocation(peg$savedPos, peg$currPos);
1555
- throw peg$buildSimpleError(message, location2);
1556
- }
1557
- function peg$literalExpectation(text2, ignoreCase) {
1558
- return { type: "literal", text: text2, ignoreCase };
1559
- }
1560
- function peg$classExpectation(parts, inverted, ignoreCase) {
1561
- return { type: "class", parts, inverted, ignoreCase };
1562
- }
1563
- function peg$anyExpectation() {
1564
- return { type: "any" };
1565
- }
1566
- function peg$endExpectation() {
1567
- return { type: "end" };
1568
- }
1569
- function peg$otherExpectation(description) {
1570
- return { type: "other", description };
1571
- }
1572
- function peg$computePosDetails(pos) {
1573
- var details = peg$posDetailsCache[pos];
1574
- var p;
1575
- if (details) {
1576
- return details;
1577
- } else {
1578
- p = pos - 1;
1579
- while (!peg$posDetailsCache[p]) {
1580
- p--;
1581
- }
1582
- details = peg$posDetailsCache[p];
1583
- details = {
1584
- line: details.line,
1585
- column: details.column
1586
- };
1587
- while (p < pos) {
1588
- if (input.charCodeAt(p) === 10) {
1589
- details.line++;
1590
- details.column = 1;
1591
- } else {
1592
- details.column++;
1593
- }
1594
- p++;
1595
- }
1596
- peg$posDetailsCache[pos] = details;
1597
- return details;
1598
- }
1599
- }
1600
- function peg$computeLocation(startPos, endPos) {
1601
- var startPosDetails = peg$computePosDetails(startPos);
1602
- var endPosDetails = peg$computePosDetails(endPos);
1603
- return {
1604
- source: peg$source,
1605
- start: {
1606
- offset: startPos,
1607
- line: startPosDetails.line,
1608
- column: startPosDetails.column
1609
- },
1610
- end: {
1611
- offset: endPos,
1612
- line: endPosDetails.line,
1613
- column: endPosDetails.column
1614
- }
1615
- };
1616
- }
1617
- function peg$fail(expected2) {
1618
- if (peg$currPos < peg$maxFailPos) {
1619
- return;
1620
- }
1621
- if (peg$currPos > peg$maxFailPos) {
1622
- peg$maxFailPos = peg$currPos;
1623
- peg$maxFailExpected = [];
1624
- }
1625
- peg$maxFailExpected.push(expected2);
1626
- }
1627
- function peg$buildSimpleError(message, location2) {
1628
- return new peg$SyntaxError(message, null, null, location2);
1629
- }
1630
- function peg$buildStructuredError(expected2, found, location2) {
1631
- return new peg$SyntaxError(
1632
- peg$SyntaxError.buildMessage(expected2, found),
1633
- expected2,
1634
- found,
1635
- location2
1636
- );
1637
- }
1638
- function peg$parseJungle() {
1639
- var s0, s1, s2, s3, s4;
1640
- s0 = peg$currPos;
1641
- s1 = [];
1642
- s2 = peg$currPos;
1643
- s3 = peg$parse__();
1644
- s4 = peg$parseAssignment();
1645
- if (s4 !== peg$FAILED) {
1646
- s2 = s4;
1647
- } else {
1648
- peg$currPos = s2;
1649
- s2 = peg$FAILED;
1650
- }
1651
- while (s2 !== peg$FAILED) {
1652
- s1.push(s2);
1653
- s2 = peg$currPos;
1654
- s3 = peg$parse__();
1655
- s4 = peg$parseAssignment();
1656
- if (s4 !== peg$FAILED) {
1657
- s2 = s4;
1658
- } else {
1659
- peg$currPos = s2;
1660
- s2 = peg$FAILED;
1661
- }
1662
- }
1663
- s2 = peg$parse__();
1664
- s3 = peg$currPos;
1665
- peg$silentFails++;
1666
- if (input.length > peg$currPos) {
1667
- s4 = input.charAt(peg$currPos);
1668
- peg$currPos++;
1669
- } else {
1670
- s4 = peg$FAILED;
1671
- if (peg$silentFails === 0) {
1672
- peg$fail(peg$e0);
1673
- }
1674
- }
1675
- peg$silentFails--;
1676
- if (s4 === peg$FAILED) {
1677
- s3 = void 0;
1678
- } else {
1679
- peg$currPos = s3;
1680
- s3 = peg$FAILED;
1681
- }
1682
- if (s3 !== peg$FAILED) {
1683
- s0 = s1;
1684
- } else {
1685
- peg$currPos = s0;
1686
- s0 = peg$FAILED;
1687
- }
1688
- return s0;
1689
- }
1690
- function peg$parseAssignment() {
1691
- var s0, s1, s2, s3, s4, s5, s6;
1692
- s0 = peg$currPos;
1693
- s1 = peg$parseQualifiedName();
1694
- if (s1 !== peg$FAILED) {
1695
- s2 = peg$parse__();
1696
- if (input.charCodeAt(peg$currPos) === 61) {
1697
- s3 = peg$c0;
1698
- peg$currPos++;
1699
- } else {
1700
- s3 = peg$FAILED;
1701
- if (peg$silentFails === 0) {
1702
- peg$fail(peg$e1);
1703
- }
1704
- }
1705
- if (s3 !== peg$FAILED) {
1706
- s4 = peg$parse__();
1707
- s5 = peg$parseValueList();
1708
- if (s5 !== peg$FAILED) {
1709
- s6 = peg$parse__();
1710
- peg$savedPos = s0;
1711
- s0 = peg$f0(s1, s5);
1712
- } else {
1713
- peg$currPos = s0;
1714
- s0 = peg$FAILED;
1715
- }
1716
- } else {
1717
- peg$currPos = s0;
1718
- s0 = peg$FAILED;
1719
- }
1720
- } else {
1721
- peg$currPos = s0;
1722
- s0 = peg$FAILED;
1723
- }
1724
- return s0;
1725
- }
1726
- function peg$parseQualifiedName() {
1727
- var s0, s1, s2, s3, s4, s5, s6, s7;
1728
- s0 = peg$currPos;
1729
- s1 = peg$parseIdentifierName();
1730
- if (s1 !== peg$FAILED) {
1731
- s2 = [];
1732
- s3 = peg$currPos;
1733
- s4 = peg$parse_();
1734
- if (input.charCodeAt(peg$currPos) === 46) {
1735
- s5 = peg$c1;
1736
- peg$currPos++;
1737
- } else {
1738
- s5 = peg$FAILED;
1739
- if (peg$silentFails === 0) {
1740
- peg$fail(peg$e2);
1741
- }
1742
- }
1743
- if (s5 !== peg$FAILED) {
1744
- s6 = peg$parse_();
1745
- s7 = peg$parseIdentifierName();
1746
- if (s7 !== peg$FAILED) {
1747
- s3 = s7;
1748
- } else {
1749
- peg$currPos = s3;
1750
- s3 = peg$FAILED;
1751
- }
1752
- } else {
1753
- peg$currPos = s3;
1754
- s3 = peg$FAILED;
1755
- }
1756
- while (s3 !== peg$FAILED) {
1757
- s2.push(s3);
1758
- s3 = peg$currPos;
1759
- s4 = peg$parse_();
1760
- if (input.charCodeAt(peg$currPos) === 46) {
1761
- s5 = peg$c1;
1762
- peg$currPos++;
1763
- } else {
1764
- s5 = peg$FAILED;
1765
- if (peg$silentFails === 0) {
1766
- peg$fail(peg$e2);
1767
- }
1768
- }
1769
- if (s5 !== peg$FAILED) {
1770
- s6 = peg$parse_();
1771
- s7 = peg$parseIdentifierName();
1772
- if (s7 !== peg$FAILED) {
1773
- s3 = s7;
1774
- } else {
1775
- peg$currPos = s3;
1776
- s3 = peg$FAILED;
1777
- }
1778
- } else {
1779
- peg$currPos = s3;
1780
- s3 = peg$FAILED;
1781
- }
1782
- }
1783
- peg$savedPos = s0;
1784
- s0 = peg$f1(s1, s2);
1785
- } else {
1786
- peg$currPos = s0;
1787
- s0 = peg$FAILED;
1788
- }
1789
- return s0;
1790
- }
1791
- function peg$parseValueList() {
1792
- var s0, s1, s2, s3, s4, s5, s6, s7;
1793
- s0 = peg$currPos;
1794
- s1 = peg$parseValue();
1795
- if (s1 !== peg$FAILED) {
1796
- s2 = [];
1797
- s3 = peg$currPos;
1798
- s4 = peg$parse_();
1799
- if (input.charCodeAt(peg$currPos) === 59) {
1800
- s5 = peg$c2;
1801
- peg$currPos++;
1802
- } else {
1803
- s5 = peg$FAILED;
1804
- if (peg$silentFails === 0) {
1805
- peg$fail(peg$e3);
1806
- }
1807
- }
1808
- if (s5 !== peg$FAILED) {
1809
- s6 = peg$parse_();
1810
- s7 = peg$parseValue();
1811
- if (s7 !== peg$FAILED) {
1812
- s3 = s7;
1813
- } else {
1814
- peg$currPos = s3;
1815
- s3 = peg$FAILED;
1816
- }
1817
- } else {
1818
- peg$currPos = s3;
1819
- s3 = peg$FAILED;
1820
- }
1821
- while (s3 !== peg$FAILED) {
1822
- s2.push(s3);
1823
- s3 = peg$currPos;
1824
- s4 = peg$parse_();
1825
- if (input.charCodeAt(peg$currPos) === 59) {
1826
- s5 = peg$c2;
1827
- peg$currPos++;
1828
- } else {
1829
- s5 = peg$FAILED;
1830
- if (peg$silentFails === 0) {
1831
- peg$fail(peg$e3);
1832
- }
1833
- }
1834
- if (s5 !== peg$FAILED) {
1835
- s6 = peg$parse_();
1836
- s7 = peg$parseValue();
1837
- if (s7 !== peg$FAILED) {
1838
- s3 = s7;
1839
- } else {
1840
- peg$currPos = s3;
1841
- s3 = peg$FAILED;
1842
- }
1843
- } else {
1844
- peg$currPos = s3;
1845
- s3 = peg$FAILED;
1846
- }
1847
- }
1848
- peg$savedPos = s0;
1849
- s0 = peg$f2(s1, s2);
1850
- } else {
1851
- peg$currPos = s0;
1852
- s0 = peg$FAILED;
1853
- }
1854
- return s0;
1855
- }
1856
- function peg$parseValue() {
1857
- var s0, s1, s2, s3;
1858
- s0 = peg$currPos;
1859
- if (input.substr(peg$currPos, 2) === peg$c3) {
1860
- s1 = peg$c3;
1861
- peg$currPos += 2;
1862
- } else {
1863
- s1 = peg$FAILED;
1864
- if (peg$silentFails === 0) {
1865
- peg$fail(peg$e4);
1866
- }
1867
- }
1868
- if (s1 !== peg$FAILED) {
1869
- s2 = peg$parseQualifiedName();
1870
- if (s2 !== peg$FAILED) {
1871
- if (input.charCodeAt(peg$currPos) === 41) {
1872
- s3 = peg$c4;
1873
- peg$currPos++;
1874
- } else {
1875
- s3 = peg$FAILED;
1876
- if (peg$silentFails === 0) {
1877
- peg$fail(peg$e5);
1878
- }
1879
- }
1880
- if (s3 !== peg$FAILED) {
1881
- s0 = s2;
1882
- } else {
1883
- peg$currPos = s0;
1884
- s0 = peg$FAILED;
1885
- }
1886
- } else {
1887
- peg$currPos = s0;
1888
- s0 = peg$FAILED;
1889
- }
1890
- } else {
1891
- peg$currPos = s0;
1892
- s0 = peg$FAILED;
1893
- }
1894
- if (s0 === peg$FAILED) {
1895
- s0 = peg$parseRawValue();
1896
- if (s0 === peg$FAILED) {
1897
- s0 = peg$parseStringValue();
1898
- if (s0 === peg$FAILED) {
1899
- s0 = peg$parseSubList();
1900
- }
1901
- }
1902
- }
1903
- return s0;
1904
- }
1905
- function peg$parseRawValue() {
1906
- var s0, s1, s2, s3, s4, s5;
1907
- peg$silentFails++;
1908
- s0 = peg$currPos;
1909
- s1 = peg$parseRawPart();
1910
- if (s1 !== peg$FAILED) {
1911
- s2 = [];
1912
- s3 = peg$currPos;
1913
- s4 = peg$parse_();
1914
- s5 = peg$parseRawPart();
1915
- if (s5 !== peg$FAILED) {
1916
- s3 = s5;
1917
- } else {
1918
- peg$currPos = s3;
1919
- s3 = peg$FAILED;
1920
- }
1921
- while (s3 !== peg$FAILED) {
1922
- s2.push(s3);
1923
- s3 = peg$currPos;
1924
- s4 = peg$parse_();
1925
- s5 = peg$parseRawPart();
1926
- if (s5 !== peg$FAILED) {
1927
- s3 = s5;
1928
- } else {
1929
- peg$currPos = s3;
1930
- s3 = peg$FAILED;
1931
- }
1932
- }
1933
- peg$savedPos = s0;
1934
- s0 = peg$f3(s1, s2);
1935
- } else {
1936
- peg$currPos = s0;
1937
- s0 = peg$FAILED;
1938
- }
1939
- peg$silentFails--;
1940
- if (s0 === peg$FAILED) {
1941
- s1 = peg$FAILED;
1942
- if (peg$silentFails === 0) {
1943
- peg$fail(peg$e6);
1944
- }
1945
- }
1946
- return s0;
1947
- }
1948
- function peg$parseStringValue() {
1949
- var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
1950
- peg$silentFails++;
1951
- s0 = peg$currPos;
1952
- if (input.charCodeAt(peg$currPos) === 34) {
1953
- s1 = peg$c5;
1954
- peg$currPos++;
1955
- } else {
1956
- s1 = peg$FAILED;
1957
- if (peg$silentFails === 0) {
1958
- peg$fail(peg$e8);
1959
- }
1960
- }
1961
- if (s1 !== peg$FAILED) {
1962
- s2 = peg$currPos;
1963
- s3 = peg$currPos;
1964
- s4 = [];
1965
- s5 = peg$parseRawPart();
1966
- if (s5 !== peg$FAILED) {
1967
- while (s5 !== peg$FAILED) {
1968
- s4.push(s5);
1969
- s5 = peg$parseRawPart();
1970
- }
1971
- } else {
1972
- s4 = peg$FAILED;
1973
- }
1974
- if (s4 !== peg$FAILED) {
1975
- s5 = [];
1976
- s6 = peg$currPos;
1977
- s7 = [];
1978
- s8 = peg$parseWhiteSpace();
1979
- if (s8 !== peg$FAILED) {
1980
- while (s8 !== peg$FAILED) {
1981
- s7.push(s8);
1982
- s8 = peg$parseWhiteSpace();
1983
- }
1984
- } else {
1985
- s7 = peg$FAILED;
1986
- }
1987
- if (s7 !== peg$FAILED) {
1988
- s8 = [];
1989
- s9 = peg$parseRawPart();
1990
- if (s9 !== peg$FAILED) {
1991
- while (s9 !== peg$FAILED) {
1992
- s8.push(s9);
1993
- s9 = peg$parseRawPart();
1994
- }
1995
- } else {
1996
- s8 = peg$FAILED;
1997
- }
1998
- if (s8 !== peg$FAILED) {
1999
- s7 = [s7, s8];
2000
- s6 = s7;
2001
- } else {
2002
- peg$currPos = s6;
2003
- s6 = peg$FAILED;
2004
- }
2005
- } else {
2006
- peg$currPos = s6;
2007
- s6 = peg$FAILED;
2008
- }
2009
- while (s6 !== peg$FAILED) {
2010
- s5.push(s6);
2011
- s6 = peg$currPos;
2012
- s7 = [];
2013
- s8 = peg$parseWhiteSpace();
2014
- if (s8 !== peg$FAILED) {
2015
- while (s8 !== peg$FAILED) {
2016
- s7.push(s8);
2017
- s8 = peg$parseWhiteSpace();
2018
- }
2019
- } else {
2020
- s7 = peg$FAILED;
2021
- }
2022
- if (s7 !== peg$FAILED) {
2023
- s8 = [];
2024
- s9 = peg$parseRawPart();
2025
- if (s9 !== peg$FAILED) {
2026
- while (s9 !== peg$FAILED) {
2027
- s8.push(s9);
2028
- s9 = peg$parseRawPart();
2029
- }
2030
- } else {
2031
- s8 = peg$FAILED;
2032
- }
2033
- if (s8 !== peg$FAILED) {
2034
- s7 = [s7, s8];
2035
- s6 = s7;
2036
- } else {
2037
- peg$currPos = s6;
2038
- s6 = peg$FAILED;
2039
- }
2040
- } else {
2041
- peg$currPos = s6;
2042
- s6 = peg$FAILED;
2043
- }
2044
- }
2045
- s6 = [];
2046
- s7 = peg$parseWhiteSpace();
2047
- while (s7 !== peg$FAILED) {
2048
- s6.push(s7);
2049
- s7 = peg$parseWhiteSpace();
2050
- }
2051
- s4 = [s4, s5, s6];
2052
- s3 = s4;
2053
- } else {
2054
- peg$currPos = s3;
2055
- s3 = peg$FAILED;
2056
- }
2057
- if (s3 !== peg$FAILED) {
2058
- s2 = input.substring(s2, peg$currPos);
2059
- } else {
2060
- s2 = s3;
2061
- }
2062
- if (s2 !== peg$FAILED) {
2063
- if (input.charCodeAt(peg$currPos) === 34) {
2064
- s3 = peg$c5;
2065
- peg$currPos++;
2066
- } else {
2067
- s3 = peg$FAILED;
2068
- if (peg$silentFails === 0) {
2069
- peg$fail(peg$e8);
2070
- }
2071
- }
2072
- if (s3 !== peg$FAILED) {
2073
- peg$savedPos = s0;
2074
- s0 = peg$f4(s2);
2075
- } else {
2076
- peg$currPos = s0;
2077
- s0 = peg$FAILED;
2078
- }
2079
- } else {
2080
- peg$currPos = s0;
2081
- s0 = peg$FAILED;
2082
- }
2083
- } else {
2084
- peg$currPos = s0;
2085
- s0 = peg$FAILED;
2086
- }
2087
- peg$silentFails--;
2088
- if (s0 === peg$FAILED) {
2089
- s1 = peg$FAILED;
2090
- if (peg$silentFails === 0) {
2091
- peg$fail(peg$e7);
2092
- }
2093
- }
2094
- return s0;
2095
- }
2096
- function peg$parseSubList() {
2097
- var s0, s1, s2, s3;
2098
- s0 = peg$currPos;
2099
- if (input.charCodeAt(peg$currPos) === 91) {
2100
- s1 = peg$c6;
2101
- peg$currPos++;
2102
- } else {
2103
- s1 = peg$FAILED;
2104
- if (peg$silentFails === 0) {
2105
- peg$fail(peg$e9);
2106
- }
2107
- }
2108
- if (s1 !== peg$FAILED) {
2109
- s2 = peg$parseValueList();
2110
- if (s2 !== peg$FAILED) {
2111
- if (input.charCodeAt(peg$currPos) === 93) {
2112
- s3 = peg$c7;
2113
- peg$currPos++;
2114
- } else {
2115
- s3 = peg$FAILED;
2116
- if (peg$silentFails === 0) {
2117
- peg$fail(peg$e10);
2118
- }
2119
- }
2120
- if (s3 !== peg$FAILED) {
2121
- peg$savedPos = s0;
2122
- s0 = peg$f5(s2);
2123
- } else {
2124
- peg$currPos = s0;
2125
- s0 = peg$FAILED;
2126
- }
2127
- } else {
2128
- peg$currPos = s0;
2129
- s0 = peg$FAILED;
2130
- }
2131
- } else {
2132
- peg$currPos = s0;
2133
- s0 = peg$FAILED;
2134
- }
2135
- return s0;
2136
- }
2137
- function peg$parse__() {
2138
- var s0, s1;
2139
- s0 = [];
2140
- s1 = peg$parseWhiteSpace();
2141
- if (s1 === peg$FAILED) {
2142
- s1 = peg$parseLineTerminatorSequence();
2143
- if (s1 === peg$FAILED) {
2144
- s1 = peg$parseComment();
2145
- }
2146
- }
2147
- while (s1 !== peg$FAILED) {
2148
- s0.push(s1);
2149
- s1 = peg$parseWhiteSpace();
2150
- if (s1 === peg$FAILED) {
2151
- s1 = peg$parseLineTerminatorSequence();
2152
- if (s1 === peg$FAILED) {
2153
- s1 = peg$parseComment();
2154
- }
2155
- }
2156
- }
2157
- return s0;
2158
- }
2159
- function peg$parse_() {
2160
- var s0, s1, s2, s3;
2161
- s0 = [];
2162
- if (input.charCodeAt(peg$currPos) === 32) {
2163
- s1 = peg$c8;
2164
- peg$currPos++;
2165
- } else {
2166
- s1 = peg$FAILED;
2167
- if (peg$silentFails === 0) {
2168
- peg$fail(peg$e11);
2169
- }
2170
- }
2171
- if (s1 === peg$FAILED) {
2172
- if (input.charCodeAt(peg$currPos) === 9) {
2173
- s1 = peg$c9;
2174
- peg$currPos++;
2175
- } else {
2176
- s1 = peg$FAILED;
2177
- if (peg$silentFails === 0) {
2178
- peg$fail(peg$e12);
2179
- }
2180
- }
2181
- if (s1 === peg$FAILED) {
2182
- s1 = peg$currPos;
2183
- if (input.charCodeAt(peg$currPos) === 92) {
2184
- s2 = peg$c10;
2185
- peg$currPos++;
2186
- } else {
2187
- s2 = peg$FAILED;
2188
- if (peg$silentFails === 0) {
2189
- peg$fail(peg$e13);
2190
- }
2191
- }
2192
- if (s2 !== peg$FAILED) {
2193
- s3 = peg$parseLineTerminatorSequence();
2194
- if (s3 !== peg$FAILED) {
2195
- s2 = [s2, s3];
2196
- s1 = s2;
2197
- } else {
2198
- peg$currPos = s1;
2199
- s1 = peg$FAILED;
2200
- }
2201
- } else {
2202
- peg$currPos = s1;
2203
- s1 = peg$FAILED;
2204
- }
2205
- if (s1 === peg$FAILED) {
2206
- s1 = peg$parseComment();
2207
- }
2208
- }
2209
- }
2210
- while (s1 !== peg$FAILED) {
2211
- s0.push(s1);
2212
- if (input.charCodeAt(peg$currPos) === 32) {
2213
- s1 = peg$c8;
2214
- peg$currPos++;
2215
- } else {
2216
- s1 = peg$FAILED;
2217
- if (peg$silentFails === 0) {
2218
- peg$fail(peg$e11);
2219
- }
2220
- }
2221
- if (s1 === peg$FAILED) {
2222
- if (input.charCodeAt(peg$currPos) === 9) {
2223
- s1 = peg$c9;
2224
- peg$currPos++;
2225
- } else {
2226
- s1 = peg$FAILED;
2227
- if (peg$silentFails === 0) {
2228
- peg$fail(peg$e12);
2229
- }
2230
- }
2231
- if (s1 === peg$FAILED) {
2232
- s1 = peg$currPos;
2233
- if (input.charCodeAt(peg$currPos) === 92) {
2234
- s2 = peg$c10;
2235
- peg$currPos++;
2236
- } else {
2237
- s2 = peg$FAILED;
2238
- if (peg$silentFails === 0) {
2239
- peg$fail(peg$e13);
2240
- }
2241
- }
2242
- if (s2 !== peg$FAILED) {
2243
- s3 = peg$parseLineTerminatorSequence();
2244
- if (s3 !== peg$FAILED) {
2245
- s2 = [s2, s3];
2246
- s1 = s2;
2247
- } else {
2248
- peg$currPos = s1;
2249
- s1 = peg$FAILED;
2250
- }
2251
- } else {
2252
- peg$currPos = s1;
2253
- s1 = peg$FAILED;
2254
- }
2255
- if (s1 === peg$FAILED) {
2256
- s1 = peg$parseComment();
2257
- }
2258
- }
2259
- }
2260
- }
2261
- return s0;
2262
- }
2263
- function peg$parseIdentifierName() {
2264
- var s0, s1, s2, s3;
2265
- peg$silentFails++;
2266
- s0 = peg$currPos;
2267
- s1 = peg$parseIdentifierStart();
2268
- if (s1 !== peg$FAILED) {
2269
- s2 = [];
2270
- s3 = peg$parseIdentifierPart();
2271
- while (s3 !== peg$FAILED) {
2272
- s2.push(s3);
2273
- s3 = peg$parseIdentifierPart();
2274
- }
2275
- peg$savedPos = s0;
2276
- s0 = peg$f6(s1, s2);
2277
- } else {
2278
- peg$currPos = s0;
2279
- s0 = peg$FAILED;
2280
- }
2281
- peg$silentFails--;
2282
- if (s0 === peg$FAILED) {
2283
- s1 = peg$FAILED;
2284
- if (peg$silentFails === 0) {
2285
- peg$fail(peg$e14);
2286
- }
2287
- }
2288
- return s0;
2289
- }
2290
- function peg$parseIdentifierStart() {
2291
- var s0;
2292
- s0 = peg$parseUnicodeLetter();
2293
- if (s0 === peg$FAILED) {
2294
- if (input.charCodeAt(peg$currPos) === 95) {
2295
- s0 = peg$c11;
2296
- peg$currPos++;
2297
- } else {
2298
- s0 = peg$FAILED;
2299
- if (peg$silentFails === 0) {
2300
- peg$fail(peg$e15);
2301
- }
2302
- }
2303
- }
2304
- return s0;
2305
- }
2306
- function peg$parseIdentifierPart() {
2307
- var s0;
2308
- s0 = peg$parseIdentifierStart();
2309
- if (s0 === peg$FAILED) {
2310
- s0 = peg$parseUnicodeCombiningMark();
2311
- if (s0 === peg$FAILED) {
2312
- s0 = peg$parseNd();
2313
- if (s0 === peg$FAILED) {
2314
- s0 = peg$parsePc();
2315
- if (s0 === peg$FAILED) {
2316
- if (input.charCodeAt(peg$currPos) === 36) {
2317
- s0 = peg$c12;
2318
- peg$currPos++;
2319
- } else {
2320
- s0 = peg$FAILED;
2321
- if (peg$silentFails === 0) {
2322
- peg$fail(peg$e16);
2323
- }
2324
- }
2325
- if (s0 === peg$FAILED) {
2326
- if (input.charCodeAt(peg$currPos) === 45) {
2327
- s0 = peg$c13;
2328
- peg$currPos++;
2329
- } else {
2330
- s0 = peg$FAILED;
2331
- if (peg$silentFails === 0) {
2332
- peg$fail(peg$e17);
2333
- }
2334
- }
2335
- if (s0 === peg$FAILED) {
2336
- if (input.charCodeAt(peg$currPos) === 8204) {
2337
- s0 = peg$c14;
2338
- peg$currPos++;
2339
- } else {
2340
- s0 = peg$FAILED;
2341
- if (peg$silentFails === 0) {
2342
- peg$fail(peg$e18);
2343
- }
2344
- }
2345
- if (s0 === peg$FAILED) {
2346
- if (input.charCodeAt(peg$currPos) === 8205) {
2347
- s0 = peg$c15;
2348
- peg$currPos++;
2349
- } else {
2350
- s0 = peg$FAILED;
2351
- if (peg$silentFails === 0) {
2352
- peg$fail(peg$e19);
2353
- }
2354
- }
2355
- }
2356
- }
2357
- }
2358
- }
2359
- }
2360
- }
2361
- }
2362
- return s0;
2363
- }
2364
- function peg$parseRawPart() {
2365
- var s0, s1;
2366
- s0 = peg$parseIdentifierPart();
2367
- if (s0 === peg$FAILED) {
2368
- if (input.charCodeAt(peg$currPos) === 46) {
2369
- s0 = peg$c1;
2370
- peg$currPos++;
2371
- } else {
2372
- s0 = peg$FAILED;
2373
- if (peg$silentFails === 0) {
2374
- peg$fail(peg$e2);
2375
- }
2376
- }
2377
- if (s0 === peg$FAILED) {
2378
- if (input.charCodeAt(peg$currPos) === 47) {
2379
- s0 = peg$c16;
2380
- peg$currPos++;
2381
- } else {
2382
- s0 = peg$FAILED;
2383
- if (peg$silentFails === 0) {
2384
- peg$fail(peg$e20);
2385
- }
2386
- }
2387
- if (s0 === peg$FAILED) {
2388
- if (input.charCodeAt(peg$currPos) === 42) {
2389
- s0 = peg$c17;
2390
- peg$currPos++;
2391
- } else {
2392
- s0 = peg$FAILED;
2393
- if (peg$silentFails === 0) {
2394
- peg$fail(peg$e21);
2395
- }
2396
- }
2397
- if (s0 === peg$FAILED) {
2398
- s0 = peg$currPos;
2399
- if (input.charCodeAt(peg$currPos) === 92) {
2400
- s1 = peg$c10;
2401
- peg$currPos++;
2402
- } else {
2403
- s1 = peg$FAILED;
2404
- if (peg$silentFails === 0) {
2405
- peg$fail(peg$e13);
2406
- }
2407
- }
2408
- if (s1 !== peg$FAILED) {
2409
- peg$savedPos = s0;
2410
- s1 = peg$f7();
2411
- }
2412
- s0 = s1;
2413
- }
2414
- }
2415
- }
2416
- }
2417
- return s0;
2418
- }
2419
- function peg$parseUnicodeLetter() {
2420
- var s0;
2421
- s0 = peg$parseLu();
2422
- if (s0 === peg$FAILED) {
2423
- s0 = peg$parseLl();
2424
- if (s0 === peg$FAILED) {
2425
- s0 = peg$parseLt();
2426
- if (s0 === peg$FAILED) {
2427
- s0 = peg$parseLm();
2428
- if (s0 === peg$FAILED) {
2429
- s0 = peg$parseLo();
2430
- if (s0 === peg$FAILED) {
2431
- s0 = peg$parseNl();
2432
- }
2433
- }
2434
- }
2435
- }
2436
- }
2437
- return s0;
2438
- }
2439
- function peg$parseUnicodeCombiningMark() {
2440
- var s0;
2441
- s0 = peg$parseMn();
2442
- if (s0 === peg$FAILED) {
2443
- s0 = peg$parseMc();
2444
- }
2445
- return s0;
2446
- }
2447
- function peg$parseSourceCharacter() {
2448
- var s0;
2449
- if (input.length > peg$currPos) {
2450
- s0 = input.charAt(peg$currPos);
2451
- peg$currPos++;
2452
- } else {
2453
- s0 = peg$FAILED;
2454
- if (peg$silentFails === 0) {
2455
- peg$fail(peg$e0);
2456
- }
2457
- }
2458
- return s0;
2459
- }
2460
- function peg$parseWhiteSpace() {
2461
- var s0, s1;
2462
- peg$silentFails++;
2463
- if (input.charCodeAt(peg$currPos) === 9) {
2464
- s0 = peg$c9;
2465
- peg$currPos++;
2466
- } else {
2467
- s0 = peg$FAILED;
2468
- if (peg$silentFails === 0) {
2469
- peg$fail(peg$e12);
2470
- }
2471
- }
2472
- if (s0 === peg$FAILED) {
2473
- if (input.charCodeAt(peg$currPos) === 11) {
2474
- s0 = peg$c18;
2475
- peg$currPos++;
2476
- } else {
2477
- s0 = peg$FAILED;
2478
- if (peg$silentFails === 0) {
2479
- peg$fail(peg$e23);
2480
- }
2481
- }
2482
- if (s0 === peg$FAILED) {
2483
- if (input.charCodeAt(peg$currPos) === 12) {
2484
- s0 = peg$c19;
2485
- peg$currPos++;
2486
- } else {
2487
- s0 = peg$FAILED;
2488
- if (peg$silentFails === 0) {
2489
- peg$fail(peg$e24);
2490
- }
2491
- }
2492
- if (s0 === peg$FAILED) {
2493
- if (input.charCodeAt(peg$currPos) === 32) {
2494
- s0 = peg$c8;
2495
- peg$currPos++;
2496
- } else {
2497
- s0 = peg$FAILED;
2498
- if (peg$silentFails === 0) {
2499
- peg$fail(peg$e11);
2500
- }
2501
- }
2502
- if (s0 === peg$FAILED) {
2503
- if (input.charCodeAt(peg$currPos) === 160) {
2504
- s0 = peg$c20;
2505
- peg$currPos++;
2506
- } else {
2507
- s0 = peg$FAILED;
2508
- if (peg$silentFails === 0) {
2509
- peg$fail(peg$e25);
2510
- }
2511
- }
2512
- if (s0 === peg$FAILED) {
2513
- if (input.charCodeAt(peg$currPos) === 65279) {
2514
- s0 = peg$c21;
2515
- peg$currPos++;
2516
- } else {
2517
- s0 = peg$FAILED;
2518
- if (peg$silentFails === 0) {
2519
- peg$fail(peg$e26);
2520
- }
2521
- }
2522
- if (s0 === peg$FAILED) {
2523
- s0 = peg$parseZs();
2524
- }
2525
- }
2526
- }
2527
- }
2528
- }
2529
- }
2530
- peg$silentFails--;
2531
- if (s0 === peg$FAILED) {
2532
- s1 = peg$FAILED;
2533
- if (peg$silentFails === 0) {
2534
- peg$fail(peg$e22);
2535
- }
2536
- }
2537
- return s0;
2538
- }
2539
- function peg$parseLineTerminator() {
2540
- var s0;
2541
- if (peg$r0.test(input.charAt(peg$currPos))) {
2542
- s0 = input.charAt(peg$currPos);
2543
- peg$currPos++;
2544
- } else {
2545
- s0 = peg$FAILED;
2546
- if (peg$silentFails === 0) {
2547
- peg$fail(peg$e27);
2548
- }
2549
- }
2550
- return s0;
2551
- }
2552
- function peg$parseLineTerminatorSequence() {
2553
- var s0, s1;
2554
- peg$silentFails++;
2555
- if (input.charCodeAt(peg$currPos) === 10) {
2556
- s0 = peg$c22;
2557
- peg$currPos++;
2558
- } else {
2559
- s0 = peg$FAILED;
2560
- if (peg$silentFails === 0) {
2561
- peg$fail(peg$e29);
2562
- }
2563
- }
2564
- if (s0 === peg$FAILED) {
2565
- if (input.substr(peg$currPos, 2) === peg$c23) {
2566
- s0 = peg$c23;
2567
- peg$currPos += 2;
2568
- } else {
2569
- s0 = peg$FAILED;
2570
- if (peg$silentFails === 0) {
2571
- peg$fail(peg$e30);
2572
- }
2573
- }
2574
- if (s0 === peg$FAILED) {
2575
- if (input.charCodeAt(peg$currPos) === 13) {
2576
- s0 = peg$c24;
2577
- peg$currPos++;
2578
- } else {
2579
- s0 = peg$FAILED;
2580
- if (peg$silentFails === 0) {
2581
- peg$fail(peg$e31);
2582
- }
2583
- }
2584
- if (s0 === peg$FAILED) {
2585
- if (input.charCodeAt(peg$currPos) === 8232) {
2586
- s0 = peg$c25;
2587
- peg$currPos++;
2588
- } else {
2589
- s0 = peg$FAILED;
2590
- if (peg$silentFails === 0) {
2591
- peg$fail(peg$e32);
2592
- }
2593
- }
2594
- if (s0 === peg$FAILED) {
2595
- if (input.charCodeAt(peg$currPos) === 8233) {
2596
- s0 = peg$c26;
2597
- peg$currPos++;
2598
- } else {
2599
- s0 = peg$FAILED;
2600
- if (peg$silentFails === 0) {
2601
- peg$fail(peg$e33);
2602
- }
2603
- }
2604
- }
2605
- }
2606
- }
2607
- }
2608
- peg$silentFails--;
2609
- if (s0 === peg$FAILED) {
2610
- s1 = peg$FAILED;
2611
- if (peg$silentFails === 0) {
2612
- peg$fail(peg$e28);
2613
- }
2614
- }
2615
- return s0;
2616
- }
2617
- function peg$parseComment() {
2618
- var s0, s1, s2, s3, s4, s5;
2619
- peg$silentFails++;
2620
- s0 = peg$currPos;
2621
- if (input.charCodeAt(peg$currPos) === 35) {
2622
- s1 = peg$c27;
2623
- peg$currPos++;
2624
- } else {
2625
- s1 = peg$FAILED;
2626
- if (peg$silentFails === 0) {
2627
- peg$fail(peg$e35);
2628
- }
2629
- }
2630
- if (s1 !== peg$FAILED) {
2631
- s2 = [];
2632
- s3 = peg$currPos;
2633
- s4 = peg$currPos;
2634
- peg$silentFails++;
2635
- s5 = peg$parseLineTerminator();
2636
- peg$silentFails--;
2637
- if (s5 === peg$FAILED) {
2638
- s4 = void 0;
2639
- } else {
2640
- peg$currPos = s4;
2641
- s4 = peg$FAILED;
2642
- }
2643
- if (s4 !== peg$FAILED) {
2644
- s5 = peg$parseSourceCharacter();
2645
- if (s5 !== peg$FAILED) {
2646
- s4 = [s4, s5];
2647
- s3 = s4;
2648
- } else {
2649
- peg$currPos = s3;
2650
- s3 = peg$FAILED;
2651
- }
2652
- } else {
2653
- peg$currPos = s3;
2654
- s3 = peg$FAILED;
2655
- }
2656
- while (s3 !== peg$FAILED) {
2657
- s2.push(s3);
2658
- s3 = peg$currPos;
2659
- s4 = peg$currPos;
2660
- peg$silentFails++;
2661
- s5 = peg$parseLineTerminator();
2662
- peg$silentFails--;
2663
- if (s5 === peg$FAILED) {
2664
- s4 = void 0;
2665
- } else {
2666
- peg$currPos = s4;
2667
- s4 = peg$FAILED;
2668
- }
2669
- if (s4 !== peg$FAILED) {
2670
- s5 = peg$parseSourceCharacter();
2671
- if (s5 !== peg$FAILED) {
2672
- s4 = [s4, s5];
2673
- s3 = s4;
2674
- } else {
2675
- peg$currPos = s3;
2676
- s3 = peg$FAILED;
2677
- }
2678
- } else {
2679
- peg$currPos = s3;
2680
- s3 = peg$FAILED;
2681
- }
2682
- }
2683
- s1 = [s1, s2];
2684
- s0 = s1;
2685
- } else {
2686
- peg$currPos = s0;
2687
- s0 = peg$FAILED;
2688
- }
2689
- peg$silentFails--;
2690
- if (s0 === peg$FAILED) {
2691
- s1 = peg$FAILED;
2692
- if (peg$silentFails === 0) {
2693
- peg$fail(peg$e34);
2694
- }
2695
- }
2696
- return s0;
2697
- }
2698
- function peg$parseLl() {
2699
- var s0;
2700
- if (peg$r1.test(input.charAt(peg$currPos))) {
2701
- s0 = input.charAt(peg$currPos);
2702
- peg$currPos++;
2703
- } else {
2704
- s0 = peg$FAILED;
2705
- if (peg$silentFails === 0) {
2706
- peg$fail(peg$e36);
2707
- }
2708
- }
2709
- return s0;
2710
- }
2711
- function peg$parseLm() {
2712
- var s0;
2713
- if (peg$r2.test(input.charAt(peg$currPos))) {
2714
- s0 = input.charAt(peg$currPos);
2715
- peg$currPos++;
2716
- } else {
2717
- s0 = peg$FAILED;
2718
- if (peg$silentFails === 0) {
2719
- peg$fail(peg$e37);
2720
- }
2721
- }
2722
- return s0;
2723
- }
2724
- function peg$parseLo() {
2725
- var s0;
2726
- if (peg$r3.test(input.charAt(peg$currPos))) {
2727
- s0 = input.charAt(peg$currPos);
2728
- peg$currPos++;
2729
- } else {
2730
- s0 = peg$FAILED;
2731
- if (peg$silentFails === 0) {
2732
- peg$fail(peg$e38);
2733
- }
2734
- }
2735
- return s0;
2736
- }
2737
- function peg$parseLt() {
2738
- var s0;
2739
- if (peg$r4.test(input.charAt(peg$currPos))) {
2740
- s0 = input.charAt(peg$currPos);
2741
- peg$currPos++;
2742
- } else {
2743
- s0 = peg$FAILED;
2744
- if (peg$silentFails === 0) {
2745
- peg$fail(peg$e39);
2746
- }
2747
- }
2748
- return s0;
2749
- }
2750
- function peg$parseLu() {
2751
- var s0;
2752
- if (peg$r5.test(input.charAt(peg$currPos))) {
2753
- s0 = input.charAt(peg$currPos);
2754
- peg$currPos++;
2755
- } else {
2756
- s0 = peg$FAILED;
2757
- if (peg$silentFails === 0) {
2758
- peg$fail(peg$e40);
2759
- }
2760
- }
2761
- return s0;
2762
- }
2763
- function peg$parseMc() {
2764
- var s0;
2765
- if (peg$r6.test(input.charAt(peg$currPos))) {
2766
- s0 = input.charAt(peg$currPos);
2767
- peg$currPos++;
2768
- } else {
2769
- s0 = peg$FAILED;
2770
- if (peg$silentFails === 0) {
2771
- peg$fail(peg$e41);
2772
- }
2773
- }
2774
- return s0;
2775
- }
2776
- function peg$parseMn() {
2777
- var s0;
2778
- if (peg$r7.test(input.charAt(peg$currPos))) {
2779
- s0 = input.charAt(peg$currPos);
2780
- peg$currPos++;
2781
- } else {
2782
- s0 = peg$FAILED;
2783
- if (peg$silentFails === 0) {
2784
- peg$fail(peg$e42);
2785
- }
2786
- }
2787
- return s0;
2788
- }
2789
- function peg$parseNd() {
2790
- var s0;
2791
- if (peg$r8.test(input.charAt(peg$currPos))) {
2792
- s0 = input.charAt(peg$currPos);
2793
- peg$currPos++;
2794
- } else {
2795
- s0 = peg$FAILED;
2796
- if (peg$silentFails === 0) {
2797
- peg$fail(peg$e43);
2798
- }
2799
- }
2800
- return s0;
2801
- }
2802
- function peg$parseNl() {
2803
- var s0;
2804
- if (peg$r9.test(input.charAt(peg$currPos))) {
2805
- s0 = input.charAt(peg$currPos);
2806
- peg$currPos++;
2807
- } else {
2808
- s0 = peg$FAILED;
2809
- if (peg$silentFails === 0) {
2810
- peg$fail(peg$e44);
2811
- }
2812
- }
2813
- return s0;
2814
- }
2815
- function peg$parsePc() {
2816
- var s0;
2817
- if (peg$r10.test(input.charAt(peg$currPos))) {
2818
- s0 = input.charAt(peg$currPos);
2819
- peg$currPos++;
2820
- } else {
2821
- s0 = peg$FAILED;
2822
- if (peg$silentFails === 0) {
2823
- peg$fail(peg$e45);
2824
- }
2825
- }
2826
- return s0;
2827
- }
2828
- function peg$parseZs() {
2829
- var s0;
2830
- if (peg$r11.test(input.charAt(peg$currPos))) {
2831
- s0 = input.charAt(peg$currPos);
2832
- peg$currPos++;
2833
- } else {
2834
- s0 = peg$FAILED;
2835
- if (peg$silentFails === 0) {
2836
- peg$fail(peg$e46);
2837
- }
2838
- }
2839
- return s0;
2840
- }
2841
- function wrap(node) {
2842
- return { ...node, source: location().source };
2843
- }
2844
- peg$result = peg$startRuleFunction();
2845
- if (peg$result !== peg$FAILED && peg$currPos === input.length) {
2846
- return peg$result;
2847
- } else {
2848
- if (peg$result !== peg$FAILED && peg$currPos < input.length) {
2849
- peg$fail(peg$endExpectation());
2850
- }
2851
- throw peg$buildStructuredError(
2852
- peg$maxFailExpected,
2853
- peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
2854
- peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
2855
- );
2856
- }
2857
- }
2858
- var init_jungle = (0, import_chunk_IAUHYWVN.__esm)({
2859
- "src/jungle.peggy"() {
2860
- "use strict";
2861
- peg$subclass(peg$SyntaxError, Error);
2862
- peg$SyntaxError.prototype.format = function(sources) {
2863
- var str = "Error: " + this.message;
2864
- if (this.location) {
2865
- var src = null;
2866
- var k;
2867
- for (k = 0; k < sources.length; k++) {
2868
- if (sources[k].source === this.location.source) {
2869
- src = sources[k].text.split(/\r\n|\n|\r/g);
2870
- break;
2871
- }
2872
- }
2873
- var s = this.location.start;
2874
- var loc = this.location.source + ":" + s.line + ":" + s.column;
2875
- if (src) {
2876
- var e = this.location.end;
2877
- var filler = peg$padEnd("", s.line.toString().length, " ");
2878
- var line = src[s.line - 1];
2879
- var last = s.line === e.line ? e.column : line.length + 1;
2880
- var hatLen = last - s.column || 1;
2881
- str += "\n --> " + loc + "\n" + filler + " |\n" + s.line + " | " + line + "\n" + filler + " | " + peg$padEnd("", s.column - 1, " ") + peg$padEnd("", hatLen, "^");
2882
- } else {
2883
- str += "\n at " + loc;
2884
- }
2885
- }
2886
- return str;
2887
- };
2888
- peg$SyntaxError.buildMessage = function(expected, found) {
2889
- var DESCRIBE_EXPECTATION_FNS = {
2890
- literal: function(expectation) {
2891
- return '"' + literalEscape(expectation.text) + '"';
2892
- },
2893
- class: function(expectation) {
2894
- var escapedParts = expectation.parts.map(function(part) {
2895
- return Array.isArray(part) ? classEscape(part[0]) + "-" + classEscape(part[1]) : classEscape(part);
2896
- });
2897
- return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
2898
- },
2899
- any: function() {
2900
- return "any character";
2901
- },
2902
- end: function() {
2903
- return "end of input";
2904
- },
2905
- other: function(expectation) {
2906
- return expectation.description;
2907
- }
2908
- };
2909
- function hex(ch) {
2910
- return ch.charCodeAt(0).toString(16).toUpperCase();
2911
- }
2912
- function literalEscape(s) {
2913
- return s.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
2914
- return "\\x0" + hex(ch);
2915
- }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
2916
- return "\\x" + hex(ch);
2917
- });
2918
- }
2919
- function classEscape(s) {
2920
- return s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
2921
- return "\\x0" + hex(ch);
2922
- }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
2923
- return "\\x" + hex(ch);
2924
- });
2925
- }
2926
- function describeExpectation(expectation) {
2927
- return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
2928
- }
2929
- function describeExpected(expected2) {
2930
- var descriptions = expected2.map(describeExpectation);
2931
- var i, j;
2932
- descriptions.sort();
2933
- if (descriptions.length > 0) {
2934
- for (i = 1, j = 1; i < descriptions.length; i++) {
2935
- if (descriptions[i - 1] !== descriptions[i]) {
2936
- descriptions[j] = descriptions[i];
2937
- j++;
2938
- }
2939
- }
2940
- descriptions.length = j;
2941
- }
2942
- switch (descriptions.length) {
2943
- case 1:
2944
- return descriptions[0];
2945
- case 2:
2946
- return descriptions[0] + " or " + descriptions[1];
2947
- default:
2948
- return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
2949
- }
2950
- }
2951
- function describeFound(found2) {
2952
- return found2 ? '"' + literalEscape(found2) + '"' : "end of input";
2953
- }
2954
- return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
2955
- };
2956
- }
2957
- });
2958
- async function readManifest(manifest) {
2959
- const data = await fs.readFile(manifest);
2960
- return import_chunk_YCLY27QH.xml_util_exports.parseXml(data.toString(), manifest);
2961
- }
2962
- async function writeManifest(filename, xml) {
2963
- return fs.writeFile(filename, import_chunk_YCLY27QH.xml_util_exports.writeXml(xml));
2964
- }
2965
- function manifestProducts(manifest) {
2966
- if (manifest.body instanceof Error) {
2967
- throw manifest.body;
2968
- }
2969
- return manifest.body.children().filter((c) => c.name === "iq:application" || c.name === "iq:barrel").children("iq:products").children("iq:product").attrs().map((p) => p.id?.value.value).filter((p) => p != null).sort().filter((p, i, a) => !i || p !== a[i - 1]);
2970
- }
2971
- function manifestBarrels(manifest) {
2972
- if (manifest.body instanceof Error) {
2973
- throw manifest.body;
2974
- }
2975
- return manifest.body.children("iq:application").children("iq:barrels").children("iq:depends").attrs().map((p) => p.name?.value.value).filter((p) => p != null).sort().filter((p, i, a) => !i || p !== a[i - 1]);
2976
- }
2977
- function manifestDropBarrels(manifest) {
2978
- if (manifest.body instanceof Error) {
2979
- throw manifest.body;
2980
- }
2981
- manifest.body.children("iq:application").deleteChildren("iq:barrels");
2982
- }
2983
- function manifestBarrelName(manifestName, manifest) {
2984
- if (manifest.body instanceof Error) {
2985
- throw manifest.body;
2986
- }
2987
- const barrel = manifest.body.children("iq:barrel");
2988
- if (!barrel.elements.length) {
2989
- throw new import_chunk_YCLY27QH.xml_util_exports.PeggyError(
2990
- `Missing 'iq:barrel' in manifest`,
2991
- manifest.body.elements[0].loc
2992
- );
2993
- }
2994
- const modules = barrel.attrs().map((a) => a.module).filter((a) => a != null);
2995
- if (!modules.length) {
2996
- throw new import_chunk_YCLY27QH.xml_util_exports.PeggyError(
2997
- `Missing 'module' attribute in barrel manifest`,
2998
- barrel.elements[0].loc
2999
- );
3000
- }
3001
- if (modules.length !== 1) {
3002
- throw new import_chunk_YCLY27QH.xml_util_exports.PeggyError(
3003
- `Manifest defines multiple modules`,
3004
- modules[0].loc
3005
- );
3006
- }
3007
- return modules[0].value.value;
3008
- }
3009
- function manifestAnnotations(manifest) {
3010
- if (manifest.body instanceof Error) {
3011
- throw manifest.body;
3012
- }
3013
- return manifest.body.children("iq:barrel").children("iq:annotations").children("iq:annotation").text();
3014
- }
3015
- function manifestLanguages(manifest) {
3016
- if (manifest.body instanceof Error) {
3017
- throw manifest.body;
3018
- }
3019
- return manifest.body.children().filter((c) => c.name === "iq:application" || c.name === "iq:barrel").children("iq:languages").children("iq:language").text();
3020
- }
3021
- async function checkManifest(manifest, products) {
3022
- if (manifest.body instanceof Error) {
3023
- throw manifest.body;
3024
- }
3025
- let ok = true;
3026
- const mattrs = manifest.body.attrs();
3027
- if (mattrs.length !== 1 || mattrs[0]["xmlns:iq"]?.value.value !== "http://www.garmin.com/xml/connectiq") {
3028
- ok = false;
3029
- }
3030
- const app = manifest.body.children("iq:application");
3031
- if (!app.length())
3032
- return ok;
3033
- if (app.length() !== 1)
3034
- return false;
3035
- const attrs = app.attrs()[0];
3036
- const id = attrs.id?.value.value;
3037
- if (typeof id !== "string" || id.length < 32 || !/^[-_0-9a-f.]+$/.test(id)) {
3038
- ok = false;
3039
- attrs.id = import_chunk_YCLY27QH.xml_util_exports.makeAttribute(
3040
- "id",
3041
- "08070f9d-8b4e-40a4-9c49-fe67a2a55dec"
3042
- );
3043
- }
3044
- const type = attrs.type?.value.value.replace(/-/g, "").toLowerCase();
3045
- const deviceInfo = await (0, import_chunk_YCLY27QH.getDeviceInfo)();
3046
- const allowedProducts = products.sort().filter(
3047
- (p) => deviceInfo[p] && deviceInfo[p].appTypes.find((at) => {
3048
- const t = at.type.toLowerCase();
3049
- return t === type || `${t}app` === type || type === "widget" && t === "watchapp";
3050
- })
3051
- );
3052
- if (JSON.stringify(allowedProducts) !== JSON.stringify(manifestProducts(manifest))) {
3053
- ok = false;
3054
- const products2 = app.children("iq:products");
3055
- products2.deleteChildren("iq:product");
3056
- products2.addChildren(
3057
- allowedProducts.map((id2) => {
3058
- return {
3059
- type: "element",
3060
- name: "iq:product",
3061
- attr: {
3062
- id: import_chunk_YCLY27QH.xml_util_exports.makeAttribute("id", id2)
3063
- }
3064
- };
3065
- })
3066
- );
3067
- }
3068
- app.deleteChildren((c) => {
3069
- if ([
3070
- "iq:permissions",
3071
- "iq:languages",
3072
- "iq:products",
3073
- "iq:barrels",
3074
- "iq:trialMode"
3075
- ].includes(c.name)) {
3076
- return false;
3077
- }
3078
- ok = false;
3079
- return true;
3080
- });
3081
- return ok;
3082
- }
3083
- var init_manifest = (0, import_chunk_IAUHYWVN.__esm)({
3084
- "src/manifest.ts"() {
3085
- "use strict";
3086
- (0, import_chunk_YCLY27QH.init_sdk_util)();
3087
- }
3088
- });
3089
- function isJNode(obj) {
3090
- return (0, import_chunk_YCLY27QH.hasProperty)(obj, "type");
3091
- }
3092
- async function default_jungle() {
3093
- const assignments = [];
3094
- const devices = await (0, import_chunk_YCLY27QH.getDeviceInfo)();
3095
- const languages = await (0, import_chunk_YCLY27QH.getLanguages)();
3096
- const literal = (value) => ({ type: "Literal", value });
3097
- const qname = (name) => ({
3098
- type: "QualifiedName",
3099
- names: name.split(".")
3100
- });
3101
- const assign = (name, values) => assignments.push({ names: name.split("."), values });
3102
- const rassign = (name, values, base) => {
3103
- assign(name, base ? [qname(name)].concat(values) : values);
3104
- };
3105
- const rezAndLang = (id, rez, base = null) => {
3106
- if (base) {
3107
- assign(id, [qname(base)]);
3108
- }
3109
- rassign(`${id}.resourcePath`, [literal(rez)], base);
3110
- languages.forEach(
3111
- (l) => rassign(`${id}.lang.${l.id}`, [literal(`${rez}-${l.id}`)], base)
3112
- );
3113
- };
3114
- const done = {};
3115
- assign("base.sourcePath", [literal("./**.mc")]);
3116
- rezAndLang("base", "resources");
3117
- Object.entries(devices).forEach(([deviceId, { deviceFamily }]) => {
3118
- const match = deviceFamily.match(/^(\w+)-\d+x\d+/);
3119
- if (!match) {
3120
- throw new Error(
3121
- `Strange deviceFamily (${deviceFamily}) for device ${deviceId}`
3122
- );
3123
- }
3124
- const shape = match[1];
3125
- if (!(0, import_chunk_YCLY27QH.hasProperty)(done, shape)) {
3126
- rezAndLang(shape, `resources-${shape}`, "base");
3127
- done[shape] = true;
3128
- }
3129
- if (!(0, import_chunk_YCLY27QH.hasProperty)(done, deviceFamily)) {
3130
- rezAndLang(deviceFamily, `resources-${deviceFamily}`, shape);
3131
- done[deviceFamily] = true;
3132
- }
3133
- rezAndLang(deviceId, `resources-${deviceId}`, deviceFamily);
3134
- });
3135
- const state = await process_assignments(assignments, {});
3136
- return { state, devices };
3137
- }
3138
- function process_assignments(assignments, current) {
3139
- return assignments.reduce((state, a) => {
3140
- const { node, dot, dotnames } = a.names.reduce(
3141
- (r, name) => {
3142
- if (!(0, import_chunk_YCLY27QH.hasProperty)(r.node, name))
3143
- r.node[name] = {};
3144
- r.dotnames.push(name);
3145
- r.node = r.node[name];
3146
- if (r.node["."]) {
3147
- r.dot = r.node["."];
3148
- r.dotnames = [];
3149
- }
3150
- return r;
3151
- },
3152
- { node: state, dot: void 0, dotnames: [] }
3153
- );
3154
- Object.keys(node).forEach((k) => delete node[k]);
3155
- const process_list = (values) => {
3156
- for (let i = values.length; i--; ) {
3157
- const v = values[i];
3158
- if (v.type === "QualifiedName" && v.names.every((n, i2) => n === a.names[i2])) {
3159
- values.splice(
3160
- i,
3161
- 1,
3162
- ...dot ? dot.map(
3163
- (v2) => v2.type === "QualifiedName" ? { ...v2, names: v2.names.concat(dotnames) } : v2
3164
- ) : []
3165
- );
3166
- } else if (v.type === "SubList") {
3167
- process_list(v.values);
3168
- }
3169
- }
3170
- };
3171
- process_list(a.values);
3172
- if (a.names.length === 1 && a.values.length === 1 && a.values[0].type === "QualifiedName" && a.values[0].names.length === 1) {
3173
- const match = a.values[0].names[0].match(/^(\w+)-(\w+)$/);
3174
- if (match) {
3175
- const key = `${match[1]}_watch`;
3176
- if (!current[key])
3177
- current[key] = { products: [] };
3178
- current[key].products.push(
3179
- a.names[0]
3180
- );
3181
- }
3182
- }
3183
- node["."] = a.values;
3184
- return state;
3185
- }, current);
3186
- }
3187
- function evaluate_locals(assignments) {
3188
- const locals = {};
3189
- while (true) {
3190
- assignments = assignments.filter((a) => {
3191
- if (a.names.length === 1 && a.values.every((v) => typeof v === "string")) {
3192
- locals[a.names[0]] = a.values;
3193
- return false;
3194
- }
3195
- return true;
3196
- });
3197
- if (!Object.keys(locals).length)
3198
- break;
3199
- const process_list = (values) => {
3200
- for (let i = values.length; i--; ) {
3201
- const v = values[i];
3202
- if (v.type === "QualifiedName" && v.names.length === 1 && (0, import_chunk_YCLY27QH.hasProperty)(locals, v.names[0])) {
3203
- values.splice(i, 1, ...locals[v.names[0]]);
3204
- } else if (v.type === "SubList") {
3205
- process_list(v.values);
3206
- }
3207
- }
3208
- };
3209
- assignments.forEach((a) => process_list(a.values));
3210
- }
3211
- return assignments;
3212
- }
3213
- async function parse_one(file) {
3214
- const [fileName, grammarSource] = Array.isArray(file) ? file : [file, file];
3215
- const source = await fs2.readFile(fileName).catch(() => {
3216
- throw new Error(`Couldn't read jungle file '${fileName}`);
3217
- });
3218
- const assignments = peg$parse(source.toString(), {
3219
- grammarSource
3220
- });
3221
- return evaluate_locals(assignments);
3222
- }
3223
- async function process_jungles(sources) {
3224
- if (!Array.isArray(sources)) {
3225
- sources = [sources];
3226
- }
3227
- const results = await Promise.all(sources.map(parse_one));
3228
- const { state, devices } = await default_jungle();
3229
- results.forEach((r) => process_assignments(r, state));
3230
- return { state, devices };
3231
- }
3232
- function resolve_node_list(state, list) {
3233
- if (!Array.isArray(list)) {
3234
- throw new Error("Expected an array");
3235
- }
3236
- for (let i = list.length; i--; ) {
3237
- const v = list[i];
3238
- if (typeof v === "string" || Array.isArray(v))
3239
- continue;
3240
- if (v.type === "QualifiedName") {
3241
- const rep = resolve_node(state, resolve_node_by_path(state, v.names));
3242
- if (Array.isArray(rep)) {
3243
- if (rep.length !== 1 || isJNode(rep[0]) && rep[0].type) {
3244
- resolve_node_list(state, rep);
3245
- }
3246
- list.splice(i, 1, ...rep);
3247
- } else if (rep != null) {
3248
- list[i] = rep;
3249
- } else {
3250
- list.splice(i, 1);
3251
- }
3252
- } else if (v.type === "SubList") {
3253
- resolve_node_list(state, v.values);
3254
- }
3255
- }
3256
- return list;
3257
- }
3258
- function check_non_leaf_dot(dot, path5 = null, i = 0) {
3259
- if (dot.length !== 1 || dot[0].type) {
3260
- throw new Error(
3261
- `'.' node at ${(path5 || []).slice(0, i + 1).join(".")} should have length 1: ${JSON.stringify(dot)}`
3262
- );
3263
- }
3264
- }
3265
- function resolve_node_by_path(state, path5) {
3266
- return path5.reduce((s, n, i) => {
3267
- if (!s || Array.isArray(s)) {
3268
- return s;
3269
- }
3270
- if (!s[n] && s["."]) {
3271
- const sdot = s["."];
3272
- const resolved = resolve_node_list(state, sdot);
3273
- if (!resolved.length)
3274
- return void 0;
3275
- const r = resolved[0][n];
3276
- if (!r && sdot.every((e) => e.type === "Literal")) {
3277
- return s;
3278
- }
3279
- check_non_leaf_dot(sdot, path5, i);
3280
- return r;
3281
- }
3282
- return s[n];
3283
- }, state);
3284
- }
3285
- function resolve_node(state, node) {
3286
- if (node === void 0 || Array.isArray(node)) {
3287
- return node;
3288
- }
3289
- const { ".": dot, ...rest } = node;
3290
- if (dot) {
3291
- const entries = Object.entries(rest);
3292
- resolve_node_list(state, dot);
3293
- if (entries.length) {
3294
- check_non_leaf_dot(dot);
3295
- Object.entries(dot[0]).forEach(([k, v]) => {
3296
- node[k] = v;
3297
- });
3298
- entries.forEach(([k, v]) => {
3299
- node[k] = v;
3300
- });
3301
- } else if (dot.length === 1 && !dot[0].type) {
3302
- Object.entries(dot[0]).forEach(([k, v]) => {
3303
- node[k] = v;
3304
- });
3305
- } else {
3306
- return dot;
3307
- }
3308
- delete node["."];
3309
- }
3310
- Object.entries(node).forEach(([key, value]) => {
3311
- node[key] = resolve_node(state, value);
3312
- });
3313
- return node;
3314
- }
3315
- function resolve_filename(literal, default_source = null) {
3316
- if (typeof literal === "string")
3317
- return literal;
3318
- const root = path2.dirname(literal.source || default_source);
3319
- return path2.resolve(root, literal.value);
3320
- }
3321
- async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
3322
- const resolve_file_list = async (literals) => literals && (await Promise.all(
3323
- literals.map(async (v) => {
3324
- if (!isJNode(v)) {
3325
- return v;
3326
- }
3327
- if (v.type === "QualifiedName") {
3328
- throw new Error("Unexpected QualifiedName found!");
3329
- }
3330
- if (v.type === "SubList") {
3331
- return resolve_file_list(v.values);
3332
- }
3333
- const resolved = resolve_filename(v, default_source).replace(
3334
- /[\\/]\*\*([^\\/])/g,
3335
- "/**/*$1"
3336
- );
3337
- if (!(0, import_chunk_YCLY27QH.hasProperty)(cache.resolvedPaths, resolved)) {
3338
- if (/[*?[\]{}]/.test(resolved)) {
3339
- cache.resolvedPaths[resolved] = (0, import_chunk_IAUHYWVN.globSome)(resolved, () => true);
3340
- } else {
3341
- cache.resolvedPaths[resolved] = fs2.stat(resolved).then(() => true).catch(() => false);
3342
- }
3343
- }
3344
- return await cache.resolvedPaths[resolved] ? resolved : null;
3345
- })
3346
- )).filter((name) => name != null);
3347
- const resolve_one_file_list = async (base, name) => {
3348
- const bname = base[name];
3349
- if (!bname)
3350
- return;
3351
- const result = await resolve_file_list(
3352
- bname
3353
- );
3354
- if (!result || !result.length) {
3355
- delete base[name];
3356
- } else {
3357
- base[name] = result;
3358
- }
3359
- };
3360
- await resolve_one_file_list(qualifier, "sourcePath");
3361
- await resolve_one_file_list(qualifier, "resourcePath");
3362
- await resolve_one_file_list(qualifier, "barrelPath");
3363
- const lang = qualifier["lang"];
3364
- if (lang) {
3365
- await Promise.all(
3366
- Object.keys(lang).map((key) => {
3367
- return resolve_one_file_list(lang, key);
3368
- })
3369
- );
3370
- if (Object.keys(lang).length === 0)
3371
- delete qualifier["lang"];
3372
- } else {
3373
- delete qualifier["lang"];
3374
- }
3375
- const resolve_literal_list = (base, name) => {
3376
- const literals = base[name];
3377
- if (!literals || !literals.length)
3378
- return;
3379
- base[name] = literals.map((v) => v.value);
3380
- };
3381
- resolve_literal_list(qualifier, "excludeAnnotations");
3382
- const annotations = {};
3383
- Object.entries(qualifier).forEach(([k, v]) => {
3384
- if ((0, import_chunk_YCLY27QH.hasProperty)(v, "annotations")) {
3385
- annotations[k] = v["annotations"];
3386
- resolve_literal_list(annotations, k);
3387
- delete qualifier[k];
3388
- }
3389
- });
3390
- qualifier.annotations = annotations;
3391
- return qualifier;
3392
- }
3393
- async function read_resource_files(targets, cache) {
3394
- const resourceGroups = {};
3395
- const resourceGroupPromises = {};
3396
- const resources = {};
3397
- if (!cache.resources) {
3398
- cache.resources = {};
3399
- }
3400
- await Promise.all(
3401
- targets.map((p) => {
3402
- if (!p.qualifier.resourcePath)
3403
- return null;
3404
- const key = p.qualifier.resourcePath.join(";");
3405
- if (!(0, import_chunk_YCLY27QH.hasProperty)(resourceGroupPromises, key)) {
3406
- resourceGroupPromises[key] = Promise.all(
3407
- p.qualifier.resourcePath.map(
3408
- (pattern) => (0, import_chunk_IAUHYWVN.globa)(pattern, { mark: true })
3409
- )
3410
- ).then(
3411
- (patterns) => Promise.all(
3412
- patterns.flat().map(
3413
- (path5) => path5.endsWith("/") ? (0, import_chunk_IAUHYWVN.globa)(`${path5}**/*.xml`, { mark: true }) : path5
3414
- )
3415
- ).then(
3416
- (paths) => Promise.all(
3417
- paths.flat().filter((file) => file.endsWith(".xml")).map((file) => {
3418
- if (!(0, import_chunk_YCLY27QH.hasProperty)(cache.resources, file)) {
3419
- cache.resources[file] = fs2.readFile(file).then(
3420
- (data) => import_chunk_YCLY27QH.xml_util_exports.parseXml(data.toString(), file)
3421
- );
3422
- }
3423
- return Promise.resolve(cache.resources[file]).then(
3424
- (rez) => {
3425
- cache.resources[file] = resources[file] = rez;
3426
- return {
3427
- path: file,
3428
- resources: rez
3429
- };
3430
- }
3431
- );
3432
- })
3433
- )
3434
- )
3435
- ).then(
3436
- (resourceFiles) => resourceGroups[key] = {
3437
- resourcePath: p.qualifier.resourcePath,
3438
- resourceFiles,
3439
- resourceMap: Object.fromEntries(
3440
- resourceFiles.map((e) => [e.path, e.resources])
3441
- ),
3442
- products: []
3443
- }
3444
- );
3445
- }
3446
- if (p.qualifier.barrelMap) {
3447
- Object.values(p.qualifier.barrelMap).forEach(
3448
- (e) => Object.assign(resources, e.resources)
3449
- );
3450
- }
3451
- resourceGroupPromises[key] = resourceGroupPromises[key].then((rg) => {
3452
- rg.products.push(p.product);
3453
- p.qualifier.resourceMap = rg.resourceMap;
3454
- return rg;
3455
- });
3456
- return resourceGroupPromises[key];
3457
- })
3458
- );
3459
- return { resources, resourceGroups };
3460
- }
3461
- async function find_build_instructions_in_resource(file, rez, buildDependencies) {
3462
- if (rez.body instanceof Error) {
3463
- buildDependencies[file] = true;
3464
- return null;
3465
- }
3466
- const build = rez.body.skip("resources").filter("build");
3467
- if (!build.length())
3468
- return null;
3469
- buildDependencies[file] = true;
3470
- const excludes = build.children("exclude").attrs();
3471
- if (!excludes.length)
3472
- return null;
3473
- const dir = path2.dirname(file);
3474
- const sourceExcludes = excludes.map((e) => e.file?.value.value).filter((f) => f != null).map((f) => path2.resolve(dir, f).replace(/\\/g, "/"));
3475
- const filePatterns = excludes.map((e) => e.dir?.value.value).filter((f) => f != null).map((f) => path2.join(dir, f, "**", "*.mc").replace(/\\/g, "/"));
3476
- if (filePatterns.length) {
3477
- const files = (await Promise.all(filePatterns.map((p) => (0, import_chunk_IAUHYWVN.globa)(p)))).flat();
3478
- sourceExcludes.push(...files);
3479
- }
3480
- const excludeAnnotations = excludes.map((e) => e.annotation?.value.value).filter((f) => f != null);
3481
- return { sourceExcludes, excludeAnnotations };
3482
- }
3483
- async function find_build_instructions(targets, resourceGroups, buildDependencies) {
3484
- await Promise.all(
3485
- targets.map(async (p) => {
3486
- if (!p.qualifier.resourcePath)
3487
- return;
3488
- const key = p.qualifier.resourcePath.join(";");
3489
- if (!(0, import_chunk_YCLY27QH.hasProperty)(resourceGroups, key))
3490
- return;
3491
- if (!(0, import_chunk_YCLY27QH.hasProperty)(resourceGroups[key], "buildInstructions")) {
3492
- resourceGroups[key].buildInstructions = (await Promise.all(
3493
- resourceGroups[key].resourceFiles.map(
3494
- ({ path: path5, resources }) => find_build_instructions_in_resource(
3495
- path5,
3496
- resources,
3497
- buildDependencies
3498
- )
3499
- )
3500
- )).filter((i) => i != null).pop();
3501
- }
3502
- const buildInstructions = resourceGroups[key].buildInstructions;
3503
- if (buildInstructions) {
3504
- if (buildInstructions.sourceExcludes && buildInstructions.sourceExcludes.length) {
3505
- p.qualifier.sourceExcludes = buildInstructions.sourceExcludes;
3506
- }
3507
- if (buildInstructions.excludeAnnotations && buildInstructions.excludeAnnotations.length) {
3508
- if (p.qualifier.excludeAnnotations) {
3509
- p.qualifier.excludeAnnotations.push(
3510
- ...buildInstructions.excludeAnnotations
3511
- );
3512
- } else {
3513
- p.qualifier.excludeAnnotations = buildInstructions.excludeAnnotations;
3514
- }
3515
- }
3516
- }
3517
- })
3518
- );
3519
- }
3520
- function identify_optimizer_groups(targets, options) {
3521
- const groups = {};
3522
- let key = 0;
3523
- const ignoreStrOption = (str) => str == null ? null : str === "*" ? "*" : Object.fromEntries(str.split(";").map((e) => [e, true]));
3524
- const getStrsWithIgnore = (strs, option) => {
3525
- if (option === "*") {
3526
- return [];
3527
- } else {
3528
- return strs.filter((a) => !(0, import_chunk_YCLY27QH.hasProperty)(option, a));
3529
- }
3530
- };
3531
- const ignoreRegExpOption = (str) => {
3532
- try {
3533
- if (!str)
3534
- return null;
3535
- return new RegExp(str);
3536
- } catch {
3537
- return null;
3538
- }
3539
- };
3540
- const ignoredExcludeAnnotations = ignoreStrOption(
3541
- options.ignoredExcludeAnnotations
3542
- );
3543
- const ignoredAnnotations = ignoreStrOption(options.ignoredAnnotations);
3544
- const ignoredSourcePathsRe = ignoreRegExpOption(options.ignoredSourcePaths);
3545
- const ignoredSourcePaths = ignoredSourcePathsRe ? targets.reduce(
3546
- (state, target) => {
3547
- if (target.qualifier.sourcePath) {
3548
- target.qualifier.sourcePath.forEach((path5) => {
3549
- const m = path5.match(ignoredSourcePathsRe);
3550
- const key2 = m ? "key-" + m.slice(1).join("") : path5;
3551
- if (!(0, import_chunk_YCLY27QH.hasProperty)(state.keys, key2)) {
3552
- state.keys[key2] = {};
3553
- }
3554
- state.keys[key2][path5] = true;
3555
- state.paths[path5] = state.keys[key2];
3556
- });
3557
- }
3558
- return state;
3559
- },
3560
- { keys: {}, paths: {} }
3561
- ).paths : null;
3562
- targets.forEach((target) => {
3563
- let {
3564
- sourcePath,
3565
- sourceExcludes,
3566
- barrelPath,
3567
- barrelMap,
3568
- excludeAnnotations,
3569
- annotations,
3570
- resourceMap,
3571
- resourcePath
3572
- } = target.qualifier;
3573
- if (excludeAnnotations && ignoredExcludeAnnotations) {
3574
- excludeAnnotations = getStrsWithIgnore(
3575
- excludeAnnotations,
3576
- ignoredExcludeAnnotations
3577
- );
3578
- }
3579
- annotations && Object.entries(annotations).forEach(([key2, value]) => {
3580
- if (ignoredAnnotations) {
3581
- annotations[key2] = getStrsWithIgnore(value, ignoredAnnotations);
3582
- }
3583
- });
3584
- if (ignoredSourcePaths) {
3585
- sourcePath = sourcePath?.map((path5) => Object.keys(ignoredSourcePaths[path5])).flat().sort().filter((v, i, a) => i === 0 || v !== a[i - 1]);
3586
- }
3587
- const optimizerConfig = {
3588
- sourcePath,
3589
- sourceExcludes,
3590
- barrelPath,
3591
- barrelMap,
3592
- excludeAnnotations,
3593
- annotations,
3594
- resourceMap
3595
- };
3596
- const toSortedEntries = (value) => Object.entries(value).filter(([, v]) => v != null).sort((a, b) => a[0] < b[0] ? -1 : a[0] === b[0] ? 0 : 1);
3597
- const serialized = JSON.stringify(optimizerConfig, function(key2, value) {
3598
- if (!value || Array.isArray(value) || typeof value !== "object") {
3599
- return value;
3600
- }
3601
- if (key2 === "") {
3602
- if (barrelMap) {
3603
- const bm = toSortedEntries(barrelMap).map(([k, v]) => {
3604
- const { jungles, qualifier } = v;
3605
- return [k, [jungles, qualifier]];
3606
- });
3607
- value = { ...value, barrelMap: bm };
3608
- }
3609
- if (resourceMap) {
3610
- value = { ...value, resourceMap: resourcePath };
3611
- }
3612
- }
3613
- return toSortedEntries(value);
3614
- });
3615
- if (!(0, import_chunk_YCLY27QH.hasProperty)(groups, serialized)) {
3616
- groups[serialized] = {
3617
- key: "group" + key.toString().padStart(3, "0"),
3618
- optimizerConfig
3619
- };
3620
- key++;
3621
- }
3622
- target.group = groups[serialized];
3623
- });
3624
- }
3625
- function find_barrels(barrelPath) {
3626
- if (Array.isArray(barrelPath)) {
3627
- return Promise.all(
3628
- barrelPath.map((path5) => (0, import_chunk_IAUHYWVN.globa)(path5, { mark: true }))
3629
- ).then((paths) => [
3630
- paths.flat().filter((path5) => path5.endsWith(".jungle")).join(";")
3631
- ]);
3632
- }
3633
- return (0, import_chunk_IAUHYWVN.globa)(barrelPath, { mark: true }).then(
3634
- (paths) => Promise.all(
3635
- paths.map(
3636
- (path5) => path5.endsWith("/") ? (0, import_chunk_IAUHYWVN.globa)(`${path5}**/*.barrel`) : path5
3637
- )
3638
- )
3639
- ).then(
3640
- (barrelPaths) => barrelPaths.flat().filter((path5) => path5.endsWith(".jungle") || path5.endsWith(".barrel"))
3641
- );
3642
- }
3643
- function resolve_barrel(barrel, barrelDir, products, options, cache, buildDependencies) {
3644
- if ((0, import_chunk_YCLY27QH.hasProperty)(cache.barrels, barrel)) {
3645
- return cache.barrels[barrel];
3646
- }
3647
- let promise = Promise.resolve();
3648
- let rawBarrel = barrel;
3649
- if (barrel.endsWith(".barrel")) {
3650
- const sha1 = crypto.createHash("sha1").update(barrel, "binary").digest("base64").replace(/[/=+]/g, "");
3651
- const localPath = path2.resolve(
3652
- barrelDir,
3653
- `${path2.basename(barrel, ".barrel")}-${sha1}`
3654
- );
3655
- rawBarrel = path2.resolve(localPath, "barrel.jungle");
3656
- promise = promise.then(
3657
- () => fs2.stat(localPath).then(
3658
- (localStat) => !localStat.isDirectory() || fs2.stat(barrel).then((barrelStat) => localStat.mtimeMs < barrelStat.mtimeMs),
3659
- () => true
3660
- ).then((needsUpdate) => {
3661
- needsUpdate && fs2.rm(localPath, { recursive: true, force: true }).then(() => (0, import_extract_zip.default)(barrel, { dir: localPath }));
3662
- })
3663
- );
3664
- }
3665
- return promise.then(() => get_jungle_and_barrels(rawBarrel, products, options, cache)).then((result) => {
3666
- Object.values(result.resources).forEach(
3667
- (rez) => rez.data || (rez.data = { barrel })
3668
- );
3669
- Object.entries(result.buildDependencies).forEach(
3670
- ([k, v]) => buildDependencies[k] = v
3671
- );
3672
- if (!cache.barrels)
3673
- cache.barrels = {};
3674
- return cache.barrels[barrel] = { ...result };
3675
- }).catch((e) => {
3676
- if (e instanceof Error) {
3677
- const err = e;
3678
- if (err.buildDependencies) {
3679
- Object.entries(err.buildDependencies).forEach(
3680
- ([k, v]) => buildDependencies[k] = v
3681
- );
3682
- }
3683
- }
3684
- throw e;
3685
- });
3686
- }
3687
- function resolve_barrels(product, qualifier, barrels, products, options, cache, buildDependencies) {
3688
- if (qualifier.annotations) {
3689
- Object.keys(qualifier.annotations).forEach((key) => {
3690
- if (!barrels.includes(key)) {
3691
- delete qualifier.annotations[key];
3692
- }
3693
- });
3694
- }
3695
- if (!barrels.length) {
3696
- delete qualifier.barrelPath;
3697
- return null;
3698
- }
3699
- const barrelMapKey = JSON.stringify([barrels, qualifier.barrelPath]);
3700
- const setBarrelMap = (barrelMap2) => {
3701
- qualifier.barrelMap = barrels.reduce((result, barrel) => {
3702
- const { targets, ...rest } = barrelMap2[barrel];
3703
- const target = targets.find((t) => t.product === product);
3704
- if (!target) {
3705
- throw new Error(`Barrel ${barrel} does not support device ${product}`);
3706
- }
3707
- const resolvedBarrel = { qualifier: target.qualifier, ...rest };
3708
- result[barrel] = resolvedBarrel;
3709
- return result;
3710
- }, {});
3711
- };
3712
- if ((0, import_chunk_YCLY27QH.hasProperty)(cache.barrelMap, barrelMapKey)) {
3713
- setBarrelMap(cache.barrelMap[barrelMapKey]);
3714
- return null;
3715
- }
3716
- const barrelDir = path2.resolve(
3717
- options.workspace,
3718
- options.outputPath,
3719
- "raw-barrels"
3720
- );
3721
- const barrelMap = Object.fromEntries(
3722
- barrels.map((b) => [b, null])
3723
- );
3724
- return (qualifier.barrelPath || []).reduce(
3725
- (promise, barrelPath) => promise.then(() => find_barrels(barrelPath)).then((barrelPaths) => {
3726
- return Promise.all(
3727
- barrelPaths.map(
3728
- (barrel) => resolve_barrel(
3729
- barrel,
3730
- barrelDir,
3731
- products,
3732
- options,
3733
- cache,
3734
- buildDependencies
3735
- )
3736
- )
3737
- );
3738
- }).then((resolvedBarrels) => {
3739
- resolvedBarrels.forEach((resolvedBarrel) => {
3740
- const name = manifestBarrelName(
3741
- resolvedBarrel.manifest,
3742
- resolvedBarrel.xml
3743
- );
3744
- if (!(0, import_chunk_YCLY27QH.hasProperty)(barrelMap, name))
3745
- return;
3746
- const bmapName = barrelMap[name];
3747
- if (bmapName) {
3748
- const bname = (r) => r.jungles.join(";");
3749
- throw new Error(
3750
- `Barrel ${name} already resolved to ${bname(
3751
- bmapName
3752
- )}; can't also resolve to ${bname(resolvedBarrel)}`
3753
- );
3754
- }
3755
- barrelMap[name] = resolvedBarrel;
3756
- });
3757
- }),
3758
- Promise.resolve()
3759
- ).then(() => {
3760
- const unresolved = Object.entries(barrelMap).filter((v) => v[1] === null);
3761
- if (unresolved.length) {
3762
- throw new Error(
3763
- `Failed to resolve some barrels: ${unresolved.map(([name]) => name).join(",")}`
3764
- );
3765
- }
3766
- const finalMap = barrelMap;
3767
- if (!cache.barrelMap)
3768
- cache.barrelMap = {};
3769
- cache.barrelMap[barrelMapKey] = finalMap;
3770
- setBarrelMap(finalMap);
3771
- });
3772
- }
3773
- async function get_jungle_and_barrels(jungleFiles, defaultProducts, options, cache) {
3774
- const buildDependencies = {};
3775
- try {
3776
- const jungles = jungleFiles.split(";").map((jungle) => path2.resolve(options.workspace || "./", jungle));
3777
- const barrels_jungle = path2.resolve(
3778
- path2.dirname(jungles[0]),
3779
- "barrels.jungle"
3780
- );
3781
- if (!jungles.includes(barrels_jungle)) {
3782
- if (await fs2.stat(barrels_jungle).then((s) => s.isFile()).catch(() => false)) {
3783
- jungles.push(barrels_jungle);
3784
- }
3785
- }
3786
- jungles.forEach((j) => buildDependencies[j] = true);
3787
- const { state, devices } = await process_jungles(jungles);
3788
- state["square_watch"] = state["rectangle_watch"];
3789
- const manifest_node = resolve_node(
3790
- state,
3791
- resolve_node_by_path(state, ["project", "manifest"])
3792
- );
3793
- if (!manifest_node)
3794
- throw new Error("No manifest found!");
3795
- const manifest = resolve_filename(manifest_node[0]);
3796
- buildDependencies[manifest] = true;
3797
- if (!options.workspace) {
3798
- options.workspace = path2.dirname(manifest);
3799
- }
3800
- if (!(0, import_chunk_YCLY27QH.hasProperty)(cache.resources, manifest)) {
3801
- cache.resources[manifest] = readManifest(manifest);
3802
- }
3803
- const xml = await Promise.resolve(cache.resources[manifest]);
3804
- if (xml.body instanceof Error) {
3805
- throw xml;
3806
- }
3807
- buildDependencies[manifest] = xml;
3808
- const targets = [];
3809
- const barrels = manifestBarrels(xml);
3810
- const annotations = manifestAnnotations(xml);
3811
- const products = manifestProducts(xml);
3812
- if (products.length === 0) {
3813
- if (defaultProducts) {
3814
- products.push(...defaultProducts);
3815
- } else if (xml.body.children("iq:barrel").length()) {
3816
- products.push(...Object.keys(devices).sort());
3817
- }
3818
- }
3819
- let promise = Promise.resolve();
3820
- const add_one = (product, shape = void 0) => {
3821
- const rawQualifier = resolve_node(state, state[product]);
3822
- if (!rawQualifier || Array.isArray(rawQualifier))
3823
- return;
3824
- promise = promise.then(
3825
- () => resolve_literals(rawQualifier, manifest, devices[product], cache)
3826
- ).then((qualifier) => {
3827
- targets.push({ product, qualifier, shape });
3828
- return resolve_barrels(
3829
- product,
3830
- qualifier,
3831
- barrels,
3832
- products,
3833
- options,
3834
- cache,
3835
- buildDependencies
3836
- );
3837
- }).then(() => {
3838
- return;
3839
- });
3840
- };
3841
- products.forEach((product) => {
3842
- if ((0, import_chunk_YCLY27QH.hasProperty)(state, product)) {
3843
- const sp = state[product];
3844
- if (sp && !Array.isArray(sp) && sp.products) {
3845
- sp.products.forEach((p) => add_one(p, product));
3846
- } else {
3847
- add_one(product);
3848
- }
3849
- }
3850
- });
3851
- await promise;
3852
- const { resourceGroups, resources } = await read_resource_files(
3853
- targets,
3854
- cache
3855
- );
3856
- await find_build_instructions(targets, resourceGroups, buildDependencies);
3857
- return {
3858
- manifest,
3859
- targets,
3860
- xml,
3861
- annotations,
3862
- jungles,
3863
- resources,
3864
- buildDependencies,
3865
- devices
3866
- };
3867
- } catch (e) {
3868
- const err = e instanceof Error ? e : new Error("An unknown error occurred");
3869
- err.buildDependencies = buildDependencies;
3870
- throw err;
3871
- }
3872
- }
3873
- async function get_jungle(jungles, options, resources) {
3874
- options = options || {};
3875
- const cache = {
3876
- resources: { ...resources || {} },
3877
- resolvedPaths: {}
3878
- };
3879
- const result = await get_jungle_and_barrels(jungles, null, options, cache);
3880
- identify_optimizer_groups(result.targets, options);
3881
- return result;
3882
- }
3883
- var import_extract_zip;
3884
- var init_jungles = (0, import_chunk_IAUHYWVN.__esm)({
3885
- "src/jungles.ts"() {
3886
- "use strict";
3887
- import_extract_zip = (0, import_chunk_IAUHYWVN.__toESM)(require_extract_zip());
3888
- init_jungle();
3889
- (0, import_chunk_YCLY27QH.init_api)();
3890
- init_manifest();
3891
- (0, import_chunk_YCLY27QH.init_sdk_util)();
3892
- (0, import_chunk_IAUHYWVN.init_util)();
3893
- }
3894
- });
3895
- async function launchSimulator(force = true) {
3896
- try {
3897
- if (!force && await checkIfSimulatorRunning())
3898
- return;
3899
- const sdk = await (0, import_chunk_YCLY27QH.getSdkPath)();
3900
- const child = force || process.platform !== "darwin" ? (0, import_child_process.execFile)(path3.resolve(sdk, "bin", import_chunk_YCLY27QH.isWin ? "simulator" : "connectiq")) : (0, import_child_process.execFile)("/usr/bin/open", [
3901
- "-g",
3902
- "-a",
3903
- path3.resolve(
3904
- sdk,
3905
- "bin",
3906
- "ConnectIQ.App",
3907
- "Contents/MacOS/simulator"
3908
- )
3909
- ]);
3910
- child.unref();
3911
- for (let i = 0; ; i++) {
3912
- if (await checkIfSimulatorRunning())
3913
- return;
3914
- if (i === 10)
3915
- return;
3916
- await new Promise((r) => setTimeout(r, 200));
3917
- }
3918
- } catch (e) {
3919
- console.log(e);
3920
- }
3921
- }
3922
- function checkIfSimulatorRunning() {
3923
- return Promise.all(
3924
- [1234, 1235, 1236, 1237, 1238].map(checkIfSimulatorRunningOn)
3925
- ).then((results) => results.some((v) => v));
3926
- }
3927
- function checkIfSimulatorRunningOn(port) {
3928
- return new Promise((resolve5) => {
3929
- let listening = false;
3930
- const socket = new net.Socket();
3931
- socket.on(
3932
- "data",
3933
- (data) => listening = data.toString().includes("A garmin device")
3934
- );
3935
- socket.on("error", () => resolve5(false));
3936
- socket.on("end", () => resolve5(listening));
3937
- socket.connect(port, "localhost");
3938
- socket.end();
3939
- }).catch(() => false);
3940
- }
3941
- function simulateProgram(prg, device, test = false, logger) {
3942
- const args = [prg, device];
3943
- if (test) {
3944
- args.push(import_chunk_YCLY27QH.isWin ? "/t" : "-t");
3945
- if (typeof test === "string") {
3946
- args.push(test);
3947
- }
3948
- }
3949
- return (0, import_chunk_YCLY27QH.getSdkPath)().then(
3950
- (sdk) => (0, import_chunk_IAUHYWVN.spawnByLine)(
3951
- path3.resolve(sdk, "bin", import_chunk_YCLY27QH.isWin ? "monkeydo.bat" : "monkeydo"),
3952
- args,
3953
- logger || ((line) => console.log(line))
3954
- ).then(() => {
3955
- return;
3956
- })
3957
- );
3958
- }
3959
- var init_launch = (0, import_chunk_IAUHYWVN.__esm)({
3960
- "src/launch.ts"() {
3961
- "use strict";
3962
- (0, import_chunk_YCLY27QH.init_sdk_util)();
3963
- (0, import_chunk_IAUHYWVN.init_util)();
3964
- }
3965
- });
3966
- function relative_path_no_dotdot(relative2) {
3967
- return relative2.replace(
3968
- /^(\.\.[\\/])+/,
3969
- (str) => `__${"dot".repeat(str.length / 3)}__${str.slice(-1)}`
3970
- );
3971
- }
3972
- async function getVSCodeSettings(path5) {
3973
- try {
3974
- const settings = await fs3.readFile(path5);
3975
- return JSON.parse(settings.toString());
3976
- } catch (e) {
3977
- return {};
3978
- }
3979
- }
3980
- function isErrorWithLocation(e) {
3981
- return (0, import_chunk_YCLY27QH.hasProperty)(e, "location");
3982
- }
3983
- function getConfig(options) {
3984
- const config = { ...defaultConfig, ...options || {} };
3985
- return [
3986
- "jungleFiles",
3987
- "developerKeyPath",
3988
- "typeCheckLevel",
3989
- "compilerOptions",
3990
- "compilerWarnings",
3991
- "ignoredExcludeAnnotations",
3992
- "ignoredAnnotations",
3993
- "ignoredSourcePaths"
3994
- ].reduce((promise, key) => {
3995
- if (key in config)
3996
- return promise;
3997
- return promise.then(
3998
- (v) => v || getVSCodeSettings(`${import_chunk_YCLY27QH.appSupport}/Code/User/settings.json`).then(
3999
- (globals) => getVSCodeSettings(
4000
- `${config.workspace}/.vscode/settings.json`
4001
- ).then((locals) => ({ ...globals, ...locals }))
4002
- )
4003
- ).then((settings) => {
4004
- const value = settings[`monkeyC.${key}`] || settings[`prettierMonkeyC.${key}`];
4005
- if (value !== void 0) {
4006
- config[key] = value;
4007
- }
4008
- return settings;
4009
- });
4010
- }, Promise.resolve(null)).then(() => config);
4011
- }
4012
- async function buildOptimizedProject(product, options) {
4013
- const config = await getConfig(options);
4014
- if (product) {
4015
- config.products = [product];
4016
- } else {
4017
- delete config.testBuild;
4018
- if (!(0, import_chunk_YCLY27QH.hasProperty)(config, "releaseBuild")) {
4019
- config.releaseBuild = true;
4020
- }
4021
- }
4022
- const { jungleFiles, program, hasTests, diagnostics } = await generateOptimizedProject(config);
4023
- config.jungleFiles = jungleFiles;
4024
- let bin = config.buildDir || "bin";
4025
- let name = `optimized-${program}.prg`;
4026
- if (product) {
4027
- product = config.products[0];
4028
- if (config.simulatorBuild === false) {
4029
- bin = path4.join(bin, product);
4030
- }
4031
- } else {
4032
- bin = path4.join(bin, "exported");
4033
- name = `${program}.iq`;
4034
- }
4035
- config.program = path4.join(bin, name);
4036
- if (!hasTests)
4037
- delete config.testBuild;
4038
- return build_project(product, config).then((result) => ({
4039
- hasTests,
4040
- diagnostics,
4041
- ...result
4042
- }));
4043
- }
4044
- async function createLocalBarrels(targets, options) {
4045
- if (targets.every(
4046
- (target) => !target.group?.optimizerConfig.barrelMap || Object.values(target.group.optimizerConfig.barrelMap).every(
4047
- (resolvedBarrel) => !resolvedBarrel.qualifier.resourcePath
4048
- )
4049
- )) {
4050
- return null;
4051
- }
4052
- const barrelDir = path4.resolve(
4053
- options.workspace,
4054
- options.outputPath,
4055
- "opt-barrels"
4056
- );
4057
- return targets.reduce((promise, target) => {
4058
- if (!target.group)
4059
- return promise;
4060
- const barrelMap = target.group.optimizerConfig.barrelMap;
4061
- if (!barrelMap || target.group.optimizerConfig.optBarrels) {
4062
- return promise;
4063
- }
4064
- const optBarrels = target.group.optimizerConfig.optBarrels = {};
4065
- return Object.entries(barrelMap).reduce(
4066
- (promise2, [barrel, resolvedBarrel]) => {
4067
- const { manifest, jungles } = resolvedBarrel;
4068
- const rawBarrelDir = path4.dirname(jungles[0]);
4069
- const rawJungles = jungles.map(
4070
- (jungle) => path4.relative(rawBarrelDir, jungle)
4071
- );
4072
- const sha1 = crypto2.createHash("sha1").update(rawBarrelDir, "binary").digest("base64").replace(/[/=+]/g, "");
4073
- const optBarrelDir = path4.resolve(barrelDir, `${barrel}-${sha1}`);
4074
- if (!(0, import_chunk_YCLY27QH.hasProperty)(optBarrels, barrel)) {
4075
- optBarrels[barrel] = {
4076
- rawBarrelDir,
4077
- manifest,
4078
- jungleFiles: [...rawJungles],
4079
- optBarrelDir
4080
- };
4081
- return promise2.then(
4082
- () => (0, import_chunk_IAUHYWVN.copyRecursiveAsNeeded)(
4083
- rawBarrelDir,
4084
- optBarrelDir,
4085
- (src) => !src.endsWith(".mc")
4086
- )
4087
- );
4088
- }
4089
- if (optBarrels[barrel].manifest !== manifest || optBarrels[barrel].optBarrelDir !== optBarrelDir || optBarrels[barrel].rawBarrelDir !== rawBarrelDir) {
4090
- throw new Error(
4091
- `For device ${target.product}, barrel ${barrel} was mapped to both ${path4.relative(
4092
- optBarrels[barrel].rawBarrelDir,
4093
- optBarrels[barrel].manifest
4094
- )} in ${optBarrels[barrel].rawBarrelDir} and ${path4.relative(
4095
- rawBarrelDir,
4096
- manifest
4097
- )} in ${rawBarrelDir}.`
4098
- );
4099
- }
4100
- optBarrels[barrel].jungleFiles.push(...rawJungles);
4101
- return promise2;
4102
- },
4103
- promise
4104
- );
4105
- }, Promise.resolve());
4106
- }
4107
- async function generateOptimizedProject(options) {
4108
- const config = await getConfig(options);
4109
- const workspace = config.workspace;
4110
- const { manifest, targets, xml, devices, resources, buildDependencies } = await get_jungle(config.jungleFiles, config);
4111
- if (xml.body instanceof Error) {
4112
- throw xml.body;
4113
- }
4114
- if (!xml.body.children("iq:application").length()) {
4115
- const error = new Error(
4116
- xml.body.children("iq:barrel").length() ? "Optimize the project that uses this barrel, not the barrel itself" : "Manifest is missing an `iq:application` tag"
4117
- );
4118
- error.location = xml.body.elements[0].loc || void 0;
4119
- throw error;
4120
- }
4121
- const dependencyFiles = Object.keys(resources).concat(
4122
- Object.keys(buildDependencies)
4123
- );
4124
- await createLocalBarrels(targets, config);
4125
- const buildConfigs = {};
4126
- const products = {};
4127
- let pick_one = config.products ? config.products.indexOf("pick-one") : -1;
4128
- if (config.skipOptimization) {
4129
- if (pick_one >= 0) {
4130
- options.products = [...options.products];
4131
- options.products[pick_one] = targets[0].product;
4132
- }
4133
- return {
4134
- jungleFiles: config.jungleFiles,
4135
- xml,
4136
- program: path4.basename(path4.dirname(manifest)),
4137
- hasTests: !!config.testBuild
4138
- };
4139
- }
4140
- let dropBarrels = false;
4141
- let configsToBuild = 0;
4142
- const configKey = (p) => p.group.key + (config.releaseBuild ? "-release" : "-debug");
4143
- targets.forEach((p) => {
4144
- if (!p.group) {
4145
- throw new Error(`Missing group in build target ${p.product}`);
4146
- }
4147
- const key = configKey(p);
4148
- if (!(0, import_chunk_YCLY27QH.hasProperty)(buildConfigs, key)) {
4149
- p.group.dir = key;
4150
- if (p.group.optimizerConfig.barrelMap && !p.group.optimizerConfig.optBarrels) {
4151
- dropBarrels = true;
4152
- }
4153
- buildConfigs[key] = null;
4154
- }
4155
- if (pick_one >= 0 || !options.products || options.products.includes(p.product) || p.shape && options.products.includes(p.shape)) {
4156
- if (pick_one >= 0) {
4157
- options.products = [...options.products];
4158
- options.products[pick_one] = p.product;
4159
- pick_one = -1;
4160
- }
4161
- if (!buildConfigs[key]) {
4162
- buildConfigs[key] = p.group.optimizerConfig;
4163
- products[key] = [];
4164
- configsToBuild++;
4165
- }
4166
- products[key].push(p.product);
4167
- }
4168
- });
4169
- const jungle_dir = path4.resolve(workspace, config.outputPath);
4170
- await fs3.mkdir(jungle_dir, { recursive: true });
4171
- const relative_path = (s) => path4.relative(jungle_dir, s);
4172
- let relative_manifest = relative_path(manifest);
4173
- const manifestOk = (!config.checkManifest || await checkManifest(
4174
- xml,
4175
- targets.map((t) => t.product)
4176
- )) && !dropBarrels;
4177
- let hasTests = false;
4178
- let diagnostics = {};
4179
- const jungleFiles = path4.join(
4180
- jungle_dir,
4181
- `${config.releaseBuild ? "release" : "debug"}.jungle`
4182
- );
4183
- let poolStarted;
4184
- try {
4185
- if (configsToBuild > 1) {
4186
- poolStarted = startPool();
4187
- }
4188
- const promises = Object.keys(buildConfigs).sort().map((key) => {
4189
- const buildConfig = buildConfigs[key];
4190
- const outputPath = path4.join(config.outputPath, key);
4191
- return buildConfig ? runTaskInPool({
4192
- type: "generateOneConfig",
4193
- data: {
4194
- buildConfig,
4195
- manifestXML: xml,
4196
- dependencyFiles,
4197
- config: {
4198
- ...config,
4199
- outputPath
4200
- }
4201
- }
4202
- }).catch((e) => {
4203
- if (!e.stack) {
4204
- e = new Error(e.toString());
4205
- }
4206
- e.products = products[key];
4207
- throw e;
4208
- }).then((t) => {
4209
- if (t.hasTests)
4210
- hasTests = true;
4211
- if (t.diagnostics) {
4212
- diagnostics = { ...diagnostics, ...t.diagnostics };
4213
- }
4214
- }) : fs3.rm(path4.resolve(workspace, outputPath), {
4215
- recursive: true,
4216
- force: true
4217
- });
4218
- });
4219
- if (!manifestOk) {
4220
- if (dropBarrels) {
4221
- manifestDropBarrels(xml);
4222
- }
4223
- const manifestFile = path4.join(jungle_dir, "manifest.xml");
4224
- promises.push(writeManifest(manifestFile, xml));
4225
- relative_manifest = "manifest.xml";
4226
- }
4227
- const parts = [`project.manifest=${relative_manifest}`];
4228
- const map_field = (base, name, mapper = null) => {
4229
- const obj = base[name];
4230
- if (!obj)
4231
- return null;
4232
- const map_one = (s) => mapper ? mapper(s) : s;
4233
- const map = (s) => Array.isArray(s) ? `[${s.map(map_one).join(";")}]` : map_one(s);
4234
- return `${obj.map(map).join(";")}`;
4235
- };
4236
- const process_field = (prefix, base, name, mapper = null) => {
4237
- const mapped = map_field(base, name, mapper);
4238
- if (!mapped)
4239
- return;
4240
- parts.push(`${prefix}${name} = ${mapped}`);
4241
- };
4242
- const languagesToInclude = Object.fromEntries(
4243
- (manifestLanguages(xml) || []).map((lang) => [lang, true])
4244
- );
4245
- const unsupportedLangsCache = {};
4246
- let availableDefaults = null;
4247
- const nextAvailableDefault = () => {
4248
- if (!availableDefaults) {
4249
- availableDefaults = Object.keys(
4250
- Object.values(devices).reduce((m, d) => {
4251
- m[d.deviceFamily] = true;
4252
- const match = d.deviceFamily.match(/^(\w+)-\d+x\d+/);
4253
- if (match)
4254
- m[match[1]] = true;
4255
- return m;
4256
- }, {})
4257
- ).sort();
4258
- availableDefaults.unshift("base");
4259
- }
4260
- return availableDefaults.shift();
4261
- };
4262
- targets.forEach((target) => {
4263
- if (!buildConfigs[configKey(target)])
4264
- return;
4265
- const { product, qualifier, group } = target;
4266
- if (!group) {
4267
- throw new Error(`Missing group in target ${target.product}`);
4268
- }
4269
- const prefix = `${product}.`;
4270
- process_field(
4271
- prefix,
4272
- qualifier,
4273
- "sourcePath",
4274
- (s) => path4.join(
4275
- group.dir,
4276
- "source",
4277
- relative_path_no_dotdot(path4.relative(workspace, s))
4278
- ).replace(/([\\/]\*\*)[\\/]\*/g, "$1")
4279
- );
4280
- if (group.optimizerConfig.optBarrels) {
4281
- parts.push(
4282
- `${prefix}barrelPath = ${Object.values(
4283
- group.optimizerConfig.optBarrels
4284
- ).map(
4285
- (value) => `[${value.jungleFiles.map((j) => relative_path(path4.join(value.optBarrelDir, j))).join(";")}]`
4286
- ).join(";")}`
4287
- );
4288
- }
4289
- if (group.optimizerConfig.barrelMap) {
4290
- parts.push(
4291
- `${prefix}sourcePath = ${[`$(${prefix}sourcePath)`].concat(
4292
- Object.entries(group.optimizerConfig.barrelMap).map(([barrel, resolvedBarrel]) => {
4293
- const root = path4.dirname(resolvedBarrel.jungles[0]);
4294
- return (resolvedBarrel.qualifier.sourcePath || []).map(
4295
- (s) => path4.join(
4296
- group.dir,
4297
- "barrels",
4298
- barrel,
4299
- path4.relative(root, s)
4300
- ).replace(/([\\/]\*\*)[\\/]\*/g, "$1")
4301
- );
4302
- }).flat().sort().filter((s, i, arr) => !i || s !== arr[i - 1])
4303
- ).join(";")}`
4304
- );
4305
- }
4306
- process_field(prefix, qualifier, "resourcePath", relative_path);
4307
- process_field(prefix, qualifier, "excludeAnnotations");
4308
- const qlang = qualifier.lang;
4309
- if (qlang) {
4310
- const devLang = devices[product].languages;
4311
- const unsupportedLangs = Object.keys(qlang).sort().map((key) => {
4312
- if ((0, import_chunk_YCLY27QH.hasProperty)(devLang, key) || !(0, import_chunk_YCLY27QH.hasProperty)(languagesToInclude, key)) {
4313
- return null;
4314
- }
4315
- const mapped = map_field(qlang, key, relative_path);
4316
- if (!mapped)
4317
- return null;
4318
- return [key, mapped];
4319
- }).filter((a) => a != null);
4320
- let keysToSkip = null;
4321
- if (unsupportedLangs.length) {
4322
- const key = JSON.stringify(unsupportedLangs);
4323
- if (!(0, import_chunk_YCLY27QH.hasProperty)(unsupportedLangsCache, key)) {
4324
- const base = nextAvailableDefault();
4325
- if (base) {
4326
- unsupportedLangs.forEach(
4327
- ([key2, value]) => parts.push(`${base}.lang.${key2} = ${value}`)
4328
- );
4329
- unsupportedLangsCache[key] = `${base}.lang`;
4330
- }
4331
- }
4332
- if ((0, import_chunk_YCLY27QH.hasProperty)(unsupportedLangsCache, key)) {
4333
- keysToSkip = Object.fromEntries(unsupportedLangs);
4334
- parts.push(`${prefix}lang = $(${unsupportedLangsCache[key]})`);
4335
- }
4336
- }
4337
- Object.keys(qlang).forEach((key) => {
4338
- (0, import_chunk_YCLY27QH.hasProperty)(keysToSkip, key) || !(0, import_chunk_YCLY27QH.hasProperty)(languagesToInclude, key) || process_field(`${prefix}lang.`, qlang, key, relative_path);
4339
- });
4340
- }
4341
- });
4342
- promises.push(fs3.writeFile(jungleFiles, parts.join("\n")));
4343
- await Promise.all(promises);
4344
- } finally {
4345
- if (poolStarted) {
4346
- stopPool();
4347
- }
4348
- }
4349
- return {
4350
- jungleFiles,
4351
- xml,
4352
- program: path4.basename(path4.dirname(manifest)),
4353
- hasTests,
4354
- diagnostics
4355
- };
4356
- }
4357
- async function fileInfoFromConfig(workspace, output, buildConfig, extraExcludes) {
4358
- const paths = (await Promise.all(
4359
- buildConfig.sourcePath?.map(
4360
- (pattern) => (0, import_chunk_IAUHYWVN.globa)(pattern, { cwd: workspace, mark: true })
4361
- ) || []
4362
- )).flat();
4363
- const files = (await Promise.all(
4364
- paths.map(
4365
- (path5) => path5.endsWith("/") ? (0, import_chunk_IAUHYWVN.globa)(`${path5}**/*.mc`, { cwd: workspace, mark: true }) : path5
4366
- )
4367
- )).flat().filter(
4368
- (file) => file.endsWith(".mc") && !path4.relative(workspace, file).startsWith("bin") && (!buildConfig.sourceExcludes || !buildConfig.sourceExcludes.includes(file))
4369
- );
4370
- const excludeAnnotations = Object.assign(
4371
- buildConfig.excludeAnnotations ? Object.fromEntries(
4372
- buildConfig.excludeAnnotations.map((ex) => [ex, true])
4373
- ) : {},
4374
- extraExcludes
4375
- );
4376
- return {
4377
- fnMap: Object.fromEntries(
4378
- files.map((file) => [
4379
- file,
4380
- {
4381
- output: path4.join(
4382
- output,
4383
- relative_path_no_dotdot(path4.relative(workspace, file))
4384
- ),
4385
- excludeAnnotations
4386
- }
4387
- ])
4388
- ),
4389
- paths: paths.filter((path5) => path5.endsWith("/"))
4390
- };
4391
- }
4392
- function excludesFromAnnotations(barrel, annotations, resolvedBarrel) {
4393
- const excludes = resolvedBarrel.annotations ? Object.fromEntries(resolvedBarrel.annotations.map((a) => [a, true])) : {};
4394
- if (annotations && annotations[barrel]) {
4395
- annotations[barrel].forEach((a) => {
4396
- delete excludes[a];
4397
- });
4398
- }
4399
- return excludes;
4400
- }
4401
- async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, config) {
4402
- const { workspace } = config;
4403
- const output = path4.join(workspace, config.outputPath);
4404
- const buildModeExcludes = {
4405
- // note: exclude debug in release builds, and release in debug builds
4406
- [config.releaseBuild ? "debug" : "release"]: true
4407
- };
4408
- if (!config.testBuild) {
4409
- buildModeExcludes.test = true;
4410
- }
4411
- const resourcesMap = {};
4412
- if (buildConfig.resourceMap) {
4413
- resourcesMap[""] = buildConfig.resourceMap;
4414
- }
4415
- const { fnMap } = await fileInfoFromConfig(
4416
- workspace,
4417
- path4.join(output, "source"),
4418
- buildConfig,
4419
- buildModeExcludes
4420
- );
4421
- if (buildConfig.barrelMap) {
4422
- const barrelFnMaps = await Promise.all(
4423
- Object.entries(buildConfig.barrelMap).map(([barrel, resolvedBarrel]) => {
4424
- if (resolvedBarrel.resources) {
4425
- resourcesMap[barrel] = resolvedBarrel.resources;
4426
- }
4427
- dependencyFiles = dependencyFiles.concat(
4428
- resolvedBarrel.jungles,
4429
- resolvedBarrel.manifest
4430
- );
4431
- return fileInfoFromConfig(
4432
- path4.dirname(resolvedBarrel.jungles[0]),
4433
- path4.join(output, "barrels", barrel),
4434
- resolvedBarrel.qualifier,
4435
- {
4436
- ...buildModeExcludes,
4437
- ...excludesFromAnnotations(
4438
- barrel,
4439
- buildConfig.annotations,
4440
- resolvedBarrel
4441
- )
4442
- }
4443
- ).then(({ fnMap: fnMap2 }) => fnMap2);
4444
- }).flat()
4445
- );
4446
- barrelFnMaps.forEach((barrelFnMap) => Object.assign(fnMap, barrelFnMap));
4447
- }
4448
- const actualOptimizedFiles = (await (0, import_chunk_IAUHYWVN.globa)(path4.join(output, "**", "*.mc"), { mark: true })).filter((file) => !file.endsWith("/")).sort();
4449
- const {
4450
- hasTests,
4451
- diagnostics: prevDiagnostics,
4452
- ...prevOptions
4453
- } = JSON.parse(
4454
- await fs3.readFile(path4.join(output, "build-info.json"), "utf-8").catch(() => "{}")
4455
- );
4456
- if (hasTests != null && !config.checkBuildPragmas && configOptionsToCheck.every(
4457
- (option) => prevOptions[option] === config[option]
4458
- ) && actualOptimizedFiles.length === Object.values(fnMap).length && Object.values(fnMap).map((v) => v.output).sort().every((f, i) => f === actualOptimizedFiles[i])) {
4459
- const source_time = await (0, import_chunk_IAUHYWVN.last_modified)(
4460
- Object.keys(fnMap).concat(dependencyFiles)
4461
- );
4462
- const opt_time = await (0, import_chunk_IAUHYWVN.first_modified)(
4463
- Object.values(fnMap).map((v) => v.output)
4464
- );
4465
- if (source_time < opt_time && 1678298050134 < opt_time) {
4466
- return { hasTests, diagnostics: prevDiagnostics };
4467
- }
4468
- }
4469
- const [, , prettierConfig] = await Promise.all([
4470
- fs3.rm(output, { recursive: true, force: true }),
4471
- fs3.mkdir(output, { recursive: true }),
4472
- Prettier.resolveConfig(config.workspace, {
4473
- useCache: false,
4474
- editorconfig: true
4475
- })
4476
- ]);
4477
- return (0, import_chunk_YCLY27QH.optimizeMonkeyC)(fnMap, resourcesMap, manifestXML, config).then(
4478
- (diagnostics) => {
4479
- const options = { ...prettierConfig, ...config.prettier || {} };
4480
- return Promise.all(
4481
- Object.values(fnMap).map(async (info) => {
4482
- const name = info.output;
4483
- const dir = path4.dirname(name);
4484
- await fs3.mkdir(dir, { recursive: true });
4485
- options.filepath = name;
4486
- const opt_source = (0, import_chunk_YCLY27QH.formatAst)(info.ast, info.monkeyCSource, options);
4487
- await fs3.writeFile(name, opt_source);
4488
- return info.hasTests;
4489
- })
4490
- ).then((results) => {
4491
- const hasTests2 = results.some((v) => v);
4492
- return fs3.writeFile(
4493
- path4.join(output, "build-info.json"),
4494
- JSON.stringify({
4495
- hasTests: hasTests2,
4496
- diagnostics,
4497
- optimizerVersion: "1.1.18",
4498
- ...Object.fromEntries(
4499
- configOptionsToCheck.map((option) => [option, config[option]])
4500
- )
4501
- })
4502
- ).then(() => ({ hasTests: hasTests2, diagnostics }));
4503
- });
4504
- }
4505
- );
4506
- }
4507
- async function getProjectAnalysis(targets, analysis, manifestXML, options) {
4508
- const sourcePath = targets.map(({ qualifier: { sourcePath: sourcePath2, barrelMap } }) => {
4509
- let sp = sourcePath2 ? sourcePath2 : [];
4510
- if (barrelMap) {
4511
- Object.values(barrelMap).forEach(
4512
- (bm) => bm.qualifier.sourcePath && (sp = sp.concat(bm.qualifier.sourcePath))
4513
- );
4514
- }
4515
- return sp;
4516
- }).flat().sort().filter((s, i, arr) => !i || s !== arr[i - 1]);
4517
- const { fnMap, paths } = await fileInfoFromConfig(
4518
- options.workspace,
4519
- options.workspace,
4520
- { sourcePath },
4521
- {}
4522
- );
4523
- if (analysis) {
4524
- Object.entries(fnMap).forEach(([k, v]) => {
4525
- if ((0, import_chunk_YCLY27QH.hasProperty)(analysis.fnMap, k)) {
4526
- const old = analysis.fnMap[k];
4527
- if (old.monkeyCSource)
4528
- v.monkeyCSource = old.monkeyCSource;
4529
- if (old.ast)
4530
- v.ast = old.ast;
4531
- }
4532
- });
4533
- }
4534
- if (!await (0, import_chunk_YCLY27QH.getFileASTs)(fnMap)) {
4535
- return { fnMap, paths };
4536
- }
4537
- const resourcesMap = {};
4538
- const addResources = (name, resources) => {
4539
- if (!resources)
4540
- return;
4541
- if (!(0, import_chunk_YCLY27QH.hasProperty)(resourcesMap, name)) {
4542
- resourcesMap[name] = { ...resources };
4543
- } else {
4544
- Object.assign(resourcesMap[name], resources);
4545
- }
4546
- };
4547
- targets.forEach((target) => {
4548
- addResources("", target.qualifier.resourceMap);
4549
- if (target.qualifier.barrelMap) {
4550
- Object.entries(target.qualifier.barrelMap).forEach(
4551
- ([key, value]) => addResources(key, value.resources)
4552
- );
4553
- }
4554
- });
4555
- const state = await (0, import_chunk_YCLY27QH.analyze)(fnMap, resourcesMap, manifestXML, options);
4556
- (0, import_chunk_YCLY27QH.reportMissingSymbols)(state, options);
4557
- let typeMap = null;
4558
- if (state.config?.propagateTypes && state.config.trustDeclaredTypes && state.config.checkTypes !== "OFF" && Object.values(state.fnMap).every((ast) => ast != null)) {
4559
- const gistate = {
4560
- state,
4561
- stack: [],
4562
- typeChecker: state.config.typeCheckLevel?.toLowerCase() === "strict" ? import_chunk_YCLY27QH.subtypeOf : import_chunk_YCLY27QH.couldBeWeak,
4563
- checkTypes: state.config?.checkTypes || "WARNING"
4564
- };
4565
- state.pre = (node) => {
4566
- switch (node.type) {
4567
- case "FunctionDeclaration": {
4568
- const self = state.top().sn;
4569
- const istate = (0, import_chunk_YCLY27QH.buildTypeInfo)(state, self, false);
4570
- if (istate) {
4571
- istate.state = state;
4572
- istate.typeChecker = gistate.typeChecker;
4573
- istate.checkTypes = gistate.checkTypes;
4574
- (0, import_chunk_YCLY27QH.evaluate)(istate, node.body);
4575
- if (istate.typeMap) {
4576
- if (typeMap == null) {
4577
- typeMap = istate.typeMap;
4578
- } else {
4579
- istate.typeMap.forEach(
4580
- (value, key) => typeMap.set(key, value)
4581
- );
4582
- }
4583
- }
4584
- }
4585
- return [];
4586
- }
4587
- }
4588
- return null;
4589
- };
4590
- Object.values(state.fnMap).forEach((f) => {
4591
- (0, import_chunk_YCLY27QH.collectNamespaces)(f.ast, state);
4592
- });
4593
- delete state.pre;
4594
- }
4595
- return { fnMap, paths, state, typeMap };
4596
- }
4597
- async function generateApiMirTests(options) {
4598
- const config = { ...defaultConfig, ...options || {} };
4599
- const tests = [];
4600
- const api = await (0, import_chunk_YCLY27QH.getApiMapping)();
4601
- if (!api) {
4602
- throw new Error("Failed to read api.mir");
4603
- }
4604
- const findConstants = (node) => {
4605
- node.decls && Object.entries(node.decls).forEach(([key, decl]) => {
4606
- if (decl.length > 1)
4607
- throw `Bad decl length:${node.fullName}.${key}`;
4608
- if (decl.length !== 1)
4609
- return;
4610
- const d = decl[0];
4611
- if (d.type === "EnumStringMember" || d.type === "VariableDeclarator" && d.node.kind === "const") {
4612
- const init = (0, import_chunk_YCLY27QH.isStateNode)(d) ? d.node.init : d.init;
4613
- if (!init) {
4614
- throw new Error(`Missing init for ${node.fullName}.${key}`);
4615
- }
4616
- tests.push([`${node.fullName}.${key}`, (0, import_chunk_YCLY27QH.formatAst)(init)]);
4617
- } else if ((0, import_chunk_YCLY27QH.isStateNode)(d)) {
4618
- findConstants(d);
4619
- }
4620
- });
4621
- };
4622
- findConstants(api);
4623
- function hasTests(name) {
4624
- const names = name.split(".");
4625
- return names.map((t, i, arr) => arr.slice(0, i).join(".") + " has :" + t).slice(2).join(" && ");
4626
- }
4627
- const source = [
4628
- "import Toybox.Lang;",
4629
- "import Toybox.Test;",
4630
- "(:test,:typecheck(false))",
4631
- "function apiTest(logger as Logger) as Boolean {",
4632
- ...tests.map(
4633
- (t) => ` if (${hasTests(t[0])}) { if (${t[0]} != ${t[1]}) { logger.debug("${t[0]}: "+${t[0]}.toString()+" != ${t[1]}"); } } else { logger.debug("Not tested: ${t[0]}"); }`
4634
- ),
4635
- " return true;",
4636
- "}"
4637
- ].join("\n");
4638
- const workspace = config.workspace;
4639
- return fs3.writeFile(`${workspace}/source/apiTest.mc`, source);
4640
- }
4641
- var defaultConfig, configOptionsToCheck;
4642
- var init_optimizer = (0, import_chunk_IAUHYWVN.__esm)({
4643
- "src/optimizer.ts"() {
4644
- (0, import_chunk_YCLY27QH.init_api)();
4645
- init_build();
4646
- init_jungles();
4647
- init_launch();
4648
- init_manifest();
4649
- (0, import_chunk_YCLY27QH.init_mc_rewrite)();
4650
- (0, import_chunk_YCLY27QH.init_sdk_util)();
4651
- (0, import_chunk_YCLY27QH.init_type_flow)();
4652
- (0, import_chunk_YCLY27QH.init_could_be)();
4653
- (0, import_chunk_YCLY27QH.init_interp)();
4654
- (0, import_chunk_YCLY27QH.init_sub_type)();
4655
- (0, import_chunk_IAUHYWVN.init_util)();
4656
- init_worker_pool();
4657
- (0, import_chunk_YCLY27QH.init_optimizer_types)();
4658
- (0, import_chunk_YCLY27QH.init_types)();
4659
- defaultConfig = {
4660
- outputPath: "bin/optimized",
4661
- workspace: "./"
4662
- };
4663
- configOptionsToCheck = [
4664
- "workspace",
4665
- "releaseBuild",
4666
- "testBuild",
4667
- "checkManifest",
4668
- "ignoredExcludeAnnotations",
4669
- "ignoredAnnotations",
4670
- "ignoredSourcePaths",
4671
- "checkInvalidSymbols",
4672
- "checkCompilerLookupRules",
4673
- "checkTypes",
4674
- "sizeBasedPRE",
4675
- "trustDeclaredTypes",
4676
- "propagateTypes",
4677
- "singleUseCopyProp",
4678
- "minimizeLocals",
4679
- "minimizeModules",
4680
- "extensionVersion",
4681
- "typeCheckLevel",
4682
- "covarianceWarnings",
4683
- "iterateOptimizer"
4684
- ];
4685
- }
4686
- });
4687
- async function performTask(task) {
4688
- const type = task.type;
4689
- const handler = Object.prototype.hasOwnProperty.call(workerTaskHandlers, type) && workerTaskHandlers[type];
4690
- if (!handler) {
4691
- throw new Error(`Invalid task type ${type}`);
4692
- }
4693
- return handler(task.data);
4694
- }
4695
- var workerTaskHandlers;
4696
- var init_worker_task = (0, import_chunk_IAUHYWVN.__esm)({
4697
- "src/worker-task.ts"() {
4698
- "use strict";
4699
- init_optimizer();
4700
- (0, import_chunk_YCLY27QH.init_sdk_util)();
4701
- workerTaskHandlers = {
4702
- buildOptimizedProject(data) {
4703
- return buildOptimizedProject(data.product, data.options);
4704
- },
4705
- generateOptimizedProject(data) {
4706
- return generateOptimizedProject(data.options);
4707
- },
4708
- generateOneConfig(data) {
4709
- if (data.buildConfig.resourceMap) {
4710
- Object.values(data.buildConfig.resourceMap).forEach(
4711
- (doc) => Object.setPrototypeOf(doc, import_chunk_YCLY27QH.xml_util_exports.Document.prototype)
4712
- );
4713
- }
4714
- if (data.manifestXML) {
4715
- Object.setPrototypeOf(data.manifestXML, import_chunk_YCLY27QH.xml_util_exports.Document.prototype);
4716
- }
4717
- return generateOneConfig(
4718
- data.buildConfig,
4719
- data.manifestXML,
4720
- data.dependencyFiles,
4721
- data.config
4722
- );
4723
- }
4724
- };
4725
- }
4726
- });
4727
- function startPool(parallelism) {
4728
- if (pool)
4729
- return false;
4730
- if (!parallelism) {
4731
- parallelism = os.cpus().length;
4732
- parallelism = os.cpus().length / (parallelism > 4 ? 4 : 2);
4733
- }
4734
- const workers = Math.ceil(parallelism);
4735
- if (workers > 1) {
4736
- pool = new WorkerPool(workers);
4737
- }
4738
- return true;
4739
- }
4740
- function stopPool() {
4741
- if (pool) {
4742
- pool.close();
4743
- pool = null;
4744
- }
4745
- }
4746
- function runTaskInPool(task) {
4747
- const p = pool;
4748
- if (p) {
4749
- return new Promise(
4750
- (resolve5, reject) => p.runTask(task, (err, result) => {
4751
- if (err)
4752
- reject(err);
4753
- else
4754
- resolve5(result);
4755
- })
4756
- );
4757
- }
4758
- return performTask(task);
4759
- }
4760
- var kTaskInfo, kWorkerFreedEvent, WorkerPoolTaskInfo, WorkerPool, pool;
4761
- var init_worker_pool = (0, import_chunk_IAUHYWVN.__esm)({
4762
- "src/worker-pool.ts"() {
4763
- init_worker_task();
4764
- kTaskInfo = Symbol("kTaskInfo");
4765
- kWorkerFreedEvent = Symbol("kWorkerFreedEvent");
4766
- WorkerPoolTaskInfo = class extends import_node_async_hooks.AsyncResource {
4767
- constructor(callback) {
4768
- super("WorkerPoolTaskInfo");
4769
- this.callback = callback;
4770
- }
4771
- done(err, result) {
4772
- this.runInAsyncScope(this.callback, null, err, result);
4773
- this.emitDestroy();
4774
- }
4775
- };
4776
- WorkerPool = class extends import_node_events.EventEmitter {
4777
- constructor(numThreads) {
4778
- super();
4779
- this.numThreads = numThreads;
4780
- this.numThreads = numThreads;
4781
- this.workers = [];
4782
- this.freeWorkers = [];
4783
- this.tasks = [];
4784
- for (let i = 0; i < numThreads; i++)
4785
- this.addNewWorker();
4786
- this.on(kWorkerFreedEvent, () => {
4787
- if (this.tasks.length > 0) {
4788
- const { task, callback } = this.tasks.shift();
4789
- this.runTask(task, callback);
4790
- }
4791
- });
4792
- }
4793
- workers;
4794
- freeWorkers;
4795
- tasks;
4796
- addNewWorker() {
4797
- const worker = new import_node_worker_threads.Worker(
4798
- //new URL("worker-thread.cjs", import.meta.url)
4799
- `${__dirname}/worker-thread.cjs`
4800
- );
4801
- worker.on("message", (result) => {
4802
- worker[kTaskInfo].done(null, result);
4803
- worker[kTaskInfo] = null;
4804
- this.freeWorkers.push(worker);
4805
- this.emit(kWorkerFreedEvent);
4806
- });
4807
- worker.on("error", (err) => {
4808
- if (worker[kTaskInfo])
4809
- worker[kTaskInfo].done(err, null);
4810
- else
4811
- this.emit("error", err);
4812
- this.workers.splice(this.workers.indexOf(worker), 1);
4813
- this.addNewWorker();
4814
- });
4815
- this.workers.push(worker);
4816
- this.freeWorkers.push(worker);
4817
- this.emit(kWorkerFreedEvent);
4818
- }
4819
- runTask(task, callback) {
4820
- const worker = this.freeWorkers.pop();
4821
- if (!worker) {
4822
- this.tasks.push({ task, callback });
4823
- return;
4824
- }
4825
- worker[kTaskInfo] = new WorkerPoolTaskInfo(callback);
4826
- worker.postMessage(task);
4827
- }
4828
- close() {
4829
- for (const worker of this.workers)
4830
- worker.terminate();
4831
- }
4832
- };
4833
- pool = null;
4834
- }
4835
- });
4836
- // Annotate the CommonJS export names for ESM import in node:
4837
- 0 && (module.exports = {
4838
- buildOptimizedProject,
4839
- defaultConfig,
4840
- generateApiMirTests,
4841
- generateOneConfig,
4842
- generateOptimizedProject,
4843
- getConfig,
4844
- getProjectAnalysis,
4845
- get_jungle,
4846
- init_optimizer,
4847
- init_worker_pool,
4848
- init_worker_task,
4849
- isErrorWithLocation,
4850
- launchSimulator,
4851
- manifestProducts,
4852
- mctree,
4853
- performTask,
4854
- runTaskInPool,
4855
- simulateProgram,
4856
- startPool,
4857
- stopPool
4858
- });