@liveblocks/core 3.17.0 → 3.18.0-rc1
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 +1250 -1576
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +197 -203
- package/dist/index.d.ts +197 -203
- package/dist/index.js +1147 -1473
- 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.18.0-rc1";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -5463,639 +5463,268 @@ async function fetchAuthEndpoint(fetch, endpoint, body) {
|
|
|
5463
5463
|
var DEFAULT_BASE_URL = "https://api.liveblocks.io";
|
|
5464
5464
|
var MENTION_CHARACTER = "@";
|
|
5465
5465
|
|
|
5466
|
-
// src/
|
|
5467
|
-
var
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
return;
|
|
5481
|
-
}
|
|
5482
|
-
window.postMessage(fullMsg, "*");
|
|
5483
|
-
}
|
|
5484
|
-
var eventSource = makeEventSource();
|
|
5485
|
-
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
5486
|
-
window.addEventListener("message", (event) => {
|
|
5487
|
-
if (event.source === window && _optionalChain([event, 'access', _112 => _112.data, 'optionalAccess', _113 => _113.source]) === "liveblocks-devtools-panel") {
|
|
5488
|
-
eventSource.notify(event.data);
|
|
5489
|
-
} else {
|
|
5490
|
-
}
|
|
5491
|
-
});
|
|
5466
|
+
// src/protocol/Op.ts
|
|
5467
|
+
var OpCode = Object.freeze({
|
|
5468
|
+
INIT: 0,
|
|
5469
|
+
SET_PARENT_KEY: 1,
|
|
5470
|
+
CREATE_LIST: 2,
|
|
5471
|
+
UPDATE_OBJECT: 3,
|
|
5472
|
+
CREATE_OBJECT: 4,
|
|
5473
|
+
DELETE_CRDT: 5,
|
|
5474
|
+
DELETE_OBJECT_KEY: 6,
|
|
5475
|
+
CREATE_MAP: 7,
|
|
5476
|
+
CREATE_REGISTER: 8
|
|
5477
|
+
});
|
|
5478
|
+
function isIgnoredOp(op) {
|
|
5479
|
+
return op.type === OpCode.DELETE_CRDT && op.id === "ACK";
|
|
5492
5480
|
}
|
|
5493
|
-
var onMessageFromPanel = eventSource.observable;
|
|
5494
5481
|
|
|
5495
|
-
// src/
|
|
5496
|
-
var
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
}
|
|
5505
|
-
_devtoolsSetupHasRun = true;
|
|
5506
|
-
onMessageFromPanel.subscribe((msg) => {
|
|
5507
|
-
switch (msg.msg) {
|
|
5508
|
-
// When a devtool panel sends an explicit "connect" message back to this
|
|
5509
|
-
// live running client (in response to the "wake-up-devtools" message,
|
|
5510
|
-
// or when the devtool panel is opened for the first time), it means that it's okay to
|
|
5511
|
-
// start emitting messages.
|
|
5512
|
-
// Before this explicit acknowledgement, any call to sendToPanel() will
|
|
5513
|
-
// be a no-op.
|
|
5514
|
-
case "connect": {
|
|
5515
|
-
activateBridge(true);
|
|
5516
|
-
for (const roomId of getAllRooms()) {
|
|
5517
|
-
sendToPanel({
|
|
5518
|
-
msg: "room::available",
|
|
5519
|
-
roomId,
|
|
5520
|
-
clientVersion: VERSION
|
|
5521
|
-
});
|
|
5522
|
-
}
|
|
5523
|
-
break;
|
|
5524
|
-
}
|
|
5525
|
-
}
|
|
5526
|
-
});
|
|
5527
|
-
sendToPanel({ msg: "wake-up-devtools" }, { force: true });
|
|
5528
|
-
}
|
|
5529
|
-
var unsubsByRoomId = /* @__PURE__ */ new Map();
|
|
5530
|
-
function stopSyncStream(roomId) {
|
|
5531
|
-
const unsubs = _nullishCoalesce(unsubsByRoomId.get(roomId), () => ( []));
|
|
5532
|
-
unsubsByRoomId.delete(roomId);
|
|
5533
|
-
for (const unsub of unsubs) {
|
|
5534
|
-
unsub();
|
|
5535
|
-
}
|
|
5482
|
+
// src/protocol/StorageNode.ts
|
|
5483
|
+
var CrdtType = Object.freeze({
|
|
5484
|
+
OBJECT: 0,
|
|
5485
|
+
LIST: 1,
|
|
5486
|
+
MAP: 2,
|
|
5487
|
+
REGISTER: 3
|
|
5488
|
+
});
|
|
5489
|
+
function isRootStorageNode(node) {
|
|
5490
|
+
return node[0] === "root";
|
|
5536
5491
|
}
|
|
5537
|
-
function
|
|
5538
|
-
|
|
5539
|
-
fullSync(room);
|
|
5540
|
-
unsubsByRoomId.set(room.id, [
|
|
5541
|
-
// When the connection status changes
|
|
5542
|
-
room.events.status.subscribe(() => partialSyncConnection(room)),
|
|
5543
|
-
// When storage initializes, send the update
|
|
5544
|
-
room.events.storageDidLoad.subscribeOnce(() => partialSyncStorage(room)),
|
|
5545
|
-
// Any time storage updates, send the new storage root
|
|
5546
|
-
room.events.storageBatch.subscribe(() => partialSyncStorage(room)),
|
|
5547
|
-
// Any time "me" or "others" updates, send the new values accordingly
|
|
5548
|
-
room.events.self.subscribe(() => partialSyncMe(room)),
|
|
5549
|
-
room.events.others.subscribe(() => partialSyncOthers(room)),
|
|
5550
|
-
// Any time ydoc is updated, forward the update
|
|
5551
|
-
room.events.ydoc.subscribe((update) => syncYdocUpdate(room, update)),
|
|
5552
|
-
// Any time a custom room event is received, forward it
|
|
5553
|
-
room.events.customEvent.subscribe(
|
|
5554
|
-
(eventData) => forwardEvent(room, eventData)
|
|
5555
|
-
)
|
|
5556
|
-
]);
|
|
5492
|
+
function isObjectStorageNode(node) {
|
|
5493
|
+
return node[1].type === CrdtType.OBJECT;
|
|
5557
5494
|
}
|
|
5558
|
-
function
|
|
5559
|
-
|
|
5560
|
-
msg: "room::sync::ydoc",
|
|
5561
|
-
roomId: room.id,
|
|
5562
|
-
update
|
|
5563
|
-
});
|
|
5495
|
+
function isListStorageNode(node) {
|
|
5496
|
+
return node[1].type === CrdtType.LIST;
|
|
5564
5497
|
}
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
function nextEventId() {
|
|
5568
|
-
return `event-${loadedAt}-${eventCounter++}`;
|
|
5498
|
+
function isMapStorageNode(node) {
|
|
5499
|
+
return node[1].type === CrdtType.MAP;
|
|
5569
5500
|
}
|
|
5570
|
-
function
|
|
5571
|
-
|
|
5572
|
-
msg: "room::events::custom-event",
|
|
5573
|
-
roomId: room.id,
|
|
5574
|
-
event: {
|
|
5575
|
-
type: "CustomEvent",
|
|
5576
|
-
id: nextEventId(),
|
|
5577
|
-
key: "Event",
|
|
5578
|
-
connectionId: eventData.connectionId,
|
|
5579
|
-
payload: eventData.event
|
|
5580
|
-
}
|
|
5581
|
-
});
|
|
5501
|
+
function isRegisterStorageNode(node) {
|
|
5502
|
+
return node[1].type === CrdtType.REGISTER;
|
|
5582
5503
|
}
|
|
5583
|
-
function
|
|
5584
|
-
|
|
5585
|
-
msg: "room::sync::partial",
|
|
5586
|
-
roomId: room.id,
|
|
5587
|
-
status: room.getStatus()
|
|
5588
|
-
});
|
|
5504
|
+
function isCompactRootNode(node) {
|
|
5505
|
+
return node[0] === "root";
|
|
5589
5506
|
}
|
|
5590
|
-
function
|
|
5591
|
-
const
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5507
|
+
function* compactNodesToNodeStream(compactNodes) {
|
|
5508
|
+
for (const cnode of compactNodes) {
|
|
5509
|
+
if (isCompactRootNode(cnode)) {
|
|
5510
|
+
yield [cnode[0], { type: CrdtType.OBJECT, data: cnode[1] }];
|
|
5511
|
+
continue;
|
|
5512
|
+
}
|
|
5513
|
+
switch (cnode[1]) {
|
|
5514
|
+
case CrdtType.OBJECT:
|
|
5515
|
+
yield [cnode[0], { type: CrdtType.OBJECT, parentId: cnode[2], parentKey: cnode[3], data: cnode[4] }];
|
|
5516
|
+
break;
|
|
5517
|
+
case CrdtType.LIST:
|
|
5518
|
+
yield [cnode[0], { type: CrdtType.LIST, parentId: cnode[2], parentKey: cnode[3] }];
|
|
5519
|
+
break;
|
|
5520
|
+
case CrdtType.MAP:
|
|
5521
|
+
yield [cnode[0], { type: CrdtType.MAP, parentId: cnode[2], parentKey: cnode[3] }];
|
|
5522
|
+
break;
|
|
5523
|
+
case CrdtType.REGISTER:
|
|
5524
|
+
yield [cnode[0], { type: CrdtType.REGISTER, parentId: cnode[2], parentKey: cnode[3], data: cnode[4] }];
|
|
5525
|
+
break;
|
|
5526
|
+
default:
|
|
5527
|
+
}
|
|
5598
5528
|
}
|
|
5599
5529
|
}
|
|
5600
|
-
function
|
|
5601
|
-
const
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5530
|
+
function* nodeStreamToCompactNodes(nodes) {
|
|
5531
|
+
for (const node of nodes) {
|
|
5532
|
+
if (isObjectStorageNode(node)) {
|
|
5533
|
+
if (isRootStorageNode(node)) {
|
|
5534
|
+
const id = node[0];
|
|
5535
|
+
const crdt = node[1];
|
|
5536
|
+
yield [id, crdt.data];
|
|
5537
|
+
} else {
|
|
5538
|
+
const id = node[0];
|
|
5539
|
+
const crdt = node[1];
|
|
5540
|
+
yield [id, CrdtType.OBJECT, crdt.parentId, crdt.parentKey, crdt.data];
|
|
5541
|
+
}
|
|
5542
|
+
} else if (isListStorageNode(node)) {
|
|
5543
|
+
const id = node[0];
|
|
5544
|
+
const crdt = node[1];
|
|
5545
|
+
yield [id, CrdtType.LIST, crdt.parentId, crdt.parentKey];
|
|
5546
|
+
} else if (isMapStorageNode(node)) {
|
|
5547
|
+
const id = node[0];
|
|
5548
|
+
const crdt = node[1];
|
|
5549
|
+
yield [id, CrdtType.MAP, crdt.parentId, crdt.parentKey];
|
|
5550
|
+
} else if (isRegisterStorageNode(node)) {
|
|
5551
|
+
const id = node[0];
|
|
5552
|
+
const crdt = node[1];
|
|
5553
|
+
yield [id, CrdtType.REGISTER, crdt.parentId, crdt.parentKey, crdt.data];
|
|
5554
|
+
} else {
|
|
5555
|
+
}
|
|
5608
5556
|
}
|
|
5609
5557
|
}
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5558
|
+
|
|
5559
|
+
// src/lib/position.ts
|
|
5560
|
+
var MIN_CODE = 32;
|
|
5561
|
+
var MAX_CODE = 126;
|
|
5562
|
+
var NUM_DIGITS = MAX_CODE - MIN_CODE + 1;
|
|
5563
|
+
var ZERO = nthDigit(0);
|
|
5564
|
+
var ONE = nthDigit(1);
|
|
5565
|
+
var ZERO_NINE = ZERO + nthDigit(-1);
|
|
5566
|
+
function nthDigit(n) {
|
|
5567
|
+
const code = MIN_CODE + (n < 0 ? NUM_DIGITS + n : n);
|
|
5568
|
+
if (code < MIN_CODE || code > MAX_CODE) {
|
|
5569
|
+
throw new Error(`Invalid n value: ${n}`);
|
|
5618
5570
|
}
|
|
5571
|
+
return String.fromCharCode(code);
|
|
5619
5572
|
}
|
|
5620
|
-
function
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
me,
|
|
5631
|
-
others
|
|
5632
|
-
});
|
|
5573
|
+
function makePosition(x, y) {
|
|
5574
|
+
if (x !== void 0 && y !== void 0) {
|
|
5575
|
+
return between(x, y);
|
|
5576
|
+
} else if (x !== void 0) {
|
|
5577
|
+
return after(x);
|
|
5578
|
+
} else if (y !== void 0) {
|
|
5579
|
+
return before(y);
|
|
5580
|
+
} else {
|
|
5581
|
+
return ONE;
|
|
5582
|
+
}
|
|
5633
5583
|
}
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5584
|
+
function before(pos) {
|
|
5585
|
+
const lastIndex = pos.length - 1;
|
|
5586
|
+
for (let i = 0; i <= lastIndex; i++) {
|
|
5587
|
+
const code = pos.charCodeAt(i);
|
|
5588
|
+
if (code <= MIN_CODE) {
|
|
5589
|
+
continue;
|
|
5590
|
+
}
|
|
5591
|
+
if (i === lastIndex) {
|
|
5592
|
+
if (code === MIN_CODE + 1) {
|
|
5593
|
+
return pos.substring(0, i) + ZERO_NINE;
|
|
5594
|
+
} else {
|
|
5595
|
+
return pos.substring(0, i) + String.fromCharCode(code - 1);
|
|
5596
|
+
}
|
|
5597
|
+
} else {
|
|
5598
|
+
return pos.substring(0, i + 1);
|
|
5599
|
+
}
|
|
5640
5600
|
}
|
|
5601
|
+
return ONE;
|
|
5641
5602
|
}
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5603
|
+
var VIEWPORT_START = 2;
|
|
5604
|
+
var VIEWPORT_STEP = 3;
|
|
5605
|
+
function after(pos) {
|
|
5606
|
+
for (let i = 0; i < pos.length; i++) {
|
|
5607
|
+
const code = pos.charCodeAt(i);
|
|
5608
|
+
if (code < MIN_CODE || code > MAX_CODE) {
|
|
5609
|
+
return pos + ONE;
|
|
5610
|
+
}
|
|
5645
5611
|
}
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
roomChannelListeners.set(
|
|
5649
|
-
roomId,
|
|
5650
|
-
// Returns the unsubscribe callback, that we store in the
|
|
5651
|
-
// roomChannelListeners registry
|
|
5652
|
-
onMessageFromPanel.subscribe((msg) => {
|
|
5653
|
-
switch (msg.msg) {
|
|
5654
|
-
// Sent by the devtool panel when it wants to receive the sync stream
|
|
5655
|
-
// for a room
|
|
5656
|
-
case "room::subscribe": {
|
|
5657
|
-
if (msg.roomId === roomId) {
|
|
5658
|
-
startSyncStream(room);
|
|
5659
|
-
}
|
|
5660
|
-
break;
|
|
5661
|
-
}
|
|
5662
|
-
case "room::unsubscribe": {
|
|
5663
|
-
if (msg.roomId === roomId) {
|
|
5664
|
-
stopSyncStream(roomId);
|
|
5665
|
-
}
|
|
5666
|
-
break;
|
|
5667
|
-
}
|
|
5668
|
-
}
|
|
5669
|
-
})
|
|
5670
|
-
);
|
|
5671
|
-
}
|
|
5672
|
-
function unlinkDevTools(roomId) {
|
|
5673
|
-
if (process.env.NODE_ENV === "production" || typeof window === "undefined") {
|
|
5674
|
-
return;
|
|
5612
|
+
while (pos.length > 1 && pos.charCodeAt(pos.length - 1) === MIN_CODE) {
|
|
5613
|
+
pos = pos.slice(0, -1);
|
|
5675
5614
|
}
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5615
|
+
if (pos.length === 0 || pos === ZERO) {
|
|
5616
|
+
return ONE;
|
|
5617
|
+
}
|
|
5618
|
+
let viewport = VIEWPORT_START;
|
|
5619
|
+
if (pos.length > VIEWPORT_START) {
|
|
5620
|
+
viewport = VIEWPORT_START + Math.ceil((pos.length - VIEWPORT_START) / VIEWPORT_STEP) * VIEWPORT_STEP;
|
|
5621
|
+
}
|
|
5622
|
+
const result = incrementWithinViewport(pos, viewport);
|
|
5623
|
+
if (result !== null) {
|
|
5624
|
+
return result;
|
|
5625
|
+
}
|
|
5626
|
+
viewport += VIEWPORT_STEP;
|
|
5627
|
+
const extendedResult = incrementWithinViewport(pos, viewport);
|
|
5628
|
+
if (extendedResult !== null) {
|
|
5629
|
+
return extendedResult;
|
|
5630
|
+
}
|
|
5631
|
+
return pos + ONE;
|
|
5682
5632
|
}
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5633
|
+
function incrementWithinViewport(pos, viewport) {
|
|
5634
|
+
const digits = [];
|
|
5635
|
+
for (let i = 0; i < viewport; i++) {
|
|
5636
|
+
if (i < pos.length) {
|
|
5637
|
+
digits.push(pos.charCodeAt(i) - MIN_CODE);
|
|
5638
|
+
} else {
|
|
5639
|
+
digits.push(0);
|
|
5640
|
+
}
|
|
5641
|
+
}
|
|
5642
|
+
let carry = 1;
|
|
5643
|
+
for (let i = viewport - 1; i >= 0 && carry; i--) {
|
|
5644
|
+
const sum = digits[i] + carry;
|
|
5645
|
+
if (sum >= NUM_DIGITS) {
|
|
5646
|
+
digits[i] = 0;
|
|
5647
|
+
carry = 1;
|
|
5648
|
+
} else {
|
|
5649
|
+
digits[i] = sum;
|
|
5650
|
+
carry = 0;
|
|
5691
5651
|
}
|
|
5692
5652
|
}
|
|
5653
|
+
if (carry) {
|
|
5654
|
+
return null;
|
|
5655
|
+
}
|
|
5656
|
+
let result = "";
|
|
5657
|
+
for (const d of digits) {
|
|
5658
|
+
result += String.fromCharCode(d + MIN_CODE);
|
|
5659
|
+
}
|
|
5660
|
+
while (result.length > 1 && result.charCodeAt(result.length - 1) === MIN_CODE) {
|
|
5661
|
+
result = result.slice(0, -1);
|
|
5662
|
+
}
|
|
5663
|
+
return result;
|
|
5693
5664
|
}
|
|
5694
|
-
function
|
|
5695
|
-
if (
|
|
5696
|
-
|
|
5665
|
+
function between(lo, hi) {
|
|
5666
|
+
if (lo < hi) {
|
|
5667
|
+
return _between(lo, hi);
|
|
5668
|
+
} else if (lo > hi) {
|
|
5669
|
+
return _between(hi, lo);
|
|
5670
|
+
} else {
|
|
5671
|
+
throw new Error("Cannot compute value between two equal positions");
|
|
5697
5672
|
}
|
|
5698
5673
|
}
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
const descriptors = {
|
|
5710
|
-
[kPlain]: {
|
|
5711
|
-
value: plain,
|
|
5712
|
-
enumerable: false
|
|
5674
|
+
function _between(lo, hi) {
|
|
5675
|
+
let index = 0;
|
|
5676
|
+
const loLen = lo.length;
|
|
5677
|
+
const hiLen = hi.length;
|
|
5678
|
+
while (true) {
|
|
5679
|
+
const loCode = index < loLen ? lo.charCodeAt(index) : MIN_CODE;
|
|
5680
|
+
const hiCode = index < hiLen ? hi.charCodeAt(index) : MAX_CODE;
|
|
5681
|
+
if (loCode === hiCode) {
|
|
5682
|
+
index++;
|
|
5683
|
+
continue;
|
|
5713
5684
|
}
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
* In the TypeScript standard library definitions, the built-in interface for a property descriptor
|
|
5720
|
-
* does not include a specialized type for the “this” context in the getter or setter functions.
|
|
5721
|
-
* As a result, both the get and set methods implicitly have this: any.
|
|
5722
|
-
* The reason is that property descriptors in JavaScript are used across various objects with
|
|
5723
|
-
* no enforced shape for this. And so the standard library definitions have to remain as broad as possible
|
|
5724
|
-
* to support any valid JavaScript usage (e.g `Object.defineProperty`).
|
|
5725
|
-
*
|
|
5726
|
-
* So we can safely tells that this getter is typed as `this: NotificationSettings` because we're
|
|
5727
|
-
* creating a well known shaped object → `NotificationSettings`.
|
|
5728
|
-
*/
|
|
5729
|
-
get() {
|
|
5730
|
-
const value = this[kPlain][channel];
|
|
5731
|
-
if (typeof value === "undefined") {
|
|
5732
|
-
error2(
|
|
5733
|
-
`In order to use the '${channel}' channel, please set up your project first. For more information: https://liveblocks.io/docs/errors/enable-a-notification-channel`
|
|
5734
|
-
);
|
|
5735
|
-
return null;
|
|
5736
|
-
}
|
|
5737
|
-
return value;
|
|
5685
|
+
if (hiCode - loCode === 1) {
|
|
5686
|
+
const size = index + 1;
|
|
5687
|
+
let prefix = lo.substring(0, size);
|
|
5688
|
+
if (prefix.length < size) {
|
|
5689
|
+
prefix += ZERO.repeat(size - prefix.length);
|
|
5738
5690
|
}
|
|
5739
|
-
|
|
5691
|
+
const suffix = lo.substring(size);
|
|
5692
|
+
const nines = "";
|
|
5693
|
+
return prefix + _between(suffix, nines);
|
|
5694
|
+
} else {
|
|
5695
|
+
return takeN(lo, index) + String.fromCharCode(hiCode + loCode >> 1);
|
|
5696
|
+
}
|
|
5740
5697
|
}
|
|
5741
|
-
return create(null, descriptors);
|
|
5742
5698
|
}
|
|
5743
|
-
function
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5699
|
+
function takeN(pos, n) {
|
|
5700
|
+
return n < pos.length ? pos.substring(0, n) : pos + ZERO.repeat(n - pos.length);
|
|
5701
|
+
}
|
|
5702
|
+
var MIN_NON_ZERO_CODE = MIN_CODE + 1;
|
|
5703
|
+
function isPos(str) {
|
|
5704
|
+
if (str === "") {
|
|
5705
|
+
return false;
|
|
5706
|
+
}
|
|
5707
|
+
const lastIdx = str.length - 1;
|
|
5708
|
+
const last = str.charCodeAt(lastIdx);
|
|
5709
|
+
if (last < MIN_NON_ZERO_CODE || last > MAX_CODE) {
|
|
5710
|
+
return false;
|
|
5711
|
+
}
|
|
5712
|
+
for (let i = 0; i < lastIdx; i++) {
|
|
5713
|
+
const code = str.charCodeAt(i);
|
|
5714
|
+
if (code < MIN_CODE || code > MAX_CODE) {
|
|
5715
|
+
return false;
|
|
5757
5716
|
}
|
|
5758
5717
|
}
|
|
5759
|
-
return
|
|
5760
|
-
}
|
|
5761
|
-
function isNotificationChannelEnabled(settings) {
|
|
5762
|
-
return settings !== null ? values(settings).every((enabled) => enabled === true) : false;
|
|
5718
|
+
return true;
|
|
5763
5719
|
}
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
return;
|
|
5720
|
+
function convertToPos(str) {
|
|
5721
|
+
const codes = [];
|
|
5722
|
+
for (let i = 0; i < str.length; i++) {
|
|
5723
|
+
const code = str.charCodeAt(i);
|
|
5724
|
+
codes.push(code < MIN_CODE ? MIN_CODE : code > MAX_CODE ? MAX_CODE : code);
|
|
5770
5725
|
}
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
}
|
|
5774
|
-
const badgeDiv = document.createElement("div");
|
|
5775
|
-
badgeDiv.id = "liveblocks-badge";
|
|
5776
|
-
badgeDiv.style.position = "fixed";
|
|
5777
|
-
badgeDiv.style.opacity = "0";
|
|
5778
|
-
badgeDiv.style.transition = "opacity 300ms";
|
|
5779
|
-
badgeDiv.style.zIndex = "9999";
|
|
5780
|
-
switch (badgeLocation) {
|
|
5781
|
-
case "top-right":
|
|
5782
|
-
badgeDiv.style.top = OFFSET;
|
|
5783
|
-
badgeDiv.style.right = OFFSET;
|
|
5784
|
-
break;
|
|
5785
|
-
case "bottom-right":
|
|
5786
|
-
badgeDiv.style.bottom = OFFSET;
|
|
5787
|
-
badgeDiv.style.right = OFFSET;
|
|
5788
|
-
break;
|
|
5789
|
-
case "bottom-left":
|
|
5790
|
-
badgeDiv.style.bottom = OFFSET;
|
|
5791
|
-
badgeDiv.style.left = OFFSET;
|
|
5792
|
-
break;
|
|
5793
|
-
case "top-left":
|
|
5794
|
-
badgeDiv.style.top = OFFSET;
|
|
5795
|
-
badgeDiv.style.left = OFFSET;
|
|
5796
|
-
break;
|
|
5797
|
-
}
|
|
5798
|
-
badgeDiv.onmouseenter = () => {
|
|
5799
|
-
const hideButton2 = document.getElementById("liveblocks-badge-hide-button");
|
|
5800
|
-
if (hideButton2) {
|
|
5801
|
-
hideButton2.style.opacity = "0.3";
|
|
5802
|
-
}
|
|
5803
|
-
};
|
|
5804
|
-
badgeDiv.onmouseleave = () => {
|
|
5805
|
-
const hideButton2 = document.getElementById("liveblocks-badge-hide-button");
|
|
5806
|
-
if (hideButton2) {
|
|
5807
|
-
hideButton2.style.opacity = "0";
|
|
5808
|
-
}
|
|
5809
|
-
};
|
|
5810
|
-
const link = document.createElement("a");
|
|
5811
|
-
link.href = "https://lblcks.io/badge";
|
|
5812
|
-
link.target = "_blank";
|
|
5813
|
-
link.rel = "noopener noreferrer";
|
|
5814
|
-
link.title = "Liveblocks";
|
|
5815
|
-
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
5816
|
-
svg.setAttribute("width", "111");
|
|
5817
|
-
svg.setAttribute("height", "38");
|
|
5818
|
-
svg.setAttribute("viewBox", "0 0 111 38");
|
|
5819
|
-
svg.setAttribute("fill", "none");
|
|
5820
|
-
const rect1 = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
5821
|
-
rect1.setAttribute("x", "1");
|
|
5822
|
-
rect1.setAttribute("y", "1");
|
|
5823
|
-
rect1.setAttribute("width", "109");
|
|
5824
|
-
rect1.setAttribute("height", "36");
|
|
5825
|
-
rect1.setAttribute("rx", "8");
|
|
5826
|
-
rect1.setAttribute("fill", "white");
|
|
5827
|
-
svg.appendChild(rect1);
|
|
5828
|
-
const rect2 = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
5829
|
-
rect2.setAttribute("x", "0.5");
|
|
5830
|
-
rect2.setAttribute("y", "0.5");
|
|
5831
|
-
rect2.setAttribute("width", "110");
|
|
5832
|
-
rect2.setAttribute("height", "37");
|
|
5833
|
-
rect2.setAttribute("rx", "8.5");
|
|
5834
|
-
rect2.setAttribute("stroke", "black");
|
|
5835
|
-
rect2.setAttribute("stroke-opacity", "0.1");
|
|
5836
|
-
svg.appendChild(rect2);
|
|
5837
|
-
const path1 = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
5838
|
-
path1.setAttribute(
|
|
5839
|
-
"d",
|
|
5840
|
-
"M39.8256 18.0832H38L38.0005 28.9009H39.8256V18.0832ZM43.213 21.1757H41.3879V28.9009H43.213V21.1757ZM43.213 18H41.3879V19.9688H43.213V18ZM45.8916 21.1757H43.9302L46.6915 28.9009H48.7283L51.4896 21.1757H49.5581L48.4039 24.8348C48.3739 24.93 48.2657 25.3024 48.0795 25.9511L47.7099 27.1959C47.4914 26.406 47.2626 25.6189 47.0237 24.8348L45.8916 21.1757ZM58.9659 23.59C58.8147 23.0721 58.5934 22.6317 58.3014 22.2694C57.9743 21.8628 57.5598 21.5482 57.0571 21.3268C56.5589 21.1004 56.0058 20.9877 55.3973 20.9877C54.2407 20.9877 53.3152 21.3495 52.6212 22.0735C52.275 22.4476 52.0103 22.8896 51.844 23.3715C51.6731 23.8691 51.5876 24.4199 51.5876 25.0233C51.5876 26.3157 51.9322 27.3142 52.6217 28.0184C53.3203 28.7323 54.2509 29.0894 55.4125 29.0894C56.4083 29.0894 57.2151 28.8658 57.8342 28.4181C58.453 27.9704 58.8628 27.3068 59.0638 26.4266L57.2834 26.2908C57.198 26.7685 57.0016 27.1257 56.6948 27.3618C56.3879 27.5933 55.9555 27.7093 55.3973 27.7093C54.1201 27.7093 53.4663 26.9899 53.4363 25.5514H59.1844L59.1922 25.295C59.1922 24.6763 59.1165 24.108 58.9659 23.59ZM53.8434 23.0471C54.1654 22.5943 54.6834 22.3679 55.3973 22.3679C55.7443 22.3679 56.0363 22.4155 56.2725 22.5111C56.509 22.6067 56.7128 22.7601 56.8837 22.9713C57.0167 23.1352 57.1189 23.3218 57.1855 23.5221C57.2605 23.731 57.3062 23.9493 57.3213 24.1708H53.451C53.4964 23.7231 53.6271 23.3484 53.8434 23.0471ZM66.2836 21.4779C65.7656 21.1406 65.1673 20.9724 64.4885 20.9724H64.4875C63.995 20.9724 63.5449 21.0727 63.1374 21.2742C62.7364 21.4696 62.3931 21.7659 62.1412 22.1341V18.0832H60.316V28.9009H62.1416V27.8373C62.373 28.2195 62.7008 28.5342 63.0921 28.7499C63.4996 28.9763 63.9497 29.0894 64.4422 29.0894C65.1266 29.0894 65.7324 28.9259 66.2614 28.5992C66.7891 28.2726 67.1989 27.8045 67.4905 27.1959C67.7871 26.5823 67.9359 25.8634 67.9359 25.0386C67.9359 24.2337 67.7895 23.5248 67.4984 22.9113C67.2115 22.2926 66.8066 21.8148 66.2836 21.4779ZM65.5064 27.0828C65.2148 27.5254 64.7172 27.7463 64.0125 27.7463C63.3786 27.7463 62.9013 27.5175 62.5797 27.0601C62.2576 26.6026 62.0968 25.9336 62.0968 25.0534C62.0968 24.2032 62.24 23.5397 62.5265 23.0619C62.8185 22.579 63.3088 22.3378 63.9978 22.3378C64.7019 22.3378 65.2023 22.5592 65.499 23.0013C65.7961 23.4389 65.944 24.1181 65.944 25.0386C65.944 25.9585 65.7985 26.6401 65.5064 27.0828ZM70.901 18.0832H69.0754V28.9009H70.901V18.0832ZM73.8582 28.6066C74.452 28.9286 75.1558 29.0894 75.9708 29.0894C76.7554 29.0894 77.4444 28.9208 78.0377 28.5844C78.6268 28.2569 79.1068 27.7637 79.4183 27.1659C79.745 26.5523 79.9086 25.843 79.9086 25.0386C79.9086 24.2642 79.7478 23.5697 79.4257 22.9565C79.117 22.3516 78.6404 21.8487 78.0529 21.508C77.4592 21.161 76.7652 20.9872 75.9708 20.9872C75.171 20.9872 74.4719 21.161 73.8735 21.508C73.2876 21.8472 72.811 22.3471 72.5002 22.9486C72.1837 23.5572 72.0252 24.254 72.0252 25.0386C72.0252 25.8735 72.181 26.5948 72.4929 27.2033C72.7962 27.798 73.2722 28.2871 73.8582 28.6066ZM77.4869 27.0906C77.18 27.5231 76.6746 27.7393 75.9708 27.7393C75.493 27.7393 75.1082 27.6437 74.8166 27.4524C74.5246 27.2565 74.3134 26.9621 74.1826 26.5699C74.0518 26.1725 73.9867 25.6619 73.9867 25.0381C73.9867 24.1029 74.1401 23.419 74.4469 22.9866C74.7588 22.5541 75.2667 22.3378 75.9708 22.3378C76.6699 22.3378 77.1727 22.5541 77.4795 22.9866C77.7914 23.419 77.9471 24.1029 77.9471 25.0386C77.9471 25.9738 77.7937 26.6576 77.4869 27.0906ZM82.3982 28.6066C82.9869 28.9286 83.6883 29.0894 84.5033 29.0894C85.1369 29.0894 85.7029 28.9791 86.2005 28.7577C86.6989 28.5364 87.1031 28.2272 87.4152 27.8299C87.7279 27.4249 87.9329 26.9471 88.0109 26.4414L86.2534 26.2607C86.1328 26.7431 85.9316 27.1031 85.6497 27.3392C85.3683 27.5757 84.9857 27.694 84.5033 27.694C84.0103 27.694 83.6232 27.5933 83.3413 27.3918C83.0598 27.1858 82.8635 26.8919 82.7531 26.5093C82.6422 26.1221 82.5872 25.6318 82.5872 25.0386C82.5872 24.455 82.6422 23.9722 82.7531 23.59C82.8635 23.2028 83.0571 22.9062 83.3339 22.6997C83.6157 22.4884 84.0053 22.3831 84.5033 22.3831C85.0362 22.3831 85.4312 22.5314 85.6877 22.8281C85.949 23.1196 86.1354 23.5193 86.2456 24.0276L87.9735 23.718C87.8078 22.8932 87.4326 22.232 86.8491 21.7344C86.2708 21.2363 85.489 20.9877 84.5033 20.9877C83.6985 20.9877 83.0021 21.1587 82.4134 21.5006C81.8322 21.8351 81.3625 22.3337 81.0633 22.9339C80.7514 23.5424 80.5952 24.2439 80.5952 25.0386C80.5952 25.8781 80.7486 26.6026 81.0554 27.2112C81.3673 27.8197 81.8151 28.285 82.3982 28.6066ZM90.8104 26.0343L91.6627 25.2192L93.9257 28.9009H96.0308L92.8999 24.0498L95.9328 21.1757H93.5634L90.8104 23.9976V18.0832H88.9845V28.9009H90.8104V26.0343ZM97.6304 28.8103C98.1436 28.9965 98.7142 29.0894 99.3428 29.0894C100.303 29.0894 101.095 28.8981 101.719 28.5165C102.348 28.1339 102.663 27.5101 102.663 26.6451C102.663 26.0818 102.516 25.6392 102.225 25.3176C101.933 24.9905 101.586 24.7566 101.184 24.6157C100.786 24.4702 100.245 24.3219 99.562 24.1707C99.1642 24.0853 98.8502 24.0049 98.6188 23.9295C98.3873 23.8538 98.201 23.7558 98.0604 23.6352C97.925 23.5141 97.8567 23.3584 97.8567 23.1676C97.8567 22.8858 97.9824 22.6723 98.2338 22.5263C98.4853 22.3803 98.7973 22.3073 99.1694 22.3073C99.6619 22.3073 100.047 22.4255 100.324 22.6621C100.605 22.8987 100.756 23.2531 100.776 23.7258L102.466 23.4467C102.385 22.5817 102.046 21.9556 101.447 21.568C100.854 21.1812 100.095 20.9872 99.1694 20.9872C98.6258 20.9872 98.1236 21.0699 97.6607 21.2362C97.2029 21.397 96.8335 21.6511 96.5517 21.9986C96.27 22.3451 96.1294 22.7827 96.1294 23.3109C96.1294 23.7988 96.25 24.1934 96.4911 24.4951C96.7368 24.8001 97.0527 25.0408 97.4118 25.1965C97.7838 25.3578 98.2512 25.5112 98.8147 25.6567L99.2828 25.7699C99.5949 25.844 99.9044 25.9295 100.211 26.0264C100.421 26.092 100.595 26.1826 100.731 26.2981C100.867 26.4136 100.935 26.5647 100.935 26.7509C100.935 27.0776 100.799 27.3294 100.527 27.505C100.261 27.6815 99.8708 27.7693 99.3583 27.7693C98.8347 27.7693 98.4176 27.6385 98.1055 27.377C97.7941 27.1154 97.6355 26.7384 97.6304 26.2454L95.9109 26.4413C95.9302 27.0351 96.094 27.5304 96.4009 27.9278C96.7129 28.3252 97.1223 28.619 97.6304 28.8103Z"
|
|
5841
|
-
);
|
|
5842
|
-
path1.setAttribute("fill", "black");
|
|
5843
|
-
svg.appendChild(path1);
|
|
5844
|
-
const path2 = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
5845
|
-
path2.setAttribute(
|
|
5846
|
-
"d",
|
|
5847
|
-
"M37.6392 15V9.18182H39.7131C40.1657 9.18182 40.5407 9.2642 40.8381 9.42898C41.1354 9.59375 41.358 9.81913 41.5057 10.1051C41.6534 10.3892 41.7273 10.7093 41.7273 11.0653C41.7273 11.4233 41.6525 11.7453 41.5028 12.0312C41.3551 12.3153 41.1316 12.5407 40.8324 12.7074C40.535 12.8722 40.161 12.9545 39.7102 12.9545H38.2841V12.2102H39.6307C39.9167 12.2102 40.1487 12.161 40.3267 12.0625C40.5047 11.9621 40.6354 11.8258 40.7188 11.6534C40.8021 11.4811 40.8438 11.285 40.8438 11.0653C40.8438 10.8456 40.8021 10.6506 40.7188 10.4801C40.6354 10.3097 40.5038 10.1761 40.3239 10.0795C40.1458 9.98295 39.911 9.93466 39.6193 9.93466H38.517V15H37.6392ZM44.4716 15.0881C44.0625 15.0881 43.7055 14.9943 43.4006 14.8068C43.0956 14.6193 42.8589 14.357 42.6903 14.0199C42.5218 13.6828 42.4375 13.2888 42.4375 12.8381C42.4375 12.3854 42.5218 11.9896 42.6903 11.6506C42.8589 11.3116 43.0956 11.0483 43.4006 10.8608C43.7055 10.6733 44.0625 10.5795 44.4716 10.5795C44.8807 10.5795 45.2377 10.6733 45.5426 10.8608C45.8475 11.0483 46.0843 11.3116 46.2528 11.6506C46.4214 11.9896 46.5057 12.3854 46.5057 12.8381C46.5057 13.2888 46.4214 13.6828 46.2528 14.0199C46.0843 14.357 45.8475 14.6193 45.5426 14.8068C45.2377 14.9943 44.8807 15.0881 44.4716 15.0881ZM44.4744 14.375C44.7396 14.375 44.9593 14.3049 45.1335 14.1648C45.3078 14.0246 45.4366 13.8381 45.5199 13.6051C45.6051 13.3722 45.6477 13.1155 45.6477 12.8352C45.6477 12.5568 45.6051 12.3011 45.5199 12.0682C45.4366 11.8333 45.3078 11.6449 45.1335 11.5028C44.9593 11.3608 44.7396 11.2898 44.4744 11.2898C44.2074 11.2898 43.9858 11.3608 43.8097 11.5028C43.6354 11.6449 43.5057 11.8333 43.4205 12.0682C43.3371 12.3011 43.2955 12.5568 43.2955 12.8352C43.2955 13.1155 43.3371 13.3722 43.4205 13.6051C43.5057 13.8381 43.6354 14.0246 43.8097 14.1648C43.9858 14.3049 44.2074 14.375 44.4744 14.375ZM48.267 15L46.983 10.6364H47.8608L48.7159 13.8409H48.7585L49.6165 10.6364H50.4943L51.3466 13.8267H51.3892L52.2386 10.6364H53.1165L51.8352 15H50.9688L50.0824 11.8494H50.017L49.1307 15H48.267ZM55.6705 15.0881C55.2405 15.0881 54.8703 14.9962 54.5597 14.8125C54.2509 14.6269 54.0123 14.3665 53.8438 14.0312C53.6771 13.6941 53.5938 13.2992 53.5938 12.8466C53.5938 12.3996 53.6771 12.0057 53.8438 11.6648C54.0123 11.3239 54.2472 11.0578 54.5483 10.8665C54.8513 10.6752 55.2055 10.5795 55.6108 10.5795C55.857 10.5795 56.0956 10.6203 56.3267 10.7017C56.5578 10.7831 56.7652 10.911 56.9489 11.0852C57.1326 11.2595 57.2775 11.4858 57.3835 11.7642C57.4896 12.0407 57.5426 12.3769 57.5426 12.7727V13.0739H54.0739V12.4375H56.7102C56.7102 12.214 56.6648 12.0161 56.5739 11.8438C56.483 11.6695 56.3551 11.5322 56.1903 11.4318C56.0275 11.3314 55.8362 11.2812 55.6165 11.2812C55.3778 11.2812 55.1695 11.34 54.9915 11.4574C54.8153 11.5729 54.679 11.7244 54.5824 11.9119C54.4877 12.0975 54.4403 12.2992 54.4403 12.517V13.0142C54.4403 13.3059 54.4915 13.554 54.5938 13.7585C54.6979 13.9631 54.8428 14.1193 55.0284 14.2273C55.214 14.3333 55.4309 14.3864 55.679 14.3864C55.84 14.3864 55.9867 14.3636 56.1193 14.3182C56.2519 14.2708 56.3665 14.2008 56.4631 14.108C56.5597 14.0152 56.6335 13.9006 56.6847 13.7642L57.4886 13.9091C57.4242 14.1458 57.3087 14.3532 57.142 14.5312C56.9773 14.7074 56.7699 14.8447 56.5199 14.9432C56.2718 15.0398 55.9886 15.0881 55.6705 15.0881ZM58.4851 15V10.6364H59.3061V11.3295H59.3516C59.4311 11.0947 59.5713 10.91 59.772 10.7756C59.9747 10.6392 60.2038 10.571 60.4595 10.571C60.5125 10.571 60.575 10.5729 60.647 10.5767C60.7209 10.5805 60.7786 10.5852 60.8203 10.5909V11.4034C60.7862 11.3939 60.7256 11.3835 60.6385 11.3722C60.5514 11.3589 60.4643 11.3523 60.3771 11.3523C60.1764 11.3523 59.9974 11.3949 59.8402 11.4801C59.6849 11.5634 59.5618 11.6799 59.4709 11.8295C59.38 11.9773 59.3345 12.1458 59.3345 12.3352V15H58.4851ZM63.2798 15.0881C62.8499 15.0881 62.4796 14.9962 62.169 14.8125C61.8603 14.6269 61.6217 14.3665 61.4531 14.0312C61.2865 13.6941 61.2031 13.2992 61.2031 12.8466C61.2031 12.3996 61.2865 12.0057 61.4531 11.6648C61.6217 11.3239 61.8565 11.0578 62.1577 10.8665C62.4607 10.6752 62.8149 10.5795 63.2202 10.5795C63.4664 10.5795 63.705 10.6203 63.9361 10.7017C64.1671 10.7831 64.3745 10.911 64.5582 11.0852C64.742 11.2595 64.8868 11.4858 64.9929 11.7642C65.099 12.0407 65.152 12.3769 65.152 12.7727V13.0739H61.6832V12.4375H64.3196C64.3196 12.214 64.2741 12.0161 64.1832 11.8438C64.0923 11.6695 63.9645 11.5322 63.7997 11.4318C63.6368 11.3314 63.4455 11.2812 63.2259 11.2812C62.9872 11.2812 62.7789 11.34 62.6009 11.4574C62.4247 11.5729 62.2884 11.7244 62.1918 11.9119C62.0971 12.0975 62.0497 12.2992 62.0497 12.517V13.0142C62.0497 13.3059 62.1009 13.554 62.2031 13.7585C62.3073 13.9631 62.4522 14.1193 62.6378 14.2273C62.8234 14.3333 63.0402 14.3864 63.2884 14.3864C63.4493 14.3864 63.5961 14.3636 63.7287 14.3182C63.8613 14.2708 63.9759 14.2008 64.0724 14.108C64.169 14.0152 64.2429 13.9006 64.294 13.7642L65.098 13.9091C65.0336 14.1458 64.9181 14.3532 64.7514 14.5312C64.5866 14.7074 64.3793 14.8447 64.1293 14.9432C63.8812 15.0398 63.598 15.0881 63.2798 15.0881ZM67.728 15.0852C67.3757 15.0852 67.0613 14.9953 66.7848 14.8153C66.5102 14.6335 66.2943 14.375 66.1371 14.0398C65.9818 13.7027 65.9041 13.2983 65.9041 12.8267C65.9041 12.3551 65.9827 11.9517 66.1399 11.6165C66.299 11.2812 66.5168 11.0246 66.7933 10.8466C67.0698 10.6686 67.3833 10.5795 67.7337 10.5795C68.0045 10.5795 68.2223 10.625 68.3871 10.7159C68.5537 10.8049 68.6825 10.9091 68.7734 11.0284C68.8662 11.1477 68.9382 11.2528 68.9893 11.3438H69.0405V9.18182H69.8899V15H69.0604V14.321H68.9893C68.9382 14.4138 68.8643 14.5199 68.7678 14.6392C68.6731 14.7585 68.5424 14.8627 68.3757 14.9517C68.209 15.0407 67.9931 15.0852 67.728 15.0852ZM67.9155 14.3608C68.1598 14.3608 68.3662 14.2964 68.5348 14.1676C68.7053 14.0369 68.834 13.8561 68.9212 13.625C69.0102 13.3939 69.0547 13.125 69.0547 12.8182C69.0547 12.5152 69.0111 12.25 68.924 12.0227C68.8369 11.7955 68.709 11.6184 68.5405 11.4915C68.3719 11.3646 68.1636 11.3011 67.9155 11.3011C67.6598 11.3011 67.4467 11.3674 67.2763 11.5C67.1058 11.6326 66.977 11.8134 66.8899 12.0426C66.8047 12.2718 66.7621 12.5303 66.7621 12.8182C66.7621 13.1098 66.8056 13.3722 66.8928 13.6051C66.9799 13.8381 67.1087 14.0227 67.2791 14.1591C67.4515 14.2936 67.6636 14.3608 67.9155 14.3608ZM73.2876 15V9.18182H74.1371V11.3438H74.1882C74.2375 11.2528 74.3085 11.1477 74.4013 11.0284C74.4941 10.9091 74.6229 10.8049 74.7876 10.7159C74.9524 10.625 75.1702 10.5795 75.4411 10.5795C75.7933 10.5795 76.1077 10.6686 76.3842 10.8466C76.6607 11.0246 76.8776 11.2812 77.0348 11.6165C77.1939 11.9517 77.2734 12.3551 77.2734 12.8267C77.2734 13.2983 77.1948 13.7027 77.0376 14.0398C76.8804 14.375 76.6645 14.6335 76.3899 14.8153C76.1153 14.9953 75.8018 15.0852 75.4496 15.0852C75.1844 15.0852 74.9676 15.0407 74.799 14.9517C74.6323 14.8627 74.5017 14.7585 74.407 14.6392C74.3123 14.5199 74.2393 14.4138 74.1882 14.321H74.1172V15H73.2876ZM74.12 12.8182C74.12 13.125 74.1645 13.3939 74.2536 13.625C74.3426 13.8561 74.4714 14.0369 74.6399 14.1676C74.8085 14.2964 75.0149 14.3608 75.2592 14.3608C75.513 14.3608 75.7251 14.2936 75.8956 14.1591C76.0661 14.0227 76.1948 13.8381 76.282 13.6051C76.371 13.3722 76.4155 13.1098 76.4155 12.8182C76.4155 12.5303 76.3719 12.2718 76.2848 12.0426C76.1996 11.8134 76.0708 11.6326 75.8984 11.5C75.728 11.3674 75.5149 11.3011 75.2592 11.3011C75.013 11.3011 74.8047 11.3646 74.6342 11.4915C74.4657 11.6184 74.3378 11.7955 74.2507 12.0227C74.1636 12.25 74.12 12.5152 74.12 12.8182ZM78.6158 16.6364C78.4889 16.6364 78.3733 16.6259 78.2692 16.6051C78.165 16.5862 78.0874 16.5653 78.0362 16.5426L78.2408 15.8466C78.3961 15.8883 78.5343 15.9063 78.6555 15.9006C78.7768 15.8949 78.8838 15.8494 78.9766 15.7642C79.0713 15.679 79.1546 15.5398 79.2266 15.3466L79.3317 15.0568L77.7351 10.6364H78.6442L79.7493 14.0227H79.7947L80.8999 10.6364H81.8118L80.0135 15.5824C79.9302 15.8097 79.8241 16.0019 79.6953 16.1591C79.5665 16.3182 79.4131 16.4375 79.2351 16.517C79.0571 16.5966 78.8506 16.6364 78.6158 16.6364Z"
|
|
5848
|
-
);
|
|
5849
|
-
path2.setAttribute("fill", "black");
|
|
5850
|
-
path2.setAttribute("fill-opacity", "0.5");
|
|
5851
|
-
svg.appendChild(path2);
|
|
5852
|
-
const rect3 = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
5853
|
-
rect3.setAttribute("x", "7");
|
|
5854
|
-
rect3.setAttribute("y", "7");
|
|
5855
|
-
rect3.setAttribute("width", "24");
|
|
5856
|
-
rect3.setAttribute("height", "24");
|
|
5857
|
-
rect3.setAttribute("rx", "3");
|
|
5858
|
-
rect3.setAttribute("fill", "black");
|
|
5859
|
-
svg.appendChild(rect3);
|
|
5860
|
-
const path3 = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
5861
|
-
path3.setAttribute("fill-rule", "evenodd");
|
|
5862
|
-
path3.setAttribute("clip-rule", "evenodd");
|
|
5863
|
-
path3.setAttribute(
|
|
5864
|
-
"d",
|
|
5865
|
-
"M22.0455 15H12.2273L15.1364 17.9091V21.9091L22.0455 15Z"
|
|
5866
|
-
);
|
|
5867
|
-
path3.setAttribute("fill", "white");
|
|
5868
|
-
svg.appendChild(path3);
|
|
5869
|
-
const path4 = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
5870
|
-
path4.setAttribute("fill-rule", "evenodd");
|
|
5871
|
-
path4.setAttribute("clip-rule", "evenodd");
|
|
5872
|
-
path4.setAttribute(
|
|
5873
|
-
"d",
|
|
5874
|
-
"M16.9546 22.9999H26.7728L23.8637 20.0908V16.0908L16.9546 22.9999Z"
|
|
5875
|
-
);
|
|
5876
|
-
path4.setAttribute("fill", "white");
|
|
5877
|
-
svg.appendChild(path4);
|
|
5878
|
-
link.appendChild(svg);
|
|
5879
|
-
badgeDiv.appendChild(link);
|
|
5880
|
-
const hideButton = document.createElement("button");
|
|
5881
|
-
hideButton.id = "liveblocks-badge-hide-button";
|
|
5882
|
-
hideButton.style.position = "absolute";
|
|
5883
|
-
hideButton.style.top = "0";
|
|
5884
|
-
hideButton.style.right = "0";
|
|
5885
|
-
hideButton.style.border = "none";
|
|
5886
|
-
hideButton.style.padding = "0";
|
|
5887
|
-
hideButton.style.margin = "0";
|
|
5888
|
-
hideButton.style.background = "none";
|
|
5889
|
-
hideButton.style.font = "inherit";
|
|
5890
|
-
hideButton.style.cursor = "pointer";
|
|
5891
|
-
hideButton.style.outline = "none";
|
|
5892
|
-
hideButton.style.setProperty("-webkit-appearance", "none");
|
|
5893
|
-
hideButton.style.setProperty("-moz-appearance", "none");
|
|
5894
|
-
hideButton.style.setProperty("appearance", "none");
|
|
5895
|
-
hideButton.style.opacity = "0";
|
|
5896
|
-
hideButton.onclick = () => {
|
|
5897
|
-
const badge2 = document.getElementById("liveblocks-badge");
|
|
5898
|
-
if (badge2) {
|
|
5899
|
-
badge2.style.display = "none";
|
|
5900
|
-
}
|
|
5901
|
-
};
|
|
5902
|
-
hideButton.onmouseenter = () => {
|
|
5903
|
-
hideButton.style.opacity = "0.5";
|
|
5904
|
-
};
|
|
5905
|
-
hideButton.onmouseleave = () => {
|
|
5906
|
-
hideButton.style.opacity = "0.3";
|
|
5907
|
-
};
|
|
5908
|
-
const hideSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
5909
|
-
hideSvg.setAttribute("width", "18");
|
|
5910
|
-
hideSvg.setAttribute("height", "18");
|
|
5911
|
-
hideSvg.setAttribute("viewBox", "0 0 18 18");
|
|
5912
|
-
hideSvg.setAttribute("fill", "none");
|
|
5913
|
-
const hidePath = document.createElementNS(
|
|
5914
|
-
"http://www.w3.org/2000/svg",
|
|
5915
|
-
"path"
|
|
5916
|
-
);
|
|
5917
|
-
hidePath.setAttribute("d", "M6 6L9 9M12 12L9 9M9 9L12 6M9 9L6 12");
|
|
5918
|
-
hidePath.setAttribute("stroke", "black");
|
|
5919
|
-
hideSvg.appendChild(hidePath);
|
|
5920
|
-
hideButton.appendChild(hideSvg);
|
|
5921
|
-
badgeDiv.appendChild(hideButton);
|
|
5922
|
-
document.body.appendChild(badgeDiv);
|
|
5923
|
-
requestAnimationFrame(() => {
|
|
5924
|
-
requestAnimationFrame(() => {
|
|
5925
|
-
badgeDiv.style.opacity = "1";
|
|
5926
|
-
});
|
|
5927
|
-
});
|
|
5928
|
-
};
|
|
5929
|
-
|
|
5930
|
-
// src/lib/position.ts
|
|
5931
|
-
var MIN_CODE = 32;
|
|
5932
|
-
var MAX_CODE = 126;
|
|
5933
|
-
var NUM_DIGITS = MAX_CODE - MIN_CODE + 1;
|
|
5934
|
-
var ZERO = nthDigit(0);
|
|
5935
|
-
var ONE = nthDigit(1);
|
|
5936
|
-
var ZERO_NINE = ZERO + nthDigit(-1);
|
|
5937
|
-
function nthDigit(n) {
|
|
5938
|
-
const code = MIN_CODE + (n < 0 ? NUM_DIGITS + n : n);
|
|
5939
|
-
if (code < MIN_CODE || code > MAX_CODE) {
|
|
5940
|
-
throw new Error(`Invalid n value: ${n}`);
|
|
5941
|
-
}
|
|
5942
|
-
return String.fromCharCode(code);
|
|
5943
|
-
}
|
|
5944
|
-
function makePosition(x, y) {
|
|
5945
|
-
if (x !== void 0 && y !== void 0) {
|
|
5946
|
-
return between(x, y);
|
|
5947
|
-
} else if (x !== void 0) {
|
|
5948
|
-
return after(x);
|
|
5949
|
-
} else if (y !== void 0) {
|
|
5950
|
-
return before(y);
|
|
5951
|
-
} else {
|
|
5952
|
-
return ONE;
|
|
5953
|
-
}
|
|
5954
|
-
}
|
|
5955
|
-
function before(pos) {
|
|
5956
|
-
const lastIndex = pos.length - 1;
|
|
5957
|
-
for (let i = 0; i <= lastIndex; i++) {
|
|
5958
|
-
const code = pos.charCodeAt(i);
|
|
5959
|
-
if (code <= MIN_CODE) {
|
|
5960
|
-
continue;
|
|
5961
|
-
}
|
|
5962
|
-
if (i === lastIndex) {
|
|
5963
|
-
if (code === MIN_CODE + 1) {
|
|
5964
|
-
return pos.substring(0, i) + ZERO_NINE;
|
|
5965
|
-
} else {
|
|
5966
|
-
return pos.substring(0, i) + String.fromCharCode(code - 1);
|
|
5967
|
-
}
|
|
5968
|
-
} else {
|
|
5969
|
-
return pos.substring(0, i + 1);
|
|
5970
|
-
}
|
|
5971
|
-
}
|
|
5972
|
-
return ONE;
|
|
5973
|
-
}
|
|
5974
|
-
var VIEWPORT_START = 2;
|
|
5975
|
-
var VIEWPORT_STEP = 3;
|
|
5976
|
-
function after(pos) {
|
|
5977
|
-
for (let i = 0; i < pos.length; i++) {
|
|
5978
|
-
const code = pos.charCodeAt(i);
|
|
5979
|
-
if (code < MIN_CODE || code > MAX_CODE) {
|
|
5980
|
-
return pos + ONE;
|
|
5981
|
-
}
|
|
5982
|
-
}
|
|
5983
|
-
while (pos.length > 1 && pos.charCodeAt(pos.length - 1) === MIN_CODE) {
|
|
5984
|
-
pos = pos.slice(0, -1);
|
|
5985
|
-
}
|
|
5986
|
-
if (pos.length === 0 || pos === ZERO) {
|
|
5987
|
-
return ONE;
|
|
5988
|
-
}
|
|
5989
|
-
let viewport = VIEWPORT_START;
|
|
5990
|
-
if (pos.length > VIEWPORT_START) {
|
|
5991
|
-
viewport = VIEWPORT_START + Math.ceil((pos.length - VIEWPORT_START) / VIEWPORT_STEP) * VIEWPORT_STEP;
|
|
5992
|
-
}
|
|
5993
|
-
const result = incrementWithinViewport(pos, viewport);
|
|
5994
|
-
if (result !== null) {
|
|
5995
|
-
return result;
|
|
5996
|
-
}
|
|
5997
|
-
viewport += VIEWPORT_STEP;
|
|
5998
|
-
const extendedResult = incrementWithinViewport(pos, viewport);
|
|
5999
|
-
if (extendedResult !== null) {
|
|
6000
|
-
return extendedResult;
|
|
6001
|
-
}
|
|
6002
|
-
return pos + ONE;
|
|
6003
|
-
}
|
|
6004
|
-
function incrementWithinViewport(pos, viewport) {
|
|
6005
|
-
const digits = [];
|
|
6006
|
-
for (let i = 0; i < viewport; i++) {
|
|
6007
|
-
if (i < pos.length) {
|
|
6008
|
-
digits.push(pos.charCodeAt(i) - MIN_CODE);
|
|
6009
|
-
} else {
|
|
6010
|
-
digits.push(0);
|
|
6011
|
-
}
|
|
6012
|
-
}
|
|
6013
|
-
let carry = 1;
|
|
6014
|
-
for (let i = viewport - 1; i >= 0 && carry; i--) {
|
|
6015
|
-
const sum = digits[i] + carry;
|
|
6016
|
-
if (sum >= NUM_DIGITS) {
|
|
6017
|
-
digits[i] = 0;
|
|
6018
|
-
carry = 1;
|
|
6019
|
-
} else {
|
|
6020
|
-
digits[i] = sum;
|
|
6021
|
-
carry = 0;
|
|
6022
|
-
}
|
|
6023
|
-
}
|
|
6024
|
-
if (carry) {
|
|
6025
|
-
return null;
|
|
6026
|
-
}
|
|
6027
|
-
let result = "";
|
|
6028
|
-
for (const d of digits) {
|
|
6029
|
-
result += String.fromCharCode(d + MIN_CODE);
|
|
6030
|
-
}
|
|
6031
|
-
while (result.length > 1 && result.charCodeAt(result.length - 1) === MIN_CODE) {
|
|
6032
|
-
result = result.slice(0, -1);
|
|
6033
|
-
}
|
|
6034
|
-
return result;
|
|
6035
|
-
}
|
|
6036
|
-
function between(lo, hi) {
|
|
6037
|
-
if (lo < hi) {
|
|
6038
|
-
return _between(lo, hi);
|
|
6039
|
-
} else if (lo > hi) {
|
|
6040
|
-
return _between(hi, lo);
|
|
6041
|
-
} else {
|
|
6042
|
-
throw new Error("Cannot compute value between two equal positions");
|
|
6043
|
-
}
|
|
6044
|
-
}
|
|
6045
|
-
function _between(lo, hi) {
|
|
6046
|
-
let index = 0;
|
|
6047
|
-
const loLen = lo.length;
|
|
6048
|
-
const hiLen = hi.length;
|
|
6049
|
-
while (true) {
|
|
6050
|
-
const loCode = index < loLen ? lo.charCodeAt(index) : MIN_CODE;
|
|
6051
|
-
const hiCode = index < hiLen ? hi.charCodeAt(index) : MAX_CODE;
|
|
6052
|
-
if (loCode === hiCode) {
|
|
6053
|
-
index++;
|
|
6054
|
-
continue;
|
|
6055
|
-
}
|
|
6056
|
-
if (hiCode - loCode === 1) {
|
|
6057
|
-
const size = index + 1;
|
|
6058
|
-
let prefix = lo.substring(0, size);
|
|
6059
|
-
if (prefix.length < size) {
|
|
6060
|
-
prefix += ZERO.repeat(size - prefix.length);
|
|
6061
|
-
}
|
|
6062
|
-
const suffix = lo.substring(size);
|
|
6063
|
-
const nines = "";
|
|
6064
|
-
return prefix + _between(suffix, nines);
|
|
6065
|
-
} else {
|
|
6066
|
-
return takeN(lo, index) + String.fromCharCode(hiCode + loCode >> 1);
|
|
6067
|
-
}
|
|
6068
|
-
}
|
|
6069
|
-
}
|
|
6070
|
-
function takeN(pos, n) {
|
|
6071
|
-
return n < pos.length ? pos.substring(0, n) : pos + ZERO.repeat(n - pos.length);
|
|
6072
|
-
}
|
|
6073
|
-
var MIN_NON_ZERO_CODE = MIN_CODE + 1;
|
|
6074
|
-
function isPos(str) {
|
|
6075
|
-
if (str === "") {
|
|
6076
|
-
return false;
|
|
6077
|
-
}
|
|
6078
|
-
const lastIdx = str.length - 1;
|
|
6079
|
-
const last = str.charCodeAt(lastIdx);
|
|
6080
|
-
if (last < MIN_NON_ZERO_CODE || last > MAX_CODE) {
|
|
6081
|
-
return false;
|
|
6082
|
-
}
|
|
6083
|
-
for (let i = 0; i < lastIdx; i++) {
|
|
6084
|
-
const code = str.charCodeAt(i);
|
|
6085
|
-
if (code < MIN_CODE || code > MAX_CODE) {
|
|
6086
|
-
return false;
|
|
6087
|
-
}
|
|
6088
|
-
}
|
|
6089
|
-
return true;
|
|
6090
|
-
}
|
|
6091
|
-
function convertToPos(str) {
|
|
6092
|
-
const codes = [];
|
|
6093
|
-
for (let i = 0; i < str.length; i++) {
|
|
6094
|
-
const code = str.charCodeAt(i);
|
|
6095
|
-
codes.push(code < MIN_CODE ? MIN_CODE : code > MAX_CODE ? MAX_CODE : code);
|
|
6096
|
-
}
|
|
6097
|
-
while (codes.length > 0 && codes[codes.length - 1] === MIN_CODE) {
|
|
6098
|
-
codes.length--;
|
|
5726
|
+
while (codes.length > 0 && codes[codes.length - 1] === MIN_CODE) {
|
|
5727
|
+
codes.length--;
|
|
6099
5728
|
}
|
|
6100
5729
|
return codes.length > 0 ? String.fromCharCode(...codes) : (
|
|
6101
5730
|
// Edge case: the str was a 0-only string, which is invalid. Default back to .1
|
|
@@ -6106,22 +5735,6 @@ function asPos(str) {
|
|
|
6106
5735
|
return isPos(str) ? str : convertToPos(str);
|
|
6107
5736
|
}
|
|
6108
5737
|
|
|
6109
|
-
// src/protocol/Op.ts
|
|
6110
|
-
var OpCode = Object.freeze({
|
|
6111
|
-
INIT: 0,
|
|
6112
|
-
SET_PARENT_KEY: 1,
|
|
6113
|
-
CREATE_LIST: 2,
|
|
6114
|
-
UPDATE_OBJECT: 3,
|
|
6115
|
-
CREATE_OBJECT: 4,
|
|
6116
|
-
DELETE_CRDT: 5,
|
|
6117
|
-
DELETE_OBJECT_KEY: 6,
|
|
6118
|
-
CREATE_MAP: 7,
|
|
6119
|
-
CREATE_REGISTER: 8
|
|
6120
|
-
});
|
|
6121
|
-
function isIgnoredOp(op) {
|
|
6122
|
-
return op.type === OpCode.DELETE_CRDT && op.id === "ACK";
|
|
6123
|
-
}
|
|
6124
|
-
|
|
6125
5738
|
// src/crdts/AbstractCrdt.ts
|
|
6126
5739
|
function createManagedPool(roomId, options) {
|
|
6127
5740
|
const {
|
|
@@ -6141,7 +5754,7 @@ function createManagedPool(roomId, options) {
|
|
|
6141
5754
|
generateId: () => `${getCurrentConnectionId()}:${clock++}`,
|
|
6142
5755
|
generateOpId: () => `${getCurrentConnectionId()}:${opClock++}`,
|
|
6143
5756
|
dispatch(ops, reverse, storageUpdates) {
|
|
6144
|
-
_optionalChain([onDispatch, 'optionalCall',
|
|
5757
|
+
_optionalChain([onDispatch, 'optionalCall', _111 => _111(ops, reverse, storageUpdates)]);
|
|
6145
5758
|
},
|
|
6146
5759
|
assertStorageIsWritable: () => {
|
|
6147
5760
|
if (!isStorageWritable()) {
|
|
@@ -6296,21 +5909,20 @@ var AbstractCrdt = class {
|
|
|
6296
5909
|
...op
|
|
6297
5910
|
}));
|
|
6298
5911
|
}
|
|
6299
|
-
/** This caches the result of the last .
|
|
6300
|
-
#
|
|
5912
|
+
/** This caches the result of the last .toJSON() call for this Live node. */
|
|
5913
|
+
#cachedJson;
|
|
6301
5914
|
#cachedTreeNodeKey;
|
|
6302
5915
|
/** This caches the result of the last .toTreeNode() call for this Live node. */
|
|
6303
5916
|
#cachedTreeNode;
|
|
6304
5917
|
/**
|
|
6305
5918
|
* @internal
|
|
6306
5919
|
*
|
|
6307
|
-
* Clear the
|
|
6308
|
-
* recompute
|
|
6309
|
-
* mutation to the Live node.
|
|
5920
|
+
* Clear the cached snapshots, so that the next call to `.toJSON()` will
|
|
5921
|
+
* recompute. Call this after every mutation to the Live node.
|
|
6310
5922
|
*/
|
|
6311
5923
|
invalidate() {
|
|
6312
|
-
if (this.#
|
|
6313
|
-
this.#
|
|
5924
|
+
if (this.#cachedJson !== void 0 || this.#cachedTreeNode !== void 0) {
|
|
5925
|
+
this.#cachedJson = void 0;
|
|
6314
5926
|
this.#cachedTreeNode = void 0;
|
|
6315
5927
|
if (this.parent.type === "HasParent") {
|
|
6316
5928
|
this.parent.node.invalidate();
|
|
@@ -6330,100 +5942,26 @@ var AbstractCrdt = class {
|
|
|
6330
5942
|
}
|
|
6331
5943
|
/**
|
|
6332
5944
|
* @private
|
|
6333
|
-
* Returns true if the cached
|
|
6334
|
-
*
|
|
5945
|
+
* Returns true if the cached JSON snapshot exists and is reference-equal
|
|
5946
|
+
* to the given value. Does not trigger a recompute.
|
|
6335
5947
|
*/
|
|
6336
|
-
|
|
6337
|
-
return this.#
|
|
5948
|
+
hasCache(value) {
|
|
5949
|
+
return this.#cachedJson !== void 0 && this.#cachedJson === value;
|
|
6338
5950
|
}
|
|
6339
5951
|
/**
|
|
6340
|
-
* Return
|
|
5952
|
+
* Return a JSON-compatible snapshot of this Live node and its children.
|
|
5953
|
+
* LiveObject values become plain objects, LiveList values become arrays,
|
|
5954
|
+
* and LiveMap values also become plain objects (not Map instances).
|
|
5955
|
+
* The result is cached and only recomputed when the contents change.
|
|
6341
5956
|
*/
|
|
6342
|
-
|
|
6343
|
-
if (this.#
|
|
6344
|
-
this.#
|
|
5957
|
+
toJSON() {
|
|
5958
|
+
if (this.#cachedJson === void 0) {
|
|
5959
|
+
this.#cachedJson = this._toJSON();
|
|
6345
5960
|
}
|
|
6346
|
-
return this.#
|
|
5961
|
+
return this.#cachedJson;
|
|
6347
5962
|
}
|
|
6348
5963
|
};
|
|
6349
5964
|
|
|
6350
|
-
// src/protocol/StorageNode.ts
|
|
6351
|
-
var CrdtType = Object.freeze({
|
|
6352
|
-
OBJECT: 0,
|
|
6353
|
-
LIST: 1,
|
|
6354
|
-
MAP: 2,
|
|
6355
|
-
REGISTER: 3
|
|
6356
|
-
});
|
|
6357
|
-
function isRootStorageNode(node) {
|
|
6358
|
-
return node[0] === "root";
|
|
6359
|
-
}
|
|
6360
|
-
function isObjectStorageNode(node) {
|
|
6361
|
-
return node[1].type === CrdtType.OBJECT;
|
|
6362
|
-
}
|
|
6363
|
-
function isListStorageNode(node) {
|
|
6364
|
-
return node[1].type === CrdtType.LIST;
|
|
6365
|
-
}
|
|
6366
|
-
function isMapStorageNode(node) {
|
|
6367
|
-
return node[1].type === CrdtType.MAP;
|
|
6368
|
-
}
|
|
6369
|
-
function isRegisterStorageNode(node) {
|
|
6370
|
-
return node[1].type === CrdtType.REGISTER;
|
|
6371
|
-
}
|
|
6372
|
-
function isCompactRootNode(node) {
|
|
6373
|
-
return node[0] === "root";
|
|
6374
|
-
}
|
|
6375
|
-
function* compactNodesToNodeStream(compactNodes) {
|
|
6376
|
-
for (const cnode of compactNodes) {
|
|
6377
|
-
if (isCompactRootNode(cnode)) {
|
|
6378
|
-
yield [cnode[0], { type: CrdtType.OBJECT, data: cnode[1] }];
|
|
6379
|
-
continue;
|
|
6380
|
-
}
|
|
6381
|
-
switch (cnode[1]) {
|
|
6382
|
-
case CrdtType.OBJECT:
|
|
6383
|
-
yield [cnode[0], { type: CrdtType.OBJECT, parentId: cnode[2], parentKey: cnode[3], data: cnode[4] }];
|
|
6384
|
-
break;
|
|
6385
|
-
case CrdtType.LIST:
|
|
6386
|
-
yield [cnode[0], { type: CrdtType.LIST, parentId: cnode[2], parentKey: cnode[3] }];
|
|
6387
|
-
break;
|
|
6388
|
-
case CrdtType.MAP:
|
|
6389
|
-
yield [cnode[0], { type: CrdtType.MAP, parentId: cnode[2], parentKey: cnode[3] }];
|
|
6390
|
-
break;
|
|
6391
|
-
case CrdtType.REGISTER:
|
|
6392
|
-
yield [cnode[0], { type: CrdtType.REGISTER, parentId: cnode[2], parentKey: cnode[3], data: cnode[4] }];
|
|
6393
|
-
break;
|
|
6394
|
-
default:
|
|
6395
|
-
}
|
|
6396
|
-
}
|
|
6397
|
-
}
|
|
6398
|
-
function* nodeStreamToCompactNodes(nodes) {
|
|
6399
|
-
for (const node of nodes) {
|
|
6400
|
-
if (isObjectStorageNode(node)) {
|
|
6401
|
-
if (isRootStorageNode(node)) {
|
|
6402
|
-
const id = node[0];
|
|
6403
|
-
const crdt = node[1];
|
|
6404
|
-
yield [id, crdt.data];
|
|
6405
|
-
} else {
|
|
6406
|
-
const id = node[0];
|
|
6407
|
-
const crdt = node[1];
|
|
6408
|
-
yield [id, CrdtType.OBJECT, crdt.parentId, crdt.parentKey, crdt.data];
|
|
6409
|
-
}
|
|
6410
|
-
} else if (isListStorageNode(node)) {
|
|
6411
|
-
const id = node[0];
|
|
6412
|
-
const crdt = node[1];
|
|
6413
|
-
yield [id, CrdtType.LIST, crdt.parentId, crdt.parentKey];
|
|
6414
|
-
} else if (isMapStorageNode(node)) {
|
|
6415
|
-
const id = node[0];
|
|
6416
|
-
const crdt = node[1];
|
|
6417
|
-
yield [id, CrdtType.MAP, crdt.parentId, crdt.parentKey];
|
|
6418
|
-
} else if (isRegisterStorageNode(node)) {
|
|
6419
|
-
const id = node[0];
|
|
6420
|
-
const crdt = node[1];
|
|
6421
|
-
yield [id, CrdtType.REGISTER, crdt.parentId, crdt.parentKey, crdt.data];
|
|
6422
|
-
} else {
|
|
6423
|
-
}
|
|
6424
|
-
}
|
|
6425
|
-
}
|
|
6426
|
-
|
|
6427
5965
|
// src/crdts/LiveRegister.ts
|
|
6428
5966
|
var LiveRegister = class _LiveRegister extends AbstractCrdt {
|
|
6429
5967
|
#data;
|
|
@@ -6491,7 +6029,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
|
|
|
6491
6029
|
};
|
|
6492
6030
|
}
|
|
6493
6031
|
/** @internal */
|
|
6494
|
-
|
|
6032
|
+
_toJSON() {
|
|
6495
6033
|
return this.#data;
|
|
6496
6034
|
}
|
|
6497
6035
|
clone() {
|
|
@@ -6841,7 +6379,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6841
6379
|
#applyInsertUndoRedo(op) {
|
|
6842
6380
|
const { id, parentKey: key } = op;
|
|
6843
6381
|
const child = creationOpToLiveNode(op);
|
|
6844
|
-
if (_optionalChain([this, 'access',
|
|
6382
|
+
if (_optionalChain([this, 'access', _112 => _112._pool, 'optionalAccess', _113 => _113.getNode, 'call', _114 => _114(id)]) !== void 0) {
|
|
6845
6383
|
return { modified: false };
|
|
6846
6384
|
}
|
|
6847
6385
|
child._attach(id, nn(this._pool));
|
|
@@ -6849,8 +6387,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6849
6387
|
const existingItemIndex = this._indexOfPosition(key);
|
|
6850
6388
|
let newKey = key;
|
|
6851
6389
|
if (existingItemIndex !== -1) {
|
|
6852
|
-
const before2 = _optionalChain([this, 'access',
|
|
6853
|
-
const after2 = _optionalChain([this, 'access',
|
|
6390
|
+
const before2 = _optionalChain([this, 'access', _115 => _115.#items, 'access', _116 => _116.at, 'call', _117 => _117(existingItemIndex), 'optionalAccess', _118 => _118._parentPos]);
|
|
6391
|
+
const after2 = _optionalChain([this, 'access', _119 => _119.#items, 'access', _120 => _120.at, 'call', _121 => _121(existingItemIndex + 1), 'optionalAccess', _122 => _122._parentPos]);
|
|
6854
6392
|
newKey = makePosition(before2, after2);
|
|
6855
6393
|
child._setParentLink(this, newKey);
|
|
6856
6394
|
}
|
|
@@ -6864,7 +6402,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6864
6402
|
#applySetUndoRedo(op) {
|
|
6865
6403
|
const { id, parentKey: key } = op;
|
|
6866
6404
|
const child = creationOpToLiveNode(op);
|
|
6867
|
-
if (_optionalChain([this, 'access',
|
|
6405
|
+
if (_optionalChain([this, 'access', _123 => _123._pool, 'optionalAccess', _124 => _124.getNode, 'call', _125 => _125(id)]) !== void 0) {
|
|
6868
6406
|
return { modified: false };
|
|
6869
6407
|
}
|
|
6870
6408
|
this.#unacknowledgedSets.set(key, nn(op.opId));
|
|
@@ -6985,7 +6523,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6985
6523
|
} else {
|
|
6986
6524
|
this.#updateItemPositionAt(
|
|
6987
6525
|
existingItemIndex,
|
|
6988
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
6526
|
+
makePosition(newKey, _optionalChain([this, 'access', _126 => _126.#items, 'access', _127 => _127.at, 'call', _128 => _128(existingItemIndex + 1), 'optionalAccess', _129 => _129._parentPos]))
|
|
6989
6527
|
);
|
|
6990
6528
|
const previousIndex = this.#items.findIndex((item) => item === child);
|
|
6991
6529
|
this.#updateItemPosition(child, newKey);
|
|
@@ -7012,7 +6550,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7012
6550
|
this,
|
|
7013
6551
|
makePosition(
|
|
7014
6552
|
newKey,
|
|
7015
|
-
_optionalChain([this, 'access',
|
|
6553
|
+
_optionalChain([this, 'access', _130 => _130.#items, 'access', _131 => _131.at, 'call', _132 => _132(existingItemIndex + 1), 'optionalAccess', _133 => _133._parentPos])
|
|
7016
6554
|
)
|
|
7017
6555
|
);
|
|
7018
6556
|
this.#items.reposition(existingItem);
|
|
@@ -7036,7 +6574,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7036
6574
|
existingItemIndex,
|
|
7037
6575
|
makePosition(
|
|
7038
6576
|
newKey,
|
|
7039
|
-
_optionalChain([this, 'access',
|
|
6577
|
+
_optionalChain([this, 'access', _134 => _134.#items, 'access', _135 => _135.at, 'call', _136 => _136(existingItemIndex + 1), 'optionalAccess', _137 => _137._parentPos])
|
|
7040
6578
|
)
|
|
7041
6579
|
);
|
|
7042
6580
|
}
|
|
@@ -7064,7 +6602,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7064
6602
|
if (existingItemIndex !== -1) {
|
|
7065
6603
|
actualNewKey = makePosition(
|
|
7066
6604
|
newKey,
|
|
7067
|
-
_optionalChain([this, 'access',
|
|
6605
|
+
_optionalChain([this, 'access', _138 => _138.#items, 'access', _139 => _139.at, 'call', _140 => _140(existingItemIndex + 1), 'optionalAccess', _141 => _141._parentPos])
|
|
7068
6606
|
);
|
|
7069
6607
|
}
|
|
7070
6608
|
this.#updateItemPosition(child, actualNewKey);
|
|
@@ -7121,7 +6659,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7121
6659
|
* @param element The element to add to the end of the LiveList.
|
|
7122
6660
|
*/
|
|
7123
6661
|
push(element) {
|
|
7124
|
-
_optionalChain([this, 'access',
|
|
6662
|
+
_optionalChain([this, 'access', _142 => _142._pool, 'optionalAccess', _143 => _143.assertStorageIsWritable, 'call', _144 => _144()]);
|
|
7125
6663
|
return this.insert(element, this.length);
|
|
7126
6664
|
}
|
|
7127
6665
|
/**
|
|
@@ -7130,14 +6668,14 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7130
6668
|
* @param index The index at which you want to insert the element.
|
|
7131
6669
|
*/
|
|
7132
6670
|
insert(element, index) {
|
|
7133
|
-
_optionalChain([this, 'access',
|
|
6671
|
+
_optionalChain([this, 'access', _145 => _145._pool, 'optionalAccess', _146 => _146.assertStorageIsWritable, 'call', _147 => _147()]);
|
|
7134
6672
|
if (index < 0 || index > this.#items.length) {
|
|
7135
6673
|
throw new Error(
|
|
7136
6674
|
`Cannot insert list item at index "${index}". index should be between 0 and ${this.#items.length}`
|
|
7137
6675
|
);
|
|
7138
6676
|
}
|
|
7139
|
-
const before2 = _optionalChain([this, 'access',
|
|
7140
|
-
const after2 = _optionalChain([this, 'access',
|
|
6677
|
+
const before2 = _optionalChain([this, 'access', _148 => _148.#items, 'access', _149 => _149.at, 'call', _150 => _150(index - 1), 'optionalAccess', _151 => _151._parentPos]);
|
|
6678
|
+
const after2 = _optionalChain([this, 'access', _152 => _152.#items, 'access', _153 => _153.at, 'call', _154 => _154(index), 'optionalAccess', _155 => _155._parentPos]);
|
|
7141
6679
|
const position = makePosition(before2, after2);
|
|
7142
6680
|
const value = lsonToLiveNode(element);
|
|
7143
6681
|
value._setParentLink(this, position);
|
|
@@ -7160,7 +6698,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7160
6698
|
* @param targetIndex The index where the element should be after moving.
|
|
7161
6699
|
*/
|
|
7162
6700
|
move(index, targetIndex) {
|
|
7163
|
-
_optionalChain([this, 'access',
|
|
6701
|
+
_optionalChain([this, 'access', _156 => _156._pool, 'optionalAccess', _157 => _157.assertStorageIsWritable, 'call', _158 => _158()]);
|
|
7164
6702
|
if (targetIndex < 0) {
|
|
7165
6703
|
throw new Error("targetIndex cannot be less than 0");
|
|
7166
6704
|
}
|
|
@@ -7178,11 +6716,11 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7178
6716
|
let beforePosition = null;
|
|
7179
6717
|
let afterPosition = null;
|
|
7180
6718
|
if (index < targetIndex) {
|
|
7181
|
-
afterPosition = targetIndex === this.#items.length - 1 ? void 0 : _optionalChain([this, 'access',
|
|
6719
|
+
afterPosition = targetIndex === this.#items.length - 1 ? void 0 : _optionalChain([this, 'access', _159 => _159.#items, 'access', _160 => _160.at, 'call', _161 => _161(targetIndex + 1), 'optionalAccess', _162 => _162._parentPos]);
|
|
7182
6720
|
beforePosition = this.#items.at(targetIndex)._parentPos;
|
|
7183
6721
|
} else {
|
|
7184
6722
|
afterPosition = this.#items.at(targetIndex)._parentPos;
|
|
7185
|
-
beforePosition = targetIndex === 0 ? void 0 : _optionalChain([this, 'access',
|
|
6723
|
+
beforePosition = targetIndex === 0 ? void 0 : _optionalChain([this, 'access', _163 => _163.#items, 'access', _164 => _164.at, 'call', _165 => _165(targetIndex - 1), 'optionalAccess', _166 => _166._parentPos]);
|
|
7186
6724
|
}
|
|
7187
6725
|
const position = makePosition(beforePosition, afterPosition);
|
|
7188
6726
|
const item = this.#items.at(index);
|
|
@@ -7217,7 +6755,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7217
6755
|
* @param index The index of the element to delete
|
|
7218
6756
|
*/
|
|
7219
6757
|
delete(index) {
|
|
7220
|
-
_optionalChain([this, 'access',
|
|
6758
|
+
_optionalChain([this, 'access', _167 => _167._pool, 'optionalAccess', _168 => _168.assertStorageIsWritable, 'call', _169 => _169()]);
|
|
7221
6759
|
if (index < 0 || index >= this.#items.length) {
|
|
7222
6760
|
throw new Error(
|
|
7223
6761
|
`Cannot delete list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -7250,7 +6788,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7250
6788
|
}
|
|
7251
6789
|
}
|
|
7252
6790
|
clear() {
|
|
7253
|
-
_optionalChain([this, 'access',
|
|
6791
|
+
_optionalChain([this, 'access', _170 => _170._pool, 'optionalAccess', _171 => _171.assertStorageIsWritable, 'call', _172 => _172()]);
|
|
7254
6792
|
if (this._pool) {
|
|
7255
6793
|
const ops = [];
|
|
7256
6794
|
const reverseOps = [];
|
|
@@ -7284,7 +6822,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7284
6822
|
}
|
|
7285
6823
|
}
|
|
7286
6824
|
set(index, item) {
|
|
7287
|
-
_optionalChain([this, 'access',
|
|
6825
|
+
_optionalChain([this, 'access', _173 => _173._pool, 'optionalAccess', _174 => _174.assertStorageIsWritable, 'call', _175 => _175()]);
|
|
7288
6826
|
if (index < 0 || index >= this.#items.length) {
|
|
7289
6827
|
throw new Error(
|
|
7290
6828
|
`Cannot set list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -7316,11 +6854,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7316
6854
|
this._pool.dispatch(ops, reverseOps, storageUpdates);
|
|
7317
6855
|
}
|
|
7318
6856
|
}
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
*/
|
|
7322
|
-
toArray() {
|
|
7323
|
-
return Array.from(this.#items, (entry) => liveNodeToLson(entry));
|
|
6857
|
+
#unwrap(node) {
|
|
6858
|
+
return liveNodeToLson(node);
|
|
7324
6859
|
}
|
|
7325
6860
|
/**
|
|
7326
6861
|
* Tests whether all elements pass the test implemented by the provided function.
|
|
@@ -7328,7 +6863,9 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7328
6863
|
* @returns true if the predicate function returns a truthy value for every element. Otherwise, false.
|
|
7329
6864
|
*/
|
|
7330
6865
|
every(predicate) {
|
|
7331
|
-
return this.
|
|
6866
|
+
return this.#items.rawArray.every(
|
|
6867
|
+
(node, i) => predicate(this.#unwrap(node), i)
|
|
6868
|
+
);
|
|
7332
6869
|
}
|
|
7333
6870
|
/**
|
|
7334
6871
|
* Creates an array with all elements that pass the test implemented by the provided function.
|
|
@@ -7336,7 +6873,12 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7336
6873
|
* @returns An array with the elements that pass the test.
|
|
7337
6874
|
*/
|
|
7338
6875
|
filter(predicate) {
|
|
7339
|
-
|
|
6876
|
+
const result = [];
|
|
6877
|
+
this.#items.rawArray.forEach((node, i) => {
|
|
6878
|
+
const item = this.#unwrap(node);
|
|
6879
|
+
if (predicate(item, i)) result.push(item);
|
|
6880
|
+
});
|
|
6881
|
+
return result;
|
|
7340
6882
|
}
|
|
7341
6883
|
/**
|
|
7342
6884
|
* Returns the first element that satisfies the provided testing function.
|
|
@@ -7344,7 +6886,11 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7344
6886
|
* @returns The value of the first element in the LiveList that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
7345
6887
|
*/
|
|
7346
6888
|
find(predicate) {
|
|
7347
|
-
|
|
6889
|
+
for (const [i, node] of this.#items.rawArray.entries()) {
|
|
6890
|
+
const item = this.#unwrap(node);
|
|
6891
|
+
if (predicate(item, i)) return item;
|
|
6892
|
+
}
|
|
6893
|
+
return void 0;
|
|
7348
6894
|
}
|
|
7349
6895
|
/**
|
|
7350
6896
|
* Returns the index of the first element in the LiveList that satisfies the provided testing function.
|
|
@@ -7352,14 +6898,18 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7352
6898
|
* @returns The index of the first element in the LiveList that passes the test. Otherwise, -1.
|
|
7353
6899
|
*/
|
|
7354
6900
|
findIndex(predicate) {
|
|
7355
|
-
return this.
|
|
6901
|
+
return this.#items.rawArray.findIndex(
|
|
6902
|
+
(node, i) => predicate(this.#unwrap(node), i)
|
|
6903
|
+
);
|
|
7356
6904
|
}
|
|
7357
6905
|
/**
|
|
7358
6906
|
* Executes a provided function once for each element.
|
|
7359
6907
|
* @param callbackfn Function to execute on each element.
|
|
7360
6908
|
*/
|
|
7361
6909
|
forEach(callbackfn) {
|
|
7362
|
-
|
|
6910
|
+
this.#items.rawArray.forEach(
|
|
6911
|
+
(node, i) => callbackfn(this.#unwrap(node), i)
|
|
6912
|
+
);
|
|
7363
6913
|
}
|
|
7364
6914
|
/**
|
|
7365
6915
|
* Get the element at the specified index.
|
|
@@ -7367,11 +6917,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7367
6917
|
* @returns The element at the specified index or undefined.
|
|
7368
6918
|
*/
|
|
7369
6919
|
get(index) {
|
|
7370
|
-
if (index < 0 || index >= this.#items.length) {
|
|
7371
|
-
return void 0;
|
|
7372
|
-
}
|
|
7373
6920
|
const item = this.#items.at(index);
|
|
7374
|
-
return item ?
|
|
6921
|
+
return item !== void 0 ? this.#unwrap(item) : void 0;
|
|
7375
6922
|
}
|
|
7376
6923
|
/**
|
|
7377
6924
|
* Returns the first index at which a given element can be found in the LiveList, or -1 if it is not present.
|
|
@@ -7380,16 +6927,22 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7380
6927
|
* @returns The first index of the element in the LiveList; -1 if not found.
|
|
7381
6928
|
*/
|
|
7382
6929
|
indexOf(searchElement, fromIndex) {
|
|
7383
|
-
return this.
|
|
6930
|
+
return this.#items.rawArray.findIndex(
|
|
6931
|
+
(node, i) => i >= (_nullishCoalesce(fromIndex, () => ( 0))) && this.#unwrap(node) === searchElement
|
|
6932
|
+
);
|
|
7384
6933
|
}
|
|
7385
6934
|
/**
|
|
7386
|
-
* Returns the last index at which a given element can be found in the LiveList, or -1 if it is not present. The
|
|
6935
|
+
* Returns the last index at which a given element can be found in the LiveList, or -1 if it is not present. The LiveList is searched backwards, starting at fromIndex.
|
|
7387
6936
|
* @param searchElement Element to locate.
|
|
7388
6937
|
* @param fromIndex The index at which to start searching backwards.
|
|
7389
|
-
* @returns
|
|
6938
|
+
* @returns The last index of the element in the LiveList; -1 if not found.
|
|
7390
6939
|
*/
|
|
7391
6940
|
lastIndexOf(searchElement, fromIndex) {
|
|
7392
|
-
|
|
6941
|
+
const arr = this.#items.rawArray;
|
|
6942
|
+
for (let i = _nullishCoalesce(fromIndex, () => ( arr.length - 1)); i >= 0; i--) {
|
|
6943
|
+
if (this.#unwrap(arr[i]) === searchElement) return i;
|
|
6944
|
+
}
|
|
6945
|
+
return -1;
|
|
7393
6946
|
}
|
|
7394
6947
|
/**
|
|
7395
6948
|
* Creates an array populated with the results of calling a provided function on every element.
|
|
@@ -7397,20 +6950,9 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7397
6950
|
* @returns An array with each element being the result of the callback function.
|
|
7398
6951
|
*/
|
|
7399
6952
|
map(callback) {
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
result.push(
|
|
7404
|
-
callback(
|
|
7405
|
-
liveNodeToLson(entry),
|
|
7406
|
-
// ^^^^^^^^
|
|
7407
|
-
// FIXME! This isn't safe.
|
|
7408
|
-
i
|
|
7409
|
-
)
|
|
7410
|
-
);
|
|
7411
|
-
i++;
|
|
7412
|
-
}
|
|
7413
|
-
return result;
|
|
6953
|
+
return this.#items.rawArray.map(
|
|
6954
|
+
(node, i) => callback(this.#unwrap(node), i)
|
|
6955
|
+
);
|
|
7414
6956
|
}
|
|
7415
6957
|
/**
|
|
7416
6958
|
* Tests whether at least one element in the LiveList passes the test implemented by the provided function.
|
|
@@ -7418,10 +6960,14 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7418
6960
|
* @returns true if the callback function returns a truthy value for at least one element. Otherwise, false.
|
|
7419
6961
|
*/
|
|
7420
6962
|
some(predicate) {
|
|
7421
|
-
return this.
|
|
6963
|
+
return this.#items.rawArray.some(
|
|
6964
|
+
(node, i) => predicate(this.#unwrap(node), i)
|
|
6965
|
+
);
|
|
7422
6966
|
}
|
|
7423
|
-
[Symbol.iterator]() {
|
|
7424
|
-
|
|
6967
|
+
*[Symbol.iterator]() {
|
|
6968
|
+
for (const node of this.#items) {
|
|
6969
|
+
yield this.#unwrap(node);
|
|
6970
|
+
}
|
|
7425
6971
|
}
|
|
7426
6972
|
#createAttachItemAndSort(op, key) {
|
|
7427
6973
|
const newItem = creationOpToLiveNode(op);
|
|
@@ -7434,7 +6980,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7434
6980
|
#shiftItemPosition(index, key) {
|
|
7435
6981
|
const shiftedPosition = makePosition(
|
|
7436
6982
|
key,
|
|
7437
|
-
this.#items.length > index + 1 ? _optionalChain([this, 'access',
|
|
6983
|
+
this.#items.length > index + 1 ? _optionalChain([this, 'access', _176 => _176.#items, 'access', _177 => _177.at, 'call', _178 => _178(index + 1), 'optionalAccess', _179 => _179._parentPos]) : void 0
|
|
7438
6984
|
);
|
|
7439
6985
|
this.#updateItemPositionAt(index, shiftedPosition);
|
|
7440
6986
|
}
|
|
@@ -7453,13 +6999,13 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7453
6999
|
payload
|
|
7454
7000
|
};
|
|
7455
7001
|
}
|
|
7456
|
-
|
|
7457
|
-
return super.
|
|
7002
|
+
toJSON() {
|
|
7003
|
+
return super.toJSON();
|
|
7458
7004
|
}
|
|
7459
7005
|
/** @internal */
|
|
7460
|
-
|
|
7461
|
-
const result = Array.from(this.#items, (node) => node.
|
|
7462
|
-
return
|
|
7006
|
+
_toJSON() {
|
|
7007
|
+
const result = Array.from(this.#items, (node) => node.toJSON());
|
|
7008
|
+
return freeze(result);
|
|
7463
7009
|
}
|
|
7464
7010
|
clone() {
|
|
7465
7011
|
return new _LiveList(
|
|
@@ -7467,26 +7013,6 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
7467
7013
|
);
|
|
7468
7014
|
}
|
|
7469
7015
|
};
|
|
7470
|
-
var LiveListIterator = class {
|
|
7471
|
-
#innerIterator;
|
|
7472
|
-
constructor(items) {
|
|
7473
|
-
this.#innerIterator = items[Symbol.iterator]();
|
|
7474
|
-
}
|
|
7475
|
-
[Symbol.iterator]() {
|
|
7476
|
-
return this;
|
|
7477
|
-
}
|
|
7478
|
-
next() {
|
|
7479
|
-
const result = this.#innerIterator.next();
|
|
7480
|
-
if (result.done) {
|
|
7481
|
-
return {
|
|
7482
|
-
done: true,
|
|
7483
|
-
value: void 0
|
|
7484
|
-
};
|
|
7485
|
-
}
|
|
7486
|
-
const value = liveNodeToLson(result.value);
|
|
7487
|
-
return { value };
|
|
7488
|
-
}
|
|
7489
|
-
};
|
|
7490
7016
|
function makeUpdate(liveList, deltaUpdates) {
|
|
7491
7017
|
return {
|
|
7492
7018
|
node: liveList,
|
|
@@ -7707,7 +7233,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
7707
7233
|
* @param value The value of the element to add. Should be serializable to JSON.
|
|
7708
7234
|
*/
|
|
7709
7235
|
set(key, value) {
|
|
7710
|
-
_optionalChain([this, 'access',
|
|
7236
|
+
_optionalChain([this, 'access', _180 => _180._pool, 'optionalAccess', _181 => _181.assertStorageIsWritable, 'call', _182 => _182()]);
|
|
7711
7237
|
const oldValue = this.#map.get(key);
|
|
7712
7238
|
if (oldValue) {
|
|
7713
7239
|
oldValue._detach();
|
|
@@ -7753,7 +7279,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
7753
7279
|
* @returns true if an element existed and has been removed, or false if the element does not exist.
|
|
7754
7280
|
*/
|
|
7755
7281
|
delete(key) {
|
|
7756
|
-
_optionalChain([this, 'access',
|
|
7282
|
+
_optionalChain([this, 'access', _183 => _183._pool, 'optionalAccess', _184 => _184.assertStorageIsWritable, 'call', _185 => _185()]);
|
|
7757
7283
|
const item = this.#map.get(key);
|
|
7758
7284
|
if (item === void 0) {
|
|
7759
7285
|
return false;
|
|
@@ -7868,14 +7394,14 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
7868
7394
|
)
|
|
7869
7395
|
};
|
|
7870
7396
|
}
|
|
7871
|
-
|
|
7872
|
-
return super.
|
|
7397
|
+
toJSON() {
|
|
7398
|
+
return super.toJSON();
|
|
7873
7399
|
}
|
|
7874
7400
|
/** @internal */
|
|
7875
|
-
|
|
7876
|
-
const result =
|
|
7401
|
+
_toJSON() {
|
|
7402
|
+
const result = {};
|
|
7877
7403
|
for (const [key, value] of this.#map) {
|
|
7878
|
-
result
|
|
7404
|
+
result[key] = value.toJSON();
|
|
7879
7405
|
}
|
|
7880
7406
|
return freeze(result);
|
|
7881
7407
|
}
|
|
@@ -7918,7 +7444,7 @@ function deepLiveify(value, config) {
|
|
|
7918
7444
|
}
|
|
7919
7445
|
function reconcile(live, json, config) {
|
|
7920
7446
|
if (isLiveObject(live) && isPlainObject(json)) {
|
|
7921
|
-
return reconcileLiveObject(live, json, config);
|
|
7447
|
+
return reconcileLiveObject(live, json, "full", config);
|
|
7922
7448
|
} else if (isLiveList(live) && Array.isArray(json)) {
|
|
7923
7449
|
return reconcileLiveList(live, json, config);
|
|
7924
7450
|
} else if (isLiveMap(live) && isPlainObject(json)) {
|
|
@@ -7930,13 +7456,15 @@ function reconcile(live, json, config) {
|
|
|
7930
7456
|
function reconcileLiveMap(_liveMap, _config) {
|
|
7931
7457
|
throw new Error("Reconciling a LiveMap is not supported yet");
|
|
7932
7458
|
}
|
|
7933
|
-
function reconcileLiveObject(liveObj, jsonObj, config) {
|
|
7459
|
+
function reconcileLiveObject(liveObj, jsonObj, extent, config) {
|
|
7934
7460
|
const currentKeys = liveObj.keys();
|
|
7935
7461
|
for (const key in jsonObj) {
|
|
7936
7462
|
currentKeys.delete(key);
|
|
7937
7463
|
const newVal = jsonObj[key];
|
|
7938
7464
|
if (newVal === void 0) {
|
|
7939
|
-
|
|
7465
|
+
if (extent === "full") {
|
|
7466
|
+
liveObj.delete(key);
|
|
7467
|
+
}
|
|
7940
7468
|
continue;
|
|
7941
7469
|
}
|
|
7942
7470
|
const subConfig = isPlainObject(config) ? config[key] : config;
|
|
@@ -7961,8 +7489,10 @@ function reconcileLiveObject(liveObj, jsonObj, config) {
|
|
|
7961
7489
|
}
|
|
7962
7490
|
}
|
|
7963
7491
|
}
|
|
7964
|
-
|
|
7965
|
-
|
|
7492
|
+
if (extent === "full") {
|
|
7493
|
+
for (const key of currentKeys) {
|
|
7494
|
+
liveObj.delete(key);
|
|
7495
|
+
}
|
|
7966
7496
|
}
|
|
7967
7497
|
return liveObj;
|
|
7968
7498
|
}
|
|
@@ -8342,16 +7872,6 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
8342
7872
|
}
|
|
8343
7873
|
return result;
|
|
8344
7874
|
}
|
|
8345
|
-
/**
|
|
8346
|
-
* Transform the LiveObject into a javascript object
|
|
8347
|
-
*/
|
|
8348
|
-
toObject() {
|
|
8349
|
-
const result = Object.fromEntries(this.#synced);
|
|
8350
|
-
for (const [key, value] of this.#local) {
|
|
8351
|
-
result[key] = value;
|
|
8352
|
-
}
|
|
8353
|
-
return result;
|
|
8354
|
-
}
|
|
8355
7875
|
/**
|
|
8356
7876
|
* Adds or updates a property with a specified key and a value.
|
|
8357
7877
|
* @param key The key of the property to add
|
|
@@ -8363,28 +7883,27 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
8363
7883
|
/**
|
|
8364
7884
|
* @experimental
|
|
8365
7885
|
*
|
|
8366
|
-
* Sets a local-only property that is not synchronized over the wire.
|
|
8367
|
-
*
|
|
8368
|
-
*
|
|
8369
|
-
* for this key.
|
|
7886
|
+
* Sets a local-only property that is not synchronized over the wire. The
|
|
7887
|
+
* value will be visible via get(), and toJSON() on this client only. Other
|
|
7888
|
+
* clients and the server will see `undefined` for this key.
|
|
8370
7889
|
*
|
|
8371
7890
|
* Caveat: this method will not add changes to the undo/redo stack.
|
|
8372
7891
|
*/
|
|
8373
7892
|
setLocal(key, value) {
|
|
8374
|
-
_optionalChain([this, 'access',
|
|
7893
|
+
_optionalChain([this, 'access', _186 => _186._pool, 'optionalAccess', _187 => _187.assertStorageIsWritable, 'call', _188 => _188()]);
|
|
8375
7894
|
const deleteResult = this.#prepareDelete(key);
|
|
8376
7895
|
this.#local.set(key, value);
|
|
8377
7896
|
this.invalidate();
|
|
8378
7897
|
if (this._pool !== void 0 && this._id !== void 0) {
|
|
8379
|
-
const ops = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess',
|
|
8380
|
-
const reverse = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess',
|
|
8381
|
-
const storageUpdates = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess',
|
|
7898
|
+
const ops = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess', _189 => _189[0]]), () => ( []));
|
|
7899
|
+
const reverse = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess', _190 => _190[1]]), () => ( []));
|
|
7900
|
+
const storageUpdates = _nullishCoalesce(_optionalChain([deleteResult, 'optionalAccess', _191 => _191[2]]), () => ( /* @__PURE__ */ new Map()));
|
|
8382
7901
|
const existing = storageUpdates.get(this._id);
|
|
8383
7902
|
storageUpdates.set(this._id, {
|
|
8384
7903
|
node: this,
|
|
8385
7904
|
type: "LiveObject",
|
|
8386
7905
|
updates: {
|
|
8387
|
-
..._optionalChain([existing, 'optionalAccess',
|
|
7906
|
+
..._optionalChain([existing, 'optionalAccess', _192 => _192.updates]),
|
|
8388
7907
|
[key]: { type: "update" }
|
|
8389
7908
|
}
|
|
8390
7909
|
});
|
|
@@ -8404,7 +7923,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
8404
7923
|
* #synced or pool/id are unavailable. Does NOT dispatch.
|
|
8405
7924
|
*/
|
|
8406
7925
|
#prepareDelete(key) {
|
|
8407
|
-
_optionalChain([this, 'access',
|
|
7926
|
+
_optionalChain([this, 'access', _193 => _193._pool, 'optionalAccess', _194 => _194.assertStorageIsWritable, 'call', _195 => _195()]);
|
|
8408
7927
|
const k = key;
|
|
8409
7928
|
if (this.#local.has(k) && !this.#synced.has(k)) {
|
|
8410
7929
|
const oldValue2 = this.#local.get(k);
|
|
@@ -8424,503 +7943,937 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
8424
7943
|
});
|
|
8425
7944
|
return [[], [], storageUpdates2];
|
|
8426
7945
|
}
|
|
8427
|
-
return null;
|
|
8428
|
-
}
|
|
8429
|
-
this.#local.delete(k);
|
|
8430
|
-
const oldValue = this.#synced.get(k);
|
|
8431
|
-
if (oldValue === void 0) {
|
|
8432
|
-
return null;
|
|
7946
|
+
return null;
|
|
7947
|
+
}
|
|
7948
|
+
this.#local.delete(k);
|
|
7949
|
+
const oldValue = this.#synced.get(k);
|
|
7950
|
+
if (oldValue === void 0) {
|
|
7951
|
+
return null;
|
|
7952
|
+
}
|
|
7953
|
+
if (this._pool === void 0 || this._id === void 0) {
|
|
7954
|
+
if (isLiveNode(oldValue)) {
|
|
7955
|
+
oldValue._detach();
|
|
7956
|
+
}
|
|
7957
|
+
this.#synced.delete(k);
|
|
7958
|
+
this.invalidate();
|
|
7959
|
+
return null;
|
|
7960
|
+
}
|
|
7961
|
+
const ops = [
|
|
7962
|
+
{
|
|
7963
|
+
type: OpCode.DELETE_OBJECT_KEY,
|
|
7964
|
+
key: k,
|
|
7965
|
+
id: this._id,
|
|
7966
|
+
opId: this._pool.generateOpId()
|
|
7967
|
+
}
|
|
7968
|
+
];
|
|
7969
|
+
let reverse;
|
|
7970
|
+
if (isLiveNode(oldValue)) {
|
|
7971
|
+
oldValue._detach();
|
|
7972
|
+
reverse = oldValue._toOps(this._id, k);
|
|
7973
|
+
} else {
|
|
7974
|
+
reverse = [
|
|
7975
|
+
{
|
|
7976
|
+
type: OpCode.UPDATE_OBJECT,
|
|
7977
|
+
data: { [k]: oldValue },
|
|
7978
|
+
id: this._id
|
|
7979
|
+
}
|
|
7980
|
+
];
|
|
7981
|
+
}
|
|
7982
|
+
this.#synced.delete(k);
|
|
7983
|
+
this.invalidate();
|
|
7984
|
+
const storageUpdates = /* @__PURE__ */ new Map();
|
|
7985
|
+
storageUpdates.set(this._id, {
|
|
7986
|
+
node: this,
|
|
7987
|
+
type: "LiveObject",
|
|
7988
|
+
updates: {
|
|
7989
|
+
[key]: { type: "delete", deletedItem: oldValue }
|
|
7990
|
+
}
|
|
7991
|
+
});
|
|
7992
|
+
return [ops, reverse, storageUpdates];
|
|
7993
|
+
}
|
|
7994
|
+
/**
|
|
7995
|
+
* Deletes a key from the LiveObject
|
|
7996
|
+
* @param key The key of the property to delete
|
|
7997
|
+
*/
|
|
7998
|
+
delete(key) {
|
|
7999
|
+
const result = this.#prepareDelete(key);
|
|
8000
|
+
if (result) {
|
|
8001
|
+
const [ops, reverse, storageUpdates] = result;
|
|
8002
|
+
_optionalChain([this, 'access', _196 => _196._pool, 'optionalAccess', _197 => _197.dispatch, 'call', _198 => _198(ops, reverse, storageUpdates)]);
|
|
8003
|
+
}
|
|
8004
|
+
}
|
|
8005
|
+
/**
|
|
8006
|
+
* Adds or updates multiple properties at once with an object.
|
|
8007
|
+
* @param patch The object used to overrides properties
|
|
8008
|
+
*/
|
|
8009
|
+
update(patch) {
|
|
8010
|
+
_optionalChain([this, 'access', _199 => _199._pool, 'optionalAccess', _200 => _200.assertStorageIsWritable, 'call', _201 => _201()]);
|
|
8011
|
+
if (_LiveObject.detectLargeObjects) {
|
|
8012
|
+
const data = {};
|
|
8013
|
+
for (const [key, value] of this.#synced) {
|
|
8014
|
+
if (!isLiveNode(value)) {
|
|
8015
|
+
data[key] = value;
|
|
8016
|
+
}
|
|
8017
|
+
}
|
|
8018
|
+
for (const key of Object.keys(patch)) {
|
|
8019
|
+
const value = patch[key];
|
|
8020
|
+
if (value === void 0) continue;
|
|
8021
|
+
if (!isLiveNode(value)) {
|
|
8022
|
+
data[key] = value;
|
|
8023
|
+
}
|
|
8024
|
+
}
|
|
8025
|
+
const jsonString = JSON.stringify(data);
|
|
8026
|
+
const upperBoundSize = jsonString.length * 4;
|
|
8027
|
+
if (upperBoundSize > MAX_LIVE_OBJECT_SIZE) {
|
|
8028
|
+
const preciseSize = new TextEncoder().encode(jsonString).length;
|
|
8029
|
+
if (preciseSize > MAX_LIVE_OBJECT_SIZE) {
|
|
8030
|
+
throw new Error(
|
|
8031
|
+
`LiveObject size exceeded limit: ${preciseSize} bytes > ${MAX_LIVE_OBJECT_SIZE} bytes. See https://liveblocks.io/docs/platform/limits#Liveblocks-Storage-limits`
|
|
8032
|
+
);
|
|
8033
|
+
}
|
|
8034
|
+
}
|
|
8035
|
+
}
|
|
8036
|
+
if (this._pool === void 0 || this._id === void 0) {
|
|
8037
|
+
for (const key in patch) {
|
|
8038
|
+
const newValue = patch[key];
|
|
8039
|
+
if (newValue === void 0) {
|
|
8040
|
+
continue;
|
|
8041
|
+
}
|
|
8042
|
+
const oldValue = this.#synced.get(key);
|
|
8043
|
+
if (isLiveNode(oldValue)) {
|
|
8044
|
+
oldValue._detach();
|
|
8045
|
+
}
|
|
8046
|
+
if (isLiveNode(newValue)) {
|
|
8047
|
+
newValue._setParentLink(this, key);
|
|
8048
|
+
}
|
|
8049
|
+
this.#local.delete(key);
|
|
8050
|
+
this.#synced.set(key, newValue);
|
|
8051
|
+
this.invalidate();
|
|
8052
|
+
}
|
|
8053
|
+
return;
|
|
8433
8054
|
}
|
|
8434
|
-
|
|
8055
|
+
const ops = [];
|
|
8056
|
+
const reverseOps = [];
|
|
8057
|
+
const opId = this._pool.generateOpId();
|
|
8058
|
+
const updatedProps = {};
|
|
8059
|
+
const reverseUpdateOp = {
|
|
8060
|
+
id: this._id,
|
|
8061
|
+
type: OpCode.UPDATE_OBJECT,
|
|
8062
|
+
data: {}
|
|
8063
|
+
};
|
|
8064
|
+
const updateDelta = {};
|
|
8065
|
+
for (const key in patch) {
|
|
8066
|
+
const newValue = patch[key];
|
|
8067
|
+
if (newValue === void 0) {
|
|
8068
|
+
continue;
|
|
8069
|
+
}
|
|
8070
|
+
const oldValue = this.#synced.get(key);
|
|
8071
|
+
if (oldValue === newValue) {
|
|
8072
|
+
continue;
|
|
8073
|
+
}
|
|
8435
8074
|
if (isLiveNode(oldValue)) {
|
|
8075
|
+
for (const childOp of oldValue._toOps(this._id, key)) {
|
|
8076
|
+
reverseOps.push(childOp);
|
|
8077
|
+
}
|
|
8436
8078
|
oldValue._detach();
|
|
8079
|
+
} else if (oldValue === void 0) {
|
|
8080
|
+
reverseOps.push({ type: OpCode.DELETE_OBJECT_KEY, id: this._id, key });
|
|
8081
|
+
} else {
|
|
8082
|
+
reverseUpdateOp.data[key] = oldValue;
|
|
8437
8083
|
}
|
|
8438
|
-
|
|
8084
|
+
if (isLiveNode(newValue)) {
|
|
8085
|
+
newValue._setParentLink(this, key);
|
|
8086
|
+
newValue._attach(this._pool.generateId(), this._pool);
|
|
8087
|
+
const newAttachChildOps = newValue._toOpsWithOpId(
|
|
8088
|
+
this._id,
|
|
8089
|
+
key,
|
|
8090
|
+
this._pool
|
|
8091
|
+
);
|
|
8092
|
+
const createCrdtOp = newAttachChildOps.find(
|
|
8093
|
+
(op) => op.parentId === this._id
|
|
8094
|
+
);
|
|
8095
|
+
if (createCrdtOp) {
|
|
8096
|
+
this.#unackedOpsByKey.set(key, nn(createCrdtOp.opId));
|
|
8097
|
+
}
|
|
8098
|
+
for (const childOp of newAttachChildOps) {
|
|
8099
|
+
ops.push(childOp);
|
|
8100
|
+
}
|
|
8101
|
+
} else {
|
|
8102
|
+
updatedProps[key] = newValue;
|
|
8103
|
+
this.#unackedOpsByKey.set(key, opId);
|
|
8104
|
+
}
|
|
8105
|
+
this.#local.delete(key);
|
|
8106
|
+
this.#synced.set(key, newValue);
|
|
8439
8107
|
this.invalidate();
|
|
8440
|
-
|
|
8108
|
+
updateDelta[key] = { type: "update" };
|
|
8441
8109
|
}
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8110
|
+
if (Object.keys(reverseUpdateOp.data).length !== 0) {
|
|
8111
|
+
reverseOps.unshift(reverseUpdateOp);
|
|
8112
|
+
}
|
|
8113
|
+
if (Object.keys(updatedProps).length !== 0) {
|
|
8114
|
+
ops.unshift({
|
|
8115
|
+
opId,
|
|
8446
8116
|
id: this._id,
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
if (
|
|
8452
|
-
|
|
8453
|
-
reverse = oldValue._toOps(this._id, k);
|
|
8454
|
-
} else {
|
|
8455
|
-
reverse = [
|
|
8456
|
-
{
|
|
8457
|
-
type: OpCode.UPDATE_OBJECT,
|
|
8458
|
-
data: { [k]: oldValue },
|
|
8459
|
-
id: this._id
|
|
8460
|
-
}
|
|
8461
|
-
];
|
|
8117
|
+
type: OpCode.UPDATE_OBJECT,
|
|
8118
|
+
data: updatedProps
|
|
8119
|
+
});
|
|
8120
|
+
}
|
|
8121
|
+
if (ops.length === 0 && reverseOps.length === 0 && Object.keys(updateDelta).length === 0) {
|
|
8122
|
+
return;
|
|
8462
8123
|
}
|
|
8463
|
-
this.#synced.delete(k);
|
|
8464
|
-
this.invalidate();
|
|
8465
8124
|
const storageUpdates = /* @__PURE__ */ new Map();
|
|
8466
8125
|
storageUpdates.set(this._id, {
|
|
8467
8126
|
node: this,
|
|
8468
8127
|
type: "LiveObject",
|
|
8469
|
-
updates:
|
|
8470
|
-
[key]: { type: "delete", deletedItem: oldValue }
|
|
8471
|
-
}
|
|
8128
|
+
updates: updateDelta
|
|
8472
8129
|
});
|
|
8473
|
-
|
|
8130
|
+
this._pool.dispatch(ops, reverseOps, storageUpdates);
|
|
8131
|
+
}
|
|
8132
|
+
static from(obj, config) {
|
|
8133
|
+
if (!isPlainObject(obj)) throw new Error("Expected a JSON object");
|
|
8134
|
+
const liveObj = new _LiveObject({});
|
|
8135
|
+
liveObj.reconcile(obj, config);
|
|
8136
|
+
return liveObj;
|
|
8137
|
+
}
|
|
8138
|
+
reconcile(jsonObj, config) {
|
|
8139
|
+
if (this.hasCache(jsonObj)) return;
|
|
8140
|
+
if (!isPlainObject(jsonObj))
|
|
8141
|
+
throw new Error(
|
|
8142
|
+
"Reconciling the document root expects a plain object value"
|
|
8143
|
+
);
|
|
8144
|
+
reconcileLiveObject(this, jsonObj, "full", config);
|
|
8145
|
+
}
|
|
8146
|
+
/**
|
|
8147
|
+
* Like reconcile(), but only touches the top-level keys present in
|
|
8148
|
+
* `partialObj`. Keys on this LiveObject that are absent from `partialObj`
|
|
8149
|
+
* are left untouched. Typically called on the storage root when
|
|
8150
|
+
* reconciling a subset of keys without affecting other keys on the root.
|
|
8151
|
+
*
|
|
8152
|
+
* Note: the partial behavior only applies to the top-level keys of this
|
|
8153
|
+
* object. Nested structures are always fully reconciled.
|
|
8154
|
+
*
|
|
8155
|
+
* @private
|
|
8156
|
+
*/
|
|
8157
|
+
reconcilePartially(partialObj, config) {
|
|
8158
|
+
if (!isPlainObject(partialObj))
|
|
8159
|
+
throw new Error(
|
|
8160
|
+
"Reconciling the document root expects a plain object value"
|
|
8161
|
+
);
|
|
8162
|
+
reconcileLiveObject(this, partialObj, "partial", config);
|
|
8163
|
+
}
|
|
8164
|
+
/** @internal */
|
|
8165
|
+
toTreeNode(key) {
|
|
8166
|
+
return super.toTreeNode(key);
|
|
8167
|
+
}
|
|
8168
|
+
/** @internal */
|
|
8169
|
+
_toTreeNode(key) {
|
|
8170
|
+
const nodeId = _nullishCoalesce(this._id, () => ( nanoid()));
|
|
8171
|
+
return {
|
|
8172
|
+
type: "LiveObject",
|
|
8173
|
+
id: nodeId,
|
|
8174
|
+
key,
|
|
8175
|
+
payload: Array.from(this.#synced.entries()).map(
|
|
8176
|
+
([key2, value]) => isLiveNode(value) ? value.toTreeNode(key2) : { type: "Json", id: `${nodeId}:${key2}`, key: key2, payload: value }
|
|
8177
|
+
)
|
|
8178
|
+
};
|
|
8179
|
+
}
|
|
8180
|
+
toJSON() {
|
|
8181
|
+
return super.toJSON();
|
|
8182
|
+
}
|
|
8183
|
+
/** @internal */
|
|
8184
|
+
_toJSON() {
|
|
8185
|
+
const result = {};
|
|
8186
|
+
for (const [key, val] of this.#synced) {
|
|
8187
|
+
result[key] = isLiveStructure(val) ? val.toJSON() : val;
|
|
8188
|
+
}
|
|
8189
|
+
for (const [key, val] of this.#local) {
|
|
8190
|
+
result[key] = val;
|
|
8191
|
+
}
|
|
8192
|
+
return freeze(result);
|
|
8193
|
+
}
|
|
8194
|
+
clone() {
|
|
8195
|
+
const cloned = new _LiveObject(
|
|
8196
|
+
Object.fromEntries(
|
|
8197
|
+
Array.from(this.#synced).map(([key, value]) => [
|
|
8198
|
+
key,
|
|
8199
|
+
isLiveStructure(value) ? value.clone() : deepClone(value)
|
|
8200
|
+
])
|
|
8201
|
+
)
|
|
8202
|
+
);
|
|
8203
|
+
for (const [key, value] of this.#local) {
|
|
8204
|
+
cloned.#local.set(key, deepClone(value));
|
|
8205
|
+
}
|
|
8206
|
+
return cloned;
|
|
8207
|
+
}
|
|
8208
|
+
}, _class2.__initStatic(), _class2);
|
|
8209
|
+
|
|
8210
|
+
// src/crdts/liveblocks-helpers.ts
|
|
8211
|
+
function creationOpToLiveNode(op) {
|
|
8212
|
+
return lsonToLiveNode(creationOpToLson(op));
|
|
8213
|
+
}
|
|
8214
|
+
function creationOpToLson(op) {
|
|
8215
|
+
switch (op.type) {
|
|
8216
|
+
case OpCode.CREATE_REGISTER:
|
|
8217
|
+
return op.data;
|
|
8218
|
+
case OpCode.CREATE_OBJECT:
|
|
8219
|
+
return new LiveObject(op.data);
|
|
8220
|
+
case OpCode.CREATE_MAP:
|
|
8221
|
+
return new LiveMap();
|
|
8222
|
+
case OpCode.CREATE_LIST:
|
|
8223
|
+
return new LiveList([]);
|
|
8224
|
+
default:
|
|
8225
|
+
return assertNever(op, "Unknown creation Op");
|
|
8226
|
+
}
|
|
8227
|
+
}
|
|
8228
|
+
function isSameNodeOrChildOf(node, parent) {
|
|
8229
|
+
if (node === parent) {
|
|
8230
|
+
return true;
|
|
8231
|
+
}
|
|
8232
|
+
if (node.parent.type === "HasParent") {
|
|
8233
|
+
return isSameNodeOrChildOf(node.parent.node, parent);
|
|
8234
|
+
}
|
|
8235
|
+
return false;
|
|
8236
|
+
}
|
|
8237
|
+
function deserialize(node, parentToChildren, pool) {
|
|
8238
|
+
if (isObjectStorageNode(node)) {
|
|
8239
|
+
return LiveObject._deserialize(node, parentToChildren, pool);
|
|
8240
|
+
} else if (isListStorageNode(node)) {
|
|
8241
|
+
return LiveList._deserialize(node, parentToChildren, pool);
|
|
8242
|
+
} else if (isMapStorageNode(node)) {
|
|
8243
|
+
return LiveMap._deserialize(node, parentToChildren, pool);
|
|
8244
|
+
} else if (isRegisterStorageNode(node)) {
|
|
8245
|
+
return LiveRegister._deserialize(node, parentToChildren, pool);
|
|
8246
|
+
} else {
|
|
8247
|
+
throw new Error("Unexpected CRDT type");
|
|
8248
|
+
}
|
|
8249
|
+
}
|
|
8250
|
+
function deserializeToLson(node, parentToChildren, pool) {
|
|
8251
|
+
if (isObjectStorageNode(node)) {
|
|
8252
|
+
return LiveObject._deserialize(node, parentToChildren, pool);
|
|
8253
|
+
} else if (isListStorageNode(node)) {
|
|
8254
|
+
return LiveList._deserialize(node, parentToChildren, pool);
|
|
8255
|
+
} else if (isMapStorageNode(node)) {
|
|
8256
|
+
return LiveMap._deserialize(node, parentToChildren, pool);
|
|
8257
|
+
} else if (isRegisterStorageNode(node)) {
|
|
8258
|
+
return node[1].data;
|
|
8259
|
+
} else {
|
|
8260
|
+
throw new Error("Unexpected CRDT type");
|
|
8261
|
+
}
|
|
8262
|
+
}
|
|
8263
|
+
function isLiveStructure(value) {
|
|
8264
|
+
return isLiveList(value) || isLiveMap(value) || isLiveObject(value);
|
|
8265
|
+
}
|
|
8266
|
+
function isLiveNode(value) {
|
|
8267
|
+
return isLiveStructure(value) || isLiveRegister(value);
|
|
8268
|
+
}
|
|
8269
|
+
function isLiveList(value) {
|
|
8270
|
+
return value instanceof LiveList;
|
|
8271
|
+
}
|
|
8272
|
+
function isLiveMap(value) {
|
|
8273
|
+
return value instanceof LiveMap;
|
|
8274
|
+
}
|
|
8275
|
+
function isLiveObject(value) {
|
|
8276
|
+
return value instanceof LiveObject;
|
|
8277
|
+
}
|
|
8278
|
+
function isLiveRegister(value) {
|
|
8279
|
+
return value instanceof LiveRegister;
|
|
8280
|
+
}
|
|
8281
|
+
function cloneLson(value) {
|
|
8282
|
+
return value === void 0 ? void 0 : isLiveStructure(value) ? value.clone() : deepClone(value);
|
|
8283
|
+
}
|
|
8284
|
+
function liveNodeToLson(obj) {
|
|
8285
|
+
if (obj instanceof LiveRegister) {
|
|
8286
|
+
return obj.data;
|
|
8287
|
+
} else if (obj instanceof LiveList || obj instanceof LiveMap || obj instanceof LiveObject) {
|
|
8288
|
+
return obj;
|
|
8289
|
+
} else {
|
|
8290
|
+
return assertNever(obj, "Unknown AbstractCrdt");
|
|
8291
|
+
}
|
|
8292
|
+
}
|
|
8293
|
+
function lsonToLiveNode(value) {
|
|
8294
|
+
if (value instanceof LiveObject || value instanceof LiveMap || value instanceof LiveList) {
|
|
8295
|
+
return value;
|
|
8296
|
+
} else {
|
|
8297
|
+
return new LiveRegister(value);
|
|
8474
8298
|
}
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
if (result) {
|
|
8482
|
-
const [ops, reverse, storageUpdates] = result;
|
|
8483
|
-
_optionalChain([this, 'access', _202 => _202._pool, 'optionalAccess', _203 => _203.dispatch, 'call', _204 => _204(ops, reverse, storageUpdates)]);
|
|
8299
|
+
}
|
|
8300
|
+
function getTreesDiffOperations(currentItems, newItems) {
|
|
8301
|
+
const ops = [];
|
|
8302
|
+
currentItems.forEach((_, id) => {
|
|
8303
|
+
if (!newItems.get(id)) {
|
|
8304
|
+
ops.push({ type: OpCode.DELETE_CRDT, id });
|
|
8484
8305
|
}
|
|
8485
|
-
}
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
data[key] = value;
|
|
8306
|
+
});
|
|
8307
|
+
newItems.forEach((crdt, id) => {
|
|
8308
|
+
const currentCrdt = currentItems.get(id);
|
|
8309
|
+
if (currentCrdt) {
|
|
8310
|
+
if (crdt.type === CrdtType.OBJECT) {
|
|
8311
|
+
if (currentCrdt.type !== CrdtType.OBJECT || stringifyOrLog(crdt.data) !== stringifyOrLog(currentCrdt.data)) {
|
|
8312
|
+
ops.push({
|
|
8313
|
+
type: OpCode.UPDATE_OBJECT,
|
|
8314
|
+
id,
|
|
8315
|
+
data: crdt.data
|
|
8316
|
+
});
|
|
8497
8317
|
}
|
|
8498
8318
|
}
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
}
|
|
8319
|
+
if (crdt.parentKey !== currentCrdt.parentKey) {
|
|
8320
|
+
ops.push({
|
|
8321
|
+
type: OpCode.SET_PARENT_KEY,
|
|
8322
|
+
id,
|
|
8323
|
+
parentKey: nn(crdt.parentKey, "Parent key must not be missing")
|
|
8324
|
+
});
|
|
8505
8325
|
}
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8326
|
+
} else {
|
|
8327
|
+
switch (crdt.type) {
|
|
8328
|
+
case CrdtType.REGISTER:
|
|
8329
|
+
ops.push({
|
|
8330
|
+
type: OpCode.CREATE_REGISTER,
|
|
8331
|
+
id,
|
|
8332
|
+
parentId: crdt.parentId,
|
|
8333
|
+
parentKey: crdt.parentKey,
|
|
8334
|
+
data: crdt.data
|
|
8335
|
+
});
|
|
8336
|
+
break;
|
|
8337
|
+
case CrdtType.LIST:
|
|
8338
|
+
ops.push({
|
|
8339
|
+
type: OpCode.CREATE_LIST,
|
|
8340
|
+
id,
|
|
8341
|
+
parentId: crdt.parentId,
|
|
8342
|
+
parentKey: crdt.parentKey
|
|
8343
|
+
});
|
|
8344
|
+
break;
|
|
8345
|
+
case CrdtType.OBJECT:
|
|
8346
|
+
if (crdt.parentId === void 0 || crdt.parentKey === void 0) {
|
|
8347
|
+
throw new Error(
|
|
8348
|
+
"Internal error. Cannot serialize storage root into an operation"
|
|
8349
|
+
);
|
|
8350
|
+
}
|
|
8351
|
+
ops.push({
|
|
8352
|
+
type: OpCode.CREATE_OBJECT,
|
|
8353
|
+
id,
|
|
8354
|
+
parentId: crdt.parentId,
|
|
8355
|
+
parentKey: crdt.parentKey,
|
|
8356
|
+
data: crdt.data
|
|
8357
|
+
});
|
|
8358
|
+
break;
|
|
8359
|
+
case CrdtType.MAP:
|
|
8360
|
+
ops.push({
|
|
8361
|
+
type: OpCode.CREATE_MAP,
|
|
8362
|
+
id,
|
|
8363
|
+
parentId: crdt.parentId,
|
|
8364
|
+
parentKey: crdt.parentKey
|
|
8365
|
+
});
|
|
8366
|
+
break;
|
|
8515
8367
|
}
|
|
8516
8368
|
}
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8369
|
+
});
|
|
8370
|
+
return ops;
|
|
8371
|
+
}
|
|
8372
|
+
function mergeObjectStorageUpdates(first, second) {
|
|
8373
|
+
const updates = first.updates;
|
|
8374
|
+
for (const [key, value] of entries(second.updates)) {
|
|
8375
|
+
updates[key] = value;
|
|
8376
|
+
}
|
|
8377
|
+
return {
|
|
8378
|
+
...second,
|
|
8379
|
+
updates
|
|
8380
|
+
};
|
|
8381
|
+
}
|
|
8382
|
+
function mergeMapStorageUpdates(first, second) {
|
|
8383
|
+
const updates = first.updates;
|
|
8384
|
+
for (const [key, value] of entries(second.updates)) {
|
|
8385
|
+
updates[key] = value;
|
|
8386
|
+
}
|
|
8387
|
+
return {
|
|
8388
|
+
...second,
|
|
8389
|
+
updates
|
|
8390
|
+
};
|
|
8391
|
+
}
|
|
8392
|
+
function mergeListStorageUpdates(first, second) {
|
|
8393
|
+
const updates = first.updates;
|
|
8394
|
+
return {
|
|
8395
|
+
...second,
|
|
8396
|
+
updates: updates.concat(second.updates)
|
|
8397
|
+
};
|
|
8398
|
+
}
|
|
8399
|
+
function mergeStorageUpdates(first, second) {
|
|
8400
|
+
if (first === void 0) {
|
|
8401
|
+
return second;
|
|
8402
|
+
}
|
|
8403
|
+
if (first.type === "LiveObject" && second.type === "LiveObject") {
|
|
8404
|
+
return mergeObjectStorageUpdates(first, second);
|
|
8405
|
+
} else if (first.type === "LiveMap" && second.type === "LiveMap") {
|
|
8406
|
+
return mergeMapStorageUpdates(first, second);
|
|
8407
|
+
} else if (first.type === "LiveList" && second.type === "LiveList") {
|
|
8408
|
+
return mergeListStorageUpdates(first, second);
|
|
8409
|
+
} else {
|
|
8410
|
+
}
|
|
8411
|
+
return second;
|
|
8412
|
+
}
|
|
8413
|
+
|
|
8414
|
+
// src/devtools/bridge.ts
|
|
8415
|
+
var _bridgeActive = false;
|
|
8416
|
+
function activateBridge(allowed) {
|
|
8417
|
+
_bridgeActive = allowed;
|
|
8418
|
+
}
|
|
8419
|
+
function sendToPanel(message, options) {
|
|
8420
|
+
if (process.env.NODE_ENV === "production" || typeof window === "undefined") {
|
|
8421
|
+
return;
|
|
8422
|
+
}
|
|
8423
|
+
const fullMsg = {
|
|
8424
|
+
...message,
|
|
8425
|
+
source: "liveblocks-devtools-client"
|
|
8426
|
+
};
|
|
8427
|
+
if (!(_optionalChain([options, 'optionalAccess', _202 => _202.force]) || _bridgeActive)) {
|
|
8428
|
+
return;
|
|
8429
|
+
}
|
|
8430
|
+
window.postMessage(fullMsg, "*");
|
|
8431
|
+
}
|
|
8432
|
+
var eventSource = makeEventSource();
|
|
8433
|
+
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
8434
|
+
window.addEventListener("message", (event) => {
|
|
8435
|
+
if (event.source === window && _optionalChain([event, 'access', _203 => _203.data, 'optionalAccess', _204 => _204.source]) === "liveblocks-devtools-panel") {
|
|
8436
|
+
eventSource.notify(event.data);
|
|
8437
|
+
} else {
|
|
8535
8438
|
}
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
newValue._attach(this._pool.generateId(), this._pool);
|
|
8568
|
-
const newAttachChildOps = newValue._toOpsWithOpId(
|
|
8569
|
-
this._id,
|
|
8570
|
-
key,
|
|
8571
|
-
this._pool
|
|
8572
|
-
);
|
|
8573
|
-
const createCrdtOp = newAttachChildOps.find(
|
|
8574
|
-
(op) => op.parentId === this._id
|
|
8575
|
-
);
|
|
8576
|
-
if (createCrdtOp) {
|
|
8577
|
-
this.#unackedOpsByKey.set(key, nn(createCrdtOp.opId));
|
|
8578
|
-
}
|
|
8579
|
-
for (const childOp of newAttachChildOps) {
|
|
8580
|
-
ops.push(childOp);
|
|
8439
|
+
});
|
|
8440
|
+
}
|
|
8441
|
+
var onMessageFromPanel = eventSource.observable;
|
|
8442
|
+
|
|
8443
|
+
// src/devtools/index.ts
|
|
8444
|
+
var VERSION = PKG_VERSION || "dev";
|
|
8445
|
+
var _devtoolsSetupHasRun = false;
|
|
8446
|
+
function setupDevTools(getAllRooms) {
|
|
8447
|
+
if (process.env.NODE_ENV === "production" || typeof window === "undefined") {
|
|
8448
|
+
return;
|
|
8449
|
+
}
|
|
8450
|
+
if (_devtoolsSetupHasRun) {
|
|
8451
|
+
return;
|
|
8452
|
+
}
|
|
8453
|
+
_devtoolsSetupHasRun = true;
|
|
8454
|
+
onMessageFromPanel.subscribe((msg) => {
|
|
8455
|
+
switch (msg.msg) {
|
|
8456
|
+
// When a devtool panel sends an explicit "connect" message back to this
|
|
8457
|
+
// live running client (in response to the "wake-up-devtools" message,
|
|
8458
|
+
// or when the devtool panel is opened for the first time), it means that it's okay to
|
|
8459
|
+
// start emitting messages.
|
|
8460
|
+
// Before this explicit acknowledgement, any call to sendToPanel() will
|
|
8461
|
+
// be a no-op.
|
|
8462
|
+
case "connect": {
|
|
8463
|
+
activateBridge(true);
|
|
8464
|
+
for (const roomId of getAllRooms()) {
|
|
8465
|
+
sendToPanel({
|
|
8466
|
+
msg: "room::available",
|
|
8467
|
+
roomId,
|
|
8468
|
+
clientVersion: VERSION
|
|
8469
|
+
});
|
|
8581
8470
|
}
|
|
8582
|
-
|
|
8583
|
-
updatedProps[key] = newValue;
|
|
8584
|
-
this.#unackedOpsByKey.set(key, opId);
|
|
8471
|
+
break;
|
|
8585
8472
|
}
|
|
8586
|
-
this.#local.delete(key);
|
|
8587
|
-
this.#synced.set(key, newValue);
|
|
8588
|
-
this.invalidate();
|
|
8589
|
-
updateDelta[key] = { type: "update" };
|
|
8590
|
-
}
|
|
8591
|
-
if (Object.keys(reverseUpdateOp.data).length !== 0) {
|
|
8592
|
-
reverseOps.unshift(reverseUpdateOp);
|
|
8593
|
-
}
|
|
8594
|
-
if (Object.keys(updatedProps).length !== 0) {
|
|
8595
|
-
ops.unshift({
|
|
8596
|
-
opId,
|
|
8597
|
-
id: this._id,
|
|
8598
|
-
type: OpCode.UPDATE_OBJECT,
|
|
8599
|
-
data: updatedProps
|
|
8600
|
-
});
|
|
8601
8473
|
}
|
|
8602
|
-
|
|
8603
|
-
|
|
8474
|
+
});
|
|
8475
|
+
sendToPanel({ msg: "wake-up-devtools" }, { force: true });
|
|
8476
|
+
}
|
|
8477
|
+
var unsubsByRoomId = /* @__PURE__ */ new Map();
|
|
8478
|
+
function stopSyncStream(roomId) {
|
|
8479
|
+
const unsubs = _nullishCoalesce(unsubsByRoomId.get(roomId), () => ( []));
|
|
8480
|
+
unsubsByRoomId.delete(roomId);
|
|
8481
|
+
for (const unsub of unsubs) {
|
|
8482
|
+
unsub();
|
|
8483
|
+
}
|
|
8484
|
+
}
|
|
8485
|
+
function startSyncStream(room) {
|
|
8486
|
+
stopSyncStream(room.id);
|
|
8487
|
+
fullSync(room);
|
|
8488
|
+
unsubsByRoomId.set(room.id, [
|
|
8489
|
+
// When the connection status changes
|
|
8490
|
+
room.events.status.subscribe(() => partialSyncConnection(room)),
|
|
8491
|
+
// When storage initializes, send the update
|
|
8492
|
+
room.events.storageDidLoad.subscribeOnce(() => partialSyncStorage(room)),
|
|
8493
|
+
// Any time storage updates, send the new storage root
|
|
8494
|
+
room.events.storageBatch.subscribe(() => partialSyncStorage(room)),
|
|
8495
|
+
// Any time "me" or "others" updates, send the new values accordingly
|
|
8496
|
+
room.events.self.subscribe(() => partialSyncMe(room)),
|
|
8497
|
+
room.events.others.subscribe(() => partialSyncOthers(room)),
|
|
8498
|
+
// Any time ydoc is updated, forward the update
|
|
8499
|
+
room.events.ydoc.subscribe((update) => syncYdocUpdate(room, update)),
|
|
8500
|
+
// Any time a custom room event is received, forward it
|
|
8501
|
+
room.events.customEvent.subscribe(
|
|
8502
|
+
(eventData) => forwardEvent(room, eventData)
|
|
8503
|
+
)
|
|
8504
|
+
]);
|
|
8505
|
+
}
|
|
8506
|
+
function syncYdocUpdate(room, update) {
|
|
8507
|
+
sendToPanel({
|
|
8508
|
+
msg: "room::sync::ydoc",
|
|
8509
|
+
roomId: room.id,
|
|
8510
|
+
update
|
|
8511
|
+
});
|
|
8512
|
+
}
|
|
8513
|
+
var loadedAt = Date.now();
|
|
8514
|
+
var eventCounter = 0;
|
|
8515
|
+
function nextEventId() {
|
|
8516
|
+
return `event-${loadedAt}-${eventCounter++}`;
|
|
8517
|
+
}
|
|
8518
|
+
function forwardEvent(room, eventData) {
|
|
8519
|
+
sendToPanel({
|
|
8520
|
+
msg: "room::events::custom-event",
|
|
8521
|
+
roomId: room.id,
|
|
8522
|
+
event: {
|
|
8523
|
+
type: "CustomEvent",
|
|
8524
|
+
id: nextEventId(),
|
|
8525
|
+
key: "Event",
|
|
8526
|
+
connectionId: eventData.connectionId,
|
|
8527
|
+
payload: eventData.event
|
|
8604
8528
|
}
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8529
|
+
});
|
|
8530
|
+
}
|
|
8531
|
+
function partialSyncConnection(room) {
|
|
8532
|
+
sendToPanel({
|
|
8533
|
+
msg: "room::sync::partial",
|
|
8534
|
+
roomId: room.id,
|
|
8535
|
+
status: room.getStatus()
|
|
8536
|
+
});
|
|
8537
|
+
}
|
|
8538
|
+
function partialSyncStorage(room) {
|
|
8539
|
+
const root = room.getStorageSnapshot();
|
|
8540
|
+
if (root) {
|
|
8541
|
+
sendToPanel({
|
|
8542
|
+
msg: "room::sync::partial",
|
|
8543
|
+
roomId: room.id,
|
|
8544
|
+
storage: root.toTreeNode("root").payload
|
|
8610
8545
|
});
|
|
8611
|
-
this._pool.dispatch(ops, reverseOps, storageUpdates);
|
|
8612
|
-
}
|
|
8613
|
-
/**
|
|
8614
|
-
* Creates a new LiveObject from a plain JSON object, recursively converting
|
|
8615
|
-
* nested objects to LiveObjects and arrays to LiveLists. An optional
|
|
8616
|
-
* SyncConfig controls per-key behavior (local-only, atomic, or deep).
|
|
8617
|
-
*
|
|
8618
|
-
* @private
|
|
8619
|
-
*/
|
|
8620
|
-
static from(obj, config) {
|
|
8621
|
-
if (!isPlainObject(obj)) throw new Error("Expected a JSON object");
|
|
8622
|
-
const liveObj = new _LiveObject({});
|
|
8623
|
-
liveObj.reconcile(obj, config);
|
|
8624
|
-
return liveObj;
|
|
8625
|
-
}
|
|
8626
|
-
/**
|
|
8627
|
-
* Reconciles a LiveObject tree to match the given JSON object and sync
|
|
8628
|
-
* config. Only mutates keys that actually changed. Recursively reconciles
|
|
8629
|
-
* the entire Live tree below it.
|
|
8630
|
-
*
|
|
8631
|
-
* @private
|
|
8632
|
-
*/
|
|
8633
|
-
reconcile(jsonObj, config) {
|
|
8634
|
-
if (this.immutableIs(jsonObj)) return;
|
|
8635
|
-
if (!isPlainObject(jsonObj))
|
|
8636
|
-
throw new Error(
|
|
8637
|
-
"Reconciling the document root expects a plain object value"
|
|
8638
|
-
);
|
|
8639
|
-
reconcileLiveObject(this, jsonObj, config);
|
|
8640
8546
|
}
|
|
8641
|
-
|
|
8642
|
-
|
|
8547
|
+
}
|
|
8548
|
+
function partialSyncMe(room) {
|
|
8549
|
+
const me = room[kInternal].getSelf_forDevTools();
|
|
8550
|
+
if (me) {
|
|
8551
|
+
sendToPanel({
|
|
8552
|
+
msg: "room::sync::partial",
|
|
8553
|
+
roomId: room.id,
|
|
8554
|
+
me
|
|
8555
|
+
});
|
|
8643
8556
|
}
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8557
|
+
}
|
|
8558
|
+
function partialSyncOthers(room) {
|
|
8559
|
+
const others = room[kInternal].getOthers_forDevTools();
|
|
8560
|
+
if (others) {
|
|
8561
|
+
sendToPanel({
|
|
8562
|
+
msg: "room::sync::partial",
|
|
8563
|
+
roomId: room.id,
|
|
8564
|
+
others
|
|
8565
|
+
});
|
|
8647
8566
|
}
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8567
|
+
}
|
|
8568
|
+
function fullSync(room) {
|
|
8569
|
+
const root = room.getStorageSnapshot();
|
|
8570
|
+
const me = room[kInternal].getSelf_forDevTools();
|
|
8571
|
+
const others = room[kInternal].getOthers_forDevTools();
|
|
8572
|
+
room.fetchYDoc("");
|
|
8573
|
+
sendToPanel({
|
|
8574
|
+
msg: "room::sync::full",
|
|
8575
|
+
roomId: room.id,
|
|
8576
|
+
status: room.getStatus(),
|
|
8577
|
+
storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _205 => _205.toTreeNode, 'call', _206 => _206("root"), 'access', _207 => _207.payload]), () => ( null)),
|
|
8578
|
+
me,
|
|
8579
|
+
others
|
|
8580
|
+
});
|
|
8581
|
+
}
|
|
8582
|
+
var roomChannelListeners = /* @__PURE__ */ new Map();
|
|
8583
|
+
function stopRoomChannelListener(roomId) {
|
|
8584
|
+
const listener = roomChannelListeners.get(roomId);
|
|
8585
|
+
roomChannelListeners.delete(roomId);
|
|
8586
|
+
if (listener) {
|
|
8587
|
+
listener();
|
|
8659
8588
|
}
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
result[key] = isLiveStructure(val) ? val.toImmutable() : val;
|
|
8665
|
-
}
|
|
8666
|
-
for (const [key, val] of this.#local) {
|
|
8667
|
-
result[key] = val;
|
|
8668
|
-
}
|
|
8669
|
-
return process.env.NODE_ENV === "production" ? result : Object.freeze(result);
|
|
8589
|
+
}
|
|
8590
|
+
function linkDevTools(roomId, room) {
|
|
8591
|
+
if (process.env.NODE_ENV === "production" || typeof window === "undefined") {
|
|
8592
|
+
return;
|
|
8670
8593
|
}
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
)
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8594
|
+
sendToPanel({ msg: "room::available", roomId, clientVersion: VERSION });
|
|
8595
|
+
stopRoomChannelListener(roomId);
|
|
8596
|
+
roomChannelListeners.set(
|
|
8597
|
+
roomId,
|
|
8598
|
+
// Returns the unsubscribe callback, that we store in the
|
|
8599
|
+
// roomChannelListeners registry
|
|
8600
|
+
onMessageFromPanel.subscribe((msg) => {
|
|
8601
|
+
switch (msg.msg) {
|
|
8602
|
+
// Sent by the devtool panel when it wants to receive the sync stream
|
|
8603
|
+
// for a room
|
|
8604
|
+
case "room::subscribe": {
|
|
8605
|
+
if (msg.roomId === roomId) {
|
|
8606
|
+
startSyncStream(room);
|
|
8607
|
+
}
|
|
8608
|
+
break;
|
|
8609
|
+
}
|
|
8610
|
+
case "room::unsubscribe": {
|
|
8611
|
+
if (msg.roomId === roomId) {
|
|
8612
|
+
stopSyncStream(roomId);
|
|
8613
|
+
}
|
|
8614
|
+
break;
|
|
8615
|
+
}
|
|
8616
|
+
}
|
|
8617
|
+
})
|
|
8618
|
+
);
|
|
8619
|
+
}
|
|
8620
|
+
function unlinkDevTools(roomId) {
|
|
8621
|
+
if (process.env.NODE_ENV === "production" || typeof window === "undefined") {
|
|
8622
|
+
return;
|
|
8684
8623
|
}
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8624
|
+
stopSyncStream(roomId);
|
|
8625
|
+
stopRoomChannelListener(roomId);
|
|
8626
|
+
sendToPanel({
|
|
8627
|
+
msg: "room::unavailable",
|
|
8628
|
+
roomId
|
|
8629
|
+
});
|
|
8690
8630
|
}
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
return new LiveList([]);
|
|
8701
|
-
default:
|
|
8702
|
-
return assertNever(op, "Unknown creation Op");
|
|
8631
|
+
|
|
8632
|
+
// src/lib/warnings.ts
|
|
8633
|
+
var _emittedWarnings = /* @__PURE__ */ new Set();
|
|
8634
|
+
function warnOnce(message, key = message) {
|
|
8635
|
+
if (process.env.NODE_ENV !== "production") {
|
|
8636
|
+
if (!_emittedWarnings.has(key)) {
|
|
8637
|
+
_emittedWarnings.add(key);
|
|
8638
|
+
warn(message);
|
|
8639
|
+
}
|
|
8703
8640
|
}
|
|
8704
8641
|
}
|
|
8705
|
-
function
|
|
8706
|
-
if (
|
|
8707
|
-
|
|
8708
|
-
}
|
|
8709
|
-
if (node.parent.type === "HasParent") {
|
|
8710
|
-
return isSameNodeOrChildOf(node.parent.node, parent);
|
|
8642
|
+
function warnOnceIf(condition, message, key = message) {
|
|
8643
|
+
if (typeof condition === "function" ? condition() : condition) {
|
|
8644
|
+
warnOnce(message, key);
|
|
8711
8645
|
}
|
|
8712
|
-
return false;
|
|
8713
8646
|
}
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8647
|
+
|
|
8648
|
+
// src/protocol/NotificationSettings.ts
|
|
8649
|
+
var kPlain = Symbol("notification-settings-plain");
|
|
8650
|
+
function createNotificationSettings(plain) {
|
|
8651
|
+
const channels = [
|
|
8652
|
+
"email",
|
|
8653
|
+
"slack",
|
|
8654
|
+
"teams",
|
|
8655
|
+
"webPush"
|
|
8656
|
+
];
|
|
8657
|
+
const descriptors = {
|
|
8658
|
+
[kPlain]: {
|
|
8659
|
+
value: plain,
|
|
8660
|
+
enumerable: false
|
|
8661
|
+
}
|
|
8662
|
+
};
|
|
8663
|
+
for (const channel of channels) {
|
|
8664
|
+
descriptors[channel] = {
|
|
8665
|
+
enumerable: true,
|
|
8666
|
+
/**
|
|
8667
|
+
* In the TypeScript standard library definitions, the built-in interface for a property descriptor
|
|
8668
|
+
* does not include a specialized type for the “this” context in the getter or setter functions.
|
|
8669
|
+
* As a result, both the get and set methods implicitly have this: any.
|
|
8670
|
+
* The reason is that property descriptors in JavaScript are used across various objects with
|
|
8671
|
+
* no enforced shape for this. And so the standard library definitions have to remain as broad as possible
|
|
8672
|
+
* to support any valid JavaScript usage (e.g `Object.defineProperty`).
|
|
8673
|
+
*
|
|
8674
|
+
* So we can safely tells that this getter is typed as `this: NotificationSettings` because we're
|
|
8675
|
+
* creating a well known shaped object → `NotificationSettings`.
|
|
8676
|
+
*/
|
|
8677
|
+
get() {
|
|
8678
|
+
const value = this[kPlain][channel];
|
|
8679
|
+
if (typeof value === "undefined") {
|
|
8680
|
+
error2(
|
|
8681
|
+
`In order to use the '${channel}' channel, please set up your project first. For more information: https://liveblocks.io/docs/errors/enable-a-notification-channel`
|
|
8682
|
+
);
|
|
8683
|
+
return null;
|
|
8684
|
+
}
|
|
8685
|
+
return value;
|
|
8686
|
+
}
|
|
8687
|
+
};
|
|
8725
8688
|
}
|
|
8689
|
+
return create(null, descriptors);
|
|
8726
8690
|
}
|
|
8727
|
-
function
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
}
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8691
|
+
function patchNotificationSettings(existing, patch) {
|
|
8692
|
+
const outcoming = createNotificationSettings({
|
|
8693
|
+
...existing[kPlain]
|
|
8694
|
+
});
|
|
8695
|
+
for (const channel of keys(patch)) {
|
|
8696
|
+
const updates = patch[channel];
|
|
8697
|
+
if (updates !== void 0) {
|
|
8698
|
+
const kindUpdates = Object.fromEntries(
|
|
8699
|
+
entries(updates).filter(([, value]) => value !== void 0)
|
|
8700
|
+
);
|
|
8701
|
+
outcoming[kPlain][channel] = {
|
|
8702
|
+
...outcoming[kPlain][channel],
|
|
8703
|
+
...kindUpdates
|
|
8704
|
+
};
|
|
8705
|
+
}
|
|
8738
8706
|
}
|
|
8707
|
+
return outcoming;
|
|
8739
8708
|
}
|
|
8740
|
-
function
|
|
8741
|
-
return
|
|
8742
|
-
}
|
|
8743
|
-
function isLiveNode(value) {
|
|
8744
|
-
return isLiveStructure(value) || isLiveRegister(value);
|
|
8745
|
-
}
|
|
8746
|
-
function isLiveList(value) {
|
|
8747
|
-
return value instanceof LiveList;
|
|
8748
|
-
}
|
|
8749
|
-
function isLiveMap(value) {
|
|
8750
|
-
return value instanceof LiveMap;
|
|
8751
|
-
}
|
|
8752
|
-
function isLiveObject(value) {
|
|
8753
|
-
return value instanceof LiveObject;
|
|
8754
|
-
}
|
|
8755
|
-
function isLiveRegister(value) {
|
|
8756
|
-
return value instanceof LiveRegister;
|
|
8757
|
-
}
|
|
8758
|
-
function cloneLson(value) {
|
|
8759
|
-
return value === void 0 ? void 0 : isLiveStructure(value) ? value.clone() : deepClone(value);
|
|
8709
|
+
function isNotificationChannelEnabled(settings) {
|
|
8710
|
+
return settings !== null ? values(settings).every((enabled) => enabled === true) : false;
|
|
8760
8711
|
}
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
return assertNever(obj, "Unknown AbstractCrdt");
|
|
8712
|
+
|
|
8713
|
+
// src/brand.ts
|
|
8714
|
+
var OFFSET = "12px";
|
|
8715
|
+
var injectBrandBadge = (badgeLocation = "bottom-right") => {
|
|
8716
|
+
if (typeof document === "undefined") {
|
|
8717
|
+
return;
|
|
8768
8718
|
}
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
if (value instanceof LiveObject || value instanceof LiveMap || value instanceof LiveList) {
|
|
8772
|
-
return value;
|
|
8773
|
-
} else {
|
|
8774
|
-
return new LiveRegister(value);
|
|
8719
|
+
if (document.getElementById("liveblocks-badge")) {
|
|
8720
|
+
return;
|
|
8775
8721
|
}
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8722
|
+
const badgeDiv = document.createElement("div");
|
|
8723
|
+
badgeDiv.id = "liveblocks-badge";
|
|
8724
|
+
badgeDiv.style.position = "fixed";
|
|
8725
|
+
badgeDiv.style.opacity = "0";
|
|
8726
|
+
badgeDiv.style.transition = "opacity 300ms";
|
|
8727
|
+
badgeDiv.style.zIndex = "9999";
|
|
8728
|
+
switch (badgeLocation) {
|
|
8729
|
+
case "top-right":
|
|
8730
|
+
badgeDiv.style.top = OFFSET;
|
|
8731
|
+
badgeDiv.style.right = OFFSET;
|
|
8732
|
+
break;
|
|
8733
|
+
case "bottom-right":
|
|
8734
|
+
badgeDiv.style.bottom = OFFSET;
|
|
8735
|
+
badgeDiv.style.right = OFFSET;
|
|
8736
|
+
break;
|
|
8737
|
+
case "bottom-left":
|
|
8738
|
+
badgeDiv.style.bottom = OFFSET;
|
|
8739
|
+
badgeDiv.style.left = OFFSET;
|
|
8740
|
+
break;
|
|
8741
|
+
case "top-left":
|
|
8742
|
+
badgeDiv.style.top = OFFSET;
|
|
8743
|
+
badgeDiv.style.left = OFFSET;
|
|
8744
|
+
break;
|
|
8745
|
+
}
|
|
8746
|
+
badgeDiv.onmouseenter = () => {
|
|
8747
|
+
const hideButton2 = document.getElementById("liveblocks-badge-hide-button");
|
|
8748
|
+
if (hideButton2) {
|
|
8749
|
+
hideButton2.style.opacity = "0.3";
|
|
8782
8750
|
}
|
|
8783
|
-
}
|
|
8784
|
-
|
|
8785
|
-
const
|
|
8786
|
-
if (
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8751
|
+
};
|
|
8752
|
+
badgeDiv.onmouseleave = () => {
|
|
8753
|
+
const hideButton2 = document.getElementById("liveblocks-badge-hide-button");
|
|
8754
|
+
if (hideButton2) {
|
|
8755
|
+
hideButton2.style.opacity = "0";
|
|
8756
|
+
}
|
|
8757
|
+
};
|
|
8758
|
+
const link = document.createElement("a");
|
|
8759
|
+
link.href = "https://lblcks.io/badge";
|
|
8760
|
+
link.target = "_blank";
|
|
8761
|
+
link.rel = "noopener noreferrer";
|
|
8762
|
+
link.title = "Liveblocks";
|
|
8763
|
+
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
8764
|
+
svg.setAttribute("width", "111");
|
|
8765
|
+
svg.setAttribute("height", "38");
|
|
8766
|
+
svg.setAttribute("viewBox", "0 0 111 38");
|
|
8767
|
+
svg.setAttribute("fill", "none");
|
|
8768
|
+
const rect1 = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
8769
|
+
rect1.setAttribute("x", "1");
|
|
8770
|
+
rect1.setAttribute("y", "1");
|
|
8771
|
+
rect1.setAttribute("width", "109");
|
|
8772
|
+
rect1.setAttribute("height", "36");
|
|
8773
|
+
rect1.setAttribute("rx", "8");
|
|
8774
|
+
rect1.setAttribute("fill", "white");
|
|
8775
|
+
svg.appendChild(rect1);
|
|
8776
|
+
const rect2 = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
8777
|
+
rect2.setAttribute("x", "0.5");
|
|
8778
|
+
rect2.setAttribute("y", "0.5");
|
|
8779
|
+
rect2.setAttribute("width", "110");
|
|
8780
|
+
rect2.setAttribute("height", "37");
|
|
8781
|
+
rect2.setAttribute("rx", "8.5");
|
|
8782
|
+
rect2.setAttribute("stroke", "black");
|
|
8783
|
+
rect2.setAttribute("stroke-opacity", "0.1");
|
|
8784
|
+
svg.appendChild(rect2);
|
|
8785
|
+
const path1 = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
8786
|
+
path1.setAttribute(
|
|
8787
|
+
"d",
|
|
8788
|
+
"M39.8256 18.0832H38L38.0005 28.9009H39.8256V18.0832ZM43.213 21.1757H41.3879V28.9009H43.213V21.1757ZM43.213 18H41.3879V19.9688H43.213V18ZM45.8916 21.1757H43.9302L46.6915 28.9009H48.7283L51.4896 21.1757H49.5581L48.4039 24.8348C48.3739 24.93 48.2657 25.3024 48.0795 25.9511L47.7099 27.1959C47.4914 26.406 47.2626 25.6189 47.0237 24.8348L45.8916 21.1757ZM58.9659 23.59C58.8147 23.0721 58.5934 22.6317 58.3014 22.2694C57.9743 21.8628 57.5598 21.5482 57.0571 21.3268C56.5589 21.1004 56.0058 20.9877 55.3973 20.9877C54.2407 20.9877 53.3152 21.3495 52.6212 22.0735C52.275 22.4476 52.0103 22.8896 51.844 23.3715C51.6731 23.8691 51.5876 24.4199 51.5876 25.0233C51.5876 26.3157 51.9322 27.3142 52.6217 28.0184C53.3203 28.7323 54.2509 29.0894 55.4125 29.0894C56.4083 29.0894 57.2151 28.8658 57.8342 28.4181C58.453 27.9704 58.8628 27.3068 59.0638 26.4266L57.2834 26.2908C57.198 26.7685 57.0016 27.1257 56.6948 27.3618C56.3879 27.5933 55.9555 27.7093 55.3973 27.7093C54.1201 27.7093 53.4663 26.9899 53.4363 25.5514H59.1844L59.1922 25.295C59.1922 24.6763 59.1165 24.108 58.9659 23.59ZM53.8434 23.0471C54.1654 22.5943 54.6834 22.3679 55.3973 22.3679C55.7443 22.3679 56.0363 22.4155 56.2725 22.5111C56.509 22.6067 56.7128 22.7601 56.8837 22.9713C57.0167 23.1352 57.1189 23.3218 57.1855 23.5221C57.2605 23.731 57.3062 23.9493 57.3213 24.1708H53.451C53.4964 23.7231 53.6271 23.3484 53.8434 23.0471ZM66.2836 21.4779C65.7656 21.1406 65.1673 20.9724 64.4885 20.9724H64.4875C63.995 20.9724 63.5449 21.0727 63.1374 21.2742C62.7364 21.4696 62.3931 21.7659 62.1412 22.1341V18.0832H60.316V28.9009H62.1416V27.8373C62.373 28.2195 62.7008 28.5342 63.0921 28.7499C63.4996 28.9763 63.9497 29.0894 64.4422 29.0894C65.1266 29.0894 65.7324 28.9259 66.2614 28.5992C66.7891 28.2726 67.1989 27.8045 67.4905 27.1959C67.7871 26.5823 67.9359 25.8634 67.9359 25.0386C67.9359 24.2337 67.7895 23.5248 67.4984 22.9113C67.2115 22.2926 66.8066 21.8148 66.2836 21.4779ZM65.5064 27.0828C65.2148 27.5254 64.7172 27.7463 64.0125 27.7463C63.3786 27.7463 62.9013 27.5175 62.5797 27.0601C62.2576 26.6026 62.0968 25.9336 62.0968 25.0534C62.0968 24.2032 62.24 23.5397 62.5265 23.0619C62.8185 22.579 63.3088 22.3378 63.9978 22.3378C64.7019 22.3378 65.2023 22.5592 65.499 23.0013C65.7961 23.4389 65.944 24.1181 65.944 25.0386C65.944 25.9585 65.7985 26.6401 65.5064 27.0828ZM70.901 18.0832H69.0754V28.9009H70.901V18.0832ZM73.8582 28.6066C74.452 28.9286 75.1558 29.0894 75.9708 29.0894C76.7554 29.0894 77.4444 28.9208 78.0377 28.5844C78.6268 28.2569 79.1068 27.7637 79.4183 27.1659C79.745 26.5523 79.9086 25.843 79.9086 25.0386C79.9086 24.2642 79.7478 23.5697 79.4257 22.9565C79.117 22.3516 78.6404 21.8487 78.0529 21.508C77.4592 21.161 76.7652 20.9872 75.9708 20.9872C75.171 20.9872 74.4719 21.161 73.8735 21.508C73.2876 21.8472 72.811 22.3471 72.5002 22.9486C72.1837 23.5572 72.0252 24.254 72.0252 25.0386C72.0252 25.8735 72.181 26.5948 72.4929 27.2033C72.7962 27.798 73.2722 28.2871 73.8582 28.6066ZM77.4869 27.0906C77.18 27.5231 76.6746 27.7393 75.9708 27.7393C75.493 27.7393 75.1082 27.6437 74.8166 27.4524C74.5246 27.2565 74.3134 26.9621 74.1826 26.5699C74.0518 26.1725 73.9867 25.6619 73.9867 25.0381C73.9867 24.1029 74.1401 23.419 74.4469 22.9866C74.7588 22.5541 75.2667 22.3378 75.9708 22.3378C76.6699 22.3378 77.1727 22.5541 77.4795 22.9866C77.7914 23.419 77.9471 24.1029 77.9471 25.0386C77.9471 25.9738 77.7937 26.6576 77.4869 27.0906ZM82.3982 28.6066C82.9869 28.9286 83.6883 29.0894 84.5033 29.0894C85.1369 29.0894 85.7029 28.9791 86.2005 28.7577C86.6989 28.5364 87.1031 28.2272 87.4152 27.8299C87.7279 27.4249 87.9329 26.9471 88.0109 26.4414L86.2534 26.2607C86.1328 26.7431 85.9316 27.1031 85.6497 27.3392C85.3683 27.5757 84.9857 27.694 84.5033 27.694C84.0103 27.694 83.6232 27.5933 83.3413 27.3918C83.0598 27.1858 82.8635 26.8919 82.7531 26.5093C82.6422 26.1221 82.5872 25.6318 82.5872 25.0386C82.5872 24.455 82.6422 23.9722 82.7531 23.59C82.8635 23.2028 83.0571 22.9062 83.3339 22.6997C83.6157 22.4884 84.0053 22.3831 84.5033 22.3831C85.0362 22.3831 85.4312 22.5314 85.6877 22.8281C85.949 23.1196 86.1354 23.5193 86.2456 24.0276L87.9735 23.718C87.8078 22.8932 87.4326 22.232 86.8491 21.7344C86.2708 21.2363 85.489 20.9877 84.5033 20.9877C83.6985 20.9877 83.0021 21.1587 82.4134 21.5006C81.8322 21.8351 81.3625 22.3337 81.0633 22.9339C80.7514 23.5424 80.5952 24.2439 80.5952 25.0386C80.5952 25.8781 80.7486 26.6026 81.0554 27.2112C81.3673 27.8197 81.8151 28.285 82.3982 28.6066ZM90.8104 26.0343L91.6627 25.2192L93.9257 28.9009H96.0308L92.8999 24.0498L95.9328 21.1757H93.5634L90.8104 23.9976V18.0832H88.9845V28.9009H90.8104V26.0343ZM97.6304 28.8103C98.1436 28.9965 98.7142 29.0894 99.3428 29.0894C100.303 29.0894 101.095 28.8981 101.719 28.5165C102.348 28.1339 102.663 27.5101 102.663 26.6451C102.663 26.0818 102.516 25.6392 102.225 25.3176C101.933 24.9905 101.586 24.7566 101.184 24.6157C100.786 24.4702 100.245 24.3219 99.562 24.1707C99.1642 24.0853 98.8502 24.0049 98.6188 23.9295C98.3873 23.8538 98.201 23.7558 98.0604 23.6352C97.925 23.5141 97.8567 23.3584 97.8567 23.1676C97.8567 22.8858 97.9824 22.6723 98.2338 22.5263C98.4853 22.3803 98.7973 22.3073 99.1694 22.3073C99.6619 22.3073 100.047 22.4255 100.324 22.6621C100.605 22.8987 100.756 23.2531 100.776 23.7258L102.466 23.4467C102.385 22.5817 102.046 21.9556 101.447 21.568C100.854 21.1812 100.095 20.9872 99.1694 20.9872C98.6258 20.9872 98.1236 21.0699 97.6607 21.2362C97.2029 21.397 96.8335 21.6511 96.5517 21.9986C96.27 22.3451 96.1294 22.7827 96.1294 23.3109C96.1294 23.7988 96.25 24.1934 96.4911 24.4951C96.7368 24.8001 97.0527 25.0408 97.4118 25.1965C97.7838 25.3578 98.2512 25.5112 98.8147 25.6567L99.2828 25.7699C99.5949 25.844 99.9044 25.9295 100.211 26.0264C100.421 26.092 100.595 26.1826 100.731 26.2981C100.867 26.4136 100.935 26.5647 100.935 26.7509C100.935 27.0776 100.799 27.3294 100.527 27.505C100.261 27.6815 99.8708 27.7693 99.3583 27.7693C98.8347 27.7693 98.4176 27.6385 98.1055 27.377C97.7941 27.1154 97.6355 26.7384 97.6304 26.2454L95.9109 26.4413C95.9302 27.0351 96.094 27.5304 96.4009 27.9278C96.7129 28.3252 97.1223 28.619 97.6304 28.8103Z"
|
|
8789
|
+
);
|
|
8790
|
+
path1.setAttribute("fill", "black");
|
|
8791
|
+
svg.appendChild(path1);
|
|
8792
|
+
const path2 = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
8793
|
+
path2.setAttribute(
|
|
8794
|
+
"d",
|
|
8795
|
+
"M37.6392 15V9.18182H39.7131C40.1657 9.18182 40.5407 9.2642 40.8381 9.42898C41.1354 9.59375 41.358 9.81913 41.5057 10.1051C41.6534 10.3892 41.7273 10.7093 41.7273 11.0653C41.7273 11.4233 41.6525 11.7453 41.5028 12.0312C41.3551 12.3153 41.1316 12.5407 40.8324 12.7074C40.535 12.8722 40.161 12.9545 39.7102 12.9545H38.2841V12.2102H39.6307C39.9167 12.2102 40.1487 12.161 40.3267 12.0625C40.5047 11.9621 40.6354 11.8258 40.7188 11.6534C40.8021 11.4811 40.8438 11.285 40.8438 11.0653C40.8438 10.8456 40.8021 10.6506 40.7188 10.4801C40.6354 10.3097 40.5038 10.1761 40.3239 10.0795C40.1458 9.98295 39.911 9.93466 39.6193 9.93466H38.517V15H37.6392ZM44.4716 15.0881C44.0625 15.0881 43.7055 14.9943 43.4006 14.8068C43.0956 14.6193 42.8589 14.357 42.6903 14.0199C42.5218 13.6828 42.4375 13.2888 42.4375 12.8381C42.4375 12.3854 42.5218 11.9896 42.6903 11.6506C42.8589 11.3116 43.0956 11.0483 43.4006 10.8608C43.7055 10.6733 44.0625 10.5795 44.4716 10.5795C44.8807 10.5795 45.2377 10.6733 45.5426 10.8608C45.8475 11.0483 46.0843 11.3116 46.2528 11.6506C46.4214 11.9896 46.5057 12.3854 46.5057 12.8381C46.5057 13.2888 46.4214 13.6828 46.2528 14.0199C46.0843 14.357 45.8475 14.6193 45.5426 14.8068C45.2377 14.9943 44.8807 15.0881 44.4716 15.0881ZM44.4744 14.375C44.7396 14.375 44.9593 14.3049 45.1335 14.1648C45.3078 14.0246 45.4366 13.8381 45.5199 13.6051C45.6051 13.3722 45.6477 13.1155 45.6477 12.8352C45.6477 12.5568 45.6051 12.3011 45.5199 12.0682C45.4366 11.8333 45.3078 11.6449 45.1335 11.5028C44.9593 11.3608 44.7396 11.2898 44.4744 11.2898C44.2074 11.2898 43.9858 11.3608 43.8097 11.5028C43.6354 11.6449 43.5057 11.8333 43.4205 12.0682C43.3371 12.3011 43.2955 12.5568 43.2955 12.8352C43.2955 13.1155 43.3371 13.3722 43.4205 13.6051C43.5057 13.8381 43.6354 14.0246 43.8097 14.1648C43.9858 14.3049 44.2074 14.375 44.4744 14.375ZM48.267 15L46.983 10.6364H47.8608L48.7159 13.8409H48.7585L49.6165 10.6364H50.4943L51.3466 13.8267H51.3892L52.2386 10.6364H53.1165L51.8352 15H50.9688L50.0824 11.8494H50.017L49.1307 15H48.267ZM55.6705 15.0881C55.2405 15.0881 54.8703 14.9962 54.5597 14.8125C54.2509 14.6269 54.0123 14.3665 53.8438 14.0312C53.6771 13.6941 53.5938 13.2992 53.5938 12.8466C53.5938 12.3996 53.6771 12.0057 53.8438 11.6648C54.0123 11.3239 54.2472 11.0578 54.5483 10.8665C54.8513 10.6752 55.2055 10.5795 55.6108 10.5795C55.857 10.5795 56.0956 10.6203 56.3267 10.7017C56.5578 10.7831 56.7652 10.911 56.9489 11.0852C57.1326 11.2595 57.2775 11.4858 57.3835 11.7642C57.4896 12.0407 57.5426 12.3769 57.5426 12.7727V13.0739H54.0739V12.4375H56.7102C56.7102 12.214 56.6648 12.0161 56.5739 11.8438C56.483 11.6695 56.3551 11.5322 56.1903 11.4318C56.0275 11.3314 55.8362 11.2812 55.6165 11.2812C55.3778 11.2812 55.1695 11.34 54.9915 11.4574C54.8153 11.5729 54.679 11.7244 54.5824 11.9119C54.4877 12.0975 54.4403 12.2992 54.4403 12.517V13.0142C54.4403 13.3059 54.4915 13.554 54.5938 13.7585C54.6979 13.9631 54.8428 14.1193 55.0284 14.2273C55.214 14.3333 55.4309 14.3864 55.679 14.3864C55.84 14.3864 55.9867 14.3636 56.1193 14.3182C56.2519 14.2708 56.3665 14.2008 56.4631 14.108C56.5597 14.0152 56.6335 13.9006 56.6847 13.7642L57.4886 13.9091C57.4242 14.1458 57.3087 14.3532 57.142 14.5312C56.9773 14.7074 56.7699 14.8447 56.5199 14.9432C56.2718 15.0398 55.9886 15.0881 55.6705 15.0881ZM58.4851 15V10.6364H59.3061V11.3295H59.3516C59.4311 11.0947 59.5713 10.91 59.772 10.7756C59.9747 10.6392 60.2038 10.571 60.4595 10.571C60.5125 10.571 60.575 10.5729 60.647 10.5767C60.7209 10.5805 60.7786 10.5852 60.8203 10.5909V11.4034C60.7862 11.3939 60.7256 11.3835 60.6385 11.3722C60.5514 11.3589 60.4643 11.3523 60.3771 11.3523C60.1764 11.3523 59.9974 11.3949 59.8402 11.4801C59.6849 11.5634 59.5618 11.6799 59.4709 11.8295C59.38 11.9773 59.3345 12.1458 59.3345 12.3352V15H58.4851ZM63.2798 15.0881C62.8499 15.0881 62.4796 14.9962 62.169 14.8125C61.8603 14.6269 61.6217 14.3665 61.4531 14.0312C61.2865 13.6941 61.2031 13.2992 61.2031 12.8466C61.2031 12.3996 61.2865 12.0057 61.4531 11.6648C61.6217 11.3239 61.8565 11.0578 62.1577 10.8665C62.4607 10.6752 62.8149 10.5795 63.2202 10.5795C63.4664 10.5795 63.705 10.6203 63.9361 10.7017C64.1671 10.7831 64.3745 10.911 64.5582 11.0852C64.742 11.2595 64.8868 11.4858 64.9929 11.7642C65.099 12.0407 65.152 12.3769 65.152 12.7727V13.0739H61.6832V12.4375H64.3196C64.3196 12.214 64.2741 12.0161 64.1832 11.8438C64.0923 11.6695 63.9645 11.5322 63.7997 11.4318C63.6368 11.3314 63.4455 11.2812 63.2259 11.2812C62.9872 11.2812 62.7789 11.34 62.6009 11.4574C62.4247 11.5729 62.2884 11.7244 62.1918 11.9119C62.0971 12.0975 62.0497 12.2992 62.0497 12.517V13.0142C62.0497 13.3059 62.1009 13.554 62.2031 13.7585C62.3073 13.9631 62.4522 14.1193 62.6378 14.2273C62.8234 14.3333 63.0402 14.3864 63.2884 14.3864C63.4493 14.3864 63.5961 14.3636 63.7287 14.3182C63.8613 14.2708 63.9759 14.2008 64.0724 14.108C64.169 14.0152 64.2429 13.9006 64.294 13.7642L65.098 13.9091C65.0336 14.1458 64.9181 14.3532 64.7514 14.5312C64.5866 14.7074 64.3793 14.8447 64.1293 14.9432C63.8812 15.0398 63.598 15.0881 63.2798 15.0881ZM67.728 15.0852C67.3757 15.0852 67.0613 14.9953 66.7848 14.8153C66.5102 14.6335 66.2943 14.375 66.1371 14.0398C65.9818 13.7027 65.9041 13.2983 65.9041 12.8267C65.9041 12.3551 65.9827 11.9517 66.1399 11.6165C66.299 11.2812 66.5168 11.0246 66.7933 10.8466C67.0698 10.6686 67.3833 10.5795 67.7337 10.5795C68.0045 10.5795 68.2223 10.625 68.3871 10.7159C68.5537 10.8049 68.6825 10.9091 68.7734 11.0284C68.8662 11.1477 68.9382 11.2528 68.9893 11.3438H69.0405V9.18182H69.8899V15H69.0604V14.321H68.9893C68.9382 14.4138 68.8643 14.5199 68.7678 14.6392C68.6731 14.7585 68.5424 14.8627 68.3757 14.9517C68.209 15.0407 67.9931 15.0852 67.728 15.0852ZM67.9155 14.3608C68.1598 14.3608 68.3662 14.2964 68.5348 14.1676C68.7053 14.0369 68.834 13.8561 68.9212 13.625C69.0102 13.3939 69.0547 13.125 69.0547 12.8182C69.0547 12.5152 69.0111 12.25 68.924 12.0227C68.8369 11.7955 68.709 11.6184 68.5405 11.4915C68.3719 11.3646 68.1636 11.3011 67.9155 11.3011C67.6598 11.3011 67.4467 11.3674 67.2763 11.5C67.1058 11.6326 66.977 11.8134 66.8899 12.0426C66.8047 12.2718 66.7621 12.5303 66.7621 12.8182C66.7621 13.1098 66.8056 13.3722 66.8928 13.6051C66.9799 13.8381 67.1087 14.0227 67.2791 14.1591C67.4515 14.2936 67.6636 14.3608 67.9155 14.3608ZM73.2876 15V9.18182H74.1371V11.3438H74.1882C74.2375 11.2528 74.3085 11.1477 74.4013 11.0284C74.4941 10.9091 74.6229 10.8049 74.7876 10.7159C74.9524 10.625 75.1702 10.5795 75.4411 10.5795C75.7933 10.5795 76.1077 10.6686 76.3842 10.8466C76.6607 11.0246 76.8776 11.2812 77.0348 11.6165C77.1939 11.9517 77.2734 12.3551 77.2734 12.8267C77.2734 13.2983 77.1948 13.7027 77.0376 14.0398C76.8804 14.375 76.6645 14.6335 76.3899 14.8153C76.1153 14.9953 75.8018 15.0852 75.4496 15.0852C75.1844 15.0852 74.9676 15.0407 74.799 14.9517C74.6323 14.8627 74.5017 14.7585 74.407 14.6392C74.3123 14.5199 74.2393 14.4138 74.1882 14.321H74.1172V15H73.2876ZM74.12 12.8182C74.12 13.125 74.1645 13.3939 74.2536 13.625C74.3426 13.8561 74.4714 14.0369 74.6399 14.1676C74.8085 14.2964 75.0149 14.3608 75.2592 14.3608C75.513 14.3608 75.7251 14.2936 75.8956 14.1591C76.0661 14.0227 76.1948 13.8381 76.282 13.6051C76.371 13.3722 76.4155 13.1098 76.4155 12.8182C76.4155 12.5303 76.3719 12.2718 76.2848 12.0426C76.1996 11.8134 76.0708 11.6326 75.8984 11.5C75.728 11.3674 75.5149 11.3011 75.2592 11.3011C75.013 11.3011 74.8047 11.3646 74.6342 11.4915C74.4657 11.6184 74.3378 11.7955 74.2507 12.0227C74.1636 12.25 74.12 12.5152 74.12 12.8182ZM78.6158 16.6364C78.4889 16.6364 78.3733 16.6259 78.2692 16.6051C78.165 16.5862 78.0874 16.5653 78.0362 16.5426L78.2408 15.8466C78.3961 15.8883 78.5343 15.9063 78.6555 15.9006C78.7768 15.8949 78.8838 15.8494 78.9766 15.7642C79.0713 15.679 79.1546 15.5398 79.2266 15.3466L79.3317 15.0568L77.7351 10.6364H78.6442L79.7493 14.0227H79.7947L80.8999 10.6364H81.8118L80.0135 15.5824C79.9302 15.8097 79.8241 16.0019 79.6953 16.1591C79.5665 16.3182 79.4131 16.4375 79.2351 16.517C79.0571 16.5966 78.8506 16.6364 78.6158 16.6364Z"
|
|
8796
|
+
);
|
|
8797
|
+
path2.setAttribute("fill", "black");
|
|
8798
|
+
path2.setAttribute("fill-opacity", "0.5");
|
|
8799
|
+
svg.appendChild(path2);
|
|
8800
|
+
const rect3 = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
8801
|
+
rect3.setAttribute("x", "7");
|
|
8802
|
+
rect3.setAttribute("y", "7");
|
|
8803
|
+
rect3.setAttribute("width", "24");
|
|
8804
|
+
rect3.setAttribute("height", "24");
|
|
8805
|
+
rect3.setAttribute("rx", "3");
|
|
8806
|
+
rect3.setAttribute("fill", "black");
|
|
8807
|
+
svg.appendChild(rect3);
|
|
8808
|
+
const path3 = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
8809
|
+
path3.setAttribute("fill-rule", "evenodd");
|
|
8810
|
+
path3.setAttribute("clip-rule", "evenodd");
|
|
8811
|
+
path3.setAttribute(
|
|
8812
|
+
"d",
|
|
8813
|
+
"M22.0455 15H12.2273L15.1364 17.9091V21.9091L22.0455 15Z"
|
|
8814
|
+
);
|
|
8815
|
+
path3.setAttribute("fill", "white");
|
|
8816
|
+
svg.appendChild(path3);
|
|
8817
|
+
const path4 = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
8818
|
+
path4.setAttribute("fill-rule", "evenodd");
|
|
8819
|
+
path4.setAttribute("clip-rule", "evenodd");
|
|
8820
|
+
path4.setAttribute(
|
|
8821
|
+
"d",
|
|
8822
|
+
"M16.9546 22.9999H26.7728L23.8637 20.0908V16.0908L16.9546 22.9999Z"
|
|
8823
|
+
);
|
|
8824
|
+
path4.setAttribute("fill", "white");
|
|
8825
|
+
svg.appendChild(path4);
|
|
8826
|
+
link.appendChild(svg);
|
|
8827
|
+
badgeDiv.appendChild(link);
|
|
8828
|
+
const hideButton = document.createElement("button");
|
|
8829
|
+
hideButton.id = "liveblocks-badge-hide-button";
|
|
8830
|
+
hideButton.style.position = "absolute";
|
|
8831
|
+
hideButton.style.top = "0";
|
|
8832
|
+
hideButton.style.right = "0";
|
|
8833
|
+
hideButton.style.border = "none";
|
|
8834
|
+
hideButton.style.padding = "0";
|
|
8835
|
+
hideButton.style.margin = "0";
|
|
8836
|
+
hideButton.style.background = "none";
|
|
8837
|
+
hideButton.style.font = "inherit";
|
|
8838
|
+
hideButton.style.cursor = "pointer";
|
|
8839
|
+
hideButton.style.outline = "none";
|
|
8840
|
+
hideButton.style.setProperty("-webkit-appearance", "none");
|
|
8841
|
+
hideButton.style.setProperty("-moz-appearance", "none");
|
|
8842
|
+
hideButton.style.setProperty("appearance", "none");
|
|
8843
|
+
hideButton.style.opacity = "0";
|
|
8844
|
+
hideButton.onclick = () => {
|
|
8845
|
+
const badge2 = document.getElementById("liveblocks-badge");
|
|
8846
|
+
if (badge2) {
|
|
8847
|
+
badge2.style.display = "none";
|
|
8845
8848
|
}
|
|
8846
|
-
});
|
|
8847
|
-
return ops;
|
|
8848
|
-
}
|
|
8849
|
-
function mergeObjectStorageUpdates(first, second) {
|
|
8850
|
-
const updates = first.updates;
|
|
8851
|
-
for (const [key, value] of entries(second.updates)) {
|
|
8852
|
-
updates[key] = value;
|
|
8853
|
-
}
|
|
8854
|
-
return {
|
|
8855
|
-
...second,
|
|
8856
|
-
updates
|
|
8857
8849
|
};
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
const updates = first.updates;
|
|
8861
|
-
for (const [key, value] of entries(second.updates)) {
|
|
8862
|
-
updates[key] = value;
|
|
8863
|
-
}
|
|
8864
|
-
return {
|
|
8865
|
-
...second,
|
|
8866
|
-
updates
|
|
8850
|
+
hideButton.onmouseenter = () => {
|
|
8851
|
+
hideButton.style.opacity = "0.5";
|
|
8867
8852
|
};
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
const updates = first.updates;
|
|
8871
|
-
return {
|
|
8872
|
-
...second,
|
|
8873
|
-
updates: updates.concat(second.updates)
|
|
8853
|
+
hideButton.onmouseleave = () => {
|
|
8854
|
+
hideButton.style.opacity = "0.3";
|
|
8874
8855
|
};
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
}
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
return {
|
|
8897
|
-
path: path || "root",
|
|
8898
|
-
value
|
|
8899
|
-
};
|
|
8900
|
-
}
|
|
8901
|
-
if (typeof value !== "object" || value === null) {
|
|
8902
|
-
return false;
|
|
8903
|
-
}
|
|
8904
|
-
for (const [key, nestedValue] of Object.entries(value)) {
|
|
8905
|
-
const nestedPath = path ? path + "." + key : key;
|
|
8906
|
-
if (!isPlain(nestedValue)) {
|
|
8907
|
-
return {
|
|
8908
|
-
path: nestedPath,
|
|
8909
|
-
value: nestedValue
|
|
8910
|
-
};
|
|
8911
|
-
}
|
|
8912
|
-
if (typeof nestedValue === "object") {
|
|
8913
|
-
const nonSerializableNestedValue = findNonSerializableValue(
|
|
8914
|
-
nestedValue,
|
|
8915
|
-
nestedPath
|
|
8916
|
-
);
|
|
8917
|
-
if (nonSerializableNestedValue) {
|
|
8918
|
-
return nonSerializableNestedValue;
|
|
8919
|
-
}
|
|
8920
|
-
}
|
|
8921
|
-
}
|
|
8922
|
-
return false;
|
|
8923
|
-
}
|
|
8856
|
+
const hideSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
8857
|
+
hideSvg.setAttribute("width", "18");
|
|
8858
|
+
hideSvg.setAttribute("height", "18");
|
|
8859
|
+
hideSvg.setAttribute("viewBox", "0 0 18 18");
|
|
8860
|
+
hideSvg.setAttribute("fill", "none");
|
|
8861
|
+
const hidePath = document.createElementNS(
|
|
8862
|
+
"http://www.w3.org/2000/svg",
|
|
8863
|
+
"path"
|
|
8864
|
+
);
|
|
8865
|
+
hidePath.setAttribute("d", "M6 6L9 9M12 12L9 9M9 9L12 6M9 9L6 12");
|
|
8866
|
+
hidePath.setAttribute("stroke", "black");
|
|
8867
|
+
hideSvg.appendChild(hidePath);
|
|
8868
|
+
hideButton.appendChild(hideSvg);
|
|
8869
|
+
badgeDiv.appendChild(hideButton);
|
|
8870
|
+
document.body.appendChild(badgeDiv);
|
|
8871
|
+
requestAnimationFrame(() => {
|
|
8872
|
+
requestAnimationFrame(() => {
|
|
8873
|
+
badgeDiv.style.opacity = "1";
|
|
8874
|
+
});
|
|
8875
|
+
});
|
|
8876
|
+
};
|
|
8924
8877
|
|
|
8925
8878
|
// src/lib/Deque.ts
|
|
8926
8879
|
var Deque = class {
|
|
@@ -11288,7 +11241,17 @@ function createClient(options) {
|
|
|
11288
11241
|
}
|
|
11289
11242
|
const options2 = _nullishCoalesce(args[0], () => ( {}));
|
|
11290
11243
|
const initialPresence = _nullishCoalesce((typeof options2.initialPresence === "function" ? options2.initialPresence(roomId) : options2.initialPresence), () => ( {}));
|
|
11291
|
-
const
|
|
11244
|
+
const rawStorage = _nullishCoalesce((typeof options2.initialStorage === "function" ? options2.initialStorage(roomId) : options2.initialStorage), () => ( {}));
|
|
11245
|
+
let initialStorage;
|
|
11246
|
+
if (isLiveObject(rawStorage)) {
|
|
11247
|
+
const obj = {};
|
|
11248
|
+
for (const key of rawStorage.keys()) {
|
|
11249
|
+
obj[key] = rawStorage.get(key);
|
|
11250
|
+
}
|
|
11251
|
+
initialStorage = obj;
|
|
11252
|
+
} else {
|
|
11253
|
+
initialStorage = rawStorage;
|
|
11254
|
+
}
|
|
11292
11255
|
const newRoom = createRoom(
|
|
11293
11256
|
{ initialPresence, initialStorage },
|
|
11294
11257
|
{
|
|
@@ -11890,14 +11853,14 @@ async function stringifyCommentBody(body, options) {
|
|
|
11890
11853
|
// src/crdts/utils.ts
|
|
11891
11854
|
function toPlainLson(lson) {
|
|
11892
11855
|
if (lson instanceof LiveObject) {
|
|
11893
|
-
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
};
|
|
11856
|
+
const data = {};
|
|
11857
|
+
for (const key of lson.keys()) {
|
|
11858
|
+
const value = lson.get(key);
|
|
11859
|
+
if (value !== void 0) {
|
|
11860
|
+
data[key] = toPlainLson(value);
|
|
11861
|
+
}
|
|
11862
|
+
}
|
|
11863
|
+
return { liveblocksType: "LiveObject", data };
|
|
11901
11864
|
} else if (lson instanceof LiveMap) {
|
|
11902
11865
|
return {
|
|
11903
11866
|
liveblocksType: "LiveMap",
|
|
@@ -11915,292 +11878,6 @@ function toPlainLson(lson) {
|
|
|
11915
11878
|
}
|
|
11916
11879
|
}
|
|
11917
11880
|
|
|
11918
|
-
// src/immutable.ts
|
|
11919
|
-
function lsonObjectToJson(obj) {
|
|
11920
|
-
const result = {};
|
|
11921
|
-
for (const key in obj) {
|
|
11922
|
-
const val = obj[key];
|
|
11923
|
-
if (val !== void 0) {
|
|
11924
|
-
result[key] = lsonToJson(val);
|
|
11925
|
-
}
|
|
11926
|
-
}
|
|
11927
|
-
return result;
|
|
11928
|
-
}
|
|
11929
|
-
function liveObjectToJson(liveObject) {
|
|
11930
|
-
return lsonObjectToJson(liveObject.toObject());
|
|
11931
|
-
}
|
|
11932
|
-
function liveMapToJson(map) {
|
|
11933
|
-
const result = {};
|
|
11934
|
-
for (const [key, value] of map.entries()) {
|
|
11935
|
-
result[key] = lsonToJson(value);
|
|
11936
|
-
}
|
|
11937
|
-
return result;
|
|
11938
|
-
}
|
|
11939
|
-
function lsonListToJson(value) {
|
|
11940
|
-
return value.map(lsonToJson);
|
|
11941
|
-
}
|
|
11942
|
-
function liveListToJson(value) {
|
|
11943
|
-
return lsonListToJson(value.toArray());
|
|
11944
|
-
}
|
|
11945
|
-
function lsonToJson(value) {
|
|
11946
|
-
if (value instanceof LiveObject) {
|
|
11947
|
-
return liveObjectToJson(value);
|
|
11948
|
-
} else if (value instanceof LiveList) {
|
|
11949
|
-
return liveListToJson(value);
|
|
11950
|
-
} else if (value instanceof LiveMap) {
|
|
11951
|
-
return liveMapToJson(value);
|
|
11952
|
-
} else if (value instanceof LiveRegister) {
|
|
11953
|
-
return value.data;
|
|
11954
|
-
}
|
|
11955
|
-
if (Array.isArray(value)) {
|
|
11956
|
-
return lsonListToJson(value);
|
|
11957
|
-
} else if (isPlainObject(value)) {
|
|
11958
|
-
return lsonObjectToJson(value);
|
|
11959
|
-
}
|
|
11960
|
-
return value;
|
|
11961
|
-
}
|
|
11962
|
-
function legacy_patchLiveList(liveList, prev, next) {
|
|
11963
|
-
let i = 0;
|
|
11964
|
-
let prevEnd = prev.length - 1;
|
|
11965
|
-
let nextEnd = next.length - 1;
|
|
11966
|
-
let prevNode = prev[0];
|
|
11967
|
-
let nextNode = next[0];
|
|
11968
|
-
outer: {
|
|
11969
|
-
while (prevNode === nextNode) {
|
|
11970
|
-
++i;
|
|
11971
|
-
if (i > prevEnd || i > nextEnd) {
|
|
11972
|
-
break outer;
|
|
11973
|
-
}
|
|
11974
|
-
prevNode = prev[i];
|
|
11975
|
-
nextNode = next[i];
|
|
11976
|
-
}
|
|
11977
|
-
prevNode = prev[prevEnd];
|
|
11978
|
-
nextNode = next[nextEnd];
|
|
11979
|
-
while (prevNode === nextNode) {
|
|
11980
|
-
prevEnd--;
|
|
11981
|
-
nextEnd--;
|
|
11982
|
-
if (i > prevEnd || i > nextEnd) {
|
|
11983
|
-
break outer;
|
|
11984
|
-
}
|
|
11985
|
-
prevNode = prev[prevEnd];
|
|
11986
|
-
nextNode = next[nextEnd];
|
|
11987
|
-
}
|
|
11988
|
-
}
|
|
11989
|
-
if (i > prevEnd) {
|
|
11990
|
-
if (i <= nextEnd) {
|
|
11991
|
-
while (i <= nextEnd) {
|
|
11992
|
-
liveList.insert(deepLiveify(next[i]), i);
|
|
11993
|
-
i++;
|
|
11994
|
-
}
|
|
11995
|
-
}
|
|
11996
|
-
} else if (i > nextEnd) {
|
|
11997
|
-
let localI = i;
|
|
11998
|
-
while (localI <= prevEnd) {
|
|
11999
|
-
liveList.delete(i);
|
|
12000
|
-
localI++;
|
|
12001
|
-
}
|
|
12002
|
-
} else {
|
|
12003
|
-
while (i <= prevEnd && i <= nextEnd) {
|
|
12004
|
-
prevNode = prev[i];
|
|
12005
|
-
nextNode = next[i];
|
|
12006
|
-
const liveListNode = liveList.get(i);
|
|
12007
|
-
if (isLiveObject(liveListNode) && isPlainObject(prevNode) && isPlainObject(nextNode)) {
|
|
12008
|
-
legacy_patchLiveObject(liveListNode, prevNode, nextNode);
|
|
12009
|
-
} else {
|
|
12010
|
-
liveList.set(i, deepLiveify(nextNode));
|
|
12011
|
-
}
|
|
12012
|
-
i++;
|
|
12013
|
-
}
|
|
12014
|
-
while (i <= nextEnd) {
|
|
12015
|
-
liveList.insert(deepLiveify(next[i]), i);
|
|
12016
|
-
i++;
|
|
12017
|
-
}
|
|
12018
|
-
let localI = i;
|
|
12019
|
-
while (localI <= prevEnd) {
|
|
12020
|
-
liveList.delete(i);
|
|
12021
|
-
localI++;
|
|
12022
|
-
}
|
|
12023
|
-
}
|
|
12024
|
-
}
|
|
12025
|
-
function legacy_patchLiveObjectKey(liveObject, key, prev, next) {
|
|
12026
|
-
if (process.env.NODE_ENV !== "production") {
|
|
12027
|
-
const nonSerializableValue = findNonSerializableValue(next);
|
|
12028
|
-
if (nonSerializableValue) {
|
|
12029
|
-
error2(
|
|
12030
|
-
`New state path: '${nonSerializableValue.path}' value: '${String(
|
|
12031
|
-
nonSerializableValue.value
|
|
12032
|
-
)}' is not serializable.
|
|
12033
|
-
Only serializable value can be synced with Liveblocks.`
|
|
12034
|
-
);
|
|
12035
|
-
return;
|
|
12036
|
-
}
|
|
12037
|
-
}
|
|
12038
|
-
const value = liveObject.get(key);
|
|
12039
|
-
if (next === void 0) {
|
|
12040
|
-
liveObject.delete(key);
|
|
12041
|
-
} else if (value === void 0) {
|
|
12042
|
-
liveObject.set(key, deepLiveify(next));
|
|
12043
|
-
} else if (prev === next) {
|
|
12044
|
-
return;
|
|
12045
|
-
} else if (isLiveList(value) && Array.isArray(prev) && Array.isArray(next)) {
|
|
12046
|
-
legacy_patchLiveList(value, prev, next);
|
|
12047
|
-
} else if (isLiveObject(value) && isPlainObject(prev) && isPlainObject(next)) {
|
|
12048
|
-
legacy_patchLiveObject(value, prev, next);
|
|
12049
|
-
} else {
|
|
12050
|
-
liveObject.set(key, deepLiveify(next));
|
|
12051
|
-
}
|
|
12052
|
-
}
|
|
12053
|
-
function legacy_patchLiveObject(root, prev, next) {
|
|
12054
|
-
const updates = {};
|
|
12055
|
-
for (const key in next) {
|
|
12056
|
-
legacy_patchLiveObjectKey(root, key, prev[key], next[key]);
|
|
12057
|
-
}
|
|
12058
|
-
for (const key in prev) {
|
|
12059
|
-
if (next[key] === void 0) {
|
|
12060
|
-
root.delete(key);
|
|
12061
|
-
}
|
|
12062
|
-
}
|
|
12063
|
-
if (Object.keys(updates).length > 0) {
|
|
12064
|
-
root.update(updates);
|
|
12065
|
-
}
|
|
12066
|
-
}
|
|
12067
|
-
function getParentsPath(node) {
|
|
12068
|
-
const path = [];
|
|
12069
|
-
while (node.parent.type === "HasParent") {
|
|
12070
|
-
if (isLiveList(node.parent.node)) {
|
|
12071
|
-
path.push(node.parent.node._indexOfPosition(node.parent.key));
|
|
12072
|
-
} else {
|
|
12073
|
-
path.push(node.parent.key);
|
|
12074
|
-
}
|
|
12075
|
-
node = node.parent.node;
|
|
12076
|
-
}
|
|
12077
|
-
return path;
|
|
12078
|
-
}
|
|
12079
|
-
function legacy_patchImmutableObject(state, updates) {
|
|
12080
|
-
return updates.reduce(
|
|
12081
|
-
(state2, update) => legacy_patchImmutableObjectWithUpdate(state2, update),
|
|
12082
|
-
state
|
|
12083
|
-
);
|
|
12084
|
-
}
|
|
12085
|
-
function legacy_patchImmutableObjectWithUpdate(state, update) {
|
|
12086
|
-
const path = getParentsPath(update.node);
|
|
12087
|
-
return legacy_patchImmutableNode(state, path, update);
|
|
12088
|
-
}
|
|
12089
|
-
function legacy_patchImmutableNode(state, path, update) {
|
|
12090
|
-
const pathItem = path.pop();
|
|
12091
|
-
if (pathItem === void 0) {
|
|
12092
|
-
switch (update.type) {
|
|
12093
|
-
case "LiveObject": {
|
|
12094
|
-
if (!isJsonObject(state)) {
|
|
12095
|
-
throw new Error(
|
|
12096
|
-
"Internal: received update on LiveObject but state was not an object"
|
|
12097
|
-
);
|
|
12098
|
-
}
|
|
12099
|
-
const newState = Object.assign({}, state);
|
|
12100
|
-
for (const key in update.updates) {
|
|
12101
|
-
if (_optionalChain([update, 'access', _301 => _301.updates, 'access', _302 => _302[key], 'optionalAccess', _303 => _303.type]) === "update") {
|
|
12102
|
-
const val = update.node.get(key);
|
|
12103
|
-
if (val !== void 0) {
|
|
12104
|
-
newState[key] = lsonToJson(val);
|
|
12105
|
-
}
|
|
12106
|
-
} else if (_optionalChain([update, 'access', _304 => _304.updates, 'access', _305 => _305[key], 'optionalAccess', _306 => _306.type]) === "delete") {
|
|
12107
|
-
delete newState[key];
|
|
12108
|
-
}
|
|
12109
|
-
}
|
|
12110
|
-
return newState;
|
|
12111
|
-
}
|
|
12112
|
-
case "LiveList": {
|
|
12113
|
-
if (!Array.isArray(state)) {
|
|
12114
|
-
throw new Error(
|
|
12115
|
-
"Internal: received update on LiveList but state was not an array"
|
|
12116
|
-
);
|
|
12117
|
-
}
|
|
12118
|
-
let newState = state.map((x) => x);
|
|
12119
|
-
for (const listUpdate of update.updates) {
|
|
12120
|
-
if (listUpdate.type === "set") {
|
|
12121
|
-
newState = newState.map(
|
|
12122
|
-
(item, index) => index === listUpdate.index ? lsonToJson(listUpdate.item) : item
|
|
12123
|
-
);
|
|
12124
|
-
} else if (listUpdate.type === "insert") {
|
|
12125
|
-
if (listUpdate.index === newState.length) {
|
|
12126
|
-
newState.push(lsonToJson(listUpdate.item));
|
|
12127
|
-
} else {
|
|
12128
|
-
newState = [
|
|
12129
|
-
...newState.slice(0, listUpdate.index),
|
|
12130
|
-
lsonToJson(listUpdate.item),
|
|
12131
|
-
...newState.slice(listUpdate.index)
|
|
12132
|
-
];
|
|
12133
|
-
}
|
|
12134
|
-
} else if (listUpdate.type === "delete") {
|
|
12135
|
-
newState.splice(listUpdate.index, 1);
|
|
12136
|
-
} else if (listUpdate.type === "move") {
|
|
12137
|
-
if (listUpdate.previousIndex > listUpdate.index) {
|
|
12138
|
-
newState = [
|
|
12139
|
-
...newState.slice(0, listUpdate.index),
|
|
12140
|
-
lsonToJson(listUpdate.item),
|
|
12141
|
-
...newState.slice(listUpdate.index, listUpdate.previousIndex),
|
|
12142
|
-
...newState.slice(listUpdate.previousIndex + 1)
|
|
12143
|
-
];
|
|
12144
|
-
} else {
|
|
12145
|
-
newState = [
|
|
12146
|
-
...newState.slice(0, listUpdate.previousIndex),
|
|
12147
|
-
...newState.slice(
|
|
12148
|
-
listUpdate.previousIndex + 1,
|
|
12149
|
-
listUpdate.index + 1
|
|
12150
|
-
),
|
|
12151
|
-
lsonToJson(listUpdate.item),
|
|
12152
|
-
...newState.slice(listUpdate.index + 1)
|
|
12153
|
-
];
|
|
12154
|
-
}
|
|
12155
|
-
}
|
|
12156
|
-
}
|
|
12157
|
-
return newState;
|
|
12158
|
-
}
|
|
12159
|
-
case "LiveMap": {
|
|
12160
|
-
if (!isJsonObject(state)) {
|
|
12161
|
-
throw new Error(
|
|
12162
|
-
"Internal: received update on LiveMap but state was not an object"
|
|
12163
|
-
);
|
|
12164
|
-
}
|
|
12165
|
-
const newState = Object.assign({}, state);
|
|
12166
|
-
for (const key in update.updates) {
|
|
12167
|
-
if (_optionalChain([update, 'access', _307 => _307.updates, 'access', _308 => _308[key], 'optionalAccess', _309 => _309.type]) === "update") {
|
|
12168
|
-
const value = update.node.get(key);
|
|
12169
|
-
if (value !== void 0) {
|
|
12170
|
-
newState[key] = lsonToJson(value);
|
|
12171
|
-
}
|
|
12172
|
-
} else if (_optionalChain([update, 'access', _310 => _310.updates, 'access', _311 => _311[key], 'optionalAccess', _312 => _312.type]) === "delete") {
|
|
12173
|
-
delete newState[key];
|
|
12174
|
-
}
|
|
12175
|
-
}
|
|
12176
|
-
return newState;
|
|
12177
|
-
}
|
|
12178
|
-
}
|
|
12179
|
-
}
|
|
12180
|
-
if (Array.isArray(state)) {
|
|
12181
|
-
const newArray = [...state];
|
|
12182
|
-
newArray[pathItem] = legacy_patchImmutableNode(
|
|
12183
|
-
state[pathItem],
|
|
12184
|
-
path,
|
|
12185
|
-
update
|
|
12186
|
-
);
|
|
12187
|
-
return newArray;
|
|
12188
|
-
} else if (isJsonObject(state)) {
|
|
12189
|
-
const node = state[pathItem];
|
|
12190
|
-
if (node === void 0) {
|
|
12191
|
-
return state;
|
|
12192
|
-
} else {
|
|
12193
|
-
const stateAsObj = state;
|
|
12194
|
-
return {
|
|
12195
|
-
...stateAsObj,
|
|
12196
|
-
[pathItem]: legacy_patchImmutableNode(node, path, update)
|
|
12197
|
-
};
|
|
12198
|
-
}
|
|
12199
|
-
} else {
|
|
12200
|
-
return state;
|
|
12201
|
-
}
|
|
12202
|
-
}
|
|
12203
|
-
|
|
12204
11881
|
// src/lib/abortController.ts
|
|
12205
11882
|
function makeAbortController(externalSignal) {
|
|
12206
11883
|
const ctl = new AbortController();
|
|
@@ -12249,9 +11926,9 @@ function makePoller(callback, intervalMs, options) {
|
|
|
12249
11926
|
const startTime = performance.now();
|
|
12250
11927
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
12251
11928
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
12252
|
-
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
11929
|
+
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _301 => _301.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
|
|
12253
11930
|
const context = {
|
|
12254
|
-
inForeground: _optionalChain([doc, 'optionalAccess',
|
|
11931
|
+
inForeground: _optionalChain([doc, 'optionalAccess', _302 => _302.visibilityState]) !== "hidden",
|
|
12255
11932
|
lastSuccessfulPollAt: startTime,
|
|
12256
11933
|
count: 0,
|
|
12257
11934
|
backoff: 0
|
|
@@ -12332,11 +12009,11 @@ function makePoller(callback, intervalMs, options) {
|
|
|
12332
12009
|
pollNowIfStale();
|
|
12333
12010
|
}
|
|
12334
12011
|
function onVisibilityChange() {
|
|
12335
|
-
setInForeground(_optionalChain([doc, 'optionalAccess',
|
|
12012
|
+
setInForeground(_optionalChain([doc, 'optionalAccess', _303 => _303.visibilityState]) !== "hidden");
|
|
12336
12013
|
}
|
|
12337
|
-
_optionalChain([doc, 'optionalAccess',
|
|
12338
|
-
_optionalChain([win, 'optionalAccess',
|
|
12339
|
-
_optionalChain([win, 'optionalAccess',
|
|
12014
|
+
_optionalChain([doc, 'optionalAccess', _304 => _304.addEventListener, 'call', _305 => _305("visibilitychange", onVisibilityChange)]);
|
|
12015
|
+
_optionalChain([win, 'optionalAccess', _306 => _306.addEventListener, 'call', _307 => _307("online", onVisibilityChange)]);
|
|
12016
|
+
_optionalChain([win, 'optionalAccess', _308 => _308.addEventListener, 'call', _309 => _309("focus", pollNowIfStale)]);
|
|
12340
12017
|
fsm.start();
|
|
12341
12018
|
return {
|
|
12342
12019
|
inc,
|
|
@@ -12473,8 +12150,5 @@ detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
|
|
|
12473
12150
|
|
|
12474
12151
|
|
|
12475
12152
|
|
|
12476
|
-
|
|
12477
|
-
|
|
12478
|
-
|
|
12479
|
-
exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.Deque = Deque; exports.DerivedSignal = DerivedSignal; exports.FeedRequestErrorCode = FeedRequestErrorCode; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.LiveblocksError = LiveblocksError; exports.MENTION_CHARACTER = MENTION_CHARACTER; exports.MutableSignal = MutableSignal; exports.OpCode = OpCode; exports.Permission = Permission; exports.Promise_withResolvers = Promise_withResolvers; exports.ServerMsgCode = ServerMsgCode; exports.Signal = Signal; exports.SortedList = SortedList; exports.TextEditorType = TextEditorType; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.checkBounds = checkBounds; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactNodesToNodeStream = compactNodesToNodeStream; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToGroupData = convertToGroupData; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToSubscriptionData = convertToSubscriptionData; exports.convertToThreadData = convertToThreadData; exports.convertToUserSubscriptionData = convertToUserSubscriptionData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createManagedPool = createManagedPool; exports.createNotificationSettings = createNotificationSettings; exports.createThreadId = createThreadId; exports.defineAiTool = defineAiTool; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.entries = entries; exports.errorIf = errorIf; exports.findLastIndex = findLastIndex; exports.freeze = freeze; exports.generateUrl = generateUrl; exports.getMentionsFromCommentBody = getMentionsFromCommentBody; exports.getSubscriptionKey = getSubscriptionKey; exports.html = html; exports.htmlSafe = htmlSafe; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isListStorageNode = isListStorageNode; exports.isLiveNode = isLiveNode; exports.isMapStorageNode = isMapStorageNode; exports.isNotificationChannelEnabled = isNotificationChannelEnabled; exports.isNumberOperator = isNumberOperator; exports.isObjectStorageNode = isObjectStorageNode; exports.isPlainObject = isPlainObject; exports.isRegisterStorageNode = isRegisterStorageNode; exports.isRootStorageNode = isRootStorageNode; exports.isStartsWithOperator = isStartsWithOperator; exports.isUrl = isUrl; exports.kInternal = kInternal; exports.keys = keys; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.legacy_patchLiveObjectKey = legacy_patchLiveObjectKey; exports.lsonToJson = lsonToJson; exports.makeAbortController = makeAbortController; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.nodeStreamToCompactNodes = nodeStreamToCompactNodes; exports.objectToQuery = objectToQuery; exports.patchNotificationSettings = patchNotificationSettings; exports.raise = raise; exports.resolveMentionsInCommentBody = resolveMentionsInCommentBody; exports.sanitizeUrl = sanitizeUrl; exports.shallow = shallow; exports.shallow2 = shallow2; exports.stableStringify = stableStringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.warnOnce = warnOnce; exports.warnOnceIf = warnOnceIf; exports.withTimeout = withTimeout;
|
|
12153
|
+
exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.Deque = Deque; exports.DerivedSignal = DerivedSignal; exports.FeedRequestErrorCode = FeedRequestErrorCode; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.LiveblocksError = LiveblocksError; exports.MENTION_CHARACTER = MENTION_CHARACTER; exports.MutableSignal = MutableSignal; exports.OpCode = OpCode; exports.Permission = Permission; exports.Promise_withResolvers = Promise_withResolvers; exports.ServerMsgCode = ServerMsgCode; exports.Signal = Signal; exports.SortedList = SortedList; exports.TextEditorType = TextEditorType; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.checkBounds = checkBounds; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactNodesToNodeStream = compactNodesToNodeStream; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToGroupData = convertToGroupData; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToSubscriptionData = convertToSubscriptionData; exports.convertToThreadData = convertToThreadData; exports.convertToUserSubscriptionData = convertToUserSubscriptionData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createManagedPool = createManagedPool; exports.createNotificationSettings = createNotificationSettings; exports.createThreadId = createThreadId; exports.defineAiTool = defineAiTool; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.entries = entries; exports.errorIf = errorIf; exports.findLastIndex = findLastIndex; exports.freeze = freeze; exports.generateUrl = generateUrl; exports.getMentionsFromCommentBody = getMentionsFromCommentBody; exports.getSubscriptionKey = getSubscriptionKey; exports.html = html; exports.htmlSafe = htmlSafe; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isListStorageNode = isListStorageNode; exports.isLiveNode = isLiveNode; exports.isMapStorageNode = isMapStorageNode; exports.isNotificationChannelEnabled = isNotificationChannelEnabled; exports.isNumberOperator = isNumberOperator; exports.isObjectStorageNode = isObjectStorageNode; exports.isPlainObject = isPlainObject; exports.isRegisterStorageNode = isRegisterStorageNode; exports.isRootStorageNode = isRootStorageNode; exports.isStartsWithOperator = isStartsWithOperator; exports.isUrl = isUrl; exports.kInternal = kInternal; exports.keys = keys; exports.makeAbortController = makeAbortController; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.nodeStreamToCompactNodes = nodeStreamToCompactNodes; exports.objectToQuery = objectToQuery; exports.patchNotificationSettings = patchNotificationSettings; exports.raise = raise; exports.resolveMentionsInCommentBody = resolveMentionsInCommentBody; exports.sanitizeUrl = sanitizeUrl; exports.shallow = shallow; exports.shallow2 = shallow2; exports.stableStringify = stableStringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.warnOnce = warnOnce; exports.warnOnceIf = warnOnceIf; exports.withTimeout = withTimeout;
|
|
12480
12154
|
//# sourceMappingURL=index.cjs.map
|