@embedpdf/plugin-annotation 2.6.1 → 2.7.0

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 (138) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +203 -8
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +12 -1
  6. package/dist/lib/annotation-plugin.d.ts +17 -0
  7. package/dist/lib/tools/default-tools.d.ts +2 -0
  8. package/dist/lib/tools/types.d.ts +2 -0
  9. package/dist/lib/types.d.ts +18 -2
  10. package/dist/preact/index.cjs +1 -1
  11. package/dist/preact/index.cjs.map +1 -1
  12. package/dist/preact/index.js +1008 -1058
  13. package/dist/preact/index.js.map +1 -1
  14. package/dist/react/index.cjs +1 -1
  15. package/dist/react/index.cjs.map +1 -1
  16. package/dist/react/index.js +1008 -1058
  17. package/dist/react/index.js.map +1 -1
  18. package/dist/shared/components/annotation-container.d.ts +11 -5
  19. package/dist/shared/components/annotations/circle.d.ts +4 -2
  20. package/dist/shared/components/annotations/free-text.d.ts +4 -1
  21. package/dist/shared/components/annotations/ink.d.ts +3 -1
  22. package/dist/shared/components/annotations/line.d.ts +3 -1
  23. package/dist/shared/components/annotations/polygon.d.ts +3 -2
  24. package/dist/shared/components/annotations/polyline.d.ts +3 -1
  25. package/dist/shared/components/annotations/square.d.ts +4 -2
  26. package/dist/shared/components/annotations.d.ts +0 -1
  27. package/dist/shared/components/appearance-image.d.ts +12 -0
  28. package/dist/shared/components/built-in-renderers.d.ts +2 -0
  29. package/dist/shared/components/text-markup/highlight.d.ts +3 -1
  30. package/dist/shared/components/text-markup/squiggly.d.ts +3 -1
  31. package/dist/shared/components/text-markup/strikeout.d.ts +3 -1
  32. package/dist/shared/components/text-markup/underline.d.ts +3 -1
  33. package/dist/shared/components/types.d.ts +66 -10
  34. package/dist/shared-preact/components/annotation-container.d.ts +11 -5
  35. package/dist/shared-preact/components/annotations/circle.d.ts +4 -2
  36. package/dist/shared-preact/components/annotations/free-text.d.ts +4 -1
  37. package/dist/shared-preact/components/annotations/ink.d.ts +3 -1
  38. package/dist/shared-preact/components/annotations/line.d.ts +3 -1
  39. package/dist/shared-preact/components/annotations/polygon.d.ts +3 -2
  40. package/dist/shared-preact/components/annotations/polyline.d.ts +3 -1
  41. package/dist/shared-preact/components/annotations/square.d.ts +4 -2
  42. package/dist/shared-preact/components/annotations.d.ts +0 -1
  43. package/dist/shared-preact/components/appearance-image.d.ts +12 -0
  44. package/dist/shared-preact/components/built-in-renderers.d.ts +2 -0
  45. package/dist/shared-preact/components/text-markup/highlight.d.ts +3 -1
  46. package/dist/shared-preact/components/text-markup/squiggly.d.ts +3 -1
  47. package/dist/shared-preact/components/text-markup/strikeout.d.ts +3 -1
  48. package/dist/shared-preact/components/text-markup/underline.d.ts +3 -1
  49. package/dist/shared-preact/components/types.d.ts +66 -10
  50. package/dist/shared-react/components/annotation-container.d.ts +11 -5
  51. package/dist/shared-react/components/annotations/circle.d.ts +4 -2
  52. package/dist/shared-react/components/annotations/free-text.d.ts +4 -1
  53. package/dist/shared-react/components/annotations/ink.d.ts +3 -1
  54. package/dist/shared-react/components/annotations/line.d.ts +3 -1
  55. package/dist/shared-react/components/annotations/polygon.d.ts +3 -2
  56. package/dist/shared-react/components/annotations/polyline.d.ts +3 -1
  57. package/dist/shared-react/components/annotations/square.d.ts +4 -2
  58. package/dist/shared-react/components/annotations.d.ts +0 -1
  59. package/dist/shared-react/components/appearance-image.d.ts +12 -0
  60. package/dist/shared-react/components/built-in-renderers.d.ts +2 -0
  61. package/dist/shared-react/components/text-markup/highlight.d.ts +3 -1
  62. package/dist/shared-react/components/text-markup/squiggly.d.ts +3 -1
  63. package/dist/shared-react/components/text-markup/strikeout.d.ts +3 -1
  64. package/dist/shared-react/components/text-markup/underline.d.ts +3 -1
  65. package/dist/shared-react/components/types.d.ts +66 -10
  66. package/dist/svelte/components/Annotations.svelte.d.ts +0 -7
  67. package/dist/svelte/components/AppearanceImage.svelte.d.ts +8 -0
  68. package/dist/svelte/components/annotations/Circle.svelte.d.ts +1 -10
  69. package/dist/svelte/components/annotations/FreeText.svelte.d.ts +1 -0
  70. package/dist/svelte/components/annotations/Ink.svelte.d.ts +1 -1
  71. package/dist/svelte/components/annotations/Line.svelte.d.ts +1 -0
  72. package/dist/svelte/components/annotations/Polygon.svelte.d.ts +1 -0
  73. package/dist/svelte/components/annotations/Polyline.svelte.d.ts +1 -1
  74. package/dist/svelte/components/annotations/Square.svelte.d.ts +1 -0
  75. package/dist/svelte/components/built-in-renderers.d.ts +2 -0
  76. package/dist/svelte/components/renderers/CircleRenderer.svelte.d.ts +5 -0
  77. package/dist/svelte/components/renderers/FreeTextRenderer.svelte.d.ts +5 -0
  78. package/dist/svelte/components/renderers/HighlightRenderer.svelte.d.ts +5 -0
  79. package/dist/svelte/components/renderers/InkRenderer.svelte.d.ts +5 -0
  80. package/dist/svelte/components/renderers/LineRenderer.svelte.d.ts +5 -0
  81. package/dist/svelte/components/renderers/LinkRenderer.svelte.d.ts +5 -0
  82. package/dist/svelte/components/renderers/PolygonRenderer.svelte.d.ts +5 -0
  83. package/dist/svelte/components/renderers/PolylineRenderer.svelte.d.ts +5 -0
  84. package/dist/svelte/components/renderers/SquareRenderer.svelte.d.ts +5 -0
  85. package/dist/svelte/components/renderers/SquigglyRenderer.svelte.d.ts +5 -0
  86. package/dist/svelte/components/renderers/StampRenderer.svelte.d.ts +5 -0
  87. package/dist/svelte/components/renderers/StrikeoutRenderer.svelte.d.ts +5 -0
  88. package/dist/svelte/components/renderers/UnderlineRenderer.svelte.d.ts +5 -0
  89. package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +2 -0
  90. package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +2 -0
  91. package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +2 -0
  92. package/dist/svelte/components/text-markup/Underline.svelte.d.ts +2 -0
  93. package/dist/svelte/components/types.d.ts +8 -2
  94. package/dist/svelte/context/renderer-registry.svelte.d.ts +2 -2
  95. package/dist/svelte/context/types.d.ts +63 -2
  96. package/dist/svelte/index.cjs +1 -1
  97. package/dist/svelte/index.cjs.map +1 -1
  98. package/dist/svelte/index.js +2509 -2864
  99. package/dist/svelte/index.js.map +1 -1
  100. package/dist/vue/components/annotation-container.vue.d.ts +8 -3
  101. package/dist/vue/components/annotation-layer.vue.d.ts +1 -20
  102. package/dist/vue/components/annotations/circle.vue.d.ts +18 -5
  103. package/dist/vue/components/annotations/free-text.vue.d.ts +17 -5
  104. package/dist/vue/components/annotations/ink.vue.d.ts +16 -6
  105. package/dist/vue/components/annotations/line.vue.d.ts +20 -5
  106. package/dist/vue/components/annotations/link.vue.d.ts +24 -6
  107. package/dist/vue/components/annotations/polygon.vue.d.ts +21 -5
  108. package/dist/vue/components/annotations/polyline.vue.d.ts +18 -5
  109. package/dist/vue/components/annotations/square.vue.d.ts +18 -5
  110. package/dist/vue/components/annotations/stamp.vue.d.ts +11 -5
  111. package/dist/vue/components/annotations.vue.d.ts +8 -575
  112. package/dist/vue/components/appearance-image.vue.d.ts +9 -0
  113. package/dist/vue/components/built-in-renderers.d.ts +2 -0
  114. package/dist/vue/components/group-selection-box.vue.d.ts +2 -2
  115. package/dist/vue/components/renderers/circle-renderer.vue.d.ts +6 -0
  116. package/dist/vue/components/renderers/free-text-renderer.vue.d.ts +6 -0
  117. package/dist/vue/components/renderers/highlight-renderer.vue.d.ts +6 -0
  118. package/dist/vue/components/renderers/ink-renderer.vue.d.ts +6 -0
  119. package/dist/vue/components/renderers/line-renderer.vue.d.ts +6 -0
  120. package/dist/vue/components/renderers/link-renderer.vue.d.ts +6 -0
  121. package/dist/vue/components/renderers/polygon-renderer.vue.d.ts +6 -0
  122. package/dist/vue/components/renderers/polyline-renderer.vue.d.ts +6 -0
  123. package/dist/vue/components/renderers/square-renderer.vue.d.ts +6 -0
  124. package/dist/vue/components/renderers/squiggly-renderer.vue.d.ts +6 -0
  125. package/dist/vue/components/renderers/stamp-renderer.vue.d.ts +6 -0
  126. package/dist/vue/components/renderers/strikeout-renderer.vue.d.ts +6 -0
  127. package/dist/vue/components/renderers/underline-renderer.vue.d.ts +6 -0
  128. package/dist/vue/components/text-markup/highlight.vue.d.ts +17 -5
  129. package/dist/vue/components/text-markup/squiggly.vue.d.ts +17 -5
  130. package/dist/vue/components/text-markup/strikeout.vue.d.ts +17 -5
  131. package/dist/vue/components/text-markup/underline.vue.d.ts +17 -5
  132. package/dist/vue/context/renderer-registry.d.ts +2 -2
  133. package/dist/vue/context/types.d.ts +63 -2
  134. package/dist/vue/index.cjs +1 -1
  135. package/dist/vue/index.cjs.map +1 -1
  136. package/dist/vue/index.js +1651 -1278
  137. package/dist/vue/index.js.map +1 -1
  138. package/package.json +10 -10
package/dist/vue/index.js CHANGED
@@ -1,12 +1,60 @@
1
1
  import { createPluginPackage } from "@embedpdf/core";
2
- import { AnnotationPlugin, initialDocumentState, inferRotationCenterFromRects, patching, getAnnotationsByPageIndex, getSelectedAnnotationIds, resolveInteractionProp, isInk, isSquare, isCircle, isLine, isPolyline, isPolygon, isFreeText, isStamp, isUnderline, isStrikeout, isSquiggly, isHighlight, isLink, AnnotationPluginPackage as AnnotationPluginPackage$1 } from "@embedpdf/plugin-annotation";
2
+ import { AnnotationPlugin, initialDocumentState, inferRotationCenterFromRects, patching, resolveInteractionProp, getAnnotationsByPageIndex, getSelectedAnnotationIds, AnnotationPluginPackage as AnnotationPluginPackage$1 } from "@embedpdf/plugin-annotation";
3
3
  export * from "@embedpdf/plugin-annotation";
4
- import { ref, toValue, watch, computed, defineComponent, shallowRef, toRaw, watchEffect, useSlots, openBlock, createElementBlock, createElementVNode, normalizeStyle, Fragment, createCommentVNode, unref, renderSlot, normalizeProps, mergeProps, renderList, createBlock, withCtx, resolveDynamicComponent, Teleport, toDisplayString, onMounted, onUnmounted, createVNode, createSlots, guardReactiveProps, provide, inject, markRaw } from "vue";
4
+ import { defineComponent, ref, watchEffect, openBlock, createElementBlock, normalizeStyle, createCommentVNode, toValue, watch, computed, shallowRef, toRaw, useSlots, createElementVNode, Fragment, unref, renderSlot, normalizeProps, mergeProps, createBlock, renderList, withCtx, resolveDynamicComponent, Teleport, toDisplayString, markRaw, provide, inject, onUnmounted, onMounted, createVNode, createSlots, guardReactiveProps } from "vue";
5
5
  import { useInteractionHandles, useDoublePressProps, CounterRotate, deepToRaw } from "@embedpdf/utils/vue";
6
- import { usePlugin, useCapability, useDocumentPermissions, useDocumentState } from "@embedpdf/core/vue";
7
- import { boundingRectOrEmpty, PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCssProperties, ignore, PdfErrorCode, PdfBlendMode, blendModeToCss, PdfAnnotationSubtype } from "@embedpdf/models";
6
+ import { useCapability, usePlugin, useDocumentPermissions, useDocumentState } from "@embedpdf/core/vue";
7
+ import { boundingRectOrEmpty, PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCssProperties, ignore, PdfErrorCode, PdfAnnotationSubtype, blendModeToCss, PdfBlendMode } from "@embedpdf/models";
8
8
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/vue";
9
9
  import { useSelectionCapability } from "@embedpdf/plugin-selection/vue";
10
+ const _hoisted_1$b = ["src"];
11
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
12
+ __name: "appearance-image",
13
+ props: {
14
+ appearance: {},
15
+ style: {}
16
+ },
17
+ setup(__props) {
18
+ const props = __props;
19
+ const imageUrl = ref(null);
20
+ const urlRef = ref(null);
21
+ watchEffect((onCleanup) => {
22
+ const url = URL.createObjectURL(props.appearance.data);
23
+ imageUrl.value = url;
24
+ urlRef.value = url;
25
+ onCleanup(() => {
26
+ if (urlRef.value) {
27
+ URL.revokeObjectURL(urlRef.value);
28
+ urlRef.value = null;
29
+ }
30
+ });
31
+ });
32
+ const handleImageLoad = () => {
33
+ if (urlRef.value) {
34
+ URL.revokeObjectURL(urlRef.value);
35
+ urlRef.value = null;
36
+ }
37
+ };
38
+ return (_ctx, _cache) => {
39
+ return imageUrl.value ? (openBlock(), createElementBlock("img", {
40
+ key: 0,
41
+ src: imageUrl.value,
42
+ alt: "",
43
+ draggable: "false",
44
+ onLoad: handleImageLoad,
45
+ style: normalizeStyle({
46
+ position: "absolute",
47
+ width: "100%",
48
+ height: "100%",
49
+ display: "block",
50
+ pointerEvents: "none",
51
+ userSelect: "none",
52
+ ...__props.style
53
+ })
54
+ }, null, 44, _hoisted_1$b)) : createCommentVNode("", true);
55
+ };
56
+ }
57
+ });
10
58
  const useAnnotationPlugin = () => usePlugin(AnnotationPlugin.id);
11
59
  const useAnnotationCapability = () => useCapability(AnnotationPlugin.id);
12
60
  const useAnnotation = (documentId) => {
@@ -39,11 +87,11 @@ const useAnnotation = (documentId) => {
39
87
  };
40
88
  const _hoisted_1$a = ["width", "height", "stroke"];
41
89
  const _hoisted_2$8 = ["width", "height", "stroke"];
42
- const __default__ = {
90
+ const __default__$d = {
43
91
  inheritAttrs: false
44
92
  };
45
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
46
- ...__default__,
93
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
94
+ ...__default__$d,
47
95
  __name: "annotation-container",
48
96
  props: {
49
97
  scale: {},
@@ -54,6 +102,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
54
102
  pageHeight: {},
55
103
  trackedAnnotation: {},
56
104
  isSelected: { type: Boolean },
105
+ isEditing: { type: Boolean, default: false },
57
106
  isMultiSelected: { type: Boolean, default: false },
58
107
  isDraggable: { type: Boolean },
59
108
  isResizable: { type: Boolean },
@@ -64,6 +113,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
64
113
  outlineOffset: { default: 1 },
65
114
  onDoubleClick: {},
66
115
  onSelect: {},
116
+ appearance: {},
67
117
  zIndex: { default: 1 },
68
118
  selectionOutlineColor: { default: "#007ACC" },
69
119
  selectionOutline: {},
@@ -148,6 +198,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
148
198
  const liveRotation = ref(null);
149
199
  const cursorScreen = ref(null);
150
200
  const isHandleHovered = ref(false);
201
+ const gestureActive = ref(false);
151
202
  const { provides: annotationCapability } = useAnnotationCapability();
152
203
  const { plugin: annotationPlugin } = useAnnotationPlugin();
153
204
  const permissions = useDocumentPermissions(props.documentId);
@@ -286,6 +337,9 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
286
337
  if (event.state === "start") {
287
338
  gestureBaseRectRef.value = props.trackedAnnotation.object.unrotatedRect ?? props.trackedAnnotation.object.rect;
288
339
  gestureBaseRef.value = currentObject.value;
340
+ if (type === "resize" || type === "vertex-edit") {
341
+ gestureActive.value = true;
342
+ }
289
343
  if (type === "move") {
290
344
  plugin.startDrag(props.documentId, { annotationIds: [id], pageSize });
291
345
  } else if (type === "resize") {
@@ -344,6 +398,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
344
398
  return;
345
399
  }
346
400
  if (event.state === "end") {
401
+ gestureActive.value = false;
347
402
  gestureBaseRectRef.value = null;
348
403
  gestureBaseRef.value = null;
349
404
  if (type === "move") plugin.commitDrag(props.documentId);
@@ -434,6 +489,12 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
434
489
  );
435
490
  const guideLength = computed(() => Math.max(300, Math.max(aabbWidth.value, aabbHeight.value) + 80));
436
491
  const rotationIconSize = computed(() => Math.round(ROTATION_SIZE.value * 0.6));
492
+ const apActive = computed(
493
+ () => {
494
+ var _a;
495
+ return !!((_a = props.appearance) == null ? void 0 : _a.normal) && !gestureActive.value && !props.isEditing && !props.trackedAnnotation.dictMode;
496
+ }
497
+ );
437
498
  const contentsStyle = { display: "contents" };
438
499
  const outerAABBStyle = computed(() => ({
439
500
  position: "absolute",
@@ -550,6 +611,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
550
611
  }));
551
612
  const slots = useSlots();
552
613
  return (_ctx, _cache) => {
614
+ var _a;
553
615
  return openBlock(), createElementBlock("div", {
554
616
  "data-no-interaction": "",
555
617
  style: contentsStyle
@@ -615,8 +677,16 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
615
677
  ], 16))
616
678
  ], 32)) : createCommentVNode("", true),
617
679
  createElementVNode("div", mergeProps({ ...effectiveIsDraggable.value && __props.isSelected ? unref(dragProps) : {}, ...unref(doubleProps) }, { style: innerRotatedStyle.value }), [
618
- renderSlot(_ctx.$slots, "default", { annotation: childObject.value }),
619
- __props.isSelected && effectiveIsResizable.value && !rotationActive.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(resize), ({ key, style, ...handle }) => {
680
+ renderSlot(_ctx.$slots, "default", {
681
+ annotation: childObject.value,
682
+ appearanceActive: apActive.value
683
+ }),
684
+ ((_a = __props.appearance) == null ? void 0 : _a.normal) ? (openBlock(), createBlock(_sfc_main$z, {
685
+ key: 0,
686
+ appearance: __props.appearance.normal,
687
+ style: normalizeStyle({ display: apActive.value ? "block" : "none" })
688
+ }, null, 8, ["appearance", "style"])) : createCommentVNode("", true),
689
+ __props.isSelected && effectiveIsResizable.value && !rotationActive.value ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(resize), ({ key, style, ...handle }) => {
620
690
  return openBlock(), createElementBlock(Fragment, { key }, [
621
691
  unref(slots)["resize-handle"] ? renderSlot(_ctx.$slots, "resize-handle", mergeProps({
622
692
  key: 0,
@@ -633,7 +703,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
633
703
  }), null, 16))
634
704
  ], 64);
635
705
  }), 128)) : createCommentVNode("", true),
636
- __props.isSelected && unref(permissions).canModifyAnnotations && !__props.isMultiSelected && !rotationActive.value && unref(vertices).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(vertices), ({ key, style, ...vertex }) => {
706
+ __props.isSelected && unref(permissions).canModifyAnnotations && !__props.isMultiSelected && !rotationActive.value && unref(vertices).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(unref(vertices), ({ key, style, ...vertex }) => {
637
707
  return openBlock(), createElementBlock(Fragment, { key }, [
638
708
  unref(slots)["vertex-handle"] ? renderSlot(_ctx.$slots, "vertex-handle", mergeProps({
639
709
  key: 0,
@@ -687,8 +757,8 @@ const _hoisted_1$9 = {
687
757
  "data-no-interaction": ""
688
758
  };
689
759
  const _hoisted_2$7 = ["width", "height", "stroke"];
690
- const _hoisted_3$4 = ["width", "height", "stroke"];
691
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
760
+ const _hoisted_3$7 = ["width", "height", "stroke"];
761
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
692
762
  __name: "group-selection-box",
693
763
  props: {
694
764
  documentId: {},
@@ -1172,7 +1242,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
1172
1242
  }, [..._cache[3] || (_cache[3] = [
1173
1243
  createElementVNode("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }, null, -1),
1174
1244
  createElementVNode("path", { d: "M21 3v5h-5" }, null, -1)
1175
- ])], 8, _hoisted_3$4))
1245
+ ])], 8, _hoisted_3$7))
1176
1246
  ], 16))
