@wix/dev-machine-monitor 1.0.9 → 1.0.10

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,6 +1,917 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // ../../node_modules/variant/lib/isType.js
28
+ var require_isType = __commonJS({
29
+ "../../node_modules/variant/lib/isType.js"(exports) {
30
+ "use strict";
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.isTypeImpl = void 0;
33
+ function isTypeImpl(key) {
34
+ function isType(instanceOrType, type) {
35
+ if (instanceOrType != void 0) {
36
+ if (typeof instanceOrType === "function" || typeof instanceOrType === "string") {
37
+ const typeArg = instanceOrType;
38
+ const typeStr = typeof typeArg === "string" ? typeArg : typeArg.output.type;
39
+ return (o) => isType(o, typeStr);
40
+ } else {
41
+ const instance = instanceOrType;
42
+ const typeStr = typeof type === "string" ? type : type.output.type;
43
+ return instance != void 0 && instance[key !== null && key !== void 0 ? key : "type"] === typeStr;
44
+ }
45
+ } else {
46
+ return false;
47
+ }
48
+ }
49
+ return { isType };
50
+ }
51
+ exports.isTypeImpl = isTypeImpl;
52
+ }
53
+ });
54
+
55
+ // ../../node_modules/variant/lib/util.js
56
+ var require_util = __commonJS({
57
+ "../../node_modules/variant/lib/util.js"(exports) {
58
+ "use strict";
59
+ Object.defineProperty(exports, "__esModule", { value: true });
60
+ exports.HOI = exports.isPromise = exports.identityFunc = void 0;
61
+ var identityFunc = (x = {}) => x;
62
+ exports.identityFunc = identityFunc;
63
+ function isPromise(x) {
64
+ return x != void 0 && typeof x === "object" && "then" in x && typeof x.then === "function";
65
+ }
66
+ exports.isPromise = isPromise;
67
+ var HOI = () => (definition) => definition;
68
+ exports.HOI = HOI;
69
+ }
70
+ });
71
+
72
+ // ../../node_modules/variant/lib/variant.js
73
+ var require_variant = __commonJS({
74
+ "../../node_modules/variant/lib/variant.js"(exports) {
75
+ "use strict";
76
+ Object.defineProperty(exports, "__esModule", { value: true });
77
+ exports.variantImpl = exports.isVariantCreator = exports.scopeType = void 0;
78
+ var util_1 = require_util();
79
+ var scopeType = (scope, type) => `${scope}/${type}`;
80
+ exports.scopeType = scopeType;
81
+ function descopeType(s) {
82
+ var _a;
83
+ return (_a = s.split("/")[1]) !== null && _a !== void 0 ? _a : s;
84
+ }
85
+ var VARIANT_CREATOR_BRAND = Symbol("Variant Creator");
86
+ function isVariantCreator(func) {
87
+ return VARIANT_CREATOR_BRAND in func;
88
+ }
89
+ exports.isVariantCreator = isVariantCreator;
90
+ function variantImpl(key) {
91
+ function scope(scope2, v) {
92
+ return Object.keys(v).reduce((acc, key2) => {
93
+ return Object.assign(Object.assign({}, acc), { [key2]: variation((0, exports.scopeType)(scope2, key2), typeof v[key2] === "function" ? v[key2] : util_1.identityFunc) });
94
+ }, {});
95
+ }
96
+ function descope(obj) {
97
+ return Object.assign(Object.assign({}, obj), { [key]: descopeType(obj[key]) });
98
+ }
99
+ function variation(type, creator) {
100
+ let maker = (...args) => {
101
+ const returned = (creator !== null && creator !== void 0 ? creator : util_1.identityFunc)(...args);
102
+ if ((0, util_1.isPromise)(returned)) {
103
+ return returned.then((result) => {
104
+ if (key in (result !== null && result !== void 0 ? result : {})) {
105
+ return result;
106
+ } else {
107
+ return Object.assign(result !== null && result !== void 0 ? result : {}, { [key]: type });
108
+ }
109
+ });
110
+ } else {
111
+ if (key in (returned !== null && returned !== void 0 ? returned : {})) {
112
+ return returned;
113
+ } else {
114
+ return Object.assign(returned !== null && returned !== void 0 ? returned : {}, { [key]: type });
115
+ }
116
+ }
117
+ };
118
+ Object.defineProperty(maker, "name", { value: type, writable: false });
119
+ const outputs = { output: { key, type } };
120
+ return Object.assign(maker, outputs, {
121
+ [VARIANT_CREATOR_BRAND]: VARIANT_CREATOR_BRAND,
122
+ toString: function() {
123
+ return this.output.type;
124
+ }
125
+ });
126
+ }
127
+ function variantModule(template) {
128
+ return Object.entries(template).reduce((result, [vmKey, vmVal]) => {
129
+ const creator = typeof vmVal === "function" ? isVariantCreator(vmVal) ? vmVal : variation(vmKey, vmVal) : variation(vmKey, util_1.identityFunc);
130
+ return Object.assign(Object.assign({}, result), { [vmKey]: creator });
131
+ }, {});
132
+ }
133
+ function variantList(template) {
134
+ return template.map((t) => {
135
+ if (typeof t === "string") {
136
+ return variation(t);
137
+ } else if (typeof t === "function") {
138
+ return t;
139
+ }
140
+ return t;
141
+ }).reduce((result, t) => {
142
+ let creator = typeof t === "string" ? variation(t) : t;
143
+ return Object.assign(Object.assign({}, result), { [creator.output.type]: creator });
144
+ }, {});
145
+ }
146
+ function variant2(template) {
147
+ if (Array.isArray(template)) {
148
+ return variantList(template);
149
+ } else {
150
+ return variantModule(template);
151
+ }
152
+ }
153
+ return { descope, scoped: scope, variant: variant2, variantList, variantModule, variation };
154
+ }
155
+ exports.variantImpl = variantImpl;
156
+ }
157
+ });
158
+
159
+ // ../../node_modules/variant/lib/precepts.js
160
+ var require_precepts = __commonJS({
161
+ "../../node_modules/variant/lib/precepts.js"(exports) {
162
+ "use strict";
163
+ Object.defineProperty(exports, "__esModule", { value: true });
164
+ exports.DEFAULT_KEY = void 0;
165
+ exports.DEFAULT_KEY = "default";
166
+ }
167
+ });
168
+
169
+ // ../../node_modules/variant/lib/match.js
170
+ var require_match = __commonJS({
171
+ "../../node_modules/variant/lib/match.js"(exports) {
172
+ "use strict";
173
+ Object.defineProperty(exports, "__esModule", { value: true });
174
+ exports.matchImpl = void 0;
175
+ var variant_1 = require_variant();
176
+ var precepts_1 = require_precepts();
177
+ function matchImpl(key) {
178
+ const prematch = (_) => (handler) => (instance) => match2(instance, handler);
179
+ function match2(...args) {
180
+ var _a, _b;
181
+ if (args.length === 1) {
182
+ const [handler] = args;
183
+ return (instance) => match2(instance, handler);
184
+ } else if (args.length === 2) {
185
+ const [instanceOrTypeOrCreator, handlerParam] = args;
186
+ const instanceOrCreator = typeof instanceOrTypeOrCreator === "string" ? ofLiteral(instanceOrTypeOrCreator) : instanceOrTypeOrCreator;
187
+ const handler = typeof handlerParam === "function" ? handlerParam(instanceOrCreator) : handlerParam;
188
+ const tType = instanceOrCreator == void 0 ? void 0 : (0, variant_1.isVariantCreator)(instanceOrCreator) ? instanceOrCreator.output.type : instanceOrCreator[key];
189
+ if (instanceOrCreator != void 0 && tType !== void 0 && tType in handler) {
190
+ return (_a = handler[tType]) === null || _a === void 0 ? void 0 : _a.call(handler, instanceOrCreator);
191
+ } else if (precepts_1.DEFAULT_KEY in handler) {
192
+ return (_b = handler[precepts_1.DEFAULT_KEY]) === null || _b === void 0 ? void 0 : _b.call(handler, instanceOrCreator);
193
+ }
194
+ }
195
+ }
196
+ const partial = (h) => () => h;
197
+ const onLiteral = ofLiteral;
198
+ function ofLiteral(instance) {
199
+ return {
200
+ [key]: instance
201
+ };
202
+ }
203
+ function lookup(handler) {
204
+ const handlerWithFuncs = Object.keys(handler).reduce((acc, cur) => {
205
+ return Object.assign(Object.assign({}, acc), { [cur]: () => handler[cur] });
206
+ }, {});
207
+ return (_) => handlerWithFuncs;
208
+ }
209
+ function otherwise(branches, elseFunc) {
210
+ return (_) => Object.assign(Object.assign({}, branches), { default: elseFunc });
211
+ }
212
+ function withFallback(handler, fallback) {
213
+ return (_) => Object.assign(Object.assign({}, handler), { default: fallback });
214
+ }
215
+ return { match: match2, ofLiteral, onLiteral, otherwise, partial, prematch, lookup, withFallback };
216
+ }
217
+ exports.matchImpl = matchImpl;
218
+ }
219
+ });
220
+
221
+ // ../../node_modules/variant/lib/types.js
222
+ var require_types = __commonJS({
223
+ "../../node_modules/variant/lib/types.js"(exports) {
224
+ "use strict";
225
+ Object.defineProperty(exports, "__esModule", { value: true });
226
+ exports.typesImpl = void 0;
227
+ var variant_1 = require_variant();
228
+ function typesImpl(key) {
229
+ function types(content) {
230
+ if (Array.isArray(content)) {
231
+ if (content.length && (0, variant_1.isVariantCreator)(content[0])) {
232
+ return content.map((c) => c.output.type);
233
+ } else {
234
+ return content.map((c) => c[key]);
235
+ }
236
+ } else {
237
+ return Object.values(content).map((c) => c.output.type);
238
+ }
239
+ }
240
+ function inferTypes(_) {
241
+ return new Proxy({}, {
242
+ get: (_2, property) => {
243
+ return property;
244
+ }
245
+ });
246
+ }
247
+ return { types, inferTypes };
248
+ }
249
+ exports.typesImpl = typesImpl;
250
+ }
251
+ });
252
+
253
+ // ../../node_modules/variant/lib/flags.js
254
+ var require_flags = __commonJS({
255
+ "../../node_modules/variant/lib/flags.js"(exports) {
256
+ "use strict";
257
+ Object.defineProperty(exports, "__esModule", { value: true });
258
+ exports.flagsImpl = void 0;
259
+ function flagsImpl(key) {
260
+ function flags(flags2) {
261
+ return flags2.reduce((o, v) => Object.assign(Object.assign({}, o), { [v[key]]: v }), /* @__PURE__ */ Object.create(null));
262
+ }
263
+ return { flags };
264
+ }
265
+ exports.flagsImpl = flagsImpl;
266
+ }
267
+ });
268
+
269
+ // ../../node_modules/variant/lib/isOfVariant.js
270
+ var require_isOfVariant = __commonJS({
271
+ "../../node_modules/variant/lib/isOfVariant.js"(exports) {
272
+ "use strict";
273
+ Object.defineProperty(exports, "__esModule", { value: true });
274
+ exports.isOfVariantImpl = void 0;
275
+ function isOfVariantImpl(key) {
276
+ function isOfVariant(...args) {
277
+ if (args.length === 1) {
278
+ const [variant2] = args;
279
+ return (instance) => instance != void 0 && Object.values(variant2).some((vc) => vc.output.type === instance[key]);
280
+ } else if (args.length === 2) {
281
+ const [instance, variant2] = args;
282
+ return instance != void 0 && Object.values(variant2).some((vc) => vc.output.type === instance[key]);
283
+ }
284
+ return false;
285
+ }
286
+ return { isOfVariant };
287
+ }
288
+ exports.isOfVariantImpl = isOfVariantImpl;
289
+ }
290
+ });
291
+
292
+ // ../../node_modules/variant/lib/remote.js
293
+ var require_remote = __commonJS({
294
+ "../../node_modules/variant/lib/remote.js"(exports) {
295
+ "use strict";
296
+ Object.defineProperty(exports, "__esModule", { value: true });
297
+ exports.remoteImpl = exports.CompareResult = void 0;
298
+ var isType_1 = require_isType();
299
+ var match_1 = require_match();
300
+ var variant_1 = require_variant();
301
+ var CompareResult;
302
+ (function(CompareResult2) {
303
+ CompareResult2[CompareResult2["Lesser"] = -1] = "Lesser";
304
+ CompareResult2[CompareResult2["Equal"] = 0] = "Equal";
305
+ CompareResult2[CompareResult2["Greater"] = 1] = "Greater";
306
+ })(CompareResult = exports.CompareResult || (exports.CompareResult = {}));
307
+ function remoteImpl(key) {
308
+ const { isType } = (0, isType_1.isTypeImpl)(key);
309
+ const { match: match2 } = (0, match_1.matchImpl)(key);
310
+ const { variantList } = (0, variant_1.variantImpl)(key);
311
+ function isFunctions(vmod) {
312
+ const keys = Object.keys(vmod);
313
+ return keys.reduce((acc, key2) => {
314
+ return Object.assign(Object.assign({}, acc), { [key2]: isType(key2) });
315
+ }, {});
316
+ }
317
+ function remote(vmod) {
318
+ return {
319
+ key,
320
+ is: isFunctions(vmod),
321
+ new: vmod,
322
+ match: match2
323
+ };
324
+ }
325
+ ;
326
+ function getType(input) {
327
+ if (typeof input === "string") {
328
+ return input;
329
+ } else if (typeof input === "function") {
330
+ return input.output.type;
331
+ } else {
332
+ return input[key];
333
+ }
334
+ }
335
+ function _sequence(module2, order) {
336
+ const miniModule = module2;
337
+ const result = remote(miniModule);
338
+ const keyOrder = order.map(getType);
339
+ return Object.assign(Object.assign({}, result), { length: order.length, compare: (a, b) => {
340
+ const ai = keyOrder.findIndex((i) => i === getType(a));
341
+ const bi = keyOrder.findIndex((i) => i === getType(b));
342
+ const diff = ai - bi;
343
+ return diff === 0 ? diff : diff / Math.abs(diff);
344
+ }, get(i) {
345
+ const type = this.types[i];
346
+ return this.new[type];
347
+ }, index: (a) => keyOrder.findIndex((i) => i === getType(a)), types: keyOrder });
348
+ }
349
+ function _sequenceOfList(order) {
350
+ const module2 = variantList(order);
351
+ return _sequence(module2, order);
352
+ }
353
+ function sequence(module2, order) {
354
+ if (Array.isArray(module2)) {
355
+ return _sequenceOfList(module2);
356
+ } else {
357
+ return _sequence(module2, order);
358
+ }
359
+ }
360
+ return { remote, sequence };
361
+ }
362
+ exports.remoteImpl = remoteImpl;
363
+ }
364
+ });
365
+
366
+ // ../../node_modules/variant/lib/typed.js
367
+ var require_typed = __commonJS({
368
+ "../../node_modules/variant/lib/typed.js"(exports) {
369
+ "use strict";
370
+ Object.defineProperty(exports, "__esModule", { value: true });
371
+ exports.typedImpl = exports.pass = void 0;
372
+ var pass = (x) => x;
373
+ exports.pass = pass;
374
+ function typedImpl(_key) {
375
+ function typed(defOrFactory) {
376
+ if (typeof defOrFactory === "function") {
377
+ return defOrFactory(exports.pass);
378
+ } else {
379
+ return defOrFactory;
380
+ }
381
+ }
382
+ return { typed };
383
+ }
384
+ exports.typedImpl = typedImpl;
385
+ }
386
+ });
387
+
388
+ // ../../node_modules/variant/lib/match.tools.js
389
+ var require_match_tools = __commonJS({
390
+ "../../node_modules/variant/lib/match.tools.js"(exports) {
391
+ "use strict";
392
+ Object.defineProperty(exports, "__esModule", { value: true });
393
+ exports.unpack = exports.just = exports.constant = void 0;
394
+ function constant(x) {
395
+ return () => x;
396
+ }
397
+ exports.constant = constant;
398
+ exports.just = constant;
399
+ var unpack = (x) => x.payload;
400
+ exports.unpack = unpack;
401
+ }
402
+ });
403
+
404
+ // ../../node_modules/variant/lib/matcher.js
405
+ var require_matcher = __commonJS({
406
+ "../../node_modules/variant/lib/matcher.js"(exports) {
407
+ "use strict";
408
+ Object.defineProperty(exports, "__esModule", { value: true });
409
+ exports.matcherImpl = exports.Matcher = exports.tableToHandler = void 0;
410
+ var match_tools_1 = require_match_tools();
411
+ var variant_1 = require_variant();
412
+ function tableToHandler(table) {
413
+ return Object.keys(table).reduce((acc, cur) => {
414
+ const key = cur;
415
+ return Object.assign(Object.assign({}, acc), { [key]: (0, match_tools_1.just)(table[key]) });
416
+ }, {});
417
+ }
418
+ exports.tableToHandler = tableToHandler;
419
+ var Matcher = class _Matcher {
420
+ /**
421
+ * Create a new matcher from the target
422
+ * @param target the
423
+ * @param handler the initial handler. Use `{}` for standard functionality.
424
+ * @param key the discriminant. Use `'type'` for standard functionality.
425
+ */
426
+ constructor(target, key, handler) {
427
+ this.target = target;
428
+ this.key = key;
429
+ this.handler = handler;
430
+ this.complete = ((options) => {
431
+ var _a, _b;
432
+ if (this.target != void 0 && this.target[this.key] in this.handler) {
433
+ return (_b = (_a = this.handler)[this.target[this.key]]) === null || _b === void 0 ? void 0 : _b.call(_a, this.target);
434
+ } else {
435
+ if ((options === null || options === void 0 ? void 0 : options.withFallback) != void 0) {
436
+ return options.withFallback(this.target);
437
+ }
438
+ }
439
+ });
440
+ }
441
+ /**
442
+ * Immediately execute the matcher. Exhaustiveness is not guaranteed.
443
+ *
444
+ * This is a **terminal** and resolves the matcher.
445
+ */
446
+ execute() {
447
+ const chosenHandler = this.handler[this.target[this.key]];
448
+ return chosenHandler === null || chosenHandler === void 0 ? void 0 : chosenHandler(this.target);
449
+ }
450
+ /**
451
+ * Handle all unhandled cases and immediately execute.
452
+ *
453
+ * > **Exhaust** — to consume entirely, _Merriam-Webster_
454
+ *
455
+ * This is a **terminal** and resolves the matcher.
456
+ * @param remainingCases an object wiht a method to handle every remaining case.
457
+ * @returns the result of executing the handler, given these final additions.
458
+ */
459
+ exhaust(remainingCases) {
460
+ var _a;
461
+ const combinedHandler = Object.assign(Object.assign({}, this.handler), remainingCases);
462
+ return (_a = combinedHandler[this.target[this.key]]) === null || _a === void 0 ? void 0 : _a.call(combinedHandler, this.target);
463
+ }
464
+ /**
465
+ * Resolve all remaining cases without executing the matcher.
466
+ * @param remainingCases
467
+ * @returns
468
+ */
469
+ remaining(remainingCases) {
470
+ return new _Matcher(this.target, this.key, Object.assign(Object.assign({}, this.handler), remainingCases));
471
+ }
472
+ /**
473
+ * Execute the match. If the target type has been explicitly handled, use that logic.
474
+ * Otherwise use the function passed here.
475
+ *
476
+ * This is a **terminal** and resolves the matcher.
477
+ * @param func
478
+ * @returns
479
+ */
480
+ else(func) {
481
+ var _a, _b;
482
+ if (this.target[this.key] in this.handler) {
483
+ return (_b = (_a = this.handler)[this.target[this.key]]) === null || _b === void 0 ? void 0 : _b.call(_a, this.target);
484
+ } else {
485
+ return func(this.target);
486
+ }
487
+ }
488
+ /**
489
+ * Register a series of options as a lookup table.
490
+ *
491
+ * ```ts
492
+ * const getSound = (a: Animal) => matcher(a)
493
+ * .register({
494
+ * cat: 'purr',
495
+ * dog: 'woof',
496
+ * snake: 'hiss',
497
+ * })
498
+ * .complete()
499
+ * ```
500
+ * @param table
501
+ * @returns
502
+ */
503
+ register(table) {
504
+ const newHandler = Object.assign(Object.assign({}, this.handler), tableToHandler(table));
505
+ return new _Matcher(this.target, this.key, newHandler);
506
+ }
507
+ /**
508
+ * Provide an exhaustive table of the unhandled options and look up which value
509
+ * to use based on the instance.
510
+ *
511
+ * This is a **terminal** and resolves the matcher.
512
+ *
513
+ * ```ts
514
+ * const getSound = (a: Animal) => matcher(a)
515
+ * .lookup({
516
+ * cat: 'purr',
517
+ * dog: 'woof',
518
+ * snake: 'hiss',
519
+ * })
520
+ * ```
521
+ * @param table
522
+ * @returns
523
+ */
524
+ lookup(table) {
525
+ var _a;
526
+ const combinedHandler = Object.assign(Object.assign({}, this.handler), tableToHandler(table));
527
+ return (_a = combinedHandler[this.target[this.key]]) === null || _a === void 0 ? void 0 : _a.call(combinedHandler, this.target);
528
+ }
529
+ /**
530
+ * Handle one or more cases, object-style.
531
+ * @param variations
532
+ */
533
+ with(variations) {
534
+ return new _Matcher(this.target, this.key, Object.assign(Object.assign({}, this.handler), variations));
535
+ }
536
+ // actual implementation
537
+ when(variations, handler) {
538
+ if (handler != void 0) {
539
+ const list = Array.isArray(variations) ? variations : [variations];
540
+ const newCases = list.reduce((acc, cur) => {
541
+ const type = typeof cur === "string" ? cur : (0, variant_1.isVariantCreator)(cur) ? cur.output.type : void 0;
542
+ return type != void 0 ? Object.assign(Object.assign({}, acc), { [type]: handler }) : acc;
543
+ }, {});
544
+ return new _Matcher(this.target, this.key, Object.assign(Object.assign({}, this.handler), newCases));
545
+ } else {
546
+ return new _Matcher(this.target, this.key, Object.assign(Object.assign({}, this.handler), variations));
547
+ }
548
+ }
549
+ };
550
+ exports.Matcher = Matcher;
551
+ function matcherImpl(key) {
552
+ function matcher(target) {
553
+ const actualTarget = typeof target === "string" ? { [key]: target } : target;
554
+ return new Matcher(actualTarget, key, {});
555
+ }
556
+ return { matcher };
557
+ }
558
+ exports.matcherImpl = matcherImpl;
559
+ }
560
+ });
561
+
562
+ // ../../node_modules/variant/lib/cosmos.js
563
+ var require_cosmos = __commonJS({
564
+ "../../node_modules/variant/lib/cosmos.js"(exports) {
565
+ "use strict";
566
+ Object.defineProperty(exports, "__esModule", { value: true });
567
+ exports.variantCosmos = void 0;
568
+ var isType_1 = require_isType();
569
+ var match_1 = require_match();
570
+ var variant_1 = require_variant();
571
+ var types_1 = require_types();
572
+ var flags_1 = require_flags();
573
+ var isOfVariant_1 = require_isOfVariant();
574
+ var remote_1 = require_remote();
575
+ var typed_1 = require_typed();
576
+ var matcher_1 = require_matcher();
577
+ function variantCosmos({ key }) {
578
+ const { isType } = (0, isType_1.isTypeImpl)(key);
579
+ const { flags } = (0, flags_1.flagsImpl)(key);
580
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
581
+ key,
582
+ isType,
583
+ flags
584
+ }, (0, isOfVariant_1.isOfVariantImpl)(key)), (0, match_1.matchImpl)(key)), (0, matcher_1.matcherImpl)(key)), (0, remote_1.remoteImpl)(key)), (0, typed_1.typedImpl)(key)), (0, types_1.typesImpl)(key)), (0, variant_1.variantImpl)(key));
585
+ }
586
+ exports.variantCosmos = variantCosmos;
587
+ }
588
+ });
589
+
590
+ // ../../node_modules/variant/lib/type/index.js
591
+ var require_type = __commonJS({
592
+ "../../node_modules/variant/lib/type/index.js"(exports) {
593
+ "use strict";
594
+ var _a;
595
+ Object.defineProperty(exports, "__esModule", { value: true });
596
+ exports.withFallback = exports.variation = exports.variantModule = exports.variantList = exports.variant = exports.types = exports.typed = exports.lookup = exports.sequence = exports.scoped = exports.remote = exports.prematch = exports.partial = exports.otherwise = exports.onLiteral = exports.ofLiteral = exports.matcher = exports.match = exports.isType = exports.isOfVariant = exports.inferTypes = exports.flags = exports.descope = void 0;
597
+ var cosmos_1 = require_cosmos();
598
+ _a = (0, cosmos_1.variantCosmos)({ key: "type" }), exports.descope = _a.descope, exports.flags = _a.flags, exports.inferTypes = _a.inferTypes, exports.isOfVariant = _a.isOfVariant, exports.isType = _a.isType, exports.match = _a.match, exports.matcher = _a.matcher, exports.ofLiteral = _a.ofLiteral, exports.onLiteral = _a.onLiteral, exports.otherwise = _a.otherwise, exports.partial = _a.partial, exports.prematch = _a.prematch, exports.remote = _a.remote, exports.scoped = _a.scoped, exports.sequence = _a.sequence, exports.lookup = _a.lookup, exports.typed = _a.typed, exports.types = _a.types, exports.variant = _a.variant, exports.variantList = _a.variantList, exports.variantModule = _a.variantModule, exports.variation = _a.variation, exports.withFallback = _a.withFallback;
599
+ }
600
+ });
601
+
602
+ // ../../node_modules/variant/lib/augment.js
603
+ var require_augment = __commonJS({
604
+ "../../node_modules/variant/lib/augment.js"(exports) {
605
+ "use strict";
606
+ Object.defineProperty(exports, "__esModule", { value: true });
607
+ exports.augment = void 0;
608
+ var type_1 = require_type();
609
+ var variant_1 = require_variant();
610
+ function augment(variantDefinition, f) {
611
+ return Object.keys(variantDefinition).reduce((acc, key) => {
612
+ let inputFunc = variantDefinition[key];
613
+ let returnFunc = (0, variant_1.isVariantCreator)(inputFunc) ? (0, type_1.variation)(inputFunc.output.type, (...args) => {
614
+ let result = inputFunc(...args);
615
+ return Object.assign(Object.assign({}, f(result)), result);
616
+ }) : (...args) => {
617
+ const branch = variantDefinition[key];
618
+ let item = typeof branch === "function" ? branch(...args) : {};
619
+ return Object.assign(Object.assign({}, f(item)), item);
620
+ };
621
+ return Object.assign(Object.assign({}, acc), { [key]: returnFunc });
622
+ }, {});
623
+ }
624
+ exports.augment = augment;
625
+ }
626
+ });
627
+
628
+ // ../../node_modules/variant/lib/constrained.js
629
+ var require_constrained = __commonJS({
630
+ "../../node_modules/variant/lib/constrained.js"(exports) {
631
+ "use strict";
632
+ Object.defineProperty(exports, "__esModule", { value: true });
633
+ exports.constrained = void 0;
634
+ function constrained(_constraint_, v) {
635
+ return v;
636
+ }
637
+ exports.constrained = constrained;
638
+ }
639
+ });
640
+
641
+ // ../../node_modules/variant/lib/construct.js
642
+ var require_construct = __commonJS({
643
+ "../../node_modules/variant/lib/construct.js"(exports) {
644
+ "use strict";
645
+ Object.defineProperty(exports, "__esModule", { value: true });
646
+ exports.construct = void 0;
647
+ function construct(cls) {
648
+ return ((...args) => new cls(args));
649
+ }
650
+ exports.construct = construct;
651
+ }
652
+ });
653
+
654
+ // ../../node_modules/variant/lib/generic.js
655
+ var require_generic = __commonJS({
656
+ "../../node_modules/variant/lib/generic.js"(exports) {
657
+ "use strict";
658
+ Object.defineProperty(exports, "__esModule", { value: true });
659
+ exports.Alpha = exports.onTerms = void 0;
660
+ var flags_1 = require_flags();
661
+ var variant_1 = require_variant();
662
+ var GENERIC_BRAND = Symbol("VARIANT GENERIC TEMPLATE");
663
+ function onTerms(func) {
664
+ return Object.assign(Object.assign({}, func(exports.Alpha)), { [GENERIC_BRAND]: void 0 });
665
+ }
666
+ exports.onTerms = onTerms;
667
+ var GTERM = "__term";
668
+ var genericTerms = (0, variant_1.variantImpl)(GTERM).variant;
669
+ var flags = (0, flags_1.flagsImpl)(GTERM).flags;
670
+ var GP = genericTerms([
671
+ "A",
672
+ "B",
673
+ "C",
674
+ "D",
675
+ "E",
676
+ "F",
677
+ "G",
678
+ "H",
679
+ "I",
680
+ "J",
681
+ "K",
682
+ "L",
683
+ "M",
684
+ "N",
685
+ "O",
686
+ "P",
687
+ "Q",
688
+ "R",
689
+ "S",
690
+ "T",
691
+ "U",
692
+ "V",
693
+ "W",
694
+ "X",
695
+ "Y",
696
+ "Z"
697
+ ]);
698
+ exports.Alpha = flags(Object.values(GP).map((f) => f()));
699
+ }
700
+ });
701
+
702
+ // ../../node_modules/variant/lib/typeCatalog.js
703
+ var require_typeCatalog = __commonJS({
704
+ "../../node_modules/variant/lib/typeCatalog.js"(exports) {
705
+ "use strict";
706
+ Object.defineProperty(exports, "__esModule", { value: true });
707
+ exports.typeMap = exports.typeCatalog = void 0;
708
+ function typeCatalog(variant2) {
709
+ return Object.values(variant2).reduce((result, vc) => {
710
+ return Object.assign(Object.assign({}, result), { [vc.output.type]: vc.output.type });
711
+ }, {});
712
+ }
713
+ exports.typeCatalog = typeCatalog;
714
+ function typeMap(variant2) {
715
+ return Object.keys(variant2).reduce((result, key) => {
716
+ return Object.assign(Object.assign({}, result), { [key]: variant2[key].output.type });
717
+ }, {});
718
+ }
719
+ exports.typeMap = typeMap;
720
+ }
721
+ });
722
+
723
+ // ../../node_modules/variant/lib/catalog.js
724
+ var require_catalog = __commonJS({
725
+ "../../node_modules/variant/lib/catalog.js"(exports) {
726
+ "use strict";
727
+ Object.defineProperty(exports, "__esModule", { value: true });
728
+ exports.literalist = exports.catalog = void 0;
729
+ function catalog(catalog2, factory) {
730
+ if (Array.isArray(catalog2)) {
731
+ return catalog2.reduce((result, current, index) => {
732
+ return Object.assign(Object.assign({}, result), { [current]: factory != void 0 ? factory(current, index) : current });
733
+ }, {});
734
+ } else {
735
+ return catalog2;
736
+ }
737
+ }
738
+ exports.catalog = catalog;
739
+ exports.literalist = catalog;
740
+ }
741
+ });
742
+
743
+ // ../../node_modules/variant/lib/patterned.js
744
+ var require_patterned = __commonJS({
745
+ "../../node_modules/variant/lib/patterned.js"(exports) {
746
+ "use strict";
747
+ Object.defineProperty(exports, "__esModule", { value: true });
748
+ exports.patterned = void 0;
749
+ function patterned(_constraint_, v) {
750
+ return v;
751
+ }
752
+ exports.patterned = patterned;
753
+ }
754
+ });
755
+
756
+ // ../../node_modules/variant/lib/variant.tools.js
757
+ var require_variant_tools = __commonJS({
758
+ "../../node_modules/variant/lib/variant.tools.js"(exports) {
759
+ "use strict";
760
+ Object.defineProperty(exports, "__esModule", { value: true });
761
+ exports.nil = exports.payload = exports.fields = void 0;
762
+ function fields(defaults = {}) {
763
+ return (...args) => {
764
+ const [arg] = args;
765
+ return Object.assign(Object.assign({}, defaults), arg);
766
+ };
767
+ }
768
+ exports.fields = fields;
769
+ function payload(_example) {
770
+ return (payload2) => ({ payload: payload2 });
771
+ }
772
+ exports.payload = payload;
773
+ var nil = () => ({});
774
+ exports.nil = nil;
775
+ }
776
+ });
777
+
778
+ // ../../node_modules/variant/lib/slim.js
779
+ var require_slim = __commonJS({
780
+ "../../node_modules/variant/lib/slim.js"(exports) {
781
+ "use strict";
782
+ Object.defineProperty(exports, "__esModule", { value: true });
783
+ exports.payload = exports.nil = exports.fields = exports.HOI = exports.pass = exports.patterned = exports.unpack = exports.just = exports.constant = exports.literalist = exports.catalog = exports.typeCatalog = exports.typeMap = exports.onTerms = exports.variantCosmos = exports.construct = exports.constrained = exports.augment = void 0;
784
+ var augment_1 = require_augment();
785
+ Object.defineProperty(exports, "augment", { enumerable: true, get: function() {
786
+ return augment_1.augment;
787
+ } });
788
+ var constrained_1 = require_constrained();
789
+ Object.defineProperty(exports, "constrained", { enumerable: true, get: function() {
790
+ return constrained_1.constrained;
791
+ } });
792
+ var construct_1 = require_construct();
793
+ Object.defineProperty(exports, "construct", { enumerable: true, get: function() {
794
+ return construct_1.construct;
795
+ } });
796
+ var cosmos_1 = require_cosmos();
797
+ Object.defineProperty(exports, "variantCosmos", { enumerable: true, get: function() {
798
+ return cosmos_1.variantCosmos;
799
+ } });
800
+ var generic_1 = require_generic();
801
+ Object.defineProperty(exports, "onTerms", { enumerable: true, get: function() {
802
+ return generic_1.onTerms;
803
+ } });
804
+ var typeCatalog_1 = require_typeCatalog();
805
+ Object.defineProperty(exports, "typeMap", { enumerable: true, get: function() {
806
+ return typeCatalog_1.typeMap;
807
+ } });
808
+ Object.defineProperty(exports, "typeCatalog", { enumerable: true, get: function() {
809
+ return typeCatalog_1.typeCatalog;
810
+ } });
811
+ var catalog_1 = require_catalog();
812
+ Object.defineProperty(exports, "catalog", { enumerable: true, get: function() {
813
+ return catalog_1.catalog;
814
+ } });
815
+ Object.defineProperty(exports, "literalist", { enumerable: true, get: function() {
816
+ return catalog_1.literalist;
817
+ } });
818
+ var match_tools_1 = require_match_tools();
819
+ Object.defineProperty(exports, "constant", { enumerable: true, get: function() {
820
+ return match_tools_1.constant;
821
+ } });
822
+ Object.defineProperty(exports, "just", { enumerable: true, get: function() {
823
+ return match_tools_1.just;
824
+ } });
825
+ Object.defineProperty(exports, "unpack", { enumerable: true, get: function() {
826
+ return match_tools_1.unpack;
827
+ } });
828
+ var patterned_1 = require_patterned();
829
+ Object.defineProperty(exports, "patterned", { enumerable: true, get: function() {
830
+ return patterned_1.patterned;
831
+ } });
832
+ var typed_1 = require_typed();
833
+ Object.defineProperty(exports, "pass", { enumerable: true, get: function() {
834
+ return typed_1.pass;
835
+ } });
836
+ var util_1 = require_util();
837
+ Object.defineProperty(exports, "HOI", { enumerable: true, get: function() {
838
+ return util_1.HOI;
839
+ } });
840
+ var variant_tools_1 = require_variant_tools();
841
+ Object.defineProperty(exports, "fields", { enumerable: true, get: function() {
842
+ return variant_tools_1.fields;
843
+ } });
844
+ Object.defineProperty(exports, "nil", { enumerable: true, get: function() {
845
+ return variant_tools_1.nil;
846
+ } });
847
+ Object.defineProperty(exports, "payload", { enumerable: true, get: function() {
848
+ return variant_tools_1.payload;
849
+ } });
850
+ }
851
+ });
852
+
853
+ // ../../node_modules/variant/lib/index.js
854
+ var require_lib = __commonJS({
855
+ "../../node_modules/variant/lib/index.js"(exports) {
856
+ "use strict";
857
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
858
+ if (k2 === void 0) k2 = k;
859
+ Object.defineProperty(o, k2, { enumerable: true, get: function() {
860
+ return m[k];
861
+ } });
862
+ }) : (function(o, m, k, k2) {
863
+ if (k2 === void 0) k2 = k;
864
+ o[k2] = m[k];
865
+ }));
866
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
867
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
868
+ };
869
+ Object.defineProperty(exports, "__esModule", { value: true });
870
+ __exportStar(require_slim(), exports);
871
+ __exportStar(require_type(), exports);
872
+ }
873
+ });
874
+
875
+ // lib/config.ts
876
+ var import_variant = __toESM(require_lib(), 1);
877
+ import process from "node:process";
878
+ import { join } from "node:path";
879
+ import { existsSync, readFileSync } from "node:fs";
880
+
881
+ // lib/templates/error-server.html
882
+ var error_server_default = '<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width,initial-scale=1" />\n <title>Development Server Crashed</title>\n <style>\n :root {\n --bg: #0f1724;\n --card: #0b1220;\n --accent: #7dd3fc;\n --muted: #94a3b8;\n --glass: rgba(255, 255, 255, 0.04);\n --radius: 16px;\n color-scheme: light dark;\n }\n * {\n box-sizing: border-box;\n }\n html,\n body {\n height: 100%;\n }\n body {\n margin: 0;\n font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI",\n Roboto, "Helvetica Neue", Arial;\n background: radial-gradient(\n 1200px 600px at 10% 10%,\n rgba(125, 211, 252, 0.06),\n transparent\n ),\n linear-gradient(180deg, var(--bg), #071025 80%);\n color: #e6eef8;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 32px;\n }\n\n .card {\n width: min(980px, 100%);\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, 0.02),\n rgba(255, 255, 255, 0.01)\n );\n border: 1px solid rgba(255, 255, 255, 0.04);\n border-radius: var(--radius);\n padding: 32px;\n display: grid;\n grid-template-columns: 300px 1fr;\n gap: 24px;\n align-items: center;\n box-shadow: 0 8px 40px rgba(2, 6, 23, 0.6);\n }\n\n .illustration {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .badge {\n background: var(--glass);\n padding: 14px;\n border-radius: 14px;\n text-align: center;\n }\n .code {\n font-weight: 700;\n font-size: 48px;\n letter-spacing: -2px;\n color: var(--accent);\n display: block;\n }\n h1 {\n margin: 0 0 6px 0;\n font-size: 20px;\n }\n p.lead {\n margin: 0;\n color: var(--muted);\n }\n\n .actions {\n margin-top: 18px;\n display: flex;\n gap: 12px;\n flex-wrap: wrap;\n }\n .btn {\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, 0.03),\n rgba(255, 255, 255, 0.01)\n );\n border: 1px solid rgba(255, 255, 255, 0.05);\n padding: 10px 14px;\n border-radius: 12px;\n cursor: pointer;\n font-weight: 600;\n color: inherit;\n text-decoration: none;\n display: inline-flex;\n align-items: center;\n gap: 10px;\n }\n .btn.primary {\n background: linear-gradient(180deg, var(--accent), #4ecfe8);\n color: #032;\n box-shadow: 0 6px 18px rgba(125, 211, 252, 0.08);\n }\n .btn.ghost {\n background: transparent;\n border: 1px dashed rgba(255, 255, 255, 0.04);\n }\n\n .details {\n background: rgba(255, 255, 255, 0.02);\n border-radius: 12px;\n padding: 18px;\n margin-top: 8px;\n color: var(--muted);\n font-size: 14px;\n }\n\n .suggestions {\n display: flex;\n flex-direction: column;\n gap: 8px;\n margin-top: 12px;\n }\n .suggestion {\n display: flex;\n gap: 12px;\n align-items: flex-start;\n }\n .dot {\n width: 10px;\n height: 10px;\n border-radius: 10px;\n background: rgba(255, 255, 255, 0.06);\n margin-top: 6px;\n }\n\n @media (max-width: 720px) {\n .card {\n grid-template-columns: 1fr;\n padding: 20px;\n }\n .illustration {\n order: -1;\n }\n }\n\n .wobble {\n transform-origin: center;\n animation: wob 6s ease-in-out infinite;\n }\n @keyframes wob {\n 0% {\n transform: rotate(-3deg);\n }\n 50% {\n transform: rotate(3deg);\n }\n 100% {\n transform: rotate(-3deg);\n }\n }\n\n footer {\n font-size: 13px;\n color: var(--muted);\n text-align: left;\n margin-top: 18px;\n }\n </style>\n </head>\n <body>\n <main class="card">\n <div class="illustration">\n <div class="badge">\n <svg\n width="160"\n height="160"\n viewBox="0 0 64 64"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n class="wobble"\n >\n <rect\n x="6"\n y="10"\n width="52"\n height="36"\n rx="6"\n fill="rgba(125,211,252,0.06)"\n stroke="rgba(125,211,252,0.12)"\n />\n <circle cx="20" cy="28" r="4" fill="rgba(125,211,252,0.18)" />\n <rect\n x="32"\n y="24"\n width="16"\n height="6"\n rx="2"\n fill="rgba(125,211,252,0.22)"\n />\n <path\n d="M18 46c2-3 6-5 10-5s8 2 10 5"\n stroke="rgba(255,255,255,0.06)"\n stroke-width="1.5"\n stroke-linecap="round"\n />\n <path\n d="M42 20l6-6"\n stroke="rgba(255,255,255,0.06)"\n stroke-width="2"\n stroke-linecap="round"\n />\n </svg>\n </div>\n </div>\n\n <section>\n <span class="code" id="err-code">Development Server Down</span>\n <h1 id="err-title">\n For unknown reasons development server has crashed and is not\n reachable.\n </h1>\n <p class="lead">\n We hit an unexpected error while trying to load the page. This usually\n clears up quickly \u2014 here are a few options.\n </p>\n\n <div class="actions">\n <form action="/__restart__" method="POST">\n <button class="btn primary" id="retryBtn" type="submit">\n Restart\n </button>\n <a class="btn" id="homeBtn" onClick="fixWithAI()">Fix with AI</a>\n </form>\n <script type="text/javascript">\n function fixWithAI() {\n window.parent?.postMessage(\n {\n type: "clientError",\n clientErrorData: {\n errorType: "build",\n message: "Development server is not responding",\n stack: "No stack trace available",\n },\n },\n "*"\n );\n }\n </script>\n </div>\n\n <div class="suggestions">\n <div class="suggestion">\n <span class="dot"></span>\n <div>\n Try refreshing the page or press <kbd>Ctrl</kbd> + <kbd>R</kbd>.\n </div>\n </div>\n <div class="suggestion">\n <span class="dot"></span>\n <div>Check your connection or try again in a few minutes.</div>\n </div>\n <div class="suggestion">\n <span class="dot"></span>\n <div>\n If the problem persists, open an issue or contact support.\n </div>\n </div>\n </div>\n </section>\n </main>\n </body>\n</html>\n';
883
+
884
+ // lib/templates/error-server-restarting.html
885
+ var error_server_restarting_default = '<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width,initial-scale=1" />\n <title>Something went wrong \u2014 Error</title>\n <meta\n name="description"\n content="Friendly error page with suggestions and retry button."\n />\n <style>\n :root {\n --bg: #0f1724;\n --card: #0b1220;\n --accent: #7dd3fc;\n --muted: #94a3b8;\n --glass: rgba(255, 255, 255, 0.04);\n --radius: 16px;\n color-scheme: light dark;\n }\n * {\n box-sizing: border-box;\n }\n html,\n body {\n height: 100%;\n }\n body {\n margin: 0;\n font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI",\n Roboto, "Helvetica Neue", Arial;\n background: radial-gradient(\n 1200px 600px at 10% 10%,\n rgba(125, 211, 252, 0.06),\n transparent\n ),\n linear-gradient(180deg, var(--bg), #071025 80%);\n color: #e6eef8;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 32px;\n }\n\n .card {\n width: min(980px, 100%);\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, 0.02),\n rgba(255, 255, 255, 0.01)\n );\n border: 1px solid rgba(255, 255, 255, 0.04);\n border-radius: var(--radius);\n padding: 32px;\n display: grid;\n grid-template-columns: 300px 1fr;\n gap: 24px;\n align-items: center;\n box-shadow: 0 8px 40px rgba(2, 6, 23, 0.6);\n }\n\n .illustration {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .badge {\n background: var(--glass);\n padding: 14px;\n border-radius: 14px;\n text-align: center;\n }\n .code {\n font-weight: 700;\n font-size: 48px;\n letter-spacing: -2px;\n color: var(--accent);\n display: block;\n }\n h1 {\n margin: 0 0 6px 0;\n font-size: 20px;\n }\n p.lead {\n margin: 0;\n color: var(--muted);\n }\n\n .actions {\n margin-top: 18px;\n display: flex;\n gap: 12px;\n flex-wrap: wrap;\n }\n .btn {\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, 0.03),\n rgba(255, 255, 255, 0.01)\n );\n border: 1px solid rgba(255, 255, 255, 0.05);\n padding: 10px 14px;\n border-radius: 12px;\n cursor: pointer;\n font-weight: 600;\n color: inherit;\n text-decoration: none;\n display: inline-flex;\n align-items: center;\n gap: 10px;\n }\n .btn.primary {\n background: linear-gradient(180deg, var(--accent), #4ecfe8);\n color: #032;\n box-shadow: 0 6px 18px rgba(125, 211, 252, 0.08);\n }\n .btn.ghost {\n background: transparent;\n border: 1px dashed rgba(255, 255, 255, 0.04);\n }\n\n .details {\n background: rgba(255, 255, 255, 0.02);\n border-radius: 12px;\n padding: 18px;\n margin-top: 8px;\n color: var(--muted);\n font-size: 14px;\n }\n\n .suggestions {\n display: flex;\n flex-direction: column;\n gap: 8px;\n margin-top: 12px;\n }\n .suggestion {\n display: flex;\n gap: 12px;\n align-items: flex-start;\n }\n .dot {\n width: 10px;\n height: 10px;\n border-radius: 10px;\n background: rgba(255, 255, 255, 0.06);\n margin-top: 6px;\n }\n\n @media (max-width: 720px) {\n .card {\n grid-template-columns: 1fr;\n padding: 20px;\n }\n .illustration {\n order: -1;\n }\n }\n\n .wobble {\n transform-origin: center;\n animation: wob 6s ease-in-out infinite;\n }\n @keyframes wob {\n 0% {\n transform: rotate(-3deg);\n }\n 50% {\n transform: rotate(3deg);\n }\n 100% {\n transform: rotate(-3deg);\n }\n }\n\n footer {\n font-size: 13px;\n color: var(--muted);\n text-align: left;\n margin-top: 18px;\n }\n </style>\n </head>\n <body>\n <main class="card" role="main" aria-labelledby="err-title">\n <div class="illustration">\n <div class="badge" aria-hidden="true">\n <svg\n width="160"\n height="160"\n viewBox="0 0 64 64"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n class="wobble"\n role="img"\n aria-hidden="true"\n >\n <rect\n x="6"\n y="10"\n width="52"\n height="36"\n rx="6"\n fill="rgba(125,211,252,0.06)"\n stroke="rgba(125,211,252,0.12)"\n />\n <circle cx="20" cy="28" r="4" fill="rgba(125,211,252,0.18)" />\n <rect\n x="32"\n y="24"\n width="16"\n height="6"\n rx="2"\n fill="rgba(125,211,252,0.22)"\n />\n <path\n d="M18 46c2-3 6-5 10-5s8 2 10 5"\n stroke="rgba(255,255,255,0.06)"\n stroke-width="1.5"\n stroke-linecap="round"\n />\n <path\n d="M42 20l6-6"\n stroke="rgba(255,255,255,0.06)"\n stroke-width="2"\n stroke-linecap="round"\n />\n </svg>\n </div>\n </div>\n\n <section>\n <span class="code" id="err-code">Restarting the services...</span>\n <h1 id="err-title">Please wait...</h1>\n <script>\n function checkIfSiteIsAlive(counter = 0) {\n if (counter === 10) {\n window.location.href = "/";\n return;\n }\n\n fetch("/")\n .then((response) => {\n if (response.ok) {\n window.location.href = "/";\n return;\n }\n return Promise.reject();\n })\n .catch((error) => {\n console.error(\n "monitor:error",\n "server is not yet reachable",\n error\n );\n setTimeout(() => checkIfSiteIsAlive(counter + 1), 2_000);\n });\n }\n checkIfSiteIsAlive();\n </script>\n <p class="lead">Waiting for server to restart</p>\n </section>\n </main>\n </body>\n</html>\n';
886
+
1
887
  // lib/templates/error-client.html
