@embedpdf/plugin-annotation 2.1.2 → 2.3.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 (97) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1232 -93
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +31 -2
  6. package/dist/lib/annotation-plugin.d.ts +177 -2
  7. package/dist/lib/handlers/types.d.ts +1 -1
  8. package/dist/lib/helpers.d.ts +6 -1
  9. package/dist/lib/selectors.d.ts +97 -8
  10. package/dist/lib/tools/default-tools.d.ts +39 -11
  11. package/dist/lib/tools/types.d.ts +7 -1
  12. package/dist/lib/types.d.ts +265 -1
  13. package/dist/preact/adapter.d.ts +3 -3
  14. package/dist/preact/index.cjs +1 -1
  15. package/dist/preact/index.cjs.map +1 -1
  16. package/dist/preact/index.js +867 -406
  17. package/dist/preact/index.js.map +1 -1
  18. package/dist/react/adapter.d.ts +1 -1
  19. package/dist/react/index.cjs +1 -1
  20. package/dist/react/index.cjs.map +1 -1
  21. package/dist/react/index.js +867 -406
  22. package/dist/react/index.js.map +1 -1
  23. package/dist/shared/components/annotation-container.d.ts +8 -1
  24. package/dist/shared/components/annotation-layer.d.ts +4 -2
  25. package/dist/shared/components/annotations/ink.d.ts +3 -3
  26. package/dist/shared/components/annotations/link.d.ts +28 -0
  27. package/dist/shared/components/annotations.d.ts +2 -1
  28. package/dist/shared/components/group-selection-box.d.ts +32 -0
  29. package/dist/shared/components/index.d.ts +1 -0
  30. package/dist/shared/components/text-markup/highlight.d.ts +3 -2
  31. package/dist/shared/components/text-markup/squiggly.d.ts +3 -2
  32. package/dist/shared/components/text-markup/strikeout.d.ts +3 -2
  33. package/dist/shared/components/text-markup/underline.d.ts +3 -2
  34. package/dist/shared/components/types.d.ts +7 -0
  35. package/dist/shared-preact/components/annotation-container.d.ts +8 -1
  36. package/dist/shared-preact/components/annotation-layer.d.ts +4 -2
  37. package/dist/shared-preact/components/annotations/ink.d.ts +3 -3
  38. package/dist/shared-preact/components/annotations/link.d.ts +28 -0
  39. package/dist/shared-preact/components/annotations.d.ts +2 -1
  40. package/dist/shared-preact/components/group-selection-box.d.ts +32 -0
  41. package/dist/shared-preact/components/index.d.ts +1 -0
  42. package/dist/shared-preact/components/text-markup/highlight.d.ts +3 -2
  43. package/dist/shared-preact/components/text-markup/squiggly.d.ts +3 -2
  44. package/dist/shared-preact/components/text-markup/strikeout.d.ts +3 -2
  45. package/dist/shared-preact/components/text-markup/underline.d.ts +3 -2
  46. package/dist/shared-preact/components/types.d.ts +7 -0
  47. package/dist/shared-react/components/annotation-container.d.ts +8 -1
  48. package/dist/shared-react/components/annotation-layer.d.ts +4 -2
  49. package/dist/shared-react/components/annotations/ink.d.ts +3 -3
  50. package/dist/shared-react/components/annotations/link.d.ts +28 -0
  51. package/dist/shared-react/components/annotations.d.ts +2 -1
  52. package/dist/shared-react/components/group-selection-box.d.ts +32 -0
  53. package/dist/shared-react/components/index.d.ts +1 -0
  54. package/dist/shared-react/components/text-markup/highlight.d.ts +3 -2
  55. package/dist/shared-react/components/text-markup/squiggly.d.ts +3 -2
  56. package/dist/shared-react/components/text-markup/strikeout.d.ts +3 -2
  57. package/dist/shared-react/components/text-markup/underline.d.ts +3 -2
  58. package/dist/shared-react/components/types.d.ts +7 -0
  59. package/dist/svelte/components/AnnotationLayer.svelte.d.ts +5 -1
  60. package/dist/svelte/components/Annotations.svelte.d.ts +5 -1
  61. package/dist/svelte/components/GroupSelectionBox.svelte.d.ts +32 -0
  62. package/dist/svelte/components/annotations/Ink.svelte.d.ts +2 -1
  63. package/dist/svelte/components/annotations/Link.svelte.d.ts +24 -0
  64. package/dist/svelte/components/annotations/index.d.ts +1 -0
  65. package/dist/svelte/components/index.d.ts +1 -0
  66. package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +2 -1
  67. package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +2 -1
  68. package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +2 -1
  69. package/dist/svelte/components/text-markup/Underline.svelte.d.ts +2 -1
  70. package/dist/svelte/components/types.d.ts +2 -0
  71. package/dist/svelte/index.cjs +1 -1
  72. package/dist/svelte/index.cjs.map +1 -1
  73. package/dist/svelte/index.js +912 -258
  74. package/dist/svelte/index.js.map +1 -1
  75. package/dist/svelte/types.d.ts +7 -0
  76. package/dist/vue/components/annotation-container.vue.d.ts +2 -0
  77. package/dist/vue/components/annotation-layer.vue.d.ts +28 -5
  78. package/dist/vue/components/annotations/index.d.ts +1 -0
  79. package/dist/vue/components/annotations/ink.vue.d.ts +2 -2
  80. package/dist/vue/components/annotations/line.vue.d.ts +1 -1
  81. package/dist/vue/components/annotations/link.vue.d.ts +29 -0
  82. package/dist/vue/components/annotations/polygon.vue.d.ts +1 -1
  83. package/dist/vue/components/annotations/polyline.vue.d.ts +1 -1
  84. package/dist/vue/components/annotations.vue.d.ts +65 -1
  85. package/dist/vue/components/group-selection-box.vue.d.ts +73 -0
  86. package/dist/vue/components/index.d.ts +1 -0
  87. package/dist/vue/components/text-markup/highlight.vue.d.ts +2 -2
  88. package/dist/vue/components/text-markup/squiggly.vue.d.ts +2 -2
  89. package/dist/vue/components/text-markup/strikeout.vue.d.ts +2 -2
  90. package/dist/vue/components/text-markup/underline.vue.d.ts +2 -2
  91. package/dist/vue/hooks/use-annotation.d.ts +2 -0
  92. package/dist/vue/index.cjs +1 -1
  93. package/dist/vue/index.cjs.map +1 -1
  94. package/dist/vue/index.js +962 -409
  95. package/dist/vue/index.js.map +1 -1
  96. package/dist/vue/types.d.ts +7 -0
  97. package/package.json +10 -10
@@ -1,10 +1,10 @@
1
- import { usePlugin, useCapability, useDocumentState } from "@embedpdf/core/preact";
2
- import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationByPageIndex, isInk, isSquare, isCircle, isUnderline, isStrikeout, isSquiggly, isHighlight, isLine, isPolyline, isPolygon, isFreeText, isStamp } from "@embedpdf/plugin-annotation";
1
+ import { usePlugin, useCapability, useDocumentPermissions, useDocumentState } from "@embedpdf/core/preact";
2
+ import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationIds, isInk, isSquare, isCircle, isUnderline, isStrikeout, isSquiggly, isHighlight, isLine, isPolyline, isPolygon, isFreeText, isStamp, isLink } from "@embedpdf/plugin-annotation";
3
3
  export * from "@embedpdf/plugin-annotation";
4
4
  import { Fragment as Fragment$1 } from "preact";
5
- import { useState, useEffect, useRef, useMemo, useLayoutEffect, useCallback } from "preact/hooks";
5
+ import { useState, useEffect, useRef, useMemo, useCallback, useLayoutEffect } from "preact/hooks";
6
6
  import { jsxs, jsx, Fragment } from "preact/jsx-runtime";
