@liveblocks/core 3.7.0-preview1 → 3.7.1-tiptap3

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.7.0-preview1";
9
+ var PKG_VERSION = "3.7.1-tiptap3";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -1127,9 +1127,15 @@ function createBatchStore(batch2) {
1127
1127
  function getCacheKey(args) {
1128
1128
  return stableStringify(args);
1129
1129
  }
1130
- function update(cacheKey, state) {
1130
+ function update(entryOrEntries) {
1131
1131
  signal.mutate((cache) => {
1132
- cache.set(cacheKey, state);
1132
+ if (Array.isArray(entryOrEntries)) {
1133
+ for (const entry of entryOrEntries) {
1134
+ cache.set(entry.key, entry.state);
1135
+ }
1136
+ } else {
1137
+ cache.set(entryOrEntries.key, entryOrEntries.state);
1138
+ }
1133
1139
  });
1134
1140
  }
1135
1141
  function invalidate(inputs) {
@@ -1150,19 +1156,23 @@ function createBatchStore(batch2) {
1150
1156
  return;
1151
1157
  }
1152
1158
  try {
1153
- update(cacheKey, { isLoading: true });
1159
+ update({ key: cacheKey, state: { isLoading: true } });
1154
1160
  const result = await batch2.get(input);
1155
- update(cacheKey, { isLoading: false, data: result });
1161
+ update({ key: cacheKey, state: { isLoading: false, data: result } });
1156
1162
  } catch (error3) {
1157
- update(cacheKey, {
1158
- isLoading: false,
1159
- error: error3
1163
+ update({
1164
+ key: cacheKey,
1165
+ state: { isLoading: false, error: error3 }
1160
1166
  });
1161
1167
  }
1162
1168
  }
1163
- function fill(input, data) {
1164
- const cacheKey = getCacheKey(input);
1165
- update(cacheKey, { isLoading: false, data });
1169
+ function setData(entries2) {
1170
+ update(
1171
+ entries2.map((entry) => ({
1172
+ key: getCacheKey(entry[0]),
1173
+ state: { isLoading: false, data: entry[1] }
1174
+ }))
1175
+ );
1166
1176
  }
1167
1177
  function getItemState(input) {
1168
1178
  const cacheKey = getCacheKey(input);
@@ -1181,7 +1191,7 @@ function createBatchStore(batch2) {
1181
1191
  return {
1182
1192
  subscribe: signal.subscribe,
1183
1193
  enqueue,
1184
- fill,
1194
+ setData,
1185
1195
  getItemState,
1186
1196
  getData,
1187
1197
  invalidate,
@@ -2148,18 +2158,21 @@ function createApiClient({
2148
2158
  }
2149
2159
  async function getInboxNotifications(options) {
2150
2160
  const PAGE_SIZE = 50;
2161
+ let query;
2162
+ if (_optionalChain([options, 'optionalAccess', _20 => _20.query])) {
2163
+ query = objectToQuery(options.query);
2164
+ }
2151
2165
  const json = await httpClient.get(
2152
2166
  url`/v2/c/inbox-notifications`,
2153
2167
  await authManager.getAuthValue({ requestedScope: "comments:read" }),
2154
2168
  {
2155
- cursor: _optionalChain([options, 'optionalAccess', _20 => _20.cursor]),
2156
- limit: PAGE_SIZE
2169
+ cursor: _optionalChain([options, 'optionalAccess', _21 => _21.cursor]),
2170
+ limit: PAGE_SIZE,
2171
+ query
2157
2172
  }
2158
2173
  );
2159
2174
  const groups = json.groups.map(convertToGroupData);
2160
- for (const group of groups) {
2161
- groupsStore.fill(group.id, group);
2162
- }
2175
+ groupsStore.setData(groups.map((group) => [group.id, group]));
2163
2176
  return {
2164
2177
  inboxNotifications: json.inboxNotifications.map(
2165
2178
  convertToInboxNotificationData
@@ -2171,10 +2184,14 @@ function createApiClient({
2171
2184
  };
2172
2185
  }
2173
2186
  async function getInboxNotificationsSince(options) {
2187
+ let query;
2188
+ if (_optionalChain([options, 'optionalAccess', _22 => _22.query])) {
2189
+ query = objectToQuery(options.query);
2190
+ }
2174
2191
  const json = await httpClient.get(
2175
2192
  url`/v2/c/inbox-notifications/delta`,
2176
2193
  await authManager.getAuthValue({ requestedScope: "comments:read" }),
2177
- { since: options.since.toISOString() },
2194
+ { since: options.since.toISOString(), query },
2178
2195
  { signal: options.signal }
2179
2196
  );
2180
2197
  return {
@@ -2248,7 +2265,7 @@ function createApiClient({
2248
2265
  url`/v2/c/notification-settings`,
2249
2266
  await authManager.getAuthValue({ requestedScope: "comments:read" }),
2250
2267
  void 0,
2251
- { signal: _optionalChain([options, 'optionalAccess', _21 => _21.signal]) }
2268
+ { signal: _optionalChain([options, 'optionalAccess', _23 => _23.signal]) }
2252
2269
  );
2253
2270
  }
2254
2271
  async function updateNotificationSettings(settings) {
@@ -2260,7 +2277,7 @@ function createApiClient({
2260
2277
  }
2261
2278
  async function getUserThreads_experimental(options) {
2262
2279
  let query;
2263
- if (_optionalChain([options, 'optionalAccess', _22 => _22.query])) {
2280
+ if (_optionalChain([options, 'optionalAccess', _24 => _24.query])) {
2264
2281
  query = objectToQuery(options.query);
2265
2282
  }
2266
2283
  const PAGE_SIZE = 50;
@@ -2268,7 +2285,7 @@ function createApiClient({
2268
2285
  url`/v2/c/threads`,
2269
2286
  await authManager.getAuthValue({ requestedScope: "comments:read" }),
2270
2287
  {
2271
- cursor: _optionalChain([options, 'optionalAccess', _23 => _23.cursor]),
2288
+ cursor: _optionalChain([options, 'optionalAccess', _25 => _25.cursor]),
2272
2289
  query,
2273
2290
  limit: PAGE_SIZE
2274
2291
  }
@@ -2433,7 +2450,7 @@ var HttpClient = class {
2433
2450
  // These headers are default, but can be overriden by custom headers
2434
2451
  "Content-Type": "application/json; charset=utf-8",
2435
2452
  // Possible header overrides
2436
- ..._optionalChain([options, 'optionalAccess', _24 => _24.headers]),
2453
+ ..._optionalChain([options, 'optionalAccess', _26 => _26.headers]),
2437
2454
  // Cannot be overriden by custom headers
2438
2455
  Authorization: `Bearer ${getBearerTokenFromAuthValue(authValue)}`,
2439
2456
  "X-LB-Client": PKG_VERSION || "dev"
@@ -2890,7 +2907,7 @@ var FSM = class {
2890
2907
  });
2891
2908
  }
2892
2909
  #getTargetFn(eventName) {
2893
- return _optionalChain([this, 'access', _25 => _25.#allowedTransitions, 'access', _26 => _26.get, 'call', _27 => _27(this.currentState), 'optionalAccess', _28 => _28.get, 'call', _29 => _29(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)]);
2894
2911
  }
2895
2912
  /**
2896
2913
  * Exits the current state, and executes any necessary cleanup functions.
@@ -2907,7 +2924,7 @@ var FSM = class {
2907
2924
  this.#currentContext.allowPatching((patchableContext) => {
2908
2925
  levels = _nullishCoalesce(levels, () => ( this.#cleanupStack.length));
2909
2926
  for (let i = 0; i < levels; i++) {
2910
- _optionalChain([this, 'access', _30 => _30.#cleanupStack, 'access', _31 => _31.pop, 'call', _32 => _32(), 'optionalCall', _33 => _33(patchableContext)]);
2927
+ _optionalChain([this, 'access', _32 => _32.#cleanupStack, 'access', _33 => _33.pop, 'call', _34 => _34(), 'optionalCall', _35 => _35(patchableContext)]);
2911
2928
  }
2912
2929
  });
2913
2930
  }
@@ -2923,7 +2940,7 @@ var FSM = class {
2923
2940
  this.#currentContext.allowPatching((patchableContext) => {
2924
2941
  for (const pattern of enterPatterns) {
2925
2942
  const enterFn = this.#enterFns.get(pattern);
2926
- const cleanupFn = _optionalChain([enterFn, 'optionalCall', _34 => _34(patchableContext)]);
2943
+ const cleanupFn = _optionalChain([enterFn, 'optionalCall', _36 => _36(patchableContext)]);
2927
2944
  if (typeof cleanupFn === "function") {
2928
2945
  this.#cleanupStack.push(cleanupFn);
2929
2946
  } else {
@@ -3317,7 +3334,7 @@ function createConnectionStateMachine(delegates, options) {
3317
3334
  }
3318
3335
  function waitForActorId(event) {
3319
3336
  const serverMsg = tryParseJson(event.data);
3320
- if (_optionalChain([serverMsg, 'optionalAccess', _35 => _35.type]) === 104 /* ROOM_STATE */) {
3337
+ if (_optionalChain([serverMsg, 'optionalAccess', _37 => _37.type]) === 104 /* ROOM_STATE */) {
3321
3338
  didReceiveActor();
3322
3339
  }
3323
3340
  }
@@ -3426,12 +3443,12 @@ function createConnectionStateMachine(delegates, options) {
3426
3443
  const sendHeartbeat = {
3427
3444
  target: "@ok.awaiting-pong",
3428
3445
  effect: (ctx) => {
3429
- _optionalChain([ctx, 'access', _36 => _36.socket, 'optionalAccess', _37 => _37.send, 'call', _38 => _38("ping")]);
3446
+ _optionalChain([ctx, 'access', _38 => _38.socket, 'optionalAccess', _39 => _39.send, 'call', _40 => _40("ping")]);
3430
3447
  }
3431
3448
  };
3432
3449
  const maybeHeartbeat = () => {
3433
3450
  const doc = typeof document !== "undefined" ? document : void 0;
3434
- const canZombie = _optionalChain([doc, 'optionalAccess', _39 => _39.visibilityState]) === "hidden" && delegates.canZombie();
3451
+ const canZombie = _optionalChain([doc, 'optionalAccess', _41 => _41.visibilityState]) === "hidden" && delegates.canZombie();
3435
3452
  return canZombie ? "@idle.zombie" : sendHeartbeat;
3436
3453
  };
3437
3454
  machine.addTimedTransition("@ok.connected", HEARTBEAT_INTERVAL, maybeHeartbeat).addTransitions("@ok.connected", {
@@ -3470,7 +3487,7 @@ function createConnectionStateMachine(delegates, options) {
3470
3487
  // socket, or not. So always check to see if the socket is still OPEN or
3471
3488
  // not. When still OPEN, don't transition.
3472
3489
  EXPLICIT_SOCKET_ERROR: (_, context) => {
3473
- if (_optionalChain([context, 'access', _40 => _40.socket, 'optionalAccess', _41 => _41.readyState]) === 1) {
3490
+ if (_optionalChain([context, 'access', _42 => _42.socket, 'optionalAccess', _43 => _43.readyState]) === 1) {
3474
3491
  return null;
3475
3492
  }
3476
3493
  return {
@@ -3522,17 +3539,17 @@ function createConnectionStateMachine(delegates, options) {
3522
3539
  machine.send({ type: "NAVIGATOR_ONLINE" });
3523
3540
  }
3524
3541
  function onVisibilityChange() {
3525
- if (_optionalChain([doc, 'optionalAccess', _42 => _42.visibilityState]) === "visible") {
3542
+ if (_optionalChain([doc, 'optionalAccess', _44 => _44.visibilityState]) === "visible") {
3526
3543
  machine.send({ type: "WINDOW_GOT_FOCUS" });
3527
3544
  }
3528
3545
  }
3529
- _optionalChain([win, 'optionalAccess', _43 => _43.addEventListener, 'call', _44 => _44("online", onNetworkBackOnline)]);
3530
- _optionalChain([win, 'optionalAccess', _45 => _45.addEventListener, 'call', _46 => _46("offline", onNetworkOffline)]);
3531
- _optionalChain([root, 'optionalAccess', _47 => _47.addEventListener, 'call', _48 => _48("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)]);
3532
3549
  return () => {
3533
- _optionalChain([root, 'optionalAccess', _49 => _49.removeEventListener, 'call', _50 => _50("visibilitychange", onVisibilityChange)]);
3534
- _optionalChain([win, 'optionalAccess', _51 => _51.removeEventListener, 'call', _52 => _52("online", onNetworkBackOnline)]);
3535
- _optionalChain([win, 'optionalAccess', _53 => _53.removeEventListener, 'call', _54 => _54("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)]);
3536
3553
  teardownSocket(ctx.socket);
3537
3554
  };
3538
3555
  });
@@ -3621,7 +3638,7 @@ var ManagedSocket = class {
3621
3638
  * message if this is somehow impossible.
3622
3639
  */
3623
3640
  send(data) {
3624
- const socket = _optionalChain([this, 'access', _55 => _55.#machine, 'access', _56 => _56.context, 'optionalAccess', _57 => _57.socket]);
3641
+ const socket = _optionalChain([this, 'access', _57 => _57.#machine, 'access', _58 => _58.context, 'optionalAccess', _59 => _59.socket]);
3625
3642
  if (socket === null) {
3626
3643
  warn("Cannot send: not connected yet", data);
3627
3644
  } else if (socket.readyState !== 1) {
@@ -4059,7 +4076,7 @@ function replaceOrAppend(content, newItem, keyFn, now2) {
4059
4076
  }
4060
4077
  }
4061
4078
  function closePart(prevPart, endedAt) {
4062
- if (_optionalChain([prevPart, 'optionalAccess', _58 => _58.type]) === "reasoning") {
4079
+ if (_optionalChain([prevPart, 'optionalAccess', _60 => _60.type]) === "reasoning") {
4063
4080
  prevPart.endedAt ??= endedAt;
4064
4081
  }
4065
4082
  }
@@ -4070,7 +4087,7 @@ function patchContentWithDelta(content, delta) {
4070
4087
  const lastPart = content[content.length - 1];
4071
4088
  switch (delta.type) {
4072
4089
  case "text-delta":
4073
- if (_optionalChain([lastPart, 'optionalAccess', _59 => _59.type]) === "text") {
4090
+ if (_optionalChain([lastPart, 'optionalAccess', _61 => _61.type]) === "text") {
4074
4091
  lastPart.text += delta.textDelta;
4075
4092
  } else {
4076
4093
  closePart(lastPart, now2);
@@ -4078,13 +4095,13 @@ function patchContentWithDelta(content, delta) {
4078
4095
  }
4079
4096
  break;
4080
4097
  case "reasoning-delta":
4081
- if (_optionalChain([lastPart, 'optionalAccess', _60 => _60.type]) === "reasoning") {
4098
+ if (_optionalChain([lastPart, 'optionalAccess', _62 => _62.type]) === "reasoning") {
4082
4099
  lastPart.text += delta.textDelta;
4083
4100
  } else {
4084
4101
  closePart(lastPart, now2);
4085
4102
  content.push({
4086
4103
  type: "reasoning",
4087
- text: _nullishCoalesce(delta.textDelta, () => ( "")),
4104
+ text: delta.textDelta,
4088
4105
  startedAt: now2
4089
4106
  });
4090
4107
  }
@@ -4098,8 +4115,8 @@ function patchContentWithDelta(content, delta) {
4098
4115
  break;
4099
4116
  }
4100
4117
  case "tool-delta": {
4101
- if (_optionalChain([lastPart, 'optionalAccess', _61 => _61.type]) === "tool-invocation" && lastPart.stage === "receiving") {
4102
- _optionalChain([lastPart, 'access', _62 => _62.__appendDelta, 'optionalCall', _63 => _63(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)]);
4103
4120
  }
4104
4121
  break;
4105
4122
  }
@@ -4218,7 +4235,7 @@ function createStore_forTools() {
4218
4235
  return DerivedSignal.from(() => {
4219
4236
  return (
4220
4237
  // A tool that's registered and scoped to a specific chat ID...
4221
- _nullishCoalesce(_optionalChain([(chatId !== void 0 ? toolsByChatId\u03A3.getOrCreate(chatId).getOrCreate(name) : void 0), 'optionalAccess', _64 => _64.get, 'call', _65 => _65()]), () => ( // ...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
4222
4239
  toolsByChatId\u03A3.getOrCreate(kWILDCARD).getOrCreate(name).get()))
4223
4240
  );
4224
4241
  });
@@ -4248,8 +4265,8 @@ function createStore_forTools() {
4248
4265
  const globalTools\u03A3 = toolsByChatId\u03A3.get(kWILDCARD);
4249
4266
  const scopedTools\u03A3 = toolsByChatId\u03A3.get(chatId);
4250
4267
  return Array.from([
4251
- ..._nullishCoalesce(_optionalChain([globalTools\u03A3, 'optionalAccess', _66 => _66.entries, 'call', _67 => _67()]), () => ( [])),
4252
- ..._nullishCoalesce(_optionalChain([scopedTools\u03A3, 'optionalAccess', _68 => _68.entries, 'call', _69 => _69()]), () => ( []))
4268
+ ..._nullishCoalesce(_optionalChain([globalTools\u03A3, 'optionalAccess', _68 => _68.entries, 'call', _69 => _69()]), () => ( [])),
4269
+ ..._nullishCoalesce(_optionalChain([scopedTools\u03A3, 'optionalAccess', _70 => _70.entries, 'call', _71 => _71()]), () => ( []))
4253
4270
  ]).flatMap(([name, tool\u03A3]) => {
4254
4271
  const tool = tool\u03A3.get();
4255
4272
  return tool && (_nullishCoalesce(tool.enabled, () => ( true))) ? [{ name, description: tool.description, parameters: tool.parameters }] : [];
@@ -4352,7 +4369,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
4352
4369
  } else {
4353
4370
  continue;
4354
4371
  }
4355
- const executeFn = _optionalChain([toolsStore, 'access', _70 => _70.getTool\u03A3, 'call', _71 => _71(toolInvocation.name, message.chatId), 'access', _72 => _72.get, 'call', _73 => _73(), 'optionalAccess', _74 => _74.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]);
4356
4373
  if (executeFn) {
4357
4374
  (async () => {
4358
4375
  const result = await executeFn(toolInvocation.args, {
@@ -4451,8 +4468,8 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
4451
4468
  const spine = [];
4452
4469
  let lastVisitedMessage = null;
4453
4470
  for (const message2 of pool.walkUp(leaf.id)) {
4454
- const prev = _nullishCoalesce(_optionalChain([first, 'call', _75 => _75(pool.walkLeft(message2.id, isAlive)), 'optionalAccess', _76 => _76.id]), () => ( null));
4455
- const next = _nullishCoalesce(_optionalChain([first, 'call', _77 => _77(pool.walkRight(message2.id, isAlive)), 'optionalAccess', _78 => _78.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));
4456
4473
  if (!message2.deletedAt || prev || next) {
4457
4474
  const node = {
4458
4475
  ...message2,
@@ -4518,7 +4535,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
4518
4535
  const latest = pool.sorted.findRight(
4519
4536
  (m) => m.role === "assistant" && !m.deletedAt
4520
4537
  );
4521
- return _optionalChain([latest, 'optionalAccess', _79 => _79.copilotId]);
4538
+ return _optionalChain([latest, 'optionalAccess', _81 => _81.copilotId]);
4522
4539
  }
4523
4540
  return {
4524
4541
  // Readers
@@ -4549,11 +4566,11 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
4549
4566
  *getAutoExecutingMessageIds() {
4550
4567
  for (const messageId of myMessages) {
4551
4568
  const message = getMessageById(messageId);
4552
- if (_optionalChain([message, 'optionalAccess', _80 => _80.role]) === "assistant" && message.status === "awaiting-tool") {
4569
+ if (_optionalChain([message, 'optionalAccess', _82 => _82.role]) === "assistant" && message.status === "awaiting-tool") {
4553
4570
  const isAutoExecuting = message.contentSoFar.some((part) => {
4554
4571
  if (part.type === "tool-invocation" && part.stage === "executing") {
4555
4572
  const tool = toolsStore.getTool\u03A3(part.name, message.chatId).get();
4556
- return typeof _optionalChain([tool, 'optionalAccess', _81 => _81.execute]) === "function";
4573
+ return typeof _optionalChain([tool, 'optionalAccess', _83 => _83.execute]) === "function";
4557
4574
  }
4558
4575
  return false;
4559
4576
  });
@@ -4698,7 +4715,7 @@ function createAi(config) {
4698
4715
  flushPendingDeltas();
4699
4716
  switch (msg.event) {
4700
4717
  case "cmd-failed":
4701
- _optionalChain([pendingCmd, 'optionalAccess', _82 => _82.reject, 'call', _83 => _83(new Error(msg.error))]);
4718
+ _optionalChain([pendingCmd, 'optionalAccess', _84 => _84.reject, 'call', _85 => _85(new Error(msg.error))]);
4702
4719
  break;
4703
4720
  case "settle": {
4704
4721
  context.messagesStore.upsert(msg.message);
@@ -4775,7 +4792,7 @@ function createAi(config) {
4775
4792
  return assertNever(msg, "Unhandled case");
4776
4793
  }
4777
4794
  }
4778
- _optionalChain([pendingCmd, 'optionalAccess', _84 => _84.resolve, 'call', _85 => _85(msg)]);
4795
+ _optionalChain([pendingCmd, 'optionalAccess', _86 => _86.resolve, 'call', _87 => _87(msg)]);
4779
4796
  }
4780
4797
  managedSocket.events.onMessage.subscribe(handleServerMessage);
4781
4798
  managedSocket.events.statusDidChange.subscribe(onStatusDidChange);
@@ -4860,9 +4877,9 @@ function createAi(config) {
4860
4877
  invocationId,
4861
4878
  result,
4862
4879
  generationOptions: {
4863
- copilotId: _optionalChain([options, 'optionalAccess', _86 => _86.copilotId]),
4864
- stream: _optionalChain([options, 'optionalAccess', _87 => _87.stream]),
4865
- timeout: _optionalChain([options, 'optionalAccess', _88 => _88.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]),
4866
4883
  // Knowledge and tools aren't coming from the options, but retrieved
4867
4884
  // from the global context
4868
4885
  knowledge: knowledge.length > 0 ? knowledge : void 0,
@@ -4880,7 +4897,7 @@ function createAi(config) {
4880
4897
  }
4881
4898
  }
4882
4899
  const win = typeof window !== "undefined" ? window : void 0;
4883
- _optionalChain([win, 'optionalAccess', _89 => _89.addEventListener, 'call', _90 => _90("beforeunload", handleBeforeUnload, { once: true })]);
4900
+ _optionalChain([win, 'optionalAccess', _91 => _91.addEventListener, 'call', _92 => _92("beforeunload", handleBeforeUnload, { once: true })]);
4884
4901
  return Object.defineProperty(
4885
4902
  {
4886
4903
  [kInternal]: {
@@ -4899,7 +4916,7 @@ function createAi(config) {
4899
4916
  clearChat: (chatId) => sendClientMsgWithResponse({ cmd: "clear-chat", chatId }),
4900
4917
  askUserMessageInChat: async (chatId, userMessage, targetMessageId, options) => {
4901
4918
  const globalKnowledge = context.knowledge.get();
4902
- const requestKnowledge = _optionalChain([options, 'optionalAccess', _91 => _91.knowledge]) || [];
4919
+ const requestKnowledge = _optionalChain([options, 'optionalAccess', _93 => _93.knowledge]) || [];
4903
4920
  const combinedKnowledge = [...globalKnowledge, ...requestKnowledge];
4904
4921
  const tools = context.toolsStore.getToolDescriptions(chatId);
4905
4922
  messagesStore.markMine(targetMessageId);
@@ -4909,9 +4926,9 @@ function createAi(config) {
4909
4926
  sourceMessage: userMessage,
4910
4927
  targetMessageId,
4911
4928
  generationOptions: {
4912
- copilotId: _optionalChain([options, 'optionalAccess', _92 => _92.copilotId]),
4913
- stream: _optionalChain([options, 'optionalAccess', _93 => _93.stream]),
4914
- timeout: _optionalChain([options, 'optionalAccess', _94 => _94.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]),
4915
4932
  // Combine global knowledge with request-specific knowledge
4916
4933
  knowledge: combinedKnowledge.length > 0 ? combinedKnowledge : void 0,
4917
4934
  tools: tools.length > 0 ? tools : void 0
@@ -5012,7 +5029,7 @@ function createAuthManager(authOptions, onAuthenticate) {
5012
5029
  return void 0;
5013
5030
  }
5014
5031
  async function makeAuthRequest(options) {
5015
- const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _95 => _95.polyfills, 'optionalAccess', _96 => _96.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)));
5016
5033
  if (authentication.type === "private") {
5017
5034
  if (fetcher === void 0) {
5018
5035
  throw new StopRetrying(
@@ -5028,7 +5045,7 @@ function createAuthManager(authOptions, onAuthenticate) {
5028
5045
  "The same Liveblocks auth token was issued from the backend before. Caching Liveblocks tokens is not supported."
5029
5046
  );
5030
5047
  }
5031
- _optionalChain([onAuthenticate, 'optionalCall', _97 => _97(parsed.parsed)]);
5048
+ _optionalChain([onAuthenticate, 'optionalCall', _99 => _99(parsed.parsed)]);
5032
5049
  return parsed;
5033
5050
  }
5034
5051
  if (authentication.type === "custom") {
@@ -5036,7 +5053,7 @@ function createAuthManager(authOptions, onAuthenticate) {
5036
5053
  if (response && typeof response === "object") {
5037
5054
  if (typeof response.token === "string") {
5038
5055
  const parsed = parseAuthToken(response.token);
5039
- _optionalChain([onAuthenticate, 'optionalCall', _98 => _98(parsed.parsed)]);
5056
+ _optionalChain([onAuthenticate, 'optionalCall', _100 => _100(parsed.parsed)]);
5040
5057
  return parsed;
5041
5058
  } else if (typeof response.error === "string") {
5042
5059
  const reason = `Authentication failed: ${"reason" in response && typeof response.reason === "string" ? response.reason : "Forbidden"}`;
@@ -5195,7 +5212,7 @@ function sendToPanel(message, options) {
5195
5212
  ...message,
5196
5213
  source: "liveblocks-devtools-client"
5197
5214
  };
5198
- if (!(_optionalChain([options, 'optionalAccess', _99 => _99.force]) || _bridgeActive)) {
5215
+ if (!(_optionalChain([options, 'optionalAccess', _101 => _101.force]) || _bridgeActive)) {
5199
5216
  return;
5200
5217
  }
5201
5218
  window.postMessage(fullMsg, "*");
@@ -5203,7 +5220,7 @@ function sendToPanel(message, options) {
5203
5220
  var eventSource = makeEventSource();
5204
5221
  if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
5205
5222
  window.addEventListener("message", (event) => {
5206
- if (event.source === window && _optionalChain([event, 'access', _100 => _100.data, 'optionalAccess', _101 => _101.source]) === "liveblocks-devtools-panel") {
5223
+ if (event.source === window && _optionalChain([event, 'access', _102 => _102.data, 'optionalAccess', _103 => _103.source]) === "liveblocks-devtools-panel") {
5207
5224
  eventSource.notify(event.data);
5208
5225
  } else {
5209
5226
  }
@@ -5345,7 +5362,7 @@ function fullSync(room) {
5345
5362
  msg: "room::sync::full",
5346
5363
  roomId: room.id,
5347
5364
  status: room.getStatus(),
5348
- storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _102 => _102.toTreeNode, 'call', _103 => _103("root"), 'access', _104 => _104.payload]), () => ( null)),
5365
+ storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _104 => _104.toTreeNode, 'call', _105 => _105("root"), 'access', _106 => _106.payload]), () => ( null)),
5349
5366
  me,
5350
5367
  others
5351
5368
  });
@@ -5652,7 +5669,7 @@ function createManagedPool(roomId, options) {
5652
5669
  generateId: () => `${getCurrentConnectionId()}:${clock++}`,
5653
5670
  generateOpId: () => `${getCurrentConnectionId()}:${opClock++}`,
5654
5671
  dispatch(ops, reverse, storageUpdates) {
5655
- _optionalChain([onDispatch, 'optionalCall', _105 => _105(ops, reverse, storageUpdates)]);
5672
+ _optionalChain([onDispatch, 'optionalCall', _107 => _107(ops, reverse, storageUpdates)]);
5656
5673
  },
5657
5674
  assertStorageIsWritable: () => {
5658
5675
  if (!isStorageWritable()) {
@@ -5879,7 +5896,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
5879
5896
  return [
5880
5897
  {
5881
5898
  type: 8 /* CREATE_REGISTER */,
5882
- opId: _optionalChain([pool, 'optionalAccess', _106 => _106.generateOpId, 'call', _107 => _107()]),
5899
+ opId: _optionalChain([pool, 'optionalAccess', _108 => _108.generateOpId, 'call', _109 => _109()]),
5883
5900
  id: this._id,
5884
5901
  parentId,
5885
5902
  parentKey,
@@ -5985,7 +6002,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
5985
6002
  const ops = [];
5986
6003
  const op = {
5987
6004
  id: this._id,
5988
- opId: _optionalChain([pool, 'optionalAccess', _108 => _108.generateOpId, 'call', _109 => _109()]),
6005
+ opId: _optionalChain([pool, 'optionalAccess', _110 => _110.generateOpId, 'call', _111 => _111()]),
5989
6006
  type: 2 /* CREATE_LIST */,
5990
6007
  parentId,
5991
6008
  parentKey
@@ -6256,7 +6273,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6256
6273
  #applyInsertUndoRedo(op) {
6257
6274
  const { id, parentKey: key } = op;
6258
6275
  const child = creationOpToLiveNode(op);
6259
- if (_optionalChain([this, 'access', _110 => _110._pool, 'optionalAccess', _111 => _111.getNode, 'call', _112 => _112(id)]) !== void 0) {
6276
+ if (_optionalChain([this, 'access', _112 => _112._pool, 'optionalAccess', _113 => _113.getNode, 'call', _114 => _114(id)]) !== void 0) {
6260
6277
  return { modified: false };
6261
6278
  }
6262
6279
  child._attach(id, nn(this._pool));
@@ -6264,8 +6281,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
6264
6281
  const existingItemIndex = this._indexOfPosition(key);
6265
6282
  let newKey = key;
6266
6283
  if (existingItemIndex !== -1) {
6267
- const before2 = _optionalChain([this, 'access', _113 => _113.#items, 'access', _114 => _114[existingItemIndex], 'optionalAccess', _115 => _115._parentPos]);
6268
- const after2 = _optionalChain([this, 'access', _116 => _116.#items, 'access', _117 => _117[existingItemIndex + 1], 'optionalAccess', _118 => _118._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]);
6269
6286
  newKey = makePosition(before2, after2);
6270
6287
  child._setParentLink(this, newKey);
6271
6288
  }
@@ -6279,7 +6296,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6279
6296
  #applySetUndoRedo(op) {
6280
6297
  const { id, parentKey: key } = op;
6281
6298
  const child = creationOpToLiveNode(op);
6282
- if (_optionalChain([this, 'access', _119 => _119._pool, 'optionalAccess', _120 => _120.getNode, 'call', _121 => _121(id)]) !== void 0) {
6299
+ if (_optionalChain([this, 'access', _121 => _121._pool, 'optionalAccess', _122 => _122.getNode, 'call', _123 => _123(id)]) !== void 0) {
6283
6300
  return { modified: false };
6284
6301
  }
6285
6302
  this.#unacknowledgedSets.set(key, nn(op.opId));
@@ -6400,7 +6417,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6400
6417
  } else {
6401
6418
  this.#items[existingItemIndex]._setParentLink(
6402
6419
  this,
6403
- makePosition(newKey, _optionalChain([this, 'access', _122 => _122.#items, 'access', _123 => _123[existingItemIndex + 1], 'optionalAccess', _124 => _124._parentPos]))
6420
+ makePosition(newKey, _optionalChain([this, 'access', _124 => _124.#items, 'access', _125 => _125[existingItemIndex + 1], 'optionalAccess', _126 => _126._parentPos]))
6404
6421
  );
6405
6422
  const previousIndex = this.#items.indexOf(child);
6406
6423
  child._setParentLink(this, newKey);
@@ -6425,7 +6442,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6425
6442
  if (existingItemIndex !== -1) {
6426
6443
  this.#items[existingItemIndex]._setParentLink(
6427
6444
  this,
6428
- makePosition(newKey, _optionalChain([this, 'access', _125 => _125.#items, 'access', _126 => _126[existingItemIndex + 1], 'optionalAccess', _127 => _127._parentPos]))
6445
+ makePosition(newKey, _optionalChain([this, 'access', _127 => _127.#items, 'access', _128 => _128[existingItemIndex + 1], 'optionalAccess', _129 => _129._parentPos]))
6429
6446
  );
6430
6447
  }
6431
6448
  child._setParentLink(this, newKey);
@@ -6444,7 +6461,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6444
6461
  if (existingItemIndex !== -1) {
6445
6462
  this.#items[existingItemIndex]._setParentLink(
6446
6463
  this,
6447
- makePosition(newKey, _optionalChain([this, 'access', _128 => _128.#items, 'access', _129 => _129[existingItemIndex + 1], 'optionalAccess', _130 => _130._parentPos]))
6464
+ makePosition(newKey, _optionalChain([this, 'access', _130 => _130.#items, 'access', _131 => _131[existingItemIndex + 1], 'optionalAccess', _132 => _132._parentPos]))
6448
6465
  );
6449
6466
  }
6450
6467
  child._setParentLink(this, newKey);
@@ -6468,13 +6485,14 @@ var LiveList = class _LiveList extends AbstractCrdt {
6468
6485
  const previousKey = nn(child._parentKey);
6469
6486
  const previousIndex = this.#items.indexOf(child);
6470
6487
  const existingItemIndex = this._indexOfPosition(newKey);
6488
+ let actualNewKey = newKey;
6471
6489
  if (existingItemIndex !== -1) {
6472
- this.#items[existingItemIndex]._setParentLink(
6473
- this,
6474
- makePosition(newKey, _optionalChain([this, 'access', _131 => _131.#items, 'access', _132 => _132[existingItemIndex + 1], 'optionalAccess', _133 => _133._parentPos]))
6490
+ actualNewKey = makePosition(
6491
+ newKey,
6492
+ _optionalChain([this, 'access', _133 => _133.#items, 'access', _134 => _134[existingItemIndex + 1], 'optionalAccess', _135 => _135._parentPos])
6475
6493
  );
6476
6494
  }
6477
- child._setParentLink(this, newKey);
6495
+ child._setParentLink(this, actualNewKey);
6478
6496
  this._sortItems();
6479
6497
  const newIndex = this.#items.indexOf(child);
6480
6498
  if (previousIndex === newIndex) {
@@ -6529,7 +6547,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6529
6547
  * @param element The element to add to the end of the LiveList.
6530
6548
  */
6531
6549
  push(element) {
6532
- _optionalChain([this, 'access', _134 => _134._pool, 'optionalAccess', _135 => _135.assertStorageIsWritable, 'call', _136 => _136()]);
6550
+ _optionalChain([this, 'access', _136 => _136._pool, 'optionalAccess', _137 => _137.assertStorageIsWritable, 'call', _138 => _138()]);
6533
6551
  return this.insert(element, this.length);
6534
6552
  }
6535
6553
  /**
@@ -6538,7 +6556,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6538
6556
  * @param index The index at which you want to insert the element.
6539
6557
  */
6540
6558
  insert(element, index) {
6541
- _optionalChain([this, 'access', _137 => _137._pool, 'optionalAccess', _138 => _138.assertStorageIsWritable, 'call', _139 => _139()]);
6559
+ _optionalChain([this, 'access', _139 => _139._pool, 'optionalAccess', _140 => _140.assertStorageIsWritable, 'call', _141 => _141()]);
6542
6560
  if (index < 0 || index > this.#items.length) {
6543
6561
  throw new Error(
6544
6562
  `Cannot insert list item at index "${index}". index should be between 0 and ${this.#items.length}`
@@ -6568,7 +6586,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6568
6586
  * @param targetIndex The index where the element should be after moving.
6569
6587
  */
6570
6588
  move(index, targetIndex) {
6571
- _optionalChain([this, 'access', _140 => _140._pool, 'optionalAccess', _141 => _141.assertStorageIsWritable, 'call', _142 => _142()]);
6589
+ _optionalChain([this, 'access', _142 => _142._pool, 'optionalAccess', _143 => _143.assertStorageIsWritable, 'call', _144 => _144()]);
6572
6590
  if (targetIndex < 0) {
6573
6591
  throw new Error("targetIndex cannot be less than 0");
6574
6592
  }
@@ -6626,7 +6644,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6626
6644
  * @param index The index of the element to delete
6627
6645
  */
6628
6646
  delete(index) {
6629
- _optionalChain([this, 'access', _143 => _143._pool, 'optionalAccess', _144 => _144.assertStorageIsWritable, 'call', _145 => _145()]);
6647
+ _optionalChain([this, 'access', _145 => _145._pool, 'optionalAccess', _146 => _146.assertStorageIsWritable, 'call', _147 => _147()]);
6630
6648
  if (index < 0 || index >= this.#items.length) {
6631
6649
  throw new Error(
6632
6650
  `Cannot delete list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
@@ -6659,7 +6677,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6659
6677
  }
6660
6678
  }
6661
6679
  clear() {
6662
- _optionalChain([this, 'access', _146 => _146._pool, 'optionalAccess', _147 => _147.assertStorageIsWritable, 'call', _148 => _148()]);
6680
+ _optionalChain([this, 'access', _148 => _148._pool, 'optionalAccess', _149 => _149.assertStorageIsWritable, 'call', _150 => _150()]);
6663
6681
  if (this._pool) {
6664
6682
  const ops = [];
6665
6683
  const reverseOps = [];
@@ -6693,7 +6711,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6693
6711
  }
6694
6712
  }
6695
6713
  set(index, item) {
6696
- _optionalChain([this, 'access', _149 => _149._pool, 'optionalAccess', _150 => _150.assertStorageIsWritable, 'call', _151 => _151()]);
6714
+ _optionalChain([this, 'access', _151 => _151._pool, 'optionalAccess', _152 => _152.assertStorageIsWritable, 'call', _153 => _153()]);
6697
6715
  if (index < 0 || index >= this.#items.length) {
6698
6716
  throw new Error(
6699
6717
  `Cannot set list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
@@ -6839,7 +6857,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6839
6857
  #shiftItemPosition(index, key) {
6840
6858
  const shiftedPosition = makePosition(
6841
6859
  key,
6842
- this.#items.length > index + 1 ? _optionalChain([this, 'access', _152 => _152.#items, 'access', _153 => _153[index + 1], 'optionalAccess', _154 => _154._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
6843
6861
  );
6844
6862
  this.#items[index]._setParentLink(this, shiftedPosition);
6845
6863
  }
@@ -6964,7 +6982,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
6964
6982
  const ops = [];
6965
6983
  const op = {
6966
6984
  id: this._id,
6967
- opId: _optionalChain([pool, 'optionalAccess', _155 => _155.generateOpId, 'call', _156 => _156()]),
6985
+ opId: _optionalChain([pool, 'optionalAccess', _157 => _157.generateOpId, 'call', _158 => _158()]),
6968
6986
  type: 7 /* CREATE_MAP */,
6969
6987
  parentId,
6970
6988
  parentKey
@@ -7099,7 +7117,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7099
7117
  * @param value The value of the element to add. Should be serializable to JSON.
7100
7118
  */
7101
7119
  set(key, value) {
7102
- _optionalChain([this, 'access', _157 => _157._pool, 'optionalAccess', _158 => _158.assertStorageIsWritable, 'call', _159 => _159()]);
7120
+ _optionalChain([this, 'access', _159 => _159._pool, 'optionalAccess', _160 => _160.assertStorageIsWritable, 'call', _161 => _161()]);
7103
7121
  const oldValue = this.#map.get(key);
7104
7122
  if (oldValue) {
7105
7123
  oldValue._detach();
@@ -7145,7 +7163,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7145
7163
  * @returns true if an element existed and has been removed, or false if the element does not exist.
7146
7164
  */
7147
7165
  delete(key) {
7148
- _optionalChain([this, 'access', _160 => _160._pool, 'optionalAccess', _161 => _161.assertStorageIsWritable, 'call', _162 => _162()]);
7166
+ _optionalChain([this, 'access', _162 => _162._pool, 'optionalAccess', _163 => _163.assertStorageIsWritable, 'call', _164 => _164()]);
7149
7167
  const item = this.#map.get(key);
7150
7168
  if (item === void 0) {
7151
7169
  return false;
@@ -7335,7 +7353,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7335
7353
  if (this._id === void 0) {
7336
7354
  throw new Error("Cannot serialize item is not attached");
7337
7355
  }
7338
- const opId = _optionalChain([pool, 'optionalAccess', _163 => _163.generateOpId, 'call', _164 => _164()]);
7356
+ const opId = _optionalChain([pool, 'optionalAccess', _165 => _165.generateOpId, 'call', _166 => _166()]);
7339
7357
  const ops = [];
7340
7358
  const op = {
7341
7359
  type: 4 /* CREATE_OBJECT */,
@@ -7607,7 +7625,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7607
7625
  * @param value The value of the property to add
7608
7626
  */
7609
7627
  set(key, value) {
7610
- _optionalChain([this, 'access', _165 => _165._pool, 'optionalAccess', _166 => _166.assertStorageIsWritable, 'call', _167 => _167()]);
7628
+ _optionalChain([this, 'access', _167 => _167._pool, 'optionalAccess', _168 => _168.assertStorageIsWritable, 'call', _169 => _169()]);
7611
7629
  this.update({ [key]: value });
7612
7630
  }
7613
7631
  /**
@@ -7622,7 +7640,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7622
7640
  * @param key The key of the property to delete
7623
7641
  */
7624
7642
  delete(key) {
7625
- _optionalChain([this, 'access', _168 => _168._pool, 'optionalAccess', _169 => _169.assertStorageIsWritable, 'call', _170 => _170()]);
7643
+ _optionalChain([this, 'access', _170 => _170._pool, 'optionalAccess', _171 => _171.assertStorageIsWritable, 'call', _172 => _172()]);
7626
7644
  const keyAsString = key;
7627
7645
  const oldValue = this.#map.get(keyAsString);
7628
7646
  if (oldValue === void 0) {
@@ -7675,7 +7693,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7675
7693
  * @param patch The object used to overrides properties
7676
7694
  */
7677
7695
  update(patch) {
7678
- _optionalChain([this, 'access', _171 => _171._pool, 'optionalAccess', _172 => _172.assertStorageIsWritable, 'call', _173 => _173()]);
7696
+ _optionalChain([this, 'access', _173 => _173._pool, 'optionalAccess', _174 => _174.assertStorageIsWritable, 'call', _175 => _175()]);
7679
7697
  if (_LiveObject.detectLargeObjects) {
7680
7698
  const data = {};
7681
7699
  for (const [key, value] of this.#map) {
@@ -8423,15 +8441,15 @@ function installBackgroundTabSpy() {
8423
8441
  const doc = typeof document !== "undefined" ? document : void 0;
8424
8442
  const inBackgroundSince = { current: null };
8425
8443
  function onVisibilityChange() {
8426
- if (_optionalChain([doc, 'optionalAccess', _174 => _174.visibilityState]) === "hidden") {
8444
+ if (_optionalChain([doc, 'optionalAccess', _176 => _176.visibilityState]) === "hidden") {
8427
8445
  inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
8428
8446
  } else {
8429
8447
  inBackgroundSince.current = null;
8430
8448
  }
8431
8449
  }
8432
- _optionalChain([doc, 'optionalAccess', _175 => _175.addEventListener, 'call', _176 => _176("visibilitychange", onVisibilityChange)]);
8450
+ _optionalChain([doc, 'optionalAccess', _177 => _177.addEventListener, 'call', _178 => _178("visibilitychange", onVisibilityChange)]);
8433
8451
  const unsub = () => {
8434
- _optionalChain([doc, 'optionalAccess', _177 => _177.removeEventListener, 'call', _178 => _178("visibilitychange", onVisibilityChange)]);
8452
+ _optionalChain([doc, 'optionalAccess', _179 => _179.removeEventListener, 'call', _180 => _180("visibilitychange", onVisibilityChange)]);
8435
8453
  };
8436
8454
  return [inBackgroundSince, unsub];
8437
8455
  }
@@ -8611,7 +8629,7 @@ function createRoom(options, config) {
8611
8629
  }
8612
8630
  }
8613
8631
  function isStorageWritable() {
8614
- const scopes = _optionalChain([context, 'access', _179 => _179.dynamicSessionInfoSig, 'access', _180 => _180.get, 'call', _181 => _181(), 'optionalAccess', _182 => _182.scopes]);
8632
+ const scopes = _optionalChain([context, 'access', _181 => _181.dynamicSessionInfoSig, 'access', _182 => _182.get, 'call', _183 => _183(), 'optionalAccess', _184 => _184.scopes]);
8615
8633
  return scopes !== void 0 ? canWriteStorage(scopes) : true;
8616
8634
  }
8617
8635
  const eventHub = {
@@ -8737,7 +8755,7 @@ function createRoom(options, config) {
8737
8755
  }
8738
8756
  case "experimental-fallback-to-http": {
8739
8757
  warn("Message is too large for websockets, so sending over HTTP instead");
8740
- const nonce = _nullishCoalesce(_optionalChain([context, 'access', _183 => _183.dynamicSessionInfoSig, 'access', _184 => _184.get, 'call', _185 => _185(), 'optionalAccess', _186 => _186.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")));
8741
8759
  void httpClient.sendMessages({ roomId, nonce, messages }).then((resp) => {
8742
8760
  if (!resp.ok && resp.status === 403) {
8743
8761
  managedSocket.reconnect();
@@ -8788,7 +8806,7 @@ function createRoom(options, config) {
8788
8806
  } else {
8789
8807
  context.root = LiveObject._fromItems(message.items, context.pool);
8790
8808
  }
8791
- const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _187 => _187.get, 'call', _188 => _188(), 'optionalAccess', _189 => _189.canWrite]), () => ( true));
8809
+ const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _189 => _189.get, 'call', _190 => _190(), 'optionalAccess', _191 => _191.canWrite]), () => ( true));
8792
8810
  const stackSizeBefore = context.undoStack.length;
8793
8811
  for (const key in context.initialStorage) {
8794
8812
  if (context.root.get(key) === void 0) {
@@ -8991,7 +9009,7 @@ function createRoom(options, config) {
8991
9009
  }
8992
9010
  context.myPresence.patch(patch);
8993
9011
  if (context.activeBatch) {
8994
- if (_optionalChain([options2, 'optionalAccess', _190 => _190.addToHistory])) {
9012
+ if (_optionalChain([options2, 'optionalAccess', _192 => _192.addToHistory])) {
8995
9013
  context.activeBatch.reverseOps.pushLeft({
8996
9014
  type: "presence",
8997
9015
  data: oldValues
@@ -9000,7 +9018,7 @@ function createRoom(options, config) {
9000
9018
  context.activeBatch.updates.presence = true;
9001
9019
  } else {
9002
9020
  flushNowOrSoon();
9003
- if (_optionalChain([options2, 'optionalAccess', _191 => _191.addToHistory])) {
9021
+ if (_optionalChain([options2, 'optionalAccess', _193 => _193.addToHistory])) {
9004
9022
  addToUndoStack([{ type: "presence", data: oldValues }]);
9005
9023
  }
9006
9024
  notify({ presence: true });
@@ -9197,7 +9215,7 @@ function createRoom(options, config) {
9197
9215
  if (process.env.NODE_ENV !== "production") {
9198
9216
  const traces = /* @__PURE__ */ new Set();
9199
9217
  for (const opId of message.opIds) {
9200
- const trace = _optionalChain([context, 'access', _192 => _192.opStackTraces, 'optionalAccess', _193 => _193.get, 'call', _194 => _194(opId)]);
9218
+ const trace = _optionalChain([context, 'access', _194 => _194.opStackTraces, 'optionalAccess', _195 => _195.get, 'call', _196 => _196(opId)]);
9201
9219
  if (trace) {
9202
9220
  traces.add(trace);
9203
9221
  }
@@ -9331,7 +9349,7 @@ ${Array.from(traces).join("\n\n")}`
9331
9349
  const unacknowledgedOps = new Map(context.unacknowledgedOps);
9332
9350
  createOrUpdateRootFromMessage(message);
9333
9351
  applyAndSendOps(unacknowledgedOps);
9334
- _optionalChain([_resolveStoragePromise, 'optionalCall', _195 => _195()]);
9352
+ _optionalChain([_resolveStoragePromise, 'optionalCall', _197 => _197()]);
9335
9353
  notifyStorageStatus();
9336
9354
  eventHub.storageDidLoad.notify();
9337
9355
  }
@@ -9552,8 +9570,8 @@ ${Array.from(traces).join("\n\n")}`
9552
9570
  async function getThreads(options2) {
9553
9571
  return httpClient.getThreads({
9554
9572
  roomId,
9555
- query: _optionalChain([options2, 'optionalAccess', _196 => _196.query]),
9556
- cursor: _optionalChain([options2, 'optionalAccess', _197 => _197.cursor])
9573
+ query: _optionalChain([options2, 'optionalAccess', _198 => _198.query]),
9574
+ cursor: _optionalChain([options2, 'optionalAccess', _199 => _199.cursor])
9557
9575
  });
9558
9576
  }
9559
9577
  async function getThread(threadId) {
@@ -9660,7 +9678,7 @@ ${Array.from(traces).join("\n\n")}`
9660
9678
  function getSubscriptionSettings(options2) {
9661
9679
  return httpClient.getSubscriptionSettings({
9662
9680
  roomId,
9663
- signal: _optionalChain([options2, 'optionalAccess', _198 => _198.signal])
9681
+ signal: _optionalChain([options2, 'optionalAccess', _200 => _200.signal])
9664
9682
  });
9665
9683
  }
9666
9684
  function updateSubscriptionSettings(settings) {
@@ -9682,7 +9700,7 @@ ${Array.from(traces).join("\n\n")}`
9682
9700
  {
9683
9701
  [kInternal]: {
9684
9702
  get presenceBuffer() {
9685
- return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _199 => _199.buffer, 'access', _200 => _200.presenceUpdates, 'optionalAccess', _201 => _201.data]), () => ( null)));
9703
+ return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _201 => _201.buffer, 'access', _202 => _202.presenceUpdates, 'optionalAccess', _203 => _203.data]), () => ( null)));
9686
9704
  },
9687
9705
  // prettier-ignore
9688
9706
  get undoStack() {
@@ -9697,9 +9715,9 @@ ${Array.from(traces).join("\n\n")}`
9697
9715
  return context.yjsProvider;
9698
9716
  },
9699
9717
  setYjsProvider(newProvider) {
9700
- _optionalChain([context, 'access', _202 => _202.yjsProvider, 'optionalAccess', _203 => _203.off, 'call', _204 => _204("status", yjsStatusDidChange)]);
9718
+ _optionalChain([context, 'access', _204 => _204.yjsProvider, 'optionalAccess', _205 => _205.off, 'call', _206 => _206("status", yjsStatusDidChange)]);
9701
9719
  context.yjsProvider = newProvider;
9702
- _optionalChain([newProvider, 'optionalAccess', _205 => _205.on, 'call', _206 => _206("status", yjsStatusDidChange)]);
9720
+ _optionalChain([newProvider, 'optionalAccess', _207 => _207.on, 'call', _208 => _208("status", yjsStatusDidChange)]);
9703
9721
  context.yjsProviderDidChange.notify();
9704
9722
  },
9705
9723
  yjsProviderDidChange: context.yjsProviderDidChange.observable,
@@ -9745,7 +9763,7 @@ ${Array.from(traces).join("\n\n")}`
9745
9763
  source.dispose();
9746
9764
  }
9747
9765
  eventHub.roomWillDestroy.notify();
9748
- _optionalChain([context, 'access', _207 => _207.yjsProvider, 'optionalAccess', _208 => _208.off, 'call', _209 => _209("status", yjsStatusDidChange)]);
9766
+ _optionalChain([context, 'access', _209 => _209.yjsProvider, 'optionalAccess', _210 => _210.off, 'call', _211 => _211("status", yjsStatusDidChange)]);
9749
9767
  syncSourceForStorage.destroy();
9750
9768
  syncSourceForYjs.destroy();
9751
9769
  uninstallBgTabSpy();
@@ -9895,7 +9913,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
9895
9913
  }
9896
9914
  if (isLiveNode(first)) {
9897
9915
  const node = first;
9898
- if (_optionalChain([options, 'optionalAccess', _210 => _210.isDeep])) {
9916
+ if (_optionalChain([options, 'optionalAccess', _212 => _212.isDeep])) {
9899
9917
  const storageCallback = second;
9900
9918
  return subscribeToLiveStructureDeeply(node, storageCallback);
9901
9919
  } else {
@@ -9962,7 +9980,7 @@ function getBaseUrl(baseUrl) {
9962
9980
  }
9963
9981
  function createClient(options) {
9964
9982
  const clientOptions = options;
9965
- const throttleDelay = getThrottle(_nullishCoalesce(clientOptions.throttle, () => ( DEFAULT_THROTTLE)));
9983
+ const throttleDelay = process.env.NODE_ENV !== "production" && clientOptions.__DANGEROUSLY_disableThrottling ? 0 : getThrottle(_nullishCoalesce(clientOptions.throttle, () => ( DEFAULT_THROTTLE)));
9966
9984
  const lostConnectionTimeout = getLostConnectionTimeout(
9967
9985
  _nullishCoalesce(clientOptions.lostConnectionTimeout, () => ( DEFAULT_LOST_CONNECTION_TIMEOUT))
9968
9986
  );
@@ -9975,8 +9993,8 @@ function createClient(options) {
9975
9993
  const userId = token.k === "sec-legacy" /* SECRET_LEGACY */ ? token.id : token.uid;
9976
9994
  currentUserId.set(() => userId);
9977
9995
  });
9978
- const fetchPolyfill = _optionalChain([clientOptions, 'access', _211 => _211.polyfills, 'optionalAccess', _212 => _212.fetch]) || /* istanbul ignore next */
9979
- _optionalChain([globalThis, 'access', _213 => _213.fetch, 'optionalAccess', _214 => _214.bind, 'call', _215 => _215(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)]);
9980
9998
  const httpClient = createApiClient({
9981
9999
  baseUrl,
9982
10000
  fetchPolyfill,
@@ -9994,7 +10012,7 @@ function createClient(options) {
9994
10012
  delegates: {
9995
10013
  createSocket: makeCreateSocketDelegateForAi(
9996
10014
  baseUrl,
9997
- _optionalChain([clientOptions, 'access', _216 => _216.polyfills, 'optionalAccess', _217 => _217.WebSocket])
10015
+ _optionalChain([clientOptions, 'access', _218 => _218.polyfills, 'optionalAccess', _219 => _219.WebSocket])
9998
10016
  ),
9999
10017
  authenticate: async () => {
10000
10018
  const resp = await authManager.getAuthValue({
@@ -10062,7 +10080,7 @@ function createClient(options) {
10062
10080
  createSocket: makeCreateSocketDelegateForRoom(
10063
10081
  roomId,
10064
10082
  baseUrl,
10065
- _optionalChain([clientOptions, 'access', _218 => _218.polyfills, 'optionalAccess', _219 => _219.WebSocket])
10083
+ _optionalChain([clientOptions, 'access', _220 => _220.polyfills, 'optionalAccess', _221 => _221.WebSocket])
10066
10084
  ),
10067
10085
  authenticate: makeAuthDelegateForRoom(roomId, authManager)
10068
10086
  })),
@@ -10085,7 +10103,7 @@ function createClient(options) {
10085
10103
  const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
10086
10104
  if (shouldConnect) {
10087
10105
  if (typeof atob === "undefined") {
10088
- if (_optionalChain([clientOptions, 'access', _220 => _220.polyfills, 'optionalAccess', _221 => _221.atob]) === void 0) {
10106
+ if (_optionalChain([clientOptions, 'access', _222 => _222.polyfills, 'optionalAccess', _223 => _223.atob]) === void 0) {
10089
10107
  throw new Error(
10090
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"
10091
10109
  );
@@ -10097,7 +10115,7 @@ function createClient(options) {
10097
10115
  return leaseRoom(newRoomDetails);
10098
10116
  }
10099
10117
  function getRoom(roomId) {
10100
- const room = _optionalChain([roomsById, 'access', _222 => _222.get, 'call', _223 => _223(roomId), 'optionalAccess', _224 => _224.room]);
10118
+ const room = _optionalChain([roomsById, 'access', _224 => _224.get, 'call', _225 => _225(roomId), 'optionalAccess', _226 => _226.room]);
10101
10119
  return room ? room : null;
10102
10120
  }
10103
10121
  function logout() {
@@ -10113,7 +10131,7 @@ function createClient(options) {
10113
10131
  const batchedResolveUsers = new Batch(
10114
10132
  async (batchedUserIds) => {
10115
10133
  const userIds = batchedUserIds.flat();
10116
- const users = await _optionalChain([resolveUsers, 'optionalCall', _225 => _225({ userIds })]);
10134
+ const users = await _optionalChain([resolveUsers, 'optionalCall', _227 => _227({ userIds })]);
10117
10135
  warnOnceIf(
10118
10136
  !resolveUsers,
10119
10137
  "Set the resolveUsers option in createClient to specify user info."
@@ -10130,7 +10148,7 @@ function createClient(options) {
10130
10148
  const batchedResolveRoomsInfo = new Batch(
10131
10149
  async (batchedRoomIds) => {
10132
10150
  const roomIds = batchedRoomIds.flat();
10133
- const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _226 => _226({ roomIds })]);
10151
+ const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _228 => _228({ roomIds })]);
10134
10152
  warnOnceIf(
10135
10153
  !resolveRoomsInfo,
10136
10154
  "Set the resolveRoomsInfo option in createClient to specify room info."
@@ -10147,7 +10165,7 @@ function createClient(options) {
10147
10165
  const batchedResolveGroupsInfo = new Batch(
10148
10166
  async (batchedGroupIds) => {
10149
10167
  const groupIds = batchedGroupIds.flat();
10150
- const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _227 => _227({ groupIds })]);
10168
+ const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _229 => _229({ groupIds })]);
10151
10169
  warnOnceIf(
10152
10170
  !resolveGroupsInfo,
10153
10171
  "Set the resolveGroupsInfo option in createClient to specify group info."
@@ -10203,7 +10221,7 @@ function createClient(options) {
10203
10221
  }
10204
10222
  };
10205
10223
  const win = typeof window !== "undefined" ? window : void 0;
10206
- _optionalChain([win, 'optionalAccess', _228 => _228.addEventListener, 'call', _229 => _229("beforeunload", maybePreventClose)]);
10224
+ _optionalChain([win, 'optionalAccess', _230 => _230.addEventListener, 'call', _231 => _231("beforeunload", maybePreventClose)]);
10207
10225
  }
10208
10226
  async function getNotificationSettings(options2) {
10209
10227
  const plainSettings = await httpClient.getNotificationSettings(options2);
@@ -10330,7 +10348,7 @@ var commentBodyElementsTypes = {
10330
10348
  mention: "inline"
10331
10349
  };
10332
10350
  function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
10333
- if (!body || !_optionalChain([body, 'optionalAccess', _230 => _230.content])) {
10351
+ if (!body || !_optionalChain([body, 'optionalAccess', _232 => _232.content])) {
10334
10352
  return;
10335
10353
  }
10336
10354
  const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
@@ -10340,13 +10358,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
10340
10358
  for (const block of body.content) {
10341
10359
  if (type === "all" || type === "block") {
10342
10360
  if (guard(block)) {
10343
- _optionalChain([visitor, 'optionalCall', _231 => _231(block)]);
10361
+ _optionalChain([visitor, 'optionalCall', _233 => _233(block)]);
10344
10362
  }
10345
10363
  }
10346
10364
  if (type === "all" || type === "inline") {
10347
10365
  for (const inline of block.children) {
10348
10366
  if (guard(inline)) {
10349
- _optionalChain([visitor, 'optionalCall', _232 => _232(inline)]);
10367
+ _optionalChain([visitor, 'optionalCall', _234 => _234(inline)]);
10350
10368
  }
10351
10369
  }
10352
10370
  }
@@ -10516,7 +10534,7 @@ var stringifyCommentBodyPlainElements = {
10516
10534
  text: ({ element }) => element.text,
10517
10535
  link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
10518
10536
  mention: ({ element, user, group }) => {
10519
- return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _233 => _233.name]), () => ( _optionalChain([group, 'optionalAccess', _234 => _234.name]))), () => ( element.id))}`;
10537
+ return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _235 => _235.name]), () => ( _optionalChain([group, 'optionalAccess', _236 => _236.name]))), () => ( element.id))}`;
10520
10538
  }
10521
10539
  };
10522
10540
  var stringifyCommentBodyHtmlElements = {
@@ -10546,7 +10564,7 @@ var stringifyCommentBodyHtmlElements = {
10546
10564
  return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
10547
10565
  },
10548
10566
  mention: ({ element, user, group }) => {
10549
- return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _235 => _235.name]) ? html`${_optionalChain([user, 'optionalAccess', _236 => _236.name])}` : _optionalChain([group, 'optionalAccess', _237 => _237.name]) ? html`${_optionalChain([group, 'optionalAccess', _238 => _238.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>`;
10550
10568
  }
10551
10569
  };
10552
10570
  var stringifyCommentBodyMarkdownElements = {
@@ -10576,20 +10594,20 @@ var stringifyCommentBodyMarkdownElements = {
10576
10594
  return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
10577
10595
  },
10578
10596
  mention: ({ element, user, group }) => {
10579
- return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _239 => _239.name]), () => ( _optionalChain([group, 'optionalAccess', _240 => _240.name]))), () => ( element.id))}`;
10597
+ return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _241 => _241.name]), () => ( _optionalChain([group, 'optionalAccess', _242 => _242.name]))), () => ( element.id))}`;
10580
10598
  }
10581
10599
  };
10582
10600
  async function stringifyCommentBody(body, options) {
10583
- const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _241 => _241.format]), () => ( "plain"));
10584
- const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _242 => _242.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")));
10585
10603
  const elements = {
10586
10604
  ...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
10587
- ..._optionalChain([options, 'optionalAccess', _243 => _243.elements])
10605
+ ..._optionalChain([options, 'optionalAccess', _245 => _245.elements])
10588
10606
  };
10589
10607
  const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInCommentBody(
10590
10608
  body,
10591
- _optionalChain([options, 'optionalAccess', _244 => _244.resolveUsers]),
10592
- _optionalChain([options, 'optionalAccess', _245 => _245.resolveGroupsInfo])
10609
+ _optionalChain([options, 'optionalAccess', _246 => _246.resolveUsers]),
10610
+ _optionalChain([options, 'optionalAccess', _247 => _247.resolveGroupsInfo])
10593
10611
  );
10594
10612
  const blocks = body.content.flatMap((block, blockIndex) => {
10595
10613
  switch (block.type) {
@@ -10876,12 +10894,12 @@ function legacy_patchImmutableNode(state, path, update) {
10876
10894
  }
10877
10895
  const newState = Object.assign({}, state);
10878
10896
  for (const key in update.updates) {
10879
- if (_optionalChain([update, 'access', _246 => _246.updates, 'access', _247 => _247[key], 'optionalAccess', _248 => _248.type]) === "update") {
10897
+ if (_optionalChain([update, 'access', _248 => _248.updates, 'access', _249 => _249[key], 'optionalAccess', _250 => _250.type]) === "update") {
10880
10898
  const val = update.node.get(key);
10881
10899
  if (val !== void 0) {
10882
10900
  newState[key] = lsonToJson(val);
10883
10901
  }
10884
- } else if (_optionalChain([update, 'access', _249 => _249.updates, 'access', _250 => _250[key], 'optionalAccess', _251 => _251.type]) === "delete") {
10902
+ } else if (_optionalChain([update, 'access', _251 => _251.updates, 'access', _252 => _252[key], 'optionalAccess', _253 => _253.type]) === "delete") {
10885
10903
  delete newState[key];
10886
10904
  }
10887
10905
  }
@@ -10942,12 +10960,12 @@ function legacy_patchImmutableNode(state, path, update) {
10942
10960
  }
10943
10961
  const newState = Object.assign({}, state);
10944
10962
  for (const key in update.updates) {
10945
- if (_optionalChain([update, 'access', _252 => _252.updates, 'access', _253 => _253[key], 'optionalAccess', _254 => _254.type]) === "update") {
10963
+ if (_optionalChain([update, 'access', _254 => _254.updates, 'access', _255 => _255[key], 'optionalAccess', _256 => _256.type]) === "update") {
10946
10964
  const value = update.node.get(key);
10947
10965
  if (value !== void 0) {
10948
10966
  newState[key] = lsonToJson(value);
10949
10967
  }
10950
- } else if (_optionalChain([update, 'access', _255 => _255.updates, 'access', _256 => _256[key], 'optionalAccess', _257 => _257.type]) === "delete") {
10968
+ } else if (_optionalChain([update, 'access', _257 => _257.updates, 'access', _258 => _258[key], 'optionalAccess', _259 => _259.type]) === "delete") {
10951
10969
  delete newState[key];
10952
10970
  }
10953
10971
  }
@@ -11027,9 +11045,9 @@ function makePoller(callback, intervalMs, options) {
11027
11045
  const startTime = performance.now();
11028
11046
  const doc = typeof document !== "undefined" ? document : void 0;
11029
11047
  const win = typeof window !== "undefined" ? window : void 0;
11030
- const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _258 => _258.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
11048
+ const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _260 => _260.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
11031
11049
  const context = {
11032
- inForeground: _optionalChain([doc, 'optionalAccess', _259 => _259.visibilityState]) !== "hidden",
11050
+ inForeground: _optionalChain([doc, 'optionalAccess', _261 => _261.visibilityState]) !== "hidden",
11033
11051
  lastSuccessfulPollAt: startTime,
11034
11052
  count: 0,
11035
11053
  backoff: 0
@@ -11110,11 +11128,11 @@ function makePoller(callback, intervalMs, options) {
11110
11128
  pollNowIfStale();
11111
11129
  }
11112
11130
  function onVisibilityChange() {
11113
- setInForeground(_optionalChain([doc, 'optionalAccess', _260 => _260.visibilityState]) !== "hidden");
11131
+ setInForeground(_optionalChain([doc, 'optionalAccess', _262 => _262.visibilityState]) !== "hidden");
11114
11132
  }
11115
- _optionalChain([doc, 'optionalAccess', _261 => _261.addEventListener, 'call', _262 => _262("visibilitychange", onVisibilityChange)]);
11116
- _optionalChain([win, 'optionalAccess', _263 => _263.addEventListener, 'call', _264 => _264("online", onVisibilityChange)]);
11117
- _optionalChain([win, 'optionalAccess', _265 => _265.addEventListener, 'call', _266 => _266("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)]);
11118
11136
  fsm.start();
11119
11137
  return {
11120
11138
  inc,