@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,11 @@
1
1
  import * as $ from "svelte/internal/client";
2
- import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationByPageIndex, isInk, isSquare, isCircle, isUnderline, isStrikeout, isSquiggly, isHighlight, isLine, isPolyline, isPolygon, isFreeText, isStamp } from "@embedpdf/plugin-annotation";
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
- import { useCapability, usePlugin, useDocumentState } from "@embedpdf/core/svelte";
4
+ import { useCapability, usePlugin, useDocumentPermissions, useDocumentState } from "@embedpdf/core/svelte";
5
5
  import "svelte/internal/disclose-version";
6
6
  import { useInteractionHandles, deepToRaw, doublePress, CounterRotate } from "@embedpdf/utils/svelte";
7
- import { PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCss, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
7
+ import { untrack } from "svelte";
8
+ import { PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCss, ignore, PdfErrorCode, boundingRectOrEmpty, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
8
9
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/svelte";
9
10
  import { useSelectionCapability } from "@embedpdf/plugin-selection/svelte";
10
11
  const useAnnotationCapability = () => useCapability(AnnotationPlugin.id);
@@ -38,10 +39,10 @@ const useAnnotation = (getDocumentId) => {
38
39
  };
39
40
  var root_6$1 = $.from_html(`<div></div>`);
40
41
  var root_10 = $.from_html(`<div></div>`);
41
- var root$a = $.from_html(`<div data-no-interaction=""><div><!> <!> <!></div> <!></div>`);
42
+ var root$c = $.from_html(`<div data-no-interaction=""><div><!> <!> <!></div> <!></div>`);
42
43
  function AnnotationContainer($$anchor, $$props) {
43
44
  $.push($$props, true);
44
- let lockAspectRatio = $.prop($$props, "lockAspectRatio", 3, false), propsClass = $.prop($$props, "class", 3, ""), outlineOffset = $.prop($$props, "outlineOffset", 3, 1), zIndex = $.prop($$props, "zIndex", 3, 20), selectionOutlineColor = $.prop($$props, "selectionOutlineColor", 3, "#007ACC"), restProps = $.rest_props($$props, [
45
+ let isMultiSelected = $.prop($$props, "isMultiSelected", 3, false), lockAspectRatio = $.prop($$props, "lockAspectRatio", 3, false), propsClass = $.prop($$props, "class", 3, ""), outlineOffset = $.prop($$props, "outlineOffset", 3, 1), zIndex = $.prop($$props, "zIndex", 3, 20), selectionOutlineColor = $.prop($$props, "selectionOutlineColor", 3, "#007ACC"), restProps = $.rest_props($$props, [
45
46
  "$$slots",
46
47
  "$$events",
47
48
  "$$legacy",
@@ -54,6 +55,7 @@ function AnnotationContainer($$anchor, $$props) {
54
55
  "trackedAnnotation",
55
56
  "children",
56
57
  "isSelected",
58
+ "isMultiSelected",
57
59
  "isDraggable",
58
60
  "isResizable",
59
61
  "lockAspectRatio",
@@ -73,7 +75,13 @@ function AnnotationContainer($$anchor, $$props) {
73
75
  ]);
74
76
  let preview = $.state($.proxy($$props.trackedAnnotation.object));
75
77
  let annotationCapability = useAnnotationCapability();
78
+ const annotationPlugin = useAnnotationPlugin();
79
+ const permissions = useDocumentPermissions(() => $$props.documentId);
76
80
  let gestureBaseRef = $.state(null);
81
+ let gestureBaseRectRef = $.state(null);
82
+ const effectiveIsDraggable = $.derived(() => permissions.canModifyAnnotations && $$props.isDraggable && !isMultiSelected());
83
+ const effectiveIsResizable = $.derived(() => permissions.canModifyAnnotations && $$props.isResizable && !isMultiSelected());
84
+ const guardedOnDoubleClick = $.derived(() => permissions.canModifyAnnotations && $$props.onDoubleClick ? $$props.onDoubleClick : void 0);
77
85
  const annotationProvides = $.derived(() => annotationCapability.provides ? annotationCapability.provides.forDocument($$props.documentId) : null);
78
86
  let currentObject = $.derived(() => $.get(preview) ? { ...$$props.trackedAnnotation.object, ...$.get(preview) } : $$props.trackedAnnotation.object);
79
87
  const HANDLE_COLOR = $.derived(() => {
@@ -92,11 +100,32 @@ function AnnotationContainer($$anchor, $$props) {
92
100
  var _a;
93
101
  return ((_a = $$props.vertexUI) == null ? void 0 : _a.size) ?? 12;
94
102
  });
103
+ const showOutline = $.derived(() => $$props.isSelected && !isMultiSelected());
95
104
  $.user_effect(() => {
96
105
  if ($$props.trackedAnnotation.object) {
97
106
  $.set(preview, $$props.trackedAnnotation.object, true);
98
107
  }
99
108
  });
109
+ $.user_effect(() => {
110
+ const plugin = annotationPlugin.plugin;
111
+ if (!plugin) return;
112
+ const id = $$props.trackedAnnotation.object.id;
113
+ const handleEvent = (event) => {
114
+ var _a;
115
+ if (event.documentId !== $$props.documentId) return;
116
+ const patch = (_a = event.previewPatches) == null ? void 0 : _a[id];
117
+ if (event.type === "update" && patch) {
118
+ $.set(preview, { ...untrack(() => $.get(preview)), ...patch }, true);
119
+ } else if (event.type === "cancel") {
120
+ $.set(preview, $$props.trackedAnnotation.object, true);
121
+ }
122
+ };
123
+ const unsubs = [
124
+ plugin.onDragChange(handleEvent),
125
+ plugin.onResizeChange(handleEvent)
126
+ ];
127
+ return () => unsubs.forEach((u) => u());
128
+ });
100
129
  const interactionHandles = useInteractionHandles(() => {
101
130
  var _a;
102
131
  return {
@@ -111,28 +140,62 @@ function AnnotationContainer($$anchor, $$props) {
111
140
  maintainAspectRatio: lockAspectRatio(),
112
141
  pageRotation: $$props.rotation,
113
142
  scale: $$props.scale,
114
- enabled: $$props.isSelected,
143
+ // Disable interaction handles when multi-selected
144
+ enabled: $$props.isSelected && !isMultiSelected(),
115
145
  onUpdate: (event) => {
116
- var _a2, _b, _c, _d;
117
- if (!((_a2 = event.transformData) == null ? void 0 : _a2.type)) return;
146
+ var _a2, _b, _c;
147
+ if (!((_a2 = event.transformData) == null ? void 0 : _a2.type) || isMultiSelected()) return;
148
+ const plugin = annotationPlugin.plugin;
149
+ if (!plugin) return;
150
+ const { type, changes, metadata } = event.transformData;
151
+ const id = $$props.trackedAnnotation.object.id;
152
+ const pageSize = { width: $$props.pageWidth, height: $$props.pageHeight };
118
153
  if (event.state === "start") {
119
- $.set(gestureBaseRef, $.get(currentObject), true);
154
+ $.set(gestureBaseRectRef, $$props.trackedAnnotation.object.rect, true);
155
+ $.set(
156
+ gestureBaseRef,
157
+ $$props.trackedAnnotation.object,
158
+ // For vertex edit
159
+ true
160
+ );
161
+ if (type === "move") {
162
+ plugin.startDrag($$props.documentId, { annotationIds: [id], pageSize });
163
+ } else if (type === "resize") {
164
+ plugin.startResize($$props.documentId, {
165
+ annotationIds: [id],
166
+ pageSize,
167
+ resizeHandle: (metadata == null ? void 0 : metadata.handle) ?? "se"
168
+ });
169
+ }
120
170
  }
121
- const transformType = event.transformData.type;
122
- const base = $.get(gestureBaseRef) ?? $.get(currentObject);
123
- const changes = event.transformData.changes.vertices ? (_b = $$props.vertexConfig) == null ? void 0 : _b.transformAnnotation(base, event.transformData.changes.vertices) : { rect: event.transformData.changes.rect };
124
- const patched = (_c = annotationCapability.provides) == null ? void 0 : _c.transformAnnotation(base, {
125
- type: transformType,
126
- changes,
127
- metadata: event.transformData.metadata
128
- });
129
- if (patched) {
130
- $.set(preview, { ...$.get(preview), ...patched }, true);
171
+ if (changes.rect && $.get(gestureBaseRectRef)) {
172
+ if (type === "move") {
173
+ const delta = {
174
+ x: changes.rect.origin.x - $.get(gestureBaseRectRef).origin.x,
175
+ y: changes.rect.origin.y - $.get(gestureBaseRectRef).origin.y
176
+ };
177
+ plugin.updateDrag($$props.documentId, delta);
178
+ } else if (type === "resize") {
179
+ plugin.updateResize($$props.documentId, changes.rect);
180
+ }
181
+ }
182
+ if (type === "vertex-edit" && changes.vertices && $$props.vertexConfig) {
183
+ const base = $.get(gestureBaseRef) ?? $$props.trackedAnnotation.object;
184
+ const vertexChanges = $$props.vertexConfig.transformAnnotation(base, changes.vertices);
185
+ const patched = (_b = annotationCapability.provides) == null ? void 0 : _b.transformAnnotation(base, { type, changes: vertexChanges, metadata });
186
+ if (patched) {
187
+ $.set(preview, { ...$.get(preview), ...patched }, true);
188
+ if (event.state === "end") {
189
+ const sanitized = deepToRaw(patched);
190
+ (_c = $.get(annotationProvides)) == null ? void 0 : _c.updateAnnotation($$props.pageIndex, id, sanitized);
191
+ }
192
+ }
131
193
  }
132
- if (event.state === "end" && patched) {
194
+ if (event.state === "end") {
195
+ $.set(gestureBaseRectRef, null);
133
196
  $.set(gestureBaseRef, null);
134
- const sanitized = deepToRaw(patched);
135
- (_d = $.get(annotationProvides)) == null ? void 0 : _d.updateAnnotation($$props.pageIndex, $$props.trackedAnnotation.object.id, sanitized);
197
+ if (type === "move") plugin.commitDrag($$props.documentId);
198
+ else if (type === "resize") plugin.commitResize($$props.documentId);
136
199
  }
137
200
  }
138
201
  },
@@ -149,7 +212,7 @@ function AnnotationContainer($$anchor, $$props) {
149
212
  });
150
213
  const resizeHandles = $.derived(() => interactionHandles.resize);
151
214
  const vertexHandles = $.derived(() => interactionHandles.vertices);
152
- const shouldShowMenu = $.derived(() => $$props.isSelected && (!!$$props.selectionMenu || !!$$props.selectionMenuSnippet));
215
+ const shouldShowMenu = $.derived(() => $$props.isSelected && !isMultiSelected() && (!!$$props.selectionMenu || !!$$props.selectionMenuSnippet));
153
216
  function buildContext() {
154
217
  return {
155
218
  type: "annotation",
@@ -167,10 +230,10 @@ function AnnotationContainer($$anchor, $$props) {
167
230
  menuWrapperProps
168
231
  };
169
232
  }
170
- var div = root$a();
233
+ var div = root$c();
171
234
  var div_1 = $.child(div);
172
235
  $.attribute_effect(div_1, () => ({
173
- ...$$props.isDraggable && $$props.isSelected ? interactionHandles.dragProps : {},
236
+ ...$.get(effectiveIsDraggable) && $$props.isSelected ? interactionHandles.dragProps : {},
174
237
  style: $$props.style || "",
175
238
  class: propsClass(),
176
239
  ...restProps,
@@ -180,11 +243,11 @@ function AnnotationContainer($$anchor, $$props) {
180
243
  top: `${$.get(currentObject).rect.origin.y * $$props.scale}px`,
181
244
  width: `${$.get(currentObject).rect.size.width * $$props.scale}px`,
182
245
  height: `${$.get(currentObject).rect.size.height * $$props.scale}px`,
183
- outline: $$props.isSelected ? `1px solid ${selectionOutlineColor()}` : "none",
184
- "outline-offset": $$props.isSelected ? `${outlineOffset()}px` : "0px",
185
- "pointer-events": $$props.isSelected ? "auto" : "none",
246
+ outline: $.get(showOutline) ? `1px solid ${selectionOutlineColor()}` : "none",
247
+ "outline-offset": $.get(showOutline) ? `${outlineOffset()}px` : "0px",
248
+ "pointer-events": $$props.isSelected && !isMultiSelected() ? "auto" : "none",
186
249
  "touch-action": "none",
187
- cursor: $$props.isSelected && $$props.isDraggable ? "move" : "default",
250
+ cursor: $$props.isSelected && $.get(effectiveIsDraggable) ? "move" : "default",
188
251
  "z-index": zIndex()
189
252
  }
190
253
  }));
@@ -260,7 +323,7 @@ function AnnotationContainer($$anchor, $$props) {
260
323
  $.append($$anchor2, fragment_2);
261
324
  };
262
325
  $.if(node_3, ($$render) => {
263
- if ($$props.isSelected && $$props.isResizable) $$render(consequent_2);
326
+ if ($$props.isSelected && $.get(effectiveIsResizable)) $$render(consequent_2);
264
327
  });
265
328
  }
266
329
  var node_7 = $.sibling(node_3, 2);
@@ -306,14 +369,14 @@ function AnnotationContainer($$anchor, $$props) {
306
369
  $.append($$anchor2, fragment_5);
307
370
  };
308
371
  $.if(node_7, ($$render) => {
309
- if ($$props.isSelected) $$render(consequent_4);
372
+ if ($$props.isSelected && permissions.canModifyAnnotations && !isMultiSelected()) $$render(consequent_4);
310
373
  });
311
374
  }
312
375
  $.reset(div_1);
313
376
  $.action(div_1, ($$node, $$action_arg) => {
314
377
  var _a;
315
378
  return (_a = doublePress) == null ? void 0 : _a($$node, $$action_arg);
316
- }, () => ({ onDouble: $$props.onDoubleClick }));
379
+ }, () => ({ onDouble: $.get(guardedOnDoubleClick) }));
317
380
  var node_11 = $.sibling(div_1, 2);
318
381
  {
319
382
  var consequent_8 = ($$anchor2) => {
@@ -401,14 +464,15 @@ function AnnotationContainer($$anchor, $$props) {
401
464
  $.append($$anchor, div);
402
465
  $.pop();
403
466
  }
404
- var root_1$9 = $.from_html(`<div></div>`);
467
+ var root_1$b = $.from_html(`<div></div>`);
405
468
  function Highlight($$anchor, $$props) {
406
469
  $.push($$props, true);
407
- let color = $.prop($$props, "color", 3, "#FFFF00"), opacity = $.prop($$props, "opacity", 3, 0.5);
470
+ let opacity = $.prop($$props, "opacity", 3, 0.5);
471
+ const resolvedColor = $.derived(() => $$props.strokeColor ?? "#FFFF00");
408
472
  var fragment = $.comment();
409
473
  var node = $.first_child(fragment);
410
474
  $.each(node, 17, () => $$props.segmentRects, $.index, ($$anchor2, b) => {
411
- var div = root_1$9();
475
+ var div = root_1$b();
412
476
  $.attribute_effect(
413
477
  div,
414
478
  ($0) => ({
@@ -423,7 +487,7 @@ function Highlight($$anchor, $$props) {
423
487
  top: `${($$props.rect ? $.get(b).origin.y - $$props.rect.origin.y : $.get(b).origin.y) * $$props.scale}px`,
424
488
  width: `${$.get(b).size.width * $$props.scale}px`,
425
489
  height: `${$.get(b).size.height * $$props.scale}px`,
426
- background: color(),
490
+ background: $.get(resolvedColor),
427
491
  opacity: opacity(),
428
492
  "pointer-events": $$props.onClick ? "auto" : "none",
429
493
  cursor: $$props.onClick ? "pointer" : "default",
@@ -439,15 +503,16 @@ function Highlight($$anchor, $$props) {
439
503
  $.append($$anchor, fragment);
440
504
  $.pop();
441
505
  }
442
- var root_1$8 = $.from_html(`<div><div></div></div>`);
506
+ var root_1$a = $.from_html(`<div><div></div></div>`);
443
507
  function Underline($$anchor, $$props) {
444
508
  $.push($$props, true);
445
- let color = $.prop($$props, "color", 3, "#FFFF00"), opacity = $.prop($$props, "opacity", 3, 0.5);
509
+ let opacity = $.prop($$props, "opacity", 3, 0.5);
510
+ const resolvedColor = $.derived(() => $$props.strokeColor ?? "#FFFF00");
446
511
  const thickness = $.derived(() => 2 * $$props.scale);
447
512
  var fragment = $.comment();
448
513
  var node = $.first_child(fragment);
449
514
  $.each(node, 17, () => $$props.segmentRects, $.index, ($$anchor2, r) => {
450
- var div = root_1$8();
515
+ var div = root_1$a();
451
516
  $.attribute_effect(
452
517
  div,
453
518
  ($0) => ({
@@ -481,7 +546,7 @@ function Underline($$anchor, $$props) {
481
546
  bottom: "0",
482
547
  width: "100%",
483
548
  height: `${$.get(thickness) ?? ""}px`,
484
- background: color(),
549
+ background: $.get(resolvedColor),
485
550
  opacity: opacity(),
486
551
  "pointer-events": "none"
487
552
  }));
@@ -490,15 +555,16 @@ function Underline($$anchor, $$props) {
490
555
  $.append($$anchor, fragment);
491
556
  $.pop();
492
557
  }
493
- var root_1$7 = $.from_html(`<div><div></div></div>`);
558
+ var root_1$9 = $.from_html(`<div><div></div></div>`);
494
559
  function Strikeout($$anchor, $$props) {
495
560
  $.push($$props, true);
496
- let color = $.prop($$props, "color", 3, "#FFFF00"), opacity = $.prop($$props, "opacity", 3, 0.5);
561
+ let opacity = $.prop($$props, "opacity", 3, 0.5);
562
+ const resolvedColor = $.derived(() => $$props.strokeColor ?? "#FFFF00");
497
563
  const thickness = $.derived(() => 2 * $$props.scale);
498
564
  var fragment = $.comment();
499
565
  var node = $.first_child(fragment);
500
566
  $.each(node, 17, () => $$props.segmentRects, $.index, ($$anchor2, r) => {
501
- var div = root_1$7();
567
+ var div = root_1$9();
502
568
  $.attribute_effect(
503
569
  div,
504
570
  ($0) => ({
@@ -532,7 +598,7 @@ function Strikeout($$anchor, $$props) {
532
598
  top: "50%",
533
599
  width: "100%",
534
600
  height: `${$.get(thickness) ?? ""}px`,
535
- background: color(),
601
+ background: $.get(resolvedColor),
536
602
  opacity: opacity(),
537
603
  transform: "translateY(-50%)",
538
604
  "pointer-events": "none"
@@ -542,21 +608,22 @@ function Strikeout($$anchor, $$props) {
542
608
  $.append($$anchor, fragment);
543
609
  $.pop();
544
610
  }
545
- var root_1$6 = $.from_html(`<div><div></div></div>`);
611
+ var root_1$8 = $.from_html(`<div><div></div></div>`);
546
612
  function Squiggly($$anchor, $$props) {
547
613
  $.push($$props, true);
548
- let color = $.prop($$props, "color", 3, "#FFFF00"), opacity = $.prop($$props, "opacity", 3, 0.5);
614
+ let opacity = $.prop($$props, "opacity", 3, 0.5);
615
+ const resolvedColor = $.derived(() => $$props.strokeColor ?? "#FFFF00");
549
616
  const amplitude = $.derived(() => 2 * $$props.scale);
550
617
  const period = $.derived(() => 6 * $$props.scale);
551
618
  const svg = $.derived(() => `<svg xmlns="http://www.w3.org/2000/svg" width="${$.get(period)}" height="${$.get(amplitude) * 2}" viewBox="0 0 ${$.get(period)} ${$.get(amplitude) * 2}">
552
619
  <path d="M0 ${$.get(amplitude)} Q ${$.get(period) / 4} 0 ${$.get(period) / 2} ${$.get(amplitude)} T ${$.get(period)} ${$.get(amplitude)}"
553
- fill="none" stroke="${color()}" stroke-width="${$.get(amplitude)}" stroke-linecap="round"/>
620
+ fill="none" stroke="${$.get(resolvedColor)}" stroke-width="${$.get(amplitude)}" stroke-linecap="round"/>
554
621
  </svg>`);
555
622
  const svgDataUri = $.derived(() => `url("data:image/svg+xml;utf8,${encodeURIComponent($.get(svg))}")`);
556
623
  var fragment = $.comment();
557
624
  var node = $.first_child(fragment);
558
625
  $.each(node, 17, () => $$props.segmentRects, $.index, ($$anchor2, r) => {
559
- var div = root_1$6();
626
+ var div = root_1$8();
560
627
  $.attribute_effect(
561
628
  div,
562
629
  ($0) => ({
@@ -601,11 +668,12 @@ function Squiggly($$anchor, $$props) {
601
668
  $.append($$anchor, fragment);
602
669
  $.pop();
603
670
  }
604
- var root_1$5 = $.from_svg(`<path fill="none"></path>`);
605
- var root$9 = $.from_svg(`<svg></svg>`);
671
+ var root_1$7 = $.from_svg(`<path fill="none"></path>`);
672
+ var root$b = $.from_svg(`<svg></svg>`);
606
673
  function Ink($$anchor, $$props) {
607
674
  $.push($$props, true);
608
- let color = $.prop($$props, "color", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1);
675
+ let opacity = $.prop($$props, "opacity", 3, 1);
676
+ const resolvedColor = $.derived(() => $$props.strokeColor ?? "#000000");
609
677
  const paths = $.derived(() => $$props.inkList.map(({ points }) => {
610
678
  let d = "";
611
679
  for (let i = 0; i < points.length; i++) {
@@ -618,10 +686,10 @@ function Ink($$anchor, $$props) {
618
686
  }));
619
687
  const width = $.derived(() => $$props.rect.size.width * $$props.scale);
620
688
  const height = $.derived(() => $$props.rect.size.height * $$props.scale);
621
- var svg = root$9();
689
+ var svg = root$b();
622
690
  let styles;
623
691
  $.each(svg, 21, () => $.get(paths), $.index, ($$anchor2, d) => {
624
- var path = root_1$5();
692
+ var path = root_1$7();
625
693
  path.__pointerdown = function(...$$args) {
626
694
  var _a;
627
695
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -637,7 +705,7 @@ function Ink($$anchor, $$props) {
637
705
  styles_1 = $.set_style(path, "", styles_1, {
638
706
  cursor: $$props.isSelected ? "move" : "pointer",
639
707
  "pointer-events": $$props.isSelected ? "none" : "visibleStroke",
640
- stroke: color(),
708
+ stroke: $.get(resolvedColor),
641
709
  "stroke-width": $$props.strokeWidth,
642
710
  "stroke-linecap": "round",
643
711
  "stroke-linejoin": "round"
@@ -656,7 +724,7 @@ function Ink($$anchor, $$props) {
656
724
  $.pop();
657
725
  }
658
726
  $.delegate(["pointerdown", "touchstart"]);
659
- var root$8 = $.from_svg(`<svg><rect></rect></svg>`);
727
+ var root$a = $.from_svg(`<svg><rect></rect></svg>`);
660
728
  function Square($$anchor, $$props) {
661
729
  $.push($$props, true);
662
730
  let color = $.prop($$props, "color", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1), strokeStyle = $.prop($$props, "strokeStyle", 19, () => PdfAnnotationBorderStyle.SOLID);
@@ -678,7 +746,7 @@ function Square($$anchor, $$props) {
678
746
  var _a;
679
747
  return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
680
748
  });
681
- var svg = root$8();
749
+ var svg = root$a();
682
750
  let styles;
683
751
  var rect_1 = $.child(svg);
684
752
  rect_1.__pointerdown = function(...$$args) {
@@ -717,7 +785,7 @@ function Square($$anchor, $$props) {
717
785
  $.pop();
718
786
  }
719
787
  $.delegate(["pointerdown", "touchstart"]);
720
- var root$7 = $.from_svg(`<svg><ellipse></ellipse></svg>`);
788
+ var root$9 = $.from_svg(`<svg><ellipse></ellipse></svg>`);
721
789
  function Circle($$anchor, $$props) {
722
790
  $.push($$props, true);
723
791
  let color = $.prop($$props, "color", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1), strokeStyle = $.prop($$props, "strokeStyle", 19, () => PdfAnnotationBorderStyle.SOLID);
@@ -739,7 +807,7 @@ function Circle($$anchor, $$props) {
739
807
  let svgWidth = $.derived(() => $.get(width) * $$props.scale);
740
808
  let svgHeight = $.derived(() => $.get(height) * $$props.scale);
741
809
  let peValue = $.derived(() => $$props.isSelected ? "none" : color() === "transparent" ? "visibleStroke" : "visible");
742
- var svg = root$7();
810
+ var svg = root$9();
743
811
  let styles;
744
812
  var ellipse = $.child(svg);
745
813
  ellipse.__pointerdown = (e) => {
@@ -787,9 +855,9 @@ function Circle($$anchor, $$props) {
787
855
  $.pop();
788
856
  }
789
857
  $.delegate(["pointerdown", "touchstart"]);
790
- var root_1$4 = $.from_svg(`<path></path>`);
791
- var root_2$3 = $.from_svg(`<path></path>`);
792
- var root$6 = $.from_svg(`<svg><line></line><!><!></svg>`);
858
+ var root_1$6 = $.from_svg(`<path></path>`);
859
+ var root_2$4 = $.from_svg(`<path></path>`);
860
+ var root$8 = $.from_svg(`<svg><line></line><!><!></svg>`);
793
861
  function Line($$anchor, $$props) {
794
862
  $.push($$props, true);
795
863
  let color = $.prop($$props, "color", 3, "transparent"), opacity = $.prop($$props, "opacity", 3, 1), strokeColor = $.prop($$props, "strokeColor", 3, "#000000"), strokeStyle = $.prop($$props, "strokeStyle", 19, () => PdfAnnotationBorderStyle.SOLID);
@@ -811,7 +879,7 @@ function Line($$anchor, $$props) {
811
879
  var _a;
812
880
  return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
813
881
  });
814
- var svg = root$6();
882
+ var svg = root$8();
815
883
  let styles;
816
884
  var line = $.child(svg);
817
885
  line.__pointerdown = function(...$$args) {
@@ -826,7 +894,7 @@ function Line($$anchor, $$props) {
826
894
  var node = $.sibling(line);
827
895
  {
828
896
  var consequent = ($$anchor2) => {
829
- var path = root_1$4();
897
+ var path = root_1$6();
830
898
  path.__pointerdown = function(...$$args) {
831
899
  var _a;
832
900
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -858,7 +926,7 @@ function Line($$anchor, $$props) {
858
926
  var node_1 = $.sibling(node);
859
927
  {
860
928
  var consequent_1 = ($$anchor2) => {
861
- var path_1 = root_2$3();
929
+ var path_1 = root_2$4();
862
930
  path_1.__pointerdown = function(...$$args) {
863
931
  var _a;
864
932
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -911,9 +979,9 @@ function Line($$anchor, $$props) {
911
979
  $.pop();
912
980
  }
913
981
  $.delegate(["pointerdown", "touchstart"]);
914
- var root_1$3 = $.from_svg(`<path></path>`);
915
- var root_2$2 = $.from_svg(`<path></path>`);
916
- var root$5 = $.from_svg(`<svg><path></path><!><!></svg>`);
982
+ var root_1$5 = $.from_svg(`<path></path>`);
983
+ var root_2$3 = $.from_svg(`<path></path>`);
984
+ var root$7 = $.from_svg(`<svg><path></path><!><!></svg>`);
917
985
  function Polyline($$anchor, $$props) {
918
986
  $.push($$props, true);
919
987
  let color = $.prop($$props, "color", 3, "transparent"), strokeColor = $.prop($$props, "strokeColor", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1);
@@ -955,7 +1023,7 @@ function Polyline($$anchor, $$props) {
955
1023
  });
956
1024
  const width = $.derived(() => $$props.rect.size.width * $$props.scale);
957
1025
  const height = $.derived(() => $$props.rect.size.height * $$props.scale);
958
- var svg = root$5();
1026
+ var svg = root$7();
959
1027
  let styles;
960
1028
  var path = $.child(svg);
961
1029
  path.__pointerdown = function(...$$args) {
@@ -970,7 +1038,7 @@ function Polyline($$anchor, $$props) {
970
1038
  var node = $.sibling(path);
971
1039
  {
972
1040
  var consequent = ($$anchor2) => {
973
- var path_1 = root_1$3();
1041
+ var path_1 = root_1$5();
974
1042
  path_1.__pointerdown = function(...$$args) {
975
1043
  var _a;
976
1044
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -1001,7 +1069,7 @@ function Polyline($$anchor, $$props) {
1001
1069
  var node_1 = $.sibling(node);
1002
1070
  {
1003
1071
  var consequent_1 = ($$anchor2) => {
1004
- var path_2 = root_2$2();
1072
+ var path_2 = root_2$3();
1005
1073
  path_2.__pointerdown = function(...$$args) {
1006
1074
  var _a;
1007
1075
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -1051,9 +1119,9 @@ function Polyline($$anchor, $$props) {
1051
1119
  $.pop();
1052
1120
  }
1053
1121
  $.delegate(["pointerdown", "touchstart"]);
1054
- var root_1$2 = $.from_svg(`<path fill="none"></path>`);
1055
- var root_2$1 = $.from_svg(`<rect></rect>`);
1056
- var root$4 = $.from_svg(`<svg><path></path><!><!></svg>`);
1122
+ var root_1$4 = $.from_svg(`<path fill="none"></path>`);
1123
+ var root_2$2 = $.from_svg(`<rect></rect>`);
1124
+ var root$6 = $.from_svg(`<svg><path></path><!><!></svg>`);
1057
1125
  function Polygon($$anchor, $$props) {
1058
1126
  $.push($$props, true);
1059
1127
  let color = $.prop($$props, "color", 3, "transparent"), strokeColor = $.prop($$props, "strokeColor", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1), strokeStyle = $.prop($$props, "strokeStyle", 19, () => PdfAnnotationBorderStyle.SOLID), handleSize = $.prop($$props, "handleSize", 3, 14);
@@ -1072,7 +1140,7 @@ function Polygon($$anchor, $$props) {
1072
1140
  var _a;
1073
1141
  return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
1074
1142
  });
1075
- var svg = root$4();
1143
+ var svg = root$6();
1076
1144
  let styles;
1077
1145
  var path = $.child(svg);
1078
1146
  path.__pointerdown = function(...$$args) {
@@ -1087,7 +1155,7 @@ function Polygon($$anchor, $$props) {
1087
1155
  var node = $.sibling(path);
1088
1156
  {
1089
1157
  var consequent = ($$anchor2) => {
1090
- var path_1 = root_1$2();
1158
+ var path_1 = root_1$4();
1091
1159
  let styles_2;
1092
1160
  $.template_effect(() => {
1093
1161
  $.set_attribute(path_1, "d", `M ${$.get(localPts)[$.get(localPts).length - 1].x} ${$.get(localPts)[$.get(localPts).length - 1].y} L ${$.get(localPts)[0].x} ${$.get(localPts)[0].y}`);
@@ -1107,7 +1175,7 @@ function Polygon($$anchor, $$props) {
1107
1175
  var node_1 = $.sibling(node);
1108
1176
  {
1109
1177
  var consequent_1 = ($$anchor2) => {
1110
- var rect_1 = root_2$1();
1178
+ var rect_1 = root_2$2();
1111
1179
  $.set_attribute(rect_1, "opacity", 0.4);
1112
1180
  $.template_effect(() => {
1113
1181
  $.set_attribute(rect_1, "x", $.get(localPts)[0].x - handleSize() / $$props.scale / 2);
@@ -1147,7 +1215,7 @@ function Polygon($$anchor, $$props) {
1147
1215
  $.pop();
1148
1216
  }
1149
1217
  $.delegate(["pointerdown", "touchstart"]);
1150
- var root$3 = $.from_html(`<div><span tabindex="0"> </span></div>`);
1218
+ var root$5 = $.from_html(`<div><span tabindex="0"> </span></div>`);
1151
1219
  function FreeText($$anchor, $$props) {
1152
1220
  $.push($$props, true);
1153
1221
  const annotationCapability = useAnnotationCapability();
@@ -1188,7 +1256,7 @@ function FreeText($$anchor, $$props) {
1188
1256
  const outerW = $.derived(() => $$props.annotation.object.rect.size.width * $$props.scale);
1189
1257
  const outerH = $.derived(() => $$props.annotation.object.rect.size.height * $$props.scale);
1190
1258
  const justify = $.derived(() => $$props.annotation.object.verticalAlign === PdfVerticalAlignment.Top ? "flex-start" : $$props.annotation.object.verticalAlign === PdfVerticalAlignment.Middle ? "center" : "flex-end");
1191
- var div = root$3();
1259
+ var div = root$5();
1192
1260
  div.__pointerdown = function(...$$args) {
1193
1261
  var _a;
1194
1262
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -1227,7 +1295,7 @@ function FreeText($$anchor, $$props) {
1227
1295
  "font-size": `${$.get(adjustedFontPx)}px`,
1228
1296
  "font-family": standardFontCss($$props.annotation.object.fontFamily),
1229
1297
  "text-align": textAlignmentToCss($$props.annotation.object.textAlign),
1230
- "background-color": $$props.annotation.object.backgroundColor,
1298
+ "background-color": $$props.annotation.object.color ?? $$props.annotation.object.backgroundColor,
1231
1299
  opacity: $$props.annotation.object.opacity,
1232
1300
  width: $.get(needsComp) ? `${$.get(invScalePercent)}%` : "100%",
1233
1301
  height: $.get(needsComp) ? `${$.get(invScalePercent)}%` : "100%",
@@ -1245,7 +1313,7 @@ function FreeText($$anchor, $$props) {
1245
1313
  $.pop();
1246
1314
  }
1247
1315
  $.delegate(["pointerdown", "touchstart"]);
1248
- var root_1$1 = $.from_html(`<img/>`);
1316
+ var root_1$3 = $.from_html(`<img/>`);
1249
1317
  function RenderAnnotation($$anchor, $$props) {
1250
1318
  $.push($$props, true);
1251
1319
  let scaleFactor = $.prop($$props, "scaleFactor", 3, 1), restProps = $.rest_props($$props, [
@@ -1303,7 +1371,7 @@ function RenderAnnotation($$anchor, $$props) {
1303
1371
  var node = $.first_child(fragment);
1304
1372
  {
1305
1373
  var consequent = ($$anchor2) => {
1306
- var img = root_1$1();
1374
+ var img = root_1$3();
1307
1375
  $.attribute_effect(img, () => ({
1308
1376
  alt: "",
1309
1377
  src: $.get(imageUrl),
@@ -1322,14 +1390,14 @@ function RenderAnnotation($$anchor, $$props) {
1322
1390
  $.append($$anchor, fragment);
1323
1391
  $.pop();
1324
1392
  }
1325
- var root$2 = $.from_html(`<div><!></div>`);
1393
+ var root$4 = $.from_html(`<div><!></div>`);
1326
1394
  function Stamp($$anchor, $$props) {
1327
1395
  $.push($$props, true);
1328
1396
  let annotationProp = $.derived(() => ({
1329
1397
  ...$$props.annotation.object,
1330
1398
  id: $$props.annotation.object.id
1331
1399
  }));
1332
- var div = root$2();
1400
+ var div = root$4();
1333
1401
  let styles;
1334
1402
  div.__pointerdown = function(...$$args) {
1335
1403
  var _a;
@@ -1363,6 +1431,392 @@ function Stamp($$anchor, $$props) {
1363
1431
  $.pop();
1364
1432
  }
1365
1433
  $.delegate(["pointerdown", "touchstart"]);
1434
+ var root_1$2 = $.from_svg(`<line></line>`);
1435
+ var root_2$1 = $.from_svg(`<rect fill="transparent"></rect>`);
1436
+ var root$3 = $.from_svg(`<svg><rect fill="transparent"></rect><!></svg>`);
1437
+ function Link($$anchor, $$props) {
1438
+ $.push($$props, true);
1439
+ let strokeColor = $.prop($$props, "strokeColor", 3, "#0000FF"), strokeWidth = $.prop($$props, "strokeWidth", 3, 2), strokeStyle = $.prop($$props, "strokeStyle", 19, () => PdfAnnotationBorderStyle.UNDERLINE), hasIRT = $.prop($$props, "hasIRT", 3, false);
1440
+ const width = $.derived(() => $$props.rect.size.width);
1441
+ const height = $.derived(() => $$props.rect.size.height);
1442
+ const svgWidth = $.derived(() => $.get(width) * $$props.scale);
1443
+ const svgHeight = $.derived(() => $.get(height) * $$props.scale);
1444
+ const dashArray = $.derived(() => {
1445
+ var _a;
1446
+ if (strokeStyle() === PdfAnnotationBorderStyle.DASHED) {
1447
+ return ((_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",")) ?? `${strokeWidth() * 3},${strokeWidth()}`;
1448
+ }
1449
+ return void 0;
1450
+ });
1451
+ const isUnderline2 = $.derived(() => strokeStyle() === PdfAnnotationBorderStyle.UNDERLINE);
1452
+ const hitAreaCursor = $.derived(() => hasIRT() ? "default" : $$props.isSelected ? "move" : "pointer");
1453
+ const hitAreaPointerEvents = $.derived(() => hasIRT() ? "none" : $$props.isSelected ? "none" : "visible");
1454
+ var svg = root$3();
1455
+ let styles;
1456
+ var rect_1 = $.child(svg);
1457
+ $.set_attribute(rect_1, "x", 0);
1458
+ $.set_attribute(rect_1, "y", 0);
1459
+ rect_1.__pointerdown = function(...$$args) {
1460
+ var _a;
1461
+ (_a = hasIRT() ? void 0 : $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1462
+ };
1463
+ rect_1.__touchstart = function(...$$args) {
1464
+ var _a;
1465
+ (_a = hasIRT() ? void 0 : $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1466
+ };
1467
+ let styles_1;
1468
+ var node = $.sibling(rect_1);
1469
+ {
1470
+ var consequent = ($$anchor2) => {
1471
+ var line = root_1$2();
1472
+ $.set_attribute(line, "x1", 1);
1473
+ $.set_style(line, "", {}, { "pointer-events": "none" });
1474
+ $.template_effect(() => {
1475
+ $.set_attribute(line, "y1", $.get(height) - 1);
1476
+ $.set_attribute(line, "x2", $.get(width) - 1);
1477
+ $.set_attribute(line, "y2", $.get(height) - 1);
1478
+ $.set_attribute(line, "stroke", strokeColor());
1479
+ $.set_attribute(line, "stroke-width", strokeWidth());
1480
+ $.set_attribute(line, "stroke-dasharray", $.get(dashArray));
1481
+ });
1482
+ $.append($$anchor2, line);
1483
+ };
1484
+ var alternate = ($$anchor2) => {
1485
+ var rect_2 = root_2$1();
1486
+ $.set_style(rect_2, "", {}, { "pointer-events": "none" });
1487
+ $.template_effect(
1488
+ ($0, $1) => {
1489
+ $.set_attribute(rect_2, "x", strokeWidth() / 2);
1490
+ $.set_attribute(rect_2, "y", strokeWidth() / 2);
1491
+ $.set_attribute(rect_2, "width", $0);
1492
+ $.set_attribute(rect_2, "height", $1);
1493
+ $.set_attribute(rect_2, "stroke", strokeColor());
1494
+ $.set_attribute(rect_2, "stroke-width", strokeWidth());
1495
+ $.set_attribute(rect_2, "stroke-dasharray", $.get(dashArray));
1496
+ },
1497
+ [
1498
+ () => Math.max($.get(width) - strokeWidth(), 0),
1499
+ () => Math.max($.get(height) - strokeWidth(), 0)
1500
+ ]
1501
+ );
1502
+ $.append($$anchor2, rect_2);
1503
+ };
1504
+ $.if(node, ($$render) => {
1505
+ if ($.get(isUnderline2)) $$render(consequent);
1506
+ else $$render(alternate, false);
1507
+ });
1508
+ }
1509
+ $.reset(svg);
1510
+ $.template_effect(() => {
1511
+ styles = $.set_style(svg, "position: absolute; z-index: 2; pointer-events: none;", styles, {
1512
+ width: `${$.get(svgWidth) ?? ""}px`,
1513
+ height: `${$.get(svgHeight) ?? ""}px`
1514
+ });
1515
+ $.set_attribute(svg, "width", $.get(svgWidth));
1516
+ $.set_attribute(svg, "height", $.get(svgHeight));
1517
+ $.set_attribute(svg, "viewBox", `0 0 ${$.get(width) ?? ""} ${$.get(height) ?? ""}`);
1518
+ $.set_attribute(rect_1, "width", $.get(width));
1519
+ $.set_attribute(rect_1, "height", $.get(height));
1520
+ styles_1 = $.set_style(rect_1, "", styles_1, {
1521
+ cursor: $.get(hitAreaCursor),
1522
+ "pointer-events": $.get(hitAreaPointerEvents)
1523
+ });
1524
+ });
1525
+ $.append($$anchor, svg);
1526
+ $.pop();
1527
+ }
1528
+ $.delegate(["pointerdown", "touchstart"]);
1529
+ var root_5$1 = $.from_html(`<div></div>`);
1530
+ var root_1$1 = $.from_html(`<div data-group-selection-box="" data-no-interaction=""><div><!></div> <!></div>`);
1531
+ function GroupSelectionBox($$anchor, $$props) {
1532
+ $.push($$props, true);
1533
+ let selectionOutlineColor = $.prop($$props, "selectionOutlineColor", 3, "#007ACC"), outlineOffset = $.prop($$props, "outlineOffset", 3, 2), zIndex = $.prop($$props, "zIndex", 3, 100);
1534
+ const annotationPlugin = useAnnotationPlugin();
1535
+ let gestureBase = $.state(null);
1536
+ let isDraggingRef = $.state(false);
1537
+ let isResizingRef = $.state(false);
1538
+ function getGroupBox() {
1539
+ const rects = $$props.selectedAnnotations.map((ta) => ta.object.rect);
1540
+ return boundingRectOrEmpty(rects);
1541
+ }
1542
+ const groupBox = $.derived(getGroupBox);
1543
+ let previewGroupBox = $.state($.proxy(getGroupBox()));
1544
+ $.user_effect(() => {
1545
+ if (!$.get(isDraggingRef) && !$.get(isResizingRef)) {
1546
+ const newBox = $.get(groupBox);
1547
+ if ($.get(previewGroupBox).origin.x !== newBox.origin.x || $.get(previewGroupBox).origin.y !== newBox.origin.y || $.get(previewGroupBox).size.width !== newBox.size.width || $.get(previewGroupBox).size.height !== newBox.size.height) {
1548
+ $.set(previewGroupBox, newBox, true);
1549
+ }
1550
+ }
1551
+ });
1552
+ const HANDLE_COLOR = $.derived(() => {
1553
+ var _a;
1554
+ return ((_a = $$props.resizeUI) == null ? void 0 : _a.color) ?? "#007ACC";
1555
+ });
1556
+ const HANDLE_SIZE = $.derived(() => {
1557
+ var _a;
1558
+ return ((_a = $$props.resizeUI) == null ? void 0 : _a.size) ?? 12;
1559
+ });
1560
+ const interactionHandles = useInteractionHandles(() => ({
1561
+ controller: {
1562
+ element: $.get(previewGroupBox),
1563
+ constraints: {
1564
+ minWidth: 20,
1565
+ minHeight: 20,
1566
+ boundingBox: { width: $$props.pageWidth, height: $$props.pageHeight }
1567
+ },
1568
+ maintainAspectRatio: false,
1569
+ pageRotation: $$props.rotation,
1570
+ scale: $$props.scale,
1571
+ enabled: true,
1572
+ onUpdate: (event) => {
1573
+ var _a, _b;
1574
+ if (!((_a = event.transformData) == null ? void 0 : _a.type)) return;
1575
+ if (!annotationPlugin.plugin) return;
1576
+ const plugin = annotationPlugin.plugin;
1577
+ const transformType = event.transformData.type;
1578
+ const isMove = transformType === "move";
1579
+ const isResize = transformType === "resize";
1580
+ if (isMove && !$$props.isDraggable) return;
1581
+ if (event.state === "start") {
1582
+ $.set(gestureBase, getGroupBox(), true);
1583
+ if (isMove) {
1584
+ $.set(isDraggingRef, true);
1585
+ plugin.startDrag($$props.documentId, {
1586
+ annotationIds: $$props.selectedAnnotations.map((ta) => ta.object.id),
1587
+ pageSize: { width: $$props.pageWidth, height: $$props.pageHeight }
1588
+ });
1589
+ } else if (isResize) {
1590
+ $.set(isResizingRef, true);
1591
+ plugin.startResize($$props.documentId, {
1592
+ annotationIds: $$props.selectedAnnotations.map((ta) => ta.object.id),
1593
+ pageSize: { width: $$props.pageWidth, height: $$props.pageHeight },
1594
+ resizeHandle: ((_b = event.transformData.metadata) == null ? void 0 : _b.handle) ?? "se"
1595
+ });
1596
+ }
1597
+ }
1598
+ const base = $.get(gestureBase) ?? getGroupBox();
1599
+ if (isMove && event.transformData.changes.rect) {
1600
+ const newRect = event.transformData.changes.rect;
1601
+ const rawDelta = {
1602
+ x: newRect.origin.x - base.origin.x,
1603
+ y: newRect.origin.y - base.origin.y
1604
+ };
1605
+ const clampedDelta = plugin.updateDrag($$props.documentId, rawDelta);
1606
+ $.set(
1607
+ previewGroupBox,
1608
+ {
1609
+ ...base,
1610
+ origin: {
1611
+ x: base.origin.x + clampedDelta.x,
1612
+ y: base.origin.y + clampedDelta.y
1613
+ }
1614
+ },
1615
+ true
1616
+ );
1617
+ } else if (isResize && event.transformData.changes.rect) {
1618
+ const newGroupBox = event.transformData.changes.rect;
1619
+ plugin.updateResize($$props.documentId, newGroupBox);
1620
+ $.set(previewGroupBox, newGroupBox, true);
1621
+ }
1622
+ if (event.state === "end") {
1623
+ $.set(gestureBase, null);
1624
+ if (isMove && $.get(isDraggingRef)) {
1625
+ $.set(isDraggingRef, false);
1626
+ plugin.commitDrag($$props.documentId);
1627
+ } else if (isResize && $.get(isResizingRef)) {
1628
+ $.set(isResizingRef, false);
1629
+ plugin.commitResize($$props.documentId);
1630
+ }
1631
+ }
1632
+ }
1633
+ },
1634
+ resizeUI: {
1635
+ handleSize: $.get(HANDLE_SIZE),
1636
+ spacing: outlineOffset(),
1637
+ offsetMode: "outside",
1638
+ includeSides: true,
1639
+ zIndex: zIndex() + 1
1640
+ },
1641
+ vertexUI: { vertexSize: 0, zIndex: zIndex() },
1642
+ includeVertices: false
1643
+ }));
1644
+ const resizeHandles = $.derived(() => interactionHandles.resize);
1645
+ const shouldShowMenu = $.derived(() => !!$$props.groupSelectionMenu || !!$$props.groupSelectionMenuSnippet);
1646
+ function buildContext() {
1647
+ return {
1648
+ type: "group",
1649
+ annotations: $$props.selectedAnnotations,
1650
+ pageIndex: $$props.pageIndex
1651
+ };
1652
+ }
1653
+ function buildMenuProps(rect, menuWrapperProps) {
1654
+ return {
1655
+ context: buildContext(),
1656
+ selected: true,
1657
+ rect,
1658
+ placement: { suggestTop: false },
1659
+ menuWrapperProps
1660
+ };
1661
+ }
1662
+ var fragment = $.comment();
1663
+ var node = $.first_child(fragment);
1664
+ {
1665
+ var consequent_6 = ($$anchor2) => {
1666
+ var div = root_1$1();
1667
+ var div_1 = $.child(div);
1668
+ $.attribute_effect(div_1, () => ({
1669
+ ...$$props.isDraggable ? interactionHandles.dragProps : { onpointerdown: (e) => e.stopPropagation() },
1670
+ [$.STYLE]: {
1671
+ position: "absolute",
1672
+ left: `${$.get(previewGroupBox).origin.x * $$props.scale}px`,
1673
+ top: `${$.get(previewGroupBox).origin.y * $$props.scale}px`,
1674
+ width: `${$.get(previewGroupBox).size.width * $$props.scale}px`,
1675
+ height: `${$.get(previewGroupBox).size.height * $$props.scale}px`,
1676
+ outline: `2px dashed ${selectionOutlineColor() ?? ""}`,
1677
+ "outline-offset": `${outlineOffset() - 1}px`,
1678
+ cursor: $$props.isDraggable ? "move" : "default",
1679
+ "touch-action": "none",
1680
+ "z-index": zIndex()
1681
+ }
1682
+ }));
1683
+ var node_1 = $.child(div_1);
1684
+ {
1685
+ var consequent_1 = ($$anchor3) => {
1686
+ var fragment_1 = $.comment();
1687
+ var node_2 = $.first_child(fragment_1);
1688
+ $.each(node_2, 17, () => $.get(resizeHandles), ({ key, style: handleStyle, ...hProps }) => key, ($$anchor4, $$item) => {
1689
+ let handleStyle = () => $.get($$item).style;
1690
+ let hProps = () => $.exclude_from_object($.get($$item), ["key", "style"]);
1691
+ var fragment_2 = $.comment();
1692
+ var node_3 = $.first_child(fragment_2);
1693
+ {
1694
+ var consequent = ($$anchor5) => {
1695
+ var fragment_3 = $.comment();
1696
+ var node_4 = $.first_child(fragment_3);
1697
+ {
1698
+ let $0 = $.derived(() => ({ ...hProps(), backgroundColor: $.get(HANDLE_COLOR) }));
1699
+ $.snippet(node_4, () => $$props.resizeUI.component, () => $.get($0));
1700
+ }
1701
+ $.append($$anchor5, fragment_3);
1702
+ };
1703
+ var alternate = ($$anchor5) => {
1704
+ var div_2 = root_5$1();
1705
+ $.attribute_effect(div_2, () => ({
1706
+ ...hProps(),
1707
+ style: `${handleStyle() ?? ""}; background-color: ${$.get(HANDLE_COLOR) ?? ""};`
1708
+ }));
1709
+ $.append($$anchor5, div_2);
1710
+ };
1711
+ $.if(node_3, ($$render) => {
1712
+ var _a;
1713
+ if ((_a = $$props.resizeUI) == null ? void 0 : _a.component) $$render(consequent);
1714
+ else $$render(alternate, false);
1715
+ });
1716
+ }
1717
+ $.append($$anchor4, fragment_2);
1718
+ });
1719
+ $.append($$anchor3, fragment_1);
1720
+ };
1721
+ $.if(node_1, ($$render) => {
1722
+ if ($$props.isResizable) $$render(consequent_1);
1723
+ });
1724
+ }
1725
+ $.reset(div_1);
1726
+ var node_5 = $.sibling(div_1, 2);
1727
+ {
1728
+ var consequent_5 = ($$anchor3) => {
1729
+ {
1730
+ const children = ($$anchor4, $$arg0) => {
1731
+ let rect = () => $$arg0 == null ? void 0 : $$arg0().rect;
1732
+ let menuWrapperProps = () => $$arg0 == null ? void 0 : $$arg0().menuWrapperProps;
1733
+ const menuProps = $.derived(() => buildMenuProps(rect(), menuWrapperProps()));
1734
+ var fragment_5 = $.comment();
1735
+ var node_6 = $.first_child(fragment_5);
1736
+ {
1737
+ var consequent_3 = ($$anchor5) => {
1738
+ const result = $.derived(() => $$props.groupSelectionMenu($.get(menuProps)));
1739
+ var fragment_6 = $.comment();
1740
+ var node_7 = $.first_child(fragment_6);
1741
+ {
1742
+ var consequent_2 = ($$anchor6) => {
1743
+ var fragment_7 = $.comment();
1744
+ var node_8 = $.first_child(fragment_7);
1745
+ $.component(node_8, () => $.get(result).component, ($$anchor7, result_component) => {
1746
+ result_component($$anchor7, $.spread_props(() => $.get(result).props));
1747
+ });
1748
+ $.append($$anchor6, fragment_7);
1749
+ };
1750
+ $.if(node_7, ($$render) => {
1751
+ if ($.get(result)) $$render(consequent_2);
1752
+ });
1753
+ }
1754
+ $.append($$anchor5, fragment_6);
1755
+ };
1756
+ var alternate_1 = ($$anchor5) => {
1757
+ var fragment_8 = $.comment();
1758
+ var node_9 = $.first_child(fragment_8);
1759
+ {
1760
+ var consequent_4 = ($$anchor6) => {
1761
+ var fragment_9 = $.comment();
1762
+ var node_10 = $.first_child(fragment_9);
1763
+ $.snippet(node_10, () => $$props.groupSelectionMenuSnippet, () => $.get(menuProps));
1764
+ $.append($$anchor6, fragment_9);
1765
+ };
1766
+ $.if(
1767
+ node_9,
1768
+ ($$render) => {
1769
+ if ($$props.groupSelectionMenuSnippet) $$render(consequent_4);
1770
+ },
1771
+ true
1772
+ );
1773
+ }
1774
+ $.append($$anchor5, fragment_8);
1775
+ };
1776
+ $.if(node_6, ($$render) => {
1777
+ if ($$props.groupSelectionMenu) $$render(consequent_3);
1778
+ else $$render(alternate_1, false);
1779
+ });
1780
+ }
1781
+ $.append($$anchor4, fragment_5);
1782
+ };
1783
+ let $0 = $.derived(() => ({
1784
+ origin: {
1785
+ x: $.get(previewGroupBox).origin.x * $$props.scale,
1786
+ y: $.get(previewGroupBox).origin.y * $$props.scale
1787
+ },
1788
+ size: {
1789
+ width: $.get(previewGroupBox).size.width * $$props.scale,
1790
+ height: $.get(previewGroupBox).size.height * $$props.scale
1791
+ }
1792
+ }));
1793
+ CounterRotate($$anchor3, {
1794
+ get rect() {
1795
+ return $.get($0);
1796
+ },
1797
+ get rotation() {
1798
+ return $$props.rotation;
1799
+ },
1800
+ children,
1801
+ $$slots: { default: true }
1802
+ });
1803
+ }
1804
+ };
1805
+ $.if(node_5, ($$render) => {
1806
+ if ($.get(shouldShowMenu)) $$render(consequent_5);
1807
+ });
1808
+ }
1809
+ $.reset(div);
1810
+ $.append($$anchor2, div);
1811
+ };
1812
+ $.if(node, ($$render) => {
1813
+ if ($$props.selectedAnnotations.length >= 2) $$render(consequent_6);
1814
+ });
1815
+ }
1816
+ $.append($$anchor, fragment);
1817
+ $.pop();
1818
+ }
1819
+ var root$2 = $.from_html(`<!> <!>`, 1);
1366
1820
  function Annotations($$anchor, $$props) {
1367
1821
  $.push($$props, true);
1368
1822
  let annotationsProps = $.rest_props($$props, ["$$slots", "$$events", "$$legacy"]);
@@ -1370,17 +1824,18 @@ function Annotations($$anchor, $$props) {
1370
1824
  const selectionCapability = useSelectionCapability();
1371
1825
  const pointerHandlers = usePointerHandlers({ documentId: $$props.documentId, pageIndex: $$props.pageIndex });
1372
1826
  let annotations = $.state($.proxy([]));
1373
- let selectionState = $.state(null);
1827
+ let allSelectedIds = $.state($.proxy([]));
1374
1828
  let editingId = $.state(null);
1375
1829
  const annotationProvides = $.derived(() => annotationCapability.provides ? annotationCapability.provides.forDocument($$props.documentId) : null);
1830
+ const isMultiSelected = $.derived(() => $.get(allSelectedIds).length > 1);
1376
1831
  $.user_effect(() => {
1377
1832
  if (!$.get(annotationProvides)) return;
1378
1833
  const currentState = $.get(annotationProvides).getState();
1379
1834
  $.set(annotations, getAnnotationsByPageIndex(currentState, $$props.pageIndex), true);
1380
- $.set(selectionState, getSelectedAnnotationByPageIndex(currentState, $$props.pageIndex), true);
1835
+ $.set(allSelectedIds, getSelectedAnnotationIds(currentState), true);
1381
1836
  const off = $.get(annotationProvides).onStateChange((state) => {
1382
1837
  $.set(annotations, getAnnotationsByPageIndex(state, $$props.pageIndex), true);
1383
- $.set(selectionState, getSelectedAnnotationByPageIndex(state, $$props.pageIndex), true);
1838
+ $.set(allSelectedIds, getSelectedAnnotationIds(state), true);
1384
1839
  });
1385
1840
  return () => off == null ? void 0 : off();
1386
1841
  });
@@ -1398,20 +1853,59 @@ function Annotations($$anchor, $$props) {
1398
1853
  function handleClick(e, annotation) {
1399
1854
  e.stopPropagation();
1400
1855
  if ($.get(annotationProvides) && selectionCapability.provides) {
1401
- $.get(annotationProvides).selectAnnotation($$props.pageIndex, annotation.object.id);
1402
1856
  selectionCapability.provides.clear();
1857
+ const isModifierPressed = "metaKey" in e ? e.metaKey || e.ctrlKey : false;
1858
+ if (isModifierPressed) {
1859
+ $.get(annotationProvides).toggleSelection($$props.pageIndex, annotation.object.id);
1860
+ } else {
1861
+ $.get(annotationProvides).selectAnnotation($$props.pageIndex, annotation.object.id);
1862
+ }
1403
1863
  if (annotation.object.id !== $.get(editingId)) {
1404
1864
  $.set(editingId, null);
1405
1865
  }
1406
1866
  }
1407
1867
  }
1408
- var fragment = $.comment();
1409
- var node = $.first_child(fragment);
1410
- $.each(node, 17, () => $.get(annotations), (annotation) => annotation.object.id, ($$anchor2, annotation) => {
1411
- const isSelected = $.derived(() => {
1868
+ function handleLinkClick(e, annotation) {
1869
+ e.stopPropagation();
1870
+ if (!$.get(annotationProvides) || !selectionCapability.provides) return;
1871
+ selectionCapability.provides.clear();
1872
+ if (annotation.object.inReplyToId) {
1873
+ const parentId = annotation.object.inReplyToId;
1874
+ const parent = $.get(annotations).find((a) => a.object.id === parentId);
1875
+ if (parent) {
1876
+ $.get(annotationProvides).selectAnnotation(parent.object.pageIndex, parentId);
1877
+ return;
1878
+ }
1879
+ }
1880
+ $.get(annotationProvides).selectAnnotation($$props.pageIndex, annotation.object.id);
1881
+ }
1882
+ const selectedAnnotationsOnPage = $.derived(() => $.get(annotations).filter((anno) => $.get(allSelectedIds).includes(anno.object.id)));
1883
+ const areAllSelectedDraggable = $.derived(() => {
1884
+ if ($.get(selectedAnnotationsOnPage).length < 2) return false;
1885
+ return $.get(selectedAnnotationsOnPage).every((ta) => {
1412
1886
  var _a;
1413
- return ((_a = $.get(selectionState)) == null ? void 0 : _a.object.id) === $.get(annotation).object.id;
1887
+ const tool = (_a = $.get(annotationProvides)) == null ? void 0 : _a.findToolForAnnotation(ta.object);
1888
+ return (tool == null ? void 0 : tool.interaction.isGroupDraggable) ?? (tool == null ? void 0 : tool.interaction.isDraggable) ?? true;
1414
1889
  });
1890
+ });
1891
+ const areAllSelectedResizable = $.derived(() => {
1892
+ if ($.get(selectedAnnotationsOnPage).length < 2) return false;
1893
+ return $.get(selectedAnnotationsOnPage).every((ta) => {
1894
+ var _a;
1895
+ const tool = (_a = $.get(annotationProvides)) == null ? void 0 : _a.findToolForAnnotation(ta.object);
1896
+ return (tool == null ? void 0 : tool.interaction.isGroupResizable) ?? (tool == null ? void 0 : tool.interaction.isResizable) ?? true;
1897
+ });
1898
+ });
1899
+ const allSelectedOnSamePage = $.derived(() => {
1900
+ if (!$.get(annotationProvides)) return false;
1901
+ if ($.get(allSelectedIds).length < 2) return false;
1902
+ const allSelected = $.get(annotationProvides).getSelectedAnnotations();
1903
+ return allSelected.every((ta) => ta.object.pageIndex === $$props.pageIndex);
1904
+ });
1905
+ var fragment = root$2();
1906
+ var node = $.first_child(fragment);
1907
+ $.each(node, 17, () => $.get(annotations), (annotation) => annotation.object.id, ($$anchor2, annotation) => {
1908
+ const isSelected = $.derived(() => $.get(allSelectedIds).includes($.get(annotation).object.id));
1415
1909
  const isEditing = $.derived(() => $.get(editingId) === $.get(annotation).object.id);
1416
1910
  const tool = $.derived(() => {
1417
1911
  var _a;
@@ -1434,40 +1928,43 @@ function Annotations($$anchor, $$props) {
1434
1928
  onClick: (e) => handleClick(e, $.get(annotation))
1435
1929
  }));
1436
1930
  };
1437
- let $0 = $.derived(() => {
1438
- var _a;
1439
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
1440
- });
1931
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1441
1932
  let $1 = $.derived(() => {
1442
1933
  var _a;
1443
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true;
1934
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true) && !$.get(isMultiSelected);
1444
1935
  });
1445
1936
  let $2 = $.derived(() => {
1937
+ var _a;
1938
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true) && !$.get(isMultiSelected);
1939
+ });
1940
+ let $3 = $.derived(() => {
1446
1941
  var _a;
1447
1942
  return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
1448
1943
  });
1944
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
1945
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1449
1946
  AnnotationContainer($$anchor3, $.spread_props(
1450
1947
  {
1451
1948
  get trackedAnnotation() {
1452
1949
  return $.get(annotation);
1453
1950
  },
1454
1951
  get isSelected() {
1455
- return $.get(isSelected);
1952
+ return $.get($0);
1456
1953
  },
1457
1954
  get isDraggable() {
1458
- return $.get($0);
1955
+ return $.get($1);
1459
1956
  },
1460
1957
  get isResizable() {
1461
- return $.get($1);
1958
+ return $.get($2);
1462
1959
  },
1463
1960
  get lockAspectRatio() {
1464
- return $.get($2);
1961
+ return $.get($3);
1465
1962
  },
1466
1963
  get selectionMenu() {
1467
- return $$props.selectionMenu;
1964
+ return $.get($4);
1468
1965
  },
1469
1966
  get selectionMenuSnippet() {
1470
- return $$props.selectionMenuSnippet;
1967
+ return $.get($5);
1471
1968
  },
1472
1969
  onSelect: (e) => handleClick(e, $.get(annotation)),
1473
1970
  get style() {
@@ -1479,7 +1976,7 @@ function Annotations($$anchor, $$props) {
1479
1976
  ));
1480
1977
  }
1481
1978
  };
1482
- var alternate_10 = ($$anchor3) => {
1979
+ var alternate_11 = ($$anchor3) => {
1483
1980
  var fragment_4 = $.comment();
1484
1981
  var node_2 = $.first_child(fragment_4);
1485
1982
  {
@@ -1496,40 +1993,43 @@ function Annotations($$anchor, $$props) {
1496
1993
  onClick: (e) => handleClick(e, $.get(annotation))
1497
1994
  }));
1498
1995
  };
1499
- let $0 = $.derived(() => {
1500
- var _a;
1501
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
1502
- });
1996
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1503
1997
  let $1 = $.derived(() => {
1504
1998
  var _a;
1505
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true;
1999
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true) && !$.get(isMultiSelected);
1506
2000
  });
1507
2001
  let $2 = $.derived(() => {
2002
+ var _a;
2003
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true) && !$.get(isMultiSelected);
2004
+ });
2005
+ let $3 = $.derived(() => {
1508
2006
  var _a;
1509
2007
  return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
1510
2008
  });
2009
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2010
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1511
2011
  AnnotationContainer($$anchor4, $.spread_props(
1512
2012
  {
1513
2013
  get trackedAnnotation() {
1514
2014
  return $.get(annotation);
1515
2015
  },
1516
2016
  get isSelected() {
1517
- return $.get(isSelected);
2017
+ return $.get($0);
1518
2018
  },
1519
2019
  get isDraggable() {
1520
- return $.get($0);
2020
+ return $.get($1);
1521
2021
  },
1522
2022
  get isResizable() {
1523
- return $.get($1);
2023
+ return $.get($2);
1524
2024
  },
1525
2025
  get lockAspectRatio() {
1526
- return $.get($2);
2026
+ return $.get($3);
1527
2027
  },
1528
2028
  get selectionMenu() {
1529
- return $$props.selectionMenu;
2029
+ return $.get($4);
1530
2030
  },
1531
2031
  get selectionMenuSnippet() {
1532
- return $$props.selectionMenuSnippet;
2032
+ return $.get($5);
1533
2033
  },
1534
2034
  onSelect: (e) => handleClick(e, $.get(annotation)),
1535
2035
  get style() {
@@ -1541,7 +2041,7 @@ function Annotations($$anchor, $$props) {
1541
2041
  ));
1542
2042
  }
1543
2043
  };
1544
- var alternate_9 = ($$anchor4) => {
2044
+ var alternate_10 = ($$anchor4) => {
1545
2045
  var fragment_7 = $.comment();
1546
2046
  var node_3 = $.first_child(fragment_7);
1547
2047
  {
@@ -1558,40 +2058,43 @@ function Annotations($$anchor, $$props) {
1558
2058
  onClick: (e) => handleClick(e, $.get(annotation))
1559
2059
  }));
1560
2060
  };
1561
- let $0 = $.derived(() => {
1562
- var _a;
1563
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
1564
- });
2061
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1565
2062
  let $1 = $.derived(() => {
1566
2063
  var _a;
1567
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true;
2064
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true) && !$.get(isMultiSelected);
1568
2065
  });
1569
2066
  let $2 = $.derived(() => {
2067
+ var _a;
2068
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true) && !$.get(isMultiSelected);
2069
+ });
2070
+ let $3 = $.derived(() => {
1570
2071
  var _a;
1571
2072
  return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
1572
2073
  });
2074
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2075
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1573
2076
  AnnotationContainer($$anchor5, $.spread_props(
1574
2077
  {
1575
2078
  get trackedAnnotation() {
1576
2079
  return $.get(annotation);
1577
2080
  },
1578
2081
  get isSelected() {
1579
- return $.get(isSelected);
2082
+ return $.get($0);
1580
2083
  },
1581
2084
  get isDraggable() {
1582
- return $.get($0);
2085
+ return $.get($1);
1583
2086
  },
1584
2087
  get isResizable() {
1585
- return $.get($1);
2088
+ return $.get($2);
1586
2089
  },
1587
2090
  get lockAspectRatio() {
1588
- return $.get($2);
2091
+ return $.get($3);
1589
2092
  },
1590
2093
  get selectionMenu() {
1591
- return $$props.selectionMenu;
2094
+ return $.get($4);
1592
2095
  },
1593
2096
  get selectionMenuSnippet() {
1594
- return $$props.selectionMenuSnippet;
2097
+ return $.get($5);
1595
2098
  },
1596
2099
  onSelect: (e) => handleClick(e, $.get(annotation)),
1597
2100
  get style() {
@@ -1603,7 +2106,7 @@ function Annotations($$anchor, $$props) {
1603
2106
  ));
1604
2107
  }
1605
2108
  };
1606
- var alternate_8 = ($$anchor5) => {
2109
+ var alternate_9 = ($$anchor5) => {
1607
2110
  var fragment_10 = $.comment();
1608
2111
  var node_4 = $.first_child(fragment_10);
1609
2112
  {
@@ -1617,40 +2120,43 @@ function Annotations($$anchor, $$props) {
1617
2120
  onClick: (e) => handleClick(e, $.get(annotation))
1618
2121
  }));
1619
2122
  };
1620
- let $0 = $.derived(() => {
1621
- var _a;
1622
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? false;
1623
- });
2123
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1624
2124
  let $1 = $.derived(() => {
1625
2125
  var _a;
1626
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2126
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? false) && !$.get(isMultiSelected);
1627
2127
  });
1628
2128
  let $2 = $.derived(() => {
2129
+ var _a;
2130
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false) && !$.get(isMultiSelected);
2131
+ });
2132
+ let $3 = $.derived(() => {
1629
2133
  var _a;
1630
2134
  return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
1631
2135
  });
2136
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2137
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1632
2138
  AnnotationContainer($$anchor6, $.spread_props(
1633
2139
  {
1634
2140
  get trackedAnnotation() {
1635
2141
  return $.get(annotation);
1636
2142
  },
1637
2143
  get isSelected() {
1638
- return $.get(isSelected);
2144
+ return $.get($0);
1639
2145
  },
1640
2146
  get isDraggable() {
1641
- return $.get($0);
2147
+ return $.get($1);
1642
2148
  },
1643
2149
  get isResizable() {
1644
- return $.get($1);
2150
+ return $.get($2);
1645
2151
  },
1646
2152
  get lockAspectRatio() {
1647
- return $.get($2);
2153
+ return $.get($3);
1648
2154
  },
1649
2155
  get selectionMenu() {
1650
- return $$props.selectionMenu;
2156
+ return $.get($4);
1651
2157
  },
1652
2158
  get selectionMenuSnippet() {
1653
- return $$props.selectionMenuSnippet;
2159
+ return $.get($5);
1654
2160
  },
1655
2161
  onSelect: (e) => handleClick(e, $.get(annotation)),
1656
2162
  zIndex: 0,
@@ -1663,7 +2169,7 @@ function Annotations($$anchor, $$props) {
1663
2169
  ));
1664
2170
  }
1665
2171
  };
1666
- var alternate_7 = ($$anchor6) => {
2172
+ var alternate_8 = ($$anchor6) => {
1667
2173
  var fragment_13 = $.comment();
1668
2174
  var node_5 = $.first_child(fragment_13);
1669
2175
  {
@@ -1677,40 +2183,43 @@ function Annotations($$anchor, $$props) {
1677
2183
  onClick: (e) => handleClick(e, $.get(annotation))
1678
2184
  }));
1679
2185
  };
1680
- let $0 = $.derived(() => {
1681
- var _a;
1682
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? false;
1683
- });
2186
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1684
2187
  let $1 = $.derived(() => {
1685
2188
  var _a;
1686
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2189
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? false) && !$.get(isMultiSelected);
1687
2190
  });
1688
2191
  let $2 = $.derived(() => {
2192
+ var _a;
2193
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false) && !$.get(isMultiSelected);
2194
+ });
2195
+ let $3 = $.derived(() => {
1689
2196
  var _a;
1690
2197
  return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
1691
2198
  });
2199
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2200
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1692
2201
  AnnotationContainer($$anchor7, $.spread_props(
1693
2202
  {
1694
2203
  get trackedAnnotation() {
1695
2204
  return $.get(annotation);
1696
2205
  },
1697
2206
  get isSelected() {
1698
- return $.get(isSelected);
2207
+ return $.get($0);
1699
2208
  },
1700
2209
  get isDraggable() {
1701
- return $.get($0);
2210
+ return $.get($1);
1702
2211
  },
1703
2212
  get isResizable() {
1704
- return $.get($1);
2213
+ return $.get($2);
1705
2214
  },
1706
2215
  get lockAspectRatio() {
1707
- return $.get($2);
2216
+ return $.get($3);
1708
2217
  },
1709
2218
  get selectionMenu() {
1710
- return $$props.selectionMenu;
2219
+ return $.get($4);
1711
2220
  },
1712
2221
  get selectionMenuSnippet() {
1713
- return $$props.selectionMenuSnippet;
2222
+ return $.get($5);
1714
2223
  },
1715
2224
  onSelect: (e) => handleClick(e, $.get(annotation)),
1716
2225
  zIndex: 0,
@@ -1723,7 +2232,7 @@ function Annotations($$anchor, $$props) {
1723
2232
  ));
1724
2233
  }
1725
2234
  };
1726
- var alternate_6 = ($$anchor7) => {
2235
+ var alternate_7 = ($$anchor7) => {
1727
2236
  var fragment_16 = $.comment();
1728
2237
  var node_6 = $.first_child(fragment_16);
1729
2238
  {
@@ -1737,40 +2246,43 @@ function Annotations($$anchor, $$props) {
1737
2246
  onClick: (e) => handleClick(e, $.get(annotation))
1738
2247
  }));
1739
2248
  };
1740
- let $0 = $.derived(() => {
1741
- var _a;
1742
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? false;
1743
- });
2249
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1744
2250
  let $1 = $.derived(() => {
1745
2251
  var _a;
1746
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2252
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? false) && !$.get(isMultiSelected);
1747
2253
  });
1748
2254
  let $2 = $.derived(() => {
2255
+ var _a;
2256
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false) && !$.get(isMultiSelected);
2257
+ });
2258
+ let $3 = $.derived(() => {
1749
2259
  var _a;
1750
2260
  return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
1751
2261
  });
2262
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2263
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1752
2264
  AnnotationContainer($$anchor8, $.spread_props(
1753
2265
  {
1754
2266
  get trackedAnnotation() {
1755
2267
  return $.get(annotation);
1756
2268
  },
1757
2269
  get isSelected() {
1758
- return $.get(isSelected);
2270
+ return $.get($0);
1759
2271
  },
1760
2272
  get isDraggable() {
1761
- return $.get($0);
2273
+ return $.get($1);
1762
2274
  },
1763
2275
  get isResizable() {
1764
- return $.get($1);
2276
+ return $.get($2);
1765
2277
  },
1766
2278
  get lockAspectRatio() {
1767
- return $.get($2);
2279
+ return $.get($3);
1768
2280
  },
1769
2281
  get selectionMenu() {
1770
- return $$props.selectionMenu;
2282
+ return $.get($4);
1771
2283
  },
1772
2284
  get selectionMenuSnippet() {
1773
- return $$props.selectionMenuSnippet;
2285
+ return $.get($5);
1774
2286
  },
1775
2287
  onSelect: (e) => handleClick(e, $.get(annotation)),
1776
2288
  zIndex: 0,
@@ -1783,7 +2295,7 @@ function Annotations($$anchor, $$props) {
1783
2295
  ));
1784
2296
  }
1785
2297
  };
1786
- var alternate_5 = ($$anchor8) => {
2298
+ var alternate_6 = ($$anchor8) => {
1787
2299
  var fragment_19 = $.comment();
1788
2300
  var node_7 = $.first_child(fragment_19);
1789
2301
  {
@@ -1797,46 +2309,49 @@ function Annotations($$anchor, $$props) {
1797
2309
  onClick: (e) => handleClick(e, $.get(annotation))
1798
2310
  }));
1799
2311
  };
1800
- let $0 = $.derived(() => {
1801
- var _a;
1802
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? false;
1803
- });
2312
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1804
2313
  let $1 = $.derived(() => {
1805
2314
  var _a;
1806
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2315
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? false) && !$.get(isMultiSelected);
1807
2316
  });
1808
2317
  let $2 = $.derived(() => {
2318
+ var _a;
2319
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false) && !$.get(isMultiSelected);
2320
+ });
2321
+ let $3 = $.derived(() => {
1809
2322
  var _a;
1810
2323
  return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
1811
2324
  });
1812
- let $3 = $.derived(() => blendModeToCss($.get(annotation).object.blendMode ?? PdfBlendMode.Multiply));
2325
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2326
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2327
+ let $6 = $.derived(() => blendModeToCss($.get(annotation).object.blendMode ?? PdfBlendMode.Multiply));
1813
2328
  AnnotationContainer($$anchor9, $.spread_props(
1814
2329
  {
1815
2330
  get trackedAnnotation() {
1816
2331
  return $.get(annotation);
1817
2332
  },
1818
2333
  get isSelected() {
1819
- return $.get(isSelected);
2334
+ return $.get($0);
1820
2335
  },
1821
2336
  get isDraggable() {
1822
- return $.get($0);
2337
+ return $.get($1);
1823
2338
  },
1824
2339
  get isResizable() {
1825
- return $.get($1);
2340
+ return $.get($2);
1826
2341
  },
1827
2342
  get lockAspectRatio() {
1828
- return $.get($2);
2343
+ return $.get($3);
1829
2344
  },
1830
2345
  onSelect: (e) => handleClick(e, $.get(annotation)),
1831
2346
  zIndex: 0,
1832
2347
  get selectionMenu() {
1833
- return $$props.selectionMenu;
2348
+ return $.get($4);
1834
2349
  },
1835
2350
  get selectionMenuSnippet() {
1836
- return $$props.selectionMenuSnippet;
2351
+ return $.get($5);
1837
2352
  },
1838
2353
  get style() {
1839
- return `mix-blend-mode: ${$.get($3) ?? ""}`;
2354
+ return `mix-blend-mode: ${$.get($6) ?? ""}`;
1840
2355
  }
1841
2356
  },
1842
2357
  () => annotationsProps,
@@ -1844,7 +2359,7 @@ function Annotations($$anchor, $$props) {
1844
2359
  ));
1845
2360
  }
1846
2361
  };
1847
- var alternate_4 = ($$anchor9) => {
2362
+ var alternate_5 = ($$anchor9) => {
1848
2363
  var fragment_22 = $.comment();
1849
2364
  var node_8 = $.first_child(fragment_22);
1850
2365
  {
@@ -1861,40 +2376,43 @@ function Annotations($$anchor, $$props) {
1861
2376
  onClick: (e) => handleClick(e, $.get(annotation))
1862
2377
  }));
1863
2378
  };
1864
- let $0 = $.derived(() => {
1865
- var _a;
1866
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
1867
- });
2379
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1868
2380
  let $1 = $.derived(() => {
1869
2381
  var _a;
1870
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2382
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true) && !$.get(isMultiSelected);
1871
2383
  });
1872
2384
  let $2 = $.derived(() => {
2385
+ var _a;
2386
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false) && !$.get(isMultiSelected);
2387
+ });
2388
+ let $3 = $.derived(() => {
1873
2389
  var _a;
1874
2390
  return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
1875
2391
  });
2392
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2393
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1876
2394
  AnnotationContainer($$anchor10, $.spread_props(
1877
2395
  {
1878
2396
  get trackedAnnotation() {
1879
2397
  return $.get(annotation);
1880
2398
  },
1881
2399
  get isSelected() {
1882
- return $.get(isSelected);
2400
+ return $.get($0);
1883
2401
  },
1884
2402
  get isDraggable() {
1885
- return $.get($0);
2403
+ return $.get($1);
1886
2404
  },
1887
2405
  get isResizable() {
1888
- return $.get($1);
2406
+ return $.get($2);
1889
2407
  },
1890
2408
  get lockAspectRatio() {
1891
- return $.get($2);
2409
+ return $.get($3);
1892
2410
  },
1893
2411
  get selectionMenu() {
1894
- return $$props.selectionMenu;
2412
+ return $.get($4);
1895
2413
  },
1896
2414
  get selectionMenuSnippet() {
1897
- return $$props.selectionMenuSnippet;
2415
+ return $.get($5);
1898
2416
  },
1899
2417
  onSelect: (e) => handleClick(e, $.get(annotation)),
1900
2418
  vertexConfig: {
@@ -1910,7 +2428,7 @@ function Annotations($$anchor, $$props) {
1910
2428
  ));
1911
2429
  }
1912
2430
  };
1913
- var alternate_3 = ($$anchor10) => {
2431
+ var alternate_4 = ($$anchor10) => {
1914
2432
  var fragment_25 = $.comment();
1915
2433
  var node_9 = $.first_child(fragment_25);
1916
2434
  {
@@ -1927,40 +2445,43 @@ function Annotations($$anchor, $$props) {
1927
2445
  onClick: (e) => handleClick(e, $.get(annotation))
1928
2446
  }));
1929
2447
  };
1930
- let $0 = $.derived(() => {
2448
+ let $0 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2449
+ let $1 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2450
+ let $2 = $.derived(() => {
1931
2451
  var _a;
1932
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
2452
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true) && !$.get(isMultiSelected);
1933
2453
  });
1934
- let $1 = $.derived(() => {
2454
+ let $3 = $.derived(() => {
1935
2455
  var _a;
1936
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2456
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false) && !$.get(isMultiSelected);
1937
2457
  });
1938
- let $2 = $.derived(() => {
2458
+ let $4 = $.derived(() => {
1939
2459
  var _a;
1940
2460
  return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
1941
2461
  });
2462
+ let $5 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1942
2463
  AnnotationContainer($$anchor11, $.spread_props(
1943
2464
  {
1944
2465
  get trackedAnnotation() {
1945
2466
  return $.get(annotation);
1946
2467
  },
1947
2468
  get selectionMenu() {
1948
- return $$props.selectionMenu;
2469
+ return $.get($0);
1949
2470
  },
1950
2471
  get selectionMenuSnippet() {
1951
- return $$props.selectionMenuSnippet;
2472
+ return $.get($1);
1952
2473
  },
1953
2474
  get isDraggable() {
1954
- return $.get($0);
2475
+ return $.get($2);
1955
2476
  },
1956
2477
  get isResizable() {
1957
- return $.get($1);
2478
+ return $.get($3);
1958
2479
  },
1959
2480
  get lockAspectRatio() {
1960
- return $.get($2);
2481
+ return $.get($4);
1961
2482
  },
1962
2483
  get isSelected() {
1963
- return $.get(isSelected);
2484
+ return $.get($5);
1964
2485
  },
1965
2486
  onSelect: (e) => handleClick(e, $.get(annotation)),
1966
2487
  vertexConfig: {
@@ -1976,7 +2497,7 @@ function Annotations($$anchor, $$props) {
1976
2497
  ));
1977
2498
  }
1978
2499
  };
1979
- var alternate_2 = ($$anchor11) => {
2500
+ var alternate_3 = ($$anchor11) => {
1980
2501
  var fragment_28 = $.comment();
1981
2502
  var node_10 = $.first_child(fragment_28);
1982
2503
  {
@@ -1993,40 +2514,43 @@ function Annotations($$anchor, $$props) {
1993
2514
  onClick: (e) => handleClick(e, $.get(annotation))
1994
2515
  }));
1995
2516
  };
1996
- let $0 = $.derived(() => {
1997
- var _a;
1998
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
1999
- });
2517
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2000
2518
  let $1 = $.derived(() => {
2001
2519
  var _a;
2002
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2520
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true) && !$.get(isMultiSelected);
2003
2521
  });
2004
2522
  let $2 = $.derived(() => {
2523
+ var _a;
2524
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false) && !$.get(isMultiSelected);
2525
+ });
2526
+ let $3 = $.derived(() => {
2005
2527
  var _a;
2006
2528
  return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2007
2529
  });
2530
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2531
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2008
2532
  AnnotationContainer($$anchor12, $.spread_props(
2009
2533
  {
2010
2534
  get trackedAnnotation() {
2011
2535
  return $.get(annotation);
2012
2536
  },
2013
2537
  get isSelected() {
2014
- return $.get(isSelected);
2538
+ return $.get($0);
2015
2539
  },
2016
2540
  get isDraggable() {
2017
- return $.get($0);
2541
+ return $.get($1);
2018
2542
  },
2019
2543
  get isResizable() {
2020
- return $.get($1);
2544
+ return $.get($2);
2021
2545
  },
2022
2546
  get lockAspectRatio() {
2023
- return $.get($2);
2547
+ return $.get($3);
2024
2548
  },
2025
2549
  get selectionMenu() {
2026
- return $$props.selectionMenu;
2550
+ return $.get($4);
2027
2551
  },
2028
2552
  get selectionMenuSnippet() {
2029
- return $$props.selectionMenuSnippet;
2553
+ return $.get($5);
2030
2554
  },
2031
2555
  onSelect: (e) => handleClick(e, $.get(annotation)),
2032
2556
  vertexConfig: {
@@ -2042,7 +2566,7 @@ function Annotations($$anchor, $$props) {
2042
2566
  ));
2043
2567
  }
2044
2568
  };
2045
- var alternate_1 = ($$anchor12) => {
2569
+ var alternate_2 = ($$anchor12) => {
2046
2570
  var fragment_31 = $.comment();
2047
2571
  var node_11 = $.first_child(fragment_31);
2048
2572
  {
@@ -2074,45 +2598,48 @@ function Annotations($$anchor, $$props) {
2074
2598
  });
2075
2599
  }
2076
2600
  };
2077
- let $0 = $.derived(() => {
2078
- var _a;
2079
- return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true) && !$.get(isEditing);
2080
- });
2601
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2081
2602
  let $1 = $.derived(() => {
2082
2603
  var _a;
2083
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true;
2604
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true) && !$.get(isEditing) && !$.get(isMultiSelected);
2084
2605
  });
2085
2606
  let $2 = $.derived(() => {
2607
+ var _a;
2608
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true) && !$.get(isMultiSelected);
2609
+ });
2610
+ let $3 = $.derived(() => {
2086
2611
  var _a;
2087
2612
  return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2088
2613
  });
2089
- let $3 = $.derived(() => blendModeToCss($.get(annotation).object.blendMode ?? PdfBlendMode.Normal));
2614
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2615
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2616
+ let $6 = $.derived(() => blendModeToCss($.get(annotation).object.blendMode ?? PdfBlendMode.Normal));
2090
2617
  AnnotationContainer($$anchor13, $.spread_props(
2091
2618
  {
2092
2619
  get trackedAnnotation() {
2093
2620
  return $.get(annotation);
2094
2621
  },
2095
2622
  get isSelected() {
2096
- return $.get(isSelected);
2623
+ return $.get($0);
2097
2624
  },
2098
2625
  get isDraggable() {
2099
- return $.get($0);
2626
+ return $.get($1);
2100
2627
  },
2101
2628
  get isResizable() {
2102
- return $.get($1);
2629
+ return $.get($2);
2103
2630
  },
2104
2631
  get lockAspectRatio() {
2105
- return $.get($2);
2632
+ return $.get($3);
2106
2633
  },
2107
2634
  get selectionMenu() {
2108
- return $$props.selectionMenu;
2635
+ return $.get($4);
2109
2636
  },
2110
2637
  get selectionMenuSnippet() {
2111
- return $$props.selectionMenuSnippet;
2638
+ return $.get($5);
2112
2639
  },
2113
2640
  onSelect: (e) => handleClick(e, $.get(annotation)),
2114
2641
  get style() {
2115
- return `mix-blend-mode: ${$.get($3) ?? ""}`;
2642
+ return `mix-blend-mode: ${$.get($6) ?? ""}`;
2116
2643
  },
2117
2644
  onDoubleClick: (e) => {
2118
2645
  e.stopPropagation();
@@ -2124,7 +2651,7 @@ function Annotations($$anchor, $$props) {
2124
2651
  ));
2125
2652
  }
2126
2653
  };
2127
- var alternate = ($$anchor13) => {
2654
+ var alternate_1 = ($$anchor13) => {
2128
2655
  var fragment_34 = $.comment();
2129
2656
  var node_12 = $.first_child(fragment_34);
2130
2657
  {
@@ -2150,40 +2677,43 @@ function Annotations($$anchor, $$props) {
2150
2677
  onClick: (e) => handleClick(e, $.get(annotation))
2151
2678
  });
2152
2679
  };
2153
- let $0 = $.derived(() => {
2154
- var _a;
2155
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
2156
- });
2680
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2157
2681
  let $1 = $.derived(() => {
2158
2682
  var _a;
2159
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true;
2683
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true) && !$.get(isMultiSelected);
2160
2684
  });
2161
2685
  let $2 = $.derived(() => {
2686
+ var _a;
2687
+ return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true) && !$.get(isMultiSelected);
2688
+ });
2689
+ let $3 = $.derived(() => {
2162
2690
  var _a;
2163
2691
  return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2164
2692
  });
2693
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2694
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2165
2695
  AnnotationContainer($$anchor14, $.spread_props(
2166
2696
  {
2167
2697
  get trackedAnnotation() {
2168
2698
  return $.get(annotation);
2169
2699
  },
2170
2700
  get isSelected() {
2171
- return $.get(isSelected);
2701
+ return $.get($0);
2172
2702
  },
2173
2703
  get isDraggable() {
2174
- return $.get($0);
2704
+ return $.get($1);
2175
2705
  },
2176
2706
  get isResizable() {
2177
- return $.get($1);
2707
+ return $.get($2);
2178
2708
  },
2179
2709
  get lockAspectRatio() {
2180
- return $.get($2);
2710
+ return $.get($3);
2181
2711
  },
2182
2712
  get selectionMenu() {
2183
- return $$props.selectionMenu;
2713
+ return $.get($4);
2184
2714
  },
2185
2715
  get selectionMenuSnippet() {
2186
- return $$props.selectionMenuSnippet;
2716
+ return $.get($5);
2187
2717
  },
2188
2718
  onSelect: (e) => handleClick(e, $.get(annotation)),
2189
2719
  get style() {
@@ -2195,10 +2725,75 @@ function Annotations($$anchor, $$props) {
2195
2725
  ));
2196
2726
  }
2197
2727
  };
2728
+ var alternate = ($$anchor14) => {
2729
+ var fragment_37 = $.comment();
2730
+ var node_13 = $.first_child(fragment_37);
2731
+ {
2732
+ var consequent_12 = ($$anchor15) => {
2733
+ const hasIRT = $.derived(() => !!$.get(annotation).object.inReplyToId);
2734
+ {
2735
+ const children = ($$anchor16, obj = $.noop) => {
2736
+ Link($$anchor16, $.spread_props(obj, {
2737
+ get isSelected() {
2738
+ return $.get(isSelected);
2739
+ },
2740
+ get scale() {
2741
+ return $$props.scale;
2742
+ },
2743
+ onClick: (e) => handleLinkClick(e, $.get(annotation)),
2744
+ get hasIRT() {
2745
+ return $.get(hasIRT);
2746
+ }
2747
+ }));
2748
+ };
2749
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2750
+ let $1 = $.derived(() => $.get(hasIRT) ? void 0 : $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2751
+ let $2 = $.derived(() => $.get(hasIRT) ? void 0 : $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2752
+ AnnotationContainer($$anchor15, $.spread_props(
2753
+ {
2754
+ get trackedAnnotation() {
2755
+ return $.get(annotation);
2756
+ },
2757
+ get isSelected() {
2758
+ return $.get($0);
2759
+ },
2760
+ get isMultiSelected() {
2761
+ return $.get(isMultiSelected);
2762
+ },
2763
+ isDraggable: false,
2764
+ isResizable: false,
2765
+ lockAspectRatio: false,
2766
+ get selectionMenu() {
2767
+ return $.get($1);
2768
+ },
2769
+ get selectionMenuSnippet() {
2770
+ return $.get($2);
2771
+ },
2772
+ onSelect: (e) => handleLinkClick(e, $.get(annotation)),
2773
+ get style() {
2774
+ return `mix-blend-mode: ${$.get(mixBlendMode) ?? ""}`;
2775
+ }
2776
+ },
2777
+ () => annotationsProps,
2778
+ { children, $$slots: { default: true } }
2779
+ ));
2780
+ }
2781
+ };
2782
+ $.if(
2783
+ node_13,
2784
+ ($$render) => {
2785
+ if (isLink($.get(annotation))) $$render(consequent_12);
2786
+ },
2787
+ true
2788
+ );
2789
+ }
2790
+ $.append($$anchor14, fragment_37);
2791
+ };
2198
2792
  $.if(
2199
2793
  node_12,
2200
2794
  ($$render) => {
2201
2795
  if (isStamp($.get(annotation))) $$render(consequent_11);
2796
+ else $$render(alternate, false);
2202
2797
  },
2203
2798
  true
2204
2799
  );
@@ -2209,7 +2804,7 @@ function Annotations($$anchor, $$props) {
2209
2804
  node_11,
2210
2805
  ($$render) => {
2211
2806
  if (isFreeText($.get(annotation))) $$render(consequent_10);
2212
- else $$render(alternate, false);
2807
+ else $$render(alternate_1, false);
2213
2808
  },
2214
2809
  true
2215
2810
  );
@@ -2220,7 +2815,7 @@ function Annotations($$anchor, $$props) {
2220
2815
  node_10,
2221
2816
  ($$render) => {
2222
2817
  if (isPolygon($.get(annotation))) $$render(consequent_9);
2223
- else $$render(alternate_1, false);
2818
+ else $$render(alternate_2, false);
2224
2819
  },
2225
2820
  true
2226
2821
  );
@@ -2231,7 +2826,7 @@ function Annotations($$anchor, $$props) {
2231
2826
  node_9,
2232
2827
  ($$render) => {
2233
2828
  if (isPolyline($.get(annotation))) $$render(consequent_8);
2234
- else $$render(alternate_2, false);
2829
+ else $$render(alternate_3, false);
2235
2830
  },
2236
2831
  true
2237
2832
  );
@@ -2242,7 +2837,7 @@ function Annotations($$anchor, $$props) {
2242
2837
  node_8,
2243
2838
  ($$render) => {
2244
2839
  if (isLine($.get(annotation))) $$render(consequent_7);
2245
- else $$render(alternate_3, false);
2840
+ else $$render(alternate_4, false);
2246
2841
  },
2247
2842
  true
2248
2843
  );
@@ -2253,7 +2848,7 @@ function Annotations($$anchor, $$props) {
2253
2848
  node_7,
2254
2849
  ($$render) => {
2255
2850
  if (isHighlight($.get(annotation))) $$render(consequent_6);
2256
- else $$render(alternate_4, false);
2851
+ else $$render(alternate_5, false);
2257
2852
  },
2258
2853
  true
2259
2854
  );
@@ -2264,7 +2859,7 @@ function Annotations($$anchor, $$props) {
2264
2859
  node_6,
2265
2860
  ($$render) => {
2266
2861
  if (isSquiggly($.get(annotation))) $$render(consequent_5);
2267
- else $$render(alternate_5, false);
2862
+ else $$render(alternate_6, false);
2268
2863
  },
2269
2864
  true
2270
2865
  );
@@ -2275,7 +2870,7 @@ function Annotations($$anchor, $$props) {
2275
2870
  node_5,
2276
2871
  ($$render) => {
2277
2872
  if (isStrikeout($.get(annotation))) $$render(consequent_4);
2278
- else $$render(alternate_6, false);
2873
+ else $$render(alternate_7, false);
2279
2874
  },
2280
2875
  true
2281
2876
  );
@@ -2286,7 +2881,7 @@ function Annotations($$anchor, $$props) {
2286
2881
  node_4,
2287
2882
  ($$render) => {
2288
2883
  if (isUnderline($.get(annotation))) $$render(consequent_3);
2289
- else $$render(alternate_7, false);
2884
+ else $$render(alternate_8, false);
2290
2885
  },
2291
2886
  true
2292
2887
  );
@@ -2297,7 +2892,7 @@ function Annotations($$anchor, $$props) {
2297
2892
  node_3,
2298
2893
  ($$render) => {
2299
2894
  if (isCircle($.get(annotation))) $$render(consequent_2);
2300
- else $$render(alternate_8, false);
2895
+ else $$render(alternate_9, false);
2301
2896
  },
2302
2897
  true
2303
2898
  );
@@ -2308,7 +2903,7 @@ function Annotations($$anchor, $$props) {
2308
2903
  node_2,
2309
2904
  ($$render) => {
2310
2905
  if (isSquare($.get(annotation))) $$render(consequent_1);
2311
- else $$render(alternate_9, false);
2906
+ else $$render(alternate_10, false);
2312
2907
  },
2313
2908
  true
2314
2909
  );
@@ -2317,11 +2912,60 @@ function Annotations($$anchor, $$props) {
2317
2912
  };
2318
2913
  $.if(node_1, ($$render) => {
2319
2914
  if (isInk($.get(annotation))) $$render(consequent);
2320
- else $$render(alternate_10, false);
2915
+ else $$render(alternate_11, false);
2321
2916
  });
2322
2917
  }
2323
2918
  $.append($$anchor2, fragment_1);
2324
2919
  });
2920
+ var node_14 = $.sibling(node, 2);
2921
+ {
2922
+ var consequent_13 = ($$anchor2) => {
2923
+ GroupSelectionBox($$anchor2, {
2924
+ get documentId() {
2925
+ return $$props.documentId;
2926
+ },
2927
+ get pageIndex() {
2928
+ return $$props.pageIndex;
2929
+ },
2930
+ get scale() {
2931
+ return $$props.scale;
2932
+ },
2933
+ get rotation() {
2934
+ return $$props.rotation;
2935
+ },
2936
+ get pageWidth() {
2937
+ return $$props.pageWidth;
2938
+ },
2939
+ get pageHeight() {
2940
+ return $$props.pageHeight;
2941
+ },
2942
+ get selectedAnnotations() {
2943
+ return $.get(selectedAnnotationsOnPage);
2944
+ },
2945
+ get isDraggable() {
2946
+ return $.get(areAllSelectedDraggable);
2947
+ },
2948
+ get isResizable() {
2949
+ return $.get(areAllSelectedResizable);
2950
+ },
2951
+ get resizeUI() {
2952
+ return $$props.resizeUI;
2953
+ },
2954
+ get selectionOutlineColor() {
2955
+ return $$props.selectionOutlineColor;
2956
+ },
2957
+ get groupSelectionMenu() {
2958
+ return $$props.groupSelectionMenu;
2959
+ },
2960
+ get groupSelectionMenuSnippet() {
2961
+ return $$props.groupSelectionMenuSnippet;
2962
+ }
2963
+ });
2964
+ };
2965
+ $.if(node_14, ($$render) => {
2966
+ if ($.get(allSelectedOnSamePage) && $.get(selectedAnnotationsOnPage).length >= 2) $$render(consequent_13);
2967
+ });
2968
+ }
2325
2969
  $.append($$anchor, fragment);
2326
2970
  $.pop();
2327
2971
  }
@@ -2372,14 +3016,14 @@ function TextMarkup($$anchor, $$props) {
2372
3016
  {
2373
3017
  let $0 = $.derived(() => {
2374
3018
  var _a;
2375
- return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.color;
3019
+ return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.strokeColor;
2376
3020
  });
2377
3021
  let $1 = $.derived(() => {
2378
3022
  var _a;
2379
3023
  return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.opacity;
2380
3024
  });
2381
3025
  Underline(node_2, {
2382
- get color() {
3026
+ get strokeColor() {
2383
3027
  return $.get($0);
2384
3028
  },
2385
3029
  get opacity() {
@@ -2413,14 +3057,14 @@ function TextMarkup($$anchor, $$props) {
2413
3057
  {
2414
3058
  let $0 = $.derived(() => {
2415
3059
  var _a;
2416
- return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.color;
3060
+ return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.strokeColor;
2417
3061
  });
2418
3062
  let $1 = $.derived(() => {
2419
3063
  var _a;
2420
3064
  return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.opacity;
2421
3065
  });
2422
3066
  Highlight(node_4, {
2423
- get color() {
3067
+ get strokeColor() {
2424
3068
  return $.get($0);
2425
3069
  },
2426
3070
  get opacity() {
@@ -2454,14 +3098,14 @@ function TextMarkup($$anchor, $$props) {
2454
3098
  {
2455
3099
  let $0 = $.derived(() => {
2456
3100
  var _a;
2457
- return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.color;
3101
+ return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.strokeColor;
2458
3102
  });
2459
3103
  let $1 = $.derived(() => {
2460
3104
  var _a;
2461
3105
  return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.opacity;
2462
3106
  });
2463
3107
  Strikeout(node_6, {
2464
- get color() {
3108
+ get strokeColor() {
2465
3109
  return $.get($0);
2466
3110
  },
2467
3111
  get opacity() {
@@ -2495,14 +3139,14 @@ function TextMarkup($$anchor, $$props) {
2495
3139
  {
2496
3140
  let $0 = $.derived(() => {
2497
3141
  var _a;
2498
- return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.color;
3142
+ return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.strokeColor;
2499
3143
  });
2500
3144
  let $1 = $.derived(() => {
2501
3145
  var _a;
2502
3146
  return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.opacity;
2503
3147
  });
2504
3148
  Squiggly(node_8, {
2505
- get color() {
3149
+ get strokeColor() {
2506
3150
  return $.get($0);
2507
3151
  },
2508
3152
  get opacity() {
@@ -2959,6 +3603,8 @@ function AnnotationLayer($$anchor, $$props) {
2959
3603
  "rotation",
2960
3604
  "selectionMenu",
2961
3605
  "selectionMenuSnippet",
3606
+ "groupSelectionMenu",
3607
+ "groupSelectionMenuSnippet",
2962
3608
  "resizeUI",
2963
3609
  "vertexUI",
2964
3610
  "selectionOutlineColor",
@@ -3000,6 +3646,12 @@ function AnnotationLayer($$anchor, $$props) {
3000
3646
  get selectionMenuSnippet() {
3001
3647
  return $$props.selectionMenuSnippet;
3002
3648
  },
3649
+ get groupSelectionMenu() {
3650
+ return $$props.groupSelectionMenu;
3651
+ },
3652
+ get groupSelectionMenuSnippet() {
3653
+ return $$props.groupSelectionMenuSnippet;
3654
+ },
3003
3655
  get pageIndex() {
3004
3656
  return $$props.pageIndex;
3005
3657
  },
@@ -3063,9 +3715,11 @@ export {
3063
3715
  Annotations,
3064
3716
  Circle,
3065
3717
  FreeText,
3718
+ GroupSelectionBox,
3066
3719
  Highlight,
3067
3720
  Ink,
3068
3721
  Line,
3722
+ Link,
3069
3723
  Polygon,
3070
3724
  Polyline,
3071
3725
  PreviewRenderer,