@lvce-editor/renderer-process 30.82.3 → 30.83.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.
@@ -1474,15 +1474,15 @@ const commandMapRef = {};
1474
1474
 
1475
1475
  const workers$1 = new Map();
1476
1476
  const metadataById = new Map();
1477
- const state$p = {
1477
+ const state$q = {
1478
1478
  generation: 0,
1479
1479
  nextId: 0
1480
1480
  };
1481
- const getGeneration = () => state$p.generation;
1481
+ const getGeneration = () => state$q.generation;
1482
1482
  const createRuntimeName = (name, parentName) => {
1483
- state$p.nextId++;
1484
- const id = `worker-${state$p.nextId}`;
1485
- const runtimeId = `worker-${String(state$p.nextId).padStart(2, '0')}`;
1483
+ state$q.nextId++;
1484
+ const id = `worker-${state$q.nextId}`;
1485
+ const runtimeId = `worker-${String(state$q.nextId).padStart(2, '0')}`;
1486
1486
  let parent;
1487
1487
  if (parentName) {
1488
1488
  parent = metadataById.values().find(worker => worker.name === parentName);
@@ -1500,8 +1500,8 @@ const createRuntimeName = (name, parentName) => {
1500
1500
  metadataById.set(id, metadata);
1501
1501
  return metadata;
1502
1502
  };
1503
- const track = (worker, startedIn = state$p.generation, trackedWorker) => {
1504
- if (startedIn !== state$p.generation) {
1503
+ const track = (worker, startedIn = state$q.generation, trackedWorker) => {
1504
+ if (startedIn !== state$q.generation) {
1505
1505
  worker.terminate();
1506
1506
  throw new Error('Worker launch canceled by application restart');
1507
1507
  }
@@ -1535,7 +1535,7 @@ const terminate$1 = id => {
1535
1535
  };
1536
1536
  const getWorkers$1 = () => workers$1.values().toArray();
1537
1537
  const terminateAll = () => {
1538
- state$p.generation++;
1538
+ state$q.generation++;
1539
1539
  const retiring = workers$1.keys().toArray();
1540
1540
  workers$1.clear();
1541
1541
  metadataById.clear();
@@ -1672,7 +1672,7 @@ const launchRendererWorker = async () => {
1672
1672
  };
1673
1673
 
1674
1674
  const selector$1 = 'script.RendererWorkerTrace';
1675
- const state$o = {
1675
+ const state$p = {
1676
1676
  enabled: false,
1677
1677
  entries: []
1678
1678
  };
@@ -1722,14 +1722,14 @@ const isCommand = value => {
1722
1722
  };
1723
1723
  const initialize$1 = search => {
1724
1724
  const searchParams = new URLSearchParams(search);
1725
- state$o.enabled = searchParams.has('traceRendererWorker');
1726
- state$o.entries = [];
1725
+ state$p.enabled = searchParams.has('traceRendererWorker');
1726
+ state$p.entries = [];
1727
1727
  };
1728
1728
  const record = (direction, method, params) => {
1729
- if (!state$o.enabled) {
1729
+ if (!state$p.enabled) {
1730
1730
  return;
1731
1731
  }
1732
- state$o.entries.push({
1732
+ state$p.entries.push({
1733
1733
  direction,
1734
1734
  method,
1735
1735
  params: serialize(params),
@@ -1737,7 +1737,7 @@ const record = (direction, method, params) => {
1737
1737
  });
1738
1738
  };
1739
1739
  const listen$1 = rpc => {
1740
- if (!state$o.enabled) {
1740
+ if (!state$p.enabled) {
1741
1741
  return;
1742
1742
  }
1743
1743
  const ipc = rpc.ipc;
@@ -1752,7 +1752,7 @@ const listen$1 = rpc => {
1752
1752
  });
1753
1753
  };
1754
1754
  const exportToDom = () => {
1755
- if (!state$o.enabled) {
1755
+ if (!state$p.enabled) {
1756
1756
  return;
1757
1757
  }
1758
1758
  const existing = document.querySelector(selector$1);
@@ -1760,7 +1760,7 @@ const exportToDom = () => {
1760
1760
  script.className = 'RendererWorkerTrace';
1761
1761
  script.type = 'application/json';
1762
1762
  script.textContent = JSON.stringify({
1763
- entries: state$o.entries,
1763
+ entries: state$p.entries,
1764
1764
  version: 1
1765
1765
  });
1766
1766
  if (!existing) {
@@ -1768,49 +1768,49 @@ const exportToDom = () => {
1768
1768
  }
1769
1769
  };
1770
1770
  const scheduleExport = () => {
1771
- if (!state$o.enabled) {
1771
+ if (!state$p.enabled) {
1772
1772
  return;
1773
1773
  }
1774
1774
  queueMicrotask(exportToDom);
1775
1775
  };
1776
1776
 
1777
- const state$n = {
1777
+ const state$o = {
1778
1778
  rpc: undefined
1779
1779
  };
1780
1780
  const hydrate$4 = async () => {
1781
1781
  const result = await launchRendererWorker();
1782
1782
  if (isError(result)) {
1783
- state$n.rpc = undefined;
1783
+ state$o.rpc = undefined;
1784
1784
  return result;
1785
1785
  }
1786
- state$n.rpc = result.value;
1786
+ state$o.rpc = result.value;
1787
1787
  listen$1(result.value);
1788
1788
  return success(undefined);
1789
1789
  };
1790
1790
 
1791
1791
  // TODO needed?
1792
1792
  const dispose$q = async () => {
1793
- const rpc = state$n.rpc;
1794
- state$n.rpc = undefined;
1793
+ const rpc = state$o.rpc;
1794
+ state$o.rpc = undefined;
1795
1795
  await rpc?.dispose();
1796
1796
  };
1797
1797
  const send$1 = (method, ...params) => {
1798
1798
  record('sent', method, params);
1799
1799
  // @ts-ignore
1800
- state$n.rpc.send(method, ...params);
1800
+ state$o.rpc.send(method, ...params);
1801
1801
  };
1802
1802
  const invoke$1 = (method, ...params) => {
1803
1803
  record('sent', method, params);
1804
1804
  // @ts-ignore
1805
- return state$n.rpc.invoke(method, ...params);
1805
+ return state$o.rpc.invoke(method, ...params);
1806
1806
  };
1807
1807
  const invokeAndTransfer = (method, ...params) => {
1808
1808
  record('sent', method, params);
1809
1809
  // @ts-ignore
1810
- return state$n.rpc.invokeAndTransfer(method, ...params);
1810
+ return state$o.rpc.invokeAndTransfer(method, ...params);
1811
1811
  };
1812
1812
 
1813
- const state$m = {
1813
+ const state$n = {
1814
1814
  client: undefined,
1815
1815
  enabled: false,
1816
1816
  lastError: '',
@@ -1820,38 +1820,38 @@ const state$m = {
1820
1820
  const workerUrl = new URL('sessionReplayWorkerMain.js', import.meta.url);
1821
1821
  const reloadMessage = 'Reload the window to start session replay with the complete DOM command history';
1822
1822
  const report = error => {
1823
- state$m.lastError = error instanceof Error ? error.message : String(error);
1824
- state$m.stopObserving?.();
1825
- state$m.stopObserving = undefined;
1826
- console.warn(`Session replay: ${state$m.lastError}`);
1823
+ state$n.lastError = error instanceof Error ? error.message : String(error);
1824
+ state$n.stopObserving?.();
1825
+ state$n.stopObserving = undefined;
1826
+ console.warn(`Session replay: ${state$n.lastError}`);
1827
1827
  };
1828
1828
 
1829
1829
  // Retain snapshot recording for older renderer workers during dependency rollout.
1830
1830
  const configure$1 = async options => {
1831
- state$m.stopObserving?.();
1832
- state$m.stopObserving = undefined;
1833
- state$m.enabled = false;
1834
- if (state$m.client) {
1831
+ state$n.stopObserving?.();
1832
+ state$n.stopObserving = undefined;
1833
+ state$n.enabled = false;
1834
+ if (state$n.client) {
1835
1835
  try {
1836
- await state$m.client.invoke('stop');
1836
+ await state$n.client.invoke('stop');
1837
1837
  } catch (error) {
1838
1838
  report(error);
1839
1839
  }
1840
1840
  // Live channels still need their proxy after capture stops.
1841
- if (!state$m.proxy) {
1842
- state$m.client.dispose();
1843
- state$m.client = undefined;
1841
+ if (!state$n.proxy) {
1842
+ state$n.client.dispose();
1843
+ state$n.client = undefined;
1844
1844
  }
1845
1845
  }
1846
1846
  if (!options.local && !options.upload) return '';
1847
- if (state$m.proxy) throw new Error(reloadMessage);
1848
- state$m.lastError = '';
1847
+ if (state$n.proxy) throw new Error(reloadMessage);
1848
+ state$n.lastError = '';
1849
1849
  const client = createClient(workerUrl);
1850
1850
  try {
1851
1851
  const id = await client.invoke('start', options);
1852
- state$m.stopObserving = observe(document, (type, data) => client.invoke('record', type, data), report);
1853
- state$m.client = client;
1854
- state$m.enabled = true;
1852
+ state$n.stopObserving = observe(document, (type, data) => client.invoke('record', type, data), report);
1853
+ state$n.client = client;
1854
+ state$n.enabled = true;
1855
1855
  return id;
1856
1856
  } catch (error) {
1857
1857
  client.dispose();
@@ -1859,7 +1859,7 @@ const configure$1 = async options => {
1859
1859
  }
1860
1860
  };
1861
1861
  const configureProxy = async (options, port) => {
1862
- if (state$m.client || !options.local && !options.upload) {
1862
+ if (state$n.client || !options.local && !options.upload) {
1863
1863
  port.close();
1864
1864
  throw new Error(reloadMessage);
1865
1865
  }
@@ -1872,25 +1872,25 @@ const configureProxy = async (options, port) => {
1872
1872
  commandMap: commandMapRef,
1873
1873
  messagePort: proxyPort
1874
1874
  });
1875
- const original = state$n.rpc;
1876
- state$n.rpc = {
1875
+ const original = state$o.rpc;
1876
+ state$o.rpc = {
1877
1877
  ...rpc,
1878
1878
  async dispose() {
1879
1879
  try {
1880
1880
  await rpc.dispose();
1881
1881
  } finally {
1882
1882
  client.dispose();
1883
- state$m.client = undefined;
1884
- state$m.enabled = false;
1885
- state$m.proxy = false;
1883
+ state$n.client = undefined;
1884
+ state$n.enabled = false;
1885
+ state$n.proxy = false;
1886
1886
  await original?.dispose();
1887
1887
  }
1888
1888
  }
1889
1889
  };
1890
- state$m.client = client;
1891
- state$m.enabled = true;
1892
- state$m.proxy = true;
1893
- state$m.lastError = '';
1890
+ state$n.client = client;
1891
+ state$n.enabled = true;
1892
+ state$n.proxy = true;
1893
+ state$n.lastError = '';
1894
1894
  return id;
1895
1895
  } catch (error) {
1896
1896
  proxyPort?.close();
@@ -1900,21 +1900,21 @@ const configureProxy = async (options, port) => {
1900
1900
  }
1901
1901
  };
1902
1902
  const getSession = async () => {
1903
- if (!state$m.enabled || !state$m.client) throw new Error('Session replay is disabled in settings');
1904
- return state$m.client.invoke('export');
1903
+ if (!state$n.enabled || !state$n.client) throw new Error('Session replay is disabled in settings');
1904
+ return state$n.client.invoke('export');
1905
1905
  };
1906
1906
  const getStatus$1 = async () => {
1907
- if (!state$m.client) return {
1907
+ if (!state$n.client) return {
1908
1908
  enabled: false,
1909
- error: state$m.lastError
1909
+ error: state$n.lastError
1910
1910
  };
1911
1911
  return {
1912
- enabled: state$m.enabled,
1913
- ...(await state$m.client.invoke('status')),
1914
- captureError: state$m.lastError
1912
+ enabled: state$n.enabled,
1913
+ ...(await state$n.client.invoke('status')),
1914
+ captureError: state$n.lastError
1915
1915
  };
1916
1916
  };
1917
- const flush = async () => state$m.client?.invoke('flush');
1917
+ const flush = async () => state$n.client?.invoke('flush');
1918
1918
  const openLocalFile = async () => {
1919
1919
  const input = document.createElement('input');
1920
1920
  input.type = 'file';
@@ -1972,12 +1972,12 @@ const initializeLayout = async href => {
1972
1972
  return true;
1973
1973
  };
1974
1974
  const dispose$p = async () => {
1975
- state$m.stopObserving?.();
1976
- state$m.stopObserving = undefined;
1977
- const client = state$m.client;
1978
- state$m.client = undefined;
1979
- state$m.enabled = false;
1980
- state$m.proxy = false;
1975
+ state$n.stopObserving?.();
1976
+ state$n.stopObserving = undefined;
1977
+ const client = state$n.client;
1978
+ state$n.client = undefined;
1979
+ state$n.enabled = false;
1980
+ state$n.proxy = false;
1981
1981
  if (client) {
1982
1982
  try {
1983
1983
  await client.invoke('flush');
@@ -1989,8 +1989,14 @@ const dispose$p = async () => {
1989
1989
 
1990
1990
  const initialize = () => {
1991
1991
  try {
1992
- const savedLayout = JSON.parse(localStorage.getItem('Layout') || 'null');
1993
- if (savedLayout?.aiNativeLayout !== true) return;
1992
+ const isChatRoute = /(?:^|\/)chat\/?$/.test(location.pathname);
1993
+ let savedLayout;
1994
+ try {
1995
+ savedLayout = JSON.parse(localStorage.getItem('Layout') || 'null');
1996
+ } catch {
1997
+ savedLayout = null;
1998
+ }
1999
+ if (savedLayout?.aiNativeLayout !== true && !isChatRoute) return;
1994
2000
  let settings;
1995
2001
  try {
1996
2002
  settings = JSON.parse(localStorage.getItem('settings') || 'null');
@@ -2037,7 +2043,7 @@ const register$2 = (uid, listeners, speed = 1) => {
2037
2043
  speed: normalize(speed)
2038
2044
  });
2039
2045
  };
2040
- const set$d = (uid, speed) => {
2046
+ const set$e = (uid, speed) => {
2041
2047
  const view = views.get(uid);
2042
2048
  if (view) view.speed = normalize(speed);
2043
2049
  };
@@ -2089,10 +2095,10 @@ const measurePrefix = (text, offset, fontWeight, fontSize, fontFamily, letterSpa
2089
2095
  };
2090
2096
 
2091
2097
  const pendingInputs = new Set();
2092
- const state$l = {
2098
+ const state$m = {
2093
2099
  shortcut: undefined
2094
2100
  };
2095
- const hasPending = () => Boolean(state$l.shortcut || pendingInputs.size > 0);
2101
+ const hasPending = () => Boolean(state$m.shortcut || pendingInputs.size > 0);
2096
2102
  const settle = async result => {
2097
2103
  try {
2098
2104
  await result;
@@ -2110,7 +2116,7 @@ const runAfterShortcut = async (previous, run) => {
2110
2116
  };
2111
2117
  const runInput = run => {
2112
2118
  // Inputs in the same burst run concurrently so the worker can coalesce renders.
2113
- const result = runAfterShortcut(state$l.shortcut, run);
2119
+ const result = runAfterShortcut(state$m.shortcut, run);
2114
2120
  const settled = settle(result);
2115
2121
  pendingInputs.add(settled);
2116
2122
  void removeInput(settled);
@@ -2122,15 +2128,15 @@ const runAfterInputs = async (earlier, run) => {
2122
2128
  };
2123
2129
  const clearShortcut = async settled => {
2124
2130
  await settled;
2125
- if (state$l.shortcut === settled) state$l.shortcut = undefined;
2131
+ if (state$m.shortcut === settled) state$m.shortcut = undefined;
2126
2132
  };
2127
2133
  const runShortcut = run => {
2128
2134
  // Snapshot only earlier input; later input waits for this shortcut instead.
2129
2135
  const earlier = [...pendingInputs];
2130
- if (state$l.shortcut) earlier.push(state$l.shortcut);
2136
+ if (state$m.shortcut) earlier.push(state$m.shortcut);
2131
2137
  const result = runAfterInputs(earlier, run);
2132
2138
  const settled = settle(result);
2133
- state$l.shortcut = settled;
2139
+ state$m.shortcut = settled;
2134
2140
  void clearShortcut(settled);
2135
2141
  return result;
2136
2142
  };
@@ -2637,7 +2643,7 @@ const createIdGenerator = () => {
2637
2643
  };
2638
2644
  const create$z = createIdGenerator();
2639
2645
 
2640
- const state$k = Object.create(null);
2646
+ const state$l = Object.create(null);
2641
2647
  const retainString = (item, index) => {
2642
2648
  const value = new Promise(resolve => {
2643
2649
  item.getAsString(resolve);
@@ -2688,25 +2694,25 @@ const retainItems = dataTransfer => {
2688
2694
  };
2689
2695
  const addItems = items => {
2690
2696
  const id = create$z();
2691
- state$k[id] = items;
2697
+ state$l[id] = items;
2692
2698
  return id;
2693
2699
  };
2694
2700
  const add$2 = dataTransfer => {
2695
2701
  return addItems(retainItems(dataTransfer));
2696
2702
  };
2697
2703
  const acquire$2 = id => {
2698
- const items = state$k[id];
2704
+ const items = state$l[id];
2699
2705
  if (!items) {
2700
2706
  throw new Error(`Drop data not found: ${id}`);
2701
2707
  }
2702
- delete state$k[id];
2708
+ delete state$l[id];
2703
2709
  return items;
2704
2710
  };
2705
2711
 
2706
- const state$j = Object.create(null);
2712
+ const state$k = Object.create(null);
2707
2713
  const acquire$1 = id => {
2708
- const promise = state$j[id];
2709
- delete state$j[id];
2714
+ const promise = state$k[id];
2715
+ delete state$k[id];
2710
2716
  return promise;
2711
2717
  };
2712
2718
  const getFileHandles = async ids => {
@@ -2716,7 +2722,7 @@ const getFileHandles = async ids => {
2716
2722
  };
2717
2723
  const add$1 = promise => {
2718
2724
  const id = create$z();
2719
- state$j[id] = promise;
2725
+ state$k[id] = promise;
2720
2726
  return id;
2721
2727
  };
2722
2728
  const addFileHandle$1 = fileHandle => {
@@ -2917,14 +2923,14 @@ const getEventListenerArgs = (params, event) => {
2917
2923
  return serialized;
2918
2924
  };
2919
2925
 
2920
- const state$i = {
2926
+ const state$j = {
2921
2927
  ipc: undefined
2922
2928
  };
2923
2929
  const getIpc = () => {
2924
- return state$i.ipc;
2930
+ return state$j.ipc;
2925
2931
  };
2926
2932
  const setIpc = value => {
2927
- state$i.ipc = value;
2933
+ state$j.ipc = value;
2928
2934
  };
2929
2935
 
2930
2936
  const nameAnonymousFunction$1 = (fn, name) => {
@@ -3654,7 +3660,7 @@ const instances = Object.create(null);
3654
3660
  const get$b = viewletId => {
3655
3661
  return instances[viewletId];
3656
3662
  };
3657
- const set$c = (viewletId, instance) => {
3663
+ const set$d = (viewletId, instance) => {
3658
3664
  instances[viewletId] = instance;
3659
3665
  };
3660
3666
 
@@ -3683,7 +3689,7 @@ const cache = new Map();
3683
3689
  const has$1 = listener => {
3684
3690
  return cache.has(listener);
3685
3691
  };
3686
- const set$b = (listener, value) => {
3692
+ const set$c = (listener, value) => {
3687
3693
  cache.set(listener, value);
3688
3694
  };
3689
3695
  const get$a = listener => {
@@ -3706,7 +3712,7 @@ const getWrappedListener = (listener, returnValue) => {
3706
3712
  ipc.send('Viewlet.executeViewletCommand', uid, ...result);
3707
3713
  };
3708
3714
  nameAnonymousFunction$1(wrapped, listener.name);
3709
- set$b(listener, wrapped);
3715
+ set$c(listener, wrapped);
3710
3716
  }
3711
3717
  return get$a(listener);
3712
3718
  };
@@ -4661,38 +4667,38 @@ const launchDragAndDropWorker = async () => {
4661
4667
  }
4662
4668
  };
4663
4669
 
4664
- const state$h = {
4670
+ const state$i = {
4665
4671
  rpc: undefined
4666
4672
  };
4667
4673
  const hydrate$3 = async () => {
4668
4674
  const result = await launchDragAndDropWorker();
4669
4675
  if (isError(result)) {
4670
- state$h.rpc = undefined;
4676
+ state$i.rpc = undefined;
4671
4677
  return result;
4672
4678
  }
4673
- state$h.rpc = result.value;
4679
+ state$i.rpc = result.value;
4674
4680
  return success(undefined);
4675
4681
  };
4676
4682
  const handleMessagePort$1 = async port => {
4677
- if (!state$h.rpc) {
4683
+ if (!state$i.rpc) {
4678
4684
  const result = await hydrate$3();
4679
4685
  if (isError(result)) {
4680
4686
  throw result.error;
4681
4687
  }
4682
4688
  }
4683
- const rpc = state$h.rpc;
4689
+ const rpc = state$i.rpc;
4684
4690
  if (!rpc) {
4685
4691
  throw new Error('Drag And Drop Worker failed to initialize');
4686
4692
  }
4687
4693
  await rpc.invokeAndTransfer('DragAndDrop.handleMessagePort', port);
4688
4694
  };
4689
4695
  const dispose$n = async () => {
4690
- const rpc = state$h.rpc;
4691
- state$h.rpc = undefined;
4696
+ const rpc = state$i.rpc;
4697
+ state$i.rpc = undefined;
4692
4698
  await rpc?.dispose();
4693
4699
  };
4694
4700
 
4695
- const set$a = setComponentUid;
4701
+ const set$b = setComponentUid;
4696
4702
  const get$9 = getComponentUid;
4697
4703
  const fromEvent = getComponentUidFromEvent;
4698
4704
 
@@ -4747,16 +4753,16 @@ const unregisterView = uid => {
4747
4753
  viewRpcIds.delete(uid);
4748
4754
  };
4749
4755
 
4750
- const state$g = {
4756
+ const state$h = {
4751
4757
  snapshot: undefined
4752
4758
  };
4753
- const get$7 = () => state$g.snapshot;
4754
- const set$9 = value => {
4755
- state$g.snapshot = value;
4759
+ const get$7 = () => state$h.snapshot;
4760
+ const set$a = value => {
4761
+ state$h.snapshot = value;
4756
4762
  };
4757
4763
 
4758
4764
  const ipcs = Object.create(null);
4759
- const set$8 = (name, ipc) => {
4765
+ const set$9 = (name, ipc) => {
4760
4766
  ipcs[name] = ipc;
4761
4767
  };
4762
4768
  const get$6 = name => {
@@ -5051,7 +5057,7 @@ const IpcParentWithReferencePort = {
5051
5057
  };
5052
5058
 
5053
5059
  const workers = Object.create(null);
5054
- const set$7 = (id, worker) => {
5060
+ const set$8 = (id, worker) => {
5055
5061
  workers[id] = worker;
5056
5062
  };
5057
5063
  const remove$3 = id => {
@@ -5103,7 +5109,7 @@ const create$v = async ({
5103
5109
  discard(trackedWorker);
5104
5110
  }
5105
5111
  if (typeof id === 'number' && raw && worker) {
5106
- set$7(id, worker);
5112
+ set$8(id, worker);
5107
5113
  }
5108
5114
  return undefined;
5109
5115
  };
@@ -5204,7 +5210,7 @@ const hydrate$2 = async () => {
5204
5210
  } = new MessageChannel();
5205
5211
  // TODO only launch port and send to renderer worker
5206
5212
  const promise = launchEditorWorker(port1);
5207
- set$8('Editor Worker', port2);
5213
+ set$9('Editor Worker', port2);
5208
5214
  const result = await promise;
5209
5215
  if (isError(result)) {
5210
5216
  remove$4('Editor Worker');
@@ -5229,7 +5235,7 @@ const preloadWorker = async (name, packageName, fileName, settingName) => {
5229
5235
  url
5230
5236
  });
5231
5237
  // Start creation before caching, so our own request cannot consume this port.
5232
- set$8(name, port2);
5238
+ set$9(name, port2);
5233
5239
  await pending;
5234
5240
  return success(undefined);
5235
5241
  } catch (error) {
@@ -5273,7 +5279,7 @@ const hydrate$1 = async () => {
5273
5279
  } = new MessageChannel();
5274
5280
  // TODO only launch port and send to renderer worker
5275
5281
  const promise = launchSyntaxHighlightingWorker(port1);
5276
- set$8('Syntax Highlighting Worker', port2);
5282
+ set$9('Syntax Highlighting Worker', port2);
5277
5283
  const result = await promise;
5278
5284
  if (isError(result)) {
5279
5285
  remove$4('Syntax Highlighting Worker');
@@ -5306,32 +5312,32 @@ const launchWorkers = async () => {
5306
5312
  return success(undefined);
5307
5313
  };
5308
5314
 
5309
- const state$f = {
5315
+ const state$g = {
5310
5316
  renderer: undefined
5311
5317
  };
5312
5318
  const configure = options => {
5313
5319
  const cache = options?.cache;
5314
- state$f.renderer = cache?.dom > 0 || cache?.text > 0 ? createRenderer(options) : undefined;
5320
+ state$g.renderer = cache?.dom > 0 || cache?.text > 0 ? createRenderer(options) : undefined;
5315
5321
  };
5316
5322
  const render = (nodes, eventMap = {}, newEventMap = {}) => {
5317
- return state$f.renderer?.render(nodes, eventMap, newEventMap) || render$1(nodes, eventMap, newEventMap);
5323
+ return state$g.renderer?.render(nodes, eventMap, newEventMap) || render$1(nodes, eventMap, newEventMap);
5318
5324
  };
5319
5325
  const renderInto = (parent, nodes, eventMap = {}, newEventMap = {}) => {
5320
- if (state$f.renderer) {
5321
- state$f.renderer.renderInto(parent, nodes, eventMap, newEventMap);
5326
+ if (state$g.renderer) {
5327
+ state$g.renderer.renderInto(parent, nodes, eventMap, newEventMap);
5322
5328
  return;
5323
5329
  }
5324
5330
  renderInto$1(parent, nodes, eventMap);
5325
5331
  };
5326
5332
  const applyPatch$1 = (element, patches, eventMap = {}, id = 0) => {
5327
- if (state$f.renderer) {
5328
- state$f.renderer.applyPatch(element, patches, eventMap, id);
5333
+ if (state$g.renderer) {
5334
+ state$g.renderer.applyPatch(element, patches, eventMap, id);
5329
5335
  return;
5330
5336
  }
5331
5337
  applyPatch$2(element, patches, eventMap, id);
5332
5338
  };
5333
5339
  const dispose$l = root => {
5334
- state$f.renderer?.dispose(root);
5340
+ state$g.renderer?.dispose(root);
5335
5341
  };
5336
5342
 
5337
5343
  const applyPatch = (element, patches, eventMap = {}, id = 0) => {
@@ -5345,24 +5351,24 @@ const attachEvents$7 = ($Node, eventMap) => {
5345
5351
  };
5346
5352
 
5347
5353
  const selector = 'textarea[name="composer"]';
5348
- const state$e = {
5354
+ const state$f = {
5349
5355
  handled: false
5350
5356
  };
5351
5357
  const hasFocus = () => !!document.activeElement && document.activeElement !== document.body && document.activeElement !== document.documentElement;
5352
5358
  const dispose$k = viewletId => {
5353
- const pending = state$e.pending;
5359
+ const pending = state$f.pending;
5354
5360
  if (pending && pending.id === viewletId) pending.cancel();
5355
5361
  };
5356
5362
 
5357
5363
  // The route's composer can arrive after the initial workbench frame.
5358
5364
  const focus$d = viewletId => {
5359
- if (state$e.handled || !/(?:^|\/)chat\/?$/.test(location.pathname)) {
5365
+ if (state$f.handled || !/(?:^|\/)chat\/?$/.test(location.pathname)) {
5360
5366
  return;
5361
5367
  }
5362
5368
  if (!get$b(viewletId)?.state.$Viewlet.querySelector(selector)) {
5363
5369
  return;
5364
5370
  }
5365
- state$e.handled = true;
5371
+ state$f.handled = true;
5366
5372
  if (hasFocus()) {
5367
5373
  return;
5368
5374
  }
@@ -5375,9 +5381,9 @@ const focus$d = viewletId => {
5375
5381
  document.removeEventListener('focusin', cancel, true);
5376
5382
  mutations?.disconnect();
5377
5383
  sizes?.disconnect();
5378
- state$e.pending = undefined;
5384
+ state$f.pending = undefined;
5379
5385
  };
5380
- state$e.pending = {
5386
+ state$f.pending = {
5381
5387
  cancel,
5382
5388
  id: viewletId
5383
5389
  };
@@ -5419,25 +5425,25 @@ const focus$d = viewletId => {
5419
5425
  requestAnimationFrame(() => requestAnimationFrame(tryFocus));
5420
5426
  };
5421
5427
 
5422
- const state$d = {
5428
+ const state$e = {
5423
5429
  styleSheets: Object.create(null),
5424
5430
  texts: Object.create(null)
5425
5431
  };
5426
- const set$6 = (id, sheet) => {
5427
- state$d.styleSheets[id] = sheet;
5432
+ const set$7 = (id, sheet) => {
5433
+ state$e.styleSheets[id] = sheet;
5428
5434
  };
5429
5435
  const get$5 = id => {
5430
- return state$d.styleSheets[id];
5436
+ return state$e.styleSheets[id];
5431
5437
  };
5432
5438
  const setText$1 = (id, text) => {
5433
- state$d.texts[id] = text;
5439
+ state$e.texts[id] = text;
5434
5440
  };
5435
5441
  const getText = id => {
5436
- return state$d.texts[id];
5442
+ return state$e.texts[id];
5437
5443
  };
5438
5444
  const remove$2 = id => {
5439
- delete state$d.styleSheets[id];
5440
- delete state$d.texts[id];
5445
+ delete state$e.styleSheets[id];
5446
+ delete state$e.texts[id];
5441
5447
  };
5442
5448
 
5443
5449
  const addCssStyleSheet = (id, text) => {
@@ -5455,7 +5461,7 @@ const addCssStyleSheet = (id, text) => {
5455
5461
  const sheet = new CSSStyleSheet({});
5456
5462
  sheet.replaceSync(text);
5457
5463
  document.adoptedStyleSheets.push(sheet);
5458
- set$6(id, sheet);
5464
+ set$7(id, sheet);
5459
5465
  setText$1(id, text);
5460
5466
  if (id === 'ContributedColorTheme') {
5461
5467
  window.dispatchEvent(new Event('color-theme-changed'));
@@ -5513,25 +5519,25 @@ const PointerUp = 'pointerup';
5513
5519
  const Resize = 'resize';
5514
5520
  const Wheel = 'wheel';
5515
5521
 
5516
- const state$c = {
5522
+ const state$d = {
5517
5523
  currentDragInfo: undefined
5518
5524
  };
5519
- const set$5 = (id, data) => {
5520
- state$c.currentDragInfo = data;
5525
+ const set$6 = (id, data) => {
5526
+ state$d.currentDragInfo = data;
5521
5527
  setDragInfo(id, data);
5522
5528
  };
5523
5529
  const getCurrent = () => {
5524
- return state$c.currentDragInfo;
5530
+ return state$d.currentDragInfo;
5525
5531
  };
5526
5532
 
5527
- const state$b = {
5533
+ const state$c = {
5528
5534
  identifiers: new Uint32Array()
5529
5535
  };
5530
5536
  const setIdentifiers$1 = identifiers => {
5531
- state$b.identifiers = identifiers;
5537
+ state$c.identifiers = identifiers;
5532
5538
  };
5533
5539
  const getIdentifiers = () => {
5534
- return state$b.identifiers;
5540
+ return state$c.identifiers;
5535
5541
  };
5536
5542
 
5537
5543
  // TODO store keybindings as JSON somewhere
@@ -5650,11 +5656,11 @@ const register = (uid, targetUid, listeners) => {
5650
5656
  };
5651
5657
 
5652
5658
  const pendingBatches = new Map();
5653
- const state$a = {
5659
+ const state$b = {
5654
5660
  nextTransactionId: 1
5655
5661
  };
5656
5662
  const queue = (uid, commands, focusVersion = 0) => {
5657
- const transactionId = state$a.nextTransactionId++;
5663
+ const transactionId = state$b.nextTransactionId++;
5658
5664
  pendingBatches.set(transactionId, {
5659
5665
  commands,
5660
5666
  committed: false,
@@ -5669,7 +5675,7 @@ const take = (uid, transactionId, focusVersion = 0) => {
5669
5675
  if (!batch) {
5670
5676
  // An allocated transaction may have been discarded with its view. Late or
5671
5677
  // duplicate commits are harmless and must not affect a recreated root.
5672
- if (transactionId > 0 && transactionId < state$a.nextTransactionId) return [];
5678
+ if (transactionId > 0 && transactionId < state$b.nextTransactionId) return [];
5673
5679
  throw new Error(`pending viewlet command transaction not found: ${transactionId}`);
5674
5680
  }
5675
5681
  if (batch.uid !== uid) {
@@ -5859,7 +5865,7 @@ class VError extends Error {
5859
5865
  }
5860
5866
 
5861
5867
  // TODO this file is not needed when all elements are position fixed
5862
- const state$9 = {
5868
+ const state$a = {
5863
5869
  $Widgets: undefined,
5864
5870
  widgetSet: new Set()
5865
5871
  };
@@ -5871,20 +5877,20 @@ const create$Widgets = () => {
5871
5877
  };
5872
5878
  const append$1 = $Element => {
5873
5879
  // TODO should not call append in the first place if it is already in DOM
5874
- if (state$9.widgetSet.has($Element)) {
5880
+ if (state$a.widgetSet.has($Element)) {
5875
5881
  return;
5876
5882
  }
5877
- state$9.widgetSet.add($Element);
5878
- if (state$9.$Widgets) {
5883
+ state$a.widgetSet.add($Element);
5884
+ if (state$a.$Widgets) {
5879
5885
  // @ts-expect-error
5880
- state$9.$Widgets.append($Element);
5886
+ state$a.$Widgets.append($Element);
5881
5887
  } else {
5882
5888
  // @ts-expect-error
5883
- state$9.$Widgets = create$Widgets();
5889
+ state$a.$Widgets = create$Widgets();
5884
5890
  // @ts-expect-error
5885
- state$9.$Widgets.append($Element);
5891
+ state$a.$Widgets.append($Element);
5886
5892
  // @ts-expect-error
5887
- document.body.append(state$9.$Widgets);
5893
+ document.body.append(state$a.$Widgets);
5888
5894
  }
5889
5895
  };
5890
5896
  const remove$1 = $Element => {
@@ -5892,13 +5898,13 @@ const remove$1 = $Element => {
5892
5898
  // TODO $Element should always be defined
5893
5899
  return;
5894
5900
  }
5895
- state$9.widgetSet.delete($Element);
5901
+ state$a.widgetSet.delete($Element);
5896
5902
  $Element.remove();
5897
5903
  // TODO state.$Widgets should always be defined at this point
5898
- if (state$9.widgetSet.size === 0 && state$9.$Widgets) {
5904
+ if (state$a.widgetSet.size === 0 && state$a.$Widgets) {
5899
5905
  // @ts-expect-error
5900
- state$9.$Widgets.remove();
5901
- state$9.$Widgets = undefined;
5906
+ state$a.$Widgets.remove();
5907
+ state$a.$Widgets = undefined;
5902
5908
  }
5903
5909
  };
5904
5910
 
@@ -6228,7 +6234,7 @@ const applyUidWorkaround = element => {
6228
6234
  throw new Error('no editor found');
6229
6235
  }
6230
6236
  const editorUid = get$9(editor);
6231
- set$a(element, editorUid);
6237
+ set$b(element, editorUid);
6232
6238
  };
6233
6239
 
6234
6240
  const startTracking$1 = ($Target, pointerId, handlePointerMove, handlePointerUp) => {
@@ -6747,7 +6753,7 @@ const sendToIframe = (contentWindow, message, origin, transfer) => {
6747
6753
  };
6748
6754
 
6749
6755
  const webViews = Object.create(null);
6750
- const set$4 = (id, webView) => {
6756
+ const set$5 = (id, webView) => {
6751
6757
  webViews[id] = webView;
6752
6758
  };
6753
6759
  const get$4 = id => {
@@ -8250,16 +8256,16 @@ const EditorTextError = 'EditorTextError';
8250
8256
  const EditorRename = 'EditorRename';
8251
8257
  const EditorCodeGenerator = 'EditorCodeGenerator';
8252
8258
 
8253
- const state$8 = {
8259
+ const state$9 = {
8254
8260
  /**
8255
8261
  * @type {HTMLElement|undefined}
8256
8262
  */
8257
8263
  $PreviousFocusElement: undefined};
8258
8264
  const setElement = $Element => {
8259
- state$8.$PreviousFocusElement = $Element;
8265
+ state$9.$PreviousFocusElement = $Element;
8260
8266
  };
8261
8267
  const getElement = () => {
8262
- return state$8.$PreviousFocusElement;
8268
+ return state$9.$PreviousFocusElement;
8263
8269
  };
8264
8270
 
8265
8271
  const focus$6 = $Element => {
@@ -8525,7 +8531,7 @@ const screenCaptures = Object.create(null);
8525
8531
  const get$3 = id => {
8526
8532
  return screenCaptures[id];
8527
8533
  };
8528
- const set$3 = (id, captureStream) => {
8534
+ const set$4 = (id, captureStream) => {
8529
8535
  screenCaptures[id] = captureStream;
8530
8536
  };
8531
8537
 
@@ -8538,7 +8544,7 @@ const start = async (id, options) => {
8538
8544
  number(id);
8539
8545
  object(options);
8540
8546
  const captureStream = await navigator.mediaDevices.getUserMedia(options);
8541
- set$3(id, captureStream);
8547
+ set$4(id, captureStream);
8542
8548
  } catch (error) {
8543
8549
  throw new VError(error, `Failed to start screen capture`);
8544
8550
  }
@@ -8667,11 +8673,11 @@ const ViewletSidebar = {
8667
8673
  };
8668
8674
 
8669
8675
  const pendingSelections = new WeakMap();
8670
- const state$7 = {};
8676
+ const state$8 = {};
8671
8677
  const handleFocus$1 = event => {
8672
8678
  const target = event.target;
8673
8679
  if (target instanceof HTMLElement && !target.closest('.SimpleBrowser') && target.closest('.Main, .Panel, .Editor, .Terminal')) {
8674
- state$7.codingFocus = new WeakRef(target);
8680
+ state$8.codingFocus = new WeakRef(target);
8675
8681
  }
8676
8682
  };
8677
8683
  const handleFocusOut$2 = event => {
@@ -8700,7 +8706,7 @@ const listen = () => {
8700
8706
  document.addEventListener('keydown', cancelPendingAddressSelection);
8701
8707
  };
8702
8708
  const restoreCodingFocus$1 = () => {
8703
- const target = state$7.codingFocus?.deref();
8709
+ const target = state$8.codingFocus?.deref();
8704
8710
  if (!target?.isConnected) {
8705
8711
  return false;
8706
8712
  }
@@ -9037,7 +9043,7 @@ const findIndex$1 = ($Container, $Target) => {
9037
9043
 
9038
9044
  // TODO keyboard handling
9039
9045
 
9040
- const state$6 = {
9046
+ const state$7 = {
9041
9047
  $$Menus: [],
9042
9048
  $BackDrop: undefined,
9043
9049
  anchorTime: -1,
@@ -9048,7 +9054,7 @@ const state$6 = {
9048
9054
  };
9049
9055
  const getLevel = $Menu => {
9050
9056
  // @ts-expect-error
9051
- return state$6.$$Menus.indexOf($Menu);
9057
+ return state$7.$$Menus.indexOf($Menu);
9052
9058
  };
9053
9059
  const handleMouseDown$1 = event => {
9054
9060
  const $Target = event.target;
@@ -9118,10 +9124,10 @@ const handleMouseLeave = event => {
9118
9124
 
9119
9125
  // const handleBlur = (event) => {}
9120
9126
  const handleKeyDown = event => {
9121
- state$6.handleKeyDown(event);
9127
+ state$7.handleKeyDown(event);
9122
9128
  };
9123
9129
  const handleFocusOut$1 = event => {
9124
- state$6.handleFocusOut(event);
9130
+ state$7.handleFocusOut(event);
9125
9131
  };
9126
9132
  const create$Menu$1 = () => {
9127
9133
  // TODO set aria label on menu (e.g. File, Edit, Selection)
@@ -9149,7 +9155,7 @@ const create$Menu$1 = () => {
9149
9155
  return $Menu;
9150
9156
  };
9151
9157
  const focusIndex = (level, oldFocusedIndex, newFocusedIndex) => {
9152
- const $Menu = state$6.$$Menus[level];
9158
+ const $Menu = state$7.$$Menus[level];
9153
9159
  if (oldFocusedIndex !== -1) {
9154
9160
  // @ts-expect-error
9155
9161
  $Menu.children[oldFocusedIndex].classList.remove('MenuItemFocused');
@@ -9171,21 +9177,21 @@ const handleBackDropMouseDown = event => {
9171
9177
  preventDefault(event);
9172
9178
  stopPropagation(event);
9173
9179
  send$1(/* Menu.hide */'Menu.hide');
9174
- if (state$6.$BackDrop) {
9175
- remove$1(state$6.$BackDrop);
9176
- state$6.$BackDrop = undefined;
9180
+ if (state$7.$BackDrop) {
9181
+ remove$1(state$7.$BackDrop);
9182
+ state$7.$BackDrop = undefined;
9177
9183
  }
9178
9184
  };
9179
9185
  const handleContextMenu$1 = event => {
9180
9186
  preventDefault(event);
9181
9187
  };
9182
9188
  const showMenu = async (x, y, width, height, items, level, parentIndex = -1, dom = [], mouseBlocking = false) => {
9183
- if (mouseBlocking && !state$6.$BackDrop) {
9189
+ if (mouseBlocking && !state$7.$BackDrop) {
9184
9190
  const $BackDrop = create$BackDrop();
9185
9191
  $BackDrop.onmousedown = handleBackDropMouseDown;
9186
9192
  $BackDrop.oncontextmenu = handleContextMenu$1;
9187
9193
  // @ts-expect-error
9188
- state$6.$BackDrop = $BackDrop;
9194
+ state$7.$BackDrop = $BackDrop;
9189
9195
  append$1($BackDrop);
9190
9196
  }
9191
9197
  const $Menu = create$Menu$1();
@@ -9193,7 +9199,7 @@ const showMenu = async (x, y, width, height, items, level, parentIndex = -1, dom
9193
9199
  setBounds$a($Menu, x, y, width, height);
9194
9200
  $Menu.id = `Menu-${level}`;
9195
9201
  if (parentIndex !== -1) {
9196
- const $ParentMenu = state$6.$$Menus[level - 1];
9202
+ const $ParentMenu = state$7.$$Menus[level - 1];
9197
9203
  // @ts-expect-error
9198
9204
  const $ParentMenuItem = $ParentMenu.children[parentIndex];
9199
9205
  $ParentMenuItem.ariaExpanded = True;
@@ -9201,7 +9207,7 @@ const showMenu = async (x, y, width, height, items, level, parentIndex = -1, dom
9201
9207
  }
9202
9208
 
9203
9209
  // @ts-expect-error
9204
- state$6.$$Menus.push($Menu);
9210
+ state$7.$$Menus.push($Menu);
9205
9211
  append$1($Menu);
9206
9212
  if (level === 0) {
9207
9213
  focus$6($Menu);
@@ -9209,14 +9215,14 @@ const showMenu = async (x, y, width, height, items, level, parentIndex = -1, dom
9209
9215
  }
9210
9216
  };
9211
9217
  const hideSubmenu = level => {
9212
- const $$ChildMenus = state$6.$$Menus.slice(level);
9218
+ const $$ChildMenus = state$7.$$Menus.slice(level);
9213
9219
  for (const $ChildMenu of $$ChildMenus) {
9214
9220
  remove$1($ChildMenu);
9215
9221
  }
9216
- state$6.$$Menus = state$6.$$Menus.slice(0, level);
9217
- if (state$6.$$Menus.length === 0 && state$6.$BackDrop) {
9218
- remove$1(state$6.$BackDrop);
9219
- state$6.$BackDrop = undefined;
9222
+ state$7.$$Menus = state$7.$$Menus.slice(0, level);
9223
+ if (state$7.$$Menus.length === 0 && state$7.$BackDrop) {
9224
+ remove$1(state$7.$BackDrop);
9225
+ state$7.$BackDrop = undefined;
9220
9226
  }
9221
9227
  };
9222
9228
 
@@ -9255,17 +9261,17 @@ const showControlled = ({
9255
9261
  y
9256
9262
  }) => {
9257
9263
  showMenu(x, y, width, height, items, level);
9258
- const $Menu = state$6.$$Menus.at(-1);
9264
+ const $Menu = state$7.$$Menus.at(-1);
9259
9265
  if ($Parent && $Menu) {
9260
9266
  const uid = get$9($Parent);
9261
- set$a($Menu, uid);
9267
+ set$b($Menu, uid);
9262
9268
  }
9263
9269
  // TODO menu should not necessarily know about parent (titleBarMenuBar)
9264
9270
  // it should be the other way around
9265
9271
  // @ts-expect-error
9266
- state$6.$Parent = $Parent;
9267
- state$6.handleFocusOut = handleFocusOut;
9268
- state$6.handleKeyDown = handleKeyDown;
9272
+ state$7.$Parent = $Parent;
9273
+ state$7.handleFocusOut = handleFocusOut;
9274
+ state$7.handleKeyDown = handleKeyDown;
9269
9275
  if ($Parent) {
9270
9276
  // state.$Menu.ariaLabel=''
9271
9277
  // state.$Menu.ariaLabelledBy =$Parent.id
@@ -9277,13 +9283,13 @@ const showControlled = ({
9277
9283
  // TODO have function to show submenu
9278
9284
 
9279
9285
  const hide = (restoreFocus = true) => {
9280
- for (const $Menu of state$6.$$Menus) {
9286
+ for (const $Menu of state$7.$$Menus) {
9281
9287
  remove$1($Menu);
9282
9288
  }
9283
- state$6.$$Menus = [];
9284
- if (state$6.$BackDrop) {
9285
- remove$1(state$6.$BackDrop);
9286
- state$6.$BackDrop = undefined;
9289
+ state$7.$$Menus = [];
9290
+ if (state$7.$BackDrop) {
9291
+ remove$1(state$7.$BackDrop);
9292
+ state$7.$BackDrop = undefined;
9287
9293
  }
9288
9294
  // TODO focus previous item
9289
9295
  if (restoreFocus) {
@@ -9528,8 +9534,8 @@ const openMenu = (state, unFocusIndex, index, level, menuItems, menuFocusedIndex
9528
9534
  $Viewlet.children[unFocusIndex].removeAttribute(AriaOwns);
9529
9535
  }
9530
9536
  $Viewlet.children[index].ariaExpanded = True;
9531
- const $$Menus = state$6.$$Menus;
9532
- state$6.$$Menus = [];
9537
+ const $$Menus = state$7.$$Menus;
9538
+ state$7.$$Menus = [];
9533
9539
  // @ts-expect-error
9534
9540
  showControlled({
9535
9541
  $Parent: $Viewlet.children[index],
@@ -9594,7 +9600,7 @@ const addMenu = ($$Menus, change, uid) => {
9594
9600
  const menu = change[1];
9595
9601
  const dom = change[2];
9596
9602
  const $Menu = create$Menu();
9597
- set$a($Menu, uid);
9603
+ set$b($Menu, uid);
9598
9604
  $Menu.onmousemove = handleMenuMouseOver;
9599
9605
  $Menu.onmouseleave = handleMenuMouseLeave;
9600
9606
  $Menu.onclick = handleMenuClick;
@@ -9838,7 +9844,7 @@ const setIframe = (state, src, sandbox = [], srcDoc = '', csp = '', credentialle
9838
9844
  $Iframe.className = 'E2eTestIframe WebViewIframe';
9839
9845
  $Parent.append($Iframe);
9840
9846
  state.frame = $Iframe;
9841
- set$4(1, $Iframe);
9847
+ set$5(1, $Iframe);
9842
9848
  };
9843
9849
  const setPort$1 = (state, portId, origin) => {
9844
9850
  const port = acquire(portId);
@@ -9936,14 +9942,14 @@ const load$1 = moduleId => {
9936
9942
  return loadModule();
9937
9943
  };
9938
9944
 
9939
- const state$5 = {
9945
+ const state$6 = {
9940
9946
  currentPanelView: undefined,
9941
9947
  currentSidebarView: undefined,
9942
9948
  modules: Object.create(null)
9943
9949
  };
9944
9950
 
9945
9951
  const create$4 = (id, uid = id) => {
9946
- const module = state$5.modules[id];
9952
+ const module = state$6.modules[id];
9947
9953
  if (!module) {
9948
9954
  throw new Error(`module not found: ${id}`);
9949
9955
  }
@@ -9952,17 +9958,17 @@ const create$4 = (id, uid = id) => {
9952
9958
  existing.state.$Viewlet.remove();
9953
9959
  }
9954
9960
  const instanceState = module.create();
9955
- set$a(instanceState.$Viewlet, uid);
9961
+ set$b(instanceState.$Viewlet, uid);
9956
9962
  if (module.attachEvents) {
9957
9963
  module.attachEvents(instanceState);
9958
9964
  }
9959
- set$c(uid, {
9965
+ set$d(uid, {
9960
9966
  factory: module,
9961
9967
  state: instanceState
9962
9968
  });
9963
9969
  };
9964
9970
  const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcId, eventTargetUid = uid) => {
9965
- let module = state$5.modules[id];
9971
+ let module = state$6.modules[id];
9966
9972
  if (hasFunctionalEvents) {
9967
9973
  module ||= {};
9968
9974
  }
@@ -9977,11 +9983,11 @@ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcI
9977
9983
  const instanceState = {
9978
9984
  $Viewlet: document.createElement('div')
9979
9985
  };
9980
- set$a(instanceState.$Viewlet, uid);
9986
+ set$b(instanceState.$Viewlet, uid);
9981
9987
  if (existing) dispose$i(uid);
9982
- set$a(instanceState.$Viewlet, eventTargetUid);
9988
+ set$b(instanceState.$Viewlet, eventTargetUid);
9983
9989
  registerView(uid, directEventRpcId);
9984
- set$c(uid, {
9990
+ set$d(uid, {
9985
9991
  factory: module,
9986
9992
  state: instanceState
9987
9993
  });
@@ -9997,7 +10003,7 @@ const removeKeyBindings = id => {
9997
10003
  const loadModule = async id => {
9998
10004
  try {
9999
10005
  const module = await load$1(id);
10000
- state$5.modules[id] = module;
10006
+ state$6.modules[id] = module;
10001
10007
  } catch (error) {
10002
10008
  throw new VError(error, `Failed to load ${id}`);
10003
10009
  }
@@ -10108,7 +10114,7 @@ const setUid = (viewletId, uid) => {
10108
10114
  const {
10109
10115
  $Viewlet
10110
10116
  } = instance.state;
10111
- set$a($Viewlet, uid);
10117
+ set$b($Viewlet, uid);
10112
10118
  };
10113
10119
  const focusCallback = {
10114
10120
  id: 0,
@@ -10183,7 +10189,7 @@ const refresh = (viewletId, viewletContext) => {
10183
10189
  instance.factory.refresh(instance.state, viewletContext);
10184
10190
  } else {
10185
10191
  // @ts-expect-error
10186
- state$5.refreshContext[viewletId] = viewletContext;
10192
+ state$6.refreshContext[viewletId] = viewletContext;
10187
10193
  }
10188
10194
  };
10189
10195
  const specialIds = new Set(['TitleBar', 'SideBar', 'Main', 'ActivityBar', 'StatusBar', 'Panel']);
@@ -10200,14 +10206,14 @@ const createPlaceholder = (viewletId, parentId, top, left, width, height) => {
10200
10206
  const parentInstance = get$b(parentId);
10201
10207
  const $Parent = parentInstance.state.$Viewlet;
10202
10208
  $Parent.append($Placeholder);
10203
- set$c(viewletId, {
10209
+ set$d(viewletId, {
10204
10210
  state: {
10205
10211
  $Viewlet: $Placeholder
10206
10212
  }
10207
10213
  });
10208
10214
  };
10209
10215
  const setDragData = (viewletId, dragData) => {
10210
- set$5(viewletId, dragData);
10216
+ set$6(viewletId, dragData);
10211
10217
  };
10212
10218
  const getDragData = () => {
10213
10219
  return getCurrent();
@@ -10258,7 +10264,7 @@ const restoreComponentDom = viewletId => {
10258
10264
  }
10259
10265
  }
10260
10266
  instance.state.$Viewlet.replaceWith($Original);
10261
- set$c(viewletId, {
10267
+ set$d(viewletId, {
10262
10268
  ...instance,
10263
10269
  componentDom: undefined,
10264
10270
  componentDomOriginal: undefined,
@@ -10306,7 +10312,7 @@ const setComponentDom = (viewletId, dom) => {
10306
10312
  uid
10307
10313
  });
10308
10314
  }
10309
- set$c(viewletId, {
10315
+ set$d(viewletId, {
10310
10316
  ...instance,
10311
10317
  componentDomOriginal: $Original,
10312
10318
  componentDomReferences: references
@@ -10320,7 +10326,7 @@ const setComponentDom = (viewletId, dom) => {
10320
10326
  throw error;
10321
10327
  }
10322
10328
  $Viewlet.replaceWith($Preview);
10323
- set$c(viewletId, {
10329
+ set$d(viewletId, {
10324
10330
  ...instance,
10325
10331
  componentDom: dom,
10326
10332
  componentDomOriginal: $Original,
@@ -10369,9 +10375,9 @@ const setDom2 = (viewletId, dom) => {
10369
10375
  const $NewViewlet = rememberFocus($Viewlet, dom, Events, viewletId);
10370
10376
  if (uid) {
10371
10377
  // @ts-ignore
10372
- set$a($NewViewlet, uid);
10378
+ set$b($NewViewlet, uid);
10373
10379
  }
10374
- set$c(viewletId, {
10380
+ set$d(viewletId, {
10375
10381
  ...instance,
10376
10382
  state: {
10377
10383
  ...instance.state,
@@ -10494,7 +10500,7 @@ const dispose$4 = id => {
10494
10500
  instance.state.$Viewlet.remove();
10495
10501
  }
10496
10502
  removeCssStyleSheet(id);
10497
- set$c(id, undefined);
10503
+ set$d(id, undefined);
10498
10504
  } catch {
10499
10505
  throw new Error(`Failed to dispose ${id}`);
10500
10506
  }
@@ -10785,7 +10791,7 @@ const commandHandlers = {
10785
10791
  'Viewlet.setInputValues': setInputValues,
10786
10792
  'Viewlet.setPatches': setPatches,
10787
10793
  'Viewlet.setProperty': setProperty,
10788
- 'Viewlet.setScrollSpeed': set$d,
10794
+ 'Viewlet.setScrollSpeed': set$e,
10789
10795
  'Viewlet.setSelectionByName': setSelectionByName,
10790
10796
  'Viewlet.setTreePatches': setTreePatches,
10791
10797
  'Viewlet.setUid': setUid,
@@ -10800,7 +10806,7 @@ const getFn = command => {
10800
10806
  return fn;
10801
10807
  };
10802
10808
 
10803
- const state$4 = {
10809
+ const state$5 = {
10804
10810
  duration: 0,
10805
10811
  lastError: '',
10806
10812
  pending: false
@@ -10815,16 +10821,16 @@ const waitForReady = async () => {
10815
10821
  }
10816
10822
  };
10817
10823
  const getStatus = () => ({
10818
- duration: state$4.duration,
10819
- error: state$4.lastError,
10820
- pending: state$4.pending
10824
+ duration: state$5.duration,
10825
+ error: state$5.lastError,
10826
+ pending: state$5.pending
10821
10827
  });
10822
10828
  const restart = async () => {
10823
10829
  const started = performance.now();
10824
10830
  try {
10825
10831
  document.documentElement.inert = true;
10826
10832
  const snapshot = await invoke$1('Reload.prepareHotReload');
10827
- set$9(snapshot);
10833
+ set$a(snapshot);
10828
10834
  await invoke$1('Reload.retire');
10829
10835
  await dispose$p();
10830
10836
  await dispose$q();
@@ -10839,10 +10845,10 @@ const restart = async () => {
10839
10845
  const result = await launchWorkers();
10840
10846
  if (isError(result)) throw result.error;
10841
10847
  await waitForReady();
10842
- set$9(undefined);
10843
- state$4.duration = performance.now() - started;
10848
+ set$a(undefined);
10849
+ state$5.duration = performance.now() - started;
10844
10850
  } catch (error) {
10845
- state$4.lastError = error instanceof Error ? error.message : String(error);
10851
+ state$5.lastError = error instanceof Error ? error.message : String(error);
10846
10852
  console.error(error);
10847
10853
  // Keep the snapshot available for recovery; never silently discard drafts.
10848
10854
  const snapshot = get$7();
@@ -10856,21 +10862,21 @@ const restart = async () => {
10856
10862
  }
10857
10863
  }
10858
10864
  const recovery = document.createElement('button');
10859
- recovery.textContent = `Application restart failed: ${state$4.lastError}. Reload window`;
10865
+ recovery.textContent = `Application restart failed: ${state$5.lastError}. Reload window`;
10860
10866
  recovery.onclick = () => location.reload();
10861
10867
  document.body.append(recovery);
10862
10868
  } finally {
10863
10869
  document.documentElement.inert = false;
10864
- state$4.pending = false;
10870
+ state$5.pending = false;
10865
10871
  }
10866
10872
  };
10867
10873
 
10868
10874
  // Reply on the old RPC before retiring it. Awaiting restart from that RPC would
10869
10875
  // strand the caller when its worker is terminated.
10870
10876
  const request = () => {
10871
- if (state$4.pending) return;
10872
- state$4.pending = true;
10873
- state$4.lastError = '';
10877
+ if (state$5.pending) return;
10878
+ state$5.pending = true;
10879
+ state$5.lastError = '';
10874
10880
  setTimeout(() => void restart(), 0);
10875
10881
  };
10876
10882
 
@@ -11160,7 +11166,7 @@ const addFileHandle = fileHandle => {
11160
11166
  return addFileHandle$1(fileHandle);
11161
11167
  };
11162
11168
 
11163
- const state$3 = {
11169
+ const state$4 = {
11164
11170
  hydrated: false,
11165
11171
  lastPathName: ''
11166
11172
  };
@@ -11180,7 +11186,7 @@ const setPathName = pathName => {
11180
11186
  return;
11181
11187
  }
11182
11188
  history.pushState(null, '', pathName);
11183
- state$3.lastPathName = getPathName();
11189
+ state$4.lastPathName = getPathName();
11184
11190
  };
11185
11191
  const setHash = hash => {
11186
11192
  const currentHref = getHref();
@@ -11226,21 +11232,21 @@ const handlePopState = () => {
11226
11232
  } else if (isChatPath(pathName)) {
11227
11233
  send$1('Layout.enterAiNativeLayout');
11228
11234
  executeExtensionCommand('chat2.show');
11229
- } else if (isChatPath(state$3.lastPathName) || isBoardPath(state$3.lastPathName)) {
11235
+ } else if (isChatPath(state$4.lastPathName) || isBoardPath(state$4.lastPathName)) {
11230
11236
  executeExtensionCommand('chat2.showIdeLayout');
11231
11237
  }
11232
- state$3.lastPathName = pathName;
11238
+ state$4.lastPathName = pathName;
11233
11239
  };
11234
11240
  const hydrate = () => {
11235
- if (state$3.hydrated) {
11241
+ if (state$4.hydrated) {
11236
11242
  return;
11237
11243
  }
11238
- state$3.lastPathName = getPathName();
11239
- if (isChatPath(state$3.lastPathName)) {
11244
+ state$4.lastPathName = getPathName();
11245
+ if (isChatPath(state$4.lastPathName)) {
11240
11246
  send$1('Layout.enterAiNativeLayout');
11241
11247
  }
11242
11248
  addEventListener('popstate', handlePopState);
11243
- state$3.hydrated = true;
11249
+ state$4.hydrated = true;
11244
11250
  };
11245
11251
 
11246
11252
  const getConfig = () => {
@@ -11332,7 +11338,7 @@ const setModernUi = enabled => {
11332
11338
  document.body.classList.toggle('ModernUi', enabled);
11333
11339
  };
11334
11340
 
11335
- const state$2 = {
11341
+ const state$3 = {
11336
11342
  nextNotificationId: 0
11337
11343
  };
11338
11344
  const pendingChoices = new WeakMap();
@@ -11362,7 +11368,7 @@ const create$Notification = message => {
11362
11368
  const $NotificationMessage = create$NotificationMessage(message);
11363
11369
  const $CloseButton = create$CloseButton();
11364
11370
  const $Notification = document.createElement('div');
11365
- $Notification.id = `Notification-${++state$2.nextNotificationId}`;
11371
+ $Notification.id = `Notification-${++state$3.nextNotificationId}`;
11366
11372
  $Notification.className = 'Notification';
11367
11373
  $Notification.append($NotificationMessage, $CloseButton);
11368
11374
  return $Notification;
@@ -11411,7 +11417,7 @@ const create$NotificationWithOptions = (message, options) => {
11411
11417
  $NotificationOptions.append($NotificationOption);
11412
11418
  }
11413
11419
  const $Notification = document.createElement('div');
11414
- $Notification.id = `Notification-${++state$2.nextNotificationId}`;
11420
+ $Notification.id = `Notification-${++state$3.nextNotificationId}`;
11415
11421
  $Notification.className = 'Notification';
11416
11422
  $Notification.append($NotificationMessage, $CloseButton, $NotificationOptions);
11417
11423
  $Notification.onclick = handleNotificationClick;
@@ -11521,17 +11527,17 @@ const createCanvasPresentation = (canvas, onDispose) => {
11521
11527
  };
11522
11528
  };
11523
11529
 
11524
- const state$1 = {
11530
+ const state$2 = {
11525
11531
  canvasObjects: Object.create(null)
11526
11532
  };
11527
- const set$2 = (canvasId, canvas) => {
11528
- state$1.canvasObjects[canvasId] = canvas;
11533
+ const set$3 = (canvasId, canvas) => {
11534
+ state$2.canvasObjects[canvasId] = canvas;
11529
11535
  };
11530
11536
 
11531
11537
  const create$2 = async (canvasId, objectId) => {
11532
11538
  const canvas = document.createElement('canvas');
11533
11539
  const offscreenCanvas = canvas.transferControlToOffscreen();
11534
- set$2(canvasId, canvas);
11540
+ set$3(canvasId, canvas);
11535
11541
  await invokeAndTransfer('Transferrable.transfer', objectId, offscreenCanvas);
11536
11542
  };
11537
11543
  const create2 = async (canvasId, objectId, width, height) => {
@@ -11544,7 +11550,7 @@ const create2 = async (canvasId, objectId, width, height) => {
11544
11550
  }
11545
11551
  const offscreenCanvas = canvas.transferControlToOffscreen();
11546
11552
  canvas.dataset.id = canvasId;
11547
- set$c(canvasId, {
11553
+ set$d(canvasId, {
11548
11554
  factory: {},
11549
11555
  state: {
11550
11556
  $Viewlet: canvas
@@ -11563,9 +11569,9 @@ const createForPreview = async (canvasId, objectId, portId, width, height) => {
11563
11569
  canvas.height = height;
11564
11570
  canvas.dataset.id = String(canvasId);
11565
11571
  const offscreen = new OffscreenCanvas(width, height);
11566
- const presentation = createCanvasPresentation(canvas, () => set$c(canvasId, undefined));
11572
+ const presentation = createCanvasPresentation(canvas, () => set$d(canvasId, undefined));
11567
11573
  // Keep the receiving port reachable until the sandbox disposes this canvas.
11568
- set$c(canvasId, {
11574
+ set$d(canvasId, {
11569
11575
  factory: {},
11570
11576
  state: {
11571
11577
  $Viewlet: canvas,
@@ -12510,6 +12516,31 @@ const revealBrowserTab = revealBrowserTab$1;
12510
12516
  const rememberBrowserParent = rememberBrowserParent$1;
12511
12517
  const restoreBrowserParent = restoreBrowserParent$1;
12512
12518
 
12519
+ const state$1 = {
12520
+ icon: undefined
12521
+ };
12522
+
12523
+ // Keep the application's original icons intact so removing this override
12524
+ // restores the default favicon, including deployments under a path prefix.
12525
+ const set$2 = href => {
12526
+ if (!href) {
12527
+ state$1.icon?.remove();
12528
+ state$1.icon = undefined;
12529
+ return;
12530
+ }
12531
+ const url = new URL(href);
12532
+ const isImageData = /^data:image\/(?:png;base64,|svg\+xml,)/u.test(href);
12533
+ if (url.protocol !== 'https:' && !isImageData) {
12534
+ throw new Error('Favicon URL must use HTTPS or PNG/SVG image data');
12535
+ }
12536
+ if (!state$1.icon) {
12537
+ state$1.icon = document.createElement('link');
12538
+ state$1.icon.rel = 'icon';
12539
+ }
12540
+ state$1.icon.href = url.href;
12541
+ document.head.append(state$1.icon);
12542
+ };
12543
+
12513
12544
  const set$1 = title => {
12514
12545
  document.title = title;
12515
12546
  };
@@ -12587,7 +12618,7 @@ const create$1 = async (uid, src, sandbox, csp, credentialless, permissionPolicy
12587
12618
  if (title) {
12588
12619
  $Iframe.title = title;
12589
12620
  }
12590
- set$4(uid, $Iframe);
12621
+ set$5(uid, $Iframe);
12591
12622
  // TODO make make waitForFrameToLoad a separate command
12592
12623
  };
12593
12624
  const loadOnly = async uid => {
@@ -12892,6 +12923,7 @@ const commandMap = {
12892
12923
  'DropData.get': get$1,
12893
12924
  'EditorKeymap.register': register$1,
12894
12925
  'EditorKeymap.remove': remove$5,
12926
+ 'Favicon.set': set$2,
12895
12927
  'FileHandles.get': get,
12896
12928
  'FilePicker.showDirectoryPicker': showDirectoryPicker,
12897
12929
  'FilePicker.showFilePicker': showFilePicker,
@@ -12990,7 +13022,7 @@ const commandMap = {
12990
13022
  'Viewlet.sendMultiple': sendMultiple,
12991
13023
  'Viewlet.setBounds': setBounds$1,
12992
13024
  'Viewlet.setComponentDom': setComponentDom,
12993
- 'Viewlet.setScrollSpeed': set$d,
13025
+ 'Viewlet.setScrollSpeed': set$e,
12994
13026
  'Viewlet.show': show,
12995
13027
  'VirtualDom.configure': configure,
12996
13028
  'WebRtc.readMicLevels': readMicLevels,
@@ -13126,15 +13158,15 @@ const main = async () => {
13126
13158
  initialize$1(location.search);
13127
13159
  Object.assign(commandMapRef, commandMap);
13128
13160
  enable(window);
13129
- state$5.modules[ColorPicker] = ViewletColorPicker;
13130
- state$5.modules[EditorCodeGenerator] = ViewletEditorCodeGenerator;
13131
- state$5.modules[EditorCompletion] = ViewletEditorCompletion;
13132
- state$5.modules[EditorCompletionDetails] = ViewletEditorCompletionDetails;
13133
- state$5.modules[EditorHover] = ViewletEditorHover;
13134
- state$5.modules[EditorRename] = ViewletEditorRename;
13135
- state$5.modules[EditorSourceActions] = ViewletEditorSourceActions;
13136
- state$5.modules[FindWidget] = ViewletFindWidget;
13137
- state$5.modules[TitleBar] = ViewletTitleBar;
13161
+ state$6.modules[ColorPicker] = ViewletColorPicker;
13162
+ state$6.modules[EditorCodeGenerator] = ViewletEditorCodeGenerator;
13163
+ state$6.modules[EditorCompletion] = ViewletEditorCompletion;
13164
+ state$6.modules[EditorCompletionDetails] = ViewletEditorCompletionDetails;
13165
+ state$6.modules[EditorHover] = ViewletEditorHover;
13166
+ state$6.modules[EditorRename] = ViewletEditorRename;
13167
+ state$6.modules[EditorSourceActions] = ViewletEditorSourceActions;
13168
+ state$6.modules[FindWidget] = ViewletFindWidget;
13169
+ state$6.modules[TitleBar] = ViewletTitleBar;
13138
13170
  // TODO this is discovered very late
13139
13171
  const launchWorkersResult = await launchWorkers();
13140
13172
  if (isError(launchWorkersResult)) {