1177
1247
  ], 32)) : createCommentVNode("", true),
1178
1248
  createElementVNode("div", mergeProps(
@@ -1227,10 +1297,175 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
1227
1297
  };
1228
1298
  }
1229
1299
  });
1300
+ const RendererRegistryKey = Symbol(
1301
+ "AnnotationRendererRegistry"
1302
+ );
1303
+ function createRendererRegistry() {
1304
+ const renderers = shallowRef([]);
1305
+ return {
1306
+ register(entries) {
1307
+ const ids = new Set(entries.map((e) => e.id));
1308
+ renderers.value = [...renderers.value.filter((r) => !ids.has(r.id)), ...entries];
1309
+ return () => {
1310
+ renderers.value = renderers.value.filter((r) => !entries.some((e) => e.id === r.id));
1311
+ };
1312
+ },
1313
+ getAll() {
1314
+ return renderers.value;
1315
+ }
1316
+ };
1317
+ }
1318
+ function provideRendererRegistry() {
1319
+ const registry = createRendererRegistry();
1320
+ provide(RendererRegistryKey, registry);
1321
+ return registry;
1322
+ }
1323
+ function useRendererRegistry() {
1324
+ return inject(RendererRegistryKey, null);
1325
+ }
1326
+ function useRegisterRenderers(entries) {
1327
+ const registry = useRendererRegistry();
1328
+ if (!registry) return;
1329
+ const unregister = registry.register(entries);
1330
+ onUnmounted(unregister);
1331
+ }
1332
+ function createRenderer(entry) {
1333
+ return {
1334
+ id: entry.id,
1335
+ matches: entry.matches,
1336
+ component: markRaw(entry.component),
1337
+ vertexConfig: entry.vertexConfig,
1338
+ zIndex: entry.zIndex,
1339
+ containerStyle: entry.containerStyle,
1340
+ interactionDefaults: entry.interactionDefaults,
1341
+ useAppearanceStream: entry.useAppearanceStream,
1342
+ isDraggable: entry.isDraggable,
1343
+ onDoubleClick: entry.onDoubleClick,
1344
+ selectOverride: entry.selectOverride,
1345
+ hideSelectionMenu: entry.hideSelectionMenu
1346
+ };
1347
+ }
1230
1348
  const _hoisted_1$8 = ["width", "height", "viewBox"];
1231
- const _hoisted_2$6 = ["cx", "cy", "rx", "ry", "fill", "opacity"];
1232
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
1233
- __name: "circle",
1349
+ const _hoisted_2$6 = ["d", "stroke-width"];
1350
+ const _hoisted_3$6 = ["d", "opacity"];
1351
+ const __default__$c = { inheritAttrs: false };
1352
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1353
+ ...__default__$c,
1354
+ __name: "ink",
1355
+ props: {
1356
+ isSelected: { type: Boolean },
1357
+ strokeColor: {},
1358
+ opacity: { default: 1 },
1359
+ strokeWidth: {},
1360
+ inkList: {},
1361
+ rect: {},
1362
+ scale: {},
1363
+ onClick: {},
1364
+ appearanceActive: { type: Boolean, default: false }
1365
+ },
1366
+ setup(__props) {
1367
+ const MIN_HIT_AREA_SCREEN_PX = 20;
1368
+ const props = __props;
1369
+ const resolvedColor = computed(() => props.strokeColor ?? "#000000");
1370
+ const paths = computed(() => {
1371
+ return props.inkList.map(({ points }) => {
1372
+ let d = "";
1373
+ points.forEach(({ x, y }, i) => {
1374
+ const lx = x - props.rect.origin.x;
1375
+ const ly = y - props.rect.origin.y;
1376
+ d += (i === 0 ? "M" : "L") + `${lx} ${ly} `;
1377
+ });
1378
+ return d.trim();
1379
+ });
1380
+ });
1381
+ const width = computed(() => props.rect.size.width * props.scale);
1382
+ const height = computed(() => props.rect.size.height * props.scale);
1383
+ const hitStrokeWidth = computed(
1384
+ () => Math.max(props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / props.scale)
1385
+ );
1386
+ return (_ctx, _cache) => {
1387
+ return openBlock(), createElementBlock("svg", {
1388
+ style: normalizeStyle({
1389
+ position: "absolute",
1390
+ width: `${width.value}px`,
1391
+ height: `${height.value}px`,
1392
+ pointerEvents: "none",
1393
+ zIndex: 2,
1394
+ overflow: "visible"
1395
+ }),
1396
+ width: width.value,
1397
+ height: height.value,
1398
+ viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`
1399
+ }, [
1400
+ (openBlock(true), createElementBlock(Fragment, null, renderList(paths.value, (d, i) => {
1401
+ return openBlock(), createElementBlock("path", {
1402
+ key: `hit-${i}`,
1403
+ d,
1404
+ fill: "none",
1405
+ stroke: "transparent",
1406
+ "stroke-width": hitStrokeWidth.value,
1407
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1408
+ (...args) => __props.onClick && __props.onClick(...args)),
1409
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1410
+ (...args) => __props.onClick && __props.onClick(...args)),
1411
+ style: normalizeStyle({
1412
+ cursor: __props.isSelected ? "move" : "pointer",
1413
+ pointerEvents: __props.isSelected ? "none" : "visibleStroke",
1414
+ strokeLinecap: "round",
1415
+ strokeLinejoin: "round"
1416
+ })
1417
+ }, null, 44, _hoisted_2$6);
1418
+ }), 128)),
1419
+ !__props.appearanceActive ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(paths.value, (d, i) => {
1420
+ return openBlock(), createElementBlock("path", {
1421
+ key: `vis-${i}`,
1422
+ d,
1423
+ fill: "none",
1424
+ opacity: __props.opacity,
1425
+ style: normalizeStyle({
1426
+ pointerEvents: "none",
1427
+ stroke: resolvedColor.value,
1428
+ strokeWidth: __props.strokeWidth,
1429
+ strokeLinecap: "round",
1430
+ strokeLinejoin: "round"
1431
+ })
1432
+ }, null, 12, _hoisted_3$6);
1433
+ }), 128)) : createCommentVNode("", true)
1434
+ ], 12, _hoisted_1$8);
1435
+ };
1436
+ }
1437
+ });
1438
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1439
+ __name: "ink-renderer",
1440
+ props: {
1441
+ annotation: {},
1442
+ currentObject: {},
1443
+ isSelected: { type: Boolean },
1444
+ isEditing: { type: Boolean },
1445
+ scale: {},
1446
+ pageIndex: {},
1447
+ documentId: {},
1448
+ onClick: { type: Function },
1449
+ appearanceActive: { type: Boolean }
1450
+ },
1451
+ setup(__props) {
1452
+ return (_ctx, _cache) => {
1453
+ return openBlock(), createBlock(_sfc_main$w, mergeProps(__props.currentObject, {
1454
+ isSelected: __props.isSelected,
1455
+ scale: __props.scale,
1456
+ onClick: __props.onClick,
1457
+ appearanceActive: __props.appearanceActive
1458
+ }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
1459
+ };
1460
+ }
1461
+ });
1462
+ const _hoisted_1$7 = ["width", "height", "viewBox"];
1463
+ const _hoisted_2$5 = ["x", "y", "width", "height", "stroke-width"];
1464
+ const _hoisted_3$5 = ["x", "y", "width", "height", "fill", "opacity"];
1465
+ const __default__$b = { inheritAttrs: false };
1466
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1467
+ ...__default__$b,
1468
+ __name: "square",
1234
1469
  props: {
1235
1470
  isSelected: { type: Boolean },
1236
1471
  color: { default: "#000000" },
@@ -1241,9 +1476,11 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
1241
1476
  strokeDashArray: {},
1242
1477
  rect: {},
1243
1478
  scale: {},
1244
- onClick: {}
1479
+ onClick: {},
1480
+ appearanceActive: { type: Boolean, default: false }
1245
1481
  },
1246
1482
  setup(__props) {
1483
+ const MIN_HIT_AREA_SCREEN_PX = 20;
1247
1484
  const props = __props;
1248
1485
  const geometry = computed(() => {
1249
1486
  const outerW = props.rect.size.width;
@@ -1251,16 +1488,17 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
1251
1488
  const innerW = Math.max(outerW - props.strokeWidth, 0);
1252
1489
  const innerH = Math.max(outerH - props.strokeWidth, 0);
1253
1490
  return {
1254
- width: outerW,
1255
- height: outerH,
1256
- cx: props.strokeWidth / 2 + innerW / 2,
1257
- cy: props.strokeWidth / 2 + innerH / 2,
1258
- rx: innerW / 2,
1259
- ry: innerH / 2
1491
+ width: innerW,
1492
+ height: innerH,
1493
+ x: props.strokeWidth / 2,
1494
+ y: props.strokeWidth / 2
1260
1495
  };
1261
1496
  });
1262
- const svgWidth = computed(() => geometry.value.width * props.scale);
1263
- const svgHeight = computed(() => geometry.value.height * props.scale);
1497
+ const svgWidth = computed(() => (geometry.value.width + props.strokeWidth) * props.scale);
1498
+ const svgHeight = computed(() => (geometry.value.height + props.strokeWidth) * props.scale);
1499
+ const hitStrokeWidth = computed(
1500
+ () => Math.max(props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / props.scale)
1501
+ );
1264
1502
  return (_ctx, _cache) => {
1265
1503
  var _a;
1266
1504
  return openBlock(), createElementBlock("svg", {
@@ -1273,208 +1511,200 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
1273
1511
  }),
1274
1512
  width: svgWidth.value,
1275
1513
  height: svgHeight.value,
1276
- viewBox: `0 0 ${geometry.value.width} ${geometry.value.height}`
1514
+ viewBox: `0 0 ${geometry.value.width + __props.strokeWidth} ${geometry.value.height + __props.strokeWidth}`,
1515
+ overflow: "visible"
1277
1516
  }, [
1278
- createElementVNode("ellipse", {
1279
- cx: geometry.value.cx,
1280
- cy: geometry.value.cy,
1281
- rx: geometry.value.rx,
1282
- ry: geometry.value.ry,
1283
- fill: __props.color,
1284
- opacity: __props.opacity,
1517
+ createElementVNode("rect", {
1518
+ x: geometry.value.x,
1519
+ y: geometry.value.y,
1520
+ width: geometry.value.width,
1521
+ height: geometry.value.height,
1522
+ fill: "transparent",
1523
+ stroke: "transparent",
1524
+ "stroke-width": hitStrokeWidth.value,
1285
1525
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1286
1526
  (...args) => __props.onClick && __props.onClick(...args)),
1287
1527
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1288
1528
  (...args) => __props.onClick && __props.onClick(...args)),
1289
1529
  style: normalizeStyle({
1290
1530
  cursor: __props.isSelected ? "move" : "pointer",
1291
- pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible",
1531
+ pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible"
1532
+ })
1533
+ }, null, 44, _hoisted_2$5),
1534
+ !__props.appearanceActive ? (openBlock(), createElementBlock("rect", {
1535
+ key: 0,
1536
+ x: geometry.value.x,
1537
+ y: geometry.value.y,
1538
+ width: geometry.value.width,
1539
+ height: geometry.value.height,
1540
+ fill: __props.color,
1541
+ opacity: __props.opacity,
1542
+ style: normalizeStyle({
1543
+ pointerEvents: "none",
1292
1544
  stroke: __props.strokeColor ?? __props.color,
1293
1545
  strokeWidth: __props.strokeWidth,
1294
1546
  ...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
1295
1547
  strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
1296
1548
  }
1297
1549
  })
1298
- }, null, 44, _hoisted_2$6)
1299
- ], 12, _hoisted_1$8);
1550
+ }, null, 12, _hoisted_3$5)) : createCommentVNode("", true)
1551
+ ], 12, _hoisted_1$7);
1300
1552
  };
1301
1553
  }
1302
1554
  });
1303
- const _hoisted_1$7 = ["contenteditable"];
1304
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
1305
- __name: "free-text",
1555
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1556
+ __name: "square-renderer",
1306
1557
  props: {
1558
+ annotation: {},
1559
+ currentObject: {},
1307
1560
  isSelected: { type: Boolean },
1308
1561
  isEditing: { type: Boolean },
1309
- annotation: {},
1562
+ scale: {},
1310
1563
  pageIndex: {},
1564
+ documentId: {},
1565
+ onClick: { type: Function },
1566
+ appearanceActive: { type: Boolean }
1567
+ },
1568
+ setup(__props) {
1569
+ return (_ctx, _cache) => {
1570
+ return openBlock(), createBlock(_sfc_main$u, mergeProps(__props.currentObject, {
1571
+ isSelected: __props.isSelected,
1572
+ scale: __props.scale,
1573
+ onClick: __props.onClick,
1574
+ appearanceActive: __props.appearanceActive
1575
+ }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
1576
+ };
1577
+ }
1578
+ });
1579
+ const _hoisted_1$6 = ["width", "height", "viewBox"];
1580
+ const _hoisted_2$4 = ["cx", "cy", "rx", "ry", "stroke-width"];
1581
+ const _hoisted_3$4 = ["cx", "cy", "rx", "ry", "fill", "opacity"];
1582
+ const __default__$a = { inheritAttrs: false };
1583
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1584
+ ...__default__$a,
1585
+ __name: "circle",
1586
+ props: {
1587
+ isSelected: { type: Boolean },
1588
+ color: { default: "#000000" },
1589
+ strokeColor: {},
1590
+ opacity: { default: 1 },
1591
+ strokeWidth: {},
1592
+ strokeStyle: { default: PdfAnnotationBorderStyle.SOLID },
1593
+ strokeDashArray: {},
1594
+ rect: {},
1311
1595
  scale: {},
1312
- onClick: { type: Function }
1596
+ onClick: {},
1597
+ appearanceActive: { type: Boolean, default: false }
1313
1598
  },
1314
1599
  setup(__props) {
1600
+ const MIN_HIT_AREA_SCREEN_PX = 20;
1315
1601
  const props = __props;
1316
- const editorRef = ref(null);
1317
- const { provides: annotationProvides } = useAnnotationCapability();
1318
- const isIOS = ref(false);
1319
- onMounted(() => {
1320
- try {
1321
- const nav = navigator;
1322
- isIOS.value = /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && (nav == null ? void 0 : nav.maxTouchPoints) > 1;
1323
- } catch {
1324
- isIOS.value = false;
1325
- }
1326
- });
1327
- watch(
1328
- () => props.isEditing,
1329
- (editing) => {
1330
- if (editing && editorRef.value) {
1331
- const editor = editorRef.value;
1332
- editor.focus();
1333
- const selection = window.getSelection();
1334
- if (selection) {
1335
- const range = document.createRange();
1336
- range.selectNodeContents(editor);
1337
- range.collapse(false);
1338
- selection.removeAllRanges();
1339
- selection.addRange(range);
1340
- }
1341
- }
1342
- }
1343
- );
1344
- const handleBlur = () => {
1345
- if (!annotationProvides.value || !editorRef.value) return;
1346
- annotationProvides.value.updateAnnotation(props.pageIndex, props.annotation.object.id, {
1347
- contents: editorRef.value.innerText
1348
- });
1349
- };
1350
- const editorStyle = computed(() => {
1351
- const { object: anno } = props.annotation;
1352
- const computedFontPx = anno.fontSize * props.scale;
1353
- const MIN_IOS_FOCUS_FONT_PX = 16;
1354
- const needsComp = isIOS.value && props.isEditing && computedFontPx > 0 && computedFontPx < MIN_IOS_FOCUS_FONT_PX;
1355
- const adjustedFontPx = needsComp ? MIN_IOS_FOCUS_FONT_PX : computedFontPx;
1356
- const scaleComp = needsComp ? computedFontPx / MIN_IOS_FOCUS_FONT_PX : 1;
1357
- const invScalePercent = needsComp ? 100 / scaleComp : 100;
1602
+ const geometry = computed(() => {
1603
+ const outerW = props.rect.size.width;
1604
+ const outerH = props.rect.size.height;
1605
+ const innerW = Math.max(outerW - props.strokeWidth, 0);
1606
+ const innerH = Math.max(outerH - props.strokeWidth, 0);
1358
1607
  return {
1359
- color: anno.fontColor,
1360
- fontSize: `${adjustedFontPx}px`,
1361
- ...standardFontCssProperties(anno.fontFamily),
1362
- textAlign: textAlignmentToCss(anno.textAlign),
1363
- flexDirection: "column",
1364
- justifyContent: anno.verticalAlign === PdfVerticalAlignment.Top ? "flex-start" : anno.verticalAlign === PdfVerticalAlignment.Middle ? "center" : "flex-end",
1365
- display: "flex",
1366
- backgroundColor: anno.color ?? anno.backgroundColor,
1367
- opacity: anno.opacity,
1368
- width: needsComp ? `${invScalePercent}%` : "100%",
1369
- height: needsComp ? `${invScalePercent}%` : "100%",
1370
- lineHeight: "1.18",
1371
- overflow: "hidden",
1372
- cursor: props.isEditing ? "text" : "pointer",
1373
- outline: "none",
1374
- transform: needsComp ? `scale(${scaleComp})` : void 0,
1375
- transformOrigin: "top left"
1608
+ width: outerW,
1609
+ height: outerH,
1610
+ cx: props.strokeWidth / 2 + innerW / 2,
1611
+ cy: props.strokeWidth / 2 + innerH / 2,
1612
+ rx: innerW / 2,
1613
+ ry: innerH / 2
1376
1614
  };
1377
1615
  });
1616
+ const svgWidth = computed(() => geometry.value.width * props.scale);
1617
+ const svgHeight = computed(() => geometry.value.height * props.scale);
1618
+ const hitStrokeWidth = computed(
1619
+ () => Math.max(props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / props.scale)
1620
+ );
1378
1621
  return (_ctx, _cache) => {
1379
- return openBlock(), createElementBlock("div", {
1622
+ var _a;
1623
+ return openBlock(), createElementBlock("svg", {
1380
1624
  style: normalizeStyle({
1381
1625
  position: "absolute",
1382
- width: `${__props.annotation.object.rect.size.width * __props.scale}px`,
1383
- height: `${__props.annotation.object.rect.size.height * __props.scale}px`,
1384
- cursor: __props.isSelected && !__props.isEditing ? "move" : "default",
1385
- pointerEvents: __props.isSelected && !__props.isEditing ? "none" : "auto",
1626
+ width: svgWidth.value,
1627
+ height: svgHeight.value,
1628
+ pointerEvents: "none",
1386
1629
  zIndex: 2
1387
1630
  }),
1388
- onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1389
- (...args) => __props.onClick && __props.onClick(...args)),
1390
- onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1391
- (...args) => __props.onClick && __props.onClick(...args))
1631
+ width: svgWidth.value,
1632
+ height: svgHeight.value,
1633
+ viewBox: `0 0 ${geometry.value.width} ${geometry.value.height}`,
1634
+ overflow: "visible"
1392
1635
  }, [
1393
- createElementVNode("span", {
1394
- ref_key: "editorRef",
1395
- ref: editorRef,
1396
- onBlur: handleBlur,
1397
- tabindex: "0",
1398
- style: normalizeStyle(editorStyle.value),
1399
- contenteditable: __props.isEditing
1400
- }, toDisplayString(__props.annotation.object.contents), 45, _hoisted_1$7)
1401
- ], 36);
1636
+ createElementVNode("ellipse", {
1637
+ cx: geometry.value.cx,
1638
+ cy: geometry.value.cy,
1639
+ rx: geometry.value.rx,
1640
+ ry: geometry.value.ry,
1641
+ fill: "transparent",
1642
+ stroke: "transparent",
1643
+ "stroke-width": hitStrokeWidth.value,
1644
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1645
+ (...args) => __props.onClick && __props.onClick(...args)),
1646
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1647
+ (...args) => __props.onClick && __props.onClick(...args)),
1648
+ style: normalizeStyle({
1649
+ cursor: __props.isSelected ? "move" : "pointer",
1650
+ pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible"
1651
+ })
1652
+ }, null, 44, _hoisted_2$4),
1653
+ !__props.appearanceActive ? (openBlock(), createElementBlock("ellipse", {
1654
+ key: 0,
1655
+ cx: geometry.value.cx,
1656
+ cy: geometry.value.cy,
1657
+ rx: geometry.value.rx,
1658
+ ry: geometry.value.ry,
1659
+ fill: __props.color,
1660
+ opacity: __props.opacity,
1661
+ style: normalizeStyle({
1662
+ pointerEvents: "none",
1663
+ stroke: __props.strokeColor ?? __props.color,
1664
+ strokeWidth: __props.strokeWidth,
1665
+ ...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
1666
+ strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
1667
+ }
1668
+ })
1669
+ }, null, 12, _hoisted_3$4)) : createCommentVNode("", true)
1670
+ ], 12, _hoisted_1$6);
1402
1671
  };
1403
1672
  }
1404
1673
  });
1405
- const _hoisted_1$6 = ["width", "height", "viewBox"];
1406
- const _hoisted_2$5 = ["d", "opacity"];
1407
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
1408
- __name: "ink",
1674
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1675
+ __name: "circle-renderer",
1409
1676
  props: {
1677
+ annotation: {},
1678
+ currentObject: {},
1410
1679
  isSelected: { type: Boolean },
1411
- strokeColor: {},
1412
- opacity: { default: 1 },
1413
- strokeWidth: {},
1414
- inkList: {},
1415
- rect: {},
1680
+ isEditing: { type: Boolean },
1416
1681
  scale: {},
1417
- onClick: {}
1682
+ pageIndex: {},
1683
+ documentId: {},
1684
+ onClick: { type: Function },
1685
+ appearanceActive: { type: Boolean }
1418
1686
  },
1419
1687
  setup(__props) {
1420
- const props = __props;
1421
- const resolvedColor = computed(() => props.strokeColor ?? "#000000");
1422
- const paths = computed(() => {
1423
- return props.inkList.map(({ points }) => {
1424
- let d = "";
1425
- points.forEach(({ x, y }, i) => {
1426
- const lx = x - props.rect.origin.x;
1427
- const ly = y - props.rect.origin.y;
1428
- d += (i === 0 ? "M" : "L") + `${lx} ${ly} `;
1429
- });
1430
- return d.trim();
1431
- });
1432
- });
1433
- const width = computed(() => props.rect.size.width * props.scale);
1434
- const height = computed(() => props.rect.size.height * props.scale);
1435
1688
  return (_ctx, _cache) => {
1436
- return openBlock(), createElementBlock("svg", {
1437
- style: normalizeStyle({
1438
- position: "absolute",
1439
- width: `${width.value}px`,
1440
- height: `${height.value}px`,
1441
- pointerEvents: "none",
1442
- zIndex: 2,
1443
- overflow: "visible"
1444
- }),
1445
- width: width.value,
1446
- height: height.value,
1447
- viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`
1448
- }, [
1449
- (openBlock(true), createElementBlock(Fragment, null, renderList(paths.value, (d, i) => {
1450
- return openBlock(), createElementBlock("path", {
1451
- key: i,
1452
- d,
1453
- fill: "none",
1454
- opacity: __props.opacity,
1455
- onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1456
- (...args) => __props.onClick && __props.onClick(...args)),
1457
- onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1458
- (...args) => __props.onClick && __props.onClick(...args)),
1459
- style: normalizeStyle({
1460
- cursor: __props.isSelected ? "move" : "pointer",
1461
- pointerEvents: __props.isSelected ? "none" : "visibleStroke",
1462
- stroke: resolvedColor.value,
1463
- strokeWidth: __props.strokeWidth,
1464
- strokeLinecap: "round",
1465
- strokeLinejoin: "round"
1466
- })
1467
- }, null, 44, _hoisted_2$5);
1468
- }), 128))
1469
- ], 12, _hoisted_1$6);
1689
+ return openBlock(), createBlock(_sfc_main$s, mergeProps(__props.currentObject, {
1690
+ isSelected: __props.isSelected,
1691
+ scale: __props.scale,
1692
+ onClick: __props.onClick,
1693
+ appearanceActive: __props.appearanceActive
1694
+ }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
1470
1695
  };
1471
1696
  }
