superdoc 2.29.0-next.1 → 2.29.0-next.3

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 (67) hide show
  1. package/dist/chunks/{FindReplaceSurface-Dm043CZP.es.js → FindReplaceSurface-BKVHzhQ4.es.js} +34 -26
  2. package/dist/chunks/{FindReplaceSurface-BRs3JrCq.cjs → FindReplaceSurface-BNDrJ6VS.cjs} +34 -26
  3. package/dist/chunks/{PasswordPromptSurface-DGjmN7A-.es.js → PasswordPromptSurface-6mF6Azda.es.js} +6 -4
  4. package/dist/chunks/{PasswordPromptSurface-BpqP4pUa.cjs → PasswordPromptSurface-BNkaztaP.cjs} +6 -4
  5. package/dist/chunks/{create-super-doc-ui-0OA8hCNb.cjs → create-super-doc-ui-BAGOnYGM.cjs} +2 -2
  6. package/dist/chunks/{create-super-doc-ui-Duf65d0b.es.js → create-super-doc-ui-BFt8agAI.es.js} +2 -2
  7. package/dist/collaboration-upgrade-engine.cjs +1 -1
  8. package/dist/collaboration-upgrade-engine.es.js +1 -1
  9. package/dist/document-api/src/contract/metadata-types.d.ts +1 -1
  10. package/dist/document-api/src/contract/operation-definitions.d.ts +1 -1
  11. package/dist/document-api/src/tables/tables.d.ts +2 -1
  12. package/dist/document-api/src/types/table-operations.types.d.ts +1 -0
  13. package/dist/layout-engine/contracts/src/index.d.ts +1 -1
  14. package/dist/layout-engine/contracts/src/paragraph-visible-text.d.ts +3 -1
  15. package/dist/public/ui-react.cjs +1 -1
  16. package/dist/public/ui-react.es.js +1 -1
  17. package/dist/public/ui-vue.cjs +1 -1
  18. package/dist/public/ui-vue.es.js +1 -1
  19. package/dist/public/ui.cjs +1 -1
  20. package/dist/public/ui.es.js +1 -1
  21. package/dist/style.css +1 -1
  22. package/dist/style.layered.css +1 -1
  23. package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +88 -1264
  24. package/dist/superdoc/src/components/CommentsLayer/CommentHeader.vue.d.ts +106 -22
  25. package/dist/superdoc/src/components/CommentsLayer/CommentInput.vue.d.ts +74 -14
  26. package/dist/superdoc/src/components/CommentsLayer/CommentsDropdown.vue.d.ts +55 -20
  27. package/dist/superdoc/src/components/CommentsLayer/InternalDropdown.vue.d.ts +24 -8
  28. package/dist/superdoc/src/components/CommentsLayer/PdfCommentsLayer.vue.d.ts +5 -3
  29. package/dist/superdoc/src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue.d.ts +60 -12
  30. package/dist/superdoc/src/components/CommentsLayer/commentsList/commentsList.vue.d.ts +20 -6
  31. package/dist/superdoc/src/components/CommentsLayer/use-comment.d.ts +1 -0
  32. package/dist/superdoc/src/components/general/Avatar.vue.d.ts +12 -5
  33. package/dist/superdoc/src/components/surfaces/FindReplaceSurface.vue.d.ts +58 -15
  34. package/dist/superdoc/src/components/surfaces/PasswordPromptSurface.vue.d.ts +58 -15
  35. package/dist/superdoc/src/components/surfaces/SurfaceFloating.vue.d.ts +14 -6
  36. package/dist/superdoc/src/components/surfaces/SurfaceHost.vue.d.ts +25 -15
  37. package/dist/superdoc/src/core/SuperDoc.d.ts +1 -6
  38. package/dist/superdoc/src/core/collaboration/permissions.d.ts +1 -1
  39. package/dist/superdoc/src/core/editor-runtime/index.d.ts +1 -1
  40. package/dist/superdoc/src/core/editor-runtime/types.d.ts +7 -0
  41. package/dist/superdoc/src/core/editor-runtime/v2/v2-editor-runtime-adapter.d.ts +2 -1
  42. package/dist/superdoc/src/icons.d.ts +8 -0
  43. package/dist/superdoc/src/internal/toolbar/built-in/AIWriter.vue.d.ts +76 -15
  44. package/dist/superdoc/src/internal/toolbar/built-in/AlignmentButtons.vue.d.ts +5 -3
  45. package/dist/superdoc/src/internal/toolbar/built-in/ButtonGroup.vue.d.ts +105 -5
  46. package/dist/superdoc/src/internal/toolbar/built-in/DocumentMode.vue.d.ts +20 -6
  47. package/dist/superdoc/src/internal/toolbar/built-in/IconGrid.vue.d.ts +44 -12
  48. package/dist/superdoc/src/internal/toolbar/built-in/IconGridRow.vue.d.ts +32 -9
  49. package/dist/superdoc/src/internal/toolbar/built-in/StyleButtonsList.vue.d.ts +39 -10
  50. package/dist/superdoc/src/internal/toolbar/built-in/TableActions.vue.d.ts +24 -6
  51. package/dist/superdoc/src/internal/toolbar/built-in/TableGrid.vue.d.ts +7 -3
  52. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarComboBox.vue.d.ts +1 -1
  53. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarDropdown.vue.d.ts +1 -0
  54. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarSeparator.vue.d.ts +16 -6
  55. package/dist/superdoc/src/internal/toolbar/built-in/color-dropdown-helpers.d.ts +2 -2
  56. package/dist/superdoc/src/internal/toolbar/built-in/list-style-buttons.d.ts +2 -2
  57. package/dist/superdoc/src/internal/toolbar/built-in/toolbarIcons.d.ts +67 -0
  58. package/dist/superdoc/src/stores/helpers/comment-draft-text.d.ts +1 -0
  59. package/dist/superdoc/src/stores/helpers/tracked-change-row-values.d.ts +25 -0
  60. package/dist/superdoc.cjs +349 -231
  61. package/dist/superdoc.es.js +322 -207
  62. package/dist-cdn/style.layered.css +1 -1
  63. package/dist-cdn/superdoc.min.css +1 -1
  64. package/dist-cdn/superdoc.min.js +42 -42
  65. package/package.json +2 -2
  66. package/dist/superdoc/src/internal/toolbar/built-in/FontFamilyCombobox.vue.d.ts +0 -10
  67. package/dist/superdoc/src/internal/toolbar/built-in/FontSizeCombobox.vue.d.ts +0 -10
@@ -1,6 +1,6 @@
1
1
  import { i as __toESM$2 } from "./chunks/rolldown-runtime-0pSA04fp.es.js";
2
2
  import { t as blank_default } from "./chunks/blank-docx-DzQccOlW.es.js";
3
- import { C as getWorkflowRecording, S as createInteractionHistory, T as recordInteraction, _ as isAllowed, a as registerFirstPartyCommandMutation, b as DOM_CLASS_NAMES, c as getCommandDescriptor, d as mutationCommittedEventChangedDocument, f as createImageFilePicker, g as createTrackedChangePermissionResolver, h as PERMISSIONS, i as readFirstPartyPageNumbers, l as applyV2CommentInvalidationFromMutation, n as executeFirstPartyCommandAsync, o as isRecord, p as resolveImageSrc, r as executeFirstPartyShortcutAsync, t as createSuperDocUI, u as getV2TrackedChangeMutationImpact, v as isPlainObject$1, w as isWorkflowRecordingEnabled, x as closeInteractionHistory, y as isSyntheticTrackedChangeCommentLaneItem } from "./chunks/create-super-doc-ui-Duf65d0b.es.js";
3
+ import { C as getWorkflowRecording, S as createInteractionHistory, T as recordInteraction, _ as isAllowed, a as registerFirstPartyCommandMutation, b as DOM_CLASS_NAMES, c as getCommandDescriptor, d as mutationCommittedEventChangedDocument, f as createImageFilePicker, g as createTrackedChangePermissionResolver, h as PERMISSIONS, i as readFirstPartyPageNumbers, l as applyV2CommentInvalidationFromMutation, n as executeFirstPartyCommandAsync, o as isRecord, p as resolveImageSrc, r as executeFirstPartyShortcutAsync, t as createSuperDocUI, u as getV2TrackedChangeMutationImpact, v as isPlainObject$1, w as isWorkflowRecordingEnabled, x as closeInteractionHistory, y as isSyntheticTrackedChangeCommentLaneItem } from "./chunks/create-super-doc-ui-BFt8agAI.es.js";
4
4
  import { t as import_eventemitter3 } from "./chunks/eventemitter3-DEIiXiH2.es.js";
5
5
  import { t as v4 } from "./chunks/uuid-H0Xcmmhy.es.js";
6
6
  import { $ as vModelSelect, A as onActivated, B as renderList, C as isRef$1, D as normalizeClass, E as nextTick, F as openBlock, G as toDisplayString, H as resolveDirective, I as provide$1, J as toRefs, K as toRaw$2, L as reactive, M as onDeactivated, N as onMounted, O as normalizeProps, P as onScopeDispose$1, Q as vModelCheckbox, R as readonly, S as isReactive$1, T as mergeProps, U as resolveDynamicComponent, V as renderSlot, W as shallowRef$1, X as useAttrs, Y as unref, Z as useSlots, _ as getCurrentInstance, a as computed$1, at as withModifiers, b as hasInjectionContext, c as createCommentVNode, d as createStaticVNode, et as vModelText, f as createTextVNode, g as effectScope, h as defineComponent, i as Transition, it as withKeys, j as onBeforeUnmount, k as normalizeStyle, l as createElementBlock, m as defineAsyncComponent, n as Fragment, nt as withCtx, o as createApp, p as createVNode, q as toRef, r as Teleport, rt as withDirectives, s as createBlock, t as _plugin_vue_export_helper_default, tt as watch$1, u as createElementVNode, v as getCurrentScope, w as markRaw, x as inject$1, y as h, z as ref } from "./chunks/_plugin-vue_export-helper-CsJQtMvr.es.js";
