@liveblocks/core 3.21.0-private3 → 3.21.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/index.cjs CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/version.ts
8
8
  var PKG_NAME = "@liveblocks/core";
9
- var PKG_VERSION = "3.21.0-private3";
9
+ var PKG_VERSION = "3.21.0";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -2132,9 +2132,9 @@ function createApiClient({
2132
2132
  })
2133
2133
  );
2134
2134
  }
2135
- async function getTextVersion(options) {
2135
+ async function getYjsHistoryVersion(options) {
2136
2136
  return httpClient.rawGet(
2137
- url`/v2/c/rooms/${options.roomId}/y-version/${options.versionId}`,
2137
+ url`/v2/c/rooms/${options.roomId}/versions/${options.versionId}/yjs`,
2138
2138
  await authManager.getAuthValue({
2139
2139
  roomId: options.roomId,
2140
2140
  resource: "storage",
@@ -2142,9 +2142,9 @@ function createApiClient({
2142
2142
  })
2143
2143
  );
2144
2144
  }
2145
- async function createTextVersion(options) {
2145
+ async function createVersionHistorySnapshot(options) {
2146
2146
  await httpClient.rawPost(
2147
- url`/v2/c/rooms/${options.roomId}/version`,
2147
+ url`/v2/c/rooms/${options.roomId}/versions`,
2148
2148
  await authManager.getAuthValue({
2149
2149
  roomId: options.roomId,
2150
2150
  resource: "storage",
@@ -2190,7 +2190,7 @@ function createApiClient({
2190
2190
  }
2191
2191
  return result.content[0].text;
2192
2192
  }
2193
- async function listTextVersions(options) {
2193
+ async function listHistoryVersions(options) {
2194
2194
  const result = await httpClient.get(
2195
2195
  url`/v2/c/rooms/${options.roomId}/versions`,
2196
2196
  await authManager.getAuthValue({
@@ -2209,7 +2209,7 @@ function createApiClient({
2209
2209
  requestedAt: new Date(result.meta.requestedAt)
2210
2210
  };
2211
2211
  }
2212
- async function listTextVersionsSince(options) {
2212
+ async function listHistoryVersionsSince(options) {
2213
2213
  const result = await httpClient.get(
2214
2214
  url`/v2/c/rooms/${options.roomId}/versions/delta`,
2215
2215
  await authManager.getAuthValue({
@@ -2475,11 +2475,11 @@ function createApiClient({
2475
2475
  // Room text editor
2476
2476
  createTextMention,
2477
2477
  deleteTextMention,
2478
- getTextVersion,
2479
- createTextVersion,
2478
+ getYjsHistoryVersion,
2479
+ createVersionHistorySnapshot,
2480
2480
  reportTextEditor,
2481
- listTextVersions,
2482
- listTextVersionsSince,
2481
+ listHistoryVersions,
2482
+ listHistoryVersionsSince,
2483
2483
  // Room attachments
2484
2484
  getAttachmentUrl,
2485
2485
  uploadAttachment,
@@ -9911,6 +9911,19 @@ function makeNodeMapBuffer() {
9911
9911
  }
9912
9912
  };
9913
9913
  }
9914
+ function topLevelKeysOf(nodes) {
9915
+ const keys2 = /* @__PURE__ */ new Set();
9916
+ const root = nodes.get("root");
9917
+ for (const key in _optionalChain([root, 'optionalAccess', _228 => _228.data])) {
9918
+ keys2.add(key);
9919
+ }
9920
+ for (const node of nodes.values()) {
9921
+ if (node.parentId === "root") {
9922
+ keys2.add(node.parentKey);
9923
+ }
9924
+ }
9925
+ return keys2;
9926
+ }
9914
9927
  function createRoom(options, config) {
9915
9928
  const roomId = config.roomId;
9916
9929
  const initialPresence = options.initialPresence;
@@ -10084,7 +10097,7 @@ function createRoom(options, config) {
10084
10097
  }
10085
10098
  }
10086
10099
  function isStorageWritable() {
10087
- const permissionMatrix = _optionalChain([context, 'access', _228 => _228.dynamicSessionInfoSig, 'access', _229 => _229.get, 'call', _230 => _230(), 'optionalAccess', _231 => _231.permissionMatrix]);
10100
+ const permissionMatrix = _optionalChain([context, 'access', _229 => _229.dynamicSessionInfoSig, 'access', _230 => _230.get, 'call', _231 => _231(), 'optionalAccess', _232 => _232.permissionMatrix]);
10088
10101
  return permissionMatrix !== void 0 ? hasPermissionAccess(permissionMatrix, "storage", "write") : true;
10089
10102
  }
10090
10103
  const eventHub = {
@@ -10113,21 +10126,21 @@ function createRoom(options, config) {
10113
10126
  async function reportTextEditor(type, rootKey) {
10114
10127
  await httpClient.reportTextEditor({ roomId, type, rootKey });
10115
10128
  }
10116
- async function listTextVersions() {
10117
- return httpClient.listTextVersions({ roomId });
10129
+ async function listHistoryVersions() {
10130
+ return httpClient.listHistoryVersions({ roomId });
10118
10131
  }
10119
- async function listTextVersionsSince(options2) {
10120
- return httpClient.listTextVersionsSince({
10132
+ async function listHistoryVersionsSince(options2) {
10133
+ return httpClient.listHistoryVersionsSince({
10121
10134
  roomId,
10122
10135
  since: options2.since,
10123
10136
  signal: options2.signal
10124
10137
  });
10125
10138
  }
10126
- async function getTextVersion(versionId) {
10127
- return httpClient.getTextVersion({ roomId, versionId });
10139
+ async function getYjsHistoryVersion(versionId) {
10140
+ return httpClient.getYjsHistoryVersion({ roomId, versionId });
10128
10141
  }
10129
- async function createTextVersion() {
10130
- return httpClient.createTextVersion({ roomId });
10142
+ async function createVersionHistorySnapshot() {
10143
+ return httpClient.createVersionHistorySnapshot({ roomId });
10131
10144
  }
10132
10145
  async function executeContextualPrompt(options2) {
10133
10146
  return httpClient.executeContextualPrompt({
@@ -10196,11 +10209,12 @@ function createRoom(options, config) {
10196
10209
  context.pool
10197
10210
  );
10198
10211
  }
10199
- const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _232 => _232.get, 'call', _233 => _233(), 'optionalAccess', _234 => _234.canWrite]), () => ( true));
10212
+ const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _233 => _233.get, 'call', _234 => _234(), 'optionalAccess', _235 => _235.canWrite]), () => ( true));
10213
+ const serverTopLevelKeys = topLevelKeysOf(nodes);
10200
10214
  const root = context.root;
10201
10215
  disableHistory(() => {
10202
10216
  for (const key in context.initialStorage) {
10203
- if (root.get(key) === void 0) {
10217
+ if (!serverTopLevelKeys.has(key)) {
10204
10218
  if (canWrite) {
10205
10219
  root.set(key, cloneLson(context.initialStorage[key]));
10206
10220
  } else {
@@ -10401,7 +10415,7 @@ function createRoom(options, config) {
10401
10415
  }
10402
10416
  context.myPresence.patch(patch);
10403
10417
  if (context.activeBatch) {
10404
- if (_optionalChain([options2, 'optionalAccess', _235 => _235.addToHistory])) {
10418
+ if (_optionalChain([options2, 'optionalAccess', _236 => _236.addToHistory])) {
10405
10419
  context.activeBatch.reverseOps.pushLeft({
10406
10420
  type: "presence",
10407
10421
  data: oldValues
@@ -10410,7 +10424,7 @@ function createRoom(options, config) {
10410
10424
  context.activeBatch.updates.presence = true;
10411
10425
  } else {
10412
10426
  flushNowOrSoon();
10413
- if (_optionalChain([options2, 'optionalAccess', _236 => _236.addToHistory])) {
10427
+ if (_optionalChain([options2, 'optionalAccess', _237 => _237.addToHistory])) {
10414
10428
  addToUndoStack([{ type: "presence", data: oldValues }]);
10415
10429
  }
10416
10430
  notify({ presence: true });
@@ -10589,11 +10603,11 @@ function createRoom(options, config) {
10589
10603
  break;
10590
10604
  }
10591
10605
  case ServerMsgCode.STORAGE_CHUNK:
10592
- _optionalChain([stopwatch, 'optionalAccess', _237 => _237.lap, 'call', _238 => _238()]);
10606
+ _optionalChain([stopwatch, 'optionalAccess', _238 => _238.lap, 'call', _239 => _239()]);
10593
10607
  nodeMapBuffer.append(compactNodesToNodeStream(message.nodes));
10594
10608
  break;
10595
10609
  case ServerMsgCode.STORAGE_STREAM_END: {
10596
- const timing = _optionalChain([stopwatch, 'optionalAccess', _239 => _239.stop, 'call', _240 => _240()]);
10610
+ const timing = _optionalChain([stopwatch, 'optionalAccess', _240 => _240.stop, 'call', _241 => _241()]);
10597
10611
  if (timing) {
10598
10612
  const ms = (v) => `${v.toFixed(1)}ms`;
10599
10613
  const rest = timing.laps.slice(1);
@@ -10728,11 +10742,11 @@ function createRoom(options, config) {
10728
10742
  } else if (pendingFeedsRequests.has(requestId)) {
10729
10743
  const pending = pendingFeedsRequests.get(requestId);
10730
10744
  pendingFeedsRequests.delete(requestId);
10731
- _optionalChain([pending, 'optionalAccess', _241 => _241.reject, 'call', _242 => _242(err)]);
10745
+ _optionalChain([pending, 'optionalAccess', _242 => _242.reject, 'call', _243 => _243(err)]);
10732
10746
  } else if (pendingFeedMessagesRequests.has(requestId)) {
10733
10747
  const pending = pendingFeedMessagesRequests.get(requestId);
10734
10748
  pendingFeedMessagesRequests.delete(requestId);
10735
- _optionalChain([pending, 'optionalAccess', _243 => _243.reject, 'call', _244 => _244(err)]);
10749
+ _optionalChain([pending, 'optionalAccess', _244 => _244.reject, 'call', _245 => _245(err)]);
10736
10750
  }
10737
10751
  eventHub.feeds.notify(message);
10738
10752
  break;
@@ -10886,10 +10900,10 @@ function createRoom(options, config) {
10886
10900
  timeoutId,
10887
10901
  kind,
10888
10902
  feedId,
10889
- messageId: _optionalChain([options2, 'optionalAccess', _245 => _245.messageId]),
10890
- expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _246 => _246.expectedClientMessageId])
10903
+ messageId: _optionalChain([options2, 'optionalAccess', _246 => _246.messageId]),
10904
+ expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _247 => _247.expectedClientMessageId])
10891
10905
  });
10892
- if (kind === "add-message" && _optionalChain([options2, 'optionalAccess', _247 => _247.expectedClientMessageId]) === void 0) {
10906
+ if (kind === "add-message" && _optionalChain([options2, 'optionalAccess', _248 => _248.expectedClientMessageId]) === void 0) {
10893
10907
  const q = _nullishCoalesce(pendingAddMessageFifoByFeed.get(feedId), () => ( []));
10894
10908
  q.push(requestId);
10895
10909
  pendingAddMessageFifoByFeed.set(feedId, q);
@@ -10940,10 +10954,10 @@ function createRoom(options, config) {
10940
10954
  }
10941
10955
  if (!matched) {
10942
10956
  const q = pendingAddMessageFifoByFeed.get(message.feedId);
10943
- const headId = _optionalChain([q, 'optionalAccess', _248 => _248[0]]);
10957
+ const headId = _optionalChain([q, 'optionalAccess', _249 => _249[0]]);
10944
10958
  if (headId !== void 0) {
10945
10959
  const pending = pendingFeedMutations.get(headId);
10946
- if (_optionalChain([pending, 'optionalAccess', _249 => _249.kind]) === "add-message" && pending.expectedClientMessageId === void 0) {
10960
+ if (_optionalChain([pending, 'optionalAccess', _250 => _250.kind]) === "add-message" && pending.expectedClientMessageId === void 0) {
10947
10961
  settleFeedMutation(headId, "ok");
10948
10962
  }
10949
10963
  }
@@ -10979,7 +10993,7 @@ function createRoom(options, config) {
10979
10993
  const unacknowledgedOps2 = [...context.unacknowledgedOps.values()];
10980
10994
  createOrUpdateRootFromMessage(nodes);
10981
10995
  applyAndSendOfflineOps(unacknowledgedOps2);
10982
- _optionalChain([_resolveStoragePromise, 'optionalCall', _250 => _250()]);
10996
+ _optionalChain([_resolveStoragePromise, 'optionalCall', _251 => _251()]);
10983
10997
  notifyStorageStatus();
10984
10998
  eventHub.storageDidLoad.notify();
10985
10999
  }
@@ -10988,7 +11002,7 @@ function createRoom(options, config) {
10988
11002
  if (!messages.some((msg) => msg.type === ClientMsgCode.FETCH_STORAGE)) {
10989
11003
  messages.push({ type: ClientMsgCode.FETCH_STORAGE });
10990
11004
  nodeMapBuffer.take();
10991
- _optionalChain([stopwatch, 'optionalAccess', _251 => _251.start, 'call', _252 => _252()]);
11005
+ _optionalChain([stopwatch, 'optionalAccess', _252 => _252.start, 'call', _253 => _253()]);
10992
11006
  }
10993
11007
  }
10994
11008
  function startLoadingStorage() {
@@ -11042,10 +11056,10 @@ function createRoom(options, config) {
11042
11056
  const message = {
11043
11057
  type: ClientMsgCode.FETCH_FEEDS,
11044
11058
  requestId,
11045
- cursor: _optionalChain([options2, 'optionalAccess', _253 => _253.cursor]),
11046
- since: _optionalChain([options2, 'optionalAccess', _254 => _254.since]),
11047
- limit: _optionalChain([options2, 'optionalAccess', _255 => _255.limit]),
11048
- metadata: _optionalChain([options2, 'optionalAccess', _256 => _256.metadata])
11059
+ cursor: _optionalChain([options2, 'optionalAccess', _254 => _254.cursor]),
11060
+ since: _optionalChain([options2, 'optionalAccess', _255 => _255.since]),
11061
+ limit: _optionalChain([options2, 'optionalAccess', _256 => _256.limit]),
11062
+ metadata: _optionalChain([options2, 'optionalAccess', _257 => _257.metadata])
11049
11063
  };
11050
11064
  context.buffer.messages.push(message);
11051
11065
  flushNowOrSoon();
@@ -11065,9 +11079,9 @@ function createRoom(options, config) {
11065
11079
  type: ClientMsgCode.FETCH_FEED_MESSAGES,
11066
11080
  requestId,
11067
11081
  feedId,
11068
- cursor: _optionalChain([options2, 'optionalAccess', _257 => _257.cursor]),
11069
- since: _optionalChain([options2, 'optionalAccess', _258 => _258.since]),
11070
- limit: _optionalChain([options2, 'optionalAccess', _259 => _259.limit])
11082
+ cursor: _optionalChain([options2, 'optionalAccess', _258 => _258.cursor]),
11083
+ since: _optionalChain([options2, 'optionalAccess', _259 => _259.since]),
11084
+ limit: _optionalChain([options2, 'optionalAccess', _260 => _260.limit])
11071
11085
  };
11072
11086
  context.buffer.messages.push(message);
11073
11087
  flushNowOrSoon();
@@ -11086,8 +11100,8 @@ function createRoom(options, config) {
11086
11100
  type: ClientMsgCode.ADD_FEED,
11087
11101
  requestId,
11088
11102
  feedId,
11089
- metadata: _optionalChain([options2, 'optionalAccess', _260 => _260.metadata]),
11090
- createdAt: _optionalChain([options2, 'optionalAccess', _261 => _261.createdAt])
11103
+ metadata: _optionalChain([options2, 'optionalAccess', _261 => _261.metadata]),
11104
+ createdAt: _optionalChain([options2, 'optionalAccess', _262 => _262.createdAt])
11091
11105
  };
11092
11106
  context.buffer.messages.push(message);
11093
11107
  flushNowOrSoon();
@@ -11121,15 +11135,15 @@ function createRoom(options, config) {
11121
11135
  function addFeedMessage(feedId, data, options2) {
11122
11136
  const requestId = nanoid();
11123
11137
  const promise = registerFeedMutation(requestId, "add-message", feedId, {
11124
- expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _262 => _262.id])
11138
+ expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _263 => _263.id])
11125
11139
  });
11126
11140
  const message = {
11127
11141
  type: ClientMsgCode.ADD_FEED_MESSAGE,
11128
11142
  requestId,
11129
11143
  feedId,
11130
11144
  data,
11131
- id: _optionalChain([options2, 'optionalAccess', _263 => _263.id]),
11132
- createdAt: _optionalChain([options2, 'optionalAccess', _264 => _264.createdAt])
11145
+ id: _optionalChain([options2, 'optionalAccess', _264 => _264.id]),
11146
+ createdAt: _optionalChain([options2, 'optionalAccess', _265 => _265.createdAt])
11133
11147
  };
11134
11148
  context.buffer.messages.push(message);
11135
11149
  flushNowOrSoon();
@@ -11146,7 +11160,7 @@ function createRoom(options, config) {
11146
11160
  feedId,
11147
11161
  messageId,
11148
11162
  data,
11149
- updatedAt: _optionalChain([options2, 'optionalAccess', _265 => _265.updatedAt])
11163
+ updatedAt: _optionalChain([options2, 'optionalAccess', _266 => _266.updatedAt])
11150
11164
  };
11151
11165
  context.buffer.messages.push(message);
11152
11166
  flushNowOrSoon();
@@ -11353,8 +11367,8 @@ function createRoom(options, config) {
11353
11367
  async function getThreads(options2) {
11354
11368
  return httpClient.getThreads({
11355
11369
  roomId,
11356
- query: _optionalChain([options2, 'optionalAccess', _266 => _266.query]),
11357
- cursor: _optionalChain([options2, 'optionalAccess', _267 => _267.cursor])
11370
+ query: _optionalChain([options2, 'optionalAccess', _267 => _267.query]),
11371
+ cursor: _optionalChain([options2, 'optionalAccess', _268 => _268.cursor])
11358
11372
  });
11359
11373
  }
11360
11374
  async function getThread(threadId) {
@@ -11477,7 +11491,7 @@ function createRoom(options, config) {
11477
11491
  function getSubscriptionSettings(options2) {
11478
11492
  return httpClient.getSubscriptionSettings({
11479
11493
  roomId,
11480
- signal: _optionalChain([options2, 'optionalAccess', _268 => _268.signal])
11494
+ signal: _optionalChain([options2, 'optionalAccess', _269 => _269.signal])
11481
11495
  });
11482
11496
  }
11483
11497
  function updateSubscriptionSettings(settings) {
@@ -11499,7 +11513,7 @@ function createRoom(options, config) {
11499
11513
  {
11500
11514
  [kInternal]: {
11501
11515
  get presenceBuffer() {
11502
- return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _269 => _269.buffer, 'access', _270 => _270.presenceUpdates, 'optionalAccess', _271 => _271.data]), () => ( null)));
11516
+ return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _270 => _270.buffer, 'access', _271 => _271.presenceUpdates, 'optionalAccess', _272 => _272.data]), () => ( null)));
11503
11517
  },
11504
11518
  // prettier-ignore
11505
11519
  get undoStack() {
@@ -11514,27 +11528,27 @@ function createRoom(options, config) {
11514
11528
  return context.yjsProvider;
11515
11529
  },
11516
11530
  setYjsProvider(newProvider) {
11517
- _optionalChain([context, 'access', _272 => _272.yjsProvider, 'optionalAccess', _273 => _273.off, 'call', _274 => _274("status", yjsStatusDidChange)]);
11531
+ _optionalChain([context, 'access', _273 => _273.yjsProvider, 'optionalAccess', _274 => _274.off, 'call', _275 => _275("status", yjsStatusDidChange)]);
11518
11532
  context.yjsProvider = newProvider;
11519
- _optionalChain([newProvider, 'optionalAccess', _275 => _275.on, 'call', _276 => _276("status", yjsStatusDidChange)]);
11533
+ _optionalChain([newProvider, 'optionalAccess', _276 => _276.on, 'call', _277 => _277("status", yjsStatusDidChange)]);
11520
11534
  context.yjsProviderDidChange.notify();
11521
11535
  },
11522
11536
  yjsProviderDidChange: context.yjsProviderDidChange.observable,
11523
11537
  // send metadata when using a text editor
11524
11538
  reportTextEditor,
11525
- getPermissionMatrix: () => _optionalChain([context, 'access', _277 => _277.dynamicSessionInfoSig, 'access', _278 => _278.get, 'call', _279 => _279(), 'optionalAccess', _280 => _280.permissionMatrix]),
11539
+ getPermissionMatrix: () => _optionalChain([context, 'access', _278 => _278.dynamicSessionInfoSig, 'access', _279 => _279.get, 'call', _280 => _280(), 'optionalAccess', _281 => _281.permissionMatrix]),
11526
11540
  // create a text mention when using a text editor
11527
11541
  createTextMention,
11528
11542
  // delete a text mention when using a text editor
11529
11543
  deleteTextMention,
11530
11544
  // list versions of the document
11531
- listTextVersions,
11545
+ listHistoryVersions,
11532
11546
  // List versions of the document since the specified date
11533
- listTextVersionsSince,
11547
+ listHistoryVersionsSince,
11534
11548
  // get a specific version
11535
- getTextVersion,
11549
+ getYjsHistoryVersion,
11536
11550
  // create a version
11537
- createTextVersion,
11551
+ createVersionHistorySnapshot,
11538
11552
  // execute a contextual prompt
11539
11553
  executeContextualPrompt,
11540
11554
  // Support for the Liveblocks browser extension
@@ -11577,7 +11591,7 @@ ${dumpPool(
11577
11591
  source.dispose();
11578
11592
  }
11579
11593
  eventHub.roomWillDestroy.notify();
11580
- _optionalChain([context, 'access', _281 => _281.yjsProvider, 'optionalAccess', _282 => _282.off, 'call', _283 => _283("status", yjsStatusDidChange)]);
11594
+ _optionalChain([context, 'access', _282 => _282.yjsProvider, 'optionalAccess', _283 => _283.off, 'call', _284 => _284("status", yjsStatusDidChange)]);
11581
11595
  syncSourceForStorage.destroy();
11582
11596
  syncSourceForYjs.destroy();
11583
11597
  uninstallBgTabSpy();
@@ -11739,7 +11753,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
11739
11753
  }
11740
11754
  if (isLiveNode(first)) {
11741
11755
  const node = first;
11742
- if (_optionalChain([options, 'optionalAccess', _284 => _284.isDeep])) {
11756
+ if (_optionalChain([options, 'optionalAccess', _285 => _285.isDeep])) {
11743
11757
  const storageCallback = second;
11744
11758
  return subscribeToLiveStructureDeeply(node, storageCallback);
11745
11759
  } else {
@@ -11829,8 +11843,8 @@ function createClient(options) {
11829
11843
  const authManager = createAuthManager(options, (token) => {
11830
11844
  currentUserId.set(() => token.uid);
11831
11845
  });
11832
- const fetchPolyfill = _optionalChain([clientOptions, 'access', _285 => _285.polyfills, 'optionalAccess', _286 => _286.fetch]) || /* istanbul ignore next */
11833
- _optionalChain([globalThis, 'access', _287 => _287.fetch, 'optionalAccess', _288 => _288.bind, 'call', _289 => _289(globalThis)]);
11846
+ const fetchPolyfill = _optionalChain([clientOptions, 'access', _286 => _286.polyfills, 'optionalAccess', _287 => _287.fetch]) || /* istanbul ignore next */
11847
+ _optionalChain([globalThis, 'access', _288 => _288.fetch, 'optionalAccess', _289 => _289.bind, 'call', _290 => _290(globalThis)]);
11834
11848
  const httpClient = createApiClient({
11835
11849
  baseUrl,
11836
11850
  fetchPolyfill,
@@ -11847,7 +11861,7 @@ function createClient(options) {
11847
11861
  delegates: {
11848
11862
  createSocket: makeCreateSocketDelegateForAi(
11849
11863
  baseUrl,
11850
- _optionalChain([clientOptions, 'access', _290 => _290.polyfills, 'optionalAccess', _291 => _291.WebSocket])
11864
+ _optionalChain([clientOptions, 'access', _291 => _291.polyfills, 'optionalAccess', _292 => _292.WebSocket])
11851
11865
  ),
11852
11866
  authenticate: async () => {
11853
11867
  const resp = await authManager.getAuthValue({
@@ -11918,7 +11932,7 @@ function createClient(options) {
11918
11932
  createSocket: makeCreateSocketDelegateForRoom(
11919
11933
  roomId,
11920
11934
  baseUrl,
11921
- _optionalChain([clientOptions, 'access', _292 => _292.polyfills, 'optionalAccess', _293 => _293.WebSocket])
11935
+ _optionalChain([clientOptions, 'access', _293 => _293.polyfills, 'optionalAccess', _294 => _294.WebSocket])
11922
11936
  ),
11923
11937
  authenticate: makeAuthDelegateForRoom(roomId, authManager)
11924
11938
  })),
@@ -11940,7 +11954,7 @@ function createClient(options) {
11940
11954
  const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
11941
11955
  if (shouldConnect) {
11942
11956
  if (typeof atob === "undefined") {
11943
- if (_optionalChain([clientOptions, 'access', _294 => _294.polyfills, 'optionalAccess', _295 => _295.atob]) === void 0) {
11957
+ if (_optionalChain([clientOptions, 'access', _295 => _295.polyfills, 'optionalAccess', _296 => _296.atob]) === void 0) {
11944
11958
  throw new Error(
11945
11959
  "You need to polyfill atob to use the client in your environment. Please follow the instructions at https://liveblocks.io/docs/errors/liveblocks-client/atob-polyfill"
11946
11960
  );
@@ -11952,7 +11966,7 @@ function createClient(options) {
11952
11966
  return leaseRoom(newRoomDetails);
11953
11967
  }
11954
11968
  function getRoom(roomId) {
11955
- const room = _optionalChain([roomsById, 'access', _296 => _296.get, 'call', _297 => _297(roomId), 'optionalAccess', _298 => _298.room]);
11969
+ const room = _optionalChain([roomsById, 'access', _297 => _297.get, 'call', _298 => _298(roomId), 'optionalAccess', _299 => _299.room]);
11956
11970
  return room ? room : null;
11957
11971
  }
11958
11972
  function logout() {
@@ -11968,7 +11982,7 @@ function createClient(options) {
11968
11982
  const batchedResolveUsers = new Batch(
11969
11983
  async (batchedUserIds) => {
11970
11984
  const userIds = batchedUserIds.flat();
11971
- const users = await _optionalChain([resolveUsers, 'optionalCall', _299 => _299({ userIds })]);
11985
+ const users = await _optionalChain([resolveUsers, 'optionalCall', _300 => _300({ userIds })]);
11972
11986
  warnOnceIf(
11973
11987
  !resolveUsers,
11974
11988
  "Set the resolveUsers option in createClient to specify user info."
@@ -11985,7 +11999,7 @@ function createClient(options) {
11985
11999
  const batchedResolveRoomsInfo = new Batch(
11986
12000
  async (batchedRoomIds) => {
11987
12001
  const roomIds = batchedRoomIds.flat();
11988
- const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _300 => _300({ roomIds })]);
12002
+ const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _301 => _301({ roomIds })]);
11989
12003
  warnOnceIf(
11990
12004
  !resolveRoomsInfo,
11991
12005
  "Set the resolveRoomsInfo option in createClient to specify room info."
@@ -12002,7 +12016,7 @@ function createClient(options) {
12002
12016
  const batchedResolveGroupsInfo = new Batch(
12003
12017
  async (batchedGroupIds) => {
12004
12018
  const groupIds = batchedGroupIds.flat();
12005
- const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _301 => _301({ groupIds })]);
12019
+ const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _302 => _302({ groupIds })]);
12006
12020
  warnOnceIf(
12007
12021
  !resolveGroupsInfo,
12008
12022
  "Set the resolveGroupsInfo option in createClient to specify group info."
@@ -12061,7 +12075,7 @@ function createClient(options) {
12061
12075
  }
12062
12076
  };
12063
12077
  const win = typeof window !== "undefined" ? window : void 0;
12064
- _optionalChain([win, 'optionalAccess', _302 => _302.addEventListener, 'call', _303 => _303("beforeunload", maybePreventClose)]);
12078
+ _optionalChain([win, 'optionalAccess', _303 => _303.addEventListener, 'call', _304 => _304("beforeunload", maybePreventClose)]);
12065
12079
  }
12066
12080
  async function getNotificationSettings(options2) {
12067
12081
  const plainSettings = await httpClient.getNotificationSettings(options2);
@@ -12189,7 +12203,7 @@ var commentBodyElementsTypes = {
12189
12203
  mention: "inline"
12190
12204
  };
12191
12205
  function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
12192
- if (!body || !_optionalChain([body, 'optionalAccess', _304 => _304.content])) {
12206
+ if (!body || !_optionalChain([body, 'optionalAccess', _305 => _305.content])) {
12193
12207
  return;
12194
12208
  }
12195
12209
  const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
@@ -12199,13 +12213,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
12199
12213
  for (const block of body.content) {
12200
12214
  if (type === "all" || type === "block") {
12201
12215
  if (guard(block)) {
12202
- _optionalChain([visitor, 'optionalCall', _305 => _305(block)]);
12216
+ _optionalChain([visitor, 'optionalCall', _306 => _306(block)]);
12203
12217
  }
12204
12218
  }
12205
12219
  if (type === "all" || type === "inline") {
12206
12220
  for (const inline of block.children) {
12207
12221
  if (guard(inline)) {
12208
- _optionalChain([visitor, 'optionalCall', _306 => _306(inline)]);
12222
+ _optionalChain([visitor, 'optionalCall', _307 => _307(inline)]);
12209
12223
  }
12210
12224
  }
12211
12225
  }
@@ -12375,7 +12389,7 @@ var stringifyCommentBodyPlainElements = {
12375
12389
  text: ({ element }) => element.text,
12376
12390
  link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
12377
12391
  mention: ({ element, user, group }) => {
12378
- return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _307 => _307.name]), () => ( _optionalChain([group, 'optionalAccess', _308 => _308.name]))), () => ( element.id))}`;
12392
+ return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _308 => _308.name]), () => ( _optionalChain([group, 'optionalAccess', _309 => _309.name]))), () => ( element.id))}`;
12379
12393
  }
12380
12394
  };
12381
12395
  var stringifyCommentBodyHtmlElements = {
@@ -12405,7 +12419,7 @@ var stringifyCommentBodyHtmlElements = {
12405
12419
  return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
12406
12420
  },
12407
12421
  mention: ({ element, user, group }) => {
12408
- return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _309 => _309.name]) ? html`${_optionalChain([user, 'optionalAccess', _310 => _310.name])}` : _optionalChain([group, 'optionalAccess', _311 => _311.name]) ? html`${_optionalChain([group, 'optionalAccess', _312 => _312.name])}` : element.id}</span>`;
12422
+ return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _310 => _310.name]) ? html`${_optionalChain([user, 'optionalAccess', _311 => _311.name])}` : _optionalChain([group, 'optionalAccess', _312 => _312.name]) ? html`${_optionalChain([group, 'optionalAccess', _313 => _313.name])}` : element.id}</span>`;
12409
12423
  }
12410
12424
  };
12411
12425
  var stringifyCommentBodyMarkdownElements = {
@@ -12435,20 +12449,20 @@ var stringifyCommentBodyMarkdownElements = {
12435
12449
  return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
12436
12450
  },
12437
12451
  mention: ({ element, user, group }) => {
12438
- return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _313 => _313.name]), () => ( _optionalChain([group, 'optionalAccess', _314 => _314.name]))), () => ( element.id))}`;
12452
+ return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _314 => _314.name]), () => ( _optionalChain([group, 'optionalAccess', _315 => _315.name]))), () => ( element.id))}`;
12439
12453
  }
12440
12454
  };
12441
12455
  async function stringifyCommentBody(body, options) {
12442
- const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _315 => _315.format]), () => ( "plain"));
12443
- const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _316 => _316.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
12456
+ const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _316 => _316.format]), () => ( "plain"));
12457
+ const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _317 => _317.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
12444
12458
  const elements = {
12445
12459
  ...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
12446
- ..._optionalChain([options, 'optionalAccess', _317 => _317.elements])
12460
+ ..._optionalChain([options, 'optionalAccess', _318 => _318.elements])
12447
12461
  };
12448
12462
  const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInCommentBody(
12449
12463
  body,
12450
- _optionalChain([options, 'optionalAccess', _318 => _318.resolveUsers]),
12451
- _optionalChain([options, 'optionalAccess', _319 => _319.resolveGroupsInfo])
12464
+ _optionalChain([options, 'optionalAccess', _319 => _319.resolveUsers]),
12465
+ _optionalChain([options, 'optionalAccess', _320 => _320.resolveGroupsInfo])
12452
12466
  );
12453
12467
  const blocks = body.content.flatMap((block, blockIndex) => {
12454
12468
  switch (block.type) {
@@ -12583,9 +12597,9 @@ function makePoller(callback, intervalMs, options) {
12583
12597
  const startTime = performance.now();
12584
12598
  const doc = typeof document !== "undefined" ? document : void 0;
12585
12599
  const win = typeof window !== "undefined" ? window : void 0;
12586
- const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _320 => _320.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
12600
+ const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _321 => _321.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
12587
12601
  const context = {
12588
- inForeground: _optionalChain([doc, 'optionalAccess', _321 => _321.visibilityState]) !== "hidden",
12602
+ inForeground: _optionalChain([doc, 'optionalAccess', _322 => _322.visibilityState]) !== "hidden",
12589
12603
  lastSuccessfulPollAt: startTime,
12590
12604
  count: 0,
12591
12605
  backoff: 0
@@ -12666,11 +12680,11 @@ function makePoller(callback, intervalMs, options) {
12666
12680
  pollNowIfStale();
12667
12681
  }
12668
12682
  function onVisibilityChange() {
12669
- setInForeground(_optionalChain([doc, 'optionalAccess', _322 => _322.visibilityState]) !== "hidden");
12683
+ setInForeground(_optionalChain([doc, 'optionalAccess', _323 => _323.visibilityState]) !== "hidden");
12670
12684
  }
12671
- _optionalChain([doc, 'optionalAccess', _323 => _323.addEventListener, 'call', _324 => _324("visibilitychange", onVisibilityChange)]);
12672
- _optionalChain([win, 'optionalAccess', _325 => _325.addEventListener, 'call', _326 => _326("online", onVisibilityChange)]);
12673
- _optionalChain([win, 'optionalAccess', _327 => _327.addEventListener, 'call', _328 => _328("focus", pollNowIfStale)]);
12685
+ _optionalChain([doc, 'optionalAccess', _324 => _324.addEventListener, 'call', _325 => _325("visibilitychange", onVisibilityChange)]);
12686
+ _optionalChain([win, 'optionalAccess', _326 => _326.addEventListener, 'call', _327 => _327("online", onVisibilityChange)]);
12687
+ _optionalChain([win, 'optionalAccess', _328 => _328.addEventListener, 'call', _329 => _329("focus", pollNowIfStale)]);
12674
12688
  fsm.start();
12675
12689
  return {
12676
12690
  inc,