2
888
  var error_client_default = '<style>\n :root {\n --bg: #0f1724;\n --card: #0b1220;\n --accent: #7dd3fc;\n --muted: #94a3b8;\n --glass: rgba(255, 255, 255, 0.04);\n --radius: 16px;\n color-scheme: light dark;\n }\n * {\n box-sizing: border-box;\n }\n html,\n body {\n height: 100%;\n }\n body {\n margin: 0;\n font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI",\n Roboto, "Helvetica Neue", Arial;\n background: radial-gradient(\n 1200px 600px at 10% 10%,\n rgba(125, 211, 252, 0.06),\n transparent\n ),\n linear-gradient(180deg, var(--bg), #071025 80%);\n color: #e6eef8;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 32px;\n }\n .card {\n width: min(980px, 100%);\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, 0.02),\n rgba(255, 255, 255, 0.01)\n );\n border: 1px solid rgba(255, 255, 255, 0.04);\n border-radius: var(--radius);\n padding: 32px;\n display: grid;\n grid-template-columns: 300px 1fr;\n gap: 24px;\n align-items: center;\n box-shadow: 0 8px 40px rgba(2, 6, 23, 0.6);\n }\n .illustration {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .badge {\n background: var(--glass);\n padding: 14px;\n border-radius: 14px;\n text-align: center;\n }\n .code {\n font-weight: 700;\n font-size: 48px;\n letter-spacing: -2px;\n color: var(--accent);\n display: block;\n }\n h1 {\n margin: 0 0 6px 0;\n font-size: 20px;\n }\n p.lead {\n margin: 0;\n color: var(--muted);\n }\n .actions {\n margin-top: 18px;\n display: flex;\n gap: 12px;\n flex-wrap: wrap;\n }\n .btn {\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, 0.03),\n rgba(255, 255, 255, 0.01)\n );\n border: 1px solid rgba(255, 255, 255, 0.05);\n padding: 10px 14px;\n border-radius: 12px;\n cursor: pointer;\n font-weight: 600;\n color: inherit;\n text-decoration: none;\n display: inline-flex;\n align-items: center;\n gap: 10px;\n }\n .btn.primary {\n background: linear-gradient(180deg, var(--accent), #4ecfe8);\n color: #032;\n box-shadow: 0 6px 18px rgba(125, 211, 252, 0.08);\n }\n @media (max-width: 720px) {\n .card {\n grid-template-columns: 1fr;\n padding: 20px;\n }\n .illustration {\n order: -1;\n }\n }\n .wobble {\n transform-origin: center;\n animation: wob 6s ease-in-out infinite;\n }\n @keyframes wob {\n 0% {\n transform: rotate(-3deg);\n }\n 50% {\n transform: rotate(3deg);\n }\n 100% {\n transform: rotate(-3deg);\n }\n }\n</style>\n<main class="card">\n <div class="illustration">\n <div class="badge">\n <svg\n width="160"\n height="160"\n viewBox="0 0 64 64"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n class="wobble"\n role="img"\n aria-hidden="true"\n >\n <rect\n x="6"\n y="10"\n width="52"\n height="36"\n rx="6"\n fill="rgba(125,211,252,0.06)"\n stroke="rgba(125,211,252,0.12)"\n />\n <circle cx="20" cy="28" r="4" fill="rgba(125,211,252,0.18)" />\n <rect\n x="32"\n y="24"\n width="16"\n height="6"\n rx="2"\n fill="rgba(125,211,252,0.22)"\n />\n <path\n d="M18 46c2-3 6-5 10-5s8 2 10 5"\n stroke="rgba(255,255,255,0.06)"\n stroke-width="1.5"\n stroke-linecap="round"\n />\n <path\n d="M42 20l6-6"\n stroke="rgba(255,255,255,0.06)"\n stroke-width="2"\n stroke-linecap="round"\n />\n </svg>\n </div>\n </div>\n\n <section>\n <span class="code" id="err-code">Build Error Occurred</span>\n <h1 id="err-title">We failed to build Your project</h1>\n <p class="lead">\n We hit an unexpected error while trying to build your project. Use an AI\n to get it fixed automatically.\n </p>\n <div class="actions">\n <a class="btn primary" id="homeBtn" onClick="fixWithAI()">Fix with AI</a>\n </div>\n </section>\n</main>\n';
