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