@ai-matrx/office 0.8.17 → 0.8.18

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.
@@ -252,19 +252,14 @@ declare function invertDocsOp(op: DocsOp, preDoc: unknown): DocsOp;
252
252
  /** Part of `proto` (§6.4): Univer 1.0.4 + this transformer, rules R1–R6. */
253
253
  declare const DOCS_TRANSFORM_VERSION = "univer-1.0.4+docs-ot-r6";
254
254
 
255
- /**
256
- * The canonical Docs state hash (COLLAB-DESIGN §7.2; C0 item 6, `spikes/c0-collab/lib.mjs`).
257
- *
258
- * SHA-256 of the canonical snapshot: keys sorted, empty values dropped, the unit id and seat-local fields
259
- * removed (revision counter, collab stamps, layout state, selections), adjacent equal text runs merged, split
260
- * pieces of one custom range or decoration folded, and `paragraphId` dropped (Univer's TextX.apply mints a
261
- * random one per seat, C0 surprise 3). Header, footer and note bodies get the same rules.
262
- *
263
- * Two seats with equal content hash equal; one character more hashes differently. Browser and Node: the
264
- * digest is Web Crypto's.
265
- */
266
255
  /** Never content: the collab stamps, revision counters, seat-local view state. */
267
256
  declare const DOC_LOCAL_KEYS: string[];
257
+ /**
258
+ * The snapshot as a seat holds it after loading it: what `DocumentModel` / the editor mount do (deterministic
259
+ * ids, `sanitizeUniverDocSnapshot`), then Univer's own model normalisation (`createDocumentSnapshot` inside
260
+ * `DocumentDataModel`). Idempotent: a snapshot a seat saved comes back unchanged in content.
261
+ */
262
+ declare function asLoadedDocsSnapshot(snapshot: unknown): Record<string, unknown>;
268
263
  /** The canonical Docs snapshot: content only, keys sorted, runs normalized, local fields removed. */
269
264
  declare function canonicalDocsSnapshot(snapshot: unknown): unknown;
270
265
  /** The canonical form as the string the hash digests (tests compare these directly). */
@@ -856,4 +851,4 @@ declare function startWorkbookOtRoom(port: SheetsOtPort & {
856
851
  dispose?: () => void;
857
852
  }, o: WorkbookOtRoomOptions): Promise<WorkbookOtRoomHandle>;
858
853
 
859
- export { COLLAB_COVERED_KEY, type CollabBase, type CollabMutationInfo, type CollabProviderLike, type CommandServiceLike, DOCS_COLLAB_PROTO, DOCS_TRANSFORM_VERSION, DOC_LOCAL_KEYS, type DocsLocalMutation, type DocsLost, type DocsOp, type DocsOtNotice, type DocsOtPort, type DocsOtRoom, type DocsTransformResult, type DocumentOtFactoryOptions, type DocumentRestoreDeps, type DocumentRestoreResult, type OpenDocsOtRoomOptions, type OpenSheetsOtRoomOptions, type OtRoomsKnob, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, type SheetOp, type SheetSelection, type SheetsCommandService, type SheetsLocalEvent, type SheetsLocalGroup, type SheetsNotShared, type SheetsOtAdapter, type SheetsOtAdapterHooks, type SheetsOtNotice, type SheetsOtPort, type SheetsOtRoom, type SheetsWorkbookLike, type SheetsWorksheetLike, type UniverSheetsOtPortOptions, WorkbookCollabSession, type WorkbookCollabSessionOptions, type WorkbookOtRoomHandle, type WorkbookOtRoomOptions, type WorkbookOtRoomsKnob, applyDocsOp, canonicalDocsSnapshot, canonicalDocsString, canonicalKeys, canonicalSheet, canonicalSheetString, composeDocsOps, createSheetsOtAdapter, decodeSheetOp, docsStateHash, documentOtFactory, documentUsesOrderedRoom, dropEmptyStyleRetains, encodeSheetOp, invertDocsOp, isCellEditorScratch, isNoopDocsOp, moveSelectionsThrough, normalizeDocsOp, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };
854
+ export { COLLAB_COVERED_KEY, type CollabBase, type CollabMutationInfo, type CollabProviderLike, type CommandServiceLike, DOCS_COLLAB_PROTO, DOCS_TRANSFORM_VERSION, DOC_LOCAL_KEYS, type DocsLocalMutation, type DocsLost, type DocsOp, type DocsOtNotice, type DocsOtPort, type DocsOtRoom, type DocsTransformResult, type DocumentOtFactoryOptions, type DocumentRestoreDeps, type DocumentRestoreResult, type OpenDocsOtRoomOptions, type OpenSheetsOtRoomOptions, type OtRoomsKnob, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, type SheetOp, type SheetSelection, type SheetsCommandService, type SheetsLocalEvent, type SheetsLocalGroup, type SheetsNotShared, type SheetsOtAdapter, type SheetsOtAdapterHooks, type SheetsOtNotice, type SheetsOtPort, type SheetsOtRoom, type SheetsWorkbookLike, type SheetsWorksheetLike, type UniverSheetsOtPortOptions, WorkbookCollabSession, type WorkbookCollabSessionOptions, type WorkbookOtRoomHandle, type WorkbookOtRoomOptions, type WorkbookOtRoomsKnob, applyDocsOp, asLoadedDocsSnapshot, canonicalDocsSnapshot, canonicalDocsString, canonicalKeys, canonicalSheet, canonicalSheetString, composeDocsOps, createSheetsOtAdapter, decodeSheetOp, docsStateHash, documentOtFactory, documentUsesOrderedRoom, dropEmptyStyleRetains, encodeSheetOp, invertDocsOp, isCellEditorScratch, isNoopDocsOp, moveSelectionsThrough, normalizeDocsOp, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };
@@ -252,19 +252,14 @@ declare function invertDocsOp(op: DocsOp, preDoc: unknown): DocsOp;
252
252
  /** Part of `proto` (§6.4): Univer 1.0.4 + this transformer, rules R1–R6. */
