@ggui-ai/ui-gen 0.6.0 → 0.6.1

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/dist/index.js CHANGED
@@ -6117,7 +6117,7 @@ var init_cost_tracker = __esm({
6117
6117
 
6118
6118
  // ../../node_modules/ms/index.js
6119
6119
  var require_ms = __commonJS({
6120
- "../../node_modules/ms/index.js"(exports$1, module) {
6120
+ "../../node_modules/ms/index.js"(exports, module) {
6121
6121
  var s = 1e3;
6122
6122
  var m = s * 60;
6123
6123
  var h = m * 60;
@@ -6233,7 +6233,7 @@ var require_ms = __commonJS({
6233
6233
 
6234
6234
  // ../../node_modules/debug/src/common.js
6235
6235
  var require_common = __commonJS({
6236
- "../../node_modules/debug/src/common.js"(exports$1, module) {
6236
+ "../../node_modules/debug/src/common.js"(exports, module) {
6237
6237
  function setup(env) {
6238
6238
  createDebug.debug = createDebug;
6239
6239
  createDebug.default = createDebug;
@@ -6410,13 +6410,13 @@ var require_common = __commonJS({
6410
6410
 
6411
6411
  // ../../node_modules/debug/src/browser.js
6412
6412
  var require_browser = __commonJS({
6413
- "../../node_modules/debug/src/browser.js"(exports$1, module) {
6414
- exports$1.formatArgs = formatArgs;
6415
- exports$1.save = save;
6416
- exports$1.load = load;
6417
- exports$1.useColors = useColors;
6418
- exports$1.storage = localstorage();
6419
- exports$1.destroy = /* @__PURE__ */ (() => {
6413
+ "../../node_modules/debug/src/browser.js"(exports, module) {
6414
+ exports.formatArgs = formatArgs;
6415
+ exports.save = save;
6416
+ exports.load = load;
6417
+ exports.useColors = useColors;
6418
+ exports.storage = localstorage();
6419
+ exports.destroy = /* @__PURE__ */ (() => {
6420
6420
  let warned = false;
6421
6421
  return () => {
6422
6422
  if (!warned) {
@@ -6425,7 +6425,7 @@ var require_browser = __commonJS({
6425
6425
  }
6426
6426
  };
6427
6427
  })();
6428
- exports$1.colors = [
6428
+ exports.colors = [
6429
6429
  "#0000CC",
6430
6430
  "#0000FF",
6431
6431
  "#0033CC",
@@ -6537,14 +6537,14 @@ var require_browser = __commonJS({
6537
6537
  });
6538
6538
  args.splice(lastC, 0, c);
6539
6539
  }
6540
- exports$1.log = console.debug || console.log || (() => {
6540
+ exports.log = console.debug || console.log || (() => {
6541
6541
  });
6542
6542
  function save(namespaces) {
6543
6543
  try {
6544
6544
  if (namespaces) {
6545
- exports$1.storage.setItem("debug", namespaces);
6545
+ exports.storage.setItem("debug", namespaces);
6546
6546
  } else {
6547
- exports$1.storage.removeItem("debug");
6547
+ exports.storage.removeItem("debug");
6548
6548
  }
6549
6549
  } catch (error) {
6550
6550
  }
@@ -6552,7 +6552,7 @@ var require_browser = __commonJS({
6552
6552
  function load() {
6553
6553
  let r;
6554
6554
  try {
6555
- r = exports$1.storage.getItem("debug") || exports$1.storage.getItem("DEBUG");
6555
+ r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
6556
6556
  } catch (error) {
6557
6557
  }
6558
6558
  if (!r && typeof process !== "undefined" && "env" in process) {
@@ -6566,7 +6566,7 @@ var require_browser = __commonJS({
6566
6566
  } catch (error) {
6567
6567
  }
6568
6568
  }
6569
- module.exports = require_common()(exports$1);
6569
+ module.exports = require_common()(exports);
6570
6570
  var { formatters } = module.exports;
6571
6571
  formatters.j = function(v) {
6572
6572
  try {
@@ -6580,7 +6580,7 @@ var require_browser = __commonJS({
6580
6580
 
6581
6581
  // ../../node_modules/has-flag/index.js
6582
6582
  var require_has_flag = __commonJS({
6583
- "../../node_modules/has-flag/index.js"(exports$1, module) {
6583
+ "../../node_modules/has-flag/index.js"(exports, module) {
6584
6584
  module.exports = (flag, argv = process.argv) => {
6585
6585
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
6586
6586
  const position = argv.indexOf(prefix + flag);
@@ -6592,7 +6592,7 @@ var require_has_flag = __commonJS({
6592
6592
 
6593
6593
  // ../../node_modules/supports-color/index.js
6594
6594
  var require_supports_color = __commonJS({
6595
- "../../node_modules/supports-color/index.js"(exports$1, module) {
6595
+ "../../node_modules/supports-color/index.js"(exports, module) {
6596
6596
  var os = __require("os");
6597
6597
  var tty = __require("tty");
6598
6598
  var hasFlag = require_has_flag();
@@ -6693,25 +6693,25 @@ var require_supports_color = __commonJS({
6693
6693
 
6694
6694
  // ../../node_modules/debug/src/node.js
6695
6695
  var require_node = __commonJS({
6696
- "../../node_modules/debug/src/node.js"(exports$1, module) {
6696
+ "../../node_modules/debug/src/node.js"(exports, module) {
6697
6697
  var tty = __require("tty");
6698
6698
  var util = __require("util");
6699
- exports$1.init = init;
6700
- exports$1.log = log;
6701
- exports$1.formatArgs = formatArgs;
6702
- exports$1.save = save;
6703
- exports$1.load = load;
6704
- exports$1.useColors = useColors;
6705
- exports$1.destroy = util.deprecate(
6699
+ exports.init = init;
6700
+ exports.log = log;
6701
+ exports.formatArgs = formatArgs;
6702
+ exports.save = save;
6703
+ exports.load = load;
6704
+ exports.useColors = useColors;
6705
+ exports.destroy = util.deprecate(
6706
6706
  () => {
6707
6707
  },
6708
6708
  "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
6709
6709
  );
6710
- exports$1.colors = [6, 2, 3, 4, 5, 1];
6710
+ exports.colors = [6, 2, 3, 4, 5, 1];
6711
6711
  try {
6712
6712
  const supportsColor = require_supports_color();
6713
6713
  if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
6714
- exports$1.colors = [
6714
+ exports.colors = [
6715
6715
  20,
6716
6716
  21,
6717
6717
  26,
@@ -6792,7 +6792,7 @@ var require_node = __commonJS({
6792
6792
  }
6793
6793
  } catch (error) {
6794
6794
  }
6795
- exports$1.inspectOpts = Object.keys(process.env).filter((key) => {
6795
+ exports.inspectOpts = Object.keys(process.env).filter((key) => {
6796
6796
  return /^debug_/i.test(key);
6797
6797
  }).reduce((obj, key) => {
6798
6798
  const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
@@ -6812,7 +6812,7 @@ var require_node = __commonJS({
6812
6812
  return obj;
6813
6813
  }, {});
6814
6814
  function useColors() {
6815
- return "colors" in exports$1.inspectOpts ? Boolean(exports$1.inspectOpts.colors) : tty.isatty(process.stderr.fd);
6815
+ return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
6816
6816
  }
6817
6817
  function formatArgs(args) {
6818
6818
  const { namespace: name, useColors: useColors2 } = this;
@@ -6827,13 +6827,13 @@ var require_node = __commonJS({
6827
6827
  }
6828
6828
  }
6829
6829
  function getDate() {
6830
- if (exports$1.inspectOpts.hideDate) {
6830
+ if (exports.inspectOpts.hideDate) {
6831
6831
  return "";
6832
6832
  }
6833
6833
  return (/* @__PURE__ */ new Date()).toISOString() + " ";
6834
6834
  }
6835
6835
  function log(...args) {
6836
- return process.stderr.write(util.formatWithOptions(exports$1.inspectOpts, ...args) + "\n");
6836
+ return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
6837
6837
  }
6838
6838
  function save(namespaces) {
6839
6839
  if (namespaces) {
@@ -6847,12 +6847,12 @@ var require_node = __commonJS({
6847
6847
  }
6848
6848
  function init(debug) {
6849
6849
  debug.inspectOpts = {};
6850
- const keys = Object.keys(exports$1.inspectOpts);
6850
+ const keys = Object.keys(exports.inspectOpts);
6851
6851
  for (let i = 0; i < keys.length; i++) {
6852
- debug.inspectOpts[keys[i]] = exports$1.inspectOpts[keys[i]];
6852
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
6853
6853
  }
6854
6854
  }
6855
- module.exports = require_common()(exports$1);
6855
+ module.exports = require_common()(exports);
6856
6856
  var { formatters } = module.exports;
6857
6857
  formatters.o = function(v) {
6858
6858
  this.inspectOpts.colors = this.useColors;
@@ -6867,7 +6867,7 @@ var require_node = __commonJS({
6867
6867
 
6868
6868
  // ../../node_modules/debug/src/index.js
6869
6869
  var require_src = __commonJS({
6870
- "../../node_modules/debug/src/index.js"(exports$1, module) {
6870
+ "../../node_modules/debug/src/index.js"(exports, module) {
6871
6871
  if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
6872
6872
  module.exports = require_browser();
6873
6873
  } else {
@@ -6878,7 +6878,7 @@ var require_src = __commonJS({
6878
6878
 
6879
6879
  // ../../node_modules/follow-redirects/debug.js
6880
6880
  var require_debug = __commonJS({
6881
- "../../node_modules/follow-redirects/debug.js"(exports$1, module) {
6881
+ "../../node_modules/follow-redirects/debug.js"(exports, module) {
6882
6882
  var debug;
6883
6883
  module.exports = function() {
6884
6884
  if (!debug) {
@@ -6898,7 +6898,7 @@ var require_debug = __commonJS({
6898
6898
 
6899
6899
  // ../../node_modules/follow-redirects/index.js
6900
6900
  var require_follow_redirects = __commonJS({
6901
- "../../node_modules/follow-redirects/index.js"(exports$1, module) {
6901
+ "../../node_modules/follow-redirects/index.js"(exports, module) {
6902
6902
  var url = __require("url");
6903
6903
  var URL2 = url.URL;
6904
6904
  var http = __require("http");
@@ -7409,14 +7409,14 @@ var require_follow_redirects = __commonJS({
7409
7409
 
7410
7410
  // ../../node_modules/events-universal/default.js
7411
7411
  var require_default = __commonJS({
7412
- "../../node_modules/events-universal/default.js"(exports$1, module) {
7412
+ "../../node_modules/events-universal/default.js"(exports, module) {
7413
7413
  module.exports = __require("events");
7414
7414
  }
7415
7415
  });
7416
7416
 
7417
7417
  // ../../node_modules/fast-fifo/fixed-size.js
7418
7418
  var require_fixed_size = __commonJS({
7419
- "../../node_modules/fast-fifo/fixed-size.js"(exports$1, module) {
7419
+ "../../node_modules/fast-fifo/fixed-size.js"(exports, module) {
7420
7420
  module.exports = class FixedFIFO {
7421
7421
  constructor(hwm) {
7422
7422
  if (!(hwm > 0) || (hwm - 1 & hwm) !== 0) throw new Error("Max size for a FixedFIFO should be a power of two");
@@ -7456,7 +7456,7 @@ var require_fixed_size = __commonJS({
7456
7456
 
7457
7457
  // ../../node_modules/fast-fifo/index.js
7458
7458
  var require_fast_fifo = __commonJS({
7459
- "../../node_modules/fast-fifo/index.js"(exports$1, module) {
7459
+ "../../node_modules/fast-fifo/index.js"(exports, module) {
7460
7460
  var FixedFIFO = require_fixed_size();
7461
7461
  module.exports = class FastFIFO {
7462
7462
  constructor(hwm) {
@@ -7503,7 +7503,7 @@ var require_fast_fifo = __commonJS({
7503
7503
 
7504
7504
  // ../../node_modules/b4a/index.js
7505
7505
  var require_b4a = __commonJS({
7506
- "../../node_modules/b4a/index.js"(exports$1, module) {
7506
+ "../../node_modules/b4a/index.js"(exports, module) {
7507
7507
  function isBuffer(value) {
7508
7508
  return Buffer.isBuffer(value) || value instanceof Uint8Array;
7509
7509
  }
@@ -7660,7 +7660,7 @@ var require_b4a = __commonJS({
7660
7660
 
7661
7661
  // ../../node_modules/text-decoder/lib/pass-through-decoder.js
7662
7662
  var require_pass_through_decoder = __commonJS({
7663
- "../../node_modules/text-decoder/lib/pass-through-decoder.js"(exports$1, module) {
7663
+ "../../node_modules/text-decoder/lib/pass-through-decoder.js"(exports, module) {
7664
7664
  var b4a = require_b4a();
7665
7665
  module.exports = class PassThroughDecoder {
7666
7666
  constructor(encoding) {
@@ -7681,7 +7681,7 @@ var require_pass_through_decoder = __commonJS({
7681
7681
 
7682
7682
  // ../../node_modules/text-decoder/lib/utf8-decoder.js
7683
7683
  var require_utf8_decoder = __commonJS({
7684
- "../../node_modules/text-decoder/lib/utf8-decoder.js"(exports$1, module) {
7684
+ "../../node_modules/text-decoder/lib/utf8-decoder.js"(exports, module) {
7685
7685
  var b4a = require_b4a();
7686
7686
  module.exports = class UTF8Decoder {
7687
7687
  constructor() {
@@ -7828,7 +7828,7 @@ var require_utf8_decoder = __commonJS({
7828
7828
 
7829
7829
  // ../../node_modules/text-decoder/index.js
7830
7830
  var require_text_decoder = __commonJS({
7831
- "../../node_modules/text-decoder/index.js"(exports$1, module) {
7831
+ "../../node_modules/text-decoder/index.js"(exports, module) {
7832
7832
  var PassThroughDecoder = require_pass_through_decoder();
7833
7833
  var UTF8Decoder = require_utf8_decoder();
7834
7834
  module.exports = class TextDecoder {
@@ -7888,14 +7888,55 @@ var require_text_decoder = __commonJS({
7888
7888
  }
7889
7889
  });
7890
7890
 
7891
+ // ../../node_modules/streamx/lib/errors.js
7892
+ var require_errors = __commonJS({
7893
+ "../../node_modules/streamx/lib/errors.js"(exports, module) {
7894
+ module.exports = class StreamError extends Error {
7895
+ constructor(msg, code, fn = StreamError) {
7896
+ super(msg);
7897
+ this.code = code;
7898
+ if (Error.captureStackTrace) {
7899
+ Error.captureStackTrace(this, fn);
7900
+ }
7901
+ }
7902
+ static isStreamDestroyed(err) {
7903
+ return err && err.code === "STREAM_DESTROYED";
7904
+ }
7905
+ static isPrematureClose(err) {
7906
+ return err && err.code === "PREMATURE_CLOSE";
7907
+ }
7908
+ static isAborted(err) {
7909
+ return err && err.code === "ABORTED";
7910
+ }
7911
+ static isBadArgument(err) {
7912
+ return err && err.code === "BAD_ARGUMENT";
7913
+ }
7914
+ get name() {
7915
+ return "StreamError";
7916
+ }
7917
+ static STREAM_DESTROYED() {
7918
+ return new StreamError("Stream was destroyed", "STREAM_DESTROYED", StreamError.STREAM_DESTROYED);
7919
+ }
7920
+ static PREMATURE_CLOSE(msg = "Premature close") {
7921
+ return new StreamError(msg, "PREMATURE_CLOSE", StreamError.PREMATURE_CLOSE);
7922
+ }
7923
+ static ABORTED() {
7924
+ return new StreamError("Stream aborted", "ABORTED", StreamError.ABORTED);
7925
+ }
7926
+ static BAD_ARGUMENT(msg = "Bad argument") {
7927
+ return new StreamError(msg, "BAD_ARGUMENT", StreamError.BAD_ARGUMENT);
7928
+ }
7929
+ };
7930
+ }
7931
+ });
7932
+
7891
7933
  // ../../node_modules/streamx/index.js
7892
7934
  var require_streamx = __commonJS({
7893
- "../../node_modules/streamx/index.js"(exports$1, module) {
7935
+ "../../node_modules/streamx/index.js"(exports, module) {
7894
7936
  var { EventEmitter } = require_default();
7895
- var STREAM_DESTROYED = new Error("Stream was destroyed");
7896
- var PREMATURE_CLOSE = new Error("Premature close");
7897
7937
  var FIFO = require_fast_fifo();
7898
7938
  var TextDecoder2 = require_text_decoder();
7939
+ var StreamError = require_errors();
7899
7940
  var qmt = typeof queueMicrotask === "undefined" ? (fn) => global.process.nextTick(fn) : queueMicrotask;
7900
7941
  var MAX = (1 << 29) - 1;
7901
7942
  var OPENING = 1;
@@ -8023,8 +8064,11 @@ var require_streamx = __commonJS({
8023
8064
  return data;
8024
8065
  }
8025
8066
  end(data) {
8026
- if (typeof data === "function") this.stream.once("finish", data);
8027
- else if (data !== void 0 && data !== null) this.push(data);
8067
+ if (typeof data === "function") {
8068
+ this.stream.once("finish", data);
8069
+ } else if (data !== void 0 && data !== null) {
8070
+ this.push(data);
8071
+ }
8028
8072
  this.stream._duplexState = (this.stream._duplexState | WRITE_FINISHING) & WRITE_NON_PRIMARY;
8029
8073
  }
8030
8074
  autoBatch(data, cb) {
@@ -8075,8 +8119,11 @@ var require_streamx = __commonJS({
8075
8119
  return true;
8076
8120
  }
8077
8121
  updateCallback() {
8078
- if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY) this.update();
8079
- else this.updateNextTick();
8122
+ if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY) {
8123
+ this.update();
8124
+ } else {
8125
+ this.updateNextTick();
8126
+ }
8080
8127
  }
8081
8128
  updateNextTick() {
8082
8129
  if ((this.stream._duplexState & WRITE_NEXT_TICK) !== 0) return;
@@ -8106,7 +8153,7 @@ var require_streamx = __commonJS({
8106
8153
  return (this.stream._duplexState & READ_DONE) !== 0;
8107
8154
  }
8108
8155
  pipe(pipeTo, cb) {
8109
- if (this.pipeTo !== null) throw new Error("Can only pipe to one destination");
8156
+ if (this.pipeTo !== null) throw StreamError.BAD_ARGUMENT("Can only pipe to one destination");
8110
8157
  if (typeof cb !== "function") cb = null;
8111
8158
  this.stream._duplexState |= READ_PIPE_DRAINED;
8112
8159
  this.pipeTo = pipeTo;
@@ -8149,7 +8196,9 @@ var require_streamx = __commonJS({
8149
8196
  shift() {
8150
8197
  const data = this.queue.shift();
8151
8198
  this.buffered -= this.byteLength(data);
8152
- if (this.buffered === 0) this.stream._duplexState &= READ_NOT_QUEUED;
8199
+ if (this.buffered === 0) {
8200
+ this.stream._duplexState &= READ_NOT_QUEUED;
8201
+ }
8153
8202
  return data;
8154
8203
  }
8155
8204
  unshift(data) {
@@ -8166,9 +8215,12 @@ var require_streamx = __commonJS({
8166
8215
  const stream = this.stream;
8167
8216
  if ((stream._duplexState & READ_STATUS) === READ_QUEUED) {
8168
8217
  const data = this.shift();
8169
- if (this.pipeTo !== null && this.pipeTo.write(data) === false)
8218
+ if (this.pipeTo !== null && this.pipeTo.write(data) === false) {
8170
8219
  stream._duplexState &= READ_PIPE_NOT_DRAINED;
8171
- if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit("data", data);
8220
+ }
8221
+ if ((stream._duplexState & READ_EMIT_DATA) !== 0) {
8222
+ stream.emit("data", data);
8223
+ }
8172
8224
  return data;
8173
8225
  }
8174
8226
  if (this.readAhead === false) {
@@ -8181,9 +8233,12 @@ var require_streamx = __commonJS({
8181
8233
  const stream = this.stream;
8182
8234
  while ((stream._duplexState & READ_STATUS) === READ_QUEUED && (stream._duplexState & READ_FLOWING) !== 0) {
8183
8235
  const data = this.shift();
8184
- if (this.pipeTo !== null && this.pipeTo.write(data) === false)
8236
+ if (this.pipeTo !== null && this.pipeTo.write(data) === false) {
8185
8237
  stream._duplexState &= READ_PIPE_NOT_DRAINED;
8186
- if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit("data", data);
8238
+ }
8239
+ if ((stream._duplexState & READ_EMIT_DATA) !== 0) {
8240
+ stream.emit("data", data);
8241
+ }
8187
8242
  }
8188
8243
  }
8189
8244
  update() {
@@ -8200,7 +8255,9 @@ var require_streamx = __commonJS({
8200
8255
  stream._duplexState |= READ_EMITTED_READABLE;
8201
8256
  stream.emit("readable");
8202
8257
  }
8203
- if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0) this.updateNonPrimary();
8258
+ if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0) {
8259
+ this.updateNonPrimary();
8260
+ }
8204
8261
  } while (this.continueUpdate() === true);
8205
8262
  stream._duplexState &= READ_NOT_UPDATING;
8206
8263
  }
@@ -8209,8 +8266,12 @@ var require_streamx = __commonJS({
8209
8266
  if ((stream._duplexState & READ_ENDING_STATUS) === READ_ENDING) {
8210
8267
  stream._duplexState = (stream._duplexState | READ_DONE) & READ_NOT_ENDING;
8211
8268
  stream.emit("end");
8212
- if ((stream._duplexState & AUTO_DESTROY) === DONE) stream._duplexState |= DESTROYING;
8213
- if (this.pipeTo !== null) this.pipeTo.end();
8269
+ if ((stream._duplexState & AUTO_DESTROY) === DONE) {
8270
+ stream._duplexState |= DESTROYING;
8271
+ }
8272
+ if (this.pipeTo !== null) {
8273
+ this.pipeTo.end();
8274
+ }
8214
8275
  }
8215
8276
  if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) {
8216
8277
  if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) {
@@ -8230,8 +8291,11 @@ var require_streamx = __commonJS({
8230
8291
  return true;
8231
8292
  }
8232
8293
  updateCallback() {
8233
- if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY) this.update();
8234
- else this.updateNextTick();
8294
+ if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY) {
8295
+ this.update();
8296
+ } else {
8297
+ this.updateNextTick();
8298
+ }
8235
8299
  }
8236
8300
  updateNextTickIfOpen() {
8237
8301
  if ((this.stream._duplexState & READ_NEXT_TICK_OR_OPENING) !== 0) return;
@@ -8268,7 +8332,7 @@ var require_streamx = __commonJS({
8268
8332
  this.to = null;
8269
8333
  if (this.from !== null) {
8270
8334
  if ((this.from._duplexState & READ_DONE) === 0 || !this.pipeToFinished) {
8271
- this.from.destroy(this.error || new Error("Writable stream closed prematurely"));
8335
+ this.from.destroy(this.error || StreamError.PREMATURE_CLOSE("Writable stream closed"));
8272
8336
  }
8273
8337
  return;
8274
8338
  }
@@ -8277,7 +8341,7 @@ var require_streamx = __commonJS({
8277
8341
  this.from = null;
8278
8342
  if (this.to !== null) {
8279
8343
  if ((stream._duplexState & READ_DONE) === 0) {
8280
- this.to.destroy(this.error || new Error("Readable stream closed before ending"));
8344
+ this.to.destroy(this.error || StreamError.PREMATURE_CLOSE("Readable stream closed"));
8281
8345
  }
8282
8346
  return;
8283
8347
  }
@@ -8301,21 +8365,30 @@ var require_streamx = __commonJS({
8301
8365
  stream._duplexState |= DESTROYING;
8302
8366
  }
8303
8367
  stream._duplexState &= WRITE_NOT_FINISHING;
8304
- if ((stream._duplexState & WRITE_UPDATING) === 0) this.update();
8305
- else this.updateNextTick();
8368
+ if ((stream._duplexState & WRITE_UPDATING) === 0) {
8369
+ this.update();
8370
+ } else {
8371
+ this.updateNextTick();
8372
+ }
8306
8373
  }
8307
8374
  function afterDestroy(err) {
8308
8375
  const stream = this.stream;
8309
- if (!err && this.error !== STREAM_DESTROYED) err = this.error;
8376
+ if (!err && !StreamError.isStreamDestroyed(this.error)) err = this.error;
8310
8377
  if (err) stream.emit("error", err);
8311
8378
  stream._duplexState |= DESTROYED;
8312
8379
  stream.emit("close");
8313
8380
  const rs = stream._readableState;
8314
8381
  const ws = stream._writableState;
8315
- if (rs !== null && rs.pipeline !== null) rs.pipeline.done(stream, err);
8382
+ if (rs !== null && rs.pipeline !== null) {
8383
+ rs.pipeline.done(stream, err);
8384
+ }
8316
8385
  if (ws !== null) {
8317
- while (ws.drains !== null && ws.drains.length > 0) ws.drains.shift().resolve(false);
8318
- if (ws.pipeline !== null) ws.pipeline.done(stream, err);
8386
+ while (ws.drains !== null && ws.drains.length > 0) {
8387
+ ws.drains.shift().resolve(false);
8388
+ }
8389
+ if (ws.pipeline !== null) {
8390
+ ws.pipeline.done(stream, err);
8391
+ }
8319
8392
  }
8320
8393
  }
8321
8394
  function afterWrite(err) {
@@ -8334,8 +8407,9 @@ var require_streamx = __commonJS({
8334
8407
  function afterRead(err) {
8335
8408
  if (err) this.stream.destroy(err);
8336
8409
  this.stream._duplexState &= READ_NOT_ACTIVE;
8337
- if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0)
8410
+ if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0) {
8338
8411
  this.stream._duplexState &= READ_NO_READ_AHEAD;
8412
+ }
8339
8413
  this.updateCallback();
8340
8414
  }
8341
8415
  function updateReadNT() {
@@ -8362,8 +8436,12 @@ var require_streamx = __commonJS({
8362
8436
  const stream = this.stream;
8363
8437
  if (err) stream.destroy(err);
8364
8438
  if ((stream._duplexState & DESTROYING) === 0) {
8365
- if ((stream._duplexState & READ_PRIMARY_STATUS) === 0) stream._duplexState |= READ_PRIMARY;
8366
- if ((stream._duplexState & WRITE_PRIMARY_STATUS) === 0) stream._duplexState |= WRITE_PRIMARY;
8439
+ if ((stream._duplexState & READ_PRIMARY_STATUS) === 0) {
8440
+ stream._duplexState |= READ_PRIMARY;
8441
+ }
8442
+ if ((stream._duplexState & WRITE_PRIMARY_STATUS) === 0) {
8443
+ stream._duplexState |= WRITE_PRIMARY;
8444
+ }
8367
8445
  stream.emit("open");
8368
8446
  }
8369
8447
  stream._duplexState &= NOT_ACTIVE;
@@ -8406,9 +8484,7 @@ var require_streamx = __commonJS({
8406
8484
  if (opts.open) this._open = opts.open;
8407
8485
  if (opts.destroy) this._destroy = opts.destroy;
8408
8486
  if (opts.predestroy) this._predestroy = opts.predestroy;
8409
- if (opts.signal) {
8410
- opts.signal.addEventListener("abort", abort.bind(this));
8411
- }
8487
+ if (opts.signal) opts.signal.addEventListener("abort", abort.bind(this));
8412
8488
  }
8413
8489
  this.on("newListener", newListener);
8414
8490
  }
@@ -8434,7 +8510,7 @@ var require_streamx = __commonJS({
8434
8510
  }
8435
8511
  destroy(err) {
8436
8512
  if ((this._duplexState & DESTROY_STATUS) === 0) {
8437
- if (!err) err = STREAM_DESTROYED;
8513
+ if (!err) err = StreamError.STREAM_DESTROYED();
8438
8514
  this._duplexState = (this._duplexState | DESTROYING) & NON_PRIMARY;
8439
8515
  if (this._readableState !== null) {
8440
8516
  this._readableState.highWaterMark = 0;
@@ -8447,8 +8523,12 @@ var require_streamx = __commonJS({
8447
8523
  this._duplexState |= PREDESTROYING;
8448
8524
  this._predestroy();
8449
8525
  this._duplexState &= NOT_PREDESTROYING;
8450
- if (this._readableState !== null) this._readableState.updateNextTick();
8451
- if (this._writableState !== null) this._writableState.updateNextTick();
8526
+ if (this._readableState !== null) {
8527
+ this._readableState.updateNextTick();
8528
+ }
8529
+ if (this._writableState !== null) {
8530
+ this._writableState.updateNextTick();
8531
+ }
8452
8532
  }
8453
8533
  }
8454
8534
  };
@@ -8464,6 +8544,15 @@ var require_streamx = __commonJS({
8464
8544
  if (opts.encoding) this.setEncoding(opts.encoding);
8465
8545
  }
8466
8546
  }
8547
+ static deferred(fn, opts) {
8548
+ const out = new PassThrough(opts);
8549
+ fn().then((src) => {
8550
+ if (src === null) return out.end();
8551
+ if (out.destroying) return;
8552
+ pipeline(src, out, noop);
8553
+ }).catch((err) => out.destroy(err));
8554
+ return out;
8555
+ }
8467
8556
  setEncoding(encoding) {
8468
8557
  const dec = new TextDecoder2(encoding);
8469
8558
  const map = this._readableState.map || echo;
@@ -8581,10 +8670,13 @@ var require_streamx = __commonJS({
8581
8670
  }
8582
8671
  function ondata(data) {
8583
8672
  if (promiseReject === null) return;
8584
- if (error) promiseReject(error);
8585
- else if (data === null && (stream._duplexState & READ_DONE) === 0)
8586
- promiseReject(STREAM_DESTROYED);
8587
- else promiseResolve({ value: data, done: data === null });
8673
+ if (error) {
8674
+ promiseReject(error);
8675
+ } else if (data === null && (stream._duplexState & READ_DONE) === 0) {
8676
+ promiseReject(StreamError.STREAM_DESTROYED());
8677
+ } else {
8678
+ promiseResolve({ value: data, done: data === null });
8679
+ }
8588
8680
  promiseReject = promiseResolve = null;
8589
8681
  }
8590
8682
  function destroy(err) {
@@ -8753,7 +8845,7 @@ var require_streamx = __commonJS({
8753
8845
  function pipeline(stream, ...streams) {
8754
8846
  const all = Array.isArray(stream) ? [...stream, ...streams] : [stream, ...streams];
8755
8847
  const done = all.length && typeof all[all.length - 1] === "function" ? all.pop() : null;
8756
- if (all.length < 2) throw new Error("Pipeline requires at least 2 streams");
8848
+ if (all.length < 2) throw StreamError.BAD_ARGUMENT("Pipeline requires at least 2 streams");
8757
8849
  let src = all[0];
8758
8850
  let dest = null;
8759
8851
  let error = null;
@@ -8778,7 +8870,7 @@ var require_streamx = __commonJS({
8778
8870
  if (!autoDestroy) done(error);
8779
8871
  });
8780
8872
  if (autoDestroy) {
8781
- dest.on("close", () => done(error || (fin ? null : PREMATURE_CLOSE)));
8873
+ dest.on("close", () => done(error || (fin ? null : StreamError.PREMATURE_CLOSE())));
8782
8874
  }
8783
8875
  }
8784
8876
  return dest;
@@ -8786,8 +8878,12 @@ var require_streamx = __commonJS({
8786
8878
  s.on("error", onerror2);
8787
8879
  s.on("close", onclose);
8788
8880
  function onclose() {
8789
- if (s._readableState && !s._readableState.ended) return onerror2(PREMATURE_CLOSE);
8790
- if (wr && s._writableState && !s._writableState.ended) return onerror2(PREMATURE_CLOSE);
8881
+ if (s._readableState && !s._readableState.ended) {
8882
+ return onerror2(StreamError.PREMATURE_CLOSE());
8883
+ }
8884
+ if (wr && s._writableState && !s._writableState.ended) {
8885
+ return onerror2(StreamError.PREMATURE_CLOSE());
8886
+ }
8791
8887
  }
8792
8888
  }
8793
8889
  function onerror(err) {
@@ -8821,7 +8917,7 @@ var require_streamx = __commonJS({
8821
8917
  }
8822
8918
  function getStreamError(stream, opts = {}) {
8823
8919
  const err = stream._readableState && stream._readableState.error || stream._writableState && stream._writableState.error;
8824
- return !opts.all && err === STREAM_DESTROYED ? null : err;
8920
+ return !opts.all && StreamError.isStreamDestroyed(err) ? null : err;
8825
8921
  }
8826
8922
  function isReadStreamx(stream) {
8827
8923
  return isStreamx(stream) && stream.readable;
@@ -8838,7 +8934,7 @@ var require_streamx = __commonJS({
8838
8934
  function noop() {
8839
8935
  }
8840
8936
  function abort() {
8841
- this.destroy(new Error("Stream aborted."));
8937
+ this.destroy(StreamError.ABORTED());
8842
8938
  }
8843
8939
  function isWritev(s) {
8844
8940
  return s._writev !== Writable.prototype._writev && s._writev !== Duplex.prototype._writev;
@@ -8867,7 +8963,7 @@ var require_streamx = __commonJS({
8867
8963
 
8868
8964
  // ../../node_modules/tar-fs/node_modules/tar-stream/headers.js
8869
8965
  var require_headers = __commonJS({
8870
- "../../node_modules/tar-fs/node_modules/tar-stream/headers.js"(exports$1) {
8966
+ "../../node_modules/tar-fs/node_modules/tar-stream/headers.js"(exports) {
8871
8967
  var b4a = require_b4a();
8872
8968
  var ZEROS = "0000000000000000000";
8873
8969
  var SEVENS = "7777777777777777777";
@@ -8879,10 +8975,10 @@ var require_headers = __commonJS({
8879
8975
  var MASK = 4095;
8880
8976
  var MAGIC_OFFSET = 257;
8881
8977
  var VERSION_OFFSET = 263;
8882
- exports$1.decodeLongPath = function decodeLongPath(buf, encoding) {
8978
+ exports.decodeLongPath = function decodeLongPath(buf, encoding) {
8883
8979
  return decodeStr(buf, 0, buf.length, encoding);
8884
8980
  };
8885
- exports$1.encodePax = function encodePax(opts) {
8981
+ exports.encodePax = function encodePax(opts) {
8886
8982
  let result = "";
8887
8983
  if (opts.name) result += addLength(" path=" + opts.name + "\n");
8888
8984
  if (opts.linkname) result += addLength(" linkpath=" + opts.linkname + "\n");
@@ -8894,7 +8990,7 @@ var require_headers = __commonJS({
8894
8990
  }
8895
8991
  return b4a.from(result);
8896
8992
  };
8897
- exports$1.decodePax = function decodePax(buf) {
8993
+ exports.decodePax = function decodePax(buf) {
8898
8994
  const result = {};
8899
8995
  while (buf.length) {
8900
8996
  let i = 0;
@@ -8909,7 +9005,7 @@ var require_headers = __commonJS({
8909
9005
  }
8910
9006
  return result;
8911
9007
  };
8912
- exports$1.encode = function encode(opts) {
9008
+ exports.encode = function encode(opts) {
8913
9009
  const buf = b4a.alloc(512);
8914
9010
  let name = opts.name;
8915
9011
  let prefix = "";
@@ -8941,7 +9037,7 @@ var require_headers = __commonJS({
8941
9037
  b4a.write(buf, encodeOct(cksum(buf), 6), 148);
8942
9038
  return buf;
8943
9039
  };
8944
- exports$1.decode = function decode(buf, filenameEncoding, allowUnknownFormat) {
9040
+ exports.decode = function decode(buf, filenameEncoding, allowUnknownFormat) {
8945
9041
  let typeflag = buf[156] === 0 ? 0 : buf[156] - ZERO_OFFSET;
8946
9042
  let name = decodeStr(buf, 0, 100, filenameEncoding);
8947
9043
  const mode = decodeOct(buf, 100, 8);
@@ -9127,7 +9223,7 @@ var require_headers = __commonJS({
9127
9223
 
9128
9224
  // ../../node_modules/tar-fs/node_modules/tar-stream/extract.js
9129
9225
  var require_extract = __commonJS({
9130
- "../../node_modules/tar-fs/node_modules/tar-stream/extract.js"(exports$1, module) {
9226
+ "../../node_modules/tar-fs/node_modules/tar-stream/extract.js"(exports, module) {
9131
9227
  var { Writable, Readable, getStreamError } = require_streamx();
9132
9228
  var FIFO = require_fast_fifo();
9133
9229
  var b4a = require_b4a();
@@ -9461,7 +9557,7 @@ var require_extract = __commonJS({
9461
9557
 
9462
9558
  // ../../node_modules/tar-fs/node_modules/tar-stream/constants.js
9463
9559
  var require_constants = __commonJS({
9464
- "../../node_modules/tar-fs/node_modules/tar-stream/constants.js"(exports$1, module) {
9560
+ "../../node_modules/tar-fs/node_modules/tar-stream/constants.js"(exports, module) {
9465
9561
  var constants = {
9466
9562
  // just for envs without fs
9467
9563
  S_IFMT: 61440,
@@ -9481,7 +9577,7 @@ var require_constants = __commonJS({
9481
9577
 
9482
9578
  // ../../node_modules/tar-fs/node_modules/tar-stream/pack.js
9483
9579
  var require_pack = __commonJS({
9484
- "../../node_modules/tar-fs/node_modules/tar-stream/pack.js"(exports$1, module) {
9580
+ "../../node_modules/tar-fs/node_modules/tar-stream/pack.js"(exports, module) {
9485
9581
  var { Readable, Writable, getStreamError } = require_streamx();
9486
9582
  var b4a = require_b4a();
9487
9583
  var constants = require_constants();
@@ -9715,15 +9811,15 @@ var require_pack = __commonJS({
9715
9811
 
9716
9812
  // ../../node_modules/tar-fs/node_modules/tar-stream/index.js
9717
9813
  var require_tar_stream = __commonJS({
9718
- "../../node_modules/tar-fs/node_modules/tar-stream/index.js"(exports$1) {
9719
- exports$1.extract = require_extract();
9720
- exports$1.pack = require_pack();
9814
+ "../../node_modules/tar-fs/node_modules/tar-stream/index.js"(exports) {
9815
+ exports.extract = require_extract();
9816
+ exports.pack = require_pack();
9721
9817
  }
9722
9818
  });
9723
9819
 
9724
9820
  // ../../node_modules/wrappy/wrappy.js
9725
9821
  var require_wrappy = __commonJS({
9726
- "../../node_modules/wrappy/wrappy.js"(exports$1, module) {
9822
+ "../../node_modules/wrappy/wrappy.js"(exports, module) {
9727
9823
  module.exports = wrappy;
9728
9824
  function wrappy(fn, cb) {
9729
9825
  if (fn && cb) return wrappy(fn)(cb);
@@ -9753,7 +9849,7 @@ var require_wrappy = __commonJS({
9753
9849
 
9754
9850
  // ../../node_modules/once/once.js
9755
9851
  var require_once = __commonJS({
9756
- "../../node_modules/once/once.js"(exports$1, module) {
9852
+ "../../node_modules/once/once.js"(exports, module) {
9757
9853
  var wrappy = require_wrappy();
9758
9854
  module.exports = wrappy(once);
9759
9855
  module.exports.strict = wrappy(onceStrict);
@@ -9797,7 +9893,7 @@ var require_once = __commonJS({
9797
9893
 
9798
9894
  // ../../node_modules/end-of-stream/index.js
9799
9895
  var require_end_of_stream = __commonJS({
9800
- "../../node_modules/end-of-stream/index.js"(exports$1, module) {
9896
+ "../../node_modules/end-of-stream/index.js"(exports, module) {
9801
9897
  var once = require_once();
9802
9898
  var noop = function() {
9803
9899
  };
@@ -9880,7 +9976,7 @@ var require_end_of_stream = __commonJS({
9880
9976
 
9881
9977
  // ../../node_modules/pump/index.js
9882
9978
  var require_pump = __commonJS({
9883
- "../../node_modules/pump/index.js"(exports$1, module) {
9979
+ "../../node_modules/pump/index.js"(exports, module) {
9884
9980
  var once = require_once();
9885
9981
  var eos = require_end_of_stream();
9886
9982
  var fs2;
@@ -9955,13 +10051,13 @@ var require_pump = __commonJS({
9955
10051
 
9956
10052
  // ../../node_modules/tar-fs/index.js
9957
10053
  var require_tar_fs = __commonJS({
9958
- "../../node_modules/tar-fs/index.js"(exports$1) {
10054
+ "../../node_modules/tar-fs/index.js"(exports) {
9959
10055
  var tar = require_tar_stream();
9960
10056
  var pump = require_pump();
9961
10057
  var fs2 = __require("fs");
9962
10058
  var path2 = __require("path");
9963
10059
  var win32 = (global.Bare ? global.Bare.platform : process.platform) === "win32";
9964
- exports$1.pack = function pack(cwd, opts) {
10060
+ exports.pack = function pack(cwd, opts) {
9965
10061
  if (!cwd) cwd = ".";
9966
10062
  if (!opts) opts = {};
9967
10063
  const xfs = opts.fs || fs2;
@@ -10048,7 +10144,7 @@ var require_tar_fs = __commonJS({
10048
10144
  function processUmask() {
10049
10145
  return !global.Bare && process.umask ? process.umask() : 0;
10050
10146
  }
10051
- exports$1.extract = function extract3(cwd, opts) {
10147
+ exports.extract = function extract3(cwd, opts) {
10052
10148
  if (!cwd) cwd = ".";
10053
10149
  if (!opts) opts = {};
10054
10150
  cwd = path2.resolve(cwd);
@@ -10121,6 +10217,7 @@ var require_tar_fs = __commonJS({
10121
10217
  });
10122
10218
  function stat(err) {
10123
10219
  if (err) return next(err);
10220
+ if (path2.join(name, ".") === path2.join(cwd, ".")) return next();
10124
10221
  utimes(name, header, function(err2) {
10125
10222
  if (err2) return next(err2);
10126
10223
  if (win32) return next();
@@ -10131,7 +10228,7 @@ var require_tar_fs = __commonJS({
10131
10228
  if (win32) return next();
10132
10229
  xfs.unlink(name, function() {
10133
10230
  const dst = path2.resolve(path2.dirname(name), header.linkname);
10134
- if (!inCwd(dst) && validateSymLinks) return next(new Error(name + " is not a valid symlink"));
10231
+ if (!inCwd(dst) && (validateSymLinks || opts.strip)) return next(new Error(name + " is not a valid symlink"));
10135
10232
  validateNotSymlink(xfs, dst, path2.join(cwd, "."), function(err, valid) {
10136
10233
  if (err) return next(err);
10137
10234
  if (!valid && validateSymLinks) return next(new Error(name + " is not a valid symlink"));
@@ -10159,15 +10256,22 @@ var require_tar_fs = __commonJS({
10159
10256
  return dst === cwd || dst.startsWith(cwd + path2.sep);
10160
10257
  }
10161
10258
  function onfile() {
10162
- const ws = xfs.createWriteStream(name);
10163
- const rs = mapStream(stream, header);
10164
- ws.on("error", function(err) {
10165
- rs.destroy(err);
10259
+ xfs.lstat(name, function(err, st) {
10260
+ if (!err && st.isSymbolicLink()) return xfs.unlink(name, onwrite);
10261
+ onwrite();
10166
10262
  });
10167
- pump(rs, ws, function(err) {
10263
+ function onwrite(err) {
10168
10264
  if (err) return next(err);
10169
- ws.on("close", stat);
10170
- });
10265
+ const ws = xfs.createWriteStream(name);
10266
+ const rs = mapStream(stream, header);
10267
+ ws.on("error", function(err2) {
10268
+ rs.destroy(err2);
10269
+ });
10270
+ pump(rs, ws, function(err2) {
10271
+ if (err2) return next(err2);
10272
+ ws.on("close", stat);
10273
+ });
10274
+ }
10171
10275
  }
10172
10276
  }
10173
10277
  function utimesParent(name, cb) {
@@ -10190,7 +10294,7 @@ var require_tar_fs = __commonJS({
10190
10294
  const chmod = link ? xfs.lchmod : xfs.chmod;
10191
10295
  const chown = link ? xfs.lchown : xfs.chown;
10192
10296
  if (!chmod) return cb();
10193
- const mode = (header.mode | (header.type === "directory" ? dmode : fmode)) & umask;
10297
+ const mode = (header.mode | (header.type === "directory" ? dmode : fmode)) & umask & 511;
10194
10298
  if (chown && own) chown.call(xfs, name, header.uid, header.gid, onchown);
10195
10299
  else onchown(null);
10196
10300
  function onchown(err) {
@@ -10227,6 +10331,9 @@ var require_tar_fs = __commonJS({
10227
10331
  cb(null, false);
10228
10332
  });
10229
10333
  }
10334
+ function inside(root, name) {
10335
+ return name === root || name.startsWith(root + path2.sep);
10336
+ }
10230
10337
  function noop() {
10231
10338
  }
10232
10339
  function echo(name) {
@@ -10238,10 +10345,12 @@ var require_tar_fs = __commonJS({
10238
10345
  function statAll(fs3, stat, cwd, ignore, entries, sort) {
10239
10346
  if (!entries) entries = ["."];
10240
10347
  const queue = entries.slice(0);
10348
+ const root = path2.resolve(cwd);
10241
10349
  return function loop(callback) {
10242
10350
  if (!queue.length) return callback(null);
10243
10351
  const next = queue.shift();
10244
10352
  const nextAbs = path2.join(cwd, next);
10353
+ if (!inside(root, path2.resolve(cwd, next))) return callback(new Error(next + " is not a valid path"));
10245
10354
  stat.call(fs3, nextAbs, function(err, stat2) {
10246
10355
  if (err) return callback(entries.indexOf(next) === -1 && err.code === "ENOENT" ? null : err);
10247
10356
  if (!stat2.isDirectory()) return callback(null, next, stat2);