@vention/vention-cli 0.38.39 → 0.38.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/main.esm.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { Command, Option } from 'commander';
2
+ import { Command, Option, InvalidArgumentError } from 'commander';
3
3
  import chalk from 'chalk';
4
+ import { release } from 'node:os';
4
5
  import { select } from '@inquirer/prompts';
5
6
  import * as fs from 'fs';
6
7
  import fs__default, { promises } from 'fs';
@@ -8,12 +9,12 @@ import * as path$2 from 'path';
8
9
  import path__default from 'path';
9
10
  import { z } from 'zod';
10
11
  import { spawn } from 'node:child_process';
11
- import { release } from 'node:os';
12
12
  import { createHash, randomBytes } from 'node:crypto';
13
13
  import { once } from 'node:events';
14
14
  import { createServer } from 'node:http';
15
15
  import { createRequire } from 'module';
16
16
  import { isDeepStrictEqual } from 'node:util';
17
+ import { createHash as createHash$1 } from 'crypto';
17
18
  import { setTimeout as setTimeout$1 } from 'node:timers/promises';
18
19
  import { execFileSync } from 'child_process';
19
20
 
@@ -64,10 +65,10 @@ var functionBindNative = !fails$D(function () {
64
65
 
65
66
  var NATIVE_BIND$3 = functionBindNative;
66
67
 
67
- var call$z = Function.prototype.call;
68
+ var call$A = Function.prototype.call;
68
69
  // eslint-disable-next-line es/no-function-prototype-bind -- safe
69
- var functionCall = NATIVE_BIND$3 ? call$z.bind(call$z) : function () {
70
- return call$z.apply(call$z, arguments);
70
+ var functionCall = NATIVE_BIND$3 ? call$A.bind(call$A) : function () {
71
+ return call$A.apply(call$A, arguments);
71
72
  };
72
73
 
73
74
  var objectPropertyIsEnumerable = {};
@@ -98,13 +99,13 @@ var createPropertyDescriptor$6 = function (bitmap, value) {
98
99
  var NATIVE_BIND$2 = functionBindNative;
99
100
 
100
101
  var FunctionPrototype$2 = Function.prototype;
101
- var call$y = FunctionPrototype$2.call;
102
+ var call$z = FunctionPrototype$2.call;
102
103
  // eslint-disable-next-line es/no-function-prototype-bind -- safe
103
- var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$y, call$y);
104
+ var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$z, call$z);
104
105
 
105
106
  var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
106
107
  return function () {
107
- return call$y.apply(fn, arguments);
108
+ return call$z.apply(fn, arguments);
108
109
  };
109
110
  };
110
111
 
@@ -282,22 +283,22 @@ var tryToString$5 = tryToString$6;
282
283
  var $TypeError$o = TypeError;
283
284
 
284
285
  // `Assert: IsCallable(argument) is true`
285
- var aCallable$k = function (argument) {
286
+ var aCallable$l = function (argument) {
286
287
  if (isCallable$o(argument)) return argument;
287
288
  throw new $TypeError$o(tryToString$5(argument) + ' is not a function');
288
289
  };
289
290
 
290
- var aCallable$j = aCallable$k;
291
+ var aCallable$k = aCallable$l;
291
292
  var isNullOrUndefined$2 = isNullOrUndefined$4;
292
293
 
293
294
  // `GetMethod` abstract operation
294
295
  // https://tc39.es/ecma262/#sec-getmethod
295
296
  var getMethod$5 = function (V, P) {
296
297
  var func = V[P];
297
- return isNullOrUndefined$2(func) ? undefined : aCallable$j(func);
298
+ return isNullOrUndefined$2(func) ? undefined : aCallable$k(func);
298
299
  };
299
300
 
300
- var call$x = functionCall;
301
+ var call$y = functionCall;
301
302
  var isCallable$n = isCallable$s;
302
303
  var isObject$k = isObject$l;
303
304
 
@@ -307,9 +308,9 @@ var $TypeError$n = TypeError;
307
308
  // https://tc39.es/ecma262/#sec-ordinarytoprimitive
308
309
  var ordinaryToPrimitive$1 = function (input, pref) {
309
310
  var fn, val;
310
- if (pref === 'string' && isCallable$n(fn = input.toString) && !isObject$k(val = call$x(fn, input))) return val;
311
- if (isCallable$n(fn = input.valueOf) && !isObject$k(val = call$x(fn, input))) return val;
312
- if (pref !== 'string' && isCallable$n(fn = input.toString) && !isObject$k(val = call$x(fn, input))) return val;
311
+ if (pref === 'string' && isCallable$n(fn = input.toString) && !isObject$k(val = call$y(fn, input))) return val;
312
+ if (isCallable$n(fn = input.valueOf) && !isObject$k(val = call$y(fn, input))) return val;
313
+ if (pref !== 'string' && isCallable$n(fn = input.toString) && !isObject$k(val = call$y(fn, input))) return val;
313
314
  throw new $TypeError$n("Can't convert object to primitive value");
314
315
  };
315
316
 
@@ -403,7 +404,7 @@ var wellKnownSymbol$n = function (name) {
403
404
  } return WellKnownSymbolsStore[name];
404
405
  };
405
406
 
406
- var call$w = functionCall;
407
+ var call$x = functionCall;
407
408
  var isObject$j = isObject$l;
408
409
  var isSymbol$3 = isSymbol$4;
409
410
  var getMethod$4 = getMethod$5;
@@ -421,7 +422,7 @@ var toPrimitive$2 = function (input, pref) {
421
422
  var result;
422
423
  if (exoticToPrim) {
423
424
  if (pref === undefined) pref = 'default';
424
- result = call$w(exoticToPrim, input, pref);
425
+ result = call$x(exoticToPrim, input, pref);
425
426
  if (!isObject$j(result) || isSymbol$3(result)) return result;
426
427
  throw new $TypeError$m("Can't convert object to primitive value");
427
428
  }
@@ -463,7 +464,7 @@ var ie8DomDefine = !DESCRIPTORS$n && !fails$A(function () {
463
464
  });
464
465
 
465
466
  var DESCRIPTORS$m = descriptors;
466
- var call$v = functionCall;
467
+ var call$w = functionCall;
467
468
  var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
468
469
  var createPropertyDescriptor$5 = createPropertyDescriptor$6;
469
470
  var toIndexedObject$5 = toIndexedObject$6;
@@ -482,7 +483,7 @@ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$m ? $getOwnPropertyDescriptor$1 :
482
483
  if (IE8_DOM_DEFINE$1) try {
483
484
  return $getOwnPropertyDescriptor$1(O, P);
484
485
  } catch (error) { /* empty */ }
485
- if (hasOwn$i(O, P)) return createPropertyDescriptor$5(!call$v(propertyIsEnumerableModule$1.f, O, P), O[P]);
486
+ if (hasOwn$i(O, P)) return createPropertyDescriptor$5(!call$w(propertyIsEnumerableModule$1.f, O, P), O[P]);
486
487
  };
487
488
 
488
489
  var objectDefineProperty = {};
@@ -506,7 +507,7 @@ var $String$5 = String;
506
507
  var $TypeError$l = TypeError;
507
508
 
508
509
  // `Assert: Type(argument) is Object`
509
- var anObject$o = function (argument) {
510
+ var anObject$p = function (argument) {
510
511
  if (isObject$h(argument)) return argument;
511
512
  throw new $TypeError$l($String$5(argument) + ' is not an object');
512
513
  };
@@ -514,7 +515,7 @@ var anObject$o = function (argument) {
514
515
  var DESCRIPTORS$k = descriptors;
515
516
  var IE8_DOM_DEFINE = ie8DomDefine;
516
517
  var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
517
- var anObject$n = anObject$o;
518
+ var anObject$o = anObject$p;
518
519
  var toPropertyKey$1 = toPropertyKey$3;
519
520
 
520
521
  var $TypeError$k = TypeError;
@@ -529,9 +530,9 @@ var WRITABLE = 'writable';
529
530
  // `Object.defineProperty` method
530
531
  // https://tc39.es/ecma262/#sec-object.defineproperty
531
532
  objectDefineProperty.f = DESCRIPTORS$k ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
532
- anObject$n(O);
533
+ anObject$o(O);
533
534
  P = toPropertyKey$1(P);
534
- anObject$n(Attributes);
535
+ anObject$o(Attributes);
535
536
  if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
536
537
  var current = $getOwnPropertyDescriptor(O, P);
537
538
  if (current && current[WRITABLE]) {
@@ -544,9 +545,9 @@ objectDefineProperty.f = DESCRIPTORS$k ? V8_PROTOTYPE_DEFINE_BUG$1 ? function de
544
545
  }
545
546
  } return $defineProperty(O, P, Attributes);
546
547
  } : $defineProperty : function defineProperty(O, P, Attributes) {
547
- anObject$n(O);
548
+ anObject$o(O);
548
549
  P = toPropertyKey$1(P);
549
- anObject$n(Attributes);
550
+ anObject$o(Attributes);
550
551
  if (IE8_DOM_DEFINE) try {
551
552
  return $defineProperty(O, P, Attributes);
552
553
  } catch (error) { /* empty */ }
@@ -916,13 +917,13 @@ var getBuiltIn$9 = getBuiltIn$b;
916
917
  var uncurryThis$A = functionUncurryThis;
917
918
  var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
918
919
  var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
919
- var anObject$m = anObject$o;
920
+ var anObject$n = anObject$p;
920
921
 
921
922
  var concat$2 = uncurryThis$A([].concat);
922
923
 
923
924
  // all object keys, includes non-enumerable and symbols
924
925
  var ownKeys$1 = getBuiltIn$9('Reflect', 'ownKeys') || function ownKeys(it) {
925
- var keys = getOwnPropertyNamesModule.f(anObject$m(it));
926
+ var keys = getOwnPropertyNamesModule.f(anObject$n(it));
926
927
  var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
927
928
  return getOwnPropertySymbols ? concat$2(keys, getOwnPropertySymbols(it)) : keys;
928
929
  };
@@ -1079,10 +1080,10 @@ var defineBuiltInAccessor$9 = function (target, name, descriptor) {
1079
1080
  return defineProperty$5.f(target, name, descriptor);
1080
1081
  };
1081
1082
 
1082
- var $$O = _export;
1083
+ var $$P = _export;
1083
1084
  var DESCRIPTORS$g = descriptors;
1084
1085
  var globalThis$E = globalThis_1;
1085
- var call$u = functionCall;
1086
+ var call$v = functionCall;
1086
1087
  var uncurryThis$z = functionUncurryThis;
1087
1088
  var hasOwn$c = hasOwnProperty_1;
1088
1089
  var isCallable$g = isCallable$s;
@@ -1116,7 +1117,7 @@ if (DESCRIPTORS$g && isCallable$g(NativeSymbol) && (!('description' in SymbolPro
1116
1117
  var nativeFor = SymbolWrapper['for'];
1117
1118
  SymbolWrapper['for'] = { 'for': function (key) {
1118
1119
  var stringKey = toString$g(key);
1119
- var symbol = call$u(nativeFor, this, stringKey);
1120
+ var symbol = call$v(nativeFor, this, stringKey);
1120
1121
  if (stringKey === '') EmptyStringDescriptionStore[symbol] = true;
1121
1122
  return symbol;
1122
1123
  } }['for'];
@@ -1141,7 +1142,7 @@ if (DESCRIPTORS$g && isCallable$g(NativeSymbol) && (!('description' in SymbolPro
1141
1142
  }
1142
1143
  });
1143
1144
 
1144
- $$O({ global: true, constructor: true, forced: true }, {
1145
+ $$P({ global: true, constructor: true, forced: true }, {
1145
1146
  Symbol: SymbolWrapper
1146
1147
  });
1147
1148
  }
@@ -1161,7 +1162,7 @@ var objectKeys$2 = Object.keys || function keys(O) {
1161
1162
  var DESCRIPTORS$f = descriptors;
1162
1163
  var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1163
1164
  var definePropertyModule$2 = objectDefineProperty;
1164
- var anObject$l = anObject$o;
1165
+ var anObject$m = anObject$p;
1165
1166
  var toIndexedObject$2 = toIndexedObject$6;
1166
1167
  var objectKeys$1 = objectKeys$2;
1167
1168
 
@@ -1169,7 +1170,7 @@ var objectKeys$1 = objectKeys$2;
1169
1170
  // https://tc39.es/ecma262/#sec-object.defineproperties
1170
1171
  // eslint-disable-next-line es/no-object-defineproperties -- safe
1171
1172
  objectDefineProperties.f = DESCRIPTORS$f && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1172
- anObject$l(O);
1173
+ anObject$m(O);
1173
1174
  var props = toIndexedObject$2(Properties);
1174
1175
  var keys = objectKeys$1(Properties);
1175
1176
  var length = keys.length;
@@ -1184,7 +1185,7 @@ var getBuiltIn$8 = getBuiltIn$b;
1184
1185
  var html$2 = getBuiltIn$8('document', 'documentElement');
1185
1186
 
1186
1187
  /* global ActiveXObject -- old IE, WSH */
1187
- var anObject$k = anObject$o;
1188
+ var anObject$l = anObject$p;
1188
1189
  var definePropertiesModule = objectDefineProperties;
1189
1190
  var enumBugKeys = enumBugKeys$3;
1190
1191
  var hiddenKeys = hiddenKeys$4;
@@ -1259,7 +1260,7 @@ hiddenKeys[IE_PROTO$1] = true;
1259
1260
  var objectCreate = Object.create || function create(O, Properties) {
1260
1261
  var result;
1261
1262
  if (O !== null) {
1262
- EmptyConstructor[PROTOTYPE$1] = anObject$k(O);
1263
+ EmptyConstructor[PROTOTYPE$1] = anObject$l(O);
1263
1264
  result = new EmptyConstructor();
1264
1265
  EmptyConstructor[PROTOTYPE$1] = null;
1265
1266
  // add "__proto__" for Object.getPrototypeOf polyfill
@@ -1289,7 +1290,7 @@ var addToUnscopables$5 = function (key) {
1289
1290
  ArrayPrototype$1[UNSCOPABLES][key] = true;
1290
1291
  };
1291
1292
 
1292
- var $$N = _export;
1293
+ var $$O = _export;
1293
1294
  var $includes = arrayIncludes.includes;
1294
1295
  var fails$w = fails$F;
1295
1296
  var addToUnscopables$4 = addToUnscopables$5;
@@ -1308,7 +1309,7 @@ var BROKEN_ON_SPARSE_WITH_FROM_INDEX = fails$w(function () {
1308
1309
 
1309
1310
  // `Array.prototype.includes` method
1310
1311
  // https://tc39.es/ecma262/#sec-array.prototype.includes
1311
- $$N({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE || BROKEN_ON_SPARSE_WITH_FROM_INDEX }, {
1312
+ $$O({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE || BROKEN_ON_SPARSE_WITH_FROM_INDEX }, {
1312
1313
  includes: function includes(el /* , fromIndex = 0 */) {
1313
1314
  return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
1314
1315
  }
@@ -1356,7 +1357,7 @@ var correctIsRegexpLogic = function (METHOD_NAME) {
1356
1357
  } return false;
1357
1358
  };
1358
1359
 
1359
- var $$M = _export;
1360
+ var $$N = _export;
1360
1361
  var uncurryThis$y = functionUncurryThis;
1361
1362
  var notARegExp$2 = notARegexp;
1362
1363
  var requireObjectCoercible$9 = requireObjectCoercible$c;
@@ -1367,7 +1368,7 @@ var stringIndexOf$2 = uncurryThis$y(''.indexOf);
1367
1368
 
1368
1369
  // `String.prototype.includes` method
1369
1370
  // https://tc39.es/ecma262/#sec-string.prototype.includes
1370
- $$M({ target: 'String', proto: true, forced: !correctIsRegExpLogic$2('includes') }, {
1371
+ $$N({ target: 'String', proto: true, forced: !correctIsRegExpLogic$2('includes') }, {
1371
1372
  includes: function includes(searchString /* , position = 0 */) {
1372
1373
  return !!~stringIndexOf$2(
1373
1374
  toString$f(requireObjectCoercible$9(this)),
@@ -1418,12 +1419,12 @@ var globalThis$C = globalThis_1;
1418
1419
  var path$1 = globalThis$C;
1419
1420
 
1420
1421
  var uncurryThis$x = functionUncurryThis;
1421
- var aCallable$i = aCallable$k;
1422
+ var aCallable$j = aCallable$l;
1422
1423
 
1423
1424
  var functionUncurryThisAccessor = function (object, key, method) {
1424
1425
  try {
1425
1426
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1426
- return uncurryThis$x(aCallable$i(Object.getOwnPropertyDescriptor(object, key)[method]));
1427
+ return uncurryThis$x(aCallable$j(Object.getOwnPropertyDescriptor(object, key)[method]));
1427
1428
  } catch (error) { /* empty */ }
1428
1429
  };
1429
1430
 
@@ -1575,7 +1576,7 @@ var aConstructor$2 = function (argument) {
1575
1576
  throw new $TypeError$g(tryToString$4(argument) + ' is not a constructor');
1576
1577
  };
1577
1578
 
1578
- var anObject$j = anObject$o;
1579
+ var anObject$k = anObject$p;
1579
1580
  var aConstructor$1 = aConstructor$2;
1580
1581
  var isNullOrUndefined$1 = isNullOrUndefined$4;
1581
1582
  var wellKnownSymbol$e = wellKnownSymbol$n;
@@ -1585,20 +1586,20 @@ var SPECIES$3 = wellKnownSymbol$e('species');
1585
1586
  // `SpeciesConstructor` abstract operation
1586
1587
  // https://tc39.es/ecma262/#sec-speciesconstructor
1587
1588
  var speciesConstructor$1 = function (O, defaultConstructor) {
1588
- var C = anObject$j(O).constructor;
1589
+ var C = anObject$k(O).constructor;
1589
1590
  var S;
1590
- return C === undefined || isNullOrUndefined$1(S = anObject$j(C)[SPECIES$3]) ? defaultConstructor : aConstructor$1(S);
1591
+ return C === undefined || isNullOrUndefined$1(S = anObject$k(C)[SPECIES$3]) ? defaultConstructor : aConstructor$1(S);
1591
1592
  };
1592
1593
 
1593
1594
  var NATIVE_BIND$1 = functionBindNative;
1594
1595
 
1595
1596
  var FunctionPrototype = Function.prototype;
1596
1597
  var apply$5 = FunctionPrototype.apply;
1597
- var call$t = FunctionPrototype.call;
1598
+ var call$u = FunctionPrototype.call;
1598
1599
 
1599
1600
  // eslint-disable-next-line es/no-function-prototype-bind, es/no-reflect -- safe
1600
- var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$t.bind(apply$5) : function () {
1601
- return call$t.apply(apply$5, arguments);
1601
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$u.bind(apply$5) : function () {
1602
+ return call$u.apply(apply$5, arguments);
1602
1603
  });
1603
1604
 
1604
1605
  var classofRaw = classofRaw$2;
@@ -1612,14 +1613,14 @@ var functionUncurryThisClause = function (fn) {
1612
1613
  };
1613
1614
 
1614
1615
  var uncurryThis$u = functionUncurryThisClause;
1615
- var aCallable$h = aCallable$k;
1616
+ var aCallable$i = aCallable$l;
1616
1617
  var NATIVE_BIND = functionBindNative;
1617
1618
 
1618
1619
  var bind$8 = uncurryThis$u(uncurryThis$u.bind);
1619
1620
 
1620
1621
  // optional / simple context binding
1621
1622
  var functionBindContext = function (fn, that) {
1622
- aCallable$h(fn);
1623
+ aCallable$i(fn);
1623
1624
  return that === undefined ? fn : NATIVE_BIND ? bind$8(fn, that) : function (/* ...args */) {
1624
1625
  return fn.apply(that, arguments);
1625
1626
  };
@@ -1945,7 +1946,7 @@ var promiseConstructorDetection = {
1945
1946
 
1946
1947
  var newPromiseCapability$2 = {};
1947
1948
 
1948
- var aCallable$g = aCallable$k;
1949
+ var aCallable$h = aCallable$l;
1949
1950
 
1950
1951
  var $TypeError$e = TypeError;
1951
1952
 
@@ -1956,8 +1957,8 @@ var PromiseCapability = function (C) {
1956
1957
  resolve = $$resolve;
1957
1958
  reject = $$reject;
1958
1959
  });
1959
- this.resolve = aCallable$g(resolve);
1960
- this.reject = aCallable$g(reject);
1960
+ this.resolve = aCallable$h(resolve);
1961
+ this.reject = aCallable$h(reject);
1961
1962
  };
1962
1963
 
1963
1964
  // `NewPromiseCapability` abstract operation
@@ -1966,16 +1967,16 @@ newPromiseCapability$2.f = function (C) {
1966
1967
  return new PromiseCapability(C);
1967
1968
  };
1968
1969
 
1969
- var $$L = _export;
1970
+ var $$M = _export;
1970
1971
  var IS_NODE$1 = environmentIsNode;
1971
1972
  var globalThis$w = globalThis_1;
1972
1973
  var path = path$1;
1973
- var call$s = functionCall;
1974
+ var call$t = functionCall;
1974
1975
  var defineBuiltIn$8 = defineBuiltIn$a;
1975
1976
  var setPrototypeOf$6 = objectSetPrototypeOf;
1976
1977
  var setToStringTag$4 = setToStringTag$5;
1977
1978
  var setSpecies$3 = setSpecies$4;
1978
- var aCallable$f = aCallable$k;
1979
+ var aCallable$g = aCallable$l;
1979
1980
  var isCallable$c = isCallable$s;
1980
1981
  var isObject$c = isObject$l;
1981
1982
  var anInstance$3 = anInstance$4;
@@ -2048,7 +2049,7 @@ var callReaction = function (reaction, state) {
2048
2049
  if (result === reaction.promise) {
2049
2050
  reject(new TypeError$4('Promise-chain cycle'));
2050
2051
  } else if (then = isThenable(result)) {
2051
- call$s(then, result, resolve, reject);
2052
+ call$t(then, result, resolve, reject);
2052
2053
  } else resolve(result);
2053
2054
  } else reject(value);
2054
2055
  } catch (error) {
@@ -2085,7 +2086,7 @@ var dispatchEvent = function (name, promise, reason) {
2085
2086
  };
2086
2087
 
2087
2088
  var onUnhandled = function (state) {
2088
- call$s(task, globalThis$w, function () {
2089
+ call$t(task, globalThis$w, function () {
2089
2090
  var promise = state.facade;
2090
2091
  var value = state.value;
2091
2092
  var IS_UNHANDLED = isUnhandled(state);
@@ -2108,7 +2109,7 @@ var isUnhandled = function (state) {
2108
2109
  };
2109
2110
 
2110
2111
  var onHandleUnhandled = function (state) {
2111
- call$s(task, globalThis$w, function () {
2112
+ call$t(task, globalThis$w, function () {
2112
2113
  var promise = state.facade;
2113
2114
  if (IS_NODE$1) {
2114
2115
  process$1.emit('rejectionHandled', promise);
@@ -2142,7 +2143,7 @@ var internalResolve = function (state, value, unwrap) {
2142
2143
  microtask(function () {
2143
2144
  var wrapper = { done: false };
2144
2145
  try {
2145
- call$s(then, value,
2146
+ call$t(then, value,
2146
2147
  bind$5(internalResolve, wrapper, state),
2147
2148
  bind$5(internalReject, wrapper, state)
2148
2149
  );
@@ -2165,8 +2166,8 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
2165
2166
  // 25.4.3.1 Promise(executor)
2166
2167
  PromiseConstructor = function Promise(executor) {
2167
2168
  anInstance$3(this, PromisePrototype);
2168
- aCallable$f(executor);
2169
- call$s(Internal, this);
2169
+ aCallable$g(executor);
2170
+ call$t(Internal, this);
2170
2171
  var state = getInternalPromiseState(this);
2171
2172
  try {
2172
2173
  executor(bind$5(internalResolve, state), bind$5(internalReject, state));
@@ -2229,7 +2230,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
2229
2230
  defineBuiltIn$8(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
2230
2231
  var that = this;
2231
2232
  return new PromiseConstructor(function (resolve, reject) {
2232
- call$s(nativeThen, that, resolve, reject);
2233
+ call$t(nativeThen, that, resolve, reject);
2233
2234
  }).then(onFulfilled, onRejected);
2234
2235
  // https://github.com/zloirock/core-js/issues/640
2235
2236
  }, { unsafe: true });
@@ -2249,7 +2250,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
2249
2250
 
2250
2251
  // `Promise` constructor
2251
2252
  // https://tc39.es/ecma262/#sec-promise-executor
2252
- $$L({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
2253
+ $$M({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
2253
2254
  Promise: PromiseConstructor
2254
2255
  });
2255
2256
 
@@ -2285,9 +2286,9 @@ var getIteratorMethod$4 = function (it) {
2285
2286
  || Iterators$3[classof$a(it)];
2286
2287
  };
2287
2288
 
2288
- var call$r = functionCall;
2289
- var aCallable$e = aCallable$k;
2290
- var anObject$i = anObject$o;
2289
+ var call$s = functionCall;
2290
+ var aCallable$f = aCallable$l;
2291
+ var anObject$j = anObject$p;
2291
2292
  var tryToString$3 = tryToString$6;
2292
2293
  var getIteratorMethod$3 = getIteratorMethod$4;
2293
2294
 
@@ -2295,44 +2296,44 @@ var $TypeError$d = TypeError;
2295
2296
 
2296
2297
  var getIterator$2 = function (argument, usingIterator) {
2297
2298
  var iteratorMethod = arguments.length < 2 ? getIteratorMethod$3(argument) : usingIterator;
2298
- if (aCallable$e(iteratorMethod)) return anObject$i(call$r(iteratorMethod, argument));
2299
+ if (aCallable$f(iteratorMethod)) return anObject$j(call$s(iteratorMethod, argument));
2299
2300
  throw new $TypeError$d(tryToString$3(argument) + ' is not iterable');
2300
2301
  };
2301
2302
 
2302
- var call$q = functionCall;
2303
- var anObject$h = anObject$o;
2303
+ var call$r = functionCall;
2304
+ var anObject$i = anObject$p;
2304
2305
  var getMethod$2 = getMethod$5;
2305
2306
 
2306
- var iteratorClose$b = function (iterator, kind, value) {
2307
+ var iteratorClose$c = function (iterator, kind, value) {
2307
2308
  var innerResult, innerError;
2308
- anObject$h(iterator);
2309
+ anObject$i(iterator);
2309
2310
  try {
2310
2311
  innerResult = getMethod$2(iterator, 'return');
2311
2312
  if (!innerResult) {
2312
2313
  if (kind === 'throw') throw value;
2313
2314
  return value;
2314
2315
  }
2315
- innerResult = call$q(innerResult, iterator);
2316
+ innerResult = call$r(innerResult, iterator);
2316
2317
  } catch (error) {
2317
2318
  innerError = true;
2318
2319
  innerResult = error;
2319
2320
  }
2320
2321
  if (kind === 'throw') throw value;
2321
2322
  if (innerError) throw innerResult;
2322
- anObject$h(innerResult);
2323
+ anObject$i(innerResult);
2323
2324
  return value;
2324
2325
  };
2325
2326
 
2326
2327
  var bind$4 = functionBindContext;
2327
- var call$p = functionCall;
2328
- var anObject$g = anObject$o;
2328
+ var call$q = functionCall;
2329
+ var anObject$h = anObject$p;
2329
2330
  var tryToString$2 = tryToString$6;
2330
2331
  var isArrayIteratorMethod$1 = isArrayIteratorMethod$2;
2331
2332
  var lengthOfArrayLike$f = lengthOfArrayLike$h;
2332
2333
  var isPrototypeOf$5 = objectIsPrototypeOf;
2333
2334
  var getIterator$1 = getIterator$2;
2334
2335
  var getIteratorMethod$2 = getIteratorMethod$4;
2335
- var iteratorClose$a = iteratorClose$b;
2336
+ var iteratorClose$b = iteratorClose$c;
2336
2337
 
2337
2338
  var $TypeError$c = TypeError;
2338
2339
 
@@ -2343,7 +2344,7 @@ var Result = function (stopped, result) {
2343
2344
 
2344
2345
  var ResultPrototype = Result.prototype;
2345
2346
 
2346
- var iterate$7 = function (iterable, unboundFunction, options) {
2347
+ var iterate$8 = function (iterable, unboundFunction, options) {
2347
2348
  var that = options && options.that;
2348
2349
  var AS_ENTRIES = !!(options && options.AS_ENTRIES);
2349
2350
  var IS_RECORD = !!(options && options.IS_RECORD);
@@ -2355,13 +2356,13 @@ var iterate$7 = function (iterable, unboundFunction, options) {
2355
2356
  var stop = function (condition) {
2356
2357
  var $iterator = iterator;
2357
2358
  iterator = undefined;
2358
- if ($iterator) iteratorClose$a($iterator, 'normal');
2359
+ if ($iterator) iteratorClose$b($iterator, 'normal');
2359
2360
  return new Result(true, condition);
2360
2361
  };
2361
2362
 
2362
2363
  var callFn = function (value) {
2363
2364
  if (AS_ENTRIES) {
2364
- anObject$g(value);
2365
+ anObject$h(value);
2365
2366
  return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
2366
2367
  } return INTERRUPTED ? fn(value, stop) : fn(value);
2367
2368
  };
@@ -2384,13 +2385,13 @@ var iterate$7 = function (iterable, unboundFunction, options) {
2384
2385
  }
2385
2386
 
2386
2387
  next = IS_RECORD ? iterable.next : iterator.next;
2387
- while (!(step = call$p(next, iterator)).done) {
2388
+ while (!(step = call$q(next, iterator)).done) {
2388
2389
  // `IteratorValue` errors should propagate without closing the iterator
2389
2390
  var value = step.value;
2390
2391
  try {
2391
2392
  result = callFn(value);
2392
2393
  } catch (error) {
2393
- if (iterator) iteratorClose$a(iterator, 'throw', error);
2394
+ if (iterator) iteratorClose$b(iterator, 'throw', error);
2394
2395
  else throw error;
2395
2396
  }
2396
2397
  if (typeof result == 'object' && result && isPrototypeOf$5(ResultPrototype, result)) return result;
@@ -2448,32 +2449,32 @@ var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCor
2448
2449
  NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
2449
2450
  });
2450
2451
 
2451
- var $$K = _export;
2452
- var call$o = functionCall;
2453
- var aCallable$d = aCallable$k;
2452
+ var $$L = _export;
2453
+ var call$p = functionCall;
2454
+ var aCallable$e = aCallable$l;
2454
2455
  var newPromiseCapabilityModule$2 = newPromiseCapability$2;
2455
2456
  var perform$1 = perform$3;
2456
- var iterate$6 = iterate$7;
2457
+ var iterate$7 = iterate$8;
2457
2458
  var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
2458
2459
 
2459
2460
  // `Promise.all` method
2460
2461
  // https://tc39.es/ecma262/#sec-promise.all
2461
- $$K({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
2462
+ $$L({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
2462
2463
  all: function all(iterable) {
2463
2464
  var C = this;
2464
2465
  var capability = newPromiseCapabilityModule$2.f(C);
2465
2466
  var resolve = capability.resolve;
2466
2467
  var reject = capability.reject;
2467
2468
  var result = perform$1(function () {
2468
- var $promiseResolve = aCallable$d(C.resolve);
2469
+ var $promiseResolve = aCallable$e(C.resolve);
2469
2470
  var values = [];
2470
2471
  var counter = 0;
2471
2472
  var remaining = 1;
2472
- iterate$6(iterable, function (promise) {
2473
+ iterate$7(iterable, function (promise) {
2473
2474
  var index = counter++;
2474
2475
  var alreadyCalled = false;
2475
2476
  remaining++;
2476
- call$o($promiseResolve, C, promise).then(function (value) {
2477
+ call$p($promiseResolve, C, promise).then(function (value) {
2477
2478
  if (alreadyCalled) return;
2478
2479
  alreadyCalled = true;
2479
2480
  values[index] = value;
@@ -2487,7 +2488,7 @@ $$K({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
2487
2488
  }
2488
2489
  });
2489
2490
 
2490
- var $$J = _export;
2491
+ var $$K = _export;
2491
2492
  var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
2492
2493
  var NativePromiseConstructor = promiseNativeConstructor;
2493
2494
  var getBuiltIn$5 = getBuiltIn$b;
@@ -2498,7 +2499,7 @@ var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructo
2498
2499
 
2499
2500
  // `Promise.prototype.catch` method
2500
2501
  // https://tc39.es/ecma262/#sec-promise.prototype.catch
2501
- $$J({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
2502
+ $$K({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
2502
2503
  'catch': function (onRejected) {
2503
2504
  return this.then(undefined, onRejected);
2504
2505
  }
@@ -2512,25 +2513,25 @@ if (isCallable$b(NativePromiseConstructor)) {
2512
2513
  }
2513
2514
  }
2514
2515
 
2515
- var $$I = _export;
2516
- var call$n = functionCall;
2517
- var aCallable$c = aCallable$k;
2516
+ var $$J = _export;
2517
+ var call$o = functionCall;
2518
+ var aCallable$d = aCallable$l;
2518
2519
  var newPromiseCapabilityModule$1 = newPromiseCapability$2;
2519
2520
  var perform = perform$3;
2520
- var iterate$5 = iterate$7;
2521
+ var iterate$6 = iterate$8;
2521
2522
  var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
2522
2523
 
2523
2524
  // `Promise.race` method
2524
2525
  // https://tc39.es/ecma262/#sec-promise.race
2525
- $$I({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
2526
+ $$J({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
2526
2527
  race: function race(iterable) {
2527
2528
  var C = this;
2528
2529
  var capability = newPromiseCapabilityModule$1.f(C);
2529
2530
  var reject = capability.reject;
2530
2531
  var result = perform(function () {
2531
- var $promiseResolve = aCallable$c(C.resolve);
2532
- iterate$5(iterable, function (promise) {
2533
- call$n($promiseResolve, C, promise).then(capability.resolve, reject);
2532
+ var $promiseResolve = aCallable$d(C.resolve);
2533
+ iterate$6(iterable, function (promise) {
2534
+ call$o($promiseResolve, C, promise).then(capability.resolve, reject);
2534
2535
  });
2535
2536
  });
2536
2537
  if (result.error) reject(result.value);
@@ -2538,13 +2539,13 @@ $$I({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
2538
2539
  }
2539
2540
  });
2540
2541
 
2541
- var $$H = _export;
2542
+ var $$I = _export;
2542
2543
  var newPromiseCapabilityModule = newPromiseCapability$2;
2543
2544
  var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
2544
2545
 
2545
2546
  // `Promise.reject` method
2546
2547
  // https://tc39.es/ecma262/#sec-promise.reject
2547
- $$H({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
2548
+ $$I({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
2548
2549
  reject: function reject(r) {
2549
2550
  var capability = newPromiseCapabilityModule.f(this);
2550
2551
  var capabilityReject = capability.reject;
@@ -2553,12 +2554,12 @@ $$H({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
2553
2554
  }
2554
2555
  });
2555
2556
 
2556
- var anObject$f = anObject$o;
2557
+ var anObject$g = anObject$p;
2557
2558
  var isObject$b = isObject$l;
2558
2559
  var newPromiseCapability = newPromiseCapability$2;
2559
2560
 
2560
2561
  var promiseResolve$1 = function (C, x) {
2561
- anObject$f(C);
2562
+ anObject$g(C);
2562
2563
  if (isObject$b(x) && x.constructor === C) return x;
2563
2564
  var promiseCapability = newPromiseCapability.f(C);
2564
2565
  var resolve = promiseCapability.resolve;
@@ -2566,7 +2567,7 @@ var promiseResolve$1 = function (C, x) {
2566
2567
  return promiseCapability.promise;
2567
2568
  };
2568
2569
 
2569
- var $$G = _export;
2570
+ var $$H = _export;
2570
2571
  var getBuiltIn$4 = getBuiltIn$b;
2571
2572
  var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
2572
2573
  var promiseResolve = promiseResolve$1;
@@ -2575,7 +2576,7 @@ getBuiltIn$4('Promise');
2575
2576
 
2576
2577
  // `Promise.resolve` method
2577
2578
  // https://tc39.es/ecma262/#sec-promise.resolve
2578
- $$G({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
2579
+ $$H({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
2579
2580
  resolve: function resolve(x) {
2580
2581
  return promiseResolve(this, x);
2581
2582
  }
@@ -2734,7 +2735,7 @@ var wrapErrorConstructorWithCause$1 = function (FULL_NAME, wrapper, FORCED, IS_A
2734
2735
  };
2735
2736
 
2736
2737
  /* eslint-disable no-unused-vars -- required for functions `.length` */
2737
- var $$F = _export;
2738
+ var $$G = _export;
2738
2739
  var globalThis$v = globalThis_1;
2739
2740
  var apply$3 = functionApply;
2740
2741
  var wrapErrorConstructorWithCause = wrapErrorConstructorWithCause$1;
@@ -2749,7 +2750,7 @@ var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) {
2749
2750
  var O = {};
2750
2751
  // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
2751
2752
  O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED$a);
2752
- $$F({ global: true, constructor: true, arity: 1, forced: FORCED$a }, O);
2753
+ $$G({ global: true, constructor: true, arity: 1, forced: FORCED$a }, O);
2753
2754
  };
2754
2755
 
2755
2756
  var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
@@ -2757,7 +2758,7 @@ var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
2757
2758
  var O = {};
2758
2759
  // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
2759
2760
  O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED$a);
2760
- $$F({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED$a }, O);
2761
+ $$G({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED$a }, O);
2761
2762
  }
2762
2763
  };
2763
2764
 
@@ -2867,12 +2868,12 @@ var parseJsonString = function (source, i) {
2867
2868
  return { value: value, end: i };
2868
2869
  };
2869
2870
 
2870
- var $$E = _export;
2871
+ var $$F = _export;
2871
2872
  var DESCRIPTORS$a = descriptors;
2872
2873
  var globalThis$u = globalThis_1;
2873
2874
  var getBuiltIn$2 = getBuiltIn$b;
2874
2875
  var uncurryThis$q = functionUncurryThis;
2875
- var call$m = functionCall;
2876
+ var call$n = functionCall;
2876
2877
  var isCallable$9 = isCallable$s;
2877
2878
  var isObject$8 = isObject$l;
2878
2879
  var isArray$3 = isArray$4;
@@ -2939,7 +2940,7 @@ var internalize = function (holder, name, reviver, node) {
2939
2940
  }
2940
2941
  }
2941
2942
  }
2942
- return call$m(reviver, holder, name, val, context);
2943
+ return call$n(reviver, holder, name, val, context);
2943
2944
  };
2944
2945
 
2945
2946
  var internalizeProperty = function (object, key, value) {
@@ -3124,7 +3125,7 @@ var PROPER_BASE_PARSE = NATIVE_SYMBOL$1 && !fails$s(function () {
3124
3125
  // `JSON.parse` method
3125
3126
  // https://tc39.es/ecma262/#sec-json.parse
3126
3127
  // https://github.com/tc39/proposal-json-parse-with-source
3127
- $$E({ target: 'JSON', stat: true, forced: NO_SOURCE_SUPPORT }, {
3128
+ $$F({ target: 'JSON', stat: true, forced: NO_SOURCE_SUPPORT }, {
3128
3129
  parse: function parse(text, reviver) {
3129
3130
  return PROPER_BASE_PARSE && !isCallable$9(reviver) ? nativeParse(text) : $parse(text, reviver);
3130
3131
  }
@@ -3150,10 +3151,10 @@ var nativeRawJson = !fails$r(function () {
3150
3151
  return !JSON.isRawJSON(raw) || JSON.stringify(raw) !== unsafeInt;
3151
3152
  });
3152
3153
 
3153
- var $$D = _export;
3154
+ var $$E = _export;
3154
3155
  var getBuiltIn$1 = getBuiltIn$b;
3155
3156
  var apply$2 = functionApply;
3156
- var call$l = functionCall;
3157
+ var call$m = functionCall;
3157
3158
  var uncurryThis$p = functionUncurryThis;
3158
3159
  var fails$q = fails$F;
3159
3160
  var isArray$2 = isArray$4;
@@ -3207,7 +3208,7 @@ var stringifyWithProperSymbolsConversion = WRONG_SYMBOLS_CONVERSION ? function (
3207
3208
  if (!isCallable$8($replacer) && (it === undefined || isSymbol$1(it))) return; // IE8 returns string on undefined
3208
3209
  args[1] = function (key, value) {
3209
3210
  // some old implementations (like WebKit) could pass numbers as keys
3210
- if (isCallable$8($replacer)) value = call$l($replacer, this, $String$1(key), value);
3211
+ if (isCallable$8($replacer)) value = call$m($replacer, this, $String$1(key), value);
3211
3212
  if (!isSymbol$1(value)) return value;
3212
3213
  };
3213
3214
  return apply$2($stringify, null, args);
@@ -3249,14 +3250,14 @@ var getReplacerFunction = function (replacer) {
3249
3250
  // `JSON.stringify` method
3250
3251
  // https://tc39.es/ecma262/#sec-json.stringify
3251
3252
  // https://github.com/tc39/proposal-json-parse-with-source
3252
- if ($stringify) $$D({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE || !NATIVE_RAW_JSON }, {
3253
+ if ($stringify) $$E({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE || !NATIVE_RAW_JSON }, {
3253
3254
  stringify: function stringify(text, replacer, space) {
3254
3255
  var replacerFunction = getReplacerFunction(replacer);
3255
3256
  var rawStrings = [];
3256
3257
 
3257
3258
  var json = stringifyWithProperSymbolsConversion(text, function (key, value) {
3258
3259
  // some old implementations (like WebKit) could pass numbers as keys
3259
- var v = isCallable$8(replacerFunction) ? call$l(replacerFunction, this, $String$1(key), value) : value;
3260
+ var v = isCallable$8(replacerFunction) ? call$m(replacerFunction, this, $String$1(key), value) : value;
3260
3261
  return !NATIVE_RAW_JSON && isRawJSON(v) ? MARK + (push$2(rawStrings, v.rawJSON) - 1) : v;
3261
3262
  }, space);
3262
3263
 
@@ -3285,7 +3286,7 @@ if ($stringify) $$D({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOL
3285
3286
  }
3286
3287
  });
3287
3288
 
3288
- var $$C = _export;
3289
+ var $$D = _export;
3289
3290
  var uncurryThis$o = functionUncurryThisClause;
3290
3291
  var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
3291
3292
  var toLength$5 = toLength$7;
@@ -3306,7 +3307,7 @@ var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () {
3306
3307
 
3307
3308
  // `String.prototype.endsWith` method
3308
3309
  // https://tc39.es/ecma262/#sec-string.prototype.endswith
3309
- $$C({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS_REGEXP_LOGIC$1 }, {
3310
+ $$D({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS_REGEXP_LOGIC$1 }, {
3310
3311
  endsWith: function endsWith(searchString /* , endPosition = @length */) {
3311
3312
  var that = toString$b(requireObjectCoercible$7(this));
3312
3313
  notARegExp$1(searchString);
@@ -3335,13 +3336,13 @@ const saveSession = async data => {
3335
3336
  const loadSession = async ({
3336
3337
  quiet: _quiet = false
3337
3338
  } = {}) => {
3339
+ const configPath = getConfigPath();
3338
3340
  try {
3339
- const configPath = getConfigPath();
3340
3341
  const data = await promises.readFile(configPath, "utf-8");
3341
3342
  return JSON.parse(data);
3342
3343
  } catch (error) {
3343
- if (!_quiet) {
3344
- console.error("Failed to load session:", error);
3344
+ if (!_quiet && error.code !== "ENOENT") {
3345
+ console.error(`Couldn't read your Vention sign-in file (${configPath}). Run 'vention login' to sign in again.`);
3345
3346
  }
3346
3347
  return null;
3347
3348
  }
@@ -3362,7 +3363,7 @@ const getOriginOverride = variableName => {
3362
3363
 
3363
3364
  var DESCRIPTORS$9 = descriptors;
3364
3365
  var uncurryThis$n = functionUncurryThis;
3365
- var call$k = functionCall;
3366
+ var call$l = functionCall;
3366
3367
  var fails$p = fails$F;
3367
3368
  var objectKeys = objectKeys$2;
3368
3369
  var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
@@ -3413,18 +3414,18 @@ var objectAssign = !$assign || fails$p(function () {
3413
3414
  var key;
3414
3415
  while (length > j) {
3415
3416
  key = keys[j++];
3416
- if (!DESCRIPTORS$9 || call$k(propertyIsEnumerable, S, key)) T[key] = S[key];
3417
+ if (!DESCRIPTORS$9 || call$l(propertyIsEnumerable, S, key)) T[key] = S[key];
3417
3418
  }
3418
3419
  } return T;
3419
3420
  } : $assign;
3420
3421
 
3421
- var $$B = _export;
3422
+ var $$C = _export;
3422
3423
  var assign = objectAssign;
3423
3424
 
3424
3425
  // `Object.assign` method
3425
3426
  // https://tc39.es/ecma262/#sec-object.assign
3426
3427
  // eslint-disable-next-line es/no-object-assign -- required for testing
3427
- $$B({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
3428
+ $$C({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
3428
3429
  assign: assign
3429
3430
  });
3430
3431
 
@@ -3917,12 +3918,12 @@ async function loginWithLoopback({ issuer, clientLabel, scopes, store, showAutho
3917
3918
  return signedInUser;
3918
3919
  }
3919
3920
 
3920
- var $$A = _export;
3921
+ var $$B = _export;
3921
3922
  var globalThis$t = globalThis_1;
3922
3923
 
3923
3924
  // `globalThis` object
3924
3925
  // https://tc39.es/ecma262/#sec-globalthis
3925
- $$A({ global: true, forced: globalThis$t.globalThis !== globalThis$t }, {
3926
+ $$B({ global: true, forced: globalThis$t.globalThis !== globalThis$t }, {
3926
3927
  globalThis: globalThis$t
3927
3928
  });
3928
3929
 
@@ -4019,8 +4020,8 @@ var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUME
4019
4020
  return IteratorConstructor;
4020
4021
  };
4021
4022
 
4022
- var $$z = _export;
4023
- var call$j = functionCall;
4023
+ var $$A = _export;
4024
+ var call$k = functionCall;
4024
4025
  var FunctionName$1 = functionName;
4025
4026
  var isCallable$5 = isCallable$s;
4026
4027
  var createIteratorConstructor = iteratorCreateConstructor;
@@ -4092,7 +4093,7 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
4092
4093
  createNonEnumerableProperty$7(IterablePrototype, 'name', VALUES);
4093
4094
  } else {
4094
4095
  INCORRECT_VALUES_NAME = true;
4095
- defaultIterator = function values() { return call$j(nativeIterator, this); };
4096
+ defaultIterator = function values() { return call$k(nativeIterator, this); };
4096
4097
  }
4097
4098
  }
4098
4099
 
@@ -4107,7 +4108,7 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
4107
4108
  if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
4108
4109
  defineBuiltIn$5(IterablePrototype, KEY, methods[KEY]);
4109
4110
  }
4110
- } else $$z({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
4111
+ } else $$A({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
4111
4112
  }
4112
4113
 
4113
4114
  // define iterator
@@ -4186,10 +4187,10 @@ if (DESCRIPTORS$8 && values.name !== 'values') try {
4186
4187
  defineProperty(values, 'name', { value: 'values' });
4187
4188
  } catch (error) { /* empty */ }
4188
4189
 
4189
- var $$y = _export;
4190
+ var $$z = _export;
4190
4191
  var globalThis$s = globalThis_1;
4191
4192
  var anInstance$2 = anInstance$4;
4192
- var anObject$e = anObject$o;
4193
+ var anObject$f = anObject$p;
4193
4194
  var isCallable$4 = isCallable$s;
4194
4195
  var getPrototypeOf$2 = objectGetPrototypeOf;
4195
4196
  var defineBuiltInAccessor$6 = defineBuiltInAccessor$9;
@@ -4226,7 +4227,7 @@ var defineIteratorPrototypeAccessor = function (key, value) {
4226
4227
  return value;
4227
4228
  },
4228
4229
  set: function (replacement) {
4229
- anObject$e(this);
4230
+ anObject$f(this);
4230
4231
  if (this === IteratorPrototype$1) throw new $TypeError$b("You can't redefine this property");
4231
4232
  if (hasOwn$5(this, key)) this[key] = replacement;
4232
4233
  else createProperty$3(this, key, replacement);
@@ -4245,13 +4246,13 @@ IteratorConstructor.prototype = IteratorPrototype$1;
4245
4246
 
4246
4247
  // `Iterator` constructor
4247
4248
  // https://tc39.es/ecma262/#sec-iterator
4248
- $$y({ global: true, constructor: true, forced: FORCED$9 }, {
4249
+ $$z({ global: true, constructor: true, forced: FORCED$9 }, {
4249
4250
  Iterator: IteratorConstructor
4250
4251
  });
4251
4252
 
4252
4253
  // `GetIteratorDirect(obj)` abstract operation
4253
4254
  // https://tc39.es/ecma262/#sec-getiteratordirect
4254
- var getIteratorDirect$7 = function (obj) {
4255
+ var getIteratorDirect$8 = function (obj) {
4255
4256
  return {
4256
4257
  iterator: obj,
4257
4258
  next: obj.next,
@@ -4262,7 +4263,7 @@ var getIteratorDirect$7 = function (obj) {
4262
4263
  var globalThis$r = globalThis_1;
4263
4264
 
4264
4265
  // https://github.com/tc39/ecma262/pull/3467
4265
- var iteratorHelperWithoutClosingOnEarlyError$5 = function (METHOD_NAME, ExpectedError) {
4266
+ var iteratorHelperWithoutClosingOnEarlyError$6 = function (METHOD_NAME, ExpectedError) {
4266
4267
  var Iterator = globalThis$r.Iterator;
4267
4268
  var IteratorPrototype = Iterator && Iterator.prototype;
4268
4269
  var method = IteratorPrototype && IteratorPrototype[METHOD_NAME];
@@ -4282,33 +4283,33 @@ var iteratorHelperWithoutClosingOnEarlyError$5 = function (METHOD_NAME, Expected
4282
4283
  if (!CLOSED) return method;
4283
4284
  };
4284
4285
 
4285
- var $$x = _export;
4286
- var call$i = functionCall;
4287
- var iterate$4 = iterate$7;
4288
- var aCallable$b = aCallable$k;
4289
- var anObject$d = anObject$o;
4290
- var getIteratorDirect$6 = getIteratorDirect$7;
4291
- var iteratorClose$9 = iteratorClose$b;
4292
- var iteratorHelperWithoutClosingOnEarlyError$4 = iteratorHelperWithoutClosingOnEarlyError$5;
4286
+ var $$y = _export;
4287
+ var call$j = functionCall;
4288
+ var iterate$5 = iterate$8;
4289
+ var aCallable$c = aCallable$l;
4290
+ var anObject$e = anObject$p;
4291
+ var getIteratorDirect$7 = getIteratorDirect$8;
4292
+ var iteratorClose$a = iteratorClose$c;
4293
+ var iteratorHelperWithoutClosingOnEarlyError$5 = iteratorHelperWithoutClosingOnEarlyError$6;
4293
4294
 
4294
- var forEachWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError$4('forEach', TypeError);
4295
+ var forEachWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError$5('forEach', TypeError);
4295
4296
 
4296
4297
  // `Iterator.prototype.forEach` method
4297
4298
  // https://tc39.es/ecma262/#sec-iterator.prototype.foreach
4298
- $$x({ target: 'Iterator', proto: true, real: true, forced: forEachWithoutClosingOnEarlyError }, {
4299
+ $$y({ target: 'Iterator', proto: true, real: true, forced: forEachWithoutClosingOnEarlyError }, {
4299
4300
  forEach: function forEach(fn) {
4300
- anObject$d(this);
4301
+ anObject$e(this);
4301
4302
  try {
4302
- aCallable$b(fn);
4303
+ aCallable$c(fn);
4303
4304
  } catch (error) {
4304
- iteratorClose$9(this, 'throw', error);
4305
+ iteratorClose$a(this, 'throw', error);
4305
4306
  }
4306
4307
 
4307
- if (forEachWithoutClosingOnEarlyError) return call$i(forEachWithoutClosingOnEarlyError, this, fn);
4308
+ if (forEachWithoutClosingOnEarlyError) return call$j(forEachWithoutClosingOnEarlyError, this, fn);
4308
4309
 
4309
- var record = getIteratorDirect$6(this);
4310
+ var record = getIteratorDirect$7(this);
4310
4311
  var counter = 0;
4311
- iterate$4(record, function (value) {
4312
+ iterate$5(record, function (value) {
4312
4313
  fn(value, counter++);
4313
4314
  }, { IS_RECORD: true });
4314
4315
  }
@@ -4430,7 +4431,7 @@ const ERROR_SUGGESTIONS = {
4430
4431
  default: ["Authentication error. Try running 'vention login' to re-authenticate."]
4431
4432
  },
4432
4433
  403: {
4433
- default: ["Authentication error. Try running 'vention login' to re-authenticate."]
4434
+ default: ["Your Vention account can't open this design.", "Run 'vention whoami' to see which account you're signed in with. If it's the wrong one, run 'vention login' again. Otherwise, ask the design's owner to share it with you."]
4434
4435
  },
4435
4436
  404: {
4436
4437
  default: ["The requested resource was not found."],
@@ -4471,7 +4472,8 @@ const handleCommandError = (error, context) => {
4471
4472
  if (isVerbose()) {
4472
4473
  console.error(chalk.dim(`URL: ${error.url}`));
4473
4474
  }
4474
- const suggestions = getErrorSuggestions(error.status, error.url);
4475
+ const serverExplainedRequest = error.status === 400 && typeof error.responseBody === "object" && error.responseBody !== null && "error" in error.responseBody;
4476
+ const suggestions = serverExplainedRequest ? [] : getErrorSuggestions(error.status, error.url);
4475
4477
  if (suggestions.length > 0) {
4476
4478
  console.error();
4477
4479
  suggestions.forEach(msg => console.error(chalk.yellow(msg)));
@@ -4525,13 +4527,13 @@ var defineBuiltIns$2 = function (target, src, options) {
4525
4527
  return target;
4526
4528
  };
4527
4529
 
4528
- var iteratorClose$8 = iteratorClose$b;
4530
+ var iteratorClose$9 = iteratorClose$c;
4529
4531
 
4530
4532
  var iteratorCloseAll$1 = function (iters, kind, value) {
4531
4533
  for (var i = iters.length - 1; i >= 0; i--) {
4532
4534
  if (iters[i] === undefined) continue;
4533
4535
  try {
4534
- value = iteratorClose$8(iters[i].iterator, kind, value);
4536
+ value = iteratorClose$9(iters[i].iterator, kind, value);
4535
4537
  } catch (error) {
4536
4538
  kind = 'throw';
4537
4539
  value = error;
@@ -4541,7 +4543,7 @@ var iteratorCloseAll$1 = function (iters, kind, value) {
4541
4543
  return value;
4542
4544
  };
4543
4545
 
4544
- var call$h = functionCall;
4546
+ var call$i = functionCall;
4545
4547
  var create$3 = objectCreate;
4546
4548
  var createNonEnumerableProperty$5 = createNonEnumerableProperty$d;
4547
4549
  var defineBuiltIns$1 = defineBuiltIns$2;
@@ -4550,7 +4552,7 @@ var InternalStateModule$3 = internalState;
4550
4552
  var getMethod$1 = getMethod$5;
4551
4553
  var IteratorPrototype = iteratorsCore.IteratorPrototype;
4552
4554
  var createIterResultObject = createIterResultObject$2;
4553
- var iteratorClose$7 = iteratorClose$b;
4555
+ var iteratorClose$8 = iteratorClose$c;
4554
4556
  var iteratorCloseAll = iteratorCloseAll$1;
4555
4557
 
4556
4558
  var TO_STRING_TAG$1 = wellKnownSymbol$5('toStringTag');
@@ -4586,21 +4588,21 @@ var createIteratorProxyPrototype = function (IS_ITERATOR) {
4586
4588
  state.done = true;
4587
4589
  if (IS_ITERATOR) {
4588
4590
  var returnMethod = getMethod$1(iterator, 'return');
4589
- return returnMethod ? call$h(returnMethod, iterator) : createIterResultObject(undefined, true);
4591
+ return returnMethod ? call$i(returnMethod, iterator) : createIterResultObject(undefined, true);
4590
4592
  }
4591
4593
  if (done) return createIterResultObject(undefined, true);
4592
4594
  if (state.inner) try {
4593
- iteratorClose$7(state.inner.iterator, NORMAL);
4595
+ iteratorClose$8(state.inner.iterator, NORMAL);
4594
4596
  } catch (error) {
4595
- return iteratorClose$7(iterator, THROW, error);
4597
+ return iteratorClose$8(iterator, THROW, error);
4596
4598
  }
4597
4599
  if (state.openIters) try {
4598
4600
  iteratorCloseAll(state.openIters, NORMAL);
4599
4601
  } catch (error) {
4600
- if (iterator) return iteratorClose$7(iterator, THROW, error);
4602
+ if (iterator) return iteratorClose$8(iterator, THROW, error);
4601
4603
  throw error;
4602
4604
  }
4603
- if (iterator) iteratorClose$7(iterator, NORMAL);
4605
+ if (iterator) iteratorClose$8(iterator, NORMAL);
4604
4606
  return createIterResultObject(undefined, true);
4605
4607
  }
4606
4608
  });
@@ -4630,15 +4632,15 @@ var iteratorCreateProxy = function (nextHandler, IS_ITERATOR, RETURN_HANDLER_RES
4630
4632
  return IteratorProxy;
4631
4633
  };
4632
4634
 
4633
- var anObject$c = anObject$o;
4634
- var iteratorClose$6 = iteratorClose$b;
4635
+ var anObject$d = anObject$p;
4636
+ var iteratorClose$7 = iteratorClose$c;
4635
4637
 
4636
4638
  // call something on iterator step with safe closing on error
4637
4639
  var callWithSafeIterationClosing$2 = function (iterator, fn, value, ENTRIES) {
4638
4640
  try {
4639
- return ENTRIES ? fn(anObject$c(value)[0], value[1]) : fn(value);
4641
+ return ENTRIES ? fn(anObject$d(value)[0], value[1]) : fn(value);
4640
4642
  } catch (error) {
4641
- iteratorClose$6(iterator, 'throw', error);
4643
+ iteratorClose$7(iterator, 'throw', error);
4642
4644
  }
4643
4645
  };
4644
4646
 
@@ -4654,59 +4656,59 @@ var iteratorHelperThrowsOnInvalidIterator$3 = function (methodName, argument) {
4654
4656
  }
4655
4657
  };
4656
4658
 
4657
- var $$w = _export;
4658
- var call$g = functionCall;
4659
- var aCallable$a = aCallable$k;
4660
- var anObject$b = anObject$o;
4661
- var getIteratorDirect$5 = getIteratorDirect$7;
4659
+ var $$x = _export;
4660
+ var call$h = functionCall;
4661
+ var aCallable$b = aCallable$l;
4662
+ var anObject$c = anObject$p;
4663
+ var getIteratorDirect$6 = getIteratorDirect$8;
4662
4664
  var createIteratorProxy$2 = iteratorCreateProxy;
4663
4665
  var callWithSafeIterationClosing$1 = callWithSafeIterationClosing$2;
4664
- var iteratorClose$5 = iteratorClose$b;
4666
+ var iteratorClose$6 = iteratorClose$c;
4665
4667
  var iteratorHelperThrowsOnInvalidIterator$2 = iteratorHelperThrowsOnInvalidIterator$3;
4666
- var iteratorHelperWithoutClosingOnEarlyError$3 = iteratorHelperWithoutClosingOnEarlyError$5;
4668
+ var iteratorHelperWithoutClosingOnEarlyError$4 = iteratorHelperWithoutClosingOnEarlyError$6;
4667
4669
 
4668
4670
  var MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !iteratorHelperThrowsOnInvalidIterator$2('map', function () { /* empty */ });
4669
4671
  var mapWithoutClosingOnEarlyError = !MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR
4670
- && iteratorHelperWithoutClosingOnEarlyError$3('map', TypeError);
4672
+ && iteratorHelperWithoutClosingOnEarlyError$4('map', TypeError);
4671
4673
 
4672
4674
  var FORCED$8 = MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || mapWithoutClosingOnEarlyError;
4673
4675
 
4674
4676
  var IteratorProxy$2 = createIteratorProxy$2(function () {
4675
4677
  var iterator = this.iterator;
4676
- var result = anObject$b(call$g(this.next, iterator));
4678
+ var result = anObject$c(call$h(this.next, iterator));
4677
4679
  var done = this.done = !!result.done;
4678
4680
  if (!done) return callWithSafeIterationClosing$1(iterator, this.mapper, [result.value, this.counter++], true);
4679
4681
  });
4680
4682
 
4681
4683
  // `Iterator.prototype.map` method
4682
4684
  // https://tc39.es/ecma262/#sec-iterator.prototype.map
4683
- $$w({ target: 'Iterator', proto: true, real: true, forced: FORCED$8 }, {
4685
+ $$x({ target: 'Iterator', proto: true, real: true, forced: FORCED$8 }, {
4684
4686
  map: function map(mapper) {
4685
- anObject$b(this);
4687
+ anObject$c(this);
4686
4688
  try {
4687
- aCallable$a(mapper);
4689
+ aCallable$b(mapper);
4688
4690
  } catch (error) {
4689
- iteratorClose$5(this, 'throw', error);
4691
+ iteratorClose$6(this, 'throw', error);
4690
4692
  }
4691
4693
 
4692
- if (mapWithoutClosingOnEarlyError) return call$g(mapWithoutClosingOnEarlyError, this, mapper);
4694
+ if (mapWithoutClosingOnEarlyError) return call$h(mapWithoutClosingOnEarlyError, this, mapper);
4693
4695
 
4694
- return new IteratorProxy$2(getIteratorDirect$5(this), {
4696
+ return new IteratorProxy$2(getIteratorDirect$6(this), {
4695
4697
  mapper: mapper
4696
4698
  });
4697
4699
  }
4698
4700
  });
4699
4701
 
4700
- var $$v = _export;
4701
- var iterate$3 = iterate$7;
4702
+ var $$w = _export;
4703
+ var iterate$4 = iterate$8;
4702
4704
  var createProperty$2 = createProperty$5;
4703
4705
 
4704
4706
  // `Object.fromEntries` method
4705
4707
  // https://tc39.es/ecma262/#sec-object.fromentries
4706
- $$v({ target: 'Object', stat: true }, {
4708
+ $$w({ target: 'Object', stat: true }, {
4707
4709
  fromEntries: function fromEntries(iterable) {
4708
4710
  var obj = {};
4709
- iterate$3(iterable, function (k, v) {
4711
+ iterate$4(iterable, function (k, v) {
4710
4712
  createProperty$2(obj, k, v);
4711
4713
  }, { AS_ENTRIES: true });
4712
4714
  return obj;
@@ -4760,12 +4762,12 @@ var FLAGS_GETTER_IS_CORRECT = !fails$l(function () {
4760
4762
 
4761
4763
  var regexpFlagsDetection = { correct: FLAGS_GETTER_IS_CORRECT };
4762
4764
 
4763
- var anObject$a = anObject$o;
4765
+ var anObject$b = anObject$p;
4764
4766
 
4765
4767
  // `RegExp.prototype.flags` getter implementation
4766
4768
  // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
4767
4769
  var regexpFlags$1 = function () {
4768
- var that = anObject$a(this);
4770
+ var that = anObject$b(this);
4769
4771
  var result = '';
4770
4772
  if (that.hasIndices) result += 'd';
4771
4773
  if (that.global) result += 'g';
@@ -4935,6 +4937,11 @@ const loginToPlatform = async environment => {
4935
4937
  await refreshFeatureFlags();
4936
4938
  };
4937
4939
 
4940
+ function canOpenBrowser(env, platform, osRelease) {
4941
+ if (platform !== "linux") return true;
4942
+ return Boolean(env.DISPLAY || env.WAYLAND_DISPLAY || env.BROWSER) || osRelease.toLowerCase().includes("microsoft");
4943
+ }
4944
+ const NO_BROWSER_WARNING = "No web browser can open here, so signing in will probably not finish. If you're using Claude Desktop's Chat or Cowork, switch to the Code tab and ask Claude to log you in there. Otherwise, run 'vention login' on a computer with a web browser.";
4938
4945
  function createLoginCommand() {
4939
4946
  return new Command().command("login").description("Login to Vention").addOption(new Option("--internal").hideHelp()).action(async (_opts, cmd) => {
4940
4947
  try {
@@ -4960,6 +4967,9 @@ function createLoginCommand() {
4960
4967
  console.log(chalk.green("Successfully logged in!"));
4961
4968
  process.exit(0);
4962
4969
  }
4970
+ if (!canOpenBrowser(process.env, process.platform, release())) {
4971
+ console.log(chalk.yellow(NO_BROWSER_WARNING));
4972
+ }
4963
4973
  await loginToPlatform(environment);
4964
4974
  console.log();
4965
4975
  console.log(chalk.green("Successfully logged in!"));
@@ -4970,6 +4980,22 @@ function createLoginCommand() {
4970
4980
  });
4971
4981
  }
4972
4982
 
4983
+ function createWhoamiCommand() {
4984
+ return new Command().command("whoami").description("Show which Vention account you're signed in with").action(async () => {
4985
+ const session = await loadSession();
4986
+ if (!(session === null || session === void 0 ? void 0 : session.gatewayToken)) {
4987
+ console.log("Not signed in. Run 'vention login'.");
4988
+ process.exit(1);
4989
+ }
4990
+ if (session.gatewayToken.capExpiresAt <= Date.now()) {
4991
+ console.log("Your Vention sign-in has expired. Run 'vention login'.");
4992
+ process.exit(1);
4993
+ }
4994
+ console.log(session.email ? `Signed in to Vention as ${session.email} (${session.environment}).` : `Signed in to Vention (${session.environment}). Run 'vention login' again to see which account.`);
4995
+ process.exit(0);
4996
+ });
4997
+ }
4998
+
4973
4999
  var $TypeError$a = TypeError;
4974
5000
  var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
4975
5001
 
@@ -5044,7 +5070,7 @@ var arraySpeciesCreate$3 = function (originalArray, length) {
5044
5070
  return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
5045
5071
  };
5046
5072
 
5047
- var $$u = _export;
5073
+ var $$v = _export;
5048
5074
  var flattenIntoArray$1 = flattenIntoArray_1;
5049
5075
  var toObject$8 = toObject$c;
5050
5076
  var lengthOfArrayLike$c = lengthOfArrayLike$h;
@@ -5053,7 +5079,7 @@ var arraySpeciesCreate$2 = arraySpeciesCreate$3;
5053
5079
 
5054
5080
  // `Array.prototype.flat` method
5055
5081
  // https://tc39.es/ecma262/#sec-array.prototype.flat
5056
- $$u({ target: 'Array', proto: true }, {
5082
+ $$v({ target: 'Array', proto: true }, {
5057
5083
  flat: function flat(/* depthArg = 1 */) {
5058
5084
  var depthArg = arguments.length ? arguments[0] : undefined;
5059
5085
  var O = toObject$8(this);
@@ -5072,20 +5098,20 @@ var addToUnscopables$2 = addToUnscopables$5;
5072
5098
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
5073
5099
  addToUnscopables$2('flat');
5074
5100
 
5075
- var $$t = _export;
5076
- var call$f = functionCall;
5077
- var aCallable$9 = aCallable$k;
5078
- var anObject$9 = anObject$o;
5079
- var getIteratorDirect$4 = getIteratorDirect$7;
5101
+ var $$u = _export;
5102
+ var call$g = functionCall;
5103
+ var aCallable$a = aCallable$l;
5104
+ var anObject$a = anObject$p;
5105
+ var getIteratorDirect$5 = getIteratorDirect$8;
5080
5106
  var createIteratorProxy$1 = iteratorCreateProxy;
5081
5107
  var callWithSafeIterationClosing = callWithSafeIterationClosing$2;
5082
- var iteratorClose$4 = iteratorClose$b;
5108
+ var iteratorClose$5 = iteratorClose$c;
5083
5109
  var iteratorHelperThrowsOnInvalidIterator$1 = iteratorHelperThrowsOnInvalidIterator$3;
5084
- var iteratorHelperWithoutClosingOnEarlyError$2 = iteratorHelperWithoutClosingOnEarlyError$5;
5110
+ var iteratorHelperWithoutClosingOnEarlyError$3 = iteratorHelperWithoutClosingOnEarlyError$6;
5085
5111
 
5086
5112
  var FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR = !iteratorHelperThrowsOnInvalidIterator$1('filter', function () { /* empty */ });
5087
5113
  var filterWithoutClosingOnEarlyError = !FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR
5088
- && iteratorHelperWithoutClosingOnEarlyError$2('filter', TypeError);
5114
+ && iteratorHelperWithoutClosingOnEarlyError$3('filter', TypeError);
5089
5115
 
5090
5116
  var FORCED$7 = FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR || filterWithoutClosingOnEarlyError;
5091
5117
 
@@ -5095,7 +5121,7 @@ var IteratorProxy$1 = createIteratorProxy$1(function () {
5095
5121
  var next = this.next;
5096
5122
  var result, done, value;
5097
5123
  while (true) {
5098
- result = anObject$9(call$f(next, iterator));
5124
+ result = anObject$a(call$g(next, iterator));
5099
5125
  done = this.done = !!result.done;
5100
5126
  if (done) return;
5101
5127
  value = result.value;
@@ -5105,8 +5131,38 @@ var IteratorProxy$1 = createIteratorProxy$1(function () {
5105
5131
 
5106
5132
  // `Iterator.prototype.filter` method
5107
5133
  // https://tc39.es/ecma262/#sec-iterator.prototype.filter
5108
- $$t({ target: 'Iterator', proto: true, real: true, forced: FORCED$7 }, {
5134
+ $$u({ target: 'Iterator', proto: true, real: true, forced: FORCED$7 }, {
5109
5135
  filter: function filter(predicate) {
5136
+ anObject$a(this);
5137
+ try {
5138
+ aCallable$a(predicate);
5139
+ } catch (error) {
5140
+ iteratorClose$5(this, 'throw', error);
5141
+ }
5142
+
5143
+ if (filterWithoutClosingOnEarlyError) return call$g(filterWithoutClosingOnEarlyError, this, predicate);
5144
+
5145
+ return new IteratorProxy$1(getIteratorDirect$5(this), {
5146
+ predicate: predicate
5147
+ });
5148
+ }
5149
+ });
5150
+
5151
+ var $$t = _export;
5152
+ var call$f = functionCall;
5153
+ var iterate$3 = iterate$8;
5154
+ var aCallable$9 = aCallable$l;
5155
+ var anObject$9 = anObject$p;
5156
+ var getIteratorDirect$4 = getIteratorDirect$8;
5157
+ var iteratorClose$4 = iteratorClose$c;
5158
+ var iteratorHelperWithoutClosingOnEarlyError$2 = iteratorHelperWithoutClosingOnEarlyError$6;
5159
+
5160
+ var findWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError$2('find', TypeError);
5161
+
5162
+ // `Iterator.prototype.find` method
5163
+ // https://tc39.es/ecma262/#sec-iterator.prototype.find
5164
+ $$t({ target: 'Iterator', proto: true, real: true, forced: findWithoutClosingOnEarlyError }, {
5165
+ find: function find(predicate) {
5110
5166
  anObject$9(this);
5111
5167
  try {
5112
5168
  aCallable$9(predicate);
@@ -5114,22 +5170,24 @@ $$t({ target: 'Iterator', proto: true, real: true, forced: FORCED$7 }, {
5114
5170
  iteratorClose$4(this, 'throw', error);
5115
5171
  }
5116
5172
 
5117
- if (filterWithoutClosingOnEarlyError) return call$f(filterWithoutClosingOnEarlyError, this, predicate);
5173
+ if (findWithoutClosingOnEarlyError) return call$f(findWithoutClosingOnEarlyError, this, predicate);
5118
5174
 
5119
- return new IteratorProxy$1(getIteratorDirect$4(this), {
5120
- predicate: predicate
5121
- });
5175
+ var record = getIteratorDirect$4(this);
5176
+ var counter = 0;
5177
+ return iterate$3(record, function (value, stop) {
5178
+ if (predicate(value, counter++)) return stop(value);
5179
+ }, { IS_RECORD: true, INTERRUPTED: true }).result;
5122
5180
  }
5123
5181
  });
5124
5182
 
5125
5183
  var $$s = _export;
5126
5184
  var call$e = functionCall;
5127
- var iterate$2 = iterate$7;
5128
- var aCallable$8 = aCallable$k;
5129
- var anObject$8 = anObject$o;
5130
- var getIteratorDirect$3 = getIteratorDirect$7;
5131
- var iteratorClose$3 = iteratorClose$b;
5132
- var iteratorHelperWithoutClosingOnEarlyError$1 = iteratorHelperWithoutClosingOnEarlyError$5;
5185
+ var iterate$2 = iterate$8;
5186
+ var aCallable$8 = aCallable$l;
5187
+ var anObject$8 = anObject$p;
5188
+ var getIteratorDirect$3 = getIteratorDirect$8;
5189
+ var iteratorClose$3 = iteratorClose$c;
5190
+ var iteratorHelperWithoutClosingOnEarlyError$1 = iteratorHelperWithoutClosingOnEarlyError$6;
5133
5191
 
5134
5192
  var someWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError$1('some', TypeError);
5135
5193
 
@@ -5694,7 +5752,7 @@ var $$q = _export;
5694
5752
  var uncurryThis$l = functionUncurryThisClause;
5695
5753
  var fails$j = fails$F;
5696
5754
  var ArrayBufferModule$1 = arrayBuffer;
5697
- var anObject$7 = anObject$o;
5755
+ var anObject$7 = anObject$p;
5698
5756
  var toAbsoluteIndex = toAbsoluteIndex$3;
5699
5757
  var toLength$3 = toLength$7;
5700
5758
 
@@ -6181,11 +6239,11 @@ var setSize = uncurryThisAccessor(SetHelpers$3.proto, 'size', 'get') || function
6181
6239
  return set.size;
6182
6240
  };
6183
6241
 
6184
- var aCallable$7 = aCallable$k;
6185
- var anObject$6 = anObject$o;
6242
+ var aCallable$7 = aCallable$l;
6243
+ var anObject$6 = anObject$p;
6186
6244
  var call$b = functionCall;
6187
6245
  var toIntegerOrInfinity$8 = toIntegerOrInfinity$e;
6188
- var getIteratorDirect$2 = getIteratorDirect$7;
6246
+ var getIteratorDirect$2 = getIteratorDirect$8;
6189
6247
 
6190
6248
  var INVALID_SIZE = 'Invalid size';
6191
6249
  var $RangeError$4 = RangeError;
@@ -6397,7 +6455,7 @@ var size$2 = setSize;
6397
6455
  var getSetRecord$4 = getSetRecord$7;
6398
6456
  var iterateSet = setIterate;
6399
6457
  var iterateSimple$3 = iterateSimple$7;
6400
- var iteratorClose$2 = iteratorClose$b;
6458
+ var iteratorClose$2 = iteratorClose$c;
6401
6459
 
6402
6460
  // `Set.prototype.isDisjointFrom` method
6403
6461
  // https://tc39.es/ecma262/#sec-set.prototype.isdisjointfrom
@@ -6462,7 +6520,7 @@ var has$3 = setHelpers.has;
6462
6520
  var size = setSize;
6463
6521
  var getSetRecord$2 = getSetRecord$7;
6464
6522
  var iterateSimple$2 = iterateSimple$7;
6465
- var iteratorClose$1 = iteratorClose$b;
6523
+ var iteratorClose$1 = iteratorClose$c;
6466
6524
 
6467
6525
  // `Set.prototype.isSupersetOf` method
6468
6526
  // https://tc39.es/ecma262/#sec-set.prototype.issupersetof
@@ -6770,7 +6828,7 @@ var regexpGetFlags = regExpFlagsDetection.correct ? function (it) {
6770
6828
  };
6771
6829
 
6772
6830
  var call$8 = functionCall;
6773
- var anObject$5 = anObject$o;
6831
+ var anObject$5 = anObject$p;
6774
6832
  var isCallable$3 = isCallable$s;
6775
6833
  var classof$6 = classofRaw$2;
6776
6834
  var regexpExec = regexpExec$2;
@@ -6795,7 +6853,7 @@ var call$7 = functionCall;
6795
6853
  var uncurryThis$e = functionUncurryThis;
6796
6854
  var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
6797
6855
  var fails$b = fails$F;
6798
- var anObject$4 = anObject$o;
6856
+ var anObject$4 = anObject$p;
6799
6857
  var isCallable$2 = isCallable$s;
6800
6858
  var isObject$4 = isObject$l;
6801
6859
  var toIntegerOrInfinity$6 = toIntegerOrInfinity$e;
@@ -7186,7 +7244,7 @@ var toBigInt$3 = function (argument) {
7186
7244
 
7187
7245
  var bind$2 = functionBindContext;
7188
7246
  var call$6 = functionCall;
7189
- var aCallable$6 = aCallable$k;
7247
+ var aCallable$6 = aCallable$l;
7190
7248
  var aConstructor = aConstructor$2;
7191
7249
  var toObject$5 = toObject$c;
7192
7250
  var lengthOfArrayLike$a = lengthOfArrayLike$h;
@@ -7745,7 +7803,7 @@ var environmentWebkitVersion = !!webkit && +webkit[1];
7745
7803
  var globalThis$9 = globalThis_1;
7746
7804
  var uncurryThis$c = functionUncurryThisClause;
7747
7805
  var fails$7 = fails$F;
7748
- var aCallable$5 = aCallable$k;
7806
+ var aCallable$5 = aCallable$l;
7749
7807
  var internalSort$1 = arraySort;
7750
7808
  var ArrayBufferViewCore$4 = arrayBufferViewCore;
7751
7809
  var FF$1 = environmentFfVersion;
@@ -7864,7 +7922,7 @@ exportTypedArrayMethod$2('toReversed', function toReversed() {
7864
7922
 
7865
7923
  var ArrayBufferViewCore$1 = arrayBufferViewCore;
7866
7924
  var uncurryThis$b = functionUncurryThis;
7867
- var aCallable$4 = aCallable$k;
7925
+ var aCallable$4 = aCallable$l;
7868
7926
  var arrayFromConstructorAndList = arrayFromConstructorAndList$2;
7869
7927
 
7870
7928
  var aTypedArray$1 = ArrayBufferViewCore$1.aTypedArray;
@@ -8333,7 +8391,7 @@ if (Uint8Array$1) $$b({ target: 'Uint8Array', proto: true, forced: INCORRECT_BEH
8333
8391
  });
8334
8392
 
8335
8393
  const getDefaultIgnorePatterns = () => {
8336
- return new Set(["venv", ".venv", "node_modules", "dist", "build", "__pycache__", ".claude", ".agents", ".git", /\.egg-info$/, ".machine-code-app-directory-info.json", ".vention-design-scene-assets.json", ".vention-design-configuration.json"]);
8394
+ return new Set(["venv", ".venv", "node_modules", "dist", "build", "__pycache__", ".claude", ".agents", ".git", ".DS_Store", "Thumbs.db", "desktop.ini", /\.egg-info$/, ".machine-code-app-directory-info.json", ".vention-design-scene-assets.json", ".vention-design-configuration.json"]);
8337
8395
  };
8338
8396
  const sanitizeFileName = fileName => {
8339
8397
  return fileName.replace(/[^a-zA-Z0-9-_]/g, "_");
@@ -8430,256 +8488,591 @@ const readMachineCodeAppDirectoryInfo = async projectPath => {
8430
8488
  }
8431
8489
  };
8432
8490
 
8433
- var $$a = _export;
8434
- var flattenIntoArray = flattenIntoArray_1;
8435
- var aCallable$3 = aCallable$k;
8436
- var toObject$2 = toObject$c;
8437
- var lengthOfArrayLike$2 = lengthOfArrayLike$h;
8438
- var arraySpeciesCreate = arraySpeciesCreate$3;
8439
-
8440
- // `Array.prototype.flatMap` method
8441
- // https://tc39.es/ecma262/#sec-array.prototype.flatmap
8442
- $$a({ target: 'Array', proto: true }, {
8443
- flatMap: function flatMap(callbackfn /* , thisArg */) {
8444
- var O = toObject$2(this);
8445
- var sourceLen = lengthOfArrayLike$2(O);
8446
- var A;
8447
- aCallable$3(callbackfn);
8448
- A = arraySpeciesCreate(O, 0);
8449
- flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
8450
- return A;
8451
- }
8452
- });
8453
-
8454
- var tryToString = tryToString$6;
8455
-
8456
- var $TypeError$1 = TypeError;
8457
-
8458
- var deletePropertyOrThrow$1 = function (O, P) {
8459
- if (!delete O[P]) throw new $TypeError$1('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
8460
- };
8461
-
8462
- var fails$5 = fails$F;
8463
-
8464
- var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
8465
- var method = [][METHOD_NAME];
8466
- return !!method && fails$5(function () {
8467
- // eslint-disable-next-line no-useless-call -- required for testing
8468
- method.call(null, argument || function () { return 1; }, 1);
8469
- });
8470
- };
8471
-
8472
- var $$9 = _export;
8491
+ var DESCRIPTORS$1 = descriptors;
8492
+ var globalThis$1 = globalThis_1;
8473
8493
  var uncurryThis$6 = functionUncurryThis;
8474
- var aCallable$2 = aCallable$k;
8475
- var toObject$1 = toObject$c;
8476
- var lengthOfArrayLike$1 = lengthOfArrayLike$h;
8477
- var deletePropertyOrThrow = deletePropertyOrThrow$1;
8494
+ var isForced = isForced_1;
8495
+ var inheritIfRequired = inheritIfRequired$4;
8496
+ var createNonEnumerableProperty = createNonEnumerableProperty$d;
8497
+ var create = objectCreate;
8498
+ var getOwnPropertyNames = objectGetOwnPropertyNames.f;
8499
+ var isPrototypeOf = objectIsPrototypeOf;
8500
+ var isRegExp = isRegexp;
8478
8501
  var toString$7 = toString$h;
8479
- var fails$4 = fails$F;
8480
- var internalSort = arraySort;
8481
- var arrayMethodIsStrict = arrayMethodIsStrict$1;
8482
- var FF = environmentFfVersion;
8483
- var IE_OR_EDGE = environmentIsIeOrEdge;
8484
- var V8 = environmentV8Version;
8485
- var WEBKIT = environmentWebkitVersion;
8486
-
8487
- var test = [];
8488
- var nativeSort = uncurryThis$6(test.sort);
8489
- var push = uncurryThis$6(test.push);
8502
+ var getRegExpFlags$1 = regexpGetFlags;
8503
+ var stickyHelpers = regexpStickyHelpers;
8504
+ var proxyAccessor = proxyAccessor$2;
8505
+ var defineBuiltIn$1 = defineBuiltIn$a;
8506
+ var fails$5 = fails$F;
8507
+ var hasOwn = hasOwnProperty_1;
8508
+ var enforceInternalState = internalState.enforce;
8509
+ var setSpecies = setSpecies$4;
8510
+ var wellKnownSymbol = wellKnownSymbol$n;
8511
+ var UNSUPPORTED_DOT_ALL$1 = regexpUnsupportedDotAll;
8512
+ var UNSUPPORTED_NCG = regexpUnsupportedNcg;
8490
8513
 
8491
- // IE8-
8492
- var FAILS_ON_UNDEFINED = fails$4(function () {
8493
- test.sort(undefined);
8494
- });
8495
- // V8 bug
8496
- var FAILS_ON_NULL = fails$4(function () {
8497
- test.sort(null);
8498
- });
8499
- // Old WebKit
8500
- var STRICT_METHOD = arrayMethodIsStrict('sort');
8514
+ var MATCH = wellKnownSymbol('match');
8515
+ var NativeRegExp = globalThis$1.RegExp;
8516
+ var RegExpPrototype$2 = NativeRegExp.prototype;
8517
+ var SyntaxError$1 = globalThis$1.SyntaxError;
8518
+ var exec = uncurryThis$6(RegExpPrototype$2.exec);
8519
+ var charAt$1 = uncurryThis$6(''.charAt);
8520
+ var replace$1 = uncurryThis$6(''.replace);
8521
+ var stringIndexOf = uncurryThis$6(''.indexOf);
8522
+ var stringSlice$2 = uncurryThis$6(''.slice);
8523
+ // TODO: Use only proper RegExpIdentifierName
8524
+ var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
8525
+ var re1 = /a/g;
8526
+ var re2 = /a/g;
8501
8527
 
8502
- var STABLE_SORT = !fails$4(function () {
8503
- // feature detection can be too slow, so check engines versions
8504
- if (V8) return V8 < 70;
8505
- if (FF && FF > 3) return;
8506
- if (IE_OR_EDGE) return true;
8507
- if (WEBKIT) return WEBKIT < 603;
8528
+ // "new" should create a new object, old webkit bug
8529
+ var CORRECT_NEW = new NativeRegExp(re1) !== re1;
8508
8530
 
8509
- var result = '';
8510
- var code, chr, value, index;
8531
+ var MISSED_STICKY = stickyHelpers.MISSED_STICKY;
8532
+ var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
8511
8533
 
8512
- // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
8513
- for (code = 65; code < 76; code++) {
8514
- chr = String.fromCharCode(code);
8534
+ var BASE_FORCED = DESCRIPTORS$1 &&
8535
+ (!CORRECT_NEW || MISSED_STICKY || UNSUPPORTED_DOT_ALL$1 || UNSUPPORTED_NCG || fails$5(function () {
8536
+ re2[MATCH] = false;
8537
+ // RegExp constructor can alter flags and IsRegExp works correct with @@match
8538
+ // eslint-disable-next-line sonarjs/inconsistent-function-call -- required for testing
8539
+ return NativeRegExp(re1) !== re1 || NativeRegExp(re2) === re2 || String(NativeRegExp(re1, 'i')) !== '/a/i';
8540
+ }));
8515
8541
 
8516
- switch (code) {
8517
- case 66: case 69: case 70: case 72: value = 3; break;
8518
- case 68: case 71: value = 4; break;
8519
- default: value = 2;
8542
+ var handleDotAll = function (string) {
8543
+ var length = string.length;
8544
+ var index = 0;
8545
+ var result = '';
8546
+ var brackets = false;
8547
+ var chr;
8548
+ for (; index < length; index++) {
8549
+ chr = charAt$1(string, index);
8550
+ if (chr === '\\') {
8551
+ result += chr + charAt$1(string, ++index);
8552
+ continue;
8520
8553
  }
8521
-
8522
- for (index = 0; index < 47; index++) {
8523
- test.push({ k: chr + index, v: value });
8554
+ if (!brackets && chr === '.') {
8555
+ result += '[\\s\\S]';
8556
+ } else {
8557
+ if (chr === '[') {
8558
+ brackets = true;
8559
+ } else if (chr === ']') {
8560
+ brackets = false;
8561
+ } result += chr;
8524
8562
  }
8525
- }
8526
-
8527
- test.sort(function (a, b) { return b.v - a.v; });
8528
-
8529
- for (index = 0; index < test.length; index++) {
8530
- chr = test[index].k.charAt(0);
8531
- if (result.charAt(result.length - 1) !== chr) result += chr;
8532
- }
8533
-
8534
- return result !== 'DGBEFHACIJK';
8535
- });
8536
-
8537
- var FORCED$2 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
8563
+ } return result;
8564
+ };
8538
8565
 
8539
- var getSortCompare = function (comparefn) {
8540
- return function (x, y) {
8541
- if (y === undefined) return -1;
8542
- if (x === undefined) return 1;
8543
- if (comparefn !== undefined) return +comparefn(x, y) || 0;
8544
- var xString = toString$7(x);
8545
- var yString = toString$7(y);
8546
- return xString === yString ? 0 : xString > yString ? 1 : -1;
8547
- };
8566
+ var handleNCG = function (string) {
8567
+ var length = string.length;
8568
+ var index = 0;
8569
+ var result = '';
8570
+ var named = [];
8571
+ var names = create(null);
8572
+ var brackets = false;
8573
+ var ncg = false;
8574
+ var groupid = 0;
8575
+ var groupname = '';
8576
+ var chr;
8577
+ for (; index < length; index++) {
8578
+ chr = charAt$1(string, index);
8579
+ if (chr === '\\') {
8580
+ chr += charAt$1(string, ++index);
8581
+ // use `\x5c` for escaped backslash to avoid corruption by `\k<name>` to `\N` replacement below
8582
+ if (!ncg && charAt$1(chr, 1) === '\\') {
8583
+ result += '\\x5c';
8584
+ continue;
8585
+ }
8586
+ } else if (chr === ']') {
8587
+ brackets = false;
8588
+ } else if (!brackets) switch (true) {
8589
+ case chr === '[':
8590
+ brackets = true;
8591
+ break;
8592
+ case chr === '(':
8593
+ result += chr;
8594
+ if (exec(IS_NCG, stringSlice$2(string, index + 1))) {
8595
+ index += 2;
8596
+ ncg = true;
8597
+ groupid++;
8598
+ } else if (charAt$1(string, index + 1) !== '?') {
8599
+ groupid++;
8600
+ }
8601
+ continue;
8602
+ case chr === '>' && ncg:
8603
+ if (groupname === '' || hasOwn(names, groupname)) {
8604
+ throw new SyntaxError$1('Invalid capture group name');
8605
+ }
8606
+ names[groupname] = true;
8607
+ named[named.length] = [groupname, groupid];
8608
+ ncg = false;
8609
+ groupname = '';
8610
+ continue;
8611
+ }
8612
+ if (ncg) groupname += chr;
8613
+ else result += chr;
8614
+ }
8615
+ // convert `\k<name>` backreferences to numbered backreferences
8616
+ for (var ni = 0; ni < named.length; ni++) {
8617
+ var backref = '\\k<' + named[ni][0] + '>';
8618
+ var numRef = '\\' + named[ni][1];
8619
+ while (stringIndexOf(result, backref) > -1) {
8620
+ result = replace$1(result, backref, numRef);
8621
+ }
8622
+ } return [result, named];
8548
8623
  };
8549
8624
 
8550
- // `Array.prototype.sort` method
8551
- // https://tc39.es/ecma262/#sec-array.prototype.sort
8552
- $$9({ target: 'Array', proto: true, forced: FORCED$2 }, {
8553
- sort: function sort(comparefn) {
8554
- if (comparefn !== undefined) aCallable$2(comparefn);
8555
-
8556
- var array = toObject$1(this);
8557
-
8558
- if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
8625
+ // `RegExp` constructor
8626
+ // https://tc39.es/ecma262/#sec-regexp-constructor
8627
+ if (isForced('RegExp', BASE_FORCED)) {
8628
+ var RegExpWrapper = function RegExp(pattern, flags) {
8629
+ var thisIsRegExp = isPrototypeOf(RegExpPrototype$2, this);
8630
+ var patternIsRegExp = isRegExp(pattern);
8631
+ var flagsAreUndefined = flags === undefined;
8632
+ var groups = [];
8633
+ var rawPattern = pattern;
8634
+ var rawFlags, dotAll, sticky, handled, result, state;
8559
8635
 
8560
- var items = [];
8561
- var arrayLength = lengthOfArrayLike$1(array);
8562
- var itemsLength, index;
8636
+ if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
8637
+ return pattern;
8638
+ }
8563
8639
 
8564
- for (index = 0; index < arrayLength; index++) {
8565
- if (index in array) push(items, array[index]);
8640
+ if (patternIsRegExp || isPrototypeOf(RegExpPrototype$2, pattern)) {
8641
+ pattern = pattern.source;
8642
+ if (flagsAreUndefined) flags = getRegExpFlags$1(rawPattern);
8566
8643
  }
8567
8644
 
8568
- internalSort(items, getSortCompare(comparefn));
8645
+ pattern = pattern === undefined ? '' : toString$7(pattern);
8646
+ flags = flags === undefined ? '' : toString$7(flags);
8647
+ rawPattern = pattern;
8569
8648
 
8570
- itemsLength = lengthOfArrayLike$1(items);
8571
- index = 0;
8649
+ if (UNSUPPORTED_DOT_ALL$1 && 'dotAll' in re1) {
8650
+ dotAll = !!flags && stringIndexOf(flags, 's') > -1;
8651
+ if (dotAll) flags = replace$1(flags, /s/g, '');
8652
+ }
8572
8653
 
8573
- while (index < itemsLength) array[index] = items[index++];
8574
- while (index < arrayLength) deletePropertyOrThrow(array, index++);
8654
+ rawFlags = flags;
8575
8655
 
8576
- return array;
8577
- }
8578
- });
8656
+ if (MISSED_STICKY && 'sticky' in re1) {
8657
+ sticky = !!flags && stringIndexOf(flags, 'y') > -1;
8658
+ if (sticky && UNSUPPORTED_Y) flags = replace$1(flags, /y/g, '');
8659
+ }
8579
8660
 
8580
- // this method was added to unscopables after implementation
8581
- // in popular engines, so it's moved to a separate module
8582
- var addToUnscopables$1 = addToUnscopables$5;
8661
+ if (UNSUPPORTED_NCG) {
8662
+ handled = handleNCG(pattern);
8663
+ pattern = handled[0];
8664
+ groups = handled[1];
8665
+ }
8583
8666
 
8584
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
8585
- addToUnscopables$1('flatMap');
8667
+ result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype$2, RegExpWrapper);
8586
8668
 
8587
- var call$2 = functionCall;
8588
- var anObject$3 = anObject$o;
8589
- var getIteratorDirect$1 = getIteratorDirect$7;
8590
- var getIteratorMethod = getIteratorMethod$4;
8669
+ if (dotAll || sticky || groups.length) {
8670
+ state = enforceInternalState(result);
8671
+ if (dotAll) {
8672
+ state.dotAll = true;
8673
+ state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
8674
+ }
8675
+ if (sticky) state.sticky = true;
8676
+ if (groups.length) state.groups = groups;
8677
+ }
8591
8678
 
8592
- var getIteratorFlattenable$1 = function (obj, stringHandling) {
8593
- if (!stringHandling || typeof obj !== 'string') anObject$3(obj);
8594
- var method = getIteratorMethod(obj);
8595
- return getIteratorDirect$1(anObject$3(method !== undefined ? call$2(method, obj) : obj));
8596
- };
8679
+ if (pattern !== rawPattern) try {
8680
+ // fails in old engines, but we have no alternatives for unsupported regex syntax
8681
+ createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);
8682
+ } catch (error) { /* empty */ }
8597
8683
 
8598
- var $$8 = _export;
8599
- var call$1 = functionCall;
8600
- var aCallable$1 = aCallable$k;
8601
- var anObject$2 = anObject$o;
8602
- var getIteratorDirect = getIteratorDirect$7;
8603
- var getIteratorFlattenable = getIteratorFlattenable$1;
8604
- var createIteratorProxy = iteratorCreateProxy;
8605
- var iteratorClose = iteratorClose$b;
8606
- var iteratorHelperThrowsOnInvalidIterator = iteratorHelperThrowsOnInvalidIterator$3;
8607
- var iteratorHelperWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError$5;
8684
+ return result;
8685
+ };
8608
8686
 
8609
- // Should not throw an error for an iterator without `return` method. Fixed in Safari 26.2
8610
- // https://bugs.webkit.org/show_bug.cgi?id=297532
8611
- function throwsOnIteratorWithoutReturn() {
8612
- try {
8613
- // eslint-disable-next-line es/no-map, es/no-iterator, es/no-iterator-prototype-flatmap -- required for testing
8614
- var it = Iterator.prototype.flatMap.call(new Map([[4, 5]]).entries(), function (v) { return v; });
8615
- it.next();
8616
- it['return']();
8617
- } catch (error) {
8618
- return true;
8687
+ for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) {
8688
+ proxyAccessor(RegExpWrapper, NativeRegExp, keys[index++]);
8619
8689
  }
8620
- }
8621
8690
 
8622
- var FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !iteratorHelperThrowsOnInvalidIterator('flatMap', function () { /* empty */ });
8623
- var flatMapWithoutClosingOnEarlyError = !FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR
8624
- && iteratorHelperWithoutClosingOnEarlyError('flatMap', TypeError);
8691
+ RegExpPrototype$2.constructor = RegExpWrapper;
8692
+ RegExpWrapper.prototype = RegExpPrototype$2;
8693
+ defineBuiltIn$1(globalThis$1, 'RegExp', RegExpWrapper, { constructor: true });
8694
+ }
8625
8695
 
8626
- var FORCED$1 = FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || flatMapWithoutClosingOnEarlyError
8627
- || throwsOnIteratorWithoutReturn();
8696
+ // https://tc39.es/ecma262/#sec-get-regexp-@@species
8697
+ setSpecies('RegExp');
8628
8698
 
8629
- var IteratorProxy = createIteratorProxy(function () {
8630
- var iterator = this.iterator;
8631
- var mapper = this.mapper;
8632
- var result, inner;
8699
+ var DESCRIPTORS = descriptors;
8700
+ var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
8701
+ var classof = classofRaw$2;
8702
+ var defineBuiltInAccessor = defineBuiltInAccessor$9;
8703
+ var getInternalState = internalState.get;
8633
8704
 
8634
- while (true) {
8635
- if (inner = this.inner) try {
8636
- result = anObject$2(call$1(inner.next, inner.iterator));
8637
- if (!result.done) return result.value;
8638
- this.inner = null;
8639
- } catch (error) { iteratorClose(iterator, 'throw', error); }
8705
+ var RegExpPrototype$1 = RegExp.prototype;
8706
+ var $TypeError$1 = TypeError;
8640
8707
 
8641
- result = anObject$2(call$1(this.next, iterator));
8708
+ // `RegExp.prototype.dotAll` getter
8709
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.dotall
8710
+ if (DESCRIPTORS && UNSUPPORTED_DOT_ALL) {
8711
+ defineBuiltInAccessor(RegExpPrototype$1, 'dotAll', {
8712
+ configurable: true,
8713
+ get: function dotAll() {
8714
+ if (this === RegExpPrototype$1) return;
8715
+ // We can't use InternalStateModule.getterFor because
8716
+ // we don't add metadata for regexps created by a literal.
8717
+ if (classof(this) === 'RegExp') {
8718
+ return !!getInternalState(this).dotAll;
8719
+ }
8720
+ throw new $TypeError$1('Incompatible receiver, RegExp required');
8721
+ }
8722
+ });
8723
+ }
8642
8724
 
8643
- if (this.done = !!result.done) return;
8725
+ // TODO: Remove from `core-js@4` since it's moved to entry points
8644
8726
 
8645
- try {
8646
- this.inner = getIteratorFlattenable(mapper(result.value, this.counter++), false);
8647
- } catch (error) { iteratorClose(iterator, 'throw', error); }
8648
- }
8649
- });
8727
+ var $$a = _export;
8728
+ var call$2 = functionCall;
8729
+ var isCallable = isCallable$s;
8730
+ var anObject$3 = anObject$p;
8731
+ var toString$6 = toString$h;
8650
8732
 
8651
- // `Iterator.prototype.flatMap` method
8652
- // https://tc39.es/ecma262/#sec-iterator.prototype.flatmap
8653
- $$8({ target: 'Iterator', proto: true, real: true, forced: FORCED$1 }, {
8654
- flatMap: function flatMap(mapper) {
8655
- anObject$2(this);
8656
- try {
8657
- aCallable$1(mapper);
8658
- } catch (error) {
8659
- iteratorClose(this, 'throw', error);
8660
- }
8733
+ var DELEGATES_TO_EXEC = function () {
8734
+ var execCalled = false;
8735
+ var re = /[ac]/;
8736
+ re.exec = function () {
8737
+ execCalled = true;
8738
+ return /./.exec.apply(this, arguments);
8739
+ };
8740
+ return re.test('abc') === true && execCalled;
8741
+ }();
8661
8742
 
8662
- if (flatMapWithoutClosingOnEarlyError) return call$1(flatMapWithoutClosingOnEarlyError, this, mapper);
8743
+ var nativeTest = /./.test;
8663
8744
 
8664
- return new IteratorProxy(getIteratorDirect(this), {
8665
- mapper: mapper,
8666
- inner: null
8667
- });
8745
+ // `RegExp.prototype.test` method
8746
+ // https://tc39.es/ecma262/#sec-regexp.prototype.test
8747
+ $$a({ target: 'RegExp', proto: true, forced: !DELEGATES_TO_EXEC }, {
8748
+ test: function (S) {
8749
+ var R = anObject$3(this);
8750
+ var string = toString$6(S);
8751
+ var exec = R.exec;
8752
+ if (!isCallable(exec)) return call$2(nativeTest, R, string);
8753
+ var result = call$2(exec, R, string);
8754
+ if (result === null) return false;
8755
+ anObject$3(result);
8756
+ return true;
8668
8757
  }
8669
8758
  });
8670
8759
 
8671
- //#region src/generated/core/bodySerializer.gen.ts
8672
- const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
8760
+ var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
8761
+ var defineBuiltIn = defineBuiltIn$a;
8762
+ var anObject$2 = anObject$p;
8763
+ var $toString = toString$h;
8764
+ var fails$4 = fails$F;
8765
+ var getRegExpFlags = regexpGetFlags;
8673
8766
 
8674
- //#region src/generated/core/pathSerializer.gen.ts
8675
- const separatorArrayExplode = (style) => {
8676
- switch (style) {
8677
- case "label": return ".";
8678
- case "matrix": return ";";
8679
- case "simple": return ",";
8680
- default: return "&";
8681
- }
8682
- };
8767
+ var TO_STRING = 'toString';
8768
+ var RegExpPrototype = RegExp.prototype;
8769
+ var nativeToString = RegExpPrototype[TO_STRING];
8770
+
8771
+ var NOT_GENERIC = fails$4(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
8772
+ // FF44- RegExp#toString has a wrong name
8773
+ var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && nativeToString.name !== TO_STRING;
8774
+
8775
+ // `RegExp.prototype.toString` method
8776
+ // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
8777
+ if (NOT_GENERIC || INCORRECT_NAME) {
8778
+ defineBuiltIn(RegExpPrototype, TO_STRING, function toString() {
8779
+ var R = anObject$2(this);
8780
+ var pattern = $toString(R.source);
8781
+ var flags = $toString(getRegExpFlags(R));
8782
+ return '/' + pattern + '/' + flags;
8783
+ }, { unsafe: true });
8784
+ }
8785
+
8786
+ /**
8787
+ * Checks if a file system node should be ignored based on the provided ignore patterns
8788
+ */
8789
+ function shouldIgnoreFileSystemNode(nodeName, ignoredNodes) {
8790
+ for (const pattern of ignoredNodes) {
8791
+ if (typeof pattern === "string" && nodeName === pattern) {
8792
+ return true;
8793
+ }
8794
+ if (pattern instanceof RegExp && pattern.test(nodeName)) {
8795
+ return true;
8796
+ }
8797
+ }
8798
+ return false;
8799
+ }
8800
+
8801
+ /**
8802
+ * Serializes a directory structure into a FileSystemNode object
8803
+ * Files are read as binary and encoded to base64, directories are recursively processed
8804
+ */
8805
+ function serializeFileSystem(sourceDirectory, ignoredFileSystemNodes) {
8806
+ const fileSystemNode = {};
8807
+ const directoryContents = fs.readdirSync(sourceDirectory);
8808
+ directoryContents.forEach(directoryItem => {
8809
+ if (shouldIgnoreFileSystemNode(directoryItem, ignoredFileSystemNodes)) {
8810
+ return;
8811
+ }
8812
+ const fullPath = path$2.join(sourceDirectory, directoryItem);
8813
+ const directoryItemInformation = fs.statSync(fullPath);
8814
+ if (directoryItemInformation.isDirectory()) {
8815
+ fileSystemNode[directoryItem] = serializeFileSystem(fullPath, ignoredFileSystemNodes);
8816
+ } else if (directoryItemInformation.isFile()) {
8817
+ // Always read as binary and encode to base64 - this is the safest approach
8818
+ // and ensures all file types are handled correctly
8819
+ const buffer = fs.readFileSync(fullPath);
8820
+ fileSystemNode[directoryItem] = buffer.toString("base64");
8821
+ }
8822
+ });
8823
+ return fileSystemNode;
8824
+ }
8825
+
8826
+ var $$9 = _export;
8827
+ var flattenIntoArray = flattenIntoArray_1;
8828
+ var aCallable$3 = aCallable$l;
8829
+ var toObject$2 = toObject$c;
8830
+ var lengthOfArrayLike$2 = lengthOfArrayLike$h;
8831
+ var arraySpeciesCreate = arraySpeciesCreate$3;
8832
+
8833
+ // `Array.prototype.flatMap` method
8834
+ // https://tc39.es/ecma262/#sec-array.prototype.flatmap
8835
+ $$9({ target: 'Array', proto: true }, {
8836
+ flatMap: function flatMap(callbackfn /* , thisArg */) {
8837
+ var O = toObject$2(this);
8838
+ var sourceLen = lengthOfArrayLike$2(O);
8839
+ var A;
8840
+ aCallable$3(callbackfn);
8841
+ A = arraySpeciesCreate(O, 0);
8842
+ flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
8843
+ return A;
8844
+ }
8845
+ });
8846
+
8847
+ var tryToString = tryToString$6;
8848
+
8849
+ var $TypeError = TypeError;
8850
+
8851
+ var deletePropertyOrThrow$1 = function (O, P) {
8852
+ if (!delete O[P]) throw new $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
8853
+ };
8854
+
8855
+ var fails$3 = fails$F;
8856
+
8857
+ var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
8858
+ var method = [][METHOD_NAME];
8859
+ return !!method && fails$3(function () {
8860
+ // eslint-disable-next-line no-useless-call -- required for testing
8861
+ method.call(null, argument || function () { return 1; }, 1);
8862
+ });
8863
+ };
8864
+
8865
+ var $$8 = _export;
8866
+ var uncurryThis$5 = functionUncurryThis;
8867
+ var aCallable$2 = aCallable$l;
8868
+ var toObject$1 = toObject$c;
8869
+ var lengthOfArrayLike$1 = lengthOfArrayLike$h;
8870
+ var deletePropertyOrThrow = deletePropertyOrThrow$1;
8871
+ var toString$5 = toString$h;
8872
+ var fails$2 = fails$F;
8873
+ var internalSort = arraySort;
8874
+ var arrayMethodIsStrict = arrayMethodIsStrict$1;
8875
+ var FF = environmentFfVersion;
8876
+ var IE_OR_EDGE = environmentIsIeOrEdge;
8877
+ var V8 = environmentV8Version;
8878
+ var WEBKIT = environmentWebkitVersion;
8879
+
8880
+ var test = [];
8881
+ var nativeSort = uncurryThis$5(test.sort);
8882
+ var push = uncurryThis$5(test.push);
8883
+
8884
+ // IE8-
8885
+ var FAILS_ON_UNDEFINED = fails$2(function () {
8886
+ test.sort(undefined);
8887
+ });
8888
+ // V8 bug
8889
+ var FAILS_ON_NULL = fails$2(function () {
8890
+ test.sort(null);
8891
+ });
8892
+ // Old WebKit
8893
+ var STRICT_METHOD = arrayMethodIsStrict('sort');
8894
+
8895
+ var STABLE_SORT = !fails$2(function () {
8896
+ // feature detection can be too slow, so check engines versions
8897
+ if (V8) return V8 < 70;
8898
+ if (FF && FF > 3) return;
8899
+ if (IE_OR_EDGE) return true;
8900
+ if (WEBKIT) return WEBKIT < 603;
8901
+
8902
+ var result = '';
8903
+ var code, chr, value, index;
8904
+
8905
+ // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
8906
+ for (code = 65; code < 76; code++) {
8907
+ chr = String.fromCharCode(code);
8908
+
8909
+ switch (code) {
8910
+ case 66: case 69: case 70: case 72: value = 3; break;
8911
+ case 68: case 71: value = 4; break;
8912
+ default: value = 2;
8913
+ }
8914
+
8915
+ for (index = 0; index < 47; index++) {
8916
+ test.push({ k: chr + index, v: value });
8917
+ }
8918
+ }
8919
+
8920
+ test.sort(function (a, b) { return b.v - a.v; });
8921
+
8922
+ for (index = 0; index < test.length; index++) {
8923
+ chr = test[index].k.charAt(0);
8924
+ if (result.charAt(result.length - 1) !== chr) result += chr;
8925
+ }
8926
+
8927
+ return result !== 'DGBEFHACIJK';
8928
+ });
8929
+
8930
+ var FORCED$2 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
8931
+
8932
+ var getSortCompare = function (comparefn) {
8933
+ return function (x, y) {
8934
+ if (y === undefined) return -1;
8935
+ if (x === undefined) return 1;
8936
+ if (comparefn !== undefined) return +comparefn(x, y) || 0;
8937
+ var xString = toString$5(x);
8938
+ var yString = toString$5(y);
8939
+ return xString === yString ? 0 : xString > yString ? 1 : -1;
8940
+ };
8941
+ };
8942
+
8943
+ // `Array.prototype.sort` method
8944
+ // https://tc39.es/ecma262/#sec-array.prototype.sort
8945
+ $$8({ target: 'Array', proto: true, forced: FORCED$2 }, {
8946
+ sort: function sort(comparefn) {
8947
+ if (comparefn !== undefined) aCallable$2(comparefn);
8948
+
8949
+ var array = toObject$1(this);
8950
+
8951
+ if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
8952
+
8953
+ var items = [];
8954
+ var arrayLength = lengthOfArrayLike$1(array);
8955
+ var itemsLength, index;
8956
+
8957
+ for (index = 0; index < arrayLength; index++) {
8958
+ if (index in array) push(items, array[index]);
8959
+ }
8960
+
8961
+ internalSort(items, getSortCompare(comparefn));
8962
+
8963
+ itemsLength = lengthOfArrayLike$1(items);
8964
+ index = 0;
8965
+
8966
+ while (index < itemsLength) array[index] = items[index++];
8967
+ while (index < arrayLength) deletePropertyOrThrow(array, index++);
8968
+
8969
+ return array;
8970
+ }
8971
+ });
8972
+
8973
+ // this method was added to unscopables after implementation
8974
+ // in popular engines, so it's moved to a separate module
8975
+ var addToUnscopables$1 = addToUnscopables$5;
8976
+
8977
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
8978
+ addToUnscopables$1('flatMap');
8979
+
8980
+ var call$1 = functionCall;
8981
+ var anObject$1 = anObject$p;
8982
+ var getIteratorDirect$1 = getIteratorDirect$8;
8983
+ var getIteratorMethod = getIteratorMethod$4;
8984
+
8985
+ var getIteratorFlattenable$1 = function (obj, stringHandling) {
8986
+ if (!stringHandling || typeof obj !== 'string') anObject$1(obj);
8987
+ var method = getIteratorMethod(obj);
8988
+ return getIteratorDirect$1(anObject$1(method !== undefined ? call$1(method, obj) : obj));
8989
+ };
8990
+
8991
+ var $$7 = _export;
8992
+ var call = functionCall;
8993
+ var aCallable$1 = aCallable$l;
8994
+ var anObject = anObject$p;
8995
+ var getIteratorDirect = getIteratorDirect$8;
8996
+ var getIteratorFlattenable = getIteratorFlattenable$1;
8997
+ var createIteratorProxy = iteratorCreateProxy;
8998
+ var iteratorClose = iteratorClose$c;
8999
+ var iteratorHelperThrowsOnInvalidIterator = iteratorHelperThrowsOnInvalidIterator$3;
9000
+ var iteratorHelperWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError$6;
9001
+
9002
+ // Should not throw an error for an iterator without `return` method. Fixed in Safari 26.2
9003
+ // https://bugs.webkit.org/show_bug.cgi?id=297532
9004
+ function throwsOnIteratorWithoutReturn() {
9005
+ try {
9006
+ // eslint-disable-next-line es/no-map, es/no-iterator, es/no-iterator-prototype-flatmap -- required for testing
9007
+ var it = Iterator.prototype.flatMap.call(new Map([[4, 5]]).entries(), function (v) { return v; });
9008
+ it.next();
9009
+ it['return']();
9010
+ } catch (error) {
9011
+ return true;
9012
+ }
9013
+ }
9014
+
9015
+ var FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !iteratorHelperThrowsOnInvalidIterator('flatMap', function () { /* empty */ });
9016
+ var flatMapWithoutClosingOnEarlyError = !FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR
9017
+ && iteratorHelperWithoutClosingOnEarlyError('flatMap', TypeError);
9018
+
9019
+ var FORCED$1 = FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || flatMapWithoutClosingOnEarlyError
9020
+ || throwsOnIteratorWithoutReturn();
9021
+
9022
+ var IteratorProxy = createIteratorProxy(function () {
9023
+ var iterator = this.iterator;
9024
+ var mapper = this.mapper;
9025
+ var result, inner;
9026
+
9027
+ while (true) {
9028
+ if (inner = this.inner) try {
9029
+ result = anObject(call(inner.next, inner.iterator));
9030
+ if (!result.done) return result.value;
9031
+ this.inner = null;
9032
+ } catch (error) { iteratorClose(iterator, 'throw', error); }
9033
+
9034
+ result = anObject(call(this.next, iterator));
9035
+
9036
+ if (this.done = !!result.done) return;
9037
+
9038
+ try {
9039
+ this.inner = getIteratorFlattenable(mapper(result.value, this.counter++), false);
9040
+ } catch (error) { iteratorClose(iterator, 'throw', error); }
9041
+ }
9042
+ });
9043
+
9044
+ // `Iterator.prototype.flatMap` method
9045
+ // https://tc39.es/ecma262/#sec-iterator.prototype.flatmap
9046
+ $$7({ target: 'Iterator', proto: true, real: true, forced: FORCED$1 }, {
9047
+ flatMap: function flatMap(mapper) {
9048
+ anObject(this);
9049
+ try {
9050
+ aCallable$1(mapper);
9051
+ } catch (error) {
9052
+ iteratorClose(this, 'throw', error);
9053
+ }
9054
+
9055
+ if (flatMapWithoutClosingOnEarlyError) return call(flatMapWithoutClosingOnEarlyError, this, mapper);
9056
+
9057
+ return new IteratorProxy(getIteratorDirect(this), {
9058
+ mapper: mapper,
9059
+ inner: null
9060
+ });
9061
+ }
9062
+ });
9063
+
9064
+ //#region src/generated/core/bodySerializer.gen.ts
9065
+ const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
9066
+
9067
+ //#region src/generated/core/pathSerializer.gen.ts
9068
+ const separatorArrayExplode = (style) => {
9069
+ switch (style) {
9070
+ case "label": return ".";
9071
+ case "matrix": return ";";
9072
+ case "simple": return ",";
9073
+ default: return "&";
9074
+ }
9075
+ };
8683
9076
  const separatorArrayNoExplode = (style) => {
8684
9077
  switch (style) {
8685
9078
  case "form": return ",";
@@ -9472,625 +9865,486 @@ const DIGITAL_TWIN_API_ORIGINS = {
9472
9865
  demo: "https://twins.vention.foo",
9473
9866
  prod: "https://twins.vention.com"
9474
9867
  };
9475
- const getOrigin = environment => {
9476
- var _a;
9477
- return (_a = getOriginOverride("VENTION_CLI_DIGITAL_TWIN_API_ORIGIN")) !== null && _a !== void 0 ? _a : DIGITAL_TWIN_API_ORIGINS[environment];
9478
- };
9479
- const createClient = (session, origins) => {
9480
- const strategy = new BearerStrategy({
9481
- exchange: oauth2TokenExchange({
9482
- issuer: origins.auth,
9483
- store: gatewayTokenStore(session),
9484
- fetch: fetchWithUserAgent
9485
- })
9486
- });
9487
- return {
9488
- api: createDigitalTwinApi({
9489
- baseUrl: origins.api,
9490
- authStrategy: strategy,
9491
- fetch: fetchWithUserAgent
9492
- }),
9493
- fetch: withAuthStrategy(strategy, fetchWithUserAgent)
9494
- };
9495
- };
9496
- const compareNewestFirst = (left, right) => Date.parse(right.createdAt) - Date.parse(left.createdAt);
9497
- const listReadyInstances = async api => {
9498
- const {
9499
- data,
9500
- error,
9501
- response
9502
- } = await api.listInstances();
9503
- if (data !== undefined) {
9504
- return data.filter(instance => instance.state === "ready").sort(compareNewestFirst);
9505
- }
9506
- if ((response === null || response === void 0 ? void 0 : response.ok) === false) {
9507
- throw buildApiError(response, typeof error === "object" && error !== null && Object.keys(error).length === 0 ? null : error, response.url);
9508
- }
9509
- throw error;
9510
- };
9511
- const buildConnection = (engineUrl, fetch) => ({
9512
- baseUrl: engineUrl,
9513
- headers: {},
9514
- fetch
9515
- });
9516
- const listDesigns$2 = async (session, origins) => {
9517
- const {
9518
- api,
9519
- fetch
9520
- } = createClient(session, origins);
9521
- const instances = await listReadyInstances(api);
9522
- const newestInstancePerDesign = instances.filter((instance, index) => instances.findIndex(other => other.designId === instance.designId) === index);
9523
- return newestInstancePerDesign.flatMap(instance => {
9524
- const engineLookup = findEndpoint(instance, "execution-engine");
9525
- return engineLookup.success ? [{
9526
- id: instance.designId,
9527
- name: instance.designName,
9528
- connection: buildConnection(engineLookup.url, fetch)
9529
- }] : [];
9530
- });
9531
- };
9532
- const resolveConnections = async (session, origins, designId) => {
9533
- const {
9534
- api,
9535
- fetch
9536
- } = createClient(session, origins);
9537
- const instances = await listReadyInstances(api);
9538
- return instances.filter(instance => instance.designId === designId).flatMap(instance => {
9539
- const engineLookup = findEndpoint(instance, "execution-engine");
9540
- return engineLookup.success ? [buildConnection(engineLookup.url, fetch)] : [];
9541
- });
9542
- };
9543
-
9544
- const LOCAL_DIGITAL_TWIN_URL = "http://localhost:3101";
9545
- const connection = {
9546
- baseUrl: LOCAL_DIGITAL_TWIN_URL,
9547
- headers: {},
9548
- fetch: fetchWithUserAgent
9549
- };
9550
- const resolveConnection = async () => connection;
9551
- const listDesigns$1 = async () => [{
9552
- id: 0,
9553
- name: "Local digital twin",
9554
- connection
9555
- }];
9556
-
9557
- const findDigitalTwinApiOrigins = session => {
9558
- const auth = getPlatformAuthOrigin(session.environment);
9559
- const api = getOrigin(session.environment);
9560
- if (!auth || !api) {
9561
- throw new Error(`The digital twin platform is not available on ${session.environment}`);
9562
- }
9563
- return {
9564
- auth,
9565
- api
9566
- };
9567
- };
9568
- const resolveDigitalTwinConnections = async (session, designId) => {
9569
- if (session.environment === "local") {
9570
- return [await resolveConnection()];
9571
- }
9572
- return resolveConnections(session, findDigitalTwinApiOrigins(session), designId);
9573
- };
9574
- const listDesigns = async session => {
9575
- if (session.environment === "local") {
9576
- return listDesigns$1();
9577
- }
9578
- return listDesigns$2(session, findDigitalTwinApiOrigins(session));
9579
- };
9580
-
9581
- const exitWithoutTwin$1 = () => {
9582
- console.log();
9583
- console.error(chalk.red("Sorry, it seems you do not have that design open with the MachineLogic tab selected."));
9584
- console.error(chalk.red("Please go to your browser, open your design, and navigate to the MachineLogic page."));
9585
- process.exit(1);
9586
- };
9587
- const getAppFromDigitalTwins = async (session, designId, {
9588
- applicationId,
9589
- appName
9590
- }) => {
9591
- const connections = await resolveDigitalTwinConnections(session, designId);
9592
- if (connections.length === 0) {
9593
- exitWithoutTwin$1();
9594
- }
9595
- console.log(chalk.blue("Fetching all applications with source code from digital twin..."));
9596
- const copies = (await Promise.all(connections.map(async connection => (await getAllApplicationsWithSourceCode(connection)).filter(app => app.id === applicationId).map(app => ({
9597
- app,
9598
- connection
9599
- }))))).flat();
9600
- const [newestCopy] = copies;
9601
- if (!newestCopy) {
9602
- console.log();
9603
- console.error(chalk.red(`Application "${appName}" (ID: ${applicationId}) not found in the digital twin.`));
9604
- process.exit(1);
9605
- }
9606
- if (copies.some(({
9607
- app
9608
- }) => !isDeepStrictEqual(app.sourceCode, newestCopy.app.sourceCode))) {
9609
- console.log();
9610
- console.error(chalk.red(`This design's twins hold different versions of "${appName}".`));
9611
- console.error(chalk.red("Each MachineBuilder tab open on the design runs its own twin, and a closed tab's twin can stay up for a while."));
9612
- console.error(chalk.red("If you just pushed, pull again in a few seconds, once every twin has finished taking the push."));
9613
- console.error(chalk.red("Otherwise run 'vention push' from a folder with the version you want, which gives every twin that copy."));
9614
- console.error(chalk.red("Or close the design's other tabs, then pull again once their twins have stopped."));
9615
- process.exit(1);
9616
- }
9617
- return newestCopy;
9618
- };
9619
- const getAvailableAppsFromDigitalTwin = async connection => {
9620
- const allApplications = await getAllApplicationsWithSourceCode(connection);
9621
- return allApplications.filter(app => app.type === "machine_code");
9622
- };
9623
- const createNewAppDirectory = async (session, currentDir) => {
9624
- const selection = await selectDesignAndApp(session);
9625
- const {
9626
- app: selectedApp,
9627
- connection
9628
- } = await getAppFromDigitalTwins(session, selection.selectedDesign.id, {
9629
- applicationId: selection.selectedApp.id,
9630
- appName: selection.selectedApp.name
9631
- });
9632
- if (!selectedApp.sourceCode) {
9633
- console.log();
9634
- console.log(chalk.yellow("No source code found for this application."));
9635
- process.exit(1);
9636
- }
9637
- const appDirectoryExists = await checkIfAppDirectoryExists(selectedApp.name, currentDir);
9638
- const safeFileName = sanitizeFileName(selectedApp.name);
9639
- if (appDirectoryExists) {
9640
- console.log();
9641
- console.error(chalk.red(`You already have a directory with name "${safeFileName}" here.`));
9642
- console.error(chalk.red("If that is the machine code app you are trying to pull, please navigate to the root folder of the app and run the 'vention pull' command from there."));
9643
- console.error(chalk.red("If not, please rename that directory and try again."));
9644
- process.exit(1);
9645
- }
9646
- const appDirectoryPath = await writeApplicationToDisk(selectedApp.name, selectedApp.sourceCode, currentDir);
9647
- const [assets, mmConfiguration] = await Promise.all([getLibraryAssets(connection), getMmConfiguration(connection)]);
9648
- if (assets !== undefined) {
9649
- await writeReadonlyJsonFile(appDirectoryPath, ".vention-design-scene-assets.json", assets);
9650
- }
9651
- await writeReadonlyJsonFile(appDirectoryPath, ".vention-design-configuration.json", mmConfiguration);
9652
- await writeMachineCodeAppDirectoryInfo(appDirectoryPath, {
9653
- appName: selectedApp.name,
9654
- designId: selection.selectedDesign.id,
9655
- applicationId: selectedApp.id,
9656
- lastPulledAt: new Date().toISOString(),
9657
- environment: session.environment,
9658
- uuid: selectedApp.uuid
9659
- });
9660
- console.log();
9661
- console.log(chalk.green(`✅ Successfully pulled "${selectedApp.name}" to: ${appDirectoryPath}`));
9662
- console.log(chalk.blue(`📁 To navigate to your project, run:`));
9663
- console.log(chalk.cyan(`cd "${safeFileName}"`));
9664
- console.log(chalk.blue("💡 You can now start working on your application!"));
9665
- };
9666
- const updateExistingAppDirectory = async (session, machineCodeAppDirectoryInfo, currentDir) => {
9667
- console.log(chalk.blue(`Found existing project: ${machineCodeAppDirectoryInfo.appName}`));
9668
- console.log(chalk.blue(`Design ID: ${machineCodeAppDirectoryInfo.designId}, App ID: ${machineCodeAppDirectoryInfo.applicationId}`));
9669
- const {
9670
- app: appWithSourceCode,
9671
- connection
9672
- } = await getAppFromDigitalTwins(session, machineCodeAppDirectoryInfo.designId, machineCodeAppDirectoryInfo);
9673
- await writeApplicationToDisk(appWithSourceCode.name, appWithSourceCode.sourceCode, currentDir, true);
9674
- const [assets, mmConfiguration] = await Promise.all([getLibraryAssets(connection), getMmConfiguration(connection)]);
9675
- if (assets !== undefined) {
9676
- await writeReadonlyJsonFile(currentDir, ".vention-design-scene-assets.json", assets);
9677
- }
9678
- await writeReadonlyJsonFile(currentDir, ".vention-design-configuration.json", mmConfiguration);
9679
- await writeMachineCodeAppDirectoryInfo(currentDir, Object.assign(Object.assign({}, machineCodeAppDirectoryInfo), {
9680
- lastPulledAt: new Date().toISOString()
9681
- }));
9682
- console.log();
9683
- console.log(chalk.green(`✅ Successfully pulled "${appWithSourceCode.name}" to: ${currentDir}`));
9684
- console.log(chalk.blue("💡 Your project has been updated with the latest changes!"));
9685
- };
9686
- const linkDirectory = async (session, currentDir) => {
9687
- const {
9688
- selectedDesign,
9689
- selectedApp
9690
- } = await selectDesignAndApp(session);
9691
- await writeMachineCodeAppDirectoryInfo(currentDir, {
9692
- appName: selectedApp.name,
9693
- designId: selectedDesign.id,
9694
- applicationId: selectedApp.id,
9695
- lastPulledAt: new Date().toISOString(),
9696
- environment: session.environment,
9697
- uuid: selectedApp.uuid
9868
+ const getOrigin = environment => {
9869
+ var _a;
9870
+ return (_a = getOriginOverride("VENTION_CLI_DIGITAL_TWIN_API_ORIGIN")) !== null && _a !== void 0 ? _a : DIGITAL_TWIN_API_ORIGINS[environment];
9871
+ };
9872
+ const createClient = (session, origins) => {
9873
+ const strategy = new BearerStrategy({
9874
+ exchange: oauth2TokenExchange({
9875
+ issuer: origins.auth,
9876
+ store: gatewayTokenStore(session),
9877
+ fetch: fetchWithUserAgent
9878
+ })
9698
9879
  });
9699
- console.log(chalk.green(`Successfully linked current directory to design "${selectedDesign.name}" (ID: ${selectedDesign.id})`));
9700
- console.log(chalk.green(`Application: "${selectedApp.name}" (ID: ${selectedApp.id})`));
9701
9880
  return {
9702
- selectedDesign,
9703
- selectedApp
9881
+ api: createDigitalTwinApi({
9882
+ baseUrl: origins.api,
9883
+ authStrategy: strategy,
9884
+ fetch: fetchWithUserAgent
9885
+ }),
9886
+ fetch: withAuthStrategy(strategy, fetchWithUserAgent)
9704
9887
  };
9705
9888
  };
9706
- const selectDesignAndApp = async session => {
9707
- const designs = await listDesigns(session);
9708
- if (designs.length === 0) {
9709
- console.log();
9710
- console.log(chalk.yellow("No running digital twins found. Please open a design and navigate to the machine logic tab to activate a digital twin."));
9711
- process.exit(1);
9889
+ const compareNewestFirst = (left, right) => Date.parse(right.createdAt) - Date.parse(left.createdAt);
9890
+ const listReadyInstances = async api => {
9891
+ const {
9892
+ data,
9893
+ error,
9894
+ response
9895
+ } = await api.listInstances();
9896
+ if (data !== undefined) {
9897
+ return data.filter(instance => instance.state === "ready").sort(compareNewestFirst);
9712
9898
  }
9713
- const selectedDesign = await select({
9714
- message: "Select a design:",
9715
- choices: designs.map(design => ({
9716
- name: `${design.name} (ID: ${design.id})`,
9717
- value: design
9718
- }))
9719
- });
9720
- const availableApps = await getAvailableAppsFromDigitalTwin(selectedDesign.connection);
9721
- if (availableApps.length === 0) {
9722
- console.log();
9723
- console.log(chalk.yellow("No machine code applications found in the digital twin"));
9724
- process.exit(1);
9899
+ if ((response === null || response === void 0 ? void 0 : response.ok) === false) {
9900
+ throw buildApiError(response, typeof error === "object" && error !== null && Object.keys(error).length === 0 ? null : error, response.url);
9725
9901
  }
9726
- const selectedApp = await select({
9727
- message: "Select an application:",
9728
- choices: availableApps.map(app => ({
9729
- name: app.name,
9730
- value: app
9731
- }))
9902
+ throw error;
9903
+ };
9904
+ const buildConnection = (engineUrl, fetch) => ({
9905
+ baseUrl: engineUrl,
9906
+ headers: {},
9907
+ fetch
9908
+ });
9909
+ const listDesigns$2 = async (session, origins) => {
9910
+ const {
9911
+ api,
9912
+ fetch
9913
+ } = createClient(session, origins);
9914
+ const instances = await listReadyInstances(api);
9915
+ const newestInstancePerDesign = instances.filter((instance, index) => instances.findIndex(other => other.designId === instance.designId) === index);
9916
+ return newestInstancePerDesign.flatMap(instance => {
9917
+ const engineLookup = findEndpoint(instance, "execution-engine");
9918
+ return engineLookup.success ? [{
9919
+ id: instance.designId,
9920
+ name: instance.designName,
9921
+ connection: buildConnection(engineLookup.url, fetch)
9922
+ }] : [];
9732
9923
  });
9733
- return {
9734
- selectedDesign,
9735
- selectedApp
9736
- };
9737
9924
  };
9738
-
9739
- function createLinkCommand() {
9740
- return new Command("link").description("Link current directory to a Vention design application").action(async () => {
9741
- try {
9742
- const session = await loadSession();
9743
- if (!session) {
9744
- console.error(chalk.red("Not logged in. Please run 'vention login' first."));
9745
- process.exit(1);
9746
- }
9747
- const currentDir = process.cwd();
9748
- console.log();
9749
- await linkDirectory(session, currentDir);
9750
- console.log(chalk.blue("You can now use 'vention pull' to download app content or 'vention push' to upload local changes."));
9751
- } catch (error) {
9752
- handleCommandError(error, "Failed to link directory");
9753
- }
9925
+ const resolveConnections = async (session, origins, designId) => {
9926
+ const {
9927
+ api,
9928
+ fetch
9929
+ } = createClient(session, origins);
9930
+ const instances = await listReadyInstances(api);
9931
+ return instances.filter(instance => instance.designId === designId).flatMap(instance => {
9932
+ const engineLookup = findEndpoint(instance, "execution-engine");
9933
+ return engineLookup.success ? [buildConnection(engineLookup.url, fetch)] : [];
9754
9934
  });
9755
- }
9756
-
9757
- var DESCRIPTORS$1 = descriptors;
9758
- var globalThis$1 = globalThis_1;
9759
- var uncurryThis$5 = functionUncurryThis;
9760
- var isForced = isForced_1;
9761
- var inheritIfRequired = inheritIfRequired$4;
9762
- var createNonEnumerableProperty = createNonEnumerableProperty$d;
9763
- var create = objectCreate;
9764
- var getOwnPropertyNames = objectGetOwnPropertyNames.f;
9765
- var isPrototypeOf = objectIsPrototypeOf;
9766
- var isRegExp = isRegexp;
9767
- var toString$6 = toString$h;
9768
- var getRegExpFlags$1 = regexpGetFlags;
9769
- var stickyHelpers = regexpStickyHelpers;
9770
- var proxyAccessor = proxyAccessor$2;
9771
- var defineBuiltIn$1 = defineBuiltIn$a;
9772
- var fails$3 = fails$F;
9773
- var hasOwn = hasOwnProperty_1;
9774
- var enforceInternalState = internalState.enforce;
9775
- var setSpecies = setSpecies$4;
9776
- var wellKnownSymbol = wellKnownSymbol$n;
9777
- var UNSUPPORTED_DOT_ALL$1 = regexpUnsupportedDotAll;
9778
- var UNSUPPORTED_NCG = regexpUnsupportedNcg;
9779
-
9780
- var MATCH = wellKnownSymbol('match');
9781
- var NativeRegExp = globalThis$1.RegExp;
9782
- var RegExpPrototype$2 = NativeRegExp.prototype;
9783
- var SyntaxError$1 = globalThis$1.SyntaxError;
9784
- var exec = uncurryThis$5(RegExpPrototype$2.exec);
9785
- var charAt$1 = uncurryThis$5(''.charAt);
9786
- var replace$1 = uncurryThis$5(''.replace);
9787
- var stringIndexOf = uncurryThis$5(''.indexOf);
9788
- var stringSlice$2 = uncurryThis$5(''.slice);
9789
- // TODO: Use only proper RegExpIdentifierName
9790
- var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
9791
- var re1 = /a/g;
9792
- var re2 = /a/g;
9793
-
9794
- // "new" should create a new object, old webkit bug
9795
- var CORRECT_NEW = new NativeRegExp(re1) !== re1;
9796
-
9797
- var MISSED_STICKY = stickyHelpers.MISSED_STICKY;
9798
- var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
9799
-
9800
- var BASE_FORCED = DESCRIPTORS$1 &&
9801
- (!CORRECT_NEW || MISSED_STICKY || UNSUPPORTED_DOT_ALL$1 || UNSUPPORTED_NCG || fails$3(function () {
9802
- re2[MATCH] = false;
9803
- // RegExp constructor can alter flags and IsRegExp works correct with @@match
9804
- // eslint-disable-next-line sonarjs/inconsistent-function-call -- required for testing
9805
- return NativeRegExp(re1) !== re1 || NativeRegExp(re2) === re2 || String(NativeRegExp(re1, 'i')) !== '/a/i';
9806
- }));
9935
+ };
9807
9936
 
9808
- var handleDotAll = function (string) {
9809
- var length = string.length;
9810
- var index = 0;
9811
- var result = '';
9812
- var brackets = false;
9813
- var chr;
9814
- for (; index < length; index++) {
9815
- chr = charAt$1(string, index);
9816
- if (chr === '\\') {
9817
- result += chr + charAt$1(string, ++index);
9818
- continue;
9819
- }
9820
- if (!brackets && chr === '.') {
9821
- result += '[\\s\\S]';
9822
- } else {
9823
- if (chr === '[') {
9824
- brackets = true;
9825
- } else if (chr === ']') {
9826
- brackets = false;
9827
- } result += chr;
9828
- }
9829
- } return result;
9937
+ const LOCAL_DIGITAL_TWIN_URL = "http://localhost:3101";
9938
+ const connection = {
9939
+ baseUrl: LOCAL_DIGITAL_TWIN_URL,
9940
+ headers: {},
9941
+ fetch: fetchWithUserAgent
9830
9942
  };
9943
+ const resolveConnection = async () => connection;
9944
+ const listDesigns$1 = async () => [{
9945
+ id: 0,
9946
+ name: "Local digital twin",
9947
+ connection
9948
+ }];
9831
9949
 
9832
- var handleNCG = function (string) {
9833
- var length = string.length;
9834
- var index = 0;
9835
- var result = '';
9836
- var named = [];
9837
- var names = create(null);
9838
- var brackets = false;
9839
- var ncg = false;
9840
- var groupid = 0;
9841
- var groupname = '';
9842
- var chr;
9843
- for (; index < length; index++) {
9844
- chr = charAt$1(string, index);
9845
- if (chr === '\\') {
9846
- chr += charAt$1(string, ++index);
9847
- // use `\x5c` for escaped backslash to avoid corruption by `\k<name>` to `\N` replacement below
9848
- if (!ncg && charAt$1(chr, 1) === '\\') {
9849
- result += '\\x5c';
9850
- continue;
9851
- }
9852
- } else if (chr === ']') {
9853
- brackets = false;
9854
- } else if (!brackets) switch (true) {
9855
- case chr === '[':
9856
- brackets = true;
9857
- break;
9858
- case chr === '(':
9859
- result += chr;
9860
- if (exec(IS_NCG, stringSlice$2(string, index + 1))) {
9861
- index += 2;
9862
- ncg = true;
9863
- groupid++;
9864
- } else if (charAt$1(string, index + 1) !== '?') {
9865
- groupid++;
9866
- }
9867
- continue;
9868
- case chr === '>' && ncg:
9869
- if (groupname === '' || hasOwn(names, groupname)) {
9870
- throw new SyntaxError$1('Invalid capture group name');
9871
- }
9872
- names[groupname] = true;
9873
- named[named.length] = [groupname, groupid];
9874
- ncg = false;
9875
- groupname = '';
9876
- continue;
9877
- }
9878
- if (ncg) groupname += chr;
9879
- else result += chr;
9950
+ const findDigitalTwinApiOrigins = session => {
9951
+ const auth = getPlatformAuthOrigin(session.environment);
9952
+ const api = getOrigin(session.environment);
9953
+ if (!auth || !api) {
9954
+ throw new Error(`The digital twin platform is not available on ${session.environment}`);
9880
9955
  }
9881
- // convert `\k<name>` backreferences to numbered backreferences
9882
- for (var ni = 0; ni < named.length; ni++) {
9883
- var backref = '\\k<' + named[ni][0] + '>';
9884
- var numRef = '\\' + named[ni][1];
9885
- while (stringIndexOf(result, backref) > -1) {
9886
- result = replace$1(result, backref, numRef);
9887
- }
9888
- } return [result, named];
9956
+ return {
9957
+ auth,
9958
+ api
9959
+ };
9960
+ };
9961
+ const resolveDigitalTwinConnections = async (session, designId) => {
9962
+ if (session.environment === "local") {
9963
+ return [await resolveConnection()];
9964
+ }
9965
+ return resolveConnections(session, findDigitalTwinApiOrigins(session), designId);
9966
+ };
9967
+ const listDesigns = async session => {
9968
+ if (session.environment === "local") {
9969
+ return listDesigns$1();
9970
+ }
9971
+ return listDesigns$2(session, findDigitalTwinApiOrigins(session));
9889
9972
  };
9890
9973
 
9891
- // `RegExp` constructor
9892
- // https://tc39.es/ecma262/#sec-regexp-constructor
9893
- if (isForced('RegExp', BASE_FORCED)) {
9894
- var RegExpWrapper = function RegExp(pattern, flags) {
9895
- var thisIsRegExp = isPrototypeOf(RegExpPrototype$2, this);
9896
- var patternIsRegExp = isRegExp(pattern);
9897
- var flagsAreUndefined = flags === undefined;
9898
- var groups = [];
9899
- var rawPattern = pattern;
9900
- var rawFlags, dotAll, sticky, handled, result, state;
9901
-
9902
- if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
9903
- return pattern;
9904
- }
9905
-
9906
- if (patternIsRegExp || isPrototypeOf(RegExpPrototype$2, pattern)) {
9907
- pattern = pattern.source;
9908
- if (flagsAreUndefined) flags = getRegExpFlags$1(rawPattern);
9909
- }
9910
-
9911
- pattern = pattern === undefined ? '' : toString$6(pattern);
9912
- flags = flags === undefined ? '' : toString$6(flags);
9913
- rawPattern = pattern;
9914
-
9915
- if (UNSUPPORTED_DOT_ALL$1 && 'dotAll' in re1) {
9916
- dotAll = !!flags && stringIndexOf(flags, 's') > -1;
9917
- if (dotAll) flags = replace$1(flags, /s/g, '');
9918
- }
9974
+ var uncurryThis$4 = functionUncurryThis;
9919
9975
 
9920
- rawFlags = flags;
9976
+ // eslint-disable-next-line es/no-map -- safe
9977
+ var MapPrototype = Map.prototype;
9921
9978
 
9922
- if (MISSED_STICKY && 'sticky' in re1) {
9923
- sticky = !!flags && stringIndexOf(flags, 'y') > -1;
9924
- if (sticky && UNSUPPORTED_Y) flags = replace$1(flags, /y/g, '');
9925
- }
9979
+ var mapHelpers = {
9980
+ set: uncurryThis$4(MapPrototype.set),
9981
+ get: uncurryThis$4(MapPrototype.get),
9982
+ has: uncurryThis$4(MapPrototype.has),
9983
+ remove: uncurryThis$4(MapPrototype['delete'])};
9926
9984
 
9927
- if (UNSUPPORTED_NCG) {
9928
- handled = handleNCG(pattern);
9929
- pattern = handled[0];
9930
- groups = handled[1];
9931
- }
9985
+ var $$6 = _export;
9986
+ var MapHelpers$1 = mapHelpers;
9987
+ var IS_PURE$1 = isPure;
9932
9988
 
9933
- result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype$2, RegExpWrapper);
9989
+ var get$1 = MapHelpers$1.get;
9990
+ var has$1 = MapHelpers$1.has;
9991
+ var set$1 = MapHelpers$1.set;
9934
9992
 
9935
- if (dotAll || sticky || groups.length) {
9936
- state = enforceInternalState(result);
9937
- if (dotAll) {
9938
- state.dotAll = true;
9939
- state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
9940
- }
9941
- if (sticky) state.sticky = true;
9942
- if (groups.length) state.groups = groups;
9943
- }
9993
+ // `Map.prototype.getOrInsert` method
9994
+ // https://tc39.es/ecma262/#sec-map.prototype.getorinsert
9995
+ $$6({ target: 'Map', proto: true, real: true, forced: IS_PURE$1 }, {
9996
+ getOrInsert: function getOrInsert(key, value) {
9997
+ if (has$1(this, key)) return get$1(this, key);
9998
+ set$1(this, key, value);
9999
+ return value;
10000
+ }
10001
+ });
9944
10002
 
9945
- if (pattern !== rawPattern) try {
9946
- // fails in old engines, but we have no alternatives for unsupported regex syntax
9947
- createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);
9948
- } catch (error) { /* empty */ }
10003
+ var $$5 = _export;
10004
+ var aCallable = aCallable$l;
10005
+ var MapHelpers = mapHelpers;
10006
+ var IS_PURE = isPure;
9949
10007
 
9950
- return result;
9951
- };
10008
+ var get = MapHelpers.get;
10009
+ var has = MapHelpers.has;
10010
+ var set = MapHelpers.set;
9952
10011
 
9953
- for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) {
9954
- proxyAccessor(RegExpWrapper, NativeRegExp, keys[index++]);
10012
+ // `Map.prototype.getOrInsertComputed` method
10013
+ // https://tc39.es/ecma262/#sec-map.prototype.getorinsertcomputed
10014
+ $$5({ target: 'Map', proto: true, real: true, forced: IS_PURE }, {
10015
+ getOrInsertComputed: function getOrInsertComputed(key, callbackfn) {
10016
+ var hasKey = has(this, key);
10017
+ aCallable(callbackfn);
10018
+ if (hasKey) return get(this, key);
10019
+ // CanonicalizeKeyedCollectionKey
10020
+ if (key === 0 && 1 / key === -Infinity) key = 0;
10021
+ var value = callbackfn(key);
10022
+ set(this, key, value);
10023
+ return value;
9955
10024
  }
10025
+ });
9956
10026
 
9957
- RegExpPrototype$2.constructor = RegExpWrapper;
9958
- RegExpWrapper.prototype = RegExpPrototype$2;
9959
- defineBuiltIn$1(globalThis$1, 'RegExp', RegExpWrapper, { constructor: true });
9960
- }
10027
+ var $$4 = _export;
10028
+ var uncurryThis$3 = functionUncurryThisClause;
10029
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
10030
+ var toLength$1 = toLength$7;
10031
+ var toString$4 = toString$h;
10032
+ var notARegExp = notARegexp;
10033
+ var requireObjectCoercible$4 = requireObjectCoercible$c;
10034
+ var correctIsRegExpLogic = correctIsRegexpLogic;
9961
10035
 
9962
- // https://tc39.es/ecma262/#sec-get-regexp-@@species
9963
- setSpecies('RegExp');
10036
+ var stringSlice$1 = uncurryThis$3(''.slice);
10037
+ var min = Math.min;
9964
10038
 
9965
- var DESCRIPTORS = descriptors;
9966
- var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
9967
- var classof = classofRaw$2;
9968
- var defineBuiltInAccessor = defineBuiltInAccessor$9;
9969
- var getInternalState = internalState.get;
10039
+ var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
10040
+ // https://github.com/zloirock/core-js/pull/702
10041
+ var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
10042
+ var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
10043
+ return descriptor && !descriptor.writable;
10044
+ }();
9970
10045
 
9971
- var RegExpPrototype$1 = RegExp.prototype;
9972
- var $TypeError = TypeError;
10046
+ // `String.prototype.startsWith` method
10047
+ // https://tc39.es/ecma262/#sec-string.prototype.startswith
10048
+ $$4({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
10049
+ startsWith: function startsWith(searchString /* , position = 0 */) {
10050
+ var that = toString$4(requireObjectCoercible$4(this));
10051
+ notARegExp(searchString);
10052
+ var search = toString$4(searchString);
10053
+ var index = toLength$1(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
10054
+ return stringSlice$1(that, index, index + search.length) === search;
10055
+ }
10056
+ });
9973
10057
 
9974
- // `RegExp.prototype.dotAll` getter
9975
- // https://tc39.es/ecma262/#sec-get-regexp.prototype.dotall
9976
- if (DESCRIPTORS && UNSUPPORTED_DOT_ALL) {
9977
- defineBuiltInAccessor(RegExpPrototype$1, 'dotAll', {
9978
- configurable: true,
9979
- get: function dotAll() {
9980
- if (this === RegExpPrototype$1) return;
9981
- // We can't use InternalStateModule.getterFor because
9982
- // we don't add metadata for regexps created by a literal.
9983
- if (classof(this) === 'RegExp') {
9984
- return !!getInternalState(this).dotAll;
9985
- }
9986
- throw new $TypeError('Incompatible receiver, RegExp required');
10058
+ const fileHashes = (node, ignorePatterns, directory) => Object.entries(node).filter(([name]) => !shouldIgnoreFileSystemNode(name, ignorePatterns)).flatMap(([name, contentOrNode]) => {
10059
+ const relativePath = `${directory}${name}`;
10060
+ return typeof contentOrNode === "string" ? [[relativePath, createHash$1("sha256").update(Buffer.from(contentOrNode, "base64")).digest("hex")]] : fileHashes(contentOrNode, ignorePatterns, `${relativePath}/`);
10061
+ });
10062
+ const isGenerated = filePath => filePath.startsWith("ui/") || filePath === "proto/app.proto" || filePath.startsWith("customui/src/gen/");
10063
+ const fingerprintFiles = (sourceCode, ignorePatterns) => Object.fromEntries(fileHashes(sourceCode, ignorePatterns, "").filter(([filePath]) => !isGenerated(filePath)));
10064
+ const filesAtRisk = ({
10065
+ synced,
10066
+ target,
10067
+ incoming,
10068
+ replacesTarget
10069
+ }) => {
10070
+ const syncedHashes = new Map(Object.entries(synced));
10071
+ const incomingHashes = new Map(Object.entries(incoming));
10072
+ const changedOnTarget = Object.entries(target).filter(([filePath, targetHash]) => {
10073
+ if (syncedHashes.get(filePath) === targetHash) return false;
10074
+ const incomingHash = incomingHashes.get(filePath);
10075
+ return incomingHash === undefined ? replacesTarget : incomingHash !== targetHash;
10076
+ }).map(([filePath]) => filePath);
10077
+ const deletedOnTarget = [...syncedHashes.keys()].filter(filePath => !(filePath in target) && incomingHashes.has(filePath));
10078
+ return [...changedOnTarget, ...deletedOnTarget].sort();
10079
+ };
10080
+
10081
+ const exitWithoutTwin$1 = () => {
10082
+ console.log();
10083
+ console.error(chalk.red("Sorry, it seems you do not have that design open with the MachineLogic tab selected."));
10084
+ console.error(chalk.red("Please go to your browser, open your design, and navigate to the MachineLogic page."));
10085
+ process.exit(1);
10086
+ };
10087
+ const getAppFromDigitalTwins = async (session, designId, {
10088
+ applicationId,
10089
+ appName
10090
+ }) => {
10091
+ const connections = await resolveDigitalTwinConnections(session, designId);
10092
+ if (connections.length === 0) {
10093
+ exitWithoutTwin$1();
10094
+ }
10095
+ console.log(chalk.blue("Fetching all applications with source code from digital twin..."));
10096
+ const copies = (await Promise.all(connections.map(async connection => (await getAllApplicationsWithSourceCode(connection)).filter(app => app.id === applicationId).map(app => ({
10097
+ app,
10098
+ connection
10099
+ }))))).flat();
10100
+ const [newestCopy] = copies;
10101
+ if (!newestCopy) {
10102
+ console.log();
10103
+ console.error(chalk.red(`Application "${appName}" (ID: ${applicationId}) not found in the digital twin.`));
10104
+ process.exit(1);
10105
+ }
10106
+ if (copies.some(({
10107
+ app
10108
+ }) => !isDeepStrictEqual(app.sourceCode, newestCopy.app.sourceCode))) {
10109
+ console.log();
10110
+ console.error(chalk.red(`This design's twins hold different versions of "${appName}".`));
10111
+ console.error(chalk.red("Each MachineBuilder tab open on the design runs its own twin, and a closed tab's twin can stay up for a while."));
10112
+ console.error(chalk.red("If you just pushed, pull again in a few seconds, once every twin has finished taking the push."));
10113
+ console.error(chalk.red("Otherwise run 'vention push' from a folder with the version you want, which gives every twin that copy."));
10114
+ console.error(chalk.red("Or close the design's other tabs, then pull again once their twins have stopped."));
10115
+ process.exit(1);
10116
+ }
10117
+ return newestCopy;
10118
+ };
10119
+ const getAvailableAppsFromDigitalTwin = async connection => {
10120
+ const allApplications = await getAllApplicationsWithSourceCode(connection);
10121
+ return allApplications.filter(app => app.type === "machine_code");
10122
+ };
10123
+ const exitWithoutSourceCode = app => {
10124
+ if (app.sourceCode) return;
10125
+ console.log();
10126
+ console.log(chalk.yellow("No source code found for this application."));
10127
+ process.exit(1);
10128
+ };
10129
+ const createNewAppDirectory = async (session, currentDir, flags) => {
10130
+ const selection = await selectDesignAndApp(session, flags);
10131
+ const {
10132
+ app: selectedApp,
10133
+ connection
10134
+ } = await getAppFromDigitalTwins(session, selection.selectedDesign.id, {
10135
+ applicationId: selection.selectedApp.id,
10136
+ appName: selection.selectedApp.name
10137
+ });
10138
+ exitWithoutSourceCode(selectedApp);
10139
+ const appDirectoryExists = await checkIfAppDirectoryExists(selectedApp.name, currentDir);
10140
+ const safeFileName = sanitizeFileName(selectedApp.name);
10141
+ if (appDirectoryExists) {
10142
+ console.log();
10143
+ console.error(chalk.red(`You already have a directory with name "${safeFileName}" here.`));
10144
+ console.error(chalk.red("If that is the machine code app you are trying to pull, please navigate to the root folder of the app and run the 'vention pull' command from there."));
10145
+ console.error(chalk.red("If not, please rename that directory and try again."));
10146
+ process.exit(1);
10147
+ }
10148
+ const appDirectoryPath = await writeApplicationToDisk(selectedApp.name, selectedApp.sourceCode, currentDir);
10149
+ const [assets, mmConfiguration] = await Promise.all([getLibraryAssets(connection), getMmConfiguration(connection)]);
10150
+ if (assets !== undefined) {
10151
+ await writeReadonlyJsonFile(appDirectoryPath, ".vention-design-scene-assets.json", assets);
10152
+ }
10153
+ await writeReadonlyJsonFile(appDirectoryPath, ".vention-design-configuration.json", mmConfiguration);
10154
+ await writeMachineCodeAppDirectoryInfo(appDirectoryPath, {
10155
+ appName: selectedApp.name,
10156
+ designId: selection.selectedDesign.id,
10157
+ applicationId: selectedApp.id,
10158
+ lastPulledAt: new Date().toISOString(),
10159
+ environment: session.environment,
10160
+ uuid: selectedApp.uuid,
10161
+ syncedFiles: fingerprintFiles(selectedApp.sourceCode, getDefaultIgnorePatterns())
10162
+ });
10163
+ console.log();
10164
+ console.log(chalk.green(`✅ Successfully pulled "${selectedApp.name}" to: ${appDirectoryPath}`));
10165
+ console.log(chalk.blue(`📁 To navigate to your project, run:`));
10166
+ console.log(chalk.cyan(`cd "${safeFileName}"`));
10167
+ console.log(chalk.blue("💡 You can now start working on your application!"));
10168
+ };
10169
+ const updateExistingAppDirectory = async (session, machineCodeAppDirectoryInfo, currentDir, {
10170
+ force: _force = false
10171
+ } = {}) => {
10172
+ console.log(chalk.blue(`Found existing project: ${machineCodeAppDirectoryInfo.appName}`));
10173
+ console.log(chalk.blue(`Design ID: ${machineCodeAppDirectoryInfo.designId}, App ID: ${machineCodeAppDirectoryInfo.applicationId}`));
10174
+ const {
10175
+ app: appWithSourceCode,
10176
+ connection
10177
+ } = await getAppFromDigitalTwins(session, machineCodeAppDirectoryInfo.designId, machineCodeAppDirectoryInfo);
10178
+ exitWithoutSourceCode(appWithSourceCode);
10179
+ const ignorePatterns = getDefaultIgnorePatterns();
10180
+ const remoteFiles = fingerprintFiles(appWithSourceCode.sourceCode, ignorePatterns);
10181
+ if (machineCodeAppDirectoryInfo.syncedFiles && !_force) {
10182
+ const localEdits = filesAtRisk({
10183
+ synced: machineCodeAppDirectoryInfo.syncedFiles,
10184
+ target: fingerprintFiles(serializeFileSystem(currentDir, ignorePatterns), ignorePatterns),
10185
+ incoming: remoteFiles,
10186
+ replacesTarget: false
10187
+ });
10188
+ if (localEdits.length > 0) {
10189
+ console.log("These files changed here since your last pull:");
10190
+ localEdits.forEach(filePath => console.log(` ${filePath}`));
10191
+ console.log("To keep them, run 'vention push' first. To throw them away, run 'vention pull --force'.");
10192
+ process.exit(1);
9987
10193
  }
10194
+ }
10195
+ await writeApplicationToDisk(appWithSourceCode.name, appWithSourceCode.sourceCode, currentDir, true);
10196
+ const [assets, mmConfiguration] = await Promise.all([getLibraryAssets(connection), getMmConfiguration(connection)]);
10197
+ if (assets !== undefined) {
10198
+ await writeReadonlyJsonFile(currentDir, ".vention-design-scene-assets.json", assets);
10199
+ }
10200
+ await writeReadonlyJsonFile(currentDir, ".vention-design-configuration.json", mmConfiguration);
10201
+ await writeMachineCodeAppDirectoryInfo(currentDir, Object.assign(Object.assign({}, machineCodeAppDirectoryInfo), {
10202
+ lastPulledAt: new Date().toISOString(),
10203
+ syncedFiles: remoteFiles
10204
+ }));
10205
+ console.log();
10206
+ console.log(chalk.green(`✅ Successfully pulled "${appWithSourceCode.name}" to: ${currentDir}`));
10207
+ console.log(chalk.blue("💡 Your project has been updated with the latest changes!"));
10208
+ };
10209
+ const linkDirectory = async (session, currentDir, flags) => {
10210
+ const {
10211
+ selectedDesign,
10212
+ selectedApp
10213
+ } = await selectDesignAndApp(session, flags);
10214
+ const {
10215
+ app: designCopy
10216
+ } = await getAppFromDigitalTwins(session, selectedDesign.id, {
10217
+ applicationId: selectedApp.id,
10218
+ appName: selectedApp.name
9988
10219
  });
9989
- }
9990
-
9991
- // TODO: Remove from `core-js@4` since it's moved to entry points
9992
-
9993
- var $$7 = _export;
9994
- var call = functionCall;
9995
- var isCallable = isCallable$s;
9996
- var anObject$1 = anObject$o;
9997
- var toString$5 = toString$h;
9998
-
9999
- var DELEGATES_TO_EXEC = function () {
10000
- var execCalled = false;
10001
- var re = /[ac]/;
10002
- re.exec = function () {
10003
- execCalled = true;
10004
- return /./.exec.apply(this, arguments);
10220
+ await writeMachineCodeAppDirectoryInfo(currentDir, {
10221
+ appName: selectedApp.name,
10222
+ designId: selectedDesign.id,
10223
+ applicationId: selectedApp.id,
10224
+ lastPulledAt: new Date().toISOString(),
10225
+ environment: session.environment,
10226
+ uuid: selectedApp.uuid,
10227
+ syncedFiles: designCopy.sourceCode ? fingerprintFiles(designCopy.sourceCode, getDefaultIgnorePatterns()) : {}
10228
+ });
10229
+ console.log(chalk.green(`Successfully linked current directory to design "${selectedDesign.name}" (ID: ${selectedDesign.id})`));
10230
+ console.log(chalk.green(`Application: "${selectedApp.name}" (ID: ${selectedApp.id})`));
10231
+ return {
10232
+ selectedDesign,
10233
+ selectedApp
10005
10234
  };
10006
- return re.test('abc') === true && execCalled;
10007
- }();
10008
-
10009
- var nativeTest = /./.test;
10010
-
10011
- // `RegExp.prototype.test` method
10012
- // https://tc39.es/ecma262/#sec-regexp.prototype.test
10013
- $$7({ target: 'RegExp', proto: true, forced: !DELEGATES_TO_EXEC }, {
10014
- test: function (S) {
10015
- var R = anObject$1(this);
10016
- var string = toString$5(S);
10017
- var exec = R.exec;
10018
- if (!isCallable(exec)) return call(nativeTest, R, string);
10019
- var result = call(exec, R, string);
10020
- if (result === null) return false;
10021
- anObject$1(result);
10022
- return true;
10235
+ };
10236
+ const printOpenDesigns = designs => {
10237
+ console.log("Open designs:");
10238
+ designs.forEach(design => console.log(` ${design.name} (ID: ${design.id})`));
10239
+ };
10240
+ const printApps = (designName, apps) => {
10241
+ console.log(`Applications in "${designName}":`);
10242
+ apps.forEach(app => console.log(` ${app.name}`));
10243
+ };
10244
+ const pickDesign = async (designs, designFlag) => {
10245
+ if (designFlag !== undefined) {
10246
+ const flagged = designs.find(design => design.id === designFlag);
10247
+ if (flagged) return flagged;
10248
+ console.log(chalk.yellow(`Design ${designFlag} isn't open on its MachineLogic tab.`));
10249
+ printOpenDesigns(designs);
10250
+ process.exit(1);
10023
10251
  }
10024
- });
10025
-
10026
- var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
10027
- var defineBuiltIn = defineBuiltIn$a;
10028
- var anObject = anObject$o;
10029
- var $toString = toString$h;
10030
- var fails$2 = fails$F;
10031
- var getRegExpFlags = regexpGetFlags;
10032
-
10033
- var TO_STRING = 'toString';
10034
- var RegExpPrototype = RegExp.prototype;
10035
- var nativeToString = RegExpPrototype[TO_STRING];
10036
-
10037
- var NOT_GENERIC = fails$2(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
10038
- // FF44- RegExp#toString has a wrong name
10039
- var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && nativeToString.name !== TO_STRING;
10040
-
10041
- // `RegExp.prototype.toString` method
10042
- // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
10043
- if (NOT_GENERIC || INCORRECT_NAME) {
10044
- defineBuiltIn(RegExpPrototype, TO_STRING, function toString() {
10045
- var R = anObject(this);
10046
- var pattern = $toString(R.source);
10047
- var flags = $toString(getRegExpFlags(R));
10048
- return '/' + pattern + '/' + flags;
10049
- }, { unsafe: true });
10050
- }
10252
+ if (designs.length === 1) {
10253
+ console.log(`Using design "${designs[0].name}" (ID: ${designs[0].id}).`);
10254
+ return designs[0];
10255
+ }
10256
+ if (process.stdin.isTTY) {
10257
+ return select({
10258
+ message: "Select a design:",
10259
+ choices: designs.map(design => ({
10260
+ name: `${design.name} (ID: ${design.id})`,
10261
+ value: design
10262
+ }))
10263
+ });
10264
+ }
10265
+ printOpenDesigns(designs);
10266
+ console.log("Run the command again with --design <id>.");
10267
+ process.exit(1);
10268
+ };
10269
+ const pickApp = async (designName, apps, appFlag) => {
10270
+ var _a;
10271
+ if (appFlag !== undefined) {
10272
+ const flagged = (_a = apps.find(app => app.name === appFlag)) !== null && _a !== void 0 ? _a : apps.find(app => app.id === appFlag);
10273
+ if (flagged) return flagged;
10274
+ console.log(chalk.yellow(`No application called "${appFlag}" in "${designName}".`));
10275
+ printApps(designName, apps);
10276
+ process.exit(1);
10277
+ }
10278
+ if (apps.length === 1) {
10279
+ console.log(`Using application "${apps[0].name}".`);
10280
+ return apps[0];
10281
+ }
10282
+ if (process.stdin.isTTY) {
10283
+ return select({
10284
+ message: "Select an application:",
10285
+ choices: apps.map(app => ({
10286
+ name: app.name,
10287
+ value: app
10288
+ }))
10289
+ });
10290
+ }
10291
+ printApps(designName, apps);
10292
+ console.log('Run the command again with --app "<name>".');
10293
+ process.exit(1);
10294
+ };
10295
+ const selectDesignAndApp = async (session, flags = {}) => {
10296
+ const designs = await listDesigns(session);
10297
+ if (designs.length === 0) {
10298
+ console.log();
10299
+ console.log(chalk.yellow("No design is open on its MachineLogic tab. Open your design in MachineBuilder, click the MachineLogic tab and keep that browser tab open. If you just opened it, wait about a minute while it starts, then run this again."));
10300
+ process.exit(1);
10301
+ }
10302
+ const selectedDesign = await pickDesign(designs, flags.design);
10303
+ const availableApps = await getAvailableAppsFromDigitalTwin(selectedDesign.connection);
10304
+ if (availableApps.length === 0) {
10305
+ console.log();
10306
+ console.log(chalk.yellow("This design has no MachineLogic application yet. On MachineLogic's Home page, click Create app and choose Python, then run this again."));
10307
+ process.exit(1);
10308
+ }
10309
+ const selectedApp = await pickApp(selectedDesign.name, availableApps, flags.app);
10310
+ return {
10311
+ selectedDesign,
10312
+ selectedApp
10313
+ };
10314
+ };
10051
10315
 
10052
- /**
10053
- * Checks if a file system node should be ignored based on the provided ignore patterns
10054
- */
10055
- function shouldIgnoreFileSystemNode(nodeName, ignoredNodes) {
10056
- for (const pattern of ignoredNodes) {
10057
- if (typeof pattern === "string" && nodeName === pattern) {
10058
- return true;
10059
- }
10060
- if (pattern instanceof RegExp && pattern.test(nodeName)) {
10061
- return true;
10062
- }
10316
+ const parseDesignId = value => {
10317
+ if (!/^\d+$/.test(value)) {
10318
+ throw new InvalidArgumentError("--design takes a design ID number");
10063
10319
  }
10064
- return false;
10065
- }
10320
+ return Number(value);
10321
+ };
10322
+ const addSelectionOptions = command => command.option("--design <id>", "ID of the open design to use", parseDesignId).option("--app <name>", "Name or ID of the application to use");
10066
10323
 
10067
- /**
10068
- * Serializes a directory structure into a FileSystemNode object
10069
- * Files are read as binary and encoded to base64, directories are recursively processed
10070
- */
10071
- function serializeFileSystem(sourceDirectory, ignoredFileSystemNodes) {
10072
- const fileSystemNode = {};
10073
- const directoryContents = fs.readdirSync(sourceDirectory);
10074
- directoryContents.forEach(directoryItem => {
10075
- if (shouldIgnoreFileSystemNode(directoryItem, ignoredFileSystemNodes)) {
10076
- return;
10077
- }
10078
- const fullPath = path$2.join(sourceDirectory, directoryItem);
10079
- const directoryItemInformation = fs.statSync(fullPath);
10080
- if (directoryItemInformation.isDirectory()) {
10081
- fileSystemNode[directoryItem] = serializeFileSystem(fullPath, ignoredFileSystemNodes);
10082
- } else if (directoryItemInformation.isFile()) {
10083
- // Always read as binary and encode to base64 - this is the safest approach
10084
- // and ensures all file types are handled correctly
10085
- const buffer = fs.readFileSync(fullPath);
10086
- fileSystemNode[directoryItem] = buffer.toString("base64");
10324
+ function createLinkCommand() {
10325
+ const command = new Command("link").description("Link current directory to a Vention design application");
10326
+ return addSelectionOptions(command).action(async flags => {
10327
+ try {
10328
+ const session = await loadSession();
10329
+ if (!session) {
10330
+ console.error(chalk.red("Not logged in. Please run 'vention login' first."));
10331
+ process.exit(1);
10332
+ }
10333
+ const currentDir = process.cwd();
10334
+ console.log();
10335
+ await linkDirectory(session, currentDir, flags);
10336
+ console.log(chalk.blue("You can now use 'vention pull' to download app content or 'vention push' to upload local changes."));
10337
+ } catch (error) {
10338
+ handleCommandError(error, "Failed to link directory");
10087
10339
  }
10088
10340
  });
10089
- return fileSystemNode;
10090
10341
  }
10091
10342
 
10092
10343
  function createPushCommand() {
10093
- return new Command("push").description("Push local changes from this directory to the linked digital twin").action(async () => {
10344
+ const command = new Command("push").description("Push local changes from this directory to the linked digital twin").option("--force", "Replace files changed on the design since the last pull or push");
10345
+ return command.action(async ({
10346
+ force
10347
+ }) => {
10094
10348
  try {
10095
10349
  const session = await loadSession();
10096
10350
  if (!session) {
@@ -10100,6 +10354,10 @@ function createPushCommand() {
10100
10354
  const currentDir = process.cwd();
10101
10355
  const machineCodeAppDirectoryInfo = await readMachineCodeAppDirectoryInfo(currentDir);
10102
10356
  if (!machineCodeAppDirectoryInfo) {
10357
+ if (!process.stdin.isTTY) {
10358
+ console.log("This folder isn't linked to a Vention application yet. Run 'vention link --design <id> --app <name>' here first, or 'vention pull' to download one into a new folder.");
10359
+ process.exit(1);
10360
+ }
10103
10361
  console.log();
10104
10362
  console.log(chalk.yellow("This directory is not linked to a Vention application."));
10105
10363
  const shouldLink = await select({
@@ -10138,6 +10396,28 @@ function createPushCommand() {
10138
10396
  console.log(chalk.blue("Serializing local files..."));
10139
10397
  const ignorePatterns = getDefaultIgnorePatterns();
10140
10398
  const serializedSourceCode = serializeFileSystem(currentDir, ignorePatterns);
10399
+ const localFiles = fingerprintFiles(serializedSourceCode, ignorePatterns);
10400
+ const {
10401
+ syncedFiles
10402
+ } = updatedMachineCodeAppDirectoryInfo;
10403
+ if (syncedFiles && !force) {
10404
+ const remoteSources = await Promise.all(connections.map(async connection => {
10405
+ var _a;
10406
+ return (_a = (await getAllApplicationsWithSourceCode(connection)).find(app => app.id === updatedMachineCodeAppDirectoryInfo.applicationId)) === null || _a === void 0 ? void 0 : _a.sourceCode;
10407
+ }));
10408
+ const designEdits = [...new Set(remoteSources.flatMap(remoteSource => remoteSource ? filesAtRisk({
10409
+ synced: syncedFiles,
10410
+ target: fingerprintFiles(remoteSource, ignorePatterns),
10411
+ incoming: localFiles,
10412
+ replacesTarget: true
10413
+ }) : []))].sort();
10414
+ if (designEdits.length > 0) {
10415
+ console.log("These files changed on the design since your last pull:");
10416
+ designEdits.forEach(filePath => console.log(` ${filePath}`));
10417
+ console.log("To keep them, pull into a new, empty folder with 'vention pull' and copy your changes across. To replace them, run 'vention push --force'.");
10418
+ process.exit(1);
10419
+ }
10420
+ }
10141
10421
  const applicationToPush = {
10142
10422
  name: updatedMachineCodeAppDirectoryInfo.appName,
10143
10423
  id: updatedMachineCodeAppDirectoryInfo.applicationId,
@@ -10148,7 +10428,8 @@ function createPushCommand() {
10148
10428
  console.log(chalk.blue("Pushing to digital twin..."));
10149
10429
  await Promise.all(connections.map(connection => pushApplicationToDigitalTwin(connection, applicationToPush)));
10150
10430
  await writeMachineCodeAppDirectoryInfo(currentDir, Object.assign(Object.assign({}, updatedMachineCodeAppDirectoryInfo), {
10151
- lastPushedAt: new Date().toISOString()
10431
+ lastPushedAt: new Date().toISOString(),
10432
+ syncedFiles: localFiles
10152
10433
  }));
10153
10434
  console.log();
10154
10435
  console.log(chalk.green(connections.length === 1 ? "✅ Successfully pushed to digital twin" : `✅ Successfully pushed to the design's ${connections.length} twins`));
@@ -10160,7 +10441,12 @@ function createPushCommand() {
10160
10441
  }
10161
10442
 
10162
10443
  function createPullCommand() {
10163
- return new Command("pull").description("Pull an application from a design to this directory").action(async () => {
10444
+ const command = new Command("pull").description("Pull an application from a design to this directory").option("--force", "Overwrite files changed in this folder since the last pull or push");
10445
+ return addSelectionOptions(command).action(async _a => {
10446
+ var {
10447
+ force
10448
+ } = _a,
10449
+ selection = __rest(_a, ["force"]);
10164
10450
  try {
10165
10451
  const session = await loadSession();
10166
10452
  if (!session) {
@@ -10170,11 +10456,24 @@ function createPullCommand() {
10170
10456
  const currentDir = process.cwd();
10171
10457
  const machineCodeAppDirectoryInfo = await readMachineCodeAppDirectoryInfo(currentDir);
10172
10458
  if (machineCodeAppDirectoryInfo) {
10173
- console.log(chalk.blue(`This directory is linked to app: ${machineCodeAppDirectoryInfo.appName}`));
10174
- console.log(chalk.blue(`Pulling latest content from design ID: ${machineCodeAppDirectoryInfo.designId}`));
10175
- await updateExistingAppDirectory(session, machineCodeAppDirectoryInfo, currentDir);
10459
+ const {
10460
+ appName,
10461
+ designId,
10462
+ applicationId
10463
+ } = machineCodeAppDirectoryInfo;
10464
+ const namesOtherDesign = selection.design !== undefined && selection.design !== designId;
10465
+ const namesOtherApp = selection.app !== undefined && selection.app !== appName && selection.app !== applicationId;
10466
+ if (namesOtherDesign || namesOtherApp) {
10467
+ console.log(`This folder is linked to "${appName}" (design ${designId}). To pull a different application, run 'vention pull' in a new, empty folder.`);
10468
+ process.exit(1);
10469
+ }
10470
+ console.log(chalk.blue(`This directory is linked to app: ${appName}`));
10471
+ console.log(chalk.blue(`Pulling latest content from design ID: ${designId}`));
10472
+ await updateExistingAppDirectory(session, machineCodeAppDirectoryInfo, currentDir, {
10473
+ force
10474
+ });
10176
10475
  } else {
10177
- await createNewAppDirectory(session, currentDir);
10476
+ await createNewAppDirectory(session, currentDir, selection);
10178
10477
  }
10179
10478
  } catch (error) {
10180
10479
  handleCommandError(error, "Failed to pull application");
@@ -10182,7 +10481,7 @@ function createPullCommand() {
10182
10481
  });
10183
10482
  }
10184
10483
 
10185
- var $$6 = _export;
10484
+ var $$3 = _export;
10186
10485
  var toObject = toObject$c;
10187
10486
  var lengthOfArrayLike = lengthOfArrayLike$h;
10188
10487
  var toIntegerOrInfinity$2 = toIntegerOrInfinity$e;
@@ -10190,7 +10489,7 @@ var addToUnscopables = addToUnscopables$5;
10190
10489
 
10191
10490
  // `Array.prototype.at` method
10192
10491
  // https://tc39.es/ecma262/#sec-array.prototype.at
10193
- $$6({ target: 'Array', proto: true }, {
10492
+ $$3({ target: 'Array', proto: true }, {
10194
10493
  at: function at(index) {
10195
10494
  var O = toObject(this);
10196
10495
  var len = lengthOfArrayLike(O);
@@ -10202,14 +10501,14 @@ $$6({ target: 'Array', proto: true }, {
10202
10501
 
10203
10502
  addToUnscopables('at');
10204
10503
 
10205
- var $$5 = _export;
10206
- var uncurryThis$4 = functionUncurryThis;
10207
- var requireObjectCoercible$4 = requireObjectCoercible$c;
10504
+ var $$2 = _export;
10505
+ var uncurryThis$2 = functionUncurryThis;
10506
+ var requireObjectCoercible$3 = requireObjectCoercible$c;
10208
10507
  var toIntegerOrInfinity$1 = toIntegerOrInfinity$e;
10209
- var toString$4 = toString$h;
10508
+ var toString$3 = toString$h;
10210
10509
  var fails$1 = fails$F;
10211
10510
 
10212
- var charAt = uncurryThis$4(''.charAt);
10511
+ var charAt = uncurryThis$2(''.charAt);
10213
10512
 
10214
10513
  var FORCED = fails$1(function () {
10215
10514
  // eslint-disable-next-line es/no-string-prototype-at -- safe
@@ -10218,9 +10517,9 @@ var FORCED = fails$1(function () {
10218
10517
 
10219
10518
  // `String.prototype.at` method
10220
10519
  // https://tc39.es/ecma262/#sec-string.prototype.at
10221
- $$5({ target: 'String', proto: true, forced: FORCED }, {
10520
+ $$2({ target: 'String', proto: true, forced: FORCED }, {
10222
10521
  at: function at(index) {
10223
- var S = toString$4(requireObjectCoercible$4(this));
10522
+ var S = toString$3(requireObjectCoercible$3(this));
10224
10523
  var len = S.length;
10225
10524
  var relativeIndex = toIntegerOrInfinity$1(index);
10226
10525
  var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
@@ -10405,62 +10704,9 @@ function createLogsCommand() {
10405
10704
  });
10406
10705
  }
10407
10706
 
10408
- var uncurryThis$3 = functionUncurryThis;
10409
-
10410
- // eslint-disable-next-line es/no-map -- safe
10411
- var MapPrototype = Map.prototype;
10412
-
10413
- var mapHelpers = {
10414
- set: uncurryThis$3(MapPrototype.set),
10415
- get: uncurryThis$3(MapPrototype.get),
10416
- has: uncurryThis$3(MapPrototype.has),
10417
- remove: uncurryThis$3(MapPrototype['delete'])};
10418
-
10419
- var $$4 = _export;
10420
- var MapHelpers$1 = mapHelpers;
10421
- var IS_PURE$1 = isPure;
10422
-
10423
- var get$1 = MapHelpers$1.get;
10424
- var has$1 = MapHelpers$1.has;
10425
- var set$1 = MapHelpers$1.set;
10426
-
10427
- // `Map.prototype.getOrInsert` method
10428
- // https://tc39.es/ecma262/#sec-map.prototype.getorinsert
10429
- $$4({ target: 'Map', proto: true, real: true, forced: IS_PURE$1 }, {
10430
- getOrInsert: function getOrInsert(key, value) {
10431
- if (has$1(this, key)) return get$1(this, key);
10432
- set$1(this, key, value);
10433
- return value;
10434
- }
10435
- });
10436
-
10437
- var $$3 = _export;
10438
- var aCallable = aCallable$k;
10439
- var MapHelpers = mapHelpers;
10440
- var IS_PURE = isPure;
10441
-
10442
- var get = MapHelpers.get;
10443
- var has = MapHelpers.has;
10444
- var set = MapHelpers.set;
10445
-
10446
- // `Map.prototype.getOrInsertComputed` method
10447
- // https://tc39.es/ecma262/#sec-map.prototype.getorinsertcomputed
10448
- $$3({ target: 'Map', proto: true, real: true, forced: IS_PURE }, {
10449
- getOrInsertComputed: function getOrInsertComputed(key, callbackfn) {
10450
- var hasKey = has(this, key);
10451
- aCallable(callbackfn);
10452
- if (hasKey) return get(this, key);
10453
- // CanonicalizeKeyedCollectionKey
10454
- if (key === 0 && 1 / key === -Infinity) key = 0;
10455
- var value = callbackfn(key);
10456
- set(this, key, value);
10457
- return value;
10458
- }
10459
- });
10460
-
10461
10707
  var toIntegerOrInfinity = toIntegerOrInfinity$e;
10462
- var toString$3 = toString$h;
10463
- var requireObjectCoercible$3 = requireObjectCoercible$c;
10708
+ var toString$2 = toString$h;
10709
+ var requireObjectCoercible$2 = requireObjectCoercible$c;
10464
10710
 
10465
10711
  var $RangeError = RangeError;
10466
10712
  var floor = Math.floor;
@@ -10468,7 +10714,7 @@ var floor = Math.floor;
10468
10714
  // `String.prototype.repeat` method implementation
10469
10715
  // https://tc39.es/ecma262/#sec-string.prototype.repeat
10470
10716
  var stringRepeat = function repeat(count) {
10471
- var str = toString$3(requireObjectCoercible$3(this));
10717
+ var str = toString$2(requireObjectCoercible$2(this));
10472
10718
  var result = '';
10473
10719
  var n = toIntegerOrInfinity(count);
10474
10720
  if (n < 0 || n === Infinity) throw new $RangeError('Wrong number of repetitions');
@@ -10476,29 +10722,29 @@ var stringRepeat = function repeat(count) {
10476
10722
  return result;
10477
10723
  };
10478
10724
 
10479
- var uncurryThis$2 = functionUncurryThis;
10480
- var toLength$1 = toLength$7;
10481
- var toString$2 = toString$h;
10725
+ var uncurryThis$1 = functionUncurryThis;
10726
+ var toLength = toLength$7;
10727
+ var toString$1 = toString$h;
10482
10728
  var $repeat = stringRepeat;
10483
- var requireObjectCoercible$2 = requireObjectCoercible$c;
10729
+ var requireObjectCoercible$1 = requireObjectCoercible$c;
10484
10730
 
10485
- var repeat = uncurryThis$2($repeat);
10486
- var stringSlice$1 = uncurryThis$2(''.slice);
10731
+ var repeat = uncurryThis$1($repeat);
10732
+ var stringSlice = uncurryThis$1(''.slice);
10487
10733
  var ceil = Math.ceil;
10488
10734
 
10489
10735
  // `String.prototype.{ padStart, padEnd }` methods implementation
10490
10736
  var createMethod$1 = function (IS_END) {
10491
10737
  return function ($this, maxLength, fillString) {
10492
- var S = toString$2(requireObjectCoercible$2($this));
10493
- var intMaxLength = toLength$1(maxLength);
10738
+ var S = toString$1(requireObjectCoercible$1($this));
10739
+ var intMaxLength = toLength(maxLength);
10494
10740
  var stringLength = S.length;
10495
10741
  if (intMaxLength <= stringLength) return S;
10496
- var fillStr = fillString === undefined ? ' ' : toString$2(fillString);
10742
+ var fillStr = fillString === undefined ? ' ' : toString$1(fillString);
10497
10743
  var fillLen, stringFiller;
10498
10744
  if (fillStr === '') return S;
10499
10745
  fillLen = intMaxLength - stringLength;
10500
10746
  stringFiller = repeat(fillStr, ceil(fillLen / fillStr.length));
10501
- if (stringFiller.length > fillLen) stringFiller = stringSlice$1(stringFiller, 0, fillLen);
10747
+ if (stringFiller.length > fillLen) stringFiller = stringSlice(stringFiller, 0, fillLen);
10502
10748
  return IS_END ? S + stringFiller : stringFiller + S;
10503
10749
  };
10504
10750
  };
@@ -10514,49 +10760,18 @@ var userAgent = environmentUserAgent;
10514
10760
 
10515
10761
  var stringPadWebkitBug = /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(userAgent);
10516
10762
 
10517
- var $$2 = _export;
10763
+ var $$1 = _export;
10518
10764
  var $padEnd = stringPad.end;
10519
10765
  var WEBKIT_BUG = stringPadWebkitBug;
10520
10766
 
10521
10767
  // `String.prototype.padEnd` method
10522
10768
  // https://tc39.es/ecma262/#sec-string.prototype.padend
10523
- $$2({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
10769
+ $$1({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
10524
10770
  padEnd: function padEnd(maxLength /* , fillString = ' ' */) {
10525
10771
  return $padEnd(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
10526
10772
  }
10527
10773
  });
10528
10774
 
10529
- var $$1 = _export;
10530
- var uncurryThis$1 = functionUncurryThisClause;
10531
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
10532
- var toLength = toLength$7;
10533
- var toString$1 = toString$h;
10534
- var notARegExp = notARegexp;
10535
- var requireObjectCoercible$1 = requireObjectCoercible$c;
10536
- var correctIsRegExpLogic = correctIsRegexpLogic;
10537
-
10538
- var stringSlice = uncurryThis$1(''.slice);
10539
- var min = Math.min;
10540
-
10541
- var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
10542
- // https://github.com/zloirock/core-js/pull/702
10543
- var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
10544
- var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
10545
- return descriptor && !descriptor.writable;
10546
- }();
10547
-
10548
- // `String.prototype.startsWith` method
10549
- // https://tc39.es/ecma262/#sec-string.prototype.startswith
10550
- $$1({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
10551
- startsWith: function startsWith(searchString /* , position = 0 */) {
10552
- var that = toString$1(requireObjectCoercible$1(this));
10553
- notARegExp(searchString);
10554
- var search = toString$1(searchString);
10555
- var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
10556
- return stringSlice(that, index, index + search.length) === search;
10557
- }
10558
- });
10559
-
10560
10775
  // a string of all valid unicode whitespaces
10561
10776
  var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
10562
10777
  '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
@@ -10678,8 +10893,23 @@ function installedVersions(installed) {
10678
10893
  }
10679
10894
  return versions;
10680
10895
  }
10681
- function execute(command, args, options = {}) {
10896
+ function notFound(command) {
10682
10897
  var _a;
10898
+ return Object.assign(new Error(`the '${command}' command was not found. Install ${(_a = INSTALL_HINTS[command]) !== null && _a !== void 0 ? _a : command} first, then try again.`), {
10899
+ code: "ENOENT"
10900
+ });
10901
+ }
10902
+ function existsOnWindows(command) {
10903
+ try {
10904
+ execFileSync("where", [command], {
10905
+ stdio: "pipe"
10906
+ });
10907
+ return true;
10908
+ } catch (_a) {
10909
+ return false;
10910
+ }
10911
+ }
10912
+ function execute(command, args, options = {}) {
10683
10913
  try {
10684
10914
  const env = Object.assign(Object.assign({}, process.env), {
10685
10915
  npm_config_allow_remote: "all"
@@ -10689,6 +10919,7 @@ function execute(command, args, options = {}) {
10689
10919
  env
10690
10920
  }, options);
10691
10921
  if (process.platform === "win32") {
10922
+ if (!existsOnWindows(command)) throw notFound(command);
10692
10923
  return execFileSync([command, ...args.map(arg => `"${arg}"`)].join(" "), Object.assign(Object.assign({}, execOptions), {
10693
10924
  shell: true
10694
10925
  }));
@@ -10696,7 +10927,7 @@ function execute(command, args, options = {}) {
10696
10927
  return execFileSync(command, args, execOptions);
10697
10928
  } catch (error) {
10698
10929
  if (error.code !== "ENOENT") throw error;
10699
- throw new Error(`the '${command}' command was not found. Install ${(_a = INSTALL_HINTS[command]) !== null && _a !== void 0 ? _a : command} first, then try again.`);
10930
+ throw notFound(command);
10700
10931
  }
10701
10932
  }
10702
10933
  function run(command, args, cwd) {
@@ -10715,8 +10946,62 @@ function latestVersion() {
10715
10946
  return undefined;
10716
10947
  }
10717
10948
  }
10949
+ const isRecord = value => typeof value === "object" && value !== null && !Array.isArray(value);
10950
+ function addPluginToClaudeSettings(settingsPath) {
10951
+ var _a, _b, _c;
10952
+ let settings = {};
10953
+ if (fs__default.existsSync(settingsPath)) {
10954
+ try {
10955
+ settings = JSON.parse(fs__default.readFileSync(settingsPath, "utf8"));
10956
+ } catch (_d) {
10957
+ return "unreadable";
10958
+ }
10959
+ }
10960
+ if (!isRecord(settings)) return "unreadable";
10961
+ const marketplaces = (_a = settings.extraKnownMarketplaces) !== null && _a !== void 0 ? _a : {};
10962
+ const plugins = (_b = settings.enabledPlugins) !== null && _b !== void 0 ? _b : {};
10963
+ if (!isRecord(marketplaces) || !isRecord(plugins)) return "unreadable";
10964
+ const marketplace = (_c = marketplaces[MARKETPLACE]) !== null && _c !== void 0 ? _c : {
10965
+ source: {
10966
+ source: "url",
10967
+ url: CATALOG_URL
10968
+ }
10969
+ };
10970
+ if (!isRecord(marketplace)) return "unreadable";
10971
+ const pluginKey = `${PLUGIN}@${MARKETPLACE}`;
10972
+ if (marketplace.autoUpdate === true && plugins[pluginKey] === true) return "already";
10973
+ marketplaces[MARKETPLACE] = Object.assign(Object.assign({}, marketplace), {
10974
+ autoUpdate: true
10975
+ });
10976
+ plugins[pluginKey] = true;
10977
+ settings.extraKnownMarketplaces = marketplaces;
10978
+ settings.enabledPlugins = plugins;
10979
+ fs__default.mkdirSync(path__default.dirname(settingsPath), {
10980
+ recursive: true
10981
+ });
10982
+ fs__default.writeFileSync(settingsPath, `${JSON.stringify(settings, null, 2)}\n`);
10983
+ return "added";
10984
+ }
10985
+ function installForClaudeSettings(scope) {
10986
+ if (scope === "project") console.log(chalk.dim("Without the claude command, the Vention skills install for your user account."));
10987
+ const settingsPath = skillPath(homeDirectory(), ".claude", "settings.json");
10988
+ const result = addPluginToClaudeSettings(settingsPath);
10989
+ if (result === "unreadable") {
10990
+ console.log(chalk.yellow(`Couldn't read ${displayPath(settingsPath)}, so it was left as it is. Add the Vention skills by hand: in Claude Desktop's Code tab, open + > Add plugins (or Customize > Plugins), and install "${PLUGIN}" from the ${MARKETPLACE} marketplace. If it isn't listed, ask your Claude administrator to add ${CATALOG_URL}.`));
10991
+ return;
10992
+ }
10993
+ const location = `${displayPath(settingsPath)} (user scope)`;
10994
+ console.log(chalk.green(result === "added" ? `Added ${PLUGIN}@${MARKETPLACE} to ${location}.` : `${PLUGIN}@${MARKETPLACE} is already in ${location}.`));
10995
+ console.log("Start a new session in Claude Desktop's Code tab to load the Vention skills.");
10996
+ }
10718
10997
  function installForClaudeCode(scope) {
10719
- console.log(run("claude", ["plugin", "marketplace", "add", "--scope", scope, CATALOG_URL]));
10998
+ try {
10999
+ console.log(run("claude", ["plugin", "marketplace", "add", "--scope", scope, CATALOG_URL]));
11000
+ } catch (error) {
11001
+ if (error.code !== "ENOENT") throw error;
11002
+ installForClaudeSettings(scope);
11003
+ return;
11004
+ }
10720
11005
  console.log(run("claude", ["plugin", "install", "-y", "--scope", scope, `${PLUGIN}@${MARKETPLACE}`]));
10721
11006
  console.log(chalk.green(`Installed ${PLUGIN}@${MARKETPLACE} for Claude Code (${scope} scope).`));
10722
11007
  }
@@ -10778,6 +11063,10 @@ function unpackSkills(agent, scope) {
10778
11063
  function createInstallCommand() {
10779
11064
  return new Command("install").description("Install the Vention skills into your coding agent").addOption(new Option("--agent <agent>", "Coding agent to install into").choices(AGENTS)).addOption(new Option("--scope <scope>", "Install for your user account or this project").choices(SCOPES).default("user")).action(async options => {
10780
11065
  var _a;
11066
+ if (!options.agent && !process.stdin.isTTY) {
11067
+ console.log(`Pick your coding agent: run 'vention skills install --agent <agent>' with one of: ${AGENTS.join(", ")}.`);
11068
+ process.exit(1);
11069
+ }
10781
11070
  try {
10782
11071
  const agent = (_a = options.agent) !== null && _a !== void 0 ? _a : await select({
10783
11072
  message: "Which coding agent?",
@@ -10874,6 +11163,10 @@ function createUpdateCommand() {
10874
11163
  update();
10875
11164
  console.log(chalk.green(`Updated ${name} from ${version} to ${installedVersions(findInstalledSkills()).get(install)}.`));
10876
11165
  } catch (error) {
11166
+ if (install === "claude-code" && error.code === "ENOENT") {
11167
+ console.log("Claude Desktop updates the Vention skills on its own. The new version loads in your next new session.");
11168
+ continue;
11169
+ }
10877
11170
  console.error(chalk.red(`Failed to update ${name}: ${error instanceof Error ? error.message : String(error)}`));
10878
11171
  process.exitCode = 1;
10879
11172
  }
@@ -11019,6 +11312,7 @@ program.name("vention").description("CLI tool for Vention").version(readVersion(
11019
11312
  setVerbose(false);
11020
11313
  });
11021
11314
  program.addCommand(createLoginCommand());
11315
+ program.addCommand(createWhoamiCommand());
11022
11316
  program.addCommand(createLinkCommand());
11023
11317
  program.addCommand(createPushCommand());
11024
11318
  program.addCommand(createPullCommand());