3
889
 
890
+ // lib/config.ts
891
+ var Template = (0, import_variant.variant)({
892
+ SERVER: {},
893
+ SERVER_RESTARTING: {},
894
+ CLIENT: {}
895
+ });
896
+ var DEFAULT_TEMPLATE_LOCATION = ".dev-machine-monitor";
897
+ function getTemplate(templateType) {
898
+ return (0, import_variant.match)(templateType, {
899
+ SERVER: () => readTemplateSafely(`${DEFAULT_TEMPLATE_LOCATION}/error-server.html`) || error_server_default,
900
+ SERVER_RESTARTING: () => readTemplateSafely(`${DEFAULT_TEMPLATE_LOCATION}/error-server-restarting.html`) || error_server_restarting_default,
901
+ CLIENT: () => readTemplateSafely(`${DEFAULT_TEMPLATE_LOCATION}/error-client.html`) || error_client_default
902
+ });
903
+ }
904
+ function readTemplateSafely(fileName) {
905
+ const fullPath = join(process.cwd(), fileName);
906
+ if (existsSync(fullPath)) {
907
+ try {
908
+ return readFileSync(fullPath, { encoding: "utf8" }).toString();
909
+ } catch {
910
+ }
911
+ }
912
+ return void 0;
913
+ }
914
+
4
915
  // lib/integration.ts
