@clawos-dev/clawd 0.2.53-beta.83.14c8221 → 0.2.53-beta.84.b617e1e

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 +711 -768
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -186,7 +186,7 @@ var init_util = __esm({
186
186
  "../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js"() {
187
187
  "use strict";
188
188
  (function(util2) {
189
- util2.assertEqual = (_2) => {
189
+ util2.assertEqual = (_) => {
190
190
  };
191
191
  function assertIs(_arg) {
192
192
  }
@@ -203,10 +203,10 @@ var init_util = __esm({
203
203
  return obj;
204
204
  };
205
205
  util2.getValidEnumValues = (obj) => {
206
- const validKeys = util2.objectKeys(obj).filter((k2) => typeof obj[obj[k2]] !== "number");
206
+ const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
207
207
  const filtered = {};
208
- for (const k2 of validKeys) {
209
- filtered[k2] = obj[k2];
208
+ for (const k of validKeys) {
209
+ filtered[k] = obj[k];
210
210
  }
211
211
  return util2.objectValues(filtered);
212
212
  };
@@ -236,7 +236,7 @@ var init_util = __esm({
236
236
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
237
237
  }
238
238
  util2.joinValues = joinValues;
239
- util2.jsonStringifyReplacer = (_2, value) => {
239
+ util2.jsonStringifyReplacer = (_, value) => {
240
240
  if (typeof value === "bigint") {
241
241
  return value.toString();
242
242
  }
@@ -611,7 +611,7 @@ var init_parseUtil = __esm({
611
611
  };
612
612
  }
613
613
  let errorMessage = "";
614
- const maps = errorMaps.filter((m2) => !!m2).slice().reverse();
614
+ const maps = errorMaps.filter((m) => !!m).slice().reverse();
615
615
  for (const map of maps) {
616
616
  errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
617
617
  }
@@ -827,17 +827,17 @@ function deepPartialify(schema) {
827
827
  return schema;
828
828
  }
829
829
  }
830
- function mergeValues(a, b2) {
830
+ function mergeValues(a, b) {
831
831
  const aType = getParsedType(a);
832
- const bType = getParsedType(b2);
833
- if (a === b2) {
832
+ const bType = getParsedType(b);
833
+ if (a === b) {
834
834
  return { valid: true, data: a };
835
835
  } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
836
- const bKeys = util.objectKeys(b2);
836
+ const bKeys = util.objectKeys(b);
837
837
  const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
838
- const newObj = { ...a, ...b2 };
838
+ const newObj = { ...a, ...b };
839
839
  for (const key of sharedKeys) {
840
- const sharedValue = mergeValues(a[key], b2[key]);
840
+ const sharedValue = mergeValues(a[key], b[key]);
841
841
  if (!sharedValue.valid) {
842
842
  return { valid: false };
843
843
  }
@@ -845,13 +845,13 @@ function mergeValues(a, b2) {
845
845
  }
846
846
  return { valid: true, data: newObj };
847
847
  } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
848
- if (a.length !== b2.length) {
848
+ if (a.length !== b.length) {
849
849
  return { valid: false };
850
850
  }
851
851
  const newArray = [];
852
852
  for (let index = 0; index < a.length; index++) {
853
853
  const itemA = a[index];
854
- const itemB = b2[index];
854
+ const itemB = b[index];
855
855
  const sharedValue = mergeValues(itemA, itemB);
856
856
  if (!sharedValue.valid) {
857
857
  return { valid: false };
@@ -859,7 +859,7 @@ function mergeValues(a, b2) {
859
859
  newArray.push(sharedValue.data);
860
860
  }
861
861
  return { valid: true, data: newArray };
862
- } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b2) {
862
+ } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
863
863
  return { valid: true, data: a };
864
864
  } else {
865
865
  return { valid: false };
@@ -873,9 +873,9 @@ function createZodEnum(values, params) {
873
873
  });
874
874
  }
875
875
  function cleanParams(params, data) {
876
- const p2 = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
877
- const p22 = typeof p2 === "string" ? { message: p2 } : p2;
878
- return p22;
876
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
877
+ const p2 = typeof p === "string" ? { message: p } : p;
878
+ return p2;
879
879
  }
880
880
  function custom(check, _params = {}, fatal) {
881
881
  if (check)
@@ -4039,10 +4039,10 @@ var init_types = __esm({
4039
4039
  }
4040
4040
  }
4041
4041
  }
4042
- static create(a, b2) {
4042
+ static create(a, b) {
4043
4043
  return new _ZodPipeline({
4044
4044
  in: a,
4045
- out: b2,
4045
+ out: b,
4046
4046
  typeName: ZodFirstPartyTypeKind.ZodPipeline
4047
4047
  });
4048
4048
  }
@@ -5336,7 +5336,7 @@ var require_pino_std_serializers = __commonJS({
5336
5336
  var require_caller = __commonJS({
5337
5337
  "../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/caller.js"(exports2, module2) {
5338
5338
  "use strict";
5339
- function noOpPrepareStackTrace(_2, stack) {
5339
+ function noOpPrepareStackTrace(_, stack) {
5340
5340
  return stack;
5341
5341
  }
5342
5342
  module2.exports = function getCallers() {
@@ -5897,9 +5897,9 @@ var require_redaction = __commonJS({
5897
5897
  o[ns].push(...o[wildcardFirstSym] || []);
5898
5898
  }
5899
5899
  if (ns === wildcardFirstSym) {
5900
- Object.keys(o).forEach(function(k2) {
5901
- if (o[k2]) {
5902
- o[k2].push(nextPath);
5900
+ Object.keys(o).forEach(function(k) {
5901
+ if (o[k]) {
5902
+ o[k].push(nextPath);
5903
5903
  }
5904
5904
  });
5905
5905
  }
@@ -5912,15 +5912,15 @@ var require_redaction = __commonJS({
5912
5912
  const topCensor = (...args) => {
5913
5913
  return typeof censor === "function" ? serialize(censor(...args)) : serialize(censor);
5914
5914
  };
5915
- return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k2) => {
5916
- if (shape[k2] === null) {
5917
- o[k2] = (value) => topCensor(value, [k2]);
5915
+ return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => {
5916
+ if (shape[k] === null) {
5917
+ o[k] = (value) => topCensor(value, [k]);
5918
5918
  } else {
5919
5919
  const wrappedCensor = typeof censor === "function" ? (value, path24) => {
5920
- return censor(value, [k2, ...path24]);
5920
+ return censor(value, [k, ...path24]);
5921
5921
  } : censor;
5922
- o[k2] = Redact({
5923
- paths: shape[k2],
5922
+ o[k] = Redact({
5923
+ paths: shape[k],
5924
5924
  censor: wrappedCensor,
5925
5925
  serialize,
5926
5926
  strict,
@@ -7797,11 +7797,11 @@ var require_tools = __commonJS({
7797
7797
  function stringify(obj, stringifySafeFn) {
7798
7798
  try {
7799
7799
  return JSON.stringify(obj);
7800
- } catch (_2) {
7800
+ } catch (_) {
7801
7801
  try {
7802
7802
  const stringify2 = stringifySafeFn || this[stringifySafeSym];
7803
7803
  return stringify2(obj);
7804
- } catch (_3) {
7804
+ } catch (_2) {
7805
7805
  return '"[unable to serialize, circular reference is too complex to analyze]"';
7806
7806
  }
7807
7807
  }
@@ -7895,12 +7895,12 @@ var require_levels = __commonJS({
7895
7895
  debug: (hook) => genLog(DEFAULT_LEVELS.debug, hook),
7896
7896
  trace: (hook) => genLog(DEFAULT_LEVELS.trace, hook)
7897
7897
  };
7898
- var nums = Object.keys(DEFAULT_LEVELS).reduce((o, k2) => {
7899
- o[DEFAULT_LEVELS[k2]] = k2;
7898
+ var nums = Object.keys(DEFAULT_LEVELS).reduce((o, k) => {
7899
+ o[DEFAULT_LEVELS[k]] = k;
7900
7900
  return o;
7901
7901
  }, {});
7902
- var initialLsCache = Object.keys(nums).reduce((o, k2) => {
7903
- o[k2] = '{"level":' + Number(k2);
7902
+ var initialLsCache = Object.keys(nums).reduce((o, k) => {
7903
+ o[k] = '{"level":' + Number(k);
7904
7904
  return o;
7905
7905
  }, {});
7906
7906
  function genLsCache(instance) {
@@ -7980,8 +7980,8 @@ var require_levels = __commonJS({
7980
7980
  return levelComparison;
7981
7981
  }
7982
7982
  function mappings(customLevels = null, useOnlyCustomLevels = false) {
7983
- const customNums = customLevels ? Object.keys(customLevels).reduce((o, k2) => {
7984
- o[customLevels[k2]] = k2;
7983
+ const customNums = customLevels ? Object.keys(customLevels).reduce((o, k) => {
7984
+ o[customLevels[k]] = k;
7985
7985
  return o;
7986
7986
  }, {}) : null;
7987
7987
  const labels = Object.assign(
@@ -8019,11 +8019,11 @@ var require_levels = __commonJS({
8019
8019
  }
8020
8020
  function assertNoLevelCollisions(levels, customLevels) {
8021
8021
  const { labels, values } = levels;
8022
- for (const k2 in customLevels) {
8023
- if (k2 in values) {
8022
+ for (const k in customLevels) {
8023
+ if (k in values) {
8024
8024
  throw Error("levels cannot be overridden");
8025
8025
  }
8026
- if (customLevels[k2] in labels) {
8026
+ if (customLevels[k] in labels) {
8027
8027
  throw Error("pre-existing level values cannot be used for new levels");
8028
8028
  }
8029
8029
  }
@@ -8176,8 +8176,8 @@ var require_proto = __commonJS({
8176
8176
  }
8177
8177
  if (options.hasOwnProperty("serializers") === true) {
8178
8178
  instance[serializersSym] = /* @__PURE__ */ Object.create(null);
8179
- for (const k2 in serializers) {
8180
- instance[serializersSym][k2] = serializers[k2];
8179
+ for (const k in serializers) {
8180
+ instance[serializersSym][k] = serializers[k];
8181
8181
  }
8182
8182
  const parentSymbols = Object.getOwnPropertySymbols(serializers);
8183
8183
  for (var i = 0; i < parentSymbols.length; i++) {
@@ -9040,8 +9040,8 @@ var require_multistream = __commonJS({
9040
9040
  };
9041
9041
  }
9042
9042
  }
9043
- function compareByLevel(a, b2) {
9044
- return a.level - b2.level;
9043
+ function compareByLevel(a, b) {
9044
+ return a.level - b.level;
9045
9045
  }
9046
9046
  function initLoopVar(length, dedupe) {
9047
9047
  return dedupe ? length - 1 : 0;
@@ -9388,41 +9388,41 @@ function removeSuffix(string, oldSuffix) {
9388
9388
  function maximumOverlap(string1, string2) {
9389
9389
  return string2.slice(0, overlapCount(string1, string2));
9390
9390
  }
9391
- function overlapCount(a, b2) {
9391
+ function overlapCount(a, b) {
9392
9392
  var startA = 0;
9393
- if (a.length > b2.length) {
9394
- startA = a.length - b2.length;
9393
+ if (a.length > b.length) {
9394
+ startA = a.length - b.length;
9395
9395
  }
9396
- var endB = b2.length;
9397
- if (a.length < b2.length) {
9396
+ var endB = b.length;
9397
+ if (a.length < b.length) {
9398
9398
  endB = a.length;
9399
9399
  }
9400
9400
  var map = Array(endB);
9401
- var k2 = 0;
9401
+ var k = 0;
9402
9402
  map[0] = 0;
9403
9403
  for (var j = 1; j < endB; j++) {
9404
- if (b2[j] == b2[k2]) {
9405
- map[j] = map[k2];
9404
+ if (b[j] == b[k]) {
9405
+ map[j] = map[k];
9406
9406
  } else {
9407
- map[j] = k2;
9407
+ map[j] = k;
9408
9408
  }
9409
- while (k2 > 0 && b2[j] != b2[k2]) {
9410
- k2 = map[k2];
9409
+ while (k > 0 && b[j] != b[k]) {
9410
+ k = map[k];
9411
9411
  }
9412
- if (b2[j] == b2[k2]) {
9413
- k2++;
9412
+ if (b[j] == b[k]) {
9413
+ k++;
9414
9414
  }
9415
9415
  }
9416
- k2 = 0;
9416
+ k = 0;
9417
9417
  for (var i = startA; i < a.length; i++) {
9418
- while (k2 > 0 && a[i] != b2[k2]) {
9419
- k2 = map[k2];
9418
+ while (k > 0 && a[i] != b[k]) {
9419
+ k = map[k];
9420
9420
  }
9421
- if (a[i] == b2[k2]) {
9422
- k2++;
9421
+ if (a[i] == b[k]) {
9422
+ k++;
9423
9423
  }
9424
9424
  }
9425
- return k2;
9425
+ return k;
9426
9426
  }
9427
9427
  function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
9428
9428
  if (deletion && insertion) {
@@ -10045,8 +10045,8 @@ var init_lib = __esm({
10045
10045
  jsonDiff.useLongestToken = true;
10046
10046
  jsonDiff.tokenize = lineDiff.tokenize;
10047
10047
  jsonDiff.castInput = function(value, options) {
10048
- var undefinedReplacement = options.undefinedReplacement, _options$stringifyRep = options.stringifyReplacer, stringifyReplacer = _options$stringifyRep === void 0 ? function(k2, v2) {
10049
- return typeof v2 === "undefined" ? undefinedReplacement : v2;
10048
+ var undefinedReplacement = options.undefinedReplacement, _options$stringifyRep = options.stringifyReplacer, stringifyReplacer = _options$stringifyRep === void 0 ? function(k, v) {
10049
+ return typeof v === "undefined" ? undefinedReplacement : v;
10050
10050
  } : _options$stringifyRep;
10051
10051
  return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, " ");
10052
10052
  };
@@ -10070,8 +10070,8 @@ function extractAskQuestionAnswers(raw) {
10070
10070
  const answers = r.answers;
10071
10071
  if (!answers || typeof answers !== "object" || Array.isArray(answers)) return void 0;
10072
10072
  const out = {};
10073
- for (const [k2, v2] of Object.entries(answers)) {
10074
- if (typeof v2 === "string") out[k2] = v2;
10073
+ for (const [k, v] of Object.entries(answers)) {
10074
+ if (typeof v === "string") out[k] = v;
10075
10075
  }
10076
10076
  return Object.keys(out).length > 0 ? out : void 0;
10077
10077
  }
@@ -10089,9 +10089,9 @@ function hashDirToCwd(hash) {
10089
10089
  const body = hash.startsWith("-") ? hash.slice(1) : hash;
10090
10090
  return "/" + body.replace(/-/g, "/");
10091
10091
  }
10092
- function safeStatMtime(p2) {
10092
+ function safeStatMtime(p) {
10093
10093
  try {
10094
- return import_node_fs6.default.statSync(p2).mtimeMs;
10094
+ return import_node_fs6.default.statSync(p).mtimeMs;
10095
10095
  } catch {
10096
10096
  return 0;
10097
10097
  }
@@ -10170,9 +10170,9 @@ function messageFromJsonl(obj) {
10170
10170
  }
10171
10171
  if (Array.isArray(content)) {
10172
10172
  const parts = content;
10173
- const texts = parts.filter((p2) => p2.type === "text" && typeof p2.text === "string").map((p2) => String(p2.text));
10174
- const toolUse = parts.find((p2) => p2.type === "tool_use");
10175
- const toolResult = parts.find((p2) => p2.type === "tool_result");
10173
+ const texts = parts.filter((p) => p.type === "text" && typeof p.text === "string").map((p) => String(p.text));
10174
+ const toolUse = parts.find((p) => p.type === "tool_use");
10175
+ const toolResult = parts.find((p) => p.type === "tool_result");
10176
10176
  if (toolUse) {
10177
10177
  return withCommonFields(
10178
10178
  {
@@ -10273,16 +10273,16 @@ function attachmentToHistoryMessage(o, ts) {
10273
10273
  const subtype = typeof a.type === "string" ? a.type : "unknown";
10274
10274
  if (subtype === "memories") {
10275
10275
  const raw = Array.isArray(a.memories) ? a.memories : [];
10276
- const memories = raw.map((m2) => {
10277
- if (!m2 || typeof m2 !== "object") return null;
10278
- const rec = m2;
10276
+ const memories = raw.map((m) => {
10277
+ if (!m || typeof m !== "object") return null;
10278
+ const rec = m;
10279
10279
  const path24 = typeof rec.path === "string" ? rec.path : null;
10280
10280
  const content = typeof rec.content === "string" ? rec.content : null;
10281
10281
  if (!path24 || content == null) return null;
10282
10282
  const entry = { path: path24, content };
10283
10283
  if (typeof rec.mtimeMs === "number") entry.mtimeMs = rec.mtimeMs;
10284
10284
  return entry;
10285
- }).filter((m2) => m2 !== null);
10285
+ }).filter((m) => m !== null);
10286
10286
  if (memories.length === 0) return null;
10287
10287
  return withCommonFields({ kind: "attachment_memories", memories, ts, raw: o }, o);
10288
10288
  }
@@ -10378,7 +10378,7 @@ var init_claude_history = __esm({
10378
10378
  if (!ent.isDirectory()) continue;
10379
10379
  const dir = import_node_path6.default.join(this.projectsRoot, ent.name);
10380
10380
  const files = import_node_fs6.default.readdirSync(dir).filter((f) => f.endsWith(".jsonl"));
10381
- const updatedAtMs = files.reduce((m2, f) => Math.max(m2, safeStatMtime(import_node_path6.default.join(dir, f))), 0);
10381
+ const updatedAtMs = files.reduce((m, f) => Math.max(m, safeStatMtime(import_node_path6.default.join(dir, f))), 0);
10382
10382
  out.push({
10383
10383
  projectPath: hashDirToCwd(ent.name),
10384
10384
  hashDir: ent.name,
@@ -10386,7 +10386,7 @@ var init_claude_history = __esm({
10386
10386
  updatedAt: updatedAtMs ? new Date(updatedAtMs).toISOString() : ""
10387
10387
  });
10388
10388
  }
10389
- out.sort((a, b2) => a.updatedAt > b2.updatedAt ? -1 : a.updatedAt < b2.updatedAt ? 1 : 0);
10389
+ out.sort((a, b) => a.updatedAt > b.updatedAt ? -1 : a.updatedAt < b.updatedAt ? 1 : 0);
10390
10390
  return out;
10391
10391
  }
10392
10392
  async listSessions(args) {
@@ -10451,7 +10451,7 @@ var init_claude_history = __esm({
10451
10451
  updatedAt: updatedAtMs ? new Date(updatedAtMs).toISOString() : ""
10452
10452
  });
10453
10453
  }
10454
- out.sort((a, b2) => a.updatedAt > b2.updatedAt ? -1 : a.updatedAt < b2.updatedAt ? 1 : 0);
10454
+ out.sort((a, b) => a.updatedAt > b.updatedAt ? -1 : a.updatedAt < b.updatedAt ? 1 : 0);
10455
10455
  return out;
10456
10456
  }
10457
10457
  async read(args) {
@@ -10604,9 +10604,9 @@ var init_claude_history = __esm({
10604
10604
  const record = {};
10605
10605
  for (const [filePath, raw] of Object.entries(backups)) {
10606
10606
  if (!raw || typeof raw !== "object") continue;
10607
- const b2 = raw;
10608
- const name = b2.backupFileName;
10609
- const version2 = b2.version;
10607
+ const b = raw;
10608
+ const name = b.backupFileName;
10609
+ const version2 = b.version;
10610
10610
  if (typeof version2 !== "number") continue;
10611
10611
  record[filePath] = {
10612
10612
  backupFileName: typeof name === "string" ? name : null,
@@ -10758,8 +10758,8 @@ async function probeClaude(env = process.env, home = import_node_os3.default.hom
10758
10758
  if (env.CLAUDE_BIN && import_node_fs7.default.existsSync(env.CLAUDE_BIN)) {
10759
10759
  return { available: true, path: env.CLAUDE_BIN };
10760
10760
  }
10761
- const w2 = probeViaWhich();
10762
- if (w2) return { available: true, path: w2 };
10761
+ const w = probeViaWhich();
10762
+ if (w) return { available: true, path: w };
10763
10763
  if (process.platform === "darwin") {
10764
10764
  for (const candidate of macOSDesktopCandidates(home)) {
10765
10765
  if (import_node_fs7.default.existsSync(candidate)) {
@@ -11079,16 +11079,16 @@ function parseAttachment(obj) {
11079
11079
  const kind = typeof a.type === "string" ? a.type : "unknown";
11080
11080
  if (kind === "memories") {
11081
11081
  const raw = Array.isArray(a.memories) ? a.memories : [];
11082
- const memories = raw.map((m2) => {
11083
- if (!m2 || typeof m2 !== "object") return null;
11084
- const rec = m2;
11082
+ const memories = raw.map((m) => {
11083
+ if (!m || typeof m !== "object") return null;
11084
+ const rec = m;
11085
11085
  const path24 = typeof rec.path === "string" ? rec.path : null;
11086
11086
  const content = typeof rec.content === "string" ? rec.content : null;
11087
11087
  if (!path24 || content == null) return null;
11088
11088
  const out = { path: path24, content };
11089
11089
  if (typeof rec.mtimeMs === "number") out.mtimeMs = rec.mtimeMs;
11090
11090
  return out;
11091
- }).filter((m2) => m2 !== null);
11091
+ }).filter((m) => m !== null);
11092
11092
  if (memories.length === 0) return null;
11093
11093
  return { kind: "attachment_memories", memories };
11094
11094
  }
@@ -11133,9 +11133,9 @@ function buildSpawnEnv(ctxEnv, base = process.env) {
11133
11133
  };
11134
11134
  }
11135
11135
  function tryParseBase64DataUrl(url) {
11136
- const m2 = url.match(/^data:([^;,]+);base64,(.+)$/);
11137
- if (!m2) return null;
11138
- return { mediaType: m2[1], data: m2[2] };
11136
+ const m = url.match(/^data:([^;,]+);base64,(.+)$/);
11137
+ if (!m) return null;
11138
+ return { mediaType: m[1], data: m[2] };
11139
11139
  }
11140
11140
  function tryParseHttpImageUrl(url) {
11141
11141
  if (!/^https?:\/\//i.test(url)) return null;
@@ -11239,7 +11239,7 @@ var init_claude = __esm({
11239
11239
  type: "select",
11240
11240
  label: "Model",
11241
11241
  scope: "core",
11242
- options: CLAUDE_MODELS.map((m2) => ({ value: m2.id, label: m2.label, description: m2.description })),
11242
+ options: CLAUDE_MODELS.map((m) => ({ value: m.id, label: m.label, description: m.description })),
11243
11243
  default: ""
11244
11244
  },
11245
11245
  {
@@ -11247,7 +11247,7 @@ var init_claude = __esm({
11247
11247
  type: "select",
11248
11248
  label: "Permission Mode",
11249
11249
  scope: "core",
11250
- options: CLAUDE_PERMISSION_MODES.map((m2) => ({ value: m2.id, label: m2.label, description: m2.description })),
11250
+ options: CLAUDE_PERMISSION_MODES.map((m) => ({ value: m.id, label: m.label, description: m.description })),
11251
11251
  default: ""
11252
11252
  },
11253
11253
  {
@@ -11297,10 +11297,10 @@ var init_claude = __esm({
11297
11297
  resolveContextWindow(modelId) {
11298
11298
  if (!modelId) return void 0;
11299
11299
  const models = CLAUDE_CAPABILITIES.models;
11300
- const exact = models.find((m2) => m2.id === modelId);
11300
+ const exact = models.find((m) => m.id === modelId);
11301
11301
  if (exact) return exact.contextWindowSize;
11302
11302
  const lower = modelId.toLowerCase();
11303
- const contains = models.find((m2) => m2.id && lower.includes(m2.id.toLowerCase()));
11303
+ const contains = models.find((m) => m.id && lower.includes(m.id.toLowerCase()));
11304
11304
  if (contains) {
11305
11305
  if (contains.id === "opus" && /opus-4-[67]/i.test(modelId)) return 1e6;
11306
11306
  return contains.contextWindowSize;
@@ -11421,11 +11421,11 @@ var require_xterm_headless = __commonJS({
11421
11421
  };
11422
11422
  }, 5777: (e2, t2, s2) => {
11423
11423
  Object.defineProperty(t2, "__esModule", { value: true }), t2.CoreTerminal = void 0;
11424
- 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);
11425
- let m2 = false;
11426
- class b2 extends v2.Disposable {
11424
+ 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);
11425
+ let m = false;
11426
+ class b extends v.Disposable {
11427
11427
  get onScroll() {
11428
- return this._onScrollApi || (this._onScrollApi = this._register(new g2.Emitter()), this._onScroll.event(((e3) => {
11428
+ return this._onScrollApi || (this._onScrollApi = this._register(new g.Emitter()), this._onScroll.event(((e3) => {
11429
11429
  this._onScrollApi?.fire(e3.position);
11430
11430
  }))), this._onScrollApi.event;
11431
11431
  }
@@ -11445,15 +11445,15 @@ var require_xterm_headless = __commonJS({
11445
11445
  for (const t3 in e3) this.optionsService.options[t3] = e3[t3];
11446
11446
  }
11447
11447
  constructor(e3) {
11448
- 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((() => {
11448
+ 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((() => {
11449
11449
  this._onScroll.fire({ position: this._bufferService.buffer.ydisp }), this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
11450
- }))), this._writeBuffer = this._register(new _2.WriteBuffer(((e4, t3) => this._inputHandler.parse(e4, t3)))), this._register(g2.Event.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));
11450
+ }))), this._writeBuffer = this._register(new _.WriteBuffer(((e4, t3) => this._inputHandler.parse(e4, t3)))), this._register(g.Event.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));
11451
11451
  }
11452
11452
  write(e3, t3) {
11453
11453
  this._writeBuffer.write(e3, t3);
11454
11454
  }
11455
11455
  writeSync(e3, t3) {
11456
- 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);
11456
+ 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);
11457
11457
  }
11458
11458
  input(e3, t3 = true) {
11459
11459
  this.coreService.triggerDataEvent(e3, t3);
@@ -11506,13 +11506,13 @@ var require_xterm_headless = __commonJS({
11506
11506
  _enableWindowsWrappingHeuristics() {
11507
11507
  if (!this._windowsWrappingHeuristics.value) {
11508
11508
  const e3 = [];
11509
- 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)((() => {
11509
+ 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)((() => {
11510
11510
  for (const t3 of e3) t3.dispose();
11511
11511
  }));
11512
11512
  }
11513
11513
  }
11514
11514
  }
11515
- t2.CoreTerminal = b2;
11515
+ t2.CoreTerminal = b;
11516
11516
  }, 2486: function(e2, t2, s2) {
11517
11517
  var i2 = this && this.__decorate || function(e3, t3, s3, i3) {
11518
11518
  var r3, n3 = arguments.length, o2 = n3 < 3 ? t3 : null === i3 ? i3 = Object.getOwnPropertyDescriptor(t3, s3) : i3;
@@ -11524,8 +11524,8 @@ var require_xterm_headless = __commonJS({
11524
11524
  t3(s3, i3, e3);
11525
11525
  };
11526
11526
  };
11527
- Object.defineProperty(t2, "__esModule", { value: true }), t2.InputHandler = t2.WindowsOptionsReportType = void 0, t2.isValidColorIndex = k2;
11528
- 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;
11527
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.InputHandler = t2.WindowsOptionsReportType = void 0, t2.isValidColorIndex = k;
11528
+ 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;
11529
11529
  function C(e3, t3) {
11530
11530
  if (e3 > 24) return t3.setWinLines || false;
11531
11531
  switch (e3) {
@@ -11576,17 +11576,17 @@ var require_xterm_headless = __commonJS({
11576
11576
  }
11577
11577
  return false;
11578
11578
  }
11579
- var w2;
11579
+ var w;
11580
11580
  !(function(e3) {
11581
11581
  e3[e3.GET_WIN_SIZE_PIXELS = 0] = "GET_WIN_SIZE_PIXELS", e3[e3.GET_CELL_SIZE_PIXELS = 1] = "GET_CELL_SIZE_PIXELS";
11582
- })(w2 || (t2.WindowsOptionsReportType = w2 = {}));
11583
- let E2 = 0;
11584
- class A2 extends h.Disposable {
11582
+ })(w || (t2.WindowsOptionsReportType = w = {}));
11583
+ let E = 0;
11584
+ class A extends h.Disposable {
11585
11585
  getAttrData() {
11586
11586
  return this._curAttrData;
11587
11587
  }
11588
11588
  constructor(e3, t3, s3, i3, r3, h2, u2, d2, f2 = new a.EscapeSequenceParser()) {
11589
- 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) => {
11589
+ 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) => {
11590
11590
  this._logService.debug("Unknown CSI code: ", { identifier: this._parser.identToString(e4), params: t4.toArray() });
11591
11591
  })), this._parser.setEscHandlerFallback(((e4) => {
11592
11592
  this._logService.debug("Unknown ESC code: ", { identifier: this._parser.identToString(e4) });
@@ -11596,15 +11596,15 @@ var require_xterm_headless = __commonJS({
11596
11596
  this._logService.debug("Unknown OSC code: ", { identifier: e4, action: t4, data: s4 });
11597
11597
  })), this._parser.setDcsHandlerFallback(((e4, t4, s4) => {
11598
11598
  "HOOK" === t4 && (s4 = s4.toArray()), this._logService.debug("Unknown DCS code: ", { identifier: this._parser.identToString(e4), action: t4, payload: s4 });
11599
- })), 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()));
11599
+ })), 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()));
11600
11600
  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)));
11601
- 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))));
11601
+ 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))));
11602
11602
  }
11603
11603
  _preserveStack(e3, t3, s3, i3) {
11604
11604
  this._parseStack.paused = true, this._parseStack.cursorStartX = e3, this._parseStack.cursorStartY = t3, this._parseStack.decodedLength = s3, this._parseStack.position = i3;
11605
11605
  }
11606
11606
  _logSlowResolvingAsync(e3) {
11607
- this._logService.logLevel <= _2.LogLevelEnum.WARN && Promise.race([e3, new Promise(((e4, t3) => setTimeout((() => t3("#SLOW_TIMEOUT")), 5e3)))]).catch(((e4) => {
11607
+ this._logService.logLevel <= _.LogLevelEnum.WARN && Promise.race([e3, new Promise(((e4, t3) => setTimeout((() => t3("#SLOW_TIMEOUT")), 5e3)))]).catch(((e4) => {
11608
11608
  if ("#SLOW_TIMEOUT" !== e4) throw e4;
11609
11609
  console.warn("async parser handler taking longer than 5000 ms");
11610
11610
  }));
@@ -11617,10 +11617,10 @@ var require_xterm_headless = __commonJS({
11617
11617
  const o2 = this._parseStack.paused;
11618
11618
  if (o2) {
11619
11619
  if (s3 = this._parser.parse(this._parseBuffer, this._parseStack.decodedLength, t3)) return this._logSlowResolvingAsync(s3), s3;
11620
- i3 = this._parseStack.cursorStartX, r3 = this._parseStack.cursorStartY, this._parseStack.paused = false, e3.length > y2 && (n3 = this._parseStack.position + y2);
11620
+ i3 = this._parseStack.cursorStartX, r3 = this._parseStack.cursorStartY, this._parseStack.paused = false, e3.length > y && (n3 = this._parseStack.position + y);
11621
11621
  }
11622
- 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) {
11623
- 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);
11622
+ 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) {
11623
+ 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);
11624
11624
  if (s3 = this._parser.parse(this._parseBuffer, o3)) return this._preserveStack(i3, r3, o3, t4), this._logSlowResolvingAsync(s3), s3;
11625
11625
  }
11626
11626
  else if (!o2) {
@@ -11634,43 +11634,43 @@ var require_xterm_headless = __commonJS({
11634
11634
  print(e3, t3, s3) {
11635
11635
  let i3, r3;
11636
11636
  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;
11637
- let _3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
11638
- 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);
11639
- let g3 = this._parser.precedingJoinState;
11640
- for (let v3 = t3; v3 < s3; ++v3) {
11641
- if (i3 = e3[v3], i3 < 127 && n3) {
11637
+ let _2 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
11638
+ 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);
11639
+ let g2 = this._parser.precedingJoinState;
11640
+ for (let v2 = t3; v2 < s3; ++v2) {
11641
+ if (i3 = e3[v2], i3 < 127 && n3) {
11642
11642
  const e4 = n3[String.fromCharCode(i3)];
11643
11643
  e4 && (i3 = e4.charCodeAt(0));
11644
11644
  }
11645
- const t4 = this._unicodeService.charProperties(i3, g3);
11646
- r3 = p2.UnicodeService.extractWidth(t4);
11647
- const s4 = p2.UnicodeService.extractShouldJoin(t4), m3 = s4 ? p2.UnicodeService.extractWidth(g3) : 0;
11648
- 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) {
11645
+ const t4 = this._unicodeService.charProperties(i3, g2);
11646
+ r3 = p.UnicodeService.extractWidth(t4);
11647
+ const s4 = p.UnicodeService.extractShouldJoin(t4), m2 = s4 ? p.UnicodeService.extractWidth(g2) : 0;
11648
+ 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) {
11649
11649
  if (h2) {
11650
- const e4 = _3;
11651
- let t5 = this._activeBuffer.x - m3;
11652
- 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);
11650
+ const e4 = _2;
11651
+ let t5 = this._activeBuffer.x - m2;
11652
+ 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);
11653
11653
  } else if (this._activeBuffer.x = a2 - 1, 2 === r3) continue;
11654
11654
  }
11655
11655
  if (s4 && this._activeBuffer.x) {
11656
- const e4 = _3.getWidth(this._activeBuffer.x - 1) ? 1 : 2;
11657
- _3.addCodepointToCell(this._activeBuffer.x - e4, i3, r3);
11658
- for (let e5 = r3 - m3; --e5 >= 0; ) _3.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, f2);
11659
- } 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);
11656
+ const e4 = _2.getWidth(this._activeBuffer.x - 1) ? 1 : 2;
11657
+ _2.addCodepointToCell(this._activeBuffer.x - e4, i3, r3);
11658
+ for (let e5 = r3 - m2; --e5 >= 0; ) _2.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, f2);
11659
+ } 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);
11660
11660
  }
11661
- 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);
11661
+ 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);
11662
11662
  }
11663
11663
  registerCsiHandler(e3, t3) {
11664
11664
  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)));
11665
11665
  }
11666
11666
  registerDcsHandler(e3, t3) {
11667
- return this._parser.registerDcsHandler(e3, new v2.DcsHandler(t3));
11667
+ return this._parser.registerDcsHandler(e3, new v.DcsHandler(t3));
11668
11668
  }
11669
11669
  registerEscHandler(e3, t3) {
11670
11670
  return this._parser.registerEscHandler(e3, t3);
11671
11671
  }
11672
11672
  registerOscHandler(e3, t3) {
11673
- return this._parser.registerOscHandler(e3, new g2.OscHandler(t3));
11673
+ return this._parser.registerOscHandler(e3, new g.OscHandler(t3));
11674
11674
  }
11675
11675
  bell() {
11676
11676
  return this._onRequestBell.fire(), true;
@@ -11903,7 +11903,7 @@ var require_xterm_headless = __commonJS({
11903
11903
  repeatPrecedingCharacter(e3) {
11904
11904
  const t3 = this._parser.precedingJoinState;
11905
11905
  if (!t3) return true;
11906
- 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);
11906
+ 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);
11907
11907
  let a2 = 0;
11908
11908
  for (let e4 = 0; e4 < n3.length; ) {
11909
11909
  const t4 = n3.codePointAt(e4) || 0;
@@ -12078,8 +12078,8 @@ var require_xterm_headless = __commonJS({
12078
12078
  }
12079
12079
  requestMode(e3, t3) {
12080
12080
  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];
12081
- 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;
12082
- var _3, p3;
12081
+ 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;
12082
+ var _2, p2;
12083
12083
  }
12084
12084
  _updateAttrColor(e3, t3, s3, i3, r3) {
12085
12085
  return 2 === t3 ? (e3 |= 50331648, e3 &= -16777216, e3 |= f.AttributeData.fromColorRGB([s3, i3, r3])) : 5 === t3 && (e3 &= -50331904, e3 |= 33554432 | 255 & s3), e3;
@@ -12179,10 +12179,10 @@ var require_xterm_headless = __commonJS({
12179
12179
  const t3 = e3.length > 1 ? e3.params[1] : 0;
12180
12180
  switch (e3.params[0]) {
12181
12181
  case 14:
12182
- 2 !== t3 && this._onRequestWindowsOptionsReport.fire(w2.GET_WIN_SIZE_PIXELS);
12182
+ 2 !== t3 && this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);
12183
12183
  break;
12184
12184
  case 16:
12185
- this._onRequestWindowsOptionsReport.fire(w2.GET_CELL_SIZE_PIXELS);
12185
+ this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);
12186
12186
  break;
12187
12187
  case 18:
12188
12188
  this._bufferService && this._coreService.triggerDataEvent(`${n2.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);
@@ -12213,9 +12213,9 @@ var require_xterm_headless = __commonJS({
12213
12213
  const e4 = s3.shift(), i3 = s3.shift();
12214
12214
  if (/^\d+$/.exec(e4)) {
12215
12215
  const s4 = parseInt(e4);
12216
- if (k2(s4)) if ("?" === i3) t3.push({ type: 0, index: s4 });
12216
+ if (k(s4)) if ("?" === i3) t3.push({ type: 0, index: s4 });
12217
12217
  else {
12218
- const e5 = (0, m2.parseColor)(i3);
12218
+ const e5 = (0, m.parseColor)(i3);
12219
12219
  e5 && t3.push({ type: 1, index: s4, color: e5 });
12220
12220
  }
12221
12221
  }
@@ -12242,7 +12242,7 @@ var require_xterm_headless = __commonJS({
12242
12242
  const s3 = e3.split(";");
12243
12243
  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] }]);
12244
12244
  else {
12245
- const i3 = (0, m2.parseColor)(s3[e4]);
12245
+ const i3 = (0, m.parseColor)(s3[e4]);
12246
12246
  i3 && this._onColor.fire([{ type: 1, index: this._specialColors[t3], color: i3 }]);
12247
12247
  }
12248
12248
  return true;
@@ -12261,7 +12261,7 @@ var require_xterm_headless = __commonJS({
12261
12261
  const t3 = [], s3 = e3.split(";");
12262
12262
  for (let e4 = 0; e4 < s3.length; ++e4) if (/^\d+$/.exec(s3[e4])) {
12263
12263
  const i3 = parseInt(s3[e4]);
12264
- k2(i3) && t3.push({ type: 2, index: i3 });
12264
+ k(i3) && t3.push({ type: 2, index: i3 });
12265
12265
  }
12266
12266
  return t3.length && this._onColor.fire(t3), true;
12267
12267
  }
@@ -12287,7 +12287,7 @@ var require_xterm_headless = __commonJS({
12287
12287
  return this._charsetService.setgLevel(0), this._charsetService.setgCharset(0, o.DEFAULT_CHARSET), true;
12288
12288
  }
12289
12289
  selectCharset(e3) {
12290
- return 2 !== e3.length ? (this.selectDefaultCharset(), true) : ("/" === e3[0] || this._charsetService.setgCharset(S2[e3[0]], o.CHARSETS[e3[1]] || o.DEFAULT_CHARSET), true);
12290
+ return 2 !== e3.length ? (this.selectDefaultCharset(), true) : ("/" === e3[0] || this._charsetService.setgCharset(S[e3[0]], o.CHARSETS[e3[1]] || o.DEFAULT_CHARSET), true);
12291
12291
  }
12292
12292
  index() {
12293
12293
  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;
@@ -12331,7 +12331,7 @@ var require_xterm_headless = __commonJS({
12331
12331
  this._dirtyRowTracker.markRangeDirty(e3, t3);
12332
12332
  }
12333
12333
  }
12334
- t2.InputHandler = A2;
12334
+ t2.InputHandler = A;
12335
12335
  let L = class {
12336
12336
  constructor(e3) {
12337
12337
  this._bufferService = e3, this.clearRange();
@@ -12343,16 +12343,16 @@ var require_xterm_headless = __commonJS({
12343
12343
  e3 < this.start ? this.start = e3 : e3 > this.end && (this.end = e3);
12344
12344
  }
12345
12345
  markRangeDirty(e3, t3) {
12346
- e3 > t3 && (E2 = e3, e3 = t3, t3 = E2), e3 < this.start && (this.start = e3), t3 > this.end && (this.end = t3);
12346
+ e3 > t3 && (E = e3, e3 = t3, t3 = E), e3 < this.start && (this.start = e3), t3 > this.end && (this.end = t3);
12347
12347
  }
12348
12348
  markAllDirty() {
12349
12349
  this.markRangeDirty(0, this._bufferService.rows - 1);
12350
12350
  }
12351
12351
  };
12352
- function k2(e3) {
12352
+ function k(e3) {
12353
12353
  return 0 <= e3 && e3 < 256;
12354
12354
  }
12355
- L = i2([r2(0, _2.IBufferService)], L);
12355
+ L = i2([r2(0, _.IBufferService)], L);
12356
12356
  }, 701: (e2, t2) => {
12357
12357
  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() {
12358
12358
  if (!t2.isSafari) return 0;
@@ -12699,29 +12699,29 @@ var require_xterm_headless = __commonJS({
12699
12699
  if (e4 >= h2 && e4 < h2 + l2.length) continue;
12700
12700
  }
12701
12701
  const u2 = l2[l2.length - 1].getTrimmedLength(), d = (0, a.reflowSmallerGetNewLineLengths)(l2, this._cols, e3), f = d.length - l2.length;
12702
- let _2;
12703
- _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);
12704
- const p2 = [];
12702
+ let _;
12703
+ _ = 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);
12704
+ const p = [];
12705
12705
  for (let e4 = 0; e4 < f; e4++) {
12706
12706
  const e5 = this.getBlankLine(o.DEFAULT_ATTR_DATA, true);
12707
- p2.push(e5);
12707
+ p.push(e5);
12708
12708
  }
12709
- p2.length > 0 && (r3.push({ start: h2 + l2.length + n3, newLines: p2 }), n3 += p2.length), l2.push(...p2);
12710
- let g2 = d.length - 1, v2 = d[g2];
12711
- 0 === v2 && (g2--, v2 = d[g2]);
12712
- let m2 = l2.length - f - 1, b2 = u2;
12713
- for (; m2 >= 0; ) {
12714
- const e4 = Math.min(b2, v2);
12715
- if (void 0 === l2[g2]) break;
12716
- if (l2[g2].copyCellsFrom(l2[m2], b2 - e4, v2 - e4, e4, true), v2 -= e4, 0 === v2 && (g2--, v2 = d[g2]), b2 -= e4, 0 === b2) {
12717
- m2--;
12718
- const e5 = Math.max(m2, 0);
12719
- b2 = (0, a.getWrappedLineTrimmedLength)(l2, e5, this._cols);
12709
+ p.length > 0 && (r3.push({ start: h2 + l2.length + n3, newLines: p }), n3 += p.length), l2.push(...p);
12710
+ let g = d.length - 1, v = d[g];
12711
+ 0 === v && (g--, v = d[g]);
12712
+ let m = l2.length - f - 1, b = u2;
12713
+ for (; m >= 0; ) {
12714
+ const e4 = Math.min(b, v);
12715
+ if (void 0 === l2[g]) break;
12716
+ if (l2[g].copyCellsFrom(l2[m], b - e4, v - e4, e4, true), v -= e4, 0 === v && (g--, v = d[g]), b -= e4, 0 === b) {
12717
+ m--;
12718
+ const e5 = Math.max(m, 0);
12719
+ b = (0, a.getWrappedLineTrimmedLength)(l2, e5, this._cols);
12720
12720
  }
12721
12721
  }
12722
12722
  for (let t4 = 0; t4 < l2.length; t4++) d[t4] < e3 && l2[t4].setCell(d[t4], i3);
12723
- let S2 = f - _2;
12724
- 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++);
12723
+ let S = f - _;
12724
+ 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++);
12725
12725
  this.savedY = Math.min(this.savedY + f, this.ybase + t3 - 1);
12726
12726
  }
12727
12727
  if (r3.length > 0) {
@@ -12973,15 +12973,15 @@ var require_xterm_headless = __commonJS({
12973
12973
  h += u.length - 1;
12974
12974
  continue;
12975
12975
  }
12976
- let d = 0, f = s2(u, d, t3), _2 = 1, p2 = 0;
12977
- for (; _2 < u.length; ) {
12978
- const e4 = s2(u, _2, t3), r3 = e4 - p2, o2 = i2 - f, a2 = Math.min(r3, o2);
12979
- 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));
12976
+ let d = 0, f = s2(u, d, t3), _ = 1, p = 0;
12977
+ for (; _ < u.length; ) {
12978
+ const e4 = s2(u, _, t3), r3 = e4 - p, o2 = i2 - f, a2 = Math.min(r3, o2);
12979
+ 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));
12980
12980
  }
12981
12981
  u[d].replaceCells(f, i2, n2);
12982
- let g2 = 0;
12983
- for (let e4 = u.length - 1; e4 > 0 && (e4 > d || 0 === u[e4].getTrimmedLength()); e4--) g2++;
12984
- g2 > 0 && (a.push(h + u.length - g2), a.push(g2)), h += u.length - 1;
12982
+ let g = 0;
12983
+ for (let e4 = u.length - 1; e4 > 0 && (e4 > d || 0 === u[e4].getTrimmedLength()); e4--) g++;
12984
+ g > 0 && (a.push(h + u.length - g), a.push(g)), h += u.length - 1;
12985
12985
  }
12986
12986
  return a;
12987
12987
  }, t2.reflowLargerCreateNewLayout = function(e3, t3) {
@@ -15134,7 +15134,7 @@ var require_xterm_headless = __commonJS({
15134
15134
  }
15135
15135
  function r3(e4, t4) {
15136
15136
  let s4;
15137
- const i4 = new v2({ onWillAddFirstListener() {
15137
+ const i4 = new v({ onWillAddFirstListener() {
15138
15138
  s4 = e4(i4.fire, i4);
15139
15139
  }, onDidRemoveLastListener() {
15140
15140
  s4?.dispose();
@@ -15143,7 +15143,7 @@ var require_xterm_headless = __commonJS({
15143
15143
  }
15144
15144
  function o2(e4, t4, s4 = 100, i4 = false, r4 = false, n3, o3) {
15145
15145
  let a3, h3, c3, l2, u2 = 0;
15146
- const d2 = new v2({ leakWarningThreshold: n3, onWillAddFirstListener() {
15146
+ const d2 = new v({ leakWarningThreshold: n3, onWillAddFirstListener() {
15147
15147
  a3 = e4(((e5) => {
15148
15148
  u2++, h3 = t4(h3, e5), i4 && !c3 && (d2.fire(h3), h3 = void 0), l2 = () => {
15149
15149
  const e6 = h3;
@@ -15191,7 +15191,7 @@ var require_xterm_headless = __commonJS({
15191
15191
  i4 && i4.add(n3);
15192
15192
  const o3 = () => {
15193
15193
  r4?.forEach(((e5) => a3.fire(e5))), r4 = null;
15194
- }, a3 = new v2({ onWillAddFirstListener() {
15194
+ }, a3 = new v({ onWillAddFirstListener() {
15195
15195
  n3 || (n3 = e4(((e5) => a3.fire(e5))), i4 && i4.add(n3));
15196
15196
  }, onDidAddFirstListener() {
15197
15197
  r4 && (t4 ? setTimeout(o3) : o3());
@@ -15239,15 +15239,15 @@ var require_xterm_headless = __commonJS({
15239
15239
  }
15240
15240
  }
15241
15241
  e3.fromNodeEventEmitter = function(e4, t4, s4 = (e5) => e5) {
15242
- const i4 = (...e5) => r4.fire(s4(...e5)), r4 = new v2({ onWillAddFirstListener: () => e4.on(t4, i4), onDidRemoveLastListener: () => e4.removeListener(t4, i4) });
15242
+ const i4 = (...e5) => r4.fire(s4(...e5)), r4 = new v({ onWillAddFirstListener: () => e4.on(t4, i4), onDidRemoveLastListener: () => e4.removeListener(t4, i4) });
15243
15243
  return r4.event;
15244
15244
  }, e3.fromDOMEventEmitter = function(e4, t4, s4 = (e5) => e5) {
15245
- const i4 = (...e5) => r4.fire(s4(...e5)), r4 = new v2({ onWillAddFirstListener: () => e4.addEventListener(t4, i4), onDidRemoveLastListener: () => e4.removeEventListener(t4, i4) });
15245
+ const i4 = (...e5) => r4.fire(s4(...e5)), r4 = new v({ onWillAddFirstListener: () => e4.addEventListener(t4, i4), onDidRemoveLastListener: () => e4.removeEventListener(t4, i4) });
15246
15246
  return r4.event;
15247
15247
  }, e3.toPromise = function(e4) {
15248
15248
  return new Promise(((s4) => t3(e4)(s4)));
15249
15249
  }, e3.fromPromise = function(e4) {
15250
- const t4 = new v2();
15250
+ const t4 = new v();
15251
15251
  return e4.then(((e5) => {
15252
15252
  t4.fire(e5);
15253
15253
  }), (() => {
@@ -15268,7 +15268,7 @@ var require_xterm_headless = __commonJS({
15268
15268
  }, onDidRemoveLastListener: () => {
15269
15269
  e4.removeObserver(this);
15270
15270
  } };
15271
- this.emitter = new v2(s4), t4 && t4.add(this.emitter);
15271
+ this.emitter = new v(s4), t4 && t4.add(this.emitter);
15272
15272
  }
15273
15273
  beginUpdate(e4) {
15274
15274
  this._counter++;
@@ -15377,19 +15377,19 @@ var require_xterm_headless = __commonJS({
15377
15377
  }
15378
15378
  }
15379
15379
  t2.ListenerLeakError = f;
15380
- class _2 extends Error {
15380
+ class _ extends Error {
15381
15381
  constructor(e3, t3) {
15382
15382
  super(e3), this.name = "ListenerRefusalError", this.stack = t3;
15383
15383
  }
15384
15384
  }
15385
- t2.ListenerRefusalError = _2;
15386
- let p2 = 0;
15387
- class g2 {
15385
+ t2.ListenerRefusalError = _;
15386
+ let p = 0;
15387
+ class g {
15388
15388
  constructor(e3) {
15389
- this.value = e3, this.id = p2++;
15389
+ this.value = e3, this.id = p++;
15390
15390
  }
15391
15391
  }
15392
- class v2 {
15392
+ class v {
15393
15393
  constructor(e3) {
15394
15394
  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;
15395
15395
  }
@@ -15401,14 +15401,14 @@ var require_xterm_headless = __commonJS({
15401
15401
  if (this._leakageMon && this._size > this._leakageMon.threshold ** 2) {
15402
15402
  const e4 = `[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;
15403
15403
  console.warn(e4);
15404
- const t4 = this._leakageMon.getMostFrequentStack() ?? ["UNKNOWN stack", -1], s4 = new _2(`${e4}. HINT: Stack shows most frequent listener (${t4[1]}-times)`, t4[0]);
15404
+ const t4 = this._leakageMon.getMostFrequentStack() ?? ["UNKNOWN stack", -1], s4 = new _(`${e4}. HINT: Stack shows most frequent listener (${t4[1]}-times)`, t4[0]);
15405
15405
  return (this._options?.onListenerError || i2.onUnexpectedError)(s4), n2.Disposable.None;
15406
15406
  }
15407
15407
  if (this._disposed) return n2.Disposable.None;
15408
15408
  t3 && (e3 = e3.bind(t3));
15409
- const r3 = new g2(e3);
15409
+ const r3 = new g(e3);
15410
15410
  let o2;
15411
- 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++;
15411
+ 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++;
15412
15412
  const a2 = (0, n2.toDisposable)((() => {
15413
15413
  o2?.(), this._removeListener(r3);
15414
15414
  }));
@@ -15444,7 +15444,7 @@ var require_xterm_headless = __commonJS({
15444
15444
  e3.reset();
15445
15445
  }
15446
15446
  fire(e3) {
15447
- 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);
15447
+ 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);
15448
15448
  else {
15449
15449
  const t3 = this._deliveryQueue;
15450
15450
  t3.enqueue(this, e3, this._listeners.length), this._deliverQueue(t3);
@@ -15455,8 +15455,8 @@ var require_xterm_headless = __commonJS({
15455
15455
  return this._size > 0;
15456
15456
  }
15457
15457
  }
15458
- t2.Emitter = v2, t2.createEventDeliveryQueue = () => new m2();
15459
- class m2 {
15458
+ t2.Emitter = v, t2.createEventDeliveryQueue = () => new m();
15459
+ class m {
15460
15460
  constructor() {
15461
15461
  this.i = -1, this.end = 0;
15462
15462
  }
@@ -15467,10 +15467,10 @@ var require_xterm_headless = __commonJS({
15467
15467
  this.i = this.end, this.current = void 0, this.value = void 0;
15468
15468
  }
15469
15469
  }
15470
- t2.AsyncEmitter = class extends v2 {
15470
+ t2.AsyncEmitter = class extends v {
15471
15471
  async fireAsync(e3, t3, s3) {
15472
15472
  if (this._listeners) for (this._asyncDeliveryQueue || (this._asyncDeliveryQueue = new o.LinkedList()), ((e4, t4) => {
15473
- if (e4 instanceof g2) t4(e4);
15473
+ if (e4 instanceof g) t4(e4);
15474
15474
  else for (let s4 = 0; s4 < e4.length; s4++) {
15475
15475
  const i3 = e4[s4];
15476
15476
  i3 && t4(i3);
@@ -15492,7 +15492,7 @@ var require_xterm_headless = __commonJS({
15492
15492
  }
15493
15493
  }
15494
15494
  };
15495
- class b2 extends v2 {
15495
+ class b extends v {
15496
15496
  get isPaused() {
15497
15497
  return 0 !== this._isPaused;
15498
15498
  }
@@ -15514,7 +15514,7 @@ var require_xterm_headless = __commonJS({
15514
15514
  this._size && (0 !== this._isPaused ? this._eventQueue.push(e3) : super.fire(e3));
15515
15515
  }
15516
15516
  }
15517
- t2.PauseableEmitter = b2, t2.DebounceEmitter = class extends b2 {
15517
+ t2.PauseableEmitter = b, t2.DebounceEmitter = class extends b {
15518
15518
  constructor(e3) {
15519
15519
  super(e3), this._delay = e3.delay ?? 100;
15520
15520
  }
@@ -15523,7 +15523,7 @@ var require_xterm_headless = __commonJS({
15523
15523
  this._handle = void 0, this.resume();
15524
15524
  }), this._delay)), super.fire(e3);
15525
15525
  }
15526
- }, t2.MicrotaskEmitter = class extends v2 {
15526
+ }, t2.MicrotaskEmitter = class extends v {
15527
15527
  constructor(e3) {
15528
15528
  super(e3), this._queuedEvents = [], this._mergeFn = e3?.merge;
15529
15529
  }
@@ -15533,9 +15533,9 @@ var require_xterm_headless = __commonJS({
15533
15533
  })));
15534
15534
  }
15535
15535
  };
15536
- class S2 {
15536
+ class S {
15537
15537
  constructor() {
15538
- this.hasListeners = false, this.events = [], this.emitter = new v2({ onWillAddFirstListener: () => this.onFirstListenerAdd(), onDidRemoveLastListener: () => this.onLastListenerRemove() });
15538
+ this.hasListeners = false, this.events = [], this.emitter = new v({ onWillAddFirstListener: () => this.onFirstListenerAdd(), onDidRemoveLastListener: () => this.onLastListenerRemove() });
15539
15539
  }
15540
15540
  get event() {
15541
15541
  return this.emitter.event;
@@ -15566,10 +15566,10 @@ var require_xterm_headless = __commonJS({
15566
15566
  this.events = [];
15567
15567
  }
15568
15568
  }
15569
- t2.EventMultiplexer = S2, t2.DynamicListEventMultiplexer = class {
15569
+ t2.EventMultiplexer = S, t2.DynamicListEventMultiplexer = class {
15570
15570
  constructor(e3, t3, s3, i3) {
15571
15571
  this._store = new n2.DisposableStore();
15572
- const r3 = this._store.add(new S2()), o2 = this._store.add(new n2.DisposableMap());
15572
+ const r3 = this._store.add(new S()), o2 = this._store.add(new n2.DisposableMap());
15573
15573
  function a2(e4) {
15574
15574
  o2.set(e4, r3.add(i3(e4)));
15575
15575
  }
@@ -15605,7 +15605,7 @@ var require_xterm_headless = __commonJS({
15605
15605
  }
15606
15606
  }, t2.Relay = class {
15607
15607
  constructor() {
15608
- this.listening = false, this.inputEvent = h.None, this.inputEventListener = n2.Disposable.None, this.emitter = new v2({ onDidAddFirstListener: () => {
15608
+ this.listening = false, this.inputEvent = h.None, this.inputEventListener = n2.Disposable.None, this.emitter = new v({ onDidAddFirstListener: () => {
15609
15609
  this.listening = true, this.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);
15610
15610
  }, onDidRemoveLastListener: () => {
15611
15611
  this.listening = false, this.inputEventListener.dispose();
@@ -15619,10 +15619,10 @@ var require_xterm_headless = __commonJS({
15619
15619
  }
15620
15620
  }, t2.ValueWithChangeEvent = class {
15621
15621
  static const(e3) {
15622
- return new y2(e3);
15622
+ return new y(e3);
15623
15623
  }
15624
15624
  constructor(e3) {
15625
- this._value = e3, this._onDidChange = new v2(), this.onDidChange = this._onDidChange.event;
15625
+ this._value = e3, this._onDidChange = new v(), this.onDidChange = this._onDidChange.event;
15626
15626
  }
15627
15627
  get value() {
15628
15628
  return this._value;
@@ -15631,7 +15631,7 @@ var require_xterm_headless = __commonJS({
15631
15631
  e3 !== this._value && (this._value = e3, this._onDidChange.fire(void 0));
15632
15632
  }
15633
15633
  };
15634
- class y2 {
15634
+ class y {
15635
15635
  constructor(e3) {
15636
15636
  this.value = e3, this.onDidChange = h.None;
15637
15637
  }
@@ -15717,16 +15717,16 @@ var require_xterm_headless = __commonJS({
15717
15717
  h = e3;
15718
15718
  }, t2.trackDisposable = l, t2.markAsDisposed = u, t2.markAsSingleton = function(e3) {
15719
15719
  return h?.markAsSingleton(e3), e3;
15720
- }, t2.isDisposable = f, t2.dispose = _2, t2.disposeIfDisposable = function(e3) {
15720
+ }, t2.isDisposable = f, t2.dispose = _, t2.disposeIfDisposable = function(e3) {
15721
15721
  for (const t3 of e3) f(t3) && t3.dispose();
15722
15722
  return [];
15723
15723
  }, t2.combinedDisposable = function(...e3) {
15724
- const t3 = p2((() => _2(e3)));
15724
+ const t3 = p((() => _(e3)));
15725
15725
  return (function(e4, t4) {
15726
15726
  if (h) for (const s3 of e4) h.setParent(s3, t4);
15727
15727
  })(e3, t3), t3;
15728
- }, t2.toDisposable = p2, t2.disposeOnReturn = function(e3) {
15729
- const t3 = new g2();
15728
+ }, t2.toDisposable = p, t2.disposeOnReturn = function(e3) {
15729
+ const t3 = new g();
15730
15730
  try {
15731
15731
  e3(t3);
15732
15732
  } finally {
@@ -15832,7 +15832,7 @@ ${i3.join("\n")}
15832
15832
  function f(e3) {
15833
15833
  return "object" == typeof e3 && null !== e3 && "function" == typeof e3.dispose && 0 === e3.dispose.length;
15834
15834
  }
15835
- function _2(e3) {
15835
+ function _(e3) {
15836
15836
  if (a.Iterable.is(e3)) {
15837
15837
  const t3 = [];
15838
15838
  for (const s3 of e3) if (s3) try {
@@ -15846,14 +15846,14 @@ ${i3.join("\n")}
15846
15846
  }
15847
15847
  if (e3) return e3.dispose(), e3;
15848
15848
  }
15849
- function p2(e3) {
15849
+ function p(e3) {
15850
15850
  const t3 = l({ dispose: (0, o.createSingleCallFunction)((() => {
15851
15851
  u(t3), e3();
15852
15852
  })) });
15853
15853
  return t3;
15854
15854
  }
15855
15855
  t2.DisposableTracker = c;
15856
- class g2 {
15856
+ class g {
15857
15857
  static {
15858
15858
  this.DISABLE_DISPOSED_WARNING = false;
15859
15859
  }
@@ -15868,7 +15868,7 @@ ${i3.join("\n")}
15868
15868
  }
15869
15869
  clear() {
15870
15870
  if (0 !== this._toDispose.size) try {
15871
- _2(this._toDispose);
15871
+ _(this._toDispose);
15872
15872
  } finally {
15873
15873
  this._toDispose.clear();
15874
15874
  }
@@ -15876,7 +15876,7 @@ ${i3.join("\n")}
15876
15876
  add(e3) {
15877
15877
  if (!e3) return e3;
15878
15878
  if (e3 === this) throw new Error("Cannot register a disposable on itself!");
15879
- 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;
15879
+ 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;
15880
15880
  }
15881
15881
  delete(e3) {
15882
15882
  if (e3) {
@@ -15888,14 +15888,14 @@ ${i3.join("\n")}
15888
15888
  e3 && this._toDispose.has(e3) && (this._toDispose.delete(e3), d(e3, null));
15889
15889
  }
15890
15890
  }
15891
- t2.DisposableStore = g2;
15892
- class v2 {
15891
+ t2.DisposableStore = g;
15892
+ class v {
15893
15893
  static {
15894
15894
  this.None = Object.freeze({ dispose() {
15895
15895
  } });
15896
15896
  }
15897
15897
  constructor() {
15898
- this._store = new g2(), l(this), d(this._store, this);
15898
+ this._store = new g(), l(this), d(this._store, this);
15899
15899
  }
15900
15900
  dispose() {
15901
15901
  u(this), this._store.dispose();
@@ -15905,8 +15905,8 @@ ${i3.join("\n")}
15905
15905
  return this._store.add(e3);
15906
15906
  }
15907
15907
  }
15908
- t2.Disposable = v2;
15909
- class m2 {
15908
+ t2.Disposable = v;
15909
+ class m {
15910
15910
  constructor() {
15911
15911
  this._isDisposed = false, l(this);
15912
15912
  }
@@ -15927,9 +15927,9 @@ ${i3.join("\n")}
15927
15927
  return this._value = void 0, e3 && d(e3, null), e3;
15928
15928
  }
15929
15929
  }
15930
- t2.MutableDisposable = m2, t2.MandatoryMutableDisposable = class {
15930
+ t2.MutableDisposable = m, t2.MandatoryMutableDisposable = class {
15931
15931
  constructor(e3) {
15932
- this._disposable = new m2(), this._isDisposed = false, this._disposable.value = e3;
15932
+ this._disposable = new m(), this._isDisposed = false, this._disposable.value = e3;
15933
15933
  }
15934
15934
  get value() {
15935
15935
  return this._disposable.value;
@@ -15993,7 +15993,7 @@ ${i3.join("\n")}
15993
15993
  dispose() {
15994
15994
  }
15995
15995
  };
15996
- class b2 {
15996
+ class b {
15997
15997
  constructor() {
15998
15998
  this._store = /* @__PURE__ */ new Map(), this._isDisposed = false, l(this);
15999
15999
  }
@@ -16002,7 +16002,7 @@ ${i3.join("\n")}
16002
16002
  }
16003
16003
  clearAndDisposeAll() {
16004
16004
  if (this._store.size) try {
16005
- _2(this._store.values());
16005
+ _(this._store.values());
16006
16006
  } finally {
16007
16007
  this._store.clear();
16008
16008
  }
@@ -16036,7 +16036,7 @@ ${i3.join("\n")}
16036
16036
  return this._store[Symbol.iterator]();
16037
16037
  }
16038
16038
  }
16039
- t2.DisposableMap = b2;
16039
+ t2.DisposableMap = b;
16040
16040
  }, 6317: (e2, t2) => {
16041
16041
  Object.defineProperty(t2, "__esModule", { value: true }), t2.LinkedList = void 0;
16042
16042
  class s2 {
@@ -16380,6 +16380,372 @@ ${i3.join("\n")}
16380
16380
  }
16381
16381
  });
16382
16382
 
16383
+ // ../node_modules/.pnpm/@xterm+addon-serialize@0.14.0/node_modules/@xterm/addon-serialize/lib/addon-serialize.js
16384
+ var require_addon_serialize = __commonJS({
16385
+ "../node_modules/.pnpm/@xterm+addon-serialize@0.14.0/node_modules/@xterm/addon-serialize/lib/addon-serialize.js"(exports2, module2) {
16386
+ "use strict";
16387
+ !(function(t, e) {
16388
+ "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();
16389
+ })(globalThis, (() => (() => {
16390
+ "use strict";
16391
+ var t = { 992: (t2, e2, s2) => {
16392
+ Object.defineProperty(e2, "__esModule", { value: true }), e2.DEFAULT_ANSI_COLORS = void 0;
16393
+ const r2 = s2(993);
16394
+ e2.DEFAULT_ANSI_COLORS = Object.freeze((() => {
16395
+ 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];
16396
+ for (let s3 = 0; s3 < 216; s3++) {
16397
+ const i = e3[s3 / 36 % 6 | 0], o = e3[s3 / 6 % 6 | 0], n = e3[s3 % 6];
16398
+ t3.push({ css: r2.channels.toCss(i, o, n), rgba: r2.channels.toRgba(i, o, n) });
16399
+ }
16400
+ for (let e4 = 0; e4 < 24; e4++) {
16401
+ const s3 = 8 + 10 * e4;
16402
+ t3.push({ css: r2.channels.toCss(s3, s3, s3), rgba: r2.channels.toRgba(s3, s3, s3) });
16403
+ }
16404
+ return t3;
16405
+ })());
16406
+ }, 993: (t2, e2) => {
16407
+ 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 = _;
16408
+ let s2 = 0, r2 = 0, i = 0, o = 0;
16409
+ var n, l, a, u, h;
16410
+ function c(t3) {
16411
+ const e3 = t3.toString(16);
16412
+ return e3.length < 2 ? "0" + e3 : e3;
16413
+ }
16414
+ function _(t3, e3) {
16415
+ return t3 < e3 ? (e3 + 0.05) / (t3 + 0.05) : (t3 + 0.05) / (e3 + 0.05);
16416
+ }
16417
+ e2.NULL_COLOR = { css: "#00000000", rgba: 0 }, (function(t3) {
16418
+ t3.toCss = function(t4, e3, s3, r3) {
16419
+ return void 0 !== r3 ? `#${c(t4)}${c(e3)}${c(s3)}${c(r3)}` : `#${c(t4)}${c(e3)}${c(s3)}`;
16420
+ }, t3.toRgba = function(t4, e3, s3, r3 = 255) {
16421
+ return (t4 << 24 | e3 << 16 | s3 << 8 | r3) >>> 0;
16422
+ }, t3.toColor = function(e3, s3, r3, i2) {
16423
+ return { css: t3.toCss(e3, s3, r3, i2), rgba: t3.toRgba(e3, s3, r3, i2) };
16424
+ };
16425
+ })(n || (e2.channels = n = {})), (function(t3) {
16426
+ function e3(t4, e4) {
16427
+ 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) };
16428
+ }
16429
+ t3.blend = function(t4, e4) {
16430
+ if (o = (255 & e4.rgba) / 255, 1 === o) return { css: e4.css, rgba: e4.rgba };
16431
+ 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;
16432
+ 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) };
16433
+ }, t3.isOpaque = function(t4) {
16434
+ return !(255 & ~t4.rgba);
16435
+ }, t3.ensureContrastRatio = function(t4, e4, s3) {
16436
+ const r3 = h.ensureContrastRatio(t4.rgba, e4.rgba, s3);
16437
+ if (r3) return n.toColor(r3 >> 24 & 255, r3 >> 16 & 255, r3 >> 8 & 255);
16438
+ }, t3.opaque = function(t4) {
16439
+ const e4 = (255 | t4.rgba) >>> 0;
16440
+ return [s2, r2, i] = h.toChannels(e4), { css: n.toCss(s2, r2, i), rgba: e4 };
16441
+ }, t3.opacity = e3, t3.multiplyOpacity = function(t4, s3) {
16442
+ return o = 255 & t4.rgba, e3(t4, o * s3 / 255);
16443
+ }, t3.toColorRGB = function(t4) {
16444
+ return [t4.rgba >> 24 & 255, t4.rgba >> 16 & 255, t4.rgba >> 8 & 255];
16445
+ };
16446
+ })(l || (e2.color = l = {})), (function(t3) {
16447
+ let e3, l2;
16448
+ try {
16449
+ const t4 = document.createElement("canvas");
16450
+ t4.width = 1, t4.height = 1;
16451
+ const s3 = t4.getContext("2d", { willReadFrequently: true });
16452
+ s3 && (e3 = s3, e3.globalCompositeOperation = "copy", l2 = e3.createLinearGradient(0, 0, 1, 1));
16453
+ } catch {
16454
+ }
16455
+ t3.toColor = function(t4) {
16456
+ if (t4.match(/#[\da-f]{3,8}/i)) switch (t4.length) {
16457
+ case 4:
16458
+ 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);
16459
+ case 5:
16460
+ 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);
16461
+ case 7:
16462
+ return { css: t4, rgba: (parseInt(t4.slice(1), 16) << 8 | 255) >>> 0 };
16463
+ case 9:
16464
+ return { css: t4, rgba: parseInt(t4.slice(1), 16) >>> 0 };
16465
+ }
16466
+ 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*)?\)/);
16467
+ 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);
16468
+ if (!e3 || !l2) throw new Error("css.toColor: Unsupported css format");
16469
+ if (e3.fillStyle = l2, e3.fillStyle = t4, "string" != typeof e3.fillStyle) throw new Error("css.toColor: Unsupported css format");
16470
+ 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");
16471
+ return { rgba: n.toRgba(s2, r2, i, o), css: t4 };
16472
+ };
16473
+ })(a || (e2.css = a = {})), (function(t3) {
16474
+ function e3(t4, e4, s3) {
16475
+ const r3 = t4 / 255, i2 = e4 / 255, o2 = s3 / 255;
16476
+ 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));
16477
+ }
16478
+ t3.relativeLuminance = function(t4) {
16479
+ return e3(t4 >> 16 & 255, t4 >> 8 & 255, 255 & t4);
16480
+ }, t3.relativeLuminance2 = e3;
16481
+ })(u || (e2.rgb = u = {})), (function(t3) {
16482
+ function e3(t4, e4, s3) {
16483
+ const r3 = t4 >> 24 & 255, i2 = t4 >> 16 & 255, o2 = t4 >> 8 & 255;
16484
+ let n2 = e4 >> 24 & 255, l3 = e4 >> 16 & 255, a2 = e4 >> 8 & 255, h2 = _(u.relativeLuminance2(n2, l3, a2), u.relativeLuminance2(r3, i2, o2));
16485
+ 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));
16486
+ return (n2 << 24 | l3 << 16 | a2 << 8 | 255) >>> 0;
16487
+ }
16488
+ function l2(t4, e4, s3) {
16489
+ const r3 = t4 >> 24 & 255, i2 = t4 >> 16 & 255, o2 = t4 >> 8 & 255;
16490
+ let n2 = e4 >> 24 & 255, l3 = e4 >> 16 & 255, a2 = e4 >> 8 & 255, h2 = _(u.relativeLuminance2(n2, l3, a2), u.relativeLuminance2(r3, i2, o2));
16491
+ 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));
16492
+ return (n2 << 24 | l3 << 16 | a2 << 8 | 255) >>> 0;
16493
+ }
16494
+ t3.blend = function(t4, e4) {
16495
+ if (o = (255 & e4) / 255, 1 === o) return e4;
16496
+ 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;
16497
+ 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);
16498
+ }, t3.ensureContrastRatio = function(t4, s3, r3) {
16499
+ const i2 = u.relativeLuminance(t4 >> 8), o2 = u.relativeLuminance(s3 >> 8);
16500
+ if (_(i2, o2) < r3) {
16501
+ if (o2 < i2) {
16502
+ const o3 = e3(t4, s3, r3), n3 = _(i2, u.relativeLuminance(o3 >> 8));
16503
+ if (n3 < r3) {
16504
+ const e4 = l2(t4, s3, r3);
16505
+ return n3 > _(i2, u.relativeLuminance(e4 >> 8)) ? o3 : e4;
16506
+ }
16507
+ return o3;
16508
+ }
16509
+ const n2 = l2(t4, s3, r3), a2 = _(i2, u.relativeLuminance(n2 >> 8));
16510
+ if (a2 < r3) {
16511
+ const o3 = e3(t4, s3, r3);
16512
+ return a2 > _(i2, u.relativeLuminance(o3 >> 8)) ? n2 : o3;
16513
+ }
16514
+ return n2;
16515
+ }
16516
+ }, t3.reduceLuminance = e3, t3.increaseLuminance = l2, t3.toChannels = function(t4) {
16517
+ return [t4 >> 24 & 255, t4 >> 16 & 255, t4 >> 8 & 255, 255 & t4];
16518
+ };
16519
+ })(h || (e2.rgba = h = {}));
16520
+ } }, e = {};
16521
+ function s(r2) {
16522
+ var i = e[r2];
16523
+ if (void 0 !== i) return i.exports;
16524
+ var o = e[r2] = { exports: {} };
16525
+ return t[r2](o, o.exports, s), o.exports;
16526
+ }
16527
+ var r = {};
16528
+ return (() => {
16529
+ var t2 = r;
16530
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.HTMLSerializeHandler = t2.SerializeAddon = void 0;
16531
+ const e2 = s(992);
16532
+ function i(t3, e3, s2) {
16533
+ return Math.max(e3, Math.min(t3, s2));
16534
+ }
16535
+ class o {
16536
+ constructor(t3) {
16537
+ this._buffer = t3;
16538
+ }
16539
+ serialize(t3, e3) {
16540
+ const s2 = this._buffer.getNullCell(), r2 = this._buffer.getNullCell();
16541
+ let i2 = s2;
16542
+ const o2 = t3.start.y, n2 = t3.end.y, l2 = t3.start.x, a2 = t3.end.x;
16543
+ this._beforeSerialize(n2 - o2, o2, n2);
16544
+ for (let e4 = o2; e4 <= n2; e4++) {
16545
+ const o3 = this._buffer.getLine(e4);
16546
+ if (o3) {
16547
+ const n3 = e4 === t3.start.y ? l2 : 0, u2 = e4 === t3.end.y ? a2 : o3.length;
16548
+ for (let t4 = n3; t4 < u2; t4++) {
16549
+ const n4 = o3.getCell(t4, i2 === s2 ? r2 : s2);
16550
+ n4 ? (this._nextCell(n4, i2, e4, t4), i2 = n4) : console.warn(`Can't get cell at row=${e4}, col=${t4}`);
16551
+ }
16552
+ }
16553
+ this._rowEnd(e4, e4 === n2);
16554
+ }
16555
+ return this._afterSerialize(), this._serializeString(e3);
16556
+ }
16557
+ _nextCell(t3, e3, s2, r2) {
16558
+ }
16559
+ _rowEnd(t3, e3) {
16560
+ }
16561
+ _beforeSerialize(t3, e3, s2) {
16562
+ }
16563
+ _afterSerialize() {
16564
+ }
16565
+ _serializeString(t3) {
16566
+ return "";
16567
+ }
16568
+ }
16569
+ function n(t3, e3) {
16570
+ return t3.getFgColorMode() === e3.getFgColorMode() && t3.getFgColor() === e3.getFgColor();
16571
+ }
16572
+ function l(t3, e3) {
16573
+ return t3.getBgColorMode() === e3.getBgColorMode() && t3.getBgColor() === e3.getBgColor();
16574
+ }
16575
+ function a(t3, e3) {
16576
+ 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();
16577
+ }
16578
+ class u extends o {
16579
+ constructor(t3, e3) {
16580
+ 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();
16581
+ }
16582
+ _beforeSerialize(t3, e3, s2) {
16583
+ this._allRows = new Array(t3), this._lastContentCursorRow = e3, this._lastCursorRow = e3, this._firstRow = e3;
16584
+ }
16585
+ _rowEnd(t3, e3) {
16586
+ this._nullCellCount > 0 && !l(this._cursorStyle, this._backgroundCell) && (this._currentRow += `\x1B[${this._nullCellCount}X`);
16587
+ let s2 = "";
16588
+ if (!e3) {
16589
+ t3 - this._firstRow >= this._terminal.rows && this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol, this._backgroundCell);
16590
+ const e4 = this._buffer.getLine(t3), r2 = this._buffer.getLine(t3 + 1);
16591
+ if (r2.isWrapped) {
16592
+ s2 = "";
16593
+ 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;
16594
+ let u2 = false;
16595
+ (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);
16596
+ } else s2 = "\r\n", this._lastCursorRow = t3 + 1, this._lastCursorCol = 0;
16597
+ }
16598
+ this._allRows[this._rowIndex] = this._currentRow, this._allRowSeparators[this._rowIndex++] = s2, this._currentRow = "", this._nullCellCount = 0;
16599
+ }
16600
+ _diffStyle(t3, e3) {
16601
+ const s2 = [], r2 = !n(t3, e3), i2 = !l(t3, e3), o2 = !a(t3, e3);
16602
+ if (r2 || i2 || o2) if (t3.isAttributeDefault()) e3.isAttributeDefault() || s2.push(0);
16603
+ else {
16604
+ if (r2) {
16605
+ const e4 = t3.getFgColor();
16606
+ 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);
16607
+ }
16608
+ if (i2) {
16609
+ const e4 = t3.getBgColor();
16610
+ 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);
16611
+ }
16612
+ 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));
16613
+ }
16614
+ return s2;
16615
+ }
16616
+ _nextCell(t3, e3, s2, r2) {
16617
+ if (0 === t3.getWidth()) return;
16618
+ const i2 = "" === t3.getChars(), o2 = this._diffStyle(t3, this._cursorStyle);
16619
+ if (i2 ? !l(this._cursorStyle, t3) : o2.length > 0) {
16620
+ 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`;
16621
+ const t4 = this._buffer.getLine(s2);
16622
+ void 0 !== t4 && (t4.getCell(r2, this._cursorStyle), this._cursorStyleRow = s2, this._cursorStyleCol = r2);
16623
+ }
16624
+ 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());
16625
+ }
16626
+ _serializeString(t3) {
16627
+ let e3 = this._allRows.length;
16628
+ this._buffer.length - this._firstRow <= this._terminal.rows && (e3 = this._lastContentCursorRow + 1 - this._firstRow, this._lastCursorCol = this._lastContentCursorCol, this._lastCursorRow = this._lastContentCursorRow);
16629
+ let s2 = "";
16630
+ for (let t4 = 0; t4 < e3; t4++) s2 += this._allRows[t4], t4 + 1 < e3 && (s2 += this._allRowSeparators[t4]);
16631
+ if (!t3) {
16632
+ const t4 = this._buffer.baseY + this._buffer.cursorY, e4 = this._buffer.cursorX, i3 = (t5) => {
16633
+ t5 > 0 ? s2 += `\x1B[${t5}C` : t5 < 0 && (s2 += `\x1B[${-t5}D`);
16634
+ };
16635
+ (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));
16636
+ }
16637
+ var r2;
16638
+ const i2 = this._terminal._core._inputHandler._curAttrData, o2 = this._diffStyle(i2, this._cursorStyle);
16639
+ return o2.length > 0 && (s2 += `\x1B[${o2.join(";")}m`), s2;
16640
+ }
16641
+ }
16642
+ t2.SerializeAddon = class {
16643
+ activate(t3) {
16644
+ this._terminal = t3;
16645
+ }
16646
+ _serializeBufferByScrollback(t3, e3, s2) {
16647
+ const r2 = e3.length, o2 = void 0 === s2 ? r2 : i(s2 + t3.rows, 0, r2);
16648
+ return this._serializeBufferByRange(t3, e3, { start: r2 - o2, end: r2 - 1 }, false);
16649
+ }
16650
+ _serializeBufferByRange(t3, e3, s2, r2) {
16651
+ 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);
16652
+ }
16653
+ _serializeBufferAsHTML(t3, e3) {
16654
+ const s2 = t3.buffer.active, r2 = new h(s2, t3, e3), o2 = e3.onlySelection ?? false, n2 = e3.range;
16655
+ if (n2) return r2.serialize({ start: { x: n2.startCol, y: (n2.startLine, n2.startLine) }, end: { x: t3.cols, y: (n2.endLine, n2.endLine) } });
16656
+ if (!o2) {
16657
+ const o3 = s2.length, n3 = e3.scrollback, l3 = void 0 === n3 ? o3 : i(n3 + t3.rows, 0, o3);
16658
+ return r2.serialize({ start: { x: 0, y: o3 - l3 }, end: { x: t3.cols, y: o3 - 1 } });
16659
+ }
16660
+ const l2 = this._terminal?.getSelectionPosition();
16661
+ return void 0 !== l2 ? r2.serialize({ start: { x: l2.start.x, y: l2.start.y }, end: { x: l2.end.x, y: l2.end.y } }) : "";
16662
+ }
16663
+ _serializeModes(t3) {
16664
+ let e3 = "";
16665
+ const s2 = t3.modes;
16666
+ 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) {
16667
+ case "x10":
16668
+ e3 += "\x1B[?9h";
16669
+ break;
16670
+ case "vt200":
16671
+ e3 += "\x1B[?1000h";
16672
+ break;
16673
+ case "drag":
16674
+ e3 += "\x1B[?1002h";
16675
+ break;
16676
+ case "any":
16677
+ e3 += "\x1B[?1003h";
16678
+ }
16679
+ return e3;
16680
+ }
16681
+ serialize(t3) {
16682
+ if (!this._terminal) throw new Error("Cannot use addon until it has been loaded");
16683
+ 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);
16684
+ 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;
16685
+ }
16686
+ serializeAsHTML(t3) {
16687
+ if (!this._terminal) throw new Error("Cannot use addon until it has been loaded");
16688
+ return this._serializeBufferAsHTML(this._terminal, t3 || {});
16689
+ }
16690
+ dispose() {
16691
+ }
16692
+ };
16693
+ class h extends o {
16694
+ constructor(t3, s2, r2) {
16695
+ 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;
16696
+ }
16697
+ _padStart(t3, e3, s2) {
16698
+ 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);
16699
+ }
16700
+ _beforeSerialize(t3, e3, s2) {
16701
+ this._htmlContent += "<html><body><!--StartFragment--><pre>";
16702
+ let r2 = "#000000", i2 = "#ffffff";
16703
+ this._options.includeGlobalBackground && (r2 = this._terminal.options.theme?.foreground ?? "#ffffff", i2 = this._terminal.options.theme?.background ?? "#000000");
16704
+ const o2 = [];
16705
+ 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(" ") + "'>";
16706
+ }
16707
+ _afterSerialize() {
16708
+ this._htmlContent += "</div>", this._htmlContent += "</pre><!--EndFragment--></body></html>";
16709
+ }
16710
+ _rowEnd(t3, e3) {
16711
+ this._htmlContent += "<div><span>" + this._currentRow + "</span></div>", this._currentRow = "";
16712
+ }
16713
+ _getHexColor(t3, e3) {
16714
+ const s2 = e3 ? t3.getFgColor() : t3.getBgColor();
16715
+ 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;
16716
+ }
16717
+ _diffStyle(t3, e3) {
16718
+ const s2 = [], r2 = !n(t3, e3), i2 = !l(t3, e3), o2 = !a(t3, e3);
16719
+ if (r2 || i2 || o2) {
16720
+ const e4 = this._getHexColor(t3, true);
16721
+ e4 && s2.push("color: " + e4 + ";");
16722
+ const r3 = this._getHexColor(t3, false);
16723
+ 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;
16724
+ }
16725
+ }
16726
+ _nextCell(t3, e3, s2, r2) {
16727
+ if (0 === t3.getWidth()) return;
16728
+ const i2 = "" === t3.getChars(), o2 = this._diffStyle(t3, e3);
16729
+ o2 && (this._currentRow += 0 === o2.length ? "</span><span>" : "</span><span style='" + o2.join(" ") + "'>"), this._currentRow += i2 ? " " : (function(t4) {
16730
+ switch (t4) {
16731
+ case "&":
16732
+ return "&amp;";
16733
+ case "<":
16734
+ return "&lt;";
16735
+ }
16736
+ return t4;
16737
+ })(t3.getChars());
16738
+ }
16739
+ _serializeString() {
16740
+ return this._htmlContent;
16741
+ }
16742
+ }
16743
+ t2.HTMLSerializeHandler = h;
16744
+ })(), r;
16745
+ })()));
16746
+ }
16747
+ });
16748
+
16383
16749
  // ../node_modules/.pnpm/@lydell+node-pty@1.2.0-beta.12/node_modules/@lydell/node-pty/package.json
16384
16750
  var require_package2 = __commonJS({
16385
16751
  "../node_modules/.pnpm/@lydell+node-pty@1.2.0-beta.12/node_modules/@lydell/node-pty/package.json"(exports2, module2) {
@@ -18212,7 +18578,7 @@ var require_sender = __commonJS({
18212
18578
  const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
18213
18579
  this._bufferedBytes += options[kByteLength];
18214
18580
  this._state = DEFLATING;
18215
- perMessageDeflate.compress(data, options.fin, (_2, buf) => {
18581
+ perMessageDeflate.compress(data, options.fin, (_, buf) => {
18216
18582
  if (this._socket.destroyed) {
18217
18583
  const err = new Error(
18218
18584
  "The socket was closed while data was being compressed"
@@ -18652,10 +19018,10 @@ var require_extension = __commonJS({
18652
19018
  if (!Array.isArray(configurations)) configurations = [configurations];
18653
19019
  return configurations.map((params) => {
18654
19020
  return [extension2].concat(
18655
- Object.keys(params).map((k2) => {
18656
- let values = params[k2];
19021
+ Object.keys(params).map((k) => {
19022
+ let values = params[k];
18657
19023
  if (!Array.isArray(values)) values = [values];
18658
- return values.map((v2) => v2 === true ? k2 : `${k2}=${v2}`).join("; ");
19024
+ return values.map((v) => v === true ? k : `${k}=${v}`).join("; ");
18659
19025
  })
18660
19026
  ).join("; ");
18661
19027
  }).join(", ");
@@ -20371,9 +20737,9 @@ function parseRunCaseArgs(argv) {
20371
20737
  for (let i = 0; i < argv.length; i++) {
20372
20738
  const a = argv[i];
20373
20739
  const next = () => {
20374
- const v2 = argv[++i];
20375
- if (v2 === void 0) throw new Error(`missing value for ${a}`);
20376
- return v2;
20740
+ const v = argv[++i];
20741
+ if (v === void 0) throw new Error(`missing value for ${a}`);
20742
+ return v;
20377
20743
  };
20378
20744
  switch (a) {
20379
20745
  case "--record":
@@ -20476,11 +20842,11 @@ function parseArgs(argv) {
20476
20842
  out.config = next();
20477
20843
  break;
20478
20844
  case "--log-level": {
20479
- const v2 = next();
20480
- if (!["debug", "info", "warn", "error"].includes(v2)) {
20481
- throw new Error(`invalid --log-level value: ${v2}`);
20845
+ const v = next();
20846
+ if (!["debug", "info", "warn", "error"].includes(v)) {
20847
+ throw new Error(`invalid --log-level value: ${v}`);
20482
20848
  }
20483
- out.logLevel = v2;
20849
+ out.logLevel = v;
20484
20850
  break;
20485
20851
  }
20486
20852
  case "--tunnel":
@@ -20511,16 +20877,16 @@ function resolveDataDir(argsDataDir, home) {
20511
20877
  if (argsDataDir && argsDataDir.trim()) return import_node_path.default.resolve(argsDataDir);
20512
20878
  return import_node_path.default.join(home, ".clawd");
20513
20879
  }
20514
- function readConfigFile(p2) {
20880
+ function readConfigFile(p) {
20515
20881
  try {
20516
- const text = import_node_fs.default.readFileSync(p2, "utf8");
20882
+ const text = import_node_fs.default.readFileSync(p, "utf8");
20517
20883
  const json = JSON.parse(text);
20518
20884
  if (json && typeof json === "object") return json;
20519
20885
  return {};
20520
20886
  } catch (err) {
20521
20887
  const code = err?.code;
20522
20888
  if (code === "ENOENT") return {};
20523
- throw new Error(`failed to read config ${p2}: ${err.message}`);
20889
+ throw new Error(`failed to read config ${p}: ${err.message}`);
20524
20890
  }
20525
20891
  }
20526
20892
  function resolveConfig(opts) {
@@ -20708,7 +21074,7 @@ var SessionStore = class {
20708
21074
  continue;
20709
21075
  }
20710
21076
  }
20711
- return out.sort((a, b2) => a.updatedAt > b2.updatedAt ? -1 : a.updatedAt < b2.updatedAt ? 1 : 0);
21077
+ return out.sort((a, b) => a.updatedAt > b.updatedAt ? -1 : a.updatedAt < b.updatedAt ? 1 : 0);
20712
21078
  }
20713
21079
  };
20714
21080
 
@@ -20872,20 +21238,20 @@ function sessionInfoFrame(file) {
20872
21238
  const frame = { type: "session:info", ...file };
20873
21239
  return { kind: "emit-frame", frame, target: "all" };
20874
21240
  }
20875
- function eqContextUsage(a, b2) {
20876
- if (a === b2) return true;
20877
- if (!a || !b2) return false;
20878
- return a.inputTokens === b2.inputTokens && a.outputTokens === b2.outputTokens && a.cacheReadTokens === b2.cacheReadTokens && a.cacheCreateTokens === b2.cacheCreateTokens;
21241
+ function eqContextUsage(a, b) {
21242
+ if (a === b) return true;
21243
+ if (!a || !b) return false;
21244
+ return a.inputTokens === b.inputTokens && a.outputTokens === b.outputTokens && a.cacheReadTokens === b.cacheReadTokens && a.cacheCreateTokens === b.cacheCreateTokens;
20879
21245
  }
20880
- function shallowEqMeta(a, b2) {
20881
- return a.gitBranch === b2.gitBranch && a.resolvedModel === b2.resolvedModel && a.contextWindowSize === b2.contextWindowSize && eqContextUsage(a.contextUsage, b2.contextUsage);
21246
+ function shallowEqMeta(a, b) {
21247
+ return a.gitBranch === b.gitBranch && a.resolvedModel === b.resolvedModel && a.contextWindowSize === b.contextWindowSize && eqContextUsage(a.contextUsage, b.contextUsage);
20882
21248
  }
20883
21249
  function applyMetaUpdate(state, patch, deps) {
20884
21250
  const next = cloneState(state);
20885
21251
  const merged = { ...next.file, ...patch };
20886
21252
  if (patch.resolvedModel !== void 0) {
20887
- const w2 = deps.resolveContextWindow?.(next.file.tool, patch.resolvedModel);
20888
- if (w2 !== void 0) merged.contextWindowSize = w2;
21253
+ const w = deps.resolveContextWindow?.(next.file.tool, patch.resolvedModel);
21254
+ if (w !== void 0) merged.contextWindowSize = w;
20889
21255
  }
20890
21256
  if (shallowEqMeta(next.file, merged)) {
20891
21257
  return { state: next, effects: [] };
@@ -21027,10 +21393,10 @@ var RUNTIME_PATCH_KEYS = [
21027
21393
  var MARKER_PATCH_KEYS = ["pinnedAt", "pinSortOrder"];
21028
21394
  function isMarkerOnlyPatch(patch) {
21029
21395
  const keys = Object.keys(patch).filter(
21030
- (k2) => patch[k2] !== void 0
21396
+ (k) => patch[k] !== void 0
21031
21397
  );
21032
21398
  if (keys.length === 0) return false;
21033
- return keys.every((k2) => MARKER_PATCH_KEYS.includes(k2));
21399
+ return keys.every((k) => MARKER_PATCH_KEYS.includes(k));
21034
21400
  }
21035
21401
  function applyCommand(state, command, deps) {
21036
21402
  const next = cloneState(state);
@@ -21136,7 +21502,7 @@ function applyCommand(state, command, deps) {
21136
21502
  case "update": {
21137
21503
  const patch = command.patch;
21138
21504
  const runtimePatch = RUNTIME_PATCH_KEYS.some(
21139
- (k2) => patch[k2] !== void 0
21505
+ (k) => patch[k] !== void 0
21140
21506
  );
21141
21507
  const markerOnly = isMarkerOnlyPatch(patch);
21142
21508
  next.file = markerOnly ? { ...next.file, ...patch } : { ...next.file, ...patch, updatedAt: nowIso(deps) };
@@ -21402,12 +21768,12 @@ function reduceSession(state, input, deps) {
21402
21768
  const now = input.nowMs;
21403
21769
  const keep = {};
21404
21770
  let removed = 0;
21405
- for (const [rid, p2] of Object.entries(state.pendingPermissions)) {
21406
- if (now - p2.createdAt > staleMs) {
21771
+ for (const [rid, p] of Object.entries(state.pendingPermissions)) {
21772
+ if (now - p.createdAt > staleMs) {
21407
21773
  removed++;
21408
21774
  continue;
21409
21775
  }
21410
- keep[rid] = p2;
21776
+ keep[rid] = p;
21411
21777
  }
21412
21778
  if (removed === 0) return { state, effects: [] };
21413
21779
  const next = cloneState(state);
@@ -21572,7 +21938,7 @@ var SessionRunner = class {
21572
21938
  if (!this.state.procAlive && this.stopWaiters.length > 0) {
21573
21939
  const waiters = this.stopWaiters;
21574
21940
  this.stopWaiters = [];
21575
- for (const w2 of waiters) w2();
21941
+ for (const w of waiters) w();
21576
21942
  }
21577
21943
  }
21578
21944
  // 等子进程退出(procAlive=false)。manager.stop 在发完 SIGTERM 后调它确保
@@ -21678,10 +22044,10 @@ var SessionRunner = class {
21678
22044
  }
21679
22045
  // 统一清理所有 pending control_requests(子进程退出 / session delete)
21680
22046
  rejectAllPending(err) {
21681
- for (const [, p2] of this.pendingControlRequests) {
21682
- clearTimeout(p2.timer);
22047
+ for (const [, p] of this.pendingControlRequests) {
22048
+ clearTimeout(p.timer);
21683
22049
  try {
21684
- p2.reject(err);
22050
+ p.reject(err);
21685
22051
  } catch {
21686
22052
  }
21687
22053
  }
@@ -22149,7 +22515,7 @@ var SessionManager = class {
22149
22515
  args.orderedIds.forEach((sessionId, index) => {
22150
22516
  const runner = this.runners.get(sessionId);
22151
22517
  if (runner) {
22152
- const { value, broadcast: b2 } = this.withCollector(() => {
22518
+ const { value, broadcast: b } = this.withCollector(() => {
22153
22519
  runner.input({
22154
22520
  kind: "command",
22155
22521
  command: { kind: "update", patch: { pinSortOrder: index } }
@@ -22157,7 +22523,7 @@ var SessionManager = class {
22157
22523
  return runner.getState().file;
22158
22524
  });
22159
22525
  updatedFiles.push(value);
22160
- broadcast.push(...b2);
22526
+ broadcast.push(...b);
22161
22527
  } else {
22162
22528
  const existing = this.getFile(sessionId);
22163
22529
  const updated = { ...existing, pinSortOrder: index };
@@ -22184,7 +22550,7 @@ var SessionManager = class {
22184
22550
  let map = this.realUuidBySynth.get(args.sessionId);
22185
22551
  if (map && map.has(args.realUuid)) return;
22186
22552
  if (map) {
22187
- for (const v2 of map.values()) if (v2 === args.realUuid) return;
22553
+ for (const v of map.values()) if (v === args.realUuid) return;
22188
22554
  }
22189
22555
  const buffer = runner.getState().buffer;
22190
22556
  let matchedSynth = null;
@@ -23003,18 +23369,18 @@ var PersonaStore = class {
23003
23369
  this.atomicWrite(this.metaPath(persona.personaId), JSON.stringify(persona, null, 2));
23004
23370
  }
23005
23371
  read(personaId) {
23006
- const p2 = this.metaPath(personaId);
23007
- if (!fs6.existsSync(p2)) return null;
23008
- const raw = JSON.parse(fs6.readFileSync(p2, "utf8"));
23372
+ const p = this.metaPath(personaId);
23373
+ if (!fs6.existsSync(p)) return null;
23374
+ const raw = JSON.parse(fs6.readFileSync(p, "utf8"));
23009
23375
  return PersonaFileSchema.parse(raw);
23010
23376
  }
23011
23377
  has(personaId) {
23012
23378
  return fs6.existsSync(this.metaPath(personaId));
23013
23379
  }
23014
23380
  readPersonality(personaId) {
23015
- const p2 = this.claudeMdPath(personaId);
23016
- if (!fs6.existsSync(p2)) return null;
23017
- return fs6.readFileSync(p2, "utf8");
23381
+ const p = this.claudeMdPath(personaId);
23382
+ if (!fs6.existsSync(p)) return null;
23383
+ return fs6.readFileSync(p, "utf8");
23018
23384
  }
23019
23385
  list() {
23020
23386
  if (!fs6.existsSync(this.root)) return [];
@@ -23048,8 +23414,8 @@ var PersonaRegistry = class {
23048
23414
  reload() {
23049
23415
  this.cache.clear();
23050
23416
  for (const id of this.store.list()) {
23051
- const p2 = this.store.read(id);
23052
- if (p2) this.cache.set(p2.personaId, p2);
23417
+ const p = this.store.read(id);
23418
+ if (p) this.cache.set(p.personaId, p);
23053
23419
  }
23054
23420
  }
23055
23421
  get(personaId) {
@@ -23246,417 +23612,8 @@ init_claude();
23246
23612
  var import_node_fs8 = __toESM(require("fs"), 1);
23247
23613
  var import_node_os4 = __toESM(require("os"), 1);
23248
23614
  var import_node_path8 = __toESM(require("path"), 1);
23249
- var import_headless = __toESM(require_xterm_headless(), 1);
23250
-
23251
- // ../node_modules/.pnpm/@xterm+addon-serialize@0.14.0/node_modules/@xterm/addon-serialize/lib/addon-serialize.mjs
23252
- var m = 0;
23253
- var p = 0;
23254
- var g = 0;
23255
- var b = 0;
23256
- var I;
23257
- ((r) => {
23258
- function u(t, a, s, i) {
23259
- return i !== void 0 ? `#${B(t)}${B(a)}${B(s)}${B(i)}` : `#${B(t)}${B(a)}${B(s)}`;
23260
- }
23261
- r.toCss = u;
23262
- function o(t, a, s, i = 255) {
23263
- return (t << 24 | a << 16 | s << 8 | i) >>> 0;
23264
- }
23265
- r.toRgba = o;
23266
- function e(t, a, s, i) {
23267
- return { css: r.toCss(t, a, s, i), rgba: r.toRgba(t, a, s, i) };
23268
- }
23269
- r.toColor = e;
23270
- })(I ||= {});
23271
- var $;
23272
- ((i) => {
23273
- function u(n, l) {
23274
- if (b = (l.rgba & 255) / 255, b === 1) return { css: l.css, rgba: l.rgba };
23275
- 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;
23276
- m = C + Math.round((f - C) * b), p = h + Math.round((d - h) * b), g = x + Math.round((c - x) * b);
23277
- let R = I.toCss(m, p, g), L = I.toRgba(m, p, g);
23278
- return { css: R, rgba: L };
23279
- }
23280
- i.blend = u;
23281
- function o(n) {
23282
- return (n.rgba & 255) === 255;
23283
- }
23284
- i.isOpaque = o;
23285
- function e(n, l, f) {
23286
- let d = y.ensureContrastRatio(n.rgba, l.rgba, f);
23287
- if (d) return I.toColor(d >> 24 & 255, d >> 16 & 255, d >> 8 & 255);
23288
- }
23289
- i.ensureContrastRatio = e;
23290
- function r(n) {
23291
- let l = (n.rgba | 255) >>> 0;
23292
- return [m, p, g] = y.toChannels(l), { css: I.toCss(m, p, g), rgba: l };
23293
- }
23294
- i.opaque = r;
23295
- function t(n, l) {
23296
- 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) };
23297
- }
23298
- i.opacity = t;
23299
- function a(n, l) {
23300
- return b = n.rgba & 255, t(n, b * l / 255);
23301
- }
23302
- i.multiplyOpacity = a;
23303
- function s(n) {
23304
- return [n.rgba >> 24 & 255, n.rgba >> 16 & 255, n.rgba >> 8 & 255];
23305
- }
23306
- i.toColorRGB = s;
23307
- })($ ||= {});
23308
- var _;
23309
- ((r) => {
23310
- let u, o;
23311
- try {
23312
- let t = document.createElement("canvas");
23313
- t.width = 1, t.height = 1;
23314
- let a = t.getContext("2d", { willReadFrequently: true });
23315
- a && (u = a, u.globalCompositeOperation = "copy", o = u.createLinearGradient(0, 0, 1, 1));
23316
- } catch {
23317
- }
23318
- function e(t) {
23319
- if (t.match(/#[\da-f]{3,8}/i)) switch (t.length) {
23320
- case 4:
23321
- 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);
23322
- case 5:
23323
- 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);
23324
- case 7:
23325
- return { css: t, rgba: (parseInt(t.slice(1), 16) << 8 | 255) >>> 0 };
23326
- case 9:
23327
- return { css: t, rgba: parseInt(t.slice(1), 16) >>> 0 };
23328
- }
23329
- 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*)?\)/);
23330
- 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);
23331
- if (!u || !o) throw new Error("css.toColor: Unsupported css format");
23332
- if (u.fillStyle = o, u.fillStyle = t, typeof u.fillStyle != "string") throw new Error("css.toColor: Unsupported css format");
23333
- 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");
23334
- return { rgba: I.toRgba(m, p, g, b), css: t };
23335
- }
23336
- r.toColor = e;
23337
- })(_ ||= {});
23338
- var v;
23339
- ((e) => {
23340
- function u(r) {
23341
- return o(r >> 16 & 255, r >> 8 & 255, r & 255);
23342
- }
23343
- e.relativeLuminance = u;
23344
- function o(r, t, a) {
23345
- 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);
23346
- return l * 0.2126 + f * 0.7152 + d * 0.0722;
23347
- }
23348
- e.relativeLuminance2 = o;
23349
- })(v ||= {});
23350
- var y;
23351
- ((a) => {
23352
- function u(s, i) {
23353
- if (b = (i & 255) / 255, b === 1) return i;
23354
- 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;
23355
- 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);
23356
- }
23357
- a.blend = u;
23358
- function o(s, i, n) {
23359
- let l = v.relativeLuminance(s >> 8), f = v.relativeLuminance(i >> 8);
23360
- if (F(l, f) < n) {
23361
- if (f < l) {
23362
- let h = e(s, i, n), x = F(l, v.relativeLuminance(h >> 8));
23363
- if (x < n) {
23364
- let R = r(s, i, n), L = F(l, v.relativeLuminance(R >> 8));
23365
- return x > L ? h : R;
23366
- }
23367
- return h;
23368
- }
23369
- let c = r(s, i, n), C = F(l, v.relativeLuminance(c >> 8));
23370
- if (C < n) {
23371
- let h = e(s, i, n), x = F(l, v.relativeLuminance(h >> 8));
23372
- return C > x ? c : h;
23373
- }
23374
- return c;
23375
- }
23376
- }
23377
- a.ensureContrastRatio = o;
23378
- function e(s, i, n) {
23379
- 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));
23380
- 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));
23381
- return (c << 24 | C << 16 | h << 8 | 255) >>> 0;
23382
- }
23383
- a.reduceLuminance = e;
23384
- function r(s, i, n) {
23385
- 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));
23386
- 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));
23387
- return (c << 24 | C << 16 | h << 8 | 255) >>> 0;
23388
- }
23389
- a.increaseLuminance = r;
23390
- function t(s) {
23391
- return [s >> 24 & 255, s >> 16 & 255, s >> 8 & 255, s & 255];
23392
- }
23393
- a.toChannels = t;
23394
- })(y ||= {});
23395
- function B(u) {
23396
- let o = u.toString(16);
23397
- return o.length < 2 ? "0" + o : o;
23398
- }
23399
- function F(u, o) {
23400
- return u < o ? (o + 0.05) / (u + 0.05) : (u + 0.05) / (o + 0.05);
23401
- }
23402
- var E = Object.freeze((() => {
23403
- 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];
23404
- for (let e = 0; e < 216; e++) {
23405
- let r = o[e / 36 % 6 | 0], t = o[e / 6 % 6 | 0], a = o[e % 6];
23406
- u.push({ css: I.toCss(r, t, a), rgba: I.toRgba(r, t, a) });
23407
- }
23408
- for (let e = 0; e < 24; e++) {
23409
- let r = 8 + e * 10;
23410
- u.push({ css: I.toCss(r, r, r), rgba: I.toRgba(r, r, r) });
23411
- }
23412
- return u;
23413
- })());
23414
- function A(u, o, e) {
23415
- return Math.max(o, Math.min(u, e));
23416
- }
23417
- function O(u) {
23418
- switch (u) {
23419
- case "&":
23420
- return "&amp;";
23421
- case "<":
23422
- return "&lt;";
23423
- }
23424
- return u;
23425
- }
23426
- var S = class {
23427
- constructor(o) {
23428
- this._buffer = o;
23429
- }
23430
- serialize(o, e) {
23431
- 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;
23432
- this._beforeSerialize(i - s, s, i);
23433
- for (let f = s; f <= i; f++) {
23434
- let d = this._buffer.getLine(f);
23435
- if (d) {
23436
- let c = f === o.start.y ? n : 0, C = f === o.end.y ? l : d.length;
23437
- for (let h = c; h < C; h++) {
23438
- let x = d.getCell(h, a === r ? t : r);
23439
- if (!x) {
23440
- console.warn(`Can't get cell at row=${f}, col=${h}`);
23441
- continue;
23442
- }
23443
- this._nextCell(x, a, f, h), a = x;
23444
- }
23445
- }
23446
- this._rowEnd(f, f === i);
23447
- }
23448
- return this._afterSerialize(), this._serializeString(e);
23449
- }
23450
- _nextCell(o, e, r, t) {
23451
- }
23452
- _rowEnd(o, e) {
23453
- }
23454
- _beforeSerialize(o, e, r) {
23455
- }
23456
- _afterSerialize() {
23457
- }
23458
- _serializeString(o) {
23459
- return "";
23460
- }
23461
- };
23462
- function T(u, o) {
23463
- return u.getFgColorMode() === o.getFgColorMode() && u.getFgColor() === o.getFgColor();
23464
- }
23465
- function w(u, o) {
23466
- return u.getBgColorMode() === o.getBgColorMode() && u.getBgColor() === o.getBgColor();
23467
- }
23468
- function z(u, o) {
23469
- 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();
23470
- }
23471
- var k = class extends S {
23472
- constructor(e, r) {
23473
- super(e);
23474
- this._terminal = r;
23475
- this._rowIndex = 0;
23476
- this._allRows = new Array();
23477
- this._allRowSeparators = new Array();
23478
- this._currentRow = "";
23479
- this._nullCellCount = 0;
23480
- this._cursorStyle = this._buffer.getNullCell();
23481
- this._cursorStyleRow = 0;
23482
- this._cursorStyleCol = 0;
23483
- this._backgroundCell = this._buffer.getNullCell();
23484
- this._firstRow = 0;
23485
- this._lastCursorRow = 0;
23486
- this._lastCursorCol = 0;
23487
- this._lastContentCursorRow = 0;
23488
- this._lastContentCursorCol = 0;
23489
- this._thisRowLastChar = this._buffer.getNullCell();
23490
- this._thisRowLastSecondChar = this._buffer.getNullCell();
23491
- this._nextRowFirstChar = this._buffer.getNullCell();
23492
- }
23493
- _beforeSerialize(e, r, t) {
23494
- this._allRows = new Array(e), this._lastContentCursorRow = r, this._lastCursorRow = r, this._firstRow = r;
23495
- }
23496
- _rowEnd(e, r) {
23497
- this._nullCellCount > 0 && !w(this._cursorStyle, this._backgroundCell) && (this._currentRow += `\x1B[${this._nullCellCount}X`);
23498
- let t = "";
23499
- if (!r) {
23500
- e - this._firstRow >= this._terminal.rows && this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol, this._backgroundCell);
23501
- let a = this._buffer.getLine(e), s = this._buffer.getLine(e + 1);
23502
- if (!s.isWrapped) t = `\r
23503
- `, this._lastCursorRow = e + 1, this._lastCursorCol = 0;
23504
- else {
23505
- t = "";
23506
- 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;
23507
- (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);
23508
- }
23509
- }
23510
- this._allRows[this._rowIndex] = this._currentRow, this._allRowSeparators[this._rowIndex++] = t, this._currentRow = "", this._nullCellCount = 0;
23511
- }
23512
- _diffStyle(e, r) {
23513
- let t = [], a = !T(e, r), s = !w(e, r), i = !z(e, r);
23514
- if (a || s || i) if (e.isAttributeDefault()) r.isAttributeDefault() || t.push(0);
23515
- else {
23516
- if (a) {
23517
- let n = e.getFgColor();
23518
- 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);
23519
- }
23520
- if (s) {
23521
- let n = e.getBgColor();
23522
- 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);
23523
- }
23524
- 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));
23525
- }
23526
- return t;
23527
- }
23528
- _nextCell(e, r, t, a) {
23529
- if (e.getWidth() === 0) return;
23530
- let i = e.getChars() === "", n = this._diffStyle(e, this._cursorStyle);
23531
- if (i ? !w(this._cursorStyle, e) : n.length > 0) {
23532
- 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`;
23533
- let f = this._buffer.getLine(t);
23534
- f !== void 0 && (f.getCell(a, this._cursorStyle), this._cursorStyleRow = t, this._cursorStyleCol = a);
23535
- }
23536
- 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());
23537
- }
23538
- _serializeString(e) {
23539
- let r = this._allRows.length;
23540
- this._buffer.length - this._firstRow <= this._terminal.rows && (r = this._lastContentCursorRow + 1 - this._firstRow, this._lastCursorCol = this._lastContentCursorCol, this._lastCursorRow = this._lastContentCursorRow);
23541
- let t = "";
23542
- for (let i = 0; i < r; i++) t += this._allRows[i], i + 1 < r && (t += this._allRowSeparators[i]);
23543
- if (!e) {
23544
- let i = this._buffer.baseY + this._buffer.cursorY, n = this._buffer.cursorX, l = i !== this._lastCursorRow || n !== this._lastCursorCol, f = (c) => {
23545
- c > 0 ? t += `\x1B[${c}C` : c < 0 && (t += `\x1B[${-c}D`);
23546
- };
23547
- l && (((c) => {
23548
- c > 0 ? t += `\x1B[${c}B` : c < 0 && (t += `\x1B[${-c}A`);
23549
- })(i - this._lastCursorRow), f(n - this._lastCursorCol));
23550
- }
23551
- let a = this._terminal._core._inputHandler._curAttrData, s = this._diffStyle(a, this._cursorStyle);
23552
- return s.length > 0 && (t += `\x1B[${s.join(";")}m`), t;
23553
- }
23554
- };
23555
- var D = class {
23556
- activate(o) {
23557
- this._terminal = o;
23558
- }
23559
- _serializeBufferByScrollback(o, e, r) {
23560
- let t = e.length, a = r === void 0 ? t : A(r + o.rows, 0, t);
23561
- return this._serializeBufferByRange(o, e, { start: t - a, end: t - 1 }, false);
23562
- }
23563
- _serializeBufferByRange(o, e, r, t) {
23564
- 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);
23565
- }
23566
- _serializeBufferAsHTML(o, e) {
23567
- let r = o.buffer.active, t = new M(r, o, e), a = e.onlySelection ?? false, s = e.range;
23568
- 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) } });
23569
- if (!a) {
23570
- let n = r.length, l = e.scrollback, f = l === void 0 ? n : A(l + o.rows, 0, n);
23571
- return t.serialize({ start: { x: 0, y: n - f }, end: { x: o.cols, y: n - 1 } });
23572
- }
23573
- let i = this._terminal?.getSelectionPosition();
23574
- return i !== void 0 ? t.serialize({ start: { x: i.start.x, y: i.start.y }, end: { x: i.end.x, y: i.end.y } }) : "";
23575
- }
23576
- _serializeModes(o) {
23577
- let e = "", r = o.modes;
23578
- 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) {
23579
- case "x10":
23580
- e += "\x1B[?9h";
23581
- break;
23582
- case "vt200":
23583
- e += "\x1B[?1000h";
23584
- break;
23585
- case "drag":
23586
- e += "\x1B[?1002h";
23587
- break;
23588
- case "any":
23589
- e += "\x1B[?1003h";
23590
- break;
23591
- }
23592
- return e;
23593
- }
23594
- serialize(o) {
23595
- if (!this._terminal) throw new Error("Cannot use addon until it has been loaded");
23596
- 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);
23597
- if (!o?.excludeAltBuffer && this._terminal.buffer.active.type === "alternate") {
23598
- let r = this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.alternate, void 0);
23599
- e += `\x1B[?1049h\x1B[H${r}`;
23600
- }
23601
- return o?.excludeModes || (e += this._serializeModes(this._terminal)), e;
23602
- }
23603
- serializeAsHTML(o) {
23604
- if (!this._terminal) throw new Error("Cannot use addon until it has been loaded");
23605
- return this._serializeBufferAsHTML(this._terminal, o || {});
23606
- }
23607
- dispose() {
23608
- }
23609
- };
23610
- var M = class extends S {
23611
- constructor(e, r, t) {
23612
- super(e);
23613
- this._terminal = r;
23614
- this._options = t;
23615
- this._currentRow = "";
23616
- this._htmlContent = "";
23617
- r._core._themeService ? this._ansiColors = r._core._themeService.colors.ansi : this._ansiColors = E;
23618
- }
23619
- _padStart(e, r, t) {
23620
- 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);
23621
- }
23622
- _beforeSerialize(e, r, t) {
23623
- this._htmlContent += "<html><body><!--StartFragment--><pre>";
23624
- let a = "#000000", s = "#ffffff";
23625
- (this._options.includeGlobalBackground ?? false) && (a = this._terminal.options.theme?.foreground ?? "#ffffff", s = this._terminal.options.theme?.background ?? "#000000");
23626
- let i = [];
23627
- 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(" ") + "'>";
23628
- }
23629
- _afterSerialize() {
23630
- this._htmlContent += "</div>", this._htmlContent += "</pre><!--EndFragment--></body></html>";
23631
- }
23632
- _rowEnd(e, r) {
23633
- this._htmlContent += "<div><span>" + this._currentRow + "</span></div>", this._currentRow = "";
23634
- }
23635
- _getHexColor(e, r) {
23636
- let t = r ? e.getFgColor() : e.getBgColor();
23637
- 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("");
23638
- if (r ? e.isFgPalette() : e.isBgPalette()) return this._ansiColors[t].css;
23639
- }
23640
- _diffStyle(e, r) {
23641
- let t = [], a = !T(e, r), s = !w(e, r), i = !z(e, r);
23642
- if (a || s || i) {
23643
- let n = this._getHexColor(e, true);
23644
- n && t.push("color: " + n + ";");
23645
- let l = this._getHexColor(e, false);
23646
- 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;
23647
- }
23648
- }
23649
- _nextCell(e, r, t, a) {
23650
- if (e.getWidth() === 0) return;
23651
- let i = e.getChars() === "", n = this._diffStyle(e, r);
23652
- n && (this._currentRow += n.length === 0 ? "</span><span>" : "</span><span style='" + n.join(" ") + "'>"), i ? this._currentRow += " " : this._currentRow += O(e.getChars());
23653
- }
23654
- _serializeString() {
23655
- return this._htmlContent;
23656
- }
23657
- };
23658
-
23659
- // src/tools/claude-tui.ts
23615
+ var headlessNs = __toESM(require_xterm_headless(), 1);
23616
+ var serializeNs = __toESM(require_addon_serialize(), 1);
23660
23617
  init_claude();
23661
23618
  init_claude_history();
23662
23619
 
@@ -23832,18 +23789,20 @@ function spawnPty(opts) {
23832
23789
  }
23833
23790
 
23834
23791
  // src/tools/claude-tui.ts
23792
+ var { Terminal } = headlessNs;
23793
+ var { SerializeAddon } = serializeNs;
23835
23794
  var POPUP_FOOTER_PATTERNS = [
23836
23795
  { kind: "permission", regex: /Tab to amend|Do you want to proceed/i },
23837
23796
  { kind: "question", regex: /Enter to select|↑\/↓ to navigate/i }
23838
23797
  ];
23839
23798
  function createPopupDetector(opts) {
23840
- const term = new import_headless.Terminal({
23799
+ const term = new Terminal({
23841
23800
  cols: opts.cols ?? 120,
23842
23801
  rows: opts.rows ?? 40,
23843
23802
  scrollback: 1e3,
23844
23803
  allowProposedApi: true
23845
23804
  });
23846
- const serializeAddon = new D();
23805
+ const serializeAddon = new SerializeAddon();
23847
23806
  term.loadAddon(serializeAddon);
23848
23807
  let visible = null;
23849
23808
  let pendingClear = null;
@@ -23854,8 +23813,8 @@ function createPopupDetector(opts) {
23854
23813
  if (!line) continue;
23855
23814
  const text = line.translateToString(true);
23856
23815
  if (!text) continue;
23857
- for (const p2 of POPUP_FOOTER_PATTERNS) {
23858
- if (p2.regex.test(text)) return p2.kind;
23816
+ for (const p of POPUP_FOOTER_PATTERNS) {
23817
+ if (p.regex.test(text)) return p.kind;
23859
23818
  }
23860
23819
  }
23861
23820
  return null;
@@ -24165,9 +24124,9 @@ var WorkspaceBrowser = class {
24165
24124
  }
24166
24125
  entries.push(entry);
24167
24126
  }
24168
- entries.sort((a, b2) => {
24169
- if (a.type !== b2.type) return a.type === "dir" ? -1 : 1;
24170
- return a.name < b2.name ? -1 : a.name > b2.name ? 1 : 0;
24127
+ entries.sort((a, b) => {
24128
+ if (a.type !== b.type) return a.type === "dir" ? -1 : 1;
24129
+ return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
24171
24130
  });
24172
24131
  return { cwd, path: args.path ?? ".", entries };
24173
24132
  }
@@ -24312,9 +24271,9 @@ function parseDescription(content) {
24312
24271
  const fields = parseFrontmatter(content, ["description"]);
24313
24272
  return { description: fields.description ?? "" };
24314
24273
  }
24315
- function isDirLikeSync(p2) {
24274
+ function isDirLikeSync(p) {
24316
24275
  try {
24317
- return import_node_fs10.default.statSync(p2).isDirectory();
24276
+ return import_node_fs10.default.statSync(p).isDirectory();
24318
24277
  } catch {
24319
24278
  return false;
24320
24279
  }
@@ -24445,13 +24404,13 @@ var SkillsScanner = class {
24445
24404
  list(args) {
24446
24405
  const seen = /* @__PURE__ */ new Set();
24447
24406
  const builtinBlock = [];
24448
- for (const b2 of BUILTIN_SKILLS) {
24449
- if (seen.has(b2.name)) continue;
24450
- seen.add(b2.name);
24407
+ for (const b of BUILTIN_SKILLS) {
24408
+ if (seen.has(b.name)) continue;
24409
+ seen.add(b.name);
24451
24410
  builtinBlock.push({
24452
- name: b2.name,
24411
+ name: b.name,
24453
24412
  source: "builtin",
24454
- description: b2.description
24413
+ description: b.description
24455
24414
  });
24456
24415
  }
24457
24416
  const fsBlock = [];
@@ -24464,7 +24423,7 @@ var SkillsScanner = class {
24464
24423
  scanSkillDir(import_node_path10.default.join(root, "skills"), "plugin", seen, fsBlock, name);
24465
24424
  scanCommandDir(import_node_path10.default.join(root, "commands"), "plugin", seen, fsBlock, name);
24466
24425
  }
24467
- fsBlock.sort((a, b2) => a.name < b2.name ? -1 : a.name > b2.name ? 1 : 0);
24426
+ fsBlock.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
24468
24427
  return [...builtinBlock, ...fsBlock];
24469
24428
  }
24470
24429
  };
@@ -24474,16 +24433,16 @@ var import_node_fs11 = __toESM(require("fs"), 1);
24474
24433
  var import_node_os7 = __toESM(require("os"), 1);
24475
24434
  var import_node_path11 = __toESM(require("path"), 1);
24476
24435
  var DEFAULT_POLICY_DIR_DARWIN = "/Library/Application Support/ClaudeCode/.claude/agents";
24477
- function isDirLikeSync2(p2) {
24436
+ function isDirLikeSync2(p) {
24478
24437
  try {
24479
- return import_node_fs11.default.statSync(p2).isDirectory();
24438
+ return import_node_fs11.default.statSync(p).isDirectory();
24480
24439
  } catch {
24481
24440
  return false;
24482
24441
  }
24483
24442
  }
24484
- function fileExistsSync(p2) {
24443
+ function fileExistsSync(p) {
24485
24444
  try {
24486
- return import_node_fs11.default.statSync(p2).isFile();
24445
+ return import_node_fs11.default.statSync(p).isFile();
24487
24446
  } catch {
24488
24447
  return false;
24489
24448
  }
@@ -24627,14 +24586,14 @@ var AgentsScanner = class {
24627
24586
  list(args) {
24628
24587
  const seen = /* @__PURE__ */ new Set();
24629
24588
  const builtinBlock = [];
24630
- for (const b2 of BUILTIN_AGENTS) {
24631
- if (seen.has(b2.name)) continue;
24632
- seen.add(b2.name);
24589
+ for (const b of BUILTIN_AGENTS) {
24590
+ if (seen.has(b.name)) continue;
24591
+ seen.add(b.name);
24633
24592
  builtinBlock.push({
24634
- name: b2.name,
24593
+ name: b.name,
24635
24594
  source: "builtin",
24636
- ...b2.description ? { description: b2.description } : {},
24637
- ...b2.whenToUse ? { whenToUse: b2.whenToUse } : {}
24595
+ ...b.description ? { description: b.description } : {},
24596
+ ...b.whenToUse ? { whenToUse: b.whenToUse } : {}
24638
24597
  });
24639
24598
  }
24640
24599
  const fsBlock = [];
@@ -24685,7 +24644,7 @@ var SessionObserver = class {
24685
24644
  size = import_node_fs12.default.statSync(filePath).size;
24686
24645
  } catch {
24687
24646
  }
24688
- const w2 = {
24647
+ const w = {
24689
24648
  sessionId: args.sessionId,
24690
24649
  filePath,
24691
24650
  watcher: null,
@@ -24698,15 +24657,15 @@ var SessionObserver = class {
24698
24657
  import_node_fs12.default.mkdirSync(import_node_path12.default.dirname(filePath), { recursive: true });
24699
24658
  } catch {
24700
24659
  }
24701
- w2.watcher = import_node_fs12.default.watch(import_node_path12.default.dirname(filePath), { persistent: false }, (_event, changedName) => {
24660
+ w.watcher = import_node_fs12.default.watch(import_node_path12.default.dirname(filePath), { persistent: false }, (_event, changedName) => {
24702
24661
  if (!changedName || !filePath.endsWith(changedName)) return;
24703
- this.poll(w2);
24662
+ this.poll(w);
24704
24663
  });
24705
- w2.pollTimer = setInterval(() => this.poll(w2), 200);
24706
- this.watches.set(args.sessionId, w2);
24664
+ w.pollTimer = setInterval(() => this.poll(w), 200);
24665
+ this.watches.set(args.sessionId, w);
24707
24666
  this.opts.onStatus?.(args.sessionId, "observing");
24708
- this.hydrateMetaTail(w2);
24709
- this.poll(w2);
24667
+ this.hydrateMetaTail(w);
24668
+ this.poll(w);
24710
24669
  return { filePath };
24711
24670
  }
24712
24671
  // 读 JSONL 文件尾部 N 行,把每行的 meta_update 字段**合并成一个 patch** 喂给 reducer。
@@ -24714,16 +24673,16 @@ var SessionObserver = class {
24714
24673
  // parseLine 对每行都产一条 meta_update,N=200 行就是 200 条几乎相同的 patch。
24715
24674
  // reducer.shallowEqMeta 会 dedup 但 CPU + log 仍吵。改成同 patch 字段保留最新值合并成单条。
24716
24675
  // 异常静默吞,不阻塞 watcher 启动
24717
- hydrateMetaTail(w2, maxLines = 200) {
24676
+ hydrateMetaTail(w, maxLines = 200) {
24718
24677
  try {
24719
- const raw = import_node_fs12.default.readFileSync(w2.filePath, "utf8");
24678
+ const raw = import_node_fs12.default.readFileSync(w.filePath, "utf8");
24720
24679
  if (!raw) return;
24721
24680
  const allLines = raw.split("\n").filter((l) => l.trim().length > 0);
24722
24681
  if (allLines.length === 0) return;
24723
24682
  const tail = allLines.length > maxLines ? allLines.slice(-maxLines) : allLines;
24724
24683
  const merged = {};
24725
24684
  for (const line of tail) {
24726
- const events = w2.adapter.parseLine(line);
24685
+ const events = w.adapter.parseLine(line);
24727
24686
  for (const e of events) {
24728
24687
  if (e.kind === "meta_update" && e.patch) {
24729
24688
  Object.assign(merged, e.patch);
@@ -24732,38 +24691,38 @@ var SessionObserver = class {
24732
24691
  }
24733
24692
  if (Object.keys(merged).length > 0) {
24734
24693
  const singleEvent = { kind: "meta_update", patch: merged };
24735
- this.opts.onEvent({ sessionId: w2.sessionId, events: [singleEvent] });
24694
+ this.opts.onEvent({ sessionId: w.sessionId, events: [singleEvent] });
24736
24695
  }
24737
24696
  } catch {
24738
24697
  }
24739
24698
  }
24740
- poll(w2) {
24699
+ poll(w) {
24741
24700
  let size = 0;
24742
24701
  try {
24743
- size = import_node_fs12.default.statSync(w2.filePath).size;
24702
+ size = import_node_fs12.default.statSync(w.filePath).size;
24744
24703
  } catch {
24745
24704
  return;
24746
24705
  }
24747
- if (size < w2.lastSize) {
24748
- w2.lastSize = 0;
24749
- w2.buf = "";
24706
+ if (size < w.lastSize) {
24707
+ w.lastSize = 0;
24708
+ w.buf = "";
24750
24709
  }
24751
- if (size === w2.lastSize) return;
24752
- const fd = import_node_fs12.default.openSync(w2.filePath, "r");
24710
+ if (size === w.lastSize) return;
24711
+ const fd = import_node_fs12.default.openSync(w.filePath, "r");
24753
24712
  try {
24754
- const len = size - w2.lastSize;
24713
+ const len = size - w.lastSize;
24755
24714
  const buf = Buffer.alloc(len);
24756
- import_node_fs12.default.readSync(fd, buf, 0, len, w2.lastSize);
24757
- w2.lastSize = size;
24758
- w2.buf += buf.toString("utf8");
24715
+ import_node_fs12.default.readSync(fd, buf, 0, len, w.lastSize);
24716
+ w.lastSize = size;
24717
+ w.buf += buf.toString("utf8");
24759
24718
  let newlineIndex;
24760
- while ((newlineIndex = w2.buf.indexOf("\n")) >= 0) {
24761
- const line = w2.buf.slice(0, newlineIndex);
24762
- w2.buf = w2.buf.slice(newlineIndex + 1);
24763
- const events = w2.adapter.parseLine(line);
24764
- this.maybeReportUserMessage(w2.sessionId, line);
24719
+ while ((newlineIndex = w.buf.indexOf("\n")) >= 0) {
24720
+ const line = w.buf.slice(0, newlineIndex);
24721
+ w.buf = w.buf.slice(newlineIndex + 1);
24722
+ const events = w.adapter.parseLine(line);
24723
+ this.maybeReportUserMessage(w.sessionId, line);
24765
24724
  if (events.length > 0) {
24766
- this.opts.onEvent({ sessionId: w2.sessionId, events });
24725
+ this.opts.onEvent({ sessionId: w.sessionId, events });
24767
24726
  }
24768
24727
  }
24769
24728
  } finally {
@@ -24812,13 +24771,13 @@ var SessionObserver = class {
24812
24771
  return this.watches.has(sessionId);
24813
24772
  }
24814
24773
  stop(sessionId) {
24815
- const w2 = this.watches.get(sessionId);
24816
- if (!w2) return false;
24774
+ const w = this.watches.get(sessionId);
24775
+ if (!w) return false;
24817
24776
  try {
24818
- w2.watcher?.close();
24777
+ w.watcher?.close();
24819
24778
  } catch {
24820
24779
  }
24821
- if (w2.pollTimer) clearInterval(w2.pollTimer);
24780
+ if (w.pollTimer) clearInterval(w.pollTimer);
24822
24781
  this.watches.delete(sessionId);
24823
24782
  this.opts.onStatus?.(sessionId, "stopped");
24824
24783
  return true;
@@ -25403,10 +25362,10 @@ var AuthGate = class {
25403
25362
  st.timer = null;
25404
25363
  }
25405
25364
  };
25406
- function constantTimeEqual(a, b2) {
25407
- if (a.length !== b2.length) return false;
25365
+ function constantTimeEqual(a, b) {
25366
+ if (a.length !== b.length) return false;
25408
25367
  let diff2 = 0;
25409
- for (let i = 0; i < a.length; i++) diff2 |= a.charCodeAt(i) ^ b2.charCodeAt(i);
25368
+ for (let i = 0; i < a.length; i++) diff2 |= a.charCodeAt(i) ^ b.charCodeAt(i);
25410
25369
  return diff2 === 0;
25411
25370
  }
25412
25371
  function buildShouldEnforce(opts) {
@@ -25503,10 +25462,10 @@ var TunnelStore = class {
25503
25462
  return null;
25504
25463
  }
25505
25464
  }
25506
- async set(v2) {
25465
+ async set(v) {
25507
25466
  const dir = import_node_path14.default.dirname(this.filePath);
25508
25467
  await import_node_fs14.default.promises.mkdir(dir, { recursive: true });
25509
- const data = JSON.stringify(v2, null, 2);
25468
+ const data = JSON.stringify(v, null, 2);
25510
25469
  const tmp = `${this.filePath}.tmp.${process.pid}.${Date.now()}`;
25511
25470
  await import_node_fs14.default.promises.writeFile(tmp, data, { mode: 384 });
25512
25471
  if (process.platform !== "win32") {
@@ -25609,8 +25568,8 @@ function buildFrpcToml(input) {
25609
25568
  lines.push(`subdomain = "${escape(input.subdomain)}"`);
25610
25569
  return lines.join("\n") + "\n";
25611
25570
  }
25612
- function escape(v2) {
25613
- return v2.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
25571
+ function escape(v) {
25572
+ return v.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
25614
25573
  }
25615
25574
 
25616
25575
  // src/tunnel/frpc-binary.ts
@@ -25643,8 +25602,8 @@ function detectPlatform(opts = {}) {
25643
25602
  else throw new UnsupportedPlatformError(platform, arch);
25644
25603
  return { os: oss, arch: a };
25645
25604
  }
25646
- function frpcDownloadUrl(version2, p2) {
25647
- return `https://github.com/fatedier/frp/releases/download/v${version2}/frp_${version2}_${p2.os}_${p2.arch}.tar.gz`;
25605
+ function frpcDownloadUrl(version2, p) {
25606
+ return `https://github.com/fatedier/frp/releases/download/v${version2}/frp_${version2}_${p.os}_${p.arch}.tar.gz`;
25648
25607
  }
25649
25608
  async function ensureFrpcBinary(opts) {
25650
25609
  if (opts.override) {
@@ -25695,9 +25654,9 @@ function cleanupStaleArtifacts(binDir) {
25695
25654
  }
25696
25655
  }
25697
25656
  }
25698
- function safeUnlink(p2) {
25657
+ function safeUnlink(p) {
25699
25658
  try {
25700
- import_node_fs15.default.unlinkSync(p2);
25659
+ import_node_fs15.default.unlinkSync(p);
25701
25660
  } catch {
25702
25661
  }
25703
25662
  }
@@ -26296,7 +26255,7 @@ function listRecentDirs(store, limit = 50) {
26296
26255
  latestByCwd.set(s.cwd, s.updatedAt);
26297
26256
  }
26298
26257
  }
26299
- 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);
26258
+ 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);
26300
26259
  }
26301
26260
 
26302
26261
  // src/handlers/history.ts
@@ -26404,8 +26363,8 @@ function formatChildProcessError(err) {
26404
26363
  if (parts.length > 0) return parts.join(" ");
26405
26364
  return e.message ?? "unknown error";
26406
26365
  }
26407
- function normalizePath(p2) {
26408
- const resolved = import_node_path19.default.resolve(p2);
26366
+ function normalizePath(p) {
26367
+ const resolved = import_node_path19.default.resolve(p);
26409
26368
  try {
26410
26369
  return import_node_fs19.default.realpathSync(resolved);
26411
26370
  } catch {
@@ -27179,19 +27138,3 @@ main().catch((err) => {
27179
27138
  console.error("[clawd] fatal:", err);
27180
27139
  process.exit(1);
27181
27140
  });
27182
- /*! Bundled license information:
27183
-
27184
- @xterm/addon-serialize/lib/addon-serialize.mjs:
27185
- (**
27186
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
27187
- * @license MIT
27188
- *
27189
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
27190
- * @license MIT
27191
- *
27192
- * Originally forked from (with the author's permission):
27193
- * Fabrice Bellard's javascript vt100 for jslinux:
27194
- * http://bellard.org/jslinux/
27195
- * Copyright (c) 2011 Fabrice Bellard
27196
- *)
27197
- */