superdoc 2.28.0 → 2.29.0-next.1

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 (56) hide show
  1. package/dist/chunks/{PdfViewer-JHXZQZ9x.es.js → PdfViewer-D4lVeOJu.es.js} +3 -2
  2. package/dist/chunks/{PdfViewer-Cg072l5d.cjs → PdfViewer-boENOZdF.cjs} +3 -2
  3. package/dist/chunks/{create-super-doc-ui-BfgYblyI.cjs → create-super-doc-ui-0OA8hCNb.cjs} +201 -23
  4. package/dist/chunks/{create-super-doc-ui-BbjHD1ul.es.js → create-super-doc-ui-Duf65d0b.es.js} +180 -20
  5. package/dist/chunks/is-finite-number-BEXgTRgc.cjs +11 -0
  6. package/dist/chunks/is-finite-number-BpL4F38c.es.js +6 -0
  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/capabilities/html-markdown-support.d.ts +3 -3
  10. package/dist/document-api/src/index.d.ts +1 -1
  11. package/dist/document-api/src/lists/lists.d.ts +79 -79
  12. package/dist/document-api/src/write/write.d.ts +10 -9
  13. package/dist/layout-engine/painters/dom/src/page-content.d.ts +1 -1
  14. package/dist/layout-engine/painters/dom/src/persistent-page-surface.d.ts +2 -0
  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/SuperDoc.vue.d.ts +5 -3
  24. package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +1670 -24
  25. package/dist/superdoc/src/components/CommentsLayer/CommentHeader.vue.d.ts +2 -2
  26. package/dist/superdoc/src/components/CommentsLayer/CommentInput.vue.d.ts +2 -2
  27. package/dist/superdoc/src/components/CommentsLayer/FloatingComments.vue.d.ts +21 -8
  28. package/dist/superdoc/src/components/general/Avatar.vue.d.ts +7 -0
  29. package/dist/superdoc/src/components/surfaces/SurfaceDialog.vue.d.ts +27 -9
  30. package/dist/superdoc/src/components/surfaces/SurfaceExternalMount.vue.d.ts +53 -16
  31. package/dist/superdoc/src/composables/use-link-popover.d.ts +3 -3
  32. package/dist/superdoc/src/composables/use-superdoc-instance.d.ts +4 -1
  33. package/dist/superdoc/src/core/SuperDoc.d.ts +1 -1
  34. package/dist/superdoc/src/core/collaboration/permissions.d.ts +1 -0
  35. package/dist/superdoc/src/core/types/index.d.ts +9 -4
  36. package/dist/superdoc/src/helpers/is-finite-number.d.ts +1 -0
  37. package/dist/superdoc/src/internal/diagnostics/diagnostic-dedupe.d.ts +2 -2
  38. package/dist/superdoc/src/internal/toolbar/built-in/AIWriter.vue.d.ts +2 -2
  39. package/dist/superdoc/src/internal/toolbar/built-in/LinkInput.vue.d.ts +181 -36
  40. package/dist/superdoc/src/internal/toolbar/built-in/LinkedStyle.vue.d.ts +39 -10
  41. package/dist/superdoc/src/internal/toolbar/built-in/PageNumberMenu.vue.d.ts +133 -22
  42. package/dist/superdoc/src/internal/toolbar/built-in/SdTooltip.vue.d.ts +62 -23
  43. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButton.vue.d.ts +101 -16
  44. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButtonIcon.vue.d.ts +31 -10
  45. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarComboBox.vue.d.ts +82 -11
  46. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarDropdown.vue.d.ts +122 -33
  47. package/dist/superdoc/src/internal/toolbar/built-in/use-toolbar-item.d.ts +0 -1
  48. package/dist/superdoc/src/stores/comments-store.d.ts +151 -28
  49. package/dist/superdoc/src/stores/superdoc-store.d.ts +454 -85
  50. package/dist/superdoc.cjs +319 -401
  51. package/dist/superdoc.es.js +247 -330
  52. package/dist-cdn/style.layered.css +1 -1
  53. package/dist-cdn/superdoc.min.css +1 -1
  54. package/dist-cdn/superdoc.min.js +42 -42
  55. package/package.json +2 -2
  56. package/dist/superdoc/src/internal/toolbar/built-in/OverflowMenu.vue.d.ts +0 -104
@@ -1,10 +1,11 @@
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 { S as recordInteraction, _ as DOM_CLASS_NAMES, a as registerFirstPartyCommandMutation, b as getWorkflowRecording, c as getCommandDescriptor, d as mutationCommittedEventChangedDocument, f as createImageFilePicker, g as isSyntheticTrackedChangeCommentLaneItem, h as isPlainObject$1, 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 closeInteractionHistory, x as isWorkflowRecordingEnabled, y as createInteractionHistory } from "./chunks/create-super-doc-ui-BbjHD1ul.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";
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";
7
7
  import { a as init_dist$1, i as global, n as init_dist$2, o as Buffer, r as process$1, s as init_dist, t as require_jszip_min } from "./chunks/jszip-BzJ3CyxR.es.js";
8
+ import { t as isFiniteNumber } from "./chunks/is-finite-number-BpL4F38c.es.js";
8
9
  import { t as PDF_TO_CSS_UNITS } from "./chunks/constants-B6VBlmKp.es.js";
9
10
  import * as Vue from "vue";
10
11
  import { Map as Map$1 } from "yjs";