253
253
  declare const DOCS_TRANSFORM_VERSION = "univer-1.0.4+docs-ot-r6";
254
254
 
255
- /**
256
- * The canonical Docs state hash (COLLAB-DESIGN §7.2; C0 item 6, `spikes/c0-collab/lib.mjs`).
257
- *
258
- * SHA-256 of the canonical snapshot: keys sorted, empty values dropped, the unit id and seat-local fields
259
- * removed (revision counter, collab stamps, layout state, selections), adjacent equal text runs merged, split
260
- * pieces of one custom range or decoration folded, and `paragraphId` dropped (Univer's TextX.apply mints a
261
- * random one per seat, C0 surprise 3). Header, footer and note bodies get the same rules.
262
- *
263
- * Two seats with equal content hash equal; one character more hashes differently. Browser and Node: the
264
- * digest is Web Crypto's.
265
- */
266
255
  /** Never content: the collab stamps, revision counters, seat-local view state. */
267
256
  declare const DOC_LOCAL_KEYS: string[];
257
+ /**
258
+ * The snapshot as a seat holds it after loading it: what `DocumentModel` / the editor mount do (deterministic
259
+ * ids, `sanitizeUniverDocSnapshot`), then Univer's own model normalisation (`createDocumentSnapshot` inside
260
+ * `DocumentDataModel`). Idempotent: a snapshot a seat saved comes back unchanged in content.
261
+ */
262
+ declare function asLoadedDocsSnapshot(snapshot: unknown): Record<string, unknown>;
268
263
  /** The canonical Docs snapshot: content only, keys sorted, runs normalized, local fields removed. */
269
264
  declare function canonicalDocsSnapshot(snapshot: unknown): unknown;
270
265
  /** The canonical form as the string the hash digests (tests compare these directly). */
@@ -856,4 +851,4 @@ declare function startWorkbookOtRoom(port: SheetsOtPort & {
856
851
  dispose?: () => void;
857
852
  }, o: WorkbookOtRoomOptions): Promise<WorkbookOtRoomHandle>;
858
853
 
