@liveblocks/core 3.8.0-next3 → 3.8.0-tiptap1

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.8.0-next3";
9
+ var PKG_VERSION = "3.8.0-tiptap1";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -2212,16 +2212,10 @@ function createApiClient({
2212
2212
  requestedAt: new Date(json.meta.requestedAt)
2213
2213
  };
2214
2214
  }
2215
- async function getUnreadInboxNotificationsCount(options) {
2216
- let query;
2217
- if (_optionalChain([options, 'optionalAccess', _23 => _23.query])) {
2218
- query = objectToQuery(options.query);
2219
- }
2215
+ async function getUnreadInboxNotificationsCount() {
2220
2216
  const { count } = await httpClient.get(
2221
2217
  url`/v2/c/inbox-notifications/count`,
2222
- await authManager.getAuthValue({ requestedScope: "comments:read" }),
2223
- { query },
2224
- { signal: _optionalChain([options, 'optionalAccess', _24 => _24.signal]) }
2218
+ await authManager.getAuthValue({ requestedScope: "comments:read" })
2225
2219
  );
2226
2220
  return count;
2227
2221
  }
@@ -2271,7 +2265,7 @@ function createApiClient({
2271
2265
  url`/v2/c/notification-settings`,
2272
2266
  await authManager.getAuthValue({ requestedScope: "comments:read" }),
2273
2267
  void 0,
2274
- { signal: _optionalChain([options, 'optionalAccess', _25 => _25.signal]) }
2268
+ { signal: _optionalChain([options, 'optionalAccess', _23 => _23.signal]) }
2275
2269
  );
2276
2270
  }
2277
2271
  async function updateNotificationSettings(settings) {
@@ -2283,7 +2277,7 @@ function createApiClient({
2283
2277
  }
2284
2278
  async function getUserThreads_experimental(options) {
2285
2279
  let query;
2286
- if (_optionalChain([options, 'optionalAccess', _26 => _26.query])) {
2280
+ if (_optionalChain([options, 'optionalAccess', _24 => _24.query])) {
2287
2281
  query = objectToQuery(options.query);
2288
2282
  }
2289
2283
  const PAGE_SIZE = 50;
@@ -2291,7 +2285,7 @@ function createApiClient({
2291
2285
  url`/v2/c/threads`,
2292
2286
  await authManager.getAuthValue({ requestedScope: "comments:read" }),
2293
2287
  {
2294
- cursor: _optionalChain([options, 'optionalAccess', _27 => _27.cursor]),
2288
+ cursor: _optionalChain([options, 'optionalAccess', _25 => _25.cursor]),
2295
2289
  query,
2296
2290
  limit: PAGE_SIZE
2297
2291
  }
@@ -2456,7 +2450,7 @@ var HttpClient = class {
2456
2450
  // These headers are default, but can be overriden by custom headers
2457
2451
  "Content-Type": "application/json; charset=utf-8",
2458
2452
  // Possible header overrides
2459
- ..._optionalChain([options, 'optionalAccess', _28 => _28.headers]),
2453
+ ..._optionalChain([options, 'optionalAccess', _26 => _26.headers]),
2460
2454
  // Cannot be overriden by custom headers
2461
2455
  Authorization: `Bearer ${getBearerTokenFromAuthValue(authValue)}`,
2462
2456
  "X-LB-Client": PKG_VERSION || "dev"
@@ -2913,7 +2907,7 @@ var FSM = class {
2913
2907
  });
2914
2908
  }
2915
2909
  #getTargetFn(eventName) {
2916
- return _optionalChain([this, 'access', _29 => _29.#allowedTransitions, 'access', _30 => _30.get, 'call', _31 => _31(this.currentState), 'optionalAccess', _32 => _32.get, 'call', _33 => _33(eventName)]);
2910
+ return _optionalChain([this, 'access', _27 => _27.#allowedTransitions, 'access', _28 => _28.get, 'call', _29 => _29(this.currentState), 'optionalAccess', _30 => _30.get, 'call', _31 => _31(eventName)]);
2917
2911
  }
2918
2912
  /**
2919
2913
  * Exits the current state, and executes any necessary cleanup functions.
@@ -2930,7 +2924,7 @@ var FSM = class {
2930
2924
  this.#currentContext.allowPatching((patchableContext) => {
2931
2925
  levels = _nullishCoalesce(levels, () => ( this.#cleanupStack.length));
2932
2926
  for (let i = 0; i < levels; i++) {
2933
- _optionalChain([this, 'access', _34 => _34.#cleanupStack, 'access', _35 => _35.pop, 'call', _36 => _36(), 'optionalCall', _37 => _37(patchableContext)]);
2927
+ _optionalChain([this, 'access', _32 => _32.#cleanupStack, 'access', _33 => _33.pop, 'call', _34 => _34(), 'optionalCall', _35 => _35(patchableContext)]);
2934
2928
  }
2935
2929
  });
2936
2930
  }
@@ -2946,7 +2940,7 @@ var FSM = class {
2946
2940
  this.#currentContext.allowPatching((patchableContext) => {
2947
2941
  for (const pattern of enterPatterns) {
2948
2942
  const enterFn = this.#enterFns.get(pattern);
2949
- const cleanupFn = _optionalChain([enterFn, 'optionalCall', _38 => _38(patchableContext)]);
2943
+ const cleanupFn = _optionalChain([enterFn, 'optionalCall', _36 => _36(patchableContext)]);
2950
2944
  if (typeof cleanupFn === "function") {
2951
2945
  this.#cleanupStack.push(cleanupFn);
2952
2946
  } else {
@@ -3340,7 +3334,7 @@ function createConnectionStateMachine(delegates, options) {
3340
3334
  }
3341
3335
  function waitForActorId(event) {
3342
3336
  const serverMsg = tryParseJson(event.data);
3343
- if (_optionalChain([serverMsg, 'optionalAccess', _39 => _39.type]) === 104 /* ROOM_STATE */) {
3337
+ if (_optionalChain([serverMsg, 'optionalAccess', _37 => _37.type]) === 104 /* ROOM_STATE */) {
3344
3338
  didReceiveActor();
3345
3339
  }
3346
3340
  }
@@ -3449,12 +3443,12 @@ function createConnectionStateMachine(delegates, options) {
3449
3443
  const sendHeartbeat = {
3450
3444
  target: "@ok.awaiting-pong",
3451
3445
  effect: (ctx) => {
3452
- _optionalChain([ctx, 'access', _40 => _40.socket, 'optionalAccess', _41 => _41.send, 'call', _42 => _42("ping")]);
3446
+ _optionalChain([ctx, 'access', _38 => _38.socket, 'optionalAccess', _39 => _39.send, 'call', _40 => _40("ping")]);
3453
3447
  }
3454
3448
  };
3455
3449
  const maybeHeartbeat = () => {
3456
3450
  const doc = typeof document !== "undefined" ? document : void 0;
3457
- const canZombie = _optionalChain([doc, 'optionalAccess', _43 => _43.visibilityState]) === "hidden" && delegates.canZombie();
3451
+ const canZombie = _optionalChain([doc, 'optionalAccess', _41 => _41.visibilityState]) === "hidden" && delegates.canZombie();
3458
3452
  return canZombie ? "@idle.zombie" : sendHeartbeat;
3459
3453
  };
3460
3454
  machine.addTimedTransition("@ok.connected", HEARTBEAT_INTERVAL, maybeHeartbeat).addTransitions("@ok.connected", {
@@ -3493,7 +3487,7 @@ function createConnectionStateMachine(delegates, options) {
3493
3487
  // socket, or not. So always check to see if the socket is still OPEN or
3494
3488
  // not. When still OPEN, don't transition.
3495
3489
  EXPLICIT_SOCKET_ERROR: (_, context) => {
3496
- if (_optionalChain([context, 'access', _44 => _44.socket, 'optionalAccess', _45 => _45.readyState]) === 1) {
3490
+ if (_optionalChain([context, 'access', _42 => _42.socket, 'optionalAccess', _43 => _43.readyState]) === 1) {
3497
3491
  return null;
3498
3492
  }
3499
3493
  return {
@@ -3545,17 +3539,17 @@ function createConnectionStateMachine(delegates, options) {
3545
3539
  machine.send({ type: "NAVIGATOR_ONLINE" });
3546
3540
  }
3547
3541
  function onVisibilityChange() {
3548
- if (_optionalChain([doc, 'optionalAccess', _46 => _46.visibilityState]) === "visible") {
3542
+ if (_optionalChain([doc, 'optionalAccess', _44 => _44.visibilityState]) === "visible") {
3549
3543
  machine.send({ type: "WINDOW_GOT_FOCUS" });
3550
3544
  }
3551
3545
  }
3552
- _optionalChain([win, 'optionalAccess', _47 => _47.addEventListener, 'call', _48 => _48("online", onNetworkBackOnline)]);
3553
- _optionalChain([win, 'optionalAccess', _49 => _49.addEventListener, 'call', _50 => _50("offline", onNetworkOffline)]);
3554
- _optionalChain([root, 'optionalAccess', _51 => _51.addEventListener, 'call', _52 => _52("visibilitychange", onVisibilityChange)]);
3546
+ _optionalChain([win, 'optionalAccess', _45 => _45.addEventListener, 'call', _46 => _46("online", onNetworkBackOnline)]);
3547
+ _optionalChain([win, 'optionalAccess', _47 => _47.addEventListener, 'call', _48 => _48("offline", onNetworkOffline)]);
3548
+ _optionalChain([root, 'optionalAccess', _49 => _49.addEventListener, 'call', _50 => _50("visibilitychange", onVisibilityChange)]);
3555
3549
  return () => {
3556
- _optionalChain([root, 'optionalAccess', _53 => _53.removeEventListener, 'call', _54 => _54("visibilitychange", onVisibilityChange)]);
3557
- _optionalChain([win, 'optionalAccess', _55 => _55.removeEventListener, 'call', _56 => _56("online", onNetworkBackOnline)]);
3558
- _optionalChain([win, 'optionalAccess', _57 => _57.removeEventListener, 'call', _58 => _58("offline", onNetworkOffline)]);
3550
+ _optionalChain([root, 'optionalAccess', _51 => _51.removeEventListener, 'call', _52 => _52("visibilitychange", onVisibilityChange)]);
3551
+ _optionalChain([win, 'optionalAccess', _53 => _53.removeEventListener, 'call', _54 => _54("online", onNetworkBackOnline)]);
3552
+ _optionalChain([win, 'optionalAccess', _55 => _55.removeEventListener, 'call', _56 => _56("offline", onNetworkOffline)]);
3559
3553
  teardownSocket(ctx.socket);
3560
3554
  };
3561
3555
  });
@@ -3644,7 +3638,7 @@ var ManagedSocket = class {
3644
3638
  * message if this is somehow impossible.
3645
3639
  */
3646
3640
  send(data) {
3647
- const socket = _optionalChain([this, 'access', _59 => _59.#machine, 'access', _60 => _60.context, 'optionalAccess', _61 => _61.socket]);
3641
+ const socket = _optionalChain([this, 'access', _57 => _57.#machine, 'access', _58 => _58.context, 'optionalAccess', _59 => _59.socket]);
3648
3642
  if (socket === null) {
3649
3643
  warn("Cannot send: not connected yet", data);
3650
3644
  } else if (socket.readyState !== 1) {
@@ -4082,7 +4076,7 @@ function replaceOrAppend(content, newItem, keyFn, now2) {
4082
4076
  }
4083
4077
  }
4084
4078
  function closePart(prevPart, endedAt) {
4085
- if (_optionalChain([prevPart, 'optionalAccess', _62 => _62.type]) === "reasoning") {
4079
+ if (_optionalChain([prevPart, 'optionalAccess', _60 => _60.type]) === "reasoning") {
4086
4080
  prevPart.endedAt ??= endedAt;
4087
4081
  }
4088
4082
  }
@@ -4093,7 +4087,7 @@ function patchContentWithDelta(content, delta) {
4093
4087
  const lastPart = content[content.length - 1];
4094
4088
  switch (delta.type) {
4095
4089
  case "text-delta":
4096
- if (_optionalChain([lastPart, 'optionalAccess', _63 => _63.type]) === "text") {
4090
+ if (_optionalChain([lastPart, 'optionalAccess', _61 => _61.type]) === "text") {
4097
4091
  lastPart.text += delta.textDelta;
4098
4092
  } else {
4099
4093
  closePart(lastPart, now2);
@@ -4101,7 +4095,7 @@ function patchContentWithDelta(content, delta) {
4101
4095
  }
4102
4096
  break;
4103
4097
  case "reasoning-delta":
4104
- if (_optionalChain([lastPart, 'optionalAccess', _64 => _64.type]) === "reasoning") {
4098
+ if (_optionalChain([lastPart, 'optionalAccess', _62 => _62.type]) === "reasoning") {
4105
4099
  lastPart.text += delta.textDelta;
4106
4100
  } else {
4107
4101
  closePart(lastPart, now2);
@@ -4121,8 +4115,8 @@ function patchContentWithDelta(content, delta) {
4121
4115
  break;
4122
4116
  }
4123
4117
  case "tool-delta": {
4124
- if (_optionalChain([lastPart, 'optionalAccess', _65 => _65.type]) === "tool-invocation" && lastPart.stage === "receiving") {
4125
- _optionalChain([lastPart, 'access', _66 => _66.__appendDelta, 'optionalCall', _67 => _67(delta.delta)]);
4118
+ if (_optionalChain([lastPart, 'optionalAccess', _63 => _63.type]) === "tool-invocation" && lastPart.stage === "receiving") {
4119
+ _optionalChain([lastPart, 'access', _64 => _64.__appendDelta, 'optionalCall', _65 => _65(delta.delta)]);
4126
4120
  }
4127
4121
  break;
4128
4122
  }
@@ -4241,7 +4235,7 @@ function createStore_forTools() {
4241
4235
  return DerivedSignal.from(() => {
4242
4236
  return (
4243
4237
  // A tool that's registered and scoped to a specific chat ID...
4244
- _nullishCoalesce(_optionalChain([(chatId !== void 0 ? toolsByChatId\u03A3.getOrCreate(chatId).getOrCreate(name) : void 0), 'optionalAccess', _68 => _68.get, 'call', _69 => _69()]), () => ( // ...or a globally registered tool
4238
+ _nullishCoalesce(_optionalChain([(chatId !== void 0 ? toolsByChatId\u03A3.getOrCreate(chatId).getOrCreate(name) : void 0), 'optionalAccess', _66 => _66.get, 'call', _67 => _67()]), () => ( // ...or a globally registered tool
4245
4239
  toolsByChatId\u03A3.getOrCreate(kWILDCARD).getOrCreate(name).get()))
4246
4240
  );
4247
4241
  });
@@ -4271,8 +4265,8 @@ function createStore_forTools() {
4271
4265
  const globalTools\u03A3 = toolsByChatId\u03A3.get(kWILDCARD);
4272
4266
  const scopedTools\u03A3 = toolsByChatId\u03A3.get(chatId);
4273
4267
  return Array.from([
4274
- ..._nullishCoalesce(_optionalChain([globalTools\u03A3, 'optionalAccess', _70 => _70.entries, 'call', _71 => _71()]), () => ( [])),
4275
- ..._nullishCoalesce(_optionalChain([scopedTools\u03A3, 'optionalAccess', _72 => _72.entries, 'call', _73 => _73()]), () => ( []))
4268
+ ..._nullishCoalesce(_optionalChain([globalTools\u03A3, 'optionalAccess', _68 => _68.entries, 'call', _69 => _69()]), () => ( [])),
4269
+ ..._nullishCoalesce(_optionalChain([scopedTools\u03A3, 'optionalAccess', _70 => _70.entries, 'call', _71 => _71()]), () => ( []))
4276
4270
  ]).flatMap(([name, tool\u03A3]) => {
4277
4271
  const tool = tool\u03A3.get();
4278
4272
  return tool && (_nullishCoalesce(tool.enabled, () => ( true))) ? [{ name, description: tool.description, parameters: tool.parameters }] : [];
@@ -4375,7 +4369,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
4375
4369
  } else {
4376
4370
  continue;
4377
4371
  }
4378
- const executeFn = _optionalChain([toolsStore, 'access', _74 => _74.getTool\u03A3, 'call', _75 => _75(toolInvocation.name, message.chatId), 'access', _76 => _76.get, 'call', _77 => _77(), 'optionalAccess', _78 => _78.execute]);
4372
+ const executeFn = _optionalChain([toolsStore, 'access', _72 => _72.getTool\u03A3, 'call', _73 => _73(toolInvocation.name, message.chatId), 'access', _74 => _74.get, 'call', _75 => _75(), 'optionalAccess', _76 => _76.execute]);
4379
4373
  if (executeFn) {
4380
4374
  (async () => {
4381
4375
  const result = await executeFn(toolInvocation.args, {
@@ -4474,8 +4468,8 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
4474
4468
  const spine = [];
4475
4469
  let lastVisitedMessage = null;
4476
4470
  for (const message2 of pool.walkUp(leaf.id)) {
4477
- const prev = _nullishCoalesce(_optionalChain([first, 'call', _79 => _79(pool.walkLeft(message2.id, isAlive)), 'optionalAccess', _80 => _80.id]), () => ( null));
4478
- const next = _nullishCoalesce(_optionalChain([first, 'call', _81 => _81(pool.walkRight(message2.id, isAlive)), 'optionalAccess', _82 => _82.id]), () => ( null));
4471
+ const prev = _nullishCoalesce(_optionalChain([first, 'call', _77 => _77(pool.walkLeft(message2.id, isAlive)), 'optionalAccess', _78 => _78.id]), () => ( null));
4472
+ const next = _nullishCoalesce(_optionalChain([first, 'call', _79 => _79(pool.walkRight(message2.id, isAlive)), 'optionalAccess', _80 => _80.id]), () => ( null));
4479
4473
  if (!message2.deletedAt || prev || next) {
4480
4474
  const node = {
4481
4475
  ...message2,
@@ -4541,7 +4535,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
4541
4535
  const latest = pool.sorted.findRight(
4542
4536
  (m) => m.role === "assistant" && !m.deletedAt
4543
4537
  );
4544
- return _optionalChain([latest, 'optionalAccess', _83 => _83.copilotId]);
4538
+ return _optionalChain([latest, 'optionalAccess', _81 => _81.copilotId]);
4545
4539
  }
4546
4540
  return {
4547
4541
  // Readers
@@ -4572,11 +4566,11 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
4572
4566
  *getAutoExecutingMessageIds() {
4573
4567
  for (const messageId of myMessages) {
4574
4568
  const message = getMessageById(messageId);
4575
- if (_optionalChain([message, 'optionalAccess', _84 => _84.role]) === "assistant" && message.status === "awaiting-tool") {
4569
+ if (_optionalChain([message, 'optionalAccess', _82 => _82.role]) === "assistant" && message.status === "awaiting-tool") {
4576
4570
  const isAutoExecuting = message.contentSoFar.some((part) => {
4577
4571
  if (part.type === "tool-invocation" && part.stage === "executing") {
4578
4572
  const tool = toolsStore.getTool\u03A3(part.name, message.chatId).get();
4579
- return typeof _optionalChain([tool, 'optionalAccess', _85 => _85.execute]) === "function";
4573
+ return typeof _optionalChain([tool, 'optionalAccess', _83 => _83.execute]) === "function";
4580
4574
  }
4581
4575
  return false;
4582
4576
  });
@@ -4721,7 +4715,7 @@ function createAi(config) {
4721
4715
  flushPendingDeltas();
4722
4716
  switch (msg.event) {
4723
4717
  case "cmd-failed":
4724
- _optionalChain([pendingCmd, 'optionalAccess', _86 => _86.reject, 'call', _87 => _87(new Error(msg.error))]);
4718
+ _optionalChain([pendingCmd, 'optionalAccess', _84 => _84.reject, 'call', _85 => _85(new Error(msg.error))]);
4725
4719
  break;
4726
4720
  case "settle": {
4727
4721
  context.messagesStore.upsert(msg.message);
@@ -4798,7 +4792,7 @@ function createAi(config) {
4798
4792
  return assertNever(msg, "Unhandled case");
4799
4793
  }
4800
4794
  }
4801
- _optionalChain([pendingCmd, 'optionalAccess', _88 => _88.resolve, 'call', _89 => _89(msg)]);
4795
+ _optionalChain([pendingCmd, 'optionalAccess', _86 => _86.resolve, 'call', _87 => _87(msg)]);
4802
4796
  }
4803
4797
  managedSocket.events.onMessage.subscribe(handleServerMessage);
4804
4798
  managedSocket.events.statusDidChange.subscribe(onStatusDidChange);
@@ -4883,9 +4877,9 @@ function createAi(config) {
4883
4877
  invocationId,
4884
4878
  result,
4885
4879
  generationOptions: {
4886
- copilotId: _optionalChain([options, 'optionalAccess', _90 => _90.copilotId]),
4887
- stream: _optionalChain([options, 'optionalAccess', _91 => _91.stream]),
4888
- timeout: _optionalChain([options, 'optionalAccess', _92 => _92.timeout]),
4880
+ copilotId: _optionalChain([options, 'optionalAccess', _88 => _88.copilotId]),
4881
+ stream: _optionalChain([options, 'optionalAccess', _89 => _89.stream]),
4882
+ timeout: _optionalChain([options, 'optionalAccess', _90 => _90.timeout]),
4889
4883
  // Knowledge and tools aren't coming from the options, but retrieved
4890
4884
  // from the global context
4891
4885
  knowledge: knowledge.length > 0 ? knowledge : void 0,
@@ -4903,7 +4897,7 @@ function createAi(config) {
4903
4897
  }
4904
4898
  }
4905
4899
  const win = typeof window !== "undefined" ? window : void 0;
4906
- _optionalChain([win, 'optionalAccess', _93 => _93.addEventListener, 'call', _94 => _94("beforeunload", handleBeforeUnload, { once: true })]);
4900
+ _optionalChain([win, 'optionalAccess', _91 => _91.addEventListener, 'call', _92 => _92("beforeunload", handleBeforeUnload, { once: true })]);
4907
4901
  return Object.defineProperty(
4908
4902
  {
4909
4903
  [kInternal]: {
@@ -4922,7 +4916,7 @@ function createAi(config) {
4922
4916
  clearChat: (chatId) => sendClientMsgWithResponse({ cmd: "clear-chat", chatId }),
4923
4917
  askUserMessageInChat: async (chatId, userMessage, targetMessageId, options) => {
4924
4918
  const globalKnowledge = context.knowledge.get();
4925
- const requestKnowledge = _optionalChain([options, 'optionalAccess', _95 => _95.knowledge]) || [];
4919
+ const requestKnowledge = _optionalChain([options, 'optionalAccess', _93 => _93.knowledge]) || [];
4926
4920
  const combinedKnowledge = [...globalKnowledge, ...requestKnowledge];
4927
4921
  const tools = context.toolsStore.getToolDescriptions(chatId);
4928
4922
  messagesStore.markMine(targetMessageId);
@@ -4932,9 +4926,9 @@ function createAi(config) {
4932
4926
  sourceMessage: userMessage,
4933
4927
  targetMessageId,
4934
4928
  generationOptions: {
4935
- copilotId: _optionalChain([options, 'optionalAccess', _96 => _96.copilotId]),
4936
- stream: _optionalChain([options, 'optionalAccess', _97 => _97.stream]),
4937
- timeout: _optionalChain([options, 'optionalAccess', _98 => _98.timeout]),
4929
+ copilotId: _optionalChain([options, 'optionalAccess', _94 => _94.copilotId]),
4930
+ stream: _optionalChain([options, 'optionalAccess', _95 => _95.stream]),
4931
+ timeout: _optionalChain([options, 'optionalAccess', _96 => _96.timeout]),
4938
4932
  // Combine global knowledge with request-specific knowledge
4939
4933
  knowledge: combinedKnowledge.length > 0 ? combinedKnowledge : void 0,
4940
4934
  tools: tools.length > 0 ? tools : void 0
@@ -5035,7 +5029,7 @@ function createAuthManager(authOptions, onAuthenticate) {
5035
5029
  return void 0;
5036
5030
  }
5037
5031
  async function makeAuthRequest(options) {
5038
- const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _99 => _99.polyfills, 'optionalAccess', _100 => _100.fetch]), () => ( (typeof window === "undefined" ? void 0 : window.fetch)));
5032
+ const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _97 => _97.polyfills, 'optionalAccess', _98 => _98.fetch]), () => ( (typeof window === "undefined" ? void 0 : window.fetch)));
5039
5033
  if (authentication.type === "private") {
5040
5034
  if (fetcher === void 0) {
5041
5035
  throw new StopRetrying(
@@ -5051,7 +5045,7 @@ function createAuthManager(authOptions, onAuthenticate) {
5051
5045
  "The same Liveblocks auth token was issued from the backend before. Caching Liveblocks tokens is not supported."
5052
5046
  );
5053
5047
  }
5054
- _optionalChain([onAuthenticate, 'optionalCall', _101 => _101(parsed.parsed)]);
5048
+ _optionalChain([onAuthenticate, 'optionalCall', _99 => _99(parsed.parsed)]);
5055
5049
  return parsed;
5056
5050
  }
5057
5051
  if (authentication.type === "custom") {
@@ -5059,7 +5053,7 @@ function createAuthManager(authOptions, onAuthenticate) {
5059
5053
  if (response && typeof response === "object") {
5060
5054
  if (typeof response.token === "string") {
5061
5055
  const parsed = parseAuthToken(response.token);
5062
- _optionalChain([onAuthenticate, 'optionalCall', _102 => _102(parsed.parsed)]);
5056
+ _optionalChain([onAuthenticate, 'optionalCall', _100 => _100(parsed.parsed)]);
5063
5057
  return parsed;
5064
5058
  } else if (typeof response.error === "string") {
5065
5059
  const reason = `Authentication failed: ${"reason" in response && typeof response.reason === "string" ? response.reason : "Forbidden"}`;
@@ -5218,7 +5212,7 @@ function sendToPanel(message, options) {
5218
5212
  ...message,
5219
5213
  source: "liveblocks-devtools-client"
5220
5214
  };
5221
- if (!(_optionalChain([options, 'optionalAccess', _103 => _103.force]) || _bridgeActive)) {
5215
+ if (!(_optionalChain([options, 'optionalAccess', _101 => _101.force]) || _bridgeActive)) {
5222
5216
  return;
5223
5217
  }
5224
5218
  window.postMessage(fullMsg, "*");
@@ -5226,7 +5220,7 @@ function sendToPanel(message, options) {
5226
5220
  var eventSource = makeEventSource();
5227
5221
  if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
5228
5222
  window.addEventListener("message", (event) => {
5229
- if (event.source === window && _optionalChain([event, 'access', _104 => _104.data, 'optionalAccess', _105 => _105.source]) === "liveblocks-devtools-panel") {
5223
+ if (event.source === window && _optionalChain([event, 'access', _102 => _102.data, 'optionalAccess', _103 => _103.source]) === "liveblocks-devtools-panel") {
5230
5224
  eventSource.notify(event.data);
5231
5225
  } else {
5232
5226
  }
@@ -5368,7 +5362,7 @@ function fullSync(room) {
5368
5362
  msg: "room::sync::full",
5369
5363
  roomId: room.id,
5370
5364
  status: room.getStatus(),
5371
- storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _106 => _106.toTreeNode, 'call', _107 => _107("root"), 'access', _108 => _108.payload]), () => ( null)),
5365
+ storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _104 => _104.toTreeNode, 'call', _105 => _105("root"), 'access', _106 => _106.payload]), () => ( null)),
5372
5366
  me,
5373
5367
  others
5374
5368
  });
@@ -5675,7 +5669,7 @@ function createManagedPool(roomId, options) {
5675
5669
  generateId: () => `${getCurrentConnectionId()}:${clock++}`,
5676
5670
  generateOpId: () => `${getCurrentConnectionId()}:${opClock++}`,
5677
5671
  dispatch(ops, reverse, storageUpdates) {
5678
- _optionalChain([onDispatch, 'optionalCall', _109 => _109(ops, reverse, storageUpdates)]);
5672
+ _optionalChain([onDispatch, 'optionalCall', _107 => _107(ops, reverse, storageUpdates)]);
5679
5673
  },
5680
5674
  assertStorageIsWritable: () => {
5681
5675
  if (!isStorageWritable()) {
@@ -5902,7 +5896,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
5902
5896
  return [
5903
5897
  {
5904
5898
  type: 8 /* CREATE_REGISTER */,
5905
- opId: _optionalChain([pool, 'optionalAccess', _110 => _110.generateOpId, 'call', _111 => _111()]),
5899
+ opId: _optionalChain([pool, 'optionalAccess', _108 => _108.generateOpId, 'call', _109 => _109()]),
5906
5900
  id: this._id,
5907
5901
  parentId,
5908
5902
  parentKey,
@@ -6008,7 +6002,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6008
6002
  const ops = [];
6009
6003
  const op = {
6010
6004
  id: this._id,
6011
- opId: _optionalChain([pool, 'optionalAccess', _112 => _112.generateOpId, 'call', _113 => _113()]),
6005
+ opId: _optionalChain([pool, 'optionalAccess', _110 => _110.generateOpId, 'call', _111 => _111()]),
6012
6006
  type: 2 /* CREATE_LIST */,
6013
6007
  parentId,
6014
6008
  parentKey
@@ -6279,7 +6273,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6279
6273
  #applyInsertUndoRedo(op) {
6280
6274
  const { id, parentKey: key } = op;
6281
6275
  const child = creationOpToLiveNode(op);
6282
- if (_optionalChain([this, 'access', _114 => _114._pool, 'optionalAccess', _115 => _115.getNode, 'call', _116 => _116(id)]) !== void 0) {
6276
+ if (_optionalChain([this, 'access', _112 => _112._pool, 'optionalAccess', _113 => _113.getNode, 'call', _114 => _114(id)]) !== void 0) {
6283
6277
  return { modified: false };
6284
6278
  }
6285
6279
  child._attach(id, nn(this._pool));
@@ -6287,8 +6281,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
6287
6281
  const existingItemIndex = this._indexOfPosition(key);
6288
6282
  let newKey = key;
6289
6283
  if (existingItemIndex !== -1) {
6290
- const before2 = _optionalChain([this, 'access', _117 => _117.#items, 'access', _118 => _118[existingItemIndex], 'optionalAccess', _119 => _119._parentPos]);
6291
- const after2 = _optionalChain([this, 'access', _120 => _120.#items, 'access', _121 => _121[existingItemIndex + 1], 'optionalAccess', _122 => _122._parentPos]);
6284
+ const before2 = _optionalChain([this, 'access', _115 => _115.#items, 'access', _116 => _116[existingItemIndex], 'optionalAccess', _117 => _117._parentPos]);
6285
+ const after2 = _optionalChain([this, 'access', _118 => _118.#items, 'access', _119 => _119[existingItemIndex + 1], 'optionalAccess', _120 => _120._parentPos]);
6292
6286
  newKey = makePosition(before2, after2);
6293
6287
  child._setParentLink(this, newKey);
6294
6288
  }
@@ -6302,7 +6296,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6302
6296
  #applySetUndoRedo(op) {
6303
6297
  const { id, parentKey: key } = op;
6304
6298
  const child = creationOpToLiveNode(op);
6305
- if (_optionalChain([this, 'access', _123 => _123._pool, 'optionalAccess', _124 => _124.getNode, 'call', _125 => _125(id)]) !== void 0) {
6299
+ if (_optionalChain([this, 'access', _121 => _121._pool, 'optionalAccess', _122 => _122.getNode, 'call', _123 => _123(id)]) !== void 0) {
6306
6300
  return { modified: false };
6307
6301
  }
6308
6302
  this.#unacknowledgedSets.set(key, nn(op.opId));
@@ -6423,7 +6417,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6423
6417
  } else {
6424
6418
  this.#items[existingItemIndex]._setParentLink(
6425
6419
  this,
6426
- makePosition(newKey, _optionalChain([this, 'access', _126 => _126.#items, 'access', _127 => _127[existingItemIndex + 1], 'optionalAccess', _128 => _128._parentPos]))
6420
+ makePosition(newKey, _optionalChain([this, 'access', _124 => _124.#items, 'access', _125 => _125[existingItemIndex + 1], 'optionalAccess', _126 => _126._parentPos]))
6427
6421
  );
6428
6422
  const previousIndex = this.#items.indexOf(child);
6429
6423
  child._setParentLink(this, newKey);
@@ -6448,7 +6442,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6448
6442
  if (existingItemIndex !== -1) {
6449
6443
  this.#items[existingItemIndex]._setParentLink(
6450
6444
  this,
6451
- makePosition(newKey, _optionalChain([this, 'access', _129 => _129.#items, 'access', _130 => _130[existingItemIndex + 1], 'optionalAccess', _131 => _131._parentPos]))
6445
+ makePosition(newKey, _optionalChain([this, 'access', _127 => _127.#items, 'access', _128 => _128[existingItemIndex + 1], 'optionalAccess', _129 => _129._parentPos]))
6452
6446
  );
6453
6447
  }
6454
6448
  child._setParentLink(this, newKey);
@@ -6467,7 +6461,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6467
6461
  if (existingItemIndex !== -1) {
6468
6462
  this.#items[existingItemIndex]._setParentLink(
6469
6463
  this,
6470
- makePosition(newKey, _optionalChain([this, 'access', _132 => _132.#items, 'access', _133 => _133[existingItemIndex + 1], 'optionalAccess', _134 => _134._parentPos]))
6464
+ makePosition(newKey, _optionalChain([this, 'access', _130 => _130.#items, 'access', _131 => _131[existingItemIndex + 1], 'optionalAccess', _132 => _132._parentPos]))
6471
6465
  );
6472
6466
  }
6473
6467
  child._setParentLink(this, newKey);
@@ -6495,7 +6489,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6495
6489
  if (existingItemIndex !== -1) {
6496
6490
  actualNewKey = makePosition(
6497
6491
  newKey,
6498
- _optionalChain([this, 'access', _135 => _135.#items, 'access', _136 => _136[existingItemIndex + 1], 'optionalAccess', _137 => _137._parentPos])
6492
+ _optionalChain([this, 'access', _133 => _133.#items, 'access', _134 => _134[existingItemIndex + 1], 'optionalAccess', _135 => _135._parentPos])
6499
6493
  );
6500
6494
  }
6501
6495
  child._setParentLink(this, actualNewKey);
@@ -6553,7 +6547,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6553
6547
  * @param element The element to add to the end of the LiveList.
6554
6548
  */
6555
6549
  push(element) {
6556
- _optionalChain([this, 'access', _138 => _138._pool, 'optionalAccess', _139 => _139.assertStorageIsWritable, 'call', _140 => _140()]);
6550
+ _optionalChain([this, 'access', _136 => _136._pool, 'optionalAccess', _137 => _137.assertStorageIsWritable, 'call', _138 => _138()]);
6557
6551
  return this.insert(element, this.length);
6558
6552
  }
6559
6553
  /**
@@ -6562,7 +6556,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6562
6556
  * @param index The index at which you want to insert the element.
6563
6557
  */
6564
6558
  insert(element, index) {
6565
- _optionalChain([this, 'access', _141 => _141._pool, 'optionalAccess', _142 => _142.assertStorageIsWritable, 'call', _143 => _143()]);
6559
+ _optionalChain([this, 'access', _139 => _139._pool, 'optionalAccess', _140 => _140.assertStorageIsWritable, 'call', _141 => _141()]);
6566
6560
  if (index < 0 || index > this.#items.length) {
6567
6561
  throw new Error(
6568
6562
  `Cannot insert list item at index "${index}". index should be between 0 and ${this.#items.length}`
@@ -6592,7 +6586,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6592
6586
  * @param targetIndex The index where the element should be after moving.
6593
6587
  */
6594
6588
  move(index, targetIndex) {
6595
- _optionalChain([this, 'access', _144 => _144._pool, 'optionalAccess', _145 => _145.assertStorageIsWritable, 'call', _146 => _146()]);
6589
+ _optionalChain([this, 'access', _142 => _142._pool, 'optionalAccess', _143 => _143.assertStorageIsWritable, 'call', _144 => _144()]);
6596
6590
  if (targetIndex < 0) {
6597
6591
  throw new Error("targetIndex cannot be less than 0");
6598
6592
  }
@@ -6650,7 +6644,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6650
6644
  * @param index The index of the element to delete
6651
6645
  */
6652
6646
  delete(index) {
6653
- _optionalChain([this, 'access', _147 => _147._pool, 'optionalAccess', _148 => _148.assertStorageIsWritable, 'call', _149 => _149()]);
6647
+ _optionalChain([this, 'access', _145 => _145._pool, 'optionalAccess', _146 => _146.assertStorageIsWritable, 'call', _147 => _147()]);
6654
6648
  if (index < 0 || index >= this.#items.length) {
6655
6649
  throw new Error(
6656
6650
  `Cannot delete list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
@@ -6683,7 +6677,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6683
6677
  }
6684
6678
  }
6685
6679
  clear() {
6686
- _optionalChain([this, 'access', _150 => _150._pool, 'optionalAccess', _151 => _151.assertStorageIsWritable, 'call', _152 => _152()]);
6680
+ _optionalChain([this, 'access', _148 => _148._pool, 'optionalAccess', _149 => _149.assertStorageIsWritable, 'call', _150 => _150()]);
6687
6681
  if (this._pool) {
6688
6682
  const ops = [];
6689
6683
  const reverseOps = [];
@@ -6717,7 +6711,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6717
6711
  }
6718
6712
  }
6719
6713
  set(index, item) {
6720
- _optionalChain([this, 'access', _153 => _153._pool, 'optionalAccess', _154 => _154.assertStorageIsWritable, 'call', _155 => _155()]);
6714
+ _optionalChain([this, 'access', _151 => _151._pool, 'optionalAccess', _152 => _152.assertStorageIsWritable, 'call', _153 => _153()]);
6721
6715
  if (index < 0 || index >= this.#items.length) {
6722
6716
  throw new Error(
6723
6717
  `Cannot set list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
@@ -6863,7 +6857,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6863
6857
  #shiftItemPosition(index, key) {
6864
6858
  const shiftedPosition = makePosition(
6865
6859
  key,
6866
- this.#items.length > index + 1 ? _optionalChain([this, 'access', _156 => _156.#items, 'access', _157 => _157[index + 1], 'optionalAccess', _158 => _158._parentPos]) : void 0
6860
+ this.#items.length > index + 1 ? _optionalChain([this, 'access', _154 => _154.#items, 'access', _155 => _155[index + 1], 'optionalAccess', _156 => _156._parentPos]) : void 0
6867
6861
  );
6868
6862
  this.#items[index]._setParentLink(this, shiftedPosition);
6869
6863
  }
@@ -6988,7 +6982,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
6988
6982
  const ops = [];
6989
6983
  const op = {
6990
6984
  id: this._id,
6991
- opId: _optionalChain([pool, 'optionalAccess', _159 => _159.generateOpId, 'call', _160 => _160()]),
6985
+ opId: _optionalChain([pool, 'optionalAccess', _157 => _157.generateOpId, 'call', _158 => _158()]),
6992
6986
  type: 7 /* CREATE_MAP */,
6993
6987
  parentId,
6994
6988
  parentKey
@@ -7123,7 +7117,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7123
7117
  * @param value The value of the element to add. Should be serializable to JSON.
7124
7118
  */
7125
7119
  set(key, value) {
7126
- _optionalChain([this, 'access', _161 => _161._pool, 'optionalAccess', _162 => _162.assertStorageIsWritable, 'call', _163 => _163()]);
7120
+ _optionalChain([this, 'access', _159 => _159._pool, 'optionalAccess', _160 => _160.assertStorageIsWritable, 'call', _161 => _161()]);
7127
7121
  const oldValue = this.#map.get(key);
7128
7122
  if (oldValue) {
7129
7123
  oldValue._detach();
@@ -7169,7 +7163,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7169
7163
  * @returns true if an element existed and has been removed, or false if the element does not exist.
7170
7164
  */
7171
7165
  delete(key) {
7172
- _optionalChain([this, 'access', _164 => _164._pool, 'optionalAccess', _165 => _165.assertStorageIsWritable, 'call', _166 => _166()]);
7166
+ _optionalChain([this, 'access', _162 => _162._pool, 'optionalAccess', _163 => _163.assertStorageIsWritable, 'call', _164 => _164()]);
7173
7167
  const item = this.#map.get(key);
7174
7168
  if (item === void 0) {
7175
7169
  return false;
@@ -7359,7 +7353,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7359
7353
  if (this._id === void 0) {
7360
7354
  throw new Error("Cannot serialize item is not attached");
7361
7355
  }
7362
- const opId = _optionalChain([pool, 'optionalAccess', _167 => _167.generateOpId, 'call', _168 => _168()]);
7356
+ const opId = _optionalChain([pool, 'optionalAccess', _165 => _165.generateOpId, 'call', _166 => _166()]);
7363
7357
  const ops = [];
7364
7358
  const op = {
7365
7359
  type: 4 /* CREATE_OBJECT */,
@@ -7631,7 +7625,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7631
7625
  * @param value The value of the property to add
7632
7626
  */
7633
7627
  set(key, value) {
7634
- _optionalChain([this, 'access', _169 => _169._pool, 'optionalAccess', _170 => _170.assertStorageIsWritable, 'call', _171 => _171()]);
7628
+ _optionalChain([this, 'access', _167 => _167._pool, 'optionalAccess', _168 => _168.assertStorageIsWritable, 'call', _169 => _169()]);
7635
7629
  this.update({ [key]: value });
7636
7630
  }
7637
7631
  /**
@@ -7646,7 +7640,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7646
7640
  * @param key The key of the property to delete
7647
7641
  */
7648
7642
  delete(key) {
7649
- _optionalChain([this, 'access', _172 => _172._pool, 'optionalAccess', _173 => _173.assertStorageIsWritable, 'call', _174 => _174()]);
7643
+ _optionalChain([this, 'access', _170 => _170._pool, 'optionalAccess', _171 => _171.assertStorageIsWritable, 'call', _172 => _172()]);
7650
7644
  const keyAsString = key;
7651
7645
  const oldValue = this.#map.get(keyAsString);
7652
7646
  if (oldValue === void 0) {
@@ -7699,7 +7693,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7699
7693
  * @param patch The object used to overrides properties
7700
7694
  */
7701
7695
  update(patch) {
7702
- _optionalChain([this, 'access', _175 => _175._pool, 'optionalAccess', _176 => _176.assertStorageIsWritable, 'call', _177 => _177()]);
7696
+ _optionalChain([this, 'access', _173 => _173._pool, 'optionalAccess', _174 => _174.assertStorageIsWritable, 'call', _175 => _175()]);
7703
7697
  if (_LiveObject.detectLargeObjects) {
7704
7698
  const data = {};
7705
7699
  for (const [key, value] of this.#map) {
@@ -8447,15 +8441,15 @@ function installBackgroundTabSpy() {
8447
8441
  const doc = typeof document !== "undefined" ? document : void 0;
8448
8442
  const inBackgroundSince = { current: null };
8449
8443
  function onVisibilityChange() {
8450
- if (_optionalChain([doc, 'optionalAccess', _178 => _178.visibilityState]) === "hidden") {
8444
+ if (_optionalChain([doc, 'optionalAccess', _176 => _176.visibilityState]) === "hidden") {
8451
8445
  inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
8452
8446
  } else {
8453
8447
  inBackgroundSince.current = null;
8454
8448
  }
8455
8449
  }
8456
- _optionalChain([doc, 'optionalAccess', _179 => _179.addEventListener, 'call', _180 => _180("visibilitychange", onVisibilityChange)]);
8450
+ _optionalChain([doc, 'optionalAccess', _177 => _177.addEventListener, 'call', _178 => _178("visibilitychange", onVisibilityChange)]);
8457
8451
  const unsub = () => {
8458
- _optionalChain([doc, 'optionalAccess', _181 => _181.removeEventListener, 'call', _182 => _182("visibilitychange", onVisibilityChange)]);
8452
+ _optionalChain([doc, 'optionalAccess', _179 => _179.removeEventListener, 'call', _180 => _180("visibilitychange", onVisibilityChange)]);
8459
8453
  };
8460
8454
  return [inBackgroundSince, unsub];
8461
8455
  }
@@ -8635,7 +8629,7 @@ function createRoom(options, config) {
8635
8629
  }
8636
8630
  }
8637
8631
  function isStorageWritable() {
8638
- const scopes = _optionalChain([context, 'access', _183 => _183.dynamicSessionInfoSig, 'access', _184 => _184.get, 'call', _185 => _185(), 'optionalAccess', _186 => _186.scopes]);
8632
+ const scopes = _optionalChain([context, 'access', _181 => _181.dynamicSessionInfoSig, 'access', _182 => _182.get, 'call', _183 => _183(), 'optionalAccess', _184 => _184.scopes]);
8639
8633
  return scopes !== void 0 ? canWriteStorage(scopes) : true;
8640
8634
  }
8641
8635
  const eventHub = {
@@ -8761,7 +8755,7 @@ function createRoom(options, config) {
8761
8755
  }
8762
8756
  case "experimental-fallback-to-http": {
8763
8757
  warn("Message is too large for websockets, so sending over HTTP instead");
8764
- const nonce = _nullishCoalesce(_optionalChain([context, 'access', _187 => _187.dynamicSessionInfoSig, 'access', _188 => _188.get, 'call', _189 => _189(), 'optionalAccess', _190 => _190.nonce]), () => ( raise("Session is not authorized to send message over HTTP")));
8758
+ const nonce = _nullishCoalesce(_optionalChain([context, 'access', _185 => _185.dynamicSessionInfoSig, 'access', _186 => _186.get, 'call', _187 => _187(), 'optionalAccess', _188 => _188.nonce]), () => ( raise("Session is not authorized to send message over HTTP")));
8765
8759
  void httpClient.sendMessages({ roomId, nonce, messages }).then((resp) => {
8766
8760
  if (!resp.ok && resp.status === 403) {
8767
8761
  managedSocket.reconnect();
@@ -8812,7 +8806,7 @@ function createRoom(options, config) {
8812
8806
  } else {
8813
8807
  context.root = LiveObject._fromItems(message.items, context.pool);
8814
8808
  }
8815
- const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _191 => _191.get, 'call', _192 => _192(), 'optionalAccess', _193 => _193.canWrite]), () => ( true));
8809
+ const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _189 => _189.get, 'call', _190 => _190(), 'optionalAccess', _191 => _191.canWrite]), () => ( true));
8816
8810
  const stackSizeBefore = context.undoStack.length;
8817
8811
  for (const key in context.initialStorage) {
8818
8812
  if (context.root.get(key) === void 0) {
@@ -9015,7 +9009,7 @@ function createRoom(options, config) {
9015
9009
  }
9016
9010
  context.myPresence.patch(patch);
9017
9011
  if (context.activeBatch) {
9018
- if (_optionalChain([options2, 'optionalAccess', _194 => _194.addToHistory])) {
9012
+ if (_optionalChain([options2, 'optionalAccess', _192 => _192.addToHistory])) {
9019
9013
  context.activeBatch.reverseOps.pushLeft({
9020
9014
  type: "presence",
9021
9015
  data: oldValues
@@ -9024,7 +9018,7 @@ function createRoom(options, config) {
9024
9018
  context.activeBatch.updates.presence = true;
9025
9019
  } else {
9026
9020
  flushNowOrSoon();
9027
- if (_optionalChain([options2, 'optionalAccess', _195 => _195.addToHistory])) {
9021
+ if (_optionalChain([options2, 'optionalAccess', _193 => _193.addToHistory])) {
9028
9022
  addToUndoStack([{ type: "presence", data: oldValues }]);
9029
9023
  }
9030
9024
  notify({ presence: true });
@@ -9221,7 +9215,7 @@ function createRoom(options, config) {
9221
9215
  if (process.env.NODE_ENV !== "production") {
9222
9216
  const traces = /* @__PURE__ */ new Set();
9223
9217
  for (const opId of message.opIds) {
9224
- const trace = _optionalChain([context, 'access', _196 => _196.opStackTraces, 'optionalAccess', _197 => _197.get, 'call', _198 => _198(opId)]);
9218
+ const trace = _optionalChain([context, 'access', _194 => _194.opStackTraces, 'optionalAccess', _195 => _195.get, 'call', _196 => _196(opId)]);
9225
9219
  if (trace) {
9226
9220
  traces.add(trace);
9227
9221
  }
@@ -9355,7 +9349,7 @@ ${Array.from(traces).join("\n\n")}`
9355
9349
  const unacknowledgedOps = new Map(context.unacknowledgedOps);
9356
9350
  createOrUpdateRootFromMessage(message);
9357
9351
  applyAndSendOps(unacknowledgedOps);
9358
- _optionalChain([_resolveStoragePromise, 'optionalCall', _199 => _199()]);
9352
+ _optionalChain([_resolveStoragePromise, 'optionalCall', _197 => _197()]);
9359
9353
  notifyStorageStatus();
9360
9354
  eventHub.storageDidLoad.notify();
9361
9355
  }
@@ -9576,8 +9570,8 @@ ${Array.from(traces).join("\n\n")}`
9576
9570
  async function getThreads(options2) {
9577
9571
  return httpClient.getThreads({
9578
9572
  roomId,
9579
- query: _optionalChain([options2, 'optionalAccess', _200 => _200.query]),
9580
- cursor: _optionalChain([options2, 'optionalAccess', _201 => _201.cursor])
9573
+ query: _optionalChain([options2, 'optionalAccess', _198 => _198.query]),
9574
+ cursor: _optionalChain([options2, 'optionalAccess', _199 => _199.cursor])
9581
9575
  });
9582
9576
  }
9583
9577
  async function getThread(threadId) {
@@ -9684,7 +9678,7 @@ ${Array.from(traces).join("\n\n")}`
9684
9678
  function getSubscriptionSettings(options2) {
9685
9679
  return httpClient.getSubscriptionSettings({
9686
9680
  roomId,
9687
- signal: _optionalChain([options2, 'optionalAccess', _202 => _202.signal])
9681
+ signal: _optionalChain([options2, 'optionalAccess', _200 => _200.signal])
9688
9682
  });
9689
9683
  }
9690
9684
  function updateSubscriptionSettings(settings) {
@@ -9706,7 +9700,7 @@ ${Array.from(traces).join("\n\n")}`
9706
9700
  {
9707
9701
  [kInternal]: {
9708
9702
  get presenceBuffer() {
9709
- return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _203 => _203.buffer, 'access', _204 => _204.presenceUpdates, 'optionalAccess', _205 => _205.data]), () => ( null)));
9703
+ return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _201 => _201.buffer, 'access', _202 => _202.presenceUpdates, 'optionalAccess', _203 => _203.data]), () => ( null)));
9710
9704
  },
9711
9705
  // prettier-ignore
9712
9706
  get undoStack() {
@@ -9721,9 +9715,9 @@ ${Array.from(traces).join("\n\n")}`
9721
9715
  return context.yjsProvider;
9722
9716
  },
9723
9717
  setYjsProvider(newProvider) {
9724
- _optionalChain([context, 'access', _206 => _206.yjsProvider, 'optionalAccess', _207 => _207.off, 'call', _208 => _208("status", yjsStatusDidChange)]);
9718
+ _optionalChain([context, 'access', _204 => _204.yjsProvider, 'optionalAccess', _205 => _205.off, 'call', _206 => _206("status", yjsStatusDidChange)]);
9725
9719
  context.yjsProvider = newProvider;
9726
- _optionalChain([newProvider, 'optionalAccess', _209 => _209.on, 'call', _210 => _210("status", yjsStatusDidChange)]);
9720
+ _optionalChain([newProvider, 'optionalAccess', _207 => _207.on, 'call', _208 => _208("status", yjsStatusDidChange)]);
9727
9721
  context.yjsProviderDidChange.notify();
9728
9722
  },
9729
9723
  yjsProviderDidChange: context.yjsProviderDidChange.observable,
@@ -9769,7 +9763,7 @@ ${Array.from(traces).join("\n\n")}`
9769
9763
  source.dispose();
9770
9764
  }
9771
9765
  eventHub.roomWillDestroy.notify();
9772
- _optionalChain([context, 'access', _211 => _211.yjsProvider, 'optionalAccess', _212 => _212.off, 'call', _213 => _213("status", yjsStatusDidChange)]);
9766
+ _optionalChain([context, 'access', _209 => _209.yjsProvider, 'optionalAccess', _210 => _210.off, 'call', _211 => _211("status", yjsStatusDidChange)]);
9773
9767
  syncSourceForStorage.destroy();
9774
9768
  syncSourceForYjs.destroy();
9775
9769
  uninstallBgTabSpy();
@@ -9919,7 +9913,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
9919
9913
  }
9920
9914
  if (isLiveNode(first)) {
9921
9915
  const node = first;
9922
- if (_optionalChain([options, 'optionalAccess', _214 => _214.isDeep])) {
9916
+ if (_optionalChain([options, 'optionalAccess', _212 => _212.isDeep])) {
9923
9917
  const storageCallback = second;
9924
9918
  return subscribeToLiveStructureDeeply(node, storageCallback);
9925
9919
  } else {
@@ -9999,8 +9993,8 @@ function createClient(options) {
9999
9993
  const userId = token.k === "sec-legacy" /* SECRET_LEGACY */ ? token.id : token.uid;
10000
9994
  currentUserId.set(() => userId);
10001
9995
  });
10002
- const fetchPolyfill = _optionalChain([clientOptions, 'access', _215 => _215.polyfills, 'optionalAccess', _216 => _216.fetch]) || /* istanbul ignore next */
10003
- _optionalChain([globalThis, 'access', _217 => _217.fetch, 'optionalAccess', _218 => _218.bind, 'call', _219 => _219(globalThis)]);
9996
+ const fetchPolyfill = _optionalChain([clientOptions, 'access', _213 => _213.polyfills, 'optionalAccess', _214 => _214.fetch]) || /* istanbul ignore next */
9997
+ _optionalChain([globalThis, 'access', _215 => _215.fetch, 'optionalAccess', _216 => _216.bind, 'call', _217 => _217(globalThis)]);
10004
9998
  const httpClient = createApiClient({
10005
9999
  baseUrl,
10006
10000
  fetchPolyfill,
@@ -10018,7 +10012,7 @@ function createClient(options) {
10018
10012
  delegates: {
10019
10013
  createSocket: makeCreateSocketDelegateForAi(
10020
10014
  baseUrl,
10021
- _optionalChain([clientOptions, 'access', _220 => _220.polyfills, 'optionalAccess', _221 => _221.WebSocket])
10015
+ _optionalChain([clientOptions, 'access', _218 => _218.polyfills, 'optionalAccess', _219 => _219.WebSocket])
10022
10016
  ),
10023
10017
  authenticate: async () => {
10024
10018
  const resp = await authManager.getAuthValue({
@@ -10086,7 +10080,7 @@ function createClient(options) {
10086
10080
  createSocket: makeCreateSocketDelegateForRoom(
10087
10081
  roomId,
10088
10082
  baseUrl,
10089
- _optionalChain([clientOptions, 'access', _222 => _222.polyfills, 'optionalAccess', _223 => _223.WebSocket])
10083
+ _optionalChain([clientOptions, 'access', _220 => _220.polyfills, 'optionalAccess', _221 => _221.WebSocket])
10090
10084
  ),
10091
10085
  authenticate: makeAuthDelegateForRoom(roomId, authManager)
10092
10086
  })),
@@ -10109,7 +10103,7 @@ function createClient(options) {
10109
10103
  const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
10110
10104
  if (shouldConnect) {
10111
10105
  if (typeof atob === "undefined") {
10112
- if (_optionalChain([clientOptions, 'access', _224 => _224.polyfills, 'optionalAccess', _225 => _225.atob]) === void 0) {
10106
+ if (_optionalChain([clientOptions, 'access', _222 => _222.polyfills, 'optionalAccess', _223 => _223.atob]) === void 0) {
10113
10107
  throw new Error(
10114
10108
  "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"
10115
10109
  );
@@ -10121,7 +10115,7 @@ function createClient(options) {
10121
10115
  return leaseRoom(newRoomDetails);
10122
10116
  }
10123
10117
  function getRoom(roomId) {
10124
- const room = _optionalChain([roomsById, 'access', _226 => _226.get, 'call', _227 => _227(roomId), 'optionalAccess', _228 => _228.room]);
10118
+ const room = _optionalChain([roomsById, 'access', _224 => _224.get, 'call', _225 => _225(roomId), 'optionalAccess', _226 => _226.room]);
10125
10119
  return room ? room : null;
10126
10120
  }
10127
10121
  function logout() {
@@ -10137,7 +10131,7 @@ function createClient(options) {
10137
10131
  const batchedResolveUsers = new Batch(
10138
10132
  async (batchedUserIds) => {
10139
10133
  const userIds = batchedUserIds.flat();
10140
- const users = await _optionalChain([resolveUsers, 'optionalCall', _229 => _229({ userIds })]);
10134
+ const users = await _optionalChain([resolveUsers, 'optionalCall', _227 => _227({ userIds })]);
10141
10135
  warnOnceIf(
10142
10136
  !resolveUsers,
10143
10137
  "Set the resolveUsers option in createClient to specify user info."
@@ -10154,7 +10148,7 @@ function createClient(options) {
10154
10148
  const batchedResolveRoomsInfo = new Batch(
10155
10149
  async (batchedRoomIds) => {
10156
10150
  const roomIds = batchedRoomIds.flat();
10157
- const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _230 => _230({ roomIds })]);
10151
+ const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _228 => _228({ roomIds })]);
10158
10152
  warnOnceIf(
10159
10153
  !resolveRoomsInfo,
10160
10154
  "Set the resolveRoomsInfo option in createClient to specify room info."
@@ -10171,7 +10165,7 @@ function createClient(options) {
10171
10165
  const batchedResolveGroupsInfo = new Batch(
10172
10166
  async (batchedGroupIds) => {
10173
10167
  const groupIds = batchedGroupIds.flat();
10174
- const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _231 => _231({ groupIds })]);
10168
+ const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _229 => _229({ groupIds })]);
10175
10169
  warnOnceIf(
10176
10170
  !resolveGroupsInfo,
10177
10171
  "Set the resolveGroupsInfo option in createClient to specify group info."
@@ -10227,7 +10221,7 @@ function createClient(options) {
10227
10221
  }
10228
10222
  };
10229
10223
  const win = typeof window !== "undefined" ? window : void 0;
10230
- _optionalChain([win, 'optionalAccess', _232 => _232.addEventListener, 'call', _233 => _233("beforeunload", maybePreventClose)]);
10224
+ _optionalChain([win, 'optionalAccess', _230 => _230.addEventListener, 'call', _231 => _231("beforeunload", maybePreventClose)]);
10231
10225
  }
10232
10226
  async function getNotificationSettings(options2) {
10233
10227
  const plainSettings = await httpClient.getNotificationSettings(options2);
@@ -10354,7 +10348,7 @@ var commentBodyElementsTypes = {
10354
10348
  mention: "inline"
10355
10349
  };
10356
10350
  function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
10357
- if (!body || !_optionalChain([body, 'optionalAccess', _234 => _234.content])) {
10351
+ if (!body || !_optionalChain([body, 'optionalAccess', _232 => _232.content])) {
10358
10352
  return;
10359
10353
  }
10360
10354
  const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
@@ -10364,13 +10358,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
10364
10358
  for (const block of body.content) {
10365
10359
  if (type === "all" || type === "block") {
10366
10360
  if (guard(block)) {
10367
- _optionalChain([visitor, 'optionalCall', _235 => _235(block)]);
10361
+ _optionalChain([visitor, 'optionalCall', _233 => _233(block)]);
10368
10362
  }
10369
10363
  }
10370
10364
  if (type === "all" || type === "inline") {
10371
10365
  for (const inline of block.children) {
10372
10366
  if (guard(inline)) {
10373
- _optionalChain([visitor, 'optionalCall', _236 => _236(inline)]);
10367
+ _optionalChain([visitor, 'optionalCall', _234 => _234(inline)]);
10374
10368
  }
10375
10369
  }
10376
10370
  }
@@ -10540,7 +10534,7 @@ var stringifyCommentBodyPlainElements = {
10540
10534
  text: ({ element }) => element.text,
10541
10535
  link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
10542
10536
  mention: ({ element, user, group }) => {
10543
- return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _237 => _237.name]), () => ( _optionalChain([group, 'optionalAccess', _238 => _238.name]))), () => ( element.id))}`;
10537
+ return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _235 => _235.name]), () => ( _optionalChain([group, 'optionalAccess', _236 => _236.name]))), () => ( element.id))}`;
10544
10538
  }
10545
10539
  };
10546
10540
  var stringifyCommentBodyHtmlElements = {
@@ -10570,7 +10564,7 @@ var stringifyCommentBodyHtmlElements = {
10570
10564
  return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
10571
10565
  },
10572
10566
  mention: ({ element, user, group }) => {
10573
- return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _239 => _239.name]) ? html`${_optionalChain([user, 'optionalAccess', _240 => _240.name])}` : _optionalChain([group, 'optionalAccess', _241 => _241.name]) ? html`${_optionalChain([group, 'optionalAccess', _242 => _242.name])}` : element.id}</span>`;
10567
+ return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _237 => _237.name]) ? html`${_optionalChain([user, 'optionalAccess', _238 => _238.name])}` : _optionalChain([group, 'optionalAccess', _239 => _239.name]) ? html`${_optionalChain([group, 'optionalAccess', _240 => _240.name])}` : element.id}</span>`;
10574
10568
  }
10575
10569
  };
10576
10570
  var stringifyCommentBodyMarkdownElements = {
@@ -10600,20 +10594,20 @@ var stringifyCommentBodyMarkdownElements = {
10600
10594
  return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
10601
10595
  },
10602
10596
  mention: ({ element, user, group }) => {
10603
- return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _243 => _243.name]), () => ( _optionalChain([group, 'optionalAccess', _244 => _244.name]))), () => ( element.id))}`;
10597
+ return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _241 => _241.name]), () => ( _optionalChain([group, 'optionalAccess', _242 => _242.name]))), () => ( element.id))}`;
10604
10598
  }
10605
10599
  };
10606
10600
  async function stringifyCommentBody(body, options) {
10607
- const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _245 => _245.format]), () => ( "plain"));
10608
- const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _246 => _246.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
10601
+ const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _243 => _243.format]), () => ( "plain"));
10602
+ const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _244 => _244.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
10609
10603
  const elements = {
10610
10604
  ...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
10611
- ..._optionalChain([options, 'optionalAccess', _247 => _247.elements])
10605
+ ..._optionalChain([options, 'optionalAccess', _245 => _245.elements])
10612
10606
  };
10613
10607
  const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInCommentBody(
10614
10608
  body,
10615
- _optionalChain([options, 'optionalAccess', _248 => _248.resolveUsers]),
10616
- _optionalChain([options, 'optionalAccess', _249 => _249.resolveGroupsInfo])
10609
+ _optionalChain([options, 'optionalAccess', _246 => _246.resolveUsers]),
10610
+ _optionalChain([options, 'optionalAccess', _247 => _247.resolveGroupsInfo])
10617
10611
  );
10618
10612
  const blocks = body.content.flatMap((block, blockIndex) => {
10619
10613
  switch (block.type) {
@@ -10900,12 +10894,12 @@ function legacy_patchImmutableNode(state, path, update) {
10900
10894
  }
10901
10895
  const newState = Object.assign({}, state);
10902
10896
  for (const key in update.updates) {
10903
- if (_optionalChain([update, 'access', _250 => _250.updates, 'access', _251 => _251[key], 'optionalAccess', _252 => _252.type]) === "update") {
10897
+ if (_optionalChain([update, 'access', _248 => _248.updates, 'access', _249 => _249[key], 'optionalAccess', _250 => _250.type]) === "update") {
10904
10898
  const val = update.node.get(key);
10905
10899
  if (val !== void 0) {
10906
10900
  newState[key] = lsonToJson(val);
10907
10901
  }
10908
- } else if (_optionalChain([update, 'access', _253 => _253.updates, 'access', _254 => _254[key], 'optionalAccess', _255 => _255.type]) === "delete") {
10902
+ } else if (_optionalChain([update, 'access', _251 => _251.updates, 'access', _252 => _252[key], 'optionalAccess', _253 => _253.type]) === "delete") {
10909
10903
  delete newState[key];
10910
10904
  }
10911
10905
  }
@@ -10966,12 +10960,12 @@ function legacy_patchImmutableNode(state, path, update) {
10966
10960
  }
10967
10961
  const newState = Object.assign({}, state);
10968
10962
  for (const key in update.updates) {
10969
- if (_optionalChain([update, 'access', _256 => _256.updates, 'access', _257 => _257[key], 'optionalAccess', _258 => _258.type]) === "update") {
10963
+ if (_optionalChain([update, 'access', _254 => _254.updates, 'access', _255 => _255[key], 'optionalAccess', _256 => _256.type]) === "update") {
10970
10964
  const value = update.node.get(key);
10971
10965
  if (value !== void 0) {
10972
10966
  newState[key] = lsonToJson(value);
10973
10967
  }
10974
- } else if (_optionalChain([update, 'access', _259 => _259.updates, 'access', _260 => _260[key], 'optionalAccess', _261 => _261.type]) === "delete") {
10968
+ } else if (_optionalChain([update, 'access', _257 => _257.updates, 'access', _258 => _258[key], 'optionalAccess', _259 => _259.type]) === "delete") {
10975
10969
  delete newState[key];
10976
10970
  }
10977
10971
  }
@@ -11051,9 +11045,9 @@ function makePoller(callback, intervalMs, options) {
11051
11045
  const startTime = performance.now();
11052
11046
  const doc = typeof document !== "undefined" ? document : void 0;
11053
11047
  const win = typeof window !== "undefined" ? window : void 0;
11054
- const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _262 => _262.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
11048
+ const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _260 => _260.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
11055
11049
  const context = {
11056
- inForeground: _optionalChain([doc, 'optionalAccess', _263 => _263.visibilityState]) !== "hidden",
11050
+ inForeground: _optionalChain([doc, 'optionalAccess', _261 => _261.visibilityState]) !== "hidden",
11057
11051
  lastSuccessfulPollAt: startTime,
11058
11052
  count: 0,
11059
11053
  backoff: 0
@@ -11134,11 +11128,11 @@ function makePoller(callback, intervalMs, options) {
11134
11128
  pollNowIfStale();
11135
11129
  }
11136
11130
  function onVisibilityChange() {
11137
- setInForeground(_optionalChain([doc, 'optionalAccess', _264 => _264.visibilityState]) !== "hidden");
11131
+ setInForeground(_optionalChain([doc, 'optionalAccess', _262 => _262.visibilityState]) !== "hidden");
11138
11132
  }
11139
- _optionalChain([doc, 'optionalAccess', _265 => _265.addEventListener, 'call', _266 => _266("visibilitychange", onVisibilityChange)]);
11140
- _optionalChain([win, 'optionalAccess', _267 => _267.addEventListener, 'call', _268 => _268("online", onVisibilityChange)]);
11141
- _optionalChain([win, 'optionalAccess', _269 => _269.addEventListener, 'call', _270 => _270("focus", pollNowIfStale)]);
11133
+ _optionalChain([doc, 'optionalAccess', _263 => _263.addEventListener, 'call', _264 => _264("visibilitychange", onVisibilityChange)]);
11134
+ _optionalChain([win, 'optionalAccess', _265 => _265.addEventListener, 'call', _266 => _266("online", onVisibilityChange)]);
11135
+ _optionalChain([win, 'optionalAccess', _267 => _267.addEventListener, 'call', _268 => _268("focus", pollNowIfStale)]);
11142
11136
  fsm.start();
11143
11137
  return {
11144
11138
  inc,