@liveblocks/core 3.19.3 → 3.20.0-pre1
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 +112 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +23 -15
- 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.
|
|
9
|
+
var PKG_VERSION = "3.20.0-pre1";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -6123,9 +6123,9 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6123
6123
|
ops.push(op);
|
|
6124
6124
|
for (const item of this.#items) {
|
|
6125
6125
|
const parentKey2 = item._getParentKeyOrThrow();
|
|
6126
|
-
const childOps =
|
|
6126
|
+
const childOps = addIntentToOpTree(
|
|
6127
6127
|
item._toOps(this._id, parentKey2),
|
|
6128
|
-
|
|
6128
|
+
"set"
|
|
6129
6129
|
);
|
|
6130
6130
|
for (const childOp of childOps) {
|
|
6131
6131
|
ops.push(childOp);
|
|
@@ -6439,8 +6439,9 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6439
6439
|
existingItem._detach();
|
|
6440
6440
|
this.#items.remove(existingItem);
|
|
6441
6441
|
this.#items.add(child);
|
|
6442
|
-
const reverse =
|
|
6442
|
+
const reverse = addIntentToOpTree(
|
|
6443
6443
|
existingItem._toOps(nn(this._id), key),
|
|
6444
|
+
"set",
|
|
6444
6445
|
op.id
|
|
6445
6446
|
);
|
|
6446
6447
|
const delta = [setDelta(indexOfItemWithSameKey, child)];
|
|
@@ -6683,8 +6684,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6683
6684
|
* @param element The element to add to the end of the LiveList.
|
|
6684
6685
|
*/
|
|
6685
6686
|
push(element) {
|
|
6686
|
-
|
|
6687
|
-
return this.insert(element, this.length);
|
|
6687
|
+
return this.#injectAt(element, this.length, "push");
|
|
6688
6688
|
}
|
|
6689
6689
|
/**
|
|
6690
6690
|
* Inserts one element at a specified index.
|
|
@@ -6692,14 +6692,23 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6692
6692
|
* @param index The index at which you want to insert the element.
|
|
6693
6693
|
*/
|
|
6694
6694
|
insert(element, index) {
|
|
6695
|
-
|
|
6695
|
+
return this.#injectAt(element, index, "insert");
|
|
6696
|
+
}
|
|
6697
|
+
/**
|
|
6698
|
+
* Shared implementation of `insert` and `push`. A `"push"` intent leaves the
|
|
6699
|
+
* client-computed position untouched (so optimistic rendering is unchanged),
|
|
6700
|
+
* but tags the Op so the server appends it to the true end of the list
|
|
6701
|
+
* instead of resolving its position against the client's stale view.
|
|
6702
|
+
*/
|
|
6703
|
+
#injectAt(element, index, intent) {
|
|
6704
|
+
_optionalChain([this, 'access', _142 => _142._pool, 'optionalAccess', _143 => _143.assertStorageIsWritable, 'call', _144 => _144()]);
|
|
6696
6705
|
if (index < 0 || index > this.#items.length) {
|
|
6697
6706
|
throw new Error(
|
|
6698
6707
|
`Cannot insert list item at index "${index}". index should be between 0 and ${this.#items.length}`
|
|
6699
6708
|
);
|
|
6700
6709
|
}
|
|
6701
|
-
const before2 = _optionalChain([this, 'access',
|
|
6702
|
-
const after2 = _optionalChain([this, 'access',
|
|
6710
|
+
const before2 = _optionalChain([this, 'access', _145 => _145.#items, 'access', _146 => _146.at, 'call', _147 => _147(index - 1), 'optionalAccess', _148 => _148._parentPos]);
|
|
6711
|
+
const after2 = _optionalChain([this, 'access', _149 => _149.#items, 'access', _150 => _150.at, 'call', _151 => _151(index), 'optionalAccess', _152 => _152._parentPos]);
|
|
6703
6712
|
const position = makePosition(before2, after2);
|
|
6704
6713
|
const value = lsonToLiveNode(element);
|
|
6705
6714
|
value._setParentLink(this, position);
|
|
@@ -6707,8 +6716,9 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6707
6716
|
if (this._pool && this._id) {
|
|
6708
6717
|
const id = this._pool.generateId();
|
|
6709
6718
|
value._attach(id, this._pool);
|
|
6719
|
+
const ops = value._toOpsWithOpId(this._id, position, this._pool);
|
|
6710
6720
|
this._pool.dispatch(
|
|
6711
|
-
|
|
6721
|
+
intent === "push" ? addIntentToOpTree(ops, "push") : ops,
|
|
6712
6722
|
[{ type: OpCode.DELETE_CRDT, id }],
|
|
6713
6723
|
/* @__PURE__ */ new Map([
|
|
6714
6724
|
[this._id, makeUpdate(this, [insertDelta(index, value)])]
|
|
@@ -6722,7 +6732,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6722
6732
|
* @param targetIndex The index where the element should be after moving.
|
|
6723
6733
|
*/
|
|
6724
6734
|
move(index, targetIndex) {
|
|
6725
|
-
_optionalChain([this, 'access',
|
|
6735
|
+
_optionalChain([this, 'access', _153 => _153._pool, 'optionalAccess', _154 => _154.assertStorageIsWritable, 'call', _155 => _155()]);
|
|
6726
6736
|
if (targetIndex < 0) {
|
|
6727
6737
|
throw new Error("targetIndex cannot be less than 0");
|
|
6728
6738
|
}
|
|
@@ -6740,11 +6750,11 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6740
6750
|
let beforePosition = null;
|
|
6741
6751
|
let afterPosition = null;
|
|
6742
6752
|
if (index < targetIndex) {
|
|
6743
|
-
afterPosition = targetIndex === this.#items.length - 1 ? void 0 : _optionalChain([this, 'access',
|
|
6753
|
+
afterPosition = targetIndex === this.#items.length - 1 ? void 0 : _optionalChain([this, 'access', _156 => _156.#items, 'access', _157 => _157.at, 'call', _158 => _158(targetIndex + 1), 'optionalAccess', _159 => _159._parentPos]);
|
|
6744
6754
|
beforePosition = this.#items.at(targetIndex)._parentPos;
|
|
6745
6755
|
} else {
|
|
6746
6756
|
afterPosition = this.#items.at(targetIndex)._parentPos;
|
|
6747
|
-
beforePosition = targetIndex === 0 ? void 0 : _optionalChain([this, 'access',
|
|
6757
|
+
beforePosition = targetIndex === 0 ? void 0 : _optionalChain([this, 'access', _160 => _160.#items, 'access', _161 => _161.at, 'call', _162 => _162(targetIndex - 1), 'optionalAccess', _163 => _163._parentPos]);
|
|
6748
6758
|
}
|
|
6749
6759
|
const position = makePosition(beforePosition, afterPosition);
|
|
6750
6760
|
const item = this.#items.at(index);
|
|
@@ -6779,7 +6789,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6779
6789
|
* @param index The index of the element to delete
|
|
6780
6790
|
*/
|
|
6781
6791
|
delete(index) {
|
|
6782
|
-
_optionalChain([this, 'access',
|
|
6792
|
+
_optionalChain([this, 'access', _164 => _164._pool, 'optionalAccess', _165 => _165.assertStorageIsWritable, 'call', _166 => _166()]);
|
|
6783
6793
|
if (index < 0 || index >= this.#items.length) {
|
|
6784
6794
|
throw new Error(
|
|
6785
6795
|
`Cannot delete list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -6812,7 +6822,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6812
6822
|
}
|
|
6813
6823
|
}
|
|
6814
6824
|
clear() {
|
|
6815
|
-
_optionalChain([this, 'access',
|
|
6825
|
+
_optionalChain([this, 'access', _167 => _167._pool, 'optionalAccess', _168 => _168.assertStorageIsWritable, 'call', _169 => _169()]);
|
|
6816
6826
|
if (this._pool) {
|
|
6817
6827
|
const ops = [];
|
|
6818
6828
|
const reverseOps = [];
|
|
@@ -6846,7 +6856,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6846
6856
|
}
|
|
6847
6857
|
}
|
|
6848
6858
|
set(index, item) {
|
|
6849
|
-
_optionalChain([this, 'access',
|
|
6859
|
+
_optionalChain([this, 'access', _170 => _170._pool, 'optionalAccess', _171 => _171.assertStorageIsWritable, 'call', _172 => _172()]);
|
|
6850
6860
|
if (index < 0 || index >= this.#items.length) {
|
|
6851
6861
|
throw new Error(
|
|
6852
6862
|
`Cannot set list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -6866,13 +6876,15 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6866
6876
|
value._attach(id, this._pool);
|
|
6867
6877
|
const storageUpdates = /* @__PURE__ */ new Map();
|
|
6868
6878
|
storageUpdates.set(this._id, makeUpdate(this, [setDelta(index, value)]));
|
|
6869
|
-
const ops =
|
|
6879
|
+
const ops = addIntentToOpTree(
|
|
6870
6880
|
value._toOpsWithOpId(this._id, position, this._pool),
|
|
6881
|
+
"set",
|
|
6871
6882
|
existingId
|
|
6872
6883
|
);
|
|
6873
6884
|
this.#unacknowledgedSets.set(position, nn(ops[0].opId));
|
|
6874
|
-
const reverseOps =
|
|
6885
|
+
const reverseOps = addIntentToOpTree(
|
|
6875
6886
|
existingItem._toOps(this._id, position),
|
|
6887
|
+
"set",
|
|
6876
6888
|
id
|
|
6877
6889
|
);
|
|
6878
6890
|
this._pool.dispatch(ops, reverseOps, storageUpdates);
|
|
@@ -7004,7 +7016,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7004
7016
|
#shiftItemPosition(index, key) {
|
|
7005
7017
|
const shiftedPosition = makePosition(
|
|
7006
7018
|
key,
|
|
7007
|
-
this.#items.length > index + 1 ? _optionalChain([this, 'access',
|
|
7019
|
+
this.#items.length > index + 1 ? _optionalChain([this, 'access', _173 => _173.#items, 'access', _174 => _174.at, 'call', _175 => _175(index + 1), 'optionalAccess', _176 => _176._parentPos]) : void 0
|
|
7008
7020
|
);
|
|
7009
7021
|
this.#updateItemPositionAt(index, shiftedPosition);
|
|
7010
7022
|
}
|
|
@@ -7073,15 +7085,11 @@ function moveDelta(previousIndex, index, item) {
|
|
|
7073
7085
|
previousIndex
|
|
7074
7086
|
};
|
|
7075
7087
|
}
|
|
7076
|
-
function
|
|
7088
|
+
function addIntentToOpTree(ops, intent, deletedId) {
|
|
7077
7089
|
return ops.map((op, index) => {
|
|
7078
7090
|
if (index === 0) {
|
|
7079
7091
|
const firstOp = op;
|
|
7080
|
-
return {
|
|
7081
|
-
...firstOp,
|
|
7082
|
-
intent: "set",
|
|
7083
|
-
deletedId
|
|
7084
|
-
};
|
|
7092
|
+
return { ...firstOp, intent, deletedId };
|
|
7085
7093
|
} else {
|
|
7086
7094
|
return op;
|
|
7087
7095
|
}
|
|
@@ -7257,7 +7265,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
7257
7265
|
* @param value The value of the element to add. Should be serializable to JSON.
|
|
7258
7266
|
*/
|
|
7259
7267
|
set(key, value) {
|
|
7260
|
-
_optionalChain([this, 'access',
|
|
7268
|
+
_optionalChain([this, 'access', _177 => _177._pool, 'optionalAccess', _178 => _178.assertStorageIsWritable, 'call', _179 => _179()]);
|
|
7261
7269
|
const oldValue = this.#map.get(key);
|
|
7262
7270
|
if (oldValue) {
|
|
7263
7271
|
oldValue._detach();
|
|
@@ -7303,7 +7311,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
7303
7311
|
* @returns true if an element existed and has been removed, or false if the element does not exist.
|
|
7304
7312
|
*/
|
|
7305
7313
|
delete(key) {
|
|
7306
|
-
_optionalChain([this, 'access',
|
|
7314
|
+
_optionalChain([this, 'access', _180 => _180._pool, 'optionalAccess', _181 => _181.assertStorageIsWritable, 'call', _182 => _182()]);
|
|
7307
7315
|
const item = this.#map.get(key);
|
|
7308
7316
|
if (item === void 0) {
|
|
7309
7317
|
return false;
|
|
@@ -7914,20 +7922,20 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
7914
7922
|
* Caveat: this method will not add changes to the undo/redo stack.
|
|
7915
7923
|
*/
|
|
7916
7924
|
setLocal(key, value) {
|
|
7917
|
-
_optionalChain([this, 'access',
|
|
7925
|
+
_optionalChain([this, 'access', _183 => _183._pool, 'optionalAccess', _184 => _184.assertStorageIsWritable, 'call', _185 => _185()]);
|
|
7918
7926
|
const deleteResult = this.#prepareDelete(key);
|
|
7919
7927
|
this.#local.set(key, value);
|
|
7920
7928
|
this.invalidate();
|
|
7921
7929
|
if (this._pool !== void 0 && this._id !== void 0) {
|
|
7922
|
-
const ops = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess',
|
|
7923
|
-
const reverse = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess',
|
|
7924
|
-
const storageUpdates = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess',
|
|
7930
|
+
const ops = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess', _186 => _186[0]]), () => ( []));
|
|
7931
|
+
const reverse = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess', _187 => _187[1]]), () => ( []));
|
|
7932
|
+
const storageUpdates = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess', _188 => _188[2]]), () => ( /* @__PURE__ */ new Map()));
|
|
7925
7933
|
const existing = storageUpdates.get(this._id);
|
|
7926
7934
|
storageUpdates.set(this._id, {
|
|
7927
7935
|
node: this,
|
|
7928
7936
|
type: "LiveObject",
|
|
7929
7937
|
updates: {
|
|
7930
|
-
..._optionalChain([existing, 'optionalAccess',
|
|
7938
|
+
..._optionalChain([existing, 'optionalAccess', _189 => _189.updates]),
|
|
7931
7939
|
[key]: { type: "update" }
|
|
7932
7940
|
}
|
|
7933
7941
|
});
|
|
@@ -7947,7 +7955,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
7947
7955
|
* #synced or pool/id are unavailable. Does NOT dispatch.
|
|
7948
7956
|
*/
|
|
7949
7957
|
#prepareDelete(key) {
|
|
7950
|
-
_optionalChain([this, 'access',
|
|
7958
|
+
_optionalChain([this, 'access', _190 => _190._pool, 'optionalAccess', _191 => _191.assertStorageIsWritable, 'call', _192 => _192()]);
|
|
7951
7959
|
const k = key;
|
|
7952
7960
|
if (this.#local.has(k) && !this.#synced.has(k)) {
|
|
7953
7961
|
const oldValue2 = this.#local.get(k);
|
|
@@ -8023,7 +8031,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
8023
8031
|
const result = this.#prepareDelete(key);
|
|
8024
8032
|
if (result) {
|
|
8025
8033
|
const [ops, reverse, storageUpdates] = result;
|
|
8026
|
-
_optionalChain([this, 'access',
|
|
8034
|
+
_optionalChain([this, 'access', _193 => _193._pool, 'optionalAccess', _194 => _194.dispatch, 'call', _195 => _195(ops, reverse, storageUpdates)]);
|
|
8027
8035
|
}
|
|
8028
8036
|
}
|
|
8029
8037
|
/**
|
|
@@ -8031,7 +8039,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
8031
8039
|
* @param patch The object used to overrides properties
|
|
8032
8040
|
*/
|
|
8033
8041
|
update(patch) {
|
|
8034
|
-
_optionalChain([this, 'access',
|
|
8042
|
+
_optionalChain([this, 'access', _196 => _196._pool, 'optionalAccess', _197 => _197.assertStorageIsWritable, 'call', _198 => _198()]);
|
|
8035
8043
|
if (_LiveObject.detectLargeObjects) {
|
|
8036
8044
|
const data = {};
|
|
8037
8045
|
for (const [key, value] of this.#synced) {
|
|
@@ -8448,7 +8456,7 @@ function sendToPanel(message, options) {
|
|
|
8448
8456
|
...message,
|
|
8449
8457
|
source: "liveblocks-devtools-client"
|
|
8450
8458
|
};
|
|
8451
|
-
if (!(_optionalChain([options, 'optionalAccess',
|
|
8459
|
+
if (!(_optionalChain([options, 'optionalAccess', _199 => _199.force]) || _bridgeActive)) {
|
|
8452
8460
|
return;
|
|
8453
8461
|
}
|
|
8454
8462
|
window.postMessage(fullMsg, "*");
|
|
@@ -8456,7 +8464,7 @@ function sendToPanel(message, options) {
|
|
|
8456
8464
|
var eventSource = makeEventSource();
|
|
8457
8465
|
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
8458
8466
|
window.addEventListener("message", (event) => {
|
|
8459
|
-
if (event.source === window && _optionalChain([event, 'access',
|
|
8467
|
+
if (event.source === window && _optionalChain([event, 'access', _200 => _200.data, 'optionalAccess', _201 => _201.source]) === "liveblocks-devtools-panel") {
|
|
8460
8468
|
eventSource.notify(event.data);
|
|
8461
8469
|
} else {
|
|
8462
8470
|
}
|
|
@@ -8598,7 +8606,7 @@ function fullSync(room) {
|
|
|
8598
8606
|
msg: "room::sync::full",
|
|
8599
8607
|
roomId: room.id,
|
|
8600
8608
|
status: room.getStatus(),
|
|
8601
|
-
storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess',
|
|
8609
|
+
storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _202 => _202.toTreeNode, 'call', _203 => _203("root"), 'access', _204 => _204.payload]), () => ( null)),
|
|
8602
8610
|
me,
|
|
8603
8611
|
others
|
|
8604
8612
|
});
|
|
@@ -9277,15 +9285,15 @@ function installBackgroundTabSpy() {
|
|
|
9277
9285
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
9278
9286
|
const inBackgroundSince = { current: null };
|
|
9279
9287
|
function onVisibilityChange() {
|
|
9280
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
9288
|
+
if (_optionalChain([doc, 'optionalAccess', _205 => _205.visibilityState]) === "hidden") {
|
|
9281
9289
|
inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
|
|
9282
9290
|
} else {
|
|
9283
9291
|
inBackgroundSince.current = null;
|
|
9284
9292
|
}
|
|
9285
9293
|
}
|
|
9286
|
-
_optionalChain([doc, 'optionalAccess',
|
|
9294
|
+
_optionalChain([doc, 'optionalAccess', _206 => _206.addEventListener, 'call', _207 => _207("visibilitychange", onVisibilityChange)]);
|
|
9287
9295
|
const unsub = () => {
|
|
9288
|
-
_optionalChain([doc, 'optionalAccess',
|
|
9296
|
+
_optionalChain([doc, 'optionalAccess', _208 => _208.removeEventListener, 'call', _209 => _209("visibilitychange", onVisibilityChange)]);
|
|
9289
9297
|
};
|
|
9290
9298
|
return [inBackgroundSince, unsub];
|
|
9291
9299
|
}
|
|
@@ -9476,7 +9484,7 @@ function createRoom(options, config) {
|
|
|
9476
9484
|
}
|
|
9477
9485
|
}
|
|
9478
9486
|
function isStorageWritable() {
|
|
9479
|
-
const scopes = _optionalChain([context, 'access',
|
|
9487
|
+
const scopes = _optionalChain([context, 'access', _210 => _210.dynamicSessionInfoSig, 'access', _211 => _211.get, 'call', _212 => _212(), 'optionalAccess', _213 => _213.scopes]);
|
|
9480
9488
|
return scopes !== void 0 ? canWriteStorage(scopes) : true;
|
|
9481
9489
|
}
|
|
9482
9490
|
const eventHub = {
|
|
@@ -9580,7 +9588,7 @@ function createRoom(options, config) {
|
|
|
9580
9588
|
context.pool
|
|
9581
9589
|
);
|
|
9582
9590
|
}
|
|
9583
|
-
const canWrite = _nullishCoalesce(_optionalChain([self, 'access',
|
|
9591
|
+
const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _214 => _214.get, 'call', _215 => _215(), 'optionalAccess', _216 => _216.canWrite]), () => ( true));
|
|
9584
9592
|
const root = context.root;
|
|
9585
9593
|
disableHistory(() => {
|
|
9586
9594
|
for (const key in context.initialStorage) {
|
|
@@ -9785,7 +9793,7 @@ function createRoom(options, config) {
|
|
|
9785
9793
|
}
|
|
9786
9794
|
context.myPresence.patch(patch);
|
|
9787
9795
|
if (context.activeBatch) {
|
|
9788
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
9796
|
+
if (_optionalChain([options2, 'optionalAccess', _217 => _217.addToHistory])) {
|
|
9789
9797
|
context.activeBatch.reverseOps.pushLeft({
|
|
9790
9798
|
type: "presence",
|
|
9791
9799
|
data: oldValues
|
|
@@ -9794,7 +9802,7 @@ function createRoom(options, config) {
|
|
|
9794
9802
|
context.activeBatch.updates.presence = true;
|
|
9795
9803
|
} else {
|
|
9796
9804
|
flushNowOrSoon();
|
|
9797
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
9805
|
+
if (_optionalChain([options2, 'optionalAccess', _218 => _218.addToHistory])) {
|
|
9798
9806
|
addToUndoStack([{ type: "presence", data: oldValues }]);
|
|
9799
9807
|
}
|
|
9800
9808
|
notify({ presence: true });
|
|
@@ -9972,11 +9980,11 @@ function createRoom(options, config) {
|
|
|
9972
9980
|
break;
|
|
9973
9981
|
}
|
|
9974
9982
|
case ServerMsgCode.STORAGE_CHUNK:
|
|
9975
|
-
_optionalChain([stopwatch, 'optionalAccess',
|
|
9983
|
+
_optionalChain([stopwatch, 'optionalAccess', _219 => _219.lap, 'call', _220 => _220()]);
|
|
9976
9984
|
nodeMapBuffer.append(compactNodesToNodeStream(message.nodes));
|
|
9977
9985
|
break;
|
|
9978
9986
|
case ServerMsgCode.STORAGE_STREAM_END: {
|
|
9979
|
-
const timing = _optionalChain([stopwatch, 'optionalAccess',
|
|
9987
|
+
const timing = _optionalChain([stopwatch, 'optionalAccess', _221 => _221.stop, 'call', _222 => _222()]);
|
|
9980
9988
|
if (timing) {
|
|
9981
9989
|
const ms = (v) => `${v.toFixed(1)}ms`;
|
|
9982
9990
|
const rest = timing.laps.slice(1);
|
|
@@ -10111,11 +10119,11 @@ function createRoom(options, config) {
|
|
|
10111
10119
|
} else if (pendingFeedsRequests.has(requestId)) {
|
|
10112
10120
|
const pending = pendingFeedsRequests.get(requestId);
|
|
10113
10121
|
pendingFeedsRequests.delete(requestId);
|
|
10114
|
-
_optionalChain([pending, 'optionalAccess',
|
|
10122
|
+
_optionalChain([pending, 'optionalAccess', _223 => _223.reject, 'call', _224 => _224(err)]);
|
|
10115
10123
|
} else if (pendingFeedMessagesRequests.has(requestId)) {
|
|
10116
10124
|
const pending = pendingFeedMessagesRequests.get(requestId);
|
|
10117
10125
|
pendingFeedMessagesRequests.delete(requestId);
|
|
10118
|
-
_optionalChain([pending, 'optionalAccess',
|
|
10126
|
+
_optionalChain([pending, 'optionalAccess', _225 => _225.reject, 'call', _226 => _226(err)]);
|
|
10119
10127
|
}
|
|
10120
10128
|
eventHub.feeds.notify(message);
|
|
10121
10129
|
break;
|
|
@@ -10269,10 +10277,10 @@ function createRoom(options, config) {
|
|
|
10269
10277
|
timeoutId,
|
|
10270
10278
|
kind,
|
|
10271
10279
|
feedId,
|
|
10272
|
-
messageId: _optionalChain([options2, 'optionalAccess',
|
|
10273
|
-
expectedClientMessageId: _optionalChain([options2, 'optionalAccess',
|
|
10280
|
+
messageId: _optionalChain([options2, 'optionalAccess', _227 => _227.messageId]),
|
|
10281
|
+
expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _228 => _228.expectedClientMessageId])
|
|
10274
10282
|
});
|
|
10275
|
-
if (kind === "add-message" && _optionalChain([options2, 'optionalAccess',
|
|
10283
|
+
if (kind === "add-message" && _optionalChain([options2, 'optionalAccess', _229 => _229.expectedClientMessageId]) === void 0) {
|
|
10276
10284
|
const q = _nullishCoalesce(pendingAddMessageFifoByFeed.get(feedId), () => ( []));
|
|
10277
10285
|
q.push(requestId);
|
|
10278
10286
|
pendingAddMessageFifoByFeed.set(feedId, q);
|
|
@@ -10323,10 +10331,10 @@ function createRoom(options, config) {
|
|
|
10323
10331
|
}
|
|
10324
10332
|
if (!matched) {
|
|
10325
10333
|
const q = pendingAddMessageFifoByFeed.get(message.feedId);
|
|
10326
|
-
const headId = _optionalChain([q, 'optionalAccess',
|
|
10334
|
+
const headId = _optionalChain([q, 'optionalAccess', _230 => _230[0]]);
|
|
10327
10335
|
if (headId !== void 0) {
|
|
10328
10336
|
const pending = pendingFeedMutations.get(headId);
|
|
10329
|
-
if (_optionalChain([pending, 'optionalAccess',
|
|
10337
|
+
if (_optionalChain([pending, 'optionalAccess', _231 => _231.kind]) === "add-message" && pending.expectedClientMessageId === void 0) {
|
|
10330
10338
|
settleFeedMutation(headId, "ok");
|
|
10331
10339
|
}
|
|
10332
10340
|
}
|
|
@@ -10362,7 +10370,7 @@ function createRoom(options, config) {
|
|
|
10362
10370
|
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
10363
10371
|
createOrUpdateRootFromMessage(nodes);
|
|
10364
10372
|
applyAndSendOfflineOps(unacknowledgedOps);
|
|
10365
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall',
|
|
10373
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _232 => _232()]);
|
|
10366
10374
|
notifyStorageStatus();
|
|
10367
10375
|
eventHub.storageDidLoad.notify();
|
|
10368
10376
|
}
|
|
@@ -10380,7 +10388,7 @@ function createRoom(options, config) {
|
|
|
10380
10388
|
} else if (!messages.some((msg) => msg.type === ClientMsgCode.FETCH_STORAGE)) {
|
|
10381
10389
|
messages.push({ type: ClientMsgCode.FETCH_STORAGE });
|
|
10382
10390
|
nodeMapBuffer.take();
|
|
10383
|
-
_optionalChain([stopwatch, 'optionalAccess',
|
|
10391
|
+
_optionalChain([stopwatch, 'optionalAccess', _233 => _233.start, 'call', _234 => _234()]);
|
|
10384
10392
|
}
|
|
10385
10393
|
if (options2.flush) {
|
|
10386
10394
|
flushNowOrSoon();
|
|
@@ -10436,10 +10444,10 @@ function createRoom(options, config) {
|
|
|
10436
10444
|
const message = {
|
|
10437
10445
|
type: ClientMsgCode.FETCH_FEEDS,
|
|
10438
10446
|
requestId,
|
|
10439
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
10440
|
-
since: _optionalChain([options2, 'optionalAccess',
|
|
10441
|
-
limit: _optionalChain([options2, 'optionalAccess',
|
|
10442
|
-
metadata: _optionalChain([options2, 'optionalAccess',
|
|
10447
|
+
cursor: _optionalChain([options2, 'optionalAccess', _235 => _235.cursor]),
|
|
10448
|
+
since: _optionalChain([options2, 'optionalAccess', _236 => _236.since]),
|
|
10449
|
+
limit: _optionalChain([options2, 'optionalAccess', _237 => _237.limit]),
|
|
10450
|
+
metadata: _optionalChain([options2, 'optionalAccess', _238 => _238.metadata])
|
|
10443
10451
|
};
|
|
10444
10452
|
context.buffer.messages.push(message);
|
|
10445
10453
|
flushNowOrSoon();
|
|
@@ -10459,9 +10467,9 @@ function createRoom(options, config) {
|
|
|
10459
10467
|
type: ClientMsgCode.FETCH_FEED_MESSAGES,
|
|
10460
10468
|
requestId,
|
|
10461
10469
|
feedId,
|
|
10462
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
10463
|
-
since: _optionalChain([options2, 'optionalAccess',
|
|
10464
|
-
limit: _optionalChain([options2, 'optionalAccess',
|
|
10470
|
+
cursor: _optionalChain([options2, 'optionalAccess', _239 => _239.cursor]),
|
|
10471
|
+
since: _optionalChain([options2, 'optionalAccess', _240 => _240.since]),
|
|
10472
|
+
limit: _optionalChain([options2, 'optionalAccess', _241 => _241.limit])
|
|
10465
10473
|
};
|
|
10466
10474
|
context.buffer.messages.push(message);
|
|
10467
10475
|
flushNowOrSoon();
|
|
@@ -10480,8 +10488,8 @@ function createRoom(options, config) {
|
|
|
10480
10488
|
type: ClientMsgCode.ADD_FEED,
|
|
10481
10489
|
requestId,
|
|
10482
10490
|
feedId,
|
|
10483
|
-
metadata: _optionalChain([options2, 'optionalAccess',
|
|
10484
|
-
createdAt: _optionalChain([options2, 'optionalAccess',
|
|
10491
|
+
metadata: _optionalChain([options2, 'optionalAccess', _242 => _242.metadata]),
|
|
10492
|
+
createdAt: _optionalChain([options2, 'optionalAccess', _243 => _243.createdAt])
|
|
10485
10493
|
};
|
|
10486
10494
|
context.buffer.messages.push(message);
|
|
10487
10495
|
flushNowOrSoon();
|
|
@@ -10515,15 +10523,15 @@ function createRoom(options, config) {
|
|
|
10515
10523
|
function addFeedMessage(feedId, data, options2) {
|
|
10516
10524
|
const requestId = nanoid();
|
|
10517
10525
|
const promise = registerFeedMutation(requestId, "add-message", feedId, {
|
|
10518
|
-
expectedClientMessageId: _optionalChain([options2, 'optionalAccess',
|
|
10526
|
+
expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _244 => _244.id])
|
|
10519
10527
|
});
|
|
10520
10528
|
const message = {
|
|
10521
10529
|
type: ClientMsgCode.ADD_FEED_MESSAGE,
|
|
10522
10530
|
requestId,
|
|
10523
10531
|
feedId,
|
|
10524
10532
|
data,
|
|
10525
|
-
id: _optionalChain([options2, 'optionalAccess',
|
|
10526
|
-
createdAt: _optionalChain([options2, 'optionalAccess',
|
|
10533
|
+
id: _optionalChain([options2, 'optionalAccess', _245 => _245.id]),
|
|
10534
|
+
createdAt: _optionalChain([options2, 'optionalAccess', _246 => _246.createdAt])
|
|
10527
10535
|
};
|
|
10528
10536
|
context.buffer.messages.push(message);
|
|
10529
10537
|
flushNowOrSoon();
|
|
@@ -10540,7 +10548,7 @@ function createRoom(options, config) {
|
|
|
10540
10548
|
feedId,
|
|
10541
10549
|
messageId,
|
|
10542
10550
|
data,
|
|
10543
|
-
updatedAt: _optionalChain([options2, 'optionalAccess',
|
|
10551
|
+
updatedAt: _optionalChain([options2, 'optionalAccess', _247 => _247.updatedAt])
|
|
10544
10552
|
};
|
|
10545
10553
|
context.buffer.messages.push(message);
|
|
10546
10554
|
flushNowOrSoon();
|
|
@@ -10747,8 +10755,8 @@ function createRoom(options, config) {
|
|
|
10747
10755
|
async function getThreads(options2) {
|
|
10748
10756
|
return httpClient.getThreads({
|
|
10749
10757
|
roomId,
|
|
10750
|
-
query: _optionalChain([options2, 'optionalAccess',
|
|
10751
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
10758
|
+
query: _optionalChain([options2, 'optionalAccess', _248 => _248.query]),
|
|
10759
|
+
cursor: _optionalChain([options2, 'optionalAccess', _249 => _249.cursor])
|
|
10752
10760
|
});
|
|
10753
10761
|
}
|
|
10754
10762
|
async function getThread(threadId) {
|
|
@@ -10870,7 +10878,7 @@ function createRoom(options, config) {
|
|
|
10870
10878
|
function getSubscriptionSettings(options2) {
|
|
10871
10879
|
return httpClient.getSubscriptionSettings({
|
|
10872
10880
|
roomId,
|
|
10873
|
-
signal: _optionalChain([options2, 'optionalAccess',
|
|
10881
|
+
signal: _optionalChain([options2, 'optionalAccess', _250 => _250.signal])
|
|
10874
10882
|
});
|
|
10875
10883
|
}
|
|
10876
10884
|
function updateSubscriptionSettings(settings) {
|
|
@@ -10892,7 +10900,7 @@ function createRoom(options, config) {
|
|
|
10892
10900
|
{
|
|
10893
10901
|
[kInternal]: {
|
|
10894
10902
|
get presenceBuffer() {
|
|
10895
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
10903
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _251 => _251.buffer, 'access', _252 => _252.presenceUpdates, 'optionalAccess', _253 => _253.data]), () => ( null)));
|
|
10896
10904
|
},
|
|
10897
10905
|
// prettier-ignore
|
|
10898
10906
|
get undoStack() {
|
|
@@ -10907,9 +10915,9 @@ function createRoom(options, config) {
|
|
|
10907
10915
|
return context.yjsProvider;
|
|
10908
10916
|
},
|
|
10909
10917
|
setYjsProvider(newProvider) {
|
|
10910
|
-
_optionalChain([context, 'access',
|
|
10918
|
+
_optionalChain([context, 'access', _254 => _254.yjsProvider, 'optionalAccess', _255 => _255.off, 'call', _256 => _256("status", yjsStatusDidChange)]);
|
|
10911
10919
|
context.yjsProvider = newProvider;
|
|
10912
|
-
_optionalChain([newProvider, 'optionalAccess',
|
|
10920
|
+
_optionalChain([newProvider, 'optionalAccess', _257 => _257.on, 'call', _258 => _258("status", yjsStatusDidChange)]);
|
|
10913
10921
|
context.yjsProviderDidChange.notify();
|
|
10914
10922
|
},
|
|
10915
10923
|
yjsProviderDidChange: context.yjsProviderDidChange.observable,
|
|
@@ -10962,7 +10970,7 @@ function createRoom(options, config) {
|
|
|
10962
10970
|
source.dispose();
|
|
10963
10971
|
}
|
|
10964
10972
|
eventHub.roomWillDestroy.notify();
|
|
10965
|
-
_optionalChain([context, 'access',
|
|
10973
|
+
_optionalChain([context, 'access', _259 => _259.yjsProvider, 'optionalAccess', _260 => _260.off, 'call', _261 => _261("status", yjsStatusDidChange)]);
|
|
10966
10974
|
syncSourceForStorage.destroy();
|
|
10967
10975
|
syncSourceForYjs.destroy();
|
|
10968
10976
|
uninstallBgTabSpy();
|
|
@@ -11122,7 +11130,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
|
|
|
11122
11130
|
}
|
|
11123
11131
|
if (isLiveNode(first)) {
|
|
11124
11132
|
const node = first;
|
|
11125
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
11133
|
+
if (_optionalChain([options, 'optionalAccess', _262 => _262.isDeep])) {
|
|
11126
11134
|
const storageCallback = second;
|
|
11127
11135
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
11128
11136
|
} else {
|
|
@@ -11208,8 +11216,8 @@ function createClient(options) {
|
|
|
11208
11216
|
const authManager = createAuthManager(options, (token) => {
|
|
11209
11217
|
currentUserId.set(() => token.uid);
|
|
11210
11218
|
});
|
|
11211
|
-
const fetchPolyfill = _optionalChain([clientOptions, 'access',
|
|
11212
|
-
_optionalChain([globalThis, 'access',
|
|
11219
|
+
const fetchPolyfill = _optionalChain([clientOptions, 'access', _263 => _263.polyfills, 'optionalAccess', _264 => _264.fetch]) || /* istanbul ignore next */
|
|
11220
|
+
_optionalChain([globalThis, 'access', _265 => _265.fetch, 'optionalAccess', _266 => _266.bind, 'call', _267 => _267(globalThis)]);
|
|
11213
11221
|
const httpClient = createApiClient({
|
|
11214
11222
|
baseUrl,
|
|
11215
11223
|
fetchPolyfill,
|
|
@@ -11227,7 +11235,7 @@ function createClient(options) {
|
|
|
11227
11235
|
delegates: {
|
|
11228
11236
|
createSocket: makeCreateSocketDelegateForAi(
|
|
11229
11237
|
baseUrl,
|
|
11230
|
-
_optionalChain([clientOptions, 'access',
|
|
11238
|
+
_optionalChain([clientOptions, 'access', _268 => _268.polyfills, 'optionalAccess', _269 => _269.WebSocket])
|
|
11231
11239
|
),
|
|
11232
11240
|
authenticate: async () => {
|
|
11233
11241
|
const resp = await authManager.getAuthValue({
|
|
@@ -11297,7 +11305,7 @@ function createClient(options) {
|
|
|
11297
11305
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
11298
11306
|
roomId,
|
|
11299
11307
|
baseUrl,
|
|
11300
|
-
_optionalChain([clientOptions, 'access',
|
|
11308
|
+
_optionalChain([clientOptions, 'access', _270 => _270.polyfills, 'optionalAccess', _271 => _271.WebSocket])
|
|
11301
11309
|
),
|
|
11302
11310
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
11303
11311
|
})),
|
|
@@ -11320,7 +11328,7 @@ function createClient(options) {
|
|
|
11320
11328
|
const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
|
|
11321
11329
|
if (shouldConnect) {
|
|
11322
11330
|
if (typeof atob === "undefined") {
|
|
11323
|
-
if (_optionalChain([clientOptions, 'access',
|
|
11331
|
+
if (_optionalChain([clientOptions, 'access', _272 => _272.polyfills, 'optionalAccess', _273 => _273.atob]) === void 0) {
|
|
11324
11332
|
throw new Error(
|
|
11325
11333
|
"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"
|
|
11326
11334
|
);
|
|
@@ -11332,7 +11340,7 @@ function createClient(options) {
|
|
|
11332
11340
|
return leaseRoom(newRoomDetails);
|
|
11333
11341
|
}
|
|
11334
11342
|
function getRoom(roomId) {
|
|
11335
|
-
const room = _optionalChain([roomsById, 'access',
|
|
11343
|
+
const room = _optionalChain([roomsById, 'access', _274 => _274.get, 'call', _275 => _275(roomId), 'optionalAccess', _276 => _276.room]);
|
|
11336
11344
|
return room ? room : null;
|
|
11337
11345
|
}
|
|
11338
11346
|
function logout() {
|
|
@@ -11348,7 +11356,7 @@ function createClient(options) {
|
|
|
11348
11356
|
const batchedResolveUsers = new Batch(
|
|
11349
11357
|
async (batchedUserIds) => {
|
|
11350
11358
|
const userIds = batchedUserIds.flat();
|
|
11351
|
-
const users = await _optionalChain([resolveUsers, 'optionalCall',
|
|
11359
|
+
const users = await _optionalChain([resolveUsers, 'optionalCall', _277 => _277({ userIds })]);
|
|
11352
11360
|
warnOnceIf(
|
|
11353
11361
|
!resolveUsers,
|
|
11354
11362
|
"Set the resolveUsers option in createClient to specify user info."
|
|
@@ -11365,7 +11373,7 @@ function createClient(options) {
|
|
|
11365
11373
|
const batchedResolveRoomsInfo = new Batch(
|
|
11366
11374
|
async (batchedRoomIds) => {
|
|
11367
11375
|
const roomIds = batchedRoomIds.flat();
|
|
11368
|
-
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall',
|
|
11376
|
+
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _278 => _278({ roomIds })]);
|
|
11369
11377
|
warnOnceIf(
|
|
11370
11378
|
!resolveRoomsInfo,
|
|
11371
11379
|
"Set the resolveRoomsInfo option in createClient to specify room info."
|
|
@@ -11382,7 +11390,7 @@ function createClient(options) {
|
|
|
11382
11390
|
const batchedResolveGroupsInfo = new Batch(
|
|
11383
11391
|
async (batchedGroupIds) => {
|
|
11384
11392
|
const groupIds = batchedGroupIds.flat();
|
|
11385
|
-
const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall',
|
|
11393
|
+
const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _279 => _279({ groupIds })]);
|
|
11386
11394
|
warnOnceIf(
|
|
11387
11395
|
!resolveGroupsInfo,
|
|
11388
11396
|
"Set the resolveGroupsInfo option in createClient to specify group info."
|
|
@@ -11441,7 +11449,7 @@ function createClient(options) {
|
|
|
11441
11449
|
}
|
|
11442
11450
|
};
|
|
11443
11451
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
11444
|
-
_optionalChain([win, 'optionalAccess',
|
|
11452
|
+
_optionalChain([win, 'optionalAccess', _280 => _280.addEventListener, 'call', _281 => _281("beforeunload", maybePreventClose)]);
|
|
11445
11453
|
}
|
|
11446
11454
|
async function getNotificationSettings(options2) {
|
|
11447
11455
|
const plainSettings = await httpClient.getNotificationSettings(options2);
|
|
@@ -11568,7 +11576,7 @@ var commentBodyElementsTypes = {
|
|
|
11568
11576
|
mention: "inline"
|
|
11569
11577
|
};
|
|
11570
11578
|
function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
11571
|
-
if (!body || !_optionalChain([body, 'optionalAccess',
|
|
11579
|
+
if (!body || !_optionalChain([body, 'optionalAccess', _282 => _282.content])) {
|
|
11572
11580
|
return;
|
|
11573
11581
|
}
|
|
11574
11582
|
const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
|
|
@@ -11578,13 +11586,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
|
11578
11586
|
for (const block of body.content) {
|
|
11579
11587
|
if (type === "all" || type === "block") {
|
|
11580
11588
|
if (guard(block)) {
|
|
11581
|
-
_optionalChain([visitor, 'optionalCall',
|
|
11589
|
+
_optionalChain([visitor, 'optionalCall', _283 => _283(block)]);
|
|
11582
11590
|
}
|
|
11583
11591
|
}
|
|
11584
11592
|
if (type === "all" || type === "inline") {
|
|
11585
11593
|
for (const inline of block.children) {
|
|
11586
11594
|
if (guard(inline)) {
|
|
11587
|
-
_optionalChain([visitor, 'optionalCall',
|
|
11595
|
+
_optionalChain([visitor, 'optionalCall', _284 => _284(inline)]);
|
|
11588
11596
|
}
|
|
11589
11597
|
}
|
|
11590
11598
|
}
|
|
@@ -11754,7 +11762,7 @@ var stringifyCommentBodyPlainElements = {
|
|
|
11754
11762
|
text: ({ element }) => element.text,
|
|
11755
11763
|
link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
|
|
11756
11764
|
mention: ({ element, user, group }) => {
|
|
11757
|
-
return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
11765
|
+
return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _285 => _285.name]), () => ( _optionalChain([group, 'optionalAccess', _286 => _286.name]))), () => ( element.id))}`;
|
|
11758
11766
|
}
|
|
11759
11767
|
};
|
|
11760
11768
|
var stringifyCommentBodyHtmlElements = {
|
|
@@ -11784,7 +11792,7 @@ var stringifyCommentBodyHtmlElements = {
|
|
|
11784
11792
|
return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
|
|
11785
11793
|
},
|
|
11786
11794
|
mention: ({ element, user, group }) => {
|
|
11787
|
-
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess',
|
|
11795
|
+
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _287 => _287.name]) ? html`${_optionalChain([user, 'optionalAccess', _288 => _288.name])}` : _optionalChain([group, 'optionalAccess', _289 => _289.name]) ? html`${_optionalChain([group, 'optionalAccess', _290 => _290.name])}` : element.id}</span>`;
|
|
11788
11796
|
}
|
|
11789
11797
|
};
|
|
11790
11798
|
var stringifyCommentBodyMarkdownElements = {
|
|
@@ -11814,20 +11822,20 @@ var stringifyCommentBodyMarkdownElements = {
|
|
|
11814
11822
|
return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
|
|
11815
11823
|
},
|
|
11816
11824
|
mention: ({ element, user, group }) => {
|
|
11817
|
-
return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
11825
|
+
return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _291 => _291.name]), () => ( _optionalChain([group, 'optionalAccess', _292 => _292.name]))), () => ( element.id))}`;
|
|
11818
11826
|
}
|
|
11819
11827
|
};
|
|
11820
11828
|
async function stringifyCommentBody(body, options) {
|
|
11821
|
-
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
11822
|
-
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
11829
|
+
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _293 => _293.format]), () => ( "plain"));
|
|
11830
|
+
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _294 => _294.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
|
|
11823
11831
|
const elements = {
|
|
11824
11832
|
...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
|
|
11825
|
-
..._optionalChain([options, 'optionalAccess',
|
|
11833
|
+
..._optionalChain([options, 'optionalAccess', _295 => _295.elements])
|
|
11826
11834
|
};
|
|
11827
11835
|
const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInCommentBody(
|
|
11828
11836
|
body,
|
|
11829
|
-
_optionalChain([options, 'optionalAccess',
|
|
11830
|
-
_optionalChain([options, 'optionalAccess',
|
|
11837
|
+
_optionalChain([options, 'optionalAccess', _296 => _296.resolveUsers]),
|
|
11838
|
+
_optionalChain([options, 'optionalAccess', _297 => _297.resolveGroupsInfo])
|
|
11831
11839
|
);
|
|
11832
11840
|
const blocks = body.content.flatMap((block, blockIndex) => {
|
|
11833
11841
|
switch (block.type) {
|
|
@@ -11962,9 +11970,9 @@ function makePoller(callback, intervalMs, options) {
|
|
|
11962
11970
|
const startTime = performance.now();
|
|
11963
11971
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
11964
11972
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
11965
|
-
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
11973
|
+
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _298 => _298.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
|
|
11966
11974
|
const context = {
|
|
11967
|
-
inForeground: _optionalChain([doc, 'optionalAccess',
|
|
11975
|
+
inForeground: _optionalChain([doc, 'optionalAccess', _299 => _299.visibilityState]) !== "hidden",
|
|
11968
11976
|
lastSuccessfulPollAt: startTime,
|
|
11969
11977
|
count: 0,
|
|
11970
11978
|
backoff: 0
|
|
@@ -12045,11 +12053,11 @@ function makePoller(callback, intervalMs, options) {
|
|
|
12045
12053
|
pollNowIfStale();
|
|
12046
12054
|
}
|
|
12047
12055
|
function onVisibilityChange() {
|
|
12048
|
-
setInForeground(_optionalChain([doc, 'optionalAccess',
|
|
12056
|
+
setInForeground(_optionalChain([doc, 'optionalAccess', _300 => _300.visibilityState]) !== "hidden");
|
|
12049
12057
|
}
|
|
12050
|
-
_optionalChain([doc, 'optionalAccess',
|
|
12051
|
-
_optionalChain([win, 'optionalAccess',
|
|
12052
|
-
_optionalChain([win, 'optionalAccess',
|
|
12058
|
+
_optionalChain([doc, 'optionalAccess', _301 => _301.addEventListener, 'call', _302 => _302("visibilitychange", onVisibilityChange)]);
|
|
12059
|
+
_optionalChain([win, 'optionalAccess', _303 => _303.addEventListener, 'call', _304 => _304("online", onVisibilityChange)]);
|
|
12060
|
+
_optionalChain([win, 'optionalAccess', _305 => _305.addEventListener, 'call', _306 => _306("focus", pollNowIfStale)]);
|
|
12053
12061
|
fsm.start();
|
|
12054
12062
|
return {
|
|
12055
12063
|
inc,
|