@liveblocks/core 2.11.1 → 2.12.0-rc1

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.js 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 = "2.11.1";
9
+ var PKG_VERSION = "2.12.0-rc1";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -2444,6 +2444,84 @@ function createNotificationsApi({
2444
2444
  };
2445
2445
  }
2446
2446
 
2447
+ // src/lib/freeze.ts
2448
+ var freeze = process.env.NODE_ENV === "production" ? (
2449
+ /* istanbul ignore next */
2450
+ (x) => x
2451
+ ) : Object.freeze;
2452
+
2453
+ // src/refs/ImmutableRef.ts
2454
+ function merge(target, patch) {
2455
+ let updated = false;
2456
+ const newValue = { ...target };
2457
+ Object.keys(patch).forEach((k) => {
2458
+ const key = k;
2459
+ const val = patch[key];
2460
+ if (newValue[key] !== val) {
2461
+ if (val === void 0) {
2462
+ delete newValue[key];
2463
+ } else {
2464
+ newValue[key] = val;
2465
+ }
2466
+ updated = true;
2467
+ }
2468
+ });
2469
+ return updated ? newValue : target;
2470
+ }
2471
+ var ImmutableRef = class {
2472
+ constructor() {
2473
+ this._ev = makeEventSource();
2474
+ }
2475
+ get didInvalidate() {
2476
+ return this._ev.observable;
2477
+ }
2478
+ invalidate() {
2479
+ if (this._cache !== null) {
2480
+ this._cache = null;
2481
+ this._ev.notify();
2482
+ }
2483
+ }
2484
+ get current() {
2485
+ return _nullishCoalesce(this._cache, () => ( (this._cache = this._toImmutable())));
2486
+ }
2487
+ };
2488
+
2489
+ // src/refs/ValueRef.ts
2490
+ var ValueRef = class extends ImmutableRef {
2491
+ constructor(initialValue) {
2492
+ super();
2493
+ this._value = freeze(initialValue);
2494
+ }
2495
+ /** @internal */
2496
+ _toImmutable() {
2497
+ return this._value;
2498
+ }
2499
+ set(newValue) {
2500
+ if (this._value !== newValue) {
2501
+ this._value = freeze(newValue);
2502
+ this.invalidate();
2503
+ }
2504
+ }
2505
+ };
2506
+ var DerivedRef = class extends ImmutableRef {
2507
+ constructor(...args) {
2508
+ super();
2509
+ const transformFn = args.pop();
2510
+ const otherRefs = args;
2511
+ this._refs = otherRefs;
2512
+ this._refs.forEach((ref) => {
2513
+ ref.didInvalidate.subscribe(() => this.invalidate());
2514
+ });
2515
+ this._transform = transformFn;
2516
+ }
2517
+ /** @internal */
2518
+ _toImmutable() {
2519
+ return this._transform(
2520
+ ...this._refs.map((ref) => ref.current)
2521
+ );
2522
+ }
2523
+ };
2524
+
2447
2525
  // src/lib/position.ts
2448
2526
  var MIN_CODE = 32;
2449
2527
  var MAX_CODE = 126;
@@ -3878,12 +3956,6 @@ function HACK_addIntentAndDeletedIdToOperation(ops, deletedId) {
3878
3956
  });
3879
3957
  }
3880
3958
 
3881
- // src/lib/freeze.ts
3882
- var freeze = process.env.NODE_ENV === "production" ? (
3883
- /* istanbul ignore next */
3884
- (x) => x
3885
- ) : Object.freeze;
3886
-
3887
3959
  // src/crdts/LiveMap.ts