1472
1697
  });
1473
1698
  const _hoisted_1$5 = ["width", "height", "viewBox"];
1474
- const _hoisted_2$4 = ["x1", "y1", "x2", "y2", "opacity"];
1475
- const _hoisted_3$3 = ["d", "transform", "stroke", "fill"];
1476
- const _hoisted_4$3 = ["d", "transform", "stroke", "fill"];
1477
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
1699
+ const _hoisted_2$3 = ["x1", "y1", "x2", "y2", "stroke-width"];
1700
+ const _hoisted_3$3 = ["d", "transform", "stroke-width"];
1701
+ const _hoisted_4$3 = ["d", "transform", "stroke-width"];
1702
+ const _hoisted_5$2 = ["x1", "y1", "x2", "y2", "opacity"];
1703
+ const _hoisted_6$1 = ["d", "transform", "stroke", "fill"];
1704
+ const _hoisted_7$1 = ["d", "transform", "stroke", "fill"];
1705
+ const __default__$9 = { inheritAttrs: false };
1706
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1707
+ ...__default__$9,
1478
1708
  __name: "line",
1479
1709
  props: {
1480
1710
  color: { default: "transparent" },
@@ -1488,9 +1718,11 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
1488
1718
  lineEndings: {},
1489
1719
  scale: {},
1490
1720
  onClick: {},
1491
- isSelected: { type: Boolean }
1721
+ isSelected: { type: Boolean },
1722
+ appearanceActive: { type: Boolean, default: false }
1492
1723
  },
1493
1724
  setup(__props) {
1725
+ const MIN_HIT_AREA_SCREEN_PX = 20;
1494
1726
  const props = __props;
1495
1727
  const localLine = computed(() => ({
1496
1728
  x1: props.linePoints.start.x - props.rect.origin.x,
@@ -1513,22 +1745,13 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
1513
1745
  end: patching.createEnding((_b = props.lineEndings) == null ? void 0 : _b.end, props.strokeWidth, angle, x2, y2)
1514
1746
  };
1515
1747
  });
1516
- const getEndingStyle = (ending) => {
1517
- var _a;
1518
- return {
1519
- cursor: props.isSelected ? "move" : "pointer",
1520
- strokeWidth: props.strokeWidth,
1521
- strokeLinecap: "butt",
1522
- pointerEvents: props.isSelected ? "none" : ending.filled ? "visible" : "visibleStroke",
1523
- ...props.strokeStyle === PdfAnnotationBorderStyle.DASHED && {
1524
- strokeDasharray: (_a = props.strokeDashArray) == null ? void 0 : _a.join(",")
1525
- }
1526
- };
1527
- };
1528
1748
  const width = computed(() => props.rect.size.width * props.scale);
1529
1749
  const height = computed(() => props.rect.size.height * props.scale);
1750
+ const hitStrokeWidth = computed(
1751
+ () => Math.max(props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / props.scale)
1752
+ );
1530
1753
  return (_ctx, _cache) => {
1531
- var _a;
1754
+ var _a, _b, _c;
1532
1755
  return openBlock(), createElementBlock("svg", {
1533
1756
  style: normalizeStyle({
1534
1757
  position: "absolute",
@@ -1547,7 +1770,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
1547
1770
  y1: localLine.value.y1,
1548
1771
  x2: localLine.value.x2,
1549
1772
  y2: localLine.value.y2,
1550
- opacity: __props.opacity,
1773
+ stroke: "transparent",
1774
+ "stroke-width": hitStrokeWidth.value,
1551
1775
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1552
1776
  (...args) => __props.onClick && __props.onClick(...args)),
1553
1777
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
@@ -1555,258 +1779,151 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
1555
1779
  style: normalizeStyle({
1556
1780
  cursor: __props.isSelected ? "move" : "pointer",
1557
1781
  pointerEvents: __props.isSelected ? "none" : "visibleStroke",
1558
- stroke: __props.strokeColor,
1559
- strokeWidth: __props.strokeWidth,
1560
- strokeLinecap: "butt",
1561
- ...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
1562
- strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
1563
- }
1782
+ strokeLinecap: "butt"
1564
1783
  })
1565
- }, null, 44, _hoisted_2$4),
1784
+ }, null, 44, _hoisted_2$3),
1566
1785
  endings.value.start ? (openBlock(), createElementBlock("path", {
1567
1786
  key: 0,
1568
1787
  d: endings.value.start.d,
1569
1788
  transform: endings.value.start.transform,
1789
+ fill: "transparent",
1790
+ stroke: "transparent",
1791
+ "stroke-width": hitStrokeWidth.value,
1570
1792
  onPointerdown: _cache[2] || (_cache[2] = //@ts-ignore
1571
1793
  (...args) => __props.onClick && __props.onClick(...args)),
1572
1794
  onTouchstart: _cache[3] || (_cache[3] = //@ts-ignore
1573
1795
  (...args) => __props.onClick && __props.onClick(...args)),
1574
- stroke: __props.strokeColor,
1575
- style: normalizeStyle(getEndingStyle(endings.value.start)),
1576
- fill: endings.value.start.filled ? __props.color : "none"
1796
+ style: normalizeStyle({
1797
+ cursor: __props.isSelected ? "move" : "pointer",
1798
+ pointerEvents: __props.isSelected ? "none" : endings.value.start.filled ? "visible" : "visibleStroke",
1799
+ strokeLinecap: "butt"
1800
+ })
1577
1801
  }, null, 44, _hoisted_3$3)) : createCommentVNode("", true),
1578
1802
  endings.value.end ? (openBlock(), createElementBlock("path", {
1579
1803
  key: 1,
1580
1804
  d: endings.value.end.d,
1581
1805
  transform: endings.value.end.transform,
1806
+ fill: "transparent",
1807
+ stroke: "transparent",
1808
+ "stroke-width": hitStrokeWidth.value,
1582
1809
  onPointerdown: _cache[4] || (_cache[4] = //@ts-ignore
1583
1810
  (...args) => __props.onClick && __props.onClick(...args)),
1584
1811
  onTouchstart: _cache[5] || (_cache[5] = //@ts-ignore
1585
1812
  (...args) => __props.onClick && __props.onClick(...args)),
1586
- stroke: __props.strokeColor,
1587
- style: normalizeStyle(getEndingStyle(endings.value.end)),
1588
- fill: endings.value.end.filled ? __props.color : "none"
1589
- }, null, 44, _hoisted_4$3)) : createCommentVNode("", true)
1813
+ style: normalizeStyle({
1814
+ cursor: __props.isSelected ? "move" : "pointer",
1815
+ pointerEvents: __props.isSelected ? "none" : endings.value.end.filled ? "visible" : "visibleStroke",
1816
+ strokeLinecap: "butt"
1817
+ })
1818
+ }, null, 44, _hoisted_4$3)) : createCommentVNode("", true),
1819
+ !__props.appearanceActive ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
1820
+ createElementVNode("line", {
1821
+ x1: localLine.value.x1,
1822
+ y1: localLine.value.y1,
1823
+ x2: localLine.value.x2,
1824
+ y2: localLine.value.y2,
1825
+ opacity: __props.opacity,
1826
+ style: normalizeStyle({
1827
+ pointerEvents: "none",
1828
+ stroke: __props.strokeColor,
1829
+ strokeWidth: __props.strokeWidth,
1830
+ strokeLinecap: "butt",
1831
+ ...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
1832
+ strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
1833
+ }
1834
+ })
1835
+ }, null, 12, _hoisted_5$2),
1836
+ endings.value.start ? (openBlock(), createElementBlock("path", {
1837
+ key: 0,
1838
+ d: endings.value.start.d,
1839
+ transform: endings.value.start.transform,
1840
+ stroke: __props.strokeColor,
1841
+ fill: endings.value.start.filled ? __props.color : "none",
1842
+ style: normalizeStyle({
1843
+ pointerEvents: "none",
1844
+ strokeWidth: __props.strokeWidth,
1845
+ strokeLinecap: "butt",
1846
+ ...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
1847
+ strokeDasharray: (_b = __props.strokeDashArray) == null ? void 0 : _b.join(",")
1848
+ }
1849
+ })
1850
+ }, null, 12, _hoisted_6$1)) : createCommentVNode("", true),
1851
+ endings.value.end ? (openBlock(), createElementBlock("path", {
1852
+ key: 1,
1853
+ d: endings.value.end.d,
1854
+ transform: endings.value.end.transform,
1855
+ stroke: __props.strokeColor,
1856
+ fill: endings.value.end.filled ? __props.color : "none",
1857
+ style: normalizeStyle({
1858
+ pointerEvents: "none",
1859
+ strokeWidth: __props.strokeWidth,
1860
+ strokeLinecap: "butt",
1861
+ ...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
1862
+ strokeDasharray: (_c = __props.strokeDashArray) == null ? void 0 : _c.join(",")
1863
+ }
1864
+ })
1865
+ }, null, 12, _hoisted_7$1)) : createCommentVNode("", true)
1866
+ ], 64)) : createCommentVNode("", true)
1590
1867
  ], 12, _hoisted_1$5);
1591
1868
  };
1592
1869
  }
1593
1870
  });
1594
- const _hoisted_1$4 = ["width", "height", "viewBox"];
1595
- const _hoisted_2$3 = ["width", "height"];
1596
- const _hoisted_3$2 = ["y1", "x2", "y2", "stroke", "stroke-width", "stroke-dasharray"];
1597
- const _hoisted_4$2 = ["x", "y", "width", "height", "stroke", "stroke-width", "stroke-dasharray"];
1598
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
1599
- __name: "link",
1871
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
1872
+ __name: "line-renderer",
1600
1873
  props: {
1874
+ annotation: {},
1875
+ currentObject: {},
1601
1876
  isSelected: { type: Boolean },
1602
- strokeColor: { default: "#0000FF" },
1603
- strokeWidth: { default: 2 },
1604
- strokeStyle: { default: PdfAnnotationBorderStyle.UNDERLINE },
1605
- strokeDashArray: {},
1877
+ isEditing: { type: Boolean },
1878
+ scale: {},
1879
+ pageIndex: {},
1880
+ documentId: {},
1881
+ onClick: { type: Function },
1882
+ appearanceActive: { type: Boolean }
1883
+ },
1884
+ setup(__props) {
1885
+ return (_ctx, _cache) => {
1886
+ return openBlock(), createBlock(_sfc_main$q, mergeProps(__props.currentObject, {
1887
+ isSelected: __props.isSelected,
1888
+ scale: __props.scale,
1889
+ onClick: __props.onClick,
1890
+ appearanceActive: __props.appearanceActive
1891
+ }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
1892
+ };
1893
+ }
1894
+ });
1895
+ const _hoisted_1$4 = ["width", "height", "viewBox"];
1896
+ const _hoisted_2$2 = ["d", "stroke-width"];
1897
+ const _hoisted_3$2 = ["d", "transform", "stroke-width"];
1898
+ const _hoisted_4$2 = ["d", "transform", "stroke-width"];
1899
+ const _hoisted_5$1 = ["d", "opacity"];
1900
+ const _hoisted_6 = ["d", "transform", "stroke", "fill"];
1901
+ const _hoisted_7 = ["d", "transform", "stroke", "fill"];
1902
+ const __default__$8 = { inheritAttrs: false };
1903
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1904
+ ...__default__$8,
1905
+ __name: "polyline",
1906
+ props: {
1606
1907
  rect: {},
1908
+ vertices: {},
1909
+ color: { default: "transparent" },
1910
+ strokeColor: { default: "#000000" },
1911
+ opacity: { default: 1 },
1912
+ strokeWidth: {},
1607
1913
  scale: {},
1914
+ isSelected: { type: Boolean },
1608
1915
  onClick: {},
1609
- hasIRT: { type: Boolean, default: false }
1916
+ lineEndings: {},
1917
+ appearanceActive: { type: Boolean, default: false }
1610
1918
  },
