@embedpdf/plugin-annotation 2.4.1 → 2.6.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 (71) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1061 -430
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/annotation-plugin.d.ts +24 -6
  6. package/dist/lib/geometry/index.d.ts +1 -0
  7. package/dist/lib/geometry/rotation.d.ts +32 -0
  8. package/dist/lib/handlers/types.d.ts +3 -1
  9. package/dist/lib/index.d.ts +1 -0
  10. package/dist/lib/patching/base-patch.d.ts +87 -0
  11. package/dist/lib/patching/index.d.ts +1 -0
  12. package/dist/lib/patching/insert-upright.d.ts +20 -0
  13. package/dist/lib/patching/patch-registry.d.ts +14 -1
  14. package/dist/lib/patching/patch-utils.d.ts +54 -1
  15. package/dist/lib/patching/patches/circle.patch.d.ts +3 -0
  16. package/dist/lib/patching/patches/freetext.patch.d.ts +3 -0
  17. package/dist/lib/patching/patches/index.d.ts +4 -0
  18. package/dist/lib/patching/patches/square.patch.d.ts +3 -0
  19. package/dist/lib/patching/patches/stamp.patch.d.ts +3 -0
  20. package/dist/lib/tools/default-tools.d.ts +32 -0
  21. package/dist/lib/tools/types.d.ts +20 -1
  22. package/dist/lib/types.d.ts +67 -3
  23. package/dist/preact/adapter.d.ts +3 -0
  24. package/dist/preact/index.cjs +1 -1
  25. package/dist/preact/index.cjs.map +1 -1
  26. package/dist/preact/index.js +797 -128
  27. package/dist/preact/index.js.map +1 -1
  28. package/dist/react/adapter.d.ts +2 -1
  29. package/dist/react/index.cjs +1 -1
  30. package/dist/react/index.cjs.map +1 -1
  31. package/dist/react/index.js +797 -128
  32. package/dist/react/index.js.map +1 -1
  33. package/dist/shared/components/annotation-container.d.ts +10 -2
  34. package/dist/shared/components/annotation-layer.d.ts +9 -3
  35. package/dist/shared/components/annotations.d.ts +4 -1
  36. package/dist/shared/components/group-selection-box.d.ts +12 -4
  37. package/dist/shared/components/render-annotation.d.ts +2 -1
  38. package/dist/shared/components/types.d.ts +51 -1
  39. package/dist/shared-preact/components/annotation-container.d.ts +10 -2
  40. package/dist/shared-preact/components/annotation-layer.d.ts +9 -3
  41. package/dist/shared-preact/components/annotations.d.ts +4 -1
  42. package/dist/shared-preact/components/group-selection-box.d.ts +12 -4
  43. package/dist/shared-preact/components/render-annotation.d.ts +2 -1
  44. package/dist/shared-preact/components/types.d.ts +51 -1
  45. package/dist/shared-react/components/annotation-container.d.ts +10 -2
  46. package/dist/shared-react/components/annotation-layer.d.ts +9 -3
  47. package/dist/shared-react/components/annotations.d.ts +4 -1
  48. package/dist/shared-react/components/group-selection-box.d.ts +12 -4
  49. package/dist/shared-react/components/render-annotation.d.ts +2 -1
  50. package/dist/shared-react/components/types.d.ts +51 -1
  51. package/dist/svelte/components/AnnotationLayer.svelte.d.ts +8 -2
  52. package/dist/svelte/components/Annotations.svelte.d.ts +7 -1
  53. package/dist/svelte/components/GroupSelectionBox.svelte.d.ts +11 -3
  54. package/dist/svelte/components/RenderAnnotation.svelte.d.ts +1 -0
  55. package/dist/svelte/components/types.d.ts +14 -1
  56. package/dist/svelte/index.cjs +1 -1
  57. package/dist/svelte/index.cjs.map +1 -1
  58. package/dist/svelte/index.js +1171 -332
  59. package/dist/svelte/index.js.map +1 -1
  60. package/dist/svelte/types.d.ts +53 -0
  61. package/dist/vue/components/annotation-container.vue.d.ts +35 -9
  62. package/dist/vue/components/annotation-layer.vue.d.ts +29 -5
  63. package/dist/vue/components/annotations.vue.d.ts +278 -134
  64. package/dist/vue/components/group-selection-box.vue.d.ts +35 -10
  65. package/dist/vue/components/render-annotation.vue.d.ts +2 -0
  66. package/dist/vue/index.cjs +1 -1
  67. package/dist/vue/index.cjs.map +1 -1
  68. package/dist/vue/index.js +949 -163
  69. package/dist/vue/index.js.map +1 -1
  70. package/dist/vue/types.d.ts +52 -0
  71. package/package.json +11 -10
@@ -6,7 +6,7 @@ import * as $ from "svelte/internal/client";
6
6
  import { setContext, getContext, untrack } from "svelte";
7
7
  import { useCapability, usePlugin, useDocumentPermissions, useDocumentState } from "@embedpdf/core/svelte";
8
8
  import { useInteractionHandles, deepToRaw, doublePress, CounterRotate } from "@embedpdf/utils/svelte";
9
- import { PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCss, ignore, PdfErrorCode, boundingRectOrEmpty, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
9
+ import { inferRotationCenterFromRects, PdfAnnotationBorderStyle, PdfVerticalAlignment, standardFontCssProperties, textAlignmentToCss, ignore, PdfErrorCode, boundingRectOrEmpty, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype } from "@embedpdf/models";
10
10
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/svelte";
11
11
  import { useSelectionCapability } from "@embedpdf/plugin-selection/svelte";
12
12
  const REGISTRY_KEY = Symbol("AnnotationRendererRegistry");
@@ -85,12 +85,17 @@ const useAnnotation = (getDocumentId) => {
85
85
  }
86
86
  };
87
87
  };