@@ -257,7 +258,7 @@ var v_click_outside_default = {
257
258
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
258
259
  function getSuperdocVersion() {
259
260
  try {
260
- return "2.28.0";
261
+ return "2.29.0-next.1";
261
262
  } catch {
262
263
  return "unknown";
263
264
  }
@@ -5396,7 +5397,7 @@ function normalizeRoomMode(value) {
5396
5397
  }
5397
5398
  function normalizeSyncTimeoutMs(value) {
5398
5399
  if (value === void 0) return void 0;
5399
- return typeof value === "number" && Number.isFinite(value) && value > 0 && value <= 2147483647 ? value : null;
5400
+ return isFiniteNumber(value) && value > 0 && value <= 2147483647 ? value : null;
5400
5401
  }
5401
5402
  function withSyncTimeout(resolution, syncTimeoutMs) {
5402
5403
  if (!resolution.ok || syncTimeoutMs === void 0) return resolution;
@@ -6583,7 +6584,7 @@ var useSuperdocStore = defineStore("superdoc", () => {
6583
6584
  currentConfig.value = config;
6584
6585
  if (config.zoom?.initial !== void 0) {
6585
6586
  const initialZoom = config.zoom.initial;
6586
- if (typeof initialZoom === "number" && Number.isFinite(initialZoom) && initialZoom > 0) activeZoom.value = initialZoom;
6587
+ if (isFiniteNumber(initialZoom) && initialZoom > 0) activeZoom.value = initialZoom;
6587
6588
  else console.warn("[SuperDoc] zoom.initial expects a positive number representing percentage");
6588
6589
  }
6589
6590
  if (config.zoom?.mode !== void 0) {
@@ -7448,8 +7449,8 @@ var normalizeTrackedChangeImagePreview = (preview) => {
7448
7449
  if (!src || !src.startsWith("data:image/")) return null;
7449
7450
  const contentType = typeof preview.contentType === "string" && preview.contentType.startsWith("image/") ? preview.contentType : null;
7450
7451
  const role = typeof preview.role === "string" ? preview.role : null;
7451
- const width = typeof preview.width === "number" && Number.isFinite(preview.width) && preview.width > 0 ? preview.width : null;
7452
- const height = typeof preview.height === "number" && Number.isFinite(preview.height) && preview.height > 0 ? preview.height : 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;
7453
7454
  const alt = typeof preview.alt === "string" && preview.alt.length > 0 ? preview.alt : "Tracked image preview";
7454
7455
  return {
7455
7456
  src,
@@ -8477,10 +8478,10 @@ var useCommentsStore = defineStore("comments", () => {
8477
8478
  * Get a new pending comment
8478
8479
  *
8479
8480
  * @param {Object} param0
8480
- * @param {Object} param0.selection The selection object
8481
- * @param {String} param0.documentId The document ID
8482
- * @param {String} param0.parentCommentId The parent comment
8483
- * @returns {Object} The new comment object
8481
+ * @param {Object} [param0.selection] The selection object
8482
+ * @param {string | null} [param0.documentId] The document ID
8483
+ * @param {string | null} [param0.parentCommentId] The parent comment
8484
+ * @returns {ReturnType<typeof useComment>} The new comment object
8484
8485
  */
8485
8486
  const getPendingComment = ({ selection, documentId, parentCommentId, ...options }) => {
8486
8487
  return _getNewcomment({
@@ -8552,7 +8553,11 @@ var useCommentsStore = defineStore("comments", () => {
8552
8553
  *
8553
8554
  * @param {Object} param0
8554
8555
  * @param {Object} param0.superdoc The SuperDoc instance
8555
- * @returns {void}
8556
+ * @param {ReturnType<typeof useComment>} param0.comment The comment to add
8557
+ * @param {boolean} [param0.skipEditorUpdate] Skip writing the comment into the editor
8558
+ * @param {boolean} [param0.broadcastChanges] Emit and sync the change
8559
+ * @param {boolean} [param0.isHydration] The comment comes from import or collaboration
8560
+ * @returns {{ ok: boolean, reason?: string, detail?: string, code?: string } | Promise<{ ok: boolean, reason?: string, detail?: string, code?: string }>} The mutation outcome
8556
8561
  */
8557
8562
  const addCommentInternal = ({ superdoc, comment, skipEditorUpdate = false, broadcastChanges = true, isHydration = false }) => {
8558
8563
  if (commentsAreReadOnly() && !isHydration) return readOnlyMutationOutcome();
@@ -9133,6 +9138,13 @@ var useCommentsStore = defineStore("comments", () => {
9133
9138
  * - successful mutation refreshes from v2 list and reconciles
9134
9139
  * - rejection preserves rows and emits a rejected `comments-update` event
9135
9140
  * - committed-but-refresh-failed surfaces honestly (no reconcile with `[]`)
9141
+ *
9142
+ * @param {Object} [param0]
9143
+ * @param {Object} [param0.superdoc] The SuperDoc instance.
9144
+ * @param {string | null} [param0.parentCommentId] The comment or tracked-change row being replied to.
9145
+ * @param {string} [param0.text] The reply text.
9146
+ * @param {Array<{ name?: string | null, email?: string | null }>} [param0.mentions] Users mentioned in the reply.
9147
+ * @param {{ kind: 'trackedChange', trackedChangeId: string, story?: unknown, side?: 'source' | 'destination' }} [param0.trackedChangeTarget] The tracked change a first reply anchors to.
9136
9148
  */
9137
9149
  const replyCommentV2 = async ({ superdoc, parentCommentId, text, mentions = [], trackedChangeTarget } = {}) => {
9138
9150
  if (commentsAreReadOnly()) return readOnlyMutationOutcome();
@@ -10403,15 +10415,13 @@ var useCommentsStore = defineStore("comments", () => {
10403
10415
  } catch {}
10404
10416
  };
10405
10417
  /**
10406
- * Rebuild tracked-change comments from the current editor state.
10407
- *
10408
- * Useful after bulk document transforms (like diff replay) where tracked-change
10409
- * marks may be remapped and incremental tracked-change events are not emitted.
10418
+ * Accept or reject the tracked change behind a sidebar row.
10410
10419
  *
10411
10420
  * @param {Object} param0
10412
10421
  * @param {Object} param0.superdoc The SuperDoc instance.
10413
- * @param {Object} param0.editor The active Super Editor instance.
10414
- * @returns {void}
10422
+ * @param {Object} param0.comment The tracked-change row.
10423
+ * @param {string} param0.decision `'accept'` or `'reject'`.
10424
+ * @returns {{ ok: boolean, success?: boolean, reason?: string } | Promise<{ ok: boolean, success?: boolean, reason?: string }>} The decision outcome.
10415
10425
  */
10416
10426
  const decideTrackedChangeFromSidebar = ({ superdoc, comment, decision }) => {
10417
10427
  const disabledReason = trackedChangeDecisionDisabledReason(superdoc);
@@ -10939,6 +10949,18 @@ var useCommentsStore = defineStore("comments", () => {
10939
10949
  };
10940
10950
  });
10941
10951
  //#endregion
10952
+ //#region src/composables/use-superdoc-instance.ts
10953
+ function useSuperDocInstance() {
10954
+ const instance = getCurrentInstance();
10955
+ if (!instance?.proxy) throw new Error("useSuperDocInstance() must be called during a component setup function.");
10956
+ const superdoc = instance.appContext.config.globalProperties.$superdoc;
10957
+ if (!superdoc) throw new Error("useSuperDocInstance() found no SuperDoc registered at app.config.globalProperties.$superdoc.");
10958
+ return {
10959
+ proxy: instance.proxy,
10960
+ superdoc
10961
+ };
10962
+ }
10963
+ //#endregion
10942
10964
  //#region ../../shared/common/icons/comment-solid.svg?raw
10943
10965
  var comment_solid_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d=\"M512 240c0 114.9-114.6 208-256 208c-37.1 0-72.3-6.4-104.1-17.9c-11.9 8.7-31.3 20.6-54.3 30.6C73.6 471.1 44.7 480 16 480c-6.5 0-12.3-3.9-14.8-9.9c-2.5-6-1.1-12.8 3.4-17.4c0 0 0 0 0 0s0 0 0 0s0 0 0 0c0 0 0 0 0 0l.3-.3c.3-.3 .7-.7 1.3-1.4c1.1-1.2 2.8-3.1 4.9-5.7c4.1-5 9.6-12.4 15.2-21.6c10-16.6 19.5-38.4 21.4-62.9C17.7 326.8 0 285.1 0 240C0 125.1 114.6 32 256 32s256 93.1 256 208z\"/></svg>";
10944
10966
  //#endregion
@@ -11350,122 +11372,6 @@ function formatDate(timestamp) {
11350
11372
  return `${`${formattedHours}:${minutes.toString().padStart(2, "0")}${meridiem}`} ${month} ${day}`;
11351
11373
  }
11352
11374
  //#endregion
11353
- //#region src/core/collaboration/permissions.js
11354
- var PERMISSIONS = Object.freeze({
11355
- RESOLVE_OWN: "RESOLVE_OWN",
11356
- RESOLVE_OTHER: "RESOLVE_OTHER",
11357
- REJECT_OWN: "REJECT_OWN",
11358
- REJECT_OTHER: "REJECT_OTHER",
11359
- COMMENTS_OVERFLOW_OWN: "COMMENTS_OVERFLOW",
11360
- COMMENTS_OVERFLOW_OTHER: "COMMENTS_OVERFLOW_OTHER",
11361
- COMMENTS_DELETE_OWN: "COMMENTS_DELETE_OWN",
11362
- COMMENTS_DELETE_OTHER: "COMMENTS_DELETE_OTHER",
11363
- UPLOAD_VERSION: "UPLOAD_VERSION",
11364
- VERSION_HISTORY: "VERSION_HISTORY"
11365
- });
11366
- var ROLES = Object.freeze({
11367
- EDITOR: "editor",
11368
- SUGGESTER: "suggester",
11369
- VIEWER: "viewer"
11370
- });
11371
- var PERMISSION_MATRIX = Object.freeze({
11372
- [PERMISSIONS.RESOLVE_OWN]: {
11373
- internal: [ROLES.EDITOR],
11374
- external: [ROLES.EDITOR]
11375
- },
11376
- [PERMISSIONS.RESOLVE_OTHER]: {
11377
- internal: [ROLES.EDITOR],
11378
- external: [ROLES.EDITOR]
11379
- },
11380
- [PERMISSIONS.REJECT_OWN]: {
11381
- internal: [ROLES.EDITOR, ROLES.SUGGESTER],
11382
- external: [ROLES.EDITOR, ROLES.SUGGESTER]
11383
- },
11384
- [PERMISSIONS.REJECT_OTHER]: {
11385
- internal: [ROLES.EDITOR],
11386
- external: [ROLES.EDITOR]
11387
- },
11388
- [PERMISSIONS.COMMENTS_OVERFLOW_OWN]: {
11389
- internal: [ROLES.EDITOR, ROLES.SUGGESTER],
11390
- external: [ROLES.EDITOR, ROLES.SUGGESTER]
11391
- },
11392
- [PERMISSIONS.COMMENTS_OVERFLOW_OTHER]: {
11393
- internal: [ROLES.EDITOR],
11394
- external: [ROLES.EDITOR]
11395
- },
11396
- [PERMISSIONS.COMMENTS_DELETE_OWN]: {
11397
- internal: [ROLES.EDITOR, ROLES.SUGGESTER],
11398
- external: [ROLES.EDITOR, ROLES.SUGGESTER]
11399
- },
11400
- [PERMISSIONS.COMMENTS_DELETE_OTHER]: {
11401
- internal: [ROLES.EDITOR],
11402
- external: [ROLES.EDITOR]
11403
- },
11404
- [PERMISSIONS.UPLOAD_VERSION]: {
11405
- internal: [ROLES.EDITOR],
11406
- external: []
11407
- },
11408
- [PERMISSIONS.VERSION_HISTORY]: {
11409
- internal: [ROLES.EDITOR],
11410
- external: []
11411
- }
11412
- });
11413
- var pickResolver = (context = {}) => {
11414
- if (typeof context.permissionResolver === "function") return context.permissionResolver;
11415
- if (typeof context.superdoc?.config?.permissionResolver === "function") return context.superdoc.config.permissionResolver;
11416
- const deprecatedResolver = context.superdoc?.config?.modules?.comments?.permissionResolver;
11417
- if (typeof deprecatedResolver === "function") return deprecatedResolver;
11418
- return null;
11419
- };
11420
- var BUILT_IN_PERMISSION_METHOD = Symbol.for("superdoc.internal.permission-method.builtin");
11421
- var BUILT_IN_PERMISSION_RESOLVER = Symbol.for("superdoc.internal.permission-resolver.builtin");
11422
- /** Create the shell's internal, live tracked-change permission shim. */
11423
- var createTrackedChangePermissionResolver = (superdoc) => {
11424
- const isBuiltInPolicy = () => superdoc.canPerformPermission?.[BUILT_IN_PERMISSION_METHOD] === true && pickResolver({ superdoc }) === null;
11425
- const resolver = (payload = {}) => isBuiltInPolicy() ? defaultDecisionFor(payload.permission, superdoc.config.role, superdoc.config.isInternal) : superdoc.canPerformPermission({
11426
- ...payload,
11427
- role: superdoc.config.role,
11428
- isInternal: superdoc.config.isInternal
11429
- });
11430
- Object.defineProperty(resolver, BUILT_IN_PERMISSION_RESOLVER, { value: isBuiltInPolicy });
11431
- return resolver;
11432
- };
11433
- var defaultDecisionFor = (permission, role, isInternal) => {
11434
- const internalExternal = isInternal ? "internal" : "external";
11435
- return PERMISSION_MATRIX[permission]?.[internalExternal]?.includes(role) ?? false;
11436
- };
11437
- /**
11438
- * Resolve a client-side permission through the built-in matrix and optional
11439
- * resolver.
11440
- *
11441
- * @param {string} permission The permission to check
11442
- * @param {string} role The role to check
11443
- * @param {boolean} isInternal The internal/external flag
11444
- * @param {object} [context] Context passed to the permission resolver
11445
- * @param {object | null} [context.comment] The comment/tracked change being evaluated
11446
- * @param {object | null} [context.superdoc] The SuperDoc instance
11447
- * @param {object | null} [context.currentUser] The active user object performing the action
11448
- * @param {Function} [context.permissionResolver] Explicit resolver override
11449
- * @param {object | null} [context.trackedChange] Tracked change metadata (for tracked-change permissions)
11450
- * @returns {boolean} Whether the permission is allowed
11451
- */
11452
- var isAllowed = (permission, role, isInternal, context = {}) => {
11453
- const defaultDecision = defaultDecisionFor(permission, role, isInternal);
11454
- const resolver = pickResolver(context);
11455
- if (typeof resolver !== "function") return defaultDecision;
11456
- const decision = resolver({
11457
- permission,
11458
- role,
11459
- isInternal,
11460
- defaultDecision,
11461
- comment: context.comment ?? null,
11462
- currentUser: context.currentUser ?? context.superdoc?.config?.user ?? null,
11463
- superdoc: context.superdoc ?? null,
11464
- trackedChange: context.trackedChange ?? null
11465
- });
11466
- return typeof decision === "boolean" ? decision : defaultDecision;
11467
- };
11468
- //#endregion
11469
11375
  //#region src/components/general/Avatar.vue
11470
11376
  var _hoisted_1$29 = { class: "user-container" };
11471
11377
  var _hoisted_2$22 = ["src"];
@@ -11650,11 +11556,12 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11650
11556
  if (props.isPendingInput) return false;
11651
11557
  return true;
11652
11558
  });
11559
+ const resolveIsDisabled = () => props.config.allowResolve === false;
11653
11560
  const allowResolve = computed$1(() => {
11654
11561
  if (!generallyAllowed.value) return false;
11655
11562
  if (props.comment.trackedChange) {
11656
11563
  if (!trackedChangeDecisionsVisible.value) return false;
11657
- } else if (!commentMutationsVisible.value || props.config.allowResolve === false) return false;
11564
+ } else if (!commentMutationsVisible.value || resolveIsDisabled()) return false;
11658
11565
  if (props.comment.parentCommentId) return false;
11659
11566
  if (trackedChangeThreadParentId.value) return false;
11660
11567
  const context = {
@@ -11679,7 +11586,7 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11679
11586
  });
11680
11587
  const allowReopen = computed$1(() => {
11681
11588
  if (!commentMutationsVisible.value) return false;
11682
- if (props.config.allowResolve === false) return false;
11589
+ if (resolveIsDisabled()) return false;
11683
11590
  if (!props.reopenSupported) return false;
11684
11591
  if (!props.comment) return false;
11685
11592
  if (!props.comment.resolvedTime) return false;
@@ -11724,7 +11631,7 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11724
11631
  const handleResolve = () => {
11725
11632
  if (props.comment?.trackedChange) {
11726
11633
  if (!trackedChangeDecisionsVisible.value) return;
11727
- } else if (!commentMutationsVisible.value || props.config.allowResolve === false) return;
11634
+ } else if (!commentMutationsVisible.value || resolveIsDisabled()) return;
11728
11635
  if (props.resolveDisabledReason) return;
11729
11636
  emit("resolve");
11730
11637
  };
@@ -11734,7 +11641,7 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11734
11641
  emit("reject");
11735
11642
  };
11736
11643
  const handleReopen = () => {
11737
- if (!commentMutationsVisible.value || props.config.allowResolve === false) return;
11644
+ if (!commentMutationsVisible.value || resolveIsDisabled()) return;
11738
11645
  if (props.reopenDisabledReason) return;
11739
11646
  emit("reopen");
11740
11647
  };
@@ -11808,7 +11715,7 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11808
11715
  ], 2)]);
11809
11716
  };
11810
11717
  }
11811
- }, [["__scopeId", "data-v-b2a33943"]]);
11718
+ }, [["__scopeId", "data-v-3af1135b"]]);
11812
11719
  //#endregion
11813
11720
  //#region src/components/CommentsLayer/CommentInput.vue
11814
11721
  var _hoisted_1$27 = { class: "input-section" };
@@ -12138,7 +12045,7 @@ function renderCommentHtml(value) {
12138
12045
  return template.innerHTML;
12139
12046
  }
12140
12047
  //#endregion
12141
- //#region src/components/CommentsLayer/CommentDialog.vue
12048
+ //#region src/components/CommentsLayer/CommentDialog.vue?vue&type=script&setup=true&lang.ts
12142
12049
  var _hoisted_1$26 = [
12143
12050
  "aria-label",
12144
12051
  "data-comment-instance-id",
@@ -12227,34 +12134,35 @@ var _hoisted_42 = {
12227
12134
  };
12228
12135
  var _hoisted_43 = { class: "reply-input-wrapper" };
12229
12136
  var _hoisted_44 = { class: "reply-actions" };
12230
- var _hoisted_45 = ["onClick"];
12231
- var _hoisted_46 = [
12137
+ var _hoisted_45 = [
12232
12138
  "onClick",
12233
12139
  "disabled",
12234
12140
  "data-disabled-reason"
12235
12141
  ];
12236
- var _hoisted_47 = { class: "collapsed-avatars" };
12237
- var _hoisted_48 = {
12142
+ var _hoisted_46 = { class: "collapsed-avatars" };
12143
+ var _hoisted_47 = {
12238
12144
  key: 3,
12239
12145
  class: "comment-separator"
12240
12146
  };
12241
- var _hoisted_49 = {
12147
+ var _hoisted_48 = {
12242
12148
  key: 3,
12243
12149
  class: "tracked-change-decision-alert",
12244
12150
  role: "alert"
12245
12151
  };
12246
- var _hoisted_50 = { class: "tracked-change-decision-alert__message" };
12247
- var _hoisted_51 = ["disabled", "data-disabled-reason"];
12248
- var _hoisted_52 = {
12152
+ var _hoisted_49 = { class: "tracked-change-decision-alert__message" };
12153
+ var _hoisted_50 = ["disabled", "data-disabled-reason"];
12154
+ var _hoisted_51 = {
12249
12155
  key: 1,
12250
12156
  class: "reply-expanded"
12251
12157
  };
12252
- var _hoisted_53 = { class: "reply-input-wrapper" };
12253
- var _hoisted_54 = { class: "reply-actions" };
12254
- var _hoisted_55 = ["disabled", "data-disabled-reason"];
12158
+ var _hoisted_52 = { class: "reply-input-wrapper" };
12159
+ var _hoisted_53 = { class: "reply-actions" };
12160
+ var _hoisted_54 = ["disabled", "data-disabled-reason"];
12255
12161
  var commentEditSessions = /* @__PURE__ */ new WeakMap();
12256
12162
  var commentReplySessions = /* @__PURE__ */ new WeakMap();
12257
- var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12163
+ //#endregion
12164
+ //#region src/components/CommentsLayer/CommentDialog.vue
12165
+ var CommentDialog_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
12258
12166
  __name: "CommentDialog",
12259
12167
  props: {
12260
12168
  comment: {
@@ -12299,9 +12207,10 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12299
12207
  setup(__props, { emit: __emit }) {
12300
12208
  const emit = __emit;
12301
12209
  const props = __props;
12302
- const { proxy } = getCurrentInstance();
12210
+ const proxy = useSuperDocInstance().proxy;
12303
12211
  const superdocStore = useSuperdocStore();
12304
- const commentsStore = useCommentsStore();
12212
+ const piniaCommentsStore = useCommentsStore();
12213
+ const commentsStore = piniaCommentsStore;
12305
12214
  const editSessionOwner = {};
12306
12215
  const replySessionOwner = {};
12307
12216
  const retireOwnEditSession = () => {
@@ -12311,7 +12220,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12311
12220
  if (commentReplySessions.get(commentsStore)?.owner === replySessionOwner) commentReplySessions.delete(commentsStore);
12312
12221
  };
12313
12222
  const { addComment, cancelComment, deleteComment, getCommentAliasIds, removePendingComment, getCommentDocumentId, requestInstantSidebarAlignment, resolveCommentPositionEntry, clearInstantSidebarAlignment, setActiveFloatingCommentInstance } = commentsStore;
12314
- const { suppressInternalExternal, getConfig, activeComment, activeFloatingCommentInstanceId, floatingCommentsOffset, pendingComment, currentCommentText, currentCommentMentions, isDebugging, editingCommentId, editorCommentPositions, isCommentHighlighted } = storeToRefs(commentsStore);
12223
+ const { suppressInternalExternal, getConfig, activeComment, activeFloatingCommentInstanceId, floatingCommentsOffset, pendingComment, currentCommentText, currentCommentMentions, isDebugging, editingCommentId, editorCommentPositions, isCommentHighlighted } = storeToRefs(piniaCommentsStore);
12315
12224
  const isInternal = ref(true);
12316
12225
  const commentInput = ref(null);
12317
12226
  const editCommentInputs = ref(/* @__PURE__ */ new Map());
@@ -12326,8 +12235,8 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12326
12235
  ];
12327
12236
  const TRACKED_CHANGE_PREVIEW_MAX_PX = 90;
12328
12237
  const trackedChangeImagePreviewStyle = (preview) => {
12329
- const width = typeof preview?.width === "number" && Number.isFinite(preview.width) ? preview.width : null;
12330
- const height = typeof preview?.height === "number" && Number.isFinite(preview.height) ? preview.height : null;
12238
+ const width = isFiniteNumber(preview?.width) ? preview.width : null;
12239
+ const height = isFiniteNumber(preview?.height) ? preview.height : null;
12331
12240
  if (!width || !height || width <= 0 || height <= 0) return {};
12332
12241
  const scale = Math.min(TRACKED_CHANGE_PREVIEW_MAX_PX / width, TRACKED_CHANGE_PREVIEW_MAX_PX / height, 1);
12333
12242
  return {
@@ -12379,13 +12288,14 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12379
12288
  const findIgnoredElementByGeometry = (clientX, clientY) => {
12380
12289
  if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) return null;
12381
12290
  const ignoredElements = document.querySelectorAll(CLICK_OUTSIDE_IGNORED_SELECTORS);
12382
- for (const element of ignoredElements) if (element instanceof HTMLElement && elementContainsClickPoint(element, clientX, clientY)) return element;
12291
+ for (const element of Array.from(ignoredElements)) if (element instanceof HTMLElement && elementContainsClickPoint(element, clientX, clientY)) return element;
12383
12292
  return null;
12384
12293
  };
12385
12294
  const focusEditInput = (commentId) => {
12386
12295
  editCommentInputs.value.get(commentId)?.focus?.();
12387
12296
  };
12388
12297
  const commentDialogElement = ref(null);
12298
+ const trackedChangeStoryType = (story) => typeof story === "object" ? story?.storyType : void 0;
12389
12299
  const getCommentFocusThreadId = (comment) => {
12390
12300
  if (comment.resolvedTime) return comment.commentId;
12391
12301
  return comment.importedId || comment.commentId;
@@ -12411,7 +12321,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12411
12321
  };
12412
12322
  const getEntryBoundsCoordinate = (entry, coordinate) => {
12413
12323
  const value = entry?.bounds?.[coordinate];
12414
- return Number.isFinite(value) ? value : null;
12324
+ return isFiniteNumber(value) ? value : null;
12415
12325
  };
12416
12326
  const entriesShareLine = (entry, candidateEntry) => {
12417
12327
  if (!entry || !candidateEntry) return false;
@@ -12425,12 +12335,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12425
12335
  const candidateLeft = getEntryBoundsCoordinate(candidateEntry, "left");
12426
12336
  const entryRight = getEntryBoundsCoordinate(entry, "right");
12427
12337
  const candidateRight = getEntryBoundsCoordinate(candidateEntry, "right");
12428
- if ([
12429
- entryLeft,
12430
- candidateLeft,
12431
- entryRight,
12432
- candidateRight
12433
- ].some((value) => value == null)) return false;
12338
+ if (entryLeft == null || candidateLeft == null || entryRight == null || candidateRight == null) return false;
12434
12339
  return candidateLeft < entryRight && entryLeft < candidateRight;
12435
12340
  };
12436
12341
  const entriesOverlapRange = (entry, candidateEntry) => {
@@ -12438,12 +12343,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12438
12343
  const entryEnd = entry?.end;
12439
12344
  const candidateStart = candidateEntry?.start;
12440
12345
  const candidateEnd = candidateEntry?.end;
12441
- if (![
12442
- entryStart,
12443
- entryEnd,
12444
- candidateStart,
12445
- candidateEnd
12446
- ].every(Number.isFinite)) return false;
12346
+ if (!isFiniteNumber(entryStart) || !isFiniteNumber(entryEnd) || !isFiniteNumber(candidateStart) || !isFiniteNumber(candidateEnd)) return false;
12447
12347
  return candidateStart <= entryEnd && entryStart <= candidateEnd;
12448
12348
  };
12449
12349
  const shouldIncludeThreadAlias = (entry, candidateEntry) => {
@@ -12464,7 +12364,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12464
12364
  return [...lookupIds];
12465
12365
  };
12466
12366
  const isDialogAlreadyAlignedWithTarget = (dialogElement, targetClientY, tolerancePx = 24) => {
12467
- if (!Number.isFinite(targetClientY) || typeof dialogElement?.getBoundingClientRect !== "function") return false;
12367
+ if (!isFiniteNumber(targetClientY) || typeof dialogElement?.getBoundingClientRect !== "function") return false;
12468
12368
  const dialogTop = dialogElement.getBoundingClientRect().top;
12469
12369
  return Number.isFinite(dialogTop) && Math.abs(dialogTop - targetClientY) <= tolerancePx;
12470
12370
  };
@@ -12490,14 +12390,19 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12490
12390
  if (showInputSection.value && index === visible.length - 1) return true;
12491
12391
  return visible.length > 1 && index !== visible.length - 1;
12492
12392
  });
12393
+ const commentsAreReadOnly = () => getConfig.value?.readOnly === true;
12394
+ const resolveIsDisabled = () => getConfig.value?.allowResolve === false;
12493
12395
  const showInputSection = computed$1(() => {
12494
- return !getConfig.readOnly && isDialogActive.value && !props.comment.resolvedTime && !isEditingAnyComment.value;
12396
+ return !commentsAreReadOnly() && isDialogActive.value && !props.comment.resolvedTime && !isEditingAnyComment.value;
12495
12397
  });
12496
12398
  const readOnlyMutationOutcome = () => ({
12497
12399
  ok: false,
12498
12400
  reason: "read-only-document"
12499
12401
  });
12500
- const commentsAreReadOnly = () => getConfig.value?.readOnly === true;
12402
+ const resolveDisabledOutcome = () => ({
12403
+ ok: false,
12404
+ reason: "resolve-disabled"
12405
+ });
12501
12406
  const trackedChangeDecisionsAreDisabled = () => {
12502
12407
  const allowDecisions = proxy.$superdoc?.interactionConfig?.trackedChanges?.allowDecisions;
12503
12408
  if (typeof allowDecisions === "boolean") return !allowDecisions;
@@ -12575,7 +12480,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12575
12480
  nextTick(() => emit("resize"));
12576
12481
  };
12577
12482
  const setParentBodyRef = (el) => {
12578
- parentBodyRef.value = el ?? null;
12483
+ parentBodyRef.value = el;
12579
12484
  };
12580
12485
  const checkOverflow = () => {
12581
12486
  if (textExpanded.value) return;
@@ -12658,7 +12563,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12658
12563
  };
12659
12564
  const isInternalDropdownDisabled = computed$1(() => {
12660
12565
  if (props.comment.resolvedTime) return true;
12661
- return getConfig.value.readOnly;
12566
+ return commentsAreReadOnly();
12662
12567
  });
12663
12568
  const isEditingThisComment = computed$1(() => (comment) => {
12664
12569
  return isDialogActive.value && editingCommentId.value === comment.commentId;
@@ -12668,7 +12573,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12668
12573
  return comments.value.some((c) => c.commentId === editingCommentId.value);
12669
12574
  });
12670
12575
  const shouldShowInternalExternal = computed$1(() => {
12671
- if (getConfig.value.readOnly) return false;
12576
+ if (commentsAreReadOnly()) return false;
12672
12577
  if (!proxy.$superdoc.config.isInternal) return false;
12673
12578
  if (isV2Mode.value) return false;
12674
12579
  return !suppressInternalExternal.value && !props.comment.trackedChange;
@@ -12712,7 +12617,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12712
12617
  if (editor) {
12713
12618
  const { entry: resolvedFocusEntry } = resolveCommentPositionEntry(props.comment);
12714
12619
  const focusEntry = props.floatingPositionEntry ?? resolvedFocusEntry;
12715
- const usePageScopedAnchorOnly = Number.isFinite(props.floatingPageIndex) && props.comment?.trackedChangeStory?.storyType === "headerFooterPart";
12620
+ const usePageScopedAnchorOnly = Number.isFinite(props.floatingPageIndex) && trackedChangeStoryType(props.comment?.trackedChangeStory) === "headerFooterPart";
12716
12621
  const visibleAnchorTargetY = getVisibleThreadAnchorClientY(props.parent, focusEntry);
12717
12622
  const visibleHighlightTargetY = usePageScopedAnchorOnly ? null : getVisibleThreadHighlightClientY(getThreadHighlightLookupIds(props.comment));
12718
12623
  const visibleThreadTargetY = Number.isFinite(visibleHighlightTargetY) ? visibleHighlightTargetY : visibleAnchorTargetY;
@@ -12930,7 +12835,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12930
12835
  const getReopenDisabledReason = () => {
12931
12836
  if (!isV2Mode.value) return null;
12932
12837
  if (!v2CommentsAdapter.value) return "v2-comments-adapter-missing";
12933
- if (getConfig.value?.readOnly) return "read-only-document";
12838
+ if (commentsAreReadOnly()) return "read-only-document";
12934
12839
  if (isV2WriteDisabled.value) return v2WriteCapability.value?.reason ?? "v2-write-unavailable";
12935
12840
  return null;
12936
12841
  };
@@ -13033,10 +12938,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13033
12938
  if (trackedChangeDecisionsAreDisabled()) return trackedChangeDecisionDisabledOutcome();
13034
12939
  } else {
13035
12940
  if (commentsAreReadOnly()) return readOnlyMutationOutcome();
13036
- if (getConfig.value?.allowResolve === false) return {
13037
- ok: false,
13038
- reason: "resolve-disabled"
13039
- };
12941
+ if (resolveIsDisabled()) return resolveDisabledOutcome();
13040
12942
  }
13041
12943
  const customHandler = proxy.$superdoc.config.onTrackedChangeBubbleAccept;
13042
12944
  if (props.comment.trackedChange && isV2Mode.value) {
@@ -13101,10 +13003,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13101
13003
  };
13102
13004
  const handleReopen = async () => {
13103
13005
  if (commentsAreReadOnly()) return readOnlyMutationOutcome();
13104
- if (getConfig.value?.allowResolve === false) return {
13105
- ok: false,
13106
- reason: "resolve-disabled"
13107
- };
13006
+ if (resolveIsDisabled()) return resolveDisabledOutcome();
13108
13007
  if (!isV2Mode.value || !v2CommentsAdapter.value) return;
13109
13008
  const outcome = await commentsStore.reopenCommentV2({
13110
13009
  superdoc: proxy.$superdoc,
@@ -13129,7 +13028,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13129
13028
  owner: editSessionOwner,
13130
13029
  submission: null
13131
13030
  });
13132
- currentCommentText.value = comment?.commentText?.value ?? comment?.commentText ?? "";
13031
+ currentCommentText.value = comment?.commentText ?? "";
13133
13032
  currentCommentMentions.value = Array.isArray(comment?.mentions) ? [...comment.mentions] : [];
13134
13033
  activeComment.value = props.comment.commentId;
13135
13034
  if (props.floatingInstanceId) setActiveFloatingCommentInstance(props.floatingInstanceId);
@@ -13201,7 +13100,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13201
13100
  const getProcessedDate = (timestamp) => {
13202
13101
  return typeof timestamp === "string" ? new Date(timestamp).getTime() : timestamp;
13203
13102
  };
13204
- const handleCancel = (comment) => {
13103
+ const handleCancel = () => {
13205
13104
  commentSaveFailure.value = "";
13206
13105
  retireOwnEditSession();
13207
13106
  retireOwnReplySession();
@@ -13211,7 +13110,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13211
13110
  };
13212
13111
  const usersFiltered = computed$1(() => {
13213
13112
  const users = proxy.$superdoc.users;
13214
- if (props.comment.isInternal === true) return users.filter((user) => user.access === "internal" || user.access?.role === "internal");
13113
+ if (props.comment.isInternal === true) return users.filter((user) => user.access === "internal" || typeof user.access === "object" && user.access?.role === "internal");
13215
13114
  return users;
13216
13115
  });
13217
13116
  onMounted(() => {
@@ -13248,7 +13147,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13248
13147
  focusEditInput(commentId);
13249
13148
  });
13250
13149
  });
13251
- watch$1(() => getConfig.value?.readOnly === true, (readOnly) => {
13150
+ watch$1(commentsAreReadOnly, (readOnly) => {
13252
13151
  if (!readOnly) return;
13253
13152
  isReplying.value = false;
13254
13153
  if (comments.value.some((comment) => comment.commentId === editingCommentId.value)) editingCommentId.value = null;
@@ -13336,11 +13235,11 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13336
13235
  timestamp: getProcessedDate(comment.createdTime),
13337
13236
  comment,
13338
13237
  "is-active": isDialogActive.value,
13339
- "resolve-disabled-reason": getResolveDisabledReason(comment),
13340
- "reject-disabled-reason": getRejectDisabledReason(comment),
13238
+ "resolve-disabled-reason": getResolveDisabledReason(comment) ?? void 0,
13239
+ "reject-disabled-reason": getRejectDisabledReason(comment) ?? void 0,
13341
13240
  "reopen-supported": isV2Mode.value && Boolean(v2CommentsAdapter.value),
13342
- "reopen-disabled-reason": getReopenDisabledReason(),
13343
- "write-disabled-reason": v2OverflowWriteDisabledReason.value,
13241
+ "reopen-disabled-reason": getReopenDisabledReason() ?? void 0,
13242
+ "write-disabled-reason": v2OverflowWriteDisabledReason.value ?? void 0,
13344
13243
  onResolve: handleResolve,
13345
13244
  onReject: handleReject,
13346
13245
  onReopen: handleReopen,
@@ -13407,7 +13306,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13407
13306
  ref_for: true,
13408
13307
  ref: index === 0 ? setParentBodyRef : void 0,
13409
13308
  innerHTML: renderedCommentTexts.value.get(comment.commentId)
13410
- }, null, 10, _hoisted_40)) : unref(isDebugging) && !isEditingThisComment.value(comment) ? (openBlock(), createElementBlock("div", _hoisted_41, toDisplayString(unref(editorCommentPositions)[comment.importedId !== void 0 ? comment.importedId : comment.commentId]?.bounds), 1)) : (openBlock(), createElementBlock("div", _hoisted_42, [createElementVNode("div", _hoisted_43, [createVNode(CommentInput_default, {
13309
+ }, null, 10, _hoisted_40)) : unref(isDebugging) && !isEditingThisComment.value(comment) ? (openBlock(), createElementBlock("div", _hoisted_41, toDisplayString(unref(editorCommentPositions)[String(comment.importedId !== void 0 ? comment.importedId : comment.commentId)]?.bounds), 1)) : (openBlock(), createElementBlock("div", _hoisted_42, [createElementVNode("div", _hoisted_43, [createVNode(CommentInput_default, {
13411
13310
  ref_for: true,
13412
13311
  ref: setEditCommentInputRef(comment.commentId),
13413
13312
  users: [],
@@ -13416,13 +13315,13 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13416
13315
  comment
13417
13316
  }, null, 8, ["config", "comment"])]), createElementVNode("div", _hoisted_44, [createElementVNode("button", {
13418
13317
  class: "sd-button reply-btn-cancel",
13419
- onClick: withModifiers(($event) => handleCancel(comment), ["stop", "prevent"])
13420
- }, "Cancel", 8, _hoisted_45), createElementVNode("button", {
13318
+ onClick: withModifiers(handleCancel, ["stop", "prevent"])
13319
+ }, "Cancel"), createElementVNode("button", {
13421
13320
  class: normalizeClass(["sd-button primary reply-btn-primary", { "sd-is-disabled": !hasTextContent.value || isV2WriteDisabled.value }]),
13422
13321
  onClick: withModifiers(($event) => handleCommentUpdate(comment), ["stop", "prevent"]),
13423
13322
  disabled: !hasTextContent.value || isV2WriteDisabled.value,
13424
13323
  "data-disabled-reason": isV2WriteDisabled.value ? v2WriteCapability.value?.reason ?? null : null
13425
- }, " Update ", 10, _hoisted_46)])])),
13324
+ }, " Update ", 10, _hoisted_45)])])),
13426
13325
  shouldTruncate.value && isTextOverflowing.value && index === 0 && !isEditingThisComment.value(comment) ? (openBlock(), createElementBlock("div", {
13427
13326
  key: 3,
13428
13327
  class: "show-more-toggle",
@@ -13437,29 +13336,29 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13437
13336
  shouldCollapseThread.value && index === 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [_cache[14] || (_cache[14] = createElementVNode("div", { class: "comment-separator" }, null, -1)), createElementVNode("div", {
13438
13337
  class: "collapsed-replies",
13439
13338
  onClick: withModifiers(expandThread, ["stop", "prevent"])
13440
- }, [createElementVNode("div", _hoisted_47, [(openBlock(true), createElementBlock(Fragment, null, renderList(collapsedReplyAuthors.value, (author) => {
13339
+ }, [createElementVNode("div", _hoisted_46, [(openBlock(true), createElementBlock(Fragment, null, renderList(collapsedReplyAuthors.value, (author) => {
13441
13340
  return openBlock(), createBlock(Avatar_default, {
13442
- key: author.email || author.name,
13341
+ key: (author.email || author.name) ?? void 0,
13443
13342
  user: author,
13444
13343
  class: "mini-avatar"
13445
13344
  }, null, 8, ["user"]);
13446
13345
  }), 128))]), createElementVNode("span", null, toDisplayString(collapsedReplyCount.value) + " more " + toDisplayString(collapsedReplyCount.value === 1 ? "reply" : "replies"), 1)])], 64)) : createCommentVNode("", true),
13447
- showSeparator.value(index) ? (openBlock(), createElementBlock("div", _hoisted_48)) : createCommentVNode("", true)
13346
+ showSeparator.value(index) ? (openBlock(), createElementBlock("div", _hoisted_47)) : createCommentVNode("", true)
13448
13347
  ]);
13449
13348
  }), 128)),
13450
- trackedChangeDecisionFailure.value ? (openBlock(), createElementBlock("div", _hoisted_49, [createElementVNode("span", _hoisted_50, toDisplayString(trackedChangeDecisionFailureMessage.value), 1), createElementVNode("button", {
13349
+ trackedChangeDecisionFailure.value ? (openBlock(), createElementBlock("div", _hoisted_48, [createElementVNode("span", _hoisted_49, toDisplayString(trackedChangeDecisionFailureMessage.value), 1), createElementVNode("button", {
13451
13350
  type: "button",
13452
13351
  class: "sd-button tracked-change-decision-alert__retry",
13453
13352
  onClick: withModifiers(retryTrackedChangeDecision, ["stop", "prevent"])
13454
13353
  }, " Retry ")])) : createCommentVNode("", true),
13455
- showInputSection.value && !unref(getConfig).readOnly ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [!isReplying.value ? (openBlock(), createElementBlock("button", {
13354
+ showInputSection.value ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [!isReplying.value ? (openBlock(), createElementBlock("button", {
13456
13355
  key: 0,
13457
13356
  type: "button",
13458
13357
  class: normalizeClass(["reply-pill", { "sd-is-disabled": isV2WriteDisabled.value }]),
13459
13358
  onClick: withModifiers(startReply, ["stop", "prevent"]),
13460
13359
  disabled: isV2WriteDisabled.value,
13461
13360
  "data-disabled-reason": isV2WriteDisabled.value ? v2WriteCapability.value?.reason ?? null : null
13462
- }, " Reply or add others with @ ", 10, _hoisted_51)) : (openBlock(), createElementBlock("div", _hoisted_52, [createElementVNode("div", _hoisted_53, [createVNode(CommentInput_default, {
13361
+ }, " Reply or add others with @ ", 10, _hoisted_50)) : (openBlock(), createElementBlock("div", _hoisted_51, [createElementVNode("div", _hoisted_52, [createVNode(CommentInput_default, {
13463
13362
  ref_key: "commentInput",
13464
13363
  ref: commentInput,
13465
13364
  users: usersFiltered.value,
@@ -13470,7 +13369,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13470
13369
  "users",
13471
13370
  "config",
13472
13371
  "comment"
13473
- ])]), createElementVNode("div", _hoisted_54, [createElementVNode("button", {
13372
+ ])]), createElementVNode("div", _hoisted_53, [createElementVNode("button", {
13474
13373
  class: "sd-button reply-btn-cancel",
13475
13374
  onClick: withModifiers(handleCancel, ["stop", "prevent"])
13476
13375
  }, "Cancel"), createElementVNode("button", {
@@ -13478,11 +13377,11 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13478
13377
  onClick: withModifiers(handleAddComment, ["stop", "prevent"]),
13479
13378
  disabled: !hasTextContent.value || isV2WriteDisabled.value || isSubmittingReply.value,
13480
13379
  "data-disabled-reason": v2ReplyDisabledReason.value
13481
- }, " Reply ", 10, _hoisted_55)])]))], 64)) : createCommentVNode("", true)
13380
+ }, " Reply ", 10, _hoisted_54)])]))], 64)) : createCommentVNode("", true)
13482
13381
  ], 64))], 14, _hoisted_1$26)), [[_directive_click_outside, handleClickOutside]]);
13483
13382
  };
13484
13383
  }
13485
- }, [["__scopeId", "data-v-239e0310"]]);
13384
+ }), [["__scopeId", "data-v-752d9e0b"]]);
13486
13385
  //#endregion
13487
13386
  //#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue
13488
13387
  var _hoisted_1$25 = [
@@ -13930,10 +13829,10 @@ var FIT_WIDTH_DEFAULTS = Object.freeze({
13930
13829
  });
13931
13830
  var resolveFitWidthOptions = (rawFitConfig) => {
13932
13831
  const raw = rawFitConfig && typeof rawFitConfig === "object" ? rawFitConfig : {};
13933
- const positiveOr = (value, fallback) => typeof value === "number" && Number.isFinite(value) && value > 0 ? value : fallback;
13832
+ const positiveOr = (value, fallback) => isFiniteNumber(value) && value > 0 ? value : fallback;
13934
13833
  const min = positiveOr(raw.min, FIT_WIDTH_DEFAULTS.min);
13935
13834
  const max = positiveOr(raw.max, FIT_WIDTH_DEFAULTS.max);
13936
- const padding = typeof raw.padding === "number" && Number.isFinite(raw.padding) && raw.padding >= 0 ? raw.padding : FIT_WIDTH_DEFAULTS.padding;
13835
+ const padding = isFiniteNumber(raw.padding) && raw.padding >= 0 ? raw.padding : FIT_WIDTH_DEFAULTS.padding;
13937
13836
  return {
13938
13837
  min: Math.min(min, max),
13939
13838
  max: Math.max(min, max),
@@ -13957,12 +13856,12 @@ var normalizePdfPageMeasurement = (measured, scaleFactor, zoomFactor) => {
13957
13856
  var resolveV2WidestPageWidth = (snapshot) => {
13958
13857
  if (!snapshot || typeof snapshot !== "object") return 0;
13959
13858
  const published = snapshot.widestPageWidthPx;
13960
- if (typeof published === "number" && Number.isFinite(published)) return published;
13859
+ if (isFiniteNumber(published)) return published;
13961
13860
  let widestPage = 0;
13962
13861
  const pages = snapshot.pages;
13963
13862
  if (Array.isArray(pages)) for (const page of pages) {
13964
13863
  const width = page?.base?.widthPx;
13965
- if (typeof width === "number" && Number.isFinite(width) && width > widestPage) widestPage = width;
13864
+ if (isFiniteNumber(width) && width > widestPage) widestPage = width;
13966
13865
  }
13967
13866
  return widestPage;
13968
13867
  };
@@ -13979,7 +13878,7 @@ var resolveEditorPageWidth = (editor) => {
13979
13878
  const pages = editor.getPages?.();
13980
13879
  if (Array.isArray(pages)) for (const page of pages) {
13981
13880
  const width = page?.size?.w;
13982
- if (typeof width === "number" && Number.isFinite(width) && width > widestPage) widestPage = width;
13881
+ if (isFiniteNumber(width) && width > widestPage) widestPage = width;
13983
13882
  }
13984
13883
  } catch {
13985
13884
  widestPage = 0;
@@ -13992,7 +13891,7 @@ var resolveEditorPageWidth = (editor) => {
13992
13891
  pageStyles = null;
13993
13892
  }
13994
13893
  const pageWidthInches = pageStyles?.pageSize?.width;
13995
- if (typeof pageWidthInches === "number" && Number.isFinite(pageWidthInches) && pageWidthInches > 0) return pageWidthInches * CSS_PX_PER_INCH;
13894
+ if (isFiniteNumber(pageWidthInches) && pageWidthInches > 0) return pageWidthInches * CSS_PX_PER_INCH;
13996
13895
  return null;
13997
13896
  };
13998
13897
  /**
@@ -14143,12 +14042,14 @@ function createHighContrastMode() {
14143
14042
  }
14144
14043
  };
14145
14044
  }
14146
- var HIGH_CONTRAST_OFF = {
14147
- isHighContrastMode: readonly(ref(false)),
14148
- setHighContrastMode: () => {}
14149
- };
14045
+ function createHighContrastOff() {
14046
+ return {
14047
+ isHighContrastMode: readonly(ref(false)),
14048
+ setHighContrastMode: () => {}
14049
+ };
14050
+ }
14150
14051
  function useHighContrastMode() {
14151
- return inject$1(HIGH_CONTRAST_MODE_KEY, HIGH_CONTRAST_OFF);
14052
+ return inject$1(HIGH_CONTRAST_MODE_KEY, createHighContrastOff, true);
14152
14053
  }
14153
14054
  //#endregion
14154
14055
  //#region ../layout-engine/contracts/src/author-colors.ts
@@ -14407,7 +14308,7 @@ var resolveRemovedReviewCardContinuityTarget = ({ previousIds, currentIds, remov
14407
14308
  return null;
14408
14309
  };
14409
14310
  //#endregion
14410
- //#region src/components/CommentsLayer/FloatingComments.vue
14311
+ //#region src/components/CommentsLayer/FloatingComments.vue?vue&type=script&setup=true&lang.ts
14411
14312
  var _hoisted_1$23 = [
14412
14313
  "data-comment-id",
14413
14314
  "data-comment-instance-id",
@@ -14416,7 +14317,9 @@ var _hoisted_1$23 = [
14416
14317
  "data-comment-page-index"
14417
14318
  ];
14418
14319
  var _heightsCache = {};
14419
- var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14320
+ //#endregion
14321
+ //#region src/components/CommentsLayer/FloatingComments.vue
14322
+ var FloatingComments_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
14420
14323
  __name: "FloatingComments",
14421
14324
  props: {
14422
14325
  currentDocument: {
@@ -14459,9 +14362,10 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14459
14362
  };
14460
14363
  const props = __props;
14461
14364
  const superdocStore = useSuperdocStore();
14462
- const commentsStore = useCommentsStore();
14365
+ const piniaCommentsStore = useCommentsStore();
14366
+ const commentsStore = piniaCommentsStore;
14463
14367
  const { clearInstantSidebarAlignment } = commentsStore;
14464
- const { activeComment, activeFloatingCommentInstanceId, editorCommentPositions, pendingComment, editingCommentId, instantSidebarAlignmentTargetY, instantSidebarAlignmentThreadId, instantSidebarAlignmentInstanceId } = storeToRefs(commentsStore);
14368
+ const { activeComment, activeFloatingCommentInstanceId, editorCommentPositions, pendingComment, editingCommentId, instantSidebarAlignmentTargetY, instantSidebarAlignmentThreadId, instantSidebarAlignmentInstanceId } = storeToRefs(piniaCommentsStore);
14465
14369
  const { activeZoom } = storeToRefs(superdocStore);
14466
14370
  const committedPresentation = computed$1(() => commentsStore.committedReviewPresentations?.[String(props.currentDocument?.id)] ?? null);
14467
14371
  const committedInstances = computed$1(() => {
@@ -14568,7 +14472,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14568
14472
  return bottom != null ? bottom * zoom : anchorTop;
14569
14473
  }
14570
14474
  const bottom = instance?.positionEntry?.bounds?.bottom;
14571
- return Number.isFinite(bottom) ? bottom : anchorTop;
14475
+ return isFiniteNumber(bottom) ? bottom : anchorTop;
14572
14476
  };
14573
14477
  const geometryBearingInstances = computed$1(() => {
14574
14478
  const positioned = [];
@@ -14576,8 +14480,8 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14576
14480
  const id = instance?.id;
14577
14481
  const threadId = getThreadId(instance?.comment);
14578
14482
  const anchorTop = getAnchorTop(instance);
14579
- if (id == null || threadId == null || !Number.isFinite(anchorTop)) continue;
14580
- const top = normalizeFloatingAnchorTop(anchorTop, instance.comment);
14483
+ if (id == null || threadId == null || !isFiniteNumber(anchorTop)) continue;
14484
+ const top = normalizeFloatingAnchorTop(anchorTop);
14581
14485
  positioned.push({
14582
14486
  id,
14583
14487
  threadId,
@@ -14599,8 +14503,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14599
14503
  return shouldMountFloatingCommentDialog({
14600
14504
  id: position?.id,
14601
14505
  visibleIds: committedPresentation.value ? new Set(allPositions.value.filter((item) => item.instanceRef?.mount).map((item) => item.id)) : visibleIds.value,
14602
- activeCommentInstanceId: activeCommentInstanceId.value,
14603
- comment: position?.commentRef
14506
+ activeCommentInstanceId: activeCommentInstanceId.value
14604
14507
  });
14605
14508
  };
14606
14509
  const getFloatingViewportRange = () => {
@@ -14956,14 +14859,14 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14956
14859
  if (!directDecisionContinuity) return;
14957
14860
  const actionElement = (event?.target instanceof Element ? event.target : null)?.closest?.("[data-comment-action]");
14958
14861
  const action = actionElement?.getAttribute?.("data-comment-action");
14959
- if (!((action === "resolve" || action === "reject") && floatingCommentsContainer.value?.contains?.(actionElement))) releaseDirectDecisionContinuity();
14862
+ if (!((action === "resolve" || action === "reject") && floatingCommentsContainer.value?.contains?.(actionElement ?? null))) releaseDirectDecisionContinuity();
14960
14863
  };
14961
14864
  const clearDeferredRemeasureTimers = () => {
14962
14865
  remeasureTimers.forEach(clearTimeout);
14963
14866
  remeasureTimers = [];
14964
14867
  };
14965
14868
  const remeasureCommentKeys = (keys) => {
14966
- for (const key of keys.filter(Boolean)) {
14869
+ for (const key of keys.filter((candidate) => Boolean(candidate))) {
14967
14870
  const el = placeholderRefs.value[key];
14968
14871
  if (!el) continue;
14969
14872
  const dialog = el.querySelector(".comments-dialog");
@@ -15084,7 +14987,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15084
14987
  removedId: removedKey
15085
14988
  });
15086
14989
  const targetClientY = (targetKey ? placeholderRefs.value[targetKey] : null)?.getBoundingClientRect?.().top;
15087
- if (!targetKey || !Number.isFinite(targetClientY)) {
14990
+ if (!targetKey || !isFiniteNumber(targetClientY)) {
15088
14991
  clearSidebarContinuityAnchor();
15089
14992
  return false;
15090
14993
  }
@@ -15097,9 +15000,9 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15097
15000
  return true;
15098
15001
  };
15099
15002
  const prepareSidebarContinuityForDirectDecision = (event) => {
15100
- const actionElement = event?.target?.closest?.("[data-comment-action]");
15003
+ const actionElement = (event?.target instanceof Element ? event.target : null)?.closest?.("[data-comment-action]");
15101
15004
  const action = actionElement?.getAttribute?.("data-comment-action");
15102
- if (action !== "resolve" && action !== "reject") return;
15005
+ if (!actionElement || action !== "resolve" && action !== "reject") return;
15103
15006
  releaseDirectDecisionContinuity();
15104
15007
  if (actionElement.getAttribute?.("aria-disabled") === "true") return;
15105
15008
  const removedKey = (actionElement.closest?.("[data-comment-id]"))?.getAttribute?.("data-comment-id");
@@ -15115,7 +15018,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15115
15018
  removedId: removedKey
15116
15019
  });
15117
15020
  const targetClientY = (targetKey ? placeholderRefs.value[targetKey] : null)?.getBoundingClientRect?.().top;
15118
- if (!targetKey || !Number.isFinite(targetClientY)) return;
15021
+ if (!targetKey || !isFiniteNumber(targetClientY)) return;
15119
15022
  directDecisionContinuity = {
15120
15023
  removedKey,
15121
15024
  targetKey,
@@ -15175,7 +15078,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15175
15078
  instantAlignmentInstanceKey,
15176
15079
  instantSidebarAlignmentTargetY
15177
15080
  ], ([activeKey, requestKey, targetY]) => {
15178
- if (!activeKey || !requestKey || activeKey !== requestKey || !Number.isFinite(targetY)) return;
15081
+ if (!activeKey || !requestKey || activeKey !== requestKey || !isFiniteNumber(targetY)) return;
15179
15082
  applyInstantSidebarAlignment(activeKey, targetY);
15180
15083
  });
15181
15084
  watch$1(editingCommentId, () => {
@@ -15232,10 +15135,10 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15232
15135
  let prevActiveLayoutTop = null;
15233
15136
  watch$1(allPositions, (positions) => {
15234
15137
  const activePosition = activeCommentInstanceId.value ? positions.find((position) => position.id === activeCommentInstanceId.value) : null;
15235
- const activeAnchorTop = typeof activePosition?.anchorTop === "number" && Number.isFinite(activePosition.anchorTop) ? activePosition.anchorTop : null;
15138
+ const activeAnchorTop = isFiniteNumber(activePosition?.anchorTop) ? activePosition.anchorTop : null;
15236
15139
  const sameActiveInstance = activeCommentInstanceId.value === prevActiveInstanceId;
15237
15140
  const activeAnchorMoved = sameActiveInstance && activeAnchorTop != null && prevActiveAnchorTop != null && Math.abs(activeAnchorTop - prevActiveAnchorTop) > 1;
15238
- const activeLayoutTop = typeof activePosition?.top === "number" && Number.isFinite(activePosition.top) ? activePosition.top : null;
15141
+ const activeLayoutTop = isFiniteNumber(activePosition?.top) ? activePosition.top : null;
15239
15142
  const activeLayoutMoved = sameActiveInstance && activeLayoutTop != null && prevActiveLayoutTop != null && Math.abs(activeLayoutTop - prevActiveLayoutTop) > 1;
15240
15143
  if (activeAnchorMoved && sidebarOffsetY.value !== 0 && !Number.isFinite(instantSidebarAlignmentTargetY.value)) {
15241
15144
  sidebarOffsetY.value = 0;
@@ -15399,8 +15302,8 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15399
15302
  parent: __props.parent,
15400
15303
  comment: pos.commentRef,
15401
15304
  "floating-instance-id": pos.id,
15402
- "floating-page-index": pos.pageIndex,
15403
- "floating-position-entry": pos.instanceRef?.positionEntry ?? null,
15305
+ "floating-page-index": pos.pageIndex ?? void 0,
15306
+ "floating-position-entry": pos.instanceRef?.positionEntry ?? void 0,
15404
15307
  "is-floating-instance-active": pos.id === activeCommentInstanceId.value
15405
15308
  }, null, 8, [
15406
15309
  "onResize",
@@ -15414,7 +15317,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15414
15317
  }), 128))], 4)], 36);
15415
15318
  };
15416
15319
  }
15417
- }, [["__scopeId", "data-v-145f83db"]]);
15320
+ }), [["__scopeId", "data-v-e74251e0"]]);
15418
15321
  //#endregion
15419
15322
  //#region src/components/CommentsLayer/PdfCommentsLayer.vue
15420
15323
  var _hoisted_1$22 = {
@@ -15939,18 +15842,6 @@ var collectRemovedCommentIds = (comments, targetIds, isInScope = () => true) =>
15939
15842
  }
15940
15843
  return removedIds;
15941
15844
  };
15942
- //#endregion
15943
- //#region src/composables/use-superdoc-instance.ts
15944
- function useSuperDocInstance() {
15945
- const instance = getCurrentInstance();
15946
- if (!instance?.proxy) throw new Error("useSuperDocInstance() must be called during a component setup function.");
15947
- const superdoc = instance.appContext.config.globalProperties.$superdoc;
15948
- if (!superdoc) throw new Error("useSuperDocInstance() found no SuperDoc registered at app.config.globalProperties.$superdoc.");
15949
- return {
15950
- proxy: instance.proxy,
15951
- superdoc
15952
- };
15953
- }
15954
15845
  var VALID_COMMENTS_LAYOUTS = /* @__PURE__ */ new Set([
15955
15846
  "auto",
15956
15847
  "sidebar",
@@ -15989,13 +15880,13 @@ function normalizeCommentsUiConfig(commentsConfig) {
15989
15880
  if (deprecatedTarget === void 0) delete normalized.compactMeasurementSelector;
15990
15881
  else normalized.compactMeasurementSelector = deprecatedTarget;
15991
15882
  const deprecatedBreakpoint = commentsConfig.compactBreakpointPx;
15992
- if (!(typeof deprecatedBreakpoint === "number" && Number.isFinite(deprecatedBreakpoint) && deprecatedBreakpoint >= 0)) delete normalized.compactBreakpointPx;
15883
+ if (!(isFiniteNumber(deprecatedBreakpoint) && deprecatedBreakpoint >= 0)) delete normalized.compactBreakpointPx;
15993
15884
  delete normalized.layout;
15994
15885
  delete normalized.responsive;
15995
15886
  if (isCommentsLayout(layout)) normalized.layout = layout;
15996
15887
  const normalizedResponsive = {};
15997
15888
  if (target !== void 0) normalizedResponsive.target = target;
15998
- if (typeof breakpoint === "number" && Number.isFinite(breakpoint) && breakpoint >= 0) normalizedResponsive.breakpoint = breakpoint;
15889
+ if (isFiniteNumber(breakpoint) && breakpoint >= 0) normalizedResponsive.breakpoint = breakpoint;
15999
15890
  if (Object.keys(normalizedResponsive).length > 0) normalized.responsive = normalizedResponsive;
16000
15891
  return normalized;
16001
15892
  }
@@ -16003,7 +15894,7 @@ function normalizeCommentsUiConfig(commentsConfig) {
16003
15894
  //#region src/composables/use-comment-small-screen.js
16004
15895
  var SUPERDOC_DOCUMENT_SELECTOR = ".superdoc__document";
16005
15896
  var isValidCompactBreakpoint = (value) => {
16006
- return typeof value === "number" && Number.isFinite(value) && value >= 0;
15897
+ return isFiniteNumber(value) && value >= 0;
16007
15898
  };
16008
15899
  var getRequiredSidebarWidth = (documentWidth) => {
16009
15900
  return documentWidth + 320 + 24;
@@ -16150,7 +16041,6 @@ var COMMENT_HIGHLIGHT_DATA_ATTR = "data-comment-ids";
16150
16041
  var PDF_COMMENT_ANCHOR_SELECTOR = ".sd-comment-anchor";
16151
16042
  var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
16152
16043
  var toNumber = (value) => Number(value);
16153
- var isFiniteNumber = (value) => Number.isFinite(value);
16154
16044
  var getCommentAnchorId = (comment) => comment?.commentId ?? comment?.importedId ?? null;
16155
16045
  var parseCommentIds = (value) => String(value || "").split(",").map((s) => s.trim()).filter(Boolean);
16156
16046
  var resolveInteractionAnchor = (lastClickAnchor) => {
@@ -17979,7 +17869,7 @@ var toolbarIcons = {
17979
17869
  formattingMarks: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><text x=\"12\" y=\"18\" text-anchor=\"middle\" font-family=\"Arial, Helvetica, sans-serif\" font-size=\"20\" font-weight=\"700\" fill=\"currentColor\">¶</text></svg>\n"
17980
17870
  };
17981
17871
  //#endregion
17982
- //#region src/internal/toolbar/built-in/LinkInput.vue
17872
+ //#region src/internal/toolbar/built-in/LinkInput.vue?vue&type=script&setup=true&lang.ts
17983
17873
  var _hoisted_1$20 = {
17984
17874
  key: 0,
17985
17875
  class: "link-title"
@@ -18027,7 +17917,9 @@ var _hoisted_18$1 = {
18027
17917
  role: "status",
18028
17918
  class: "sd-error"
18029
17919
  };
18030
- var LinkInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
17920
+ //#endregion
17921
+ //#region src/internal/toolbar/built-in/LinkInput.vue
17922
+ var LinkInput_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
18031
17923
  __name: "LinkInput",
18032
17924
  props: {
18033
17925
  showInput: {
@@ -18178,7 +18070,7 @@ var LinkInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
18178
18070
  commandError.value = "";
18179
18071
  try {
18180
18072
  const result = await runLinkCommand(payload);
18181
- if (result === false || result == null || typeof result === "object" && (result.success === false || result.status === "rejected")) {
18073
+ if (result === false || result == null || typeof result === "object" && result.success === false) {
18182
18074
  commandError.value = "Could not apply link. Check the selection and try again.";
18183
18075
  return;
18184
18076
  }
@@ -18288,7 +18180,7 @@ var LinkInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
18288
18180
  ], 2);
18289
18181
  };
18290
18182
  }
18291
- }, [["__scopeId", "data-v-360db842"]]);
18183
+ }), [["__scopeId", "data-v-172107e4"]]);
18292
18184
  //#endregion
18293
18185
  //#region src/internal/toolbar/built-in/scroll-helpers.js
18294
18186
  function getScrollableParent(element) {
@@ -20205,7 +20097,7 @@ function translateExportDiagnostic(error, ctx = {}) {
20205
20097
  * event only fires on success, fires AFTER the diagnostics events on the
20206
20098
  * success path, and never fires at all for a failed attempt.
20207
20099
  *
20208
- * @param {{generation?: unknown}} [payload]
20100
+ * @param {{generation?: unknown} | null} [payload]
20209
20101
  * @returns {number}
20210
20102
  */
20211
20103
  function getV2DiagnosticGeneration(payload) {
@@ -20277,7 +20169,9 @@ function createV2DiagnosticDedupe() {
20277
20169
  function isBootDiagnosticRedundant(bootDiagnostic, reason, translatedRecords) {
20278
20170
  return Boolean(bootDiagnostic) && bootDiagnostic.internalCode === reason && translatedRecords.length > 0;
20279
20171
  }
20280
- var SurfaceExternalMount_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20172
+ //#endregion
20173
+ //#region src/components/surfaces/SurfaceExternalMount.vue
20174
+ var SurfaceExternalMount_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
20281
20175
  __name: "SurfaceExternalMount",
20282
20176
  props: {
20283
20177
  surfaceId: {
@@ -20339,7 +20233,7 @@ var SurfaceExternalMount_default = /*#__PURE__*/ _plugin_vue_export_helper_defau
20339
20233
  }, null, 512);
20340
20234
  };
20341
20235
  }
20342
- }, [["__scopeId", "data-v-b2412c5d"]]);
20236
+ }), [["__scopeId", "data-v-d1081bc8"]]);
20343
20237
  //#endregion
20344
20238
  //#region src/components/surfaces/focusable-selector.js
20345
20239
  /**
@@ -20355,11 +20249,13 @@ var FOCUSABLE_SELECTOR = [
20355
20249
  "[tabindex]:not([tabindex=\"-1\"])"
20356
20250
  ].join(", ");
20357
20251
  //#endregion
20358
- //#region src/components/surfaces/SurfaceDialog.vue
20252
+ //#region src/components/surfaces/SurfaceDialog.vue?vue&type=script&setup=true&lang.ts
20359
20253
  var _hoisted_1$19 = ["aria-labelledby", "aria-label"];
20360
20254
  var _hoisted_2$15 = ["id"];
20361
20255
  var _hoisted_3$13 = { class: "sd-surface-dialog__content" };
20362
- var SurfaceDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20256
+ //#endregion
20257
+ //#region src/components/surfaces/SurfaceDialog.vue
20258
+ var SurfaceDialog_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
20363
20259
  __name: "SurfaceDialog",
20364
20260
  props: {
20365
20261
  surface: {
@@ -20406,7 +20302,7 @@ var SurfaceDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20406
20302
  if (props.scrollLockTarget) scrollLockTarget = props.scrollLockTarget;
20407
20303
  else {
20408
20304
  const superdocRoot = dialogRef.value?.closest(".superdoc");
20409
- scrollLockTarget = superdocRoot?.querySelector(".superdoc__layers") ?? superdocRoot;
20305
+ scrollLockTarget = superdocRoot?.querySelector(".superdoc__layers") ?? superdocRoot ?? null;
20410
20306
  }
20411
20307
  if (!scrollLockTarget) return;
20412
20308
  originalOverflow = scrollLockTarget.style.overflow;
@@ -20507,7 +20403,7 @@ var SurfaceDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20507
20403
  ])) : __props.surface.component ? (openBlock(), createBlock(resolveDynamicComponent(__props.surface.component), normalizeProps(mergeProps({ key: 1 }, mergedComponentProps.value)), null, 16)) : createCommentVNode("", true)])], 12, _hoisted_1$19)], 32);
20508
20404
  };
20509
20405
  }
20510
- }, [["__scopeId", "data-v-5cee3b11"]]);
20406
+ }), [["__scopeId", "data-v-6ce23dd7"]]);
20511
20407
  //#endregion
20512
20408
  //#region src/components/surfaces/SurfaceFloating.vue
20513
20409
  var _hoisted_1$18 = ["aria-labelledby", "aria-label"];
@@ -20885,7 +20781,7 @@ var SurfaceHost_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20885
20781
  }
20886
20782
  }, [["__scopeId", "data-v-dad99b67"]]);
20887
20783
  //#endregion
20888
- //#region src/SuperDoc.vue
20784
+ //#region src/SuperDoc.vue?vue&type=script&setup=true&lang.ts
20889
20785
  var _hoisted_1$17 = ["data-superdoc-ui-owner"];
20890
20786
  var _hoisted_2$13 = ["innerHTML"];
20891
20787
  var _hoisted_3$11 = { class: "superdoc__document document" };
@@ -20893,11 +20789,13 @@ var _hoisted_4$9 = { class: "floating-comments" };
20893
20789
  var TRACKED_CHANGE_CARRIERS_RESTAMPED_EVENT = "superdoc:v2-tracked-change-carriers-restamped";
20894
20790
  var UNAVAILABLE_COMMAND_RESULT = false;
20895
20791
  var V2_SELECTION_TOOLBAR_SYNC_RETRY_FRAMES = 3;
20896
- var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20792
+ //#endregion
20793
+ //#region src/SuperDoc.vue
20794
+ var SuperDoc_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
20897
20795
  __name: "SuperDoc",
20898
20796
  emits: ["selection-update"],
20899
20797
  setup(__props, { emit: __emit }) {
20900
- const PdfViewer = defineAsyncComponent(() => import("./chunks/PdfViewer-JHXZQZ9x.es.js"));
20798
+ const PdfViewer = defineAsyncComponent(() => import("./chunks/PdfViewer-D4lVeOJu.es.js"));
20901
20799
  const getDocumentLoadPassword = (doc) => doc.password ?? proxy.$superdoc.config.password;
20902
20800
  const resolveDocumentV2Collaboration = (doc) => {
20903
20801
  const rawConfig = doc?.v2Collaboration;
@@ -21159,7 +21057,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21159
21057
  if (typeof bindSessionShortcuts !== "function") return;
21160
21058
  const unbind = bindSessionShortcuts({
21161
21059
  routes: createV2SessionShortcutRoutes({
21162
- resolveToolbarElement: () => proxy.$superdoc?.toolbar?.toolbarContainer ?? null,
21060
+ resolveToolbarElement: () => (proxy.$superdoc?.toolbar)?.toolbarContainer ?? null,
21163
21061
  getDocumentApi: () => documentApi ?? null,
21164
21062
  ...firstPartyCommandMutation ? { runReferenceMutation: (memberPath, input) => firstPartyCommandMutation.run(memberPath, [input]) } : {},
21165
21063
  pageNumberCommand: {
@@ -21194,7 +21092,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21194
21092
  if (document && provider?.sendStateless) document.provider = null;
21195
21093
  const entry = v2Runtimes.get(documentId);
21196
21094
  if (!entry) return;
21197
- proxy.$superdoc.unregisterEditorRuntime(entry.runtimeId);
21095
+ proxy.$superdoc["unregisterEditorRuntime"](entry.runtimeId);
21198
21096
  v2Runtimes.delete(documentId);
21199
21097
  const hostRoot = subDocumentRoots.get(documentId);
21200
21098
  if (hostRoot) unmarkRuntimeRoot(hostRoot);
@@ -21214,7 +21112,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21214
21112
  host,
21215
21113
  getLegacyEditorProjection: () => facade,
21216
21114
  onUnregister: (id) => {
21217
- proxy.$superdoc.unregisterEditorRuntime(id);
21115
+ proxy.$superdoc["unregisterEditorRuntime"](id);
21218
21116
  const current = v2Runtimes.get(documentId);
21219
21117
  if (current && current.runtimeId === id) v2Runtimes.delete(documentId);
21220
21118
  const hostRoot = subDocumentRoots.get(documentId);
@@ -21223,12 +21121,12 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21223
21121
  });
21224
21122
  adapter.attachMountHandle(mount ?? null);
21225
21123
  markRuntimeRoot(root, runtimeId);
21226
- proxy.$superdoc.registerEditorRuntime(adapter.runtime);
21124
+ proxy.$superdoc["registerEditorRuntime"](adapter.runtime);
21227
21125
  v2Runtimes.set(documentId, {
21228
21126
  runtimeId,
21229
21127
  adapter
21230
21128
  });
21231
- proxy.$superdoc.setActiveRuntime(runtimeId, "v2-editor-ready");
21129
+ proxy.$superdoc["setActiveRuntime"](runtimeId, "v2-editor-ready");
21232
21130
  return true;
21233
21131
  };
21234
21132
  const v2ReviewWindowController = resolvedEditorIntegration.createReviewWindowController({ applyReviewWindow: (ctx, result) => commentsStore.applyReviewWindowFromV2?.({
@@ -21754,7 +21652,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21754
21652
  if (!isV2Mode.value) return;
21755
21653
  let handles = null;
21756
21654
  try {
21757
- handles = proxy.$superdoc?.activeEditor?.host?.getHandles?.() ?? null;
21655
+ handles = (proxy.$superdoc?.activeEditor)?.host?.getHandles?.() ?? null;
21758
21656
  } catch {
21759
21657
  handles = null;
21760
21658
  }
@@ -21833,7 +21731,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21833
21731
  syncV2SelectionToolbarState();
21834
21732
  };
21835
21733
  const getActiveV2MountContainer = () => {
21836
- return v2GeometryRender.value?.mountContainer ?? proxy.$superdoc?.activeEditor?.mount?.container ?? null;
21734
+ return v2GeometryRender.value?.mountContainer ?? (proxy.$superdoc?.activeEditor)?.mount?.container ?? null;
21837
21735
  };
21838
21736
  const escapeCssIdent = (value) => {
21839
21737
  const raw = String(value);
@@ -22344,7 +22242,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
22344
22242
  }
22345
22243
  };
22346
22244
  const activateRuntimeFromEvent = (event, reason) => {
22347
- proxy.$superdoc?.activateRuntimeFromEventTarget?.(event.target, reason);
22245
+ proxy.$superdoc?.["activateRuntimeFromEventTarget"]?.(event.target, reason);
22348
22246
  };
22349
22247
  const handleRuntimeFocusIn = (event) => activateRuntimeFromEvent(event, "focusin");
22350
22248
  const handleRuntimePointerDown = (event) => activateRuntimeFromEvent(event, "pointerdown");
@@ -22752,8 +22650,8 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
22752
22650
  if (!isCommentsEnabled.value) return false;
22753
22651
  return !getConfig.value?.readOnly && selectionPosition.value;
22754
22652
  });
22755
- watch$1(showCommentsSidebar, (value) => {
22756
- proxy.$superdoc.broadcastSidebarToggle(value);
22653
+ watch$1(() => Boolean(showCommentsSidebar.value), (isOpened) => {
22654
+ proxy.$superdoc.broadcastSidebarToggle(isOpened);
22757
22655
  });
22758
22656
  useViewportFit({
22759
22657
  getSuperdoc: () => proxy.$superdoc,
@@ -22834,7 +22732,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
22834
22732
  const activeElement = document.activeElement;
22835
22733
  if (!(activeElement instanceof Node)) return false;
22836
22734
  if (root?.contains(activeElement)) return true;
22837
- const activeEditorDom = proxy.$superdoc?.activeEditor?.view?.dom;
22735
+ const activeEditorDom = (proxy.$superdoc?.activeEditor?.view)?.dom;
22838
22736
  return activeEditorDom instanceof Node && (activeElement === activeEditorDom || activeEditorDom.contains?.(activeElement));
22839
22737
  }
22840
22738
  /**
@@ -23027,16 +22925,18 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
23027
22925
  resetSelection();
23028
22926
  selectionLayer.value.style.pointerEvents = "auto";
23029
22927
  nextTick(() => {
22928
+ const layer = selectionLayer.value;
22929
+ if (!layer) return;
23030
22930
  isDragging.value = true;
23031
- selectionLayer.value.style.pointerEvents = "none";
22931
+ layer.style.pointerEvents = "none";
23032
22932
  const pageNumber = getPdfPageNumberFromEvent(e);
23033
- selectionLayer.value.style.pointerEvents = "auto";
22933
+ layer.style.pointerEvents = "auto";
23034
22934
  if (!pageNumber) {
23035
22935
  isDragging.value = false;
23036
- selectionLayer.value.style.pointerEvents = "none";
22936
+ layer.style.pointerEvents = "none";
23037
22937
  return;
23038
22938
  }
23039
- const layerBounds = selectionLayer.value.getBoundingClientRect();
22939
+ const layerBounds = layer.getBoundingClientRect();
23040
22940
  const zoom = activeZoom.value / 100;
23041
22941
  const x = (e.clientX - layerBounds.left) / zoom;
23042
22942
  const y = (e.clientY - layerBounds.top) / zoom;
@@ -23046,7 +22946,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
23046
22946
  page: pageNumber,
23047
22947
  source: "pdf"
23048
22948
  });
23049
- selectionLayer.value.addEventListener("mousemove", handleDragMove);
22949
+ layer.addEventListener("mousemove", handleDragMove);
23050
22950
  });
23051
22951
  };
23052
22952
  const handleDragMove = (e) => {
@@ -23121,7 +23021,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
23121
23021
  if (typeof container === "string") return (typeof document !== "undefined" ? document : globalThis.document)?.querySelector(container) ?? null;
23122
23022
  return typeof HTMLElement !== "undefined" && container instanceof HTMLElement ? container : null;
23123
23023
  };
23124
- const getActiveV2DocumentId = () => proxy.$superdoc?.activeEditor?.documentId ?? proxy.$superdoc?.activeEditor?.options?.documentId ?? null;
23024
+ const getActiveV2DocumentId = () => (proxy.$superdoc?.activeEditor)?.documentId ?? proxy.$superdoc?.activeEditor?.options?.documentId ?? null;
23125
23025
  const resolveV2RulerAlignmentContainer = () => {
23126
23026
  if (resolvedRulerContainer.value) return resolveV2RulerContainer();
23127
23027
  const activeDocumentId = getActiveV2DocumentId();
@@ -23512,7 +23412,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
23512
23412
  ], 46, _hoisted_1$17);
23513
23413
  };
23514
23414
  }
23515
- }, [["__scopeId", "data-v-ba00d895"]]);
23415
+ }), [["__scopeId", "data-v-da95e5c5"]]);
23516
23416
  //#endregion
23517
23417
  //#region src/core/create-app.js
23518
23418
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
@@ -26913,10 +26813,12 @@ var throttle = (func, wait, options) => {
26913
26813
  return throttled;
26914
26814
  };
26915
26815
  //#endregion
26916
- //#region src/internal/toolbar/built-in/ToolbarButtonIcon.vue
26816
+ //#region src/internal/toolbar/built-in/ToolbarButtonIcon.vue?vue&type=script&setup=true&lang.ts
26917
26817
  var _hoisted_1$16 = { class: "sd-toolbar-icon" };
26918
26818
  var _hoisted_2$12 = ["innerHTML"];
26919
- var ToolbarButtonIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
26819
+ //#endregion
26820
+ //#region src/internal/toolbar/built-in/ToolbarButtonIcon.vue
26821
+ var ToolbarButtonIcon_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
26920
26822
  __name: "ToolbarButtonIcon",
26921
26823
  props: {
26922
26824
  name: {
@@ -26952,9 +26854,9 @@ var ToolbarButtonIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
26952
26854
  }, null, 4)) : createCommentVNode("", true)]);
26953
26855
  };
26954
26856
  }
26955
- }, [["__scopeId", "data-v-65ecd5b1"]]);
26857
+ }), [["__scopeId", "data-v-e72eee56"]]);
26956
26858
  //#endregion
26957
- //#region src/internal/toolbar/built-in/ToolbarButton.vue
26859
+ //#region src/internal/toolbar/built-in/ToolbarButton.vue?vue&type=script&setup=true&lang.ts
26958
26860
  var _hoisted_1$15 = [
26959
26861
  "role",
26960
26862
  "aria-label",
@@ -26981,7 +26883,9 @@ var _hoisted_11$1 = {
26981
26883
  "aria-live": "polite",
26982
26884
  class: "sd-visually-hidden"
26983
26885
  };
26984
- var ToolbarButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
26886
+ //#endregion
26887
+ //#region src/internal/toolbar/built-in/ToolbarButton.vue
26888
+ var ToolbarButton_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
26985
26889
  __name: "ToolbarButton",
26986
26890
  props: {
26987
26891
  iconColor: {
@@ -27024,9 +26928,9 @@ var ToolbarButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27024
26928
  ],
27025
26929
  setup(__props, { emit: __emit }) {
27026
26930
  const emit = __emit;
27027
- const { proxy } = getCurrentInstance();
26931
+ const proxy = getCurrentInstance()?.proxy;
27028
26932
  const props = __props;
27029
- const { name, active, icon, label, hideLabel, iconColor, hasCaret, splitButton, disabled, expand, inlineTextInputVisible, hasInlineTextInput, minWidth, style, attributes } = props.toolbarItem;
26933
+ const { name, active, icon, label, hideLabel, iconColor, hasCaret, splitButton, disabled, expand, inlineTextInputVisible, hasInlineTextInput, style, attributes } = props.toolbarItem;
27030
26934
  const isSplit = computed$1(() => Boolean(splitButton?.value) && Boolean(hasCaret?.value));
27031
26935
  const itemName = computed$1(() => name?.value ?? "");
27032
26936
  const inlineTextInput = ref("");
@@ -27138,17 +27042,13 @@ var ToolbarButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27138
27042
  }
27139
27043
  if (itemName.value === "fontSize") nextTick(focusEditorSurface);
27140
27044
  };
27141
- const getStyle = computed$1(() => {
27142
- if (style.value) return style.value;
27143
- return { minWidth: props.minWidth };
27144
- });
27145
27045
  const caretIcon = computed$1(() => {
27146
27046
  return expand?.value ? toolbarIcons.dropdownCaretUp : toolbarIcons.dropdownCaretDown;
27147
27047
  });
27148
27048
  return (_ctx, _cache) => {
27149
27049
  return openBlock(), createElementBlock("div", {
27150
27050
  class: normalizeClass(["sd-toolbar-item", unref(attributes).className]),
27151
- style: normalizeStyle(getStyle.value),
27051
+ style: normalizeStyle(unref(style)),
27152
27052
  role: __props.isOverflowItem ? "menuitem" : "button",
27153
27053
  "aria-label": unref(attributes).ariaLabel,
27154
27054
  "aria-disabled": unref(disabled) ? "true" : void 0,
@@ -27252,7 +27152,7 @@ var ToolbarButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27252
27152
  ], 10, _hoisted_2$11)], 46, _hoisted_1$15);
27253
27153
  };
27254
27154
  }
27255
- }, [["__scopeId", "data-v-96796456"]]);
27155
+ }), [["__scopeId", "data-v-40889353"]]);
27256
27156
  //#endregion
27257
27157
  //#region src/internal/toolbar/built-in/ToolbarSeparator.vue
27258
27158
  var _hoisted_1$14 = {
@@ -27282,7 +27182,7 @@ var ToolbarSeparator_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27282
27182
  }
27283
27183
  }, [["__scopeId", "data-v-cb82253a"]]);
27284
27184
  //#endregion
27285
- //#region src/internal/toolbar/built-in/ToolbarDropdown.vue
27185
+ //#region src/internal/toolbar/built-in/ToolbarDropdown.vue?vue&type=script&setup=true&lang.ts
27286
27186
  var _hoisted_1$13 = { class: "toolbar-dropdown" };
27287
27187
  var _hoisted_2$10 = ["data-superdoc-ui-owner"];
27288
27188
  var _hoisted_3$9 = ["onClick"];
@@ -27292,7 +27192,9 @@ var _hoisted_4$7 = {
27292
27192
  };
27293
27193
  var _hoisted_5$5 = { class: "toolbar-dropdown-option__label" };
27294
27194
  var TRIGGER_FOCUS_SELECTOR = "button, [href], input, select, textarea, [role=\"button\"], [tabindex]:not([tabindex=\"-1\"])";
27295
- var ToolbarDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27195
+ //#endregion
27196
+ //#region src/internal/toolbar/built-in/ToolbarDropdown.vue
27197
+ var ToolbarDropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
27296
27198
  __name: "ToolbarDropdown",
27297
27199
  props: {
27298
27200
  options: {
@@ -27449,7 +27351,7 @@ var ToolbarDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27449
27351
  if (!value) return false;
27450
27352
  if (typeof value === "string") return value.split(/\s+/).includes("sd-selected");
27451
27353
  if (Array.isArray(value)) return value.some(classHasSelected);
27452
- if (typeof value === "object") return Boolean(value["sd-selected"]);
27354
+ if (typeof value === "object") return "sd-selected" in value && Boolean(value["sd-selected"]);
27453
27355
  return false;
27454
27356
  };
27455
27357
  const isOptionSelected = (option) => {
@@ -27681,7 +27583,7 @@ var ToolbarDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27681
27583
  })], 8, ["to"]))]);
27682
27584
  };
27683
27585
  }
27684
- }, [["__scopeId", "data-v-e6f71d76"]]);
27586
+ }), [["__scopeId", "data-v-50758732"]]);
27685
27587
  //#endregion
27686
27588
  //#region src/internal/toolbar/built-in/toolbar-focus-helpers.js
27687
27589
  var preventEditorFocusTransfer = (event) => {
@@ -27902,7 +27804,7 @@ var normalizeCustomFontSize = (value) => {
27902
27804
  return String(Math.min(halfPoint, MAX_FONT_SIZE));
27903
27805
  };
27904
27806
  //#endregion
27905
- //#region src/internal/toolbar/built-in/ToolbarComboBox.vue
27807
+ //#region src/internal/toolbar/built-in/ToolbarComboBox.vue?vue&type=script&setup=true&lang.ts
27906
27808
  var _hoisted_1$12 = ["data-item"];
27907
27809
  var _hoisted_2$9 = [
27908
27810
  "id",
@@ -27937,7 +27839,9 @@ var _hoisted_8$1 = {
27937
27839
  class: "sd-button-label sd-font-combobox__legacy-label",
27938
27840
  "aria-hidden": "true"
27939
27841
  };
27940
- var ToolbarComboBox_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27842
+ //#endregion
27843
+ //#region src/internal/toolbar/built-in/ToolbarComboBox.vue
27844
+ var ToolbarComboBox_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
27941
27845
  __name: "ToolbarComboBox",
27942
27846
  props: {
27943
27847
  item: {
@@ -28423,10 +28327,10 @@ var ToolbarComboBox_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
28423
28327
  ], 14, _hoisted_1$12);
28424
28328
  };
28425
28329
  }
28426
- }, [["__scopeId", "data-v-eb442535"]]);
28330
+ }), [["__scopeId", "data-v-e9143b7e"]]);
28427
28331
  //#endregion
28428
28332
  //#region src/internal/toolbar/built-in/FontFamilyCombobox.vue
28429
- var _sfc_main$14 = {
28333
+ var _sfc_main$11 = {
28430
28334
  __name: "FontFamilyCombobox",
28431
28335
  props: {
28432
28336
  item: {
@@ -28467,7 +28371,7 @@ var _sfc_main$14 = {
28467
28371
  };
28468
28372
  //#endregion
28469
28373
  //#region src/internal/toolbar/built-in/FontSizeCombobox.vue
28470
- var _sfc_main$13 = {
28374
+ var _sfc_main$10 = {
28471
28375
  __name: "FontSizeCombobox",
28472
28376
  props: {
28473
28377
  item: {
@@ -28507,9 +28411,12 @@ var _sfc_main$13 = {
28507
28411
  }
28508
28412
  };
28509
28413
  //#endregion
28510
- //#region src/internal/toolbar/built-in/SdTooltip.vue
28414
+ //#region src/internal/toolbar/built-in/SdTooltip.vue?vue&type=script&setup=true&lang.ts
28511
28415
  var AUTO_HIDE_DELAY = 2500;
28512
- var SdTooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
28416
+ //#endregion
28417
+ //#region src/internal/toolbar/built-in/SdTooltip.vue
28418
+ var SdTooltip_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
28419
+ inheritAttrs: false,
28513
28420
  __name: "SdTooltip",
28514
28421
  props: {
28515
28422
  trigger: {
@@ -28723,7 +28630,7 @@ var SdTooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
28723
28630
  }, 8, ["css"])]))], 64);
28724
28631
  };
28725
28632
  }
28726
- }), [["__scopeId", "data-v-71c6de4c"]]);
28633
+ }), [["__scopeId", "data-v-dfd6f1d1"]]);
28727
28634
  //#endregion
28728
28635
  //#region src/internal/toolbar/built-in/ButtonGroup.vue
28729
28636
  var _hoisted_1$11 = [
@@ -29111,7 +29018,7 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29111
29018
  disabled: !item.tooltip?.value,
29112
29019
  "content-style": { fontFamily: props.uiFontFamily }
29113
29020
  }, {
29114
- trigger: withCtx(() => [createVNode(_sfc_main$14, {
29021
+ trigger: withCtx(() => [createVNode(_sfc_main$11, {
29115
29022
  item,
29116
29023
  "ui-font-family": props.uiFontFamily,
29117
29024
  class: "sd-toolbar-button sd-editor-toolbar-dropdown",
@@ -29128,7 +29035,7 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29128
29035
  disabled: !item.tooltip?.value,
29129
29036
  "content-style": { fontFamily: props.uiFontFamily }
29130
29037
  }, {
29131
- trigger: withCtx(() => [createVNode(_sfc_main$13, {
29038
+ trigger: withCtx(() => [createVNode(_sfc_main$10, {
29132
29039
  item,
29133
29040
  "ui-font-family": props.uiFontFamily,
29134
29041
  class: "sd-toolbar-button sd-editor-toolbar-dropdown",
@@ -29633,7 +29540,6 @@ var useToolbarItem = (options) => {
29633
29540
  const style = ref(options.style);
29634
29541
  const isNarrow = ref(options.isNarrow);
29635
29542
  const isWide = ref(options.isWide);
29636
- const minWidth = ref(options.minWidth);
29637
29543
  const layoutWidth = ref(options.layoutWidth);
29638
29544
  const suppressActiveHighlight = ref(options.suppressActiveHighlight || false);
29639
29545
  const argument = ref(options.argument);
@@ -29710,7 +29616,6 @@ var useToolbarItem = (options) => {
29710
29616
  style,
29711
29617
  isNarrow,
29712
29618
  isWide,
29713
- minWidth,
29714
29619
  layoutWidth,
29715
29620
  argument,
29716
29621
  parentItem,
@@ -30071,7 +29976,7 @@ var DocumentMode_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30071
29976
  }
30072
29977
  }, [["__scopeId", "data-v-bee14d7a"]]);
30073
29978
  //#endregion
30074
- //#region src/internal/toolbar/built-in/LinkedStyle.vue
29979
+ //#region src/internal/toolbar/built-in/LinkedStyle.vue?vue&type=script&setup=true&lang.ts
30075
29980
  var _hoisted_1$6 = {
30076
29981
  class: "linked-style-buttons",
30077
29982
  "data-editor-ui-surface": ""
@@ -30087,7 +29992,9 @@ var _hoisted_3$5 = [
30087
29992
  "onClick"
30088
29993
  ];
30089
29994
  var _hoisted_4$3 = ["innerHTML"];
30090
- var LinkedStyle_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29995
+ //#endregion
29996
+ //#region src/internal/toolbar/built-in/LinkedStyle.vue
29997
+ var LinkedStyle_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30091
29998
  __name: "LinkedStyle",
30092
29999
  props: {
30093
30000
  styles: {
@@ -30188,7 +30095,7 @@ var LinkedStyle_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30188
30095
  }), 128))]);
30189
30096
  };
30190
30097
  }
30191
- }, [["__scopeId", "data-v-b5a32523"]]);
30098
+ }), [["__scopeId", "data-v-4e36f956"]]);
30192
30099
  //#endregion
30193
30100
  //#region src/internal/toolbar/built-in/AIWriter.vue
30194
30101
  var _hoisted_1$5 = ["placeholder"];
@@ -30828,7 +30735,7 @@ var TableActions_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30828
30735
  }
30829
30736
  }, [["__scopeId", "data-v-72123aae"]]);
30830
30737
  //#endregion
30831
- //#region src/internal/toolbar/built-in/PageNumberMenu.vue
30738
+ //#region src/internal/toolbar/built-in/PageNumberMenu.vue?vue&type=script&setup=true&lang.ts
30832
30739
  var _hoisted_1 = ["aria-busy"];
30833
30740
  var _hoisted_2 = ["aria-disabled"];
30834
30741
  var _hoisted_3 = {
@@ -30876,7 +30783,9 @@ var _hoisted_20 = ["disabled"];
30876
30783
  var _hoisted_21 = ["disabled"];
30877
30784
  var _hoisted_22 = ["disabled"];
30878
30785
  var _hoisted_23 = { class: "sd-page-number-menu__cursor-text" };
30879
- var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30786
+ //#endregion
30787
+ //#region src/internal/toolbar/built-in/PageNumberMenu.vue
30788
+ var PageNumberMenu_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30880
30789
  __name: "PageNumberMenu",
30881
30790
  props: {
30882
30791
  /** Command state of `page-numbers-apply`, read when the popover opens. */
@@ -31005,7 +30914,7 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31005
30914
  const { isHighContrastMode } = useHighContrastMode();
31006
30915
  const remembered = props.initialChoice ?? {};
31007
30916
  const position = ref(remembered.position === "top" ? "top" : "bottom");
31008
- const alignment = ref(ALIGNMENTS.some((entry) => entry.value === remembered.alignment) ? remembered.alignment : "right");
30917
+ const alignment = ref(isAlignment(remembered.alignment) ? remembered.alignment : "right");
31009
30918
  const showOnFirstPage = ref(remembered.showOnFirstPage !== false);
31010
30919
  const format = ref("decimal");
31011
30920
  const restart = ref(false);
@@ -31040,6 +30949,9 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31040
30949
  const platform = typeof navigator === "undefined" ? "" : navigator.platform || navigator.userAgent || "";
31041
30950
  return /Mac|iPhone|iPad/i.test(platform) ? "⌥⇧⌘P" : "Ctrl+Alt+Shift+P";
31042
30951
  });
30952
+ function isAlignment(value) {
30953
+ return ALIGNMENTS.some((entry) => entry.value === value);
30954
+ }
31043
30955
  function isTileSelected(tile) {
31044
30956
  return tile.position === position.value && tile.alignment === alignment.value;
31045
30957
  }
@@ -31109,8 +31021,12 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31109
31021
  const value = Math.floor(Number(startAt.value));
31110
31022
  return Number.isFinite(value) && value >= 0 ? value : 1;
31111
31023
  }