@@ -258,7 +258,7 @@ var v_click_outside_default = {
258
258
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
259
259
  function getSuperdocVersion() {
260
260
  try {
261
- return "2.29.0-next.1";
261
+ return "2.29.0-next.3";
262
262
  } catch {
263
263
  return "unknown";
264
264
  }
@@ -7383,74 +7383,88 @@ var buildTrackedChangeDecisionLinkIndex = (allComments, previous = /* @__PURE__
7383
7383
  return next;
7384
7384
  };
7385
7385
  //#endregion
7386
- //#region src/stores/comments-store.js
7387
- var makeTrackedChangeAnchorKey = ({ storyKey, rawId }) => `tc::${storyKey}::${rawId}`;
7386
+ //#region src/stores/helpers/comment-draft-text.ts
7388
7387
  var COMMENT_DRAFT_BR_TAG = /<br(?:\s[^>]*)?\s*\/?>/gi;
7389
7388
  var COMMENT_DRAFT_BLOCK_BOUNDARY = /(?:<\/(?:p|div|li|blockquote|pre|h[1-6])\s*>\s*)+(?:<(?:p|div|li|blockquote|pre|h[1-6])(?:\s[^>]*)?\s*\/?>)+/gi;
7390
7389
  var COMMENT_DRAFT_BLOCK_OPEN_TAG = /<(?:p|div|li|blockquote|pre|h[1-6])(?:\s[^>]*)?\s*\/?>/gi;
7391
7390
  var COMMENT_DRAFT_BLOCK_CLOSE_TAG = /<\/(?:p|div|li|blockquote|pre|h[1-6])\s*>/gi;
7392
7391
  var COMMENT_DRAFT_ANY_TAG = /<\/?[A-Za-z][A-Za-z0-9:-]*(?:\s[^>]*)?\s*\/?>/g;
7393
- var COMMENT_DRAFT_ENTITY = /&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z][a-zA-Z0-9]+);/g;
7394
- var COMMENT_DRAFT_NAMED_ENTITIES = {
7395
- amp: "&",
7396
- apos: "'",
7397
- gt: ">",
7398
- lt: "<",
7399
- nbsp: " ",
7400
- quot: "\""
7392
+ var COMMENT_DRAFT_ENTITY = /&(#[xX][0-9a-fA-F]+|#\d+|[a-zA-Z][a-zA-Z0-9]+);/g;
7393
+ var COMMENT_DRAFT_NAMED_ENTITIES = /* @__PURE__ */ new Map([
7394
+ ["amp", "&"],
7395
+ ["apos", "'"],
7396
+ ["gt", ">"],
7397
+ ["lt", "<"],
7398
+ ["nbsp", " "],
7399
+ ["quot", "\""]
7400
+ ]);
7401
+ var decodeCommentDraftEntity = (entity) => {
7402
+ const lower = entity.toLowerCase();
7403
+ const named = COMMENT_DRAFT_NAMED_ENTITIES.get(lower);
7404
+ if (named !== void 0) return named;
7405
+ const radix = lower.startsWith("#x") ? 16 : lower.startsWith("#") ? 10 : null;
7406
+ if (!radix) return null;
7407
+ const value = lower.startsWith("#x") ? lower.slice(2) : lower.slice(1);
7408
+ const codePoint = Number.parseInt(value, radix);
7409
+ if (!Number.isFinite(codePoint)) return null;
7410
+ try {
7411
+ return String.fromCodePoint(codePoint);
7412
+ } catch {
7413
+ return null;
7414
+ }
7415
+ };
7416
+ var decodeCommentDraftEntities = (value) => value.replace(COMMENT_DRAFT_ENTITY, (match, entity) => decodeCommentDraftEntity(entity) ?? match);
7417
+ var normalizeV2CommentDraftText = (value) => {
7418
+ const html = String(value ?? "");
7419
+ if (!html || html === "<p></p>") return "";
7420
+ return decodeCommentDraftEntities(html.replace(COMMENT_DRAFT_BLOCK_BOUNDARY, "\n").replace(COMMENT_DRAFT_BR_TAG, "\n").replace(COMMENT_DRAFT_BLOCK_CLOSE_TAG, "").replace(COMMENT_DRAFT_BLOCK_OPEN_TAG, "").replace(COMMENT_DRAFT_ANY_TAG, ""));
7401
7421
  };
7422
+ //#endregion
7423
+ //#region src/stores/helpers/tracked-change-row-values.ts
7424
+ var isObjectOrArray = (value) => isPlainObject$1(value) || Array.isArray(value);
7425
+ var stringOrEmpty = (value) => typeof value === "string" ? value : "";
7426
+ var makeTrackedChangeAnchorKey = ({ storyKey, rawId }) => `tc::${storyKey}::${rawId}`;
7402
7427
  var shallowEqual = (a, b) => {
7403
7428
  if (Object.is(a, b)) return true;
7404
- if (!a || !b || typeof a !== "object" || typeof b !== "object") return false;
7429
+ if (!isObjectOrArray(a) || !isObjectOrArray(b)) return false;
7405
7430
  const aKeys = Object.keys(a);
7406
7431
  const bKeys = Object.keys(b);
7407
7432
  if (aKeys.length !== bKeys.length) return false;
7408
7433
  return aKeys.every((key) => Object.prototype.hasOwnProperty.call(b, key) && Object.is(a[key], b[key]));
7409
7434
  };
7410
- /**
7411
- * Normalize the optional signed tracked-change detail lines
7412
- * (`[{ excerpt, label }]`, TCS-LIST-005) to a stable shape; absent, empty, or
7413
- * malformed input reads as `null` so legacy rows stay untouched.
7414
- */
7435
+ var elementsShallowEqual = (a, b) => {
7436
+ if (a === b) return true;
7437
+ if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
7438
+ return a.every((element, index) => shallowEqual(element, b[index]));
7439
+ };
7415
7440
  var normalizeTrackedChangeDetailLines = (lines) => {
7416
7441
  if (!Array.isArray(lines)) return null;
7417
- const normalized = lines.filter((line) => line && typeof line === "object").map((line) => ({
7418
- excerpt: typeof line.excerpt === "string" ? line.excerpt : "",
7419
- label: typeof line.label === "string" ? line.label : ""
7442
+ const normalized = lines.filter(isObjectOrArray).map((line) => ({
7443
+ excerpt: stringOrEmpty(line.excerpt),
7444
+ label: stringOrEmpty(line.label)
7420
7445
  }));
7421
7446
  return normalized.length > 0 ? normalized : null;
7422
7447
  };
7423
- /**
7424
- * Element-wise equality for detail-line arrays: refresh paths rebuild the
7425
- * array each pass, so reference equality would rebroadcast every keystroke.
7426
- */
7427
- var trackedChangeDetailLinesEqual = (a, b) => {
7428
- if (a === b) return true;
7429
- if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
7430
- return a.every((line, index) => shallowEqual(line, b[index]));
7431
- };
7448
+ var trackedChangeDetailLinesEqual = elementsShallowEqual;
7432
7449
  var normalizeTrackedChangeCustomAttributes = (attributes) => {
7433
7450
  if (!Array.isArray(attributes)) return null;
7434
- return attributes.filter((attribute) => attribute && typeof attribute === "object").map((attribute) => ({
7435
- name: typeof attribute.name === "string" ? attribute.name : "",
7436
- namespaceUri: typeof attribute.namespaceUri === "string" ? attribute.namespaceUri : "",
7437
- localName: typeof attribute.localName === "string" ? attribute.localName : "",
7438
- value: typeof attribute.value === "string" ? attribute.value : ""
7451
+ return attributes.filter(isObjectOrArray).map((attribute) => ({
7452
+ name: stringOrEmpty(attribute.name),
7453
+ namespaceUri: stringOrEmpty(attribute.namespaceUri),
7454
+ localName: stringOrEmpty(attribute.localName),
7455
+ value: stringOrEmpty(attribute.value)
7439
7456
  })).filter((attribute) => attribute.name && attribute.namespaceUri && attribute.localName);
7440
7457
  };
7441
- var trackedChangeCustomAttributesEqual = (left, right) => {
7442
- if (left === right) return true;
7443
- if (!Array.isArray(left) || !Array.isArray(right) || left.length !== right.length) return false;
7444
- return left.every((attribute, index) => shallowEqual(attribute, right[index]));
7445
- };
7458
+ var trackedChangeCustomAttributesEqual = elementsShallowEqual;
7459
+ var positiveDimension = (value) => isFiniteNumber(value) && value > 0 ? value : null;
7446
7460
  var normalizeTrackedChangeImagePreview = (preview) => {
7447
- if (!preview || typeof preview !== "object") return null;
7461
+ if (!isObjectOrArray(preview)) return null;
7448
7462
  const src = typeof preview.src === "string" ? preview.src : null;
7449
7463
  if (!src || !src.startsWith("data:image/")) return null;
7450
7464
  const contentType = typeof preview.contentType === "string" && preview.contentType.startsWith("image/") ? preview.contentType : null;
7451
7465
  const role = typeof preview.role === "string" ? preview.role : null;
7452
- const width = isFiniteNumber(preview.width) && preview.width > 0 ? preview.width : null;
7453
- const height = isFiniteNumber(preview.height) && preview.height > 0 ? preview.height : null;
7466
+ const width = positiveDimension(preview.width);
7467
+ const height = positiveDimension(preview.height);
7454
7468
  const alt = typeof preview.alt === "string" && preview.alt.length > 0 ? preview.alt : "Tracked image preview";
7455
7469
  return {
7456
7470
  src,
@@ -7461,35 +7475,16 @@ var normalizeTrackedChangeImagePreview = (preview) => {
7461
7475
  alt
7462
7476
  };
7463
7477
  };
7464
- var decodeCommentDraftEntity = (entity) => {
7465
- const lower = String(entity).toLowerCase();
7466
- const named = COMMENT_DRAFT_NAMED_ENTITIES[lower];
7467
- if (named !== void 0) return named;
7468
- const radix = lower.startsWith("#x") ? 16 : lower.startsWith("#") ? 10 : null;
7469
- if (!radix) return null;
7470
- const value = lower.startsWith("#x") ? lower.slice(2) : lower.slice(1);
7471
- const codePoint = Number.parseInt(value, radix);
7472
- if (!Number.isFinite(codePoint)) return null;
7473
- try {
7474
- return String.fromCodePoint(codePoint);
7475
- } catch {
7476
- return null;
7477
- }
7478
- };
7479
- var decodeCommentDraftEntities = (value) => value.replace(COMMENT_DRAFT_ENTITY, (match, entity) => decodeCommentDraftEntity(entity) ?? match);
7480
- var normalizeV2CommentDraftText = (value) => {
7481
- const html = String(value ?? "");
7482
- if (!html || html === "<p></p>") return "";
7483
- return decodeCommentDraftEntities(html.replace(COMMENT_DRAFT_BLOCK_BOUNDARY, "\n").replace(COMMENT_DRAFT_BR_TAG, "\n").replace(COMMENT_DRAFT_BLOCK_CLOSE_TAG, "").replace(COMMENT_DRAFT_BLOCK_OPEN_TAG, "").replace(COMMENT_DRAFT_ANY_TAG, ""));
7484
- };
7485
7478
  var cloneV2TrackedChangeStory = (story) => {
7486
- if (!story || typeof story !== "object") return null;
7479
+ if (!isObjectOrArray(story)) return null;
7487
7480
  const rawStory = toRaw$2(story);
7488
7481
  return {
7489
7482
  ...rawStory,
7490
- ...rawStory.section && typeof rawStory.section === "object" ? { section: { ...toRaw$2(rawStory.section) } } : {}
7483
+ ...isObjectOrArray(rawStory.section) ? { section: { ...toRaw$2(rawStory.section) } } : {}
7491
7484
  };
7492
7485
  };
7486
+ //#endregion
7487
+ //#region src/stores/comments-store.js
7493
7488
  var useCommentsStore = defineStore("comments", () => {
7494
7489
  const BODY_TRACKED_CHANGE_STORY = {
7495
7490
  kind: "story",
@@ -11092,7 +11087,7 @@ function useUiFontFamily() {
11092
11087
  }) };
11093
11088
  }
11094
11089
  //#endregion
11095
- //#region src/components/CommentsLayer/CommentsDropdown.vue
11090
+ //#region src/components/CommentsLayer/CommentsDropdown.vue?vue&type=script&setup=true&lang.ts
11096
11091
  var _hoisted_1$31 = { class: "comments-dropdown" };
11097
11092
  var _hoisted_2$24 = ["onClick"];
11098
11093
  var _hoisted_3$21 = {
@@ -11101,7 +11096,9 @@ var _hoisted_3$21 = {
11101
11096
  };
11102
11097
  var _hoisted_4$15 = ["innerHTML"];
11103
11098
  var _hoisted_5$11 = { class: "comments-dropdown__option-label" };
11104
- var CommentsDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11099
+ //#endregion
11100
+ //#region src/components/CommentsLayer/CommentsDropdown.vue
11101
+ var CommentsDropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
11105
11102
  __name: "CommentsDropdown",
11106
11103
  props: {
11107
11104
  options: {
@@ -11250,14 +11247,16 @@ var CommentsDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11250
11247
  }), 128))], 4)) : createCommentVNode("", true)]))]);
11251
11248
  };