1611
1919
  setup(__props) {
1920
+ const MIN_HIT_AREA_SCREEN_PX = 20;
1612
1921
  const props = __props;
1613
- const width = computed(() => props.rect.size.width);
1614
- const height = computed(() => props.rect.size.height);
1615
- const svgWidth = computed(() => width.value * props.scale);
1616
- const svgHeight = computed(() => height.value * props.scale);
1617
- const dashArray = computed(() => {
1618
- var _a;
1619
- if (props.strokeStyle === PdfAnnotationBorderStyle.DASHED) {
1620
- return ((_a = props.strokeDashArray) == null ? void 0 : _a.join(",")) ?? `${props.strokeWidth * 3},${props.strokeWidth}`;
1621
- }
1622
- return void 0;
1623
- });
1624
- const isUnderline2 = computed(() => props.strokeStyle === PdfAnnotationBorderStyle.UNDERLINE);
1625
- const hitAreaCursor = computed(
1626
- () => props.hasIRT ? "default" : props.isSelected ? "move" : "pointer"
1627
- );
1628
- const hitAreaPointerEvents = computed(
1629
- () => props.hasIRT ? "none" : props.isSelected ? "none" : "visible"
1630
- );
1631
- return (_ctx, _cache) => {
1632
- return openBlock(), createElementBlock("svg", {
1633
- style: normalizeStyle({
1634
- position: "absolute",
1635
- width: `${svgWidth.value}px`,
1636
- height: `${svgHeight.value}px`,
1637
- pointerEvents: "none",
1638
- zIndex: 2
1639
- }),
1640
- width: svgWidth.value,
1641
- height: svgHeight.value,
1642
- viewBox: `0 0 ${width.value} ${height.value}`
1643
- }, [
1644
- createElementVNode("rect", {
1645
- x: 0,
1646
- y: 0,
1647
- width: width.value,
1648
- height: height.value,
1649
- fill: "transparent",
1650
- onPointerdown: _cache[0] || (_cache[0] = ($event) => __props.hasIRT ? void 0 : __props.onClick),
1651
- onTouchstart: _cache[1] || (_cache[1] = ($event) => __props.hasIRT ? void 0 : __props.onClick),
1652
- style: normalizeStyle({
1653
- cursor: hitAreaCursor.value,
1654
- pointerEvents: hitAreaPointerEvents.value
1655
- })
1656
- }, null, 44, _hoisted_2$3),
1657
- isUnderline2.value ? (openBlock(), createElementBlock("line", {
1658
- key: 0,
1659
- x1: 1,
1660
- y1: height.value - 1,
1661
- x2: width.value - 1,
1662
- y2: height.value - 1,
1663
- stroke: __props.strokeColor,
1664
- "stroke-width": __props.strokeWidth,
1665
- "stroke-dasharray": dashArray.value,
1666
- style: { "pointer-events": "none" }
1667
- }, null, 8, _hoisted_3$2)) : (openBlock(), createElementBlock("rect", {
1668
- key: 1,
1669
- x: __props.strokeWidth / 2,
1670
- y: __props.strokeWidth / 2,
1671
- width: Math.max(width.value - __props.strokeWidth, 0),
1672
- height: Math.max(height.value - __props.strokeWidth, 0),
1673
- fill: "transparent",
1674
- stroke: __props.strokeColor,
1675
- "stroke-width": __props.strokeWidth,
1676
- "stroke-dasharray": dashArray.value,
1677
- style: { "pointer-events": "none" }
1678
- }, null, 8, _hoisted_4$2))
1679
- ], 12, _hoisted_1$4);
1680
- };
1681
- }
1682
- });
1683
- const _hoisted_1$3 = ["width", "height", "viewBox"];
1684
- const _hoisted_2$2 = ["d", "opacity"];
1685
- const _hoisted_3$1 = ["d"];
1686
- const _hoisted_4$1 = ["x", "y", "width", "height", "fill", "stroke", "stroke-width"];
1687
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
1688
- __name: "polygon",
1689
- props: {
1690
- rect: {},
1691
- vertices: {},
1692
- color: { default: "transparent" },
1693
- strokeColor: { default: "#000000" },
1694
- opacity: { default: 1 },
1695
- strokeWidth: {},
1696
- strokeStyle: { default: PdfAnnotationBorderStyle.SOLID },
1697
- strokeDashArray: {},
1698
- scale: {},
1699
- isSelected: { type: Boolean },
1700
- onClick: {},
1701
- currentVertex: {},
1702
- handleSize: { default: 14 }
1703
- },
1704
- setup(__props) {
1705
- const props = __props;
1706
- const allPoints = computed(
1707
- () => props.currentVertex ? [...props.vertices, props.currentVertex] : props.vertices
1708
- );
1709
- const localPts = computed(
1710
- () => allPoints.value.map(({ x, y }) => ({
1711
- x: x - props.rect.origin.x,
1712
- y: y - props.rect.origin.y
1713
- }))
1714
- );
1715
- const pathData = computed(() => {
1716
- if (!localPts.value.length) return "";
1717
- const [first, ...rest] = localPts.value;
1718
- const isPreview = !!props.currentVertex;
1719
- return (`M ${first.x} ${first.y} ` + rest.map((p) => `L ${p.x} ${p.y}`).join(" ") + (isPreview ? "" : " Z")).trim();
1720
- });
1721
- const isPreviewing = computed(() => props.currentVertex && props.vertices.length > 0);
1722
- const width = computed(() => props.rect.size.width * props.scale);
1723
- const height = computed(() => props.rect.size.height * props.scale);
1724
- return (_ctx, _cache) => {
1725
- var _a;
1726
- return openBlock(), createElementBlock("svg", {
1727
- style: normalizeStyle({
1728
- position: "absolute",
1729
- width: `${width.value}px`,
1730
- height: `${height.value}px`,
1731
- pointerEvents: "none",
1732
- zIndex: 2,
1733
- overflow: "visible"
1734
- }),
1735
- width: width.value,
1736
- height: height.value,
1737
- viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`
1738
- }, [
1739
- createElementVNode("path", {
1740
- d: pathData.value,
1741
- onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1742
- (...args) => __props.onClick && __props.onClick(...args)),
1743
- onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1744
- (...args) => __props.onClick && __props.onClick(...args)),
1745
- opacity: __props.opacity,
1746
- style: normalizeStyle({
1747
- fill: __props.currentVertex ? "none" : __props.color,
1748
- stroke: __props.strokeColor ?? __props.color,
1749
- strokeWidth: __props.strokeWidth,
1750
- cursor: __props.isSelected ? "move" : "pointer",
1751
- pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible",
1752
- strokeLinecap: "butt",
1753
- strokeLinejoin: "miter",
1754
- ...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
1755
- strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
1756
- }
1757
- })
1758
- }, null, 44, _hoisted_2$2),
1759
- isPreviewing.value && localPts.value.length > 1 ? (openBlock(), createElementBlock("path", {
1760
- key: 0,
1761
- d: `M ${localPts.value[localPts.value.length - 1].x} ${localPts.value[localPts.value.length - 1].y} L ${localPts.value[0].x} ${localPts.value[0].y}`,
1762
- fill: "none",
1763
- style: normalizeStyle({
1764
- stroke: __props.strokeColor,
1765
- strokeWidth: __props.strokeWidth,
1766
- strokeDasharray: "4,4",
1767
- opacity: 0.7
1768
- })
1769
- }, null, 12, _hoisted_3$1)) : createCommentVNode("", true),
1770
- isPreviewing.value && localPts.value.length >= 2 ? (openBlock(), createElementBlock("rect", {
1771
- key: 1,
1772
- x: localPts.value[0].x - __props.handleSize / __props.scale / 2,
1773
- y: localPts.value[0].y - __props.handleSize / __props.scale / 2,
1774
- width: __props.handleSize / __props.scale,
1775
- height: __props.handleSize / __props.scale,
1776
- fill: __props.strokeColor,
1777
- opacity: 0.4,
1778
- stroke: __props.strokeColor,
1779
- "stroke-width": __props.strokeWidth / 2
1780
- }, null, 8, _hoisted_4$1)) : createCommentVNode("", true)
1781
- ], 12, _hoisted_1$3);
1782
- };
1783
- }
1784
- });
1785
- const _hoisted_1$2 = ["width", "height", "viewBox"];
1786
- const _hoisted_2$1 = ["d", "opacity"];
1787
- const _hoisted_3 = ["d", "transform", "stroke", "fill"];
1788
- const _hoisted_4 = ["d", "transform", "stroke", "fill"];
1789
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
1790
- __name: "polyline",
1791
- props: {
1792
- rect: {},
1793
- vertices: {},
1794
- color: { default: "transparent" },
1795
- strokeColor: { default: "#000000" },
1796
- opacity: { default: 1 },
1797
- strokeWidth: {},
1798
- scale: {},
1799
- isSelected: { type: Boolean },
1800
- onClick: {},
1801
- lineEndings: {}
1802
- },
1803
- setup(__props) {
1804
- const props = __props;
1805
- const localPts = computed(
1806
- () => props.vertices.map(({ x, y }) => ({
1807
- x: x - props.rect.origin.x,
1808
- y: y - props.rect.origin.y
1809
- }))
1922
+ const localPts = computed(
1923
+ () => props.vertices.map(({ x, y }) => ({
1924
+ x: x - props.rect.origin.x,
1925
+ y: y - props.rect.origin.y
1926
+ }))
1810
1927
  );
1811
1928
  const pathData = computed(() => {
1812
1929
  if (localPts.value.length === 0) return "";
@@ -1839,14 +1956,11 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1839
1956
  )
1840
1957
  };
1841
1958
  });
1842
- const getEndingStyle = (ending) => ({
1843
- cursor: props.isSelected ? "move" : "pointer",
1844
- strokeWidth: props.strokeWidth,
1845
- pointerEvents: props.isSelected ? "none" : ending.filled ? "visible" : "visibleStroke",
1846
- strokeLinecap: "butt"
1847
- });
1848
1959
  const width = computed(() => props.rect.size.width * props.scale);
1849
1960
  const height = computed(() => props.rect.size.height * props.scale);
1961
+ const hitStrokeWidth = computed(
1962
+ () => Math.max(props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / props.scale)
1963
+ );
1850
1964
  return (_ctx, _cache) => {
1851
1965
  return openBlock(), createElementBlock("svg", {
1852
1966
  style: normalizeStyle({
@@ -1863,102 +1977,189 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1863
1977
  }, [
1864
1978
  createElementVNode("path", {
1865
1979
  d: pathData.value,
1980
+ fill: "none",
1981
+ stroke: "transparent",
1982
+ "stroke-width": hitStrokeWidth.value,
1866
1983
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1867
1984
  (...args) => __props.onClick && __props.onClick(...args)),
1868
1985
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1869
1986
  (...args) => __props.onClick && __props.onClick(...args)),
1870
- opacity: __props.opacity,
1871
1987
  style: normalizeStyle({
1872
- fill: "none",
1873
- stroke: __props.strokeColor ?? __props.color,
1874
- strokeWidth: __props.strokeWidth,
1875
1988
  cursor: __props.isSelected ? "move" : "pointer",
1876
1989
  pointerEvents: __props.isSelected ? "none" : "visibleStroke",
1877
1990
  strokeLinecap: "butt",
1878
1991
  strokeLinejoin: "miter"
1879
1992
  })
1880
- }, null, 44, _hoisted_2$1),
1993
+ }, null, 44, _hoisted_2$2),
1881
1994
  endings.value.start ? (openBlock(), createElementBlock("path", {
1882
1995
  key: 0,
1883
1996
  d: endings.value.start.d,
1884
1997
  transform: endings.value.start.transform,
1885
- stroke: __props.strokeColor,
1886
- fill: endings.value.start.filled ? __props.color : "none",
1998
+ fill: "transparent",
1999
+ stroke: "transparent",
2000
+ "stroke-width": hitStrokeWidth.value,
1887
2001
  onPointerdown: _cache[2] || (_cache[2] = //@ts-ignore
1888
2002
  (...args) => __props.onClick && __props.onClick(...args)),
1889
2003
  onTouchstart: _cache[3] || (_cache[3] = //@ts-ignore
1890
2004
  (...args) => __props.onClick && __props.onClick(...args)),
1891
- style: normalizeStyle(getEndingStyle(endings.value.start))
1892
- }, null, 44, _hoisted_3)) : createCommentVNode("", true),
2005
+ style: normalizeStyle({
2006
+ cursor: __props.isSelected ? "move" : "pointer",
2007
+ pointerEvents: __props.isSelected ? "none" : endings.value.start.filled ? "visible" : "visibleStroke",
2008
+ strokeLinecap: "butt"
2009
+ })
2010
+ }, null, 44, _hoisted_3$2)) : createCommentVNode("", true),
1893
2011
  endings.value.end ? (openBlock(), createElementBlock("path", {
1894
2012
  key: 1,
1895
2013
  d: endings.value.end.d,
1896
2014
  transform: endings.value.end.transform,
1897
- stroke: __props.strokeColor,
1898
- fill: endings.value.end.filled ? __props.color : "none",
2015
+ fill: "transparent",
2016
+ stroke: "transparent",
2017
+ "stroke-width": hitStrokeWidth.value,
1899
2018
  onPointerdown: _cache[4] || (_cache[4] = //@ts-ignore
1900
2019
  (...args) => __props.onClick && __props.onClick(...args)),
1901
2020
  onTouchstart: _cache[5] || (_cache[5] = //@ts-ignore
1902
2021
  (...args) => __props.onClick && __props.onClick(...args)),
1903
- style: normalizeStyle(getEndingStyle(endings.value.end))
1904
- }, null, 44, _hoisted_4)) : createCommentVNode("", true)
1905
- ], 12, _hoisted_1$2);
2022
+ style: normalizeStyle({
2023
+ cursor: __props.isSelected ? "move" : "pointer",
2024
+ pointerEvents: __props.isSelected ? "none" : endings.value.end.filled ? "visible" : "visibleStroke",
2025
+ strokeLinecap: "butt"
2026
+ })
2027
+ }, null, 44, _hoisted_4$2)) : createCommentVNode("", true),
2028
+ !__props.appearanceActive ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2029
+ createElementVNode("path", {
2030
+ d: pathData.value,
2031
+ opacity: __props.opacity,
2032
+ style: normalizeStyle({
2033
+ fill: "none",
2034
+ stroke: __props.strokeColor ?? __props.color,
2035
+ strokeWidth: __props.strokeWidth,
2036
+ pointerEvents: "none",
2037
+ strokeLinecap: "butt",
2038
+ strokeLinejoin: "miter"
2039
+ })
2040
+ }, null, 12, _hoisted_5$1),
2041
+ endings.value.start ? (openBlock(), createElementBlock("path", {
2042
+ key: 0,
2043
+ d: endings.value.start.d,
2044
+ transform: endings.value.start.transform,
2045
+ stroke: __props.strokeColor,
2046
+ fill: endings.value.start.filled ? __props.color : "none",
2047
+ style: normalizeStyle({
2048
+ pointerEvents: "none",
2049
+ strokeWidth: __props.strokeWidth,
2050
+ strokeLinecap: "butt"
2051
+ })
2052
+ }, null, 12, _hoisted_6)) : createCommentVNode("", true),
2053
+ endings.value.end ? (openBlock(), createElementBlock("path", {
2054
+ key: 1,
2055
+ d: endings.value.end.d,
2056
+ transform: endings.value.end.transform,
2057
+ stroke: __props.strokeColor,
2058
+ fill: endings.value.end.filled ? __props.color : "none",
2059
+ style: normalizeStyle({
2060
+ pointerEvents: "none",
2061
+ strokeWidth: __props.strokeWidth,
2062
+ strokeLinecap: "butt"
2063
+ })
2064
+ }, null, 12, _hoisted_7)) : createCommentVNode("", true)
2065
+ ], 64)) : createCommentVNode("", true)
2066
+ ], 12, _hoisted_1$4);
1906
2067
  };
1907
2068
  }
1908
2069
  });
1909
- const _hoisted_1$1 = ["width", "height", "viewBox"];
1910
- const _hoisted_2 = ["x", "y", "width", "height", "fill", "opacity"];
1911
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
1912
- __name: "square",
2070
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2071
+ __name: "polyline-renderer",
1913
2072
  props: {
2073
+ annotation: {},
2074
+ currentObject: {},
1914
2075
  isSelected: { type: Boolean },
1915
- color: { default: "#000000" },
1916
- strokeColor: {},
2076
+ isEditing: { type: Boolean },
2077
+ scale: {},
2078
+ pageIndex: {},
2079
+ documentId: {},
2080
+ onClick: { type: Function },
2081
+ appearanceActive: { type: Boolean }
2082
+ },
2083
+ setup(__props) {
2084
+ return (_ctx, _cache) => {
2085
+ return openBlock(), createBlock(_sfc_main$o, mergeProps(__props.currentObject, {
2086
+ isSelected: __props.isSelected,
2087
+ scale: __props.scale,
2088
+ onClick: __props.onClick,
2089
+ appearanceActive: __props.appearanceActive
2090
+ }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
2091
+ };
2092
+ }
2093
+ });
2094
+ const _hoisted_1$3 = ["width", "height", "viewBox"];
2095
+ const _hoisted_2$1 = ["d", "stroke-width"];
2096
+ const _hoisted_3$1 = ["d", "opacity"];
2097
+ const _hoisted_4$1 = ["d"];
2098
+ const _hoisted_5 = ["x", "y", "width", "height", "fill", "stroke", "stroke-width"];
2099
+ const __default__$7 = { inheritAttrs: false };
2100
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2101
+ ...__default__$7,
2102
+ __name: "polygon",
2103
+ props: {
2104
+ rect: {},
2105
+ vertices: {},
2106
+ color: { default: "transparent" },
2107
+ strokeColor: { default: "#000000" },
1917
2108
  opacity: { default: 1 },
1918
2109
  strokeWidth: {},
1919
2110
  strokeStyle: { default: PdfAnnotationBorderStyle.SOLID },
1920
2111
  strokeDashArray: {},
1921
- rect: {},
1922
2112
  scale: {},
1923
- onClick: {}
2113
+ isSelected: { type: Boolean },
2114
+ onClick: {},
2115
+ currentVertex: {},
2116
+ handleSize: { default: 14 },
2117
+ appearanceActive: { type: Boolean, default: false }
1924
2118
  },
1925
2119
  setup(__props) {
2120
+ const MIN_HIT_AREA_SCREEN_PX = 20;
1926
2121
  const props = __props;
1927
- const geometry = computed(() => {
1928
- const outerW = props.rect.size.width;
1929
- const outerH = props.rect.size.height;
1930
- const innerW = Math.max(outerW - props.strokeWidth, 0);
1931
- const innerH = Math.max(outerH - props.strokeWidth, 0);
1932
- return {
1933
- width: innerW,
1934
- height: innerH,
1935
- x: props.strokeWidth / 2,
1936
- y: props.strokeWidth / 2
1937
- };
2122
+ const allPoints = computed(
2123
+ () => props.currentVertex ? [...props.vertices, props.currentVertex] : props.vertices
2124
+ );
2125
+ const localPts = computed(
2126
+ () => allPoints.value.map(({ x, y }) => ({
2127
+ x: x - props.rect.origin.x,
2128
+ y: y - props.rect.origin.y
2129
+ }))
2130
+ );
2131
+ const pathData = computed(() => {
2132
+ if (!localPts.value.length) return "";
2133
+ const [first, ...rest] = localPts.value;
2134
+ const isPreview = !!props.currentVertex;
2135
+ return (`M ${first.x} ${first.y} ` + rest.map((p) => `L ${p.x} ${p.y}`).join(" ") + (isPreview ? "" : " Z")).trim();
1938
2136
  });
1939
- const svgWidth = computed(() => (geometry.value.width + props.strokeWidth) * props.scale);
1940
- const svgHeight = computed(() => (geometry.value.height + props.strokeWidth) * props.scale);
2137
+ const isPreviewing = computed(() => props.currentVertex && props.vertices.length > 0);
2138
+ const width = computed(() => props.rect.size.width * props.scale);
2139
+ const height = computed(() => props.rect.size.height * props.scale);
2140
+ const hitStrokeWidth = computed(
2141
+ () => Math.max(props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / props.scale)
2142
+ );
1941
2143
  return (_ctx, _cache) => {
1942
2144
  var _a;
1943
2145
  return openBlock(), createElementBlock("svg", {
1944
2146
  style: normalizeStyle({
1945
2147
  position: "absolute",
1946
- width: svgWidth.value,
1947
- height: svgHeight.value,
2148
+ width: `${width.value}px`,
2149
+ height: `${height.value}px`,
1948
2150
  pointerEvents: "none",
1949
- zIndex: 2
2151
+ zIndex: 2,
2152
+ overflow: "visible"
1950
2153
  }),
1951
- width: svgWidth.value,
1952
- height: svgHeight.value,
1953
- viewBox: `0 0 ${geometry.value.width + __props.strokeWidth} ${geometry.value.height + __props.strokeWidth}`
1954
- }, [
1955
- createElementVNode("rect", {
1956
- x: geometry.value.x,
1957
- y: geometry.value.y,
1958
- width: geometry.value.width,
1959
- height: geometry.value.height,
1960
- fill: __props.color,
1961
- opacity: __props.opacity,
2154
+ width: width.value,
2155
+ height: height.value,
2156
+ viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`
2157
+ }, [
2158
+ createElementVNode("path", {
2159
+ d: pathData.value,
2160
+ fill: "transparent",
2161
+ stroke: "transparent",
2162
+ "stroke-width": hitStrokeWidth.value,
1962
2163
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1963
2164
  (...args) => __props.onClick && __props.onClick(...args)),
1964
2165
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
@@ -1966,19 +2167,226 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
1966
2167
  style: normalizeStyle({
1967
2168
  cursor: __props.isSelected ? "move" : "pointer",
1968
2169
  pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible",
1969
- stroke: __props.strokeColor ?? __props.color,
1970
- strokeWidth: __props.strokeWidth,
1971
- ...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
1972
- strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
1973
- }
2170
+ strokeLinecap: "butt",
2171
+ strokeLinejoin: "miter"
1974
2172
  })
1975
- }, null, 44, _hoisted_2)
1976
- ], 12, _hoisted_1$1);
2173
+ }, null, 44, _hoisted_2$1),
2174
+ !__props.appearanceActive ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2175
+ createElementVNode("path", {
2176
+ d: pathData.value,
2177
+ opacity: __props.opacity,
2178
+ style: normalizeStyle({
2179
+ fill: __props.currentVertex ? "none" : __props.color,
2180
+ stroke: __props.strokeColor ?? __props.color,
2181
+ strokeWidth: __props.strokeWidth,
2182
+ pointerEvents: "none",
2183
+ strokeLinecap: "butt",
2184
+ strokeLinejoin: "miter",
2185
+ ...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
2186
+ strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
2187
+ }
2188
+ })
2189
+ }, null, 12, _hoisted_3$1),
2190
+ isPreviewing.value && localPts.value.length > 1 ? (openBlock(), createElementBlock("path", {
2191
+ key: 0,
2192
+ d: `M ${localPts.value[localPts.value.length - 1].x} ${localPts.value[localPts.value.length - 1].y} L ${localPts.value[0].x} ${localPts.value[0].y}`,
2193
+ fill: "none",
2194
+ style: normalizeStyle({
2195
+ stroke: __props.strokeColor,
2196
+ strokeWidth: __props.strokeWidth,
2197
+ strokeDasharray: "4,4",
2198
+ opacity: 0.7,
2199
+ pointerEvents: "none"
2200
+ })
2201
+ }, null, 12, _hoisted_4$1)) : createCommentVNode("", true),
2202
+ isPreviewing.value && localPts.value.length >= 2 ? (openBlock(), createElementBlock("rect", {
2203
+ key: 1,
2204
+ x: localPts.value[0].x - __props.handleSize / __props.scale / 2,
2205
+ y: localPts.value[0].y - __props.handleSize / __props.scale / 2,
2206
+ width: __props.handleSize / __props.scale,
2207
+ height: __props.handleSize / __props.scale,
2208
+ fill: __props.strokeColor,
2209
+ opacity: 0.4,
2210
+ stroke: __props.strokeColor,
2211
+ "stroke-width": __props.strokeWidth / 2,
2212
+ style: { "pointer-events": "none" }
2213
+ }, null, 8, _hoisted_5)) : createCommentVNode("", true)
2214
+ ], 64)) : createCommentVNode("", true)
2215
+ ], 12, _hoisted_1$3);
1977
2216
  };
1978
2217
  }
1979
2218
  });
1980
- const _hoisted_1 = ["src"];
1981
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
2219
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2220
+ __name: "polygon-renderer",
2221
+ props: {
2222
+ annotation: {},
2223
+ currentObject: {},
2224
+ isSelected: { type: Boolean },
2225
+ isEditing: { type: Boolean },
2226
+ scale: {},
2227
+ pageIndex: {},
2228
+ documentId: {},
2229
+ onClick: { type: Function },
2230
+ appearanceActive: { type: Boolean }
2231
+ },
2232
+ setup(__props) {
2233
+ return (_ctx, _cache) => {
2234
+ return openBlock(), createBlock(_sfc_main$m, mergeProps(__props.currentObject, {
2235
+ isSelected: __props.isSelected,
2236
+ scale: __props.scale,
2237
+ onClick: __props.onClick,
2238
+ appearanceActive: __props.appearanceActive
2239
+ }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
2240
+ };
2241
+ }
2242
+ });
2243
+ const _hoisted_1$2 = ["contenteditable"];
2244
+ const __default__$6 = { inheritAttrs: false };
2245
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2246
+ ...__default__$6,
2247
+ __name: "free-text",
2248
+ props: {
2249
+ documentId: {},
2250
+ isSelected: { type: Boolean },
2251
+ isEditing: { type: Boolean },
2252
+ annotation: {},
2253
+ pageIndex: {},
2254
+ scale: {},
2255
+ onClick: {},
2256
+ appearanceActive: { type: Boolean, default: false }
2257
+ },
2258
+ setup(__props) {
2259
+ const props = __props;
2260
+ const editorRef = ref(null);
2261
+ const editingRef = ref(false);
2262
+ const { provides: annotationCapability } = useAnnotationCapability();
2263
+ const annotationProvides = computed(
2264
+ () => {
2265
+ var _a;
2266
+ return ((_a = annotationCapability.value) == null ? void 0 : _a.forDocument(props.documentId)) ?? null;
2267
+ }
2268
+ );
2269
+ const isIOS = ref(false);
2270
+ onMounted(() => {
2271
+ try {
2272
+ const nav = navigator;
2273
+ isIOS.value = /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && (nav == null ? void 0 : nav.maxTouchPoints) > 1;
2274
+ } catch {
2275
+ isIOS.value = false;
2276
+ }
2277
+ });
2278
+ watch(
2279
+ () => props.isEditing,
2280
+ (editing) => {
2281
+ if (editing && editorRef.value) {
2282
+ editingRef.value = true;
2283
+ const editor = editorRef.value;
2284
+ editor.focus();
2285
+ const selection = window.getSelection();
2286
+ if (selection) {
2287
+ const range = document.createRange();
2288
+ range.selectNodeContents(editor);
2289
+ range.collapse(false);
2290
+ selection.removeAllRanges();
2291
+ selection.addRange(range);
2292
+ }
2293
+ }
2294
+ }
2295
+ );
2296
+ const handleBlur = () => {
2297
+ if (!editingRef.value) return;
2298
+ editingRef.value = false;
2299
+ if (!annotationProvides.value || !editorRef.value) return;
2300
+ annotationProvides.value.updateAnnotation(props.pageIndex, props.annotation.object.id, {
2301
+ contents: editorRef.value.innerText
2302
+ });
2303
+ };
2304
+ const editorStyle = computed(() => {
2305
+ const { object: anno } = props.annotation;
2306
+ const computedFontPx = anno.fontSize * props.scale;
2307
+ const MIN_IOS_FOCUS_FONT_PX = 16;
2308
+ const needsComp = isIOS.value && props.isEditing && computedFontPx > 0 && computedFontPx < MIN_IOS_FOCUS_FONT_PX;
2309
+ const adjustedFontPx = needsComp ? MIN_IOS_FOCUS_FONT_PX : computedFontPx;
2310
+ const scaleComp = needsComp ? computedFontPx / MIN_IOS_FOCUS_FONT_PX : 1;
2311
+ const invScalePercent = needsComp ? 100 / scaleComp : 100;
2312
+ return {
2313
+ color: anno.fontColor,
2314
+ fontSize: `${adjustedFontPx}px`,
2315
+ ...standardFontCssProperties(anno.fontFamily),
2316
+ textAlign: textAlignmentToCss(anno.textAlign),
2317
+ flexDirection: "column",
2318
+ justifyContent: anno.verticalAlign === PdfVerticalAlignment.Top ? "flex-start" : anno.verticalAlign === PdfVerticalAlignment.Middle ? "center" : "flex-end",
2319
+ display: "flex",
2320
+ backgroundColor: anno.color ?? anno.backgroundColor,
2321
+ opacity: anno.opacity,
2322
+ width: needsComp ? `${invScalePercent}%` : "100%",
2323
+ height: needsComp ? `${invScalePercent}%` : "100%",
2324
+ lineHeight: "1.18",
2325
+ overflow: "hidden",
2326
+ cursor: props.isEditing ? "text" : "pointer",
2327
+ outline: "none",
2328
+ transform: needsComp ? `scale(${scaleComp})` : void 0,
2329
+ transformOrigin: "top left"
2330
+ };
2331
+ });
2332
+ return (_ctx, _cache) => {
2333
+ return openBlock(), createElementBlock("div", {
2334
+ style: normalizeStyle({
2335
+ position: "absolute",
2336
+ width: `${__props.annotation.object.rect.size.width * __props.scale}px`,
2337
+ height: `${__props.annotation.object.rect.size.height * __props.scale}px`,
2338
+ cursor: __props.isSelected && !__props.isEditing ? "move" : "default",
2339
+ pointerEvents: __props.isSelected && !__props.isEditing ? "none" : "auto",
2340
+ zIndex: 2,
2341
+ opacity: __props.appearanceActive ? 0 : 1
2342
+ }),
2343
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
2344
+ (...args) => __props.onClick && __props.onClick(...args)),
2345
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
2346
+ (...args) => __props.onClick && __props.onClick(...args))
2347
+ }, [
2348
+ createElementVNode("span", {
2349
+ ref_key: "editorRef",
2350
+ ref: editorRef,
2351
+ onBlur: handleBlur,
2352
+ tabindex: "0",
2353
+ style: normalizeStyle(editorStyle.value),
2354
+ contenteditable: __props.isEditing
2355
+ }, toDisplayString(__props.annotation.object.contents), 45, _hoisted_1$2)
2356
+ ], 36);
2357
+ };
2358
+ }
2359
+ });
2360
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2361
+ __name: "free-text-renderer",
2362
+ props: {
2363
+ annotation: {},
2364
+ currentObject: {},
2365
+ isSelected: { type: Boolean },
2366
+ isEditing: { type: Boolean },
2367
+ scale: {},
2368
+ pageIndex: {},
2369
+ documentId: {},
2370
+ onClick: { type: Function },
2371
+ appearanceActive: { type: Boolean }
2372
+ },
2373
+ setup(__props) {
2374
+ return (_ctx, _cache) => {
2375
+ return openBlock(), createBlock(_sfc_main$k, {
2376
+ documentId: __props.documentId,
2377
+ isSelected: __props.isSelected,
2378
+ isEditing: __props.isEditing,
2379
+ annotation: { ...__props.annotation, object: __props.currentObject },
2380
+ pageIndex: __props.pageIndex,
2381
+ scale: __props.scale,
2382
+ onClick: __props.onClick,
2383
+ appearanceActive: __props.appearanceActive
2384
+ }, null, 8, ["documentId", "isSelected", "isEditing", "annotation", "pageIndex", "scale", "onClick", "appearanceActive"]);
2385
+ };
2386
+ }
2387
+ });
2388
+ const _hoisted_1$1 = ["src"];
2389
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
1982
2390
  __name: "render-annotation",
