@embedpdf/plugin-annotation 2.2.0 → 2.3.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 (97) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1196 -92
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +31 -2
  6. package/dist/lib/annotation-plugin.d.ts +177 -2
  7. package/dist/lib/handlers/types.d.ts +1 -1
  8. package/dist/lib/helpers.d.ts +6 -1
  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 +7 -1
  12. package/dist/lib/types.d.ts +265 -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 +857 -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 +857 -403
  22. package/dist/react/index.js.map +1 -1
  23. package/dist/shared/components/annotation-container.d.ts +8 -1
  24. package/dist/shared/components/annotation-layer.d.ts +4 -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 +2 -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 +7 -0
  35. package/dist/shared-preact/components/annotation-container.d.ts +8 -1
  36. package/dist/shared-preact/components/annotation-layer.d.ts +4 -2
  37. package/dist/shared-preact/components/annotations/ink.d.ts +3 -3
  38. package/dist/shared-preact/components/annotations/link.d.ts +28 -0
  39. package/dist/shared-preact/components/annotations.d.ts +2 -1
  40. package/dist/shared-preact/components/group-selection-box.d.ts +32 -0
  41. package/dist/shared-preact/components/index.d.ts +1 -0
  42. package/dist/shared-preact/components/text-markup/highlight.d.ts +3 -2
  43. package/dist/shared-preact/components/text-markup/squiggly.d.ts +3 -2
  44. package/dist/shared-preact/components/text-markup/strikeout.d.ts +3 -2
  45. package/dist/shared-preact/components/text-markup/underline.d.ts +3 -2
  46. package/dist/shared-preact/components/types.d.ts +7 -0
  47. package/dist/shared-react/components/annotation-container.d.ts +8 -1
  48. package/dist/shared-react/components/annotation-layer.d.ts +4 -2
  49. package/dist/shared-react/components/annotations/ink.d.ts +3 -3
  50. package/dist/shared-react/components/annotations/link.d.ts +28 -0
  51. package/dist/shared-react/components/annotations.d.ts +2 -1
  52. package/dist/shared-react/components/group-selection-box.d.ts +32 -0
  53. package/dist/shared-react/components/index.d.ts +1 -0
  54. package/dist/shared-react/components/text-markup/highlight.d.ts +3 -2
  55. package/dist/shared-react/components/text-markup/squiggly.d.ts +3 -2
  56. package/dist/shared-react/components/text-markup/strikeout.d.ts +3 -2
  57. package/dist/shared-react/components/text-markup/underline.d.ts +3 -2
  58. package/dist/shared-react/components/types.d.ts +7 -0
  59. package/dist/svelte/components/AnnotationLayer.svelte.d.ts +5 -1
  60. package/dist/svelte/components/Annotations.svelte.d.ts +5 -1
  61. package/dist/svelte/components/GroupSelectionBox.svelte.d.ts +32 -0
  62. package/dist/svelte/components/annotations/Ink.svelte.d.ts +2 -1
  63. package/dist/svelte/components/annotations/Link.svelte.d.ts +24 -0
  64. package/dist/svelte/components/annotations/index.d.ts +1 -0
  65. package/dist/svelte/components/index.d.ts +1 -0
  66. package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +2 -1
  67. package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +2 -1
  68. package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +2 -1
  69. package/dist/svelte/components/text-markup/Underline.svelte.d.ts +2 -1
  70. package/dist/svelte/components/types.d.ts +2 -0
  71. package/dist/svelte/index.cjs +1 -1
  72. package/dist/svelte/index.cjs.map +1 -1
  73. package/dist/svelte/index.js +905 -255
  74. package/dist/svelte/index.js.map +1 -1
  75. package/dist/svelte/types.d.ts +7 -0
  76. package/dist/vue/components/annotation-container.vue.d.ts +2 -0
  77. package/dist/vue/components/annotation-layer.vue.d.ts +28 -5
  78. package/dist/vue/components/annotations/index.d.ts +1 -0
  79. package/dist/vue/components/annotations/ink.vue.d.ts +2 -2
  80. package/dist/vue/components/annotations/line.vue.d.ts +1 -1
  81. package/dist/vue/components/annotations/link.vue.d.ts +29 -0
  82. package/dist/vue/components/annotations/polygon.vue.d.ts +1 -1
  83. package/dist/vue/components/annotations/polyline.vue.d.ts +1 -1
  84. package/dist/vue/components/annotations.vue.d.ts +65 -1
  85. package/dist/vue/components/group-selection-box.vue.d.ts +73 -0
  86. package/dist/vue/components/index.d.ts +1 -0
  87. package/dist/vue/components/text-markup/highlight.vue.d.ts +2 -2
  88. package/dist/vue/components/text-markup/squiggly.vue.d.ts +2 -2
  89. package/dist/vue/components/text-markup/strikeout.vue.d.ts +2 -2
  90. package/dist/vue/components/text-markup/underline.vue.d.ts +2 -2
  91. package/dist/vue/hooks/use-annotation.d.ts +2 -0
  92. package/dist/vue/index.cjs +1 -1
  93. package/dist/vue/index.cjs.map +1 -1
  94. package/dist/vue/index.js +946 -406
  95. package/dist/vue/index.js.map +1 -1
  96. package/dist/vue/types.d.ts +7 -0
  97. package/package.json +10 -10
