@arbidocs/blocks 0.4.155 → 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 (105) 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-KHXEIEXN.js → chunk-7IRSCMNK.js} +3 -3
  26. package/dist/{chunk-KHXEIEXN.js.map → chunk-7IRSCMNK.js.map} +1 -1
  27. package/dist/{chunk-TZOQKV64.js → chunk-EWCJXUBP.js} +3 -3
  28. package/dist/{chunk-TZOQKV64.js.map → chunk-EWCJXUBP.js.map} +1 -1
  29. package/dist/{chunk-CU6LDQ57.js → chunk-F3EZDBDJ.js} +4 -4
  30. package/dist/{chunk-CU6LDQ57.js.map → chunk-F3EZDBDJ.js.map} +1 -1
  31. package/dist/{chunk-YF3QUHKN.cjs → chunk-FEGXFABZ.cjs} +3 -3
  32. package/dist/{chunk-YF3QUHKN.cjs.map → chunk-FEGXFABZ.cjs.map} +1 -1
  33. package/dist/{chunk-GC2FSPSQ.cjs → chunk-HDJRSCRE.cjs} +6 -6
  34. package/dist/{chunk-GC2FSPSQ.cjs.map → chunk-HDJRSCRE.cjs.map} +1 -1
  35. package/dist/{chunk-CQCNU5KT.cjs → chunk-IJEISII2.cjs} +6 -6
  36. package/dist/{chunk-CQCNU5KT.cjs.map → chunk-IJEISII2.cjs.map} +1 -1
  37. package/dist/{chunk-NPR5BGFF.cjs → chunk-JSQEAPTC.cjs} +26 -14
  38. package/dist/chunk-JSQEAPTC.cjs.map +1 -0
  39. package/dist/{chunk-6QAAIDQQ.cjs → chunk-O3FB62T5.cjs} +47 -47
  40. package/dist/{chunk-6QAAIDQQ.cjs.map → chunk-O3FB62T5.cjs.map} +1 -1
  41. package/dist/{chunk-265GOG4W.js → chunk-ONTUMV74.js} +26 -14
  42. package/dist/chunk-ONTUMV74.js.map +1 -0
  43. package/dist/chunk-OTU5KGQ6.cjs +18 -0
  44. package/dist/{chunk-HUATKA3M.cjs.map → chunk-OTU5KGQ6.cjs.map} +1 -1
  45. package/dist/{chunk-GO3BN76C.js → chunk-PGOSIJ2I.js} +3 -3
  46. package/dist/{chunk-GO3BN76C.js.map → chunk-PGOSIJ2I.js.map} +1 -1
  47. package/dist/chunk-S74QMZVZ.cjs +18 -0
  48. package/dist/{chunk-C3SMTA3C.cjs.map → chunk-S74QMZVZ.cjs.map} +1 -1
  49. package/dist/{chunk-KUT2Y7JF.cjs → chunk-TQIY2SVY.cjs} +5 -5
  50. package/dist/{chunk-KUT2Y7JF.cjs.map → chunk-TQIY2SVY.cjs.map} +1 -1
  51. package/dist/{chunk-MNG7N6M2.js → chunk-UKCCV63X.js} +4 -4
  52. package/dist/{chunk-MNG7N6M2.js.map → chunk-UKCCV63X.js.map} +1 -1
  53. package/dist/{chunk-B3FMUFAW.cjs → chunk-UKT3WH5Z.cjs} +3 -3
  54. package/dist/{chunk-B3FMUFAW.cjs.map → chunk-UKT3WH5Z.cjs.map} +1 -1
  55. package/dist/{chunk-P6RIBIVN.js → chunk-UPMADXDU.js} +3 -3
  56. package/dist/{chunk-P6RIBIVN.js.map → chunk-UPMADXDU.js.map} +1 -1
  57. package/dist/{chunk-757OYF6G.cjs → chunk-VY4UFXTM.cjs} +4 -4
  58. package/dist/{chunk-757OYF6G.cjs.map → chunk-VY4UFXTM.cjs.map} +1 -1
  59. package/dist/{chunk-WU34CHU5.js → chunk-YMQDDUKW.js} +3 -3
  60. package/dist/{chunk-WU34CHU5.js.map → chunk-YMQDDUKW.js.map} +1 -1
  61. package/dist/connect/docx.cjs +11 -11
  62. package/dist/connect/docx.js +7 -7
  63. package/dist/connect/index.cjs +137 -137
  64. package/dist/connect/index.js +16 -16
  65. package/dist/connect/viewer.cjs +10 -10
  66. package/dist/connect/viewer.js +10 -10
  67. package/dist/document-tools/index.cjs +1 -1
  68. package/dist/document-tools/index.js +1 -1
  69. package/dist/docx/index.cjs +47 -47
  70. package/dist/docx/index.js +3 -3
  71. package/dist/facts/index.cjs +54 -54
  72. package/dist/facts/index.js +4 -4
  73. package/dist/index.cjs +347 -347
  74. package/dist/index.js +8 -8
  75. package/dist/studio/index.cjs +1 -1
  76. package/dist/studio/index.js +1 -1
  77. package/dist/workflow-canvas/index.cjs +16 -16
  78. package/dist/workflow-canvas/index.js +4 -4
  79. package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs +96 -29
  80. package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs.map +1 -1
  81. package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.cts +1 -1
  82. package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.ts +1 -1
  83. package/node_modules/@arbidocs/coedit/dist/hocuspocus.js +98 -31
  84. package/node_modules/@arbidocs/coedit/dist/hocuspocus.js.map +1 -1
  85. package/node_modules/@arbidocs/coedit/dist/index.cjs +96 -29
  86. package/node_modules/@arbidocs/coedit/dist/index.cjs.map +1 -1
  87. package/node_modules/@arbidocs/coedit/dist/index.d.cts +1 -1
  88. package/node_modules/@arbidocs/coedit/dist/index.d.ts +1 -1
  89. package/node_modules/@arbidocs/coedit/dist/index.js +98 -31
  90. package/node_modules/@arbidocs/coedit/dist/index.js.map +1 -1
  91. package/node_modules/@arbidocs/coedit/dist/server.cjs +98 -33
  92. package/node_modules/@arbidocs/coedit/dist/server.cjs.map +1 -1
  93. package/node_modules/@arbidocs/coedit/dist/server.d.cts +1 -1
  94. package/node_modules/@arbidocs/coedit/dist/server.d.ts +1 -1
  95. package/node_modules/@arbidocs/coedit/dist/server.js +99 -34
  96. package/node_modules/@arbidocs/coedit/dist/server.js.map +1 -1
  97. package/node_modules/@arbidocs/coedit/dist/{session-Cf9iu1Vt.d.cts → session-WGvWs6yO.d.cts} +22 -4
  98. package/node_modules/@arbidocs/coedit/dist/{session-Cf9iu1Vt.d.ts → session-WGvWs6yO.d.ts} +22 -4
  99. package/node_modules/@arbidocs/coedit/package.json +1 -1
  100. package/package.json +5 -5
  101. package/dist/ConnectedStreamedWordArtifact-5DK6QGYN.cjs.map +0 -1
  102. package/dist/chunk-265GOG4W.js.map +0 -1
  103. package/dist/chunk-C3SMTA3C.cjs +0 -18
  104. package/dist/chunk-HUATKA3M.cjs +0 -18
  105. package/dist/chunk-NPR5BGFF.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import * as Y from 'yjs';
