@embedpdf/plugin-annotation 2.7.0 → 2.9.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 (134) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1131 -203
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/annotation-plugin.d.ts +2 -0
  6. package/dist/lib/geometry/cloudy-border.d.ts +90 -0
  7. package/dist/lib/geometry/index.d.ts +1 -0
  8. package/dist/lib/handlers/index.d.ts +4 -0
  9. package/dist/lib/handlers/insert-text.handler.d.ts +8 -0
  10. package/dist/lib/handlers/replace-text.handler.d.ts +9 -0
  11. package/dist/lib/handlers/selection-utils.d.ts +7 -0
  12. package/dist/lib/handlers/text-markup.handler.d.ts +7 -0
  13. package/dist/lib/handlers/text.handler.d.ts +3 -0
  14. package/dist/lib/handlers/types.d.ts +14 -1
  15. package/dist/lib/helpers.d.ts +2 -1
  16. package/dist/lib/selectors.d.ts +6 -1
  17. package/dist/lib/tools/default-tools.d.ts +141 -45
  18. package/dist/lib/tools/tools-utils.d.ts +2 -0
  19. package/dist/lib/tools/types.d.ts +34 -1
  20. package/dist/lib/types.d.ts +1 -0
  21. package/dist/preact/index.cjs +1 -1
  22. package/dist/preact/index.cjs.map +1 -1
  23. package/dist/preact/index.js +621 -274
  24. package/dist/preact/index.js.map +1 -1
  25. package/dist/react/index.cjs +1 -1
  26. package/dist/react/index.cjs.map +1 -1
  27. package/dist/react/index.js +621 -274
  28. package/dist/react/index.js.map +1 -1
  29. package/dist/shared/annotation-bounds.d.ts +14 -0
  30. package/dist/shared/components/annotation-container.d.ts +4 -2
  31. package/dist/shared/components/annotations/caret.d.ts +24 -0
  32. package/dist/shared/components/annotations/circle.d.ts +8 -4
  33. package/dist/shared/components/annotations/free-text.d.ts +2 -2
  34. package/dist/shared/components/annotations/ink.d.ts +2 -2
  35. package/dist/shared/components/annotations/line.d.ts +2 -2
  36. package/dist/shared/components/annotations/link.d.ts +2 -2
  37. package/dist/shared/components/annotations/polygon.d.ts +5 -3
  38. package/dist/shared/components/annotations/polyline.d.ts +8 -4
  39. package/dist/shared/components/annotations/square.d.ts +8 -4
  40. package/dist/shared/components/annotations/stamp.d.ts +2 -2
  41. package/dist/shared/components/annotations/text.d.ts +14 -0
  42. package/dist/shared/components/text-markup/highlight.d.ts +2 -2
  43. package/dist/shared/components/text-markup/squiggly.d.ts +2 -2
  44. package/dist/shared/components/text-markup/strikeout.d.ts +2 -2
  45. package/dist/shared/components/text-markup/underline.d.ts +2 -2
  46. package/dist/shared/components/types.d.ts +8 -4
  47. package/dist/shared-preact/annotation-bounds.d.ts +14 -0
  48. package/dist/shared-preact/components/annotation-container.d.ts +4 -2
  49. package/dist/shared-preact/components/annotations/caret.d.ts +24 -0
  50. package/dist/shared-preact/components/annotations/circle.d.ts +8 -4
  51. package/dist/shared-preact/components/annotations/free-text.d.ts +2 -2
  52. package/dist/shared-preact/components/annotations/ink.d.ts +2 -2
  53. package/dist/shared-preact/components/annotations/line.d.ts +2 -2
  54. package/dist/shared-preact/components/annotations/link.d.ts +2 -2
  55. package/dist/shared-preact/components/annotations/polygon.d.ts +5 -3
  56. package/dist/shared-preact/components/annotations/polyline.d.ts +8 -4
  57. package/dist/shared-preact/components/annotations/square.d.ts +8 -4
  58. package/dist/shared-preact/components/annotations/stamp.d.ts +2 -2
  59. package/dist/shared-preact/components/annotations/text.d.ts +14 -0
  60. package/dist/shared-preact/components/text-markup/highlight.d.ts +2 -2
  61. package/dist/shared-preact/components/text-markup/squiggly.d.ts +2 -2
  62. package/dist/shared-preact/components/text-markup/strikeout.d.ts +2 -2
  63. package/dist/shared-preact/components/text-markup/underline.d.ts +2 -2
  64. package/dist/shared-preact/components/types.d.ts +8 -4
  65. package/dist/shared-react/annotation-bounds.d.ts +14 -0
  66. package/dist/shared-react/components/annotation-container.d.ts +4 -2
  67. package/dist/shared-react/components/annotations/caret.d.ts +24 -0
  68. package/dist/shared-react/components/annotations/circle.d.ts +8 -4
  69. package/dist/shared-react/components/annotations/free-text.d.ts +2 -2
  70. package/dist/shared-react/components/annotations/ink.d.ts +2 -2
  71. package/dist/shared-react/components/annotations/line.d.ts +2 -2
  72. package/dist/shared-react/components/annotations/link.d.ts +2 -2
  73. package/dist/shared-react/components/annotations/polygon.d.ts +5 -3
  74. package/dist/shared-react/components/annotations/polyline.d.ts +8 -4
  75. package/dist/shared-react/components/annotations/square.d.ts +8 -4
  76. package/dist/shared-react/components/annotations/stamp.d.ts +2 -2
  77. package/dist/shared-react/components/annotations/text.d.ts +14 -0
  78. package/dist/shared-react/components/text-markup/highlight.d.ts +2 -2
  79. package/dist/shared-react/components/text-markup/squiggly.d.ts +2 -2
  80. package/dist/shared-react/components/text-markup/strikeout.d.ts +2 -2
  81. package/dist/shared-react/components/text-markup/underline.d.ts +2 -2
  82. package/dist/shared-react/components/types.d.ts +8 -4
  83. package/dist/shared-vue/annotation-bounds.d.ts +14 -0
  84. package/dist/svelte/components/annotations/Caret.svelte.d.ts +13 -0
  85. package/dist/svelte/components/annotations/Circle.svelte.d.ts +4 -2
  86. package/dist/svelte/components/annotations/FreeText.svelte.d.ts +1 -1
  87. package/dist/svelte/components/annotations/Ink.svelte.d.ts +1 -1
  88. package/dist/svelte/components/annotations/Line.svelte.d.ts +1 -1
  89. package/dist/svelte/components/annotations/Link.svelte.d.ts +1 -1
  90. package/dist/svelte/components/annotations/Polygon.svelte.d.ts +2 -1
  91. package/dist/svelte/components/annotations/Polyline.svelte.d.ts +4 -2
  92. package/dist/svelte/components/annotations/Square.svelte.d.ts +4 -2
  93. package/dist/svelte/components/annotations/Stamp.svelte.d.ts +1 -1
  94. package/dist/svelte/components/annotations/Text.svelte.d.ts +10 -0
  95. package/dist/svelte/components/annotations/index.d.ts +1 -0
  96. package/dist/svelte/components/renderers/CaretRenderer.svelte.d.ts +5 -0
  97. package/dist/svelte/components/renderers/TextRenderer.svelte.d.ts +5 -0
  98. package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +1 -1
  99. package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +1 -1
  100. package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +1 -1
  101. package/dist/svelte/components/text-markup/Underline.svelte.d.ts +1 -1
  102. package/dist/svelte/components/types.d.ts +2 -1
  103. package/dist/svelte/context/types.d.ts +7 -3
  104. package/dist/svelte/index.cjs +1 -1
  105. package/dist/svelte/index.cjs.map +1 -1
  106. package/dist/svelte/index.js +831 -416
  107. package/dist/svelte/index.js.map +1 -1
  108. package/dist/vue/components/annotation-container.vue.d.ts +9 -8
  109. package/dist/vue/components/annotation-layer.vue.d.ts +1 -1
  110. package/dist/vue/components/annotations/caret.vue.d.ts +24 -0
  111. package/dist/vue/components/annotations/circle.vue.d.ts +7 -3
  112. package/dist/vue/components/annotations/free-text.vue.d.ts +2 -2
  113. package/dist/vue/components/annotations/index.d.ts +1 -0
  114. package/dist/vue/components/annotations/ink.vue.d.ts +2 -2
  115. package/dist/vue/components/annotations/line.vue.d.ts +2 -2
  116. package/dist/vue/components/annotations/link.vue.d.ts +2 -2
  117. package/dist/vue/components/annotations/polygon.vue.d.ts +4 -2
  118. package/dist/vue/components/annotations/polyline.vue.d.ts +8 -3
  119. package/dist/vue/components/annotations/square.vue.d.ts +7 -3
  120. package/dist/vue/components/annotations/stamp.vue.d.ts +2 -2
  121. package/dist/vue/components/annotations/text.vue.d.ts +14 -0
  122. package/dist/vue/components/annotations.vue.d.ts +9 -10
  123. package/dist/vue/components/renderers/caret-renderer.vue.d.ts +6 -0
  124. package/dist/vue/components/renderers/text-renderer.vue.d.ts +6 -0
  125. package/dist/vue/components/text-markup/highlight.vue.d.ts +2 -2
  126. package/dist/vue/components/text-markup/squiggly.vue.d.ts +2 -2
  127. package/dist/vue/components/text-markup/strikeout.vue.d.ts +2 -2
  128. package/dist/vue/components/text-markup/underline.vue.d.ts +2 -2
  129. package/dist/vue/context/types.d.ts +7 -3
  130. package/dist/vue/index.cjs +1 -1
  131. package/dist/vue/index.cjs.map +1 -1
  132. package/dist/vue/index.js +778 -354
  133. package/dist/vue/index.js.map +1 -1
  134. package/package.json +10 -10
@@ -1,12 +1,13 @@
1
1
  import { createPluginPackage } from "@embedpdf/core";
2
- import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationIds, resolveInteractionProp, AnnotationPluginPackage as AnnotationPluginPackage$1 } from "@embedpdf/plugin-annotation";
2
+ import { AnnotationPlugin, initialDocumentState, generateCloudyRectanglePath, generateCloudyEllipsePath, patching, generateCloudyPolygonPath, getAnnotationsByPageIndex, getSelectedAnnotationIds, resolveInteractionProp, AnnotationPluginPackage as AnnotationPluginPackage$1 } from "@embedpdf/plugin-annotation";
3
3
  export * from "@embedpdf/plugin-annotation";
4
4
  import "svelte/internal/disclose-version";
5
5
  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
+ import { getCounterRotation } from "@embedpdf/utils";
8
9
  import { useInteractionHandles, deepToRaw, doublePress, CounterRotate } from "@embedpdf/utils/svelte";
9
- import { inferRotationCenterFromRects, boundingRectOrEmpty, PdfAnnotationBorderStyle, PdfVerticalAlignment, standardFontCssProperties, textAlignmentToCss, ignore, PdfErrorCode, PdfAnnotationSubtype, blendModeToCss, PdfBlendMode } from "@embedpdf/models";
10
+ import { inferRotationCenterFromRects, boundingRectOrEmpty, PdfAnnotationBorderStyle, PdfVerticalAlignment, standardFontCssProperties, textAlignmentToCss, ignore, PdfErrorCode, getContrastStrokeColor, PdfBlendMode, PdfAnnotationSubtype, blendModeToCss } from "@embedpdf/models";
10
11
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/svelte";
11
12
  import { useSelectionCapability } from "@embedpdf/plugin-selection/svelte";
12
13
  const REGISTRY_KEY = Symbol("AnnotationRendererRegistry");
@@ -47,6 +48,7 @@ function createRenderer(entry) {
47
48
  component: entry.component,
48
49
  vertexConfig: entry.vertexConfig,
49
50
  zIndex: entry.zIndex,
51
+ defaultBlendMode: entry.defaultBlendMode,
50
52
  containerStyle: entry.containerStyle,
51
53
  interactionDefaults: entry.interactionDefaults,
52
54
  useAppearanceStream: entry.useAppearanceStream,
@@ -136,14 +138,14 @@ function AppearanceImage($$anchor, $$props) {
136
138
  $.append($$anchor, fragment);
137
139
  $.pop();
138
140
  }
139
- var root_1$e = $.from_html(`<div></div> <div></div> <div></div>`, 1);
140
- var root_3$5 = $.from_html(`<div style="display: contents;"><!></div>`);
141
- var root_5$4 = $.from_html(`<div></div>`);
142
- var root_4$4 = $.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>`);
141
+ var root_4$7 = $.from_html(`<div></div> <div></div> <div></div>`, 1);
142
+ var root_6$2 = $.from_html(`<div style="display: contents;"><!></div>`);
143
+ var root_8$1 = $.from_html(`<div></div>`);
144
+ var root_7$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>`);
143
145
  var root_12 = $.from_html(`<div></div>`);
144
146
  var root_16 = $.from_html(`<div></div>`);
145
147
  var root_23 = $.from_html(`<div><div> </div></div>`);
