@liveblocks/core 3.6.1-preview1 → 3.7.0-preview1
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 +301 -199
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +119 -14
- package/dist/index.d.ts +119 -14
- package/dist/index.js +179 -77
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
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.
|
|
9
|
+
var PKG_VERSION = "3.7.0-preview1";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -851,6 +851,38 @@ function convertToSubscriptionDeleteInfo(data) {
|
|
|
851
851
|
deletedAt
|
|
852
852
|
};
|
|
853
853
|
}
|
|
854
|
+
function convertToGroupData(data) {
|
|
855
|
+
const createdAt = new Date(data.createdAt);
|
|
856
|
+
const updatedAt = new Date(data.updatedAt);
|
|
857
|
+
const members = data.members.map((member) => ({
|
|
858
|
+
...member,
|
|
859
|
+
addedAt: new Date(member.addedAt)
|
|
860
|
+
}));
|
|
861
|
+
return {
|
|
862
|
+
...data,
|
|
863
|
+
createdAt,
|
|
864
|
+
updatedAt,
|
|
865
|
+
members
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
// src/lib/assert.ts
|
|
870
|
+
function assertNever(_value, errmsg) {
|
|
871
|
+
throw new Error(errmsg);
|
|
872
|
+
}
|
|
873
|
+
function assert(condition, errmsg) {
|
|
874
|
+
if (process.env.NODE_ENV !== "production") {
|
|
875
|
+
if (!condition) {
|
|
876
|
+
const err = new Error(errmsg);
|
|
877
|
+
err.name = "Assertion failure";
|
|
878
|
+
throw err;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
function nn(value, errmsg = "Expected value to be non-nullable") {
|
|
883
|
+
assert(value !== null && value !== void 0, errmsg);
|
|
884
|
+
return value;
|
|
885
|
+
}
|
|
854
886
|
|
|
855
887
|
// src/lib/fancy-console.ts
|
|
856
888
|
var fancy_console_exports = {};
|
|
@@ -1128,11 +1160,20 @@ function createBatchStore(batch2) {
|
|
|
1128
1160
|
});
|
|
1129
1161
|
}
|
|
1130
1162
|
}
|
|
1163
|
+
function fill(input, data) {
|
|
1164
|
+
const cacheKey = getCacheKey(input);
|
|
1165
|
+
update(cacheKey, { isLoading: false, data });
|
|
1166
|
+
}
|
|
1131
1167
|
function getItemState(input) {
|
|
1132
1168
|
const cacheKey = getCacheKey(input);
|
|
1133
1169
|
const cache = signal.get();
|
|
1134
1170
|
return cache.get(cacheKey);
|
|
1135
1171
|
}
|
|
1172
|
+
function getData(input) {
|
|
1173
|
+
const cacheKey = getCacheKey(input);
|
|
1174
|
+
const cache = signal.get();
|
|
1175
|
+
return _optionalChain([cache, 'access', _12 => _12.get, 'call', _13 => _13(cacheKey), 'optionalAccess', _14 => _14.data]);
|
|
1176
|
+
}
|
|
1136
1177
|
function _cacheKeys() {
|
|
1137
1178
|
const cache = signal.get();
|
|
1138
1179
|
return [...cache.keys()];
|
|
@@ -1140,7 +1181,9 @@ function createBatchStore(batch2) {
|
|
|
1140
1181
|
return {
|
|
1141
1182
|
subscribe: signal.subscribe,
|
|
1142
1183
|
enqueue,
|
|
1184
|
+
fill,
|
|
1143
1185
|
getItemState,
|
|
1186
|
+
getData,
|
|
1144
1187
|
invalidate,
|
|
1145
1188
|
batch: batch2,
|
|
1146
1189
|
_cacheKeys
|
|
@@ -1658,11 +1701,11 @@ function createApiClient({
|
|
|
1658
1701
|
`Upload of attachment ${options.attachment.id} was aborted.`,
|
|
1659
1702
|
"AbortError"
|
|
1660
1703
|
) : void 0;
|
|
1661
|
-
if (_optionalChain([abortSignal, 'optionalAccess',
|
|
1704
|
+
if (_optionalChain([abortSignal, 'optionalAccess', _15 => _15.aborted])) {
|
|
1662
1705
|
throw abortError;
|
|
1663
1706
|
}
|
|
1664
1707
|
const handleRetryError = (err) => {
|
|
1665
|
-
if (_optionalChain([abortSignal, 'optionalAccess',
|
|
1708
|
+
if (_optionalChain([abortSignal, 'optionalAccess', _16 => _16.aborted])) {
|
|
1666
1709
|
throw abortError;
|
|
1667
1710
|
}
|
|
1668
1711
|
if (err instanceof HttpError && err.status === 413) {
|
|
@@ -1734,7 +1777,7 @@ function createApiClient({
|
|
|
1734
1777
|
try {
|
|
1735
1778
|
uploadId = createMultiPartUpload.uploadId;
|
|
1736
1779
|
const parts = splitFileIntoParts(attachment.file);
|
|
1737
|
-
if (_optionalChain([abortSignal, 'optionalAccess',
|
|
1780
|
+
if (_optionalChain([abortSignal, 'optionalAccess', _17 => _17.aborted])) {
|
|
1738
1781
|
throw abortError;
|
|
1739
1782
|
}
|
|
1740
1783
|
const batches = chunk(parts, 5);
|
|
@@ -1761,7 +1804,7 @@ function createApiClient({
|
|
|
1761
1804
|
}
|
|
1762
1805
|
uploadedParts.push(...await Promise.all(uploadedPartsPromises));
|
|
1763
1806
|
}
|
|
1764
|
-
if (_optionalChain([abortSignal, 'optionalAccess',
|
|
1807
|
+
if (_optionalChain([abortSignal, 'optionalAccess', _18 => _18.aborted])) {
|
|
1765
1808
|
throw abortError;
|
|
1766
1809
|
}
|
|
1767
1810
|
const sortedUploadedParts = uploadedParts.sort(
|
|
@@ -1777,7 +1820,7 @@ function createApiClient({
|
|
|
1777
1820
|
{ signal: abortSignal }
|
|
1778
1821
|
);
|
|
1779
1822
|
} catch (error3) {
|
|
1780
|
-
if (uploadId && _optionalChain([error3, 'optionalAccess',
|
|
1823
|
+
if (uploadId && _optionalChain([error3, 'optionalAccess', _19 => _19.name]) && (error3.name === "AbortError" || error3.name === "TimeoutError")) {
|
|
1781
1824
|
try {
|
|
1782
1825
|
await httpClient.rawDelete(
|
|
1783
1826
|
url`/v2/c/rooms/${roomId}/attachments/${attachment.id}/multipart/${uploadId}`,
|
|
@@ -1962,6 +2005,9 @@ function createApiClient({
|
|
|
1962
2005
|
return batch2.get(options.inboxNotificationId);
|
|
1963
2006
|
}
|
|
1964
2007
|
async function createTextMention(options) {
|
|
2008
|
+
if (options.mention.kind !== "user" && options.mention.kind !== "group") {
|
|
2009
|
+
return assertNever(options.mention, "Unexpected mention kind");
|
|
2010
|
+
}
|
|
1965
2011
|
await httpClient.rawPost(
|
|
1966
2012
|
url`/v2/c/rooms/${options.roomId}/text-mentions`,
|
|
1967
2013
|
await authManager.getAuthValue({
|
|
@@ -1969,7 +2015,9 @@ function createApiClient({
|
|
|
1969
2015
|
roomId: options.roomId
|
|
1970
2016
|
}),
|
|
1971
2017
|
{
|
|
1972
|
-
userId: options.
|
|
2018
|
+
userId: options.mention.kind === "user" ? options.mention.id : void 0,
|
|
2019
|
+
groupId: options.mention.kind === "group" ? options.mention.id : void 0,
|
|
2020
|
+
userIds: options.mention.kind === "group" ? options.mention.userIds : void 0,
|
|
1973
2021
|
mentionId: options.mentionId
|
|
1974
2022
|
}
|
|
1975
2023
|
);
|
|
@@ -2104,10 +2152,14 @@ function createApiClient({
|
|
|
2104
2152
|
url`/v2/c/inbox-notifications`,
|
|
2105
2153
|
await authManager.getAuthValue({ requestedScope: "comments:read" }),
|
|
2106
2154
|
{
|
|
2107
|
-
cursor: _optionalChain([options, 'optionalAccess',
|
|
2155
|
+
cursor: _optionalChain([options, 'optionalAccess', _20 => _20.cursor]),
|
|
2108
2156
|
limit: PAGE_SIZE
|
|
2109
2157
|
}
|
|
2110
2158
|
);
|
|
2159
|
+
const groups = json.groups.map(convertToGroupData);
|
|
2160
|
+
for (const group of groups) {
|
|
2161
|
+
groupsStore.fill(group.id, group);
|
|
2162
|
+
}
|
|
2111
2163
|
return {
|
|
2112
2164
|
inboxNotifications: json.inboxNotifications.map(
|
|
2113
2165
|
convertToInboxNotificationData
|
|
@@ -2196,7 +2248,7 @@ function createApiClient({
|
|
|
2196
2248
|
url`/v2/c/notification-settings`,
|
|
2197
2249
|
await authManager.getAuthValue({ requestedScope: "comments:read" }),
|
|
2198
2250
|
void 0,
|
|
2199
|
-
{ signal: _optionalChain([options, 'optionalAccess',
|
|
2251
|
+
{ signal: _optionalChain([options, 'optionalAccess', _21 => _21.signal]) }
|
|
2200
2252
|
);
|
|
2201
2253
|
}
|
|
2202
2254
|
async function updateNotificationSettings(settings) {
|
|
@@ -2208,7 +2260,7 @@ function createApiClient({
|
|
|
2208
2260
|
}
|
|
2209
2261
|
async function getUserThreads_experimental(options) {
|
|
2210
2262
|
let query;
|
|
2211
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
2263
|
+
if (_optionalChain([options, 'optionalAccess', _22 => _22.query])) {
|
|
2212
2264
|
query = objectToQuery(options.query);
|
|
2213
2265
|
}
|
|
2214
2266
|
const PAGE_SIZE = 50;
|
|
@@ -2216,7 +2268,7 @@ function createApiClient({
|
|
|
2216
2268
|
url`/v2/c/threads`,
|
|
2217
2269
|
await authManager.getAuthValue({ requestedScope: "comments:read" }),
|
|
2218
2270
|
{
|
|
2219
|
-
cursor: _optionalChain([options, 'optionalAccess',
|
|
2271
|
+
cursor: _optionalChain([options, 'optionalAccess', _23 => _23.cursor]),
|
|
2220
2272
|
query,
|
|
2221
2273
|
limit: PAGE_SIZE
|
|
2222
2274
|
}
|
|
@@ -2258,6 +2310,28 @@ function createApiClient({
|
|
|
2258
2310
|
permissionHints: json.meta.permissionHints
|
|
2259
2311
|
};
|
|
2260
2312
|
}
|
|
2313
|
+
const batchedGetGroups = new Batch(
|
|
2314
|
+
async (batchedGroupIds) => {
|
|
2315
|
+
const groupIds = batchedGroupIds.flat();
|
|
2316
|
+
const { groups: plainGroups } = await httpClient.post(
|
|
2317
|
+
url`/v2/c/groups/find`,
|
|
2318
|
+
await authManager.getAuthValue({
|
|
2319
|
+
requestedScope: "comments:read"
|
|
2320
|
+
}),
|
|
2321
|
+
{ groupIds }
|
|
2322
|
+
);
|
|
2323
|
+
const groups = /* @__PURE__ */ new Map();
|
|
2324
|
+
for (const group of plainGroups) {
|
|
2325
|
+
groups.set(group.id, convertToGroupData(group));
|
|
2326
|
+
}
|
|
2327
|
+
return groupIds.map((groupId) => groups.get(groupId));
|
|
2328
|
+
},
|
|
2329
|
+
{ delay: 50 }
|
|
2330
|
+
);
|
|
2331
|
+
const groupsStore = createBatchStore(batchedGetGroups);
|
|
2332
|
+
function getGroup(groupId) {
|
|
2333
|
+
return batchedGetGroups.get(groupId);
|
|
2334
|
+
}
|
|
2261
2335
|
return {
|
|
2262
2336
|
// Room threads
|
|
2263
2337
|
getThreads,
|
|
@@ -2311,6 +2385,9 @@ function createApiClient({
|
|
|
2311
2385
|
// User threads
|
|
2312
2386
|
getUserThreads_experimental,
|
|
2313
2387
|
getUserThreadsSince_experimental,
|
|
2388
|
+
// Groups
|
|
2389
|
+
groupsStore,
|
|
2390
|
+
getGroup,
|
|
2314
2391
|
// AI
|
|
2315
2392
|
executeContextualPrompt
|
|
2316
2393
|
};
|
|
@@ -2356,7 +2433,7 @@ var HttpClient = class {
|
|
|
2356
2433
|
// These headers are default, but can be overriden by custom headers
|
|
2357
2434
|
"Content-Type": "application/json; charset=utf-8",
|
|
2358
2435
|
// Possible header overrides
|
|
2359
|
-
..._optionalChain([options, 'optionalAccess',
|
|
2436
|
+
..._optionalChain([options, 'optionalAccess', _24 => _24.headers]),
|
|
2360
2437
|
// Cannot be overriden by custom headers
|
|
2361
2438
|
Authorization: `Bearer ${getBearerTokenFromAuthValue(authValue)}`,
|
|
2362
2439
|
"X-LB-Client": PKG_VERSION || "dev"
|
|
@@ -2468,24 +2545,6 @@ var HttpClient = class {
|
|
|
2468
2545
|
}
|
|
2469
2546
|
};
|
|
2470
2547
|
|
|
2471
|
-
// src/lib/assert.ts
|
|
2472
|
-
function assertNever(_value, errmsg) {
|
|
2473
|
-
throw new Error(errmsg);
|
|
2474
|
-
}
|
|
2475
|
-
function assert(condition, errmsg) {
|
|
2476
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2477
|
-
if (!condition) {
|
|
2478
|
-
const err = new Error(errmsg);
|
|
2479
|
-
err.name = "Assertion failure";
|
|
2480
|
-
throw err;
|
|
2481
|
-
}
|
|
2482
|
-
}
|
|
2483
|
-
}
|
|
2484
|
-
function nn(value, errmsg = "Expected value to be non-nullable") {
|
|
2485
|
-
assert(value !== null && value !== void 0, errmsg);
|
|
2486
|
-
return value;
|
|
2487
|
-
}
|
|
2488
|
-
|
|
2489
2548
|
// src/lib/fsm.ts
|
|
2490
2549
|
function distance(state1, state2) {
|
|
2491
2550
|
if (state1 === state2) {
|
|
@@ -2831,7 +2890,7 @@ var FSM = class {
|
|
|
2831
2890
|
});
|
|
2832
2891
|
}
|
|
2833
2892
|
#getTargetFn(eventName) {
|
|
2834
|
-
return _optionalChain([this, 'access',
|
|
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)]);
|
|
2835
2894
|
}
|
|
2836
2895
|
/**
|
|
2837
2896
|
* Exits the current state, and executes any necessary cleanup functions.
|
|
@@ -2848,7 +2907,7 @@ var FSM = class {
|
|
|
2848
2907
|
this.#currentContext.allowPatching((patchableContext) => {
|
|
2849
2908
|
levels = _nullishCoalesce(levels, () => ( this.#cleanupStack.length));
|
|
2850
2909
|
for (let i = 0; i < levels; i++) {
|
|
2851
|
-
_optionalChain([this, 'access',
|
|
2910
|
+
_optionalChain([this, 'access', _30 => _30.#cleanupStack, 'access', _31 => _31.pop, 'call', _32 => _32(), 'optionalCall', _33 => _33(patchableContext)]);
|
|
2852
2911
|
}
|
|
2853
2912
|
});
|
|
2854
2913
|
}
|
|
@@ -2864,7 +2923,7 @@ var FSM = class {
|
|
|
2864
2923
|
this.#currentContext.allowPatching((patchableContext) => {
|
|
2865
2924
|
for (const pattern of enterPatterns) {
|
|
2866
2925
|
const enterFn = this.#enterFns.get(pattern);
|
|
2867
|
-
const cleanupFn = _optionalChain([enterFn, 'optionalCall',
|
|
2926
|
+
const cleanupFn = _optionalChain([enterFn, 'optionalCall', _34 => _34(patchableContext)]);
|
|
2868
2927
|
if (typeof cleanupFn === "function") {
|
|
2869
2928
|
this.#cleanupStack.push(cleanupFn);
|
|
2870
2929
|
} else {
|
|
@@ -3258,7 +3317,7 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
3258
3317
|
}
|
|
3259
3318
|
function waitForActorId(event) {
|
|
3260
3319
|
const serverMsg = tryParseJson(event.data);
|
|
3261
|
-
if (_optionalChain([serverMsg, 'optionalAccess',
|
|
3320
|
+
if (_optionalChain([serverMsg, 'optionalAccess', _35 => _35.type]) === 104 /* ROOM_STATE */) {
|
|
3262
3321
|
didReceiveActor();
|
|
3263
3322
|
}
|
|
3264
3323
|
}
|
|
@@ -3367,12 +3426,12 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
3367
3426
|
const sendHeartbeat = {
|
|
3368
3427
|
target: "@ok.awaiting-pong",
|
|
3369
3428
|
effect: (ctx) => {
|
|
3370
|
-
_optionalChain([ctx, 'access',
|
|
3429
|
+
_optionalChain([ctx, 'access', _36 => _36.socket, 'optionalAccess', _37 => _37.send, 'call', _38 => _38("ping")]);
|
|
3371
3430
|
}
|
|
3372
3431
|
};
|
|
3373
3432
|
const maybeHeartbeat = () => {
|
|
3374
3433
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
3375
|
-
const canZombie = _optionalChain([doc, 'optionalAccess',
|
|
3434
|
+
const canZombie = _optionalChain([doc, 'optionalAccess', _39 => _39.visibilityState]) === "hidden" && delegates.canZombie();
|
|
3376
3435
|
return canZombie ? "@idle.zombie" : sendHeartbeat;
|
|
3377
3436
|
};
|
|
3378
3437
|
machine.addTimedTransition("@ok.connected", HEARTBEAT_INTERVAL, maybeHeartbeat).addTransitions("@ok.connected", {
|
|
@@ -3411,7 +3470,7 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
3411
3470
|
// socket, or not. So always check to see if the socket is still OPEN or
|
|
3412
3471
|
// not. When still OPEN, don't transition.
|
|
3413
3472
|
EXPLICIT_SOCKET_ERROR: (_, context) => {
|
|
3414
|
-
if (_optionalChain([context, 'access',
|
|
3473
|
+
if (_optionalChain([context, 'access', _40 => _40.socket, 'optionalAccess', _41 => _41.readyState]) === 1) {
|
|
3415
3474
|
return null;
|
|
3416
3475
|
}
|
|
3417
3476
|
return {
|
|
@@ -3463,17 +3522,17 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
3463
3522
|
machine.send({ type: "NAVIGATOR_ONLINE" });
|
|
3464
3523
|
}
|
|
3465
3524
|
function onVisibilityChange() {
|
|
3466
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
3525
|
+
if (_optionalChain([doc, 'optionalAccess', _42 => _42.visibilityState]) === "visible") {
|
|
3467
3526
|
machine.send({ type: "WINDOW_GOT_FOCUS" });
|
|
3468
3527
|
}
|
|
3469
3528
|
}
|
|
3470
|
-
_optionalChain([win, 'optionalAccess',
|
|
3471
|
-
_optionalChain([win, 'optionalAccess',
|
|
3472
|
-
_optionalChain([root, 'optionalAccess',
|
|
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)]);
|
|
3473
3532
|
return () => {
|
|
3474
|
-
_optionalChain([root, 'optionalAccess',
|
|
3475
|
-
_optionalChain([win, 'optionalAccess',
|
|
3476
|
-
_optionalChain([win, 'optionalAccess',
|
|
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)]);
|
|
3477
3536
|
teardownSocket(ctx.socket);
|
|
3478
3537
|
};
|
|
3479
3538
|
});
|
|
@@ -3562,7 +3621,7 @@ var ManagedSocket = class {
|
|
|
3562
3621
|
* message if this is somehow impossible.
|
|
3563
3622
|
*/
|
|
3564
3623
|
send(data) {
|
|
3565
|
-
const socket = _optionalChain([this, 'access',
|
|
3624
|
+
const socket = _optionalChain([this, 'access', _55 => _55.#machine, 'access', _56 => _56.context, 'optionalAccess', _57 => _57.socket]);
|
|
3566
3625
|
if (socket === null) {
|
|
3567
3626
|
warn("Cannot send: not connected yet", data);
|
|
3568
3627
|
} else if (socket.readyState !== 1) {
|
|
@@ -4000,7 +4059,7 @@ function replaceOrAppend(content, newItem, keyFn, now2) {
|
|
|
4000
4059
|
}
|
|
4001
4060
|
}
|
|
4002
4061
|
function closePart(prevPart, endedAt) {
|
|
4003
|
-
if (_optionalChain([prevPart, 'optionalAccess',
|
|
4062
|
+
if (_optionalChain([prevPart, 'optionalAccess', _58 => _58.type]) === "reasoning") {
|
|
4004
4063
|
prevPart.endedAt ??= endedAt;
|
|
4005
4064
|
}
|
|
4006
4065
|
}
|
|
@@ -4011,7 +4070,7 @@ function patchContentWithDelta(content, delta) {
|
|
|
4011
4070
|
const lastPart = content[content.length - 1];
|
|
4012
4071
|
switch (delta.type) {
|
|
4013
4072
|
case "text-delta":
|
|
4014
|
-
if (_optionalChain([lastPart, 'optionalAccess',
|
|
4073
|
+
if (_optionalChain([lastPart, 'optionalAccess', _59 => _59.type]) === "text") {
|
|
4015
4074
|
lastPart.text += delta.textDelta;
|
|
4016
4075
|
} else {
|
|
4017
4076
|
closePart(lastPart, now2);
|
|
@@ -4019,7 +4078,7 @@ function patchContentWithDelta(content, delta) {
|
|
|
4019
4078
|
}
|
|
4020
4079
|
break;
|
|
4021
4080
|
case "reasoning-delta":
|
|
4022
|
-
if (_optionalChain([lastPart, 'optionalAccess',
|
|
4081
|
+
if (_optionalChain([lastPart, 'optionalAccess', _60 => _60.type]) === "reasoning") {
|
|
4023
4082
|
lastPart.text += delta.textDelta;
|
|
4024
4083
|
} else {
|
|
4025
4084
|
closePart(lastPart, now2);
|
|
@@ -4039,8 +4098,8 @@ function patchContentWithDelta(content, delta) {
|
|
|
4039
4098
|
break;
|
|
4040
4099
|
}
|
|
4041
4100
|
case "tool-delta": {
|
|
4042
|
-
if (_optionalChain([lastPart, 'optionalAccess',
|
|
4043
|
-
_optionalChain([lastPart, 'access',
|
|
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)]);
|
|
4044
4103
|
}
|
|
4045
4104
|
break;
|
|
4046
4105
|
}
|
|
@@ -4159,7 +4218,7 @@ function createStore_forTools() {
|
|
|
4159
4218
|
return DerivedSignal.from(() => {
|
|
4160
4219
|
return (
|
|
4161
4220
|
// A tool that's registered and scoped to a specific chat ID...
|
|
4162
|
-
_nullishCoalesce(_optionalChain([(chatId !== void 0 ? toolsByChatId\u03A3.getOrCreate(chatId).getOrCreate(name) : void 0), 'optionalAccess',
|
|
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
|
|
4163
4222
|
toolsByChatId\u03A3.getOrCreate(kWILDCARD).getOrCreate(name).get()))
|
|
4164
4223
|
);
|
|
4165
4224
|
});
|
|
@@ -4189,8 +4248,8 @@ function createStore_forTools() {
|
|
|
4189
4248
|
const globalTools\u03A3 = toolsByChatId\u03A3.get(kWILDCARD);
|
|
4190
4249
|
const scopedTools\u03A3 = toolsByChatId\u03A3.get(chatId);
|
|
4191
4250
|
return Array.from([
|
|
4192
|
-
..._nullishCoalesce(_optionalChain([globalTools\u03A3, 'optionalAccess',
|
|
4193
|
-
..._nullishCoalesce(_optionalChain([scopedTools\u03A3, 'optionalAccess',
|
|
4251
|
+
..._nullishCoalesce(_optionalChain([globalTools\u03A3, 'optionalAccess', _66 => _66.entries, 'call', _67 => _67()]), () => ( [])),
|
|
4252
|
+
..._nullishCoalesce(_optionalChain([scopedTools\u03A3, 'optionalAccess', _68 => _68.entries, 'call', _69 => _69()]), () => ( []))
|
|
4194
4253
|
]).flatMap(([name, tool\u03A3]) => {
|
|
4195
4254
|
const tool = tool\u03A3.get();
|
|
4196
4255
|
return tool && (_nullishCoalesce(tool.enabled, () => ( true))) ? [{ name, description: tool.description, parameters: tool.parameters }] : [];
|
|
@@ -4293,7 +4352,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
4293
4352
|
} else {
|
|
4294
4353
|
continue;
|
|
4295
4354
|
}
|
|
4296
|
-
const executeFn = _optionalChain([toolsStore, 'access',
|
|
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]);
|
|
4297
4356
|
if (executeFn) {
|
|
4298
4357
|
(async () => {
|
|
4299
4358
|
const result = await executeFn(toolInvocation.args, {
|
|
@@ -4392,8 +4451,8 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
4392
4451
|
const spine = [];
|
|
4393
4452
|
let lastVisitedMessage = null;
|
|
4394
4453
|
for (const message2 of pool.walkUp(leaf.id)) {
|
|
4395
|
-
const prev = _nullishCoalesce(_optionalChain([first, 'call',
|
|
4396
|
-
const next = _nullishCoalesce(_optionalChain([first, 'call',
|
|
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));
|
|
4397
4456
|
if (!message2.deletedAt || prev || next) {
|
|
4398
4457
|
const node = {
|
|
4399
4458
|
...message2,
|
|
@@ -4459,7 +4518,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
4459
4518
|
const latest = pool.sorted.findRight(
|
|
4460
4519
|
(m) => m.role === "assistant" && !m.deletedAt
|
|
4461
4520
|
);
|
|
4462
|
-
return _optionalChain([latest, 'optionalAccess',
|
|
4521
|
+
return _optionalChain([latest, 'optionalAccess', _79 => _79.copilotId]);
|
|
4463
4522
|
}
|
|
4464
4523
|
return {
|
|
4465
4524
|
// Readers
|
|
@@ -4490,11 +4549,11 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
4490
4549
|
*getAutoExecutingMessageIds() {
|
|
4491
4550
|
for (const messageId of myMessages) {
|
|
4492
4551
|
const message = getMessageById(messageId);
|
|
4493
|
-
if (_optionalChain([message, 'optionalAccess',
|
|
4552
|
+
if (_optionalChain([message, 'optionalAccess', _80 => _80.role]) === "assistant" && message.status === "awaiting-tool") {
|
|
4494
4553
|
const isAutoExecuting = message.contentSoFar.some((part) => {
|
|
4495
4554
|
if (part.type === "tool-invocation" && part.stage === "executing") {
|
|
4496
4555
|
const tool = toolsStore.getTool\u03A3(part.name, message.chatId).get();
|
|
4497
|
-
return typeof _optionalChain([tool, 'optionalAccess',
|
|
4556
|
+
return typeof _optionalChain([tool, 'optionalAccess', _81 => _81.execute]) === "function";
|
|
4498
4557
|
}
|
|
4499
4558
|
return false;
|
|
4500
4559
|
});
|
|
@@ -4639,7 +4698,7 @@ function createAi(config) {
|
|
|
4639
4698
|
flushPendingDeltas();
|
|
4640
4699
|
switch (msg.event) {
|
|
4641
4700
|
case "cmd-failed":
|
|
4642
|
-
_optionalChain([pendingCmd, 'optionalAccess',
|
|
4701
|
+
_optionalChain([pendingCmd, 'optionalAccess', _82 => _82.reject, 'call', _83 => _83(new Error(msg.error))]);
|
|
4643
4702
|
break;
|
|
4644
4703
|
case "settle": {
|
|
4645
4704
|
context.messagesStore.upsert(msg.message);
|
|
@@ -4716,7 +4775,7 @@ function createAi(config) {
|
|
|
4716
4775
|
return assertNever(msg, "Unhandled case");
|
|
4717
4776
|
}
|
|
4718
4777
|
}
|
|
4719
|
-
_optionalChain([pendingCmd, 'optionalAccess',
|
|
4778
|
+
_optionalChain([pendingCmd, 'optionalAccess', _84 => _84.resolve, 'call', _85 => _85(msg)]);
|
|
4720
4779
|
}
|
|
4721
4780
|
managedSocket.events.onMessage.subscribe(handleServerMessage);
|
|
4722
4781
|
managedSocket.events.statusDidChange.subscribe(onStatusDidChange);
|
|
@@ -4801,9 +4860,9 @@ function createAi(config) {
|
|
|
4801
4860
|
invocationId,
|
|
4802
4861
|
result,
|
|
4803
4862
|
generationOptions: {
|
|
4804
|
-
copilotId: _optionalChain([options, 'optionalAccess',
|
|
4805
|
-
stream: _optionalChain([options, 'optionalAccess',
|
|
4806
|
-
timeout: _optionalChain([options, 'optionalAccess',
|
|
4863
|
+
copilotId: _optionalChain([options, 'optionalAccess', _86 => _86.copilotId]),
|
|
4864
|
+
stream: _optionalChain([options, 'optionalAccess', _87 => _87.stream]),
|
|
4865
|
+
timeout: _optionalChain([options, 'optionalAccess', _88 => _88.timeout]),
|
|
4807
4866
|
// Knowledge and tools aren't coming from the options, but retrieved
|
|
4808
4867
|
// from the global context
|
|
4809
4868
|
knowledge: knowledge.length > 0 ? knowledge : void 0,
|
|
@@ -4821,7 +4880,7 @@ function createAi(config) {
|
|
|
4821
4880
|
}
|
|
4822
4881
|
}
|
|
4823
4882
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
4824
|
-
_optionalChain([win, 'optionalAccess',
|
|
4883
|
+
_optionalChain([win, 'optionalAccess', _89 => _89.addEventListener, 'call', _90 => _90("beforeunload", handleBeforeUnload, { once: true })]);
|
|
4825
4884
|
return Object.defineProperty(
|
|
4826
4885
|
{
|
|
4827
4886
|
[kInternal]: {
|
|
@@ -4840,7 +4899,7 @@ function createAi(config) {
|
|
|
4840
4899
|
clearChat: (chatId) => sendClientMsgWithResponse({ cmd: "clear-chat", chatId }),
|
|
4841
4900
|
askUserMessageInChat: async (chatId, userMessage, targetMessageId, options) => {
|
|
4842
4901
|
const globalKnowledge = context.knowledge.get();
|
|
4843
|
-
const requestKnowledge = _optionalChain([options, 'optionalAccess',
|
|
4902
|
+
const requestKnowledge = _optionalChain([options, 'optionalAccess', _91 => _91.knowledge]) || [];
|
|
4844
4903
|
const combinedKnowledge = [...globalKnowledge, ...requestKnowledge];
|
|
4845
4904
|
const tools = context.toolsStore.getToolDescriptions(chatId);
|
|
4846
4905
|
messagesStore.markMine(targetMessageId);
|
|
@@ -4850,9 +4909,9 @@ function createAi(config) {
|
|
|
4850
4909
|
sourceMessage: userMessage,
|
|
4851
4910
|
targetMessageId,
|
|
4852
4911
|
generationOptions: {
|
|
4853
|
-
copilotId: _optionalChain([options, 'optionalAccess',
|
|
4854
|
-
stream: _optionalChain([options, 'optionalAccess',
|
|
4855
|
-
timeout: _optionalChain([options, 'optionalAccess',
|
|
4912
|
+
copilotId: _optionalChain([options, 'optionalAccess', _92 => _92.copilotId]),
|
|
4913
|
+
stream: _optionalChain([options, 'optionalAccess', _93 => _93.stream]),
|
|
4914
|
+
timeout: _optionalChain([options, 'optionalAccess', _94 => _94.timeout]),
|
|
4856
4915
|
// Combine global knowledge with request-specific knowledge
|
|
4857
4916
|
knowledge: combinedKnowledge.length > 0 ? combinedKnowledge : void 0,
|
|
4858
4917
|
tools: tools.length > 0 ? tools : void 0
|
|
@@ -4953,7 +5012,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
4953
5012
|
return void 0;
|
|
4954
5013
|
}
|
|
4955
5014
|
async function makeAuthRequest(options) {
|
|
4956
|
-
const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access',
|
|
5015
|
+
const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _95 => _95.polyfills, 'optionalAccess', _96 => _96.fetch]), () => ( (typeof window === "undefined" ? void 0 : window.fetch)));
|
|
4957
5016
|
if (authentication.type === "private") {
|
|
4958
5017
|
if (fetcher === void 0) {
|
|
4959
5018
|
throw new StopRetrying(
|
|
@@ -4969,7 +5028,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
4969
5028
|
"The same Liveblocks auth token was issued from the backend before. Caching Liveblocks tokens is not supported."
|
|
4970
5029
|
);
|
|
4971
5030
|
}
|
|
4972
|
-
_optionalChain([onAuthenticate, 'optionalCall',
|
|
5031
|
+
_optionalChain([onAuthenticate, 'optionalCall', _97 => _97(parsed.parsed)]);
|
|
4973
5032
|
return parsed;
|
|
4974
5033
|
}
|
|
4975
5034
|
if (authentication.type === "custom") {
|
|
@@ -4977,7 +5036,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
4977
5036
|
if (response && typeof response === "object") {
|
|
4978
5037
|
if (typeof response.token === "string") {
|
|
4979
5038
|
const parsed = parseAuthToken(response.token);
|
|
4980
|
-
_optionalChain([onAuthenticate, 'optionalCall',
|
|
5039
|
+
_optionalChain([onAuthenticate, 'optionalCall', _98 => _98(parsed.parsed)]);
|
|
4981
5040
|
return parsed;
|
|
4982
5041
|
} else if (typeof response.error === "string") {
|
|
4983
5042
|
const reason = `Authentication failed: ${"reason" in response && typeof response.reason === "string" ? response.reason : "Forbidden"}`;
|
|
@@ -5121,6 +5180,7 @@ async function fetchAuthEndpoint(fetch, endpoint, body) {
|
|
|
5121
5180
|
|
|
5122
5181
|
// src/constants.ts
|
|
5123
5182
|
var DEFAULT_BASE_URL = "https://api.liveblocks.io";
|
|
5183
|
+
var MENTION_CHARACTER = "@";
|
|
5124
5184
|
|
|
5125
5185
|
// src/devtools/bridge.ts
|
|
5126
5186
|
var _bridgeActive = false;
|
|
@@ -5135,7 +5195,7 @@ function sendToPanel(message, options) {
|
|
|
5135
5195
|
...message,
|
|
5136
5196
|
source: "liveblocks-devtools-client"
|
|
5137
5197
|
};
|
|
5138
|
-
if (!(_optionalChain([options, 'optionalAccess',
|
|
5198
|
+
if (!(_optionalChain([options, 'optionalAccess', _99 => _99.force]) || _bridgeActive)) {
|
|
5139
5199
|
return;
|
|
5140
5200
|
}
|
|
5141
5201
|
window.postMessage(fullMsg, "*");
|
|
@@ -5143,7 +5203,7 @@ function sendToPanel(message, options) {
|
|
|
5143
5203
|
var eventSource = makeEventSource();
|
|
5144
5204
|
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
5145
5205
|
window.addEventListener("message", (event) => {
|
|
5146
|
-
if (event.source === window && _optionalChain([event, 'access',
|
|
5206
|
+
if (event.source === window && _optionalChain([event, 'access', _100 => _100.data, 'optionalAccess', _101 => _101.source]) === "liveblocks-devtools-panel") {
|
|
5147
5207
|
eventSource.notify(event.data);
|
|
5148
5208
|
} else {
|
|
5149
5209
|
}
|
|
@@ -5285,7 +5345,7 @@ function fullSync(room) {
|
|
|
5285
5345
|
msg: "room::sync::full",
|
|
5286
5346
|
roomId: room.id,
|
|
5287
5347
|
status: room.getStatus(),
|
|
5288
|
-
storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess',
|
|
5348
|
+
storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _102 => _102.toTreeNode, 'call', _103 => _103("root"), 'access', _104 => _104.payload]), () => ( null)),
|
|
5289
5349
|
me,
|
|
5290
5350
|
others
|
|
5291
5351
|
});
|
|
@@ -5340,6 +5400,22 @@ function unlinkDevTools(roomId) {
|
|
|
5340
5400
|
});
|
|
5341
5401
|
}
|
|
5342
5402
|
|
|
5403
|
+
// src/lib/warnings.ts
|
|
5404
|
+
var _emittedWarnings = /* @__PURE__ */ new Set();
|
|
5405
|
+
function warnOnce(message, key = message) {
|
|
5406
|
+
if (process.env.NODE_ENV !== "production") {
|
|
5407
|
+
if (!_emittedWarnings.has(key)) {
|
|
5408
|
+
_emittedWarnings.add(key);
|
|
5409
|
+
warn(message);
|
|
5410
|
+
}
|
|
5411
|
+
}
|
|
5412
|
+
}
|
|
5413
|
+
function warnOnceIf(condition, message, key = message) {
|
|
5414
|
+
if (typeof condition === "function" ? condition() : condition) {
|
|
5415
|
+
warnOnce(message, key);
|
|
5416
|
+
}
|
|
5417
|
+
}
|
|
5418
|
+
|
|
5343
5419
|
// src/protocol/NotificationSettings.ts
|
|
5344
5420
|
var kPlain = Symbol("notification-settings-plain");
|
|
5345
5421
|
function createNotificationSettings(plain) {
|
|
@@ -5576,7 +5652,7 @@ function createManagedPool(roomId, options) {
|
|
|
5576
5652
|
generateId: () => `${getCurrentConnectionId()}:${clock++}`,
|
|
5577
5653
|
generateOpId: () => `${getCurrentConnectionId()}:${opClock++}`,
|
|
5578
5654
|
dispatch(ops, reverse, storageUpdates) {
|
|
5579
|
-
_optionalChain([onDispatch, 'optionalCall',
|
|
5655
|
+
_optionalChain([onDispatch, 'optionalCall', _105 => _105(ops, reverse, storageUpdates)]);
|
|
5580
5656
|
},
|
|
5581
5657
|
assertStorageIsWritable: () => {
|
|
5582
5658
|
if (!isStorageWritable()) {
|
|
@@ -5803,7 +5879,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
|
|
|
5803
5879
|
return [
|
|
5804
5880
|
{
|
|
5805
5881
|
type: 8 /* CREATE_REGISTER */,
|
|
5806
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
5882
|
+
opId: _optionalChain([pool, 'optionalAccess', _106 => _106.generateOpId, 'call', _107 => _107()]),
|
|
5807
5883
|
id: this._id,
|
|
5808
5884
|
parentId,
|
|
5809
5885
|
parentKey,
|
|
@@ -5909,7 +5985,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
5909
5985
|
const ops = [];
|
|
5910
5986
|
const op = {
|
|
5911
5987
|
id: this._id,
|
|
5912
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
5988
|
+
opId: _optionalChain([pool, 'optionalAccess', _108 => _108.generateOpId, 'call', _109 => _109()]),
|
|
5913
5989
|
type: 2 /* CREATE_LIST */,
|
|
5914
5990
|
parentId,
|
|
5915
5991
|
parentKey
|
|
@@ -6180,7 +6256,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6180
6256
|
#applyInsertUndoRedo(op) {
|
|
6181
6257
|
const { id, parentKey: key } = op;
|
|
6182
6258
|
const child = creationOpToLiveNode(op);
|
|
6183
|
-
if (_optionalChain([this, 'access',
|
|
6259
|
+
if (_optionalChain([this, 'access', _110 => _110._pool, 'optionalAccess', _111 => _111.getNode, 'call', _112 => _112(id)]) !== void 0) {
|
|
6184
6260
|
return { modified: false };
|
|
6185
6261
|
}
|
|
6186
6262
|
child._attach(id, nn(this._pool));
|
|
@@ -6188,8 +6264,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6188
6264
|
const existingItemIndex = this._indexOfPosition(key);
|
|
6189
6265
|
let newKey = key;
|
|
6190
6266
|
if (existingItemIndex !== -1) {
|
|
6191
|
-
const before2 = _optionalChain([this, 'access',
|
|
6192
|
-
const after2 = _optionalChain([this, 'access',
|
|
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]);
|
|
6193
6269
|
newKey = makePosition(before2, after2);
|
|
6194
6270
|
child._setParentLink(this, newKey);
|
|
6195
6271
|
}
|
|
@@ -6203,7 +6279,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6203
6279
|
#applySetUndoRedo(op) {
|
|
6204
6280
|
const { id, parentKey: key } = op;
|
|
6205
6281
|
const child = creationOpToLiveNode(op);
|
|
6206
|
-
if (_optionalChain([this, 'access',
|
|
6282
|
+
if (_optionalChain([this, 'access', _119 => _119._pool, 'optionalAccess', _120 => _120.getNode, 'call', _121 => _121(id)]) !== void 0) {
|
|
6207
6283
|
return { modified: false };
|
|
6208
6284
|
}
|
|
6209
6285
|
this.#unacknowledgedSets.set(key, nn(op.opId));
|
|
@@ -6324,7 +6400,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6324
6400
|
} else {
|
|
6325
6401
|
this.#items[existingItemIndex]._setParentLink(
|
|
6326
6402
|
this,
|
|
6327
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
6403
|
+
makePosition(newKey, _optionalChain([this, 'access', _122 => _122.#items, 'access', _123 => _123[existingItemIndex + 1], 'optionalAccess', _124 => _124._parentPos]))
|
|
6328
6404
|
);
|
|
6329
6405
|
const previousIndex = this.#items.indexOf(child);
|
|
6330
6406
|
child._setParentLink(this, newKey);
|
|
@@ -6349,7 +6425,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6349
6425
|
if (existingItemIndex !== -1) {
|
|
6350
6426
|
this.#items[existingItemIndex]._setParentLink(
|
|
6351
6427
|
this,
|
|
6352
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
6428
|
+
makePosition(newKey, _optionalChain([this, 'access', _125 => _125.#items, 'access', _126 => _126[existingItemIndex + 1], 'optionalAccess', _127 => _127._parentPos]))
|
|
6353
6429
|
);
|
|
6354
6430
|
}
|
|
6355
6431
|
child._setParentLink(this, newKey);
|
|
@@ -6368,7 +6444,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6368
6444
|
if (existingItemIndex !== -1) {
|
|
6369
6445
|
this.#items[existingItemIndex]._setParentLink(
|
|
6370
6446
|
this,
|
|
6371
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
6447
|
+
makePosition(newKey, _optionalChain([this, 'access', _128 => _128.#items, 'access', _129 => _129[existingItemIndex + 1], 'optionalAccess', _130 => _130._parentPos]))
|
|
6372
6448
|
);
|
|
6373
6449
|
}
|
|
6374
6450
|
child._setParentLink(this, newKey);
|
|
@@ -6392,14 +6468,13 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6392
6468
|
const previousKey = nn(child._parentKey);
|
|
6393
6469
|
const previousIndex = this.#items.indexOf(child);
|
|
6394
6470
|
const existingItemIndex = this._indexOfPosition(newKey);
|
|
6395
|
-
let actualNewKey = newKey;
|
|
6396
6471
|
if (existingItemIndex !== -1) {
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
_optionalChain([this, 'access',
|
|
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]))
|
|
6400
6475
|
);
|
|
6401
6476
|
}
|
|
6402
|
-
child._setParentLink(this,
|
|
6477
|
+
child._setParentLink(this, newKey);
|
|
6403
6478
|
this._sortItems();
|
|
6404
6479
|
const newIndex = this.#items.indexOf(child);
|
|
6405
6480
|
if (previousIndex === newIndex) {
|
|
@@ -6454,7 +6529,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6454
6529
|
* @param element The element to add to the end of the LiveList.
|
|
6455
6530
|
*/
|
|
6456
6531
|
push(element) {
|
|
6457
|
-
_optionalChain([this, 'access',
|
|
6532
|
+
_optionalChain([this, 'access', _134 => _134._pool, 'optionalAccess', _135 => _135.assertStorageIsWritable, 'call', _136 => _136()]);
|
|
6458
6533
|
return this.insert(element, this.length);
|
|
6459
6534
|
}
|
|
6460
6535
|
/**
|
|
@@ -6463,7 +6538,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6463
6538
|
* @param index The index at which you want to insert the element.
|
|
6464
6539
|
*/
|
|
6465
6540
|
insert(element, index) {
|
|
6466
|
-
_optionalChain([this, 'access',
|
|
6541
|
+
_optionalChain([this, 'access', _137 => _137._pool, 'optionalAccess', _138 => _138.assertStorageIsWritable, 'call', _139 => _139()]);
|
|
6467
6542
|
if (index < 0 || index > this.#items.length) {
|
|
6468
6543
|
throw new Error(
|
|
6469
6544
|
`Cannot insert list item at index "${index}". index should be between 0 and ${this.#items.length}`
|
|
@@ -6493,7 +6568,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6493
6568
|
* @param targetIndex The index where the element should be after moving.
|
|
6494
6569
|
*/
|
|
6495
6570
|
move(index, targetIndex) {
|
|
6496
|
-
_optionalChain([this, 'access',
|
|
6571
|
+
_optionalChain([this, 'access', _140 => _140._pool, 'optionalAccess', _141 => _141.assertStorageIsWritable, 'call', _142 => _142()]);
|
|
6497
6572
|
if (targetIndex < 0) {
|
|
6498
6573
|
throw new Error("targetIndex cannot be less than 0");
|
|
6499
6574
|
}
|
|
@@ -6551,7 +6626,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6551
6626
|
* @param index The index of the element to delete
|
|
6552
6627
|
*/
|
|
6553
6628
|
delete(index) {
|
|
6554
|
-
_optionalChain([this, 'access',
|
|
6629
|
+
_optionalChain([this, 'access', _143 => _143._pool, 'optionalAccess', _144 => _144.assertStorageIsWritable, 'call', _145 => _145()]);
|
|
6555
6630
|
if (index < 0 || index >= this.#items.length) {
|
|
6556
6631
|
throw new Error(
|
|
6557
6632
|
`Cannot delete list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -6584,7 +6659,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6584
6659
|
}
|
|
6585
6660
|
}
|
|
6586
6661
|
clear() {
|
|
6587
|
-
_optionalChain([this, 'access',
|
|
6662
|
+
_optionalChain([this, 'access', _146 => _146._pool, 'optionalAccess', _147 => _147.assertStorageIsWritable, 'call', _148 => _148()]);
|
|
6588
6663
|
if (this._pool) {
|
|
6589
6664
|
const ops = [];
|
|
6590
6665
|
const reverseOps = [];
|
|
@@ -6618,7 +6693,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6618
6693
|
}
|
|
6619
6694
|
}
|
|
6620
6695
|
set(index, item) {
|
|
6621
|
-
_optionalChain([this, 'access',
|
|
6696
|
+
_optionalChain([this, 'access', _149 => _149._pool, 'optionalAccess', _150 => _150.assertStorageIsWritable, 'call', _151 => _151()]);
|
|
6622
6697
|
if (index < 0 || index >= this.#items.length) {
|
|
6623
6698
|
throw new Error(
|
|
6624
6699
|
`Cannot set list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -6764,7 +6839,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6764
6839
|
#shiftItemPosition(index, key) {
|
|
6765
6840
|
const shiftedPosition = makePosition(
|
|
6766
6841
|
key,
|
|
6767
|
-
this.#items.length > index + 1 ? _optionalChain([this, 'access',
|
|
6842
|
+
this.#items.length > index + 1 ? _optionalChain([this, 'access', _152 => _152.#items, 'access', _153 => _153[index + 1], 'optionalAccess', _154 => _154._parentPos]) : void 0
|
|
6768
6843
|
);
|
|
6769
6844
|
this.#items[index]._setParentLink(this, shiftedPosition);
|
|
6770
6845
|
}
|
|
@@ -6889,7 +6964,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
6889
6964
|
const ops = [];
|
|
6890
6965
|
const op = {
|
|
6891
6966
|
id: this._id,
|
|
6892
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
6967
|
+
opId: _optionalChain([pool, 'optionalAccess', _155 => _155.generateOpId, 'call', _156 => _156()]),
|
|
6893
6968
|
type: 7 /* CREATE_MAP */,
|
|
6894
6969
|
parentId,
|
|
6895
6970
|
parentKey
|
|
@@ -7024,7 +7099,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
7024
7099
|
* @param value The value of the element to add. Should be serializable to JSON.
|
|
7025
7100
|
*/
|
|
7026
7101
|
set(key, value) {
|
|
7027
|
-
_optionalChain([this, 'access',
|
|
7102
|
+
_optionalChain([this, 'access', _157 => _157._pool, 'optionalAccess', _158 => _158.assertStorageIsWritable, 'call', _159 => _159()]);
|
|
7028
7103
|
const oldValue = this.#map.get(key);
|
|
7029
7104
|
if (oldValue) {
|
|
7030
7105
|
oldValue._detach();
|
|
@@ -7070,7 +7145,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
7070
7145
|
* @returns true if an element existed and has been removed, or false if the element does not exist.
|
|
7071
7146
|
*/
|
|
7072
7147
|
delete(key) {
|
|
7073
|
-
_optionalChain([this, 'access',
|
|
7148
|
+
_optionalChain([this, 'access', _160 => _160._pool, 'optionalAccess', _161 => _161.assertStorageIsWritable, 'call', _162 => _162()]);
|
|
7074
7149
|
const item = this.#map.get(key);
|
|
7075
7150
|
if (item === void 0) {
|
|
7076
7151
|
return false;
|
|
@@ -7260,7 +7335,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
7260
7335
|
if (this._id === void 0) {
|
|
7261
7336
|
throw new Error("Cannot serialize item is not attached");
|
|
7262
7337
|
}
|
|
7263
|
-
const opId = _optionalChain([pool, 'optionalAccess',
|
|
7338
|
+
const opId = _optionalChain([pool, 'optionalAccess', _163 => _163.generateOpId, 'call', _164 => _164()]);
|
|
7264
7339
|
const ops = [];
|
|
7265
7340
|
const op = {
|
|
7266
7341
|
type: 4 /* CREATE_OBJECT */,
|
|
@@ -7532,7 +7607,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
7532
7607
|
* @param value The value of the property to add
|
|
7533
7608
|
*/
|
|
7534
7609
|
set(key, value) {
|
|
7535
|
-
_optionalChain([this, 'access',
|
|
7610
|
+
_optionalChain([this, 'access', _165 => _165._pool, 'optionalAccess', _166 => _166.assertStorageIsWritable, 'call', _167 => _167()]);
|
|
7536
7611
|
this.update({ [key]: value });
|
|
7537
7612
|
}
|
|
7538
7613
|
/**
|
|
@@ -7547,7 +7622,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
7547
7622
|
* @param key The key of the property to delete
|
|
7548
7623
|
*/
|
|
7549
7624
|
delete(key) {
|
|
7550
|
-
_optionalChain([this, 'access',
|
|
7625
|
+
_optionalChain([this, 'access', _168 => _168._pool, 'optionalAccess', _169 => _169.assertStorageIsWritable, 'call', _170 => _170()]);
|
|
7551
7626
|
const keyAsString = key;
|
|
7552
7627
|
const oldValue = this.#map.get(keyAsString);
|
|
7553
7628
|
if (oldValue === void 0) {
|
|
@@ -7600,7 +7675,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
7600
7675
|
* @param patch The object used to overrides properties
|
|
7601
7676
|
*/
|
|
7602
7677
|
update(patch) {
|
|
7603
|
-
_optionalChain([this, 'access',
|
|
7678
|
+
_optionalChain([this, 'access', _171 => _171._pool, 'optionalAccess', _172 => _172.assertStorageIsWritable, 'call', _173 => _173()]);
|
|
7604
7679
|
if (_LiveObject.detectLargeObjects) {
|
|
7605
7680
|
const data = {};
|
|
7606
7681
|
for (const [key, value] of this.#map) {
|
|
@@ -8348,15 +8423,15 @@ function installBackgroundTabSpy() {
|
|
|
8348
8423
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
8349
8424
|
const inBackgroundSince = { current: null };
|
|
8350
8425
|
function onVisibilityChange() {
|
|
8351
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
8426
|
+
if (_optionalChain([doc, 'optionalAccess', _174 => _174.visibilityState]) === "hidden") {
|
|
8352
8427
|
inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
|
|
8353
8428
|
} else {
|
|
8354
8429
|
inBackgroundSince.current = null;
|
|
8355
8430
|
}
|
|
8356
8431
|
}
|
|
8357
|
-
_optionalChain([doc, 'optionalAccess',
|
|
8432
|
+
_optionalChain([doc, 'optionalAccess', _175 => _175.addEventListener, 'call', _176 => _176("visibilitychange", onVisibilityChange)]);
|
|
8358
8433
|
const unsub = () => {
|
|
8359
|
-
_optionalChain([doc, 'optionalAccess',
|
|
8434
|
+
_optionalChain([doc, 'optionalAccess', _177 => _177.removeEventListener, 'call', _178 => _178("visibilitychange", onVisibilityChange)]);
|
|
8360
8435
|
};
|
|
8361
8436
|
return [inBackgroundSince, unsub];
|
|
8362
8437
|
}
|
|
@@ -8536,7 +8611,7 @@ function createRoom(options, config) {
|
|
|
8536
8611
|
}
|
|
8537
8612
|
}
|
|
8538
8613
|
function isStorageWritable() {
|
|
8539
|
-
const scopes = _optionalChain([context, 'access',
|
|
8614
|
+
const scopes = _optionalChain([context, 'access', _179 => _179.dynamicSessionInfoSig, 'access', _180 => _180.get, 'call', _181 => _181(), 'optionalAccess', _182 => _182.scopes]);
|
|
8540
8615
|
return scopes !== void 0 ? canWriteStorage(scopes) : true;
|
|
8541
8616
|
}
|
|
8542
8617
|
const eventHub = {
|
|
@@ -8555,8 +8630,8 @@ function createRoom(options, config) {
|
|
|
8555
8630
|
comments: makeEventSource(),
|
|
8556
8631
|
roomWillDestroy: makeEventSource()
|
|
8557
8632
|
};
|
|
8558
|
-
async function createTextMention(
|
|
8559
|
-
return httpClient.createTextMention({ roomId,
|
|
8633
|
+
async function createTextMention(mentionId, mention) {
|
|
8634
|
+
return httpClient.createTextMention({ roomId, mentionId, mention });
|
|
8560
8635
|
}
|
|
8561
8636
|
async function deleteTextMention(mentionId) {
|
|
8562
8637
|
return httpClient.deleteTextMention({ roomId, mentionId });
|
|
@@ -8662,7 +8737,7 @@ function createRoom(options, config) {
|
|
|
8662
8737
|
}
|
|
8663
8738
|
case "experimental-fallback-to-http": {
|
|
8664
8739
|
warn("Message is too large for websockets, so sending over HTTP instead");
|
|
8665
|
-
const nonce = _nullishCoalesce(_optionalChain([context, 'access',
|
|
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")));
|
|
8666
8741
|
void httpClient.sendMessages({ roomId, nonce, messages }).then((resp) => {
|
|
8667
8742
|
if (!resp.ok && resp.status === 403) {
|
|
8668
8743
|
managedSocket.reconnect();
|
|
@@ -8713,7 +8788,7 @@ function createRoom(options, config) {
|
|
|
8713
8788
|
} else {
|
|
8714
8789
|
context.root = LiveObject._fromItems(message.items, context.pool);
|
|
8715
8790
|
}
|
|
8716
|
-
const canWrite = _nullishCoalesce(_optionalChain([self, 'access',
|
|
8791
|
+
const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _187 => _187.get, 'call', _188 => _188(), 'optionalAccess', _189 => _189.canWrite]), () => ( true));
|
|
8717
8792
|
const stackSizeBefore = context.undoStack.length;
|
|
8718
8793
|
for (const key in context.initialStorage) {
|
|
8719
8794
|
if (context.root.get(key) === void 0) {
|
|
@@ -8916,7 +8991,7 @@ function createRoom(options, config) {
|
|
|
8916
8991
|
}
|
|
8917
8992
|
context.myPresence.patch(patch);
|
|
8918
8993
|
if (context.activeBatch) {
|
|
8919
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
8994
|
+
if (_optionalChain([options2, 'optionalAccess', _190 => _190.addToHistory])) {
|
|
8920
8995
|
context.activeBatch.reverseOps.pushLeft({
|
|
8921
8996
|
type: "presence",
|
|
8922
8997
|
data: oldValues
|
|
@@ -8925,7 +9000,7 @@ function createRoom(options, config) {
|
|
|
8925
9000
|
context.activeBatch.updates.presence = true;
|
|
8926
9001
|
} else {
|
|
8927
9002
|
flushNowOrSoon();
|
|
8928
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
9003
|
+
if (_optionalChain([options2, 'optionalAccess', _191 => _191.addToHistory])) {
|
|
8929
9004
|
addToUndoStack([{ type: "presence", data: oldValues }]);
|
|
8930
9005
|
}
|
|
8931
9006
|
notify({ presence: true });
|
|
@@ -9122,7 +9197,7 @@ function createRoom(options, config) {
|
|
|
9122
9197
|
if (process.env.NODE_ENV !== "production") {
|
|
9123
9198
|
const traces = /* @__PURE__ */ new Set();
|
|
9124
9199
|
for (const opId of message.opIds) {
|
|
9125
|
-
const trace = _optionalChain([context, 'access',
|
|
9200
|
+
const trace = _optionalChain([context, 'access', _192 => _192.opStackTraces, 'optionalAccess', _193 => _193.get, 'call', _194 => _194(opId)]);
|
|
9126
9201
|
if (trace) {
|
|
9127
9202
|
traces.add(trace);
|
|
9128
9203
|
}
|
|
@@ -9256,7 +9331,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9256
9331
|
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
9257
9332
|
createOrUpdateRootFromMessage(message);
|
|
9258
9333
|
applyAndSendOps(unacknowledgedOps);
|
|
9259
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall',
|
|
9334
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _195 => _195()]);
|
|
9260
9335
|
notifyStorageStatus();
|
|
9261
9336
|
eventHub.storageDidLoad.notify();
|
|
9262
9337
|
}
|
|
@@ -9477,8 +9552,8 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9477
9552
|
async function getThreads(options2) {
|
|
9478
9553
|
return httpClient.getThreads({
|
|
9479
9554
|
roomId,
|
|
9480
|
-
query: _optionalChain([options2, 'optionalAccess',
|
|
9481
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
9555
|
+
query: _optionalChain([options2, 'optionalAccess', _196 => _196.query]),
|
|
9556
|
+
cursor: _optionalChain([options2, 'optionalAccess', _197 => _197.cursor])
|
|
9482
9557
|
});
|
|
9483
9558
|
}
|
|
9484
9559
|
async function getThread(threadId) {
|
|
@@ -9585,7 +9660,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9585
9660
|
function getSubscriptionSettings(options2) {
|
|
9586
9661
|
return httpClient.getSubscriptionSettings({
|
|
9587
9662
|
roomId,
|
|
9588
|
-
signal: _optionalChain([options2, 'optionalAccess',
|
|
9663
|
+
signal: _optionalChain([options2, 'optionalAccess', _198 => _198.signal])
|
|
9589
9664
|
});
|
|
9590
9665
|
}
|
|
9591
9666
|
function updateSubscriptionSettings(settings) {
|
|
@@ -9607,7 +9682,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9607
9682
|
{
|
|
9608
9683
|
[kInternal]: {
|
|
9609
9684
|
get presenceBuffer() {
|
|
9610
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
9685
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _199 => _199.buffer, 'access', _200 => _200.presenceUpdates, 'optionalAccess', _201 => _201.data]), () => ( null)));
|
|
9611
9686
|
},
|
|
9612
9687
|
// prettier-ignore
|
|
9613
9688
|
get undoStack() {
|
|
@@ -9622,9 +9697,9 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9622
9697
|
return context.yjsProvider;
|
|
9623
9698
|
},
|
|
9624
9699
|
setYjsProvider(newProvider) {
|
|
9625
|
-
_optionalChain([context, 'access',
|
|
9700
|
+
_optionalChain([context, 'access', _202 => _202.yjsProvider, 'optionalAccess', _203 => _203.off, 'call', _204 => _204("status", yjsStatusDidChange)]);
|
|
9626
9701
|
context.yjsProvider = newProvider;
|
|
9627
|
-
_optionalChain([newProvider, 'optionalAccess',
|
|
9702
|
+
_optionalChain([newProvider, 'optionalAccess', _205 => _205.on, 'call', _206 => _206("status", yjsStatusDidChange)]);
|
|
9628
9703
|
context.yjsProviderDidChange.notify();
|
|
9629
9704
|
},
|
|
9630
9705
|
yjsProviderDidChange: context.yjsProviderDidChange.observable,
|
|
@@ -9670,7 +9745,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9670
9745
|
source.dispose();
|
|
9671
9746
|
}
|
|
9672
9747
|
eventHub.roomWillDestroy.notify();
|
|
9673
|
-
_optionalChain([context, 'access',
|
|
9748
|
+
_optionalChain([context, 'access', _207 => _207.yjsProvider, 'optionalAccess', _208 => _208.off, 'call', _209 => _209("status", yjsStatusDidChange)]);
|
|
9674
9749
|
syncSourceForStorage.destroy();
|
|
9675
9750
|
syncSourceForYjs.destroy();
|
|
9676
9751
|
uninstallBgTabSpy();
|
|
@@ -9820,7 +9895,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
|
|
|
9820
9895
|
}
|
|
9821
9896
|
if (isLiveNode(first)) {
|
|
9822
9897
|
const node = first;
|
|
9823
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
9898
|
+
if (_optionalChain([options, 'optionalAccess', _210 => _210.isDeep])) {
|
|
9824
9899
|
const storageCallback = second;
|
|
9825
9900
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
9826
9901
|
} else {
|
|
@@ -9877,6 +9952,7 @@ var MAX_LOST_CONNECTION_TIMEOUT = 3e4;
|
|
|
9877
9952
|
var DEFAULT_LOST_CONNECTION_TIMEOUT = 5e3;
|
|
9878
9953
|
var RESOLVE_USERS_BATCH_DELAY = 50;
|
|
9879
9954
|
var RESOLVE_ROOMS_INFO_BATCH_DELAY = 50;
|
|
9955
|
+
var RESOLVE_GROUPS_INFO_BATCH_DELAY = 50;
|
|
9880
9956
|
function getBaseUrl(baseUrl) {
|
|
9881
9957
|
if (typeof baseUrl === "string" && baseUrl.startsWith("http")) {
|
|
9882
9958
|
return baseUrl;
|
|
@@ -9886,7 +9962,7 @@ function getBaseUrl(baseUrl) {
|
|
|
9886
9962
|
}
|
|
9887
9963
|
function createClient(options) {
|
|
9888
9964
|
const clientOptions = options;
|
|
9889
|
-
const throttleDelay =
|
|
9965
|
+
const throttleDelay = getThrottle(_nullishCoalesce(clientOptions.throttle, () => ( DEFAULT_THROTTLE)));
|
|
9890
9966
|
const lostConnectionTimeout = getLostConnectionTimeout(
|
|
9891
9967
|
_nullishCoalesce(clientOptions.lostConnectionTimeout, () => ( DEFAULT_LOST_CONNECTION_TIMEOUT))
|
|
9892
9968
|
);
|
|
@@ -9899,8 +9975,8 @@ function createClient(options) {
|
|
|
9899
9975
|
const userId = token.k === "sec-legacy" /* SECRET_LEGACY */ ? token.id : token.uid;
|
|
9900
9976
|
currentUserId.set(() => userId);
|
|
9901
9977
|
});
|
|
9902
|
-
const fetchPolyfill = _optionalChain([clientOptions, 'access',
|
|
9903
|
-
_optionalChain([globalThis, 'access',
|
|
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)]);
|
|
9904
9980
|
const httpClient = createApiClient({
|
|
9905
9981
|
baseUrl,
|
|
9906
9982
|
fetchPolyfill,
|
|
@@ -9918,7 +9994,7 @@ function createClient(options) {
|
|
|
9918
9994
|
delegates: {
|
|
9919
9995
|
createSocket: makeCreateSocketDelegateForAi(
|
|
9920
9996
|
baseUrl,
|
|
9921
|
-
_optionalChain([clientOptions, 'access',
|
|
9997
|
+
_optionalChain([clientOptions, 'access', _216 => _216.polyfills, 'optionalAccess', _217 => _217.WebSocket])
|
|
9922
9998
|
),
|
|
9923
9999
|
authenticate: async () => {
|
|
9924
10000
|
const resp = await authManager.getAuthValue({
|
|
@@ -9986,7 +10062,7 @@ function createClient(options) {
|
|
|
9986
10062
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
9987
10063
|
roomId,
|
|
9988
10064
|
baseUrl,
|
|
9989
|
-
_optionalChain([clientOptions, 'access',
|
|
10065
|
+
_optionalChain([clientOptions, 'access', _218 => _218.polyfills, 'optionalAccess', _219 => _219.WebSocket])
|
|
9990
10066
|
),
|
|
9991
10067
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
9992
10068
|
})),
|
|
@@ -10009,7 +10085,7 @@ function createClient(options) {
|
|
|
10009
10085
|
const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
|
|
10010
10086
|
if (shouldConnect) {
|
|
10011
10087
|
if (typeof atob === "undefined") {
|
|
10012
|
-
if (_optionalChain([clientOptions, 'access',
|
|
10088
|
+
if (_optionalChain([clientOptions, 'access', _220 => _220.polyfills, 'optionalAccess', _221 => _221.atob]) === void 0) {
|
|
10013
10089
|
throw new Error(
|
|
10014
10090
|
"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"
|
|
10015
10091
|
);
|
|
@@ -10021,7 +10097,7 @@ function createClient(options) {
|
|
|
10021
10097
|
return leaseRoom(newRoomDetails);
|
|
10022
10098
|
}
|
|
10023
10099
|
function getRoom(roomId) {
|
|
10024
|
-
const room = _optionalChain([roomsById, 'access',
|
|
10100
|
+
const room = _optionalChain([roomsById, 'access', _222 => _222.get, 'call', _223 => _223(roomId), 'optionalAccess', _224 => _224.room]);
|
|
10025
10101
|
return room ? room : null;
|
|
10026
10102
|
}
|
|
10027
10103
|
function logout() {
|
|
@@ -10034,15 +10110,14 @@ function createClient(options) {
|
|
|
10034
10110
|
}
|
|
10035
10111
|
}
|
|
10036
10112
|
const resolveUsers = clientOptions.resolveUsers;
|
|
10037
|
-
const warnIfNoResolveUsers = createDevelopmentWarning(
|
|
10038
|
-
() => !resolveUsers,
|
|
10039
|
-
"Set the resolveUsers option in createClient to specify user info."
|
|
10040
|
-
);
|
|
10041
10113
|
const batchedResolveUsers = new Batch(
|
|
10042
10114
|
async (batchedUserIds) => {
|
|
10043
10115
|
const userIds = batchedUserIds.flat();
|
|
10044
|
-
const users = await _optionalChain([resolveUsers, 'optionalCall',
|
|
10045
|
-
|
|
10116
|
+
const users = await _optionalChain([resolveUsers, 'optionalCall', _225 => _225({ userIds })]);
|
|
10117
|
+
warnOnceIf(
|
|
10118
|
+
!resolveUsers,
|
|
10119
|
+
"Set the resolveUsers option in createClient to specify user info."
|
|
10120
|
+
);
|
|
10046
10121
|
return _nullishCoalesce(users, () => ( userIds.map(() => void 0)));
|
|
10047
10122
|
},
|
|
10048
10123
|
{ delay: RESOLVE_USERS_BATCH_DELAY }
|
|
@@ -10052,15 +10127,14 @@ function createClient(options) {
|
|
|
10052
10127
|
usersStore.invalidate(userIds);
|
|
10053
10128
|
}
|
|
10054
10129
|
const resolveRoomsInfo = clientOptions.resolveRoomsInfo;
|
|
10055
|
-
const warnIfNoResolveRoomsInfo = createDevelopmentWarning(
|
|
10056
|
-
() => !resolveRoomsInfo,
|
|
10057
|
-
"Set the resolveRoomsInfo option in createClient to specify room info."
|
|
10058
|
-
);
|
|
10059
10130
|
const batchedResolveRoomsInfo = new Batch(
|
|
10060
10131
|
async (batchedRoomIds) => {
|
|
10061
10132
|
const roomIds = batchedRoomIds.flat();
|
|
10062
|
-
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall',
|
|
10063
|
-
|
|
10133
|
+
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _226 => _226({ roomIds })]);
|
|
10134
|
+
warnOnceIf(
|
|
10135
|
+
!resolveRoomsInfo,
|
|
10136
|
+
"Set the resolveRoomsInfo option in createClient to specify room info."
|
|
10137
|
+
);
|
|
10064
10138
|
return _nullishCoalesce(roomsInfo, () => ( roomIds.map(() => void 0)));
|
|
10065
10139
|
},
|
|
10066
10140
|
{ delay: RESOLVE_ROOMS_INFO_BATCH_DELAY }
|
|
@@ -10069,6 +10143,23 @@ function createClient(options) {
|
|
|
10069
10143
|
function invalidateResolvedRoomsInfo(roomIds) {
|
|
10070
10144
|
roomsInfoStore.invalidate(roomIds);
|
|
10071
10145
|
}
|
|
10146
|
+
const resolveGroupsInfo = clientOptions.resolveGroupsInfo;
|
|
10147
|
+
const batchedResolveGroupsInfo = new Batch(
|
|
10148
|
+
async (batchedGroupIds) => {
|
|
10149
|
+
const groupIds = batchedGroupIds.flat();
|
|
10150
|
+
const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _227 => _227({ groupIds })]);
|
|
10151
|
+
warnOnceIf(
|
|
10152
|
+
!resolveGroupsInfo,
|
|
10153
|
+
"Set the resolveGroupsInfo option in createClient to specify group info."
|
|
10154
|
+
);
|
|
10155
|
+
return _nullishCoalesce(groupsInfo, () => ( groupIds.map(() => void 0)));
|
|
10156
|
+
},
|
|
10157
|
+
{ delay: RESOLVE_GROUPS_INFO_BATCH_DELAY }
|
|
10158
|
+
);
|
|
10159
|
+
const groupsInfoStore = createBatchStore(batchedResolveGroupsInfo);
|
|
10160
|
+
function invalidateResolvedGroupsInfo(groupIds) {
|
|
10161
|
+
groupsInfoStore.invalidate(groupIds);
|
|
10162
|
+
}
|
|
10072
10163
|
const mentionSuggestionsCache = /* @__PURE__ */ new Map();
|
|
10073
10164
|
function invalidateResolvedMentionSuggestions() {
|
|
10074
10165
|
mentionSuggestionsCache.clear();
|
|
@@ -10112,7 +10203,7 @@ function createClient(options) {
|
|
|
10112
10203
|
}
|
|
10113
10204
|
};
|
|
10114
10205
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
10115
|
-
_optionalChain([win, 'optionalAccess',
|
|
10206
|
+
_optionalChain([win, 'optionalAccess', _228 => _228.addEventListener, 'call', _229 => _229("beforeunload", maybePreventClose)]);
|
|
10116
10207
|
}
|
|
10117
10208
|
async function getNotificationSettings(options2) {
|
|
10118
10209
|
const plainSettings = await httpClient.getNotificationSettings(options2);
|
|
@@ -10144,6 +10235,7 @@ function createClient(options) {
|
|
|
10144
10235
|
resolvers: {
|
|
10145
10236
|
invalidateUsers: invalidateResolvedUsers,
|
|
10146
10237
|
invalidateRoomsInfo: invalidateResolvedRoomsInfo,
|
|
10238
|
+
invalidateGroupsInfo: invalidateResolvedGroupsInfo,
|
|
10147
10239
|
invalidateMentionSuggestions: invalidateResolvedMentionSuggestions
|
|
10148
10240
|
},
|
|
10149
10241
|
getSyncStatus,
|
|
@@ -10159,6 +10251,7 @@ function createClient(options) {
|
|
|
10159
10251
|
resolveMentionSuggestions: clientOptions.resolveMentionSuggestions,
|
|
10160
10252
|
usersStore,
|
|
10161
10253
|
roomsInfoStore,
|
|
10254
|
+
groupsInfoStore,
|
|
10162
10255
|
getRoomIds() {
|
|
10163
10256
|
return Array.from(roomsById.keys());
|
|
10164
10257
|
},
|
|
@@ -10210,20 +10303,6 @@ function getLostConnectionTimeout(value) {
|
|
|
10210
10303
|
RECOMMENDED_MIN_LOST_CONNECTION_TIMEOUT
|
|
10211
10304
|
);
|
|
10212
10305
|
}
|
|
10213
|
-
function createDevelopmentWarning(condition, ...args) {
|
|
10214
|
-
let hasWarned = false;
|
|
10215
|
-
if (process.env.NODE_ENV !== "production") {
|
|
10216
|
-
return () => {
|
|
10217
|
-
if (!hasWarned && (typeof condition === "function" ? condition() : condition)) {
|
|
10218
|
-
warn(...args);
|
|
10219
|
-
hasWarned = true;
|
|
10220
|
-
}
|
|
10221
|
-
};
|
|
10222
|
-
} else {
|
|
10223
|
-
return () => {
|
|
10224
|
-
};
|
|
10225
|
-
}
|
|
10226
|
-
}
|
|
10227
10306
|
|
|
10228
10307
|
// src/comments/comment-body.ts
|
|
10229
10308
|
function isCommentBodyParagraph(element) {
|
|
@@ -10251,7 +10330,7 @@ var commentBodyElementsTypes = {
|
|
|
10251
10330
|
mention: "inline"
|
|
10252
10331
|
};
|
|
10253
10332
|
function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
10254
|
-
if (!body || !_optionalChain([body, 'optionalAccess',
|
|
10333
|
+
if (!body || !_optionalChain([body, 'optionalAccess', _230 => _230.content])) {
|
|
10255
10334
|
return;
|
|
10256
10335
|
}
|
|
10257
10336
|
const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
|
|
@@ -10261,13 +10340,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
|
10261
10340
|
for (const block of body.content) {
|
|
10262
10341
|
if (type === "all" || type === "block") {
|
|
10263
10342
|
if (guard(block)) {
|
|
10264
|
-
_optionalChain([visitor, 'optionalCall',
|
|
10343
|
+
_optionalChain([visitor, 'optionalCall', _231 => _231(block)]);
|
|
10265
10344
|
}
|
|
10266
10345
|
}
|
|
10267
10346
|
if (type === "all" || type === "inline") {
|
|
10268
10347
|
for (const inline of block.children) {
|
|
10269
10348
|
if (guard(inline)) {
|
|
10270
|
-
_optionalChain([visitor, 'optionalCall',
|
|
10349
|
+
_optionalChain([visitor, 'optionalCall', _232 => _232(inline)]);
|
|
10271
10350
|
}
|
|
10272
10351
|
}
|
|
10273
10352
|
}
|
|
@@ -10288,25 +10367,42 @@ function getMentionsFromCommentBody(body, predicate) {
|
|
|
10288
10367
|
});
|
|
10289
10368
|
return mentions;
|
|
10290
10369
|
}
|
|
10291
|
-
async function
|
|
10370
|
+
async function resolveMentionsInCommentBody(body, resolveUsers, resolveGroupsInfo) {
|
|
10292
10371
|
const resolvedUsers = /* @__PURE__ */ new Map();
|
|
10293
|
-
|
|
10294
|
-
|
|
10372
|
+
const resolvedGroupsInfo = /* @__PURE__ */ new Map();
|
|
10373
|
+
if (!resolveUsers && !resolveGroupsInfo) {
|
|
10374
|
+
return {
|
|
10375
|
+
users: resolvedUsers,
|
|
10376
|
+
groups: resolvedGroupsInfo
|
|
10377
|
+
};
|
|
10295
10378
|
}
|
|
10296
|
-
const
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
const
|
|
10305
|
-
|
|
10306
|
-
|
|
10379
|
+
const mentions = getMentionsFromCommentBody(body);
|
|
10380
|
+
const userIds = mentions.filter((mention) => mention.kind === "user").map((mention) => mention.id);
|
|
10381
|
+
const groupIds = mentions.filter((mention) => mention.kind === "group").map((mention) => mention.id);
|
|
10382
|
+
const [users, groups] = await Promise.all([
|
|
10383
|
+
resolveUsers && userIds.length > 0 ? resolveUsers({ userIds }) : void 0,
|
|
10384
|
+
resolveGroupsInfo && groupIds.length > 0 ? resolveGroupsInfo({ groupIds }) : void 0
|
|
10385
|
+
]);
|
|
10386
|
+
if (users) {
|
|
10387
|
+
for (const [index, userId] of userIds.entries()) {
|
|
10388
|
+
const user = users[index];
|
|
10389
|
+
if (user) {
|
|
10390
|
+
resolvedUsers.set(userId, user);
|
|
10391
|
+
}
|
|
10307
10392
|
}
|
|
10308
10393
|
}
|
|
10309
|
-
|
|
10394
|
+
if (groups) {
|
|
10395
|
+
for (const [index, groupId] of groupIds.entries()) {
|
|
10396
|
+
const group = groups[index];
|
|
10397
|
+
if (group) {
|
|
10398
|
+
resolvedGroupsInfo.set(groupId, group);
|
|
10399
|
+
}
|
|
10400
|
+
}
|
|
10401
|
+
}
|
|
10402
|
+
return {
|
|
10403
|
+
users: resolvedUsers,
|
|
10404
|
+
groups: resolvedGroupsInfo
|
|
10405
|
+
};
|
|
10310
10406
|
}
|
|
10311
10407
|
var htmlEscapables = {
|
|
10312
10408
|
"&": "&",
|
|
@@ -10419,8 +10515,8 @@ var stringifyCommentBodyPlainElements = {
|
|
|
10419
10515
|
paragraph: ({ children }) => children,
|
|
10420
10516
|
text: ({ element }) => element.text,
|
|
10421
10517
|
link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
|
|
10422
|
-
mention: ({ element, user }) => {
|
|
10423
|
-
return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
10518
|
+
mention: ({ element, user, group }) => {
|
|
10519
|
+
return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _233 => _233.name]), () => ( _optionalChain([group, 'optionalAccess', _234 => _234.name]))), () => ( element.id))}`;
|
|
10424
10520
|
}
|
|
10425
10521
|
};
|
|
10426
10522
|
var stringifyCommentBodyHtmlElements = {
|
|
@@ -10449,8 +10545,8 @@ var stringifyCommentBodyHtmlElements = {
|
|
|
10449
10545
|
link: ({ element, href }) => {
|
|
10450
10546
|
return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
|
|
10451
10547
|
},
|
|
10452
|
-
mention: ({ element, user }) => {
|
|
10453
|
-
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess',
|
|
10548
|
+
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>`;
|
|
10454
10550
|
}
|
|
10455
10551
|
};
|
|
10456
10552
|
var stringifyCommentBodyMarkdownElements = {
|
|
@@ -10479,20 +10575,21 @@ var stringifyCommentBodyMarkdownElements = {
|
|
|
10479
10575
|
link: ({ element, href }) => {
|
|
10480
10576
|
return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
|
|
10481
10577
|
},
|
|
10482
|
-
mention: ({ element, user }) => {
|
|
10483
|
-
return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
10578
|
+
mention: ({ element, user, group }) => {
|
|
10579
|
+
return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _239 => _239.name]), () => ( _optionalChain([group, 'optionalAccess', _240 => _240.name]))), () => ( element.id))}`;
|
|
10484
10580
|
}
|
|
10485
10581
|
};
|
|
10486
10582
|
async function stringifyCommentBody(body, options) {
|
|
10487
|
-
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
10488
|
-
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
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")));
|
|
10489
10585
|
const elements = {
|
|
10490
10586
|
...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
|
|
10491
|
-
..._optionalChain([options, 'optionalAccess',
|
|
10587
|
+
..._optionalChain([options, 'optionalAccess', _243 => _243.elements])
|
|
10492
10588
|
};
|
|
10493
|
-
const resolvedUsers = await
|
|
10589
|
+
const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInCommentBody(
|
|
10494
10590
|
body,
|
|
10495
|
-
_optionalChain([options, 'optionalAccess',
|
|
10591
|
+
_optionalChain([options, 'optionalAccess', _244 => _244.resolveUsers]),
|
|
10592
|
+
_optionalChain([options, 'optionalAccess', _245 => _245.resolveGroupsInfo])
|
|
10496
10593
|
);
|
|
10497
10594
|
const blocks = body.content.flatMap((block, blockIndex) => {
|
|
10498
10595
|
switch (block.type) {
|
|
@@ -10503,7 +10600,8 @@ async function stringifyCommentBody(body, options) {
|
|
|
10503
10600
|
elements.mention(
|
|
10504
10601
|
{
|
|
10505
10602
|
element: inline,
|
|
10506
|
-
user: resolvedUsers.get(inline.id)
|
|
10603
|
+
user: inline.kind === "user" ? resolvedUsers.get(inline.id) : void 0,
|
|
10604
|
+
group: inline.kind === "group" ? resolvedGroupsInfo.get(inline.id) : void 0
|
|
10507
10605
|
},
|
|
10508
10606
|
inlineIndex
|
|
10509
10607
|
)
|
|
@@ -10778,12 +10876,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
10778
10876
|
}
|
|
10779
10877
|
const newState = Object.assign({}, state);
|
|
10780
10878
|
for (const key in update.updates) {
|
|
10781
|
-
if (_optionalChain([update, 'access',
|
|
10879
|
+
if (_optionalChain([update, 'access', _246 => _246.updates, 'access', _247 => _247[key], 'optionalAccess', _248 => _248.type]) === "update") {
|
|
10782
10880
|
const val = update.node.get(key);
|
|
10783
10881
|
if (val !== void 0) {
|
|
10784
10882
|
newState[key] = lsonToJson(val);
|
|
10785
10883
|
}
|
|
10786
|
-
} else if (_optionalChain([update, 'access',
|
|
10884
|
+
} else if (_optionalChain([update, 'access', _249 => _249.updates, 'access', _250 => _250[key], 'optionalAccess', _251 => _251.type]) === "delete") {
|
|
10787
10885
|
delete newState[key];
|
|
10788
10886
|
}
|
|
10789
10887
|
}
|
|
@@ -10844,12 +10942,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
10844
10942
|
}
|
|
10845
10943
|
const newState = Object.assign({}, state);
|
|
10846
10944
|
for (const key in update.updates) {
|
|
10847
|
-
if (_optionalChain([update, 'access',
|
|
10945
|
+
if (_optionalChain([update, 'access', _252 => _252.updates, 'access', _253 => _253[key], 'optionalAccess', _254 => _254.type]) === "update") {
|
|
10848
10946
|
const value = update.node.get(key);
|
|
10849
10947
|
if (value !== void 0) {
|
|
10850
10948
|
newState[key] = lsonToJson(value);
|
|
10851
10949
|
}
|
|
10852
|
-
} else if (_optionalChain([update, 'access',
|
|
10950
|
+
} else if (_optionalChain([update, 'access', _255 => _255.updates, 'access', _256 => _256[key], 'optionalAccess', _257 => _257.type]) === "delete") {
|
|
10853
10951
|
delete newState[key];
|
|
10854
10952
|
}
|
|
10855
10953
|
}
|
|
@@ -10929,9 +11027,9 @@ function makePoller(callback, intervalMs, options) {
|
|
|
10929
11027
|
const startTime = performance.now();
|
|
10930
11028
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
10931
11029
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
10932
|
-
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
11030
|
+
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _258 => _258.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
|
|
10933
11031
|
const context = {
|
|
10934
|
-
inForeground: _optionalChain([doc, 'optionalAccess',
|
|
11032
|
+
inForeground: _optionalChain([doc, 'optionalAccess', _259 => _259.visibilityState]) !== "hidden",
|
|
10935
11033
|
lastSuccessfulPollAt: startTime,
|
|
10936
11034
|
count: 0,
|
|
10937
11035
|
backoff: 0
|
|
@@ -11012,11 +11110,11 @@ function makePoller(callback, intervalMs, options) {
|
|
|
11012
11110
|
pollNowIfStale();
|
|
11013
11111
|
}
|
|
11014
11112
|
function onVisibilityChange() {
|
|
11015
|
-
setInForeground(_optionalChain([doc, 'optionalAccess',
|
|
11113
|
+
setInForeground(_optionalChain([doc, 'optionalAccess', _260 => _260.visibilityState]) !== "hidden");
|
|
11016
11114
|
}
|
|
11017
|
-
_optionalChain([doc, 'optionalAccess',
|
|
11018
|
-
_optionalChain([win, 'optionalAccess',
|
|
11019
|
-
_optionalChain([win, 'optionalAccess',
|
|
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)]);
|
|
11020
11118
|
fsm.start();
|
|
11021
11119
|
return {
|
|
11022
11120
|
inc,
|
|
@@ -11146,5 +11244,9 @@ detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
|
|
|
11146
11244
|
|
|
11147
11245
|
|
|
11148
11246
|
|
|
11149
|
-
|
|
11247
|
+
|
|
11248
|
+
|
|
11249
|
+
|
|
11250
|
+
|
|
11251
|
+
exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.Deque = Deque; exports.DerivedSignal = DerivedSignal; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.LiveblocksError = LiveblocksError; exports.MENTION_CHARACTER = MENTION_CHARACTER; exports.MutableSignal = MutableSignal; exports.OpCode = OpCode; exports.Permission = Permission; exports.Promise_withResolvers = Promise_withResolvers; exports.ServerMsgCode = ServerMsgCode; exports.Signal = Signal; exports.SortedList = SortedList; exports.TextEditorType = TextEditorType; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.ackOp = ackOp; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.checkBounds = checkBounds; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToGroupData = convertToGroupData; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToSubscriptionData = convertToSubscriptionData; exports.convertToThreadData = convertToThreadData; exports.convertToUserSubscriptionData = convertToUserSubscriptionData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createManagedPool = createManagedPool; exports.createNotificationSettings = createNotificationSettings; exports.createThreadId = createThreadId; exports.defineAiTool = defineAiTool; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.entries = entries; exports.errorIf = errorIf; exports.findLastIndex = findLastIndex; exports.freeze = freeze; exports.generateUrl = generateUrl; exports.getMentionsFromCommentBody = getMentionsFromCommentBody; exports.getSubscriptionKey = getSubscriptionKey; exports.html = html; exports.htmlSafe = htmlSafe; exports.isChildCrdt = isChildCrdt; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isNotificationChannelEnabled = isNotificationChannelEnabled; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.isStartsWithOperator = isStartsWithOperator; exports.isUrl = isUrl; exports.kInternal = kInternal; exports.keys = keys; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeAbortController = makeAbortController; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.objectToQuery = objectToQuery; exports.patchLiveObjectKey = patchLiveObjectKey; exports.patchNotificationSettings = patchNotificationSettings; exports.raise = raise; exports.resolveMentionsInCommentBody = resolveMentionsInCommentBody; exports.sanitizeUrl = sanitizeUrl; exports.shallow = shallow; exports.shallow2 = shallow2; exports.stableStringify = stableStringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.warnOnce = warnOnce; exports.warnOnceIf = warnOnceIf; exports.withTimeout = withTimeout;
|
|
11150
11252
|
//# sourceMappingURL=index.cjs.map
|