@clawos-dev/clawd 0.2.56 → 0.2.57

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.
Files changed (2) hide show
  1. package/dist/cli.cjs +772 -714
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -190,7 +190,7 @@ var init_util = __esm({
190
190
  "../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js"() {
191
191
  "use strict";
192
192
  (function(util2) {
193
- util2.assertEqual = (_) => {
193
+ util2.assertEqual = (_2) => {
194
194
  };
195
195
  function assertIs(_arg) {
196
196
  }
@@ -207,10 +207,10 @@ var init_util = __esm({
207
207
  return obj;
208
208
  };
209
209
  util2.getValidEnumValues = (obj) => {
210
- const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
210
+ const validKeys = util2.objectKeys(obj).filter((k2) => typeof obj[obj[k2]] !== "number");
211
211
  const filtered = {};
212
- for (const k of validKeys) {
213
- filtered[k] = obj[k];
212
+ for (const k2 of validKeys) {
213
+ filtered[k2] = obj[k2];
214
214
  }
215
215
  return util2.objectValues(filtered);
216
216
  };
@@ -240,7 +240,7 @@ var init_util = __esm({
240
240
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
241
241
  }
242
242
  util2.joinValues = joinValues;
243
- util2.jsonStringifyReplacer = (_, value) => {
243
+ util2.jsonStringifyReplacer = (_2, value) => {
244
244
  if (typeof value === "bigint") {
245
245
  return value.toString();
246
246
  }
@@ -615,7 +615,7 @@ var init_parseUtil = __esm({
615
615
  };
616
616
  }
617
617
  let errorMessage = "";
618
- const maps = errorMaps.filter((m) => !!m).slice().reverse();
618
+ const maps = errorMaps.filter((m2) => !!m2).slice().reverse();
619
619
  for (const map of maps) {
620
620
  errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
621
621
  }
@@ -831,17 +831,17 @@ function deepPartialify(schema) {
831
831
  return schema;
832
832
  }
833
833
  }
834
- function mergeValues(a, b) {
834
+ function mergeValues(a, b2) {
835
835
  const aType = getParsedType(a);
836
- const bType = getParsedType(b);
837
- if (a === b) {
836
+ const bType = getParsedType(b2);
837
+ if (a === b2) {
838
838
  return { valid: true, data: a };
839
839
  } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
840
- const bKeys = util.objectKeys(b);
840
+ const bKeys = util.objectKeys(b2);
841
841
  const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
842
- const newObj = { ...a, ...b };
842
+ const newObj = { ...a, ...b2 };
843
843
  for (const key of sharedKeys) {
844
- const sharedValue = mergeValues(a[key], b[key]);
844
+ const sharedValue = mergeValues(a[key], b2[key]);
845
845
  if (!sharedValue.valid) {
846
846
  return { valid: false };
847
847
  }
@@ -849,13 +849,13 @@ function mergeValues(a, b) {
849
849
  }
850
850
  return { valid: true, data: newObj };
851
851
  } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
852
- if (a.length !== b.length) {
852
+ if (a.length !== b2.length) {
853
853
  return { valid: false };
854
854
  }
855
855
  const newArray = [];
856
856
  for (let index = 0; index < a.length; index++) {
857
857
  const itemA = a[index];
858
- const itemB = b[index];
858
+ const itemB = b2[index];
859
859
  const sharedValue = mergeValues(itemA, itemB);
860
860
  if (!sharedValue.valid) {
861
861
  return { valid: false };
@@ -863,7 +863,7 @@ function mergeValues(a, b) {
863
863
  newArray.push(sharedValue.data);
864
864
  }
865
865
  return { valid: true, data: newArray };
866
- } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
866
+ } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b2) {
867
867
  return { valid: true, data: a };
868
868
  } else {
869
869
  return { valid: false };
@@ -877,9 +877,9 @@ function createZodEnum(values, params) {
877
877
  });
878
878
  }
879
879
  function cleanParams(params, data) {
880
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
881
- const p2 = typeof p === "string" ? { message: p } : p;
882
- return p2;
880
+ const p2 = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
881
+ const p22 = typeof p2 === "string" ? { message: p2 } : p2;
882
+ return p22;
883
883
  }
884
884
  function custom(check, _params = {}, fatal) {
885
885
  if (check)
@@ -4043,10 +4043,10 @@ var init_types = __esm({
4043
4043
  }
4044
4044
  }
4045
4045
  }
4046
- static create(a, b) {
4046
+ static create(a, b2) {
4047
4047
  return new _ZodPipeline({
4048
4048
  in: a,
4049
- out: b,
4049
+ out: b2,
4050
4050
  typeName: ZodFirstPartyTypeKind.ZodPipeline
4051
4051
  });
4052
4052
  }
@@ -5480,7 +5480,7 @@ var require_pino_std_serializers = __commonJS({
5480
5480
  var require_caller = __commonJS({
5481
5481
  "../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/caller.js"(exports2, module2) {
5482
5482
  "use strict";
5483
- function noOpPrepareStackTrace(_, stack) {
5483
+ function noOpPrepareStackTrace(_2, stack) {
5484
5484
  return stack;
5485
5485
  }
5486
5486
  module2.exports = function getCallers() {
@@ -6041,9 +6041,9 @@ var require_redaction = __commonJS({
6041
6041
  o[ns].push(...o[wildcardFirstSym] || []);
6042
6042
  }
6043
6043
  if (ns === wildcardFirstSym) {
6044
- Object.keys(o).forEach(function(k) {
6045
- if (o[k]) {
6046
- o[k].push(nextPath);
6044
+ Object.keys(o).forEach(function(k2) {
6045
+ if (o[k2]) {
6046
+ o[k2].push(nextPath);
6047
6047
  }
6048
6048
  });
6049
6049
  }
@@ -6056,15 +6056,15 @@ var require_redaction = __commonJS({
6056
6056
  const topCensor = (...args) => {
6057
6057
  return typeof censor === "function" ? serialize(censor(...args)) : serialize(censor);
6058
6058
  };
6059
- return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => {
6060
- if (shape[k] === null) {
6061
- o[k] = (value) => topCensor(value, [k]);
6059
+ return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k2) => {
6060
+ if (shape[k2] === null) {
6061
+ o[k2] = (value) => topCensor(value, [k2]);
6062
6062
  } else {
6063
6063
  const wrappedCensor = typeof censor === "function" ? (value, path27) => {
6064
- return censor(value, [k, ...path27]);
6064
+ return censor(value, [k2, ...path27]);
6065
6065
  } : censor;
6066
- o[k] = Redact({
6067
- paths: shape[k],
6066
+ o[k2] = Redact({
6067
+ paths: shape[k2],
6068
6068
  censor: wrappedCensor,
6069
6069
  serialize,
6070
6070
  strict,
@@ -7941,11 +7941,11 @@ var require_tools = __commonJS({
7941
7941
  function stringify(obj, stringifySafeFn) {
7942
7942
  try {
7943
7943
  return JSON.stringify(obj);
7944
- } catch (_) {
7944
+ } catch (_2) {
7945
7945
  try {
7946
7946
  const stringify2 = stringifySafeFn || this[stringifySafeSym];
7947
7947
  return stringify2(obj);
7948
- } catch (_2) {
7948
+ } catch (_3) {
7949
7949
  return '"[unable to serialize, circular reference is too complex to analyze]"';
7950
7950
  }
7951
7951
  }
@@ -8039,12 +8039,12 @@ var require_levels = __commonJS({
8039
8039
  debug: (hook) => genLog(DEFAULT_LEVELS.debug, hook),
8040
8040
  trace: (hook) => genLog(DEFAULT_LEVELS.trace, hook)
8041
8041
  };
8042
- var nums = Object.keys(DEFAULT_LEVELS).reduce((o, k) => {
8043
- o[DEFAULT_LEVELS[k]] = k;
8042
+ var nums = Object.keys(DEFAULT_LEVELS).reduce((o, k2) => {
8043
+ o[DEFAULT_LEVELS[k2]] = k2;
8044
8044
  return o;
8045
8045
  }, {});
8046
- var initialLsCache = Object.keys(nums).reduce((o, k) => {
8047
- o[k] = '{"level":' + Number(k);
8046
+ var initialLsCache = Object.keys(nums).reduce((o, k2) => {
8047
+ o[k2] = '{"level":' + Number(k2);
8048
8048
  return o;
8049
8049
  }, {});
8050
8050
  function genLsCache(instance) {
@@ -8124,8 +8124,8 @@ var require_levels = __commonJS({
8124
8124
  return levelComparison;
8125
8125
  }
8126
8126
  function mappings(customLevels = null, useOnlyCustomLevels = false) {
8127
- const customNums = customLevels ? Object.keys(customLevels).reduce((o, k) => {
8128
- o[customLevels[k]] = k;
8127
+ const customNums = customLevels ? Object.keys(customLevels).reduce((o, k2) => {
8128
+ o[customLevels[k2]] = k2;
8129
8129
  return o;
8130
8130
  }, {}) : null;
8131
8131
  const labels = Object.assign(
@@ -8163,11 +8163,11 @@ var require_levels = __commonJS({
8163
8163
  }
8164
8164
  function assertNoLevelCollisions(levels, customLevels) {
8165
8165
  const { labels, values } = levels;
8166
- for (const k in customLevels) {
8167
- if (k in values) {
8166
+ for (const k2 in customLevels) {
8167
+ if (k2 in values) {
8168
8168
  throw Error("levels cannot be overridden");
8169
8169
  }
8170
- if (customLevels[k] in labels) {
8170
+ if (customLevels[k2] in labels) {
8171
8171
  throw Error("pre-existing level values cannot be used for new levels");
8172
8172
  }
8173
8173
  }
@@ -8320,8 +8320,8 @@ var require_proto = __commonJS({
8320
8320
  }
8321
8321
  if (options.hasOwnProperty("serializers") === true) {
8322
8322
  instance[serializersSym] = /* @__PURE__ */ Object.create(null);
8323
- for (const k in serializers) {
8324
- instance[serializersSym][k] = serializers[k];
8323
+ for (const k2 in serializers) {
8324
+ instance[serializersSym][k2] = serializers[k2];
8325
8325
  }
8326
8326
  const parentSymbols = Object.getOwnPropertySymbols(serializers);
8327
8327
  for (var i = 0; i < parentSymbols.length; i++) {
@@ -9184,8 +9184,8 @@ var require_multistream = __commonJS({
9184
9184
  };
9185
9185
  }
9186
9186
  }
9187
- function compareByLevel(a, b) {
9188
- return a.level - b.level;
9187
+ function compareByLevel(a, b2) {
9188
+ return a.level - b2.level;
9189
9189
  }
9190
9190
  function initLoopVar(length, dedupe) {
9191
9191
  return dedupe ? length - 1 : 0;
@@ -9532,41 +9532,41 @@ function removeSuffix(string, oldSuffix) {
9532
9532
  function maximumOverlap(string1, string2) {
9533
9533
  return string2.slice(0, overlapCount(string1, string2));
9534
9534
  }
9535
- function overlapCount(a, b) {
9535
+ function overlapCount(a, b2) {
9536
9536
  var startA = 0;
9537
- if (a.length > b.length) {
9538
- startA = a.length - b.length;
9537
+ if (a.length > b2.length) {
9538
+ startA = a.length - b2.length;
9539
9539
  }
9540
- var endB = b.length;
9541
- if (a.length < b.length) {
9540
+ var endB = b2.length;
9541
+ if (a.length < b2.length) {
9542
9542
  endB = a.length;
9543
9543
  }
9544
9544
  var map = Array(endB);
9545
- var k = 0;
9545
+ var k2 = 0;
9546
9546
  map[0] = 0;
9547
9547
  for (var j = 1; j < endB; j++) {
9548
- if (b[j] == b[k]) {
9549
- map[j] = map[k];
9548
+ if (b2[j] == b2[k2]) {
9549
+ map[j] = map[k2];
9550
9550
  } else {
9551
- map[j] = k;
9551
+ map[j] = k2;
9552
9552
  }
9553
- while (k > 0 && b[j] != b[k]) {
9554
- k = map[k];
9553
+ while (k2 > 0 && b2[j] != b2[k2]) {
9554
+ k2 = map[k2];
9555
9555
  }
9556
- if (b[j] == b[k]) {
9557
- k++;
9556
+ if (b2[j] == b2[k2]) {
9557
+ k2++;
9558
9558
  }
9559
9559
  }
9560
- k = 0;
9560
+ k2 = 0;
9561
9561
  for (var i = startA; i < a.length; i++) {
9562
- while (k > 0 && a[i] != b[k]) {
9563
- k = map[k];
9562
+ while (k2 > 0 && a[i] != b2[k2]) {
9563
+ k2 = map[k2];
9564
9564
  }
9565
- if (a[i] == b[k]) {
9566
- k++;
9565
+ if (a[i] == b2[k2]) {
9566
+ k2++;
9567
9567
  }
9568
9568
  }
9569
- return k;
9569
+ return k2;
9570
9570
  }
9571
9571
  function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
9572
9572
  if (deletion && insertion) {
@@ -10189,8 +10189,8 @@ var init_lib = __esm({
10189
10189
  jsonDiff.useLongestToken = true;
10190
10190
  jsonDiff.tokenize = lineDiff.tokenize;
10191
10191
  jsonDiff.castInput = function(value, options) {
10192
- var undefinedReplacement = options.undefinedReplacement, _options$stringifyRep = options.stringifyReplacer, stringifyReplacer = _options$stringifyRep === void 0 ? function(k, v) {
10193
- return typeof v === "undefined" ? undefinedReplacement : v;
10192
+ var undefinedReplacement = options.undefinedReplacement, _options$stringifyRep = options.stringifyReplacer, stringifyReplacer = _options$stringifyRep === void 0 ? function(k2, v2) {
10193
+ return typeof v2 === "undefined" ? undefinedReplacement : v2;
10194
10194
  } : _options$stringifyRep;
10195
10195
  return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, " ");
10196
10196
  };
@@ -10214,8 +10214,8 @@ function extractAskQuestionAnswers(raw) {
10214
10214
  const answers = r.answers;
10215
10215
  if (!answers || typeof answers !== "object" || Array.isArray(answers)) return void 0;
10216
10216
  const out = {};
10217
- for (const [k, v] of Object.entries(answers)) {
10218
- if (typeof v === "string") out[k] = v;
10217
+ for (const [k2, v2] of Object.entries(answers)) {
10218
+ if (typeof v2 === "string") out[k2] = v2;
10219
10219
  }
10220
10220
  return Object.keys(out).length > 0 ? out : void 0;
10221
10221
  }
@@ -10233,9 +10233,9 @@ function hashDirToCwd(hash) {
10233
10233
  const body = hash.startsWith("-") ? hash.slice(1) : hash;
10234
10234
  return "/" + body.replace(/-/g, "/");
10235
10235
  }
10236
- function safeStatMtime(p) {
10236
+ function safeStatMtime(p2) {
10237
10237
  try {
10238
- return import_node_fs7.default.statSync(p).mtimeMs;
10238
+ return import_node_fs7.default.statSync(p2).mtimeMs;
10239
10239
  } catch {
10240
10240
  return 0;
10241
10241
  }
@@ -10314,9 +10314,9 @@ function messageFromJsonl(obj) {
10314
10314
  }
10315
10315
  if (Array.isArray(content)) {
10316
10316
  const parts = content;
10317
- const texts = parts.filter((p) => p.type === "text" && typeof p.text === "string").map((p) => String(p.text));
10318
- const toolUse = parts.find((p) => p.type === "tool_use");
10319
- const toolResult = parts.find((p) => p.type === "tool_result");
10317
+ const texts = parts.filter((p2) => p2.type === "text" && typeof p2.text === "string").map((p2) => String(p2.text));
10318
+ const toolUse = parts.find((p2) => p2.type === "tool_use");
10319
+ const toolResult = parts.find((p2) => p2.type === "tool_result");
10320
10320
  if (toolUse) {
10321
10321
  return withCommonFields(
10322
10322
  {
@@ -10417,16 +10417,16 @@ function attachmentToHistoryMessage(o, ts) {
10417
10417
  const subtype = typeof a.type === "string" ? a.type : "unknown";
10418
10418
  if (subtype === "memories") {
10419
10419
  const raw = Array.isArray(a.memories) ? a.memories : [];
10420
- const memories = raw.map((m) => {
10421
- if (!m || typeof m !== "object") return null;
10422
- const rec = m;
10420
+ const memories = raw.map((m2) => {
10421
+ if (!m2 || typeof m2 !== "object") return null;
10422
+ const rec = m2;
10423
10423
  const path27 = typeof rec.path === "string" ? rec.path : null;
10424
10424
  const content = typeof rec.content === "string" ? rec.content : null;
10425
10425
  if (!path27 || content == null) return null;
10426
10426
  const entry = { path: path27, content };
10427
10427
  if (typeof rec.mtimeMs === "number") entry.mtimeMs = rec.mtimeMs;
10428
10428
  return entry;
10429
- }).filter((m) => m !== null);
10429
+ }).filter((m2) => m2 !== null);
10430
10430
  if (memories.length === 0) return null;
10431
10431
  return withCommonFields({ kind: "attachment_memories", memories, ts, raw: o }, o);
10432
10432
  }
@@ -10522,7 +10522,7 @@ var init_claude_history = __esm({
10522
10522
  if (!ent.isDirectory()) continue;
10523
10523
  const dir = import_node_path8.default.join(this.projectsRoot, ent.name);
10524
10524
  const files = import_node_fs7.default.readdirSync(dir).filter((f) => f.endsWith(".jsonl"));
10525
- const updatedAtMs = files.reduce((m, f) => Math.max(m, safeStatMtime(import_node_path8.default.join(dir, f))), 0);
10525
+ const updatedAtMs = files.reduce((m2, f) => Math.max(m2, safeStatMtime(import_node_path8.default.join(dir, f))), 0);
10526
10526
  out.push({
10527
10527
  projectPath: hashDirToCwd(ent.name),
10528
10528
  hashDir: ent.name,
@@ -10530,7 +10530,7 @@ var init_claude_history = __esm({
10530
10530
  updatedAt: updatedAtMs ? new Date(updatedAtMs).toISOString() : ""
10531
10531
  });
10532
10532
  }
10533
- out.sort((a, b) => a.updatedAt > b.updatedAt ? -1 : a.updatedAt < b.updatedAt ? 1 : 0);
10533
+ out.sort((a, b2) => a.updatedAt > b2.updatedAt ? -1 : a.updatedAt < b2.updatedAt ? 1 : 0);
10534
10534
  return out;
10535
10535
  }
10536
10536
  async listSessions(args) {
@@ -10595,7 +10595,7 @@ var init_claude_history = __esm({
10595
10595
  updatedAt: updatedAtMs ? new Date(updatedAtMs).toISOString() : ""
10596
10596
  });
10597
10597
  }
10598
- out.sort((a, b) => a.updatedAt > b.updatedAt ? -1 : a.updatedAt < b.updatedAt ? 1 : 0);
10598
+ out.sort((a, b2) => a.updatedAt > b2.updatedAt ? -1 : a.updatedAt < b2.updatedAt ? 1 : 0);
10599
10599
  return out;
10600
10600
  }
10601
10601
  async read(args) {
@@ -10748,9 +10748,9 @@ var init_claude_history = __esm({
10748
10748
  const record = {};
10749
10749
  for (const [filePath, raw] of Object.entries(backups)) {
10750
10750
  if (!raw || typeof raw !== "object") continue;
10751
- const b = raw;
10752
- const name = b.backupFileName;
10753
- const version2 = b.version;
10751
+ const b2 = raw;
10752
+ const name = b2.backupFileName;
10753
+ const version2 = b2.version;
10754
10754
  if (typeof version2 !== "number") continue;
10755
10755
  record[filePath] = {
10756
10756
  backupFileName: typeof name === "string" ? name : null,
@@ -10902,8 +10902,8 @@ async function probeClaude(env = process.env, home = import_node_os4.default.hom
10902
10902
  if (env.CLAUDE_BIN && import_node_fs8.default.existsSync(env.CLAUDE_BIN)) {
10903
10903
  return { available: true, path: env.CLAUDE_BIN };
10904
10904
  }
10905
- const w = probeViaWhich();
10906
- if (w) return { available: true, path: w };
10905
+ const w2 = probeViaWhich();
10906
+ if (w2) return { available: true, path: w2 };
10907
10907
  if (process.platform === "darwin") {
10908
10908
  for (const candidate of macOSDesktopCandidates(home)) {
10909
10909
  if (import_node_fs8.default.existsSync(candidate)) {
@@ -11224,16 +11224,16 @@ function parseAttachment(obj) {
11224
11224
  const kind = typeof a.type === "string" ? a.type : "unknown";
11225
11225
  if (kind === "memories") {
11226
11226
  const raw = Array.isArray(a.memories) ? a.memories : [];
11227
- const memories = raw.map((m) => {
11228
- if (!m || typeof m !== "object") return null;
11229
- const rec = m;
11227
+ const memories = raw.map((m2) => {
11228
+ if (!m2 || typeof m2 !== "object") return null;
11229
+ const rec = m2;
11230
11230
  const path27 = typeof rec.path === "string" ? rec.path : null;
11231
11231
  const content = typeof rec.content === "string" ? rec.content : null;
11232
11232
  if (!path27 || content == null) return null;
11233
11233
  const out = { path: path27, content };
11234
11234
  if (typeof rec.mtimeMs === "number") out.mtimeMs = rec.mtimeMs;
11235
11235
  return out;
11236
- }).filter((m) => m !== null);
11236
+ }).filter((m2) => m2 !== null);
11237
11237
  if (memories.length === 0) return null;
11238
11238
  return { kind: "attachment_memories", memories };
11239
11239
  }
@@ -11278,9 +11278,9 @@ function buildSpawnEnv(ctxEnv, base = process.env) {
11278
11278
  };
11279
11279
  }
11280
11280
  function tryParseBase64DataUrl(url) {
11281
- const m = url.match(/^data:([^;,]+);base64,(.+)$/);
11282
- if (!m) return null;
11283
- return { mediaType: m[1], data: m[2] };
11281
+ const m2 = url.match(/^data:([^;,]+);base64,(.+)$/);
11282
+ if (!m2) return null;
11283
+ return { mediaType: m2[1], data: m2[2] };
11284
11284
  }
11285
11285
  function tryParseHttpImageUrl(url) {
11286
11286
  if (!/^https?:\/\//i.test(url)) return null;
@@ -11384,7 +11384,7 @@ var init_claude = __esm({
11384
11384
  type: "select",
11385
11385
  label: "Model",
11386
11386
  scope: "core",
11387
- options: CLAUDE_MODELS.map((m) => ({ value: m.id, label: m.label, description: m.description })),
11387
+ options: CLAUDE_MODELS.map((m2) => ({ value: m2.id, label: m2.label, description: m2.description })),
11388
11388
  default: ""
11389
11389
  },
11390
11390
  {
@@ -11392,7 +11392,7 @@ var init_claude = __esm({
11392
11392
  type: "select",
11393
11393
  label: "Permission Mode",
11394
11394
  scope: "core",
11395
- options: CLAUDE_PERMISSION_MODES.map((m) => ({ value: m.id, label: m.label, description: m.description })),
11395
+ options: CLAUDE_PERMISSION_MODES.map((m2) => ({ value: m2.id, label: m2.label, description: m2.description })),
11396
11396
  default: ""
11397
11397
  },
11398
11398
  {
@@ -11442,10 +11442,10 @@ var init_claude = __esm({
11442
11442
  resolveContextWindow(modelId) {
11443
11443
  if (!modelId) return void 0;
11444
11444
  const models = CLAUDE_CAPABILITIES.models;
11445
- const exact = models.find((m) => m.id === modelId);
11445
+ const exact = models.find((m2) => m2.id === modelId);
11446
11446
  if (exact) return exact.contextWindowSize;
11447
11447
  const lower = modelId.toLowerCase();
11448
- const contains = models.find((m) => m.id && lower.includes(m.id.toLowerCase()));
11448
+ const contains = models.find((m2) => m2.id && lower.includes(m2.id.toLowerCase()));
11449
11449
  if (contains) {
11450
11450
  if (contains.id === "opus" && /opus-4-[67]/i.test(modelId)) return 1e6;
11451
11451
  return contains.contextWindowSize;
@@ -11566,11 +11566,11 @@ var require_xterm_headless = __commonJS({
11566
11566
  };
11567
11567
  }, 5777: (e2, t2, s2) => {
11568
11568
  Object.defineProperty(t2, "__esModule", { value: true }), t2.CoreTerminal = void 0;
11569
- const i2 = s2(6501), r2 = s2(6025), n2 = s2(7276), o = s2(9640), a = s2(56), h = s2(4071), c = s2(7792), l = s2(6415), u = s2(5746), d = s2(5882), f = s2(2486), _ = s2(3562), p = s2(8811), g = s2(802), v = s2(7150);
11570
- let m = false;
11571
- class b extends v.Disposable {
11569
+ const i2 = s2(6501), r2 = s2(6025), n2 = s2(7276), o = s2(9640), a = s2(56), h = s2(4071), c = s2(7792), l = s2(6415), u = s2(5746), d = s2(5882), f = s2(2486), _2 = s2(3562), p2 = s2(8811), g2 = s2(802), v2 = s2(7150);
11570
+ let m2 = false;
11571
+ class b2 extends v2.Disposable {
11572
11572
  get onScroll() {
11573
- return this._onScrollApi || (this._onScrollApi = this._register(new g.Emitter()), this._onScroll.event(((e3) => {
11573
+ return this._onScrollApi || (this._onScrollApi = this._register(new g2.Emitter()), this._onScroll.event(((e3) => {
11574
11574
  this._onScrollApi?.fire(e3.position);
11575
11575
  }))), this._onScrollApi.event;
11576
11576
  }
@@ -11590,15 +11590,15 @@ var require_xterm_headless = __commonJS({
11590
11590
  for (const t3 in e3) this.optionsService.options[t3] = e3[t3];
11591
11591
  }
11592
11592
  constructor(e3) {
11593
- super(), this._windowsWrappingHeuristics = this._register(new v.MutableDisposable()), this._onBinary = this._register(new g.Emitter()), this.onBinary = this._onBinary.event, this._onData = this._register(new g.Emitter()), this.onData = this._onData.event, this._onLineFeed = this._register(new g.Emitter()), this.onLineFeed = this._onLineFeed.event, this._onResize = this._register(new g.Emitter()), this.onResize = this._onResize.event, this._onWriteParsed = this._register(new g.Emitter()), this.onWriteParsed = this._onWriteParsed.event, this._onScroll = this._register(new g.Emitter()), this._instantiationService = new r2.InstantiationService(), this.optionsService = this._register(new a.OptionsService(e3)), this._instantiationService.setService(i2.IOptionsService, this.optionsService), this._bufferService = this._register(this._instantiationService.createInstance(o.BufferService)), this._instantiationService.setService(i2.IBufferService, this._bufferService), this._logService = this._register(this._instantiationService.createInstance(n2.LogService)), this._instantiationService.setService(i2.ILogService, this._logService), this.coreService = this._register(this._instantiationService.createInstance(h.CoreService)), this._instantiationService.setService(i2.ICoreService, this.coreService), this.coreMouseService = this._register(this._instantiationService.createInstance(c.CoreMouseService)), this._instantiationService.setService(i2.ICoreMouseService, this.coreMouseService), this.unicodeService = this._register(this._instantiationService.createInstance(l.UnicodeService)), this._instantiationService.setService(i2.IUnicodeService, this.unicodeService), this._charsetService = this._instantiationService.createInstance(u.CharsetService), this._instantiationService.setService(i2.ICharsetService, this._charsetService), this._oscLinkService = this._instantiationService.createInstance(p.OscLinkService), this._instantiationService.setService(i2.IOscLinkService, this._oscLinkService), this._inputHandler = this._register(new f.InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService)), this._register(g.Event.forward(this._inputHandler.onLineFeed, this._onLineFeed)), this._register(this._inputHandler), this._register(g.Event.forward(this._bufferService.onResize, this._onResize)), this._register(g.Event.forward(this.coreService.onData, this._onData)), this._register(g.Event.forward(this.coreService.onBinary, this._onBinary)), this._register(this.coreService.onRequestScrollToBottom((() => this.scrollToBottom(true)))), this._register(this.coreService.onUserInput((() => this._writeBuffer.handleUserInput()))), this._register(this.optionsService.onMultipleOptionChange(["windowsMode", "windowsPty"], (() => this._handleWindowsPtyOptionChange()))), this._register(this._bufferService.onScroll((() => {
11593
+ super(), this._windowsWrappingHeuristics = this._register(new v2.MutableDisposable()), this._onBinary = this._register(new g2.Emitter()), this.onBinary = this._onBinary.event, this._onData = this._register(new g2.Emitter()), this.onData = this._onData.event, this._onLineFeed = this._register(new g2.Emitter()), this.onLineFeed = this._onLineFeed.event, this._onResize = this._register(new g2.Emitter()), this.onResize = this._onResize.event, this._onWriteParsed = this._register(new g2.Emitter()), this.onWriteParsed = this._onWriteParsed.event, this._onScroll = this._register(new g2.Emitter()), this._instantiationService = new r2.InstantiationService(), this.optionsService = this._register(new a.OptionsService(e3)), this._instantiationService.setService(i2.IOptionsService, this.optionsService), this._bufferService = this._register(this._instantiationService.createInstance(o.BufferService)), this._instantiationService.setService(i2.IBufferService, this._bufferService), this._logService = this._register(this._instantiationService.createInstance(n2.LogService)), this._instantiationService.setService(i2.ILogService, this._logService), this.coreService = this._register(this._instantiationService.createInstance(h.CoreService)), this._instantiationService.setService(i2.ICoreService, this.coreService), this.coreMouseService = this._register(this._instantiationService.createInstance(c.CoreMouseService)), this._instantiationService.setService(i2.ICoreMouseService, this.coreMouseService), this.unicodeService = this._register(this._instantiationService.createInstance(l.UnicodeService)), this._instantiationService.setService(i2.IUnicodeService, this.unicodeService), this._charsetService = this._instantiationService.createInstance(u.CharsetService), this._instantiationService.setService(i2.ICharsetService, this._charsetService), this._oscLinkService = this._instantiationService.createInstance(p2.OscLinkService), this._instantiationService.setService(i2.IOscLinkService, this._oscLinkService), this._inputHandler = this._register(new f.InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService)), this._register(g2.Event.forward(this._inputHandler.onLineFeed, this._onLineFeed)), this._register(this._inputHandler), this._register(g2.Event.forward(this._bufferService.onResize, this._onResize)), this._register(g2.Event.forward(this.coreService.onData, this._onData)), this._register(g2.Event.forward(this.coreService.onBinary, this._onBinary)), this._register(this.coreService.onRequestScrollToBottom((() => this.scrollToBottom(true)))), this._register(this.coreService.onUserInput((() => this._writeBuffer.handleUserInput()))), this._register(this.optionsService.onMultipleOptionChange(["windowsMode", "windowsPty"], (() => this._handleWindowsPtyOptionChange()))), this._register(this._bufferService.onScroll((() => {
11594
11594
  this._onScroll.fire({ position: this._bufferService.buffer.ydisp }), this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
11595
- }))), this._writeBuffer = this._register(new _.WriteBuffer(((e4, t3) => this._inputHandler.parse(e4, t3)))), this._register(g.Event.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));
11595
+ }))), this._writeBuffer = this._register(new _2.WriteBuffer(((e4, t3) => this._inputHandler.parse(e4, t3)))), this._register(g2.Event.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));
11596
11596
  }
11597
11597
  write(e3, t3) {
11598
11598
  this._writeBuffer.write(e3, t3);
11599
11599
  }
11600
11600
  writeSync(e3, t3) {
11601
- this._logService.logLevel <= i2.LogLevelEnum.WARN && !m && (this._logService.warn("writeSync is unreliable and will be removed soon."), m = true), this._writeBuffer.writeSync(e3, t3);
11601
+ this._logService.logLevel <= i2.LogLevelEnum.WARN && !m2 && (this._logService.warn("writeSync is unreliable and will be removed soon."), m2 = true), this._writeBuffer.writeSync(e3, t3);
11602
11602
  }
11603
11603
  input(e3, t3 = true) {
11604
11604
  this.coreService.triggerDataEvent(e3, t3);
@@ -11651,13 +11651,13 @@ var require_xterm_headless = __commonJS({
11651
11651
  _enableWindowsWrappingHeuristics() {
11652
11652
  if (!this._windowsWrappingHeuristics.value) {
11653
11653
  const e3 = [];
11654
- e3.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null, this._bufferService))), e3.push(this.registerCsiHandler({ final: "H" }, (() => ((0, d.updateWindowsModeWrappedState)(this._bufferService), false)))), this._windowsWrappingHeuristics.value = (0, v.toDisposable)((() => {
11654
+ e3.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null, this._bufferService))), e3.push(this.registerCsiHandler({ final: "H" }, (() => ((0, d.updateWindowsModeWrappedState)(this._bufferService), false)))), this._windowsWrappingHeuristics.value = (0, v2.toDisposable)((() => {
11655
11655
  for (const t3 of e3) t3.dispose();
11656
11656
  }));
11657
11657
  }
11658
11658
  }
11659
11659
  }
11660
- t2.CoreTerminal = b;
11660
+ t2.CoreTerminal = b2;
11661
11661
  }, 2486: function(e2, t2, s2) {
11662
11662
  var i2 = this && this.__decorate || function(e3, t3, s3, i3) {
11663
11663
  var r3, n3 = arguments.length, o2 = n3 < 3 ? t3 : null === i3 ? i3 = Object.getOwnPropertyDescriptor(t3, s3) : i3;
@@ -11669,8 +11669,8 @@ var require_xterm_headless = __commonJS({
11669
11669
  t3(s3, i3, e3);
11670
11670
  };
11671
11671
  };
11672
- Object.defineProperty(t2, "__esModule", { value: true }), t2.InputHandler = t2.WindowsOptionsReportType = void 0, t2.isValidColorIndex = k;
11673
- const n2 = s2(3534), o = s2(6760), a = s2(6717), h = s2(7150), c = s2(726), l = s2(6107), u = s2(8938), d = s2(3055), f = s2(5451), _ = s2(6501), p = s2(6415), g = s2(1346), v = s2(9823), m = s2(8693), b = s2(802), S = { "(": 0, ")": 1, "*": 2, "+": 3, "-": 1, ".": 2 }, y = 131072;
11672
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.InputHandler = t2.WindowsOptionsReportType = void 0, t2.isValidColorIndex = k2;
11673
+ const n2 = s2(3534), o = s2(6760), a = s2(6717), h = s2(7150), c = s2(726), l = s2(6107), u = s2(8938), d = s2(3055), f = s2(5451), _2 = s2(6501), p2 = s2(6415), g2 = s2(1346), v2 = s2(9823), m2 = s2(8693), b2 = s2(802), S2 = { "(": 0, ")": 1, "*": 2, "+": 3, "-": 1, ".": 2 }, y2 = 131072;
11674
11674
  function C(e3, t3) {
11675
11675
  if (e3 > 24) return t3.setWinLines || false;
11676
11676
  switch (e3) {
@@ -11721,17 +11721,17 @@ var require_xterm_headless = __commonJS({
11721
11721
  }
11722
11722
  return false;
11723
11723
  }
11724
- var w;
11724
+ var w2;
11725
11725
  !(function(e3) {
11726
11726
  e3[e3.GET_WIN_SIZE_PIXELS = 0] = "GET_WIN_SIZE_PIXELS", e3[e3.GET_CELL_SIZE_PIXELS = 1] = "GET_CELL_SIZE_PIXELS";
11727
- })(w || (t2.WindowsOptionsReportType = w = {}));
11728
- let E = 0;
11729
- class A extends h.Disposable {
11727
+ })(w2 || (t2.WindowsOptionsReportType = w2 = {}));
11728
+ let E2 = 0;
11729
+ class A2 extends h.Disposable {
11730
11730
  getAttrData() {
11731
11731
  return this._curAttrData;
11732
11732
  }
11733
11733
  constructor(e3, t3, s3, i3, r3, h2, u2, d2, f2 = new a.EscapeSequenceParser()) {
11734
- super(), this._bufferService = e3, this._charsetService = t3, this._coreService = s3, this._logService = i3, this._optionsService = r3, this._oscLinkService = h2, this._coreMouseService = u2, this._unicodeService = d2, this._parser = f2, this._parseBuffer = new Uint32Array(4096), this._stringDecoder = new c.StringToUtf32(), this._utf8Decoder = new c.Utf8ToUtf32(), this._windowTitle = "", this._iconName = "", this._windowTitleStack = [], this._iconNameStack = [], this._curAttrData = l.DEFAULT_ATTR_DATA.clone(), this._eraseAttrDataInternal = l.DEFAULT_ATTR_DATA.clone(), this._onRequestBell = this._register(new b.Emitter()), this.onRequestBell = this._onRequestBell.event, this._onRequestRefreshRows = this._register(new b.Emitter()), this.onRequestRefreshRows = this._onRequestRefreshRows.event, this._onRequestReset = this._register(new b.Emitter()), this.onRequestReset = this._onRequestReset.event, this._onRequestSendFocus = this._register(new b.Emitter()), this.onRequestSendFocus = this._onRequestSendFocus.event, this._onRequestSyncScrollBar = this._register(new b.Emitter()), this.onRequestSyncScrollBar = this._onRequestSyncScrollBar.event, this._onRequestWindowsOptionsReport = this._register(new b.Emitter()), this.onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event, this._onA11yChar = this._register(new b.Emitter()), this.onA11yChar = this._onA11yChar.event, this._onA11yTab = this._register(new b.Emitter()), this.onA11yTab = this._onA11yTab.event, this._onCursorMove = this._register(new b.Emitter()), this.onCursorMove = this._onCursorMove.event, this._onLineFeed = this._register(new b.Emitter()), this.onLineFeed = this._onLineFeed.event, this._onScroll = this._register(new b.Emitter()), this.onScroll = this._onScroll.event, this._onTitleChange = this._register(new b.Emitter()), this.onTitleChange = this._onTitleChange.event, this._onColor = this._register(new b.Emitter()), this.onColor = this._onColor.event, this._parseStack = { paused: false, cursorStartX: 0, cursorStartY: 0, decodedLength: 0, position: 0 }, this._specialColors = [256, 257, 258], this._register(this._parser), this._dirtyRowTracker = new L(this._bufferService), this._activeBuffer = this._bufferService.buffer, this._register(this._bufferService.buffers.onBufferActivate(((e4) => this._activeBuffer = e4.activeBuffer))), this._parser.setCsiHandlerFallback(((e4, t4) => {
11734
+ super(), this._bufferService = e3, this._charsetService = t3, this._coreService = s3, this._logService = i3, this._optionsService = r3, this._oscLinkService = h2, this._coreMouseService = u2, this._unicodeService = d2, this._parser = f2, this._parseBuffer = new Uint32Array(4096), this._stringDecoder = new c.StringToUtf32(), this._utf8Decoder = new c.Utf8ToUtf32(), this._windowTitle = "", this._iconName = "", this._windowTitleStack = [], this._iconNameStack = [], this._curAttrData = l.DEFAULT_ATTR_DATA.clone(), this._eraseAttrDataInternal = l.DEFAULT_ATTR_DATA.clone(), this._onRequestBell = this._register(new b2.Emitter()), this.onRequestBell = this._onRequestBell.event, this._onRequestRefreshRows = this._register(new b2.Emitter()), this.onRequestRefreshRows = this._onRequestRefreshRows.event, this._onRequestReset = this._register(new b2.Emitter()), this.onRequestReset = this._onRequestReset.event, this._onRequestSendFocus = this._register(new b2.Emitter()), this.onRequestSendFocus = this._onRequestSendFocus.event, this._onRequestSyncScrollBar = this._register(new b2.Emitter()), this.onRequestSyncScrollBar = this._onRequestSyncScrollBar.event, this._onRequestWindowsOptionsReport = this._register(new b2.Emitter()), this.onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event, this._onA11yChar = this._register(new b2.Emitter()), this.onA11yChar = this._onA11yChar.event, this._onA11yTab = this._register(new b2.Emitter()), this.onA11yTab = this._onA11yTab.event, this._onCursorMove = this._register(new b2.Emitter()), this.onCursorMove = this._onCursorMove.event, this._onLineFeed = this._register(new b2.Emitter()), this.onLineFeed = this._onLineFeed.event, this._onScroll = this._register(new b2.Emitter()), this.onScroll = this._onScroll.event, this._onTitleChange = this._register(new b2.Emitter()), this.onTitleChange = this._onTitleChange.event, this._onColor = this._register(new b2.Emitter()), this.onColor = this._onColor.event, this._parseStack = { paused: false, cursorStartX: 0, cursorStartY: 0, decodedLength: 0, position: 0 }, this._specialColors = [256, 257, 258], this._register(this._parser), this._dirtyRowTracker = new L(this._bufferService), this._activeBuffer = this._bufferService.buffer, this._register(this._bufferService.buffers.onBufferActivate(((e4) => this._activeBuffer = e4.activeBuffer))), this._parser.setCsiHandlerFallback(((e4, t4) => {
11735
11735
  this._logService.debug("Unknown CSI code: ", { identifier: this._parser.identToString(e4), params: t4.toArray() });
11736
11736
  })), this._parser.setEscHandlerFallback(((e4) => {
11737
11737
  this._logService.debug("Unknown ESC code: ", { identifier: this._parser.identToString(e4) });
@@ -11741,15 +11741,15 @@ var require_xterm_headless = __commonJS({
11741
11741
  this._logService.debug("Unknown OSC code: ", { identifier: e4, action: t4, data: s4 });
11742
11742
  })), this._parser.setDcsHandlerFallback(((e4, t4, s4) => {
11743
11743
  "HOOK" === t4 && (s4 = s4.toArray()), this._logService.debug("Unknown DCS code: ", { identifier: this._parser.identToString(e4), action: t4, payload: s4 });
11744
- })), this._parser.setPrintHandler(((e4, t4, s4) => this.print(e4, t4, s4))), this._parser.registerCsiHandler({ final: "@" }, ((e4) => this.insertChars(e4))), this._parser.registerCsiHandler({ intermediates: " ", final: "@" }, ((e4) => this.scrollLeft(e4))), this._parser.registerCsiHandler({ final: "A" }, ((e4) => this.cursorUp(e4))), this._parser.registerCsiHandler({ intermediates: " ", final: "A" }, ((e4) => this.scrollRight(e4))), this._parser.registerCsiHandler({ final: "B" }, ((e4) => this.cursorDown(e4))), this._parser.registerCsiHandler({ final: "C" }, ((e4) => this.cursorForward(e4))), this._parser.registerCsiHandler({ final: "D" }, ((e4) => this.cursorBackward(e4))), this._parser.registerCsiHandler({ final: "E" }, ((e4) => this.cursorNextLine(e4))), this._parser.registerCsiHandler({ final: "F" }, ((e4) => this.cursorPrecedingLine(e4))), this._parser.registerCsiHandler({ final: "G" }, ((e4) => this.cursorCharAbsolute(e4))), this._parser.registerCsiHandler({ final: "H" }, ((e4) => this.cursorPosition(e4))), this._parser.registerCsiHandler({ final: "I" }, ((e4) => this.cursorForwardTab(e4))), this._parser.registerCsiHandler({ final: "J" }, ((e4) => this.eraseInDisplay(e4, false))), this._parser.registerCsiHandler({ prefix: "?", final: "J" }, ((e4) => this.eraseInDisplay(e4, true))), this._parser.registerCsiHandler({ final: "K" }, ((e4) => this.eraseInLine(e4, false))), this._parser.registerCsiHandler({ prefix: "?", final: "K" }, ((e4) => this.eraseInLine(e4, true))), this._parser.registerCsiHandler({ final: "L" }, ((e4) => this.insertLines(e4))), this._parser.registerCsiHandler({ final: "M" }, ((e4) => this.deleteLines(e4))), this._parser.registerCsiHandler({ final: "P" }, ((e4) => this.deleteChars(e4))), this._parser.registerCsiHandler({ final: "S" }, ((e4) => this.scrollUp(e4))), this._parser.registerCsiHandler({ final: "T" }, ((e4) => this.scrollDown(e4))), this._parser.registerCsiHandler({ final: "X" }, ((e4) => this.eraseChars(e4))), this._parser.registerCsiHandler({ final: "Z" }, ((e4) => this.cursorBackwardTab(e4))), this._parser.registerCsiHandler({ final: "`" }, ((e4) => this.charPosAbsolute(e4))), this._parser.registerCsiHandler({ final: "a" }, ((e4) => this.hPositionRelative(e4))), this._parser.registerCsiHandler({ final: "b" }, ((e4) => this.repeatPrecedingCharacter(e4))), this._parser.registerCsiHandler({ final: "c" }, ((e4) => this.sendDeviceAttributesPrimary(e4))), this._parser.registerCsiHandler({ prefix: ">", final: "c" }, ((e4) => this.sendDeviceAttributesSecondary(e4))), this._parser.registerCsiHandler({ final: "d" }, ((e4) => this.linePosAbsolute(e4))), this._parser.registerCsiHandler({ final: "e" }, ((e4) => this.vPositionRelative(e4))), this._parser.registerCsiHandler({ final: "f" }, ((e4) => this.hVPosition(e4))), this._parser.registerCsiHandler({ final: "g" }, ((e4) => this.tabClear(e4))), this._parser.registerCsiHandler({ final: "h" }, ((e4) => this.setMode(e4))), this._parser.registerCsiHandler({ prefix: "?", final: "h" }, ((e4) => this.setModePrivate(e4))), this._parser.registerCsiHandler({ final: "l" }, ((e4) => this.resetMode(e4))), this._parser.registerCsiHandler({ prefix: "?", final: "l" }, ((e4) => this.resetModePrivate(e4))), this._parser.registerCsiHandler({ final: "m" }, ((e4) => this.charAttributes(e4))), this._parser.registerCsiHandler({ final: "n" }, ((e4) => this.deviceStatus(e4))), this._parser.registerCsiHandler({ prefix: "?", final: "n" }, ((e4) => this.deviceStatusPrivate(e4))), this._parser.registerCsiHandler({ intermediates: "!", final: "p" }, ((e4) => this.softReset(e4))), this._parser.registerCsiHandler({ intermediates: " ", final: "q" }, ((e4) => this.setCursorStyle(e4))), this._parser.registerCsiHandler({ final: "r" }, ((e4) => this.setScrollRegion(e4))), this._parser.registerCsiHandler({ final: "s" }, ((e4) => this.saveCursor(e4))), this._parser.registerCsiHandler({ final: "t" }, ((e4) => this.windowOptions(e4))), this._parser.registerCsiHandler({ final: "u" }, ((e4) => this.restoreCursor(e4))), this._parser.registerCsiHandler({ intermediates: "'", final: "}" }, ((e4) => this.insertColumns(e4))), this._parser.registerCsiHandler({ intermediates: "'", final: "~" }, ((e4) => this.deleteColumns(e4))), this._parser.registerCsiHandler({ intermediates: '"', final: "q" }, ((e4) => this.selectProtected(e4))), this._parser.registerCsiHandler({ intermediates: "$", final: "p" }, ((e4) => this.requestMode(e4, true))), this._parser.registerCsiHandler({ prefix: "?", intermediates: "$", final: "p" }, ((e4) => this.requestMode(e4, false))), this._parser.setExecuteHandler(n2.C0.BEL, (() => this.bell())), this._parser.setExecuteHandler(n2.C0.LF, (() => this.lineFeed())), this._parser.setExecuteHandler(n2.C0.VT, (() => this.lineFeed())), this._parser.setExecuteHandler(n2.C0.FF, (() => this.lineFeed())), this._parser.setExecuteHandler(n2.C0.CR, (() => this.carriageReturn())), this._parser.setExecuteHandler(n2.C0.BS, (() => this.backspace())), this._parser.setExecuteHandler(n2.C0.HT, (() => this.tab())), this._parser.setExecuteHandler(n2.C0.SO, (() => this.shiftOut())), this._parser.setExecuteHandler(n2.C0.SI, (() => this.shiftIn())), this._parser.setExecuteHandler(n2.C1.IND, (() => this.index())), this._parser.setExecuteHandler(n2.C1.NEL, (() => this.nextLine())), this._parser.setExecuteHandler(n2.C1.HTS, (() => this.tabSet())), this._parser.registerOscHandler(0, new g.OscHandler(((e4) => (this.setTitle(e4), this.setIconName(e4), true)))), this._parser.registerOscHandler(1, new g.OscHandler(((e4) => this.setIconName(e4)))), this._parser.registerOscHandler(2, new g.OscHandler(((e4) => this.setTitle(e4)))), this._parser.registerOscHandler(4, new g.OscHandler(((e4) => this.setOrReportIndexedColor(e4)))), this._parser.registerOscHandler(8, new g.OscHandler(((e4) => this.setHyperlink(e4)))), this._parser.registerOscHandler(10, new g.OscHandler(((e4) => this.setOrReportFgColor(e4)))), this._parser.registerOscHandler(11, new g.OscHandler(((e4) => this.setOrReportBgColor(e4)))), this._parser.registerOscHandler(12, new g.OscHandler(((e4) => this.setOrReportCursorColor(e4)))), this._parser.registerOscHandler(104, new g.OscHandler(((e4) => this.restoreIndexedColor(e4)))), this._parser.registerOscHandler(110, new g.OscHandler(((e4) => this.restoreFgColor(e4)))), this._parser.registerOscHandler(111, new g.OscHandler(((e4) => this.restoreBgColor(e4)))), this._parser.registerOscHandler(112, new g.OscHandler(((e4) => this.restoreCursorColor(e4)))), this._parser.registerEscHandler({ final: "7" }, (() => this.saveCursor())), this._parser.registerEscHandler({ final: "8" }, (() => this.restoreCursor())), this._parser.registerEscHandler({ final: "D" }, (() => this.index())), this._parser.registerEscHandler({ final: "E" }, (() => this.nextLine())), this._parser.registerEscHandler({ final: "H" }, (() => this.tabSet())), this._parser.registerEscHandler({ final: "M" }, (() => this.reverseIndex())), this._parser.registerEscHandler({ final: "=" }, (() => this.keypadApplicationMode())), this._parser.registerEscHandler({ final: ">" }, (() => this.keypadNumericMode())), this._parser.registerEscHandler({ final: "c" }, (() => this.fullReset())), this._parser.registerEscHandler({ final: "n" }, (() => this.setgLevel(2))), this._parser.registerEscHandler({ final: "o" }, (() => this.setgLevel(3))), this._parser.registerEscHandler({ final: "|" }, (() => this.setgLevel(3))), this._parser.registerEscHandler({ final: "}" }, (() => this.setgLevel(2))), this._parser.registerEscHandler({ final: "~" }, (() => this.setgLevel(1))), this._parser.registerEscHandler({ intermediates: "%", final: "@" }, (() => this.selectDefaultCharset())), this._parser.registerEscHandler({ intermediates: "%", final: "G" }, (() => this.selectDefaultCharset()));
11744
+ })), this._parser.setPrintHandler(((e4, t4, s4) => this.print(e4, t4, s4))), this._parser.registerCsiHandler({ final: "@" }, ((e4) => this.insertChars(e4))), this._parser.registerCsiHandler({ intermediates: " ", final: "@" }, ((e4) => this.scrollLeft(e4))), this._parser.registerCsiHandler({ final: "A" }, ((e4) => this.cursorUp(e4))), this._parser.registerCsiHandler({ intermediates: " ", final: "A" }, ((e4) => this.scrollRight(e4))), this._parser.registerCsiHandler({ final: "B" }, ((e4) => this.cursorDown(e4))), this._parser.registerCsiHandler({ final: "C" }, ((e4) => this.cursorForward(e4))), this._parser.registerCsiHandler({ final: "D" }, ((e4) => this.cursorBackward(e4))), this._parser.registerCsiHandler({ final: "E" }, ((e4) => this.cursorNextLine(e4))), this._parser.registerCsiHandler({ final: "F" }, ((e4) => this.cursorPrecedingLine(e4))), this._parser.registerCsiHandler({ final: "G" }, ((e4) => this.cursorCharAbsolute(e4))), this._parser.registerCsiHandler({ final: "H" }, ((e4) => this.cursorPosition(e4))), this._parser.registerCsiHandler({ final: "I" }, ((e4) => this.cursorForwardTab(e4))), this._parser.registerCsiHandler({ final: "J" }, ((e4) => this.eraseInDisplay(e4, false))), this._parser.registerCsiHandler({ prefix: "?", final: "J" }, ((e4) => this.eraseInDisplay(e4, true))), this._parser.registerCsiHandler({ final: "K" }, ((e4) => this.eraseInLine(e4, false))), this._parser.registerCsiHandler({ prefix: "?", final: "K" }, ((e4) => this.eraseInLine(e4, true))), this._parser.registerCsiHandler({ final: "L" }, ((e4) => this.insertLines(e4))), this._parser.registerCsiHandler({ final: "M" }, ((e4) => this.deleteLines(e4))), this._parser.registerCsiHandler({ final: "P" }, ((e4) => this.deleteChars(e4))), this._parser.registerCsiHandler({ final: "S" }, ((e4) => this.scrollUp(e4))), this._parser.registerCsiHandler({ final: "T" }, ((e4) => this.scrollDown(e4))), this._parser.registerCsiHandler({ final: "X" }, ((e4) => this.eraseChars(e4))), this._parser.registerCsiHandler({ final: "Z" }, ((e4) => this.cursorBackwardTab(e4))), this._parser.registerCsiHandler({ final: "`" }, ((e4) => this.charPosAbsolute(e4))), this._parser.registerCsiHandler({ final: "a" }, ((e4) => this.hPositionRelative(e4))), this._parser.registerCsiHandler({ final: "b" }, ((e4) => this.repeatPrecedingCharacter(e4))), this._parser.registerCsiHandler({ final: "c" }, ((e4) => this.sendDeviceAttributesPrimary(e4))), this._parser.registerCsiHandler({ prefix: ">", final: "c" }, ((e4) => this.sendDeviceAttributesSecondary(e4))), this._parser.registerCsiHandler({ final: "d" }, ((e4) => this.linePosAbsolute(e4))), this._parser.registerCsiHandler({ final: "e" }, ((e4) => this.vPositionRelative(e4))), this._parser.registerCsiHandler({ final: "f" }, ((e4) => this.hVPosition(e4))), this._parser.registerCsiHandler({ final: "g" }, ((e4) => this.tabClear(e4))), this._parser.registerCsiHandler({ final: "h" }, ((e4) => this.setMode(e4))), this._parser.registerCsiHandler({ prefix: "?", final: "h" }, ((e4) => this.setModePrivate(e4))), this._parser.registerCsiHandler({ final: "l" }, ((e4) => this.resetMode(e4))), this._parser.registerCsiHandler({ prefix: "?", final: "l" }, ((e4) => this.resetModePrivate(e4))), this._parser.registerCsiHandler({ final: "m" }, ((e4) => this.charAttributes(e4))), this._parser.registerCsiHandler({ final: "n" }, ((e4) => this.deviceStatus(e4))), this._parser.registerCsiHandler({ prefix: "?", final: "n" }, ((e4) => this.deviceStatusPrivate(e4))), this._parser.registerCsiHandler({ intermediates: "!", final: "p" }, ((e4) => this.softReset(e4))), this._parser.registerCsiHandler({ intermediates: " ", final: "q" }, ((e4) => this.setCursorStyle(e4))), this._parser.registerCsiHandler({ final: "r" }, ((e4) => this.setScrollRegion(e4))), this._parser.registerCsiHandler({ final: "s" }, ((e4) => this.saveCursor(e4))), this._parser.registerCsiHandler({ final: "t" }, ((e4) => this.windowOptions(e4))), this._parser.registerCsiHandler({ final: "u" }, ((e4) => this.restoreCursor(e4))), this._parser.registerCsiHandler({ intermediates: "'", final: "}" }, ((e4) => this.insertColumns(e4))), this._parser.registerCsiHandler({ intermediates: "'", final: "~" }, ((e4) => this.deleteColumns(e4))), this._parser.registerCsiHandler({ intermediates: '"', final: "q" }, ((e4) => this.selectProtected(e4))), this._parser.registerCsiHandler({ intermediates: "$", final: "p" }, ((e4) => this.requestMode(e4, true))), this._parser.registerCsiHandler({ prefix: "?", intermediates: "$", final: "p" }, ((e4) => this.requestMode(e4, false))), this._parser.setExecuteHandler(n2.C0.BEL, (() => this.bell())), this._parser.setExecuteHandler(n2.C0.LF, (() => this.lineFeed())), this._parser.setExecuteHandler(n2.C0.VT, (() => this.lineFeed())), this._parser.setExecuteHandler(n2.C0.FF, (() => this.lineFeed())), this._parser.setExecuteHandler(n2.C0.CR, (() => this.carriageReturn())), this._parser.setExecuteHandler(n2.C0.BS, (() => this.backspace())), this._parser.setExecuteHandler(n2.C0.HT, (() => this.tab())), this._parser.setExecuteHandler(n2.C0.SO, (() => this.shiftOut())), this._parser.setExecuteHandler(n2.C0.SI, (() => this.shiftIn())), this._parser.setExecuteHandler(n2.C1.IND, (() => this.index())), this._parser.setExecuteHandler(n2.C1.NEL, (() => this.nextLine())), this._parser.setExecuteHandler(n2.C1.HTS, (() => this.tabSet())), this._parser.registerOscHandler(0, new g2.OscHandler(((e4) => (this.setTitle(e4), this.setIconName(e4), true)))), this._parser.registerOscHandler(1, new g2.OscHandler(((e4) => this.setIconName(e4)))), this._parser.registerOscHandler(2, new g2.OscHandler(((e4) => this.setTitle(e4)))), this._parser.registerOscHandler(4, new g2.OscHandler(((e4) => this.setOrReportIndexedColor(e4)))), this._parser.registerOscHandler(8, new g2.OscHandler(((e4) => this.setHyperlink(e4)))), this._parser.registerOscHandler(10, new g2.OscHandler(((e4) => this.setOrReportFgColor(e4)))), this._parser.registerOscHandler(11, new g2.OscHandler(((e4) => this.setOrReportBgColor(e4)))), this._parser.registerOscHandler(12, new g2.OscHandler(((e4) => this.setOrReportCursorColor(e4)))), this._parser.registerOscHandler(104, new g2.OscHandler(((e4) => this.restoreIndexedColor(e4)))), this._parser.registerOscHandler(110, new g2.OscHandler(((e4) => this.restoreFgColor(e4)))), this._parser.registerOscHandler(111, new g2.OscHandler(((e4) => this.restoreBgColor(e4)))), this._parser.registerOscHandler(112, new g2.OscHandler(((e4) => this.restoreCursorColor(e4)))), this._parser.registerEscHandler({ final: "7" }, (() => this.saveCursor())), this._parser.registerEscHandler({ final: "8" }, (() => this.restoreCursor())), this._parser.registerEscHandler({ final: "D" }, (() => this.index())), this._parser.registerEscHandler({ final: "E" }, (() => this.nextLine())), this._parser.registerEscHandler({ final: "H" }, (() => this.tabSet())), this._parser.registerEscHandler({ final: "M" }, (() => this.reverseIndex())), this._parser.registerEscHandler({ final: "=" }, (() => this.keypadApplicationMode())), this._parser.registerEscHandler({ final: ">" }, (() => this.keypadNumericMode())), this._parser.registerEscHandler({ final: "c" }, (() => this.fullReset())), this._parser.registerEscHandler({ final: "n" }, (() => this.setgLevel(2))), this._parser.registerEscHandler({ final: "o" }, (() => this.setgLevel(3))), this._parser.registerEscHandler({ final: "|" }, (() => this.setgLevel(3))), this._parser.registerEscHandler({ final: "}" }, (() => this.setgLevel(2))), this._parser.registerEscHandler({ final: "~" }, (() => this.setgLevel(1))), this._parser.registerEscHandler({ intermediates: "%", final: "@" }, (() => this.selectDefaultCharset())), this._parser.registerEscHandler({ intermediates: "%", final: "G" }, (() => this.selectDefaultCharset()));
11745
11745
  for (const e4 in o.CHARSETS) this._parser.registerEscHandler({ intermediates: "(", final: e4 }, (() => this.selectCharset("(" + e4))), this._parser.registerEscHandler({ intermediates: ")", final: e4 }, (() => this.selectCharset(")" + e4))), this._parser.registerEscHandler({ intermediates: "*", final: e4 }, (() => this.selectCharset("*" + e4))), this._parser.registerEscHandler({ intermediates: "+", final: e4 }, (() => this.selectCharset("+" + e4))), this._parser.registerEscHandler({ intermediates: "-", final: e4 }, (() => this.selectCharset("-" + e4))), this._parser.registerEscHandler({ intermediates: ".", final: e4 }, (() => this.selectCharset("." + e4))), this._parser.registerEscHandler({ intermediates: "/", final: e4 }, (() => this.selectCharset("/" + e4)));
11746
- this._parser.registerEscHandler({ intermediates: "#", final: "8" }, (() => this.screenAlignmentPattern())), this._parser.setErrorHandler(((e4) => (this._logService.error("Parsing error: ", e4), e4))), this._parser.registerDcsHandler({ intermediates: "$", final: "q" }, new v.DcsHandler(((e4, t4) => this.requestStatusString(e4, t4))));
11746
+ this._parser.registerEscHandler({ intermediates: "#", final: "8" }, (() => this.screenAlignmentPattern())), this._parser.setErrorHandler(((e4) => (this._logService.error("Parsing error: ", e4), e4))), this._parser.registerDcsHandler({ intermediates: "$", final: "q" }, new v2.DcsHandler(((e4, t4) => this.requestStatusString(e4, t4))));
11747
11747
  }
11748
11748
  _preserveStack(e3, t3, s3, i3) {
11749
11749
  this._parseStack.paused = true, this._parseStack.cursorStartX = e3, this._parseStack.cursorStartY = t3, this._parseStack.decodedLength = s3, this._parseStack.position = i3;
11750
11750
  }
11751
11751
  _logSlowResolvingAsync(e3) {
11752
- this._logService.logLevel <= _.LogLevelEnum.WARN && Promise.race([e3, new Promise(((e4, t3) => setTimeout((() => t3("#SLOW_TIMEOUT")), 5e3)))]).catch(((e4) => {
11752
+ this._logService.logLevel <= _2.LogLevelEnum.WARN && Promise.race([e3, new Promise(((e4, t3) => setTimeout((() => t3("#SLOW_TIMEOUT")), 5e3)))]).catch(((e4) => {
11753
11753
  if ("#SLOW_TIMEOUT" !== e4) throw e4;
11754
11754
  console.warn("async parser handler taking longer than 5000 ms");
11755
11755
  }));
@@ -11762,10 +11762,10 @@ var require_xterm_headless = __commonJS({
11762
11762
  const o2 = this._parseStack.paused;
11763
11763
  if (o2) {
11764
11764
  if (s3 = this._parser.parse(this._parseBuffer, this._parseStack.decodedLength, t3)) return this._logSlowResolvingAsync(s3), s3;
11765
- i3 = this._parseStack.cursorStartX, r3 = this._parseStack.cursorStartY, this._parseStack.paused = false, e3.length > y && (n3 = this._parseStack.position + y);
11765
+ i3 = this._parseStack.cursorStartX, r3 = this._parseStack.cursorStartY, this._parseStack.paused = false, e3.length > y2 && (n3 = this._parseStack.position + y2);
11766
11766
  }
11767
- if (this._logService.logLevel <= _.LogLevelEnum.DEBUG && this._logService.debug("parsing data " + ("string" == typeof e3 ? ` "${e3}"` : ` "${Array.prototype.map.call(e3, ((e4) => String.fromCharCode(e4))).join("")}"`)), this._logService.logLevel === _.LogLevelEnum.TRACE && this._logService.trace("parsing data (codes)", "string" == typeof e3 ? e3.split("").map(((e4) => e4.charCodeAt(0))) : e3), this._parseBuffer.length < e3.length && this._parseBuffer.length < y && (this._parseBuffer = new Uint32Array(Math.min(e3.length, y))), o2 || this._dirtyRowTracker.clearRange(), e3.length > y) for (let t4 = n3; t4 < e3.length; t4 += y) {
11768
- const n4 = t4 + y < e3.length ? t4 + y : e3.length, o3 = "string" == typeof e3 ? this._stringDecoder.decode(e3.substring(t4, n4), this._parseBuffer) : this._utf8Decoder.decode(e3.subarray(t4, n4), this._parseBuffer);
11767
+ if (this._logService.logLevel <= _2.LogLevelEnum.DEBUG && this._logService.debug("parsing data " + ("string" == typeof e3 ? ` "${e3}"` : ` "${Array.prototype.map.call(e3, ((e4) => String.fromCharCode(e4))).join("")}"`)), this._logService.logLevel === _2.LogLevelEnum.TRACE && this._logService.trace("parsing data (codes)", "string" == typeof e3 ? e3.split("").map(((e4) => e4.charCodeAt(0))) : e3), this._parseBuffer.length < e3.length && this._parseBuffer.length < y2 && (this._parseBuffer = new Uint32Array(Math.min(e3.length, y2))), o2 || this._dirtyRowTracker.clearRange(), e3.length > y2) for (let t4 = n3; t4 < e3.length; t4 += y2) {
11768
+ const n4 = t4 + y2 < e3.length ? t4 + y2 : e3.length, o3 = "string" == typeof e3 ? this._stringDecoder.decode(e3.substring(t4, n4), this._parseBuffer) : this._utf8Decoder.decode(e3.subarray(t4, n4), this._parseBuffer);
11769
11769
  if (s3 = this._parser.parse(this._parseBuffer, o3)) return this._preserveStack(i3, r3, o3, t4), this._logSlowResolvingAsync(s3), s3;
11770
11770
  }
11771
11771
  else if (!o2) {
@@ -11779,43 +11779,43 @@ var require_xterm_headless = __commonJS({
11779
11779
  print(e3, t3, s3) {
11780
11780
  let i3, r3;
11781
11781
  const n3 = this._charsetService.charset, o2 = this._optionsService.rawOptions.screenReaderMode, a2 = this._bufferService.cols, h2 = this._coreService.decPrivateModes.wraparound, d2 = this._coreService.modes.insertMode, f2 = this._curAttrData;
11782
- let _2 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
11783
- this._dirtyRowTracker.markDirty(this._activeBuffer.y), this._activeBuffer.x && s3 - t3 > 0 && 2 === _2.getWidth(this._activeBuffer.x - 1) && _2.setCellFromCodepoint(this._activeBuffer.x - 1, 0, 1, f2);
11784
- let g2 = this._parser.precedingJoinState;
11785
- for (let v2 = t3; v2 < s3; ++v2) {
11786
- if (i3 = e3[v2], i3 < 127 && n3) {
11782
+ let _3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
11783
+ this._dirtyRowTracker.markDirty(this._activeBuffer.y), this._activeBuffer.x && s3 - t3 > 0 && 2 === _3.getWidth(this._activeBuffer.x - 1) && _3.setCellFromCodepoint(this._activeBuffer.x - 1, 0, 1, f2);
11784
+ let g3 = this._parser.precedingJoinState;
11785
+ for (let v3 = t3; v3 < s3; ++v3) {
11786
+ if (i3 = e3[v3], i3 < 127 && n3) {
11787
11787
  const e4 = n3[String.fromCharCode(i3)];
11788
11788
  e4 && (i3 = e4.charCodeAt(0));
11789
11789
  }
11790
- const t4 = this._unicodeService.charProperties(i3, g2);
11791
- r3 = p.UnicodeService.extractWidth(t4);
11792
- const s4 = p.UnicodeService.extractShouldJoin(t4), m2 = s4 ? p.UnicodeService.extractWidth(g2) : 0;
11793
- if (g2 = t4, o2 && this._onA11yChar.fire((0, c.stringFromCodePoint)(i3)), this._getCurrentLinkId() && this._oscLinkService.addLineToLink(this._getCurrentLinkId(), this._activeBuffer.ybase + this._activeBuffer.y), this._activeBuffer.x + r3 - m2 > a2) {
11790
+ const t4 = this._unicodeService.charProperties(i3, g3);
11791
+ r3 = p2.UnicodeService.extractWidth(t4);
11792
+ const s4 = p2.UnicodeService.extractShouldJoin(t4), m3 = s4 ? p2.UnicodeService.extractWidth(g3) : 0;
11793
+ if (g3 = t4, o2 && this._onA11yChar.fire((0, c.stringFromCodePoint)(i3)), this._getCurrentLinkId() && this._oscLinkService.addLineToLink(this._getCurrentLinkId(), this._activeBuffer.ybase + this._activeBuffer.y), this._activeBuffer.x + r3 - m3 > a2) {
11794
11794
  if (h2) {
11795
- const e4 = _2;
11796
- let t5 = this._activeBuffer.x - m2;
11797
- for (this._activeBuffer.x = m2, this._activeBuffer.y++, this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--, this._bufferService.scroll(this._eraseAttrData(), true)) : (this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1), this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = true), _2 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y), m2 > 0 && _2 instanceof l.BufferLine && _2.copyCellsFrom(e4, t5, 0, m2, false); t5 < a2; ) e4.setCellFromCodepoint(t5++, 0, 1, f2);
11795
+ const e4 = _3;
11796
+ let t5 = this._activeBuffer.x - m3;
11797
+ for (this._activeBuffer.x = m3, this._activeBuffer.y++, this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--, this._bufferService.scroll(this._eraseAttrData(), true)) : (this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1), this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = true), _3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y), m3 > 0 && _3 instanceof l.BufferLine && _3.copyCellsFrom(e4, t5, 0, m3, false); t5 < a2; ) e4.setCellFromCodepoint(t5++, 0, 1, f2);
11798
11798
  } else if (this._activeBuffer.x = a2 - 1, 2 === r3) continue;
11799
11799
  }
11800
11800
  if (s4 && this._activeBuffer.x) {
11801
- const e4 = _2.getWidth(this._activeBuffer.x - 1) ? 1 : 2;
11802
- _2.addCodepointToCell(this._activeBuffer.x - e4, i3, r3);
11803
- for (let e5 = r3 - m2; --e5 >= 0; ) _2.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, f2);
11804
- } else if (d2 && (_2.insertCells(this._activeBuffer.x, r3 - m2, this._activeBuffer.getNullCell(f2)), 2 === _2.getWidth(a2 - 1) && _2.setCellFromCodepoint(a2 - 1, u.NULL_CELL_CODE, u.NULL_CELL_WIDTH, f2)), _2.setCellFromCodepoint(this._activeBuffer.x++, i3, r3, f2), r3 > 0) for (; --r3; ) _2.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, f2);
11801
+ const e4 = _3.getWidth(this._activeBuffer.x - 1) ? 1 : 2;
11802
+ _3.addCodepointToCell(this._activeBuffer.x - e4, i3, r3);
11803
+ for (let e5 = r3 - m3; --e5 >= 0; ) _3.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, f2);
11804
+ } else if (d2 && (_3.insertCells(this._activeBuffer.x, r3 - m3, this._activeBuffer.getNullCell(f2)), 2 === _3.getWidth(a2 - 1) && _3.setCellFromCodepoint(a2 - 1, u.NULL_CELL_CODE, u.NULL_CELL_WIDTH, f2)), _3.setCellFromCodepoint(this._activeBuffer.x++, i3, r3, f2), r3 > 0) for (; --r3; ) _3.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, f2);
11805
11805
  }
11806
- this._parser.precedingJoinState = g2, this._activeBuffer.x < a2 && s3 - t3 > 0 && 0 === _2.getWidth(this._activeBuffer.x) && !_2.hasContent(this._activeBuffer.x) && _2.setCellFromCodepoint(this._activeBuffer.x, 0, 1, f2), this._dirtyRowTracker.markDirty(this._activeBuffer.y);
11806
+ this._parser.precedingJoinState = g3, this._activeBuffer.x < a2 && s3 - t3 > 0 && 0 === _3.getWidth(this._activeBuffer.x) && !_3.hasContent(this._activeBuffer.x) && _3.setCellFromCodepoint(this._activeBuffer.x, 0, 1, f2), this._dirtyRowTracker.markDirty(this._activeBuffer.y);
11807
11807
  }
11808
11808
  registerCsiHandler(e3, t3) {
11809
11809
  return "t" !== e3.final || e3.prefix || e3.intermediates ? this._parser.registerCsiHandler(e3, t3) : this._parser.registerCsiHandler(e3, ((e4) => !C(e4.params[0], this._optionsService.rawOptions.windowOptions) || t3(e4)));
11810
11810
  }
11811
11811
  registerDcsHandler(e3, t3) {
11812
- return this._parser.registerDcsHandler(e3, new v.DcsHandler(t3));
11812
+ return this._parser.registerDcsHandler(e3, new v2.DcsHandler(t3));
11813
11813
  }
11814
11814
  registerEscHandler(e3, t3) {
11815
11815
  return this._parser.registerEscHandler(e3, t3);
11816
11816
  }
11817
11817
  registerOscHandler(e3, t3) {
11818
- return this._parser.registerOscHandler(e3, new g.OscHandler(t3));
11818
+ return this._parser.registerOscHandler(e3, new g2.OscHandler(t3));
11819
11819
  }
11820
11820
  bell() {
11821
11821
  return this._onRequestBell.fire(), true;
@@ -12048,7 +12048,7 @@ var require_xterm_headless = __commonJS({
12048
12048
  repeatPrecedingCharacter(e3) {
12049
12049
  const t3 = this._parser.precedingJoinState;
12050
12050
  if (!t3) return true;
12051
- const s3 = e3.params[0] || 1, i3 = p.UnicodeService.extractWidth(t3), r3 = this._activeBuffer.x - i3, n3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).getString(r3), o2 = new Uint32Array(n3.length * s3);
12051
+ const s3 = e3.params[0] || 1, i3 = p2.UnicodeService.extractWidth(t3), r3 = this._activeBuffer.x - i3, n3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).getString(r3), o2 = new Uint32Array(n3.length * s3);
12052
12052
  let a2 = 0;
12053
12053
  for (let e4 = 0; e4 < n3.length; ) {
12054
12054
  const t4 = n3.codePointAt(e4) || 0;
@@ -12223,8 +12223,8 @@ var require_xterm_headless = __commonJS({
12223
12223
  }
12224
12224
  requestMode(e3, t3) {
12225
12225
  const s3 = this._coreService.decPrivateModes, { activeProtocol: i3, activeEncoding: r3 } = this._coreMouseService, o2 = this._coreService, { buffers: a2, cols: h2 } = this._bufferService, { active: c2, alt: l2 } = a2, u2 = this._optionsService.rawOptions, d2 = (e4) => e4 ? 1 : 2, f2 = e3.params[0];
12226
- return _2 = f2, p2 = t3 ? 2 === f2 ? 4 : 4 === f2 ? d2(o2.modes.insertMode) : 12 === f2 ? 3 : 20 === f2 ? d2(u2.convertEol) : 0 : 1 === f2 ? d2(s3.applicationCursorKeys) : 3 === f2 ? u2.windowOptions.setWinLines ? 80 === h2 ? 2 : 132 === h2 ? 1 : 0 : 0 : 6 === f2 ? d2(s3.origin) : 7 === f2 ? d2(s3.wraparound) : 8 === f2 ? 3 : 9 === f2 ? d2("X10" === i3) : 12 === f2 ? d2(u2.cursorBlink) : 25 === f2 ? d2(!o2.isCursorHidden) : 45 === f2 ? d2(s3.reverseWraparound) : 66 === f2 ? d2(s3.applicationKeypad) : 67 === f2 ? 4 : 1e3 === f2 ? d2("VT200" === i3) : 1002 === f2 ? d2("DRAG" === i3) : 1003 === f2 ? d2("ANY" === i3) : 1004 === f2 ? d2(s3.sendFocus) : 1005 === f2 ? 4 : 1006 === f2 ? d2("SGR" === r3) : 1015 === f2 ? 4 : 1016 === f2 ? d2("SGR_PIXELS" === r3) : 1048 === f2 ? 1 : 47 === f2 || 1047 === f2 || 1049 === f2 ? d2(c2 === l2) : 2004 === f2 ? d2(s3.bracketedPasteMode) : 2026 === f2 ? d2(s3.synchronizedOutput) : 0, o2.triggerDataEvent(`${n2.C0.ESC}[${t3 ? "" : "?"}${_2};${p2}$y`), true;
12227
- var _2, p2;
12226
+ return _3 = f2, p3 = t3 ? 2 === f2 ? 4 : 4 === f2 ? d2(o2.modes.insertMode) : 12 === f2 ? 3 : 20 === f2 ? d2(u2.convertEol) : 0 : 1 === f2 ? d2(s3.applicationCursorKeys) : 3 === f2 ? u2.windowOptions.setWinLines ? 80 === h2 ? 2 : 132 === h2 ? 1 : 0 : 0 : 6 === f2 ? d2(s3.origin) : 7 === f2 ? d2(s3.wraparound) : 8 === f2 ? 3 : 9 === f2 ? d2("X10" === i3) : 12 === f2 ? d2(u2.cursorBlink) : 25 === f2 ? d2(!o2.isCursorHidden) : 45 === f2 ? d2(s3.reverseWraparound) : 66 === f2 ? d2(s3.applicationKeypad) : 67 === f2 ? 4 : 1e3 === f2 ? d2("VT200" === i3) : 1002 === f2 ? d2("DRAG" === i3) : 1003 === f2 ? d2("ANY" === i3) : 1004 === f2 ? d2(s3.sendFocus) : 1005 === f2 ? 4 : 1006 === f2 ? d2("SGR" === r3) : 1015 === f2 ? 4 : 1016 === f2 ? d2("SGR_PIXELS" === r3) : 1048 === f2 ? 1 : 47 === f2 || 1047 === f2 || 1049 === f2 ? d2(c2 === l2) : 2004 === f2 ? d2(s3.bracketedPasteMode) : 2026 === f2 ? d2(s3.synchronizedOutput) : 0, o2.triggerDataEvent(`${n2.C0.ESC}[${t3 ? "" : "?"}${_3};${p3}$y`), true;
12227
+ var _3, p3;
12228
12228
  }
12229
12229
  _updateAttrColor(e3, t3, s3, i3, r3) {
12230
12230
  return 2 === t3 ? (e3 |= 50331648, e3 &= -16777216, e3 |= f.AttributeData.fromColorRGB([s3, i3, r3])) : 5 === t3 && (e3 &= -50331904, e3 |= 33554432 | 255 & s3), e3;
@@ -12324,10 +12324,10 @@ var require_xterm_headless = __commonJS({
12324
12324
  const t3 = e3.length > 1 ? e3.params[1] : 0;
12325
12325
  switch (e3.params[0]) {
12326
12326
  case 14:
12327
- 2 !== t3 && this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);
12327
+ 2 !== t3 && this._onRequestWindowsOptionsReport.fire(w2.GET_WIN_SIZE_PIXELS);
12328
12328
  break;
12329
12329
  case 16:
12330
- this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);
12330
+ this._onRequestWindowsOptionsReport.fire(w2.GET_CELL_SIZE_PIXELS);
12331
12331
  break;
12332
12332
  case 18:
12333
12333
  this._bufferService && this._coreService.triggerDataEvent(`${n2.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);
@@ -12358,9 +12358,9 @@ var require_xterm_headless = __commonJS({
12358
12358
  const e4 = s3.shift(), i3 = s3.shift();
12359
12359
  if (/^\d+$/.exec(e4)) {
12360
12360
  const s4 = parseInt(e4);
12361
- if (k(s4)) if ("?" === i3) t3.push({ type: 0, index: s4 });
12361
+ if (k2(s4)) if ("?" === i3) t3.push({ type: 0, index: s4 });
12362
12362
  else {
12363
- const e5 = (0, m.parseColor)(i3);
12363
+ const e5 = (0, m2.parseColor)(i3);
12364
12364
  e5 && t3.push({ type: 1, index: s4, color: e5 });
12365
12365
  }
12366
12366
  }
@@ -12387,7 +12387,7 @@ var require_xterm_headless = __commonJS({
12387
12387
  const s3 = e3.split(";");
12388
12388
  for (let e4 = 0; e4 < s3.length && !(t3 >= this._specialColors.length); ++e4, ++t3) if ("?" === s3[e4]) this._onColor.fire([{ type: 0, index: this._specialColors[t3] }]);
12389
12389
  else {
12390
- const i3 = (0, m.parseColor)(s3[e4]);
12390
+ const i3 = (0, m2.parseColor)(s3[e4]);
12391
12391
  i3 && this._onColor.fire([{ type: 1, index: this._specialColors[t3], color: i3 }]);
12392
12392
  }
12393
12393
  return true;
@@ -12406,7 +12406,7 @@ var require_xterm_headless = __commonJS({
12406
12406
  const t3 = [], s3 = e3.split(";");
12407
12407
  for (let e4 = 0; e4 < s3.length; ++e4) if (/^\d+$/.exec(s3[e4])) {
12408
12408
  const i3 = parseInt(s3[e4]);
12409
- k(i3) && t3.push({ type: 2, index: i3 });
12409
+ k2(i3) && t3.push({ type: 2, index: i3 });
12410
12410
  }
12411
12411
  return t3.length && this._onColor.fire(t3), true;
12412
12412
  }
@@ -12432,7 +12432,7 @@ var require_xterm_headless = __commonJS({
12432
12432
  return this._charsetService.setgLevel(0), this._charsetService.setgCharset(0, o.DEFAULT_CHARSET), true;
12433
12433
  }
12434
12434
  selectCharset(e3) {
12435
- return 2 !== e3.length ? (this.selectDefaultCharset(), true) : ("/" === e3[0] || this._charsetService.setgCharset(S[e3[0]], o.CHARSETS[e3[1]] || o.DEFAULT_CHARSET), true);
12435
+ return 2 !== e3.length ? (this.selectDefaultCharset(), true) : ("/" === e3[0] || this._charsetService.setgCharset(S2[e3[0]], o.CHARSETS[e3[1]] || o.DEFAULT_CHARSET), true);
12436
12436
  }
12437
12437
  index() {
12438
12438
  return this._restrictCursor(), this._activeBuffer.y++, this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--, this._bufferService.scroll(this._eraseAttrData())) : this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1), this._restrictCursor(), true;
@@ -12476,7 +12476,7 @@ var require_xterm_headless = __commonJS({
12476
12476
  this._dirtyRowTracker.markRangeDirty(e3, t3);
12477
12477
  }
12478
12478
  }
12479
- t2.InputHandler = A;
12479
+ t2.InputHandler = A2;
12480
12480
  let L = class {
12481
12481
  constructor(e3) {
12482
12482
  this._bufferService = e3, this.clearRange();
@@ -12488,16 +12488,16 @@ var require_xterm_headless = __commonJS({
12488
12488
  e3 < this.start ? this.start = e3 : e3 > this.end && (this.end = e3);
12489
12489
  }
12490
12490
  markRangeDirty(e3, t3) {
12491
- e3 > t3 && (E = e3, e3 = t3, t3 = E), e3 < this.start && (this.start = e3), t3 > this.end && (this.end = t3);
12491
+ e3 > t3 && (E2 = e3, e3 = t3, t3 = E2), e3 < this.start && (this.start = e3), t3 > this.end && (this.end = t3);
12492
12492
  }
12493
12493
  markAllDirty() {
12494
12494
  this.markRangeDirty(0, this._bufferService.rows - 1);
12495
12495
  }
12496
12496
  };
12497
- function k(e3) {
12497
+ function k2(e3) {
12498
12498
  return 0 <= e3 && e3 < 256;
12499
12499
  }
12500
- L = i2([r2(0, _.IBufferService)], L);
12500
+ L = i2([r2(0, _2.IBufferService)], L);
12501
12501
  }, 701: (e2, t2) => {
12502
12502
  Object.defineProperty(t2, "__esModule", { value: true }), t2.isChromeOS = t2.isLinux = t2.isWindows = t2.isIphone = t2.isIpad = t2.isMac = t2.isSafari = t2.isLegacyEdge = t2.isFirefox = t2.isNode = void 0, t2.getSafariVersion = function() {
12503
12503
  if (!t2.isSafari) return 0;
@@ -12844,29 +12844,29 @@ var require_xterm_headless = __commonJS({
12844
12844
  if (e4 >= h2 && e4 < h2 + l2.length) continue;
12845
12845
  }
12846
12846
  const u2 = l2[l2.length - 1].getTrimmedLength(), d = (0, a.reflowSmallerGetNewLineLengths)(l2, this._cols, e3), f = d.length - l2.length;
12847
- let _;
12848
- _ = 0 === this.ybase && this.y !== this.lines.length - 1 ? Math.max(0, this.y - this.lines.maxLength + f) : Math.max(0, this.lines.length - this.lines.maxLength + f);
12849
- const p = [];
12847
+ let _2;
12848
+ _2 = 0 === this.ybase && this.y !== this.lines.length - 1 ? Math.max(0, this.y - this.lines.maxLength + f) : Math.max(0, this.lines.length - this.lines.maxLength + f);
12849
+ const p2 = [];
12850
12850
  for (let e4 = 0; e4 < f; e4++) {
12851
12851
  const e5 = this.getBlankLine(o.DEFAULT_ATTR_DATA, true);
12852
- p.push(e5);
12852
+ p2.push(e5);
12853
12853
  }
12854
- p.length > 0 && (r3.push({ start: h2 + l2.length + n3, newLines: p }), n3 += p.length), l2.push(...p);
12855
- let g = d.length - 1, v = d[g];
12856
- 0 === v && (g--, v = d[g]);
12857
- let m = l2.length - f - 1, b = u2;
12858
- for (; m >= 0; ) {
12859
- const e4 = Math.min(b, v);
12860
- if (void 0 === l2[g]) break;
12861
- if (l2[g].copyCellsFrom(l2[m], b - e4, v - e4, e4, true), v -= e4, 0 === v && (g--, v = d[g]), b -= e4, 0 === b) {
12862
- m--;
12863
- const e5 = Math.max(m, 0);
12864
- b = (0, a.getWrappedLineTrimmedLength)(l2, e5, this._cols);
12854
+ p2.length > 0 && (r3.push({ start: h2 + l2.length + n3, newLines: p2 }), n3 += p2.length), l2.push(...p2);
12855
+ let g2 = d.length - 1, v2 = d[g2];
12856
+ 0 === v2 && (g2--, v2 = d[g2]);
12857
+ let m2 = l2.length - f - 1, b2 = u2;
12858
+ for (; m2 >= 0; ) {
12859
+ const e4 = Math.min(b2, v2);
12860
+ if (void 0 === l2[g2]) break;
12861
+ if (l2[g2].copyCellsFrom(l2[m2], b2 - e4, v2 - e4, e4, true), v2 -= e4, 0 === v2 && (g2--, v2 = d[g2]), b2 -= e4, 0 === b2) {
12862
+ m2--;
12863
+ const e5 = Math.max(m2, 0);
12864
+ b2 = (0, a.getWrappedLineTrimmedLength)(l2, e5, this._cols);
12865
12865
  }
12866
12866
  }
12867
12867
  for (let t4 = 0; t4 < l2.length; t4++) d[t4] < e3 && l2[t4].setCell(d[t4], i3);
12868
- let S = f - _;
12869
- for (; S-- > 0; ) 0 === this.ybase ? this.y < t3 - 1 ? (this.y++, this.lines.pop()) : (this.ybase++, this.ydisp++) : this.ybase < Math.min(this.lines.maxLength, this.lines.length + n3) - t3 && (this.ybase === this.ydisp && this.ydisp++, this.ybase++);
12868
+ let S2 = f - _2;
12869
+ for (; S2-- > 0; ) 0 === this.ybase ? this.y < t3 - 1 ? (this.y++, this.lines.pop()) : (this.ybase++, this.ydisp++) : this.ybase < Math.min(this.lines.maxLength, this.lines.length + n3) - t3 && (this.ybase === this.ydisp && this.ydisp++, this.ybase++);
12870
12870
  this.savedY = Math.min(this.savedY + f, this.ybase + t3 - 1);
12871
12871
  }
12872
12872
  if (r3.length > 0) {
@@ -13118,15 +13118,15 @@ var require_xterm_headless = __commonJS({
13118
13118
  h += u.length - 1;
13119
13119
  continue;
13120
13120
  }
13121
- let d = 0, f = s2(u, d, t3), _ = 1, p = 0;
13122
- for (; _ < u.length; ) {
13123
- const e4 = s2(u, _, t3), r3 = e4 - p, o2 = i2 - f, a2 = Math.min(r3, o2);
13124
- u[d].copyCellsFrom(u[_], p, f, a2, false), f += a2, f === i2 && (d++, f = 0), p += a2, p === e4 && (_++, p = 0), 0 === f && 0 !== d && 2 === u[d - 1].getWidth(i2 - 1) && (u[d].copyCellsFrom(u[d - 1], i2 - 1, f++, 1, false), u[d - 1].setCell(i2 - 1, n2));
13121
+ let d = 0, f = s2(u, d, t3), _2 = 1, p2 = 0;
13122
+ for (; _2 < u.length; ) {
13123
+ const e4 = s2(u, _2, t3), r3 = e4 - p2, o2 = i2 - f, a2 = Math.min(r3, o2);
13124
+ u[d].copyCellsFrom(u[_2], p2, f, a2, false), f += a2, f === i2 && (d++, f = 0), p2 += a2, p2 === e4 && (_2++, p2 = 0), 0 === f && 0 !== d && 2 === u[d - 1].getWidth(i2 - 1) && (u[d].copyCellsFrom(u[d - 1], i2 - 1, f++, 1, false), u[d - 1].setCell(i2 - 1, n2));
13125
13125
  }
13126
13126
  u[d].replaceCells(f, i2, n2);
13127
- let g = 0;
13128
- for (let e4 = u.length - 1; e4 > 0 && (e4 > d || 0 === u[e4].getTrimmedLength()); e4--) g++;
13129
- g > 0 && (a.push(h + u.length - g), a.push(g)), h += u.length - 1;
13127
+ let g2 = 0;
13128
+ for (let e4 = u.length - 1; e4 > 0 && (e4 > d || 0 === u[e4].getTrimmedLength()); e4--) g2++;
13129
+ g2 > 0 && (a.push(h + u.length - g2), a.push(g2)), h += u.length - 1;
13130
13130
  }
13131
13131
  return a;
13132
13132
  }, t2.reflowLargerCreateNewLayout = function(e3, t3) {
@@ -15279,7 +15279,7 @@ var require_xterm_headless = __commonJS({
15279
15279
  }
15280
15280
  function r3(e4, t4) {
15281
15281
  let s4;
15282
- const i4 = new v({ onWillAddFirstListener() {
15282
+ const i4 = new v2({ onWillAddFirstListener() {
15283
15283
  s4 = e4(i4.fire, i4);
15284
15284
  }, onDidRemoveLastListener() {
15285
15285
  s4?.dispose();
@@ -15288,7 +15288,7 @@ var require_xterm_headless = __commonJS({
15288
15288
  }
15289
15289
  function o2(e4, t4, s4 = 100, i4 = false, r4 = false, n3, o3) {
15290
15290
  let a3, h3, c3, l2, u2 = 0;
15291
- const d2 = new v({ leakWarningThreshold: n3, onWillAddFirstListener() {
15291
+ const d2 = new v2({ leakWarningThreshold: n3, onWillAddFirstListener() {
15292
15292
  a3 = e4(((e5) => {
15293
15293
  u2++, h3 = t4(h3, e5), i4 && !c3 && (d2.fire(h3), h3 = void 0), l2 = () => {
15294
15294
  const e6 = h3;
@@ -15336,7 +15336,7 @@ var require_xterm_headless = __commonJS({
15336
15336
  i4 && i4.add(n3);
15337
15337
  const o3 = () => {
15338
15338
  r4?.forEach(((e5) => a3.fire(e5))), r4 = null;
15339
- }, a3 = new v({ onWillAddFirstListener() {
15339
+ }, a3 = new v2({ onWillAddFirstListener() {
15340
15340
  n3 || (n3 = e4(((e5) => a3.fire(e5))), i4 && i4.add(n3));
15341
15341
  }, onDidAddFirstListener() {
15342
15342
  r4 && (t4 ? setTimeout(o3) : o3());
@@ -15384,15 +15384,15 @@ var require_xterm_headless = __commonJS({
15384
15384
  }
15385
15385
  }
15386
15386
  e3.fromNodeEventEmitter = function(e4, t4, s4 = (e5) => e5) {
15387
- const i4 = (...e5) => r4.fire(s4(...e5)), r4 = new v({ onWillAddFirstListener: () => e4.on(t4, i4), onDidRemoveLastListener: () => e4.removeListener(t4, i4) });
15387
+ const i4 = (...e5) => r4.fire(s4(...e5)), r4 = new v2({ onWillAddFirstListener: () => e4.on(t4, i4), onDidRemoveLastListener: () => e4.removeListener(t4, i4) });
15388
15388
  return r4.event;
15389
15389
  }, e3.fromDOMEventEmitter = function(e4, t4, s4 = (e5) => e5) {
15390
- const i4 = (...e5) => r4.fire(s4(...e5)), r4 = new v({ onWillAddFirstListener: () => e4.addEventListener(t4, i4), onDidRemoveLastListener: () => e4.removeEventListener(t4, i4) });
15390
+ const i4 = (...e5) => r4.fire(s4(...e5)), r4 = new v2({ onWillAddFirstListener: () => e4.addEventListener(t4, i4), onDidRemoveLastListener: () => e4.removeEventListener(t4, i4) });
15391
15391
  return r4.event;
15392
15392
  }, e3.toPromise = function(e4) {
15393
15393
  return new Promise(((s4) => t3(e4)(s4)));
15394
15394
  }, e3.fromPromise = function(e4) {
15395
- const t4 = new v();
15395
+ const t4 = new v2();
15396
15396
  return e4.then(((e5) => {
15397
15397
  t4.fire(e5);
15398
15398
  }), (() => {
@@ -15413,7 +15413,7 @@ var require_xterm_headless = __commonJS({
15413
15413
  }, onDidRemoveLastListener: () => {
15414
15414
  e4.removeObserver(this);
15415
15415
  } };
15416
- this.emitter = new v(s4), t4 && t4.add(this.emitter);
15416
+ this.emitter = new v2(s4), t4 && t4.add(this.emitter);
15417
15417
  }
15418
15418
  beginUpdate(e4) {
15419
15419
  this._counter++;
@@ -15522,19 +15522,19 @@ var require_xterm_headless = __commonJS({
15522
15522
  }
15523
15523
  }
15524
15524
  t2.ListenerLeakError = f;
15525
- class _ extends Error {
15525
+ class _2 extends Error {
15526
15526
  constructor(e3, t3) {
15527
15527
  super(e3), this.name = "ListenerRefusalError", this.stack = t3;
15528
15528
  }
15529
15529
  }
15530
- t2.ListenerRefusalError = _;
15531
- let p = 0;
15532
- class g {
15530
+ t2.ListenerRefusalError = _2;
15531
+ let p2 = 0;
15532
+ class g2 {
15533
15533
  constructor(e3) {
15534
- this.value = e3, this.id = p++;
15534
+ this.value = e3, this.id = p2++;
15535
15535
  }
15536
15536
  }
15537
- class v {
15537
+ class v2 {
15538
15538
  constructor(e3) {
15539
15539
  this._size = 0, this._options = e3, this._leakageMon = l > 0 || this._options?.leakWarningThreshold ? new u(e3?.onListenerError ?? i2.onUnexpectedError, this._options?.leakWarningThreshold ?? l) : void 0, this._perfMon = this._options?._profName ? new c(this._options._profName) : void 0, this._deliveryQueue = this._options?.deliveryQueue;
15540
15540
  }
@@ -15546,14 +15546,14 @@ var require_xterm_headless = __commonJS({
15546
15546
  if (this._leakageMon && this._size > this._leakageMon.threshold ** 2) {
15547
15547
  const e4 = `[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;
15548
15548
  console.warn(e4);
15549
- const t4 = this._leakageMon.getMostFrequentStack() ?? ["UNKNOWN stack", -1], s4 = new _(`${e4}. HINT: Stack shows most frequent listener (${t4[1]}-times)`, t4[0]);
15549
+ const t4 = this._leakageMon.getMostFrequentStack() ?? ["UNKNOWN stack", -1], s4 = new _2(`${e4}. HINT: Stack shows most frequent listener (${t4[1]}-times)`, t4[0]);
15550
15550
  return (this._options?.onListenerError || i2.onUnexpectedError)(s4), n2.Disposable.None;
15551
15551
  }
15552
15552
  if (this._disposed) return n2.Disposable.None;
15553
15553
  t3 && (e3 = e3.bind(t3));
15554
- const r3 = new g(e3);
15554
+ const r3 = new g2(e3);
15555
15555
  let o2;
15556
- this._leakageMon && this._size >= Math.ceil(0.2 * this._leakageMon.threshold) && (r3.stack = d.create(), o2 = this._leakageMon.check(r3.stack, this._size + 1)), this._listeners ? this._listeners instanceof g ? (this._deliveryQueue ??= new m(), this._listeners = [this._listeners, r3]) : this._listeners.push(r3) : (this._options?.onWillAddFirstListener?.(this), this._listeners = r3, this._options?.onDidAddFirstListener?.(this)), this._size++;
15556
+ this._leakageMon && this._size >= Math.ceil(0.2 * this._leakageMon.threshold) && (r3.stack = d.create(), o2 = this._leakageMon.check(r3.stack, this._size + 1)), this._listeners ? this._listeners instanceof g2 ? (this._deliveryQueue ??= new m2(), this._listeners = [this._listeners, r3]) : this._listeners.push(r3) : (this._options?.onWillAddFirstListener?.(this), this._listeners = r3, this._options?.onDidAddFirstListener?.(this)), this._size++;
15557
15557
  const a2 = (0, n2.toDisposable)((() => {
15558
15558
  o2?.(), this._removeListener(r3);
15559
15559
  }));
@@ -15589,7 +15589,7 @@ var require_xterm_headless = __commonJS({
15589
15589
  e3.reset();
15590
15590
  }
15591
15591
  fire(e3) {
15592
- if (this._deliveryQueue?.current && (this._deliverQueue(this._deliveryQueue), this._perfMon?.stop()), this._perfMon?.start(this._size), this._listeners) if (this._listeners instanceof g) this._deliver(this._listeners, e3);
15592
+ if (this._deliveryQueue?.current && (this._deliverQueue(this._deliveryQueue), this._perfMon?.stop()), this._perfMon?.start(this._size), this._listeners) if (this._listeners instanceof g2) this._deliver(this._listeners, e3);
15593
15593
  else {
15594
15594
  const t3 = this._deliveryQueue;
15595
15595
  t3.enqueue(this, e3, this._listeners.length), this._deliverQueue(t3);
@@ -15600,8 +15600,8 @@ var require_xterm_headless = __commonJS({
15600
15600
  return this._size > 0;
15601
15601
  }
15602
15602
  }
15603
- t2.Emitter = v, t2.createEventDeliveryQueue = () => new m();
15604
- class m {
15603
+ t2.Emitter = v2, t2.createEventDeliveryQueue = () => new m2();
15604
+ class m2 {
15605
15605
  constructor() {
15606
15606
  this.i = -1, this.end = 0;
15607
15607
  }
@@ -15612,10 +15612,10 @@ var require_xterm_headless = __commonJS({
15612
15612
  this.i = this.end, this.current = void 0, this.value = void 0;
15613
15613
  }
15614
15614
  }
15615
- t2.AsyncEmitter = class extends v {
15615
+ t2.AsyncEmitter = class extends v2 {
15616
15616
  async fireAsync(e3, t3, s3) {
15617
15617
  if (this._listeners) for (this._asyncDeliveryQueue || (this._asyncDeliveryQueue = new o.LinkedList()), ((e4, t4) => {
15618
- if (e4 instanceof g) t4(e4);
15618
+ if (e4 instanceof g2) t4(e4);
15619
15619
  else for (let s4 = 0; s4 < e4.length; s4++) {
15620
15620
  const i3 = e4[s4];
15621
15621
  i3 && t4(i3);
@@ -15637,7 +15637,7 @@ var require_xterm_headless = __commonJS({
15637
15637
  }
15638
15638
  }
15639
15639
  };
15640
- class b extends v {
15640
+ class b2 extends v2 {
15641
15641
  get isPaused() {
15642
15642
  return 0 !== this._isPaused;
15643
15643
  }
@@ -15659,7 +15659,7 @@ var require_xterm_headless = __commonJS({
15659
15659
  this._size && (0 !== this._isPaused ? this._eventQueue.push(e3) : super.fire(e3));
15660
15660
  }
15661
15661
  }
15662
- t2.PauseableEmitter = b, t2.DebounceEmitter = class extends b {
15662
+ t2.PauseableEmitter = b2, t2.DebounceEmitter = class extends b2 {
15663
15663
  constructor(e3) {
15664
15664
  super(e3), this._delay = e3.delay ?? 100;
15665
15665
  }
@@ -15668,7 +15668,7 @@ var require_xterm_headless = __commonJS({
15668
15668
  this._handle = void 0, this.resume();
15669
15669
  }), this._delay)), super.fire(e3);
15670
15670
  }
15671
- }, t2.MicrotaskEmitter = class extends v {
15671
+ }, t2.MicrotaskEmitter = class extends v2 {
15672
15672
  constructor(e3) {
15673
15673
  super(e3), this._queuedEvents = [], this._mergeFn = e3?.merge;
15674
15674
  }
@@ -15678,9 +15678,9 @@ var require_xterm_headless = __commonJS({
15678
15678
  })));
15679
15679
  }
15680
15680
  };
15681
- class S {
15681
+ class S2 {
15682
15682
  constructor() {
15683
- this.hasListeners = false, this.events = [], this.emitter = new v({ onWillAddFirstListener: () => this.onFirstListenerAdd(), onDidRemoveLastListener: () => this.onLastListenerRemove() });
15683
+ this.hasListeners = false, this.events = [], this.emitter = new v2({ onWillAddFirstListener: () => this.onFirstListenerAdd(), onDidRemoveLastListener: () => this.onLastListenerRemove() });
15684
15684
  }
15685
15685
  get event() {
15686
15686
  return this.emitter.event;
@@ -15711,10 +15711,10 @@ var require_xterm_headless = __commonJS({
15711
15711
  this.events = [];
15712
15712
  }
15713
15713
  }
15714
- t2.EventMultiplexer = S, t2.DynamicListEventMultiplexer = class {
15714
+ t2.EventMultiplexer = S2, t2.DynamicListEventMultiplexer = class {
15715
15715
  constructor(e3, t3, s3, i3) {
15716
15716
  this._store = new n2.DisposableStore();
15717
- const r3 = this._store.add(new S()), o2 = this._store.add(new n2.DisposableMap());
15717
+ const r3 = this._store.add(new S2()), o2 = this._store.add(new n2.DisposableMap());
15718
15718
  function a2(e4) {
15719
15719
  o2.set(e4, r3.add(i3(e4)));
15720
15720
  }
@@ -15750,7 +15750,7 @@ var require_xterm_headless = __commonJS({
15750
15750
  }
15751
15751
  }, t2.Relay = class {
15752
15752
  constructor() {
15753
- this.listening = false, this.inputEvent = h.None, this.inputEventListener = n2.Disposable.None, this.emitter = new v({ onDidAddFirstListener: () => {
15753
+ this.listening = false, this.inputEvent = h.None, this.inputEventListener = n2.Disposable.None, this.emitter = new v2({ onDidAddFirstListener: () => {
15754
15754
  this.listening = true, this.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);
15755
15755
  }, onDidRemoveLastListener: () => {
15756
15756
  this.listening = false, this.inputEventListener.dispose();
@@ -15764,10 +15764,10 @@ var require_xterm_headless = __commonJS({
15764
15764
  }
15765
15765
  }, t2.ValueWithChangeEvent = class {
15766
15766
  static const(e3) {
15767
- return new y(e3);
15767
+ return new y2(e3);
15768
15768
  }
15769
15769
  constructor(e3) {
15770
- this._value = e3, this._onDidChange = new v(), this.onDidChange = this._onDidChange.event;
15770
+ this._value = e3, this._onDidChange = new v2(), this.onDidChange = this._onDidChange.event;
15771
15771
  }
15772
15772
  get value() {
15773
15773
  return this._value;
@@ -15776,7 +15776,7 @@ var require_xterm_headless = __commonJS({
15776
15776
  e3 !== this._value && (this._value = e3, this._onDidChange.fire(void 0));
15777
15777
  }
15778
15778
  };
15779
- class y {
15779
+ class y2 {
15780
15780
  constructor(e3) {
15781
15781
  this.value = e3, this.onDidChange = h.None;
15782
15782
  }
@@ -15862,16 +15862,16 @@ var require_xterm_headless = __commonJS({
15862
15862
  h = e3;
15863
15863
  }, t2.trackDisposable = l, t2.markAsDisposed = u, t2.markAsSingleton = function(e3) {
15864
15864
  return h?.markAsSingleton(e3), e3;
15865
- }, t2.isDisposable = f, t2.dispose = _, t2.disposeIfDisposable = function(e3) {
15865
+ }, t2.isDisposable = f, t2.dispose = _2, t2.disposeIfDisposable = function(e3) {
15866
15866
  for (const t3 of e3) f(t3) && t3.dispose();
15867
15867
  return [];
15868
15868
  }, t2.combinedDisposable = function(...e3) {
15869
- const t3 = p((() => _(e3)));
15869
+ const t3 = p2((() => _2(e3)));
15870
15870
  return (function(e4, t4) {
15871
15871
  if (h) for (const s3 of e4) h.setParent(s3, t4);
15872
15872
  })(e3, t3), t3;
15873
- }, t2.toDisposable = p, t2.disposeOnReturn = function(e3) {
15874
- const t3 = new g();
15873
+ }, t2.toDisposable = p2, t2.disposeOnReturn = function(e3) {
15874
+ const t3 = new g2();
15875
15875
  try {
15876
15876
  e3(t3);
15877
15877
  } finally {
@@ -15977,7 +15977,7 @@ ${i3.join("\n")}
15977
15977
  function f(e3) {
15978
15978
  return "object" == typeof e3 && null !== e3 && "function" == typeof e3.dispose && 0 === e3.dispose.length;
15979
15979
  }
15980
- function _(e3) {
15980
+ function _2(e3) {
15981
15981
  if (a.Iterable.is(e3)) {
15982
15982
  const t3 = [];
15983
15983
  for (const s3 of e3) if (s3) try {
@@ -15991,14 +15991,14 @@ ${i3.join("\n")}
15991
15991
  }
15992
15992
  if (e3) return e3.dispose(), e3;
15993
15993
  }
15994
- function p(e3) {
15994
+ function p2(e3) {
15995
15995
  const t3 = l({ dispose: (0, o.createSingleCallFunction)((() => {
15996
15996
  u(t3), e3();
15997
15997
  })) });
15998
15998
  return t3;
15999
15999
  }
16000
16000
  t2.DisposableTracker = c;
16001
- class g {
16001
+ class g2 {
16002
16002
  static {
16003
16003
  this.DISABLE_DISPOSED_WARNING = false;
16004
16004
  }
@@ -16013,7 +16013,7 @@ ${i3.join("\n")}
16013
16013
  }
16014
16014
  clear() {
16015
16015
  if (0 !== this._toDispose.size) try {
16016
- _(this._toDispose);
16016
+ _2(this._toDispose);
16017
16017
  } finally {
16018
16018
  this._toDispose.clear();
16019
16019
  }
@@ -16021,7 +16021,7 @@ ${i3.join("\n")}
16021
16021
  add(e3) {
16022
16022
  if (!e3) return e3;
16023
16023
  if (e3 === this) throw new Error("Cannot register a disposable on itself!");
16024
- return d(e3, this), this._isDisposed ? g.DISABLE_DISPOSED_WARNING || console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack) : this._toDispose.add(e3), e3;
16024
+ return d(e3, this), this._isDisposed ? g2.DISABLE_DISPOSED_WARNING || console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack) : this._toDispose.add(e3), e3;
16025
16025
  }
16026
16026
  delete(e3) {
16027
16027
  if (e3) {
@@ -16033,14 +16033,14 @@ ${i3.join("\n")}
16033
16033
  e3 && this._toDispose.has(e3) && (this._toDispose.delete(e3), d(e3, null));
16034
16034
  }
16035
16035
  }
16036
- t2.DisposableStore = g;
16037
- class v {
16036
+ t2.DisposableStore = g2;
16037
+ class v2 {
16038
16038
  static {
16039
16039
  this.None = Object.freeze({ dispose() {
16040
16040
  } });
16041
16041
  }
16042
16042
  constructor() {
16043
- this._store = new g(), l(this), d(this._store, this);
16043
+ this._store = new g2(), l(this), d(this._store, this);
16044
16044
  }
16045
16045
  dispose() {
16046
16046
  u(this), this._store.dispose();
@@ -16050,8 +16050,8 @@ ${i3.join("\n")}
16050
16050
  return this._store.add(e3);
16051
16051
  }
16052
16052
  }
16053
- t2.Disposable = v;
16054
- class m {
16053
+ t2.Disposable = v2;
16054
+ class m2 {
16055
16055
  constructor() {
16056
16056
  this._isDisposed = false, l(this);
16057
16057
  }
@@ -16072,9 +16072,9 @@ ${i3.join("\n")}
16072
16072
  return this._value = void 0, e3 && d(e3, null), e3;
16073
16073
  }
16074
16074
  }
16075
- t2.MutableDisposable = m, t2.MandatoryMutableDisposable = class {
16075
+ t2.MutableDisposable = m2, t2.MandatoryMutableDisposable = class {
16076
16076
  constructor(e3) {
16077
- this._disposable = new m(), this._isDisposed = false, this._disposable.value = e3;
16077
+ this._disposable = new m2(), this._isDisposed = false, this._disposable.value = e3;
16078
16078
  }
16079
16079
  get value() {
16080
16080
  return this._disposable.value;
@@ -16138,7 +16138,7 @@ ${i3.join("\n")}
16138
16138
  dispose() {
16139
16139
  }
16140
16140
  };
16141
- class b {
16141
+ class b2 {
16142
16142
  constructor() {
16143
16143
  this._store = /* @__PURE__ */ new Map(), this._isDisposed = false, l(this);
16144
16144
  }
@@ -16147,7 +16147,7 @@ ${i3.join("\n")}
16147
16147
  }
16148
16148
  clearAndDisposeAll() {
16149
16149
  if (this._store.size) try {
16150
- _(this._store.values());
16150
+ _2(this._store.values());
16151
16151
  } finally {
16152
16152
  this._store.clear();
16153
16153
  }
@@ -16181,7 +16181,7 @@ ${i3.join("\n")}
16181
16181
  return this._store[Symbol.iterator]();
16182
16182
  }
16183
16183
  }
16184
- t2.DisposableMap = b;
16184
+ t2.DisposableMap = b2;
16185
16185
  }, 6317: (e2, t2) => {
16186
16186
  Object.defineProperty(t2, "__esModule", { value: true }), t2.LinkedList = void 0;
16187
16187
  class s2 {
@@ -16525,372 +16525,6 @@ ${i3.join("\n")}
16525
16525
  }
16526
16526
  });
16527
16527
 
16528
- // ../node_modules/.pnpm/@xterm+addon-serialize@0.14.0/node_modules/@xterm/addon-serialize/lib/addon-serialize.js
16529
- var require_addon_serialize = __commonJS({
16530
- "../node_modules/.pnpm/@xterm+addon-serialize@0.14.0/node_modules/@xterm/addon-serialize/lib/addon-serialize.js"(exports2, module2) {
16531
- "use strict";
16532
- !(function(t, e) {
16533
- "object" == typeof exports2 && "object" == typeof module2 ? module2.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports2 ? exports2.SerializeAddon = e() : t.SerializeAddon = e();
16534
- })(globalThis, (() => (() => {
16535
- "use strict";
16536
- var t = { 992: (t2, e2, s2) => {
16537
- Object.defineProperty(e2, "__esModule", { value: true }), e2.DEFAULT_ANSI_COLORS = void 0;
16538
- const r2 = s2(993);
16539
- e2.DEFAULT_ANSI_COLORS = Object.freeze((() => {
16540
- const t3 = [r2.css.toColor("#2e3436"), r2.css.toColor("#cc0000"), r2.css.toColor("#4e9a06"), r2.css.toColor("#c4a000"), r2.css.toColor("#3465a4"), r2.css.toColor("#75507b"), r2.css.toColor("#06989a"), r2.css.toColor("#d3d7cf"), r2.css.toColor("#555753"), r2.css.toColor("#ef2929"), r2.css.toColor("#8ae234"), r2.css.toColor("#fce94f"), r2.css.toColor("#729fcf"), r2.css.toColor("#ad7fa8"), r2.css.toColor("#34e2e2"), r2.css.toColor("#eeeeec")], e3 = [0, 95, 135, 175, 215, 255];
16541
- for (let s3 = 0; s3 < 216; s3++) {
16542
- const i = e3[s3 / 36 % 6 | 0], o = e3[s3 / 6 % 6 | 0], n = e3[s3 % 6];
16543
- t3.push({ css: r2.channels.toCss(i, o, n), rgba: r2.channels.toRgba(i, o, n) });
16544
- }
16545
- for (let e4 = 0; e4 < 24; e4++) {
16546
- const s3 = 8 + 10 * e4;
16547
- t3.push({ css: r2.channels.toCss(s3, s3, s3), rgba: r2.channels.toRgba(s3, s3, s3) });
16548
- }
16549
- return t3;
16550
- })());
16551
- }, 993: (t2, e2) => {
16552
- Object.defineProperty(e2, "__esModule", { value: true }), e2.rgba = e2.rgb = e2.css = e2.color = e2.channels = e2.NULL_COLOR = void 0, e2.toPaddedHex = c, e2.contrastRatio = _;
16553
- let s2 = 0, r2 = 0, i = 0, o = 0;
16554
- var n, l, a, u, h;
16555
- function c(t3) {
16556
- const e3 = t3.toString(16);
16557
- return e3.length < 2 ? "0" + e3 : e3;
16558
- }
16559
- function _(t3, e3) {
16560
- return t3 < e3 ? (e3 + 0.05) / (t3 + 0.05) : (t3 + 0.05) / (e3 + 0.05);
16561
- }
16562
- e2.NULL_COLOR = { css: "#00000000", rgba: 0 }, (function(t3) {
16563
- t3.toCss = function(t4, e3, s3, r3) {
16564
- return void 0 !== r3 ? `#${c(t4)}${c(e3)}${c(s3)}${c(r3)}` : `#${c(t4)}${c(e3)}${c(s3)}`;
16565
- }, t3.toRgba = function(t4, e3, s3, r3 = 255) {
16566
- return (t4 << 24 | e3 << 16 | s3 << 8 | r3) >>> 0;
16567
- }, t3.toColor = function(e3, s3, r3, i2) {
16568
- return { css: t3.toCss(e3, s3, r3, i2), rgba: t3.toRgba(e3, s3, r3, i2) };
16569
- };
16570
- })(n || (e2.channels = n = {})), (function(t3) {
16571
- function e3(t4, e4) {
16572
- return o = Math.round(255 * e4), [s2, r2, i] = h.toChannels(t4.rgba), { css: n.toCss(s2, r2, i, o), rgba: n.toRgba(s2, r2, i, o) };
16573
- }
16574
- t3.blend = function(t4, e4) {
16575
- if (o = (255 & e4.rgba) / 255, 1 === o) return { css: e4.css, rgba: e4.rgba };
16576
- const l2 = e4.rgba >> 24 & 255, a2 = e4.rgba >> 16 & 255, u2 = e4.rgba >> 8 & 255, h2 = t4.rgba >> 24 & 255, c2 = t4.rgba >> 16 & 255, _2 = t4.rgba >> 8 & 255;
16577
- return s2 = h2 + Math.round((l2 - h2) * o), r2 = c2 + Math.round((a2 - c2) * o), i = _2 + Math.round((u2 - _2) * o), { css: n.toCss(s2, r2, i), rgba: n.toRgba(s2, r2, i) };
16578
- }, t3.isOpaque = function(t4) {
16579
- return !(255 & ~t4.rgba);
16580
- }, t3.ensureContrastRatio = function(t4, e4, s3) {
16581
- const r3 = h.ensureContrastRatio(t4.rgba, e4.rgba, s3);
16582
- if (r3) return n.toColor(r3 >> 24 & 255, r3 >> 16 & 255, r3 >> 8 & 255);
16583
- }, t3.opaque = function(t4) {
16584
- const e4 = (255 | t4.rgba) >>> 0;
16585
- return [s2, r2, i] = h.toChannels(e4), { css: n.toCss(s2, r2, i), rgba: e4 };
16586
- }, t3.opacity = e3, t3.multiplyOpacity = function(t4, s3) {
16587
- return o = 255 & t4.rgba, e3(t4, o * s3 / 255);
16588
- }, t3.toColorRGB = function(t4) {
16589
- return [t4.rgba >> 24 & 255, t4.rgba >> 16 & 255, t4.rgba >> 8 & 255];
16590
- };
16591
- })(l || (e2.color = l = {})), (function(t3) {
16592
- let e3, l2;
16593
- try {
16594
- const t4 = document.createElement("canvas");
16595
- t4.width = 1, t4.height = 1;
16596
- const s3 = t4.getContext("2d", { willReadFrequently: true });
16597
- s3 && (e3 = s3, e3.globalCompositeOperation = "copy", l2 = e3.createLinearGradient(0, 0, 1, 1));
16598
- } catch {
16599
- }
16600
- t3.toColor = function(t4) {
16601
- if (t4.match(/#[\da-f]{3,8}/i)) switch (t4.length) {
16602
- case 4:
16603
- return s2 = parseInt(t4.slice(1, 2).repeat(2), 16), r2 = parseInt(t4.slice(2, 3).repeat(2), 16), i = parseInt(t4.slice(3, 4).repeat(2), 16), n.toColor(s2, r2, i);
16604
- case 5:
16605
- return s2 = parseInt(t4.slice(1, 2).repeat(2), 16), r2 = parseInt(t4.slice(2, 3).repeat(2), 16), i = parseInt(t4.slice(3, 4).repeat(2), 16), o = parseInt(t4.slice(4, 5).repeat(2), 16), n.toColor(s2, r2, i, o);
16606
- case 7:
16607
- return { css: t4, rgba: (parseInt(t4.slice(1), 16) << 8 | 255) >>> 0 };
16608
- case 9:
16609
- return { css: t4, rgba: parseInt(t4.slice(1), 16) >>> 0 };
16610
- }
16611
- const a2 = t4.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);
16612
- if (a2) return s2 = parseInt(a2[1]), r2 = parseInt(a2[2]), i = parseInt(a2[3]), o = Math.round(255 * (void 0 === a2[5] ? 1 : parseFloat(a2[5]))), n.toColor(s2, r2, i, o);
16613
- if (!e3 || !l2) throw new Error("css.toColor: Unsupported css format");
16614
- if (e3.fillStyle = l2, e3.fillStyle = t4, "string" != typeof e3.fillStyle) throw new Error("css.toColor: Unsupported css format");
16615
- if (e3.fillRect(0, 0, 1, 1), [s2, r2, i, o] = e3.getImageData(0, 0, 1, 1).data, 255 !== o) throw new Error("css.toColor: Unsupported css format");
16616
- return { rgba: n.toRgba(s2, r2, i, o), css: t4 };
16617
- };
16618
- })(a || (e2.css = a = {})), (function(t3) {
16619
- function e3(t4, e4, s3) {
16620
- const r3 = t4 / 255, i2 = e4 / 255, o2 = s3 / 255;
16621
- return 0.2126 * (r3 <= 0.03928 ? r3 / 12.92 : Math.pow((r3 + 0.055) / 1.055, 2.4)) + 0.7152 * (i2 <= 0.03928 ? i2 / 12.92 : Math.pow((i2 + 0.055) / 1.055, 2.4)) + 0.0722 * (o2 <= 0.03928 ? o2 / 12.92 : Math.pow((o2 + 0.055) / 1.055, 2.4));
16622
- }
16623
- t3.relativeLuminance = function(t4) {
16624
- return e3(t4 >> 16 & 255, t4 >> 8 & 255, 255 & t4);
16625
- }, t3.relativeLuminance2 = e3;
16626
- })(u || (e2.rgb = u = {})), (function(t3) {
16627
- function e3(t4, e4, s3) {
16628
- const r3 = t4 >> 24 & 255, i2 = t4 >> 16 & 255, o2 = t4 >> 8 & 255;
16629
- let n2 = e4 >> 24 & 255, l3 = e4 >> 16 & 255, a2 = e4 >> 8 & 255, h2 = _(u.relativeLuminance2(n2, l3, a2), u.relativeLuminance2(r3, i2, o2));
16630
- for (; h2 < s3 && (n2 > 0 || l3 > 0 || a2 > 0); ) n2 -= Math.max(0, Math.ceil(0.1 * n2)), l3 -= Math.max(0, Math.ceil(0.1 * l3)), a2 -= Math.max(0, Math.ceil(0.1 * a2)), h2 = _(u.relativeLuminance2(n2, l3, a2), u.relativeLuminance2(r3, i2, o2));
16631
- return (n2 << 24 | l3 << 16 | a2 << 8 | 255) >>> 0;
16632
- }
16633
- function l2(t4, e4, s3) {
16634
- const r3 = t4 >> 24 & 255, i2 = t4 >> 16 & 255, o2 = t4 >> 8 & 255;
16635
- let n2 = e4 >> 24 & 255, l3 = e4 >> 16 & 255, a2 = e4 >> 8 & 255, h2 = _(u.relativeLuminance2(n2, l3, a2), u.relativeLuminance2(r3, i2, o2));
16636
- for (; h2 < s3 && (n2 < 255 || l3 < 255 || a2 < 255); ) n2 = Math.min(255, n2 + Math.ceil(0.1 * (255 - n2))), l3 = Math.min(255, l3 + Math.ceil(0.1 * (255 - l3))), a2 = Math.min(255, a2 + Math.ceil(0.1 * (255 - a2))), h2 = _(u.relativeLuminance2(n2, l3, a2), u.relativeLuminance2(r3, i2, o2));
16637
- return (n2 << 24 | l3 << 16 | a2 << 8 | 255) >>> 0;
16638
- }
16639
- t3.blend = function(t4, e4) {
16640
- if (o = (255 & e4) / 255, 1 === o) return e4;
16641
- const l3 = e4 >> 24 & 255, a2 = e4 >> 16 & 255, u2 = e4 >> 8 & 255, h2 = t4 >> 24 & 255, c2 = t4 >> 16 & 255, _2 = t4 >> 8 & 255;
16642
- return s2 = h2 + Math.round((l3 - h2) * o), r2 = c2 + Math.round((a2 - c2) * o), i = _2 + Math.round((u2 - _2) * o), n.toRgba(s2, r2, i);
16643
- }, t3.ensureContrastRatio = function(t4, s3, r3) {
16644
- const i2 = u.relativeLuminance(t4 >> 8), o2 = u.relativeLuminance(s3 >> 8);
16645
- if (_(i2, o2) < r3) {
16646
- if (o2 < i2) {
16647
- const o3 = e3(t4, s3, r3), n3 = _(i2, u.relativeLuminance(o3 >> 8));
16648
- if (n3 < r3) {
16649
- const e4 = l2(t4, s3, r3);
16650
- return n3 > _(i2, u.relativeLuminance(e4 >> 8)) ? o3 : e4;
16651
- }
16652
- return o3;
16653
- }
16654
- const n2 = l2(t4, s3, r3), a2 = _(i2, u.relativeLuminance(n2 >> 8));
16655
- if (a2 < r3) {
16656
- const o3 = e3(t4, s3, r3);
16657
- return a2 > _(i2, u.relativeLuminance(o3 >> 8)) ? n2 : o3;
16658
- }
16659
- return n2;
16660
- }
16661
- }, t3.reduceLuminance = e3, t3.increaseLuminance = l2, t3.toChannels = function(t4) {
16662
- return [t4 >> 24 & 255, t4 >> 16 & 255, t4 >> 8 & 255, 255 & t4];
16663
- };
16664
- })(h || (e2.rgba = h = {}));
16665
- } }, e = {};
16666
- function s(r2) {
16667
- var i = e[r2];
16668
- if (void 0 !== i) return i.exports;
16669
- var o = e[r2] = { exports: {} };
16670
- return t[r2](o, o.exports, s), o.exports;
16671
- }
16672
- var r = {};
16673
- return (() => {
16674
- var t2 = r;
16675
- Object.defineProperty(t2, "__esModule", { value: true }), t2.HTMLSerializeHandler = t2.SerializeAddon = void 0;
16676
- const e2 = s(992);
16677
- function i(t3, e3, s2) {
16678
- return Math.max(e3, Math.min(t3, s2));
16679
- }
16680
- class o {
16681
- constructor(t3) {
16682
- this._buffer = t3;
16683
- }
16684
- serialize(t3, e3) {
16685
- const s2 = this._buffer.getNullCell(), r2 = this._buffer.getNullCell();
16686
- let i2 = s2;
16687
- const o2 = t3.start.y, n2 = t3.end.y, l2 = t3.start.x, a2 = t3.end.x;
16688
- this._beforeSerialize(n2 - o2, o2, n2);
16689
- for (let e4 = o2; e4 <= n2; e4++) {
16690
- const o3 = this._buffer.getLine(e4);
16691
- if (o3) {
16692
- const n3 = e4 === t3.start.y ? l2 : 0, u2 = e4 === t3.end.y ? a2 : o3.length;
16693
- for (let t4 = n3; t4 < u2; t4++) {
16694
- const n4 = o3.getCell(t4, i2 === s2 ? r2 : s2);
16695
- n4 ? (this._nextCell(n4, i2, e4, t4), i2 = n4) : console.warn(`Can't get cell at row=${e4}, col=${t4}`);
16696
- }
16697
- }
16698
- this._rowEnd(e4, e4 === n2);
16699
- }
16700
- return this._afterSerialize(), this._serializeString(e3);
16701
- }
16702
- _nextCell(t3, e3, s2, r2) {
16703
- }
16704
- _rowEnd(t3, e3) {
16705
- }
16706
- _beforeSerialize(t3, e3, s2) {
16707
- }
16708
- _afterSerialize() {
16709
- }
16710
- _serializeString(t3) {
16711
- return "";
16712
- }
16713
- }
16714
- function n(t3, e3) {
16715
- return t3.getFgColorMode() === e3.getFgColorMode() && t3.getFgColor() === e3.getFgColor();
16716
- }
16717
- function l(t3, e3) {
16718
- return t3.getBgColorMode() === e3.getBgColorMode() && t3.getBgColor() === e3.getBgColor();
16719
- }
16720
- function a(t3, e3) {
16721
- return t3.isInverse() === e3.isInverse() && t3.isBold() === e3.isBold() && t3.isUnderline() === e3.isUnderline() && t3.isOverline() === e3.isOverline() && t3.isBlink() === e3.isBlink() && t3.isInvisible() === e3.isInvisible() && t3.isItalic() === e3.isItalic() && t3.isDim() === e3.isDim() && t3.isStrikethrough() === e3.isStrikethrough();
16722
- }
16723
- class u extends o {
16724
- constructor(t3, e3) {
16725
- super(t3), this._terminal = e3, this._rowIndex = 0, this._allRows = new Array(), this._allRowSeparators = new Array(), this._currentRow = "", this._nullCellCount = 0, this._cursorStyle = this._buffer.getNullCell(), this._cursorStyleRow = 0, this._cursorStyleCol = 0, this._backgroundCell = this._buffer.getNullCell(), this._firstRow = 0, this._lastCursorRow = 0, this._lastCursorCol = 0, this._lastContentCursorRow = 0, this._lastContentCursorCol = 0, this._thisRowLastChar = this._buffer.getNullCell(), this._thisRowLastSecondChar = this._buffer.getNullCell(), this._nextRowFirstChar = this._buffer.getNullCell();
16726
- }
16727
- _beforeSerialize(t3, e3, s2) {
16728
- this._allRows = new Array(t3), this._lastContentCursorRow = e3, this._lastCursorRow = e3, this._firstRow = e3;
16729
- }
16730
- _rowEnd(t3, e3) {
16731
- this._nullCellCount > 0 && !l(this._cursorStyle, this._backgroundCell) && (this._currentRow += `\x1B[${this._nullCellCount}X`);
16732
- let s2 = "";
16733
- if (!e3) {
16734
- t3 - this._firstRow >= this._terminal.rows && this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol, this._backgroundCell);
16735
- const e4 = this._buffer.getLine(t3), r2 = this._buffer.getLine(t3 + 1);
16736
- if (r2.isWrapped) {
16737
- s2 = "";
16738
- const i2 = e4.getCell(e4.length - 1, this._thisRowLastChar), o2 = e4.getCell(e4.length - 2, this._thisRowLastSecondChar), n2 = r2.getCell(0, this._nextRowFirstChar), a2 = n2.getWidth() > 1;
16739
- let u2 = false;
16740
- (n2.getChars() && a2 ? this._nullCellCount <= 1 : this._nullCellCount <= 0) && ((i2.getChars() || 0 === i2.getWidth()) && l(i2, n2) && (u2 = true), a2 && (o2.getChars() || 0 === o2.getWidth()) && l(i2, n2) && l(o2, n2) && (u2 = true)), u2 || (s2 = "-".repeat(this._nullCellCount + 1), s2 += "\x1B[1D\x1B[1X", this._nullCellCount > 0 && (s2 += "\x1B[A", s2 += `\x1B[${e4.length - this._nullCellCount}C`, s2 += `\x1B[${this._nullCellCount}X`, s2 += `\x1B[${e4.length - this._nullCellCount}D`, s2 += "\x1B[B"), this._lastContentCursorRow = t3 + 1, this._lastContentCursorCol = 0, this._lastCursorRow = t3 + 1, this._lastCursorCol = 0);
16741
- } else s2 = "\r\n", this._lastCursorRow = t3 + 1, this._lastCursorCol = 0;
16742
- }
16743
- this._allRows[this._rowIndex] = this._currentRow, this._allRowSeparators[this._rowIndex++] = s2, this._currentRow = "", this._nullCellCount = 0;
16744
- }
16745
- _diffStyle(t3, e3) {
16746
- const s2 = [], r2 = !n(t3, e3), i2 = !l(t3, e3), o2 = !a(t3, e3);
16747
- if (r2 || i2 || o2) if (t3.isAttributeDefault()) e3.isAttributeDefault() || s2.push(0);
16748
- else {
16749
- if (r2) {
16750
- const e4 = t3.getFgColor();
16751
- t3.isFgRGB() ? s2.push(38, 2, e4 >>> 16 & 255, e4 >>> 8 & 255, 255 & e4) : t3.isFgPalette() ? e4 >= 16 ? s2.push(38, 5, e4) : s2.push(8 & e4 ? 90 + (7 & e4) : 30 + (7 & e4)) : s2.push(39);
16752
- }
16753
- if (i2) {
16754
- const e4 = t3.getBgColor();
16755
- t3.isBgRGB() ? s2.push(48, 2, e4 >>> 16 & 255, e4 >>> 8 & 255, 255 & e4) : t3.isBgPalette() ? e4 >= 16 ? s2.push(48, 5, e4) : s2.push(8 & e4 ? 100 + (7 & e4) : 40 + (7 & e4)) : s2.push(49);
16756
- }
16757
- o2 && (t3.isInverse() !== e3.isInverse() && s2.push(t3.isInverse() ? 7 : 27), t3.isBold() !== e3.isBold() && s2.push(t3.isBold() ? 1 : 22), t3.isUnderline() !== e3.isUnderline() && s2.push(t3.isUnderline() ? 4 : 24), t3.isOverline() !== e3.isOverline() && s2.push(t3.isOverline() ? 53 : 55), t3.isBlink() !== e3.isBlink() && s2.push(t3.isBlink() ? 5 : 25), t3.isInvisible() !== e3.isInvisible() && s2.push(t3.isInvisible() ? 8 : 28), t3.isItalic() !== e3.isItalic() && s2.push(t3.isItalic() ? 3 : 23), t3.isDim() !== e3.isDim() && s2.push(t3.isDim() ? 2 : 22), t3.isStrikethrough() !== e3.isStrikethrough() && s2.push(t3.isStrikethrough() ? 9 : 29));
16758
- }
16759
- return s2;
16760
- }
16761
- _nextCell(t3, e3, s2, r2) {
16762
- if (0 === t3.getWidth()) return;
16763
- const i2 = "" === t3.getChars(), o2 = this._diffStyle(t3, this._cursorStyle);
16764
- if (i2 ? !l(this._cursorStyle, t3) : o2.length > 0) {
16765
- this._nullCellCount > 0 && (l(this._cursorStyle, this._backgroundCell) || (this._currentRow += `\x1B[${this._nullCellCount}X`), this._currentRow += `\x1B[${this._nullCellCount}C`, this._nullCellCount = 0), this._lastContentCursorRow = this._lastCursorRow = s2, this._lastContentCursorCol = this._lastCursorCol = r2, this._currentRow += `\x1B[${o2.join(";")}m`;
16766
- const t4 = this._buffer.getLine(s2);
16767
- void 0 !== t4 && (t4.getCell(r2, this._cursorStyle), this._cursorStyleRow = s2, this._cursorStyleCol = r2);
16768
- }
16769
- i2 ? this._nullCellCount += t3.getWidth() : (this._nullCellCount > 0 && (l(this._cursorStyle, this._backgroundCell) || (this._currentRow += `\x1B[${this._nullCellCount}X`), this._currentRow += `\x1B[${this._nullCellCount}C`, this._nullCellCount = 0), this._currentRow += t3.getChars(), this._lastContentCursorRow = this._lastCursorRow = s2, this._lastContentCursorCol = this._lastCursorCol = r2 + t3.getWidth());
16770
- }
16771
- _serializeString(t3) {
16772
- let e3 = this._allRows.length;
16773
- this._buffer.length - this._firstRow <= this._terminal.rows && (e3 = this._lastContentCursorRow + 1 - this._firstRow, this._lastCursorCol = this._lastContentCursorCol, this._lastCursorRow = this._lastContentCursorRow);
16774
- let s2 = "";
16775
- for (let t4 = 0; t4 < e3; t4++) s2 += this._allRows[t4], t4 + 1 < e3 && (s2 += this._allRowSeparators[t4]);
16776
- if (!t3) {
16777
- const t4 = this._buffer.baseY + this._buffer.cursorY, e4 = this._buffer.cursorX, i3 = (t5) => {
16778
- t5 > 0 ? s2 += `\x1B[${t5}C` : t5 < 0 && (s2 += `\x1B[${-t5}D`);
16779
- };
16780
- (t4 !== this._lastCursorRow || e4 !== this._lastCursorCol) && ((r2 = t4 - this._lastCursorRow) > 0 ? s2 += `\x1B[${r2}B` : r2 < 0 && (s2 += `\x1B[${-r2}A`), i3(e4 - this._lastCursorCol));
16781
- }
16782
- var r2;
16783
- const i2 = this._terminal._core._inputHandler._curAttrData, o2 = this._diffStyle(i2, this._cursorStyle);
16784
- return o2.length > 0 && (s2 += `\x1B[${o2.join(";")}m`), s2;
16785
- }
16786
- }
16787
- t2.SerializeAddon = class {
16788
- activate(t3) {
16789
- this._terminal = t3;
16790
- }
16791
- _serializeBufferByScrollback(t3, e3, s2) {
16792
- const r2 = e3.length, o2 = void 0 === s2 ? r2 : i(s2 + t3.rows, 0, r2);
16793
- return this._serializeBufferByRange(t3, e3, { start: r2 - o2, end: r2 - 1 }, false);
16794
- }
16795
- _serializeBufferByRange(t3, e3, s2, r2) {
16796
- return new u(e3, t3).serialize({ start: { x: 0, y: "number" == typeof s2.start ? s2.start : s2.start.line }, end: { x: t3.cols, y: "number" == typeof s2.end ? s2.end : s2.end.line } }, r2);
16797
- }
16798
- _serializeBufferAsHTML(t3, e3) {
16799
- const s2 = t3.buffer.active, r2 = new h(s2, t3, e3), o2 = e3.onlySelection ?? false, n2 = e3.range;
16800
- if (n2) return r2.serialize({ start: { x: n2.startCol, y: (n2.startLine, n2.startLine) }, end: { x: t3.cols, y: (n2.endLine, n2.endLine) } });
16801
- if (!o2) {
16802
- const o3 = s2.length, n3 = e3.scrollback, l3 = void 0 === n3 ? o3 : i(n3 + t3.rows, 0, o3);
16803
- return r2.serialize({ start: { x: 0, y: o3 - l3 }, end: { x: t3.cols, y: o3 - 1 } });
16804
- }
16805
- const l2 = this._terminal?.getSelectionPosition();
16806
- return void 0 !== l2 ? r2.serialize({ start: { x: l2.start.x, y: l2.start.y }, end: { x: l2.end.x, y: l2.end.y } }) : "";
16807
- }
16808
- _serializeModes(t3) {
16809
- let e3 = "";
16810
- const s2 = t3.modes;
16811
- if (s2.applicationCursorKeysMode && (e3 += "\x1B[?1h"), s2.applicationKeypadMode && (e3 += "\x1B[?66h"), s2.bracketedPasteMode && (e3 += "\x1B[?2004h"), s2.insertMode && (e3 += "\x1B[4h"), s2.originMode && (e3 += "\x1B[?6h"), s2.reverseWraparoundMode && (e3 += "\x1B[?45h"), s2.sendFocusMode && (e3 += "\x1B[?1004h"), false === s2.wraparoundMode && (e3 += "\x1B[?7l"), "none" !== s2.mouseTrackingMode) switch (s2.mouseTrackingMode) {
16812
- case "x10":
16813
- e3 += "\x1B[?9h";
16814
- break;
16815
- case "vt200":
16816
- e3 += "\x1B[?1000h";
16817
- break;
16818
- case "drag":
16819
- e3 += "\x1B[?1002h";
16820
- break;
16821
- case "any":
16822
- e3 += "\x1B[?1003h";
16823
- }
16824
- return e3;
16825
- }
16826
- serialize(t3) {
16827
- if (!this._terminal) throw new Error("Cannot use addon until it has been loaded");
16828
- let e3 = t3?.range ? this._serializeBufferByRange(this._terminal, this._terminal.buffer.normal, t3.range, true) : this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.normal, t3?.scrollback);
16829
- return t3?.excludeAltBuffer || "alternate" !== this._terminal.buffer.active.type || (e3 += `\x1B[?1049h\x1B[H${this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.alternate, void 0)}`), t3?.excludeModes || (e3 += this._serializeModes(this._terminal)), e3;
16830
- }
16831
- serializeAsHTML(t3) {
16832
- if (!this._terminal) throw new Error("Cannot use addon until it has been loaded");
16833
- return this._serializeBufferAsHTML(this._terminal, t3 || {});
16834
- }
16835
- dispose() {
16836
- }
16837
- };
16838
- class h extends o {
16839
- constructor(t3, s2, r2) {
16840
- super(t3), this._terminal = s2, this._options = r2, this._currentRow = "", this._htmlContent = "", s2._core._themeService ? this._ansiColors = s2._core._themeService.colors.ansi : this._ansiColors = e2.DEFAULT_ANSI_COLORS;
16841
- }
16842
- _padStart(t3, e3, s2) {
16843
- return e3 |= 0, s2 = s2 ?? " ", t3.length > e3 ? t3 : ((e3 -= t3.length) > s2.length && (s2 += s2.repeat(e3 / s2.length)), s2.slice(0, e3) + t3);
16844
- }
16845
- _beforeSerialize(t3, e3, s2) {
16846
- this._htmlContent += "<html><body><!--StartFragment--><pre>";
16847
- let r2 = "#000000", i2 = "#ffffff";
16848
- this._options.includeGlobalBackground && (r2 = this._terminal.options.theme?.foreground ?? "#ffffff", i2 = this._terminal.options.theme?.background ?? "#000000");
16849
- const o2 = [];
16850
- o2.push("color: " + r2 + ";"), o2.push("background-color: " + i2 + ";"), o2.push("font-family: " + this._terminal.options.fontFamily + ";"), o2.push("font-size: " + this._terminal.options.fontSize + "px;"), this._htmlContent += "<div style='" + o2.join(" ") + "'>";
16851
- }
16852
- _afterSerialize() {
16853
- this._htmlContent += "</div>", this._htmlContent += "</pre><!--EndFragment--></body></html>";
16854
- }
16855
- _rowEnd(t3, e3) {
16856
- this._htmlContent += "<div><span>" + this._currentRow + "</span></div>", this._currentRow = "";
16857
- }
16858
- _getHexColor(t3, e3) {
16859
- const s2 = e3 ? t3.getFgColor() : t3.getBgColor();
16860
- return (e3 ? t3.isFgRGB() : t3.isBgRGB()) ? "#" + [s2 >> 16 & 255, s2 >> 8 & 255, 255 & s2].map(((t4) => this._padStart(t4.toString(16), 2, "0"))).join("") : (e3 ? t3.isFgPalette() : t3.isBgPalette()) ? this._ansiColors[s2].css : void 0;
16861
- }
16862
- _diffStyle(t3, e3) {
16863
- const s2 = [], r2 = !n(t3, e3), i2 = !l(t3, e3), o2 = !a(t3, e3);
16864
- if (r2 || i2 || o2) {
16865
- const e4 = this._getHexColor(t3, true);
16866
- e4 && s2.push("color: " + e4 + ";");
16867
- const r3 = this._getHexColor(t3, false);
16868
- return r3 && s2.push("background-color: " + r3 + ";"), t3.isInverse() && s2.push("color: #000000; background-color: #BFBFBF;"), t3.isBold() && s2.push("font-weight: bold;"), t3.isUnderline() && t3.isOverline() ? s2.push("text-decoration: overline underline;") : t3.isUnderline() ? s2.push("text-decoration: underline;") : t3.isOverline() && s2.push("text-decoration: overline;"), t3.isBlink() && s2.push("text-decoration: blink;"), t3.isInvisible() && s2.push("visibility: hidden;"), t3.isItalic() && s2.push("font-style: italic;"), t3.isDim() && s2.push("opacity: 0.5;"), t3.isStrikethrough() && s2.push("text-decoration: line-through;"), s2;
16869
- }
16870
- }
16871
- _nextCell(t3, e3, s2, r2) {
16872
- if (0 === t3.getWidth()) return;
16873
- const i2 = "" === t3.getChars(), o2 = this._diffStyle(t3, e3);
16874
- o2 && (this._currentRow += 0 === o2.length ? "</span><span>" : "</span><span style='" + o2.join(" ") + "'>"), this._currentRow += i2 ? " " : (function(t4) {
16875
- switch (t4) {
16876
- case "&":
16877
- return "&amp;";
16878
- case "<":
16879
- return "&lt;";
16880
- }
16881
- return t4;
16882
- })(t3.getChars());
16883
- }
16884
- _serializeString() {
16885
- return this._htmlContent;
16886
- }
16887
- }
16888
- t2.HTMLSerializeHandler = h;
16889
- })(), r;
16890
- })()));
16891
- }
16892
- });
16893
-
16894
16528
  // ../node_modules/.pnpm/@lydell+node-pty@1.2.0-beta.12/node_modules/@lydell/node-pty/package.json
16895
16529
  var require_package2 = __commonJS({
16896
16530
  "../node_modules/.pnpm/@lydell+node-pty@1.2.0-beta.12/node_modules/@lydell/node-pty/package.json"(exports2, module2) {
@@ -18723,7 +18357,7 @@ var require_sender = __commonJS({
18723
18357
  const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
18724
18358
  this._bufferedBytes += options[kByteLength];
18725
18359
  this._state = DEFLATING;
18726
- perMessageDeflate.compress(data, options.fin, (_, buf) => {
18360
+ perMessageDeflate.compress(data, options.fin, (_2, buf) => {
18727
18361
  if (this._socket.destroyed) {
18728
18362
  const err = new Error(
18729
18363
  "The socket was closed while data was being compressed"
@@ -19163,10 +18797,10 @@ var require_extension = __commonJS({
19163
18797
  if (!Array.isArray(configurations)) configurations = [configurations];
19164
18798
  return configurations.map((params) => {
19165
18799
  return [extension2].concat(
19166
- Object.keys(params).map((k) => {
19167
- let values = params[k];
18800
+ Object.keys(params).map((k2) => {
18801
+ let values = params[k2];
19168
18802
  if (!Array.isArray(values)) values = [values];
19169
- return values.map((v) => v === true ? k : `${k}=${v}`).join("; ");
18803
+ return values.map((v2) => v2 === true ? k2 : `${k2}=${v2}`).join("; ");
19170
18804
  })
19171
18805
  ).join("; ");
19172
18806
  }).join(", ");
@@ -20882,9 +20516,9 @@ function parseRunCaseArgs(argv) {
20882
20516
  for (let i = 0; i < argv.length; i++) {
20883
20517
  const a = argv[i];
20884
20518
  const next = () => {
20885
- const v = argv[++i];
20886
- if (v === void 0) throw new Error(`missing value for ${a}`);
20887
- return v;
20519
+ const v2 = argv[++i];
20520
+ if (v2 === void 0) throw new Error(`missing value for ${a}`);
20521
+ return v2;
20888
20522
  };
20889
20523
  switch (a) {
20890
20524
  case "--record":
@@ -20987,11 +20621,11 @@ function parseArgs(argv) {
20987
20621
  out.config = next();
20988
20622
  break;
20989
20623
  case "--log-level": {
20990
- const v = next();
20991
- if (!["debug", "info", "warn", "error"].includes(v)) {
20992
- throw new Error(`invalid --log-level value: ${v}`);
20624
+ const v2 = next();
20625
+ if (!["debug", "info", "warn", "error"].includes(v2)) {
20626
+ throw new Error(`invalid --log-level value: ${v2}`);
20993
20627
  }
20994
- out.logLevel = v;
20628
+ out.logLevel = v2;
20995
20629
  break;
20996
20630
  }
20997
20631
  case "--tunnel":
@@ -21022,16 +20656,16 @@ function resolveDataDir(argsDataDir, home) {
21022
20656
  if (argsDataDir && argsDataDir.trim()) return import_node_path.default.resolve(argsDataDir);
21023
20657
  return import_node_path.default.join(home, ".clawd");
21024
20658
  }
21025
- function readConfigFile(p) {
20659
+ function readConfigFile(p2) {
21026
20660
  try {
21027
- const text = import_node_fs.default.readFileSync(p, "utf8");
20661
+ const text = import_node_fs.default.readFileSync(p2, "utf8");
21028
20662
  const json = JSON.parse(text);
21029
20663
  if (json && typeof json === "object") return json;
21030
20664
  return {};
21031
20665
  } catch (err) {
21032
20666
  const code = err?.code;
21033
20667
  if (code === "ENOENT") return {};
21034
- throw new Error(`failed to read config ${p}: ${err.message}`);
20668
+ throw new Error(`failed to read config ${p2}: ${err.message}`);
21035
20669
  }
21036
20670
  }
21037
20671
  function resolveConfig(opts) {
@@ -21235,7 +20869,7 @@ var SessionStore = class {
21235
20869
  continue;
21236
20870
  }
21237
20871
  }
21238
- return out.sort((a, b) => a.updatedAt > b.updatedAt ? -1 : a.updatedAt < b.updatedAt ? 1 : 0);
20872
+ return out.sort((a, b2) => a.updatedAt > b2.updatedAt ? -1 : a.updatedAt < b2.updatedAt ? 1 : 0);
21239
20873
  }
21240
20874
  };
21241
20875
 
@@ -21417,20 +21051,20 @@ function sessionInfoFrame(file) {
21417
21051
  const frame = { type: "session:info", ...file };
21418
21052
  return { kind: "emit-frame", frame, target: "all" };
21419
21053
  }
21420
- function eqContextUsage(a, b) {
21421
- if (a === b) return true;
21422
- if (!a || !b) return false;
21423
- return a.inputTokens === b.inputTokens && a.outputTokens === b.outputTokens && a.cacheReadTokens === b.cacheReadTokens && a.cacheCreateTokens === b.cacheCreateTokens;
21054
+ function eqContextUsage(a, b2) {
21055
+ if (a === b2) return true;
21056
+ if (!a || !b2) return false;
21057
+ return a.inputTokens === b2.inputTokens && a.outputTokens === b2.outputTokens && a.cacheReadTokens === b2.cacheReadTokens && a.cacheCreateTokens === b2.cacheCreateTokens;
21424
21058
  }
21425
- function shallowEqMeta(a, b) {
21426
- return a.gitBranch === b.gitBranch && a.resolvedModel === b.resolvedModel && a.contextWindowSize === b.contextWindowSize && eqContextUsage(a.contextUsage, b.contextUsage);
21059
+ function shallowEqMeta(a, b2) {
21060
+ return a.gitBranch === b2.gitBranch && a.resolvedModel === b2.resolvedModel && a.contextWindowSize === b2.contextWindowSize && eqContextUsage(a.contextUsage, b2.contextUsage);
21427
21061
  }
21428
21062
  function applyMetaUpdate(state, patch, deps) {
21429
21063
  const next = cloneState(state);
21430
21064
  const merged = { ...next.file, ...patch };
21431
21065
  if (patch.resolvedModel !== void 0) {
21432
- const w = deps.resolveContextWindow?.(next.file.tool, patch.resolvedModel);
21433
- if (w !== void 0) merged.contextWindowSize = w;
21066
+ const w2 = deps.resolveContextWindow?.(next.file.tool, patch.resolvedModel);
21067
+ if (w2 !== void 0) merged.contextWindowSize = w2;
21434
21068
  }
21435
21069
  if (shallowEqMeta(next.file, merged)) {
21436
21070
  return { state: next, effects: [] };
@@ -21572,10 +21206,10 @@ var RUNTIME_PATCH_KEYS = [
21572
21206
  var MARKER_PATCH_KEYS = ["pinnedAt", "pinSortOrder"];
21573
21207
  function isMarkerOnlyPatch(patch) {
21574
21208
  const keys = Object.keys(patch).filter(
21575
- (k) => patch[k] !== void 0
21209
+ (k2) => patch[k2] !== void 0
21576
21210
  );
21577
21211
  if (keys.length === 0) return false;
21578
- return keys.every((k) => MARKER_PATCH_KEYS.includes(k));
21212
+ return keys.every((k2) => MARKER_PATCH_KEYS.includes(k2));
21579
21213
  }
21580
21214
  function applyCommand(state, command, deps) {
21581
21215
  const next = cloneState(state);
@@ -21681,7 +21315,7 @@ function applyCommand(state, command, deps) {
21681
21315
  case "update": {
21682
21316
  const patch = command.patch;
21683
21317
  const runtimePatch = RUNTIME_PATCH_KEYS.some(
21684
- (k) => patch[k] !== void 0
21318
+ (k2) => patch[k2] !== void 0
21685
21319
  );
21686
21320
  const markerOnly = isMarkerOnlyPatch(patch);
21687
21321
  next.file = markerOnly ? { ...next.file, ...patch } : { ...next.file, ...patch, updatedAt: nowIso(deps) };
@@ -21947,12 +21581,12 @@ function reduceSession(state, input, deps) {
21947
21581
  const now = input.nowMs;
21948
21582
  const keep = {};
21949
21583
  let removed = 0;
21950
- for (const [rid, p] of Object.entries(state.pendingPermissions)) {
21951
- if (now - p.createdAt > staleMs) {
21584
+ for (const [rid, p2] of Object.entries(state.pendingPermissions)) {
21585
+ if (now - p2.createdAt > staleMs) {
21952
21586
  removed++;
21953
21587
  continue;
21954
21588
  }
21955
- keep[rid] = p;
21589
+ keep[rid] = p2;
21956
21590
  }
21957
21591
  if (removed === 0) return { state, effects: [] };
21958
21592
  const next = cloneState(state);
@@ -22118,7 +21752,7 @@ var SessionRunner = class {
22118
21752
  if (!this.state.procAlive && this.stopWaiters.length > 0) {
22119
21753
  const waiters = this.stopWaiters;
22120
21754
  this.stopWaiters = [];
22121
- for (const w of waiters) w();
21755
+ for (const w2 of waiters) w2();
22122
21756
  }
22123
21757
  }
22124
21758
  // 等子进程退出(procAlive=false)。manager.stop 在发完 SIGTERM 后调它确保
@@ -22224,10 +21858,10 @@ var SessionRunner = class {
22224
21858
  }
22225
21859
  // 统一清理所有 pending control_requests(子进程退出 / session delete)
22226
21860
  rejectAllPending(err) {
22227
- for (const [, p] of this.pendingControlRequests) {
22228
- clearTimeout(p.timer);
21861
+ for (const [, p2] of this.pendingControlRequests) {
21862
+ clearTimeout(p2.timer);
22229
21863
  try {
22230
- p.reject(err);
21864
+ p2.reject(err);
22231
21865
  } catch {
22232
21866
  }
22233
21867
  }
@@ -22535,7 +22169,7 @@ var SessionManager = class {
22535
22169
  out.push(...ownerStore.list());
22536
22170
  }
22537
22171
  return out.sort(
22538
- (a, b) => a.updatedAt > b.updatedAt ? -1 : a.updatedAt < b.updatedAt ? 1 : 0
22172
+ (a, b2) => a.updatedAt > b2.updatedAt ? -1 : a.updatedAt < b2.updatedAt ? 1 : 0
22539
22173
  );
22540
22174
  }
22541
22175
  // 写回 SessionFile,自动根据 ownerPersonaId 派生写入 scope。
@@ -22739,7 +22373,7 @@ var SessionManager = class {
22739
22373
  args.orderedIds.forEach((sessionId, index) => {
22740
22374
  const runner = this.runners.get(sessionId);
22741
22375
  if (runner) {
22742
- const { value, broadcast: b } = this.withCollector(() => {
22376
+ const { value, broadcast: b2 } = this.withCollector(() => {
22743
22377
  runner.input({
22744
22378
  kind: "command",
22745
22379
  command: { kind: "update", patch: { pinSortOrder: index } }
@@ -22747,7 +22381,7 @@ var SessionManager = class {
22747
22381
  return runner.getState().file;
22748
22382
  });
22749
22383
  updatedFiles.push(value);
22750
- broadcast.push(...b);
22384
+ broadcast.push(...b2);
22751
22385
  } else {
22752
22386
  const existing = this.getFile(sessionId);
22753
22387
  const updated = { ...existing, pinSortOrder: index };
@@ -22774,7 +22408,7 @@ var SessionManager = class {
22774
22408
  let map = this.realUuidBySynth.get(args.sessionId);
22775
22409
  if (map && map.has(args.realUuid)) return;
22776
22410
  if (map) {
22777
- for (const v of map.values()) if (v === args.realUuid) return;
22411
+ for (const v2 of map.values()) if (v2 === args.realUuid) return;
22778
22412
  }
22779
22413
  const buffer = runner.getState().buffer;
22780
22414
  let matchedSynth = null;
@@ -23625,28 +23259,28 @@ var PersonaStore = class {
23625
23259
  this.atomicWrite(this.metaPath(persona.personaId), JSON.stringify(persona, null, 2));
23626
23260
  }
23627
23261
  read(personaId) {
23628
- const p = this.metaPath(personaId);
23629
- if (!fs6.existsSync(p)) return null;
23630
- const raw = JSON.parse(fs6.readFileSync(p, "utf8"));
23262
+ const p2 = this.metaPath(personaId);
23263
+ if (!fs6.existsSync(p2)) return null;
23264
+ const raw = JSON.parse(fs6.readFileSync(p2, "utf8"));
23631
23265
  return PersonaFileSchema.parse(raw);
23632
23266
  }
23633
23267
  has(personaId) {
23634
23268
  return fs6.existsSync(this.metaPath(personaId));
23635
23269
  }
23636
23270
  readPersonality(personaId) {
23637
- const p = this.claudeMdPath(personaId);
23638
- if (!fs6.existsSync(p)) return null;
23639
- return fs6.readFileSync(p, "utf8");
23271
+ const p2 = this.claudeMdPath(personaId);
23272
+ if (!fs6.existsSync(p2)) return null;
23273
+ return fs6.readFileSync(p2, "utf8");
23640
23274
  }
23641
23275
  /**
23642
23276
  * 读 sandbox-settings.json 当前内容;文件不存在 / JSON 解析失败均返回 null。
23643
23277
  * owner 手改文件可能写出非法形状,daemon 不强校验,UI 拿到 null → 显示空状态。
23644
23278
  */
23645
23279
  readSandboxSettings(personaId) {
23646
- const p = this.sandboxSettingsPath(personaId);
23647
- if (!fs6.existsSync(p)) return null;
23280
+ const p2 = this.sandboxSettingsPath(personaId);
23281
+ if (!fs6.existsSync(p2)) return null;
23648
23282
  try {
23649
- return JSON.parse(fs6.readFileSync(p, "utf8"));
23283
+ return JSON.parse(fs6.readFileSync(p2, "utf8"));
23650
23284
  } catch {
23651
23285
  return null;
23652
23286
  }
@@ -23687,8 +23321,8 @@ var PersonaRegistry = class {
23687
23321
  reload() {
23688
23322
  this.cache.clear();
23689
23323
  for (const id of this.store.list()) {
23690
- const p = this.store.read(id);
23691
- if (p) this.cache.set(p.personaId, p);
23324
+ const p2 = this.store.read(id);
23325
+ if (p2) this.cache.set(p2.personaId, p2);
23692
23326
  }
23693
23327
  }
23694
23328
  get(personaId) {
@@ -23828,9 +23462,9 @@ function parseDescription(content) {
23828
23462
  const fields = parseFrontmatter(content, ["description"]);
23829
23463
  return { description: fields.description ?? "" };
23830
23464
  }
23831
- function isDirLikeSync(p) {
23465
+ function isDirLikeSync(p2) {
23832
23466
  try {
23833
- return import_node_fs6.default.statSync(p).isDirectory();
23467
+ return import_node_fs6.default.statSync(p2).isDirectory();
23834
23468
  } catch {
23835
23469
  return false;
23836
23470
  }
@@ -23967,13 +23601,13 @@ var SkillsScanner = class {
23967
23601
  list(args) {
23968
23602
  const seen = /* @__PURE__ */ new Set();
23969
23603
  const builtinBlock = [];
23970
- for (const b of BUILTIN_SKILLS) {
23971
- if (seen.has(b.name)) continue;
23972
- seen.add(b.name);
23604
+ for (const b2 of BUILTIN_SKILLS) {
23605
+ if (seen.has(b2.name)) continue;
23606
+ seen.add(b2.name);
23973
23607
  builtinBlock.push({
23974
- name: b.name,
23608
+ name: b2.name,
23975
23609
  source: "builtin",
23976
- description: b.description
23610
+ description: b2.description
23977
23611
  });
23978
23612
  }
23979
23613
  const fsBlock = [];
@@ -23986,7 +23620,7 @@ var SkillsScanner = class {
23986
23620
  scanSkillDir(import_node_path7.default.join(root, "skills"), "plugin", seen, fsBlock, name);
23987
23621
  scanCommandDir(import_node_path7.default.join(root, "commands"), "plugin", seen, fsBlock, name);
23988
23622
  }
23989
- fsBlock.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
23623
+ fsBlock.sort((a, b2) => a.name < b2.name ? -1 : a.name > b2.name ? 1 : 0);
23990
23624
  return [...builtinBlock, ...fsBlock];
23991
23625
  }
23992
23626
  };
@@ -24300,8 +23934,417 @@ init_claude();
24300
23934
  var import_node_fs9 = __toESM(require("fs"), 1);
24301
23935
  var import_node_os5 = __toESM(require("os"), 1);
24302
23936
  var import_node_path10 = __toESM(require("path"), 1);
24303
- var headlessNs = __toESM(require_xterm_headless(), 1);
24304
- var serializeNs = __toESM(require_addon_serialize(), 1);
23937
+ var import_headless = __toESM(require_xterm_headless(), 1);
23938
+
23939
+ // ../node_modules/.pnpm/@xterm+addon-serialize@0.14.0/node_modules/@xterm/addon-serialize/lib/addon-serialize.mjs
23940
+ var m = 0;
23941
+ var p = 0;
23942
+ var g = 0;
23943
+ var b = 0;
23944
+ var I;
23945
+ ((r) => {
23946
+ function u(t, a, s, i) {
23947
+ return i !== void 0 ? `#${B(t)}${B(a)}${B(s)}${B(i)}` : `#${B(t)}${B(a)}${B(s)}`;
23948
+ }
23949
+ r.toCss = u;
23950
+ function o(t, a, s, i = 255) {
23951
+ return (t << 24 | a << 16 | s << 8 | i) >>> 0;
23952
+ }
23953
+ r.toRgba = o;
23954
+ function e(t, a, s, i) {
23955
+ return { css: r.toCss(t, a, s, i), rgba: r.toRgba(t, a, s, i) };
23956
+ }
23957
+ r.toColor = e;
23958
+ })(I ||= {});
23959
+ var $;
23960
+ ((i) => {
23961
+ function u(n, l) {
23962
+ if (b = (l.rgba & 255) / 255, b === 1) return { css: l.css, rgba: l.rgba };
23963
+ let f = l.rgba >> 24 & 255, d = l.rgba >> 16 & 255, c = l.rgba >> 8 & 255, C = n.rgba >> 24 & 255, h = n.rgba >> 16 & 255, x = n.rgba >> 8 & 255;
23964
+ m = C + Math.round((f - C) * b), p = h + Math.round((d - h) * b), g = x + Math.round((c - x) * b);
23965
+ let R = I.toCss(m, p, g), L = I.toRgba(m, p, g);
23966
+ return { css: R, rgba: L };
23967
+ }
23968
+ i.blend = u;
23969
+ function o(n) {
23970
+ return (n.rgba & 255) === 255;
23971
+ }
23972
+ i.isOpaque = o;
23973
+ function e(n, l, f) {
23974
+ let d = y.ensureContrastRatio(n.rgba, l.rgba, f);
23975
+ if (d) return I.toColor(d >> 24 & 255, d >> 16 & 255, d >> 8 & 255);
23976
+ }
23977
+ i.ensureContrastRatio = e;
23978
+ function r(n) {
23979
+ let l = (n.rgba | 255) >>> 0;
23980
+ return [m, p, g] = y.toChannels(l), { css: I.toCss(m, p, g), rgba: l };
23981
+ }
23982
+ i.opaque = r;
23983
+ function t(n, l) {
23984
+ return b = Math.round(l * 255), [m, p, g] = y.toChannels(n.rgba), { css: I.toCss(m, p, g, b), rgba: I.toRgba(m, p, g, b) };
23985
+ }
23986
+ i.opacity = t;
23987
+ function a(n, l) {
23988
+ return b = n.rgba & 255, t(n, b * l / 255);
23989
+ }
23990
+ i.multiplyOpacity = a;
23991
+ function s(n) {
23992
+ return [n.rgba >> 24 & 255, n.rgba >> 16 & 255, n.rgba >> 8 & 255];
23993
+ }
23994
+ i.toColorRGB = s;
23995
+ })($ ||= {});
23996
+ var _;
23997
+ ((r) => {
23998
+ let u, o;
23999
+ try {
24000
+ let t = document.createElement("canvas");
24001
+ t.width = 1, t.height = 1;
24002
+ let a = t.getContext("2d", { willReadFrequently: true });
24003
+ a && (u = a, u.globalCompositeOperation = "copy", o = u.createLinearGradient(0, 0, 1, 1));
24004
+ } catch {
24005
+ }
24006
+ function e(t) {
24007
+ if (t.match(/#[\da-f]{3,8}/i)) switch (t.length) {
24008
+ case 4:
24009
+ return m = parseInt(t.slice(1, 2).repeat(2), 16), p = parseInt(t.slice(2, 3).repeat(2), 16), g = parseInt(t.slice(3, 4).repeat(2), 16), I.toColor(m, p, g);
24010
+ case 5:
24011
+ return m = parseInt(t.slice(1, 2).repeat(2), 16), p = parseInt(t.slice(2, 3).repeat(2), 16), g = parseInt(t.slice(3, 4).repeat(2), 16), b = parseInt(t.slice(4, 5).repeat(2), 16), I.toColor(m, p, g, b);
24012
+ case 7:
24013
+ return { css: t, rgba: (parseInt(t.slice(1), 16) << 8 | 255) >>> 0 };
24014
+ case 9:
24015
+ return { css: t, rgba: parseInt(t.slice(1), 16) >>> 0 };
24016
+ }
24017
+ let a = t.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);
24018
+ if (a) return m = parseInt(a[1]), p = parseInt(a[2]), g = parseInt(a[3]), b = Math.round((a[5] === void 0 ? 1 : parseFloat(a[5])) * 255), I.toColor(m, p, g, b);
24019
+ if (!u || !o) throw new Error("css.toColor: Unsupported css format");
24020
+ if (u.fillStyle = o, u.fillStyle = t, typeof u.fillStyle != "string") throw new Error("css.toColor: Unsupported css format");
24021
+ if (u.fillRect(0, 0, 1, 1), [m, p, g, b] = u.getImageData(0, 0, 1, 1).data, b !== 255) throw new Error("css.toColor: Unsupported css format");
24022
+ return { rgba: I.toRgba(m, p, g, b), css: t };
24023
+ }
24024
+ r.toColor = e;
24025
+ })(_ ||= {});
24026
+ var v;
24027
+ ((e) => {
24028
+ function u(r) {
24029
+ return o(r >> 16 & 255, r >> 8 & 255, r & 255);
24030
+ }
24031
+ e.relativeLuminance = u;
24032
+ function o(r, t, a) {
24033
+ let s = r / 255, i = t / 255, n = a / 255, l = s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4), f = i <= 0.03928 ? i / 12.92 : Math.pow((i + 0.055) / 1.055, 2.4), d = n <= 0.03928 ? n / 12.92 : Math.pow((n + 0.055) / 1.055, 2.4);
24034
+ return l * 0.2126 + f * 0.7152 + d * 0.0722;
24035
+ }
24036
+ e.relativeLuminance2 = o;
24037
+ })(v ||= {});
24038
+ var y;
24039
+ ((a) => {
24040
+ function u(s, i) {
24041
+ if (b = (i & 255) / 255, b === 1) return i;
24042
+ let n = i >> 24 & 255, l = i >> 16 & 255, f = i >> 8 & 255, d = s >> 24 & 255, c = s >> 16 & 255, C = s >> 8 & 255;
24043
+ return m = d + Math.round((n - d) * b), p = c + Math.round((l - c) * b), g = C + Math.round((f - C) * b), I.toRgba(m, p, g);
24044
+ }
24045
+ a.blend = u;
24046
+ function o(s, i, n) {
24047
+ let l = v.relativeLuminance(s >> 8), f = v.relativeLuminance(i >> 8);
24048
+ if (F(l, f) < n) {
24049
+ if (f < l) {
24050
+ let h = e(s, i, n), x = F(l, v.relativeLuminance(h >> 8));
24051
+ if (x < n) {
24052
+ let R = r(s, i, n), L = F(l, v.relativeLuminance(R >> 8));
24053
+ return x > L ? h : R;
24054
+ }
24055
+ return h;
24056
+ }
24057
+ let c = r(s, i, n), C = F(l, v.relativeLuminance(c >> 8));
24058
+ if (C < n) {
24059
+ let h = e(s, i, n), x = F(l, v.relativeLuminance(h >> 8));
24060
+ return C > x ? c : h;
24061
+ }
24062
+ return c;
24063
+ }
24064
+ }
24065
+ a.ensureContrastRatio = o;
24066
+ function e(s, i, n) {
24067
+ let l = s >> 24 & 255, f = s >> 16 & 255, d = s >> 8 & 255, c = i >> 24 & 255, C = i >> 16 & 255, h = i >> 8 & 255, x = F(v.relativeLuminance2(c, C, h), v.relativeLuminance2(l, f, d));
24068
+ for (; x < n && (c > 0 || C > 0 || h > 0); ) c -= Math.max(0, Math.ceil(c * 0.1)), C -= Math.max(0, Math.ceil(C * 0.1)), h -= Math.max(0, Math.ceil(h * 0.1)), x = F(v.relativeLuminance2(c, C, h), v.relativeLuminance2(l, f, d));
24069
+ return (c << 24 | C << 16 | h << 8 | 255) >>> 0;
24070
+ }
24071
+ a.reduceLuminance = e;
24072
+ function r(s, i, n) {
24073
+ let l = s >> 24 & 255, f = s >> 16 & 255, d = s >> 8 & 255, c = i >> 24 & 255, C = i >> 16 & 255, h = i >> 8 & 255, x = F(v.relativeLuminance2(c, C, h), v.relativeLuminance2(l, f, d));
24074
+ for (; x < n && (c < 255 || C < 255 || h < 255); ) c = Math.min(255, c + Math.ceil((255 - c) * 0.1)), C = Math.min(255, C + Math.ceil((255 - C) * 0.1)), h = Math.min(255, h + Math.ceil((255 - h) * 0.1)), x = F(v.relativeLuminance2(c, C, h), v.relativeLuminance2(l, f, d));
24075
+ return (c << 24 | C << 16 | h << 8 | 255) >>> 0;
24076
+ }
24077
+ a.increaseLuminance = r;
24078
+ function t(s) {
24079
+ return [s >> 24 & 255, s >> 16 & 255, s >> 8 & 255, s & 255];
24080
+ }
24081
+ a.toChannels = t;
24082
+ })(y ||= {});
24083
+ function B(u) {
24084
+ let o = u.toString(16);
24085
+ return o.length < 2 ? "0" + o : o;
24086
+ }
24087
+ function F(u, o) {
24088
+ return u < o ? (o + 0.05) / (u + 0.05) : (u + 0.05) / (o + 0.05);
24089
+ }
24090
+ var E = Object.freeze((() => {
24091
+ let u = [_.toColor("#2e3436"), _.toColor("#cc0000"), _.toColor("#4e9a06"), _.toColor("#c4a000"), _.toColor("#3465a4"), _.toColor("#75507b"), _.toColor("#06989a"), _.toColor("#d3d7cf"), _.toColor("#555753"), _.toColor("#ef2929"), _.toColor("#8ae234"), _.toColor("#fce94f"), _.toColor("#729fcf"), _.toColor("#ad7fa8"), _.toColor("#34e2e2"), _.toColor("#eeeeec")], o = [0, 95, 135, 175, 215, 255];
24092
+ for (let e = 0; e < 216; e++) {
24093
+ let r = o[e / 36 % 6 | 0], t = o[e / 6 % 6 | 0], a = o[e % 6];
24094
+ u.push({ css: I.toCss(r, t, a), rgba: I.toRgba(r, t, a) });
24095
+ }
24096
+ for (let e = 0; e < 24; e++) {
24097
+ let r = 8 + e * 10;
24098
+ u.push({ css: I.toCss(r, r, r), rgba: I.toRgba(r, r, r) });
24099
+ }
24100
+ return u;
24101
+ })());
24102
+ function A(u, o, e) {
24103
+ return Math.max(o, Math.min(u, e));
24104
+ }
24105
+ function O(u) {
24106
+ switch (u) {
24107
+ case "&":
24108
+ return "&amp;";
24109
+ case "<":
24110
+ return "&lt;";
24111
+ }
24112
+ return u;
24113
+ }
24114
+ var S = class {
24115
+ constructor(o) {
24116
+ this._buffer = o;
24117
+ }
24118
+ serialize(o, e) {
24119
+ let r = this._buffer.getNullCell(), t = this._buffer.getNullCell(), a = r, s = o.start.y, i = o.end.y, n = o.start.x, l = o.end.x;
24120
+ this._beforeSerialize(i - s, s, i);
24121
+ for (let f = s; f <= i; f++) {
24122
+ let d = this._buffer.getLine(f);
24123
+ if (d) {
24124
+ let c = f === o.start.y ? n : 0, C = f === o.end.y ? l : d.length;
24125
+ for (let h = c; h < C; h++) {
24126
+ let x = d.getCell(h, a === r ? t : r);
24127
+ if (!x) {
24128
+ console.warn(`Can't get cell at row=${f}, col=${h}`);
24129
+ continue;
24130
+ }
24131
+ this._nextCell(x, a, f, h), a = x;
24132
+ }
24133
+ }
24134
+ this._rowEnd(f, f === i);
24135
+ }
24136
+ return this._afterSerialize(), this._serializeString(e);
24137
+ }
24138
+ _nextCell(o, e, r, t) {
24139
+ }
24140
+ _rowEnd(o, e) {
24141
+ }
24142
+ _beforeSerialize(o, e, r) {
24143
+ }
24144
+ _afterSerialize() {
24145
+ }
24146
+ _serializeString(o) {
24147
+ return "";
24148
+ }
24149
+ };
24150
+ function T(u, o) {
24151
+ return u.getFgColorMode() === o.getFgColorMode() && u.getFgColor() === o.getFgColor();
24152
+ }
24153
+ function w(u, o) {
24154
+ return u.getBgColorMode() === o.getBgColorMode() && u.getBgColor() === o.getBgColor();
24155
+ }
24156
+ function z(u, o) {
24157
+ return u.isInverse() === o.isInverse() && u.isBold() === o.isBold() && u.isUnderline() === o.isUnderline() && u.isOverline() === o.isOverline() && u.isBlink() === o.isBlink() && u.isInvisible() === o.isInvisible() && u.isItalic() === o.isItalic() && u.isDim() === o.isDim() && u.isStrikethrough() === o.isStrikethrough();
24158
+ }
24159
+ var k = class extends S {
24160
+ constructor(e, r) {
24161
+ super(e);
24162
+ this._terminal = r;
24163
+ this._rowIndex = 0;
24164
+ this._allRows = new Array();
24165
+ this._allRowSeparators = new Array();
24166
+ this._currentRow = "";
24167
+ this._nullCellCount = 0;
24168
+ this._cursorStyle = this._buffer.getNullCell();
24169
+ this._cursorStyleRow = 0;
24170
+ this._cursorStyleCol = 0;
24171
+ this._backgroundCell = this._buffer.getNullCell();
24172
+ this._firstRow = 0;
24173
+ this._lastCursorRow = 0;
24174
+ this._lastCursorCol = 0;
24175
+ this._lastContentCursorRow = 0;
24176
+ this._lastContentCursorCol = 0;
24177
+ this._thisRowLastChar = this._buffer.getNullCell();
24178
+ this._thisRowLastSecondChar = this._buffer.getNullCell();
24179
+ this._nextRowFirstChar = this._buffer.getNullCell();
24180
+ }
24181
+ _beforeSerialize(e, r, t) {
24182
+ this._allRows = new Array(e), this._lastContentCursorRow = r, this._lastCursorRow = r, this._firstRow = r;
24183
+ }
24184
+ _rowEnd(e, r) {
24185
+ this._nullCellCount > 0 && !w(this._cursorStyle, this._backgroundCell) && (this._currentRow += `\x1B[${this._nullCellCount}X`);
24186
+ let t = "";
24187
+ if (!r) {
24188
+ e - this._firstRow >= this._terminal.rows && this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol, this._backgroundCell);
24189
+ let a = this._buffer.getLine(e), s = this._buffer.getLine(e + 1);
24190
+ if (!s.isWrapped) t = `\r
24191
+ `, this._lastCursorRow = e + 1, this._lastCursorCol = 0;
24192
+ else {
24193
+ t = "";
24194
+ let i = a.getCell(a.length - 1, this._thisRowLastChar), n = a.getCell(a.length - 2, this._thisRowLastSecondChar), l = s.getCell(0, this._nextRowFirstChar), f = l.getWidth() > 1, d = false;
24195
+ (l.getChars() && f ? this._nullCellCount <= 1 : this._nullCellCount <= 0) && ((i.getChars() || i.getWidth() === 0) && w(i, l) && (d = true), f && (n.getChars() || n.getWidth() === 0) && w(i, l) && w(n, l) && (d = true)), d || (t = "-".repeat(this._nullCellCount + 1), t += "\x1B[1D\x1B[1X", this._nullCellCount > 0 && (t += "\x1B[A", t += `\x1B[${a.length - this._nullCellCount}C`, t += `\x1B[${this._nullCellCount}X`, t += `\x1B[${a.length - this._nullCellCount}D`, t += "\x1B[B"), this._lastContentCursorRow = e + 1, this._lastContentCursorCol = 0, this._lastCursorRow = e + 1, this._lastCursorCol = 0);
24196
+ }
24197
+ }
24198
+ this._allRows[this._rowIndex] = this._currentRow, this._allRowSeparators[this._rowIndex++] = t, this._currentRow = "", this._nullCellCount = 0;
24199
+ }
24200
+ _diffStyle(e, r) {
24201
+ let t = [], a = !T(e, r), s = !w(e, r), i = !z(e, r);
24202
+ if (a || s || i) if (e.isAttributeDefault()) r.isAttributeDefault() || t.push(0);
24203
+ else {
24204
+ if (a) {
24205
+ let n = e.getFgColor();
24206
+ e.isFgRGB() ? t.push(38, 2, n >>> 16 & 255, n >>> 8 & 255, n & 255) : e.isFgPalette() ? n >= 16 ? t.push(38, 5, n) : t.push(n & 8 ? 90 + (n & 7) : 30 + (n & 7)) : t.push(39);
24207
+ }
24208
+ if (s) {
24209
+ let n = e.getBgColor();
24210
+ e.isBgRGB() ? t.push(48, 2, n >>> 16 & 255, n >>> 8 & 255, n & 255) : e.isBgPalette() ? n >= 16 ? t.push(48, 5, n) : t.push(n & 8 ? 100 + (n & 7) : 40 + (n & 7)) : t.push(49);
24211
+ }
24212
+ i && (e.isInverse() !== r.isInverse() && t.push(e.isInverse() ? 7 : 27), e.isBold() !== r.isBold() && t.push(e.isBold() ? 1 : 22), e.isUnderline() !== r.isUnderline() && t.push(e.isUnderline() ? 4 : 24), e.isOverline() !== r.isOverline() && t.push(e.isOverline() ? 53 : 55), e.isBlink() !== r.isBlink() && t.push(e.isBlink() ? 5 : 25), e.isInvisible() !== r.isInvisible() && t.push(e.isInvisible() ? 8 : 28), e.isItalic() !== r.isItalic() && t.push(e.isItalic() ? 3 : 23), e.isDim() !== r.isDim() && t.push(e.isDim() ? 2 : 22), e.isStrikethrough() !== r.isStrikethrough() && t.push(e.isStrikethrough() ? 9 : 29));
24213
+ }
24214
+ return t;
24215
+ }
24216
+ _nextCell(e, r, t, a) {
24217
+ if (e.getWidth() === 0) return;
24218
+ let i = e.getChars() === "", n = this._diffStyle(e, this._cursorStyle);
24219
+ if (i ? !w(this._cursorStyle, e) : n.length > 0) {
24220
+ this._nullCellCount > 0 && (w(this._cursorStyle, this._backgroundCell) || (this._currentRow += `\x1B[${this._nullCellCount}X`), this._currentRow += `\x1B[${this._nullCellCount}C`, this._nullCellCount = 0), this._lastContentCursorRow = this._lastCursorRow = t, this._lastContentCursorCol = this._lastCursorCol = a, this._currentRow += `\x1B[${n.join(";")}m`;
24221
+ let f = this._buffer.getLine(t);
24222
+ f !== void 0 && (f.getCell(a, this._cursorStyle), this._cursorStyleRow = t, this._cursorStyleCol = a);
24223
+ }
24224
+ i ? this._nullCellCount += e.getWidth() : (this._nullCellCount > 0 && (w(this._cursorStyle, this._backgroundCell) ? this._currentRow += `\x1B[${this._nullCellCount}C` : (this._currentRow += `\x1B[${this._nullCellCount}X`, this._currentRow += `\x1B[${this._nullCellCount}C`), this._nullCellCount = 0), this._currentRow += e.getChars(), this._lastContentCursorRow = this._lastCursorRow = t, this._lastContentCursorCol = this._lastCursorCol = a + e.getWidth());
24225
+ }
24226
+ _serializeString(e) {
24227
+ let r = this._allRows.length;
24228
+ this._buffer.length - this._firstRow <= this._terminal.rows && (r = this._lastContentCursorRow + 1 - this._firstRow, this._lastCursorCol = this._lastContentCursorCol, this._lastCursorRow = this._lastContentCursorRow);
24229
+ let t = "";
24230
+ for (let i = 0; i < r; i++) t += this._allRows[i], i + 1 < r && (t += this._allRowSeparators[i]);
24231
+ if (!e) {
24232
+ let i = this._buffer.baseY + this._buffer.cursorY, n = this._buffer.cursorX, l = i !== this._lastCursorRow || n !== this._lastCursorCol, f = (c) => {
24233
+ c > 0 ? t += `\x1B[${c}C` : c < 0 && (t += `\x1B[${-c}D`);
24234
+ };
24235
+ l && (((c) => {
24236
+ c > 0 ? t += `\x1B[${c}B` : c < 0 && (t += `\x1B[${-c}A`);
24237
+ })(i - this._lastCursorRow), f(n - this._lastCursorCol));
24238
+ }
24239
+ let a = this._terminal._core._inputHandler._curAttrData, s = this._diffStyle(a, this._cursorStyle);
24240
+ return s.length > 0 && (t += `\x1B[${s.join(";")}m`), t;
24241
+ }
24242
+ };
24243
+ var D = class {
24244
+ activate(o) {
24245
+ this._terminal = o;
24246
+ }
24247
+ _serializeBufferByScrollback(o, e, r) {
24248
+ let t = e.length, a = r === void 0 ? t : A(r + o.rows, 0, t);
24249
+ return this._serializeBufferByRange(o, e, { start: t - a, end: t - 1 }, false);
24250
+ }
24251
+ _serializeBufferByRange(o, e, r, t) {
24252
+ return new k(e, o).serialize({ start: { x: 0, y: typeof r.start == "number" ? r.start : r.start.line }, end: { x: o.cols, y: typeof r.end == "number" ? r.end : r.end.line } }, t);
24253
+ }
24254
+ _serializeBufferAsHTML(o, e) {
24255
+ let r = o.buffer.active, t = new M(r, o, e), a = e.onlySelection ?? false, s = e.range;
24256
+ if (s) return t.serialize({ start: { x: s.startCol, y: (typeof s.startLine == "number", s.startLine) }, end: { x: o.cols, y: (typeof s.endLine == "number", s.endLine) } });
24257
+ if (!a) {
24258
+ let n = r.length, l = e.scrollback, f = l === void 0 ? n : A(l + o.rows, 0, n);
24259
+ return t.serialize({ start: { x: 0, y: n - f }, end: { x: o.cols, y: n - 1 } });
24260
+ }
24261
+ let i = this._terminal?.getSelectionPosition();
24262
+ return i !== void 0 ? t.serialize({ start: { x: i.start.x, y: i.start.y }, end: { x: i.end.x, y: i.end.y } }) : "";
24263
+ }
24264
+ _serializeModes(o) {
24265
+ let e = "", r = o.modes;
24266
+ if (r.applicationCursorKeysMode && (e += "\x1B[?1h"), r.applicationKeypadMode && (e += "\x1B[?66h"), r.bracketedPasteMode && (e += "\x1B[?2004h"), r.insertMode && (e += "\x1B[4h"), r.originMode && (e += "\x1B[?6h"), r.reverseWraparoundMode && (e += "\x1B[?45h"), r.sendFocusMode && (e += "\x1B[?1004h"), r.wraparoundMode === false && (e += "\x1B[?7l"), r.mouseTrackingMode !== "none") switch (r.mouseTrackingMode) {
24267
+ case "x10":
24268
+ e += "\x1B[?9h";
24269
+ break;
24270
+ case "vt200":
24271
+ e += "\x1B[?1000h";
24272
+ break;
24273
+ case "drag":
24274
+ e += "\x1B[?1002h";
24275
+ break;
24276
+ case "any":
24277
+ e += "\x1B[?1003h";
24278
+ break;
24279
+ }
24280
+ return e;
24281
+ }
24282
+ serialize(o) {
24283
+ if (!this._terminal) throw new Error("Cannot use addon until it has been loaded");
24284
+ let e = o?.range ? this._serializeBufferByRange(this._terminal, this._terminal.buffer.normal, o.range, true) : this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.normal, o?.scrollback);
24285
+ if (!o?.excludeAltBuffer && this._terminal.buffer.active.type === "alternate") {
24286
+ let r = this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.alternate, void 0);
24287
+ e += `\x1B[?1049h\x1B[H${r}`;
24288
+ }
24289
+ return o?.excludeModes || (e += this._serializeModes(this._terminal)), e;
24290
+ }
24291
+ serializeAsHTML(o) {
24292
+ if (!this._terminal) throw new Error("Cannot use addon until it has been loaded");
24293
+ return this._serializeBufferAsHTML(this._terminal, o || {});
24294
+ }
24295
+ dispose() {
24296
+ }
24297
+ };
24298
+ var M = class extends S {
24299
+ constructor(e, r, t) {
24300
+ super(e);
24301
+ this._terminal = r;
24302
+ this._options = t;
24303
+ this._currentRow = "";
24304
+ this._htmlContent = "";
24305
+ r._core._themeService ? this._ansiColors = r._core._themeService.colors.ansi : this._ansiColors = E;
24306
+ }
24307
+ _padStart(e, r, t) {
24308
+ return r = r >> 0, t = t ?? " ", e.length > r ? e : (r -= e.length, r > t.length && (t += t.repeat(r / t.length)), t.slice(0, r) + e);
24309
+ }
24310
+ _beforeSerialize(e, r, t) {
24311
+ this._htmlContent += "<html><body><!--StartFragment--><pre>";
24312
+ let a = "#000000", s = "#ffffff";
24313
+ (this._options.includeGlobalBackground ?? false) && (a = this._terminal.options.theme?.foreground ?? "#ffffff", s = this._terminal.options.theme?.background ?? "#000000");
24314
+ let i = [];
24315
+ i.push("color: " + a + ";"), i.push("background-color: " + s + ";"), i.push("font-family: " + this._terminal.options.fontFamily + ";"), i.push("font-size: " + this._terminal.options.fontSize + "px;"), this._htmlContent += "<div style='" + i.join(" ") + "'>";
24316
+ }
24317
+ _afterSerialize() {
24318
+ this._htmlContent += "</div>", this._htmlContent += "</pre><!--EndFragment--></body></html>";
24319
+ }
24320
+ _rowEnd(e, r) {
24321
+ this._htmlContent += "<div><span>" + this._currentRow + "</span></div>", this._currentRow = "";
24322
+ }
24323
+ _getHexColor(e, r) {
24324
+ let t = r ? e.getFgColor() : e.getBgColor();
24325
+ if (r ? e.isFgRGB() : e.isBgRGB()) return "#" + [t >> 16 & 255, t >> 8 & 255, t & 255].map((s) => this._padStart(s.toString(16), 2, "0")).join("");
24326
+ if (r ? e.isFgPalette() : e.isBgPalette()) return this._ansiColors[t].css;
24327
+ }
24328
+ _diffStyle(e, r) {
24329
+ let t = [], a = !T(e, r), s = !w(e, r), i = !z(e, r);
24330
+ if (a || s || i) {
24331
+ let n = this._getHexColor(e, true);
24332
+ n && t.push("color: " + n + ";");
24333
+ let l = this._getHexColor(e, false);
24334
+ return l && t.push("background-color: " + l + ";"), e.isInverse() && t.push("color: #000000; background-color: #BFBFBF;"), e.isBold() && t.push("font-weight: bold;"), e.isUnderline() && e.isOverline() ? t.push("text-decoration: overline underline;") : e.isUnderline() ? t.push("text-decoration: underline;") : e.isOverline() && t.push("text-decoration: overline;"), e.isBlink() && t.push("text-decoration: blink;"), e.isInvisible() && t.push("visibility: hidden;"), e.isItalic() && t.push("font-style: italic;"), e.isDim() && t.push("opacity: 0.5;"), e.isStrikethrough() && t.push("text-decoration: line-through;"), t;
24335
+ }
24336
+ }
24337
+ _nextCell(e, r, t, a) {
24338
+ if (e.getWidth() === 0) return;
24339
+ let i = e.getChars() === "", n = this._diffStyle(e, r);
24340
+ n && (this._currentRow += n.length === 0 ? "</span><span>" : "</span><span style='" + n.join(" ") + "'>"), i ? this._currentRow += " " : this._currentRow += O(e.getChars());
24341
+ }
24342
+ _serializeString() {
24343
+ return this._htmlContent;
24344
+ }
24345
+ };
24346
+
24347
+ // src/tools/claude-tui.ts
24305
24348
  init_claude();
24306
24349
  init_claude_history();
24307
24350
 
@@ -24477,8 +24520,7 @@ function spawnPty(opts) {
24477
24520
  }
24478
24521
 
24479
24522
  // src/tools/claude-tui.ts
24480
- var { Terminal } = headlessNs;
24481
- var { SerializeAddon } = serializeNs;
24523
+ var { Terminal } = import_headless.default;
24482
24524
  var POPUP_FOOTER_PATTERNS = [
24483
24525
  { kind: "permission", regex: /Tab to amend|Do you want to proceed/i },
24484
24526
  { kind: "question", regex: /Enter to select|↑\/↓ to navigate/i }
@@ -24490,7 +24532,7 @@ function createPopupDetector(opts) {
24490
24532
  scrollback: 1e3,
24491
24533
  allowProposedApi: true
24492
24534
  });
24493
- const serializeAddon = new SerializeAddon();
24535
+ const serializeAddon = new D();
24494
24536
  term.loadAddon(serializeAddon);
24495
24537
  let visible = null;
24496
24538
  let pendingClear = null;
@@ -24501,8 +24543,8 @@ function createPopupDetector(opts) {
24501
24543
  if (!line) continue;
24502
24544
  const text = line.translateToString(true);
24503
24545
  if (!text) continue;
24504
- for (const p of POPUP_FOOTER_PATTERNS) {
24505
- if (p.regex.test(text)) return p.kind;
24546
+ for (const p2 of POPUP_FOOTER_PATTERNS) {
24547
+ if (p2.regex.test(text)) return p2.kind;
24506
24548
  }
24507
24549
  }
24508
24550
  return null;
@@ -24812,9 +24854,9 @@ var WorkspaceBrowser = class {
24812
24854
  }
24813
24855
  entries.push(entry);
24814
24856
  }
24815
- entries.sort((a, b) => {
24816
- if (a.type !== b.type) return a.type === "dir" ? -1 : 1;
24817
- return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
24857
+ entries.sort((a, b2) => {
24858
+ if (a.type !== b2.type) return a.type === "dir" ? -1 : 1;
24859
+ return a.name < b2.name ? -1 : a.name > b2.name ? 1 : 0;
24818
24860
  });
24819
24861
  return { cwd, path: args.path ?? ".", entries };
24820
24862
  }
@@ -24854,16 +24896,16 @@ var import_node_fs11 = __toESM(require("fs"), 1);
24854
24896
  var import_node_os7 = __toESM(require("os"), 1);
24855
24897
  var import_node_path12 = __toESM(require("path"), 1);
24856
24898
  var DEFAULT_POLICY_DIR_DARWIN = "/Library/Application Support/ClaudeCode/.claude/agents";
24857
- function isDirLikeSync2(p) {
24899
+ function isDirLikeSync2(p2) {
24858
24900
  try {
24859
- return import_node_fs11.default.statSync(p).isDirectory();
24901
+ return import_node_fs11.default.statSync(p2).isDirectory();
24860
24902
  } catch {
24861
24903
  return false;
24862
24904
  }
24863
24905
  }
24864
- function fileExistsSync(p) {
24906
+ function fileExistsSync(p2) {
24865
24907
  try {
24866
- return import_node_fs11.default.statSync(p).isFile();
24908
+ return import_node_fs11.default.statSync(p2).isFile();
24867
24909
  } catch {
24868
24910
  return false;
24869
24911
  }
@@ -25007,14 +25049,14 @@ var AgentsScanner = class {
25007
25049
  list(args) {
25008
25050
  const seen = /* @__PURE__ */ new Set();
25009
25051
  const builtinBlock = [];
25010
- for (const b of BUILTIN_AGENTS) {
25011
- if (seen.has(b.name)) continue;
25012
- seen.add(b.name);
25052
+ for (const b2 of BUILTIN_AGENTS) {
25053
+ if (seen.has(b2.name)) continue;
25054
+ seen.add(b2.name);
25013
25055
  builtinBlock.push({
25014
- name: b.name,
25056
+ name: b2.name,
25015
25057
  source: "builtin",
25016
- ...b.description ? { description: b.description } : {},
25017
- ...b.whenToUse ? { whenToUse: b.whenToUse } : {}
25058
+ ...b2.description ? { description: b2.description } : {},
25059
+ ...b2.whenToUse ? { whenToUse: b2.whenToUse } : {}
25018
25060
  });
25019
25061
  }
25020
25062
  const fsBlock = [];
@@ -25065,7 +25107,7 @@ var SessionObserver = class {
25065
25107
  size = import_node_fs12.default.statSync(filePath).size;
25066
25108
  } catch {
25067
25109
  }
25068
- const w = {
25110
+ const w2 = {
25069
25111
  sessionId: args.sessionId,
25070
25112
  filePath,
25071
25113
  watcher: null,
@@ -25078,15 +25120,15 @@ var SessionObserver = class {
25078
25120
  import_node_fs12.default.mkdirSync(import_node_path13.default.dirname(filePath), { recursive: true });
25079
25121
  } catch {
25080
25122
  }
25081
- w.watcher = import_node_fs12.default.watch(import_node_path13.default.dirname(filePath), { persistent: false }, (_event, changedName) => {
25123
+ w2.watcher = import_node_fs12.default.watch(import_node_path13.default.dirname(filePath), { persistent: false }, (_event, changedName) => {
25082
25124
  if (!changedName || !filePath.endsWith(changedName)) return;
25083
- this.poll(w);
25125
+ this.poll(w2);
25084
25126
  });
25085
- w.pollTimer = setInterval(() => this.poll(w), 200);
25086
- this.watches.set(args.sessionId, w);
25127
+ w2.pollTimer = setInterval(() => this.poll(w2), 200);
25128
+ this.watches.set(args.sessionId, w2);
25087
25129
  this.opts.onStatus?.(args.sessionId, "observing");
25088
- this.hydrateMetaTail(w);
25089
- this.poll(w);
25130
+ this.hydrateMetaTail(w2);
25131
+ this.poll(w2);
25090
25132
  return { filePath };
25091
25133
  }
25092
25134
  // 读 JSONL 文件尾部 N 行,把每行的 meta_update 字段**合并成一个 patch** 喂给 reducer。
@@ -25094,16 +25136,16 @@ var SessionObserver = class {
25094
25136
  // parseLine 对每行都产一条 meta_update,N=200 行就是 200 条几乎相同的 patch。
25095
25137
  // reducer.shallowEqMeta 会 dedup 但 CPU + log 仍吵。改成同 patch 字段保留最新值合并成单条。
25096
25138
  // 异常静默吞,不阻塞 watcher 启动
25097
- hydrateMetaTail(w, maxLines = 200) {
25139
+ hydrateMetaTail(w2, maxLines = 200) {
25098
25140
  try {
25099
- const raw = import_node_fs12.default.readFileSync(w.filePath, "utf8");
25141
+ const raw = import_node_fs12.default.readFileSync(w2.filePath, "utf8");
25100
25142
  if (!raw) return;
25101
25143
  const allLines = raw.split("\n").filter((l) => l.trim().length > 0);
25102
25144
  if (allLines.length === 0) return;
25103
25145
  const tail = allLines.length > maxLines ? allLines.slice(-maxLines) : allLines;
25104
25146
  const merged = {};
25105
25147
  for (const line of tail) {
25106
- const events = w.adapter.parseLine(line);
25148
+ const events = w2.adapter.parseLine(line);
25107
25149
  for (const e of events) {
25108
25150
  if (e.kind === "meta_update" && e.patch) {
25109
25151
  Object.assign(merged, e.patch);
@@ -25112,38 +25154,38 @@ var SessionObserver = class {
25112
25154
  }
25113
25155
  if (Object.keys(merged).length > 0) {
25114
25156
  const singleEvent = { kind: "meta_update", patch: merged };
25115
- this.opts.onEvent({ sessionId: w.sessionId, events: [singleEvent] });
25157
+ this.opts.onEvent({ sessionId: w2.sessionId, events: [singleEvent] });
25116
25158
  }
25117
25159
  } catch {
25118
25160
  }
25119
25161
  }
25120
- poll(w) {
25162
+ poll(w2) {
25121
25163
  let size = 0;
25122
25164
  try {
25123
- size = import_node_fs12.default.statSync(w.filePath).size;
25165
+ size = import_node_fs12.default.statSync(w2.filePath).size;
25124
25166
  } catch {
25125
25167
  return;
25126
25168
  }
25127
- if (size < w.lastSize) {
25128
- w.lastSize = 0;
25129
- w.buf = "";
25169
+ if (size < w2.lastSize) {
25170
+ w2.lastSize = 0;
25171
+ w2.buf = "";
25130
25172
  }
25131
- if (size === w.lastSize) return;
25132
- const fd = import_node_fs12.default.openSync(w.filePath, "r");
25173
+ if (size === w2.lastSize) return;
25174
+ const fd = import_node_fs12.default.openSync(w2.filePath, "r");
25133
25175
  try {
25134
- const len = size - w.lastSize;
25176
+ const len = size - w2.lastSize;
25135
25177
  const buf = Buffer.alloc(len);
25136
- import_node_fs12.default.readSync(fd, buf, 0, len, w.lastSize);
25137
- w.lastSize = size;
25138
- w.buf += buf.toString("utf8");
25178
+ import_node_fs12.default.readSync(fd, buf, 0, len, w2.lastSize);
25179
+ w2.lastSize = size;
25180
+ w2.buf += buf.toString("utf8");
25139
25181
  let newlineIndex;
25140
- while ((newlineIndex = w.buf.indexOf("\n")) >= 0) {
25141
- const line = w.buf.slice(0, newlineIndex);
25142
- w.buf = w.buf.slice(newlineIndex + 1);
25143
- const events = w.adapter.parseLine(line);
25144
- this.maybeReportUserMessage(w.sessionId, line);
25182
+ while ((newlineIndex = w2.buf.indexOf("\n")) >= 0) {
25183
+ const line = w2.buf.slice(0, newlineIndex);
25184
+ w2.buf = w2.buf.slice(newlineIndex + 1);
25185
+ const events = w2.adapter.parseLine(line);
25186
+ this.maybeReportUserMessage(w2.sessionId, line);
25145
25187
  if (events.length > 0) {
25146
- this.opts.onEvent({ sessionId: w.sessionId, events });
25188
+ this.opts.onEvent({ sessionId: w2.sessionId, events });
25147
25189
  }
25148
25190
  }
25149
25191
  } finally {
@@ -25192,13 +25234,13 @@ var SessionObserver = class {
25192
25234
  return this.watches.has(sessionId);
25193
25235
  }
25194
25236
  stop(sessionId) {
25195
- const w = this.watches.get(sessionId);
25196
- if (!w) return false;
25237
+ const w2 = this.watches.get(sessionId);
25238
+ if (!w2) return false;
25197
25239
  try {
25198
- w.watcher?.close();
25240
+ w2.watcher?.close();
25199
25241
  } catch {
25200
25242
  }
25201
- if (w.pollTimer) clearInterval(w.pollTimer);
25243
+ if (w2.pollTimer) clearInterval(w2.pollTimer);
25202
25244
  this.watches.delete(sessionId);
25203
25245
  this.opts.onStatus?.(sessionId, "stopped");
25204
25246
  return true;
@@ -26012,10 +26054,10 @@ var AuthGate = class {
26012
26054
  st.timer = null;
26013
26055
  }
26014
26056
  };
26015
- function constantTimeEqual(a, b) {
26016
- if (a.length !== b.length) return false;
26057
+ function constantTimeEqual(a, b2) {
26058
+ if (a.length !== b2.length) return false;
26017
26059
  let diff2 = 0;
26018
- for (let i = 0; i < a.length; i++) diff2 |= a.charCodeAt(i) ^ b.charCodeAt(i);
26060
+ for (let i = 0; i < a.length; i++) diff2 |= a.charCodeAt(i) ^ b2.charCodeAt(i);
26019
26061
  return diff2 === 0;
26020
26062
  }
26021
26063
  function buildShouldEnforce(opts) {
@@ -26112,10 +26154,10 @@ var TunnelStore = class {
26112
26154
  return null;
26113
26155
  }
26114
26156
  }
26115
- async set(v) {
26157
+ async set(v2) {
26116
26158
  const dir = import_node_path15.default.dirname(this.filePath);
26117
26159
  await import_node_fs14.default.promises.mkdir(dir, { recursive: true });
26118
- const data = JSON.stringify(v, null, 2);
26160
+ const data = JSON.stringify(v2, null, 2);
26119
26161
  const tmp = `${this.filePath}.tmp.${process.pid}.${Date.now()}`;
26120
26162
  await import_node_fs14.default.promises.writeFile(tmp, data, { mode: 384 });
26121
26163
  if (process.platform !== "win32") {
@@ -26218,8 +26260,8 @@ function buildFrpcToml(input) {
26218
26260
  lines.push(`subdomain = "${escape(input.subdomain)}"`);
26219
26261
  return lines.join("\n") + "\n";
26220
26262
  }
26221
- function escape(v) {
26222
- return v.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
26263
+ function escape(v2) {
26264
+ return v2.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
26223
26265
  }
26224
26266
 
26225
26267
  // src/tunnel/frpc-binary.ts
@@ -26252,8 +26294,8 @@ function detectPlatform(opts = {}) {
26252
26294
  else throw new UnsupportedPlatformError(platform, arch);
26253
26295
  return { os: oss, arch: a };
26254
26296
  }
26255
- function frpcDownloadUrl(version2, p) {
26256
- return `https://github.com/fatedier/frp/releases/download/v${version2}/frp_${version2}_${p.os}_${p.arch}.tar.gz`;
26297
+ function frpcDownloadUrl(version2, p2) {
26298
+ return `https://github.com/fatedier/frp/releases/download/v${version2}/frp_${version2}_${p2.os}_${p2.arch}.tar.gz`;
26257
26299
  }
26258
26300
  async function ensureFrpcBinary(opts) {
26259
26301
  if (opts.override) {
@@ -26304,9 +26346,9 @@ function cleanupStaleArtifacts(binDir) {
26304
26346
  }
26305
26347
  }
26306
26348
  }
26307
- function safeUnlink(p) {
26349
+ function safeUnlink(p2) {
26308
26350
  try {
26309
- import_node_fs15.default.unlinkSync(p);
26351
+ import_node_fs15.default.unlinkSync(p2);
26310
26352
  } catch {
26311
26353
  }
26312
26354
  }
@@ -26937,7 +26979,7 @@ function listRecentDirs(store, limit = 50) {
26937
26979
  latestByCwd.set(s.cwd, s.updatedAt);
26938
26980
  }
26939
26981
  }
26940
- return Array.from(latestByCwd.entries()).map(([cwd, updatedAt]) => ({ cwd, updatedAt })).sort((a, b) => a.updatedAt > b.updatedAt ? -1 : a.updatedAt < b.updatedAt ? 1 : 0).slice(0, limit);
26982
+ return Array.from(latestByCwd.entries()).map(([cwd, updatedAt]) => ({ cwd, updatedAt })).sort((a, b2) => a.updatedAt > b2.updatedAt ? -1 : a.updatedAt < b2.updatedAt ? 1 : 0).slice(0, limit);
26941
26983
  }
26942
26984
 
26943
26985
  // src/handlers/history.ts
@@ -27045,8 +27087,8 @@ function formatChildProcessError(err) {
27045
27087
  if (parts.length > 0) return parts.join(" ");
27046
27088
  return e.message ?? "unknown error";
27047
27089
  }
27048
- function normalizePath(p) {
27049
- const resolved = import_node_path21.default.resolve(p);
27090
+ function normalizePath(p2) {
27091
+ const resolved = import_node_path21.default.resolve(p2);
27050
27092
  try {
27051
27093
  return import_node_fs20.default.realpathSync(resolved);
27052
27094
  } catch {
@@ -27849,3 +27891,19 @@ main().catch((err) => {
27849
27891
  console.error("[clawd] fatal:", err);
27850
27892
  process.exit(1);
27851
27893
  });
27894
+ /*! Bundled license information:
27895
+
27896
+ @xterm/addon-serialize/lib/addon-serialize.mjs:
27897
+ (**
27898
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
27899
+ * @license MIT
27900
+ *
27901
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
27902
+ * @license MIT
27903
+ *
27904
+ * Originally forked from (with the author's permission):
27905
+ * Fabrice Bellard's javascript vt100 for jslinux:
27906
+ * http://bellard.org/jslinux/
27907
+ * Copyright (c) 2011 Fabrice Bellard
27908
+ *)
27909
+ */