859
- export { COLLAB_COVERED_KEY, type CollabBase, type CollabMutationInfo, type CollabProviderLike, type CommandServiceLike, DOCS_COLLAB_PROTO, DOCS_TRANSFORM_VERSION, DOC_LOCAL_KEYS, type DocsLocalMutation, type DocsLost, type DocsOp, type DocsOtNotice, type DocsOtPort, type DocsOtRoom, type DocsTransformResult, type DocumentOtFactoryOptions, type DocumentRestoreDeps, type DocumentRestoreResult, type OpenDocsOtRoomOptions, type OpenSheetsOtRoomOptions, type OtRoomsKnob, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, type SheetOp, type SheetSelection, type SheetsCommandService, type SheetsLocalEvent, type SheetsLocalGroup, type SheetsNotShared, type SheetsOtAdapter, type SheetsOtAdapterHooks, type SheetsOtNotice, type SheetsOtPort, type SheetsOtRoom, type SheetsWorkbookLike, type SheetsWorksheetLike, type UniverSheetsOtPortOptions, WorkbookCollabSession, type WorkbookCollabSessionOptions, type WorkbookOtRoomHandle, type WorkbookOtRoomOptions, type WorkbookOtRoomsKnob, applyDocsOp, canonicalDocsSnapshot, canonicalDocsString, canonicalKeys, canonicalSheet, canonicalSheetString, composeDocsOps, createSheetsOtAdapter, decodeSheetOp, docsStateHash, documentOtFactory, documentUsesOrderedRoom, dropEmptyStyleRetains, encodeSheetOp, invertDocsOp, isCellEditorScratch, isNoopDocsOp, moveSelectionsThrough, normalizeDocsOp, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };
854
+ export { COLLAB_COVERED_KEY, type CollabBase, type CollabMutationInfo, type CollabProviderLike, type CommandServiceLike, DOCS_COLLAB_PROTO, DOCS_TRANSFORM_VERSION, DOC_LOCAL_KEYS, type DocsLocalMutation, type DocsLost, type DocsOp, type DocsOtNotice, type DocsOtPort, type DocsOtRoom, type DocsTransformResult, type DocumentOtFactoryOptions, type DocumentRestoreDeps, type DocumentRestoreResult, type OpenDocsOtRoomOptions, type OpenSheetsOtRoomOptions, type OtRoomsKnob, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, type SheetOp, type SheetSelection, type SheetsCommandService, type SheetsLocalEvent, type SheetsLocalGroup, type SheetsNotShared, type SheetsOtAdapter, type SheetsOtAdapterHooks, type SheetsOtNotice, type SheetsOtPort, type SheetsOtRoom, type SheetsWorkbookLike, type SheetsWorksheetLike, type UniverSheetsOtPortOptions, WorkbookCollabSession, type WorkbookCollabSessionOptions, type WorkbookOtRoomHandle, type WorkbookOtRoomOptions, type WorkbookOtRoomsKnob, applyDocsOp, asLoadedDocsSnapshot, canonicalDocsSnapshot, canonicalDocsString, canonicalKeys, canonicalSheet, canonicalSheetString, composeDocsOps, createSheetsOtAdapter, decodeSheetOp, docsStateHash, documentOtFactory, documentUsesOrderedRoom, dropEmptyStyleRetains, encodeSheetOp, invertDocsOp, isCellEditorScratch, isNoopDocsOp, moveSelectionsThrough, normalizeDocsOp, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };
@@ -870,6 +870,104 @@ function invertDocsOp(op, preDoc) {
870
870
  }
871
871
  var DOCS_TRANSFORM_VERSION = "univer-1.0.4+docs-ot-r6";
872
872
 