1983
2391
  props: {
1984
2392
  documentId: {},
@@ -2073,11 +2481,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2073
2481
  display: "block",
2074
2482
  ...__props.style
2075
2483
  })
2076
- }, null, 44, _hoisted_1)) : createCommentVNode("", true);
2484
+ }, null, 44, _hoisted_1$1)) : createCommentVNode("", true);
2077
2485
  };
2078
2486
  }
2079
2487
  });
2080
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
2488
+ const __default__$5 = { inheritAttrs: false };
2489
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2490
+ ...__default__$5,
2081
2491
  __name: "stamp",
2082
2492
  props: {
2083
2493
  isSelected: { type: Boolean },
@@ -2107,7 +2517,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2107
2517
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
2108
2518
  (...args) => __props.onClick && __props.onClick(...args))
2109
2519
  }, [
2110
- createVNode(_sfc_main$b, {
2520
+ createVNode(_sfc_main$i, {
2111
2521
  documentId: __props.documentId,
2112
2522
  pageIndex: __props.pageIndex,
2113
2523
  annotation: { ...__props.annotation.object, id: __props.annotation.object.id },
@@ -2118,78 +2528,238 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2118
2528
  };
2119
2529
  }
2120
2530
  });
2121
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2122
- __name: "highlight",
2531
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2532
+ __name: "stamp-renderer",
2123
2533
  props: {
2124
- strokeColor: {},
2125
- opacity: { default: 0.5 },
2126
- segmentRects: {},
2127
- rect: {},
2534
+ annotation: {},
2535
+ currentObject: {},
2536
+ isSelected: { type: Boolean },
2537
+ isEditing: { type: Boolean },
2128
2538
  scale: {},
2129
- onClick: {}
2539
+ pageIndex: {},
2540
+ documentId: {},
2541
+ onClick: { type: Function },
2542
+ appearanceActive: { type: Boolean }
2130
2543
  },
2131
2544
  setup(__props) {
2132
- const props = __props;
2133
- const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
2134
2545
  return (_ctx, _cache) => {
2135
- return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (b, i) => {
2136
- return openBlock(), createElementBlock("div", {
2137
- key: i,
2138
- onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
2139
- (...args) => __props.onClick && __props.onClick(...args)),
2140
- onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
2141
- (...args) => __props.onClick && __props.onClick(...args)),
2142
- style: normalizeStyle({
2143
- position: "absolute",
2144
- left: `${(__props.rect ? b.origin.x - __props.rect.origin.x : b.origin.x) * __props.scale}px`,
2145
- top: `${(__props.rect ? b.origin.y - __props.rect.origin.y : b.origin.y) * __props.scale}px`,
2146
- width: `${b.size.width * __props.scale}px`,
2147
- height: `${b.size.height * __props.scale}px`,
2148
- background: resolvedColor.value,
2149
- opacity: __props.opacity,
2150
- pointerEvents: __props.onClick ? "auto" : "none",
2151
- cursor: __props.onClick ? "pointer" : "default",
2152
- zIndex: __props.onClick ? 1 : void 0
2153
- })
2154
- }, null, 36);
2155
- }), 128);
2546
+ return openBlock(), createBlock(_sfc_main$h, {
2547
+ isSelected: __props.isSelected,
2548
+ annotation: __props.annotation,
2549
+ documentId: __props.documentId,
2550
+ pageIndex: __props.pageIndex,
2551
+ scale: __props.scale,
2552
+ onClick: __props.onClick
2553
+ }, null, 8, ["isSelected", "annotation", "documentId", "pageIndex", "scale", "onClick"]);
2156
2554
  };
2157
2555
  }
2158
2556
  });
2159
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2160
- __name: "squiggly",
2557
+ const _hoisted_1 = ["width", "height", "viewBox"];
2558
+ const _hoisted_2 = ["width", "height"];
2559
+ const _hoisted_3 = ["y1", "x2", "y2", "stroke", "stroke-width", "stroke-dasharray"];
2560
+ const _hoisted_4 = ["x", "y", "width", "height", "stroke", "stroke-width", "stroke-dasharray"];
2561
+ const __default__$4 = { inheritAttrs: false };
2562
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2563
+ ...__default__$4,
2564
+ __name: "link",
2161
2565
  props: {
2162
- strokeColor: {},
2163
- opacity: { default: 0.5 },
2164
- segmentRects: {},
2566
+ isSelected: { type: Boolean },
2567
+ strokeColor: { default: "#0000FF" },
2568
+ strokeWidth: { default: 2 },
2569
+ strokeStyle: { default: PdfAnnotationBorderStyle.UNDERLINE },
2570
+ strokeDashArray: {},
2165
2571
  rect: {},
2166
2572
  scale: {},
2167
- onClick: {}
2573
+ onClick: {},
2574
+ hasIRT: { type: Boolean, default: false }
2168
2575
  },
2169
2576
  setup(__props) {
2170
2577
  const props = __props;
2171
- const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
2172
- const amplitude = computed(() => 2 * props.scale);
2173
- const period = computed(() => 6 * props.scale);
2174
- const svgDataUri = computed(() => {
2175
- const amp = amplitude.value;
2176
- const per = period.value;
2177
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${per}" height="${amp * 2}" viewBox="0 0 ${per} ${amp * 2}">
2178
- <path d="M0 ${amp} Q ${per / 4} 0 ${per / 2} ${amp} T ${per} ${amp}"
2179
- fill="none" stroke="${resolvedColor.value}" stroke-width="${amp}" stroke-linecap="round"/>
2180
- </svg>`;
2181
- return `url("data:image/svg+xml;utf8,${encodeURIComponent(svg)}")`;
2578
+ const width = computed(() => props.rect.size.width);
2579
+ const height = computed(() => props.rect.size.height);
2580
+ const svgWidth = computed(() => width.value * props.scale);
2581
+ const svgHeight = computed(() => height.value * props.scale);
2582
+ const dashArray = computed(() => {
2583
+ var _a;
2584
+ if (props.strokeStyle === PdfAnnotationBorderStyle.DASHED) {
2585
+ return ((_a = props.strokeDashArray) == null ? void 0 : _a.join(",")) ?? `${props.strokeWidth * 3},${props.strokeWidth}`;
2586
+ }
2587
+ return void 0;
2182
2588
  });
2589
+ const isUnderline = computed(() => props.strokeStyle === PdfAnnotationBorderStyle.UNDERLINE);
2590
+ const hitAreaCursor = computed(
2591
+ () => props.hasIRT ? "default" : props.isSelected ? "move" : "pointer"
2592
+ );
2593
+ const hitAreaPointerEvents = computed(
2594
+ () => props.hasIRT ? "none" : props.isSelected ? "none" : "visible"
2595
+ );
2183
2596
  return (_ctx, _cache) => {
2184
- return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (r, i) => {
2185
- return openBlock(), createElementBlock("div", {
2186
- key: i,
2187
- onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
2188
- (...args) => __props.onClick && __props.onClick(...args)),
2189
- onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
2190
- (...args) => __props.onClick && __props.onClick(...args)),
2191
- style: normalizeStyle({
2192
- position: "absolute",
2597
+ return openBlock(), createElementBlock("svg", {
2598
+ style: normalizeStyle({
2599
+ position: "absolute",
2600
+ width: `${svgWidth.value}px`,
2601
+ height: `${svgHeight.value}px`,
2602
+ pointerEvents: "none",
2603
+ zIndex: 2
2604
+ }),
2605
+ width: svgWidth.value,
2606
+ height: svgHeight.value,
2607
+ viewBox: `0 0 ${width.value} ${height.value}`
2608
+ }, [
2609
+ createElementVNode("rect", {
2610
+ x: 0,
2611
+ y: 0,
2612
+ width: width.value,
2613
+ height: height.value,
2614
+ fill: "transparent",
2615
+ onPointerdown: _cache[0] || (_cache[0] = ($event) => __props.hasIRT ? void 0 : __props.onClick),
2616
+ onTouchstart: _cache[1] || (_cache[1] = ($event) => __props.hasIRT ? void 0 : __props.onClick),
2617
+ style: normalizeStyle({
2618
+ cursor: hitAreaCursor.value,
2619
+ pointerEvents: hitAreaPointerEvents.value
2620
+ })
2621
+ }, null, 44, _hoisted_2),
2622
+ isUnderline.value ? (openBlock(), createElementBlock("line", {
2623
+ key: 0,
2624
+ x1: 1,
2625
+ y1: height.value - 1,
2626
+ x2: width.value - 1,
2627
+ y2: height.value - 1,
2628
+ stroke: __props.strokeColor,
2629
+ "stroke-width": __props.strokeWidth,
2630
+ "stroke-dasharray": dashArray.value,
2631
+ style: { "pointer-events": "none" }
2632
+ }, null, 8, _hoisted_3)) : (openBlock(), createElementBlock("rect", {
2633
+ key: 1,
2634
+ x: __props.strokeWidth / 2,
2635
+ y: __props.strokeWidth / 2,
2636
+ width: Math.max(width.value - __props.strokeWidth, 0),
2637
+ height: Math.max(height.value - __props.strokeWidth, 0),
2638
+ fill: "transparent",
2639
+ stroke: __props.strokeColor,
2640
+ "stroke-width": __props.strokeWidth,
2641
+ "stroke-dasharray": dashArray.value,
2642
+ style: { "pointer-events": "none" }
2643
+ }, null, 8, _hoisted_4))
2644
+ ], 12, _hoisted_1);
2645
+ };
2646
+ }
2647
+ });
2648
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2649
+ __name: "link-renderer",
2650
+ props: {
2651
+ annotation: {},
2652
+ currentObject: {},
2653
+ isSelected: { type: Boolean },
2654
+ isEditing: { type: Boolean },
2655
+ scale: {},
2656
+ pageIndex: {},
2657
+ documentId: {},
2658
+ onClick: { type: Function },
2659
+ appearanceActive: { type: Boolean }
2660
+ },
2661
+ setup(__props) {
2662
+ return (_ctx, _cache) => {
2663
+ return openBlock(), createBlock(_sfc_main$f, mergeProps(__props.currentObject, {
2664
+ isSelected: __props.isSelected,
2665
+ scale: __props.scale,
2666
+ onClick: __props.onClick,
2667
+ hasIRT: !!__props.currentObject.inReplyToId
2668
+ }), null, 16, ["isSelected", "scale", "onClick", "hasIRT"]);
2669
+ };
2670
+ }
2671
+ });
2672
+ const __default__$3 = { inheritAttrs: false };
2673
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2674
+ ...__default__$3,
2675
+ __name: "highlight",
2676
+ props: {
2677
+ strokeColor: {},
2678
+ opacity: { default: 0.5 },
2679
+ segmentRects: {},
2680
+ rect: {},
2681
+ scale: {},
2682
+ onClick: {},
2683
+ appearanceActive: { type: Boolean, default: false }
2684
+ },
2685
+ setup(__props) {
2686
+ const props = __props;
2687
+ const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
2688
+ return (_ctx, _cache) => {
2689
+ return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (b, i) => {
2690
+ return openBlock(), createElementBlock("div", {
2691
+ key: i,
2692
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
2693
+ (...args) => __props.onClick && __props.onClick(...args)),
2694
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
2695
+ (...args) => __props.onClick && __props.onClick(...args)),
2696
+ style: normalizeStyle({
2697
+ position: "absolute",
2698
+ left: `${(__props.rect ? b.origin.x - __props.rect.origin.x : b.origin.x) * __props.scale}px`,
2699
+ top: `${(__props.rect ? b.origin.y - __props.rect.origin.y : b.origin.y) * __props.scale}px`,
2700
+ width: `${b.size.width * __props.scale}px`,
2701
+ height: `${b.size.height * __props.scale}px`,
2702
+ background: __props.appearanceActive ? "transparent" : resolvedColor.value,
2703
+ opacity: __props.appearanceActive ? void 0 : __props.opacity,
2704
+ pointerEvents: __props.onClick ? "auto" : "none",
2705
+ cursor: __props.onClick ? "pointer" : "default",
2706
+ zIndex: __props.onClick ? 1 : void 0
2707
+ })
2708
+ }, null, 36);
2709
+ }), 128);
2710
+ };
2711
+ }
2712
+ });
2713
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
2714
+ __name: "highlight-renderer",
2715
+ props: {
2716
+ annotation: {},
2717
+ currentObject: {},
2718
+ isSelected: { type: Boolean },
2719
+ isEditing: { type: Boolean },
2720
+ scale: {},
2721
+ pageIndex: {},
2722
+ documentId: {},
2723
+ onClick: { type: Function },
2724
+ appearanceActive: { type: Boolean }
2725
+ },
2726
+ setup(__props) {
2727
+ return (_ctx, _cache) => {
2728
+ return openBlock(), createBlock(_sfc_main$d, mergeProps(__props.currentObject, {
2729
+ scale: __props.scale,
2730
+ onClick: __props.onClick,
2731
+ appearanceActive: __props.appearanceActive
2732
+ }), null, 16, ["scale", "onClick", "appearanceActive"]);
2733
+ };
2734
+ }
2735
+ });
2736
+ const __default__$2 = { inheritAttrs: false };
2737
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2738
+ ...__default__$2,
2739
+ __name: "underline",
2740
+ props: {
2741
+ strokeColor: {},
2742
+ opacity: { default: 0.5 },
2743
+ segmentRects: {},
2744
+ rect: {},
2745
+ scale: {},
2746
+ onClick: {},
2747
+ appearanceActive: { type: Boolean, default: false }
2748
+ },
2749
+ setup(__props) {
2750
+ const props = __props;
2751
+ const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
2752
+ const thickness = computed(() => 2 * props.scale);
2753
+ return (_ctx, _cache) => {
2754
+ return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (r, i) => {
2755
+ return openBlock(), createElementBlock("div", {
2756
+ key: i,
2757
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
2758
+ (...args) => __props.onClick && __props.onClick(...args)),
2759
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
2760
+ (...args) => __props.onClick && __props.onClick(...args)),
2761
+ style: normalizeStyle({
2762
+ position: "absolute",
2193
2763
  left: `${(__props.rect ? r.origin.x - __props.rect.origin.x : r.origin.x) * __props.scale}px`,
2194
2764
  top: `${(__props.rect ? r.origin.y - __props.rect.origin.y : r.origin.y) * __props.scale}px`,
2195
2765
  width: `${r.size.width * __props.scale}px`,
@@ -2200,26 +2770,50 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2200
2770
  zIndex: __props.onClick ? 1 : 0
2201
2771
  })
2202
2772
  }, [
2203
- createElementVNode("div", {
2773
+ !__props.appearanceActive ? (openBlock(), createElementBlock("div", {
2774
+ key: 0,
2204
2775
  style: normalizeStyle({
2205
2776
  position: "absolute",
2206
2777
  left: 0,
2207
2778
  bottom: 0,
2208
2779
  width: "100%",
2209
- height: `${amplitude.value * 2}px`,
2210
- backgroundImage: svgDataUri.value,
2211
- backgroundRepeat: "repeat-x",
2212
- backgroundSize: `${period.value}px ${amplitude.value * 2}px`,
2780
+ height: `${thickness.value}px`,
2781
+ background: resolvedColor.value,
2213
2782
  opacity: __props.opacity,
2214
2783
  pointerEvents: "none"
2215
2784
  })
2216
- }, null, 4)
2785
+ }, null, 4)) : createCommentVNode("", true)
2217
2786
  ], 36);
2218
2787
  }), 128);
2219
2788
  };
2220
2789
  }
2221
2790
  });
2222
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2791
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2792
+ __name: "underline-renderer",
2793
+ props: {
2794
+ annotation: {},
2795
+ currentObject: {},
2796
+ isSelected: { type: Boolean },
2797
+ isEditing: { type: Boolean },
2798
+ scale: {},
2799
+ pageIndex: {},
2800
+ documentId: {},
2801
+ onClick: { type: Function },
2802
+ appearanceActive: { type: Boolean }
2803
+ },
2804
+ setup(__props) {
2805
+ return (_ctx, _cache) => {
2806
+ return openBlock(), createBlock(_sfc_main$b, mergeProps(__props.currentObject, {
2807
+ scale: __props.scale,
2808
+ onClick: __props.onClick,
2809
+ appearanceActive: __props.appearanceActive
2810
+ }), null, 16, ["scale", "onClick", "appearanceActive"]);
2811
+ };
2812
+ }
2813
+ });
2814
+ const __default__$1 = { inheritAttrs: false };
2815
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2816
+ ...__default__$1,
2223
2817
  __name: "strikeout",
2224
2818
  props: {
2225
2819
  strokeColor: {},
@@ -2227,7 +2821,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2227
2821
  segmentRects: {},
2228
2822
  rect: {},
2229
2823
  scale: {},
2230
- onClick: {}
2824
+ onClick: {},
2825
+ appearanceActive: { type: Boolean, default: false }
2231
2826
  },
2232
2827
  setup(__props) {
2233
2828
  const props = __props;
@@ -2253,7 +2848,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2253
2848
  zIndex: __props.onClick ? 1 : 0
2254
2849
  })
2255
2850
  }, [
2256
- createElementVNode("div", {
2851
+ !__props.appearanceActive ? (openBlock(), createElementBlock("div", {
2852
+ key: 0,
2257
2853
  style: normalizeStyle({
2258
2854
  position: "absolute",
2259
2855
  left: 0,
@@ -2265,26 +2861,62 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2265
2861
  transform: "translateY(-50%)",
2266
2862
  pointerEvents: "none"
2267
2863
  })
2268
- }, null, 4)
2864
+ }, null, 4)) : createCommentVNode("", true)
2269
2865
  ], 36);
2270
2866
  }), 128);
2271
2867
  };
2272
2868
  }
2273
2869
  });
2274
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2275
- __name: "underline",
2870
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2871
+ __name: "strikeout-renderer",
2872
+ props: {
2873
+ annotation: {},
2874
+ currentObject: {},
2875
+ isSelected: { type: Boolean },
2876
+ isEditing: { type: Boolean },
2877
+ scale: {},
2878
+ pageIndex: {},
2879
+ documentId: {},
2880
+ onClick: { type: Function },
2881
+ appearanceActive: { type: Boolean }
2882
+ },
2883
+ setup(__props) {
2884
+ return (_ctx, _cache) => {
2885
+ return openBlock(), createBlock(_sfc_main$9, mergeProps(__props.currentObject, {
2886
+ scale: __props.scale,
2887
+ onClick: __props.onClick,
2888
+ appearanceActive: __props.appearanceActive
2889
+ }), null, 16, ["scale", "onClick", "appearanceActive"]);
2890
+ };
2891
+ }
2892
+ });
2893
+ const __default__ = { inheritAttrs: false };
2894
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2895
+ ...__default__,
2896
+ __name: "squiggly",
2276
2897
  props: {
2277
2898
  strokeColor: {},
2278
2899
  opacity: { default: 0.5 },
2279
2900
  segmentRects: {},
2280
2901
  rect: {},
2281
2902
  scale: {},
2282
- onClick: {}
2903
+ onClick: {},
2904
+ appearanceActive: { type: Boolean, default: false }
2283
2905
  },
2284
2906
  setup(__props) {
2285
2907
  const props = __props;
2286
2908
  const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
2287
- const thickness = computed(() => 2 * props.scale);
2909
+ const amplitude = computed(() => 2 * props.scale);
2910
+ const period = computed(() => 6 * props.scale);
2911
+ const svgDataUri = computed(() => {
2912
+ const amp = amplitude.value;
2913
+ const per = period.value;
2914
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${per}" height="${amp * 2}" viewBox="0 0 ${per} ${amp * 2}">
2915
+ <path d="M0 ${amp} Q ${per / 4} 0 ${per / 2} ${amp} T ${per} ${amp}"
2916
+ fill="none" stroke="${resolvedColor.value}" stroke-width="${amp}" stroke-linecap="round"/>
2917
+ </svg>`;
2918
+ return `url("data:image/svg+xml;utf8,${encodeURIComponent(svg)}")`;
2919
+ });
2288
2920
  return (_ctx, _cache) => {
2289
2921
  return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (r, i) => {
2290
2922
  return openBlock(), createElementBlock("div", {
@@ -2305,23 +2937,170 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2305
2937
  zIndex: __props.onClick ? 1 : 0
2306
2938
  })
2307
2939
  }, [
2308
- createElementVNode("div", {
2940
+ !__props.appearanceActive ? (openBlock(), createElementBlock("div", {
2941
+ key: 0,
2309
2942
  style: normalizeStyle({
2310
2943
  position: "absolute",
2311
2944
  left: 0,
2312
2945
  bottom: 0,
2313
2946
  width: "100%",
2314
- height: `${thickness.value}px`,
2315
- background: resolvedColor.value,
2947
+ height: `${amplitude.value * 2}px`,
2948
+ backgroundImage: svgDataUri.value,
2949
+ backgroundRepeat: "repeat-x",
2950
+ backgroundSize: `${period.value}px ${amplitude.value * 2}px`,
2316
2951
  opacity: __props.opacity,
2317
2952
  pointerEvents: "none"
2318
2953
  })
2319
- }, null, 4)
2954
+ }, null, 4)) : createCommentVNode("", true)
2320
2955
  ], 36);
2321
2956
  }), 128);
