@arbidocs/blocks 0.4.154 → 0.4.156

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.
Files changed (141) hide show
  1. package/dist/{ConnectedNativeDocxComparison-OLWRQSRS.js → ConnectedNativeDocxComparison-2PLOOXSH.js} +7 -7
  2. package/dist/{ConnectedNativeDocxComparison-OLWRQSRS.js.map → ConnectedNativeDocxComparison-2PLOOXSH.js.map} +1 -1
  3. package/dist/{ConnectedNativeDocxComparison-YORMOPPN.cjs → ConnectedNativeDocxComparison-S25BPUH5.cjs} +8 -8
  4. package/dist/{ConnectedNativeDocxComparison-YORMOPPN.cjs.map → ConnectedNativeDocxComparison-S25BPUH5.cjs.map} +1 -1
  5. package/dist/{ConnectedNativeDocxEditor-34EBIIFS.js → ConnectedNativeDocxEditor-JJAGMHZC.js} +5 -5
  6. package/dist/{ConnectedNativeDocxEditor-34EBIIFS.js.map → ConnectedNativeDocxEditor-JJAGMHZC.js.map} +1 -1
  7. package/dist/{ConnectedNativeDocxEditor-EHTWGGX3.cjs → ConnectedNativeDocxEditor-YA4HWLY4.cjs} +7 -7
  8. package/dist/{ConnectedNativeDocxEditor-EHTWGGX3.cjs.map → ConnectedNativeDocxEditor-YA4HWLY4.cjs.map} +1 -1
  9. package/dist/{ConnectedStreamedWordArtifact-5DK6QGYN.cjs → ConnectedStreamedWordArtifact-EXYZAU4Y.cjs} +8 -8
  10. package/dist/ConnectedStreamedWordArtifact-EXYZAU4Y.cjs.map +1 -0
  11. package/dist/{ConnectedStreamedWordArtifact-GLIDLSAS.js → ConnectedStreamedWordArtifact-YAAXY5KY.js} +7 -7
  12. package/dist/{ConnectedStreamedWordArtifact-GLIDLSAS.js.map → ConnectedStreamedWordArtifact-YAAXY5KY.js.map} +1 -1
  13. package/dist/{NativeDocxEditor-XT5ZLFGU.js → NativeDocxEditor-JBQMH3MP.js} +3 -3
  14. package/dist/{NativeDocxEditor-XT5ZLFGU.js.map → NativeDocxEditor-JBQMH3MP.js.map} +1 -1
  15. package/dist/{NativeDocxEditor-5VBNM5I7.cjs → NativeDocxEditor-M3I776GD.cjs} +7 -7
  16. package/dist/{NativeDocxEditor-5VBNM5I7.cjs.map → NativeDocxEditor-M3I776GD.cjs.map} +1 -1
  17. package/dist/agents/index.cjs +238 -238
  18. package/dist/agents/index.js +4 -4
  19. package/dist/chat/index.cjs +1 -1
  20. package/dist/chat/index.js +1 -1
  21. package/dist/{chunk-MF5KQ4PS.js → chunk-2CWM2CFZ.js} +4 -4
  22. package/dist/{chunk-MF5KQ4PS.js.map → chunk-2CWM2CFZ.js.map} +1 -1
  23. package/dist/{chunk-QKR5LWDO.js → chunk-6HG56GCT.js} +4 -4
  24. package/dist/{chunk-QKR5LWDO.js.map → chunk-6HG56GCT.js.map} +1 -1
  25. package/dist/chunk-6HMCF4AJ.js +1720 -0
  26. package/dist/chunk-6HMCF4AJ.js.map +1 -0
  27. package/dist/{chunk-KHXEIEXN.js → chunk-7IRSCMNK.js} +3 -3
  28. package/dist/{chunk-KHXEIEXN.js.map → chunk-7IRSCMNK.js.map} +1 -1
  29. package/dist/{chunk-TZOQKV64.js → chunk-EWCJXUBP.js} +3 -3
  30. package/dist/{chunk-TZOQKV64.js.map → chunk-EWCJXUBP.js.map} +1 -1
  31. package/dist/{chunk-CU6LDQ57.js → chunk-F3EZDBDJ.js} +4 -4
  32. package/dist/{chunk-CU6LDQ57.js.map → chunk-F3EZDBDJ.js.map} +1 -1
  33. package/dist/{chunk-YF3QUHKN.cjs → chunk-FEGXFABZ.cjs} +3 -3
  34. package/dist/{chunk-YF3QUHKN.cjs.map → chunk-FEGXFABZ.cjs.map} +1 -1
  35. package/dist/{chunk-GC2FSPSQ.cjs → chunk-HDJRSCRE.cjs} +6 -6
  36. package/dist/{chunk-GC2FSPSQ.cjs.map → chunk-HDJRSCRE.cjs.map} +1 -1
  37. package/dist/{chunk-CQCNU5KT.cjs → chunk-IJEISII2.cjs} +6 -6
  38. package/dist/{chunk-CQCNU5KT.cjs.map → chunk-IJEISII2.cjs.map} +1 -1
  39. package/dist/{chunk-NPR5BGFF.cjs → chunk-JSQEAPTC.cjs} +26 -14
  40. package/dist/chunk-JSQEAPTC.cjs.map +1 -0
  41. package/dist/{chunk-BDA3RHYD.cjs → chunk-MUDEL7UL.cjs} +25 -884
  42. package/dist/chunk-MUDEL7UL.cjs.map +1 -0
  43. package/dist/{chunk-6QAAIDQQ.cjs → chunk-O3FB62T5.cjs} +47 -47
  44. package/dist/{chunk-6QAAIDQQ.cjs.map → chunk-O3FB62T5.cjs.map} +1 -1
  45. package/dist/{chunk-265GOG4W.js → chunk-ONTUMV74.js} +26 -14
  46. package/dist/chunk-ONTUMV74.js.map +1 -0
  47. package/dist/chunk-OTU5KGQ6.cjs +18 -0
  48. package/dist/{chunk-HUATKA3M.cjs.map → chunk-OTU5KGQ6.cjs.map} +1 -1
  49. package/dist/{chunk-GO3BN76C.js → chunk-PGOSIJ2I.js} +3 -3
  50. package/dist/{chunk-GO3BN76C.js.map → chunk-PGOSIJ2I.js.map} +1 -1
  51. package/dist/chunk-S74QMZVZ.cjs +18 -0
  52. package/dist/{chunk-C3SMTA3C.cjs.map → chunk-S74QMZVZ.cjs.map} +1 -1
  53. package/dist/{chunk-KUT2Y7JF.cjs → chunk-TQIY2SVY.cjs} +5 -5
  54. package/dist/{chunk-KUT2Y7JF.cjs.map → chunk-TQIY2SVY.cjs.map} +1 -1
  55. package/dist/{chunk-MNG7N6M2.js → chunk-UKCCV63X.js} +4 -4
  56. package/dist/{chunk-MNG7N6M2.js.map → chunk-UKCCV63X.js.map} +1 -1
  57. package/dist/{chunk-B3FMUFAW.cjs → chunk-UKT3WH5Z.cjs} +3 -3
  58. package/dist/{chunk-B3FMUFAW.cjs.map → chunk-UKT3WH5Z.cjs.map} +1 -1
  59. package/dist/{chunk-P6RIBIVN.js → chunk-UPMADXDU.js} +3 -3
  60. package/dist/{chunk-P6RIBIVN.js.map → chunk-UPMADXDU.js.map} +1 -1
  61. package/dist/{chunk-757OYF6G.cjs → chunk-VY4UFXTM.cjs} +4 -4
  62. package/dist/{chunk-757OYF6G.cjs.map → chunk-VY4UFXTM.cjs.map} +1 -1
  63. package/dist/{chunk-RE7NULEY.js → chunk-W7CWGURO.js} +28 -873
  64. package/dist/chunk-W7CWGURO.js.map +1 -0
  65. package/dist/chunk-WV4TD2HZ.cjs +1785 -0
  66. package/dist/chunk-WV4TD2HZ.cjs.map +1 -0
  67. package/dist/{chunk-WU34CHU5.js → chunk-YMQDDUKW.js} +3 -3
  68. package/dist/{chunk-WU34CHU5.js.map → chunk-YMQDDUKW.js.map} +1 -1
  69. package/dist/connect/docx.cjs +11 -11
  70. package/dist/connect/docx.js +7 -7
  71. package/dist/connect/index.cjs +1313 -151
  72. package/dist/connect/index.cjs.map +1 -1
  73. package/dist/connect/index.d.ts +1 -0
  74. package/dist/connect/index.js +1175 -27
  75. package/dist/connect/index.js.map +1 -1
  76. package/dist/connect/viewer.cjs +48 -52
  77. package/dist/connect/viewer.cjs.map +1 -1
  78. package/dist/connect/viewer.js +10 -14
  79. package/dist/connect/viewer.js.map +1 -1
  80. package/dist/connection/files/DocumentSyncGlyph.d.ts +28 -0
  81. package/dist/connection/files/explorer/ConnectedFilesExplorer.d.ts +56 -0
  82. package/dist/connection/files/explorer/FileTiles.d.ts +87 -0
  83. package/dist/connection/files/index.d.ts +5 -0
  84. package/dist/connection/files/store.d.ts +27 -0
  85. package/dist/connection/files/support.d.ts +38 -0
  86. package/dist/document-tools/index.cjs +1 -1
  87. package/dist/document-tools/index.js +1 -1
  88. package/dist/docx/index.cjs +47 -47
  89. package/dist/docx/index.js +3 -3
  90. package/dist/facts/index.cjs +54 -54
  91. package/dist/facts/index.js +4 -4
  92. package/dist/files/DocStatusIcon.d.ts +5 -4
  93. package/dist/files/FailedStageIcon.d.ts +26 -0
  94. package/dist/files/folders/FolderProviderIcon.d.ts +29 -0
  95. package/dist/files/folders/folderPaths.d.ts +86 -0
  96. package/dist/files/folders/index.d.ts +2 -0
  97. package/dist/files/index.cjs +326 -238
  98. package/dist/files/index.d.ts +5 -0
  99. package/dist/files/index.js +2 -2
  100. package/dist/files/permissions.d.ts +28 -0
  101. package/dist/files/recently-deleted.d.ts +7 -0
  102. package/dist/files/visibility.d.ts +31 -0
  103. package/dist/index.cjs +371 -371
  104. package/dist/index.js +10 -10
  105. package/dist/studio/index.cjs +1 -1
  106. package/dist/studio/index.js +1 -1
  107. package/dist/workflow-canvas/index.cjs +16 -16
  108. package/dist/workflow-canvas/index.js +4 -4
  109. package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs +96 -29
  110. package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs.map +1 -1
  111. package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.cts +1 -1
  112. package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.ts +1 -1
  113. package/node_modules/@arbidocs/coedit/dist/hocuspocus.js +98 -31
  114. package/node_modules/@arbidocs/coedit/dist/hocuspocus.js.map +1 -1
  115. package/node_modules/@arbidocs/coedit/dist/index.cjs +96 -29
  116. package/node_modules/@arbidocs/coedit/dist/index.cjs.map +1 -1
  117. package/node_modules/@arbidocs/coedit/dist/index.d.cts +1 -1
  118. package/node_modules/@arbidocs/coedit/dist/index.d.ts +1 -1
  119. package/node_modules/@arbidocs/coedit/dist/index.js +98 -31
  120. package/node_modules/@arbidocs/coedit/dist/index.js.map +1 -1
  121. package/node_modules/@arbidocs/coedit/dist/server.cjs +98 -33
  122. package/node_modules/@arbidocs/coedit/dist/server.cjs.map +1 -1
  123. package/node_modules/@arbidocs/coedit/dist/server.d.cts +1 -1
  124. package/node_modules/@arbidocs/coedit/dist/server.d.ts +1 -1
  125. package/node_modules/@arbidocs/coedit/dist/server.js +99 -34
  126. package/node_modules/@arbidocs/coedit/dist/server.js.map +1 -1
  127. package/node_modules/@arbidocs/coedit/dist/{session-Cf9iu1Vt.d.cts → session-WGvWs6yO.d.cts} +22 -4
  128. package/node_modules/@arbidocs/coedit/dist/{session-Cf9iu1Vt.d.ts → session-WGvWs6yO.d.ts} +22 -4
  129. package/node_modules/@arbidocs/coedit/package.json +1 -1
  130. package/package.json +6 -5
  131. package/dist/ConnectedStreamedWordArtifact-5DK6QGYN.cjs.map +0 -1
  132. package/dist/chunk-265GOG4W.js.map +0 -1
  133. package/dist/chunk-BDA3RHYD.cjs.map +0 -1
  134. package/dist/chunk-C3SMTA3C.cjs +0 -18
  135. package/dist/chunk-HUATKA3M.cjs +0 -18
  136. package/dist/chunk-JGOST4IL.js +0 -648
  137. package/dist/chunk-JGOST4IL.js.map +0 -1
  138. package/dist/chunk-NPR5BGFF.cjs.map +0 -1
  139. package/dist/chunk-RE7NULEY.js.map +0 -1
  140. package/dist/chunk-YAEXSCUW.cjs +0 -677
  141. package/dist/chunk-YAEXSCUW.cjs.map +0 -1