11252
11249
  }
11253
- }, [["__scopeId", "data-v-7eced80a"]]);
11250
+ }), [["__scopeId", "data-v-70674ffd"]]);
11254
11251
  //#endregion
11255
- //#region src/components/CommentsLayer/InternalDropdown.vue
11252
+ //#region src/components/CommentsLayer/InternalDropdown.vue?vue&type=script&setup=true&lang.ts
11256
11253
  var _hoisted_1$30 = { class: "sd-comment-option" };
11257
11254
  var _hoisted_2$23 = ["innerHTML"];
11258
11255
  var _hoisted_3$20 = { class: "sd-option-state" };
11259
11256
  var _hoisted_4$14 = ["innerHTML"];
11260
- var InternalDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11257
+ //#endregion
11258
+ //#region src/components/CommentsLayer/InternalDropdown.vue
11259
+ var InternalDropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
11261
11260
  __name: "InternalDropdown",
11262
11261
  props: {
11263
11262
  state: {
@@ -11339,7 +11338,7 @@ var InternalDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11339
11338
  }, 8, ["disabled", "content-style"])], 4);
11340
11339
  };
11341
11340
  }
11342
- }, [["__scopeId", "data-v-138d641e"]]);
11341
+ }), [["__scopeId", "data-v-026f5d66"]]);
11343
11342
  //#endregion
11344
11343
  //#region src/components/CommentsLayer/helpers.js
