@embedpdf/plugin-annotation 1.3.11 → 1.3.13

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 (54) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/index.d.ts +1 -0
  6. package/dist/preact/index.cjs +1 -1
  7. package/dist/preact/index.cjs.map +1 -1
  8. package/dist/preact/index.js +21 -5
  9. package/dist/preact/index.js.map +1 -1
  10. package/dist/react/index.cjs +1 -1
  11. package/dist/react/index.cjs.map +1 -1
  12. package/dist/react/index.js +21 -5
  13. package/dist/react/index.js.map +1 -1
  14. package/dist/shared-preact/components/annotation-container.d.ts +2 -1
  15. package/dist/shared-preact/components/annotation-layer.d.ts +1 -1
  16. package/dist/shared-preact/components/annotations.d.ts +1 -1
  17. package/dist/shared-preact/components/types.d.ts +51 -0
  18. package/dist/shared-preact/hooks/use-annotation.d.ts +5 -1
  19. package/dist/shared-preact/types.d.ts +1 -50
  20. package/dist/shared-react/components/annotation-container.d.ts +2 -1
  21. package/dist/shared-react/components/annotation-layer.d.ts +1 -1
  22. package/dist/shared-react/components/annotations.d.ts +1 -1
  23. package/dist/shared-react/components/types.d.ts +51 -0
  24. package/dist/shared-react/hooks/use-annotation.d.ts +5 -1
  25. package/dist/shared-react/types.d.ts +1 -50
  26. package/dist/vue/components/annotation-container.vue.d.ts +48 -0
  27. package/dist/vue/components/annotation-layer.vue.d.ts +27 -0
  28. package/dist/vue/components/annotation-paint-layer.vue.d.ts +6 -0
  29. package/dist/vue/components/annotations/circle.vue.d.ts +19 -0
  30. package/dist/vue/components/annotations/free-text.vue.d.ts +12 -0
  31. package/dist/vue/components/annotations/index.d.ts +8 -0
  32. package/dist/vue/components/annotations/ink.vue.d.ts +16 -0
  33. package/dist/vue/components/annotations/line.vue.d.ts +22 -0
  34. package/dist/vue/components/annotations/polygon.vue.d.ts +24 -0
  35. package/dist/vue/components/annotations/polyline.vue.d.ts +19 -0
  36. package/dist/vue/components/annotations/square.vue.d.ts +19 -0
  37. package/dist/vue/components/annotations/stamp.vue.d.ts +11 -0
  38. package/dist/vue/components/annotations.vue.d.ts +77 -0
  39. package/dist/vue/components/index.d.ts +9 -0
  40. package/dist/vue/components/preview-renderer.vue.d.ts +7 -0
  41. package/dist/vue/components/render-annotation.vue.d.ts +12 -0
  42. package/dist/vue/components/text-markup/highlight.vue.d.ts +14 -0
  43. package/dist/vue/components/text-markup/index.d.ts +4 -0
  44. package/dist/vue/components/text-markup/squiggly.vue.d.ts +14 -0
  45. package/dist/vue/components/text-markup/strikeout.vue.d.ts +14 -0
  46. package/dist/vue/components/text-markup/underline.vue.d.ts +14 -0
  47. package/dist/vue/components/text-markup.vue.d.ts +6 -0
  48. package/dist/vue/hooks/use-annotation.d.ts +2682 -0
  49. package/dist/vue/index.cjs +1 -1
  50. package/dist/vue/index.cjs.map +1 -1
  51. package/dist/vue/index.d.ts +1 -0
  52. package/dist/vue/index.js +1921 -1
  53. package/dist/vue/index.js.map +1 -1
  54. package/package.json +10 -10
package/dist/vue/index.js CHANGED
@@ -1,9 +1,1929 @@
1
+ import { ref, watchEffect, readonly, defineComponent, shallowRef, toRaw, computed, watch, useSlots, createElementBlock, openBlock, createElementVNode, createVNode, mergeProps, unref, renderSlot, createCommentVNode, Fragment, renderList, withCtx, normalizeStyle, onMounted, toDisplayString, onUnmounted, createBlock, normalizeProps, guardReactiveProps } from "vue";
1
2
  import { usePlugin, useCapability } from "@embedpdf/core/vue";
2
- import { AnnotationPlugin } from "@embedpdf/plugin-annotation";
3
+ import { AnnotationPlugin, initialState, patching, getAnnotationsByPageIndex, getSelectedAnnotationByPageIndex, isInk, isSquare, isCircle, isLine, isPolyline, isPolygon, isFreeText, isStamp, isUnderline, isStrikeout, isSquiggly, isHighlight } from "@embedpdf/plugin-annotation";
3
4
  export * from "@embedpdf/plugin-annotation";
5
+ import { useInteractionHandles, useDoublePressProps, CounterRotate, deepToRaw } from "@embedpdf/utils/vue";
6
+ import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/vue";
7
+ import { useSelectionCapability } from "@embedpdf/plugin-selection/vue";
8
+ import { PdfAnnotationBorderStyle, textAlignmentToCss, standardFontCss, PdfVerticalAlignment, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype } from "@embedpdf/models";
4
9
  const useAnnotationPlugin = () => usePlugin(AnnotationPlugin.id);
5
10
  const useAnnotationCapability = () => useCapability(AnnotationPlugin.id);
