@ai-ecoverse/slicc-spectrum 1.70.0 → 1.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/slicc-ui.js CHANGED
@@ -6605,8 +6605,8 @@ function hasFixedPositionAncestor(element2, stopNode) {
6605
6605
  }
6606
6606
  return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
6607
6607
  }
6608
- function getClippingElementAncestors(element2, cache3) {
6609
- const cachedResult = cache3.get(element2);
6608
+ function getClippingElementAncestors(element2, cache4) {
6609
+ const cachedResult = cache4.get(element2);
6610
6610
  if (cachedResult) {
6611
6611
  return cachedResult;
6612
6612
  }
@@ -6628,7 +6628,7 @@ function getClippingElementAncestors(element2, cache3) {
6628
6628
  }
6629
6629
  currentNode = getParentNode(currentNode);
6630
6630
  }
6631
- cache3.set(element2, result);
6631
+ cache4.set(element2, result);
6632
6632
  return result;
6633
6633
  }
6634
6634
  function getClippingRect(_ref) {
@@ -6929,14 +6929,14 @@ var flip2 = flip;
6929
6929
  var size2 = size;
6930
6930
  var arrow2 = arrow;
6931
6931
  var computePosition2 = (reference2, floating, options) => {
6932
- const cache3 = /* @__PURE__ */ new Map();
6932
+ const cache4 = /* @__PURE__ */ new Map();
6933
6933
  const mergedOptions = {
6934
6934
  platform,
6935
6935
  ...options
6936
6936
  };
6937
6937
  const platformWithCache = {
6938
6938
  ...mergedOptions.platform,
6939
- _c: cache3
6939
+ _c: cache4
6940
6940
  };
6941
6941
  return computePosition(reference2, floating, {
6942
6942
  ...mergedOptions,
@@ -9727,33 +9727,33 @@ var lights = {
9727
9727
  unlinked: ["negative", (owner) => `Unlinked from ${owner}`],
9728
9728
  failed: ["negative", (owner) => `Can\u2019t reach ${owner}`]
9729
9729
  };
9730
- function followLight(state3) {
9731
- const [variant, text2] = lights[state3.link];
9732
- return { variant, text: text2(state3.owner) };
9730
+ function followLight(state2) {
9731
+ const [variant, text2] = lights[state2.link];
9732
+ return { variant, text: text2(state2.owner) };
9733
9733
  }
9734
- function followPage(state3) {
9735
- if (!state3) return null;
9736
- const { owner } = state3;
9737
- if (state3.link === "connecting")
9734
+ function followPage(state2) {
9735
+ if (!state2) return null;
9736
+ const { owner } = state2;
9737
+ if (state2.link === "connecting")
9738
9738
  return {
9739
9739
  kind: "connecting",
9740
9740
  title: `Connecting to ${owner}\u2026`,
9741
9741
  body: `This device follows ${owner}. Its agent shows here once it\u2019s connected.`
9742
9742
  };
9743
- if (state3.link === "unlinked")
9743
+ if (state2.link === "unlinked")
9744
9744
  return {
9745
9745
  kind: "unlinked",
9746
9746
  title: `${owner} unlinked this device`,
9747
9747
  body: `To follow it again, open a new link from ${owner}.`
9748
9748
  };
9749
- if (state3.link === "failed")
9749
+ if (state2.link === "failed")
9750
9750
  return {
9751
9751
  kind: "failed",
9752
9752
  title: `Can\u2019t follow ${owner}`,
9753
- body: state3.error ?? `The link to ${owner} failed.`
9753
+ body: state2.error ?? `The link to ${owner} failed.`
9754
9754
  };
9755
- if (state3.access.view) return null;
9756
- const where2 = state3.name ? `next to ${state3.name}` : "for this device";
9755
+ if (state2.access.view) return null;
9756
+ const where2 = state2.name ? `next to ${state2.name}` : "for this device";
9757
9757
  return {
9758
9758
  kind: "waiting",
9759
9759
  title: `Waiting for ${owner} to allow this device`,
@@ -9764,26 +9764,26 @@ function list(items, last) {
9764
9764
  if (items.length < 2) return items.join("");
9765
9765
  return `${items.slice(0, -1).join(", ")} ${last} ${items.at(-1)}`;
9766
9766
  }
9767
- function followCan(state3) {
9767
+ function followCan(state2) {
9768
9768
  const allowed = ["watch the agent"];
9769
9769
  const missing = [];
9770
- (state3.access.control ? allowed : missing).push("send prompts");
9771
- (state3.access.terminal ? allowed : missing).push("open terminals");
9770
+ (state2.access.control ? allowed : missing).push("send prompts");
9771
+ (state2.access.terminal ? allowed : missing).push("open terminals");
9772
9772
  const can = `This device can ${list(allowed, "and")}.`;
9773
- return missing.length ? `${can} To ${list(missing, "or")}, allow it on ${state3.owner}.` : can;
9773
+ return missing.length ? `${can} To ${list(missing, "or")}, allow it on ${state2.owner}.` : can;
9774
9774
  }
9775
9775
  function following(model) {
9776
- const state3 = model?.follow?.state();
9777
- return state3 && !followPage(state3) ? state3 : null;
9776
+ const state2 = model?.follow?.state();
9777
+ return state2 && !followPage(state2) ? state2 : null;
9778
9778
  }
9779
9779
  function watchOnly(model) {
9780
- const state3 = following(model);
9781
- if (!state3 || state3.access.control) return "";
9782
- return `Watch only. To send prompts from this device, allow Control for it on ${state3.owner}.`;
9780
+ const state2 = following(model);
9781
+ if (!state2 || state2.access.control) return "";
9782
+ return `Watch only. To send prompts from this device, allow Control for it on ${state2.owner}.`;
9783
9783
  }
9784
9784
  function terminalsAllowed(model) {
9785
- const state3 = model?.follow?.state();
9786
- return !state3 || !!state3.access.terminal;
9785
+ const state2 = model?.follow?.state();
9786
+ return !state2 || !!state2.access.terminal;
9787
9787
  }
9788
9788
  var SliccFollow = class extends ModelElement {
9789
9789
  static properties = {
@@ -9879,11 +9879,11 @@ var SliccFollow = class extends ModelElement {
9879
9879
  async leave() {
9880
9880
  const port = this.model?.follow;
9881
9881
  if (!port || this.busy) return;
9882
- const state3 = port.state();
9883
- if (state3.link !== "unlinked") {
9882
+ const state2 = port.state();
9883
+ if (state2.link !== "unlinked") {
9884
9884
  const ok2 = await confirm({
9885
- title: `Stop following ${state3.owner}?`,
9886
- body: `This device forgets the link. To follow ${state3.owner} again, open a new link from it.`,
9885
+ title: `Stop following ${state2.owner}?`,
9886
+ body: `This device forgets the link. To follow ${state2.owner} again, open a new link from it.`,
9887
9887
  action: "Leave",
9888
9888
  variant: "confirmation"
9889
9889
  });
@@ -9926,12 +9926,12 @@ var SliccFollow = class extends ModelElement {
9926
9926
  </div>`;
9927
9927
  }
9928
9928
  render() {
9929
- const state3 = this.model?.follow?.state();
9930
- if (!state3) return A;
9931
- const page = followPage(state3);
9929
+ const state2 = this.model?.follow?.state();
9930
+ if (!state2) return A;
9931
+ const page = followPage(state2);
9932
9932
  if (this.page) return page ? this.#page(page) : A;
9933
- const light = followLight(state3);
9934
- return b`<swc-action-button id="chip" class="chip" size="s" quiet data-follow=${state3.link} accessible-label=${light.text}>
9933
+ const light = followLight(state2);
9934
+ return b`<swc-action-button id="chip" class="chip" size="s" quiet data-follow=${state2.link} accessible-label=${light.text}>
9935
9935
  ${this.compact ? b`<swc-icon-user-following slot="icon" size="s" aria-hidden="true"></swc-icon-user-following>` : A}
9936
9936
  <swc-status-light size="s" variant=${light.variant}><span class="text">${light.text}</span></swc-status-light>
9937
9937
  </swc-action-button>
@@ -9939,8 +9939,8 @@ var SliccFollow = class extends ModelElement {
9939
9939
  <swc-popover for="chip" placement="bottom-end" accessible-label=${light.text}>
9940
9940
  <div class="panel">
9941
9941
  <h2>${light.text}</h2>
9942
- ${state3.link === "reconnecting" ? b`<p class="muted" data-reconnecting>The link to ${state3.owner} dropped. The conversation may be out of date until it’s back${state3.access.control ? ", and sending waits until then" : ""}.</p>` : A}
9943
- <p data-can>${followCan(state3)}</p>
9942
+ ${state2.link === "reconnecting" ? b`<p class="muted" data-reconnecting>The link to ${state2.owner} dropped. The conversation may be out of date until it’s back${state2.access.control ? ", and sending waits until then" : ""}.</p>` : A}
9943
+ <p data-can>${followCan(state2)}</p>
9944
9944
  ${this.#error()}
9945
9945
  <div class="actions">${this.#leaveButton()}</div>
9946
9946
  </div>
@@ -10991,6 +10991,7 @@ var SliccMonitor = class extends ModelElement {
10991
10991
  flex: none;
10992
10992
  }
10993
10993
  .body {
10994
+ container: monitor / inline-size;
10994
10995
  flex: 1;
10995
10996
  min-height: 0;
10996
10997
  overflow-y: auto;
@@ -11005,10 +11006,65 @@ var SliccMonitor = class extends ModelElement {
11005
11006
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--swc-card-default-width-extra-small)), 1fr));
11006
11007
  gap: var(--swc-spacing-100);
11007
11008
  }
11009
+ @container monitor (min-width: 248px) {
11010
+ .vital:last-child:nth-child(2n + 1) {
11011
+ grid-column: 1 / -1;
11012
+ }
11013
+ }
11014
+ @container monitor (min-width: 376px) {
11015
+ .vital:last-child:nth-child(n) {
11016
+ grid-column: auto;
11017
+ }
11018
+ .vital:last-child:nth-child(3n + 1) {
11019
+ grid-column: 1 / -1;
11020
+ }
11021
+ }
11022
+ @container monitor (min-width: 504px) {
11023
+ .vital:last-child:nth-child(n) {
11024
+ grid-column: auto;
11025
+ }
11026
+ .vital:last-child:nth-child(4n + 1) {
11027
+ grid-column: 1 / -1;
11028
+ }
11029
+ }
11030
+ @container monitor (min-width: 632px) {
11031
+ .vital:last-child:nth-child(n) {
11032
+ grid-column: auto;
11033
+ }
11034
+ .vital:last-child:nth-child(5n + 1) {
11035
+ grid-column: 1 / -1;
11036
+ }
11037
+ }
11038
+ @container monitor (min-width: 760px) {
11039
+ .vital:last-child:nth-child(n) {
11040
+ grid-column: auto;
11041
+ }
11042
+ .vital:last-child:nth-child(6n + 1) {
11043
+ grid-column: 1 / -1;
11044
+ }
11045
+ }
11046
+ @container monitor (min-width: 888px) {
11047
+ .vital:last-child:nth-child(n) {
11048
+ grid-column: auto;
11049
+ }
11050
+ .vital:last-child:nth-child(7n + 1) {
11051
+ grid-column: 1 / -1;
11052
+ }
11053
+ }
11054
+ @container monitor (min-width: 1016px) {
11055
+ .vital:last-child:nth-child(n) {
11056
+ grid-column: auto;
11057
+ }
11058
+ .vital:last-child:nth-child(8n + 1) {
11059
+ grid-column: 1 / -1;
11060
+ }
11061
+ }
11008
11062
  .vital {
11009
11063
  display: grid;
11064
+ grid-template-rows: auto auto 1fr;
11010
11065
  align-content: start;
11011
11066
  gap: var(--swc-spacing-50);
11067
+ min-width: 0;
11012
11068
  border-radius: var(--swc-corner-radius-medium-default);
11013
11069
  padding: var(--swc-spacing-200);
11014
11070
  background: var(--swc-background-layer-1-color);
@@ -11017,20 +11073,41 @@ var SliccMonitor = class extends ModelElement {
11017
11073
  color: var(--swc-neutral-subdued-content-color-default);
11018
11074
  font-size: var(--swc-font-size-75);
11019
11075
  }
11076
+ .reading {
11077
+ display: flex;
11078
+ align-items: baseline;
11079
+ gap: var(--swc-spacing-75);
11080
+ min-width: 0;
11081
+ white-space: nowrap;
11082
+ }
11083
+ .value,
11084
+ .rest {
11085
+ min-width: 0;
11086
+ overflow: hidden;
11087
+ text-overflow: ellipsis;
11088
+ }
11020
11089
  .value {
11090
+ flex: none;
11091
+ max-width: 100%;
11021
11092
  font-size: var(--swc-font-size-300);
11022
11093
  font-weight: var(--swc-bold-font-weight);
11023
11094
  font-variant-numeric: tabular-nums;
11024
11095
  }
11025
- .unit,
11026
- .delta {
11096
+ .rest {
11097
+ flex: 0 1 auto;
11027
11098
  color: var(--swc-neutral-subdued-content-color-default);
11099
+ }
11100
+ .unit + .delta {
11028
11101
  margin-inline-start: var(--swc-spacing-75);
11029
11102
  }
11103
+ .spark {
11104
+ align-self: end;
11105
+ height: var(--swc-component-height-100);
11106
+ }
11030
11107
  svg {
11031
11108
  display: block;
11032
11109
  width: 100%;
11033
- height: var(--swc-component-height-100);
11110
+ height: 100%;
11034
11111
  }
11035
11112
  polyline {
11036
11113
  fill: none;
@@ -11040,6 +11117,13 @@ var SliccMonitor = class extends ModelElement {
11040
11117
  swc-meter {
11041
11118
  width: 100%;
11042
11119
  }
11120
+ swc-meter > span {
11121
+ display: block;
11122
+ min-width: 0;
11123
+ overflow: hidden;
11124
+ white-space: nowrap;
11125
+ text-overflow: ellipsis;
11126
+ }
11043
11127
  .alerts {
11044
11128
  display: grid;
11045
11129
  gap: var(--swc-spacing-75);
@@ -11101,25 +11185,34 @@ var SliccMonitor = class extends ModelElement {
11101
11185
  }
11102
11186
  .sections {
11103
11187
  display: grid;
11188
+ grid-template-columns: minmax(0, 1fr) auto auto;
11189
+ column-gap: var(--swc-spacing-100);
11104
11190
  margin: 0;
11105
11191
  padding: 0;
11106
11192
  list-style: none;
11107
11193
  }
11108
- .section {
11194
+ .section,
11195
+ .line {
11196
+ grid-column: 1 / -1;
11109
11197
  display: grid;
11198
+ grid-template-columns: subgrid;
11110
11199
  }
11111
11200
  .line {
11112
- display: flex;
11113
- flex-wrap: wrap;
11114
11201
  align-items: center;
11115
- gap: var(--swc-spacing-100);
11116
11202
  min-height: var(--swc-component-height-100);
11117
11203
  padding: var(--swc-spacing-50) 0;
11118
11204
  }
11205
+ .caption {
11206
+ grid-column: 1;
11207
+ min-width: 0;
11208
+ display: flex;
11209
+ flex-wrap: wrap;
11210
+ align-items: center;
11211
+ gap: var(--swc-spacing-50) var(--swc-spacing-75);
11212
+ }
11119
11213
  .toggle {
11120
11214
  all: unset;
11121
11215
  box-sizing: border-box;
11122
- flex: 1 1 auto;
11123
11216
  min-width: 0;
11124
11217
  display: flex;
11125
11218
  align-items: center;
@@ -11145,14 +11238,19 @@ var SliccMonitor = class extends ModelElement {
11145
11238
  transform: scaleX(-1);
11146
11239
  }
11147
11240
  .line .name {
11148
- flex: 1 1 auto;
11149
11241
  min-width: 0;
11150
11242
  }
11151
11243
  .line .num {
11244
+ grid-column: 2;
11245
+ justify-self: end;
11152
11246
  font-weight: var(--swc-bold-font-weight);
11153
11247
  font-variant-numeric: tabular-nums;
11154
11248
  }
11249
+ .line swc-action-button {
11250
+ grid-column: 3;
11251
+ }
11155
11252
  .rows {
11253
+ grid-column: 1 / -1;
11156
11254
  display: grid;
11157
11255
  gap: var(--swc-spacing-50);
11158
11256
  margin: 0 0 var(--swc-spacing-100);
@@ -11208,15 +11306,15 @@ var SliccMonitor = class extends ModelElement {
11208
11306
  variant=${meterVariant2(vital.ratio)}
11209
11307
  value=${Math.round(vital.ratio * 100)}
11210
11308
  value-label=${vital.value}
11211
- ><span slot="label">${vital.label}</span>${vital.unit ? b`<span slot="description">${vital.unit}</span>` : A}</swc-meter
11309
+ ><span slot="label">${vital.label}</span><span slot="description">${vital.unit ?? "\xA0"}</span></swc-meter
11212
11310
  >
11213
11311
  </div>`;
11214
11312
  }
11215
11313
  const line = vital.series ? sparkline(vital.series) : "";
11216
11314
  return b`<div class="vital" data-id=${vital.id}>
11217
11315
  <div class="label">${vital.label}</div>
11218
- <div><span class="value">${vital.value}</span>${vital.unit ? b`<span class="unit">${vital.unit}</span>` : A}${vital.delta ? b`<span class="delta">${vital.delta}</span>` : A}</div>
11219
- ${line ? b`<svg viewBox="0 0 120 28" preserveAspectRatio="none" aria-hidden="true">${w`<polyline points=${line}></polyline>`}</svg>` : A}
11316
+ <div class="reading"><span class="value">${vital.value}</span>${vital.unit || vital.delta ? b`<span class="rest">${vital.unit ? b`<span class="unit">${vital.unit}</span>` : A}${vital.delta ? b`<span class="delta">${vital.delta}</span>` : A}</span>` : A}</div>
11317
+ <div class="spark">${line ? b`<svg viewBox="0 0 120 28" preserveAspectRatio="none" aria-hidden="true">${w`<polyline points=${line}></polyline>`}</svg>` : A}</div>
11220
11318
  </div>`;
11221
11319
  }
11222
11320
  #alert(alert) {
@@ -11252,12 +11350,12 @@ var SliccMonitor = class extends ModelElement {
11252
11350
  const rows = section.rows.length > 0;
11253
11351
  const open = rows && (this.expanded[section.id] ?? flag !== null);
11254
11352
  const list5 = `rows-${section.id}`;
11353
+ const badge = flag ? b`<swc-badge size="s" variant=${flag.variant} subtle>${flag.text}</swc-badge>` : A;
11255
11354
  return b`<li class="section" data-id=${section.id} data-open=${open ? "" : A}>
11256
11355
  <div class="line">
11257
- ${rows ? b`<button class="toggle" aria-expanded=${open ? "true" : "false"} aria-controls=${open ? list5 : A} @click=${() => {
11356
+ <span class="caption">${rows ? b`<button class="toggle" aria-expanded=${open ? "true" : "false"} aria-controls=${open ? list5 : A} @click=${() => {
11258
11357
  this.expanded = { ...this.expanded, [section.id]: !open };
11259
- }}><span class="chevron"><swc-icon-chevron-right size="s" aria-hidden="true"></swc-icon-chevron-right></span><span class="name">${section.label}</span></button>` : b`<span class="chevron"></span><span class="name">${section.label}</span>`}
11260
- ${flag ? b`<swc-badge size="s" variant=${flag.variant} subtle>${flag.text}</swc-badge>` : A}
11358
+ }}><span class="chevron"><swc-icon-chevron-right size="s" aria-hidden="true"></swc-icon-chevron-right></span><span class="name">${section.label}</span></button>` : b`<span class="chevron"></span><span class="name">${section.label}</span>`}${badge}</span>
11261
11359
  <span class="num">${section.rows.length}</span>
11262
11360
  ${surface2 ? b`<swc-action-button size="s" quiet accessible-label=${`Open ${section.label}`} @click=${() => this.#open(surface2)}
11263
11361
  >Open</swc-action-button
@@ -11783,8 +11881,8 @@ function fallbackModel(options) {
11783
11881
  return offered.find((option2) => option2.default) ?? offered[0];
11784
11882
  }
11785
11883
  function controls(model) {
11786
- const state3 = model.follow?.state();
11787
- return !state3 || !!state3.access.control && state3.link === "connected";
11884
+ const state2 = model.follow?.state();
11885
+ return !state2 || !!state2.access.control && state2.link === "connected";
11788
11886
  }
11789
11887
  function settleModels(model) {
11790
11888
  if (settling.has(model) || !controls(model)) return;
@@ -12203,8 +12301,8 @@ var QrCode = class {
12203
12301
  for (let vert = 0; vert < this.size; vert++) {
12204
12302
  for (let j5 = 0; j5 < 2; j5++) {
12205
12303
  const x7 = right - j5;
12206
- const upward = (right + 1 & 2) === 0;
12207
- const y10 = upward ? this.size - 1 - vert : vert;
12304
+ const upward2 = (right + 1 & 2) === 0;
12305
+ const y10 = upward2 ? this.size - 1 - vert : vert;
12208
12306
  if (!this.types[y10][x7] && i26 < data.length * 8) {
12209
12307
  this.modules[y10][x7] = getBit(data[i26 >>> 3], 7 - (i26 & 7));
12210
12308
  i26++;
@@ -14665,23 +14763,23 @@ function installProperties(document2, text2 = swc_default) {
14665
14763
  var following2 = "SLICC runs in another tab. This tab shows it and sends your actions there.";
14666
14764
  var connecting = "Connecting to the tab running SLICC\u2026";
14667
14765
  var alone = "SLICC is open in another tab.";
14668
- function tabsBanner(state3) {
14669
- if (!state3 || state3.role === "alone") return null;
14670
- if (state3.skew === "newer")
14766
+ function tabsBanner(state2) {
14767
+ if (!state2 || state2.role === "alone") return null;
14768
+ if (state2.skew === "newer")
14671
14769
  return {
14672
14770
  kind: "skew",
14673
14771
  skew: "newer",
14674
14772
  text: "Another tab runs a newer SLICC. Reload this tab.",
14675
14773
  reload: true
14676
14774
  };
14677
- if (state3.skew === "older")
14775
+ if (state2.skew === "older")
14678
14776
  return {
14679
14777
  kind: "skew",
14680
14778
  skew: "older",
14681
14779
  text: "Another tab runs an older SLICC. Reload the other SLICC tab.",
14682
14780
  reload: false
14683
14781
  };
14684
- if (state3.stalled)
14782
+ if (state2.stalled)
14685
14783
  return {
14686
14784
  kind: "stalled",
14687
14785
  skew: null,
@@ -14690,11 +14788,11 @@ function tabsBanner(state3) {
14690
14788
  };
14691
14789
  return null;
14692
14790
  }
14693
- function tabsLight(state3) {
14694
- if (!state3 || state3.role === "owner" || state3.role === "alone") return null;
14695
- const banner = tabsBanner(state3);
14791
+ function tabsLight(state2) {
14792
+ if (!state2 || state2.role === "owner" || state2.role === "alone") return null;
14793
+ const banner = tabsBanner(state2);
14696
14794
  if (banner) return { variant: "notice", text: "Another tab", tooltip: banner.text };
14697
- if (state3.role === "connecting")
14795
+ if (state2.role === "connecting")
14698
14796
  return { variant: "info", text: "Connecting", tooltip: connecting };
14699
14797
  return { variant: "neutral", text: "Another tab", tooltip: following2 };
14700
14798
  }
@@ -21800,12 +21898,12 @@ function comparePreparedEntries(left, right) {
21800
21898
  function comparePreparedPaths(left, right) {
21801
21899
  return comparePreparedEntries(left, right);
21802
21900
  }
21803
- function comparePreparedPathsWithCachedSortKeys(left, right, cache3) {
21901
+ function comparePreparedPathsWithCachedSortKeys(left, right, cache4) {
21804
21902
  const getCachedSortKey = (value) => {
21805
- const existingKey = cache3.get(value);
21903
+ const existingKey = cache4.get(value);
21806
21904
  if (existingKey != null) return existingKey;
21807
21905
  const nextKey = createSegmentSortKey(value);
21808
- cache3.set(value, nextKey);
21906
+ cache4.set(value, nextKey);
21809
21907
  return nextKey;
21810
21908
  };
21811
21909
  const sharedDepth = Math.min(left.segments.length, right.segments.length);
@@ -22505,40 +22603,40 @@ function resolveInitialExpansion(initialExpansion) {
22505
22603
  if (!Number.isInteger(initialExpansion) || initialExpansion < 0) throw new Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(initialExpansion)}`);
22506
22604
  return initialExpansion;
22507
22605
  }
22508
- function isDirectoryExpandedByDefault(state3, node) {
22606
+ function isDirectoryExpandedByDefault(state2, node) {
22509
22607
  if (hasNodeFlag(node, 2)) return true;
22510
- if (state3.defaultExpansion === "open") return true;
22511
- if (state3.defaultExpansion === "closed") return false;
22512
- return getNodeDepth(node) <= state3.defaultExpansion;
22608
+ if (state2.defaultExpansion === "open") return true;
22609
+ if (state2.defaultExpansion === "closed") return false;
22610
+ return getNodeDepth(node) <= state2.defaultExpansion;
22513
22611
  }
22514
- function isDirectoryExpanded(state3, nodeId, node = state3.snapshot.nodes[nodeId]) {
22612
+ function isDirectoryExpanded(state2, nodeId, node = state2.snapshot.nodes[nodeId]) {
22515
22613
  if (node == null || !isDirectoryNode(node)) return false;
22516
- if (state3.directoriesOpenByDefault && !state3.hasCollapsedDirectoryOverrides) return true;
22517
- if (state3.collapsedDirectoryIds.has(nodeId)) return false;
22518
- if (state3.expandedDirectoryIds.has(nodeId)) return true;
22519
- return isDirectoryExpandedByDefault(state3, node);
22614
+ if (state2.directoriesOpenByDefault && !state2.hasCollapsedDirectoryOverrides) return true;
22615
+ if (state2.collapsedDirectoryIds.has(nodeId)) return false;
22616
+ if (state2.expandedDirectoryIds.has(nodeId)) return true;
22617
+ return isDirectoryExpandedByDefault(state2, node);
22520
22618
  }
22521
- function setDirectoryExpanded(state3, nodeId, expanded, node = state3.snapshot.nodes[nodeId]) {
22619
+ function setDirectoryExpanded(state2, nodeId, expanded, node = state2.snapshot.nodes[nodeId]) {
22522
22620
  if (node == null || !isDirectoryNode(node)) return;
22523
- const expandedByDefault = isDirectoryExpandedByDefault(state3, node);
22621
+ const expandedByDefault = isDirectoryExpandedByDefault(state2, node);
22524
22622
  if (expanded) {
22525
22623
  if (expandedByDefault) {
22526
- state3.collapsedDirectoryIds.delete(nodeId);
22527
- state3.hasCollapsedDirectoryOverrides = state3.collapsedDirectoryIds.size > 0;
22624
+ state2.collapsedDirectoryIds.delete(nodeId);
22625
+ state2.hasCollapsedDirectoryOverrides = state2.collapsedDirectoryIds.size > 0;
22528
22626
  return;
22529
22627
  }
22530
- state3.expandedDirectoryIds.add(nodeId);
22628
+ state2.expandedDirectoryIds.add(nodeId);
22531
22629
  return;
22532
22630
  }
22533
22631
  if (expandedByDefault) {
22534
- state3.collapsedDirectoryIds.add(nodeId);
22535
- state3.hasCollapsedDirectoryOverrides = true;
22632
+ state2.collapsedDirectoryIds.add(nodeId);
22633
+ state2.hasCollapsedDirectoryOverrides = true;
22536
22634
  return;
22537
22635
  }
22538
- state3.expandedDirectoryIds.delete(nodeId);
22636
+ state2.expandedDirectoryIds.delete(nodeId);
22539
22637
  }
22540
- function getOrCreateDirectoryLoadInfo(state3, nodeId) {
22541
- const existingInfo = state3.directoryLoadInfoById.get(nodeId);
22638
+ function getOrCreateDirectoryLoadInfo(state2, nodeId) {
22639
+ const existingInfo = state2.directoryLoadInfoById.get(nodeId);
22542
22640
  if (existingInfo != null) return existingInfo;
22543
22641
  const nextInfo = {
22544
22642
  activeAttemptId: null,
@@ -22546,14 +22644,14 @@ function getOrCreateDirectoryLoadInfo(state3, nodeId) {
22546
22644
  nextAttemptId: 1,
22547
22645
  state: "loaded"
22548
22646
  };
22549
- state3.directoryLoadInfoById.set(nodeId, nextInfo);
22647
+ state2.directoryLoadInfoById.set(nodeId, nextInfo);
22550
22648
  return nextInfo;
22551
22649
  }
22552
- function getDirectoryLoadState(state3, nodeId) {
22553
- return state3.directoryLoadInfoById.get(nodeId)?.state ?? "loaded";
22650
+ function getDirectoryLoadState(state2, nodeId) {
22651
+ return state2.directoryLoadInfoById.get(nodeId)?.state ?? "loaded";
22554
22652
  }
22555
- function beginDirectoryLoad(state3, nodeId) {
22556
- const loadInfo = getOrCreateDirectoryLoadInfo(state3, nodeId);
22653
+ function beginDirectoryLoad(state2, nodeId) {
22654
+ const loadInfo = getOrCreateDirectoryLoadInfo(state2, nodeId);
22557
22655
  if (loadInfo.state === "loading" && loadInfo.activeAttemptId != null) return {
22558
22656
  attemptId: loadInfo.activeAttemptId,
22559
22657
  nodeId,
@@ -22570,46 +22668,46 @@ function beginDirectoryLoad(state3, nodeId) {
22570
22668
  reused: false
22571
22669
  };
22572
22670
  }
22573
- function markDirectoryUnloadedState(state3, nodeId) {
22574
- const loadInfo = getOrCreateDirectoryLoadInfo(state3, nodeId);
22671
+ function markDirectoryUnloadedState(state2, nodeId) {
22672
+ const loadInfo = getOrCreateDirectoryLoadInfo(state2, nodeId);
22575
22673
  loadInfo.activeAttemptId = null;
22576
22674
  loadInfo.errorMessage = null;
22577
22675
  loadInfo.state = "unloaded";
22578
22676
  }
22579
- function completeDirectoryLoad(state3, nodeId, attemptId) {
22580
- const loadInfo = state3.directoryLoadInfoById.get(nodeId);
22677
+ function completeDirectoryLoad(state2, nodeId, attemptId) {
22678
+ const loadInfo = state2.directoryLoadInfoById.get(nodeId);
22581
22679
  if (loadInfo == null || loadInfo.activeAttemptId !== attemptId) return false;
22582
22680
  loadInfo.activeAttemptId = null;
22583
22681
  loadInfo.errorMessage = null;
22584
22682
  loadInfo.state = "loaded";
22585
22683
  return true;
22586
22684
  }
22587
- function isDirectoryLoadAttemptCurrent(state3, nodeId, attemptId) {
22588
- return state3.directoryLoadInfoById.get(nodeId)?.activeAttemptId === attemptId;
22685
+ function isDirectoryLoadAttemptCurrent(state2, nodeId, attemptId) {
22686
+ return state2.directoryLoadInfoById.get(nodeId)?.activeAttemptId === attemptId;
22589
22687
  }
22590
- function failDirectoryLoad(state3, nodeId, attemptId, errorMessage) {
22591
- const loadInfo = state3.directoryLoadInfoById.get(nodeId);
22688
+ function failDirectoryLoad(state2, nodeId, attemptId, errorMessage) {
22689
+ const loadInfo = state2.directoryLoadInfoById.get(nodeId);
22592
22690
  if (loadInfo == null || loadInfo.activeAttemptId !== attemptId) return false;
22593
22691
  loadInfo.activeAttemptId = null;
22594
22692
  loadInfo.errorMessage = errorMessage ?? null;
22595
22693
  loadInfo.state = "error";
22596
22694
  return true;
22597
22695
  }
22598
- function clearDirectoryLoadInfo(state3, nodeId) {
22599
- state3.directoryLoadInfoById.delete(nodeId);
22696
+ function clearDirectoryLoadInfo(state2, nodeId) {
22697
+ state2.directoryLoadInfoById.delete(nodeId);
22600
22698
  }
22601
22699
 
22602
22700
  // node_modules/@pierre/trees/dist/path-store/src/events.js
22603
- function subscribe(state3, type, handler) {
22701
+ function subscribe(state2, type, handler) {
22604
22702
  const rawHandler = handler;
22605
- const existingListeners = state3.listeners.get(type);
22703
+ const existingListeners = state2.listeners.get(type);
22606
22704
  if (existingListeners != null) existingListeners.add(rawHandler);
22607
- else state3.listeners.set(type, /* @__PURE__ */ new Set([rawHandler]));
22705
+ else state2.listeners.set(type, /* @__PURE__ */ new Set([rawHandler]));
22608
22706
  return () => {
22609
- const listeners = state3.listeners.get(type);
22707
+ const listeners = state2.listeners.get(type);
22610
22708
  if (listeners == null) return;
22611
22709
  listeners.delete(rawHandler);
22612
- if (listeners.size === 0) state3.listeners.delete(type);
22710
+ if (listeners.size === 0) state2.listeners.delete(type);
22613
22711
  };
22614
22712
  }
22615
22713
  function createAddEvent(args2) {
@@ -22759,58 +22857,58 @@ function createCleanupEvent(args2) {
22759
22857
  visibleCountDelta: null
22760
22858
  };
22761
22859
  }
22762
- function finalizeEvent(state3, previousVisibleCount, event2) {
22860
+ function finalizeEvent(state2, previousVisibleCount, event2) {
22763
22861
  return {
22764
22862
  ...event2,
22765
- visibleCountDelta: getCurrentVisibleCount(state3) - previousVisibleCount
22863
+ visibleCountDelta: getCurrentVisibleCount(state2) - previousVisibleCount
22766
22864
  };
22767
22865
  }
22768
- function batchEvents(state3, run2) {
22769
- const previousVisibleCount = getCurrentVisibleCount(state3);
22866
+ function batchEvents(state2, run2) {
22867
+ const previousVisibleCount = getCurrentVisibleCount(state2);
22770
22868
  const frame = createTransactionFrame();
22771
- state3.transactionStack.push(frame);
22869
+ state2.transactionStack.push(frame);
22772
22870
  try {
22773
22871
  run2();
22774
22872
  } catch (error) {
22775
- finishTransaction(state3, frame, false);
22873
+ finishTransaction(state2, frame, false);
22776
22874
  throw error;
22777
22875
  }
22778
- finishTransaction(state3, frame, true, getCurrentVisibleCount(state3) - previousVisibleCount);
22876
+ finishTransaction(state2, frame, true, getCurrentVisibleCount(state2) - previousVisibleCount);
22779
22877
  }
22780
- function recordEvent(state3, event2) {
22781
- const instrumentation = state3.instrumentation;
22878
+ function recordEvent(state2, event2) {
22879
+ const instrumentation = state2.instrumentation;
22782
22880
  if (instrumentation == null) {
22783
- recordEventNow(state3, event2);
22881
+ recordEventNow(state2, event2);
22784
22882
  return;
22785
22883
  }
22786
- withBenchmarkPhase(instrumentation, "store.events.record", () => recordEventNow(state3, event2));
22884
+ withBenchmarkPhase(instrumentation, "store.events.record", () => recordEventNow(state2, event2));
22787
22885
  }
22788
- function recordEventNow(state3, event2) {
22789
- const currentFrame = state3.transactionStack[state3.transactionStack.length - 1] ?? null;
22886
+ function recordEventNow(state2, event2) {
22887
+ const currentFrame = state2.transactionStack[state2.transactionStack.length - 1] ?? null;
22790
22888
  if (currentFrame == null) {
22791
- emitEvent(state3, event2);
22889
+ emitEvent(state2, event2);
22792
22890
  return;
22793
22891
  }
22794
22892
  currentFrame.events.push(event2);
22795
22893
  mergeEventMetadataIntoFrame(currentFrame, event2);
22796
22894
  }
22797
- function finishTransaction(state3, frame, emit, visibleCountDelta = null) {
22798
- if (state3.transactionStack.pop() !== frame) throw new Error("Transaction stack underflow");
22895
+ function finishTransaction(state2, frame, emit, visibleCountDelta = null) {
22896
+ if (state2.transactionStack.pop() !== frame) throw new Error("Transaction stack underflow");
22799
22897
  if (!emit) return;
22800
- const parentFrame = state3.transactionStack[state3.transactionStack.length - 1] ?? null;
22898
+ const parentFrame = state2.transactionStack[state2.transactionStack.length - 1] ?? null;
22801
22899
  if (parentFrame != null) {
22802
- const instrumentation2 = state3.instrumentation;
22900
+ const instrumentation2 = state2.instrumentation;
22803
22901
  if (instrumentation2 == null) mergeBatchFrameIntoParent(parentFrame, frame);
22804
22902
  else withBenchmarkPhase(instrumentation2, "store.events.batch.merge", () => mergeBatchFrameIntoParent(parentFrame, frame));
22805
22903
  return;
22806
22904
  }
22807
22905
  const batchEvent = createBatchEvent(frame, visibleCountDelta);
22808
- const instrumentation = state3.instrumentation;
22906
+ const instrumentation = state2.instrumentation;
22809
22907
  if (instrumentation == null) {
22810
- emitEvent(state3, batchEvent);
22908
+ emitEvent(state2, batchEvent);
22811
22909
  return;
22812
22910
  }
22813
- withBenchmarkPhase(instrumentation, "store.events.batch.commit", () => emitEvent(state3, batchEvent));
22911
+ withBenchmarkPhase(instrumentation, "store.events.batch.commit", () => emitEvent(state2, batchEvent));
22814
22912
  }
22815
22913
  function createBatchEvent(frame, visibleCountDelta) {
22816
22914
  return {
@@ -22835,48 +22933,48 @@ function mergeEventMetadataIntoFrame(frame, event2) {
22835
22933
  for (const nodeId of event2.affectedNodeIds) frame.affectedNodeIds.add(nodeId);
22836
22934
  for (const nodeId of event2.affectedAncestorIds) frame.affectedAncestorIds.add(nodeId);
22837
22935
  }
22838
- function emitEvent(state3, event2) {
22839
- const instrumentation = state3.instrumentation;
22936
+ function emitEvent(state2, event2) {
22937
+ const instrumentation = state2.instrumentation;
22840
22938
  if (instrumentation == null) {
22841
- emitEventNow(state3, event2);
22939
+ emitEventNow(state2, event2);
22842
22940
  return;
22843
22941
  }
22844
- withBenchmarkPhase(instrumentation, "store.events.emit", () => emitEventNow(state3, event2));
22942
+ withBenchmarkPhase(instrumentation, "store.events.emit", () => emitEventNow(state2, event2));
22845
22943
  }
22846
- function emitEventNow(state3, event2) {
22847
- state3.listeners.get(event2.operation)?.forEach((handler) => handler(event2));
22848
- state3.listeners.get("*")?.forEach((handler) => handler(event2));
22944
+ function emitEventNow(state2, event2) {
22945
+ state2.listeners.get(event2.operation)?.forEach((handler) => handler(event2));
22946
+ state2.listeners.get("*")?.forEach((handler) => handler(event2));
22849
22947
  }
22850
- function getCurrentVisibleCount(state3) {
22851
- return state3.snapshot.nodes[state3.snapshot.rootId]?.visibleSubtreeCount ?? 0;
22948
+ function getCurrentVisibleCount(state2) {
22949
+ return state2.snapshot.nodes[state2.snapshot.rootId]?.visibleSubtreeCount ?? 0;
22852
22950
  }
22853
22951
 
22854
22952
  // node_modules/@pierre/trees/dist/path-store/src/flatten.js
22855
- function getFlattenedChildDirectoryId(state3, directoryNodeId) {
22856
- if (state3.snapshot.options.flattenEmptyDirectories !== true) return null;
22857
- const directoryNode = state3.snapshot.nodes[directoryNodeId];
22953
+ function getFlattenedChildDirectoryId(state2, directoryNodeId) {
22954
+ if (state2.snapshot.options.flattenEmptyDirectories !== true) return null;
22955
+ const directoryNode = state2.snapshot.nodes[directoryNodeId];
22858
22956
  if (directoryNode == null || !isDirectoryNode(directoryNode) || hasNodeFlag(directoryNode, 2)) return null;
22859
- const directoryIndex = state3.snapshot.directories.get(directoryNodeId);
22957
+ const directoryIndex = state2.snapshot.directories.get(directoryNodeId);
22860
22958
  if (directoryIndex == null || directoryIndex.childIds.length !== 1) return null;
22861
22959
  const childId = directoryIndex.childIds[0];
22862
22960
  if (childId == null) return null;
22863
- const childNode = state3.snapshot.nodes[childId];
22961
+ const childNode = state2.snapshot.nodes[childId];
22864
22962
  if (childNode == null || !isDirectoryNode(childNode)) return null;
22865
22963
  return childId;
22866
22964
  }
22867
- function getFlattenedTerminalDirectoryId(state3, directoryNodeId) {
22965
+ function getFlattenedTerminalDirectoryId(state2, directoryNodeId) {
22868
22966
  let currentDirectoryId = directoryNodeId;
22869
22967
  while (true) {
22870
- const nextDirectoryId = getFlattenedChildDirectoryId(state3, currentDirectoryId);
22968
+ const nextDirectoryId = getFlattenedChildDirectoryId(state2, currentDirectoryId);
22871
22969
  if (nextDirectoryId == null) return currentDirectoryId;
22872
22970
  currentDirectoryId = nextDirectoryId;
22873
22971
  }
22874
22972
  }
22875
- function collectFlattenedDirectoryChainIds(state3, directoryNodeId) {
22973
+ function collectFlattenedDirectoryChainIds(state2, directoryNodeId) {
22876
22974
  const chainIds = [directoryNodeId];
22877
22975
  let currentDirectoryId = directoryNodeId;
22878
22976
  while (true) {
22879
- const nextDirectoryId = getFlattenedChildDirectoryId(state3, currentDirectoryId);
22977
+ const nextDirectoryId = getFlattenedChildDirectoryId(state2, currentDirectoryId);
22880
22978
  if (nextDirectoryId == null) return chainIds;
22881
22979
  chainIds.push(nextDirectoryId);
22882
22980
  currentDirectoryId = nextDirectoryId;
@@ -22884,144 +22982,144 @@ function collectFlattenedDirectoryChainIds(state3, directoryNodeId) {
22884
22982
  }
22885
22983
 
22886
22984
  // node_modules/@pierre/trees/dist/path-store/src/canonical.js
22887
- function listPaths(state3, path) {
22888
- const nodeId = path == null ? state3.snapshot.rootId : findNodeId(state3, path);
22985
+ function listPaths(state2, path) {
22986
+ const nodeId = path == null ? state2.snapshot.rootId : findNodeId(state2, path);
22889
22987
  if (nodeId == null) return [];
22890
- return collectCanonicalEntries(state3, nodeId);
22988
+ return collectCanonicalEntries(state2, nodeId);
22891
22989
  }
22892
- function addPath(state3, path) {
22990
+ function addPath(state2, path) {
22893
22991
  const preparedPath = parseInputPath(path);
22894
22992
  const parentSegments = preparedPath.isDirectory ? preparedPath.segments : preparedPath.segments.slice(0, -1);
22895
- const previousProjectionSignature = getCollapsedProjectionSignature(state3, findDeepestExistingDirectoryId(state3, parentSegments));
22896
- const { createdNodeIds, directoryId } = ensureDirectoryChain(state3, parentSegments);
22993
+ const previousProjectionSignature = getCollapsedProjectionSignature(state2, findDeepestExistingDirectoryId(state2, parentSegments));
22994
+ const { createdNodeIds, directoryId } = ensureDirectoryChain(state2, parentSegments);
22897
22995
  const affectedNodeIds = new Set(createdNodeIds);
22898
22996
  let addedNodeId = directoryId;
22899
22997
  if (preparedPath.isDirectory) {
22900
- const directoryNode = requireNode(state3, directoryId);
22998
+ const directoryNode = requireNode(state2, directoryId);
22901
22999
  if (hasNodeFlag(directoryNode, 1)) throw new Error(`Path already exists: "${path}"`);
22902
23000
  addNodeFlag(directoryNode, 1);
22903
- state3.pathCacheByNodeId.set(directoryId, {
23001
+ state2.pathCacheByNodeId.set(directoryId, {
22904
23002
  path,
22905
- version: state3.pathCacheVersion
23003
+ version: state2.pathCacheVersion
22906
23004
  });
22907
23005
  affectedNodeIds.add(directoryId);
22908
23006
  } else {
22909
- addedNodeId = createFileNode(state3, directoryId, preparedPath.basename);
23007
+ addedNodeId = createFileNode(state2, directoryId, preparedPath.basename);
22910
23008
  affectedNodeIds.add(addedNodeId);
22911
23009
  }
22912
- recomputeCountsUpwardFrom(state3, directoryId);
22913
- const nextProjectionSignature = getCollapsedProjectionSignature(state3, directoryId);
23010
+ recomputeCountsUpwardFrom(state2, directoryId);
23011
+ const nextProjectionSignature = getCollapsedProjectionSignature(state2, directoryId);
22914
23012
  return createAddEvent({
22915
- affectedAncestorIds: collectAncestorIds(state3, addedNodeId),
23013
+ affectedAncestorIds: collectAncestorIds(state2, addedNodeId),
22916
23014
  affectedNodeIds: [...affectedNodeIds],
22917
23015
  path,
22918
23016
  projectionChanged: didProjectionChange(previousProjectionSignature, nextProjectionSignature)
22919
23017
  });
22920
23018
  }
22921
- function removePath(state3, path, options) {
22922
- const nodeId = findNodeId(state3, path);
23019
+ function removePath(state2, path, options) {
23020
+ const nodeId = findNodeId(state2, path);
22923
23021
  if (nodeId == null) throw new Error(`Path does not exist: "${path}"`);
22924
- const node = requireNode(state3, nodeId);
23022
+ const node = requireNode(state2, nodeId);
22925
23023
  if (hasNodeFlag(node, 2)) throw new Error("The root node cannot be removed");
22926
- if (isDirectoryNode(node) && getDirectoryIndex(state3, nodeId).childIds.length > 0 && options.recursive !== true) throw new Error(`Cannot remove a non-empty directory without recursive: "${path}"`);
23024
+ if (isDirectoryNode(node) && getDirectoryIndex(state2, nodeId).childIds.length > 0 && options.recursive !== true) throw new Error(`Cannot remove a non-empty directory without recursive: "${path}"`);
22927
23025
  const parentId = node.parentId;
22928
- const previousProjectionSignature = getCollapsedProjectionSignature(state3, parentId);
22929
- const removedNodeIds = removeSubtree(state3, nodeId);
22930
- removeChildReference(state3, parentId, nodeId, node.nameId);
22931
- promoteEmptyAncestorsToExplicit(state3, parentId);
22932
- recomputeCountsUpwardFrom(state3, parentId);
22933
- const nextProjectionSignature = getCollapsedProjectionSignature(state3, parentId);
23026
+ const previousProjectionSignature = getCollapsedProjectionSignature(state2, parentId);
23027
+ const removedNodeIds = removeSubtree(state2, nodeId);
23028
+ removeChildReference(state2, parentId, nodeId, node.nameId);
23029
+ promoteEmptyAncestorsToExplicit(state2, parentId);
23030
+ recomputeCountsUpwardFrom(state2, parentId);
23031
+ const nextProjectionSignature = getCollapsedProjectionSignature(state2, parentId);
22934
23032
  return createRemoveEvent({
22935
- affectedAncestorIds: collectAncestorIds(state3, parentId),
23033
+ affectedAncestorIds: collectAncestorIds(state2, parentId),
22936
23034
  affectedNodeIds: removedNodeIds,
22937
23035
  path,
22938
23036
  projectionChanged: didProjectionChange(previousProjectionSignature, nextProjectionSignature),
22939
23037
  recursive: options.recursive === true
22940
23038
  });
22941
23039
  }
22942
- function movePath(state3, fromPath, toPath, options) {
22943
- const sourceNodeId = findNodeId(state3, fromPath);
23040
+ function movePath(state2, fromPath, toPath, options) {
23041
+ const sourceNodeId = findNodeId(state2, fromPath);
22944
23042
  if (sourceNodeId == null) throw new Error(`Source path does not exist: "${fromPath}"`);
22945
- const sourceNode = requireNode(state3, sourceNodeId);
23043
+ const sourceNode = requireNode(state2, sourceNodeId);
22946
23044
  if (hasNodeFlag(sourceNode, 2)) throw new Error("The root node cannot be moved");
22947
23045
  const collision = options.collision ?? "error";
22948
- const moveTarget = resolveMoveTarget(state3, sourceNodeId, toPath);
22949
- const previousSourceProjectionSignature = getCollapsedProjectionSignature(state3, sourceNode.parentId);
22950
- const previousTargetProjectionSignature = getCollapsedProjectionSignature(state3, moveTarget.parentId);
22951
- const sourceName = getSegmentValue(state3.snapshot.segmentTable, sourceNode.nameId);
22952
- const targetNameId = internSegment(state3.snapshot.segmentTable, moveTarget.basename);
23046
+ const moveTarget = resolveMoveTarget(state2, sourceNodeId, toPath);
23047
+ const previousSourceProjectionSignature = getCollapsedProjectionSignature(state2, sourceNode.parentId);
23048
+ const previousTargetProjectionSignature = getCollapsedProjectionSignature(state2, moveTarget.parentId);
23049
+ const sourceName = getSegmentValue(state2.snapshot.segmentTable, sourceNode.nameId);
23050
+ const targetNameId = internSegment(state2.snapshot.segmentTable, moveTarget.basename);
22953
23051
  if (moveTarget.parentId === sourceNode.parentId && sourceName === moveTarget.basename) return null;
22954
- if (isDirectoryNode(sourceNode) && isAncestor(state3, sourceNodeId, moveTarget.parentId)) throw new Error("Cannot move a directory into one of its descendants");
22955
- const siblingCollisionId = ensureChildIdByNameId(state3.snapshot.nodes, getDirectoryIndex(state3, moveTarget.parentId)).get(targetNameId);
23052
+ if (isDirectoryNode(sourceNode) && isAncestor(state2, sourceNodeId, moveTarget.parentId)) throw new Error("Cannot move a directory into one of its descendants");
23053
+ const siblingCollisionId = ensureChildIdByNameId(state2.snapshot.nodes, getDirectoryIndex(state2, moveTarget.parentId)).get(targetNameId);
22956
23054
  const collisionNodeId = moveTarget.existingNodeId ?? siblingCollisionId ?? null;
22957
23055
  if (collisionNodeId != null && collisionNodeId !== sourceNodeId) {
22958
- if (handleMoveCollision(state3, collisionNodeId, collision, getNodeKind(sourceNode)) === "skip") return null;
23056
+ if (handleMoveCollision(state2, collisionNodeId, collision, getNodeKind(sourceNode)) === "skip") return null;
22959
23057
  }
22960
23058
  const previousParentId = sourceNode.parentId;
22961
- removeChildReference(state3, previousParentId, sourceNodeId, sourceNode.nameId);
23059
+ removeChildReference(state2, previousParentId, sourceNodeId, sourceNode.nameId);
22962
23060
  sourceNode.parentId = moveTarget.parentId;
22963
23061
  sourceNode.nameId = targetNameId;
22964
- state3.pathCacheByNodeId.delete(sourceNodeId);
22965
- recomputeDepths(state3, sourceNodeId);
22966
- insertChildReference(state3, moveTarget.parentId, sourceNodeId);
22967
- promoteEmptyAncestorsToExplicit(state3, previousParentId);
22968
- state3.pathCacheVersion++;
22969
- recomputeCountsUpwardFrom(state3, previousParentId);
22970
- if (moveTarget.parentId !== previousParentId) recomputeCountsUpwardFrom(state3, moveTarget.parentId);
22971
- const nextSourceProjectionSignature = getCollapsedProjectionSignature(state3, previousParentId);
22972
- const nextTargetProjectionSignature = getCollapsedProjectionSignature(state3, moveTarget.parentId);
23062
+ state2.pathCacheByNodeId.delete(sourceNodeId);
23063
+ recomputeDepths(state2, sourceNodeId);
23064
+ insertChildReference(state2, moveTarget.parentId, sourceNodeId);
23065
+ promoteEmptyAncestorsToExplicit(state2, previousParentId);
23066
+ state2.pathCacheVersion++;
23067
+ recomputeCountsUpwardFrom(state2, previousParentId);
23068
+ if (moveTarget.parentId !== previousParentId) recomputeCountsUpwardFrom(state2, moveTarget.parentId);
23069
+ const nextSourceProjectionSignature = getCollapsedProjectionSignature(state2, previousParentId);
23070
+ const nextTargetProjectionSignature = getCollapsedProjectionSignature(state2, moveTarget.parentId);
22973
23071
  return createMoveEvent({
22974
- affectedAncestorIds: [.../* @__PURE__ */ new Set([...collectAncestorIds(state3, previousParentId), ...collectAncestorIds(state3, moveTarget.parentId)])],
23072
+ affectedAncestorIds: [.../* @__PURE__ */ new Set([...collectAncestorIds(state2, previousParentId), ...collectAncestorIds(state2, moveTarget.parentId)])],
22975
23073
  affectedNodeIds: [sourceNodeId],
22976
23074
  from: fromPath,
22977
23075
  projectionChanged: didAnyProjectionChange([previousSourceProjectionSignature, previousTargetProjectionSignature], [nextSourceProjectionSignature, nextTargetProjectionSignature]),
22978
- to: materializeNodePath(state3, sourceNodeId)
23076
+ to: materializeNodePath(state2, sourceNodeId)
22979
23077
  });
22980
23078
  }
22981
- function getCachedNodePath(state3, nodeId) {
22982
- const cachedEntry = state3.pathCacheByNodeId.get(nodeId);
22983
- return cachedEntry != null && cachedEntry.version === state3.pathCacheVersion ? cachedEntry.path : null;
23079
+ function getCachedNodePath(state2, nodeId) {
23080
+ const cachedEntry = state2.pathCacheByNodeId.get(nodeId);
23081
+ return cachedEntry != null && cachedEntry.version === state2.pathCacheVersion ? cachedEntry.path : null;
22984
23082
  }
22985
- function setCachedNodePath(state3, nodeId, path) {
22986
- state3.pathCacheByNodeId.set(nodeId, {
23083
+ function setCachedNodePath(state2, nodeId, path) {
23084
+ state2.pathCacheByNodeId.set(nodeId, {
22987
23085
  path,
22988
- version: state3.pathCacheVersion
23086
+ version: state2.pathCacheVersion
22989
23087
  });
22990
23088
  return path;
22991
23089
  }
22992
- function materializeNodePath(state3, nodeId) {
22993
- const node = requireNode(state3, nodeId);
22994
- const cachedPath = getCachedNodePath(state3, nodeId);
23090
+ function materializeNodePath(state2, nodeId) {
23091
+ const node = requireNode(state2, nodeId);
23092
+ const cachedPath = getCachedNodePath(state2, nodeId);
22995
23093
  if (cachedPath != null) return cachedPath;
22996
- if (hasNodeFlag(node, 2)) return setCachedNodePath(state3, nodeId, "");
22997
- const parentPath = materializeNodePath(state3, node.parentId);
22998
- const nodeName = getSegmentValue(state3.snapshot.segmentTable, node.nameId);
23094
+ if (hasNodeFlag(node, 2)) return setCachedNodePath(state2, nodeId, "");
23095
+ const parentPath = materializeNodePath(state2, node.parentId);
23096
+ const nodeName = getSegmentValue(state2.snapshot.segmentTable, node.nameId);
22999
23097
  const path = parentPath.length === 0 ? nodeName : `${parentPath}${nodeName}`;
23000
- return setCachedNodePath(state3, nodeId, isDirectoryNode(node) ? `${path}/` : path);
23098
+ return setCachedNodePath(state2, nodeId, isDirectoryNode(node) ? `${path}/` : path);
23001
23099
  }
23002
- function recomputeCountsUpwardFrom(state3, startNodeId) {
23003
- const instrumentation = state3.instrumentation;
23100
+ function recomputeCountsUpwardFrom(state2, startNodeId) {
23101
+ const instrumentation = state2.instrumentation;
23004
23102
  if (instrumentation == null) {
23005
- recomputeCountsUpwardFromNow(state3, startNodeId);
23103
+ recomputeCountsUpwardFromNow(state2, startNodeId);
23006
23104
  return;
23007
23105
  }
23008
- withBenchmarkPhase(instrumentation, "store.recomputeCountsUpwardFrom", () => recomputeCountsUpwardFromNow(state3, startNodeId));
23106
+ withBenchmarkPhase(instrumentation, "store.recomputeCountsUpwardFrom", () => recomputeCountsUpwardFromNow(state2, startNodeId));
23009
23107
  }
23010
- function recomputeCountsRecursive(state3, nodeId) {
23108
+ function recomputeCountsRecursive(state2, nodeId) {
23011
23109
  const stack = [[nodeId, 0]];
23012
- const { nodes, directories } = state3.snapshot;
23110
+ const { nodes, directories } = state2.snapshot;
23013
23111
  while (stack.length > 0) {
23014
23112
  const frame = stack[stack.length - 1];
23015
23113
  const nid = frame[0];
23016
23114
  const node = nodes[nid];
23017
23115
  if (node == null || !isDirectoryNode(node)) {
23018
- recomputeNodeCounts(state3, nid, node, true);
23116
+ recomputeNodeCounts(state2, nid, node, true);
23019
23117
  stack.pop();
23020
23118
  continue;
23021
23119
  }
23022
23120
  const dirIndex = directories.get(nid);
23023
23121
  if (dirIndex == null || frame[1] >= dirIndex.childIds.length) {
23024
- recomputeNodeCounts(state3, nid, node, true);
23122
+ recomputeNodeCounts(state2, nid, node, true);
23025
23123
  stack.pop();
23026
23124
  continue;
23027
23125
  }
@@ -23029,51 +23127,51 @@ function recomputeCountsRecursive(state3, nodeId) {
23029
23127
  stack.push([childId, 0]);
23030
23128
  }
23031
23129
  }
23032
- function collectAncestorIds(state3, nodeId) {
23130
+ function collectAncestorIds(state2, nodeId) {
23033
23131
  const ancestorIds = [];
23034
23132
  let currentNodeId = nodeId;
23035
23133
  while (currentNodeId != null) {
23036
- const currentNode = requireNode(state3, currentNodeId);
23134
+ const currentNode = requireNode(state2, currentNodeId);
23037
23135
  ancestorIds.push(currentNodeId);
23038
- if (currentNodeId === state3.snapshot.rootId) break;
23136
+ if (currentNodeId === state2.snapshot.rootId) break;
23039
23137
  currentNodeId = currentNode.parentId;
23040
23138
  }
23041
23139
  return ancestorIds;
23042
23140
  }
23043
- function findNodeId(state3, path) {
23044
- if (path.length === 0) return state3.snapshot.rootId;
23141
+ function findNodeId(state2, path) {
23142
+ if (path.length === 0) return state2.snapshot.rootId;
23045
23143
  const lookupPath = parseLookupPath(path);
23046
- return findNodeIdBySegments(state3, lookupPath.segments, lookupPath.requiresDirectory);
23144
+ return findNodeIdBySegments(state2, lookupPath.segments, lookupPath.requiresDirectory);
23047
23145
  }
23048
- function findNodeIdBySegments(state3, segments, requireDirectory) {
23049
- let currentNodeId = state3.snapshot.rootId;
23146
+ function findNodeIdBySegments(state2, segments, requireDirectory) {
23147
+ let currentNodeId = state2.snapshot.rootId;
23050
23148
  for (const segment2 of segments) {
23051
- const segmentId = state3.snapshot.segmentTable.idByValue.get(segment2);
23149
+ const segmentId = state2.snapshot.segmentTable.idByValue.get(segment2);
23052
23150
  if (segmentId === void 0) return null;
23053
- const currentIndex = getDirectoryIndex(state3, currentNodeId);
23054
- const nextNodeId = ensureChildIdByNameId(state3.snapshot.nodes, currentIndex).get(segmentId);
23151
+ const currentIndex = getDirectoryIndex(state2, currentNodeId);
23152
+ const nextNodeId = ensureChildIdByNameId(state2.snapshot.nodes, currentIndex).get(segmentId);
23055
23153
  if (nextNodeId === void 0) return null;
23056
23154
  currentNodeId = nextNodeId;
23057
23155
  }
23058
- const currentNode = requireNode(state3, currentNodeId);
23156
+ const currentNode = requireNode(state2, currentNodeId);
23059
23157
  if (requireDirectory && !isDirectoryNode(currentNode)) return null;
23060
23158
  return currentNodeId;
23061
23159
  }
23062
- function getDirectoryIndex(state3, directoryId) {
23063
- const directoryIndex = state3.snapshot.directories.get(directoryId);
23160
+ function getDirectoryIndex(state2, directoryId) {
23161
+ const directoryIndex = state2.snapshot.directories.get(directoryId);
23064
23162
  if (directoryIndex === void 0) throw new Error(`Unknown directory child index for node ${String(directoryId)}`);
23065
23163
  return directoryIndex;
23066
23164
  }
23067
- function requireNode(state3, nodeId) {
23068
- const node = state3.snapshot.nodes[nodeId];
23165
+ function requireNode(state2, nodeId) {
23166
+ const node = state2.snapshot.nodes[nodeId];
23069
23167
  if (node === void 0 || hasNodeFlag(node, 4)) throw new Error(`Unknown node ID: ${String(nodeId)}`);
23070
23168
  return node;
23071
23169
  }
23072
- function collectCanonicalEntries(state3, nodeId) {
23073
- const rootNode = state3.snapshot.nodes[nodeId];
23170
+ function collectCanonicalEntries(state2, nodeId) {
23171
+ const rootNode = state2.snapshot.nodes[nodeId];
23074
23172
  if (rootNode === void 0 || hasNodeFlag(rootNode, 4)) return [];
23075
- if (!isDirectoryNode(rootNode)) return [materializeNodePath(state3, nodeId)];
23076
- if (getDirectoryIndex(state3, nodeId).childIds.length === 0) return hasNodeFlag(rootNode, 1) && !hasNodeFlag(rootNode, 2) ? [materializeNodePath(state3, nodeId)] : [];
23173
+ if (!isDirectoryNode(rootNode)) return [materializeNodePath(state2, nodeId)];
23174
+ if (getDirectoryIndex(state2, nodeId).childIds.length === 0) return hasNodeFlag(rootNode, 1) && !hasNodeFlag(rootNode, 2) ? [materializeNodePath(state2, nodeId)] : [];
23077
23175
  const entries = [];
23078
23176
  const stack = [{
23079
23177
  childIndex: 0,
@@ -23082,19 +23180,19 @@ function collectCanonicalEntries(state3, nodeId) {
23082
23180
  while (stack.length > 0) {
23083
23181
  const frame = stack[stack.length - 1];
23084
23182
  if (frame == null) break;
23085
- const currentNode = state3.snapshot.nodes[frame.nodeId];
23183
+ const currentNode = state2.snapshot.nodes[frame.nodeId];
23086
23184
  if (currentNode === void 0 || hasNodeFlag(currentNode, 4)) {
23087
23185
  stack.pop();
23088
23186
  continue;
23089
23187
  }
23090
23188
  if (!isDirectoryNode(currentNode)) {
23091
- entries.push(materializeNodePath(state3, frame.nodeId));
23189
+ entries.push(materializeNodePath(state2, frame.nodeId));
23092
23190
  stack.pop();
23093
23191
  continue;
23094
23192
  }
23095
- const currentIndex = getDirectoryIndex(state3, frame.nodeId);
23193
+ const currentIndex = getDirectoryIndex(state2, frame.nodeId);
23096
23194
  if (currentIndex.childIds.length === 0) {
23097
- if (hasNodeFlag(currentNode, 1) && !hasNodeFlag(currentNode, 2)) entries.push(materializeNodePath(state3, frame.nodeId));
23195
+ if (hasNodeFlag(currentNode, 1) && !hasNodeFlag(currentNode, 2)) entries.push(materializeNodePath(state2, frame.nodeId));
23098
23196
  stack.pop();
23099
23197
  continue;
23100
23198
  }
@@ -23111,19 +23209,19 @@ function collectCanonicalEntries(state3, nodeId) {
23111
23209
  }
23112
23210
  return entries;
23113
23211
  }
23114
- function ensureDirectoryChain(state3, directorySegments) {
23212
+ function ensureDirectoryChain(state2, directorySegments) {
23115
23213
  const createdNodeIds = [];
23116
- let currentDirectoryId = state3.snapshot.rootId;
23214
+ let currentDirectoryId = state2.snapshot.rootId;
23117
23215
  for (const segment2 of directorySegments) {
23118
- const segmentId = internSegment(state3.snapshot.segmentTable, segment2);
23119
- const currentIndex = getDirectoryIndex(state3, currentDirectoryId);
23120
- const existingChildId = ensureChildIdByNameId(state3.snapshot.nodes, currentIndex).get(segmentId);
23216
+ const segmentId = internSegment(state2.snapshot.segmentTable, segment2);
23217
+ const currentIndex = getDirectoryIndex(state2, currentDirectoryId);
23218
+ const existingChildId = ensureChildIdByNameId(state2.snapshot.nodes, currentIndex).get(segmentId);
23121
23219
  if (existingChildId !== void 0) {
23122
- if (!isDirectoryNode(requireNode(state3, existingChildId))) throw new Error(`Cannot create a directory that collides with an existing file: "${segment2}"`);
23220
+ if (!isDirectoryNode(requireNode(state2, existingChildId))) throw new Error(`Cannot create a directory that collides with an existing file: "${segment2}"`);
23123
23221
  currentDirectoryId = existingChildId;
23124
23222
  continue;
23125
23223
  }
23126
- currentDirectoryId = createDirectoryNode(state3, currentDirectoryId, segmentId);
23224
+ currentDirectoryId = createDirectoryNode(state2, currentDirectoryId, segmentId);
23127
23225
  createdNodeIds.push(currentDirectoryId);
23128
23226
  }
23129
23227
  return {
@@ -23131,43 +23229,43 @@ function ensureDirectoryChain(state3, directorySegments) {
23131
23229
  directoryId: currentDirectoryId
23132
23230
  };
23133
23231
  }
23134
- function createDirectoryNode(state3, parentId, nameId) {
23135
- const parentNode = requireNode(state3, parentId);
23136
- const nodeId = state3.snapshot.nodes.length;
23137
- state3.snapshot.nodes.push({
23232
+ function createDirectoryNode(state2, parentId, nameId) {
23233
+ const parentNode = requireNode(state2, parentId);
23234
+ const nodeId = state2.snapshot.nodes.length;
23235
+ state2.snapshot.nodes.push({
23138
23236
  depthAndFlags: createNodeDepthAndFlags(getNodeDepth(parentNode) + 1, 0, 1),
23139
23237
  nameId,
23140
23238
  parentId,
23141
23239
  subtreeNodeCount: 1,
23142
23240
  visibleSubtreeCount: 1
23143
23241
  });
23144
- state3.snapshot.directories.set(nodeId, createDirectoryChildIndex());
23145
- insertChildReference(state3, parentId, nodeId);
23146
- if (state3.collapseNewDirectoriesByDefault) {
23147
- state3.collapsedDirectoryIds.add(nodeId);
23148
- state3.hasCollapsedDirectoryOverrides = true;
23242
+ state2.snapshot.directories.set(nodeId, createDirectoryChildIndex());
23243
+ insertChildReference(state2, parentId, nodeId);
23244
+ if (state2.collapseNewDirectoriesByDefault) {
23245
+ state2.collapsedDirectoryIds.add(nodeId);
23246
+ state2.hasCollapsedDirectoryOverrides = true;
23149
23247
  }
23150
- state3.activeNodeCount++;
23248
+ state2.activeNodeCount++;
23151
23249
  return nodeId;
23152
23250
  }
23153
- function createFileNode(state3, parentId, basename3) {
23154
- const nameId = internSegment(state3.snapshot.segmentTable, basename3);
23155
- const parentIndex = getDirectoryIndex(state3, parentId);
23156
- if (ensureChildIdByNameId(state3.snapshot.nodes, parentIndex).has(nameId)) throw new Error(`Path already exists: "${buildPathPreview(state3, parentId, basename3)}"`);
23157
- const parentNode = requireNode(state3, parentId);
23158
- const nodeId = state3.snapshot.nodes.length;
23159
- state3.snapshot.nodes.push({
23251
+ function createFileNode(state2, parentId, basename3) {
23252
+ const nameId = internSegment(state2.snapshot.segmentTable, basename3);
23253
+ const parentIndex = getDirectoryIndex(state2, parentId);
23254
+ if (ensureChildIdByNameId(state2.snapshot.nodes, parentIndex).has(nameId)) throw new Error(`Path already exists: "${buildPathPreview(state2, parentId, basename3)}"`);
23255
+ const parentNode = requireNode(state2, parentId);
23256
+ const nodeId = state2.snapshot.nodes.length;
23257
+ state2.snapshot.nodes.push({
23160
23258
  depthAndFlags: createNodeDepthAndFlags(getNodeDepth(parentNode) + 1, 0),
23161
23259
  nameId,
23162
23260
  parentId,
23163
23261
  subtreeNodeCount: 1,
23164
23262
  visibleSubtreeCount: 1
23165
23263
  });
23166
- insertChildReference(state3, parentId, nodeId);
23167
- state3.activeNodeCount++;
23264
+ insertChildReference(state2, parentId, nodeId);
23265
+ state2.activeNodeCount++;
23168
23266
  return nodeId;
23169
23267
  }
23170
- function findChildInsertIndex(state3, parentIndex, childId) {
23268
+ function findChildInsertIndex(state2, parentIndex, childId) {
23171
23269
  let low = 0;
23172
23270
  let high = parentIndex.childIds.length;
23173
23271
  while (low < high) {
@@ -23177,72 +23275,72 @@ function findChildInsertIndex(state3, parentIndex, childId) {
23177
23275
  high = middle;
23178
23276
  continue;
23179
23277
  }
23180
- if (compareSiblingNodes(state3, childId, existingChildId) < 0) high = middle;
23278
+ if (compareSiblingNodes(state2, childId, existingChildId) < 0) high = middle;
23181
23279
  else low = middle + 1;
23182
23280
  }
23183
23281
  return low;
23184
23282
  }
23185
- function insertChildReference(state3, parentId, childId) {
23186
- const parentIndex = getDirectoryIndex(state3, parentId);
23187
- const childNode = requireNode(state3, childId);
23188
- ensureChildIdByNameId(state3.snapshot.nodes, parentIndex).set(childNode.nameId, childId);
23283
+ function insertChildReference(state2, parentId, childId) {
23284
+ const parentIndex = getDirectoryIndex(state2, parentId);
23285
+ const childNode = requireNode(state2, childId);
23286
+ ensureChildIdByNameId(state2.snapshot.nodes, parentIndex).set(childNode.nameId, childId);
23189
23287
  applyChildAggregateDelta(parentIndex, childId, childNode.subtreeNodeCount, childNode.visibleSubtreeCount);
23190
- const insertIndex = findChildInsertIndex(state3, parentIndex, childId);
23288
+ const insertIndex = findChildInsertIndex(state2, parentIndex, childId);
23191
23289
  parentIndex.childIds.splice(insertIndex, 0, childId);
23192
23290
  updateChildPositionsFrom(parentIndex, insertIndex);
23193
- rebuildVisibleChildChunks(state3.snapshot.nodes, parentIndex);
23291
+ rebuildVisibleChildChunks(state2.snapshot.nodes, parentIndex);
23194
23292
  }
23195
- function removeChildReference(state3, parentId, childId, childNameId) {
23196
- const parentIndex = getDirectoryIndex(state3, parentId);
23293
+ function removeChildReference(state2, parentId, childId, childNameId) {
23294
+ const parentIndex = getDirectoryIndex(state2, parentId);
23197
23295
  const positions2 = ensureChildPositions(parentIndex);
23198
23296
  const childIndex = positions2.get(childId) ?? -1;
23199
- ensureChildIdByNameId(state3.snapshot.nodes, parentIndex).delete(childNameId);
23297
+ ensureChildIdByNameId(state2.snapshot.nodes, parentIndex).delete(childNameId);
23200
23298
  positions2.delete(childId);
23201
- const childNode = state3.snapshot.nodes[childId];
23299
+ const childNode = state2.snapshot.nodes[childId];
23202
23300
  if (childNode != null) applyChildAggregateDelta(parentIndex, childId, -childNode.subtreeNodeCount, -childNode.visibleSubtreeCount);
23203
23301
  if (childIndex >= 0) {
23204
23302
  parentIndex.childIds.splice(childIndex, 1);
23205
23303
  updateChildPositionsFrom(parentIndex, childIndex);
23206
- rebuildVisibleChildChunks(state3.snapshot.nodes, parentIndex);
23304
+ rebuildVisibleChildChunks(state2.snapshot.nodes, parentIndex);
23207
23305
  }
23208
23306
  }
23209
- function compareSiblingNodes(state3, leftId, rightId) {
23210
- const sortOption = state3.snapshot.options.sort;
23211
- if (sortOption === "default") return compareSiblingNodesDefault(state3, leftId, rightId);
23212
- return sortOption(createCompareEntry2(state3, leftId), createCompareEntry2(state3, rightId));
23307
+ function compareSiblingNodes(state2, leftId, rightId) {
23308
+ const sortOption = state2.snapshot.options.sort;
23309
+ if (sortOption === "default") return compareSiblingNodesDefault(state2, leftId, rightId);
23310
+ return sortOption(createCompareEntry2(state2, leftId), createCompareEntry2(state2, rightId));
23213
23311
  }
23214
- function compareSiblingNodesDefault(state3, leftId, rightId) {
23215
- const leftNode = requireNode(state3, leftId);
23216
- const rightNode = requireNode(state3, rightId);
23312
+ function compareSiblingNodesDefault(state2, leftId, rightId) {
23313
+ const leftNode = requireNode(state2, leftId);
23314
+ const rightNode = requireNode(state2, rightId);
23217
23315
  const leftIsDirectory = isDirectoryNode(leftNode);
23218
23316
  if (leftIsDirectory !== isDirectoryNode(rightNode)) return leftIsDirectory ? -1 : 1;
23219
- const comparison = compareSegmentSortKeys(getSegmentSortKey(state3.snapshot.segmentTable, leftNode.nameId), getSegmentSortKey(state3.snapshot.segmentTable, rightNode.nameId));
23317
+ const comparison = compareSegmentSortKeys(getSegmentSortKey(state2.snapshot.segmentTable, leftNode.nameId), getSegmentSortKey(state2.snapshot.segmentTable, rightNode.nameId));
23220
23318
  if (comparison !== 0) return comparison;
23221
- const leftName = getSegmentValue(state3.snapshot.segmentTable, leftNode.nameId);
23222
- const rightName = getSegmentValue(state3.snapshot.segmentTable, rightNode.nameId);
23319
+ const leftName = getSegmentValue(state2.snapshot.segmentTable, leftNode.nameId);
23320
+ const rightName = getSegmentValue(state2.snapshot.segmentTable, rightNode.nameId);
23223
23321
  if (leftName !== rightName) return leftName < rightName ? -1 : 1;
23224
23322
  return leftId < rightId ? -1 : 1;
23225
23323
  }
23226
- function createCompareEntry2(state3, nodeId) {
23227
- const node = requireNode(state3, nodeId);
23228
- const path = materializeNodePath(state3, nodeId);
23324
+ function createCompareEntry2(state2, nodeId) {
23325
+ const node = requireNode(state2, nodeId);
23326
+ const path = materializeNodePath(state2, nodeId);
23229
23327
  const isDirectory = isDirectoryNode(node);
23230
23328
  const normalizedPath = isDirectory ? path.slice(0, -1) : path;
23231
23329
  return {
23232
- basename: getSegmentValue(state3.snapshot.segmentTable, node.nameId),
23330
+ basename: getSegmentValue(state2.snapshot.segmentTable, node.nameId),
23233
23331
  depth: getNodeDepth(node),
23234
23332
  isDirectory,
23235
23333
  path,
23236
23334
  segments: normalizedPath.length === 0 ? [] : normalizedPath.split("/")
23237
23335
  };
23238
23336
  }
23239
- function resolveMoveTarget(state3, sourceNodeId, toPath) {
23240
- const sourceNode = requireNode(state3, sourceNodeId);
23241
- const existingDestinationId = findNodeId(state3, toPath);
23337
+ function resolveMoveTarget(state2, sourceNodeId, toPath) {
23338
+ const sourceNode = requireNode(state2, sourceNodeId);
23339
+ const existingDestinationId = findNodeId(state2, toPath);
23242
23340
  if (existingDestinationId != null) {
23243
- const existingDestination = requireNode(state3, existingDestinationId);
23341
+ const existingDestination = requireNode(state2, existingDestinationId);
23244
23342
  if (isDirectoryNode(existingDestination)) return {
23245
- basename: getSegmentValue(state3.snapshot.segmentTable, sourceNode.nameId),
23343
+ basename: getSegmentValue(state2.snapshot.segmentTable, sourceNode.nameId),
23246
23344
  existingNodeId: null,
23247
23345
  parentId: existingDestinationId
23248
23346
  };
@@ -23256,7 +23354,7 @@ function resolveMoveTarget(state3, sourceNodeId, toPath) {
23256
23354
  const destinationLookup = parseLookupPath(toPath);
23257
23355
  const basename3 = destinationLookup.segments[destinationLookup.segments.length - 1] ?? "";
23258
23356
  const parentSegments = destinationLookup.segments.slice(0, -1);
23259
- const parentId = parentSegments.length === 0 ? state3.snapshot.rootId : findNodeIdBySegments(state3, parentSegments, true);
23357
+ const parentId = parentSegments.length === 0 ? state2.snapshot.rootId : findNodeIdBySegments(state2, parentSegments, true);
23260
23358
  if (parentId == null) throw new Error(`Destination parent does not exist: "${toPath}"`);
23261
23359
  return {
23262
23360
  basename: basename3,
@@ -23264,21 +23362,21 @@ function resolveMoveTarget(state3, sourceNodeId, toPath) {
23264
23362
  parentId
23265
23363
  };
23266
23364
  }
23267
- function handleMoveCollision(state3, collisionNodeId, strategy, sourceKind) {
23365
+ function handleMoveCollision(state2, collisionNodeId, strategy, sourceKind) {
23268
23366
  if (strategy === "skip") return "skip";
23269
- if (strategy === "error") throw new Error(`Destination already exists: "${materializeNodePath(state3, collisionNodeId)}"`);
23270
- const collisionNode = requireNode(state3, collisionNodeId);
23367
+ if (strategy === "error") throw new Error(`Destination already exists: "${materializeNodePath(state2, collisionNodeId)}"`);
23368
+ const collisionNode = requireNode(state2, collisionNodeId);
23271
23369
  if (getNodeKind(collisionNode) !== sourceKind) throw new Error("replace collision requires the same source and destination kinds");
23272
- if (isDirectoryNode(collisionNode) && getDirectoryIndex(state3, collisionNodeId).childIds.length > 0) throw new Error("replace collision does not support non-empty directories");
23370
+ if (isDirectoryNode(collisionNode) && getDirectoryIndex(state2, collisionNodeId).childIds.length > 0) throw new Error("replace collision does not support non-empty directories");
23273
23371
  const collisionParentId = collisionNode.parentId;
23274
23372
  const collisionNameId = collisionNode.nameId;
23275
- removeSubtree(state3, collisionNodeId);
23276
- removeChildReference(state3, collisionParentId, collisionNodeId, collisionNameId);
23277
- promoteEmptyAncestorsToExplicit(state3, collisionParentId);
23278
- recomputeCountsUpwardFrom(state3, collisionParentId);
23373
+ removeSubtree(state2, collisionNodeId);
23374
+ removeChildReference(state2, collisionParentId, collisionNodeId, collisionNameId);
23375
+ promoteEmptyAncestorsToExplicit(state2, collisionParentId);
23376
+ recomputeCountsUpwardFrom(state2, collisionParentId);
23279
23377
  return "handled";
23280
23378
  }
23281
- function removeSubtree(state3, nodeId) {
23379
+ function removeSubtree(state2, nodeId) {
23282
23380
  const removedNodeIds = [];
23283
23381
  const stack = [{
23284
23382
  nodeId,
@@ -23287,15 +23385,15 @@ function removeSubtree(state3, nodeId) {
23287
23385
  while (stack.length > 0) {
23288
23386
  const frame = stack.pop();
23289
23387
  if (frame == null) break;
23290
- const node = requireNode(state3, frame.nodeId);
23388
+ const node = requireNode(state2, frame.nodeId);
23291
23389
  if (frame.visitedChildren || !isDirectoryNode(node)) {
23292
- if (isDirectoryNode(node)) state3.snapshot.directories.delete(frame.nodeId);
23390
+ if (isDirectoryNode(node)) state2.snapshot.directories.delete(frame.nodeId);
23293
23391
  addNodeFlag(node, 4);
23294
- state3.pathCacheByNodeId.delete(frame.nodeId);
23295
- if (state3.collapsedDirectoryIds.delete(frame.nodeId)) state3.hasCollapsedDirectoryOverrides = state3.collapsedDirectoryIds.size > 0;
23296
- state3.expandedDirectoryIds.delete(frame.nodeId);
23297
- clearDirectoryLoadInfo(state3, frame.nodeId);
23298
- state3.activeNodeCount--;
23392
+ state2.pathCacheByNodeId.delete(frame.nodeId);
23393
+ if (state2.collapsedDirectoryIds.delete(frame.nodeId)) state2.hasCollapsedDirectoryOverrides = state2.collapsedDirectoryIds.size > 0;
23394
+ state2.expandedDirectoryIds.delete(frame.nodeId);
23395
+ clearDirectoryLoadInfo(state2, frame.nodeId);
23396
+ state2.activeNodeCount--;
23299
23397
  removedNodeIds.push(frame.nodeId);
23300
23398
  continue;
23301
23399
  }
@@ -23303,7 +23401,7 @@ function removeSubtree(state3, nodeId) {
23303
23401
  nodeId: frame.nodeId,
23304
23402
  visitedChildren: true
23305
23403
  });
23306
- const directoryIndex = getDirectoryIndex(state3, frame.nodeId);
23404
+ const directoryIndex = getDirectoryIndex(state2, frame.nodeId);
23307
23405
  for (let childIndex = directoryIndex.childIds.length - 1; childIndex >= 0; childIndex--) {
23308
23406
  const childId = directoryIndex.childIds[childIndex];
23309
23407
  if (childId != null) stack.push({
@@ -23314,38 +23412,38 @@ function removeSubtree(state3, nodeId) {
23314
23412
  }
23315
23413
  return removedNodeIds;
23316
23414
  }
23317
- function promoteEmptyAncestorsToExplicit(state3, startDirectoryId) {
23415
+ function promoteEmptyAncestorsToExplicit(state2, startDirectoryId) {
23318
23416
  let currentDirectoryId = startDirectoryId;
23319
23417
  while (currentDirectoryId != null) {
23320
- const currentNode = requireNode(state3, currentDirectoryId);
23418
+ const currentNode = requireNode(state2, currentDirectoryId);
23321
23419
  if (!isDirectoryNode(currentNode) || hasNodeFlag(currentNode, 2)) return;
23322
- if (getDirectoryIndex(state3, currentDirectoryId).childIds.length > 0) return;
23420
+ if (getDirectoryIndex(state2, currentDirectoryId).childIds.length > 0) return;
23323
23421
  addNodeFlag(currentNode, 1);
23324
23422
  currentDirectoryId = currentNode.parentId === currentDirectoryId ? null : currentNode.parentId;
23325
23423
  }
23326
23424
  }
23327
- function findDeepestExistingDirectoryId(state3, segments) {
23328
- let currentDirectoryId = state3.snapshot.rootId;
23425
+ function findDeepestExistingDirectoryId(state2, segments) {
23426
+ let currentDirectoryId = state2.snapshot.rootId;
23329
23427
  for (const segment2 of segments) {
23330
- const segmentId = state3.snapshot.segmentTable.idByValue.get(segment2);
23428
+ const segmentId = state2.snapshot.segmentTable.idByValue.get(segment2);
23331
23429
  if (segmentId == null) break;
23332
- const nextNodeId = ensureChildIdByNameId(state3.snapshot.nodes, getDirectoryIndex(state3, currentDirectoryId)).get(segmentId);
23430
+ const nextNodeId = ensureChildIdByNameId(state2.snapshot.nodes, getDirectoryIndex(state2, currentDirectoryId)).get(segmentId);
23333
23431
  if (nextNodeId == null) break;
23334
- if (!isDirectoryNode(requireNode(state3, nextNodeId))) break;
23432
+ if (!isDirectoryNode(requireNode(state2, nextNodeId))) break;
23335
23433
  currentDirectoryId = nextNodeId;
23336
23434
  }
23337
23435
  return currentDirectoryId;
23338
23436
  }
23339
- function getCollapsedProjectionSignature(state3, startDirectoryId) {
23340
- const collapsedAncestorId = findNearestCollapsedAncestor(state3, startDirectoryId);
23437
+ function getCollapsedProjectionSignature(state2, startDirectoryId) {
23438
+ const collapsedAncestorId = findNearestCollapsedAncestor(state2, startDirectoryId);
23341
23439
  if (collapsedAncestorId == null) return null;
23342
- const terminalDirectoryId = getFlattenedTerminalDirectoryId(state3, collapsedAncestorId);
23343
- const terminalNode = requireNode(state3, terminalDirectoryId);
23344
- const flattenedSegmentPaths = collapsedAncestorId === terminalDirectoryId ? null : collectFlattenedDirectoryChainIds(state3, collapsedAncestorId).map((nodeId) => materializeNodePath(state3, nodeId));
23440
+ const terminalDirectoryId = getFlattenedTerminalDirectoryId(state2, collapsedAncestorId);
23441
+ const terminalNode = requireNode(state2, terminalDirectoryId);
23442
+ const flattenedSegmentPaths = collapsedAncestorId === terminalDirectoryId ? null : collectFlattenedDirectoryChainIds(state2, collapsedAncestorId).map((nodeId) => materializeNodePath(state2, nodeId));
23345
23443
  return JSON.stringify({
23346
23444
  flattenedSegmentPaths,
23347
- hasChildren: getDirectoryIndex(state3, terminalDirectoryId).childIds.length > 0,
23348
- path: materializeNodePath(state3, terminalDirectoryId),
23445
+ hasChildren: getDirectoryIndex(state2, terminalDirectoryId).childIds.length > 0,
23446
+ path: materializeNodePath(state2, terminalDirectoryId),
23349
23447
  terminalKind: getNodeKind(terminalNode)
23350
23448
  });
23351
23449
  }
@@ -23360,67 +23458,67 @@ function didAnyProjectionChange(previousProjectionSignatures, nextProjectionSign
23360
23458
  }
23361
23459
  return false;
23362
23460
  }
23363
- function findNearestCollapsedAncestor(state3, startDirectoryId) {
23461
+ function findNearestCollapsedAncestor(state2, startDirectoryId) {
23364
23462
  let currentDirectoryId = startDirectoryId;
23365
23463
  while (currentDirectoryId != null) {
23366
- const currentNode = requireNode(state3, currentDirectoryId);
23464
+ const currentNode = requireNode(state2, currentDirectoryId);
23367
23465
  if (!isDirectoryNode(currentNode) || hasNodeFlag(currentNode, 2)) return null;
23368
- if (!isDirectoryExpanded(state3, currentDirectoryId, currentNode)) return currentDirectoryId;
23466
+ if (!isDirectoryExpanded(state2, currentDirectoryId, currentNode)) return currentDirectoryId;
23369
23467
  currentDirectoryId = currentNode.parentId;
23370
23468
  }
23371
23469
  return null;
23372
23470
  }
23373
- function recomputeDepths(state3, nodeId) {
23374
- const node = requireNode(state3, nodeId);
23375
- setNodeDepth(node, (nodeId === state3.snapshot.rootId ? -1 : getNodeDepth(requireNode(state3, node.parentId))) + 1);
23471
+ function recomputeDepths(state2, nodeId) {
23472
+ const node = requireNode(state2, nodeId);
23473
+ setNodeDepth(node, (nodeId === state2.snapshot.rootId ? -1 : getNodeDepth(requireNode(state2, node.parentId))) + 1);
23376
23474
  if (!isDirectoryNode(node)) return;
23377
- const directoryIndex = getDirectoryIndex(state3, nodeId);
23378
- for (const childId of directoryIndex.childIds) recomputeDepths(state3, childId);
23475
+ const directoryIndex = getDirectoryIndex(state2, nodeId);
23476
+ for (const childId of directoryIndex.childIds) recomputeDepths(state2, childId);
23379
23477
  }
23380
- function isAncestor(state3, ancestorNodeId, nodeId) {
23478
+ function isAncestor(state2, ancestorNodeId, nodeId) {
23381
23479
  let currentNodeId = nodeId;
23382
23480
  while (currentNodeId != null) {
23383
23481
  if (currentNodeId === ancestorNodeId) return true;
23384
- const currentNode = requireNode(state3, currentNodeId);
23385
- if (currentNodeId === state3.snapshot.rootId) return false;
23482
+ const currentNode = requireNode(state2, currentNodeId);
23483
+ if (currentNodeId === state2.snapshot.rootId) return false;
23386
23484
  currentNodeId = currentNode.parentId;
23387
23485
  }
23388
23486
  return false;
23389
23487
  }
23390
- function recomputeNodeCounts(state3, nodeId, currentNode = requireNode(state3, nodeId), rebuildChildAggregates = false) {
23391
- const instrumentation = state3.instrumentation;
23488
+ function recomputeNodeCounts(state2, nodeId, currentNode = requireNode(state2, nodeId), rebuildChildAggregates = false) {
23489
+ const instrumentation = state2.instrumentation;
23392
23490
  if (instrumentation == null) {
23393
- recomputeNodeCountsNow(state3, nodeId, currentNode, rebuildChildAggregates);
23491
+ recomputeNodeCountsNow(state2, nodeId, currentNode, rebuildChildAggregates);
23394
23492
  return;
23395
23493
  }
23396
- withBenchmarkPhase(instrumentation, "store.recomputeNodeCounts", () => recomputeNodeCountsNow(state3, nodeId, currentNode, rebuildChildAggregates));
23494
+ withBenchmarkPhase(instrumentation, "store.recomputeNodeCounts", () => recomputeNodeCountsNow(state2, nodeId, currentNode, rebuildChildAggregates));
23397
23495
  }
23398
- function recomputeCountsUpwardFromNow(state3, startNodeId) {
23496
+ function recomputeCountsUpwardFromNow(state2, startNodeId) {
23399
23497
  let currentNodeId = startNodeId;
23400
23498
  while (currentNodeId != null) {
23401
- const currentNode = requireNode(state3, currentNodeId);
23499
+ const currentNode = requireNode(state2, currentNodeId);
23402
23500
  const previousSubtreeNodeCount = currentNode.subtreeNodeCount;
23403
23501
  const previousVisibleSubtreeCount = currentNode.visibleSubtreeCount;
23404
- recomputeNodeCounts(state3, currentNodeId, currentNode);
23405
- if (currentNodeId === state3.snapshot.rootId) return;
23502
+ recomputeNodeCounts(state2, currentNodeId, currentNode);
23503
+ if (currentNodeId === state2.snapshot.rootId) return;
23406
23504
  const subtreeNodeDelta = currentNode.subtreeNodeCount - previousSubtreeNodeCount;
23407
23505
  const visibleSubtreeDelta = currentNode.visibleSubtreeCount - previousVisibleSubtreeCount;
23408
23506
  const parentId = currentNode.parentId;
23409
- if (subtreeNodeDelta !== 0 || visibleSubtreeDelta !== 0) applyChildAggregateDelta(getDirectoryIndex(state3, parentId), currentNodeId, subtreeNodeDelta, visibleSubtreeDelta);
23507
+ if (subtreeNodeDelta !== 0 || visibleSubtreeDelta !== 0) applyChildAggregateDelta(getDirectoryIndex(state2, parentId), currentNodeId, subtreeNodeDelta, visibleSubtreeDelta);
23410
23508
  currentNodeId = parentId;
23411
23509
  }
23412
23510
  }
23413
- function recomputeNodeCountsNow(state3, nodeId, currentNode, rebuildChildAggregates) {
23511
+ function recomputeNodeCountsNow(state2, nodeId, currentNode, rebuildChildAggregates) {
23414
23512
  if (!isDirectoryNode(currentNode)) {
23415
23513
  currentNode.subtreeNodeCount = 1;
23416
23514
  currentNode.visibleSubtreeCount = 1;
23417
23515
  return;
23418
23516
  }
23419
- const currentIndex = getDirectoryIndex(state3, nodeId);
23517
+ const currentIndex = getDirectoryIndex(state2, nodeId);
23420
23518
  if (rebuildChildAggregates) {
23421
- const instrumentation = state3.instrumentation;
23422
- if (instrumentation == null) rebuildDirectoryChildAggregates(state3.snapshot.nodes, currentIndex);
23423
- else withBenchmarkPhase(instrumentation, "store.recomputeNodeCounts.rebuildChildAggregates", () => rebuildDirectoryChildAggregates(state3.snapshot.nodes, currentIndex));
23519
+ const instrumentation = state2.instrumentation;
23520
+ if (instrumentation == null) rebuildDirectoryChildAggregates(state2.snapshot.nodes, currentIndex);
23521
+ else withBenchmarkPhase(instrumentation, "store.recomputeNodeCounts.rebuildChildAggregates", () => rebuildDirectoryChildAggregates(state2.snapshot.nodes, currentIndex));
23424
23522
  }
23425
23523
  const subtreeNodeCount = 1 + currentIndex.totalChildSubtreeNodeCount;
23426
23524
  const visibleChildCount = currentIndex.totalChildVisibleSubtreeCount;
@@ -23429,10 +23527,10 @@ function recomputeNodeCountsNow(state3, nodeId, currentNode, rebuildChildAggrega
23429
23527
  currentNode.visibleSubtreeCount = visibleChildCount;
23430
23528
  return;
23431
23529
  }
23432
- currentNode.visibleSubtreeCount = getFlattenedChildDirectoryId(state3, nodeId) != null ? visibleChildCount : isDirectoryExpanded(state3, nodeId, currentNode) ? 1 + visibleChildCount : 1;
23530
+ currentNode.visibleSubtreeCount = getFlattenedChildDirectoryId(state2, nodeId) != null ? visibleChildCount : isDirectoryExpanded(state2, nodeId, currentNode) ? 1 + visibleChildCount : 1;
23433
23531
  }
23434
- function buildPathPreview(state3, parentId, basename3) {
23435
- const parentPath = materializeNodePath(state3, parentId);
23532
+ function buildPathPreview(state2, parentId, basename3) {
23533
+ const parentPath = materializeNodePath(state2, parentId);
23436
23534
  return parentPath.length === 0 ? basename3 : `${parentPath}${basename3}`;
23437
23535
  }
23438
23536
 
@@ -23440,16 +23538,16 @@ function buildPathPreview(state3, parentId, basename3) {
23440
23538
  function isLiveNode(node) {
23441
23539
  return node != null && !hasNodeFlag(node, 4);
23442
23540
  }
23443
- function isLiveDirectoryNode(state3, nodeId) {
23444
- const node = state3.snapshot.nodes[nodeId];
23541
+ function isLiveDirectoryNode(state2, nodeId) {
23542
+ const node = state2.snapshot.nodes[nodeId];
23445
23543
  if (!isLiveNode(node) || !isDirectoryNode(node) || hasNodeFlag(node, 2)) return null;
23446
23544
  return node;
23447
23545
  }
23448
- function countCachedPathEntries(state3) {
23546
+ function countCachedPathEntries(state2) {
23449
23547
  let cachedPathEntryCount = 0;
23450
- for (const [nodeId, cachedEntry] of state3.pathCacheByNodeId) {
23451
- if (cachedEntry.version !== state3.pathCacheVersion) continue;
23452
- if (!isLiveNode(state3.snapshot.nodes[nodeId])) continue;
23548
+ for (const [nodeId, cachedEntry] of state2.pathCacheByNodeId) {
23549
+ if (cachedEntry.version !== state2.pathCacheVersion) continue;
23550
+ if (!isLiveNode(state2.snapshot.nodes[nodeId])) continue;
23453
23551
  cachedPathEntryCount += 1;
23454
23552
  }
23455
23553
  return cachedPathEntryCount;
@@ -23457,13 +23555,13 @@ function countCachedPathEntries(state3) {
23457
23555
  function countSegmentEntries(segmentTable) {
23458
23556
  return Math.max(0, segmentTable.valueById.length - 1);
23459
23557
  }
23460
- function createCleanupMetricSnapshot(state3) {
23558
+ function createCleanupMetricSnapshot(state2) {
23461
23559
  return {
23462
- activeNodeCount: state3.activeNodeCount,
23463
- cachedPathEntryCount: countCachedPathEntries(state3),
23464
- loadInfoEntryCount: state3.directoryLoadInfoById.size,
23465
- segmentCount: countSegmentEntries(state3.snapshot.segmentTable),
23466
- totalNodeSlotCount: Math.max(0, state3.snapshot.nodes.length - 1)
23560
+ activeNodeCount: state2.activeNodeCount,
23561
+ cachedPathEntryCount: countCachedPathEntries(state2),
23562
+ loadInfoEntryCount: state2.directoryLoadInfoById.size,
23563
+ segmentCount: countSegmentEntries(state2.snapshot.segmentTable),
23564
+ totalNodeSlotCount: Math.max(0, state2.snapshot.nodes.length - 1)
23467
23565
  };
23468
23566
  }
23469
23567
  function createCleanupResult(mode2, idsPreserved, before, after) {
@@ -23486,20 +23584,20 @@ function createCleanupResult(mode2, idsPreserved, before, after) {
23486
23584
  totalNodeSlotCountBefore: before.totalNodeSlotCount
23487
23585
  };
23488
23586
  }
23489
- function collectExpansionOverridePaths(state3) {
23587
+ function collectExpansionOverridePaths(state2) {
23490
23588
  const collapsedPaths = [];
23491
23589
  const expandedPaths = [];
23492
- for (const nodeId of state3.collapsedDirectoryIds) if (isLiveDirectoryNode(state3, nodeId) != null) collapsedPaths.push(materializeNodePath(state3, nodeId));
23493
- for (const nodeId of state3.expandedDirectoryIds) if (isLiveDirectoryNode(state3, nodeId) != null) expandedPaths.push(materializeNodePath(state3, nodeId));
23590
+ for (const nodeId of state2.collapsedDirectoryIds) if (isLiveDirectoryNode(state2, nodeId) != null) collapsedPaths.push(materializeNodePath(state2, nodeId));
23591
+ for (const nodeId of state2.expandedDirectoryIds) if (isLiveDirectoryNode(state2, nodeId) != null) expandedPaths.push(materializeNodePath(state2, nodeId));
23494
23592
  return {
23495
23593
  collapsedPaths,
23496
23594
  expandedPaths
23497
23595
  };
23498
23596
  }
23499
- function collectDirectoryLoadInfos(state3) {
23597
+ function collectDirectoryLoadInfos(state2) {
23500
23598
  const retainedInfos = [];
23501
- for (const [nodeId, info] of state3.directoryLoadInfoById) {
23502
- if (isLiveDirectoryNode(state3, nodeId) == null || getDirectoryLoadState(state3, nodeId) === "loaded") continue;
23599
+ for (const [nodeId, info] of state2.directoryLoadInfoById) {
23600
+ if (isLiveDirectoryNode(state2, nodeId) == null || getDirectoryLoadState(state2, nodeId) === "loaded") continue;
23503
23601
  retainedInfos.push({
23504
23602
  info: {
23505
23603
  activeAttemptId: null,
@@ -23507,33 +23605,33 @@ function collectDirectoryLoadInfos(state3) {
23507
23605
  nextAttemptId: info.nextAttemptId,
23508
23606
  state: info.state
23509
23607
  },
23510
- path: materializeNodePath(state3, nodeId)
23608
+ path: materializeNodePath(state2, nodeId)
23511
23609
  });
23512
23610
  }
23513
23611
  return retainedInfos;
23514
23612
  }
23515
- function restoreExpansionOverridePaths(state3, persistedExpansionState) {
23516
- state3.collapsedDirectoryIds.clear();
23517
- state3.hasCollapsedDirectoryOverrides = false;
23518
- state3.expandedDirectoryIds.clear();
23613
+ function restoreExpansionOverridePaths(state2, persistedExpansionState) {
23614
+ state2.collapsedDirectoryIds.clear();
23615
+ state2.hasCollapsedDirectoryOverrides = false;
23616
+ state2.expandedDirectoryIds.clear();
23519
23617
  for (const path of persistedExpansionState.expandedPaths) {
23520
- const nodeId = findNodeId(state3, path);
23618
+ const nodeId = findNodeId(state2, path);
23521
23619
  if (nodeId == null) continue;
23522
- setDirectoryExpanded(state3, nodeId, true, requireNode(state3, nodeId));
23620
+ setDirectoryExpanded(state2, nodeId, true, requireNode(state2, nodeId));
23523
23621
  }
23524
23622
  for (const path of persistedExpansionState.collapsedPaths) {
23525
- const nodeId = findNodeId(state3, path);
23623
+ const nodeId = findNodeId(state2, path);
23526
23624
  if (nodeId == null) continue;
23527
- setDirectoryExpanded(state3, nodeId, false, requireNode(state3, nodeId));
23625
+ setDirectoryExpanded(state2, nodeId, false, requireNode(state2, nodeId));
23528
23626
  }
23529
23627
  }
23530
- function restoreDirectoryLoadInfos(state3, persistedLoadInfos) {
23531
- state3.directoryLoadInfoById.clear();
23628
+ function restoreDirectoryLoadInfos(state2, persistedLoadInfos) {
23629
+ state2.directoryLoadInfoById.clear();
23532
23630
  for (const retainedInfo of persistedLoadInfos) {
23533
- const nodeId = findNodeId(state3, retainedInfo.path);
23631
+ const nodeId = findNodeId(state2, retainedInfo.path);
23534
23632
  if (nodeId == null) continue;
23535
- if (isLiveDirectoryNode(state3, nodeId) == null) continue;
23536
- state3.directoryLoadInfoById.set(nodeId, {
23633
+ if (isLiveDirectoryNode(state2, nodeId) == null) continue;
23634
+ state2.directoryLoadInfoById.set(nodeId, {
23537
23635
  activeAttemptId: null,
23538
23636
  errorMessage: retainedInfo.info.errorMessage,
23539
23637
  nextAttemptId: retainedInfo.info.nextAttemptId,
@@ -23541,18 +23639,18 @@ function restoreDirectoryLoadInfos(state3, persistedLoadInfos) {
23541
23639
  });
23542
23640
  }
23543
23641
  }
23544
- function clearPathCaches(state3) {
23545
- state3.pathCacheVersion += 1;
23546
- state3.pathCacheByNodeId.clear();
23547
- state3.pathCacheByNodeId.set(state3.snapshot.rootId, {
23642
+ function clearPathCaches(state2) {
23643
+ state2.pathCacheVersion += 1;
23644
+ state2.pathCacheByNodeId.clear();
23645
+ state2.pathCacheByNodeId.set(state2.snapshot.rootId, {
23548
23646
  path: "",
23549
- version: state3.pathCacheVersion
23647
+ version: state2.pathCacheVersion
23550
23648
  });
23551
23649
  }
23552
- function rebuildSegmentTablePreservingNodeIds(state3) {
23553
- const previousSegmentTable = state3.snapshot.segmentTable;
23650
+ function rebuildSegmentTablePreservingNodeIds(state2) {
23651
+ const previousSegmentTable = state2.snapshot.segmentTable;
23554
23652
  const nextSegmentTable = createSegmentTable();
23555
- for (const node of state3.snapshot.nodes) {
23653
+ for (const node of state2.snapshot.nodes) {
23556
23654
  if (!isLiveNode(node)) continue;
23557
23655
  if (hasNodeFlag(node, 2)) {
23558
23656
  node.nameId = 0;
@@ -23560,75 +23658,75 @@ function rebuildSegmentTablePreservingNodeIds(state3) {
23560
23658
  }
23561
23659
  node.nameId = internSegment(nextSegmentTable, getSegmentValue(previousSegmentTable, node.nameId));
23562
23660
  }
23563
- state3.snapshot.segmentTable = nextSegmentTable;
23661
+ state2.snapshot.segmentTable = nextSegmentTable;
23564
23662
  }
23565
- function rebuildDirectoryIndexes(state3) {
23566
- for (const [directoryId, directoryIndex] of state3.snapshot.directories) {
23567
- const directoryNode = state3.snapshot.nodes[directoryId];
23663
+ function rebuildDirectoryIndexes(state2) {
23664
+ for (const [directoryId, directoryIndex] of state2.snapshot.directories) {
23665
+ const directoryNode = state2.snapshot.nodes[directoryId];
23568
23666
  if (!isLiveNode(directoryNode) || !isDirectoryNode(directoryNode)) {
23569
- state3.snapshot.directories.delete(directoryId);
23667
+ state2.snapshot.directories.delete(directoryId);
23570
23668
  continue;
23571
23669
  }
23572
23670
  const liveChildIds = directoryIndex.childIds.filter((childId) => {
23573
- const childNode = state3.snapshot.nodes[childId];
23671
+ const childNode = state2.snapshot.nodes[childId];
23574
23672
  return isLiveNode(childNode) && childNode.parentId === directoryId;
23575
23673
  });
23576
23674
  directoryIndex.childIds = liveChildIds;
23577
- directoryIndex.childIdByNameId = new Map(liveChildIds.map((childId) => [requireNode(state3, childId).nameId, childId]));
23675
+ directoryIndex.childIdByNameId = new Map(liveChildIds.map((childId) => [requireNode(state2, childId).nameId, childId]));
23578
23676
  directoryIndex.childPositionById = new Map(liveChildIds.map((childId, childIndex) => [childId, childIndex]));
23579
- rebuildDirectoryChildAggregates(state3.snapshot.nodes, directoryIndex);
23677
+ rebuildDirectoryChildAggregates(state2.snapshot.nodes, directoryIndex);
23580
23678
  }
23581
23679
  }
23582
- function trimTrailingRemovedNodeSlots(state3) {
23583
- let lastNodeIndex = state3.snapshot.nodes.length - 1;
23584
- while (lastNodeIndex > state3.snapshot.rootId) {
23585
- const node = state3.snapshot.nodes[lastNodeIndex];
23680
+ function trimTrailingRemovedNodeSlots(state2) {
23681
+ let lastNodeIndex = state2.snapshot.nodes.length - 1;
23682
+ while (lastNodeIndex > state2.snapshot.rootId) {
23683
+ const node = state2.snapshot.nodes[lastNodeIndex];
23586
23684
  if (isLiveNode(node)) break;
23587
23685
  lastNodeIndex -= 1;
23588
23686
  }
23589
- state3.snapshot.nodes.length = lastNodeIndex + 1;
23590
- }
23591
- function runStableCleanup(state3) {
23592
- const persistedExpansionState = collectExpansionOverridePaths(state3);
23593
- const persistedLoadInfos = collectDirectoryLoadInfos(state3);
23594
- withBenchmarkPhase(state3.instrumentation, "store.cleanup.stable.clearPathCaches", () => clearPathCaches(state3));
23595
- withBenchmarkPhase(state3.instrumentation, "store.cleanup.stable.rebuildSegmentTable", () => rebuildSegmentTablePreservingNodeIds(state3));
23596
- withBenchmarkPhase(state3.instrumentation, "store.cleanup.stable.rebuildDirectoryIndexes", () => rebuildDirectoryIndexes(state3));
23597
- withBenchmarkPhase(state3.instrumentation, "store.cleanup.stable.trimTrailingRemovedNodeSlots", () => trimTrailingRemovedNodeSlots(state3));
23598
- withBenchmarkPhase(state3.instrumentation, "store.cleanup.stable.restoreExpansionOverrides", () => restoreExpansionOverridePaths(state3, persistedExpansionState));
23599
- withBenchmarkPhase(state3.instrumentation, "store.cleanup.stable.restoreDirectoryLoadInfos", () => restoreDirectoryLoadInfos(state3, persistedLoadInfos));
23600
- withBenchmarkPhase(state3.instrumentation, "store.cleanup.stable.recomputeCounts", () => recomputeCountsRecursive(state3, state3.snapshot.rootId));
23601
- }
23602
- function runAggressiveCleanup(state3) {
23603
- const persistedExpansionState = collectExpansionOverridePaths(state3);
23604
- const persistedLoadInfos = collectDirectoryLoadInfos(state3);
23605
- const canonicalPaths = withBenchmarkPhase(state3.instrumentation, "store.cleanup.aggressive.listPaths", () => listPaths(state3));
23606
- const builderOptions = attachBenchmarkInstrumentation({ ...state3.snapshot.options }, state3.instrumentation);
23607
- const rebuiltSnapshot = withBenchmarkPhase(state3.instrumentation, "store.cleanup.aggressive.rebuildSnapshot", () => {
23687
+ state2.snapshot.nodes.length = lastNodeIndex + 1;
23688
+ }
23689
+ function runStableCleanup(state2) {
23690
+ const persistedExpansionState = collectExpansionOverridePaths(state2);
23691
+ const persistedLoadInfos = collectDirectoryLoadInfos(state2);
23692
+ withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.clearPathCaches", () => clearPathCaches(state2));
23693
+ withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.rebuildSegmentTable", () => rebuildSegmentTablePreservingNodeIds(state2));
23694
+ withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.rebuildDirectoryIndexes", () => rebuildDirectoryIndexes(state2));
23695
+ withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.trimTrailingRemovedNodeSlots", () => trimTrailingRemovedNodeSlots(state2));
23696
+ withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.restoreExpansionOverrides", () => restoreExpansionOverridePaths(state2, persistedExpansionState));
23697
+ withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.restoreDirectoryLoadInfos", () => restoreDirectoryLoadInfos(state2, persistedLoadInfos));
23698
+ withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.recomputeCounts", () => recomputeCountsRecursive(state2, state2.snapshot.rootId));
23699
+ }
23700
+ function runAggressiveCleanup(state2) {
23701
+ const persistedExpansionState = collectExpansionOverridePaths(state2);
23702
+ const persistedLoadInfos = collectDirectoryLoadInfos(state2);
23703
+ const canonicalPaths = withBenchmarkPhase(state2.instrumentation, "store.cleanup.aggressive.listPaths", () => listPaths(state2));
23704
+ const builderOptions = attachBenchmarkInstrumentation({ ...state2.snapshot.options }, state2.instrumentation);
23705
+ const rebuiltSnapshot = withBenchmarkPhase(state2.instrumentation, "store.cleanup.aggressive.rebuildSnapshot", () => {
23608
23706
  const builder = new PathStoreBuilder(builderOptions);
23609
23707
  builder.appendPaths(canonicalPaths);
23610
23708
  return builder.finish();
23611
23709
  });
23612
- state3.snapshot = rebuiltSnapshot;
23613
- state3.activeNodeCount = rebuiltSnapshot.nodes.length - 1;
23614
- state3.pathCacheByNodeId = /* @__PURE__ */ new Map([[rebuiltSnapshot.rootId, {
23710
+ state2.snapshot = rebuiltSnapshot;
23711
+ state2.activeNodeCount = rebuiltSnapshot.nodes.length - 1;
23712
+ state2.pathCacheByNodeId = /* @__PURE__ */ new Map([[rebuiltSnapshot.rootId, {
23615
23713
  path: "",
23616
23714
  version: 0
23617
23715
  }]]);
23618
- state3.pathCacheVersion = 0;
23619
- withBenchmarkPhase(state3.instrumentation, "store.cleanup.aggressive.restoreExpansionOverrides", () => restoreExpansionOverridePaths(state3, persistedExpansionState));
23620
- withBenchmarkPhase(state3.instrumentation, "store.cleanup.aggressive.restoreDirectoryLoadInfos", () => restoreDirectoryLoadInfos(state3, persistedLoadInfos));
23621
- withBenchmarkPhase(state3.instrumentation, "store.cleanup.aggressive.recomputeCounts", () => recomputeCountsRecursive(state3, state3.snapshot.rootId));
23716
+ state2.pathCacheVersion = 0;
23717
+ withBenchmarkPhase(state2.instrumentation, "store.cleanup.aggressive.restoreExpansionOverrides", () => restoreExpansionOverridePaths(state2, persistedExpansionState));
23718
+ withBenchmarkPhase(state2.instrumentation, "store.cleanup.aggressive.restoreDirectoryLoadInfos", () => restoreDirectoryLoadInfos(state2, persistedLoadInfos));
23719
+ withBenchmarkPhase(state2.instrumentation, "store.cleanup.aggressive.recomputeCounts", () => recomputeCountsRecursive(state2, state2.snapshot.rootId));
23622
23720
  }
23623
- function hasActiveCleanupBlockingLoads(state3) {
23624
- for (const loadInfo of state3.directoryLoadInfoById.values()) if (loadInfo.state === "loading" && loadInfo.activeAttemptId != null) return true;
23721
+ function hasActiveCleanupBlockingLoads(state2) {
23722
+ for (const loadInfo of state2.directoryLoadInfoById.values()) if (loadInfo.state === "loading" && loadInfo.activeAttemptId != null) return true;
23625
23723
  return false;
23626
23724
  }
23627
- function cleanupPathStoreState(state3, mode2) {
23628
- const before = createCleanupMetricSnapshot(state3);
23629
- if (mode2 === "stable") withBenchmarkPhase(state3.instrumentation, "store.cleanup.stable", () => runStableCleanup(state3));
23630
- else withBenchmarkPhase(state3.instrumentation, "store.cleanup.aggressive", () => runAggressiveCleanup(state3));
23631
- const after = createCleanupMetricSnapshot(state3);
23725
+ function cleanupPathStoreState(state2, mode2) {
23726
+ const before = createCleanupMetricSnapshot(state2);
23727
+ if (mode2 === "stable") withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable", () => runStableCleanup(state2));
23728
+ else withBenchmarkPhase(state2.instrumentation, "store.cleanup.aggressive", () => runAggressiveCleanup(state2));
23729
+ const after = createCleanupMetricSnapshot(state2);
23632
23730
  return createCleanupResult(mode2, mode2 === "stable", before, after);
23633
23731
  }
23634
23732
 
@@ -23644,33 +23742,33 @@ function ensureProjectionDepthCapacity(depthTable, depth) {
23644
23742
  nextDepthTable.set(depthTable);
23645
23743
  return nextDepthTable;
23646
23744
  }
23647
- function getVisibleCount(state3) {
23648
- return requireNode(state3, state3.snapshot.rootId).visibleSubtreeCount;
23745
+ function getVisibleCount(state2) {
23746
+ return requireNode(state2, state2.snapshot.rootId).visibleSubtreeCount;
23649
23747
  }
23650
- function getVisibleRowSubtreeEndIndex(state3, cursor, index, totalVisibleCount) {
23651
- const terminalNode = requireNode(state3, cursor.terminalNodeId);
23748
+ function getVisibleRowSubtreeEndIndex(state2, cursor, index, totalVisibleCount) {
23749
+ const terminalNode = requireNode(state2, cursor.terminalNodeId);
23652
23750
  const subtreeSize = Math.max(1, terminalNode.visibleSubtreeCount);
23653
23751
  return Math.min(totalVisibleCount - 1, index + subtreeSize - 1);
23654
23752
  }
23655
- function materializeVisibleAncestorRow(state3, entry, totalVisibleCount, ancestorPaths) {
23753
+ function materializeVisibleAncestorRow(state2, entry, totalVisibleCount, ancestorPaths) {
23656
23754
  return {
23657
23755
  ancestorPaths,
23658
23756
  index: entry.index,
23659
23757
  posInSet: entry.posInSet,
23660
- row: materializeVisibleRow(state3, entry.cursor),
23758
+ row: materializeVisibleRow(state2, entry.cursor),
23661
23759
  setSize: entry.setSize,
23662
- subtreeEndIndex: getVisibleRowSubtreeEndIndex(state3, entry.cursor, entry.index, totalVisibleCount)
23760
+ subtreeEndIndex: getVisibleRowSubtreeEndIndex(state2, entry.cursor, entry.index, totalVisibleCount)
23663
23761
  };
23664
23762
  }
23665
- function selectVisibleRowContextWithinDirectory(state3, directoryNodeId, index, directoryStartIndex, parentVisibleDepth, ancestors2) {
23666
- const directoryIndex = getDirectoryIndex(state3, directoryNodeId);
23667
- const { childIndex, childVisibleIndex, localVisibleIndex } = selectChildIndexByVisibleIndex(state3.snapshot.nodes, directoryIndex, index);
23763
+ function selectVisibleRowContextWithinDirectory(state2, directoryNodeId, index, directoryStartIndex, parentVisibleDepth, ancestors2) {
23764
+ const directoryIndex = getDirectoryIndex(state2, directoryNodeId);
23765
+ const { childIndex, childVisibleIndex, localVisibleIndex } = selectChildIndexByVisibleIndex(state2.snapshot.nodes, directoryIndex, index);
23668
23766
  const childId = directoryIndex.childIds[childIndex];
23669
23767
  if (childId == null) throw new Error(`Visible index ${String(index)} is out of range`);
23670
- return selectVisibleRowContextWithinSubtree(state3, childId, localVisibleIndex, directoryStartIndex + childVisibleIndex, parentVisibleDepth + 1, childIndex, directoryIndex.childIds.length, ancestors2);
23768
+ return selectVisibleRowContextWithinSubtree(state2, childId, localVisibleIndex, directoryStartIndex + childVisibleIndex, parentVisibleDepth + 1, childIndex, directoryIndex.childIds.length, ancestors2);
23671
23769
  }
23672
- function selectVisibleRowContextWithinSubtree(state3, nodeId, index, rowIndex, visibleDepth, posInSet, setSize, ancestors2) {
23673
- if (!isDirectoryNode(requireNode(state3, nodeId))) {
23770
+ function selectVisibleRowContextWithinSubtree(state2, nodeId, index, rowIndex, visibleDepth, posInSet, setSize, ancestors2) {
23771
+ if (!isDirectoryNode(requireNode(state2, nodeId))) {
23674
23772
  if (index === 0) return {
23675
23773
  ancestors: ancestors2,
23676
23774
  cursor: {
@@ -23684,7 +23782,7 @@ function selectVisibleRowContextWithinSubtree(state3, nodeId, index, rowIndex, v
23684
23782
  };
23685
23783
  throw new Error(`Visible index ${String(index)} is out of range for file`);
23686
23784
  }
23687
- const currentCursor = createVisibleRowCursor(state3, nodeId, visibleDepth);
23785
+ const currentCursor = createVisibleRowCursor(state2, nodeId, visibleDepth);
23688
23786
  if (index === 0) return {
23689
23787
  ancestors: ancestors2,
23690
23788
  cursor: currentCursor,
@@ -23692,20 +23790,20 @@ function selectVisibleRowContextWithinSubtree(state3, nodeId, index, rowIndex, v
23692
23790
  posInSet,
23693
23791
  setSize
23694
23792
  };
23695
- const terminalNode = requireNode(state3, currentCursor.terminalNodeId);
23696
- if (!isDirectoryNode(terminalNode) || !isDirectoryExpanded(state3, currentCursor.terminalNodeId, terminalNode)) throw new Error(`Visible index ${String(index)} is out of range for collapsed directory`);
23697
- return selectVisibleRowContextWithinDirectory(state3, currentCursor.terminalNodeId, index - 1, rowIndex + 1, currentCursor.visibleDepth, [...ancestors2, {
23793
+ const terminalNode = requireNode(state2, currentCursor.terminalNodeId);
23794
+ if (!isDirectoryNode(terminalNode) || !isDirectoryExpanded(state2, currentCursor.terminalNodeId, terminalNode)) throw new Error(`Visible index ${String(index)} is out of range for collapsed directory`);
23795
+ return selectVisibleRowContextWithinDirectory(state2, currentCursor.terminalNodeId, index - 1, rowIndex + 1, currentCursor.visibleDepth, [...ancestors2, {
23698
23796
  cursor: currentCursor,
23699
23797
  index: rowIndex,
23700
23798
  posInSet,
23701
23799
  setSize
23702
23800
  }]);
23703
23801
  }
23704
- function getVisibleRowContext(state3, index) {
23705
- const totalVisibleCount = getVisibleCount(state3);
23802
+ function getVisibleRowContext(state2, index) {
23803
+ const totalVisibleCount = getVisibleCount(state2);
23706
23804
  if (index < 0 || index >= totalVisibleCount) return null;
23707
- const selected = selectVisibleRowContextWithinDirectory(state3, state3.snapshot.rootId, index, 0, -1, []);
23708
- const ancestorPaths = selected.ancestors.map((ancestor) => materializeNodePath(state3, ancestor.cursor.terminalNodeId));
23805
+ const selected = selectVisibleRowContextWithinDirectory(state2, state2.snapshot.rootId, index, 0, -1, []);
23806
+ const ancestorPaths = selected.ancestors.map((ancestor) => materializeNodePath(state2, ancestor.cursor.terminalNodeId));
23709
23807
  let cachedAncestorRows = null;
23710
23808
  return {
23711
23809
  ancestorPaths,
@@ -23714,7 +23812,7 @@ function getVisibleRowContext(state3, index) {
23714
23812
  const ancestorRows = [];
23715
23813
  const rowAncestorPaths = [];
23716
23814
  for (const ancestor of selected.ancestors) {
23717
- const ancestorRow = materializeVisibleAncestorRow(state3, ancestor, totalVisibleCount, [...rowAncestorPaths]);
23815
+ const ancestorRow = materializeVisibleAncestorRow(state2, ancestor, totalVisibleCount, [...rowAncestorPaths]);
23718
23816
  ancestorRows.push(ancestorRow);
23719
23817
  rowAncestorPaths.push(ancestorRow.row.path);
23720
23818
  }
@@ -23723,121 +23821,121 @@ function getVisibleRowContext(state3, index) {
23723
23821
  },
23724
23822
  index: selected.index,
23725
23823
  posInSet: selected.posInSet,
23726
- row: materializeVisibleRow(state3, selected.cursor),
23824
+ row: materializeVisibleRow(state2, selected.cursor),
23727
23825
  setSize: selected.setSize,
23728
- subtreeEndIndex: getVisibleRowSubtreeEndIndex(state3, selected.cursor, selected.index, totalVisibleCount)
23826
+ subtreeEndIndex: getVisibleRowSubtreeEndIndex(state2, selected.cursor, selected.index, totalVisibleCount)
23729
23827
  };
23730
23828
  }
23731
- function getVisibleSlice(state3, start, end) {
23732
- const instrumentation = state3.instrumentation;
23733
- const totalVisibleCount = getVisibleCount(state3);
23829
+ function getVisibleSlice(state2, start, end) {
23830
+ const instrumentation = state2.instrumentation;
23831
+ const totalVisibleCount = getVisibleCount(state2);
23734
23832
  if (totalVisibleCount <= 0 || end < start) return [];
23735
23833
  const normalizedStart = Math.max(0, Math.min(start, totalVisibleCount - 1));
23736
23834
  const normalizedEnd = Math.max(normalizedStart, Math.min(end, totalVisibleCount - 1));
23737
23835
  if (instrumentation == null) {
23738
- if (normalizedStart === 0) return collectVisibleRowsDFS(state3, normalizedEnd + 1);
23836
+ if (normalizedStart === 0) return collectVisibleRowsDFS(state2, normalizedEnd + 1);
23739
23837
  const rows2 = [];
23740
- let currentCursor2 = selectVisibleRow(state3, normalizedStart);
23838
+ let currentCursor2 = selectVisibleRow(state2, normalizedStart);
23741
23839
  for (let visibleIndex = normalizedStart; visibleIndex <= normalizedEnd && currentCursor2 != null; visibleIndex++) {
23742
- const row = materializeVisibleRow(state3, currentCursor2);
23840
+ const row = materializeVisibleRow(state2, currentCursor2);
23743
23841
  rows2.push(row);
23744
- currentCursor2 = getNextVisibleRowCursor(state3, currentCursor2);
23842
+ currentCursor2 = getNextVisibleRowCursor(state2, currentCursor2);
23745
23843
  }
23746
23844
  return rows2;
23747
23845
  }
23748
23846
  const rows = [];
23749
23847
  let flattenedRowCount = 0;
23750
23848
  let flattenedSegmentCount = 0;
23751
- let currentCursor = withBenchmarkPhase(instrumentation, "store.getVisibleSlice.selectFirstRow", () => selectVisibleRow(state3, normalizedStart));
23849
+ let currentCursor = withBenchmarkPhase(instrumentation, "store.getVisibleSlice.selectFirstRow", () => selectVisibleRow(state2, normalizedStart));
23752
23850
  for (let visibleIndex = normalizedStart; visibleIndex <= normalizedEnd && currentCursor != null; visibleIndex++) {
23753
- const row = withBenchmarkPhase(instrumentation, "store.getVisibleSlice.materializeRow", () => materializeVisibleRow(state3, currentCursor));
23851
+ const row = withBenchmarkPhase(instrumentation, "store.getVisibleSlice.materializeRow", () => materializeVisibleRow(state2, currentCursor));
23754
23852
  rows.push(row);
23755
23853
  if (row.isFlattened) {
23756
23854
  flattenedRowCount++;
23757
23855
  flattenedSegmentCount += row.flattenedSegments?.length ?? 0;
23758
23856
  }
23759
- currentCursor = withBenchmarkPhase(instrumentation, "store.getVisibleSlice.advanceCursor", () => getNextVisibleRowCursor(state3, currentCursor));
23857
+ currentCursor = withBenchmarkPhase(instrumentation, "store.getVisibleSlice.advanceCursor", () => getNextVisibleRowCursor(state2, currentCursor));
23760
23858
  }
23761
23859
  setBenchmarkCounter(instrumentation, "workload.visibleRowsRead", rows.length);
23762
23860
  setBenchmarkCounter(instrumentation, "workload.flattenedRowsRead", flattenedRowCount);
23763
23861
  setBenchmarkCounter(instrumentation, "workload.flattenedSegmentsRead", flattenedSegmentCount);
23764
23862
  return rows;
23765
23863
  }
23766
- function getVisibleTreeProjectionData(state3, maxRows = getVisibleCount(state3)) {
23767
- const instrumentation = state3.instrumentation;
23768
- if (instrumentation == null) return buildVisibleTreeProjectionDataDFS(state3, maxRows);
23769
- return withBenchmarkPhase(instrumentation, "store.getVisibleTreeProjection", () => buildVisibleTreeProjectionDataDFS(state3, maxRows));
23864
+ function getVisibleTreeProjectionData(state2, maxRows = getVisibleCount(state2)) {
23865
+ const instrumentation = state2.instrumentation;
23866
+ if (instrumentation == null) return buildVisibleTreeProjectionDataDFS(state2, maxRows);
23867
+ return withBenchmarkPhase(instrumentation, "store.getVisibleTreeProjection", () => buildVisibleTreeProjectionDataDFS(state2, maxRows));
23770
23868
  }
23771
- function getVisibleTreeProjection(state3) {
23772
- return createVisibleTreeProjectionFromData(getVisibleTreeProjectionData(state3));
23869
+ function getVisibleTreeProjection(state2) {
23870
+ return createVisibleTreeProjectionFromData(getVisibleTreeProjectionData(state2));
23773
23871
  }
23774
- function getVisibleIndexByPath(state3, path) {
23775
- const nodeId = findNodeId(state3, path);
23776
- if (nodeId == null || nodeId === state3.snapshot.rootId) return null;
23777
- if (isDirectoryNode(requireNode(state3, nodeId)) && getFlattenedTerminalDirectoryId(state3, nodeId) !== nodeId) return null;
23872
+ function getVisibleIndexByPath(state2, path) {
23873
+ const nodeId = findNodeId(state2, path);
23874
+ if (nodeId == null || nodeId === state2.snapshot.rootId) return null;
23875
+ if (isDirectoryNode(requireNode(state2, nodeId)) && getFlattenedTerminalDirectoryId(state2, nodeId) !== nodeId) return null;
23778
23876
  let visibleIndex = 0;
23779
23877
  let currentNodeId = nodeId;
23780
- const { nodes, rootId } = state3.snapshot;
23878
+ const { nodes, rootId } = state2.snapshot;
23781
23879
  while (currentNodeId !== rootId) {
23782
- const parentId = requireNode(state3, currentNodeId).parentId;
23783
- const parentIndex = getDirectoryIndex(state3, parentId);
23880
+ const parentId = requireNode(state2, currentNodeId).parentId;
23881
+ const parentIndex = getDirectoryIndex(state2, parentId);
23784
23882
  const childPosition = ensureChildPositions(parentIndex).get(currentNodeId);
23785
23883
  if (childPosition == null) throw new Error(`Child ${String(currentNodeId)} was not found in its parent index`);
23786
23884
  visibleIndex += getVisibleChildPrefixCount(nodes, parentIndex, childPosition);
23787
23885
  if (parentId !== rootId) {
23788
- const parentNode = requireNode(state3, parentId);
23789
- const flattenedChildDirectoryId = getFlattenedChildDirectoryId(state3, parentId);
23790
- if (!isDirectoryExpanded(state3, parentId, parentNode) && flattenedChildDirectoryId !== currentNodeId) return null;
23791
- if (getFlattenedTerminalDirectoryId(state3, parentId) === parentId) visibleIndex += 1;
23886
+ const parentNode = requireNode(state2, parentId);
23887
+ const flattenedChildDirectoryId = getFlattenedChildDirectoryId(state2, parentId);
23888
+ if (!isDirectoryExpanded(state2, parentId, parentNode) && flattenedChildDirectoryId !== currentNodeId) return null;
23889
+ if (getFlattenedTerminalDirectoryId(state2, parentId) === parentId) visibleIndex += 1;
23792
23890
  }
23793
23891
  currentNodeId = parentId;
23794
23892
  }
23795
23893
  return visibleIndex;
23796
23894
  }
23797
- function expandPath(state3, path) {
23798
- const directoryNodeId = findNodeId(state3, path);
23895
+ function expandPath(state2, path) {
23896
+ const directoryNodeId = findNodeId(state2, path);
23799
23897
  if (directoryNodeId == null) throw new Error(`Path does not exist: "${path}"`);
23800
- const directoryNode = requireNode(state3, directoryNodeId);
23898
+ const directoryNode = requireNode(state2, directoryNodeId);
23801
23899
  if (!isDirectoryNode(directoryNode)) throw new Error(`Path is not a directory: "${path}"`);
23802
- if (isDirectoryExpanded(state3, directoryNodeId, directoryNode)) return null;
23803
- setDirectoryExpanded(state3, directoryNodeId, true, directoryNode);
23804
- recomputeCountsUpwardFrom(state3, directoryNodeId);
23900
+ if (isDirectoryExpanded(state2, directoryNodeId, directoryNode)) return null;
23901
+ setDirectoryExpanded(state2, directoryNodeId, true, directoryNode);
23902
+ recomputeCountsUpwardFrom(state2, directoryNodeId);
23805
23903
  return createExpandEvent({
23806
- affectedAncestorIds: collectAncestorIds(state3, directoryNodeId),
23904
+ affectedAncestorIds: collectAncestorIds(state2, directoryNodeId),
23807
23905
  affectedNodeIds: [directoryNodeId],
23808
23906
  path,
23809
23907
  projectionChanged: true
23810
23908
  });
23811
23909
  }
23812
- function collapsePath(state3, path) {
23813
- const directoryNodeId = findNodeId(state3, path);
23910
+ function collapsePath(state2, path) {
23911
+ const directoryNodeId = findNodeId(state2, path);
23814
23912
  if (directoryNodeId == null) throw new Error(`Path does not exist: "${path}"`);
23815
- const directoryNode = requireNode(state3, directoryNodeId);
23913
+ const directoryNode = requireNode(state2, directoryNodeId);
23816
23914
  if (!isDirectoryNode(directoryNode)) throw new Error(`Path is not a directory: "${path}"`);
23817
- if (!isDirectoryExpanded(state3, directoryNodeId, directoryNode)) return null;
23818
- setDirectoryExpanded(state3, directoryNodeId, false, directoryNode);
23819
- recomputeCountsUpwardFrom(state3, directoryNodeId);
23915
+ if (!isDirectoryExpanded(state2, directoryNodeId, directoryNode)) return null;
23916
+ setDirectoryExpanded(state2, directoryNodeId, false, directoryNode);
23917
+ recomputeCountsUpwardFrom(state2, directoryNodeId);
23820
23918
  return createCollapseEvent({
23821
- affectedAncestorIds: collectAncestorIds(state3, directoryNodeId),
23919
+ affectedAncestorIds: collectAncestorIds(state2, directoryNodeId),
23822
23920
  affectedNodeIds: [directoryNodeId],
23823
23921
  path,
23824
23922
  projectionChanged: true
23825
23923
  });
23826
23924
  }
23827
- function selectVisibleRow(state3, index) {
23828
- if (index < 0 || index >= getVisibleCount(state3)) return null;
23829
- return selectVisibleRowWithinDirectory(state3, state3.snapshot.rootId, index, -1);
23925
+ function selectVisibleRow(state2, index) {
23926
+ if (index < 0 || index >= getVisibleCount(state2)) return null;
23927
+ return selectVisibleRowWithinDirectory(state2, state2.snapshot.rootId, index, -1);
23830
23928
  }
23831
- function selectVisibleRowWithinDirectory(state3, directoryNodeId, index, parentVisibleDepth) {
23832
- const directoryIndex = getDirectoryIndex(state3, directoryNodeId);
23833
- const instrumentation = state3.instrumentation;
23834
- const { childIndex, localVisibleIndex } = instrumentation == null ? selectChildIndexByVisibleIndex(state3.snapshot.nodes, directoryIndex, index) : withBenchmarkPhase(instrumentation, "store.getVisibleSlice.selectChildIndex", () => selectChildIndexByVisibleIndex(state3.snapshot.nodes, directoryIndex, index));
23929
+ function selectVisibleRowWithinDirectory(state2, directoryNodeId, index, parentVisibleDepth) {
23930
+ const directoryIndex = getDirectoryIndex(state2, directoryNodeId);
23931
+ const instrumentation = state2.instrumentation;
23932
+ const { childIndex, localVisibleIndex } = instrumentation == null ? selectChildIndexByVisibleIndex(state2.snapshot.nodes, directoryIndex, index) : withBenchmarkPhase(instrumentation, "store.getVisibleSlice.selectChildIndex", () => selectChildIndexByVisibleIndex(state2.snapshot.nodes, directoryIndex, index));
23835
23933
  const childId = directoryIndex.childIds[childIndex];
23836
- if (childId != null) return selectVisibleRowWithinSubtree(state3, childId, localVisibleIndex, parentVisibleDepth + 1);
23934
+ if (childId != null) return selectVisibleRowWithinSubtree(state2, childId, localVisibleIndex, parentVisibleDepth + 1);
23837
23935
  throw new Error(`Visible index ${String(index)} is out of range`);
23838
23936
  }
23839
- function selectVisibleRowWithinSubtree(state3, nodeId, index, visibleDepth) {
23840
- if (!isDirectoryNode(requireNode(state3, nodeId))) {
23937
+ function selectVisibleRowWithinSubtree(state2, nodeId, index, visibleDepth) {
23938
+ if (!isDirectoryNode(requireNode(state2, nodeId))) {
23841
23939
  if (index === 0) return {
23842
23940
  headNodeId: nodeId,
23843
23941
  terminalNodeId: nodeId,
@@ -23845,57 +23943,57 @@ function selectVisibleRowWithinSubtree(state3, nodeId, index, visibleDepth) {
23845
23943
  };
23846
23944
  throw new Error(`Visible index ${String(index)} is out of range for file`);
23847
23945
  }
23848
- const currentCursor = createVisibleRowCursor(state3, nodeId, visibleDepth);
23946
+ const currentCursor = createVisibleRowCursor(state2, nodeId, visibleDepth);
23849
23947
  if (index === 0) return currentCursor;
23850
- const terminalNode = requireNode(state3, currentCursor.terminalNodeId);
23851
- if (!isDirectoryNode(terminalNode) || !isDirectoryExpanded(state3, currentCursor.terminalNodeId, terminalNode)) throw new Error(`Visible index ${String(index)} is out of range for collapsed directory`);
23852
- return selectVisibleRowWithinDirectory(state3, currentCursor.terminalNodeId, index - 1, currentCursor.visibleDepth);
23948
+ const terminalNode = requireNode(state2, currentCursor.terminalNodeId);
23949
+ if (!isDirectoryNode(terminalNode) || !isDirectoryExpanded(state2, currentCursor.terminalNodeId, terminalNode)) throw new Error(`Visible index ${String(index)} is out of range for collapsed directory`);
23950
+ return selectVisibleRowWithinDirectory(state2, currentCursor.terminalNodeId, index - 1, currentCursor.visibleDepth);
23853
23951
  }
23854
- function createVisibleRowCursor(state3, nodeId, visibleDepth) {
23855
- if (!isDirectoryNode(requireNode(state3, nodeId))) return {
23952
+ function createVisibleRowCursor(state2, nodeId, visibleDepth) {
23953
+ if (!isDirectoryNode(requireNode(state2, nodeId))) return {
23856
23954
  headNodeId: nodeId,
23857
23955
  terminalNodeId: nodeId,
23858
23956
  visibleDepth
23859
23957
  };
23860
- if (state3.instrumentation == null) return {
23958
+ if (state2.instrumentation == null) return {
23861
23959
  headNodeId: nodeId,
23862
- terminalNodeId: getFlattenedTerminalDirectoryId(state3, nodeId),
23960
+ terminalNodeId: getFlattenedTerminalDirectoryId(state2, nodeId),
23863
23961
  visibleDepth
23864
23962
  };
23865
23963
  return {
23866
23964
  headNodeId: nodeId,
23867
- terminalNodeId: withBenchmarkPhase(state3.instrumentation, "store.getVisibleSlice.flatten.resolveTerminalDirectory", () => getFlattenedTerminalDirectoryId(state3, nodeId)),
23965
+ terminalNodeId: withBenchmarkPhase(state2.instrumentation, "store.getVisibleSlice.flatten.resolveTerminalDirectory", () => getFlattenedTerminalDirectoryId(state2, nodeId)),
23868
23966
  visibleDepth
23869
23967
  };
23870
23968
  }
23871
- function isVisibleRowHeadNode(state3, nodeId) {
23872
- const node = requireNode(state3, nodeId);
23969
+ function isVisibleRowHeadNode(state2, nodeId) {
23970
+ const node = requireNode(state2, nodeId);
23873
23971
  if (!isDirectoryNode(node)) return true;
23874
23972
  const parentId = node.parentId;
23875
- if (parentId === state3.snapshot.rootId) return true;
23876
- return getFlattenedChildDirectoryId(state3, parentId) !== nodeId;
23973
+ if (parentId === state2.snapshot.rootId) return true;
23974
+ return getFlattenedChildDirectoryId(state2, parentId) !== nodeId;
23877
23975
  }
23878
- function getNextVisibleRowCursor(state3, currentCursor) {
23879
- const terminalNode = requireNode(state3, currentCursor.terminalNodeId);
23976
+ function getNextVisibleRowCursor(state2, currentCursor) {
23977
+ const terminalNode = requireNode(state2, currentCursor.terminalNodeId);
23880
23978
  if (isDirectoryNode(terminalNode)) {
23881
- const currentIndex = getDirectoryIndex(state3, currentCursor.terminalNodeId);
23882
- if (isDirectoryExpanded(state3, currentCursor.terminalNodeId, terminalNode) && currentIndex.childIds.length > 0) {
23979
+ const currentIndex = getDirectoryIndex(state2, currentCursor.terminalNodeId);
23980
+ if (isDirectoryExpanded(state2, currentCursor.terminalNodeId, terminalNode) && currentIndex.childIds.length > 0) {
23883
23981
  const firstChildId = currentIndex.childIds[0];
23884
- return firstChildId == null ? null : selectVisibleRowWithinSubtree(state3, firstChildId, 0, currentCursor.visibleDepth + 1);
23982
+ return firstChildId == null ? null : selectVisibleRowWithinSubtree(state2, firstChildId, 0, currentCursor.visibleDepth + 1);
23885
23983
  }
23886
23984
  }
23887
23985
  let currentNodeId = currentCursor.terminalNodeId;
23888
23986
  let currentVisibleDepth = currentCursor.visibleDepth;
23889
23987
  while (true) {
23890
- const currentNode = requireNode(state3, currentNodeId);
23891
- if (currentNodeId === state3.snapshot.rootId) return null;
23988
+ const currentNode = requireNode(state2, currentNodeId);
23989
+ if (currentNodeId === state2.snapshot.rootId) return null;
23892
23990
  const parentId = currentNode.parentId;
23893
- const parentIndex = getDirectoryIndex(state3, parentId);
23991
+ const parentIndex = getDirectoryIndex(state2, parentId);
23894
23992
  const siblingIndex = ensureChildPositions(parentIndex).get(currentNodeId) ?? -1;
23895
23993
  if (siblingIndex < 0) throw new Error(`Child ${String(currentNodeId)} was not found in its parent index`);
23896
23994
  const nextSiblingId = parentIndex.childIds[siblingIndex + 1] ?? null;
23897
- if (nextSiblingId != null) return selectVisibleRowWithinSubtree(state3, nextSiblingId, 0, currentVisibleDepth);
23898
- if (isVisibleRowHeadNode(state3, currentNodeId)) currentVisibleDepth--;
23995
+ if (nextSiblingId != null) return selectVisibleRowWithinSubtree(state2, nextSiblingId, 0, currentVisibleDepth);
23996
+ if (isVisibleRowHeadNode(state2, currentNodeId)) currentVisibleDepth--;
23899
23997
  currentNodeId = parentId;
23900
23998
  }
23901
23999
  }
@@ -23920,7 +24018,7 @@ function createVisibleTreeProjectionFromData(projection) {
23920
24018
  }
23921
24019
  };
23922
24020
  }
23923
- function buildVisibleTreeProjectionDataDFS(state3, maxRows) {
24021
+ function buildVisibleTreeProjectionDataDFS(state2, maxRows) {
23924
24022
  const paths = new Array(maxRows);
23925
24023
  const parentRowIndex = new Int32Array(maxRows);
23926
24024
  const posInSetByIndex = new Int32Array(maxRows);
@@ -23928,16 +24026,16 @@ function buildVisibleTreeProjectionDataDFS(state3, maxRows) {
23928
24026
  let lastRowAtDepth = new Int32Array(INITIAL_PROJECTION_DEPTH_CAPACITY);
23929
24027
  lastRowAtDepth.fill(-1);
23930
24028
  let rowCount = 0;
23931
- const { nodes, directories, segmentTable } = state3.snapshot;
24029
+ const { nodes, directories, segmentTable } = state2.snapshot;
23932
24030
  const stack = [[
23933
- directories.get(state3.snapshot.rootId),
24031
+ directories.get(state2.snapshot.rootId),
23934
24032
  0,
23935
24033
  -1,
23936
24034
  ""
23937
24035
  ]];
23938
- const flattenEnabled = state3.snapshot.options.flattenEmptyDirectories;
23939
- const pathCacheByNodeId = state3.pathCacheByNodeId;
23940
- const pathCacheVersion = state3.pathCacheVersion;
24036
+ const flattenEnabled = state2.snapshot.options.flattenEmptyDirectories;
24037
+ const pathCacheByNodeId = state2.pathCacheByNodeId;
24038
+ const pathCacheVersion = state2.pathCacheVersion;
23941
24039
  const segmentValues = segmentTable.valueById;
23942
24040
  while (stack.length > 0 && rowCount < maxRows) {
23943
24041
  const frame = stack[stack.length - 1];
@@ -23958,8 +24056,8 @@ function buildVisibleTreeProjectionDataDFS(state3, maxRows) {
23958
24056
  const cachedPathEntry = pathCacheByNodeId.get(childId);
23959
24057
  path = cachedPathEntry != null && cachedPathEntry.version === pathCacheVersion ? cachedPathEntry.path : `${parentPath}${segmentValues[childNode.nameId]}`;
23960
24058
  } else {
23961
- terminalNodeId = flattenEnabled ? getFlattenedTerminalDirectoryId(state3, childId) : childId;
23962
- path = terminalNodeId === childId ? `${parentPath}${segmentValues[childNode.nameId]}/` : materializeNodePath(state3, terminalNodeId);
24059
+ terminalNodeId = flattenEnabled ? getFlattenedTerminalDirectoryId(state2, childId) : childId;
24060
+ path = terminalNodeId === childId ? `${parentPath}${segmentValues[childNode.nameId]}/` : materializeNodePath(state2, terminalNodeId);
23963
24061
  }
23964
24062
  parentRowIndex[rowCount] = lastRowAtDepth[visibleDepth];
23965
24063
  paths[rowCount] = path;
@@ -23968,7 +24066,7 @@ function buildVisibleTreeProjectionDataDFS(state3, maxRows) {
23968
24066
  lastRowAtDepth[visibleDepth + 1] = rowCount;
23969
24067
  rowCount += 1;
23970
24068
  const terminalNode = nodes[terminalNodeId];
23971
- if (terminalNode != null && isDirectoryNode(terminalNode) && isDirectoryExpanded(state3, terminalNodeId, terminalNode)) stack.push([
24069
+ if (terminalNode != null && isDirectoryNode(terminalNode) && isDirectoryExpanded(state2, terminalNodeId, terminalNode)) stack.push([
23972
24070
  directories.get(terminalNodeId),
23973
24071
  0,
23974
24072
  visibleDepth,
@@ -23996,19 +24094,19 @@ function buildVisibleTreeProjectionDataDFS(state3, maxRows) {
23996
24094
  }
23997
24095
  };
23998
24096
  }
23999
- function collectVisibleRowsDFS(state3, maxRows) {
24097
+ function collectVisibleRowsDFS(state2, maxRows) {
24000
24098
  const rows = new Array(maxRows);
24001
24099
  let rowCount = 0;
24002
- const { nodes, directories, segmentTable } = state3.snapshot;
24100
+ const { nodes, directories, segmentTable } = state2.snapshot;
24003
24101
  const stack = [[
24004
- directories.get(state3.snapshot.rootId),
24102
+ directories.get(state2.snapshot.rootId),
24005
24103
  0,
24006
24104
  -1
24007
24105
  ]];
24008
24106
  const segmentValues = segmentTable.valueById;
24009
- const flattenEnabled = state3.snapshot.options.flattenEmptyDirectories;
24010
- const pathCacheByNodeId = state3.pathCacheByNodeId;
24011
- const pathCacheVersion = state3.pathCacheVersion;
24107
+ const flattenEnabled = state2.snapshot.options.flattenEmptyDirectories;
24108
+ const pathCacheByNodeId = state2.pathCacheByNodeId;
24109
+ const pathCacheVersion = state2.pathCacheVersion;
24012
24110
  while (stack.length > 0 && rowCount < maxRows) {
24013
24111
  const frame = stack[stack.length - 1];
24014
24112
  const dirIndex = frame[0];
@@ -24032,19 +24130,19 @@ function collectVisibleRowsDFS(state3, maxRows) {
24032
24130
  kind: "file",
24033
24131
  loadState: void 0,
24034
24132
  name: segmentValues[childNode.nameId],
24035
- path: cachedPathEntry != null && cachedPathEntry.version === pathCacheVersion ? cachedPathEntry.path : materializeNodePath(state3, childId)
24133
+ path: cachedPathEntry != null && cachedPathEntry.version === pathCacheVersion ? cachedPathEntry.path : materializeNodePath(state2, childId)
24036
24134
  };
24037
24135
  continue;
24038
24136
  }
24039
- const terminalNodeId = flattenEnabled ? getFlattenedTerminalDirectoryId(state3, childId) : childId;
24137
+ const terminalNodeId = flattenEnabled ? getFlattenedTerminalDirectoryId(state2, childId) : childId;
24040
24138
  const cursor = {
24041
24139
  headNodeId: childId,
24042
24140
  terminalNodeId,
24043
24141
  visibleDepth
24044
24142
  };
24045
- rows[rowCount++] = materializeVisibleRow(state3, cursor);
24143
+ rows[rowCount++] = materializeVisibleRow(state2, cursor);
24046
24144
  const terminalNode = nodes[terminalNodeId];
24047
- if (terminalNode != null && isDirectoryNode(terminalNode) && isDirectoryExpanded(state3, terminalNodeId, terminalNode)) stack.push([
24145
+ if (terminalNode != null && isDirectoryNode(terminalNode) && isDirectoryExpanded(state2, terminalNodeId, terminalNode)) stack.push([
24048
24146
  directories.get(terminalNodeId),
24049
24147
  0,
24050
24148
  visibleDepth
@@ -24053,29 +24151,29 @@ function collectVisibleRowsDFS(state3, maxRows) {
24053
24151
  if (rowCount < maxRows) rows.length = rowCount;
24054
24152
  return rows;
24055
24153
  }
24056
- function materializeVisibleRow(state3, cursor) {
24057
- const terminalNode = requireNode(state3, cursor.terminalNodeId);
24058
- const loadState = isDirectoryNode(terminalNode) ? getVisibleRowLoadState(state3, cursor) : null;
24059
- const path = materializeNodePath(state3, cursor.terminalNodeId);
24060
- const name = getSegmentValue(state3.snapshot.segmentTable, terminalNode.nameId);
24061
- const hasChildren = isDirectoryNode(terminalNode) && getDirectoryIndex(state3, cursor.terminalNodeId).childIds.length > 0;
24154
+ function materializeVisibleRow(state2, cursor) {
24155
+ const terminalNode = requireNode(state2, cursor.terminalNodeId);
24156
+ const loadState = isDirectoryNode(terminalNode) ? getVisibleRowLoadState(state2, cursor) : null;
24157
+ const path = materializeNodePath(state2, cursor.terminalNodeId);
24158
+ const name = getSegmentValue(state2.snapshot.segmentTable, terminalNode.nameId);
24159
+ const hasChildren = isDirectoryNode(terminalNode) && getDirectoryIndex(state2, cursor.terminalNodeId).childIds.length > 0;
24062
24160
  const isFlattened = cursor.headNodeId !== cursor.terminalNodeId;
24063
- const instrumentation = state3.instrumentation;
24064
- const flattenedSegments = isFlattened ? instrumentation == null ? collectFlattenedDirectoryChainIds(state3, cursor.headNodeId).map((nodeId) => {
24065
- const node = requireNode(state3, nodeId);
24161
+ const instrumentation = state2.instrumentation;
24162
+ const flattenedSegments = isFlattened ? instrumentation == null ? collectFlattenedDirectoryChainIds(state2, cursor.headNodeId).map((nodeId) => {
24163
+ const node = requireNode(state2, nodeId);
24066
24164
  return {
24067
24165
  isTerminal: nodeId === cursor.terminalNodeId,
24068
- name: getSegmentValue(state3.snapshot.segmentTable, node.nameId),
24166
+ name: getSegmentValue(state2.snapshot.segmentTable, node.nameId),
24069
24167
  nodeId,
24070
- path: materializeNodePath(state3, nodeId)
24168
+ path: materializeNodePath(state2, nodeId)
24071
24169
  };
24072
- }) : withBenchmarkPhase(instrumentation, "store.getVisibleSlice.flatten.collectSegments", () => collectFlattenedDirectoryChainIds(state3, cursor.headNodeId).map((nodeId) => {
24073
- const node = requireNode(state3, nodeId);
24170
+ }) : withBenchmarkPhase(instrumentation, "store.getVisibleSlice.flatten.collectSegments", () => collectFlattenedDirectoryChainIds(state2, cursor.headNodeId).map((nodeId) => {
24171
+ const node = requireNode(state2, nodeId);
24074
24172
  return {
24075
24173
  isTerminal: nodeId === cursor.terminalNodeId,
24076
- name: getSegmentValue(state3.snapshot.segmentTable, node.nameId),
24174
+ name: getSegmentValue(state2.snapshot.segmentTable, node.nameId),
24077
24175
  nodeId,
24078
- path: materializeNodePath(state3, nodeId)
24176
+ path: materializeNodePath(state2, nodeId)
24079
24177
  };
24080
24178
  })) : void 0;
24081
24179
  return {
@@ -24083,7 +24181,7 @@ function materializeVisibleRow(state3, cursor) {
24083
24181
  flattenedSegments,
24084
24182
  hasChildren,
24085
24183
  id: cursor.terminalNodeId,
24086
- isExpanded: isDirectoryNode(terminalNode) && isDirectoryExpanded(state3, cursor.terminalNodeId, terminalNode),
24184
+ isExpanded: isDirectoryNode(terminalNode) && isDirectoryExpanded(state2, cursor.terminalNodeId, terminalNode),
24087
24185
  isFlattened,
24088
24186
  isLoading: loadState === "loading",
24089
24187
  kind: isDirectoryNode(terminalNode) ? "directory" : "file",
@@ -24092,13 +24190,13 @@ function materializeVisibleRow(state3, cursor) {
24092
24190
  path
24093
24191
  };
24094
24192
  }
24095
- function getVisibleRowLoadState(state3, cursor) {
24096
- if (cursor.headNodeId === cursor.terminalNodeId) return getDirectoryLoadState(state3, cursor.terminalNodeId);
24097
- const chainNodeIds = collectFlattenedDirectoryChainIds(state3, cursor.headNodeId);
24193
+ function getVisibleRowLoadState(state2, cursor) {
24194
+ if (cursor.headNodeId === cursor.terminalNodeId) return getDirectoryLoadState(state2, cursor.terminalNodeId);
24195
+ const chainNodeIds = collectFlattenedDirectoryChainIds(state2, cursor.headNodeId);
24098
24196
  let hasUnloaded = false;
24099
24197
  let hasError = false;
24100
24198
  for (const nodeId of chainNodeIds) {
24101
- const loadState = getDirectoryLoadState(state3, nodeId);
24199
+ const loadState = getDirectoryLoadState(state2, nodeId);
24102
24200
  if (loadState === "loading") return "loading";
24103
24201
  if (loadState === "error") {
24104
24202
  hasError = true;
@@ -24192,8 +24290,8 @@ function sweepOpenVisibleCountsSoa(store2) {
24192
24290
  }
24193
24291
 
24194
24292
  // node_modules/@pierre/trees/dist/path-store/src/store.js
24195
- function initializeOpenVisibleCounts(state3) {
24196
- const { directories, nodes, options, rootId, presortedDirectoryNodeIds } = state3.snapshot;
24293
+ function initializeOpenVisibleCounts(state2) {
24294
+ const { directories, nodes, options, rootId, presortedDirectoryNodeIds } = state2.snapshot;
24197
24295
  const flattenEmptyDirectories = options.flattenEmptyDirectories === true;
24198
24296
  const walkDirectory = (nodeId) => {
24199
24297
  const currentNode = nodes[nodeId];
@@ -24243,9 +24341,9 @@ function initializeOpenVisibleCounts(state3) {
24243
24341
  rootNode.subtreeNodeCount = 1 + rootTotalChildSubtreeNodeCount;
24244
24342
  rootNode.visibleSubtreeCount = rootTotalChildVisibleSubtreeCount;
24245
24343
  }
24246
- function initializeOpenVisibleCountsViaSoa(state3) {
24247
- const { directories, nodes, rootId } = state3.snapshot;
24248
- const soa = buildSoaNodeStore(state3.snapshot);
24344
+ function initializeOpenVisibleCountsViaSoa(state2) {
24345
+ const { directories, nodes, rootId } = state2.snapshot;
24346
+ const soa = buildSoaNodeStore(state2.snapshot);
24249
24347
  sweepOpenVisibleCountsSoa(soa);
24250
24348
  const subtreeNodeCount = soa.subtreeNodeCount;
24251
24349
  const visibleSubtreeCount = soa.visibleSubtreeCount;
@@ -27369,17 +27467,17 @@ function RenameInput({ ariaLabel, isFlattened = false, ref, value, onBlur, onInp
27369
27467
 
27370
27468
  // node_modules/@pierre/trees/dist/render/rowAttributes.js
27371
27469
  function computeFileTreeRowElementAttributes(input) {
27372
- const { row, mode: mode2, targetPath, ariaLabel, domId, isParked, itemHeight, features, state: state3, extraStyle } = input;
27470
+ const { row, mode: mode2, targetPath, ariaLabel, domId, isParked, itemHeight, features, state: state2, extraStyle } = input;
27373
27471
  const isSticky = mode2 === "sticky";
27374
27472
  const parentPath = row.ancestorPaths.at(-1) ?? "";
27375
27473
  const stateAttributes = {};
27376
- if (state3.isFocusRinged) stateAttributes["data-item-focused"] = true;
27474
+ if (state2.isFocusRinged) stateAttributes["data-item-focused"] = true;
27377
27475
  if (row.isSelected) stateAttributes["data-item-selected"] = true;
27378
- if (state3.isContextHovered) stateAttributes["data-item-context-hover"] = "true";
27379
- if (state3.isDragTarget) stateAttributes["data-item-drag-target"] = true;
27380
- if (state3.isDragging) stateAttributes["data-item-dragging"] = true;
27381
- if (state3.effectiveGitStatus != null) stateAttributes["data-item-git-status"] = state3.effectiveGitStatus;
27382
- if (state3.containsGitChange) stateAttributes["data-item-contains-git-change"] = "true";
27476
+ if (state2.isContextHovered) stateAttributes["data-item-context-hover"] = "true";
27477
+ if (state2.isDragTarget) stateAttributes["data-item-drag-target"] = true;
27478
+ if (state2.isDragging) stateAttributes["data-item-dragging"] = true;
27479
+ if (state2.effectiveGitStatus != null) stateAttributes["data-item-git-status"] = state2.effectiveGitStatus;
27480
+ if (state2.containsGitChange) stateAttributes["data-item-contains-git-change"] = "true";
27383
27481
  return {
27384
27482
  "aria-expanded": !isSticky && row.kind === "directory" ? row.isExpanded : void 0,
27385
27483
  "aria-haspopup": features.contextMenuEnabled ? "menu" : void 0,
@@ -30189,19 +30287,10 @@ var lickLabels = {
30189
30287
  "sudo-request": ["Permission", "notice"]
30190
30288
  };
30191
30289
  var toolStates = {
30192
- running: [
30193
- "Running",
30194
- b`<swc-progress-circle size="s" label="Running" aria-hidden="true"></swc-progress-circle>`
30195
- ],
30196
- done: [
30197
- "Done",
30198
- b`<swc-icon-checkmark-circle size="s" aria-hidden="true"></swc-icon-checkmark-circle>`
30199
- ],
30200
- error: [
30201
- "Failed",
30202
- b`<swc-icon-alert-diamond size="s" aria-hidden="true"></swc-icon-alert-diamond>`
30203
- ],
30204
- cancelled: ["Cancelled", b`<swc-icon-cancel size="s" aria-hidden="true"></swc-icon-cancel>`]
30290
+ running: "Running",
30291
+ done: "Done",
30292
+ error: "Failed",
30293
+ cancelled: "Cancelled"
30205
30294
  };
30206
30295
  var stepStates = {
30207
30296
  running: "active",
@@ -30291,11 +30380,8 @@ function toolSummary(calls) {
30291
30380
  }
30292
30381
  return [...counts].sort((a23, b13) => b13[1] - a23[1]).map(([kind, count]) => `${count} ${count === 1 ? kind.one : kind.many}`).join(", ");
30293
30382
  }
30294
- function state2(status2, label = toolStates[status2][0]) {
30295
- return b`<span class="state" data-state=${status2}>${toolStates[status2][1]}<span>${label}</span></span>`;
30296
- }
30297
30383
  function statusLabel2(status2) {
30298
- return toolStates[status2][0];
30384
+ return toolStates[status2];
30299
30385
  }
30300
30386
  function overall(calls) {
30301
30387
  const count = (status3) => calls.filter((call) => call.status === status3).length;
@@ -30418,32 +30504,31 @@ function notes(list5) {
30418
30504
  }
30419
30505
  function tool(call, color = "light", options = {}) {
30420
30506
  const kind = toolKind(call.name);
30421
- return b`<details class=${options.run ? "tool run" : "tool"} id=${`run-${call.id}`} data-id=${options.owner?.id ?? A} data-status=${call.status} data-tool=${call.name} data-kind=${kind.id} ?open=${!!options.open} @toggle=${options.toggle ?? A}>
30422
- <summary aria-label=${`${call.title}, ${statusLabel2(call.status)}`}>
30423
- <span class="head">
30424
- <swc-icon-chevron-right class="chevron" size="s" aria-hidden="true"></swc-icon-chevron-right>
30425
- ${chip(call, options.model ?? null)}
30426
- <span class="title">${call.title}</span>
30427
- <span class="name">${call.name}</span>
30428
- ${call.meta ? b`<span class="tool-meta">${call.meta}</span>` : A}
30429
- ${state2(call.status)}
30430
- </span>
30431
- ${call.image ? b`<span class="thumb"><img src=${call.image} alt="" /></span>` : A}
30432
- </summary>
30433
- <div class="call">
30507
+ const label = `${call.title}, ${statusLabel2(call.status)}`;
30508
+ const content = b`<div class="call">
30434
30509
  ${body(call, color)}
30435
30510
  ${call.output ? b`<pre class="output">${call.output}</pre>` : A}
30436
30511
  ${call.notes?.length ? notes(call.notes) : A}
30437
30512
  ${call.image ? b`<img class="shot" src=${call.image} alt=${call.title} />` : A}
30513
+ ${call.meta ? b`<span class="tool-meta">${call.meta}</span>` : A}
30438
30514
  ${options.owner ? b`<span class="ran">Ran at ${when(options.owner.at)}</span>` : A}
30439
- </div>
30515
+ </div>`;
30516
+ if (!options.run) {
30517
+ return b`<div class="tool" id=${`run-${call.id}`} role="region" aria-label=${label} data-id=${options.owner?.id ?? A} data-status=${call.status} data-tool=${call.name} data-kind=${kind.id}>${content}</div>`;
30518
+ }
30519
+ return b`<details class="tool run" id=${`run-${call.id}`} data-id=${options.owner?.id ?? A} data-status=${call.status} data-tool=${call.name} data-kind=${kind.id} ?open=${!!options.open} @toggle=${options.toggle ?? A}>
30520
+ <summary class="strip" aria-label=${label}>
30521
+ <span class="icons"><span class="run">${chip(call, options.model ?? null)}</span></span>
30522
+ <span class="label">${call.title}</span>
30523
+ </summary>
30524
+ ${content}
30440
30525
  </details>`;
30441
30526
  }
30442
30527
  var clusterSize = 3;
30443
30528
  function runs(calls, handlers) {
30444
30529
  const groups2 = calls.length >= clusterSize ? [calls] : calls.map((call) => [call]);
30445
30530
  return groups2.map(
30446
- (group) => b`<slicc-tool-runs .calls=${group} .model=${handlers.model} .owners=${handlers.owners ?? null} .color=${handlers.color}></slicc-tool-runs>`
30531
+ (group) => b`<slicc-tool-runs .calls=${group} .agent=${handlers.agentId ?? ""} .model=${handlers.model} .owners=${handlers.owners ?? null} .color=${handlers.color}></slicc-tool-runs>`
30447
30532
  );
30448
30533
  }
30449
30534
  function media(items) {
@@ -30981,21 +31066,6 @@ var messageCss = i`
30981
31066
  summary::-webkit-details-marker {
30982
31067
  display: none;
30983
31068
  }
30984
- details.tool > summary {
30985
- padding-inline: var(--swc-spacing-100);
30986
- }
30987
- details.tool > summary {
30988
- flex-direction: column;
30989
- align-items: stretch;
30990
- justify-content: center;
30991
- gap: 0;
30992
- }
30993
- details.tool > summary > .head {
30994
- display: flex;
30995
- align-items: center;
30996
- gap: var(--swc-spacing-100);
30997
- min-inline-size: 0;
30998
- }
30999
31069
  details.tool > summary:hover,
31000
31070
  .runs button:hover {
31001
31071
  background: var(--swc-gray-100);
@@ -31014,75 +31084,39 @@ var messageCss = i`
31014
31084
  details[open] > summary .chevron {
31015
31085
  transform: rotate(90deg);
31016
31086
  }
31017
- .tool .title,
31018
- .tool .name,
31019
- .runs .names,
31020
- .lick .text {
31087
+ .lick .text,
31088
+ .runs .label {
31021
31089
  min-inline-size: 0;
31022
31090
  overflow: hidden;
31023
31091
  text-overflow: ellipsis;
31024
31092
  white-space: nowrap;
31025
31093
  }
31026
- .tool .title {
31027
- flex: 0 1 auto;
31028
- font-weight: var(--swc-medium-font-weight);
31029
- }
31030
31094
  .lick .text {
31031
31095
  flex: 1;
31032
31096
  }
31033
- .tool .name {
31034
- flex: 0 0.001 auto;
31035
- max-inline-size: 50%;
31036
- font-family: var(--swc-code-font-family-stack);
31037
- color: var(--swc-neutral-subdued-content-color-default);
31038
- }
31039
- .tool-meta {
31040
- flex: none;
31041
- color: var(--swc-neutral-subdued-content-color-default);
31042
- }
31043
- .runs .summary .names {
31044
- flex: 0 1 auto;
31045
- }
31046
- .state {
31047
- display: inline-flex;
31048
- align-items: center;
31049
- gap: var(--swc-spacing-75);
31050
- flex: none;
31051
- margin-inline-start: auto;
31052
- padding-inline-start: var(--swc-spacing-100);
31053
- color: var(--swc-neutral-subdued-content-color-default);
31054
- }
31055
- .state[data-state='done'] swc-icon-checkmark-circle {
31056
- color: var(--swc-positive-visual-color);
31057
- }
31058
- .state[data-state='running'] {
31059
- color: var(--swc-neutral-content-color-default);
31060
- }
31061
- .state[data-state='error'] {
31062
- color: var(--swc-negative-content-color-default);
31063
- font-weight: var(--swc-bold-font-weight);
31064
- }
31065
31097
  swc-system-message > slicc-tool-runs + slicc-tool-runs {
31066
31098
  margin-block-start: var(--swc-spacing-75);
31067
31099
  }
31068
31100
  slicc-tool-runs {
31069
31101
  display: block;
31102
+ container-type: inline-size;
31070
31103
  }
31071
31104
  .runs {
31105
+ --run-size: var(--swc-spacing-500);
31106
+ --run-gap: var(--swc-spacing-25);
31107
+ --run-icons: calc(5 * var(--run-size) + 4 * var(--run-gap));
31072
31108
  display: flex;
31073
31109
  flex-direction: column;
31074
- align-items: center;
31075
31110
  min-inline-size: 0;
31111
+ margin-inline: var(--swc-spacing-700);
31076
31112
  }
31077
- .runs > details.tool.run,
31078
- .runs > .cards {
31079
- align-self: stretch;
31080
- }
31081
- details.run > summary {
31082
- inline-size: fit-content;
31083
- max-inline-size: 100%;
31084
- margin-inline: auto;
31085
- padding-inline: var(--swc-spacing-100) var(--swc-spacing-200);
31113
+ .strip {
31114
+ display: grid;
31115
+ grid-template-columns: var(--run-icons) minmax(0, 1fr);
31116
+ align-items: center;
31117
+ gap: var(--swc-spacing-50) var(--swc-spacing-200);
31118
+ min-block-size: 0;
31119
+ padding: var(--swc-spacing-50);
31086
31120
  border: var(--swc-border-width-100) solid var(--swc-gray-200);
31087
31121
  border-radius: var(--swc-corner-radius-500);
31088
31122
  background: var(--swc-background-layer-1-color);
@@ -31091,39 +31125,28 @@ var messageCss = i`
31091
31125
  details.run[open] > summary {
31092
31126
  margin-block-end: var(--swc-spacing-75);
31093
31127
  }
31094
- details.run > summary :is(.name, .tool-meta, .state[data-state='done'], .state[data-state='running']),
31095
- details.run > summary .thumb {
31096
- display: none;
31097
- }
31098
- details.run > summary .state {
31099
- padding-inline-start: 0;
31100
- }
31101
- details.run > .call {
31102
- padding-inline-start: var(--swc-spacing-100);
31103
- }
31104
- .strip {
31128
+ .icons {
31105
31129
  display: flex;
31106
- flex-wrap: wrap;
31130
+ gap: var(--run-gap);
31131
+ overflow-x: auto;
31132
+ scrollbar-width: none;
31133
+ }
31134
+ .icons > .run {
31135
+ display: inline-flex;
31136
+ flex: none;
31107
31137
  align-items: center;
31108
31138
  justify-content: center;
31109
- gap: var(--swc-spacing-50) var(--swc-spacing-100);
31110
- max-inline-size: 100%;
31111
- padding: var(--swc-spacing-50) var(--swc-spacing-75);
31112
- border: var(--swc-border-width-100) solid var(--swc-gray-200);
31113
- border-radius: var(--swc-corner-radius-500);
31114
- background: var(--swc-background-layer-1-color);
31115
- box-sizing: border-box;
31139
+ inline-size: var(--run-size);
31140
+ block-size: var(--run-size);
31116
31141
  }
31117
- .icons {
31118
- display: flex;
31119
- flex-wrap: wrap;
31120
- justify-content: center;
31121
- gap: var(--swc-spacing-25);
31142
+ .runs .label {
31143
+ block-size: var(--run-size);
31144
+ padding-inline: var(--swc-spacing-100);
31145
+ line-height: var(--run-size);
31146
+ text-align: end;
31147
+ font-weight: var(--swc-medium-font-weight);
31122
31148
  }
31123
31149
  .runs button {
31124
- display: inline-flex;
31125
- align-items: center;
31126
- gap: var(--swc-spacing-75);
31127
31150
  margin: 0;
31128
31151
  padding: 0;
31129
31152
  border: 0;
@@ -31137,25 +31160,21 @@ var messageCss = i`
31137
31160
  outline: var(--swc-focus-indicator-thickness) solid var(--swc-focus-indicator-color);
31138
31161
  outline-offset: calc(-1 * var(--swc-focus-indicator-thickness));
31139
31162
  }
31140
- button.run {
31141
- justify-content: center;
31142
- inline-size: var(--swc-spacing-500);
31143
- block-size: var(--swc-spacing-500);
31144
- }
31145
31163
  button.run[aria-expanded='true'] {
31146
31164
  background: var(--swc-accent-subtle-background-color-default);
31147
31165
  }
31148
- button.summary {
31149
- min-block-size: var(--swc-spacing-500);
31150
- min-inline-size: 0;
31151
- padding-inline: var(--swc-spacing-75) var(--swc-spacing-100);
31152
- color: var(--swc-neutral-subdued-content-color-default);
31153
- }
31154
- button.summary .state {
31155
- padding-inline-start: 0;
31156
- }
31157
- button.summary[aria-expanded='true'] .chevron {
31158
- transform: rotate(90deg);
31166
+ @container (inline-size < 480px) {
31167
+ .runs {
31168
+ margin-inline: var(--swc-spacing-300);
31169
+ }
31170
+ .strip {
31171
+ grid-template-columns: minmax(0, 1fr);
31172
+ }
31173
+ .icons {
31174
+ inline-size: calc(
31175
+ round(down, 100% + var(--run-gap), var(--run-size) + var(--run-gap)) - var(--run-gap)
31176
+ );
31177
+ }
31159
31178
  }
31160
31179
  .cards {
31161
31180
  margin-block-start: var(--swc-spacing-75);
@@ -31237,12 +31256,12 @@ var messageCss = i`
31237
31256
  display: flex;
31238
31257
  flex-direction: column;
31239
31258
  gap: var(--swc-spacing-100);
31240
- padding: var(--swc-spacing-75) var(--swc-spacing-100) var(--swc-spacing-200) var(--swc-spacing-500);
31259
+ padding-block: var(--swc-spacing-75) var(--swc-spacing-200);
31241
31260
  }
31242
31261
  .call:empty {
31243
31262
  display: none;
31244
31263
  }
31245
- .call > .ran {
31264
+ .call > :is(.ran, .tool-meta) {
31246
31265
  font-size: var(--swc-font-size-75);
31247
31266
  color: var(--swc-neutral-subdued-content-color-default);
31248
31267
  }
@@ -31302,19 +31321,6 @@ var messageCss = i`
31302
31321
  white-space: pre-wrap;
31303
31322
  overflow-wrap: anywhere;
31304
31323
  }
31305
- .thumb {
31306
- padding-inline-start: calc(var(--swc-spacing-100) + var(--swc-spacing-300));
31307
- padding-block: var(--swc-spacing-75);
31308
- }
31309
- .thumb img {
31310
- display: block;
31311
- max-inline-size: min(100%, calc(var(--swc-spacing-1000) * 2));
31312
- max-block-size: calc(var(--swc-spacing-1000) * 1.25);
31313
- border-radius: var(--swc-corner-radius-75);
31314
- }
31315
- details[open] > summary .thumb {
31316
- display: none;
31317
- }
31318
31324
  .shot {
31319
31325
  display: block;
31320
31326
  max-inline-size: min(100%, calc(var(--swc-spacing-1000) * 5));
@@ -31661,7 +31667,7 @@ function requiresText(item2, all2) {
31661
31667
  ].filter(Boolean);
31662
31668
  return parts2.length ? parts2.join("; ") : null;
31663
31669
  }
31664
- var snapshot = (items) => new Map(items.map(({ id, state: state3, error }) => [id, { state: state3, error }]));
31670
+ var snapshot = (items) => new Map(items.map(({ id, state: state2, error }) => [id, { state: state2, error }]));
31665
31671
  function settled2(failures, before, after) {
31666
31672
  return new Map(
31667
31673
  [...failures].filter(([id]) => {
@@ -32077,8 +32083,8 @@ var SliccUpdates = class extends ModelElement {
32077
32083
  return b`<span>Checked <time datetime=${date.toISOString()}>${shown4}</time></span>`;
32078
32084
  }
32079
32085
  #item(item2) {
32080
- const [variant, state3] = states[item2.state];
32081
- const label = item2.state === "failed" && item2.from !== null ? "Update failed" : state3;
32086
+ const [variant, state2] = states[item2.state];
32087
+ const label = item2.state === "failed" && item2.from !== null ? "Update failed" : state2;
32082
32088
  const error = this.failures.get(item2.id) ?? item2.error;
32083
32089
  return b`<swc-divider size="s"></swc-divider>
32084
32090
  <article data-id=${item2.id} data-state=${item2.state} aria-label=${item2.label}>
@@ -33026,10 +33032,10 @@ var SliccApp = class extends ThemedElement {
33026
33032
  <swc-tooltip for="updates" placement="bottom">${text2}</swc-tooltip>`;
33027
33033
  }
33028
33034
  #tabsIndicator() {
33029
- const state3 = this.model?.tabs?.state();
33030
- const light = tabsLight(state3);
33031
- if (!state3 || !light) return A;
33032
- return b`<span id="tabs" class="tabs" tabindex="0" role="img" data-tabs data-role=${state3.role} ?data-stalled=${state3.stalled} data-skew=${state3.skew ?? A} aria-label=${`${light.text}. ${light.tooltip}`}>
33035
+ const state2 = this.model?.tabs?.state();
33036
+ const light = tabsLight(state2);
33037
+ if (!state2 || !light) return A;
33038
+ return b`<span id="tabs" class="tabs" tabindex="0" role="img" data-tabs data-role=${state2.role} ?data-stalled=${state2.stalled} data-skew=${state2.skew ?? A} aria-label=${`${light.text}. ${light.tooltip}`}>
33033
33039
  <swc-status-light size="s" variant=${light.variant}>${this.screen === "phone" ? A : light.text}</swc-status-light>
33034
33040
  </span>
33035
33041
  <swc-tooltip for="tabs" placement="bottom">${light.tooltip}</swc-tooltip>`;
@@ -33048,9 +33054,9 @@ var SliccApp = class extends ThemedElement {
33048
33054
  const port = this.model?.network;
33049
33055
  if (!port || !this.#offers("network")) return A;
33050
33056
  const status2 = networkStatus(port);
33051
- const [variant, state3] = networkHealth[status2.health];
33057
+ const [variant, state2] = networkHealth[status2.health];
33052
33058
  const label = networkLabel(status2);
33053
- const content = this.screen === "phone" ? networkIcon[status2.health] : b`<swc-status-light size="s" variant=${variant}>Network${status2.health === "ok" ? A : b`<span class="state"> ${state3.toLowerCase()}</span>`}</swc-status-light>`;
33059
+ const content = this.screen === "phone" ? networkIcon[status2.health] : b`<swc-status-light size="s" variant=${variant}>Network${status2.health === "ok" ? A : b`<span class="state"> ${state2.toLowerCase()}</span>`}</swc-status-light>`;
33054
33060
  return b`<swc-action-button id="network" quiet size="s" data-network data-health=${status2.health} accessible-label=${label} @click=${() => this.show("network")}>${content}</swc-action-button>
33055
33061
  <swc-tooltip for="network" placement="bottom">${status2.detail ?? label}${status2.tailnet?.state === "running" ? " Tailscale is connected." : ""}</swc-tooltip>`;
33056
33062
  }
@@ -33349,6 +33355,10 @@ function origin() {
33349
33355
  const active = focused();
33350
33356
  return active?.closest("slicc-terminal") ?? active;
33351
33357
  }
33358
+ var inCwd = (approval) => approval.alwaysScope === "cwd" && !!approval.cwd;
33359
+ function alwaysHint(approval) {
33360
+ return inCwd(approval) ? `Always allow lets ${approval.requester.name} run exactly this command with sudo, in ${approval.cwd}, without asking again.` : `Always allow lets ${approval.requester.name} run exactly this command with sudo without asking again.`;
33361
+ }
33352
33362
  function waiting(model, now) {
33353
33363
  return [...model?.approvals?.list() ?? []].filter((approval) => approval.expiresAt > now).sort((a23, b13) => a23.createdAt - b13.createdAt);
33354
33364
  }
@@ -33606,12 +33616,12 @@ var SliccApprovals = class extends ModelElement {
33606
33616
  ${this.#request(approval)}
33607
33617
  ${approval.cwd ? b`<p class="cwd">In ${approval.cwd}</p>` : A}
33608
33618
  ${rules ? b`<div class="rules" data-secret-rules=${rules}><swc-icon-alert-triangle size="s" aria-hidden="true"></swc-icon-alert-triangle><p>${verdict.certain ? b`<strong>This changes secret rules.</strong> It names <code>${rules}</code>, where SLICC keeps which secrets programs may use and where they may be sent.` : b`<strong>This may change secret rules.</strong> SLICC can't tell where <code>${rules}</code> leads, and it could reach the files where SLICC keeps which secrets programs may use and where they may be sent.`} Allow it only if you asked for this change.</p></div>` : A}
33609
- ${always ? b`<p class="hint">Always allow lets ${approval.requester.name} run exactly this command with sudo without asking again.</p>` : A}
33619
+ ${always ? b`<p class="hint">${alwaysHint(approval)}</p>` : A}
33610
33620
  ${failure2 ? b`<p class="problem" role="alert" data-error><swc-icon-alert-triangle size="s" aria-hidden="true"></swc-icon-alert-triangle><span>${failure2}</span></p>` : A}
33611
33621
  <p class="timer" data-timer>Denied automatically in ${countdown(approval.expiresAt - this.now)}.</p>
33612
33622
  ${rest.length ? b`<p class="more" data-more>${rest.length === 1 ? "1 more request is waiting." : `${rest.length} more requests are waiting.`}</p>` : A}
33613
33623
  ${this.#button(approval, "deny", "Deny", "secondary")}
33614
- ${always ? this.#button(approval, "always", "Always allow", "secondary") : A}
33624
+ ${always ? this.#button(approval, "always", inCwd(approval) ? "Always allow in this directory" : "Always allow", "secondary") : A}
33615
33625
  ${this.#button(approval, "once", "Allow once", "accent")}
33616
33626
  </sp-alert-dialog>`
33617
33627
  );
@@ -35727,6 +35737,7 @@ var navigation = /* @__PURE__ */ new Set([
35727
35737
  "PageUp",
35728
35738
  "PageDown"
35729
35739
  ]);
35740
+ var upward = /* @__PURE__ */ new Set(["ArrowUp", "PageUp", "Home"]);
35730
35741
  var compactWidth = 560;
35731
35742
  var failed = (message) => message.role === "assistant" ? message.status === "error" : message.role === "system" && message.kind === "error";
35732
35743
  function carriesFiles(event2) {
@@ -35923,7 +35934,7 @@ var SliccChat = class extends ThemedElement {
35923
35934
  model: null,
35924
35935
  readOnly: false,
35925
35936
  answer: (questionId, answer) => this.model?.agent.answer(this.#id(), questionId, answer),
35926
- resolve: (messageId, state3) => this.model?.agent.resolveLick(this.#id(), messageId, state3),
35937
+ resolve: (messageId, state2) => this.model?.agent.resolveLick(this.#id(), messageId, state2),
35927
35938
  action: (action, messageId) => this.#action(action, messageId),
35928
35939
  dropping: (messageId) => failedTurns(this.model.agent.messages(this.#id()), messageId).length,
35929
35940
  open: (path) => this.dispatchEvent(
@@ -35974,6 +35985,12 @@ var SliccChat = class extends ThemedElement {
35974
35985
  }
35975
35986
  #stuck = true;
35976
35987
  #last = 0;
35988
+ #height = 0;
35989
+ #input = Number.NEGATIVE_INFINITY;
35990
+ #up = Number.NEGATIVE_INFINITY;
35991
+ #from = 0;
35992
+ #start = 0;
35993
+ #settle;
35977
35994
  #tail = "";
35978
35995
  #sent(agentId) {
35979
35996
  const last = this.model?.agent.messages(agentId).at(-1);
@@ -35988,12 +36005,42 @@ var SliccChat = class extends ThemedElement {
35988
36005
  const log = this.#log();
35989
36006
  log.scrollTop = log.scrollHeight;
35990
36007
  this.#last = log.scrollTop;
36008
+ this.#height = log.scrollHeight;
35991
36009
  }
35992
36010
  #scroll = () => {
35993
36011
  const log = this.#log();
35994
- if (log.scrollHeight - log.scrollTop - log.clientHeight < 48) this.#stuck = true;
35995
- else if (log.scrollTop < this.#last) this.#stuck = false;
36012
+ const reader = log.scrollHeight <= this.#height || this.#height - log.scrollTop - log.clientHeight >= 48 || performance.now() - this.#input < 1e3;
36013
+ const rising = performance.now() - this.#up < 1e3 && log.scrollTop <= this.#from;
36014
+ if (log.scrollHeight - log.scrollTop - log.clientHeight < 48) this.#stuck ||= !rising;
36015
+ else if (reader && log.scrollTop < this.#last) this.#stuck = false;
35996
36016
  this.#last = log.scrollTop;
36017
+ this.#height = log.scrollHeight;
36018
+ };
36019
+ #intent = {
36020
+ passive: true,
36021
+ handleEvent: (event2) => {
36022
+ this.#input = performance.now();
36023
+ const up = event2 instanceof WheelEvent ? event2.deltaY < 0 && !event2.ctrlKey : event2 instanceof KeyboardEvent && (upward.has(event2.key) || event2.key === " " && event2.shiftKey);
36024
+ const at = this.#log().scrollTop;
36025
+ if (!up || at <= 0) return;
36026
+ this.#from = at;
36027
+ this.#up = this.#input;
36028
+ if (this.#settle === void 0) this.#start = Math.max(at, this.#last);
36029
+ this.#stuck = false;
36030
+ clearTimeout(this.#settle);
36031
+ this.#settle = setTimeout(() => {
36032
+ this.#settle = void 0;
36033
+ if (this.#start - this.#log().scrollTop >= 48) return;
36034
+ this.#stuck = true;
36035
+ this.#pin();
36036
+ }, 400);
36037
+ }
36038
+ };
36039
+ #hold = (event2) => {
36040
+ if (event2.target === event2.currentTarget) this.#input = Number.POSITIVE_INFINITY;
36041
+ };
36042
+ #release = () => {
36043
+ if (this.#input === Number.POSITIVE_INFINITY) this.#input = performance.now();
35997
36044
  };
35998
36045
  #refresh(jump) {
35999
36046
  if (jump) this.#stuck = true;
@@ -36008,11 +36055,16 @@ var SliccChat = class extends ThemedElement {
36008
36055
  }
36009
36056
  connectedCallback() {
36010
36057
  super.connectedCallback();
36058
+ globalThis.addEventListener("pointerup", this.#release, true);
36059
+ globalThis.addEventListener("pointercancel", this.#release, true);
36011
36060
  if (this.hasUpdated) this.#observe();
36012
36061
  }
36013
36062
  disconnectedCallback() {
36014
36063
  super.disconnectedCallback();
36064
+ globalThis.removeEventListener("pointerup", this.#release, true);
36065
+ globalThis.removeEventListener("pointercancel", this.#release, true);
36015
36066
  this.#resize.disconnect();
36067
+ clearTimeout(this.#settle);
36016
36068
  }
36017
36069
  firstUpdated() {
36018
36070
  this.#observe();
@@ -36184,6 +36236,7 @@ var SliccChat = class extends ThemedElement {
36184
36236
  const agent = this.#agent();
36185
36237
  const watch = watchOnly(this.model);
36186
36238
  this.#handlers.readOnly = !!agent?.frozen || !!watch;
36239
+ this.#handlers.agentId = agent?.id;
36187
36240
  const messages = agent ? this.model?.agent.messages(agent.id) ?? [] : [];
36188
36241
  this.#tail = messages.at(-1)?.id ?? "";
36189
36242
  return b`
@@ -36198,6 +36251,11 @@ var SliccChat = class extends ThemedElement {
36198
36251
  aria-label="Conversation"
36199
36252
  tabindex="-1"
36200
36253
  @scroll=${this.#scroll}
36254
+ @wheel=${this.#intent}
36255
+ @touchstart=${this.#intent}
36256
+ @touchmove=${this.#intent}
36257
+ @keydown=${this.#intent}
36258
+ @pointerdown=${this.#hold}
36201
36259
  >
36202
36260
  <div class="column" @keydown=${this.#keys}>
36203
36261
  ${agent && messages.length > 0 ? b`<swc-conversation-thread>${c(
@@ -37140,8 +37198,8 @@ function fieldOf(error, field) {
37140
37198
  return isVaultFailure(error) && error.code === "EINVAL" ? field : null;
37141
37199
  }
37142
37200
  function away(vault) {
37143
- const state3 = vault.availability?.() ?? (vault.status() ? "ready" : "waiting");
37144
- return state3 === "connecting" || state3 === "waiting";
37201
+ const state2 = vault.availability?.() ?? (vault.status() ? "ready" : "waiting");
37202
+ return state2 === "connecting" || state2 === "waiting";
37145
37203
  }
37146
37204
  function take(input) {
37147
37205
  const value = input.value;
@@ -37321,10 +37379,10 @@ var SliccVaultButton = class extends i2 {
37321
37379
  const at = order.indexOf(null);
37322
37380
  order[event2.direction === "next" ? at + 1 : at - 1]?.focus();
37323
37381
  } else if (event2.event === "popup") {
37324
- const { intent, state: state3 } = event2;
37382
+ const { intent, state: state2 } = event2;
37325
37383
  this.dispatchEvent(
37326
37384
  new CustomEvent("vault-popup", {
37327
- detail: { intent, state: state3 },
37385
+ detail: { intent, state: state2 },
37328
37386
  bubbles: true,
37329
37387
  composed: true
37330
37388
  })
@@ -37795,8 +37853,8 @@ var SliccComposer = class extends ThemedElement {
37795
37853
  ];
37796
37854
  }
37797
37855
  #held() {
37798
- const state3 = this.model?.follow?.state();
37799
- return state3?.link === "reconnecting" ? state3.owner : null;
37856
+ const state2 = this.model?.follow?.state();
37857
+ return state2?.link === "reconnecting" ? state2.owner : null;
37800
37858
  }
37801
37859
  #switch(id) {
37802
37860
  if (this.#agent)
@@ -38958,7 +39016,7 @@ var SliccNotices = class extends ModelElement {
38958
39016
  // src/app/secrets.ts
38959
39017
  var kinds = { secret: null, grant: "Sign-in", model: "Model key", mcp: "MCP server" };
38960
39018
  var lockModes = {
38961
- auto: "Unlocks with this browser",
39019
+ auto: "Unlocks automatically in this browser",
38962
39020
  passkey: "Unlocks with a passkey",
38963
39021
  passphrase: "Unlocks with a passphrase"
38964
39022
  };
@@ -39219,6 +39277,7 @@ var SliccSecrets = class extends ThemedElement {
39219
39277
  font-weight: var(--swc-bold-font-weight);
39220
39278
  }
39221
39279
  .box .actions,
39280
+ .locked,
39222
39281
  .buttons {
39223
39282
  display: flex;
39224
39283
  flex-wrap: wrap;
@@ -39782,7 +39841,7 @@ var SliccSecrets = class extends ThemedElement {
39782
39841
  </div>`;
39783
39842
  }
39784
39843
  #locked(locked) {
39785
- return locked ? b`<p class="muted" data-locked>Unlock the vault first</p>` : A;
39844
+ return locked ? b`<div class="locked"><p class="muted" data-locked>Unlock the vault first</p>${this.#button({ intent: { kind: "unlock" }, label: "Unlock", size: "s", variant: "accent" }, "unlock")}</div>` : A;
39786
39845
  }
39787
39846
  #valueForm(vault, form, locked) {
39788
39847
  const save = () => this.save(vault);
@@ -40806,9 +40865,9 @@ function literal(value) {
40806
40865
  return "null";
40807
40866
  }
40808
40867
  }
40809
- function store(state3) {
40868
+ function store(state2) {
40810
40869
  return `(() => {
40811
- let state = ${literal(state3)};
40870
+ let state = ${literal(state2)};
40812
40871
  const tag = Math.random().toString(36).slice(2);
40813
40872
  const pending = new Map();
40814
40873
  let next = 0;
@@ -40846,11 +40905,11 @@ function store(state3) {
40846
40905
  });
40847
40906
  })();`;
40848
40907
  }
40849
- function frameDocument(source, color, name, state3) {
40908
+ function frameDocument(source, color, name, state2) {
40850
40909
  const scheme = `<style>${sprinkleTokens}${sprinkle_theme_default}</style>`;
40851
40910
  const light = `<script>document.documentElement.classList.toggle('theme-light', ${color === "light"});<\/script>`;
40852
40911
  const script = `<script data-name="${name.replace(/"/g, "&quot;")}">${bridge}<\/script>`;
40853
- const injection = light + scheme + script + (state3 ? `<script>${store(state3.value)}<\/script>` : "");
40912
+ const injection = light + scheme + script + (state2 ? `<script>${store(state2.value)}<\/script>` : "");
40854
40913
  const head2 = source.match(/<head\b[^>]*>/i);
40855
40914
  if (!head2 || head2.index === void 0) return injection + source;
40856
40915
  const at = head2.index + head2[0].length;
@@ -41112,12 +41171,12 @@ var SliccSprinkle = class extends ThemedElement {
41112
41171
  return this.model?.sprinkles.list().find((candidate) => candidate.id === this.sprinkle);
41113
41172
  }
41114
41173
  #frame = { key: "", doc: "" };
41115
- #document(data, state3) {
41116
- const key2 = `${!!state3}
41174
+ #document(data, state2) {
41175
+ const key2 = `${!!state2}
41117
41176
  ${data.name}
41118
41177
  ${data.html}`;
41119
41178
  if (this.#frame.key !== key2)
41120
- this.#frame = { key: key2, doc: frameDocument(data.html, this.color, data.name, state3) };
41179
+ this.#frame = { key: key2, doc: frameDocument(data.html, this.color, data.name, state2) };
41121
41180
  return this.#frame.doc;
41122
41181
  }
41123
41182
  updated(changed) {
@@ -41141,13 +41200,13 @@ ${data.html}`;
41141
41200
  }
41142
41201
  const bridged = !!this.model?.sprinkles.call;
41143
41202
  if (bridged && !this.#held.ready) return b``;
41144
- const state3 = bridged ? this.#held : void 0;
41203
+ const state2 = bridged ? this.#held : void 0;
41145
41204
  const watch = !!watchOnly(this.model);
41146
41205
  const caption = watch ? b`<span class="view-only" data-view-only>View only on this device</span>` : A;
41147
41206
  const style = `color-scheme:${this.color};${this.inline ? `height:${this.height}px;` : ""}`;
41148
41207
  const frame = b`${i17(
41149
41208
  this.#mounts,
41150
- b`<iframe title=${data.title} sandbox="allow-scripts" ?inert=${watch} style=${style} .srcdoc=${this.#document(data, state3)}></iframe>`
41209
+ b`<iframe title=${data.title} sandbox="allow-scripts" ?inert=${watch} style=${style} .srcdoc=${this.#document(data, state2)}></iframe>`
41151
41210
  )}`;
41152
41211
  if (!this.inline)
41153
41212
  return watch ? b`<div class="panel"><div class="bar">${caption}</div>${frame}</div>` : frame;
@@ -41165,16 +41224,29 @@ ${data.html}`;
41165
41224
 
41166
41225
  // src/app/tool-runs.ts
41167
41226
  var opened = /* @__PURE__ */ new Map();
41227
+ var caches = /* @__PURE__ */ new WeakMap();
41228
+ function cache(port) {
41229
+ const found = caches.get(port);
41230
+ if (found) return found;
41231
+ const fresh2 = { done: /* @__PURE__ */ new Map(), latest: /* @__PURE__ */ new Map(), asked: /* @__PURE__ */ new Set() };
41232
+ caches.set(port, fresh2);
41233
+ return fresh2;
41234
+ }
41168
41235
  var SliccToolRuns = class extends i2 {
41169
41236
  static properties = {
41170
41237
  calls: { attribute: false },
41238
+ agent: { attribute: false },
41171
41239
  color: { attribute: false },
41172
41240
  model: { attribute: false },
41173
41241
  owners: { attribute: false }
41174
41242
  };
41243
+ #icons = null;
41244
+ #count = 0;
41245
+ #resize = new ResizeObserver(() => this.#end());
41175
41246
  constructor() {
41176
41247
  super();
41177
41248
  this.calls = [];
41249
+ this.agent = "";
41178
41250
  this.color = "light";
41179
41251
  this.model = null;
41180
41252
  this.owners = null;
@@ -41182,9 +41254,20 @@ var SliccToolRuns = class extends i2 {
41182
41254
  createRenderRoot() {
41183
41255
  return this;
41184
41256
  }
41257
+ connectedCallback() {
41258
+ super.connectedCallback();
41259
+ if (this.#icons) this.#resize.observe(this.#icons);
41260
+ }
41261
+ disconnectedCallback() {
41262
+ super.disconnectedCallback();
41263
+ this.#resize.disconnect();
41264
+ }
41185
41265
  get #anchor() {
41186
41266
  return this.calls[0]?.id ?? "";
41187
41267
  }
41268
+ get #key() {
41269
+ return this.calls.map((call) => call.id).join(" ");
41270
+ }
41188
41271
  get #open() {
41189
41272
  return opened.get(this.#anchor) ?? "";
41190
41273
  }
@@ -41195,9 +41278,55 @@ var SliccToolRuns = class extends i2 {
41195
41278
  }
41196
41279
  #toggled(call, event2) {
41197
41280
  const open = event2.currentTarget.open;
41198
- const current = this.#open;
41199
- if (open && current !== "all") this.#set(call.id);
41200
- if (!open && current === call.id) this.#set("");
41281
+ if (open) this.#set(call.id);
41282
+ else if (this.#open === call.id) this.#set("");
41283
+ }
41284
+ #ask() {
41285
+ const port = this.model?.agent;
41286
+ if (this.calls.length < 2 || !port?.toolLabel) return;
41287
+ const store2 = cache(port);
41288
+ const key2 = `${this.agent} ${this.#key}`;
41289
+ const anchor = `${this.agent} ${this.#anchor}`;
41290
+ if (store2.asked.has(key2)) return;
41291
+ store2.asked.add(key2);
41292
+ port.toolLabel(
41293
+ this.agent,
41294
+ this.calls.map((call) => call.id)
41295
+ ).then(
41296
+ (text2) => {
41297
+ const label = text2?.trim();
41298
+ if (!label) return;
41299
+ store2.done.set(key2, label);
41300
+ store2.latest.set(anchor, label);
41301
+ this.requestUpdate();
41302
+ },
41303
+ () => void 0
41304
+ );
41305
+ }
41306
+ #label() {
41307
+ const port = this.model?.agent;
41308
+ const store2 = port ? caches.get(port) : void 0;
41309
+ if (!store2) return "";
41310
+ return store2.done.get(`${this.agent} ${this.#key}`) ?? store2.latest.get(`${this.agent} ${this.#anchor}`) ?? "";
41311
+ }
41312
+ #end() {
41313
+ const icons3 = this.#icons;
41314
+ const rtl = getComputedStyle(icons3).direction === "rtl";
41315
+ icons3.scrollLeft = rtl ? -icons3.scrollWidth : icons3.scrollWidth;
41316
+ }
41317
+ willUpdate() {
41318
+ this.#ask();
41319
+ }
41320
+ updated() {
41321
+ const icons3 = this.querySelector(".icons");
41322
+ if (icons3 !== this.#icons) {
41323
+ this.#resize.disconnect();
41324
+ this.#resize.observe(icons3);
41325
+ this.#icons = icons3;
41326
+ }
41327
+ if (this.calls.length === this.#count) return;
41328
+ this.#count = this.calls.length;
41329
+ this.#end();
41201
41330
  }
41202
41331
  #card(call, run2) {
41203
41332
  const open = this.#open;
@@ -41216,17 +41345,15 @@ var SliccToolRuns = class extends i2 {
41216
41345
  }
41217
41346
  const open = this.#open;
41218
41347
  const [status2, label] = overall(calls);
41348
+ const summary = `${toolSummary(calls)}. ${label}`;
41349
+ const text2 = this.#label();
41219
41350
  const pick = (id) => this.#set(open === id ? "" : id);
41220
41351
  return b`<div class="runs" data-runs="cluster" data-status=${status2} data-count=${calls.length}>
41221
- <div class="strip">
41222
- <span class="icons" role="group" aria-label=${`${calls.length} tool runs`}>${calls.map(
41352
+ <div class="strip" title=${summary}>
41353
+ <span class="icons" role="group" aria-label=${summary}>${calls.map(
41223
41354
  (call) => b`<button type="button" class="run" data-action="open-run" data-target=${call.id} data-status=${call.status} aria-expanded=${open === call.id ? "true" : "false"} aria-controls=${`run-${call.id}`} aria-label=${`${call.title}, ${statusLabel2(call.status)}`} title=${call.title} @click=${() => pick(call.id)}>${chip(call, this.model)}</button>`
41224
41355
  )}</span>
41225
- <button type="button" class="summary" data-action="open-cluster" aria-expanded=${open === "all" ? "true" : "false"} @click=${() => pick("all")}>
41226
- <swc-icon-chevron-right class="chevron" size="s" aria-hidden="true"></swc-icon-chevron-right>
41227
- <span class="names">${toolSummary(calls)}</span>
41228
- ${state2(status2, label)}
41229
- </button>
41356
+ <button type="button" class="label" data-action="open-cluster" aria-expanded=${open === "all" ? "true" : "false"} aria-label=${text2 ? A : "Show all runs"} @click=${() => pick("all")}>${text2}</button>
41230
41357
  </div>
41231
41358
  <div class="cards" ?hidden=${!open}>${calls.map(
41232
41359
  (call) => b`<div class="slot" ?hidden=${open !== "all" && open !== call.id}>${this.#card(call, false)}</div>`
@@ -47415,8 +47542,8 @@ async function createShikiPrimitiveAsync(options) {
47415
47542
  });
47416
47543
  }
47417
47544
  var _grammarStateMap = /* @__PURE__ */ new WeakMap();
47418
- function setLastGrammarStateToMap(keys, state3) {
47419
- _grammarStateMap.set(keys, state3);
47545
+ function setLastGrammarStateToMap(keys, state2) {
47546
+ _grammarStateMap.set(keys, state2);
47420
47547
  }
47421
47548
  function getLastGrammarStateFromMap(keys) {
47422
47549
  return _grammarStateMap.get(keys);
@@ -47485,9 +47612,9 @@ function getScopes(stack) {
47485
47612
  pushScope(stack);
47486
47613
  return scopes;
47487
47614
  }
47488
- function getGrammarStack(state3, theme3) {
47489
- if (!(state3 instanceof GrammarState)) throw new ShikiError2("Invalid grammar state");
47490
- return state3.getInternalStack(theme3);
47615
+ function getGrammarStack(state2, theme3) {
47616
+ if (!(state2 instanceof GrammarState)) throw new ShikiError2("Invalid grammar state");
47617
+ return state2.getInternalStack(theme3);
47491
47618
  }
47492
47619
  var RE_COMMA = /,/;
47493
47620
  var RE_SPACE = / /;
@@ -49490,17 +49617,17 @@ function stringifyEntities(value, options) {
49490
49617
  var htmlCommentRegex = /^>|^->|<!--|-->|--!>|<!-$/g;
49491
49618
  var bogusCommentEntitySubset = [">"];
49492
49619
  var commentEntitySubset = ["<", ">"];
49493
- function comment(node, _1, _22, state3) {
49494
- return state3.settings.bogusComments ? "<?" + stringifyEntities(
49620
+ function comment(node, _1, _22, state2) {
49621
+ return state2.settings.bogusComments ? "<?" + stringifyEntities(
49495
49622
  node.value,
49496
- Object.assign({}, state3.settings.characterReferences, {
49623
+ Object.assign({}, state2.settings.characterReferences, {
49497
49624
  subset: bogusCommentEntitySubset
49498
49625
  })
49499
49626
  ) + ">" : "<!--" + node.value.replace(htmlCommentRegex, encode2) + "-->";
49500
49627
  function encode2($0) {
49501
49628
  return stringifyEntities(
49502
49629
  $0,
49503
- Object.assign({}, state3.settings.characterReferences, {
49630
+ Object.assign({}, state2.settings.characterReferences, {
49504
49631
  subset: commentEntitySubset
49505
49632
  })
49506
49633
  );
@@ -49508,8 +49635,8 @@ function comment(node, _1, _22, state3) {
49508
49635
  }
49509
49636
 
49510
49637
  // node_modules/hast-util-to-html/lib/handle/doctype.js
49511
- function doctype(_1, _22, _32, state3) {
49512
- return "<!" + (state3.settings.upperDoctype ? "DOCTYPE" : "doctype") + (state3.settings.tightDoctype ? "" : " ") + "html>";
49638
+ function doctype(_1, _22, _32, state2) {
49639
+ return "<!" + (state2.settings.upperDoctype ? "DOCTYPE" : "doctype") + (state2.settings.tightDoctype ? "" : " ") + "html>";
49513
49640
  }
49514
49641
 
49515
49642
  // node_modules/ccount/index.js
@@ -49734,26 +49861,26 @@ var constants = {
49734
49861
  ['\0"&'.split(""), "\0\"&'`".split("")]
49735
49862
  ]
49736
49863
  };
49737
- function element(node, index, parent, state3) {
49738
- const schema = state3.schema;
49739
- const omit = schema.space === "svg" ? false : state3.settings.omitOptionalTags;
49740
- let selfClosing = schema.space === "svg" ? state3.settings.closeEmptyElements : state3.settings.voids.includes(node.tagName.toLowerCase());
49864
+ function element(node, index, parent, state2) {
49865
+ const schema = state2.schema;
49866
+ const omit = schema.space === "svg" ? false : state2.settings.omitOptionalTags;
49867
+ let selfClosing = schema.space === "svg" ? state2.settings.closeEmptyElements : state2.settings.voids.includes(node.tagName.toLowerCase());
49741
49868
  const parts2 = [];
49742
49869
  let last;
49743
49870
  if (schema.space === "html" && node.tagName === "svg") {
49744
- state3.schema = svg3;
49871
+ state2.schema = svg3;
49745
49872
  }
49746
- const attributes = serializeAttributes(state3, node.properties);
49747
- const content = state3.all(
49873
+ const attributes = serializeAttributes(state2, node.properties);
49874
+ const content = state2.all(
49748
49875
  schema.space === "html" && node.tagName === "template" ? node.content : node
49749
49876
  );
49750
- state3.schema = schema;
49877
+ state2.schema = schema;
49751
49878
  if (content) selfClosing = false;
49752
49879
  if (attributes || !omit || !opening(node, index, parent)) {
49753
49880
  parts2.push("<", node.tagName, attributes ? " " + attributes : "");
49754
- if (selfClosing && (schema.space === "svg" || state3.settings.closeSelfClosing)) {
49881
+ if (selfClosing && (schema.space === "svg" || state2.settings.closeSelfClosing)) {
49755
49882
  last = attributes.charAt(attributes.length - 1);
49756
- if (!state3.settings.tightSelfClosing || last === "/" || last && last !== '"' && last !== "'") {
49883
+ if (!state2.settings.tightSelfClosing || last === "/" || last && last !== '"' && last !== "'") {
49757
49884
  parts2.push(" ");
49758
49885
  }
49759
49886
  parts2.push("/");
@@ -49766,31 +49893,31 @@ function element(node, index, parent, state3) {
49766
49893
  }
49767
49894
  return parts2.join("");
49768
49895
  }
49769
- function serializeAttributes(state3, properties) {
49896
+ function serializeAttributes(state2, properties) {
49770
49897
  const values = [];
49771
49898
  let index = -1;
49772
49899
  let key2;
49773
49900
  if (properties) {
49774
49901
  for (key2 in properties) {
49775
49902
  if (properties[key2] !== null && properties[key2] !== void 0) {
49776
- const value = serializeAttribute(state3, key2, properties[key2]);
49903
+ const value = serializeAttribute(state2, key2, properties[key2]);
49777
49904
  if (value) values.push(value);
49778
49905
  }
49779
49906
  }
49780
49907
  }
49781
49908
  while (++index < values.length) {
49782
- const last = state3.settings.tightAttributes ? values[index].charAt(values[index].length - 1) : void 0;
49909
+ const last = state2.settings.tightAttributes ? values[index].charAt(values[index].length - 1) : void 0;
49783
49910
  if (index !== values.length - 1 && last !== '"' && last !== "'") {
49784
49911
  values[index] += " ";
49785
49912
  }
49786
49913
  }
49787
49914
  return values.join("");
49788
49915
  }
49789
- function serializeAttribute(state3, key2, value) {
49790
- const info = find(state3.schema, key2);
49791
- const x7 = state3.settings.allowParseErrors && state3.schema.space === "html" ? 0 : 1;
49792
- const y10 = state3.settings.allowDangerousCharacters ? 0 : 1;
49793
- let quote = state3.quote;
49916
+ function serializeAttribute(state2, key2, value) {
49917
+ const info = find(state2.schema, key2);
49918
+ const x7 = state2.settings.allowParseErrors && state2.schema.space === "html" ? 0 : 1;
49919
+ const y10 = state2.settings.allowDangerousCharacters ? 0 : 1;
49920
+ let quote = state2.quote;
49794
49921
  let result;
49795
49922
  if (info.overloadedBoolean && (value === info.attribute || value === "")) {
49796
49923
  value = true;
@@ -49802,32 +49929,32 @@ function serializeAttribute(state3, key2, value) {
49802
49929
  }
49803
49930
  const name = stringifyEntities(
49804
49931
  info.attribute,
49805
- Object.assign({}, state3.settings.characterReferences, {
49932
+ Object.assign({}, state2.settings.characterReferences, {
49806
49933
  // Always encode without parse errors in non-HTML.
49807
49934
  subset: constants.name[x7][y10]
49808
49935
  })
49809
49936
  );
49810
49937
  if (value === true) return name;
49811
49938
  value = Array.isArray(value) ? (info.commaSeparated ? stringify : stringify2)(value, {
49812
- padLeft: !state3.settings.tightCommaSeparatedLists
49939
+ padLeft: !state2.settings.tightCommaSeparatedLists
49813
49940
  }) : String(value);
49814
- if (state3.settings.collapseEmptyAttributes && !value) return name;
49815
- if (state3.settings.preferUnquoted) {
49941
+ if (state2.settings.collapseEmptyAttributes && !value) return name;
49942
+ if (state2.settings.preferUnquoted) {
49816
49943
  result = stringifyEntities(
49817
49944
  value,
49818
- Object.assign({}, state3.settings.characterReferences, {
49945
+ Object.assign({}, state2.settings.characterReferences, {
49819
49946
  attribute: true,
49820
49947
  subset: constants.unquoted[x7][y10]
49821
49948
  })
49822
49949
  );
49823
49950
  }
49824
49951
  if (result !== value) {
49825
- if (state3.settings.quoteSmart && ccount(value, quote) > ccount(value, state3.alternative)) {
49826
- quote = state3.alternative;
49952
+ if (state2.settings.quoteSmart && ccount(value, quote) > ccount(value, state2.alternative)) {
49953
+ quote = state2.alternative;
49827
49954
  }
49828
49955
  result = quote + stringifyEntities(
49829
49956
  value,
49830
- Object.assign({}, state3.settings.characterReferences, {
49957
+ Object.assign({}, state2.settings.characterReferences, {
49831
49958
  // Always encode without parse errors in non-HTML.
49832
49959
  subset: (quote === "'" ? constants.single : constants.double)[x7][y10],
49833
49960
  attribute: true
@@ -49839,23 +49966,23 @@ function serializeAttribute(state3, key2, value) {
49839
49966
 
49840
49967
  // node_modules/hast-util-to-html/lib/handle/text.js
49841
49968
  var textEntitySubset = ["<", "&"];
49842
- function text(node, _9, parent, state3) {
49969
+ function text(node, _9, parent, state2) {
49843
49970
  return parent && parent.type === "element" && (parent.tagName === "script" || parent.tagName === "style") ? node.value : stringifyEntities(
49844
49971
  node.value,
49845
- Object.assign({}, state3.settings.characterReferences, {
49972
+ Object.assign({}, state2.settings.characterReferences, {
49846
49973
  subset: textEntitySubset
49847
49974
  })
49848
49975
  );
49849
49976
  }
49850
49977
 
49851
49978
  // node_modules/hast-util-to-html/lib/handle/raw.js
49852
- function raw(node, index, parent, state3) {
49853
- return state3.settings.allowDangerousHtml ? node.value : text(node, index, parent, state3);
49979
+ function raw(node, index, parent, state2) {
49980
+ return state2.settings.allowDangerousHtml ? node.value : text(node, index, parent, state2);
49854
49981
  }
49855
49982
 
49856
49983
  // node_modules/hast-util-to-html/lib/handle/root.js
49857
- function root(node, _1, _22, state3) {
49858
- return state3.all(node);
49984
+ function root(node, _1, _22, state2) {
49985
+ return state2.all(node);
49859
49986
  }
49860
49987
 
49861
49988
  // node_modules/hast-util-to-html/lib/handle/index.js
@@ -49886,7 +50013,7 @@ function toHtml(tree, options) {
49886
50013
  if (quote !== '"' && quote !== "'") {
49887
50014
  throw new Error("Invalid quote `" + quote + "`, expected `'` or `\"`");
49888
50015
  }
49889
- const state3 = {
50016
+ const state2 = {
49890
50017
  one,
49891
50018
  all,
49892
50019
  settings: {
@@ -49912,7 +50039,7 @@ function toHtml(tree, options) {
49912
50039
  quote,
49913
50040
  alternative
49914
50041
  };
49915
- return state3.one(
50042
+ return state2.one(
49916
50043
  Array.isArray(tree) ? { type: "root", children: tree } : tree,
49917
50044
  void 0,
49918
50045
  void 0
@@ -51073,11 +51200,11 @@ var JavaScriptScanner = class {
51073
51200
  constructor(patterns, options = {}) {
51074
51201
  this.patterns = patterns;
51075
51202
  this.options = options;
51076
- const { forgiving = false, cache: cache3, regexConstructor } = options;
51203
+ const { forgiving = false, cache: cache4, regexConstructor } = options;
51077
51204
  if (!regexConstructor) throw new Error("Option `regexConstructor` is not provided");
51078
51205
  this.regexps = patterns.map((p17) => {
51079
51206
  if (typeof p17 !== "string") return p17;
51080
- const cached = cache3?.get(p17);
51207
+ const cached = cache4?.get(p17);
51081
51208
  if (cached) {
51082
51209
  if (cached instanceof RegExp) return cached;
51083
51210
  if (forgiving) return null;
@@ -51085,10 +51212,10 @@ var JavaScriptScanner = class {
51085
51212
  }
51086
51213
  try {
51087
51214
  const regex = regexConstructor(p17);
51088
- cache3?.set(p17, regex);
51215
+ cache4?.set(p17, regex);
51089
51216
  return regex;
51090
51217
  } catch (e122) {
51091
- cache3?.set(p17, e122);
51218
+ cache4?.set(p17, e122);
51092
51219
  if (forgiving) return null;
51093
51220
  throw e122;
51094
51221
  }
@@ -52813,9 +52940,9 @@ var FirstPassVisitor = {
52813
52940
  }
52814
52941
  }
52815
52942
  },
52816
- Assertion({ node, parent, key: key2, container, root: root2, remove: remove2, replaceWith }, state3) {
52943
+ Assertion({ node, parent, key: key2, container, root: root2, remove: remove2, replaceWith }, state2) {
52817
52944
  const { kind, negate } = node;
52818
- const { asciiWordBoundaries, avoidSubclass, supportedGNodes, wordIsAscii } = state3;
52945
+ const { asciiWordBoundaries, avoidSubclass, supportedGNodes, wordIsAscii } = state2;
52819
52946
  if (kind === "text_segment_boundary") {
52820
52947
  throw new Error(`Unsupported text segment boundary "\\${negate ? "Y" : "y"}"`);
52821
52948
  } else if (kind === "line_end") {
@@ -52838,7 +52965,7 @@ var FirstPassVisitor = {
52838
52965
  throw new Error(r39`Uses "\G" in a way that requires a subclass`);
52839
52966
  } else {
52840
52967
  replaceWith(setParent(F5("string_start"), parent));
52841
- state3.strategy = "clip_search";
52968
+ state2.strategy = "clip_search";
52842
52969
  }
52843
52970
  }
52844
52971
  } else if (kind === "string_end" || kind === "string_start") {
@@ -53031,10 +53158,10 @@ var FirstPassVisitor = {
53031
53158
  disable && !Object.keys(disable).length && delete node.flags.disable;
53032
53159
  !node.flags.enable && !node.flags.disable && delete node.flags;
53033
53160
  },
53034
- LookaroundAssertion({ node }, state3) {
53161
+ LookaroundAssertion({ node }, state2) {
53035
53162
  const { kind } = node;
53036
53163
  if (kind === "lookbehind") {
53037
- state3.passedLookbehind = true;
53164
+ state2.passedLookbehind = true;
53038
53165
  }
53039
53166
  },
53040
53167
  NamedCallout({ node, parent, replaceWith }) {
@@ -53161,17 +53288,17 @@ var SecondPassVisitor = {
53161
53288
  }
53162
53289
  },
53163
53290
  Group: {
53164
- enter({ node }, state3) {
53165
- state3.prevFlags = state3.currentFlags;
53291
+ enter({ node }, state2) {
53292
+ state2.prevFlags = state2.currentFlags;
53166
53293
  if (node.flags) {
53167
- state3.currentFlags = getNewCurrentFlags(state3.currentFlags, node.flags);
53294
+ state2.currentFlags = getNewCurrentFlags(state2.currentFlags, node.flags);
53168
53295
  }
53169
53296
  },
53170
- exit(_9, state3) {
53171
- state3.currentFlags = state3.prevFlags;
53297
+ exit(_9, state2) {
53298
+ state2.currentFlags = state2.prevFlags;
53172
53299
  }
53173
53300
  },
53174
- Subroutine({ node, parent, replaceWith }, state3) {
53301
+ Subroutine({ node, parent, replaceWith }, state2) {
53175
53302
  const { isRecursive, ref } = node;
53176
53303
  if (isRecursive) {
53177
53304
  let reffed = parent;
@@ -53180,14 +53307,14 @@ var SecondPassVisitor = {
53180
53307
  break;
53181
53308
  }
53182
53309
  }
53183
- state3.reffedNodesByReferencer.set(node, reffed);
53310
+ state2.reffedNodesByReferencer.set(node, reffed);
53184
53311
  return;
53185
53312
  }
53186
- const reffedGroupNode = state3.subroutineRefMap.get(ref);
53313
+ const reffedGroupNode = state2.subroutineRefMap.get(ref);
53187
53314
  const isGlobalRecursion = ref === 0;
53188
53315
  const expandedSubroutine = isGlobalRecursion ? createRecursion(0) : (
53189
53316
  // The reffed group might itself contain subroutines, which are expanded during sub-traversal
53190
- cloneCapturingGroup(reffedGroupNode, state3.groupOriginByCopy, null)
53317
+ cloneCapturingGroup(reffedGroupNode, state2.groupOriginByCopy, null)
53191
53318
  );
53192
53319
  let replacement = expandedSubroutine;
53193
53320
  if (!isGlobalRecursion) {
@@ -53195,8 +53322,8 @@ var SecondPassVisitor = {
53195
53322
  reffedGroupNode,
53196
53323
  (p17) => p17.type === "Group" && !!p17.flags
53197
53324
  ));
53198
- const reffedGroupFlags = reffedGroupFlagMods ? getNewCurrentFlags(state3.globalFlags, reffedGroupFlagMods) : state3.globalFlags;
53199
- if (!areFlagsEqual(reffedGroupFlags, state3.currentFlags)) {
53325
+ const reffedGroupFlags = reffedGroupFlagMods ? getNewCurrentFlags(state2.globalFlags, reffedGroupFlagMods) : state2.globalFlags;
53326
+ if (!areFlagsEqual(reffedGroupFlags, state2.currentFlags)) {
53200
53327
  replacement = A8({
53201
53328
  flags: getFlagModsFromFlags(reffedGroupFlags)
53202
53329
  });
@@ -53207,12 +53334,12 @@ var SecondPassVisitor = {
53207
53334
  }
53208
53335
  };
53209
53336
  var ThirdPassVisitor = {
53210
- Backreference({ node, parent, replaceWith }, state3) {
53337
+ Backreference({ node, parent, replaceWith }, state2) {
53211
53338
  if (node.orphan) {
53212
- state3.highestOrphanBackref = Math.max(state3.highestOrphanBackref, node.ref);
53339
+ state2.highestOrphanBackref = Math.max(state2.highestOrphanBackref, node.ref);
53213
53340
  return;
53214
53341
  }
53215
- const reffedNodes = state3.reffedNodesByReferencer.get(node);
53342
+ const reffedNodes = state2.reffedNodesByReferencer.get(node);
53216
53343
  const participants = reffedNodes.filter((reffed) => canParticipateWithNode(reffed, node));
53217
53344
  if (!participants.length) {
53218
53345
  replaceWith(setParentDeep(K2({ negate: true }), parent));
@@ -53228,28 +53355,28 @@ var ThirdPassVisitor = {
53228
53355
  node.ref = participants[0].number;
53229
53356
  }
53230
53357
  },
53231
- CapturingGroup({ node }, state3) {
53232
- node.number = ++state3.numCapturesToLeft;
53358
+ CapturingGroup({ node }, state2) {
53359
+ node.number = ++state2.numCapturesToLeft;
53233
53360
  if (node.name) {
53234
- if (state3.groupsByName.get(node.name).get(node).hasDuplicateNameToRemove) {
53361
+ if (state2.groupsByName.get(node.name).get(node).hasDuplicateNameToRemove) {
53235
53362
  delete node.name;
53236
53363
  }
53237
53364
  }
53238
53365
  },
53239
53366
  Regex: {
53240
- exit({ node }, state3) {
53241
- const numCapsNeeded = Math.max(state3.highestOrphanBackref - state3.numCapturesToLeft, 0);
53367
+ exit({ node }, state2) {
53368
+ const numCapsNeeded = Math.max(state2.highestOrphanBackref - state2.numCapturesToLeft, 0);
53242
53369
  for (let i26 = 0; i26 < numCapsNeeded; i26++) {
53243
53370
  const emptyCapture = P4();
53244
53371
  node.body.at(-1).body.push(emptyCapture);
53245
53372
  }
53246
53373
  }
53247
53374
  },
53248
- Subroutine({ node }, state3) {
53375
+ Subroutine({ node }, state2) {
53249
53376
  if (!node.isRecursive || node.ref === 0) {
53250
53377
  return;
53251
53378
  }
53252
- node.ref = state3.reffedNodesByReferencer.get(node).number;
53379
+ node.ref = state2.reffedNodesByReferencer.get(node).number;
53253
53380
  }
53254
53381
  };
53255
53382
  function addParentProperties(root2) {
@@ -53491,7 +53618,7 @@ function generate(ast, options) {
53491
53618
  ignoreCase: !!((ast.flags.ignoreCase || hasCaseInsensitiveNode) && !hasCaseSensitiveNode)
53492
53619
  };
53493
53620
  let lastNode = ast;
53494
- const state3 = {
53621
+ const state2 = {
53495
53622
  accuracy: opts.accuracy,
53496
53623
  appliedGlobalFlags,
53497
53624
  captureMap: /* @__PURE__ */ new Map(),
@@ -53509,10 +53636,10 @@ function generate(ast, options) {
53509
53636
  verbose: opts.verbose
53510
53637
  };
53511
53638
  function gen(node) {
53512
- state3.lastNode = lastNode;
53639
+ state2.lastNode = lastNode;
53513
53640
  lastNode = node;
53514
53641
  const fn = throwIfNullish(generator[node.type], `Unexpected node type "${node.type}"`);
53515
- return fn(node, state3, gen);
53642
+ return fn(node, state2, gen);
53516
53643
  }
53517
53644
  const result = {
53518
53645
  pattern: ast.body.map(gen).join("|"),
@@ -53527,7 +53654,7 @@ function generate(ast, options) {
53527
53654
  }
53528
53655
  result._captureTransfers = /* @__PURE__ */ new Map();
53529
53656
  result._hiddenCaptures = [];
53530
- state3.captureMap.forEach((value, key2) => {
53657
+ state2.captureMap.forEach((value, key2) => {
53531
53658
  if (value.hidden) {
53532
53659
  result._hiddenCaptures.push(key2);
53533
53660
  }
@@ -53539,37 +53666,37 @@ function generate(ast, options) {
53539
53666
  }
53540
53667
  var FlagModifierVisitor = {
53541
53668
  "*": {
53542
- enter({ node }, state3) {
53669
+ enter({ node }, state2) {
53543
53670
  if (isAnyGroup(node)) {
53544
- const currentModI = state3.getCurrentModI();
53545
- state3.pushModI(
53671
+ const currentModI = state2.getCurrentModI();
53672
+ state2.pushModI(
53546
53673
  node.flags ? getNewCurrentFlags({ ignoreCase: currentModI }, node.flags).ignoreCase : currentModI
53547
53674
  );
53548
53675
  }
53549
53676
  },
53550
- exit({ node }, state3) {
53677
+ exit({ node }, state2) {
53551
53678
  if (isAnyGroup(node)) {
53552
- state3.popModI();
53679
+ state2.popModI();
53553
53680
  }
53554
53681
  }
53555
53682
  },
53556
- Backreference(_9, state3) {
53557
- state3.setHasCasedChar();
53683
+ Backreference(_9, state2) {
53684
+ state2.setHasCasedChar();
53558
53685
  },
53559
- Character({ node }, state3) {
53686
+ Character({ node }, state2) {
53560
53687
  if (charHasCase(cp(node.value))) {
53561
- state3.setHasCasedChar();
53688
+ state2.setHasCasedChar();
53562
53689
  }
53563
53690
  },
53564
- CharacterClassRange({ node, skip }, state3) {
53691
+ CharacterClassRange({ node, skip }, state2) {
53565
53692
  skip();
53566
53693
  if (getCasesOutsideCharClassRange(node, { firstOnly: true }).length) {
53567
- state3.setHasCasedChar();
53694
+ state2.setHasCasedChar();
53568
53695
  }
53569
53696
  },
53570
- CharacterSet({ node }, state3) {
53697
+ CharacterSet({ node }, state2) {
53571
53698
  if (node.kind === "property" && UnicodePropertiesWithSpecificCase.has(node.value)) {
53572
- state3.setHasCasedChar();
53699
+ state2.setHasCasedChar();
53573
53700
  }
53574
53701
  }
53575
53702
  };
@@ -53598,11 +53725,11 @@ var generator = {
53598
53725
  /**
53599
53726
  @param {BackreferenceNode} node
53600
53727
  */
53601
- Backreference({ ref }, state3) {
53728
+ Backreference({ ref }, state2) {
53602
53729
  if (typeof ref !== "number") {
53603
53730
  throw new Error("Unexpected named backref in transformed AST");
53604
53731
  }
53605
- if (!state3.useFlagMods && state3.accuracy === "strict" && state3.currentFlags.ignoreCase && !state3.captureMap.get(ref).ignoreCase) {
53732
+ if (!state2.useFlagMods && state2.accuracy === "strict" && state2.currentFlags.ignoreCase && !state2.captureMap.get(ref).ignoreCase) {
53606
53733
  throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");
53607
53734
  }
53608
53735
  return "\\" + ref;
@@ -53610,55 +53737,55 @@ var generator = {
53610
53737
  /**
53611
53738
  @param {CapturingGroupNode} node
53612
53739
  */
53613
- CapturingGroup(node, state3, gen) {
53740
+ CapturingGroup(node, state2, gen) {
53614
53741
  const { body: body4, name, number: number2 } = node;
53615
- const data = { ignoreCase: state3.currentFlags.ignoreCase };
53616
- const origin2 = state3.originMap.get(node);
53742
+ const data = { ignoreCase: state2.currentFlags.ignoreCase };
53743
+ const origin2 = state2.originMap.get(node);
53617
53744
  if (origin2) {
53618
53745
  data.hidden = true;
53619
53746
  if (number2 > origin2.number) {
53620
53747
  data.transferTo = origin2.number;
53621
53748
  }
53622
53749
  }
53623
- state3.captureMap.set(number2, data);
53750
+ state2.captureMap.set(number2, data);
53624
53751
  return `(${name ? `?<${name}>` : ""}${body4.map(gen).join("|")})`;
53625
53752
  },
53626
53753
  /**
53627
53754
  @param {CharacterNode} node
53628
53755
  */
53629
- Character({ value }, state3) {
53756
+ Character({ value }, state2) {
53630
53757
  const char = cp(value);
53631
53758
  const escaped = getCharEscape(value, {
53632
- escDigit: state3.lastNode.type === "Backreference",
53633
- inCharClass: state3.inCharClass,
53634
- useFlagV: state3.useFlagV
53759
+ escDigit: state2.lastNode.type === "Backreference",
53760
+ inCharClass: state2.inCharClass,
53761
+ useFlagV: state2.useFlagV
53635
53762
  });
53636
53763
  if (escaped !== char) {
53637
53764
  return escaped;
53638
53765
  }
53639
- if (state3.useAppliedIgnoreCase && state3.currentFlags.ignoreCase && charHasCase(char)) {
53766
+ if (state2.useAppliedIgnoreCase && state2.currentFlags.ignoreCase && charHasCase(char)) {
53640
53767
  const cases = getIgnoreCaseMatchChars(char);
53641
- return state3.inCharClass ? cases.join("") : cases.length > 1 ? `[${cases.join("")}]` : cases[0];
53768
+ return state2.inCharClass ? cases.join("") : cases.length > 1 ? `[${cases.join("")}]` : cases[0];
53642
53769
  }
53643
53770
  return char;
53644
53771
  },
53645
53772
  /**
53646
53773
  @param {CharacterClassNode} node
53647
53774
  */
53648
- CharacterClass(node, state3, gen) {
53775
+ CharacterClass(node, state2, gen) {
53649
53776
  const { kind, negate, parent } = node;
53650
53777
  let { body: body4 } = node;
53651
- if (kind === "intersection" && !state3.useFlagV) {
53778
+ if (kind === "intersection" && !state2.useFlagV) {
53652
53779
  throw new Error("Use of character class intersection requires min target ES2024");
53653
53780
  }
53654
- if (envFlags.bugFlagVLiteralHyphenIsRange && state3.useFlagV && body4.some(isLiteralHyphen)) {
53781
+ if (envFlags.bugFlagVLiteralHyphenIsRange && state2.useFlagV && body4.some(isLiteralHyphen)) {
53655
53782
  body4 = [m15(45), ...body4.filter((kid) => !isLiteralHyphen(kid))];
53656
53783
  }
53657
53784
  const genClass = () => `[${negate ? "^" : ""}${body4.map(gen).join(kind === "intersection" ? "&&" : "")}]`;
53658
- if (!state3.inCharClass) {
53785
+ if (!state2.inCharClass) {
53659
53786
  if (
53660
53787
  // Already established `kind !== 'intersection'` if `!state.useFlagV`; don't check again
53661
- (!state3.useFlagV || envFlags.bugNestedClassIgnoresNegation) && !negate
53788
+ (!state2.useFlagV || envFlags.bugNestedClassIgnoresNegation) && !negate
53662
53789
  ) {
53663
53790
  const negatedChildClasses = body4.filter(
53664
53791
  (kid) => kid.type === "CharacterClass" && kid.kind === "union" && kid.negate
@@ -53685,21 +53812,21 @@ var generator = {
53685
53812
  return gen(group);
53686
53813
  }
53687
53814
  }
53688
- state3.inCharClass = true;
53815
+ state2.inCharClass = true;
53689
53816
  const result = genClass();
53690
- state3.inCharClass = false;
53817
+ state2.inCharClass = false;
53691
53818
  return result;
53692
53819
  }
53693
53820
  const firstEl = body4[0];
53694
53821
  if (
53695
53822
  // Already established that the parent is a char class via `inCharClass`; don't check again
53696
53823
  kind === "union" && !negate && firstEl && // Allows many nested classes to work with `target` ES2018 which doesn't support nesting
53697
- ((!state3.useFlagV || !state3.verbose) && parent.kind === "union" && !(envFlags.bugFlagVLiteralHyphenIsRange && state3.useFlagV) || !state3.verbose && parent.kind === "intersection" && // JS doesn't allow intersection with union or ranges
53824
+ ((!state2.useFlagV || !state2.verbose) && parent.kind === "union" && !(envFlags.bugFlagVLiteralHyphenIsRange && state2.useFlagV) || !state2.verbose && parent.kind === "intersection" && // JS doesn't allow intersection with union or ranges
53698
53825
  body4.length === 1 && firstEl.type !== "CharacterClassRange")
53699
53826
  ) {
53700
53827
  return body4.map(gen).join("");
53701
53828
  }
53702
- if (!state3.useFlagV && parent.type === "CharacterClass") {
53829
+ if (!state2.useFlagV && parent.type === "CharacterClass") {
53703
53830
  throw new Error("Uses nested character class in a way that requires min target ES2024");
53704
53831
  }
53705
53832
  return genClass();
@@ -53707,18 +53834,18 @@ var generator = {
53707
53834
  /**
53708
53835
  @param {CharacterClassRangeNode} node
53709
53836
  */
53710
- CharacterClassRange(node, state3) {
53837
+ CharacterClassRange(node, state2) {
53711
53838
  const min2 = node.min.value;
53712
53839
  const max2 = node.max.value;
53713
53840
  const escOpts = {
53714
53841
  escDigit: false,
53715
53842
  inCharClass: true,
53716
- useFlagV: state3.useFlagV
53843
+ useFlagV: state2.useFlagV
53717
53844
  };
53718
53845
  const minStr = getCharEscape(min2, escOpts);
53719
53846
  const maxStr = getCharEscape(max2, escOpts);
53720
53847
  const extraChars = /* @__PURE__ */ new Set();
53721
- if (state3.useAppliedIgnoreCase && state3.currentFlags.ignoreCase) {
53848
+ if (state2.useAppliedIgnoreCase && state2.currentFlags.ignoreCase) {
53722
53849
  const charsOutsideRange = getCasesOutsideCharClassRange(node);
53723
53850
  const ranges = getCodePointRangesFromChars(charsOutsideRange);
53724
53851
  ranges.forEach((value) => {
@@ -53732,9 +53859,9 @@ var generator = {
53732
53859
  /**
53733
53860
  @param {CharacterSetNode} node
53734
53861
  */
53735
- CharacterSet({ kind, negate, value, key: key2 }, state3) {
53862
+ CharacterSet({ kind, negate, value, key: key2 }, state2) {
53736
53863
  if (kind === "dot") {
53737
- return state3.currentFlags.dotAll ? state3.appliedGlobalFlags.dotAll || state3.useFlagMods ? "." : "[^]" : (
53864
+ return state2.currentFlags.dotAll ? state2.appliedGlobalFlags.dotAll || state2.useFlagMods ? "." : "[^]" : (
53738
53865
  // Onig's only line break char is line feed, unlike JS
53739
53866
  r39`[^\n]`
53740
53867
  );
@@ -53743,7 +53870,7 @@ var generator = {
53743
53870
  return negate ? r39`\D` : r39`\d`;
53744
53871
  }
53745
53872
  if (kind === "property") {
53746
- if (state3.useAppliedIgnoreCase && state3.currentFlags.ignoreCase && UnicodePropertiesWithSpecificCase.has(value)) {
53873
+ if (state2.useAppliedIgnoreCase && state2.currentFlags.ignoreCase && UnicodePropertiesWithSpecificCase.has(value)) {
53747
53874
  throw new Error(`Unicode property "${value}" can't be case-insensitive when other chars have specific case`);
53748
53875
  }
53749
53876
  return `${negate ? r39`\P` : r39`\p`}{${key2 ? `${key2}=` : ""}${value}}`;
@@ -53756,28 +53883,28 @@ var generator = {
53756
53883
  /**
53757
53884
  @param {FlagsNode} node
53758
53885
  */
53759
- Flags(node, state3) {
53886
+ Flags(node, state2) {
53760
53887
  return (
53761
53888
  // The transformer should never turn on the properties for flags d, g, m since Onig doesn't
53762
53889
  // have equivs. Flag m is never used since Onig uses different line break chars than JS
53763
53890
  // (node.hasIndices ? 'd' : '') +
53764
53891
  // (node.global ? 'g' : '') +
53765
53892
  // (node.multiline ? 'm' : '') +
53766
- (state3.appliedGlobalFlags.ignoreCase ? "i" : "") + (node.dotAll ? "s" : "") + (node.sticky ? "y" : "")
53893
+ (state2.appliedGlobalFlags.ignoreCase ? "i" : "") + (node.dotAll ? "s" : "") + (node.sticky ? "y" : "")
53767
53894
  );
53768
53895
  },
53769
53896
  /**
53770
53897
  @param {GroupNode} node
53771
53898
  */
53772
- Group({ atomic: atomic2, body: body4, flags, parent }, state3, gen) {
53773
- const currentFlags = state3.currentFlags;
53899
+ Group({ atomic: atomic2, body: body4, flags, parent }, state2, gen) {
53900
+ const currentFlags = state2.currentFlags;
53774
53901
  if (flags) {
53775
- state3.currentFlags = getNewCurrentFlags(currentFlags, flags);
53902
+ state2.currentFlags = getNewCurrentFlags(currentFlags, flags);
53776
53903
  }
53777
53904
  const contents = body4.map(gen).join("|");
53778
- const result = !state3.verbose && body4.length === 1 && // Single alt
53779
- parent.type !== "Quantifier" && !atomic2 && (!state3.useFlagMods || !flags) ? contents : `(?${getGroupPrefix(atomic2, flags, state3.useFlagMods)}${contents})`;
53780
- state3.currentFlags = currentFlags;
53905
+ const result = !state2.verbose && body4.length === 1 && // Single alt
53906
+ parent.type !== "Quantifier" && !atomic2 && (!state2.useFlagMods || !flags) ? contents : `(?${getGroupPrefix(atomic2, flags, state2.useFlagMods)}${contents})`;
53907
+ state2.currentFlags = currentFlags;
53781
53908
  return result;
53782
53909
  },
53783
53910
  /**
@@ -53796,11 +53923,11 @@ var generator = {
53796
53923
  /**
53797
53924
  @param {SubroutineNode & {isRecursive: true}} node
53798
53925
  */
53799
- Subroutine({ isRecursive, ref }, state3) {
53926
+ Subroutine({ isRecursive, ref }, state2) {
53800
53927
  if (!isRecursive) {
53801
53928
  throw new Error("Unexpected non-recursive subroutine in transformed AST");
53802
53929
  }
53803
- const limit2 = state3.recursionLimit;
53930
+ const limit2 = state2.recursionLimit;
53804
53931
  return ref === 0 ? `(?R=${limit2})` : r39`\g<${ref}&R=${limit2}>`;
53805
53932
  }
53806
53933
  };
@@ -55766,13 +55893,13 @@ var InteractionManager = class {
55766
55893
  }
55767
55894
  };
55768
55895
  }
55769
- resolveLineRenderRange(state3, split, source) {
55770
- if (state3.range == null) return;
55771
- const rowRange = this.getIndexesFromSelection(state3.range, split);
55896
+ resolveLineRenderRange(state2, split, source) {
55897
+ if (state2.range == null) return;
55898
+ const rowRange = this.getIndexesFromSelection(state2.range, split);
55772
55899
  if (rowRange == null) {
55773
55900
  console.error({
55774
55901
  rowRange,
55775
- range: state3.range
55902
+ range: state2.range
55776
55903
  });
55777
55904
  throw new Error(`InteractionManager.renderSelection: No valid ${source} rowRange`);
55778
55905
  }
@@ -57054,14 +57181,14 @@ function isDefaultRenderRange(renderRange) {
57054
57181
  }
57055
57182
 
57056
57183
  // node_modules/@pierre/diffs/dist/utils/processLine.js
57057
- function processLine(node, line, state3) {
57058
- const lineInfo = typeof state3.lineInfo === "function" ? state3.lineInfo(line) : state3.lineInfo[line - 1];
57184
+ function processLine(node, line, state2) {
57185
+ const lineInfo = typeof state2.lineInfo === "function" ? state2.lineInfo(line) : state2.lineInfo[line - 1];
57059
57186
  if (lineInfo == null) {
57060
57187
  const errorMessage = `processLine: line ${line}, contains no state.lineInfo`;
57061
57188
  console.error(errorMessage, {
57062
57189
  node,
57063
57190
  line,
57064
- state: state3
57191
+ state: state2
57065
57192
  });
57066
57193
  throw new Error(errorMessage);
57067
57194
  }
@@ -57213,7 +57340,7 @@ function cyrb53(str, seed2 = 0) {
57213
57340
 
57214
57341
  // node_modules/@pierre/diffs/dist/utils/createTransformerWithState.js
57215
57342
  function createTransformerWithState(useTokenTransformer = false, useCSSClasses = false) {
57216
- const state3 = { lineInfo: [] };
57343
+ const state2 = { lineInfo: [] };
57217
57344
  const transformers = [{
57218
57345
  line(node) {
57219
57346
  delete node.properties.class;
@@ -57227,7 +57354,7 @@ function createTransformerWithState(useTokenTransformer = false, useCSSClasses =
57227
57354
  for (const node of code2.children) {
57228
57355
  if (node.type !== "element") continue;
57229
57356
  if (useTokenTransformer) wrapTokenFragments(node);
57230
- children.push(processLine(node, index, state3));
57357
+ children.push(processLine(node, index, state2));
57231
57358
  index++;
57232
57359
  }
57233
57360
  code2.children = children;
@@ -57269,7 +57396,7 @@ function createTransformerWithState(useTokenTransformer = false, useCSSClasses =
57269
57396
  return node;
57270
57397
  } });
57271
57398
  return {
57272
- state: state3,
57399
+ state: state2,
57273
57400
  transformers,
57274
57401
  toClass
57275
57402
  };
@@ -57362,9 +57489,9 @@ function hoverWouldEraseText(hover, bg, fg) {
57362
57489
  }
57363
57490
 
57364
57491
  // node_modules/@pierre/theming/dist/modules/normalizeThemeColors.js
57365
- var cache = /* @__PURE__ */ new WeakMap();
57492
+ var cache2 = /* @__PURE__ */ new WeakMap();
57366
57493
  function normalizeThemeColors(theme3) {
57367
- const cached = cache.get(theme3);
57494
+ const cached = cache2.get(theme3);
57368
57495
  if (cached != null) return cached;
57369
57496
  const originalColors = theme3.colors ?? {};
57370
57497
  const colors = { ...originalColors };
@@ -57391,7 +57518,7 @@ function normalizeThemeColors(theme3) {
57391
57518
  ...theme3,
57392
57519
  colors: Object.freeze(colors)
57393
57520
  });
57394
- cache.set(theme3, result);
57521
+ cache2.set(theme3, result);
57395
57522
  return result;
57396
57523
  }
57397
57524
  function fill(colors, key2, value) {
@@ -57522,14 +57649,14 @@ function renderFileWithHighlighter(file, highlighter2, { theme: theme3, tokenize
57522
57649
  totalLines = Infinity;
57523
57650
  }
57524
57651
  const isWindowedHighlight = startingLine > 0 || totalLines < Infinity;
57525
- const { state: state3, transformers } = createTransformerWithState(useTokenTransformer);
57652
+ const { state: state2, transformers } = createTransformerWithState(useTokenTransformer);
57526
57653
  const lang = forcePlainText ? "text" : file.lang ?? getFiletypeFromFileName(file.name);
57527
57654
  const baseThemeType = typeof theme3 === "string" ? highlighter2.getTheme(theme3).type : void 0;
57528
57655
  const themeStyles = getHighlighterThemeStyles({
57529
57656
  theme: theme3,
57530
57657
  highlighter: highlighter2
57531
57658
  });
57532
- state3.lineInfo = (shikiLineNumber) => ({
57659
+ state2.lineInfo = (shikiLineNumber) => ({
57533
57660
  type: "context",
57534
57661
  lineIndex: shikiLineNumber - 1 + startingLine,
57535
57662
  lineNumber: shikiLineNumber + startingLine
@@ -57760,14 +57887,14 @@ var FileRenderer = class {
57760
57887
  this.file = file;
57761
57888
  const { options } = this.getRenderOptions(file);
57762
57889
  const massiveFile = isFileMassive(this.getOrCreateLineCache(file).length, this.getTokenizeMaxLength());
57763
- let cache3 = this.workerManager?.getFileResultCache(file);
57764
- if (cache3 != null && !areFileRenderOptionsEqual(options, cache3.options)) cache3 = void 0;
57890
+ let cache4 = this.workerManager?.getFileResultCache(file);
57891
+ if (cache4 != null && !areFileRenderOptionsEqual(options, cache4.options)) cache4 = void 0;
57765
57892
  this.renderCache ??= {
57766
57893
  file,
57767
57894
  hydrated: true,
57768
57895
  options,
57769
57896
  highlighted: !massiveFile && !isFilePlainText(file),
57770
- result: massiveFile ? void 0 : cache3?.result,
57897
+ result: massiveFile ? void 0 : cache4?.result,
57771
57898
  renderRange: void 0
57772
57899
  };
57773
57900
  if (!this.editSessionActive && this.workerManager?.isWorkingPool() === true) {
@@ -58177,9 +58304,9 @@ var FileRenderer = class {
58177
58304
  }
58178
58305
  getMatchingWorkerResultCache(file, options) {
58179
58306
  if (this.editSessionActive) return;
58180
- const cache3 = this.workerManager?.getFileResultCache(file);
58181
- if (cache3 == null || !areFileRenderOptionsEqual(options, cache3.options)) return;
58182
- return cache3;
58307
+ const cache4 = this.workerManager?.getFileResultCache(file);
58308
+ if (cache4 == null || !areFileRenderOptionsEqual(options, cache4.options)) return;
58309
+ return cache4;
58183
58310
  }
58184
58311
  getReadyRenderResult(file, options) {
58185
58312
  const { pendingHighlightResult } = this;
@@ -59330,18 +59457,18 @@ var File = class {
59330
59457
  if (renderAnnotation != null && lineAnnotations.length > 0) for (const [index, annotation] of lineAnnotations.entries()) {
59331
59458
  const name = this.getAnnotationSlotName(annotation);
59332
59459
  const id = `${index}-${name}`;
59333
- let cache3 = this.annotationCache.get(id);
59334
- if (cache3 == null || !areLineAnnotationsEqual(annotation, cache3.annotation)) {
59335
- cache3?.element.remove();
59460
+ let cache4 = this.annotationCache.get(id);
59461
+ if (cache4 == null || !areLineAnnotationsEqual(annotation, cache4.annotation)) {
59462
+ cache4?.element.remove();
59336
59463
  const content = renderAnnotation(annotation);
59337
59464
  if (content == null) continue;
59338
- cache3 = {
59465
+ cache4 = {
59339
59466
  element: createAnnotationWrapperNode(name),
59340
59467
  annotation
59341
59468
  };
59342
- cache3.element.appendChild(content);
59343
- this.fileContainer.appendChild(cache3.element);
59344
- this.annotationCache.set(id, cache3);
59469
+ cache4.element.appendChild(content);
59470
+ this.fileContainer.appendChild(cache4.element);
59471
+ this.annotationCache.set(id, cache4);
59345
59472
  }
59346
59473
  staleAnnotations.delete(id);
59347
59474
  }
@@ -61732,7 +61859,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
61732
61859
  expandedHunks,
61733
61860
  collapsedContextThreshold
61734
61861
  });
61735
- const state3 = {
61862
+ const state2 = {
61736
61863
  viewportStart: startingLine,
61737
61864
  viewportEnd: startingLine + totalLines,
61738
61865
  isWindowedHighlight: startingLine > 0 || totalLines < Infinity,
@@ -61740,44 +61867,44 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
61740
61867
  unifiedCount: iterationStart.unifiedCount,
61741
61868
  finalHunkIndex: diff.hunks.length - 1,
61742
61869
  shouldBreak() {
61743
- if (!state3.isWindowedHighlight) return false;
61744
- const breakUnified = state3.unifiedCount >= startingLine + totalLines;
61745
- const breakSplit = state3.splitCount >= startingLine + totalLines;
61870
+ if (!state2.isWindowedHighlight) return false;
61871
+ const breakUnified = state2.unifiedCount >= startingLine + totalLines;
61872
+ const breakSplit = state2.splitCount >= startingLine + totalLines;
61746
61873
  if (diffStyle === "unified") return breakUnified;
61747
61874
  else if (diffStyle === "split") return breakSplit;
61748
61875
  else return breakUnified && breakSplit;
61749
61876
  },
61750
61877
  shouldSkip(unifiedCount, splitCount) {
61751
- if (!state3.isWindowedHighlight) return false;
61752
- const skipUnified = unifiedCount > 0 && state3.unifiedCount + unifiedCount <= startingLine;
61753
- const skipSplit = splitCount > 0 && state3.splitCount + splitCount <= startingLine;
61878
+ if (!state2.isWindowedHighlight) return false;
61879
+ const skipUnified = unifiedCount > 0 && state2.unifiedCount + unifiedCount <= startingLine;
61880
+ const skipSplit = splitCount > 0 && state2.splitCount + splitCount <= startingLine;
61754
61881
  if (diffStyle === "unified") return skipUnified;
61755
61882
  else if (diffStyle === "split") return skipSplit;
61756
61883
  else return skipUnified && skipSplit;
61757
61884
  },
61758
61885
  incrementCounts(unifiedValue, splitValue) {
61759
- if (diffStyle === "unified" || diffStyle === "both") state3.unifiedCount += unifiedValue;
61760
- if (diffStyle === "split" || diffStyle === "both") state3.splitCount += splitValue;
61886
+ if (diffStyle === "unified" || diffStyle === "both") state2.unifiedCount += unifiedValue;
61887
+ if (diffStyle === "split" || diffStyle === "both") state2.splitCount += splitValue;
61761
61888
  },
61762
61889
  isInWindow(unifiedHeight, splitHeight) {
61763
- if (!state3.isWindowedHighlight) return true;
61764
- const unifiedInWindow = state3.isInUnifiedWindow(unifiedHeight);
61765
- const splitInWindow = state3.isInSplitWindow(splitHeight);
61890
+ if (!state2.isWindowedHighlight) return true;
61891
+ const unifiedInWindow = state2.isInUnifiedWindow(unifiedHeight);
61892
+ const splitInWindow = state2.isInSplitWindow(splitHeight);
61766
61893
  if (diffStyle === "unified") return unifiedInWindow;
61767
61894
  else if (diffStyle === "split") return splitInWindow;
61768
61895
  else return unifiedInWindow || splitInWindow;
61769
61896
  },
61770
61897
  isInUnifiedWindow(unifiedHeight) {
61771
- return !state3.isWindowedHighlight || state3.unifiedCount >= startingLine - unifiedHeight && state3.unifiedCount < startingLine + totalLines;
61898
+ return !state2.isWindowedHighlight || state2.unifiedCount >= startingLine - unifiedHeight && state2.unifiedCount < startingLine + totalLines;
61772
61899
  },
61773
61900
  isInSplitWindow(splitHeight) {
61774
- return !state3.isWindowedHighlight || state3.splitCount >= startingLine - splitHeight && state3.splitCount < startingLine + totalLines;
61901
+ return !state2.isWindowedHighlight || state2.splitCount >= startingLine - splitHeight && state2.splitCount < startingLine + totalLines;
61775
61902
  },
61776
61903
  emit(props, silent2 = false) {
61777
61904
  if (!silent2) {
61778
- if (diffStyle === "unified") state3.incrementCounts(1, 0);
61779
- else if (diffStyle === "split") state3.incrementCounts(0, 1);
61780
- else state3.incrementCounts(1, 1);
61905
+ if (diffStyle === "unified") state2.incrementCounts(1, 0);
61906
+ else if (diffStyle === "split") state2.incrementCounts(0, 1);
61907
+ else state2.incrementCounts(1, 1);
61781
61908
  }
61782
61909
  return callback(props) ?? false;
61783
61910
  }
@@ -61794,7 +61921,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
61794
61921
  };
61795
61922
  const hunk = diff.hunks[hunkIndex];
61796
61923
  if (hunk == null) throw new Error("iterateOverDiff: invalid hunk index");
61797
- if (state3.shouldBreak()) break;
61924
+ if (state2.shouldBreak()) break;
61798
61925
  const deletionBoundary = getHunkSideStartBoundary(hunk.deletionStart, hunk.deletionCount);
61799
61926
  const additionBoundary = getHunkSideStartBoundary(hunk.additionStart, hunk.additionCount);
61800
61927
  const deletionStartIndex = !diff.isPartial && hunk.deletionCount === 0 ? deletionBoundary : hunk.deletionLineIndex;
@@ -61806,7 +61933,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
61806
61933
  hunkIndex,
61807
61934
  collapsedContextThreshold
61808
61935
  });
61809
- const trailingRegion = hunkIndex === state3.finalHunkIndex ? getTrailingExpandedRegion({
61936
+ const trailingRegion = hunkIndex === state2.finalHunkIndex ? getTrailingExpandedRegion({
61810
61937
  fileDiff: diff,
61811
61938
  hunkIndex,
61812
61939
  expandedHunks,
@@ -61815,15 +61942,15 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
61815
61942
  }) : void 0;
61816
61943
  const expandedLineCount = leadingRegion.fromStart + leadingRegion.fromEnd;
61817
61944
  let consumedCollapsed = leadingRegion.collapsedLines === 0;
61818
- if (!state3.shouldSkip(expandedLineCount, expandedLineCount)) {
61945
+ if (!state2.shouldSkip(expandedLineCount, expandedLineCount)) {
61819
61946
  let unifiedLineIndex2 = hunk.unifiedLineStart - leadingRegion.rangeSize;
61820
61947
  let splitLineIndex2 = hunk.splitLineStart - leadingRegion.rangeSize;
61821
61948
  let deletionLineIndex2 = deletionStartIndex - leadingRegion.rangeSize;
61822
61949
  let additionLineIndex2 = additionStartIndex - leadingRegion.rangeSize;
61823
61950
  let deletionLineNumber2 = deletionBoundary + 1 - leadingRegion.rangeSize;
61824
61951
  let additionLineNumber2 = additionBoundary + 1 - leadingRegion.rangeSize;
61825
- if (walkContextLines(state3, leadingRegion.fromStart, diffStyle, (index) => {
61826
- return state3.emit({
61952
+ if (walkContextLines(state2, leadingRegion.fromStart, diffStyle, (index) => {
61953
+ return state2.emit({
61827
61954
  hunkIndex,
61828
61955
  hunk,
61829
61956
  collapsedBefore: 0,
@@ -61851,8 +61978,8 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
61851
61978
  additionLineIndex2 = additionStartIndex - leadingRegion.fromEnd;
61852
61979
  deletionLineNumber2 = deletionBoundary + 1 - leadingRegion.fromEnd;
61853
61980
  additionLineNumber2 = additionBoundary + 1 - leadingRegion.fromEnd;
61854
- if (walkContextLines(state3, leadingRegion.fromEnd, diffStyle, (index) => {
61855
- return state3.emit({
61981
+ if (walkContextLines(state2, leadingRegion.fromEnd, diffStyle, (index) => {
61982
+ return state2.emit({
61856
61983
  hunkIndex,
61857
61984
  hunk,
61858
61985
  collapsedBefore: consumePendingCollapsed(),
@@ -61877,7 +62004,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
61877
62004
  consumePendingCollapsed();
61878
62005
  })) break hunkIterator;
61879
62006
  } else {
61880
- state3.incrementCounts(expandedLineCount, expandedLineCount);
62007
+ state2.incrementCounts(expandedLineCount, expandedLineCount);
61881
62008
  consumePendingCollapsed();
61882
62009
  }
61883
62010
  let unifiedLineIndex = hunk.unifiedLineStart;
@@ -61888,15 +62015,15 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
61888
62015
  let additionLineNumber = additionBoundary + 1;
61889
62016
  const lastContent = hunk.hunkContent.at(-1);
61890
62017
  for (const content of hunk.hunkContent) {
61891
- if (state3.shouldBreak()) break hunkIterator;
62018
+ if (state2.shouldBreak()) break hunkIterator;
61892
62019
  const isLastContent = content === lastContent;
61893
62020
  if (content.type === "context") {
61894
- if (!state3.shouldSkip(content.lines, content.lines)) {
61895
- if (walkContextLines(state3, content.lines, diffStyle, (index) => {
62021
+ if (!state2.shouldSkip(content.lines, content.lines)) {
62022
+ if (walkContextLines(state2, content.lines, diffStyle, (index) => {
61896
62023
  const isLastLine = isLastContent && index === content.lines - 1;
61897
62024
  const unifiedRowIndex = unifiedLineIndex + index;
61898
62025
  const splitRowIndex = splitLineIndex + index;
61899
- return state3.emit({
62026
+ return state2.emit({
61900
62027
  hunkIndex,
61901
62028
  hunk,
61902
62029
  collapsedBefore: consumePendingCollapsed(),
@@ -61921,7 +62048,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
61921
62048
  consumePendingCollapsed();
61922
62049
  })) break hunkIterator;
61923
62050
  } else {
61924
- state3.incrementCounts(content.lines, content.lines);
62051
+ state2.incrementCounts(content.lines, content.lines);
61925
62052
  consumePendingCollapsed();
61926
62053
  }
61927
62054
  unifiedLineIndex += content.lines;
@@ -61933,12 +62060,12 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
61933
62060
  } else {
61934
62061
  const splitCount = Math.max(content.deletions, content.additions);
61935
62062
  const unifiedCount = content.deletions + content.additions;
61936
- if (!state3.shouldSkip(unifiedCount, splitCount)) {
61937
- const iterationRanges = getChangeIterationRanges(state3, content, diffStyle);
62063
+ if (!state2.shouldSkip(unifiedCount, splitCount)) {
62064
+ const iterationRanges = getChangeIterationRanges(state2, content, diffStyle);
61938
62065
  if ((iterationRanges[0]?.[0] ?? 0) > 0) consumePendingCollapsed();
61939
62066
  for (const [rangeStart, rangeEnd] of iterationRanges) for (let index = rangeStart; index < rangeEnd; index++) {
61940
62067
  const collapsedAfter = getTrailingCollapsedAfter(unifiedLineIndex + index, diffStyle === "unified" ? splitLineIndex + (index < content.deletions ? index : index - content.deletions) : splitLineIndex + index);
61941
- if (state3.emit(getChangeLineData({
62068
+ if (state2.emit(getChangeLineData({
61942
62069
  hunkIndex,
61943
62070
  hunk,
61944
62071
  collapsedBefore: consumePendingCollapsed(),
@@ -61959,7 +62086,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
61959
62086
  }
61960
62087
  }
61961
62088
  consumePendingCollapsed();
61962
- state3.incrementCounts(unifiedCount, splitCount);
62089
+ state2.incrementCounts(unifiedCount, splitCount);
61963
62090
  unifiedLineIndex += unifiedCount;
61964
62091
  splitLineIndex += splitCount;
61965
62092
  deletionLineIndex += content.deletions;
@@ -61971,9 +62098,9 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
61971
62098
  if (trailingRegion != null) {
61972
62099
  const { collapsedLines, fromStart, fromEnd } = trailingRegion;
61973
62100
  const len = fromStart + fromEnd;
61974
- if (walkContextLines(state3, len, diffStyle, (index) => {
62101
+ if (walkContextLines(state2, len, diffStyle, (index) => {
61975
62102
  const isLastLine = index === len - 1;
61976
- return state3.emit({
62103
+ return state2.emit({
61977
62104
  hunkIndex: diff.hunks.length,
61978
62105
  hunk: void 0,
61979
62106
  collapsedBefore: 0,
@@ -61994,7 +62121,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
61994
62121
  noEOFCR: false
61995
62122
  }
61996
62123
  });
61997
- }, void 0, () => state3.shouldBreak())) break hunkIterator;
62124
+ }, void 0, () => state2.shouldBreak())) break hunkIterator;
61998
62125
  }
61999
62126
  }
62000
62127
  }
@@ -62078,16 +62205,16 @@ function getHunkPrefixCounts({ diff, expandedHunks, collapsedContextThreshold })
62078
62205
  }
62079
62206
  return prefixCounts;
62080
62207
  }
62081
- function getContextLineIterationBounds(state3, count, diffStyle) {
62082
- if (!state3.isWindowedHighlight || count <= 0) return [0, count];
62208
+ function getContextLineIterationBounds(state2, count, diffStyle) {
62209
+ if (!state2.isWindowedHighlight || count <= 0) return [0, count];
62083
62210
  const ranges = [];
62084
62211
  function pushRange(currentCount) {
62085
- const start2 = Math.max(0, state3.viewportStart - currentCount);
62086
- const end2 = Math.min(count, state3.viewportEnd - currentCount);
62212
+ const start2 = Math.max(0, state2.viewportStart - currentCount);
62213
+ const end2 = Math.min(count, state2.viewportEnd - currentCount);
62087
62214
  if (end2 > start2) ranges.push([start2, end2]);
62088
62215
  }
62089
- if (diffStyle !== "split") pushRange(state3.unifiedCount);
62090
- if (diffStyle !== "unified") pushRange(state3.splitCount);
62216
+ if (diffStyle !== "split") pushRange(state2.unifiedCount);
62217
+ if (diffStyle !== "unified") pushRange(state2.splitCount);
62091
62218
  if (ranges.length === 0) return [0, 0];
62092
62219
  let start = ranges[0][0];
62093
62220
  let end = ranges[0][1];
@@ -62098,36 +62225,36 @@ function getContextLineIterationBounds(state3, count, diffStyle) {
62098
62225
  }
62099
62226
  return [start, end];
62100
62227
  }
62101
- function walkContextLines(state3, count, diffStyle, callback, onSkippedStart, shouldBreak) {
62102
- const [startIndex, endIndex] = getContextLineIterationBounds(state3, count, diffStyle);
62228
+ function walkContextLines(state2, count, diffStyle, callback, onSkippedStart, shouldBreak) {
62229
+ const [startIndex, endIndex] = getContextLineIterationBounds(state2, count, diffStyle);
62103
62230
  if (startIndex > 0) {
62104
- state3.incrementCounts(startIndex, startIndex);
62231
+ state2.incrementCounts(startIndex, startIndex);
62105
62232
  onSkippedStart?.();
62106
62233
  }
62107
62234
  let index = startIndex;
62108
62235
  while (index < count) {
62109
62236
  if (shouldBreak?.() === true) return true;
62110
62237
  if (index >= endIndex) {
62111
- state3.incrementCounts(count - index, count - index);
62238
+ state2.incrementCounts(count - index, count - index);
62112
62239
  break;
62113
62240
  }
62114
- if (state3.isInWindow(0, 0)) {
62241
+ if (state2.isInWindow(0, 0)) {
62115
62242
  if (callback(index) === true) return true;
62116
- } else state3.incrementCounts(1, 1);
62243
+ } else state2.incrementCounts(1, 1);
62117
62244
  index++;
62118
62245
  }
62119
62246
  return false;
62120
62247
  }
62121
- function getChangeIterationRanges(state3, content, diffStyle) {
62122
- if (!state3.isWindowedHighlight) return [[0, diffStyle === "unified" ? content.deletions + content.additions : Math.max(content.deletions, content.additions)]];
62248
+ function getChangeIterationRanges(state2, content, diffStyle) {
62249
+ if (!state2.isWindowedHighlight) return [[0, diffStyle === "unified" ? content.deletions + content.additions : Math.max(content.deletions, content.additions)]];
62123
62250
  const useUnified = diffStyle !== "split";
62124
62251
  const useSplit = diffStyle !== "unified";
62125
62252
  const iterationSpace = diffStyle === "unified" ? "unified" : "split";
62126
62253
  const iterationRanges = [];
62127
62254
  function getVisibleRange(start, count) {
62128
- if (start + count <= state3.viewportStart || start >= state3.viewportEnd) return;
62129
- const visibleStart = Math.max(0, state3.viewportStart - start);
62130
- const visibleEnd = Math.min(count, state3.viewportEnd - start);
62255
+ if (start + count <= state2.viewportStart || start >= state2.viewportEnd) return;
62256
+ const visibleStart = Math.max(0, state2.viewportStart - start);
62257
+ const visibleEnd = Math.min(count, state2.viewportEnd - start);
62131
62258
  return visibleEnd > visibleStart ? [visibleStart, visibleEnd] : void 0;
62132
62259
  }
62133
62260
  function mapRangeToIteration(range3, kind) {
@@ -62140,12 +62267,12 @@ function getChangeIterationRanges(state3, content, diffStyle) {
62140
62267
  if (end > start) iterationRanges.push([start, end]);
62141
62268
  }
62142
62269
  if (useUnified) {
62143
- pushRange(getVisibleRange(state3.unifiedCount, content.deletions), "deletions");
62144
- pushRange(getVisibleRange(state3.unifiedCount + content.deletions, content.additions), "additions");
62270
+ pushRange(getVisibleRange(state2.unifiedCount, content.deletions), "deletions");
62271
+ pushRange(getVisibleRange(state2.unifiedCount + content.deletions, content.additions), "additions");
62145
62272
  }
62146
62273
  if (useSplit) {
62147
- pushRange(getVisibleRange(state3.splitCount, content.deletions), "deletions");
62148
- pushRange(getVisibleRange(state3.splitCount, content.additions), "additions");
62274
+ pushRange(getVisibleRange(state2.splitCount, content.deletions), "deletions");
62275
+ pushRange(getVisibleRange(state2.splitCount, content.additions), "additions");
62149
62276
  }
62150
62277
  if (iterationRanges.length === 0) return iterationRanges;
62151
62278
  iterationRanges.sort((a23, b13) => a23[0] - b13[0]);
@@ -62461,7 +62588,7 @@ function createBucket() {
62461
62588
  function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo, highlighter: highlighter2, deletionDecorations, additionDecorations, languageOverride, options: { theme: themeOrThemes, ...options } }) {
62462
62589
  const deletionLang = languageOverride ?? getFiletypeFromFileName(deletionFile.name);
62463
62590
  const additionLang = languageOverride ?? getFiletypeFromFileName(additionFile.name);
62464
- const { state: state3, transformers } = createTransformerWithState(options.useTokenTransformer);
62591
+ const { state: state2, transformers } = createTransformerWithState(options.useTokenTransformer);
62465
62592
  const hastConfig = (() => {
62466
62593
  return typeof themeOrThemes === "string" ? {
62467
62594
  ...options,
@@ -62487,7 +62614,7 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
62487
62614
  deletionLines: (() => {
62488
62615
  if (deletionFile.contents === "") return [];
62489
62616
  hastConfig.lang = deletionLang;
62490
- state3.lineInfo = deletionInfo;
62617
+ state2.lineInfo = deletionInfo;
62491
62618
  hastConfig.decorations = deletionDecorations;
62492
62619
  return getLineNodes(highlighter2.codeToHast(cleanLastNewline(deletionFile.contents), hastConfig));
62493
62620
  })(),
@@ -62495,7 +62622,7 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
62495
62622
  if (additionFile.contents === "") return [];
62496
62623
  hastConfig.lang = additionLang;
62497
62624
  hastConfig.decorations = additionDecorations;
62498
- state3.lineInfo = additionInfo;
62625
+ state2.lineInfo = additionInfo;
62499
62626
  return getLineNodes(highlighter2.codeToHast(cleanLastNewline(additionFile.contents), hastConfig));
62500
62627
  })()
62501
62628
  };
@@ -63544,14 +63671,14 @@ var DiffHunksRenderer = class {
63544
63671
  this.diff = diff;
63545
63672
  const { options } = this.getRenderOptions(diff);
63546
63673
  const massiveDiff = isDiffMassive(diff, this.getTokenizeMaxLength());
63547
- let cache3 = this.workerManager?.getDiffResultCache(diff);
63548
- if (cache3 != null && !areDiffRenderOptionsEqual(options, cache3.options)) cache3 = void 0;
63674
+ let cache4 = this.workerManager?.getDiffResultCache(diff);
63675
+ if (cache4 != null && !areDiffRenderOptionsEqual(options, cache4.options)) cache4 = void 0;
63549
63676
  this.renderCache ??= {
63550
63677
  diff,
63551
63678
  hydrated: true,
63552
63679
  highlighted: !massiveDiff && !isDiffPlainText(diff),
63553
63680
  options,
63554
- result: massiveDiff ? void 0 : cache3?.result,
63681
+ result: massiveDiff ? void 0 : cache4?.result,
63555
63682
  renderRange: void 0
63556
63683
  };
63557
63684
  if (!this.editSessionActive && this.workerManager?.isWorkingPool() === true) {
@@ -63761,9 +63888,9 @@ var DiffHunksRenderer = class {
63761
63888
  }
63762
63889
  getMatchingWorkerResultCache(diff, options) {
63763
63890
  if (this.editSessionActive) return;
63764
- const cache3 = this.workerManager?.getDiffResultCache(diff);
63765
- if (cache3 == null || !areDiffRenderOptionsEqual(options, cache3.options)) return;
63766
- return cache3;
63891
+ const cache4 = this.workerManager?.getDiffResultCache(diff);
63892
+ if (cache4 == null || !areDiffRenderOptionsEqual(options, cache4.options)) return;
63893
+ return cache4;
63767
63894
  }
63768
63895
  getReadyRenderResult(diff, options) {
63769
63896
  const { pendingHighlightResult } = this;
@@ -65678,20 +65805,20 @@ var FileDiff = class {
65678
65805
  const staleSeparators = new Map(this.separatorCache);
65679
65806
  for (const hunk of hunkData) {
65680
65807
  const id = hunk.slotName;
65681
- let cache3 = this.separatorCache.get(id);
65682
- if (cache3 == null || !areHunkDataEqual(hunk, cache3.hunkData)) {
65683
- cache3?.element.remove();
65808
+ let cache4 = this.separatorCache.get(id);
65809
+ if (cache4 == null || !areHunkDataEqual(hunk, cache4.hunkData)) {
65810
+ cache4?.element.remove();
65684
65811
  const element2 = document.createElement("div");
65685
65812
  element2.style.display = "contents";
65686
65813
  element2.slot = hunk.slotName;
65687
65814
  const child = hunkSeparators(hunk, this);
65688
65815
  if (child != null) element2.appendChild(child);
65689
65816
  this.fileContainer.appendChild(element2);
65690
- cache3 = {
65817
+ cache4 = {
65691
65818
  element: element2,
65692
65819
  hunkData: hunk
65693
65820
  };
65694
- this.separatorCache.set(id, cache3);
65821
+ this.separatorCache.set(id, cache4);
65695
65822
  }
65696
65823
  staleSeparators.delete(id);
65697
65824
  }
@@ -65712,18 +65839,18 @@ var FileDiff = class {
65712
65839
  if (renderAnnotation != null && lineAnnotations.length > 0) for (const [index, annotation] of lineAnnotations.entries()) {
65713
65840
  const name = this.getAnnotationSlotName(annotation);
65714
65841
  const id = `${index}-${name}`;
65715
- let cache3 = this.annotationCache.get(id);
65716
- if (cache3 == null || !areDiffLineAnnotationsEqual(annotation, cache3.annotation)) {
65717
- cache3?.element.remove();
65842
+ let cache4 = this.annotationCache.get(id);
65843
+ if (cache4 == null || !areDiffLineAnnotationsEqual(annotation, cache4.annotation)) {
65844
+ cache4?.element.remove();
65718
65845
  const content = renderAnnotation(annotation);
65719
65846
  if (content == null) continue;
65720
- cache3 = {
65847
+ cache4 = {
65721
65848
  element: createAnnotationWrapperNode(name),
65722
65849
  annotation
65723
65850
  };
65724
- cache3.element.appendChild(content);
65725
- this.fileContainer.appendChild(cache3.element);
65726
- this.annotationCache.set(id, cache3);
65851
+ cache4.element.appendChild(content);
65852
+ this.fileContainer.appendChild(cache4.element);
65853
+ this.annotationCache.set(id, cache4);
65727
65854
  }
65728
65855
  staleAnnotations.delete(id);
65729
65856
  }
@@ -66469,13 +66596,13 @@ function getElementChildren(node) {
66469
66596
  var code_default = ':host {\n display: block;\n height: 100%;\n overflow: auto;\n background: var(--spectrum-background-layer-2-color, #fff);\n --diffs-font-family: var(\n --spectrum-code-font-family-stack,\n ui-monospace,\n "SF Mono",\n Menlo,\n Consolas,\n monospace\n );\n --diffs-font-size: var(--spectrum-font-size-75, 12px);\n --diffs-bg-context-override: var(--spectrum-background-layer-2-color, #fff);\n --diffs-bg-context-gutter-override: var(--spectrum-background-layer-1-color, #f8f8f8);\n --diffs-bg-buffer-override: var(--spectrum-background-layer-1-color, #f8f8f8);\n --diffs-bg-separator-override: var(--spectrum-background-layer-1-color, #f8f8f8);\n --diffs-fg-number-override: var(--spectrum-gray-600, #717171);\n}\n\n.empty {\n padding: 24px;\n color: var(--spectrum-neutral-subdued-content-color-default, #505050);\n font-family: var(--spectrum-sans-font-family-stack, system-ui, sans-serif);\n font-size: var(--spectrum-font-size-75, 12px);\n}\n';
66470
66597
 
66471
66598
  // src/components/sheets.ts
66472
- var cache2 = /* @__PURE__ */ new WeakMap();
66599
+ var cache3 = /* @__PURE__ */ new WeakMap();
66473
66600
  function adoptStyles(root2, ...texts) {
66474
66601
  const document2 = root2.ownerDocument;
66475
- let sheets = cache2.get(document2);
66602
+ let sheets = cache3.get(document2);
66476
66603
  if (!sheets) {
66477
66604
  sheets = /* @__PURE__ */ new Map();
66478
- cache2.set(document2, sheets);
66605
+ cache3.set(document2, sheets);
66479
66606
  }
66480
66607
  const adopted = texts.map((text2) => {
66481
66608
  let sheet2 = sheets.get(text2);
@@ -68121,11 +68248,11 @@ var Splitview = class {
68121
68248
  else this.updateSash(sash, 3);
68122
68249
  }
68123
68250
  }
68124
- updateSash(sash, state3) {
68125
- toggleClass(sash.container, "dv-disabled", state3 === 2);
68126
- toggleClass(sash.container, "dv-enabled", state3 === 3);
68127
- toggleClass(sash.container, "dv-maximum", state3 === 0);
68128
- toggleClass(sash.container, "dv-minimum", state3 === 1);
68251
+ updateSash(sash, state2) {
68252
+ toggleClass(sash.container, "dv-disabled", state2 === 2);
68253
+ toggleClass(sash.container, "dv-enabled", state2 === 3);
68254
+ toggleClass(sash.container, "dv-maximum", state2 === 0);
68255
+ toggleClass(sash.container, "dv-minimum", state2 === 1);
68129
68256
  }
68130
68257
  createViewContainer() {
68131
68258
  const element2 = document.createElement("div");
@@ -70324,14 +70451,14 @@ var Droptarget = class Droptarget2 extends CompositeDisposable {
70324
70451
  onDrop: (e122) => {
70325
70452
  var _this$options$getOver7, _this$options6;
70326
70453
  e122.preventDefault();
70327
- const state3 = this._state;
70454
+ const state2 = this._state;
70328
70455
  const edge = this._edge;
70329
70456
  this.removeDropTarget();
70330
70457
  (_this$options$getOver7 = (_this$options6 = this.options).getOverrideTarget) === null || _this$options$getOver7 === void 0 || (_this$options$getOver7 = _this$options$getOver7.call(_this$options6)) === null || _this$options$getOver7 === void 0 || _this$options$getOver7.clear();
70331
- if (state3) {
70458
+ if (state2) {
70332
70459
  e122.stopPropagation();
70333
70460
  this._onDrop.fire({
70334
- position: state3,
70461
+ position: state2,
70335
70462
  nativeEvent: e122,
70336
70463
  edge
70337
70464
  });
@@ -70805,13 +70932,13 @@ var PointerDropTarget = class extends CompositeDisposable {
70805
70932
  }
70806
70933
  _onDropEvent(event2) {
70807
70934
  var _this$options$getOver5, _this$options4;
70808
- const state3 = this._state;
70935
+ const state2 = this._state;
70809
70936
  const edge = this._edge;
70810
70937
  const overrideTarget = (_this$options$getOver5 = (_this$options4 = this.options).getOverrideTarget) === null || _this$options$getOver5 === void 0 ? void 0 : _this$options$getOver5.call(_this$options4);
70811
70938
  this._removeOverlay();
70812
70939
  overrideTarget === null || overrideTarget === void 0 || overrideTarget.clear();
70813
- if (state3) this._onDrop.fire({
70814
- position: state3,
70940
+ if (state2) this._onDrop.fire({
70941
+ position: state2,
70815
70942
  nativeEvent: event2.pointerEvent,
70816
70943
  edge
70817
70944
  });
@@ -76864,10 +76991,10 @@ var GridviewPanel = class extends BasePanelView {
76864
76991
  });
76865
76992
  }
76866
76993
  toJSON() {
76867
- const state3 = super.toJSON();
76994
+ const state2 = super.toJSON();
76868
76995
  const maximum = (value) => value === Number.MAX_SAFE_INTEGER ? void 0 : value;
76869
76996
  const minimum = (value) => value <= 0 ? void 0 : value;
76870
- return _objectSpread2(_objectSpread2({}, state3), {}, {
76997
+ return _objectSpread2(_objectSpread2({}, state2), {}, {
76871
76998
  minimumHeight: minimum(this.minimumHeight),
76872
76999
  maximumHeight: maximum(this.maximumHeight),
76873
77000
  minimumWidth: minimum(this.minimumWidth),
@@ -77359,17 +77486,17 @@ var DockviewPanel = class extends CompositeDisposable {
77359
77486
  for (const key2 of Object.keys(event2.params)) if (event2.params[key2] === void 0) delete this._params[key2];
77360
77487
  this.view.update({ params: this._params });
77361
77488
  }
77362
- updateFromStateModel(state3) {
77489
+ updateFromStateModel(state2) {
77363
77490
  var _state$params, _state$title, _state$renderer, _state$pinned, _this$accessor$option;
77364
- this._maximumHeight = state3.maximumHeight;
77365
- this._minimumHeight = state3.minimumHeight;
77366
- this._maximumWidth = state3.maximumWidth;
77367
- this._minimumWidth = state3.minimumWidth;
77368
- this._params = (_state$params = state3.params) !== null && _state$params !== void 0 ? _state$params : {};
77491
+ this._maximumHeight = state2.maximumHeight;
77492
+ this._minimumHeight = state2.minimumHeight;
77493
+ this._maximumWidth = state2.maximumWidth;
77494
+ this._minimumWidth = state2.minimumWidth;
77495
+ this._params = (_state$params = state2.params) !== null && _state$params !== void 0 ? _state$params : {};
77369
77496
  this.view.update({ params: this._params });
77370
- this.setTitle((_state$title = state3.title) !== null && _state$title !== void 0 ? _state$title : this.id);
77371
- this.setRenderer((_state$renderer = state3.renderer) !== null && _state$renderer !== void 0 ? _state$renderer : this.accessor.renderer);
77372
- this.setPinned(((_state$pinned = state3.pinned) !== null && _state$pinned !== void 0 ? _state$pinned : false) && !!((_this$accessor$option = this.accessor.options.pinnedTabs) === null || _this$accessor$option === void 0 ? void 0 : _this$accessor$option.enabled));
77497
+ this.setTitle((_state$title = state2.title) !== null && _state$title !== void 0 ? _state$title : this.id);
77498
+ this.setRenderer((_state$renderer = state2.renderer) !== null && _state$renderer !== void 0 ? _state$renderer : this.accessor.renderer);
77499
+ this.setPinned(((_state$pinned = state2.pinned) !== null && _state$pinned !== void 0 ? _state$pinned : false) && !!((_this$accessor$option = this.accessor.options.pinnedTabs) === null || _this$accessor$option === void 0 ? void 0 : _this$accessor$option.enabled));
77373
77500
  }
77374
77501
  updateParentGroup(group, options) {
77375
77502
  this._group = group;
@@ -78647,36 +78774,36 @@ var HeaderActionsService = class {
78647
78774
  }
78648
78775
  refresh(group) {
78649
78776
  if (!(group === null || group === void 0 ? void 0 : group.model)) return;
78650
- const state3 = this._ensureState(group);
78651
- this._refreshSlot("left", group, state3.left);
78652
- this._refreshSlot("right", group, state3.right);
78653
- this._refreshSlot("prefix", group, state3.prefix);
78777
+ const state2 = this._ensureState(group);
78778
+ this._refreshSlot("left", group, state2.left);
78779
+ this._refreshSlot("right", group, state2.right);
78780
+ this._refreshSlot("prefix", group, state2.prefix);
78654
78781
  }
78655
78782
  refreshAll() {
78656
78783
  for (const group of this._host.groups) this.refresh(group);
78657
78784
  }
78658
78785
  disposeGroup(group) {
78659
- const state3 = this._perGroup.get(group);
78660
- if (!state3) return;
78661
- state3.left.dispose();
78662
- state3.right.dispose();
78663
- state3.prefix.dispose();
78786
+ const state2 = this._perGroup.get(group);
78787
+ if (!state2) return;
78788
+ state2.left.dispose();
78789
+ state2.right.dispose();
78790
+ state2.prefix.dispose();
78664
78791
  this._perGroup.delete(group);
78665
78792
  }
78666
78793
  dispose() {
78667
78794
  for (const group of [...this._perGroup.keys()]) this.disposeGroup(group);
78668
78795
  }
78669
78796
  _ensureState(group) {
78670
- let state3 = this._perGroup.get(group);
78671
- if (!state3) {
78672
- state3 = {
78797
+ let state2 = this._perGroup.get(group);
78798
+ if (!state2) {
78799
+ state2 = {
78673
78800
  left: new MutableDisposable(),
78674
78801
  right: new MutableDisposable(),
78675
78802
  prefix: new MutableDisposable()
78676
78803
  };
78677
- this._perGroup.set(group, state3);
78804
+ this._perGroup.set(group, state2);
78678
78805
  }
78679
- return state3;
78806
+ return state2;
78680
78807
  }
78681
78808
  _refreshSlot(slot, group, disposable) {
78682
78809
  const factory = this._host.options[SLOT_OPTION_KEY[slot]];
@@ -80375,16 +80502,16 @@ var ShellManager = class {
80375
80502
  "bottom"
80376
80503
  ]) {
80377
80504
  var _state$collapsed;
80378
- const state3 = data[position];
80505
+ const state2 = data[position];
80379
80506
  const view = this._getView(position);
80380
- if (!state3 || !view) continue;
80381
- view.restoreExpandedSize(state3.size);
80382
- view.setCollapsed((_state$collapsed = state3.collapsed) !== null && _state$collapsed !== void 0 ? _state$collapsed : false);
80383
- if (state3.collapsed) {
80507
+ if (!state2 || !view) continue;
80508
+ view.restoreExpandedSize(state2.size);
80509
+ view.setCollapsed((_state$collapsed = state2.collapsed) !== null && _state$collapsed !== void 0 ? _state$collapsed : false);
80510
+ if (state2.collapsed) {
80384
80511
  this._pendingSizes.delete(position);
80385
80512
  this._resizeView(position, view.collapsedSize);
80386
- } else this.resizeEdgeGroup(position, state3.size);
80387
- this.setEdgeGroupVisible(position, !!state3.visible);
80513
+ } else this.resizeEdgeGroup(position, state2.size);
80514
+ this.setEdgeGroupVisible(position, !!state2.visible);
80388
80515
  }
80389
80516
  }
80390
80517
  dispose() {