11345
11344
  /**
@@ -11372,14 +11371,16 @@ function formatDate(timestamp) {
11372
11371
  return `${`${formattedHours}:${minutes.toString().padStart(2, "0")}${meridiem}`} ${month} ${day}`;
11373
11372
  }
11374
11373
  //#endregion
11375
- //#region src/components/general/Avatar.vue
11374
+ //#region src/components/general/Avatar.vue?vue&type=script&setup=true&lang.ts
11376
11375
  var _hoisted_1$29 = { class: "user-container" };
11377
11376
  var _hoisted_2$22 = ["src"];
11378
11377
  var _hoisted_3$19 = {
11379
11378
  key: 1,
11380
11379
  class: "user-bg"
11381
11380
  };
11382
- var Avatar_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11381
+ //#endregion
11382
+ //#region src/components/general/Avatar.vue
11383
+ var Avatar_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
11383
11384
  __name: "Avatar",
11384
11385
  props: { user: {
11385
11386
  type: Object,
@@ -11403,9 +11404,9 @@ var Avatar_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11403
11404
  }, null, 8, _hoisted_2$22)) : (openBlock(), createElementBlock("span", _hoisted_3$19, toDisplayString(getInitials(__props.user.name, __props.user.email)), 1))]);
11404
11405
  };
11405
11406
  }
11406
- }, [["__scopeId", "data-v-c95b2073"]]);
11407
+ }), [["__scopeId", "data-v-0b3a0868"]]);
11407
11408
  //#endregion
11408
- //#region src/components/CommentsLayer/CommentHeader.vue
11409
+ //#region src/components/CommentsLayer/CommentHeader.vue?vue&type=script&setup=true&lang.ts
11409
11410
  var _hoisted_1$28 = { class: "card-section comment-header" };
11410
11411
  var _hoisted_2$21 = { class: "comment-header-left" };
11411
11412
  var _hoisted_3$18 = { class: "user-info" };
@@ -11435,7 +11436,9 @@ var _hoisted_9$4 = [
11435
11436
  ];
11436
11437
  var _hoisted_10$4 = { class: "overflow-menu__icon" };
11437
11438
  var _hoisted_11$4 = ["innerHTML"];
11438
- var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11439
+ //#endregion
11440
+ //#region src/components/CommentsLayer/CommentHeader.vue
11441
+ var CommentHeader_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
11439
11442
  __name: "CommentHeader",
11440
11443
  props: {
11441
11444
  timestamp: {
@@ -11448,7 +11451,7 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11448
11451
  },
11449
11452
  comment: {
11450
11453
  type: Object,
11451
- required: false
11454
+ required: true
11452
11455
  },
11453
11456
  isPendingInput: {
11454
11457
  type: Boolean,
@@ -11490,9 +11493,9 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11490
11493
  const emit = __emit;
11491
11494
  const commentsStore = useCommentsStore();
11492
11495
  const props = __props;
11493
- const { proxy } = getCurrentInstance();
11494
- const role = proxy.$superdoc.config.role;
11495
- const isInternal = proxy.$superdoc.config.isInternal;
11496
+ const { proxy, superdoc } = useSuperDocInstance();
11497
+ const role = superdoc.config.role;
11498
+ const isInternal = superdoc.config.isInternal;
11496
11499
  const isCommentOwnedByCurrentUser = (comment) => {
11497
11500
  const currentUser = proxy.$superdoc.config.user;
11498
11501
  const otherUser = {
@@ -11715,9 +11718,9 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11715
11718
  ], 2)]);
11716
11719
  };
11717
11720
  }
11718
- }, [["__scopeId", "data-v-3af1135b"]]);
11721
+ }), [["__scopeId", "data-v-5831e876"]]);
11719
11722
  //#endregion
11720
- //#region src/components/CommentsLayer/CommentInput.vue
11723
+ //#region src/components/CommentsLayer/CommentInput.vue?vue&type=script&setup=true&lang.ts
11721
11724
  var _hoisted_1$27 = { class: "input-section" };
11722
11725
  var _hoisted_2$20 = { class: "comment-composer" };
11723
11726
  var _hoisted_3$17 = [
@@ -11737,7 +11740,9 @@ var _hoisted_6$7 = {
11737
11740
  class: "comment-mention-option__email"
11738
11741
  };
11739
11742
  var commentInputSequence = 0;
11740
- var CommentInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11743
+ //#endregion
11744
+ //#region src/components/CommentsLayer/CommentInput.vue
11745
+ var CommentInput_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
11741
11746
  __name: "CommentInput",
11742
11747
  props: {
11743
11748
  users: {
@@ -11759,7 +11764,7 @@ var CommentInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11759
11764
  },
11760
11765
  comment: {
11761
11766
  type: Object,
11762
- required: false
11767
+ required: true
11763
11768
  }
11764
11769
  },
11765
11770
  emits: ["focus"],
@@ -11846,7 +11851,8 @@ var CommentInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11846
11851
  };
11847
11852
  const onInput = (event) => {
11848
11853
  currentCommentMentions.value = currentCommentMentions.value.filter((user) => commentDraft.value.includes(`@${displayName(user)}`));
11849
- updateMentionQuery(event.target.selectionStart ?? commentDraft.value.length);
11854
+ const caret = event.target instanceof HTMLTextAreaElement ? event.target.selectionStart : null;
11855
+ updateMentionQuery(caret ?? commentDraft.value.length);
11850
11856
  syncInputHeight();
11851
11857
  };
11852
11858
  const selectMention = (user) => {
@@ -11935,7 +11941,7 @@ var CommentInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11935
11941
  }), 128))])) : createCommentVNode("", true)])], 2)]);
11936
11942
  };
11937
11943
  }
11938
- }, [["__scopeId", "data-v-0720a671"]]);
11944
+ }), [["__scopeId", "data-v-aa97de44"]]);
11939
11945
  //#endregion
11940
11946
  //#region src/internal/toolbar/built-in/url-safety.js
11941
11947
  /**
@@ -13381,9 +13387,9 @@ var CommentDialog_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
13381
13387
  ], 64))], 14, _hoisted_1$26)), [[_directive_click_outside, handleClickOutside]]);
13382
13388
  };
13383
13389
  }
13384
- }), [["__scopeId", "data-v-752d9e0b"]]);
13390
+ }), [["__scopeId", "data-v-90d88bf5"]]);
13385
13391
  //#endregion
13386
- //#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue
13392
+ //#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue?vue&type=script&setup=true&lang.ts
13387
13393
  var _hoisted_1$25 = [
13388
13394
  "tabindex",
13389
13395
  "aria-posinset",
@@ -13395,7 +13401,9 @@ var _hoisted_1$25 = [
13395
13401
  "data-comment-page-index",
13396
13402
  "data-review-directory-index"
13397
13403
  ];
13398
- var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13404
+ //#endregion
13405
+ //#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue
13406
+ var ReviewDirectoryListItem_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
13399
13407
  __name: "ReviewDirectoryListItem",
13400
13408
  props: {
13401
13409
  item: {
@@ -13444,12 +13452,15 @@ var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_de
13444
13452
  });
13445
13453
  const measure = () => {
13446
13454
  const height = shell.value?.getBoundingClientRect?.().height;
13447
- if (Number.isFinite(height) && height > 0) measuredHeight.value = height;
13455
+ if (isFiniteNumber(height) && height > 0) measuredHeight.value = height;
13448
13456
  };
13449
13457
  const onFocusIn = () => {
13450
13458
  containsFocus.value = true;
13451
13459
  emit("focus-item", props.index);
13452
13460
  };
13461
+ const onFocusOut = (event) => {
13462
+ containsFocus.value = event.relatedTarget instanceof Node && shell.value?.contains(event.relatedTarget) === true;
13463
+ };
13453
13464
  const onKeydown = (event) => {
13454
13465
  if (![
13455
13466
  "ArrowDown",
@@ -13457,7 +13468,7 @@ var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_de
13457
13468
  "Home",
13458
13469
  "End"
13459
13470
  ].includes(event.key)) return;
13460
- if (event.target?.closest?.("input, textarea, select, button, [contenteditable=\"true\"]")) return;
13471
+ if (event.target instanceof Element && event.target.closest("input, textarea, select, button, [contenteditable=\"true\"]")) return;
13461
13472
  event.preventDefault();
13462
13473
  emit("navigate", {
13463
13474
  index: props.index,
@@ -13465,6 +13476,8 @@ var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_de
13465
13476
  });
13466
13477
  };
13467
13478
  onMounted(() => {
13479
+ const element = shell.value;
13480
+ if (!element) return;
13468
13481
  if (typeof IntersectionObserver !== "undefined") {
13469
13482
  intersectionObserver = new IntersectionObserver((entries) => {
13470
13483
  const entry = entries[0];
@@ -13475,11 +13488,11 @@ var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_de
13475
13488
  root: null,
13476
13489
  rootMargin: "600px 0px"
13477
13490
  });
13478
- intersectionObserver.observe(shell.value);
13491
+ intersectionObserver.observe(element);
13479
13492
  }
13480
13493
  if (typeof ResizeObserver !== "undefined") {
13481
13494
  resizeObserver = new ResizeObserver(measure);
13482
- resizeObserver.observe(shell.value);
13495
+ resizeObserver.observe(element);
13483
13496
  }
13484
13497
  nextTick(measure);
13485
13498
  });
@@ -13504,7 +13517,7 @@ var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_de
13504
13517
  "data-comment-page-index": Number.isFinite(__props.item.floatingPageIndex) ? __props.item.floatingPageIndex : "",
13505
13518
  "data-review-directory-index": __props.index,
13506
13519
  onFocusin: onFocusIn,
13507
- onFocusout: _cache[0] || (_cache[0] = ($event) => containsFocus.value = shell.value?.contains?.($event.relatedTarget) === true),
13520
+ onFocusout: onFocusOut,
13508
13521
  onKeydown
13509
13522
  }, [materialized.value ? (openBlock(), createBlock(CommentDialog_default, {
13510
13523
  key: 0,
@@ -13525,14 +13538,16 @@ var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_de
13525
13538
  ])) : createCommentVNode("", true)], 44, _hoisted_1$25);
13526
13539
  };
13527
13540
  }
13528
- }, [["__scopeId", "data-v-29650a06"]]);
13541
+ }), [["__scopeId", "data-v-db6ccae8"]]);
13529
13542
  //#endregion
13530
- //#region src/components/CommentsLayer/commentsList/commentsList.vue
13543
+ //#region src/components/CommentsLayer/commentsList/commentsList.vue?vue&type=script&setup=true&lang.ts
13531
13544
  var _hoisted_1$24 = ["aria-busy"];
13532
13545
  var _hoisted_2$18 = { key: 0 };
13533
13546
  var _hoisted_3$15 = { key: 1 };
13534
13547
  var REPEATED_HEADER_FOOTER_STORY_TYPE = "headerFooterPart";
13535
- var commentsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13548
+ //#endregion
13549
+ //#region src/components/CommentsLayer/commentsList/commentsList.vue
13550
+ var commentsList_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
13536
13551
  __name: "commentsList",
13537
13552
  props: {
13538
13553
  showMainComments: {
@@ -13546,12 +13561,13 @@ var commentsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13546
13561
  },
13547
13562
  setup(__props) {
13548
13563
  const props = __props;
13549
- const commentsStore = useCommentsStore();
13564
+ const piniaCommentsStore = useCommentsStore();
13565
+ const commentsStore = piniaCommentsStore;
13550
13566
  const listRoot = ref(null);
13551
13567
  const rovingIndex = ref(0);
13552
13568
  const isCommentsListVisible = toRef(commentsStore, "isCommentsListVisible");
13553
13569
  const floatingCommentInstances = computed$1(() => commentsStore.getFloatingCommentInstances);
13554
- const { activeComment, activeFloatingCommentInstanceId, commentsList, reviewDirectoryList, isReviewDirectoryActive, isReviewDirectoryLoading } = storeToRefs(commentsStore);
13570
+ const { activeComment, activeFloatingCommentInstanceId, commentsList, reviewDirectoryList, isReviewDirectoryActive, isReviewDirectoryLoading } = storeToRefs(piniaCommentsStore);
13555
13571
  const groupedComments = computed$1(() => isReviewDirectoryActive.value ? commentsStore.getGroupedReviewDirectory : commentsStore.getGroupedComments);
13556
13572
  const reviewRows = computed$1(() => isReviewDirectoryActive.value ? reviewDirectoryList.value : commentsList.value);
13557
13573
  const commentAliases = (comment) => [
@@ -13582,11 +13598,15 @@ var commentsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13582
13598
  }
13583
13599
  return [parentComment];
13584
13600
  };
13601
+ const getStoryType = (comment) => {
13602
+ const story = comment?.trackedChangeStory;
13603
+ return typeof story === "object" && story !== null ? story.storyType : void 0;
13604
+ };
13585
13605
  const getRepeatedHeaderFooterInstances = (comment) => {
13586
13606
  const matchingInstances = floatingCommentInstances.value.filter((instance) => instance?.comment?.commentId === comment?.commentId);
13587
13607
  if (matchingInstances.length < 2) return [];
13588
13608
  if (!comment?.trackedChange) return [];
13589
- if (comment?.trackedChangeStory?.storyType !== REPEATED_HEADER_FOOTER_STORY_TYPE) return [];
13609
+ if (getStoryType(comment) !== REPEATED_HEADER_FOOTER_STORY_TYPE) return [];
13590
13610
  return matchingInstances;
13591
13611
  };
13592
13612
  const isRepeatedInstanceActive = (instance) => {
@@ -13643,8 +13663,9 @@ var commentsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13643
13663
  rovingIndex.value = nextIndex;
13644
13664
  await nextTick();
13645
13665
  const target = listRoot.value?.querySelector?.(`[data-review-directory-index="${nextIndex}"]`);
13646
- target?.scrollIntoView?.({ block: "nearest" });
13647
- target?.focus?.({ preventScroll: true });
13666
+ if (!(target instanceof HTMLElement)) return;
13667
+ target.scrollIntoView?.({ block: "nearest" });
13668
+ target.focus?.({ preventScroll: true });
13648
13669
  };
13649
13670
  onMounted(() => {
13650
13671
  isCommentsListVisible.value = true;
@@ -13692,7 +13713,7 @@ var commentsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13692
13713
  }), 128))])) : createCommentVNode("", true)], 8, _hoisted_1$24);
13693
13714
  };
13694
13715
  }
13695
- }, [["__scopeId", "data-v-89244745"]]);
13716
+ }), [["__scopeId", "data-v-8eca48e1"]]);
13696
13717
  //#endregion
13697
13718
  //#region src/components/CommentsLayer/commentsList/super-comments-list.js
13698
13719
  /**
@@ -15317,9 +15338,9 @@ var FloatingComments_default = /* @__PURE__ */ _plugin_vue_export_helper_default
15317
15338
  }), 128))], 4)], 36);
15318
15339
  };
15319
15340
  }
15320
- }), [["__scopeId", "data-v-e74251e0"]]);
15341
+ }), [["__scopeId", "data-v-0655e424"]]);
15321
15342
  //#endregion
15322
- //#region src/components/CommentsLayer/PdfCommentsLayer.vue
15343
+ //#region src/components/CommentsLayer/PdfCommentsLayer.vue?vue&type=script&setup=true&lang.ts
15323
15344
  var _hoisted_1$22 = {
15324
15345
  class: "superdoc__pdf-comments-layer pdf-comments-layer",
15325
15346
  "aria-hidden": "false"
@@ -15334,7 +15355,9 @@ var _hoisted_2$17 = [
15334
15355
  var PDF_SELECTION_SOURCE = "pdf";
15335
15356
  var INTERNAL_HIGHLIGHT_COLOR = "#078383";
15336
15357
  var EXTERNAL_HIGHLIGHT_COLOR = "#B1124B";
15337
- var PdfCommentsLayer_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15358
+ //#endregion
15359
+ //#region src/components/CommentsLayer/PdfCommentsLayer.vue
15360
+ var PdfCommentsLayer_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
15338
15361
  __name: "PdfCommentsLayer",
15339
15362
  emits: ["anchor-activate"],
15340
15363
  setup(__props, { emit: __emit }) {
@@ -15353,11 +15376,12 @@ var PdfCommentsLayer_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15353
15376
  * on-document DOCX comment markers.
15354
15377
  */
15355
15378
  const emit = __emit;
15356
- const commentsStore = useCommentsStore();
15379
+ const piniaCommentsStore = useCommentsStore();
15380
+ const commentsStore = piniaCommentsStore;
15357
15381
  const superdocStore = useSuperdocStore();
15358
- const { activeComment } = storeToRefs(commentsStore);
15382
+ const { activeComment } = storeToRefs(piniaCommentsStore);
15359
15383
  const { documents, activeZoom } = storeToRefs(superdocStore);
15360
- const { proxy } = getCurrentInstance();
15384
+ const { proxy } = useSuperDocInstance();
15361
15385
  const isFiniteNumber = (value) => {
15362
15386
  if (typeof value === "number") return Number.isFinite(value);
15363
15387
  if (typeof value === "string" && value.trim() !== "") return Number.isFinite(Number(value));
@@ -15396,15 +15420,20 @@ var PdfCommentsLayer_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15396
15420
  const pdfCommentAnchors = computed$1(() => {
15397
15421
  const parentComments = commentsStore.getFloatingComments;
15398
15422
  if (!Array.isArray(parentComments)) return [];
15399
- return parentComments.filter((comment) => comment?.selection?.source === PDF_SELECTION_SOURCE).filter((comment) => !comment.resolvedTime).filter((comment) => getAnchorCommentId(comment) !== null).filter((comment) => hasFiniteBounds(comment.selection?.selectionBounds)).filter((comment) => belongsToOpenPdfDocument(comment)).map((comment) => {
15423
+ return parentComments.flatMap((comment) => {
15424
+ if (comment?.selection?.source !== PDF_SELECTION_SOURCE) return [];
15425
+ if (comment.resolvedTime) return [];
15400
15426
  const commentId = getAnchorCommentId(comment);
15401
- const bounds = normalizeBounds(comment.selection.selectionBounds);
15402
- return {
15427
+ if (commentId === null) return [];
15428
+ const selectionBounds = comment.selection.selectionBounds;
15429
+ if (!hasFiniteBounds(selectionBounds)) return [];
15430
+ if (!belongsToOpenPdfDocument(comment)) return [];
15431
+ return [{
15403
15432
  commentId,
15404
- page: comment.selection?.page ?? null,
15433
+ page: comment.selection.page ?? null,
15405
15434
  isInternal: comment.isInternal !== false,
15406
- bounds
15407
- };
15435
+ bounds: normalizeBounds(selectionBounds)
15436
+ }];
15408
15437
  });
15409
15438
  });
15410
15439
  const getAnchorStyle = (anchor) => {
@@ -15442,7 +15471,7 @@ var PdfCommentsLayer_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15442
15471
  }), 128))]);
15443
15472
  };