2322
2957
  };
2323
2958
  }
2324
2959
  });
2960
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2961
+ __name: "squiggly-renderer",
2962
+ props: {
2963
+ annotation: {},
2964
+ currentObject: {},
2965
+ isSelected: { type: Boolean },
2966
+ isEditing: { type: Boolean },
2967
+ scale: {},
2968
+ pageIndex: {},
2969
+ documentId: {},
2970
+ onClick: { type: Function },
2971
+ appearanceActive: { type: Boolean }
2972
+ },
2973
+ setup(__props) {
2974
+ return (_ctx, _cache) => {
2975
+ return openBlock(), createBlock(_sfc_main$7, mergeProps(__props.currentObject, {
2976
+ scale: __props.scale,
2977
+ onClick: __props.onClick,
2978
+ appearanceActive: __props.appearanceActive
2979
+ }), null, 16, ["scale", "onClick", "appearanceActive"]);
2980
+ };
2981
+ }
2982
+ });
2983
+ const builtInRenderers = [
2984
+ createRenderer({
2985
+ id: "ink",
2986
+ matches: (a) => a.type === PdfAnnotationSubtype.INK,
2987
+ component: _sfc_main$v,
2988
+ interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
2989
+ }),
2990
+ createRenderer({
2991
+ id: "square",
2992
+ matches: (a) => a.type === PdfAnnotationSubtype.SQUARE,
2993
+ component: _sfc_main$t,
2994
+ interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
2995
+ }),
2996
+ createRenderer({
2997
+ id: "circle",
2998
+ matches: (a) => a.type === PdfAnnotationSubtype.CIRCLE,
2999
+ component: _sfc_main$r,
3000
+ interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
3001
+ }),
3002
+ createRenderer({
3003
+ id: "line",
3004
+ matches: (a) => a.type === PdfAnnotationSubtype.LINE,
3005
+ component: _sfc_main$p,
3006
+ vertexConfig: {
3007
+ extractVertices: (a) => [a.linePoints.start, a.linePoints.end],
3008
+ transformAnnotation: (a, v) => ({
3009
+ ...a,
3010
+ linePoints: { start: v[0], end: v[1] }
3011
+ })
3012
+ },
3013
+ interactionDefaults: { isDraggable: true, isResizable: false, isRotatable: true }
3014
+ }),
3015
+ createRenderer({
3016
+ id: "polyline",
3017
+ matches: (a) => a.type === PdfAnnotationSubtype.POLYLINE,
3018
+ component: _sfc_main$n,
3019
+ vertexConfig: {
3020
+ extractVertices: (a) => a.vertices,
3021
+ transformAnnotation: (a, vertices) => ({ ...a, vertices })
3022
+ },
3023
+ interactionDefaults: { isDraggable: true, isResizable: false, isRotatable: true }
3024
+ }),
3025
+ createRenderer({
3026
+ id: "polygon",
3027
+ matches: (a) => a.type === PdfAnnotationSubtype.POLYGON,
3028
+ component: _sfc_main$l,
3029
+ vertexConfig: {
3030
+ extractVertices: (a) => a.vertices,
3031
+ transformAnnotation: (a, vertices) => ({ ...a, vertices })
3032
+ },
3033
+ interactionDefaults: { isDraggable: true, isResizable: false, isRotatable: true }
3034
+ }),
3035
+ createRenderer({
3036
+ id: "highlight",
3037
+ matches: (a) => a.type === PdfAnnotationSubtype.HIGHLIGHT,
3038
+ component: _sfc_main$c,
3039
+ zIndex: 0,
3040
+ interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },
3041
+ containerStyle: (a) => ({
3042
+ mixBlendMode: blendModeToCss(a.blendMode ?? PdfBlendMode.Multiply)
3043
+ })
3044
+ }),
3045
+ createRenderer({
3046
+ id: "underline",
3047
+ matches: (a) => a.type === PdfAnnotationSubtype.UNDERLINE,
3048
+ component: _sfc_main$a,
3049
+ zIndex: 0,
3050
+ interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false }
3051
+ }),
3052
+ createRenderer({
3053
+ id: "strikeout",
3054
+ matches: (a) => a.type === PdfAnnotationSubtype.STRIKEOUT,
3055
+ component: _sfc_main$8,
3056
+ zIndex: 0,
3057
+ interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false }
3058
+ }),
3059
+ createRenderer({
3060
+ id: "squiggly",
3061
+ matches: (a) => a.type === PdfAnnotationSubtype.SQUIGGLY,
3062
+ component: _sfc_main$6,
3063
+ zIndex: 0,
3064
+ interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false }
3065
+ }),
3066
+ createRenderer({
3067
+ id: "freeText",
3068
+ matches: (a) => a.type === PdfAnnotationSubtype.FREETEXT,
3069
+ component: _sfc_main$j,
3070
+ interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true },
3071
+ isDraggable: (toolDraggable, { isEditing }) => toolDraggable && !isEditing,
3072
+ onDoubleClick: (id, setEditingId) => setEditingId(id)
3073
+ }),
3074
+ createRenderer({
3075
+ id: "stamp",
3076
+ matches: (a) => a.type === PdfAnnotationSubtype.STAMP,
3077
+ component: _sfc_main$g,
3078
+ useAppearanceStream: false,
3079
+ interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
3080
+ }),
3081
+ createRenderer({
3082
+ id: "link",
3083
+ matches: (a) => a.type === PdfAnnotationSubtype.LINK,
3084
+ component: _sfc_main$e,
3085
+ interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },
3086
+ useAppearanceStream: false,
3087
+ selectOverride: (e, annotation, helpers) => {
3088
+ e.stopPropagation();
3089
+ helpers.clearSelection();
3090
+ if (annotation.object.inReplyToId) {
3091
+ const parent = helpers.allAnnotations.find(
3092
+ (a) => a.object.id === annotation.object.inReplyToId
3093
+ );
3094
+ if (parent) {
3095
+ helpers.selectAnnotation(parent.object.pageIndex, parent.object.id);
3096
+ return;
3097
+ }
3098
+ }
3099
+ helpers.selectAnnotation(helpers.pageIndex, annotation.object.id);
3100
+ },
3101
+ hideSelectionMenu: (a) => !!a.inReplyToId
3102
+ })
3103
+ ];
2325
3104
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2326
3105
  __name: "annotations",
2327
3106
  props: {
@@ -2343,538 +3122,320 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2343
3122
  },
2344
3123
  setup(__props) {
2345
3124
  const props = __props;
2346
- const blendStyle = (annotation, defaultBlend = PdfBlendMode.Normal) => ({
2347
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? defaultBlend)
2348
- });
2349
- const findCustomRenderer = (annotation) => {
2350
- var _a;
2351
- return (_a = props.annotationRenderers) == null ? void 0 : _a.find((r) => r.matches(annotation.object));
2352
- };
2353
3125
  const { provides: annotationCapability } = useAnnotationCapability();
2354
3126
  const { provides: selectionProvides } = useSelectionCapability();
2355
- const annotations = ref([]);
2356
- const allSelectedIds = ref([]);
3127
+ const annotations = shallowRef([]);
3128
+ const allSelectedIds = shallowRef([]);
2357
3129
  const { register } = usePointerHandlers({
2358
3130
  documentId: () => props.documentId,
2359
3131
  pageIndex: props.pageIndex
2360
3132
  });
2361
3133
  const editingId = ref(null);
3134
+ const appearanceMap = shallowRef({});
3135
+ let prevScale = props.scale;
2362
3136
  const annotationProvides = computed(
2363
3137
  () => annotationCapability.value ? annotationCapability.value.forDocument(props.documentId) : null
2364
3138
  );
2365
3139
  const isMultiSelected = computed(() => allSelectedIds.value.length > 1);