5
916
  var { HTMLElement = class {
6
917
  } } = globalThis;
@@ -8,8 +919,14 @@ var ErrorOverlay = class extends HTMLElement {
8
919
  constructor(error) {
9
920
  super();
10
921
  const div = document.createElement("div");
11
- div.innerHTML = `__TEMPLATE__`;
922
+ div.id = "template";
12
923
  this.appendChild(div);
924
+ import("mustache").then((mustache) => {
925
+ const template = document.getElementById("template");
926
+ if (template != null) {
927
+ template.innerHTML = mustache.default.render(`__TEMPLATE__`, { error });
928
+ }
929
+ });
13
930
  console.error("monitor:error", error);
14
931
  window.fixWithAI = function() {
15
932
  window.parent?.postMessage(
@@ -61,16 +978,17 @@ function clientErrorMonitor() {
61
978
  if (command != "dev") {
62
979
  return;
63
980
  }
981
+ const template = getTemplate(Template.CLIENT());
64
982
  updateConfig({
65
983
  vite: {
66
- plugins: [customErrorOverlayPlugin()]
984
+ plugins: [customErrorOverlayPlugin(template)]
67
985
  }
68
986
  });
69
987
  }
70
988
  }
71
989
  };
72
990
  }
73
- function customErrorOverlayPlugin() {
991
+ function customErrorOverlayPlugin(template) {
74
992
  return {
75
993
  name: "custom-error-overlay",
76
994
  transform(code, id, opts = {}) {
@@ -83,7 +1001,7 @@ function customErrorOverlayPlugin() {
83
1001
  const overlay = ErrorOverlay.toString().replace(
84
1002
  "class extends HTMLElement",
85
1003
  "class ErrorOverlay extends HTMLElement"
86
- ).replace("__TEMPLATE__", error_client_default);
1004
+ ).replace("__TEMPLATE__", template);
87
1005
  return code.replace(
88
1006
  "class ErrorOverlay",
89
1007
  `${overlay}