@@ -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("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),s=()=>t.useCapability(o.AnnotationPlugin.id),c={"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},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(o){const l=o,r="#007ACC",i="#007ACC",d=e.shallowRef(e.toRaw(l.trackedAnnotation.object)),{provides:u}=s(),{plugin:p}=a(),v=t.useDocumentPermissions(l.documentId),g=e.ref(null),m=e.shallowRef(null),k=e.computed(()=>v.value.canModifyAnnotations&&l.isDraggable&&!l.isMultiSelected),f=e.computed(()=>v.value.canModifyAnnotations&&l.isResizable&&!l.isMultiSelected),h=l.onDoubleClick?e=>{var t;v.value.canModifyAnnotations&&(null==(t=l.onDoubleClick)||t.call(l,e))}:void 0,y=e.computed(()=>u.value?u.value.forDocument(l.documentId):null),x=e.computed(()=>({...e.toRaw(l.trackedAnnotation.object),...e.toRaw(d.value)})),C=e.computed(()=>l.isSelected&&!l.isMultiSelected),S=e.computed(()=>l.isSelected&&!l.isMultiSelected&&(l.selectionMenu||N["selection-menu"])),b=e.computed(()=>({origin:{x:x.value.rect.origin.x*l.scale,y:x.value.rect.origin.y*l.scale},size:{width:x.value.rect.size.width*l.scale,height:x.value.rect.size.height*l.scale}})),w=e.computed(()=>({type:"annotation",annotation:l.trackedAnnotation,pageIndex:l.pageIndex})),B=e.computed(()=>({suggestTop:!1,spaceAbove:0,spaceBelow:0})),z=(e,t)=>l.selectionMenu?l.selectionMenu({rect:e,menuWrapperProps:t,selected:l.isSelected,placement:B.value,context:w.value}):null,I=e.computed(()=>e.toRaw(x.value).rect),P=e.computed(()=>{var t;const o=e.toRaw(x.value);return(null==(t=l.vertexConfig)?void 0:t.extractVertices(o))??[]}),A=e.computed(()=>({minWidth:10,minHeight:10,boundingBox:{width:l.pageWidth,height:l.pageHeight}})),{dragProps:M,vertices:R,resize:E}=n.useInteractionHandles({controller:{element:I,vertices:P,constraints:A,maintainAspectRatio:e.computed(()=>l.lockAspectRatio),pageRotation:e.computed(()=>l.rotation),scale:e.computed(()=>l.scale),enabled:e.computed(()=>l.isSelected&&!l.isMultiSelected),onUpdate:t=>{var o,n,r;if(!(null==(o=t.transformData)?void 0:o.type)||l.isMultiSelected)return;const i=p.value;if(!i)return;const{type:a,changes:s,metadata:c}=t.transformData,v=l.trackedAnnotation.object.id,k={width:l.pageWidth,height:l.pageHeight};if("start"===t.state&&(m.value=l.trackedAnnotation.object.rect,g.value=x.value,"move"===a?i.startDrag(l.documentId,{annotationIds:[v],pageSize:k}):"resize"===a&&i.startResize(l.documentId,{annotationIds:[v],pageSize:k,resizeHandle:(null==c?void 0:c.handle)??"se"})),s.rect&&m.value)if("move"===a){const e={x:s.rect.origin.x-m.value.origin.x,y:s.rect.origin.y-m.value.origin.y};i.updateDrag(l.documentId,e)}else"resize"===a&&i.updateResize(l.documentId,s.rect);if("vertex-edit"===a&&s.vertices&&l.vertexConfig){const o=g.value??x.value,i=l.vertexConfig.transformAnnotation(e.toRaw(o),s.vertices),p=null==(n=u.value)?void 0:n.transformAnnotation(o,{type:a,changes:i,metadata:c});p&&(d.value={...e.toRaw(d.value),...p},"end"===t.state&&(null==(r=y.value)||r.updateAnnotation(l.pageIndex,v,p)))}"end"===t.state&&(m.value=null,g.value=null,"move"===a?i.commitDrag(l.documentId):"resize"===a&&i.commitResize(l.documentId))}},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}),_=n.useDoublePressProps(h);e.watch(()=>l.trackedAnnotation.object,e=>{d.value=e},{deep:!0}),e.watchEffect(t=>{const o=p.value;if(!o)return;const n=l.trackedAnnotation.object.id,r=t=>{var o;if(t.documentId!==l.documentId)return;const r=null==(o=t.previewPatches)?void 0:o[n];"update"===t.type&&r?d.value={...e.toRaw(d.value),...r}:"cancel"===t.type&&(d.value=l.trackedAnnotation.object)},i=[o.onDragChange(r),o.onResizeChange(r)];t(()=>i.forEach(e=>e()))});const D=e.computed(()=>({position:"absolute",left:x.value.rect.origin.x*l.scale+"px",top:x.value.rect.origin.y*l.scale+"px",width:x.value.rect.size.width*l.scale+"px",height:x.value.rect.size.height*l.scale+"px",outline:C.value?`1px solid ${l.selectionOutlineColor}`:"none",outlineOffset:C.value?`${l.outlineOffset}px`:"0px",pointerEvents:l.isSelected&&!l.isMultiSelected?"auto":"none",touchAction:"none",cursor:l.isSelected&&k.value?"move":"default",zIndex:l.zIndex})),$=e.computed(()=>({...D.value,...l.style??{}})),N=e.useSlots();return(t,l)=>(e.openBlock(),e.createElementBlock("div",c,[e.createElementVNode("div",e.mergeProps({...k.value&&o.isSelected?e.unref(M):{},...e.unref(_)},{style:$.value}),[e.renderSlot(t.$slots,"default",{annotation:x.value}),o.isSelected&&f.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(E),({key:o,style:n,...l})=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o},[e.unref(N)["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(v).canModifyAnnotations&&!o.isMultiSelected&&e.unref(R).length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(e.unref(R),({key:o,style:n,...l})=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o},[e.unref(N)["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),S.value?(e.openBlock(),e.createBlock(e.unref(n.CounterRotate),{key:0,rect:b.value,rotation:o.rotation},{default:e.withCtx(({rect:n,menuWrapperProps:l})=>[o.selectionMenu?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(z(n,l)),{key:0})):e.renderSlot(t.$slots,"selection-menu",{key:1,context:w.value,selected:o.isSelected,rect:n,placement:B.value,menuWrapperProps:l})]),_:3},8,["rect","rotation"])):e.createCommentVNode("",!0)]))}}),u={key:0,"data-group-selection-box":"","data-no-interaction":""},p=e.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(t){const o=t,r=e.useSlots(),{plugin:i}=a(),s=e.shallowRef(null),c=e.ref(!1),d=e.ref(!1),p=e.computed(()=>{var e;return(null==(e=o.resizeUI)?void 0:e.color)??"#007ACC"}),v=e.computed(()=>{var e;return(null==(e=o.resizeUI)?void 0:e.size)??12}),g=e.computed(()=>{const e=o.selectedAnnotations.map(e=>e.object.rect);return l.boundingRectOrEmpty(e)}),m=e.shallowRef(g.value);e.watch(()=>g.value,e=>{c.value||d.value||(m.value=e)},{immediate:!0});const k=e.computed(()=>({position:"absolute",left:m.value.origin.x*o.scale+"px",top:m.value.origin.y*o.scale+"px",width:m.value.size.width*o.scale+"px",height:m.value.size.height*o.scale+"px",outline:`2px dashed ${o.selectionOutlineColor}`,outlineOffset:o.outlineOffset-1+"px",cursor:o.isDraggable?"move":"default",touchAction:"none",zIndex:o.zIndex})),f=e.computed(()=>({origin:{x:m.value.origin.x*o.scale,y:m.value.origin.y*o.scale},size:{width:m.value.size.width*o.scale,height:m.value.size.height*o.scale}})),h=e.computed(()=>({type:"group",annotations:o.selectedAnnotations,pageIndex:o.pageIndex})),y=e.computed(()=>({suggestTop:!1})),x=e.computed(()=>o.groupSelectionMenu||r["group-selection-menu"]),C=(e,t)=>o.groupSelectionMenu?o.groupSelectionMenu({rect:e,menuWrapperProps:t,selected:!0,placement:y.value,context:h.value}):null,S=e.computed(()=>m.value),b=e.computed(()=>({minWidth:20,minHeight:20,boundingBox:{width:o.pageWidth,height:o.pageHeight}})),{dragProps:w,resize:B}=n.useInteractionHandles({controller:{element:S,vertices:e.computed(()=>[]),constraints:b,maintainAspectRatio:e.computed(()=>!1),pageRotation:e.computed(()=>o.rotation),scale:e.computed(()=>o.scale),enabled:e.computed(()=>!0),onUpdate:e=>{var t,n;if(!(null==(t=e.transformData)?void 0:t.type))return;if(!i.value)return;const l=i.value,r=e.transformData.type,a="move"===r,u="resize"===r;if(a&&!o.isDraggable)return;"start"===e.state&&(s.value=g.value,a?(c.value=!0,l.startDrag(o.documentId,{annotationIds:o.selectedAnnotations.map(e=>e.object.id),pageSize:{width:o.pageWidth,height:o.pageHeight}})):u&&(d.value=!0,l.startResize(o.documentId,{annotationIds:o.selectedAnnotations.map(e=>e.object.id),pageSize:{width:o.pageWidth,height:o.pageHeight},resizeHandle:(null==(n=e.transformData.metadata)?void 0:n.handle)??"se"})));const p=s.value??g.value;if(a&&e.transformData.changes.rect){const t=e.transformData.changes.rect,n={x:t.origin.x-p.origin.x,y:t.origin.y-p.origin.y},r=l.updateDrag(o.documentId,n);m.value={...p,origin:{x:p.origin.x+r.x,y:p.origin.y+r.y}}}else if(u&&e.transformData.changes.rect){const t=e.transformData.changes.rect;l.updateResize(o.documentId,t),m.value=t}"end"===e.state&&(s.value=null,a&&c.value?(c.value=!1,l.commitDrag(o.documentId)):u&&d.value&&(d.value=!1,l.commitResize(o.documentId)))}},resizeUI:{handleSize:v.value,spacing:o.outlineOffset,offsetMode:"outside",includeSides:!0,zIndex:o.zIndex+1},vertexUI:{vertexSize:0,zIndex:o.zIndex},includeVertices:!1});return(o,l)=>t.selectedAnnotations.length>=2?(e.openBlock(),e.createElementBlock("div",u,[e.createElementVNode("div",e.mergeProps(t.isDraggable?e.unref(w):{},{style:k.value,onPointerdown:l[0]||(l[0]=e=>t.isDraggable?void 0:e.stopPropagation())}),[t.isResizable?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(B),({key:t,style:n,...l})=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t},[e.unref(r)["resize-handle"]?e.renderSlot(o.$slots,"resize-handle",e.mergeProps({key:0,ref_for:!0},{key:t,style:n,...l,backgroundColor:p.value}),()=>[e.createElementVNode("div",e.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:p.value}]}),null,16)]):(e.openBlock(),e.createElementBlock("div",e.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:p.value}]}),null,16))],64))),128)):e.createCommentVNode("",!0)],16),x.value?(e.openBlock(),e.createBlock(e.unref(n.CounterRotate),{key:0,rect:f.value,rotation:t.rotation},{default:e.withCtx(({rect:n,menuWrapperProps:l})=>[t.groupSelectionMenu?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(C(n,l)),{key:0})):e.renderSlot(o.$slots,"group-selection-menu",{key:1,context:h.value,selected:!0,rect:n,placement:y.value,menuWrapperProps:l})]),_:3},8,["rect","rotation"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}),v=["width","height","viewBox"],g=["cx","cy","rx","ry","fill","opacity"],m=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 s;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==(s=t.strokeDashArray)?void 0:s.join(",")}})},null,44,g)],12,v)}}}),k=["contenteditable"],f=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}=s(),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})},c=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,s=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.color??e.backgroundColor,opacity:e.opacity,width:n?`${s}%`:"100%",height:n?`${s}%`:"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(c.value),contenteditable:t.isEditing},e.toDisplayString(t.annotation.object.contents),45,k)],36))}}),h=["width","height","viewBox"],y=["d","opacity"],x=e.defineComponent({__name:"ink",props:{isSelected:{type:Boolean},strokeColor:{},opacity:{default:1},strokeWidth:{},inkList:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>o.strokeColor??"#000000"),l=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()})),r=e.computed(()=>o.rect.size.width*o.scale),i=e.computed(()=>o.rect.size.height*o.scale);return(o,a)=>(e.openBlock(),e.createElementBlock("svg",{style:e.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 ${t.rect.size.width} ${t.rect.size.height}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(o,l)=>(e.openBlock(),e.createElementBlock("path",{key:l,d:o,fill:"none",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":"visibleStroke",stroke:n.value,strokeWidth:t.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round"})},null,44,y))),128))],12,h))}}),C=["width","height","viewBox"],S=["x1","y1","x2","y2","opacity"],b=["d","transform","stroke","fill"],w=["d","transform","stroke","fill"],B=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:s}=r.value,c=Math.atan2(s-i,a-l);return{start:o.patching.createEnding(null==(e=n.lineEndings)?void 0:e.start,n.strokeWidth,c+Math.PI,l,i),end:o.patching.createEnding(null==(t=n.lineEndings)?void 0:t.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===l.PdfAnnotationBorderStyle.DASHED&&{strokeDasharray:null==(t=n.strokeDashArray)?void 0:t.join(",")}}},s=e.computed(()=>n.rect.size.width*n.scale),c=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:`${s.value}px`,height:`${c.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:s.value,height:c.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,S),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,b)):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,w)):e.createCommentVNode("",!0)],12,C)}}}),z=["width","height","viewBox"],I=["width","height"],P=["y1","x2","y2","stroke","stroke-width","stroke-dasharray"],A=["x","y","width","height","stroke","stroke-width","stroke-dasharray"],M=e.defineComponent({__name:"link",props:{isSelected:{type:Boolean},strokeColor:{default:"#0000FF"},strokeWidth:{default:2},strokeStyle:{default:l.PdfAnnotationBorderStyle.UNDERLINE},strokeDashArray:{},rect:{},scale:{},onClick:{},hasIRT:{type:Boolean,default:!1}},setup(t){const o=t,n=e.computed(()=>o.rect.size.width),r=e.computed(()=>o.rect.size.height),i=e.computed(()=>n.value*o.scale),a=e.computed(()=>r.value*o.scale),s=e.computed(()=>{var e;if(o.strokeStyle===l.PdfAnnotationBorderStyle.DASHED)return(null==(e=o.strokeDashArray)?void 0:e.join(","))??`${3*o.strokeWidth},${o.strokeWidth}`}),c=e.computed(()=>o.strokeStyle===l.PdfAnnotationBorderStyle.UNDERLINE),d=e.computed(()=>o.hasIRT?"default":o.isSelected?"move":"pointer"),u=e.computed(()=>o.hasIRT||o.isSelected?"none":"visible");return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{style:e.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} ${r.value}`},[e.createElementVNode("rect",{x:0,y:0,width:n.value,height:r.value,fill:"transparent",onPointerdown:l[0]||(l[0]=e=>t.hasIRT?void 0:t.onClick),onTouchstart:l[1]||(l[1]=e=>t.hasIRT?void 0:t.onClick),style:e.normalizeStyle({cursor:d.value,pointerEvents:u.value})},null,44,I),c.value?(e.openBlock(),e.createElementBlock("line",{key:0,x1:1,y1:r.value-1,x2:n.value-1,y2:r.value-1,stroke:t.strokeColor,"stroke-width":t.strokeWidth,"stroke-dasharray":s.value,style:{"pointer-events":"none"}},null,8,P)):(e.openBlock(),e.createElementBlock("rect",{key:1,x:t.strokeWidth/2,y:t.strokeWidth/2,width:Math.max(n.value-t.strokeWidth,0),height:Math.max(r.value-t.strokeWidth,0),fill:"transparent",stroke:t.strokeColor,"stroke-width":t.strokeWidth,"stroke-dasharray":s.value,style:{"pointer-events":"none"}},null,8,A))],12,z))}}),R=["width","height","viewBox"],E=["d","opacity"],_=["d"],D=["x","y","width","height","fill","stroke","stroke-width"],$=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),s=e.computed(()=>o.rect.size.width*o.scale),c=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:`${s.value}px`,height:`${c.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:s.value,height:c.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,E),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,_)):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,D)):e.createCommentVNode("",!0)],12,R)}}}),N=["width","height","viewBox"],j=["d","opacity"],W=["d","transform","stroke","fill"],T=["d","transform","stroke","fill"],V=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"}),s=e.computed(()=>n.rect.size.width*n.scale),c=e.computed(()=>n.rect.size.height*n.scale);return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{style:e.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 ${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,j),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,W)):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,T)):e.createCommentVNode("",!0)],12,N))}}),L=["width","height","viewBox"],F=["x","y","width","height","fill","opacity"],U=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 s;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==(s=t.strokeDashArray)?void 0:s.join(",")}})},null,44,F)],12,L)}}}),O=["src"],H=e.defineComponent({__name:"render-annotation",props:{documentId:{},pageIndex:{},annotation:{},scaleFactor:{default:1},style:{}},setup(t){const o=t,{provides:r}=s(),i=e.ref(null),a=e.ref(null),c=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,s)=>{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}});c.value=e,e.wait(e=>{const t=URL.createObjectURL(e);i.value=t,a.value=t},l.ignore),s(()=>{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),c.value&&c.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,O)):e.createCommentVNode("",!0)}}),q=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(H,{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))}),G=e.defineComponent({__name:"highlight",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>o.strokeColor??"#FFFF00");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:n.value,opacity:t.opacity,pointerEvents:t.onClick?"auto":"none",cursor:t.onClick?"pointer":"default",zIndex:t.onClick?1:void 0})},null,36))),128))}}),K=e.defineComponent({__name:"squiggly",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>o.strokeColor??"#FFFF00"),l=e.computed(()=>2*o.scale),r=e.computed(()=>6*o.scale),i=e.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(o,n)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,(o,a)=>(e.openBlock(),e.createElementBlock("div",{key:a,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:"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*l.value+"px",backgroundImage:i.value,backgroundRepeat:"repeat-x",backgroundSize:`${r.value}px ${2*l.value}px`,opacity:t.opacity,pointerEvents:"none"})},null,4)],36))),128))}}),Y=e.defineComponent({__name:"strikeout",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>o.strokeColor??"#FFFF00"),l=e.computed(()=>2*o.scale);return(o,r)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,(o,i)=>(e.openBlock(),e.createElementBlock("div",{key:i,onPointerdown:r[0]||(r[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:r[1]||(r[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:`${l.value}px`,background:n.value,opacity:t.opacity,transform:"translateY(-50%)",pointerEvents:"none"})},null,4)],36))),128))}}),Q=e.defineComponent({__name:"underline",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>o.strokeColor??"#FFFF00"),l=e.computed(()=>2*o.scale);return(o,r)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,(o,i)=>(e.openBlock(),e.createElementBlock("div",{key:i,onPointerdown:r[0]||(r[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:r[1]||(r[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:`${l.value}px`,background:n.value,opacity:t.opacity,pointerEvents:"none"})},null,4)],36))),128))}}),X=e.defineComponent({__name:"annotations",props:{documentId:{},pageIndex:{},scale:{},rotation:{},pageWidth:{},pageHeight:{},resizeUI:{},vertexUI:{},selectionOutlineColor:{},selectionMenu:{type:Function},groupSelectionMenu:{type:Function}},setup(t){const n=t,{provides:a}=s(),{provides:c}=i.useSelectionCapability(),u=e.ref([]),v=e.ref([]),{register:g}=r.usePointerHandlers({documentId:()=>n.documentId,pageIndex:n.pageIndex}),k=e.ref(null),h=e.computed(()=>a.value?a.value.forDocument(n.documentId):null),y=e.computed(()=>v.value.length>1);e.watchEffect(e=>{if(h.value){const t=h.value.getState();u.value=o.getAnnotationsByPageIndex(t,n.pageIndex),v.value=o.getSelectedAnnotationIds(t);e(h.value.onStateChange(e=>{u.value=o.getAnnotationsByPageIndex(e,n.pageIndex),v.value=o.getSelectedAnnotationIds(e)}))}});const C=(e,t)=>{t.target===t.currentTarget&&h.value&&(h.value.deselectAnnotation(),k.value=null)},S=(e,t)=>{if(e.stopPropagation(),h.value&&c.value){c.value.clear();"metaKey"in e&&(e.metaKey||e.ctrlKey)?h.value.toggleSelection(n.pageIndex,t.object.id):h.value.selectAnnotation(n.pageIndex,t.object.id),t.object.id!==k.value&&(k.value=null)}},b=(e,t)=>{if(e.stopPropagation(),h.value&&c.value){if(c.value.clear(),t.object.inReplyToId){const e=t.object.inReplyToId,o=u.value.find(t=>t.object.id===e);if(o)return void h.value.selectAnnotation(o.object.pageIndex,e)}h.value.selectAnnotation(n.pageIndex,t.object.id)}};e.watchEffect(e=>{if(h.value){const t=g({onPointerDown:C});t&&e(t)}});const w=e=>v.value.includes(e.object.id),z=e.computed(()=>u.value.filter(e=>v.value.includes(e.object.id))),I=e.computed(()=>!(z.value.length<2)&&z.value.every(e=>{var t;const o=null==(t=h.value)?void 0:t.findToolForAnnotation(e.object);return(null==o?void 0:o.interaction.isGroupDraggable)??(null==o?void 0:o.interaction.isDraggable)??!0})),P=e.computed(()=>!(z.value.length<2)&&z.value.every(e=>{var t;const o=null==(t=h.value)?void 0:t.findToolForAnnotation(e.object);return(null==o?void 0:o.interaction.isGroupResizable)??(null==o?void 0:o.interaction.isResizable)??!0})),A=e.computed(()=>{if(!h.value)return!1;if(v.value.length<2)return!1;return h.value.getSelectedAnnotations().every(e=>e.object.pageIndex===n.pageIndex)}),R=e=>{var t;return null==(t=h.value)?void 0:t.findToolForAnnotation(e.object)},E=e=>{var t;return(!o.isFreeText(e)||k.value!==e.object.id)&&(!y.value&&((null==(t=R(e))?void 0:t.interaction.isDraggable)??!1))},_=e=>{var t;return!y.value&&((null==(t=R(e))?void 0:t.interaction.isResizable)??!1)},D=e=>{var t;return(null==(t=R(e))?void 0:t.interaction.lockAspectRatio)??!1},N=e=>w(e)&&!y.value,j=e.computed(()=>{const{selectionMenu:e,groupSelectionMenu:t,...o}=n;return o}),W=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(n,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,r=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.object.id},[e.unref(o.isInk)(r)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:0,trackedAnnotation:r,isSelected:N(r),isDraggable:E(r),isResizable:_(r),lockAspectRatio:D(r),onSelect:e=>S(e,r),vertexConfig:W(r),selectionMenu:y.value?void 0:t.selectionMenu,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},j.value),e.createSlots({default:e.withCtx(({annotation:o})=>[e.createVNode(x,e.mergeProps({ref_for:!0},o,{isSelected:w(r),scale:t.scale,onClick:e=>S(e,r)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},[y.value?void 0:{name:"selection-menu",fn:e.withCtx(t=>[e.renderSlot(n.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):e.unref(o.isSquare)(r)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:1,trackedAnnotation:r,isSelected:N(r),isDraggable:E(r),isResizable:_(r),lockAspectRatio:D(r),onSelect:e=>S(e,r),vertexConfig:W(r),selectionMenu:y.value?void 0:t.selectionMenu,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},j.value),e.createSlots({default:e.withCtx(({annotation:o})=>[e.createVNode(U,e.mergeProps({ref_for:!0},o,{isSelected:w(r),scale:t.scale,onClick:e=>S(e,r)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},[y.value?void 0:{name:"selection-menu",fn:e.withCtx(t=>[e.renderSlot(n.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):e.unref(o.isCircle)(r)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:2,trackedAnnotation:r,isSelected:N(r),isDraggable:E(r),isResizable:_(r),lockAspectRatio:D(r),onSelect:e=>S(e,r),vertexConfig:W(r),selectionMenu:y.value?void 0:t.selectionMenu,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},j.value),e.createSlots({default:e.withCtx(({annotation:o})=>[e.createVNode(m,e.mergeProps({ref_for:!0},o,{isSelected:w(r),scale:t.scale,onClick:e=>S(e,r)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},[y.value?void 0:{name:"selection-menu",fn:e.withCtx(t=>[e.renderSlot(n.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):e.unref(o.isLine)(r)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:3,trackedAnnotation:r,isSelected:N(r),isDraggable:E(r),isResizable:_(r),lockAspectRatio:D(r),onSelect:e=>S(e,r),vertexConfig:W(r),selectionMenu:y.value?void 0:t.selectionMenu,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},j.value),e.createSlots({default:e.withCtx(({annotation:o})=>[e.createVNode(B,e.mergeProps({ref_for:!0},o,{isSelected:w(r),scale:t.scale,onClick:e=>S(e,r)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},[y.value?void 0:{name:"selection-menu",fn:e.withCtx(t=>[e.renderSlot(n.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):e.unref(o.isPolyline)(r)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:4,trackedAnnotation:r,isSelected:N(r),isDraggable:E(r),isResizable:_(r),lockAspectRatio:D(r),onSelect:e=>S(e,r),vertexConfig:W(r),selectionMenu:y.value?void 0:t.selectionMenu,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},j.value),e.createSlots({default:e.withCtx(({annotation:o})=>[e.createVNode(V,e.mergeProps({ref_for:!0},o,{isSelected:w(r),scale:t.scale,onClick:e=>S(e,r)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},[y.value?void 0:{name:"selection-menu",fn:e.withCtx(t=>[e.renderSlot(n.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):e.unref(o.isPolygon)(r)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:5,trackedAnnotation:r,isSelected:N(r),isDraggable:E(r),isResizable:_(r),lockAspectRatio:D(r),onSelect:e=>S(e,r),vertexConfig:W(r),selectionMenu:y.value?void 0:t.selectionMenu,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},j.value),e.createSlots({default:e.withCtx(({annotation:o})=>[e.createVNode($,e.mergeProps({ref_for:!0},o,{isSelected:w(r),scale:t.scale,onClick:e=>S(e,r)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},[y.value?void 0:{name:"selection-menu",fn:e.withCtx(t=>[e.renderSlot(n.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):e.unref(o.isFreeText)(r)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:6,trackedAnnotation:r,isSelected:N(r),isDraggable:E(r),isResizable:_(r),lockAspectRatio:D(r),onSelect:e=>S(e,r),onDoubleClick:e=>{return t=r.object.id,void(o.isFreeText(u.value.find(e=>e.object.id===t))&&(k.value=t));var t},vertexConfig:W(r),selectionMenu:y.value?void 0:t.selectionMenu,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},j.value),e.createSlots({default:e.withCtx(({annotation:o})=>[e.createVNode(f,{isSelected:w(r),isEditing:k.value===r.object.id,annotation:{...r,object:o},pageIndex:t.pageIndex,scale:t.scale,onClick:e=>S(e,r)},null,8,["isSelected","isEditing","annotation","pageIndex","scale","onClick"])]),"resize-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},[y.value?void 0:{name:"selection-menu",fn:e.withCtx(t=>[e.renderSlot(n.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","onDoubleClick","vertexConfig","selectionMenu","style"])):e.unref(o.isStamp)(r)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:7,trackedAnnotation:r,isSelected:N(r),isDraggable:E(r),isResizable:_(r),lockAspectRatio:D(r),onSelect:e=>S(e,r),vertexConfig:W(r),selectionMenu:y.value?void 0:t.selectionMenu,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},j.value),e.createSlots({default:e.withCtx(()=>[e.createVNode(q,{documentId:t.documentId,isSelected:w(r),annotation:r,pageIndex:t.pageIndex,scale:t.scale,onClick:e=>S(e,r)},null,8,["documentId","isSelected","annotation","pageIndex","scale","onClick"])]),"resize-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},[y.value?void 0:{name:"selection-menu",fn:e.withCtx(t=>[e.renderSlot(n.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):e.unref(o.isUnderline)(r)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:8,trackedAnnotation:r,isSelected:N(r),isDraggable:E(r),isResizable:_(r),lockAspectRatio:D(r),onSelect:e=>S(e,r),vertexConfig:W(r),selectionMenu:y.value?void 0:t.selectionMenu,zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},j.value),e.createSlots({default:e.withCtx(({annotation:o})=>[e.createVNode(Q,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>S(e,r)}),null,16,["scale","onClick"])]),_:2},[y.value?void 0:{name:"selection-menu",fn:e.withCtx(t=>[e.renderSlot(n.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):e.unref(o.isStrikeout)(r)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:9,trackedAnnotation:r,isSelected:N(r),isDraggable:E(r),isResizable:_(r),lockAspectRatio:D(r),onSelect:e=>S(e,r),vertexConfig:W(r),selectionMenu:y.value?void 0:t.selectionMenu,zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},j.value),e.createSlots({default:e.withCtx(({annotation:o})=>[e.createVNode(Y,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>S(e,r)}),null,16,["scale","onClick"])]),_:2},[y.value?void 0:{name:"selection-menu",fn:e.withCtx(t=>[e.renderSlot(n.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):e.unref(o.isSquiggly)(r)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:10,trackedAnnotation:r,isSelected:N(r),isDraggable:E(r),isResizable:_(r),lockAspectRatio:D(r),onSelect:e=>S(e,r),vertexConfig:W(r),selectionMenu:y.value?void 0:t.selectionMenu,zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},j.value),e.createSlots({default:e.withCtx(({annotation:o})=>[e.createVNode(K,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>S(e,r)}),null,16,["scale","onClick"])]),_:2},[y.value?void 0:{name:"selection-menu",fn:e.withCtx(t=>[e.renderSlot(n.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):e.unref(o.isHighlight)(r)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:11,trackedAnnotation:r,isSelected:N(r),isDraggable:E(r),isResizable:_(r),lockAspectRatio:D(r),onSelect:e=>S(e,r),vertexConfig:W(r),selectionMenu:y.value?void 0:t.selectionMenu,zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Multiply)}},{ref_for:!0},j.value),e.createSlots({default:e.withCtx(({annotation:o})=>[e.createVNode(G,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>S(e,r)}),null,16,["scale","onClick"])]),_:2},[y.value?void 0:{name:"selection-menu",fn:e.withCtx(t=>[e.renderSlot(n.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):e.unref(o.isLink)(r)?(e.openBlock(),e.createBlock(d,e.mergeProps({key:12,trackedAnnotation:r,isSelected:N(r),isMultiSelected:y.value,isDraggable:!1,isResizable:!1,lockAspectRatio:!1,onSelect:e=>b(e,r),selectionMenu:r.object.inReplyToId||y.value?void 0:t.selectionMenu,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},j.value),e.createSlots({default:e.withCtx(({annotation:o})=>[e.createVNode(M,e.mergeProps({ref_for:!0},o,{isSelected:w(r),scale:t.scale,onClick:e=>b(e,r),hasIRT:!!r.object.inReplyToId}),null,16,["isSelected","scale","onClick","hasIRT"])]),"resize-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),_:2},[y.value||r.object.inReplyToId?void 0:{name:"selection-menu",fn:e.withCtx(t=>[e.renderSlot(n.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isMultiSelected","onSelect","selectionMenu","style"])):e.createCommentVNode("",!0)],64))),128)),A.value&&z.value.length>=2?(e.openBlock(),e.createBlock(p,{key:0,documentId:t.documentId,pageIndex:t.pageIndex,scale:t.scale,rotation:t.rotation,pageWidth:t.pageWidth,pageHeight:t.pageHeight,selectedAnnotations:z.value,isDraggable:I.value,isResizable:P.value,resizeUI:t.resizeUI,selectionOutlineColor:t.selectionOutlineColor,groupSelectionMenu:t.groupSelectionMenu},{"group-selection-menu":e.withCtx(t=>[e.renderSlot(n.$slots,"group-selection-menu",e.normalizeProps(e.guardReactiveProps(t)))]),"resize-handle":e.withCtx(t=>[e.renderSlot(n.$slots,"resize-handle",e.normalizeProps(e.guardReactiveProps(t)))]),_:3},8,["documentId","pageIndex","scale","rotation","pageWidth","pageHeight","selectedAnnotations","isDraggable","isResizable","resizeUI","selectionOutlineColor","groupSelectionMenu"])):e.createCommentVNode("",!0)],64))}}),Z=e.defineComponent({__name:"text-markup",props:{documentId:{},pageIndex:{},scale:{}},setup(t){const o=t,{provides:n}=i.useSelectionCapability(),{provides:r}=s(),a=e.ref([]),c=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),c.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)=>c.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(G,{key:0,strokeColor:d.value.defaults.strokeColor,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).UNDERLINE?(e.openBlock(),e.createBlock(Q,{key:1,strokeColor:d.value.defaults.strokeColor,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).STRIKEOUT?(e.openBlock(),e.createBlock(Y,{key:2,strokeColor:d.value.defaults.strokeColor,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).SQUIGGLY?(e.openBlock(),e.createBlock(K,{key:3,strokeColor:d.value.defaults.strokeColor,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0)}}),J=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(m),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(U),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($),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(V),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(B),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(x),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))}}),ee=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),s=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: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 e.watchEffect(e=>{n.value&&(c=n.value.registerPageHandlers(o.documentId,o.pageIndex,o.scale,{services:s.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()})}),(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(J,{key:o,preview:n,scale:t.scale},null,8,["preview","scale"]))),128))],64))}}),te=e.defineComponent({__name:"annotation-layer",props:{documentId:{},pageIndex:{},scale:{},rotation:{},resizeUI:{},vertexUI:{},selectionOutlineColor:{},selectionMenu:{type:Function},groupSelectionMenu:{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}),s=e.computed(()=>{var e,t;return(null==(t=null==(e=i.value)?void 0:e.size)?void 0:t.height)??0}),c=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(X,{documentId:o.documentId,pageIndex:o.pageIndex,scale:c.value,rotation:d.value,pageWidth:a.value,pageHeight:s.value,resizeUI:o.resizeUI,vertexUI:o.vertexUI,selectionOutlineColor:o.selectionOutlineColor,selectionMenu:o.selectionMenu,groupSelectionMenu:o.groupSelectionMenu},{"selection-menu":e.withCtx(o=>[e.renderSlot(t.$slots,"selection-menu",e.normalizeProps(e.guardReactiveProps(o)))]),"group-selection-menu":e.withCtx(o=>[e.renderSlot(t.$slots,"group-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","groupSelectionMenu"]),e.createVNode(Z,{documentId:o.documentId,pageIndex:o.pageIndex,scale:c.value},null,8,["documentId","pageIndex","scale"]),e.createVNode(ee,{documentId:o.documentId,pageIndex:o.pageIndex,scale:c.value},null,8,["documentId","pageIndex","scale"])]))}});exports.AnnotationContainer=d,exports.AnnotationLayer=te,exports.AnnotationPaintLayer=ee,exports.Annotations=X,exports.Circle=m,exports.FreeText=f,exports.GroupSelectionBox=p,exports.Highlight=G,exports.Ink=x,exports.Line=B,exports.Link=M,exports.Polygon=$,exports.Polyline=V,exports.PreviewRenderer=J,exports.RenderAnnotation=H,exports.Square=U,exports.Squiggly=K,exports.Stamp=q,exports.Strikeout=Y,exports.TextMarkup=Z,exports.Underline=Q,exports.useAnnotation=t=>{var n,l;const{provides:r}=s(),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=s,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]})});
2
2
  //# sourceMappingURL=index.cjs.map