146
- var root$c = $.from_html(`<div data-no-interaction=""><div><!> <!> <div><!> <!> <!> <!></div></div> <!> <!></div>`);
148
+ var root$e = $.from_html(`<div data-no-interaction=""><div><div><!> <!></div></div> <div><!> <!> <div><!> <!></div></div> <!> <!></div>`);
147
149
  function AnnotationContainer($$anchor, $$props) {
148
150
  $.push($$props, true);
149
151
  let isEditing = $.prop($$props, "isEditing", 3, false), 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, [
@@ -165,6 +167,7 @@ function AnnotationContainer($$anchor, $$props) {
165
167
  "isResizable",
166
168
  "isRotatable",
167
169
  "lockAspectRatio",
170
+ "blendMode",
168
171
  "style",
169
172
  "class",
170
173
  "vertexConfig",
@@ -201,6 +204,11 @@ function AnnotationContainer($$anchor, $$props) {
201
204
  const guardedOnDoubleClick = $.derived(() => permissions.canModifyAnnotations && $$props.onDoubleClick ? $$props.onDoubleClick : void 0);
202
205
  const annotationProvides = $.derived(() => annotationCapability.provides ? annotationCapability.provides.forDocument($$props.documentId) : null);
203
206
  let currentObject = $.derived(() => $.get(preview) ? { ...$$props.trackedAnnotation.object, ...$.get(preview) } : $$props.trackedAnnotation.object);
207
+ const annoFlags = $.derived(() => $$props.trackedAnnotation.object.flags ?? []);
208
+ const hasNoZoom = $.derived(() => $.get(annoFlags).includes("noZoom"));
209
+ const hasNoRotate = $.derived(() => $.get(annoFlags).includes("noRotate"));
210
+ const visualScale = $.derived(() => $.get(hasNoZoom) ? 1 : $$props.scale);
211
+ const effectivePageRotation = $.derived(() => $.get(hasNoRotate) ? 0 : $$props.rotation);
204
212
  const HANDLE_COLOR = $.derived(() => {
205
213
  var _a;
206
214
  return ((_a = $$props.resizeUI) == null ? void 0 : _a.color) ?? "#007ACC";
@@ -278,17 +286,24 @@ function AnnotationContainer($$anchor, $$props) {
278
286
  const effectiveUnrotatedRect = $.derived(() => $.get(explicitUnrotatedRect) ?? $.get(currentObject).rect);
279
287
  const rotationPivot = $.derived(() => $.get(explicitUnrotatedRect) && $.get(annotationRotation) !== 0 ? inferRotationCenterFromRects($.get(effectiveUnrotatedRect), $.get(currentObject).rect, $.get(annotationRotation)) : void 0);
280
288
  const controllerElement = $.derived(() => $.get(effectiveUnrotatedRect));
281
- const aabbWidth = $.derived(() => $.get(currentObject).rect.size.width * $$props.scale);
282
- const aabbHeight = $.derived(() => $.get(currentObject).rect.size.height * $$props.scale);
283
- const innerWidth = $.derived(() => $.get(effectiveUnrotatedRect).size.width * $$props.scale);
284
- const innerHeight = $.derived(() => $.get(effectiveUnrotatedRect).size.height * $$props.scale);
289
+ const aabbWidth = $.derived(() => $.get(currentObject).rect.size.width * $.get(visualScale));
290
+ const aabbHeight = $.derived(() => $.get(currentObject).rect.size.height * $.get(visualScale));
291
+ const innerWidth = $.derived(() => $.get(effectiveUnrotatedRect).size.width * $.get(visualScale));
292
+ const innerHeight = $.derived(() => $.get(effectiveUnrotatedRect).size.height * $.get(visualScale));
285
293
  const usesCustomPivot = $.derived(() => Boolean($.get(explicitUnrotatedRect)) && $.get(annotationRotation) !== 0);
286
- const innerLeft = $.derived(() => $.get(usesCustomPivot) ? ($.get(effectiveUnrotatedRect).origin.x - $.get(currentObject).rect.origin.x) * $$props.scale : ($.get(aabbWidth) - $.get(innerWidth)) / 2);
287
- const innerTop = $.derived(() => $.get(usesCustomPivot) ? ($.get(effectiveUnrotatedRect).origin.y - $.get(currentObject).rect.origin.y) * $$props.scale : ($.get(aabbHeight) - $.get(innerHeight)) / 2);
288
- 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");
289
- const centerX = $.derived(() => $.get(rotationPivot) ? ($.get(rotationPivot).x - $.get(currentObject).rect.origin.x) * $$props.scale : $.get(aabbWidth) / 2);
290
- const centerY = $.derived(() => $.get(rotationPivot) ? ($.get(rotationPivot).y - $.get(currentObject).rect.origin.y) * $$props.scale : $.get(aabbHeight) / 2);
294
+ const innerLeft = $.derived(() => $.get(usesCustomPivot) ? ($.get(effectiveUnrotatedRect).origin.x - $.get(currentObject).rect.origin.x) * $.get(visualScale) : ($.get(aabbWidth) - $.get(innerWidth)) / 2);
295
+ const innerTop = $.derived(() => $.get(usesCustomPivot) ? ($.get(effectiveUnrotatedRect).origin.y - $.get(currentObject).rect.origin.y) * $.get(visualScale) : ($.get(aabbHeight) - $.get(innerHeight)) / 2);
296
+ const innerTransformOrigin = $.derived(() => $.get(usesCustomPivot) && $.get(rotationPivot) ? `${($.get(rotationPivot).x - $.get(effectiveUnrotatedRect).origin.x) * $.get(visualScale)}px ${($.get(rotationPivot).y - $.get(effectiveUnrotatedRect).origin.y) * $.get(visualScale)}px` : "center center");
297
+ const centerX = $.derived(() => $.get(rotationPivot) ? ($.get(rotationPivot).x - $.get(currentObject).rect.origin.x) * $.get(visualScale) : $.get(aabbWidth) / 2);
298
+ const centerY = $.derived(() => $.get(rotationPivot) ? ($.get(rotationPivot).y - $.get(currentObject).rect.origin.y) * $.get(visualScale) : $.get(aabbHeight) / 2);
291
299
  const guideLength = $.derived(() => Math.max(300, Math.max($.get(aabbWidth), $.get(aabbHeight)) + 80));
300
+ const counterRot = $.derived(() => $.get(hasNoRotate) ? getCounterRotation(
301
+ {
302
+ origin: { x: 0, y: 0 },
303
+ size: { width: $.get(aabbWidth), height: $.get(aabbHeight) }
304
+ },
305
+ $$props.rotation
306
+ ) : null);
292
307
  const apActive = $.derived(() => {
293
308
  var _a;
294
309
  return !!((_a = $$props.appearance) == null ? void 0 : _a.normal) && !$.get(gestureActive) && !isEditing() && !$$props.trackedAnnotation.dictMode;
@@ -469,7 +484,7 @@ function AnnotationContainer($$anchor, $$props) {
469
484
  };
470
485
  }
471
486
  function buildMenuProps(rect, menuWrapperProps) {
472
- const effectiveAngle = (($.get(annotationRotation) + $$props.rotation * 90) % 360 + 360) % 360;
487
+ const effectiveAngle = (($.get(annotationRotation) + $.get(effectivePageRotation) * 90) % 360 + 360) % 360;
473
488
  const handleNearMenuSide = $.get(effectiveIsRotatable) && effectiveAngle > 90 && effectiveAngle < 270;
474
489
  return {
475
490
  context: buildContext(),
@@ -489,34 +504,90 @@ function AnnotationContainer($$anchor, $$props) {
489
504
  }
490
505
  };
491
506
  }
492
- var div = root$c();
507
+ var div = root$e();
493
508
  var div_1 = $.child(div);
494
- $.attribute_effect(div_1, () => ({
495
- style: $$props.style || "",
509
+ let styles;
510
+ var div_2 = $.child(div_1);
511
+ let styles_1;
512
+ var node_1 = $.child(div_2);
513
+ {
514
+ var consequent = ($$anchor2) => {
515
+ var fragment = $.comment();
516
+ var node_2 = $.first_child(fragment);
517
+ $.snippet(node_2, () => $$props.customAnnotationRenderer ?? $.noop, () => ({
518
+ annotation: $.get(childObject),
519
+ children: $$props.children,
520
+ isSelected: $$props.isSelected,
521
+ scale: $$props.scale,
522
+ rotation: $$props.rotation,
523
+ pageWidth: $$props.pageWidth,
524
+ pageHeight: $$props.pageHeight,
525
+ pageIndex: $$props.pageIndex,
526
+ onSelect: $$props.onSelect
527
+ }));
528
+ $.append($$anchor2, fragment);
529
+ };
530
+ var alternate = ($$anchor2) => {
531
+ var fragment_1 = $.comment();
532
+ var node_3 = $.first_child(fragment_1);
533
+ $.snippet(node_3, () => $$props.children, () => $.get(childObject), () => ({ appearanceActive: $.get(apActive) }));
534
+ $.append($$anchor2, fragment_1);
535
+ };
536
+ $.if(node_1, ($$render) => {
537
+ if ($$props.customAnnotationRenderer) $$render(consequent);
538
+ else $$render(alternate, false);
539
+ });
540
+ }
541
+ var node_4 = $.sibling(node_1, 2);
542
+ {
543
+ var consequent_1 = ($$anchor2) => {
544
+ {
545
+ let $0 = $.derived(() => $.get(apActive) ? "block" : "none");
546
+ AppearanceImage($$anchor2, {
547
+ get appearance() {
548
+ return $$props.appearance.normal;
549
+ },
550
+ get style() {
551
+ return `display: ${$.get($0) ?? ""};`;
552
+ }
553
+ });
554
+ }
555
+ };
556
+ $.if(node_4, ($$render) => {
557
+ var _a;
558
+ if ((_a = $$props.appearance) == null ? void 0 : _a.normal) $$render(consequent_1);
559
+ });
560
+ }
561
+ $.reset(div_2);
562
+ $.reset(div_1);
563
+ var div_3 = $.sibling(div_1, 2);
564
+ $.attribute_effect(div_3, () => ({
496
565
  class: propsClass(),
497
566
  ...restProps,
498
567
  [$.STYLE]: {
499
568
  position: "absolute",
500
569
  left: `${$.get(currentObject).rect.origin.x * $$props.scale}px`,
501
570
  top: `${$.get(currentObject).rect.origin.y * $$props.scale}px`,
502
- width: `${$.get(aabbWidth) ?? ""}px`,
503
- height: `${$.get(aabbHeight) ?? ""}px`,
571
+ width: `${($.get(counterRot) ? $.get(counterRot).width : $.get(aabbWidth)) ?? ""}px`,
572
+ height: `${($.get(counterRot) ? $.get(counterRot).height : $.get(aabbHeight)) ?? ""}px`,
504
573
  "pointer-events": "none",
505
- "z-index": zIndex()
574
+ "z-index": zIndex(),
575
+ transform: $.get(counterRot) ? $.get(counterRot).matrix : void 0,
576
+ "transform-origin": $.get(counterRot) ? "0 0" : void 0
506
577
  }
507
578
  }));
508
- var node_1 = $.child(div_1);
579
+ var node_5 = $.child(div_3);
509
580
  {
510
- var consequent = ($$anchor2) => {
511
- var fragment = root_1$e();
512
- var div_2 = $.first_child(fragment);
513
- let styles;
514
- var div_3 = $.sibling(div_2, 2);
515
- let styles_1;
516
- var div_4 = $.sibling(div_3, 2);
581
+ var consequent_2 = ($$anchor2) => {
582
+ var fragment_3 = root_4$7();
583
+ var div_4 = $.first_child(fragment_3);
517
584
  let styles_2;
585
+ var div_5 = $.sibling(div_4, 2);
586
+ let styles_3;
587
+ var div_6 = $.sibling(div_5, 2);
588
+ let styles_4;
518
589
  $.template_effect(() => {
519
- styles = $.set_style(div_2, "", styles, {
590
+ styles_2 = $.set_style(div_4, "", styles_2, {
520
591
  position: "absolute",
521
592
  left: `${$.get(centerX) - $.get(guideLength) / 2}px`,
522
593
  top: `${$.get(centerY) ?? ""}px`,
@@ -526,7 +597,7 @@ function AnnotationContainer($$anchor, $$props) {
526
597
  opacity: "0.35",
527
598
  "pointer-events": "none"
528
599
  });
529
- styles_1 = $.set_style(div_3, "", styles_1, {
600
+ styles_3 = $.set_style(div_5, "", styles_3, {
530
601
  position: "absolute",
531
602
  left: `${$.get(centerX) ?? ""}px`,
532
603
  top: `${$.get(centerY) - $.get(guideLength) / 2}px`,
@@ -536,7 +607,7 @@ function AnnotationContainer($$anchor, $$props) {
536
607
  opacity: "0.35",
537
608
  "pointer-events": "none"
538
609
  });
539
- styles_2 = $.set_style(div_4, "", styles_2, {
610
+ styles_4 = $.set_style(div_6, "", styles_4, {
540
611
  position: "absolute",
541
612
  left: `${$.get(centerX) - $.get(guideLength) / 2}px`,
542
613
  top: `${$.get(centerY) ?? ""}px`,
@@ -549,24 +620,24 @@ function AnnotationContainer($$anchor, $$props) {
549
620
  "pointer-events": "none"
550
621
  });
551
622
  });
552
- $.append($$anchor2, fragment);
623
+ $.append($$anchor2, fragment_3);
553
624
  };
554
- $.if(node_1, ($$render) => {
555
- if ($.get(rotationActive)) $$render(consequent);
625
+ $.if(node_5, ($$render) => {
626
+ if ($.get(rotationActive)) $$render(consequent_2);
556
627
  });
557
628
  }
558
- var node_2 = $.sibling(node_1, 2);
629
+ var node_6 = $.sibling(node_5, 2);
559
630
  {
560
- var consequent_3 = ($$anchor2) => {
561
- var fragment_1 = $.comment();
562
- var node_3 = $.first_child(fragment_1);
631
+ var consequent_5 = ($$anchor2) => {
632
+ var fragment_4 = $.comment();
633
+ var node_7 = $.first_child(fragment_4);
563
634
  {
564
- var consequent_1 = ($$anchor3) => {
565
- var div_5 = root_3$5();
566
- div_5.__pointermove = (e) => {
635
+ var consequent_3 = ($$anchor3) => {
636
+ var div_7 = root_6$2();
637
+ div_7.__pointermove = (e) => {
567
638
  if (!$.get(rotationActive)) $.set(cursorScreen, { x: e.clientX, y: e.clientY }, true);
568
639
  };
569
- var node_4 = $.child(div_5);
640
+ var node_8 = $.child(div_7);
570
641
  {
571
642
  let $0 = $.derived(() => ({
572
643
  ...$.get(rotationHandle).handle,
@@ -581,34 +652,34 @@ function AnnotationContainer($$anchor, $$props) {
581
652
  style: $.get(ROTATION_BORDER_STYLE)
582
653
  }
583
654
  }));
584
- $.snippet(node_4, () => $$props.rotationUI.component, () => $.get($0));
655
+ $.snippet(node_8, () => $$props.rotationUI.component, () => $.get($0));
585
656
  }
586
- $.reset(div_5);
587
- $.event("pointerenter", div_5, () => $.set(isHandleHovered, true));
588
- $.event("pointerleave", div_5, () => {
657
+ $.reset(div_7);
658
+ $.event("pointerenter", div_7, () => $.set(isHandleHovered, true));
659
+ $.event("pointerleave", div_7, () => {
589
660
  $.set(isHandleHovered, false);
590
661
  $.set(cursorScreen, null);
591
662
  });
592
- $.append($$anchor3, div_5);
663
+ $.append($$anchor3, div_7);
593
664
  };
594
- var alternate = ($$anchor3) => {
595
- var div_6 = root_4$4();
596
- div_6.__pointermove = (e) => {
665
+ var alternate_1 = ($$anchor3) => {
666
+ var div_8 = root_7$1();
667
+ div_8.__pointermove = (e) => {
597
668
  if (!$.get(rotationActive)) $.set(cursorScreen, { x: e.clientX, y: e.clientY }, true);
598
669
  };
599
- var node_5 = $.child(div_6);
670
+ var node_9 = $.child(div_8);
600
671
  {
601
- var consequent_2 = ($$anchor4) => {
602
- var div_7 = root_5$4();
603
- $.template_effect(() => $.set_style(div_7, `${$.get(rotationHandle).connector.style ?? ""}; background-color: ${$.get(ROTATION_CONNECTOR_COLOR) ?? ""}; opacity: ${$.get(rotationActive) ? 0 : 1};`));
604
- $.append($$anchor4, div_7);
672
+ var consequent_4 = ($$anchor4) => {
673
+ var div_9 = root_8$1();
674
+ $.template_effect(() => $.set_style(div_9, `${$.get(rotationHandle).connector.style ?? ""}; background-color: ${$.get(ROTATION_CONNECTOR_COLOR) ?? ""}; opacity: ${$.get(rotationActive) ? 0 : 1};`));
675
+ $.append($$anchor4, div_9);
605
676
  };
606
- $.if(node_5, ($$render) => {
607
- if ($.get(SHOW_CONNECTOR)) $$render(consequent_2);
677
+ $.if(node_9, ($$render) => {
678
+ if ($.get(SHOW_CONNECTOR)) $$render(consequent_4);
608
679
  });
609
680
  }
610
- var div_8 = $.sibling(node_5, 2);
611
- $.attribute_effect(div_8, () => ({
681
+ var div_10 = $.sibling(node_9, 2);
682
+ $.attribute_effect(div_10, () => ({
612
683
  ...{
613
684
  onpointerdown: $.get(rotationHandle).handle.onpointerdown,
614
685
  onpointermove: $.get(rotationHandle).handle.onpointermove,
@@ -617,9 +688,9 @@ function AnnotationContainer($$anchor, $$props) {
617
688
  },
618
689
  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};`
619
690
  }));
620
- var svg = $.child(div_8);
691
+ var svg = $.child(div_10);
692
+ $.reset(div_10);
621
693
  $.reset(div_8);
622
- $.reset(div_6);
623
694
  $.template_effect(
624
695
  ($0, $1) => {
625
696
  $.set_attribute(svg, "width", $0);
@@ -631,27 +702,27 @@ function AnnotationContainer($$anchor, $$props) {
631
702
  () => Math.round($.get(ROTATION_SIZE) * 0.6)
632
703
  ]
633
704
  );
634
- $.event("pointerenter", div_6, () => $.set(isHandleHovered, true));
635
- $.event("pointerleave", div_6, () => {
705
+ $.event("pointerenter", div_8, () => $.set(isHandleHovered, true));
706
+ $.event("pointerleave", div_8, () => {
636
707
  $.set(isHandleHovered, false);
637
708
  $.set(cursorScreen, null);
638
709
  });
639
- $.append($$anchor3, div_6);
710
+ $.append($$anchor3, div_8);
640
711
  };
641
- $.if(node_3, ($$render) => {
712
+ $.if(node_7, ($$render) => {
642
713
  var _a;
643
- if ((_a = $$props.rotationUI) == null ? void 0 : _a.component) $$render(consequent_1);
644
- else $$render(alternate, false);
714
+ if ((_a = $$props.rotationUI) == null ? void 0 : _a.component) $$render(consequent_3);
715
+ else $$render(alternate_1, false);
645
716
  });
646
717
  }
647
- $.append($$anchor2, fragment_1);
718
+ $.append($$anchor2, fragment_4);
648
719
  };
649
- $.if(node_2, ($$render) => {
650
- if ($$props.isSelected && $.get(effectiveIsRotatable) && $.get(rotationHandle)) $$render(consequent_3);
720
+ $.if(node_6, ($$render) => {
721
+ if ($$props.isSelected && $.get(effectiveIsRotatable) && $.get(rotationHandle)) $$render(consequent_5);
651
722
  });
652
723
  }
653
- var div_9 = $.sibling(node_2, 2);
654
- $.attribute_effect(div_9, () => ({
724
+ var div_11 = $.sibling(node_6, 2);
725
+ $.attribute_effect(div_11, () => ({
655
726
  ...$.get(effectiveIsDraggable) && $$props.isSelected ? interactionHandles.dragProps : {},
656
727
  [$.STYLE]: {
657
728
  position: "absolute",
@@ -668,56 +739,7 @@ function AnnotationContainer($$anchor, $$props) {
668
739
  cursor: $$props.isSelected && $.get(effectiveIsDraggable) ? "move" : "default"
669
740
  }
670
741
  }));
671
- var node_6 = $.child(div_9);
672
- {
673
- var consequent_4 = ($$anchor2) => {
674
- var fragment_2 = $.comment();
675
- var node_7 = $.first_child(fragment_2);
676
- $.snippet(node_7, () => $$props.customAnnotationRenderer ?? $.noop, () => ({
677
- annotation: $.get(childObject),
678
- children: $$props.children,
679
- isSelected: $$props.isSelected,
680
- scale: $$props.scale,
681
- rotation: $$props.rotation,
682
- pageWidth: $$props.pageWidth,
683
- pageHeight: $$props.pageHeight,
684
- pageIndex: $$props.pageIndex,
685
- onSelect: $$props.onSelect
686
- }));
687
- $.append($$anchor2, fragment_2);
688
- };
689
- var alternate_1 = ($$anchor2) => {
690
- var fragment_3 = $.comment();
691
- var node_8 = $.first_child(fragment_3);
692
- $.snippet(node_8, () => $$props.children, () => $.get(childObject), () => ({ appearanceActive: $.get(apActive) }));
693
- $.append($$anchor2, fragment_3);
694
- };
695
- $.if(node_6, ($$render) => {
696
- if ($$props.customAnnotationRenderer) $$render(consequent_4);
697
- else $$render(alternate_1, false);
698
- });
699
- }
700
- var node_9 = $.sibling(node_6, 2);
701
- {
702
- var consequent_5 = ($$anchor2) => {
703
- {
704
- let $0 = $.derived(() => $.get(apActive) ? "block" : "none");
705
- AppearanceImage($$anchor2, {
706
- get appearance() {
707
- return $$props.appearance.normal;
708
- },
709
- get style() {
710
- return `display: ${$.get($0) ?? ""};`;
711
- }
712
- });
713
- }
714
- };
715
- $.if(node_9, ($$render) => {
716
- var _a;
717
- if ((_a = $$props.appearance) == null ? void 0 : _a.normal) $$render(consequent_5);
718
- });
719
- }
720
- var node_10 = $.sibling(node_9, 2);
742
+ var node_10 = $.child(div_11);
721
743
  {
722
744
  var consequent_7 = ($$anchor2) => {
723
745
  var fragment_5 = $.comment();
@@ -742,12 +764,12 @@ function AnnotationContainer($$anchor, $$props) {
742
764
  $.append($$anchor4, fragment_7);
743
765
  };
744
766
  var alternate_2 = ($$anchor4) => {
745
- var div_10 = root_12();
746
- $.attribute_effect(div_10, () => ({
767
+ var div_12 = root_12();
768
+ $.attribute_effect(div_12, () => ({
747
769
  ...hProps(),
748
770
  style: `${handleStyle() ?? ""}; background-color: ${$.get(HANDLE_COLOR) ?? ""};`
749
771
  }));
750
- $.append($$anchor4, div_10);
772
+ $.append($$anchor4, div_12);
751
773
  };
752
774
  $.if(node_12, ($$render) => {
753
775
  var _a;
@@ -788,12 +810,12 @@ function AnnotationContainer($$anchor, $$props) {
788
810
  $.append($$anchor4, fragment_10);
789
811
  };
790
812
  var alternate_3 = ($$anchor4) => {
791
- var div_11 = root_16();
792
- $.attribute_effect(div_11, () => ({
813
+ var div_13 = root_16();
814
+ $.attribute_effect(div_13, () => ({
793
815
  ...vProps(),
794
816
  style: `${vertexStyle() ?? ""}; background-color: ${$.get(VERTEX_COLOR) ?? ""};`
795
817
  }));
796
- $.append($$anchor4, div_11);
818
+ $.append($$anchor4, div_13);
797
819
  };
798
820
  $.if(node_16, ($$render) => {
799
821
  var _a;
@@ -809,13 +831,13 @@ function AnnotationContainer($$anchor, $$props) {
809
831
  if ($$props.isSelected && permissions.canModifyAnnotations && !isMultiSelected() && !$.get(rotationActive)) $$render(consequent_9);
810
832
  });
811
833
  }
812
- $.reset(div_9);
813
- $.action(div_9, ($$node, $$action_arg) => {
834
+ $.reset(div_11);
835
+ $.action(div_11, ($$node, $$action_arg) => {
814
836
  var _a;
815
837
  return (_a = doublePress) == null ? void 0 : _a($$node, $$action_arg);
816
838
  }, () => ({ onDouble: $.get(guardedOnDoubleClick) }));
817
- $.reset(div_1);
818
- var node_18 = $.sibling(div_1, 2);
839
+ $.reset(div_3);
840
+ var node_18 = $.sibling(div_3, 2);
819
841
  {
820
842
  var consequent_13 = ($$anchor2) => {
821
843
  {
@@ -878,8 +900,8 @@ function AnnotationContainer($$anchor, $$props) {
878
900
  y: $.get(currentObject).rect.origin.y * $$props.scale
879
901
  },
880
902
  size: {
881
- width: $.get(currentObject).rect.size.width * $$props.scale,
882
- height: $.get(currentObject).rect.size.height * $$props.scale
903
+ width: $.get(currentObject).rect.size.width * $.get(visualScale),
904
+ height: $.get(currentObject).rect.size.height * $.get(visualScale)
883
905
  }
884
906
  }));
885
907
  CounterRotate($$anchor2, {
@@ -901,16 +923,16 @@ function AnnotationContainer($$anchor, $$props) {
901
923
  var node_24 = $.sibling(node_18, 2);
902
924
  {
903
925
  var consequent_14 = ($$anchor2) => {
904
- var div_12 = root_23();
905
- var div_13 = $.child(div_12);
906
- let styles_3;
907
- var text = $.child(div_13);
908
- $.reset(div_13);
909
- $.reset(div_12);
910
- $.action(div_12, ($$node) => portalToBody == null ? void 0 : portalToBody($$node));
926
+ var div_14 = root_23();
927
+ var div_15 = $.child(div_14);
928
+ let styles_5;
929
+ var text = $.child(div_15);
930
+ $.reset(div_15);
931
+ $.reset(div_14);
932
+ $.action(div_14, ($$node) => portalToBody == null ? void 0 : portalToBody($$node));
911
933
  $.template_effect(
912
934
  ($0) => {
913
- styles_3 = $.set_style(div_13, "", styles_3, {
935
+ styles_5 = $.set_style(div_15, "", styles_5, {
914
936
  position: "fixed",
915
937
  left: `${$.get(cursorScreen).x + 16}px`,
916
938
  top: `${$.get(cursorScreen).y - 16}px`,
@@ -928,24 +950,99 @@ function AnnotationContainer($$anchor, $$props) {
928
950
  },
929
951
  [() => $.get(normalizedRotationDisplay).toFixed(0)]
930
952
  );
931
- $.append($$anchor2, div_12);
953
+ $.append($$anchor2, div_14);
932
954
  };
933
955
  $.if(node_24, ($$render) => {
934
956
  if (($.get(rotationActive) || $.get(isHandleHovered)) && $.get(cursorScreen)) $$render(consequent_14);
935
957
  });
936
958
  }
937
959
  $.reset(div);
960
+ $.template_effect(() => {
961
+ styles = $.set_style(div_1, $$props.style, styles, {
962
+ position: "absolute",
963
+ left: `${$.get(currentObject).rect.origin.x * $$props.scale}px`,
964
+ top: `${$.get(currentObject).rect.origin.y * $$props.scale}px`,
965
+ width: `${($.get(counterRot) ? $.get(counterRot).width : $.get(aabbWidth)) ?? ""}px`,
966
+ height: `${($.get(counterRot) ? $.get(counterRot).height : $.get(aabbHeight)) ?? ""}px`,
967
+ "pointer-events": "none",
968
+ "z-index": zIndex(),
969
+ transform: $.get(counterRot) ? $.get(counterRot).matrix : void 0,
970
+ "transform-origin": $.get(counterRot) ? "0 0" : void 0,
971
+ "mix-blend-mode": $$props.blendMode
972
+ });
973
+ styles_1 = $.set_style(div_2, "", styles_1, {
974
+ position: "absolute",
975
+ left: `${$.get(innerLeft) ?? ""}px`,
976
+ top: `${$.get(innerTop) ?? ""}px`,
977
+ width: `${$.get(innerWidth) ?? ""}px`,
978
+ height: `${$.get(innerHeight) ?? ""}px`,
979
+ transform: $.get(annotationRotation) !== 0 ? `rotate(${$.get(annotationRotation)}deg)` : void 0,
980
+ "transform-origin": $.get(innerTransformOrigin),
981
+ "pointer-events": "none"
982
+ });
983
+ });
938
984
  $.append($$anchor, div);
939
985
  $.pop();
940
986
  }
941
987
  $.delegate(["pointermove"]);
942
- var root_2$8 = $.from_html(`<div></div> <div></div> <div></div>`, 1);
943
- var root_4$3 = $.from_html(`<div style="display: contents;"><!></div>`);
988
+ function mapCounterRotatePoint(x, y, width, height, rotation) {
989
+ switch (rotation) {
990
+ case 1:
991
+ return { x: y, y: height - x };
992
+ case 2:
993
+ return { x: width - x, y: height - y };
994
+ case 3:
995
+ return { x: width - y, y: x };
996
+ default:
997
+ return { x, y };
998
+ }
999
+ }
1000
+ function getAnnotationScreenBounds(annotation, scale, rotation) {
1001
+ const flags = annotation.object.flags ?? [];
1002
+ const hasNoZoom = flags.includes("noZoom");
1003
+ const hasNoRotate = flags.includes("noRotate");
1004
+ const left = annotation.object.rect.origin.x * scale;
1005
+ const top = annotation.object.rect.origin.y * scale;
1006
+ const width = annotation.object.rect.size.width * (hasNoZoom ? 1 : scale);
1007
+ const height = annotation.object.rect.size.height * (hasNoZoom ? 1 : scale);
1008
+ if (!hasNoRotate || rotation === 0) {
1009
+ return {
1010
+ left,
1011
+ top,
1012
+ right: left + width,
1013
+ bottom: top + height
1014
+ };
1015
+ }
1016
+ const corners = [
1017
+ mapCounterRotatePoint(0, 0, width, height, rotation),
1018
+ mapCounterRotatePoint(width, 0, width, height, rotation),
1019
+ mapCounterRotatePoint(0, height, width, height, rotation),
1020
+ mapCounterRotatePoint(width, height, width, height, rotation)
1021
+ ];
1022
+ let minX = Infinity;
1023
+ let minY = Infinity;
1024
+ let maxX = -Infinity;
1025
+ let maxY = -Infinity;
1026
+ for (const corner of corners) {
1027
+ if (corner.x < minX) minX = corner.x;
1028
+ if (corner.y < minY) minY = corner.y;
1029
+ if (corner.x > maxX) maxX = corner.x;
1030
+ if (corner.y > maxY) maxY = corner.y;
1031
+ }
1032
+ return {
1033
+ left: left + minX,
1034
+ top: top + minY,
1035
+ right: left + maxX,
1036
+ bottom: top + maxY
1037
+ };
1038
+ }
1039
+ var root_2$a = $.from_html(`<div></div> <div></div> <div></div>`, 1);
1040
+ var root_4$6 = $.from_html(`<div style="display: contents;"><!></div>`);
944
1041
  var root_6$1 = $.from_html(`<div></div>`);
945
- var root_5$3 = $.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>`);
1042
+ var root_5$6 = $.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>`);
946
1043
  var root_10 = $.from_html(`<div></div>`);
947
1044
  var root_11$1 = $.from_html(`<div><div> </div></div>`);
948
- var root_1$d = $.from_html(`<div data-group-selection-box="" data-no-interaction=""><div><!> <!> <div><!></div></div> <!> <!></div>`);
1045
+ var root_1$e = $.from_html(`<div data-group-selection-box="" data-no-interaction=""><div><!> <!> <div><!></div></div> <!> <!></div>`);
949
1046
  function GroupSelectionBox($$anchor, $$props) {
950
1047
  $.push($$props, true);
951
1048
  let isRotatable = $.prop($$props, "isRotatable", 3, true), lockAspectRatio = $.prop($$props, "lockAspectRatio", 3, false), zIndex = $.prop($$props, "zIndex", 3, 2);
@@ -1048,8 +1145,33 @@ function GroupSelectionBox($$anchor, $$props) {
1048
1145
  const groupRotationDisplay = $.derived(() => $.get(liveRotation) ?? 0);
1049
1146
  const rotationActive = $.derived(() => $.get(liveRotation) !== null);
1050
1147
  const normalizedRotationDisplay = $.derived(() => Number.isFinite($.get(groupRotationDisplay)) ? Math.round($.get(groupRotationDisplay) * 10) / 10 : 0);
1051
- const groupBoxWidth = $.derived(() => $.get(previewGroupBox).size.width * $$props.scale);
1052
- const groupBoxHeight = $.derived(() => $.get(previewGroupBox).size.height * $$props.scale);
1148
+ const visualBoundsCorrection = $.derived(() => {
1149
+ let visualLeft = Infinity;
1150
+ let visualTop = Infinity;
1151
+ let visualRight = -Infinity;
1152
+ let visualBottom = -Infinity;
1153
+ for (const ta of $$props.selectedAnnotations) {
1154
+ const bounds = getAnnotationScreenBounds(ta, $$props.scale, $$props.rotation);
1155
+ if (bounds.left < visualLeft) visualLeft = bounds.left;
1156
+ if (bounds.top < visualTop) visualTop = bounds.top;
1157
+ if (bounds.right > visualRight) visualRight = bounds.right;
1158
+ if (bounds.bottom > visualBottom) visualBottom = bounds.bottom;
1159
+ }
1160
+ const logicalLeft = $.get(groupBox).origin.x * $$props.scale;
1161
+ const logicalTop = $.get(groupBox).origin.y * $$props.scale;
1162
+ const logicalRight = ($.get(groupBox).origin.x + $.get(groupBox).size.width) * $$props.scale;
1163
+ const logicalBottom = ($.get(groupBox).origin.y + $.get(groupBox).size.height) * $$props.scale;
1164
+ return {
1165
+ left: visualLeft - logicalLeft,
1166
+ top: visualTop - logicalTop,
1167
+ right: visualRight - logicalRight,
1168
+ bottom: visualBottom - logicalBottom
1169
+ };
1170
+ });
1171
+ const groupBoxLeft = $.derived(() => $.get(previewGroupBox).origin.x * $$props.scale + $.get(visualBoundsCorrection).left);
1172
+ const groupBoxTop = $.derived(() => $.get(previewGroupBox).origin.y * $$props.scale + $.get(visualBoundsCorrection).top);
1173
+ const groupBoxWidth = $.derived(() => $.get(previewGroupBox).size.width * $$props.scale + ($.get(visualBoundsCorrection).right - $.get(visualBoundsCorrection).left));
1174
+ const groupBoxHeight = $.derived(() => $.get(previewGroupBox).size.height * $$props.scale + ($.get(visualBoundsCorrection).bottom - $.get(visualBoundsCorrection).top));
1053
1175
  const groupCenterX = $.derived(() => $.get(groupBoxWidth) / 2);
1054
1176
  const groupCenterY = $.derived(() => $.get(groupBoxHeight) / 2);
1055
1177
  const groupGuideLength = $.derived(() => Math.max(300, Math.max($.get(groupBoxWidth), $.get(groupBoxHeight)) + 80));
@@ -1203,13 +1325,13 @@ function GroupSelectionBox($$anchor, $$props) {
1203
1325
  var node_1 = $.first_child(fragment);
1204
1326
  {
1205
1327
  var consequent_11 = ($$anchor2) => {
1206
- var div = root_1$d();
1328
+ var div = root_1$e();
1207
1329
  var div_1 = $.child(div);
1208
1330
  let styles;
1209
1331
  var node_2 = $.child(div_1);
1210
1332
  {
1211
1333
  var consequent = ($$anchor3) => {
1212
- var fragment_1 = root_2$8();
1334
+ var fragment_1 = root_2$a();
1213
1335
  var div_2 = $.first_child(fragment_1);
1214
1336
  let styles_1;
1215
1337
  var div_3 = $.sibling(div_2, 2);
@@ -1263,7 +1385,7 @@ function GroupSelectionBox($$anchor, $$props) {
1263
1385
  var node_4 = $.first_child(fragment_2);
1264
1386
  {
1265
1387
  var consequent_1 = ($$anchor4) => {
1266
- var div_5 = root_4$3();
1388
+ var div_5 = root_4$6();
1267
1389
  div_5.__pointermove = (e) => {
1268
1390
  if (!$.get(rotationActive)) $.set(cursorScreen, { x: e.clientX, y: e.clientY }, true);
1269
1391
  };
@@ -1293,7 +1415,7 @@ function GroupSelectionBox($$anchor, $$props) {
1293
1415
  $.append($$anchor4, div_5);
1294
1416
  };
1295
1417
  var alternate = ($$anchor4) => {
1296
- var div_6 = root_5$3();
1418
+ var div_6 = root_5$6();
1297
1419
  div_6.__pointermove = (e) => {
1298
1420
  if (!$.get(rotationActive)) $.set(cursorScreen, { x: e.clientX, y: e.clientY }, true);
1299
1421
  };
@@ -1509,14 +1631,8 @@ function GroupSelectionBox($$anchor, $$props) {
1509
1631
  $.append($$anchor4, fragment_7);
1510
1632
  };
1511
1633
  let $0 = $.derived(() => ({
1512
- origin: {
1513
- x: $.get(previewGroupBox).origin.x * $$props.scale,
1514
- y: $.get(previewGroupBox).origin.y * $$props.scale
1515
- },
1516
- size: {
1517
- width: $.get(previewGroupBox).size.width * $$props.scale,
1518
- height: $.get(previewGroupBox).size.height * $$props.scale
1519
- }
1634
+ origin: { x: $.get(groupBoxLeft), y: $.get(groupBoxTop) },
1635
+ size: { width: $.get(groupBoxWidth), height: $.get(groupBoxHeight) }
1520
1636
  }));
1521
1637
  CounterRotate($$anchor3, {
1522
1638
  get rect() {
@@ -1531,14 +1647,14 @@ function GroupSelectionBox($$anchor, $$props) {
1531
1647
  }
1532
1648
  };
1533
1649
  $.if(node_12, ($$render) => {
1534
- if ($.get(shouldShowMenu)) $$render(consequent_10);
1650
+ if ($.get(shouldShowMenu) && !$.get(rotationActive)) $$render(consequent_10);
1535
1651
  });
1536
1652
  }
1537
1653
  $.reset(div);
1538
1654
  $.template_effect(() => styles = $.set_style(div_1, "", styles, {
1539
1655
  position: "absolute",
1540
- left: `${$.get(previewGroupBox).origin.x * $$props.scale}px`,
1541
- top: `${$.get(previewGroupBox).origin.y * $$props.scale}px`,
1656
+ left: `${$.get(groupBoxLeft) ?? ""}px`,
1657
+ top: `${$.get(groupBoxTop) ?? ""}px`,
1542
1658
  width: `${$.get(groupBoxWidth) ?? ""}px`,
1543
1659
  height: `${$.get(groupBoxHeight) ?? ""}px`,
1544
1660
  "pointer-events": "none",
@@ -1554,9 +1670,9 @@ function GroupSelectionBox($$anchor, $$props) {
1554
1670
  $.pop();
1555
1671
  }
1556
1672
  $.delegate(["pointermove"]);
1557
- var root_1$c = $.from_svg(`<path fill="none" stroke="transparent"></path>`);
1673
+ var root_1$d = $.from_svg(`<path fill="none" stroke="transparent"></path>`);
1558
1674
  var root_3$4 = $.from_svg(`<path fill="none"></path>`);
1559
- var root$b = $.from_svg(`<svg><!><!></svg>`);
1675
+ var root$d = $.from_svg(`<svg><!><!></svg>`);
1560
1676
  function Ink($$anchor, $$props) {
1561
1677
  $.push($$props, true);
1562
1678
  const MIN_HIT_AREA_SCREEN_PX = 20;
@@ -1575,19 +1691,15 @@ function Ink($$anchor, $$props) {
1575
1691
  const width = $.derived(() => $$props.rect.size.width * $$props.scale);
1576
1692
  const height = $.derived(() => $$props.rect.size.height * $$props.scale);
1577
1693
  const hitStrokeWidth = $.derived(() => Math.max($$props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / $$props.scale));
1578
- var svg = root$b();
1694
+ var svg = root$d();
1579
1695
  let styles;
1580
1696
  var node = $.child(svg);
1581
1697
  $.each(node, 19, () => $.get(paths), (d, i) => `hit-${i}`, ($$anchor2, d) => {
1582
- var path = root_1$c();
1698
+ var path = root_1$d();
1583
1699
  path.__pointerdown = function(...$$args) {
1584
1700
  var _a;
1585
1701
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1586
1702
  };
1587
- path.__touchstart = function(...$$args) {
1588
- var _a;
1589
- (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1590
- };
1591
1703
  let styles_1;
1592
1704
  $.template_effect(() => {
1593
1705
  $.set_attribute(path, "d", $.get(d));
@@ -1638,7 +1750,7 @@ function Ink($$anchor, $$props) {
1638
1750
  $.append($$anchor, svg);
1639
1751
  $.pop();
1640
1752
  }
1641
- $.delegate(["pointerdown", "touchstart"]);
1753
+ $.delegate(["pointerdown"]);
1642
1754
  function InkRenderer($$anchor, $$props) {
1643
1755
  Ink($$anchor, $.spread_props(() => $$props.currentObject, {
1644
1756
  get isSelected() {
@@ -1655,12 +1767,16 @@ function InkRenderer($$anchor, $$props) {
1655
1767
  }
1656
1768
  }));
1657
1769
  }
1658
- var root_1$b = $.from_svg(`<rect></rect>`);
1659
- var root$a = $.from_svg(`<svg overflow="visible"><rect fill="transparent" stroke="transparent"></rect><!></svg>`);
1770
+ var root_1$c = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
1771
+ var root_2$9 = $.from_svg(`<rect fill="transparent" stroke="transparent"></rect>`);
1772
+ var root_4$5 = $.from_svg(`<path stroke-linejoin="round"></path>`);
1773
+ var root_5$5 = $.from_svg(`<rect></rect>`);
1774
+ var root$c = $.from_svg(`<svg overflow="visible"><!><!></svg>`);
1660
1775
  function Square($$anchor, $$props) {
1661
1776
  $.push($$props, true);
1662
1777
  const MIN_HIT_AREA_SCREEN_PX = 20;
1663
1778
  let color = $.prop($$props, "color", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1), strokeStyle = $.prop($$props, "strokeStyle", 19, () => PdfAnnotationBorderStyle.SOLID), appearanceActive = $.prop($$props, "appearanceActive", 3, false);
1779
+ const isCloudy = $.derived(() => ($$props.cloudyBorderIntensity ?? 0) > 0);
1664
1780
  const $$d = $.derived(() => {
1665
1781
  const outerW = $$props.rect.size.width;
1666
1782
  const outerH = $$props.rect.size.height;
@@ -1673,6 +1789,20 @@ function Square($$anchor, $$props) {
1673
1789
  y: $$props.strokeWidth / 2
1674
1790
  };
1675
1791
  }), width = $.derived(() => $.get($$d).width), height = $.derived(() => $.get($$d).height), x = $.derived(() => $.get($$d).x), y = $.derived(() => $.get($$d).y);
1792
+ const cloudyPath = $.derived(() => {
1793
+ if (!$.get(isCloudy)) return null;
1794
+ return generateCloudyRectanglePath(
1795
+ {
1796
+ x: 0,
1797
+ y: 0,
1798
+ width: $$props.rect.size.width,
1799
+ height: $$props.rect.size.height
1800
+ },
1801
+ $$props.rectangleDifferences,
1802
+ $$props.cloudyBorderIntensity,
1803
+ $$props.strokeWidth
1804
+ );
1805
+ });
1676
1806
  const svgWidth = $.derived(() => ($.get(width) + $$props.strokeWidth) * $$props.scale);
1677
1807
  const svgHeight = $.derived(() => ($.get(height) + $$props.strokeWidth) * $$props.scale);
1678
1808
  const hitStrokeWidth = $.derived(() => Math.max($$props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / $$props.scale));
@@ -1680,41 +1810,101 @@ function Square($$anchor, $$props) {
1680
1810
  var _a;
1681
1811
  return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
1682
1812
  });
1683
- var svg = root$a();
1813
+ var svg = root$c();
1684
1814
  let styles;
1685
- var rect_1 = $.child(svg);
1686
- rect_1.__pointerdown = function(...$$args) {
1687
- var _a;
1688
- (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1689
- };
1690
- rect_1.__touchstart = function(...$$args) {
1691
- var _a;
1692
- (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1693
- };
1694
- let styles_1;
1695
- var node = $.sibling(rect_1);
1815
+ var node = $.child(svg);
1696
1816
  {
1697
1817
  var consequent = ($$anchor2) => {
1698
- var rect_2 = root_1$b();
1818
+ var path = root_1$c();
1819
+ path.__pointerdown = function(...$$args) {
1820
+ var _a;
1821
+ (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1822
+ };
1823
+ let styles_1;
1824
+ $.template_effect(() => {
1825
+ $.set_attribute(path, "d", $.get(cloudyPath).path);
1826
+ $.set_attribute(path, "stroke-width", $.get(hitStrokeWidth));
1827
+ styles_1 = $.set_style(path, "", styles_1, {
1828
+ cursor: $$props.isSelected ? "move" : "pointer",
1829
+ "pointer-events": $$props.isSelected ? "none" : color() === "transparent" ? "visibleStroke" : "visible"
1830
+ });
1831
+ });
1832
+ $.append($$anchor2, path);
1833
+ };
1834
+ var alternate = ($$anchor2) => {
1835
+ var rect_1 = root_2$9();
1836
+ rect_1.__pointerdown = function(...$$args) {
1837
+ var _a;
1838
+ (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1839
+ };
1699
1840
  let styles_2;
1700
1841
  $.template_effect(() => {
1701
- $.set_attribute(rect_2, "x", $.get(x));
1702
- $.set_attribute(rect_2, "y", $.get(y));
1703
- $.set_attribute(rect_2, "width", $.get(width));
1704
- $.set_attribute(rect_2, "height", $.get(height));
1705
- $.set_attribute(rect_2, "fill", color());
1706
- $.set_attribute(rect_2, "opacity", opacity());
1707
- styles_2 = $.set_style(rect_2, "", styles_2, {
1708
- "pointer-events": "none",
1709
- stroke: $$props.strokeColor ?? color(),
1710
- "stroke-width": $$props.strokeWidth,
1711
- "stroke-dasharray": $.get(dash)
1842
+ $.set_attribute(rect_1, "x", $.get(x));
1843
+ $.set_attribute(rect_1, "y", $.get(y));
1844
+ $.set_attribute(rect_1, "width", $.get(width));
1845
+ $.set_attribute(rect_1, "height", $.get(height));
1846
+ $.set_attribute(rect_1, "stroke-width", $.get(hitStrokeWidth));
1847
+ styles_2 = $.set_style(rect_1, "", styles_2, {
1848
+ cursor: $$props.isSelected ? "move" : "pointer",
1849
+ "pointer-events": $$props.isSelected ? "none" : color() === "transparent" ? "visibleStroke" : "visible"
1712
1850
  });
1713
1851
  });
1714
- $.append($$anchor2, rect_2);
1852
+ $.append($$anchor2, rect_1);
1715
1853
  };
1716
1854
  $.if(node, ($$render) => {
1717
- if (!appearanceActive()) $$render(consequent);
1855
+ if ($.get(isCloudy) && $.get(cloudyPath)) $$render(consequent);
1856
+ else $$render(alternate, false);
1857
+ });
1858
+ }
1859
+ var node_1 = $.sibling(node);
1860
+ {
1861
+ var consequent_2 = ($$anchor2) => {
1862
+ var fragment = $.comment();
1863
+ var node_2 = $.first_child(fragment);
1864
+ {
1865
+ var consequent_1 = ($$anchor3) => {
1866
+ var path_1 = root_4$5();
1867
+ let styles_3;
1868
+ $.template_effect(() => {
1869
+ $.set_attribute(path_1, "d", $.get(cloudyPath).path);
1870
+ $.set_attribute(path_1, "fill", color());
1871
+ $.set_attribute(path_1, "opacity", opacity());
1872
+ styles_3 = $.set_style(path_1, "", styles_3, {
1873
+ "pointer-events": "none",
1874
+ stroke: $$props.strokeColor ?? color(),
1875
+ "stroke-width": $$props.strokeWidth
1876
+ });
1877
+ });
1878
+ $.append($$anchor3, path_1);
1879
+ };
1880
+ var alternate_1 = ($$anchor3) => {
1881
+ var rect_2 = root_5$5();
1882
+ let styles_4;
1883
+ $.template_effect(() => {
1884
+ $.set_attribute(rect_2, "x", $.get(x));
1885
+ $.set_attribute(rect_2, "y", $.get(y));
1886
+ $.set_attribute(rect_2, "width", $.get(width));
1887
+ $.set_attribute(rect_2, "height", $.get(height));
1888
+ $.set_attribute(rect_2, "fill", color());
1889
+ $.set_attribute(rect_2, "opacity", opacity());
1890
+ styles_4 = $.set_style(rect_2, "", styles_4, {
1891
+ "pointer-events": "none",
1892
+ stroke: $$props.strokeColor ?? color(),
1893
+ "stroke-width": $$props.strokeWidth,
1894
+ "stroke-dasharray": $.get(dash)
1895
+ });
1896
+ });
1897
+ $.append($$anchor3, rect_2);
1898
+ };
1899
+ $.if(node_2, ($$render) => {
1900
+ if ($.get(isCloudy) && $.get(cloudyPath)) $$render(consequent_1);
1901
+ else $$render(alternate_1, false);
1902
+ });
1903
+ }
1904
+ $.append($$anchor2, fragment);
1905
+ };
1906
+ $.if(node_1, ($$render) => {
1907
+ if (!appearanceActive()) $$render(consequent_2);
1718
1908
  });
1719
1909
  }
1720
1910
  $.reset(svg);
@@ -1726,20 +1916,11 @@ function Square($$anchor, $$props) {
1726
1916
  $.set_attribute(svg, "width", $.get(svgWidth));
1727
1917
  $.set_attribute(svg, "height", $.get(svgHeight));
1728
1918
  $.set_attribute(svg, "viewBox", `0 0 ${$.get(width) + $$props.strokeWidth} ${$.get(height) + $$props.strokeWidth}`);
1729
- $.set_attribute(rect_1, "x", $.get(x));
1730
- $.set_attribute(rect_1, "y", $.get(y));
1731
- $.set_attribute(rect_1, "width", $.get(width));
1732
- $.set_attribute(rect_1, "height", $.get(height));
1733
- $.set_attribute(rect_1, "stroke-width", $.get(hitStrokeWidth));
1734
- styles_1 = $.set_style(rect_1, "", styles_1, {
1735
- cursor: $$props.isSelected ? "move" : "pointer",
1736
- "pointer-events": $$props.isSelected ? "none" : color() === "transparent" ? "visibleStroke" : "visible"
1737
- });
1738
1919
  });
1739
1920
  $.append($$anchor, svg);
1740
1921
  $.pop();
1741
1922
  }
1742
- $.delegate(["pointerdown", "touchstart"]);
1923
+ $.delegate(["pointerdown"]);
1743
1924
  function SquareRenderer($$anchor, $$props) {
1744
1925
  Square($$anchor, $.spread_props(() => $$props.currentObject, {
1745
1926
  get isSelected() {
@@ -1756,12 +1937,16 @@ function SquareRenderer($$anchor, $$props) {
1756
1937
  }
1757
1938
  }));
1758
1939
  }
1759
- var root_1$a = $.from_svg(`<ellipse></ellipse>`);
1760
- var root$9 = $.from_svg(`<svg overflow="visible"><ellipse fill="transparent" stroke="transparent"></ellipse><!></svg>`);
1940
+ var root_1$b = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
1941
+ var root_2$8 = $.from_svg(`<ellipse fill="transparent" stroke="transparent"></ellipse>`);
1942
+ var root_4$4 = $.from_svg(`<path stroke-linejoin="round"></path>`);
1943
+ var root_5$4 = $.from_svg(`<ellipse></ellipse>`);
1944
+ var root$b = $.from_svg(`<svg overflow="visible"><!><!></svg>`);
1761
1945
  function Circle($$anchor, $$props) {
1762
1946
  $.push($$props, true);
1763
1947
  const MIN_HIT_AREA_SCREEN_PX = 20;
1764
1948
  let color = $.prop($$props, "color", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1), strokeStyle = $.prop($$props, "strokeStyle", 19, () => PdfAnnotationBorderStyle.SOLID), appearanceActive = $.prop($$props, "appearanceActive", 3, false);
1949
+ const isCloudy = $.derived(() => ($$props.cloudyBorderIntensity ?? 0) > 0);
1765
1950
  const $$d = $.derived(() => {
1766
1951
  const outerW = $$props.rect.size.width;
1767
1952
  const outerH = $$props.rect.size.height;
@@ -1776,50 +1961,117 @@ function Circle($$anchor, $$props) {
1776
1961
  ry: innerH / 2
1777
1962
  };
1778
1963
  }), width = $.derived(() => $.get($$d).width), height = $.derived(() => $.get($$d).height), cx = $.derived(() => $.get($$d).cx), cy = $.derived(() => $.get($$d).cy), rx = $.derived(() => $.get($$d).rx), ry = $.derived(() => $.get($$d).ry);
1964
+ const cloudyPath = $.derived(() => {
1965
+ if (!$.get(isCloudy)) return null;
1966
+ return generateCloudyEllipsePath(
1967
+ {
1968
+ x: 0,
1969
+ y: 0,
1970
+ width: $$props.rect.size.width,
1971
+ height: $$props.rect.size.height
1972
+ },
1973
+ $$props.rectangleDifferences,
1974
+ $$props.cloudyBorderIntensity,
1975
+ $$props.strokeWidth
1976
+ );
1977
+ });
1779
1978
  let svgWidth = $.derived(() => $.get(width) * $$props.scale);
1780
1979
  let svgHeight = $.derived(() => $.get(height) * $$props.scale);
1781
1980
  let hitStrokeWidth = $.derived(() => Math.max($$props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / $$props.scale));
1782
1981
  let peValue = $.derived(() => $$props.isSelected ? "none" : color() === "transparent" ? "visibleStroke" : "visible");
1783
- var svg = root$9();
1982
+ var svg = root$b();
1784
1983
  let styles;
1785
- var ellipse = $.child(svg);
1786
- ellipse.__pointerdown = (e) => {
1787
- var _a;
1788
- return (_a = $$props.onClick) == null ? void 0 : _a.call($$props, e);
1789
- };
1790
- ellipse.__touchstart = (e) => {
1791
- var _a;
1792
- return (_a = $$props.onClick) == null ? void 0 : _a.call($$props, e);
1793
- };
1794
- let styles_1;
1795
- var node = $.sibling(ellipse);
1984
+ var node = $.child(svg);
1796
1985
  {
1797
1986
  var consequent = ($$anchor2) => {
1798
- var ellipse_1 = root_1$a();
1799
- $.set_style(ellipse_1, "", {}, { "pointer-events": "none" });
1800
- $.template_effect(
1801
- ($0) => {
1802
- $.set_attribute(ellipse_1, "cx", $.get(cx));
1803
- $.set_attribute(ellipse_1, "cy", $.get(cy));
1804
- $.set_attribute(ellipse_1, "rx", $.get(rx));
1805
- $.set_attribute(ellipse_1, "ry", $.get(ry));
1806
- $.set_attribute(ellipse_1, "fill", color());
1807
- $.set_attribute(ellipse_1, "opacity", opacity());
1808
- $.set_attribute(ellipse_1, "stroke", $$props.strokeColor ?? color());
1809
- $.set_attribute(ellipse_1, "stroke-width", $$props.strokeWidth);
1810
- $.set_attribute(ellipse_1, "stroke-dasharray", $0);
1811
- },
1812
- [
1813
- () => {
1814
- var _a;
1815
- return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
1816
- }
1817
- ]
1818
- );
1819
- $.append($$anchor2, ellipse_1);
1987
+ var path = root_1$b();
1988
+ path.__pointerdown = (e) => {
1989
+ var _a;
1990
+ return (_a = $$props.onClick) == null ? void 0 : _a.call($$props, e);
1991
+ };
1992
+ let styles_1;
1993
+ $.template_effect(() => {
1994
+ $.set_attribute(path, "d", $.get(cloudyPath).path);
1995
+ $.set_attribute(path, "stroke-width", $.get(hitStrokeWidth));
1996
+ $.set_attribute(path, "pointer-events", $.get(peValue));
1997
+ styles_1 = $.set_style(path, "", styles_1, { cursor: $$props.isSelected ? "move" : "pointer" });
1998
+ });
1999
+ $.append($$anchor2, path);
2000
+ };
2001
+ var alternate = ($$anchor2) => {
2002
+ var ellipse = root_2$8();
2003
+ ellipse.__pointerdown = (e) => {
2004
+ var _a;
2005
+ return (_a = $$props.onClick) == null ? void 0 : _a.call($$props, e);
2006
+ };
2007
+ let styles_2;
2008
+ $.template_effect(() => {
2009
+ $.set_attribute(ellipse, "cx", $.get(cx));
2010
+ $.set_attribute(ellipse, "cy", $.get(cy));
2011
+ $.set_attribute(ellipse, "rx", $.get(rx));
2012
+ $.set_attribute(ellipse, "ry", $.get(ry));
2013
+ $.set_attribute(ellipse, "stroke-width", $.get(hitStrokeWidth));
2014
+ $.set_attribute(ellipse, "pointer-events", $.get(peValue));
2015
+ styles_2 = $.set_style(ellipse, "", styles_2, { cursor: $$props.isSelected ? "move" : "pointer" });
2016
+ });
2017
+ $.append($$anchor2, ellipse);
1820
2018
  };
1821
2019
  $.if(node, ($$render) => {
1822
- if (!appearanceActive()) $$render(consequent);
2020
+ if ($.get(isCloudy) && $.get(cloudyPath)) $$render(consequent);
2021
+ else $$render(alternate, false);
2022
+ });
2023
+ }
2024
+ var node_1 = $.sibling(node);
2025
+ {
2026
+ var consequent_2 = ($$anchor2) => {
2027
+ var fragment = $.comment();
2028
+ var node_2 = $.first_child(fragment);
2029
+ {
2030
+ var consequent_1 = ($$anchor3) => {
2031
+ var path_1 = root_4$4();
2032
+ $.set_style(path_1, "", {}, { "pointer-events": "none" });
2033
+ $.template_effect(() => {
2034
+ $.set_attribute(path_1, "d", $.get(cloudyPath).path);
2035
+ $.set_attribute(path_1, "fill", color());
2036
+ $.set_attribute(path_1, "opacity", opacity());
2037
+ $.set_attribute(path_1, "stroke", $$props.strokeColor ?? color());
2038
+ $.set_attribute(path_1, "stroke-width", $$props.strokeWidth);
2039
+ });
2040
+ $.append($$anchor3, path_1);
2041
+ };
2042
+ var alternate_1 = ($$anchor3) => {
2043
+ var ellipse_1 = root_5$4();
2044
+ $.set_style(ellipse_1, "", {}, { "pointer-events": "none" });
2045
+ $.template_effect(
2046
+ ($0) => {
2047
+ $.set_attribute(ellipse_1, "cx", $.get(cx));
2048
+ $.set_attribute(ellipse_1, "cy", $.get(cy));
2049
+ $.set_attribute(ellipse_1, "rx", $.get(rx));
2050
+ $.set_attribute(ellipse_1, "ry", $.get(ry));
2051
+ $.set_attribute(ellipse_1, "fill", color());
2052
+ $.set_attribute(ellipse_1, "opacity", opacity());
2053
+ $.set_attribute(ellipse_1, "stroke", $$props.strokeColor ?? color());
2054
+ $.set_attribute(ellipse_1, "stroke-width", $$props.strokeWidth);
2055
+ $.set_attribute(ellipse_1, "stroke-dasharray", $0);
2056
+ },
2057
+ [
2058
+ () => {
2059
+ var _a;
2060
+ return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
2061
+ }
2062
+ ]
2063
+ );
2064
+ $.append($$anchor3, ellipse_1);
2065
+ };
2066
+ $.if(node_2, ($$render) => {
2067
+ if ($.get(isCloudy) && $.get(cloudyPath)) $$render(consequent_1);
2068
+ else $$render(alternate_1, false);
2069
+ });
2070
+ }
2071
+ $.append($$anchor2, fragment);
2072
+ };
2073
+ $.if(node_1, ($$render) => {
2074
+ if (!appearanceActive()) $$render(consequent_2);
1823
2075
  });
1824
2076
  }
1825
2077
  $.reset(svg);
@@ -1834,18 +2086,11 @@ function Circle($$anchor, $$props) {
1834
2086
  "pointer-events": "none",
1835
2087
  "z-index": "2"
1836
2088
  });
1837
- $.set_attribute(ellipse, "cx", $.get(cx));
1838
- $.set_attribute(ellipse, "cy", $.get(cy));
1839
- $.set_attribute(ellipse, "rx", $.get(rx));
1840
- $.set_attribute(ellipse, "ry", $.get(ry));
1841
- $.set_attribute(ellipse, "stroke-width", $.get(hitStrokeWidth));
1842
- $.set_attribute(ellipse, "pointer-events", $.get(peValue));
1843
- styles_1 = $.set_style(ellipse, "", styles_1, { cursor: $$props.isSelected ? "move" : "pointer" });
1844
2089
  });
1845
2090
  $.append($$anchor, svg);
1846
2091
  $.pop();
1847
2092
  }
1848
- $.delegate(["pointerdown", "touchstart"]);
2093
+ $.delegate(["pointerdown"]);
1849
2094
  function CircleRenderer($$anchor, $$props) {
1850
2095
  Circle($$anchor, $.spread_props(() => $$props.currentObject, {
1851
2096
  get isSelected() {
@@ -1862,12 +2107,12 @@ function CircleRenderer($$anchor, $$props) {
1862
2107
  }
1863
2108
  }));
1864
2109
  }
1865
- var root_1$9 = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
2110
+ var root_1$a = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
1866
2111
  var root_2$7 = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
1867
- var root_4$2 = $.from_svg(`<path></path>`);
1868
- var root_5$2 = $.from_svg(`<path></path>`);
2112
+ var root_4$3 = $.from_svg(`<path></path>`);
2113
+ var root_5$3 = $.from_svg(`<path></path>`);
1869
2114
  var root_3$3 = $.from_svg(`<line></line><!><!>`, 1);
1870
- var root$8 = $.from_svg(`<svg><line stroke="transparent"></line><!><!><!></svg>`);
2115
+ var root$a = $.from_svg(`<svg><line stroke="transparent"></line><!><!><!></svg>`);
1871
2116
  function Line($$anchor, $$props) {
1872
2117
  $.push($$props, true);
1873
2118
  const MIN_HIT_AREA_SCREEN_PX = 20;
@@ -1891,30 +2136,22 @@ function Line($$anchor, $$props) {
1891
2136
  var _a;
1892
2137
  return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
1893
2138
  });
1894
- var svg = root$8();
2139
+ var svg = root$a();
1895
2140
  let styles;
1896
2141
  var line = $.child(svg);
1897
2142
  line.__pointerdown = function(...$$args) {
1898
2143
  var _a;
1899
2144
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1900
2145
  };
1901
- line.__touchstart = function(...$$args) {
1902
- var _a;
1903
- (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1904
- };
1905
2146
  let styles_1;
1906
2147
  var node = $.sibling(line);
1907
2148
  {
1908
2149
  var consequent = ($$anchor2) => {
1909
- var path = root_1$9();
2150
+ var path = root_1$a();
1910
2151
  path.__pointerdown = function(...$$args) {
1911
2152
  var _a;
1912
2153
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1913
2154
  };
1914
- path.__touchstart = function(...$$args) {
1915
- var _a;
1916
- (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1917
- };
1918
2155
  let styles_2;
1919
2156
  $.template_effect(() => {
1920
2157
  $.set_attribute(path, "d", $.get(endings).start.d);
@@ -1940,10 +2177,6 @@ function Line($$anchor, $$props) {
1940
2177
  var _a;
1941
2178
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1942
2179
  };
1943
- path_1.__touchstart = function(...$$args) {
1944
- var _a;
1945
- (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
1946
- };
1947
2180
  let styles_3;
1948
2181
  $.template_effect(() => {
1949
2182
  $.set_attribute(path_1, "d", $.get(endings).end.d);
@@ -1970,7 +2203,7 @@ function Line($$anchor, $$props) {
1970
2203
  var node_3 = $.sibling(line_1);
1971
2204
  {
1972
2205
  var consequent_2 = ($$anchor3) => {
1973
- var path_2 = root_4$2();
2206
+ var path_2 = root_4$3();
1974
2207
  let styles_5;
1975
2208
  $.template_effect(() => {
1976
2209
  $.set_attribute(path_2, "d", $.get(endings).start.d);
@@ -1993,7 +2226,7 @@ function Line($$anchor, $$props) {
1993
2226
  var node_4 = $.sibling(node_3);
1994
2227
  {
1995
2228
  var consequent_3 = ($$anchor3) => {
1996
- var path_3 = root_5$2();
2229
+ var path_3 = root_5$3();
1997
2230
  let styles_6;
1998
2231
  $.template_effect(() => {
1999
2232
  $.set_attribute(path_3, "d", $.get(endings).end.d);
@@ -2053,7 +2286,7 @@ function Line($$anchor, $$props) {
2053
2286
  $.append($$anchor, svg);
2054
2287
  $.pop();
2055
2288
  }
2056
- $.delegate(["pointerdown", "touchstart"]);
2289
+ $.delegate(["pointerdown"]);
2057
2290
  function LineRenderer($$anchor, $$props) {
2058
2291
  Line($$anchor, $.spread_props(() => $$props.currentObject, {
2059
2292
  get isSelected() {
@@ -2070,16 +2303,16 @@ function LineRenderer($$anchor, $$props) {
2070
2303
  }
2071
2304
  }));
2072
2305
  }
2073
- var root_1$8 = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
2306
+ var root_1$9 = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
2074
2307
  var root_2$6 = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
2075
- var root_4$1 = $.from_svg(`<path></path>`);
2076
- var root_5$1 = $.from_svg(`<path></path>`);
2308
+ var root_4$2 = $.from_svg(`<path></path>`);
2309
+ var root_5$2 = $.from_svg(`<path></path>`);
2077
2310
  var root_3$2 = $.from_svg(`<path></path><!><!>`, 1);
2078
- var root$7 = $.from_svg(`<svg><path fill="none" stroke="transparent"></path><!><!><!></svg>`);
2311
+ var root$9 = $.from_svg(`<svg><path fill="none" stroke="transparent"></path><!><!><!></svg>`);
2079
2312
  function Polyline($$anchor, $$props) {
2080
2313
  $.push($$props, true);
2081
2314
  const MIN_HIT_AREA_SCREEN_PX = 20;
2082
- let color = $.prop($$props, "color", 3, "transparent"), strokeColor = $.prop($$props, "strokeColor", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1), appearanceActive = $.prop($$props, "appearanceActive", 3, false);
2315
+ let color = $.prop($$props, "color", 3, "transparent"), strokeColor = $.prop($$props, "strokeColor", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1), strokeStyle = $.prop($$props, "strokeStyle", 19, () => PdfAnnotationBorderStyle.SOLID), appearanceActive = $.prop($$props, "appearanceActive", 3, false);
2083
2316
  const localPts = $.derived(() => $$props.vertices.map(({ x, y }) => ({ x: x - $$props.rect.origin.x, y: y - $$props.rect.origin.y })));
2084
2317
  const pathData = $.derived(() => {
2085
2318
  if (!$.get(localPts).length) return "";
@@ -2099,30 +2332,26 @@ function Polyline($$anchor, $$props) {
2099
2332
  const width = $.derived(() => $$props.rect.size.width * $$props.scale);
2100
2333
  const height = $.derived(() => $$props.rect.size.height * $$props.scale);
2101
2334
  const hitStrokeWidth = $.derived(() => Math.max($$props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / $$props.scale));
2102
- var svg = root$7();
2335
+ const dash = $.derived(() => {
2336
+ var _a;
2337
+ return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
2338
+ });
2339
+ var svg = root$9();
2103
2340
  let styles;
2104
2341
  var path = $.child(svg);
2105
2342
  path.__pointerdown = function(...$$args) {
2106
2343
  var _a;
2107
2344
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2108
2345
  };
2109
- path.__touchstart = function(...$$args) {
2110
- var _a;
2111
- (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2112
- };
2113
2346
  let styles_1;
2114
2347
  var node = $.sibling(path);
2115
2348
  {
2116
2349
  var consequent = ($$anchor2) => {
2117
- var path_1 = root_1$8();
2350
+ var path_1 = root_1$9();
2118
2351
  path_1.__pointerdown = function(...$$args) {
2119
2352
  var _a;
2120
2353
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2121
2354
  };
2122
- path_1.__touchstart = function(...$$args) {
2123
- var _a;
2124
- (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2125
- };
2126
2355
  let styles_2;
2127
2356
  $.template_effect(() => {
2128
2357
  $.set_attribute(path_1, "d", $.get(endings).start.d);
@@ -2148,10 +2377,6 @@ function Polyline($$anchor, $$props) {
2148
2377
  var _a;
2149
2378
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2150
2379
  };
2151
- path_2.__touchstart = function(...$$args) {
2152
- var _a;
2153
- (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2154
- };
2155
2380
  let styles_3;
2156
2381
  $.template_effect(() => {
2157
2382
  $.set_attribute(path_2, "d", $.get(endings).end.d);
@@ -2178,7 +2403,7 @@ function Polyline($$anchor, $$props) {
2178
2403
  var node_3 = $.sibling(path_3);
2179
2404
  {
2180
2405
  var consequent_2 = ($$anchor3) => {
2181
- var path_4 = root_4$1();
2406
+ var path_4 = root_4$2();
2182
2407
  let styles_5;
2183
2408
  $.template_effect(() => {
2184
2409
  $.set_attribute(path_4, "d", $.get(endings).start.d);
@@ -2188,7 +2413,8 @@ function Polyline($$anchor, $$props) {
2188
2413
  styles_5 = $.set_style(path_4, "", styles_5, {
2189
2414
  "pointer-events": "none",
2190
2415
  "stroke-width": $$props.strokeWidth,
2191
- "stroke-linecap": "butt"
2416
+ "stroke-linecap": "butt",
2417
+ "stroke-dasharray": $.get(dash)
2192
2418
  });
2193
2419
  });
2194
2420
  $.append($$anchor3, path_4);
@@ -2200,7 +2426,7 @@ function Polyline($$anchor, $$props) {
2200
2426
  var node_4 = $.sibling(node_3);
2201
2427
  {
2202
2428
  var consequent_3 = ($$anchor3) => {
2203
- var path_5 = root_5$1();
2429
+ var path_5 = root_5$2();
2204
2430
  let styles_6;
2205
2431
  $.template_effect(() => {
2206
2432
  $.set_attribute(path_5, "d", $.get(endings).end.d);
@@ -2210,7 +2436,8 @@ function Polyline($$anchor, $$props) {
2210
2436
  styles_6 = $.set_style(path_5, "", styles_6, {
2211
2437
  "pointer-events": "none",
2212
2438
  "stroke-width": $$props.strokeWidth,
2213
- "stroke-linecap": "butt"
2439
+ "stroke-linecap": "butt",
2440
+ "stroke-dasharray": $.get(dash)
2214
2441
  });
2215
2442
  });
2216
2443
  $.append($$anchor3, path_5);
@@ -2228,7 +2455,8 @@ function Polyline($$anchor, $$props) {
2228
2455
  "stroke-width": $$props.strokeWidth,
2229
2456
  "pointer-events": "none",
2230
2457
  "stroke-linecap": "butt",
2231
- "stroke-linejoin": "miter"
2458
+ "stroke-linejoin": "miter",
2459
+ "stroke-dasharray": $.get(dash)
2232
2460
  });
2233
2461
  });
2234
2462
  $.append($$anchor2, fragment);
@@ -2255,7 +2483,7 @@ function Polyline($$anchor, $$props) {
2255
2483
  $.append($$anchor, svg);
2256
2484
  $.pop();
2257
2485
  }
2258
- $.delegate(["pointerdown", "touchstart"]);
2486
+ $.delegate(["pointerdown"]);
2259
2487
  function PolylineRenderer($$anchor, $$props) {
2260
2488
  Polyline($$anchor, $.spread_props(() => $$props.currentObject, {
2261
2489
  get isSelected() {
@@ -2272,14 +2500,16 @@ function PolylineRenderer($$anchor, $$props) {
2272
2500
  }
2273
2501
  }));
2274
2502
  }
2275
- var root_2$5 = $.from_svg(`<path fill="none"></path>`);
2276
- var root_3$1 = $.from_svg(`<rect></rect>`);
2277
- var root_1$7 = $.from_svg(`<path></path><!><!>`, 1);
2278
- var root$6 = $.from_svg(`<svg><path fill="transparent" stroke="transparent"></path><!></svg>`);
2503
+ var root_2$5 = $.from_svg(`<path></path>`);
2504
+ var root_4$1 = $.from_svg(`<path fill="none"></path>`);
2505
+ var root_5$1 = $.from_svg(`<rect></rect>`);
2506
+ var root_3$1 = $.from_svg(`<path></path><!><!>`, 1);
2507
+ var root$8 = $.from_svg(`<svg><path fill="transparent" stroke="transparent"></path><!></svg>`);
2279
2508
  function Polygon($$anchor, $$props) {
2280
2509
  $.push($$props, true);
2281
2510
  const MIN_HIT_AREA_SCREEN_PX = 20;
2282
2511
  let color = $.prop($$props, "color", 3, "transparent"), strokeColor = $.prop($$props, "strokeColor", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1), strokeStyle = $.prop($$props, "strokeStyle", 19, () => PdfAnnotationBorderStyle.SOLID), handleSize = $.prop($$props, "handleSize", 3, 14), appearanceActive = $.prop($$props, "appearanceActive", 3, false);
2512
+ const isCloudy = $.derived(() => ($$props.cloudyBorderIntensity ?? 0) > 0);
2283
2513
  const allPoints = $.derived(() => $$props.currentVertex ? [...$$props.vertices, $$props.currentVertex] : $$props.vertices);
2284
2514
  const localPts = $.derived(() => $.get(allPoints).map(({ x, y }) => ({ x: x - $$props.rect.origin.x, y: y - $$props.rect.origin.y })));
2285
2515
  const pathData = $.derived(() => {
@@ -2288,6 +2518,10 @@ function Polygon($$anchor, $$props) {
2288
2518
  const isPreview = !!$$props.currentVertex;
2289
2519
  return (`M ${first.x} ${first.y} ` + rest.map((p) => `L ${p.x} ${p.y}`).join(" ") + (isPreview ? "" : " Z")).trim();
2290
2520
  });
2521
+ const cloudyPath = $.derived(() => {
2522
+ if (!$.get(isCloudy) || $.get(allPoints).length < 3) return null;
2523
+ return generateCloudyPolygonPath($.get(allPoints), $$props.rect.origin, $$props.cloudyBorderIntensity, $$props.strokeWidth);
2524
+ });
2291
2525
  const isPreviewing = $.derived(() => !!$$props.currentVertex && $$props.vertices.length > 0);
2292
2526
  const width = $.derived(() => $$props.rect.size.width * $$props.scale);
2293
2527
  const height = $.derived(() => $$props.rect.size.height * $$props.scale);
@@ -2296,83 +2530,106 @@ function Polygon($$anchor, $$props) {
2296
2530
  var _a;
2297
2531
  return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
2298
2532
  });
2299
- var svg = root$6();
2533
+ var svg = root$8();
2300
2534
  let styles;
2301
2535
  var path = $.child(svg);
2302
2536
  path.__pointerdown = function(...$$args) {
2303
2537
  var _a;
2304
2538
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2305
2539
  };
2306
- path.__touchstart = function(...$$args) {
2307
- var _a;
2308
- (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2309
- };
2310
2540
  let styles_1;
2311
2541
  var node = $.sibling(path);
2312
2542
  {
2313
- var consequent_2 = ($$anchor2) => {
2314
- var fragment = root_1$7();
2315
- var path_1 = $.first_child(fragment);
2316
- let styles_2;
2317
- var node_1 = $.sibling(path_1);
2543
+ var consequent_3 = ($$anchor2) => {
2544
+ var fragment = $.comment();
2545
+ var node_1 = $.first_child(fragment);
2318
2546
  {
2319
2547
  var consequent = ($$anchor3) => {
2320
- var path_2 = root_2$5();
2321
- let styles_3;
2548
+ var path_1 = root_2$5();
2549
+ let styles_2;
2322
2550
  $.template_effect(() => {
2323
- $.set_attribute(path_2, "d", `M ${$.get(localPts)[$.get(localPts).length - 1].x} ${$.get(localPts)[$.get(localPts).length - 1].y} L ${$.get(localPts)[0].x} ${$.get(localPts)[0].y}`);
2324
- styles_3 = $.set_style(path_2, "", styles_3, {
2325
- stroke: strokeColor(),
2551
+ $.set_attribute(path_1, "d", $.get(cloudyPath).path);
2552
+ $.set_attribute(path_1, "opacity", opacity());
2553
+ styles_2 = $.set_style(path_1, "", styles_2, {
2554
+ fill: color(),
2555
+ stroke: strokeColor() ?? color(),
2326
2556
  "stroke-width": $$props.strokeWidth,
2327
- "stroke-dasharray": "4,4",
2328
- opacity: 0.7,
2329
- "pointer-events": "none"
2557
+ "pointer-events": "none",
2558
+ "stroke-linejoin": "round"
2330
2559
  });
2331
2560
  });
2332
- $.append($$anchor3, path_2);
2561
+ $.append($$anchor3, path_1);
2333
2562
  };
2334
- $.if(node_1, ($$render) => {
2335
- if ($.get(isPreviewing) && $$props.vertices.length > 1) $$render(consequent);
2336
- });
2337
- }
2338
- var node_2 = $.sibling(node_1);
2339
- {
2340
- var consequent_1 = ($$anchor3) => {
2341
- var rect_1 = root_3$1();
2342
- $.set_attribute(rect_1, "opacity", 0.4);
2343
- $.set_style(rect_1, "", {}, { "pointer-events": "none" });
2563
+ var alternate = ($$anchor3) => {
2564
+ var fragment_1 = root_3$1();
2565
+ var path_2 = $.first_child(fragment_1);
2566
+ let styles_3;
2567
+ var node_2 = $.sibling(path_2);
2568
+ {
2569
+ var consequent_1 = ($$anchor4) => {
2570
+ var path_3 = root_4$1();
2571
+ let styles_4;
2572
+ $.template_effect(() => {
2573
+ $.set_attribute(path_3, "d", `M ${$.get(localPts)[$.get(localPts).length - 1].x} ${$.get(localPts)[$.get(localPts).length - 1].y} L ${$.get(localPts)[0].x} ${$.get(localPts)[0].y}`);
2574
+ styles_4 = $.set_style(path_3, "", styles_4, {
2575
+ stroke: strokeColor(),
2576
+ "stroke-width": $$props.strokeWidth,
2577
+ "stroke-dasharray": "4,4",
2578
+ opacity: 0.7,
2579
+ "pointer-events": "none"
2580
+ });
2581
+ });
2582
+ $.append($$anchor4, path_3);
2583
+ };
2584
+ $.if(node_2, ($$render) => {
2585
+ if ($.get(isPreviewing) && $$props.vertices.length > 1) $$render(consequent_1);
2586
+ });
2587
+ }
2588
+ var node_3 = $.sibling(node_2);
2589
+ {
2590
+ var consequent_2 = ($$anchor4) => {
2591
+ var rect_1 = root_5$1();
2592
+ $.set_attribute(rect_1, "opacity", 0.4);
2593
+ $.set_style(rect_1, "", {}, { "pointer-events": "none" });
2594
+ $.template_effect(() => {
2595
+ $.set_attribute(rect_1, "x", $.get(localPts)[0].x - handleSize() / $$props.scale / 2);
2596
+ $.set_attribute(rect_1, "y", $.get(localPts)[0].y - handleSize() / $$props.scale / 2);
2597
+ $.set_attribute(rect_1, "width", handleSize() / $$props.scale);
2598
+ $.set_attribute(rect_1, "height", handleSize() / $$props.scale);
2599
+ $.set_attribute(rect_1, "fill", strokeColor());
2600
+ $.set_attribute(rect_1, "stroke", strokeColor());
2601
+ $.set_attribute(rect_1, "stroke-width", $$props.strokeWidth / 2);
2602
+ });
2603
+ $.append($$anchor4, rect_1);
2604
+ };
2605
+ $.if(node_3, ($$render) => {
2606
+ if ($.get(isPreviewing) && $$props.vertices.length >= 2) $$render(consequent_2);
2607
+ });
2608
+ }
2344
2609
  $.template_effect(() => {
2345
- $.set_attribute(rect_1, "x", $.get(localPts)[0].x - handleSize() / $$props.scale / 2);
2346
- $.set_attribute(rect_1, "y", $.get(localPts)[0].y - handleSize() / $$props.scale / 2);
2347
- $.set_attribute(rect_1, "width", handleSize() / $$props.scale);
2348
- $.set_attribute(rect_1, "height", handleSize() / $$props.scale);
2349
- $.set_attribute(rect_1, "fill", strokeColor());
2350
- $.set_attribute(rect_1, "stroke", strokeColor());
2351
- $.set_attribute(rect_1, "stroke-width", $$props.strokeWidth / 2);
2610
+ $.set_attribute(path_2, "d", $.get(pathData));
2611
+ $.set_attribute(path_2, "opacity", opacity());
2612
+ styles_3 = $.set_style(path_2, "", styles_3, {
2613
+ fill: $$props.currentVertex ? "none" : color(),
2614
+ stroke: strokeColor() ?? color(),
2615
+ "stroke-width": $$props.strokeWidth,
2616
+ "pointer-events": "none",
2617
+ "stroke-linecap": "butt",
2618
+ "stroke-linejoin": "miter",
2619
+ "stroke-dasharray": $.get(dash)
2620
+ });
2352
2621
  });
2353
- $.append($$anchor3, rect_1);
2622
+ $.append($$anchor3, fragment_1);
2354
2623
  };
2355
- $.if(node_2, ($$render) => {
2356
- if ($.get(isPreviewing) && $$props.vertices.length >= 2) $$render(consequent_1);
2624
+ $.if(node_1, ($$render) => {
2625
+ if ($.get(isCloudy) && $.get(cloudyPath)) $$render(consequent);
2626
+ else $$render(alternate, false);
2357
2627
  });
2358
2628
  }
2359
- $.template_effect(() => {
2360
- $.set_attribute(path_1, "d", $.get(pathData));
2361
- $.set_attribute(path_1, "opacity", opacity());
2362
- styles_2 = $.set_style(path_1, "", styles_2, {
2363
- fill: $$props.currentVertex ? "none" : color(),
2364
- stroke: strokeColor() ?? color(),
2365
- "stroke-width": $$props.strokeWidth,
2366
- "pointer-events": "none",
2367
- "stroke-linecap": "butt",
2368
- "stroke-linejoin": "miter",
2369
- "stroke-dasharray": $.get(dash)
2370
- });
2371
- });
2372
2629
  $.append($$anchor2, fragment);
2373
2630
  };
2374
2631
  $.if(node, ($$render) => {
2375
- if (!appearanceActive()) $$render(consequent_2);
2632
+ if (!appearanceActive()) $$render(consequent_3);
2376
2633
  });
2377
2634
  }
2378
2635
  $.reset(svg);
@@ -2381,7 +2638,7 @@ function Polygon($$anchor, $$props) {
2381
2638
  $.set_attribute(svg, "width", $.get(width));
2382
2639
  $.set_attribute(svg, "height", $.get(height));
2383
2640
  $.set_attribute(svg, "viewBox", `0 0 ${$$props.rect.size.width} ${$$props.rect.size.height}`);
2384
- $.set_attribute(path, "d", $.get(pathData));
2641
+ $.set_attribute(path, "d", $.get(isCloudy) && $.get(cloudyPath) ? $.get(cloudyPath).path : $.get(pathData));
2385
2642
  $.set_attribute(path, "stroke-width", $.get(hitStrokeWidth));
2386
2643
  styles_1 = $.set_style(path, "", styles_1, {
2387
2644
  cursor: $$props.isSelected ? "move" : "pointer",
@@ -2393,7 +2650,7 @@ function Polygon($$anchor, $$props) {
2393
2650
  $.append($$anchor, svg);
2394
2651
  $.pop();
2395
2652
  }
2396
- $.delegate(["pointerdown", "touchstart"]);
2653
+ $.delegate(["pointerdown"]);
2397
2654
  function PolygonRenderer($$anchor, $$props) {
2398
2655
  Polygon($$anchor, $.spread_props(() => $$props.currentObject, {
2399
2656
  get isSelected() {
@@ -2410,7 +2667,7 @@ function PolygonRenderer($$anchor, $$props) {
2410
2667
  }
2411
2668
  }));
2412
2669
  }
2413
- var root$5 = $.from_html(`<div role="button"><span role="textbox" tabindex="0"> </span></div>`);
2670
+ var root$7 = $.from_html(`<div role="button"><span role="textbox" tabindex="0"> </span></div>`);
2414
2671
  function FreeText($$anchor, $$props) {
2415
2672
  $.push($$props, true);
2416
2673
  let appearanceActive = $.prop($$props, "appearanceActive", 3, false);
@@ -2457,16 +2714,12 @@ function FreeText($$anchor, $$props) {
2457
2714
  const outerH = $.derived(() => $$props.annotation.object.rect.size.height * $$props.scale);
2458
2715
  const justify = $.derived(() => $$props.annotation.object.verticalAlign === PdfVerticalAlignment.Top ? "flex-start" : $$props.annotation.object.verticalAlign === PdfVerticalAlignment.Middle ? "center" : "flex-end");
2459
2716
  const fontCss = $.derived(() => standardFontCssProperties($$props.annotation.object.fontFamily));
2460
- var div = root$5();
2717
+ var div = root$7();
2461
2718
  $.set_attribute(div, "tabindex", -1);
2462
2719
  div.__pointerdown = function(...$$args) {
2463
2720
  var _a;
2464
2721
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2465
2722
  };
2466
- div.__touchstart = function(...$$args) {
2467
- var _a;
2468
- (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2469
- };
2470
2723
  let styles;
2471
2724
  var span = $.child(div);
2472
2725
  let styles_1;
@@ -2517,7 +2770,7 @@ function FreeText($$anchor, $$props) {
2517
2770
  $.append($$anchor, div);
2518
2771
  $.pop();
2519
2772
  }
2520
- $.delegate(["pointerdown", "touchstart"]);
2773
+ $.delegate(["pointerdown"]);
2521
2774
  function FreeTextRenderer($$anchor, $$props) {
2522
2775
  {
2523
2776
  let $0 = $.derived(() => ({ ...$$props.annotation, object: $$props.currentObject }));
@@ -2549,7 +2802,7 @@ function FreeTextRenderer($$anchor, $$props) {
2549
2802
  });
2550
2803
  }
2551
2804
  }
2552
- var root_1$6 = $.from_html(`<img/>`);
2805
+ var root_1$8 = $.from_html(`<img/>`);
2553
2806
  function RenderAnnotation($$anchor, $$props) {
2554
2807
  $.push($$props, true);
2555
2808
  let scaleFactor = $.prop($$props, "scaleFactor", 3, 1), unrotated = $.prop($$props, "unrotated", 3, false), restProps = $.rest_props($$props, [
@@ -2612,7 +2865,7 @@ function RenderAnnotation($$anchor, $$props) {
2612
2865
  var node = $.first_child(fragment);
2613
2866
  {
2614
2867
  var consequent = ($$anchor2) => {
2615
- var img = root_1$6();
2868
+ var img = root_1$8();
2616
2869
  $.attribute_effect(img, () => ({
2617
2870
  alt: "",
2618
2871
  src: $.get(imageUrl),
@@ -2631,7 +2884,7 @@ function RenderAnnotation($$anchor, $$props) {
2631
2884
  $.append($$anchor, fragment);
2632
2885
  $.pop();
2633
2886
  }
2634
- var root$4 = $.from_html(`<div role="button"><!></div>`);
2887
+ var root$6 = $.from_html(`<div role="button"><!></div>`);
2635
2888
  function Stamp($$anchor, $$props) {
2636
2889
  $.push($$props, true);
2637
2890
  let annotationProp = $.derived(() => ({
@@ -2639,17 +2892,13 @@ function Stamp($$anchor, $$props) {
2639
2892
  id: $$props.annotation.object.id
2640
2893
  }));
2641
2894
  const unrotated = $.derived(() => !!$$props.annotation.object.rotation && !!$$props.annotation.object.unrotatedRect);
2642
- var div = root$4();
2895
+ var div = root$6();
2643
2896
  $.set_attribute(div, "tabindex", -1);
2644
2897
  let styles;
2645
2898
  div.__pointerdown = function(...$$args) {
2646
2899
  var _a;
2647
2900
  (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2648
2901
  };
2649
- div.__touchstart = function(...$$args) {
2650
- var _a;
2651
- (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2652
- };
2653
2902
  var node = $.child(div);
2654
2903
  RenderAnnotation(node, {
2655
2904
  get documentId() {
@@ -2676,7 +2925,7 @@ function Stamp($$anchor, $$props) {
2676
2925
  $.append($$anchor, div);
2677
2926
  $.pop();
2678
2927
  }
2679
- $.delegate(["pointerdown", "touchstart"]);
2928
+ $.delegate(["pointerdown"]);
2680
2929
  function StampRenderer($$anchor, $$props) {
2681
2930
  Stamp($$anchor, {
2682
2931
  get documentId() {
@@ -2699,9 +2948,9 @@ function StampRenderer($$anchor, $$props) {
2699
2948
  }
2700
2949
  });
2701
2950
  }
2702
- var root_1$5 = $.from_svg(`<line></line>`);
2951
+ var root_1$7 = $.from_svg(`<line></line>`);
2703
2952
  var root_2$4 = $.from_svg(`<rect fill="transparent"></rect>`);
2704
- var root$3 = $.from_svg(`<svg><rect fill="transparent"></rect><!></svg>`);
2953
+ var root$5 = $.from_svg(`<svg><rect fill="transparent"></rect><!></svg>`);
2705
2954
  function Link($$anchor, $$props) {
2706
2955
  $.push($$props, true);
2707
2956
  let strokeColor = $.prop($$props, "strokeColor", 3, "#0000FF"), strokeWidth = $.prop($$props, "strokeWidth", 3, 2), strokeStyle = $.prop($$props, "strokeStyle", 19, () => PdfAnnotationBorderStyle.UNDERLINE), hasIRT = $.prop($$props, "hasIRT", 3, false);
@@ -2719,7 +2968,7 @@ function Link($$anchor, $$props) {
2719
2968
  const isUnderline = $.derived(() => strokeStyle() === PdfAnnotationBorderStyle.UNDERLINE);
2720
2969
  const hitAreaCursor = $.derived(() => hasIRT() ? "default" : $$props.isSelected ? "move" : "pointer");
2721
2970
  const hitAreaPointerEvents = $.derived(() => hasIRT() ? "none" : $$props.isSelected ? "none" : "visible");
2722
- var svg = root$3();
2971
+ var svg = root$5();
2723
2972
  let styles;
2724
2973
  var rect_1 = $.child(svg);
2725
2974
  $.set_attribute(rect_1, "x", 0);
@@ -2728,15 +2977,11 @@ function Link($$anchor, $$props) {
2728
2977
  var _a;
2729
2978
  (_a = hasIRT() ? void 0 : $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2730
2979
  };
2731
- rect_1.__touchstart = function(...$$args) {
2732
- var _a;
2733
- (_a = hasIRT() ? void 0 : $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
2734
- };
2735
2980
  let styles_1;
2736
2981
  var node = $.sibling(rect_1);
2737
2982
  {
2738
2983
  var consequent = ($$anchor2) => {
2739
- var line = root_1$5();
2984
+ var line = root_1$7();
2740
2985
  $.set_attribute(line, "x1", 1);
2741
2986
  $.set_style(line, "", {}, { "pointer-events": "none" });
2742
2987
  $.template_effect(() => {
@@ -2793,7 +3038,7 @@ function Link($$anchor, $$props) {
2793
3038
  $.append($$anchor, svg);
2794
3039
  $.pop();
2795
3040
  }
2796
- $.delegate(["pointerdown", "touchstart"]);
3041
+ $.delegate(["pointerdown"]);
2797
3042
  function LinkRenderer($$anchor, $$props) {
2798
3043
  $.push($$props, true);
2799
3044
  {
@@ -2815,7 +3060,7 @@ function LinkRenderer($$anchor, $$props) {
2815
3060
  }
2816
3061
  $.pop();
2817
3062
  }
2818
- var root_1$4 = $.from_html(`<div></div>`);
3063
+ var root_1$6 = $.from_html(`<div></div>`);
2819
3064
  function Highlight($$anchor, $$props) {
2820
3065
  $.push($$props, true);
2821
3066
  let opacity = $.prop($$props, "opacity", 3, 0.5), appearanceActive = $.prop($$props, "appearanceActive", 3, false);
@@ -2823,14 +3068,13 @@ function Highlight($$anchor, $$props) {
2823
3068
  var fragment = $.comment();
2824
3069
  var node = $.first_child(fragment);
2825
3070
  $.each(node, 17, () => $$props.segmentRects, $.index, ($$anchor2, b) => {
2826
- var div = root_1$4();
3071
+ var div = root_1$6();
2827
3072
  $.attribute_effect(
2828
3073
  div,
2829
3074
  ($0) => ({
2830
3075
  role: "button",
2831
3076
  tabindex: $$props.onClick ? 0 : -1,
2832
3077
  onpointerdown: $$props.onClick,
2833
- ontouchstart: $$props.onClick,
2834
3078
  ...$0,
2835
3079
  [$.STYLE]: {
2836
3080
  position: "absolute",
@@ -2868,7 +3112,7 @@ function HighlightRenderer($$anchor, $$props) {
2868
3112
  }));
2869
3113
  }
2870
3114
  var root_2$3 = $.from_html(`<div></div>`);
2871
- var root_1$3 = $.from_html(`<div><!></div>`);
3115
+ var root_1$5 = $.from_html(`<div><!></div>`);
2872
3116
  function Underline($$anchor, $$props) {
2873
3117
  $.push($$props, true);
2874
3118
  let opacity = $.prop($$props, "opacity", 3, 0.5), appearanceActive = $.prop($$props, "appearanceActive", 3, false);
@@ -2877,14 +3121,13 @@ function Underline($$anchor, $$props) {
2877
3121
  var fragment = $.comment();
2878
3122
  var node = $.first_child(fragment);
2879
3123
  $.each(node, 17, () => $$props.segmentRects, $.index, ($$anchor2, r) => {
2880
- var div = root_1$3();
3124
+ var div = root_1$5();
2881
3125
  $.attribute_effect(
2882
3126
  div,
2883
3127
  ($0) => ({
2884
3128
  role: "button",
2885
3129
  tabindex: $$props.onClick ? 0 : -1,
2886
3130
  onpointerdown: $$props.onClick,
2887
- ontouchstart: $$props.onClick,
2888
3131
  ...$0,
2889
3132
  [$.STYLE]: {
2890
3133
  position: "absolute",
@@ -2943,7 +3186,7 @@ function UnderlineRenderer($$anchor, $$props) {
2943
3186
  }));
2944
3187
  }
2945
3188
  var root_2$2 = $.from_html(`<div></div>`);
2946
- var root_1$2 = $.from_html(`<div><!></div>`);
3189
+ var root_1$4 = $.from_html(`<div><!></div>`);
2947
3190
  function Strikeout($$anchor, $$props) {
2948
3191
  $.push($$props, true);
2949
3192
  let opacity = $.prop($$props, "opacity", 3, 0.5), appearanceActive = $.prop($$props, "appearanceActive", 3, false);
@@ -2952,14 +3195,13 @@ function Strikeout($$anchor, $$props) {
2952
3195
  var fragment = $.comment();
2953
3196
  var node = $.first_child(fragment);
2954
3197
  $.each(node, 17, () => $$props.segmentRects, $.index, ($$anchor2, r) => {
2955
- var div = root_1$2();
3198
+ var div = root_1$4();
2956
3199
  $.attribute_effect(
2957
3200
  div,
2958
3201
  ($0) => ({
2959
3202
  role: "button",
2960
3203
  tabindex: $$props.onClick ? 0 : -1,
2961
3204
  onpointerdown: $$props.onClick,
2962
- ontouchstart: $$props.onClick,
2963
3205
  ...$0,
2964
3206
  [$.STYLE]: {
2965
3207
  position: "absolute",
@@ -3019,7 +3261,7 @@ function StrikeoutRenderer($$anchor, $$props) {
3019
3261
  }));
3020
3262
  }
3021
3263
  var root_2$1 = $.from_html(`<div></div>`);
3022
- var root_1$1 = $.from_html(`<div><!></div>`);
3264
+ var root_1$3 = $.from_html(`<div><!></div>`);
3023
3265
  function Squiggly($$anchor, $$props) {
3024
3266
  $.push($$props, true);
3025
3267
  let opacity = $.prop($$props, "opacity", 3, 0.5), appearanceActive = $.prop($$props, "appearanceActive", 3, false);
@@ -3034,14 +3276,13 @@ function Squiggly($$anchor, $$props) {
3034
3276
  var fragment = $.comment();
3035
3277
  var node = $.first_child(fragment);
3036
3278
  $.each(node, 17, () => $$props.segmentRects, $.index, ($$anchor2, r) => {
3037
- var div = root_1$1();
3279
+ var div = root_1$3();
3038
3280
  $.attribute_effect(
3039
3281
  div,
3040
3282
  ($0) => ({
3041
3283
  role: "button",
3042
3284
  tabindex: $$props.onClick ? 0 : -1,
3043
3285
  onpointerdown: $$props.onClick,
3044
- ontouchstart: $$props.onClick,
3045
3286
  ...$0,
3046
3287
  [$.STYLE]: {
3047
3288
  position: "absolute",
@@ -3101,6 +3342,160 @@ function SquigglyRenderer($$anchor, $$props) {
3101
3342
  }
3102
3343
  }));
3103
3344
  }
3345
+ var root_1$2 = $.from_svg(`<path fill-rule="evenodd"></path>`);
3346
+ var root$4 = $.from_svg(`<svg overflow="visible"><path fill="transparent" stroke="transparent"></path><!></svg>`);
3347
+ function Caret($$anchor, $$props) {
3348
+ $.push($$props, true);
3349
+ let strokeColor = $.prop($$props, "strokeColor", 3, "#000000"), opacity = $.prop($$props, "opacity", 3, 1), appearanceActive = $.prop($$props, "appearanceActive", 3, false);
3350
+ const $$d = $.derived(() => {
3351
+ const w = $$props.rect.size.width;
3352
+ const h = $$props.rect.size.height;
3353
+ const midX = w / 2;
3354
+ const d = [
3355
+ `M 0 ${h}`,
3356
+ `C ${w * 0.27} ${h} ${midX} ${h - h * 0.44} ${midX} 0`,
3357
+ `C ${midX} ${h - h * 0.44} ${w - w * 0.27} ${h} ${w} ${h}`,
3358
+ "Z"
3359
+ ].join(" ");
3360
+ return { width: w, height: h, path: d };
3361
+ }), width = $.derived(() => $.get($$d).width), height = $.derived(() => $.get($$d).height), path = $.derived(() => $.get($$d).path);
3362
+ let svgWidth = $.derived(() => $.get(width) * $$props.scale);
3363
+ let svgHeight = $.derived(() => $.get(height) * $$props.scale);
3364
+ var svg = root$4();
3365
+ let styles;
3366
+ var path_1 = $.child(svg);
3367
+ $.set_attribute(path_1, "stroke-width", 4);
3368
+ path_1.__pointerdown = (e) => {
3369
+ var _a;
3370
+ return (_a = $$props.onClick) == null ? void 0 : _a.call($$props, e);
3371
+ };
3372
+ let styles_1;
3373
+ var node = $.sibling(path_1);
3374
+ {
3375
+ var consequent = ($$anchor2) => {
3376
+ var path_2 = root_1$2();
3377
+ $.set_attribute(path_2, "stroke-width", 0.5);
3378
+ $.set_style(path_2, "", {}, { "pointer-events": "none" });
3379
+ $.template_effect(() => {
3380
+ $.set_attribute(path_2, "d", $.get(path));
3381
+ $.set_attribute(path_2, "fill", strokeColor());
3382
+ $.set_attribute(path_2, "stroke", strokeColor());
3383
+ $.set_attribute(path_2, "opacity", opacity());
3384
+ });
3385
+ $.append($$anchor2, path_2);
3386
+ };
3387
+ $.if(node, ($$render) => {
3388
+ if (!appearanceActive()) $$render(consequent);
3389
+ });
3390
+ }
3391
+ $.reset(svg);
3392
+ $.template_effect(() => {
3393
+ $.set_attribute(svg, "width", $.get(svgWidth));
3394
+ $.set_attribute(svg, "height", $.get(svgHeight));
3395
+ $.set_attribute(svg, "viewBox", `0 0 ${$.get(width)} ${$.get(height)}`);
3396
+ styles = $.set_style(svg, "", styles, {
3397
+ position: "absolute",
3398
+ width: `${$.get(svgWidth)}px`,
3399
+ height: `${$.get(svgHeight)}px`,
3400
+ "pointer-events": "none",
3401
+ "z-index": "2"
3402
+ });
3403
+ $.set_attribute(path_1, "d", $.get(path));
3404
+ $.set_attribute(path_1, "pointer-events", $$props.isSelected ? "none" : "visible");
3405
+ styles_1 = $.set_style(path_1, "", styles_1, { cursor: $$props.isSelected ? "move" : "pointer" });
3406
+ });
3407
+ $.append($$anchor, svg);
3408
+ $.pop();
3409
+ }
3410
+ $.delegate(["pointerdown"]);
3411
+ function CaretRenderer($$anchor, $$props) {
3412
+ Caret($$anchor, $.spread_props(() => $$props.currentObject, {
3413
+ get isSelected() {
3414
+ return $$props.isSelected;
3415
+ },
3416
+ get scale() {
3417
+ return $$props.scale;
3418
+ },
3419
+ get onClick() {
3420
+ return $$props.onClick;
3421
+ },
3422
+ get appearanceActive() {
3423
+ return $$props.appearanceActive;
3424
+ }
3425
+ }));
3426
+ }
3427
+ var root_1$1 = $.from_svg(`<svg viewBox="0 0 20 20" width="100%" height="100%"><path d="M 0.5 15.5 L 0.5 0.5 L 19.5 0.5 L 19.5 15.5 L 8.5 15.5 L 6.5 19.5 L 4.5 15.5 Z" stroke-width="1" stroke-linejoin="miter"></path><line x1="2.5" y1="4.25" x2="17.5" y2="4.25" stroke-width="1"></line><line x1="2.5" y1="8" x2="17.5" y2="8" stroke-width="1"></line><line x1="2.5" y1="11.75" x2="17.5" y2="11.75" stroke-width="1"></line></svg>`);
3428
+ var root$3 = $.from_html(`<div><!></div>`);
3429
+ function Text($$anchor, $$props) {
3430
+ $.push($$props, true);
3431
+ let color = $.prop($$props, "color", 3, "#facc15"), opacity = $.prop($$props, "opacity", 3, 1), appearanceActive = $.prop($$props, "appearanceActive", 3, false);
3432
+ const lineColor = $.derived(() => getContrastStrokeColor(color()));
3433
+ var div = root$3();
3434
+ div.__pointerdown = function(...$$args) {
3435
+ var _a;
3436
+ (_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
3437
+ };
3438
+ let styles;
3439
+ var node = $.child(div);
3440
+ {
3441
+ var consequent = ($$anchor2) => {
3442
+ var svg = root_1$1();
3443
+ $.set_style(svg, "", {}, { position: "absolute", inset: "0", "pointer-events": "none" });
3444
+ var path = $.child(svg);
3445
+ var line = $.sibling(path);
3446
+ var line_1 = $.sibling(line);
3447
+ var line_2 = $.sibling(line_1);
3448
+ $.reset(svg);
3449
+ $.template_effect(() => {
3450
+ $.set_attribute(path, "fill", color());
3451
+ $.set_attribute(path, "opacity", opacity());
3452
+ $.set_attribute(path, "stroke", $.get(lineColor));
3453
+ $.set_attribute(line, "stroke", $.get(lineColor));
3454
+ $.set_attribute(line_1, "stroke", $.get(lineColor));
3455
+ $.set_attribute(line_2, "stroke", $.get(lineColor));
3456
+ });
3457
+ $.append($$anchor2, svg);
3458
+ };
3459
+ $.if(node, ($$render) => {
3460
+ if (!appearanceActive()) $$render(consequent);
3461
+ });
3462
+ }
3463
+ $.reset(div);
3464
+ $.template_effect(() => styles = $.set_style(div, "", styles, {
3465
+ position: "absolute",
3466
+ inset: "0",
3467
+ "z-index": "2",
3468
+ "pointer-events": $$props.isSelected ? "none" : "auto",
3469
+ cursor: $$props.isSelected ? "move" : "pointer"
3470
+ }));
3471
+ $.append($$anchor, div);
3472
+ $.pop();
3473
+ }
3474
+ $.delegate(["pointerdown"]);
3475
+ function TextRenderer($$anchor, $$props) {
3476
+ $.push($$props, true);
3477
+ {
3478
+ let $0 = $.derived(() => $$props.currentObject.strokeColor ?? $$props.currentObject.color);
3479
+ Text($$anchor, {
3480
+ get isSelected() {
3481
+ return $$props.isSelected;
3482
+ },
3483
+ get color() {
3484
+ return $.get($0);
3485
+ },
3486
+ get opacity() {
3487
+ return $$props.currentObject.opacity;
3488
+ },
3489
+ get onClick() {
3490
+ return $$props.onClick;
3491
+ },
3492
+ get appearanceActive() {
3493
+ return $$props.appearanceActive;
3494
+ }
3495
+ });
3496
+ }
3497
+ $.pop();
3498
+ }
3104
3499
  const builtInRenderers = [
3105
3500
  createRenderer({
3106
3501
  id: "ink",
@@ -3159,7 +3554,7 @@ const builtInRenderers = [
3159
3554
  component: HighlightRenderer,
3160
3555
  zIndex: 0,
3161
3556
  interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },
3162
- containerStyle: (a) => `mix-blend-mode: ${blendModeToCss(a.blendMode ?? PdfBlendMode.Multiply)}`
3557
+ defaultBlendMode: PdfBlendMode.Multiply
3163
3558
  }),
3164
3559
  createRenderer({
3165
3560
  id: "underline",
@@ -3182,6 +3577,18 @@ const builtInRenderers = [
3182
3577
  zIndex: 0,
3183
3578
  interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false }
3184
3579
  }),
3580
+ createRenderer({
3581
+ id: "text",
3582
+ matches: (a) => a.type === PdfAnnotationSubtype.TEXT && !a.inReplyToId,
3583
+ component: TextRenderer,
3584
+ interactionDefaults: { isDraggable: true, isResizable: false, isRotatable: false }
3585
+ }),
3586
+ createRenderer({
3587
+ id: "caret",
3588
+ matches: (a) => a.type === PdfAnnotationSubtype.CARET,
3589
+ component: CaretRenderer,
3590
+ interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false }
3591
+ }),
3185
3592
  createRenderer({
3186
3593
  id: "freeText",
3187
3594
  matches: (a) => a.type === PdfAnnotationSubtype.FREETEXT,
@@ -3452,11 +3859,12 @@ function Annotations($$anchor, $$props) {
3452
3859
  e.stopPropagation();
3453
3860
  $.get(renderer).onDoubleClick($.get(annotation).object.id, setEditingId);
3454
3861
  } : void 0);
3455
- let $6 = $.derived(() => {
3862
+ let $6 = $.derived(() => blendModeToCss($.get(annotation).object.blendMode ?? $.get(renderer).defaultBlendMode ?? PdfBlendMode.Normal));
3863
+ let $7 = $.derived(() => {
3456
3864
  var _a, _b;
3457
- return ((_b = (_a = $.get(renderer)).containerStyle) == null ? void 0 : _b.call(_a, $.get(annotation).object)) ?? `mix-blend-mode: ${blendModeToCss($.get(annotation).object.blendMode ?? PdfBlendMode.Normal)}`;
3865
+ return (_b = (_a = $.get(renderer)).containerStyle) == null ? void 0 : _b.call(_a, $.get(annotation).object);
3458
3866
  });
3459
- let $7 = $.derived(() => $.get(useAP) ? getAppearanceForAnnotation($.get(annotation)) : void 0);
3867
+ let $8 = $.derived(() => $.get(useAP) ? getAppearanceForAnnotation($.get(annotation)) : void 0);
3460
3868
  AnnotationContainer($$anchor3, $.spread_props(
3461
3869
  {
3462
3870
  get trackedAnnotation() {
@@ -3501,11 +3909,14 @@ function Annotations($$anchor, $$props) {
3501
3909
  get zIndex() {
3502
3910
  return $.get(renderer).zIndex;
3503
3911
  },
3504
- get style() {
3912
+ get blendMode() {
3505
3913
  return $.get($6);
3506
3914
  },
3507
- get appearance() {
3915
+ get style() {
3508
3916
  return $.get($7);
3917
+ },
3918
+ get appearance() {
3919
+ return $.get($8);
3509
3920
  }
3510
3921
  },
3511
3922
  () => annotationsProps,
@@ -4010,15 +4421,18 @@ function PreviewRenderer($$anchor, $$props) {
4010
4421
  () => $$props.preview.data
4011
4422
  ));
4012
4423
  $.reset(div_5);
4013
- $.template_effect(() => styles_5 = $.set_style(div_5, "", styles_5, {
4014
- position: "absolute",
4015
- left: `${$.get(style).left ?? ""}px`,
4016
- top: `${$.get(style).top ?? ""}px`,
4017
- width: `${$.get(style).width ?? ""}px`,
4018
- height: `${$.get(style).height ?? ""}px`,
4019
- "pointer-events": "none",
4020
- "z-index": "10"
4021
- }));
4424
+ $.template_effect(($0) => styles_5 = $.set_style(div_5, "", styles_5, $0), [
4425
+ () => ({
4426
+ position: "absolute",
4427
+ left: `${$.get(style).left ?? ""}px`,
4428
+ top: `${$.get(style).top ?? ""}px`,
4429
+ width: `${$.get(style).width ?? ""}px`,
4430
+ height: `${$.get(style).height ?? ""}px`,
4431
+ "pointer-events": "none",
4432
+ "z-index": "10",
4433
+ "mix-blend-mode": blendModeToCss($$props.preview.data.blendMode ?? PdfBlendMode.Normal)
4434
+ })
4435
+ ]);
4022
4436
  $.append($$anchor7, div_5);
4023
4437
  };
4024
4438
  var alternate = ($$anchor7) => {
@@ -4379,6 +4793,7 @@ export {
4379
4793
  Squiggly,
4380
4794
  Stamp,
4381
4795
  Strikeout,
4796
+ Text,
4382
4797
  TextMarkup,
4383
4798
  Underline,
4384
4799
  createRenderer,