2366
- watchEffect((onCleanup) => {
2367
- if (annotationProvides.value) {
2368
- const currentState = annotationProvides.value.getState();
2369
- annotations.value = getAnnotationsByPageIndex(currentState, props.pageIndex);
2370
- allSelectedIds.value = getSelectedAnnotationIds(currentState);
2371
- const off = annotationProvides.value.onStateChange((state) => {
2372
- annotations.value = getAnnotationsByPageIndex(state, props.pageIndex);
2373
- allSelectedIds.value = getSelectedAnnotationIds(state);
2374
- });
2375
- onCleanup(off);
2376
- }
3140
+ const allRenderers = computed(() => {
3141
+ const external = props.annotationRenderers ?? [];
3142
+ const externalIds = new Set(external.map((r) => r.id));
3143
+ return [...external, ...builtInRenderers.filter((r) => !externalIds.has(r.id))];
2377
3144
  });
2378
- const handlePointerDown = (_pos, pe) => {
2379
- if (pe.target === pe.currentTarget && annotationProvides.value) {
2380
- annotationProvides.value.deselectAnnotation();
2381
- editingId.value = null;
2382
- }
3145
+ const resolveRenderer = (annotation) => {
3146
+ return allRenderers.value.find((r) => r.matches(annotation.object)) ?? null;
2383
3147
  };
2384
- const handleClick = (e, annotation) => {
2385
- e.stopPropagation();
2386
- if (annotationProvides.value && selectionProvides.value) {
2387
- selectionProvides.value.clear();
2388
- const isModifierPressed = "metaKey" in e ? e.metaKey || e.ctrlKey : false;
2389
- if (isModifierPressed) {
2390
- annotationProvides.value.toggleSelection(props.pageIndex, annotation.object.id);
2391
- } else {
2392
- annotationProvides.value.selectAnnotation(props.pageIndex, annotation.object.id);
2393
- }
2394
- if (annotation.object.id !== editingId.value) {
2395
- editingId.value = null;
2396
- }
2397
- }
3148
+ const getAppearanceForAnnotation = (ta) => {
3149
+ if (ta.dictMode) return null;
3150
+ if (ta.object.rotation && ta.object.unrotatedRect) return null;
3151
+ const appearances = appearanceMap.value[ta.object.id];
3152
+ if (!(appearances == null ? void 0 : appearances.normal)) return null;
3153
+ return appearances;
2398
3154
  };
2399
- const handleLinkClick = (e, annotation) => {
2400
- e.stopPropagation();
2401
- if (!annotationProvides.value || !selectionProvides.value) return;
2402
- selectionProvides.value.clear();
2403
- if (annotation.object.inReplyToId) {
2404
- const parentId = annotation.object.inReplyToId;
2405
- const parent = annotations.value.find((a) => a.object.id === parentId);
2406
- if (parent) {
2407
- annotationProvides.value.selectAnnotation(parent.object.pageIndex, parentId);
3155
+ watch(
3156
+ [annotationProvides, () => props.pageIndex],
3157
+ ([provides, pageIndex], _prev, onCleanup) => {
3158
+ if (!provides) {
3159
+ annotations.value = [];
3160
+ allSelectedIds.value = [];
2408
3161
  return;
2409
3162
  }
2410
- }
2411
- annotationProvides.value.selectAnnotation(props.pageIndex, annotation.object.id);
2412
- };
2413
- const handleDoubleClick = (_e, id) => {
2414
- if (isFreeText(annotations.value.find((a) => a.object.id === id))) {
2415
- editingId.value = id;
2416
- }
2417
- };
2418
- watchEffect((onCleanup) => {
2419
- if (annotationProvides.value) {
2420
- const unregister = register({ onPointerDown: handlePointerDown });
2421
- if (unregister) {
2422
- onCleanup(unregister);
2423
- }
2424
- }
2425
- });
2426
- const isSelected = (annotation) => allSelectedIds.value.includes(annotation.object.id);
2427
- const selectedAnnotationsOnPage = computed(
2428
- () => annotations.value.filter((anno) => allSelectedIds.value.includes(anno.object.id))
3163
+ const syncState = (state) => {
3164
+ annotations.value = getAnnotationsByPageIndex(state, pageIndex);
3165
+ allSelectedIds.value = getSelectedAnnotationIds(state);
3166
+ };
3167
+ syncState(provides.getState());
3168
+ const off = provides.onStateChange(syncState);
3169
+ onCleanup(off);
3170
+ },
3171
+ { immediate: true }
2429
3172
  );
2430
- const areAllSelectedDraggable = computed(() => {
2431
- if (selectedAnnotationsOnPage.value.length < 2) return false;
2432
- return selectedAnnotationsOnPage.value.every((ta) => {
2433
- var _a;
2434
- const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
2435
- const groupDraggable = resolveInteractionProp(
2436
- tool == null ? void 0 : tool.interaction.isGroupDraggable,
2437
- ta.object,
2438
- true
2439
- );
2440
- const singleDraggable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isDraggable, ta.object, true);
2441
- return (tool == null ? void 0 : tool.interaction.isGroupDraggable) !== void 0 ? groupDraggable : singleDraggable;
2442
- });
2443
- });
2444
- const areAllSelectedResizable = computed(() => {
2445
- if (selectedAnnotationsOnPage.value.length < 2) return false;
2446
- return selectedAnnotationsOnPage.value.every((ta) => {
2447
- var _a;
2448
- const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
2449
- const groupResizable = resolveInteractionProp(
2450
- tool == null ? void 0 : tool.interaction.isGroupResizable,
2451
- ta.object,
2452
- true
2453
- );
2454
- const singleResizable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isResizable, ta.object, true);
2455
- return (tool == null ? void 0 : tool.interaction.isGroupResizable) !== void 0 ? groupResizable : singleResizable;
2456
- });
2457
- });
2458
- const areAllSelectedRotatable = computed(() => {
2459
- if (selectedAnnotationsOnPage.value.length < 2) return false;
2460
- return selectedAnnotationsOnPage.value.every((ta) => {
2461
- var _a;
2462
- const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
2463
- const groupRotatable = resolveInteractionProp(
2464
- tool == null ? void 0 : tool.interaction.isGroupRotatable,
2465
- ta.object,
2466
- true
2467
- );
2468
- const singleRotatable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isRotatable, ta.object, true);
2469
- return (tool == null ? void 0 : tool.interaction.isGroupRotatable) !== void 0 ? groupRotatable : singleRotatable;
2470
- });
2471
- });
2472
- const shouldLockGroupAspectRatio = computed(() => {
2473
- if (selectedAnnotationsOnPage.value.length < 2) return false;
2474
- return selectedAnnotationsOnPage.value.some((ta) => {
2475
- var _a;
2476
- const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
2477
- const groupLock = resolveInteractionProp(
2478
- tool == null ? void 0 : tool.interaction.lockGroupAspectRatio,
2479
- ta.object,
2480
- false
3173
+ watch(
3174
+ [annotationProvides, () => props.pageIndex, () => props.scale],
3175
+ ([provides, pageIndex, scale], _prev, onCleanup) => {
3176
+ if (!provides) {
3177
+ appearanceMap.value = {};
3178
+ return;
3179
+ }
3180
+ if (prevScale !== scale) {
3181
+ provides.invalidatePageAppearances(pageIndex);
3182
+ prevScale = scale;
3183
+ }
3184
+ let cancelled = false;
3185
+ onCleanup(() => {
3186
+ cancelled = true;
3187
+ });
3188
+ const task = provides.getPageAppearances(pageIndex, {
3189
+ scaleFactor: scale,
3190
+ dpr: typeof window !== "undefined" ? window.devicePixelRatio : 1
3191
+ });
3192
+ task.wait(
3193
+ (map) => {
3194
+ if (!cancelled) appearanceMap.value = map;
3195
+ },
3196
+ () => {
3197
+ if (!cancelled) appearanceMap.value = {};
3198
+ }
2481
3199
  );
2482
- const singleLock = resolveInteractionProp(tool == null ? void 0 : tool.interaction.lockAspectRatio, ta.object, false);
2483
- return (tool == null ? void 0 : tool.interaction.lockGroupAspectRatio) !== void 0 ? groupLock : singleLock;
2484
- });
2485
- });
2486
- const allSelectedOnSamePage = computed(() => {
2487
- if (!annotationProvides.value) return false;
2488
- if (allSelectedIds.value.length < 2) return false;
2489
- const allSelected = annotationProvides.value.getSelectedAnnotations();
2490
- return allSelected.every((ta) => ta.object.pageIndex === props.pageIndex);
2491
- });
2492
- const getTool = (annotation) => {
3200
+ },
3201
+ { immediate: true }
3202
+ );
3203
+ const resolvedAnnotations = computed(
3204
+ () => annotations.value.map((annotation) => ({
3205
+ annotation,
3206
+ renderer: resolveRenderer(annotation)
3207
+ }))
3208
+ );
3209
+ const getFinalDraggable = (annotation, renderer) => {
2493
3210
  var _a;
2494
- return (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
3211
+ const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
3212
+ const defaults = renderer.interactionDefaults;
3213
+ const isEditing = editingId.value === annotation.object.id;
3214
+ const resolvedDraggable = resolveInteractionProp(
3215
+ tool == null ? void 0 : tool.interaction.isDraggable,
3216
+ annotation.object,
3217
+ (defaults == null ? void 0 : defaults.isDraggable) ?? true
3218
+ );
3219
+ return renderer.isDraggable ? renderer.isDraggable(resolvedDraggable, { isEditing }) : resolvedDraggable;
2495
3220
  };
2496
- const isDraggable = (anno) => {
2497
- var _a;
2498
- if (isFreeText(anno) && editingId.value === anno.object.id) return false;
2499
- if (isMultiSelected.value) return false;
2500
- return resolveInteractionProp((_a = getTool(anno)) == null ? void 0 : _a.interaction.isDraggable, anno.object, false);
3221
+ const getResolvedResizable = (annotation, renderer) => {
3222
+ var _a, _b;
3223
+ const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
3224
+ return resolveInteractionProp(
3225
+ tool == null ? void 0 : tool.interaction.isResizable,
3226
+ annotation.object,
3227
+ ((_b = renderer.interactionDefaults) == null ? void 0 : _b.isResizable) ?? false
3228
+ );
2501
3229
  };
2502
- const isResizable = (anno) => {
2503
- var _a;
2504
- if (isMultiSelected.value) return false;
2505
- return resolveInteractionProp((_a = getTool(anno)) == null ? void 0 : _a.interaction.isResizable, anno.object, false);
3230
+ const getResolvedLockAspectRatio = (annotation, renderer) => {
3231
+ var _a, _b;
3232
+ const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
3233
+ return resolveInteractionProp(
3234
+ tool == null ? void 0 : tool.interaction.lockAspectRatio,
3235
+ annotation.object,
3236
+ ((_b = renderer.interactionDefaults) == null ? void 0 : _b.lockAspectRatio) ?? false
3237
+ );
2506
3238
  };
2507
- const lockAspectRatio = (anno) => {
2508
- var _a;
2509
- return resolveInteractionProp((_a = getTool(anno)) == null ? void 0 : _a.interaction.lockAspectRatio, anno.object, false);
3239
+ const getResolvedRotatable = (annotation, renderer) => {
3240
+ var _a, _b;
3241
+ const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
3242
+ return resolveInteractionProp(
3243
+ tool == null ? void 0 : tool.interaction.isRotatable,
3244
+ annotation.object,
3245
+ ((_b = renderer.interactionDefaults) == null ? void 0 : _b.isRotatable) ?? false
3246
+ );
2510
3247
  };
2511
- const isRotatableFor = (anno, fallback) => {
3248
+ const getSelectionMenu = (annotation, renderer) => {
2512
3249
  var _a;
2513
- if (isMultiSelected.value) return false;
2514
- return resolveInteractionProp((_a = getTool(anno)) == null ? void 0 : _a.interaction.isRotatable, anno.object, fallback);
2515
- };
2516
- const showIndividualSelection = (anno) => isSelected(anno) && !isMultiSelected.value;
2517
- const containerProps = computed(() => {
2518
- const {
2519
- selectionMenu: _sm,
2520
- groupSelectionMenu: _gsm,
2521
- groupSelectionOutline: _gso,
2522
- ...rest
2523
- } = props;
2524
- return rest;
2525
- });
2526
- const getVertexConfig = (annotation) => {
2527
- if (isLine(annotation)) {
2528
- return {
2529
- extractVertices: (anno) => [anno.linePoints.start, anno.linePoints.end],
2530
- transformAnnotation: (anno, vertices) => ({
2531
- ...anno,
2532
- linePoints: { start: vertices[0], end: vertices[1] }
2533
- })
2534
- };
2535
- }
2536
- if (isPolyline(annotation) || isPolygon(annotation)) {
2537
- return {
2538
- extractVertices: (anno) => anno.vertices,
2539
- transformAnnotation: (anno, vertices) => ({ ...anno, vertices })
2540
- };
2541
- }
2542
- return void 0;
2543
- };
2544
- return (_ctx, _cache) => {
2545
- return openBlock(), createElementBlock(Fragment, null, [
2546
- (openBlock(true), createElementBlock(Fragment, null, renderList(annotations.value, (annotation) => {
2547
- return openBlock(), createElementBlock(Fragment, {
2548
- key: annotation.object.id
2549
- }, [
2550
- findCustomRenderer(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2551
- key: 0,
2552
- trackedAnnotation: annotation,
2553
- isSelected: showIndividualSelection(annotation),
2554
- isDraggable: isDraggable(annotation),
2555
- isResizable: isResizable(annotation),
2556
- isRotatable: isRotatableFor(annotation, false),
2557
- lockAspectRatio: lockAspectRatio(annotation),
2558
- onSelect: (e) => handleClick(e, annotation),
2559
- selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2560
- style: blendStyle(annotation)
2561
- }, { ref_for: true }, containerProps.value), createSlots({
2562
- default: withCtx(() => [
2563
- (openBlock(), createBlock(resolveDynamicComponent(findCustomRenderer(annotation).component), {
2564
- annotation,
2565
- isSelected: isSelected(annotation),
2566
- scale: __props.scale,
2567
- pageIndex: __props.pageIndex,
2568
- onClick: (e) => handleClick(e, annotation)
2569
- }, null, 8, ["annotation", "isSelected", "scale", "pageIndex", "onClick"]))
2570
- ]),
2571
- "resize-handle": withCtx((slotProps) => [
2572
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
2573
- ]),
2574
- "rotation-handle": withCtx((slotProps) => [
2575
- renderSlot(_ctx.$slots, "rotation-handle", mergeProps({ ref_for: true }, slotProps))
2576
- ]),
2577
- _: 2
2578
- }, [
2579
- !isMultiSelected.value ? {
2580
- name: "selection-menu",
2581
- fn: withCtx((slotProps) => [
2582
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2583
- ]),
2584
- key: "0"
2585
- } : void 0
2586
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "selectionMenu", "style"])) : unref(isInk)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2587
- key: 1,
2588
- trackedAnnotation: annotation,
2589
- isSelected: showIndividualSelection(annotation),
2590
- isDraggable: isDraggable(annotation),
2591
- isResizable: isResizable(annotation),
2592
- isRotatable: isRotatableFor(annotation, true),
2593
- lockAspectRatio: lockAspectRatio(annotation),
2594
- onSelect: (e) => handleClick(e, annotation),
2595
- vertexConfig: getVertexConfig(annotation),
2596
- selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2597
- style: blendStyle(annotation)
2598
- }, { ref_for: true }, containerProps.value), createSlots({
2599
- default: withCtx(({ annotation: currentObject }) => [
2600
- createVNode(_sfc_main$h, mergeProps({ ref_for: true }, currentObject, {
2601
- isSelected: isSelected(annotation),
2602
- scale: __props.scale,
2603
- onClick: (e) => handleClick(e, annotation)
2604
- }), null, 16, ["isSelected", "scale", "onClick"])
2605
- ]),
2606
- "resize-handle": withCtx((slotProps) => [
2607
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
2608
- ]),
2609
- "vertex-handle": withCtx((slotProps) => [
2610
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
2611
- ]),
2612
- "rotation-handle": withCtx((slotProps) => [
2613
- renderSlot(_ctx.$slots, "rotation-handle", mergeProps({ ref_for: true }, slotProps))
2614
- ]),
2615
- _: 2
2616
- }, [
2617
- !isMultiSelected.value ? {
2618
- name: "selection-menu",
2619
- fn: withCtx((slotProps) => [
2620
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2621
- ]),
2622
- key: "0"
2623
- } : void 0
2624
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isSquare)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2625
- key: 2,
2626
- trackedAnnotation: annotation,
2627
- isSelected: showIndividualSelection(annotation),
2628
- isDraggable: isDraggable(annotation),
2629
- isResizable: isResizable(annotation),
2630
- isRotatable: isRotatableFor(annotation, true),
2631
- lockAspectRatio: lockAspectRatio(annotation),
2632
- onSelect: (e) => handleClick(e, annotation),
2633
- vertexConfig: getVertexConfig(annotation),
2634
- selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2635
- style: blendStyle(annotation)
2636
- }, { ref_for: true }, containerProps.value), createSlots({
2637
- default: withCtx(({ annotation: currentObject }) => [
2638
- createVNode(_sfc_main$c, mergeProps({ ref_for: true }, currentObject, {
2639
- isSelected: isSelected(annotation),
2640
- scale: __props.scale,
2641
- onClick: (e) => handleClick(e, annotation)
2642
- }), null, 16, ["isSelected", "scale", "onClick"])
2643
- ]),
2644
- "resize-handle": withCtx((slotProps) => [
2645
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
2646
- ]),
2647
- "vertex-handle": withCtx((slotProps) => [
2648
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
2649
- ]),
2650
- "rotation-handle": withCtx((slotProps) => [
2651
- renderSlot(_ctx.$slots, "rotation-handle", mergeProps({ ref_for: true }, slotProps))
2652
- ]),
2653
- _: 2
2654
- }, [
2655
- !isMultiSelected.value ? {
2656
- name: "selection-menu",
2657
- fn: withCtx((slotProps) => [
2658
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2659
- ]),
2660
- key: "0"
2661
- } : void 0
2662
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isCircle)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2663
- key: 3,
2664
- trackedAnnotation: annotation,
2665
- isSelected: showIndividualSelection(annotation),
2666
- isDraggable: isDraggable(annotation),
2667
- isResizable: isResizable(annotation),
2668
- isRotatable: isRotatableFor(annotation, true),
2669
- lockAspectRatio: lockAspectRatio(annotation),
2670
- onSelect: (e) => handleClick(e, annotation),
2671
- vertexConfig: getVertexConfig(annotation),
2672
- selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2673
- style: blendStyle(annotation)
2674
- }, { ref_for: true }, containerProps.value), createSlots({
2675
- default: withCtx(({ annotation: currentObject }) => [
2676
- createVNode(_sfc_main$j, mergeProps({ ref_for: true }, currentObject, {
2677
- isSelected: isSelected(annotation),
2678
- scale: __props.scale,
2679
- onClick: (e) => handleClick(e, annotation)
2680
- }), null, 16, ["isSelected", "scale", "onClick"])
2681
- ]),
2682
- "resize-handle": withCtx((slotProps) => [
2683
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
2684
- ]),
2685
- "vertex-handle": withCtx((slotProps) => [
2686
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
2687
- ]),
2688
- "rotation-handle": withCtx((slotProps) => [
2689
- renderSlot(_ctx.$slots, "rotation-handle", mergeProps({ ref_for: true }, slotProps))
2690
- ]),
2691
- _: 2
2692
- }, [
2693
- !isMultiSelected.value ? {
2694
- name: "selection-menu",
2695
- fn: withCtx((slotProps) => [
2696
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2697
- ]),
2698
- key: "0"
2699
- } : void 0
2700
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isLine)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2701
- key: 4,
2702
- trackedAnnotation: annotation,
2703
- isSelected: showIndividualSelection(annotation),
2704
- isDraggable: isDraggable(annotation),
2705
- isResizable: isResizable(annotation),
2706
- isRotatable: isRotatableFor(annotation, true),
2707
- lockAspectRatio: lockAspectRatio(annotation),
2708
- onSelect: (e) => handleClick(e, annotation),
2709
- vertexConfig: getVertexConfig(annotation),
2710
- selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2711
- style: blendStyle(annotation)
2712
- }, { ref_for: true }, containerProps.value), createSlots({
2713
- default: withCtx(({ annotation: currentObject }) => [
2714
- createVNode(_sfc_main$g, mergeProps({ ref_for: true }, currentObject, {
2715
- isSelected: isSelected(annotation),
2716
- scale: __props.scale,
2717
- onClick: (e) => handleClick(e, annotation)
2718
- }), null, 16, ["isSelected", "scale", "onClick"])
2719
- ]),
2720
- "resize-handle": withCtx((slotProps) => [
2721
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
2722
- ]),
2723
- "vertex-handle": withCtx((slotProps) => [
2724
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
2725
- ]),
2726
- "rotation-handle": withCtx((slotProps) => [
2727
- renderSlot(_ctx.$slots, "rotation-handle", mergeProps({ ref_for: true }, slotProps))
2728
- ]),
2729
- _: 2
2730
- }, [
2731
- !isMultiSelected.value ? {
2732
- name: "selection-menu",
2733
- fn: withCtx((slotProps) => [
2734
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2735
- ]),
2736
- key: "0"
2737
- } : void 0
2738
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isPolyline)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2739
- key: 5,
2740
- trackedAnnotation: annotation,
2741
- isSelected: showIndividualSelection(annotation),
2742
- isDraggable: isDraggable(annotation),
2743
- isResizable: isResizable(annotation),
2744
- isRotatable: isRotatableFor(annotation, true),
2745
- lockAspectRatio: lockAspectRatio(annotation),
2746
- onSelect: (e) => handleClick(e, annotation),
2747
- vertexConfig: getVertexConfig(annotation),
2748
- selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2749
- style: blendStyle(annotation)
2750
- }, { ref_for: true }, containerProps.value), createSlots({
2751
- default: withCtx(({ annotation: currentObject }) => [
2752
- createVNode(_sfc_main$d, mergeProps({ ref_for: true }, currentObject, {
2753
- isSelected: isSelected(annotation),
2754
- scale: __props.scale,
2755
- onClick: (e) => handleClick(e, annotation)
2756
- }), null, 16, ["isSelected", "scale", "onClick"])
2757
- ]),
2758
- "resize-handle": withCtx((slotProps) => [
2759
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
2760
- ]),
2761
- "vertex-handle": withCtx((slotProps) => [
2762
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
2763
- ]),
2764
- "rotation-handle": withCtx((slotProps) => [
2765
- renderSlot(_ctx.$slots, "rotation-handle", mergeProps({ ref_for: true }, slotProps))
2766
- ]),
2767
- _: 2
2768
- }, [
2769
- !isMultiSelected.value ? {
2770
- name: "selection-menu",
2771
- fn: withCtx((slotProps) => [
2772
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2773
- ]),
2774
- key: "0"
2775
- } : void 0
2776
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isPolygon)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2777
- key: 6,
2778
- trackedAnnotation: annotation,
2779
- isSelected: showIndividualSelection(annotation),
2780
- isDraggable: isDraggable(annotation),
2781
- isResizable: isResizable(annotation),
2782
- isRotatable: isRotatableFor(annotation, true),
2783
- lockAspectRatio: lockAspectRatio(annotation),
2784
- onSelect: (e) => handleClick(e, annotation),
2785
- vertexConfig: getVertexConfig(annotation),
2786
- selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2787
- style: blendStyle(annotation)
2788
- }, { ref_for: true }, containerProps.value), createSlots({
2789
- default: withCtx(({ annotation: currentObject }) => [
2790
- createVNode(_sfc_main$e, mergeProps({ ref_for: true }, currentObject, {
2791
- isSelected: isSelected(annotation),
2792
- scale: __props.scale,
2793
- onClick: (e) => handleClick(e, annotation)
2794
- }), null, 16, ["isSelected", "scale", "onClick"])
2795
- ]),
2796
- "resize-handle": withCtx((slotProps) => [
2797
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
2798
- ]),
2799
- "vertex-handle": withCtx((slotProps) => [
2800
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
2801
- ]),
2802
- "rotation-handle": withCtx((slotProps) => [
2803
- renderSlot(_ctx.$slots, "rotation-handle", mergeProps({ ref_for: true }, slotProps))
2804
- ]),
2805
- _: 2
2806
- }, [
2807
- !isMultiSelected.value ? {
2808
- name: "selection-menu",
2809
- fn: withCtx((slotProps) => [
2810
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2811
- ]),
2812
- key: "0"
2813
- } : void 0
2814
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isFreeText)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2815
- key: 7,
3250
+ if ((_a = renderer.hideSelectionMenu) == null ? void 0 : _a.call(renderer, annotation.object)) return void 0;
3251
+ if (isMultiSelected.value) return void 0;
3252
+ return props.selectionMenu;
3253
+ };
3254
+ const getOnSelect = (annotation, renderer) => {
3255
+ if (renderer.selectOverride) {
3256
+ const selectHelpers = {
3257
+ defaultSelect: handleClick,
3258
+ selectAnnotation: (pi, id) => {
3259
+ var _a;
3260
+ return (_a = annotationProvides.value) == null ? void 0 : _a.selectAnnotation(pi, id);
3261
+ },
3262
+ clearSelection: () => {
3263
+ var _a;
3264
+ return (_a = selectionProvides.value) == null ? void 0 : _a.clear();
3265
+ },
3266
+ allAnnotations: annotations.value,
3267
+ pageIndex: props.pageIndex
3268
+ };
3269
+ return (e) => renderer.selectOverride(e, annotation, selectHelpers);
3270
+ }
3271
+ return (e) => handleClick(e, annotation);
3272
+ };
3273
+ const handlePointerDown = (_pos, pe) => {
3274
+ if (pe.target === pe.currentTarget && annotationProvides.value) {
3275
+ annotationProvides.value.deselectAnnotation();
3276
+ editingId.value = null;
3277
+ }
3278
+ };
3279
+ const handleClick = (e, annotation) => {
3280
+ e.stopPropagation();
3281
+ if (annotationProvides.value && selectionProvides.value) {
3282
+ selectionProvides.value.clear();
3283
+ const isModifierPressed = "metaKey" in e ? e.metaKey || e.ctrlKey : false;
3284
+ if (isModifierPressed) {
3285
+ annotationProvides.value.toggleSelection(props.pageIndex, annotation.object.id);
3286
+ } else {
3287
+ annotationProvides.value.selectAnnotation(props.pageIndex, annotation.object.id);
3288
+ }
3289
+ if (annotation.object.id !== editingId.value) {
3290
+ editingId.value = null;
3291
+ }
3292
+ }
3293
+ };
3294
+ const setEditingId = (id) => {
3295
+ editingId.value = id;
3296
+ };
3297
+ const pointerHandlers = { onPointerDown: handlePointerDown };
3298
+ watch(
3299
+ annotationProvides,
3300
+ (provides, _prev, onCleanup) => {
3301
+ if (!provides) return;
3302
+ const unregister = register(pointerHandlers);
3303
+ if (unregister) {
3304
+ onCleanup(unregister);
3305
+ }
3306
+ },
3307
+ { immediate: true }
3308
+ );
3309
+ const selectedAnnotationsOnPage = computed(
3310
+ () => annotations.value.filter((anno) => allSelectedIds.value.includes(anno.object.id))
3311
+ );
3312
+ const areAllSelectedDraggable = computed(() => {
3313
+ if (selectedAnnotationsOnPage.value.length < 2) return false;
3314
+ return selectedAnnotationsOnPage.value.every((ta) => {
3315
+ var _a;
3316
+ const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
3317
+ const groupDraggable = resolveInteractionProp(
3318
+ tool == null ? void 0 : tool.interaction.isGroupDraggable,
3319
+ ta.object,
3320
+ true
3321
+ );
3322
+ const singleDraggable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isDraggable, ta.object, true);
3323
+ return (tool == null ? void 0 : tool.interaction.isGroupDraggable) !== void 0 ? groupDraggable : singleDraggable;
3324
+ });
3325
+ });
3326
+ const areAllSelectedResizable = computed(() => {
3327
+ if (selectedAnnotationsOnPage.value.length < 2) return false;
3328
+ return selectedAnnotationsOnPage.value.every((ta) => {
3329
+ var _a;
3330
+ const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
3331
+ const groupResizable = resolveInteractionProp(
3332
+ tool == null ? void 0 : tool.interaction.isGroupResizable,
3333
+ ta.object,
3334
+ true
3335
+ );
3336
+ const singleResizable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isResizable, ta.object, true);
3337
+ return (tool == null ? void 0 : tool.interaction.isGroupResizable) !== void 0 ? groupResizable : singleResizable;
3338
+ });
3339
+ });
3340
+ const areAllSelectedRotatable = computed(() => {
3341
+ if (selectedAnnotationsOnPage.value.length < 2) return false;
3342
+ return selectedAnnotationsOnPage.value.every((ta) => {
3343
+ var _a;
3344
+ const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
3345
+ const groupRotatable = resolveInteractionProp(
3346
+ tool == null ? void 0 : tool.interaction.isGroupRotatable,
3347
+ ta.object,
3348
+ true
3349
+ );
3350
+ const singleRotatable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isRotatable, ta.object, true);
3351
+ return (tool == null ? void 0 : tool.interaction.isGroupRotatable) !== void 0 ? groupRotatable : singleRotatable;
3352
+ });
3353
+ });
3354
+ const shouldLockGroupAspectRatio = computed(() => {
3355
+ if (selectedAnnotationsOnPage.value.length < 2) return false;
3356
+ return selectedAnnotationsOnPage.value.some((ta) => {
3357
+ var _a;
3358
+ const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
3359
+ const groupLock = resolveInteractionProp(
3360
+ tool == null ? void 0 : tool.interaction.lockGroupAspectRatio,
3361
+ ta.object,
3362
+ false
3363
+ );
3364
+ const singleLock = resolveInteractionProp(tool == null ? void 0 : tool.interaction.lockAspectRatio, ta.object, false);
3365
+ return (tool == null ? void 0 : tool.interaction.lockGroupAspectRatio) !== void 0 ? groupLock : singleLock;
3366
+ });
3367
+ });
3368
+ const allSelectedOnSamePage = computed(() => {
3369
+ if (!annotationProvides.value) return false;
3370
+ if (allSelectedIds.value.length < 2) return false;
3371
+ const allSelected = annotationProvides.value.getSelectedAnnotations();
3372
+ return allSelected.every((ta) => ta.object.pageIndex === props.pageIndex);
3373
+ });
3374
+ const getOnDoubleClick = (renderer, annotation) => {
3375
+ if (!renderer.onDoubleClick) return void 0;
3376
+ return (e) => {
3377
+ e.stopPropagation();
3378
+ renderer.onDoubleClick(annotation.object.id, setEditingId);
3379
+ };
3380
+ };
3381
+ const getContainerStyle = (annotation, renderer) => {
3382
+ var _a;
3383
+ return ((_a = renderer.containerStyle) == null ? void 0 : _a.call(renderer, annotation.object)) ?? {
3384
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
3385
+ };
3386
+ };
3387
+ const getAppearance = (annotation, renderer) => {
3388
+ var _a, _b;
3389
+ const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
3390
+ const useAP = ((_b = tool == null ? void 0 : tool.behavior) == null ? void 0 : _b.useAppearanceStream) ?? renderer.useAppearanceStream ?? true;
3391
+ return useAP ? getAppearanceForAnnotation(annotation) : void 0;
3392
+ };
3393
+ const containerProps = computed(() => {
3394
+ const {
3395
+ selectionMenu: _sm,
3396
+ groupSelectionMenu: _gsm,
3397
+ groupSelectionOutline: _gso,
3398
+ annotationRenderers: _ar,
3399
+ ...rest
3400
+ } = props;
3401
+ return rest;
3402
+ });
3403
+ return (_ctx, _cache) => {
3404
+ return openBlock(), createElementBlock(Fragment, null, [
3405
+ (openBlock(true), createElementBlock(Fragment, null, renderList(resolvedAnnotations.value, ({ annotation, renderer }) => {
3406
+ return openBlock(), createElementBlock(Fragment, {
3407
+ key: annotation.object.id
3408
+ }, [
3409
+ renderer ? (openBlock(), createBlock(_sfc_main$y, mergeProps({
3410
+ key: 0,
2816
3411
  trackedAnnotation: annotation,
2817
- isSelected: showIndividualSelection(annotation),
2818
- isDraggable: isDraggable(annotation),
2819
- isResizable: isResizable(annotation),
2820
- isRotatable: isRotatableFor(annotation, true),
2821
- lockAspectRatio: lockAspectRatio(annotation),
2822
- onSelect: (e) => handleClick(e, annotation),
2823
- onDoubleClick: (e) => handleDoubleClick(e, annotation.object.id),
2824
- vertexConfig: getVertexConfig(annotation),
2825
- selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2826
- style: blendStyle(annotation)
3412
+ isSelected: allSelectedIds.value.includes(annotation.object.id),
3413
+ isEditing: editingId.value === annotation.object.id,
3414
+ isMultiSelected: isMultiSelected.value,
3415
+ isDraggable: getFinalDraggable(annotation, renderer),
3416
+ isResizable: getResolvedResizable(annotation, renderer),
3417
+ lockAspectRatio: getResolvedLockAspectRatio(annotation, renderer),
3418
+ isRotatable: getResolvedRotatable(annotation, renderer),
3419
+ vertexConfig: renderer.vertexConfig,
3420
+ selectionMenu: getSelectionMenu(annotation, renderer),
3421
+ onSelect: getOnSelect(annotation, renderer),
3422
+ onDoubleClick: getOnDoubleClick(renderer, annotation),
3423
+ zIndex: renderer.zIndex,
3424
+ style: getContainerStyle(annotation, renderer),
3425
+ appearance: getAppearance(annotation, renderer)
2827
3426
  }, { ref_for: true }, containerProps.value), createSlots({
2828
- default: withCtx(({ annotation: currentObject }) => [
2829
- createVNode(_sfc_main$i, {
2830
- isSelected: isSelected(annotation),
3427
+ default: withCtx(({ annotation: currentObject, appearanceActive }) => [
3428
+ (openBlock(), createBlock(resolveDynamicComponent(renderer.component), {
3429
+ annotation,
3430
+ currentObject,
3431
+ isSelected: allSelectedIds.value.includes(annotation.object.id),
2831
3432
  isEditing: editingId.value === annotation.object.id,
2832
- annotation: { ...annotation, object: currentObject },
2833
- pageIndex: __props.pageIndex,
2834
3433
  scale: __props.scale,
2835
- onClick: (e) => handleClick(e, annotation)
2836
- }, null, 8, ["isSelected", "isEditing", "annotation", "pageIndex", "scale", "onClick"])
2837
- ]),
2838
- "resize-handle": withCtx((slotProps) => [
2839
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
2840
- ]),
2841
- "vertex-handle": withCtx((slotProps) => [
2842
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
2843
- ]),
2844
- "rotation-handle": withCtx((slotProps) => [
2845
- renderSlot(_ctx.$slots, "rotation-handle", mergeProps({ ref_for: true }, slotProps))
2846
- ]),
2847
- _: 2
2848
- }, [
2849
- !isMultiSelected.value ? {
2850
- name: "selection-menu",
2851
- fn: withCtx((slotProps) => [
2852
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2853
- ]),
2854
- key: "0"
2855
- } : void 0
2856
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "onDoubleClick", "vertexConfig", "selectionMenu", "style"])) : unref(isStamp)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2857
- key: 8,
2858
- trackedAnnotation: annotation,
2859
- isSelected: showIndividualSelection(annotation),
2860
- isDraggable: isDraggable(annotation),
2861
- isResizable: isResizable(annotation),
2862
- isRotatable: isRotatableFor(annotation, true),
2863
- lockAspectRatio: lockAspectRatio(annotation),
2864
- onSelect: (e) => handleClick(e, annotation),
2865
- vertexConfig: getVertexConfig(annotation),
2866
- selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2867
- style: blendStyle(annotation)
2868
- }, { ref_for: true }, containerProps.value), createSlots({
2869
- default: withCtx(() => [
2870
- createVNode(_sfc_main$a, {
2871
- documentId: __props.documentId,
2872
- isSelected: isSelected(annotation),
2873
- annotation,
2874
3434
  pageIndex: __props.pageIndex,
2875
- scale: __props.scale,
2876
- onClick: (e) => handleClick(e, annotation)
2877
- }, null, 8, ["documentId", "isSelected", "annotation", "pageIndex", "scale", "onClick"])
3435
+ documentId: __props.documentId,
3436
+ onClick: getOnSelect(annotation, renderer),
3437
+ appearanceActive
3438
+ }, null, 8, ["annotation", "currentObject", "isSelected", "isEditing", "scale", "pageIndex", "documentId", "onClick", "appearanceActive"]))
2878
3439
  ]),
2879
3440
  "resize-handle": withCtx((slotProps) => [
2880
3441
  renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
@@ -2894,159 +3455,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2894
3455
  ]),
2895
3456
  key: "0"
2896
3457
  } : void 0
2897
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isUnderline)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2898
- key: 9,
2899
- trackedAnnotation: annotation,
2900
- isSelected: showIndividualSelection(annotation),
2901
- isDraggable: isDraggable(annotation),
2902
- isResizable: isResizable(annotation),
2903
- isRotatable: isRotatableFor(annotation, false),
2904
- lockAspectRatio: lockAspectRatio(annotation),
2905
- onSelect: (e) => handleClick(e, annotation),
2906
- vertexConfig: getVertexConfig(annotation),
2907
- selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2908
- zIndex: 0,
2909
- style: blendStyle(annotation)
2910
- }, { ref_for: true }, containerProps.value), createSlots({
2911
- default: withCtx(({ annotation: currentObject }) => [
2912
- createVNode(_sfc_main$6, mergeProps({ ref_for: true }, currentObject, {
2913
- scale: __props.scale,
2914
- onClick: (e) => handleClick(e, annotation)
2915
- }), null, 16, ["scale", "onClick"])
2916
- ]),
2917
- _: 2
2918
- }, [
2919
- !isMultiSelected.value ? {
2920
- name: "selection-menu",
2921
- fn: withCtx((slotProps) => [
2922
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2923
- ]),
2924
- key: "0"
2925
- } : void 0
2926
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isStrikeout)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2927
- key: 10,
2928
- trackedAnnotation: annotation,
2929
- isSelected: showIndividualSelection(annotation),
2930
- isDraggable: isDraggable(annotation),
2931
- isResizable: isResizable(annotation),
2932
- isRotatable: isRotatableFor(annotation, false),
2933
- lockAspectRatio: lockAspectRatio(annotation),
2934
- onSelect: (e) => handleClick(e, annotation),
2935
- vertexConfig: getVertexConfig(annotation),
2936
- selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2937
- zIndex: 0,
2938
- style: blendStyle(annotation)
2939
- }, { ref_for: true }, containerProps.value), createSlots({
2940
- default: withCtx(({ annotation: currentObject }) => [
2941
- createVNode(_sfc_main$7, mergeProps({ ref_for: true }, currentObject, {
2942
- scale: __props.scale,
2943
- onClick: (e) => handleClick(e, annotation)
2944
- }), null, 16, ["scale", "onClick"])
2945
- ]),
2946
- _: 2
2947
- }, [
2948
- !isMultiSelected.value ? {
2949
- name: "selection-menu",
2950
- fn: withCtx((slotProps) => [
2951
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2952
- ]),
2953
- key: "0"
2954
- } : void 0
2955
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isSquiggly)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2956
- key: 11,
2957
- trackedAnnotation: annotation,
2958
- isSelected: showIndividualSelection(annotation),
2959
- isDraggable: isDraggable(annotation),
2960
- isResizable: isResizable(annotation),
2961
- isRotatable: isRotatableFor(annotation, false),
2962
- lockAspectRatio: lockAspectRatio(annotation),
2963
- onSelect: (e) => handleClick(e, annotation),
2964
- vertexConfig: getVertexConfig(annotation),
2965
- selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2966
- zIndex: 0,
2967
- style: blendStyle(annotation)
2968
- }, { ref_for: true }, containerProps.value), createSlots({
2969
- default: withCtx(({ annotation: currentObject }) => [
2970
- createVNode(_sfc_main$8, mergeProps({ ref_for: true }, currentObject, {
2971
- scale: __props.scale,
2972
- onClick: (e) => handleClick(e, annotation)
2973
- }), null, 16, ["scale", "onClick"])
2974
- ]),
2975
- _: 2
2976
- }, [
2977
- !isMultiSelected.value ? {
2978
- name: "selection-menu",
2979
- fn: withCtx((slotProps) => [
2980
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2981
- ]),
2982
- key: "0"
2983
- } : void 0
2984
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isHighlight)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2985
- key: 12,
2986
- trackedAnnotation: annotation,
2987
- isSelected: showIndividualSelection(annotation),
2988
- isDraggable: isDraggable(annotation),
2989
- isResizable: isResizable(annotation),
2990
- isRotatable: isRotatableFor(annotation, false),
2991
- lockAspectRatio: lockAspectRatio(annotation),
2992
- onSelect: (e) => handleClick(e, annotation),
2993
- vertexConfig: getVertexConfig(annotation),
2994
- selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2995
- zIndex: 0,
2996
- style: blendStyle(annotation, unref(PdfBlendMode).Multiply)
2997
- }, { ref_for: true }, containerProps.value), createSlots({
2998
- default: withCtx(({ annotation: currentObject }) => [
2999
- createVNode(_sfc_main$9, mergeProps({ ref_for: true }, currentObject, {
3000
- scale: __props.scale,
3001
- onClick: (e) => handleClick(e, annotation)
3002
- }), null, 16, ["scale", "onClick"])
3003
- ]),
3004
- _: 2
3005
- }, [
3006
- !isMultiSelected.value ? {
3007
- name: "selection-menu",
3008
- fn: withCtx((slotProps) => [
3009
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
3010
- ]),
3011
- key: "0"
3012
- } : void 0
3013
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "isRotatable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isLink)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
3014
- key: 13,
3015
- trackedAnnotation: annotation,
3016
- isSelected: showIndividualSelection(annotation),
3017
- isMultiSelected: isMultiSelected.value,
3018
- isDraggable: false,
3019
- isResizable: false,
3020
- isRotatable: false,
3021
- lockAspectRatio: false,
3022
- onSelect: (e) => handleLinkClick(e, annotation),
3023
- selectionMenu: annotation.object.inReplyToId ? void 0 : isMultiSelected.value ? void 0 : __props.selectionMenu,
3024
- style: blendStyle(annotation)
3025
- }, { ref_for: true }, containerProps.value), createSlots({
3026
- default: withCtx(({ annotation: currentObject }) => [
3027
- createVNode(_sfc_main$f, mergeProps({ ref_for: true }, currentObject, {
3028
- isSelected: isSelected(annotation),
3029
- scale: __props.scale,
3030
- onClick: (e) => handleLinkClick(e, annotation),
3031
- hasIRT: !!annotation.object.inReplyToId
3032
- }), null, 16, ["isSelected", "scale", "onClick", "hasIRT"])
3033
- ]),
3034
- "resize-handle": withCtx((slotProps) => [
3035
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
3036
- ]),
3037
- _: 2
3038
- }, [
3039
- !isMultiSelected.value && !annotation.object.inReplyToId ? {
3040
- name: "selection-menu",
3041
- fn: withCtx((slotProps) => [
3042
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
3043
- ]),
3044
- key: "0"
3045
- } : void 0
3046
- ]), 1040, ["trackedAnnotation", "isSelected", "isMultiSelected", "onSelect", "selectionMenu", "style"])) : createCommentVNode("", true)
3458
+ ]), 1040, ["trackedAnnotation", "isSelected", "isEditing", "isMultiSelected", "isDraggable", "isResizable", "lockAspectRatio", "isRotatable", "vertexConfig", "selectionMenu", "onSelect", "onDoubleClick", "zIndex", "style", "appearance"])) : createCommentVNode("", true)
3047
3459
  ], 64);
3048
3460
  }), 128)),