15444
15473
  }
15445
- }, [["__scopeId", "data-v-b5ad4c58"]]);
15474
+ }), [["__scopeId", "data-v-86166837"]]);
15446
15475
  //#endregion
15447
15476
  //#region src/components/Whiteboard/use-whiteboard.js
15448
15477
  var useWhiteboard = ({ proxy, layers, documents, modules }) => {
@@ -16821,7 +16850,7 @@ function usePasswordPrompt({ getSurfaceManager, getPasswordPromptConfig, onUnhan
16821
16850
  })
16822
16851
  });
16823
16852
  } else {
16824
- const PasswordPromptSurface = (await import("./chunks/PasswordPromptSurface-DGjmN7A-.es.js")).default;
16853
+ const PasswordPromptSurface = (await import("./chunks/PasswordPromptSurface-6mF6Azda.es.js")).default;
16825
16854
  const surfaceId = `password-prompt-${doc.id}`;
16826
16855
  handle = manager.open({
16827
16856
  id: surfaceId,
@@ -17516,7 +17545,7 @@ function useFindReplace({ getSurfaceManager, getActiveEditor, activeEditorRef, g
17516
17545
  } else {
17517
17546
  let FindReplaceSurface;
17518
17547
  try {
17519
- FindReplaceSurface = (await import("./chunks/FindReplaceSurface-Dm043CZP.es.js")).default;
17548
+ FindReplaceSurface = (await import("./chunks/FindReplaceSurface-BKVHzhQ4.es.js")).default;
17520
17549
  } catch {
17521
17550
  opening = false;
17522
17551
  return;
@@ -19566,6 +19595,9 @@ function createV2EditorRuntimeAdapter(options) {
19566
19595
  setDocumentMode(mode) {
19567
19596
  host.setDocumentMode(mode);
19568
19597
  },
19598
+ async setUser(user) {
19599
+ await host.setUser?.(user);
19600
+ },
19569
19601
  getDocumentMode: () => host.getDocumentMode(),
19570
19602
  setTrackedChangesRenderOptions(options) {
19571
19603
  host.setTrackedChangesRenderOptions(options);
@@ -20405,11 +20437,13 @@ var SurfaceDialog_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
20405
20437
  }
20406
20438
  }), [["__scopeId", "data-v-6ce23dd7"]]);
20407
20439
  //#endregion
20408
- //#region src/components/surfaces/SurfaceFloating.vue
20440
+ //#region src/components/surfaces/SurfaceFloating.vue?vue&type=script&setup=true&lang.ts
20409
20441
  var _hoisted_1$18 = ["aria-labelledby", "aria-label"];
20410
20442
  var _hoisted_2$14 = ["id"];
20411
20443
  var _hoisted_3$12 = { class: "sd-surface-floating__content" };
20412
- var SurfaceFloating_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20444
+ //#endregion
20445
+ //#region src/components/surfaces/SurfaceFloating.vue
20446
+ var SurfaceFloating_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
20413
20447
  __name: "SurfaceFloating",
20414
20448
  props: { surface: {
20415
20449
  type: Object,
@@ -20557,8 +20591,10 @@ var SurfaceFloating_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20557
20591
  ])) : __props.surface.component ? (openBlock(), createBlock(resolveDynamicComponent(__props.surface.component), normalizeProps(mergeProps({ key: 1 }, mergedComponentProps.value)), null, 16)) : createCommentVNode("", true)])], 14, _hoisted_1$18);
20558
20592
  };
20559
20593
  }
20560
- }, [["__scopeId", "data-v-cd2be5db"]]);
20561
- var SurfaceHost_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20594
+ }), [["__scopeId", "data-v-d26a1197"]]);
20595
+ //#endregion
20596
+ //#region src/components/surfaces/SurfaceHost.vue
20597
+ var SurfaceHost_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
20562
20598
  __name: "SurfaceHost",
20563
20599
  props: { geometryTarget: {
20564
20600
  type: Object,
@@ -20708,7 +20744,7 @@ var SurfaceHost_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20708
20744
  if (dialog.value) return;
20709
20745
  if (event.key === "Escape" && f.request.closeOnEscape !== false) {
20710
20746
  event.stopPropagation();
20711
- surfaceManager.close(f.id);
20747
+ surfaceManager?.close(f.id);
20712
20748
  }
20713
20749
  }
20714
20750
  let escapeListenerAttached = false;
@@ -20727,7 +20763,8 @@ var SurfaceHost_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20727
20763
  if (!f || f.settled) return;
20728
20764
  if (dialog.value) return;
20729
20765
  const rootEl = floatingRef.value?.rootEl;
20730
- if (rootEl && !rootEl.contains(event.target)) surfaceManager.close(f.id);
20766
+ const target = event.target instanceof Node ? event.target : null;
20767
+ if (rootEl && !rootEl.contains(target)) surfaceManager?.close(f.id);
20731
20768
  }
20732
20769
  let pointerListenerAttached = false;
20733
20770
  function attachPointerListener() {
@@ -20757,7 +20794,7 @@ var SurfaceHost_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20757
20794
  });
20758
20795
  function handleDialogClose() {
20759
20796
  const d = dialog.value;
20760
- if (d && !d.settled) surfaceManager.close(d.id);
20797
+ if (d && !d.settled) surfaceManager?.close(d.id);
20761
20798
  }
20762
20799
  return (_ctx, _cache) => {
20763
20800
  return openBlock(), createBlock(Teleport, { to: "body" }, [hasAnySurface.value ? (openBlock(), createElementBlock("div", {
@@ -20779,7 +20816,7 @@ var SurfaceHost_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20779
20816
  }, null, 8, ["surface", "scroll-lock-target"])) : createCommentVNode("", true)]);
20780
20817
  };
20781
20818
  }
20782
- }, [["__scopeId", "data-v-dad99b67"]]);
20819
+ }), [["__scopeId", "data-v-ae02e94c"]]);
20783
20820
  //#endregion
20784
20821
  //#region src/SuperDoc.vue?vue&type=script&setup=true&lang.ts
20785
20822
  var _hoisted_1$17 = ["data-superdoc-ui-owner"];
@@ -23412,7 +23449,7 @@ var SuperDoc_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__P
23412
23449
  ], 46, _hoisted_1$17);
23413
23450
  };
23414
23451
  }
23415
- }), [["__scopeId", "data-v-da95e5c5"]]);
23452
+ }), [["__scopeId", "data-v-0c6f8747"]]);
23416
23453
  //#endregion
23417
23454
  //#region src/core/create-app.js
23418
23455
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
@@ -27154,13 +27191,15 @@ var ToolbarButton_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
27154
27191
  }
27155
27192
  }), [["__scopeId", "data-v-40889353"]]);
27156
27193
  //#endregion
27157
- //#region src/internal/toolbar/built-in/ToolbarSeparator.vue
27194
+ //#region src/internal/toolbar/built-in/ToolbarSeparator.vue?vue&type=script&setup=true&lang.ts
27158
27195
  var _hoisted_1$14 = {
27159
27196
  class: "toolbar-separator",
27160
27197
  role: "separator",
27161
27198
  "aria-label": "Toolbar separator"
27162
27199
  };
27163
- var ToolbarSeparator_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27200
+ //#endregion
27201
+ //#region src/internal/toolbar/built-in/ToolbarSeparator.vue
27202
+ var ToolbarSeparator_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
27164
27203
  __name: "ToolbarSeparator",
27165
27204
  props: { active: {
27166
27205
  type: Boolean,
@@ -27180,7 +27219,7 @@ var ToolbarSeparator_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27180
27219
  }, null, 4)]);
27181
27220
  };
27182
27221
  }
27183
- }, [["__scopeId", "data-v-cb82253a"]]);
27222
+ }), [["__scopeId", "data-v-10932d46"]]);
27184
27223
  //#endregion
27185
27224
  //#region src/internal/toolbar/built-in/ToolbarDropdown.vue?vue&type=script&setup=true&lang.ts
27186
27225
  var _hoisted_1$13 = { class: "toolbar-dropdown" };
@@ -27583,7 +27622,7 @@ var ToolbarDropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
27583
27622
  })], 8, ["to"]))]);
27584
27623
  };
27585
27624
  }
27586
- }), [["__scopeId", "data-v-50758732"]]);
27625
+ }), [["__scopeId", "data-v-942d76a6"]]);
27587
27626
  //#endregion
27588
27627
  //#region src/internal/toolbar/built-in/toolbar-focus-helpers.js
27589
27628
  var preventEditorFocusTransfer = (event) => {
@@ -27605,7 +27644,9 @@ var refocusEditorSurface = (superToolbar, preferredEditor = null) => {
27605
27644
  const editor = document.querySelector("[role=\"textbox\"][aria-label*=\"SuperDoc body\"], .ProseMirror");
27606
27645
  if (editor instanceof HTMLElement) editor.focus({ preventScroll: true });
27607
27646
  };
27608
- var OverflowMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27647
+ //#endregion
27648
+ //#region src/internal/toolbar/built-in/OverflowMenu.vue
27649
+ var OverflowMenu_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
27609
27650
  __name: "OverflowMenu",
27610
27651
  props: {
27611
27652
  toolbarItem: {
@@ -27701,7 +27742,7 @@ var OverflowMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27701
27742
  ]);
27702
27743
  };