3888
3960
  var LiveMap = class _LiveMap extends AbstractCrdt {
3889
3961
  constructor(entries2) {
@@ -5172,42 +5244,6 @@ var ClientMsgCode = /* @__PURE__ */ ((ClientMsgCode2) => {
5172
5244
  return ClientMsgCode2;
5173
5245
  })(ClientMsgCode || {});
5174
5246
 
5175
- // src/refs/ImmutableRef.ts
5176
- function merge(target, patch) {
5177
- let updated = false;
5178
- const newValue = { ...target };
5179
- Object.keys(patch).forEach((k) => {
5180
- const key = k;
5181
- const val = patch[key];
5182
- if (newValue[key] !== val) {
5183
- if (val === void 0) {
5184
- delete newValue[key];
5185
- } else {
5186
- newValue[key] = val;
5187
- }
5188
- updated = true;
5189
- }
5190
- });
5191
- return updated ? newValue : target;
5192
- }
5193
- var ImmutableRef = class {
5194
- constructor() {
5195
- this._ev = makeEventSource();
5196
- }
5197
- get didInvalidate() {
5198
- return this._ev.observable;
5199
- }
5200
- invalidate() {
5201
- if (this._cache !== void 0) {
5202
- this._cache = void 0;
5203
- this._ev.notify();
5204
- }
5205
- }
5206
- get current() {
5207
- return _nullishCoalesce(this._cache, () => ( (this._cache = this._toImmutable())));
5208
- }
5209
- };
5210
-
5211
5247
  // src/refs/OthersRef.ts
5212
5248
  function makeUser(conn, presence) {
5213
5249
  const { connectionId, id, info } = conn;
@@ -5359,40 +5395,6 @@ var PatchableRef = class extends ImmutableRef {
5359
5395
  }
5360
5396
  };
5361
5397
 
5362
- // src/refs/ValueRef.ts
5363
- var ValueRef = class extends ImmutableRef {
5364
- constructor(initialValue) {
5365
- super();
5366
- this._value = freeze(initialValue);
5367
- }
5368
- /** @internal */
5369
- _toImmutable() {
5370
- return this._value;
5371
- }
5372
- set(newValue) {
5373
- this._value = freeze(newValue);
5374
- this.invalidate();
5375
- }
5376
- };
5377
- var DerivedRef = class extends ImmutableRef {
5378
- constructor(...args) {
5379
- super();
5380
- const transformFn = args.pop();
5381
- const otherRefs = args;
5382
- this._refs = otherRefs;
5383
- this._refs.forEach((ref) => {
5384
- ref.didInvalidate.subscribe(() => this.invalidate());
5385
- });
5386
- this._transform = transformFn;
5387
- }
5388
- /** @internal */
5389
- _toImmutable() {
5390
- return this._transform(
5391
- ...this._refs.map((ref) => ref.current)
5392
- );
5393
- }
5394
- };
5395
-
5396
5398
  // src/room.ts
5397
5399
  var MAX_SOCKET_MESSAGE_SIZE = 1024 * 1024 - 1024;
5398
5400
  function makeIdFactory(connectionId) {
@@ -5500,9 +5502,9 @@ function createRoom(options, config) {
5500
5502
  others: new OthersRef(),
5501
5503
  initialStorage,
5502
5504
  idFactory: null,
5503
- // Y.js
5504
- provider: void 0,
5505
- onProviderUpdate: makeEventSource(),
5505
+ // The Yjs provider associated to this room
5506
+ yjsProvider: void 0,
5507
+ yjsProviderDidChange: makeEventSource(),
5506
5508
  // Storage
5507
5509
  clock: 0,
5508
5510
  opClock: 0,
@@ -6516,6 +6518,7 @@ ${Array.from(traces).join("\n\n")}`
6516
6518
  _addToRealUndoStack(historyOps, batchUpdates);
6517
6519
  }
6518
6520
  }
6521
+ const syncSourceForStorage = config.createSyncSource();
6519
6522
  function getStorageStatus() {
6520
6523
  if (context.root === void 0) {
6521
6524
  return _getStorage$ === null ? "not-loaded" : "loading";
@@ -6530,6 +6533,9 @@ ${Array.from(traces).join("\n\n")}`
6530
6533
  _lastStorageStatus = storageStatus;
6531
6534
  eventHub.storageStatus.notify(storageStatus);
6532
6535
  }
6536
+ syncSourceForStorage.setSyncStatus(
6537
+ storageStatus === "synchronizing" ? "synchronizing" : "synchronized"
6538
+ );
6533
6539
  }
6534
6540
  function isPresenceReady() {
6535
6541
  return self.current !== null;
@@ -6919,6 +6925,12 @@ ${Array.from(traces).join("\n\n")}`
6919
6925
  async function markInboxNotificationAsRead(inboxNotificationId) {
6920
6926
  await batchedMarkInboxNotificationsAsRead.get(inboxNotificationId);
6921
6927
  }
6928
+ const syncSourceForYjs = config.createSyncSource();
6929
+ function yjsStatusDidChange(status) {
6930
+ return syncSourceForYjs.setSyncStatus(
6931
+ status === "synchronizing" ? "synchronizing" : "synchronized"
6932
+ );
6933
+ }
6922
6934
  return Object.defineProperty(
6923
6935
  {
6924
6936
  [kInternal]: {
@@ -6934,14 +6946,16 @@ ${Array.from(traces).join("\n\n")}`
6934
6946
  return context.nodes.size;
6935
6947
  },
6936
6948
  // prettier-ignore
6937
- getProvider() {
6938
- return context.provider;
6949
+ getYjsProvider() {
6950
+ return context.yjsProvider;
6939
6951
  },
6940
- setProvider(provider) {
6941
- context.provider = provider;
6942
- context.onProviderUpdate.notify();
6952
+ setYjsProvider(newProvider) {
6953
+ _optionalChain([context, 'access', _155 => _155.yjsProvider, 'optionalAccess', _156 => _156.off, 'call', _157 => _157("status", yjsStatusDidChange)]);
6954
+ context.yjsProvider = newProvider;
6955
+ _optionalChain([newProvider, 'optionalAccess', _158 => _158.on, 'call', _159 => _159("status", yjsStatusDidChange)]);
6956
+ context.yjsProviderDidChange.notify();
6943
6957
  },
6944
- onProviderUpdate: context.onProviderUpdate.observable,
6958
+ yjsProviderDidChange: context.yjsProviderDidChange.observable,
6945
6959
  // send metadata when using a text editor
6946
6960
  reportTextEditor,
6947
6961
  // create a text mention when using a text editor
@@ -6973,6 +6987,9 @@ ${Array.from(traces).join("\n\n")}`
6973
6987
  reconnect: () => managedSocket.reconnect(),
6974
6988
  disconnect: () => managedSocket.disconnect(),
6975
6989
  destroy: () => {
6990
+ syncSourceForStorage.destroy();
6991
+ _optionalChain([context, 'access', _160 => _160.yjsProvider, 'optionalAccess', _161 => _161.off, 'call', _162 => _162("status", yjsStatusDidChange)]);
6992
+ syncSourceForYjs.destroy();
6976
6993
  uninstallBgTabSpy();
6977
6994
  managedSocket.destroy();
6978
6995
  },
@@ -7109,7 +7126,7 @@ function makeClassicSubscribeFn(events) {
7109
7126
  }
7110
7127
  if (isLiveNode(first)) {
7111
7128
  const node = first;
7112
- if (_optionalChain([options, 'optionalAccess', _155 => _155.isDeep])) {
7129
+ if (_optionalChain([options, 'optionalAccess', _163 => _163.isDeep])) {
7113
7130
  const storageCallback = second;
7114
7131
  return subscribeToLiveStructureDeeply(node, storageCallback);
7115
7132
  } else {
@@ -7229,15 +7246,16 @@ function createClient(options) {
7229
7246
  createSocket: makeCreateSocketDelegateForRoom(
7230
7247
  roomId,
7231
7248
  baseUrl,
7232
- _optionalChain([clientOptions, 'access', _156 => _156.polyfills, 'optionalAccess', _157 => _157.WebSocket])
7249
+ _optionalChain([clientOptions, 'access', _164 => _164.polyfills, 'optionalAccess', _165 => _165.WebSocket])
7233
7250
  ),
7234
7251
  authenticate: makeAuthDelegateForRoom(roomId, authManager)
7235
7252
  })),
7236
7253
  enableDebugLogging: clientOptions.enableDebugLogging,
7237
- unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess', _158 => _158.unstable_batchedUpdates]),
7254
+ unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess', _166 => _166.unstable_batchedUpdates]),
7238
7255
  baseUrl,
7239
7256
  unstable_fallbackToHTTP: !!clientOptions.unstable_fallbackToHTTP,
7240
- unstable_streamData: !!clientOptions.unstable_streamData
7257
+ unstable_streamData: !!clientOptions.unstable_streamData,
7258
+ createSyncSource
7241
7259
  }
7242
7260
  );
7243
7261
  const newRoomDetails = {
@@ -7250,7 +7268,7 @@ function createClient(options) {
7250
7268
  const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
7251
7269
  if (shouldConnect) {
7252
7270
  if (typeof atob === "undefined") {
7253
- if (_optionalChain([clientOptions, 'access', _159 => _159.polyfills, 'optionalAccess', _160 => _160.atob]) === void 0) {
7271
+ if (_optionalChain([clientOptions, 'access', _167 => _167.polyfills, 'optionalAccess', _168 => _168.atob]) === void 0) {
7254
7272
  throw new Error(
7255
7273
  "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"
7256
7274
  );
@@ -7262,7 +7280,7 @@ function createClient(options) {
7262
7280
  return leaseRoom(newRoomDetails);
7263
7281
  }
7264
7282
  function getRoom(roomId) {
7265
- const room = _optionalChain([roomsById, 'access', _161 => _161.get, 'call', _162 => _162(roomId), 'optionalAccess', _163 => _163.room]);
7283
+ const room = _optionalChain([roomsById, 'access', _169 => _169.get, 'call', _170 => _170(roomId), 'optionalAccess', _171 => _171.room]);
7266
7284
  return room ? room : null;
7267
7285
  }
7268
7286
  function logout() {
@@ -7274,8 +7292,8 @@ function createClient(options) {
7274
7292
  }
7275
7293
  }
7276
7294
  const currentUserIdStore = createStore(null);
7277
- const fetchPolyfill = _optionalChain([clientOptions, 'access', _164 => _164.polyfills, 'optionalAccess', _165 => _165.fetch]) || /* istanbul ignore next */
7278
- _optionalChain([globalThis, 'access', _166 => _166.fetch, 'optionalAccess', _167 => _167.bind, 'call', _168 => _168(globalThis)]);
7295
+ const fetchPolyfill = _optionalChain([clientOptions, 'access', _172 => _172.polyfills, 'optionalAccess', _173 => _173.fetch]) || /* istanbul ignore next */
7296
+ _optionalChain([globalThis, 'access', _174 => _174.fetch, 'optionalAccess', _175 => _175.bind, 'call', _176 => _176(globalThis)]);
7279
7297
  const notificationsAPI = createNotificationsApi({
7280
7298
  baseUrl,
7281
7299
  fetchPolyfill,
@@ -7290,7 +7308,7 @@ function createClient(options) {
7290
7308
  const batchedResolveUsers = new Batch(
7291
7309
  async (batchedUserIds) => {
7292
7310
  const userIds = batchedUserIds.flat();
7293
- const users = await _optionalChain([resolveUsers, 'optionalCall', _169 => _169({ userIds })]);
7311
+ const users = await _optionalChain([resolveUsers, 'optionalCall', _177 => _177({ userIds })]);
7294
7312
  warnIfNoResolveUsers();
7295
7313
  return _nullishCoalesce(users, () => ( userIds.map(() => void 0)));
7296
7314
  },
@@ -7308,7 +7326,7 @@ function createClient(options) {
7308
7326
  const batchedResolveRoomsInfo = new Batch(
7309
7327
  async (batchedRoomIds) => {
7310
7328
  const roomIds = batchedRoomIds.flat();
7311
- const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _170 => _170({ roomIds })]);
7329
+ const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _178 => _178({ roomIds })]);
7312
7330
  warnIfNoResolveRoomsInfo();
7313
7331
  return _nullishCoalesce(roomsInfo, () => ( roomIds.map(() => void 0)));
7314
7332
  },
@@ -7322,6 +7340,46 @@ function createClient(options) {
7322
7340
  function invalidateResolvedMentionSuggestions() {
7323
7341
  mentionSuggestionsCache.clear();
7324
7342
  }
7343
+ const syncStatusSources = [];
7344
+ const syncStatusRef = new ValueRef("synchronized");
7345
+ function getSyncStatus() {
7346
+ const status = syncStatusRef.current;
7347
+ return status === "synchronizing" ? status : "synchronized";
7348
+ }
7349
+ function recompute() {
7350
+ syncStatusRef.set(
7351
+ syncStatusSources.some((src) => src.current === "synchronizing") ? "synchronizing" : syncStatusSources.some((src) => src.current === "has-local-changes") ? "has-local-changes" : "synchronized"
7352
+ );
7353
+ }
7354
+ function createSyncSource() {
7355
+ const source = new ValueRef("synchronized");
7356
+ syncStatusSources.push(source);
7357
+ const unsub = source.didInvalidate.subscribe(() => recompute());
7358
+ function setSyncStatus(status) {
7359
+ source.set(status);
7360
+ }
7361
+ function destroy() {
7362
+ unsub();
7363
+ const index = syncStatusSources.findIndex((item) => item === source);
7364
+ if (index > -1) {
7365
+ const [ref] = syncStatusSources.splice(index, 1);
7366
+ const wasStillPending = ref.current !== "synchronized";
7367
+ if (wasStillPending) {
7368
+ recompute();
7369
+ }
7370
+ }
7371
+ }
7372
+ return { setSyncStatus, destroy };
7373
+ }
7374
+ {
7375
+ const maybePreventClose = (e) => {
7376
+ if (clientOptions.preventUnsavedChanges && syncStatusRef.current !== "synchronized") {
7377
+ e.preventDefault();
7378
+ }
7379
+ };
7380
+ const win = typeof window !== "undefined" ? window : void 0;
7381
+ _optionalChain([win, 'optionalAccess', _179 => _179.addEventListener, 'call', _180 => _180("beforeunload", maybePreventClose)]);
7382
+ }
7325
7383
  const client = Object.defineProperty(
7326
7384
  {
7327
7385
  enterRoom,
@@ -7334,6 +7392,10 @@ function createClient(options) {
7334
7392
  invalidateRoomsInfo: invalidateResolvedRoomsInfo,
7335
7393
  invalidateMentionSuggestions: invalidateResolvedMentionSuggestions
7336
7394
  },
7395
+ getSyncStatus,
7396
+ events: {
7397
+ syncStatus: syncStatusRef.didInvalidate
7398
+ },
7337
7399
  // Internal
7338
7400
  [kInternal]: {
7339
7401
  currentUserIdStore,
@@ -7348,7 +7410,8 @@ function createClient(options) {
7348
7410
  getUserThreads_experimental: notificationsAPI.getUserThreads_experimental,
7349
7411
  getUserThreadsSince_experimental: notificationsAPI.getUserThreadsSince_experimental,
7350
7412
  // Type-level helper only, it's effectively only an identity-function at runtime
7351
- as: () => client
7413
+ as: () => client,
7414
+ createSyncSource
7352
7415
  }
7353
7416
  },
7354
7417
  kInternal,
@@ -7427,7 +7490,7 @@ var commentBodyElementsTypes = {
7427
7490
  mention: "inline"
7428
7491
  };
7429
7492
  function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
7430
- if (!body || !_optionalChain([body, 'optionalAccess', _171 => _171.content])) {
7493
+ if (!body || !_optionalChain([body, 'optionalAccess', _181 => _181.content])) {
7431
7494
  return;
7432
7495
  }
7433
7496
  const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
@@ -7437,13 +7500,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
7437
7500
  for (const block of body.content) {
7438
7501
  if (type === "all" || type === "block") {
7439
7502
  if (guard(block)) {
7440
- _optionalChain([visitor, 'optionalCall', _172 => _172(block)]);
7503
+ _optionalChain([visitor, 'optionalCall', _182 => _182(block)]);
7441
7504
  }
7442
7505
  }
7443
7506
  if (type === "all" || type === "inline") {
7444
7507
  for (const inline of block.children) {
7445
7508
  if (guard(inline)) {
7446
- _optionalChain([visitor, 'optionalCall', _173 => _173(inline)]);
7509
+ _optionalChain([visitor, 'optionalCall', _183 => _183(inline)]);
7447
7510
  }
7448
7511
  }
7449
7512
  }
@@ -7468,7 +7531,7 @@ async function resolveUsersInCommentBody(body, resolveUsers) {
7468
7531
  userIds
7469
7532
  });
7470
7533
  for (const [index, userId] of userIds.entries()) {
7471
- const user = _optionalChain([users, 'optionalAccess', _174 => _174[index]]);
7534
+ const user = _optionalChain([users, 'optionalAccess', _184 => _184[index]]);
7472
7535
  if (user) {
7473
7536
  resolvedUsers.set(userId, user);
7474
7537
  }
@@ -7591,7 +7654,7 @@ var stringifyCommentBodyPlainElements = {
7591
7654
  text: ({ element }) => element.text,
7592
7655
  link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
7593
7656
  mention: ({ element, user }) => {
7594
- return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _175 => _175.name]), () => ( element.id))}`;
7657
+ return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _185 => _185.name]), () => ( element.id))}`;
7595
7658
  }
7596
7659
  };
7597
7660
  var stringifyCommentBodyHtmlElements = {
@@ -7621,7 +7684,7 @@ var stringifyCommentBodyHtmlElements = {
7621
7684
  return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${_nullishCoalesce(element.text, () => ( element.url))}</a>`;