2
2
  import { HocuspocusProvider } from '@hocuspocus/provider';
3
3
  import { CollaborationIdentity } from '@docx-editor.dev/core/collaboration';
4
- import { D as DocxCollaborationSession } from './session-Cf9iu1Vt.cjs';
4
+ import { D as DocxCollaborationSession } from './session-WGvWs6yO.cjs';
5
5
  import 'y-protocols/awareness';
6
6
  import '@docx-editor.dev/core/collaboration/replication';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import * as Y from 'yjs';
2
2
  import { HocuspocusProvider } from '@hocuspocus/provider';
3
3
  import { CollaborationIdentity } from '@docx-editor.dev/core/collaboration';
4
- import { D as DocxCollaborationSession } from './session-Cf9iu1Vt.js';
4
+ import { D as DocxCollaborationSession } from './session-WGvWs6yO.js';
5
5
  import 'y-protocols/awareness';
6
6
  import '@docx-editor.dev/core/collaboration/replication';
7
7
 
@@ -1,9 +1,9 @@
1
1
  import * as Y3 from 'yjs';
2
2
  import { Awareness } from 'y-protocols/awareness';
3
3
  import { HocuspocusProvider } from '@hocuspocus/provider';
4
- import { writeOoxmlPackage, readOoxmlPart, validateExternalTarget, relsPartNameFor, contentTypesPartBytes, withContentTypeOverride } from '@docx-editor.dev/core/store';
4
+ import { writeOoxmlPackage, ORIGIN_IDS, readOoxmlPart, validateExternalTarget, relsPartNameFor, contentTypesPartBytes, withContentTypeOverride } from '@docx-editor.dev/core/store';
5
5
  import { createCollaborationStatusTracker, safeParticipantColor } from '@docx-editor.dev/core/collaboration';