27703
27744
  }
27704
- }, [["__scopeId", "data-v-1227fcf9"]]);
27745
+ }), [["__scopeId", "data-v-d2e189fd"]]);
27705
27746
  //#endregion
27706
27747
  //#region src/internal/toolbar/built-in/font-typeahead.js
27707
27748
  /**
@@ -28327,10 +28368,10 @@ var ToolbarComboBox_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
28327
28368
  ], 14, _hoisted_1$12);
28328
28369
  };
28329
28370
  }
28330
- }), [["__scopeId", "data-v-e9143b7e"]]);
28371
+ }), [["__scopeId", "data-v-a400064a"]]);
28331
28372
  //#endregion
28332
28373
  //#region src/internal/toolbar/built-in/FontFamilyCombobox.vue
28333
- var _sfc_main$11 = {
28374
+ var FontFamilyCombobox_default = /* @__PURE__ */ defineComponent({
28334
28375
  __name: "FontFamilyCombobox",
28335
28376
  props: {
28336
28377
  item: {
@@ -28368,10 +28409,10 @@ var _sfc_main$11 = {
28368
28409
  ]);
28369
28410
  };
28370
28411
  }
28371
- };
28412
+ });
28372
28413
  //#endregion
28373
28414
  //#region src/internal/toolbar/built-in/FontSizeCombobox.vue
28374
- var _sfc_main$10 = {
28415
+ var FontSizeCombobox_default = /* @__PURE__ */ defineComponent({
28375
28416
  __name: "FontSizeCombobox",
28376
28417
  props: {
28377
28418
  item: {
@@ -28409,7 +28450,7 @@ var _sfc_main$10 = {
28409
28450
  ]);
28410
28451
  };
28411
28452
  }
28412
- };
28453
+ });
28413
28454
  //#endregion
28414
28455
  //#region src/internal/toolbar/built-in/SdTooltip.vue?vue&type=script&setup=true&lang.ts
28415
28456
  var AUTO_HIDE_DELAY = 2500;
@@ -28632,7 +28673,7 @@ var SdTooltip_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__
28632
28673
  }
28633
28674
  }), [["__scopeId", "data-v-dfd6f1d1"]]);
28634
28675
  //#endregion
28635
- //#region src/internal/toolbar/built-in/ButtonGroup.vue
28676
+ //#region src/internal/toolbar/built-in/ButtonGroup.vue?vue&type=script&setup=true&lang.ts
28636
28677
  var _hoisted_1$11 = [
28637
28678
  "onKeydown",
28638
28679
  "tabindex",
@@ -28643,7 +28684,9 @@ var _hoisted_3$7 = { key: 0 };
28643
28684
  var _hoisted_4$5 = { key: 0 };
28644
28685
  var _hoisted_5$3 = { key: 0 };
28645
28686
  var _hoisted_6$2 = { key: 0 };
28646
- var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
28687
+ //#endregion
28688
+ //#region src/internal/toolbar/built-in/ButtonGroup.vue
28689
+ var ButtonGroup_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
28647
28690
  __name: "ButtonGroup",
28648
28691
  props: {
28649
28692
  toolbarItems: {
@@ -28684,7 +28727,7 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
28684
28727
  ],
28685
28728
  setup(__props, { emit: __emit }) {
28686
28729
  const emit = __emit;
28687
- const { proxy } = getCurrentInstance();
28730
+ const proxy = getCurrentInstance()?.proxy;
28688
28731
  const toolbarItemRefs = ref([]);
28689
28732
  const buttonGroupRef = ref(null);
28690
28733
  const props = __props;
@@ -28867,37 +28910,35 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
28867
28910
  "aria-label": `${item.attributes.value.ariaLabel} - ${option.label}`
28868
28911
  };
28869
28912
  };
28870
- const moveToNextButton = (e) => {
28871
- const currentButton = e.target;
28872
- const nextButton = e.target.closest(".sd-toolbar-item-ctn").nextElementSibling;
28873
- if (nextButton) {
28874
- currentButton.setAttribute("tabindex", "-1");
28913
+ const moveToNextButton = (target) => {
28914
+ const nextButton = target.closest(".sd-toolbar-item-ctn")?.nextElementSibling;
28915
+ if (nextButton instanceof HTMLElement) {
28916
+ target.setAttribute("tabindex", "-1");
28875
28917
  nextButton.setAttribute("tabindex", "0");
28876
28918
  nextButton.focus();
28877
28919
  }
28878
28920
  };
28879
- const moveToPreviousButton = (e) => {
28880
- const currentButton = e.target;
28881
- const previousButton = e.target.closest(".sd-toolbar-item-ctn").previousElementSibling;
28882
- if (previousButton) {
28883
- currentButton.setAttribute("tabindex", "-1");
28921
+ const moveToPreviousButton = (target) => {
28922
+ const previousButton = target.closest(".sd-toolbar-item-ctn")?.previousElementSibling;
28923
+ if (previousButton instanceof HTMLElement) {
28924
+ target.setAttribute("tabindex", "-1");
28884
28925
  previousButton.setAttribute("tabindex", "0");
28885
28926
  previousButton.focus();
28886
28927
  }
28887
28928
  };
28888
- const moveToNextButtonGroup = (e) => {
28889
- const nextButtonGroup = e.target.closest(".button-group").nextElementSibling;
28890
- if (nextButtonGroup) {
28929
+ const moveToNextButtonGroup = (target) => {
28930
+ const nextButtonGroup = target.closest(".button-group")?.nextElementSibling;
28931
+ if (nextButtonGroup instanceof HTMLElement) {
28891
28932
  nextButtonGroup.setAttribute("tabindex", "0");
28892
28933
  nextButtonGroup.focus();
28893
28934
  } else {
28894
28935
  const editor = document.querySelector(".ProseMirror");
28895
- if (editor) editor.focus();
28936
+ if (editor instanceof HTMLElement) editor.focus();
28896
28937
  }
28897
28938
  };
28898
- const moveToPreviousButtonGroup = (e) => {
28899
- const previousButtonGroup = e.target.closest(".button-group").previousElementSibling;
28900
- if (previousButtonGroup) {
28939
+ const moveToPreviousButtonGroup = (target) => {
28940
+ const previousButtonGroup = target.closest(".button-group")?.previousElementSibling;
28941
+ if (previousButtonGroup instanceof HTMLElement) {
28901
28942
  previousButtonGroup.setAttribute("tabindex", "0");
28902
28943
  previousButtonGroup.focus();
28903
28944
  }
@@ -28911,7 +28952,9 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
28911
28952
  handleToolbarButtonClick(item);
28912
28953
  };
28913
28954
  const handleKeyDown = (e, item) => {
28914
- const isTypingField = e.target.nodeName === "INPUT" || e.target.nodeName === "TEXTAREA";
28955
+ const target = e.target;
28956
+ if (!(target instanceof Element)) return;
28957
+ const isTypingField = target.nodeName === "INPUT" || target.nodeName === "TEXTAREA";
28915
28958
  const isTypingToolbarItem = item.name.value === "fontSize" || item.name.value === "fontFamily";
28916
28959
  if (isTypingField && isTypingToolbarItem) return;
28917
28960
  if (![
@@ -28935,20 +28978,20 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
28935
28978
  break;
28936
28979
  case "ArrowRight":
28937
28980
  closeDropdowns();
28938
- moveToNextButton(e);
28981
+ moveToNextButton(target);
28939
28982
  break;
28940
28983
  case "ArrowLeft":
28941
28984
  closeDropdowns();
28942
- moveToPreviousButton(e);
28985
+ moveToPreviousButton(target);
28943
28986
  break;
28944
28987
  case "Tab":
28945
- if (e.shiftKey) moveToPreviousButtonGroup(e);
28946
- else moveToNextButtonGroup(e);
28988
+ if (e.shiftKey) moveToPreviousButtonGroup(target);
28989
+ else moveToNextButtonGroup(target);
28947
28990
  break;
28948
28991
  default: break;
28949
28992
  }
28950
28993
  };
28951
- const handleFocus = (e) => {
28994
+ const handleFocus = () => {
28952
28995
  const firstButton = toolbarItemRefs.value.find((item) => !item.classList.contains("sd-disabled"));
28953
28996
  if (firstButton) {
28954
28997
  firstButton.setAttribute("tabindex", "0");
@@ -29018,7 +29061,7 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29018
29061
  disabled: !item.tooltip?.value,
29019
29062
  "content-style": { fontFamily: props.uiFontFamily }
29020
29063
  }, {
29021
- trigger: withCtx(() => [createVNode(_sfc_main$11, {
29064
+ trigger: withCtx(() => [createVNode(FontFamilyCombobox_default, {
29022
29065
  item,
29023
29066
  "ui-font-family": props.uiFontFamily,
29024
29067
  class: "sd-toolbar-button sd-editor-toolbar-dropdown",
@@ -29035,7 +29078,7 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29035
29078
  disabled: !item.tooltip?.value,
29036
29079
  "content-style": { fontFamily: props.uiFontFamily }
29037
29080
  }, {
29038
- trigger: withCtx(() => [createVNode(_sfc_main$10, {
29081
+ trigger: withCtx(() => [createVNode(FontSizeCombobox_default, {
29039
29082
  item,
29040
29083
  "ui-font-family": props.uiFontFamily,
29041
29084
  class: "sd-toolbar-button sd-editor-toolbar-dropdown",
@@ -29133,7 +29176,7 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29133
29176
  }), 128))], 36);
29134
29177
  };
29135
29178
  }
29136
- }, [["__scopeId", "data-v-fb216897"]]);
29179
+ }), [["__scopeId", "data-v-21333fed"]]);
29137
29180
  var TOOLBAR_FONTS = [
29138
29181
  ["Arial", "sans-serif"],
29139
29182
  ["Arial Black", "sans-serif"],
@@ -29653,14 +29696,16 @@ var useToolbarItem = (options) => {
29653
29696
  };
29654
29697
  };
29655
29698
  //#endregion
29656
- //#region src/internal/toolbar/built-in/AlignmentButtons.vue
29699
+ //#region src/internal/toolbar/built-in/AlignmentButtons.vue?vue&type=script&setup=true&lang.ts
29657
29700
  var _hoisted_1$9 = [
29658
29701
  "onClick",
29659
29702
  "innerHTML",
29660
29703
  "aria-label",
29661
29704
  "onKeydown"
29662
29705
  ];
29663
- var AlignmentButtons_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29706
+ //#endregion
29707
+ //#region src/internal/toolbar/built-in/AlignmentButtons.vue
29708
+ var AlignmentButtons_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
29664
29709
  __name: "AlignmentButtons",
29665
29710
  emits: ["select"],
29666
29711
  setup(__props, { emit: __emit }) {
@@ -29747,16 +29792,18 @@ var AlignmentButtons_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29747
29792
  }), 64))], 2);
29748
29793
  };
29749
29794
  }
29750
- }, [["__scopeId", "data-v-13e5f7a4"]]);
29795
+ }), [["__scopeId", "data-v-7ddf6e50"]]);
29751
29796
  //#endregion
29752
- //#region src/internal/toolbar/built-in/StyleButtonsList.vue
29797
+ //#region src/internal/toolbar/built-in/StyleButtonsList.vue?vue&type=script&setup=true&lang.ts
29753
29798
  var _hoisted_1$8 = [
29754
29799
  "onClick",
29755
29800
  "innerHTML",
29756
29801
  "aria-label",
29757
29802
  "onKeydown"
29758
29803
  ];
29759
- var StyleButtonsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29804
+ //#endregion
29805
+ //#region src/internal/toolbar/built-in/StyleButtonsList.vue
29806
+ var StyleButtonsList_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
29760
29807
  __name: "StyleButtonsList",
29761
29808
  props: {
29762
29809
  buttons: {
@@ -29840,7 +29887,7 @@ var StyleButtonsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29840
29887
  }), 128))], 2);
