@liveblocks/core 3.23.0-file2 → 3.23.0-file4
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 +416 -224
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +120 -115
- package/dist/index.d.ts +120 -115
- package/dist/index.js +255 -63
- 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.23.0-
|
|
9
|
+
var PKG_VERSION = "3.23.0-file4";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -1919,8 +1919,10 @@ var Batch = (_class = class {
|
|
|
1919
1919
|
this.#clearDelayTimeout();
|
|
1920
1920
|
}
|
|
1921
1921
|
}, _class);
|
|
1922
|
-
function createBatchStore(batch2) {
|
|
1922
|
+
function createBatchStore(batch2, options) {
|
|
1923
1923
|
const signal = new MutableSignal(/* @__PURE__ */ new Map());
|
|
1924
|
+
const cacheExpiryTimeouts = /* @__PURE__ */ new Map();
|
|
1925
|
+
const pendingEnqueues = /* @__PURE__ */ new Map();
|
|
1924
1926
|
function getCacheKey(args) {
|
|
1925
1927
|
return stableStringify(args);
|
|
1926
1928
|
}
|
|
@@ -1935,7 +1937,42 @@ function createBatchStore(batch2) {
|
|
|
1935
1937
|
}
|
|
1936
1938
|
});
|
|
1937
1939
|
}
|
|
1940
|
+
function clearCacheExpiry(cacheKey) {
|
|
1941
|
+
const timeoutId = cacheExpiryTimeouts.get(cacheKey);
|
|
1942
|
+
if (timeoutId !== void 0) {
|
|
1943
|
+
clearTimeout(timeoutId);
|
|
1944
|
+
cacheExpiryTimeouts.delete(cacheKey);
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
function scheduleCacheExpiry(input, expiresAt) {
|
|
1948
|
+
const cacheKey = getCacheKey(input);
|
|
1949
|
+
clearCacheExpiry(cacheKey);
|
|
1950
|
+
if (expiresAt === void 0 || !Number.isFinite(expiresAt)) {
|
|
1951
|
+
return;
|
|
1952
|
+
}
|
|
1953
|
+
const timeoutId = setTimeout(
|
|
1954
|
+
() => {
|
|
1955
|
+
cacheExpiryTimeouts.delete(cacheKey);
|
|
1956
|
+
invalidate([input]);
|
|
1957
|
+
},
|
|
1958
|
+
Math.max(0, expiresAt - Date.now())
|
|
1959
|
+
);
|
|
1960
|
+
cacheExpiryTimeouts.set(cacheKey, timeoutId);
|
|
1961
|
+
}
|
|
1938
1962
|
function invalidate(inputs) {
|
|
1963
|
+
if (Array.isArray(inputs)) {
|
|
1964
|
+
for (const input of inputs) {
|
|
1965
|
+
const cacheKey = getCacheKey(input);
|
|
1966
|
+
clearCacheExpiry(cacheKey);
|
|
1967
|
+
pendingEnqueues.delete(cacheKey);
|
|
1968
|
+
}
|
|
1969
|
+
} else {
|
|
1970
|
+
for (const timeoutId of cacheExpiryTimeouts.values()) {
|
|
1971
|
+
clearTimeout(timeoutId);
|
|
1972
|
+
}
|
|
1973
|
+
cacheExpiryTimeouts.clear();
|
|
1974
|
+
pendingEnqueues.clear();
|
|
1975
|
+
}
|
|
1939
1976
|
signal.mutate((cache) => {
|
|
1940
1977
|
if (Array.isArray(inputs)) {
|
|
1941
1978
|
for (const input of inputs) {
|
|
@@ -1946,23 +1983,54 @@ function createBatchStore(batch2) {
|
|
|
1946
1983
|
}
|
|
1947
1984
|
});
|
|
1948
1985
|
}
|
|
1949
|
-
async function
|
|
1950
|
-
const cacheKey = getCacheKey(input);
|
|
1951
|
-
const cache = signal.get();
|
|
1952
|
-
if (cache.has(cacheKey)) {
|
|
1953
|
-
return;
|
|
1954
|
-
}
|
|
1986
|
+
async function processEnqueue(input, cacheKey, batchResult$, pendingEnqueueId) {
|
|
1955
1987
|
try {
|
|
1956
|
-
|
|
1957
|
-
|
|
1988
|
+
const result = await batchResult$;
|
|
1989
|
+
if (_optionalChain([pendingEnqueues, 'access', _27 => _27.get, 'call', _28 => _28(cacheKey), 'optionalAccess', _29 => _29.id]) !== pendingEnqueueId) {
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1958
1992
|
update({ key: cacheKey, state: { isLoading: false, data: result } });
|
|
1993
|
+
scheduleCacheExpiry(input, _optionalChain([options, 'optionalAccess', _30 => _30.getCacheExpiry, 'optionalCall', _31 => _31(result)]));
|
|
1959
1994
|
} catch (error3) {
|
|
1995
|
+
if (_optionalChain([pendingEnqueues, 'access', _32 => _32.get, 'call', _33 => _33(cacheKey), 'optionalAccess', _34 => _34.id]) !== pendingEnqueueId) {
|
|
1996
|
+
return;
|
|
1997
|
+
}
|
|
1998
|
+
scheduleCacheExpiry(input, _optionalChain([options, 'optionalAccess', _35 => _35.getErrorCacheExpiry, 'optionalCall', _36 => _36(error3)]));
|
|
1960
1999
|
update({
|
|
1961
2000
|
key: cacheKey,
|
|
1962
2001
|
state: { isLoading: false, error: error3 }
|
|
1963
2002
|
});
|
|
2003
|
+
} finally {
|
|
2004
|
+
if (_optionalChain([pendingEnqueues, 'access', _37 => _37.get, 'call', _38 => _38(cacheKey), 'optionalAccess', _39 => _39.id]) === pendingEnqueueId) {
|
|
2005
|
+
pendingEnqueues.delete(cacheKey);
|
|
2006
|
+
}
|
|
1964
2007
|
}
|
|
1965
2008
|
}
|
|
2009
|
+
function enqueue(input) {
|
|
2010
|
+
const cacheKey = getCacheKey(input);
|
|
2011
|
+
const existingEnqueue = pendingEnqueues.get(cacheKey);
|
|
2012
|
+
if (existingEnqueue !== void 0) {
|
|
2013
|
+
return existingEnqueue.promise;
|
|
2014
|
+
}
|
|
2015
|
+
const cache = signal.get();
|
|
2016
|
+
if (cache.has(cacheKey)) {
|
|
2017
|
+
return Promise.resolve();
|
|
2018
|
+
}
|
|
2019
|
+
const batchResult$ = batch2.get(input);
|
|
2020
|
+
const pendingEnqueueId = /* @__PURE__ */ Symbol();
|
|
2021
|
+
const pendingEnqueue$ = processEnqueue(
|
|
2022
|
+
input,
|
|
2023
|
+
cacheKey,
|
|
2024
|
+
batchResult$,
|
|
2025
|
+
pendingEnqueueId
|
|
2026
|
+
);
|
|
2027
|
+
pendingEnqueues.set(cacheKey, {
|
|
2028
|
+
id: pendingEnqueueId,
|
|
2029
|
+
promise: pendingEnqueue$
|
|
2030
|
+
});
|
|
2031
|
+
update({ key: cacheKey, state: { isLoading: true } });
|
|
2032
|
+
return pendingEnqueue$;
|
|
2033
|
+
}
|
|
1966
2034
|
function setData(entries2) {
|
|
1967
2035
|
update(
|
|
1968
2036
|
entries2.map((entry) => ({
|
|
@@ -1970,6 +2038,9 @@ function createBatchStore(batch2) {
|
|
|
1970
2038
|
state: { isLoading: false, data: entry[1] }
|
|
1971
2039
|
}))
|
|
1972
2040
|
);
|
|
2041
|
+
for (const [input, output] of entries2) {
|
|
2042
|
+
scheduleCacheExpiry(input, _optionalChain([options, 'optionalAccess', _40 => _40.getCacheExpiry, 'optionalCall', _41 => _41(output)]));
|
|
2043
|
+
}
|
|
1973
2044
|
}
|
|
1974
2045
|
function getItemState(input) {
|
|
1975
2046
|
const cacheKey = getCacheKey(input);
|
|
@@ -1979,7 +2050,22 @@ function createBatchStore(batch2) {
|
|
|
1979
2050
|
function getData(input) {
|
|
1980
2051
|
const cacheKey = getCacheKey(input);
|
|
1981
2052
|
const cache = signal.get();
|
|
1982
|
-
return _optionalChain([cache, 'access',
|
|
2053
|
+
return _optionalChain([cache, 'access', _42 => _42.get, 'call', _43 => _43(cacheKey), 'optionalAccess', _44 => _44.data]);
|
|
2054
|
+
}
|
|
2055
|
+
function waitUntilItemCacheExpires(input) {
|
|
2056
|
+
const cacheKey = getCacheKey(input);
|
|
2057
|
+
if (!cacheExpiryTimeouts.has(cacheKey)) {
|
|
2058
|
+
return void 0;
|
|
2059
|
+
}
|
|
2060
|
+
const initialState = signal.get().get(cacheKey);
|
|
2061
|
+
return new Promise((resolve) => {
|
|
2062
|
+
const unsubscribe = signal.subscribe(() => {
|
|
2063
|
+
if (signal.get().get(cacheKey) !== initialState) {
|
|
2064
|
+
unsubscribe();
|
|
2065
|
+
resolve();
|
|
2066
|
+
}
|
|
2067
|
+
});
|
|
2068
|
+
});
|
|
1983
2069
|
}
|
|
1984
2070
|
function _cacheKeys() {
|
|
1985
2071
|
const cache = signal.get();
|
|
@@ -1991,6 +2077,7 @@ function createBatchStore(batch2) {
|
|
|
1991
2077
|
setData,
|
|
1992
2078
|
getItemState,
|
|
1993
2079
|
getData,
|
|
2080
|
+
waitUntilItemCacheExpires,
|
|
1994
2081
|
invalidate,
|
|
1995
2082
|
batch: batch2,
|
|
1996
2083
|
_cacheKeys
|
|
@@ -2274,6 +2361,10 @@ function isUrl(string) {
|
|
|
2274
2361
|
// src/api-client.ts
|
|
2275
2362
|
var ROOM_FILE_PART_SIZE = 5 * 1024 * 1024;
|
|
2276
2363
|
var ROOM_FILE_RETRY_ATTEMPTS = 10;
|
|
2364
|
+
var FILE_URL_EXPIRY_BUFFER = 3e4;
|
|
2365
|
+
var FILE_URL_ERROR_CACHE_TTL = 1e3;
|
|
2366
|
+
var FILE_URL_ERROR_MAX_ATTEMPTS = 3;
|
|
2367
|
+
var FILE_URL_ERROR_ATTEMPTS_EXPIRY = 3e4;
|
|
2277
2368
|
var ROOM_FILE_RETRY_DELAYS = [
|
|
2278
2369
|
2e3,
|
|
2279
2370
|
2e3,
|
|
@@ -2286,10 +2377,13 @@ var ROOM_FILE_RETRY_DELAYS = [
|
|
|
2286
2377
|
2e3,
|
|
2287
2378
|
2e3
|
|
2288
2379
|
];
|
|
2380
|
+
var FileUrlUnavailableError = class extends Error {
|
|
2381
|
+
};
|
|
2289
2382
|
async function uploadRoomFile({
|
|
2290
2383
|
file,
|
|
2291
2384
|
signal,
|
|
2292
2385
|
abortErrorMessage,
|
|
2386
|
+
retryMultipartCompletion,
|
|
2293
2387
|
uploadSingle,
|
|
2294
2388
|
createMultipartUpload,
|
|
2295
2389
|
uploadMultipartPart,
|
|
@@ -2297,17 +2391,14 @@ async function uploadRoomFile({
|
|
|
2297
2391
|
abortMultipartUpload
|
|
2298
2392
|
}) {
|
|
2299
2393
|
const abortError = createAbortError(abortErrorMessage);
|
|
2300
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
2394
|
+
if (_optionalChain([signal, 'optionalAccess', _45 => _45.aborted])) {
|
|
2301
2395
|
throw abortError;
|
|
2302
2396
|
}
|
|
2303
2397
|
const handleRetryError = (err) => {
|
|
2304
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
2398
|
+
if (_optionalChain([signal, 'optionalAccess', _46 => _46.aborted])) {
|
|
2305
2399
|
throw abortError;
|
|
2306
2400
|
}
|
|
2307
|
-
|
|
2308
|
-
throw err;
|
|
2309
|
-
}
|
|
2310
|
-
return false;
|
|
2401
|
+
return err instanceof HttpError && err.status >= 400 && err.status < 500;
|
|
2311
2402
|
};
|
|
2312
2403
|
if (file.size <= ROOM_FILE_PART_SIZE) {
|
|
2313
2404
|
return autoRetry(
|
|
@@ -2325,41 +2416,84 @@ async function uploadRoomFile({
|
|
|
2325
2416
|
ROOM_FILE_RETRY_DELAYS,
|
|
2326
2417
|
handleRetryError
|
|
2327
2418
|
);
|
|
2419
|
+
const partUploadController = new AbortController();
|
|
2420
|
+
const partUploadSignal = partUploadController.signal;
|
|
2421
|
+
const abortPartUploads = (reason) => {
|
|
2422
|
+
partUploadController.abort(reason);
|
|
2423
|
+
};
|
|
2424
|
+
const handleExternalAbort = () => abortPartUploads();
|
|
2425
|
+
if (_optionalChain([signal, 'optionalAccess', _47 => _47.aborted])) {
|
|
2426
|
+
handleExternalAbort();
|
|
2427
|
+
} else {
|
|
2428
|
+
_optionalChain([signal, 'optionalAccess', _48 => _48.addEventListener, 'call', _49 => _49("abort", handleExternalAbort, { once: true })]);
|
|
2429
|
+
}
|
|
2328
2430
|
try {
|
|
2329
2431
|
uploadId = multipartUpload.uploadId;
|
|
2330
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
2432
|
+
if (_optionalChain([signal, 'optionalAccess', _50 => _50.aborted])) {
|
|
2331
2433
|
throw abortError;
|
|
2332
2434
|
}
|
|
2333
2435
|
const batches = chunk(splitFileIntoParts(file), 5);
|
|
2334
2436
|
for (const parts of batches) {
|
|
2335
|
-
const
|
|
2437
|
+
const firstPartUploadFailure = {};
|
|
2438
|
+
const partUploads$ = [];
|
|
2336
2439
|
for (const { part, partNumber } of parts) {
|
|
2337
|
-
|
|
2440
|
+
partUploads$.push(
|
|
2338
2441
|
autoRetry(
|
|
2339
|
-
() => uploadMultipartPart(
|
|
2442
|
+
() => uploadMultipartPart(
|
|
2443
|
+
multipartUpload.uploadId,
|
|
2444
|
+
partNumber,
|
|
2445
|
+
part,
|
|
2446
|
+
partUploadSignal
|
|
2447
|
+
),
|
|
2340
2448
|
ROOM_FILE_RETRY_ATTEMPTS,
|
|
2341
2449
|
ROOM_FILE_RETRY_DELAYS,
|
|
2342
|
-
|
|
2343
|
-
|
|
2450
|
+
(error3) => {
|
|
2451
|
+
if (_optionalChain([signal, 'optionalAccess', _51 => _51.aborted])) {
|
|
2452
|
+
throw abortError;
|
|
2453
|
+
}
|
|
2454
|
+
return partUploadSignal.aborted || handleRetryError(error3);
|
|
2455
|
+
}
|
|
2456
|
+
).catch((error3) => {
|
|
2457
|
+
if (firstPartUploadFailure.value === void 0) {
|
|
2458
|
+
firstPartUploadFailure.value = { error: error3 };
|
|
2459
|
+
abortPartUploads(error3);
|
|
2460
|
+
}
|
|
2461
|
+
throw error3;
|
|
2462
|
+
})
|
|
2344
2463
|
);
|
|
2345
2464
|
}
|
|
2346
|
-
|
|
2465
|
+
const settledPartUploads = await Promise.allSettled(partUploads$);
|
|
2466
|
+
if (firstPartUploadFailure.value !== void 0) {
|
|
2467
|
+
throw firstPartUploadFailure.value.error;
|
|
2468
|
+
}
|
|
2469
|
+
for (const settledPartUpload of settledPartUploads) {
|
|
2470
|
+
if (settledPartUpload.status === "fulfilled") {
|
|
2471
|
+
uploadedParts.push(settledPartUpload.value);
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2347
2474
|
}
|
|
2348
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
2475
|
+
if (_optionalChain([signal, 'optionalAccess', _52 => _52.aborted])) {
|
|
2349
2476
|
throw abortError;
|
|
2350
2477
|
}
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
uploadedParts.sort((a, b) => a.partNumber - b.partNumber)
|
|
2478
|
+
const sortedParts = uploadedParts.sort(
|
|
2479
|
+
(a, b) => a.partNumber - b.partNumber
|
|
2354
2480
|
);
|
|
2481
|
+
return retryMultipartCompletion ? autoRetry(
|
|
2482
|
+
() => completeMultipartUpload(multipartUpload.uploadId, sortedParts),
|
|
2483
|
+
ROOM_FILE_RETRY_ATTEMPTS,
|
|
2484
|
+
ROOM_FILE_RETRY_DELAYS,
|
|
2485
|
+
handleRetryError
|
|
2486
|
+
) : completeMultipartUpload(uploadId, sortedParts);
|
|
2355
2487
|
} catch (error3) {
|
|
2356
|
-
if (uploadId
|
|
2488
|
+
if (uploadId) {
|
|
2357
2489
|
try {
|
|
2358
2490
|
await abortMultipartUpload(uploadId);
|
|
2359
2491
|
} catch (e8) {
|
|
2360
2492
|
}
|
|
2361
2493
|
}
|
|
2362
2494
|
throw error3;
|
|
2495
|
+
} finally {
|
|
2496
|
+
_optionalChain([signal, 'optionalAccess', _53 => _53.removeEventListener, 'call', _54 => _54("abort", handleExternalAbort)]);
|
|
2363
2497
|
}
|
|
2364
2498
|
}
|
|
2365
2499
|
function splitFileIntoParts(file) {
|
|
@@ -2375,9 +2509,6 @@ function splitFileIntoParts(file) {
|
|
|
2375
2509
|
}
|
|
2376
2510
|
return parts;
|
|
2377
2511
|
}
|
|
2378
|
-
function isAbortOrTimeoutError(error3) {
|
|
2379
|
-
return error3 instanceof Error && (error3.name === "AbortError" || error3.name === "TimeoutError");
|
|
2380
|
-
}
|
|
2381
2512
|
function createAbortError(message) {
|
|
2382
2513
|
if (typeof DOMException === "function") {
|
|
2383
2514
|
return new DOMException(message, "AbortError");
|
|
@@ -2446,7 +2577,7 @@ function createApiClient({
|
|
|
2446
2577
|
url`/v2/c/rooms/${options.roomId}/threads`,
|
|
2447
2578
|
await authManager.getAuthValue({
|
|
2448
2579
|
roomId: options.roomId,
|
|
2449
|
-
resource: commentsResourceForVisibility(_optionalChain([options, 'access',
|
|
2580
|
+
resource: commentsResourceForVisibility(_optionalChain([options, 'access', _55 => _55.query, 'optionalAccess', _56 => _56.visibility])),
|
|
2450
2581
|
access: "read"
|
|
2451
2582
|
}),
|
|
2452
2583
|
{
|
|
@@ -2504,7 +2635,7 @@ function createApiClient({
|
|
|
2504
2635
|
hasMentions: options.query.hasMentions
|
|
2505
2636
|
})
|
|
2506
2637
|
},
|
|
2507
|
-
{ signal: _optionalChain([requestOptions, 'optionalAccess',
|
|
2638
|
+
{ signal: _optionalChain([requestOptions, 'optionalAccess', _57 => _57.signal]) }
|
|
2508
2639
|
);
|
|
2509
2640
|
return result;
|
|
2510
2641
|
}
|
|
@@ -2706,6 +2837,7 @@ function createApiClient({
|
|
|
2706
2837
|
file: attachment.file,
|
|
2707
2838
|
signal: options.signal,
|
|
2708
2839
|
abortErrorMessage: `Upload of attachment ${attachment.id} was aborted.`,
|
|
2840
|
+
retryMultipartCompletion: false,
|
|
2709
2841
|
uploadSingle: async () => httpClient.putBlob(
|
|
2710
2842
|
url`/v2/c/rooms/${roomId}/attachments/${attachment.id}/upload/${attachment.name}`,
|
|
2711
2843
|
await authManager.getAuthValue({
|
|
@@ -2728,7 +2860,7 @@ function createApiClient({
|
|
|
2728
2860
|
{ signal: options.signal },
|
|
2729
2861
|
{ fileSize: attachment.size }
|
|
2730
2862
|
),
|
|
2731
|
-
uploadMultipartPart: async (uploadId, partNumber, part) => httpClient.putBlob(
|
|
2863
|
+
uploadMultipartPart: async (uploadId, partNumber, part, signal) => httpClient.putBlob(
|
|
2732
2864
|
url`/v2/c/rooms/${roomId}/attachments/${attachment.id}/multipart/${uploadId}/${String(partNumber)}`,
|
|
2733
2865
|
await authManager.getAuthValue({
|
|
2734
2866
|
roomId,
|
|
@@ -2737,7 +2869,7 @@ function createApiClient({
|
|
|
2737
2869
|
}),
|
|
2738
2870
|
part,
|
|
2739
2871
|
void 0,
|
|
2740
|
-
{ signal
|
|
2872
|
+
{ signal }
|
|
2741
2873
|
),
|
|
2742
2874
|
completeMultipartUpload: async (uploadId, parts) => httpClient.post(
|
|
2743
2875
|
url`/v2/c/rooms/${roomId}/attachments/${attachment.id}/multipart/${uploadId}/complete`,
|
|
@@ -2769,6 +2901,7 @@ function createApiClient({
|
|
|
2769
2901
|
file,
|
|
2770
2902
|
signal: options.signal,
|
|
2771
2903
|
abortErrorMessage: `Upload of file ${fileId} was aborted.`,
|
|
2904
|
+
retryMultipartCompletion: true,
|
|
2772
2905
|
uploadSingle: async () => httpClient.putBlob(
|
|
2773
2906
|
url`/v2/c/rooms/${roomId}/storage/files/${fileId}/upload/${file.name}`,
|
|
2774
2907
|
await authManager.getAuthValue({
|
|
@@ -2791,7 +2924,7 @@ function createApiClient({
|
|
|
2791
2924
|
{ signal: options.signal },
|
|
2792
2925
|
{ fileSize: file.size }
|
|
2793
2926
|
),
|
|
2794
|
-
uploadMultipartPart: async (uploadId, partNumber, part) => httpClient.putBlob(
|
|
2927
|
+
uploadMultipartPart: async (uploadId, partNumber, part, signal) => httpClient.putBlob(
|
|
2795
2928
|
url`/v2/c/rooms/${roomId}/storage/files/${fileId}/multipart/${uploadId}/${String(partNumber)}`,
|
|
2796
2929
|
await authManager.getAuthValue({
|
|
2797
2930
|
roomId,
|
|
@@ -2800,7 +2933,7 @@ function createApiClient({
|
|
|
2800
2933
|
}),
|
|
2801
2934
|
part,
|
|
2802
2935
|
void 0,
|
|
2803
|
-
{ signal
|
|
2936
|
+
{ signal }
|
|
2804
2937
|
),
|
|
2805
2938
|
completeMultipartUpload: async (uploadId, parts) => httpClient.post(
|
|
2806
2939
|
url`/v2/c/rooms/${roomId}/storage/files/${fileId}/multipart/${uploadId}/complete`,
|
|
@@ -2854,10 +2987,37 @@ function createApiClient({
|
|
|
2854
2987
|
return batch2.get(options.attachmentId);
|
|
2855
2988
|
}
|
|
2856
2989
|
const fileUrlsBatchStoresByRoom = new DefaultMap((roomId) => {
|
|
2990
|
+
const pendingFileUrlAttempts = /* @__PURE__ */ new Map();
|
|
2991
|
+
const clearPendingFileUrlAttempts = (fileId) => {
|
|
2992
|
+
const attempts = pendingFileUrlAttempts.get(fileId);
|
|
2993
|
+
if (attempts !== void 0) {
|
|
2994
|
+
clearTimeout(attempts.cleanupTimeoutId);
|
|
2995
|
+
pendingFileUrlAttempts.delete(fileId);
|
|
2996
|
+
}
|
|
2997
|
+
};
|
|
2998
|
+
const shouldRetryPendingFileUrl = (fileId) => {
|
|
2999
|
+
const previousAttempts = pendingFileUrlAttempts.get(fileId);
|
|
3000
|
+
if (previousAttempts !== void 0) {
|
|
3001
|
+
clearTimeout(previousAttempts.cleanupTimeoutId);
|
|
3002
|
+
}
|
|
3003
|
+
const count = (_nullishCoalesce(_optionalChain([previousAttempts, 'optionalAccess', _58 => _58.count]), () => ( 0))) + 1;
|
|
3004
|
+
if (count >= FILE_URL_ERROR_MAX_ATTEMPTS) {
|
|
3005
|
+
pendingFileUrlAttempts.delete(fileId);
|
|
3006
|
+
return false;
|
|
3007
|
+
}
|
|
3008
|
+
pendingFileUrlAttempts.set(fileId, {
|
|
3009
|
+
count,
|
|
3010
|
+
cleanupTimeoutId: setTimeout(
|
|
3011
|
+
() => pendingFileUrlAttempts.delete(fileId),
|
|
3012
|
+
FILE_URL_ERROR_ATTEMPTS_EXPIRY
|
|
3013
|
+
)
|
|
3014
|
+
});
|
|
3015
|
+
return true;
|
|
3016
|
+
};
|
|
2857
3017
|
const batch2 = new Batch(
|
|
2858
3018
|
async (batchedFileIds) => {
|
|
2859
3019
|
const fileIds = batchedFileIds.flat();
|
|
2860
|
-
const { urls } = await httpClient.post(
|
|
3020
|
+
const { urls, expiresAt } = await httpClient.post(
|
|
2861
3021
|
url`/v2/c/rooms/${roomId}/storage/files/presigned-urls`,
|
|
2862
3022
|
await authManager.getAuthValue({
|
|
2863
3023
|
roomId,
|
|
@@ -2866,20 +3026,31 @@ function createApiClient({
|
|
|
2866
3026
|
}),
|
|
2867
3027
|
{ fileIds }
|
|
2868
3028
|
);
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
3029
|
+
const expiresAtTimestamp = Date.parse(expiresAt);
|
|
3030
|
+
return urls.map((url2, index) => {
|
|
3031
|
+
const fileId = fileIds[index];
|
|
3032
|
+
if (url2 === false) {
|
|
3033
|
+
return shouldRetryPendingFileUrl(fileId) ? new FileUrlUnavailableError(
|
|
3034
|
+
"There was an error while getting this file's URL"
|
|
3035
|
+
) : new Error("There was an error while getting this file's URL");
|
|
3036
|
+
}
|
|
3037
|
+
clearPendingFileUrlAttempts(fileId);
|
|
3038
|
+
return url2 !== null ? { url: url2, expiresAt: expiresAtTimestamp } : new Error("There was an error while getting this file's URL");
|
|
3039
|
+
});
|
|
2872
3040
|
},
|
|
2873
3041
|
{ delay: 50 }
|
|
2874
3042
|
);
|
|
2875
|
-
return createBatchStore(batch2
|
|
3043
|
+
return createBatchStore(batch2, {
|
|
3044
|
+
getCacheExpiry: ({ expiresAt }) => expiresAt - FILE_URL_EXPIRY_BUFFER,
|
|
3045
|
+
getErrorCacheExpiry: (error3) => error3 instanceof FileUrlUnavailableError ? Date.now() + FILE_URL_ERROR_CACHE_TTL : void 0
|
|
3046
|
+
});
|
|
2876
3047
|
});
|
|
2877
3048
|
function getOrCreateFileUrlsStore(roomId) {
|
|
2878
3049
|
return fileUrlsBatchStoresByRoom.getOrCreate(roomId);
|
|
2879
3050
|
}
|
|
2880
|
-
function getFileUrl(options) {
|
|
3051
|
+
async function getFileUrl(options) {
|
|
2881
3052
|
const batch2 = getOrCreateFileUrlsStore(options.roomId).batch;
|
|
2882
|
-
return batch2.get(options.fileId);
|
|
3053
|
+
return (await batch2.get(options.fileId)).url;
|
|
2883
3054
|
}
|
|
2884
3055
|
async function getSubscriptionSettings(options) {
|
|
2885
3056
|
return httpClient.get(
|
|
@@ -3089,14 +3260,14 @@ function createApiClient({
|
|
|
3089
3260
|
async function getInboxNotifications(options) {
|
|
3090
3261
|
const PAGE_SIZE = 50;
|
|
3091
3262
|
let query;
|
|
3092
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3263
|
+
if (_optionalChain([options, 'optionalAccess', _59 => _59.query])) {
|
|
3093
3264
|
query = objectToQuery(options.query);
|
|
3094
3265
|
}
|
|
3095
3266
|
const json = await httpClient.get(
|
|
3096
3267
|
url`/v2/c/inbox-notifications`,
|
|
3097
3268
|
await authManager.getAuthValue({ resource: "personal", access: "write" }),
|
|
3098
3269
|
{
|
|
3099
|
-
cursor: _optionalChain([options, 'optionalAccess',
|
|
3270
|
+
cursor: _optionalChain([options, 'optionalAccess', _60 => _60.cursor]),
|
|
3100
3271
|
limit: PAGE_SIZE,
|
|
3101
3272
|
query
|
|
3102
3273
|
}
|
|
@@ -3115,7 +3286,7 @@ function createApiClient({
|
|
|
3115
3286
|
}
|
|
3116
3287
|
async function getInboxNotificationsSince(options) {
|
|
3117
3288
|
let query;
|
|
3118
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3289
|
+
if (_optionalChain([options, 'optionalAccess', _61 => _61.query])) {
|
|
3119
3290
|
query = objectToQuery(options.query);
|
|
3120
3291
|
}
|
|
3121
3292
|
const json = await httpClient.get(
|
|
@@ -3144,14 +3315,14 @@ function createApiClient({
|
|
|
3144
3315
|
}
|
|
3145
3316
|
async function getUnreadInboxNotificationsCount(options) {
|
|
3146
3317
|
let query;
|
|
3147
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3318
|
+
if (_optionalChain([options, 'optionalAccess', _62 => _62.query])) {
|
|
3148
3319
|
query = objectToQuery(options.query);
|
|
3149
3320
|
}
|
|
3150
3321
|
const { count } = await httpClient.get(
|
|
3151
3322
|
url`/v2/c/inbox-notifications/count`,
|
|
3152
3323
|
await authManager.getAuthValue({ resource: "personal", access: "write" }),
|
|
3153
3324
|
{ query },
|
|
3154
|
-
{ signal: _optionalChain([options, 'optionalAccess',
|
|
3325
|
+
{ signal: _optionalChain([options, 'optionalAccess', _63 => _63.signal]) }
|
|
3155
3326
|
);
|
|
3156
3327
|
return count;
|
|
3157
3328
|
}
|
|
@@ -3201,7 +3372,7 @@ function createApiClient({
|
|
|
3201
3372
|
url`/v2/c/notification-settings`,
|
|
3202
3373
|
await authManager.getAuthValue({ resource: "personal", access: "write" }),
|
|
3203
3374
|
void 0,
|
|
3204
|
-
{ signal: _optionalChain([options, 'optionalAccess',
|
|
3375
|
+
{ signal: _optionalChain([options, 'optionalAccess', _64 => _64.signal]) }
|
|
3205
3376
|
);
|
|
3206
3377
|
}
|
|
3207
3378
|
async function updateNotificationSettings(settings) {
|
|
@@ -3213,7 +3384,7 @@ function createApiClient({
|
|
|
3213
3384
|
}
|
|
3214
3385
|
async function getUserThreads_experimental(options) {
|
|
3215
3386
|
let query;
|
|
3216
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3387
|
+
if (_optionalChain([options, 'optionalAccess', _65 => _65.query])) {
|
|
3217
3388
|
query = objectToQuery(options.query);
|
|
3218
3389
|
}
|
|
3219
3390
|
const PAGE_SIZE = 50;
|
|
@@ -3221,7 +3392,7 @@ function createApiClient({
|
|
|
3221
3392
|
url`/v2/c/threads`,
|
|
3222
3393
|
await authManager.getAuthValue({ resource: "personal", access: "write" }),
|
|
3223
3394
|
{
|
|
3224
|
-
cursor: _optionalChain([options, 'optionalAccess',
|
|
3395
|
+
cursor: _optionalChain([options, 'optionalAccess', _66 => _66.cursor]),
|
|
3225
3396
|
query,
|
|
3226
3397
|
limit: PAGE_SIZE
|
|
3227
3398
|
}
|
|
@@ -3400,7 +3571,7 @@ var HttpClient = class {
|
|
|
3400
3571
|
// These headers are default, but can be overriden by custom headers
|
|
3401
3572
|
"Content-Type": "application/json; charset=utf-8",
|
|
3402
3573
|
// Possible header overrides
|
|
3403
|
-
..._optionalChain([options, 'optionalAccess',
|
|
3574
|
+
..._optionalChain([options, 'optionalAccess', _67 => _67.headers]),
|
|
3404
3575
|
// Cannot be overriden by custom headers
|
|
3405
3576
|
Authorization: `Bearer ${getBearerTokenFromAuthValue(authValue)}`,
|
|
3406
3577
|
"X-LB-Client": PKG_VERSION || "dev"
|
|
@@ -3408,7 +3579,7 @@ var HttpClient = class {
|
|
|
3408
3579
|
});
|
|
3409
3580
|
const xwarn = response.headers.get("X-LB-Warn");
|
|
3410
3581
|
if (xwarn) {
|
|
3411
|
-
const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3582
|
+
const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _68 => _68.method, 'optionalAccess', _69 => _69.toUpperCase, 'call', _70 => _70()]), () => ( "GET"));
|
|
3412
3583
|
const msg = `${xwarn} (${method} ${endpoint})`;
|
|
3413
3584
|
if (response.ok) {
|
|
3414
3585
|
warn(msg);
|
|
@@ -3890,7 +4061,7 @@ var FSM = class {
|
|
|
3890
4061
|
});
|
|
3891
4062
|
}
|
|
3892
4063
|
#getTargetFn(eventName) {
|
|
3893
|
-
return _optionalChain([this, 'access',
|
|
4064
|
+
return _optionalChain([this, 'access', _71 => _71.#allowedTransitions, 'access', _72 => _72.get, 'call', _73 => _73(this.currentState), 'optionalAccess', _74 => _74.get, 'call', _75 => _75(eventName)]);
|
|
3894
4065
|
}
|
|
3895
4066
|
/**
|
|
3896
4067
|
* Exits the current state, and executes any necessary cleanup functions.
|
|
@@ -3909,7 +4080,7 @@ var FSM = class {
|
|
|
3909
4080
|
this.#currentContext.allowPatching((patchableContext) => {
|
|
3910
4081
|
levels = _nullishCoalesce(levels, () => ( this.#cleanupStack.length));
|
|
3911
4082
|
for (let i = 0; i < levels; i++) {
|
|
3912
|
-
_optionalChain([this, 'access',
|
|
4083
|
+
_optionalChain([this, 'access', _76 => _76.#cleanupStack, 'access', _77 => _77.pop, 'call', _78 => _78(), 'optionalCall', _79 => _79(patchableContext)]);
|
|
3913
4084
|
const entryTime = this.#entryTimesStack.pop();
|
|
3914
4085
|
if (entryTime !== void 0 && // ...but avoid computing state names if nobody is listening
|
|
3915
4086
|
this.#eventHub.didExitState.count() > 0) {
|
|
@@ -3937,7 +4108,7 @@ var FSM = class {
|
|
|
3937
4108
|
this.#currentContext.allowPatching((patchableContext) => {
|
|
3938
4109
|
for (const pattern of enterPatterns) {
|
|
3939
4110
|
const enterFn = this.#enterFns.get(pattern);
|
|
3940
|
-
const cleanupFn = _optionalChain([enterFn, 'optionalCall',
|
|
4111
|
+
const cleanupFn = _optionalChain([enterFn, 'optionalCall', _80 => _80(patchableContext)]);
|
|
3941
4112
|
if (typeof cleanupFn === "function") {
|
|
3942
4113
|
this.#cleanupStack.push(cleanupFn);
|
|
3943
4114
|
} else {
|
|
@@ -4364,7 +4535,7 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
4364
4535
|
}
|
|
4365
4536
|
function waitForActorId(event) {
|
|
4366
4537
|
const serverMsg = tryParseJson(event.data);
|
|
4367
|
-
if (_optionalChain([serverMsg, 'optionalAccess',
|
|
4538
|
+
if (_optionalChain([serverMsg, 'optionalAccess', _81 => _81.type]) === ServerMsgCode.ROOM_STATE) {
|
|
4368
4539
|
if (options.enableDebugLogging && socketOpenAt !== null) {
|
|
4369
4540
|
const elapsed = performance.now() - socketOpenAt;
|
|
4370
4541
|
warn(
|
|
@@ -4492,12 +4663,12 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
4492
4663
|
const sendHeartbeat = {
|
|
4493
4664
|
target: "@ok.awaiting-pong",
|
|
4494
4665
|
effect: (ctx) => {
|
|
4495
|
-
_optionalChain([ctx, 'access',
|
|
4666
|
+
_optionalChain([ctx, 'access', _82 => _82.socket, 'optionalAccess', _83 => _83.send, 'call', _84 => _84("ping")]);
|
|
4496
4667
|
}
|
|
4497
4668
|
};
|
|
4498
4669
|
const maybeHeartbeat = () => {
|
|
4499
4670
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
4500
|
-
const canZombie = _optionalChain([doc, 'optionalAccess',
|
|
4671
|
+
const canZombie = _optionalChain([doc, 'optionalAccess', _85 => _85.visibilityState]) === "hidden" && delegates.canZombie();
|
|
4501
4672
|
return canZombie ? "@idle.zombie" : sendHeartbeat;
|
|
4502
4673
|
};
|
|
4503
4674
|
machine.addTimedTransition("@ok.connected", HEARTBEAT_INTERVAL, maybeHeartbeat).addTransitions("@ok.connected", {
|
|
@@ -4537,7 +4708,7 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
4537
4708
|
// socket, or not. So always check to see if the socket is still OPEN or
|
|
4538
4709
|
// not. When still OPEN, don't transition.
|
|
4539
4710
|
EXPLICIT_SOCKET_ERROR: (_, context) => {
|
|
4540
|
-
if (_optionalChain([context, 'access',
|
|
4711
|
+
if (_optionalChain([context, 'access', _86 => _86.socket, 'optionalAccess', _87 => _87.readyState]) === 1) {
|
|
4541
4712
|
return IGNORE;
|
|
4542
4713
|
}
|
|
4543
4714
|
return {
|
|
@@ -4589,17 +4760,17 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
4589
4760
|
machine.send({ type: "NAVIGATOR_ONLINE" });
|
|
4590
4761
|
}
|
|
4591
4762
|
function onVisibilityChange() {
|
|
4592
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
4763
|
+
if (_optionalChain([doc, 'optionalAccess', _88 => _88.visibilityState]) === "visible") {
|
|
4593
4764
|
machine.send({ type: "WINDOW_GOT_FOCUS" });
|
|
4594
4765
|
}
|
|
4595
4766
|
}
|
|
4596
|
-
_optionalChain([win, 'optionalAccess',
|
|
4597
|
-
_optionalChain([win, 'optionalAccess',
|
|
4598
|
-
_optionalChain([root, 'optionalAccess',
|
|
4767
|
+
_optionalChain([win, 'optionalAccess', _89 => _89.addEventListener, 'call', _90 => _90("online", onNetworkBackOnline)]);
|
|
4768
|
+
_optionalChain([win, 'optionalAccess', _91 => _91.addEventListener, 'call', _92 => _92("offline", onNetworkOffline)]);
|
|
4769
|
+
_optionalChain([root, 'optionalAccess', _93 => _93.addEventListener, 'call', _94 => _94("visibilitychange", onVisibilityChange)]);
|
|
4599
4770
|
return () => {
|
|
4600
|
-
_optionalChain([root, 'optionalAccess',
|
|
4601
|
-
_optionalChain([win, 'optionalAccess',
|
|
4602
|
-
_optionalChain([win, 'optionalAccess',
|
|
4771
|
+
_optionalChain([root, 'optionalAccess', _95 => _95.removeEventListener, 'call', _96 => _96("visibilitychange", onVisibilityChange)]);
|
|
4772
|
+
_optionalChain([win, 'optionalAccess', _97 => _97.removeEventListener, 'call', _98 => _98("online", onNetworkBackOnline)]);
|
|
4773
|
+
_optionalChain([win, 'optionalAccess', _99 => _99.removeEventListener, 'call', _100 => _100("offline", onNetworkOffline)]);
|
|
4603
4774
|
teardownSocket(ctx.socket);
|
|
4604
4775
|
};
|
|
4605
4776
|
});
|
|
@@ -4688,7 +4859,7 @@ var ManagedSocket = class {
|
|
|
4688
4859
|
* message if this is somehow impossible.
|
|
4689
4860
|
*/
|
|
4690
4861
|
send(data) {
|
|
4691
|
-
const socket = _optionalChain([this, 'access',
|
|
4862
|
+
const socket = _optionalChain([this, 'access', _101 => _101.#machine, 'access', _102 => _102.context, 'optionalAccess', _103 => _103.socket]);
|
|
4692
4863
|
if (socket === null) {
|
|
4693
4864
|
warn("Cannot send: not connected yet", data);
|
|
4694
4865
|
} else if (socket.readyState !== 1) {
|
|
@@ -5150,7 +5321,7 @@ function createStore_forKnowledge() {
|
|
|
5150
5321
|
}
|
|
5151
5322
|
function getKnowledgeForChat(chatId) {
|
|
5152
5323
|
const globalKnowledge = knowledgeByChatId.getOrCreate(kWILDCARD).get();
|
|
5153
|
-
const scopedKnowledge = _nullishCoalesce(_optionalChain([knowledgeByChatId, 'access',
|
|
5324
|
+
const scopedKnowledge = _nullishCoalesce(_optionalChain([knowledgeByChatId, 'access', _104 => _104.get, 'call', _105 => _105(chatId), 'optionalAccess', _106 => _106.get, 'call', _107 => _107()]), () => ( []));
|
|
5154
5325
|
return [...globalKnowledge, ...scopedKnowledge];
|
|
5155
5326
|
}
|
|
5156
5327
|
return {
|
|
@@ -5175,7 +5346,7 @@ function createStore_forTools() {
|
|
|
5175
5346
|
return DerivedSignal.from(() => {
|
|
5176
5347
|
return (
|
|
5177
5348
|
// A tool that's registered and scoped to a specific chat ID...
|
|
5178
|
-
_nullishCoalesce(_optionalChain([(chatId !== void 0 ? toolsByChatId\u03A3.getOrCreate(chatId).getOrCreate(name) : void 0), 'optionalAccess',
|
|
5349
|
+
_nullishCoalesce(_optionalChain([(chatId !== void 0 ? toolsByChatId\u03A3.getOrCreate(chatId).getOrCreate(name) : void 0), 'optionalAccess', _108 => _108.get, 'call', _109 => _109()]), () => ( // ...or a globally registered tool
|
|
5179
5350
|
toolsByChatId\u03A3.getOrCreate(kWILDCARD).getOrCreate(name).get()))
|
|
5180
5351
|
);
|
|
5181
5352
|
});
|
|
@@ -5205,8 +5376,8 @@ function createStore_forTools() {
|
|
|
5205
5376
|
const globalTools\u03A3 = toolsByChatId\u03A3.get(kWILDCARD);
|
|
5206
5377
|
const scopedTools\u03A3 = toolsByChatId\u03A3.get(chatId);
|
|
5207
5378
|
return Array.from([
|
|
5208
|
-
..._nullishCoalesce(_optionalChain([globalTools\u03A3, 'optionalAccess',
|
|
5209
|
-
..._nullishCoalesce(_optionalChain([scopedTools\u03A3, 'optionalAccess',
|
|
5379
|
+
..._nullishCoalesce(_optionalChain([globalTools\u03A3, 'optionalAccess', _110 => _110.entries, 'call', _111 => _111()]), () => ( [])),
|
|
5380
|
+
..._nullishCoalesce(_optionalChain([scopedTools\u03A3, 'optionalAccess', _112 => _112.entries, 'call', _113 => _113()]), () => ( []))
|
|
5210
5381
|
]).flatMap(([name, tool\u03A3]) => {
|
|
5211
5382
|
const tool = tool\u03A3.get();
|
|
5212
5383
|
return tool && (_nullishCoalesce(tool.enabled, () => ( true))) ? [{ name, description: tool.description, parameters: tool.parameters }] : [];
|
|
@@ -5309,7 +5480,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
5309
5480
|
} else {
|
|
5310
5481
|
continue;
|
|
5311
5482
|
}
|
|
5312
|
-
const executeFn = _optionalChain([toolsStore, 'access',
|
|
5483
|
+
const executeFn = _optionalChain([toolsStore, 'access', _114 => _114.getTool\u03A3, 'call', _115 => _115(toolInvocation.name, message.chatId), 'access', _116 => _116.get, 'call', _117 => _117(), 'optionalAccess', _118 => _118.execute]);
|
|
5313
5484
|
if (executeFn) {
|
|
5314
5485
|
(async () => {
|
|
5315
5486
|
const result = await executeFn(toolInvocation.args, {
|
|
@@ -5408,8 +5579,8 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
5408
5579
|
const spine = [];
|
|
5409
5580
|
let lastVisitedMessage = null;
|
|
5410
5581
|
for (const message2 of pool.walkUp(leaf.id)) {
|
|
5411
|
-
const prev = _nullishCoalesce(_optionalChain([first, 'call',
|
|
5412
|
-
const next = _nullishCoalesce(_optionalChain([first, 'call',
|
|
5582
|
+
const prev = _nullishCoalesce(_optionalChain([first, 'call', _119 => _119(pool.walkLeft(message2.id, isAlive)), 'optionalAccess', _120 => _120.id]), () => ( null));
|
|
5583
|
+
const next = _nullishCoalesce(_optionalChain([first, 'call', _121 => _121(pool.walkRight(message2.id, isAlive)), 'optionalAccess', _122 => _122.id]), () => ( null));
|
|
5413
5584
|
if (!message2.deletedAt || prev || next) {
|
|
5414
5585
|
const node = {
|
|
5415
5586
|
...message2,
|
|
@@ -5475,7 +5646,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
5475
5646
|
const latest = pool.sorted.findRight(
|
|
5476
5647
|
(m) => m.role === "assistant" && !m.deletedAt
|
|
5477
5648
|
);
|
|
5478
|
-
return _optionalChain([latest, 'optionalAccess',
|
|
5649
|
+
return _optionalChain([latest, 'optionalAccess', _123 => _123.copilotId]);
|
|
5479
5650
|
}
|
|
5480
5651
|
return {
|
|
5481
5652
|
// Readers
|
|
@@ -5506,11 +5677,11 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
5506
5677
|
*getAutoExecutingMessageIds() {
|
|
5507
5678
|
for (const messageId of myMessages) {
|
|
5508
5679
|
const message = getMessageById(messageId);
|
|
5509
|
-
if (_optionalChain([message, 'optionalAccess',
|
|
5680
|
+
if (_optionalChain([message, 'optionalAccess', _124 => _124.role]) === "assistant" && message.status === "awaiting-tool") {
|
|
5510
5681
|
const isAutoExecuting = message.contentSoFar.some((part) => {
|
|
5511
5682
|
if (part.type === "tool-invocation" && part.stage === "executing") {
|
|
5512
5683
|
const tool = toolsStore.getTool\u03A3(part.name, message.chatId).get();
|
|
5513
|
-
return typeof _optionalChain([tool, 'optionalAccess',
|
|
5684
|
+
return typeof _optionalChain([tool, 'optionalAccess', _125 => _125.execute]) === "function";
|
|
5514
5685
|
}
|
|
5515
5686
|
return false;
|
|
5516
5687
|
});
|
|
@@ -5658,7 +5829,7 @@ function createAi(config) {
|
|
|
5658
5829
|
flushPendingDeltas();
|
|
5659
5830
|
switch (msg.event) {
|
|
5660
5831
|
case "cmd-failed":
|
|
5661
|
-
_optionalChain([pendingCmd, 'optionalAccess',
|
|
5832
|
+
_optionalChain([pendingCmd, 'optionalAccess', _126 => _126.reject, 'call', _127 => _127(new Error(msg.error))]);
|
|
5662
5833
|
break;
|
|
5663
5834
|
case "settle": {
|
|
5664
5835
|
context.messagesStore.upsert(msg.message);
|
|
@@ -5735,7 +5906,7 @@ function createAi(config) {
|
|
|
5735
5906
|
return assertNever(msg, "Unhandled case");
|
|
5736
5907
|
}
|
|
5737
5908
|
}
|
|
5738
|
-
_optionalChain([pendingCmd, 'optionalAccess',
|
|
5909
|
+
_optionalChain([pendingCmd, 'optionalAccess', _128 => _128.resolve, 'call', _129 => _129(msg)]);
|
|
5739
5910
|
}
|
|
5740
5911
|
managedSocket.events.onMessage.subscribe(handleServerMessage);
|
|
5741
5912
|
managedSocket.events.statusDidChange.subscribe(onStatusDidChange);
|
|
@@ -5811,9 +5982,9 @@ function createAi(config) {
|
|
|
5811
5982
|
invocationId,
|
|
5812
5983
|
result,
|
|
5813
5984
|
generationOptions: {
|
|
5814
|
-
copilotId: _optionalChain([options, 'optionalAccess',
|
|
5815
|
-
stream: _optionalChain([options, 'optionalAccess',
|
|
5816
|
-
timeout: _optionalChain([options, 'optionalAccess',
|
|
5985
|
+
copilotId: _optionalChain([options, 'optionalAccess', _130 => _130.copilotId]),
|
|
5986
|
+
stream: _optionalChain([options, 'optionalAccess', _131 => _131.stream]),
|
|
5987
|
+
timeout: _optionalChain([options, 'optionalAccess', _132 => _132.timeout]),
|
|
5817
5988
|
// Knowledge and tools aren't coming from the options, but retrieved
|
|
5818
5989
|
// from the global context
|
|
5819
5990
|
knowledge: knowledge.length > 0 ? knowledge : void 0,
|
|
@@ -5831,7 +6002,7 @@ function createAi(config) {
|
|
|
5831
6002
|
}
|
|
5832
6003
|
}
|
|
5833
6004
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
5834
|
-
_optionalChain([win, 'optionalAccess',
|
|
6005
|
+
_optionalChain([win, 'optionalAccess', _133 => _133.addEventListener, 'call', _134 => _134("beforeunload", handleBeforeUnload, { once: true })]);
|
|
5835
6006
|
return Object.defineProperty(
|
|
5836
6007
|
{
|
|
5837
6008
|
[kInternal]: {
|
|
@@ -5850,7 +6021,7 @@ function createAi(config) {
|
|
|
5850
6021
|
clearChat: (chatId) => sendClientMsgWithResponse({ cmd: "clear-chat", chatId }),
|
|
5851
6022
|
askUserMessageInChat: async (chatId, userMessage, targetMessageId, options) => {
|
|
5852
6023
|
const knowledge = context.knowledgeStore.getKnowledgeForChat(chatId);
|
|
5853
|
-
const requestKnowledge = _optionalChain([options, 'optionalAccess',
|
|
6024
|
+
const requestKnowledge = _optionalChain([options, 'optionalAccess', _135 => _135.knowledge]) || [];
|
|
5854
6025
|
const combinedKnowledge = [...knowledge, ...requestKnowledge];
|
|
5855
6026
|
const tools = context.toolsStore.getToolDescriptions(chatId);
|
|
5856
6027
|
messagesStore.markMine(targetMessageId);
|
|
@@ -5860,9 +6031,9 @@ function createAi(config) {
|
|
|
5860
6031
|
sourceMessage: userMessage,
|
|
5861
6032
|
targetMessageId,
|
|
5862
6033
|
generationOptions: {
|
|
5863
|
-
copilotId: _optionalChain([options, 'optionalAccess',
|
|
5864
|
-
stream: _optionalChain([options, 'optionalAccess',
|
|
5865
|
-
timeout: _optionalChain([options, 'optionalAccess',
|
|
6034
|
+
copilotId: _optionalChain([options, 'optionalAccess', _136 => _136.copilotId]),
|
|
6035
|
+
stream: _optionalChain([options, 'optionalAccess', _137 => _137.stream]),
|
|
6036
|
+
timeout: _optionalChain([options, 'optionalAccess', _138 => _138.timeout]),
|
|
5866
6037
|
// Combine global knowledge with request-specific knowledge
|
|
5867
6038
|
knowledge: combinedKnowledge.length > 0 ? combinedKnowledge : void 0,
|
|
5868
6039
|
tools: tools.length > 0 ? tools : void 0
|
|
@@ -5934,7 +6105,7 @@ function replaceOrAppend(content, newItem, keyFn, now2) {
|
|
|
5934
6105
|
}
|
|
5935
6106
|
}
|
|
5936
6107
|
function closePart(prevPart, endedAt) {
|
|
5937
|
-
if (_optionalChain([prevPart, 'optionalAccess',
|
|
6108
|
+
if (_optionalChain([prevPart, 'optionalAccess', _139 => _139.type]) === "reasoning") {
|
|
5938
6109
|
prevPart.endedAt ??= endedAt;
|
|
5939
6110
|
}
|
|
5940
6111
|
}
|
|
@@ -5949,7 +6120,7 @@ function patchContentWithDelta(content, delta) {
|
|
|
5949
6120
|
const lastPart = parts[parts.length - 1];
|
|
5950
6121
|
switch (delta.type) {
|
|
5951
6122
|
case "text-delta":
|
|
5952
|
-
if (_optionalChain([lastPart, 'optionalAccess',
|
|
6123
|
+
if (_optionalChain([lastPart, 'optionalAccess', _140 => _140.type]) === "text") {
|
|
5953
6124
|
lastPart.text += delta.textDelta;
|
|
5954
6125
|
} else {
|
|
5955
6126
|
closePart(lastPart, now2);
|
|
@@ -5957,7 +6128,7 @@ function patchContentWithDelta(content, delta) {
|
|
|
5957
6128
|
}
|
|
5958
6129
|
break;
|
|
5959
6130
|
case "reasoning-delta":
|
|
5960
|
-
if (_optionalChain([lastPart, 'optionalAccess',
|
|
6131
|
+
if (_optionalChain([lastPart, 'optionalAccess', _141 => _141.type]) === "reasoning") {
|
|
5961
6132
|
lastPart.text += delta.textDelta;
|
|
5962
6133
|
} else {
|
|
5963
6134
|
closePart(lastPart, now2);
|
|
@@ -5977,8 +6148,8 @@ function patchContentWithDelta(content, delta) {
|
|
|
5977
6148
|
break;
|
|
5978
6149
|
}
|
|
5979
6150
|
case "tool-delta": {
|
|
5980
|
-
if (_optionalChain([lastPart, 'optionalAccess',
|
|
5981
|
-
_optionalChain([lastPart, 'access',
|
|
6151
|
+
if (_optionalChain([lastPart, 'optionalAccess', _142 => _142.type]) === "tool-invocation" && lastPart.stage === "receiving") {
|
|
6152
|
+
_optionalChain([lastPart, 'access', _143 => _143.__appendDelta, 'optionalCall', _144 => _144(delta.delta)]);
|
|
5982
6153
|
}
|
|
5983
6154
|
break;
|
|
5984
6155
|
}
|
|
@@ -6333,7 +6504,7 @@ function explicitAccessForResource(source, resource) {
|
|
|
6333
6504
|
}
|
|
6334
6505
|
function permissionForAccessLevel(resource, access, field = resource) {
|
|
6335
6506
|
const permissions = PERMISSIONS_BY_RESOURCE[resource][access];
|
|
6336
|
-
const permission = _optionalChain([permissions, 'optionalAccess',
|
|
6507
|
+
const permission = _optionalChain([permissions, 'optionalAccess', _145 => _145[0]]);
|
|
6337
6508
|
if (permission !== void 0) {
|
|
6338
6509
|
return permission;
|
|
6339
6510
|
}
|
|
@@ -6443,7 +6614,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
6443
6614
|
return void 0;
|
|
6444
6615
|
}
|
|
6445
6616
|
async function makeAuthRequest(options) {
|
|
6446
|
-
const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access',
|
|
6617
|
+
const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _146 => _146.polyfills, 'optionalAccess', _147 => _147.fetch]), () => ( (typeof window === "undefined" ? void 0 : window.fetch)));
|
|
6447
6618
|
if (authentication.type === "private") {
|
|
6448
6619
|
if (fetcher === void 0) {
|
|
6449
6620
|
throw new StopRetrying(
|
|
@@ -6456,14 +6627,14 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
6456
6627
|
const parsed = parseAuthToken(response.token);
|
|
6457
6628
|
if (seenTokens.has(parsed.raw)) {
|
|
6458
6629
|
const cachedToken = getCachedToken(options);
|
|
6459
|
-
if (_optionalChain([cachedToken, 'optionalAccess',
|
|
6630
|
+
if (_optionalChain([cachedToken, 'optionalAccess', _148 => _148.raw]) === parsed.raw) {
|
|
6460
6631
|
return cachedToken;
|
|
6461
6632
|
}
|
|
6462
6633
|
throw new StopRetrying(
|
|
6463
6634
|
"The same Liveblocks auth token was issued from the backend before. Caching Liveblocks tokens is not supported."
|
|
6464
6635
|
);
|
|
6465
6636
|
}
|
|
6466
|
-
_optionalChain([onAuthenticate, 'optionalCall',
|
|
6637
|
+
_optionalChain([onAuthenticate, 'optionalCall', _149 => _149(parsed.parsed)]);
|
|
6467
6638
|
return parsed;
|
|
6468
6639
|
}
|
|
6469
6640
|
if (authentication.type === "custom") {
|
|
@@ -6471,7 +6642,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
6471
6642
|
if (response && typeof response === "object") {
|
|
6472
6643
|
if (typeof response.token === "string") {
|
|
6473
6644
|
const parsed = parseAuthToken(response.token);
|
|
6474
|
-
_optionalChain([onAuthenticate, 'optionalCall',
|
|
6645
|
+
_optionalChain([onAuthenticate, 'optionalCall', _150 => _150(parsed.parsed)]);
|
|
6475
6646
|
return parsed;
|
|
6476
6647
|
} else if (typeof response.error === "string") {
|
|
6477
6648
|
const reason = `Authentication failed: ${"reason" in response && typeof response.reason === "string" ? response.reason : "Forbidden"}`;
|
|
@@ -7171,7 +7342,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7171
7342
|
#applyInsertUndoRedo(op) {
|
|
7172
7343
|
const { id, parentKey: key } = op;
|
|
7173
7344
|
const child = creationOpToLiveNode(op);
|
|
7174
|
-
if (_optionalChain([this, 'access',
|
|
7345
|
+
if (_optionalChain([this, 'access', _151 => _151._pool, 'optionalAccess', _152 => _152.getNode, 'call', _153 => _153(id)]) !== void 0) {
|
|
7175
7346
|
return { modified: false };
|
|
7176
7347
|
}
|
|
7177
7348
|
child._attach(id, nn(this._pool));
|
|
@@ -7179,8 +7350,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7179
7350
|
const existingItemIndex = this._indexOfPosition(key);
|
|
7180
7351
|
let newKey = key;
|
|
7181
7352
|
if (existingItemIndex !== -1) {
|
|
7182
|
-
const before2 = _optionalChain([this, 'access',
|
|
7183
|
-
const after2 = _optionalChain([this, 'access',
|
|
7353
|
+
const before2 = _optionalChain([this, 'access', _154 => _154.#items, 'access', _155 => _155.at, 'call', _156 => _156(existingItemIndex), 'optionalAccess', _157 => _157._parentPos]);
|
|
7354
|
+
const after2 = _optionalChain([this, 'access', _158 => _158.#items, 'access', _159 => _159.at, 'call', _160 => _160(existingItemIndex + 1), 'optionalAccess', _161 => _161._parentPos]);
|
|
7184
7355
|
newKey = makePosition(before2, after2);
|
|
7185
7356
|
child._setParentLink(this, newKey);
|
|
7186
7357
|
}
|
|
@@ -7194,7 +7365,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7194
7365
|
#applySetUndoRedo(op) {
|
|
7195
7366
|
const { id, parentKey: key } = op;
|
|
7196
7367
|
const child = creationOpToLiveNode(op);
|
|
7197
|
-
if (_optionalChain([this, 'access',
|
|
7368
|
+
if (_optionalChain([this, 'access', _162 => _162._pool, 'optionalAccess', _163 => _163.getNode, 'call', _164 => _164(id)]) !== void 0) {
|
|
7198
7369
|
return { modified: false };
|
|
7199
7370
|
}
|
|
7200
7371
|
const indexOfItemWithSameKey = this._indexOfPosition(key);
|
|
@@ -7315,7 +7486,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7315
7486
|
} else {
|
|
7316
7487
|
this.#updateItemPositionAt(
|
|
7317
7488
|
existingItemIndex,
|
|
7318
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
7489
|
+
makePosition(newKey, _optionalChain([this, 'access', _165 => _165.#items, 'access', _166 => _166.at, 'call', _167 => _167(existingItemIndex + 1), 'optionalAccess', _168 => _168._parentPos]))
|
|
7319
7490
|
);
|
|
7320
7491
|
const previousIndex = this.#items.findIndex((item) => item === child);
|
|
7321
7492
|
this.#updateItemPosition(child, newKey);
|
|
@@ -7342,7 +7513,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7342
7513
|
this,
|
|
7343
7514
|
makePosition(
|
|
7344
7515
|
newKey,
|
|
7345
|
-
_optionalChain([this, 'access',
|
|
7516
|
+
_optionalChain([this, 'access', _169 => _169.#items, 'access', _170 => _170.at, 'call', _171 => _171(existingItemIndex + 1), 'optionalAccess', _172 => _172._parentPos])
|
|
7346
7517
|
)
|
|
7347
7518
|
);
|
|
7348
7519
|
this.#items.reposition(existingItem);
|
|
@@ -7366,7 +7537,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7366
7537
|
existingItemIndex,
|
|
7367
7538
|
makePosition(
|
|
7368
7539
|
newKey,
|
|
7369
|
-
_optionalChain([this, 'access',
|
|
7540
|
+
_optionalChain([this, 'access', _173 => _173.#items, 'access', _174 => _174.at, 'call', _175 => _175(existingItemIndex + 1), 'optionalAccess', _176 => _176._parentPos])
|
|
7370
7541
|
)
|
|
7371
7542
|
);
|
|
7372
7543
|
}
|
|
@@ -7394,7 +7565,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7394
7565
|
if (existingItemIndex !== -1) {
|
|
7395
7566
|
actualNewKey = makePosition(
|
|
7396
7567
|
newKey,
|
|
7397
|
-
_optionalChain([this, 'access',
|
|
7568
|
+
_optionalChain([this, 'access', _177 => _177.#items, 'access', _178 => _178.at, 'call', _179 => _179(existingItemIndex + 1), 'optionalAccess', _180 => _180._parentPos])
|
|
7398
7569
|
);
|
|
7399
7570
|
}
|
|
7400
7571
|
this.#updateItemPosition(child, actualNewKey);
|
|
@@ -7468,14 +7639,14 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7468
7639
|
* instead of resolving its position against the client's stale view.
|
|
7469
7640
|
*/
|
|
7470
7641
|
#injectAt(element, index, intent) {
|
|
7471
|
-
_optionalChain([this, 'access',
|
|
7642
|
+
_optionalChain([this, 'access', _181 => _181._pool, 'optionalAccess', _182 => _182.assertStorageIsWritable, 'call', _183 => _183()]);
|
|
7472
7643
|
if (index < 0 || index > this.#items.length) {
|
|
7473
7644
|
throw new Error(
|
|
7474
7645
|
`Cannot insert list item at index "${index}". index should be between 0 and ${this.#items.length}`
|
|
7475
7646
|
);
|
|
7476
7647
|
}
|
|
7477
|
-
const before2 = _optionalChain([this, 'access',
|
|
7478
|
-
const after2 = _optionalChain([this, 'access',
|
|
7648
|
+
const before2 = _optionalChain([this, 'access', _184 => _184.#items, 'access', _185 => _185.at, 'call', _186 => _186(index - 1), 'optionalAccess', _187 => _187._parentPos]);
|
|
7649
|
+
const after2 = _optionalChain([this, 'access', _188 => _188.#items, 'access', _189 => _189.at, 'call', _190 => _190(index), 'optionalAccess', _191 => _191._parentPos]);
|
|
7479
7650
|
const position = makePosition(before2, after2);
|
|
7480
7651
|
const value = lsonToLiveNode(element);
|
|
7481
7652
|
value._setParentLink(this, position);
|
|
@@ -7499,7 +7670,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7499
7670
|
* @param targetIndex The index where the element should be after moving.
|
|
7500
7671
|
*/
|
|
7501
7672
|
move(index, targetIndex) {
|
|
7502
|
-
_optionalChain([this, 'access',
|
|
7673
|
+
_optionalChain([this, 'access', _192 => _192._pool, 'optionalAccess', _193 => _193.assertStorageIsWritable, 'call', _194 => _194()]);
|
|
7503
7674
|
if (targetIndex < 0) {
|
|
7504
7675
|
throw new Error("targetIndex cannot be less than 0");
|
|
7505
7676
|
}
|
|
@@ -7517,11 +7688,11 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7517
7688
|
let beforePosition = null;
|
|
7518
7689
|
let afterPosition = null;
|
|
7519
7690
|
if (index < targetIndex) {
|
|
7520
|
-
afterPosition = targetIndex === this.#items.length - 1 ? void 0 : _optionalChain([this, 'access',
|
|
7691
|
+
afterPosition = targetIndex === this.#items.length - 1 ? void 0 : _optionalChain([this, 'access', _195 => _195.#items, 'access', _196 => _196.at, 'call', _197 => _197(targetIndex + 1), 'optionalAccess', _198 => _198._parentPos]);
|
|
7521
7692
|
beforePosition = this.#items.at(targetIndex)._parentPos;
|
|
7522
7693
|
} else {
|
|
7523
7694
|
afterPosition = this.#items.at(targetIndex)._parentPos;
|
|
7524
|
-
beforePosition = targetIndex === 0 ? void 0 : _optionalChain([this, 'access',
|
|
7695
|
+
beforePosition = targetIndex === 0 ? void 0 : _optionalChain([this, 'access', _199 => _199.#items, 'access', _200 => _200.at, 'call', _201 => _201(targetIndex - 1), 'optionalAccess', _202 => _202._parentPos]);
|
|
7525
7696
|
}
|
|
7526
7697
|
const position = makePosition(beforePosition, afterPosition);
|
|
7527
7698
|
const item = this.#items.at(index);
|
|
@@ -7556,7 +7727,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7556
7727
|
* @param index The index of the element to delete
|
|
7557
7728
|
*/
|
|
7558
7729
|
delete(index) {
|
|
7559
|
-
_optionalChain([this, 'access',
|
|
7730
|
+
_optionalChain([this, 'access', _203 => _203._pool, 'optionalAccess', _204 => _204.assertStorageIsWritable, 'call', _205 => _205()]);
|
|
7560
7731
|
if (index < 0 || index >= this.#items.length) {
|
|
7561
7732
|
throw new Error(
|
|
7562
7733
|
`Cannot delete list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -7589,7 +7760,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7589
7760
|
}
|
|
7590
7761
|
}
|
|
7591
7762
|
clear() {
|
|
7592
|
-
_optionalChain([this, 'access',
|
|
7763
|
+
_optionalChain([this, 'access', _206 => _206._pool, 'optionalAccess', _207 => _207.assertStorageIsWritable, 'call', _208 => _208()]);
|
|
7593
7764
|
if (this._pool) {
|
|
7594
7765
|
const ops = [];
|
|
7595
7766
|
const reverseOps = [];
|
|
@@ -7623,7 +7794,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7623
7794
|
}
|
|
7624
7795
|
}
|
|
7625
7796
|
set(index, item) {
|
|
7626
|
-
_optionalChain([this, 'access',
|
|
7797
|
+
_optionalChain([this, 'access', _209 => _209._pool, 'optionalAccess', _210 => _210.assertStorageIsWritable, 'call', _211 => _211()]);
|
|
7627
7798
|
if (index < 0 || index >= this.#items.length) {
|
|
7628
7799
|
throw new Error(
|
|
7629
7800
|
`Cannot set list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -7782,7 +7953,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7782
7953
|
#shiftItemPosition(index, key) {
|
|
7783
7954
|
const shiftedPosition = makePosition(
|
|
7784
7955
|
key,
|
|
7785
|
-
this.#items.length > index + 1 ? _optionalChain([this, 'access',
|
|
7956
|
+
this.#items.length > index + 1 ? _optionalChain([this, 'access', _212 => _212.#items, 'access', _213 => _213.at, 'call', _214 => _214(index + 1), 'optionalAccess', _215 => _215._parentPos]) : void 0
|
|
7786
7957
|
);
|
|
7787
7958
|
this.#updateItemPositionAt(index, shiftedPosition);
|
|
7788
7959
|
}
|
|
@@ -8031,7 +8202,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
8031
8202
|
* @param value The value of the element to add. Should be serializable to JSON.
|
|
8032
8203
|
*/
|
|
8033
8204
|
set(key, value) {
|
|
8034
|
-
_optionalChain([this, 'access',
|
|
8205
|
+
_optionalChain([this, 'access', _216 => _216._pool, 'optionalAccess', _217 => _217.assertStorageIsWritable, 'call', _218 => _218()]);
|
|
8035
8206
|
const oldValue = this.#map.get(key);
|
|
8036
8207
|
if (oldValue) {
|
|
8037
8208
|
oldValue._detach();
|
|
@@ -8077,7 +8248,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
8077
8248
|
* @returns true if an element existed and has been removed, or false if the element does not exist.
|
|
8078
8249
|
*/
|
|
8079
8250
|
delete(key) {
|
|
8080
|
-
_optionalChain([this, 'access',
|
|
8251
|
+
_optionalChain([this, 'access', _219 => _219._pool, 'optionalAccess', _220 => _220.assertStorageIsWritable, 'call', _221 => _221()]);
|
|
8081
8252
|
const item = this.#map.get(key);
|
|
8082
8253
|
if (item === void 0) {
|
|
8083
8254
|
return false;
|
|
@@ -8247,6 +8418,8 @@ function reconcile(live, json, config) {
|
|
|
8247
8418
|
return reconcileLiveList(live, json, config);
|
|
8248
8419
|
} else if (isLiveMap(live) && isPlainObject(json)) {
|
|
8249
8420
|
return reconcileLiveMap(live, config);
|
|
8421
|
+
} else if (isLiveFile(live) && shallow(live.data, json)) {
|
|
8422
|
+
return live;
|
|
8250
8423
|
} else {
|
|
8251
8424
|
return deepLiveify(json, config);
|
|
8252
8425
|
}
|
|
@@ -8689,20 +8862,20 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
8689
8862
|
* Caveat: this method will not add changes to the undo/redo stack.
|
|
8690
8863
|
*/
|
|
8691
8864
|
setLocal(key, value) {
|
|
8692
|
-
_optionalChain([this, 'access',
|
|
8865
|
+
_optionalChain([this, 'access', _222 => _222._pool, 'optionalAccess', _223 => _223.assertStorageIsWritable, 'call', _224 => _224()]);
|
|
8693
8866
|
const deleteResult = this.#prepareDelete(key);
|
|
8694
8867
|
this.#local.set(key, value);
|
|
8695
8868
|
this.invalidate();
|
|
8696
8869
|
if (this._pool !== void 0 && this._id !== void 0) {
|
|
8697
|
-
const ops = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess',
|
|
8698
|
-
const reverse = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess',
|
|
8699
|
-
const storageUpdates = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess',
|
|
8870
|
+
const ops = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess', _225 => _225[0]]), () => ( []));
|
|
8871
|
+
const reverse = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess', _226 => _226[1]]), () => ( []));
|
|
8872
|
+
const storageUpdates = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess', _227 => _227[2]]), () => ( /* @__PURE__ */ new Map()));
|
|
8700
8873
|
const existing = storageUpdates.get(this._id);
|
|
8701
8874
|
storageUpdates.set(this._id, {
|
|
8702
8875
|
node: this,
|
|
8703
8876
|
type: "LiveObject",
|
|
8704
8877
|
updates: {
|
|
8705
|
-
..._optionalChain([existing, 'optionalAccess',
|
|
8878
|
+
..._optionalChain([existing, 'optionalAccess', _228 => _228.updates]),
|
|
8706
8879
|
[key]: { type: "update" }
|
|
8707
8880
|
}
|
|
8708
8881
|
});
|
|
@@ -8722,7 +8895,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
8722
8895
|
* #synced or pool/id are unavailable. Does NOT dispatch.
|
|
8723
8896
|
*/
|
|
8724
8897
|
#prepareDelete(key) {
|
|
8725
|
-
_optionalChain([this, 'access',
|
|
8898
|
+
_optionalChain([this, 'access', _229 => _229._pool, 'optionalAccess', _230 => _230.assertStorageIsWritable, 'call', _231 => _231()]);
|
|
8726
8899
|
const k = key;
|
|
8727
8900
|
if (this.#local.has(k) && !this.#synced.has(k)) {
|
|
8728
8901
|
const oldValue2 = this.#local.get(k);
|
|
@@ -8798,7 +8971,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
8798
8971
|
const result = this.#prepareDelete(key);
|
|
8799
8972
|
if (result) {
|
|
8800
8973
|
const [ops, reverse, storageUpdates] = result;
|
|
8801
|
-
_optionalChain([this, 'access',
|
|
8974
|
+
_optionalChain([this, 'access', _232 => _232._pool, 'optionalAccess', _233 => _233.dispatch, 'call', _234 => _234(ops, reverse, storageUpdates)]);
|
|
8802
8975
|
}
|
|
8803
8976
|
}
|
|
8804
8977
|
/**
|
|
@@ -8806,7 +8979,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
8806
8979
|
* @param patch The object used to overrides properties
|
|
8807
8980
|
*/
|
|
8808
8981
|
update(patch) {
|
|
8809
|
-
_optionalChain([this, 'access',
|
|
8982
|
+
_optionalChain([this, 'access', _235 => _235._pool, 'optionalAccess', _236 => _236.assertStorageIsWritable, 'call', _237 => _237()]);
|
|
8810
8983
|
if (_LiveObject.detectLargeObjects) {
|
|
8811
8984
|
const data = {};
|
|
8812
8985
|
for (const [key, value] of this.#synced) {
|
|
@@ -9173,8 +9346,31 @@ function isJsonEq(a, b) {
|
|
|
9173
9346
|
}
|
|
9174
9347
|
function diffNodeMap(prev, next) {
|
|
9175
9348
|
const ops = [];
|
|
9176
|
-
|
|
9177
|
-
|
|
9349
|
+
const idsToRecreate = /* @__PURE__ */ new Set();
|
|
9350
|
+
next.forEach((nextCrdt, id) => {
|
|
9351
|
+
const currentCrdt = prev.get(id);
|
|
9352
|
+
if (currentCrdt === void 0) {
|
|
9353
|
+
return;
|
|
9354
|
+
}
|
|
9355
|
+
if (currentCrdt.type !== nextCrdt.type || currentCrdt.type === CrdtType.FILE && nextCrdt.type === CrdtType.FILE && (currentCrdt.data.id !== nextCrdt.data.id || currentCrdt.data.name !== nextCrdt.data.name || currentCrdt.data.size !== nextCrdt.data.size || currentCrdt.data.mimeType !== nextCrdt.data.mimeType)) {
|
|
9356
|
+
idsToRecreate.add(id);
|
|
9357
|
+
}
|
|
9358
|
+
});
|
|
9359
|
+
let foundDescendant = true;
|
|
9360
|
+
while (foundDescendant) {
|
|
9361
|
+
foundDescendant = false;
|
|
9362
|
+
for (const nodes of [prev, next]) {
|
|
9363
|
+
nodes.forEach((crdt, id) => {
|
|
9364
|
+
if (!idsToRecreate.has(id) && crdt.parentId !== void 0 && idsToRecreate.has(crdt.parentId)) {
|
|
9365
|
+
idsToRecreate.add(id);
|
|
9366
|
+
foundDescendant = true;
|
|
9367
|
+
}
|
|
9368
|
+
});
|
|
9369
|
+
}
|
|
9370
|
+
}
|
|
9371
|
+
prev.forEach((crdt, id) => {
|
|
9372
|
+
const parentWillBeRecreated = crdt.parentId !== void 0 && idsToRecreate.has(crdt.parentId);
|
|
9373
|
+
if ((!next.has(id) || idsToRecreate.has(id)) && !parentWillBeRecreated) {
|
|
9178
9374
|
ops.push({ type: OpCode.DELETE_CRDT, id });
|
|
9179
9375
|
}
|
|
9180
9376
|
});
|
|
@@ -9185,7 +9381,7 @@ function diffNodeMap(prev, next) {
|
|
|
9185
9381
|
}
|
|
9186
9382
|
emitted.add(id);
|
|
9187
9383
|
const parentId = crdt.parentId;
|
|
9188
|
-
if (parentId !== void 0 && !prev.has(parentId)) {
|
|
9384
|
+
if (parentId !== void 0 && (!prev.has(parentId) || idsToRecreate.has(parentId))) {
|
|
9189
9385
|
const parentCrdt = next.get(parentId);
|
|
9190
9386
|
if (parentCrdt !== void 0) {
|
|
9191
9387
|
emitCreate(parentId, parentCrdt);
|
|
@@ -9244,29 +9440,25 @@ function diffNodeMap(prev, next) {
|
|
|
9244
9440
|
}
|
|
9245
9441
|
next.forEach((crdt, id) => {
|
|
9246
9442
|
const currentCrdt = prev.get(id);
|
|
9247
|
-
if (currentCrdt) {
|
|
9248
|
-
if (crdt.type === CrdtType.OBJECT) {
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
const value = crdt.data[key];
|
|
9255
|
-
if (value !== void 0 && !isJsonEq(value, currentCrdt.data[key])) {
|
|
9256
|
-
changed.set(key, value);
|
|
9257
|
-
}
|
|
9258
|
-
}
|
|
9259
|
-
if (changed.size > 0) {
|
|
9260
|
-
ops.push({
|
|
9261
|
-
type: OpCode.UPDATE_OBJECT,
|
|
9262
|
-
id,
|
|
9263
|
-
data: Object.fromEntries(changed)
|
|
9264
|
-
});
|
|
9443
|
+
if (currentCrdt && !idsToRecreate.has(id)) {
|
|
9444
|
+
if (crdt.type === CrdtType.OBJECT && currentCrdt.type === CrdtType.OBJECT) {
|
|
9445
|
+
const changed = /* @__PURE__ */ new Map();
|
|
9446
|
+
for (const key of Object.keys(crdt.data)) {
|
|
9447
|
+
const value = crdt.data[key];
|
|
9448
|
+
if (value !== void 0 && !isJsonEq(value, currentCrdt.data[key])) {
|
|
9449
|
+
changed.set(key, value);
|
|
9265
9450
|
}
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9451
|
+
}
|
|
9452
|
+
if (changed.size > 0) {
|
|
9453
|
+
ops.push({
|
|
9454
|
+
type: OpCode.UPDATE_OBJECT,
|
|
9455
|
+
id,
|
|
9456
|
+
data: Object.fromEntries(changed)
|
|
9457
|
+
});
|
|
9458
|
+
}
|
|
9459
|
+
for (const key of Object.keys(currentCrdt.data)) {
|
|
9460
|
+
if (!(key in crdt.data)) {
|
|
9461
|
+
ops.push({ type: OpCode.DELETE_OBJECT_KEY, id, key });
|
|
9270
9462
|
}
|
|
9271
9463
|
}
|
|
9272
9464
|
}
|
|
@@ -9338,7 +9530,7 @@ function sendToPanel(message, options) {
|
|
|
9338
9530
|
...message,
|
|
9339
9531
|
source: "liveblocks-devtools-client"
|
|
9340
9532
|
};
|
|
9341
|
-
if (!(_optionalChain([options, 'optionalAccess',
|
|
9533
|
+
if (!(_optionalChain([options, 'optionalAccess', _238 => _238.force]) || _bridgeActive)) {
|
|
9342
9534
|
return;
|
|
9343
9535
|
}
|
|
9344
9536
|
window.postMessage(fullMsg, "*");
|
|
@@ -9346,7 +9538,7 @@ function sendToPanel(message, options) {
|
|
|
9346
9538
|
var eventSource = makeEventSource();
|
|
9347
9539
|
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
9348
9540
|
window.addEventListener("message", (event) => {
|
|
9349
|
-
if (event.source === window && _optionalChain([event, 'access',
|
|
9541
|
+
if (event.source === window && _optionalChain([event, 'access', _239 => _239.data, 'optionalAccess', _240 => _240.source]) === "liveblocks-devtools-panel") {
|
|
9350
9542
|
eventSource.notify(event.data);
|
|
9351
9543
|
} else {
|
|
9352
9544
|
}
|
|
@@ -9488,7 +9680,7 @@ function fullSync(room) {
|
|
|
9488
9680
|
msg: "room::sync::full",
|
|
9489
9681
|
roomId: room.id,
|
|
9490
9682
|
status: room.getStatus(),
|
|
9491
|
-
storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess',
|
|
9683
|
+
storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _241 => _241.toTreeNode, 'call', _242 => _242("root"), 'access', _243 => _243.payload]), () => ( null)),
|
|
9492
9684
|
me,
|
|
9493
9685
|
others
|
|
9494
9686
|
});
|
|
@@ -10175,15 +10367,15 @@ function installBackgroundTabSpy() {
|
|
|
10175
10367
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
10176
10368
|
const inBackgroundSince = { current: null };
|
|
10177
10369
|
function onVisibilityChange() {
|
|
10178
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
10370
|
+
if (_optionalChain([doc, 'optionalAccess', _244 => _244.visibilityState]) === "hidden") {
|
|
10179
10371
|
inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
|
|
10180
10372
|
} else {
|
|
10181
10373
|
inBackgroundSince.current = null;
|
|
10182
10374
|
}
|
|
10183
10375
|
}
|
|
10184
|
-
_optionalChain([doc, 'optionalAccess',
|
|
10376
|
+
_optionalChain([doc, 'optionalAccess', _245 => _245.addEventListener, 'call', _246 => _246("visibilitychange", onVisibilityChange)]);
|
|
10185
10377
|
const unsub = () => {
|
|
10186
|
-
_optionalChain([doc, 'optionalAccess',
|
|
10378
|
+
_optionalChain([doc, 'optionalAccess', _247 => _247.removeEventListener, 'call', _248 => _248("visibilitychange", onVisibilityChange)]);
|
|
10187
10379
|
};
|
|
10188
10380
|
return [inBackgroundSince, unsub];
|
|
10189
10381
|
}
|
|
@@ -10207,7 +10399,7 @@ function makeNodeMapBuffer() {
|
|
|
10207
10399
|
function topLevelKeysOf(nodes) {
|
|
10208
10400
|
const keys2 = /* @__PURE__ */ new Set();
|
|
10209
10401
|
const root = nodes.get("root");
|
|
10210
|
-
for (const key in _optionalChain([root, 'optionalAccess',
|
|
10402
|
+
for (const key in _optionalChain([root, 'optionalAccess', _249 => _249.data])) {
|
|
10211
10403
|
keys2.add(key);
|
|
10212
10404
|
}
|
|
10213
10405
|
for (const node of nodes.values()) {
|
|
@@ -10390,7 +10582,7 @@ function createRoom(options, config) {
|
|
|
10390
10582
|
}
|
|
10391
10583
|
}
|
|
10392
10584
|
function isStorageWritable() {
|
|
10393
|
-
const permissionMatrix = _optionalChain([context, 'access',
|
|
10585
|
+
const permissionMatrix = _optionalChain([context, 'access', _250 => _250.dynamicSessionInfoSig, 'access', _251 => _251.get, 'call', _252 => _252(), 'optionalAccess', _253 => _253.permissionMatrix]);
|
|
10394
10586
|
return permissionMatrix !== void 0 ? hasPermissionAccess(permissionMatrix, "storage", "write") : true;
|
|
10395
10587
|
}
|
|
10396
10588
|
const eventHub = {
|
|
@@ -10510,7 +10702,7 @@ function createRoom(options, config) {
|
|
|
10510
10702
|
context.pool
|
|
10511
10703
|
);
|
|
10512
10704
|
}
|
|
10513
|
-
const canWrite = _nullishCoalesce(_optionalChain([self, 'access',
|
|
10705
|
+
const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _254 => _254.get, 'call', _255 => _255(), 'optionalAccess', _256 => _256.canWrite]), () => ( true));
|
|
10514
10706
|
const serverTopLevelKeys = topLevelKeysOf(nodes);
|
|
10515
10707
|
const root = context.root;
|
|
10516
10708
|
disableHistory(() => {
|
|
@@ -10743,7 +10935,7 @@ function createRoom(options, config) {
|
|
|
10743
10935
|
}
|
|
10744
10936
|
context.myPresence.patch(patch);
|
|
10745
10937
|
if (context.activeBatch) {
|
|
10746
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
10938
|
+
if (_optionalChain([options2, 'optionalAccess', _257 => _257.addToHistory])) {
|
|
10747
10939
|
context.activeBatch.reverseOps.pushLeft({
|
|
10748
10940
|
type: "presence",
|
|
10749
10941
|
data: oldValues
|
|
@@ -10752,7 +10944,7 @@ function createRoom(options, config) {
|
|
|
10752
10944
|
context.activeBatch.updates.presence = true;
|
|
10753
10945
|
} else {
|
|
10754
10946
|
flushNowOrSoon();
|
|
10755
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
10947
|
+
if (_optionalChain([options2, 'optionalAccess', _258 => _258.addToHistory])) {
|
|
10756
10948
|
addToUndoStack([{ type: "presence", data: oldValues }]);
|
|
10757
10949
|
}
|
|
10758
10950
|
notify({ presence: true });
|
|
@@ -10931,11 +11123,11 @@ function createRoom(options, config) {
|
|
|
10931
11123
|
break;
|
|
10932
11124
|
}
|
|
10933
11125
|
case ServerMsgCode.STORAGE_CHUNK:
|
|
10934
|
-
_optionalChain([stopwatch, 'optionalAccess',
|
|
11126
|
+
_optionalChain([stopwatch, 'optionalAccess', _259 => _259.lap, 'call', _260 => _260()]);
|
|
10935
11127
|
nodeMapBuffer.append(compactNodesToNodeStream(message.nodes));
|
|
10936
11128
|
break;
|
|
10937
11129
|
case ServerMsgCode.STORAGE_STREAM_END: {
|
|
10938
|
-
const timing = _optionalChain([stopwatch, 'optionalAccess',
|
|
11130
|
+
const timing = _optionalChain([stopwatch, 'optionalAccess', _261 => _261.stop, 'call', _262 => _262()]);
|
|
10939
11131
|
if (timing) {
|
|
10940
11132
|
const ms = (v) => `${v.toFixed(1)}ms`;
|
|
10941
11133
|
const rest = timing.laps.slice(1);
|
|
@@ -11070,11 +11262,11 @@ function createRoom(options, config) {
|
|
|
11070
11262
|
} else if (pendingFeedsRequests.has(requestId)) {
|
|
11071
11263
|
const pending = pendingFeedsRequests.get(requestId);
|
|
11072
11264
|
pendingFeedsRequests.delete(requestId);
|
|
11073
|
-
_optionalChain([pending, 'optionalAccess',
|
|
11265
|
+
_optionalChain([pending, 'optionalAccess', _263 => _263.reject, 'call', _264 => _264(err)]);
|
|
11074
11266
|
} else if (pendingFeedMessagesRequests.has(requestId)) {
|
|
11075
11267
|
const pending = pendingFeedMessagesRequests.get(requestId);
|
|
11076
11268
|
pendingFeedMessagesRequests.delete(requestId);
|
|
11077
|
-
_optionalChain([pending, 'optionalAccess',
|
|
11269
|
+
_optionalChain([pending, 'optionalAccess', _265 => _265.reject, 'call', _266 => _266(err)]);
|
|
11078
11270
|
}
|
|
11079
11271
|
eventHub.feeds.notify(message);
|
|
11080
11272
|
break;
|
|
@@ -11228,10 +11420,10 @@ function createRoom(options, config) {
|
|
|
11228
11420
|
timeoutId,
|
|
11229
11421
|
kind,
|
|
11230
11422
|
feedId,
|
|
11231
|
-
messageId: _optionalChain([options2, 'optionalAccess',
|
|
11232
|
-
expectedClientMessageId: _optionalChain([options2, 'optionalAccess',
|
|
11423
|
+
messageId: _optionalChain([options2, 'optionalAccess', _267 => _267.messageId]),
|
|
11424
|
+
expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _268 => _268.expectedClientMessageId])
|
|
11233
11425
|
});
|
|
11234
|
-
if (kind === "add-message" && _optionalChain([options2, 'optionalAccess',
|
|
11426
|
+
if (kind === "add-message" && _optionalChain([options2, 'optionalAccess', _269 => _269.expectedClientMessageId]) === void 0) {
|
|
11235
11427
|
const q = _nullishCoalesce(pendingAddMessageFifoByFeed.get(feedId), () => ( []));
|
|
11236
11428
|
q.push(requestId);
|
|
11237
11429
|
pendingAddMessageFifoByFeed.set(feedId, q);
|
|
@@ -11282,10 +11474,10 @@ function createRoom(options, config) {
|
|
|
11282
11474
|
}
|
|
11283
11475
|
if (!matched) {
|
|
11284
11476
|
const q = pendingAddMessageFifoByFeed.get(message.feedId);
|
|
11285
|
-
const headId = _optionalChain([q, 'optionalAccess',
|
|
11477
|
+
const headId = _optionalChain([q, 'optionalAccess', _270 => _270[0]]);
|
|
11286
11478
|
if (headId !== void 0) {
|
|
11287
11479
|
const pending = pendingFeedMutations.get(headId);
|
|
11288
|
-
if (_optionalChain([pending, 'optionalAccess',
|
|
11480
|
+
if (_optionalChain([pending, 'optionalAccess', _271 => _271.kind]) === "add-message" && pending.expectedClientMessageId === void 0) {
|
|
11289
11481
|
settleFeedMutation(headId, "ok");
|
|
11290
11482
|
}
|
|
11291
11483
|
}
|
|
@@ -11321,7 +11513,7 @@ function createRoom(options, config) {
|
|
|
11321
11513
|
const unacknowledgedOps2 = [...context.unacknowledgedOps.values()];
|
|
11322
11514
|
createOrUpdateRootFromMessage(nodes);
|
|
11323
11515
|
applyAndSendOfflineOps(unacknowledgedOps2);
|
|
11324
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall',
|
|
11516
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _272 => _272()]);
|
|
11325
11517
|
notifyStorageStatus();
|
|
11326
11518
|
eventHub.storageDidLoad.notify();
|
|
11327
11519
|
}
|
|
@@ -11330,7 +11522,7 @@ function createRoom(options, config) {
|
|
|
11330
11522
|
if (!messages.some((msg) => msg.type === ClientMsgCode.FETCH_STORAGE)) {
|
|
11331
11523
|
messages.push({ type: ClientMsgCode.FETCH_STORAGE });
|
|
11332
11524
|
nodeMapBuffer.take();
|
|
11333
|
-
_optionalChain([stopwatch, 'optionalAccess',
|
|
11525
|
+
_optionalChain([stopwatch, 'optionalAccess', _273 => _273.start, 'call', _274 => _274()]);
|
|
11334
11526
|
}
|
|
11335
11527
|
}
|
|
11336
11528
|
function startLoadingStorage() {
|
|
@@ -11384,10 +11576,10 @@ function createRoom(options, config) {
|
|
|
11384
11576
|
const message = {
|
|
11385
11577
|
type: ClientMsgCode.FETCH_FEEDS,
|
|
11386
11578
|
requestId,
|
|
11387
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
11388
|
-
since: _optionalChain([options2, 'optionalAccess',
|
|
11389
|
-
limit: _optionalChain([options2, 'optionalAccess',
|
|
11390
|
-
metadata: _optionalChain([options2, 'optionalAccess',
|
|
11579
|
+
cursor: _optionalChain([options2, 'optionalAccess', _275 => _275.cursor]),
|
|
11580
|
+
since: _optionalChain([options2, 'optionalAccess', _276 => _276.since]),
|
|
11581
|
+
limit: _optionalChain([options2, 'optionalAccess', _277 => _277.limit]),
|
|
11582
|
+
metadata: _optionalChain([options2, 'optionalAccess', _278 => _278.metadata])
|
|
11391
11583
|
};
|
|
11392
11584
|
context.buffer.messages.push(message);
|
|
11393
11585
|
flushNowOrSoon();
|
|
@@ -11407,9 +11599,9 @@ function createRoom(options, config) {
|
|
|
11407
11599
|
type: ClientMsgCode.FETCH_FEED_MESSAGES,
|
|
11408
11600
|
requestId,
|
|
11409
11601
|
feedId,
|
|
11410
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
11411
|
-
since: _optionalChain([options2, 'optionalAccess',
|
|
11412
|
-
limit: _optionalChain([options2, 'optionalAccess',
|
|
11602
|
+
cursor: _optionalChain([options2, 'optionalAccess', _279 => _279.cursor]),
|
|
11603
|
+
since: _optionalChain([options2, 'optionalAccess', _280 => _280.since]),
|
|
11604
|
+
limit: _optionalChain([options2, 'optionalAccess', _281 => _281.limit])
|
|
11413
11605
|
};
|
|
11414
11606
|
context.buffer.messages.push(message);
|
|
11415
11607
|
flushNowOrSoon();
|
|
@@ -11428,8 +11620,8 @@ function createRoom(options, config) {
|
|
|
11428
11620
|
type: ClientMsgCode.ADD_FEED,
|
|
11429
11621
|
requestId,
|
|
11430
11622
|
feedId,
|
|
11431
|
-
metadata: _optionalChain([options2, 'optionalAccess',
|
|
11432
|
-
createdAt: _optionalChain([options2, 'optionalAccess',
|
|
11623
|
+
metadata: _optionalChain([options2, 'optionalAccess', _282 => _282.metadata]),
|
|
11624
|
+
createdAt: _optionalChain([options2, 'optionalAccess', _283 => _283.createdAt])
|
|
11433
11625
|
};
|
|
11434
11626
|
context.buffer.messages.push(message);
|
|
11435
11627
|
flushNowOrSoon();
|
|
@@ -11463,15 +11655,15 @@ function createRoom(options, config) {
|
|
|
11463
11655
|
function addFeedMessage(feedId, data, options2) {
|
|
11464
11656
|
const requestId = nanoid();
|
|
11465
11657
|
const promise = registerFeedMutation(requestId, "add-message", feedId, {
|
|
11466
|
-
expectedClientMessageId: _optionalChain([options2, 'optionalAccess',
|
|
11658
|
+
expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _284 => _284.id])
|
|
11467
11659
|
});
|
|
11468
11660
|
const message = {
|
|
11469
11661
|
type: ClientMsgCode.ADD_FEED_MESSAGE,
|
|
11470
11662
|
requestId,
|
|
11471
11663
|
feedId,
|
|
11472
11664
|
data,
|
|
11473
|
-
id: _optionalChain([options2, 'optionalAccess',
|
|
11474
|
-
createdAt: _optionalChain([options2, 'optionalAccess',
|
|
11665
|
+
id: _optionalChain([options2, 'optionalAccess', _285 => _285.id]),
|
|
11666
|
+
createdAt: _optionalChain([options2, 'optionalAccess', _286 => _286.createdAt])
|
|
11475
11667
|
};
|
|
11476
11668
|
context.buffer.messages.push(message);
|
|
11477
11669
|
flushNowOrSoon();
|
|
@@ -11488,7 +11680,7 @@ function createRoom(options, config) {
|
|
|
11488
11680
|
feedId,
|
|
11489
11681
|
messageId,
|
|
11490
11682
|
data,
|
|
11491
|
-
updatedAt: _optionalChain([options2, 'optionalAccess',
|
|
11683
|
+
updatedAt: _optionalChain([options2, 'optionalAccess', _287 => _287.updatedAt])
|
|
11492
11684
|
};
|
|
11493
11685
|
context.buffer.messages.push(message);
|
|
11494
11686
|
flushNowOrSoon();
|
|
@@ -11695,8 +11887,8 @@ function createRoom(options, config) {
|
|
|
11695
11887
|
async function getThreads(options2) {
|
|
11696
11888
|
return httpClient.getThreads({
|
|
11697
11889
|
roomId,
|
|
11698
|
-
query: _optionalChain([options2, 'optionalAccess',
|
|
11699
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
11890
|
+
query: _optionalChain([options2, 'optionalAccess', _288 => _288.query]),
|
|
11891
|
+
cursor: _optionalChain([options2, 'optionalAccess', _289 => _289.cursor])
|
|
11700
11892
|
});
|
|
11701
11893
|
}
|
|
11702
11894
|
async function getThread(threadId) {
|
|
@@ -11829,7 +12021,7 @@ function createRoom(options, config) {
|
|
|
11829
12021
|
function getSubscriptionSettings(options2) {
|
|
11830
12022
|
return httpClient.getSubscriptionSettings({
|
|
11831
12023
|
roomId,
|
|
11832
|
-
signal: _optionalChain([options2, 'optionalAccess',
|
|
12024
|
+
signal: _optionalChain([options2, 'optionalAccess', _290 => _290.signal])
|
|
11833
12025
|
});
|
|
11834
12026
|
}
|
|
11835
12027
|
function updateSubscriptionSettings(settings) {
|
|
@@ -11851,7 +12043,7 @@ function createRoom(options, config) {
|
|
|
11851
12043
|
{
|
|
11852
12044
|
[kInternal]: {
|
|
11853
12045
|
get presenceBuffer() {
|
|
11854
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
12046
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _291 => _291.buffer, 'access', _292 => _292.presenceUpdates, 'optionalAccess', _293 => _293.data]), () => ( null)));
|
|
11855
12047
|
},
|
|
11856
12048
|
// prettier-ignore
|
|
11857
12049
|
get undoStack() {
|
|
@@ -11866,15 +12058,15 @@ function createRoom(options, config) {
|
|
|
11866
12058
|
return context.yjsProvider;
|
|
11867
12059
|
},
|
|
11868
12060
|
setYjsProvider(newProvider) {
|
|
11869
|
-
_optionalChain([context, 'access',
|
|
12061
|
+
_optionalChain([context, 'access', _294 => _294.yjsProvider, 'optionalAccess', _295 => _295.off, 'call', _296 => _296("status", yjsStatusDidChange)]);
|
|
11870
12062
|
context.yjsProvider = newProvider;
|
|
11871
|
-
_optionalChain([newProvider, 'optionalAccess',
|
|
12063
|
+
_optionalChain([newProvider, 'optionalAccess', _297 => _297.on, 'call', _298 => _298("status", yjsStatusDidChange)]);
|
|
11872
12064
|
context.yjsProviderDidChange.notify();
|
|
11873
12065
|
},
|
|
11874
12066
|
yjsProviderDidChange: context.yjsProviderDidChange.observable,
|
|
11875
12067
|
// send metadata when using a text editor
|
|
11876
12068
|
reportTextEditor,
|
|
11877
|
-
getPermissionMatrix: () => _optionalChain([context, 'access',
|
|
12069
|
+
getPermissionMatrix: () => _optionalChain([context, 'access', _299 => _299.dynamicSessionInfoSig, 'access', _300 => _300.get, 'call', _301 => _301(), 'optionalAccess', _302 => _302.permissionMatrix]),
|
|
11878
12070
|
// create a text mention when using a text editor
|
|
11879
12071
|
createTextMention,
|
|
11880
12072
|
// delete a text mention when using a text editor
|
|
@@ -11937,7 +12129,7 @@ ${dumpPool(
|
|
|
11937
12129
|
source.dispose();
|
|
11938
12130
|
}
|
|
11939
12131
|
eventHub.roomWillDestroy.notify();
|
|
11940
|
-
_optionalChain([context, 'access',
|
|
12132
|
+
_optionalChain([context, 'access', _303 => _303.yjsProvider, 'optionalAccess', _304 => _304.off, 'call', _305 => _305("status", yjsStatusDidChange)]);
|
|
11941
12133
|
syncSourceForStorage.destroy();
|
|
11942
12134
|
syncSourceForYjs.destroy();
|
|
11943
12135
|
uninstallBgTabSpy();
|
|
@@ -12101,7 +12293,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
|
|
|
12101
12293
|
}
|
|
12102
12294
|
if (isLiveNode(first)) {
|
|
12103
12295
|
const node = first;
|
|
12104
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12296
|
+
if (_optionalChain([options, 'optionalAccess', _306 => _306.isDeep])) {
|
|
12105
12297
|
const storageCallback = second;
|
|
12106
12298
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
12107
12299
|
} else {
|
|
@@ -12191,8 +12383,8 @@ function createClient(options) {
|
|
|
12191
12383
|
const authManager = createAuthManager(options, (token) => {
|
|
12192
12384
|
currentUserId.set(() => token.uid);
|
|
12193
12385
|
});
|
|
12194
|
-
const fetchPolyfill = _optionalChain([clientOptions, 'access',
|
|
12195
|
-
_optionalChain([globalThis, 'access',
|
|
12386
|
+
const fetchPolyfill = _optionalChain([clientOptions, 'access', _307 => _307.polyfills, 'optionalAccess', _308 => _308.fetch]) || /* istanbul ignore next */
|
|
12387
|
+
_optionalChain([globalThis, 'access', _309 => _309.fetch, 'optionalAccess', _310 => _310.bind, 'call', _311 => _311(globalThis)]);
|
|
12196
12388
|
const httpClient = createApiClient({
|
|
12197
12389
|
baseUrl,
|
|
12198
12390
|
fetchPolyfill,
|
|
@@ -12209,7 +12401,7 @@ function createClient(options) {
|
|
|
12209
12401
|
delegates: {
|
|
12210
12402
|
createSocket: makeCreateSocketDelegateForAi(
|
|
12211
12403
|
baseUrl,
|
|
12212
|
-
_optionalChain([clientOptions, 'access',
|
|
12404
|
+
_optionalChain([clientOptions, 'access', _312 => _312.polyfills, 'optionalAccess', _313 => _313.WebSocket])
|
|
12213
12405
|
),
|
|
12214
12406
|
authenticate: async () => {
|
|
12215
12407
|
const resp = await authManager.getAuthValue({
|
|
@@ -12280,7 +12472,7 @@ function createClient(options) {
|
|
|
12280
12472
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
12281
12473
|
roomId,
|
|
12282
12474
|
baseUrl,
|
|
12283
|
-
_optionalChain([clientOptions, 'access',
|
|
12475
|
+
_optionalChain([clientOptions, 'access', _314 => _314.polyfills, 'optionalAccess', _315 => _315.WebSocket])
|
|
12284
12476
|
),
|
|
12285
12477
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
12286
12478
|
})),
|
|
@@ -12302,7 +12494,7 @@ function createClient(options) {
|
|
|
12302
12494
|
const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
|
|
12303
12495
|
if (shouldConnect) {
|
|
12304
12496
|
if (typeof atob === "undefined") {
|
|
12305
|
-
if (_optionalChain([clientOptions, 'access',
|
|
12497
|
+
if (_optionalChain([clientOptions, 'access', _316 => _316.polyfills, 'optionalAccess', _317 => _317.atob]) === void 0) {
|
|
12306
12498
|
throw new Error(
|
|
12307
12499
|
"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"
|
|
12308
12500
|
);
|
|
@@ -12314,7 +12506,7 @@ function createClient(options) {
|
|
|
12314
12506
|
return leaseRoom(newRoomDetails);
|
|
12315
12507
|
}
|
|
12316
12508
|
function getRoom(roomId) {
|
|
12317
|
-
const room = _optionalChain([roomsById, 'access',
|
|
12509
|
+
const room = _optionalChain([roomsById, 'access', _318 => _318.get, 'call', _319 => _319(roomId), 'optionalAccess', _320 => _320.room]);
|
|
12318
12510
|
return room ? room : null;
|
|
12319
12511
|
}
|
|
12320
12512
|
function logout() {
|
|
@@ -12330,7 +12522,7 @@ function createClient(options) {
|
|
|
12330
12522
|
const batchedResolveUsers = new Batch(
|
|
12331
12523
|
async (batchedUserIds) => {
|
|
12332
12524
|
const userIds = batchedUserIds.flat();
|
|
12333
|
-
const users = await _optionalChain([resolveUsers, 'optionalCall',
|
|
12525
|
+
const users = await _optionalChain([resolveUsers, 'optionalCall', _321 => _321({ userIds })]);
|
|
12334
12526
|
warnOnceIf(
|
|
12335
12527
|
!resolveUsers,
|
|
12336
12528
|
"Set the resolveUsers option in createClient to specify user info."
|
|
@@ -12347,7 +12539,7 @@ function createClient(options) {
|
|
|
12347
12539
|
const batchedResolveRoomsInfo = new Batch(
|
|
12348
12540
|
async (batchedRoomIds) => {
|
|
12349
12541
|
const roomIds = batchedRoomIds.flat();
|
|
12350
|
-
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall',
|
|
12542
|
+
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _322 => _322({ roomIds })]);
|
|
12351
12543
|
warnOnceIf(
|
|
12352
12544
|
!resolveRoomsInfo,
|
|
12353
12545
|
"Set the resolveRoomsInfo option in createClient to specify room info."
|
|
@@ -12364,7 +12556,7 @@ function createClient(options) {
|
|
|
12364
12556
|
const batchedResolveGroupsInfo = new Batch(
|
|
12365
12557
|
async (batchedGroupIds) => {
|
|
12366
12558
|
const groupIds = batchedGroupIds.flat();
|
|
12367
|
-
const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall',
|
|
12559
|
+
const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _323 => _323({ groupIds })]);
|
|
12368
12560
|
warnOnceIf(
|
|
12369
12561
|
!resolveGroupsInfo,
|
|
12370
12562
|
"Set the resolveGroupsInfo option in createClient to specify group info."
|
|
@@ -12423,7 +12615,7 @@ function createClient(options) {
|
|
|
12423
12615
|
}
|
|
12424
12616
|
};
|
|
12425
12617
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
12426
|
-
_optionalChain([win, 'optionalAccess',
|
|
12618
|
+
_optionalChain([win, 'optionalAccess', _324 => _324.addEventListener, 'call', _325 => _325("beforeunload", maybePreventClose)]);
|
|
12427
12619
|
}
|
|
12428
12620
|
async function getNotificationSettings(options2) {
|
|
12429
12621
|
const plainSettings = await httpClient.getNotificationSettings(options2);
|
|
@@ -12551,7 +12743,7 @@ var commentBodyElementsTypes = {
|
|
|
12551
12743
|
mention: "inline"
|
|
12552
12744
|
};
|
|
12553
12745
|
function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
12554
|
-
if (!body || !_optionalChain([body, 'optionalAccess',
|
|
12746
|
+
if (!body || !_optionalChain([body, 'optionalAccess', _326 => _326.content])) {
|
|
12555
12747
|
return;
|
|
12556
12748
|
}
|
|
12557
12749
|
const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
|
|
@@ -12561,13 +12753,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
|
12561
12753
|
for (const block of body.content) {
|
|
12562
12754
|
if (type === "all" || type === "block") {
|
|
12563
12755
|
if (guard(block)) {
|
|
12564
|
-
_optionalChain([visitor, 'optionalCall',
|
|
12756
|
+
_optionalChain([visitor, 'optionalCall', _327 => _327(block)]);
|
|
12565
12757
|
}
|
|
12566
12758
|
}
|
|
12567
12759
|
if (type === "all" || type === "inline") {
|
|
12568
12760
|
for (const inline of block.children) {
|
|
12569
12761
|
if (guard(inline)) {
|
|
12570
|
-
_optionalChain([visitor, 'optionalCall',
|
|
12762
|
+
_optionalChain([visitor, 'optionalCall', _328 => _328(inline)]);
|
|
12571
12763
|
}
|
|
12572
12764
|
}
|
|
12573
12765
|
}
|
|
@@ -12737,7 +12929,7 @@ var stringifyCommentBodyPlainElements = {
|
|
|
12737
12929
|
text: ({ element }) => element.text,
|
|
12738
12930
|
link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
|
|
12739
12931
|
mention: ({ element, user, group }) => {
|
|
12740
|
-
return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
12932
|
+
return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _329 => _329.name]), () => ( _optionalChain([group, 'optionalAccess', _330 => _330.name]))), () => ( element.id))}`;
|
|
12741
12933
|
}
|
|
12742
12934
|
};
|
|
12743
12935
|
var stringifyCommentBodyHtmlElements = {
|
|
@@ -12767,7 +12959,7 @@ var stringifyCommentBodyHtmlElements = {
|
|
|
12767
12959
|
return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
|
|
12768
12960
|
},
|
|
12769
12961
|
mention: ({ element, user, group }) => {
|
|
12770
|
-
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess',
|
|
12962
|
+
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _331 => _331.name]) ? html`${_optionalChain([user, 'optionalAccess', _332 => _332.name])}` : _optionalChain([group, 'optionalAccess', _333 => _333.name]) ? html`${_optionalChain([group, 'optionalAccess', _334 => _334.name])}` : element.id}</span>`;
|
|
12771
12963
|
}
|
|
12772
12964
|
};
|
|
12773
12965
|
var stringifyCommentBodyMarkdownElements = {
|
|
@@ -12797,20 +12989,20 @@ var stringifyCommentBodyMarkdownElements = {
|
|
|
12797
12989
|
return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
|
|
12798
12990
|
},
|
|
12799
12991
|
mention: ({ element, user, group }) => {
|
|
12800
|
-
return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
12992
|
+
return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _335 => _335.name]), () => ( _optionalChain([group, 'optionalAccess', _336 => _336.name]))), () => ( element.id))}`;
|
|
12801
12993
|
}
|
|
12802
12994
|
};
|
|
12803
12995
|
async function stringifyCommentBody(body, options) {
|
|
12804
|
-
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
12805
|
-
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
12996
|
+
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _337 => _337.format]), () => ( "plain"));
|
|
12997
|
+
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _338 => _338.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
|
|
12806
12998
|
const elements = {
|
|
12807
12999
|
...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
|
|
12808
|
-
..._optionalChain([options, 'optionalAccess',
|
|
13000
|
+
..._optionalChain([options, 'optionalAccess', _339 => _339.elements])
|
|
12809
13001
|
};
|
|
12810
13002
|
const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInCommentBody(
|
|
12811
13003
|
body,
|
|
12812
|
-
_optionalChain([options, 'optionalAccess',
|
|
12813
|
-
_optionalChain([options, 'optionalAccess',
|
|
13004
|
+
_optionalChain([options, 'optionalAccess', _340 => _340.resolveUsers]),
|
|
13005
|
+
_optionalChain([options, 'optionalAccess', _341 => _341.resolveGroupsInfo])
|
|
12814
13006
|
);
|
|
12815
13007
|
const blocks = body.content.flatMap((block, blockIndex) => {
|
|
12816
13008
|
switch (block.type) {
|
|
@@ -12950,9 +13142,9 @@ function makePoller(callback, intervalMs, options) {
|
|
|
12950
13142
|
const startTime = performance.now();
|
|
12951
13143
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
12952
13144
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
12953
|
-
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
13145
|
+
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _342 => _342.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
|
|
12954
13146
|
const context = {
|
|
12955
|
-
inForeground: _optionalChain([doc, 'optionalAccess',
|
|
13147
|
+
inForeground: _optionalChain([doc, 'optionalAccess', _343 => _343.visibilityState]) !== "hidden",
|
|
12956
13148
|
lastSuccessfulPollAt: startTime,
|
|
12957
13149
|
count: 0,
|
|
12958
13150
|
backoff: 0
|
|
@@ -13033,11 +13225,11 @@ function makePoller(callback, intervalMs, options) {
|
|
|
13033
13225
|
pollNowIfStale();
|
|
13034
13226
|
}
|
|
13035
13227
|
function onVisibilityChange() {
|
|
13036
|
-
setInForeground(_optionalChain([doc, 'optionalAccess',
|
|
13228
|
+
setInForeground(_optionalChain([doc, 'optionalAccess', _344 => _344.visibilityState]) !== "hidden");
|
|
13037
13229
|
}
|
|
13038
|
-
_optionalChain([doc, 'optionalAccess',
|
|
13039
|
-
_optionalChain([win, 'optionalAccess',
|
|
13040
|
-
_optionalChain([win, 'optionalAccess',
|
|
13230
|
+
_optionalChain([doc, 'optionalAccess', _345 => _345.addEventListener, 'call', _346 => _346("visibilitychange", onVisibilityChange)]);
|
|
13231
|
+
_optionalChain([win, 'optionalAccess', _347 => _347.addEventListener, 'call', _348 => _348("online", onVisibilityChange)]);
|
|
13232
|
+
_optionalChain([win, 'optionalAccess', _349 => _349.addEventListener, 'call', _350 => _350("focus", pollNowIfStale)]);
|
|
13041
13233
|
fsm.start();
|
|
13042
13234
|
return {
|
|
13043
13235
|
inc,
|