6
- import { historyGroupOfJournal } from '@docx-editor.dev/core/collaboration/replication';
6
+ import { historyGroupOfJournal, mapOffsetAcrossText } from '@docx-editor.dev/core/collaboration/replication';
7
7
 
8
8
  // src/hocuspocus.ts
9
9
 
@@ -1259,7 +1259,6 @@ function applyJournal(doc, registry, journal, origin, context) {
1259
1259
 
1260
1260
  // src/sync.ts
1261
1261
  var LOCAL_ORIGIN = /* @__PURE__ */ Symbol("arbi-coedit/local");
1262
- var DEFAULT_REMOTE_DELAY_MS = 40;
1263
1262
  var MirrorSync = class {
1264
1263
  doc;
1265
1264
  registry = new NodeRegistry();
@@ -1268,14 +1267,11 @@ var MirrorSync = class {
1268
1267
  actorId;
1269
1268
  onFailure;
1270
1269
  onLocalJournal;
1270
+ aroundRemote;
1271
1271
  disposers = [];
1272
- remoteDelayMs;
1273
1272
  operation = 0;
1274
1273
  applyingRemote = false;
1275
1274
  failed = false;
1276
- remoteDirty = false;
1277
- remoteOrigin;
1278
- remoteTimer;
1279
1275
  /** Parts whose node ids must be re-registered before the next local journal; true means all. */
1280
1276
  staleParts = null;
1281
1277
  constructor(options) {
@@ -1284,7 +1280,7 @@ var MirrorSync = class {
1284
1280
  this.actorId = options.actorId;
1285
1281
  this.onFailure = options.onFailure;
1286
1282
  this.onLocalJournal = options.onLocalJournal;
1287
- this.remoteDelayMs = options.remoteDelayMs ?? DEFAULT_REMOTE_DELAY_MS;
1283
+ this.aroundRemote = options.aroundRemote;
1288
1284
  registerMirror(this.doc, this.registry);
1289
1285
  this.cache = new MaterializeCache(this.doc);
1290
1286
  this.disposers.push(() => this.cache.destroy());
@@ -1305,16 +1301,10 @@ var MirrorSync = class {
1305
1301
  const onAfterTransaction = (transaction) => {
1306
1302
  if (transaction.origin === LOCAL_ORIGIN || this.failed) return;
1307
1303
  if (transaction.changed.size === 0 && transaction.changedParentTypes.size === 0) return;
1308
- this.remoteDirty = true;
1309
- this.remoteOrigin = transaction.origin;
1310
- if (this.remoteDelayMs <= 0) this.flushRemote();
1311
- else if (this.remoteTimer === void 0) {
1312
- this.remoteTimer = setTimeout(() => this.flushRemote(), this.remoteDelayMs);
1313
- }
1304
+ this.publishRemote(transaction.origin);
1314
1305
  };
1315
1306
  this.doc.on("afterTransaction", onAfterTransaction);
1316
1307
  this.disposers.push(() => this.doc.off("afterTransaction", onAfterTransaction));
1317
- this.disposers.push(() => clearTimeout(this.remoteTimer));
1318
1308
  }
1319
1309
  get hasFailed() {
1320
1310
  return this.failed;
@@ -1323,17 +1313,8 @@ var MirrorSync = class {
1323
1313
  beforeRemote() {
1324
1314
  this.port.flushPendingJournals();
1325
1315
  }
1326
- /** Publish any waiting remote change now. Call before a local operation runs. */
1327
- flushRemote() {
1328
- clearTimeout(this.remoteTimer);
1329
- this.remoteTimer = void 0;
1330
- if (!this.remoteDirty || this.failed) return;
1331
- this.remoteDirty = false;
1332
- this.publishRemote(this.remoteOrigin);
1333
- }
1334
1316
  /** Make the local tree equal to the room: used when the editor opened an older snapshot of it. */
1335
1317
  adopt() {
1336
- this.remoteDirty = false;
1337
1318
  this.publishRemote(void 0);
1338
1319
  }
1339
1320
  /** Re-register node ids for parts a remote publication replaced; deferred until a local edit needs them. */
@@ -1343,23 +1324,29 @@ var MirrorSync = class {
1343
1324
  this.staleParts = null;
1344
1325
  }
1345
1326
  publishRemote(origin) {
1327
+ if (this.failed) return;
1328
+ const published = this.aroundRemote?.();
1346
1329
  this.applyingRemote = true;
1347
1330
  const changed = this.cache.take();
1331
+ let ok = false;
1348
1332
  try {
1349
1333
  const result = this.port.applyRemotePackage(materialize(this.doc, this.cache, changed), {
1350
- origin: "dev.docx-editor.collaboration.remote",
1334
+ // The editor's own origin for a peer's change: it carries the local caret only across those.
1335
+ origin: ORIGIN_IDS.mutationRemote,
1351
1336
  actorId: typeof origin === "string" ? origin : this.actorId,
1352
1337
  operationId: `${this.actorId}:remote:${this.operation++}`
1353
1338
  });
1354
1339
  if (!result.ok) throw new JournalError(result.reason);
1355
1340
  if (changed === null || this.staleParts === true) this.staleParts = true;
1356
1341
  else this.staleParts = /* @__PURE__ */ new Set([...this.staleParts ?? [], ...changed]);
1342
+ ok = true;
1357
1343
  } catch (error) {
1358
1344
  this.cache.restore(changed);
1359
1345
  this.fail(error instanceof MaterializeError ? "materialize" : "apply", error);
1360
1346
  } finally {
1361
1347
  this.applyingRemote = false;
1362
1348
  }
1349
+ if (ok) published?.();
1363
1350
  }
1364
1351
  fail(code, error) {
1365
1352
  if (this.failed) return;
@@ -1413,7 +1400,6 @@ var DocxCollaborationSession = class {
1413
1400
  doc;
1414
1401
  awareness;
1415
1402
  offlineEditing;
1416
- remoteDelayMs;
1417
1403
  tracker = createCollaborationStatusTracker("initializing");
1418
1404
  statusListeners = /* @__PURE__ */ new Set();
1419
1405
  participantListeners = /* @__PURE__ */ new Set();
@@ -1426,6 +1412,10 @@ var DocxCollaborationSession = class {
1426
1412
  selectionsCache = [];
1427
1413
  selectionsKey = "[]";
1428
1414
  baselineVector;
1415
+ /** The selection the editor last published, carried across the remote changes since. */
1416
+ carried = null;
1417
+ selectionMove = null;
1418
+ inputFlush = null;
1429
1419
  disposers = [];
1430
1420
  constructor(options) {
1431
1421
  this.documentId = options.documentId;
@@ -1434,7 +1424,6 @@ var DocxCollaborationSession = class {
1434
1424
  this.doc = options.doc;
1435
1425
  this.awareness = options.awareness;
1436
1426
  this.offlineEditing = options.offlineEditing ?? false;
1437
- this.remoteDelayMs = options.remoteDelayMs;
1438
1427
  this.undoManager = new Y3.UndoManager(
1439
1428
  [
1440
1429
  this.doc.getMap("parts"),
@@ -1496,7 +1485,6 @@ var DocxCollaborationSession = class {
1496
1485
  return this.port !== void 0;
1497
1486
  }
1498
1487
  gateOperations() {
1499
- this.sync?.flushRemote();
1500
1488
  switch (this.status()) {
1501
1489
  case "ready":
1502
1490
  return this.port ? null : "collaboration-session-not-attached";
@@ -1525,7 +1513,7 @@ var DocxCollaborationSession = class {
1525
1513
  doc: this.doc,
1526
1514
  port,
1527
1515
  actorId: this.identity.actorId,
1528
- remoteDelayMs: this.remoteDelayMs,
1516
+ aroundRemote: () => this.carrySelection(),
1529
1517
  onFailure: (code, detail) => {
1530
1518
  this.markFailed(code === "journal" ? "local-mirror-failed" : "remote-apply-failed", detail);
1531
1519
  },
@@ -1549,8 +1537,21 @@ var DocxCollaborationSession = class {
1549
1537
  }
1550
1538
  /** Transport hook: call before integrating inbound Yjs data so queued local edits are mirrored first. */
1551
1539
  beforeRemote() {
1540
+ this.inputFlush?.();
1552
1541
  this.sync?.beforeRemote();
1553
1542
  }
1543
+ /**
1544
+ * Bind the editor's pending-input flush (`PaginatedSurface.flushPendingInput`). The session writes
1545
+ * below the editor's input buffer, so it lands queued typing before a remote change and lays the
1546
+ * change out right after it: the editor carries its caret at that layout, and a keystroke before
1547
+ * it would otherwise use the caret from before the change. Returns the unbind function.
1548
+ */
1549
+ bindEditorInput(flush) {
1550
+ this.inputFlush = flush;
1551
+ return () => {
1552
+ if (this.inputFlush === flush) this.inputFlush = null;
1553
+ };
1554
+ }
1554
1555
  // ── Undo ─────────────────────────────────────────────────────────────────
1555
1556
  canUndo() {
1556
1557
  return this.undoManager.undoStack.length > 0;
@@ -1563,7 +1564,6 @@ var DocxCollaborationSession = class {
1563
1564
  if (this.gateOperations() !== null || !this.canUndo()) return false;
1564
1565
  this.undoManager.stopCapturing();
1565
1566
  this.undoManager.undo();
1566
- this.sync?.flushRemote();
1567
1567
  return true;
1568
1568
  }
1569
1569
  redo() {
@@ -1571,13 +1571,79 @@ var DocxCollaborationSession = class {
1571
1571
  if (this.gateOperations() !== null || !this.canRedo()) return false;
1572
1572
  this.undoManager.stopCapturing();
1573
1573
  this.undoManager.redo();
1574
- this.sync?.flushRemote();
1575
1574
  return true;
1576
1575
  }
1577
1576
  // ── Presence ─────────────────────────────────────────────────────────────
1578
1577
  setLocalSelection(selection) {
1578
+ this.carried = selection && selection.kind !== "cells" ? { from: null, selection } : null;
1579
+ this.selectionMove = null;
1579
1580
  this.awareness.setLocalStateField("selection", selection);
1580
1581
  }
1582
+ /** Where the last remote change carried the local selection; see `carrySelection`. */
1583
+ remoteSelectionMove() {
1584
+ return this.selectionMove;
1585
+ }
1586
+ /**
1587
+ * Called before a remote change reaches the port: notes the selection's paragraphs and their text,
1588
+ * and returns what carries it across the change once the port holds the new tree. The editor
1589
+ * takes the carried selection when a local edit was coalesced with the remote change, where it
1590
+ * cannot map its caret by the text alone. Several remote changes before the editor publishes its
1591
+ * selection again chain, all from the selection it published.
1592
+ */
1593
+ carrySelection() {
1594
+ const port = this.port;
1595
+ const carried = this.carried;
1596
+ const settle = () => this.inputFlush?.();
1597
+ if (!port || !carried) return settle;
1598
+ const before = (address) => {
1599
+ const paragraph = port.paragraphByStableId(address.paragraphId);
1600
+ if (!paragraph) return null;
1601
+ const offset = Math.min(address.offset, paragraph.text.length);
1602
+ return { nodeId: paragraph.nodeId, text: paragraph.text, offset };
1603
+ };
1604
+ const anchor = before(carried.selection.anchor);
1605
+ const head = before(carried.selection.head);
1606
+ if (!anchor || !head) {
1607
+ this.carried = null;
1608
+ this.selectionMove = null;
1609
+ return settle;
1610
+ }
1611
+ const from = carried.from ?? {
1612
+ anchor: { nodeId: anchor.nodeId, offset: anchor.offset },
1613
+ head: { nodeId: head.nodeId, offset: head.offset }
1614
+ };
1615
+ return () => {
1616
+ const after = (address, was) => {
1617
+ const paragraph = port.paragraphByStableId(address.paragraphId);
1618
+ if (!paragraph) return null;
1619
+ const offset = mapOffsetAcrossText(was.offset, was.text, paragraph.text);
1620
+ return { paragraphId: address.paragraphId, nodeId: paragraph.nodeId, offset };
1621
+ };
1622
+ const nextAnchor = after(carried.selection.anchor, anchor);
1623
+ const nextHead = after(carried.selection.head, head);
1624
+ if (!nextAnchor || !nextHead) {
1625
+ this.carried = null;
1626
+ this.selectionMove = null;
1627
+ } else {
1628
+ this.carried = {
1629
+ from,
1630
+ selection: {
1631
+ ...carried.selection,
1632
+ anchor: { paragraphId: nextAnchor.paragraphId, offset: nextAnchor.offset },
1633
+ head: { paragraphId: nextHead.paragraphId, offset: nextHead.offset }
1634
+ }
1635
+ };
1636
+ this.selectionMove = {
1637
+ from,
1638
+ to: {
1639
+ anchor: { nodeId: nextAnchor.nodeId, offset: nextAnchor.offset },
1640
+ head: { nodeId: nextHead.nodeId, offset: nextHead.offset }
1641
+ }
1642
+ };
1643
+ }
1644
+ settle();
1645
+ };
1646
+ }
1581
1647
  participants() {
1582
1648
  return this.participantsCache;
1583
1649
  }
@@ -1649,6 +1715,7 @@ var DocxCollaborationSession = class {
1649
1715
  this.sync?.destroy();
1650
1716
  this.sync = void 0;
1651
1717
  this.port = void 0;
1718
+ this.inputFlush = null;
1652
1719
  this.undoManager.destroy();
1653
1720
  this.awareness.setLocalState(null);
1654
1721
  for (const dispose of this.disposers.splice(0)) dispose();