11
+ const useAnnotation = () => {
12
+ const { provides } = useAnnotationCapability();
13
+ const dummyConfig = { enabled: true };
14
+ const state = ref(initialState(dummyConfig));
15
+ watchEffect((onCleanup) => {
16
+ if (provides.value) {
17
+ const unsubscribe = provides.value.onStateChange((newState) => {
18
+ state.value = newState;
19
+ });
20
+ onCleanup(unsubscribe);
21
+ }
22
+ });
23
+ return {
24
+ state: readonly(state),
25
+ provides
26
+ };
27
+ };
28
+ const _hoisted_1$8 = { "data-no-interaction": "" };
29
+ const HANDLE_COLOR = "#007ACC";
30
+ const VERTEX_COLOR = "#007ACC";
31
+ const HANDLE_SIZE = 12;
32
+ const VERTEX_SIZE = 12;
33
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
34
+ __name: "annotation-container",
35
+ props: {
36
+ scale: {},
37
+ pageIndex: {},
38
+ rotation: {},
39
+ pageWidth: {},
40
+ pageHeight: {},
41
+ trackedAnnotation: {},
42
+ isSelected: { type: Boolean },
43
+ isDraggable: { type: Boolean },
44
+ isResizable: { type: Boolean },
45
+ lockAspectRatio: { type: Boolean, default: false },
46
+ vertexConfig: {},
47
+ outlineOffset: { default: 1 },
48
+ onDoubleClick: {},
49
+ onSelect: {},
50
+ zIndex: { default: 1 },
51
+ selectionOutlineColor: { default: "#007ACC" }
52
+ },
53
+ setup(__props) {
54
+ const props = __props;
55
+ const preview = shallowRef(toRaw(props.trackedAnnotation.object));
56
+ const { provides: annotationProvides } = useAnnotationCapability();
57
+ const gestureBaseRef = ref(null);
58
+ const currentObject = computed(
59
+ () => ({ ...toRaw(props.trackedAnnotation.object), ...toRaw(preview.value) })
60
+ );
61
+ const elementSnapshot = computed(() => {
62
+ const obj = toRaw(currentObject.value);
63
+ return obj.rect;
64
+ });
65
+ const verticesSnapshot = computed(() => {
66
+ var _a;
67
+ const obj = toRaw(currentObject.value);
68
+ return ((_a = props.vertexConfig) == null ? void 0 : _a.extractVertices(obj)) ?? [];
69
+ });
70
+ const constraintsSnapshot = computed(() => ({
71
+ minWidth: 10,
72
+ minHeight: 10,
73
+ boundingBox: {
74
+ width: props.pageWidth / props.scale,
75
+ height: props.pageHeight / props.scale
76
+ }
77
+ }));
78
+ const { dragProps, vertices, resize } = useInteractionHandles({
79
+ controller: {
80
+ element: elementSnapshot,
81
+ vertices: verticesSnapshot,
82
+ constraints: constraintsSnapshot,
83
+ maintainAspectRatio: computed(() => props.lockAspectRatio),
84
+ pageRotation: computed(() => props.rotation),
85
+ scale: computed(() => props.scale),
86
+ enabled: computed(() => props.isSelected),
87
+ onUpdate: (event) => {
88
+ var _a, _b, _c, _d;
89
+ if (!((_a = event.transformData) == null ? void 0 : _a.type)) return;
90
+ if (event.state === "start") {
91
+ gestureBaseRef.value = currentObject.value;
92
+ }
93
+ const base = gestureBaseRef.value ?? currentObject.value;
94
+ const changes = event.transformData.changes.vertices ? (_b = props.vertexConfig) == null ? void 0 : _b.transformAnnotation(toRaw(base), event.transformData.changes.vertices) : { rect: event.transformData.changes.rect };
95
+ const patched = (_c = annotationProvides.value) == null ? void 0 : _c.transformAnnotation(base, {
96
+ type: event.transformData.type,
97
+ changes,
98
+ metadata: event.transformData.metadata
99
+ });
100
+ if (patched) {
101
+ preview.value = { ...toRaw(preview.value), ...patched };
102
+ }
103
+ if (event.state === "end" && patched) {
104
+ gestureBaseRef.value = null;
105
+ (_d = annotationProvides.value) == null ? void 0 : _d.updateAnnotation(
106
+ props.pageIndex,
107
+ props.trackedAnnotation.object.id,
108
+ patched
109
+ );
110
+ }
111
+ }
112
+ },
113
+ resizeUI: {
114
+ handleSize: HANDLE_SIZE,
115
+ spacing: props.outlineOffset,
116
+ offsetMode: "outside",
117
+ includeSides: !props.lockAspectRatio,
118
+ zIndex: props.zIndex + 1
119
+ },
120
+ vertexUI: {
121
+ vertexSize: VERTEX_SIZE,
122
+ zIndex: props.zIndex + 2
123
+ },
124
+ includeVertices: !!props.vertexConfig
125
+ });
126
+ const doubleProps = useDoublePressProps(props.onDoubleClick);
127
+ watch(
128
+ () => props.trackedAnnotation.object,
129
+ (newObject) => {
130
+ preview.value = newObject;
131
+ },
132
+ { deep: true }
133
+ );
134
+ const containerStyle = computed(() => ({
135
+ position: "absolute",
136
+ left: `${currentObject.value.rect.origin.x * props.scale}px`,
137
+ top: `${currentObject.value.rect.origin.y * props.scale}px`,
138
+ width: `${currentObject.value.rect.size.width * props.scale}px`,
139
+ height: `${currentObject.value.rect.size.height * props.scale}px`,
140
+ outline: props.isSelected ? `1px solid ${props.selectionOutlineColor}` : "none",
141
+ outlineOffset: props.isSelected ? `${props.outlineOffset}px` : "0px",
142
+ pointerEvents: props.isSelected ? "auto" : "none",
143
+ touchAction: "none",
144
+ cursor: props.isSelected && props.isDraggable ? "move" : "default",
145
+ zIndex: props.zIndex
146
+ }));
147
+ const slots = useSlots();
148
+ return (_ctx, _cache) => {
149
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
150
+ createElementVNode("div", mergeProps({ ...unref(dragProps), ...unref(doubleProps) }, { style: containerStyle.value }), [
151
+ renderSlot(_ctx.$slots, "default", { annotation: currentObject.value }),
152
+ _ctx.isSelected && _ctx.isResizable ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(resize), ({ key, style, ...handle }) => {
153
+ return openBlock(), createElementBlock(Fragment, { key }, [
154
+ unref(slots)["resize-handle"] ? renderSlot(_ctx.$slots, "resize-handle", mergeProps({
155
+ key: 0,
156
+ ref_for: true
157
+ }, { key, style, ...handle, backgroundColor: HANDLE_COLOR }), () => [
158
+ createElementVNode("div", mergeProps({ ref_for: true }, handle, {
159
+ style: [style, { backgroundColor: HANDLE_COLOR }]
160
+ }), null, 16)
161
+ ]) : (openBlock(), createElementBlock("div", mergeProps({
162
+ key: 1,
163
+ ref_for: true
164
+ }, handle, {
165
+ style: [style, { backgroundColor: HANDLE_COLOR }]
166
+ }), null, 16))
167
+ ], 64);
168
+ }), 128)) : createCommentVNode("", true),
169
+ _ctx.isSelected && unref(vertices).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(vertices), ({ key, style, ...vertex }) => {
170
+ return openBlock(), createElementBlock(Fragment, { key }, [
171
+ unref(slots)["vertex-handle"] ? renderSlot(_ctx.$slots, "vertex-handle", mergeProps({
172
+ key: 0,
173
+ ref_for: true
174
+ }, { key, style, ...vertex, backgroundColor: VERTEX_COLOR }), () => [
175
+ createElementVNode("div", mergeProps({ ref_for: true }, vertex, {
176
+ style: [style, { backgroundColor: VERTEX_COLOR }]
177
+ }), null, 16)
178
+ ]) : (openBlock(), createElementBlock("div", mergeProps({
179
+ key: 1,
180
+ ref_for: true
181
+ }, vertex, {
182
+ style: [style, { backgroundColor: VERTEX_COLOR }]
183
+ }), null, 16))
184
+ ], 64);
185
+ }), 128)) : createCommentVNode("", true)
186
+ ], 16),
187
+ createVNode(unref(CounterRotate), {
188
+ rect: {
189
+ origin: {
190
+ x: currentObject.value.rect.origin.x * _ctx.scale,
191
+ y: currentObject.value.rect.origin.y * _ctx.scale
192
+ },
193
+ size: {
194
+ width: currentObject.value.rect.size.width * _ctx.scale,
195
+ height: currentObject.value.rect.size.height * _ctx.scale
196
+ }
197
+ },
198
+ rotation: _ctx.rotation
199
+ }, {
200
+ default: withCtx(({ rect, menuWrapperProps }) => [
201
+ renderSlot(_ctx.$slots, "selection-menu", {
202
+ annotation: _ctx.trackedAnnotation,
203
+ selected: _ctx.isSelected,
204
+ rect,
205
+ menuWrapperProps
206
+ })
207
+ ]),
208
+ _: 3
209
+ }, 8, ["rect", "rotation"])
210
+ ]);
211
+ };
212
+ }
213
+ });
214
+ const _hoisted_1$7 = ["width", "height", "viewBox"];
215
+ const _hoisted_2$5 = ["cx", "cy", "rx", "ry", "fill", "opacity"];
216
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
217
+ __name: "circle",
218
+ props: {
219
+ isSelected: { type: Boolean },
220
+ color: { default: "#000000" },
221
+ strokeColor: {},
222
+ opacity: { default: 1 },
223
+ strokeWidth: {},
224
+ strokeStyle: { default: PdfAnnotationBorderStyle.SOLID },
225
+ strokeDashArray: {},
226
+ rect: {},
227
+ scale: {},
228
+ onClick: {}
229
+ },
230
+ setup(__props) {
231
+ const props = __props;
232
+ const geometry = computed(() => {
233
+ const outerW = props.rect.size.width;
234
+ const outerH = props.rect.size.height;
235
+ const innerW = Math.max(outerW - props.strokeWidth, 0);
236
+ const innerH = Math.max(outerH - props.strokeWidth, 0);
237
+ return {
238
+ width: outerW,
239
+ height: outerH,
240
+ cx: props.strokeWidth / 2 + innerW / 2,
241
+ cy: props.strokeWidth / 2 + innerH / 2,
242
+ rx: innerW / 2,
243
+ ry: innerH / 2
244
+ };
245
+ });
246
+ const svgWidth = computed(() => geometry.value.width * props.scale);
247
+ const svgHeight = computed(() => geometry.value.height * props.scale);
248
+ return (_ctx, _cache) => {
249
+ var _a;
250
+ return openBlock(), createElementBlock("svg", {
251
+ style: normalizeStyle({
252
+ position: "absolute",
253
+ width: svgWidth.value,
254
+ height: svgHeight.value,
255
+ pointerEvents: "none",
256
+ zIndex: 2
257
+ }),
258
+ width: svgWidth.value,
259
+ height: svgHeight.value,
260
+ viewBox: `0 0 ${geometry.value.width} ${geometry.value.height}`
261
+ }, [
262
+ createElementVNode("ellipse", {
263
+ cx: geometry.value.cx,
264
+ cy: geometry.value.cy,
265
+ rx: geometry.value.rx,
266
+ ry: geometry.value.ry,
267
+ fill: _ctx.color,
268
+ opacity: _ctx.opacity,
269
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
270
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
271
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
272
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
273
+ style: normalizeStyle({
274
+ cursor: _ctx.isSelected ? "move" : "pointer",
275
+ pointerEvents: _ctx.isSelected ? "none" : _ctx.color === "transparent" ? "visibleStroke" : "visible",
276
+ stroke: _ctx.strokeColor ?? _ctx.color,
277
+ strokeWidth: _ctx.strokeWidth,
278
+ ..._ctx.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
279
+ strokeDasharray: (_a = _ctx.strokeDashArray) == null ? void 0 : _a.join(",")
280
+ }
281
+ })
282
+ }, null, 44, _hoisted_2$5)
283
+ ], 12, _hoisted_1$7);
284
+ };
285
+ }
286
+ });
287
+ const _hoisted_1$6 = ["contenteditable"];
288
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
289
+ __name: "free-text",
290
+ props: {
291
+ isSelected: { type: Boolean },
292
+ isEditing: { type: Boolean },
293
+ annotation: {},
294
+ pageIndex: {},
295
+ scale: {},
296
+ onClick: { type: Function }
297
+ },
298
+ setup(__props) {
299
+ const props = __props;
300
+ const editorRef = ref(null);
301
+ const { provides: annotationProvides } = useAnnotationCapability();
302
+ const isIOS = ref(false);
303
+ onMounted(() => {
304
+ try {
305
+ const nav = navigator;
306
+ isIOS.value = /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && (nav == null ? void 0 : nav.maxTouchPoints) > 1;
307
+ } catch {
308
+ isIOS.value = false;
309
+ }
310
+ });
311
+ watch(
312
+ () => props.isEditing,
313
+ (editing) => {
314
+ if (editing && editorRef.value) {
315
+ const editor = editorRef.value;
316
+ editor.focus();
317
+ const selection = window.getSelection();
318
+ if (selection) {
319
+ const range = document.createRange();
320
+ range.selectNodeContents(editor);
321
+ range.collapse(false);
322
+ selection.removeAllRanges();
323
+ selection.addRange(range);
324
+ }
325
+ }
326
+ }
327
+ );
328
+ const handleBlur = () => {
329
+ if (!annotationProvides.value || !editorRef.value) return;
330
+ annotationProvides.value.updateAnnotation(props.pageIndex, props.annotation.object.id, {
331
+ contents: editorRef.value.innerText
332
+ });
333
+ };
334
+ const editorStyle = computed(() => {
335
+ const { object: anno } = props.annotation;
336
+ const computedFontPx = anno.fontSize * props.scale;
337
+ const MIN_IOS_FOCUS_FONT_PX = 16;
338
+ const needsComp = isIOS.value && props.isEditing && computedFontPx > 0 && computedFontPx < MIN_IOS_FOCUS_FONT_PX;
339
+ const adjustedFontPx = needsComp ? MIN_IOS_FOCUS_FONT_PX : computedFontPx;
340
+ const scaleComp = needsComp ? computedFontPx / MIN_IOS_FOCUS_FONT_PX : 1;
341
+ const invScalePercent = needsComp ? 100 / scaleComp : 100;
342
+ return {
343
+ color: anno.fontColor,
344
+ fontSize: `${adjustedFontPx}px`,
345
+ fontFamily: standardFontCss(anno.fontFamily),
346
+ textAlign: textAlignmentToCss(anno.textAlign),
347
+ flexDirection: "column",
348
+ justifyContent: anno.verticalAlign === PdfVerticalAlignment.Top ? "flex-start" : anno.verticalAlign === PdfVerticalAlignment.Middle ? "center" : "flex-end",
349
+ display: "flex",
350
+ backgroundColor: anno.backgroundColor,
351
+ opacity: anno.opacity,
352
+ width: needsComp ? `${invScalePercent}%` : "100%",
353
+ height: needsComp ? `${invScalePercent}%` : "100%",
354
+ lineHeight: "1.18",
355
+ overflow: "hidden",
356
+ cursor: props.isEditing ? "text" : "pointer",
357
+ outline: "none",
358
+ transform: needsComp ? `scale(${scaleComp})` : void 0,
359
+ transformOrigin: "top left"
360
+ };
361
+ });
362
+ return (_ctx, _cache) => {
363
+ return openBlock(), createElementBlock("div", {
364
+ style: normalizeStyle({
365
+ position: "absolute",
366
+ width: `${_ctx.annotation.object.rect.size.width * _ctx.scale}px`,
367
+ height: `${_ctx.annotation.object.rect.size.height * _ctx.scale}px`,
368
+ cursor: _ctx.isSelected && !_ctx.isEditing ? "move" : "default",
369
+ pointerEvents: _ctx.isSelected && !_ctx.isEditing ? "none" : "auto",
370
+ zIndex: 2
371
+ }),
372
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
373
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
374
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
375
+ (...args) => _ctx.onClick && _ctx.onClick(...args))
376
+ }, [
377
+ createElementVNode("span", {
378
+ ref_key: "editorRef",
379
+ ref: editorRef,
380
+ onBlur: handleBlur,
381
+ tabindex: "0",
382
+ style: normalizeStyle(editorStyle.value),
383
+ contenteditable: _ctx.isEditing
384
+ }, toDisplayString(_ctx.annotation.object.contents), 45, _hoisted_1$6)
385
+ ], 36);
386
+ };
387
+ }
388
+ });
389
+ const _hoisted_1$5 = ["width", "height", "viewBox"];
390
+ const _hoisted_2$4 = ["d", "opacity"];
391
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
392
+ __name: "ink",
393
+ props: {
394
+ isSelected: { type: Boolean },
395
+ color: { default: "#000000" },
396
+ opacity: { default: 1 },
397
+ strokeWidth: {},
398
+ inkList: {},
399
+ rect: {},
400
+ scale: {},
401
+ onClick: {}
402
+ },
403
+ setup(__props) {
404
+ const props = __props;
405
+ const paths = computed(() => {
406
+ return props.inkList.map(({ points }) => {
407
+ let d = "";
408
+ points.forEach(({ x, y }, i) => {
409
+ const lx = x - props.rect.origin.x;
410
+ const ly = y - props.rect.origin.y;
411
+ d += (i === 0 ? "M" : "L") + `${lx} ${ly} `;
412
+ });
413
+ return d.trim();
414
+ });
415
+ });
416
+ const width = computed(() => props.rect.size.width * props.scale);
417
+ const height = computed(() => props.rect.size.height * props.scale);
418
+ return (_ctx, _cache) => {
419
+ return openBlock(), createElementBlock("svg", {
420
+ style: normalizeStyle({
421
+ position: "absolute",
422
+ width: `${width.value}px`,
423
+ height: `${height.value}px`,
424
+ pointerEvents: "none",
425
+ zIndex: 2,
426
+ overflow: "visible"
427
+ }),
428
+ width: width.value,
429
+ height: height.value,
430
+ viewBox: `0 0 ${_ctx.rect.size.width} ${_ctx.rect.size.height}`
431
+ }, [
432
+ (openBlock(true), createElementBlock(Fragment, null, renderList(paths.value, (d, i) => {
433
+ return openBlock(), createElementBlock("path", {
434
+ key: i,
435
+ d,
436
+ fill: "none",
437
+ opacity: _ctx.opacity,
438
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
439
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
440
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
441
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
442
+ style: normalizeStyle({
443
+ cursor: _ctx.isSelected ? "move" : "pointer",
444
+ pointerEvents: _ctx.isSelected ? "none" : "visibleStroke",
445
+ stroke: _ctx.color,
446
+ strokeWidth: _ctx.strokeWidth,
447
+ strokeLinecap: "round",
448
+ strokeLinejoin: "round"
449
+ })
450
+ }, null, 44, _hoisted_2$4);
451
+ }), 128))
452
+ ], 12, _hoisted_1$5);
453
+ };
454
+ }
455
+ });
456
+ const _hoisted_1$4 = ["width", "height", "viewBox"];
457
+ const _hoisted_2$3 = ["x1", "y1", "x2", "y2", "opacity"];
458
+ const _hoisted_3$2 = ["d", "transform", "stroke", "fill"];
459
+ const _hoisted_4$2 = ["d", "transform", "stroke", "fill"];
460
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
461
+ __name: "line",
462
+ props: {
463
+ color: { default: "transparent" },
464
+ opacity: { default: 1 },
465
+ strokeWidth: {},
466
+ strokeColor: { default: "#000000" },
467
+ strokeStyle: { default: PdfAnnotationBorderStyle.SOLID },
468
+ strokeDashArray: {},
469
+ rect: {},
470
+ linePoints: {},
471
+ lineEndings: {},
472
+ scale: {},
473
+ onClick: {},
474
+ isSelected: { type: Boolean }
475
+ },
476
+ setup(__props) {
477
+ const props = __props;
478
+ const localLine = computed(() => ({
479
+ x1: props.linePoints.start.x - props.rect.origin.x,
480
+ y1: props.linePoints.start.y - props.rect.origin.y,
481
+ x2: props.linePoints.end.x - props.rect.origin.x,
482
+ y2: props.linePoints.end.y - props.rect.origin.y
483
+ }));
484
+ const endings = computed(() => {
485
+ var _a, _b;
486
+ const { x1, y1, x2, y2 } = localLine.value;
487
+ const angle = Math.atan2(y2 - y1, x2 - x1);
488
+ return {
489
+ start: patching.createEnding(
490
+ (_a = props.lineEndings) == null ? void 0 : _a.start,
491
+ props.strokeWidth,
492
+ angle + Math.PI,
493
+ x1,
494
+ y1
495
+ ),
496
+ end: patching.createEnding((_b = props.lineEndings) == null ? void 0 : _b.end, props.strokeWidth, angle, x2, y2)
497
+ };
498
+ });
499
+ const getEndingStyle = (ending) => {
500
+ var _a;
501
+ return {
502
+ cursor: props.isSelected ? "move" : "pointer",
503
+ strokeWidth: props.strokeWidth,
504
+ strokeLinecap: "butt",
505
+ pointerEvents: props.isSelected ? "none" : ending.filled ? "visible" : "visibleStroke",
506
+ ...props.strokeStyle === PdfAnnotationBorderStyle.DASHED && {
507
+ strokeDasharray: (_a = props.strokeDashArray) == null ? void 0 : _a.join(",")
508
+ }
509
+ };
510
+ };
511
+ const width = computed(() => props.rect.size.width * props.scale);
512
+ const height = computed(() => props.rect.size.height * props.scale);
513
+ return (_ctx, _cache) => {
514
+ var _a;
515
+ return openBlock(), createElementBlock("svg", {
516
+ style: normalizeStyle({
517
+ position: "absolute",
518
+ width: `${width.value}px`,
519
+ height: `${height.value}px`,
520
+ pointerEvents: "none",
521
+ zIndex: 2,
522
+ overflow: "visible"
523
+ }),
524
+ width: width.value,
525
+ height: height.value,
526
+ viewBox: `0 0 ${_ctx.rect.size.width} ${_ctx.rect.size.height}`
527
+ }, [
528
+ createElementVNode("line", {
529
+ x1: localLine.value.x1,
530
+ y1: localLine.value.y1,
531
+ x2: localLine.value.x2,
532
+ y2: localLine.value.y2,
533
+ opacity: _ctx.opacity,
534
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
535
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
536
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
537
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
538
+ style: normalizeStyle({
539
+ cursor: _ctx.isSelected ? "move" : "pointer",
540
+ pointerEvents: _ctx.isSelected ? "none" : "visibleStroke",
541
+ stroke: _ctx.strokeColor,
542
+ strokeWidth: _ctx.strokeWidth,
543
+ strokeLinecap: "butt",
544
+ ..._ctx.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
545
+ strokeDasharray: (_a = _ctx.strokeDashArray) == null ? void 0 : _a.join(",")
546
+ }
547
+ })
548
+ }, null, 44, _hoisted_2$3),
549
+ endings.value.start ? (openBlock(), createElementBlock("path", {
550
+ key: 0,
551
+ d: endings.value.start.d,
552
+ transform: endings.value.start.transform,
553
+ onPointerdown: _cache[2] || (_cache[2] = //@ts-ignore
554
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
555
+ onTouchstart: _cache[3] || (_cache[3] = //@ts-ignore
556
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
557
+ stroke: _ctx.strokeColor,
558
+ style: normalizeStyle(getEndingStyle(endings.value.start)),
559
+ fill: endings.value.start.filled ? _ctx.color : "none"
560
+ }, null, 44, _hoisted_3$2)) : createCommentVNode("", true),
561
+ endings.value.end ? (openBlock(), createElementBlock("path", {
562
+ key: 1,
563
+ d: endings.value.end.d,
564
+ transform: endings.value.end.transform,
565
+ onPointerdown: _cache[4] || (_cache[4] = //@ts-ignore
566
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
567
+ onTouchstart: _cache[5] || (_cache[5] = //@ts-ignore
568
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
569
+ stroke: _ctx.strokeColor,
570
+ style: normalizeStyle(getEndingStyle(endings.value.end)),
571
+ fill: endings.value.end.filled ? _ctx.color : "none"
572
+ }, null, 44, _hoisted_4$2)) : createCommentVNode("", true)
573
+ ], 12, _hoisted_1$4);
574
+ };
575
+ }
576
+ });
577
+ const _hoisted_1$3 = ["width", "height", "viewBox"];
578
+ const _hoisted_2$2 = ["d", "opacity"];
579
+ const _hoisted_3$1 = ["d"];
580
+ const _hoisted_4$1 = ["x", "y", "width", "height", "fill", "stroke", "stroke-width"];
581
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
582
+ __name: "polygon",
583
+ props: {
584
+ rect: {},
585
+ vertices: {},
586
+ color: { default: "transparent" },
587
+ strokeColor: { default: "#000000" },
588
+ opacity: { default: 1 },
589
+ strokeWidth: {},
590
+ strokeStyle: { default: PdfAnnotationBorderStyle.SOLID },
591
+ strokeDashArray: {},
592
+ scale: {},
593
+ isSelected: { type: Boolean },
594
+ onClick: {},
595
+ currentVertex: {},
596
+ handleSize: { default: 14 }
597
+ },
598
+ setup(__props) {
599
+ const props = __props;
600
+ const allPoints = computed(
601
+ () => props.currentVertex ? [...props.vertices, props.currentVertex] : props.vertices
602
+ );
603
+ const localPts = computed(
604
+ () => allPoints.value.map(({ x, y }) => ({
605
+ x: x - props.rect.origin.x,
606
+ y: y - props.rect.origin.y
607
+ }))
608
+ );
609
+ const pathData = computed(() => {
610
+ if (!localPts.value.length) return "";
611
+ const [first, ...rest] = localPts.value;
612
+ const isPreview = !!props.currentVertex;
613
+ return (`M ${first.x} ${first.y} ` + rest.map((p) => `L ${p.x} ${p.y}`).join(" ") + (isPreview ? "" : " Z")).trim();
614
+ });
615
+ const isPreviewing = computed(() => props.currentVertex && props.vertices.length > 0);
616
+ const width = computed(() => props.rect.size.width * props.scale);
617
+ const height = computed(() => props.rect.size.height * props.scale);
618
+ return (_ctx, _cache) => {
619
+ var _a;
620
+ return openBlock(), createElementBlock("svg", {
621
+ style: normalizeStyle({
622
+ position: "absolute",
623
+ width: `${width.value}px`,
624
+ height: `${height.value}px`,
625
+ pointerEvents: "none",
626
+ zIndex: 2,
627
+ overflow: "visible"
628
+ }),
629
+ width: width.value,
630
+ height: height.value,
631
+ viewBox: `0 0 ${_ctx.rect.size.width} ${_ctx.rect.size.height}`
632
+ }, [
633
+ createElementVNode("path", {
634
+ d: pathData.value,
635
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
636
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
637
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
638
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
639
+ opacity: _ctx.opacity,
640
+ style: normalizeStyle({
641
+ fill: _ctx.currentVertex ? "none" : _ctx.color,
642
+ stroke: _ctx.strokeColor ?? _ctx.color,
643
+ strokeWidth: _ctx.strokeWidth,
644
+ cursor: _ctx.isSelected ? "move" : "pointer",
645
+ pointerEvents: _ctx.isSelected ? "none" : _ctx.color === "transparent" ? "visibleStroke" : "visible",
646
+ strokeLinecap: "butt",
647
+ strokeLinejoin: "miter",
648
+ ..._ctx.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
649
+ strokeDasharray: (_a = _ctx.strokeDashArray) == null ? void 0 : _a.join(",")
650
+ }
651
+ })
652
+ }, null, 44, _hoisted_2$2),
653
+ isPreviewing.value && localPts.value.length > 1 ? (openBlock(), createElementBlock("path", {
654
+ key: 0,
655
+ d: `M ${localPts.value[localPts.value.length - 1].x} ${localPts.value[localPts.value.length - 1].y} L ${localPts.value[0].x} ${localPts.value[0].y}`,
656
+ fill: "none",
657
+ style: normalizeStyle({
658
+ stroke: _ctx.strokeColor,
659
+ strokeWidth: _ctx.strokeWidth,
660
+ strokeDasharray: "4,4",
661
+ opacity: 0.7
662
+ })
663
+ }, null, 12, _hoisted_3$1)) : createCommentVNode("", true),
664
+ isPreviewing.value && localPts.value.length >= 2 ? (openBlock(), createElementBlock("rect", {
665
+ key: 1,
666
+ x: localPts.value[0].x - _ctx.handleSize / _ctx.scale / 2,
667
+ y: localPts.value[0].y - _ctx.handleSize / _ctx.scale / 2,
668
+ width: _ctx.handleSize / _ctx.scale,
669
+ height: _ctx.handleSize / _ctx.scale,
670
+ fill: _ctx.strokeColor,
671
+ opacity: 0.4,
672
+ stroke: _ctx.strokeColor,
673
+ "stroke-width": _ctx.strokeWidth / 2
674
+ }, null, 8, _hoisted_4$1)) : createCommentVNode("", true)
675
+ ], 12, _hoisted_1$3);
676
+ };
677
+ }
678
+ });
679
+ const _hoisted_1$2 = ["width", "height", "viewBox"];
680
+ const _hoisted_2$1 = ["d", "opacity"];
681
+ const _hoisted_3 = ["d", "transform", "stroke", "fill"];
682
+ const _hoisted_4 = ["d", "transform", "stroke", "fill"];
683
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
684
+ __name: "polyline",
685
+ props: {
686
+ rect: {},
687
+ vertices: {},
688
+ color: { default: "transparent" },
689
+ strokeColor: { default: "#000000" },
690
+ opacity: { default: 1 },
691
+ strokeWidth: {},
692
+ scale: {},
693
+ isSelected: { type: Boolean },
694
+ onClick: {},
695
+ lineEndings: {}
696
+ },
697
+ setup(__props) {
698
+ const props = __props;
699
+ const localPts = computed(
700
+ () => props.vertices.map(({ x, y }) => ({
701
+ x: x - props.rect.origin.x,
702
+ y: y - props.rect.origin.y
703
+ }))
704
+ );
705
+ const pathData = computed(() => {
706
+ if (localPts.value.length === 0) return "";
707
+ const [first, ...rest] = localPts.value;
708
+ return (`M ${first.x} ${first.y} ` + rest.map((p) => `L ${p.x} ${p.y} `).join("")).trim();
709
+ });
710
+ const endings = computed(() => {
711
+ var _a, _b;
712
+ if (localPts.value.length < 2) return { start: null, end: null };
713
+ const toAngle = (a, b) => Math.atan2(b.y - a.y, b.x - a.x);
714
+ const startRad = toAngle(localPts.value[0], localPts.value[1]);
715
+ const endRad = toAngle(
716
+ localPts.value[localPts.value.length - 2],
717
+ localPts.value[localPts.value.length - 1]
718
+ );
719
+ return {
720
+ start: patching.createEnding(
721
+ (_a = props.lineEndings) == null ? void 0 : _a.start,
722
+ props.strokeWidth,
723
+ startRad + Math.PI,
724
+ localPts.value[0].x,
725
+ localPts.value[0].y
726
+ ),
727
+ end: patching.createEnding(
728
+ (_b = props.lineEndings) == null ? void 0 : _b.end,
729
+ props.strokeWidth,
730
+ endRad,
731
+ localPts.value[localPts.value.length - 1].x,
732
+ localPts.value[localPts.value.length - 1].y
733
+ )
734
+ };
735
+ });
736
+ const getEndingStyle = (ending) => ({
737
+ cursor: props.isSelected ? "move" : "pointer",
738
+ strokeWidth: props.strokeWidth,
739
+ pointerEvents: props.isSelected ? "none" : ending.filled ? "visible" : "visibleStroke",
740
+ strokeLinecap: "butt"
741
+ });
742
+ const width = computed(() => props.rect.size.width * props.scale);
743
+ const height = computed(() => props.rect.size.height * props.scale);
744
+ return (_ctx, _cache) => {
745
+ return openBlock(), createElementBlock("svg", {
746
+ style: normalizeStyle({
747
+ position: "absolute",
748
+ width: `${width.value}px`,
749
+ height: `${height.value}px`,
750
+ pointerEvents: "none",
751
+ zIndex: 2,
752
+ overflow: "visible"
753
+ }),
754
+ width: width.value,
755
+ height: height.value,
756
+ viewBox: `0 0 ${_ctx.rect.size.width} ${_ctx.rect.size.height}`
757
+ }, [
758
+ createElementVNode("path", {
759
+ d: pathData.value,
760
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
761
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
762
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
763
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
764
+ opacity: _ctx.opacity,
765
+ style: normalizeStyle({
766
+ fill: "none",
767
+ stroke: _ctx.strokeColor ?? _ctx.color,
768
+ strokeWidth: _ctx.strokeWidth,
769
+ cursor: _ctx.isSelected ? "move" : "pointer",
770
+ pointerEvents: _ctx.isSelected ? "none" : "visibleStroke",
771
+ strokeLinecap: "butt",
772
+ strokeLinejoin: "miter"
773
+ })
774
+ }, null, 44, _hoisted_2$1),
775
+ endings.value.start ? (openBlock(), createElementBlock("path", {
776
+ key: 0,
777
+ d: endings.value.start.d,
778
+ transform: endings.value.start.transform,
779
+ stroke: _ctx.strokeColor,
780
+ fill: endings.value.start.filled ? _ctx.color : "none",
781
+ onPointerdown: _cache[2] || (_cache[2] = //@ts-ignore
782
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
783
+ onTouchstart: _cache[3] || (_cache[3] = //@ts-ignore
784
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
785
+ style: normalizeStyle(getEndingStyle(endings.value.start))
786
+ }, null, 44, _hoisted_3)) : createCommentVNode("", true),
787
+ endings.value.end ? (openBlock(), createElementBlock("path", {
788
+ key: 1,
789
+ d: endings.value.end.d,
790
+ transform: endings.value.end.transform,
791
+ stroke: _ctx.strokeColor,
792
+ fill: endings.value.end.filled ? _ctx.color : "none",
793
+ onPointerdown: _cache[4] || (_cache[4] = //@ts-ignore
794
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
795
+ onTouchstart: _cache[5] || (_cache[5] = //@ts-ignore
796
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
797
+ style: normalizeStyle(getEndingStyle(endings.value.end))
798
+ }, null, 44, _hoisted_4)) : createCommentVNode("", true)
799
+ ], 12, _hoisted_1$2);
800
+ };
801
+ }
802
+ });
803
+ const _hoisted_1$1 = ["width", "height", "viewBox"];
804
+ const _hoisted_2 = ["x", "y", "width", "height", "fill", "opacity"];
805
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
806
+ __name: "square",
807
+ props: {
808
+ isSelected: { type: Boolean },
809
+ color: { default: "#000000" },
810
+ strokeColor: {},
811
+ opacity: { default: 1 },
812
+ strokeWidth: {},
813
+ strokeStyle: { default: PdfAnnotationBorderStyle.SOLID },
814
+ strokeDashArray: {},
815
+ rect: {},
816
+ scale: {},
817
+ onClick: {}
818
+ },
819
+ setup(__props) {
820
+ const props = __props;
821
+ const geometry = computed(() => {
822
+ const outerW = props.rect.size.width;
823
+ const outerH = props.rect.size.height;
824
+ const innerW = Math.max(outerW - props.strokeWidth, 0);
825
+ const innerH = Math.max(outerH - props.strokeWidth, 0);
826
+ return {
827
+ width: innerW,
828
+ height: innerH,
829
+ x: props.strokeWidth / 2,
830
+ y: props.strokeWidth / 2
831
+ };
832
+ });
833
+ const svgWidth = computed(() => (geometry.value.width + props.strokeWidth) * props.scale);
834
+ const svgHeight = computed(() => (geometry.value.height + props.strokeWidth) * props.scale);
835
+ return (_ctx, _cache) => {
836
+ var _a;
837
+ return openBlock(), createElementBlock("svg", {
838
+ style: normalizeStyle({
839
+ position: "absolute",
840
+ width: svgWidth.value,
841
+ height: svgHeight.value,
842
+ pointerEvents: "none",
843
+ zIndex: 2
844
+ }),
845
+ width: svgWidth.value,
846
+ height: svgHeight.value,
847
+ viewBox: `0 0 ${geometry.value.width + _ctx.strokeWidth} ${geometry.value.height + _ctx.strokeWidth}`
848
+ }, [
849
+ createElementVNode("rect", {
850
+ x: geometry.value.x,
851
+ y: geometry.value.y,
852
+ width: geometry.value.width,
853
+ height: geometry.value.height,
854
+ fill: _ctx.color,
855
+ opacity: _ctx.opacity,
856
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
857
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
858
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
859
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
860
+ style: normalizeStyle({
861
+ cursor: _ctx.isSelected ? "move" : "pointer",
862
+ pointerEvents: _ctx.isSelected ? "none" : _ctx.color === "transparent" ? "visibleStroke" : "visible",
863
+ stroke: _ctx.strokeColor ?? _ctx.color,
864
+ strokeWidth: _ctx.strokeWidth,
865
+ ..._ctx.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
866
+ strokeDasharray: (_a = _ctx.strokeDashArray) == null ? void 0 : _a.join(",")
867
+ }
868
+ })
869
+ }, null, 44, _hoisted_2)
870
+ ], 12, _hoisted_1$1);
871
+ };
872
+ }
873
+ });
874
+ const _hoisted_1 = ["src"];
875
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
876
+ __name: "render-annotation",
877
+ props: {
878
+ pageIndex: {},
879
+ annotation: {},
880
+ scaleFactor: { default: 1 },
881
+ style: {}
882
+ },
883
+ setup(__props) {
884
+ const props = __props;
885
+ const { provides: annotationProvides } = useAnnotationCapability();
886
+ const imageUrl = ref(null);
887
+ const urlRef = ref(null);
888
+ const currentTask = ref(null);
889
+ const annotationId = computed(() => props.annotation.id);
890
+ const rectWidth = computed(() => props.annotation.rect.size.width);
891
+ const rectHeight = computed(() => props.annotation.rect.size.height);
892
+ watch(
893
+ () => [
894
+ props.pageIndex,
895
+ props.scaleFactor,
896
+ annotationId.value,
897
+ rectWidth.value,
898
+ rectHeight.value,
899
+ annotationProvides.value
900
+ ],
901
+ (_, __, onCleanup) => {
902
+ if (annotationProvides.value) {
903
+ if (urlRef.value) {
904
+ URL.revokeObjectURL(urlRef.value);
905
+ urlRef.value = null;
906
+ }
907
+ const task = annotationProvides.value.renderAnnotation({
908
+ pageIndex: props.pageIndex,
909
+ annotation: deepToRaw(props.annotation),
910
+ options: {
911
+ scaleFactor: props.scaleFactor,
912
+ dpr: window.devicePixelRatio
913
+ }
914
+ });
915
+ currentTask.value = task;
916
+ task.wait((blob) => {
917
+ const url = URL.createObjectURL(blob);
918
+ imageUrl.value = url;
919
+ urlRef.value = url;
920
+ }, ignore);
921
+ onCleanup(() => {
922
+ if (urlRef.value) {
923
+ URL.revokeObjectURL(urlRef.value);
924
+ urlRef.value = null;
925
+ } else {
926
+ task.abort({
927
+ code: PdfErrorCode.Cancelled,
928
+ message: "canceled render task"
929
+ });
930
+ }
931
+ });
932
+ }
933
+ },
934
+ { immediate: true }
935
+ );
936
+ onUnmounted(() => {
937
+ if (urlRef.value) {
938
+ URL.revokeObjectURL(urlRef.value);
939
+ urlRef.value = null;
940
+ }
941
+ if (currentTask.value) {
942
+ currentTask.value.abort({
943
+ code: PdfErrorCode.Cancelled,
944
+ message: "canceled render task on unmount"
945
+ });
946
+ }
947
+ });
948
+ const handleImageLoad = () => {
949
+ if (urlRef.value) {
950
+ URL.revokeObjectURL(urlRef.value);
951
+ urlRef.value = null;
952
+ }
953
+ };
954
+ return (_ctx, _cache) => {
955
+ return imageUrl.value ? (openBlock(), createElementBlock("img", {
956
+ key: 0,
957
+ src: imageUrl.value,
958
+ onLoad: handleImageLoad,
959
+ style: normalizeStyle({
960
+ width: "100%",
961
+ height: "100%",
962
+ display: "block",
963
+ ..._ctx.style
964
+ })
965
+ }, null, 44, _hoisted_1)) : createCommentVNode("", true);
966
+ };
967
+ }
968
+ });
969
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
970
+ __name: "stamp",
971
+ props: {
972
+ isSelected: { type: Boolean },
973
+ annotation: {},
974
+ pageIndex: {},
975
+ scale: {},
976
+ onClick: { type: Function }
977
+ },
978
+ setup(__props) {
979
+ return (_ctx, _cache) => {
980
+ return openBlock(), createElementBlock("div", {
981
+ style: normalizeStyle({
982
+ position: "absolute",
983
+ width: "100%",
984
+ height: "100%",
985
+ zIndex: 2,
986
+ pointerEvents: _ctx.isSelected ? "none" : "auto",
987
+ cursor: "pointer"
988
+ }),
989
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
990
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
991
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
992
+ (...args) => _ctx.onClick && _ctx.onClick(...args))
993
+ }, [
994
+ createVNode(_sfc_main$a, {
995
+ pageIndex: _ctx.pageIndex,
996
+ annotation: { ..._ctx.annotation.object, id: _ctx.annotation.object.id },
997
+ scaleFactor: _ctx.scale
998
+ }, null, 8, ["pageIndex", "annotation", "scaleFactor"])
999
+ ], 36);
1000
+ };
1001
+ }
1002
+ });
1003
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1004
+ __name: "highlight",
1005
+ props: {
1006
+ color: { default: "#FFFF00" },
1007
+ opacity: { default: 0.5 },
1008
+ segmentRects: {},
1009
+ rect: {},
1010
+ scale: {},
1011
+ onClick: {}
1012
+ },
1013
+ setup(__props) {
1014
+ return (_ctx, _cache) => {
1015
+ return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.segmentRects, (b, i) => {
1016
+ return openBlock(), createElementBlock("div", {
1017
+ key: i,
1018
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1019
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
1020
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1021
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
1022
+ style: normalizeStyle({
1023
+ position: "absolute",
1024
+ left: `${(_ctx.rect ? b.origin.x - _ctx.rect.origin.x : b.origin.x) * _ctx.scale}px`,
1025
+ top: `${(_ctx.rect ? b.origin.y - _ctx.rect.origin.y : b.origin.y) * _ctx.scale}px`,
1026
+ width: `${b.size.width * _ctx.scale}px`,
1027
+ height: `${b.size.height * _ctx.scale}px`,
1028
+ background: _ctx.color,
1029
+ opacity: _ctx.opacity,
1030
+ pointerEvents: _ctx.onClick ? "auto" : "none",
1031
+ cursor: _ctx.onClick ? "pointer" : "default",
1032
+ zIndex: _ctx.onClick ? 1 : void 0
1033
+ })
1034
+ }, null, 36);
1035
+ }), 128);
1036
+ };
1037
+ }
1038
+ });
1039
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1040
+ __name: "squiggly",
1041
+ props: {
1042
+ color: { default: "#FFFF00" },
1043
+ opacity: { default: 0.5 },
1044
+ segmentRects: {},
1045
+ rect: {},
1046
+ scale: {},
1047
+ onClick: {}
1048
+ },
1049
+ setup(__props) {
1050
+ const props = __props;
1051
+ const amplitude = computed(() => 2 * props.scale);
1052
+ const period = computed(() => 6 * props.scale);
1053
+ const svgDataUri = computed(() => {
1054
+ const amp = amplitude.value;
1055
+ const per = period.value;
1056
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${per}" height="${amp * 2}" viewBox="0 0 ${per} ${amp * 2}">
1057
+ <path d="M0 ${amp} Q ${per / 4} 0 ${per / 2} ${amp} T ${per} ${amp}"
1058
+ fill="none" stroke="${props.color}" stroke-width="${amp}" stroke-linecap="round"/>
1059
+ </svg>`;
1060
+ return `url("data:image/svg+xml;utf8,${encodeURIComponent(svg)}")`;
1061
+ });
1062
+ return (_ctx, _cache) => {
1063
+ return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.segmentRects, (r, i) => {
1064
+ return openBlock(), createElementBlock("div", {
1065
+ key: i,
1066
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1067
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
1068
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1069
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
1070
+ style: normalizeStyle({
1071
+ position: "absolute",
1072
+ left: `${(_ctx.rect ? r.origin.x - _ctx.rect.origin.x : r.origin.x) * _ctx.scale}px`,
1073
+ top: `${(_ctx.rect ? r.origin.y - _ctx.rect.origin.y : r.origin.y) * _ctx.scale}px`,
1074
+ width: `${r.size.width * _ctx.scale}px`,
1075
+ height: `${r.size.height * _ctx.scale}px`,
1076
+ background: "transparent",
1077
+ pointerEvents: _ctx.onClick ? "auto" : "none",
1078
+ cursor: _ctx.onClick ? "pointer" : "default",
1079
+ zIndex: _ctx.onClick ? 1 : 0
1080
+ })
1081
+ }, [
1082
+ createElementVNode("div", {
1083
+ style: normalizeStyle({
1084
+ position: "absolute",
1085
+ left: 0,
1086
+ bottom: 0,
1087
+ width: "100%",
1088
+ height: `${amplitude.value * 2}px`,
1089
+ backgroundImage: svgDataUri.value,
1090
+ backgroundRepeat: "repeat-x",
1091
+ backgroundSize: `${period.value}px ${amplitude.value * 2}px`,
1092
+ opacity: _ctx.opacity,
1093
+ pointerEvents: "none"
1094
+ })
1095
+ }, null, 4)
1096
+ ], 36);
1097
+ }), 128);
1098
+ };
1099
+ }
1100
+ });
1101
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1102
+ __name: "strikeout",
1103
+ props: {
1104
+ color: { default: "#FFFF00" },
1105
+ opacity: { default: 0.5 },
1106
+ segmentRects: {},
1107
+ rect: {},
1108
+ scale: {},
1109
+ onClick: {}
1110
+ },
1111
+ setup(__props) {
1112
+ const props = __props;
1113
+ const thickness = computed(() => 2 * props.scale);
1114
+ return (_ctx, _cache) => {
1115
+ return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.segmentRects, (r, i) => {
1116
+ return openBlock(), createElementBlock("div", {
1117
+ key: i,
1118
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1119
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
1120
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1121
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
1122
+ style: normalizeStyle({
1123
+ position: "absolute",
1124
+ left: `${(_ctx.rect ? r.origin.x - _ctx.rect.origin.x : r.origin.x) * _ctx.scale}px`,
1125
+ top: `${(_ctx.rect ? r.origin.y - _ctx.rect.origin.y : r.origin.y) * _ctx.scale}px`,
1126
+ width: `${r.size.width * _ctx.scale}px`,
1127
+ height: `${r.size.height * _ctx.scale}px`,
1128
+ background: "transparent",
1129
+ pointerEvents: _ctx.onClick ? "auto" : "none",
1130
+ cursor: _ctx.onClick ? "pointer" : "default",
1131
+ zIndex: _ctx.onClick ? 1 : 0
1132
+ })
1133
+ }, [
1134
+ createElementVNode("div", {
1135
+ style: normalizeStyle({
1136
+ position: "absolute",
1137
+ left: 0,
1138
+ top: "50%",
1139
+ width: "100%",
1140
+ height: `${thickness.value}px`,
1141
+ background: _ctx.color,
1142
+ opacity: _ctx.opacity,
1143
+ transform: "translateY(-50%)",
1144
+ pointerEvents: "none"
1145
+ })
1146
+ }, null, 4)
1147
+ ], 36);
1148
+ }), 128);
1149
+ };
1150
+ }
1151
+ });
1152
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1153
+ __name: "underline",
1154
+ props: {
1155
+ color: { default: "#FFFF00" },
1156
+ opacity: { default: 0.5 },
1157
+ segmentRects: {},
1158
+ rect: {},
1159
+ scale: {},
1160
+ onClick: {}
1161
+ },
1162
+ setup(__props) {
1163
+ const props = __props;
1164
+ const thickness = computed(() => 2 * props.scale);
1165
+ return (_ctx, _cache) => {
1166
+ return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.segmentRects, (r, i) => {
1167
+ return openBlock(), createElementBlock("div", {
1168
+ key: i,
1169
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1170
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
1171
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1172
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
1173
+ style: normalizeStyle({
1174
+ position: "absolute",
1175
+ left: `${(_ctx.rect ? r.origin.x - _ctx.rect.origin.x : r.origin.x) * _ctx.scale}px`,
1176
+ top: `${(_ctx.rect ? r.origin.y - _ctx.rect.origin.y : r.origin.y) * _ctx.scale}px`,
1177
+ width: `${r.size.width * _ctx.scale}px`,
1178
+ height: `${r.size.height * _ctx.scale}px`,
1179
+ background: "transparent",
1180
+ pointerEvents: _ctx.onClick ? "auto" : "none",
1181
+ cursor: _ctx.onClick ? "pointer" : "default",
1182
+ zIndex: _ctx.onClick ? 1 : 0
1183
+ })
1184
+ }, [
1185
+ createElementVNode("div", {
1186
+ style: normalizeStyle({
1187
+ position: "absolute",
1188
+ left: 0,
1189
+ bottom: 0,
1190
+ width: "100%",
1191
+ height: `${thickness.value}px`,
1192
+ background: _ctx.color,
1193
+ opacity: _ctx.opacity,
1194
+ pointerEvents: "none"
1195
+ })
1196
+ }, null, 4)
1197
+ ], 36);
1198
+ }), 128);
1199
+ };
1200
+ }
1201
+ });
1202
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1203
+ __name: "annotations",
1204
+ props: {
1205
+ pageIndex: {},
1206
+ scale: {},
1207
+ rotation: {},
1208
+ pageWidth: {},
1209
+ pageHeight: {},
1210
+ resizeUI: {},
1211
+ vertexUI: {},
1212
+ selectionOutlineColor: {}
1213
+ },
1214
+ setup(__props) {
1215
+ const props = __props;
1216
+ const { provides: annotationProvides } = useAnnotationCapability();
1217
+ const { provides: selectionProvides } = useSelectionCapability();
1218
+ const annotations = ref([]);
1219
+ const { register } = usePointerHandlers({ pageIndex: props.pageIndex });
1220
+ const selectionState = ref(null);
1221
+ const editingId = ref(null);
1222
+ watchEffect((onCleanup) => {
1223
+ if (annotationProvides.value) {
1224
+ const off = annotationProvides.value.onStateChange((state) => {
1225
+ annotations.value = getAnnotationsByPageIndex(state, props.pageIndex);
1226
+ selectionState.value = getSelectedAnnotationByPageIndex(state, props.pageIndex);
1227
+ });
1228
+ onCleanup(off);
1229
+ }
1230
+ });
1231
+ const handlePointerDown = (_pos, pe) => {
1232
+ if (pe.target === pe.currentTarget && annotationProvides.value) {
1233
+ annotationProvides.value.deselectAnnotation();
1234
+ editingId.value = null;
1235
+ }
1236
+ };
1237
+ const handleClick = (e, annotation) => {
1238
+ e.stopPropagation();
1239
+ if (annotationProvides.value && selectionProvides.value) {
1240
+ annotationProvides.value.selectAnnotation(props.pageIndex, annotation.object.id);
1241
+ selectionProvides.value.clear();
1242
+ if (annotation.object.id !== editingId.value) {
1243
+ editingId.value = null;
1244
+ }
1245
+ }
1246
+ };
1247
+ const handleDoubleClick = (_e, id) => {
1248
+ if (isFreeText(annotations.value.find((a) => a.object.id === id))) {
1249
+ editingId.value = id;
1250
+ }
1251
+ };
1252
+ watchEffect((onCleanup) => {
1253
+ if (annotationProvides.value) {
1254
+ const unregister = register({ onPointerDown: handlePointerDown });
1255
+ if (unregister) {
1256
+ onCleanup(unregister);
1257
+ }
1258
+ }
1259
+ });
1260
+ const getTool = (annotation) => {
1261
+ var _a;
1262
+ return (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
1263
+ };
1264
+ const isDraggable = (anno) => {
1265
+ var _a;
1266
+ if (isFreeText(anno) && editingId.value === anno.object.id) return false;
1267
+ return ((_a = getTool(anno)) == null ? void 0 : _a.interaction.isDraggable) ?? false;
1268
+ };
1269
+ const isResizable = (anno) => {
1270
+ var _a;
1271
+ return ((_a = getTool(anno)) == null ? void 0 : _a.interaction.isResizable) ?? false;
1272
+ };
1273
+ const lockAspectRatio = (anno) => {
1274
+ var _a;
1275
+ return ((_a = getTool(anno)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
1276
+ };
1277
+ const getVertexConfig = (annotation) => {
1278
+ if (isLine(annotation)) {
1279
+ return {
1280
+ extractVertices: (anno) => [anno.linePoints.start, anno.linePoints.end],
1281
+ transformAnnotation: (anno, vertices) => ({
1282
+ ...anno,
1283
+ linePoints: { start: vertices[0], end: vertices[1] }
1284
+ })
1285
+ };
1286
+ }
1287
+ if (isPolyline(annotation) || isPolygon(annotation)) {
1288
+ return {
1289
+ extractVertices: (anno) => anno.vertices,
1290
+ transformAnnotation: (anno, vertices) => ({ ...anno, vertices })
1291
+ };
1292
+ }
1293
+ return void 0;
1294
+ };
1295
+ return (_ctx, _cache) => {
1296
+ return openBlock(true), createElementBlock(Fragment, null, renderList(annotations.value, (annotation) => {
1297
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1298
+ return openBlock(), createElementBlock(Fragment, {
1299
+ key: annotation.object.id
1300
+ }, [
1301
+ unref(isInk)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1302
+ key: 0,
1303
+ trackedAnnotation: annotation,
1304
+ isSelected: ((_a = selectionState.value) == null ? void 0 : _a.object.id) === annotation.object.id,
1305
+ isDraggable: isDraggable(annotation),
1306
+ isResizable: isResizable(annotation),
1307
+ lockAspectRatio: lockAspectRatio(annotation),
1308
+ onSelect: (e) => handleClick(e, annotation),
1309
+ vertexConfig: getVertexConfig(annotation)
1310
+ }, { ref_for: true }, props), {
1311
+ default: withCtx(({ annotation: currentObject }) => {
1312
+ var _a2;
1313
+ return [
1314
+ createVNode(_sfc_main$f, mergeProps({ ref_for: true }, currentObject, {
1315
+ isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1316
+ scale: _ctx.scale,
1317
+ onClick: (e) => handleClick(e, annotation)
1318
+ }), null, 16, ["isSelected", "scale", "onClick"])
1319
+ ];
1320
+ }),
1321
+ "selection-menu": withCtx((slotProps) => [
1322
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1323
+ ]),
1324
+ "resize-handle": withCtx((slotProps) => [
1325
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1326
+ ]),
1327
+ "vertex-handle": withCtx((slotProps) => [
1328
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1329
+ ]),
1330
+ _: 2
1331
+ }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig"])) : unref(isSquare)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1332
+ key: 1,
1333
+ trackedAnnotation: annotation,
1334
+ isSelected: ((_b = selectionState.value) == null ? void 0 : _b.object.id) === annotation.object.id,
1335
+ isDraggable: isDraggable(annotation),
1336
+ isResizable: isResizable(annotation),
1337
+ lockAspectRatio: lockAspectRatio(annotation),
1338
+ onSelect: (e) => handleClick(e, annotation),
1339
+ vertexConfig: getVertexConfig(annotation)
1340
+ }, { ref_for: true }, props), {
1341
+ default: withCtx(({ annotation: currentObject }) => {
1342
+ var _a2;
1343
+ return [
1344
+ createVNode(_sfc_main$b, mergeProps({ ref_for: true }, currentObject, {
1345
+ isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1346
+ scale: _ctx.scale,
1347
+ onClick: (e) => handleClick(e, annotation)
1348
+ }), null, 16, ["isSelected", "scale", "onClick"])
1349
+ ];
1350
+ }),
1351
+ "selection-menu": withCtx((slotProps) => [
1352
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1353
+ ]),
1354
+ "resize-handle": withCtx((slotProps) => [
1355
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1356
+ ]),
1357
+ "vertex-handle": withCtx((slotProps) => [
1358
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1359
+ ]),
1360
+ _: 2
1361
+ }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig"])) : unref(isCircle)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1362
+ key: 2,
1363
+ trackedAnnotation: annotation,
1364
+ isSelected: ((_c = selectionState.value) == null ? void 0 : _c.object.id) === annotation.object.id,
1365
+ isDraggable: isDraggable(annotation),
1366
+ isResizable: isResizable(annotation),
1367
+ lockAspectRatio: lockAspectRatio(annotation),
1368
+ onSelect: (e) => handleClick(e, annotation),
1369
+ vertexConfig: getVertexConfig(annotation)
1370
+ }, { ref_for: true }, props), {
1371
+ default: withCtx(({ annotation: currentObject }) => {
1372
+ var _a2;
1373
+ return [
1374
+ createVNode(_sfc_main$h, mergeProps({ ref_for: true }, currentObject, {
1375
+ isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1376
+ scale: _ctx.scale,
1377
+ onClick: (e) => handleClick(e, annotation)
1378
+ }), null, 16, ["isSelected", "scale", "onClick"])
1379
+ ];
1380
+ }),
1381
+ "selection-menu": withCtx((slotProps) => [
1382
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1383
+ ]),
1384
+ "resize-handle": withCtx((slotProps) => [
1385
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1386
+ ]),
1387
+ "vertex-handle": withCtx((slotProps) => [
1388
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1389
+ ]),
1390
+ _: 2
1391
+ }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig"])) : unref(isLine)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1392
+ key: 3,
1393
+ trackedAnnotation: annotation,
1394
+ isSelected: ((_d = selectionState.value) == null ? void 0 : _d.object.id) === annotation.object.id,
1395
+ isDraggable: isDraggable(annotation),
1396
+ isResizable: isResizable(annotation),
1397
+ lockAspectRatio: lockAspectRatio(annotation),
1398
+ onSelect: (e) => handleClick(e, annotation),
1399
+ vertexConfig: getVertexConfig(annotation)
1400
+ }, { ref_for: true }, props), {
1401
+ default: withCtx(({ annotation: currentObject }) => {
1402
+ var _a2;
1403
+ return [
1404
+ createVNode(_sfc_main$e, mergeProps({ ref_for: true }, currentObject, {
1405
+ isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1406
+ scale: _ctx.scale,
1407
+ onClick: (e) => handleClick(e, annotation)
1408
+ }), null, 16, ["isSelected", "scale", "onClick"])
1409
+ ];
1410
+ }),
1411
+ "selection-menu": withCtx((slotProps) => [
1412
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1413
+ ]),
1414
+ "resize-handle": withCtx((slotProps) => [
1415
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1416
+ ]),
1417
+ "vertex-handle": withCtx((slotProps) => [
1418
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1419
+ ]),
1420
+ _: 2
1421
+ }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig"])) : unref(isPolyline)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1422
+ key: 4,
1423
+ trackedAnnotation: annotation,
1424
+ isSelected: ((_e = selectionState.value) == null ? void 0 : _e.object.id) === annotation.object.id,
1425
+ isDraggable: isDraggable(annotation),
1426
+ isResizable: isResizable(annotation),
1427
+ lockAspectRatio: lockAspectRatio(annotation),
1428
+ onSelect: (e) => handleClick(e, annotation),
1429
+ vertexConfig: getVertexConfig(annotation)
1430
+ }, { ref_for: true }, props), {
1431
+ default: withCtx(({ annotation: currentObject }) => {
1432
+ var _a2;
1433
+ return [
1434
+ createVNode(_sfc_main$c, mergeProps({ ref_for: true }, currentObject, {
1435
+ isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1436
+ scale: _ctx.scale,
1437
+ onClick: (e) => handleClick(e, annotation)
1438
+ }), null, 16, ["isSelected", "scale", "onClick"])
1439
+ ];
1440
+ }),
1441
+ "selection-menu": withCtx((slotProps) => [
1442
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1443
+ ]),
1444
+ "resize-handle": withCtx((slotProps) => [
1445
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1446
+ ]),
1447
+ "vertex-handle": withCtx((slotProps) => [
1448
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1449
+ ]),
1450
+ _: 2
1451
+ }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig"])) : unref(isPolygon)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1452
+ key: 5,
1453
+ trackedAnnotation: annotation,
1454
+ isSelected: ((_f = selectionState.value) == null ? void 0 : _f.object.id) === annotation.object.id,
1455
+ isDraggable: isDraggable(annotation),
1456
+ isResizable: isResizable(annotation),
1457
+ lockAspectRatio: lockAspectRatio(annotation),
1458
+ onSelect: (e) => handleClick(e, annotation),
1459
+ vertexConfig: getVertexConfig(annotation)
1460
+ }, { ref_for: true }, props), {
1461
+ default: withCtx(({ annotation: currentObject }) => {
1462
+ var _a2;
1463
+ return [
1464
+ createVNode(_sfc_main$d, mergeProps({ ref_for: true }, currentObject, {
1465
+ isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1466
+ scale: _ctx.scale,
1467
+ onClick: (e) => handleClick(e, annotation)
1468
+ }), null, 16, ["isSelected", "scale", "onClick"])
1469
+ ];
1470
+ }),
1471
+ "selection-menu": withCtx((slotProps) => [
1472
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1473
+ ]),
1474
+ "resize-handle": withCtx((slotProps) => [
1475
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1476
+ ]),
1477
+ "vertex-handle": withCtx((slotProps) => [
1478
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1479
+ ]),
1480
+ _: 2
1481
+ }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig"])) : unref(isFreeText)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1482
+ key: 6,
1483
+ trackedAnnotation: annotation,
1484
+ isSelected: ((_g = selectionState.value) == null ? void 0 : _g.object.id) === annotation.object.id,
1485
+ isDraggable: isDraggable(annotation),
1486
+ isResizable: isResizable(annotation),
1487
+ lockAspectRatio: lockAspectRatio(annotation),
1488
+ onSelect: (e) => handleClick(e, annotation),
1489
+ onDoubleClick: (e) => handleDoubleClick(e, annotation.object.id),
1490
+ vertexConfig: getVertexConfig(annotation)
1491
+ }, { ref_for: true }, props), {
1492
+ default: withCtx(({ annotation: currentObject }) => {
1493
+ var _a2;
1494
+ return [
1495
+ createVNode(_sfc_main$g, {
1496
+ isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1497
+ isEditing: editingId.value === annotation.object.id,
1498
+ annotation: { ...annotation, object: currentObject },
1499
+ pageIndex: _ctx.pageIndex,
1500
+ scale: _ctx.scale,
1501
+ onClick: (e) => handleClick(e, annotation)
1502
+ }, null, 8, ["isSelected", "isEditing", "annotation", "pageIndex", "scale", "onClick"])
1503
+ ];
1504
+ }),
1505
+ "selection-menu": withCtx((slotProps) => [
1506
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1507
+ ]),
1508
+ "resize-handle": withCtx((slotProps) => [
1509
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1510
+ ]),
1511
+ "vertex-handle": withCtx((slotProps) => [
1512
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1513
+ ]),
1514
+ _: 2
1515
+ }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "onDoubleClick", "vertexConfig"])) : unref(isStamp)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1516
+ key: 7,
1517
+ trackedAnnotation: annotation,
1518
+ isSelected: ((_h = selectionState.value) == null ? void 0 : _h.object.id) === annotation.object.id,
1519
+ isDraggable: isDraggable(annotation),
1520
+ isResizable: isResizable(annotation),
1521
+ lockAspectRatio: lockAspectRatio(annotation),
1522
+ onSelect: (e) => handleClick(e, annotation),
1523
+ vertexConfig: getVertexConfig(annotation)
1524
+ }, { ref_for: true }, props), {
1525
+ default: withCtx(() => {
1526
+ var _a2;
1527
+ return [
1528
+ createVNode(_sfc_main$9, {
1529
+ isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1530
+ annotation,
1531
+ pageIndex: _ctx.pageIndex,
1532
+ scale: _ctx.scale,
1533
+ onClick: (e) => handleClick(e, annotation)
1534
+ }, null, 8, ["isSelected", "annotation", "pageIndex", "scale", "onClick"])
1535
+ ];
1536
+ }),
1537
+ "selection-menu": withCtx((slotProps) => [
1538
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1539
+ ]),
1540
+ "resize-handle": withCtx((slotProps) => [
1541
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1542
+ ]),
1543
+ "vertex-handle": withCtx((slotProps) => [
1544
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1545
+ ]),
1546
+ _: 2
1547
+ }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig"])) : unref(isUnderline)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1548
+ key: 8,
1549
+ trackedAnnotation: annotation,
1550
+ isSelected: ((_i = selectionState.value) == null ? void 0 : _i.object.id) === annotation.object.id,
1551
+ isDraggable: isDraggable(annotation),
1552
+ isResizable: isResizable(annotation),
1553
+ lockAspectRatio: lockAspectRatio(annotation),
1554
+ onSelect: (e) => handleClick(e, annotation),
1555
+ vertexConfig: getVertexConfig(annotation),
1556
+ zIndex: 0
1557
+ }, { ref_for: true }, props), {
1558
+ default: withCtx(({ annotation: currentObject }) => [
1559
+ createVNode(_sfc_main$5, mergeProps({ ref_for: true }, currentObject, {
1560
+ scale: _ctx.scale,
1561
+ onClick: (e) => handleClick(e, annotation)
1562
+ }), null, 16, ["scale", "onClick"])
1563
+ ]),
1564
+ "selection-menu": withCtx((slotProps) => [
1565
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1566
+ ]),
1567
+ _: 2
1568
+ }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig"])) : unref(isStrikeout)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1569
+ key: 9,
1570
+ trackedAnnotation: annotation,
1571
+ isSelected: ((_j = selectionState.value) == null ? void 0 : _j.object.id) === annotation.object.id,
1572
+ isDraggable: isDraggable(annotation),
1573
+ isResizable: isResizable(annotation),
1574
+ lockAspectRatio: lockAspectRatio(annotation),
1575
+ onSelect: (e) => handleClick(e, annotation),
1576
+ vertexConfig: getVertexConfig(annotation),
1577
+ zIndex: 0
1578
+ }, { ref_for: true }, props), {
1579
+ default: withCtx(({ annotation: currentObject }) => [
1580
+ createVNode(_sfc_main$6, mergeProps({ ref_for: true }, currentObject, {
1581
+ scale: _ctx.scale,
1582
+ onClick: (e) => handleClick(e, annotation)
1583
+ }), null, 16, ["scale", "onClick"])
1584
+ ]),
1585
+ "selection-menu": withCtx((slotProps) => [
1586
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1587
+ ]),
1588
+ _: 2
1589
+ }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig"])) : unref(isSquiggly)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1590
+ key: 10,
1591
+ trackedAnnotation: annotation,
1592
+ isSelected: ((_k = selectionState.value) == null ? void 0 : _k.object.id) === annotation.object.id,
1593
+ isDraggable: isDraggable(annotation),
1594
+ isResizable: isResizable(annotation),
1595
+ lockAspectRatio: lockAspectRatio(annotation),
1596
+ onSelect: (e) => handleClick(e, annotation),
1597
+ vertexConfig: getVertexConfig(annotation),
1598
+ zIndex: 0
1599
+ }, { ref_for: true }, props), {
1600
+ default: withCtx(({ annotation: currentObject }) => [
1601
+ createVNode(_sfc_main$7, mergeProps({ ref_for: true }, currentObject, {
1602
+ scale: _ctx.scale,
1603
+ onClick: (e) => handleClick(e, annotation)
1604
+ }), null, 16, ["scale", "onClick"])
1605
+ ]),
1606
+ "selection-menu": withCtx((slotProps) => [
1607
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1608
+ ]),
1609
+ _: 2
1610
+ }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig"])) : unref(isHighlight)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1611
+ key: 11,
1612
+ trackedAnnotation: annotation,
1613
+ isSelected: ((_l = selectionState.value) == null ? void 0 : _l.object.id) === annotation.object.id,
1614
+ isDraggable: isDraggable(annotation),
1615
+ isResizable: isResizable(annotation),
1616
+ lockAspectRatio: lockAspectRatio(annotation),
1617
+ onSelect: (e) => handleClick(e, annotation),
1618
+ vertexConfig: getVertexConfig(annotation),
1619
+ zIndex: 0
1620
+ }, { ref_for: true }, props), {
1621
+ default: withCtx(({ annotation: currentObject }) => [
1622
+ createVNode(_sfc_main$8, mergeProps({ ref_for: true }, currentObject, {
1623
+ scale: _ctx.scale,
1624
+ onClick: (e) => handleClick(e, annotation)
1625
+ }), null, 16, ["scale", "onClick"])
1626
+ ]),
1627
+ "selection-menu": withCtx((slotProps) => [
1628
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1629
+ ]),
1630
+ _: 2
1631
+ }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig"])) : createCommentVNode("", true)
1632
+ ], 64);
1633
+ }), 128);
1634
+ };
1635
+ }
1636
+ });
1637
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1638
+ __name: "text-markup",
1639
+ props: {
1640
+ pageIndex: {},
1641
+ scale: {}
1642
+ },
1643
+ setup(__props) {
1644
+ const props = __props;
1645
+ const { provides: selectionProvides } = useSelectionCapability();
1646
+ const { provides: annotationProvides } = useAnnotationCapability();
1647
+ const rects = ref([]);
1648
+ const boundingRect = ref(null);
1649
+ const activeTool = ref(null);
1650
+ watchEffect((onCleanup) => {
1651
+ const unsubscribers = [];
1652
+ if (selectionProvides.value) {
1653
+ const provides = selectionProvides.value;
1654
+ const off = provides.onSelectionChange(() => {
1655
+ rects.value = provides.getHighlightRectsForPage(props.pageIndex);
1656
+ boundingRect.value = provides.getBoundingRectForPage(props.pageIndex);
1657
+ });
1658
+ unsubscribers.push(off);
1659
+ }
1660
+ if (annotationProvides.value) {
1661
+ const provides = annotationProvides.value;
1662
+ const off = provides.onActiveToolChange((tool) => activeTool.value = tool);
1663
+ unsubscribers.push(off);
1664
+ }
1665
+ onCleanup(() => {
1666
+ unsubscribers.forEach((unsub) => unsub());
1667
+ });
1668
+ });
1669
+ const blendMode = computed(() => {
1670
+ if (!activeTool.value) return blendModeToCss(PdfBlendMode.Normal);
1671
+ const defaultMode = activeTool.value.defaults.type === PdfAnnotationSubtype.HIGHLIGHT ? PdfBlendMode.Multiply : PdfBlendMode.Normal;
1672
+ return blendModeToCss(activeTool.value.defaults.blendMode ?? defaultMode);
1673
+ });
1674
+ return (_ctx, _cache) => {
1675
+ return boundingRect.value && activeTool.value ? (openBlock(), createElementBlock("div", {
1676
+ key: 0,
1677
+ style: normalizeStyle({
1678
+ mixBlendMode: blendMode.value,
1679
+ pointerEvents: "none",
1680
+ position: "absolute",
1681
+ inset: 0
1682
+ })
1683
+ }, [
1684
+ activeTool.value.defaults.type === unref(PdfAnnotationSubtype).HIGHLIGHT ? (openBlock(), createBlock(_sfc_main$8, {
1685
+ key: 0,
1686
+ color: activeTool.value.defaults.color,
1687
+ opacity: activeTool.value.defaults.opacity,
1688
+ segmentRects: rects.value,
1689
+ scale: _ctx.scale
1690
+ }, null, 8, ["color", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).UNDERLINE ? (openBlock(), createBlock(_sfc_main$5, {
1691
+ key: 1,
1692
+ color: activeTool.value.defaults.color,
1693
+ opacity: activeTool.value.defaults.opacity,
1694
+ segmentRects: rects.value,
1695
+ scale: _ctx.scale
1696
+ }, null, 8, ["color", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).STRIKEOUT ? (openBlock(), createBlock(_sfc_main$6, {
1697
+ key: 2,
1698
+ color: activeTool.value.defaults.color,
1699
+ opacity: activeTool.value.defaults.opacity,
1700
+ segmentRects: rects.value,
1701
+ scale: _ctx.scale
1702
+ }, null, 8, ["color", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).SQUIGGLY ? (openBlock(), createBlock(_sfc_main$7, {
1703
+ key: 3,
1704
+ color: activeTool.value.defaults.color,
1705
+ opacity: activeTool.value.defaults.opacity,
1706
+ segmentRects: rects.value,
1707
+ scale: _ctx.scale
1708
+ }, null, 8, ["color", "opacity", "segmentRects", "scale"])) : createCommentVNode("", true)
1709
+ ], 4)) : createCommentVNode("", true);
1710
+ };
1711
+ }
1712
+ });
1713
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1714
+ __name: "preview-renderer",
1715
+ props: {
1716
+ preview: {},
1717
+ scale: {}
1718
+ },
1719
+ setup(__props) {
1720
+ const props = __props;
1721
+ const style = computed(() => ({
1722
+ position: "absolute",
1723
+ left: `${props.preview.bounds.origin.x * props.scale}px`,
1724
+ top: `${props.preview.bounds.origin.y * props.scale}px`,
1725
+ width: `${props.preview.bounds.size.width * props.scale}px`,
1726
+ height: `${props.preview.bounds.size.height * props.scale}px`,
1727
+ pointerEvents: "none",
1728
+ zIndex: 10
1729
+ }));
1730
+ return (_ctx, _cache) => {
1731
+ return openBlock(), createElementBlock("div", {
1732
+ style: normalizeStyle(style.value)
1733
+ }, [
1734
+ _ctx.preview.type === unref(PdfAnnotationSubtype).CIRCLE ? (openBlock(), createBlock(unref(_sfc_main$h), mergeProps({
1735
+ key: 0,
1736
+ isSelected: false,
1737
+ scale: _ctx.scale
1738
+ }, _ctx.preview.data), null, 16, ["scale"])) : _ctx.preview.type === unref(PdfAnnotationSubtype).SQUARE ? (openBlock(), createBlock(unref(_sfc_main$b), mergeProps({
1739
+ key: 1,
1740
+ isSelected: false,
1741
+ scale: _ctx.scale
1742
+ }, _ctx.preview.data), null, 16, ["scale"])) : _ctx.preview.type === unref(PdfAnnotationSubtype).POLYGON ? (openBlock(), createBlock(unref(_sfc_main$d), mergeProps({
1743
+ key: 2,
1744
+ isSelected: false,
1745
+ scale: _ctx.scale
1746
+ }, _ctx.preview.data), null, 16, ["scale"])) : _ctx.preview.type === unref(PdfAnnotationSubtype).POLYLINE ? (openBlock(), createBlock(unref(_sfc_main$c), mergeProps({
1747
+ key: 3,
1748
+ isSelected: false,
1749
+ scale: _ctx.scale
1750
+ }, _ctx.preview.data), null, 16, ["scale"])) : _ctx.preview.type === unref(PdfAnnotationSubtype).LINE ? (openBlock(), createBlock(unref(_sfc_main$e), mergeProps({
1751
+ key: 4,
1752
+ isSelected: false,
1753
+ scale: _ctx.scale
1754
+ }, _ctx.preview.data), null, 16, ["scale"])) : _ctx.preview.type === unref(PdfAnnotationSubtype).INK ? (openBlock(), createBlock(unref(_sfc_main$f), mergeProps({
1755
+ key: 5,
1756
+ isSelected: false,
1757
+ scale: _ctx.scale
1758
+ }, _ctx.preview.data), null, 16, ["scale"])) : _ctx.preview.type === unref(PdfAnnotationSubtype).FREETEXT ? (openBlock(), createElementBlock("div", {
1759
+ key: 6,
1760
+ style: normalizeStyle({
1761
+ width: "100%",
1762
+ height: "100%",
1763
+ border: `1px dashed ${_ctx.preview.data.fontColor || "#000000"}`,
1764
+ backgroundColor: "transparent"
1765
+ })
1766
+ }, null, 4)) : createCommentVNode("", true)
1767
+ ], 4);
1768
+ };
1769
+ }
1770
+ });
1771
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1772
+ __name: "annotation-paint-layer",
1773
+ props: {
1774
+ pageIndex: {},
1775
+ scale: {}
1776
+ },
1777
+ setup(__props) {
1778
+ const props = __props;
1779
+ const { plugin: annotationPlugin } = useAnnotationPlugin();
1780
+ const previews = ref(/* @__PURE__ */ new Map());
1781
+ const fileInputRef = ref(null);
1782
+ const canvasRef = ref(null);
1783
+ const services = computed(() => ({
1784
+ requestFile: ({ accept, onFile }) => {
1785
+ const input = fileInputRef.value;
1786
+ if (!input) return;
1787
+ input.accept = accept;
1788
+ input.onchange = (e) => {
1789
+ var _a;
1790
+ const file = (_a = e.target.files) == null ? void 0 : _a[0];
1791
+ if (file) {
1792
+ onFile(file);
1793
+ input.value = "";
1794
+ }
1795
+ };
1796
+ input.click();
1797
+ },
1798
+ processImage: ({ source, maxWidth, maxHeight, onComplete }) => {
1799
+ const canvas = canvasRef.value;
1800
+ if (!canvas || !canvas.getContext) return;
1801
+ const ctx = canvas.getContext("2d");
1802
+ if (!ctx) return;
1803
+ const img = new Image();
1804
+ img.crossOrigin = "Anonymous";
1805
+ img.onload = () => {
1806
+ let { naturalWidth: width, naturalHeight: height } = img;
1807
+ const scaleX = maxWidth ? maxWidth / width : 1;
1808
+ const scaleY = maxHeight ? maxHeight / height : 1;
1809
+ const scaleFactor = Math.min(scaleX, scaleY, 1);
1810
+ const finalWidth = width * scaleFactor;
1811
+ const finalHeight = height * scaleFactor;
1812
+ canvas.width = finalWidth;
1813
+ canvas.height = finalHeight;
1814
+ ctx.drawImage(img, 0, 0, finalWidth, finalHeight);
1815
+ const imageData = ctx.getImageData(0, 0, finalWidth, finalHeight);
1816
+ if (typeof source !== "string") URL.revokeObjectURL(img.src);
1817
+ onComplete({ imageData, width: finalWidth, height: finalHeight });
1818
+ };
1819
+ img.src = typeof source === "string" ? source : URL.createObjectURL(source);
1820
+ }
1821
+ }));
1822
+ let unregister;
1823
+ watchEffect((onCleanup) => {
1824
+ if (annotationPlugin.value) {
1825
+ unregister = annotationPlugin.value.registerPageHandlers(props.pageIndex, props.scale, {
1826
+ services: services.value,
1827
+ onPreview: (toolId, state) => {
1828
+ const next = new Map(previews.value);
1829
+ if (state) {
1830
+ next.set(toolId, state);
1831
+ } else {
1832
+ next.delete(toolId);
1833
+ }
1834
+ previews.value = next;
1835
+ }
1836
+ });
1837
+ }
1838
+ onCleanup(() => {
1839
+ unregister == null ? void 0 : unregister();
1840
+ });
1841
+ });
1842
+ return (_ctx, _cache) => {
1843
+ return openBlock(), createElementBlock(Fragment, null, [
1844
+ createElementVNode("input", {
1845
+ ref_key: "fileInputRef",
1846
+ ref: fileInputRef,
1847
+ type: "file",
1848
+ style: { "display": "none" }
1849
+ }, null, 512),
1850
+ createElementVNode("canvas", {
1851
+ ref_key: "canvasRef",
1852
+ ref: canvasRef,
1853
+ style: { "display": "none" }
1854
+ }, null, 512),
1855
+ (openBlock(true), createElementBlock(Fragment, null, renderList(previews.value.entries(), ([toolId, preview]) => {
1856
+ return openBlock(), createBlock(_sfc_main$2, {
1857
+ key: toolId,
1858
+ preview,
1859
+ scale: _ctx.scale
1860
+ }, null, 8, ["preview", "scale"]);
1861
+ }), 128))
1862
+ ], 64);
1863
+ };
1864
+ }
1865
+ });
1866
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1867
+ __name: "annotation-layer",
1868
+ props: {
1869
+ pageIndex: {},
1870
+ scale: {},
1871
+ pageWidth: {},
1872
+ pageHeight: {},
1873
+ rotation: {},
1874
+ resizeUI: {},
1875
+ vertexUI: {},
1876
+ selectionOutlineColor: {}
1877
+ },
1878
+ setup(__props) {
1879
+ const props = __props;
1880
+ return (_ctx, _cache) => {
1881
+ return openBlock(), createElementBlock("div", null, [
1882
+ createVNode(_sfc_main$4, normalizeProps(guardReactiveProps(props)), {
1883
+ "selection-menu": withCtx((slotProps) => [
1884
+ renderSlot(_ctx.$slots, "selection-menu", normalizeProps(guardReactiveProps(slotProps)))
1885
+ ]),
1886
+ "resize-handle": withCtx((slotProps) => [
1887
+ renderSlot(_ctx.$slots, "resize-handle", normalizeProps(guardReactiveProps(slotProps)))
1888
+ ]),
1889
+ "vertex-handle": withCtx((slotProps) => [
1890
+ renderSlot(_ctx.$slots, "vertex-handle", normalizeProps(guardReactiveProps(slotProps)))
1891
+ ]),
1892
+ _: 3
1893
+ }, 16),
1894
+ createVNode(_sfc_main$3, {
1895
+ pageIndex: _ctx.pageIndex,
1896
+ scale: _ctx.scale
1897
+ }, null, 8, ["pageIndex", "scale"]),
1898
+ createVNode(_sfc_main$1, {
1899
+ pageIndex: _ctx.pageIndex,
1900
+ scale: _ctx.scale
1901
+ }, null, 8, ["pageIndex", "scale"])
1902
+ ]);
1903
+ };
1904
+ }
1905
+ });
6
1906
  export {
1907
+ _sfc_main$i as AnnotationContainer,
1908
+ _sfc_main as AnnotationLayer,
1909
+ _sfc_main$1 as AnnotationPaintLayer,
1910
+ _sfc_main$4 as Annotations,
1911
+ _sfc_main$h as Circle,
1912
+ _sfc_main$g as FreeText,
1913
+ _sfc_main$8 as Highlight,
1914
+ _sfc_main$f as Ink,
1915
+ _sfc_main$e as Line,
1916
+ _sfc_main$d as Polygon,
1917
+ _sfc_main$c as Polyline,
1918
+ _sfc_main$2 as PreviewRenderer,
1919
+ _sfc_main$a as RenderAnnotation,
1920
+ _sfc_main$b as Square,
1921
+ _sfc_main$7 as Squiggly,
1922
+ _sfc_main$9 as Stamp,
1923
+ _sfc_main$6 as Strikeout,
1924
+ _sfc_main$3 as TextMarkup,
1925
+ _sfc_main$5 as Underline,
1926
+ useAnnotation,
7
1927
  useAnnotationCapability,
8
1928
  useAnnotationPlugin
9
1929
  };