@embedpdf/plugin-annotation 2.2.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1232 -101
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +33 -3
  6. package/dist/lib/annotation-plugin.d.ts +178 -2
  7. package/dist/lib/handlers/types.d.ts +1 -1
  8. package/dist/lib/helpers.d.ts +8 -2
  9. package/dist/lib/selectors.d.ts +97 -8
  10. package/dist/lib/tools/default-tools.d.ts +39 -11
  11. package/dist/lib/tools/types.d.ts +22 -4
  12. package/dist/lib/types.d.ts +278 -1
  13. package/dist/preact/adapter.d.ts +3 -3
  14. package/dist/preact/index.cjs +1 -1
  15. package/dist/preact/index.cjs.map +1 -1
  16. package/dist/preact/index.js +1133 -403
  17. package/dist/preact/index.js.map +1 -1
  18. package/dist/react/adapter.d.ts +1 -1
  19. package/dist/react/index.cjs +1 -1
  20. package/dist/react/index.cjs.map +1 -1
  21. package/dist/react/index.js +1132 -402
  22. package/dist/react/index.js.map +1 -1
  23. package/dist/shared/components/annotation-container.d.ts +13 -2
  24. package/dist/shared/components/annotation-layer.d.ts +6 -2
  25. package/dist/shared/components/annotations/ink.d.ts +3 -3
  26. package/dist/shared/components/annotations/link.d.ts +28 -0
  27. package/dist/shared/components/annotations.d.ts +4 -1
  28. package/dist/shared/components/group-selection-box.d.ts +32 -0
  29. package/dist/shared/components/index.d.ts +1 -0
  30. package/dist/shared/components/text-markup/highlight.d.ts +3 -2
  31. package/dist/shared/components/text-markup/squiggly.d.ts +3 -2
  32. package/dist/shared/components/text-markup/strikeout.d.ts +3 -2
  33. package/dist/shared/components/text-markup/underline.d.ts +3 -2
  34. package/dist/shared/components/types.d.ts +50 -1
  35. package/dist/shared/context/index.d.ts +1 -0
  36. package/dist/shared/context/renderer-registry.d.ts +21 -0
  37. package/dist/shared/index.d.ts +2 -0
  38. package/dist/shared-preact/components/annotation-container.d.ts +13 -2
  39. package/dist/shared-preact/components/annotation-layer.d.ts +6 -2
  40. package/dist/shared-preact/components/annotations/ink.d.ts +3 -3
  41. package/dist/shared-preact/components/annotations/link.d.ts +28 -0
  42. package/dist/shared-preact/components/annotations.d.ts +4 -1
  43. package/dist/shared-preact/components/group-selection-box.d.ts +32 -0
  44. package/dist/shared-preact/components/index.d.ts +1 -0
  45. package/dist/shared-preact/components/text-markup/highlight.d.ts +3 -2
  46. package/dist/shared-preact/components/text-markup/squiggly.d.ts +3 -2
  47. package/dist/shared-preact/components/text-markup/strikeout.d.ts +3 -2
  48. package/dist/shared-preact/components/text-markup/underline.d.ts +3 -2
  49. package/dist/shared-preact/components/types.d.ts +50 -1
  50. package/dist/shared-preact/context/index.d.ts +1 -0
  51. package/dist/shared-preact/context/renderer-registry.d.ts +21 -0
  52. package/dist/shared-preact/index.d.ts +2 -0
  53. package/dist/shared-react/components/annotation-container.d.ts +13 -2
  54. package/dist/shared-react/components/annotation-layer.d.ts +6 -2
  55. package/dist/shared-react/components/annotations/ink.d.ts +3 -3
  56. package/dist/shared-react/components/annotations/link.d.ts +28 -0
  57. package/dist/shared-react/components/annotations.d.ts +4 -1
  58. package/dist/shared-react/components/group-selection-box.d.ts +32 -0
  59. package/dist/shared-react/components/index.d.ts +1 -0
  60. package/dist/shared-react/components/text-markup/highlight.d.ts +3 -2
  61. package/dist/shared-react/components/text-markup/squiggly.d.ts +3 -2
  62. package/dist/shared-react/components/text-markup/strikeout.d.ts +3 -2
  63. package/dist/shared-react/components/text-markup/underline.d.ts +3 -2
  64. package/dist/shared-react/components/types.d.ts +50 -1
  65. package/dist/shared-react/context/index.d.ts +1 -0
  66. package/dist/shared-react/context/renderer-registry.d.ts +21 -0
  67. package/dist/shared-react/index.d.ts +2 -0
  68. package/dist/svelte/components/AnnotationLayer.svelte.d.ts +8 -1
  69. package/dist/svelte/components/Annotations.svelte.d.ts +8 -1
  70. package/dist/svelte/components/GroupSelectionBox.svelte.d.ts +32 -0
  71. package/dist/svelte/components/RendererRegistryProvider.svelte.d.ts +7 -0
  72. package/dist/svelte/components/annotations/Ink.svelte.d.ts +2 -1
  73. package/dist/svelte/components/annotations/Link.svelte.d.ts +24 -0
  74. package/dist/svelte/components/annotations/index.d.ts +1 -0
  75. package/dist/svelte/components/index.d.ts +2 -0
  76. package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +2 -1
  77. package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +2 -1
  78. package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +2 -1
  79. package/dist/svelte/components/text-markup/Underline.svelte.d.ts +2 -1
  80. package/dist/svelte/components/types.d.ts +2 -0
  81. package/dist/svelte/context/index.d.ts +2 -0
  82. package/dist/svelte/context/renderer-registry.svelte.d.ts +20 -0
  83. package/dist/svelte/context/types.d.ts +33 -0
  84. package/dist/svelte/index.cjs +1 -1
  85. package/dist/svelte/index.cjs.map +1 -1
  86. package/dist/svelte/index.d.ts +2 -0
  87. package/dist/svelte/index.js +1215 -394
  88. package/dist/svelte/index.js.map +1 -1
  89. package/dist/svelte/types.d.ts +7 -0
  90. package/dist/vue/components/annotation-container.vue.d.ts +3 -1
  91. package/dist/vue/components/annotation-layer.vue.d.ts +31 -5
  92. package/dist/vue/components/annotations/free-text.vue.d.ts +1 -1
  93. package/dist/vue/components/annotations/index.d.ts +1 -0
  94. package/dist/vue/components/annotations/ink.vue.d.ts +2 -2
  95. package/dist/vue/components/annotations/line.vue.d.ts +1 -1
  96. package/dist/vue/components/annotations/link.vue.d.ts +29 -0
  97. package/dist/vue/components/annotations/polygon.vue.d.ts +1 -1
  98. package/dist/vue/components/annotations/polyline.vue.d.ts +1 -1
  99. package/dist/vue/components/annotations/stamp.vue.d.ts +1 -1
  100. package/dist/vue/components/annotations.vue.d.ts +151 -53
  101. package/dist/vue/components/group-selection-box.vue.d.ts +73 -0
  102. package/dist/vue/components/index.d.ts +2 -0
  103. package/dist/vue/components/preview-renderer.vue.d.ts +1 -1
  104. package/dist/vue/components/renderer-registry-provider.vue.d.ts +13 -0
  105. package/dist/vue/components/text-markup/highlight.vue.d.ts +2 -2
  106. package/dist/vue/components/text-markup/squiggly.vue.d.ts +2 -2
  107. package/dist/vue/components/text-markup/strikeout.vue.d.ts +2 -2
  108. package/dist/vue/components/text-markup/underline.vue.d.ts +2 -2
  109. package/dist/vue/context/index.d.ts +2 -0
  110. package/dist/vue/context/renderer-registry.d.ts +26 -0
  111. package/dist/vue/context/types.d.ts +33 -0
  112. package/dist/vue/hooks/use-annotation.d.ts +7 -5
  113. package/dist/vue/index.cjs +1 -1
  114. package/dist/vue/index.cjs.map +1 -1
  115. package/dist/vue/index.d.ts +3 -1
  116. package/dist/vue/index.js +1124 -459
  117. package/dist/vue/index.js.map +1 -1
  118. package/dist/vue/types.d.ts +8 -1
  119. package/package.json +10 -10
@@ -0,0 +1,73 @@
1
+ import { SelectionMenuPlacement } from '@embedpdf/utils/vue';
2
+ import { TrackedAnnotation } from '../../lib';
3
+ import { GroupSelectionContext, GroupSelectionMenuRenderFn, ResizeHandleUI } from '../types';
4
+ type __VLS_Props = {
5
+ documentId: string;
6
+ pageIndex: number;
7
+ scale: number;
8
+ rotation: number;
9
+ pageWidth: number;
10
+ pageHeight: number;
11
+ /** All selected annotations on this page */
12
+ selectedAnnotations: TrackedAnnotation[];
13
+ /** Whether the group is draggable (all annotations must be group-draggable) */
14
+ isDraggable: boolean;
15
+ /** Whether the group is resizable (all annotations must be group-resizable) */
16
+ isResizable: boolean;
17
+ /** Resize handle UI customization */
18
+ resizeUI?: ResizeHandleUI;
19
+ /** Selection outline color */
20
+ selectionOutlineColor?: string;
21
+ /** Outline offset */
22
+ outlineOffset?: number;
23
+ /** Z-index for the group box */
24
+ zIndex?: number;
25
+ /** Group selection menu render function */
26
+ groupSelectionMenu?: GroupSelectionMenuRenderFn;
27
+ };
28
+ declare var __VLS_1: {
29
+ backgroundColor: string;
30
+ onPointerdown: (e: PointerEvent) => void;
31
+ onPointermove: (e: PointerEvent) => void;
32
+ onPointerup: (e: PointerEvent) => void;
33
+ onPointercancel: (e: PointerEvent) => void;
34
+ key: string | number;
35
+ style: import('vue').CSSProperties;
36
+ }, __VLS_15: {
37
+ context: GroupSelectionContext;
38
+ selected: boolean;
39
+ rect: {
40
+ origin: {
41
+ x: number;
42
+ y: number;
43
+ };
44
+ size: {
45
+ width: number;
46
+ height: number;
47
+ };
48
+ };
49
+ placement: SelectionMenuPlacement;
50
+ menuWrapperProps: {
51
+ style: import('vue').CSSProperties;
52
+ onPointerdown: (e: PointerEvent) => void;
53
+ onTouchstart: (e: TouchEvent) => void;
54
+ };
55
+ };
56
+ type __VLS_Slots = {} & {
57
+ 'resize-handle'?: (props: typeof __VLS_1) => any;
58
+ } & {
59
+ 'group-selection-menu'?: (props: typeof __VLS_15) => any;
60
+ };
61
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
62
+ outlineOffset: number;
63
+ zIndex: number;
64
+ selectionOutlineColor: string;
65
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
66
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
67
+ declare const _default: typeof __VLS_export;
68
+ export default _default;
69
+ type __VLS_WithSlots<T, S> = T & {
70
+ new (): {
71
+ $slots: S;
72
+ };
73
+ };
@@ -2,8 +2,10 @@ export { default as AnnotationContainer } from './annotation-container.vue';
2
2
  export { default as AnnotationLayer } from './annotation-layer.vue';
3
3
  export { default as AnnotationPaintLayer } from './annotation-paint-layer.vue';
4
4
  export { default as Annotations } from './annotations.vue';
5
+ export { default as GroupSelectionBox } from './group-selection-box.vue';
5
6
  export { default as PreviewRenderer } from './preview-renderer.vue';
6
7
  export { default as RenderAnnotation } from './render-annotation.vue';
7
8
  export { default as TextMarkup } from './text-markup.vue';
9
+ export { default as RendererRegistryProvider } from './renderer-registry-provider.vue';
8
10
  export * from './annotations';
9
11
  export * from './text-markup';
@@ -1,4 +1,4 @@
1
- import { AnyPreviewState } from '../../lib/index.ts';
1
+ import { AnyPreviewState } from '../../lib';
2
2
  type __VLS_Props = {
3
3
  preview: AnyPreviewState;
4
4
  scale: number;
@@ -0,0 +1,13 @@
1
+ declare var __VLS_1: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_1) => any;
4
+ };
5
+ declare const __VLS_base: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
6
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
9
+ type __VLS_WithSlots<T, S> = T & {
10
+ new (): {
11
+ $slots: S;
12
+ };
13
+ };
@@ -1,6 +1,7 @@
1
1
  import { Rect } from '@embedpdf/models';