873
+ // src/univer/collab/docs-ot/state-hash.ts
874
+ import { DocumentDataModel } from "@univerjs/core";
875
+
876
+ // src/docs/sanitize-univer-doc-snapshot.ts
877
+ import { NamedStyleType } from "@univerjs/core";
878
+
879
+ // src/core/document-page-style.ts
880
+ var TRADITIONAL = 1;
881
+ var PORTRAIT = 0;
882
+ var PX_PER_INCH = 96;
883
+ var DEFAULT_DOCUMENT_PAGE_STYLE = {
884
+ pageSize: { width: 816, height: 1056 },
885
+ documentFlavor: TRADITIONAL,
886
+ pageOrient: PORTRAIT,
887
+ marginTop: PX_PER_INCH,
888
+ marginBottom: PX_PER_INCH,
889
+ marginLeft: PX_PER_INCH,
890
+ marginRight: PX_PER_INCH,
891
+ // Univer applies no paragraph spacing to a paginated page by itself; without this every paragraph
892
+ // runs into the next (Google Docs' own default: 1.15 lines, 10px after).
893
+ defaultParagraphStyle: { spaceAbove: { v: 0 }, spaceBelow: { v: 10 }, lineSpacing: 1.15 }
894
+ };
895
+ function defaultDocumentPageStyle() {
896
+ return {
897
+ ...DEFAULT_DOCUMENT_PAGE_STYLE,
898
+ pageSize: { ...DEFAULT_DOCUMENT_PAGE_STYLE.pageSize },
899
+ defaultParagraphStyle: { ...DEFAULT_DOCUMENT_PAGE_STYLE.defaultParagraphStyle }
900
+ };
901
+ }
902
+ function isLegacySqueezedPageStyle(style) {
903
+ const size = style?.pageSize;
904
+ return !!size && size.width === 595 && size.height === 842 && style?.marginLeft === 90 && style?.marginRight === 90 && style?.marginTop === 72 && style?.marginBottom === 72;
905
+ }
906
+ var PAGE_COLORS = ["#ffffff", "#fff8e7", "#f3f3f3", "#e8f0fe", "#e6f4ea", "#fef7e0"];
907
+ var DEFAULT_PAGE_COLOR = PAGE_COLORS[0];
908
+
909
+ // src/docs/sanitize-univer-doc-snapshot.ts
910
+ var NAMED_STYLE_STRING_TO_NUMBER = Object.fromEntries(
911
+ Object.entries(NamedStyleType).filter(([key, val]) => typeof val === "number" && isNaN(Number(key))).map(([key, val]) => [key, val])
912
+ );
913
+ function sanitizeUniverDocSnapshot(snapshot, docId, opts = {}) {
914
+ restorePageStyle(snapshot, docId, opts.quiet === true);
915
+ ensureTextRuns(snapshot);
916
+ const paragraphs = snapshot?.body?.paragraphs;
917
+ if (!Array.isArray(paragraphs)) return snapshot;
918
+ let fixed = 0;
919
+ for (const paragraph of paragraphs) {
920
+ const style = paragraph?.paragraphStyle;
921
+ const value = style?.namedStyleType;
922
+ if (typeof value === "string") {
923
+ const numeric = NAMED_STYLE_STRING_TO_NUMBER[value];
924
+ if (numeric !== void 0) {
925
+ style.namedStyleType = numeric;
926
+ fixed += 1;
927
+ } else {
928
+ delete style.namedStyleType;
929
+ fixed += 1;
930
+ }
931
+ }
932
+ }
933
+ if (fixed > 0 && opts.quiet !== true) {
934
+ console.warn(
935
+ `[data-tables] RECOVERY: sanitized ${fixed} string namedStyleType value(s) to numeric NamedStyleType in document snapshot${docId ? ` ${docId}` : ""}. The snapshot was written with the wrong enum encoding (string instead of number) and would have crashed Univer's <ParagraphMenu>. Fix the snapshot writer to emit numeric NamedStyleType values.`
936
+ );
937
+ }
938
+ return snapshot;
939
+ }
940
+ function restorePageStyle(snapshot, docId, quiet = false) {
941
+ if (!snapshot || typeof snapshot !== "object") return;
942
+ const style = snapshot.documentStyle;
943
+ if (style?.pageSize?.width && isLegacySqueezedPageStyle(style)) {
944
+ const page = defaultDocumentPageStyle();
945
+ snapshot.documentStyle = { ...style, ...page, defaultParagraphStyle: style.defaultParagraphStyle ?? page.defaultParagraphStyle };
946
+ return;
947
+ }
948
+ if (style?.pageSize?.width) {
949
+ if (!style.documentFlavor) {
950
+ const page = defaultDocumentPageStyle();
951
+ Object.assign(style, { documentFlavor: page.documentFlavor });
952
+ if (page.defaultParagraphStyle) style.defaultParagraphStyle ??= page.defaultParagraphStyle;
953
+ }
954
+ return;
955
+ }
956
+ snapshot.documentStyle = {
957
+ ...defaultDocumentPageStyle(),
958
+ ...snapshot.documentStyle ?? {},
959
+ pageSize: defaultDocumentPageStyle().pageSize
960
+ };
961
+ if (quiet) return;
962
+ console.warn(
963
+ `[data-tables] RECOVERY: document snapshot${docId ? ` ${docId}` : ""} had no documentStyle.pageSize \u2014 restored the default Letter page geometry. Without a page box Univer lays the body out unbounded: text does not wrap and the viewport has no scrollable extent, so the document appears frozen. Fix the snapshot writer (agent/markdown converters must stamp DEFAULT_DOCUMENT_PAGE_STYLE).`
964
+ );
965
+ }
966
+ function ensureTextRuns(snapshot) {
967
+ const body = snapshot?.body;
968
+ if (body && typeof body === "object" && !Array.isArray(body.textRuns)) body.textRuns = [];
969
+ }
970
+
873
971
  // src/univer/collab/docs-ot/state-hash.ts