7622
7685
  },
7623
7686
  mention: ({ element, user }) => {
7624
- return html`<span data-mention>@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _176 => _176.name]), () => ( element.id))}</span>`;
7687
+ return html`<span data-mention>@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _186 => _186.name]), () => ( element.id))}</span>`;
7625
7688
  }
7626
7689
  };
7627
7690
  var stringifyCommentBodyMarkdownElements = {
@@ -7651,19 +7714,19 @@ var stringifyCommentBodyMarkdownElements = {
7651
7714
  return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
7652
7715
  },
7653
7716
  mention: ({ element, user }) => {
7654
- return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _177 => _177.name]), () => ( element.id))}`;
7717
+ return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _187 => _187.name]), () => ( element.id))}`;
7655
7718
  }
7656
7719
  };
7657
7720
  async function stringifyCommentBody(body, options) {
7658
- const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _178 => _178.format]), () => ( "plain"));
7659
- const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _179 => _179.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
7721
+ const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _188 => _188.format]), () => ( "plain"));
7722
+ const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _189 => _189.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
7660
7723
  const elements = {
7661
7724
  ...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
7662
- ..._optionalChain([options, 'optionalAccess', _180 => _180.elements])
7725
+ ..._optionalChain([options, 'optionalAccess', _190 => _190.elements])
7663
7726
  };