3049
- allSelectedOnSamePage.value && selectedAnnotationsOnPage.value.length >= 2 ? (openBlock(), createBlock(_sfc_main$k, {
3461
+ allSelectedOnSamePage.value && selectedAnnotationsOnPage.value.length >= 2 ? (openBlock(), createBlock(_sfc_main$x, {
3050
3462
  key: 0,
3051
3463
  documentId: __props.documentId,
3052
3464
  pageIndex: __props.pageIndex,
@@ -3065,7 +3477,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3065
3477
  selectionOutline: __props.groupSelectionOutline ?? __props.selectionOutline,
3066
3478
  groupSelectionMenu: __props.groupSelectionMenu
3067
3479
  }, {
3068
- "group-selection-menu": withCtx((slotProps) => [
3480
+ "selection-menu": withCtx((slotProps) => [
3069
3481
  renderSlot(_ctx.$slots, "group-selection-menu", normalizeProps(guardReactiveProps(slotProps)))
3070
3482
  ]),
3071
3483
  "resize-handle": withCtx((slotProps) => [
@@ -3129,25 +3541,25 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3129
3541
  inset: 0
3130
3542
  })
3131
3543
  }, [
3132
- activeTool.value.defaults.type === unref(PdfAnnotationSubtype).HIGHLIGHT ? (openBlock(), createBlock(_sfc_main$9, {
3544
+ activeTool.value.defaults.type === unref(PdfAnnotationSubtype).HIGHLIGHT ? (openBlock(), createBlock(_sfc_main$d, {
3133
3545
  key: 0,
3134
3546
  strokeColor: activeTool.value.defaults.strokeColor,
3135
3547
  opacity: activeTool.value.defaults.opacity,
3136
3548
  segmentRects: rects.value,
3137
3549
  scale: __props.scale
3138
- }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).UNDERLINE ? (openBlock(), createBlock(_sfc_main$6, {
3550
+ }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).UNDERLINE ? (openBlock(), createBlock(_sfc_main$b, {
3139
3551
  key: 1,
3140
3552
  strokeColor: activeTool.value.defaults.strokeColor,
3141
3553
  opacity: activeTool.value.defaults.opacity,
3142
3554
  segmentRects: rects.value,
3143
3555
  scale: __props.scale
3144
- }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).STRIKEOUT ? (openBlock(), createBlock(_sfc_main$7, {
3556
+ }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).STRIKEOUT ? (openBlock(), createBlock(_sfc_main$9, {
3145
3557
  key: 2,
3146
3558
  strokeColor: activeTool.value.defaults.strokeColor,
3147
3559
  opacity: activeTool.value.defaults.opacity,
3148
3560
  segmentRects: rects.value,
3149
3561
  scale: __props.scale
3150
- }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).SQUIGGLY ? (openBlock(), createBlock(_sfc_main$8, {
3562
+ }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).SQUIGGLY ? (openBlock(), createBlock(_sfc_main$7, {
3151
3563
  key: 3,
3152
3564
  strokeColor: activeTool.value.defaults.strokeColor,
3153
3565
  opacity: activeTool.value.defaults.opacity,
@@ -3179,27 +3591,27 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3179
3591
  return openBlock(), createElementBlock("div", {
3180
3592
  style: normalizeStyle(style.value)
3181
3593
  }, [
3182
- __props.preview.type === unref(PdfAnnotationSubtype).CIRCLE ? (openBlock(), createBlock(unref(_sfc_main$j), mergeProps({
3594
+ __props.preview.type === unref(PdfAnnotationSubtype).CIRCLE ? (openBlock(), createBlock(unref(_sfc_main$s), mergeProps({
3183
3595
  key: 0,
3184
3596
  isSelected: false,
3185
3597
  scale: __props.scale
3186
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).SQUARE ? (openBlock(), createBlock(unref(_sfc_main$c), mergeProps({
3598
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).SQUARE ? (openBlock(), createBlock(unref(_sfc_main$u), mergeProps({
3187
3599
  key: 1,
3188
3600
  isSelected: false,
3189
3601
  scale: __props.scale
3190
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYGON ? (openBlock(), createBlock(unref(_sfc_main$e), mergeProps({
3602
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYGON ? (openBlock(), createBlock(unref(_sfc_main$m), mergeProps({
3191
3603
  key: 2,
3192
3604
  isSelected: false,
3193
3605
  scale: __props.scale
3194
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYLINE ? (openBlock(), createBlock(unref(_sfc_main$d), mergeProps({
3606
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYLINE ? (openBlock(), createBlock(unref(_sfc_main$o), mergeProps({
3195
3607
  key: 3,
3196
3608
  isSelected: false,
3197
3609
  scale: __props.scale
3198
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).LINE ? (openBlock(), createBlock(unref(_sfc_main$g), mergeProps({
3610
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).LINE ? (openBlock(), createBlock(unref(_sfc_main$q), mergeProps({
3199
3611
  key: 4,
3200
3612
  isSelected: false,
3201
3613
  scale: __props.scale
3202
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).INK ? (openBlock(), createBlock(unref(_sfc_main$h), mergeProps({
3614
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).INK ? (openBlock(), createBlock(unref(_sfc_main$w), mergeProps({
3203
3615
  key: 5,
3204
3616
  isSelected: false,
3205
3617
  scale: __props.scale
@@ -3317,45 +3729,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3317
3729
  };
3318
3730
  }
3319
3731
  });
3320
- const RendererRegistryKey = Symbol(
3321
- "AnnotationRendererRegistry"
3322
- );
3323
- function createRendererRegistry() {
3324
- const renderers = shallowRef([]);
3325
- return {
3326
- register(entries) {
3327
- const ids = new Set(entries.map((e) => e.id));
3328
- renderers.value = [...renderers.value.filter((r) => !ids.has(r.id)), ...entries];
3329
- return () => {
3330
- renderers.value = renderers.value.filter((r) => !entries.some((e) => e.id === r.id));
3331
- };
3332
- },
3333
- getAll() {
3334
- return renderers.value;
3335
- }
3336
- };
3337
- }
3338
- function provideRendererRegistry() {
3339
- const registry = createRendererRegistry();
3340
- provide(RendererRegistryKey, registry);
3341
- return registry;
3342
- }
3343
- function useRendererRegistry() {
3344
- return inject(RendererRegistryKey, null);
3345
- }
3346
- function useRegisterRenderers(entries) {
3347
- const registry = useRendererRegistry();
3348
- if (!registry) return;
3349
- const unregister = registry.register(entries);
3350
- onUnmounted(unregister);
3351
- }
3352
- function createRenderer(entry) {
3353
- return {
3354
- id: entry.id,
3355
- matches: entry.matches,
3356
- component: markRaw(entry.component)
3357
- };
3358
- }
3359
3732
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3360
3733
  __name: "annotation-layer",
3361
3734
  props: {
@@ -3489,29 +3862,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3489
3862
  });
3490
3863
  const AnnotationPluginPackage = createPluginPackage(AnnotationPluginPackage$1).addWrapper(_sfc_main).build();
3491
3864
  export {
3492
- _sfc_main$l as AnnotationContainer,
3865
+ _sfc_main$y as AnnotationContainer,
3493
3866
  _sfc_main$1 as AnnotationLayer,
3494
3867
  _sfc_main$2 as AnnotationPaintLayer,
3495
3868
  AnnotationPluginPackage,
3496
3869
  _sfc_main$5 as Annotations,
3497
- _sfc_main$j as Circle,
3498
- _sfc_main$i as FreeText,
3499
- _sfc_main$k as GroupSelectionBox,
3500
- _sfc_main$9 as Highlight,
3501
- _sfc_main$h as Ink,
3502
- _sfc_main$g as Line,
3870
+ _sfc_main$s as Circle,
3871
+ _sfc_main$k as FreeText,
3872
+ _sfc_main$x as GroupSelectionBox,
3873
+ _sfc_main$d as Highlight,
3874
+ _sfc_main$w as Ink,
3875
+ _sfc_main$q as Line,
3503
3876
  _sfc_main$f as Link,
3504
- _sfc_main$e as Polygon,
3505
- _sfc_main$d as Polyline,
3877
+ _sfc_main$m as Polygon,
3878
+ _sfc_main$o as Polyline,
3506
3879
  _sfc_main$3 as PreviewRenderer,
3507
- _sfc_main$b as RenderAnnotation,
3880
+ _sfc_main$i as RenderAnnotation,
3508
3881
  _sfc_main as RendererRegistryProvider,
3509
- _sfc_main$c as Square,
3510
- _sfc_main$8 as Squiggly,
3511
- _sfc_main$a as Stamp,
3512
- _sfc_main$7 as Strikeout,
3882
+ _sfc_main$u as Square,
3883
+ _sfc_main$7 as Squiggly,
3884
+ _sfc_main$h as Stamp,
3885
+ _sfc_main$9 as Strikeout,
3513
3886
  _sfc_main$4 as TextMarkup,
3514
- _sfc_main$6 as Underline,
3887
+ _sfc_main$b as Underline,
3515
3888
  createRenderer,
3516
3889
  createRendererRegistry,
3517
3890
  provideRendererRegistry,