29841
29888
  };
29842
29889
  }
29843
- }, [["__scopeId", "data-v-44f37ff6"]]);
29890
+ }), [["__scopeId", "data-v-539d0995"]]);
29844
29891
  //#endregion
29845
29892
  //#region src/internal/toolbar/built-in/list-style-buttons.js
29846
29893
  var bulletStyleButtons = [
@@ -29903,14 +29950,16 @@ var numberedStyleButtons = [
29903
29950
  }
29904
29951
  ];
29905
29952
  //#endregion
29906
- //#region src/internal/toolbar/built-in/DocumentMode.vue
29953
+ //#region src/internal/toolbar/built-in/DocumentMode.vue?vue&type=script&setup=true&lang.ts
29907
29954
  var _hoisted_1$7 = ["onClick", "onKeydown"];
29908
29955
  var _hoisted_2$7 = { class: "document-mode-column icon-column" };
29909
29956
  var _hoisted_3$6 = ["innerHTML"];
29910
29957
  var _hoisted_4$4 = { class: "document-mode-column text-column" };
29911
29958
  var _hoisted_5$2 = { class: "document-mode-type" };
29912
29959
  var _hoisted_6$1 = { class: "document-mode-description" };
29913
- var DocumentMode_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29960
+ //#endregion
29961
+ //#region src/internal/toolbar/built-in/DocumentMode.vue
29962
+ var DocumentMode_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
29914
29963
  __name: "DocumentMode",
29915
29964
  props: { options: { type: Array } },
29916
29965
  emits: ["select"],
@@ -29946,9 +29995,11 @@ var DocumentMode_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29946
29995
  case "ArrowUp":
29947
29996
  moveToPreviousOption(index);
29948
29997
  break;
29949
- case "Enter":
29950
- handleClick(props.options[index]);
29998
+ case "Enter": {
29999
+ const option = props.options?.[index];
30000
+ if (option) handleClick(option);
29951
30001
  break;
30002
+ }
29952
30003
  default: break;
29953
30004
  }
29954
30005
  };
@@ -29974,7 +30025,7 @@ var DocumentMode_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29974
30025
  }), 256))], 2);
29975
30026
  };
29976
30027
  }
29977
- }, [["__scopeId", "data-v-bee14d7a"]]);
30028
+ }), [["__scopeId", "data-v-a20b9574"]]);
29978
30029
  //#endregion
29979
30030
  //#region src/internal/toolbar/built-in/LinkedStyle.vue?vue&type=script&setup=true&lang.ts
29980
30031
  var _hoisted_1$6 = {
@@ -30097,7 +30148,7 @@ var LinkedStyle_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @
30097
30148
  }
30098
30149
  }), [["__scopeId", "data-v-4e36f956"]]);
30099
30150
  //#endregion
30100
- //#region src/internal/toolbar/built-in/AIWriter.vue
30151
+ //#region src/internal/toolbar/built-in/AIWriter.vue?vue&type=script&setup=true&lang.ts
30101
30152
  var _hoisted_1$5 = ["placeholder"];
30102
30153
  var _hoisted_2$5 = { class: "sd-ai-writer__footer" };
30103
30154
  var _hoisted_3$4 = {
@@ -30108,7 +30159,9 @@ var _hoisted_3$4 = {
30108
30159
  var _hoisted_4$2 = ["disabled"];
30109
30160
  var DEFAULT_AI_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
30110
30161
  var SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. Only write what is asked for.";
30111
- var AIWriter_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30162
+ //#endregion
30163
+ //#region src/internal/toolbar/built-in/AIWriter.vue
30164
+ var AIWriter_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30112
30165
  __name: "AIWriter",
30113
30166
  props: {
30114
30167
  selectedText: {
@@ -30155,13 +30208,13 @@ var AIWriter_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30155
30208
  });
30156
30209
  function extractGeneratedText(payload) {
30157
30210
  if (typeof payload === "string") return payload;
30158
- if (!payload || typeof payload !== "object") return "";
30211
+ if (!isPlainObject$1(payload)) return "";
30159
30212
  const customPrompt = payload.custom_prompt;
30160
30213
  if (Array.isArray(customPrompt)) {
30161
30214
  const first = customPrompt[0];
30162
- if (first && typeof first.value === "string") return first.value;
30215
+ if (isPlainObject$1(first) && typeof first.value === "string") return first.value;
30163
30216
  }
30164
- if (customPrompt && typeof customPrompt === "object" && typeof customPrompt.value === "string") return customPrompt.value;
30217
+ if (isPlainObject$1(customPrompt) && typeof customPrompt.value === "string") return customPrompt.value;
30165
30218
  if (typeof payload.value === "string") return payload.value;
30166
30219
  if (typeof payload.text === "string") return payload.text;
30167
30220
  return "";
@@ -30195,7 +30248,7 @@ var AIWriter_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30195
30248
  }
30196
30249
  function receiptSucceeded(receipt) {
30197
30250
  if (!receipt || typeof receipt !== "object") return true;
30198
- if (receipt.success === false || receipt.ok === false) return false;
30251
+ if ("success" in receipt && receipt.success === false || "ok" in receipt && receipt.ok === false) return false;
30199
30252
  return true;
30200
30253
  }
30201
30254
  function insertGeneratedText(text) {
@@ -30265,9 +30318,9 @@ var AIWriter_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30265
30318
  }, toDisplayString(isLoading.value ? "Generating" : "Generate"), 9, _hoisted_4$2)])], 32);
30266
30319
  };
30267
30320
  }
30268
- }, [["__scopeId", "data-v-67f6c6f7"]]);
30321
+ }), [["__scopeId", "data-v-3951e804"]]);
30269
30322
  //#endregion
30270
- //#region src/internal/toolbar/built-in/IconGridRow.vue
30323
+ //#region src/internal/toolbar/built-in/IconGridRow.vue?vue&type=script&setup=true&lang.ts
30271
30324
  var _hoisted_1$4 = [
30272
30325
  "aria-label",
30273
30326
  "onClick",
@@ -30276,7 +30329,9 @@ var _hoisted_1$4 = [
30276
30329
  var _hoisted_2$4 = ["innerHTML"];
30277
30330
  var _hoisted_3$3 = ["innerHTML"];
30278
30331
  var ROW_SIZE$1 = 7;
30279
- var IconGridRow_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30332
+ //#endregion
30333
+ //#region src/internal/toolbar/built-in/IconGridRow.vue
30334
+ var IconGridRow_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30280
30335
  __name: "IconGridRow",
30281
30336
  props: {
30282
30337
  icons: {
@@ -30293,8 +30348,9 @@ var IconGridRow_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30293
30348
  const emit = __emit;
30294
30349
  const props = __props;
30295
30350
  const isActive = computed$1(() => (option) => {
30296
- if (!props.activeColor.value) return false;
30297
- return props.activeColor.value.toUpperCase() === option.value;
30351
+ const activeColor = props.activeColor?.value;
30352
+ if (!activeColor) return false;
30353
+ return activeColor.toUpperCase() === option.value;
30298
30354
  });
30299
30355
  const getCheckStyle = (color, optionIndex) => {
30300
30356
  if (optionIndex === 5 || ["#FFFFFF", "#FAFF09"].includes(color)) return { color: "#000" };
@@ -30402,16 +30458,18 @@ var IconGridRow_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30402
30458
  }), 128);
30403
30459
  };
30404
30460
  }
30405
- }, [["__scopeId", "data-v-05eb02fc"]]);
30461
+ }), [["__scopeId", "data-v-b1771c36"]]);
30406
30462
  //#endregion
30407
30463
  //#region ../../shared/common/icons/droplet-slash.svg?raw
30408
30464
  var droplet_slash_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 640 512\"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d=\"M320 512c53.2 0 101.4-21.6 136.1-56.6l-298.3-235C140 257.1 128 292.3 128 320c0 106 86 192 192 192zM505.2 370.7c4.4-16.2 6.8-33.1 6.8-50.7c0-91.2-130.2-262.3-166.6-308.3C339.4 4.2 330.5 0 320.9 0l-1.8 0c-9.6 0-18.5 4.2-24.5 11.7C277.8 33 240.7 81.3 205.8 136L38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L505.2 370.7zM224 336c0 44.2 35.8 80 80 80c8.8 0 16 7.2 16 16s-7.2 16-16 16c-61.9 0-112-50.1-112-112c0-8.8 7.2-16 16-16s16 7.2 16 16z\"/></svg>\n";
30409
30465
  //#endregion
30410
- //#region src/internal/toolbar/built-in/IconGrid.vue
30466
+ //#region src/internal/toolbar/built-in/IconGrid.vue?vue&type=script&setup=true&lang.ts
30411
30467
  var _hoisted_1$3 = { class: "options-grid-wrap" };
30412
30468
  var _hoisted_2$3 = ["innerHTML"];