7
- import { PdfAnnotationBorderStyle, textAlignmentToCss, standardFontCss, PdfVerticalAlignment, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
7
+ import { boundingRectOrEmpty, PdfAnnotationBorderStyle, textAlignmentToCss, standardFontCss, PdfVerticalAlignment, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
8
8
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/preact";
9
9
  import { useSelectionCapability } from "@embedpdf/plugin-selection/preact";
10
10
  import { useInteractionHandles, useDoublePressProps, CounterRotate } from "@embedpdf/utils/preact";
@@ -40,6 +40,7 @@ function AnnotationContainer({
40
40
  trackedAnnotation,
41
41
  children,
42
42
  isSelected,
43
+ isMultiSelected = false,
43
44
  isDraggable,
44
45
  isResizable,
45
46
  lockAspectRatio = false,
@@ -58,7 +59,11 @@ function AnnotationContainer({
58
59
  }) {
59
60
  const [preview, setPreview] = useState(trackedAnnotation.object);
60
61
  const { provides: annotationCapability } = useAnnotationCapability();
62
+ const { plugin } = useAnnotationPlugin();
63
+ const { canModifyAnnotations } = useDocumentPermissions(documentId);
61
64
  const gestureBaseRef = useRef(null);
65
+ const effectiveIsDraggable = canModifyAnnotations && isDraggable && !isMultiSelected;
66
+ const effectiveIsResizable = canModifyAnnotations && isResizable && !isMultiSelected;
62
67
  const annotationProvides = useMemo(
63
68
  () => annotationCapability ? annotationCapability.forDocument(documentId) : null,
64
69
  [annotationCapability, documentId]
@@ -68,6 +73,73 @@ function AnnotationContainer({
68
73
  const VERTEX_COLOR = (vertexUI == null ? void 0 : vertexUI.color) ?? "#007ACC";
69
74
  const HANDLE_SIZE = (resizeUI == null ? void 0 : resizeUI.size) ?? 12;
70
75
  const VERTEX_SIZE = (vertexUI == null ? void 0 : vertexUI.size) ?? 12;
76
+ const gestureBaseRectRef = useRef(null);
77
+ const handleUpdate = useCallback(
78
+ (event) => {
79
+ var _a;
80
+ if (!((_a = event.transformData) == null ? void 0 : _a.type) || isMultiSelected || !plugin) return;
81
+ const { type, changes, metadata } = event.transformData;
82
+ const id = trackedAnnotation.object.id;
83
+ const pageSize = { width: pageWidth, height: pageHeight };
84
+ if (event.state === "start") {
85
+ gestureBaseRectRef.current = trackedAnnotation.object.rect;
86
+ gestureBaseRef.current = trackedAnnotation.object;
87
+ if (type === "move") {
88
+ plugin.startDrag(documentId, { annotationIds: [id], pageSize });
89
+ } else if (type === "resize") {
90
+ plugin.startResize(documentId, {
91
+ annotationIds: [id],
92
+ pageSize,
93
+ resizeHandle: (metadata == null ? void 0 : metadata.handle) ?? "se"
94
+ });
95
+ }
96
+ }
97
+ if (changes.rect && gestureBaseRectRef.current) {
98
+ if (type === "move") {
99
+ const delta = {
100
+ x: changes.rect.origin.x - gestureBaseRectRef.current.origin.x,
101
+ y: changes.rect.origin.y - gestureBaseRectRef.current.origin.y
102
+ };
103
+ plugin.updateDrag(documentId, delta);
104
+ } else if (type === "resize") {
105
+ plugin.updateResize(documentId, changes.rect);
106
+ }
107
+ }
108
+ if (type === "vertex-edit" && changes.vertices && vertexConfig) {
109
+ const base = gestureBaseRef.current ?? trackedAnnotation.object;
110
+ const vertexChanges = vertexConfig.transformAnnotation(base, changes.vertices);
111
+ const patched = annotationCapability == null ? void 0 : annotationCapability.transformAnnotation(base, {
112
+ type,
113
+ changes: vertexChanges,
114
+ metadata
115
+ });
116
+ if (patched) {
117
+ setPreview((prev) => ({ ...prev, ...patched }));
118
+ if (event.state === "end") {
119
+ annotationProvides == null ? void 0 : annotationProvides.updateAnnotation(pageIndex, id, patched);
120
+ }
121
+ }
122
+ }
123
+ if (event.state === "end") {
124
+ gestureBaseRectRef.current = null;
125
+ gestureBaseRef.current = null;
126
+ if (type === "move") plugin.commitDrag(documentId);
127
+ else if (type === "resize") plugin.commitResize(documentId);
128
+ }
129
+ },
130
+ [
131
+ plugin,
132
+ documentId,
133
+ trackedAnnotation.object,
134
+ pageWidth,
135
+ pageHeight,
136
+ pageIndex,
137
+ isMultiSelected,
138
+ vertexConfig,
139
+ annotationCapability,
140
+ annotationProvides
141
+ ]
142
+ );
71
143
  const { dragProps, vertices, resize } = useInteractionHandles({
72
144
  controller: {
73
145
  element: currentObject.rect,
@@ -80,32 +152,9 @@ function AnnotationContainer({
80
152
  maintainAspectRatio: lockAspectRatio,
81
153
  pageRotation: rotation,
82
154
  scale,
83
- enabled: isSelected,
84
- onUpdate: (event) => {
85
- var _a;
86
- if (!((_a = event.transformData) == null ? void 0 : _a.type)) return;
87
- if (event.state === "start") {
88
- gestureBaseRef.current = currentObject;
89
- }
90
- const transformType = event.transformData.type;
91
- const base = gestureBaseRef.current ?? currentObject;
92
- const changes = event.transformData.changes.vertices ? vertexConfig == null ? void 0 : vertexConfig.transformAnnotation(base, event.transformData.changes.vertices) : { rect: event.transformData.changes.rect };
93
- const patched = annotationCapability == null ? void 0 : annotationCapability.transformAnnotation(base, {
94
- type: transformType,
95
- changes,
96
- metadata: event.transformData.metadata
97
- });
98
- if (patched) {
99
- setPreview((prev) => ({
100
- ...prev,
101
- ...patched
102
- }));
103
- }
104
- if (event.state === "end" && patched) {
105
- gestureBaseRef.current = null;
106
- annotationProvides == null ? void 0 : annotationProvides.updateAnnotation(pageIndex, trackedAnnotation.object.id, patched);
107
- }
108
- }
155
+ // Disable interaction handles when multi-selected
156
+ enabled: isSelected && !isMultiSelected,
157
+ onUpdate: handleUpdate
109
158
  },
110
159
  resizeUI: {
111
160
  handleSize: HANDLE_SIZE,
@@ -120,15 +169,33 @@ function AnnotationContainer({
120
169
  },
121
170
  includeVertices: vertexConfig ? true : false
122
171
  });
123
- const doubleProps = useDoublePressProps(onDoubleClick);
172
+ const guardedOnDoubleClick = useMemo(() => {
173
+ if (!canModifyAnnotations || !onDoubleClick) return void 0;
174
+ return onDoubleClick;
175
+ }, [canModifyAnnotations, onDoubleClick]);
176
+ const doubleProps = useDoublePressProps(guardedOnDoubleClick);
124
177
  useEffect(() => {
125
178
  setPreview(trackedAnnotation.object);
126
179
  }, [trackedAnnotation.object]);
180
+ useEffect(() => {
181
+ if (!plugin) return;
182
+ const id = trackedAnnotation.object.id;
183
+ const handleEvent = (event) => {
184
+ var _a;
185
+ if (event.documentId !== documentId) return;
186
+ const patch = (_a = event.previewPatches) == null ? void 0 : _a[id];
187
+ if (event.type === "update" && patch) setPreview((prev) => ({ ...prev, ...patch }));
188
+ else if (event.type === "cancel") setPreview(trackedAnnotation.object);
189
+ };
190
+ const unsubs = [plugin.onDragChange(handleEvent), plugin.onResizeChange(handleEvent)];
191
+ return () => unsubs.forEach((u) => u());
192
+ }, [plugin, documentId, trackedAnnotation.object]);
193
+ const showOutline = isSelected && !isMultiSelected;
127
194
  return /* @__PURE__ */ jsxs("div", { "data-no-interaction": true, children: [
128
195
  /* @__PURE__ */ jsxs(
129
196
  "div",
130
197
  {
131
- ...isDraggable && isSelected ? dragProps : {},
198
+ ...effectiveIsDraggable && isSelected ? dragProps : {},
132
199
  ...doubleProps,
133
200
  style: {
134
201
  position: "absolute",
@@ -136,11 +203,11 @@ function AnnotationContainer({
136
203
  top: currentObject.rect.origin.y * scale,
137
204
  width: currentObject.rect.size.width * scale,
138
205
  height: currentObject.rect.size.height * scale,
139
- outline: isSelected ? `1px solid ${selectionOutlineColor}` : "none",
140
- outlineOffset: isSelected ? `${outlineOffset}px` : "0px",
141
- pointerEvents: isSelected ? "auto" : "none",
206
+ outline: showOutline ? `1px solid ${selectionOutlineColor}` : "none",
207
+ outlineOffset: showOutline ? `${outlineOffset}px` : "0px",
208
+ pointerEvents: isSelected && !isMultiSelected ? "auto" : "none",
142
209
  touchAction: "none",
143
- cursor: isSelected && isDraggable ? "move" : "default",
210
+ cursor: isSelected && effectiveIsDraggable ? "move" : "default",
144
211
  zIndex,
145
212
  ...style
146
213
  },
@@ -164,7 +231,7 @@ function AnnotationContainer({
164
231
  }
165
232
  return childrenRender;
166
233
  })(),
167
- isSelected && isResizable && resize.map(
234
+ isSelected && effectiveIsResizable && resize.map(
168
235
  ({ key, ...hProps }) => (resizeUI == null ? void 0 : resizeUI.component) ? resizeUI.component({
169
236
  key,
170
237
  ...hProps,
@@ -178,7 +245,7 @@ function AnnotationContainer({
178
245
  key
179
246
  )
180
247
  ),
181
- isSelected && vertices.map(
248
+ isSelected && canModifyAnnotations && !isMultiSelected && vertices.map(
182
249
  ({ key, ...vProps }) => (vertexUI == null ? void 0 : vertexUI.component) ? vertexUI.component({
183
250
  key,
184
251
  ...vProps,
@@ -195,7 +262,7 @@ function AnnotationContainer({
195
262
  ]
196
263
  }
197
264
  ),
198
- selectionMenu && /* @__PURE__ */ jsx(
265
+ selectionMenu && !isMultiSelected && /* @__PURE__ */ jsx(
199
266
  CounterRotate,
200
267
  {
201
268
  rect: {
@@ -209,8 +276,8 @@ function AnnotationContainer({
209
276
  }
210
277
  },
211
278
  rotation,
212
- children: (props2) => selectionMenu({
213
- ...props2,
279
+ children: (counterRotateProps) => selectionMenu({
280
+ ...counterRotateProps,
214
281
  context: {
215
282
  type: "annotation",
216
283
  annotation: trackedAnnotation,
@@ -225,8 +292,194 @@ function AnnotationContainer({
225
292
  )
226
293
  ] });
227
294
  }
295
+ function GroupSelectionBox({
296
+ documentId,
297
+ pageIndex,
298
+ scale,
299
+ rotation,
300
+ pageWidth,
301
+ pageHeight,
302
+ selectedAnnotations,
303
+ isDraggable,
304
+ isResizable,
305
+ resizeUI,
306
+ selectionOutlineColor = "#007ACC",
307
+ outlineOffset = 2,
308
+ zIndex = 100,
309
+ groupSelectionMenu
310
+ }) {
311
+ const { plugin } = useAnnotationPlugin();
312
+ const gestureBaseRef = useRef(null);
313
+ const isDraggingRef = useRef(false);
314
+ const isResizingRef = useRef(false);
315
+ const groupBox = useMemo(() => {
316
+ const rects = selectedAnnotations.map((ta) => ta.object.rect);
317
+ return boundingRectOrEmpty(rects);
318
+ }, [selectedAnnotations]);
319
+ const [previewGroupBox, setPreviewGroupBox] = useState(groupBox);
320
+ useEffect(() => {
321
+ if (!isDraggingRef.current && !isResizingRef.current) {
322
+ setPreviewGroupBox(groupBox);
323
+ }
324
+ }, [groupBox]);
325
+ const handleUpdate = useCallback(
326
+ (event) => {
327
+ var _a, _b;
328
+ if (!((_a = event.transformData) == null ? void 0 : _a.type)) return;
329
+ if (!plugin) return;
330
+ const transformType = event.transformData.type;
331
+ const isMove = transformType === "move";
332
+ const isResize = transformType === "resize";
333
+ if (isMove && !isDraggable) return;
334
+ if (event.state === "start") {
335
+ gestureBaseRef.current = groupBox;
336
+ if (isMove) {
337
+ isDraggingRef.current = true;
338
+ plugin.startDrag(documentId, {
339
+ annotationIds: selectedAnnotations.map((ta) => ta.object.id),
340
+ pageSize: { width: pageWidth, height: pageHeight }
341
+ });
342
+ } else if (isResize) {
343
+ isResizingRef.current = true;
344
+ plugin.startResize(documentId, {
345
+ annotationIds: selectedAnnotations.map((ta) => ta.object.id),
346
+ pageSize: { width: pageWidth, height: pageHeight },
347
+ resizeHandle: ((_b = event.transformData.metadata) == null ? void 0 : _b.handle) ?? "se"
348
+ });
349
+ }
350
+ }
351
+ const base = gestureBaseRef.current ?? groupBox;
352
+ if (isMove && event.transformData.changes.rect) {
353
+ const newRect = event.transformData.changes.rect;
354
+ const rawDelta = {
355
+ x: newRect.origin.x - base.origin.x,
356
+ y: newRect.origin.y - base.origin.y
357
+ };
358
+ const clampedDelta = plugin.updateDrag(documentId, rawDelta);
359
+ setPreviewGroupBox({
360
+ ...base,
361
+ origin: {
362
+ x: base.origin.x + clampedDelta.x,
363
+ y: base.origin.y + clampedDelta.y
364
+ }
365
+ });
366
+ } else if (isResize && event.transformData.changes.rect) {
367
+ const newGroupBox = event.transformData.changes.rect;
368
+ plugin.updateResize(documentId, newGroupBox);
369
+ setPreviewGroupBox(newGroupBox);
370
+ }
371
+ if (event.state === "end") {
372
+ gestureBaseRef.current = null;
373
+ if (isMove && isDraggingRef.current) {
374
+ isDraggingRef.current = false;
375
+ plugin.commitDrag(documentId);
376
+ } else if (isResize && isResizingRef.current) {
377
+ isResizingRef.current = false;
378
+ plugin.commitResize(documentId);
379
+ }
380
+ }
381
+ },
382
+ [plugin, documentId, pageWidth, pageHeight, groupBox, isDraggable, selectedAnnotations]
383
+ );
384
+ const HANDLE_COLOR = (resizeUI == null ? void 0 : resizeUI.color) ?? "#007ACC";
385
+ const HANDLE_SIZE = (resizeUI == null ? void 0 : resizeUI.size) ?? 12;
386
+ const { dragProps, resize } = useInteractionHandles({
387
+ controller: {
388
+ element: previewGroupBox,
389
+ constraints: {
390
+ minWidth: 20,
391
+ minHeight: 20,
392
+ boundingBox: { width: pageWidth, height: pageHeight }
393
+ },
394
+ maintainAspectRatio: false,
395
+ pageRotation: rotation,
396
+ scale,
397
+ enabled: true,
398
+ onUpdate: handleUpdate
399
+ },
400
+ resizeUI: {
401
+ handleSize: HANDLE_SIZE,
402
+ spacing: outlineOffset,
403
+ offsetMode: "outside",
404
+ includeSides: true,
405
+ zIndex: zIndex + 1
406
+ },
407
+ vertexUI: {
408
+ vertexSize: 0,
409
+ zIndex
410
+ },
411
+ includeVertices: false
412
+ });
413
+ if (selectedAnnotations.length < 2) {
414
+ return null;
415
+ }
416
+ return /* @__PURE__ */ jsxs("div", { "data-group-selection-box": true, "data-no-interaction": true, children: [
417
+ /* @__PURE__ */ jsx(
418
+ "div",
419
+ {
420
+ ...isDraggable ? dragProps : {
421
+ onPointerDown: (e) => e.stopPropagation()
422
+ },
423
+ style: {
424
+ position: "absolute",
425
+ left: previewGroupBox.origin.x * scale,
426
+ top: previewGroupBox.origin.y * scale,
427
+ width: previewGroupBox.size.width * scale,
428
+ height: previewGroupBox.size.height * scale,
429
+ outline: `2px dashed ${selectionOutlineColor}`,
430
+ outlineOffset: outlineOffset - 1,
431
+ cursor: isDraggable ? "move" : "default",
432
+ touchAction: "none",
433
+ zIndex
434
+ },
435
+ children: isResizable && resize.map(
436
+ ({ key, ...hProps }) => (resizeUI == null ? void 0 : resizeUI.component) ? resizeUI.component({
437
+ key,
438
+ ...hProps,
439
+ backgroundColor: HANDLE_COLOR
440
+ }) : /* @__PURE__ */ jsx(
441
+ "div",
442
+ {
443
+ ...hProps,
444
+ style: { ...hProps.style, backgroundColor: HANDLE_COLOR }
445
+ },
446
+ key
447
+ )
448
+ )
449
+ }
450
+ ),
451
+ groupSelectionMenu && /* @__PURE__ */ jsx(
452
+ CounterRotate,
453
+ {
454
+ rect: {
455
+ origin: {
456
+ x: previewGroupBox.origin.x * scale,
457
+ y: previewGroupBox.origin.y * scale
458
+ },
459
+ size: {
460
+ width: previewGroupBox.size.width * scale,
461
+ height: previewGroupBox.size.height * scale
462
+ }
463
+ },
464
+ rotation,
465
+ children: (counterRotateProps) => groupSelectionMenu({
466
+ ...counterRotateProps,
467
+ context: {
468
+ type: "group",
469
+ annotations: selectedAnnotations,
470
+ pageIndex
471
+ },
472
+ selected: true,
473
+ placement: {
474
+ suggestTop: false
475
+ }
476
+ })
477
+ }
478
+ )
479
+ ] });
480
+ }
228
481
  function Highlight({
229
- color = "#FFFF00",
482
+ strokeColor,
230
483
  opacity = 0.5,
231
484
  segmentRects,
232
485
  rect,
@@ -234,6 +487,7 @@ function Highlight({
234
487
  onClick,
235
488
  style
236
489
  }) {
490
+ const resolvedColor = strokeColor ?? "#FFFF00";
237
491
  return /* @__PURE__ */ jsx(Fragment, { children: segmentRects.map((b, i) => /* @__PURE__ */ jsx(
238
492
  "div",
239
493
  {
@@ -245,7 +499,7 @@ function Highlight({
245
499
  top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,
246
500
  width: b.size.width * scale,
247
501
  height: b.size.height * scale,
248
- background: color,
502
+ background: resolvedColor,
249
503
  opacity,
250
504
  pointerEvents: onClick ? "auto" : "none",
251
505
  cursor: onClick ? "pointer" : "default",
@@ -257,7 +511,7 @@ function Highlight({
257
511
  )) });
258
512
  }
259
513
  function Underline({
260
- color = "#FFFF00",
514
+ strokeColor,
261
515
  opacity = 0.5,
262
516
  segmentRects,
263
517
  rect,
@@ -265,6 +519,7 @@ function Underline({
265
519
  onClick,
266
520
  style
267
521
  }) {
522
+ const resolvedColor = strokeColor ?? "#FFFF00";
268
523
  const thickness = 2 * scale;
269
524
  return /* @__PURE__ */ jsx(Fragment, { children: segmentRects.map((r, i) => /* @__PURE__ */ jsx(
270
525
  "div",
@@ -292,7 +547,7 @@ function Underline({
292
547
  bottom: 0,
293
548
  width: "100%",
294
549
  height: thickness,
295
- background: color,
550
+ background: resolvedColor,
296
551
  opacity,
297
552
  pointerEvents: "none"
298
553
  }
@@ -303,7 +558,7 @@ function Underline({
303
558
  )) });
304
559
  }
305
560
  function Strikeout({
306
- color = "#FFFF00",
561
+ strokeColor,
307
562
  opacity = 0.5,
308
563
  segmentRects,
309
564
  rect,
@@ -311,6 +566,7 @@ function Strikeout({
311
566
  onClick,
312
567
  style
313
568
  }) {
569
+ const resolvedColor = strokeColor ?? "#FFFF00";
314
570
  const thickness = 2 * scale;
315
571
  return /* @__PURE__ */ jsx(Fragment, { children: segmentRects.map((r, i) => /* @__PURE__ */ jsx(
316
572
  "div",
@@ -338,7 +594,7 @@ function Strikeout({
338
594
  top: "50%",
339
595
  width: "100%",
340
596
  height: thickness,
341
- background: color,
597
+ background: resolvedColor,
342
598
  opacity,
343
599
  transform: "translateY(-50%)",
344
600
  pointerEvents: "none"
@@ -350,7 +606,7 @@ function Strikeout({
350
606
  )) });
351
607
  }
352
608
  function Squiggly({
353
- color = "#FFFF00",
609
+ strokeColor,
354
610
  opacity = 0.5,
355
611
  segmentRects,
356
612
  rect,
@@ -358,11 +614,12 @@ function Squiggly({
358
614
  onClick,
359
615
  style
360
616
  }) {
617
+ const resolvedColor = strokeColor ?? "#FFFF00";
361
618
  const amplitude = 2 * scale;
362
619
  const period = 6 * scale;
363
620
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${period}" height="${amplitude * 2}" viewBox="0 0 ${period} ${amplitude * 2}">
364
621
  <path d="M0 ${amplitude} Q ${period / 4} 0 ${period / 2} ${amplitude} T ${period} ${amplitude}"
365
- fill="none" stroke="${color}" stroke-width="${amplitude}" stroke-linecap="round"/>
622
+ fill="none" stroke="${resolvedColor}" stroke-width="${amplitude}" stroke-linecap="round"/>
366
623
  </svg>`;
367
624
  const svgDataUri = `url("data:image/svg+xml;utf8,${encodeURIComponent(svg)}")`;
368
625
  return /* @__PURE__ */ jsx(Fragment, { children: segmentRects.map((r, i) => /* @__PURE__ */ jsx(
@@ -405,7 +662,7 @@ function Squiggly({
405
662
  }
406
663
  function Ink({
407
664
  isSelected,
408
- color = "#000000",
665
+ strokeColor,
409
666
  opacity = 1,
410
667
  strokeWidth,
411
668
  inkList,
@@ -413,6 +670,7 @@ function Ink({
413
670
  scale,
414
671
  onClick
415
672
  }) {
673
+ const resolvedColor = strokeColor ?? "#000000";
416
674
  const paths = useMemo(() => {
417
675
  return inkList.map(({ points }) => {
418
676
  let d = "";
@@ -451,7 +709,7 @@ function Ink({
451
709
  style: {
452
710
  cursor: isSelected ? "move" : "pointer",
453
711
  pointerEvents: isSelected ? "none" : "visibleStroke",
454
- stroke: color,
712
+ stroke: resolvedColor,
455
713
  strokeWidth,
456
714
  strokeLinecap: "round",
457
715
  strokeLinejoin: "round"
@@ -989,7 +1247,7 @@ function FreeText({
989
1247
  flexDirection: "column",
990
1248
  justifyContent: annotation.object.verticalAlign === PdfVerticalAlignment.Top ? "flex-start" : annotation.object.verticalAlign === PdfVerticalAlignment.Middle ? "center" : "flex-end",
991
1249
  display: "flex",
992
- backgroundColor: annotation.object.backgroundColor,
1250
+ backgroundColor: annotation.object.color ?? annotation.object.backgroundColor,
993
1251
  opacity: annotation.object.opacity,
994
1252
  width: needsComp ? `${invScalePercent}%` : "100%",
995
1253
  height: needsComp ? `${invScalePercent}%` : "100%",
@@ -1102,26 +1360,123 @@ function Stamp({
1102
1360
  }
1103
1361
  );
1104
1362
  }
1363
+ function Link({
1364
+ isSelected,
1365
+ strokeColor = "#0000FF",
1366
+ strokeWidth = 2,
1367
+ strokeStyle = PdfAnnotationBorderStyle.UNDERLINE,
1368
+ strokeDashArray,
1369
+ rect,
1370
+ scale,
1371
+ onClick,
1372
+ hasIRT = false
1373
+ }) {
1374
+ const { width, height } = useMemo(() => {
1375
+ return {
1376
+ width: rect.size.width,
1377
+ height: rect.size.height
1378
+ };
1379
+ }, [rect]);
1380
+ const svgWidth = width * scale;
1381
+ const svgHeight = height * scale;
1382
+ const dashArray = useMemo(() => {
1383
+ if (strokeStyle === PdfAnnotationBorderStyle.DASHED) {
1384
+ return (strokeDashArray == null ? void 0 : strokeDashArray.join(",")) ?? `${strokeWidth * 3},${strokeWidth}`;
1385
+ }
1386
+ return void 0;
1387
+ }, [strokeStyle, strokeDashArray, strokeWidth]);
1388
+ const isUnderline2 = strokeStyle === PdfAnnotationBorderStyle.UNDERLINE;
1389
+ return /* @__PURE__ */ jsxs(
1390
+ "svg",
1391
+ {
1392
+ style: {
1393
+ position: "absolute",
1394
+ width: svgWidth,
1395
+ height: svgHeight,
1396
+ pointerEvents: "none",
1397
+ zIndex: 2
1398
+ },
1399
+ width: svgWidth,
1400
+ height: svgHeight,
1401
+ viewBox: `0 0 ${width} ${height}`,
1402
+ children: [
1403
+ /* @__PURE__ */ jsx(
1404
+ "rect",
1405
+ {
1406
+ x: 0,
1407
+ y: 0,
1408
+ width,
1409
+ height,
1410
+ fill: "transparent",
1411
+ onPointerDown: hasIRT ? void 0 : onClick,
1412
+ onTouchStart: hasIRT ? void 0 : onClick,
1413
+ style: {
1414
+ cursor: hasIRT ? "default" : isSelected ? "move" : "pointer",
1415
+ pointerEvents: hasIRT ? "none" : isSelected ? "none" : "visible"
1416
+ }
1417
+ }
1418
+ ),
1419
+ isUnderline2 ? (
1420
+ // Underline style: line at bottom of rect
1421
+ /* @__PURE__ */ jsx(
1422
+ "line",
1423
+ {
1424
+ x1: 1,
1425
+ y1: height - 1,
1426
+ x2: width - 1,
1427
+ y2: height - 1,
1428
+ stroke: strokeColor,
1429
+ strokeWidth,
1430
+ strokeDasharray: dashArray,
1431
+ style: {
1432
+ pointerEvents: "none"
1433
+ }
1434
+ }
1435
+ )
1436
+ ) : (
1437
+ // Solid/Dashed style: rectangle border
1438
+ /* @__PURE__ */ jsx(
1439
+ "rect",
1440
+ {
1441
+ x: strokeWidth / 2,
1442
+ y: strokeWidth / 2,
1443
+ width: Math.max(width - strokeWidth, 0),
1444
+ height: Math.max(height - strokeWidth, 0),
1445
+ fill: "transparent",
1446
+ stroke: strokeColor,
1447
+ strokeWidth,
1448
+ strokeDasharray: dashArray,
1449
+ style: {
1450
+ pointerEvents: "none"
1451
+ }
1452
+ }
1453
+ )
1454
+ )
1455
+ ]
1456
+ }
1457
+ );
1458
+ }
1105
1459
  function Annotations(annotationsProps) {
1106
- const { documentId, pageIndex, scale, selectionMenu } = annotationsProps;
1460
+ const { documentId, pageIndex, scale, pageWidth, pageHeight, selectionMenu } = annotationsProps;
1107
1461
  const { provides: annotationCapability } = useAnnotationCapability();
1108
1462
  const { provides: selectionProvides } = useSelectionCapability();
1109
1463
  const [annotations, setAnnotations] = useState([]);
1110
1464
  const { register } = usePointerHandlers({ documentId, pageIndex });
1111
- const [selectionState, setSelectionState] = useState(null);
1465
+ const [allSelectedIds, setAllSelectedIds] = useState([]);
1112
1466
  const [editingId, setEditingId] = useState(null);
1113
1467
  const annotationProvides = useMemo(
1114
1468
  () => annotationCapability ? annotationCapability.forDocument(documentId) : null,
1115
1469
  [annotationCapability, documentId]
1116
1470
  );
1471
+ const isMultiSelected = allSelectedIds.length > 1;
1117
1472
  useEffect(() => {
1118
1473
  if (annotationProvides) {
1119
1474
  const currentState = annotationProvides.getState();
1120
1475
  setAnnotations(getAnnotationsByPageIndex(currentState, pageIndex));
1121
- setSelectionState(getSelectedAnnotationByPageIndex(currentState, pageIndex));
1476
+ setAllSelectedIds(getSelectedAnnotationIds(currentState));
1122
1477
  return annotationProvides.onStateChange((state) => {
1123
1478
  setAnnotations(getAnnotationsByPageIndex(state, pageIndex));
1124
- setSelectionState(getSelectedAnnotationByPageIndex(state, pageIndex));
1479
+ setAllSelectedIds(getSelectedAnnotationIds(state));
1125
1480
  });
1126
1481
  }
1127
1482
  }, [annotationProvides, pageIndex]);
@@ -1140,8 +1495,13 @@ function Annotations(annotationsProps) {
1140
1495
  (e, annotation) => {
1141
1496
  e.stopPropagation();
1142
1497
  if (annotationProvides && selectionProvides) {
1143
- annotationProvides.selectAnnotation(pageIndex, annotation.object.id);
1144
1498
  selectionProvides.clear();
1499
+ const isModifierPressed = "metaKey" in e ? e.metaKey || e.ctrlKey : false;
1500
+ if (isModifierPressed) {
1501
+ annotationProvides.toggleSelection(pageIndex, annotation.object.id);
1502
+ } else {
1503
+ annotationProvides.selectAnnotation(pageIndex, annotation.object.id);
1504
+ }
1145
1505
  if (annotation.object.id !== editingId) {
1146
1506
  setEditingId(null);
1147
1507
  }
@@ -1149,369 +1509,467 @@ function Annotations(annotationsProps) {
1149
1509
  },
1150
1510
  [annotationProvides, selectionProvides, editingId, pageIndex]
1151
1511
  );
1512
+ const handleLinkClick = useCallback(
1513
+ (e, annotation) => {
1514
+ e.stopPropagation();
1515
+ if (!annotationProvides || !selectionProvides) return;
1516
+ selectionProvides.clear();
1517
+ if (annotation.object.inReplyToId) {
1518
+ const parentId = annotation.object.inReplyToId;
1519
+ const parent = annotations.find((a) => a.object.id === parentId);
1520
+ if (parent) {
1521
+ annotationProvides.selectAnnotation(parent.object.pageIndex, parentId);
1522
+ return;
1523
+ }
1524
+ }
1525
+ annotationProvides.selectAnnotation(pageIndex, annotation.object.id);
1526
+ },
1527
+ [annotationProvides, selectionProvides, annotations, pageIndex]
1528
+ );
1152
1529
  useEffect(() => {
1153
1530
  return register(handlers, {
1154
1531
  documentId
1155
1532
  });
1156
1533
  }, [register, handlers]);
1157
- return /* @__PURE__ */ jsx(Fragment, { children: annotations.map((annotation) => {
1158
- const isSelected = (selectionState == null ? void 0 : selectionState.object.id) === annotation.object.id;
1159
- const isEditing = editingId === annotation.object.id;
1160
- const tool = annotationProvides == null ? void 0 : annotationProvides.findToolForAnnotation(annotation.object);
1161
- if (isInk(annotation)) {
1162
- return /* @__PURE__ */ jsx(
1163
- AnnotationContainer,
1164
- {
1165
- trackedAnnotation: annotation,
1166
- isSelected,
1167
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1168
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1169
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1170
- selectionMenu,
1171
- onSelect: (e) => handleClick(e, annotation),
1172
- style: {
1173
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1174
- },
1175
- ...annotationsProps,
1176
- children: (obj) => /* @__PURE__ */ jsx(
1177
- Ink,
1178
- {
1179
- ...obj,
1180
- isSelected,
1181
- scale,
1182
- onClick: (e) => handleClick(e, annotation)
1183
- }
1184
- )
1185
- },
1186
- annotation.object.id
1187
- );
1188
- }
1189
- if (isSquare(annotation)) {
1190
- return /* @__PURE__ */ jsx(
1191
- AnnotationContainer,
1192
- {
1193
- trackedAnnotation: annotation,
1194
- isSelected,
1195
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1196
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1197
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1198
- selectionMenu,
1199
- onSelect: (e) => handleClick(e, annotation),
1200
- style: {
1201
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1202
- },
1203
- ...annotationsProps,
1204
- children: (obj) => /* @__PURE__ */ jsx(
1205
- Square,
1206
- {
1207
- ...obj,
1208
- isSelected,
1209
- scale,
1210
- onClick: (e) => handleClick(e, annotation)
1211
- }
1212
- )
1213
- },
1214
- annotation.object.id
1215
- );
1216
- }
1217
- if (isCircle(annotation)) {
1218
- return /* @__PURE__ */ jsx(
1219
- AnnotationContainer,
1220
- {
1221
- trackedAnnotation: annotation,
1222
- isSelected,
1223
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1224
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1225
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1226
- selectionMenu,
1227
- onSelect: (e) => handleClick(e, annotation),
1228
- style: {
1229
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1230
- },
1231
- ...annotationsProps,
1232
- children: (obj) => /* @__PURE__ */ jsx(
1233
- Circle,
1234
- {
1235
- ...obj,
1236
- isSelected,
1237
- scale,
1238
- onClick: (e) => handleClick(e, annotation)
1239
- }
1240
- )
1241
- },
1242
- annotation.object.id
1243
- );
1244
- }
1245
- if (isUnderline(annotation)) {
1246
- return /* @__PURE__ */ jsx(
1247
- AnnotationContainer,
1248
- {
1249
- trackedAnnotation: annotation,
1250
- isSelected,
1251
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1252
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1253
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1254
- selectionMenu,
1255
- onSelect: (e) => handleClick(e, annotation),
1256
- zIndex: 0,
1257
- style: {
1258
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1534
+ const selectedAnnotationsOnPage = useMemo(() => {
1535
+ return annotations.filter((anno) => allSelectedIds.includes(anno.object.id));
1536
+ }, [annotations, allSelectedIds]);
1537
+ const areAllSelectedDraggable = useMemo(() => {
1538
+ if (selectedAnnotationsOnPage.length < 2) return false;
1539
+ return selectedAnnotationsOnPage.every((ta) => {
1540
+ const tool = annotationProvides == null ? void 0 : annotationProvides.findToolForAnnotation(ta.object);
1541
+ return (tool == null ? void 0 : tool.interaction.isGroupDraggable) ?? (tool == null ? void 0 : tool.interaction.isDraggable) ?? true;
1542
+ });
1543
+ }, [selectedAnnotationsOnPage, annotationProvides]);
1544
+ const areAllSelectedResizable = useMemo(() => {
1545
+ if (selectedAnnotationsOnPage.length < 2) return false;
1546
+ return selectedAnnotationsOnPage.every((ta) => {
1547
+ const tool = annotationProvides == null ? void 0 : annotationProvides.findToolForAnnotation(ta.object);
1548
+ return (tool == null ? void 0 : tool.interaction.isGroupResizable) ?? (tool == null ? void 0 : tool.interaction.isResizable) ?? true;
1549
+ });
1550
+ }, [selectedAnnotationsOnPage, annotationProvides]);
1551
+ const allSelectedOnSamePage = useMemo(() => {
1552
+ if (!annotationProvides) return false;
1553
+ const allSelected = annotationProvides.getSelectedAnnotations();
1554
+ return allSelected.length > 1 && allSelected.every((ta) => ta.object.pageIndex === pageIndex);
1555
+ }, [annotationProvides, pageIndex, allSelectedIds]);
1556
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1557
+ annotations.map((annotation) => {
1558
+ const isSelected = allSelectedIds.includes(annotation.object.id);
1559
+ const isEditing = editingId === annotation.object.id;
1560
+ const tool = annotationProvides == null ? void 0 : annotationProvides.findToolForAnnotation(annotation.object);
1561
+ if (isInk(annotation)) {
1562
+ return /* @__PURE__ */ jsx(
1563
+ AnnotationContainer,
1564
+ {
1565
+ trackedAnnotation: annotation,
1566
+ isSelected,
1567
+ isMultiSelected,
1568
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1569
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1570
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1571
+ selectionMenu,
1572
+ onSelect: (e) => handleClick(e, annotation),
1573
+ style: {
1574
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1575
+ },
1576
+ ...annotationsProps,
1577
+ children: (obj) => /* @__PURE__ */ jsx(
1578
+ Ink,
1579
+ {
1580
+ ...obj,
1581
+ isSelected,
1582
+ scale,
1583
+ onClick: (e) => handleClick(e, annotation)
1584
+ }
1585
+ )
1259
1586
  },
1260
- ...annotationsProps,
1261
- children: (obj) => /* @__PURE__ */ jsx(Underline, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1262
- },
1263
- annotation.object.id
1264
- );
1265
- }
1266
- if (isStrikeout(annotation)) {
1267
- return /* @__PURE__ */ jsx(
1268
- AnnotationContainer,
1269
- {
1270
- trackedAnnotation: annotation,
1271
- isSelected,
1272
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1273
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1274
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1275
- selectionMenu,
1276
- onSelect: (e) => handleClick(e, annotation),
1277
- zIndex: 0,
1278
- style: {
1279
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1587
+ annotation.object.id
1588
+ );
1589
+ }
1590
+ if (isSquare(annotation)) {
1591
+ return /* @__PURE__ */ jsx(
1592
+ AnnotationContainer,
1593
+ {
1594
+ trackedAnnotation: annotation,
1595
+ isSelected,
1596
+ isMultiSelected,
1597
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1598
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1599
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1600
+ selectionMenu,
1601
+ onSelect: (e) => handleClick(e, annotation),
1602
+ style: {
1603
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1604
+ },
1605
+ ...annotationsProps,
1606
+ children: (obj) => /* @__PURE__ */ jsx(
1607
+ Square,
1608
+ {
1609
+ ...obj,
1610
+ isSelected,
1611
+ scale,
1612
+ onClick: (e) => handleClick(e, annotation)
1613
+ }
1614
+ )
1280
1615
  },
1281
- ...annotationsProps,
1282
- children: (obj) => /* @__PURE__ */ jsx(Strikeout, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1283
- },
1284
- annotation.object.id
1285
- );
1286
- }
1287
- if (isSquiggly(annotation)) {
1288
- return /* @__PURE__ */ jsx(
1289
- AnnotationContainer,
1290
- {
1291
- trackedAnnotation: annotation,
1292
- isSelected,
1293
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1294
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1295
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1296
- selectionMenu,
1297
- onSelect: (e) => handleClick(e, annotation),
1298
- zIndex: 0,
1299
- style: {
1300
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1616
+ annotation.object.id
1617
+ );
1618
+ }
1619
+ if (isCircle(annotation)) {
1620
+ return /* @__PURE__ */ jsx(
1621
+ AnnotationContainer,
1622
+ {
1623
+ trackedAnnotation: annotation,
1624
+ isSelected,
1625
+ isMultiSelected,
1626
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1627
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1628
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1629
+ selectionMenu,
1630
+ onSelect: (e) => handleClick(e, annotation),
1631
+ style: {
1632
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1633
+ },
1634
+ ...annotationsProps,
1635
+ children: (obj) => /* @__PURE__ */ jsx(
1636
+ Circle,
1637
+ {
1638
+ ...obj,
1639
+ isSelected,
1640
+ scale,
1641
+ onClick: (e) => handleClick(e, annotation)
1642
+ }
1643
+ )
1301
1644
  },
1302
- ...annotationsProps,
1303
- children: (obj) => /* @__PURE__ */ jsx(Squiggly, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1304
- },
1305
- annotation.object.id
1306
- );
1307
- }
1308
- if (isHighlight(annotation)) {
1309
- return /* @__PURE__ */ jsx(
1310
- AnnotationContainer,
1311
- {
1312
- trackedAnnotation: annotation,
1313
- isSelected,
1314
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1315
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1316
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1317
- selectionMenu,
1318
- onSelect: (e) => handleClick(e, annotation),
1319
- zIndex: 0,
1320
- style: {
1321
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Multiply)
1645
+ annotation.object.id
1646
+ );
1647
+ }
1648
+ if (isUnderline(annotation)) {
1649
+ return /* @__PURE__ */ jsx(
1650
+ AnnotationContainer,
1651
+ {
1652
+ trackedAnnotation: annotation,
1653
+ isSelected,
1654
+ isMultiSelected,
1655
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1656
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1657
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1658
+ selectionMenu,
1659
+ onSelect: (e) => handleClick(e, annotation),
1660
+ zIndex: 0,
1661
+ style: {
1662
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1663
+ },
1664
+ ...annotationsProps,
1665
+ children: (obj) => /* @__PURE__ */ jsx(Underline, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1322
1666
  },
1323
- ...annotationsProps,
1324
- children: (obj) => /* @__PURE__ */ jsx(Highlight, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1325
- },
1326
- annotation.object.id
1327
- );
1328
- }
1329
- if (isLine(annotation)) {
1330
- return /* @__PURE__ */ jsx(
1331
- AnnotationContainer,
1332
- {
1333
- trackedAnnotation: annotation,
1334
- isSelected,
1335
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1336
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1337
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1338
- selectionMenu,
1339
- onSelect: (e) => handleClick(e, annotation),
1340
- vertexConfig: {
1341
- extractVertices: (annotation2) => [
1342
- annotation2.linePoints.start,
1343
- annotation2.linePoints.end
1344
- ],
1345
- transformAnnotation: (annotation2, vertices) => {
1346
- return {
1347
- ...annotation2,
1348
- linePoints: {
1349
- start: vertices[0],
1350
- end: vertices[1]
1351
- }
1352
- };
1353
- }
1667
+ annotation.object.id
1668
+ );
1669
+ }
1670
+ if (isStrikeout(annotation)) {
1671
+ return /* @__PURE__ */ jsx(
1672
+ AnnotationContainer,
1673
+ {
1674
+ trackedAnnotation: annotation,
1675
+ isSelected,
1676
+ isMultiSelected,
1677
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1678
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1679
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1680
+ selectionMenu,
1681
+ onSelect: (e) => handleClick(e, annotation),
1682
+ zIndex: 0,
1683
+ style: {
1684
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1685
+ },
1686
+ ...annotationsProps,
1687
+ children: (obj) => /* @__PURE__ */ jsx(Strikeout, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1354
1688
  },
1355
- style: {
1356
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1689
+ annotation.object.id
1690
+ );
1691
+ }
1692
+ if (isSquiggly(annotation)) {
1693
+ return /* @__PURE__ */ jsx(
1694
+ AnnotationContainer,
1695
+ {
1696
+ trackedAnnotation: annotation,
1697
+ isSelected,
1698
+ isMultiSelected,
1699
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1700
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1701
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1702
+ selectionMenu,
1703
+ onSelect: (e) => handleClick(e, annotation),
1704
+ zIndex: 0,
1705
+ style: {
1706
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1707
+ },
1708
+ ...annotationsProps,
1709
+ children: (obj) => /* @__PURE__ */ jsx(Squiggly, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1357
1710
  },
1358
- ...annotationsProps,
1359
- children: (obj) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(
1360
- Line,
1361
- {
1362
- ...obj,
1363
- isSelected,
1364
- scale,
1365
- onClick: (e) => handleClick(e, annotation)
1366
- }
1367
- ) })
1368
- },
1369
- annotation.object.id
1370
- );
1371
- }
1372
- if (isPolyline(annotation)) {
1373
- return /* @__PURE__ */ jsx(
1374
- AnnotationContainer,
1375
- {
1376
- trackedAnnotation: annotation,
1377
- isSelected,
1378
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1379
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1380
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1381
- selectionMenu,
1382
- onSelect: (e) => handleClick(e, annotation),
1383
- vertexConfig: {
1384
- extractVertices: (annotation2) => annotation2.vertices,
1385
- transformAnnotation: (annotation2, vertices) => {
1386
- return {
1387
- ...annotation2,
1388
- vertices
1389
- };
1390
- }
1711
+ annotation.object.id
1712
+ );
1713
+ }
1714
+ if (isHighlight(annotation)) {
1715
+ return /* @__PURE__ */ jsx(
1716
+ AnnotationContainer,
1717
+ {
1718
+ trackedAnnotation: annotation,
1719
+ isSelected,
1720
+ isMultiSelected,
1721
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1722
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1723
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1724
+ selectionMenu,
1725
+ onSelect: (e) => handleClick(e, annotation),
1726
+ zIndex: 0,
1727
+ style: {
1728
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Multiply)
1729
+ },
1730
+ ...annotationsProps,
1731
+ children: (obj) => /* @__PURE__ */ jsx(Highlight, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1391
1732
  },
1392
- style: {
1393
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1733
+ annotation.object.id
1734
+ );
1735
+ }
1736
+ if (isLine(annotation)) {
1737
+ return /* @__PURE__ */ jsx(
1738
+ AnnotationContainer,
1739
+ {
1740
+ trackedAnnotation: annotation,
1741
+ isSelected,
1742
+ isMultiSelected,
1743
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1744
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1745
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1746
+ selectionMenu,
1747
+ onSelect: (e) => handleClick(e, annotation),
1748
+ vertexConfig: {
1749
+ extractVertices: (annotation2) => [
1750
+ annotation2.linePoints.start,
1751
+ annotation2.linePoints.end
1752
+ ],
1753
+ transformAnnotation: (annotation2, vertices) => {
1754
+ return {
1755
+ ...annotation2,
1756
+ linePoints: {
1757
+ start: vertices[0],
1758
+ end: vertices[1]
1759
+ }
1760
+ };
1761
+ }
1762
+ },
1763
+ style: {
1764
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1765
+ },
1766
+ ...annotationsProps,
1767
+ children: (obj) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(
1768
+ Line,
1769
+ {
1770
+ ...obj,
1771
+ isSelected,
1772
+ scale,
1773
+ onClick: (e) => handleClick(e, annotation)
1774
+ }
1775
+ ) })
1394
1776
  },
1395
- ...annotationsProps,
1396
- children: (obj) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(
1397
- Polyline,
1398
- {
1399
- ...obj,
1400
- isSelected,
1401
- scale,
1402
- onClick: (e) => handleClick(e, annotation)
1403
- }
1404
- ) })
1405
- },
1406
- annotation.object.id
1407
- );
1408
- }
1409
- if (isPolygon(annotation)) {
1410
- return /* @__PURE__ */ jsx(
1411
- AnnotationContainer,
1412
- {
1413
- trackedAnnotation: annotation,
1414
- isSelected,
1415
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1416
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1417
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1418
- selectionMenu,
1419
- onSelect: (e) => handleClick(e, annotation),
1420
- vertexConfig: {
1421
- extractVertices: (annotation2) => annotation2.vertices,
1422
- transformAnnotation: (annotation2, vertices) => {
1423
- return {
1424
- ...annotation2,
1425
- vertices
1426
- };
1427
- }
1777
+ annotation.object.id
1778
+ );
1779
+ }
1780
+ if (isPolyline(annotation)) {
1781
+ return /* @__PURE__ */ jsx(
1782
+ AnnotationContainer,
1783
+ {
1784
+ trackedAnnotation: annotation,
1785
+ isSelected,
1786
+ isMultiSelected,
1787
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1788
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1789
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1790
+ selectionMenu,
1791
+ onSelect: (e) => handleClick(e, annotation),
1792
+ vertexConfig: {
1793
+ extractVertices: (annotation2) => annotation2.vertices,
1794
+ transformAnnotation: (annotation2, vertices) => {
1795
+ return {
1796
+ ...annotation2,
1797
+ vertices
1798
+ };
1799
+ }
1800
+ },
1801
+ style: {
1802
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1803
+ },
1804
+ ...annotationsProps,
1805
+ children: (obj) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(
1806
+ Polyline,
1807
+ {
1808
+ ...obj,
1809
+ isSelected,
1810
+ scale,
1811
+ onClick: (e) => handleClick(e, annotation)
1812
+ }
1813
+ ) })
1428
1814
  },
1429
- style: {
1430
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1815
+ annotation.object.id
1816
+ );
1817
+ }
1818
+ if (isPolygon(annotation)) {
1819
+ return /* @__PURE__ */ jsx(
1820
+ AnnotationContainer,
1821
+ {
1822
+ trackedAnnotation: annotation,
1823
+ isSelected,
1824
+ isMultiSelected,
1825
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1826
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1827
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1828
+ selectionMenu,
1829
+ onSelect: (e) => handleClick(e, annotation),
1830
+ vertexConfig: {
1831
+ extractVertices: (annotation2) => annotation2.vertices,
1832
+ transformAnnotation: (annotation2, vertices) => {
1833
+ return {
1834
+ ...annotation2,
1835
+ vertices
1836
+ };
1837
+ }
1838
+ },
1839
+ style: {
1840
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1841
+ },
1842
+ ...annotationsProps,
1843
+ children: (obj) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(
1844
+ Polygon,
1845
+ {
1846
+ ...obj,
1847
+ isSelected,
1848
+ scale,
1849
+ onClick: (e) => handleClick(e, annotation)
1850
+ }
1851
+ ) })
1431
1852
  },
1432
- ...annotationsProps,
1433
- children: (obj) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(
1434
- Polygon,
1435
- {
1436
- ...obj,
1437
- isSelected,
1438
- scale,
1439
- onClick: (e) => handleClick(e, annotation)
1440
- }
1441
- ) })
1442
- },
1443
- annotation.object.id
1444
- );
1445
- }
1446
- if (isFreeText(annotation)) {
1447
- return /* @__PURE__ */ jsx(
1448
- AnnotationContainer,
1449
- {
1450
- trackedAnnotation: annotation,
1451
- isSelected,
1452
- isDraggable: ((tool == null ? void 0 : tool.interaction.isDraggable) ?? true) && !isEditing,
1453
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1454
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1455
- selectionMenu,
1456
- onSelect: (e) => handleClick(e, annotation),
1457
- style: {
1458
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1853
+ annotation.object.id
1854
+ );
1855
+ }
1856
+ if (isFreeText(annotation)) {
1857
+ return /* @__PURE__ */ jsx(
1858
+ AnnotationContainer,
1859
+ {
1860
+ trackedAnnotation: annotation,
1861
+ isSelected,
1862
+ isMultiSelected,
1863
+ isDraggable: ((tool == null ? void 0 : tool.interaction.isDraggable) ?? true) && !isEditing,
1864
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1865
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1866
+ selectionMenu,
1867
+ onSelect: (e) => handleClick(e, annotation),
1868
+ style: {
1869
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1870
+ },
1871
+ onDoubleClick: (e) => {
1872
+ e.stopPropagation();
1873
+ setEditingId(annotation.object.id);
1874
+ },
1875
+ ...annotationsProps,
1876
+ children: (object) => /* @__PURE__ */ jsx(
1877
+ FreeText,
1878
+ {
1879
+ isSelected,
1880
+ isEditing,
1881
+ annotation: {
1882
+ ...annotation,
1883
+ object
1884
+ },
1885
+ pageIndex,
1886
+ scale,
1887
+ onClick: (e) => handleClick(e, annotation)
1888
+ }
1889
+ )
1459
1890
  },
1460
- onDoubleClick: (e) => {
1461
- e.stopPropagation();
1462
- setEditingId(annotation.object.id);
1891
+ annotation.object.id
1892
+ );
1893
+ }
1894
+ if (isStamp(annotation)) {
1895
+ return /* @__PURE__ */ jsx(
1896
+ AnnotationContainer,
1897
+ {
1898
+ trackedAnnotation: annotation,
1899
+ isSelected,
1900
+ isMultiSelected,
1901
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1902
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1903
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1904
+ selectionMenu,
1905
+ onSelect: (e) => handleClick(e, annotation),
1906
+ style: {
1907
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1908
+ },
1909
+ ...annotationsProps,
1910
+ children: (_object) => /* @__PURE__ */ jsx(
1911
+ Stamp,
1912
+ {
1913
+ isSelected,
1914
+ annotation,
1915
+ documentId,
1916
+ pageIndex,
1917
+ scale,
1918
+ onClick: (e) => handleClick(e, annotation)
1919
+ }
1920
+ )
1463
1921
  },
1464
- ...annotationsProps,
1465
- children: (object) => /* @__PURE__ */ jsx(
1466
- FreeText,
1467
- {
1468
- isSelected,
1469
- isEditing,
1470
- annotation: {
1471
- ...annotation,
1472
- object
1473
- },
1474
- pageIndex,
1475
- scale,
1476
- onClick: (e) => handleClick(e, annotation)
1477
- }
1478
- )
1479
- },
1480
- annotation.object.id
1481
- );
1482
- }
1483
- if (isStamp(annotation)) {
1484
- return /* @__PURE__ */ jsx(
1485
- AnnotationContainer,
1486
- {
1487
- trackedAnnotation: annotation,
1488
- isSelected,
1489
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1490
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1491
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1492
- selectionMenu,
1493
- onSelect: (e) => handleClick(e, annotation),
1494
- style: {
1495
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1922
+ annotation.object.id
1923
+ );
1924
+ }
1925
+ if (isLink(annotation)) {
1926
+ const hasIRT = !!annotation.object.inReplyToId;
1927
+ return /* @__PURE__ */ jsx(
1928
+ AnnotationContainer,
1929
+ {
1930
+ trackedAnnotation: annotation,
1931
+ isSelected,
1932
+ isMultiSelected,
1933
+ isDraggable: false,
1934
+ isResizable: false,
1935
+ lockAspectRatio: false,
1936
+ selectionMenu: hasIRT ? void 0 : selectionMenu,
1937
+ onSelect: (e) => handleLinkClick(e, annotation),
1938
+ ...annotationsProps,
1939
+ children: (obj) => /* @__PURE__ */ jsx(
1940
+ Link,
1941
+ {
1942
+ ...obj,
1943
+ isSelected,
1944
+ scale,
1945
+ onClick: (e) => handleLinkClick(e, annotation),
1946
+ hasIRT
1947
+ }
1948
+ )
1496
1949
  },
1497
- ...annotationsProps,
1498
- children: (_object) => /* @__PURE__ */ jsx(
1499
- Stamp,
1500
- {
1501
- isSelected,
1502
- annotation,
1503
- documentId,
1504
- pageIndex,
1505
- scale,
1506
- onClick: (e) => handleClick(e, annotation)
1507
- }
1508
- )
1509
- },
1510
- annotation.object.id
1511
- );
1512
- }
1513
- return null;
1514
- }) });
1950
+ annotation.object.id
1951
+ );
1952
+ }
1953
+ return null;
1954
+ }),
1955
+ allSelectedOnSamePage && selectedAnnotationsOnPage.length >= 2 && /* @__PURE__ */ jsx(
1956
+ GroupSelectionBox,
1957
+ {
1958
+ documentId,
1959
+ pageIndex,
1960
+ scale,
1961
+ rotation: annotationsProps.rotation,
1962
+ pageWidth,
1963
+ pageHeight,
1964
+ selectedAnnotations: selectedAnnotationsOnPage,
1965
+ isDraggable: areAllSelectedDraggable,
1966
+ isResizable: areAllSelectedResizable,
1967
+ resizeUI: annotationsProps.resizeUI,
1968
+ selectionOutlineColor: annotationsProps.selectionOutlineColor,
1969
+ groupSelectionMenu: annotationsProps.groupSelectionMenu
1970
+ }
1971
+ )
1972
+ ] });
1515
1973
  }
1516
1974
  function TextMarkup({ documentId, pageIndex, scale }) {
1517
1975
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
@@ -1548,7 +2006,7 @@ function TextMarkup({ documentId, pageIndex, scale }) {
1548
2006
  children: /* @__PURE__ */ jsx(
1549
2007
  Underline,
1550
2008
  {
1551
- color: (_b = activeTool.defaults) == null ? void 0 : _b.color,
2009
+ strokeColor: (_b = activeTool.defaults) == null ? void 0 : _b.strokeColor,
1552
2010
  opacity: (_c = activeTool.defaults) == null ? void 0 : _c.opacity,
1553
2011
  segmentRects: rects,
1554
2012
  scale
@@ -1569,7 +2027,7 @@ function TextMarkup({ documentId, pageIndex, scale }) {
1569
2027
  children: /* @__PURE__ */ jsx(
1570
2028
  Highlight,
1571
2029
  {
1572
- color: (_e = activeTool.defaults) == null ? void 0 : _e.color,
2030
+ strokeColor: (_e = activeTool.defaults) == null ? void 0 : _e.strokeColor,
1573
2031
  opacity: (_f = activeTool.defaults) == null ? void 0 : _f.opacity,
1574
2032
  segmentRects: rects,
1575
2033
  scale
@@ -1590,7 +2048,7 @@ function TextMarkup({ documentId, pageIndex, scale }) {
1590
2048
  children: /* @__PURE__ */ jsx(
1591
2049
  Strikeout,
1592
2050
  {
1593
- color: (_h = activeTool.defaults) == null ? void 0 : _h.color,
2051
+ strokeColor: (_h = activeTool.defaults) == null ? void 0 : _h.strokeColor,
1594
2052
  opacity: (_i = activeTool.defaults) == null ? void 0 : _i.opacity,
1595
2053
  segmentRects: rects,
1596
2054
  scale
@@ -1611,7 +2069,7 @@ function TextMarkup({ documentId, pageIndex, scale }) {
1611
2069
  children: /* @__PURE__ */ jsx(
1612
2070
  Squiggly,
1613
2071
  {
1614
- color: (_k = activeTool.defaults) == null ? void 0 : _k.color,
2072
+ strokeColor: (_k = activeTool.defaults) == null ? void 0 : _k.strokeColor,
1615
2073
  opacity: (_l = activeTool.defaults) == null ? void 0 : _l.opacity,
1616
2074
  segmentRects: rects,
1617
2075
  scale
@@ -1744,6 +2202,7 @@ function AnnotationLayer({
1744
2202
  scale: overrideScale,
1745
2203
  rotation: overrideRotation,
1746
2204
  selectionMenu,
2205
+ groupSelectionMenu,
1747
2206
  resizeUI,
1748
2207
  vertexUI,
1749
2208
  selectionOutlineColor,
@@ -1776,6 +2235,7 @@ function AnnotationLayer({
1776
2235
  {
1777
2236
  documentId,
1778
2237
  selectionMenu,
2238
+ groupSelectionMenu,
1779
2239
  pageIndex,
1780
2240
  scale: actualScale,
1781
2241
  rotation: actualRotation,
@@ -1795,6 +2255,7 @@ function AnnotationLayer({
1795
2255
  }
1796
2256
  export {
1797
2257
  AnnotationLayer,
2258
+ GroupSelectionBox,
1798
2259
  useAnnotation,
1799
2260
  useAnnotationCapability,
1800
2261
  useAnnotationPlugin