31024
+ function failureDetails(result) {
31025
+ if (typeof result !== "object" || result === null || result.success) return null;
31026
+ return isPlainObject$1(result.failure?.details) ? result.failure.details : null;
31027
+ }
31112
31028
  function failureMessage(result, action) {
31113
- const details = result?.failure?.details;
31029
+ const details = failureDetails(result);
31114
31030
  if (details?.reason === "page-number-has-content") return `A page number shares its line with other text. Edit the ${details.kind === "header" ? "header" : "footer"} directly to change it.`;
31115
31031
  if (details?.reason === "page-number-exists") return "This section already has page numbers.";
31116
31032
  if (action === "remove") return "Page numbers couldn’t be removed. Try again.";
@@ -31128,7 +31044,7 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31128
31044
  await loaded;
31129
31045
  const { execute, outcome } = prepare();
31130
31046
  const result = await execute();
31131
- if (result === true || result?.success === true) {
31047
+ if (result === true || typeof result === "object" && result !== null && result.success === true) {
31132
31048
  props.close(outcome);
31133
31049
  return;
31134
31050
  }
@@ -31178,8 +31094,9 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31178
31094
  }
31179
31095
  onMounted(() => {
31180
31096
  nextTick(() => tileRefs.value[focusIndex.value]?.focus({ preventScroll: true }));
31181
- if (typeof props.loadCurrent !== "function") return;
31182
- loaded = Promise.resolve().then(() => props.loadCurrent()).then(adoptCurrent, () => adoptCurrent(null)).finally(() => {
31097
+ const loadCurrent = props.loadCurrent;
31098
+ if (typeof loadCurrent !== "function") return;
31099
+ loaded = Promise.resolve().then(() => loadCurrent()).then(adoptCurrent, () => adoptCurrent(null)).finally(() => {
31183
31100
  loading.value = false;
31184
31101
  });
31185
31102
  });
@@ -31218,7 +31135,7 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31218
31135
  onClick: ($event) => selectTile(tile),
31219
31136
  onDblclick: applyPageNumbers,
31220
31137
  onKeydown: onTileKeydown
31221
- }, [(openBlock(), createElementBlock("svg", _hoisted_5, [_cache[4] || (_cache[4] = createStaticVNode("<rect class=\"sd-page-number-menu__sheet\" x=\"0.75\" y=\"0.75\" width=\"34.5\" height=\"44.5\" rx=\"2.5\" data-v-30327fd0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"14\" width=\"22\" height=\"2\" rx=\"1\" data-v-30327fd0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"19\" width=\"18\" height=\"2\" rx=\"1\" data-v-30327fd0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"24\" width=\"22\" height=\"2\" rx=\"1\" data-v-30327fd0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"29\" width=\"14\" height=\"2\" rx=\"1\" data-v-30327fd0></rect>", 5)), createElementVNode("rect", {
31138
+ }, [(openBlock(), createElementBlock("svg", _hoisted_5, [_cache[4] || (_cache[4] = createStaticVNode("<rect class=\"sd-page-number-menu__sheet\" x=\"0.75\" y=\"0.75\" width=\"34.5\" height=\"44.5\" rx=\"2.5\" data-v-a6c124c0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"14\" width=\"22\" height=\"2\" rx=\"1\" data-v-a6c124c0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"19\" width=\"18\" height=\"2\" rx=\"1\" data-v-a6c124c0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"24\" width=\"22\" height=\"2\" rx=\"1\" data-v-a6c124c0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"29\" width=\"14\" height=\"2\" rx=\"1\" data-v-a6c124c0></rect>", 5)), createElementVNode("rect", {
31222
31139
  class: "sd-page-number-menu__chip",
31223
31140
  x: CHIP_X[tile.alignment],
31224
31141
  y: CHIP_Y[tile.position],
@@ -31298,7 +31215,7 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31298
31215
  ], 10, _hoisted_1);
31299
31216
  };
31300
31217
  }
31301
- }, [["__scopeId", "data-v-30327fd0"]]);
31218
+ }), [["__scopeId", "data-v-a6c124c0"]]);
31302
31219
  //#endregion
31303
31220
  //#region src/internal/toolbar/built-in/page-number-feedback.js
31304
31221
  var FLASH_CLASS = "sd-page-number-flash";
@@ -34131,7 +34048,7 @@ var SuperDoc = class extends import_eventemitter3.default {
34131
34048
  }
34132
34049
  this.userColorMap = /* @__PURE__ */ new Map();
34133
34050
  this.colorIndex = 0;
34134
- this.version = "2.28.0";
34051
+ this.version = "2.29.0-next.1";
34135
34052
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
34136
34053
  this.superdocId = config.superdocId || v4();
34137
34054
  this.colors = this.config.colors ?? [];
@@ -35923,7 +35840,7 @@ var SuperDoc = class extends import_eventemitter3.default {
35923
35840
  * superdoc.setZoom(50); // Set zoom to 50%
35924
35841
  */
35925
35842
  setZoom(percent) {
35926
- if (typeof percent !== "number" || !Number.isFinite(percent) || percent <= 0) {
35843
+ if (!isFiniteNumber(percent) || percent <= 0) {
35927
35844
  console.warn("[SuperDoc] setZoom expects a positive number representing percentage");
35928
35845
  return;
35929
35846
  }