30413
30469
  var _hoisted_3$2 = { class: "option-grid-ctn" };
30414
- var IconGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30470
+ //#endregion
30471
+ //#region src/internal/toolbar/built-in/IconGrid.vue
30472
+ var IconGrid_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30415
30473
  __name: "IconGrid",
30416
30474
  props: {
30417
30475
  icons: {
@@ -30451,14 +30509,14 @@ var IconGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30451
30509
  icons: __props.icons,
30452
30510
  "active-color": __props.activeColor,
30453
30511
  onSelect: handleSelect
30454
- }, null, 8, ["icons", "active-color"]), __props.customIcons.flat().length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[2] || (_cache[2] = createElementVNode("span", { class: "option-grid-ctn__subtitle" }, "Custom colors", -1)), createVNode(IconGridRow_default, {
30512
+ }, null, 8, ["icons", "active-color"]), __props.customIcons?.flat().length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[2] || (_cache[2] = createElementVNode("span", { class: "option-grid-ctn__subtitle" }, "Custom colors", -1)), createVNode(IconGridRow_default, {
30455
30513
  icons: __props.customIcons,
30456
30514
  "active-color": __props.activeColor,
30457
30515
  onSelect: handleSelect
30458
30516
  }, null, 8, ["icons", "active-color"])], 64)) : createCommentVNode("", true)])]);
30459
30517
  };
30460
30518
  }
30461
- }, [["__scopeId", "data-v-52b0283a"]]);
30519
+ }), [["__scopeId", "data-v-03719472"]]);
30462
30520
  //#endregion
30463
30521
  //#region src/internal/toolbar/built-in/color-dropdown-helpers.js
30464
30522
  var closeDropdown$1 = (dropdown) => {
@@ -30569,7 +30627,7 @@ var icons = [
30569
30627
  ]
30570
30628
  ];
30571
30629
  //#endregion
30572
- //#region src/internal/toolbar/built-in/TableGrid.vue
30630
+ //#region src/internal/toolbar/built-in/TableGrid.vue?vue&type=script&setup=true&lang.ts
30573
30631
  var _hoisted_1$2 = [
30574
30632
  "data-cols",
30575
30633
  "data-rows",
@@ -30578,7 +30636,9 @@ var _hoisted_1$2 = [
30578
30636
  ];
30579
30637
  var _hoisted_2$2 = ["aria-valuetext"];
30580
30638
  var ROW_SIZE = 5;
30581
- var TableGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30639
+ //#endregion
30640
+ //#region src/internal/toolbar/built-in/TableGrid.vue
30641
+ var TableGrid_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30582
30642
  __name: "TableGrid",
30583
30643
  emits: ["select", "clickoutside"],
30584
30644
  setup(__props, { emit: __emit }) {
@@ -30589,10 +30649,13 @@ var TableGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30589
30649
  const tableGridItems = ref([]);
30590
30650
  const onTableGridMouseOver = (event) => {
30591
30651
  let target = event.target;
30652
+ if (!(target instanceof HTMLElement)) return;
30592
30653
  if (!!target.dataset.grid) return;
30593
- let allItems = [...target.parentElement.querySelectorAll("[data-item]")];
30594
- let cols = parseInt(target.dataset.cols, 10);
30595
- let rows = parseInt(target.dataset.rows, 10);
30654
+ let grid = target.parentElement;
30655
+ if (!grid) return;
30656
+ let allItems = Array.from(grid.querySelectorAll("[data-item]"));
30657
+ let cols = parseInt(target.dataset.cols ?? "", 10);
30658
+ let rows = parseInt(target.dataset.rows ?? "", 10);
30596
30659
  selectGridItems(allItems, cols, rows);
30597
30660
  };
30598
30661
  const selectGridItems = (allItems, cols, rows) => {
@@ -30600,8 +30663,8 @@ var TableGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30600
30663
  selectedRows.value = rows;
30601
30664
  for (let i = 0; i < allItems.length; i++) {
30602
30665
  let item = allItems[i];
30603
- let itemsCols = parseInt(item.dataset.cols, 10);
30604
- let itemsRows = parseInt(item.dataset.rows, 10);
30666
+ let itemsCols = parseInt(item.dataset.cols ?? "", 10);
30667
+ let itemsRows = parseInt(item.dataset.rows ?? "", 10);
30605
30668
  if (itemsCols <= cols && itemsRows <= rows) item.classList.add("sd-selected");
30606
30669
  else item.classList.remove("sd-selected");
30607
30670
  }
@@ -30691,9 +30754,9 @@ var TableGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30691
30754
  }, toDisplayString(selectedRows.value) + " x " + toDisplayString(selectedCols.value), 9, _hoisted_2$2)], 2);
30692
30755
  };
30693
30756
  }
30694
- }, [["__scopeId", "data-v-b87d6ca2"]]);
30757
+ }), [["__scopeId", "data-v-38daa3ad"]]);
30695
30758
  //#endregion
30696
- //#region src/internal/toolbar/built-in/TableActions.vue
30759
+ //#region src/internal/toolbar/built-in/TableActions.vue?vue&type=script&setup=true&lang.ts
30697
30760
  var _hoisted_1$1 = { class: "toolbar-table-actions" };
30698
30761
  var _hoisted_2$1 = [
30699
30762
  "aria-disabled",
@@ -30704,7 +30767,9 @@ var _hoisted_2$1 = [
30704
30767
  var _hoisted_3$1 = { class: "toolbar-table-actions__icon" };
30705
30768
  var _hoisted_4$1 = ["innerHTML"];
30706
30769
  var _hoisted_5$1 = { class: "toolbar-table-actions__label" };
30707
- var TableActions_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30770
+ //#endregion
30771
+ //#region src/internal/toolbar/built-in/TableActions.vue
30772
+ var TableActions_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30708
30773
  __name: "TableActions",
30709
30774
  props: { options: { type: Array } },
30710
30775
  emits: ["select"],
@@ -30733,7 +30798,7 @@ var TableActions_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30733
30798
  }), 256))]);
30734
30799
  };
30735
30800
  }
30736
- }, [["__scopeId", "data-v-72123aae"]]);
30801
+ }), [["__scopeId", "data-v-76ed2dc1"]]);
30737
30802
  //#endregion
30738
30803
  //#region src/internal/toolbar/built-in/PageNumberMenu.vue?vue&type=script&setup=true&lang.ts
30739
30804
  var _hoisted_1 = ["aria-busy"];
@@ -33722,6 +33787,15 @@ function getActiveFontRuntime(editor) {
33722
33787
  *
33723
33788
  * @class
33724
33789
  */
33790
+ function runtimeUserOf(user) {
33791
+ const text = (value) => typeof value === "string" && value ? value : void 0;
33792
+ return {
33793
+ name: text(user.name) ?? "",
33794
+ ...text(user.id) ? { id: text(user.id) } : {},
33795
+ ...text(user.email) ? { email: text(user.email) } : {},
33796
+ ...text(user.initials) ? { initials: text(user.initials) } : {}
33797
+ };
33798
+ }
33725
33799
  var SuperDoc = class extends import_eventemitter3.default {
33726
33800
  static {
33727
33801
  this.allowedTypes = [DOCX, PDF];
@@ -33952,6 +34026,7 @@ var SuperDoc = class extends import_eventemitter3.default {
33952
34026
  viewOptions: { layout: "print" },
33953
34027
  useLayoutEngine: true
33954
34028
  };
34029
+ this.#userSwitch = Promise.resolve();
33955
34030
  this.#fontsRelayEditors = /* @__PURE__ */ new WeakSet();
33956
34031
  this.#warnedMissingFonts = /* @__PURE__ */ new WeakMap();
33957
34032
  this.#lastFontsChangedPayload = null;
@@ -34048,7 +34123,7 @@ var SuperDoc = class extends import_eventemitter3.default {
34048
34123
  }
34049
34124
  this.userColorMap = /* @__PURE__ */ new Map();
34050
34125
  this.colorIndex = 0;
34051
- this.version = "2.29.0-next.1";
34126
+ this.version = "2.29.0-next.3";
34052
34127
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
34053
34128
  this.superdocId = config.superdocId || v4();
34054
34129
  this.colors = this.config.colors ?? [];
@@ -34903,6 +34978,46 @@ var SuperDoc = class extends import_eventemitter3.default {
34903
34978
  if (!editor) throw new Error("SuperDoc: source editor not yet created — wait for the ready event before upgrading");
34904
34979
  return editor;
34905
34980
  }
34981
+ setUser(user) {
34982
+ this.#requireReady("setUser");
34983
+ const name = typeof user?.name === "string" ? user.name.trim() : "";
34984
+ if (!name) return Promise.reject(/* @__PURE__ */ new TypeError("SuperDoc.setUser requires a non-empty user name."));
34985
+ const next = normalizeSuperDocUser({
34986
+ ...user,
34987
+ name
34988
+ });
34989
+ const applied = this.#userSwitch.then(() => this.#applyUser(next));
34990
+ this.#userSwitch = applied.catch(() => {});
34991
+ return applied;
34992
+ }
34993
+ #userSwitch;
34994
+ async #applyUser(next) {
34995
+ const current = this.config.user;
34996
+ if (current && [
34997
+ "id",
34998
+ "name",
34999
+ "email",
35000
+ "image",
35001
+ "initials"
35002
+ ].every((key) => (current[key] ?? null) === (next[key] ?? null))) return;
35003
+ const runtimes = this.#editorRuntimeRegistry.getAll();
35004
+ const results = await Promise.allSettled(runtimes.map((runtime) => runtime.setUser?.(runtimeUserOf(next))));
35005
+ const failure = results.find((result) => result.status === "rejected");
35006
+ if (failure) {
35007
+ if (current) await Promise.allSettled(runtimes.filter((_, index) => results[index].status === "fulfilled").map((runtime) => runtime.setUser?.(runtimeUserOf(current))));
35008
+ throw failure.reason;
35009
+ }
35010
+ const target = this.config.user ?? (this.config.user = {});
35011
+ for (const key of Object.keys(target)) delete target[key];
35012
+ Object.assign(target, next);
35013
+ this.user = target;
35014
+ this.#assignUserColor();
35015
+ const storeUser = this.superdocStore?.user;
35016
+ if (storeUser) {
35017
+ for (const key of Object.keys(storeUser)) delete storeUser[key];
35018
+ Object.assign(storeUser, target);
35019
+ }
35020
+ }
34906
35021
  /**
34907
35022
  * Add a user to the shared users list. Requires the instance to be
34908
35023
  * ready; pre-ready mutations would be silently overwritten by the