2
2
  type __VLS_Props = {
3
- color?: string;
3
+ /** Stroke/markup color */
4
+ strokeColor?: string;
4
5
  opacity?: number;
5
6
  segmentRects: Rect[];
6
7
  rect?: Rect;
@@ -8,7 +9,6 @@ type __VLS_Props = {
8
9
  onClick?: (e: PointerEvent | TouchEvent) => void;
9
10
  };
10
11
  declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
- color: string;
12
12
  opacity: number;
13
13
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
14
  declare const _default: typeof __VLS_export;
@@ -1,6 +1,7 @@
1
1
  import { Rect } from '@embedpdf/models';
2
2
  type __VLS_Props = {
3
- color?: string;
3
+ /** Stroke/markup color */
4
+ strokeColor?: string;
4
5
  opacity?: number;
5
6
  segmentRects: Rect[];
6
7
  rect?: Rect;
@@ -8,7 +9,6 @@ type __VLS_Props = {
8
9
  onClick?: (e: PointerEvent | TouchEvent) => void;
9
10
  };
10
11
  declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
- color: string;
12
12
  opacity: number;
13
13
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
14
  declare const _default: typeof __VLS_export;
@@ -1,6 +1,7 @@
1
1
  import { Rect } from '@embedpdf/models';
2
2
  type __VLS_Props = {
3
- color?: string;
3
+ /** Stroke/markup color */
4
+ strokeColor?: string;
4
5
  opacity?: number;
5
6
  segmentRects: Rect[];
6
7
  rect?: Rect;
@@ -8,7 +9,6 @@ type __VLS_Props = {
8
9
  onClick?: (e: PointerEvent | TouchEvent) => void;
9
10
  };
10
11
  declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
- color: string;
12
12
  opacity: number;
13
13
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
14
  declare const _default: typeof __VLS_export;
@@ -1,6 +1,7 @@
1
1
  import { Rect } from '@embedpdf/models';
2
2
  type __VLS_Props = {
3
- color?: string;
3
+ /** Stroke/markup color */
4
+ strokeColor?: string;
4
5
  opacity?: number;
5
6
  segmentRects: Rect[];
6
7
  rect?: Rect;
@@ -8,7 +9,6 @@ type __VLS_Props = {
8
9
  onClick?: (e: PointerEvent | TouchEvent) => void;
9
10
  };
10
11
  declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
- color: string;
12
12
  opacity: number;
13
13
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
14
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,2 @@
1
+ export * from './renderer-registry';
2
+ export * from './types';
@@ -0,0 +1,26 @@
1
+ import { BoxedAnnotationRenderer, AnnotationRendererEntry, AnnotationRendererProps } from './types';
2
+ import { PdfAnnotationObject } from '@embedpdf/models';
3
+ /**
4
+ * Annotation Renderer Registry
5
+ *
6
+ * Allows external plugins to register custom annotation renderers
7
+ * that integrate with the annotation layer.
8
+ */
9
+ export interface AnnotationRendererRegistry {
10
+ register(entries: BoxedAnnotationRenderer[]): () => void;
11
+ getAll(): BoxedAnnotationRenderer[];
12
+ }
13
+ export declare function createRendererRegistry(): AnnotationRendererRegistry;
14
+ export declare function provideRendererRegistry(): AnnotationRendererRegistry;
15
+ export declare function useRendererRegistry(): AnnotationRendererRegistry | null;
16
+ /**
17
+ * Composable for plugins to register renderers.
18
+ * Automatically cleans up on unmount.
19
+ */
20
+ export declare function useRegisterRenderers(entries: BoxedAnnotationRenderer[]): void;
21
+ /**
22
+ * Factory to create a boxed renderer from a typed entry.
23
+ * Wraps component in markRaw to prevent reactivity overhead.
24
+ */
25
+ export declare function createRenderer<T extends PdfAnnotationObject>(entry: AnnotationRendererEntry<T>): BoxedAnnotationRenderer;
26
+ export type { AnnotationRendererProps, AnnotationRendererEntry, BoxedAnnotationRenderer };
@@ -0,0 +1,33 @@
1
+ import { Component } from 'vue';
2
+ import { PdfAnnotationObject } from '@embedpdf/models';
3
+ import { TrackedAnnotation } from '../../lib';
4
+ /**
5
+ * Props passed to custom annotation renderer components
6
+ */
7
+ export interface AnnotationRendererProps<T extends PdfAnnotationObject = PdfAnnotationObject> {
8
+ annotation: TrackedAnnotation<T>;
9
+ isSelected: boolean;
10
+ scale: number;
11
+ pageIndex: number;
12
+ onClick: (e: PointerEvent | TouchEvent) => void;
13
+ }
14
+ /**
15
+ * Entry for defining a custom annotation renderer.
16
+ * Type safety enforced at definition time via generic.
17
+ */
18
+ export interface AnnotationRendererEntry<T extends PdfAnnotationObject = PdfAnnotationObject> {
19
+ /** Unique identifier for this renderer */
20
+ id: string;
21
+ /** Returns true if this renderer handles the annotation */
22
+ matches: (annotation: PdfAnnotationObject) => annotation is T;
23
+ /** Vue component to render the annotation */
24
+ component: Component<AnnotationRendererProps<T>>;
25
+ }
26
+ /**
27
+ * Boxed renderer stored in registry (generic erased for storage)
28
+ */
29
+ export interface BoxedAnnotationRenderer {
30
+ id: string;
31
+ matches: (annotation: PdfAnnotationObject) => boolean;
32
+ component: Component<AnnotationRendererProps>;
33
+ }
@@ -1,7 +1,7 @@
1
1
  import { MaybeRefOrGetter } from 'vue';
2
- import { AnnotationPlugin, AnnotationDocumentState } from '../../lib/index.ts';
2
+ import { AnnotationPlugin, AnnotationDocumentState } from '../../lib';
3
3
  export declare const useAnnotationPlugin: () => import('@embedpdf/core/vue').PluginState<AnnotationPlugin>;
4
- export declare const useAnnotationCapability: () => import('@embedpdf/core/vue').CapabilityState<Readonly<import('../../lib/index.ts').AnnotationCapability>>;
4
+ export declare const useAnnotationCapability: () => import('@embedpdf/core/vue').CapabilityState<Readonly<import('../../lib').AnnotationCapability>>;
5
5
  /**
6
6
  * Hook for annotation state for a specific document
7
7
  * @param documentId Document ID (can be ref, computed, getter, or plain value)
@@ -9,16 +9,18 @@ export declare const useAnnotationCapability: () => import('@embedpdf/core/vue')
9
9
  export declare const useAnnotation: (documentId: MaybeRefOrGetter<string>) => {
10
10
  state: import('vue').Ref<{
11
11
  pages: Record<number, string[]>;
12
- byUid: Record<string, import('../../lib/index.ts').TrackedAnnotation>;
12
+ byUid: Record<string, import('../../lib').TrackedAnnotation>;
13
+ selectedUids: string[];
13
14
  selectedUid: string | null;
14
15
  activeToolId: string | null;
15
16
  hasPendingChanges: boolean;
16
17
  }, AnnotationDocumentState | {
17
18
  pages: Record<number, string[]>;
18
- byUid: Record<string, import('../../lib/index.ts').TrackedAnnotation>;
19
+ byUid: Record<string, import('../../lib').TrackedAnnotation>;
20
+ selectedUids: string[];
19
21
  selectedUid: string | null;
20
22
  activeToolId: string | null;
21
23
  hasPendingChanges: boolean;
22
24
  }>;
23
- provides: import('vue').ComputedRef<import('../../lib/index.ts').AnnotationScope | null>;
25
+ provides: import('vue').ComputedRef<import('../../lib').AnnotationScope | null>;
24
26
  };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("@embedpdf/core/vue"),o=require("@embedpdf/plugin-annotation"),n=require("@embedpdf/utils/vue"),l=require("@embedpdf/models"),r=require("@embedpdf/plugin-interaction-manager/vue"),i=require("@embedpdf/plugin-selection/vue"),a=()=>t.usePlugin(o.AnnotationPlugin.id),c=()=>t.useCapability(o.AnnotationPlugin.id),s={"data-no-interaction":"",style:{display:"contents"}},d=e.defineComponent({inheritAttrs:!1,__name:"annotation-container",props:{scale:{},documentId:{},pageIndex:{},rotation:{},pageWidth:{},pageHeight:{},trackedAnnotation:{},isSelected:{type:Boolean},isDraggable:{type:Boolean},isResizable:{type:Boolean},lockAspectRatio:{type:Boolean,default:!1},vertexConfig:{},selectionMenu:{},outlineOffset:{default:1},onDoubleClick:{},onSelect:{},zIndex:{default:1},selectionOutlineColor:{default:"#007ACC"},style:{}},setup(o){const l=o,r="#007ACC",i="#007ACC",a=e.shallowRef(e.toRaw(l.trackedAnnotation.object)),{provides:d}=c(),u=t.useDocumentPermissions(l.documentId),p=e.ref(null),v=e.computed(()=>u.value.canModifyAnnotations&&l.isDraggable),k=e.computed(()=>u.value.canModifyAnnotations&&l.isResizable),g=l.onDoubleClick?e=>{var t;u.value.canModifyAnnotations&&(null==(t=l.onDoubleClick)||t.call(l,e))}:void 0,m=e.computed(()=>d.value?d.value.forDocument(l.documentId):null),f=e.computed(()=>({...e.toRaw(l.trackedAnnotation.object),...e.toRaw(a.value)})),h=e.computed(()=>l.isSelected&&(l.selectionMenu||_["selection-menu"])),y=e.computed(()=>({origin:{x:f.value.rect.origin.x*l.scale,y:f.value.rect.origin.y*l.scale},size:{width:f.value.rect.size.width*l.scale,height:f.value.rect.size.height*l.scale}})),x=e.computed(()=>({type:"annotation",annotation:l.trackedAnnotation,pageIndex:l.pageIndex})),C=e.computed(()=>({suggestTop:!1,spaceAbove:0,spaceBelow:0})),b=(e,t)=>l.selectionMenu?l.selectionMenu({rect:e,menuWrapperProps:t,selected:l.isSelected,placement:C.value,context:x.value}):null,S=e.computed(()=>e.toRaw(f.value).rect),w=e.computed(()=>{var t;const o=e.toRaw(f.value);return(null==(t=l.vertexConfig)?void 0:t.extractVertices(o))??[]}),B=e.computed(()=>({minWidth:10,minHeight:10,boundingBox:{width:l.pageWidth,height:l.pageHeight}})),{dragProps:P,vertices:z,resize:I}=n.useInteractionHandles({controller:{element:S,vertices:w,constraints:B,maintainAspectRatio:e.computed(()=>l.lockAspectRatio),pageRotation:e.computed(()=>l.rotation),scale:e.computed(()=>l.scale),enabled:e.computed(()=>l.isSelected),onUpdate:t=>{var o,n,r,i;if(!(null==(o=t.transformData)?void 0:o.type))return;"start"===t.state&&(p.value=f.value);const c=p.value??f.value,s=t.transformData.changes.vertices?null==(n=l.vertexConfig)?void 0:n.transformAnnotation(e.toRaw(c),t.transformData.changes.vertices):{rect:t.transformData.changes.rect},u=null==(r=d.value)?void 0:r.transformAnnotation(c,{type:t.transformData.type,changes:s,metadata:t.transformData.metadata});u&&(a.value={...e.toRaw(a.value),...u}),"end"===t.state&&u&&(p.value=null,null==(i=m.value)||i.updateAnnotation(l.pageIndex,l.trackedAnnotation.object.id,u))}},resizeUI:{handleSize:12,spacing:l.outlineOffset,offsetMode:"outside",includeSides:!l.lockAspectRatio,zIndex:l.zIndex+1},vertexUI:{vertexSize:12,zIndex:l.zIndex+2},includeVertices:!!l.vertexConfig}),A=n.useDoublePressProps(g);e.watch(()=>l.trackedAnnotation.object,e=>{a.value=e},{deep:!0});const E=e.computed(()=>({position:"absolute",left:f.value.rect.origin.x*l.scale+"px",top:f.value.rect.origin.y*l.scale+"px",width:f.value.rect.size.width*l.scale+"px",height:f.value.rect.size.height*l.scale+"px",outline:l.isSelected?`1px solid ${l.selectionOutlineColor}`:"none",outlineOffset:l.isSelected?`${l.outlineOffset}px`:"0px",pointerEvents:l.isSelected?"auto":"none",touchAction:"none",cursor:l.isSelected&&v.value?"move":"default",zIndex:l.zIndex})),R=e.computed(()=>({...E.value,...l.style??{}})),_=e.useSlots();return(t,l)=>(e.openBlock(),e.createElementBlock("div",s,[e.createElementVNode("div",e.mergeProps({...v.value&&o.isSelected?e.unref(P):{},...e.unref(A)},{style:R.value}),[e.renderSlot(t.$slots,"default",{annotation:f.value}),o.isSelected&&k.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(I),({key:o,style:n,...l})=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o},[e.unref(_)["resize-handle"]?e.renderSlot(t.$slots,"resize-handle",e.mergeProps({key:0,ref_for:!0},{key:o,style:n,...l,backgroundColor:r}),()=>[e.createElementVNode("div",e.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:r}]}),null,16)]):(e.openBlock(),e.createElementBlock("div",e.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:r}]}),null,16))],64))),128)):e.createCommentVNode("",!0),o.isSelected&&e.unref(u).canModifyAnnotations&&e.unref(z).length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(e.unref(z),({key:o,style:n,...l})=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o},[e.unref(_)["vertex-handle"]?e.renderSlot(t.$slots,"vertex-handle",e.mergeProps({key:0,ref_for:!0},{key:o,style:n,...l,backgroundColor:i}),()=>[e.createElementVNode("div",e.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:i}]}),null,16)]):(e.openBlock(),e.createElementBlock("div",e.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:i}]}),null,16))],64))),128)):e.createCommentVNode("",!0)],16),h.value?(e.openBlock(),e.createBlock(e.unref(n.CounterRotate),{key:0,rect:y.value,rotation:o.rotation},{default:e.withCtx(({rect:n,menuWrapperProps:l})=>[o.selectionMenu?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b(n,l)),{key:0})):e.renderSlot(t.$slots,"selection-menu",{key:1,context:x.value,selected:o.isSelected,rect:n,placement:C.value,menuWrapperProps:l})]),_:3},8,["rect","rotation"])):e.createCommentVNode("",!0)]))}}),u=["width","height","viewBox"],p=["cx","cy","rx","ry","fill","opacity"],v=e.defineComponent({__name:"circle",props:{isSelected:{type:Boolean},color:{default:"#000000"},strokeColor:{},opacity:{default:1},strokeWidth:{},strokeStyle:{default:l.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>{const e=o.rect.size.width,t=o.rect.size.height,n=Math.max(e-o.strokeWidth,0),l=Math.max(t-o.strokeWidth,0);return{width:e,height:t,cx:o.strokeWidth/2+n/2,cy:o.strokeWidth/2+l/2,rx:n/2,ry:l/2}}),r=e.computed(()=>n.value.width*o.scale),i=e.computed(()=>n.value.height*o.scale);return(o,a)=>{var c;return e.openBlock(),e.createElementBlock("svg",{style:e.normalizeStyle({position:"absolute",width:r.value,height:i.value,pointerEvents:"none",zIndex:2}),width:r.value,height:i.value,viewBox:`0 0 ${n.value.width} ${n.value.height}`},[e.createElementVNode("ellipse",{cx:n.value.cx,cy:n.value.cy,rx:n.value.rx,ry:n.value.ry,fill:t.color,opacity:t.opacity,onPointerdown:a[0]||(a[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:a[1]||(a[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"transparent"===t.color?"visibleStroke":"visible",stroke:t.strokeColor??t.color,strokeWidth:t.strokeWidth,...t.strokeStyle===e.unref(l.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(c=t.strokeDashArray)?void 0:c.join(",")}})},null,44,p)],12,u)}}}),k=["contenteditable"],g=e.defineComponent({__name:"free-text",props:{isSelected:{type:Boolean},isEditing:{type:Boolean},annotation:{},pageIndex:{},scale:{},onClick:{type:Function}},setup(t){const o=t,n=e.ref(null),{provides:r}=c(),i=e.ref(!1);e.onMounted(()=>{try{const e=navigator;i.value=/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&(null==e?void 0:e.maxTouchPoints)>1}catch{i.value=!1}}),e.watch(()=>o.isEditing,e=>{if(e&&n.value){const e=n.value;e.focus();const t=window.getSelection();if(t){const o=document.createRange();o.selectNodeContents(e),o.collapse(!1),t.removeAllRanges(),t.addRange(o)}}});const a=()=>{r.value&&n.value&&r.value.updateAnnotation(o.pageIndex,o.annotation.object.id,{contents:n.value.innerText})},s=e.computed(()=>{const{object:e}=o.annotation,t=e.fontSize*o.scale,n=i.value&&o.isEditing&&t>0&&t<16,r=n?16:t,a=n?t/16:1,c=n?100/a:100;return{color:e.fontColor,fontSize:`${r}px`,fontFamily:l.standardFontCss(e.fontFamily),textAlign:l.textAlignmentToCss(e.textAlign),flexDirection:"column",justifyContent:e.verticalAlign===l.PdfVerticalAlignment.Top?"flex-start":e.verticalAlign===l.PdfVerticalAlignment.Middle?"center":"flex-end",display:"flex",backgroundColor:e.backgroundColor,opacity:e.opacity,width:n?`${c}%`:"100%",height:n?`${c}%`:"100%",lineHeight:"1.18",overflow:"hidden",cursor:o.isEditing?"text":"pointer",outline:"none",transform:n?`scale(${a})`:void 0,transformOrigin:"top left"}});return(o,l)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle({position:"absolute",width:t.annotation.object.rect.size.width*t.scale+"px",height:t.annotation.object.rect.size.height*t.scale+"px",cursor:t.isSelected&&!t.isEditing?"move":"default",pointerEvents:t.isSelected&&!t.isEditing?"none":"auto",zIndex:2}),onPointerdown:l[0]||(l[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:l[1]||(l[1]=(...e)=>t.onClick&&t.onClick(...e))},[e.createElementVNode("span",{ref_key:"editorRef",ref:n,onBlur:a,tabindex:"0",style:e.normalizeStyle(s.value),contenteditable:t.isEditing},e.toDisplayString(t.annotation.object.contents),45,k)],36))}}),m=["width","height","viewBox"],f=["d","opacity"],h=e.defineComponent({__name:"ink",props:{isSelected:{type:Boolean},color:{default:"#000000"},opacity:{default:1},strokeWidth:{},inkList:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>o.inkList.map(({points:e})=>{let t="";return e.forEach(({x:e,y:n},l)=>{const r=e-o.rect.origin.x,i=n-o.rect.origin.y;t+=(0===l?"M":"L")+`${r} ${i} `}),t.trim()})),l=e.computed(()=>o.rect.size.width*o.scale),r=e.computed(()=>o.rect.size.height*o.scale);return(o,i)=>(e.openBlock(),e.createElementBlock("svg",{style:e.normalizeStyle({position:"absolute",width:`${l.value}px`,height:`${r.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:l.value,height:r.value,viewBox:`0 0 ${t.rect.size.width} ${t.rect.size.height}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(o,n)=>(e.openBlock(),e.createElementBlock("path",{key:n,d:o,fill:"none",opacity:t.opacity,onPointerdown:i[0]||(i[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:i[1]||(i[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"visibleStroke",stroke:t.color,strokeWidth:t.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round"})},null,44,f))),128))],12,m))}}),y=["width","height","viewBox"],x=["x1","y1","x2","y2","opacity"],C=["d","transform","stroke","fill"],b=["d","transform","stroke","fill"],S=e.defineComponent({__name:"line",props:{color:{default:"transparent"},opacity:{default:1},strokeWidth:{},strokeColor:{default:"#000000"},strokeStyle:{default:l.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},linePoints:{},lineEndings:{},scale:{},onClick:{},isSelected:{type:Boolean}},setup(t){const n=t,r=e.computed(()=>({x1:n.linePoints.start.x-n.rect.origin.x,y1:n.linePoints.start.y-n.rect.origin.y,x2:n.linePoints.end.x-n.rect.origin.x,y2:n.linePoints.end.y-n.rect.origin.y})),i=e.computed(()=>{var e,t;const{x1:l,y1:i,x2:a,y2:c}=r.value,s=Math.atan2(c-i,a-l);return{start:o.patching.createEnding(null==(e=n.lineEndings)?void 0:e.start,n.strokeWidth,s+Math.PI,l,i),end:o.patching.createEnding(null==(t=n.lineEndings)?void 0:t.end,n.strokeWidth,s,a,c)}}),a=e=>{var t;return{cursor:n.isSelected?"move":"pointer",strokeWidth:n.strokeWidth,strokeLinecap:"butt",pointerEvents:n.isSelected?"none":e.filled?"visible":"visibleStroke",...n.strokeStyle===l.PdfAnnotationBorderStyle.DASHED&&{strokeDasharray:null==(t=n.strokeDashArray)?void 0:t.join(",")}}},c=e.computed(()=>n.rect.size.width*n.scale),s=e.computed(()=>n.rect.size.height*n.scale);return(o,n)=>{var d;return e.openBlock(),e.createElementBlock("svg",{style:e.normalizeStyle({position:"absolute",width:`${c.value}px`,height:`${s.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:c.value,height:s.value,viewBox:`0 0 ${t.rect.size.width} ${t.rect.size.height}`},[e.createElementVNode("line",{x1:r.value.x1,y1:r.value.y1,x2:r.value.x2,y2:r.value.y2,opacity:t.opacity,onPointerdown:n[0]||(n[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[1]||(n[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"visibleStroke",stroke:t.strokeColor,strokeWidth:t.strokeWidth,strokeLinecap:"butt",...t.strokeStyle===e.unref(l.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(d=t.strokeDashArray)?void 0:d.join(",")}})},null,44,x),i.value.start?(e.openBlock(),e.createElementBlock("path",{key:0,d:i.value.start.d,transform:i.value.start.transform,onPointerdown:n[2]||(n[2]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[3]||(n[3]=(...e)=>t.onClick&&t.onClick(...e)),stroke:t.strokeColor,style:e.normalizeStyle(a(i.value.start)),fill:i.value.start.filled?t.color:"none"},null,44,C)):e.createCommentVNode("",!0),i.value.end?(e.openBlock(),e.createElementBlock("path",{key:1,d:i.value.end.d,transform:i.value.end.transform,onPointerdown:n[4]||(n[4]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[5]||(n[5]=(...e)=>t.onClick&&t.onClick(...e)),stroke:t.strokeColor,style:e.normalizeStyle(a(i.value.end)),fill:i.value.end.filled?t.color:"none"},null,44,b)):e.createCommentVNode("",!0)],12,y)}}}),w=["width","height","viewBox"],B=["d","opacity"],P=["d"],z=["x","y","width","height","fill","stroke","stroke-width"],I=e.defineComponent({__name:"polygon",props:{rect:{},vertices:{},color:{default:"transparent"},strokeColor:{default:"#000000"},opacity:{default:1},strokeWidth:{},strokeStyle:{default:l.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},scale:{},isSelected:{type:Boolean},onClick:{},currentVertex:{},handleSize:{default:14}},setup(t){const o=t,n=e.computed(()=>o.currentVertex?[...o.vertices,o.currentVertex]:o.vertices),r=e.computed(()=>n.value.map(({x:e,y:t})=>({x:e-o.rect.origin.x,y:t-o.rect.origin.y}))),i=e.computed(()=>{if(!r.value.length)return"";const[e,...t]=r.value,n=!!o.currentVertex;return(`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y}`).join(" ")+(n?"":" Z")).trim()}),a=e.computed(()=>o.currentVertex&&o.vertices.length>0),c=e.computed(()=>o.rect.size.width*o.scale),s=e.computed(()=>o.rect.size.height*o.scale);return(o,n)=>{var d;return e.openBlock(),e.createElementBlock("svg",{style:e.normalizeStyle({position:"absolute",width:`${c.value}px`,height:`${s.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:c.value,height:s.value,viewBox:`0 0 ${t.rect.size.width} ${t.rect.size.height}`},[e.createElementVNode("path",{d:i.value,onPointerdown:n[0]||(n[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[1]||(n[1]=(...e)=>t.onClick&&t.onClick(...e)),opacity:t.opacity,style:e.normalizeStyle({fill:t.currentVertex?"none":t.color,stroke:t.strokeColor??t.color,strokeWidth:t.strokeWidth,cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"transparent"===t.color?"visibleStroke":"visible",strokeLinecap:"butt",strokeLinejoin:"miter",...t.strokeStyle===e.unref(l.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(d=t.strokeDashArray)?void 0:d.join(",")}})},null,44,B),a.value&&r.value.length>1?(e.openBlock(),e.createElementBlock("path",{key:0,d:`M ${r.value[r.value.length-1].x} ${r.value[r.value.length-1].y} L ${r.value[0].x} ${r.value[0].y}`,fill:"none",style:e.normalizeStyle({stroke:t.strokeColor,strokeWidth:t.strokeWidth,strokeDasharray:"4,4",opacity:.7})},null,12,P)):e.createCommentVNode("",!0),a.value&&r.value.length>=2?(e.openBlock(),e.createElementBlock("rect",{key:1,x:r.value[0].x-t.handleSize/t.scale/2,y:r.value[0].y-t.handleSize/t.scale/2,width:t.handleSize/t.scale,height:t.handleSize/t.scale,fill:t.strokeColor,opacity:.4,stroke:t.strokeColor,"stroke-width":t.strokeWidth/2},null,8,z)):e.createCommentVNode("",!0)],12,w)}}}),A=["width","height","viewBox"],E=["d","opacity"],R=["d","transform","stroke","fill"],_=["d","transform","stroke","fill"],j=e.defineComponent({__name:"polyline",props:{rect:{},vertices:{},color:{default:"transparent"},strokeColor:{default:"#000000"},opacity:{default:1},strokeWidth:{},scale:{},isSelected:{type:Boolean},onClick:{},lineEndings:{}},setup(t){const n=t,l=e.computed(()=>n.vertices.map(({x:e,y:t})=>({x:e-n.rect.origin.x,y:t-n.rect.origin.y}))),r=e.computed(()=>{if(0===l.value.length)return"";const[e,...t]=l.value;return(`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y} `).join("")).trim()}),i=e.computed(()=>{var e,t;if(l.value.length<2)return{start:null,end:null};const r=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),i=r(l.value[0],l.value[1]),a=r(l.value[l.value.length-2],l.value[l.value.length-1]);return{start:o.patching.createEnding(null==(e=n.lineEndings)?void 0:e.start,n.strokeWidth,i+Math.PI,l.value[0].x,l.value[0].y),end:o.patching.createEnding(null==(t=n.lineEndings)?void 0:t.end,n.strokeWidth,a,l.value[l.value.length-1].x,l.value[l.value.length-1].y)}}),a=e=>({cursor:n.isSelected?"move":"pointer",strokeWidth:n.strokeWidth,pointerEvents:n.isSelected?"none":e.filled?"visible":"visibleStroke",strokeLinecap:"butt"}),c=e.computed(()=>n.rect.size.width*n.scale),s=e.computed(()=>n.rect.size.height*n.scale);return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{style:e.normalizeStyle({position:"absolute",width:`${c.value}px`,height:`${s.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:c.value,height:s.value,viewBox:`0 0 ${t.rect.size.width} ${t.rect.size.height}`},[e.createElementVNode("path",{d:r.value,onPointerdown:n[0]||(n[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[1]||(n[1]=(...e)=>t.onClick&&t.onClick(...e)),opacity:t.opacity,style:e.normalizeStyle({fill:"none",stroke:t.strokeColor??t.color,strokeWidth:t.strokeWidth,cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"visibleStroke",strokeLinecap:"butt",strokeLinejoin:"miter"})},null,44,E),i.value.start?(e.openBlock(),e.createElementBlock("path",{key:0,d:i.value.start.d,transform:i.value.start.transform,stroke:t.strokeColor,fill:i.value.start.filled?t.color:"none",onPointerdown:n[2]||(n[2]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[3]||(n[3]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle(a(i.value.start))},null,44,R)):e.createCommentVNode("",!0),i.value.end?(e.openBlock(),e.createElementBlock("path",{key:1,d:i.value.end.d,transform:i.value.end.transform,stroke:t.strokeColor,fill:i.value.end.filled?t.color:"none",onPointerdown:n[4]||(n[4]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[5]||(n[5]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle(a(i.value.end))},null,44,_)):e.createCommentVNode("",!0)],12,A))}}),M=["width","height","viewBox"],$=["x","y","width","height","fill","opacity"],D=e.defineComponent({__name:"square",props:{isSelected:{type:Boolean},color:{default:"#000000"},strokeColor:{},opacity:{default:1},strokeWidth:{},strokeStyle:{default:l.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>{const e=o.rect.size.width,t=o.rect.size.height;return{width:Math.max(e-o.strokeWidth,0),height:Math.max(t-o.strokeWidth,0),x:o.strokeWidth/2,y:o.strokeWidth/2}}),r=e.computed(()=>(n.value.width+o.strokeWidth)*o.scale),i=e.computed(()=>(n.value.height+o.strokeWidth)*o.scale);return(o,a)=>{var c;return e.openBlock(),e.createElementBlock("svg",{style:e.normalizeStyle({position:"absolute",width:r.value,height:i.value,pointerEvents:"none",zIndex:2}),width:r.value,height:i.value,viewBox:`0 0 ${n.value.width+t.strokeWidth} ${n.value.height+t.strokeWidth}`},[e.createElementVNode("rect",{x:n.value.x,y:n.value.y,width:n.value.width,height:n.value.height,fill:t.color,opacity:t.opacity,onPointerdown:a[0]||(a[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:a[1]||(a[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"transparent"===t.color?"visibleStroke":"visible",stroke:t.strokeColor??t.color,strokeWidth:t.strokeWidth,...t.strokeStyle===e.unref(l.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(c=t.strokeDashArray)?void 0:c.join(",")}})},null,44,$)],12,M)}}}),N=["src"],V=e.defineComponent({__name:"render-annotation",props:{documentId:{},pageIndex:{},annotation:{},scaleFactor:{default:1},style:{}},setup(t){const o=t,{provides:r}=c(),i=e.ref(null),a=e.ref(null),s=e.ref(null),d=e.computed(()=>o.annotation.id),u=e.computed(()=>o.annotation.rect.size.width),p=e.computed(()=>o.annotation.rect.size.height);e.watch(()=>[o.pageIndex,o.scaleFactor,o.documentId,d.value,u.value,p.value,r.value],(e,t,c)=>{if(r.value){a.value&&(URL.revokeObjectURL(a.value),a.value=null);const e=r.value.forDocument(o.documentId).renderAnnotation({pageIndex:o.pageIndex,annotation:n.deepToRaw(o.annotation),options:{scaleFactor:o.scaleFactor,dpr:window.devicePixelRatio}});s.value=e,e.wait(e=>{const t=URL.createObjectURL(e);i.value=t,a.value=t},l.ignore),c(()=>{a.value?(URL.revokeObjectURL(a.value),a.value=null):e.abort({code:l.PdfErrorCode.Cancelled,message:"canceled render task"})})}},{immediate:!0}),e.onUnmounted(()=>{a.value&&(URL.revokeObjectURL(a.value),a.value=null),s.value&&s.value.abort({code:l.PdfErrorCode.Cancelled,message:"canceled render task on unmount"})});const v=()=>{a.value&&(URL.revokeObjectURL(a.value),a.value=null)};return(o,n)=>i.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:i.value,onLoad:v,style:e.normalizeStyle({width:"100%",height:"100%",display:"block",...t.style})},null,44,N)):e.createCommentVNode("",!0)}}),L=e.defineComponent({__name:"stamp",props:{isSelected:{type:Boolean},annotation:{},documentId:{},pageIndex:{},scale:{},onClick:{type:Function}},setup:t=>(o,n)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle({position:"absolute",width:"100%",height:"100%",zIndex:2,pointerEvents:t.isSelected?"none":"auto",cursor:"pointer"}),onPointerdown:n[0]||(n[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[1]||(n[1]=(...e)=>t.onClick&&t.onClick(...e))},[e.createVNode(V,{documentId:t.documentId,pageIndex:t.pageIndex,annotation:{...t.annotation.object,id:t.annotation.object.id},scaleFactor:t.scale},null,8,["documentId","pageIndex","annotation","scaleFactor"])],36))}),T=e.defineComponent({__name:"highlight",props:{color:{default:"#FFFF00"},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup:t=>(o,n)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,(o,l)=>(e.openBlock(),e.createElementBlock("div",{key:l,onPointerdown:n[0]||(n[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[1]||(n[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({position:"absolute",left:(t.rect?o.origin.x-t.rect.origin.x:o.origin.x)*t.scale+"px",top:(t.rect?o.origin.y-t.rect.origin.y:o.origin.y)*t.scale+"px",width:o.size.width*t.scale+"px",height:o.size.height*t.scale+"px",background:t.color,opacity:t.opacity,pointerEvents:t.onClick?"auto":"none",cursor:t.onClick?"pointer":"default",zIndex:t.onClick?1:void 0})},null,36))),128))}),F=e.defineComponent({__name:"squiggly",props:{color:{default:"#FFFF00"},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>2*o.scale),l=e.computed(()=>6*o.scale),r=e.computed(()=>{const e=n.value,t=l.value,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${2*e}" viewBox="0 0 ${t} ${2*e}">\n <path d="M0 ${e} Q ${t/4} 0 ${t/2} ${e} T ${t} ${e}"\n fill="none" stroke="${o.color}" stroke-width="${e}" stroke-linecap="round"/>\n </svg>`;return`url("data:image/svg+xml;utf8,${encodeURIComponent(r)}")`});return(o,i)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,(o,a)=>(e.openBlock(),e.createElementBlock("div",{key:a,onPointerdown:i[0]||(i[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:i[1]||(i[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({position:"absolute",left:(t.rect?o.origin.x-t.rect.origin.x:o.origin.x)*t.scale+"px",top:(t.rect?o.origin.y-t.rect.origin.y:o.origin.y)*t.scale+"px",width:o.size.width*t.scale+"px",height:o.size.height*t.scale+"px",background:"transparent",pointerEvents:t.onClick?"auto":"none",cursor:t.onClick?"pointer":"default",zIndex:t.onClick?1:0})},[e.createElementVNode("div",{style:e.normalizeStyle({position:"absolute",left:0,bottom:0,width:"100%",height:2*n.value+"px",backgroundImage:r.value,backgroundRepeat:"repeat-x",backgroundSize:`${l.value}px ${2*n.value}px`,opacity:t.opacity,pointerEvents:"none"})},null,4)],36))),128))}}),W=e.defineComponent({__name:"strikeout",props:{color:{default:"#FFFF00"},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>2*o.scale);return(o,l)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,(o,r)=>(e.openBlock(),e.createElementBlock("div",{key:r,onPointerdown:l[0]||(l[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:l[1]||(l[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({position:"absolute",left:(t.rect?o.origin.x-t.rect.origin.x:o.origin.x)*t.scale+"px",top:(t.rect?o.origin.y-t.rect.origin.y:o.origin.y)*t.scale+"px",width:o.size.width*t.scale+"px",height:o.size.height*t.scale+"px",background:"transparent",pointerEvents:t.onClick?"auto":"none",cursor:t.onClick?"pointer":"default",zIndex:t.onClick?1:0})},[e.createElementVNode("div",{style:e.normalizeStyle({position:"absolute",left:0,top:"50%",width:"100%",height:`${n.value}px`,background:t.color,opacity:t.opacity,transform:"translateY(-50%)",pointerEvents:"none"})},null,4)],36))),128))}}),U=e.defineComponent({__name:"underline",props:{color:{default:"#FFFF00"},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>2*o.scale);return(o,l)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,(o,r)=>(e.openBlock(),e.createElementBlock("div",{key:r,onPointerdown:l[0]||(l[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:l[1]||(l[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({position:"absolute",left:(t.rect?o.origin.x-t.rect.origin.x:o.origin.x)*t.scale+"px",top:(t.rect?o.origin.y-t.rect.origin.y:o.origin.y)*t.scale+"px",width:o.size.width*t.scale+"px",height:o.size.height*t.scale+"px",background:"transparent",pointerEvents:t.onClick?"auto":"none",cursor:t.onClick?"pointer":"default",zIndex:t.onClick?1:0})},[e.createElementVNode("div",{style:e.normalizeStyle({position:"absolute",left:0,bottom:0,width:"100%",height:`${n.value}px`,background:t.color,opacity:t.opacity,pointerEvents:"none"})},null,4)],36))),128))}}),O=e.defineComponent({__name:"annotations",props:{documentId:{},pageIndex:{},scale:{},rotation:{},pageWidth:{},pageHeight:{},resizeUI:{},vertexUI:{},selectionOutlineColor:{},selectionMenu:{type:Function}},setup(t){const n=t,{provides:a}=c(),{provides:s}=i.useSelectionCapability(),u=e.ref([]),{register:p}=r.usePointerHandlers({documentId:()=>n.documentId,pageIndex:n.pageIndex}),k=e.ref(null),m=e.ref(null),f=e.computed(()=>a.value?a.value.forDocument(n.documentId):null);e.watchEffect(e=>{if(f.value){const t=f.value.getState();u.value=o.getAnnotationsByPageIndex(t,n.pageIndex),k.value=o.getSelectedAnnotationByPageIndex(t,n.pageIndex);e(f.value.onStateChange(e=>{u.value=o.getAnnotationsByPageIndex(e,n.pageIndex),k.value=o.getSelectedAnnotationByPageIndex(e,n.pageIndex)}))}});const y=(e,t)=>{t.target===t.currentTarget&&f.value&&(f.value.deselectAnnotation(),m.value=null)},x=(e,t)=>{e.stopPropagation(),f.value&&s.value&&(f.value.selectAnnotation(n.pageIndex,t.object.id),s.value.clear(),t.object.id!==m.value&&(m.value=null))};e.watchEffect(e=>{if(f.value){const t=p({onPointerDown:y});t&&e(t)}});const C=e=>{var t;return null==(t=f.value)?void 0:t.findToolForAnnotation(e.object)},b=e=>{var t;return(!o.isFreeText(e)||m.value!==e.object.id)&&((null==(t=C(e))?void 0:t.interaction.isDraggable)??!1)},w=e=>{var t;return(null==(t=C(e))?void 0:t.interaction.isResizable)??!1},B=e=>{var t;return(null==(t=C(e))?void 0:t.interaction.lockAspectRatio)??!1},P=e=>o.isLine(e)?{extractVertices:e=>[e.linePoints.start,e.linePoints.end],transformAnnotation:(e,t)=>({...e,linePoints:{start:t[0],end:t[1]}})}:o.isPolyline(e)||o.isPolygon(e)?{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})}:void 0;return(r,i)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,i=>{var a,c,s,p,f,y,C,z,A,E,R,_;return e.openBlock(),e.createElementBlock(e.Fragment,{key:i.object.id},[e.unref(o.isInk)(i)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:0,trackedAnnotation:i,isSelected:(null==(a=k.value)?void 0:a.object.id)===i.object.id,isDraggable:b(i),isResizable:w(i),lockAspectRatio:B(i),onSelect:e=>x(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(h,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=k.value)?void 0:n.object.id)===i.object.id,scale:t.scale,onClick:e=>x(e,i)}),null,16,["isSelected","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isSquare)(i)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:1,trackedAnnotation:i,isSelected:(null==(c=k.value)?void 0:c.object.id)===i.object.id,isDraggable:b(i),isResizable:w(i),lockAspectRatio:B(i),onSelect:e=>x(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(D,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=k.value)?void 0:n.object.id)===i.object.id,scale:t.scale,onClick:e=>x(e,i)}),null,16,["isSelected","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isCircle)(i)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:2,trackedAnnotation:i,isSelected:(null==(s=k.value)?void 0:s.object.id)===i.object.id,isDraggable:b(i),isResizable:w(i),lockAspectRatio:B(i),onSelect:e=>x(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(v,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=k.value)?void 0:n.object.id)===i.object.id,scale:t.scale,onClick:e=>x(e,i)}),null,16,["isSelected","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isLine)(i)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:3,trackedAnnotation:i,isSelected:(null==(p=k.value)?void 0:p.object.id)===i.object.id,isDraggable:b(i),isResizable:w(i),lockAspectRatio:B(i),onSelect:e=>x(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(S,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=k.value)?void 0:n.object.id)===i.object.id,scale:t.scale,onClick:e=>x(e,i)}),null,16,["isSelected","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isPolyline)(i)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:4,trackedAnnotation:i,isSelected:(null==(f=k.value)?void 0:f.object.id)===i.object.id,isDraggable:b(i),isResizable:w(i),lockAspectRatio:B(i),onSelect:e=>x(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(j,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=k.value)?void 0:n.object.id)===i.object.id,scale:t.scale,onClick:e=>x(e,i)}),null,16,["isSelected","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isPolygon)(i)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:5,trackedAnnotation:i,isSelected:(null==(y=k.value)?void 0:y.object.id)===i.object.id,isDraggable:b(i),isResizable:w(i),lockAspectRatio:B(i),onSelect:e=>x(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(I,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=k.value)?void 0:n.object.id)===i.object.id,scale:t.scale,onClick:e=>x(e,i)}),null,16,["isSelected","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isFreeText)(i)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:6,trackedAnnotation:i,isSelected:(null==(C=k.value)?void 0:C.object.id)===i.object.id,isDraggable:b(i),isResizable:w(i),lockAspectRatio:B(i),onSelect:e=>x(e,i),onDoubleClick:e=>{return t=i.object.id,void(o.isFreeText(u.value.find(e=>e.object.id===t))&&(m.value=t));var t},vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(g,{isSelected:(null==(n=k.value)?void 0:n.object.id)===i.object.id,isEditing:m.value===i.object.id,annotation:{...i,object:o},pageIndex:t.pageIndex,scale:t.scale,onClick:e=>x(e,i)},null,8,["isSelected","isEditing","annotation","pageIndex","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","onDoubleClick","vertexConfig","style"])):e.unref(o.isStamp)(i)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:7,trackedAnnotation:i,isSelected:(null==(z=k.value)?void 0:z.object.id)===i.object.id,isDraggable:b(i),isResizable:w(i),lockAspectRatio:B(i),onSelect:e=>x(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(()=>{var o;return[e.createVNode(L,{documentId:t.documentId,isSelected:(null==(o=k.value)?void 0:o.object.id)===i.object.id,annotation:i,pageIndex:t.pageIndex,scale:t.scale,onClick:e=>x(e,i)},null,8,["documentId","isSelected","annotation","pageIndex","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isUnderline)(i)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:8,trackedAnnotation:i,isSelected:(null==(A=k.value)?void 0:A.object.id)===i.object.id,isDraggable:b(i),isResizable:w(i),lockAspectRatio:B(i),onSelect:e=>x(e,i),vertexConfig:P(i),zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>[e.createVNode(U,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>x(e,i)}),null,16,["scale","onClick"])]),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isStrikeout)(i)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:9,trackedAnnotation:i,isSelected:(null==(E=k.value)?void 0:E.object.id)===i.object.id,isDraggable:b(i),isResizable:w(i),lockAspectRatio:B(i),onSelect:e=>x(e,i),vertexConfig:P(i),zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>[e.createVNode(W,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>x(e,i)}),null,16,["scale","onClick"])]),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isSquiggly)(i)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:10,trackedAnnotation:i,isSelected:(null==(R=k.value)?void 0:R.object.id)===i.object.id,isDraggable:b(i),isResizable:w(i),lockAspectRatio:B(i),onSelect:e=>x(e,i),vertexConfig:P(i),zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>[e.createVNode(F,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>x(e,i)}),null,16,["scale","onClick"])]),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isHighlight)(i)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:11,trackedAnnotation:i,isSelected:(null==(_=k.value)?void 0:_.object.id)===i.object.id,isDraggable:b(i),isResizable:w(i),lockAspectRatio:B(i),onSelect:e=>x(e,i),vertexConfig:P(i),zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Multiply)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>[e.createVNode(T,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>x(e,i)}),null,16,["scale","onClick"])]),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.createCommentVNode("",!0)],64)}),128))}}),H=e.defineComponent({__name:"text-markup",props:{documentId:{},pageIndex:{},scale:{}},setup(t){const o=t,{provides:n}=i.useSelectionCapability(),{provides:r}=c(),a=e.ref([]),s=e.ref(null),d=e.ref(null);e.watchEffect(e=>{const t=[];if(n.value){const e=n.value.forDocument(o.documentId),l=e.onSelectionChange(()=>{a.value=e.getHighlightRectsForPage(o.pageIndex),s.value=e.getBoundingRectForPage(o.pageIndex)});t.push(l)}if(r.value){const e=r.value.forDocument(o.documentId);d.value=e.getActiveTool();const n=e.onActiveToolChange(e=>d.value=e);t.push(n)}e(()=>{t.forEach(e=>e())})});const u=e.computed(()=>{if(!d.value)return l.blendModeToCss(l.PdfBlendMode.Normal);const e=d.value.defaults.type===l.PdfAnnotationSubtype.HIGHLIGHT?l.PdfBlendMode.Multiply:l.PdfBlendMode.Normal;return l.blendModeToCss(d.value.defaults.blendMode??e)});return(o,n)=>s.value&&d.value?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle({mixBlendMode:u.value,pointerEvents:"none",position:"absolute",inset:0})},[d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).HIGHLIGHT?(e.openBlock(),e.createBlock(T,{key:0,color:d.value.defaults.color,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["color","opacity","segmentRects","scale"])):d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).UNDERLINE?(e.openBlock(),e.createBlock(U,{key:1,color:d.value.defaults.color,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["color","opacity","segmentRects","scale"])):d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).STRIKEOUT?(e.openBlock(),e.createBlock(W,{key:2,color:d.value.defaults.color,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["color","opacity","segmentRects","scale"])):d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).SQUIGGLY?(e.openBlock(),e.createBlock(F,{key:3,color:d.value.defaults.color,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["color","opacity","segmentRects","scale"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0)}}),q=e.defineComponent({__name:"preview-renderer",props:{preview:{},scale:{}},setup(t){const o=t,n=e.computed(()=>({position:"absolute",left:o.preview.bounds.origin.x*o.scale+"px",top:o.preview.bounds.origin.y*o.scale+"px",width:o.preview.bounds.size.width*o.scale+"px",height:o.preview.bounds.size.height*o.scale+"px",pointerEvents:"none",zIndex:10}));return(o,r)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(n.value)},[t.preview.type===e.unref(l.PdfAnnotationSubtype).CIRCLE?(e.openBlock(),e.createBlock(e.unref(v),e.mergeProps({key:0,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).SQUARE?(e.openBlock(),e.createBlock(e.unref(D),e.mergeProps({key:1,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).POLYGON?(e.openBlock(),e.createBlock(e.unref(I),e.mergeProps({key:2,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).POLYLINE?(e.openBlock(),e.createBlock(e.unref(j),e.mergeProps({key:3,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).LINE?(e.openBlock(),e.createBlock(e.unref(S),e.mergeProps({key:4,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).INK?(e.openBlock(),e.createBlock(e.unref(h),e.mergeProps({key:5,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).FREETEXT?(e.openBlock(),e.createElementBlock("div",{key:6,style:e.normalizeStyle({width:"100%",height:"100%",border:`1px dashed ${t.preview.data.fontColor||"#000000"}`,backgroundColor:"transparent"})},null,4)):e.createCommentVNode("",!0)],4))}}),G=e.defineComponent({__name:"annotation-paint-layer",props:{documentId:{},pageIndex:{},scale:{}},setup(t){const o=t,{plugin:n}=a(),l=e.ref(new Map),r=e.ref(null),i=e.ref(null),c=e.computed(()=>({requestFile:({accept:e,onFile:t})=>{const o=r.value;o&&(o.accept=e,o.onchange=e=>{var n;const l=null==(n=e.target.files)?void 0:n[0];l&&(t(l),o.value="")},o.click())},processImage:({source:e,maxWidth:t,maxHeight:o,onComplete:n})=>{const l=i.value;if(!l||!l.getContext)return;const r=l.getContext("2d");if(!r)return;const a=new Image;a.crossOrigin="Anonymous",a.onload=()=>{let{naturalWidth:i,naturalHeight:c}=a;const s=t?t/i:1,d=o?o/c:1,u=Math.min(s,d,1),p=i*u,v=c*u;l.width=p,l.height=v,r.drawImage(a,0,0,p,v);const k=r.getImageData(0,0,p,v);"string"!=typeof e&&URL.revokeObjectURL(a.src),n({imageData:k,width:p,height:v})},a.src="string"==typeof e?e:URL.createObjectURL(e)}}));let s;return e.watchEffect(e=>{n.value&&(s=n.value.registerPageHandlers(o.documentId,o.pageIndex,o.scale,{services:c.value,onPreview:(e,t)=>{const o=new Map(l.value);t?o.set(e,t):o.delete(e),l.value=o}})),e(()=>{null==s||s()})}),(o,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("input",{ref_key:"fileInputRef",ref:r,type:"file",style:{display:"none"}},null,512),e.createElementVNode("canvas",{ref_key:"canvasRef",ref:i,style:{display:"none"}},null,512),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.entries(),([o,n])=>(e.openBlock(),e.createBlock(q,{key:o,preview:n,scale:t.scale},null,8,["preview","scale"]))),128))],64))}}),Y=e.defineComponent({__name:"annotation-layer",props:{documentId:{},pageIndex:{},scale:{},rotation:{},resizeUI:{},vertexUI:{},selectionOutlineColor:{},selectionMenu:{type:Function}},setup(o){const n=o,r=t.useDocumentState(()=>n.documentId),i=e.computed(()=>{var e,t,o;return null==(o=null==(t=null==(e=r.value)?void 0:e.document)?void 0:t.pages)?void 0:o[n.pageIndex]}),a=e.computed(()=>{var e,t;return(null==(t=null==(e=i.value)?void 0:e.size)?void 0:t.width)??0}),c=e.computed(()=>{var e,t;return(null==(t=null==(e=i.value)?void 0:e.size)?void 0:t.height)??0}),s=e.computed(()=>{var e;return void 0!==n.scale?n.scale:(null==(e=r.value)?void 0:e.scale)??1}),d=e.computed(()=>{var e;return void 0!==n.rotation?n.rotation:(null==(e=r.value)?void 0:e.rotation)??l.Rotation.Degree0});return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(O,{documentId:o.documentId,pageIndex:o.pageIndex,scale:s.value,rotation:d.value,pageWidth:a.value,pageHeight:c.value,resizeUI:o.resizeUI,vertexUI:o.vertexUI,selectionOutlineColor:o.selectionOutlineColor,selectionMenu:o.selectionMenu},{"selection-menu":e.withCtx(o=>[e.renderSlot(t.$slots,"selection-menu",e.normalizeProps(e.guardReactiveProps(o)))]),"resize-handle":e.withCtx(o=>[e.renderSlot(t.$slots,"resize-handle",e.normalizeProps(e.guardReactiveProps(o)))]),"vertex-handle":e.withCtx(o=>[e.renderSlot(t.$slots,"vertex-handle",e.normalizeProps(e.guardReactiveProps(o)))]),_:3},8,["documentId","pageIndex","scale","rotation","pageWidth","pageHeight","resizeUI","vertexUI","selectionOutlineColor","selectionMenu"]),e.createVNode(H,{documentId:o.documentId,pageIndex:o.pageIndex,scale:s.value},null,8,["documentId","pageIndex","scale"]),e.createVNode(G,{documentId:o.documentId,pageIndex:o.pageIndex,scale:s.value},null,8,["documentId","pageIndex","scale"])]))}});exports.AnnotationContainer=d,exports.AnnotationLayer=Y,exports.AnnotationPaintLayer=G,exports.Annotations=O,exports.Circle=v,exports.FreeText=g,exports.Highlight=T,exports.Ink=h,exports.Line=S,exports.Polygon=I,exports.Polyline=j,exports.PreviewRenderer=q,exports.RenderAnnotation=V,exports.Square=D,exports.Squiggly=F,exports.Stamp=L,exports.Strikeout=W,exports.TextMarkup=H,exports.Underline=U,exports.useAnnotation=t=>{var n,l;const{provides:r}=c(),i=e.ref((null==(l=null==(n=null==r?void 0:r.value)?void 0:n.forDocument(e.toValue(t)))?void 0:l.getState())??o.initialDocumentState());return e.watch([r,()=>e.toValue(t)],([e,t],o,n)=>{if(e&&t){const o=e.forDocument(t);i.value=o.getState();n(o.onStateChange(e=>{i.value=e}))}},{immediate:!0}),{state:i,provides:e.computed(()=>{var o;return(null==(o=r.value)?void 0:o.forDocument(e.toValue(t)))??null})}},exports.useAnnotationCapability=c,exports.useAnnotationPlugin=a,Object.keys(o).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>o[e]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/plugin-annotation"),o=require("vue"),n=require("@embedpdf/utils/vue"),l=require("@embedpdf/core/vue"),r=require("@embedpdf/models"),i=require("@embedpdf/plugin-interaction-manager/vue"),a=require("@embedpdf/plugin-selection/vue"),s=()=>l.usePlugin(t.AnnotationPlugin.id),c=()=>l.useCapability(t.AnnotationPlugin.id),d={"data-no-interaction":"",style:{display:"contents"}},u=o.defineComponent({inheritAttrs:!1,__name:"annotation-container",props:{scale:{},documentId:{},pageIndex:{},rotation:{},pageWidth:{},pageHeight:{},trackedAnnotation:{},isSelected:{type:Boolean},isMultiSelected:{type:Boolean,default:!1},isDraggable:{type:Boolean},isResizable:{type:Boolean},lockAspectRatio:{type:Boolean,default:!1},vertexConfig:{},selectionMenu:{},outlineOffset:{default:1},onDoubleClick:{},onSelect:{},zIndex:{default:1},selectionOutlineColor:{default:"#007ACC"},style:{}},setup(e){const t=e,r="#007ACC",i="#007ACC",a=o.shallowRef(o.toRaw(t.trackedAnnotation.object)),{provides:u}=c(),{plugin:p}=s(),v=l.useDocumentPermissions(t.documentId),g=o.ref(null),m=o.shallowRef(null),k=o.computed(()=>v.value.canModifyAnnotations&&t.isDraggable&&!t.isMultiSelected),f=o.computed(()=>v.value.canModifyAnnotations&&t.isResizable&&!t.isMultiSelected),h=t.onDoubleClick?e=>{var o;v.value.canModifyAnnotations&&(null==(o=t.onDoubleClick)||o.call(t,e))}:void 0,y=o.computed(()=>u.value?u.value.forDocument(t.documentId):null),x=o.computed(()=>({...o.toRaw(t.trackedAnnotation.object),...o.toRaw(a.value)})),C=o.computed(()=>t.isSelected&&!t.isMultiSelected),S=o.computed(()=>t.isSelected&&!t.isMultiSelected&&(t.selectionMenu||j["selection-menu"])),b=o.computed(()=>({origin:{x:x.value.rect.origin.x*t.scale,y:x.value.rect.origin.y*t.scale},size:{width:x.value.rect.size.width*t.scale,height:x.value.rect.size.height*t.scale}})),w=o.computed(()=>({type:"annotation",annotation:t.trackedAnnotation,pageIndex:t.pageIndex})),B=o.computed(()=>({suggestTop:!1,spaceAbove:0,spaceBelow:0})),z=(e,o)=>t.selectionMenu?t.selectionMenu({rect:e,menuWrapperProps:o,selected:t.isSelected,placement:B.value,context:w.value}):null,I=o.computed(()=>o.toRaw(x.value).rect),P=o.computed(()=>{var e;const n=o.toRaw(x.value);return(null==(e=t.vertexConfig)?void 0:e.extractVertices(n))??[]}),R=o.computed(()=>({minWidth:10,minHeight:10,boundingBox:{width:t.pageWidth,height:t.pageHeight}})),{dragProps:A,vertices:M,resize:E}=n.useInteractionHandles({controller:{element:I,vertices:P,constraints:R,maintainAspectRatio:o.computed(()=>t.lockAspectRatio),pageRotation:o.computed(()=>t.rotation),scale:o.computed(()=>t.scale),enabled:o.computed(()=>t.isSelected&&!t.isMultiSelected),onUpdate:e=>{var n,l,r;if(!(null==(n=e.transformData)?void 0:n.type)||t.isMultiSelected)return;const i=p.value;if(!i)return;const{type:s,changes:c,metadata:d}=e.transformData,v=t.trackedAnnotation.object.id,k={width:t.pageWidth,height:t.pageHeight};if("start"===e.state&&(m.value=t.trackedAnnotation.object.rect,g.value=x.value,"move"===s?i.startDrag(t.documentId,{annotationIds:[v],pageSize:k}):"resize"===s&&i.startResize(t.documentId,{annotationIds:[v],pageSize:k,resizeHandle:(null==d?void 0:d.handle)??"se"})),c.rect&&m.value)if("move"===s){const e={x:c.rect.origin.x-m.value.origin.x,y:c.rect.origin.y-m.value.origin.y};i.updateDrag(t.documentId,e)}else"resize"===s&&i.updateResize(t.documentId,c.rect);if("vertex-edit"===s&&c.vertices&&t.vertexConfig){const n=g.value??x.value,i=t.vertexConfig.transformAnnotation(o.toRaw(n),c.vertices),p=null==(l=u.value)?void 0:l.transformAnnotation(n,{type:s,changes:i,metadata:d});p&&(a.value={...o.toRaw(a.value),...p},"end"===e.state&&(null==(r=y.value)||r.updateAnnotation(t.pageIndex,v,p)))}"end"===e.state&&(m.value=null,g.value=null,"move"===s?i.commitDrag(t.documentId):"resize"===s&&i.commitResize(t.documentId))}},resizeUI:{handleSize:12,spacing:t.outlineOffset,offsetMode:"outside",includeSides:!t.lockAspectRatio,zIndex:t.zIndex+1},vertexUI:{vertexSize:12,zIndex:t.zIndex+2},includeVertices:!!t.vertexConfig}),_=n.useDoublePressProps(h);o.watchEffect(()=>{t.trackedAnnotation.object&&(a.value=t.trackedAnnotation.object)}),o.watchEffect(e=>{const n=p.value;if(!n)return;const l=t.trackedAnnotation.object.id,r=e=>{var n;if(e.documentId!==t.documentId)return;const r=null==(n=e.previewPatches)?void 0:n[l];"update"===e.type&&r?a.value={...o.toRaw(a.value),...r}:"cancel"===e.type&&(a.value=t.trackedAnnotation.object)},i=[n.onDragChange(r),n.onResizeChange(r)];e(()=>i.forEach(e=>e()))});const D=o.computed(()=>({position:"absolute",left:x.value.rect.origin.x*t.scale+"px",top:x.value.rect.origin.y*t.scale+"px",width:x.value.rect.size.width*t.scale+"px",height:x.value.rect.size.height*t.scale+"px",outline:C.value?`1px solid ${t.selectionOutlineColor}`:"none",outlineOffset:C.value?`${t.outlineOffset}px`:"0px",pointerEvents:t.isSelected&&!t.isMultiSelected?"auto":"none",touchAction:"none",cursor:t.isSelected&&k.value?"move":"default",zIndex:t.zIndex})),$=o.computed(()=>({...D.value,...t.style??{}})),j=o.useSlots();return(t,l)=>(o.openBlock(),o.createElementBlock("div",d,[o.createElementVNode("div",o.mergeProps({...k.value&&e.isSelected?o.unref(A):{},...o.unref(_)},{style:$.value}),[o.renderSlot(t.$slots,"default",{annotation:x.value}),e.isSelected&&f.value?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:0},o.renderList(o.unref(E),({key:e,style:n,...l})=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:e},[o.unref(j)["resize-handle"]?o.renderSlot(t.$slots,"resize-handle",o.mergeProps({key:0,ref_for:!0},{key:e,style:n,...l,backgroundColor:r}),()=>[o.createElementVNode("div",o.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:r}]}),null,16)]):(o.openBlock(),o.createElementBlock("div",o.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:r}]}),null,16))],64))),128)):o.createCommentVNode("",!0),e.isSelected&&o.unref(v).canModifyAnnotations&&!e.isMultiSelected&&o.unref(M).length>0?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:1},o.renderList(o.unref(M),({key:e,style:n,...l})=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:e},[o.unref(j)["vertex-handle"]?o.renderSlot(t.$slots,"vertex-handle",o.mergeProps({key:0,ref_for:!0},{key:e,style:n,...l,backgroundColor:i}),()=>[o.createElementVNode("div",o.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:i}]}),null,16)]):(o.openBlock(),o.createElementBlock("div",o.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:i}]}),null,16))],64))),128)):o.createCommentVNode("",!0)],16),S.value?(o.openBlock(),o.createBlock(o.unref(n.CounterRotate),{key:0,rect:b.value,rotation:e.rotation},{default:o.withCtx(({rect:n,menuWrapperProps:l})=>[e.selectionMenu?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(z(n,l)),{key:0})):o.renderSlot(t.$slots,"selection-menu",{key:1,context:w.value,selected:e.isSelected,rect:n,placement:B.value,menuWrapperProps:l})]),_:3},8,["rect","rotation"])):o.createCommentVNode("",!0)]))}}),p={key:0,"data-group-selection-box":"","data-no-interaction":""},v=o.defineComponent({__name:"group-selection-box",props:{documentId:{},pageIndex:{},scale:{},rotation:{},pageWidth:{},pageHeight:{},selectedAnnotations:{},isDraggable:{type:Boolean},isResizable:{type:Boolean},resizeUI:{},selectionOutlineColor:{default:"#007ACC"},outlineOffset:{default:2},zIndex:{default:100},groupSelectionMenu:{}},setup(e){const t=e,i=o.useSlots(),{plugin:a}=s(),c=l.useDocumentPermissions(()=>t.documentId),d=o.shallowRef(null),u=o.ref(!1),v=o.ref(!1),g=o.computed(()=>c.value.canModifyAnnotations&&t.isDraggable),m=o.computed(()=>c.value.canModifyAnnotations&&t.isResizable),k=o.computed(()=>{var e;return(null==(e=t.resizeUI)?void 0:e.color)??"#007ACC"}),f=o.computed(()=>{var e;return(null==(e=t.resizeUI)?void 0:e.size)??12}),h=o.computed(()=>{const e=t.selectedAnnotations.map(e=>e.object.rect);return r.boundingRectOrEmpty(e)}),y=o.shallowRef(h.value);o.watch(()=>h.value,e=>{u.value||v.value||(y.value=e)},{immediate:!0});const x=o.computed(()=>({position:"absolute",left:y.value.origin.x*t.scale+"px",top:y.value.origin.y*t.scale+"px",width:y.value.size.width*t.scale+"px",height:y.value.size.height*t.scale+"px",outline:`2px dashed ${t.selectionOutlineColor}`,outlineOffset:t.outlineOffset-1+"px",cursor:g.value?"move":"default",touchAction:"none",zIndex:t.zIndex})),C=o.computed(()=>({origin:{x:y.value.origin.x*t.scale,y:y.value.origin.y*t.scale},size:{width:y.value.size.width*t.scale,height:y.value.size.height*t.scale}})),S=o.computed(()=>({type:"group",annotations:t.selectedAnnotations,pageIndex:t.pageIndex})),b=o.computed(()=>({suggestTop:!1})),w=o.computed(()=>t.groupSelectionMenu||i["group-selection-menu"]),B=(e,o)=>t.groupSelectionMenu?t.groupSelectionMenu({rect:e,menuWrapperProps:o,selected:!0,placement:b.value,context:S.value}):null,z=o.computed(()=>y.value),I=o.computed(()=>({minWidth:20,minHeight:20,boundingBox:{width:t.pageWidth,height:t.pageHeight}})),{dragProps:P,resize:R}=n.useInteractionHandles({controller:{element:z,vertices:o.computed(()=>[]),constraints:I,maintainAspectRatio:o.computed(()=>!1),pageRotation:o.computed(()=>t.rotation),scale:o.computed(()=>t.scale),enabled:o.computed(()=>!0),onUpdate:e=>{var o,n;if(!(null==(o=e.transformData)?void 0:o.type))return;if(!a.value)return;const l=a.value,r=e.transformData.type,i="move"===r,s="resize"===r;if(i&&!g.value)return;"start"===e.state&&(d.value=h.value,i?(u.value=!0,l.startDrag(t.documentId,{annotationIds:t.selectedAnnotations.map(e=>e.object.id),pageSize:{width:t.pageWidth,height:t.pageHeight}})):s&&(v.value=!0,l.startResize(t.documentId,{annotationIds:t.selectedAnnotations.map(e=>e.object.id),pageSize:{width:t.pageWidth,height:t.pageHeight},resizeHandle:(null==(n=e.transformData.metadata)?void 0:n.handle)??"se"})));const c=d.value??h.value;if(i&&e.transformData.changes.rect){const o=e.transformData.changes.rect,n={x:o.origin.x-c.origin.x,y:o.origin.y-c.origin.y},r=l.updateDrag(t.documentId,n);y.value={...c,origin:{x:c.origin.x+r.x,y:c.origin.y+r.y}}}else if(s&&e.transformData.changes.rect){const o=e.transformData.changes.rect;l.updateResize(t.documentId,o),y.value=o}"end"===e.state&&(d.value=null,i&&u.value?(u.value=!1,l.commitDrag(t.documentId)):s&&v.value&&(v.value=!1,l.commitResize(t.documentId)))}},resizeUI:{handleSize:f.value,spacing:t.outlineOffset,offsetMode:"outside",includeSides:!0,zIndex:t.zIndex+1},vertexUI:{vertexSize:0,zIndex:t.zIndex},includeVertices:!1});return(t,l)=>e.selectedAnnotations.length>=2?(o.openBlock(),o.createElementBlock("div",p,[o.createElementVNode("div",o.mergeProps(g.value?o.unref(P):{},{style:x.value,onPointerdown:l[0]||(l[0]=e=>g.value?void 0:e.stopPropagation())}),[m.value?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:0},o.renderList(o.unref(R),({key:e,style:n,...l})=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:e},[o.unref(i)["resize-handle"]?o.renderSlot(t.$slots,"resize-handle",o.mergeProps({key:0,ref_for:!0},{key:e,style:n,...l,backgroundColor:k.value}),()=>[o.createElementVNode("div",o.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:k.value}]}),null,16)]):(o.openBlock(),o.createElementBlock("div",o.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:k.value}]}),null,16))],64))),128)):o.createCommentVNode("",!0)],16),w.value?(o.openBlock(),o.createBlock(o.unref(n.CounterRotate),{key:0,rect:C.value,rotation:e.rotation},{default:o.withCtx(({rect:n,menuWrapperProps:l})=>[e.groupSelectionMenu?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(B(n,l)),{key:0})):o.renderSlot(t.$slots,"group-selection-menu",{key:1,context:S.value,selected:!0,rect:n,placement:b.value,menuWrapperProps:l})]),_:3},8,["rect","rotation"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0)}}),g=["width","height","viewBox"],m=["cx","cy","rx","ry","fill","opacity"],k=o.defineComponent({__name:"circle",props:{isSelected:{type:Boolean},color:{default:"#000000"},strokeColor:{},opacity:{default:1},strokeWidth:{},strokeStyle:{default:r.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>{const e=t.rect.size.width,o=t.rect.size.height,n=Math.max(e-t.strokeWidth,0),l=Math.max(o-t.strokeWidth,0);return{width:e,height:o,cx:t.strokeWidth/2+n/2,cy:t.strokeWidth/2+l/2,rx:n/2,ry:l/2}}),l=o.computed(()=>n.value.width*t.scale),i=o.computed(()=>n.value.height*t.scale);return(t,a)=>{var s;return o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:l.value,height:i.value,pointerEvents:"none",zIndex:2}),width:l.value,height:i.value,viewBox:`0 0 ${n.value.width} ${n.value.height}`},[o.createElementVNode("ellipse",{cx:n.value.cx,cy:n.value.cy,rx:n.value.rx,ry:n.value.ry,fill:e.color,opacity:e.opacity,onPointerdown:a[0]||(a[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:a[1]||(a[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"transparent"===e.color?"visibleStroke":"visible",stroke:e.strokeColor??e.color,strokeWidth:e.strokeWidth,...e.strokeStyle===o.unref(r.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(s=e.strokeDashArray)?void 0:s.join(",")}})},null,44,m)],12,g)}}}),f=["contenteditable"],h=o.defineComponent({__name:"free-text",props:{isSelected:{type:Boolean},isEditing:{type:Boolean},annotation:{},pageIndex:{},scale:{},onClick:{type:Function}},setup(e){const t=e,n=o.ref(null),{provides:l}=c(),i=o.ref(!1);o.onMounted(()=>{try{const e=navigator;i.value=/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&(null==e?void 0:e.maxTouchPoints)>1}catch{i.value=!1}}),o.watch(()=>t.isEditing,e=>{if(e&&n.value){const e=n.value;e.focus();const t=window.getSelection();if(t){const o=document.createRange();o.selectNodeContents(e),o.collapse(!1),t.removeAllRanges(),t.addRange(o)}}});const a=()=>{l.value&&n.value&&l.value.updateAnnotation(t.pageIndex,t.annotation.object.id,{contents:n.value.innerText})},s=o.computed(()=>{const{object:e}=t.annotation,o=e.fontSize*t.scale,n=i.value&&t.isEditing&&o>0&&o<16,l=n?16:o,a=n?o/16:1,s=n?100/a:100;return{color:e.fontColor,fontSize:`${l}px`,fontFamily:r.standardFontCss(e.fontFamily),textAlign:r.textAlignmentToCss(e.textAlign),flexDirection:"column",justifyContent:e.verticalAlign===r.PdfVerticalAlignment.Top?"flex-start":e.verticalAlign===r.PdfVerticalAlignment.Middle?"center":"flex-end",display:"flex",backgroundColor:e.color??e.backgroundColor,opacity:e.opacity,width:n?`${s}%`:"100%",height:n?`${s}%`:"100%",lineHeight:"1.18",overflow:"hidden",cursor:t.isEditing?"text":"pointer",outline:"none",transform:n?`scale(${a})`:void 0,transformOrigin:"top left"}});return(t,l)=>(o.openBlock(),o.createElementBlock("div",{style:o.normalizeStyle({position:"absolute",width:e.annotation.object.rect.size.width*e.scale+"px",height:e.annotation.object.rect.size.height*e.scale+"px",cursor:e.isSelected&&!e.isEditing?"move":"default",pointerEvents:e.isSelected&&!e.isEditing?"none":"auto",zIndex:2}),onPointerdown:l[0]||(l[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:l[1]||(l[1]=(...t)=>e.onClick&&e.onClick(...t))},[o.createElementVNode("span",{ref_key:"editorRef",ref:n,onBlur:a,tabindex:"0",style:o.normalizeStyle(s.value),contenteditable:e.isEditing},o.toDisplayString(e.annotation.object.contents),45,f)],36))}}),y=["width","height","viewBox"],x=["d","opacity"],C=o.defineComponent({__name:"ink",props:{isSelected:{type:Boolean},strokeColor:{},opacity:{default:1},strokeWidth:{},inkList:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#000000"),l=o.computed(()=>t.inkList.map(({points:e})=>{let o="";return e.forEach(({x:e,y:n},l)=>{const r=e-t.rect.origin.x,i=n-t.rect.origin.y;o+=(0===l?"M":"L")+`${r} ${i} `}),o.trim()})),r=o.computed(()=>t.rect.size.width*t.scale),i=o.computed(()=>t.rect.size.height*t.scale);return(t,a)=>(o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${r.value}px`,height:`${i.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:r.value,height:i.value,viewBox:`0 0 ${e.rect.size.width} ${e.rect.size.height}`},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value,(t,l)=>(o.openBlock(),o.createElementBlock("path",{key:l,d:t,fill:"none",opacity:e.opacity,onPointerdown:a[0]||(a[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:a[1]||(a[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"visibleStroke",stroke:n.value,strokeWidth:e.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round"})},null,44,x))),128))],12,y))}}),S=["width","height","viewBox"],b=["x1","y1","x2","y2","opacity"],w=["d","transform","stroke","fill"],B=["d","transform","stroke","fill"],z=o.defineComponent({__name:"line",props:{color:{default:"transparent"},opacity:{default:1},strokeWidth:{},strokeColor:{default:"#000000"},strokeStyle:{default:r.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},linePoints:{},lineEndings:{},scale:{},onClick:{},isSelected:{type:Boolean}},setup(e){const n=e,l=o.computed(()=>({x1:n.linePoints.start.x-n.rect.origin.x,y1:n.linePoints.start.y-n.rect.origin.y,x2:n.linePoints.end.x-n.rect.origin.x,y2:n.linePoints.end.y-n.rect.origin.y})),i=o.computed(()=>{var e,o;const{x1:r,y1:i,x2:a,y2:s}=l.value,c=Math.atan2(s-i,a-r);return{start:t.patching.createEnding(null==(e=n.lineEndings)?void 0:e.start,n.strokeWidth,c+Math.PI,r,i),end:t.patching.createEnding(null==(o=n.lineEndings)?void 0:o.end,n.strokeWidth,c,a,s)}}),a=e=>{var t;return{cursor:n.isSelected?"move":"pointer",strokeWidth:n.strokeWidth,strokeLinecap:"butt",pointerEvents:n.isSelected?"none":e.filled?"visible":"visibleStroke",...n.strokeStyle===r.PdfAnnotationBorderStyle.DASHED&&{strokeDasharray:null==(t=n.strokeDashArray)?void 0:t.join(",")}}},s=o.computed(()=>n.rect.size.width*n.scale),c=o.computed(()=>n.rect.size.height*n.scale);return(t,n)=>{var d;return o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${s.value}px`,height:`${c.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:s.value,height:c.value,viewBox:`0 0 ${e.rect.size.width} ${e.rect.size.height}`},[o.createElementVNode("line",{x1:l.value.x1,y1:l.value.y1,x2:l.value.x2,y2:l.value.y2,opacity:e.opacity,onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"visibleStroke",stroke:e.strokeColor,strokeWidth:e.strokeWidth,strokeLinecap:"butt",...e.strokeStyle===o.unref(r.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(d=e.strokeDashArray)?void 0:d.join(",")}})},null,44,b),i.value.start?(o.openBlock(),o.createElementBlock("path",{key:0,d:i.value.start.d,transform:i.value.start.transform,onPointerdown:n[2]||(n[2]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[3]||(n[3]=(...t)=>e.onClick&&e.onClick(...t)),stroke:e.strokeColor,style:o.normalizeStyle(a(i.value.start)),fill:i.value.start.filled?e.color:"none"},null,44,w)):o.createCommentVNode("",!0),i.value.end?(o.openBlock(),o.createElementBlock("path",{key:1,d:i.value.end.d,transform:i.value.end.transform,onPointerdown:n[4]||(n[4]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[5]||(n[5]=(...t)=>e.onClick&&e.onClick(...t)),stroke:e.strokeColor,style:o.normalizeStyle(a(i.value.end)),fill:i.value.end.filled?e.color:"none"},null,44,B)):o.createCommentVNode("",!0)],12,S)}}}),I=["width","height","viewBox"],P=["width","height"],R=["y1","x2","y2","stroke","stroke-width","stroke-dasharray"],A=["x","y","width","height","stroke","stroke-width","stroke-dasharray"],M=o.defineComponent({__name:"link",props:{isSelected:{type:Boolean},strokeColor:{default:"#0000FF"},strokeWidth:{default:2},strokeStyle:{default:r.PdfAnnotationBorderStyle.UNDERLINE},strokeDashArray:{},rect:{},scale:{},onClick:{},hasIRT:{type:Boolean,default:!1}},setup(e){const t=e,n=o.computed(()=>t.rect.size.width),l=o.computed(()=>t.rect.size.height),i=o.computed(()=>n.value*t.scale),a=o.computed(()=>l.value*t.scale),s=o.computed(()=>{var e;if(t.strokeStyle===r.PdfAnnotationBorderStyle.DASHED)return(null==(e=t.strokeDashArray)?void 0:e.join(","))??`${3*t.strokeWidth},${t.strokeWidth}`}),c=o.computed(()=>t.strokeStyle===r.PdfAnnotationBorderStyle.UNDERLINE),d=o.computed(()=>t.hasIRT?"default":t.isSelected?"move":"pointer"),u=o.computed(()=>t.hasIRT||t.isSelected?"none":"visible");return(t,r)=>(o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${i.value}px`,height:`${a.value}px`,pointerEvents:"none",zIndex:2}),width:i.value,height:a.value,viewBox:`0 0 ${n.value} ${l.value}`},[o.createElementVNode("rect",{x:0,y:0,width:n.value,height:l.value,fill:"transparent",onPointerdown:r[0]||(r[0]=t=>e.hasIRT?void 0:e.onClick),onTouchstart:r[1]||(r[1]=t=>e.hasIRT?void 0:e.onClick),style:o.normalizeStyle({cursor:d.value,pointerEvents:u.value})},null,44,P),c.value?(o.openBlock(),o.createElementBlock("line",{key:0,x1:1,y1:l.value-1,x2:n.value-1,y2:l.value-1,stroke:e.strokeColor,"stroke-width":e.strokeWidth,"stroke-dasharray":s.value,style:{"pointer-events":"none"}},null,8,R)):(o.openBlock(),o.createElementBlock("rect",{key:1,x:e.strokeWidth/2,y:e.strokeWidth/2,width:Math.max(n.value-e.strokeWidth,0),height:Math.max(l.value-e.strokeWidth,0),fill:"transparent",stroke:e.strokeColor,"stroke-width":e.strokeWidth,"stroke-dasharray":s.value,style:{"pointer-events":"none"}},null,8,A))],12,I))}}),E=["width","height","viewBox"],_=["d","opacity"],D=["d"],$=["x","y","width","height","fill","stroke","stroke-width"],j=o.defineComponent({__name:"polygon",props:{rect:{},vertices:{},color:{default:"transparent"},strokeColor:{default:"#000000"},opacity:{default:1},strokeWidth:{},strokeStyle:{default:r.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},scale:{},isSelected:{type:Boolean},onClick:{},currentVertex:{},handleSize:{default:14}},setup(e){const t=e,n=o.computed(()=>t.currentVertex?[...t.vertices,t.currentVertex]:t.vertices),l=o.computed(()=>n.value.map(({x:e,y:o})=>({x:e-t.rect.origin.x,y:o-t.rect.origin.y}))),i=o.computed(()=>{if(!l.value.length)return"";const[e,...o]=l.value,n=!!t.currentVertex;return(`M ${e.x} ${e.y} `+o.map(e=>`L ${e.x} ${e.y}`).join(" ")+(n?"":" Z")).trim()}),a=o.computed(()=>t.currentVertex&&t.vertices.length>0),s=o.computed(()=>t.rect.size.width*t.scale),c=o.computed(()=>t.rect.size.height*t.scale);return(t,n)=>{var d;return o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${s.value}px`,height:`${c.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:s.value,height:c.value,viewBox:`0 0 ${e.rect.size.width} ${e.rect.size.height}`},[o.createElementVNode("path",{d:i.value,onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t)),opacity:e.opacity,style:o.normalizeStyle({fill:e.currentVertex?"none":e.color,stroke:e.strokeColor??e.color,strokeWidth:e.strokeWidth,cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"transparent"===e.color?"visibleStroke":"visible",strokeLinecap:"butt",strokeLinejoin:"miter",...e.strokeStyle===o.unref(r.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(d=e.strokeDashArray)?void 0:d.join(",")}})},null,44,_),a.value&&l.value.length>1?(o.openBlock(),o.createElementBlock("path",{key:0,d:`M ${l.value[l.value.length-1].x} ${l.value[l.value.length-1].y} L ${l.value[0].x} ${l.value[0].y}`,fill:"none",style:o.normalizeStyle({stroke:e.strokeColor,strokeWidth:e.strokeWidth,strokeDasharray:"4,4",opacity:.7})},null,12,D)):o.createCommentVNode("",!0),a.value&&l.value.length>=2?(o.openBlock(),o.createElementBlock("rect",{key:1,x:l.value[0].x-e.handleSize/e.scale/2,y:l.value[0].y-e.handleSize/e.scale/2,width:e.handleSize/e.scale,height:e.handleSize/e.scale,fill:e.strokeColor,opacity:.4,stroke:e.strokeColor,"stroke-width":e.strokeWidth/2},null,8,$)):o.createCommentVNode("",!0)],12,E)}}}),N=["width","height","viewBox"],W=["d","opacity"],T=["d","transform","stroke","fill"],V=["d","transform","stroke","fill"],L=o.defineComponent({__name:"polyline",props:{rect:{},vertices:{},color:{default:"transparent"},strokeColor:{default:"#000000"},opacity:{default:1},strokeWidth:{},scale:{},isSelected:{type:Boolean},onClick:{},lineEndings:{}},setup(e){const n=e,l=o.computed(()=>n.vertices.map(({x:e,y:t})=>({x:e-n.rect.origin.x,y:t-n.rect.origin.y}))),r=o.computed(()=>{if(0===l.value.length)return"";const[e,...t]=l.value;return(`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y} `).join("")).trim()}),i=o.computed(()=>{var e,o;if(l.value.length<2)return{start:null,end:null};const r=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),i=r(l.value[0],l.value[1]),a=r(l.value[l.value.length-2],l.value[l.value.length-1]);return{start:t.patching.createEnding(null==(e=n.lineEndings)?void 0:e.start,n.strokeWidth,i+Math.PI,l.value[0].x,l.value[0].y),end:t.patching.createEnding(null==(o=n.lineEndings)?void 0:o.end,n.strokeWidth,a,l.value[l.value.length-1].x,l.value[l.value.length-1].y)}}),a=e=>({cursor:n.isSelected?"move":"pointer",strokeWidth:n.strokeWidth,pointerEvents:n.isSelected?"none":e.filled?"visible":"visibleStroke",strokeLinecap:"butt"}),s=o.computed(()=>n.rect.size.width*n.scale),c=o.computed(()=>n.rect.size.height*n.scale);return(t,n)=>(o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${s.value}px`,height:`${c.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:s.value,height:c.value,viewBox:`0 0 ${e.rect.size.width} ${e.rect.size.height}`},[o.createElementVNode("path",{d:r.value,onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t)),opacity:e.opacity,style:o.normalizeStyle({fill:"none",stroke:e.strokeColor??e.color,strokeWidth:e.strokeWidth,cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"visibleStroke",strokeLinecap:"butt",strokeLinejoin:"miter"})},null,44,W),i.value.start?(o.openBlock(),o.createElementBlock("path",{key:0,d:i.value.start.d,transform:i.value.start.transform,stroke:e.strokeColor,fill:i.value.start.filled?e.color:"none",onPointerdown:n[2]||(n[2]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[3]||(n[3]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle(a(i.value.start))},null,44,T)):o.createCommentVNode("",!0),i.value.end?(o.openBlock(),o.createElementBlock("path",{key:1,d:i.value.end.d,transform:i.value.end.transform,stroke:e.strokeColor,fill:i.value.end.filled?e.color:"none",onPointerdown:n[4]||(n[4]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[5]||(n[5]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle(a(i.value.end))},null,44,V)):o.createCommentVNode("",!0)],12,N))}}),F=["width","height","viewBox"],U=["x","y","width","height","fill","opacity"],O=o.defineComponent({__name:"square",props:{isSelected:{type:Boolean},color:{default:"#000000"},strokeColor:{},opacity:{default:1},strokeWidth:{},strokeStyle:{default:r.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>{const e=t.rect.size.width,o=t.rect.size.height;return{width:Math.max(e-t.strokeWidth,0),height:Math.max(o-t.strokeWidth,0),x:t.strokeWidth/2,y:t.strokeWidth/2}}),l=o.computed(()=>(n.value.width+t.strokeWidth)*t.scale),i=o.computed(()=>(n.value.height+t.strokeWidth)*t.scale);return(t,a)=>{var s;return o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:l.value,height:i.value,pointerEvents:"none",zIndex:2}),width:l.value,height:i.value,viewBox:`0 0 ${n.value.width+e.strokeWidth} ${n.value.height+e.strokeWidth}`},[o.createElementVNode("rect",{x:n.value.x,y:n.value.y,width:n.value.width,height:n.value.height,fill:e.color,opacity:e.opacity,onPointerdown:a[0]||(a[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:a[1]||(a[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"transparent"===e.color?"visibleStroke":"visible",stroke:e.strokeColor??e.color,strokeWidth:e.strokeWidth,...e.strokeStyle===o.unref(r.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(s=e.strokeDashArray)?void 0:s.join(",")}})},null,44,U)],12,F)}}}),H=["src"],q=o.defineComponent({__name:"render-annotation",props:{documentId:{},pageIndex:{},annotation:{},scaleFactor:{default:1},style:{}},setup(e){const t=e,{provides:l}=c(),i=o.ref(null),a=o.ref(null),s=o.ref(null),d=o.computed(()=>t.annotation.id),u=o.computed(()=>t.annotation.rect.size.width),p=o.computed(()=>t.annotation.rect.size.height);o.watch(()=>[t.pageIndex,t.scaleFactor,t.documentId,d.value,u.value,p.value,l.value],(e,o,c)=>{if(l.value){a.value&&(URL.revokeObjectURL(a.value),a.value=null);const e=l.value.forDocument(t.documentId).renderAnnotation({pageIndex:t.pageIndex,annotation:n.deepToRaw(t.annotation),options:{scaleFactor:t.scaleFactor,dpr:window.devicePixelRatio}});s.value=e,e.wait(e=>{const t=URL.createObjectURL(e);i.value=t,a.value=t},r.ignore),c(()=>{a.value?(URL.revokeObjectURL(a.value),a.value=null):e.abort({code:r.PdfErrorCode.Cancelled,message:"canceled render task"})})}},{immediate:!0}),o.onUnmounted(()=>{a.value&&(URL.revokeObjectURL(a.value),a.value=null),s.value&&s.value.abort({code:r.PdfErrorCode.Cancelled,message:"canceled render task on unmount"})});const v=()=>{a.value&&(URL.revokeObjectURL(a.value),a.value=null)};return(t,n)=>i.value?(o.openBlock(),o.createElementBlock("img",{key:0,src:i.value,onLoad:v,style:o.normalizeStyle({width:"100%",height:"100%",display:"block",...e.style})},null,44,H)):o.createCommentVNode("",!0)}}),G=o.defineComponent({__name:"stamp",props:{isSelected:{type:Boolean},annotation:{},documentId:{},pageIndex:{},scale:{},onClick:{type:Function}},setup:e=>(t,n)=>(o.openBlock(),o.createElementBlock("div",{style:o.normalizeStyle({position:"absolute",width:"100%",height:"100%",zIndex:2,pointerEvents:e.isSelected?"none":"auto",cursor:"pointer"}),onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t))},[o.createVNode(q,{documentId:e.documentId,pageIndex:e.pageIndex,annotation:{...e.annotation.object,id:e.annotation.object.id},scaleFactor:e.scale},null,8,["documentId","pageIndex","annotation","scaleFactor"])],36))}),K=o.defineComponent({__name:"highlight",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#FFFF00");return(t,l)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.segmentRects,(t,r)=>(o.openBlock(),o.createElementBlock("div",{key:r,onPointerdown:l[0]||(l[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:l[1]||(l[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({position:"absolute",left:(e.rect?t.origin.x-e.rect.origin.x:t.origin.x)*e.scale+"px",top:(e.rect?t.origin.y-e.rect.origin.y:t.origin.y)*e.scale+"px",width:t.size.width*e.scale+"px",height:t.size.height*e.scale+"px",background:n.value,opacity:e.opacity,pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:void 0})},null,36))),128))}}),Y=o.defineComponent({__name:"squiggly",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#FFFF00"),l=o.computed(()=>2*t.scale),r=o.computed(()=>6*t.scale),i=o.computed(()=>{const e=l.value,t=r.value,o=`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${2*e}" viewBox="0 0 ${t} ${2*e}">\n <path d="M0 ${e} Q ${t/4} 0 ${t/2} ${e} T ${t} ${e}"\n fill="none" stroke="${n.value}" stroke-width="${e}" stroke-linecap="round"/>\n </svg>`;return`url("data:image/svg+xml;utf8,${encodeURIComponent(o)}")`});return(t,n)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.segmentRects,(t,a)=>(o.openBlock(),o.createElementBlock("div",{key:a,onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({position:"absolute",left:(e.rect?t.origin.x-e.rect.origin.x:t.origin.x)*e.scale+"px",top:(e.rect?t.origin.y-e.rect.origin.y:t.origin.y)*e.scale+"px",width:t.size.width*e.scale+"px",height:t.size.height*e.scale+"px",background:"transparent",pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:0})},[o.createElementVNode("div",{style:o.normalizeStyle({position:"absolute",left:0,bottom:0,width:"100%",height:2*l.value+"px",backgroundImage:i.value,backgroundRepeat:"repeat-x",backgroundSize:`${r.value}px ${2*l.value}px`,opacity:e.opacity,pointerEvents:"none"})},null,4)],36))),128))}}),Q=o.defineComponent({__name:"strikeout",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#FFFF00"),l=o.computed(()=>2*t.scale);return(t,r)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.segmentRects,(t,i)=>(o.openBlock(),o.createElementBlock("div",{key:i,onPointerdown:r[0]||(r[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:r[1]||(r[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({position:"absolute",left:(e.rect?t.origin.x-e.rect.origin.x:t.origin.x)*e.scale+"px",top:(e.rect?t.origin.y-e.rect.origin.y:t.origin.y)*e.scale+"px",width:t.size.width*e.scale+"px",height:t.size.height*e.scale+"px",background:"transparent",pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:0})},[o.createElementVNode("div",{style:o.normalizeStyle({position:"absolute",left:0,top:"50%",width:"100%",height:`${l.value}px`,background:n.value,opacity:e.opacity,transform:"translateY(-50%)",pointerEvents:"none"})},null,4)],36))),128))}}),X=o.defineComponent({__name:"underline",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#FFFF00"),l=o.computed(()=>2*t.scale);return(t,r)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.segmentRects,(t,i)=>(o.openBlock(),o.createElementBlock("div",{key:i,onPointerdown:r[0]||(r[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:r[1]||(r[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({position:"absolute",left:(e.rect?t.origin.x-e.rect.origin.x:t.origin.x)*e.scale+"px",top:(e.rect?t.origin.y-e.rect.origin.y:t.origin.y)*e.scale+"px",width:t.size.width*e.scale+"px",height:t.size.height*e.scale+"px",background:"transparent",pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:0})},[o.createElementVNode("div",{style:o.normalizeStyle({position:"absolute",left:0,bottom:0,width:"100%",height:`${l.value}px`,background:n.value,opacity:e.opacity,pointerEvents:"none"})},null,4)],36))),128))}}),Z=o.defineComponent({__name:"annotations",props:{documentId:{},pageIndex:{},scale:{},rotation:{},pageWidth:{},pageHeight:{},resizeUI:{},vertexUI:{},selectionOutlineColor:{},selectionMenu:{type:Function},groupSelectionMenu:{type:Function},annotationRenderers:{}},setup(e){const n=e,l=e=>{var t;return null==(t=n.annotationRenderers)?void 0:t.find(t=>t.matches(e.object))},{provides:s}=c(),{provides:d}=a.useSelectionCapability(),p=o.ref([]),g=o.ref([]),{register:m}=i.usePointerHandlers({documentId:()=>n.documentId,pageIndex:n.pageIndex}),f=o.ref(null),y=o.computed(()=>s.value?s.value.forDocument(n.documentId):null),x=o.computed(()=>g.value.length>1);o.watchEffect(e=>{if(y.value){const o=y.value.getState();p.value=t.getAnnotationsByPageIndex(o,n.pageIndex),g.value=t.getSelectedAnnotationIds(o);e(y.value.onStateChange(e=>{p.value=t.getAnnotationsByPageIndex(e,n.pageIndex),g.value=t.getSelectedAnnotationIds(e)}))}});const S=(e,t)=>{t.target===t.currentTarget&&y.value&&(y.value.deselectAnnotation(),f.value=null)},b=(e,t)=>{if(e.stopPropagation(),y.value&&d.value){d.value.clear();"metaKey"in e&&(e.metaKey||e.ctrlKey)?y.value.toggleSelection(n.pageIndex,t.object.id):y.value.selectAnnotation(n.pageIndex,t.object.id),t.object.id!==f.value&&(f.value=null)}},w=(e,t)=>{if(e.stopPropagation(),y.value&&d.value){if(d.value.clear(),t.object.inReplyToId){const e=t.object.inReplyToId,o=p.value.find(t=>t.object.id===e);if(o)return void y.value.selectAnnotation(o.object.pageIndex,e)}y.value.selectAnnotation(n.pageIndex,t.object.id)}};o.watchEffect(e=>{if(y.value){const t=m({onPointerDown:S});t&&e(t)}});const B=e=>g.value.includes(e.object.id),I=o.computed(()=>p.value.filter(e=>g.value.includes(e.object.id))),P=o.computed(()=>!(I.value.length<2)&&I.value.every(e=>{var o;const n=null==(o=y.value)?void 0:o.findToolForAnnotation(e.object),l=t.resolveInteractionProp(null==n?void 0:n.interaction.isGroupDraggable,e.object,!0),r=t.resolveInteractionProp(null==n?void 0:n.interaction.isDraggable,e.object,!0);return void 0!==(null==n?void 0:n.interaction.isGroupDraggable)?l:r})),R=o.computed(()=>!(I.value.length<2)&&I.value.every(e=>{var o;const n=null==(o=y.value)?void 0:o.findToolForAnnotation(e.object),l=t.resolveInteractionProp(null==n?void 0:n.interaction.isGroupResizable,e.object,!0),r=t.resolveInteractionProp(null==n?void 0:n.interaction.isResizable,e.object,!0);return void 0!==(null==n?void 0:n.interaction.isGroupResizable)?l:r})),A=o.computed(()=>{if(!y.value)return!1;if(g.value.length<2)return!1;return y.value.getSelectedAnnotations().every(e=>e.object.pageIndex===n.pageIndex)}),E=e=>{var t;return null==(t=y.value)?void 0:t.findToolForAnnotation(e.object)},_=e=>{var o;return(!t.isFreeText(e)||f.value!==e.object.id)&&(!x.value&&t.resolveInteractionProp(null==(o=E(e))?void 0:o.interaction.isDraggable,e.object,!1))},D=e=>{var o;return!x.value&&t.resolveInteractionProp(null==(o=E(e))?void 0:o.interaction.isResizable,e.object,!1)},$=e=>{var o;return t.resolveInteractionProp(null==(o=E(e))?void 0:o.interaction.lockAspectRatio,e.object,!1)},N=e=>B(e)&&!x.value,W=o.computed(()=>{const{selectionMenu:e,groupSelectionMenu:t,...o}=n;return o}),T=e=>t.isLine(e)?{extractVertices:e=>[e.linePoints.start,e.linePoints.end],transformAnnotation:(e,t)=>({...e,linePoints:{start:t[0],end:t[1]}})}:t.isPolyline(e)||t.isPolygon(e)?{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})}:void 0;return(n,i)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(p.value,i=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:i.object.id},[l(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:0,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(l(i).component),{annotation:i,isSelected:B(i),scale:e.scale,pageIndex:e.pageIndex,onClick:e=>b(e,i)},null,8,["annotation","isSelected","scale","pageIndex","onClick"]))]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","selectionMenu","style"])):o.unref(t.isInk)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:1,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(C,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>b(e,i)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isSquare)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:2,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(O,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>b(e,i)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isCircle)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:3,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(k,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>b(e,i)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isLine)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:4,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(z,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>b(e,i)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isPolyline)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:5,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(L,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>b(e,i)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isPolygon)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:6,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(j,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>b(e,i)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isFreeText)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:7,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),onDoubleClick:e=>{return o=i.object.id,void(t.isFreeText(p.value.find(e=>e.object.id===o))&&(f.value=o));var o},vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(h,{isSelected:B(i),isEditing:f.value===i.object.id,annotation:{...i,object:t},pageIndex:e.pageIndex,scale:e.scale,onClick:e=>b(e,i)},null,8,["isSelected","isEditing","annotation","pageIndex","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","onDoubleClick","vertexConfig","selectionMenu","style"])):o.unref(t.isStamp)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:8,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(()=>[o.createVNode(G,{documentId:e.documentId,isSelected:B(i),annotation:i,pageIndex:e.pageIndex,scale:e.scale,onClick:e=>b(e,i)},null,8,["documentId","isSelected","annotation","pageIndex","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isUnderline)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:9,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,zIndex:0,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(X,o.mergeProps({ref_for:!0},t,{scale:e.scale,onClick:e=>b(e,i)}),null,16,["scale","onClick"])]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isStrikeout)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:10,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,zIndex:0,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(Q,o.mergeProps({ref_for:!0},t,{scale:e.scale,onClick:e=>b(e,i)}),null,16,["scale","onClick"])]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isSquiggly)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:11,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,zIndex:0,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(Y,o.mergeProps({ref_for:!0},t,{scale:e.scale,onClick:e=>b(e,i)}),null,16,["scale","onClick"])]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isHighlight)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:12,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,zIndex:0,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Multiply)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(K,o.mergeProps({ref_for:!0},t,{scale:e.scale,onClick:e=>b(e,i)}),null,16,["scale","onClick"])]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isLink)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:13,trackedAnnotation:i,isSelected:N(i),isMultiSelected:x.value,isDraggable:!1,isResizable:!1,lockAspectRatio:!1,onSelect:e=>w(e,i),selectionMenu:i.object.inReplyToId||x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(M,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>w(e,i),hasIRT:!!i.object.inReplyToId}),null,16,["isSelected","scale","onClick","hasIRT"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value||i.object.inReplyToId?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isMultiSelected","onSelect","selectionMenu","style"])):o.createCommentVNode("",!0)],64))),128)),A.value&&I.value.length>=2?(o.openBlock(),o.createBlock(v,{key:0,documentId:e.documentId,pageIndex:e.pageIndex,scale:e.scale,rotation:e.rotation,pageWidth:e.pageWidth,pageHeight:e.pageHeight,selectedAnnotations:I.value,isDraggable:P.value,isResizable:R.value,resizeUI:e.resizeUI,selectionOutlineColor:e.selectionOutlineColor,groupSelectionMenu:e.groupSelectionMenu},{"group-selection-menu":o.withCtx(e=>[o.renderSlot(n.$slots,"group-selection-menu",o.normalizeProps(o.guardReactiveProps(e)))]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.normalizeProps(o.guardReactiveProps(e)))]),_:3},8,["documentId","pageIndex","scale","rotation","pageWidth","pageHeight","selectedAnnotations","isDraggable","isResizable","resizeUI","selectionOutlineColor","groupSelectionMenu"])):o.createCommentVNode("",!0)],64))}}),J=o.defineComponent({__name:"text-markup",props:{documentId:{},pageIndex:{},scale:{}},setup(e){const t=e,{provides:n}=a.useSelectionCapability(),{provides:l}=c(),i=o.ref([]),s=o.ref(null),d=o.ref(null);o.watchEffect(e=>{const o=[];if(n.value){const e=n.value.forDocument(t.documentId),l=e.onSelectionChange(()=>{i.value=e.getHighlightRectsForPage(t.pageIndex),s.value=e.getBoundingRectForPage(t.pageIndex)});o.push(l)}if(l.value){const e=l.value.forDocument(t.documentId);d.value=e.getActiveTool();const n=e.onActiveToolChange(e=>d.value=e);o.push(n)}e(()=>{o.forEach(e=>e())})});const u=o.computed(()=>{if(!d.value)return r.blendModeToCss(r.PdfBlendMode.Normal);const e=d.value.defaults.type===r.PdfAnnotationSubtype.HIGHLIGHT?r.PdfBlendMode.Multiply:r.PdfBlendMode.Normal;return r.blendModeToCss(d.value.defaults.blendMode??e)});return(t,n)=>s.value&&d.value?(o.openBlock(),o.createElementBlock("div",{key:0,style:o.normalizeStyle({mixBlendMode:u.value,pointerEvents:"none",position:"absolute",inset:0})},[d.value.defaults.type===o.unref(r.PdfAnnotationSubtype).HIGHLIGHT?(o.openBlock(),o.createBlock(K,{key:0,strokeColor:d.value.defaults.strokeColor,opacity:d.value.defaults.opacity,segmentRects:i.value,scale:e.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):d.value.defaults.type===o.unref(r.PdfAnnotationSubtype).UNDERLINE?(o.openBlock(),o.createBlock(X,{key:1,strokeColor:d.value.defaults.strokeColor,opacity:d.value.defaults.opacity,segmentRects:i.value,scale:e.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):d.value.defaults.type===o.unref(r.PdfAnnotationSubtype).STRIKEOUT?(o.openBlock(),o.createBlock(Q,{key:2,strokeColor:d.value.defaults.strokeColor,opacity:d.value.defaults.opacity,segmentRects:i.value,scale:e.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):d.value.defaults.type===o.unref(r.PdfAnnotationSubtype).SQUIGGLY?(o.openBlock(),o.createBlock(Y,{key:3,strokeColor:d.value.defaults.strokeColor,opacity:d.value.defaults.opacity,segmentRects:i.value,scale:e.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):o.createCommentVNode("",!0)],4)):o.createCommentVNode("",!0)}}),ee=o.defineComponent({__name:"preview-renderer",props:{preview:{},scale:{}},setup(e){const t=e,n=o.computed(()=>({position:"absolute",left:t.preview.bounds.origin.x*t.scale+"px",top:t.preview.bounds.origin.y*t.scale+"px",width:t.preview.bounds.size.width*t.scale+"px",height:t.preview.bounds.size.height*t.scale+"px",pointerEvents:"none",zIndex:10}));return(t,l)=>(o.openBlock(),o.createElementBlock("div",{style:o.normalizeStyle(n.value)},[e.preview.type===o.unref(r.PdfAnnotationSubtype).CIRCLE?(o.openBlock(),o.createBlock(o.unref(k),o.mergeProps({key:0,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(r.PdfAnnotationSubtype).SQUARE?(o.openBlock(),o.createBlock(o.unref(O),o.mergeProps({key:1,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(r.PdfAnnotationSubtype).POLYGON?(o.openBlock(),o.createBlock(o.unref(j),o.mergeProps({key:2,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(r.PdfAnnotationSubtype).POLYLINE?(o.openBlock(),o.createBlock(o.unref(L),o.mergeProps({key:3,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(r.PdfAnnotationSubtype).LINE?(o.openBlock(),o.createBlock(o.unref(z),o.mergeProps({key:4,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(r.PdfAnnotationSubtype).INK?(o.openBlock(),o.createBlock(o.unref(C),o.mergeProps({key:5,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(r.PdfAnnotationSubtype).FREETEXT?(o.openBlock(),o.createElementBlock("div",{key:6,style:o.normalizeStyle({width:"100%",height:"100%",border:`1px dashed ${e.preview.data.fontColor||"#000000"}`,backgroundColor:"transparent"})},null,4)):o.createCommentVNode("",!0)],4))}}),te=o.defineComponent({__name:"annotation-paint-layer",props:{documentId:{},pageIndex:{},scale:{}},setup(e){const t=e,{plugin:n}=s(),l=o.ref(new Map),r=o.ref(null),i=o.ref(null),a=o.computed(()=>({requestFile:({accept:e,onFile:t})=>{const o=r.value;o&&(o.accept=e,o.onchange=e=>{var n;const l=null==(n=e.target.files)?void 0:n[0];l&&(t(l),o.value="")},o.click())},processImage:({source:e,maxWidth:t,maxHeight:o,onComplete:n})=>{const l=i.value;if(!l||!l.getContext)return;const r=l.getContext("2d");if(!r)return;const a=new Image;a.crossOrigin="Anonymous",a.onload=()=>{let{naturalWidth:i,naturalHeight:s}=a;const c=t?t/i:1,d=o?o/s:1,u=Math.min(c,d,1),p=i*u,v=s*u;l.width=p,l.height=v,r.drawImage(a,0,0,p,v);const g=r.getImageData(0,0,p,v);"string"!=typeof e&&URL.revokeObjectURL(a.src),n({imageData:g,width:p,height:v})},a.src="string"==typeof e?e:URL.createObjectURL(e)}}));let c;return o.watchEffect(e=>{n.value&&(c=n.value.registerPageHandlers(t.documentId,t.pageIndex,t.scale,{services:a.value,onPreview:(e,t)=>{const o=new Map(l.value);t?o.set(e,t):o.delete(e),l.value=o}})),e(()=>{null==c||c()})}),(t,n)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("input",{ref_key:"fileInputRef",ref:r,type:"file",style:{display:"none"}},null,512),o.createElementVNode("canvas",{ref_key:"canvasRef",ref:i,style:{display:"none"}},null,512),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value.entries(),([t,n])=>(o.openBlock(),o.createBlock(ee,{key:t,preview:n,scale:e.scale},null,8,["preview","scale"]))),128))],64))}}),oe=Symbol("AnnotationRendererRegistry");function ne(){const e=o.shallowRef([]);return{register(t){const o=new Set(t.map(e=>e.id));return e.value=[...e.value.filter(e=>!o.has(e.id)),...t],()=>{e.value=e.value.filter(e=>!t.some(t=>t.id===e.id))}},getAll:()=>e.value}}function le(){const e=ne();return o.provide(oe,e),e}function re(){return o.inject(oe,null)}const ie=o.defineComponent({__name:"annotation-layer",props:{documentId:{},pageIndex:{},scale:{},rotation:{},resizeUI:{},vertexUI:{},selectionOutlineColor:{},selectionMenu:{type:Function},groupSelectionMenu:{type:Function},annotationRenderers:{}},setup(e){const t=e,n=re(),i=o.computed(()=>{const e=(null==n?void 0:n.getAll())??[],o=t.annotationRenderers??[],l=[...e];for(const t of o){const e=l.findIndex(e=>e.id===t.id);e>=0?l[e]=t:l.push(t)}return l}),a=l.useDocumentState(()=>t.documentId),s=o.computed(()=>{var e,o,n;return null==(n=null==(o=null==(e=a.value)?void 0:e.document)?void 0:o.pages)?void 0:n[t.pageIndex]}),c=o.computed(()=>{var e,t;return(null==(t=null==(e=s.value)?void 0:e.size)?void 0:t.width)??0}),d=o.computed(()=>{var e,t;return(null==(t=null==(e=s.value)?void 0:e.size)?void 0:t.height)??0}),u=o.computed(()=>{var e;return void 0!==t.scale?t.scale:(null==(e=a.value)?void 0:e.scale)??1}),p=o.computed(()=>{var e;return void 0!==t.rotation?t.rotation:(null==(e=a.value)?void 0:e.rotation)??r.Rotation.Degree0});return(t,n)=>(o.openBlock(),o.createElementBlock("div",null,[o.createVNode(Z,{documentId:e.documentId,pageIndex:e.pageIndex,scale:u.value,rotation:p.value,pageWidth:c.value,pageHeight:d.value,resizeUI:e.resizeUI,vertexUI:e.vertexUI,selectionOutlineColor:e.selectionOutlineColor,selectionMenu:e.selectionMenu,groupSelectionMenu:e.groupSelectionMenu,annotationRenderers:i.value},{"selection-menu":o.withCtx(e=>[o.renderSlot(t.$slots,"selection-menu",o.normalizeProps(o.guardReactiveProps(e)))]),"group-selection-menu":o.withCtx(e=>[o.renderSlot(t.$slots,"group-selection-menu",o.normalizeProps(o.guardReactiveProps(e)))]),"resize-handle":o.withCtx(e=>[o.renderSlot(t.$slots,"resize-handle",o.normalizeProps(o.guardReactiveProps(e)))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(t.$slots,"vertex-handle",o.normalizeProps(o.guardReactiveProps(e)))]),_:3},8,["documentId","pageIndex","scale","rotation","pageWidth","pageHeight","resizeUI","vertexUI","selectionOutlineColor","selectionMenu","groupSelectionMenu","annotationRenderers"]),o.createVNode(J,{documentId:e.documentId,pageIndex:e.pageIndex,scale:u.value},null,8,["documentId","pageIndex","scale"]),o.createVNode(te,{documentId:e.documentId,pageIndex:e.pageIndex,scale:u.value},null,8,["documentId","pageIndex","scale"])]))}}),ae=o.defineComponent({__name:"renderer-registry-provider",setup:e=>(le(),(e,t)=>o.renderSlot(e.$slots,"default"))}),se=e.createPluginPackage(t.AnnotationPluginPackage).addWrapper(ae).build();exports.AnnotationContainer=u,exports.AnnotationLayer=ie,exports.AnnotationPaintLayer=te,exports.AnnotationPluginPackage=se,exports.Annotations=Z,exports.Circle=k,exports.FreeText=h,exports.GroupSelectionBox=v,exports.Highlight=K,exports.Ink=C,exports.Line=z,exports.Link=M,exports.Polygon=j,exports.Polyline=L,exports.PreviewRenderer=ee,exports.RenderAnnotation=q,exports.RendererRegistryProvider=ae,exports.Square=O,exports.Squiggly=Y,exports.Stamp=G,exports.Strikeout=Q,exports.TextMarkup=J,exports.Underline=X,exports.createRenderer=function(e){return{id:e.id,matches:e.matches,component:o.markRaw(e.component)}},exports.createRendererRegistry=ne,exports.provideRendererRegistry=le,exports.useAnnotation=e=>{var n,l;const{provides:r}=c(),i=o.ref((null==(l=null==(n=null==r?void 0:r.value)?void 0:n.forDocument(o.toValue(e)))?void 0:l.getState())??t.initialDocumentState());return o.watch([r,()=>o.toValue(e)],([e,t],o,n)=>{if(e&&t){const o=e.forDocument(t);i.value=o.getState();n(o.onStateChange(e=>{i.value=e}))}},{immediate:!0}),{state:i,provides:o.computed(()=>{var t;return(null==(t=r.value)?void 0:t.forDocument(o.toValue(e)))??null})}},exports.useAnnotationCapability=c,exports.useAnnotationPlugin=s,exports.useRegisterRenderers=function(e){const t=re();if(!t)return;const n=t.register(e);o.onUnmounted(n)},exports.useRendererRegistry=re,Object.keys(t).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
2
2
  //# sourceMappingURL=index.cjs.map