@@ -1276,7 +1276,6 @@ function applyJournal(doc, registry, journal, origin, context) {
1276
1276
 
1277
1277
  // src/sync.ts
1278
1278
  var LOCAL_ORIGIN = /* @__PURE__ */ Symbol("arbi-coedit/local");
1279
- var DEFAULT_REMOTE_DELAY_MS = 40;
1280
1279
  var MirrorSync = class {
1281
1280
  doc;
1282
1281
  registry = new NodeRegistry();
@@ -1285,14 +1284,11 @@ var MirrorSync = class {
1285
1284
  actorId;
1286
1285
  onFailure;
1287
1286
  onLocalJournal;
1287
+ aroundRemote;
1288
1288
  disposers = [];
1289
- remoteDelayMs;
1290
1289
  operation = 0;
1291
1290
  applyingRemote = false;
1292
1291
  failed = false;
1293
- remoteDirty = false;
1294
- remoteOrigin;
1295
- remoteTimer;
1296
1292
  /** Parts whose node ids must be re-registered before the next local journal; true means all. */
1297
1293
  staleParts = null;
1298
1294
  constructor(options) {
@@ -1301,7 +1297,7 @@ var MirrorSync = class {
1301
1297
  this.actorId = options.actorId;
1302
1298
  this.onFailure = options.onFailure;
1303
1299
  this.onLocalJournal = options.onLocalJournal;
1304
- this.remoteDelayMs = options.remoteDelayMs ?? DEFAULT_REMOTE_DELAY_MS;
1300
+ this.aroundRemote = options.aroundRemote;
1305
1301
  registerMirror(this.doc, this.registry);
1306
1302
  this.cache = new MaterializeCache(this.doc);
1307
1303
  this.disposers.push(() => this.cache.destroy());
@@ -1322,16 +1318,10 @@ var MirrorSync = class {
1322
1318
  const onAfterTransaction = (transaction) => {
1323
1319
  if (transaction.origin === LOCAL_ORIGIN || this.failed) return;
1324
1320
  if (transaction.changed.size === 0 && transaction.changedParentTypes.size === 0) return;
1325
- this.remoteDirty = true;
1326
- this.remoteOrigin = transaction.origin;
1327
- if (this.remoteDelayMs <= 0) this.flushRemote();
1328
- else if (this.remoteTimer === void 0) {
1329
- this.remoteTimer = setTimeout(() => this.flushRemote(), this.remoteDelayMs);
1330
- }
1321
+ this.publishRemote(transaction.origin);
1331
1322
  };
1332
1323
  this.doc.on("afterTransaction", onAfterTransaction);
1333
1324
  this.disposers.push(() => this.doc.off("afterTransaction", onAfterTransaction));
1334
- this.disposers.push(() => clearTimeout(this.remoteTimer));
1335
1325
  }
1336
1326
  get hasFailed() {
1337
1327
  return this.failed;
@@ -1340,17 +1330,8 @@ var MirrorSync = class {
1340
1330
  beforeRemote() {
1341
1331
  this.port.flushPendingJournals();
1342
1332
  }
1343
- /** Publish any waiting remote change now. Call before a local operation runs. */
1344
- flushRemote() {
1345
- clearTimeout(this.remoteTimer);
1346
- this.remoteTimer = void 0;
1347
- if (!this.remoteDirty || this.failed) return;
1348
- this.remoteDirty = false;
1349
- this.publishRemote(this.remoteOrigin);
1350
- }
1351
1333
  /** Make the local tree equal to the room: used when the editor opened an older snapshot of it. */
1352
1334
  adopt() {
1353
- this.remoteDirty = false;
1354
1335
  this.publishRemote(void 0);
1355
1336
  }
1356
1337
  /** Re-register node ids for parts a remote publication replaced; deferred until a local edit needs them. */
@@ -1360,23 +1341,29 @@ var MirrorSync = class {
1360
1341
  this.staleParts = null;
1361
1342
  }
1362
1343
  publishRemote(origin) {
1344
+ if (this.failed) return;
1345
+ const published = this.aroundRemote?.();
1363
1346
  this.applyingRemote = true;
1364
1347
  const changed = this.cache.take();
1348
+ let ok = false;
1365
1349
  try {
1366
1350
  const result = this.port.applyRemotePackage(materialize(this.doc, this.cache, changed), {
1367
- origin: "dev.docx-editor.collaboration.remote",
1351
+ // The editor's own origin for a peer's change: it carries the local caret only across those.
1352
+ origin: store.ORIGIN_IDS.mutationRemote,
1368
1353
  actorId: typeof origin === "string" ? origin : this.actorId,
1369
1354
  operationId: `${this.actorId}:remote:${this.operation++}`
1370
1355
  });
1371
1356
  if (!result.ok) throw new JournalError(result.reason);
1372
1357
  if (changed === null || this.staleParts === true) this.staleParts = true;
1373
1358
  else this.staleParts = /* @__PURE__ */ new Set([...this.staleParts ?? [], ...changed]);
1359
+ ok = true;
1374
1360
  } catch (error) {
1375
1361
  this.cache.restore(changed);
1376
1362
  this.fail(error instanceof MaterializeError ? "materialize" : "apply", error);
1377
1363
  } finally {
1378
1364
  this.applyingRemote = false;
1379
1365
  }
1366
+ if (ok) published?.();
1380
1367
  }
1381
1368
  fail(code, error) {
1382
1369
  if (this.failed) return;
@@ -1430,7 +1417,6 @@ var DocxCollaborationSession = class {
1430
1417
  doc;
1431
1418
  awareness;
1432
1419
  offlineEditing;
1433
- remoteDelayMs;
1434
1420
  tracker = collaboration.createCollaborationStatusTracker("initializing");
1435
1421
  statusListeners = /* @__PURE__ */ new Set();
1436
1422
  participantListeners = /* @__PURE__ */ new Set();
@@ -1443,6 +1429,10 @@ var DocxCollaborationSession = class {
1443
1429
  selectionsCache = [];
1444
1430
  selectionsKey = "[]";
1445
1431
  baselineVector;
1432
+ /** The selection the editor last published, carried across the remote changes since. */
1433
+ carried = null;
1434
+ selectionMove = null;
1435
+ inputFlush = null;
1446
1436
  disposers = [];
1447
1437
  constructor(options) {
1448
1438
  this.documentId = options.documentId;
@@ -1451,7 +1441,6 @@ var DocxCollaborationSession = class {
1451
1441
  this.doc = options.doc;
1452
1442
  this.awareness = options.awareness;
1453
1443
  this.offlineEditing = options.offlineEditing ?? false;
1454
- this.remoteDelayMs = options.remoteDelayMs;
1455
1444
  this.undoManager = new Y3__namespace.UndoManager(
1456
1445
  [
1457
1446
  this.doc.getMap("parts"),
@@ -1513,7 +1502,6 @@ var DocxCollaborationSession = class {
1513
1502
  return this.port !== void 0;
1514
1503
  }
1515
1504
  gateOperations() {
1516
- this.sync?.flushRemote();
1517
1505
  switch (this.status()) {
1518
1506
  case "ready":
1519
1507
  return this.port ? null : "collaboration-session-not-attached";
@@ -1542,7 +1530,7 @@ var DocxCollaborationSession = class {
1542
1530
  doc: this.doc,
1543
1531
  port,
1544
1532
  actorId: this.identity.actorId,
1545
- remoteDelayMs: this.remoteDelayMs,
1533
+ aroundRemote: () => this.carrySelection(),
1546
1534
  onFailure: (code, detail) => {
1547
1535
  this.markFailed(code === "journal" ? "local-mirror-failed" : "remote-apply-failed", detail);
1548
1536
  },
@@ -1566,8 +1554,21 @@ var DocxCollaborationSession = class {
1566
1554
  }
1567
1555
  /** Transport hook: call before integrating inbound Yjs data so queued local edits are mirrored first. */
1568
1556
  beforeRemote() {
1557
+ this.inputFlush?.();
1569
1558
  this.sync?.beforeRemote();
1570
1559
  }
1560
+ /**
1561
+ * Bind the editor's pending-input flush (`PaginatedSurface.flushPendingInput`). The session writes
1562
+ * below the editor's input buffer, so it lands queued typing before a remote change and lays the
1563
+ * change out right after it: the editor carries its caret at that layout, and a keystroke before
1564
+ * it would otherwise use the caret from before the change. Returns the unbind function.
1565
+ */
1566
+ bindEditorInput(flush) {
1567
+ this.inputFlush = flush;
1568
+ return () => {
1569
+ if (this.inputFlush === flush) this.inputFlush = null;
1570
+ };
1571
+ }
1571
1572
  // ── Undo ─────────────────────────────────────────────────────────────────
1572
1573
  canUndo() {
1573
1574
  return this.undoManager.undoStack.length > 0;
@@ -1580,7 +1581,6 @@ var DocxCollaborationSession = class {
1580
1581
  if (this.gateOperations() !== null || !this.canUndo()) return false;
1581
1582
  this.undoManager.stopCapturing();
1582
1583
  this.undoManager.undo();
1583
- this.sync?.flushRemote();
1584
1584
  return true;
1585
1585
  }
1586
1586
  redo() {
@@ -1588,13 +1588,79 @@ var DocxCollaborationSession = class {
1588
1588
  if (this.gateOperations() !== null || !this.canRedo()) return false;
1589
1589
  this.undoManager.stopCapturing();
1590
1590
  this.undoManager.redo();
1591
- this.sync?.flushRemote();
1592
1591
  return true;
1593
1592
  }
1594
1593
  // ── Presence ─────────────────────────────────────────────────────────────
1595
1594
  setLocalSelection(selection) {
1595
+ this.carried = selection && selection.kind !== "cells" ? { from: null, selection } : null;
1596
+ this.selectionMove = null;
1596
1597
  this.awareness.setLocalStateField("selection", selection);
1597
1598
  }
1599
+ /** Where the last remote change carried the local selection; see `carrySelection`. */
1600
+ remoteSelectionMove() {
1601
+ return this.selectionMove;
1602
+ }
1603
+ /**
1604
+ * Called before a remote change reaches the port: notes the selection's paragraphs and their text,
1605
+ * and returns what carries it across the change once the port holds the new tree. The editor
1606
+ * takes the carried selection when a local edit was coalesced with the remote change, where it
1607
+ * cannot map its caret by the text alone. Several remote changes before the editor publishes its
1608
+ * selection again chain, all from the selection it published.
1609
+ */
1610
+ carrySelection() {
1611
+ const port = this.port;
1612
+ const carried = this.carried;
1613
+ const settle = () => this.inputFlush?.();
1614
+ if (!port || !carried) return settle;
1615
+ const before = (address) => {
1616
+ const paragraph = port.paragraphByStableId(address.paragraphId);
1617
+ if (!paragraph) return null;
1618
+ const offset = Math.min(address.offset, paragraph.text.length);
1619
+ return { nodeId: paragraph.nodeId, text: paragraph.text, offset };
1620
+ };
1621
+ const anchor = before(carried.selection.anchor);
1622
+ const head = before(carried.selection.head);
1623
+ if (!anchor || !head) {
1624
+ this.carried = null;
1625
+ this.selectionMove = null;
1626
+ return settle;
1627
+ }
1628
+ const from = carried.from ?? {
1629
+ anchor: { nodeId: anchor.nodeId, offset: anchor.offset },
1630
+ head: { nodeId: head.nodeId, offset: head.offset }
1631
+ };
1632
+ return () => {
1633
+ const after = (address, was) => {
1634
+ const paragraph = port.paragraphByStableId(address.paragraphId);
1635
+ if (!paragraph) return null;
1636
+ const offset = replication.mapOffsetAcrossText(was.offset, was.text, paragraph.text);
1637
+ return { paragraphId: address.paragraphId, nodeId: paragraph.nodeId, offset };
1638
+ };
1639
+ const nextAnchor = after(carried.selection.anchor, anchor);
1640
+ const nextHead = after(carried.selection.head, head);
1641
+ if (!nextAnchor || !nextHead) {
1642
+ this.carried = null;
1643
+ this.selectionMove = null;
1644
+ } else {
1645
+ this.carried = {
1646
+ from,
1647
+ selection: {
1648
+ ...carried.selection,
1649
+ anchor: { paragraphId: nextAnchor.paragraphId, offset: nextAnchor.offset },
1650
+ head: { paragraphId: nextHead.paragraphId, offset: nextHead.offset }
1651
+ }
1652
+ };
1653
+ this.selectionMove = {
1654
+ from,
1655
+ to: {
1656
+ anchor: { nodeId: nextAnchor.nodeId, offset: nextAnchor.offset },
1657
+ head: { nodeId: nextHead.nodeId, offset: nextHead.offset }
1658
+ }
1659
+ };
1660
+ }
1661
+ settle();
1662
+ };
1663
+ }
1598
1664
  participants() {
1599
1665
  return this.participantsCache;
1600
1666
  }
@@ -1666,6 +1732,7 @@ var DocxCollaborationSession = class {
1666
1732
  this.sync?.destroy();
1667
1733
  this.sync = void 0;
1668
1734
  this.port = void 0;
1735
+ this.inputFlush = null;
1669
1736
  this.undoManager.destroy();
1670
1737
  this.awareness.setLocalState(null);
1671
1738
  for (const dispose of this.disposers.splice(0)) dispose();