7664
7727
  const resolvedUsers = await resolveUsersInCommentBody(
7665
7728
  body,
7666
- _optionalChain([options, 'optionalAccess', _181 => _181.resolveUsers])
7729
+ _optionalChain([options, 'optionalAccess', _191 => _191.resolveUsers])
7667
7730
  );
7668
7731
  const blocks = body.content.flatMap((block, blockIndex) => {
7669
7732
  switch (block.type) {
@@ -7954,12 +8017,12 @@ function legacy_patchImmutableNode(state, path, update) {
7954
8017
  }
7955
8018
  const newState = Object.assign({}, state);
7956
8019
  for (const key in update.updates) {
7957
- if (_optionalChain([update, 'access', _182 => _182.updates, 'access', _183 => _183[key], 'optionalAccess', _184 => _184.type]) === "update") {
8020
+ if (_optionalChain([update, 'access', _192 => _192.updates, 'access', _193 => _193[key], 'optionalAccess', _194 => _194.type]) === "update") {
7958
8021
  const val = update.node.get(key);
7959
8022
  if (val !== void 0) {
7960
8023
  newState[key] = lsonToJson(val);
7961
8024
  }
7962
- } else if (_optionalChain([update, 'access', _185 => _185.updates, 'access', _186 => _186[key], 'optionalAccess', _187 => _187.type]) === "delete") {
8025
+ } else if (_optionalChain([update, 'access', _195 => _195.updates, 'access', _196 => _196[key], 'optionalAccess', _197 => _197.type]) === "delete") {
7963
8026
  delete newState[key];
7964
8027
  }
7965
8028
  }
@@ -8020,12 +8083,12 @@ function legacy_patchImmutableNode(state, path, update) {
8020
8083
  }
8021
8084
  const newState = Object.assign({}, state);
8022
8085
  for (const key in update.updates) {
8023
- if (_optionalChain([update, 'access', _188 => _188.updates, 'access', _189 => _189[key], 'optionalAccess', _190 => _190.type]) === "update") {
8086
+ if (_optionalChain([update, 'access', _198 => _198.updates, 'access', _199 => _199[key], 'optionalAccess', _200 => _200.type]) === "update") {
8024
8087
  const value = update.node.get(key);
8025
8088
  if (value !== void 0) {
8026
8089
  newState[key] = lsonToJson(value);
8027
8090
  }
8028
- } else if (_optionalChain([update, 'access', _191 => _191.updates, 'access', _192 => _192[key], 'optionalAccess', _193 => _193.type]) === "delete") {
8091
+ } else if (_optionalChain([update, 'access', _201 => _201.updates, 'access', _202 => _202[key], 'optionalAccess', _203 => _203.type]) === "delete") {
8029
8092
  delete newState[key];
8030
8093
  }
8031
8094
  }
@@ -8096,9 +8159,9 @@ function makePoller(callback, intervalMs, options) {
8096
8159
  const startTime = performance.now();
8097
8160
  const doc = typeof document !== "undefined" ? document : void 0;
8098
8161
  const win = typeof window !== "undefined" ? window : void 0;
8099
- const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _194 => _194.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
8162
+ const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _204 => _204.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
8100
8163
  const context = {
8101
- inForeground: _optionalChain([doc, 'optionalAccess', _195 => _195.visibilityState]) !== "hidden",
8164
+ inForeground: _optionalChain([doc, 'optionalAccess', _205 => _205.visibilityState]) !== "hidden",
8102
8165
  lastSuccessfulPollAt: startTime,
8103
8166
  count: 0,
8104
8167
  backoff: 0
@@ -8176,10 +8239,10 @@ function makePoller(callback, intervalMs, options) {
8176
8239
  pollNowIfStale();
8177
8240
  }
8178
8241
  function onVisibilityChange() {
8179
- setInForeground(_optionalChain([doc, 'optionalAccess', _196 => _196.visibilityState]) !== "hidden");
8242
+ setInForeground(_optionalChain([doc, 'optionalAccess', _206 => _206.visibilityState]) !== "hidden");
8180
8243
  }
8181
- _optionalChain([doc, 'optionalAccess', _197 => _197.addEventListener, 'call', _198 => _198("visibilitychange", onVisibilityChange)]);
8182
- _optionalChain([win, 'optionalAccess', _199 => _199.addEventListener, 'call', _200 => _200("online", onVisibilityChange)]);
8244
+ _optionalChain([doc, 'optionalAccess', _207 => _207.addEventListener, 'call', _208 => _208("visibilitychange", onVisibilityChange)]);
8245
+ _optionalChain([win, 'optionalAccess', _209 => _209.addEventListener, 'call', _210 => _210("online", onVisibilityChange)]);
8183
8246
  fsm.start();
8184
8247
  return {
8185
8248
  inc,