@embedpdf/plugin-annotation 2.2.0 → 2.4.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 (119) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1232 -101
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +33 -3
  6. package/dist/lib/annotation-plugin.d.ts +178 -2
  7. package/dist/lib/handlers/types.d.ts +1 -1
  8. package/dist/lib/helpers.d.ts +8 -2
  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 +22 -4
  12. package/dist/lib/types.d.ts +278 -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 +1133 -403
  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 +1132 -402
  22. package/dist/react/index.js.map +1 -1
  23. package/dist/shared/components/annotation-container.d.ts +13 -2
  24. package/dist/shared/components/annotation-layer.d.ts +6 -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 +4 -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 +50 -1
  35. package/dist/shared/context/index.d.ts +1 -0
  36. package/dist/shared/context/renderer-registry.d.ts +21 -0
  37. package/dist/shared/index.d.ts +2 -0
  38. package/dist/shared-preact/components/annotation-container.d.ts +13 -2
  39. package/dist/shared-preact/components/annotation-layer.d.ts +6 -2
  40. package/dist/shared-preact/components/annotations/ink.d.ts +3 -3
  41. package/dist/shared-preact/components/annotations/link.d.ts +28 -0
  42. package/dist/shared-preact/components/annotations.d.ts +4 -1
  43. package/dist/shared-preact/components/group-selection-box.d.ts +32 -0
  44. package/dist/shared-preact/components/index.d.ts +1 -0
  45. package/dist/shared-preact/components/text-markup/highlight.d.ts +3 -2
  46. package/dist/shared-preact/components/text-markup/squiggly.d.ts +3 -2
  47. package/dist/shared-preact/components/text-markup/strikeout.d.ts +3 -2
  48. package/dist/shared-preact/components/text-markup/underline.d.ts +3 -2
  49. package/dist/shared-preact/components/types.d.ts +50 -1
  50. package/dist/shared-preact/context/index.d.ts +1 -0
  51. package/dist/shared-preact/context/renderer-registry.d.ts +21 -0
  52. package/dist/shared-preact/index.d.ts +2 -0
  53. package/dist/shared-react/components/annotation-container.d.ts +13 -2
  54. package/dist/shared-react/components/annotation-layer.d.ts +6 -2
  55. package/dist/shared-react/components/annotations/ink.d.ts +3 -3
  56. package/dist/shared-react/components/annotations/link.d.ts +28 -0
  57. package/dist/shared-react/components/annotations.d.ts +4 -1
  58. package/dist/shared-react/components/group-selection-box.d.ts +32 -0
  59. package/dist/shared-react/components/index.d.ts +1 -0
  60. package/dist/shared-react/components/text-markup/highlight.d.ts +3 -2
  61. package/dist/shared-react/components/text-markup/squiggly.d.ts +3 -2
  62. package/dist/shared-react/components/text-markup/strikeout.d.ts +3 -2
  63. package/dist/shared-react/components/text-markup/underline.d.ts +3 -2
  64. package/dist/shared-react/components/types.d.ts +50 -1
  65. package/dist/shared-react/context/index.d.ts +1 -0
  66. package/dist/shared-react/context/renderer-registry.d.ts +21 -0
  67. package/dist/shared-react/index.d.ts +2 -0
  68. package/dist/svelte/components/AnnotationLayer.svelte.d.ts +8 -1
  69. package/dist/svelte/components/Annotations.svelte.d.ts +8 -1
  70. package/dist/svelte/components/GroupSelectionBox.svelte.d.ts +32 -0
  71. package/dist/svelte/components/RendererRegistryProvider.svelte.d.ts +7 -0
  72. package/dist/svelte/components/annotations/Ink.svelte.d.ts +2 -1
  73. package/dist/svelte/components/annotations/Link.svelte.d.ts +24 -0
  74. package/dist/svelte/components/annotations/index.d.ts +1 -0
  75. package/dist/svelte/components/index.d.ts +2 -0
  76. package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +2 -1
  77. package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +2 -1
  78. package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +2 -1
  79. package/dist/svelte/components/text-markup/Underline.svelte.d.ts +2 -1
  80. package/dist/svelte/components/types.d.ts +2 -0
  81. package/dist/svelte/context/index.d.ts +2 -0
  82. package/dist/svelte/context/renderer-registry.svelte.d.ts +20 -0
  83. package/dist/svelte/context/types.d.ts +33 -0
  84. package/dist/svelte/index.cjs +1 -1
  85. package/dist/svelte/index.cjs.map +1 -1
  86. package/dist/svelte/index.d.ts +2 -0
  87. package/dist/svelte/index.js +1215 -394
  88. package/dist/svelte/index.js.map +1 -1
  89. package/dist/svelte/types.d.ts +7 -0
  90. package/dist/vue/components/annotation-container.vue.d.ts +3 -1
  91. package/dist/vue/components/annotation-layer.vue.d.ts +31 -5
  92. package/dist/vue/components/annotations/free-text.vue.d.ts +1 -1
  93. package/dist/vue/components/annotations/index.d.ts +1 -0
  94. package/dist/vue/components/annotations/ink.vue.d.ts +2 -2
  95. package/dist/vue/components/annotations/line.vue.d.ts +1 -1
  96. package/dist/vue/components/annotations/link.vue.d.ts +29 -0
  97. package/dist/vue/components/annotations/polygon.vue.d.ts +1 -1
  98. package/dist/vue/components/annotations/polyline.vue.d.ts +1 -1
  99. package/dist/vue/components/annotations/stamp.vue.d.ts +1 -1
  100. package/dist/vue/components/annotations.vue.d.ts +151 -53
  101. package/dist/vue/components/group-selection-box.vue.d.ts +73 -0
  102. package/dist/vue/components/index.d.ts +2 -0
  103. package/dist/vue/components/preview-renderer.vue.d.ts +1 -1
  104. package/dist/vue/components/renderer-registry-provider.vue.d.ts +13 -0
  105. package/dist/vue/components/text-markup/highlight.vue.d.ts +2 -2
  106. package/dist/vue/components/text-markup/squiggly.vue.d.ts +2 -2
  107. package/dist/vue/components/text-markup/strikeout.vue.d.ts +2 -2
  108. package/dist/vue/components/text-markup/underline.vue.d.ts +2 -2
  109. package/dist/vue/context/index.d.ts +2 -0
  110. package/dist/vue/context/renderer-registry.d.ts +26 -0
  111. package/dist/vue/context/types.d.ts +33 -0
  112. package/dist/vue/hooks/use-annotation.d.ts +7 -5
  113. package/dist/vue/index.cjs +1 -1
  114. package/dist/vue/index.cjs.map +1 -1
  115. package/dist/vue/index.d.ts +3 -1
  116. package/dist/vue/index.js +1124 -459
  117. package/dist/vue/index.js.map +1 -1
  118. package/dist/vue/types.d.ts +8 -1
  119. package/package.json +10 -10
@@ -1,12 +1,61 @@
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";
1
+ import { createPluginPackage } from "@embedpdf/core";
2
+ import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationIds, resolveInteractionProp, isInk, isSquare, isCircle, isUnderline, isStrikeout, isSquiggly, isHighlight, isLine, isPolyline, isPolygon, isFreeText, isStamp, isLink, AnnotationPluginPackage as AnnotationPluginPackage$1 } from "@embedpdf/plugin-annotation";
3
3
  export * from "@embedpdf/plugin-annotation";
4
- import { useCapability, usePlugin, useDocumentPermissions, useDocumentState } from "@embedpdf/core/svelte";
5
4
  import "svelte/internal/disclose-version";
5
+ import * as $ from "svelte/internal/client";
6
+ import { setContext, getContext, untrack } from "svelte";
7
+ import { useCapability, usePlugin, useDocumentPermissions, useDocumentState } from "@embedpdf/core/svelte";
6
8
  import { useInteractionHandles, deepToRaw, doublePress, CounterRotate } from "@embedpdf/utils/svelte";
