@wix/astro 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -259,8 +259,8 @@ var require_utils = __commonJS({
259
259
  exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
260
260
  exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
261
261
  exports.removeBackslashes = (str) => {
262
- return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
263
- return match === "\\" ? "" : match;
262
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match2) => {
263
+ return match2 === "\\" ? "" : match2;
264
264
  });
265
265
  };
266
266
  exports.supportsLookbehinds = () => {
@@ -883,10 +883,10 @@ var require_parse = __commonJS({
883
883
  push({ type: "text", value });
884
884
  continue;
885
885
  }
886
- const match = /^\\+/.exec(remaining());
886
+ const match2 = /^\\+/.exec(remaining());
887
887
  let slashes = 0;
888
- if (match && match[0].length > 2) {
889
- slashes = match[0].length;
888
+ if (match2 && match2[0].length > 2) {
889
+ slashes = match2[0].length;
890
890
  state.index += slashes;
891
891
  if (slashes % 2 !== 0) {
892
892
  value += "\\";
@@ -1174,10 +1174,10 @@ var require_parse = __commonJS({
1174
1174
  if (value === "$" || value === "^") {
1175
1175
  value = `\\${value}`;
1176
1176
  }
1177
- const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1178
- if (match) {
1179
- value += match[0];
1180
- state.index += match[0].length;
1177
+ const match2 = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1178
+ if (match2) {
1179
+ value += match2[0];
1180
+ state.index += match2[0].length;
1181
1181
  }
1182
1182
  push({ type: "text", value });
1183
1183
  continue;
@@ -1388,11 +1388,11 @@ var require_parse = __commonJS({
1388
1388
  case "**/.*":
1389
1389
  return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
1390
1390
  default: {
1391
- const match = /^(.*?)\.(\w+)$/.exec(str);
1392
- if (!match) return;
1393
- const source2 = create(match[1]);
1391
+ const match2 = /^(.*?)\.(\w+)$/.exec(str);
1392
+ if (!match2) return;
1393
+ const source2 = create(match2[1]);
1394
1394
  if (!source2) return;
1395
- return source2 + DOT_LITERAL + match[2];
1395
+ return source2 + DOT_LITERAL + match2[2];
1396
1396
  }
1397
1397
  }
1398
1398
  };
@@ -1445,8 +1445,8 @@ var require_picomatch = __commonJS({
1445
1445
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
1446
1446
  }
1447
1447
  const matcher = (input, returnObject = false) => {
1448
- const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
1449
- const result = { glob, state, regex, posix, input, output, match, isMatch };
1448
+ const { isMatch, match: match2, output } = picomatch.test(input, regex, options, { glob, posix });
1449
+ const result = { glob, state, regex, posix, input, output, match: match2, isMatch };
1450
1450
  if (typeof opts.onResult === "function") {
1451
1451
  opts.onResult(result);
1452
1452
  }
@@ -1480,20 +1480,20 @@ var require_picomatch = __commonJS({
1480
1480
  }
1481
1481
  const opts = options || {};
1482
1482
  const format = opts.format || (posix ? utils.toPosixSlashes : null);
1483
- let match = input === glob;
1484
- let output = match && format ? format(input) : input;
1485
- if (match === false) {
1483
+ let match2 = input === glob;
1484
+ let output = match2 && format ? format(input) : input;
1485
+ if (match2 === false) {
1486
1486
  output = format ? format(input) : input;
1487
- match = output === glob;
1487
+ match2 = output === glob;
1488
1488
  }
1489
- if (match === false || opts.capture === true) {
1489
+ if (match2 === false || opts.capture === true) {
1490
1490
  if (opts.matchBase === true || opts.basename === true) {
1491
- match = picomatch.matchBase(input, regex, options, posix);
1491
+ match2 = picomatch.matchBase(input, regex, options, posix);
1492
1492
  } else {
1493
- match = regex.exec(output);
1493
+ match2 = regex.exec(output);
1494
1494
  }
1495
1495
  }
1496
- return { isMatch: Boolean(match), match, output };
1496
+ return { isMatch: Boolean(match2), match: match2, output };
1497
1497
  };
1498
1498
  picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
1499
1499
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
@@ -2006,8 +2006,8 @@ var require_utils2 = __commonJS({
2006
2006
  exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
2007
2007
  exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
2008
2008
  exports.removeBackslashes = (str) => {
2009
- return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
2010
- return match === "\\" ? "" : match;
2009
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match2) => {
2010
+ return match2 === "\\" ? "" : match2;
2011
2011
  });
2012
2012
  };
2013
2013
  exports.supportsLookbehinds = () => {
@@ -2630,10 +2630,10 @@ var require_parse2 = __commonJS({
2630
2630
  push({ type: "text", value });
2631
2631
  continue;
2632
2632
  }
2633
- const match = /^\\+/.exec(remaining());
2633
+ const match2 = /^\\+/.exec(remaining());
2634
2634
  let slashes = 0;
2635
- if (match && match[0].length > 2) {
2636
- slashes = match[0].length;
2635
+ if (match2 && match2[0].length > 2) {
2636
+ slashes = match2[0].length;
2637
2637
  state.index += slashes;
2638
2638
  if (slashes % 2 !== 0) {
2639
2639
  value += "\\";
@@ -2921,10 +2921,10 @@ var require_parse2 = __commonJS({
2921
2921
  if (value === "$" || value === "^") {
2922
2922
  value = `\\${value}`;
2923
2923
  }
2924
- const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
2925
- if (match) {
2926
- value += match[0];
2927
- state.index += match[0].length;
2924
+ const match2 = REGEX_NON_SPECIAL_CHARS.exec(remaining());
2925
+ if (match2) {
2926
+ value += match2[0];
2927
+ state.index += match2[0].length;
2928
2928
  }
2929
2929
  push({ type: "text", value });
2930
2930
  continue;
@@ -3135,11 +3135,11 @@ var require_parse2 = __commonJS({
3135
3135
  case "**/.*":
3136
3136
  return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
3137
3137
  default: {
3138
- const match = /^(.*?)\.(\w+)$/.exec(str);
3139
- if (!match) return;
3140
- const source2 = create(match[1]);
3138
+ const match2 = /^(.*?)\.(\w+)$/.exec(str);
3139
+ if (!match2) return;
3140
+ const source2 = create(match2[1]);
3141
3141
  if (!source2) return;
3142
- return source2 + DOT_LITERAL + match[2];
3142
+ return source2 + DOT_LITERAL + match2[2];
3143
3143
  }
3144
3144
  }
3145
3145
  };
@@ -3192,8 +3192,8 @@ var require_picomatch3 = __commonJS({
3192
3192
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
3193
3193
  }
3194
3194
  const matcher = (input, returnObject = false) => {
3195
- const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
3196
- const result = { glob, state, regex, posix, input, output, match, isMatch };
3195
+ const { isMatch, match: match2, output } = picomatch.test(input, regex, options, { glob, posix });
3196
+ const result = { glob, state, regex, posix, input, output, match: match2, isMatch };
3197
3197
  if (typeof opts.onResult === "function") {
3198
3198
  opts.onResult(result);
3199
3199
  }
@@ -3227,20 +3227,20 @@ var require_picomatch3 = __commonJS({
3227
3227
  }
3228
3228
  const opts = options || {};
3229
3229
  const format = opts.format || (posix ? utils.toPosixSlashes : null);
3230
- let match = input === glob;
3231
- let output = match && format ? format(input) : input;
3232
- if (match === false) {
3230
+ let match2 = input === glob;
3231
+ let output = match2 && format ? format(input) : input;
3232
+ if (match2 === false) {
3233
3233
  output = format ? format(input) : input;
3234
- match = output === glob;
3234
+ match2 = output === glob;
3235
3235
  }
3236
- if (match === false || opts.capture === true) {
3236
+ if (match2 === false || opts.capture === true) {
3237
3237
  if (opts.matchBase === true || opts.basename === true) {
3238
- match = picomatch.matchBase(input, regex, options, posix);
3238
+ match2 = picomatch.matchBase(input, regex, options, posix);
3239
3239
  } else {
3240
- match = regex.exec(output);
3240
+ match2 = regex.exec(output);
3241
3241
  }
3242
3242
  }
3243
- return { isMatch: Boolean(match), match, output };
3243
+ return { isMatch: Boolean(match2), match: match2, output };
3244
3244
  };
3245
3245
  picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
3246
3246
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
@@ -3411,10 +3411,10 @@ var require_is_extglob = __commonJS({
3411
3411
  if (typeof str !== "string" || str === "") {
3412
3412
  return false;
3413
3413
  }
3414
- var match;
3415
- while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
3416
- if (match[2]) return true;
3417
- str = str.slice(match.index + match[0].length);
3414
+ var match2;
3415
+ while (match2 = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
3416
+ if (match2[2]) return true;
3417
+ str = str.slice(match2.index + match2[0].length);
3418
3418
  }
3419
3419
  return false;
3420
3420
  };
@@ -7002,8 +7002,8 @@ var require_utils4 = __commonJS({
7002
7002
  exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
7003
7003
  exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
7004
7004
  exports.removeBackslashes = (str) => {
7005
- return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
7006
- return match === "\\" ? "" : match;
7005
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match2) => {
7006
+ return match2 === "\\" ? "" : match2;
7007
7007
  });
7008
7008
  };
7009
7009
  exports.supportsLookbehinds = () => {
@@ -7626,10 +7626,10 @@ var require_parse4 = __commonJS({
7626
7626
  push({ type: "text", value });
7627
7627
  continue;
7628
7628
  }
7629
- const match = /^\\+/.exec(remaining());
7629
+ const match2 = /^\\+/.exec(remaining());
7630
7630
  let slashes = 0;
7631
- if (match && match[0].length > 2) {
7632
- slashes = match[0].length;
7631
+ if (match2 && match2[0].length > 2) {
7632
+ slashes = match2[0].length;
7633
7633
  state.index += slashes;
7634
7634
  if (slashes % 2 !== 0) {
7635
7635
  value += "\\";
@@ -7917,10 +7917,10 @@ var require_parse4 = __commonJS({
7917
7917
  if (value === "$" || value === "^") {
7918
7918
  value = `\\${value}`;
7919
7919
  }
7920
- const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
7921
- if (match) {
7922
- value += match[0];
7923
- state.index += match[0].length;
7920
+ const match2 = REGEX_NON_SPECIAL_CHARS.exec(remaining());
7921
+ if (match2) {
7922
+ value += match2[0];
7923
+ state.index += match2[0].length;
7924
7924
  }
7925
7925
  push({ type: "text", value });
7926
7926
  continue;
@@ -8131,11 +8131,11 @@ var require_parse4 = __commonJS({
8131
8131
  case "**/.*":
8132
8132
  return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
8133
8133
  default: {
8134
- const match = /^(.*?)\.(\w+)$/.exec(str);
8135
- if (!match) return;
8136
- const source2 = create(match[1]);
8134
+ const match2 = /^(.*?)\.(\w+)$/.exec(str);
8135
+ if (!match2) return;
8136
+ const source2 = create(match2[1]);
8137
8137
  if (!source2) return;
8138
- return source2 + DOT_LITERAL + match[2];
8138
+ return source2 + DOT_LITERAL + match2[2];
8139
8139
  }
8140
8140
  }
8141
8141
  };
@@ -8188,8 +8188,8 @@ var require_picomatch5 = __commonJS({
8188
8188
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
8189
8189
  }
8190
8190
  const matcher = (input, returnObject = false) => {
8191
- const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
8192
- const result = { glob, state, regex, posix, input, output, match, isMatch };
8191
+ const { isMatch, match: match2, output } = picomatch.test(input, regex, options, { glob, posix });
8192
+ const result = { glob, state, regex, posix, input, output, match: match2, isMatch };
8193
8193
  if (typeof opts.onResult === "function") {
8194
8194
  opts.onResult(result);
8195
8195
  }
@@ -8223,20 +8223,20 @@ var require_picomatch5 = __commonJS({
8223
8223
  }
8224
8224
  const opts = options || {};
8225
8225
  const format = opts.format || (posix ? utils.toPosixSlashes : null);
8226
- let match = input === glob;
8227
- let output = match && format ? format(input) : input;
8228
- if (match === false) {
8226
+ let match2 = input === glob;
8227
+ let output = match2 && format ? format(input) : input;
8228
+ if (match2 === false) {
8229
8229
  output = format ? format(input) : input;
8230
- match = output === glob;
8230
+ match2 = output === glob;
8231
8231
  }
8232
- if (match === false || opts.capture === true) {
8232
+ if (match2 === false || opts.capture === true) {
8233
8233
  if (opts.matchBase === true || opts.basename === true) {
8234
- match = picomatch.matchBase(input, regex, options, posix);
8234
+ match2 = picomatch.matchBase(input, regex, options, posix);
8235
8235
  } else {
8236
- match = regex.exec(output);
8236
+ match2 = regex.exec(output);
8237
8237
  }
8238
8238
  }
8239
- return { isMatch: Boolean(match), match, output };
8239
+ return { isMatch: Boolean(match2), match: match2, output };
8240
8240
  };
8241
8241
  picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
8242
8242
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
@@ -8334,8 +8334,8 @@ var require_micromatch = __commonJS({
8334
8334
  if (negated) negatives++;
8335
8335
  for (let item of list) {
8336
8336
  let matched = isMatch(item, true);
8337
- let match = negated ? !matched.isMatch : matched.isMatch;
8338
- if (!match) continue;
8337
+ let match2 = negated ? !matched.isMatch : matched.isMatch;
8338
+ if (!match2) continue;
8339
8339
  if (negated) {
8340
8340
  omit.add(matched.output);
8341
8341
  } else {
@@ -8431,9 +8431,9 @@ var require_micromatch = __commonJS({
8431
8431
  micromatch.capture = (glob, input, options) => {
8432
8432
  let posix = utils.isWindows(options);
8433
8433
  let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
8434
- let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
8435
- if (match) {
8436
- return match.slice(1).map((v) => v === void 0 ? "" : v);
8434
+ let match2 = regex.exec(posix ? utils.toPosixSlashes(input) : input);
8435
+ if (match2) {
8436
+ return match2.slice(1).map((v) => v === void 0 ? "" : v);
8437
8437
  }
8438
8438
  };
8439
8439
  micromatch.makeRe = (...args) => picomatch.makeRe(...args);
@@ -10362,7 +10362,7 @@ var require_partial = __commonJS({
10362
10362
  if (!pattern.complete && levels > section.length) {
10363
10363
  return true;
10364
10364
  }
10365
- const match = parts.every((part, index) => {
10365
+ const match2 = parts.every((part, index) => {
10366
10366
  const segment = pattern.segments[index];
10367
10367
  if (segment.dynamic && segment.patternRe.test(part)) {
10368
10368
  return true;
@@ -10372,7 +10372,7 @@ var require_partial = __commonJS({
10372
10372
  }
10373
10373
  return false;
10374
10374
  });
10375
- if (match) {
10375
+ if (match2) {
10376
10376
  return true;
10377
10377
  }
10378
10378
  }
@@ -10988,7 +10988,7 @@ var require_ignore = __commonJS({
10988
10988
  var RETURN_FALSE = () => false;
10989
10989
  var sanitizeRange = (range) => range.replace(
10990
10990
  REGEX_REGEXP_RANGE,
10991
- (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY
10991
+ (match2, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match2 : EMPTY
10992
10992
  );
10993
10993
  var cleanRangeBackSlash = (slashes) => {
10994
10994
  const { length } = slashes;
@@ -11040,7 +11040,7 @@ var require_ignore = __commonJS({
11040
11040
  // > These special characters are often called "metacharacters".
11041
11041
  [
11042
11042
  /[\\$.|*+(){^]/g,
11043
- (match) => `\\${match}`
11043
+ (match2) => `\\${match2}`
11044
11044
  ],
11045
11045
  [
11046
11046
  // > a question mark (?) matches a single character
@@ -11122,7 +11122,7 @@ var require_ignore = __commonJS({
11122
11122
  // > can be used to match one of the characters in a range.
11123
11123
  // `\` is escaped by step 3
11124
11124
  /(\\)?\[([^\]/]*?)(\\*)($|\])/g,
11125
- (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
11125
+ (match2, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
11126
11126
  ],
11127
11127
  // ending
11128
11128
  [
@@ -11139,7 +11139,7 @@ var require_ignore = __commonJS({
11139
11139
  // 'js*' will not match 'a.js'
11140
11140
  // 'js/' will not match 'a.js'
11141
11141
  // 'js' will match 'a.js' and 'a.js/'
11142
- (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
11142
+ (match2) => /\/$/.test(match2) ? `${match2}$` : `${match2}(?=$|\\/$)`
11143
11143
  ]
11144
11144
  ];
11145
11145
  var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\\\*$/;
@@ -11410,10 +11410,883 @@ var require_ignore = __commonJS({
11410
11410
  }
11411
11411
  });
11412
11412
 
11413
+ // ../../node_modules/variant/lib/isType.js
11414
+ var require_isType = __commonJS({
11415
+ "../../node_modules/variant/lib/isType.js"(exports) {
11416
+ "use strict";
11417
+ init_esm_shims();
11418
+ Object.defineProperty(exports, "__esModule", { value: true });
11419
+ exports.isTypeImpl = void 0;
11420
+ function isTypeImpl(key) {
11421
+ function isType2(instanceOrType, type) {
11422
+ if (instanceOrType != void 0) {
11423
+ if (typeof instanceOrType === "function" || typeof instanceOrType === "string") {
11424
+ const typeArg = instanceOrType;
11425
+ const typeStr = typeof typeArg === "string" ? typeArg : typeArg.output.type;
11426
+ return (o) => isType2(o, typeStr);
11427
+ } else {
11428
+ const instance = instanceOrType;
11429
+ const typeStr = typeof type === "string" ? type : type.output.type;
11430
+ return instance != void 0 && instance[key !== null && key !== void 0 ? key : "type"] === typeStr;
11431
+ }
11432
+ } else {
11433
+ return false;
11434
+ }
11435
+ }
11436
+ return { isType: isType2 };
11437
+ }
11438
+ exports.isTypeImpl = isTypeImpl;
11439
+ }
11440
+ });
11441
+
11442
+ // ../../node_modules/variant/lib/util.js
11443
+ var require_util = __commonJS({
11444
+ "../../node_modules/variant/lib/util.js"(exports) {
11445
+ "use strict";
11446
+ init_esm_shims();
11447
+ Object.defineProperty(exports, "__esModule", { value: true });
11448
+ exports.HOI = exports.isPromise = exports.identityFunc = void 0;
11449
+ var identityFunc = (x = {}) => x;
11450
+ exports.identityFunc = identityFunc;
11451
+ function isPromise(x) {
11452
+ return x != void 0 && typeof x === "object" && "then" in x && typeof x.then === "function";
11453
+ }
11454
+ exports.isPromise = isPromise;
11455
+ var HOI = () => (definition) => definition;
11456
+ exports.HOI = HOI;
11457
+ }
11458
+ });
11459
+
11460
+ // ../../node_modules/variant/lib/variant.js
11461
+ var require_variant = __commonJS({
11462
+ "../../node_modules/variant/lib/variant.js"(exports) {
11463
+ "use strict";
11464
+ init_esm_shims();
11465
+ Object.defineProperty(exports, "__esModule", { value: true });
11466
+ exports.variantImpl = exports.isVariantCreator = exports.scopeType = void 0;
11467
+ var util_1 = require_util();
11468
+ var scopeType = (scope, type) => `${scope}/${type}`;
11469
+ exports.scopeType = scopeType;
11470
+ function descopeType(s) {
11471
+ var _a;
11472
+ return (_a = s.split("/")[1]) !== null && _a !== void 0 ? _a : s;
11473
+ }
11474
+ var VARIANT_CREATOR_BRAND = Symbol("Variant Creator");
11475
+ function isVariantCreator(func) {
11476
+ return VARIANT_CREATOR_BRAND in func;
11477
+ }
11478
+ exports.isVariantCreator = isVariantCreator;
11479
+ function variantImpl(key) {
11480
+ function scope(scope2, v) {
11481
+ return Object.keys(v).reduce((acc, key2) => {
11482
+ return Object.assign(Object.assign({}, acc), { [key2]: variation((0, exports.scopeType)(scope2, key2), typeof v[key2] === "function" ? v[key2] : util_1.identityFunc) });
11483
+ }, {});
11484
+ }
11485
+ function descope(obj) {
11486
+ return Object.assign(Object.assign({}, obj), { [key]: descopeType(obj[key]) });
11487
+ }
11488
+ function variation(type, creator) {
11489
+ let maker = (...args) => {
11490
+ const returned = (creator !== null && creator !== void 0 ? creator : util_1.identityFunc)(...args);
11491
+ if ((0, util_1.isPromise)(returned)) {
11492
+ return returned.then((result) => {
11493
+ if (key in (result !== null && result !== void 0 ? result : {})) {
11494
+ return result;
11495
+ } else {
11496
+ return Object.assign(result !== null && result !== void 0 ? result : {}, { [key]: type });
11497
+ }
11498
+ });
11499
+ } else {
11500
+ if (key in (returned !== null && returned !== void 0 ? returned : {})) {
11501
+ return returned;
11502
+ } else {
11503
+ return Object.assign(returned !== null && returned !== void 0 ? returned : {}, { [key]: type });
11504
+ }
11505
+ }
11506
+ };
11507
+ Object.defineProperty(maker, "name", { value: type, writable: false });
11508
+ const outputs = { output: { key, type } };
11509
+ return Object.assign(maker, outputs, {
11510
+ [VARIANT_CREATOR_BRAND]: VARIANT_CREATOR_BRAND,
11511
+ toString: function() {
11512
+ return this.output.type;
11513
+ }
11514
+ });
11515
+ }
11516
+ function variantModule(template) {
11517
+ return Object.entries(template).reduce((result, [vmKey, vmVal]) => {
11518
+ const creator = typeof vmVal === "function" ? isVariantCreator(vmVal) ? vmVal : variation(vmKey, vmVal) : variation(vmKey, util_1.identityFunc);
11519
+ return Object.assign(Object.assign({}, result), { [vmKey]: creator });
11520
+ }, {});
11521
+ }
11522
+ function variantList(template) {
11523
+ return template.map((t) => {
11524
+ if (typeof t === "string") {
11525
+ return variation(t);
11526
+ } else if (typeof t === "function") {
11527
+ return t;
11528
+ }
11529
+ return t;
11530
+ }).reduce((result, t) => {
11531
+ let creator = typeof t === "string" ? variation(t) : t;
11532
+ return Object.assign(Object.assign({}, result), { [creator.output.type]: creator });
11533
+ }, {});
11534
+ }
11535
+ function variant2(template) {
11536
+ if (Array.isArray(template)) {
11537
+ return variantList(template);
11538
+ } else {
11539
+ return variantModule(template);
11540
+ }
11541
+ }
11542
+ return { descope, scoped: scope, variant: variant2, variantList, variantModule, variation };
11543
+ }
11544
+ exports.variantImpl = variantImpl;
11545
+ }
11546
+ });
11547
+
11548
+ // ../../node_modules/variant/lib/precepts.js
11549
+ var require_precepts = __commonJS({
11550
+ "../../node_modules/variant/lib/precepts.js"(exports) {
11551
+ "use strict";
11552
+ init_esm_shims();
11553
+ Object.defineProperty(exports, "__esModule", { value: true });
11554
+ exports.DEFAULT_KEY = void 0;
11555
+ exports.DEFAULT_KEY = "default";
11556
+ }
11557
+ });
11558
+
11559
+ // ../../node_modules/variant/lib/match.js
11560
+ var require_match = __commonJS({
11561
+ "../../node_modules/variant/lib/match.js"(exports) {
11562
+ "use strict";
11563
+ init_esm_shims();
11564
+ Object.defineProperty(exports, "__esModule", { value: true });
11565
+ exports.matchImpl = void 0;
11566
+ var variant_1 = require_variant();
11567
+ var precepts_1 = require_precepts();
11568
+ function matchImpl(key) {
11569
+ const prematch = (_) => (handler) => (instance) => match2(instance, handler);
11570
+ function match2(...args) {
11571
+ var _a, _b;
11572
+ if (args.length === 1) {
11573
+ const [handler] = args;
11574
+ return (instance) => match2(instance, handler);
11575
+ } else if (args.length === 2) {
11576
+ const [instanceOrTypeOrCreator, handlerParam] = args;
11577
+ const instanceOrCreator = typeof instanceOrTypeOrCreator === "string" ? ofLiteral(instanceOrTypeOrCreator) : instanceOrTypeOrCreator;
11578
+ const handler = typeof handlerParam === "function" ? handlerParam(instanceOrCreator) : handlerParam;
11579
+ const tType = instanceOrCreator == void 0 ? void 0 : (0, variant_1.isVariantCreator)(instanceOrCreator) ? instanceOrCreator.output.type : instanceOrCreator[key];
11580
+ if (instanceOrCreator != void 0 && tType !== void 0 && tType in handler) {
11581
+ return (_a = handler[tType]) === null || _a === void 0 ? void 0 : _a.call(handler, instanceOrCreator);
11582
+ } else if (precepts_1.DEFAULT_KEY in handler) {
11583
+ return (_b = handler[precepts_1.DEFAULT_KEY]) === null || _b === void 0 ? void 0 : _b.call(handler, instanceOrCreator);
11584
+ }
11585
+ }
11586
+ }
11587
+ const partial = (h) => () => h;
11588
+ const onLiteral = ofLiteral;
11589
+ function ofLiteral(instance) {
11590
+ return {
11591
+ [key]: instance
11592
+ };
11593
+ }
11594
+ function lookup(handler) {
11595
+ const handlerWithFuncs = Object.keys(handler).reduce((acc, cur) => {
11596
+ return Object.assign(Object.assign({}, acc), { [cur]: () => handler[cur] });
11597
+ }, {});
11598
+ return (_) => handlerWithFuncs;
11599
+ }
11600
+ function otherwise(branches, elseFunc) {
11601
+ return (_) => Object.assign(Object.assign({}, branches), { default: elseFunc });
11602
+ }
11603
+ function withFallback(handler, fallback) {
11604
+ return (_) => Object.assign(Object.assign({}, handler), { default: fallback });
11605
+ }
11606
+ return { match: match2, ofLiteral, onLiteral, otherwise, partial, prematch, lookup, withFallback };
11607
+ }
11608
+ exports.matchImpl = matchImpl;
11609
+ }
11610
+ });
11611
+
11612
+ // ../../node_modules/variant/lib/types.js
11613
+ var require_types = __commonJS({
11614
+ "../../node_modules/variant/lib/types.js"(exports) {
11615
+ "use strict";
11616
+ init_esm_shims();
11617
+ Object.defineProperty(exports, "__esModule", { value: true });
11618
+ exports.typesImpl = void 0;
11619
+ var variant_1 = require_variant();
11620
+ function typesImpl(key) {
11621
+ function types(content) {
11622
+ if (Array.isArray(content)) {
11623
+ if (content.length && (0, variant_1.isVariantCreator)(content[0])) {
11624
+ return content.map((c) => c.output.type);
11625
+ } else {
11626
+ return content.map((c) => c[key]);
11627
+ }
11628
+ } else {
11629
+ return Object.values(content).map((c) => c.output.type);
11630
+ }
11631
+ }
11632
+ function inferTypes(_) {
11633
+ return new Proxy({}, {
11634
+ get: (_2, property) => {
11635
+ return property;
11636
+ }
11637
+ });
11638
+ }
11639
+ return { types, inferTypes };
11640
+ }
11641
+ exports.typesImpl = typesImpl;
11642
+ }
11643
+ });
11644
+
11645
+ // ../../node_modules/variant/lib/flags.js
11646
+ var require_flags = __commonJS({
11647
+ "../../node_modules/variant/lib/flags.js"(exports) {
11648
+ "use strict";
11649
+ init_esm_shims();
11650
+ Object.defineProperty(exports, "__esModule", { value: true });
11651
+ exports.flagsImpl = void 0;
11652
+ function flagsImpl(key) {
11653
+ function flags(flags2) {
11654
+ return flags2.reduce((o, v) => Object.assign(Object.assign({}, o), { [v[key]]: v }), /* @__PURE__ */ Object.create(null));
11655
+ }
11656
+ return { flags };
11657
+ }
11658
+ exports.flagsImpl = flagsImpl;
11659
+ }
11660
+ });
11661
+
11662
+ // ../../node_modules/variant/lib/isOfVariant.js
11663
+ var require_isOfVariant = __commonJS({
11664
+ "../../node_modules/variant/lib/isOfVariant.js"(exports) {
11665
+ "use strict";
11666
+ init_esm_shims();
11667
+ Object.defineProperty(exports, "__esModule", { value: true });
11668
+ exports.isOfVariantImpl = void 0;
11669
+ function isOfVariantImpl(key) {
11670
+ function isOfVariant(...args) {
11671
+ if (args.length === 1) {
11672
+ const [variant2] = args;
11673
+ return (instance) => instance != void 0 && Object.values(variant2).some((vc) => vc.output.type === instance[key]);
11674
+ } else if (args.length === 2) {
11675
+ const [instance, variant2] = args;
11676
+ return instance != void 0 && Object.values(variant2).some((vc) => vc.output.type === instance[key]);
11677
+ }
11678
+ return false;
11679
+ }
11680
+ return { isOfVariant };
11681
+ }
11682
+ exports.isOfVariantImpl = isOfVariantImpl;
11683
+ }
11684
+ });
11685
+
11686
+ // ../../node_modules/variant/lib/remote.js
11687
+ var require_remote = __commonJS({
11688
+ "../../node_modules/variant/lib/remote.js"(exports) {
11689
+ "use strict";
11690
+ init_esm_shims();
11691
+ Object.defineProperty(exports, "__esModule", { value: true });
11692
+ exports.remoteImpl = exports.CompareResult = void 0;
11693
+ var isType_1 = require_isType();
11694
+ var match_1 = require_match();
11695
+ var variant_1 = require_variant();
11696
+ var CompareResult;
11697
+ (function(CompareResult2) {
11698
+ CompareResult2[CompareResult2["Lesser"] = -1] = "Lesser";
11699
+ CompareResult2[CompareResult2["Equal"] = 0] = "Equal";
11700
+ CompareResult2[CompareResult2["Greater"] = 1] = "Greater";
11701
+ })(CompareResult = exports.CompareResult || (exports.CompareResult = {}));
11702
+ function remoteImpl(key) {
11703
+ const { isType: isType2 } = (0, isType_1.isTypeImpl)(key);
11704
+ const { match: match2 } = (0, match_1.matchImpl)(key);
11705
+ const { variantList } = (0, variant_1.variantImpl)(key);
11706
+ function isFunctions(vmod) {
11707
+ const keys = Object.keys(vmod);
11708
+ return keys.reduce((acc, key2) => {
11709
+ return Object.assign(Object.assign({}, acc), { [key2]: isType2(key2) });
11710
+ }, {});
11711
+ }
11712
+ function remote(vmod) {
11713
+ return {
11714
+ key,
11715
+ is: isFunctions(vmod),
11716
+ new: vmod,
11717
+ match: match2
11718
+ };
11719
+ }
11720
+ ;
11721
+ function getType(input) {
11722
+ if (typeof input === "string") {
11723
+ return input;
11724
+ } else if (typeof input === "function") {
11725
+ return input.output.type;
11726
+ } else {
11727
+ return input[key];
11728
+ }
11729
+ }
11730
+ function _sequence(module3, order) {
11731
+ const miniModule = module3;
11732
+ const result = remote(miniModule);
11733
+ const keyOrder = order.map(getType);
11734
+ return Object.assign(Object.assign({}, result), { length: order.length, compare: (a, b) => {
11735
+ const ai = keyOrder.findIndex((i) => i === getType(a));
11736
+ const bi = keyOrder.findIndex((i) => i === getType(b));
11737
+ const diff = ai - bi;
11738
+ return diff === 0 ? diff : diff / Math.abs(diff);
11739
+ }, get(i) {
11740
+ const type = this.types[i];
11741
+ return this.new[type];
11742
+ }, index: (a) => keyOrder.findIndex((i) => i === getType(a)), types: keyOrder });
11743
+ }
11744
+ function _sequenceOfList(order) {
11745
+ const module3 = variantList(order);
11746
+ return _sequence(module3, order);
11747
+ }
11748
+ function sequence(module3, order) {
11749
+ if (Array.isArray(module3)) {
11750
+ return _sequenceOfList(module3);
11751
+ } else {
11752
+ return _sequence(module3, order);
11753
+ }
11754
+ }
11755
+ return { remote, sequence };
11756
+ }
11757
+ exports.remoteImpl = remoteImpl;
11758
+ }
11759
+ });
11760
+
11761
+ // ../../node_modules/variant/lib/typed.js
11762
+ var require_typed = __commonJS({
11763
+ "../../node_modules/variant/lib/typed.js"(exports) {
11764
+ "use strict";
11765
+ init_esm_shims();
11766
+ Object.defineProperty(exports, "__esModule", { value: true });
11767
+ exports.typedImpl = exports.pass = void 0;
11768
+ var pass = (x) => x;
11769
+ exports.pass = pass;
11770
+ function typedImpl(_key) {
11771
+ function typed(defOrFactory) {
11772
+ if (typeof defOrFactory === "function") {
11773
+ return defOrFactory(exports.pass);
11774
+ } else {
11775
+ return defOrFactory;
11776
+ }
11777
+ }
11778
+ return { typed };
11779
+ }
11780
+ exports.typedImpl = typedImpl;
11781
+ }
11782
+ });
11783
+
11784
+ // ../../node_modules/variant/lib/match.tools.js
11785
+ var require_match_tools = __commonJS({
11786
+ "../../node_modules/variant/lib/match.tools.js"(exports) {
11787
+ "use strict";
11788
+ init_esm_shims();
11789
+ Object.defineProperty(exports, "__esModule", { value: true });
11790
+ exports.unpack = exports.just = exports.constant = void 0;
11791
+ function constant(x) {
11792
+ return () => x;
11793
+ }
11794
+ exports.constant = constant;
11795
+ exports.just = constant;
11796
+ var unpack = (x) => x.payload;
11797
+ exports.unpack = unpack;
11798
+ }
11799
+ });
11800
+
11801
+ // ../../node_modules/variant/lib/matcher.js
11802
+ var require_matcher2 = __commonJS({
11803
+ "../../node_modules/variant/lib/matcher.js"(exports) {
11804
+ "use strict";
11805
+ init_esm_shims();
11806
+ Object.defineProperty(exports, "__esModule", { value: true });
11807
+ exports.matcherImpl = exports.Matcher = exports.tableToHandler = void 0;
11808
+ var match_tools_1 = require_match_tools();
11809
+ var variant_1 = require_variant();
11810
+ function tableToHandler(table) {
11811
+ return Object.keys(table).reduce((acc, cur) => {
11812
+ const key = cur;
11813
+ return Object.assign(Object.assign({}, acc), { [key]: (0, match_tools_1.just)(table[key]) });
11814
+ }, {});
11815
+ }
11816
+ exports.tableToHandler = tableToHandler;
11817
+ var Matcher = class _Matcher {
11818
+ /**
11819
+ * Create a new matcher from the target
11820
+ * @param target the
11821
+ * @param handler the initial handler. Use `{}` for standard functionality.
11822
+ * @param key the discriminant. Use `'type'` for standard functionality.
11823
+ */
11824
+ constructor(target, key, handler) {
11825
+ this.target = target;
11826
+ this.key = key;
11827
+ this.handler = handler;
11828
+ this.complete = (options) => {
11829
+ var _a, _b;
11830
+ if (this.target != void 0 && this.target[this.key] in this.handler) {
11831
+ return (_b = (_a = this.handler)[this.target[this.key]]) === null || _b === void 0 ? void 0 : _b.call(_a, this.target);
11832
+ } else {
11833
+ if ((options === null || options === void 0 ? void 0 : options.withFallback) != void 0) {
11834
+ return options.withFallback(this.target);
11835
+ }
11836
+ }
11837
+ };
11838
+ }
11839
+ /**
11840
+ * Immediately execute the matcher. Exhaustiveness is not guaranteed.
11841
+ *
11842
+ * This is a **terminal** and resolves the matcher.
11843
+ */
11844
+ execute() {
11845
+ const chosenHandler = this.handler[this.target[this.key]];
11846
+ return chosenHandler === null || chosenHandler === void 0 ? void 0 : chosenHandler(this.target);
11847
+ }
11848
+ /**
11849
+ * Handle all unhandled cases and immediately execute.
11850
+ *
11851
+ * > **Exhaust** — to consume entirely, _Merriam-Webster_
11852
+ *
11853
+ * This is a **terminal** and resolves the matcher.
11854
+ * @param remainingCases an object wiht a method to handle every remaining case.
11855
+ * @returns the result of executing the handler, given these final additions.
11856
+ */
11857
+ exhaust(remainingCases) {
11858
+ var _a;
11859
+ const combinedHandler = Object.assign(Object.assign({}, this.handler), remainingCases);
11860
+ return (_a = combinedHandler[this.target[this.key]]) === null || _a === void 0 ? void 0 : _a.call(combinedHandler, this.target);
11861
+ }
11862
+ /**
11863
+ * Resolve all remaining cases without executing the matcher.
11864
+ * @param remainingCases
11865
+ * @returns
11866
+ */
11867
+ remaining(remainingCases) {
11868
+ return new _Matcher(this.target, this.key, Object.assign(Object.assign({}, this.handler), remainingCases));
11869
+ }
11870
+ /**
11871
+ * Execute the match. If the target type has been explicitly handled, use that logic.
11872
+ * Otherwise use the function passed here.
11873
+ *
11874
+ * This is a **terminal** and resolves the matcher.
11875
+ * @param func
11876
+ * @returns
11877
+ */
11878
+ else(func) {
11879
+ var _a, _b;
11880
+ if (this.target[this.key] in this.handler) {
11881
+ return (_b = (_a = this.handler)[this.target[this.key]]) === null || _b === void 0 ? void 0 : _b.call(_a, this.target);
11882
+ } else {
11883
+ return func(this.target);
11884
+ }
11885
+ }
11886
+ /**
11887
+ * Register a series of options as a lookup table.
11888
+ *
11889
+ * ```ts
11890
+ * const getSound = (a: Animal) => matcher(a)
11891
+ * .register({
11892
+ * cat: 'purr',
11893
+ * dog: 'woof',
11894
+ * snake: 'hiss',
11895
+ * })
11896
+ * .complete()
11897
+ * ```
11898
+ * @param table
11899
+ * @returns
11900
+ */
11901
+ register(table) {
11902
+ const newHandler = Object.assign(Object.assign({}, this.handler), tableToHandler(table));
11903
+ return new _Matcher(this.target, this.key, newHandler);
11904
+ }
11905
+ /**
11906
+ * Provide an exhaustive table of the unhandled options and look up which value
11907
+ * to use based on the instance.
11908
+ *
11909
+ * This is a **terminal** and resolves the matcher.
11910
+ *
11911
+ * ```ts
11912
+ * const getSound = (a: Animal) => matcher(a)
11913
+ * .lookup({
11914
+ * cat: 'purr',
11915
+ * dog: 'woof',
11916
+ * snake: 'hiss',
11917
+ * })
11918
+ * ```
11919
+ * @param table
11920
+ * @returns
11921
+ */
11922
+ lookup(table) {
11923
+ var _a;
11924
+ const combinedHandler = Object.assign(Object.assign({}, this.handler), tableToHandler(table));
11925
+ return (_a = combinedHandler[this.target[this.key]]) === null || _a === void 0 ? void 0 : _a.call(combinedHandler, this.target);
11926
+ }
11927
+ /**
11928
+ * Handle one or more cases, object-style.
11929
+ * @param variations
11930
+ */
11931
+ with(variations) {
11932
+ return new _Matcher(this.target, this.key, Object.assign(Object.assign({}, this.handler), variations));
11933
+ }
11934
+ // actual implementation
11935
+ when(variations, handler) {
11936
+ if (handler != void 0) {
11937
+ const list = Array.isArray(variations) ? variations : [variations];
11938
+ const newCases = list.reduce((acc, cur) => {
11939
+ const type = typeof cur === "string" ? cur : (0, variant_1.isVariantCreator)(cur) ? cur.output.type : void 0;
11940
+ return type != void 0 ? Object.assign(Object.assign({}, acc), { [type]: handler }) : acc;
11941
+ }, {});
11942
+ return new _Matcher(this.target, this.key, Object.assign(Object.assign({}, this.handler), newCases));
11943
+ } else {
11944
+ return new _Matcher(this.target, this.key, Object.assign(Object.assign({}, this.handler), variations));
11945
+ }
11946
+ }
11947
+ };
11948
+ exports.Matcher = Matcher;
11949
+ function matcherImpl(key) {
11950
+ function matcher(target) {
11951
+ const actualTarget = typeof target === "string" ? { [key]: target } : target;
11952
+ return new Matcher(actualTarget, key, {});
11953
+ }
11954
+ return { matcher };
11955
+ }
11956
+ exports.matcherImpl = matcherImpl;
11957
+ }
11958
+ });
11959
+
11960
+ // ../../node_modules/variant/lib/cosmos.js
11961
+ var require_cosmos = __commonJS({
11962
+ "../../node_modules/variant/lib/cosmos.js"(exports) {
11963
+ "use strict";
11964
+ init_esm_shims();
11965
+ Object.defineProperty(exports, "__esModule", { value: true });
11966
+ exports.variantCosmos = void 0;
11967
+ var isType_1 = require_isType();
11968
+ var match_1 = require_match();
11969
+ var variant_1 = require_variant();
11970
+ var types_1 = require_types();
11971
+ var flags_1 = require_flags();
11972
+ var isOfVariant_1 = require_isOfVariant();
11973
+ var remote_1 = require_remote();
11974
+ var typed_1 = require_typed();
11975
+ var matcher_1 = require_matcher2();
11976
+ function variantCosmos({ key }) {
11977
+ const { isType: isType2 } = (0, isType_1.isTypeImpl)(key);
11978
+ const { flags } = (0, flags_1.flagsImpl)(key);
11979
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
11980
+ key,
11981
+ isType: isType2,
11982
+ flags
11983
+ }, (0, isOfVariant_1.isOfVariantImpl)(key)), (0, match_1.matchImpl)(key)), (0, matcher_1.matcherImpl)(key)), (0, remote_1.remoteImpl)(key)), (0, typed_1.typedImpl)(key)), (0, types_1.typesImpl)(key)), (0, variant_1.variantImpl)(key));
11984
+ }
11985
+ exports.variantCosmos = variantCosmos;
11986
+ }
11987
+ });
11988
+
11989
+ // ../../node_modules/variant/lib/type/index.js
11990
+ var require_type = __commonJS({
11991
+ "../../node_modules/variant/lib/type/index.js"(exports) {
11992
+ "use strict";
11993
+ init_esm_shims();
11994
+ var _a;
11995
+ Object.defineProperty(exports, "__esModule", { value: true });
11996
+ exports.withFallback = exports.variation = exports.variantModule = exports.variantList = exports.variant = exports.types = exports.typed = exports.lookup = exports.sequence = exports.scoped = exports.remote = exports.prematch = exports.partial = exports.otherwise = exports.onLiteral = exports.ofLiteral = exports.matcher = exports.match = exports.isType = exports.isOfVariant = exports.inferTypes = exports.flags = exports.descope = void 0;
11997
+ var cosmos_1 = require_cosmos();
11998
+ _a = (0, cosmos_1.variantCosmos)({ key: "type" }), exports.descope = _a.descope, exports.flags = _a.flags, exports.inferTypes = _a.inferTypes, exports.isOfVariant = _a.isOfVariant, exports.isType = _a.isType, exports.match = _a.match, exports.matcher = _a.matcher, exports.ofLiteral = _a.ofLiteral, exports.onLiteral = _a.onLiteral, exports.otherwise = _a.otherwise, exports.partial = _a.partial, exports.prematch = _a.prematch, exports.remote = _a.remote, exports.scoped = _a.scoped, exports.sequence = _a.sequence, exports.lookup = _a.lookup, exports.typed = _a.typed, exports.types = _a.types, exports.variant = _a.variant, exports.variantList = _a.variantList, exports.variantModule = _a.variantModule, exports.variation = _a.variation, exports.withFallback = _a.withFallback;
11999
+ }
12000
+ });
12001
+
12002
+ // ../../node_modules/variant/lib/augment.js
12003
+ var require_augment = __commonJS({
12004
+ "../../node_modules/variant/lib/augment.js"(exports) {
12005
+ "use strict";
12006
+ init_esm_shims();
12007
+ Object.defineProperty(exports, "__esModule", { value: true });
12008
+ exports.augment = void 0;
12009
+ var type_1 = require_type();
12010
+ var variant_1 = require_variant();
12011
+ function augment(variantDefinition, f) {
12012
+ return Object.keys(variantDefinition).reduce((acc, key) => {
12013
+ let inputFunc = variantDefinition[key];
12014
+ let returnFunc = (0, variant_1.isVariantCreator)(inputFunc) ? (0, type_1.variation)(inputFunc.output.type, (...args) => {
12015
+ let result = inputFunc(...args);
12016
+ return Object.assign(Object.assign({}, f(result)), result);
12017
+ }) : (...args) => {
12018
+ const branch = variantDefinition[key];
12019
+ let item = typeof branch === "function" ? branch(...args) : {};
12020
+ return Object.assign(Object.assign({}, f(item)), item);
12021
+ };
12022
+ return Object.assign(Object.assign({}, acc), { [key]: returnFunc });
12023
+ }, {});
12024
+ }
12025
+ exports.augment = augment;
12026
+ }
12027
+ });
12028
+
12029
+ // ../../node_modules/variant/lib/constrained.js
12030
+ var require_constrained = __commonJS({
12031
+ "../../node_modules/variant/lib/constrained.js"(exports) {
12032
+ "use strict";
12033
+ init_esm_shims();
12034
+ Object.defineProperty(exports, "__esModule", { value: true });
12035
+ exports.constrained = void 0;
12036
+ function constrained(_constraint_, v) {
12037
+ return v;
12038
+ }
12039
+ exports.constrained = constrained;
12040
+ }
12041
+ });
12042
+
12043
+ // ../../node_modules/variant/lib/construct.js
12044
+ var require_construct = __commonJS({
12045
+ "../../node_modules/variant/lib/construct.js"(exports) {
12046
+ "use strict";
12047
+ init_esm_shims();
12048
+ Object.defineProperty(exports, "__esModule", { value: true });
12049
+ exports.construct = void 0;
12050
+ function construct(cls) {
12051
+ return (...args) => new cls(args);
12052
+ }
12053
+ exports.construct = construct;
12054
+ }
12055
+ });
12056
+
12057
+ // ../../node_modules/variant/lib/generic.js
12058
+ var require_generic = __commonJS({
12059
+ "../../node_modules/variant/lib/generic.js"(exports) {
12060
+ "use strict";
12061
+ init_esm_shims();
12062
+ Object.defineProperty(exports, "__esModule", { value: true });
12063
+ exports.Alpha = exports.onTerms = void 0;
12064
+ var flags_1 = require_flags();
12065
+ var variant_1 = require_variant();
12066
+ var GENERIC_BRAND = Symbol("VARIANT GENERIC TEMPLATE");
12067
+ function onTerms(func) {
12068
+ return Object.assign(Object.assign({}, func(exports.Alpha)), { [GENERIC_BRAND]: void 0 });
12069
+ }
12070
+ exports.onTerms = onTerms;
12071
+ var GTERM = "__term";
12072
+ var genericTerms = (0, variant_1.variantImpl)(GTERM).variant;
12073
+ var flags = (0, flags_1.flagsImpl)(GTERM).flags;
12074
+ var GP = genericTerms([
12075
+ "A",
12076
+ "B",
12077
+ "C",
12078
+ "D",
12079
+ "E",
12080
+ "F",
12081
+ "G",
12082
+ "H",
12083
+ "I",
12084
+ "J",
12085
+ "K",
12086
+ "L",
12087
+ "M",
12088
+ "N",
12089
+ "O",
12090
+ "P",
12091
+ "Q",
12092
+ "R",
12093
+ "S",
12094
+ "T",
12095
+ "U",
12096
+ "V",
12097
+ "W",
12098
+ "X",
12099
+ "Y",
12100
+ "Z"
12101
+ ]);
12102
+ exports.Alpha = flags(Object.values(GP).map((f) => f()));
12103
+ }
12104
+ });
12105
+
12106
+ // ../../node_modules/variant/lib/typeCatalog.js
12107
+ var require_typeCatalog = __commonJS({
12108
+ "../../node_modules/variant/lib/typeCatalog.js"(exports) {
12109
+ "use strict";
12110
+ init_esm_shims();
12111
+ Object.defineProperty(exports, "__esModule", { value: true });
12112
+ exports.typeMap = exports.typeCatalog = void 0;
12113
+ function typeCatalog(variant2) {
12114
+ return Object.values(variant2).reduce((result, vc) => {
12115
+ return Object.assign(Object.assign({}, result), { [vc.output.type]: vc.output.type });
12116
+ }, {});
12117
+ }
12118
+ exports.typeCatalog = typeCatalog;
12119
+ function typeMap(variant2) {
12120
+ return Object.keys(variant2).reduce((result, key) => {
12121
+ return Object.assign(Object.assign({}, result), { [key]: variant2[key].output.type });
12122
+ }, {});
12123
+ }
12124
+ exports.typeMap = typeMap;
12125
+ }
12126
+ });
12127
+
12128
+ // ../../node_modules/variant/lib/catalog.js
12129
+ var require_catalog = __commonJS({
12130
+ "../../node_modules/variant/lib/catalog.js"(exports) {
12131
+ "use strict";
12132
+ init_esm_shims();
12133
+ Object.defineProperty(exports, "__esModule", { value: true });
12134
+ exports.literalist = exports.catalog = void 0;
12135
+ function catalog(catalog2, factory) {
12136
+ if (Array.isArray(catalog2)) {
12137
+ return catalog2.reduce((result, current, index) => {
12138
+ return Object.assign(Object.assign({}, result), { [current]: factory != void 0 ? factory(current, index) : current });
12139
+ }, {});
12140
+ } else {
12141
+ return catalog2;
12142
+ }
12143
+ }
12144
+ exports.catalog = catalog;
12145
+ exports.literalist = catalog;
12146
+ }
12147
+ });
12148
+
12149
+ // ../../node_modules/variant/lib/patterned.js
12150
+ var require_patterned = __commonJS({
12151
+ "../../node_modules/variant/lib/patterned.js"(exports) {
12152
+ "use strict";
12153
+ init_esm_shims();
12154
+ Object.defineProperty(exports, "__esModule", { value: true });
12155
+ exports.patterned = void 0;
12156
+ function patterned(_constraint_, v) {
12157
+ return v;
12158
+ }
12159
+ exports.patterned = patterned;
12160
+ }
12161
+ });
12162
+
12163
+ // ../../node_modules/variant/lib/variant.tools.js
12164
+ var require_variant_tools = __commonJS({
12165
+ "../../node_modules/variant/lib/variant.tools.js"(exports) {
12166
+ "use strict";
12167
+ init_esm_shims();
12168
+ Object.defineProperty(exports, "__esModule", { value: true });
12169
+ exports.nil = exports.payload = exports.fields = void 0;
12170
+ function fields2(defaults = {}) {
12171
+ return (...args) => {
12172
+ const [arg] = args;
12173
+ return Object.assign(Object.assign({}, defaults), arg);
12174
+ };
12175
+ }
12176
+ exports.fields = fields2;
12177
+ function payload(_example) {
12178
+ return (payload2) => ({ payload: payload2 });
12179
+ }
12180
+ exports.payload = payload;
12181
+ var nil = () => ({});
12182
+ exports.nil = nil;
12183
+ }
12184
+ });
12185
+
12186
+ // ../../node_modules/variant/lib/slim.js
12187
+ var require_slim = __commonJS({
12188
+ "../../node_modules/variant/lib/slim.js"(exports) {
12189
+ "use strict";
12190
+ init_esm_shims();
12191
+ Object.defineProperty(exports, "__esModule", { value: true });
12192
+ exports.payload = exports.nil = exports.fields = exports.HOI = exports.pass = exports.patterned = exports.unpack = exports.just = exports.constant = exports.literalist = exports.catalog = exports.typeCatalog = exports.typeMap = exports.onTerms = exports.variantCosmos = exports.construct = exports.constrained = exports.augment = void 0;
12193
+ var augment_1 = require_augment();
12194
+ Object.defineProperty(exports, "augment", { enumerable: true, get: function() {
12195
+ return augment_1.augment;
12196
+ } });
12197
+ var constrained_1 = require_constrained();
12198
+ Object.defineProperty(exports, "constrained", { enumerable: true, get: function() {
12199
+ return constrained_1.constrained;
12200
+ } });
12201
+ var construct_1 = require_construct();
12202
+ Object.defineProperty(exports, "construct", { enumerable: true, get: function() {
12203
+ return construct_1.construct;
12204
+ } });
12205
+ var cosmos_1 = require_cosmos();
12206
+ Object.defineProperty(exports, "variantCosmos", { enumerable: true, get: function() {
12207
+ return cosmos_1.variantCosmos;
12208
+ } });
12209
+ var generic_1 = require_generic();
12210
+ Object.defineProperty(exports, "onTerms", { enumerable: true, get: function() {
12211
+ return generic_1.onTerms;
12212
+ } });
12213
+ var typeCatalog_1 = require_typeCatalog();
12214
+ Object.defineProperty(exports, "typeMap", { enumerable: true, get: function() {
12215
+ return typeCatalog_1.typeMap;
12216
+ } });
12217
+ Object.defineProperty(exports, "typeCatalog", { enumerable: true, get: function() {
12218
+ return typeCatalog_1.typeCatalog;
12219
+ } });
12220
+ var catalog_1 = require_catalog();
12221
+ Object.defineProperty(exports, "catalog", { enumerable: true, get: function() {
12222
+ return catalog_1.catalog;
12223
+ } });
12224
+ Object.defineProperty(exports, "literalist", { enumerable: true, get: function() {
12225
+ return catalog_1.literalist;
12226
+ } });
12227
+ var match_tools_1 = require_match_tools();
12228
+ Object.defineProperty(exports, "constant", { enumerable: true, get: function() {
12229
+ return match_tools_1.constant;
12230
+ } });
12231
+ Object.defineProperty(exports, "just", { enumerable: true, get: function() {
12232
+ return match_tools_1.just;
12233
+ } });
12234
+ Object.defineProperty(exports, "unpack", { enumerable: true, get: function() {
12235
+ return match_tools_1.unpack;
12236
+ } });
12237
+ var patterned_1 = require_patterned();
12238
+ Object.defineProperty(exports, "patterned", { enumerable: true, get: function() {
12239
+ return patterned_1.patterned;
12240
+ } });
12241
+ var typed_1 = require_typed();
12242
+ Object.defineProperty(exports, "pass", { enumerable: true, get: function() {
12243
+ return typed_1.pass;
12244
+ } });
12245
+ var util_1 = require_util();
12246
+ Object.defineProperty(exports, "HOI", { enumerable: true, get: function() {
12247
+ return util_1.HOI;
12248
+ } });
12249
+ var variant_tools_1 = require_variant_tools();
12250
+ Object.defineProperty(exports, "fields", { enumerable: true, get: function() {
12251
+ return variant_tools_1.fields;
12252
+ } });
12253
+ Object.defineProperty(exports, "nil", { enumerable: true, get: function() {
12254
+ return variant_tools_1.nil;
12255
+ } });
12256
+ Object.defineProperty(exports, "payload", { enumerable: true, get: function() {
12257
+ return variant_tools_1.payload;
12258
+ } });
12259
+ }
12260
+ });
12261
+
12262
+ // ../../node_modules/variant/lib/index.js
12263
+ var require_lib = __commonJS({
12264
+ "../../node_modules/variant/lib/index.js"(exports) {
12265
+ "use strict";
12266
+ init_esm_shims();
12267
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
12268
+ if (k2 === void 0) k2 = k;
12269
+ Object.defineProperty(o, k2, { enumerable: true, get: function() {
12270
+ return m[k];
12271
+ } });
12272
+ } : function(o, m, k, k2) {
12273
+ if (k2 === void 0) k2 = k;
12274
+ o[k2] = m[k];
12275
+ });
12276
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
12277
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
12278
+ };
12279
+ Object.defineProperty(exports, "__esModule", { value: true });
12280
+ __exportStar(require_slim(), exports);
12281
+ __exportStar(require_type(), exports);
12282
+ }
12283
+ });
12284
+
11413
12285
  // src/index.ts
11414
12286
  init_esm_shims();
11415
12287
  var import_chokidar = __toESM(require_chokidar(), 1);
11416
12288
  import { join as join6 } from "node:path";
12289
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
11417
12290
  import { envField, passthroughImageService } from "astro/config";
11418
12291
 
11419
12292
  // ../../node_modules/outdent/lib-module/index.js
@@ -11461,9 +12334,9 @@ var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
11461
12334
  var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
11462
12335
  function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
11463
12336
  var indentationLevel = 0;
11464
- var match = strings[0].match(reDetectIndentation);
11465
- if (match) {
11466
- indentationLevel = match[1].length;
12337
+ var match2 = strings[0].match(reDetectIndentation);
12338
+ if (match2) {
12339
+ indentationLevel = match2[1].length;
11467
12340
  }
11468
12341
  var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
11469
12342
  var reMatchIndent = new RegExp(reSource, "g");
@@ -12104,6 +12977,26 @@ var generateGlobTasks = normalizeArguments(generateTasks);
12104
12977
  var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
12105
12978
  var { convertPathToPattern } = import_fast_glob2.default;
12106
12979
 
12980
+ // src/components.ts
12981
+ init_esm_shims();
12982
+ var import_variant = __toESM(require_lib(), 1);
12983
+ var Component = (0, import_variant.variant)({
12984
+ BackofficeExtensionMenuPlugin: (0, import_variant.fields)(),
12985
+ BackofficeExtensionWidget: (0, import_variant.fields)(),
12986
+ BackofficeModal: (0, import_variant.fields)(),
12987
+ BackofficePage: (0, import_variant.fields)(),
12988
+ EcomAdditionalFees: (0, import_variant.fields)(),
12989
+ EcomDiscountsTrigger: (0, import_variant.fields)(),
12990
+ EcomGiftCardsProvider: (0, import_variant.fields)(),
12991
+ EcomPaymentSettings: (0, import_variant.fields)(),
12992
+ EcomShippingRates: (0, import_variant.fields)(),
12993
+ EcomValidations: (0, import_variant.fields)(),
12994
+ Webhook: (0, import_variant.fields)()
12995
+ });
12996
+ var UnknownComponent = (0, import_variant.variant)({
12997
+ Unknown: (0, import_variant.fields)()
12998
+ });
12999
+
12107
13000
  // src/schemas.ts
12108
13001
  init_esm_shims();
12109
13002
 
@@ -16169,13 +17062,13 @@ var z = /* @__PURE__ */ Object.freeze({
16169
17062
  });
16170
17063
 
16171
17064
  // src/schemas.ts
16172
- var baseComponentSchema = z.object({
17065
+ var baseDevCenterComponentSchema = z.object({
16173
17066
  compData: z.unknown(),
16174
17067
  compId: z.string(),
16175
17068
  compName: z.string().optional(),
16176
17069
  compType: z.string()
16177
17070
  }).passthrough();
16178
- var webhookSchema = baseComponentSchema.merge(
17071
+ var devCenterWebhookSchema = baseDevCenterComponentSchema.merge(
16179
17072
  z.object({
16180
17073
  compData: z.object({
16181
17074
  webhook: z.object({
@@ -16185,7 +17078,7 @@ var webhookSchema = baseComponentSchema.merge(
16185
17078
  compType: z.literal("WEBHOOK")
16186
17079
  })
16187
17080
  );
16188
- var backofficeExtensionWidgetSchema = baseComponentSchema.merge(
17081
+ var devCenterBackofficeExtensionWidgetSchema = baseDevCenterComponentSchema.merge(
16189
17082
  z.object({
16190
17083
  compData: z.object({
16191
17084
  backOfficeExtensionWidget: z.object({
@@ -16195,17 +17088,15 @@ var backofficeExtensionWidgetSchema = baseComponentSchema.merge(
16195
17088
  compType: z.literal("BACK_OFFICE_EXTENSION_WIDGET")
16196
17089
  })
16197
17090
  );
16198
- var backofficeExtensionMenuPluginSchema = baseComponentSchema.merge(
17091
+ var devCenterBackofficeExtensionMenuPluginSchema = baseDevCenterComponentSchema.merge(
16199
17092
  z.object({
16200
17093
  compData: z.object({
16201
- backOfficeExtensionMenuItem: z.object({
16202
- iframeUrl: z.string().optional()
16203
- }).passthrough()
17094
+ backOfficeExtensionMenuItem: z.unknown().optional()
16204
17095
  }),
16205
17096
  compType: z.literal("BACK_OFFICE_EXTENSION_MENU_ITEM")
16206
17097
  })
16207
17098
  );
16208
- var backofficeModalSchema = baseComponentSchema.merge(
17099
+ var devCenterBackofficeModalSchema = baseDevCenterComponentSchema.merge(
16209
17100
  z.object({
16210
17101
  compData: z.object({
16211
17102
  backOfficeModal: z.object({
@@ -16215,7 +17106,7 @@ var backofficeModalSchema = baseComponentSchema.merge(
16215
17106
  compType: z.literal("BACK_OFFICE_MODAL")
16216
17107
  })
16217
17108
  );
16218
- var backofficePageSchema = baseComponentSchema.merge(
17109
+ var devCenterBackofficePageSchema = baseDevCenterComponentSchema.merge(
16219
17110
  z.object({
16220
17111
  compData: z.object({
16221
17112
  backOfficePage: z.object({
@@ -16225,7 +17116,7 @@ var backofficePageSchema = baseComponentSchema.merge(
16225
17116
  compType: z.literal("BACK_OFFICE_PAGE")
16226
17117
  })
16227
17118
  );
16228
- var ecomAdditionalFeesSchema = baseComponentSchema.merge(
17119
+ var devCenterEcomAdditionalFeesSchema = baseDevCenterComponentSchema.merge(
16229
17120
  z.object({
16230
17121
  compData: z.object({
16231
17122
  ecomAdditionalFees: z.object({
@@ -16235,7 +17126,7 @@ var ecomAdditionalFeesSchema = baseComponentSchema.merge(
16235
17126
  compType: z.literal("ECOM_ADDITIONAL_FEES")
16236
17127
  })
16237
17128
  );
16238
- var ecomDiscountsTriggerSchema = baseComponentSchema.merge(
17129
+ var devCenterEcomDiscountsTriggerSchema = baseDevCenterComponentSchema.merge(
16239
17130
  z.object({
16240
17131
  compData: z.object({
16241
17132
  ecomDiscountsTrigger: z.object({
@@ -16245,7 +17136,7 @@ var ecomDiscountsTriggerSchema = baseComponentSchema.merge(
16245
17136
  compType: z.literal("ECOM_DISCOUNTS_TRIGGER")
16246
17137
  })
16247
17138
  );
16248
- var ecomPaymentSettingsSchema = baseComponentSchema.merge(
17139
+ var devCenterEcomPaymentSettingsSchema = baseDevCenterComponentSchema.merge(
16249
17140
  z.object({
16250
17141
  compData: z.object({
16251
17142
  ecomPaymentSettings: z.object({
@@ -16255,7 +17146,7 @@ var ecomPaymentSettingsSchema = baseComponentSchema.merge(
16255
17146
  compType: z.literal("ECOM_PAYMENT_SETTINGS")
16256
17147
  })
16257
17148
  );
16258
- var ecomShippingRatesSchema = baseComponentSchema.merge(
17149
+ var devCenterEcomShippingRatesSchema = baseDevCenterComponentSchema.merge(
16259
17150
  z.object({
16260
17151
  compData: z.object({
16261
17152
  ecomShippingRates: z.object({
@@ -16265,7 +17156,7 @@ var ecomShippingRatesSchema = baseComponentSchema.merge(
16265
17156
  compType: z.literal("ECOM_SHIPPING_RATES")
16266
17157
  })
16267
17158
  );
16268
- var ecomValidationsSchema = baseComponentSchema.merge(
17159
+ var devCenterEcomValidationsSchema = baseDevCenterComponentSchema.merge(
16269
17160
  z.object({
16270
17161
  compData: z.object({
16271
17162
  ecomValidations: z.object({
@@ -16275,7 +17166,7 @@ var ecomValidationsSchema = baseComponentSchema.merge(
16275
17166
  compType: z.literal("ECOM_VALIDATIONS")
16276
17167
  })
16277
17168
  );
16278
- var ecomGiftCardsProviderSchema = baseComponentSchema.merge(
17169
+ var devCenterEcomGiftCardsProviderSchema = baseDevCenterComponentSchema.merge(
16279
17170
  z.object({
16280
17171
  compData: z.object({
16281
17172
  giftCardsProvider: z.object({
@@ -16285,18 +17176,18 @@ var ecomGiftCardsProviderSchema = baseComponentSchema.merge(
16285
17176
  compType: z.literal("GIFT_CARDS_PROVIDER")
16286
17177
  })
16287
17178
  );
16288
- var componentSchema = z.discriminatedUnion("compType", [
16289
- backofficePageSchema,
16290
- backofficeExtensionWidgetSchema,
16291
- backofficeExtensionMenuPluginSchema,
16292
- backofficeModalSchema,
16293
- webhookSchema,
16294
- ecomAdditionalFeesSchema,
16295
- ecomShippingRatesSchema,
16296
- ecomDiscountsTriggerSchema,
16297
- ecomValidationsSchema,
16298
- ecomPaymentSettingsSchema,
16299
- ecomGiftCardsProviderSchema
17179
+ var devCenterComponentSchema = z.discriminatedUnion("compType", [
17180
+ devCenterBackofficePageSchema,
17181
+ devCenterBackofficeExtensionWidgetSchema,
17182
+ devCenterBackofficeExtensionMenuPluginSchema,
17183
+ devCenterBackofficeModalSchema,
17184
+ devCenterWebhookSchema,
17185
+ devCenterEcomAdditionalFeesSchema,
17186
+ devCenterEcomShippingRatesSchema,
17187
+ devCenterEcomDiscountsTriggerSchema,
17188
+ devCenterEcomValidationsSchema,
17189
+ devCenterEcomPaymentSettingsSchema,
17190
+ devCenterEcomGiftCardsProviderSchema
16300
17191
  ]);
16301
17192
 
16302
17193
  // src/utils/fs-utils.ts
@@ -16861,45 +17752,113 @@ function loadEnvVars(rootDir, logger) {
16861
17752
  async function createProjectModel(logger) {
16862
17753
  const rootDir = cwd();
16863
17754
  const { appId, env: env2 } = loadEnvVars(rootDir, logger);
16864
- const extensionsPaths = await globby(join2(EXTENSIONS_DIR, "*"), {
17755
+ const componentsPaths = await globby(join2(EXTENSIONS_DIR, "*"), {
16865
17756
  cwd: rootDir,
16866
17757
  onlyDirectories: true
16867
17758
  });
16868
- const extensions = [];
16869
- const unknownExtensions = [];
16870
- for (const extensionPath of extensionsPaths) {
16871
- const extensionManifest = await readExtensionManifest(extensionPath);
16872
- const knownAppManifest = await parseKnownExtensionManifest(extensionManifest);
16873
- if (knownAppManifest != null) {
16874
- extensions.push({
16875
- cwd: extensionPath,
16876
- manifest: knownAppManifest
16877
- });
17759
+ const components = [];
17760
+ const unknownComponents = [];
17761
+ for (const componentPath of componentsPaths) {
17762
+ const extensionManifest = await readExtensionManifest(componentPath);
17763
+ const knownManifest = await parseKnownExtensionManifest(extensionManifest);
17764
+ if (knownManifest != null) {
17765
+ components.push(createComponent(knownManifest, componentPath));
16878
17766
  continue;
16879
17767
  }
16880
- const unknownAppManifest = await parseBaseExtensionManifest(extensionManifest);
16881
- unknownExtensions.push({
16882
- cwd: extensionPath,
16883
- manifest: unknownAppManifest
16884
- });
17768
+ const unknownManifest = await parseBaseExtensionManifest(extensionManifest);
17769
+ unknownComponents.push(
17770
+ UnknownComponent.Unknown({
17771
+ directory: componentPath,
17772
+ manifest: unknownManifest
17773
+ })
17774
+ );
16885
17775
  }
16886
17776
  return {
16887
17777
  appId,
17778
+ components,
16888
17779
  env: env2,
16889
- extensions,
16890
17780
  rootDir,
16891
- unknownExtensions
17781
+ unknownComponents
16892
17782
  };
16893
17783
  }
17784
+ function createComponent(manifest, directory) {
17785
+ switch (manifest.compType) {
17786
+ case "BACK_OFFICE_EXTENSION_MENU_ITEM":
17787
+ return Component.BackofficeExtensionMenuPlugin({
17788
+ directory,
17789
+ manifest
17790
+ });
17791
+ case "BACK_OFFICE_EXTENSION_WIDGET": {
17792
+ return Component.BackofficeExtensionWidget({
17793
+ directory,
17794
+ manifest
17795
+ });
17796
+ }
17797
+ case "BACK_OFFICE_MODAL": {
17798
+ return Component.BackofficeModal({
17799
+ directory,
17800
+ manifest
17801
+ });
17802
+ }
17803
+ case "BACK_OFFICE_PAGE": {
17804
+ return Component.BackofficePage({
17805
+ directory,
17806
+ manifest
17807
+ });
17808
+ }
17809
+ case "ECOM_ADDITIONAL_FEES": {
17810
+ return Component.EcomAdditionalFees({
17811
+ directory,
17812
+ manifest
17813
+ });
17814
+ }
17815
+ case "ECOM_DISCOUNTS_TRIGGER": {
17816
+ return Component.EcomDiscountsTrigger({
17817
+ directory,
17818
+ manifest
17819
+ });
17820
+ }
17821
+ case "ECOM_PAYMENT_SETTINGS": {
17822
+ return Component.EcomPaymentSettings({
17823
+ directory,
17824
+ manifest
17825
+ });
17826
+ }
17827
+ case "ECOM_SHIPPING_RATES": {
17828
+ return Component.EcomShippingRates({
17829
+ directory,
17830
+ manifest
17831
+ });
17832
+ }
17833
+ case "ECOM_VALIDATIONS": {
17834
+ return Component.EcomValidations({
17835
+ directory,
17836
+ manifest
17837
+ });
17838
+ }
17839
+ case "GIFT_CARDS_PROVIDER": {
17840
+ return Component.EcomGiftCardsProvider({
17841
+ directory,
17842
+ manifest
17843
+ });
17844
+ }
17845
+ case "WEBHOOK": {
17846
+ return Component.Webhook({
17847
+ directory,
17848
+ manifest
17849
+ });
17850
+ }
17851
+ }
17852
+ }
16894
17853
  async function parseKnownExtensionManifest(extensionManifest) {
16895
- const appManifestResult = componentSchema.safeParse(extensionManifest);
17854
+ const appManifestResult = devCenterComponentSchema.safeParse(extensionManifest);
16896
17855
  if (appManifestResult.error) {
16897
17856
  return null;
16898
17857
  }
16899
17858
  return appManifestResult.data;
16900
17859
  }
16901
17860
  async function parseBaseExtensionManifest(extensionManifest) {
16902
- const appManifestResult = baseComponentSchema.safeParse(extensionManifest);
17861
+ const appManifestResult = baseDevCenterComponentSchema.safeParse(extensionManifest);
16903
17862
  if (!appManifestResult.success) {
16904
17863
  throw new Error(defaultOutdent`
16905
17864
  Invalid extension configuration:
@@ -16920,21 +17879,10 @@ async function readExtensionManifest(directoryPath) {
16920
17879
  // src/utils/generateAppManifest.ts
16921
17880
  init_esm_shims();
16922
17881
  function generateAppManifest(model) {
16923
- const extensions = model.extensions.map((extension) => extension.manifest).map((manifest) => {
17882
+ const extensions = model.components.map((component) => component.manifest).map((manifest) => {
16924
17883
  switch (manifest.compType) {
16925
17884
  case "BACK_OFFICE_EXTENSION_MENU_ITEM":
16926
- if (manifest.compData.backOfficeExtensionMenuItem.iframeUrl) {
16927
- return manifest;
16928
- }
16929
- return {
16930
- ...manifest,
16931
- compData: {
16932
- backOfficeExtensionMenuItem: {
16933
- ...manifest.compData.backOfficeExtensionMenuItem,
16934
- iframeUrl: `_wix/extensions/backoffice/${manifest.compId}`
16935
- }
16936
- }
16937
- };
17885
+ return manifest;
16938
17886
  case "BACK_OFFICE_EXTENSION_WIDGET":
16939
17887
  if (manifest.compData.backOfficeExtensionWidget.iframeUrl) {
16940
17888
  return manifest;
@@ -17069,8 +18017,8 @@ function generateAppManifest(model) {
17069
18017
  return manifest;
17070
18018
  }
17071
18019
  });
17072
- const unknownExtensions = model.unknownExtensions.map(
17073
- (extension) => extension.manifest
18020
+ const unknownExtensions = model.unknownComponents.map(
18021
+ (component) => component.manifest
17074
18022
  );
17075
18023
  return {
17076
18024
  appId: model.appId,
@@ -17081,30 +18029,34 @@ function generateAppManifest(model) {
17081
18029
  // src/utils/isValidBackofficeComponent.ts
17082
18030
  init_esm_shims();
17083
18031
  function isValidBackofficeComponent(component) {
17084
- return component.compType === "BACK_OFFICE_PAGE" && !component.compData.backOfficePage.iframeUrl || component.compType === "BACK_OFFICE_EXTENSION_WIDGET" && !component.compData.backOfficeExtensionWidget.iframeUrl || component.compType === "BACK_OFFICE_EXTENSION_MENU_ITEM" && !component.compData.backOfficeExtensionMenuItem.iframeUrl || component.compType === "BACK_OFFICE_MODAL" && !component.compData.backOfficeModal.iframeUrl;
18032
+ return component.type === "BackofficePage" && !component.manifest.compData.backOfficePage.iframeUrl || component.type === "BackofficeExtensionWidget" && !component.manifest.compData.backOfficeExtensionWidget.iframeUrl || component.type === "BackofficeModal" && !component.manifest.compData.backOfficeModal.iframeUrl;
17085
18033
  }
17086
18034
 
17087
18035
  // src/utils/isValidServicePluginComponent.ts
17088
18036
  init_esm_shims();
17089
18037
  function isValidServicePluginComponent(component) {
17090
- return component.compType === "ECOM_SHIPPING_RATES" && !component.compData.ecomShippingRates.deploymentUri || component.compType === "ECOM_ADDITIONAL_FEES" && !component.compData.ecomAdditionalFees.deploymentUri || component.compType === "ECOM_DISCOUNTS_TRIGGER" && !component.compData.ecomDiscountsTrigger.deploymentUri || component.compType === "ECOM_VALIDATIONS" && !component.compData.ecomValidations.deploymentUri || component.compType === "ECOM_PAYMENT_SETTINGS" && !component.compData.ecomPaymentSettings.deploymentUri || component.compType === "GIFT_CARDS_PROVIDER" && !component.compData.giftCardsProvider.deploymentUri;
18038
+ return component.type === "EcomShippingRates" && !component.manifest.compData.ecomShippingRates.deploymentUri || component.type === "EcomAdditionalFees" && !component.manifest.compData.ecomAdditionalFees.deploymentUri || component.type === "EcomDiscountsTrigger" && !component.manifest.compData.ecomDiscountsTrigger.deploymentUri || component.type === "EcomValidations" && !component.manifest.compData.ecomValidations.deploymentUri || component.type === "EcomPaymentSettings" && !component.manifest.compData.ecomPaymentSettings.deploymentUri || component.type === "EcomGiftCardsProvider" && !component.manifest.compData.giftCardsProvider.deploymentUri;
17091
18039
  }
17092
18040
 
17093
18041
  // src/utils/isValidWebhookComponent.ts
17094
18042
  init_esm_shims();
17095
18043
  function isValidWebhookComponent(component) {
17096
- return component.compType === "WEBHOOK" && !component.compData.webhook.callbackUrl;
18044
+ return component.type === "Webhook" && !component.manifest.compData.webhook.callbackUrl;
17097
18045
  }
17098
18046
 
17099
18047
  // src/utils/resolveBuildMetadata.ts
17100
18048
  init_esm_shims();
18049
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
17101
18050
  async function resolveBuildMetadata(appManifestPath, config) {
17102
- const clientDir = await pathExists(config.build.client.pathname) ? config.build.client.pathname : config.outDir.pathname;
17103
- const serverDir = await pathExists(config.build.server.pathname) ? config.build.server.pathname : void 0;
18051
+ const outDir = fileURLToPath2(config.outDir);
18052
+ const buildClientDir = fileURLToPath2(config.build.client);
18053
+ const buildServerDir = fileURLToPath2(config.build.server);
18054
+ const clientDir = await pathExists(buildClientDir) ? buildClientDir : outDir;
18055
+ const serverDir = await pathExists(buildServerDir) ? buildServerDir : void 0;
17104
18056
  return {
17105
18057
  appManifestPath,
17106
18058
  clientDir,
17107
- outDir: config.outDir.pathname,
18059
+ outDir,
17108
18060
  serverDir
17109
18061
  };
17110
18062
  }
@@ -17113,32 +18065,30 @@ async function resolveBuildMetadata(appManifestPath, config) {
17113
18065
  init_esm_shims();
17114
18066
  import { rm, writeFile as writeFile2 } from "node:fs/promises";
17115
18067
  import { join as join3, resolve } from "node:path";
18068
+ var import_variant2 = __toESM(require_lib(), 1);
17116
18069
  async function writeVirtualBackofficeExtensionFiles(model, codegenDir) {
17117
- const backofficeExtensions = model.extensions.filter(
17118
- (extension) => isValidBackofficeComponent(extension.manifest)
18070
+ const backofficeComponents = model.components.filter(
18071
+ isValidBackofficeComponent
17119
18072
  );
17120
18073
  const existingFiles = await globby(`*.astro`, {
17121
18074
  cwd: codegenDir,
17122
18075
  onlyFiles: true
17123
18076
  });
17124
18077
  for (const filename of existingFiles) {
17125
- const hasMatchingSourceFile = backofficeExtensions.some(
17126
- (extension) => `${extension.manifest.compId}.astro` === filename
18078
+ const hasMatchingSourceFile = backofficeComponents.some(
18079
+ (component) => `${component.manifest.compId}.astro` === filename
17127
18080
  );
17128
18081
  if (hasMatchingSourceFile) {
17129
18082
  continue;
17130
18083
  }
17131
18084
  await rm(join3(codegenDir, filename));
17132
18085
  }
17133
- for (const extension of backofficeExtensions) {
17134
- const originalEntrypoint = resolve(
17135
- model.rootDir,
17136
- extension.cwd,
17137
- "page.tsx"
17138
- );
18086
+ for (const component of backofficeComponents) {
18087
+ const entryFilename = resolveEntry(component);
18088
+ const originalEntrypoint = resolve(model.rootDir, entryFilename);
17139
18089
  const virtualEntrypoint = join3(
17140
18090
  codegenDir,
17141
- `${extension.manifest.compId}.astro`
18091
+ `${component.manifest.compId}.astro`
17142
18092
  );
17143
18093
  await writeFile2(
17144
18094
  virtualEntrypoint,
@@ -17154,33 +18104,41 @@ async function writeVirtualBackofficeExtensionFiles(model, codegenDir) {
17154
18104
  );
17155
18105
  }
17156
18106
  }
18107
+ function resolveEntry(component) {
18108
+ const entryName = (0, import_variant2.match)(component, {
18109
+ BackofficeExtensionWidget: () => "widget.tsx",
18110
+ BackofficeModal: () => "modal.tsx",
18111
+ BackofficePage: () => "page.tsx"
18112
+ });
18113
+ return join3(component.directory, entryName);
18114
+ }
17157
18115
 
17158
18116
  // src/utils/writeVirtualServicePluginExtensionFiles.ts
17159
18117
  init_esm_shims();
17160
18118
  import { rm as rm2, writeFile as writeFile3 } from "node:fs/promises";
17161
18119
  import { join as join4, resolve as resolve2 } from "node:path";
17162
18120
  async function writeVirtualServicePluginExtensionFiles(model, codegenDir) {
17163
- const servicePluginExtensions = model.extensions.filter(
17164
- (extension) => isValidServicePluginComponent(extension.manifest)
18121
+ const servicePluginComponents = model.components.filter(
18122
+ isValidServicePluginComponent
17165
18123
  );
17166
18124
  const existingFiles = await globby(`*.ts`, {
17167
18125
  cwd: codegenDir,
17168
18126
  onlyFiles: true
17169
18127
  });
17170
18128
  for (const filename of existingFiles) {
17171
- const hasMatchingSourceFile = servicePluginExtensions.some(
17172
- (extension) => `${extension.manifest.compId}.ts` === filename
18129
+ const hasMatchingSourceFile = servicePluginComponents.some(
18130
+ (component) => `${component.manifest.compId}.ts` === filename
17173
18131
  );
17174
18132
  if (hasMatchingSourceFile) {
17175
18133
  continue;
17176
18134
  }
17177
18135
  await rm2(join4(codegenDir, filename));
17178
18136
  }
17179
- for (const extension of servicePluginExtensions) {
17180
- const originalEntrypoint = resolve2(extension.cwd, "plugin.ts");
18137
+ for (const component of servicePluginComponents) {
18138
+ const originalEntrypoint = resolve2(component.directory, "plugin.ts");
17181
18139
  const virtualEntrypoint = join4(
17182
18140
  codegenDir,
17183
- `${extension.manifest.compId}.ts`
18141
+ `${component.manifest.compId}.ts`
17184
18142
  );
17185
18143
  await writeFile3(
17186
18144
  virtualEntrypoint,
@@ -17221,27 +18179,25 @@ init_esm_shims();
17221
18179
  import { rm as rm3, writeFile as writeFile4 } from "node:fs/promises";
17222
18180
  import { join as join5, resolve as resolve3 } from "node:path";
17223
18181
  async function writeVirtualWebhookExtensionFiles(model, codegenDir) {
17224
- const webhookExtensions = model.extensions.filter(
17225
- (extension) => isValidWebhookComponent(extension.manifest)
17226
- );
18182
+ const webhookComponents = model.components.filter(isValidWebhookComponent);
17227
18183
  const existingFiles = await globby(`*.ts`, {
17228
18184
  cwd: codegenDir,
17229
18185
  onlyFiles: true
17230
18186
  });
17231
18187
  for (const filename of existingFiles) {
17232
- const hasMatchingSourceFile = webhookExtensions.some(
17233
- (extension) => `${extension.manifest.compId}.ts` === filename
18188
+ const hasMatchingSourceFile = webhookComponents.some(
18189
+ (component) => `${component.manifest.compId}.ts` === filename
17234
18190
  );
17235
18191
  if (hasMatchingSourceFile) {
17236
18192
  continue;
17237
18193
  }
17238
18194
  await rm3(join5(codegenDir, filename));
17239
18195
  }
17240
- for (const extension of webhookExtensions) {
17241
- const originalEntrypoint = resolve3(extension.cwd, "event.ts");
18196
+ for (const component of webhookComponents) {
18197
+ const originalEntrypoint = resolve3(component.directory, "event.ts");
17242
18198
  const virtualEntrypoint = join5(
17243
18199
  codegenDir,
17244
- `${extension.manifest.compId}.ts`
18200
+ `${component.manifest.compId}.ts`
17245
18201
  );
17246
18202
  await writeFile4(
17247
18203
  virtualEntrypoint,
@@ -17287,13 +18243,12 @@ var createIntegration = () => {
17287
18243
  async "astro:build:done"({ logger }) {
17288
18244
  model ??= await createProjectModel(logger);
17289
18245
  const appManifest = generateAppManifest(model);
17290
- const appManifestPath = join6(
17291
- _config.outDir.pathname,
17292
- "_wix/app-manifest.json"
17293
- );
18246
+ const outDir = fileURLToPath3(_config.outDir);
18247
+ const rootDir = fileURLToPath3(_config.outDir);
18248
+ const appManifestPath = join6(outDir, "_wix/app-manifest.json");
17294
18249
  await writeJson(appManifestPath, appManifest, { spaces: 2 });
17295
18250
  await writeJson(
17296
- join6(_config.root.pathname, GIT_IGNORED_DIR, "build-metadata.json"),
18251
+ join6(rootDir, GIT_IGNORED_DIR, "build-metadata.json"),
17297
18252
  await resolveBuildMetadata(appManifestPath, _config),
17298
18253
  { spaces: 2 }
17299
18254
  );
@@ -17311,7 +18266,9 @@ var createIntegration = () => {
17311
18266
  logger,
17312
18267
  updateConfig
17313
18268
  }) {
17314
- const { pathname: codegenDir } = createCodegenDir();
18269
+ const codegenDirURL = createCodegenDir();
18270
+ const codegenDir = fileURLToPath3(codegenDirURL);
18271
+ const rootDir = fileURLToPath3(config.outDir);
17315
18272
  model ??= await createProjectModel(logger);
17316
18273
  injectScript(
17317
18274
  "before-hydration",
@@ -17416,7 +18373,7 @@ var createIntegration = () => {
17416
18373
  prerender: false
17417
18374
  });
17418
18375
  import_chokidar.default.watch([EXTENSIONS_DIR], {
17419
- cwd: config.root.pathname,
18376
+ cwd: rootDir,
17420
18377
  ignoreInitial: true,
17421
18378
  useFsEvents: false
17422
18379
  }).on("all", async () => {
@@ -17424,17 +18381,17 @@ var createIntegration = () => {
17424
18381
  await writeVirtualWebhookExtensionFiles(model, webhookCodegenDir);
17425
18382
  });
17426
18383
  } else {
17427
- const webhookExtensions = model.extensions.filter(
17428
- (extension) => isValidWebhookComponent(extension.manifest)
18384
+ const webhookComponents = model.components.filter(
18385
+ isValidWebhookComponent
17429
18386
  );
17430
- for (const extension of webhookExtensions) {
18387
+ for (const component of webhookComponents) {
17431
18388
  const virtualEntrypoint = join6(
17432
18389
  webhookCodegenDir,
17433
- `${extension.manifest.compId}.ts`
18390
+ `${component.manifest.compId}.ts`
17434
18391
  );
17435
18392
  injectRoute({
17436
18393
  entrypoint: virtualEntrypoint,
17437
- pattern: `/_wix/extensions/webhooks/${extension.manifest.compId}`
18394
+ pattern: `/_wix/extensions/webhooks/${component.manifest.compId}`
17438
18395
  });
17439
18396
  }
17440
18397
  }
@@ -17454,7 +18411,7 @@ var createIntegration = () => {
17454
18411
  prerender: false
17455
18412
  });
17456
18413
  import_chokidar.default.watch([EXTENSIONS_DIR], {
17457
- cwd: config.root.pathname,
18414
+ cwd: rootDir,
17458
18415
  ignoreInitial: true,
17459
18416
  useFsEvents: false
17460
18417
  }).on("all", async () => {
@@ -17465,17 +18422,17 @@ var createIntegration = () => {
17465
18422
  );
17466
18423
  });
17467
18424
  } else {
17468
- const servicePluginExtensions = model.extensions.filter(
17469
- (extension) => isValidServicePluginComponent(extension.manifest)
18425
+ const servicePluginComponents = model.components.filter(
18426
+ isValidServicePluginComponent
17470
18427
  );
17471
- for (const extension of servicePluginExtensions) {
18428
+ for (const component of servicePluginComponents) {
17472
18429
  const virtualEntrypoint = join6(
17473
18430
  servicePluginCodegenDir,
17474
- `${extension.manifest.compId}.ts`
18431
+ `${component.manifest.compId}.ts`
17475
18432
  );
17476
18433
  injectRoute({
17477
18434
  entrypoint: virtualEntrypoint,
17478
- pattern: `/_wix/extensions/service-plugins/${extension.manifest.compId}`
18435
+ pattern: `/_wix/extensions/service-plugins/${component.manifest.compId}`
17479
18436
  });
17480
18437
  }
17481
18438
  }
@@ -17492,7 +18449,7 @@ var createIntegration = () => {
17492
18449
  prerender: false
17493
18450
  });
17494
18451
  import_chokidar.default.watch([EXTENSIONS_DIR], {
17495
- cwd: config.root.pathname,
18452
+ cwd: rootDir,
17496
18453
  ignoreInitial: true,
17497
18454
  useFsEvents: false
17498
18455
  }).on("all", async () => {
@@ -17503,17 +18460,17 @@ var createIntegration = () => {
17503
18460
  );
17504
18461
  });
17505
18462
  } else {
17506
- const backofficeExtensions = model.extensions.filter(
17507
- (extension) => isValidBackofficeComponent(extension.manifest)
18463
+ const backofficeComponents = model.components.filter(
18464
+ isValidBackofficeComponent
17508
18465
  );
17509
- for (const extension of backofficeExtensions) {
18466
+ for (const component of backofficeComponents) {
17510
18467
  const virtualEntrypoint = join6(
17511
18468
  backofficeCodegenDir,
17512
- `${extension.manifest.compId}.astro`
18469
+ `${component.manifest.compId}.astro`
17513
18470
  );
17514
18471
  injectRoute({
17515
18472
  entrypoint: virtualEntrypoint,
17516
- pattern: `/_wix/extensions/backoffice/${extension.manifest.compId}`
18473
+ pattern: `/_wix/extensions/backoffice/${component.manifest.compId}`
17517
18474
  });
17518
18475
  }
17519
18476
  }