874
972
  var DOC_LOCAL_KEYS = ["rev", "__matrxCollabCovered", "__collab", "disabled", "layoutState", "textRanges", "selections"];
875
973
  function sortDeep(v) {
@@ -929,6 +1027,7 @@ function canonicalBody(body) {
929
1027
  const b = { ...body };
930
1028
  b.textRuns = canonicalRuns(b.textRuns);
931
1029
  if (Array.isArray(b.paragraphs)) b.paragraphs = b.paragraphs.map(({ paragraphId: _p, ...p }) => p);
1030
+ if (Array.isArray(b.sectionBreaks)) b.sectionBreaks = b.sectionBreaks.map(({ sectionId: _s, ...x }) => x);
932
1031
  b.customRanges = foldPieces(b.customRanges, (r) => JSON.stringify([rootId(r.rangeId), r.rangeType, sortDeep(r.properties ?? {})])).map((r) => ({
933
1032
  ...r,
934
1033
  rangeId: rootId(r.rangeId)
@@ -943,8 +1042,20 @@ function canonicalBody(body) {
943
1042
  }
944
1043
  return b;
945
1044
  }
1045
+ function asLoadedDocsSnapshot(snapshot) {
1046
+ const s = stampDeterministicIds(structuredClone(snapshot ?? {}));
1047
+ delete s.id;
1048
+ for (const k of DOC_LOCAL_KEYS) delete s[k];
1049
+ sanitizeUniverDocSnapshot(s, void 0, { quiet: true });
1050
+ const model = new DocumentDataModel(s);
1051
+ try {
1052
+ return structuredClone(model.getSnapshot());
1053
+ } finally {
1054
+ model.dispose();
1055
+ }
1056
+ }
946
1057
  function canonicalDocsSnapshot(snapshot) {
947
- const s = structuredClone(snapshot ?? {});
1058
+ const s = asLoadedDocsSnapshot(snapshot);
948
1059
  delete s.id;
949
1060
  for (const k of DOC_LOCAL_KEYS) delete s[k];
950
1061
  s.body = canonicalBody(s.body);
@@ -1153,7 +1264,10 @@ function openDocsOtRoom(o) {
1153
1264
  queue = next.filter((q) => !isNoopDocsOp(q));
1154
1265
  if (isNoopDocsOp(op)) return;
1155
1266
  }
1156
- if (!session.local(op, { ...inverse !== void 0 ? { inverse } : {}, label: m.cmd ?? RICH_TEXT_EDITING })) notice({ kind: "not_live" });
1267
+ if (!session.local(op, { ...inverse !== void 0 ? { inverse } : {}, label: m.cmd ?? RICH_TEXT_EDITING })) {
1268
+ notice({ kind: "not_live" });
1269
+ session.rebuild("not_live");
1270
+ }
1157
1271
  };
1158
1272
  const unsubLocal = port.onLocal(onLocal);
1159
1273
  const target = o.compositionTarget === void 0 ? typeof document !== "undefined" ? document : null : o.compositionTarget;
@@ -1214,6 +1328,7 @@ import * as Y2 from "yjs";
1214
1328
  import { Awareness as Awareness2 } from "y-protocols/awareness";
1215
1329
  import {
1216
1330
  awarenessOpPresence,
1331
+ claimCollaboratorColor,
1217
1332
  collabReplace,
1218
1333
  collabRoomExists,
1219
1334
  SupabaseYjsProvider,
@@ -1378,15 +1493,6 @@ async function documentUsesOrderedRoom(documentId, knob, isNewDocument) {
1378
1493
  if (knob === "new") return isNewDocument();
1379
1494
  return false;
1380
1495
  }
1381
- function pickColor2(uid) {
1382
- const palette = ["#ef4444", "#f59e0b", "#10b981", "#3b82f6", "#8b5cf6", "#ec4899", "#14b8a6", "#f97316"];
1383
- let h = 2166136261;
1384
- for (let i = 0; i < uid.length; i++) {
1385
- h ^= uid.charCodeAt(i);
1386
- h = Math.imul(h, 16777619);
1387
- }
1388
- return palette[Math.abs(h) % palette.length] ?? "#ec4899";
1389
- }
1390
1496
  function documentOtFactory(o) {
1391
1497
  return async (basePort, onAwareness) => {
1392
1498
  const latest = await getLatestDocumentSnapshot(o.documentId);
@@ -1400,7 +1506,8 @@ function documentOtFactory(o) {
1400
1506
  }
1401
1507
  const doc = new Y2.Doc();
1402
1508
  const awareness = new Awareness2(doc);
1403
- awareness.setLocalState({ uid: o.uid, clientId: o.clientId, name: o.displayName ?? o.uid.slice(0, 8), color: pickColor2(o.uid), ts: Date.now() });
1509
+ awareness.setLocalState({ uid: o.uid, clientId: o.clientId, name: o.displayName ?? o.uid.slice(0, 8), ts: Date.now() });
1510
+ const stopColor = claimCollaboratorColor(awareness, { uid: o.uid, clientId: o.clientId });
1404
1511
  const carets = new RemoteCaretBook(awareness.clientID);
1405
1512
  const emit = () => onAwareness({ states: new Map(awareness.getStates()), selfUid: o.uid, carets: carets.list() });
1406
1513
  const publishAwareness = () => {
@@ -1486,6 +1593,7 @@ function documentOtFactory(o) {
1486
1593
  replace: (snapshot) => room.replace(snapshot),
1487
1594
  stop: () => {
1488
1595
  clearInterval(caretTimer);
1596
+ stopColor();
1489
1597
  room.stop();
1490
1598
  awareness.off("change", publishAwareness);
1491
1599
  provider.disconnect();
@@ -3274,7 +3382,7 @@ function univerSheetsOtPort(o) {
3274
3382
  const a = forApply(m);
3275
3383
  applying = true;
3276
3384
  try {
3277
- const ok2 = cs.syncExecuteCommand(a.id, { ...json(a.params), unitId: u }, { onlyLocal: true, fromCollab: true });
3385
+ const ok2 = cs.syncExecuteCommand(a.id, { ...json(a.params), unitId: u }, { fromCollab: true });
3278
3386
  if (ok2 === false) throw new Error(`"${m.id}" was refused by the editor`);
3279
3387
  } finally {
3280
3388
  applying = false;
@@ -3454,7 +3562,7 @@ async function workbookUsesOrderedRoom(workbookId, knob, isNewWorkbook) {
3454
3562
  if (knob === "new") return isNewWorkbook();
3455
3563
  return false;
3456
3564
  }
3457
- function pickColor3(uid) {
3565
+ function pickColor2(uid) {
3458
3566
  const palette = ["#ef4444", "#f59e0b", "#10b981", "#3b82f6", "#8b5cf6", "#ec4899", "#14b8a6", "#f97316"];
3459
3567
  let h = 2166136261;
3460
3568
  for (let i = 0; i < uid.length; i++) {
@@ -3479,7 +3587,7 @@ async function startWorkbookOtRoom(port, o) {
3479
3587
  uid: o.uid,
3480
3588
  clientId: o.clientId,
3481
3589
  name: o.displayName ?? o.uid.slice(0, 8),
3482
- color: pickColor3(o.uid),
3590
+ color: pickColor2(o.uid),
3483
3591
  sheetId: null,
3484
3592
  row: null,
3485
3593
  col: null,
@@ -3550,6 +3658,7 @@ export {
3550
3658
  SHEETS_EDIT_GROUP,
3551
3659
  WorkbookCollabSession,
3552
3660
  applyDocsOp,
3661
+ asLoadedDocsSnapshot,
3553
3662
  canonicalDocsSnapshot,
3554
3663
  canonicalDocsString,
3555
3664
  canonicalKeys,