@willh/copilotstatusline 0.2.2 → 0.2.3

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.
@@ -19180,9 +19180,9 @@ var require_scheduler_development = __commonJS((exports) => {
19180
19180
  return localPerformance.now();
19181
19181
  };
19182
19182
  } else {
19183
- var localDate = Date, initialTime = localDate.now();
19183
+ var localDate2 = Date, initialTime = localDate2.now();
19184
19184
  exports.unstable_now = function() {
19185
- return localDate.now() - initialTime;
19185
+ return localDate2.now() - initialTime;
19186
19186
  };
19187
19187
  }
19188
19188
  var taskQueue = [], timerQueue = [], taskIdCounter = 1, currentTask = null, currentPriorityLevel = 3, isPerformingWork = false, isHostCallbackScheduled = false, isHostTimeoutScheduled = false, needsPaint = false, localSetTimeout = typeof setTimeout === "function" ? setTimeout : null, localClearTimeout = typeof clearTimeout === "function" ? clearTimeout : null, localSetImmediate = typeof setImmediate !== "undefined" ? setImmediate : null, isMessageLoopRunning = false, taskTimeoutID = -1, frameInterval = 5, startTime = -1;
@@ -19321,11 +19321,11 @@ var require_react_reconciler_development = __commonJS((exports, module) => {
19321
19321
  fiber = fiber.next, id--;
19322
19322
  return fiber;
19323
19323
  }
19324
- function copyWithSetImpl(obj, path3, index, value) {
19325
- if (index >= path3.length)
19324
+ function copyWithSetImpl(obj, path4, index, value) {
19325
+ if (index >= path4.length)
19326
19326
  return value;
19327
- var key = path3[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
19328
- updated[key] = copyWithSetImpl(obj[key], path3, index + 1, value);
19327
+ var key = path4[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
19328
+ updated[key] = copyWithSetImpl(obj[key], path4, index + 1, value);
19329
19329
  return updated;
19330
19330
  }
19331
19331
  function copyWithRename(obj, oldPath, newPath) {
@@ -19345,11 +19345,11 @@ var require_react_reconciler_development = __commonJS((exports, module) => {
19345
19345
  index + 1 === oldPath.length ? (updated[newPath[index]] = updated[oldKey], isArrayImpl(updated) ? updated.splice(oldKey, 1) : delete updated[oldKey]) : updated[oldKey] = copyWithRenameImpl(obj[oldKey], oldPath, newPath, index + 1);
19346
19346
  return updated;
19347
19347
  }
19348
- function copyWithDeleteImpl(obj, path3, index) {
19349
- var key = path3[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
19350
- if (index + 1 === path3.length)
19348
+ function copyWithDeleteImpl(obj, path4, index) {
19349
+ var key = path4[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
19350
+ if (index + 1 === path4.length)
19351
19351
  return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
19352
- updated[key] = copyWithDeleteImpl(obj[key], path3, index + 1);
19352
+ updated[key] = copyWithDeleteImpl(obj[key], path4, index + 1);
19353
19353
  return updated;
19354
19354
  }
19355
19355
  function shouldSuspendImpl() {
@@ -27061,9 +27061,9 @@ Check the render method of %s.`, getComponentNameFromFiber(current) || "Unknown"
27061
27061
  return localPerformance.now();
27062
27062
  };
27063
27063
  } else {
27064
- var localDate = Date;
27064
+ var localDate2 = Date;
27065
27065
  getCurrentTime = function() {
27066
- return localDate.now();
27066
+ return localDate2.now();
27067
27067
  };
27068
27068
  }
27069
27069
  var objectIs = typeof Object.is === "function" ? Object.is : is, NoMode = 0, valueCursor = createCursor(null);
@@ -28381,29 +28381,29 @@ Check the top-level render call using <` + componentName2 + ">.");
28381
28381
  var didWarnAboutNestedUpdates = false;
28382
28382
  var didWarnAboutFindNodeInStrictMode = {};
28383
28383
  var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, setErrorHandler = null, setSuspenseHandler = null;
28384
- overrideHookState = function(fiber, id, path3, value) {
28384
+ overrideHookState = function(fiber, id, path4, value) {
28385
28385
  id = findHook(fiber, id);
28386
- id !== null && (path3 = copyWithSetImpl(id.memoizedState, path3, 0, value), id.memoizedState = path3, id.baseState = path3, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path3 = enqueueConcurrentRenderForLane(fiber, 2), path3 !== null && scheduleUpdateOnFiber(path3, fiber, 2));
28386
+ id !== null && (path4 = copyWithSetImpl(id.memoizedState, path4, 0, value), id.memoizedState = path4, id.baseState = path4, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path4 = enqueueConcurrentRenderForLane(fiber, 2), path4 !== null && scheduleUpdateOnFiber(path4, fiber, 2));
28387
28387
  };
28388
- overrideHookStateDeletePath = function(fiber, id, path3) {
28388
+ overrideHookStateDeletePath = function(fiber, id, path4) {
28389
28389
  id = findHook(fiber, id);
28390
- id !== null && (path3 = copyWithDeleteImpl(id.memoizedState, path3, 0), id.memoizedState = path3, id.baseState = path3, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path3 = enqueueConcurrentRenderForLane(fiber, 2), path3 !== null && scheduleUpdateOnFiber(path3, fiber, 2));
28390
+ id !== null && (path4 = copyWithDeleteImpl(id.memoizedState, path4, 0), id.memoizedState = path4, id.baseState = path4, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path4 = enqueueConcurrentRenderForLane(fiber, 2), path4 !== null && scheduleUpdateOnFiber(path4, fiber, 2));
28391
28391
  };
28392
28392
  overrideHookStateRenamePath = function(fiber, id, oldPath, newPath) {
28393
28393
  id = findHook(fiber, id);
28394
28394
  id !== null && (oldPath = copyWithRename(id.memoizedState, oldPath, newPath), id.memoizedState = oldPath, id.baseState = oldPath, fiber.memoizedProps = assign2({}, fiber.memoizedProps), oldPath = enqueueConcurrentRenderForLane(fiber, 2), oldPath !== null && scheduleUpdateOnFiber(oldPath, fiber, 2));
28395
28395
  };
28396
- overrideProps = function(fiber, path3, value) {
28397
- fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path3, 0, value);
28396
+ overrideProps = function(fiber, path4, value) {
28397
+ fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path4, 0, value);
28398
28398
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
28399
- path3 = enqueueConcurrentRenderForLane(fiber, 2);
28400
- path3 !== null && scheduleUpdateOnFiber(path3, fiber, 2);
28399
+ path4 = enqueueConcurrentRenderForLane(fiber, 2);
28400
+ path4 !== null && scheduleUpdateOnFiber(path4, fiber, 2);
28401
28401
  };
28402
- overridePropsDeletePath = function(fiber, path3) {
28403
- fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path3, 0);
28402
+ overridePropsDeletePath = function(fiber, path4) {
28403
+ fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path4, 0);
28404
28404
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
28405
- path3 = enqueueConcurrentRenderForLane(fiber, 2);
28406
- path3 !== null && scheduleUpdateOnFiber(path3, fiber, 2);
28405
+ path4 = enqueueConcurrentRenderForLane(fiber, 2);
28406
+ path4 !== null && scheduleUpdateOnFiber(path4, fiber, 2);
28407
28407
  };
28408
28408
  overridePropsRenamePath = function(fiber, oldPath, newPath) {
28409
28409
  fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
@@ -36229,8 +36229,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36229
36229
  }
36230
36230
  return false;
36231
36231
  }
36232
- function utils_getInObject(object2, path3) {
36233
- return path3.reduce(function(reduced, attr) {
36232
+ function utils_getInObject(object2, path4) {
36233
+ return path4.reduce(function(reduced, attr) {
36234
36234
  if (reduced) {
36235
36235
  if (utils_hasOwnProperty.call(reduced, attr)) {
36236
36236
  return reduced[attr];
@@ -36242,11 +36242,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36242
36242
  return null;
36243
36243
  }, object2);
36244
36244
  }
36245
- function deletePathInObject(object2, path3) {
36246
- var length = path3.length;
36247
- var last2 = path3[length - 1];
36245
+ function deletePathInObject(object2, path4) {
36246
+ var length = path4.length;
36247
+ var last2 = path4[length - 1];
36248
36248
  if (object2 != null) {
36249
- var parent = utils_getInObject(object2, path3.slice(0, length - 1));
36249
+ var parent = utils_getInObject(object2, path4.slice(0, length - 1));
36250
36250
  if (parent) {
36251
36251
  if (src_isArray(parent)) {
36252
36252
  parent.splice(last2, 1);
@@ -36272,11 +36272,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36272
36272
  }
36273
36273
  }
36274
36274
  }
36275
- function utils_setInObject(object2, path3, value) {
36276
- var length = path3.length;
36277
- var last2 = path3[length - 1];
36275
+ function utils_setInObject(object2, path4, value) {
36276
+ var length = path4.length;
36277
+ var last2 = path4[length - 1];
36278
36278
  if (object2 != null) {
36279
- var parent = utils_getInObject(object2, path3.slice(0, length - 1));
36279
+ var parent = utils_getInObject(object2, path4.slice(0, length - 1));
36280
36280
  if (parent) {
36281
36281
  parent[last2] = value;
36282
36282
  }
@@ -36807,8 +36807,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36807
36807
  unserializable: Symbol("unserializable")
36808
36808
  };
36809
36809
  var LEVEL_THRESHOLD = 2;
36810
- function createDehydrated(type, inspectable, data, cleaned, path3) {
36811
- cleaned.push(path3);
36810
+ function createDehydrated(type, inspectable, data, cleaned, path4) {
36811
+ cleaned.push(path4);
36812
36812
  var dehydrated = {
36813
36813
  inspectable,
36814
36814
  type,
@@ -36826,13 +36826,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36826
36826
  }
36827
36827
  return dehydrated;
36828
36828
  }
36829
- function dehydrate(data, cleaned, unserializable, path3, isPathAllowed) {
36829
+ function dehydrate(data, cleaned, unserializable, path4, isPathAllowed) {
36830
36830
  var level = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
36831
36831
  var type = getDataType(data);
36832
36832
  var isPathAllowedCheck;
36833
36833
  switch (type) {
36834
36834
  case "html_element":
36835
- cleaned.push(path3);
36835
+ cleaned.push(path4);
36836
36836
  return {
36837
36837
  inspectable: false,
36838
36838
  preview_short: formatDataForPreview(data, false),
@@ -36841,7 +36841,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36841
36841
  type
36842
36842
  };
36843
36843
  case "function":
36844
- cleaned.push(path3);
36844
+ cleaned.push(path4);
36845
36845
  return {
36846
36846
  inspectable: false,
36847
36847
  preview_short: formatDataForPreview(data, false),
@@ -36850,14 +36850,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36850
36850
  type
36851
36851
  };
36852
36852
  case "string":
36853
- isPathAllowedCheck = isPathAllowed(path3);
36853
+ isPathAllowedCheck = isPathAllowed(path4);
36854
36854
  if (isPathAllowedCheck) {
36855
36855
  return data;
36856
36856
  } else {
36857
36857
  return data.length <= 500 ? data : data.slice(0, 500) + "...";
36858
36858
  }
36859
36859
  case "bigint":
36860
- cleaned.push(path3);
36860
+ cleaned.push(path4);
36861
36861
  return {
36862
36862
  inspectable: false,
36863
36863
  preview_short: formatDataForPreview(data, false),
@@ -36866,7 +36866,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36866
36866
  type
36867
36867
  };
36868
36868
  case "symbol":
36869
- cleaned.push(path3);
36869
+ cleaned.push(path4);
36870
36870
  return {
36871
36871
  inspectable: false,
36872
36872
  preview_short: formatDataForPreview(data, false),
@@ -36875,9 +36875,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36875
36875
  type
36876
36876
  };
36877
36877
  case "react_element": {
36878
- isPathAllowedCheck = isPathAllowed(path3);
36878
+ isPathAllowedCheck = isPathAllowed(path4);
36879
36879
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
36880
- cleaned.push(path3);
36880
+ cleaned.push(path4);
36881
36881
  return {
36882
36882
  inspectable: true,
36883
36883
  preview_short: formatDataForPreview(data, false),
@@ -36894,19 +36894,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36894
36894
  preview_long: formatDataForPreview(data, true),
36895
36895
  name: getDisplayNameForReactElement(data) || "Unknown"
36896
36896
  };
36897
- unserializableValue.key = dehydrate(data.key, cleaned, unserializable, path3.concat(["key"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
36897
+ unserializableValue.key = dehydrate(data.key, cleaned, unserializable, path4.concat(["key"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
36898
36898
  if (data.$$typeof === REACT_LEGACY_ELEMENT_TYPE) {
36899
- unserializableValue.ref = dehydrate(data.ref, cleaned, unserializable, path3.concat(["ref"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
36899
+ unserializableValue.ref = dehydrate(data.ref, cleaned, unserializable, path4.concat(["ref"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
36900
36900
  }
36901
- unserializableValue.props = dehydrate(data.props, cleaned, unserializable, path3.concat(["props"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
36902
- unserializable.push(path3);
36901
+ unserializableValue.props = dehydrate(data.props, cleaned, unserializable, path4.concat(["props"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
36902
+ unserializable.push(path4);
36903
36903
  return unserializableValue;
36904
36904
  }
36905
36905
  case "react_lazy": {
36906
- isPathAllowedCheck = isPathAllowed(path3);
36906
+ isPathAllowedCheck = isPathAllowed(path4);
36907
36907
  var payload = data._payload;
36908
36908
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
36909
- cleaned.push(path3);
36909
+ cleaned.push(path4);
36910
36910
  var inspectable = payload !== null && hydration_typeof(payload) === "object" && (payload._status === 1 || payload._status === 2 || payload.status === "fulfilled" || payload.status === "rejected");
36911
36911
  return {
36912
36912
  inspectable,
@@ -36923,13 +36923,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36923
36923
  preview_long: formatDataForPreview(data, true),
36924
36924
  name: "lazy()"
36925
36925
  };
36926
- _unserializableValue._payload = dehydrate(payload, cleaned, unserializable, path3.concat(["_payload"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
36927
- unserializable.push(path3);
36926
+ _unserializableValue._payload = dehydrate(payload, cleaned, unserializable, path4.concat(["_payload"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
36927
+ unserializable.push(path4);
36928
36928
  return _unserializableValue;
36929
36929
  }
36930
36930
  case "array_buffer":
36931
36931
  case "data_view":
36932
- cleaned.push(path3);
36932
+ cleaned.push(path4);
36933
36933
  return {
36934
36934
  inspectable: false,
36935
36935
  preview_short: formatDataForPreview(data, false),
@@ -36939,21 +36939,21 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36939
36939
  type
36940
36940
  };
36941
36941
  case "array":
36942
- isPathAllowedCheck = isPathAllowed(path3);
36942
+ isPathAllowedCheck = isPathAllowed(path4);
36943
36943
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
36944
- return createDehydrated(type, true, data, cleaned, path3);
36944
+ return createDehydrated(type, true, data, cleaned, path4);
36945
36945
  }
36946
36946
  var arr = [];
36947
36947
  for (var i = 0;i < data.length; i++) {
36948
- arr[i] = dehydrateKey(data, i, cleaned, unserializable, path3.concat([i]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
36948
+ arr[i] = dehydrateKey(data, i, cleaned, unserializable, path4.concat([i]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
36949
36949
  }
36950
36950
  return arr;
36951
36951
  case "html_all_collection":
36952
36952
  case "typed_array":
36953
36953
  case "iterator":
36954
- isPathAllowedCheck = isPathAllowed(path3);
36954
+ isPathAllowedCheck = isPathAllowed(path4);
36955
36955
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
36956
- return createDehydrated(type, true, data, cleaned, path3);
36956
+ return createDehydrated(type, true, data, cleaned, path4);
36957
36957
  } else {
36958
36958
  var _unserializableValue2 = {
36959
36959
  unserializable: true,
@@ -36965,13 +36965,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36965
36965
  name: typeof data.constructor !== "function" || typeof data.constructor.name !== "string" || data.constructor.name === "Object" ? "" : data.constructor.name
36966
36966
  };
36967
36967
  Array.from(data).forEach(function(item, i2) {
36968
- return _unserializableValue2[i2] = dehydrate(item, cleaned, unserializable, path3.concat([i2]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
36968
+ return _unserializableValue2[i2] = dehydrate(item, cleaned, unserializable, path4.concat([i2]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
36969
36969
  });
36970
- unserializable.push(path3);
36970
+ unserializable.push(path4);
36971
36971
  return _unserializableValue2;
36972
36972
  }
36973
36973
  case "opaque_iterator":
36974
- cleaned.push(path3);
36974
+ cleaned.push(path4);
36975
36975
  return {
36976
36976
  inspectable: false,
36977
36977
  preview_short: formatDataForPreview(data, false),
@@ -36980,7 +36980,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36980
36980
  type
36981
36981
  };
36982
36982
  case "date":
36983
- cleaned.push(path3);
36983
+ cleaned.push(path4);
36984
36984
  return {
36985
36985
  inspectable: false,
36986
36986
  preview_short: formatDataForPreview(data, false),
@@ -36989,7 +36989,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36989
36989
  type
36990
36990
  };
36991
36991
  case "regexp":
36992
- cleaned.push(path3);
36992
+ cleaned.push(path4);
36993
36993
  return {
36994
36994
  inspectable: false,
36995
36995
  preview_short: formatDataForPreview(data, false),
@@ -36998,9 +36998,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36998
36998
  type
36999
36999
  };
37000
37000
  case "thenable":
37001
- isPathAllowedCheck = isPathAllowed(path3);
37001
+ isPathAllowedCheck = isPathAllowed(path4);
37002
37002
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
37003
- cleaned.push(path3);
37003
+ cleaned.push(path4);
37004
37004
  return {
37005
37005
  inspectable: data.status === "fulfilled" || data.status === "rejected",
37006
37006
  preview_short: formatDataForPreview(data, false),
@@ -37021,8 +37021,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37021
37021
  preview_long: formatDataForPreview(data, true),
37022
37022
  name: "fulfilled Thenable"
37023
37023
  };
37024
- _unserializableValue3.value = dehydrate(data.value, cleaned, unserializable, path3.concat(["value"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37025
- unserializable.push(path3);
37024
+ _unserializableValue3.value = dehydrate(data.value, cleaned, unserializable, path4.concat(["value"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37025
+ unserializable.push(path4);
37026
37026
  return _unserializableValue3;
37027
37027
  }
37028
37028
  case "rejected": {
@@ -37033,12 +37033,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37033
37033
  preview_long: formatDataForPreview(data, true),
37034
37034
  name: "rejected Thenable"
37035
37035
  };
37036
- _unserializableValue4.reason = dehydrate(data.reason, cleaned, unserializable, path3.concat(["reason"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37037
- unserializable.push(path3);
37036
+ _unserializableValue4.reason = dehydrate(data.reason, cleaned, unserializable, path4.concat(["reason"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37037
+ unserializable.push(path4);
37038
37038
  return _unserializableValue4;
37039
37039
  }
37040
37040
  default:
37041
- cleaned.push(path3);
37041
+ cleaned.push(path4);
37042
37042
  return {
37043
37043
  inspectable: false,
37044
37044
  preview_short: formatDataForPreview(data, false),
@@ -37048,21 +37048,21 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37048
37048
  };
37049
37049
  }
37050
37050
  case "object":
37051
- isPathAllowedCheck = isPathAllowed(path3);
37051
+ isPathAllowedCheck = isPathAllowed(path4);
37052
37052
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
37053
- return createDehydrated(type, true, data, cleaned, path3);
37053
+ return createDehydrated(type, true, data, cleaned, path4);
37054
37054
  } else {
37055
37055
  var object2 = {};
37056
37056
  getAllEnumerableKeys(data).forEach(function(key) {
37057
37057
  var name = key.toString();
37058
- object2[name] = dehydrateKey(data, key, cleaned, unserializable, path3.concat([name]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37058
+ object2[name] = dehydrateKey(data, key, cleaned, unserializable, path4.concat([name]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37059
37059
  });
37060
37060
  return object2;
37061
37061
  }
37062
37062
  case "class_instance": {
37063
- isPathAllowedCheck = isPathAllowed(path3);
37063
+ isPathAllowedCheck = isPathAllowed(path4);
37064
37064
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
37065
- return createDehydrated(type, true, data, cleaned, path3);
37065
+ return createDehydrated(type, true, data, cleaned, path4);
37066
37066
  }
37067
37067
  var value = {
37068
37068
  unserializable: true,
@@ -37074,15 +37074,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37074
37074
  };
37075
37075
  getAllEnumerableKeys(data).forEach(function(key) {
37076
37076
  var keyAsString = key.toString();
37077
- value[keyAsString] = dehydrate(data[key], cleaned, unserializable, path3.concat([keyAsString]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37077
+ value[keyAsString] = dehydrate(data[key], cleaned, unserializable, path4.concat([keyAsString]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37078
37078
  });
37079
- unserializable.push(path3);
37079
+ unserializable.push(path4);
37080
37080
  return value;
37081
37081
  }
37082
37082
  case "error": {
37083
- isPathAllowedCheck = isPathAllowed(path3);
37083
+ isPathAllowedCheck = isPathAllowed(path4);
37084
37084
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
37085
- return createDehydrated(type, true, data, cleaned, path3);
37085
+ return createDehydrated(type, true, data, cleaned, path4);
37086
37086
  }
37087
37087
  var _value = {
37088
37088
  unserializable: true,
@@ -37092,22 +37092,22 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37092
37092
  preview_long: formatDataForPreview(data, true),
37093
37093
  name: data.name
37094
37094
  };
37095
- _value.message = dehydrate(data.message, cleaned, unserializable, path3.concat(["message"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37096
- _value.stack = dehydrate(data.stack, cleaned, unserializable, path3.concat(["stack"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37095
+ _value.message = dehydrate(data.message, cleaned, unserializable, path4.concat(["message"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37096
+ _value.stack = dehydrate(data.stack, cleaned, unserializable, path4.concat(["stack"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37097
37097
  if ("cause" in data) {
37098
- _value.cause = dehydrate(data.cause, cleaned, unserializable, path3.concat(["cause"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37098
+ _value.cause = dehydrate(data.cause, cleaned, unserializable, path4.concat(["cause"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37099
37099
  }
37100
37100
  getAllEnumerableKeys(data).forEach(function(key) {
37101
37101
  var keyAsString = key.toString();
37102
- _value[keyAsString] = dehydrate(data[key], cleaned, unserializable, path3.concat([keyAsString]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37102
+ _value[keyAsString] = dehydrate(data[key], cleaned, unserializable, path4.concat([keyAsString]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
37103
37103
  });
37104
- unserializable.push(path3);
37104
+ unserializable.push(path4);
37105
37105
  return _value;
37106
37106
  }
37107
37107
  case "infinity":
37108
37108
  case "nan":
37109
37109
  case "undefined":
37110
- cleaned.push(path3);
37110
+ cleaned.push(path4);
37111
37111
  return {
37112
37112
  type
37113
37113
  };
@@ -37115,10 +37115,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37115
37115
  return data;
37116
37116
  }
37117
37117
  }
37118
- function dehydrateKey(parent, key, cleaned, unserializable, path3, isPathAllowed) {
37118
+ function dehydrateKey(parent, key, cleaned, unserializable, path4, isPathAllowed) {
37119
37119
  var level = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
37120
37120
  try {
37121
- return dehydrate(parent[key], cleaned, unserializable, path3, isPathAllowed, level);
37121
+ return dehydrate(parent[key], cleaned, unserializable, path4, isPathAllowed, level);
37122
37122
  } catch (error51) {
37123
37123
  var preview = "";
37124
37124
  if (hydration_typeof(error51) === "object" && error51 !== null && typeof error51.stack === "string") {
@@ -37126,7 +37126,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37126
37126
  } else if (typeof error51 === "string") {
37127
37127
  preview = error51;
37128
37128
  }
37129
- cleaned.push(path3);
37129
+ cleaned.push(path4);
37130
37130
  return {
37131
37131
  inspectable: false,
37132
37132
  preview_short: "[Exception]",
@@ -37136,8 +37136,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37136
37136
  };
37137
37137
  }
37138
37138
  }
37139
- function fillInPath(object2, data, path3, value) {
37140
- var target = getInObject(object2, path3);
37139
+ function fillInPath(object2, data, path4, value) {
37140
+ var target = getInObject(object2, path4);
37141
37141
  if (target != null) {
37142
37142
  if (!target[meta3.unserializable]) {
37143
37143
  delete target[meta3.inspectable];
@@ -37152,9 +37152,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37152
37152
  }
37153
37153
  if (value !== null && data.unserializable.length > 0) {
37154
37154
  var unserializablePath = data.unserializable[0];
37155
- var isMatch2 = unserializablePath.length === path3.length;
37156
- for (var i = 0;i < path3.length; i++) {
37157
- if (path3[i] !== unserializablePath[i]) {
37155
+ var isMatch2 = unserializablePath.length === path4.length;
37156
+ for (var i = 0;i < path4.length; i++) {
37157
+ if (path4[i] !== unserializablePath[i]) {
37158
37158
  isMatch2 = false;
37159
37159
  break;
37160
37160
  }
@@ -37163,13 +37163,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37163
37163
  upgradeUnserializable(value, value);
37164
37164
  }
37165
37165
  }
37166
- setInObject(object2, path3, value);
37166
+ setInObject(object2, path4, value);
37167
37167
  }
37168
37168
  function hydrate(object2, cleaned, unserializable) {
37169
- cleaned.forEach(function(path3) {
37170
- var length = path3.length;
37171
- var last2 = path3[length - 1];
37172
- var parent = getInObject(object2, path3.slice(0, length - 1));
37169
+ cleaned.forEach(function(path4) {
37170
+ var length = path4.length;
37171
+ var last2 = path4[length - 1];
37172
+ var parent = getInObject(object2, path4.slice(0, length - 1));
37173
37173
  if (!parent || !parent.hasOwnProperty(last2)) {
37174
37174
  return;
37175
37175
  }
@@ -37195,10 +37195,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37195
37195
  parent[last2] = replaced;
37196
37196
  }
37197
37197
  });
37198
- unserializable.forEach(function(path3) {
37199
- var length = path3.length;
37200
- var last2 = path3[length - 1];
37201
- var parent = getInObject(object2, path3.slice(0, length - 1));
37198
+ unserializable.forEach(function(path4) {
37199
+ var length = path4.length;
37200
+ var last2 = path4[length - 1];
37201
+ var parent = getInObject(object2, path4.slice(0, length - 1));
37202
37202
  if (!parent || !parent.hasOwnProperty(last2)) {
37203
37203
  return;
37204
37204
  }
@@ -37319,11 +37319,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37319
37319
  return gte2(version2, FIRST_DEVTOOLS_BACKEND_LOCKSTEP_VER);
37320
37320
  }
37321
37321
  function cleanForBridge(data, isPathAllowed) {
37322
- var path3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
37322
+ var path4 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
37323
37323
  if (data !== null) {
37324
37324
  var cleanedPaths = [];
37325
37325
  var unserializablePaths = [];
37326
- var cleanedData = dehydrate(data, cleanedPaths, unserializablePaths, path3, isPathAllowed);
37326
+ var cleanedData = dehydrate(data, cleanedPaths, unserializablePaths, path4, isPathAllowed);
37327
37327
  return {
37328
37328
  data: cleanedData,
37329
37329
  cleaned: cleanedPaths,
@@ -37333,18 +37333,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37333
37333
  return null;
37334
37334
  }
37335
37335
  }
37336
- function copyWithDelete(obj, path3) {
37336
+ function copyWithDelete(obj, path4) {
37337
37337
  var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
37338
- var key = path3[index];
37338
+ var key = path4[index];
37339
37339
  var updated = shared_isArray(obj) ? obj.slice() : utils_objectSpread({}, obj);
37340
- if (index + 1 === path3.length) {
37340
+ if (index + 1 === path4.length) {
37341
37341
  if (shared_isArray(updated)) {
37342
37342
  updated.splice(key, 1);
37343
37343
  } else {
37344
37344
  delete updated[key];
37345
37345
  }
37346
37346
  } else {
37347
- updated[key] = copyWithDelete(obj[key], path3, index + 1);
37347
+ updated[key] = copyWithDelete(obj[key], path4, index + 1);
37348
37348
  }
37349
37349
  return updated;
37350
37350
  }
@@ -37365,14 +37365,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37365
37365
  }
37366
37366
  return updated;
37367
37367
  }
37368
- function copyWithSet(obj, path3, value) {
37368
+ function copyWithSet(obj, path4, value) {
37369
37369
  var index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
37370
- if (index >= path3.length) {
37370
+ if (index >= path4.length) {
37371
37371
  return value;
37372
37372
  }
37373
- var key = path3[index];
37373
+ var key = path4[index];
37374
37374
  var updated = shared_isArray(obj) ? obj.slice() : utils_objectSpread({}, obj);
37375
- updated[key] = copyWithSet(obj[key], path3, value, index + 1);
37375
+ updated[key] = copyWithSet(obj[key], path4, value, index + 1);
37376
37376
  return updated;
37377
37377
  }
37378
37378
  function getEffectDurations(root) {
@@ -38700,12 +38700,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
38700
38700
  }
38701
38701
  });
38702
38702
  bridge_defineProperty(_this, "overrideValueAtPath", function(_ref) {
38703
- var { id, path: path3, rendererID, type, value } = _ref;
38703
+ var { id, path: path4, rendererID, type, value } = _ref;
38704
38704
  switch (type) {
38705
38705
  case "context":
38706
38706
  _this.send("overrideContext", {
38707
38707
  id,
38708
- path: path3,
38708
+ path: path4,
38709
38709
  rendererID,
38710
38710
  wasForwarded: true,
38711
38711
  value
@@ -38714,7 +38714,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
38714
38714
  case "hooks":
38715
38715
  _this.send("overrideHookState", {
38716
38716
  id,
38717
- path: path3,
38717
+ path: path4,
38718
38718
  rendererID,
38719
38719
  wasForwarded: true,
38720
38720
  value
@@ -38723,7 +38723,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
38723
38723
  case "props":
38724
38724
  _this.send("overrideProps", {
38725
38725
  id,
38726
- path: path3,
38726
+ path: path4,
38727
38727
  rendererID,
38728
38728
  wasForwarded: true,
38729
38729
  value
@@ -38732,7 +38732,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
38732
38732
  case "state":
38733
38733
  _this.send("overrideState", {
38734
38734
  id,
38735
- path: path3,
38735
+ path: path4,
38736
38736
  rendererID,
38737
38737
  wasForwarded: true,
38738
38738
  value
@@ -39066,12 +39066,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
39066
39066
  }
39067
39067
  });
39068
39068
  agent_defineProperty(_this, "copyElementPath", function(_ref5) {
39069
- var { id, path: path3, rendererID } = _ref5;
39069
+ var { id, path: path4, rendererID } = _ref5;
39070
39070
  var renderer = _this._rendererInterfaces[rendererID];
39071
39071
  if (renderer == null) {
39072
39072
  console.warn('Invalid renderer id "'.concat(rendererID, '" for element "').concat(id, '"'));
39073
39073
  } else {
39074
- var value = renderer.getSerializedElementValueByPath(id, path3);
39074
+ var value = renderer.getSerializedElementValueByPath(id, path4);
39075
39075
  if (value != null) {
39076
39076
  _this._bridge.send("saveToClipboard", value);
39077
39077
  } else {
@@ -39080,12 +39080,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
39080
39080
  }
39081
39081
  });
39082
39082
  agent_defineProperty(_this, "deletePath", function(_ref6) {
39083
- var { hookID, id, path: path3, rendererID, type } = _ref6;
39083
+ var { hookID, id, path: path4, rendererID, type } = _ref6;
39084
39084
  var renderer = _this._rendererInterfaces[rendererID];
39085
39085
  if (renderer == null) {
39086
39086
  console.warn('Invalid renderer id "'.concat(rendererID, '" for element "').concat(id, '"'));
39087
39087
  } else {
39088
- renderer.deletePath(type, id, hookID, path3);
39088
+ renderer.deletePath(type, id, hookID, path4);
39089
39089
  }
39090
39090
  });
39091
39091
  agent_defineProperty(_this, "getBackendVersion", function() {
@@ -39122,12 +39122,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
39122
39122
  }
39123
39123
  });
39124
39124
  agent_defineProperty(_this, "inspectElement", function(_ref9) {
39125
- var { forceFullData, id, path: path3, rendererID, requestID } = _ref9;
39125
+ var { forceFullData, id, path: path4, rendererID, requestID } = _ref9;
39126
39126
  var renderer = _this._rendererInterfaces[rendererID];
39127
39127
  if (renderer == null) {
39128
39128
  console.warn('Invalid renderer id "'.concat(rendererID, '" for element "').concat(id, '"'));
39129
39129
  } else {
39130
- _this._bridge.send("inspectedElement", renderer.inspectElement(requestID, id, path3, forceFullData));
39130
+ _this._bridge.send("inspectedElement", renderer.inspectElement(requestID, id, path4, forceFullData));
39131
39131
  if (_this._persistedSelectionMatch === null || _this._persistedSelectionMatch.id !== id) {
39132
39132
  _this._persistedSelection = null;
39133
39133
  _this._persistedSelectionMatch = null;
@@ -39161,15 +39161,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
39161
39161
  }
39162
39162
  for (var rendererID in _this._rendererInterfaces) {
39163
39163
  var renderer = _this._rendererInterfaces[rendererID];
39164
- var path3 = null;
39164
+ var path4 = null;
39165
39165
  if (suspendedByPathIndex !== null && rendererPath !== null) {
39166
39166
  var suspendedByPathRendererIndex = suspendedByPathIndex - suspendedByOffset;
39167
39167
  var rendererHasRequestedSuspendedByPath = renderer.getElementAttributeByPath(id, ["suspendedBy", suspendedByPathRendererIndex]) !== undefined;
39168
39168
  if (rendererHasRequestedSuspendedByPath) {
39169
- path3 = ["suspendedBy", suspendedByPathRendererIndex].concat(rendererPath);
39169
+ path4 = ["suspendedBy", suspendedByPathRendererIndex].concat(rendererPath);
39170
39170
  }
39171
39171
  }
39172
- var inspectedRootsPayload = renderer.inspectElement(requestID, id, path3, forceFullData);
39172
+ var inspectedRootsPayload = renderer.inspectElement(requestID, id, path4, forceFullData);
39173
39173
  switch (inspectedRootsPayload.type) {
39174
39174
  case "hydrated-path":
39175
39175
  inspectedRootsPayload.path[1] += suspendedByOffset;
@@ -39263,20 +39263,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
39263
39263
  }
39264
39264
  });
39265
39265
  agent_defineProperty(_this, "overrideValueAtPath", function(_ref15) {
39266
- var { hookID, id, path: path3, rendererID, type, value } = _ref15;
39266
+ var { hookID, id, path: path4, rendererID, type, value } = _ref15;
39267
39267
  var renderer = _this._rendererInterfaces[rendererID];
39268
39268
  if (renderer == null) {
39269
39269
  console.warn('Invalid renderer id "'.concat(rendererID, '" for element "').concat(id, '"'));
39270
39270
  } else {
39271
- renderer.overrideValueAtPath(type, id, hookID, path3, value);
39271
+ renderer.overrideValueAtPath(type, id, hookID, path4, value);
39272
39272
  }
39273
39273
  });
39274
39274
  agent_defineProperty(_this, "overrideContext", function(_ref16) {
39275
- var { id, path: path3, rendererID, wasForwarded, value } = _ref16;
39275
+ var { id, path: path4, rendererID, wasForwarded, value } = _ref16;
39276
39276
  if (!wasForwarded) {
39277
39277
  _this.overrideValueAtPath({
39278
39278
  id,
39279
- path: path3,
39279
+ path: path4,
39280
39280
  rendererID,
39281
39281
  type: "context",
39282
39282
  value
@@ -39284,11 +39284,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
39284
39284
  }
39285
39285
  });
39286
39286
  agent_defineProperty(_this, "overrideHookState", function(_ref17) {
39287
- var { id, hookID, path: path3, rendererID, wasForwarded, value } = _ref17;
39287
+ var { id, hookID, path: path4, rendererID, wasForwarded, value } = _ref17;
39288
39288
  if (!wasForwarded) {
39289
39289
  _this.overrideValueAtPath({
39290
39290
  id,
39291
- path: path3,
39291
+ path: path4,
39292
39292
  rendererID,
39293
39293
  type: "hooks",
39294
39294
  value
@@ -39296,11 +39296,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
39296
39296
  }
39297
39297
  });
39298
39298
  agent_defineProperty(_this, "overrideProps", function(_ref18) {
39299
- var { id, path: path3, rendererID, wasForwarded, value } = _ref18;
39299
+ var { id, path: path4, rendererID, wasForwarded, value } = _ref18;
39300
39300
  if (!wasForwarded) {
39301
39301
  _this.overrideValueAtPath({
39302
39302
  id,
39303
- path: path3,
39303
+ path: path4,
39304
39304
  rendererID,
39305
39305
  type: "props",
39306
39306
  value
@@ -39308,11 +39308,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
39308
39308
  }
39309
39309
  });
39310
39310
  agent_defineProperty(_this, "overrideState", function(_ref19) {
39311
- var { id, path: path3, rendererID, wasForwarded, value } = _ref19;
39311
+ var { id, path: path4, rendererID, wasForwarded, value } = _ref19;
39312
39312
  if (!wasForwarded) {
39313
39313
  _this.overrideValueAtPath({
39314
39314
  id,
39315
- path: path3,
39315
+ path: path4,
39316
39316
  rendererID,
39317
39317
  type: "state",
39318
39318
  value
@@ -39379,12 +39379,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
39379
39379
  _this._bridge.send("stopInspectingHost", selected);
39380
39380
  });
39381
39381
  agent_defineProperty(_this, "storeAsGlobal", function(_ref23) {
39382
- var { count, id, path: path3, rendererID } = _ref23;
39382
+ var { count, id, path: path4, rendererID } = _ref23;
39383
39383
  var renderer = _this._rendererInterfaces[rendererID];
39384
39384
  if (renderer == null) {
39385
39385
  console.warn('Invalid renderer id "'.concat(rendererID, '" for element "').concat(id, '"'));
39386
39386
  } else {
39387
- renderer.storeAsGlobal(id, path3, count);
39387
+ renderer.storeAsGlobal(id, path4, count);
39388
39388
  }
39389
39389
  });
39390
39390
  agent_defineProperty(_this, "updateHookSettings", function(settings) {
@@ -39401,12 +39401,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
39401
39401
  var rendererID = +rendererIDString;
39402
39402
  var renderer = _this._rendererInterfaces[rendererID];
39403
39403
  if (_this._lastSelectedRendererID === rendererID) {
39404
- var path3 = renderer.getPathForElement(_this._lastSelectedElementID);
39405
- if (path3 !== null) {
39406
- renderer.setTrackedPath(path3);
39404
+ var path4 = renderer.getPathForElement(_this._lastSelectedElementID);
39405
+ if (path4 !== null) {
39406
+ renderer.setTrackedPath(path4);
39407
39407
  _this._persistedSelection = {
39408
39408
  rendererID,
39409
- path: path3
39409
+ path: path4
39410
39410
  };
39411
39411
  }
39412
39412
  }
@@ -39481,11 +39481,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
39481
39481
  var rendererID = _this._lastSelectedRendererID;
39482
39482
  var id = _this._lastSelectedElementID;
39483
39483
  var renderer = _this._rendererInterfaces[rendererID];
39484
- var path3 = renderer != null ? renderer.getPathForElement(id) : null;
39485
- if (path3 !== null) {
39484
+ var path4 = renderer != null ? renderer.getPathForElement(id) : null;
39485
+ if (path4 !== null) {
39486
39486
  storage_sessionStorageSetItem(SESSION_STORAGE_LAST_SELECTION_KEY, JSON.stringify({
39487
39487
  rendererID,
39488
- path: path3
39488
+ path: path4
39489
39489
  }));
39490
39490
  } else {
39491
39491
  storage_sessionStorageRemoveItem(SESSION_STORAGE_LAST_SELECTION_KEY);
@@ -40208,7 +40208,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
40208
40208
  hasElementWithId: function hasElementWithId() {
40209
40209
  return false;
40210
40210
  },
40211
- inspectElement: function inspectElement(requestID, id, path3) {
40211
+ inspectElement: function inspectElement(requestID, id, path4) {
40212
40212
  return {
40213
40213
  id,
40214
40214
  responseID: requestID,
@@ -45478,9 +45478,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
45478
45478
  }
45479
45479
  return null;
45480
45480
  }
45481
- function getElementAttributeByPath(id, path3) {
45481
+ function getElementAttributeByPath(id, path4) {
45482
45482
  if (isMostRecentlyInspectedElement(id)) {
45483
- return utils_getInObject(mostRecentlyInspectedElement, path3);
45483
+ return utils_getInObject(mostRecentlyInspectedElement, path4);
45484
45484
  }
45485
45485
  return;
45486
45486
  }
@@ -46183,9 +46183,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
46183
46183
  function isMostRecentlyInspectedElementCurrent(id) {
46184
46184
  return isMostRecentlyInspectedElement(id) && !hasElementUpdatedSinceLastInspected;
46185
46185
  }
46186
- function mergeInspectedPaths(path3) {
46186
+ function mergeInspectedPaths(path4) {
46187
46187
  var current = currentlyInspectedPaths;
46188
- path3.forEach(function(key) {
46188
+ path4.forEach(function(key) {
46189
46189
  if (!current[key]) {
46190
46190
  current[key] = {};
46191
46191
  }
@@ -46193,21 +46193,21 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
46193
46193
  });
46194
46194
  }
46195
46195
  function createIsPathAllowed(key, secondaryCategory) {
46196
- return function isPathAllowed(path3) {
46196
+ return function isPathAllowed(path4) {
46197
46197
  switch (secondaryCategory) {
46198
46198
  case "hooks":
46199
- if (path3.length === 1) {
46199
+ if (path4.length === 1) {
46200
46200
  return true;
46201
46201
  }
46202
- if (path3[path3.length - 2] === "hookSource" && path3[path3.length - 1] === "fileName") {
46202
+ if (path4[path4.length - 2] === "hookSource" && path4[path4.length - 1] === "fileName") {
46203
46203
  return true;
46204
46204
  }
46205
- if (path3[path3.length - 1] === "subHooks" || path3[path3.length - 2] === "subHooks") {
46205
+ if (path4[path4.length - 1] === "subHooks" || path4[path4.length - 2] === "subHooks") {
46206
46206
  return true;
46207
46207
  }
46208
46208
  break;
46209
46209
  case "suspendedBy":
46210
- if (path3.length < 5) {
46210
+ if (path4.length < 5) {
46211
46211
  return true;
46212
46212
  }
46213
46213
  break;
@@ -46218,8 +46218,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
46218
46218
  if (!current) {
46219
46219
  return false;
46220
46220
  }
46221
- for (var i = 0;i < path3.length; i++) {
46222
- current = current[path3[i]];
46221
+ for (var i = 0;i < path4.length; i++) {
46222
+ current = current[path4[i]];
46223
46223
  if (!current) {
46224
46224
  return false;
46225
46225
  }
@@ -46273,38 +46273,38 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
46273
46273
  break;
46274
46274
  }
46275
46275
  }
46276
- function storeAsGlobal(id, path3, count) {
46276
+ function storeAsGlobal(id, path4, count) {
46277
46277
  if (isMostRecentlyInspectedElement(id)) {
46278
- var value = utils_getInObject(mostRecentlyInspectedElement, path3);
46278
+ var value = utils_getInObject(mostRecentlyInspectedElement, path4);
46279
46279
  var key = "$reactTemp".concat(count);
46280
46280
  window[key] = value;
46281
46281
  console.log(key);
46282
46282
  console.log(value);
46283
46283
  }
46284
46284
  }
46285
- function getSerializedElementValueByPath(id, path3) {
46285
+ function getSerializedElementValueByPath(id, path4) {
46286
46286
  if (isMostRecentlyInspectedElement(id)) {
46287
- var valueToCopy = utils_getInObject(mostRecentlyInspectedElement, path3);
46287
+ var valueToCopy = utils_getInObject(mostRecentlyInspectedElement, path4);
46288
46288
  return serializeToString(valueToCopy);
46289
46289
  }
46290
46290
  }
46291
- function inspectElement(requestID, id, path3, forceFullData) {
46292
- if (path3 !== null) {
46293
- mergeInspectedPaths(path3);
46291
+ function inspectElement(requestID, id, path4, forceFullData) {
46292
+ if (path4 !== null) {
46293
+ mergeInspectedPaths(path4);
46294
46294
  }
46295
46295
  if (isMostRecentlyInspectedElement(id) && !forceFullData) {
46296
46296
  if (!hasElementUpdatedSinceLastInspected) {
46297
- if (path3 !== null) {
46297
+ if (path4 !== null) {
46298
46298
  var secondaryCategory = null;
46299
- if (path3[0] === "hooks" || path3[0] === "suspendedBy") {
46300
- secondaryCategory = path3[0];
46299
+ if (path4[0] === "hooks" || path4[0] === "suspendedBy") {
46300
+ secondaryCategory = path4[0];
46301
46301
  }
46302
46302
  return {
46303
46303
  id,
46304
46304
  responseID: requestID,
46305
46305
  type: "hydrated-path",
46306
- path: path3,
46307
- value: cleanForBridge(utils_getInObject(mostRecentlyInspectedElement, path3), createIsPathAllowed(null, secondaryCategory), path3)
46306
+ path: path4,
46307
+ value: cleanForBridge(utils_getInObject(mostRecentlyInspectedElement, path4), createIsPathAllowed(null, secondaryCategory), path4)
46308
46308
  };
46309
46309
  } else {
46310
46310
  return {
@@ -46500,7 +46500,7 @@ The error thrown in the component is:
46500
46500
  console.groupEnd();
46501
46501
  }
46502
46502
  }
46503
- function deletePath(type, id, hookID, path3) {
46503
+ function deletePath(type, id, hookID, path4) {
46504
46504
  var devtoolsInstance = idToDevToolsInstanceMap.get(id);
46505
46505
  if (devtoolsInstance === undefined) {
46506
46506
  console.warn('Could not find DevToolsInstance with id "'.concat(id, '"'));
@@ -46514,11 +46514,11 @@ The error thrown in the component is:
46514
46514
  var instance = fiber.stateNode;
46515
46515
  switch (type) {
46516
46516
  case "context":
46517
- path3 = path3.slice(1);
46517
+ path4 = path4.slice(1);
46518
46518
  switch (fiber.tag) {
46519
46519
  case ClassComponent:
46520
- if (path3.length === 0) {} else {
46521
- deletePathInObject(instance.context, path3);
46520
+ if (path4.length === 0) {} else {
46521
+ deletePathInObject(instance.context, path4);
46522
46522
  }
46523
46523
  instance.forceUpdate();
46524
46524
  break;
@@ -46528,21 +46528,21 @@ The error thrown in the component is:
46528
46528
  break;
46529
46529
  case "hooks":
46530
46530
  if (typeof overrideHookStateDeletePath === "function") {
46531
- overrideHookStateDeletePath(fiber, hookID, path3);
46531
+ overrideHookStateDeletePath(fiber, hookID, path4);
46532
46532
  }
46533
46533
  break;
46534
46534
  case "props":
46535
46535
  if (instance === null) {
46536
46536
  if (typeof overridePropsDeletePath === "function") {
46537
- overridePropsDeletePath(fiber, path3);
46537
+ overridePropsDeletePath(fiber, path4);
46538
46538
  }
46539
46539
  } else {
46540
- fiber.pendingProps = copyWithDelete(instance.props, path3);
46540
+ fiber.pendingProps = copyWithDelete(instance.props, path4);
46541
46541
  instance.forceUpdate();
46542
46542
  }
46543
46543
  break;
46544
46544
  case "state":
46545
- deletePathInObject(instance.state, path3);
46545
+ deletePathInObject(instance.state, path4);
46546
46546
  instance.forceUpdate();
46547
46547
  break;
46548
46548
  }
@@ -46597,7 +46597,7 @@ The error thrown in the component is:
46597
46597
  }
46598
46598
  }
46599
46599
  }
46600
- function overrideValueAtPath(type, id, hookID, path3, value) {
46600
+ function overrideValueAtPath(type, id, hookID, path4, value) {
46601
46601
  var devtoolsInstance = idToDevToolsInstanceMap.get(id);
46602
46602
  if (devtoolsInstance === undefined) {
46603
46603
  console.warn('Could not find DevToolsInstance with id "'.concat(id, '"'));
@@ -46611,13 +46611,13 @@ The error thrown in the component is:
46611
46611
  var instance = fiber.stateNode;
46612
46612
  switch (type) {
46613
46613
  case "context":
46614
- path3 = path3.slice(1);
46614
+ path4 = path4.slice(1);
46615
46615
  switch (fiber.tag) {
46616
46616
  case ClassComponent:
46617
- if (path3.length === 0) {
46617
+ if (path4.length === 0) {
46618
46618
  instance.context = value;
46619
46619
  } else {
46620
- utils_setInObject(instance.context, path3, value);
46620
+ utils_setInObject(instance.context, path4, value);
46621
46621
  }
46622
46622
  instance.forceUpdate();
46623
46623
  break;
@@ -46627,18 +46627,18 @@ The error thrown in the component is:
46627
46627
  break;
46628
46628
  case "hooks":
46629
46629
  if (typeof overrideHookState === "function") {
46630
- overrideHookState(fiber, hookID, path3, value);
46630
+ overrideHookState(fiber, hookID, path4, value);
46631
46631
  }
46632
46632
  break;
46633
46633
  case "props":
46634
46634
  switch (fiber.tag) {
46635
46635
  case ClassComponent:
46636
- fiber.pendingProps = copyWithSet(instance.props, path3, value);
46636
+ fiber.pendingProps = copyWithSet(instance.props, path4, value);
46637
46637
  instance.forceUpdate();
46638
46638
  break;
46639
46639
  default:
46640
46640
  if (typeof overrideProps === "function") {
46641
- overrideProps(fiber, path3, value);
46641
+ overrideProps(fiber, path4, value);
46642
46642
  }
46643
46643
  break;
46644
46644
  }
@@ -46646,7 +46646,7 @@ The error thrown in the component is:
46646
46646
  case "state":
46647
46647
  switch (fiber.tag) {
46648
46648
  case ClassComponent:
46649
- utils_setInObject(instance.state, path3, value);
46649
+ utils_setInObject(instance.state, path4, value);
46650
46650
  instance.forceUpdate();
46651
46651
  break;
46652
46652
  }
@@ -46932,14 +46932,14 @@ The error thrown in the component is:
46932
46932
  var trackedPathMatchInstance = null;
46933
46933
  var trackedPathMatchDepth = -1;
46934
46934
  var mightBeOnTrackedPath = false;
46935
- function setTrackedPath(path3) {
46936
- if (path3 === null) {
46935
+ function setTrackedPath(path4) {
46936
+ if (path4 === null) {
46937
46937
  trackedPathMatchFiber = null;
46938
46938
  trackedPathMatchInstance = null;
46939
46939
  trackedPathMatchDepth = -1;
46940
46940
  mightBeOnTrackedPath = false;
46941
46941
  }
46942
- trackedPath = path3;
46942
+ trackedPath = path4;
46943
46943
  }
46944
46944
  function updateTrackedPathStateBeforeMount(fiber, fiberInstance) {
46945
46945
  if (trackedPath === null || !mightBeOnTrackedPath) {
@@ -47703,9 +47703,9 @@ The error thrown in the component is:
47703
47703
  }
47704
47704
  var currentlyInspectedElementID = null;
47705
47705
  var currentlyInspectedPaths = {};
47706
- function mergeInspectedPaths(path3) {
47706
+ function mergeInspectedPaths(path4) {
47707
47707
  var current = currentlyInspectedPaths;
47708
- path3.forEach(function(key) {
47708
+ path4.forEach(function(key) {
47709
47709
  if (!current[key]) {
47710
47710
  current[key] = {};
47711
47711
  }
@@ -47713,13 +47713,13 @@ The error thrown in the component is:
47713
47713
  });
47714
47714
  }
47715
47715
  function createIsPathAllowed(key) {
47716
- return function isPathAllowed(path3) {
47716
+ return function isPathAllowed(path4) {
47717
47717
  var current = currentlyInspectedPaths[key];
47718
47718
  if (!current) {
47719
47719
  return false;
47720
47720
  }
47721
- for (var i = 0;i < path3.length; i++) {
47722
- current = current[path3[i]];
47721
+ for (var i = 0;i < path4.length; i++) {
47722
+ current = current[path4[i]];
47723
47723
  if (!current) {
47724
47724
  return false;
47725
47725
  }
@@ -47769,24 +47769,24 @@ The error thrown in the component is:
47769
47769
  break;
47770
47770
  }
47771
47771
  }
47772
- function storeAsGlobal(id, path3, count) {
47772
+ function storeAsGlobal(id, path4, count) {
47773
47773
  var inspectedElement = inspectElementRaw(id);
47774
47774
  if (inspectedElement !== null) {
47775
- var value = utils_getInObject(inspectedElement, path3);
47775
+ var value = utils_getInObject(inspectedElement, path4);
47776
47776
  var key = "$reactTemp".concat(count);
47777
47777
  window[key] = value;
47778
47778
  console.log(key);
47779
47779
  console.log(value);
47780
47780
  }
47781
47781
  }
47782
- function getSerializedElementValueByPath(id, path3) {
47782
+ function getSerializedElementValueByPath(id, path4) {
47783
47783
  var inspectedElement = inspectElementRaw(id);
47784
47784
  if (inspectedElement !== null) {
47785
- var valueToCopy = utils_getInObject(inspectedElement, path3);
47785
+ var valueToCopy = utils_getInObject(inspectedElement, path4);
47786
47786
  return serializeToString(valueToCopy);
47787
47787
  }
47788
47788
  }
47789
- function inspectElement(requestID, id, path3, forceFullData) {
47789
+ function inspectElement(requestID, id, path4, forceFullData) {
47790
47790
  if (forceFullData || currentlyInspectedElementID !== id) {
47791
47791
  currentlyInspectedElementID = id;
47792
47792
  currentlyInspectedPaths = {};
@@ -47799,8 +47799,8 @@ The error thrown in the component is:
47799
47799
  type: "not-found"
47800
47800
  };
47801
47801
  }
47802
- if (path3 !== null) {
47803
- mergeInspectedPaths(path3);
47802
+ if (path4 !== null) {
47803
+ mergeInspectedPaths(path4);
47804
47804
  }
47805
47805
  updateSelectedElement(id);
47806
47806
  inspectedElement.context = cleanForBridge(inspectedElement.context, createIsPathAllowed("context"));
@@ -48003,10 +48003,10 @@ The error thrown in the component is:
48003
48003
  console.groupEnd();
48004
48004
  }
48005
48005
  }
48006
- function getElementAttributeByPath(id, path3) {
48006
+ function getElementAttributeByPath(id, path4) {
48007
48007
  var inspectedElement = inspectElementRaw(id);
48008
48008
  if (inspectedElement !== null) {
48009
- return utils_getInObject(inspectedElement, path3);
48009
+ return utils_getInObject(inspectedElement, path4);
48010
48010
  }
48011
48011
  return;
48012
48012
  }
@@ -48023,14 +48023,14 @@ The error thrown in the component is:
48023
48023
  }
48024
48024
  return element.type;
48025
48025
  }
48026
- function deletePath(type, id, hookID, path3) {
48026
+ function deletePath(type, id, hookID, path4) {
48027
48027
  var internalInstance = idToInternalInstanceMap.get(id);
48028
48028
  if (internalInstance != null) {
48029
48029
  var publicInstance = internalInstance._instance;
48030
48030
  if (publicInstance != null) {
48031
48031
  switch (type) {
48032
48032
  case "context":
48033
- deletePathInObject(publicInstance.context, path3);
48033
+ deletePathInObject(publicInstance.context, path4);
48034
48034
  forceUpdate(publicInstance);
48035
48035
  break;
48036
48036
  case "hooks":
@@ -48038,12 +48038,12 @@ The error thrown in the component is:
48038
48038
  case "props":
48039
48039
  var element = internalInstance._currentElement;
48040
48040
  internalInstance._currentElement = legacy_renderer_objectSpread(legacy_renderer_objectSpread({}, element), {}, {
48041
- props: copyWithDelete(element.props, path3)
48041
+ props: copyWithDelete(element.props, path4)
48042
48042
  });
48043
48043
  forceUpdate(publicInstance);
48044
48044
  break;
48045
48045
  case "state":
48046
- deletePathInObject(publicInstance.state, path3);
48046
+ deletePathInObject(publicInstance.state, path4);
48047
48047
  forceUpdate(publicInstance);
48048
48048
  break;
48049
48049
  }
@@ -48077,14 +48077,14 @@ The error thrown in the component is:
48077
48077
  }
48078
48078
  }
48079
48079
  }
48080
- function overrideValueAtPath(type, id, hookID, path3, value) {
48080
+ function overrideValueAtPath(type, id, hookID, path4, value) {
48081
48081
  var internalInstance = idToInternalInstanceMap.get(id);
48082
48082
  if (internalInstance != null) {
48083
48083
  var publicInstance = internalInstance._instance;
48084
48084
  if (publicInstance != null) {
48085
48085
  switch (type) {
48086
48086
  case "context":
48087
- utils_setInObject(publicInstance.context, path3, value);
48087
+ utils_setInObject(publicInstance.context, path4, value);
48088
48088
  forceUpdate(publicInstance);
48089
48089
  break;
48090
48090
  case "hooks":
@@ -48092,12 +48092,12 @@ The error thrown in the component is:
48092
48092
  case "props":
48093
48093
  var element = internalInstance._currentElement;
48094
48094
  internalInstance._currentElement = legacy_renderer_objectSpread(legacy_renderer_objectSpread({}, element), {}, {
48095
- props: copyWithSet(element.props, path3, value)
48095
+ props: copyWithSet(element.props, path4, value)
48096
48096
  });
48097
48097
  forceUpdate(publicInstance);
48098
48098
  break;
48099
48099
  case "state":
48100
- utils_setInObject(publicInstance.state, path3, value);
48100
+ utils_setInObject(publicInstance.state, path4, value);
48101
48101
  forceUpdate(publicInstance);
48102
48102
  break;
48103
48103
  }
@@ -48138,7 +48138,7 @@ The error thrown in the component is:
48138
48138
  return [];
48139
48139
  }
48140
48140
  function setTraceUpdatesEnabled(enabled) {}
48141
- function setTrackedPath(path3) {}
48141
+ function setTrackedPath(path4) {}
48142
48142
  function getOwnersList(id) {
48143
48143
  return null;
48144
48144
  }
@@ -51582,7 +51582,7 @@ var init_Text = __esm(() => {
51582
51582
  });
51583
51583
 
51584
51584
  // node_modules/ink/build/components/ErrorOverview.js
51585
- import * as fs3 from "node:fs";
51585
+ import * as fs4 from "node:fs";
51586
51586
  import { cwd } from "node:process";
51587
51587
  function ErrorOverview({ error: error51 }) {
51588
51588
  const stack = error51.stack ? error51.stack.split(`
@@ -51591,8 +51591,8 @@ function ErrorOverview({ error: error51 }) {
51591
51591
  const filePath = cleanupPath(origin?.file);
51592
51592
  let excerpt;
51593
51593
  let lineWidth = 0;
51594
- if (filePath && origin?.line && fs3.existsSync(filePath)) {
51595
- const sourceCode = fs3.readFileSync(filePath, "utf8");
51594
+ if (filePath && origin?.line && fs4.existsSync(filePath)) {
51595
+ const sourceCode = fs4.readFileSync(filePath, "utf8");
51596
51596
  excerpt = dist_default3(sourceCode, origin.line);
51597
51597
  if (excerpt) {
51598
51598
  for (const { line } of excerpt) {
@@ -51609,8 +51609,8 @@ function ErrorOverview({ error: error51 }) {
51609
51609
  return import_react11.default.createElement(Box_default, { key: line }, import_react11.default.createElement(Text, { dimColor: true }, "- "), import_react11.default.createElement(Text, { dimColor: true, bold: true }, parsedLine.function), import_react11.default.createElement(Text, { dimColor: true, color: "gray", "aria-label": `at ${cleanupPath(parsedLine.file) ?? ""} line ${parsedLine.line} column ${parsedLine.column}` }, " ", "(", cleanupPath(parsedLine.file) ?? "", ":", parsedLine.line, ":", parsedLine.column, ")"));
51610
51610
  })));
51611
51611
  }
51612
- var import_react11, import_stack_utils, cleanupPath = (path3) => {
51613
- return path3?.replace(`file://${cwd()}/`, "");
51612
+ var import_react11, import_stack_utils, cleanupPath = (path4) => {
51613
+ return path4?.replace(`file://${cwd()}/`, "");
51614
51614
  }, stackUtils;
51615
51615
  var init_ErrorOverview = __esm(() => {
51616
51616
  init_dist3();
@@ -53171,21 +53171,21 @@ var require_tinycolor = __commonJS((exports, module) => {
53171
53171
  };
53172
53172
  }
53173
53173
  function rgbToHex(r, g, b, allow3Char) {
53174
- var hex3 = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
53174
+ var hex3 = [pad22(Math.round(r).toString(16)), pad22(Math.round(g).toString(16)), pad22(Math.round(b).toString(16))];
53175
53175
  if (allow3Char && hex3[0].charAt(0) == hex3[0].charAt(1) && hex3[1].charAt(0) == hex3[1].charAt(1) && hex3[2].charAt(0) == hex3[2].charAt(1)) {
53176
53176
  return hex3[0].charAt(0) + hex3[1].charAt(0) + hex3[2].charAt(0);
53177
53177
  }
53178
53178
  return hex3.join("");
53179
53179
  }
53180
53180
  function rgbaToHex(r, g, b, a, allow4Char) {
53181
- var hex3 = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
53181
+ var hex3 = [pad22(Math.round(r).toString(16)), pad22(Math.round(g).toString(16)), pad22(Math.round(b).toString(16)), pad22(convertDecimalToHex(a))];
53182
53182
  if (allow4Char && hex3[0].charAt(0) == hex3[0].charAt(1) && hex3[1].charAt(0) == hex3[1].charAt(1) && hex3[2].charAt(0) == hex3[2].charAt(1) && hex3[3].charAt(0) == hex3[3].charAt(1)) {
53183
53183
  return hex3[0].charAt(0) + hex3[1].charAt(0) + hex3[2].charAt(0) + hex3[3].charAt(0);
53184
53184
  }
53185
53185
  return hex3.join("");
53186
53186
  }
53187
53187
  function rgbaToArgbHex(r, g, b, a) {
53188
- var hex3 = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
53188
+ var hex3 = [pad22(convertDecimalToHex(a)), pad22(Math.round(r).toString(16)), pad22(Math.round(g).toString(16)), pad22(Math.round(b).toString(16))];
53189
53189
  return hex3.join("");
53190
53190
  }
53191
53191
  tinycolor.equals = function(color1, color2) {
@@ -53563,7 +53563,7 @@ var require_tinycolor = __commonJS((exports, module) => {
53563
53563
  function isPercentage(n) {
53564
53564
  return typeof n === "string" && n.indexOf("%") != -1;
53565
53565
  }
53566
- function pad2(c) {
53566
+ function pad22(c) {
53567
53567
  return c.length == 1 ? "0" + c : "" + c;
53568
53568
  }
53569
53569
  function convertToPercentage(n) {
@@ -54312,7 +54312,7 @@ var package_default;
54312
54312
  var init_package = __esm(() => {
54313
54313
  package_default = {
54314
54314
  name: "@willh/copilotstatusline",
54315
- version: "0.2.2",
54315
+ version: "0.2.3",
54316
54316
  bugs: {
54317
54317
  url: "https://github.com/doggy8088/copilotstatusline/issues"
54318
54318
  },
@@ -56535,7 +56535,313 @@ function normalizeCopilotStatus(status) {
56535
56535
  init_app_settings();
56536
56536
  init_copilot_settings();
56537
56537
  init_renderer();
56538
- var PACKAGE_VERSION = "0.2.2";
56538
+
56539
+ // src/utils/token-usage.ts
56540
+ init_zod();
56541
+ init_copilot_settings();
56542
+ import * as fs3 from "node:fs";
56543
+ import * as path3 from "node:path";
56544
+ var USAGE_RECORDING_DISABLE_ENV = "COPILOTSTATUSLINE_DISABLE_USAGE_RECORDING";
56545
+ var STATE_VERSION = 1;
56546
+ var MAX_TRACKED_SESSIONS = 100;
56547
+ var DEFAULT_LOCK_TIMEOUT_MS = 100;
56548
+ var DEFAULT_STALE_LOCK_MS = 5000;
56549
+ var nonNegativeInteger = exports_external.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
56550
+ var sessionStateSchema = exports_external.object({
56551
+ sessionId: exports_external.string(),
56552
+ turnNo: nonNegativeInteger,
56553
+ model: exports_external.string(),
56554
+ modelId: exports_external.string(),
56555
+ inputTokens: nonNegativeInteger,
56556
+ outputTokens: nonNegativeInteger,
56557
+ cacheReadTokens: nonNegativeInteger,
56558
+ cacheWriteTokens: nonNegativeInteger,
56559
+ reasoningTokens: nonNegativeInteger,
56560
+ totalTokens: nonNegativeInteger,
56561
+ updatedAt: exports_external.string(),
56562
+ updatedAtEpochMs: nonNegativeInteger
56563
+ });
56564
+ var usageStateSchema = exports_external.object({
56565
+ version: exports_external.literal(STATE_VERSION),
56566
+ sessions: exports_external.record(exports_external.string(), sessionStateSchema)
56567
+ });
56568
+ var legacyStateSchema = exports_external.looseObject({
56569
+ session_id: exports_external.string(),
56570
+ turn_no: nonNegativeInteger.optional(),
56571
+ model: exports_external.string().optional(),
56572
+ model_id: exports_external.string().optional(),
56573
+ input_tokens: nonNegativeInteger.optional(),
56574
+ output_tokens: nonNegativeInteger.optional(),
56575
+ cache_read_tokens: nonNegativeInteger.optional(),
56576
+ cache_write_tokens: nonNegativeInteger.optional(),
56577
+ reasoning_tokens: nonNegativeInteger.optional(),
56578
+ total_tokens: nonNegativeInteger.optional()
56579
+ });
56580
+ function emptyState() {
56581
+ return {
56582
+ version: STATE_VERSION,
56583
+ sessions: {}
56584
+ };
56585
+ }
56586
+ function isNodeError(error51, code) {
56587
+ return error51.code === code;
56588
+ }
56589
+ function pad(value, length = 2) {
56590
+ return String(value).padStart(length, "0");
56591
+ }
56592
+ function localDate(date5) {
56593
+ return `${date5.getFullYear()}-${pad(date5.getMonth() + 1)}-${pad(date5.getDate())}`;
56594
+ }
56595
+ function localIsoTimestamp(date5) {
56596
+ const offsetMinutes = -date5.getTimezoneOffset();
56597
+ const offsetSign = offsetMinutes >= 0 ? "+" : "-";
56598
+ const absoluteOffset = Math.abs(offsetMinutes);
56599
+ const offsetHours = Math.floor(absoluteOffset / 60);
56600
+ const remainingMinutes = absoluteOffset % 60;
56601
+ return `${localDate(date5)}T${pad(date5.getHours())}:${pad(date5.getMinutes())}:${pad(date5.getSeconds())}` + `${offsetSign}${pad(offsetHours)}:${pad(remainingMinutes)}`;
56602
+ }
56603
+ function delay(milliseconds) {
56604
+ return new Promise((resolve3) => setTimeout(resolve3, milliseconds));
56605
+ }
56606
+ async function acquireLock(lockPath, timeoutMs, staleLockMs) {
56607
+ const startedAt = Date.now();
56608
+ for (;; ) {
56609
+ try {
56610
+ await fs3.promises.mkdir(lockPath);
56611
+ return async () => fs3.promises.rm(lockPath, { recursive: true, force: true });
56612
+ } catch (error51) {
56613
+ if (!isNodeError(error51, "EEXIST")) {
56614
+ throw error51;
56615
+ }
56616
+ const stats = await fs3.promises.stat(lockPath).catch(() => {
56617
+ return;
56618
+ });
56619
+ if (stats !== undefined && Date.now() - stats.mtimeMs > staleLockMs) {
56620
+ await fs3.promises.rm(lockPath, { recursive: true, force: true });
56621
+ continue;
56622
+ }
56623
+ if (Date.now() - startedAt >= timeoutMs) {
56624
+ throw new Error(`timed out waiting for usage lock after ${timeoutMs} ms`, { cause: error51 });
56625
+ }
56626
+ await delay(Math.min(10, Math.max(1, timeoutMs)));
56627
+ }
56628
+ }
56629
+ }
56630
+ async function atomicWriteJson2(filePath, value) {
56631
+ const temporaryPath = path3.join(path3.dirname(filePath), `${path3.basename(filePath)}.${process.pid}.${Date.now()}.tmp`);
56632
+ try {
56633
+ await fs3.promises.writeFile(temporaryPath, `${JSON.stringify(value, null, 2)}
56634
+ `, "utf8");
56635
+ await fs3.promises.rename(temporaryPath, filePath);
56636
+ } catch (error51) {
56637
+ await fs3.promises.unlink(temporaryPath).catch(() => {
56638
+ return;
56639
+ });
56640
+ throw error51;
56641
+ }
56642
+ }
56643
+ function legacySessionState(input, sessionId, updatedAt, updatedAtEpochMs) {
56644
+ const parsed = legacyStateSchema.safeParse(input);
56645
+ if (!parsed.success || parsed.data.session_id !== sessionId) {
56646
+ return;
56647
+ }
56648
+ return {
56649
+ sessionId,
56650
+ turnNo: parsed.data.turn_no ?? 0,
56651
+ model: parsed.data.model ?? "unknown",
56652
+ modelId: parsed.data.model_id ?? "unknown",
56653
+ inputTokens: parsed.data.input_tokens ?? 0,
56654
+ outputTokens: parsed.data.output_tokens ?? 0,
56655
+ cacheReadTokens: parsed.data.cache_read_tokens ?? 0,
56656
+ cacheWriteTokens: parsed.data.cache_write_tokens ?? 0,
56657
+ reasoningTokens: parsed.data.reasoning_tokens ?? 0,
56658
+ totalTokens: parsed.data.total_tokens ?? 0,
56659
+ updatedAt,
56660
+ updatedAtEpochMs
56661
+ };
56662
+ }
56663
+ async function loadLegacyState(copilotHome, sessionId, updatedAt, updatedAtEpochMs) {
56664
+ try {
56665
+ const input = await fs3.promises.readFile(path3.join(copilotHome, "statusline-state.json"), "utf8");
56666
+ const legacy = legacySessionState(JSON.parse(input), sessionId, updatedAt, updatedAtEpochMs);
56667
+ const state = emptyState();
56668
+ if (legacy !== undefined) {
56669
+ state.sessions[sessionId] = legacy;
56670
+ }
56671
+ return state;
56672
+ } catch {
56673
+ return emptyState();
56674
+ }
56675
+ }
56676
+ async function loadState(statePath, copilotHome, sessionId, updatedAt, updatedAtEpochMs) {
56677
+ let input;
56678
+ try {
56679
+ input = await fs3.promises.readFile(statePath, "utf8");
56680
+ } catch (error51) {
56681
+ if (!isNodeError(error51, "ENOENT")) {
56682
+ throw error51;
56683
+ }
56684
+ return { state: await loadLegacyState(copilotHome, sessionId, updatedAt, updatedAtEpochMs) };
56685
+ }
56686
+ try {
56687
+ const parsedJson = JSON.parse(input);
56688
+ const parsed = usageStateSchema.safeParse(parsedJson);
56689
+ if (!parsed.success) {
56690
+ throw new Error("state schema is invalid");
56691
+ }
56692
+ return { state: parsed.data };
56693
+ } catch {
56694
+ const corruptPath = `${statePath}.corrupt.${Date.now()}.${process.pid}`;
56695
+ await fs3.promises.rename(statePath, corruptPath);
56696
+ return {
56697
+ state: emptyState(),
56698
+ warning: `recovered invalid usage state as ${corruptPath}`
56699
+ };
56700
+ }
56701
+ }
56702
+ function assertTokenCounters(status) {
56703
+ const counters = [
56704
+ status.context.inputTokens,
56705
+ status.context.outputTokens,
56706
+ status.context.cacheReadTokens,
56707
+ status.context.cacheWriteTokens,
56708
+ status.context.reasoningTokens,
56709
+ status.context.totalTokens,
56710
+ status.context.lastCallInputTokens,
56711
+ status.context.lastCallOutputTokens,
56712
+ status.context.currentTokens,
56713
+ status.context.limitTokens
56714
+ ];
56715
+ if (!counters.every((value) => Number.isSafeInteger(value) && value >= 0)) {
56716
+ throw new Error("token counters must be non-negative safe integers");
56717
+ }
56718
+ }
56719
+ function delta(current, previous) {
56720
+ return Math.max(0, current - (previous ?? 0));
56721
+ }
56722
+ function sessionStateKey(sessionId) {
56723
+ return Buffer.from(sessionId, "utf8").toString("base64url");
56724
+ }
56725
+ function pruneSessions(state) {
56726
+ const sessions = Object.entries(state.sessions);
56727
+ if (sessions.length <= MAX_TRACKED_SESSIONS) {
56728
+ return;
56729
+ }
56730
+ sessions.sort((left, right) => {
56731
+ return right[1].updatedAtEpochMs - left[1].updatedAtEpochMs;
56732
+ });
56733
+ state.sessions = Object.fromEntries(sessions.slice(0, MAX_TRACKED_SESSIONS));
56734
+ }
56735
+ async function recordTokenUsage(status, options = {}) {
56736
+ if (process.env[USAGE_RECORDING_DISABLE_ENV] === "1") {
56737
+ return { recorded: false };
56738
+ }
56739
+ const sessionId = status.sessionId;
56740
+ if (sessionId === undefined || sessionId.trim() === "") {
56741
+ return { recorded: false };
56742
+ }
56743
+ assertTokenCounters(status);
56744
+ const now = options.now ?? new Date;
56745
+ const timestamp = localIsoTimestamp(now);
56746
+ const copilotHome = options.copilotHome ?? getCopilotHome();
56747
+ const usageDirectory = path3.join(copilotHome, "usage");
56748
+ const statePath = path3.join(copilotHome, "copilotstatusline-usage-state.json");
56749
+ const lockPath = path3.join(copilotHome, "copilotstatusline-usage.lock");
56750
+ await fs3.promises.mkdir(copilotHome, { recursive: true });
56751
+ const releaseLock = await acquireLock(lockPath, options.lockTimeoutMs ?? DEFAULT_LOCK_TIMEOUT_MS, options.staleLockMs ?? DEFAULT_STALE_LOCK_MS);
56752
+ try {
56753
+ const loaded = await loadState(statePath, copilotHome, sessionId, timestamp, now.getTime());
56754
+ const state = loaded.state;
56755
+ const sessionKey = sessionStateKey(sessionId);
56756
+ const previous = state.sessions[sessionKey] ?? state.sessions[sessionId];
56757
+ const model = status.modelName ?? status.modelId ?? "unknown";
56758
+ const modelId = status.modelId ?? "unknown";
56759
+ const deltaInput = delta(status.context.inputTokens, previous?.inputTokens);
56760
+ const deltaOutput = delta(status.context.outputTokens, previous?.outputTokens);
56761
+ const deltaCacheRead = delta(status.context.cacheReadTokens, previous?.cacheReadTokens);
56762
+ const deltaCacheWrite = delta(status.context.cacheWriteTokens, previous?.cacheWriteTokens);
56763
+ const deltaReasoning = delta(status.context.reasoningTokens, previous?.reasoningTokens);
56764
+ const deltaTotal = delta(status.context.totalTokens, previous?.totalTokens);
56765
+ const previousModel = previous?.model ?? "";
56766
+ const modelChanged = previousModel !== "" && previousModel !== model;
56767
+ const turnNo = (previous?.turnNo ?? 0) + (deltaTotal > 0 ? 1 : 0);
56768
+ if (deltaTotal > 0) {
56769
+ const entry = {
56770
+ timestamp,
56771
+ session_id: sessionId,
56772
+ session_name: status.sessionName ?? "",
56773
+ transcript_path: status.transcriptPath ?? "",
56774
+ cwd: status.cwd ?? "",
56775
+ version: status.version ?? "",
56776
+ turn_no: turnNo,
56777
+ model,
56778
+ model_id: modelId,
56779
+ previous_model: previousModel,
56780
+ model_changed: modelChanged,
56781
+ tokens: {
56782
+ input: status.context.inputTokens,
56783
+ output: status.context.outputTokens,
56784
+ cache_read: status.context.cacheReadTokens,
56785
+ cache_write: status.context.cacheWriteTokens,
56786
+ reasoning: status.context.reasoningTokens,
56787
+ total: status.context.totalTokens,
56788
+ last_call_input: status.context.lastCallInputTokens,
56789
+ last_call_output: status.context.lastCallOutputTokens
56790
+ },
56791
+ delta_tokens: {
56792
+ input: deltaInput,
56793
+ output: deltaOutput,
56794
+ cache_read: deltaCacheRead,
56795
+ cache_write: deltaCacheWrite,
56796
+ reasoning: deltaReasoning,
56797
+ total: deltaTotal
56798
+ },
56799
+ context: {
56800
+ current_context_tokens: status.context.currentTokens,
56801
+ displayed_context_limit: status.context.limitTokens,
56802
+ current_context_used_percentage: status.context.usedPercentage === undefined ? "" : String(status.context.usedPercentage)
56803
+ },
56804
+ cost: {
56805
+ total_api_duration_ms: status.cost.apiDurationMs,
56806
+ total_duration_ms: status.cost.durationMs,
56807
+ total_premium_requests: status.cost.premiumRequests,
56808
+ total_lines_added: status.cost.linesAdded,
56809
+ total_lines_removed: status.cost.linesRemoved
56810
+ }
56811
+ };
56812
+ await fs3.promises.mkdir(usageDirectory, { recursive: true });
56813
+ const jsonlPath = path3.join(usageDirectory, `usage-${localDate(now)}.jsonl`);
56814
+ await fs3.promises.appendFile(jsonlPath, `${JSON.stringify(entry)}
56815
+ `, "utf8");
56816
+ }
56817
+ Reflect.deleteProperty(state.sessions, sessionId);
56818
+ state.sessions[sessionKey] = {
56819
+ sessionId,
56820
+ turnNo,
56821
+ model,
56822
+ modelId,
56823
+ inputTokens: status.context.inputTokens,
56824
+ outputTokens: status.context.outputTokens,
56825
+ cacheReadTokens: status.context.cacheReadTokens,
56826
+ cacheWriteTokens: status.context.cacheWriteTokens,
56827
+ reasoningTokens: status.context.reasoningTokens,
56828
+ totalTokens: status.context.totalTokens,
56829
+ updatedAt: timestamp,
56830
+ updatedAtEpochMs: now.getTime()
56831
+ };
56832
+ pruneSessions(state);
56833
+ await atomicWriteJson2(statePath, state);
56834
+ return {
56835
+ recorded: deltaTotal > 0,
56836
+ ...loaded.warning === undefined ? {} : { warning: loaded.warning }
56837
+ };
56838
+ } finally {
56839
+ await releaseLock();
56840
+ }
56841
+ }
56842
+
56843
+ // src/copilotstatusline.ts
56844
+ var PACKAGE_VERSION = "0.2.3";
56539
56845
  async function readStdin() {
56540
56846
  process.stdin.setEncoding("utf8");
56541
56847
  const chunks = [];
@@ -56566,12 +56872,21 @@ async function renderPipedStatus() {
56566
56872
  if (!parsed.success) {
56567
56873
  throw new Error(`Invalid Copilot status JSON: ${parsed.error.message}`);
56568
56874
  }
56875
+ const status = normalizeCopilotStatus(parsed.data);
56876
+ try {
56877
+ const recording = await recordTokenUsage(status);
56878
+ if (recording.warning !== undefined) {
56879
+ console.error(`copilotstatusline: ${recording.warning}`);
56880
+ }
56881
+ } catch (error51) {
56882
+ const message = error51 instanceof Error ? error51.message : String(error51);
56883
+ console.error(`copilotstatusline: unable to record token usage: ${message}`);
56884
+ }
56569
56885
  const settings = await loadSettings();
56570
56886
  const warning = getSettingsLoadError();
56571
56887
  if (warning !== null) {
56572
56888
  console.error(`copilotstatusline: ${warning}; using defaults without overwriting the file`);
56573
56889
  }
56574
- const status = normalizeCopilotStatus(parsed.data);
56575
56890
  for (const line of renderStatusLines(status, settings)) {
56576
56891
  console.log(line);
56577
56892
  }