88
- var root_6$1 = $.from_html(`<div></div>`);
89
- var root_10 = $.from_html(`<div></div>`);
90
- var root$c = $.from_html(`<div data-no-interaction=""><div><!> <!> <!></div> <!></div>`);
88
+ var root_1$c = $.from_html(`<div></div> <div></div> <div></div>`, 1);
89
+ var root_3$1 = $.from_html(`<div style="display: contents;"><!></div>`);
90
+ var root_5$2 = $.from_html(`<div></div>`);
91
+ var root_4$2 = $.from_html(`<div style="display: contents;"><!> <div><svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></div></div>`);
92
+ var root_11$2 = $.from_html(`<div></div>`);
93
+ var root_15 = $.from_html(`<div></div>`);
94
+ var root_22 = $.from_html(`<div><div> </div></div>`);
95
+ var root$c = $.from_html(`<div data-no-interaction=""><div><!> <!> <div><!> <!> <!></div></div> <!> <!></div>`);
91
96
  function AnnotationContainer($$anchor, $$props) {
92
97
  $.push($$props, true);
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, [
98
+ let isMultiSelected = $.prop($$props, "isMultiSelected", 3, false), isRotatable = $.prop($$props, "isRotatable", 3, true), lockAspectRatio = $.prop($$props, "lockAspectRatio", 3, false), propsClass = $.prop($$props, "class", 3, ""), outlineOffset = $.prop($$props, "outlineOffset", 3, 1), zIndex = $.prop($$props, "zIndex", 3, 1), restProps = $.rest_props($$props, [
94
99
  "$$slots",
95
100
  "$$events",
96
101
  "$$legacy",
@@ -106,6 +111,7 @@ function AnnotationContainer($$anchor, $$props) {
106
111
  "isMultiSelected",
107
112
  "isDraggable",
108
113
  "isResizable",
114
+ "isRotatable",
109
115
  "lockAspectRatio",
110
116
  "style",
111
117
  "class",
@@ -118,10 +124,18 @@ function AnnotationContainer($$anchor, $$props) {
118
124
  "zIndex",
119
125
  "resizeUI",
120
126
  "vertexUI",
127
+ "rotationUI",
121
128
  "selectionOutlineColor",
122
- "customAnnotationRenderer"
129
+ "selectionOutline",
130
+ "customAnnotationRenderer",
131
+ "groupSelectionMenu",
132
+ "groupSelectionOutline",
133
+ "annotationRenderers"
123
134
  ]);
124
135
  let preview = $.state($.proxy($$props.trackedAnnotation.object));
136
+ let liveRotation = $.state(null);
137
+ let cursorScreen = $.state(null);
138
+ let isHandleHovered = $.state(false);
125
139
  let annotationCapability = useAnnotationCapability();
126
140
  const annotationPlugin = useAnnotationPlugin();
127
141
  const permissions = useDocumentPermissions(() => $$props.documentId);
@@ -129,6 +143,7 @@ function AnnotationContainer($$anchor, $$props) {
129
143
  let gestureBaseRectRef = $.state(null);
130
144
  const effectiveIsDraggable = $.derived(() => permissions.canModifyAnnotations && $$props.isDraggable && !isMultiSelected());
131
145
  const effectiveIsResizable = $.derived(() => permissions.canModifyAnnotations && $$props.isResizable && !isMultiSelected());
146
+ const effectiveIsRotatable = $.derived(() => permissions.canModifyAnnotations && isRotatable() && !isMultiSelected());
132
147
  const guardedOnDoubleClick = $.derived(() => permissions.canModifyAnnotations && $$props.onDoubleClick ? $$props.onDoubleClick : void 0);
133
148
  const annotationProvides = $.derived(() => annotationCapability.provides ? annotationCapability.provides.forDocument($$props.documentId) : null);
134
149
  let currentObject = $.derived(() => $.get(preview) ? { ...$$props.trackedAnnotation.object, ...$.get(preview) } : $$props.trackedAnnotation.object);
@@ -140,6 +155,14 @@ function AnnotationContainer($$anchor, $$props) {
140
155
  var _a;
141
156
  return ((_a = $$props.vertexUI) == null ? void 0 : _a.color) ?? "#007ACC";
142
157
  });
158
+ const ROTATION_COLOR = $.derived(() => {
159
+ var _a;
160
+ return ((_a = $$props.rotationUI) == null ? void 0 : _a.color) ?? "white";
161
+ });
162
+ const ROTATION_CONNECTOR_COLOR = $.derived(() => {
163
+ var _a;
164
+ return ((_a = $$props.rotationUI) == null ? void 0 : _a.connectorColor) ?? "#007ACC";
165
+ });
143
166
  const HANDLE_SIZE = $.derived(() => {
144
167
  var _a;
145
168
  return ((_a = $$props.resizeUI) == null ? void 0 : _a.size) ?? 12;
@@ -148,7 +171,76 @@ function AnnotationContainer($$anchor, $$props) {
148
171
  var _a;
149
172
  return ((_a = $$props.vertexUI) == null ? void 0 : _a.size) ?? 12;
150
173
  });
174
+ const ROTATION_SIZE = $.derived(() => {
175
+ var _a;
176
+ return ((_a = $$props.rotationUI) == null ? void 0 : _a.size) ?? 32;
177
+ });
178
+ const ROTATION_MARGIN = $.derived(() => {
179
+ var _a;
180
+ return (_a = $$props.rotationUI) == null ? void 0 : _a.margin;
181
+ });
182
+ const ROTATION_ICON_COLOR = $.derived(() => {
183
+ var _a;
184
+ return ((_a = $$props.rotationUI) == null ? void 0 : _a.iconColor) ?? "#007ACC";
185
+ });
186
+ const SHOW_CONNECTOR = $.derived(() => {
187
+ var _a;
188
+ return ((_a = $$props.rotationUI) == null ? void 0 : _a.showConnector) ?? false;
189
+ });
190
+ const ROTATION_BORDER_COLOR = $.derived(() => {
191
+ var _a, _b;
192
+ return ((_b = (_a = $$props.rotationUI) == null ? void 0 : _a.border) == null ? void 0 : _b.color) ?? "#007ACC";
193
+ });
194
+ const ROTATION_BORDER_WIDTH = $.derived(() => {
195
+ var _a, _b;
196
+ return ((_b = (_a = $$props.rotationUI) == null ? void 0 : _a.border) == null ? void 0 : _b.width) ?? 1;
197
+ });
198
+ const ROTATION_BORDER_STYLE = $.derived(() => {
199
+ var _a, _b;
200
+ return ((_b = (_a = $$props.rotationUI) == null ? void 0 : _a.border) == null ? void 0 : _b.style) ?? "solid";
201
+ });
202
+ const outlineColor = $.derived(() => {
203
+ var _a;
204
+ return ((_a = $$props.selectionOutline) == null ? void 0 : _a.color) ?? $$props.selectionOutlineColor ?? "#007ACC";
205
+ });
206
+ const outlineStyleVal = $.derived(() => {
207
+ var _a;
208
+ return ((_a = $$props.selectionOutline) == null ? void 0 : _a.style) ?? "solid";
209
+ });
210
+ const outlineWidth = $.derived(() => {
211
+ var _a;
212
+ return ((_a = $$props.selectionOutline) == null ? void 0 : _a.width) ?? 1;
213
+ });
214
+ const outlineOff = $.derived(() => {
215
+ var _a;
216
+ return ((_a = $$props.selectionOutline) == null ? void 0 : _a.offset) ?? outlineOffset() ?? 1;
217
+ });
218
+ const annotationRotation = $.derived(() => $.get(liveRotation) ?? $.get(currentObject).rotation ?? 0);
219
+ const rotationDisplay = $.derived(() => $.get(liveRotation) ?? $.get(currentObject).rotation ?? 0);
220
+ const normalizedRotationDisplay = $.derived(() => Number.isFinite($.get(rotationDisplay)) ? Math.round($.get(rotationDisplay) * 10) / 10 : 0);
221
+ const rotationActive = $.derived(() => $.get(liveRotation) !== null);
151
222
  const showOutline = $.derived(() => $$props.isSelected && !isMultiSelected());
223
+ const explicitUnrotatedRect = $.derived(() => $.get(currentObject).unrotatedRect);
224
+ const effectiveUnrotatedRect = $.derived(() => $.get(explicitUnrotatedRect) ?? $.get(currentObject).rect);
225
+ const rotationPivot = $.derived(() => $.get(explicitUnrotatedRect) && $.get(annotationRotation) !== 0 ? inferRotationCenterFromRects($.get(effectiveUnrotatedRect), $.get(currentObject).rect, $.get(annotationRotation)) : void 0);
226
+ const controllerElement = $.derived(() => $.get(effectiveUnrotatedRect));
227
+ const aabbWidth = $.derived(() => $.get(currentObject).rect.size.width * $$props.scale);
228
+ const aabbHeight = $.derived(() => $.get(currentObject).rect.size.height * $$props.scale);
229
+ const innerWidth = $.derived(() => $.get(effectiveUnrotatedRect).size.width * $$props.scale);
230
+ const innerHeight = $.derived(() => $.get(effectiveUnrotatedRect).size.height * $$props.scale);
231
+ const usesCustomPivot = $.derived(() => Boolean($.get(explicitUnrotatedRect)) && $.get(annotationRotation) !== 0);
232
+ const innerLeft = $.derived(() => $.get(usesCustomPivot) ? ($.get(effectiveUnrotatedRect).origin.x - $.get(currentObject).rect.origin.x) * $$props.scale : ($.get(aabbWidth) - $.get(innerWidth)) / 2);
233
+ const innerTop = $.derived(() => $.get(usesCustomPivot) ? ($.get(effectiveUnrotatedRect).origin.y - $.get(currentObject).rect.origin.y) * $$props.scale : ($.get(aabbHeight) - $.get(innerHeight)) / 2);
234
+ const innerTransformOrigin = $.derived(() => $.get(usesCustomPivot) && $.get(rotationPivot) ? `${($.get(rotationPivot).x - $.get(effectiveUnrotatedRect).origin.x) * $$props.scale}px ${($.get(rotationPivot).y - $.get(effectiveUnrotatedRect).origin.y) * $$props.scale}px` : "center center");
235
+ const centerX = $.derived(() => $.get(rotationPivot) ? ($.get(rotationPivot).x - $.get(currentObject).rect.origin.x) * $$props.scale : $.get(aabbWidth) / 2);
236
+ const centerY = $.derived(() => $.get(rotationPivot) ? ($.get(rotationPivot).y - $.get(currentObject).rect.origin.y) * $$props.scale : $.get(aabbHeight) / 2);
237
+ const guideLength = $.derived(() => Math.max(300, Math.max($.get(aabbWidth), $.get(aabbHeight)) + 80));
238
+ const childObject = $.derived(() => {
239
+ if ($.get(explicitUnrotatedRect)) {
240
+ return { ...$.get(currentObject), rect: $.get(explicitUnrotatedRect) };
241
+ }
242
+ return $.get(currentObject);
243
+ });
152
244
  $.user_effect(() => {
153
245
  if ($$props.trackedAnnotation.object) {
154
246
  $.set(preview, $$props.trackedAnnotation.object, true);
@@ -161,6 +253,9 @@ function AnnotationContainer($$anchor, $$props) {
161
253
  const handleEvent = (event) => {
162
254
  var _a;
163
255
  if (event.documentId !== $$props.documentId) return;
256
+ if (event.type === "end" || event.type === "cancel") {
257
+ $.set(liveRotation, null);
258
+ }
164
259
  const patch = (_a = event.previewPatches) == null ? void 0 : _a[id];
165
260
  if (event.type === "update" && patch) {
166
261
  $.set(preview, { ...untrack(() => $.get(preview)), ...patch }, true);
@@ -170,7 +265,8 @@ function AnnotationContainer($$anchor, $$props) {
170
265
  };
171
266
  const unsubs = [
172
267
  plugin.onDragChange(handleEvent),
173
- plugin.onResizeChange(handleEvent)
268
+ plugin.onResizeChange(handleEvent),
269
+ plugin.onRotateChange(handleEvent)
174
270
  ];
175
271
  return () => unsubs.forEach((u) => u());
176
272
  });
@@ -178,7 +274,7 @@ function AnnotationContainer($$anchor, $$props) {
178
274
  var _a;
179
275
  return {
180
276
  controller: {
181
- element: $.get(currentObject).rect,
277
+ element: $.get(controllerElement),
182
278
  vertices: (_a = $$props.vertexConfig) == null ? void 0 : _a.extractVertices($.get(currentObject)),
183
279
  constraints: {
184
280
  minWidth: 10,
@@ -187,6 +283,9 @@ function AnnotationContainer($$anchor, $$props) {
187
283
  },
188
284
  maintainAspectRatio: lockAspectRatio(),
189
285
  pageRotation: $$props.rotation,
286
+ annotationRotation: $.get(annotationRotation),
287
+ rotationCenter: $.get(rotationPivot),
288
+ rotationElement: $.get(currentObject).rect,
190
289
  scale: $$props.scale,
191
290
  // Disable interaction handles when multi-selected
192
291
  enabled: $$props.isSelected && !isMultiSelected(),
@@ -199,7 +298,7 @@ function AnnotationContainer($$anchor, $$props) {
199
298
  const id = $$props.trackedAnnotation.object.id;
200
299
  const pageSize = { width: $$props.pageWidth, height: $$props.pageHeight };
201
300
  if (event.state === "start") {
202
- $.set(gestureBaseRectRef, $$props.trackedAnnotation.object.rect, true);
301
+ $.set(gestureBaseRectRef, $$props.trackedAnnotation.object.unrotatedRect ?? $$props.trackedAnnotation.object.rect, true);
203
302
  $.set(
204
303
  gestureBaseRef,
205
304
  $$props.trackedAnnotation.object,
@@ -239,6 +338,27 @@ function AnnotationContainer($$anchor, $$props) {
239
338
  }
240
339
  }
241
340
  }
341
+ if (type === "rotate") {
342
+ const cursorAngle = (metadata == null ? void 0 : metadata.rotationAngle) ?? $.get(annotationRotation);
343
+ const cursorPos = metadata == null ? void 0 : metadata.cursorPosition;
344
+ if (cursorPos) $.set(cursorScreen, { x: cursorPos.clientX, y: cursorPos.clientY }, true);
345
+ if (event.state === "start") {
346
+ $.set(liveRotation, cursorAngle, true);
347
+ plugin.startRotation($$props.documentId, {
348
+ annotationIds: [id],
349
+ cursorAngle,
350
+ rotationCenter: metadata == null ? void 0 : metadata.rotationCenter
351
+ });
352
+ } else if (event.state === "move") {
353
+ $.set(liveRotation, cursorAngle, true);
354
+ plugin.updateRotation($$props.documentId, cursorAngle, metadata == null ? void 0 : metadata.rotationDelta);
355
+ } else if (event.state === "end") {
356
+ $.set(liveRotation, null);
357
+ $.set(cursorScreen, null);
358
+ plugin.commitRotation($$props.documentId);
359
+ }
360
+ return;
361
+ }
242
362
  if (event.state === "end") {
243
363
  $.set(gestureBaseRectRef, null);
244
364
  $.set(gestureBaseRef, null);
@@ -249,18 +369,27 @@ function AnnotationContainer($$anchor, $$props) {
249
369
  },
250
370
  resizeUI: {
251
371
  handleSize: $.get(HANDLE_SIZE),
252
- spacing: outlineOffset(),
372
+ spacing: $.get(outlineOff),
253
373
  offsetMode: "outside",
254
374
  includeSides: lockAspectRatio() ? false : true,
255
375
  zIndex: zIndex() + 1
256
376
  },
257
377
  vertexUI: { vertexSize: $.get(VERTEX_SIZE), zIndex: zIndex() + 2 },
258
- includeVertices: $$props.vertexConfig ? true : false
378
+ rotationUI: {
379
+ handleSize: $.get(ROTATION_SIZE),
380
+ margin: $.get(ROTATION_MARGIN),
381
+ zIndex: zIndex() + 3,
382
+ showConnector: $.get(SHOW_CONNECTOR)
383
+ },
384
+ includeVertices: $$props.vertexConfig ? true : false,
385
+ includeRotation: $.get(effectiveIsRotatable),
386
+ currentRotation: $.get(annotationRotation)
259
387
  };
260
388
  });
261
389
  const resizeHandles = $.derived(() => interactionHandles.resize);
262
390
  const vertexHandles = $.derived(() => interactionHandles.vertices);
263
- const shouldShowMenu = $.derived(() => $$props.isSelected && !isMultiSelected() && (!!$$props.selectionMenu || !!$$props.selectionMenuSnippet));
391
+ const rotationHandle = $.derived(() => interactionHandles.rotation);
392
+ const shouldShowMenu = $.derived(() => $$props.isSelected && !isMultiSelected() && !$.get(rotationActive) && (!!$$props.selectionMenu || !!$$props.selectionMenuSnippet));
264
393
  function buildContext() {
265
394
  return {
266
395
  type: "annotation",
@@ -268,20 +397,30 @@ function AnnotationContainer($$anchor, $$props) {
268
397
  pageIndex: $$props.pageIndex
269
398
  };
270
399
  }
271
- const menuPlacement = { suggestTop: false, spaceAbove: 0, spaceBelow: 0 };
272
400
  function buildMenuProps(rect, menuWrapperProps) {
401
+ const effectiveAngle = (($.get(annotationRotation) + $$props.rotation * 90) % 360 + 360) % 360;
402
+ const handleNearMenuSide = $.get(effectiveIsRotatable) && effectiveAngle > 90 && effectiveAngle < 270;
273
403
  return {
274
404
  context: buildContext(),
275
405
  selected: $$props.isSelected,
276
406
  rect,
277
- placement: menuPlacement,
407
+ placement: { suggestTop: handleNearMenuSide, spaceAbove: 0, spaceBelow: 0 },
278
408
  menuWrapperProps
279
409
  };
280
410
  }
411
+ function portalToBody(node) {
412
+ document.body.appendChild(node);
413
+ return {
414
+ destroy() {
415
+ if (node.parentNode === document.body) {
416
+ document.body.removeChild(node);
417
+ }
418
+ }
419
+ };
420
+ }
281
421
  var div = root$c();
282
422
  var div_1 = $.child(div);
283
423
  $.attribute_effect(div_1, () => ({
284
- ...$.get(effectiveIsDraggable) && $$props.isSelected ? interactionHandles.dragProps : {},
285
424
  style: $$props.style || "",
286
425
  class: propsClass(),
287
426
  ...restProps,
@@ -289,23 +428,182 @@ function AnnotationContainer($$anchor, $$props) {
289
428
  position: "absolute",
290
429
  left: `${$.get(currentObject).rect.origin.x * $$props.scale}px`,
291
430
  top: `${$.get(currentObject).rect.origin.y * $$props.scale}px`,
292
- width: `${$.get(currentObject).rect.size.width * $$props.scale}px`,
293
- height: `${$.get(currentObject).rect.size.height * $$props.scale}px`,
294
- outline: $.get(showOutline) ? `1px solid ${selectionOutlineColor()}` : "none",
295
- "outline-offset": $.get(showOutline) ? `${outlineOffset()}px` : "0px",
296
- "pointer-events": $$props.isSelected && !isMultiSelected() ? "auto" : "none",
297
- "touch-action": "none",
298
- cursor: $$props.isSelected && $.get(effectiveIsDraggable) ? "move" : "default",
431
+ width: `${$.get(aabbWidth) ?? ""}px`,
432
+ height: `${$.get(aabbHeight) ?? ""}px`,
433
+ "pointer-events": "none",
299
434
  "z-index": zIndex()
300
435
  }
301
436
  }));
302
- var node = $.child(div_1);
437
+ var node_1 = $.child(div_1);
303
438
  {
304
439
  var consequent = ($$anchor2) => {
305
- var fragment = $.comment();
306
- var node_1 = $.first_child(fragment);
307
- $.snippet(node_1, () => $$props.customAnnotationRenderer ?? $.noop, () => ({
308
- annotation: $.get(currentObject),
440
+ var fragment = root_1$c();
441
+ var div_2 = $.first_child(fragment);
442
+ let styles;
443
+ var div_3 = $.sibling(div_2, 2);
444
+ let styles_1;
445
+ var div_4 = $.sibling(div_3, 2);
446
+ let styles_2;
447
+ $.template_effect(() => {
448
+ styles = $.set_style(div_2, "", styles, {
449
+ position: "absolute",
450
+ left: `${$.get(centerX) - $.get(guideLength) / 2}px`,
451
+ top: `${$.get(centerY) ?? ""}px`,
452
+ width: `${$.get(guideLength) ?? ""}px`,
453
+ height: "1px",
454
+ "background-color": $.get(ROTATION_CONNECTOR_COLOR),
455
+ opacity: "0.35",
456
+ "pointer-events": "none"
457
+ });
458
+ styles_1 = $.set_style(div_3, "", styles_1, {
459
+ position: "absolute",
460
+ left: `${$.get(centerX) ?? ""}px`,
461
+ top: `${$.get(centerY) - $.get(guideLength) / 2}px`,
462
+ width: "1px",
463
+ height: `${$.get(guideLength) ?? ""}px`,
464
+ "background-color": $.get(ROTATION_CONNECTOR_COLOR),
465
+ opacity: "0.35",
466
+ "pointer-events": "none"
467
+ });
468
+ styles_2 = $.set_style(div_4, "", styles_2, {
469
+ position: "absolute",
470
+ left: `${$.get(centerX) - $.get(guideLength) / 2}px`,
471
+ top: `${$.get(centerY) ?? ""}px`,
472
+ width: `${$.get(guideLength) ?? ""}px`,
473
+ height: "1px",
474
+ "transform-origin": "center center",
475
+ transform: `rotate(${$.get(annotationRotation) ?? ""}deg)`,
476
+ "background-color": $.get(ROTATION_CONNECTOR_COLOR),
477
+ opacity: "0.8",
478
+ "pointer-events": "none"
479
+ });
480
+ });
481
+ $.append($$anchor2, fragment);
482
+ };
483
+ $.if(node_1, ($$render) => {
484
+ if ($.get(rotationActive)) $$render(consequent);
485
+ });
486
+ }
487
+ var node_2 = $.sibling(node_1, 2);
488
+ {
489
+ var consequent_3 = ($$anchor2) => {
490
+ var fragment_1 = $.comment();
491
+ var node_3 = $.first_child(fragment_1);
492
+ {
493
+ var consequent_1 = ($$anchor3) => {
494
+ var div_5 = root_3$1();
495
+ div_5.__pointermove = (e) => {
496
+ if (!$.get(rotationActive)) $.set(cursorScreen, { x: e.clientX, y: e.clientY }, true);
497
+ };
498
+ var node_4 = $.child(div_5);
499
+ {
500
+ let $0 = $.derived(() => ({
501
+ ...$.get(rotationHandle).handle,
502
+ backgroundColor: $.get(ROTATION_COLOR),
503
+ iconColor: $.get(ROTATION_ICON_COLOR),
504
+ connectorStyle: `${$.get(rotationHandle).connector.style}; background-color: ${$.get(ROTATION_CONNECTOR_COLOR)}; opacity: ${$.get(rotationActive) ? 0 : 1};`,
505
+ showConnector: $.get(SHOW_CONNECTOR),
506
+ opacity: $.get(rotationActive) ? 0 : 1,
507
+ border: {
508
+ color: $.get(ROTATION_BORDER_COLOR),
509
+ width: $.get(ROTATION_BORDER_WIDTH),
510
+ style: $.get(ROTATION_BORDER_STYLE)
511
+ }
512
+ }));
513
+ $.snippet(node_4, () => $$props.rotationUI.component, () => $.get($0));
514
+ }
515
+ $.reset(div_5);
516
+ $.event("pointerenter", div_5, () => $.set(isHandleHovered, true));
517
+ $.event("pointerleave", div_5, () => {
518
+ $.set(isHandleHovered, false);
519
+ $.set(cursorScreen, null);
520
+ });
521
+ $.append($$anchor3, div_5);
522
+ };
523
+ var alternate = ($$anchor3) => {
524
+ var div_6 = root_4$2();
525
+ div_6.__pointermove = (e) => {
526
+ if (!$.get(rotationActive)) $.set(cursorScreen, { x: e.clientX, y: e.clientY }, true);
527
+ };
528
+ var node_5 = $.child(div_6);
529
+ {
530
+ var consequent_2 = ($$anchor4) => {
531
+ var div_7 = root_5$2();
532
+ $.template_effect(() => $.set_style(div_7, `${$.get(rotationHandle).connector.style ?? ""}; background-color: ${$.get(ROTATION_CONNECTOR_COLOR) ?? ""}; opacity: ${$.get(rotationActive) ? 0 : 1};`));
533
+ $.append($$anchor4, div_7);
534
+ };
535
+ $.if(node_5, ($$render) => {
536
+ if ($.get(SHOW_CONNECTOR)) $$render(consequent_2);
537
+ });
538
+ }
539
+ var div_8 = $.sibling(node_5, 2);
540
+ $.attribute_effect(div_8, () => ({
541
+ ...{
542
+ onpointerdown: $.get(rotationHandle).handle.onpointerdown,
543
+ onpointermove: $.get(rotationHandle).handle.onpointermove,
544
+ onpointerup: $.get(rotationHandle).handle.onpointerup,
545
+ onpointercancel: $.get(rotationHandle).handle.onpointercancel
546
+ },
547
+ style: `${$.get(rotationHandle).handle.style ?? ""}; background-color: ${$.get(ROTATION_COLOR) ?? ""}; border: ${$.get(ROTATION_BORDER_WIDTH) ?? ""}px ${$.get(ROTATION_BORDER_STYLE) ?? ""} ${$.get(ROTATION_BORDER_COLOR) ?? ""}; box-sizing: border-box; display: flex; align-items: center; justify-content: center; pointer-events: auto; opacity: ${$.get(rotationActive) ? 0 : 1};`
548
+ }));
549
+ var svg = $.child(div_8);
550
+ $.reset(div_8);
551
+ $.reset(div_6);
552
+ $.template_effect(
553
+ ($0, $1) => {
554
+ $.set_attribute(svg, "width", $0);
555
+ $.set_attribute(svg, "height", $1);
556
+ $.set_attribute(svg, "stroke", $.get(ROTATION_ICON_COLOR));
557
+ },
558
+ [
559
+ () => Math.round($.get(ROTATION_SIZE) * 0.6),
560
+ () => Math.round($.get(ROTATION_SIZE) * 0.6)
561
+ ]
562
+ );
563
+ $.event("pointerenter", div_6, () => $.set(isHandleHovered, true));
564
+ $.event("pointerleave", div_6, () => {
565
+ $.set(isHandleHovered, false);
566
+ $.set(cursorScreen, null);
567
+ });
568
+ $.append($$anchor3, div_6);
569
+ };
570
+ $.if(node_3, ($$render) => {
571
+ var _a;
572
+ if ((_a = $$props.rotationUI) == null ? void 0 : _a.component) $$render(consequent_1);
573
+ else $$render(alternate, false);
574
+ });
575
+ }
576
+ $.append($$anchor2, fragment_1);
577
+ };
578
+ $.if(node_2, ($$render) => {
579
+ if ($$props.isSelected && $.get(effectiveIsRotatable) && $.get(rotationHandle)) $$render(consequent_3);
580
+ });
581
+ }
582
+ var div_9 = $.sibling(node_2, 2);
583
+ $.attribute_effect(div_9, () => ({
584
+ ...$.get(effectiveIsDraggable) && $$props.isSelected ? interactionHandles.dragProps : {},
585
+ [$.STYLE]: {
586
+ position: "absolute",
587
+ left: `${$.get(innerLeft) ?? ""}px`,
588
+ top: `${$.get(innerTop) ?? ""}px`,
589
+ width: `${$.get(innerWidth) ?? ""}px`,
590
+ height: `${$.get(innerHeight) ?? ""}px`,
591
+ transform: $.get(annotationRotation) !== 0 ? `rotate(${$.get(annotationRotation)}deg)` : void 0,
592
+ "transform-origin": $.get(innerTransformOrigin),
593
+ outline: $.get(showOutline) ? `${$.get(outlineWidth)}px ${$.get(outlineStyleVal)} ${$.get(outlineColor)}` : "none",
594
+ "outline-offset": $.get(showOutline) ? `${$.get(outlineOff)}px` : "0px",
595
+ "pointer-events": $$props.isSelected && !isMultiSelected() ? "auto" : "none",
596
+ "touch-action": "none",
597
+ cursor: $$props.isSelected && $.get(effectiveIsDraggable) ? "move" : "default"
598
+ }
599
+ }));
600
+ var node_6 = $.child(div_9);
601
+ {
602
+ var consequent_4 = ($$anchor2) => {
603
+ var fragment_2 = $.comment();
604
+ var node_7 = $.first_child(fragment_2);
605
+ $.snippet(node_7, () => $$props.customAnnotationRenderer ?? $.noop, () => ({
606
+ annotation: $.get(childObject),
309
607
  children: $$props.children,
310
608
  isSelected: $$props.isSelected,
311
609
  scale: $$props.scale,
@@ -315,172 +613,173 @@ function AnnotationContainer($$anchor, $$props) {
315
613
  pageIndex: $$props.pageIndex,
316
614
  onSelect: $$props.onSelect
317
615
  }));
318
- $.append($$anchor2, fragment);
616
+ $.append($$anchor2, fragment_2);
319
617
  };
320
- var alternate = ($$anchor2) => {
321
- var fragment_1 = $.comment();
322
- var node_2 = $.first_child(fragment_1);
323
- $.snippet(node_2, () => $$props.children, () => $.get(currentObject));
324
- $.append($$anchor2, fragment_1);
618
+ var alternate_1 = ($$anchor2) => {
619
+ var fragment_3 = $.comment();
620
+ var node_8 = $.first_child(fragment_3);
621
+ $.snippet(node_8, () => $$props.children, () => $.get(childObject));
622
+ $.append($$anchor2, fragment_3);
325
623
  };
326
- $.if(node, ($$render) => {
327
- if ($$props.customAnnotationRenderer) $$render(consequent);
328
- else $$render(alternate, false);
624
+ $.if(node_6, ($$render) => {
625
+ if ($$props.customAnnotationRenderer) $$render(consequent_4);
626
+ else $$render(alternate_1, false);
329
627
  });
330
628
  }
331
- var node_3 = $.sibling(node, 2);
629
+ var node_9 = $.sibling(node_6, 2);
332
630
  {
333
- var consequent_2 = ($$anchor2) => {
334
- var fragment_2 = $.comment();
335
- var node_4 = $.first_child(fragment_2);
336
- $.each(node_4, 17, () => $.get(resizeHandles), ({ key, style: handleStyle, ...hProps }) => key, ($$anchor3, $$item) => {
631
+ var consequent_6 = ($$anchor2) => {
632
+ var fragment_4 = $.comment();
633
+ var node_10 = $.first_child(fragment_4);
634
+ $.each(node_10, 17, () => $.get(resizeHandles), ({ key, style: handleStyle, ...hProps }) => key, ($$anchor3, $$item) => {
337
635
  let handleStyle = () => $.get($$item).style;
338
636
  let hProps = () => $.exclude_from_object($.get($$item), ["key", "style"]);
339
- var fragment_3 = $.comment();
340
- var node_5 = $.first_child(fragment_3);
637
+ var fragment_5 = $.comment();
638
+ var node_11 = $.first_child(fragment_5);
341
639
  {
342
- var consequent_1 = ($$anchor4) => {
343
- const Component = $.derived(() => $$props.resizeUI.component);
344
- var fragment_4 = $.comment();
345
- var node_6 = $.first_child(fragment_4);
346
- $.component(node_6, () => $.get(Component), ($$anchor5, Component_1) => {
347
- Component_1($$anchor5, $.spread_props(hProps, {
348
- get backgroundColor() {
349
- return $.get(HANDLE_COLOR);
350
- }
640
+ var consequent_5 = ($$anchor4) => {
641
+ var fragment_6 = $.comment();
642
+ var node_12 = $.first_child(fragment_6);
643
+ {
644
+ let $0 = $.derived(() => ({
645
+ ...hProps(),
646
+ style: handleStyle(),
647
+ backgroundColor: $.get(HANDLE_COLOR)
351
648
  }));
352
- });
353
- $.append($$anchor4, fragment_4);
649
+ $.snippet(node_12, () => $$props.resizeUI.component, () => $.get($0));
650
+ }
651
+ $.append($$anchor4, fragment_6);
354
652
  };
355
- var alternate_1 = ($$anchor4) => {
356
- var div_2 = root_6$1();
357
- $.attribute_effect(div_2, () => ({
653
+ var alternate_2 = ($$anchor4) => {
654
+ var div_10 = root_11$2();
655
+ $.attribute_effect(div_10, () => ({
358
656
  ...hProps(),
359
657
  style: `${handleStyle() ?? ""}; background-color: ${$.get(HANDLE_COLOR) ?? ""};`
360
658
  }));
361
- $.append($$anchor4, div_2);
659
+ $.append($$anchor4, div_10);
362
660
  };
363
- $.if(node_5, ($$render) => {
661
+ $.if(node_11, ($$render) => {
364
662
  var _a;
365
- if ((_a = $$props.resizeUI) == null ? void 0 : _a.component) $$render(consequent_1);
366
- else $$render(alternate_1, false);
663
+ if ((_a = $$props.resizeUI) == null ? void 0 : _a.component) $$render(consequent_5);
664
+ else $$render(alternate_2, false);
367
665
  });
368
666
  }
369
- $.append($$anchor3, fragment_3);
667
+ $.append($$anchor3, fragment_5);
370
668
  });
371
- $.append($$anchor2, fragment_2);
669
+ $.append($$anchor2, fragment_4);
372
670
  };
373
- $.if(node_3, ($$render) => {
374
- if ($$props.isSelected && $.get(effectiveIsResizable)) $$render(consequent_2);
671
+ $.if(node_9, ($$render) => {
672
+ if ($$props.isSelected && $.get(effectiveIsResizable) && !$.get(rotationActive)) $$render(consequent_6);
375
673
  });
376
674
  }
377
- var node_7 = $.sibling(node_3, 2);
675
+ var node_13 = $.sibling(node_9, 2);
378
676
  {
379
- var consequent_4 = ($$anchor2) => {
380
- var fragment_5 = $.comment();
381
- var node_8 = $.first_child(fragment_5);
382
- $.each(node_8, 17, () => $.get(vertexHandles), ({ key, style: vertexStyle, ...vProps }) => key, ($$anchor3, $$item) => {
677
+ var consequent_8 = ($$anchor2) => {
678
+ var fragment_7 = $.comment();
679
+ var node_14 = $.first_child(fragment_7);
680
+ $.each(node_14, 17, () => $.get(vertexHandles), ({ key, style: vertexStyle, ...vProps }) => key, ($$anchor3, $$item) => {
383
681
  let vertexStyle = () => $.get($$item).style;
384
682
  let vProps = () => $.exclude_from_object($.get($$item), ["key", "style"]);
385
- var fragment_6 = $.comment();
386
- var node_9 = $.first_child(fragment_6);
683
+ var fragment_8 = $.comment();
684
+ var node_15 = $.first_child(fragment_8);
387
685
  {
388
- var consequent_3 = ($$anchor4) => {
389
- const Component = $.derived(() => $$props.vertexUI.component);
390
- var fragment_7 = $.comment();
391
- var node_10 = $.first_child(fragment_7);
392
- $.component(node_10, () => $.get(Component), ($$anchor5, Component_2) => {
393
- Component_2($$anchor5, $.spread_props(vProps, {
394
- get backgroundColor() {
395
- return $.get(VERTEX_COLOR);
396
- }
686
+ var consequent_7 = ($$anchor4) => {
687
+ var fragment_9 = $.comment();
688
+ var node_16 = $.first_child(fragment_9);
689
+ {
690
+ let $0 = $.derived(() => ({
691
+ ...vProps(),
692
+ style: vertexStyle(),
693
+ backgroundColor: $.get(VERTEX_COLOR)
397
694
  }));
398
- });
399
- $.append($$anchor4, fragment_7);
695
+ $.snippet(node_16, () => $$props.vertexUI.component, () => $.get($0));
696
+ }
697
+ $.append($$anchor4, fragment_9);
400
698
  };
401
- var alternate_2 = ($$anchor4) => {
402
- var div_3 = root_10();
403
- $.attribute_effect(div_3, () => ({
699
+ var alternate_3 = ($$anchor4) => {
700
+ var div_11 = root_15();
701
+ $.attribute_effect(div_11, () => ({
404
702
  ...vProps(),
405
703
  style: `${vertexStyle() ?? ""}; background-color: ${$.get(VERTEX_COLOR) ?? ""};`
406
704
  }));
407
- $.append($$anchor4, div_3);
705
+ $.append($$anchor4, div_11);
408
706
  };
409
- $.if(node_9, ($$render) => {
707
+ $.if(node_15, ($$render) => {
410
708
  var _a;
411
- if ((_a = $$props.vertexUI) == null ? void 0 : _a.component) $$render(consequent_3);
412
- else $$render(alternate_2, false);
709
+ if ((_a = $$props.vertexUI) == null ? void 0 : _a.component) $$render(consequent_7);
710
+ else $$render(alternate_3, false);
413
711
  });
414
712
  }
415
- $.append($$anchor3, fragment_6);
713
+ $.append($$anchor3, fragment_8);
416
714
  });
417
- $.append($$anchor2, fragment_5);
715
+ $.append($$anchor2, fragment_7);
418
716
  };
419
- $.if(node_7, ($$render) => {
420
- if ($$props.isSelected && permissions.canModifyAnnotations && !isMultiSelected()) $$render(consequent_4);
717
+ $.if(node_13, ($$render) => {
718
+ if ($$props.isSelected && permissions.canModifyAnnotations && !isMultiSelected() && !$.get(rotationActive)) $$render(consequent_8);
421
719
  });
422
720
  }
423
- $.reset(div_1);
424
- $.action(div_1, ($$node, $$action_arg) => {
721
+ $.reset(div_9);
722
+ $.action(div_9, ($$node, $$action_arg) => {
425
723
  var _a;
426
724
  return (_a = doublePress) == null ? void 0 : _a($$node, $$action_arg);
427
725
  }, () => ({ onDouble: $.get(guardedOnDoubleClick) }));
428
- var node_11 = $.sibling(div_1, 2);
726
+ $.reset(div_1);
727
+ var node_17 = $.sibling(div_1, 2);
429
728
  {
430
- var consequent_8 = ($$anchor2) => {
729
+ var consequent_12 = ($$anchor2) => {
431
730
  {
432
731
  const children = ($$anchor3, $$arg0) => {
433
732
  let rect = () => $$arg0 == null ? void 0 : $$arg0().rect;
434
733
  let menuWrapperProps = () => $$arg0 == null ? void 0 : $$arg0().menuWrapperProps;
435
734
  const menuProps = $.derived(() => buildMenuProps(rect(), menuWrapperProps()));
436
- var fragment_9 = $.comment();
437
- var node_12 = $.first_child(fragment_9);
735
+ var fragment_11 = $.comment();
736
+ var node_18 = $.first_child(fragment_11);
438
737
  {
439
- var consequent_6 = ($$anchor4) => {
738
+ var consequent_10 = ($$anchor4) => {
440
739
  const result = $.derived(() => $$props.selectionMenu($.get(menuProps)));
441
- var fragment_10 = $.comment();
442
- var node_13 = $.first_child(fragment_10);
740
+ var fragment_12 = $.comment();
741
+ var node_19 = $.first_child(fragment_12);
443
742
  {
444
- var consequent_5 = ($$anchor5) => {
445
- var fragment_11 = $.comment();
446
- var node_14 = $.first_child(fragment_11);
447
- $.component(node_14, () => $.get(result).component, ($$anchor6, result_component) => {
743
+ var consequent_9 = ($$anchor5) => {
744
+ var fragment_13 = $.comment();
745
+ var node_20 = $.first_child(fragment_13);
746
+ $.component(node_20, () => $.get(result).component, ($$anchor6, result_component) => {
448
747
  result_component($$anchor6, $.spread_props(() => $.get(result).props));
449
748
  });
450
- $.append($$anchor5, fragment_11);
749
+ $.append($$anchor5, fragment_13);
451
750
  };
452
- $.if(node_13, ($$render) => {
453
- if ($.get(result)) $$render(consequent_5);
751
+ $.if(node_19, ($$render) => {
752
+ if ($.get(result)) $$render(consequent_9);
454
753
  });
455
754
  }
456
- $.append($$anchor4, fragment_10);
755
+ $.append($$anchor4, fragment_12);
457
756
  };
458
- var alternate_3 = ($$anchor4) => {
459
- var fragment_12 = $.comment();
460
- var node_15 = $.first_child(fragment_12);
757
+ var alternate_4 = ($$anchor4) => {
758
+ var fragment_14 = $.comment();
759
+ var node_21 = $.first_child(fragment_14);
461
760
  {
462
- var consequent_7 = ($$anchor5) => {
463
- var fragment_13 = $.comment();
464
- var node_16 = $.first_child(fragment_13);
465
- $.snippet(node_16, () => $$props.selectionMenuSnippet, () => $.get(menuProps));
466
- $.append($$anchor5, fragment_13);
761
+ var consequent_11 = ($$anchor5) => {
762
+ var fragment_15 = $.comment();
763
+ var node_22 = $.first_child(fragment_15);
764
+ $.snippet(node_22, () => $$props.selectionMenuSnippet, () => $.get(menuProps));
765
+ $.append($$anchor5, fragment_15);
467
766
  };
468
767
  $.if(
469
- node_15,
768
+ node_21,
470
769
  ($$render) => {
471
- if ($$props.selectionMenuSnippet) $$render(consequent_7);
770
+ if ($$props.selectionMenuSnippet) $$render(consequent_11);
472
771
  },
473
772
  true
474
773
  );
475
774
  }
476
- $.append($$anchor4, fragment_12);
775
+ $.append($$anchor4, fragment_14);
477
776
  };
478
- $.if(node_12, ($$render) => {
479
- if ($$props.selectionMenu) $$render(consequent_6);
480
- else $$render(alternate_3, false);
777
+ $.if(node_18, ($$render) => {
778
+ if ($$props.selectionMenu) $$render(consequent_10);
779
+ else $$render(alternate_4, false);
481
780
  });
482
781
  }
483
- $.append($$anchor3, fragment_9);
782
+ $.append($$anchor3, fragment_11);
484
783
  };
485
784
  let $0 = $.derived(() => ({
486
785
  origin: {
@@ -504,14 +803,51 @@ function AnnotationContainer($$anchor, $$props) {
504
803
  });
505
804
  }
506
805
  };
507
- $.if(node_11, ($$render) => {
508
- if ($.get(shouldShowMenu)) $$render(consequent_8);
806
+ $.if(node_17, ($$render) => {
807
+ if ($.get(shouldShowMenu)) $$render(consequent_12);
808
+ });
809
+ }
810
+ var node_23 = $.sibling(node_17, 2);
811
+ {
812
+ var consequent_13 = ($$anchor2) => {
813
+ var div_12 = root_22();
814
+ var div_13 = $.child(div_12);
815
+ let styles_3;
816
+ var text = $.child(div_13);
817
+ $.reset(div_13);
818
+ $.reset(div_12);
819
+ $.action(div_12, ($$node) => portalToBody == null ? void 0 : portalToBody($$node));
820
+ $.template_effect(
821
+ ($0) => {
822
+ styles_3 = $.set_style(div_13, "", styles_3, {
823
+ position: "fixed",
824
+ left: `${$.get(cursorScreen).x + 16}px`,
825
+ top: `${$.get(cursorScreen).y - 16}px`,
826
+ background: "rgba(0,0,0,0.8)",
827
+ color: "#fff",
828
+ padding: "4px 8px",
829
+ "border-radius": "4px",
830
+ "font-size": "12px",
831
+ "font-family": "monospace",
832
+ "pointer-events": "none",
833
+ "z-index": "10000",
834
+ "white-space": "nowrap"
835
+ });
836
+ $.set_text(text, `${$0 ?? ""}°`);
837
+ },
838
+ [() => $.get(normalizedRotationDisplay).toFixed(0)]
839
+ );
840
+ $.append($$anchor2, div_12);
841
+ };
842
+ $.if(node_23, ($$render) => {
843
+ if (($.get(rotationActive) || $.get(isHandleHovered)) && $.get(cursorScreen)) $$render(consequent_13);
509
844
  });
510
845
  }
511
846
  $.reset(div);
512
847
  $.append($$anchor, div);
513
848
  $.pop();
514
849
  }
850
+ $.delegate(["pointermove"]);
515
851
  var root_1$b = $.from_html(`<div></div>`);
516
852
  function Highlight($$anchor, $$props) {
517
853
  $.push($$props, true);
@@ -904,7 +1240,7 @@ function Circle($$anchor, $$props) {
904
1240
  }
905
1241
  $.delegate(["pointerdown", "touchstart"]);
906
1242
  var root_1$6 = $.from_svg(`<path></path>`);
907
- var root_2$4 = $.from_svg(`<path></path>`);
1243
+ var root_2$5 = $.from_svg(`<path></path>`);
908
1244
  var root$8 = $.from_svg(`<svg><line></line><!><!></svg>`);
909
1245
  function Line($$anchor, $$props) {
910
1246
  $.push($$props, true);
@@ -974,7 +1310,7 @@ function Line($$anchor, $$props) {
974
1310
  var node_1 = $.sibling(node);
975
1311
  {
976
1312
  var consequent_1 = ($$anchor2) => {
977
- var path_1 = root_2$4();
1313
+ var path_1 = root_2$5();
978
1314
  path_1.__pointerdown = function(...$$args) {
979
1315
  var _a;
980
1316
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -1028,7 +1364,7 @@ function Line($$anchor, $$props) {
1028
1364
  }
1029
1365
  $.delegate(["pointerdown", "touchstart"]);
1030
1366
  var root_1$5 = $.from_svg(`<path></path>`);
1031
- var root_2$3 = $.from_svg(`<path></path>`);
1367
+ var root_2$4 = $.from_svg(`<path></path>`);
1032
1368
  var root$7 = $.from_svg(`<svg><path></path><!><!></svg>`);
1033
1369
  function Polyline($$anchor, $$props) {
1034
1370
  $.push($$props, true);
@@ -1117,7 +1453,7 @@ function Polyline($$anchor, $$props) {
1117
1453
  var node_1 = $.sibling(node);
1118
1454
  {
1119
1455
  var consequent_1 = ($$anchor2) => {
1120
- var path_2 = root_2$3();
1456
+ var path_2 = root_2$4();
1121
1457
  path_2.__pointerdown = function(...$$args) {
1122
1458
  var _a;
1123
1459
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -1168,7 +1504,7 @@ function Polyline($$anchor, $$props) {
1168
1504
  }
1169
1505
  $.delegate(["pointerdown", "touchstart"]);
1170
1506
  var root_1$4 = $.from_svg(`<path fill="none"></path>`);
1171
- var root_2$2 = $.from_svg(`<rect></rect>`);
1507
+ var root_2$3 = $.from_svg(`<rect></rect>`);
1172
1508
  var root$6 = $.from_svg(`<svg><path></path><!><!></svg>`);
1173
1509
  function Polygon($$anchor, $$props) {
1174
1510
  $.push($$props, true);
@@ -1223,7 +1559,7 @@ function Polygon($$anchor, $$props) {
1223
1559
  var node_1 = $.sibling(node);
1224
1560
  {
1225
1561
  var consequent_1 = ($$anchor2) => {
1226
- var rect_1 = root_2$2();
1562
+ var rect_1 = root_2$3();
1227
1563
  $.set_attribute(rect_1, "opacity", 0.4);
1228
1564
  $.template_effect(() => {
1229
1565
  $.set_attribute(rect_1, "x", $.get(localPts)[0].x - handleSize() / $$props.scale / 2);
@@ -1263,7 +1599,7 @@ function Polygon($$anchor, $$props) {
1263
1599
  $.pop();
1264
1600
  }
1265
1601
  $.delegate(["pointerdown", "touchstart"]);
1266
- var root$5 = $.from_html(`<div><span tabindex="0"> </span></div>`);
1602
+ var root$5 = $.from_html(`<div role="button"><span role="textbox" tabindex="0"> </span></div>`);
1267
1603
  function FreeText($$anchor, $$props) {
1268
1604
  $.push($$props, true);
1269
1605
  const annotationCapability = useAnnotationCapability();
@@ -1304,7 +1640,9 @@ function FreeText($$anchor, $$props) {
1304
1640
  const outerW = $.derived(() => $$props.annotation.object.rect.size.width * $$props.scale);
1305
1641
  const outerH = $.derived(() => $$props.annotation.object.rect.size.height * $$props.scale);
1306
1642
  const justify = $.derived(() => $$props.annotation.object.verticalAlign === PdfVerticalAlignment.Top ? "flex-start" : $$props.annotation.object.verticalAlign === PdfVerticalAlignment.Middle ? "center" : "flex-end");
1643
+ const fontCss = $.derived(() => standardFontCssProperties($$props.annotation.object.fontFamily));
1307
1644
  var div = root$5();
1645
+ $.set_attribute(div, "tabindex", -1);
1308
1646
  div.__pointerdown = function(...$$args) {
1309
1647
  var _a;
1310
1648
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
@@ -1341,7 +1679,9 @@ function FreeText($$anchor, $$props) {
1341
1679
  "justify-content": $.get(justify),
1342
1680
  color: $$props.annotation.object.fontColor,
1343
1681
  "font-size": `${$.get(adjustedFontPx)}px`,
1344
- "font-family": standardFontCss($$props.annotation.object.fontFamily),
1682
+ "font-family": $.get(fontCss).fontFamily,
1683
+ "font-weight": $.get(fontCss).fontWeight,
1684
+ "font-style": $.get(fontCss).fontStyle,
1345
1685
  "text-align": textAlignmentToCss($$props.annotation.object.textAlign),
1346
1686
  "background-color": $$props.annotation.object.color ?? $$props.annotation.object.backgroundColor,
1347
1687
  opacity: $$props.annotation.object.opacity,
@@ -1364,7 +1704,7 @@ $.delegate(["pointerdown", "touchstart"]);
1364
1704
  var root_1$3 = $.from_html(`<img/>`);
1365
1705
  function RenderAnnotation($$anchor, $$props) {
1366
1706
  $.push($$props, true);
1367
- let scaleFactor = $.prop($$props, "scaleFactor", 3, 1), restProps = $.rest_props($$props, [
1707
+ let scaleFactor = $.prop($$props, "scaleFactor", 3, 1), unrotated = $.prop($$props, "unrotated", 3, false), restProps = $.rest_props($$props, [
1368
1708
  "$$slots",
1369
1709
  "$$events",
1370
1710
  "$$legacy",
@@ -1372,6 +1712,7 @@ function RenderAnnotation($$anchor, $$props) {
1372
1712
  "pageIndex",
1373
1713
  "annotation",
1374
1714
  "scaleFactor",
1715
+ "unrotated",
1375
1716
  "style"
1376
1717
  ]);
1377
1718
  const annotationCapability = useAnnotationCapability();
@@ -1386,7 +1727,11 @@ function RenderAnnotation($$anchor, $$props) {
1386
1727
  const task = $.get(annotationProvides).renderAnnotation({
1387
1728
  pageIndex: $$props.pageIndex,
1388
1729
  annotation: deepToRaw($$props.annotation),
1389
- options: { scaleFactor: scaleFactor(), dpr: window.devicePixelRatio }
1730
+ options: {
1731
+ scaleFactor: scaleFactor(),
1732
+ dpr: window.devicePixelRatio,
1733
+ unrotated: unrotated()
1734
+ }
1390
1735
  });
1391
1736
  task.wait(
1392
1737
  (blob) => {
@@ -1438,14 +1783,16 @@ function RenderAnnotation($$anchor, $$props) {
1438
1783
  $.append($$anchor, fragment);
1439
1784
  $.pop();
1440
1785
  }
1441
- var root$4 = $.from_html(`<div><!></div>`);
1786
+ var root$4 = $.from_html(`<div role="button"><!></div>`);
1442
1787
  function Stamp($$anchor, $$props) {
1443
1788
  $.push($$props, true);
1444
1789
  let annotationProp = $.derived(() => ({
1445
1790
  ...$$props.annotation.object,
1446
1791
  id: $$props.annotation.object.id
1447
1792
  }));
1793
+ const unrotated = $.derived(() => !!$$props.annotation.object.rotation && !!$$props.annotation.object.unrotatedRect);
1448
1794
  var div = root$4();
1795
+ $.set_attribute(div, "tabindex", -1);
1449
1796
  let styles;
1450
1797
  div.__pointerdown = function(...$$args) {
1451
1798
  var _a;
@@ -1468,6 +1815,9 @@ function Stamp($$anchor, $$props) {
1468
1815
  },
1469
1816
  get scaleFactor() {
1470
1817
  return $$props.scale;
1818
+ },
1819
+ get unrotated() {
1820
+ return $.get(unrotated);
1471
1821
  }
1472
1822
  });
1473
1823
  $.reset(div);
@@ -1480,7 +1830,7 @@ function Stamp($$anchor, $$props) {
1480
1830
  }
1481
1831
  $.delegate(["pointerdown", "touchstart"]);
1482
1832
  var root_1$2 = $.from_svg(`<line></line>`);
1483
- var root_2$1 = $.from_svg(`<rect fill="transparent"></rect>`);
1833
+ var root_2$2 = $.from_svg(`<rect fill="transparent"></rect>`);
1484
1834
  var root$3 = $.from_svg(`<svg><rect fill="transparent"></rect><!></svg>`);
1485
1835
  function Link($$anchor, $$props) {
1486
1836
  $.push($$props, true);
@@ -1530,7 +1880,7 @@ function Link($$anchor, $$props) {
1530
1880
  $.append($$anchor2, line);
1531
1881
  };
1532
1882
  var alternate = ($$anchor2) => {
1533
- var rect_2 = root_2$1();
1883
+ var rect_2 = root_2$2();
1534
1884
  $.set_style(rect_2, "", {}, { "pointer-events": "none" });
1535
1885
  $.template_effect(
1536
1886
  ($0, $1) => {
@@ -1574,18 +1924,27 @@ function Link($$anchor, $$props) {
1574
1924
  $.pop();
1575
1925
  }
1576
1926
  $.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>`);
1927
+ var root_2$1 = $.from_html(`<div></div> <div></div> <div></div>`, 1);
1928
+ var root_4$1 = $.from_html(`<div style="display: contents;"><!></div>`);
1929
+ var root_6$1 = $.from_html(`<div></div>`);
1930
+ var root_5$1 = $.from_html(`<div style="display: contents;"><!> <div><svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></div></div>`);
1931
+ var root_10 = $.from_html(`<div></div>`);
1932
+ var root_11$1 = $.from_html(`<div><div> </div></div>`);
1933
+ var root_1$1 = $.from_html(`<div data-group-selection-box="" data-no-interaction=""><div><!> <!> <div><!></div></div> <!> <!></div>`);
1579
1934
  function GroupSelectionBox($$anchor, $$props) {
1580
1935
  $.push($$props, true);
1581
- let selectionOutlineColor = $.prop($$props, "selectionOutlineColor", 3, "#007ACC"), outlineOffset = $.prop($$props, "outlineOffset", 3, 2), zIndex = $.prop($$props, "zIndex", 3, 100);
1936
+ let isRotatable = $.prop($$props, "isRotatable", 3, true), lockAspectRatio = $.prop($$props, "lockAspectRatio", 3, false), zIndex = $.prop($$props, "zIndex", 3, 2);
1582
1937
  const annotationPlugin = useAnnotationPlugin();
1583
1938
  const permissions = useDocumentPermissions(() => $$props.documentId);
1584
1939
  let gestureBase = $.state(null);
1585
1940
  let isDraggingRef = $.state(false);
1586
1941
  let isResizingRef = $.state(false);
1942
+ let liveRotation = $.state(null);
1943
+ let cursorScreen = $.state(null);
1944
+ let isHandleHovered = $.state(false);
1587
1945
  const effectiveIsDraggable = $.derived(() => permissions.canModifyAnnotations && $$props.isDraggable);
1588
1946
  const effectiveIsResizable = $.derived(() => permissions.canModifyAnnotations && $$props.isResizable);
1947
+ const effectiveIsRotatable = $.derived(() => permissions.canModifyAnnotations && isRotatable());
1589
1948
  function getGroupBox() {
1590
1949
  const rects = $$props.selectedAnnotations.map((ta) => ta.object.rect);
1591
1950
  return boundingRectOrEmpty(rects);
@@ -1600,6 +1959,17 @@ function GroupSelectionBox($$anchor, $$props) {
1600
1959
  }
1601
1960
  }
1602
1961
  });
1962
+ $.user_effect(() => {
1963
+ const plugin = annotationPlugin.plugin;
1964
+ if (!plugin) return;
1965
+ const unsubscribe = plugin.onRotateChange((event) => {
1966
+ if (event.documentId !== $$props.documentId) return;
1967
+ if (event.type === "end" || event.type === "cancel") {
1968
+ $.set(liveRotation, null);
1969
+ }
1970
+ });
1971
+ return unsubscribe;
1972
+ });
1603
1973
  const HANDLE_COLOR = $.derived(() => {
1604
1974
  var _a;
1605
1975
  return ((_a = $$props.resizeUI) == null ? void 0 : _a.color) ?? "#007ACC";
@@ -1608,6 +1978,66 @@ function GroupSelectionBox($$anchor, $$props) {
1608
1978
  var _a;
1609
1979
  return ((_a = $$props.resizeUI) == null ? void 0 : _a.size) ?? 12;
1610
1980
  });
1981
+ const ROTATION_COLOR = $.derived(() => {
1982
+ var _a;
1983
+ return ((_a = $$props.rotationUI) == null ? void 0 : _a.color) ?? "white";
1984
+ });
1985
+ const ROTATION_CONNECTOR_COLOR = $.derived(() => {
1986
+ var _a;
1987
+ return ((_a = $$props.rotationUI) == null ? void 0 : _a.connectorColor) ?? "#007ACC";
1988
+ });
1989
+ const ROTATION_SIZE = $.derived(() => {
1990
+ var _a;
1991
+ return ((_a = $$props.rotationUI) == null ? void 0 : _a.size) ?? 32;
1992
+ });
1993
+ const ROTATION_MARGIN = $.derived(() => {
1994
+ var _a;
1995
+ return (_a = $$props.rotationUI) == null ? void 0 : _a.margin;
1996
+ });
1997
+ const ROTATION_ICON_COLOR = $.derived(() => {
1998
+ var _a;
1999
+ return ((_a = $$props.rotationUI) == null ? void 0 : _a.iconColor) ?? "#007ACC";
2000
+ });
2001
+ const SHOW_CONNECTOR = $.derived(() => {
2002
+ var _a;
2003
+ return ((_a = $$props.rotationUI) == null ? void 0 : _a.showConnector) ?? false;
2004
+ });
2005
+ const ROTATION_BORDER_COLOR = $.derived(() => {
2006
+ var _a, _b;
2007
+ return ((_b = (_a = $$props.rotationUI) == null ? void 0 : _a.border) == null ? void 0 : _b.color) ?? "#007ACC";
2008
+ });
2009
+ const ROTATION_BORDER_WIDTH = $.derived(() => {
2010
+ var _a, _b;
2011
+ return ((_b = (_a = $$props.rotationUI) == null ? void 0 : _a.border) == null ? void 0 : _b.width) ?? 1;
2012
+ });
2013
+ const ROTATION_BORDER_STYLE = $.derived(() => {
2014
+ var _a, _b;
2015
+ return ((_b = (_a = $$props.rotationUI) == null ? void 0 : _a.border) == null ? void 0 : _b.style) ?? "solid";
2016
+ });
2017
+ const outlineColor = $.derived(() => {
2018
+ var _a;
2019
+ return ((_a = $$props.selectionOutline) == null ? void 0 : _a.color) ?? $$props.selectionOutlineColor ?? "#007ACC";
2020
+ });
2021
+ const outlineStyleVal = $.derived(() => {
2022
+ var _a;
2023
+ return ((_a = $$props.selectionOutline) == null ? void 0 : _a.style) ?? "dashed";
2024
+ });
2025
+ const outlineWidthVal = $.derived(() => {
2026
+ var _a;
2027
+ return ((_a = $$props.selectionOutline) == null ? void 0 : _a.width) ?? 2;
2028
+ });
2029
+ const outlineOff = $.derived(() => {
2030
+ var _a;
2031
+ return ((_a = $$props.selectionOutline) == null ? void 0 : _a.offset) ?? $$props.outlineOffset ?? 2;
2032
+ });
2033
+ const groupRotationDisplay = $.derived(() => $.get(liveRotation) ?? 0);
2034
+ const rotationActive = $.derived(() => $.get(liveRotation) !== null);
2035
+ const normalizedRotationDisplay = $.derived(() => Number.isFinite($.get(groupRotationDisplay)) ? Math.round($.get(groupRotationDisplay) * 10) / 10 : 0);
2036
+ const groupBoxWidth = $.derived(() => $.get(previewGroupBox).size.width * $$props.scale);
2037
+ const groupBoxHeight = $.derived(() => $.get(previewGroupBox).size.height * $$props.scale);
2038
+ const groupCenterX = $.derived(() => $.get(groupBoxWidth) / 2);
2039
+ const groupCenterY = $.derived(() => $.get(groupBoxHeight) / 2);
2040
+ const groupGuideLength = $.derived(() => Math.max(300, Math.max($.get(groupBoxWidth), $.get(groupBoxHeight)) + 80));
1611
2041
  const interactionHandles = useInteractionHandles(() => ({
1612
2042
  controller: {
1613
2043
  element: $.get(previewGroupBox),
@@ -1616,12 +2046,12 @@ function GroupSelectionBox($$anchor, $$props) {
1616
2046
  minHeight: 20,
1617
2047
  boundingBox: { width: $$props.pageWidth, height: $$props.pageHeight }
1618
2048
  },
1619
- maintainAspectRatio: false,
2049
+ maintainAspectRatio: lockAspectRatio(),
1620
2050
  pageRotation: $$props.rotation,
1621
2051
  scale: $$props.scale,
1622
2052
  enabled: true,
1623
2053
  onUpdate: (event) => {
1624
- var _a, _b;
2054
+ var _a, _b, _c, _d, _e, _f;
1625
2055
  if (!((_a = event.transformData) == null ? void 0 : _a.type)) return;
1626
2056
  if (!annotationPlugin.plugin) return;
1627
2057
  const plugin = annotationPlugin.plugin;
@@ -1646,6 +2076,29 @@ function GroupSelectionBox($$anchor, $$props) {
1646
2076
  });
1647
2077
  }
1648
2078
  }
2079
+ if (transformType === "rotate") {
2080
+ if (!isRotatable()) return;
2081
+ const ids = $$props.selectedAnnotations.map((ta) => ta.object.id);
2082
+ const cursorAngle = ((_c = event.transformData.metadata) == null ? void 0 : _c.rotationAngle) ?? 0;
2083
+ const cursorPos = (_d = event.transformData.metadata) == null ? void 0 : _d.cursorPosition;
2084
+ if (cursorPos) $.set(cursorScreen, { x: cursorPos.clientX, y: cursorPos.clientY }, true);
2085
+ if (event.state === "start") {
2086
+ $.set(liveRotation, cursorAngle, true);
2087
+ plugin.startRotation($$props.documentId, {
2088
+ annotationIds: ids,
2089
+ cursorAngle,
2090
+ rotationCenter: (_e = event.transformData.metadata) == null ? void 0 : _e.rotationCenter
2091
+ });
2092
+ } else if (event.state === "move") {
2093
+ $.set(liveRotation, cursorAngle, true);
2094
+ plugin.updateRotation($$props.documentId, cursorAngle, (_f = event.transformData.metadata) == null ? void 0 : _f.rotationDelta);
2095
+ } else if (event.state === "end") {
2096
+ $.set(liveRotation, null);
2097
+ $.set(cursorScreen, null);
2098
+ plugin.commitRotation($$props.documentId);
2099
+ }
2100
+ return;
2101
+ }
1649
2102
  const base = $.get(gestureBase) ?? getGroupBox();
1650
2103
  if (isMove && event.transformData.changes.rect) {
1651
2104
  const newRect = event.transformData.changes.rect;
@@ -1684,15 +2137,24 @@ function GroupSelectionBox($$anchor, $$props) {
1684
2137
  },
1685
2138
  resizeUI: {
1686
2139
  handleSize: $.get(HANDLE_SIZE),
1687
- spacing: outlineOffset(),
2140
+ spacing: $.get(outlineOff),
1688
2141
  offsetMode: "outside",
1689
- includeSides: true,
2142
+ includeSides: !lockAspectRatio(),
1690
2143
  zIndex: zIndex() + 1
1691
2144
  },
1692
2145
  vertexUI: { vertexSize: 0, zIndex: zIndex() },
1693
- includeVertices: false
2146
+ rotationUI: {
2147
+ handleSize: $.get(ROTATION_SIZE),
2148
+ margin: $.get(ROTATION_MARGIN),
2149
+ zIndex: zIndex() + 2,
2150
+ showConnector: $.get(SHOW_CONNECTOR)
2151
+ },
2152
+ includeVertices: false,
2153
+ includeRotation: $.get(effectiveIsRotatable),
2154
+ currentRotation: $.get(liveRotation) ?? 0
1694
2155
  }));
1695
2156
  const resizeHandles = $.derived(() => interactionHandles.resize);
2157
+ const rotationHandle = $.derived(() => interactionHandles.rotation);
1696
2158
  const shouldShowMenu = $.derived(() => !!$$props.groupSelectionMenu || !!$$props.groupSelectionMenuSnippet);
1697
2159
  function buildContext() {
1698
2160
  return {
@@ -1702,134 +2164,334 @@ function GroupSelectionBox($$anchor, $$props) {
1702
2164
  };
1703
2165
  }
1704
2166
  function buildMenuProps(rect, menuWrapperProps) {
2167
+ const effectiveAngle = (($.get(groupRotationDisplay) + $$props.rotation * 90) % 360 + 360) % 360;
2168
+ const handleNearMenuSide = $.get(effectiveIsRotatable) && effectiveAngle > 90 && effectiveAngle < 270;
1705
2169
  return {
1706
2170
  context: buildContext(),
1707
2171
  selected: true,
1708
2172
  rect,
1709
- placement: { suggestTop: false },
2173
+ placement: { suggestTop: handleNearMenuSide },
1710
2174
  menuWrapperProps
1711
2175
  };
1712
2176
  }
2177
+ function portalToBody(node) {
2178
+ document.body.appendChild(node);
2179
+ return {
2180
+ destroy() {
2181
+ if (node.parentNode === document.body) {
2182
+ document.body.removeChild(node);
2183
+ }
2184
+ }
2185
+ };
2186
+ }
1713
2187
  var fragment = $.comment();
1714
- var node = $.first_child(fragment);
2188
+ var node_1 = $.first_child(fragment);
1715
2189
  {
1716
- var consequent_6 = ($$anchor2) => {
2190
+ var consequent_11 = ($$anchor2) => {
1717
2191
  var div = root_1$1();
1718
2192
  var div_1 = $.child(div);
1719
- $.attribute_effect(div_1, () => ({
2193
+ let styles;
2194
+ var node_2 = $.child(div_1);
2195
+ {
2196
+ var consequent = ($$anchor3) => {
2197
+ var fragment_1 = root_2$1();
2198
+ var div_2 = $.first_child(fragment_1);
2199
+ let styles_1;
2200
+ var div_3 = $.sibling(div_2, 2);
2201
+ let styles_2;
2202
+ var div_4 = $.sibling(div_3, 2);
2203
+ let styles_3;
2204
+ $.template_effect(() => {
2205
+ styles_1 = $.set_style(div_2, "", styles_1, {
2206
+ position: "absolute",
2207
+ left: `${$.get(groupCenterX) - $.get(groupGuideLength) / 2}px`,
2208
+ top: `${$.get(groupCenterY) ?? ""}px`,
2209
+ width: `${$.get(groupGuideLength) ?? ""}px`,
2210
+ height: "1px",
2211
+ "background-color": $.get(HANDLE_COLOR),
2212
+ opacity: "0.35",
2213
+ "pointer-events": "none"
2214
+ });
2215
+ styles_2 = $.set_style(div_3, "", styles_2, {
2216
+ position: "absolute",
2217
+ left: `${$.get(groupCenterX) ?? ""}px`,
2218
+ top: `${$.get(groupCenterY) - $.get(groupGuideLength) / 2}px`,
2219
+ width: "1px",
2220
+ height: `${$.get(groupGuideLength) ?? ""}px`,
2221
+ "background-color": $.get(HANDLE_COLOR),
2222
+ opacity: "0.35",
2223
+ "pointer-events": "none"
2224
+ });
2225
+ styles_3 = $.set_style(div_4, "", styles_3, {
2226
+ position: "absolute",
2227
+ left: `${$.get(groupCenterX) - $.get(groupGuideLength) / 2}px`,
2228
+ top: `${$.get(groupCenterY) ?? ""}px`,
2229
+ width: `${$.get(groupGuideLength) ?? ""}px`,
2230
+ height: "1px",
2231
+ "transform-origin": "center center",
2232
+ transform: `rotate(${$.get(groupRotationDisplay) ?? ""}deg)`,
2233
+ "background-color": $.get(HANDLE_COLOR),
2234
+ opacity: "0.8",
2235
+ "pointer-events": "none"
2236
+ });
2237
+ });
2238
+ $.append($$anchor3, fragment_1);
2239
+ };
2240
+ $.if(node_2, ($$render) => {
2241
+ if ($.get(rotationActive)) $$render(consequent);
2242
+ });
2243
+ }
2244
+ var node_3 = $.sibling(node_2, 2);
2245
+ {
2246
+ var consequent_3 = ($$anchor3) => {
2247
+ var fragment_2 = $.comment();
2248
+ var node_4 = $.first_child(fragment_2);
2249
+ {
2250
+ var consequent_1 = ($$anchor4) => {
2251
+ var div_5 = root_4$1();
2252
+ div_5.__pointermove = (e) => {
2253
+ if (!$.get(rotationActive)) $.set(cursorScreen, { x: e.clientX, y: e.clientY }, true);
2254
+ };
2255
+ var node_5 = $.child(div_5);
2256
+ {
2257
+ let $0 = $.derived(() => ({
2258
+ ...$.get(rotationHandle).handle,
2259
+ backgroundColor: $.get(ROTATION_COLOR),
2260
+ iconColor: $.get(ROTATION_ICON_COLOR),
2261
+ connectorStyle: `${$.get(rotationHandle).connector.style}; background-color: ${$.get(ROTATION_CONNECTOR_COLOR)}; opacity: ${$.get(rotationActive) ? 0 : 1};`,
2262
+ showConnector: $.get(SHOW_CONNECTOR),
2263
+ opacity: $.get(rotationActive) ? 0 : 1,
2264
+ border: {
2265
+ color: $.get(ROTATION_BORDER_COLOR),
2266
+ width: $.get(ROTATION_BORDER_WIDTH),
2267
+ style: $.get(ROTATION_BORDER_STYLE)
2268
+ }
2269
+ }));
2270
+ $.snippet(node_5, () => $$props.rotationUI.component, () => $.get($0));
2271
+ }
2272
+ $.reset(div_5);
2273
+ $.event("pointerenter", div_5, () => $.set(isHandleHovered, true));
2274
+ $.event("pointerleave", div_5, () => {
2275
+ $.set(isHandleHovered, false);
2276
+ $.set(cursorScreen, null);
2277
+ });
2278
+ $.append($$anchor4, div_5);
2279
+ };
2280
+ var alternate = ($$anchor4) => {
2281
+ var div_6 = root_5$1();
2282
+ div_6.__pointermove = (e) => {
2283
+ if (!$.get(rotationActive)) $.set(cursorScreen, { x: e.clientX, y: e.clientY }, true);
2284
+ };
2285
+ var node_6 = $.child(div_6);
2286
+ {
2287
+ var consequent_2 = ($$anchor5) => {
2288
+ var div_7 = root_6$1();
2289
+ $.template_effect(() => $.set_style(div_7, `${$.get(rotationHandle).connector.style ?? ""}; background-color: ${$.get(ROTATION_CONNECTOR_COLOR) ?? ""}; opacity: ${$.get(rotationActive) ? 0 : 1};`));
2290
+ $.append($$anchor5, div_7);
2291
+ };
2292
+ $.if(node_6, ($$render) => {
2293
+ if ($.get(SHOW_CONNECTOR)) $$render(consequent_2);
2294
+ });
2295
+ }
2296
+ var div_8 = $.sibling(node_6, 2);
2297
+ $.attribute_effect(div_8, () => ({
2298
+ ...{
2299
+ onpointerdown: $.get(rotationHandle).handle.onpointerdown,
2300
+ onpointermove: $.get(rotationHandle).handle.onpointermove,
2301
+ onpointerup: $.get(rotationHandle).handle.onpointerup,
2302
+ onpointercancel: $.get(rotationHandle).handle.onpointercancel
2303
+ },
2304
+ style: `${$.get(rotationHandle).handle.style ?? ""}; background-color: ${$.get(ROTATION_COLOR) ?? ""}; border: ${$.get(ROTATION_BORDER_WIDTH) ?? ""}px ${$.get(ROTATION_BORDER_STYLE) ?? ""} ${$.get(ROTATION_BORDER_COLOR) ?? ""}; box-sizing: border-box; display: flex; align-items: center; justify-content: center; pointer-events: auto; opacity: ${$.get(rotationActive) ? 0 : 1};`
2305
+ }));
2306
+ var svg = $.child(div_8);
2307
+ $.reset(div_8);
2308
+ $.reset(div_6);
2309
+ $.template_effect(
2310
+ ($0, $1) => {
2311
+ $.set_attribute(svg, "width", $0);
2312
+ $.set_attribute(svg, "height", $1);
2313
+ $.set_attribute(svg, "stroke", $.get(ROTATION_ICON_COLOR));
2314
+ },
2315
+ [
2316
+ () => Math.round($.get(ROTATION_SIZE) * 0.6),
2317
+ () => Math.round($.get(ROTATION_SIZE) * 0.6)
2318
+ ]
2319
+ );
2320
+ $.event("pointerenter", div_6, () => $.set(isHandleHovered, true));
2321
+ $.event("pointerleave", div_6, () => {
2322
+ $.set(isHandleHovered, false);
2323
+ $.set(cursorScreen, null);
2324
+ });
2325
+ $.append($$anchor4, div_6);
2326
+ };
2327
+ $.if(node_4, ($$render) => {
2328
+ var _a;
2329
+ if ((_a = $$props.rotationUI) == null ? void 0 : _a.component) $$render(consequent_1);
2330
+ else $$render(alternate, false);
2331
+ });
2332
+ }
2333
+ $.append($$anchor3, fragment_2);
2334
+ };
2335
+ $.if(node_3, ($$render) => {
2336
+ if ($.get(effectiveIsRotatable) && $.get(rotationHandle)) $$render(consequent_3);
2337
+ });
2338
+ }
2339
+ var div_9 = $.sibling(node_3, 2);
2340
+ $.attribute_effect(div_9, () => ({
1720
2341
  ...$.get(effectiveIsDraggable) ? interactionHandles.dragProps : { onpointerdown: (e) => e.stopPropagation() },
1721
2342
  [$.STYLE]: {
1722
2343
  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`,
2344
+ left: "0px",
2345
+ top: "0px",
2346
+ width: `${$.get(groupBoxWidth) ?? ""}px`,
2347
+ height: `${$.get(groupBoxHeight) ?? ""}px`,
2348
+ outline: $.get(rotationActive) ? "none" : `${$.get(outlineWidthVal)}px ${$.get(outlineStyleVal)} ${$.get(outlineColor)}`,
2349
+ "outline-offset": `${$.get(outlineOff) - 1}px`,
1729
2350
  cursor: $.get(effectiveIsDraggable) ? "move" : "default",
1730
2351
  "touch-action": "none",
1731
- "z-index": zIndex()
2352
+ "pointer-events": "auto"
1732
2353
  }
1733
2354
  }));
1734
- var node_1 = $.child(div_1);
2355
+ var node_7 = $.child(div_9);
1735
2356
  {
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) => {
2357
+ var consequent_5 = ($$anchor3) => {
2358
+ var fragment_3 = $.comment();
2359
+ var node_8 = $.first_child(fragment_3);
2360
+ $.each(node_8, 17, () => $.get(resizeHandles), ({ key, style: handleStyle, ...hProps }) => key, ($$anchor4, $$item) => {
1740
2361
  let handleStyle = () => $.get($$item).style;
1741
2362
  let hProps = () => $.exclude_from_object($.get($$item), ["key", "style"]);
1742
- var fragment_2 = $.comment();
1743
- var node_3 = $.first_child(fragment_2);
2363
+ var fragment_4 = $.comment();
2364
+ var node_9 = $.first_child(fragment_4);
1744
2365
  {
1745
- var consequent = ($$anchor5) => {
1746
- var fragment_3 = $.comment();
1747
- var node_4 = $.first_child(fragment_3);
2366
+ var consequent_4 = ($$anchor5) => {
2367
+ var fragment_5 = $.comment();
2368
+ var node_10 = $.first_child(fragment_5);
1748
2369
  {
1749
- let $0 = $.derived(() => ({ ...hProps(), backgroundColor: $.get(HANDLE_COLOR) }));
1750
- $.snippet(node_4, () => $$props.resizeUI.component, () => $.get($0));
2370
+ let $0 = $.derived(() => ({
2371
+ ...hProps(),
2372
+ style: handleStyle(),
2373
+ backgroundColor: $.get(HANDLE_COLOR)
2374
+ }));
2375
+ $.snippet(node_10, () => $$props.resizeUI.component, () => $.get($0));
1751
2376
  }
1752
- $.append($$anchor5, fragment_3);
2377
+ $.append($$anchor5, fragment_5);
1753
2378
  };
1754
- var alternate = ($$anchor5) => {
1755
- var div_2 = root_5$1();
1756
- $.attribute_effect(div_2, () => ({
2379
+ var alternate_1 = ($$anchor5) => {
2380
+ var div_10 = root_10();
2381
+ $.attribute_effect(div_10, () => ({
1757
2382
  ...hProps(),
1758
2383
  style: `${handleStyle() ?? ""}; background-color: ${$.get(HANDLE_COLOR) ?? ""};`
1759
2384
  }));
1760
- $.append($$anchor5, div_2);
2385
+ $.append($$anchor5, div_10);
1761
2386
  };
1762
- $.if(node_3, ($$render) => {
2387
+ $.if(node_9, ($$render) => {
1763
2388
  var _a;
1764
- if ((_a = $$props.resizeUI) == null ? void 0 : _a.component) $$render(consequent);
1765
- else $$render(alternate, false);
2389
+ if ((_a = $$props.resizeUI) == null ? void 0 : _a.component) $$render(consequent_4);
2390
+ else $$render(alternate_1, false);
1766
2391
  });
1767
2392
  }
1768
- $.append($$anchor4, fragment_2);
2393
+ $.append($$anchor4, fragment_4);
1769
2394
  });
1770
- $.append($$anchor3, fragment_1);
2395
+ $.append($$anchor3, fragment_3);
1771
2396
  };
1772
- $.if(node_1, ($$render) => {
1773
- if ($.get(effectiveIsResizable)) $$render(consequent_1);
2397
+ $.if(node_7, ($$render) => {
2398
+ if ($.get(effectiveIsResizable) && !$.get(rotationActive)) $$render(consequent_5);
1774
2399
  });
1775
2400
  }
2401
+ $.reset(div_9);
1776
2402
  $.reset(div_1);
1777
- var node_5 = $.sibling(div_1, 2);
2403
+ var node_11 = $.sibling(div_1, 2);
1778
2404
  {
1779
- var consequent_5 = ($$anchor3) => {
2405
+ var consequent_6 = ($$anchor3) => {
2406
+ var div_11 = root_11$1();
2407
+ var div_12 = $.child(div_11);
2408
+ let styles_4;
2409
+ var text = $.child(div_12);
2410
+ $.reset(div_12);
2411
+ $.reset(div_11);
2412
+ $.action(div_11, ($$node) => portalToBody == null ? void 0 : portalToBody($$node));
2413
+ $.template_effect(
2414
+ ($0) => {
2415
+ styles_4 = $.set_style(div_12, "", styles_4, {
2416
+ position: "fixed",
2417
+ left: `${$.get(cursorScreen).x + 16}px`,
2418
+ top: `${$.get(cursorScreen).y - 16}px`,
2419
+ background: "rgba(0,0,0,0.8)",
2420
+ color: "#fff",
2421
+ padding: "4px 8px",
2422
+ "border-radius": "4px",
2423
+ "font-size": "12px",
2424
+ "font-family": "monospace",
2425
+ "pointer-events": "none",
2426
+ "z-index": "10000",
2427
+ "white-space": "nowrap"
2428
+ });
2429
+ $.set_text(text, `${$0 ?? ""}°`);
2430
+ },
2431
+ [() => $.get(normalizedRotationDisplay).toFixed(0)]
2432
+ );
2433
+ $.append($$anchor3, div_11);
2434
+ };
2435
+ $.if(node_11, ($$render) => {
2436
+ if (($.get(rotationActive) || $.get(isHandleHovered)) && $.get(cursorScreen)) $$render(consequent_6);
2437
+ });
2438
+ }
2439
+ var node_12 = $.sibling(node_11, 2);
2440
+ {
2441
+ var consequent_10 = ($$anchor3) => {
1780
2442
  {
1781
2443
  const children = ($$anchor4, $$arg0) => {
1782
2444
  let rect = () => $$arg0 == null ? void 0 : $$arg0().rect;
1783
2445
  let menuWrapperProps = () => $$arg0 == null ? void 0 : $$arg0().menuWrapperProps;
1784
2446
  const menuProps = $.derived(() => buildMenuProps(rect(), menuWrapperProps()));
1785
- var fragment_5 = $.comment();
1786
- var node_6 = $.first_child(fragment_5);
2447
+ var fragment_7 = $.comment();
2448
+ var node_13 = $.first_child(fragment_7);
1787
2449
  {
1788
- var consequent_3 = ($$anchor5) => {
2450
+ var consequent_8 = ($$anchor5) => {
1789
2451
  const result = $.derived(() => $$props.groupSelectionMenu($.get(menuProps)));
1790
- var fragment_6 = $.comment();
1791
- var node_7 = $.first_child(fragment_6);
2452
+ var fragment_8 = $.comment();
2453
+ var node_14 = $.first_child(fragment_8);
1792
2454
  {
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) => {
2455
+ var consequent_7 = ($$anchor6) => {
2456
+ var fragment_9 = $.comment();
2457
+ var node_15 = $.first_child(fragment_9);
2458
+ $.component(node_15, () => $.get(result).component, ($$anchor7, result_component) => {
1797
2459
  result_component($$anchor7, $.spread_props(() => $.get(result).props));
1798
2460
  });
1799
- $.append($$anchor6, fragment_7);
2461
+ $.append($$anchor6, fragment_9);
1800
2462
  };
1801
- $.if(node_7, ($$render) => {
1802
- if ($.get(result)) $$render(consequent_2);
2463
+ $.if(node_14, ($$render) => {
2464
+ if ($.get(result)) $$render(consequent_7);
1803
2465
  });
1804
2466
  }
1805
- $.append($$anchor5, fragment_6);
2467
+ $.append($$anchor5, fragment_8);
1806
2468
  };
1807
- var alternate_1 = ($$anchor5) => {
1808
- var fragment_8 = $.comment();
1809
- var node_9 = $.first_child(fragment_8);
2469
+ var alternate_2 = ($$anchor5) => {
2470
+ var fragment_10 = $.comment();
2471
+ var node_16 = $.first_child(fragment_10);
1810
2472
  {
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);
2473
+ var consequent_9 = ($$anchor6) => {
2474
+ var fragment_11 = $.comment();
2475
+ var node_17 = $.first_child(fragment_11);
2476
+ $.snippet(node_17, () => $$props.groupSelectionMenuSnippet, () => $.get(menuProps));
2477
+ $.append($$anchor6, fragment_11);
1816
2478
  };
1817
2479
  $.if(
1818
- node_9,
2480
+ node_16,
1819
2481
  ($$render) => {
1820
- if ($$props.groupSelectionMenuSnippet) $$render(consequent_4);
2482
+ if ($$props.groupSelectionMenuSnippet) $$render(consequent_9);
1821
2483
  },
1822
2484
  true
1823
2485
  );
1824
2486
  }
1825
- $.append($$anchor5, fragment_8);
2487
+ $.append($$anchor5, fragment_10);
1826
2488
  };
1827
- $.if(node_6, ($$render) => {
1828
- if ($$props.groupSelectionMenu) $$render(consequent_3);
1829
- else $$render(alternate_1, false);
2489
+ $.if(node_13, ($$render) => {
2490
+ if ($$props.groupSelectionMenu) $$render(consequent_8);
2491
+ else $$render(alternate_2, false);
1830
2492
  });
1831
2493
  }
1832
- $.append($$anchor4, fragment_5);
2494
+ $.append($$anchor4, fragment_7);
1833
2495
  };
1834
2496
  let $0 = $.derived(() => ({
1835
2497
  origin: {
@@ -1853,20 +2515,30 @@ function GroupSelectionBox($$anchor, $$props) {
1853
2515
  });
1854
2516
  }
1855
2517
  };
1856
- $.if(node_5, ($$render) => {
1857
- if ($.get(shouldShowMenu)) $$render(consequent_5);
2518
+ $.if(node_12, ($$render) => {
2519
+ if ($.get(shouldShowMenu)) $$render(consequent_10);
1858
2520
  });
1859
2521
  }
1860
2522
  $.reset(div);
2523
+ $.template_effect(() => styles = $.set_style(div_1, "", styles, {
2524
+ position: "absolute",
2525
+ left: `${$.get(previewGroupBox).origin.x * $$props.scale}px`,
2526
+ top: `${$.get(previewGroupBox).origin.y * $$props.scale}px`,
2527
+ width: `${$.get(groupBoxWidth) ?? ""}px`,
2528
+ height: `${$.get(groupBoxHeight) ?? ""}px`,
2529
+ "pointer-events": "none",
2530
+ "z-index": zIndex()
2531
+ }));
1861
2532
  $.append($$anchor2, div);
1862
2533
  };
1863
- $.if(node, ($$render) => {
1864
- if ($$props.selectedAnnotations.length >= 2) $$render(consequent_6);
2534
+ $.if(node_1, ($$render) => {
2535
+ if ($$props.selectedAnnotations.length >= 2) $$render(consequent_11);
1865
2536
  });
1866
2537
  }
1867
2538
  $.append($$anchor, fragment);
1868
2539
  $.pop();
1869
2540
  }
2541
+ $.delegate(["pointermove"]);
1870
2542
  var root$2 = $.from_html(`<!> <!>`, 1);
1871
2543
  function Annotations($$anchor, $$props) {
1872
2544
  $.push($$props, true);
@@ -1955,6 +2627,26 @@ function Annotations($$anchor, $$props) {
1955
2627
  return (tool == null ? void 0 : tool.interaction.isGroupResizable) !== void 0 ? groupResizable : singleResizable;
1956
2628
  });
1957
2629
  });
2630
+ const areAllSelectedRotatable = $.derived(() => {
2631
+ if ($.get(selectedAnnotationsOnPage).length < 2) return false;
2632
+ return $.get(selectedAnnotationsOnPage).every((ta) => {
2633
+ var _a;
2634
+ const tool = (_a = $.get(annotationProvides)) == null ? void 0 : _a.findToolForAnnotation(ta.object);
2635
+ const groupRotatable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isGroupRotatable, ta.object, true);
2636
+ const singleRotatable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isRotatable, ta.object, true);
2637
+ return (tool == null ? void 0 : tool.interaction.isGroupRotatable) !== void 0 ? groupRotatable : singleRotatable;
2638
+ });
2639
+ });
2640
+ const shouldLockGroupAspectRatio = $.derived(() => {
2641
+ if ($.get(selectedAnnotationsOnPage).length < 2) return false;
2642
+ return $.get(selectedAnnotationsOnPage).some((ta) => {
2643
+ var _a;
2644
+ const tool = (_a = $.get(annotationProvides)) == null ? void 0 : _a.findToolForAnnotation(ta.object);
2645
+ const groupLock = resolveInteractionProp(tool == null ? void 0 : tool.interaction.lockGroupAspectRatio, ta.object, false);
2646
+ const singleLock = resolveInteractionProp(tool == null ? void 0 : tool.interaction.lockAspectRatio, ta.object, false);
2647
+ return (tool == null ? void 0 : tool.interaction.lockGroupAspectRatio) !== void 0 ? groupLock : singleLock;
2648
+ });
2649
+ });
1958
2650
  const allSelectedOnSamePage = $.derived(() => {
1959
2651
  if (!$.get(annotationProvides)) return false;
1960
2652
  if ($.get(allSelectedIds).length < 2) return false;
@@ -2000,14 +2692,17 @@ function Annotations($$anchor, $$props) {
2000
2692
  });
2001
2693
  $.append($$anchor4, fragment_3);
2002
2694
  };
2003
- let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2695
+ let $0 = $.derived(() => {
2696
+ var _a;
2697
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, false);
2698
+ });
2004
2699
  let $1 = $.derived(() => {
2005
2700
  var _a;
2006
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
2701
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false);
2007
2702
  });
2008
2703
  let $2 = $.derived(() => {
2009
2704
  var _a;
2010
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true) && !$.get(isMultiSelected);
2705
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isRotatable, $.get(annotation).object, false);
2011
2706
  });
2012
2707
  let $3 = $.derived(() => {
2013
2708
  var _a;
@@ -2021,12 +2716,18 @@ function Annotations($$anchor, $$props) {
2021
2716
  return $.get(annotation);
2022
2717
  },
2023
2718
  get isSelected() {
2024
- return $.get($0);
2719
+ return $.get(isSelected);
2720
+ },
2721
+ get isMultiSelected() {
2722
+ return $.get(isMultiSelected);
2025
2723
  },
2026
2724
  get isDraggable() {
2027
- return $.get($1);
2725
+ return $.get($0);
2028
2726
  },
2029
2727
  get isResizable() {
2728
+ return $.get($1);
2729
+ },
2730
+ get isRotatable() {
2030
2731
  return $.get($2);
2031
2732
  },
2032
2733
  get lockAspectRatio() {
@@ -2065,14 +2766,17 @@ function Annotations($$anchor, $$props) {
2065
2766
  onClick: (e) => handleClick(e, $.get(annotation))
2066
2767
  }));
2067
2768
  };
2068
- let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2769
+ let $0 = $.derived(() => {
2770
+ var _a;
2771
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true);
2772
+ });
2069
2773
  let $1 = $.derived(() => {
2070
2774
  var _a;
2071
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
2775
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true);
2072
2776
  });
2073
2777
  let $2 = $.derived(() => {
2074
2778
  var _a;
2075
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true) && !$.get(isMultiSelected);
2779
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isRotatable, $.get(annotation).object, true);
2076
2780
  });
2077
2781
  let $3 = $.derived(() => {
2078
2782
  var _a;
@@ -2086,12 +2790,18 @@ function Annotations($$anchor, $$props) {
2086
2790
  return $.get(annotation);
2087
2791
  },
2088
2792
  get isSelected() {
2089
- return $.get($0);
2793
+ return $.get(isSelected);
2794
+ },
2795
+ get isMultiSelected() {
2796
+ return $.get(isMultiSelected);
2090
2797
  },
2091
2798
  get isDraggable() {
2092
- return $.get($1);
2799
+ return $.get($0);
2093
2800
  },
2094
2801
  get isResizable() {
2802
+ return $.get($1);
2803
+ },
2804
+ get isRotatable() {
2095
2805
  return $.get($2);
2096
2806
  },
2097
2807
  get lockAspectRatio() {
@@ -2130,14 +2840,17 @@ function Annotations($$anchor, $$props) {
2130
2840
  onClick: (e) => handleClick(e, $.get(annotation))
2131
2841
  }));
2132
2842
  };
2133
- let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2843
+ let $0 = $.derived(() => {
2844
+ var _a;
2845
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true);
2846
+ });
2134
2847
  let $1 = $.derived(() => {
2135
2848
  var _a;
2136
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
2849
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true);
2137
2850
  });
2138
2851
  let $2 = $.derived(() => {
2139
2852
  var _a;
2140
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true) && !$.get(isMultiSelected);
2853
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isRotatable, $.get(annotation).object, true);
2141
2854
  });
2142
2855
  let $3 = $.derived(() => {
2143
2856
  var _a;
@@ -2151,12 +2864,18 @@ function Annotations($$anchor, $$props) {
2151
2864
  return $.get(annotation);
2152
2865
  },
2153
2866
  get isSelected() {
2154
- return $.get($0);
2867
+ return $.get(isSelected);
2868
+ },
2869
+ get isMultiSelected() {
2870
+ return $.get(isMultiSelected);
2155
2871
  },
2156
2872
  get isDraggable() {
2157
- return $.get($1);
2873
+ return $.get($0);
2158
2874
  },
2159
2875
  get isResizable() {
2876
+ return $.get($1);
2877
+ },
2878
+ get isRotatable() {
2160
2879
  return $.get($2);
2161
2880
  },
2162
2881
  get lockAspectRatio() {
@@ -2195,14 +2914,17 @@ function Annotations($$anchor, $$props) {
2195
2914
  onClick: (e) => handleClick(e, $.get(annotation))
2196
2915
  }));
2197
2916
  };
2198
- let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2917
+ let $0 = $.derived(() => {
2918
+ var _a;
2919
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true);
2920
+ });
2199
2921
  let $1 = $.derived(() => {
2200
2922
  var _a;
2201
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
2923
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true);
2202
2924
  });
2203
2925
  let $2 = $.derived(() => {
2204
2926
  var _a;
2205
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true) && !$.get(isMultiSelected);
2927
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isRotatable, $.get(annotation).object, true);
2206
2928
  });
2207
2929
  let $3 = $.derived(() => {
2208
2930
  var _a;
@@ -2216,12 +2938,18 @@ function Annotations($$anchor, $$props) {
2216
2938
  return $.get(annotation);
2217
2939
  },
2218
2940
  get isSelected() {
2219
- return $.get($0);
2941
+ return $.get(isSelected);
2942
+ },
2943
+ get isMultiSelected() {
2944
+ return $.get(isMultiSelected);
2220
2945
  },
2221
2946
  get isDraggable() {
2222
- return $.get($1);
2947
+ return $.get($0);
2223
2948
  },
2224
2949
  get isResizable() {
2950
+ return $.get($1);
2951
+ },
2952
+ get isRotatable() {
2225
2953
  return $.get($2);
2226
2954
  },
2227
2955
  get lockAspectRatio() {
@@ -2257,14 +2985,17 @@ function Annotations($$anchor, $$props) {
2257
2985
  onClick: (e) => handleClick(e, $.get(annotation))
2258
2986
  }));
2259
2987
  };
2260
- let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2988
+ let $0 = $.derived(() => {
2989
+ var _a;
2990
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, false);
2991
+ });
2261
2992
  let $1 = $.derived(() => {
2262
2993
  var _a;
2263
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, false) && !$.get(isMultiSelected);
2994
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false);
2264
2995
  });
2265
2996
  let $2 = $.derived(() => {
2266
2997
  var _a;
2267
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
2998
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isRotatable, $.get(annotation).object, false);
2268
2999
  });
2269
3000
  let $3 = $.derived(() => {
2270
3001
  var _a;
@@ -2278,12 +3009,18 @@ function Annotations($$anchor, $$props) {
2278
3009
  return $.get(annotation);
2279
3010
  },
2280
3011
  get isSelected() {
2281
- return $.get($0);
3012
+ return $.get(isSelected);
3013
+ },
3014
+ get isMultiSelected() {
3015
+ return $.get(isMultiSelected);
2282
3016
  },
2283
3017
  get isDraggable() {
2284
- return $.get($1);
3018
+ return $.get($0);
2285
3019
  },
2286
3020
  get isResizable() {
3021
+ return $.get($1);
3022
+ },
3023
+ get isRotatable() {
2287
3024
  return $.get($2);
2288
3025
  },
2289
3026
  get lockAspectRatio() {
@@ -2320,14 +3057,17 @@ function Annotations($$anchor, $$props) {
2320
3057
  onClick: (e) => handleClick(e, $.get(annotation))
2321
3058
  }));
2322
3059
  };
2323
- let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
3060
+ let $0 = $.derived(() => {
3061
+ var _a;
3062
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, false);
3063
+ });
2324
3064
  let $1 = $.derived(() => {
2325
3065
  var _a;
2326
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, false) && !$.get(isMultiSelected);
3066
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false);
2327
3067
  });
2328
3068
  let $2 = $.derived(() => {
2329
3069
  var _a;
2330
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
3070
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isRotatable, $.get(annotation).object, false);
2331
3071
  });
2332
3072
  let $3 = $.derived(() => {
2333
3073
  var _a;
@@ -2341,12 +3081,18 @@ function Annotations($$anchor, $$props) {
2341
3081
  return $.get(annotation);
2342
3082
  },
2343
3083
  get isSelected() {
2344
- return $.get($0);
3084
+ return $.get(isSelected);
3085
+ },
3086
+ get isMultiSelected() {
3087
+ return $.get(isMultiSelected);
2345
3088
  },
2346
3089
  get isDraggable() {
2347
- return $.get($1);
3090
+ return $.get($0);
2348
3091
  },
2349
3092
  get isResizable() {
3093
+ return $.get($1);
3094
+ },
3095
+ get isRotatable() {
2350
3096
  return $.get($2);
2351
3097
  },
2352
3098
  get lockAspectRatio() {
@@ -2383,14 +3129,17 @@ function Annotations($$anchor, $$props) {
2383
3129
  onClick: (e) => handleClick(e, $.get(annotation))
2384
3130
  }));
2385
3131
  };
2386
- let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
3132
+ let $0 = $.derived(() => {
3133
+ var _a;
3134
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, false);
3135
+ });
2387
3136
  let $1 = $.derived(() => {
2388
3137
  var _a;
2389
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, false) && !$.get(isMultiSelected);
3138
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false);
2390
3139
  });
2391
3140
  let $2 = $.derived(() => {
2392
3141
  var _a;
2393
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
3142
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isRotatable, $.get(annotation).object, false);
2394
3143
  });
2395
3144
  let $3 = $.derived(() => {
2396
3145
  var _a;
@@ -2404,12 +3153,18 @@ function Annotations($$anchor, $$props) {
2404
3153
  return $.get(annotation);
2405
3154
  },
2406
3155
  get isSelected() {
2407
- return $.get($0);
3156
+ return $.get(isSelected);
3157
+ },
3158
+ get isMultiSelected() {
3159
+ return $.get(isMultiSelected);
2408
3160
  },
2409
3161
  get isDraggable() {
2410
- return $.get($1);
3162
+ return $.get($0);
2411
3163
  },
2412
3164
  get isResizable() {
3165
+ return $.get($1);
3166
+ },
3167
+ get isRotatable() {
2413
3168
  return $.get($2);
2414
3169
  },
2415
3170
  get lockAspectRatio() {
@@ -2446,14 +3201,17 @@ function Annotations($$anchor, $$props) {
2446
3201
  onClick: (e) => handleClick(e, $.get(annotation))
2447
3202
  }));
2448
3203
  };
2449
- let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
3204
+ let $0 = $.derived(() => {
3205
+ var _a;
3206
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, false);
3207
+ });
2450
3208
  let $1 = $.derived(() => {
2451
3209
  var _a;
2452
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, false) && !$.get(isMultiSelected);
3210
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false);
2453
3211
  });
2454
3212
  let $2 = $.derived(() => {
2455
3213
  var _a;
2456
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
3214
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isRotatable, $.get(annotation).object, false);
2457
3215
  });
2458
3216
  let $3 = $.derived(() => {
2459
3217
  var _a;
@@ -2468,12 +3226,18 @@ function Annotations($$anchor, $$props) {
2468
3226
  return $.get(annotation);
2469
3227
  },
2470
3228
  get isSelected() {
2471
- return $.get($0);
3229
+ return $.get(isSelected);
3230
+ },
3231
+ get isMultiSelected() {
3232
+ return $.get(isMultiSelected);
2472
3233
  },
2473
3234
  get isDraggable() {
2474
- return $.get($1);
3235
+ return $.get($0);
2475
3236
  },
2476
3237
  get isResizable() {
3238
+ return $.get($1);
3239
+ },
3240
+ get isRotatable() {
2477
3241
  return $.get($2);
2478
3242
  },
2479
3243
  get lockAspectRatio() {
@@ -2513,14 +3277,17 @@ function Annotations($$anchor, $$props) {
2513
3277
  onClick: (e) => handleClick(e, $.get(annotation))
2514
3278
  }));
2515
3279
  };
2516
- let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
3280
+ let $0 = $.derived(() => {
3281
+ var _a;
3282
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true);
3283
+ });
2517
3284
  let $1 = $.derived(() => {
2518
3285
  var _a;
2519
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
3286
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false);
2520
3287
  });
2521
3288
  let $2 = $.derived(() => {
2522
3289
  var _a;
2523
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
3290
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isRotatable, $.get(annotation).object, true);
2524
3291
  });
2525
3292
  let $3 = $.derived(() => {
2526
3293
  var _a;
@@ -2534,12 +3301,18 @@ function Annotations($$anchor, $$props) {
2534
3301
  return $.get(annotation);
2535
3302
  },
2536
3303
  get isSelected() {
2537
- return $.get($0);
3304
+ return $.get(isSelected);
3305
+ },
3306
+ get isMultiSelected() {
3307
+ return $.get(isMultiSelected);
2538
3308
  },
2539
3309
  get isDraggable() {
2540
- return $.get($1);
3310
+ return $.get($0);
2541
3311
  },
2542
3312
  get isResizable() {
3313
+ return $.get($1);
3314
+ },
3315
+ get isRotatable() {
2543
3316
  return $.get($2);
2544
3317
  },
2545
3318
  get lockAspectRatio() {
@@ -2586,17 +3359,20 @@ function Annotations($$anchor, $$props) {
2586
3359
  let $1 = $.derived(() => $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2587
3360
  let $2 = $.derived(() => {
2588
3361
  var _a;
2589
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
3362
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true);
2590
3363
  });
2591
3364
  let $3 = $.derived(() => {
2592
3365
  var _a;
2593
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
3366
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false);
2594
3367
  });
2595
3368
  let $4 = $.derived(() => {
3369
+ var _a;
3370
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isRotatable, $.get(annotation).object, true);
3371
+ });
3372
+ let $5 = $.derived(() => {
2596
3373
  var _a;
2597
3374
  return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.lockAspectRatio, $.get(annotation).object, false);
2598
3375
  });
2599
- let $5 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
2600
3376
  AnnotationContainer($$anchor12, $.spread_props(
2601
3377
  {
2602
3378
  get trackedAnnotation() {
@@ -2614,12 +3390,18 @@ function Annotations($$anchor, $$props) {
2614
3390
  get isResizable() {
2615
3391
  return $.get($3);
2616
3392
  },
2617
- get lockAspectRatio() {
3393
+ get isRotatable() {
2618
3394
  return $.get($4);
2619
3395
  },
2620
- get isSelected() {
3396
+ get lockAspectRatio() {
2621
3397
  return $.get($5);
2622
3398
  },
3399
+ get isSelected() {
3400
+ return $.get(isSelected);
3401
+ },
3402
+ get isMultiSelected() {
3403
+ return $.get(isMultiSelected);
3404
+ },
2623
3405
  onSelect: (e) => handleClick(e, $.get(annotation)),
2624
3406
  vertexConfig: {
2625
3407
  extractVertices: (a) => a.vertices,
@@ -2651,14 +3433,17 @@ function Annotations($$anchor, $$props) {
2651
3433
  onClick: (e) => handleClick(e, $.get(annotation))
2652
3434
  }));
2653
3435
  };
2654
- let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
3436
+ let $0 = $.derived(() => {
3437
+ var _a;
3438
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true);
3439
+ });
2655
3440
  let $1 = $.derived(() => {
2656
3441
  var _a;
2657
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
3442
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false);
2658
3443
  });
2659
3444
  let $2 = $.derived(() => {
2660
3445
  var _a;
2661
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, false) && !$.get(isMultiSelected);
3446
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isRotatable, $.get(annotation).object, true);
2662
3447
  });
2663
3448
  let $3 = $.derived(() => {
2664
3449
  var _a;
@@ -2672,12 +3457,18 @@ function Annotations($$anchor, $$props) {
2672
3457
  return $.get(annotation);
2673
3458
  },
2674
3459
  get isSelected() {
2675
- return $.get($0);
3460
+ return $.get(isSelected);
3461
+ },
3462
+ get isMultiSelected() {
3463
+ return $.get(isMultiSelected);
2676
3464
  },
2677
3465
  get isDraggable() {
2678
- return $.get($1);
3466
+ return $.get($0);
2679
3467
  },
2680
3468
  get isResizable() {
3469
+ return $.get($1);
3470
+ },
3471
+ get isRotatable() {
2681
3472
  return $.get($2);
2682
3473
  },
2683
3474
  get lockAspectRatio() {
@@ -2735,14 +3526,17 @@ function Annotations($$anchor, $$props) {
2735
3526
  });
2736
3527
  }
2737
3528
  };
2738
- let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
3529
+ let $0 = $.derived(() => {
3530
+ var _a;
3531
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isEditing);
3532
+ });
2739
3533
  let $1 = $.derived(() => {
2740
3534
  var _a;
2741
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isEditing) && !$.get(isMultiSelected);
3535
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true);
2742
3536
  });
2743
3537
  let $2 = $.derived(() => {
2744
3538
  var _a;
2745
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true) && !$.get(isMultiSelected);
3539
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isRotatable, $.get(annotation).object, true);
2746
3540
  });
2747
3541
  let $3 = $.derived(() => {
2748
3542
  var _a;
@@ -2757,12 +3551,18 @@ function Annotations($$anchor, $$props) {
2757
3551
  return $.get(annotation);
2758
3552
  },
2759
3553
  get isSelected() {
2760
- return $.get($0);
3554
+ return $.get(isSelected);
3555
+ },
3556
+ get isMultiSelected() {
3557
+ return $.get(isMultiSelected);
2761
3558
  },
2762
3559
  get isDraggable() {
2763
- return $.get($1);
3560
+ return $.get($0);
2764
3561
  },
2765
3562
  get isResizable() {
3563
+ return $.get($1);
3564
+ },
3565
+ get isRotatable() {
2766
3566
  return $.get($2);
2767
3567
  },
2768
3568
  get lockAspectRatio() {
@@ -2814,14 +3614,17 @@ function Annotations($$anchor, $$props) {
2814
3614
  onClick: (e) => handleClick(e, $.get(annotation))
2815
3615
  });
2816
3616
  };
2817
- let $0 = $.derived(() => $.get(isSelected) && !$.get(isMultiSelected));
3617
+ let $0 = $.derived(() => {
3618
+ var _a;
3619
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true);
3620
+ });
2818
3621
  let $1 = $.derived(() => {
2819
3622
  var _a;
2820
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isDraggable, $.get(annotation).object, true) && !$.get(isMultiSelected);
3623
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true);
2821
3624
  });
2822
3625
  let $2 = $.derived(() => {
2823
3626
  var _a;
2824
- return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isResizable, $.get(annotation).object, true) && !$.get(isMultiSelected);
3627
+ return resolveInteractionProp((_a = $.get(tool)) == null ? void 0 : _a.interaction.isRotatable, $.get(annotation).object, true);
2825
3628
  });
2826
3629
  let $3 = $.derived(() => {
2827
3630
  var _a;
@@ -2835,12 +3638,18 @@ function Annotations($$anchor, $$props) {
2835
3638
  return $.get(annotation);
2836
3639
  },
2837
3640
  get isSelected() {
2838
- return $.get($0);
3641
+ return $.get(isSelected);
3642
+ },
3643
+ get isMultiSelected() {
3644
+ return $.get(isMultiSelected);
2839
3645
  },
2840
3646
  get isDraggable() {
2841
- return $.get($1);
3647
+ return $.get($0);
2842
3648
  },
2843
3649
  get isResizable() {
3650
+ return $.get($1);
3651
+ },
3652
+ get isRotatable() {
2844
3653
  return $.get($2);
2845
3654
  },
2846
3655
  get lockAspectRatio() {
@@ -2883,28 +3692,28 @@ function Annotations($$anchor, $$props) {
2883
3692
  }
2884
3693
  }));
2885
3694
  };
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);
3695
+ let $0 = $.derived(() => $.get(hasIRT) ? void 0 : $.get(isMultiSelected) ? void 0 : $$props.selectionMenu);
3696
+ let $1 = $.derived(() => $.get(hasIRT) ? void 0 : $.get(isMultiSelected) ? void 0 : $$props.selectionMenuSnippet);
2889
3697
  AnnotationContainer($$anchor16, $.spread_props(
2890
3698
  {
2891
3699
  get trackedAnnotation() {
2892
3700
  return $.get(annotation);
2893
3701
  },
2894
3702
  get isSelected() {
2895
- return $.get($0);
3703
+ return $.get(isSelected);
2896
3704
  },
2897
3705
  get isMultiSelected() {
2898
3706
  return $.get(isMultiSelected);
2899
3707
  },
2900
3708
  isDraggable: false,
2901
3709
  isResizable: false,
3710
+ isRotatable: false,
2902
3711
  lockAspectRatio: false,
2903
3712
  get selectionMenu() {
2904
- return $.get($1);
3713
+ return $.get($0);
2905
3714
  },
2906
3715
  get selectionMenuSnippet() {
2907
- return $.get($2);
3716
+ return $.get($1);
2908
3717
  },
2909
3718
  onSelect: (e) => handleLinkClick(e, $.get(annotation)),
2910
3719
  get style() {
@@ -3068,47 +3877,62 @@ function Annotations($$anchor, $$props) {
3068
3877
  var node_16 = $.sibling(node, 2);
3069
3878
  {
3070
3879
  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
- });
3880
+ {
3881
+ let $0 = $.derived(() => $$props.groupSelectionOutline ?? $$props.selectionOutline);
3882
+ GroupSelectionBox($$anchor2, {
3883
+ get documentId() {
3884
+ return $$props.documentId;
3885
+ },
3886
+ get pageIndex() {
3887
+ return $$props.pageIndex;
3888
+ },
3889
+ get scale() {
3890
+ return $$props.scale;
3891
+ },
3892
+ get rotation() {
3893
+ return $$props.rotation;
3894
+ },
3895
+ get pageWidth() {
3896
+ return $$props.pageWidth;
3897
+ },
3898
+ get pageHeight() {
3899
+ return $$props.pageHeight;
3900
+ },
3901
+ get selectedAnnotations() {
3902
+ return $.get(selectedAnnotationsOnPage);
3903
+ },
3904
+ get isDraggable() {
3905
+ return $.get(areAllSelectedDraggable);
3906
+ },
3907
+ get isResizable() {
3908
+ return $.get(areAllSelectedResizable);
3909
+ },
3910
+ get isRotatable() {
3911
+ return $.get(areAllSelectedRotatable);
3912
+ },
3913
+ get lockAspectRatio() {
3914
+ return $.get(shouldLockGroupAspectRatio);
3915
+ },
3916
+ get resizeUI() {
3917
+ return $$props.resizeUI;
3918
+ },
3919
+ get rotationUI() {
3920
+ return $$props.rotationUI;
3921
+ },
3922
+ get selectionOutlineColor() {
3923
+ return $$props.selectionOutlineColor;
3924
+ },
3925
+ get selectionOutline() {
3926
+ return $.get($0);
3927
+ },
3928
+ get groupSelectionMenu() {
3929
+ return $$props.groupSelectionMenu;
3930
+ },
3931
+ get groupSelectionMenuSnippet() {
3932
+ return $$props.groupSelectionMenuSnippet;
3933
+ }
3934
+ });
3935
+ }
3112
3936
  };
3113
3937
  $.if(node_16, ($$render) => {
3114
3938
  if ($.get(allSelectedOnSamePage) && $.get(selectedAnnotationsOnPage).length >= 2) $$render(consequent_14);
@@ -3755,7 +4579,10 @@ function AnnotationLayer($$anchor, $$props) {
3755
4579
  "groupSelectionMenuSnippet",
3756
4580
  "resizeUI",
3757
4581
  "vertexUI",
4582
+ "rotationUI",
3758
4583
  "selectionOutlineColor",
4584
+ "selectionOutline",
4585
+ "groupSelectionOutline",
3759
4586
  "customAnnotationRenderer",
3760
4587
  "annotationRenderers"
3761
4588
  ]);
@@ -3789,8 +4616,11 @@ function AnnotationLayer($$anchor, $$props) {
3789
4616
  return $$props.scale !== void 0 ? $$props.scale : ((_a = documentState == null ? void 0 : documentState.current) == null ? void 0 : _a.scale) ?? 1;
3790
4617
  });
3791
4618
  const actualRotation = $.derived(() => {
3792
- var _a;
3793
- return $$props.rotation !== void 0 ? $$props.rotation : ((_a = documentState == null ? void 0 : documentState.current) == null ? void 0 : _a.rotation) ?? Rotation.Degree0;
4619
+ var _a, _b;
4620
+ if ($$props.rotation !== void 0) return $$props.rotation;
4621
+ const pageRotation = ((_a = $.get(page)) == null ? void 0 : _a.rotation) ?? 0;
4622
+ const docRotation = ((_b = documentState == null ? void 0 : documentState.current) == null ? void 0 : _b.rotation) ?? 0;
4623
+ return (pageRotation + docRotation) % 4;
3794
4624
  });
3795
4625
  var div = root();
3796
4626
  $.attribute_effect(div, ($0) => ({ id: "annotation-layer", ...$0, ...restProps }), [
@@ -3834,9 +4664,18 @@ function AnnotationLayer($$anchor, $$props) {
3834
4664
  get vertexUI() {
3835
4665
  return $$props.vertexUI;
3836
4666
  },
4667
+ get rotationUI() {
4668
+ return $$props.rotationUI;
4669
+ },
3837
4670
  get selectionOutlineColor() {
3838
4671
  return $$props.selectionOutlineColor;
3839
4672
  },
4673
+ get selectionOutline() {
4674
+ return $$props.selectionOutline;
4675
+ },
4676
+ get groupSelectionOutline() {
4677
+ return $$props.groupSelectionOutline;
4678
+ },
3840
4679
  get customAnnotationRenderer() {
3841
4680
  return $$props.customAnnotationRenderer;
3842
4681
  },