7
- import { PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCss, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
9
+ import { PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCss, ignore, PdfErrorCode, boundingRectOrEmpty, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
8
10
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/svelte";
9
11
  import { useSelectionCapability } from "@embedpdf/plugin-selection/svelte";
12
+ const REGISTRY_KEY = Symbol("AnnotationRendererRegistry");
13
+ function createRendererRegistry() {
14
+ let renderers = $.state($.proxy([]));
15
+ return {
16
+ register(entries) {
17
+ const ids = new Set(entries.map((e) => e.id));
18
+ $.set(
19
+ renderers,
20
+ [
21
+ ...$.get(renderers).filter((r) => !ids.has(r.id)),
22
+ ...entries
23
+ ],
24
+ true
25
+ );
26
+ return () => {
27
+ $.set(renderers, $.get(renderers).filter((r) => !entries.some((e) => e.id === r.id)), true);
28
+ };
29
+ },
30
+ getAll() {
31
+ return $.get(renderers);
32
+ }
33
+ };
34
+ }
35
+ function provideRendererRegistry() {
36
+ const registry = createRendererRegistry();
37
+ setContext(REGISTRY_KEY, registry);
38
+ return registry;
39
+ }
40
+ function getRendererRegistry() {
41
+ return getContext(REGISTRY_KEY) ?? null;
42
+ }
43
+ function createRenderer(entry) {
44
+ return {
45
+ id: entry.id,
46
+ matches: entry.matches,
47
+ component: entry.component
48
+ };
49
+ }
50
+ function RendererRegistryProvider($$anchor, $$props) {
51
+ $.push($$props, true);
52
+ provideRendererRegistry();
53
+ var fragment = $.comment();
54
+ var node = $.first_child(fragment);
55
+ $.snippet(node, () => $$props.children);
56
+ $.append($$anchor, fragment);
57
+ $.pop();
58
+ }
10
59
  const useAnnotationCapability = () => useCapability(AnnotationPlugin.id);
11
60
  const useAnnotationPlugin = () => usePlugin(AnnotationPlugin.id);
12
61
  const useAnnotation = (getDocumentId) => {
@@ -38,10 +87,10 @@ const useAnnotation = (getDocumentId) => {
38
87
  };
39
88
  var root_6$1 = $.from_html(`<div></div>`);
40
89
  var root_10 = $.from_html(`<div></div>`);
41
- var root$a = $.from_html(`<div data-no-interaction=""><div><!> <!> <!></div> <!></div>`);
90
+ var root$c = $.from_html(`<div data-no-interaction=""><div><!> <!> <!></div> <!></div>`);
42
91
  function AnnotationContainer($$anchor, $$props) {
43
92
  $.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, [
93
+ 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, 1), selectionOutlineColor = $.prop($$props, "selectionOutlineColor", 3, "#007ACC"), restProps = $.rest_props($$props, [
45
94
  "$$slots",
46
95
  "$$events",
47
96
  "$$legacy",
@@ -54,6 +103,7 @@ function AnnotationContainer($$anchor, $$props) {
54
103
  "trackedAnnotation",
55
104
  "children",
56
105
  "isSelected",
106
+ "isMultiSelected",
57
107
  "isDraggable",
58
108
  "isResizable",
59
109
  "lockAspectRatio",
@@ -73,10 +123,12 @@ function AnnotationContainer($$anchor, $$props) {
73
123
  ]);
74
124
  let preview = $.state($.proxy($$props.trackedAnnotation.object));
75
125
  let annotationCapability = useAnnotationCapability();
126
+ const annotationPlugin = useAnnotationPlugin();
76
127
  const permissions = useDocumentPermissions(() => $$props.documentId);
77
128
  let gestureBaseRef = $.state(null);
78
- const effectiveIsDraggable = $.derived(() => permissions.canModifyAnnotations && $$props.isDraggable);
79
- const effectiveIsResizable = $.derived(() => permissions.canModifyAnnotations && $$props.isResizable);
129
+ let gestureBaseRectRef = $.state(null);
130
+ const effectiveIsDraggable = $.derived(() => permissions.canModifyAnnotations && $$props.isDraggable && !isMultiSelected());
131
+ const effectiveIsResizable = $.derived(() => permissions.canModifyAnnotations && $$props.isResizable && !isMultiSelected());
80
132
  const guardedOnDoubleClick = $.derived(() => permissions.canModifyAnnotations && $$props.onDoubleClick ? $$props.onDoubleClick : void 0);
81
133
  const annotationProvides = $.derived(() => annotationCapability.provides ? annotationCapability.provides.forDocument($$props.documentId) : null);
82
134
  let currentObject = $.derived(() => $.get(preview) ? { ...$$props.trackedAnnotation.object, ...$.get(preview) } : $$props.trackedAnnotation.object);
@@ -96,11 +148,32 @@ function AnnotationContainer($$anchor, $$props) {
96
148
  var _a;
97
149
  return ((_a = $$props.vertexUI) == null ? void 0 : _a.size) ?? 12;
98
150
  });
151
+ const showOutline = $.derived(() => $$props.isSelected && !isMultiSelected());
99
152
  $.user_effect(() => {
100
153
  if ($$props.trackedAnnotation.object) {
101
154
  $.set(preview, $$props.trackedAnnotation.object, true);
102
155
  }
103
156
  });
157
+ $.user_effect(() => {
158
+ const plugin = annotationPlugin.plugin;
159
+ if (!plugin) return;
160
+ const id = $$props.trackedAnnotation.object.id;
161
+ const handleEvent = (event) => {
162
+ var _a;
163
+ if (event.documentId !== $$props.documentId) return;
164
+ const patch = (_a = event.previewPatches) == null ? void 0 : _a[id];
165
+ if (event.type === "update" && patch) {
166
+ $.set(preview, { ...untrack(() => $.get(preview)), ...patch }, true);
167
+ } else if (event.type === "cancel") {
168
+ $.set(preview, $$props.trackedAnnotation.object, true);
169
+ }
170
+ };
171
+ const unsubs = [
172
+ plugin.onDragChange(handleEvent),
173
+ plugin.onResizeChange(handleEvent)
174
+ ];
175
+ return () => unsubs.forEach((u) => u());
176
+ });
104
177
  const interactionHandles = useInteractionHandles(() => {
105
178
  var _a;
106
179
  return {
@@ -115,28 +188,62 @@ function AnnotationContainer($$anchor, $$props) {
115
188
  maintainAspectRatio: lockAspectRatio(),
116
189
  pageRotation: $$props.rotation,
117
190
  scale: $$props.scale,
118
- enabled: $$props.isSelected,
191
+ // Disable interaction handles when multi-selected
192
+ enabled: $$props.isSelected && !isMultiSelected(),
119
193
  onUpdate: (event) => {
120
- var _a2, _b, _c, _d;
121
- if (!((_a2 = event.transformData) == null ? void 0 : _a2.type)) return;
194
+ var _a2, _b, _c;
195
+ if (!((_a2 = event.transformData) == null ? void 0 : _a2.type) || isMultiSelected()) return;
196
+ const plugin = annotationPlugin.plugin;
197
+ if (!plugin) return;
198
+ const { type, changes, metadata } = event.transformData;
199
+ const id = $$props.trackedAnnotation.object.id;
200
+ const pageSize = { width: $$props.pageWidth, height: $$props.pageHeight };
122
201
  if (event.state === "start") {
123
- $.set(gestureBaseRef, $.get(currentObject), true);
202
+ $.set(gestureBaseRectRef, $$props.trackedAnnotation.object.rect, true);
203
+ $.set(
204
+ gestureBaseRef,
205
+ $$props.trackedAnnotation.object,
206
+ // For vertex edit
207
+ true
208
+ );
209
+ if (type === "move") {
210
+ plugin.startDrag($$props.documentId, { annotationIds: [id], pageSize });
211
+ } else if (type === "resize") {
212
+ plugin.startResize($$props.documentId, {
213
+ annotationIds: [id],
214
+ pageSize,
215
+ resizeHandle: (metadata == null ? void 0 : metadata.handle) ?? "se"
216
+ });
217
+ }
124
218
  }
125
- const transformType = event.transformData.type;
126
- const base = $.get(gestureBaseRef) ?? $.get(currentObject);
127
- const changes = event.transformData.changes.vertices ? (_b = $$props.vertexConfig) == null ? void 0 : _b.transformAnnotation(base, event.transformData.changes.vertices) : { rect: event.transformData.changes.rect };
128
- const patched = (_c = annotationCapability.provides) == null ? void 0 : _c.transformAnnotation(base, {
129
- type: transformType,
130
- changes,
131
- metadata: event.transformData.metadata
132
- });
133
- if (patched) {
134
- $.set(preview, { ...$.get(preview), ...patched }, true);
219
+ if (changes.rect && $.get(gestureBaseRectRef)) {
220
+ if (type === "move") {
221
+ const delta = {
222
+ x: changes.rect.origin.x - $.get(gestureBaseRectRef).origin.x,
223
+ y: changes.rect.origin.y - $.get(gestureBaseRectRef).origin.y
224
+ };
225
+ plugin.updateDrag($$props.documentId, delta);
226
+ } else if (type === "resize") {
227
+ plugin.updateResize($$props.documentId, changes.rect);
228
+ }
135
229
  }
136
- if (event.state === "end" && patched) {
230
+ if (type === "vertex-edit" && changes.vertices && $$props.vertexConfig) {
231
+ const base = $.get(gestureBaseRef) ?? $$props.trackedAnnotation.object;
232
+ const vertexChanges = $$props.vertexConfig.transformAnnotation(base, changes.vertices);
233
+ const patched = (_b = annotationCapability.provides) == null ? void 0 : _b.transformAnnotation(base, { type, changes: vertexChanges, metadata });
234
+ if (patched) {
235
+ $.set(preview, { ...$.get(preview), ...patched }, true);
236
+ if (event.state === "end") {
237
+ const sanitized = deepToRaw(patched);
238
+ (_c = $.get(annotationProvides)) == null ? void 0 : _c.updateAnnotation($$props.pageIndex, id, sanitized);
239
+ }
240
+ }
241
+ }
242
+ if (event.state === "end") {
243
+ $.set(gestureBaseRectRef, null);
137
244
  $.set(gestureBaseRef, null);
138
- const sanitized = deepToRaw(patched);
139
- (_d = $.get(annotationProvides)) == null ? void 0 : _d.updateAnnotation($$props.pageIndex, $$props.trackedAnnotation.object.id, sanitized);
245
+ if (type === "move") plugin.commitDrag($$props.documentId);
246
+ else if (type === "resize") plugin.commitResize($$props.documentId);
140
247
  }
141
248
  }
142
249
  },
@@ -153,7 +260,7 @@ function AnnotationContainer($$anchor, $$props) {
153
260
  });
154
261
  const resizeHandles = $.derived(() => interactionHandles.resize);
155
262
  const vertexHandles = $.derived(() => interactionHandles.vertices);
156
- const shouldShowMenu = $.derived(() => $$props.isSelected && (!!$$props.selectionMenu || !!$$props.selectionMenuSnippet));
263
+ const shouldShowMenu = $.derived(() => $$props.isSelected && !isMultiSelected() && (!!$$props.selectionMenu || !!$$props.selectionMenuSnippet));
157
264
  function buildContext() {
158
265
  return {
159
266
  type: "annotation",
@@ -171,7 +278,7 @@ function AnnotationContainer($$anchor, $$props) {
171
278
  menuWrapperProps
172
279
  };
173
280
  }
174
- var div = root$a();
281
+ var div = root$c();
175
282
  var div_1 = $.child(div);
176
283
  $.attribute_effect(div_1, () => ({
177
284
  ...$.get(effectiveIsDraggable) && $$props.isSelected ? interactionHandles.dragProps : {},
@@ -184,9 +291,9 @@ function AnnotationContainer($$anchor, $$props) {
184
291
  top: `${$.get(currentObject).rect.origin.y * $$props.scale}px`,
185
292
  width: `${$.get(currentObject).rect.size.width * $$props.scale}px`,
186
293
  height: `${$.get(currentObject).rect.size.height * $$props.scale}px`,
187
- outline: $$props.isSelected ? `1px solid ${selectionOutlineColor()}` : "none",
188
- "outline-offset": $$props.isSelected ? `${outlineOffset()}px` : "0px",
189
- "pointer-events": $$props.isSelected ? "auto" : "none",
294
+ outline: $.get(showOutline) ? `1px solid ${selectionOutlineColor()}` : "none",
295
+ "outline-offset": $.get(showOutline) ? `${outlineOffset()}px` : "0px",
296
+ "pointer-events": $$props.isSelected && !isMultiSelected() ? "auto" : "none",
190
297
  "touch-action": "none",
191
298
  cursor: $$props.isSelected && $.get(effectiveIsDraggable) ? "move" : "default",
192
299
  "z-index": zIndex()
@@ -310,7 +417,7 @@ function AnnotationContainer($$anchor, $$props) {
310
417
  $.append($$anchor2, fragment_5);
311
418
  };
312
419
  $.if(node_7, ($$render) => {
313
- if ($$props.isSelected && permissions.canModifyAnnotations) $$render(consequent_4);
420
+ if ($$props.isSelected && permissions.canModifyAnnotations && !isMultiSelected()) $$render(consequent_4);
314
421
  });
315
422
  }
316
423
  $.reset(div_1);
@@ -405,14 +512,15 @@ function AnnotationContainer($$anchor, $$props) {
405
512
  $.append($$anchor, div);
406
513
  $.pop();
407
514
  }
408
- var root_1$9 = $.from_html(`<div></div>`);
515
+ var root_1$b = $.from_html(`<div></div>`);
409
516
  function Highlight($$anchor, $$props) {
410
517
  $.push($$props, true);
411
- let color = $.prop($$props, "color", 3, "#FFFF00"), opacity = $.prop($$props, "opacity", 3, 0.5);
518
+ let opacity = $.prop($$props, "opacity", 3, 0.5);
519
+ const resolvedColor = $.derived(() => $$props.strokeColor ?? "#FFFF00");
412
520
  var fragment = $.comment();
413
521
  var node = $.first_child(fragment);
414
522
  $.each(node, 17, () => $$props.segmentRects, $.index, ($$anchor2, b) => {
415
- var div = root_1$9();
523
+ var div = root_1$b();
416
524
  $.attribute_effect(
417
525
  div,
418
526
  ($0) => ({
@@ -427,7 +535,7 @@ function Highlight($$anchor, $$props) {
427
535
  top: `${($$props.rect ? $.get(b).origin.y - $$props.rect.origin.y : $.get(b).origin.y) * $$props.scale}px`,
428
536
  width: `${$.get(b).size.width * $$props.scale}px`,
429
537
  height: `${$.get(b).size.height * $$props.scale}px`,
430
- background: color(),
538
+ background: $.get(resolvedColor),
431
539
  opacity: opacity(),
432
540
  "pointer-events": $$props.onClick ? "auto" : "none",
433
541
  cursor: $$props.onClick ? "pointer" : "default",
@@ -443,15 +551,16 @@ function Highlight($$anchor, $$props) {
443
551
  $.append($$anchor, fragment);
444
552
  $.pop();
445
553
  }
446
- var root_1$8 = $.from_html(`<div><div></div></div>`);
554
+ var root_1$a = $.from_html(`<div><div></div></div>`);
447
555
  function Underline($$anchor, $$props) {
448
556
  $.push($$props, true);
449
- let color = $.prop($$props, "color", 3, "#FFFF00"), opacity = $.prop($$props, "opacity", 3, 0.5);
557
+ let opacity = $.prop($$props, "opacity", 3, 0.5);
558
+ const resolvedColor = $.derived(() => $$props.strokeColor ?? "#FFFF00");
450
559
  const thickness = $.derived(() => 2 * $$props.scale);
451
560
  var fragment = $.comment();
452
561
  var node = $.first_child(fragment);
453
562
  $.each(node, 17, () => $$props.segmentRects, $.index, ($$anchor2, r) => {
454
- var div = root_1$8();
563
+ var div = root_1$a();
455
564
  $.attribute_effect(
456
565
  div,
457
566
  ($0) => ({
@@ -485,7 +594,7 @@ function Underline($$anchor, $$props) {
485
594
  bottom: "0",
486
595
  width: "100%",
487
596
  height: `${$.get(thickness) ?? ""}px`,
488
- background: color(),
597
+ background: $.get(resolvedColor),
489
598
  opacity: opacity(),
490
599
  "pointer-events": "none"
491
600
  }));
@@ -494,15 +603,16 @@ function Underline($$anchor, $$props) {
494
603
  $.append($$anchor, fragment);
495
604
  $.pop();
496
605
  }
497
- var root_1$7 = $.from_html(`<div><div></div></div>`);
606
+ var root_1$9 = $.from_html(`<div><div></div></div>`);
498
607
  function Strikeout($$anchor, $$props) {
499
608
  $.push($$props, true);
500
- let color = $.prop($$props, "color", 3, "#FFFF00"), opacity = $.prop($$props, "opacity", 3, 0.5);
609
+ let opacity = $.prop($$props, "opacity", 3, 0.5);
610
+ const resolvedColor = $.derived(() => $$props.strokeColor ?? "#FFFF00");
501
611
  const thickness = $.derived(() => 2 * $$props.scale);
502
612
  var fragment = $.comment();
503
613
  var node = $.first_child(fragment);
504
614
  $.each(node, 17, () => $$props.segmentRects, $.index, ($$anchor2, r) => {
505
- var div = root_1$7();
615
+ var div = root_1$9();
506
616
  $.attribute_effect(
507
617
  div,
508
618
  ($0) => ({
@@ -536,7 +646,7 @@ function Strikeout($$anchor, $$props) {
536
646
  top: "50%",
537
647
  width: "100%",
538
648
  height: `${$.get(thickness) ?? ""}px`,
539
- background: color(),
649
+ background: $.get(resolvedColor),
540
650
  opacity: opacity(),
541
651
  transform: "translateY(-50%)",
542
652
  "pointer-events": "none"
@@ -546,21 +656,22 @@ function Strikeout($$anchor, $$props) {
546
656
  $.append($$anchor, fragment);
547
657
  $.pop();
548
658
  }
549
- var root_1$6 = $.from_html(`<div><div></div></div>`);
659
+ var root_1$8 = $.from_html(`<div><div></div></div>`);
550
660
  function Squiggly($$anchor, $$props) {
551
661
  $.push($$props, true);
552
- let color = $.prop($$props, "color", 3, "#FFFF00"), opacity = $.prop($$props, "opacity", 3, 0.5);
662
+ let opacity = $.prop($$props, "opacity", 3, 0.5);
663
+ const resolvedColor = $.derived(() => $$props.strokeColor ?? "#FFFF00");
553
664
  const amplitude = $.derived(() => 2 * $$props.scale);
554
665
  const period = $.derived(() => 6 * $$props.scale);
555
666
  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}">
556
667
  <path d="M0 ${$.get(amplitude)} Q ${$.get(period) / 4} 0 ${$.get(period) / 2} ${$.get(amplitude)} T ${$.get(period)} ${$.get(amplitude)}"
557
- fill="none" stroke="${color()}" stroke-width="${$.get(amplitude)}" stroke-linecap="round"/>
668
+ fill="none" stroke="${$.get(resolvedColor)}" stroke-width="${$.get(amplitude)}" stroke-linecap="round"/>
558
669
  </svg>`);
559
670
  const svgDataUri = $.derived(() => `url("data:image/svg+xml;utf8,${encodeURIComponent($.get(svg))}")`);
560
671
  var fragment = $.comment();
561
672
  var node = $.first_child(fragment);
562
673
  $.each(node, 17, () => $$props.segmentRects, $.index, ($$anchor2, r) => {
563
- var div = root_1$6();
674
+ var div = root_1$8();
564
675
  $.attribute_effect(
565
676
  div,
566
677
  ($0) => ({
@@ -605,11 +716,12 @@ function Squiggly($$anchor, $$props) {
605
716
  $.append($$anchor, fragment);
606
717
  $.pop();
607
718
  }
608
- var root_1$5 = $.from_svg(`<path fill="none"></path>`);
609
- var root$9 = $.from_svg(`<svg></svg>`);
719
+ var root_1$7 = $.from_svg(`<path fill="none"></path>`);
720
+ var root$b = $.from_svg(`<svg></svg>`);
610
721
  function Ink($$anchor, $$props) {
611
722
  $.push($$props, true);
612
- let color = $.prop($$props, "color", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1);
723
+ let opacity = $.prop($$props, "opacity", 3, 1);
724
+ const resolvedColor = $.derived(() => $$props.strokeColor ?? "#000000");
613
725
  const paths = $.derived(() => $$props.inkList.map(({ points }) => {
614
726
  let d = "";
615
727
  for (let i = 0; i < points.length; i++) {
@@ -622,10 +734,10 @@ function Ink($$anchor, $$props) {
622
734
  }));
623
735
  const width = $.derived(() => $$props.rect.size.width * $$props.scale);
624
736
  const height = $.derived(() => $$props.rect.size.height * $$props.scale);
625
- var svg = root$9();
737
+ var svg = root$b();
626
738
  let styles;
627
739
  $.each(svg, 21, () => $.get(paths), $.index, ($$anchor2, d) => {
628
- var path = root_1$5();
740
+ var path = root_1$7();
629
741
  path.__pointerdown = function(...$$args) {
630
742
  var _a;
631
743
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -641,7 +753,7 @@ function Ink($$anchor, $$props) {
641
753
  styles_1 = $.set_style(path, "", styles_1, {
642
754
  cursor: $$props.isSelected ? "move" : "pointer",
643
755
  "pointer-events": $$props.isSelected ? "none" : "visibleStroke",
644
- stroke: color(),
756
+ stroke: $.get(resolvedColor),
645
757
  "stroke-width": $$props.strokeWidth,
646
758
  "stroke-linecap": "round",
647
759
  "stroke-linejoin": "round"
@@ -660,7 +772,7 @@ function Ink($$anchor, $$props) {
660
772
  $.pop();
661
773
  }
662
774
  $.delegate(["pointerdown", "touchstart"]);
663
- var root$8 = $.from_svg(`<svg><rect></rect></svg>`);
775
+ var root$a = $.from_svg(`<svg><rect></rect></svg>`);
664
776
  function Square($$anchor, $$props) {
665
777
  $.push($$props, true);
666
778
  let color = $.prop($$props, "color", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1), strokeStyle = $.prop($$props, "strokeStyle", 19, () => PdfAnnotationBorderStyle.SOLID);
@@ -682,7 +794,7 @@ function Square($$anchor, $$props) {
682
794
  var _a;
683
795
  return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
684
796
  });
685
- var svg = root$8();
797
+ var svg = root$a();
686
798
  let styles;
687
799
  var rect_1 = $.child(svg);
688
800
  rect_1.__pointerdown = function(...$$args) {
@@ -721,7 +833,7 @@ function Square($$anchor, $$props) {
721
833
  $.pop();
722
834
  }
723
835
  $.delegate(["pointerdown", "touchstart"]);
724
- var root$7 = $.from_svg(`<svg><ellipse></ellipse></svg>`);
836
+ var root$9 = $.from_svg(`<svg><ellipse></ellipse></svg>`);
725
837
  function Circle($$anchor, $$props) {
726
838
  $.push($$props, true);
727
839
  let color = $.prop($$props, "color", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1), strokeStyle = $.prop($$props, "strokeStyle", 19, () => PdfAnnotationBorderStyle.SOLID);
@@ -743,7 +855,7 @@ function Circle($$anchor, $$props) {
743
855
  let svgWidth = $.derived(() => $.get(width) * $$props.scale);
744
856
  let svgHeight = $.derived(() => $.get(height) * $$props.scale);
745
857
  let peValue = $.derived(() => $$props.isSelected ? "none" : color() === "transparent" ? "visibleStroke" : "visible");
746
- var svg = root$7();
858
+ var svg = root$9();
747
859
  let styles;
748
860
  var ellipse = $.child(svg);
749
861
  ellipse.__pointerdown = (e) => {
@@ -791,9 +903,9 @@ function Circle($$anchor, $$props) {
791
903
  $.pop();
792
904
  }
793
905
  $.delegate(["pointerdown", "touchstart"]);
794
- var root_1$4 = $.from_svg(`<path></path>`);
795
- var root_2$3 = $.from_svg(`<path></path>`);
796
- var root$6 = $.from_svg(`<svg><line></line><!><!></svg>`);
906
+ var root_1$6 = $.from_svg(`<path></path>`);
907
+ var root_2$4 = $.from_svg(`<path></path>`);
908
+ var root$8 = $.from_svg(`<svg><line></line><!><!></svg>`);
797
909
  function Line($$anchor, $$props) {
798
910
  $.push($$props, true);
799
911
  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);
@@ -815,7 +927,7 @@ function Line($$anchor, $$props) {
815
927
  var _a;
816
928
  return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
817
929
  });
818
- var svg = root$6();
930
+ var svg = root$8();
819
931
  let styles;
820
932
  var line = $.child(svg);
821
933
  line.__pointerdown = function(...$$args) {
@@ -830,7 +942,7 @@ function Line($$anchor, $$props) {
830
942
  var node = $.sibling(line);
831
943
  {
832
944
  var consequent = ($$anchor2) => {
833
- var path = root_1$4();
945
+ var path = root_1$6();
834
946
  path.__pointerdown = function(...$$args) {
835
947
  var _a;
836
948
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -862,7 +974,7 @@ function Line($$anchor, $$props) {
862
974
  var node_1 = $.sibling(node);
863
975
  {
864
976
  var consequent_1 = ($$anchor2) => {
865
- var path_1 = root_2$3();
977
+ var path_1 = root_2$4();
866
978
  path_1.__pointerdown = function(...$$args) {
867
979
  var _a;
868
980
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -915,9 +1027,9 @@ function Line($$anchor, $$props) {
915
1027
  $.pop();
916
1028
  }
917
1029
  $.delegate(["pointerdown", "touchstart"]);
918
- var root_1$3 = $.from_svg(`<path></path>`);
919
- var root_2$2 = $.from_svg(`<path></path>`);
920
- var root$5 = $.from_svg(`<svg><path></path><!><!></svg>`);
1030
+ var root_1$5 = $.from_svg(`<path></path>`);
1031
+ var root_2$3 = $.from_svg(`<path></path>`);
1032
+ var root$7 = $.from_svg(`<svg><path></path><!><!></svg>`);
921
1033
  function Polyline($$anchor, $$props) {
922
1034
  $.push($$props, true);
923
1035
  let color = $.prop($$props, "color", 3, "transparent"), strokeColor = $.prop($$props, "strokeColor", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1);
@@ -959,7 +1071,7 @@ function Polyline($$anchor, $$props) {
959
1071
  });
960
1072
  const width = $.derived(() => $$props.rect.size.width * $$props.scale);
961
1073
  const height = $.derived(() => $$props.rect.size.height * $$props.scale);
962
- var svg = root$5();
1074
+ var svg = root$7();
963
1075
  let styles;
964
1076
  var path = $.child(svg);
965
1077
  path.__pointerdown = function(...$$args) {
@@ -974,7 +1086,7 @@ function Polyline($$anchor, $$props) {
974
1086
  var node = $.sibling(path);
975
1087
  {
976
1088
  var consequent = ($$anchor2) => {
977
- var path_1 = root_1$3();
1089
+ var path_1 = root_1$5();
978
1090
  path_1.__pointerdown = function(...$$args) {
979
1091
  var _a;
980
1092
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -1005,7 +1117,7 @@ function Polyline($$anchor, $$props) {
1005
1117
  var node_1 = $.sibling(node);
1006
1118
  {
1007
1119
  var consequent_1 = ($$anchor2) => {
1008
- var path_2 = root_2$2();
1120
+ var path_2 = root_2$3();
1009
1121
  path_2.__pointerdown = function(...$$args) {
1010
1122
  var _a;
1011
1123
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -1055,9 +1167,9 @@ function Polyline($$anchor, $$props) {
1055
1167
  $.pop();
1056
1168
  }
1057
1169
  $.delegate(["pointerdown", "touchstart"]);
1058
- var root_1$2 = $.from_svg(`<path fill="none"></path>`);
1059
- var root_2$1 = $.from_svg(`<rect></rect>`);
1060
- var root$4 = $.from_svg(`<svg><path></path><!><!></svg>`);
1170
+ var root_1$4 = $.from_svg(`<path fill="none"></path>`);
1171
+ var root_2$2 = $.from_svg(`<rect></rect>`);
1172
+ var root$6 = $.from_svg(`<svg><path></path><!><!></svg>`);
1061
1173
  function Polygon($$anchor, $$props) {
1062
1174
  $.push($$props, true);
1063
1175
  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);
@@ -1076,7 +1188,7 @@ function Polygon($$anchor, $$props) {
1076
1188
  var _a;
1077
1189
  return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
1078
1190
  });
1079
- var svg = root$4();
1191
+ var svg = root$6();
1080
1192
  let styles;
1081
1193
  var path = $.child(svg);
1082
1194
  path.__pointerdown = function(...$$args) {
@@ -1091,7 +1203,7 @@ function Polygon($$anchor, $$props) {
1091
1203
  var node = $.sibling(path);
1092
1204
  {
1093
1205
  var consequent = ($$anchor2) => {
1094
- var path_1 = root_1$2();
1206
+ var path_1 = root_1$4();
1095
1207
  let styles_2;
1096
1208
  $.template_effect(() => {
1097
1209
  $.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}`);
@@ -1111,7 +1223,7 @@ function Polygon($$anchor, $$props) {
1111
1223
  var node_1 = $.sibling(node);
1112
1224
  {
1113
1225
  var consequent_1 = ($$anchor2) => {
1114
- var rect_1 = root_2$1();
1226
+ var rect_1 = root_2$2();
1115
1227
  $.set_attribute(rect_1, "opacity", 0.4);
1116
1228
  $.template_effect(() => {
1117
1229
  $.set_attribute(rect_1, "x", $.get(localPts)[0].x - handleSize() / $$props.scale / 2);
@@ -1151,7 +1263,7 @@ function Polygon($$anchor, $$props) {
1151
1263
  $.pop();
1152
1264
  }
1153
1265
  $.delegate(["pointerdown", "touchstart"]);
1154
- var root$3 = $.from_html(`<div><span tabindex="0"> </span></div>`);
1266
+ var root$5 = $.from_html(`<div><span tabindex="0"> </span></div>`);
1155
1267
  function FreeText($$anchor, $$props) {
1156
1268
  $.push($$props, true);
1157
1269
  const annotationCapability = useAnnotationCapability();
@@ -1192,7 +1304,7 @@ function FreeText($$anchor, $$props) {
1192
1304
  const outerW = $.derived(() => $$props.annotation.object.rect.size.width * $$props.scale);
1193
1305
  const outerH = $.derived(() => $$props.annotation.object.rect.size.height * $$props.scale);
1194
1306
  const justify = $.derived(() => $$props.annotation.object.verticalAlign === PdfVerticalAlignment.Top ? "flex-start" : $$props.annotation.object.verticalAlign === PdfVerticalAlignment.Middle ? "center" : "flex-end");
1195
- var div = root$3();
1307
+ var div = root$5();
1196
1308
  div.__pointerdown = function(...$$args) {
1197
1309
  var _a;
1198
1310
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -1231,7 +1343,7 @@ function FreeText($$anchor, $$props) {
1231
1343
  "font-size": `${$.get(adjustedFontPx)}px`,
1232
1344
  "font-family": standardFontCss($$props.annotation.object.fontFamily),
1233
1345
  "text-align": textAlignmentToCss($$props.annotation.object.textAlign),
1234
- "background-color": $$props.annotation.object.backgroundColor,
1346
+ "background-color": $$props.annotation.object.color ?? $$props.annotation.object.backgroundColor,
1235
1347
  opacity: $$props.annotation.object.opacity,
1236
1348
  width: $.get(needsComp) ? `${$.get(invScalePercent)}%` : "100%",
1237
1349
  height: $.get(needsComp) ? `${$.get(invScalePercent)}%` : "100%",
@@ -1249,7 +1361,7 @@ function FreeText($$anchor, $$props) {
1249
1361
  $.pop();
1250
1362
  }
1251
1363
  $.delegate(["pointerdown", "touchstart"]);
1252
- var root_1$1 = $.from_html(`<img/>`);
1364
+ var root_1$3 = $.from_html(`<img/>`);
1253
1365
  function RenderAnnotation($$anchor, $$props) {
1254
1366
  $.push($$props, true);
1255
1367
  let scaleFactor = $.prop($$props, "scaleFactor", 3, 1), restProps = $.rest_props($$props, [
@@ -1307,7 +1419,7 @@ function RenderAnnotation($$anchor, $$props) {
1307
1419
  var node = $.first_child(fragment);
1308
1420
  {
1309
1421
  var consequent = ($$anchor2) => {
1310
- var img = root_1$1();
1422
+ var img = root_1$3();
1311
1423
  $.attribute_effect(img, () => ({
1312
1424
  alt: "",
1313
1425
  src: $.get(imageUrl),
@@ -1326,14 +1438,14 @@ function RenderAnnotation($$anchor, $$props) {
1326
1438
  $.append($$anchor, fragment);
1327
1439
  $.pop();
1328
1440
  }
1329
- var root$2 = $.from_html(`<div><!></div>`);
1441
+ var root$4 = $.from_html(`<div><!></div>`);
1330
1442
  function Stamp($$anchor, $$props) {
1331
1443
  $.push($$props, true);
1332
1444
  let annotationProp = $.derived(() => ({
1333
1445
  ...$$props.annotation.object,
1334
1446
  id: $$props.annotation.object.id
1335
1447
  }));
1336
- var div = root$2();
1448
+ var div = root$4();
1337
1449
  let styles;
1338
1450
  div.__pointerdown = function(...$$args) {
1339
1451
  var _a;
@@ -1367,24 +1479,418 @@ function Stamp($$anchor, $$props) {
1367
1479
  $.pop();
1368
1480
  }
1369
1481
  $.delegate(["pointerdown", "touchstart"]);
1482
+ var root_1$2 = $.from_svg(`<line></line>`);
1483
+ var root_2$1 = $.from_svg(`<rect fill="transparent"></rect>`);
1484
+ var root$3 = $.from_svg(`<svg><rect fill="transparent"></rect><!></svg>`);
1485
+ function Link($$anchor, $$props) {
1486
+ $.push($$props, true);
1487
+ 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);
1488
+ const width = $.derived(() => $$props.rect.size.width);
1489
+ const height = $.derived(() => $$props.rect.size.height);
1490
+ const svgWidth = $.derived(() => $.get(width) * $$props.scale);
1491
+ const svgHeight = $.derived(() => $.get(height) * $$props.scale);
1492
+ const dashArray = $.derived(() => {
1493
+ var _a;
1494
+ if (strokeStyle() === PdfAnnotationBorderStyle.DASHED) {
1495
+ return ((_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",")) ?? `${strokeWidth() * 3},${strokeWidth()}`;
1496
+ }
1497
+ return void 0;
1498
+ });
1499
+ const isUnderline2 = $.derived(() => strokeStyle() === PdfAnnotationBorderStyle.UNDERLINE);
1500
+ const hitAreaCursor = $.derived(() => hasIRT() ? "default" : $$props.isSelected ? "move" : "pointer");
1501
+ const hitAreaPointerEvents = $.derived(() => hasIRT() ? "none" : $$props.isSelected ? "none" : "visible");
1502
+ var svg = root$3();
1503
+ let styles;
1504
+ var rect_1 = $.child(svg);
1505
+ $.set_attribute(rect_1, "x", 0);
1506
+ $.set_attribute(rect_1, "y", 0);
1507
+ rect_1.__pointerdown = function(...$$args) {
1508
+ var _a;
1509
+ (_a = hasIRT() ? void 0 : $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1510
+ };
1511
+ rect_1.__touchstart = function(...$$args) {
1512
+ var _a;
1513
+ (_a = hasIRT() ? void 0 : $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1514
+ };
1515
+ let styles_1;
1516
+ var node = $.sibling(rect_1);
1517
+ {
1518
+ var consequent = ($$anchor2) => {
1519
+ var line = root_1$2();
1520
+ $.set_attribute(line, "x1", 1);
1521
+ $.set_style(line, "", {}, { "pointer-events": "none" });
1522
+ $.template_effect(() => {
1523
+ $.set_attribute(line, "y1", $.get(height) - 1);
1524
+ $.set_attribute(line, "x2", $.get(width) - 1);
1525
+ $.set_attribute(line, "y2", $.get(height) - 1);
1526
+ $.set_attribute(line, "stroke", strokeColor());
1527
+ $.set_attribute(line, "stroke-width", strokeWidth());
1528
+ $.set_attribute(line, "stroke-dasharray", $.get(dashArray));
1529
+ });
1530
+ $.append($$anchor2, line);
1531
+ };
1532
+ var alternate = ($$anchor2) => {
1533
+ var rect_2 = root_2$1();
1534
+ $.set_style(rect_2, "", {}, { "pointer-events": "none" });
1535
+ $.template_effect(
1536
+ ($0, $1) => {
1537
+ $.set_attribute(rect_2, "x", strokeWidth() / 2);
1538
+ $.set_attribute(rect_2, "y", strokeWidth() / 2);
1539
+ $.set_attribute(rect_2, "width", $0);
1540
+ $.set_attribute(rect_2, "height", $1);
1541
+ $.set_attribute(rect_2, "stroke", strokeColor());
1542
+ $.set_attribute(rect_2, "stroke-width", strokeWidth());
1543
+ $.set_attribute(rect_2, "stroke-dasharray", $.get(dashArray));
1544
+ },
1545
+ [
1546
+ () => Math.max($.get(width) - strokeWidth(), 0),
1547
+ () => Math.max($.get(height) - strokeWidth(), 0)
1548
+ ]
1549
+ );
1550
+ $.append($$anchor2, rect_2);
1551
+ };
1552
+ $.if(node, ($$render) => {
1553
+ if ($.get(isUnderline2)) $$render(consequent);
1554
+ else $$render(alternate, false);
1555
+ });
1556
+ }
1557
+ $.reset(svg);
1558
+ $.template_effect(() => {
1559
+ styles = $.set_style(svg, "position: absolute; z-index: 2; pointer-events: none;", styles, {
1560
+ width: `${$.get(svgWidth) ?? ""}px`,
1561
+ height: `${$.get(svgHeight) ?? ""}px`
1562
+ });
1563
+ $.set_attribute(svg, "width", $.get(svgWidth));
1564
+ $.set_attribute(svg, "height", $.get(svgHeight));
1565
+ $.set_attribute(svg, "viewBox", `0 0 ${$.get(width) ?? ""} ${$.get(height) ?? ""}`);
1566
+ $.set_attribute(rect_1, "width", $.get(width));
1567
+ $.set_attribute(rect_1, "height", $.get(height));
1568
+ styles_1 = $.set_style(rect_1, "", styles_1, {
1569
+ cursor: $.get(hitAreaCursor),
1570
+ "pointer-events": $.get(hitAreaPointerEvents)
1571
+ });
1572
+ });
1573
+ $.append($$anchor, svg);
1574
+ $.pop();
1575
+ }
1576
+ $.delegate(["pointerdown", "touchstart"]);
1577
+ var root_5$1 = $.from_html(`<div></div>`);
1578
+ var root_1$1 = $.from_html(`<div data-group-selection-box="" data-no-interaction=""><div><!></div> <!></div>`);
1579
+ function GroupSelectionBox($$anchor, $$props) {
1580
+ $.push($$props, true);
1581
+ let selectionOutlineColor = $.prop($$props, "selectionOutlineColor", 3, "#007ACC"), outlineOffset = $.prop($$props, "outlineOffset", 3, 2), zIndex = $.prop($$props, "zIndex", 3, 100);
1582
+ const annotationPlugin = useAnnotationPlugin();
1583
+ const permissions = useDocumentPermissions(() => $$props.documentId);
1584
+ let gestureBase = $.state(null);
1585
+ let isDraggingRef = $.state(false);
1586
+ let isResizingRef = $.state(false);
1587
+ const effectiveIsDraggable = $.derived(() => permissions.canModifyAnnotations && $$props.isDraggable);
1588
+ const effectiveIsResizable = $.derived(() => permissions.canModifyAnnotations && $$props.isResizable);
1589
+ function getGroupBox() {
1590
+ const rects = $$props.selectedAnnotations.map((ta) => ta.object.rect);
1591
+ return boundingRectOrEmpty(rects);
1592
+ }
1593
+ const groupBox = $.derived(getGroupBox);
1594
+ let previewGroupBox = $.state($.proxy(getGroupBox()));
1595
+ $.user_effect(() => {
1596
+ if (!$.get(isDraggingRef) && !$.get(isResizingRef)) {
1597
+ const newBox = $.get(groupBox);
1598
+ 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) {
1599
+ $.set(previewGroupBox, newBox, true);
1600
+ }
1601
+ }
1602
+ });
1603
+ const HANDLE_COLOR = $.derived(() => {
1604
+ var _a;
1605
+ return ((_a = $$props.resizeUI) == null ? void 0 : _a.color) ?? "#007ACC";
1606
+ });
1607
+ const HANDLE_SIZE = $.derived(() => {
1608
+ var _a;
1609
+ return ((_a = $$props.resizeUI) == null ? void 0 : _a.size) ?? 12;
1610
+ });
1611
+ const interactionHandles = useInteractionHandles(() => ({
1612
+ controller: {
1613
+ element: $.get(previewGroupBox),
1614
+ constraints: {
1615
+ minWidth: 20,
1616
+ minHeight: 20,
1617
+ boundingBox: { width: $$props.pageWidth, height: $$props.pageHeight }
1618
+ },
1619
+ maintainAspectRatio: false,
1620
+ pageRotation: $$props.rotation,
1621
+ scale: $$props.scale,
1622
+ enabled: true,
1623
+ onUpdate: (event) => {
1624
+ var _a, _b;
1625
+ if (!((_a = event.transformData) == null ? void 0 : _a.type)) return;
1626
+ if (!annotationPlugin.plugin) return;
1627
+ const plugin = annotationPlugin.plugin;
1628
+ const transformType = event.transformData.type;
1629
+ const isMove = transformType === "move";
1630
+ const isResize = transformType === "resize";
1631
+ if (isMove && !$.get(effectiveIsDraggable)) return;
1632
+ if (event.state === "start") {
1633
+ $.set(gestureBase, getGroupBox(), true);
1634
+ if (isMove) {
1635
+ $.set(isDraggingRef, true);
1636
+ plugin.startDrag($$props.documentId, {
1637
+ annotationIds: $$props.selectedAnnotations.map((ta) => ta.object.id),
1638
+ pageSize: { width: $$props.pageWidth, height: $$props.pageHeight }
1639
+ });
1640
+ } else if (isResize) {
1641
+ $.set(isResizingRef, true);
1642
+ plugin.startResize($$props.documentId, {
1643
+ annotationIds: $$props.selectedAnnotations.map((ta) => ta.object.id),
1644
+ pageSize: { width: $$props.pageWidth, height: $$props.pageHeight },
1645
+ resizeHandle: ((_b = event.transformData.metadata) == null ? void 0 : _b.handle) ?? "se"
1646
+ });
1647
+ }
1648
+ }
1649
+ const base = $.get(gestureBase) ?? getGroupBox();
1650
+ if (isMove && event.transformData.changes.rect) {
1651
+ const newRect = event.transformData.changes.rect;
1652
+ const rawDelta = {
1653
+ x: newRect.origin.x - base.origin.x,
1654
+ y: newRect.origin.y - base.origin.y
1655
+ };
1656
+ const clampedDelta = plugin.updateDrag($$props.documentId, rawDelta);
1657
+ $.set(
1658
+ previewGroupBox,
1659
+ {
1660
+ ...base,
1661
+ origin: {
1662
+ x: base.origin.x + clampedDelta.x,
1663
+ y: base.origin.y + clampedDelta.y
1664
+ }
1665
+ },
1666
+ true
1667
+ );
1668
+ } else if (isResize && event.transformData.changes.rect) {
1669
+ const newGroupBox = event.transformData.changes.rect;
1670
+ plugin.updateResize($$props.documentId, newGroupBox);
1671
+ $.set(previewGroupBox, newGroupBox, true);
1672
+ }
1673
+ if (event.state === "end") {
1674
+ $.set(gestureBase, null);
1675
+ if (isMove && $.get(isDraggingRef)) {
1676
+ $.set(isDraggingRef, false);
1677
+ plugin.commitDrag($$props.documentId);
1678
+ } else if (isResize && $.get(isResizingRef)) {
1679
+ $.set(isResizingRef, false);
1680
+ plugin.commitResize($$props.documentId);
1681
+ }
1682
+ }
1683
+ }
1684
+ },
1685
+ resizeUI: {
1686
+ handleSize: $.get(HANDLE_SIZE),
1687
+ spacing: outlineOffset(),
1688
+ offsetMode: "outside",
1689
+ includeSides: true,
1690
+ zIndex: zIndex() + 1
1691
+ },
1692
+ vertexUI: { vertexSize: 0, zIndex: zIndex() },
1693
+ includeVertices: false
1694
+ }));
1695
+ const resizeHandles = $.derived(() => interactionHandles.resize);
1696
+ const shouldShowMenu = $.derived(() => !!$$props.groupSelectionMenu || !!$$props.groupSelectionMenuSnippet);
1697
+ function buildContext() {
1698
+ return {
1699
+ type: "group",
1700
+ annotations: $$props.selectedAnnotations,
1701
+ pageIndex: $$props.pageIndex
1702
+ };
1703
+ }
1704
+ function buildMenuProps(rect, menuWrapperProps) {
1705
+ return {
1706
+ context: buildContext(),
1707
+ selected: true,
1708
+ rect,
1709
+ placement: { suggestTop: false },
1710
+ menuWrapperProps
1711
+ };
1712
+ }
1713
+ var fragment = $.comment();
1714
+ var node = $.first_child(fragment);
1715
+ {
1716
+ var consequent_6 = ($$anchor2) => {
1717
+ var div = root_1$1();
1718
+ var div_1 = $.child(div);
1719
+ $.attribute_effect(div_1, () => ({
1720
+ ...$.get(effectiveIsDraggable) ? interactionHandles.dragProps : { onpointerdown: (e) => e.stopPropagation() },
1721
+ [$.STYLE]: {
1722
+ position: "absolute",
1723
+ left: `${$.get(previewGroupBox).origin.x * $$props.scale}px`,
1724
+ top: `${$.get(previewGroupBox).origin.y * $$props.scale}px`,
1725
+ width: `${$.get(previewGroupBox).size.width * $$props.scale}px`,
1726
+ height: `${$.get(previewGroupBox).size.height * $$props.scale}px`,
1727
+ outline: `2px dashed ${selectionOutlineColor() ?? ""}`,
1728
+ "outline-offset": `${outlineOffset() - 1}px`,
1729
+ cursor: $.get(effectiveIsDraggable) ? "move" : "default",
1730
+ "touch-action": "none",
1731
+ "z-index": zIndex()
1732
+ }
1733
+ }));
1734
+ var node_1 = $.child(div_1);
1735
+ {
1736
+ var consequent_1 = ($$anchor3) => {
1737
+ var fragment_1 = $.comment();
1738
+ var node_2 = $.first_child(fragment_1);
1739
+ $.each(node_2, 17, () => $.get(resizeHandles), ({ key, style: handleStyle, ...hProps }) => key, ($$anchor4, $$item) => {
1740
+ let handleStyle = () => $.get($$item).style;
1741
+ let hProps = () => $.exclude_from_object($.get($$item), ["key", "style"]);
1742
+ var fragment_2 = $.comment();
1743
+ var node_3 = $.first_child(fragment_2);
1744
+ {
1745
+ var consequent = ($$anchor5) => {
1746
+ var fragment_3 = $.comment();
1747
+ var node_4 = $.first_child(fragment_3);
1748
+ {
1749
+ let $0 = $.derived(() => ({ ...hProps(), backgroundColor: $.get(HANDLE_COLOR) }));
1750
+ $.snippet(node_4, () => $$props.resizeUI.component, () => $.get($0));
1751
+ }
1752
+ $.append($$anchor5, fragment_3);
1753
+ };
1754
+ var alternate = ($$anchor5) => {
1755
+ var div_2 = root_5$1();
1756
+ $.attribute_effect(div_2, () => ({
1757
+ ...hProps(),
1758
+ style: `${handleStyle() ?? ""}; background-color: ${$.get(HANDLE_COLOR) ?? ""};`
1759
+ }));
1760
+ $.append($$anchor5, div_2);
1761
+ };
1762
+ $.if(node_3, ($$render) => {
1763
+ var _a;
1764
+ if ((_a = $$props.resizeUI) == null ? void 0 : _a.component) $$render(consequent);
1765
+ else $$render(alternate, false);
1766
+ });
1767
+ }
1768
+ $.append($$anchor4, fragment_2);
1769
+ });
1770
+ $.append($$anchor3, fragment_1);
1771
+ };
1772
+ $.if(node_1, ($$render) => {
1773
+ if ($.get(effectiveIsResizable)) $$render(consequent_1);
1774
+ });
1775
+ }
1776
+ $.reset(div_1);
1777
+ var node_5 = $.sibling(div_1, 2);
1778
+ {
1779
+ var consequent_5 = ($$anchor3) => {
1780
+ {
1781
+ const children = ($$anchor4, $$arg0) => {
1782
+ let rect = () => $$arg0 == null ? void 0 : $$arg0().rect;
1783
+ let menuWrapperProps = () => $$arg0 == null ? void 0 : $$arg0().menuWrapperProps;
1784
+ const menuProps = $.derived(() => buildMenuProps(rect(), menuWrapperProps()));
1785
+ var fragment_5 = $.comment();
1786
+ var node_6 = $.first_child(fragment_5);
1787
+ {
1788
+ var consequent_3 = ($$anchor5) => {
1789
+ const result = $.derived(() => $$props.groupSelectionMenu($.get(menuProps)));
1790
+ var fragment_6 = $.comment();
1791
+ var node_7 = $.first_child(fragment_6);
1792
+ {
1793
+ var consequent_2 = ($$anchor6) => {
1794
+ var fragment_7 = $.comment();
1795
+ var node_8 = $.first_child(fragment_7);
1796
+ $.component(node_8, () => $.get(result).component, ($$anchor7, result_component) => {
1797
+ result_component($$anchor7, $.spread_props(() => $.get(result).props));
1798
+ });
1799
+ $.append($$anchor6, fragment_7);
1800
+ };
1801
+ $.if(node_7, ($$render) => {
1802
+ if ($.get(result)) $$render(consequent_2);
1803
+ });
1804
+ }
1805
+ $.append($$anchor5, fragment_6);
1806
+ };
1807
+ var alternate_1 = ($$anchor5) => {
1808
+ var fragment_8 = $.comment();
1809
+ var node_9 = $.first_child(fragment_8);
1810
+ {
1811
+ var consequent_4 = ($$anchor6) => {
1812
+ var fragment_9 = $.comment();
1813
+ var node_10 = $.first_child(fragment_9);
1814
+ $.snippet(node_10, () => $$props.groupSelectionMenuSnippet, () => $.get(menuProps));
1815
+ $.append($$anchor6, fragment_9);
1816
+ };
1817
+ $.if(
1818
+ node_9,
1819
+ ($$render) => {
1820
+ if ($$props.groupSelectionMenuSnippet) $$render(consequent_4);
1821
+ },
1822
+ true
1823
+ );
1824
+ }
1825
+ $.append($$anchor5, fragment_8);
1826
+ };
1827
+ $.if(node_6, ($$render) => {
1828
+ if ($$props.groupSelectionMenu) $$render(consequent_3);
1829
+ else $$render(alternate_1, false);
1830
+ });
1831
+ }
1832
+ $.append($$anchor4, fragment_5);
1833
+ };
1834
+ let $0 = $.derived(() => ({
1835
+ origin: {
1836
+ x: $.get(previewGroupBox).origin.x * $$props.scale,
1837
+ y: $.get(previewGroupBox).origin.y * $$props.scale
1838
+ },
1839
+ size: {
1840
+ width: $.get(previewGroupBox).size.width * $$props.scale,
1841
+ height: $.get(previewGroupBox).size.height * $$props.scale
1842
+ }
1843
+ }));
1844
+ CounterRotate($$anchor3, {
1845
+ get rect() {
1846
+ return $.get($0);
1847
+ },
1848
+ get rotation() {
1849
+ return $$props.rotation;
1850
+ },
1851
+ children,
1852
+ $$slots: { default: true }
1853
+ });
1854
+ }
1855
+ };
1856
+ $.if(node_5, ($$render) => {
1857
+ if ($.get(shouldShowMenu)) $$render(consequent_5);
1858
+ });
1859
+ }
1860
+ $.reset(div);
1861
+ $.append($$anchor2, div);
1862
+ };
1863
+ $.if(node, ($$render) => {
1864
+ if ($$props.selectedAnnotations.length >= 2) $$render(consequent_6);
1865
+ });
1866
+ }
1867
+ $.append($$anchor, fragment);
1868
+ $.pop();
1869
+ }
1870
+ var root$2 = $.from_html(`<!> <!>`, 1);
1370
1871
  function Annotations($$anchor, $$props) {
1371
1872
  $.push($$props, true);
1372
1873
  let annotationsProps = $.rest_props($$props, ["$$slots", "$$events", "$$legacy"]);
1874
+ function findCustomRenderer(annotation) {
1875
+ var _a;
1876
+ return (_a = $$props.annotationRenderers) == null ? void 0 : _a.find((r) => r.matches(annotation.object));
1877
+ }
1373
1878
  const annotationCapability = useAnnotationCapability();
1374
1879
  const selectionCapability = useSelectionCapability();
1375
1880
  const pointerHandlers = usePointerHandlers({ documentId: $$props.documentId, pageIndex: $$props.pageIndex });
1376
1881
  let annotations = $.state($.proxy([]));
1377
- let selectionState = $.state(null);
1882
+ let allSelectedIds = $.state($.proxy([]));
1378
1883
  let editingId = $.state(null);
1379
1884
  const annotationProvides = $.derived(() => annotationCapability.provides ? annotationCapability.provides.forDocument($$props.documentId) : null);
1885
+ const isMultiSelected = $.derived(() => $.get(allSelectedIds).length > 1);
1380
1886
  $.user_effect(() => {
1381
1887
  if (!$.get(annotationProvides)) return;
1382
1888
  const currentState = $.get(annotationProvides).getState();
1383
1889
  $.set(annotations, getAnnotationsByPageIndex(currentState, $$props.pageIndex), true);
1384
- $.set(selectionState, getSelectedAnnotationByPageIndex(currentState, $$props.pageIndex), true);
1890
+ $.set(allSelectedIds, getSelectedAnnotationIds(currentState), true);
1385
1891
  const off = $.get(annotationProvides).onStateChange((state) => {
1386
1892
  $.set(annotations, getAnnotationsByPageIndex(state, $$props.pageIndex), true);
1387
- $.set(selectionState, getSelectedAnnotationByPageIndex(state, $$props.pageIndex), true);
1893
+ $.set(allSelectedIds, getSelectedAnnotationIds(state), true);
1388
1894
  });
1389
1895
  return () => off == null ? void 0 : off();
1390
1896
  });
@@ -1402,76 +1908,135 @@ function Annotations($$anchor, $$props) {
1402
1908
  function handleClick(e, annotation) {
1403
1909
  e.stopPropagation();
1404
1910
  if ($.get(annotationProvides) && selectionCapability.provides) {
1405
- $.get(annotationProvides).selectAnnotation($$props.pageIndex, annotation.object.id);
1406
1911
  selectionCapability.provides.clear();
1912
+ const isModifierPressed = "metaKey" in e ? e.metaKey || e.ctrlKey : false;
1913
+ if (isModifierPressed) {
1914
+ $.get(annotationProvides).toggleSelection($$props.pageIndex, annotation.object.id);
1915
+ } else {
1916
+ $.get(annotationProvides).selectAnnotation($$props.pageIndex, annotation.object.id);
1917
+ }
1407
1918
  if (annotation.object.id !== $.get(editingId)) {
1408
1919
  $.set(editingId, null);
1409
1920
  }
1410
1921
  }
1411
1922
  }
1412
- var fragment = $.comment();
1413
- var node = $.first_child(fragment);
1414
- $.each(node, 17, () => $.get(annotations), (annotation) => annotation.object.id, ($$anchor2, annotation) => {
1415
- const isSelected = $.derived(() => {
1923
+ function handleLinkClick(e, annotation) {
1924
+ e.stopPropagation();
1925
+ if (!$.get(annotationProvides) || !selectionCapability.provides) return;
1926
+ selectionCapability.provides.clear();
1927
+ if (annotation.object.inReplyToId) {
1928
+ const parentId = annotation.object.inReplyToId;
1929
+ const parent = $.get(annotations).find((a) => a.object.id === parentId);
1930
+ if (parent) {
1931
+ $.get(annotationProvides).selectAnnotation(parent.object.pageIndex, parentId);
1932
+ return;
1933
+ }
1934
+ }
1935
+ $.get(annotationProvides).selectAnnotation($$props.pageIndex, annotation.object.id);
1936
+ }
1937
+ const selectedAnnotationsOnPage = $.derived(() => $.get(annotations).filter((anno) => $.get(allSelectedIds).includes(anno.object.id)));
1938
+ const areAllSelectedDraggable = $.derived(() => {
1939
+ if ($.get(selectedAnnotationsOnPage).length < 2) return false;
1940
+ return $.get(selectedAnnotationsOnPage).every((ta) => {
1941
+ var _a;
1942
+ const tool = (_a = $.get(annotationProvides)) == null ? void 0 : _a.findToolForAnnotation(ta.object);
1943
+ const groupDraggable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isGroupDraggable, ta.object, true);
1944
+ const singleDraggable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isDraggable, ta.object, true);
1945
+ return (tool == null ? void 0 : tool.interaction.isGroupDraggable) !== void 0 ? groupDraggable : singleDraggable;
1946
+ });
1947
+ });
1948
+ const areAllSelectedResizable = $.derived(() => {
1949
+ if ($.get(selectedAnnotationsOnPage).length < 2) return false;
1950
+ return $.get(selectedAnnotationsOnPage).every((ta) => {
1416
1951
  var _a;
1417
- return ((_a = $.get(selectionState)) == null ? void 0 : _a.object.id) === $.get(annotation).object.id;
1952
+ const tool = (_a = $.get(annotationProvides)) == null ? void 0 : _a.findToolForAnnotation(ta.object);
1953
+ const groupResizable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isGroupResizable, ta.object, true);
1954
+ const singleResizable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isResizable, ta.object, true);
1955
+ return (tool == null ? void 0 : tool.interaction.isGroupResizable) !== void 0 ? groupResizable : singleResizable;
1418
1956
  });
1957
+ });
1958
+ const allSelectedOnSamePage = $.derived(() => {
1959
+ if (!$.get(annotationProvides)) return false;
1960
+ if ($.get(allSelectedIds).length < 2) return false;
1961
+ const allSelected = $.get(annotationProvides).getSelectedAnnotations();
1962
+ return allSelected.every((ta) => ta.object.pageIndex === $$props.pageIndex);
1963
+ });
1964
+ var fragment = root$2();
1965
+ var node = $.first_child(fragment);
1966
+ $.each(node, 17, () => $.get(annotations), (annotation) => annotation.object.id, ($$anchor2, annotation) => {
1967
+ const isSelected = $.derived(() => $.get(allSelectedIds).includes($.get(annotation).object.id));
1419
1968
  const isEditing = $.derived(() => $.get(editingId) === $.get(annotation).object.id);
1420
1969
  const tool = $.derived(() => {
1421
1970
  var _a;
1422
1971
  return (_a = $.get(annotationProvides)) == null ? void 0 : _a.findToolForAnnotation($.get(annotation).object);
1423
1972
  });
1424
1973
  const mixBlendMode = $.derived(() => blendModeToCss($.get(annotation).object.blendMode ?? PdfBlendMode.Normal));
1974
+ const customRenderer = $.derived(() => findCustomRenderer($.get(annotation)));
1425
1975
  var fragment_1 = $.comment();
1426
1976
  var node_1 = $.first_child(fragment_1);
1427
1977
  {
1428
1978
  var consequent = ($$anchor3) => {
1429
1979
  {
1430
- const children = ($$anchor4, obj = $.noop) => {
1431
- Ink($$anchor4, $.spread_props(obj, {
1432
- get isSelected() {
1433
- return $.get(isSelected);
1434
- },
1435
- get scale() {
1436
- return $$props.scale;
1437
- },
1438
- onClick: (e) => handleClick(e, $.get(annotation))
1439
- }));
1980
+ const children = ($$anchor4, _obj = $.noop) => {
1981
+ const CustomComponent = $.derived(() => $.get(customRenderer).component);
1982
+ var fragment_3 = $.comment();
1983
+ var node_2 = $.first_child(fragment_3);
1984
+ $.component(node_2, () => $.get(CustomComponent), ($$anchor5, CustomComponent_1) => {
1985
+ CustomComponent_1($$anchor5, {
1986
+ get annotation() {
1987
+ return $.get(annotation);
1988
+ },
1989
+ get isSelected() {
1990
+ return $.get(isSelected);
1991
+ },
1992
+ get scale() {
1993
+ return $$props.scale;
1994
+ },
1995
+ get pageIndex() {
1996
+ return $$props.pageIndex;
1997
+ },
1998
+ onClick: (e) => handleClick(e, $.get(annotation))
1999
+ });
2000
+ });
2001
+ $.append($$anchor4, fragment_3);
1440
2002
  };
1441
- let $0 = $.derived(() => {
1442
- var _a;
1443
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
1444
- });
2003
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1445
2004
  let $1 = $.derived(() => {
1446
2005
  var _a;
1447
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true;
2006
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
1448
2007
  });
1449
2008
  let $2 = $.derived(() => {
1450
2009
  var _a;
1451
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2010
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true) && !$.get(isMultiSelected);
1452
2011
  });
2012
+ let $3 = $.derived(() => {
2013
+ var _a;
2014
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
2015
+ });
2016
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2017
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1453
2018
  AnnotationContainer($$anchor3, $.spread_props(
1454
2019
  {
1455
2020
  get trackedAnnotation() {
1456
2021
  return $.get(annotation);
1457
2022
  },
1458
2023
  get isSelected() {
1459
- return $.get(isSelected);
2024
+ return $.get($0);
1460
2025
  },
1461
2026
  get isDraggable() {
1462
- return $.get($0);
2027
+ return $.get($1);
1463
2028
  },
1464
2029
  get isResizable() {
1465
- return $.get($1);
2030
+ return $.get($2);
1466
2031
  },
1467
2032
  get lockAspectRatio() {
1468
- return $.get($2);
2033
+ return $.get($3);
1469
2034
  },
1470
2035
  get selectionMenu() {
1471
- return $$props.selectionMenu;
2036
+ return $.get($4);
1472
2037
  },
1473
2038
  get selectionMenuSnippet() {
1474
- return $$props.selectionMenuSnippet;
2039
+ return $.get($5);
1475
2040
  },
1476
2041
  onSelect: (e) => handleClick(e, $.get(annotation)),
1477
2042
  get style() {
@@ -1483,14 +2048,14 @@ function Annotations($$anchor, $$props) {
1483
2048
  ));
1484
2049
  }
1485
2050
  };
1486
- var alternate_10 = ($$anchor3) => {
2051
+ var alternate_12 = ($$anchor3) => {
1487
2052
  var fragment_4 = $.comment();
1488
- var node_2 = $.first_child(fragment_4);
2053
+ var node_3 = $.first_child(fragment_4);
1489
2054
  {
1490
2055
  var consequent_1 = ($$anchor4) => {
1491
2056
  {
1492
2057
  const children = ($$anchor5, obj = $.noop) => {
1493
- Square($$anchor5, $.spread_props(obj, {
2058
+ Ink($$anchor5, $.spread_props(obj, {
1494
2059
  get isSelected() {
1495
2060
  return $.get(isSelected);
1496
2061
  },
@@ -1500,40 +2065,43 @@ function Annotations($$anchor, $$props) {
1500
2065
  onClick: (e) => handleClick(e, $.get(annotation))
1501
2066
  }));
1502
2067
  };
1503
- let $0 = $.derived(() => {
1504
- var _a;
1505
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
1506
- });
2068
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1507
2069
  let $1 = $.derived(() => {
1508
2070
  var _a;
1509
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true;
2071
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
1510
2072
  });
1511
2073
  let $2 = $.derived(() => {
1512
2074
  var _a;
1513
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2075
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true) && !$.get(isMultiSelected);
1514
2076
  });
2077
+ let $3 = $.derived(() => {
2078
+ var _a;
2079
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
2080
+ });
2081
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2082
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1515
2083
  AnnotationContainer($$anchor4, $.spread_props(
1516
2084
  {
1517
2085
  get trackedAnnotation() {
1518
2086
  return $.get(annotation);
1519
2087
  },
1520
2088
  get isSelected() {
1521
- return $.get(isSelected);
2089
+ return $.get($0);
1522
2090
  },
1523
2091
  get isDraggable() {
1524
- return $.get($0);
2092
+ return $.get($1);
1525
2093
  },
1526
2094
  get isResizable() {
1527
- return $.get($1);
2095
+ return $.get($2);
1528
2096
  },
1529
2097
  get lockAspectRatio() {
1530
- return $.get($2);
2098
+ return $.get($3);
1531
2099
  },
1532
2100
  get selectionMenu() {
1533
- return $$props.selectionMenu;
2101
+ return $.get($4);
1534
2102
  },
1535
2103
  get selectionMenuSnippet() {
1536
- return $$props.selectionMenuSnippet;
2104
+ return $.get($5);
1537
2105
  },
1538
2106
  onSelect: (e) => handleClick(e, $.get(annotation)),
1539
2107
  get style() {
@@ -1545,14 +2113,14 @@ function Annotations($$anchor, $$props) {
1545
2113
  ));
1546
2114
  }
1547
2115
  };
1548
- var alternate_9 = ($$anchor4) => {
2116
+ var alternate_11 = ($$anchor4) => {
1549
2117
  var fragment_7 = $.comment();
1550
- var node_3 = $.first_child(fragment_7);
2118
+ var node_4 = $.first_child(fragment_7);
1551
2119
  {
1552
2120
  var consequent_2 = ($$anchor5) => {
1553
2121
  {
1554
2122
  const children = ($$anchor6, obj = $.noop) => {
1555
- Circle($$anchor6, $.spread_props(obj, {
2123
+ Square($$anchor6, $.spread_props(obj, {
1556
2124
  get isSelected() {
1557
2125
  return $.get(isSelected);
1558
2126
  },
@@ -1562,40 +2130,43 @@ function Annotations($$anchor, $$props) {
1562
2130
  onClick: (e) => handleClick(e, $.get(annotation))
1563
2131
  }));
1564
2132
  };
1565
- let $0 = $.derived(() => {
1566
- var _a;
1567
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
1568
- });
2133
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1569
2134
  let $1 = $.derived(() => {
1570
2135
  var _a;
1571
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true;
2136
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
1572
2137
  });
1573
2138
  let $2 = $.derived(() => {
1574
2139
  var _a;
1575
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2140
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true) && !$.get(isMultiSelected);
1576
2141
  });
2142
+ let $3 = $.derived(() => {
2143
+ var _a;
2144
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
2145
+ });
2146
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2147
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1577
2148
  AnnotationContainer($$anchor5, $.spread_props(
1578
2149
  {
1579
2150
  get trackedAnnotation() {
1580
2151
  return $.get(annotation);
1581
2152
  },
1582
2153
  get isSelected() {
1583
- return $.get(isSelected);
2154
+ return $.get($0);
1584
2155
  },
1585
2156
  get isDraggable() {
1586
- return $.get($0);
2157
+ return $.get($1);
1587
2158
  },
1588
2159
  get isResizable() {
1589
- return $.get($1);
2160
+ return $.get($2);
1590
2161
  },
1591
2162
  get lockAspectRatio() {
1592
- return $.get($2);
2163
+ return $.get($3);
1593
2164
  },
1594
2165
  get selectionMenu() {
1595
- return $$props.selectionMenu;
2166
+ return $.get($4);
1596
2167
  },
1597
2168
  get selectionMenuSnippet() {
1598
- return $$props.selectionMenuSnippet;
2169
+ return $.get($5);
1599
2170
  },
1600
2171
  onSelect: (e) => handleClick(e, $.get(annotation)),
1601
2172
  get style() {
@@ -1607,57 +2178,62 @@ function Annotations($$anchor, $$props) {
1607
2178
  ));
1608
2179
  }
1609
2180
  };
1610
- var alternate_8 = ($$anchor5) => {
2181
+ var alternate_10 = ($$anchor5) => {
1611
2182
  var fragment_10 = $.comment();
1612
- var node_4 = $.first_child(fragment_10);
2183
+ var node_5 = $.first_child(fragment_10);
1613
2184
  {
1614
2185
  var consequent_3 = ($$anchor6) => {
1615
2186
  {
1616
2187
  const children = ($$anchor7, obj = $.noop) => {
1617
- Underline($$anchor7, $.spread_props(obj, {
2188
+ Circle($$anchor7, $.spread_props(obj, {
2189
+ get isSelected() {
2190
+ return $.get(isSelected);
2191
+ },
1618
2192
  get scale() {
1619
2193
  return $$props.scale;
1620
2194
  },
1621
2195
  onClick: (e) => handleClick(e, $.get(annotation))
1622
2196
  }));
1623
2197
  };
1624
- let $0 = $.derived(() => {
1625
- var _a;
1626
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? false;
1627
- });
2198
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1628
2199
  let $1 = $.derived(() => {
1629
2200
  var _a;
1630
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2201
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
1631
2202
  });
1632
2203
  let $2 = $.derived(() => {
1633
2204
  var _a;
1634
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2205
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true) && !$.get(isMultiSelected);
1635
2206
  });
2207
+ let $3 = $.derived(() => {
2208
+ var _a;
2209
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
2210
+ });
2211
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2212
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1636
2213
  AnnotationContainer($$anchor6, $.spread_props(
1637
2214
  {
1638
2215
  get trackedAnnotation() {
1639
2216
  return $.get(annotation);
1640
2217
  },
1641
2218
  get isSelected() {
1642
- return $.get(isSelected);
2219
+ return $.get($0);
1643
2220
  },
1644
2221
  get isDraggable() {
1645
- return $.get($0);
2222
+ return $.get($1);
1646
2223
  },
1647
2224
  get isResizable() {
1648
- return $.get($1);
2225
+ return $.get($2);
1649
2226
  },
1650
2227
  get lockAspectRatio() {
1651
- return $.get($2);
2228
+ return $.get($3);
1652
2229
  },
1653
2230
  get selectionMenu() {
1654
- return $$props.selectionMenu;
2231
+ return $.get($4);
1655
2232
  },
1656
2233
  get selectionMenuSnippet() {
1657
- return $$props.selectionMenuSnippet;
2234
+ return $.get($5);
1658
2235
  },
1659
2236
  onSelect: (e) => handleClick(e, $.get(annotation)),
1660
- zIndex: 0,
1661
2237
  get style() {
1662
2238
  return `mix-blend-mode: ${$.get(mixBlendMode) ?? ""}`;
1663
2239
  }
@@ -1667,54 +2243,57 @@ function Annotations($$anchor, $$props) {
1667
2243
  ));
1668
2244
  }
1669
2245
  };
1670
- var alternate_7 = ($$anchor6) => {
2246
+ var alternate_9 = ($$anchor6) => {
1671
2247
  var fragment_13 = $.comment();
1672
- var node_5 = $.first_child(fragment_13);
2248
+ var node_6 = $.first_child(fragment_13);
1673
2249
  {
1674
2250
  var consequent_4 = ($$anchor7) => {
1675
2251
  {
1676
2252
  const children = ($$anchor8, obj = $.noop) => {
1677
- Strikeout($$anchor8, $.spread_props(obj, {
2253
+ Underline($$anchor8, $.spread_props(obj, {
1678
2254
  get scale() {
1679
2255
  return $$props.scale;
1680
2256
  },
1681
2257
  onClick: (e) => handleClick(e, $.get(annotation))
1682
2258
  }));
1683
2259
  };
1684
- let $0 = $.derived(() => {
1685
- var _a;
1686
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? false;
1687
- });
2260
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1688
2261
  let $1 = $.derived(() => {
1689
2262
  var _a;
1690
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2263
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, false) && !$.get(isMultiSelected);
1691
2264
  });
1692
2265
  let $2 = $.derived(() => {
1693
2266
  var _a;
1694
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2267
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
2268
+ });
2269
+ let $3 = $.derived(() => {
2270
+ var _a;
2271
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
1695
2272
  });
2273
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2274
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1696
2275
  AnnotationContainer($$anchor7, $.spread_props(
1697
2276
  {
1698
2277
  get trackedAnnotation() {
1699
2278
  return $.get(annotation);
1700
2279
  },
1701
2280
  get isSelected() {
1702
- return $.get(isSelected);
2281
+ return $.get($0);
1703
2282
  },
1704
2283
  get isDraggable() {
1705
- return $.get($0);
2284
+ return $.get($1);
1706
2285
  },
1707
2286
  get isResizable() {
1708
- return $.get($1);
2287
+ return $.get($2);
1709
2288
  },
1710
2289
  get lockAspectRatio() {
1711
- return $.get($2);
2290
+ return $.get($3);
1712
2291
  },
1713
2292
  get selectionMenu() {
1714
- return $$props.selectionMenu;
2293
+ return $.get($4);
1715
2294
  },
1716
2295
  get selectionMenuSnippet() {
1717
- return $$props.selectionMenuSnippet;
2296
+ return $.get($5);
1718
2297
  },
1719
2298
  onSelect: (e) => handleClick(e, $.get(annotation)),
1720
2299
  zIndex: 0,
@@ -1727,54 +2306,57 @@ function Annotations($$anchor, $$props) {
1727
2306
  ));
1728
2307
  }
1729
2308
  };
1730
- var alternate_6 = ($$anchor7) => {
2309
+ var alternate_8 = ($$anchor7) => {
1731
2310
  var fragment_16 = $.comment();
1732
- var node_6 = $.first_child(fragment_16);
2311
+ var node_7 = $.first_child(fragment_16);
1733
2312
  {
1734
2313
  var consequent_5 = ($$anchor8) => {
1735
2314
  {
1736
2315
  const children = ($$anchor9, obj = $.noop) => {
1737
- Squiggly($$anchor9, $.spread_props(obj, {
2316
+ Strikeout($$anchor9, $.spread_props(obj, {
1738
2317
  get scale() {
1739
2318
  return $$props.scale;
1740
2319
  },
1741
2320
  onClick: (e) => handleClick(e, $.get(annotation))
1742
2321
  }));
1743
2322
  };
1744
- let $0 = $.derived(() => {
1745
- var _a;
1746
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? false;
1747
- });
2323
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1748
2324
  let $1 = $.derived(() => {
1749
2325
  var _a;
1750
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2326
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, false) && !$.get(isMultiSelected);
1751
2327
  });
1752
2328
  let $2 = $.derived(() => {
1753
2329
  var _a;
1754
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2330
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
1755
2331
  });
2332
+ let $3 = $.derived(() => {
2333
+ var _a;
2334
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
2335
+ });
2336
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2337
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1756
2338
  AnnotationContainer($$anchor8, $.spread_props(
1757
2339
  {
1758
2340
  get trackedAnnotation() {
1759
2341
  return $.get(annotation);
1760
2342
  },
1761
2343
  get isSelected() {
1762
- return $.get(isSelected);
2344
+ return $.get($0);
1763
2345
  },
1764
2346
  get isDraggable() {
1765
- return $.get($0);
2347
+ return $.get($1);
1766
2348
  },
1767
2349
  get isResizable() {
1768
- return $.get($1);
2350
+ return $.get($2);
1769
2351
  },
1770
2352
  get lockAspectRatio() {
1771
- return $.get($2);
2353
+ return $.get($3);
1772
2354
  },
1773
2355
  get selectionMenu() {
1774
- return $$props.selectionMenu;
2356
+ return $.get($4);
1775
2357
  },
1776
2358
  get selectionMenuSnippet() {
1777
- return $$props.selectionMenuSnippet;
2359
+ return $.get($5);
1778
2360
  },
1779
2361
  onSelect: (e) => handleClick(e, $.get(annotation)),
1780
2362
  zIndex: 0,
@@ -1787,60 +2369,62 @@ function Annotations($$anchor, $$props) {
1787
2369
  ));
1788
2370
  }
1789
2371
  };
1790
- var alternate_5 = ($$anchor8) => {
2372
+ var alternate_7 = ($$anchor8) => {
1791
2373
  var fragment_19 = $.comment();
1792
- var node_7 = $.first_child(fragment_19);
2374
+ var node_8 = $.first_child(fragment_19);
1793
2375
  {
1794
2376
  var consequent_6 = ($$anchor9) => {
1795
2377
  {
1796
2378
  const children = ($$anchor10, obj = $.noop) => {
1797
- Highlight($$anchor10, $.spread_props(obj, {
2379
+ Squiggly($$anchor10, $.spread_props(obj, {
1798
2380
  get scale() {
1799
2381
  return $$props.scale;
1800
2382
  },
1801
2383
  onClick: (e) => handleClick(e, $.get(annotation))
1802
2384
  }));
1803
2385
  };
1804
- let $0 = $.derived(() => {
1805
- var _a;
1806
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? false;
1807
- });
2386
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1808
2387
  let $1 = $.derived(() => {
1809
2388
  var _a;
1810
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2389
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, false) && !$.get(isMultiSelected);
1811
2390
  });
1812
2391
  let $2 = $.derived(() => {
1813
2392
  var _a;
1814
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2393
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
1815
2394
  });
1816
- let $3 = $.derived(() => blendModeToCss($.get(annotation).object.blendMode ?? PdfBlendMode.Multiply));
2395
+ let $3 = $.derived(() => {
2396
+ var _a;
2397
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
2398
+ });
2399
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2400
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1817
2401
  AnnotationContainer($$anchor9, $.spread_props(
1818
2402
  {
1819
2403
  get trackedAnnotation() {
1820
2404
  return $.get(annotation);
1821
2405
  },
1822
2406
  get isSelected() {
1823
- return $.get(isSelected);
2407
+ return $.get($0);
1824
2408
  },
1825
2409
  get isDraggable() {
1826
- return $.get($0);
2410
+ return $.get($1);
1827
2411
  },
1828
2412
  get isResizable() {
1829
- return $.get($1);
2413
+ return $.get($2);
1830
2414
  },
1831
2415
  get lockAspectRatio() {
1832
- return $.get($2);
2416
+ return $.get($3);
1833
2417
  },
1834
- onSelect: (e) => handleClick(e, $.get(annotation)),
1835
- zIndex: 0,
1836
2418
  get selectionMenu() {
1837
- return $$props.selectionMenu;
2419
+ return $.get($4);
1838
2420
  },
1839
2421
  get selectionMenuSnippet() {
1840
- return $$props.selectionMenuSnippet;
2422
+ return $.get($5);
1841
2423
  },
2424
+ onSelect: (e) => handleClick(e, $.get(annotation)),
2425
+ zIndex: 0,
1842
2426
  get style() {
1843
- return `mix-blend-mode: ${$.get($3) ?? ""}`;
2427
+ return `mix-blend-mode: ${$.get(mixBlendMode) ?? ""}`;
1844
2428
  }
1845
2429
  },
1846
2430
  () => annotationsProps,
@@ -1848,65 +2432,63 @@ function Annotations($$anchor, $$props) {
1848
2432
  ));
1849
2433
  }
1850
2434
  };
1851
- var alternate_4 = ($$anchor9) => {
2435
+ var alternate_6 = ($$anchor9) => {
1852
2436
  var fragment_22 = $.comment();
1853
- var node_8 = $.first_child(fragment_22);
2437
+ var node_9 = $.first_child(fragment_22);
1854
2438
  {
1855
2439
  var consequent_7 = ($$anchor10) => {
1856
2440
  {
1857
2441
  const children = ($$anchor11, obj = $.noop) => {
1858
- Line($$anchor11, $.spread_props(obj, {
1859
- get isSelected() {
1860
- return $.get(isSelected);
1861
- },
2442
+ Highlight($$anchor11, $.spread_props(obj, {
1862
2443
  get scale() {
1863
2444
  return $$props.scale;
1864
2445
  },
1865
2446
  onClick: (e) => handleClick(e, $.get(annotation))
1866
2447
  }));
1867
2448
  };
1868
- let $0 = $.derived(() => {
1869
- var _a;
1870
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
1871
- });
2449
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1872
2450
  let $1 = $.derived(() => {
1873
2451
  var _a;
1874
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2452
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, false) && !$.get(isMultiSelected);
1875
2453
  });
1876
2454
  let $2 = $.derived(() => {
1877
2455
  var _a;
1878
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2456
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
2457
+ });
2458
+ let $3 = $.derived(() => {
2459
+ var _a;
2460
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
1879
2461
  });
2462
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2463
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2464
+ let $6 = $.derived(() => blendModeToCss($.get(annotation).object.blendMode ?? PdfBlendMode.Multiply));
1880
2465
  AnnotationContainer($$anchor10, $.spread_props(
1881
2466
  {
1882
2467
  get trackedAnnotation() {
1883
2468
  return $.get(annotation);
1884
2469
  },
1885
2470
  get isSelected() {
1886
- return $.get(isSelected);
2471
+ return $.get($0);
1887
2472
  },
1888
2473
  get isDraggable() {
1889
- return $.get($0);
2474
+ return $.get($1);
1890
2475
  },
1891
2476
  get isResizable() {
1892
- return $.get($1);
2477
+ return $.get($2);
1893
2478
  },
1894
2479
  get lockAspectRatio() {
1895
- return $.get($2);
2480
+ return $.get($3);
1896
2481
  },
2482
+ onSelect: (e) => handleClick(e, $.get(annotation)),
2483
+ zIndex: 0,
1897
2484
  get selectionMenu() {
1898
- return $$props.selectionMenu;
2485
+ return $.get($4);
1899
2486
  },
1900
2487
  get selectionMenuSnippet() {
1901
- return $$props.selectionMenuSnippet;
1902
- },
1903
- onSelect: (e) => handleClick(e, $.get(annotation)),
1904
- vertexConfig: {
1905
- extractVertices: (a) => [a.linePoints.start, a.linePoints.end],
1906
- transformAnnotation: (a, vertices) => ({ ...a, linePoints: { start: vertices[0], end: vertices[1] } })
2488
+ return $.get($5);
1907
2489
  },
1908
2490
  get style() {
1909
- return `mix-blend-mode: ${$.get(mixBlendMode) ?? ""}`;
2491
+ return `mix-blend-mode: ${$.get($6) ?? ""}`;
1910
2492
  }
1911
2493
  },
1912
2494
  () => annotationsProps,
@@ -1914,14 +2496,14 @@ function Annotations($$anchor, $$props) {
1914
2496
  ));
1915
2497
  }
1916
2498
  };
1917
- var alternate_3 = ($$anchor10) => {
2499
+ var alternate_5 = ($$anchor10) => {
1918
2500
  var fragment_25 = $.comment();
1919
- var node_9 = $.first_child(fragment_25);
2501
+ var node_10 = $.first_child(fragment_25);
1920
2502
  {
1921
2503
  var consequent_8 = ($$anchor11) => {
1922
2504
  {
1923
2505
  const children = ($$anchor12, obj = $.noop) => {
1924
- Polyline($$anchor12, $.spread_props(obj, {
2506
+ Line($$anchor12, $.spread_props(obj, {
1925
2507
  get isSelected() {
1926
2508
  return $.get(isSelected);
1927
2509
  },
@@ -1931,45 +2513,48 @@ function Annotations($$anchor, $$props) {
1931
2513
  onClick: (e) => handleClick(e, $.get(annotation))
1932
2514
  }));
1933
2515
  };
1934
- let $0 = $.derived(() => {
1935
- var _a;
1936
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
1937
- });
2516
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
1938
2517
  let $1 = $.derived(() => {
1939
2518
  var _a;
1940
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2519
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
1941
2520
  });
1942
2521
  let $2 = $.derived(() => {
1943
2522
  var _a;
1944
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2523
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
2524
+ });
2525
+ let $3 = $.derived(() => {
2526
+ var _a;
2527
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
1945
2528
  });
2529
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2530
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
1946
2531
  AnnotationContainer($$anchor11, $.spread_props(
1947
2532
  {
1948
2533
  get trackedAnnotation() {
1949
2534
  return $.get(annotation);
1950
2535
  },
1951
- get selectionMenu() {
1952
- return $$props.selectionMenu;
1953
- },
1954
- get selectionMenuSnippet() {
1955
- return $$props.selectionMenuSnippet;
2536
+ get isSelected() {
2537
+ return $.get($0);
1956
2538
  },
1957
2539
  get isDraggable() {
1958
- return $.get($0);
2540
+ return $.get($1);
1959
2541
  },
1960
2542
  get isResizable() {
1961
- return $.get($1);
2543
+ return $.get($2);
1962
2544
  },
1963
2545
  get lockAspectRatio() {
1964
- return $.get($2);
2546
+ return $.get($3);
1965
2547
  },
1966
- get isSelected() {
1967
- return $.get(isSelected);
2548
+ get selectionMenu() {
2549
+ return $.get($4);
2550
+ },
2551
+ get selectionMenuSnippet() {
2552
+ return $.get($5);
1968
2553
  },
1969
2554
  onSelect: (e) => handleClick(e, $.get(annotation)),
1970
2555
  vertexConfig: {
1971
- extractVertices: (a) => a.vertices,
1972
- transformAnnotation: (a, vertices) => ({ ...a, vertices })
2556
+ extractVertices: (a) => [a.linePoints.start, a.linePoints.end],
2557
+ transformAnnotation: (a, vertices) => ({ ...a, linePoints: { start: vertices[0], end: vertices[1] } })
1973
2558
  },
1974
2559
  get style() {
1975
2560
  return `mix-blend-mode: ${$.get(mixBlendMode) ?? ""}`;
@@ -1980,14 +2565,14 @@ function Annotations($$anchor, $$props) {
1980
2565
  ));
1981
2566
  }
1982
2567
  };
1983
- var alternate_2 = ($$anchor11) => {
2568
+ var alternate_4 = ($$anchor11) => {
1984
2569
  var fragment_28 = $.comment();
1985
- var node_10 = $.first_child(fragment_28);
2570
+ var node_11 = $.first_child(fragment_28);
1986
2571
  {
1987
2572
  var consequent_9 = ($$anchor12) => {
1988
2573
  {
1989
2574
  const children = ($$anchor13, obj = $.noop) => {
1990
- Polygon($$anchor13, $.spread_props(obj, {
2575
+ Polyline($$anchor13, $.spread_props(obj, {
1991
2576
  get isSelected() {
1992
2577
  return $.get(isSelected);
1993
2578
  },
@@ -1997,40 +2582,43 @@ function Annotations($$anchor, $$props) {
1997
2582
  onClick: (e) => handleClick(e, $.get(annotation))
1998
2583
  }));
1999
2584
  };
2000
- let $0 = $.derived(() => {
2585
+ let $0 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2586
+ let $1 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2587
+ let $2 = $.derived(() => {
2001
2588
  var _a;
2002
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
2589
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
2003
2590
  });
2004
- let $1 = $.derived(() => {
2591
+ let $3 = $.derived(() => {
2005
2592
  var _a;
2006
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? false;
2593
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
2007
2594
  });
2008
- let $2 = $.derived(() => {
2595
+ let $4 = $.derived(() => {
2009
2596
  var _a;
2010
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2597
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
2011
2598
  });
2599
+ let $5 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2012
2600
  AnnotationContainer($$anchor12, $.spread_props(
2013
2601
  {
2014
2602
  get trackedAnnotation() {
2015
2603
  return $.get(annotation);
2016
2604
  },
2017
- get isSelected() {
2018
- return $.get(isSelected);
2019
- },
2020
- get isDraggable() {
2605
+ get selectionMenu() {
2021
2606
  return $.get($0);
2022
2607
  },
2023
- get isResizable() {
2608
+ get selectionMenuSnippet() {
2024
2609
  return $.get($1);
2025
2610
  },
2026
- get lockAspectRatio() {
2611
+ get isDraggable() {
2027
2612
  return $.get($2);
2028
2613
  },
2029
- get selectionMenu() {
2030
- return $$props.selectionMenu;
2614
+ get isResizable() {
2615
+ return $.get($3);
2031
2616
  },
2032
- get selectionMenuSnippet() {
2033
- return $$props.selectionMenuSnippet;
2617
+ get lockAspectRatio() {
2618
+ return $.get($4);
2619
+ },
2620
+ get isSelected() {
2621
+ return $.get($5);
2034
2622
  },
2035
2623
  onSelect: (e) => handleClick(e, $.get(annotation)),
2036
2624
  vertexConfig: {
@@ -2046,81 +2634,68 @@ function Annotations($$anchor, $$props) {
2046
2634
  ));
2047
2635
  }
2048
2636
  };
2049
- var alternate_1 = ($$anchor12) => {
2637
+ var alternate_3 = ($$anchor12) => {
2050
2638
  var fragment_31 = $.comment();
2051
- var node_11 = $.first_child(fragment_31);
2639
+ var node_12 = $.first_child(fragment_31);
2052
2640
  {
2053
2641
  var consequent_10 = ($$anchor13) => {
2054
2642
  {
2055
- const children = ($$anchor14, object = $.noop) => {
2056
- {
2057
- let $02 = $.derived(() => ({ ...$.get(annotation), object: object() }));
2058
- FreeText($$anchor14, {
2059
- get documentId() {
2060
- return $$props.documentId;
2061
- },
2062
- get isSelected() {
2063
- return $.get(isSelected);
2064
- },
2065
- get isEditing() {
2066
- return $.get(isEditing);
2067
- },
2068
- get annotation() {
2069
- return $.get($02);
2070
- },
2071
- get pageIndex() {
2072
- return $$props.pageIndex;
2073
- },
2074
- get scale() {
2075
- return $$props.scale;
2076
- },
2077
- onClick: (e) => handleClick(e, $.get(annotation))
2078
- });
2079
- }
2643
+ const children = ($$anchor14, obj = $.noop) => {
2644
+ Polygon($$anchor14, $.spread_props(obj, {
2645
+ get isSelected() {
2646
+ return $.get(isSelected);
2647
+ },
2648
+ get scale() {
2649
+ return $$props.scale;
2650
+ },
2651
+ onClick: (e) => handleClick(e, $.get(annotation))
2652
+ }));
2080
2653
  };
2081
- let $0 = $.derived(() => {
2082
- var _a;
2083
- return (((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true) && !$.get(isEditing);
2084
- });
2654
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2085
2655
  let $1 = $.derived(() => {
2086
2656
  var _a;
2087
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true;
2657
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
2088
2658
  });
2089
2659
  let $2 = $.derived(() => {
2090
2660
  var _a;
2091
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2661
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
2662
+ });
2663
+ let $3 = $.derived(() => {
2664
+ var _a;
2665
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
2092
2666
  });
2093
- let $3 = $.derived(() => blendModeToCss($.get(annotation).object.blendMode ?? PdfBlendMode.Normal));
2667
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2668
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2094
2669
  AnnotationContainer($$anchor13, $.spread_props(
2095
2670
  {
2096
2671
  get trackedAnnotation() {
2097
2672
  return $.get(annotation);
2098
2673
  },
2099
2674
  get isSelected() {
2100
- return $.get(isSelected);
2675
+ return $.get($0);
2101
2676
  },
2102
2677
  get isDraggable() {
2103
- return $.get($0);
2678
+ return $.get($1);
2104
2679
  },
2105
2680
  get isResizable() {
2106
- return $.get($1);
2681
+ return $.get($2);
2107
2682
  },
2108
2683
  get lockAspectRatio() {
2109
- return $.get($2);
2684
+ return $.get($3);
2110
2685
  },
2111
2686
  get selectionMenu() {
2112
- return $$props.selectionMenu;
2687
+ return $.get($4);
2113
2688
  },
2114
2689
  get selectionMenuSnippet() {
2115
- return $$props.selectionMenuSnippet;
2690
+ return $.get($5);
2116
2691
  },
2117
2692
  onSelect: (e) => handleClick(e, $.get(annotation)),
2118
- get style() {
2119
- return `mix-blend-mode: ${$.get($3) ?? ""}`;
2693
+ vertexConfig: {
2694
+ extractVertices: (a) => a.vertices,
2695
+ transformAnnotation: (a, vertices) => ({ ...a, vertices })
2120
2696
  },
2121
- onDoubleClick: (e) => {
2122
- e.stopPropagation();
2123
- $.set(editingId, $.get(annotation).object.id, true);
2697
+ get style() {
2698
+ return `mix-blend-mode: ${$.get(mixBlendMode) ?? ""}`;
2124
2699
  }
2125
2700
  },
2126
2701
  () => annotationsProps,
@@ -2128,70 +2703,84 @@ function Annotations($$anchor, $$props) {
2128
2703
  ));
2129
2704
  }
2130
2705
  };
2131
- var alternate = ($$anchor13) => {
2706
+ var alternate_2 = ($$anchor13) => {
2132
2707
  var fragment_34 = $.comment();
2133
- var node_12 = $.first_child(fragment_34);
2708
+ var node_13 = $.first_child(fragment_34);
2134
2709
  {
2135
2710
  var consequent_11 = ($$anchor14) => {
2136
2711
  {
2137
- const children = ($$anchor15, _object = $.noop) => {
2138
- Stamp($$anchor15, {
2139
- get documentId() {
2140
- return $$props.documentId;
2141
- },
2142
- get isSelected() {
2143
- return $.get(isSelected);
2144
- },
2145
- get annotation() {
2146
- return $.get(annotation);
2147
- },
2148
- get pageIndex() {
2149
- return $$props.pageIndex;
2150
- },
2151
- get scale() {
2152
- return $$props.scale;
2153
- },
2154
- onClick: (e) => handleClick(e, $.get(annotation))
2155
- });
2712
+ const children = ($$anchor15, object = $.noop) => {
2713
+ {
2714
+ let $02 = $.derived(() => ({ ...$.get(annotation), object: object() }));
2715
+ FreeText($$anchor15, {
2716
+ get documentId() {
2717
+ return $$props.documentId;
2718
+ },
2719
+ get isSelected() {
2720
+ return $.get(isSelected);
2721
+ },
2722
+ get isEditing() {
2723
+ return $.get(isEditing);
2724
+ },
2725
+ get annotation() {
2726
+ return $.get($02);
2727
+ },
2728
+ get pageIndex() {
2729
+ return $$props.pageIndex;
2730
+ },
2731
+ get scale() {
2732
+ return $$props.scale;
2733
+ },
2734
+ onClick: (e) => handleClick(e, $.get(annotation))
2735
+ });
2736
+ }
2156
2737
  };
2157
- let $0 = $.derived(() => {
2158
- var _a;
2159
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable) ?? true;
2160
- });
2738
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2161
2739
  let $1 = $.derived(() => {
2162
2740
  var _a;
2163
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable) ?? true;
2741
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isEditing) && !$.get(isMultiSelected);
2164
2742
  });
2165
2743
  let $2 = $.derived(() => {
2166
2744
  var _a;
2167
- return ((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
2745
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true) && !$.get(isMultiSelected);
2746
+ });
2747
+ let $3 = $.derived(() => {
2748
+ var _a;
2749
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
2168
2750
  });
2751
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2752
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2753
+ let $6 = $.derived(() => blendModeToCss($.get(annotation).object.blendMode ?? PdfBlendMode.Normal));
2169
2754
  AnnotationContainer($$anchor14, $.spread_props(
2170
2755
  {
2171
2756
  get trackedAnnotation() {
2172
2757
  return $.get(annotation);
2173
2758
  },
2174
2759
  get isSelected() {
2175
- return $.get(isSelected);
2760
+ return $.get($0);
2176
2761
  },
2177
2762
  get isDraggable() {
2178
- return $.get($0);
2763
+ return $.get($1);
2179
2764
  },
2180
2765
  get isResizable() {
2181
- return $.get($1);
2766
+ return $.get($2);
2182
2767
  },
2183
2768
  get lockAspectRatio() {
2184
- return $.get($2);
2769
+ return $.get($3);
2185
2770
  },
2186
2771
  get selectionMenu() {
2187
- return $$props.selectionMenu;
2772
+ return $.get($4);
2188
2773
  },
2189
2774
  get selectionMenuSnippet() {
2190
- return $$props.selectionMenuSnippet;
2775
+ return $.get($5);
2191
2776
  },
2192
2777
  onSelect: (e) => handleClick(e, $.get(annotation)),
2193
2778
  get style() {
2194
- return `mix-blend-mode: ${$.get(mixBlendMode) ?? ""}`;
2779
+ return `mix-blend-mode: ${$.get($6) ?? ""}`;
2780
+ },
2781
+ onDoubleClick: (e) => {
2782
+ e.stopPropagation();
2783
+ $.set(editingId, $.get(annotation).object.id, true);
2195
2784
  }
2196
2785
  },
2197
2786
  () => annotationsProps,
@@ -2199,10 +2788,160 @@ function Annotations($$anchor, $$props) {
2199
2788
  ));
2200
2789
  }
2201
2790
  };
2791
+ var alternate_1 = ($$anchor14) => {
2792
+ var fragment_37 = $.comment();
2793
+ var node_14 = $.first_child(fragment_37);
2794
+ {
2795
+ var consequent_12 = ($$anchor15) => {
2796
+ {
2797
+ const children = ($$anchor16, _object = $.noop) => {
2798
+ Stamp($$anchor16, {
2799
+ get documentId() {
2800
+ return $$props.documentId;
2801
+ },
2802
+ get isSelected() {
2803
+ return $.get(isSelected);
2804
+ },
2805
+ get annotation() {
2806
+ return $.get(annotation);
2807
+ },
2808
+ get pageIndex() {
2809
+ return $$props.pageIndex;
2810
+ },
2811
+ get scale() {
2812
+ return $$props.scale;
2813
+ },
2814
+ onClick: (e) => handleClick(e, $.get(annotation))
2815
+ });
2816
+ };
2817
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2818
+ let $1 = $.derived(() => {
2819
+ var _a;
2820
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
2821
+ });
2822
+ let $2 = $.derived(() => {
2823
+ var _a;
2824
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true) && !$.get(isMultiSelected);
2825
+ });
2826
+ let $3 = $.derived(() => {
2827
+ var _a;
2828
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
2829
+ });
2830
+ let $4 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2831
+ let $5 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2832
+ AnnotationContainer($$anchor15, $.spread_props(
2833
+ {
2834
+ get trackedAnnotation() {
2835
+ return $.get(annotation);
2836
+ },
2837
+ get isSelected() {
2838
+ return $.get($0);
2839
+ },
2840
+ get isDraggable() {
2841
+ return $.get($1);
2842
+ },
2843
+ get isResizable() {
2844
+ return $.get($2);
2845
+ },
2846
+ get lockAspectRatio() {
2847
+ return $.get($3);
2848
+ },
2849
+ get selectionMenu() {
2850
+ return $.get($4);
2851
+ },
2852
+ get selectionMenuSnippet() {
2853
+ return $.get($5);
2854
+ },
2855
+ onSelect: (e) => handleClick(e, $.get(annotation)),
2856
+ get style() {
2857
+ return `mix-blend-mode: ${$.get(mixBlendMode) ?? ""}`;
2858
+ }
2859
+ },
2860
+ () => annotationsProps,
2861
+ { children, $$slots: { default: true } }
2862
+ ));
2863
+ }
2864
+ };
2865
+ var alternate = ($$anchor15) => {
2866
+ var fragment_40 = $.comment();
2867
+ var node_15 = $.first_child(fragment_40);
2868
+ {
2869
+ var consequent_13 = ($$anchor16) => {
2870
+ const hasIRT = $.derived(() => !!$.get(annotation).object.inReplyToId);
2871
+ {
2872
+ const children = ($$anchor17, obj = $.noop) => {
2873
+ Link($$anchor17, $.spread_props(obj, {
2874
+ get isSelected() {
2875
+ return $.get(isSelected);
2876
+ },
2877
+ get scale() {
2878
+ return $$props.scale;
2879
+ },
2880
+ onClick: (e) => handleLinkClick(e, $.get(annotation)),
2881
+ get hasIRT() {
2882
+ return $.get(hasIRT);
2883
+ }
2884
+ }));
2885
+ };
2886
+ let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2887
+ let $1 = $.derived(() => $.get(hasIRT) ? void 0 : $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
2888
+ let $2 = $.derived(() => $.get(hasIRT) ? void 0 : $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2889
+ AnnotationContainer($$anchor16, $.spread_props(
2890
+ {
2891
+ get trackedAnnotation() {
2892
+ return $.get(annotation);
2893
+ },
2894
+ get isSelected() {
2895
+ return $.get($0);
2896
+ },
2897
+ get isMultiSelected() {
2898
+ return $.get(isMultiSelected);
2899
+ },
2900
+ isDraggable: false,
2901
+ isResizable: false,
2902
+ lockAspectRatio: false,
2903
+ get selectionMenu() {
2904
+ return $.get($1);
2905
+ },
2906
+ get selectionMenuSnippet() {
2907
+ return $.get($2);
2908
+ },
2909
+ onSelect: (e) => handleLinkClick(e, $.get(annotation)),
2910
+ get style() {
2911
+ return `mix-blend-mode: ${$.get(mixBlendMode) ?? ""}`;
2912
+ }
2913
+ },
2914
+ () => annotationsProps,
2915
+ { children, $$slots: { default: true } }
2916
+ ));
2917
+ }
2918
+ };
2919
+ $.if(
2920
+ node_15,
2921
+ ($$render) => {
2922
+ if (isLink($.get(annotation))) $$render(consequent_13);
2923
+ },
2924
+ true
2925
+ );
2926
+ }
2927
+ $.append($$anchor15, fragment_40);
2928
+ };
2929
+ $.if(
2930
+ node_14,
2931
+ ($$render) => {
2932
+ if (isStamp($.get(annotation))) $$render(consequent_12);
2933
+ else $$render(alternate, false);
2934
+ },
2935
+ true
2936
+ );
2937
+ }
2938
+ $.append($$anchor14, fragment_37);
2939
+ };
2202
2940
  $.if(
2203
- node_12,
2941
+ node_13,
2204
2942
  ($$render) => {
2205
- if (isStamp($.get(annotation))) $$render(consequent_11);
2943
+ if (isFreeText($.get(annotation))) $$render(consequent_11);
2944
+ else $$render(alternate_1, false);
2206
2945
  },
2207
2946
  true
2208
2947
  );
@@ -2210,10 +2949,10 @@ function Annotations($$anchor, $$props) {
2210
2949
  $.append($$anchor13, fragment_34);
2211
2950
  };
2212
2951
  $.if(
2213
- node_11,
2952
+ node_12,
2214
2953
  ($$render) => {
2215
- if (isFreeText($.get(annotation))) $$render(consequent_10);
2216
- else $$render(alternate, false);
2954
+ if (isPolygon($.get(annotation))) $$render(consequent_10);
2955
+ else $$render(alternate_2, false);
2217
2956
  },
2218
2957
  true
2219
2958
  );
@@ -2221,10 +2960,10 @@ function Annotations($$anchor, $$props) {
2221
2960
  $.append($$anchor12, fragment_31);
2222
2961
  };
2223
2962
  $.if(
2224
- node_10,
2963
+ node_11,
2225
2964
  ($$render) => {
2226
- if (isPolygon($.get(annotation))) $$render(consequent_9);
2227
- else $$render(alternate_1, false);
2965
+ if (isPolyline($.get(annotation))) $$render(consequent_9);
2966
+ else $$render(alternate_3, false);
2228
2967
  },
2229
2968
  true
2230
2969
  );
@@ -2232,10 +2971,10 @@ function Annotations($$anchor, $$props) {
2232
2971
  $.append($$anchor11, fragment_28);
2233
2972
  };
2234
2973
  $.if(
2235
- node_9,
2974
+ node_10,
2236
2975
  ($$render) => {
2237
- if (isPolyline($.get(annotation))) $$render(consequent_8);
2238
- else $$render(alternate_2, false);
2976
+ if (isLine($.get(annotation))) $$render(consequent_8);
2977
+ else $$render(alternate_4, false);
2239
2978
  },
2240
2979
  true
2241
2980
  );
@@ -2243,10 +2982,10 @@ function Annotations($$anchor, $$props) {
2243
2982
  $.append($$anchor10, fragment_25);
2244
2983
  };
2245
2984
  $.if(
2246
- node_8,
2985
+ node_9,
2247
2986
  ($$render) => {
2248
- if (isLine($.get(annotation))) $$render(consequent_7);
2249
- else $$render(alternate_3, false);
2987
+ if (isHighlight($.get(annotation))) $$render(consequent_7);
2988
+ else $$render(alternate_5, false);
2250
2989
  },
2251
2990
  true
2252
2991
  );
@@ -2254,10 +2993,10 @@ function Annotations($$anchor, $$props) {
2254
2993
  $.append($$anchor9, fragment_22);
2255
2994
  };
2256
2995
  $.if(
2257
- node_7,
2996
+ node_8,
2258
2997
  ($$render) => {
2259
- if (isHighlight($.get(annotation))) $$render(consequent_6);
2260
- else $$render(alternate_4, false);
2998
+ if (isSquiggly($.get(annotation))) $$render(consequent_6);
2999
+ else $$render(alternate_6, false);
2261
3000
  },
2262
3001
  true
2263
3002
  );
@@ -2265,10 +3004,10 @@ function Annotations($$anchor, $$props) {
2265
3004
  $.append($$anchor8, fragment_19);
2266
3005
  };
2267
3006
  $.if(
2268
- node_6,
3007
+ node_7,
2269
3008
  ($$render) => {
2270
- if (isSquiggly($.get(annotation))) $$render(consequent_5);
2271
- else $$render(alternate_5, false);
3009
+ if (isStrikeout($.get(annotation))) $$render(consequent_5);
3010
+ else $$render(alternate_7, false);
2272
3011
  },
2273
3012
  true
2274
3013
  );
@@ -2276,10 +3015,10 @@ function Annotations($$anchor, $$props) {
2276
3015
  $.append($$anchor7, fragment_16);
2277
3016
  };
2278
3017
  $.if(
2279
- node_5,
3018
+ node_6,
2280
3019
  ($$render) => {
2281
- if (isStrikeout($.get(annotation))) $$render(consequent_4);
2282
- else $$render(alternate_6, false);
3020
+ if (isUnderline($.get(annotation))) $$render(consequent_4);
3021
+ else $$render(alternate_8, false);
2283
3022
  },
2284
3023
  true
2285
3024
  );
@@ -2287,10 +3026,10 @@ function Annotations($$anchor, $$props) {
2287
3026
  $.append($$anchor6, fragment_13);
2288
3027
  };
2289
3028
  $.if(
2290
- node_4,
3029
+ node_5,
2291
3030
  ($$render) => {
2292
- if (isUnderline($.get(annotation))) $$render(consequent_3);
2293
- else $$render(alternate_7, false);
3031
+ if (isCircle($.get(annotation))) $$render(consequent_3);
3032
+ else $$render(alternate_9, false);
2294
3033
  },
2295
3034
  true
2296
3035
  );
@@ -2298,10 +3037,10 @@ function Annotations($$anchor, $$props) {
2298
3037
  $.append($$anchor5, fragment_10);
2299
3038
  };
2300
3039
  $.if(
2301
- node_3,
3040
+ node_4,
2302
3041
  ($$render) => {
2303
- if (isCircle($.get(annotation))) $$render(consequent_2);
2304
- else $$render(alternate_8, false);
3042
+ if (isSquare($.get(annotation))) $$render(consequent_2);
3043
+ else $$render(alternate_10, false);
2305
3044
  },
2306
3045
  true
2307
3046
  );
@@ -2309,10 +3048,10 @@ function Annotations($$anchor, $$props) {
2309
3048
  $.append($$anchor4, fragment_7);
2310
3049
  };
2311
3050
  $.if(
2312
- node_2,
3051
+ node_3,
2313
3052
  ($$render) => {
2314
- if (isSquare($.get(annotation))) $$render(consequent_1);
2315
- else $$render(alternate_9, false);
3053
+ if (isInk($.get(annotation))) $$render(consequent_1);
3054
+ else $$render(alternate_11, false);
2316
3055
  },
2317
3056
  true
2318
3057
  );
@@ -2320,12 +3059,61 @@ function Annotations($$anchor, $$props) {
2320
3059
  $.append($$anchor3, fragment_4);
2321
3060
  };
2322
3061
  $.if(node_1, ($$render) => {
2323
- if (isInk($.get(annotation))) $$render(consequent);
2324
- else $$render(alternate_10, false);
3062
+ if ($.get(customRenderer)) $$render(consequent);
3063
+ else $$render(alternate_12, false);
2325
3064
  });
2326
3065
  }
2327
3066
  $.append($$anchor2, fragment_1);
2328
3067
  });
3068
+ var node_16 = $.sibling(node, 2);
3069
+ {
3070
+ var consequent_14 = ($$anchor2) => {
3071
+ GroupSelectionBox($$anchor2, {
3072
+ get documentId() {
3073
+ return $$props.documentId;
3074
+ },
3075
+ get pageIndex() {
3076
+ return $$props.pageIndex;
3077
+ },
3078
+ get scale() {
3079
+ return $$props.scale;
3080
+ },
3081
+ get rotation() {
3082
+ return $$props.rotation;
3083
+ },
3084
+ get pageWidth() {
3085
+ return $$props.pageWidth;
3086
+ },
3087
+ get pageHeight() {
3088
+ return $$props.pageHeight;
3089
+ },
3090
+ get selectedAnnotations() {
3091
+ return $.get(selectedAnnotationsOnPage);
3092
+ },
3093
+ get isDraggable() {
3094
+ return $.get(areAllSelectedDraggable);
3095
+ },
3096
+ get isResizable() {
3097
+ return $.get(areAllSelectedResizable);
3098
+ },
3099
+ get resizeUI() {
3100
+ return $$props.resizeUI;
3101
+ },
3102
+ get selectionOutlineColor() {
3103
+ return $$props.selectionOutlineColor;
3104
+ },
3105
+ get groupSelectionMenu() {
3106
+ return $$props.groupSelectionMenu;
3107
+ },
3108
+ get groupSelectionMenuSnippet() {
3109
+ return $$props.groupSelectionMenuSnippet;
3110
+ }
3111
+ });
3112
+ };
3113
+ $.if(node_16, ($$render) => {
3114
+ if ($.get(allSelectedOnSamePage) && $.get(selectedAnnotationsOnPage).length >= 2) $$render(consequent_14);
3115
+ });
3116
+ }
2329
3117
  $.append($$anchor, fragment);
2330
3118
  $.pop();
2331
3119
  }
@@ -2376,14 +3164,14 @@ function TextMarkup($$anchor, $$props) {
2376
3164
  {
2377
3165
  let $0 = $.derived(() => {
2378
3166
  var _a;
2379
- return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.color;
3167
+ return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.strokeColor;
2380
3168
  });
2381
3169
  let $1 = $.derived(() => {
2382
3170
  var _a;
2383
3171
  return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.opacity;
2384
3172
  });
2385
3173
  Underline(node_2, {
2386
- get color() {
3174
+ get strokeColor() {
2387
3175
  return $.get($0);
2388
3176
  },
2389
3177
  get opacity() {
@@ -2417,14 +3205,14 @@ function TextMarkup($$anchor, $$props) {
2417
3205
  {
2418
3206
  let $0 = $.derived(() => {
2419
3207
  var _a;
2420
- return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.color;
3208
+ return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.strokeColor;
2421
3209
  });
2422
3210
  let $1 = $.derived(() => {
2423
3211
  var _a;
2424
3212
  return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.opacity;
2425
3213
  });
2426
3214
  Highlight(node_4, {
2427
- get color() {
3215
+ get strokeColor() {
2428
3216
  return $.get($0);
2429
3217
  },
2430
3218
  get opacity() {
@@ -2458,14 +3246,14 @@ function TextMarkup($$anchor, $$props) {
2458
3246
  {
2459
3247
  let $0 = $.derived(() => {
2460
3248
  var _a;
2461
- return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.color;
3249
+ return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.strokeColor;
2462
3250
  });
2463
3251
  let $1 = $.derived(() => {
2464
3252
  var _a;
2465
3253
  return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.opacity;
2466
3254
  });
2467
3255
  Strikeout(node_6, {
2468
- get color() {
3256
+ get strokeColor() {
2469
3257
  return $.get($0);
2470
3258
  },
2471
3259
  get opacity() {
@@ -2499,14 +3287,14 @@ function TextMarkup($$anchor, $$props) {
2499
3287
  {
2500
3288
  let $0 = $.derived(() => {
2501
3289
  var _a;
2502
- return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.color;
3290
+ return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.strokeColor;
2503
3291
  });
2504
3292
  let $1 = $.derived(() => {
2505
3293
  var _a;
2506
3294
  return (_a = $.get(activeTool).defaults) == null ? void 0 : _a.opacity;
2507
3295
  });
2508
3296
  Squiggly(node_8, {
2509
- get color() {
3297
+ get strokeColor() {
2510
3298
  return $.get($0);
2511
3299
  },
2512
3300
  get opacity() {
@@ -2963,11 +3751,26 @@ function AnnotationLayer($$anchor, $$props) {
2963
3751
  "rotation",
2964
3752
  "selectionMenu",
2965
3753
  "selectionMenuSnippet",
3754
+ "groupSelectionMenu",
3755
+ "groupSelectionMenuSnippet",
2966
3756
  "resizeUI",
2967
3757
  "vertexUI",
2968
3758
  "selectionOutlineColor",
2969
- "customAnnotationRenderer"
3759
+ "customAnnotationRenderer",
3760
+ "annotationRenderers"
2970
3761
  ]);
3762
+ const registry = getRendererRegistry();
3763
+ const allRenderers = $.derived(() => {
3764
+ const fromRegistry = (registry == null ? void 0 : registry.getAll()) ?? [];
3765
+ const fromProps = $$props.annotationRenderers ?? [];
3766
+ const merged = [...fromRegistry];
3767
+ for (const r of fromProps) {
3768
+ const idx = merged.findIndex((m) => m.id === r.id);
3769
+ if (idx >= 0) merged[idx] = r;
3770
+ else merged.push(r);
3771
+ }
3772
+ return merged;
3773
+ });
2971
3774
  const documentState = useDocumentState(() => $$props.documentId);
2972
3775
  const page = $.derived(() => {
2973
3776
  var _a, _b, _c;
@@ -3004,6 +3807,12 @@ function AnnotationLayer($$anchor, $$props) {
3004
3807
  get selectionMenuSnippet() {
3005
3808
  return $$props.selectionMenuSnippet;
3006
3809
  },
3810
+ get groupSelectionMenu() {
3811
+ return $$props.groupSelectionMenu;
3812
+ },
3813
+ get groupSelectionMenuSnippet() {
3814
+ return $$props.groupSelectionMenuSnippet;
3815
+ },
3007
3816
  get pageIndex() {
3008
3817
  return $$props.pageIndex;
3009
3818
  },
@@ -3030,6 +3839,9 @@ function AnnotationLayer($$anchor, $$props) {
3030
3839
  },
3031
3840
  get customAnnotationRenderer() {
3032
3841
  return $$props.customAnnotationRenderer;
3842
+ },
3843
+ get annotationRenderers() {
3844
+ return $.get(allRenderers);
3033
3845
  }
3034
3846
  });
3035
3847
  var node_1 = $.sibling(node, 2);
@@ -3060,26 +3872,35 @@ function AnnotationLayer($$anchor, $$props) {
3060
3872
  $.append($$anchor, div);
3061
3873
  $.pop();
3062
3874
  }
3875
+ const AnnotationPluginPackage = createPluginPackage(AnnotationPluginPackage$1).addWrapper(RendererRegistryProvider).build();
3063
3876
  export {
3064
3877
  AnnotationContainer,
3065
3878
  AnnotationLayer,
3066
3879
  AnnotationPaintLayer,
3880
+ AnnotationPluginPackage,
3067
3881
  Annotations,
3068
3882
  Circle,
3069
3883
  FreeText,
3884
+ GroupSelectionBox,
3070
3885
  Highlight,
3071
3886
  Ink,
3072
3887
  Line,
3888
+ Link,
3073
3889
  Polygon,
3074
3890
  Polyline,
3075
3891
  PreviewRenderer,
3076
3892
  RenderAnnotation,
3893
+ RendererRegistryProvider,
3077
3894
  Square,
3078
3895
  Squiggly,
3079
3896
  Stamp,
3080
3897
  Strikeout,
3081
3898
  TextMarkup,
3082
3899
  Underline,
3900
+ createRenderer,
3901
+ createRendererRegistry,
3902
+ getRendererRegistry,
3903
+ provideRendererRegistry,
3083
3904
  useAnnotation,
3084
3905
  useAnnotationCapability,
3085
3906
  useAnnotationPlugin