@eternalheart/vue-file-preview 1.1.4

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 (218) hide show
  1. package/lib/FilePreviewContent.vue.d.ts +21 -0
  2. package/lib/FilePreviewContent.vue.d.ts.map +1 -0
  3. package/lib/FilePreviewEmbed.vue.d.ts +23 -0
  4. package/lib/FilePreviewEmbed.vue.d.ts.map +1 -0
  5. package/lib/FilePreviewModal.vue.d.ts +19 -0
  6. package/lib/FilePreviewModal.vue.d.ts.map +1 -0
  7. package/lib/__vite-browser-external-BcPniuRQ.cjs +2 -0
  8. package/lib/__vite-browser-external-BcPniuRQ.cjs.map +1 -0
  9. package/lib/__vite-browser-external-DYxpcVy9.js +5 -0
  10. package/lib/__vite-browser-external-DYxpcVy9.js.map +1 -0
  11. package/lib/composables/useAudioPlayer.d.ts +25 -0
  12. package/lib/composables/useAudioPlayer.d.ts.map +1 -0
  13. package/lib/composables/useScrollLock.d.ts +8 -0
  14. package/lib/composables/useScrollLock.d.ts.map +1 -0
  15. package/lib/index.cjs +30 -0
  16. package/lib/index.cjs.map +1 -0
  17. package/lib/index.css +1 -0
  18. package/lib/index.d.ts +9 -0
  19. package/lib/index.d.ts.map +1 -0
  20. package/lib/index.mjs +16260 -0
  21. package/lib/index.mjs.map +1 -0
  22. package/lib/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  23. package/lib/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  24. package/lib/pdfjs/cmaps/78-H.bcmap +0 -0
  25. package/lib/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  26. package/lib/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  27. package/lib/pdfjs/cmaps/78-V.bcmap +0 -0
  28. package/lib/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  29. package/lib/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  30. package/lib/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  31. package/lib/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  32. package/lib/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  33. package/lib/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  34. package/lib/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  35. package/lib/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  36. package/lib/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  37. package/lib/pdfjs/cmaps/Add-H.bcmap +0 -0
  38. package/lib/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  39. package/lib/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  40. package/lib/pdfjs/cmaps/Add-V.bcmap +0 -0
  41. package/lib/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  42. package/lib/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  43. package/lib/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  44. package/lib/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  45. package/lib/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  46. package/lib/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  47. package/lib/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  48. package/lib/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  49. package/lib/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  50. package/lib/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  51. package/lib/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  52. package/lib/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  53. package/lib/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  54. package/lib/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  55. package/lib/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  56. package/lib/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  57. package/lib/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  58. package/lib/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  59. package/lib/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  60. package/lib/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  61. package/lib/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  62. package/lib/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  63. package/lib/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  64. package/lib/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  65. package/lib/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  66. package/lib/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  67. package/lib/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  68. package/lib/pdfjs/cmaps/B5-H.bcmap +0 -0
  69. package/lib/pdfjs/cmaps/B5-V.bcmap +0 -0
  70. package/lib/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  71. package/lib/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  72. package/lib/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  73. package/lib/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  74. package/lib/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  75. package/lib/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  76. package/lib/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  77. package/lib/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  78. package/lib/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  79. package/lib/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  80. package/lib/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  81. package/lib/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  82. package/lib/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  83. package/lib/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  84. package/lib/pdfjs/cmaps/EUC-H.bcmap +0 -0
  85. package/lib/pdfjs/cmaps/EUC-V.bcmap +0 -0
  86. package/lib/pdfjs/cmaps/Ext-H.bcmap +0 -0
  87. package/lib/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  88. package/lib/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  89. package/lib/pdfjs/cmaps/Ext-V.bcmap +0 -0
  90. package/lib/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  91. package/lib/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  92. package/lib/pdfjs/cmaps/GB-H.bcmap +4 -0
  93. package/lib/pdfjs/cmaps/GB-V.bcmap +0 -0
  94. package/lib/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  95. package/lib/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  96. package/lib/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  97. package/lib/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  98. package/lib/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  99. package/lib/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  100. package/lib/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  101. package/lib/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  102. package/lib/pdfjs/cmaps/GBT-H.bcmap +0 -0
  103. package/lib/pdfjs/cmaps/GBT-V.bcmap +0 -0
  104. package/lib/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  105. package/lib/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  106. package/lib/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  107. package/lib/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  108. package/lib/pdfjs/cmaps/H.bcmap +0 -0
  109. package/lib/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  110. package/lib/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  111. package/lib/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  112. package/lib/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  113. package/lib/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  114. package/lib/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  115. package/lib/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  116. package/lib/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  117. package/lib/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  118. package/lib/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  119. package/lib/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  120. package/lib/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  121. package/lib/pdfjs/cmaps/Hankaku.bcmap +0 -0
  122. package/lib/pdfjs/cmaps/Hiragana.bcmap +0 -0
  123. package/lib/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  124. package/lib/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  125. package/lib/pdfjs/cmaps/KSC-H.bcmap +0 -0
  126. package/lib/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  127. package/lib/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  128. package/lib/pdfjs/cmaps/KSC-V.bcmap +0 -0
  129. package/lib/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  130. package/lib/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  131. package/lib/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  132. package/lib/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  133. package/lib/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  134. package/lib/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  135. package/lib/pdfjs/cmaps/Katakana.bcmap +0 -0
  136. package/lib/pdfjs/cmaps/LICENSE +36 -0
  137. package/lib/pdfjs/cmaps/NWP-H.bcmap +0 -0
  138. package/lib/pdfjs/cmaps/NWP-V.bcmap +0 -0
  139. package/lib/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  140. package/lib/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  141. package/lib/pdfjs/cmaps/Roman.bcmap +0 -0
  142. package/lib/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  143. package/lib/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  144. package/lib/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  145. package/lib/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  146. package/lib/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  147. package/lib/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  148. package/lib/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  149. package/lib/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  150. package/lib/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  151. package/lib/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  152. package/lib/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  153. package/lib/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  154. package/lib/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  155. package/lib/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  156. package/lib/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  157. package/lib/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  158. package/lib/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  159. package/lib/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  160. package/lib/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  161. package/lib/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  162. package/lib/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  163. package/lib/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  164. package/lib/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  165. package/lib/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  166. package/lib/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  167. package/lib/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  168. package/lib/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  169. package/lib/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  170. package/lib/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  171. package/lib/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  172. package/lib/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  173. package/lib/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  174. package/lib/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  175. package/lib/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  176. package/lib/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  177. package/lib/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  178. package/lib/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  179. package/lib/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  180. package/lib/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  181. package/lib/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  182. package/lib/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  183. package/lib/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  184. package/lib/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  185. package/lib/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  186. package/lib/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  187. package/lib/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  188. package/lib/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  189. package/lib/pdfjs/cmaps/V.bcmap +0 -0
  190. package/lib/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  191. package/lib/pdfjs/pdf.worker.min.mjs +21 -0
  192. package/lib/renderers/AudioRenderer.vue.d.ts +7 -0
  193. package/lib/renderers/AudioRenderer.vue.d.ts.map +1 -0
  194. package/lib/renderers/DocxRenderer.vue.d.ts +6 -0
  195. package/lib/renderers/DocxRenderer.vue.d.ts.map +1 -0
  196. package/lib/renderers/EpubRenderer.vue.d.ts +17 -0
  197. package/lib/renderers/EpubRenderer.vue.d.ts.map +1 -0
  198. package/lib/renderers/ImageRenderer.vue.d.ts +18 -0
  199. package/lib/renderers/ImageRenderer.vue.d.ts.map +1 -0
  200. package/lib/renderers/MarkdownRenderer.vue.d.ts +6 -0
  201. package/lib/renderers/MarkdownRenderer.vue.d.ts.map +1 -0
  202. package/lib/renderers/MsgRenderer.vue.d.ts +6 -0
  203. package/lib/renderers/MsgRenderer.vue.d.ts.map +1 -0
  204. package/lib/renderers/PdfRenderer.vue.d.ts +16 -0
  205. package/lib/renderers/PdfRenderer.vue.d.ts.map +1 -0
  206. package/lib/renderers/PptxRenderer.vue.d.ts +9 -0
  207. package/lib/renderers/PptxRenderer.vue.d.ts.map +1 -0
  208. package/lib/renderers/TextRenderer.vue.d.ts +7 -0
  209. package/lib/renderers/TextRenderer.vue.d.ts.map +1 -0
  210. package/lib/renderers/UnsupportedRenderer.vue.d.ts +11 -0
  211. package/lib/renderers/UnsupportedRenderer.vue.d.ts.map +1 -0
  212. package/lib/renderers/VideoRenderer.vue.d.ts +7 -0
  213. package/lib/renderers/VideoRenderer.vue.d.ts.map +1 -0
  214. package/lib/renderers/XlsxRenderer.vue.d.ts +6 -0
  215. package/lib/renderers/XlsxRenderer.vue.d.ts.map +1 -0
  216. package/lib/types.d.ts +23 -0
  217. package/lib/types.d.ts.map +1 -0
  218. package/package.json +99 -0
package/lib/index.cjs ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";var Ef=Object.defineProperty;var Gh=u=>{throw TypeError(u)};var kf=(u,t,e)=>t in u?Ef(u,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[t]=e;var q=(u,t,e)=>kf(u,typeof t!="symbol"?t+"":t,e),nc=(u,t,e)=>t.has(u)||Gh("Cannot "+e);var r=(u,t,e)=>(nc(u,t,"read from private field"),e?e.call(u):t.get(u)),w=(u,t,e)=>t.has(u)?Gh("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(u):t.set(u,e),v=(u,t,e,s)=>(nc(u,t,"write to private field"),s?s.call(u,e):t.set(u,e),e),b=(u,t,e)=>(nc(u,t,"access private method"),e);var ee=(u,t,e,s)=>({set _(i){v(u,t,i,e)},get _(){return r(u,t,s)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),W=require("lucide-vue-next"),Me=require("@eternalheart/file-preview-core"),Sf=require("mammoth"),Cf=require("exceljs"),Tf=require("x-data-spreadsheet"),rc=require("pptx-preview"),Mf=require("@kenjiuno/msgreader"),Rf=require("@likecoin/epub-ts"),Pf=require("video.js"),Lf=require("markdown-it"),md=require("shiki"),Nf="1.1.4",If={version:Nf},Ff={key:0,class:"vfp-flex vfp-items-center vfp-justify-center"},Df={key:1,class:"vfp-text-white/70 vfp-text-center"},Of={class:"vfp-text-lg"},Bf=["src"],Vf={key:2,class:"vfp-absolute vfp-bottom-2 vfp-right-3 vfp-text-[10px] vfp-text-white/30 hover:vfp-text-white/80 vfp-transition-colors vfp-pointer-events-auto vfp-select-none vfp-cursor-default"},Hf=l.defineComponent({__name:"ImageRenderer",props:{url:{},zoom:{},rotation:{},resetKey:{},fileSize:{}},emits:["zoomChange","naturalWidthChange","naturalHeightChange"],setup(u,{emit:t}){const e=u,s=t,i=l.ref(!1),n=l.ref(null),a=l.ref({x:0,y:0}),o=l.ref(!1);let c={x:0,y:0};const h=l.ref(1),d=l.ref({width:0,height:0}),f=l.ref(null),p=l.ref(null);l.watch(()=>e.url,()=>{i.value=!1,n.value=null,a.value={x:0,y:0},h.value=1}),l.watch(()=>e.zoom,M=>{h.value=M}),l.watch(()=>e.resetKey,()=>{a.value={x:0,y:0}});const g=(M,P)=>{const N=p.value;if(!N||d.value.width===0)return M;const H=N.clientWidth,L=N.clientHeight,S=d.value.width*P,R=d.value.height*P,F=Math.min(80,H*.15,L*.15),V=(H+S)/2-F,$=(L+R)/2-F;return{x:V>0?Math.max(-V,Math.min(V,M.x)):0,y:$>0?Math.max(-$,Math.min($,M.y)):0}},m=M=>{i.value=!0;const P=M.currentTarget;d.value={width:P.naturalWidth,height:P.naturalHeight},s("naturalWidthChange",P.naturalWidth),s("naturalHeightChange",P.naturalHeight)},y=()=>{n.value="图片加载失败",i.value=!0},x=()=>{a.value={x:0,y:0},h.value=1,s("zoomChange",1)},A=M=>{M.preventDefault(),M.stopPropagation();const P=p.value;if(!P)return;const N=P.getBoundingClientRect(),H=M.clientX-N.left-N.width/2,L=M.clientY-N.top-N.height/2,S=M.deltaY>0?-.05:.05,R=h.value,F=Math.max(.01,Math.min(10,R+S)),V=F/R;a.value=g({x:H-V*(H-a.value.x),y:L-V*(L-a.value.y)},F),h.value=F,s("zoomChange",F)};l.onMounted(()=>{const M=p.value;M&&M.addEventListener("wheel",A,{passive:!1})}),l.onBeforeUnmount(()=>{const M=p.value;M&&M.removeEventListener("wheel",A)});const _=M=>{M.button===0&&(o.value=!0,c={x:M.clientX-a.value.x,y:M.clientY-a.value.y})},E=M=>{o.value&&(a.value=g({x:M.clientX-c.x,y:M.clientY-c.y},h.value))},k=()=>{o.value=!1},C=l.computed(()=>({transform:`translate(${a.value.x}px, ${a.value.y}px) scale(${h.value}) rotate(${e.rotation}deg)`,transformOrigin:"center",transition:o.value?"none":"transform 0.3s ease-out",opacity:i.value?1:0})),T=l.computed(()=>e.fileSize==null?"":` · ${Me.formatFileSize(e.fileSize)}`);return(M,P)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"containerRef",ref:p,class:"vfp-relative vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-overflow-hidden",style:l.normalizeStyle({cursor:o.value?"grabbing":"grab"}),onMousedown:_,onMousemove:E,onMouseup:k,onMouseleave:k},[!i.value&&!n.value?(l.openBlock(),l.createElementBlock("div",Ff,[...P[0]||(P[0]=[l.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):l.createCommentVNode("",!0),n.value?(l.openBlock(),l.createElementBlock("div",Df,[l.createElementVNode("p",Of,l.toDisplayString(n.value),1)])):l.createCommentVNode("",!0),l.createElementVNode("img",{ref_key:"imgRef",ref:f,src:u.url,alt:"Preview",class:l.normalizeClass(["vfp-max-w-none vfp-select-none",!i.value&&"vfp-hidden"]),style:l.normalizeStyle(C.value),draggable:!1,onLoad:m,onError:y,onDblclick:x},null,46,Bf),i.value&&!n.value&&d.value.width>0?(l.openBlock(),l.createElementBlock("div",Vf,l.toDisplayString(d.value.width)+" × "+l.toDisplayString(d.value.height)+l.toDisplayString(T.value),1)):l.createCommentVNode("",!0)],36))}});var _a={};_a.d=(u,t)=>{for(var e in t)_a.o(t,e)&&!_a.o(u,e)&&Object.defineProperty(u,e,{enumerable:!0,get:t[e]})};_a.o=(u,t)=>Object.prototype.hasOwnProperty.call(u,t);var Y=globalThis.pdfjsLib={};_a.d(Y,{AbortException:()=>Gn,AnnotationEditorLayer:()=>_h,AnnotationEditorParamsType:()=>X,AnnotationEditorType:()=>Q,AnnotationEditorUIManager:()=>$n,AnnotationLayer:()=>Bg,AnnotationMode:()=>ni,ColorPicker:()=>Rl,DOMSVGFactory:()=>Hh,DrawLayer:()=>Sh,FeatureTest:()=>re,GlobalWorkerOptions:()=>Ks,ImageKind:()=>Qo,InvalidPDFException:()=>bd,MissingPDFException:()=>Un,OPS:()=>$e,OutputScale:()=>mc,PDFDataRangeTransport:()=>pu,PDFDateString:()=>Nh,PDFWorker:()=>nr,PasswordResponses:()=>Wf,PermissionFlag:()=>jf,PixelsPerInch:()=>Li,RenderingCancelledException:()=>Ph,TextLayer:()=>ka,UnexpectedResponseException:()=>Zl,Util:()=>z,VerbosityLevel:()=>Yl,XfaLayer:()=>mu,build:()=>bg,createValidAbsoluteUrl:()=>Xf,fetchData:()=>tc,getDocument:()=>cg,getFilenameFromUrl:()=>ip,getPdfFilenameFromUrl:()=>np,getXfaPageViewport:()=>rp,isDataScheme:()=>ec,isPdfFile:()=>Lh,noContextMenu:()=>Ve,normalizeUnicode:()=>tp,setLayerDimensions:()=>Hn,shadow:()=>it,version:()=>vg});const te=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),vd=[1,0,0,1,0,0],uc=[.001,0,0,.001,0,0],$f=1e7,ac=1.35,Se={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},ni={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},zf="pdfjs_internal_editor_",Q={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},X={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},jf={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Xt={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Qo={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Pt={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,WIDGET:20},ia={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Yl={ERRORS:0,WARNINGS:1,INFOS:5},$e={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},Wf={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Kl=Yl.WARNINGS;function Uf(u){Number.isInteger(u)&&(Kl=u)}function Gf(){return Kl}function Ql(u){Kl>=Yl.INFOS&&console.log(`Info: ${u}`)}function J(u){Kl>=Yl.WARNINGS&&console.log(`Warning: ${u}`)}function mt(u){throw new Error(u)}function Dt(u,t){u||mt(t)}function qf(u){switch(u==null?void 0:u.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Xf(u,t=null,e=null){if(!u)return null;try{if(e&&typeof u=="string"){if(e.addDefaultProtocol&&u.startsWith("www.")){const i=u.match(/\./g);(i==null?void 0:i.length)>=2&&(u=`http://${u}`)}if(e.tryConvertEncoding)try{u=Jf(u)}catch{}}const s=t?new URL(u,t):new URL(u);if(qf(s))return s}catch{}return null}function it(u,t,e,s=!1){return Object.defineProperty(u,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}const Di=function(){function t(e,s){this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t}();class fc extends Di{constructor(t,e){super(t,"PasswordException"),this.code=e}}class pc extends Di{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class bd extends Di{constructor(t){super(t,"InvalidPDFException")}}class Un extends Di{constructor(t){super(t,"MissingPDFException")}}class Zl extends Di{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class Yf extends Di{constructor(t){super(t,"FormatError")}}class Gn extends Di{constructor(t){super(t,"AbortException")}}function yd(u){(typeof u!="object"||(u==null?void 0:u.length)===void 0)&&mt("Invalid argument for bytesToString");const t=u.length,e=8192;if(t<e)return String.fromCharCode.apply(null,u);const s=[];for(let i=0;i<t;i+=e){const n=Math.min(i+e,t),a=u.subarray(i,n);s.push(String.fromCharCode.apply(null,a))}return s.join("")}function Jl(u){typeof u!="string"&&mt("Invalid argument for stringToBytes");const t=u.length,e=new Uint8Array(t);for(let s=0;s<t;++s)e[s]=u.charCodeAt(s)&255;return e}function Kf(u){return String.fromCharCode(u>>24&255,u>>16&255,u>>8&255,u&255)}function Mh(u){const t=Object.create(null);for(const[e,s]of u)t[e]=s;return t}function Qf(){const u=new Uint8Array(4);return u[0]=1,new Uint32Array(u.buffer,0,1)[0]===1}function Zf(){try{return new Function(""),!0}catch{return!1}}class re{static get isLittleEndian(){return it(this,"isLittleEndian",Qf())}static get isEvalSupported(){return it(this,"isEvalSupported",Zf())}static get isOffscreenCanvasSupported(){return it(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?it(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:typeof(navigator==null?void 0:navigator.userAgent)=="string"&&navigator.userAgent.includes("Firefox")}):it(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var t,e;return it(this,"isCSSRoundSupported",(e=(t=globalThis.CSS)==null?void 0:t.supports)==null?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const oc=Array.from(Array(256).keys(),u=>u.toString(16).padStart(2,"0"));var Zs,Zo,gc;class z{static makeHexColor(t,e,s){return`#${oc[t]}${oc[e]}${oc[s]}`}static scaleMinMax(t,e){let s;t[0]?(t[0]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[3],e[3]*=t[3]):(s=e[0],e[0]=e[1],e[1]=s,s=e[2],e[2]=e[3],e[3]=s,t[1]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){const s=t[0]*e[0]+t[1]*e[2]+e[4],i=t[0]*e[1]+t[1]*e[3]+e[5];return[s,i]}static applyInverseTransform(t,e){const s=e[0]*e[3]-e[1]*e[2],i=(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/s,n=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/s;return[i,n]}static getAxialAlignedBoundingBox(t,e){const s=this.applyTransform(t,e),i=this.applyTransform(t.slice(2,4),e),n=this.applyTransform([t[0],t[3]],e),a=this.applyTransform([t[2],t[1]],e);return[Math.min(s[0],i[0],n[0],a[0]),Math.min(s[1],i[1],n[1],a[1]),Math.max(s[0],i[0],n[0],a[0]),Math.max(s[1],i[1],n[1],a[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],s=t[0]*e[0]+t[1]*e[2],i=t[0]*e[1]+t[1]*e[3],n=t[2]*e[0]+t[3]*e[2],a=t[2]*e[1]+t[3]*e[3],o=(s+a)/2,c=Math.sqrt((s+a)**2-4*(s*a-n*i))/2,h=o+c||1,d=o-c||1;return[Math.sqrt(h),Math.sqrt(d)]}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const s=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(s>i)return null;const n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>a?null:[s,n,i,a]}static bezierBoundingBox(t,e,s,i,n,a,o,c,h){return h?(h[0]=Math.min(h[0],t,o),h[1]=Math.min(h[1],e,c),h[2]=Math.max(h[2],t,o),h[3]=Math.max(h[3],e,c)):h=[Math.min(t,o),Math.min(e,c),Math.max(t,o),Math.max(e,c)],b(this,Zs,gc).call(this,t,s,n,o,e,i,a,c,3*(-t+3*(s-n)+o),6*(t-2*s+n),3*(s-t),h),b(this,Zs,gc).call(this,t,s,n,o,e,i,a,c,3*(-e+3*(i-a)+c),6*(e-2*i+a),3*(i-e),h),h}}Zs=new WeakSet,Zo=function(t,e,s,i,n,a,o,c,h,d){if(h<=0||h>=1)return;const f=1-h,p=h*h,g=p*h,m=f*(f*(f*t+3*h*e)+3*p*s)+g*i,y=f*(f*(f*n+3*h*a)+3*p*o)+g*c;d[0]=Math.min(d[0],m),d[1]=Math.min(d[1],y),d[2]=Math.max(d[2],m),d[3]=Math.max(d[3],y)},gc=function(t,e,s,i,n,a,o,c,h,d,f,p){if(Math.abs(h)<1e-12){Math.abs(d)>=1e-12&&b(this,Zs,Zo).call(this,t,e,s,i,n,a,o,c,-f/d,p);return}const g=d**2-4*f*h;if(g<0)return;const m=Math.sqrt(g),y=2*h;b(this,Zs,Zo).call(this,t,e,s,i,n,a,o,c,(-d+m)/y,p),b(this,Zs,Zo).call(this,t,e,s,i,n,a,o,c,(-d-m)/y,p)},w(z,Zs);function Jf(u){return decodeURIComponent(escape(u))}let lc=null,qh=null;function tp(u){return lc||(lc=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,qh=new Map([["ſt","ſt"]])),u.replaceAll(lc,(t,e,s)=>e?e.normalize("NFKC"):qh.get(s))}function ep(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const u=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(u);else for(let t=0;t<32;t++)u[t]=Math.floor(Math.random()*255);return yd(u)}const Rh="pdfjs_internal_id_",As={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};function sp(u){return Uint8Array.prototype.toBase64?u.toBase64():btoa(yd(u))}const xs="http://www.w3.org/2000/svg",$i=class $i{};q($i,"CSS",96),q($i,"PDF",72),q($i,"PDF_TO_CSS_UNITS",$i.CSS/$i.PDF);let Li=$i;async function tc(u,t="text"){if(aa(u,document.baseURI)){const e=await fetch(u);if(!e.ok)throw new Error(e.statusText);switch(t){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise((e,s)=>{const i=new XMLHttpRequest;i.open("GET",u,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(i.response);return}e(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}class jo{constructor({viewBox:t,scale:e,rotation:s,offsetX:i=0,offsetY:n=0,dontFlip:a=!1}){this.viewBox=t,this.scale=e,this.rotation=s,this.offsetX=i,this.offsetY=n;const o=(t[2]+t[0])/2,c=(t[3]+t[1])/2;let h,d,f,p;switch(s%=360,s<0&&(s+=360),s){case 180:h=-1,d=0,f=0,p=1;break;case 90:h=0,d=1,f=1,p=0;break;case 270:h=0,d=-1,f=-1,p=0;break;case 0:h=1,d=0,f=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(f=-f,p=-p);let g,m,y,x;h===0?(g=Math.abs(c-t[1])*e+i,m=Math.abs(o-t[0])*e+n,y=(t[3]-t[1])*e,x=(t[2]-t[0])*e):(g=Math.abs(o-t[0])*e+i,m=Math.abs(c-t[1])*e+n,y=(t[2]-t[0])*e,x=(t[3]-t[1])*e),this.transform=[h*e,d*e,f*e,p*e,g-h*e*o-f*e*c,m-d*e*o-p*e*c],this.width=y,this.height=x}get rawDims(){const{viewBox:t}=this;return it(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:n=!1}={}){return new jo({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(t,e){return z.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=z.applyTransform([t[0],t[1]],this.transform),s=z.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){return z.applyInverseTransform([t,e],this.transform)}}class Ph extends Di{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function ec(u){const t=u.length;let e=0;for(;e<t&&u[e].trim()==="";)e++;return u.substring(e,e+5).toLowerCase()==="data:"}function Lh(u){return typeof u=="string"&&/\.pdf$/i.test(u)}function ip(u){return[u]=u.split(/[#?]/,1),u.substring(u.lastIndexOf("/")+1)}function np(u,t="document.pdf"){if(typeof u!="string")return t;if(ec(u))return J('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const e=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,s=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=e.exec(u);let n=s.exec(i[1])||s.exec(i[2])||s.exec(i[3]);if(n&&(n=n[0],n.includes("%")))try{n=s.exec(decodeURIComponent(n))[0]}catch{}return n||t}class Xh{constructor(){q(this,"started",Object.create(null));q(this,"times",[])}time(t){t in this.started&&J(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||J(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:s}of this.times)e=Math.max(s.length,e);for(const{name:s,start:i,end:n}of this.times)t.push(`${s.padEnd(e)} ${n-i}ms
2
+ `);return t.join("")}}function aa(u,t){try{const{protocol:e}=t?new URL(u,t):new URL(u);return e==="http:"||e==="https:"}catch{return!1}}function Ve(u){u.preventDefault()}function Yh(u){console.log("Deprecated API usage: "+u)}var Ca;class Nh{static toDateObject(t){if(!t||typeof t!="string")return null;r(this,Ca)||v(this,Ca,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=r(this,Ca).exec(t);if(!e)return null;const s=parseInt(e[1],10);let i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let c=parseInt(e[6],10);c=c>=0&&c<=59?c:0;const h=e[7]||"Z";let d=parseInt(e[8],10);d=d>=0&&d<=23?d:0;let f=parseInt(e[9],10)||0;return f=f>=0&&f<=59?f:0,h==="-"?(a+=d,o+=f):h==="+"&&(a-=d,o-=f),new Date(Date.UTC(s,i,n,a,o,c))}}Ca=new WeakMap,w(Nh,Ca);function rp(u,{scale:t=1,rotation:e=0}){const{width:s,height:i}=u.attributes.style,n=[0,0,parseInt(s),parseInt(i)];return new jo({viewBox:n,scale:t,rotation:e})}function Ih(u){if(u.startsWith("#")){const t=parseInt(u.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return u.startsWith("rgb(")?u.slice(4,-1).split(",").map(t=>parseInt(t)):u.startsWith("rgba(")?u.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(J(`Not a valid color format: "${u}"`),[0,0,0])}function ap(u){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const e of u.keys()){t.style.color=e;const s=window.getComputedStyle(t).color;u.set(e,Ih(s))}t.remove()}function xt(u){const{a:t,b:e,c:s,d:i,e:n,f:a}=u.getTransform();return[t,e,s,i,n,a]}function _s(u){const{a:t,b:e,c:s,d:i,e:n,f:a}=u.getTransform().invertSelf();return[t,e,s,i,n,a]}function Hn(u,t,e=!1,s=!0){if(t instanceof jo){const{pageWidth:i,pageHeight:n}=t.rawDims,{style:a}=u,o=re.isCSSRoundSupported,c=`var(--scale-factor) * ${i}px`,h=`var(--scale-factor) * ${n}px`,d=o?`round(down, ${c}, var(--scale-round-x, 1px))`:`calc(${c})`,f=o?`round(down, ${h}, var(--scale-round-y, 1px))`:`calc(${h})`;!e||t.rotation%180===0?(a.width=d,a.height=f):(a.width=f,a.height=d)}s&&u.setAttribute("data-main-rotation",t.rotation)}class mc{constructor(){const t=window.devicePixelRatio||1;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}}var ri,ji,ze,Wi,Ta,Ma,Ll,wd,ae,Ad,_d,Jo,xd,bc;const Es=class Es{constructor(t){w(this,ae);w(this,ri,null);w(this,ji,null);w(this,ze);w(this,Wi,null);w(this,Ta,null);v(this,ze,t),r(Es,Ma)||v(Es,Ma,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}render(){const t=v(this,ri,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=r(this,ze)._uiManager._signal;t.addEventListener("contextmenu",Ve,{signal:e}),t.addEventListener("pointerdown",b(Es,Ll,wd),{signal:e});const s=v(this,Wi,document.createElement("div"));s.className="buttons",t.append(s);const i=r(this,ze).toolbarPosition;if(i){const{style:n}=t,a=r(this,ze)._uiManager.direction==="ltr"?1-i[0]:i[0];n.insetInlineEnd=`${100*a}%`,n.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return b(this,ae,xd).call(this),t}get div(){return r(this,ri)}hide(){var t;r(this,ri).classList.add("hidden"),(t=r(this,ji))==null||t.hideDropdown()}show(){var t;r(this,ri).classList.remove("hidden"),(t=r(this,Ta))==null||t.shown()}async addAltText(t){const e=await t.render();b(this,ae,Jo).call(this,e),r(this,Wi).prepend(e,r(this,ae,bc)),v(this,Ta,t)}addColorPicker(t){v(this,ji,t);const e=t.renderButton();b(this,ae,Jo).call(this,e),r(this,Wi).prepend(e,r(this,ae,bc))}remove(){var t;r(this,ri).remove(),(t=r(this,ji))==null||t.destroy(),v(this,ji,null)}};ri=new WeakMap,ji=new WeakMap,ze=new WeakMap,Wi=new WeakMap,Ta=new WeakMap,Ma=new WeakMap,Ll=new WeakSet,wd=function(t){t.stopPropagation()},ae=new WeakSet,Ad=function(t){r(this,ze)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()},_d=function(t){r(this,ze)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()},Jo=function(t){const e=r(this,ze)._uiManager._signal;t.addEventListener("focusin",b(this,ae,Ad).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",b(this,ae,_d).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Ve,{signal:e})},xd=function(){const{editorType:t,_uiManager:e}=r(this,ze),s=document.createElement("button");s.className="delete",s.tabIndex=0,s.setAttribute("data-l10n-id",r(Es,Ma)[t]),b(this,ae,Jo).call(this,s),s.addEventListener("click",i=>{e.delete()},{signal:e._signal}),r(this,Wi).append(s)},bc=function(){const t=document.createElement("div");return t.className="divider",t},w(Es,Ll),w(Es,Ma,null);let vc=Es;var Ra,Ui,Gi,Ii,Ed,kd,Sd;class op{constructor(t){w(this,Ii);w(this,Ra,null);w(this,Ui,null);w(this,Gi);v(this,Gi,t)}show(t,e,s){const[i,n]=b(this,Ii,kd).call(this,e,s),{style:a}=r(this,Ui)||v(this,Ui,b(this,Ii,Ed).call(this));t.append(r(this,Ui)),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){r(this,Ui).remove()}}Ra=new WeakMap,Ui=new WeakMap,Gi=new WeakMap,Ii=new WeakSet,Ed=function(){const t=v(this,Ui,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Ve,{signal:r(this,Gi)._signal});const e=v(this,Ra,document.createElement("div"));return e.className="buttons",t.append(e),b(this,Ii,Sd).call(this),t},kd=function(t,e){let s=0,i=0;for(const n of t){const a=n.y+n.height;if(a<s)continue;const o=n.x+(e?n.width:0);if(a>s){i=o,s=a;continue}e?o>i&&(i=o):o<i&&(i=o)}return[e?1-i:i,s]},Sd=function(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const s=r(this,Gi)._signal;t.addEventListener("contextmenu",Ve,{signal:s}),t.addEventListener("click",()=>{r(this,Gi).highlightSelection("floating_button")},{signal:s}),r(this,Ra).append(t)};function Cl(u,t,e){for(const s of e)t.addEventListener(s,u[s].bind(u))}function lp(u){return Math.round(Math.min(255,Math.max(1,255*u))).toString(16).padStart(2,"0")}var Nl;class cp{constructor(){w(this,Nl,0)}get id(){return`${zf}${ee(this,Nl)._++}`}}Nl=new WeakMap;var rr,Pa,Kt,ar,tl;const jh=class jh{constructor(){w(this,ar);w(this,rr,ep());w(this,Pa,0);w(this,Kt,null)}static get _isSVGFittingCanvas(){const t='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',s=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=t;const n=i.decode().then(()=>(s.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(s.getImageData(0,0,1,1).data.buffer)[0]===0));return it(this,"_isSVGFittingCanvas",n)}async getFromFile(t){const{lastModified:e,name:s,size:i,type:n}=t;return b(this,ar,tl).call(this,`${e}_${s}_${i}_${n}`,t)}async getFromUrl(t){return b(this,ar,tl).call(this,t,t)}async getFromBlob(t,e){const s=await e;return b(this,ar,tl).call(this,t,s)}async getFromId(t){r(this,Kt)||v(this,Kt,new Map);const e=r(this,Kt).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:s}=e;return delete e.blobPromise,this.getFromBlob(e.id,s)}return this.getFromUrl(e.url)}getFromCanvas(t,e){r(this,Kt)||v(this,Kt,new Map);let s=r(this,Kt).get(t);if(s!=null&&s.bitmap)return s.refCounter+=1,s;const i=new OffscreenCanvas(e.width,e.height);return i.getContext("2d").drawImage(e,0,0),s={bitmap:i.transferToImageBitmap(),id:`image_${r(this,rr)}_${ee(this,Pa)._++}`,refCounter:1,isSvg:!1},r(this,Kt).set(t,s),r(this,Kt).set(s.id,s),s}getSvgUrl(t){const e=r(this,Kt).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){var i;r(this,Kt)||v(this,Kt,new Map);const e=r(this,Kt).get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;const{bitmap:s}=e;if(!e.url&&!e.file){const n=new OffscreenCanvas(s.width,s.height);n.getContext("bitmaprenderer").transferFromImageBitmap(s),e.blobPromise=n.convertToBlob()}(i=s.close)==null||i.call(s),e.bitmap=null}isValidId(t){return t.startsWith(`image_${r(this,rr)}_`)}};rr=new WeakMap,Pa=new WeakMap,Kt=new WeakMap,ar=new WeakSet,tl=async function(t,e){r(this,Kt)||v(this,Kt,new Map);let s=r(this,Kt).get(t);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${r(this,rr)}_${ee(this,Pa)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(s.url=e,i=await tc(e,"blob")):e instanceof File?i=s.file=e:e instanceof Blob&&(i=e),i.type==="image/svg+xml"){const n=jh._isSVGFittingCanvas,a=new FileReader,o=new Image,c=new Promise((h,d)=>{o.onload=()=>{s.bitmap=o,s.isSvg=!0,h()},a.onload=async()=>{const f=s.svgUrl=a.result;o.src=await n?`${f}#svgView(preserveAspectRatio(none))`:f},o.onerror=a.onerror=d});a.readAsDataURL(i),await c}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){console.error(i),s=null}return r(this,Kt).set(t,s),s&&r(this,Kt).set(s.id,s),s};let yc=jh;var Bt,ai,La,Vt;class hp{constructor(t=128){w(this,Bt,[]);w(this,ai,!1);w(this,La);w(this,Vt,-1);v(this,La,t)}add({cmd:t,undo:e,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(i&&t(),r(this,ai))return;const c={cmd:t,undo:e,post:s,type:n};if(r(this,Vt)===-1){r(this,Bt).length>0&&(r(this,Bt).length=0),v(this,Vt,0),r(this,Bt).push(c);return}if(a&&r(this,Bt)[r(this,Vt)].type===n){o&&(c.undo=r(this,Bt)[r(this,Vt)].undo),r(this,Bt)[r(this,Vt)]=c;return}const h=r(this,Vt)+1;h===r(this,La)?r(this,Bt).splice(0,1):(v(this,Vt,h),h<r(this,Bt).length&&r(this,Bt).splice(h)),r(this,Bt).push(c)}undo(){if(r(this,Vt)===-1)return;v(this,ai,!0);const{undo:t,post:e}=r(this,Bt)[r(this,Vt)];t(),e==null||e(),v(this,ai,!1),v(this,Vt,r(this,Vt)-1)}redo(){if(r(this,Vt)<r(this,Bt).length-1){v(this,Vt,r(this,Vt)+1),v(this,ai,!0);const{cmd:t,post:e}=r(this,Bt)[r(this,Vt)];t(),e==null||e(),v(this,ai,!1)}}hasSomethingToUndo(){return r(this,Vt)!==-1}hasSomethingToRedo(){return r(this,Vt)<r(this,Bt).length-1}destroy(){v(this,Bt,null)}}Bt=new WeakMap,ai=new WeakMap,La=new WeakMap,Vt=new WeakMap;var Il,Cd;class Wo{constructor(t){w(this,Il);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=re.platform;for(const[s,i,n={}]of t)for(const a of s){const o=a.startsWith("mac+");e&&o?(this.callbacks.set(a.slice(4),{callback:i,options:n}),this.allKeys.add(a.split("+").at(-1))):!e&&!o&&(this.callbacks.set(a,{callback:i,options:n}),this.allKeys.add(a.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const s=this.callbacks.get(b(this,Il,Cd).call(this,e));if(!s)return;const{callback:i,options:{bubbles:n=!1,args:a=[],checker:o=null}}=s;o&&!o(t,e)||(i.bind(t,...a,e)(),n||(e.stopPropagation(),e.preventDefault()))}}Il=new WeakSet,Cd=function(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e};const Fl=class Fl{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return ap(t),it(this,"_colors",t)}convert(t){const e=Ih(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[s,i]of this._colors)if(i.every((n,a)=>n===e[a]))return Fl._colorsMapping.get(s);return e}getHexCode(t){const e=this._colors.get(t);return e?z.makeHexColor(...e):t}};q(Fl,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let wc=Fl;var or,be,Nt,Wt,lr,Ss,cr,je,oi,hr,qi,is,We,Xi,Na,Ia,dr,Fa,ns,li,ur,ci,rs,Dl,hi,Da,di,Yi,Oa,Ba,Ht,ct,Cs,Ki,Va,Ha,ui,as,Ts,$a,Pe,O,el,Ac,Td,Md,sl,Rd,Pd,Ld,_c,Nd,xc,Ec,Id,se,si,Fd,Dd,kc,Od,oa,Sc;const sr=class sr{constructor(t,e,s,i,n,a,o,c,h,d,f){w(this,O);w(this,or,new AbortController);w(this,be,null);w(this,Nt,new Map);w(this,Wt,new Map);w(this,lr,null);w(this,Ss,null);w(this,cr,null);w(this,je,new hp);w(this,oi,null);w(this,hr,0);w(this,qi,new Set);w(this,is,null);w(this,We,null);w(this,Xi,new Set);w(this,Na,!1);w(this,Ia,!1);w(this,dr,!1);w(this,Fa,null);w(this,ns,null);w(this,li,null);w(this,ur,null);w(this,ci,!1);w(this,rs,null);w(this,Dl,new cp);w(this,hi,!1);w(this,Da,!1);w(this,di,null);w(this,Yi,null);w(this,Oa,null);w(this,Ba,null);w(this,Ht,Q.NONE);w(this,ct,new Set);w(this,Cs,null);w(this,Ki,null);w(this,Va,null);w(this,Ha,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});w(this,ui,[0,0]);w(this,as,null);w(this,Ts,null);w(this,$a,null);w(this,Pe,null);const p=this._signal=r(this,or).signal;v(this,Ts,t),v(this,$a,e),v(this,lr,s),this._eventBus=i,i._on("editingaction",this.onEditingAction.bind(this),{signal:p}),i._on("pagechanging",this.onPageChanging.bind(this),{signal:p}),i._on("scalechanging",this.onScaleChanging.bind(this),{signal:p}),i._on("rotationchanging",this.onRotationChanging.bind(this),{signal:p}),i._on("setpreference",this.onSetPreference.bind(this),{signal:p}),i._on("switchannotationeditorparams",g=>this.updateParams(g.type,g.value),{signal:p}),b(this,O,Rd).call(this),b(this,O,Id).call(this),b(this,O,_c).call(this),v(this,Ss,n.annotationStorage),v(this,Fa,n.filterFactory),v(this,Ki,a),v(this,ur,o||null),v(this,Na,c),v(this,Ia,h),v(this,dr,d),v(this,Ba,f||null),this.viewParameters={realScale:Li.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const t=sr.prototype,e=a=>r(a,Ts).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),s=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:c}=o;return c!=="text"&&c!=="number"}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return it(this,"_keyboardManager",new Wo([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],t.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:s}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:s}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,Ts).contains(o)&&!a.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,Ts).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}destroy(){var t,e,s,i;(t=r(this,Pe))==null||t.resolve(),v(this,Pe,null),(e=r(this,or))==null||e.abort(),v(this,or,null),this._signal=null;for(const n of r(this,Wt).values())n.destroy();r(this,Wt).clear(),r(this,Nt).clear(),r(this,Xi).clear(),v(this,be,null),r(this,ct).clear(),r(this,je).destroy(),(s=r(this,lr))==null||s.destroy(),(i=r(this,rs))==null||i.hide(),v(this,rs,null),r(this,ns)&&(clearTimeout(r(this,ns)),v(this,ns,null)),r(this,as)&&(clearTimeout(r(this,as)),v(this,as,null))}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return r(this,Ba)}get useNewAltTextFlow(){return r(this,Ia)}get useNewAltTextWhenAddingImage(){return r(this,dr)}get hcmFilter(){return it(this,"hcmFilter",r(this,Ki)?r(this,Fa).addHCMFilter(r(this,Ki).foreground,r(this,Ki).background):"none")}get direction(){return it(this,"direction",getComputedStyle(r(this,Ts)).direction)}get highlightColors(){return it(this,"highlightColors",r(this,ur)?new Map(r(this,ur).split(",").map(t=>t.split("=").map(e=>e.trim()))):null)}get highlightColorNames(){return it(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){v(this,Oa,t)}editAltText(t,e=!1){var s;(s=r(this,lr))==null||s.editAltText(this,t,e)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){switch(t){case"enableNewAltTextWhenAddingImage":v(this,dr,e);break}}onPageChanging({pageNumber:t}){v(this,hr,t-1)}focusMainContainer(){r(this,Ts).focus()}findParent(t,e){for(const s of r(this,Wt).values()){const{x:i,y:n,width:a,height:o}=s.div.getBoundingClientRect();if(t>=i&&t<=i+a&&e>=n&&e<=n+o)return s}return null}disableUserSelect(t=!1){r(this,$a).classList.toggle("noUserSelect",t)}addShouldRescale(t){r(this,Xi).add(t)}removeShouldRescale(t){r(this,Xi).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*Li.PDF_TO_CSS_UNITS;for(const e of r(this,Xi))e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t=""){const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:a}=e,o=e.toString(),h=b(this,O,el).call(this,e).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;e.empty();const f=b(this,O,Ac).call(this,h),p=r(this,Ht)===Q.NONE,g=()=>{f==null||f.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:a,text:o}),p&&this.showAllEditors("highlight",!0,!0)};if(p){this.switchToMode(Q.HIGHLIGHT,g);return}g()}addToAnnotationStorage(t){!t.isEmpty()&&r(this,Ss)&&!r(this,Ss).has(t.id)&&r(this,Ss).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,r(this,ci)&&(v(this,ci,!1),b(this,O,sl).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of r(this,ct))if(e.div.contains(t)){v(this,Yi,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!r(this,Yi))return;const[t,e]=r(this,Yi);v(this,Yi,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){b(this,O,_c).call(this),b(this,O,xc).call(this)}removeEditListeners(){b(this,O,Nd).call(this),b(this,O,Ec).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const s of r(this,We))if(s.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const e of t.dataTransfer.items)for(const s of r(this,We))if(s.isHandlingMimeForPasting(e.type)){s.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var s;if(t.preventDefault(),(s=r(this,be))==null||s.commitOrRemove(),!this.hasSelection)return;const e=[];for(const i of r(this,ct)){const n=i.serialize(!0);n&&e.push(n)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const n of e.items)for(const a of r(this,We))if(a.isHandlingMimeForPasting(n.type)){a.paste(n,this.currentLayer);return}let s=e.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(n){J(`paste: "${n.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const n=[];for(const c of s){const h=await i.deserialize(c);if(!h)return;n.push(h)}const a=()=>{for(const c of n)b(this,O,kc).call(this,c);b(this,O,Sc).call(this,n)},o=()=>{for(const c of n)c.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(n){J(`paste: "${n.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),r(this,Ht)!==Q.NONE&&!this.isEditorHandlingKeyboard&&sr._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,r(this,ci)&&(v(this,ci,!1),b(this,O,sl).call(this,"main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(t){t?(b(this,O,Pd).call(this),b(this,O,xc).call(this),b(this,O,se).call(this,{isEditing:r(this,Ht)!==Q.NONE,isEmpty:b(this,O,oa).call(this),hasSomethingToUndo:r(this,je).hasSomethingToUndo(),hasSomethingToRedo:r(this,je).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,O,Ld).call(this),b(this,O,Ec).call(this),b(this,O,se).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!r(this,We)){v(this,We,t);for(const e of r(this,We))b(this,O,si).call(this,e.defaultPropertiesToUpdate)}}getId(){return r(this,Dl).id}get currentLayer(){return r(this,Wt).get(r(this,hr))}getLayer(t){return r(this,Wt).get(t)}get currentPageIndex(){return r(this,hr)}addLayer(t){r(this,Wt).set(t.pageIndex,t),r(this,hi)?t.enable():t.disable()}removeLayer(t){r(this,Wt).delete(t.pageIndex)}async updateMode(t,e=null,s=!1){if(r(this,Ht)!==t&&!(r(this,Pe)&&(await r(this,Pe).promise,!r(this,Pe)))){if(v(this,Pe,Promise.withResolvers()),v(this,Ht,t),t===Q.NONE){this.setEditingState(!1),b(this,O,Dd).call(this),r(this,Pe).resolve();return}this.setEditingState(!0),await b(this,O,Fd).call(this),this.unselectAll();for(const i of r(this,Wt).values())i.updateMode(t);if(!e){s&&this.addNewEditorFromKeyboard(),r(this,Pe).resolve();return}for(const i of r(this,Nt).values())i.annotationElementId===e?(this.setSelected(i),i.enterInEditMode()):i.unselect();r(this,Pe).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==r(this,Ht)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){var s;if(r(this,We)){switch(t){case X.CREATE:this.currentLayer.addNewEditor();return;case X.HIGHLIGHT_DEFAULT_COLOR:(s=r(this,Oa))==null||s.updateColor(e);break;case X.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(r(this,Va)||v(this,Va,new Map)).set(t,e),this.showAllEditors("highlight",e);break}for(const i of r(this,ct))i.updateParams(t,e);for(const i of r(this,We))i.updateDefaultParams(t,e)}}showAllEditors(t,e,s=!1){var n;for(const a of r(this,Nt).values())a.editorType===t&&a.show(e);(((n=r(this,Va))==null?void 0:n.get(X.HIGHLIGHT_SHOW_ALL))??!0)!==e&&b(this,O,si).call(this,[[X.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(r(this,Da)!==t){v(this,Da,t);for(const e of r(this,Wt).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const s of r(this,Nt).values())s.pageIndex===t&&e.push(s);return e}getEditor(t){return r(this,Nt).get(t)}addEditor(t){r(this,Nt).set(t.id,t)}removeEditor(t){var e;t.div.contains(document.activeElement)&&(r(this,ns)&&clearTimeout(r(this,ns)),v(this,ns,setTimeout(()=>{this.focusMainContainer(),v(this,ns,null)},0))),r(this,Nt).delete(t.id),this.unselect(t),(!t.annotationElementId||!r(this,qi).has(t.annotationElementId))&&((e=r(this,Ss))==null||e.remove(t.id))}addDeletedAnnotationElement(t){r(this,qi).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return r(this,qi).has(t)}removeDeletedAnnotationElement(t){r(this,qi).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){r(this,be)!==t&&(v(this,be,t),t&&b(this,O,si).call(this,t.propertiesToUpdate))}updateUI(t){r(this,O,Od)===t&&b(this,O,si).call(this,t.propertiesToUpdate)}toggleSelected(t){if(r(this,ct).has(t)){r(this,ct).delete(t),t.unselect(),b(this,O,se).call(this,{hasSelectedEditor:this.hasSelection});return}r(this,ct).add(t),t.select(),b(this,O,si).call(this,t.propertiesToUpdate),b(this,O,se).call(this,{hasSelectedEditor:!0})}setSelected(t){for(const e of r(this,ct))e!==t&&e.unselect();r(this,ct).clear(),r(this,ct).add(t),t.select(),b(this,O,si).call(this,t.propertiesToUpdate),b(this,O,se).call(this,{hasSelectedEditor:!0})}isSelected(t){return r(this,ct).has(t)}get firstSelectedEditor(){return r(this,ct).values().next().value}unselect(t){t.unselect(),r(this,ct).delete(t),b(this,O,se).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return r(this,ct).size!==0}get isEnterHandled(){return r(this,ct).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){r(this,je).undo(),b(this,O,se).call(this,{hasSomethingToUndo:r(this,je).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,O,oa).call(this)})}redo(){r(this,je).redo(),b(this,O,se).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:r(this,je).hasSomethingToRedo(),isEmpty:b(this,O,oa).call(this)})}addCommands(t){r(this,je).add(t),b(this,O,se).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,O,oa).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...r(this,ct)],e=()=>{for(const i of t)i.remove()},s=()=>{for(const i of t)b(this,O,kc).call(this,i)};this.addCommands({cmd:e,undo:s,mustExec:!0})}commitOrRemove(){var t;(t=r(this,be))==null||t.commitOrRemove()}hasSomethingToControl(){return r(this,be)||this.hasSelection}selectAll(){for(const t of r(this,ct))t.commit();b(this,O,Sc).call(this,r(this,Nt).values())}unselectAll(){if(!(r(this,be)&&(r(this,be).commitOrRemove(),r(this,Ht)!==Q.NONE))&&this.hasSelection){for(const t of r(this,ct))t.unselect();r(this,ct).clear(),b(this,O,se).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;r(this,ui)[0]+=t,r(this,ui)[1]+=e;const[i,n]=r(this,ui),a=[...r(this,ct)],o=1e3;r(this,as)&&clearTimeout(r(this,as)),v(this,as,setTimeout(()=>{v(this,as,null),r(this,ui)[0]=r(this,ui)[1]=0,this.addCommands({cmd:()=>{for(const c of a)r(this,Nt).has(c.id)&&c.translateInPage(i,n)},undo:()=>{for(const c of a)r(this,Nt).has(c.id)&&c.translateInPage(-i,-n)},mustExec:!1})},o));for(const c of a)c.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),v(this,is,new Map);for(const t of r(this,ct))r(this,is).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!r(this,is))return!1;this.disableUserSelect(!1);const t=r(this,is);v(this,is,null);let e=!1;for(const[{x:i,y:n,pageIndex:a},o]of t)o.newX=i,o.newY=n,o.newPageIndex=a,e||(e=i!==o.savedX||n!==o.savedY||a!==o.savedPageIndex);if(!e)return!1;const s=(i,n,a,o)=>{if(r(this,Nt).has(i.id)){const c=r(this,Wt).get(o);c?i._setParentAndPosition(c,n,a):(i.pageIndex=o,i.x=n,i.y=a)}};return this.addCommands({cmd:()=>{for(const[i,{newX:n,newY:a,newPageIndex:o}]of t)s(i,n,a,o)},undo:()=>{for(const[i,{savedX:n,savedY:a,savedPageIndex:o}]of t)s(i,n,a,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(r(this,is))for(const s of r(this,is).keys())s.drag(t,e)}rebuild(t){if(t.parent===null){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return((t=this.getActive())==null?void 0:t.shouldGetKeyboardEvents())||r(this,ct).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return r(this,be)===t}getActive(){return r(this,be)}getMode(){return r(this,Ht)}get imageManager(){return it(this,"imageManager",new yc)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let h=0,d=e.rangeCount;h<d;h++)if(!t.contains(e.getRangeAt(h).commonAncestorContainer))return null;const{x:s,y:i,width:n,height:a}=t.getBoundingClientRect();let o;switch(t.getAttribute("data-main-rotation")){case"90":o=(h,d,f,p)=>({x:(d-i)/a,y:1-(h+f-s)/n,width:p/a,height:f/n});break;case"180":o=(h,d,f,p)=>({x:1-(h+f-s)/n,y:1-(d+p-i)/a,width:f/n,height:p/a});break;case"270":o=(h,d,f,p)=>({x:1-(d+p-i)/a,y:(h-s)/n,width:p/a,height:f/n});break;default:o=(h,d,f,p)=>({x:(h-s)/n,y:(d-i)/a,width:f/n,height:p/a});break}const c=[];for(let h=0,d=e.rangeCount;h<d;h++){const f=e.getRangeAt(h);if(!f.collapsed)for(const{x:p,y:g,width:m,height:y}of f.getClientRects())m===0||y===0||c.push(o(p,g,m,y))}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:t,id:e}){(r(this,cr)||v(this,cr,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;(e=r(this,cr))==null||e.delete(t)}renderAnnotationElement(t){var i;const e=(i=r(this,cr))==null?void 0:i.get(t.data.id);if(!e)return;const s=r(this,Ss).getRawValue(e);s&&(r(this,Ht)===Q.NONE&&!s.hasBeenModified||s.renderAnnotationElement(t))}};or=new WeakMap,be=new WeakMap,Nt=new WeakMap,Wt=new WeakMap,lr=new WeakMap,Ss=new WeakMap,cr=new WeakMap,je=new WeakMap,oi=new WeakMap,hr=new WeakMap,qi=new WeakMap,is=new WeakMap,We=new WeakMap,Xi=new WeakMap,Na=new WeakMap,Ia=new WeakMap,dr=new WeakMap,Fa=new WeakMap,ns=new WeakMap,li=new WeakMap,ur=new WeakMap,ci=new WeakMap,rs=new WeakMap,Dl=new WeakMap,hi=new WeakMap,Da=new WeakMap,di=new WeakMap,Yi=new WeakMap,Oa=new WeakMap,Ba=new WeakMap,Ht=new WeakMap,ct=new WeakMap,Cs=new WeakMap,Ki=new WeakMap,Va=new WeakMap,Ha=new WeakMap,ui=new WeakMap,as=new WeakMap,Ts=new WeakMap,$a=new WeakMap,Pe=new WeakMap,O=new WeakSet,el=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},Ac=function(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const s of r(this,Wt).values())if(s.hasTextLayer(t))return s;return null},Td=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const s=b(this,O,el).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(s);i&&(r(this,rs)||v(this,rs,new op(this)),r(this,rs).show(s,i,this.direction==="ltr"))},Md=function(){var n,a,o;const t=document.getSelection();if(!t||t.isCollapsed){r(this,Cs)&&((n=r(this,rs))==null||n.hide(),v(this,Cs,null),b(this,O,se).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=t;if(e===r(this,Cs))return;const i=b(this,O,el).call(this,t).closest(".textLayer");if(!i){r(this,Cs)&&((a=r(this,rs))==null||a.hide(),v(this,Cs,null),b(this,O,se).call(this,{hasSelectedText:!1}));return}if((o=r(this,rs))==null||o.hide(),v(this,Cs,e),b(this,O,se).call(this,{hasSelectedText:!0}),!(r(this,Ht)!==Q.HIGHLIGHT&&r(this,Ht)!==Q.NONE)&&(r(this,Ht)===Q.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),v(this,ci,this.isShiftKeyDown),!this.isShiftKeyDown)){const c=r(this,Ht)===Q.HIGHLIGHT?b(this,O,Ac).call(this,i):null;c==null||c.toggleDrawing();const h=new AbortController,d=this.combinedSignal(h),f=p=>{p.type==="pointerup"&&p.button!==0||(h.abort(),c==null||c.toggleDrawing(!0),p.type==="pointerup"&&b(this,O,sl).call(this,"main_toolbar"))};window.addEventListener("pointerup",f,{signal:d}),window.addEventListener("blur",f,{signal:d})}},sl=function(t=""){r(this,Ht)===Q.HIGHLIGHT?this.highlightSelection(t):r(this,Na)&&b(this,O,Td).call(this)},Rd=function(){document.addEventListener("selectionchange",b(this,O,Md).bind(this),{signal:this._signal})},Pd=function(){if(r(this,li))return;v(this,li,new AbortController);const t=this.combinedSignal(r(this,li));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},Ld=function(){var t;(t=r(this,li))==null||t.abort(),v(this,li,null)},_c=function(){if(r(this,di))return;v(this,di,new AbortController);const t=this.combinedSignal(r(this,di));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},Nd=function(){var t;(t=r(this,di))==null||t.abort(),v(this,di,null)},xc=function(){if(r(this,oi))return;v(this,oi,new AbortController);const t=this.combinedSignal(r(this,oi));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})},Ec=function(){var t;(t=r(this,oi))==null||t.abort(),v(this,oi,null)},Id=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},se=function(t){Object.entries(t).some(([s,i])=>r(this,Ha)[s]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(r(this,Ha),t)}),r(this,Ht)===Q.HIGHLIGHT&&t.hasSelectedEditor===!1&&b(this,O,si).call(this,[[X.HIGHLIGHT_FREE,!0]]))},si=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},Fd=async function(){if(!r(this,hi)){v(this,hi,!0);const t=[];for(const e of r(this,Wt).values())t.push(e.enable());await Promise.all(t);for(const e of r(this,Nt).values())e.enable()}},Dd=function(){if(this.unselectAll(),r(this,hi)){v(this,hi,!1);for(const t of r(this,Wt).values())t.disable();for(const t of r(this,Nt).values())t.disable()}},kc=function(t){const e=r(this,Wt).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},Od=function(){let t=null;for(t of r(this,ct));return t},oa=function(){if(r(this,Nt).size===0)return!0;if(r(this,Nt).size===1)for(const t of r(this,Nt).values())return t.isEmpty();return!1},Sc=function(t){for(const e of r(this,ct))e.unselect();r(this,ct).clear();for(const e of t)e.isEmpty()||(r(this,ct).add(e),e.select());b(this,O,se).call(this,{hasSelectedEditor:this.hasSelection})},q(sr,"TRANSLATE_SMALL",1),q(sr,"TRANSLATE_BIG",10);let $n=sr;var $t,os,Ue,fr,ls,ye,pr,cs,de,Ms,Qi,hs,fi,es,la,il;const ie=class ie{constructor(t){w(this,es);w(this,$t,null);w(this,os,!1);w(this,Ue,null);w(this,fr,null);w(this,ls,null);w(this,ye,null);w(this,pr,!1);w(this,cs,null);w(this,de,null);w(this,Ms,null);w(this,Qi,null);w(this,hs,!1);v(this,de,t),v(this,hs,t._uiManager.useNewAltTextFlow),r(ie,fi)||v(ie,fi,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){ie._l10n??(ie._l10n=t)}async render(){const t=v(this,Ue,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=v(this,fr,document.createElement("span"));t.append(e),r(this,hs)?(t.classList.add("new"),t.setAttribute("data-l10n-id",r(ie,fi).missing),e.setAttribute("data-l10n-id",r(ie,fi)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const s=r(this,de)._uiManager._signal;t.addEventListener("contextmenu",Ve,{signal:s}),t.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),r(this,de)._uiManager.editAltText(r(this,de)),r(this,hs)&&r(this,de)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:r(this,es,la)}})};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",n=>{n.target===t&&n.key==="Enter"&&(v(this,pr,!0),i(n))},{signal:s}),await b(this,es,il).call(this),t}finish(){r(this,Ue)&&(r(this,Ue).focus({focusVisible:r(this,pr)}),v(this,pr,!1))}isEmpty(){return r(this,hs)?r(this,$t)===null:!r(this,$t)&&!r(this,os)}hasData(){return r(this,hs)?r(this,$t)!==null||!!r(this,Ms):this.isEmpty()}get guessedText(){return r(this,Ms)}async setGuessedText(t){r(this,$t)===null&&(v(this,Ms,t),v(this,Qi,await ie._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),b(this,es,il).call(this))}toggleAltTextBadge(t=!1){var e;if(!r(this,hs)||r(this,$t)){(e=r(this,cs))==null||e.remove(),v(this,cs,null);return}if(!r(this,cs)){const s=v(this,cs,document.createElement("div"));s.className="noAltTextBadge",r(this,de).div.append(s)}r(this,cs).classList.toggle("hidden",!t)}serialize(t){let e=r(this,$t);return!t&&r(this,Ms)===e&&(e=r(this,Qi)),{altText:e,decorative:r(this,os),guessedText:r(this,Ms),textWithDisclaimer:r(this,Qi)}}get data(){return{altText:r(this,$t),decorative:r(this,os)}}set data({altText:t,decorative:e,guessedText:s,textWithDisclaimer:i,cancel:n=!1}){s&&(v(this,Ms,s),v(this,Qi,i)),!(r(this,$t)===t&&r(this,os)===e)&&(n||(v(this,$t,t),v(this,os,e)),b(this,es,il).call(this))}toggle(t=!1){r(this,Ue)&&(!t&&r(this,ye)&&(clearTimeout(r(this,ye)),v(this,ye,null)),r(this,Ue).disabled=!t)}shown(){r(this,de)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:r(this,es,la)}})}destroy(){var t,e;(t=r(this,Ue))==null||t.remove(),v(this,Ue,null),v(this,fr,null),v(this,ls,null),(e=r(this,cs))==null||e.remove(),v(this,cs,null)}};$t=new WeakMap,os=new WeakMap,Ue=new WeakMap,fr=new WeakMap,ls=new WeakMap,ye=new WeakMap,pr=new WeakMap,cs=new WeakMap,de=new WeakMap,Ms=new WeakMap,Qi=new WeakMap,hs=new WeakMap,fi=new WeakMap,es=new WeakSet,la=function(){return r(this,$t)&&"added"||r(this,$t)===null&&this.guessedText&&"review"||"missing"},il=async function(){var i,n,a;const t=r(this,Ue);if(!t)return;if(r(this,hs)){if(t.classList.toggle("done",!!r(this,$t)),t.setAttribute("data-l10n-id",r(ie,fi)[r(this,es,la)]),(i=r(this,fr))==null||i.setAttribute("data-l10n-id",r(ie,fi)[`${r(this,es,la)}-label`]),!r(this,$t)){(n=r(this,ls))==null||n.remove();return}}else{if(!r(this,$t)&&!r(this,os)){t.classList.remove("done"),(a=r(this,ls))==null||a.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=r(this,ls);if(!e){v(this,ls,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${r(this,de).id}`;const o=100,c=r(this,de)._uiManager._signal;c.addEventListener("abort",()=>{clearTimeout(r(this,ye)),v(this,ye,null)},{once:!0}),t.addEventListener("mouseenter",()=>{v(this,ye,setTimeout(()=>{v(this,ye,null),r(this,ls).classList.add("show"),r(this,de)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:c}),t.addEventListener("mouseleave",()=>{var h;r(this,ye)&&(clearTimeout(r(this,ye)),v(this,ye,null)),(h=r(this,ls))==null||h.classList.remove("show")},{signal:c})}r(this,os)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=r(this,$t)),e.parentNode||t.append(e);const s=r(this,de).getImageForAltText();s==null||s.setAttribute("aria-describedby",e.id)},w(ie,fi,null),q(ie,"_l10n",null);let Tl=ie;var Zi,Ge,At,gr,Ji,Ut,tn,pi,za,en,gi,ja,sn,Rs,ds,mr,vr,Le,Wa,Ol,Z,Cc,Ua,Tc,Mc,Bd,Vd,Rc,Pc,Lc,Hd,Nc,$d,zd,jd,Ic,ca;const lt=class lt{constructor(t){w(this,Z);w(this,Zi,null);w(this,Ge,null);w(this,At,null);w(this,gr,!1);w(this,Ji,!1);w(this,Ut,null);w(this,tn,null);w(this,pi,null);w(this,za,"");w(this,en,!1);w(this,gi,null);w(this,ja,!1);w(this,sn,!1);w(this,Rs,!1);w(this,ds,null);w(this,mr,0);w(this,vr,0);w(this,Le,null);q(this,"_editToolbar",null);q(this,"_initialOptions",Object.create(null));q(this,"_initialData",null);q(this,"_isVisible",!0);q(this,"_uiManager",null);q(this,"_focusEventsAllowed",!0);w(this,Wa,!1);w(this,Ol,lt._zIndex++);this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:e,rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[n,a];const[o,c]=this.parentDimensions;this.x=t.x/o,this.y=t.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=lt.prototype._resizeWithKeyboard,e=$n.TRANSLATE_SMALL,s=$n.TRANSLATE_BIG;return it(this,"_resizerKeyboardManager",new Wo([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-s,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[s,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-s]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,s]}],[["Escape","mac+Escape"],lt.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return it(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new dp({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(lt._l10n??(lt._l10n=t),lt._l10nResizer||(lt._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),lt._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);lt._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){mt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return r(this,Wa)}set _isDraggable(t){var e;v(this,Wa,t),(e=this.div)==null||e.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=r(this,Ol)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):b(this,Z,ca).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&(r(this,en)?v(this,en,!1):this.parent.setSelected(this))}focusout(t){var s;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const e=t.relatedTarget;e!=null&&e.closest(`#${this.id}`)||(t.preventDefault(),(s=this.parent)!=null&&s.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,s,i){const[n,a]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(t+s)/n,this.y=(e+i)/a,this.fixAndSetPosition()}translate(t,e){b(this,Z,Cc).call(this,this.parentDimensions,t,e)}translateInPage(t,e){r(this,gi)||v(this,gi,[this.x,this.y]),b(this,Z,Cc).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){r(this,gi)||v(this,gi,[this.x,this.y]);const[s,i]=this.parentDimensions;if(this.x+=t/s,this.y+=e/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:h,y:d}=this.div.getBoundingClientRect();this.parent.findNewParent(this,h,d)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:n,y:a}=this;const[o,c]=this.getBaseTranslation();n+=o,a+=c,this.div.style.left=`${(100*n).toFixed(2)}%`,this.div.style.top=`${(100*a).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!r(this,gi)&&(r(this,gi)[0]!==this.x||r(this,gi)[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:s}=lt,i=s/t,n=s/e;switch(this.rotation){case 90:return[-i,n];case 180:return[i,n];case 270:return[i,-n];default:return[-i,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[e,s]=this.pageDimensions;let{x:i,y:n,width:a,height:o}=this;if(a*=e,o*=s,i*=e,n*=s,this._mustFixPosition)switch(t){case 0:i=Math.max(0,Math.min(e-a,i)),n=Math.max(0,Math.min(s-o,n));break;case 90:i=Math.max(0,Math.min(e-o,i)),n=Math.min(s,Math.max(a,n));break;case 180:i=Math.min(e,Math.max(a,i)),n=Math.min(s,Math.max(o,n));break;case 270:i=Math.min(e,Math.max(o,i)),n=Math.max(0,Math.min(s-a,n));break}this.x=i/=e,this.y=n/=s;const[c,h]=this.getBaseTranslation();i+=c,n+=h;const{style:d}=this.div;d.left=`${(100*i).toFixed(2)}%`,d.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var s;return b(s=lt,Ua,Tc).call(s,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var s;return b(s=lt,Ua,Tc).call(s,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,s]}=this;return[e*t,s*t]}setDims(t,e){const[s,i]=this.parentDimensions;this.div.style.width=`${(100*t/s).toFixed(2)}%`,r(this,Ji)||(this.div.style.height=`${(100*e/i).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:s}=t,i=s.endsWith("%"),n=!r(this,Ji)&&e.endsWith("%");if(i&&n)return;const[a,o]=this.parentDimensions;i||(t.width=`${(100*parseFloat(s)/a).toFixed(2)}%`),!r(this,Ji)&&!n&&(t.height=`${(100*parseFloat(e)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var t;(t=r(this,At))==null||t.finish()}async addEditToolbar(){return this._editToolbar||r(this,sn)?this._editToolbar:(this._editToolbar=new vc(this),this.div.append(this._editToolbar.render()),r(this,At)&&await this._editToolbar.addAltText(r(this,At)),this._editToolbar)}removeEditToolbar(){var t;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(t=r(this,At))==null||t.destroy())}addContainer(t){var s;const e=(s=this._editToolbar)==null?void 0:s.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){r(this,At)||(Tl.initialize(lt._l10n),v(this,At,new Tl(this)),r(this,Zi)&&(r(this,At).data=r(this,Zi),v(this,Zi,null)),await this.addEditToolbar())}get altTextData(){var t;return(t=r(this,At))==null?void 0:t.data}set altTextData(t){r(this,At)&&(r(this,At).data=t)}get guessedAltText(){var t;return(t=r(this,At))==null?void 0:t.guessedText}async setGuessedAltText(t){var e;await((e=r(this,At))==null?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return(e=r(this,At))==null?void 0:e.serialize(t)}hasAltText(){return!!r(this,At)&&!r(this,At).isEmpty()}hasAltTextData(){var t;return((t=r(this,At))==null?void 0:t.hasData())??!1}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=r(this,gr)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),b(this,Z,Nc).call(this);const[t,e]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*e/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/e).toFixed(2)}%`);const[s,i]=this.getInitialTranslation();return this.translate(s,i),Cl(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=re.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(v(this,en,!0),this._isDraggable){b(this,Z,Hd).call(this,t);return}b(this,Z,Lc).call(this,t)}get isSelected(){return this._uiManager.isSelected(this)}moveInDOM(){r(this,ds)&&clearTimeout(r(this,ds)),v(this,ds,setTimeout(()=>{var t;v(this,ds,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,s){t.changeParent(this),this.x=e,this.y=s,this.fixAndSetPosition()}getRect(t,e,s=this.rotation){const i=this.parentScale,[n,a]=this.pageDimensions,[o,c]=this.pageTranslation,h=t/i,d=e/i,f=this.x*n,p=this.y*a,g=this.width*n,m=this.height*a;switch(s){case 0:return[f+h+o,a-p-d-m+c,f+h+g+o,a-p-d+c];case 90:return[f+d+o,a-p+h+c,f+d+m+o,a-p+h+g+c];case 180:return[f-h-g+o,a-p+d+c,f-h+o,a-p+d+m+c];case 270:return[f-d-m+o,a-p-h-g+c,f-d+o,a-p-h+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[s,i,n,a]=t,o=n-s,c=a-i;switch(this.rotation){case 0:return[s,e-a,o,c];case 90:return[s,e-i,c,o];case 180:return[n,e-i,o,c];case 270:return[n,e-a,c,o];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){v(this,sn,!0)}disableEditMode(){v(this,sn,!1)}isInEditMode(){return r(this,sn)}shouldGetKeyboardEvents(){return r(this,Rs)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){b(this,Z,Nc).call(this)}rotate(t){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((t=this._initialData)==null?void 0:t.popupRef)||""}}serialize(t=!1,e=null){mt("An editor must be serializable")}static async deserialize(t,e,s){const i=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:s});i.rotation=t.rotation,v(i,Zi,t.accessibilityData);const[n,a]=i.pageDimensions,[o,c,h,d]=i.getRectInCurrentCoords(t.rect,a);return i.x=o/n,i.y=c/a,i.width=h/n,i.height=d/a,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var t;if((t=r(this,pi))==null||t.abort(),v(this,pi,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),r(this,ds)&&(clearTimeout(r(this,ds)),v(this,ds,null)),b(this,Z,ca).call(this),this.removeEditToolbar(),r(this,Le)){for(const e of r(this,Le).values())clearTimeout(e);v(this,Le,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,Z,Bd).call(this),r(this,Ut).classList.remove("hidden"),Cl(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),v(this,tn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=r(this,Ut).children;if(!r(this,Ge)){v(this,Ge,Array.from(e));const a=b(this,Z,$d).bind(this),o=b(this,Z,zd).bind(this),c=this._uiManager._signal;for(const h of r(this,Ge)){const d=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",a,{signal:c}),h.addEventListener("blur",o,{signal:c}),h.addEventListener("focus",b(this,Z,jd).bind(this,d),{signal:c}),h.setAttribute("data-l10n-id",lt._l10nResizer[d])}}const s=r(this,Ge)[0];let i=0;for(const a of e){if(a===s)break;i++}const n=(360-this.rotation+this.parentRotation)%360/90*(r(this,Ge).length/4);if(n!==i){if(n<i)for(let o=0;o<i-n;o++)r(this,Ut).append(r(this,Ut).firstChild);else if(n>i)for(let o=0;o<n-i;o++)r(this,Ut).firstChild.before(r(this,Ut).lastChild);let a=0;for(const o of e){const h=r(this,Ge)[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",lt._l10nResizer[h])}}b(this,Z,Ic).call(this,0),v(this,Rs,!0),r(this,Ut).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){r(this,Rs)&&b(this,Z,Pc).call(this,r(this,za),{movementX:t,movementY:e})}_stopResizingWithKeyboard(){b(this,Z,ca).call(this),this.div.focus()}select(){var t,e,s;if(this.makeResizable(),(t=this.div)==null||t.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var i,n;(i=this.div)!=null&&i.classList.contains("selectedEditor")&&((n=this._editToolbar)==null||n.show())});return}(e=this._editToolbar)==null||e.show(),(s=r(this,At))==null||s.toggleAltTextBadge(!1)}unselect(){var t,e,s,i,n;(t=r(this,Ut))==null||t.classList.add("hidden"),(e=this.div)==null||e.classList.remove("selectedEditor"),(s=this.div)!=null&&s.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(i=this._editToolbar)==null||i.hide(),(n=r(this,At))==null||n.toggleAltTextBadge(!0)}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return r(this,ja)}set isEditing(t){v(this,ja,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){v(this,Ji,!0);const s=t/e,{style:i}=this.div;i.aspectRatio=s,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){r(this,Le)||v(this,Le,new Map);const{action:s}=t;let i=r(this,Le).get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),r(this,Le).delete(s),r(this,Le).size===0&&v(this,Le,null)},lt._telemetryTimeout),r(this,Le).set(s,i);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),v(this,gr,!1)}disable(){this.div&&(this.div.tabIndex=-1),v(this,gr,!0)}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){const s=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),s.before(e)}return e}resetAnnotationElement(t){const{firstChild:e}=t.container;(e==null?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};Zi=new WeakMap,Ge=new WeakMap,At=new WeakMap,gr=new WeakMap,Ji=new WeakMap,Ut=new WeakMap,tn=new WeakMap,pi=new WeakMap,za=new WeakMap,en=new WeakMap,gi=new WeakMap,ja=new WeakMap,sn=new WeakMap,Rs=new WeakMap,ds=new WeakMap,mr=new WeakMap,vr=new WeakMap,Le=new WeakMap,Wa=new WeakMap,Ol=new WeakMap,Z=new WeakSet,Cc=function([t,e],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/t,this.y+=i/e,this.fixAndSetPosition()},Ua=new WeakSet,Tc=function(t,e,s){switch(s){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},Mc=function(t){switch(t){case 90:{const[e,s]=this.pageDimensions;return[0,-e/s,s/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,s]=this.pageDimensions;return[0,e/s,-s/e,0]}default:return[1,0,0,1]}},Bd=function(){if(r(this,Ut))return;v(this,Ut,document.createElement("div")),r(this,Ut).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const s of t){const i=document.createElement("div");r(this,Ut).append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",b(this,Z,Vd).bind(this,s),{signal:e}),i.addEventListener("contextmenu",Ve,{signal:e}),i.tabIndex=-1}this.div.prepend(r(this,Ut))},Vd=function(t,e){var m;e.preventDefault();const{isMac:s}=re.platform;if(e.button!==0||e.ctrlKey&&s)return;(m=r(this,At))==null||m.toggle(!1);const i=this._isDraggable;this._isDraggable=!1;const n=new AbortController,a=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",b(this,Z,Pc).bind(this,t),{passive:!0,capture:!0,signal:a}),window.addEventListener("contextmenu",Ve,{signal:a});const o=this.x,c=this.y,h=this.width,d=this.height,f=this.parent.div.style.cursor,p=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const g=()=>{var y;n.abort(),this.parent.togglePointerEvents(!0),(y=r(this,At))==null||y.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=f,this.div.style.cursor=p,b(this,Z,Rc).call(this,o,c,h,d)};window.addEventListener("pointerup",g,{signal:a}),window.addEventListener("blur",g,{signal:a})},Rc=function(t,e,s,i){const n=this.x,a=this.y,o=this.width,c=this.height;n===t&&a===e&&o===s&&c===i||this.addCommands({cmd:()=>{this.width=o,this.height=c,this.x=n,this.y=a;const[h,d]=this.parentDimensions;this.setDims(h*o,d*c),this.fixAndSetPosition()},undo:()=>{this.width=s,this.height=i,this.x=t,this.y=e;const[h,d]=this.parentDimensions;this.setDims(h*s,d*i),this.fixAndSetPosition()},mustExec:!0})},Pc=function(t,e){const[s,i]=this.parentDimensions,n=this.x,a=this.y,o=this.width,c=this.height,h=lt.MIN_SIZE/s,d=lt.MIN_SIZE/i,f=j=>Math.round(j*1e4)/1e4,p=b(this,Z,Mc).call(this,this.rotation),g=(j,G)=>[p[0]*j+p[2]*G,p[1]*j+p[3]*G],m=b(this,Z,Mc).call(this,360-this.rotation),y=(j,G)=>[m[0]*j+m[2]*G,m[1]*j+m[3]*G];let x,A,_=!1,E=!1;switch(t){case"topLeft":_=!0,x=(j,G)=>[0,0],A=(j,G)=>[j,G];break;case"topMiddle":x=(j,G)=>[j/2,0],A=(j,G)=>[j/2,G];break;case"topRight":_=!0,x=(j,G)=>[j,0],A=(j,G)=>[0,G];break;case"middleRight":E=!0,x=(j,G)=>[j,G/2],A=(j,G)=>[0,G/2];break;case"bottomRight":_=!0,x=(j,G)=>[j,G],A=(j,G)=>[0,0];break;case"bottomMiddle":x=(j,G)=>[j/2,G],A=(j,G)=>[j/2,0];break;case"bottomLeft":_=!0,x=(j,G)=>[0,G],A=(j,G)=>[j,0];break;case"middleLeft":E=!0,x=(j,G)=>[0,G/2],A=(j,G)=>[j,G/2];break}const k=x(o,c),C=A(o,c);let T=g(...C);const M=f(n+T[0]),P=f(a+T[1]);let N=1,H=1,[L,S]=this.screenToPageTranslation(e.movementX,e.movementY);if([L,S]=y(L/s,S/i),_){const j=Math.hypot(o,c);N=H=Math.max(Math.min(Math.hypot(C[0]-k[0]-L,C[1]-k[1]-S)/j,1/o,1/c),h/o,d/c)}else E?N=Math.max(h,Math.min(1,Math.abs(C[0]-k[0]-L)))/o:H=Math.max(d,Math.min(1,Math.abs(C[1]-k[1]-S)))/c;const R=f(o*N),F=f(c*H);T=g(...A(R,F));const V=M-T[0],$=P-T[1];this.width=R,this.height=F,this.x=V,this.y=$,this.setDims(s*R,i*F),this.fixAndSetPosition()},Lc=function(t){const{isMac:e}=re.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Hd=function(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();const s=new AbortController,i=this._uiManager.combinedSignal(s);if(e){this.div.classList.add("moving"),v(this,mr,t.clientX),v(this,vr,t.clientY);const a=o=>{const{clientX:c,clientY:h}=o,[d,f]=this.screenToPageTranslation(c-r(this,mr),h-r(this,vr));v(this,mr,c),v(this,vr,h),this._uiManager.dragSelectedEditors(d,f)};window.addEventListener("pointermove",a,{passive:!0,capture:!0,signal:i})}const n=()=>{s.abort(),e&&this.div.classList.remove("moving"),v(this,en,!1),this._uiManager.endDragSession()||b(this,Z,Lc).call(this,t)};window.addEventListener("pointerup",n,{signal:i}),window.addEventListener("blur",n,{signal:i})},Nc=function(){if(r(this,pi)||!this.div)return;v(this,pi,new AbortController);const t=this._uiManager.combinedSignal(r(this,pi));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},$d=function(t){lt._resizerKeyboardManager.exec(this,t)},zd=function(t){var e;r(this,Rs)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==r(this,Ut)&&b(this,Z,ca).call(this)},jd=function(t){v(this,za,r(this,Rs)?t:"")},Ic=function(t){if(r(this,Ge))for(const e of r(this,Ge))e.tabIndex=t},ca=function(){if(v(this,Rs,!1),b(this,Z,Ic).call(this,-1),r(this,tn)){const{savedX:t,savedY:e,savedWidth:s,savedHeight:i}=r(this,tn);b(this,Z,Rc).call(this,t,e,s,i),v(this,tn,null)}},w(lt,Ua),q(lt,"_l10n",null),q(lt,"_l10nResizer",null),q(lt,"_borderLineWidth",-1),q(lt,"_colorManager",new wc),q(lt,"_zIndex",1),q(lt,"_telemetryTimeout",1e3);let dt=lt;class dp extends dt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Kh=3285377520,Re=4294901760,ss=65535;class Wd{constructor(t){this.h1=t?t&4294967295:Kh,this.h2=t?t&4294967295:Kh}update(t){let e,s;if(typeof t=="string"){e=new Uint8Array(t.length*2),s=0;for(let y=0,x=t.length;y<x;y++){const A=t.charCodeAt(y);A<=255?e[s++]=A:(e[s++]=A>>>8,e[s++]=A&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),s=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const i=s>>2,n=s-i*4,a=new Uint32Array(e.buffer,0,i);let o=0,c=0,h=this.h1,d=this.h2;const f=3432918353,p=461845907,g=f&ss,m=p&ss;for(let y=0;y<i;y++)y&1?(o=a[y],o=o*f&Re|o*g&ss,o=o<<15|o>>>17,o=o*p&Re|o*m&ss,h^=o,h=h<<13|h>>>19,h=h*5+3864292196):(c=a[y],c=c*f&Re|c*g&ss,c=c<<15|c>>>17,c=c*p&Re|c*m&ss,d^=c,d=d<<13|d>>>19,d=d*5+3864292196);switch(o=0,n){case 3:o^=e[i*4+2]<<16;case 2:o^=e[i*4+1]<<8;case 1:o^=e[i*4],o=o*f&Re|o*g&ss,o=o<<15|o>>>17,o=o*p&Re|o*m&ss,i&1?h^=o:d^=o}this.h1=h,this.h2=d}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&Re|t*36045&ss,e=e*4283543511&Re|((e<<16|t>>>16)*2950163797&Re)>>>16,t^=e>>>1,t=t*444984403&Re|t*60499&ss,e=e*3301882366&Re|((e<<16|t>>>16)*3120437893&Re)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Fc=Object.freeze({map:null,hash:"",transfer:void 0});var nn,rn,zt,Bl,Ud;class Fh{constructor(){w(this,Bl);w(this,nn,!1);w(this,rn,null);w(this,zt,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const s=r(this,zt).get(t);return s===void 0?e:Object.assign(e,s)}getRawValue(t){return r(this,zt).get(t)}remove(t){if(r(this,zt).delete(t),r(this,zt).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const e of r(this,zt).values())if(e instanceof dt)return;this.onAnnotationEditor(null)}}setValue(t,e){const s=r(this,zt).get(t);let i=!1;if(s!==void 0)for(const[n,a]of Object.entries(e))s[n]!==a&&(i=!0,s[n]=a);else i=!0,r(this,zt).set(t,e);i&&b(this,Bl,Ud).call(this),e instanceof dt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type)}has(t){return r(this,zt).has(t)}getAll(){return r(this,zt).size>0?Mh(r(this,zt)):null}setAll(t){for(const[e,s]of Object.entries(t))this.setValue(e,s)}get size(){return r(this,zt).size}resetModified(){r(this,nn)&&(v(this,nn,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Gd(this)}get serializable(){if(r(this,zt).size===0)return Fc;const t=new Map,e=new Wd,s=[],i=Object.create(null);let n=!1;for(const[a,o]of r(this,zt)){const c=o instanceof dt?o.serialize(!1,i):o;c&&(t.set(a,c),e.update(`${a}:${JSON.stringify(c)}`),n||(n=!!c.bitmap))}if(n)for(const a of t.values())a.bitmap&&s.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:s}:Fc}get editorStats(){let t=null;const e=new Map;for(const s of r(this,zt).values()){if(!(s instanceof dt))continue;const i=s.telemetryFinalData;if(!i)continue;const{type:n}=i;e.has(n)||e.set(n,Object.getPrototypeOf(s).constructor),t||(t=Object.create(null));const a=t[n]||(t[n]=new Map);for(const[o,c]of Object.entries(i)){if(o==="type")continue;let h=a.get(o);h||(h=new Map,a.set(o,h));const d=h.get(c)??0;h.set(c,d+1)}}for(const[s,i]of e)t[s]=i.computeTelemetryFinalData(t[s]);return t}resetModifiedIds(){v(this,rn,null)}get modifiedIds(){if(r(this,rn))return r(this,rn);const t=[];for(const e of r(this,zt).values())!(e instanceof dt)||!e.annotationElementId||!e.serialize()||t.push(e.annotationElementId);return v(this,rn,{ids:new Set(t),hash:t.join(",")})}}nn=new WeakMap,rn=new WeakMap,zt=new WeakMap,Bl=new WeakSet,Ud=function(){r(this,nn)||(v(this,nn,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var Ga;class Gd extends Fh{constructor(e){super();w(this,Ga);const{map:s,hash:i,transfer:n}=e.serializable,a=structuredClone(s,n?{transfer:n}:null);v(this,Ga,{map:a,hash:i,transfer:n})}get print(){mt("Should not call PrintAnnotationStorage.print")}get serializable(){return r(this,Ga)}get modifiedIds(){return it(this,"modifiedIds",{ids:new Set,hash:""})}}Ga=new WeakMap;var br;class up{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){w(this,br,new Set);this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),r(this,br).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:e}){if(!(!t||r(this,br).has(t.loadedName))){if(Dt(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:s,src:i,style:n}=t,a=new FontFace(s,i,n);this.addNativeFontFace(a);try{await a.load(),r(this,br).add(s),e==null||e(t)}catch{J(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}mt("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){const s=t.createNativeFontFace();if(s){this.addNativeFontFace(s);try{await s.loaded}catch(i){throw J(`Failed to load font '${s.family}': '${i}'.`),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(s=>{const i=this._queueLoadingCallback(s);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){var e;const t=!!((e=this._document)!=null&&e.fonts);return it(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(te||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),it(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){function e(){for(Dt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;s.length>0&&s[0].done;){const n=s.shift();setTimeout(n.callback,0)}}const{loadingRequests:s}=this,i={done:!1,complete:e,callback:t};return s.push(i),i}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return it(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function s(k,C){return k.charCodeAt(C)<<24|k.charCodeAt(C+1)<<16|k.charCodeAt(C+2)<<8|k.charCodeAt(C+3)&255}function i(k,C,T,M){const P=k.substring(0,C),N=k.substring(C+T);return P+M+N}let n,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const c=o.getContext("2d");let h=0;function d(k,C){if(++h>30){J("Load test font never loaded."),C();return}if(c.font="30px "+k,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){C();return}setTimeout(d.bind(null,k,C))}const f=`lt${Date.now()}${this.loadTestFontId++}`;let p=this._loadTestFont;p=i(p,976,f.length,f);const m=16,y=1482184792;let x=s(p,m);for(n=0,a=f.length-3;n<a;n+=4)x=x-y+s(f,n)|0;n<f.length&&(x=x-y+s(f+"XXX",n)|0),p=i(p,m,4,Kf(x));const A=`url(data:font/opentype;base64,${btoa(p)});`,_=`@font-face {font-family:"${f}";src:${A}}`;this.insertRule(_);const E=this._document.createElement("div");E.style.visibility="hidden",E.style.width=E.style.height="10px",E.style.position="absolute",E.style.top=E.style.left="0px";for(const k of[t.loadedName,f]){const C=this._document.createElement("span");C.textContent="Hi",C.style.fontFamily=k,E.append(C)}this._document.body.append(E),d(f,()=>{E.remove(),e.complete()})}}br=new WeakMap;class fp{constructor(t,{disableFontFace:e=!1,inspectFont:s=null}){this.compiledGlyphs=Object.create(null);for(const i in t)this[i]=t[i];this.disableFontFace=e===!0,this._inspectFont=s}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const s={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(s.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,s)}return(e=this._inspectFont)==null||e.call(this,this),t}createFontFaceRule(){var s;if(!this.data||this.disableFontFace)return null;const t=`url(data:${this.mimetype};base64,${sp(this.data)});`;let e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${t}}`}return(s=this._inspectFont)==null||s.call(this,this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];let s;try{s=t.get(this.loadedName+"_path_"+e)}catch(n){J(`getPathGenerator - ignoring character: "${n}".`)}if(!Array.isArray(s)||s.length===0)return this.compiledGlyphs[e]=function(n,a){};const i=[];for(let n=0,a=s.length;n<a;)switch(s[n++]){case As.BEZIER_CURVE_TO:{const[o,c,h,d,f,p]=s.slice(n,n+6);i.push(g=>g.bezierCurveTo(o,c,h,d,f,p)),n+=6}break;case As.MOVE_TO:{const[o,c]=s.slice(n,n+2);i.push(h=>h.moveTo(o,c)),n+=2}break;case As.LINE_TO:{const[o,c]=s.slice(n,n+2);i.push(h=>h.lineTo(o,c)),n+=2}break;case As.QUADRATIC_CURVE_TO:{const[o,c,h,d]=s.slice(n,n+4);i.push(f=>f.quadraticCurveTo(o,c,h,d)),n+=4}break;case As.RESTORE:i.push(o=>o.restore());break;case As.SAVE:i.push(o=>o.save());break;case As.SCALE:Dt(i.length===2,"Scale command is only valid at the third position.");break;case As.TRANSFORM:{const[o,c,h,d,f,p]=s.slice(n,n+6);i.push(g=>g.transform(o,c,h,d,f,p)),n+=6}break;case As.TRANSLATE:{const[o,c]=s.slice(n,n+2);i.push(h=>h.translate(o,c)),n+=2}break}return this.compiledGlyphs[e]=function(a,o){i[0](a),i[1](a),a.scale(o,-o);for(let c=2,h=i.length;c<h;c++)i[c](a)}}}var qa;class qd{constructor({enableHWA:t=!1}){w(this,qa,!1);v(this,qa,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const s=this._createCanvas(t,e);return{canvas:s,context:s.getContext("2d",{willReadFrequently:!r(this,qa)})}}reset(t,e,s){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||s<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=s}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){mt("Abstract method `_createCanvas` called.")}}qa=new WeakMap;class pp extends qd{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){const s=this._document.createElement("canvas");return s.width=t,s.height=e,s}}class Xd{constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!t)throw new Error("CMap name must be specified.");const e=this.baseUrl+t+(this.isCompressed?".bcmap":"");return this._fetch(e).then(s=>({cMapData:s,isCompressed:this.isCompressed})).catch(s=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}async _fetch(t){mt("Abstract method `_fetch` called.")}}class Yd extends Xd{async _fetch(t){const e=await tc(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Jl(e)}}class Kd{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,s,i,n){return"none"}destroy(t=!1){}}var an,on,us,Ps,Qt,Vl,ln,B,Yt,Xn,Yn,nl,Kn,Qd,Dc,Qn,ha,da,Oc,ua;class gp extends Kd{constructor({docId:e,ownerDocument:s=globalThis.document}){super();w(this,B);w(this,an);w(this,on);w(this,us);w(this,Ps);w(this,Qt);w(this,Vl);w(this,ln,0);v(this,Ps,e),v(this,Qt,s)}addFilter(e){if(!e)return"none";let s=r(this,B,Yt).get(e);if(s)return s;const[i,n,a]=b(this,B,nl).call(this,e),o=e.length===1?i:`${i}${n}${a}`;if(s=r(this,B,Yt).get(o),s)return r(this,B,Yt).set(e,s),s;const c=`g_${r(this,Ps)}_transfer_map_${ee(this,ln)._++}`,h=b(this,B,Kn).call(this,c);r(this,B,Yt).set(e,h),r(this,B,Yt).set(o,h);const d=b(this,B,Qn).call(this,c);return b(this,B,da).call(this,i,n,a,d),h}addHCMFilter(e,s){var m;const i=`${e}-${s}`,n="base";let a=r(this,B,Xn).get(n);if((a==null?void 0:a.key)===i||(a?((m=a.filter)==null||m.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},r(this,B,Xn).set(n,a)),!e||!s))return a.url;const o=b(this,B,ua).call(this,e);e=z.makeHexColor(...o);const c=b(this,B,ua).call(this,s);if(s=z.makeHexColor(...c),r(this,B,Yn).style.color="",e==="#000000"&&s==="#ffffff"||e===s)return a.url;const h=new Array(256);for(let y=0;y<=255;y++){const x=y/255;h[y]=x<=.03928?x/12.92:((x+.055)/1.055)**2.4}const d=h.join(","),f=`g_${r(this,Ps)}_hcm_filter`,p=a.filter=b(this,B,Qn).call(this,f);b(this,B,da).call(this,d,d,d,p),b(this,B,Dc).call(this,p);const g=(y,x)=>{const A=o[y]/255,_=c[y]/255,E=new Array(x+1);for(let k=0;k<=x;k++)E[k]=A+k/x*(_-A);return E.join(",")};return b(this,B,da).call(this,g(0,5),g(1,5),g(2,5),p),a.url=b(this,B,Kn).call(this,f),a.url}addAlphaFilter(e){let s=r(this,B,Yt).get(e);if(s)return s;const[i]=b(this,B,nl).call(this,[e]),n=`alpha_${i}`;if(s=r(this,B,Yt).get(n),s)return r(this,B,Yt).set(e,s),s;const a=`g_${r(this,Ps)}_alpha_map_${ee(this,ln)._++}`,o=b(this,B,Kn).call(this,a);r(this,B,Yt).set(e,o),r(this,B,Yt).set(n,o);const c=b(this,B,Qn).call(this,a);return b(this,B,Oc).call(this,i,c),o}addLuminosityFilter(e){let s=r(this,B,Yt).get(e||"luminosity");if(s)return s;let i,n;if(e?([i]=b(this,B,nl).call(this,[e]),n=`luminosity_${i}`):n="luminosity",s=r(this,B,Yt).get(n),s)return r(this,B,Yt).set(e,s),s;const a=`g_${r(this,Ps)}_luminosity_map_${ee(this,ln)._++}`,o=b(this,B,Kn).call(this,a);r(this,B,Yt).set(e,o),r(this,B,Yt).set(n,o);const c=b(this,B,Qn).call(this,a);return b(this,B,Qd).call(this,c),e&&b(this,B,Oc).call(this,i,c),o}addHighlightHCMFilter(e,s,i,n,a){var _;const o=`${s}-${i}-${n}-${a}`;let c=r(this,B,Xn).get(e);if((c==null?void 0:c.key)===o||(c?((_=c.filter)==null||_.remove(),c.key=o,c.url="none",c.filter=null):(c={key:o,url:"none",filter:null},r(this,B,Xn).set(e,c)),!s||!i))return c.url;const[h,d]=[s,i].map(b(this,B,ua).bind(this));let f=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),p=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[g,m]=[n,a].map(b(this,B,ua).bind(this));p<f&&([f,p,g,m]=[p,f,m,g]),r(this,B,Yn).style.color="";const y=(E,k,C)=>{const T=new Array(256),M=(p-f)/C,P=E/255,N=(k-E)/(255*C);let H=0;for(let L=0;L<=C;L++){const S=Math.round(f+L*M),R=P+L*N;for(let F=H;F<=S;F++)T[F]=R;H=S+1}for(let L=H;L<256;L++)T[L]=T[H-1];return T.join(",")},x=`g_${r(this,Ps)}_hcm_${e}_filter`,A=c.filter=b(this,B,Qn).call(this,x);return b(this,B,Dc).call(this,A),b(this,B,da).call(this,y(g[0],m[0],5),y(g[1],m[1],5),y(g[2],m[2],5),A),c.url=b(this,B,Kn).call(this,x),c.url}destroy(e=!1){e&&r(this,B,Xn).size!==0||(r(this,us)&&(r(this,us).parentNode.parentNode.remove(),v(this,us,null)),r(this,on)&&(r(this,on).clear(),v(this,on,null)),v(this,ln,0))}}an=new WeakMap,on=new WeakMap,us=new WeakMap,Ps=new WeakMap,Qt=new WeakMap,Vl=new WeakMap,ln=new WeakMap,B=new WeakSet,Yt=function(){return r(this,on)||v(this,on,new Map)},Xn=function(){return r(this,Vl)||v(this,Vl,new Map)},Yn=function(){if(!r(this,us)){const e=r(this,Qt).createElement("div"),{style:s}=e;s.visibility="hidden",s.contain="strict",s.width=s.height=0,s.position="absolute",s.top=s.left=0,s.zIndex=-1;const i=r(this,Qt).createElementNS(xs,"svg");i.setAttribute("width",0),i.setAttribute("height",0),v(this,us,r(this,Qt).createElementNS(xs,"defs")),e.append(i),i.append(r(this,us)),r(this,Qt).body.append(e)}return r(this,us)},nl=function(e){if(e.length===1){const h=e[0],d=new Array(256);for(let p=0;p<256;p++)d[p]=h[p]/255;const f=d.join(",");return[f,f,f]}const[s,i,n]=e,a=new Array(256),o=new Array(256),c=new Array(256);for(let h=0;h<256;h++)a[h]=s[h]/255,o[h]=i[h]/255,c[h]=n[h]/255;return[a.join(","),o.join(","),c.join(",")]},Kn=function(e){if(r(this,an)===void 0){v(this,an,"");const s=r(this,Qt).URL;s!==r(this,Qt).baseURI&&(ec(s)?J('#createUrl: ignore "data:"-URL for performance reasons.'):v(this,an,s.split("#",1)[0]))}return`url(${r(this,an)}#${e})`},Qd=function(e){const s=r(this,Qt).createElementNS(xs,"feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(s)},Dc=function(e){const s=r(this,Qt).createElementNS(xs,"feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(s)},Qn=function(e){const s=r(this,Qt).createElementNS(xs,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",e),r(this,B,Yn).append(s),s},ha=function(e,s,i){const n=r(this,Qt).createElementNS(xs,s);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),e.append(n)},da=function(e,s,i,n){const a=r(this,Qt).createElementNS(xs,"feComponentTransfer");n.append(a),b(this,B,ha).call(this,a,"feFuncR",e),b(this,B,ha).call(this,a,"feFuncG",s),b(this,B,ha).call(this,a,"feFuncB",i)},Oc=function(e,s){const i=r(this,Qt).createElementNS(xs,"feComponentTransfer");s.append(i),b(this,B,ha).call(this,i,"feFuncA",e)},ua=function(e){return r(this,B,Yn).style.color=e,Ih(getComputedStyle(r(this,B,Yn)).getPropertyValue("color"))};class Zd{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!t)throw new Error("Font filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetch(e).catch(s=>{throw new Error(`Unable to load font data at: ${e}`)})}async _fetch(t){mt("Abstract method `_fetch` called.")}}class Jd extends Zd{async _fetch(t){const e=await tc(t,"arraybuffer");return new Uint8Array(e)}}if(te){var Bc=Promise.withResolvers(),xa=null;(async()=>{const t=await Promise.resolve().then(()=>require("./__vite-browser-external-BcPniuRQ.cjs")),e=await Promise.resolve().then(()=>require("./__vite-browser-external-BcPniuRQ.cjs")),s=await Promise.resolve().then(()=>require("./__vite-browser-external-BcPniuRQ.cjs")),i=await Promise.resolve().then(()=>require("./__vite-browser-external-BcPniuRQ.cjs"));let n,a;return new Map(Object.entries({fs:t,http:e,https:s,url:i,canvas:n,path2d:a}))})().then(t=>{xa=t,Bc.resolve()},t=>{J(`loadPackages: ${t}`),xa=new Map,Bc.resolve()})}class Ni{static get promise(){return Bc.promise}static get(t){return xa==null?void 0:xa.get(t)}}async function tu(u){const e=await Ni.get("fs").promises.readFile(u);return new Uint8Array(e)}class mp extends Kd{}class vp extends qd{_createCanvas(t,e){return Ni.get("canvas").createCanvas(t,e)}}class bp extends Xd{async _fetch(t){return tu(t)}}class yp extends Zd{async _fetch(t){return tu(t)}}const ne={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function Vc(u,t){if(!t)return;const e=t[2]-t[0],s=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],e,s),u.clip(i)}class Dh{getPattern(){mt("Abstract method `getPattern` called.")}}class wp extends Dh{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;this._type==="axial"?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const s of this._colorStops)e.addColorStop(s[0],s[1]);return e}getPattern(t,e,s,i){let n;if(i===ne.STROKE||i===ne.FILL){const a=e.current.getClippedPathBoundingBox(i,xt(t))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,c=Math.ceil(a[3]-a[1])||1,h=e.cachedCanvases.getCanvas("pattern",o,c),d=h.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-a[0],-a[1]),s=z.transform(s,[1,0,0,1,a[0],a[1]]),d.transform(...e.baseTransform),this.matrix&&d.transform(...this.matrix),Vc(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),n=t.createPattern(h.canvas,"no-repeat");const f=new DOMMatrix(s);n.setTransform(f)}else Vc(t,this._bbox),n=this._createGradient(t);return n}}function cc(u,t,e,s,i,n,a,o){const c=t.coords,h=t.colors,d=u.data,f=u.width*4;let p;c[e+1]>c[s+1]&&(p=e,e=s,s=p,p=n,n=a,a=p),c[s+1]>c[i+1]&&(p=s,s=i,i=p,p=a,a=o,o=p),c[e+1]>c[s+1]&&(p=e,e=s,s=p,p=n,n=a,a=p);const g=(c[e]+t.offsetX)*t.scaleX,m=(c[e+1]+t.offsetY)*t.scaleY,y=(c[s]+t.offsetX)*t.scaleX,x=(c[s+1]+t.offsetY)*t.scaleY,A=(c[i]+t.offsetX)*t.scaleX,_=(c[i+1]+t.offsetY)*t.scaleY;if(m>=_)return;const E=h[n],k=h[n+1],C=h[n+2],T=h[a],M=h[a+1],P=h[a+2],N=h[o],H=h[o+1],L=h[o+2],S=Math.round(m),R=Math.round(_);let F,V,$,j,G,le,bt,Ct;for(let yt=S;yt<=R;yt++){if(yt<x){const rt=yt<m?0:(m-yt)/(m-x);F=g-(g-y)*rt,V=E-(E-T)*rt,$=k-(k-M)*rt,j=C-(C-P)*rt}else{let rt;yt>_?rt=1:x===_?rt=0:rt=(x-yt)/(x-_),F=y-(y-A)*rt,V=T-(T-N)*rt,$=M-(M-H)*rt,j=P-(P-L)*rt}let pt;yt<m?pt=0:yt>_?pt=1:pt=(m-yt)/(m-_),G=g-(g-A)*pt,le=E-(E-N)*pt,bt=k-(k-H)*pt,Ct=C-(C-L)*pt;const me=Math.round(Math.min(F,G)),nt=Math.round(Math.max(F,G));let I=f*yt+me*4;for(let rt=me;rt<=nt;rt++)pt=(F-rt)/(F-G),pt<0?pt=0:pt>1&&(pt=1),d[I++]=V-(V-le)*pt|0,d[I++]=$-($-bt)*pt|0,d[I++]=j-(j-Ct)*pt|0,d[I++]=255}}function Ap(u,t,e){const s=t.coords,i=t.colors;let n,a;switch(t.type){case"lattice":const o=t.verticesPerRow,c=Math.floor(s.length/o)-1,h=o-1;for(n=0;n<c;n++){let d=n*o;for(let f=0;f<h;f++,d++)cc(u,e,s[d],s[d+1],s[d+o],i[d],i[d+1],i[d+o]),cc(u,e,s[d+o+1],s[d+1],s[d+o],i[d+o+1],i[d+1],i[d+o])}break;case"triangles":for(n=0,a=s.length;n<a;n+=3)cc(u,e,s[n],s[n+1],s[n+2],i[n],i[n+1],i[n+2]);break;default:throw new Error("illegal figure")}}class _p extends Dh{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,s){const o=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-o,d=Math.ceil(this._bounds[3])-c,f=Math.min(Math.ceil(Math.abs(h*t[0]*1.1)),3e3),p=Math.min(Math.ceil(Math.abs(d*t[1]*1.1)),3e3),g=h/f,m=d/p,y={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-c,scaleX:1/g,scaleY:1/m},x=f+2*2,A=p+2*2,_=s.getCanvas("mesh",x,A),E=_.context,k=E.createImageData(f,p);if(e){const T=k.data;for(let M=0,P=T.length;M<P;M+=4)T[M]=e[0],T[M+1]=e[1],T[M+2]=e[2],T[M+3]=255}for(const T of this._figures)Ap(k,T,y);return E.putImageData(k,2,2),{canvas:_.canvas,offsetX:o-2*g,offsetY:c-2*m,scaleX:g,scaleY:m}}getPattern(t,e,s,i){Vc(t,this._bbox);let n;if(i===ne.SHADING)n=z.singularValueDecompose2dScale(xt(t));else if(n=z.singularValueDecompose2dScale(e.baseTransform),this.matrix){const o=z.singularValueDecompose2dScale(this.matrix);n=[n[0]*o[0],n[1]*o[1]]}const a=this._createMeshCanvas(n,i===ne.SHADING?null:this._background,e.cachedCanvases);return i!==ne.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY),t.createPattern(a.canvas,"no-repeat")}}class xp extends Dh{getPattern(){return"hotpink"}}function Ep(u){switch(u[0]){case"RadialAxial":return new wp(u);case"Mesh":return new _p(u);case"Dummy":return new xp}throw new Error(`Unknown IR type: ${u[0]}`)}const Qh={COLORED:1,UNCOLORED:2},Hl=class Hl{constructor(t,e,s,i,n){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.ctx=s,this.canvasGraphicsFactory=i,this.baseTransform=n}createPatternCanvas(t){const{bbox:e,operatorList:s,paintType:i,tilingType:n,color:a,canvasGraphicsFactory:o}=this;let{xstep:c,ystep:h}=this;c=Math.abs(c),h=Math.abs(h),Ql("TilingType: "+n);const d=e[0],f=e[1],p=e[2],g=e[3],m=p-d,y=g-f,x=z.singularValueDecompose2dScale(this.matrix),A=z.singularValueDecompose2dScale(this.baseTransform),_=x[0]*A[0],E=x[1]*A[1];let k=m,C=y,T=!1,M=!1;const P=Math.ceil(c*_),N=Math.ceil(h*E),H=Math.ceil(m*_),L=Math.ceil(y*E);P>=H?k=c:T=!0,N>=L?C=h:M=!0;const S=this.getSizeAndScale(k,this.ctx.canvas.width,_),R=this.getSizeAndScale(C,this.ctx.canvas.height,E),F=t.cachedCanvases.getCanvas("pattern",S.size,R.size),V=F.context,$=o.createCanvasGraphics(V);if($.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext($,i,a),V.translate(-S.scale*d,-R.scale*f),$.transform(S.scale,0,0,R.scale,0,0),V.save(),this.clipBbox($,d,f,p,g),$.baseTransform=xt($.ctx),$.executeOperatorList(s),$.endDrawing(),V.restore(),T||M){const j=F.canvas;T&&(k=c),M&&(C=h);const G=this.getSizeAndScale(k,this.ctx.canvas.width,_),le=this.getSizeAndScale(C,this.ctx.canvas.height,E),bt=G.size,Ct=le.size,yt=t.cachedCanvases.getCanvas("pattern-workaround",bt,Ct),pt=yt.context,me=T?Math.floor(m/c):0,nt=M?Math.floor(y/h):0;for(let I=0;I<=me;I++)for(let rt=0;rt<=nt;rt++)pt.drawImage(j,bt*I,Ct*rt,bt,Ct,0,0,bt,Ct);return{canvas:yt.canvas,scaleX:G.scale,scaleY:le.scale,offsetX:d,offsetY:f}}return{canvas:F.canvas,scaleX:S.scale,scaleY:R.scale,offsetX:d,offsetY:f}}getSizeAndScale(t,e,s){const i=Math.max(Hl.MAX_PATTERN_SIZE,e);let n=Math.ceil(t*s);return n>=i?n=i:s=n/t,{scale:s,size:n}}clipBbox(t,e,s,i,n){const a=i-e,o=n-s;t.ctx.rect(e,s,a,o),t.current.updateRectMinMax(xt(t.ctx),[e,s,i,n]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,s){const i=t.ctx,n=t.current;switch(e){case Qh.COLORED:const a=this.ctx;i.fillStyle=a.fillStyle,i.strokeStyle=a.strokeStyle,n.fillColor=a.fillStyle,n.strokeColor=a.strokeStyle;break;case Qh.UNCOLORED:const o=z.makeHexColor(s[0],s[1],s[2]);i.fillStyle=o,i.strokeStyle=o,n.fillColor=o,n.strokeColor=o;break;default:throw new Yf(`Unsupported paint type: ${e}`)}}getPattern(t,e,s,i){let n=s;i!==ne.SHADING&&(n=z.transform(n,e.baseTransform),this.matrix&&(n=z.transform(n,this.matrix)));const a=this.createPatternCanvas(e);let o=new DOMMatrix(n);o=o.translate(a.offsetX,a.offsetY),o=o.scale(1/a.scaleX,1/a.scaleY);const c=t.createPattern(a.canvas,"repeat");return c.setTransform(o),c}};q(Hl,"MAX_PATTERN_SIZE",3e3);let Hc=Hl;function kp({src:u,srcPos:t=0,dest:e,width:s,height:i,nonBlackColor:n=4294967295,inverseDecode:a=!1}){const o=re.isLittleEndian?4278190080:255,[c,h]=a?[n,o]:[o,n],d=s>>3,f=s&7,p=u.length;e=new Uint32Array(e.buffer);let g=0;for(let m=0;m<i;m++){for(const x=t+d;t<x;t++){const A=t<p?u[t]:255;e[g++]=A&128?h:c,e[g++]=A&64?h:c,e[g++]=A&32?h:c,e[g++]=A&16?h:c,e[g++]=A&8?h:c,e[g++]=A&4?h:c,e[g++]=A&2?h:c,e[g++]=A&1?h:c}if(f===0)continue;const y=t<p?u[t++]:255;for(let x=0;x<f;x++)e[g++]=y&1<<7-x?h:c}return{srcPos:t,destPos:g}}const Zh=16,Jh=100,Sp=15,td=10,ed=1e3,pe=16;function Cp(u,t){if(u._removeMirroring)throw new Error("Context is already forwarding operations.");u.__originalSave=u.save,u.__originalRestore=u.restore,u.__originalRotate=u.rotate,u.__originalScale=u.scale,u.__originalTranslate=u.translate,u.__originalTransform=u.transform,u.__originalSetTransform=u.setTransform,u.__originalResetTransform=u.resetTransform,u.__originalClip=u.clip,u.__originalMoveTo=u.moveTo,u.__originalLineTo=u.lineTo,u.__originalBezierCurveTo=u.bezierCurveTo,u.__originalRect=u.rect,u.__originalClosePath=u.closePath,u.__originalBeginPath=u.beginPath,u._removeMirroring=()=>{u.save=u.__originalSave,u.restore=u.__originalRestore,u.rotate=u.__originalRotate,u.scale=u.__originalScale,u.translate=u.__originalTranslate,u.transform=u.__originalTransform,u.setTransform=u.__originalSetTransform,u.resetTransform=u.__originalResetTransform,u.clip=u.__originalClip,u.moveTo=u.__originalMoveTo,u.lineTo=u.__originalLineTo,u.bezierCurveTo=u.__originalBezierCurveTo,u.rect=u.__originalRect,u.closePath=u.__originalClosePath,u.beginPath=u.__originalBeginPath,delete u._removeMirroring},u.save=function(){t.save(),this.__originalSave()},u.restore=function(){t.restore(),this.__originalRestore()},u.translate=function(s,i){t.translate(s,i),this.__originalTranslate(s,i)},u.scale=function(s,i){t.scale(s,i),this.__originalScale(s,i)},u.transform=function(s,i,n,a,o,c){t.transform(s,i,n,a,o,c),this.__originalTransform(s,i,n,a,o,c)},u.setTransform=function(s,i,n,a,o,c){t.setTransform(s,i,n,a,o,c),this.__originalSetTransform(s,i,n,a,o,c)},u.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},u.rotate=function(s){t.rotate(s),this.__originalRotate(s)},u.clip=function(s){t.clip(s),this.__originalClip(s)},u.moveTo=function(e,s){t.moveTo(e,s),this.__originalMoveTo(e,s)},u.lineTo=function(e,s){t.lineTo(e,s),this.__originalLineTo(e,s)},u.bezierCurveTo=function(e,s,i,n,a,o){t.bezierCurveTo(e,s,i,n,a,o),this.__originalBezierCurveTo(e,s,i,n,a,o)},u.rect=function(e,s,i,n){t.rect(e,s,i,n),this.__originalRect(e,s,i,n)},u.closePath=function(){t.closePath(),this.__originalClosePath()},u.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class Tp{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,s){let i;return this.cache[t]!==void 0?(i=this.cache[t],this.canvasFactory.reset(i,e,s)):(i=this.canvasFactory.create(e,s),this.cache[t]=i),i}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function Go(u,t,e,s,i,n,a,o,c,h){const[d,f,p,g,m,y]=xt(u);if(f===0&&p===0){const _=a*d+m,E=Math.round(_),k=o*g+y,C=Math.round(k),T=(a+c)*d+m,M=Math.abs(Math.round(T)-E)||1,P=(o+h)*g+y,N=Math.abs(Math.round(P)-C)||1;return u.setTransform(Math.sign(d),0,0,Math.sign(g),E,C),u.drawImage(t,e,s,i,n,0,0,M,N),u.setTransform(d,f,p,g,m,y),[M,N]}if(d===0&&g===0){const _=o*p+m,E=Math.round(_),k=a*f+y,C=Math.round(k),T=(o+h)*p+m,M=Math.abs(Math.round(T)-E)||1,P=(a+c)*f+y,N=Math.abs(Math.round(P)-C)||1;return u.setTransform(0,Math.sign(f),Math.sign(p),0,E,C),u.drawImage(t,e,s,i,n,0,0,N,M),u.setTransform(d,f,p,g,m,y),[N,M]}u.drawImage(t,e,s,i,n,a,o,c,h);const x=Math.hypot(d,f),A=Math.hypot(p,g);return[x*c,A*h]}function Mp(u){const{width:t,height:e}=u;if(t>ed||e>ed)return null;const s=1e3,i=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),n=t+1;let a=new Uint8Array(n*(e+1)),o,c,h;const d=t+7&-8;let f=new Uint8Array(d*e),p=0;for(const A of u.data){let _=128;for(;_>0;)f[p++]=A&_?0:255,_>>=1}let g=0;for(p=0,f[p]!==0&&(a[0]=1,++g),c=1;c<t;c++)f[p]!==f[p+1]&&(a[c]=f[p]?2:1,++g),p++;for(f[p]!==0&&(a[c]=2,++g),o=1;o<e;o++){p=o*d,h=o*n,f[p-d]!==f[p]&&(a[h]=f[p]?1:8,++g);let A=(f[p]?4:0)+(f[p-d]?8:0);for(c=1;c<t;c++)A=(A>>2)+(f[p+1]?4:0)+(f[p-d+1]?8:0),i[A]&&(a[h+c]=i[A],++g),p++;if(f[p-d]!==f[p]&&(a[h+c]=f[p]?2:4,++g),g>s)return null}for(p=d*(e-1),h=o*n,f[p]!==0&&(a[h]=8,++g),c=1;c<t;c++)f[p]!==f[p+1]&&(a[h+c]=f[p]?4:8,++g),p++;if(f[p]!==0&&(a[h+c]=4,++g),g>s)return null;const m=new Int32Array([0,n,-1,0,-n,0,0,0,1]),y=new Path2D;for(o=0;g&&o<=e;o++){let A=o*n;const _=A+t;for(;A<_&&!a[A];)A++;if(A===_)continue;y.moveTo(A%n,o);const E=A;let k=a[A];do{const C=m[k];do A+=C;while(!a[A]);const T=a[A];T!==5&&T!==10?(k=T,a[A]=0):(k=T&51*k>>4,a[A]&=k>>2|k<<2),y.lineTo(A%n,A/n|0),a[A]||--g}while(E!==A);--o}return f=null,a=null,function(A){A.save(),A.scale(1/t,-1/e),A.translate(0,-e),A.fill(y),A.beginPath(),A.restore()}}class sd{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=vd,this.textMatrixScale=1,this.fontMatrix=uc,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=Xt.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,s){[e,s]=z.applyTransform([e,s],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,s),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,s)}updateRectMinMax(t,e){const s=z.applyTransform(e,t),i=z.applyTransform(e.slice(2),t),n=z.applyTransform([e[0],e[3]],t),a=z.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,s[0],i[0],n[0],a[0]),this.minY=Math.min(this.minY,s[1],i[1],n[1],a[1]),this.maxX=Math.max(this.maxX,s[0],i[0],n[0],a[0]),this.maxY=Math.max(this.maxY,s[1],i[1],n[1],a[1])}updateScalingPathMinMax(t,e){z.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,s,i,n,a,o,c,h,d){const f=z.bezierBoundingBox(e,s,i,n,a,o,c,h,d);d||this.updateRectMinMax(t,f)}getPathBoundingBox(t=ne.FILL,e=null){const s=[this.minX,this.minY,this.maxX,this.maxY];if(t===ne.STROKE){e||mt("Stroke bounding box must include transform.");const i=z.singularValueDecompose2dScale(e),n=i[0]*this.lineWidth/2,a=i[1]*this.lineWidth/2;s[0]-=n,s[1]-=a,s[2]+=n,s[3]+=a}return s}updateClipFromPath(){const t=z.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=ne.FILL,e=null){return z.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function id(u,t){if(typeof ImageData<"u"&&t instanceof ImageData){u.putImageData(t,0,0);return}const e=t.height,s=t.width,i=e%pe,n=(e-i)/pe,a=i===0?n:n+1,o=u.createImageData(s,pe);let c=0,h;const d=t.data,f=o.data;let p,g,m,y;if(t.kind===Qo.GRAYSCALE_1BPP){const x=d.byteLength,A=new Uint32Array(f.buffer,0,f.byteLength>>2),_=A.length,E=s+7>>3,k=4294967295,C=re.isLittleEndian?4278190080:255;for(p=0;p<a;p++){for(m=p<n?pe:i,h=0,g=0;g<m;g++){const T=x-c;let M=0;const P=T>E?s:T*8-7,N=P&-8;let H=0,L=0;for(;M<N;M+=8)L=d[c++],A[h++]=L&128?k:C,A[h++]=L&64?k:C,A[h++]=L&32?k:C,A[h++]=L&16?k:C,A[h++]=L&8?k:C,A[h++]=L&4?k:C,A[h++]=L&2?k:C,A[h++]=L&1?k:C;for(;M<P;M++)H===0&&(L=d[c++],H=128),A[h++]=L&H?k:C,H>>=1}for(;h<_;)A[h++]=0;u.putImageData(o,0,p*pe)}}else if(t.kind===Qo.RGBA_32BPP){for(g=0,y=s*pe*4,p=0;p<n;p++)f.set(d.subarray(c,c+y)),c+=y,u.putImageData(o,0,g),g+=pe;p<a&&(y=s*i*4,f.set(d.subarray(c,c+y)),u.putImageData(o,0,g))}else if(t.kind===Qo.RGB_24BPP)for(m=pe,y=s*m,p=0;p<a;p++){for(p>=n&&(m=i,y=s*m),h=0,g=y;g--;)f[h++]=d[c++],f[h++]=d[c++],f[h++]=d[c++],f[h++]=255;u.putImageData(o,0,p*pe)}else throw new Error(`bad image kind: ${t.kind}`)}function nd(u,t){if(t.bitmap){u.drawImage(t.bitmap,0,0);return}const e=t.height,s=t.width,i=e%pe,n=(e-i)/pe,a=i===0?n:n+1,o=u.createImageData(s,pe);let c=0;const h=t.data,d=o.data;for(let f=0;f<a;f++){const p=f<n?pe:i;({srcPos:c}=kp({src:h,srcPos:c,dest:d,width:s,height:p,nonBlackColor:0})),u.putImageData(o,0,f*pe)}}function na(u,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of e)u[s]!==void 0&&(t[s]=u[s]);u.setLineDash!==void 0&&(t.setLineDash(u.getLineDash()),t.lineDashOffset=u.lineDashOffset)}function qo(u){if(u.strokeStyle=u.fillStyle="#000000",u.fillRule="nonzero",u.globalAlpha=1,u.lineWidth=1,u.lineCap="butt",u.lineJoin="miter",u.miterLimit=10,u.globalCompositeOperation="source-over",u.font="10px sans-serif",u.setLineDash!==void 0&&(u.setLineDash([]),u.lineDashOffset=0),!te){const{filter:t}=u;t!=="none"&&t!==""&&(u.filter="none")}}function rd(u,t){if(t)return!0;const e=z.singularValueDecompose2dScale(u);e[0]=Math.fround(e[0]),e[1]=Math.fround(e[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*Li.PDF_TO_CSS_UNITS);return e[0]<=s&&e[1]<=s}const Rp=["butt","round","square"],Pp=["miter","round","bevel"],Lp={},ad={};var Fi,$c,zc;const Wh=class Wh{constructor(t,e,s,i,n,{optionalContentConfig:a,markedContentStack:o=null},c,h){w(this,Fi);this.ctx=t,this.current=new sd(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=s,this.canvasFactory=i,this.filterFactory=n,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedCanvases=new Tp(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=h,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,e=null){return typeof t=="string"?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing({transform:t,viewport:e,transparency:s=!1,background:i=null}){const n=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,n,a),this.ctx.fillStyle=o,s){const c=this.cachedCanvases.getCanvas("transparent",n,a);this.compositeCtx=this.ctx,this.transparentCanvas=c.canvas,this.ctx=c.context,this.ctx.save(),this.ctx.transform(...xt(this.compositeCtx))}this.ctx.save(),qo(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=xt(this.ctx)}executeOperatorList(t,e,s,i){const n=t.argsArray,a=t.fnArray;let o=e||0;const c=n.length;if(c===o)return o;const h=c-o>td&&typeof s=="function",d=h?Date.now()+Sp:0;let f=0;const p=this.commonObjs,g=this.objs;let m;for(;;){if(i!==void 0&&o===i.nextBreakPoint)return i.breakIt(o,s),o;if(m=a[o],m!==$e.dependency)this[m].apply(this,n[o]);else for(const y of n[o]){const x=y.startsWith("g_")?p:g;if(!x.has(y))return x.get(y,s),o}if(o++,o===c)return o;if(h&&++f>td){if(Date.now()>d)return s(),o;f=0}}}endDrawing(){b(this,Fi,$c).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),b(this,Fi,zc).call(this)}_scaleImage(t,e){const s=t.width??t.displayWidth,i=t.height??t.displayHeight;let n=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),o=s,c=i,h="prescale1",d,f;for(;n>2&&o>1||a>2&&c>1;){let p=o,g=c;n>2&&o>1&&(p=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),n/=o/p),a>2&&c>1&&(g=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,a/=c/g),d=this.cachedCanvases.getCanvas(h,p,g),f=d.context,f.clearRect(0,0,p,g),f.drawImage(t,0,0,o,c,0,0,p,g),t=d.canvas,o=p,c=g,h=h==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:o,paintHeight:c}}_createMaskCanvas(t){const e=this.ctx,{width:s,height:i}=t,n=this.current.fillColor,a=this.current.patternFill,o=xt(e);let c,h,d,f;if((t.bitmap||t.data)&&t.count>1){const P=t.bitmap||t.data.buffer;h=JSON.stringify(a?o:[o.slice(0,4),n]),c=this._cachedBitmapsMap.get(P),c||(c=new Map,this._cachedBitmapsMap.set(P,c));const N=c.get(h);if(N&&!a){const H=Math.round(Math.min(o[0],o[2])+o[4]),L=Math.round(Math.min(o[1],o[3])+o[5]);return{canvas:N,offsetX:H,offsetY:L}}d=N}d||(f=this.cachedCanvases.getCanvas("maskCanvas",s,i),nd(f.context,t));let p=z.transform(o,[1/s,0,0,-1/i,0,0]);p=z.transform(p,[1,0,0,1,0,-i]);const[g,m,y,x]=z.getAxialAlignedBoundingBox([0,0,s,i],p),A=Math.round(y-g)||1,_=Math.round(x-m)||1,E=this.cachedCanvases.getCanvas("fillCanvas",A,_),k=E.context,C=g,T=m;k.translate(-C,-T),k.transform(...p),d||(d=this._scaleImage(f.canvas,_s(k)),d=d.img,c&&a&&c.set(h,d)),k.imageSmoothingEnabled=rd(xt(k),t.interpolate),Go(k,d,0,0,d.width,d.height,0,0,s,i),k.globalCompositeOperation="source-in";const M=z.transform(_s(k),[1,0,0,1,-C,-T]);return k.fillStyle=a?n.getPattern(e,this,M,ne.FILL):n,k.fillRect(0,0,s,i),c&&!a&&(this.cachedCanvases.delete("fillCanvas"),c.set(h,E.canvas)),{canvas:E.canvas,offsetX:Math.round(C),offsetY:Math.round(T)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=Rp[t]}setLineJoin(t){this.ctx.lineJoin=Pp[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const s=this.ctx;s.setLineDash!==void 0&&(s.setLineDash(t),s.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,s]of t)switch(e){case"LW":this.setLineWidth(s);break;case"LC":this.setLineCap(s);break;case"LJ":this.setLineJoin(s);break;case"ML":this.setMiterLimit(s);break;case"D":this.setDash(s[0],s[1]);break;case"RI":this.setRenderingIntent(s);break;case"FL":this.setFlatness(s);break;case"Font":this.setFont(s[0],s[1]);break;case"CA":this.current.strokeAlpha=s;break;case"ca":this.current.fillAlpha=s,this.ctx.globalAlpha=s;break;case"BM":this.ctx.globalCompositeOperation=s;break;case"SMask":this.current.activeSMask=s?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,e=this.ctx.canvas.height,s="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(s,t,e);this.suspendedCtx=this.ctx,this.ctx=i.context;const n=this.ctx;n.setTransform(...xt(this.suspendedCtx)),na(this.suspendedCtx,n),Cp(n,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),na(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,s=this.suspendedCtx;this.composeSMask(s,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,s,i){const n=i[0],a=i[1],o=i[2]-n,c=i[3]-a;o===0||c===0||(this.genericComposeSMask(e.context,s,o,c,e.subtype,e.backdrop,e.transferMap,n,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(s.canvas,0,0),t.restore())}genericComposeSMask(t,e,s,i,n,a,o,c,h,d,f){let p=t.canvas,g=c-d,m=h-f;if(a){const x=z.makeHexColor(...a);if(g<0||m<0||g+s>p.width||m+i>p.height){const A=this.cachedCanvases.getCanvas("maskExtension",s,i),_=A.context;_.drawImage(p,-g,-m),_.globalCompositeOperation="destination-atop",_.fillStyle=x,_.fillRect(0,0,s,i),_.globalCompositeOperation="source-over",p=A.canvas,g=m=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const A=new Path2D;A.rect(g,m,s,i),t.clip(A),t.globalCompositeOperation="destination-atop",t.fillStyle=x,t.fillRect(g,m,s,i),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),n==="Alpha"&&o?e.filter=this.filterFactory.addAlphaFilter(o):n==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(o));const y=new Path2D;y.rect(c,h,s,i),e.clip(y),e.globalCompositeOperation="destination-in",e.drawImage(p,g,m,s,i,c,h,s,i),e.restore()}save(){this.inSMaskMode?(na(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),na(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,s,i,n,a){this.ctx.transform(t,e,s,i,n,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,s){const i=this.ctx,n=this.current;let a=n.x,o=n.y,c,h;const d=xt(i),f=d[0]===0&&d[3]===0||d[1]===0&&d[2]===0,p=f?s.slice(0):null;for(let g=0,m=0,y=t.length;g<y;g++)switch(t[g]|0){case $e.rectangle:a=e[m++],o=e[m++];const x=e[m++],A=e[m++],_=a+x,E=o+A;i.moveTo(a,o),x===0||A===0?i.lineTo(_,E):(i.lineTo(_,o),i.lineTo(_,E),i.lineTo(a,E)),f||n.updateRectMinMax(d,[a,o,_,E]),i.closePath();break;case $e.moveTo:a=e[m++],o=e[m++],i.moveTo(a,o),f||n.updatePathMinMax(d,a,o);break;case $e.lineTo:a=e[m++],o=e[m++],i.lineTo(a,o),f||n.updatePathMinMax(d,a,o);break;case $e.curveTo:c=a,h=o,a=e[m+4],o=e[m+5],i.bezierCurveTo(e[m],e[m+1],e[m+2],e[m+3],a,o),n.updateCurvePathMinMax(d,c,h,e[m],e[m+1],e[m+2],e[m+3],a,o,p),m+=6;break;case $e.curveTo2:c=a,h=o,i.bezierCurveTo(a,o,e[m],e[m+1],e[m+2],e[m+3]),n.updateCurvePathMinMax(d,c,h,a,o,e[m],e[m+1],e[m+2],e[m+3],p),a=e[m+2],o=e[m+3],m+=4;break;case $e.curveTo3:c=a,h=o,a=e[m+2],o=e[m+3],i.bezierCurveTo(e[m],e[m+1],a,o,a,o),n.updateCurvePathMinMax(d,c,h,e[m],e[m+1],a,o,a,o,p),m+=4;break;case $e.closePath:i.closePath();break}f&&n.updateScalingPathMinMax(d,p),n.setCurrentPoint(a,o)}closePath(){this.ctx.closePath()}stroke(t=!0){const e=this.ctx,s=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof s=="object"&&(s!=null&&s.getPattern)?(e.save(),e.strokeStyle=s.getPattern(e,this,_s(e),ne.STROKE),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const e=this.ctx,s=this.current.fillColor,i=this.current.patternFill;let n=!1;i&&(e.save(),e.fillStyle=s.getPattern(e,this,_s(e),ne.FILL),n=!0);const a=this.current.getClippedPathBoundingBox();this.contentVisible&&a!==null&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),n&&e.restore(),t&&this.consumePath(a)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=Lp}eoClip(){this.pendingClip=ad}beginText(){this.current.textMatrix=vd,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,e=this.ctx;if(t===void 0){e.beginPath();return}e.save(),e.beginPath();for(const s of t)e.setTransform(...s.transform),e.translate(s.x,s.y),s.addToPath(e,s.fontSize);e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){var d;const s=this.commonObjs.get(t),i=this.current;if(!s)throw new Error(`Can't find font for ${t}`);if(i.fontMatrix=s.fontMatrix||uc,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&J("Invalid font matrix for font "+t),e<0?(e=-e,i.fontDirection=-1):i.fontDirection=1,this.current.font=s,this.current.fontSize=e,s.isType3Font)return;const n=s.loadedName||"sans-serif",a=((d=s.systemFontInfo)==null?void 0:d.css)||`"${n}", ${s.fallbackName}`;let o="normal";s.black?o="900":s.bold&&(o="bold");const c=s.italic?"italic":"normal";let h=e;e<Zh?h=Zh:e>Jh&&(h=Jh),this.current.fontSizeScale=e/h,this.ctx.font=`${c} ${o} ${h}px ${a}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,s,i,n,a){this.current.textMatrix=[t,e,s,i,n,a],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,s,i){const n=this.ctx,a=this.current,o=a.font,c=a.textRenderingMode,h=a.fontSize/a.fontSizeScale,d=c&Xt.FILL_STROKE_MASK,f=!!(c&Xt.ADD_TO_PATH_FLAG),p=a.patternFill&&!o.missingFile;let g;(o.disableFontFace||f||p)&&(g=o.getPathGenerator(this.commonObjs,t)),o.disableFontFace||p?(n.save(),n.translate(e,s),n.beginPath(),g(n,h),i&&n.setTransform(...i),(d===Xt.FILL||d===Xt.FILL_STROKE)&&n.fill(),(d===Xt.STROKE||d===Xt.FILL_STROKE)&&n.stroke(),n.restore()):((d===Xt.FILL||d===Xt.FILL_STROKE)&&n.fillText(t,e,s),(d===Xt.STROKE||d===Xt.FILL_STROKE)&&n.strokeText(t,e,s)),f&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:xt(n),x:e,y:s,fontSize:h,addToPath:g})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let s=!1;for(let i=3;i<e.length;i+=4)if(e[i]>0&&e[i]<255){s=!0;break}return it(this,"isFontSubpixelAAEnabled",s)}showText(t){const e=this.current,s=e.font;if(s.isType3Font)return this.showType3Text(t);const i=e.fontSize;if(i===0)return;const n=this.ctx,a=e.fontSizeScale,o=e.charSpacing,c=e.wordSpacing,h=e.fontDirection,d=e.textHScale*h,f=t.length,p=s.vertical,g=p?1:-1,m=s.defaultVMetrics,y=i*e.fontMatrix[0],x=e.textRenderingMode===Xt.FILL&&!s.disableFontFace&&!e.patternFill;n.save(),n.transform(...e.textMatrix),n.translate(e.x,e.y+e.textRise),h>0?n.scale(d,-1):n.scale(d,1);let A;if(e.patternFill){n.save();const T=e.fillColor.getPattern(n,this,_s(n),ne.FILL);A=xt(n),n.restore(),n.fillStyle=T}let _=e.lineWidth;const E=e.textMatrixScale;if(E===0||_===0){const T=e.textRenderingMode&Xt.FILL_STROKE_MASK;(T===Xt.STROKE||T===Xt.FILL_STROKE)&&(_=this.getSinglePixelWidth())}else _/=E;if(a!==1&&(n.scale(a,a),_/=a),n.lineWidth=_,s.isInvalidPDFjsFont){const T=[];let M=0;for(const P of t)T.push(P.unicode),M+=P.width;n.fillText(T.join(""),0,0),e.x+=M*y*d,n.restore(),this.compose();return}let k=0,C;for(C=0;C<f;++C){const T=t[C];if(typeof T=="number"){k+=g*T*i/1e3;continue}let M=!1;const P=(T.isSpace?c:0)+o,N=T.fontChar,H=T.accent;let L,S,R=T.width;if(p){const V=T.vmetric||m,$=-(T.vmetric?V[1]:R*.5)*y,j=V[2]*y;R=V?-V[0]:R,L=$/a,S=(k+j)/a}else L=k/a,S=0;if(s.remeasure&&R>0){const V=n.measureText(N).width*1e3/i*a;if(R<V&&this.isFontSubpixelAAEnabled){const $=R/V;M=!0,n.save(),n.scale($,1),L/=$}else R!==V&&(L+=(R-V)/2e3*i/a)}if(this.contentVisible&&(T.isInFont||s.missingFile)){if(x&&!H)n.fillText(N,L,S);else if(this.paintChar(N,L,S,A),H){const V=L+i*H.offset.x/a,$=S-i*H.offset.y/a;this.paintChar(H.fontChar,V,$,A)}}const F=p?R*y-P*h:R*y+P*h;k+=F,M&&n.restore()}p?e.y-=k:e.x+=k*d,n.restore(),this.compose()}showType3Text(t){const e=this.ctx,s=this.current,i=s.font,n=s.fontSize,a=s.fontDirection,o=i.vertical?1:-1,c=s.charSpacing,h=s.wordSpacing,d=s.textHScale*a,f=s.fontMatrix||uc,p=t.length,g=s.textRenderingMode===Xt.INVISIBLE;let m,y,x,A;if(!(g||n===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...s.textMatrix),e.translate(s.x,s.y),e.scale(d,a),m=0;m<p;++m){if(y=t[m],typeof y=="number"){A=o*y*n/1e3,this.ctx.translate(A,0),s.x+=A*d;continue}const _=(y.isSpace?h:0)+c,E=i.charProcOperatorList[y.operatorListId];if(!E){J(`Type3 character "${y.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=y,this.save(),e.scale(n,n),e.transform(...f),this.executeOperatorList(E),this.restore()),x=z.applyTransform([y.width,0],f)[0]*n+_,e.translate(x,0),s.x+=x*d}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,s,i,n,a){this.ctx.rect(s,i,n-s,a-i),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if(t[0]==="TilingPattern"){const s=t[1],i=this.baseTransform||xt(this.ctx),n={createCanvasGraphics:a=>new Wh(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new Hc(t,s,this.ctx,n,i)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,s){this.ctx.strokeStyle=this.current.strokeColor=z.makeHexColor(t,e,s)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(t,e,s){this.ctx.fillStyle=this.current.fillColor=z.makeHexColor(t,e,s),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e=null){let s;return this.cachedPatterns.has(t)?s=this.cachedPatterns.get(t):(s=Ep(this.getObject(t)),this.cachedPatterns.set(t,s)),e&&(s.matrix=e),s}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const s=this._getPattern(t);e.fillStyle=s.getPattern(e,this,_s(e),ne.SHADING);const i=_s(e);if(i){const{width:n,height:a}=e.canvas,[o,c,h,d]=z.getAxialAlignedBoundingBox([0,0,n,a],i);this.ctx.fillRect(o,c,h-o,d-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){mt("Should not call beginInlineImage")}beginImageData(){mt("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=xt(this.ctx),e)){const s=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],s,i),this.current.updateRectMinMax(xt(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;t.isolated||Ql("TODO: Support non-isolated groups."),t.knockout&&J("Knockout groups not supported.");const s=xt(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let i=z.getAxialAlignedBoundingBox(t.bbox,xt(e));const n=[0,0,e.canvas.width,e.canvas.height];i=z.intersect(i,n)||[0,0,0,0];const a=Math.floor(i[0]),o=Math.floor(i[1]),c=Math.max(Math.ceil(i[2])-a,1),h=Math.max(Math.ceil(i[3])-o,1);this.current.startNewPathAndClipBox([0,0,c,h]);let d="groupAt"+this.groupLevel;t.smask&&(d+="_smask_"+this.smaskCounter++%2);const f=this.cachedCanvases.getCanvas(d,c,h),p=f.context;p.translate(-a,-o),p.transform(...s),t.smask?this.smaskStack.push({canvas:f.canvas,context:p,offsetX:a,offsetY:o,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(a,o),e.save()),na(e,p),this.ctx=p,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const i=xt(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...i);const n=z.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],i);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(t,e,s,i,n){if(b(this,Fi,$c).call(this),qo(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const a=e[2]-e[0],o=e[3]-e[1];if(n&&this.annotationCanvasMap){s=s.slice(),s[4]-=e[0],s[5]-=e[1],e=e.slice(),e[0]=e[1]=0,e[2]=a,e[3]=o;const[c,h]=z.singularValueDecompose2dScale(xt(this.ctx)),{viewportScale:d}=this,f=Math.ceil(a*this.outputScaleX*d),p=Math.ceil(o*this.outputScaleY*d);this.annotationCanvas=this.canvasFactory.create(f,p);const{canvas:g,context:m}=this.annotationCanvas;this.annotationCanvasMap.set(t,g),this.annotationCanvas.savedCtx=this.ctx,this.ctx=m,this.ctx.save(),this.ctx.setTransform(c,0,0,-h,0,o*h),qo(this.ctx)}else qo(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],a,o),this.ctx.clip(),this.ctx.beginPath()}this.current=new sd(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...s),this.transform(...i)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),b(this,Fi,zc).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;t=this.getObject(t.data,t),t.count=e;const s=this.ctx,i=this.processingType3;if(i&&(i.compiled===void 0&&(i.compiled=Mp(t)),i.compiled)){i.compiled(s);return}const n=this._createMaskCanvas(t),a=n.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(a,n.offsetX,n.offsetY),s.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,s=0,i=0,n,a){if(!this.contentVisible)return;t=this.getObject(t.data,t);const o=this.ctx;o.save();const c=xt(o);o.transform(e,s,i,n,0,0);const h=this._createMaskCanvas(t);o.setTransform(1,0,0,1,h.offsetX-c[4],h.offsetY-c[5]);for(let d=0,f=a.length;d<f;d+=2){const p=z.transform(c,[e,s,i,n,a[d],a[d+1]]),[g,m]=z.applyTransform([0,0],p);o.drawImage(h.canvas,g,m)}o.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,s=this.current.fillColor,i=this.current.patternFill;for(const n of t){const{data:a,width:o,height:c,transform:h}=n,d=this.cachedCanvases.getCanvas("maskCanvas",o,c),f=d.context;f.save();const p=this.getObject(a,n);nd(f,p),f.globalCompositeOperation="source-in",f.fillStyle=i?s.getPattern(f,this,_s(e),ne.FILL):s,f.fillRect(0,0,o,c),f.restore(),e.save(),e.transform(...h),e.scale(1,-1),Go(e,d.canvas,0,0,o,c,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);if(!e){J("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e)}paintImageXObjectRepeat(t,e,s,i){if(!this.contentVisible)return;const n=this.getObject(t);if(!n){J("Dependent image isn't ready yet");return}const a=n.width,o=n.height,c=[];for(let h=0,d=i.length;h<d;h+=2)c.push({transform:[e,0,0,s,i[h],i[h+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(n,c)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return t.bitmap;const{bitmap:e,width:s,height:i}=t,n=this.cachedCanvases.getCanvas("inlineImage",s,i),a=n.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",n.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,s=t.height,i=this.ctx;if(this.save(),!te){const{filter:o}=i;o!=="none"&&o!==""&&(i.filter="none")}i.scale(1/e,-1/s);let n;if(t.bitmap)n=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)n=t;else{const c=this.cachedCanvases.getCanvas("inlineImage",e,s).context;id(c,t),n=this.applyTransferMapsToCanvas(c)}const a=this._scaleImage(n,_s(i));i.imageSmoothingEnabled=rd(xt(i),t.interpolate),Go(i,a.img,0,0,a.paintWidth,a.paintHeight,0,-s,e,s),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const s=this.ctx;let i;if(t.bitmap)i=t.bitmap;else{const n=t.width,a=t.height,c=this.cachedCanvases.getCanvas("inlineImage",n,a).context;id(c,t),i=this.applyTransferMapsToCanvas(c)}for(const n of e)s.save(),s.transform(...n.transform),s.scale(1,-1),Go(s,i,n.x,n.y,n.w,n.h,0,-1,1,1),s.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const s=this.ctx;this.pendingClip&&(e||(this.pendingClip===ad?s.clip("evenodd"):s.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),s.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=xt(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),s=Math.hypot(t[0],t[2]),i=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(s,i)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:e,b:s,c:i,d:n}=this.ctx.getTransform();let a,o;if(s===0&&i===0){const c=Math.abs(e),h=Math.abs(n);if(c===h)if(t===0)a=o=1/c;else{const d=c*t;a=o=d<1?1/d:1}else if(t===0)a=1/c,o=1/h;else{const d=c*t,f=h*t;a=d<1?1/d:1,o=f<1?1/f:1}}else{const c=Math.abs(e*n-s*i),h=Math.hypot(e,s),d=Math.hypot(i,n);if(t===0)a=d/c,o=h/c;else{const f=t*c;a=d>f?d/f:1,o=h>f?h/f:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:s}=this.current,[i,n]=this.getScaleForStroking();if(e.lineWidth=s||1,i===1&&n===1){e.stroke();return}const a=e.getLineDash();if(t&&e.save(),e.scale(i,n),a.length>0){const o=Math.max(i,n);e.setLineDash(a.map(c=>c/o)),e.lineDashOffset/=o}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};Fi=new WeakSet,$c=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)},zc=function(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}};let ir=Wh;for(const u in $e)ir.prototype[u]!==void 0&&(ir.prototype[$e[u]]=ir.prototype[u]);var Xa,Ya;class Ks{static get workerPort(){return r(this,Xa)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");v(this,Xa,t)}static get workerSrc(){return r(this,Ya)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");v(this,Ya,t)}}Xa=new WeakMap,Ya=new WeakMap,w(Ks,Xa,null),w(Ks,Ya,"");const Xo={DATA:1,ERROR:2},Tt={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function ve(u){switch(u instanceof Error||typeof u=="object"&&u!==null||mt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),u.name){case"AbortException":return new Gn(u.message);case"MissingPDFException":return new Un(u.message);case"PasswordException":return new fc(u.message,u.code);case"UnexpectedResponseException":return new Zl(u.message,u.status);case"UnknownErrorException":return new pc(u.message,u.details);default:return new pc(u.message,u.toString())}}var yr,Be,eu,su,iu,rl;class fa{constructor(t,e,s){w(this,Be);w(this,yr,new AbortController);this.sourceName=t,this.targetName=e,this.comObj=s,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),s.addEventListener("message",b(this,Be,eu).bind(this),{signal:r(this,yr).signal})}on(t,e){const s=this.actionHandler;if(s[t])throw new Error(`There is already an actionName called "${t}"`);s[t]=e}send(t,e,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},s)}sendWithPromise(t,e,s){const i=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[i]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},s)}catch(a){n.reject(a)}return n.promise}sendWithStream(t,e,s,i){const n=this.streamId++,a=this.sourceName,o=this.targetName,c=this.comObj;return new ReadableStream({start:h=>{const d=Promise.withResolvers();return this.streamControllers[n]={controller:h,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:a,targetName:o,action:t,streamId:n,data:e,desiredSize:h.desiredSize},i),d.promise},pull:h=>{const d=Promise.withResolvers();return this.streamControllers[n].pullCall=d,c.postMessage({sourceName:a,targetName:o,stream:Tt.PULL,streamId:n,desiredSize:h.desiredSize}),d.promise},cancel:h=>{Dt(h instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[n].cancelCall=d,this.streamControllers[n].isClosed=!0,c.postMessage({sourceName:a,targetName:o,stream:Tt.CANCEL,streamId:n,reason:ve(h)}),d.promise}},s)}destroy(){var t;(t=r(this,yr))==null||t.abort(),v(this,yr,null)}}yr=new WeakMap,Be=new WeakSet,eu=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){b(this,Be,iu).call(this,t);return}if(t.callback){const s=t.callbackId,i=this.callbackCapabilities[s];if(!i)throw new Error(`Cannot resolve callback ${s}`);if(delete this.callbackCapabilities[s],t.callback===Xo.DATA)i.resolve(t.data);else if(t.callback===Xo.ERROR)i.reject(ve(t.reason));else throw new Error("Unexpected callback case");return}const e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const s=this.sourceName,i=t.sourceName,n=this.comObj;new Promise(function(a){a(e(t.data))}).then(function(a){n.postMessage({sourceName:s,targetName:i,callback:Xo.DATA,callbackId:t.callbackId,data:a})},function(a){n.postMessage({sourceName:s,targetName:i,callback:Xo.ERROR,callbackId:t.callbackId,reason:ve(a)})});return}if(t.streamId){b(this,Be,su).call(this,t);return}e(t.data)},su=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,a=this,o=this.actionHandler[t.action],c={enqueue(h,d=1,f){if(this.isCancelled)return;const p=this.desiredSize;this.desiredSize-=d,p>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:s,targetName:i,stream:Tt.ENQUEUE,streamId:e,chunk:h},f)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:Tt.CLOSE,streamId:e}),delete a.streamSinks[e])},error(h){Dt(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:Tt.ERROR,streamId:e,reason:ve(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[e]=c,new Promise(function(h){h(o(t.data,c))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Tt.START_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:Tt.START_COMPLETE,streamId:e,reason:ve(h)})})},iu=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,a=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case Tt.START_COMPLETE:t.success?a.startCall.resolve():a.startCall.reject(ve(t.reason));break;case Tt.PULL_COMPLETE:t.success?a.pullCall.resolve():a.pullCall.reject(ve(t.reason));break;case Tt.PULL:if(!o){n.postMessage({sourceName:s,targetName:i,stream:Tt.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,new Promise(function(c){var h;c((h=o.onPull)==null?void 0:h.call(o))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Tt.PULL_COMPLETE,streamId:e,success:!0})},function(c){n.postMessage({sourceName:s,targetName:i,stream:Tt.PULL_COMPLETE,streamId:e,reason:ve(c)})});break;case Tt.ENQUEUE:if(Dt(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case Tt.CLOSE:if(Dt(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),b(this,Be,rl).call(this,a,e);break;case Tt.ERROR:Dt(a,"error should have stream controller"),a.controller.error(ve(t.reason)),b(this,Be,rl).call(this,a,e);break;case Tt.CANCEL_COMPLETE:t.success?a.cancelCall.resolve():a.cancelCall.reject(ve(t.reason)),b(this,Be,rl).call(this,a,e);break;case Tt.CANCEL:if(!o)break;new Promise(function(c){var h;c((h=o.onCancel)==null?void 0:h.call(o,ve(t.reason)))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Tt.CANCEL_COMPLETE,streamId:e,success:!0})},function(c){n.postMessage({sourceName:s,targetName:i,stream:Tt.CANCEL_COMPLETE,streamId:e,reason:ve(c)})}),o.sinkCapability.reject(ve(t.reason)),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},rl=async function(t,e){var s,i,n;await Promise.allSettled([(s=t.startCall)==null?void 0:s.promise,(i=t.pullCall)==null?void 0:i.promise,(n=t.cancelCall)==null?void 0:n.promise]),delete this.streamControllers[e]};var cn,Ka;class Np{constructor({parsedData:t,rawData:e}){w(this,cn);w(this,Ka);v(this,cn,t),v(this,Ka,e)}getRaw(){return r(this,Ka)}get(t){return r(this,cn).get(t)??null}getAll(){return Mh(r(this,cn))}has(t){return r(this,cn).has(t)}}cn=new WeakMap,Ka=new WeakMap;const Zn=Symbol("INTERNAL");var Qa,Za,Ja,wr;class Ip{constructor(t,{name:e,intent:s,usage:i,rbGroups:n}){w(this,Qa,!1);w(this,Za,!1);w(this,Ja,!1);w(this,wr,!0);v(this,Qa,!!(t&Se.DISPLAY)),v(this,Za,!!(t&Se.PRINT)),this.name=e,this.intent=s,this.usage=i,this.rbGroups=n}get visible(){if(r(this,Ja))return r(this,wr);if(!r(this,wr))return!1;const{print:t,view:e}=this.usage;return r(this,Qa)?(e==null?void 0:e.viewState)!=="OFF":r(this,Za)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,s=!1){t!==Zn&&mt("Internal method `_setVisible` called."),v(this,Ja,s),v(this,wr,e)}}Qa=new WeakMap,Za=new WeakMap,Ja=new WeakMap,wr=new WeakMap;var mi,ht,Ar,_r,to,jc;class Fp{constructor(t,e=Se.DISPLAY){w(this,to);w(this,mi,null);w(this,ht,new Map);w(this,Ar,null);w(this,_r,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,v(this,_r,t.order);for(const s of t.groups)r(this,ht).set(s.id,new Ip(e,s));if(t.baseState==="OFF")for(const s of r(this,ht).values())s._setVisible(Zn,!1);for(const s of t.on)r(this,ht).get(s)._setVisible(Zn,!0);for(const s of t.off)r(this,ht).get(s)._setVisible(Zn,!1);v(this,Ar,this.getHash())}}isVisible(t){if(r(this,ht).size===0)return!0;if(!t)return Ql("Optional content group not defined."),!0;if(t.type==="OCG")return r(this,ht).has(t.id)?r(this,ht).get(t.id).visible:(J(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return b(this,to,jc).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!r(this,ht).has(e))return J(`Optional content group not found: ${e}`),!0;if(r(this,ht).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!r(this,ht).has(e))return J(`Optional content group not found: ${e}`),!0;if(!r(this,ht).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!r(this,ht).has(e))return J(`Optional content group not found: ${e}`),!0;if(!r(this,ht).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!r(this,ht).has(e))return J(`Optional content group not found: ${e}`),!0;if(r(this,ht).get(e).visible)return!1}return!0}return J(`Unknown optional content policy ${t.policy}.`),!0}return J(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,s=!0){var n;const i=r(this,ht).get(t);if(!i){J(`Optional content group not found: ${t}`);return}if(s&&e&&i.rbGroups.length)for(const a of i.rbGroups)for(const o of a)o!==t&&((n=r(this,ht).get(o))==null||n._setVisible(Zn,!1,!0));i._setVisible(Zn,!!e,!0),v(this,mi,null)}setOCGState({state:t,preserveRB:e}){let s;for(const i of t){switch(i){case"ON":case"OFF":case"Toggle":s=i;continue}const n=r(this,ht).get(i);if(n)switch(s){case"ON":this.setVisibility(i,!0,e);break;case"OFF":this.setVisibility(i,!1,e);break;case"Toggle":this.setVisibility(i,!n.visible,e);break}}v(this,mi,null)}get hasInitialVisibility(){return r(this,Ar)===null||this.getHash()===r(this,Ar)}getOrder(){return r(this,ht).size?r(this,_r)?r(this,_r).slice():[...r(this,ht).keys()]:null}getGroups(){return r(this,ht).size>0?Mh(r(this,ht)):null}getGroup(t){return r(this,ht).get(t)||null}getHash(){if(r(this,mi)!==null)return r(this,mi);const t=new Wd;for(const[e,s]of r(this,ht))t.update(`${e}:${s.visible}`);return v(this,mi,t.hexdigest())}}mi=new WeakMap,ht=new WeakMap,Ar=new WeakMap,_r=new WeakMap,to=new WeakSet,jc=function(t){const e=t.length;if(e<2)return!0;const s=t[0];for(let i=1;i<e;i++){const n=t[i];let a;if(Array.isArray(n))a=b(this,to,jc).call(this,n);else if(r(this,ht).has(n))a=r(this,ht).get(n).visible;else return J(`Optional content group not found: ${n}`),!0;switch(s){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return s==="And"};class Dp{constructor(t,{disableRange:e=!1,disableStream:s=!1}){Dt(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:i,initialData:n,progressiveDone:a,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=o,(n==null?void 0:n.length)>0){const c=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(c)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!s,this._isRangeSupported=!e,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((c,h)=>{this._onReceiveData({begin:c,chunk:h})}),t.addProgressListener((c,h)=>{this._onProgress({loaded:c,total:h})}),t.addProgressiveReadListener(c=>{this._onReceiveData({chunk:c})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){const s=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s);else{const i=this._rangeReaders.some(function(n){return n._begin!==t?!1:(n._enqueue(s),!0)});Dt(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}_onProgress(t){var e,s,i,n;t.total===void 0?(s=(e=this._rangeReaders[0])==null?void 0:e.onProgress)==null||s.call(e,{loaded:t.loaded}):(n=(i=this._fullRequestReader)==null?void 0:i.onProgress)==null||n.call(i,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;(t=this._fullRequestReader)==null||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){Dt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new Op(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new Bp(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeReaders.slice(0))s.cancel(t);this._pdfDataRangeTransport.abort()}}class Op{constructor(t,e,s=!1,i=null){this._stream=t,this._done=s||!1,this._filename=Lh(i)?i:null,this._queuedChunks=e||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Bp{constructor(t,e,s){this._stream=t,this._begin=e,this._end=s,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length===0)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Vp(u){let t=!0,e=s("filename\\*","i").exec(u);if(e){e=e[1];let d=o(e);return d=unescape(d),d=c(d),d=h(d),n(d)}if(e=a(u),e){const d=h(e);return n(d)}if(e=s("filename","i").exec(u),e){e=e[1];let d=o(e);return d=h(d),n(d)}function s(d,f){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',f)}function i(d,f){if(d){if(!/^[\x00-\xFF]+$/.test(f))return f;try{const p=new TextDecoder(d,{fatal:!0}),g=Jl(f);f=p.decode(g),t=!1}catch{}}return f}function n(d){return t&&/[\x80-\xff]/.test(d)&&(d=i("utf-8",d),t&&(d=i("iso-8859-1",d))),d}function a(d){const f=[];let p;const g=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(p=g.exec(d))!==null;){let[,y,x,A]=p;if(y=parseInt(y,10),y in f){if(y===0)break;continue}f[y]=[x,A]}const m=[];for(let y=0;y<f.length&&y in f;++y){let[x,A]=f[y];A=o(A),x&&(A=unescape(A),y===0&&(A=c(A))),m.push(A)}return m.join("")}function o(d){if(d.startsWith('"')){const f=d.slice(1).split('\\"');for(let p=0;p<f.length;++p){const g=f[p].indexOf('"');g!==-1&&(f[p]=f[p].slice(0,g),f.length=p+1),f[p]=f[p].replaceAll(/\\(.)/g,"$1")}d=f.join('"')}return d}function c(d){const f=d.indexOf("'");if(f===-1)return d;const p=d.slice(0,f),m=d.slice(f+1).replace(/^[^']*'/,"");return i(p,m)}function h(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(f,p,g,m){if(g==="q"||g==="Q")return m=m.replaceAll("_"," "),m=m.replaceAll(/=([0-9a-fA-F]{2})/g,function(y,x){return String.fromCharCode(parseInt(x,16))}),i(p,m);try{m=atob(m)}catch{}return i(p,m)})}return""}function Oh(u,t){const e=new Headers;if(!u||!t||typeof t!="object")return e;for(const s in t){const i=t[s];i!==void 0&&e.append(s,i)}return e}function Bh({responseHeaders:u,isHttp:t,rangeChunkSize:e,disableRange:s}){const i={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(u.get("Content-Length"),10);return!Number.isInteger(n)||(i.suggestedLength=n,n<=2*e)||s||!t||u.get("Accept-Ranges")!=="bytes"||(u.get("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function Vh(u){const t=u.get("Content-Disposition");if(t){let e=Vp(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Lh(e))return e}return null}function sc(u,t){return u===404||u===0&&t.startsWith("file:")?new Un('Missing PDF "'+t+'".'):new Zl(`Unexpected server response (${u}) while retrieving PDF "${t}".`,u)}function nu(u){return u===200||u===206}function ru(u,t,e){return{method:"GET",headers:u,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function au(u){return u instanceof Uint8Array?u.buffer:u instanceof ArrayBuffer?u:(J(`getArrayBuffer - unexpected data format: ${u}`),new Uint8Array(u).buffer)}class od{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=Oh(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}getFullReader(){return Dt(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Hp(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new $p(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class Hp{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;const s=new Headers(t.headers),i=e.url;fetch(i,ru(s,this._withCredentials,this._abortController)).then(n=>{if(!nu(n.status))throw sc(n.status,i);this._reader=n.body.getReader(),this._headersCapability.resolve();const a=n.headers,{allowRangeRequests:o,suggestedLength:c}=Bh({responseHeaders:a,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=c||this._contentLength,this._filename=Vh(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Gn("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;await this._headersCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:au(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class $p{constructor(t,e,s){this._stream=t,this._reader=null,this._loaded=0;const i=t.source;this._withCredentials=i.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!i.disableStream,this._abortController=new AbortController;const n=new Headers(t.headers);n.append("Range",`bytes=${e}-${s-1}`);const a=i.url;fetch(a,ru(n,this._withCredentials,this._abortController)).then(o=>{if(!nu(o.status))throw sc(o.status,a);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:au(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}const hc=200,dc=206;function zp(u){const t=u.response;return typeof t!="string"?t:Jl(t).buffer}class jp{constructor({url:t,httpHeaders:e,withCredentials:s}){this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=Oh(this.isHttp,e),this.withCredentials=s||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,s){const i={begin:t,end:e};for(const n in s)i[n]=s[n];return this.request(i)}requestFull(t){return this.request(t)}request(t){const e=new XMLHttpRequest,s=this.currXhrId++,i=this.pendingRequests[s]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const[n,a]of this.headers)e.setRequestHeader(n,a);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.expectedStatus=dc):i.expectedStatus=hc,e.responseType="arraybuffer",t.onError&&(e.onerror=function(n){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,s),e.onprogress=this.onProgress.bind(this,s),i.onHeadersReceived=t.onHeadersReceived,i.onDone=t.onDone,i.onError=t.onError,i.onProgress=t.onProgress,e.send(null),s}onProgress(t,e){var i;const s=this.pendingRequests[t];s&&((i=s.onProgress)==null||i.call(s,e))}onStateChange(t,e){var c,h,d;const s=this.pendingRequests[t];if(!s)return;const i=s.xhr;if(i.readyState>=2&&s.onHeadersReceived&&(s.onHeadersReceived(),delete s.onHeadersReceived),i.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],i.status===0&&this.isHttp){(c=s.onError)==null||c.call(s,i.status);return}const n=i.status||hc;if(!(n===hc&&s.expectedStatus===dc)&&n!==s.expectedStatus){(h=s.onError)==null||h.call(s,i.status);return}const o=zp(i);if(n===dc){const f=i.getResponseHeader("Content-Range"),p=/bytes (\d+)-(\d+)\/(\d+)/.exec(f);s.onDone({begin:parseInt(p[1],10),chunk:o})}else o?s.onDone({begin:0,chunk:o}):(d=s.onError)==null||d.call(s,i.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class Wp{constructor(t){this._source=t,this._manager=new jp(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return Dt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Up(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const s=new Gp(this._manager,t,e);return s.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class Up{constructor(t,e){this._manager=t;const s={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(s),this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t),s=new Headers(e.getAllResponseHeaders().trim().split(/[\r\n]+/).map(a=>{const[o,...c]=a.split(": ");return[o,c.join(": ")]})),{allowRangeRequests:i,suggestedLength:n}=Bh({responseHeaders:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=Vh(s),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=sc(t,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;(e=this.onProgress)==null||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class Gp{constructor(t,e,s){this._manager=t;const i={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,s,i),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var t;(t=this.onClosed)==null||t.call(this,this)}_onDone(t){const e=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0;for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=sc(t,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||(e=this.onProgress)==null||e.call(this,{loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const qp=/^[a-z][a-z0-9\-+.]+:/i;function Xp(u){if(qp.test(u))return new URL(u);const t=Ni.get("url");return new URL(t.pathToFileURL(u))}function ou(u,t,e){return u.protocol==="http:"?Ni.get("http").request(u,{headers:t},e):Ni.get("https").request(u,{headers:t},e)}class Yp{constructor(t){this.source=t,this.url=Xp(t.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.headers=Oh(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}getFullReader(){return Dt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new Zp(this):new Kp(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=this.isFsUrl?new Jp(this,t,e):new Qp(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class lu{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Gn("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class cu{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const e=t.source;this._isStreamingSupported=!e.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}}class Kp extends lu{constructor(t){super(t);const e=Object.fromEntries(t.headers),s=i=>{if(i.statusCode===404){const c=new Un(`Missing PDF "${this._url}".`);this._storedError=c,this._headersCapability.reject(c);return}this._headersCapability.resolve(),this._setReadableStream(i);const n=new Headers(this._readableStream.headers),{allowRangeRequests:a,suggestedLength:o}=Bh({responseHeaders:n,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=o||this._contentLength,this._filename=Vh(n)};this._request=ou(this._url,e,s),this._request.on("error",i=>{this._storedError=i,this._headersCapability.reject(i)}),this._request.end()}}class Qp extends cu{constructor(t,e,s){super(t);const i=Object.fromEntries(t.headers);i.Range=`bytes=${e}-${s-1}`;const n=a=>{if(a.statusCode===404){const o=new Un(`Missing PDF "${this._url}".`);this._storedError=o;return}this._setReadableStream(a)};this._request=ou(this._url,i,n),this._request.on("error",a=>{this._storedError=a}),this._request.end()}}class Zp extends lu{constructor(t){super(t);const e=Ni.get("fs");e.promises.lstat(this._url).then(s=>{this._contentLength=s.size,this._setReadableStream(e.createReadStream(this._url)),this._headersCapability.resolve()},s=>{s.code==="ENOENT"&&(s=new Un(`Missing PDF "${this._url}".`)),this._storedError=s,this._headersCapability.reject(s)})}}class Jp extends cu{constructor(t,e,s){super(t);const i=Ni.get("fs");this._setReadableStream(i.createReadStream(this._url,{start:e,end:s-1}))}}const tg=1e5,ce=30,eg=.8;var gd,vi,ue,eo,so,hn,Ls,io,no,dn,xr,Er,bi,kr,ro,Sr,un,ao,oo,fn,pn,lo,yi,Cr,ti,hu,du,Wc,Te,al,Uc,uu,fu;const Lt=class Lt{constructor({textContentSource:t,container:e,viewport:s}){w(this,ti);w(this,vi,Promise.withResolvers());w(this,ue,null);w(this,eo,!1);w(this,so,!!((gd=globalThis.FontInspector)!=null&&gd.enabled));w(this,hn,null);w(this,Ls,null);w(this,io,0);w(this,no,0);w(this,dn,null);w(this,xr,null);w(this,Er,0);w(this,bi,0);w(this,kr,Object.create(null));w(this,ro,[]);w(this,Sr,null);w(this,un,[]);w(this,ao,new WeakMap);w(this,oo,null);var c;if(t instanceof ReadableStream)v(this,Sr,t);else if(typeof t=="object")v(this,Sr,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');v(this,ue,v(this,xr,e)),v(this,bi,s.scale*(globalThis.devicePixelRatio||1)),v(this,Er,s.rotation),v(this,Ls,{div:null,properties:null,ctx:null});const{pageWidth:i,pageHeight:n,pageX:a,pageY:o}=s.rawDims;v(this,oo,[1,0,0,-1,-a,o+n]),v(this,no,i),v(this,io,n),b(c=Lt,Te,uu).call(c),Hn(e,s),r(this,vi).promise.finally(()=>{r(Lt,Cr).delete(this),v(this,Ls,null),v(this,kr,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=re.platform;return it(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){const t=()=>{r(this,dn).read().then(({value:e,done:s})=>{if(s){r(this,vi).resolve();return}r(this,hn)??v(this,hn,e.lang),Object.assign(r(this,kr),e.styles),b(this,ti,hu).call(this,e.items),t()},r(this,vi).reject)};return v(this,dn,r(this,Sr).getReader()),r(Lt,Cr).add(this),t(),r(this,vi).promise}update({viewport:t,onBefore:e=null}){var n;const s=t.scale*(globalThis.devicePixelRatio||1),i=t.rotation;if(i!==r(this,Er)&&(e==null||e(),v(this,Er,i),Hn(r(this,xr),{rotation:i})),s!==r(this,bi)){e==null||e(),v(this,bi,s);const a={div:null,properties:null,ctx:b(n=Lt,Te,al).call(n,r(this,hn))};for(const o of r(this,un))a.properties=r(this,ao).get(o),a.div=o,b(this,ti,Wc).call(this,a)}}cancel(){var e;const t=new Gn("TextLayer task cancelled.");(e=r(this,dn))==null||e.cancel(t).catch(()=>{}),v(this,dn,null),r(this,vi).reject(t)}get textDivs(){return r(this,un)}get textContentItemsStr(){return r(this,ro)}static cleanup(){if(!(r(this,Cr).size>0)){r(this,fn).clear();for(const{canvas:t}of r(this,pn).values())t.remove();r(this,pn).clear()}}};vi=new WeakMap,ue=new WeakMap,eo=new WeakMap,so=new WeakMap,hn=new WeakMap,Ls=new WeakMap,io=new WeakMap,no=new WeakMap,dn=new WeakMap,xr=new WeakMap,Er=new WeakMap,bi=new WeakMap,kr=new WeakMap,ro=new WeakMap,Sr=new WeakMap,un=new WeakMap,ao=new WeakMap,oo=new WeakMap,fn=new WeakMap,pn=new WeakMap,lo=new WeakMap,yi=new WeakMap,Cr=new WeakMap,ti=new WeakSet,hu=function(t){var i,n;if(r(this,eo))return;(n=r(this,Ls)).ctx??(n.ctx=b(i=Lt,Te,al).call(i,r(this,hn)));const e=r(this,un),s=r(this,ro);for(const a of t){if(e.length>tg){J("Ignoring additional textDivs for performance reasons."),v(this,eo,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=r(this,ue);v(this,ue,document.createElement("span")),r(this,ue).classList.add("markedContent"),a.id!==null&&r(this,ue).setAttribute("id",`${a.id}`),o.append(r(this,ue))}else a.type==="endMarkedContent"&&v(this,ue,r(this,ue).parentNode);continue}s.push(a.str),b(this,ti,du).call(this,a)}},du=function(t){var y;const e=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};r(this,un).push(e);const i=z.transform(r(this,oo),t.transform);let n=Math.atan2(i[1],i[0]);const a=r(this,kr)[t.fontName];a.vertical&&(n+=Math.PI/2);let o=r(this,so)&&a.fontSubstitution||a.fontFamily;o=Lt.fontFamilyMap.get(o)||o;const c=Math.hypot(i[2],i[3]),h=c*b(y=Lt,Te,fu).call(y,o,r(this,hn));let d,f;n===0?(d=i[4],f=i[5]-h):(d=i[4]+h*Math.sin(n),f=i[5]-h*Math.cos(n));const p="calc(var(--scale-factor)*",g=e.style;r(this,ue)===r(this,xr)?(g.left=`${(100*d/r(this,no)).toFixed(2)}%`,g.top=`${(100*f/r(this,io)).toFixed(2)}%`):(g.left=`${p}${d.toFixed(2)}px)`,g.top=`${p}${f.toFixed(2)}px)`),g.fontSize=`${p}${(r(Lt,yi)*c).toFixed(2)}px)`,g.fontFamily=o,s.fontSize=c,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,r(this,so)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),n!==0&&(s.angle=n*(180/Math.PI));let m=!1;if(t.str.length>1)m=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const x=Math.abs(t.transform[0]),A=Math.abs(t.transform[3]);x!==A&&Math.max(x,A)/Math.min(x,A)>1.5&&(m=!0)}if(m&&(s.canvasWidth=a.vertical?t.height:t.width),r(this,ao).set(e,s),r(this,Ls).div=e,r(this,Ls).properties=s,b(this,ti,Wc).call(this,r(this,Ls)),s.hasText&&r(this,ue).append(e),s.hasEOL){const x=document.createElement("br");x.setAttribute("role","presentation"),r(this,ue).append(x)}},Wc=function(t){var o;const{div:e,properties:s,ctx:i}=t,{style:n}=e;let a="";if(r(Lt,yi)>1&&(a=`scale(${1/r(Lt,yi)})`),s.canvasWidth!==0&&s.hasText){const{fontFamily:c}=n,{canvasWidth:h,fontSize:d}=s;b(o=Lt,Te,Uc).call(o,i,d*r(this,bi),c);const{width:f}=i.measureText(e.textContent);f>0&&(a=`scaleX(${h*r(this,bi)/f}) ${a}`)}s.angle!==0&&(a=`rotate(${s.angle}deg) ${a}`),a.length>0&&(n.transform=a)},Te=new WeakSet,al=function(t=null){let e=r(this,pn).get(t||(t=""));if(!e){const s=document.createElement("canvas");s.className="hiddenCanvasElement",s.lang=t,document.body.append(s),e=s.getContext("2d",{alpha:!1,willReadFrequently:!0}),r(this,pn).set(t,e),r(this,lo).set(e,{size:0,family:""})}return e},Uc=function(t,e,s){const i=r(this,lo).get(t);e===i.size&&s===i.family||(t.font=`${e}px ${s}`,i.size=e,i.family=s)},uu=function(){if(r(this,yi)!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),v(this,yi,t.getBoundingClientRect().height),t.remove()},fu=function(t,e){const s=r(this,fn).get(t);if(s)return s;const i=b(this,Te,al).call(this,e);i.canvas.width=i.canvas.height=ce,b(this,Te,Uc).call(this,i,ce,t);const n=i.measureText("");let a=n.fontBoundingBoxAscent,o=Math.abs(n.fontBoundingBoxDescent);if(a){const d=a/(a+o);return r(this,fn).set(t,d),i.canvas.width=i.canvas.height=0,d}i.strokeStyle="red",i.clearRect(0,0,ce,ce),i.strokeText("g",0,0);let c=i.getImageData(0,0,ce,ce).data;o=0;for(let d=c.length-1-3;d>=0;d-=4)if(c[d]>0){o=Math.ceil(d/4/ce);break}i.clearRect(0,0,ce,ce),i.strokeText("A",0,ce),c=i.getImageData(0,0,ce,ce).data,a=0;for(let d=0,f=c.length;d<f;d+=4)if(c[d]>0){a=ce-Math.floor(d/4/ce);break}i.canvas.width=i.canvas.height=0;const h=a?a/(a+o):eg;return r(this,fn).set(t,h),h},w(Lt,Te),w(Lt,fn,new Map),w(Lt,pn,new Map),w(Lt,lo,new WeakMap),w(Lt,yi,null),w(Lt,Cr,new Set);let ka=Lt;class Sa{static textContent(t){const e=[],s={items:e,styles:Object.create(null)};function i(n){var c;if(!n)return;let a=null;const o=n.name;if(o==="#text")a=n.value;else if(Sa.shouldBuildText(o))(c=n==null?void 0:n.attributes)!=null&&c.textContent?a=n.attributes.textContent:n.value&&(a=n.value);else return;if(a!==null&&e.push({str:a}),!!n.children)for(const h of n.children)i(h)}return i(t),s}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const sg=65536,ig=100,ng=5e3,rg=te?vp:pp,ag=te?bp:Yd,og=te?mp:gp,lg=te?yp:Jd;function cg(u={}){typeof u=="string"||u instanceof URL?u={url:u}:(u instanceof ArrayBuffer||ArrayBuffer.isView(u))&&(u={data:u});const t=new Gc,{docId:e}=t,s=u.url?hg(u.url):null,i=u.data?dg(u.data):null,n=u.httpHeaders||null,a=u.withCredentials===!0,o=u.password??null,c=u.range instanceof pu?u.range:null,h=Number.isInteger(u.rangeChunkSize)&&u.rangeChunkSize>0?u.rangeChunkSize:sg;let d=u.worker instanceof nr?u.worker:null;const f=u.verbosity,p=typeof u.docBaseUrl=="string"&&!ec(u.docBaseUrl)?u.docBaseUrl:null,g=typeof u.cMapUrl=="string"?u.cMapUrl:null,m=u.cMapPacked!==!1,y=u.CMapReaderFactory||ag,x=typeof u.standardFontDataUrl=="string"?u.standardFontDataUrl:null,A=u.StandardFontDataFactory||lg,_=u.stopAtErrors!==!0,E=Number.isInteger(u.maxImageSize)&&u.maxImageSize>-1?u.maxImageSize:-1,k=u.isEvalSupported!==!1,C=typeof u.isOffscreenCanvasSupported=="boolean"?u.isOffscreenCanvasSupported:!te,T=typeof u.isChrome=="boolean"?u.isChrome:!re.platform.isFirefox&&typeof window<"u"&&!!(window!=null&&window.chrome),M=Number.isInteger(u.canvasMaxAreaInBytes)?u.canvasMaxAreaInBytes:-1,P=typeof u.disableFontFace=="boolean"?u.disableFontFace:te,N=u.fontExtraProperties===!0,H=u.enableXfa===!0,L=u.ownerDocument||globalThis.document,S=u.disableRange===!0,R=u.disableStream===!0,F=u.disableAutoFetch===!0,V=u.pdfBug===!0,$=u.CanvasFactory||rg,j=u.FilterFactory||og,G=u.enableHWA===!0,le=c?c.length:u.length??NaN,bt=typeof u.useSystemFonts=="boolean"?u.useSystemFonts:!te&&!P,Ct=typeof u.useWorkerFetch=="boolean"?u.useWorkerFetch:y===Yd&&A===Jd&&g&&x&&aa(g,document.baseURI)&&aa(x,document.baseURI);u.canvasFactory&&Yh("`canvasFactory`-instance option, please use `CanvasFactory` instead."),u.filterFactory&&Yh("`filterFactory`-instance option, please use `FilterFactory` instead.");const yt=null;Uf(f);const pt={canvasFactory:new $({ownerDocument:L,enableHWA:G}),filterFactory:new j({docId:e,ownerDocument:L}),cMapReaderFactory:Ct?null:new y({baseUrl:g,isCompressed:m}),standardFontDataFactory:Ct?null:new A({baseUrl:x})};if(!d){const I={verbosity:f,port:Ks.workerPort};d=I.port?nr.fromPort(I):new nr(I),t._worker=d}const me={docId:e,apiVersion:"4.8.69",data:i,password:o,disableAutoFetch:F,rangeChunkSize:h,length:le,docBaseUrl:p,enableXfa:H,evaluatorOptions:{maxImageSize:E,disableFontFace:P,ignoreErrors:_,isEvalSupported:k,isOffscreenCanvasSupported:C,isChrome:T,canvasMaxAreaInBytes:M,fontExtraProperties:N,useSystemFonts:bt,cMapUrl:Ct?g:null,standardFontDataUrl:Ct?x:null}},nt={disableFontFace:P,fontExtraProperties:N,ownerDocument:L,pdfBug:V,styleElement:yt,loadingParams:{disableAutoFetch:F,enableXfa:H}};return d.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const I=d.messageHandler.sendWithPromise("GetDocRequest",me,i?[i.buffer]:null);let rt;if(c)rt=new Dp(c,{disableRange:S,disableStream:R});else if(!i){if(!s)throw new Error("getDocument - no `url` parameter provided.");let st;te?st=typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype&&aa(s)?od:Yp:st=aa(s)?od:Wp,rt=new st({url:s,length:le,httpHeaders:n,withCredentials:a,rangeChunkSize:h,disableRange:S,disableStream:R})}return I.then(st=>{if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const at=new fa(e,st,d.port),xf=new gg(at,t,rt,nt,pt);t._transport=xf,at.send("Ready",null)})}).catch(t._capability.reject),t}function hg(u){if(u instanceof URL)return u.href;try{return new URL(u,window.location).href}catch{if(te&&typeof u=="string")return u}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function dg(u){if(te&&typeof Buffer<"u"&&u instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(u instanceof Uint8Array&&u.byteLength===u.buffer.byteLength)return u;if(typeof u=="string")return Jl(u);if(u instanceof ArrayBuffer||ArrayBuffer.isView(u)||typeof u=="object"&&!isNaN(u==null?void 0:u.length))return new Uint8Array(u);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function ld(u){return typeof u=="object"&&Number.isInteger(u==null?void 0:u.num)&&u.num>=0&&Number.isInteger(u==null?void 0:u.gen)&&u.gen>=0}var $l;const zl=class zl{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${ee(zl,$l)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var t,e,s;this.destroyed=!0;try{(t=this._worker)!=null&&t.port&&(this._worker._pendingDestroy=!0),await((e=this._transport)==null?void 0:e.destroy())}catch(i){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,i}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};$l=new WeakMap,w(zl,$l,0);let Gc=zl;class pu{constructor(t,e,s=!1,i=null){this.length=t,this.initialData=e,this.progressiveDone=s,this.contentDispositionFilename=i,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(const s of this._rangeListeners)s(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(const s of this._progressListeners)s(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){mt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class ug{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return it(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var wi,Ns,De,Jn,ol;class fg{constructor(t,e,s,i=!1){w(this,De);w(this,wi,null);w(this,Ns,!1);this._pageIndex=t,this._pageInfo=e,this._transport=s,this._stats=i?new Xh:null,this._pdfBug=i,this.commonObjs=s.commonObjs,this.objs=new gu,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:n=!1}={}){return new jo({viewBox:this.view,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}getAnnotations({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return it(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return((t=this._transport._htmlForXfa)==null?void 0:t.children[this._pageIndex])||null}render({canvasContext:t,viewport:e,intent:s="display",annotationMode:i=ni.ENABLE,transform:n=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:c=null,pageColors:h=null,printAnnotationStorage:d=null,isEditing:f=!1}){var k,C;(k=this._stats)==null||k.time("Overall");const p=this._transport.getRenderingIntent(s,i,d,f),{renderingIntent:g,cacheKey:m}=p;v(this,Ns,!1),b(this,De,ol).call(this),o||(o=this._transport.getOptionalContentConfig(g));let y=this._intentStates.get(m);y||(y=Object.create(null),this._intentStates.set(m,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);const x=!!(g&Se.PRINT);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(C=this._stats)==null||C.time("Page Request"),this._pumpOperatorList(p));const A=T=>{var M;y.renderTasks.delete(_),(this._maybeCleanupAfterRender||x)&&v(this,Ns,!0),b(this,De,Jn).call(this,!x),T?(_.capability.reject(T),this._abortOperatorList({intentState:y,reason:T instanceof Error?T:new Error(T)})):_.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(M=globalThis.Stats)!=null&&M.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},_=new Xc({callback:A,params:{canvasContext:t,viewport:e,transform:n,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!x,pdfBug:this._pdfBug,pageColors:h});(y.renderTasks||(y.renderTasks=new Set)).add(_);const E=_.task;return Promise.all([y.displayReadyCapability.promise,o]).then(([T,M])=>{var P;if(this.destroyed){A();return}if((P=this._stats)==null||P.time("Rendering"),!(M.renderingIntent&g))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");_.initializeGraphics({transparency:T,optionalContentConfig:M}),_.operatorListChanged()}).catch(A),E}getOperatorList({intent:t="display",annotationMode:e=ni.ENABLE,printAnnotationStorage:s=null,isEditing:i=!1}={}){var h;function n(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(c))}const a=this._transport.getRenderingIntent(t,e,s,i,!0);let o=this._intentStates.get(a.cacheKey);o||(o=Object.create(null),this._intentStates.set(a.cacheKey,o));let c;return o.opListReadCapability||(c=Object.create(null),c.operatorListChanged=n,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(c),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(i){return i.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(s=>Sa.textContent(s));const e=this.streamTextContent(t);return new Promise(function(s,i){function n(){a.read().then(function({value:c,done:h}){if(h){s(o);return}o.lang??(o.lang=c.lang),Object.assign(o.styles,c.styles),o.items.push(...c.items),n()},i)}const a=e.getReader(),o={items:[],styles:Object.create(null),lang:null};n()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const s of e.renderTasks)t.push(s.completed),s.cancel();return this.objs.clear(),v(this,Ns,!1),b(this,De,ol).call(this),Promise.all(t)}cleanup(t=!1){v(this,Ns,!0);const e=b(this,De,Jn).call(this,!1);return t&&e&&this._stats&&(this._stats=new Xh),e}_startRenderPage(t,e){var i,n;const s=this._intentStates.get(e);s&&((i=this._stats)==null||i.timeEnd("Page Request"),(n=s.displayReadyCapability)==null||n.resolve(t))}_renderPageChunk(t,e){for(let s=0,i=t.length;s<i;s++)e.operatorList.fnArray.push(t.fnArray[s]),e.operatorList.argsArray.push(t.argsArray[s]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const s of e.renderTasks)s.operatorListChanged();t.lastChunk&&b(this,De,Jn).call(this,!0)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:s,modifiedIds:i}){const{map:n,transfer:a}=s,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:n,modifiedIds:i},a).getReader(),h=this._intentStates.get(e);h.streamReader=c;const d=()=>{c.read().then(({value:f,done:p})=>{if(p){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(f,h),d())},f=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const p of h.renderTasks)p.operatorListChanged();b(this,De,Jn).call(this,!0)}if(h.displayReadyCapability)h.displayReadyCapability.reject(f);else if(h.opListReadCapability)h.opListReadCapability.reject(f);else throw f}})};d()}_abortOperatorList({intentState:t,reason:e,force:s=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!s){if(t.renderTasks.size>0)return;if(e instanceof Ph){let i=ig;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new Gn(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[i,n]of this._intentStates)if(n===t){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}}wi=new WeakMap,Ns=new WeakMap,De=new WeakSet,Jn=function(t=!1){if(b(this,De,ol).call(this),!r(this,Ns)||this.destroyed)return!1;if(t)return v(this,wi,setTimeout(()=>{v(this,wi,null),b(this,De,Jn).call(this,!1)},ng)),!1;for(const{renderTasks:e,operatorList:s}of this._intentStates.values())if(e.size>0||!s.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),v(this,Ns,!1),!0},ol=function(){r(this,wi)&&(clearTimeout(r(this,wi)),v(this,wi,null))};var Is,jl;class pg{constructor(){w(this,Is,new Map);w(this,jl,Promise.resolve())}postMessage(t,e){const s={data:structuredClone(t,e?{transfer:e}:null)};r(this,jl).then(()=>{for(const[i]of r(this,Is))i.call(this,s)})}addEventListener(t,e,s=null){let i=null;if((s==null?void 0:s.signal)instanceof AbortSignal){const{signal:n}=s;if(n.aborted){J("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(t,e);i=()=>n.removeEventListener("abort",a),n.addEventListener("abort",a)}r(this,Is).set(e,i)}removeEventListener(t,e){const s=r(this,Is).get(e);s==null||s(),r(this,Is).delete(e)}terminate(){for(const[,t]of r(this,Is))t==null||t();r(this,Is).clear()}}Is=new WeakMap,jl=new WeakMap;var Wl,gn,mn,Tr,ll,Mr,cl;const vt=class vt{constructor({name:t=null,port:e=null,verbosity:s=Gf()}={}){w(this,Tr);var i;if(this.name=t,this.destroyed=!1,this.verbosity=s,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if((i=r(vt,mn))!=null&&i.has(e))throw new Error("Cannot use more than one PDFWorker per port.");(r(vt,mn)||v(vt,mn,new WeakMap)).set(e,this),this._initializeFromPort(e);return}this._initialize()}get promise(){return te?Promise.all([Ni.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new fa("main","worker",t),this._messageHandler.on("ready",function(){}),b(this,Tr,ll).call(this)}_initialize(){if(r(vt,gn)||r(vt,Mr,cl)){this._setupFakeWorker();return}let{workerSrc:t}=vt;try{vt._isSameOrigin(window.location.href,t)||(t=vt._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),s=new fa("main","worker",e),i=()=>{n.abort(),s.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;e.addEventListener("error",()=>{this._webWorker||i()},{signal:n.signal}),s.on("test",o=>{if(n.abort(),this.destroyed||!o){i();return}this._messageHandler=s,this._port=e,this._webWorker=e,b(this,Tr,ll).call(this)}),s.on("ready",o=>{if(n.abort(),this.destroyed){i();return}try{a()}catch{this._setupFakeWorker()}});const a=()=>{const o=new Uint8Array;s.send("test",o,[o.buffer])};a();return}catch{Ql("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){r(vt,gn)||(J("Setting up fake worker."),v(vt,gn,!0)),vt._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const e=new pg;this._port=e;const s=`fake${ee(vt,Wl)._++}`,i=new fa(s+"_worker",s,e);t.setup(i,e),this._messageHandler=new fa(s,s+"_worker",e),b(this,Tr,ll).call(this)}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){var t;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(t=r(vt,mn))==null||t.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){var s;if(!(t!=null&&t.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const e=(s=r(this,mn))==null?void 0:s.get(t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new vt(t)}static get workerSrc(){if(Ks.workerSrc)return Ks.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return it(this,"_setupFakeWorkerGlobal",(async()=>r(this,Mr,cl)?r(this,Mr,cl):(await import(this.workerSrc)).WorkerMessageHandler)())}};Wl=new WeakMap,gn=new WeakMap,mn=new WeakMap,Tr=new WeakSet,ll=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},Mr=new WeakSet,cl=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},w(vt,Mr),w(vt,Wl,0),w(vt,gn,!1),w(vt,mn),te&&(v(vt,gn,!0),Ks.workerSrc||(Ks.workerSrc="./pdf.worker.mjs")),vt._isSameOrigin=(t,e)=>{let s;try{if(s=new URL(t),!s.origin||s.origin==="null")return!1}catch{return!1}const i=new URL(e,s);return s.origin===i.origin},vt._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};let nr=vt;var Fs,fs,Rr,Pr,ps,vn,pa;class gg{constructor(t,e,s,i,n){w(this,vn);w(this,Fs,new Map);w(this,fs,new Map);w(this,Rr,new Map);w(this,Pr,new Map);w(this,ps,null);this.messageHandler=t,this.loadingTask=e,this.commonObjs=new gu,this.fontLoader=new up({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=s,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return it(this,"annotationStorage",new Fh)}getRenderingIntent(t,e=ni.ENABLE,s=null,i=!1,n=!1){let a=Se.DISPLAY,o=Fc;switch(t){case"any":a=Se.ANY;break;case"display":break;case"print":a=Se.PRINT;break;default:J(`getRenderingIntent - invalid intent: ${t}`)}const c=a&Se.PRINT&&s instanceof Gd?s:this.annotationStorage;switch(e){case ni.DISABLE:a+=Se.ANNOTATIONS_DISABLE;break;case ni.ENABLE:break;case ni.ENABLE_FORMS:a+=Se.ANNOTATIONS_FORMS;break;case ni.ENABLE_STORAGE:a+=Se.ANNOTATIONS_STORAGE,o=c.serializable;break;default:J(`getRenderingIntent - invalid annotationMode: ${e}`)}i&&(a+=Se.IS_EDITING),n&&(a+=Se.OPLIST);const{ids:h,hash:d}=c.modifiedIds,f=[a,o.hash,d];return{renderingIntent:a,cacheKey:f.join("_"),annotationStorageSerializable:o,modifiedIds:h}}destroy(){var s;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(s=r(this,ps))==null||s.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of r(this,fs).values())t.push(i._destroy());r(this,fs).clear(),r(this,Rr).clear(),r(this,Pr).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var i;this.commonObjs.clear(),this.fontLoader.clear(),r(this,Fs).clear(),this.filterFactory.destroy(),ka.cleanup(),(i=this._networkStream)==null||i.cancelAllRequests(new Gn("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(s,i)=>{Dt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=n=>{this._lastProgress={loaded:n.loaded,total:n.total}},i.onPull=()=>{this._fullReader.read().then(function({value:n,done:a}){if(a){i.close();return}Dt(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{i.error(n)})},i.onCancel=n=>{this._fullReader.cancel(n),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("ReaderHeadersReady",async s=>{var o;await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:a}=this._fullReader;return(!i||!n)&&(this._lastProgress&&((o=e.onProgress)==null||o.call(e,this._lastProgress)),this._fullReader.onProgress=c=>{var h;(h=e.onProgress)==null||h.call(e,{loaded:c.loaded,total:c.total})}),{isStreamingSupported:i,isRangeSupported:n,contentLength:a}}),t.on("GetRangeReader",(s,i)=>{Dt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(s.begin,s.end);if(!n){i.close();return}i.onPull=()=>{n.read().then(function({value:a,done:o}){if(o){i.close();return}Dt(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{n.cancel(a),i.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("GetDoc",({pdfInfo:s})=>{this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,e._capability.resolve(new ug(s,this))}),t.on("DocException",function(s){let i;switch(s.name){case"PasswordException":i=new fc(s.message,s.code);break;case"InvalidPDFException":i=new bd(s.message);break;case"MissingPDFException":i=new Un(s.message);break;case"UnexpectedResponseException":i=new Zl(s.message,s.status);break;case"UnknownErrorException":i=new pc(s.message,s.details);break;default:mt("DocException - expected a valid Error.")}e._capability.reject(i)}),t.on("PasswordRequest",s=>{if(v(this,ps,Promise.withResolvers()),e.onPassword){const i=n=>{n instanceof Error?r(this,ps).reject(n):r(this,ps).resolve({password:n})};try{e.onPassword(i,s.code)}catch(n){r(this,ps).reject(n)}}else r(this,ps).reject(new fc(s.message,s.code));return r(this,ps).promise}),t.on("DataLoaded",s=>{var i;(i=e.onProgress)==null||i.call(e,{loaded:s.length,total:s.length}),this.downloadInfoCapability.resolve(s)}),t.on("StartRenderPage",s=>{if(this.destroyed)return;r(this,fs).get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),t.on("commonobj",([s,i,n])=>{var a;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":const{disableFontFace:o,fontExtraProperties:c,pdfBug:h}=this._params;if("error"in n){const g=n.error;J(`Error during font loading: ${g}`),this.commonObjs.resolve(s,g);break}const d=h&&((a=globalThis.FontInspector)!=null&&a.enabled)?(g,m)=>globalThis.FontInspector.fontAdded(g,m):null,f=new fp(n,{disableFontFace:o,inspectFont:d});this.fontLoader.bind(f).catch(()=>t.sendWithPromise("FontFallback",{id:s})).finally(()=>{!c&&f.data&&(f.data=null),this.commonObjs.resolve(s,f)});break;case"CopyLocalImage":const{imageRef:p}=n;Dt(p,"The imageRef must be defined.");for(const g of r(this,fs).values())for(const[,m]of g.objs)if((m==null?void 0:m.ref)===p)return m.dataLen?(this.commonObjs.resolve(s,structuredClone(m)),m.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(s,n);break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([s,i,n,a])=>{var c;if(this.destroyed)return;const o=r(this,fs).get(i);if(!o.objs.has(s)){if(o._intentStates.size===0){(c=a==null?void 0:a.bitmap)==null||c.close();return}switch(n){case"Image":o.objs.resolve(s,a),(a==null?void 0:a.dataLen)>$f&&(o._maybeCleanupAfterRender=!0);break;case"Pattern":o.objs.resolve(s,a);break;default:throw new Error(`Got unknown object type ${n}`)}}}),t.on("DocProgress",s=>{var i;this.destroyed||(i=e.onProgress)==null||i.call(e,{loaded:s.loaded,total:s.total})}),t.on("FetchBuiltInCMap",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(s)}),t.on("FetchStandardFontData",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(s)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var s;this.annotationStorage.size<=0&&J("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:((s=this._fullReader)==null?void 0:s.filename)??null},e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,s=r(this,Rr).get(e);if(s)return s;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&r(this,Pr).set(n.refStr,t);const a=new fg(e,n,this,this._params.pdfBug);return r(this,fs).set(e,a),a});return r(this,Rr).set(e,i),i}getPageIndex(t){return ld(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return b(this,vn,pa).call(this,"GetFieldObjects")}hasJSActions(){return b(this,vn,pa).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return b(this,vn,pa).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return b(this,vn,pa).call(this,"GetOptionalContentConfig").then(e=>new Fp(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=r(this,Fs).get(t);if(e)return e;const s=this.messageHandler.sendWithPromise(t,null).then(i=>{var n,a;return{info:i[0],metadata:i[1]?new Np(i[1]):null,contentDispositionFilename:((n=this._fullReader)==null?void 0:n.filename)??null,contentLength:((a=this._fullReader)==null?void 0:a.contentLength)??null}});return r(this,Fs).set(t,s),s}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of r(this,fs).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),r(this,Fs).clear(),this.filterFactory.destroy(!0),ka.cleanup()}}cachedPageNumber(t){if(!ld(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return r(this,Pr).get(e)??null}}Fs=new WeakMap,fs=new WeakMap,Rr=new WeakMap,Pr=new WeakMap,ps=new WeakMap,vn=new WeakSet,pa=function(t,e=null){const s=r(this,Fs).get(t);if(s)return s;const i=this.messageHandler.sendWithPromise(t,e);return r(this,Fs).set(t,i),i};const Yo=Symbol("INITIAL_DATA");var qe,co,qc;class gu{constructor(){w(this,co);w(this,qe,Object.create(null))}get(t,e=null){if(e){const i=b(this,co,qc).call(this,t);return i.promise.then(()=>e(i.data)),null}const s=r(this,qe)[t];if(!s||s.data===Yo)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){const e=r(this,qe)[t];return!!e&&e.data!==Yo}resolve(t,e=null){const s=b(this,co,qc).call(this,t);s.data=e,s.resolve()}clear(){var t;for(const e in r(this,qe)){const{data:s}=r(this,qe)[e];(t=s==null?void 0:s.bitmap)==null||t.close()}v(this,qe,Object.create(null))}*[Symbol.iterator](){for(const t in r(this,qe)){const{data:e}=r(this,qe)[t];e!==Yo&&(yield[t,e])}}}qe=new WeakMap,co=new WeakSet,qc=function(t){var e;return(e=r(this,qe))[t]||(e[t]={...Promise.withResolvers(),data:Yo})};var Ai;class mg{constructor(t){w(this,Ai,null);v(this,Ai,t),this.onContinue=null}get promise(){return r(this,Ai).capability.promise}cancel(t=0){r(this,Ai).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=r(this,Ai).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=r(this,Ai);return t.form||t.canvas&&(e==null?void 0:e.size)>0}}Ai=new WeakMap;var _i,bn;const zi=class zi{constructor({callback:t,params:e,objs:s,commonObjs:i,annotationCanvasMap:n,operatorList:a,pageIndex:o,canvasFactory:c,filterFactory:h,useRequestAnimationFrame:d=!1,pdfBug:f=!1,pageColors:p=null}){w(this,_i,null);this.callback=t,this.params=e,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=c,this.filterFactory=h,this._pdfBug=f,this.pageColors=p,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=d===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new mg(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){var o,c;if(this.cancelled)return;if(this._canvas){if(r(zi,bn).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");r(zi,bn).add(this._canvas)}this._pdfBug&&((o=globalThis.StepperManager)!=null&&o.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:s,viewport:i,transform:n,background:a}=this.params;this.gfx=new ir(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:n,viewport:i,transparency:t,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,(c=this.graphicsReadyCallback)==null||c.call(this)}cancel(t=null,e=0){var s;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),r(this,_i)&&(window.cancelAnimationFrame(r(this,_i)),v(this,_i,null)),r(zi,bn).delete(this._canvas),this.callback(t||new Ph(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){var t;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(t=this.stepper)==null||t.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?v(this,_i,window.requestAnimationFrame(()=>{v(this,_i,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),r(zi,bn).delete(this._canvas),this.callback())))}};_i=new WeakMap,bn=new WeakMap,w(zi,bn,new WeakSet);let Xc=zi;const vg="4.8.69",bg="3634dab10";function cd(u){return Math.floor(Math.max(0,Math.min(1,u))*255).toString(16).padStart(2,"0")}function ra(u){return Math.max(0,Math.min(255,255*u))}class hd{static CMYK_G([t,e,s,i]){return["G",1-Math.min(1,.3*t+.59*s+.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=ra(t),[t,t,t]}static G_HTML([t]){const e=cd(t);return`#${e}${e}${e}`}static RGB_G([t,e,s]){return["G",.3*t+.59*e+.11*s]}static RGB_rgb(t){return t.map(ra)}static RGB_HTML(t){return`#${t.map(cd).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,s,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,s+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,s,i]){return[ra(1-Math.min(1,t+i)),ra(1-Math.min(1,s+i)),ra(1-Math.min(1,e+i))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,s]){const i=1-t,n=1-e,a=1-s,o=Math.min(i,n,a);return["CMYK",i,n,a,o]}}class yg{create(t,e,s=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){mt("Abstract method `_createSVG` called.")}}class Hh extends yg{_createSVG(t){return document.createElementNS(xs,t)}}class mu{static setupStorage(t,e,s,i,n){const a=i.getValue(e,{value:null});switch(s.name){case"textarea":if(a.value!==null&&(t.textContent=a.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})});break;case"input":if(s.attributes.type==="radio"||s.attributes.type==="checkbox"){if(a.value===s.attributes.xfaOn?t.setAttribute("checked",!0):a.value===s.attributes.xfaOff&&t.removeAttribute("checked"),n==="print")break;t.addEventListener("change",o=>{i.setValue(e,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&t.setAttribute("value",a.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})})}break;case"select":if(a.value!==null){t.setAttribute("value",a.value);for(const o of s.children)o.attributes.value===a.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{const c=o.target.options,h=c.selectedIndex===-1?"":c[c.selectedIndex].value;i.setValue(e,{value:h})});break}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:n}){const{attributes:a}=e,o=t instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${i}`);for(const[c,h]of Object.entries(a))if(h!=null)switch(c){case"class":h.length&&t.setAttribute(c,h.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",h);break;case"style":Object.assign(t.style,h);break;case"textContent":t.textContent=h;break;default:(!o||c!=="href"&&c!=="newWindow")&&t.setAttribute(c,h)}o&&n.addLinkAttributes(t,a.href,a.newWindow),s&&a.dataId&&this.setupStorage(t,a.dataId,e,s)}static render(t){var f,p;const e=t.annotationStorage,s=t.linkService,i=t.xfaHtml,n=t.intent||"display",a=document.createElement(i.name);i.attributes&&this.setAttributes({html:a,element:i,intent:n,linkService:s});const o=n!=="richText",c=t.div;if(c.append(a),t.viewport){const g=`matrix(${t.viewport.transform.join(",")})`;c.style.transform=g}o&&c.setAttribute("class","xfaLayer xfaFont");const h=[];if(i.children.length===0){if(i.value){const g=document.createTextNode(i.value);a.append(g),o&&Sa.shouldBuildText(i.name)&&h.push(g)}return{textDivs:h}}const d=[[i,-1,a]];for(;d.length>0;){const[g,m,y]=d.at(-1);if(m+1===g.children.length){d.pop();continue}const x=g.children[++d.at(-1)[1]];if(x===null)continue;const{name:A}=x;if(A==="#text"){const E=document.createTextNode(x.value);h.push(E),y.append(E);continue}const _=(f=x==null?void 0:x.attributes)!=null&&f.xmlns?document.createElementNS(x.attributes.xmlns,A):document.createElement(A);if(y.append(_),x.attributes&&this.setAttributes({html:_,element:x,storage:e,intent:n,linkService:s}),((p=x.children)==null?void 0:p.length)>0)d.push([x,-1,_]);else if(x.value){const E=document.createTextNode(x.value);o&&Sa.shouldBuildText(A)&&h.push(E),_.append(E)}}for(const g of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))g.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const Uo=1e3,wg=9,zn=new WeakSet;function Qs(u){return{width:u[2]-u[0],height:u[3]-u[1]}}class Ag{static create(t){switch(t.data.annotationType){case Pt.LINK:return new vu(t);case Pt.TEXT:return new _g(t);case Pt.WIDGET:switch(t.data.fieldType){case"Tx":return new xg(t);case"Btn":return t.data.radioButton?new wu(t):t.data.checkBox?new kg(t):new Sg(t);case"Ch":return new Cg(t);case"Sig":return new Eg(t)}return new qn(t);case Pt.POPUP:return new Kc(t);case Pt.FREETEXT:return new ku(t);case Pt.LINE:return new Mg(t);case Pt.SQUARE:return new Rg(t);case Pt.CIRCLE:return new Pg(t);case Pt.POLYLINE:return new Su(t);case Pt.CARET:return new Ng(t);case Pt.INK:return new $h(t);case Pt.POLYGON:return new Lg(t);case Pt.HIGHLIGHT:return new Cu(t);case Pt.UNDERLINE:return new Ig(t);case Pt.SQUIGGLY:return new Fg(t);case Pt.STRIKEOUT:return new Dg(t);case Pt.STAMP:return new Tu(t);case Pt.FILEATTACHMENT:return new Og(t);default:return new St(t)}}}var yn,Lr,Nr,ho,Yc;const Uh=class Uh{constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){w(this,ho);w(this,yn,null);w(this,Lr,!1);w(this,Nr,null);this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(s)),i&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:e,richText:s}){return!!(t!=null&&t.str||e!=null&&e.str||s!=null&&s.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Uh._hasPopupData(this.data)}updateEdited(t){var s;if(!this.container)return;r(this,yn)||v(this,yn,{rect:this.data.rect.slice(0)});const{rect:e}=t;e&&b(this,ho,Yc).call(this,e),(s=r(this,Nr))==null||s.popup.updateEdited(t)}resetEdited(){var t;r(this,yn)&&(b(this,ho,Yc).call(this,r(this,yn).rect),(t=r(this,Nr))==null||t.popup.resetEdited(),v(this,yn,null))}_createContainer(t){const{data:e,parent:{page:s,viewport:i}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),this instanceof qn||(n.tabIndex=Uo);const{style:a}=n;if(a.zIndex=this.parent.zIndex++,e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof Kc){const{rotation:y}=e;return!e.hasOwnCanvas&&y!==0&&this.setRotation(y,n),n}const{width:o,height:c}=Qs(e.rect);if(!t&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;const y=e.borderStyle.horizontalCornerRadius,x=e.borderStyle.verticalCornerRadius;if(y>0||x>0){const _=`calc(${y}px * var(--scale-factor)) / calc(${x}px * var(--scale-factor))`;a.borderRadius=_}else if(this instanceof wu){const _=`calc(${o}px * var(--scale-factor)) / calc(${c}px * var(--scale-factor))`;a.borderRadius=_}switch(e.borderStyle.style){case ia.SOLID:a.borderStyle="solid";break;case ia.DASHED:a.borderStyle="dashed";break;case ia.BEVELED:J("Unimplemented border style: beveled");break;case ia.INSET:J("Unimplemented border style: inset");break;case ia.UNDERLINE:a.borderBottomStyle="solid";break}const A=e.borderColor||null;A?(v(this,Lr,!0),a.borderColor=z.makeHexColor(A[0]|0,A[1]|0,A[2]|0)):a.borderWidth=0}const h=z.normalizeRect([e.rect[0],s.view[3]-e.rect[1]+s.view[1],e.rect[2],s.view[3]-e.rect[3]+s.view[1]]),{pageWidth:d,pageHeight:f,pageX:p,pageY:g}=i.rawDims;a.left=`${100*(h[0]-p)/d}%`,a.top=`${100*(h[1]-g)/f}%`;const{rotation:m}=e;return e.hasOwnCanvas||m===0?(a.width=`${100*o/d}%`,a.height=`${100*c/f}%`):this.setRotation(m,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims,{width:n,height:a}=Qs(this.data.rect);let o,c;t%180===0?(o=100*n/s,c=100*a/i):(o=100*a/s,c=100*n/i),e.style.width=`${o}%`,e.style.height=`${c}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,s,i)=>{const n=i.detail[e],a=n[0],o=n.slice(1);i.target.style[s]=hd[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[s]:hd[`${a}_rgb`](o)})};return it(this,"_commonActions",{display:e=>{const{display:s}=e.detail,i=s%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:s===1||s===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:s}=e.detail;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:s,noView:s})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{const s=e.detail.rotation;this.setRotation(s),this.annotationStorage.setValue(this.data.id,{rotation:s})}})}_dispatchEventFromSandbox(t,e){const s=this._commonActions;for(const i of Object.keys(e.detail)){const n=t[i]||s[i];n==null||n(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const s=this._commonActions;for(const[i,n]of Object.entries(e)){const a=s[i];if(a){const o={detail:{[i]:n},target:t};a(o),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,s,i,n]=this.data.rect.map(y=>Math.fround(y));if(t.length===8){const[y,x,A,_]=t.subarray(2,6);if(i===y&&n===x&&e===A&&s===_)return}const{style:a}=this.container;let o;if(r(this,Lr)){const{borderColor:y,borderWidth:x}=a;a.borderWidth=0,o=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${y}" stroke-width="${x}">`],this.container.classList.add("hasBorder")}const c=i-e,h=n-s,{svgFactory:d}=this,f=d.createElement("svg");f.classList.add("quadrilateralsContainer"),f.setAttribute("width",0),f.setAttribute("height",0);const p=d.createElement("defs");f.append(p);const g=d.createElement("clipPath"),m=`clippath_${this.data.id}`;g.setAttribute("id",m),g.setAttribute("clipPathUnits","objectBoundingBox"),p.append(g);for(let y=2,x=t.length;y<x;y+=8){const A=t[y],_=t[y+1],E=t[y+2],k=t[y+3],C=d.createElement("rect"),T=(E-e)/c,M=(n-_)/h,P=(A-E)/c,N=(_-k)/h;C.setAttribute("x",T),C.setAttribute("y",M),C.setAttribute("width",P),C.setAttribute("height",N),g.append(C),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${T}" y="${M}" width="${P}" height="${N}"/>`)}r(this,Lr)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(f),this.container.style.clipPath=`url(#${m})`}_createPopup(){const{data:t}=this,e=v(this,Nr,new Kc({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(e.render())}render(){mt("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects[t];if(i)for(const{page:n,id:a,exportValues:o}of i){if(n===-1||a===e)continue;const c=typeof o=="string"?o:null,h=document.querySelector(`[data-element-id="${a}"]`);if(h&&!zn.has(h)){J(`_getElementsByName - element not allowed: ${a}`);continue}s.push({id:a,exportValue:c,domElement:h})}return s}for(const i of document.getElementsByName(t)){const{exportValue:n}=i,a=i.getAttribute("data-element-id");a!==e&&zn.has(i)&&s.push({id:a,exportValue:n,domElement:i})}return s}show(){var t;this.container&&(this.container.hidden=!1),(t=this.popup)==null||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),(t=this.popup)==null||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var s;(s=this.linkService.eventBus)==null||s.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})})}};yn=new WeakMap,Lr=new WeakMap,Nr=new WeakMap,ho=new WeakSet,Yc=function(t){const{container:{style:e},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:c}}}}=this;s==null||s.splice(0,4,...t);const{width:h,height:d}=Qs(t);e.left=`${100*(t[0]-o)/n}%`,e.top=`${100*(a-t[3]+c)/a}%`,i===0?(e.width=`${100*h/n}%`,e.height=`${100*d/a}%`):this.setRotation(i)};let St=Uh;var Ce,Oi,bu,yu;class vu extends St{constructor(e,s=null){super(e,{isRenderable:!0,ignoreBorder:!!(s!=null&&s.ignoreBorder),createQuadrilaterals:!0});w(this,Ce);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:s}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let n=!1;return e.url?(s.addLinkAttributes(i,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(i,e.action),n=!0):e.attachment?(b(this,Ce,bu).call(this,i,e.attachment,e.attachmentDest),n=!0):e.setOCGState?(b(this,Ce,yu).call(this,i,e.setOCGState),n=!0):e.dest?(this._bindLink(i,e.dest),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),n=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container}_bindLink(e,s){e.href=this.linkService.getDestinationHash(s),e.onclick=()=>(s&&this.linkService.goToDestination(s),!1),(s||s==="")&&b(this,Ce,Oi).call(this)}_bindNamedAction(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(s),!1),b(this,Ce,Oi).call(this)}_bindJSAction(e,s){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(s.actions)){const a=i.get(n);a&&(e[a]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s.id,name:n}}),!1})}e.onclick||(e.onclick=()=>!1),b(this,Ce,Oi).call(this)}_bindResetFormAction(e,s){const i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),b(this,Ce,Oi).call(this),!this._fieldObjects){J('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(e.onclick=()=>!1);return}e.onclick=()=>{var f;i==null||i();const{fields:n,refs:a,include:o}=s,c=[];if(n.length!==0||a.length!==0){const p=new Set(a);for(const g of n){const m=this._fieldObjects[g]||[];for(const{id:y}of m)p.add(y)}for(const g of Object.values(this._fieldObjects))for(const m of g)p.has(m.id)===o&&c.push(m)}else for(const p of Object.values(this._fieldObjects))c.push(...p);const h=this.annotationStorage,d=[];for(const p of c){const{id:g}=p;switch(d.push(g),p.type){case"text":{const y=p.defaultValue||"";h.setValue(g,{value:y});break}case"checkbox":case"radiobutton":{const y=p.defaultValue===p.exportValues;h.setValue(g,{value:y});break}case"combobox":case"listbox":{const y=p.defaultValue||"";h.setValue(g,{value:y});break}default:continue}const m=document.querySelector(`[data-element-id="${g}"]`);if(m){if(!zn.has(m)){J(`_bindResetFormAction - element not allowed: ${g}`);continue}}else continue;m.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((f=this.linkService.eventBus)==null||f.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}Ce=new WeakSet,Oi=function(){this.container.setAttribute("data-internal-link","")},bu=function(e,s,i=null){e.href=this.linkService.getAnchorUrl(""),s.description&&(e.title=s.description),e.onclick=()=>{var n;return(n=this.downloadManager)==null||n.openOrDownloadData(s.content,s.filename,i),!1},b(this,Ce,Oi).call(this)},yu=function(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(s),!1),b(this,Ce,Oi).call(this)};class _g extends St{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class qn extends St{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&(((e=t.previousSibling)==null?void 0:e.nodeName)==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return re.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,s,i,n){s.includes("mouse")?t.addEventListener(s,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):t.addEventListener(s,a=>{var o;if(s==="blur"){if(!e.focused||!a.relatedTarget)return;e.focused=!1}else if(s==="focus"){if(e.focused)return;e.focused=!0}n&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a)}}))})}_setEventListeners(t,e,s,i){var n,a,o;for(const[c,h]of s)(h==="Action"||(n=this.data.actions)!=null&&n[h])&&((h==="Focus"||h==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,c,h,i),h==="Focus"&&!((a=this.data.actions)!=null&&a.Blur)?this._setEventListener(t,e,"blur","Blur",null):h==="Blur"&&!((o=this.data.actions)!=null&&o.Focus)&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":z.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||wg,n=t.style;let a;const o=2,c=h=>Math.round(10*h)/10;if(this.data.multiLine){const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o),d=Math.round(h/(ac*i))||1,f=h/d;a=Math.min(i,c(f/ac))}else{const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(i,c(h/ac))}n.fontSize=`calc(${a}px * var(--scale-factor))`,n.color=z.makeHexColor(s[0],s[1],s[2]),this.data.textAlignment!==null&&(n.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class xg extends qn{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,s,i){const n=this.annotationStorage;for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=s),n.setValue(a.id,{[i]:s})}render(){var i,n;const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const a=t.getValue(e,{value:this.data.fieldValue});let o=a.value||"";const c=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;c&&o.length>c&&(o=o.slice(0,c));let h=a.formattedValue||((i=this.data.textContent)==null?void 0:i.join(`
3
+ `))||null;h&&this.data.comb&&(h=h.replaceAll(/\s+/g,""));const d={userValue:o,formattedValue:h,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=h??o,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type="text",s.setAttribute("value",h??o),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),zn.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=Uo,this._setRequired(s,this.data.required),c&&(s.maxLength=c),s.addEventListener("input",p=>{t.setValue(e,{value:p.target.value}),this.setPropertyOnSiblings(s,"value",p.target.value,"value"),d.formattedValue=null}),s.addEventListener("resetform",p=>{const g=this.data.defaultFieldValue??"";s.value=d.userValue=g,d.formattedValue=null});let f=p=>{const{formattedValue:g}=d;g!=null&&(p.target.value=g),p.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",g=>{var y;if(d.focused)return;const{target:m}=g;d.userValue&&(m.value=d.userValue),d.lastCommittedValue=m.value,d.commitKey=1,(y=this.data.actions)!=null&&y.Focus||(d.focused=!0)}),s.addEventListener("updatefromsandbox",g=>{this.showElementAndHideCanvas(g.target);const m={value(y){d.userValue=y.detail.value??"",t.setValue(e,{value:d.userValue.toString()}),y.target.value=d.userValue},formattedValue(y){const{formattedValue:x}=y.detail;d.formattedValue=x,x!=null&&y.target!==document.activeElement&&(y.target.value=x),t.setValue(e,{formattedValue:x})},selRange(y){y.target.setSelectionRange(...y.detail.selRange)},charLimit:y=>{var E;const{charLimit:x}=y.detail,{target:A}=y;if(x===0){A.removeAttribute("maxLength");return}A.setAttribute("maxLength",x);let _=d.userValue;!_||_.length<=x||(_=_.slice(0,x),A.value=d.userValue=_,t.setValue(e,{value:_}),(E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,willCommit:!0,commitKey:1,selStart:A.selectionStart,selEnd:A.selectionEnd}}))}};this._dispatchEventFromSandbox(m,g)}),s.addEventListener("keydown",g=>{var x;d.commitKey=1;let m=-1;if(g.key==="Escape"?m=0:g.key==="Enter"&&!this.data.multiLine?m=2:g.key==="Tab"&&(d.commitKey=3),m===-1)return;const{value:y}=g.target;d.lastCommittedValue!==y&&(d.lastCommittedValue=y,d.userValue=y,(x=this.linkService.eventBus)==null||x.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:y,willCommit:!0,commitKey:m,selStart:g.target.selectionStart,selEnd:g.target.selectionEnd}}))});const p=f;f=null,s.addEventListener("blur",g=>{var y,x;if(!d.focused||!g.relatedTarget)return;(y=this.data.actions)!=null&&y.Blur||(d.focused=!1);const{value:m}=g.target;d.userValue=m,d.lastCommittedValue!==m&&((x=this.linkService.eventBus)==null||x.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:m,willCommit:!0,commitKey:d.commitKey,selStart:g.target.selectionStart,selEnd:g.target.selectionEnd}})),p(g)}),(n=this.data.actions)!=null&&n.Keystroke&&s.addEventListener("beforeinput",g=>{var C;d.lastCommittedValue=null;const{data:m,target:y}=g,{value:x,selectionStart:A,selectionEnd:_}=y;let E=A,k=_;switch(g.inputType){case"deleteWordBackward":{const T=x.substring(0,A).match(/\w*[^\w]*$/);T&&(E-=T[0].length);break}case"deleteWordForward":{const T=x.substring(A).match(/^[^\w]*\w*/);T&&(k+=T[0].length);break}case"deleteContentBackward":A===_&&(E-=1);break;case"deleteContentForward":A===_&&(k+=1);break}g.preventDefault(),(C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:x,change:m||"",willCommit:!1,selStart:E,selEnd:k}})}),this._setEventListeners(s,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],g=>g.target.value)}if(f&&s.addEventListener("blur",f),this.data.comb){const g=(this.data.rect[2]-this.data.rect[0])/c;s.classList.add("comb"),s.style.letterSpacing=`calc(${g}px * var(--scale-factor) - 1ch)`}}else s=document.createElement("div"),s.textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Eg extends qn{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class kg extends qn{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.exportValue===e.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",t.setValue(s,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return zn.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=Uo,n.addEventListener("change",a=>{const{name:o,checked:c}=a.target;for(const h of this._getElementsByName(o,s)){const d=c&&h.exportValue===e.exportValue;h.domElement&&(h.domElement.checked=d),t.setValue(h.id,{value:d})}t.setValue(s,{value:c})}),n.addEventListener("resetform",a=>{const o=e.defaultFieldValue||"Off";a.target.checked=o===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",a=>{const o={value(c){c.target.checked=c.detail.value!=="Off",t.setValue(s,{value:c.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class wu extends qn{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.fieldValue===e.buttonValue}).value;if(typeof i=="string"&&(i=i!==e.buttonValue,t.setValue(s,{value:i})),i)for(const a of this._getElementsByName(e.fieldName,s))t.setValue(a.id,{value:!1});const n=document.createElement("input");if(zn.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.tabIndex=Uo,n.addEventListener("change",a=>{const{name:o,checked:c}=a.target;for(const h of this._getElementsByName(o,s))t.setValue(h.id,{value:!1});t.setValue(s,{value:c})}),n.addEventListener("resetform",a=>{const o=e.defaultFieldValue;a.target.checked=o!=null&&o===e.buttonValue}),this.enableScripting&&this.hasJSActions){const a=e.buttonValue;n.addEventListener("updatefromsandbox",o=>{const c={value:h=>{const d=a===h.detail.value;for(const f of this._getElementsByName(h.target.name)){const p=d&&f.id===s;f.domElement&&(f.domElement.checked=p),t.setValue(f.id,{value:p})}}};this._dispatchEventFromSandbox(c,o)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Sg extends vu{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",s=>{this._dispatchEventFromSandbox({},s)})),t}}class Cg extends qn{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,s=t.getValue(e,{value:this.data.fieldValue}),i=document.createElement("select");zn.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=Uo;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",d=>{const f=this.data.defaultFieldValue;for(const p of i.options)p.selected=p.value===f});for(const d of this.data.options){const f=document.createElement("option");f.textContent=d.displayValue,f.value=d.exportValue,s.value.includes(d.exportValue)&&(f.setAttribute("selected",!0),n=!1),i.append(f)}let a=null;if(n){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),i.prepend(d),a=()=>{d.remove(),i.removeEventListener("input",a),a=null},i.addEventListener("input",a)}const o=d=>{const f=d?"value":"textContent",{options:p,multiple:g}=i;return g?Array.prototype.filter.call(p,m=>m.selected).map(m=>m[f]):p.selectedIndex===-1?null:p[p.selectedIndex][f]};let c=o(!1);const h=d=>{const f=d.target.options;return Array.prototype.map.call(f,p=>({displayValue:p.textContent,exportValue:p.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",d=>{const f={value(p){a==null||a();const g=p.detail.value,m=new Set(Array.isArray(g)?g:[g]);for(const y of i.options)y.selected=m.has(y.value);t.setValue(e,{value:o(!0)}),c=o(!1)},multipleSelection(p){i.multiple=!0},remove(p){const g=i.options,m=p.detail.remove;g[m].selected=!1,i.remove(m),g.length>0&&Array.prototype.findIndex.call(g,x=>x.selected)===-1&&(g[0].selected=!0),t.setValue(e,{value:o(!0),items:h(p)}),c=o(!1)},clear(p){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),c=o(!1)},insert(p){const{index:g,displayValue:m,exportValue:y}=p.detail.insert,x=i.children[g],A=document.createElement("option");A.textContent=m,A.value=y,x?x.before(A):i.append(A),t.setValue(e,{value:o(!0),items:h(p)}),c=o(!1)},items(p){const{items:g}=p.detail;for(;i.length!==0;)i.remove(0);for(const m of g){const{displayValue:y,exportValue:x}=m,A=document.createElement("option");A.textContent=y,A.value=x,i.append(A)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:o(!0),items:h(p)}),c=o(!1)},indices(p){const g=new Set(p.detail.indices);for(const m of p.target.options)m.selected=g.has(m.index);t.setValue(e,{value:o(!0)}),c=o(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(f,d)}),i.addEventListener("input",d=>{var g;const f=o(!0),p=o(!1);t.setValue(e,{value:f}),d.preventDefault(),(g=this.linkService.eventBus)==null||g.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:c,change:p,changeEx:f,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):i.addEventListener("input",function(d){t.setValue(e,{value:o(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Kc extends St{constructor(t){const{data:e,elements:s}=t;super(t,{isRenderable:St._hasPopupData(e)}),this.elements=s,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new Tg({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),e=[];for(const s of this.elements)s.popup=t,s.container.ariaHasPopup="dialog",e.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",e.map(s=>`${Rh}${s}`).join(",")),this.container}}var Ir,Ul,Gl,Fr,wn,Et,Ds,Dr,uo,fo,Or,Os,Xe,Bs,po,Vs,go,An,_n,ft,hl,Qc,Au,_u,xu,Eu,dl,ul,Zc;class Tg{constructor({container:t,color:e,elements:s,titleObj:i,modificationDate:n,contentsObj:a,richText:o,parent:c,rect:h,parentRect:d,open:f}){w(this,ft);w(this,Ir,b(this,ft,xu).bind(this));w(this,Ul,b(this,ft,Zc).bind(this));w(this,Gl,b(this,ft,ul).bind(this));w(this,Fr,b(this,ft,dl).bind(this));w(this,wn,null);w(this,Et,null);w(this,Ds,null);w(this,Dr,null);w(this,uo,null);w(this,fo,null);w(this,Or,null);w(this,Os,!1);w(this,Xe,null);w(this,Bs,null);w(this,po,null);w(this,Vs,null);w(this,go,null);w(this,An,null);w(this,_n,!1);var p;v(this,Et,t),v(this,go,i),v(this,Ds,a),v(this,Vs,o),v(this,fo,c),v(this,wn,e),v(this,po,h),v(this,Or,d),v(this,uo,s),v(this,Dr,Nh.toDateObject(n)),this.trigger=s.flatMap(g=>g.getElementsToTriggerPopup());for(const g of this.trigger)g.addEventListener("click",r(this,Fr)),g.addEventListener("mouseenter",r(this,Gl)),g.addEventListener("mouseleave",r(this,Ul)),g.classList.add("popupTriggerArea");for(const g of s)(p=g.container)==null||p.addEventListener("keydown",r(this,Ir));r(this,Et).hidden=!0,f&&b(this,ft,dl).call(this)}render(){if(r(this,Xe))return;const t=v(this,Xe,document.createElement("div"));if(t.className="popup",r(this,wn)){const n=t.style.outlineColor=z.makeHexColor(...r(this,wn));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`:t.style.backgroundColor=z.makeHexColor(...r(this,wn).map(o=>Math.floor(.7*(255-o)+o)))}const e=document.createElement("span");e.className="header";const s=document.createElement("h1");if(e.append(s),{dir:s.dir,str:s.textContent}=r(this,go),t.append(e),r(this,Dr)){const n=document.createElement("span");n.classList.add("popupDate"),n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:r(this,Dr).valueOf()})),e.append(n)}const i=r(this,ft,hl);if(i)mu.render({xfaHtml:i,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const n=this._formatContents(r(this,Ds));t.append(n)}r(this,Et).append(t)}_formatContents({str:t,dir:e}){const s=document.createElement("p");s.classList.add("popupContent"),s.dir=e;const i=t.split(/(?:\r\n?|\n)/);for(let n=0,a=i.length;n<a;++n){const o=i[n];s.append(document.createTextNode(o)),n<a-1&&s.append(document.createElement("br"))}return s}updateEdited({rect:t,popupContent:e}){var s;r(this,An)||v(this,An,{contentsObj:r(this,Ds),richText:r(this,Vs)}),t&&v(this,Bs,null),e&&(v(this,Vs,b(this,ft,_u).call(this,e)),v(this,Ds,null)),(s=r(this,Xe))==null||s.remove(),v(this,Xe,null)}resetEdited(){var t;r(this,An)&&({contentsObj:ee(this,Ds)._,richText:ee(this,Vs)._}=r(this,An),v(this,An,null),(t=r(this,Xe))==null||t.remove(),v(this,Xe,null),v(this,Bs,null))}forceHide(){v(this,_n,this.isVisible),r(this,_n)&&(r(this,Et).hidden=!0)}maybeShow(){r(this,_n)&&(r(this,Xe)||b(this,ft,ul).call(this),v(this,_n,!1),r(this,Et).hidden=!1)}get isVisible(){return r(this,Et).hidden===!1}}Ir=new WeakMap,Ul=new WeakMap,Gl=new WeakMap,Fr=new WeakMap,wn=new WeakMap,Et=new WeakMap,Ds=new WeakMap,Dr=new WeakMap,uo=new WeakMap,fo=new WeakMap,Or=new WeakMap,Os=new WeakMap,Xe=new WeakMap,Bs=new WeakMap,po=new WeakMap,Vs=new WeakMap,go=new WeakMap,An=new WeakMap,_n=new WeakMap,ft=new WeakSet,hl=function(){const t=r(this,Vs),e=r(this,Ds);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&r(this,Vs).html||null},Qc=function(){var t,e,s;return((s=(e=(t=r(this,ft,hl))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.fontSize)||0},Au=function(){var t,e,s;return((s=(e=(t=r(this,ft,hl))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.color)||null},_u=function(t){const e=[],s={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:r(this,ft,Au),fontSize:r(this,ft,Qc)?`calc(${r(this,ft,Qc)}px * var(--scale-factor))`:""}};for(const n of t.split(`
4
+ `))e.push({name:"span",value:n,attributes:i});return s},xu=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&r(this,Os))&&b(this,ft,dl).call(this)},Eu=function(){if(r(this,Bs)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:s,pageX:i,pageY:n}}}=r(this,fo);let a=!!r(this,Or),o=a?r(this,Or):r(this,po);for(const m of r(this,uo))if(!o||z.intersect(m.data.rect,o)!==null){o=m.data.rect,a=!0;break}const c=z.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),d=a?o[2]-o[0]+5:0,f=c[0]+d,p=c[1];v(this,Bs,[100*(f-i)/e,100*(p-n)/s]);const{style:g}=r(this,Et);g.left=`${r(this,Bs)[0]}%`,g.top=`${r(this,Bs)[1]}%`},dl=function(){v(this,Os,!r(this,Os)),r(this,Os)?(b(this,ft,ul).call(this),r(this,Et).addEventListener("click",r(this,Fr)),r(this,Et).addEventListener("keydown",r(this,Ir))):(b(this,ft,Zc).call(this),r(this,Et).removeEventListener("click",r(this,Fr)),r(this,Et).removeEventListener("keydown",r(this,Ir)))},ul=function(){r(this,Xe)||this.render(),this.isVisible?r(this,Os)&&r(this,Et).classList.add("focused"):(b(this,ft,Eu).call(this),r(this,Et).hidden=!1,r(this,Et).style.zIndex=parseInt(r(this,Et).style.zIndex)+1e3)},Zc=function(){r(this,Et).classList.remove("focused"),!(r(this,Os)||!this.isVisible)&&(r(this,Et).hidden=!0,r(this,Et).style.zIndex=parseInt(r(this,Et).style.zIndex)-1e3)};class ku extends St{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=Q.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const s=document.createElement("span");s.textContent=e,t.append(s)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var mo;class Mg extends St{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});w(this,mo,null)}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:s,height:i}=Qs(e.rect),n=this.svgFactory.create(s,i,!0),a=v(this,mo,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),n.append(a),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,mo)}addHighlightArea(){this.container.classList.add("highlightArea")}}mo=new WeakMap;var vo;class Rg extends St{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});w(this,vo,null)}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:s,height:i}=Qs(e.rect),n=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=v(this,vo,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",s-a),o.setAttribute("height",i-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,vo)}addHighlightArea(){this.container.classList.add("highlightArea")}}vo=new WeakMap;var bo;class Pg extends St{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});w(this,bo,null)}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:s,height:i}=Qs(e.rect),n=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=v(this,bo,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",s/2),o.setAttribute("cy",i/2),o.setAttribute("rx",s/2-a/2),o.setAttribute("ry",i/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,bo)}addHighlightArea(){this.container.classList.add("highlightArea")}}bo=new WeakMap;var yo;class Su extends St{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});w(this,yo,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:s,borderStyle:i,popupRef:n}}=this;if(!s)return this.container;const{width:a,height:o}=Qs(e),c=this.svgFactory.create(a,o,!0);let h=[];for(let f=0,p=s.length;f<p;f+=2){const g=s[f]-e[0],m=e[3]-s[f+1];h.push(`${g},${m}`)}h=h.join(" ");const d=v(this,yo,this.svgFactory.createElement(this.svgElementName));return d.setAttribute("points",h),d.setAttribute("stroke-width",i.width||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),c.append(d),this.container.append(c),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,yo)}addHighlightArea(){this.container.classList.add("highlightArea")}}yo=new WeakMap;class Lg extends Su{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Ng extends St{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var wo;class $h extends St{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});w(this,wo,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?Q.HIGHLIGHT:Q.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,inkLists:s,borderStyle:i,popupRef:n}}=this,{width:a,height:o}=Qs(e),c=this.svgFactory.create(a,o,!0);for(const h of s){let d=[];for(let p=0,g=h.length;p<g;p+=2){const m=h[p]-e[0],y=e[3]-h[p+1];d.push(`${m},${y}`)}d=d.join(" ");const f=this.svgFactory.createElement(this.svgElementName);r(this,wo).push(f),f.setAttribute("points",d),f.setAttribute("stroke-width",i.width||1),f.setAttribute("stroke","transparent"),f.setAttribute("fill","transparent"),c.append(f)}return!n&&this.hasPopupData&&this._createPopup(),this.container.append(c),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return r(this,wo)}addHighlightArea(){this.container.classList.add("highlightArea")}}wo=new WeakMap;class Cu extends St{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Q.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class Ig extends St{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class Fg extends St{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class Dg extends St{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class Tu extends St{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Q.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Ao,_o,Jc;class Og extends St{constructor(e){var i;super(e,{isRenderable:!0});w(this,_o);w(this,Ao,null);const{file:s}=this.data;this.filename=s.filename,this.content=s.content,(i=this.linkService.eventBus)==null||i.dispatch("fileattachmentannotation",{source:this,...s})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:s}=this;let i;s.hasAppearance||s.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(s.name)?"paperclip":"pushpin"}.svg`,s.fillAlpha&&s.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(s.fillAlpha*100)}%);`)),i.addEventListener("dblclick",b(this,_o,Jc).bind(this)),v(this,Ao,i);const{isMac:n}=re.platform;return e.addEventListener("keydown",a=>{a.key==="Enter"&&(n?a.metaKey:a.ctrlKey)&&b(this,_o,Jc).call(this)}),!s.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return r(this,Ao)}addHighlightArea(){this.container.classList.add("highlightArea")}}Ao=new WeakMap,_o=new WeakSet,Jc=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var xo,xn,En,Eo,jn,Mu,th;class Bg{constructor({div:t,accessibilityManager:e,annotationCanvasMap:s,annotationEditorUIManager:i,page:n,viewport:a,structTreeLayer:o}){w(this,jn);w(this,xo,null);w(this,xn,null);w(this,En,new Map);w(this,Eo,null);this.div=t,v(this,xo,e),v(this,xn,s),v(this,Eo,o||null),this.page=n,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=i}hasEditableAnnotations(){return r(this,En).size>0}async render(t){var a;const{annotations:e}=t,s=this.div;Hn(s,this.viewport);const i=new Map,n={data:null,layer:s,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Hh,annotationStorage:t.annotationStorage||new Fh,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const o of e){if(o.noHTML)continue;const c=o.annotationType===Pt.POPUP;if(c){const f=i.get(o.id);if(!f)continue;n.elements=f}else{const{width:f,height:p}=Qs(o.rect);if(f<=0||p<=0)continue}n.data=o;const h=Ag.create(n);if(!h.isRenderable)continue;if(!c&&o.popupRef){const f=i.get(o.popupRef);f?f.push(h):i.set(o.popupRef,[h])}const d=h.render();o.hidden&&(d.style.visibility="hidden"),await b(this,jn,Mu).call(this,d,o.id),h._isEditable&&(r(this,En).set(h.data.id,h),(a=this._annotationEditorUIManager)==null||a.renderAnnotationElement(h))}b(this,jn,th).call(this)}update({viewport:t}){const e=this.div;this.viewport=t,Hn(e,{rotation:t.rotation}),b(this,jn,th).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(r(this,En).values())}getEditableAnnotation(t){return r(this,En).get(t)}}xo=new WeakMap,xn=new WeakMap,En=new WeakMap,Eo=new WeakMap,jn=new WeakSet,Mu=async function(t,e){var a,o;const s=t.firstChild||t,i=s.id=`${Rh}${e}`,n=await((a=r(this,Eo))==null?void 0:a.getAriaAttributes(i));if(n)for(const[c,h]of n)s.setAttribute(c,h);this.div.append(t),(o=r(this,xo))==null||o.moveElementInDOM(this.div,t,s,!1)},th=function(){if(!r(this,xn))return;const t=this.div;for(const[e,s]of r(this,xn)){const i=t.querySelector(`[data-annotation-id="${e}"]`);if(!i)continue;s.className="annotationContent";const{firstChild:n}=i;n?n.nodeName==="CANVAS"?n.replaceWith(s):n.classList.contains("annotationContent")?n.after(s):n.before(s):i.append(s)}r(this,xn).clear()};const Ko=/\r\n?|\n/g;var Ye,we,ko,kn,Ae,Rt,Ru,Pu,Lu,fl,Js,pl,gl,Nu,sh,Iu;const gt=class gt extends dt{constructor(e){super({...e,name:"freeTextEditor"});w(this,Rt);w(this,Ye);w(this,we,"");w(this,ko,`${this.id}-editor`);w(this,kn,null);w(this,Ae);v(this,Ye,e.color||gt._defaultColor||dt._defaultLineColor),v(this,Ae,e.fontSize||gt._defaultFontSize)}static get _keyboardManager(){const e=gt.prototype,s=a=>a.isEmpty(),i=$n.TRANSLATE_SMALL,n=$n.TRANSLATE_BIG;return it(this,"_keyboardManager",new Wo([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:s}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:s}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[i,0],checker:s}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[n,0],checker:s}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:s}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:s}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,i],checker:s}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,n],checker:s}]]))}static initialize(e,s){dt.initialize(e,s);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,s){switch(e){case X.FREETEXT_SIZE:gt._defaultFontSize=s;break;case X.FREETEXT_COLOR:gt._defaultColor=s;break}}updateParams(e,s){switch(e){case X.FREETEXT_SIZE:b(this,Rt,Ru).call(this,s);break;case X.FREETEXT_COLOR:b(this,Rt,Pu).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[X.FREETEXT_SIZE,gt._defaultFontSize],[X.FREETEXT_COLOR,gt._defaultColor||dt._defaultLineColor]]}get propertiesToUpdate(){return[[X.FREETEXT_SIZE,r(this,Ae)],[X.FREETEXT_COLOR,r(this,Ye)]]}_translateEmpty(e,s){this._uiManager.translateSelectedEditors(e,s,!0)}getInitialTranslation(){const e=this.parentScale;return[-gt._internalPadding*e,-(gt._internalPadding+r(this,Ae))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(Q.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),v(this,kn,new AbortController);const e=this._uiManager.combinedSignal(r(this,kn));this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e})}disableEditMode(){var e;this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",r(this,ko)),this._isDraggable=!0,(e=r(this,kn))==null||e.abort(),v(this,kn,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var e;this.width||(this.enableEditMode(),this.editorDiv.focus(),(e=this._initialOptions)!=null&&e.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=r(this,we),s=v(this,we,b(this,Rt,Lu).call(this).trimEnd());if(e===s)return;const i=n=>{if(v(this,we,n),!n){this.remove();return}b(this,Rt,gl).call(this),this._uiManager.rebuild(this),b(this,Rt,fl).call(this)};this.addCommands({cmd:()=>{i(s)},undo:()=>{i(e)},mustExec:!1}),b(this,Rt,fl).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){gt._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let e,s;this.width&&(e=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",r(this,ko)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${r(this,Ae)}px * var(--scale-factor))`,i.color=r(this,Ye),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),Cl(this,this.div,["dblclick","keydown"]),this.width){const[n,a]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[c,h]=this.getInitialTranslation();[c,h]=this.pageTranslationToScreen(c,h);const[d,f]=this.pageDimensions,[p,g]=this.pageTranslation;let m,y;switch(this.rotation){case 0:m=e+(o[0]-p)/d,y=s+this.height-(o[1]-g)/f;break;case 90:m=e+(o[0]-p)/d,y=s-(o[1]-g)/f,[c,h]=[h,-c];break;case 180:m=e-this.width+(o[0]-p)/d,y=s-(o[1]-g)/f,[c,h]=[-c,-h];break;case 270:m=e+(o[0]-p-this.height*f)/d,y=s+(o[1]-g-this.width*d)/f,[c,h]=[-h,c];break}this.setAt(m*n,y*a,c,h)}else this.setAt(e*n,s*a,this.width*n,this.height*a);b(this,Rt,gl).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var m,y,x;const s=e.clipboardData||window.clipboardData,{types:i}=s;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();const n=b(m=gt,Js,sh).call(m,s.getData("text")||"").replaceAll(Ko,`
5
+ `);if(!n)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!n.includes(`
6
+ `)){o.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:c,startOffset:h}=o,d=[],f=[];if(c.nodeType===Node.TEXT_NODE){const A=c.parentElement;if(f.push(c.nodeValue.slice(h).replaceAll(Ko,"")),A!==this.editorDiv){let _=d;for(const E of this.editorDiv.childNodes){if(E===A){_=f;continue}_.push(b(y=gt,Js,pl).call(y,E))}}d.push(c.nodeValue.slice(0,h).replaceAll(Ko,""))}else if(c===this.editorDiv){let A=d,_=0;for(const E of this.editorDiv.childNodes)_++===h&&(A=f),A.push(b(x=gt,Js,pl).call(x,E))}v(this,we,`${d.join(`
7
+ `)}${n}${f.join(`
8
+ `)}`),b(this,Rt,gl).call(this);const p=new Range;let g=d.reduce((A,_)=>A+_.length,0);for(const{firstChild:A}of this.editorDiv.childNodes)if(A.nodeType===Node.TEXT_NODE){const _=A.nodeValue.length;if(g<=_){p.setStart(A,g),p.setEnd(A,g);break}g-=_}a.removeAllRanges(),a.addRange(p)}get contentDiv(){return this.editorDiv}static async deserialize(e,s,i){var o;let n=null;if(e instanceof ku){const{data:{defaultAppearanceData:{fontSize:c,fontColor:h},rect:d,rotation:f,id:p,popupRef:g},textContent:m,textPosition:y,parent:{page:{pageNumber:x}}}=e;if(!m||m.length===0)return null;n=e={annotationType:Q.FREETEXT,color:Array.from(h),fontSize:c,value:m.join(`
9
+ `),position:y,pageIndex:x-1,rect:d.slice(0),rotation:f,id:p,deleted:!1,popupRef:g}}const a=await super.deserialize(e,s,i);return v(a,Ae,e.fontSize),v(a,Ye,z.makeHexColor(...e.color)),v(a,we,b(o=gt,Js,sh).call(o,e.value)),a.annotationElementId=e.id||null,a._initialData=n,a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=gt._internalPadding*this.parentScale,i=this.getRect(s,s),n=dt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:r(this,Ye)),a={annotationType:Q.FREETEXT,color:n,fontSize:r(this,Ae),value:b(this,Rt,Nu).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?a:this.annotationElementId&&!b(this,Rt,Iu).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(e){const s=super.renderAnnotationElement(e);if(this.deleted)return s;const{style:i}=s;i.fontSize=`calc(${r(this,Ae)}px * var(--scale-factor))`,i.color=r(this,Ye),s.replaceChildren();for(const a of r(this,we).split(`
10
+ `)){const o=document.createElement("div");o.append(a?document.createTextNode(a):document.createElement("br")),s.append(o)}const n=gt._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(n,n),popupContent:r(this,we)}),s}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};Ye=new WeakMap,we=new WeakMap,ko=new WeakMap,kn=new WeakMap,Ae=new WeakMap,Rt=new WeakSet,Ru=function(e){const s=n=>{this.editorDiv.style.fontSize=`calc(${n}px * var(--scale-factor))`,this.translate(0,-(n-r(this,Ae))*this.parentScale),v(this,Ae,n),b(this,Rt,fl).call(this)},i=r(this,Ae);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:X.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},Pu=function(e){const s=n=>{v(this,Ye,this.editorDiv.style.color=n)},i=r(this,Ye);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:X.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Lu=function(){var i;const e=[];this.editorDiv.normalize();let s=null;for(const n of this.editorDiv.childNodes)(s==null?void 0:s.nodeType)===Node.TEXT_NODE&&n.nodeName==="BR"||(e.push(b(i=gt,Js,pl).call(i,n)),s=n);return e.join(`
11
+ `)},fl=function(){const[e,s]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:n,div:a}=this,o=a.style.display,c=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",n.div.append(this.div),i=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=i.width/e,this.height=i.height/s):(this.width=i.height/e,this.height=i.width/s),this.fixAndSetPosition()},Js=new WeakSet,pl=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Ko,"")},gl=function(){if(this.editorDiv.replaceChildren(),!!r(this,we))for(const e of r(this,we).split(`
12
+ `)){const s=document.createElement("div");s.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(s)}},Nu=function(){return r(this,we).replaceAll(" "," ")},sh=function(e){return e.replaceAll(" "," ")},Iu=function(e){const{value:s,fontSize:i,color:n,pageIndex:a}=this._initialData;return this._hasBeenMoved||e.value!==s||e.fontSize!==i||e.color.some((o,c)=>o!==n[c])||e.pageIndex!==a},w(gt,Js),q(gt,"_freeTextDefaultContent",""),q(gt,"_internalPadding",0),q(gt,"_defaultColor",null),q(gt,"_defaultFontSize",10),q(gt,"_type","freetext"),q(gt,"_editorType",Q.FREETEXT);let eh=gt;class Fu{toSVGPath(){mt("Abstract method `toSVGPath` must be implemented.")}get box(){mt("Abstract getter `box` must be implemented.")}serialize(t,e){mt("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){mt("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){mt("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}var _e,Ke,Br,Vr,gs,tt,Sn,Cn,So,Co,Hr,$r,xi,To,ql,Xl,Ot,ga,Du,Ou,Bu,Vu,Hu,$u;const ks=class ks{constructor({x:t,y:e},s,i,n,a,o=0){w(this,Ot);w(this,_e);w(this,Ke,[]);w(this,Br);w(this,Vr);w(this,gs,[]);w(this,tt,new Float64Array(18));w(this,Sn);w(this,Cn);w(this,So);w(this,Co);w(this,Hr);w(this,$r);w(this,xi,[]);v(this,_e,s),v(this,$r,n*i),v(this,Vr,a),r(this,tt).set([NaN,NaN,NaN,NaN,t,e],6),v(this,Br,o),v(this,Co,r(ks,To)*i),v(this,So,r(ks,Xl)*i),v(this,Hr,i),r(this,xi).push(t,e)}isEmpty(){return isNaN(r(this,tt)[8])}add({x:t,y:e}){var N;v(this,Sn,t),v(this,Cn,e);const[s,i,n,a]=r(this,_e);let[o,c,h,d]=r(this,tt).subarray(8,12);const f=t-h,p=e-d,g=Math.hypot(f,p);if(g<r(this,So))return!1;const m=g-r(this,Co),y=m/g,x=y*f,A=y*p;let _=o,E=c;o=h,c=d,h+=x,d+=A,(N=r(this,xi))==null||N.push(t,e);const k=-A/m,C=x/m,T=k*r(this,$r),M=C*r(this,$r);return r(this,tt).set(r(this,tt).subarray(2,8),0),r(this,tt).set([h+T,d+M],4),r(this,tt).set(r(this,tt).subarray(14,18),12),r(this,tt).set([h-T,d-M],16),isNaN(r(this,tt)[6])?(r(this,gs).length===0&&(r(this,tt).set([o+T,c+M],2),r(this,gs).push(NaN,NaN,NaN,NaN,(o+T-s)/n,(c+M-i)/a),r(this,tt).set([o-T,c-M],14),r(this,Ke).push(NaN,NaN,NaN,NaN,(o-T-s)/n,(c-M-i)/a)),r(this,tt).set([_,E,o,c,h,d],6),!this.isEmpty()):(r(this,tt).set([_,E,o,c,h,d],6),Math.abs(Math.atan2(E-c,_-o)-Math.atan2(A,x))<Math.PI/2?([o,c,h,d]=r(this,tt).subarray(2,6),r(this,gs).push(NaN,NaN,NaN,NaN,((o+h)/2-s)/n,((c+d)/2-i)/a),[o,c,_,E]=r(this,tt).subarray(14,18),r(this,Ke).push(NaN,NaN,NaN,NaN,((_+o)/2-s)/n,((E+c)/2-i)/a),!0):([_,E,o,c,h,d]=r(this,tt).subarray(0,6),r(this,gs).push(((_+5*o)/6-s)/n,((E+5*c)/6-i)/a,((5*o+h)/6-s)/n,((5*c+d)/6-i)/a,((o+h)/2-s)/n,((c+d)/2-i)/a),[h,d,o,c,_,E]=r(this,tt).subarray(12,18),r(this,Ke).push(((_+5*o)/6-s)/n,((E+5*c)/6-i)/a,((5*o+h)/6-s)/n,((5*c+d)/6-i)/a,((o+h)/2-s)/n,((c+d)/2-i)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const t=r(this,gs),e=r(this,Ke);if(isNaN(r(this,tt)[6])&&!this.isEmpty())return b(this,Ot,Du).call(this);const s=[];s.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)isNaN(t[i])?s.push(`L${t[i+4]} ${t[i+5]}`):s.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);b(this,Ot,Bu).call(this,s);for(let i=e.length-6;i>=6;i-=6)isNaN(e[i])?s.push(`L${e[i+4]} ${e[i+5]}`):s.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);return b(this,Ot,Ou).call(this,s),s.join(" ")}newFreeDrawOutline(t,e,s,i,n,a){return new zu(t,e,s,i,n,a)}getOutlines(){var f;const t=r(this,gs),e=r(this,Ke),s=r(this,tt),[i,n,a,o]=r(this,_e),c=new Float64Array((((f=r(this,xi))==null?void 0:f.length)??0)+2);for(let p=0,g=c.length-2;p<g;p+=2)c[p]=(r(this,xi)[p]-i)/a,c[p+1]=(r(this,xi)[p+1]-n)/o;if(c[c.length-2]=(r(this,Sn)-i)/a,c[c.length-1]=(r(this,Cn)-n)/o,isNaN(s[6])&&!this.isEmpty())return b(this,Ot,Vu).call(this,c);const h=new Float64Array(r(this,gs).length+24+r(this,Ke).length);let d=t.length;for(let p=0;p<d;p+=2){if(isNaN(t[p])){h[p]=h[p+1]=NaN;continue}h[p]=t[p],h[p+1]=t[p+1]}d=b(this,Ot,$u).call(this,h,d);for(let p=e.length-6;p>=6;p-=6)for(let g=0;g<6;g+=2){if(isNaN(e[p+g])){h[d]=h[d+1]=NaN,d+=2;continue}h[d]=e[p+g],h[d+1]=e[p+g+1],d+=2}return b(this,Ot,Hu).call(this,h,d),this.newFreeDrawOutline(h,c,r(this,_e),r(this,Hr),r(this,Br),r(this,Vr))}};_e=new WeakMap,Ke=new WeakMap,Br=new WeakMap,Vr=new WeakMap,gs=new WeakMap,tt=new WeakMap,Sn=new WeakMap,Cn=new WeakMap,So=new WeakMap,Co=new WeakMap,Hr=new WeakMap,$r=new WeakMap,xi=new WeakMap,To=new WeakMap,ql=new WeakMap,Xl=new WeakMap,Ot=new WeakSet,ga=function(){const t=r(this,tt).subarray(4,6),e=r(this,tt).subarray(16,18),[s,i,n,a]=r(this,_e);return[(r(this,Sn)+(t[0]-e[0])/2-s)/n,(r(this,Cn)+(t[1]-e[1])/2-i)/a,(r(this,Sn)+(e[0]-t[0])/2-s)/n,(r(this,Cn)+(e[1]-t[1])/2-i)/a]},Du=function(){const[t,e,s,i]=r(this,_e),[n,a,o,c]=b(this,Ot,ga).call(this);return`M${(r(this,tt)[2]-t)/s} ${(r(this,tt)[3]-e)/i} L${(r(this,tt)[4]-t)/s} ${(r(this,tt)[5]-e)/i} L${n} ${a} L${o} ${c} L${(r(this,tt)[16]-t)/s} ${(r(this,tt)[17]-e)/i} L${(r(this,tt)[14]-t)/s} ${(r(this,tt)[15]-e)/i} Z`},Ou=function(t){const e=r(this,Ke);t.push(`L${e[4]} ${e[5]} Z`)},Bu=function(t){const[e,s,i,n]=r(this,_e),a=r(this,tt).subarray(4,6),o=r(this,tt).subarray(16,18),[c,h,d,f]=b(this,Ot,ga).call(this);t.push(`L${(a[0]-e)/i} ${(a[1]-s)/n} L${c} ${h} L${d} ${f} L${(o[0]-e)/i} ${(o[1]-s)/n}`)},Vu=function(t){const e=r(this,tt),[s,i,n,a]=r(this,_e),[o,c,h,d]=b(this,Ot,ga).call(this),f=new Float64Array(36);return f.set([NaN,NaN,NaN,NaN,(e[2]-s)/n,(e[3]-i)/a,NaN,NaN,NaN,NaN,(e[4]-s)/n,(e[5]-i)/a,NaN,NaN,NaN,NaN,o,c,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,(e[16]-s)/n,(e[17]-i)/a,NaN,NaN,NaN,NaN,(e[14]-s)/n,(e[15]-i)/a],0),this.newFreeDrawOutline(f,t,r(this,_e),r(this,Hr),r(this,Br),r(this,Vr))},Hu=function(t,e){const s=r(this,Ke);return t.set([NaN,NaN,NaN,NaN,s[4],s[5]],e),e+=6},$u=function(t,e){const s=r(this,tt).subarray(4,6),i=r(this,tt).subarray(16,18),[n,a,o,c]=r(this,_e),[h,d,f,p]=b(this,Ot,ga).call(this);return t.set([NaN,NaN,NaN,NaN,(s[0]-n)/o,(s[1]-a)/c,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,f,p,NaN,NaN,NaN,NaN,(i[0]-n)/o,(i[1]-a)/c],e),e+=24},w(ks,To,8),w(ks,ql,2),w(ks,Xl,r(ks,To)+r(ks,ql));let Ml=ks;var zr,Tn,Hs,Mo,xe,Ro,kt,ge,ma,va,ju;class zu extends Fu{constructor(e,s,i,n,a,o){super();w(this,ge);w(this,zr);w(this,Tn,null);w(this,Hs);w(this,Mo);w(this,xe);w(this,Ro);w(this,kt);v(this,kt,e),v(this,xe,s),v(this,zr,i),v(this,Ro,n),v(this,Hs,a),v(this,Mo,o),b(this,ge,ju).call(this,o);const{x:c,y:h,width:d,height:f}=r(this,Tn);for(let p=0,g=e.length;p<g;p+=2)e[p]=(e[p]-c)/d,e[p+1]=(e[p+1]-h)/f;for(let p=0,g=s.length;p<g;p+=2)s[p]=(s[p]-c)/d,s[p+1]=(s[p+1]-h)/f}toSVGPath(){const e=[`M${r(this,kt)[4]} ${r(this,kt)[5]}`];for(let s=6,i=r(this,kt).length;s<i;s+=6){if(isNaN(r(this,kt)[s])){e.push(`L${r(this,kt)[s+4]} ${r(this,kt)[s+5]}`);continue}e.push(`C${r(this,kt)[s]} ${r(this,kt)[s+1]} ${r(this,kt)[s+2]} ${r(this,kt)[s+3]} ${r(this,kt)[s+4]} ${r(this,kt)[s+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,s,i,n],a){const o=i-e,c=n-s;let h,d;switch(a){case 0:h=b(this,ge,ma).call(this,r(this,kt),e,n,o,-c),d=b(this,ge,ma).call(this,r(this,xe),e,n,o,-c);break;case 90:h=b(this,ge,va).call(this,r(this,kt),e,s,o,c),d=b(this,ge,va).call(this,r(this,xe),e,s,o,c);break;case 180:h=b(this,ge,ma).call(this,r(this,kt),i,s,-o,c),d=b(this,ge,ma).call(this,r(this,xe),i,s,-o,c);break;case 270:h=b(this,ge,va).call(this,r(this,kt),i,n,-o,-c),d=b(this,ge,va).call(this,r(this,xe),i,n,-o,-c);break}return{outline:Array.from(h),points:[Array.from(d)]}}get box(){return r(this,Tn)}newOutliner(e,s,i,n,a,o=0){return new Ml(e,s,i,n,a,o)}getNewOutline(e,s){const{x:i,y:n,width:a,height:o}=r(this,Tn),[c,h,d,f]=r(this,zr),p=a*d,g=o*f,m=i*d+c,y=n*f+h,x=this.newOutliner({x:r(this,xe)[0]*p+m,y:r(this,xe)[1]*g+y},r(this,zr),r(this,Ro),e,r(this,Mo),s??r(this,Hs));for(let A=2;A<r(this,xe).length;A+=2)x.add({x:r(this,xe)[A]*p+m,y:r(this,xe)[A+1]*g+y});return x.getOutlines()}get mustRemoveSelfIntersections(){return!0}}zr=new WeakMap,Tn=new WeakMap,Hs=new WeakMap,Mo=new WeakMap,xe=new WeakMap,Ro=new WeakMap,kt=new WeakMap,ge=new WeakSet,ma=function(e,s,i,n,a){const o=new Float64Array(e.length);for(let c=0,h=e.length;c<h;c+=2)o[c]=s+e[c]*n,o[c+1]=i+e[c+1]*a;return o},va=function(e,s,i,n,a){const o=new Float64Array(e.length);for(let c=0,h=e.length;c<h;c+=2)o[c]=s+e[c+1]*n,o[c+1]=i+e[c]*a;return o},ju=function(e){const s=r(this,kt);let i=s[4],n=s[5],a=i,o=n,c=i,h=n,d=i,f=n;const p=e?Math.max:Math.min;for(let A=6,_=s.length;A<_;A+=6){if(isNaN(s[A]))a=Math.min(a,s[A+4]),o=Math.min(o,s[A+5]),c=Math.max(c,s[A+4]),h=Math.max(h,s[A+5]),f<s[A+5]?(d=s[A+4],f=s[A+5]):f===s[A+5]&&(d=p(d,s[A+4]));else{const E=z.bezierBoundingBox(i,n,...s.slice(A,A+6));a=Math.min(a,E[0]),o=Math.min(o,E[1]),c=Math.max(c,E[2]),h=Math.max(h,E[3]),f<E[3]?(d=E[2],f=E[3]):f===E[3]&&(d=p(d,E[2]))}i=s[A+4],n=s[A+5]}const g=a-r(this,Hs),m=o-r(this,Hs),y=c-a+2*r(this,Hs),x=h-o+2*r(this,Hs);v(this,Tn,{x:g,y:m,width:y,height:x,lastPoint:[d,f]})};var Po,Ei,Qe,oe,Wu,ml,Uu,Gu,ih;class dd{constructor(t,e=0,s=0,i=!0){w(this,oe);w(this,Po);w(this,Ei,[]);w(this,Qe,[]);let n=1/0,a=-1/0,o=1/0,c=-1/0;const h=10**-4;for(const{x,y:A,width:_,height:E}of t){const k=Math.floor((x-e)/h)*h,C=Math.ceil((x+_+e)/h)*h,T=Math.floor((A-e)/h)*h,M=Math.ceil((A+E+e)/h)*h,P=[k,T,M,!0],N=[C,T,M,!1];r(this,Ei).push(P,N),n=Math.min(n,k),a=Math.max(a,C),o=Math.min(o,T),c=Math.max(c,M)}const d=a-n+2*s,f=c-o+2*s,p=n-s,g=o-s,m=r(this,Ei).at(i?-1:-2),y=[m[0],m[2]];for(const x of r(this,Ei)){const[A,_,E]=x;x[0]=(A-p)/d,x[1]=(_-g)/f,x[2]=(E-g)/f}v(this,Po,{x:p,y:g,width:d,height:f,lastPoint:y})}getOutlines(){r(this,Ei).sort((e,s)=>e[0]-s[0]||e[1]-s[1]||e[2]-s[2]);const t=[];for(const e of r(this,Ei))e[3]?(t.push(...b(this,oe,ih).call(this,e)),b(this,oe,Uu).call(this,e)):(b(this,oe,Gu).call(this,e),t.push(...b(this,oe,ih).call(this,e)));return b(this,oe,Wu).call(this,t)}}Po=new WeakMap,Ei=new WeakMap,Qe=new WeakMap,oe=new WeakSet,Wu=function(t){const e=[],s=new Set;for(const a of t){const[o,c,h]=a;e.push([o,c,a],[o,h,a])}e.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=e.length;a<o;a+=2){const c=e[a][2],h=e[a+1][2];c.push(h),h.push(c),s.add(c),s.add(h)}const i=[];let n;for(;s.size>0;){const a=s.values().next().value;let[o,c,h,d,f]=a;s.delete(a);let p=o,g=c;for(n=[o,h],i.push(n);;){let m;if(s.has(d))m=d;else if(s.has(f))m=f;else break;s.delete(m),[o,c,h,d,f]=m,p!==o&&(n.push(p,g,o,g===c?c:h),p=o),g=g===c?h:c}n.push(p,g)}return new Vg(i,r(this,Po))},ml=function(t){const e=r(this,Qe);let s=0,i=e.length-1;for(;s<=i;){const n=s+i>>1,a=e[n][0];if(a===t)return n;a<t?s=n+1:i=n-1}return i+1},Uu=function([,t,e]){const s=b(this,oe,ml).call(this,t);r(this,Qe).splice(s,0,[t,e])},Gu=function([,t,e]){const s=b(this,oe,ml).call(this,t);for(let i=s;i<r(this,Qe).length;i++){const[n,a]=r(this,Qe)[i];if(n!==t)break;if(n===t&&a===e){r(this,Qe).splice(i,1);return}}for(let i=s-1;i>=0;i--){const[n,a]=r(this,Qe)[i];if(n!==t)break;if(n===t&&a===e){r(this,Qe).splice(i,1);return}}},ih=function(t){const[e,s,i]=t,n=[[e,s,i]],a=b(this,oe,ml).call(this,i);for(let o=0;o<a;o++){const[c,h]=r(this,Qe)[o];for(let d=0,f=n.length;d<f;d++){const[,p,g]=n[d];if(!(h<=p||g<=c)){if(p>=c){if(g>h)n[d][1]=h;else{if(f===1)return[];n.splice(d,1),d--,f--}continue}n[d][2]=c,g>h&&n.push([e,h,g])}}}return n};var Lo,jr;class Vg extends Fu{constructor(e,s){super();w(this,Lo);w(this,jr);v(this,jr,e),v(this,Lo,s)}toSVGPath(){const e=[];for(const s of r(this,jr)){let[i,n]=s;e.push(`M${i} ${n}`);for(let a=2;a<s.length;a+=2){const o=s[a],c=s[a+1];o===i?(e.push(`V${c}`),n=c):c===n&&(e.push(`H${o}`),i=o)}e.push("Z")}return e.join(" ")}serialize([e,s,i,n],a){const o=[],c=i-e,h=n-s;for(const d of r(this,jr)){const f=new Array(d.length);for(let p=0;p<d.length;p+=2)f[p]=e+d[p]*c,f[p+1]=n-d[p+1]*h;o.push(f)}return o}get box(){return r(this,Lo)}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}}Lo=new WeakMap,jr=new WeakMap;class nh extends Ml{newFreeDrawOutline(t,e,s,i,n,a){return new Hg(t,e,s,i,n,a)}get classNamesForDrawing(){return["highlight","free"]}}class Hg extends zu{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(t,e,s,i,n,a=0){return new nh(t,e,s,i,n,a)}}var Ze,Mn,Wr,It,No,Ur,Io,Fo,ki,Je,Gr,Do,ut,rh,ah,oh,Bi,qu,ii;const he=class he{constructor({editor:t=null,uiManager:e=null}){w(this,ut);w(this,Ze,null);w(this,Mn,null);w(this,Wr);w(this,It,null);w(this,No,!1);w(this,Ur,!1);w(this,Io,null);w(this,Fo);w(this,ki,null);w(this,Je,null);w(this,Gr);var s;t?(v(this,Ur,!1),v(this,Gr,X.HIGHLIGHT_COLOR),v(this,Io,t)):(v(this,Ur,!0),v(this,Gr,X.HIGHLIGHT_DEFAULT_COLOR)),v(this,Je,(t==null?void 0:t._uiManager)||e),v(this,Fo,r(this,Je)._eventBus),v(this,Wr,(t==null?void 0:t.color)||((s=r(this,Je))==null?void 0:s.highlightColors.values().next().value)||"#FFFF98"),r(he,Do)||v(he,Do,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return it(this,"_keyboardManager",new Wo([[["Escape","mac+Escape"],he.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],he.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],he.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],he.prototype._moveToPrevious],[["Home","mac+Home"],he.prototype._moveToBeginning],[["End","mac+End"],he.prototype._moveToEnd]]))}renderButton(){const t=v(this,Ze,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);const e=r(this,Je)._signal;t.addEventListener("click",b(this,ut,Bi).bind(this),{signal:e}),t.addEventListener("keydown",b(this,ut,oh).bind(this),{signal:e});const s=v(this,Mn,document.createElement("span"));return s.className="swatch",s.setAttribute("aria-hidden",!0),s.style.backgroundColor=r(this,Wr),t.append(s),t}renderMainDropdown(){const t=v(this,It,b(this,ut,rh).call(this));return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}_colorSelectFromKeyboard(t){if(t.target===r(this,Ze)){b(this,ut,Bi).call(this,t);return}const e=t.target.getAttribute("data-color");e&&b(this,ut,ah).call(this,e,t)}_moveToNext(t){var e,s;if(!r(this,ut,ii)){b(this,ut,Bi).call(this,t);return}if(t.target===r(this,Ze)){(e=r(this,It).firstChild)==null||e.focus();return}(s=t.target.nextSibling)==null||s.focus()}_moveToPrevious(t){var e,s;if(t.target===((e=r(this,It))==null?void 0:e.firstChild)||t.target===r(this,Ze)){r(this,ut,ii)&&this._hideDropdownFromKeyboard();return}r(this,ut,ii)||b(this,ut,Bi).call(this,t),(s=t.target.previousSibling)==null||s.focus()}_moveToBeginning(t){var e;if(!r(this,ut,ii)){b(this,ut,Bi).call(this,t);return}(e=r(this,It).firstChild)==null||e.focus()}_moveToEnd(t){var e;if(!r(this,ut,ii)){b(this,ut,Bi).call(this,t);return}(e=r(this,It).lastChild)==null||e.focus()}hideDropdown(){var t,e;(t=r(this,It))==null||t.classList.add("hidden"),(e=r(this,ki))==null||e.abort(),v(this,ki,null)}_hideDropdownFromKeyboard(){var t;if(!r(this,Ur)){if(!r(this,ut,ii)){(t=r(this,Io))==null||t.unselect();return}this.hideDropdown(),r(this,Ze).focus({preventScroll:!0,focusVisible:r(this,No)})}}updateColor(t){if(r(this,Mn)&&(r(this,Mn).style.backgroundColor=t),!r(this,It))return;const e=r(this,Je).highlightColors.values();for(const s of r(this,It).children)s.setAttribute("aria-selected",e.next().value===t)}destroy(){var t,e;(t=r(this,Ze))==null||t.remove(),v(this,Ze,null),v(this,Mn,null),(e=r(this,It))==null||e.remove(),v(this,It,null)}};Ze=new WeakMap,Mn=new WeakMap,Wr=new WeakMap,It=new WeakMap,No=new WeakMap,Ur=new WeakMap,Io=new WeakMap,Fo=new WeakMap,ki=new WeakMap,Je=new WeakMap,Gr=new WeakMap,Do=new WeakMap,ut=new WeakSet,rh=function(){const t=document.createElement("div"),e=r(this,Je)._signal;t.addEventListener("contextmenu",Ve,{signal:e}),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[s,i]of r(this,Je).highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",i),n.title=s,n.setAttribute("data-l10n-id",r(he,Do)[s]);const a=document.createElement("span");n.append(a),a.className="swatch",a.style.backgroundColor=i,n.setAttribute("aria-selected",i===r(this,Wr)),n.addEventListener("click",b(this,ut,ah).bind(this,i),{signal:e}),t.append(n)}return t.addEventListener("keydown",b(this,ut,oh).bind(this),{signal:e}),t},ah=function(t,e){e.stopPropagation(),r(this,Fo).dispatch("switchannotationeditorparams",{source:this,type:r(this,Gr),value:t})},oh=function(t){he._keyboardManager.exec(this,t)},Bi=function(t){if(r(this,ut,ii)){this.hideDropdown();return}if(v(this,No,t.detail===0),r(this,ki)||(v(this,ki,new AbortController),window.addEventListener("pointerdown",b(this,ut,qu).bind(this),{signal:r(this,Je).combinedSignal(r(this,ki))})),r(this,It)){r(this,It).classList.remove("hidden");return}const e=v(this,It,b(this,ut,rh).call(this));r(this,Ze).append(e)},qu=function(t){var e;(e=r(this,It))!=null&&e.contains(t.target)||this.hideDropdown()},ii=function(){return r(this,It)&&!r(this,It).classList.contains("hidden")},w(he,Do,null);let Rl=he;var qr,Oo,$s,Rn,Xr,Ne,Bo,Vo,Pn,ts,Zt,fe,Yr,zs,Ft,Kr,Ie,Ho,K,lh,vl,Xu,Yu,Ku,ch,Vi,Oe,tr,Qu,bl,ba,Zu,Ju,tf,ef,sf;const ot=class ot extends dt{constructor(e){super({...e,name:"highlightEditor"});w(this,K);w(this,qr,null);w(this,Oo,0);w(this,$s);w(this,Rn,null);w(this,Xr,null);w(this,Ne,null);w(this,Bo,null);w(this,Vo,0);w(this,Pn,null);w(this,ts,null);w(this,Zt,null);w(this,fe,!1);w(this,Yr,null);w(this,zs);w(this,Ft,null);w(this,Kr,"");w(this,Ie);w(this,Ho,"");this.color=e.color||ot._defaultColor,v(this,Ie,e.thickness||ot._defaultThickness),v(this,zs,e.opacity||ot._defaultOpacity),v(this,$s,e.boxes||null),v(this,Ho,e.methodOfCreation||""),v(this,Kr,e.text||""),this._isDraggable=!1,e.highlightId>-1?(v(this,fe,!0),b(this,K,vl).call(this,e),b(this,K,Vi).call(this)):r(this,$s)&&(v(this,qr,e.anchorNode),v(this,Oo,e.anchorOffset),v(this,Bo,e.focusNode),v(this,Vo,e.focusOffset),b(this,K,lh).call(this),b(this,K,Vi).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const e=ot.prototype;return it(this,"_keyboardManager",new Wo([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:r(this,fe)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:r(this,Ie),methodOfCreation:r(this,Ho)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,s){var i;dt.initialize(e,s),ot._defaultColor||(ot._defaultColor=((i=s.highlightColors)==null?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(e,s){switch(e){case X.HIGHLIGHT_DEFAULT_COLOR:ot._defaultColor=s;break;case X.HIGHLIGHT_THICKNESS:ot._defaultThickness=s;break}}translateInPage(e,s){}get toolbarPosition(){return r(this,Yr)}updateParams(e,s){switch(e){case X.HIGHLIGHT_COLOR:b(this,K,Xu).call(this,s);break;case X.HIGHLIGHT_THICKNESS:b(this,K,Yu).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[X.HIGHLIGHT_DEFAULT_COLOR,ot._defaultColor],[X.HIGHLIGHT_THICKNESS,ot._defaultThickness]]}get propertiesToUpdate(){return[[X.HIGHLIGHT_COLOR,this.color||ot._defaultColor],[X.HIGHLIGHT_THICKNESS,r(this,Ie)||ot._defaultThickness],[X.HIGHLIGHT_FREE,r(this,fe)]]}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(v(this,Xr,new Rl({editor:this})),e.addColorPicker(r(this,Xr))),e):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(b(this,K,ba).call(this))}getBaseTranslation(){return[0,0]}getRect(e,s){return super.getRect(e,s,b(this,K,ba).call(this))}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){b(this,K,ch).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,K,Vi).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var i;let s=!1;this.parent&&!e?b(this,K,ch).call(this):e&&(b(this,K,Vi).call(this,e),s=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(e),this.show(this._isVisible),s&&this.select()}rotate(e){var n,a,o;const{drawLayer:s}=this.parent;let i;r(this,fe)?(e=(e-this.rotation+360)%360,i=b(n=ot,Oe,tr).call(n,r(this,ts).box,e)):i=b(a=ot,Oe,tr).call(a,this,e),s.rotate(r(this,Zt),e),s.rotate(r(this,Ft),e),s.updateBox(r(this,Zt),i),s.updateBox(r(this,Ft),b(o=ot,Oe,tr).call(o,r(this,Ne).box,e))}render(){if(this.div)return this.div;const e=super.render();r(this,Kr)&&(e.setAttribute("aria-label",r(this,Kr)),e.setAttribute("role","mark")),r(this,fe)?e.classList.add("free"):this.div.addEventListener("keydown",b(this,K,Qu).bind(this),{signal:this._uiManager._signal});const s=v(this,Pn,document.createElement("div"));e.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",s.style.clipPath=r(this,Rn);const[i,n]=this.parentDimensions;return this.setDims(this.width*i,this.height*n),Cl(this,r(this,Pn),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent.drawLayer.addClass(r(this,Ft),"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass(r(this,Ft),"hovered")}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:b(this,K,bl).call(this,!0);break;case 1:case 3:b(this,K,bl).call(this,!1);break}}select(){var e,s;super.select(),r(this,Ft)&&((e=this.parent)==null||e.drawLayer.removeClass(r(this,Ft),"hovered"),(s=this.parent)==null||s.drawLayer.addClass(r(this,Ft),"selected"))}unselect(){var e;super.unselect(),r(this,Ft)&&((e=this.parent)==null||e.drawLayer.removeClass(r(this,Ft),"selected"),r(this,fe)||b(this,K,bl).call(this,!1))}get _mustFixPosition(){return!r(this,fe)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.show(r(this,Zt),e),this.parent.drawLayer.show(r(this,Ft),e))}static startHighlighting(e,s,{target:i,x:n,y:a}){const{x:o,y:c,width:h,height:d}=i.getBoundingClientRect(),f=new AbortController,p=e.combinedSignal(f),g=y=>{y.preventDefault(),y.stopPropagation()},m=y=>{f.abort(),b(this,Oe,ef).call(this,e,y)};window.addEventListener("blur",m,{signal:p}),window.addEventListener("pointerup",m,{signal:p}),window.addEventListener("pointerdown",g,{capture:!0,passive:!1,signal:p}),window.addEventListener("contextmenu",Ve,{signal:p}),i.addEventListener("pointermove",b(this,Oe,tf).bind(this,e),{signal:p}),this._freeHighlight=new nh({x:n,y:a},[o,c,h,d],e.scale,this._defaultThickness/2,s,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static async deserialize(e,s,i){var y,x,A,_;let n=null;if(e instanceof Cu){const{data:{quadPoints:E,rect:k,rotation:C,id:T,color:M,opacity:P,popupRef:N},parent:{page:{pageNumber:H}}}=e;n=e={annotationType:Q.HIGHLIGHT,color:Array.from(M),opacity:P,quadPoints:E,boxes:null,pageIndex:H-1,rect:k.slice(0),rotation:C,id:T,deleted:!1,popupRef:N}}else if(e instanceof $h){const{data:{inkLists:E,rect:k,rotation:C,id:T,color:M,borderStyle:{rawWidth:P},popupRef:N},parent:{page:{pageNumber:H}}}=e;n=e={annotationType:Q.HIGHLIGHT,color:Array.from(M),thickness:P,inkLists:E,boxes:null,pageIndex:H-1,rect:k.slice(0),rotation:C,id:T,deleted:!1,popupRef:N}}const{color:a,quadPoints:o,inkLists:c,opacity:h}=e,d=await super.deserialize(e,s,i);d.color=z.makeHexColor(...a),v(d,zs,h||1),c&&v(d,Ie,e.thickness),d.annotationElementId=e.id||null,d._initialData=n;const[f,p]=d.pageDimensions,[g,m]=d.pageTranslation;if(o){const E=v(d,$s,[]);for(let k=0;k<o.length;k+=8)E.push({x:(o[k]-g)/f,y:1-(o[k+1]-m)/p,width:(o[k+2]-o[k])/f,height:(o[k+1]-o[k+5])/p});b(y=d,K,lh).call(y),b(x=d,K,Vi).call(x),d.rotate(d.rotation)}else if(c){v(d,fe,!0);const E=c[0],k={x:E[0]-g,y:p-(E[1]-m)},C=new nh(k,[0,0,f,p],1,r(d,Ie)/2,!0,.001);for(let P=0,N=E.length;P<N;P+=2)k.x=E[P]-g,k.y=p-(E[P+1]-m),C.add(k);const{id:T,clipPathId:M}=s.drawLayer.draw(C,d.color,d._defaultOpacity,!0);b(A=d,K,vl).call(A,{highlightOutlines:C.getOutlines(),highlightId:T,clipPathId:M}),b(_=d,K,Vi).call(_)}return d}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const s=this.getRect(0,0),i=dt._colorManager.convert(this.color),n={annotationType:Q.HIGHLIGHT,color:i,opacity:r(this,zs),thickness:r(this,Ie),quadPoints:b(this,K,Zu).call(this),outlines:b(this,K,Ju).call(this,s),pageIndex:this.pageIndex,rect:s,rotation:b(this,K,ba).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!b(this,K,sf).call(this,n)?null:(n.id=this.annotationElementId,n)}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};qr=new WeakMap,Oo=new WeakMap,$s=new WeakMap,Rn=new WeakMap,Xr=new WeakMap,Ne=new WeakMap,Bo=new WeakMap,Vo=new WeakMap,Pn=new WeakMap,ts=new WeakMap,Zt=new WeakMap,fe=new WeakMap,Yr=new WeakMap,zs=new WeakMap,Ft=new WeakMap,Kr=new WeakMap,Ie=new WeakMap,Ho=new WeakMap,K=new WeakSet,lh=function(){const e=new dd(r(this,$s),.001);v(this,ts,e.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=r(this,ts).box;const s=new dd(r(this,$s),.0025,.001,this._uiManager.direction==="ltr");v(this,Ne,s.getOutlines());const{lastPoint:i}=r(this,Ne).box;v(this,Yr,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])},vl=function({highlightOutlines:e,highlightId:s,clipPathId:i}){var f,p;if(v(this,ts,e),v(this,Ne,e.getNewOutline(r(this,Ie)/2+1.5,.0025)),s>=0)v(this,Zt,s),v(this,Rn,i),this.parent.drawLayer.finalizeLine(s,e),v(this,Ft,this.parent.drawLayer.drawOutline(r(this,Ne)));else if(this.parent){const g=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(r(this,Zt),e),this.parent.drawLayer.updateBox(r(this,Zt),b(f=ot,Oe,tr).call(f,r(this,ts).box,(g-this.rotation+360)%360)),this.parent.drawLayer.updateLine(r(this,Ft),r(this,Ne)),this.parent.drawLayer.updateBox(r(this,Ft),b(p=ot,Oe,tr).call(p,r(this,Ne).box,g))}const{x:a,y:o,width:c,height:h}=e.box;switch(this.rotation){case 0:this.x=a,this.y=o,this.width=c,this.height=h;break;case 90:{const[g,m]=this.parentDimensions;this.x=o,this.y=1-a,this.width=c*m/g,this.height=h*g/m;break}case 180:this.x=1-a,this.y=1-o,this.width=c,this.height=h;break;case 270:{const[g,m]=this.parentDimensions;this.x=1-o,this.y=a,this.width=c*m/g,this.height=h*g/m;break}}const{lastPoint:d}=r(this,Ne).box;v(this,Yr,[(d[0]-a)/c,(d[1]-o)/h])},Xu=function(e){const s=(a,o)=>{var c,h,d;this.color=a,(c=this.parent)==null||c.drawLayer.changeColor(r(this,Zt),a),(h=r(this,Xr))==null||h.updateColor(a),v(this,zs,o),(d=this.parent)==null||d.drawLayer.changeOpacity(r(this,Zt),o)},i=this.color,n=r(this,zs);this.addCommands({cmd:s.bind(this,e,ot._defaultOpacity),undo:s.bind(this,i,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:X.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)},Yu=function(e){const s=r(this,Ie),i=n=>{v(this,Ie,n),b(this,K,Ku).call(this,n)};this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:X.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},Ku=function(e){if(!r(this,fe))return;b(this,K,vl).call(this,{highlightOutlines:r(this,ts).getNewOutline(e/2)}),this.fixAndSetPosition();const[s,i]=this.parentDimensions;this.setDims(this.width*s,this.height*i)},ch=function(){r(this,Zt)===null||!this.parent||(this.parent.drawLayer.remove(r(this,Zt)),v(this,Zt,null),this.parent.drawLayer.remove(r(this,Ft)),v(this,Ft,null))},Vi=function(e=this.parent){r(this,Zt)===null&&({id:ee(this,Zt)._,clipPathId:ee(this,Rn)._}=e.drawLayer.draw(r(this,ts),this.color,r(this,zs)),v(this,Ft,e.drawLayer.drawOutline(r(this,Ne))),r(this,Pn)&&(r(this,Pn).style.clipPath=r(this,Rn)))},Oe=new WeakSet,tr=function({x:e,y:s,width:i,height:n},a){switch(a){case 90:return{x:1-s-n,y:e,width:n,height:i};case 180:return{x:1-e-i,y:1-s-n,width:i,height:n};case 270:return{x:s,y:1-e-i,width:n,height:i}}return{x:e,y:s,width:i,height:n}},Qu=function(e){ot._keyboardManager.exec(this,e)},bl=function(e){if(!r(this,qr))return;const s=window.getSelection();e?s.setPosition(r(this,qr),r(this,Oo)):s.setPosition(r(this,Bo),r(this,Vo))},ba=function(){return r(this,fe)?this.rotation:0},Zu=function(){if(r(this,fe))return null;const[e,s]=this.pageDimensions,[i,n]=this.pageTranslation,a=r(this,$s),o=new Float32Array(a.length*8);let c=0;for(const{x:h,y:d,width:f,height:p}of a){const g=h*e+i,m=(1-d-p)*s+n;o[c]=o[c+4]=g,o[c+1]=o[c+3]=m,o[c+2]=o[c+6]=g+f*e,o[c+5]=o[c+7]=m+p*s,c+=8}return o},Ju=function(e){return r(this,ts).serialize(e,b(this,K,ba).call(this))},tf=function(e,s){this._freeHighlight.add(s)&&e.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},ef=function(e,s){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(s,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},sf=function(e){const{color:s}=this._initialData;return e.color.some((i,n)=>i!==s[n])},w(ot,Oe),q(ot,"_defaultColor",null),q(ot,"_defaultOpacity",1),q(ot,"_defaultThickness",12),q(ot,"_type","highlight"),q(ot,"_editorType",Q.HIGHLIGHT),q(ot,"_freeHighlightId",-1),q(ot,"_freeHighlight",null),q(ot,"_freeHighlightClipId","");let Pl=ot;var Ln,Nn,ms,js,Fe,In,Fn,Dn,Ws,Qr,On,Bn,Si,D,nf,rf,af,of,dh,lf,uh,cf,hf,df,uf,ff,Hi,fh,ph,gh,yl,wl,er,mh,Al,ei,pf,vh,gf,mf,bh,_l,ya;const wt=class wt extends dt{constructor(e){super({...e,name:"inkEditor"});w(this,D);w(this,Ln,0);w(this,Nn,0);w(this,ms,null);w(this,js,new Path2D);w(this,Fe,!1);w(this,In,null);w(this,Fn,!1);w(this,Dn,!1);w(this,Ws,null);w(this,Qr,null);w(this,On,0);w(this,Bn,0);w(this,Si,null);this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(e,s){dt.initialize(e,s)}static updateDefaultParams(e,s){switch(e){case X.INK_THICKNESS:wt._defaultThickness=s;break;case X.INK_COLOR:wt._defaultColor=s;break;case X.INK_OPACITY:wt._defaultOpacity=s/100;break}}updateParams(e,s){switch(e){case X.INK_THICKNESS:b(this,D,nf).call(this,s);break;case X.INK_COLOR:b(this,D,rf).call(this,s);break;case X.INK_OPACITY:b(this,D,af).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[X.INK_THICKNESS,wt._defaultThickness],[X.INK_COLOR,wt._defaultColor||dt._defaultLineColor],[X.INK_OPACITY,Math.round(wt._defaultOpacity*100)]]}get propertiesToUpdate(){return[[X.INK_THICKNESS,this.thickness||wt._defaultThickness],[X.INK_COLOR,this.color||wt._defaultColor||dt._defaultLineColor],[X.INK_OPACITY,Math.round(100*(this.opacity??wt._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(b(this,D,yl).call(this),b(this,D,wl).call(this)),this.isAttachedToDOM||(this.parent.add(this),b(this,D,er).call(this)),b(this,D,ya).call(this)))}remove(){var e;this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,r(this,ms)&&(clearTimeout(r(this,ms)),v(this,ms,null)),(e=r(this,Ws))==null||e.disconnect(),v(this,Ws,null),super.remove())}setParent(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&e===null&&this._uiManager.addShouldRescale(this),super.setParent(e)}onScaleChanging(){const[e,s]=this.parentDimensions,i=this.width*e,n=this.height*s;this.setDimensions(i,n)}enableEditMode(){r(this,Fe)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,b(this,D,fh).call(this))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),b(this,D,ph).call(this))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){r(this,Fe)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),v(this,Fe,!0),this.div.classList.add("disabled"),b(this,D,ya).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),this.enableEditMode())}canvasPointerdown(e){e.button!==0||!this.isInEditMode()||r(this,Fe)||(this.setInForeground(),e.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),b(this,D,lf).call(this,e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),b(this,D,uh).call(this,e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),b(this,D,gh).call(this,e)}canvasPointerleave(e){b(this,D,gh).call(this,e)}get isResizable(){return!this.isEmpty()&&r(this,Fe)}render(){if(this.div)return this.div;let e,s;this.width&&(e=this.x,s=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[i,n,a,o]=b(this,D,of).call(this);if(this.setAt(i,n,0,0),this.setDims(a,o),b(this,D,yl).call(this),this.width){const[c,h]=this.parentDimensions;this.setAspectRatio(this.width*c,this.height*h),this.setAt(e*c,s*h,this.width*c,this.height*h),v(this,Dn,!0),b(this,D,er).call(this),this.setDims(this.width*c,this.height*h),b(this,D,Hi).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return b(this,D,wl).call(this),this.div}setDimensions(e,s){const i=Math.round(e),n=Math.round(s);if(r(this,On)===i&&r(this,Bn)===n)return;v(this,On,i),v(this,Bn,n),this.canvas.style.visibility="hidden";const[a,o]=this.parentDimensions;this.width=e/a,this.height=s/o,this.fixAndSetPosition(),r(this,Fe)&&b(this,D,mh).call(this,e,s),b(this,D,er).call(this),b(this,D,Hi).call(this),this.canvas.style.visibility="visible",this.fixDims()}static async deserialize(e,s,i){var x,A,_;if(e instanceof $h)return null;const n=await super.deserialize(e,s,i);n.thickness=e.thickness,n.color=z.makeHexColor(...e.color),n.opacity=e.opacity;const[a,o]=n.pageDimensions,c=n.width*a,h=n.height*o,d=n.parentScale,f=e.thickness/2;v(n,Fe,!0),v(n,On,Math.round(c)),v(n,Bn,Math.round(h));const{paths:p,rect:g,rotation:m}=e;for(let{bezier:E}of p){E=b(x=wt,ei,gf).call(x,E,g,m);const k=[];n.paths.push(k);let C=d*(E[0]-f),T=d*(E[1]-f);for(let P=2,N=E.length;P<N;P+=6){const H=d*(E[P]-f),L=d*(E[P+1]-f),S=d*(E[P+2]-f),R=d*(E[P+3]-f),F=d*(E[P+4]-f),V=d*(E[P+5]-f);k.push([[C,T],[H,L],[S,R],[F,V]]),C=F,T=V}const M=b(this,ei,pf).call(this,k);n.bezierPath2D.push(M)}const y=b(A=n,D,bh).call(A);return v(n,Nn,Math.max(dt.MIN_SIZE,y[2]-y[0])),v(n,Ln,Math.max(dt.MIN_SIZE,y[3]-y[1])),b(_=n,D,mh).call(_,c,h),n}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),s=dt._colorManager.convert(this.ctx.strokeStyle);return{annotationType:Q.INK,color:s,thickness:this.thickness,opacity:this.opacity,paths:b(this,D,mf).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:e,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};Ln=new WeakMap,Nn=new WeakMap,ms=new WeakMap,js=new WeakMap,Fe=new WeakMap,In=new WeakMap,Fn=new WeakMap,Dn=new WeakMap,Ws=new WeakMap,Qr=new WeakMap,On=new WeakMap,Bn=new WeakMap,Si=new WeakMap,D=new WeakSet,nf=function(e){const s=n=>{this.thickness=n,b(this,D,ya).call(this)},i=this.thickness;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:X.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},rf=function(e){const s=n=>{this.color=n,b(this,D,Hi).call(this)},i=this.color;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:X.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},af=function(e){const s=n=>{this.opacity=n,b(this,D,Hi).call(this)};e/=100;const i=this.opacity;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:X.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},of=function(){const{parentRotation:e,parentDimensions:[s,i]}=this;switch(e){case 90:return[0,i,i,s];case 180:return[s,i,s,i];case 270:return[s,0,i,s];default:return[0,0,s,i]}},dh=function(){const{ctx:e,color:s,opacity:i,thickness:n,parentScale:a,scaleFactor:o}=this;e.lineWidth=n*a/o,e.lineCap="round",e.lineJoin="round",e.miterLimit=10,e.strokeStyle=`${s}${lp(i)}`},lf=function(e,s){this.canvas.addEventListener("contextmenu",Ve,{signal:this._uiManager._signal}),b(this,D,ph).call(this),v(this,In,new AbortController);const i=this._uiManager.combinedSignal(r(this,In));this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:i}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:i}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:i}),this.isEditing=!0,r(this,Dn)||(v(this,Dn,!0),b(this,D,er).call(this),this.thickness||(this.thickness=wt._defaultThickness),this.color||(this.color=wt._defaultColor||dt._defaultLineColor),this.opacity??(this.opacity=wt._defaultOpacity)),this.currentPath.push([e,s]),v(this,Fn,!1),b(this,D,dh).call(this),v(this,Si,()=>{b(this,D,df).call(this),r(this,Si)&&window.requestAnimationFrame(r(this,Si))}),window.requestAnimationFrame(r(this,Si))},uh=function(e,s){const[i,n]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===i&&s===n)return;const a=this.currentPath;let o=r(this,js);if(a.push([e,s]),v(this,Fn,!0),a.length<=2){o.moveTo(...a[0]),o.lineTo(e,s);return}a.length===3&&(v(this,js,o=new Path2D),o.moveTo(...a[0])),b(this,D,uf).call(this,o,...a.at(-3),...a.at(-2),e,s)},cf=function(){if(this.currentPath.length===0)return;const e=this.currentPath.at(-1);r(this,js).lineTo(...e)},hf=function(e,s){v(this,Si,null),e=Math.min(Math.max(e,0),this.canvas.width),s=Math.min(Math.max(s,0),this.canvas.height),b(this,D,uh).call(this,e,s),b(this,D,cf).call(this);let i;if(this.currentPath.length!==1)i=b(this,D,ff).call(this);else{const h=[e,s];i=[[h,h.slice(),h.slice(),h]]}const n=r(this,js),a=this.currentPath;this.currentPath=[],v(this,js,new Path2D);const o=()=>{this.allRawPaths.push(a),this.paths.push(i),this.bezierPath2D.push(n),this._uiManager.rebuild(this)},c=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(b(this,D,yl).call(this),b(this,D,wl).call(this)),b(this,D,ya).call(this))};this.addCommands({cmd:o,undo:c,mustExec:!0})},df=function(){if(!r(this,Fn))return;v(this,Fn,!1);const e=Math.ceil(this.thickness*this.parentScale),s=this.currentPath.slice(-3),i=s.map(o=>o[0]),n=s.map(o=>o[1]);Math.min(...i)-e,Math.max(...i)+e,Math.min(...n)-e,Math.max(...n)+e;const{ctx:a}=this;a.save(),a.clearRect(0,0,this.canvas.width,this.canvas.height);for(const o of this.bezierPath2D)a.stroke(o);a.stroke(r(this,js)),a.restore()},uf=function(e,s,i,n,a,o,c){const h=(s+n)/2,d=(i+a)/2,f=(n+o)/2,p=(a+c)/2;e.bezierCurveTo(h+2*(n-h)/3,d+2*(a-d)/3,f+2*(n-f)/3,p+2*(a-p)/3,f,p)},ff=function(){const e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];const s=[];let i,[n,a]=e[0];for(i=1;i<e.length-2;i++){const[g,m]=e[i],[y,x]=e[i+1],A=(g+y)/2,_=(m+x)/2,E=[n+2*(g-n)/3,a+2*(m-a)/3],k=[A+2*(g-A)/3,_+2*(m-_)/3];s.push([[n,a],E,k,[A,_]]),[n,a]=[A,_]}const[o,c]=e[i],[h,d]=e[i+1],f=[n+2*(o-n)/3,a+2*(c-a)/3],p=[h+2*(o-h)/3,d+2*(c-d)/3];return s.push([[n,a],f,p,[h,d]]),s},Hi=function(){if(this.isEmpty()){b(this,D,Al).call(this);return}b(this,D,dh).call(this);const{canvas:e,ctx:s}=this;s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,e.width,e.height),b(this,D,Al).call(this);for(const i of this.bezierPath2D)s.stroke(i)},fh=function(){if(r(this,Qr))return;v(this,Qr,new AbortController);const e=this._uiManager.combinedSignal(r(this,Qr));this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:e})},ph=function(){var e;(e=this.pointerdownAC)==null||e.abort(),this.pointerdownAC=null},gh=function(e){var s;(s=r(this,In))==null||s.abort(),v(this,In,null),b(this,D,fh).call(this),r(this,ms)&&clearTimeout(r(this,ms)),v(this,ms,setTimeout(()=>{v(this,ms,null),this.canvas.removeEventListener("contextmenu",Ve)},10)),b(this,D,hf).call(this,e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackground()},yl=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},wl=function(){v(this,Ws,new ResizeObserver(e=>{const s=e[0].contentRect;s.width&&s.height&&this.setDimensions(s.width,s.height)})),r(this,Ws).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var e;(e=r(this,Ws))==null||e.disconnect(),v(this,Ws,null)},{once:!0})},er=function(){if(!r(this,Dn))return;const[e,s]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*s),b(this,D,Al).call(this)},mh=function(e,s){const i=b(this,D,_l).call(this),n=(e-i)/r(this,Nn),a=(s-i)/r(this,Ln);this.scaleFactor=Math.min(n,a)},Al=function(){const e=b(this,D,_l).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)},ei=new WeakSet,pf=function(e){const s=new Path2D;for(let i=0,n=e.length;i<n;i++){const[a,o,c,h]=e[i];i===0&&s.moveTo(...a),s.bezierCurveTo(o[0],o[1],c[0],c[1],h[0],h[1])}return s},vh=function(e,s,i){const[n,a,o,c]=s;switch(i){case 0:for(let h=0,d=e.length;h<d;h+=2)e[h]+=n,e[h+1]=c-e[h+1];break;case 90:for(let h=0,d=e.length;h<d;h+=2){const f=e[h];e[h]=e[h+1]+n,e[h+1]=f+a}break;case 180:for(let h=0,d=e.length;h<d;h+=2)e[h]=o-e[h],e[h+1]+=a;break;case 270:for(let h=0,d=e.length;h<d;h+=2){const f=e[h];e[h]=o-e[h+1],e[h+1]=c-f}break;default:throw new Error("Invalid rotation")}return e},gf=function(e,s,i){const[n,a,o,c]=s;switch(i){case 0:for(let h=0,d=e.length;h<d;h+=2)e[h]-=n,e[h+1]=c-e[h+1];break;case 90:for(let h=0,d=e.length;h<d;h+=2){const f=e[h];e[h]=e[h+1]-a,e[h+1]=f-n}break;case 180:for(let h=0,d=e.length;h<d;h+=2)e[h]=o-e[h],e[h+1]-=a;break;case 270:for(let h=0,d=e.length;h<d;h+=2){const f=e[h];e[h]=c-e[h+1],e[h+1]=o-f}break;default:throw new Error("Invalid rotation")}return e},mf=function(e,s,i,n){var d,f;const a=[],o=this.thickness/2,c=e*s+o,h=e*i+o;for(const p of this.paths){const g=[],m=[];for(let y=0,x=p.length;y<x;y++){const[A,_,E,k]=p[y];if(A[0]===k[0]&&A[1]===k[1]&&x===1){const R=e*A[0]+c,F=e*A[1]+h;g.push(R,F),m.push(R,F);break}const C=e*A[0]+c,T=e*A[1]+h,M=e*_[0]+c,P=e*_[1]+h,N=e*E[0]+c,H=e*E[1]+h,L=e*k[0]+c,S=e*k[1]+h;y===0&&(g.push(C,T),m.push(C,T)),g.push(M,P,N,H,L,S),m.push(M,P),y===x-1&&m.push(L,S)}a.push({bezier:b(d=wt,ei,vh).call(d,g,n,this.rotation),points:b(f=wt,ei,vh).call(f,m,n,this.rotation)})}return a},bh=function(){let e=1/0,s=-1/0,i=1/0,n=-1/0;for(const a of this.paths)for(const[o,c,h,d]of a){const f=z.bezierBoundingBox(...o,...c,...h,...d);e=Math.min(e,f[0]),i=Math.min(i,f[1]),s=Math.max(s,f[2]),n=Math.max(n,f[3])}return[e,i,s,n]},_l=function(){return r(this,Fe)?Math.ceil(this.thickness*this.parentScale):0},ya=function(e=!1){if(this.isEmpty())return;if(!r(this,Fe)){b(this,D,Hi).call(this);return}const s=b(this,D,bh).call(this),i=b(this,D,_l).call(this);v(this,Nn,Math.max(dt.MIN_SIZE,s[2]-s[0])),v(this,Ln,Math.max(dt.MIN_SIZE,s[3]-s[1]));const n=Math.ceil(i+r(this,Nn)*this.scaleFactor),a=Math.ceil(i+r(this,Ln)*this.scaleFactor),[o,c]=this.parentDimensions;this.width=n/o,this.height=a/c,this.setAspectRatio(n,a);const h=this.translationX,d=this.translationY;this.translationX=-s[0],this.translationY=-s[1],b(this,D,er).call(this),b(this,D,Hi).call(this),v(this,On,n),v(this,Bn,a),this.setDims(n,a);const f=e?i/this.scaleFactor/2:0;this.translate(h-this.translationX-f,d-this.translationY-f)},w(wt,ei),q(wt,"_defaultColor",null),q(wt,"_defaultOpacity",1),q(wt,"_defaultThickness",1),q(wt,"_type","ink"),q(wt,"_editorType",Q.INK);let hh=wt;var _t,Gt,Ci,Us,Ti,Zr,vs,Gs,bs,Ee,Jr,et,wa,Aa,xl,wh,vf,El,Ah,kl,bf,yf;const Ea=class Ea extends dt{constructor(e){super({...e,name:"stampEditor"});w(this,et);w(this,_t,null);w(this,Gt,null);w(this,Ci,null);w(this,Us,null);w(this,Ti,null);w(this,Zr,"");w(this,vs,null);w(this,Gs,null);w(this,bs,null);w(this,Ee,!1);w(this,Jr,!1);v(this,Us,e.bitmapUrl),v(this,Ti,e.bitmapFile)}static initialize(e,s){dt.initialize(e,s)}static get supportedTypes(){return it(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(s=>`image/${s}`))}static get supportedTypesStr(){return it(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,s){s.pasteEditor(Q.STAMP,{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var e;return{type:"stamp",hasAltText:!!((e=this.altTextData)!=null&&e.altText)}}static computeTelemetryFinalData(e){const s=e.get("hasAltText");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}async mlGuessAltText(e=null,s=!0){if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:n,width:a,height:o}=e||this.copyCanvas(null,null,!0).imageData,c=await i.guess({name:"altText",request:{data:n,width:a,height:o,channels:n.length/(a*o)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");const h=c.output;return await this.setGuessedAltText(h),s&&!this.hasAltTextData()&&(this.altTextData={alt:h,decorative:!1}),h}remove(){var e,s;r(this,Gt)&&(v(this,_t,null),this._uiManager.imageManager.deleteId(r(this,Gt)),(e=r(this,vs))==null||e.remove(),v(this,vs,null),(s=r(this,Gs))==null||s.disconnect(),v(this,Gs,null),r(this,bs)&&(clearTimeout(r(this,bs)),v(this,bs,null))),super.remove()}rebuild(){if(!this.parent){r(this,Gt)&&b(this,et,xl).call(this);return}super.rebuild(),this.div!==null&&(r(this,Gt)&&r(this,vs)===null&&b(this,et,xl).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(r(this,Ci)||r(this,_t)||r(this,Us)||r(this,Ti)||r(this,Gt))}get isResizable(){return!0}render(){if(this.div)return this.div;let e,s;if(this.width&&(e=this.x,s=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),r(this,_t)?b(this,et,wh).call(this):b(this,et,xl).call(this),this.width&&!this.annotationElementId){const[i,n]=this.parentDimensions;this.setAt(e*i,s*n,this.width*i,this.height*n)}return this.div}copyCanvas(e,s,i=!1){var g;e||(e=224);const{width:n,height:a}=r(this,_t),o=new mc;let c=r(this,_t),h=n,d=a,f=null;if(s){if(n>s||a>s){const P=Math.min(s/n,s/a);h=Math.floor(n*P),d=Math.floor(a*P)}f=document.createElement("canvas");const m=f.width=Math.ceil(h*o.sx),y=f.height=Math.ceil(d*o.sy);r(this,Ee)||(c=b(this,et,El).call(this,m,y));const x=f.getContext("2d");x.filter=this._uiManager.hcmFilter;let A="white",_="#cfcfd8";this._uiManager.hcmFilter!=="none"?_="black":(g=window.matchMedia)!=null&&g.call(window,"(prefers-color-scheme: dark)").matches&&(A="#8f8f9d",_="#42414d");const E=15,k=E*o.sx,C=E*o.sy,T=new OffscreenCanvas(k*2,C*2),M=T.getContext("2d");M.fillStyle=A,M.fillRect(0,0,k*2,C*2),M.fillStyle=_,M.fillRect(0,0,k,C),M.fillRect(k,C,k,C),x.fillStyle=x.createPattern(T,"repeat"),x.fillRect(0,0,m,y),x.drawImage(c,0,0,c.width,c.height,0,0,m,y)}let p=null;if(i){let m,y;if(o.symmetric&&c.width<e&&c.height<e)m=c.width,y=c.height;else if(c=r(this,_t),n>e||a>e){const _=Math.min(e/n,e/a);m=Math.floor(n*_),y=Math.floor(a*_),r(this,Ee)||(c=b(this,et,El).call(this,m,y))}const A=new OffscreenCanvas(m,y).getContext("2d",{willReadFrequently:!0});A.drawImage(c,0,0,c.width,c.height,0,0,m,y),p={width:m,height:y,data:A.getImageData(0,0,m,y).data}}return{canvas:f,width:h,height:d,imageData:p}}getImageForAltText(){return r(this,vs)}static async deserialize(e,s,i){var y;let n=null;if(e instanceof Tu){const{data:{rect:x,rotation:A,id:_,structParent:E,popupRef:k},container:C,parent:{page:{pageNumber:T}}}=e,M=C.querySelector("canvas"),P=i.imageManager.getFromCanvas(C.id,M);M.remove();const N=((y=await s._structTree.getAriaAttributes(`${Rh}${_}`))==null?void 0:y.get("aria-label"))||"";n=e={annotationType:Q.STAMP,bitmapId:P.id,bitmap:P.bitmap,pageIndex:T-1,rect:x.slice(0),rotation:A,id:_,deleted:!1,accessibilityData:{decorative:!1,altText:N},isSvg:!1,structParent:E,popupRef:k}}const a=await super.deserialize(e,s,i),{rect:o,bitmap:c,bitmapUrl:h,bitmapId:d,isSvg:f,accessibilityData:p}=e;d&&i.imageManager.isValidId(d)?(v(a,Gt,d),c&&v(a,_t,c)):v(a,Us,h),v(a,Ee,f);const[g,m]=a.pageDimensions;return a.width=(o[2]-o[0])/g,a.height=(o[3]-o[1])/m,a.annotationElementId=e.id||null,p&&(a.altTextData=p),a._initialData=n,v(a,Jr,!!n),a}serialize(e=!1,s=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i={annotationType:Q.STAMP,bitmapId:r(this,Gt),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:r(this,Ee),structTreeParentId:this._structTreeParentId};if(e)return i.bitmapUrl=b(this,et,kl).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i;const{decorative:n,altText:a}=this.serializeAltText(!1);if(!n&&a&&(i.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const c=b(this,et,yf).call(this,i);if(c.isSame)return null;c.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1}if(i.id=this.annotationElementId,s===null)return i;s.stamps||(s.stamps=new Map);const o=r(this,Ee)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!s.stamps.has(r(this,Gt)))s.stamps.set(r(this,Gt),{area:o,serialized:i}),i.bitmap=b(this,et,kl).call(this,!1);else if(r(this,Ee)){const c=s.stamps.get(r(this,Gt));o>c.area&&(c.area=o,c.serialized.bitmap.close(),c.serialized.bitmap=b(this,et,kl).call(this,!1))}return i}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}};_t=new WeakMap,Gt=new WeakMap,Ci=new WeakMap,Us=new WeakMap,Ti=new WeakMap,Zr=new WeakMap,vs=new WeakMap,Gs=new WeakMap,bs=new WeakMap,Ee=new WeakMap,Jr=new WeakMap,et=new WeakSet,wa=function(e,s=!1){if(!e){this.remove();return}v(this,_t,e.bitmap),s||(v(this,Gt,e.id),v(this,Ee,e.isSvg)),e.file&&v(this,Zr,e.file.name),b(this,et,wh).call(this)},Aa=function(){if(v(this,Ci,null),this._uiManager.enableWaiting(!1),!!r(this,vs)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,_t)){this._editToolbar.hide(),this._uiManager.editAltText(this,!0);return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,_t)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},xl=function(){if(r(this,Gt)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(r(this,Gt)).then(i=>b(this,et,wa).call(this,i,!0)).finally(()=>b(this,et,Aa).call(this));return}if(r(this,Us)){const i=r(this,Us);v(this,Us,null),this._uiManager.enableWaiting(!0),v(this,Ci,this._uiManager.imageManager.getFromUrl(i).then(n=>b(this,et,wa).call(this,n)).finally(()=>b(this,et,Aa).call(this)));return}if(r(this,Ti)){const i=r(this,Ti);v(this,Ti,null),this._uiManager.enableWaiting(!0),v(this,Ci,this._uiManager.imageManager.getFromFile(i).then(n=>b(this,et,wa).call(this,n)).finally(()=>b(this,et,Aa).call(this)));return}const e=document.createElement("input");e.type="file",e.accept=Ea.supportedTypesStr;const s=this._uiManager._signal;v(this,Ci,new Promise(i=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const n=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),b(this,et,wa).call(this,n)}i()},{signal:s}),e.addEventListener("cancel",()=>{this.remove(),i()},{signal:s})}).finally(()=>b(this,et,Aa).call(this))),e.click()},wh=function(){const{div:e}=this;let{width:s,height:i}=r(this,_t);const[n,a]=this.pageDimensions,o=.75;if(this.width)s=this.width*n,i=this.height*a;else if(s>o*n||i>o*a){const f=Math.min(o*n/s,o*a/i);s*=f,i*=f}const[c,h]=this.parentDimensions;this.setDims(s*c/n,i*h/a),this._uiManager.enableWaiting(!1);const d=v(this,vs,document.createElement("canvas"));d.setAttribute("role","img"),this.addContainer(d),(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),b(this,et,Ah).call(this,s,i),b(this,et,bf).call(this),r(this,Jr)||(this.parent.addUndoableEditor(this),v(this,Jr,!0)),this._reportTelemetry({action:"inserted_image"}),r(this,Zr)&&d.setAttribute("aria-label",r(this,Zr))},vf=function(e,s){var o;const[i,n]=this.parentDimensions;this.width=e/i,this.height=s/n,(o=this._initialOptions)!=null&&o.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,r(this,bs)!==null&&clearTimeout(r(this,bs)),v(this,bs,setTimeout(()=>{v(this,bs,null),b(this,et,Ah).call(this,e,s)},200))},El=function(e,s){const{width:i,height:n}=r(this,_t);let a=i,o=n,c=r(this,_t);for(;a>2*e||o>2*s;){const h=a,d=o;a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),o>2*s&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const f=new OffscreenCanvas(a,o);f.getContext("2d").drawImage(c,0,0,h,d,0,0,a,o),c=f.transferToImageBitmap()}return c},Ah=function(e,s){const i=new mc,n=Math.ceil(e*i.sx),a=Math.ceil(s*i.sy),o=r(this,vs);if(!o||o.width===n&&o.height===a)return;o.width=n,o.height=a;const c=r(this,Ee)?r(this,_t):b(this,et,El).call(this,n,a),h=o.getContext("2d");h.filter=this._uiManager.hcmFilter,h.drawImage(c,0,0,c.width,c.height,0,0,n,a)},kl=function(e){if(e){if(r(this,Ee)){const n=this._uiManager.imageManager.getSvgUrl(r(this,Gt));if(n)return n}const s=document.createElement("canvas");return{width:s.width,height:s.height}=r(this,_t),s.getContext("2d").drawImage(r(this,_t),0,0),s.toDataURL()}if(r(this,Ee)){const[s,i]=this.pageDimensions,n=Math.round(this.width*s*Li.PDF_TO_CSS_UNITS),a=Math.round(this.height*i*Li.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(n,a);return o.getContext("2d").drawImage(r(this,_t),0,0,r(this,_t).width,r(this,_t).height,0,0,n,a),o.transferToImageBitmap()}return structuredClone(r(this,_t))},bf=function(){this._uiManager._signal&&(v(this,Gs,new ResizeObserver(e=>{const s=e[0].contentRect;s.width&&s.height&&b(this,et,vf).call(this,s.width,s.height)})),r(this,Gs).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var e;(e=r(this,Gs))==null||e.disconnect(),v(this,Gs,null)},{once:!0}))},yf=function(e){var h;const{rect:s,pageIndex:i,accessibilityData:{altText:n}}=this._initialData,a=e.rect.every((d,f)=>Math.abs(d-s[f])<1),o=e.pageIndex===i,c=(((h=e.accessibilityData)==null?void 0:h.alt)||"")===n;return{isSame:a&&o&&c,isSameAltText:c}},q(Ea,"_type","stamp"),q(Ea,"_editorType",Q.STAMP);let yh=Ea;var Vn,ta,ys,Mi,qs,ke,Ri,ea,sa,Jt,Xs,U,Pi,qt,wf,xh,Eh,kh,Sl;const He=class He{constructor({uiManager:t,pageIndex:e,div:s,structTreeLayer:i,accessibilityManager:n,annotationLayer:a,drawLayer:o,textLayer:c,viewport:h,l10n:d}){w(this,qt);w(this,Vn);w(this,ta,!1);w(this,ys,null);w(this,Mi,null);w(this,qs,null);w(this,ke,new Map);w(this,Ri,!1);w(this,ea,!1);w(this,sa,!1);w(this,Jt,null);w(this,Xs,null);w(this,U);const f=[...r(He,Pi).values()];if(!He._initialized){He._initialized=!0;for(const p of f)p.initialize(d,t)}t.registerEditorTypes(f),v(this,U,t),this.pageIndex=e,this.div=s,v(this,Vn,n),v(this,ys,a),this.viewport=h,v(this,Jt,c),this.drawLayer=o,this._structTree=i,r(this,U).addLayer(this)}get isEmpty(){return r(this,ke).size===0}get isInvisible(){return this.isEmpty&&r(this,U).getMode()===Q.NONE}updateToolbar(t){r(this,U).updateToolbar(t)}updateMode(t=r(this,U).getMode()){switch(b(this,qt,Sl).call(this),t){case Q.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Q.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case Q.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;for(const s of r(He,Pi).values())e.toggle(`${s._type}Editing`,t===s._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===((e=r(this,Jt))==null?void 0:e.div)}addInkEditorIfNeeded(t){if(r(this,U).getMode()!==Q.INK)return;if(!t){for(const s of r(this,ke).values())if(s.isEmpty()){s.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(t){r(this,U).setEditingState(t)}addCommands(t){r(this,U).addCommands(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){var e;(e=r(this,ys))==null||e.div.classList.toggle("disabled",!t)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const s of r(this,ke).values())s.enableEditing(),s.show(!0),s.annotationElementId&&(r(this,U).removeChangedExistingAnnotation(s),t.add(s.annotationElementId));if(!r(this,ys))return;const e=r(this,ys).getEditableAnnotations();for(const s of e){if(s.hide(),r(this,U).isDeletedAnnotationElement(s.data.id)||t.has(s.data.id))continue;const i=await this.deserialize(s);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){var i;v(this,sa,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const n of r(this,ke).values())if(n.disableEditing(),!!n.annotationElementId){if(n.serialize()!==null){t.set(n.annotationElementId,n);continue}else e.set(n.annotationElementId,n);(i=this.getEditableAnnotation(n.annotationElementId))==null||i.show(),n.remove()}if(r(this,ys)){const n=r(this,ys).getEditableAnnotations();for(const a of n){const{id:o}=a.data;if(r(this,U).isDeletedAnnotationElement(o))continue;let c=e.get(o);if(c){c.resetAnnotationElement(a),c.show(!1),a.show();continue}c=t.get(o),c&&(r(this,U).addChangedExistingAnnotation(c),c.renderAnnotationElement(a)&&c.show(!1)),a.show()}}b(this,qt,Sl).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of r(He,Pi).values())s.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),v(this,sa,!1)}getEditableAnnotation(t){var e;return((e=r(this,ys))==null?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){r(this,U).getActive()!==t&&r(this,U).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(t=r(this,Jt))!=null&&t.div&&!r(this,Xs)){v(this,Xs,new AbortController);const e=r(this,U).combinedSignal(r(this,Xs));r(this,Jt).div.addEventListener("pointerdown",b(this,qt,wf).bind(this),{signal:e}),r(this,Jt).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(t=r(this,Jt))!=null&&t.div&&r(this,Xs)&&(r(this,Xs).abort(),v(this,Xs,null),r(this,Jt).div.classList.remove("highlighting"))}enableClick(){if(r(this,Mi))return;v(this,Mi,new AbortController);const t=r(this,U).combinedSignal(r(this,Mi));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:t})}disableClick(){var t;(t=r(this,Mi))==null||t.abort(),v(this,Mi,null)}attach(t){r(this,ke).set(t.id,t);const{annotationElementId:e}=t;e&&r(this,U).isDeletedAnnotationElement(e)&&r(this,U).removeDeletedAnnotationElement(t)}detach(t){var e;r(this,ke).delete(t.id),(e=r(this,Vn))==null||e.removePointerInTextLayer(t.contentDiv),!r(this,sa)&&t.annotationElementId&&r(this,U).addDeletedAnnotationElement(t)}remove(t){this.detach(t),r(this,U).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,r(this,ea)||this.addInkEditorIfNeeded(!1)}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(r(this,U).addDeletedAnnotationElement(t.annotationElementId),dt.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),(e=t.parent)==null||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),r(this,U).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),r(this,U).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var s;if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!r(this,qs)&&(t._focusEventsAllowed=!1,v(this,qs,setTimeout(()=>{v(this,qs,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:r(this,U)._signal}),e.focus())},0))),t._structTreeParentId=(s=r(this,Vn))==null?void 0:s.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){const e=()=>t._uiManager.rebuild(t),s=()=>{t.remove()};this.addCommands({cmd:e,undo:s,mustExec:!1})}getNextId(){return r(this,U).getId()}combinedSignal(t){return r(this,U).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return(t=r(this,qt,xh))==null?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){r(this,U).updateToolbar(t),r(this,U).updateMode(t);const{offsetX:s,offsetY:i}=b(this,qt,kh).call(this),n=this.getNextId(),a=b(this,qt,Eh).call(this,{parent:this,id:n,x:s,y:i,uiManager:r(this,U),isCentered:!0,...e});a&&this.add(a)}async deserialize(t){var e;return await((e=r(He,Pi).get(t.annotationType??t.annotationEditorType))==null?void 0:e.deserialize(t,this,r(this,U)))||null}createAndAddNewEditor(t,e,s={}){const i=this.getNextId(),n=b(this,qt,Eh).call(this,{parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:r(this,U),isCentered:e,...s});return n&&this.add(n),n}addNewEditor(){this.createAndAddNewEditor(b(this,qt,kh).call(this),!0)}setSelected(t){r(this,U).setSelected(t)}toggleSelected(t){r(this,U).toggleSelected(t)}unselect(t){r(this,U).unselect(t)}pointerup(t){const{isMac:e}=re.platform;if(!(t.button!==0||t.ctrlKey&&e)&&t.target===this.div&&r(this,Ri)){if(v(this,Ri,!1),!r(this,ta)){v(this,ta,!0);return}if(r(this,U).getMode()===Q.STAMP){r(this,U).unselectAll();return}this.createAndAddNewEditor(t,!1)}}pointerdown(t){if(r(this,U).getMode()===Q.HIGHLIGHT&&this.enableTextSelection(),r(this,Ri)){v(this,Ri,!1);return}const{isMac:e}=re.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;v(this,Ri,!0);const s=r(this,U).getActive();v(this,ta,!s||s.isEmpty())}findNewParent(t,e,s){const i=r(this,U).findParent(e,s);return i===null||i===this?!1:(i.changeParent(t),!0)}destroy(){var t,e;((t=r(this,U).getActive())==null?void 0:t.parent)===this&&(r(this,U).commitOrRemove(),r(this,U).setActiveEditor(null)),r(this,qs)&&(clearTimeout(r(this,qs)),v(this,qs,null));for(const s of r(this,ke).values())(e=r(this,Vn))==null||e.removePointerInTextLayer(s.contentDiv),s.setParent(null),s.isAttachedToDOM=!1,s.div.remove();this.div=null,r(this,ke).clear(),r(this,U).removeLayer(this)}render({viewport:t}){this.viewport=t,Hn(this.div,t);for(const e of r(this,U).getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){r(this,U).commitOrRemove(),b(this,qt,Sl).call(this);const e=this.viewport.rotation,s=t.rotation;if(this.viewport=t,Hn(this.div,{rotation:s}),e!==s)for(const i of r(this,ke).values())i.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return r(this,U).viewParameters.realScale}};Vn=new WeakMap,ta=new WeakMap,ys=new WeakMap,Mi=new WeakMap,qs=new WeakMap,ke=new WeakMap,Ri=new WeakMap,ea=new WeakMap,sa=new WeakMap,Jt=new WeakMap,Xs=new WeakMap,U=new WeakMap,Pi=new WeakMap,qt=new WeakSet,wf=function(t){r(this,U).unselectAll();const{target:e}=t;if(e===r(this,Jt).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&r(this,Jt).div.contains(e)){const{isMac:s}=re.platform;if(t.button!==0||t.ctrlKey&&s)return;r(this,U).showAllEditors("highlight",!0,!0),r(this,Jt).div.classList.add("free"),this.toggleDrawing(),Pl.startHighlighting(this,r(this,U).direction==="ltr",{target:r(this,Jt).div,x:t.x,y:t.y}),r(this,Jt).div.addEventListener("pointerup",()=>{r(this,Jt).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:r(this,U)._signal}),t.preventDefault()}},xh=function(){return r(He,Pi).get(r(this,U).getMode())},Eh=function(t){const e=r(this,qt,xh);return e?new e.prototype.constructor(t):null},kh=function(){const{x:t,y:e,width:s,height:i}=this.div.getBoundingClientRect(),n=Math.max(0,t),a=Math.max(0,e),o=Math.min(window.innerWidth,t+s),c=Math.min(window.innerHeight,e+i),h=(n+o)/2-t,d=(a+c)/2-e,[f,p]=this.viewport.rotation%180===0?[h,d]:[d,h];return{offsetX:f,offsetY:p}},Sl=function(){v(this,ea,!0);for(const t of r(this,ke).values())t.isEmpty()&&t.remove();v(this,ea,!1)},q(He,"_initialized",!1),w(He,Pi,new Map([eh,hh,yh,Pl].map(t=>[t._editorType,t])));let _h=He;var ws,$o,Mt,Ys,zo,Ch,Wn,Th,Af;const jt=class jt{constructor({pageIndex:t}){w(this,Wn);w(this,ws,null);w(this,$o,0);w(this,Mt,new Map);w(this,Ys,new Map);this.pageIndex=t}setParent(t){if(!r(this,ws)){v(this,ws,t);return}if(r(this,ws)!==t){if(r(this,Mt).size>0)for(const e of r(this,Mt).values())e.remove(),t.append(e);v(this,ws,t)}}static get _svgFactory(){return it(this,"_svgFactory",new Hh)}draw(t,e,s,i=!1){const n=ee(this,$o)._++,a=b(this,Wn,Th).call(this,t.box);a.classList.add(...t.classNamesForDrawing);const o=jt._svgFactory.createElement("defs");a.append(o);const c=jt._svgFactory.createElement("path");o.append(c);const h=`path_p${this.pageIndex}_${n}`;c.setAttribute("id",h),c.setAttribute("d",t.toSVGPath()),i&&r(this,Ys).set(n,c);const d=b(this,Wn,Af).call(this,o,h),f=jt._svgFactory.createElement("use");return a.append(f),a.setAttribute("fill",e),a.setAttribute("fill-opacity",s),f.setAttribute("href",`#${h}`),r(this,Mt).set(n,a),{id:n,clipPathId:`url(#${d})`}}drawOutline(t){const e=ee(this,$o)._++,s=b(this,Wn,Th).call(this,t.box);s.classList.add(...t.classNamesForOutlining);const i=jt._svgFactory.createElement("defs");s.append(i);const n=jt._svgFactory.createElement("path");i.append(n);const a=`path_p${this.pageIndex}_${e}`;n.setAttribute("id",a),n.setAttribute("d",t.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke");let o;if(t.mustRemoveSelfIntersections){const d=jt._svgFactory.createElement("mask");i.append(d),o=`mask_p${this.pageIndex}_${e}`,d.setAttribute("id",o),d.setAttribute("maskUnits","objectBoundingBox");const f=jt._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const p=jt._svgFactory.createElement("use");d.append(p),p.setAttribute("href",`#${a}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}const c=jt._svgFactory.createElement("use");s.append(c),c.setAttribute("href",`#${a}`),o&&c.setAttribute("mask",`url(#${o})`);const h=c.cloneNode();return s.append(h),c.classList.add("mainOutline"),h.classList.add("secondaryOutline"),r(this,Mt).set(e,s),e}finalizeLine(t,e){const s=r(this,Ys).get(t);r(this,Ys).delete(t),this.updateBox(t,e.box),s.setAttribute("d",e.toSVGPath())}updateLine(t,e){r(this,Mt).get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}updatePath(t,e){r(this,Ys).get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){var s;b(s=jt,zo,Ch).call(s,r(this,Mt).get(t),e)}show(t,e){r(this,Mt).get(t).classList.toggle("hidden",!e)}rotate(t,e){r(this,Mt).get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){r(this,Mt).get(t).setAttribute("fill",e)}changeOpacity(t,e){r(this,Mt).get(t).setAttribute("fill-opacity",e)}addClass(t,e){r(this,Mt).get(t).classList.add(e)}removeClass(t,e){r(this,Mt).get(t).classList.remove(e)}getSVGRoot(t){return r(this,Mt).get(t)}remove(t){r(this,Ys).delete(t),r(this,ws)!==null&&(r(this,Mt).get(t).remove(),r(this,Mt).delete(t))}destroy(){v(this,ws,null);for(const t of r(this,Mt).values())t.remove();r(this,Mt).clear(),r(this,Ys).clear()}};ws=new WeakMap,$o=new WeakMap,Mt=new WeakMap,Ys=new WeakMap,zo=new WeakSet,Ch=function(t,{x:e=0,y:s=0,width:i=1,height:n=1}={}){const{style:a}=t;a.top=`${100*s}%`,a.left=`${100*e}%`,a.width=`${100*i}%`,a.height=`${100*n}%`},Wn=new WeakSet,Th=function(t){var s;const e=jt._svgFactory.create(1,1,!0);return r(this,ws).append(e),e.setAttribute("aria-hidden",!0),b(s=jt,zo,Ch).call(s,e,t),e},Af=function(t,e){const s=jt._svgFactory.createElement("clipPath");t.append(s);const i=`clip_${e}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=jt._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),i},w(jt,zo);let Sh=jt;var $g=Y.AbortException,zg=Y.AnnotationEditorLayer,jg=Y.AnnotationEditorParamsType,Wg=Y.AnnotationEditorType,Ug=Y.AnnotationEditorUIManager,Gg=Y.AnnotationLayer,qg=Y.AnnotationMode,Xg=Y.ColorPicker,Yg=Y.DOMSVGFactory,Kg=Y.DrawLayer,Qg=Y.FeatureTest,Zg=Y.GlobalWorkerOptions,Jg=Y.ImageKind,tm=Y.InvalidPDFException,em=Y.MissingPDFException,sm=Y.OPS,im=Y.OutputScale,nm=Y.PDFDataRangeTransport,rm=Y.PDFDateString,am=Y.PDFWorker,om=Y.PasswordResponses,lm=Y.PermissionFlag,cm=Y.PixelsPerInch,hm=Y.RenderingCancelledException,dm=Y.TextLayer,um=Y.UnexpectedResponseException,fm=Y.Util,pm=Y.VerbosityLevel,gm=Y.XfaLayer,mm=Y.build,vm=Y.createValidAbsoluteUrl,bm=Y.fetchData,_f=Y.getDocument,ym=Y.getFilenameFromUrl,wm=Y.getPdfFilenameFromUrl,Am=Y.getXfaPageViewport,_m=Y.isDataScheme,xm=Y.isPdfFile,Em=Y.noContextMenu,km=Y.normalizeUnicode,Sm=Y.setLayerDimensions,Cm=Y.shadow,Tm=Y.version;const Mm=Object.freeze(Object.defineProperty({__proto__:null,AbortException:$g,AnnotationEditorLayer:zg,AnnotationEditorParamsType:jg,AnnotationEditorType:Wg,AnnotationEditorUIManager:Ug,AnnotationLayer:Gg,AnnotationMode:qg,ColorPicker:Xg,DOMSVGFactory:Yg,DrawLayer:Kg,FeatureTest:Qg,GlobalWorkerOptions:Zg,ImageKind:Jg,InvalidPDFException:tm,MissingPDFException:em,OPS:sm,OutputScale:im,PDFDataRangeTransport:nm,PDFDateString:rm,PDFWorker:am,PasswordResponses:om,PermissionFlag:lm,PixelsPerInch:cm,RenderingCancelledException:hm,TextLayer:dm,UnexpectedResponseException:um,Util:fm,VerbosityLevel:pm,XfaLayer:gm,build:mm,createValidAbsoluteUrl:vm,fetchData:bm,getDocument:_f,getFilenameFromUrl:ym,getPdfFilenameFromUrl:wm,getXfaPageViewport:Am,isDataScheme:_m,isPdfFile:xm,noContextMenu:Em,normalizeUnicode:km,setLayerDimensions:Sm,shadow:Cm,version:Tm},Symbol.toStringTag,{value:"Module"})),Rm={key:0,class:"vfp-text-white/70 vfp-text-center"},Pm={class:"vfp-text-lg"},Lm={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-min-h-screen"},Nm={class:"pdf-pages vfp-flex vfp-flex-col vfp-gap-4"},Im={key:2,class:"vfp-sticky vfp-bottom-2 md:vfp-bottom-4 vfp-mt-4 md:vfp-mt-8 vfp-bg-black/60 vfp-backdrop-blur-xl vfp-text-white vfp-px-4 vfp-py-2 md:vfp-px-6 md:vfp-py-3 vfp-rounded-full vfp-text-xs md:vfp-text-sm vfp-font-medium vfp-shadow-2xl vfp-border vfp-border-white/10"},Fm=l.defineComponent({__name:"PdfRenderer",props:{url:{},zoom:{},currentPage:{}},emits:["pageChange","totalPagesChange","pageWidthChange"],setup(u,{emit:t}){Me.configurePdfWorker(Mm);const e=u,s=t,i=l.ref(0),n=l.ref(null),a=l.ref(null);let o=null;const c=[],h=async(g,m,y)=>{if(!o)return;const x=await o.getPage(g),A=x.getViewport({scale:m}),_=document.createElement("canvas");_.width=A.width,_.height=A.height,_.style.maxWidth="100%",_.style.height="auto",_.style.borderRadius="8px",_.style.display="block",_.style.boxShadow="0 25px 50px -12px rgba(0,0,0,0.25)",_.style.filter="brightness(0.95) contrast(1.05)";const E=_.getContext("2d");if(!E)return;if(await x.render({canvasContext:E,viewport:A}).promise,g===1){const C=x.getViewport({scale:1});s("pageWidthChange",C.width)}y.innerHTML="",y.appendChild(_);const k=document.createElement("div");k.textContent=String(g),k.style.cssText="position:absolute;top:8px;right:8px;background:rgba(0,0,0,0.6);backdrop-filter:blur(4px);color:white;font-size:12px;padding:4px 12px;border-radius:9999px;",y.appendChild(k)},d=async()=>{if(!o||!a.value)return;const g=a.value.querySelector(".pdf-pages");if(g){g.innerHTML="",c.length=0;for(let m=1;m<=i.value;m++){const y=document.createElement("div");y.style.cssText="position:relative;display:flex;justify-content:center;",g.appendChild(y),c.push(y),await h(m,e.zoom,y)}}},f=async()=>{if(n.value=null,i.value=0,o){try{o.destroy()}catch{}o=null}try{o=await _f({url:e.url}).promise,i.value=o.numPages,s("totalPagesChange",o.numPages),s("pageChange",1),await l.nextTick(),await d()}catch(g){console.error("PDF 加载错误:",g),n.value="PDF 文件加载失败"}},p=()=>{if(!a.value)return;const g=a.value,m=g.scrollTop,y=g.clientHeight,x=m+y/2;let A=1,_=1/0;c.forEach((E,k)=>{const C=k+1,T=E.getBoundingClientRect(),M=g.getBoundingClientRect(),P=T.top-M.top+T.height/2+m,N=Math.abs(P-x);N<_&&(_=N,A=C)}),A!==e.currentPage&&s("pageChange",A)};return l.onMounted(()=>{f(),a.value&&a.value.addEventListener("scroll",p)}),l.watch(()=>e.url,()=>{f()}),l.watch(()=>e.zoom,()=>{d()}),l.onBeforeUnmount(()=>{if(a.value&&a.value.removeEventListener("scroll",p),o){try{o.destroy()}catch{}o=null}}),(g,m)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"containerRef",ref:a,class:"vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-4 md:vfp-py-8 vfp-px-2 md:vfp-px-4"},[n.value?(l.openBlock(),l.createElementBlock("div",Rm,[l.createElementVNode("p",Pm,l.toDisplayString(n.value),1)])):l.createCommentVNode("",!0),!n.value&&i.value===0?(l.openBlock(),l.createElementBlock("div",Lm,[...m[0]||(m[0]=[l.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):l.createCommentVNode("",!0),l.withDirectives(l.createElementVNode("div",Nm,null,512),[[l.vShow,!n.value&&i.value>0]]),i.value>0?(l.openBlock(),l.createElementBlock("div",Im," 第 "+l.toDisplayString(u.currentPage)+" 页 / 共 "+l.toDisplayString(i.value)+" 页 ",1)):l.createCommentVNode("",!0)],512))}}),Dm={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Om={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Bm={class:"vfp-text-white/70 vfp-text-center"},Vm={class:"vfp-text-lg"},Hm={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto",style:{background:"rgba(0, 0, 0, 0.15)"}},$m=["innerHTML"],zm=["innerHTML"],ud=1123,fd=60,pd=50,jm=24,Wm=l.defineComponent({__name:"DocxRenderer",props:{url:{}},setup(u){const t=ud-fd*2,e=u,s=l.ref(""),i=l.ref(!0),n=l.ref(null),a=l.ref([]),o=l.ref(null),c=async()=>{i.value=!0,n.value=null,s.value="",a.value=[];try{const g=await fetch(e.url);if(!g.ok)throw new Error("文件加载失败");const m=await g.arrayBuffer(),y=await Sf.convertToHtml({arrayBuffer:m});s.value=y.value}catch(g){console.error("Docx 解析错误:",g),n.value="Word 文档解析失败"}finally{i.value=!1}},h=()=>{const g=o.value;if(!g||!s.value)return;const m=Array.from(g.children);if(m.length===0){a.value=[s.value];return}const y=[[]];let x=0;for(const A of m){const _=A.offsetHeight;x>0&&x+_>t&&(y.push([]),x=0),y[y.length-1].push(A.outerHTML),x+=_}y.length===0&&y.push([]),a.value=y.map(A=>A.join(""))};l.watch(()=>e.url,c,{immediate:!0}),l.watch(s,async()=>{s.value&&(await l.nextTick(),requestAnimationFrame(()=>h()))});const d={fontFamily:"system-ui, -apple-system, sans-serif",lineHeight:"1.8",color:"#333"},f={...d,position:"absolute",visibility:"hidden",width:`${794-pd*2}px`,pointerEvents:"none"},p={width:"100%",maxWidth:"794px",minHeight:`${ud}px`,background:"white",boxShadow:"0 2px 12px rgba(0, 0, 0, 0.15)",flexShrink:0,padding:`${fd}px ${pd}px`};return(g,m)=>i.value?(l.openBlock(),l.createElementBlock("div",Dm,[...m[0]||(m[0]=[l.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):n.value?(l.openBlock(),l.createElementBlock("div",Om,[l.createElementVNode("div",Bm,[l.createElementVNode("p",Vm,l.toDisplayString(n.value),1)])])):(l.openBlock(),l.createElementBlock("div",Hm,[l.createElementVNode("div",{ref_key:"measureRef",ref:o,style:f,innerHTML:s.value},null,8,$m),l.createElementVNode("div",{class:"vfp-py-6 md:vfp-py-10 vfp-flex vfp-flex-col vfp-items-center",style:l.normalizeStyle({gap:`${jm}px`})},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(a.value.length>0?a.value:[""],(y,x)=>(l.openBlock(),l.createElementBlock("div",{key:x,style:p},[l.createElementVNode("div",{style:d,innerHTML:y},null,8,zm)]))),128))],4)]))}}),Um={class:"vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full"},Gm={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},qm={key:1,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},Xm={class:"vfp-text-center vfp-max-w-sm md:vfp-max-w-md vfp-px-4"},Ym={class:"vfp-w-24 vfp-h-24 md:vfp-w-32 md:vfp-h-32 vfp-mx-auto vfp-mb-4 md:vfp-mb-6 vfp-rounded-2xl md:vfp-rounded-3xl vfp-bg-gradient-to-br vfp-from-green-500 vfp-via-emerald-500 vfp-to-teal-500 vfp-flex vfp-items-center vfp-justify-center vfp-shadow-2xl"},Km={class:"vfp-text-xs md:vfp-text-sm vfp-text-white/60 vfp-mb-4 md:vfp-mb-6"},Qm=["href"],Zm=l.defineComponent({__name:"XlsxRenderer",props:{url:{}},setup(u){const t=u,e=l.ref(!0),s=l.ref(null),i=l.ref(null);let n=null,a=null,o=null,c={width:0,height:0};const h=()=>{if(!i.value)return{width:800,height:600};const p=i.value.clientWidth,g=i.value.clientHeight,m=p>100?p:800,y=g>100?g:600;return{width:m,height:y}},d=()=>{if(!i.value||!n)return;i.value.innerHTML="";const{width:p,height:g}=h(),m=p<640;new Tf(i.value,{mode:"read",showToolbar:!1,showContextmenu:!1,showGrid:!0,row:{len:100,height:25},col:{len:26,width:m?80:100,indexWidth:m?40:60,minWidth:m?40:60},view:{height:()=>g,width:()=>p}}).loadData(n)},f=async()=>{if(i.value){e.value=!0,s.value=null;try{const p=await fetch(t.url,{mode:"cors",credentials:"omit",redirect:"follow"});if(!p.ok)throw p.status===404?new Error("Excel 文件不存在"):p.status===403?new Error("无权限访问此文件"):new Error(`文件加载失败 (${p.status})`);const g=await p.arrayBuffer();if(g.byteLength===0)throw new Error("文件为空");const m=new Cf.Workbook;await m.xlsx.load(g),n=Me.convertWorkbookToSpreadsheetData(m),d(),e.value=!1}catch(p){console.error("Excel 解析错误:",p);let g="Excel 文件解析失败";p instanceof Error&&(g=p.message),s.value=g,e.value=!1}}};return l.onMounted(()=>{if(!i.value)return;let p=!0;a=new ResizeObserver(()=>{if(p){p=!1,c=h();return}const g=h(),m=Math.abs(c.width-g.width),y=Math.abs(c.height-g.height);m<10&&y<10||(c=g,o!==null&&clearTimeout(o),o=window.setTimeout(()=>{n&&d()},500))}),a.observe(i.value),setTimeout(()=>{requestAnimationFrame(()=>f())},100)}),l.watch(()=>t.url,()=>{f()}),l.onBeforeUnmount(()=>{a&&a.disconnect(),o!==null&&clearTimeout(o),n=null,i.value&&(i.value.innerHTML="")}),(p,g)=>(l.openBlock(),l.createElementBlock("div",Um,[e.value?(l.openBlock(),l.createElementBlock("div",Gm,[...g[0]||(g[0]=[l.createElementVNode("div",{class:"vfp-text-center"},[l.createElementVNode("div",{class:"vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-mx-auto vfp-mb-3 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"}),l.createElementVNode("p",{class:"vfp-text-xs md:vfp-text-sm vfp-text-white/70 vfp-font-medium"},"加载 Excel 中...")],-1)])])):l.createCommentVNode("",!0),s.value&&!e.value?(l.openBlock(),l.createElementBlock("div",qm,[l.createElementVNode("div",Xm,[l.createElementVNode("div",Ym,[l.createVNode(l.unref(W.FileSpreadsheet),{class:"vfp-w-12 vfp-h-12 md:vfp-w-16 md:vfp-h-16 vfp-text-white"})]),g[1]||(g[1]=l.createElementVNode("p",{class:"vfp-text-lg md:vfp-text-xl vfp-text-white/90 vfp-mb-2 md:vfp-mb-3 vfp-font-medium"}," Excel 加载失败 ",-1)),l.createElementVNode("p",Km,l.toDisplayString(s.value),1),l.createElementVNode("a",{href:u.url,download:"",class:"vfp-inline-flex vfp-items-center vfp-gap-2 vfp-px-4 vfp-py-2 md:vfp-px-6 md:vfp-py-3 vfp-bg-gradient-to-r vfp-from-purple-500 vfp-to-pink-500 vfp-text-white vfp-text-sm md:vfp-text-base vfp-rounded-lg md:vfp-rounded-xl hover:vfp-scale-105 vfp-transition-all vfp-shadow-lg"}," 下载文件 ",8,Qm),g[2]||(g[2]=l.createElementVNode("p",{class:"vfp-text-xs vfp-text-white/40 vfp-mt-3 md:vfp-mt-4"},"提示:可以使用 Microsoft Excel 或 WPS 打开",-1))])])):l.createCommentVNode("",!0),s.value?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",{key:2,ref_key:"containerRef",ref:i,class:"xlsx-spreadsheet-container vfp-w-full vfp-h-full",style:l.normalizeStyle({opacity:e.value?0:1})},null,4))]))}}),Jm={class:"vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full"},tv={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},ev={key:1,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},sv={class:"vfp-text-center vfp-max-w-sm md:vfp-max-w-md vfp-px-4"},iv={class:"vfp-w-24 vfp-h-24 md:vfp-w-32 md:vfp-h-32 vfp-mx-auto vfp-mb-4 md:vfp-mb-6 vfp-rounded-2xl md:vfp-rounded-3xl vfp-bg-gradient-to-br vfp-from-orange-500 vfp-via-red-500 vfp-to-pink-500 vfp-flex vfp-items-center vfp-justify-center vfp-shadow-2xl"},nv={class:"vfp-text-xs md:vfp-text-sm vfp-text-white/60 vfp-mb-4 md:vfp-mb-6"},rv=["href"],av=l.defineComponent({__name:"PptxRenderer",props:{url:{},tiled:{type:Boolean,default:!0}},setup(u){const t=u,e=l.ref(!0),s=l.ref(null),i=l.ref(0),n=l.ref(null);let a=null,o=null,c=null,h=null,d={width:0,height:0};const f=()=>{var _;if(!n.value)return{width:960,height:540};const m=n.value.clientWidth,y=((_=n.value.parentElement)==null?void 0:_.clientWidth)||0,x=m>100?m:y>100?y:300,A=Math.floor(x*9/16);return{width:x,height:A}},p=async()=>{if(!(!n.value||!c||i.value===0))try{if(a)try{a.destroy()}catch{}n.value.innerHTML="";const m=f();a=rc.init(n.value,{width:m.width,height:t.tiled?m.height*i.value:m.height,mode:t.tiled?"list":"slide"}),await a.preview(c)}catch{}},g=async()=>{if(!n.value)return;e.value=!0,s.value=null;let m=window.setTimeout(()=>{s.value="加载超时,请检查网络或稍后重试",e.value=!1},3e4);try{const y=await fetch(t.url,{mode:"cors",credentials:"omit",redirect:"follow"});if(!y.ok)throw y.status===404?new Error("PPT 文件不存在"):y.status===403?new Error("无权限访问此文件"):y.status>=500?new Error("服务器错误,请稍后重试"):new Error(`文件加载失败 (${y.status})`);const x=await y.arrayBuffer();if(x.byteLength===0)throw new Error("文件为空");c=x;const A=document.createElement("div");A.style.cssText="position:absolute;left:-9999px;top:-9999px;visibility:hidden",document.body.appendChild(A);try{const _=rc.init(A,{width:100,height:100,mode:"slide"});try{await _.preview(x)}catch{throw new Error("PPT 文件格式错误或已损坏")}const E=_.slideCount;if(!E||E===0)throw new Error("PPT 文件无有效页面");_.destroy(),i.value=E,n.value&&(n.value.innerHTML="");const k=f();a=rc.init(n.value,{width:k.width,height:t.tiled?k.height*E:k.height,mode:t.tiled?"list":"slide"}),await a.preview(x),m!==null&&(clearTimeout(m),m=null),e.value=!1}finally{document.body.contains(A)&&document.body.removeChild(A)}}catch(y){m!==null&&clearTimeout(m);let x="PPT 文件解析失败";y instanceof Error?x=y.message:typeof y=="string"&&(x=y),s.value=x,e.value=!1}};return l.onMounted(()=>{if(!n.value)return;let m=!0;o=new ResizeObserver(()=>{if(m){m=!1,d=f();return}const y=f(),x=Math.abs(d.width-y.width),A=Math.abs(d.height-y.height);x<10&&A<10||(d=y,h!==null&&clearTimeout(h),h=window.setTimeout(()=>{a&&c&&p()},800))}),o.observe(n.value),setTimeout(()=>{requestAnimationFrame(()=>requestAnimationFrame(()=>g()))},150)}),l.watch(()=>t.url,()=>{g()}),l.onBeforeUnmount(()=>{if(o&&o.disconnect(),h!==null&&clearTimeout(h),c=null,i.value=0,a)try{a.destroy()}catch{}a=null}),(m,y)=>(l.openBlock(),l.createElementBlock("div",Jm,[e.value?(l.openBlock(),l.createElementBlock("div",tv,[...y[0]||(y[0]=[l.createElementVNode("div",{class:"vfp-text-center"},[l.createElementVNode("div",{class:"vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-mx-auto vfp-mb-3 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"}),l.createElementVNode("p",{class:"vfp-text-xs md:vfp-text-sm vfp-text-white/70 vfp-font-medium"},"加载 PPT 中...")],-1)])])):l.createCommentVNode("",!0),s.value&&!e.value?(l.openBlock(),l.createElementBlock("div",ev,[l.createElementVNode("div",sv,[l.createElementVNode("div",iv,[l.createVNode(l.unref(W.Presentation),{class:"vfp-w-12 vfp-h-12 md:vfp-w-16 md:vfp-h-16 vfp-text-white"})]),y[1]||(y[1]=l.createElementVNode("p",{class:"vfp-text-lg md:vfp-text-xl vfp-text-white/90 vfp-mb-2 md:vfp-mb-3 vfp-font-medium"}," PPT 加载失败 ",-1)),l.createElementVNode("p",nv,l.toDisplayString(s.value),1),l.createElementVNode("a",{href:u.url,download:"",class:"vfp-inline-flex vfp-items-center vfp-gap-2 vfp-px-4 vfp-py-2 md:vfp-px-6 md:vfp-py-3 vfp-bg-gradient-to-r vfp-from-purple-500 vfp-to-pink-500 vfp-text-white vfp-text-sm md:vfp-text-base vfp-rounded-lg md:vfp-rounded-xl hover:vfp-scale-105 vfp-transition-all vfp-shadow-lg"}," 下载文件 ",8,rv),y[2]||(y[2]=l.createElementVNode("p",{class:"vfp-text-xs vfp-text-white/40 vfp-mt-3 md:vfp-mt-4"}," 提示:可以使用 Microsoft PowerPoint 或 WPS 打开 ",-1))])])):l.createCommentVNode("",!0),s.value?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",{key:2,ref_key:"containerRef",ref:n,class:"pptx-wrapper vfp-w-full vfp-max-w-full md:vfp-max-w-6xl",style:l.normalizeStyle({opacity:e.value?0:1})},null,4))]))}}),ov={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},lv={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},cv={class:"vfp-text-white/70 vfp-text-center"},hv={class:"vfp-text-lg"},dv={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto",style:{background:"rgba(0, 0, 0, 0.15)"}},uv={class:"msg-container"},fv={class:"msg-header"},pv={class:"msg-subject"},gv={class:"msg-meta"},mv={key:0,class:"msg-row"},vv={class:"msg-icon-wrap"},bv={class:"msg-row-content"},yv={class:"msg-value"},wv={key:1,class:"msg-row"},Av={class:"msg-icon-wrap"},_v={class:"msg-row-content"},xv={class:"msg-value"},Ev={key:2,class:"msg-row"},kv={class:"msg-icon-wrap"},Sv={class:"msg-row-content"},Cv={class:"msg-value"},Tv={key:3,class:"msg-row"},Mv={class:"msg-icon-wrap"},Rv={class:"msg-row-content"},Pv={class:"msg-value"},Lv={key:4,class:"msg-row"},Nv={class:"msg-icon-wrap"},Iv={class:"msg-row-content"},Fv={class:"msg-value"},Dv={key:5,class:"msg-row"},Ov={class:"msg-icon-wrap"},Bv={class:"msg-row-content"},Vv={class:"msg-value"},Hv={key:6,class:"msg-row"},$v={class:"msg-icon-wrap"},zv={class:"msg-row-content"},jv={class:"msg-value"},Wv={key:7,class:"msg-row"},Uv={class:"msg-icon-wrap"},Gv={class:"msg-row-content"},qv={key:8,class:"msg-row"},Xv={class:"msg-icon-wrap"},Yv={class:"msg-row-content"},Kv={class:"msg-value"},Qv={key:9,class:"msg-row"},Zv={class:"msg-icon-wrap"},Jv={class:"msg-row-content"},tb={class:"msg-value"},eb={key:10,class:"msg-row msg-row-bordered"},sb={class:"msg-icon-wrap"},ib={class:"msg-row-content"},nb={class:"msg-value msg-attachments"},rb={key:0,class:"msg-attachment-size"},ab={class:"msg-icon-wrap"},ob={class:"msg-row-content"},lb={class:"msg-value msg-id"},cb={key:12,class:"msg-row"},hb={class:"msg-icon-wrap"},db={class:"msg-row-content"},ub={class:"msg-value msg-id"},fb=["innerHTML"],pb=l.defineComponent({__name:"MsgRenderer",props:{url:{}},setup(u){const t=u,e=l.ref(!0),s=l.ref(null),i=l.ref(null);function n(S,R){return S?S.filter(F=>F.recipType===R).map(F=>{const V=F.name||"",$=F.smtpAddress||F.email||"";return V&&$&&V!==$?`${V} <${$}>`:V||$}).filter(Boolean).join("; "):""}function a(S){if(!S)return"";try{const R=new Date(S);return isNaN(R.getTime())?S:R.toLocaleString()}catch{return S}}function o(S){if(S.bodyHtml)return S.bodyHtml;if(S.html)try{return new TextDecoder("utf-8").decode(S.html)}catch{}return S.body?`<pre style="white-space: pre-wrap; word-wrap: break-word; font-family: system-ui, sans-serif;">${S.body.replace(/&/g,"&amp;").replace(/\x3c/g,"&lt;").replace(/>/g,"&gt;")}</pre>`:'<p style="color: #999;">(无邮件正文)</p>'}function c(S){return S?{"IPM.Note":"Email","IPM.Note.SMIME":"Encrypted Email","IPM.Note.SMIME.MultipartSigned":"Signed Email","IPM.Appointment":"Appointment","IPM.Schedule.Meeting.Request":"Meeting Request","IPM.Schedule.Meeting.Canceled":"Meeting Cancellation","IPM.Contact":"Contact","IPM.Task":"Task","IPM.StickyNote":"Sticky Note"}[S]||S:""}const h=async()=>{e.value=!0,s.value=null,i.value=null;try{const S=await fetch(t.url);if(!S.ok)throw new Error("文件加载失败");const R=await S.arrayBuffer(),F=new Mf(R);i.value=F.getFileData()}catch(S){console.error("MSG 解析错误:",S),s.value="Outlook 邮件解析失败"}finally{e.value=!1}};l.watch(()=>t.url,h,{immediate:!0});const d=l.computed(()=>{var S;return((S=i.value)==null?void 0:S.subject)||"(无主题)"}),f=l.computed(()=>{if(!i.value)return"";const S=i.value.senderName||"",R=i.value.senderSmtpAddress||i.value.senderEmail||"";return S&&R&&S!==R?`${S} <${R}>`:S||R}),p=l.computed(()=>{var S;return n((S=i.value)==null?void 0:S.recipients,"to")}),g=l.computed(()=>{var S;return n((S=i.value)==null?void 0:S.recipients,"cc")}),m=l.computed(()=>{var S;return n((S=i.value)==null?void 0:S.recipients,"bcc")}),y=l.computed(()=>{var S;return a((S=i.value)==null?void 0:S.clientSubmitTime)}),x=l.computed(()=>{var S;return a((S=i.value)==null?void 0:S.messageDeliveryTime)}),A=l.computed(()=>{var S;return a((S=i.value)==null?void 0:S.creationTime)}),_=l.computed(()=>{var S;return a((S=i.value)==null?void 0:S.lastModificationTime)}),E=l.computed(()=>{var S;return(((S=i.value)==null?void 0:S.attachments)||[]).filter(R=>!R.attachmentHidden)}),k=l.computed(()=>i.value?o(i.value):""),C=l.computed(()=>{var S;return c((S=i.value)==null?void 0:S.messageClass)}),T=l.computed(()=>{var S;return((S=i.value)==null?void 0:S.messageId)||""}),M=l.computed(()=>{const S=i.value;return S&&typeof S.importance=="number"?S.importance:void 0}),P=l.computed(()=>M.value===2?"High":M.value===0?"Low":""),N=l.computed(()=>{const S=i.value;return S&&typeof S.sensitivity=="number"?S.sensitivity:void 0}),H=l.computed(()=>N.value===void 0||N.value===0?"":{1:"Personal",2:"Private",3:"Confidential"}[N.value]||""),L=S=>S?S>1048576?`${(S/1048576).toFixed(1)} MB`:S>1024?`${(S/1024).toFixed(0)} KB`:`${S} B`:"";return(S,R)=>e.value?(l.openBlock(),l.createElementBlock("div",ov,[...R[0]||(R[0]=[l.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):s.value||!i.value?(l.openBlock(),l.createElementBlock("div",lv,[l.createElementVNode("div",cv,[l.createElementVNode("p",hv,l.toDisplayString(s.value||"邮件解析失败"),1)])])):(l.openBlock(),l.createElementBlock("div",dv,[l.createElementVNode("div",uv,[l.createElementVNode("div",fv,[l.createElementVNode("h2",pv,l.toDisplayString(d.value),1),l.createElementVNode("div",gv,[f.value?(l.openBlock(),l.createElementBlock("div",mv,[l.createElementVNode("span",vv,[l.createVNode(l.unref(W.User),{size:16,class:"msg-icon"})]),l.createElementVNode("div",bv,[R[1]||(R[1]=l.createElementVNode("span",{class:"msg-label"},"From",-1)),l.createElementVNode("span",yv,l.toDisplayString(f.value),1)])])):l.createCommentVNode("",!0),p.value?(l.openBlock(),l.createElementBlock("div",wv,[l.createElementVNode("span",Av,[l.createVNode(l.unref(W.Users),{size:16,class:"msg-icon"})]),l.createElementVNode("div",_v,[R[2]||(R[2]=l.createElementVNode("span",{class:"msg-label"},"To",-1)),l.createElementVNode("span",xv,l.toDisplayString(p.value),1)])])):l.createCommentVNode("",!0),g.value?(l.openBlock(),l.createElementBlock("div",Ev,[l.createElementVNode("span",kv,[l.createVNode(l.unref(W.Users),{size:16,class:"msg-icon"})]),l.createElementVNode("div",Sv,[R[3]||(R[3]=l.createElementVNode("span",{class:"msg-label"},"Cc",-1)),l.createElementVNode("span",Cv,l.toDisplayString(g.value),1)])])):l.createCommentVNode("",!0),m.value?(l.openBlock(),l.createElementBlock("div",Tv,[l.createElementVNode("span",Mv,[l.createVNode(l.unref(W.Users),{size:16,class:"msg-icon"})]),l.createElementVNode("div",Rv,[R[4]||(R[4]=l.createElementVNode("span",{class:"msg-label"},"Bcc",-1)),l.createElementVNode("span",Pv,l.toDisplayString(m.value),1)])])):l.createCommentVNode("",!0),y.value?(l.openBlock(),l.createElementBlock("div",Lv,[l.createElementVNode("span",Nv,[l.createVNode(l.unref(W.Calendar),{size:16,class:"msg-icon"})]),l.createElementVNode("div",Iv,[R[5]||(R[5]=l.createElementVNode("span",{class:"msg-label"},"Sent",-1)),l.createElementVNode("span",Fv,l.toDisplayString(y.value),1)])])):l.createCommentVNode("",!0),x.value&&x.value!==y.value?(l.openBlock(),l.createElementBlock("div",Dv,[l.createElementVNode("span",Ov,[l.createVNode(l.unref(W.Clock),{size:16,class:"msg-icon"})]),l.createElementVNode("div",Bv,[R[6]||(R[6]=l.createElementVNode("span",{class:"msg-label"},"Received",-1)),l.createElementVNode("span",Vv,l.toDisplayString(x.value),1)])])):l.createCommentVNode("",!0),!y.value&&!x.value&&A.value?(l.openBlock(),l.createElementBlock("div",Hv,[l.createElementVNode("span",$v,[l.createVNode(l.unref(W.Calendar),{size:16,class:"msg-icon"})]),l.createElementVNode("div",zv,[R[7]||(R[7]=l.createElementVNode("span",{class:"msg-label"},"Date",-1)),l.createElementVNode("span",jv,l.toDisplayString(A.value),1)])])):l.createCommentVNode("",!0),P.value?(l.openBlock(),l.createElementBlock("div",Wv,[l.createElementVNode("span",Uv,[l.createVNode(l.unref(W.Tag),{size:16,class:"msg-icon"})]),l.createElementVNode("div",Gv,[R[8]||(R[8]=l.createElementVNode("span",{class:"msg-label"},"Importance",-1)),l.createElementVNode("span",{class:"msg-value",style:l.normalizeStyle({color:M.value===2?"#dc2626":"#2563eb",fontWeight:500})},l.toDisplayString(P.value),5)])])):l.createCommentVNode("",!0),H.value?(l.openBlock(),l.createElementBlock("div",qv,[l.createElementVNode("span",Xv,[l.createVNode(l.unref(W.Tag),{size:16,class:"msg-icon"})]),l.createElementVNode("div",Yv,[R[9]||(R[9]=l.createElementVNode("span",{class:"msg-label"},"Sensitivity",-1)),l.createElementVNode("span",Kv,l.toDisplayString(H.value),1)])])):l.createCommentVNode("",!0),C.value&&C.value!=="Email"?(l.openBlock(),l.createElementBlock("div",Qv,[l.createElementVNode("span",Zv,[l.createVNode(l.unref(W.Mail),{size:16,class:"msg-icon"})]),l.createElementVNode("div",Jv,[R[10]||(R[10]=l.createElementVNode("span",{class:"msg-label"},"Type",-1)),l.createElementVNode("span",tb,l.toDisplayString(C.value),1)])])):l.createCommentVNode("",!0),E.value.length>0?(l.openBlock(),l.createElementBlock("div",eb,[l.createElementVNode("span",sb,[l.createVNode(l.unref(W.Paperclip),{size:16,class:"msg-icon"})]),l.createElementVNode("div",ib,[R[11]||(R[11]=l.createElementVNode("span",{class:"msg-label"},"Attachments",-1)),l.createElementVNode("div",nb,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(E.value,(F,V)=>(l.openBlock(),l.createElementBlock("span",{key:V,class:"msg-attachment"},[l.createTextVNode(l.toDisplayString(F.fileName||F.name||"未知文件")+" ",1),L(F.contentLength)?(l.openBlock(),l.createElementBlock("span",rb," ("+l.toDisplayString(L(F.contentLength))+") ",1)):l.createCommentVNode("",!0)]))),128))])])])):l.createCommentVNode("",!0),T.value?(l.openBlock(),l.createElementBlock("div",{key:11,class:l.normalizeClass(["msg-row",{"msg-row-bordered":E.value.length===0}])},[l.createElementVNode("span",ab,[l.createVNode(l.unref(W.Hash),{size:16,class:"msg-icon"})]),l.createElementVNode("div",ob,[R[12]||(R[12]=l.createElementVNode("span",{class:"msg-label"},"Message-ID",-1)),l.createElementVNode("span",lb,l.toDisplayString(T.value),1)])],2)):l.createCommentVNode("",!0),_.value&&_.value!==y.value&&_.value!==x.value?(l.openBlock(),l.createElementBlock("div",cb,[l.createElementVNode("span",hb,[l.createVNode(l.unref(W.Clock),{size:16,class:"msg-icon"})]),l.createElementVNode("div",db,[R[13]||(R[13]=l.createElementVNode("span",{class:"msg-label"},"Modified",-1)),l.createElementVNode("span",ub,l.toDisplayString(_.value),1)])])):l.createCommentVNode("",!0)])]),l.createElementVNode("div",{class:"msg-body",innerHTML:k.value},null,8,fb)])]))}}),ic=(u,t)=>{const e=u.__vccOpts||u;for(const[s,i]of t)e[s]=i;return e},gb=ic(pb,[["__scopeId","data-v-e8e56b21"]]),mb={class:"vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-center vfp-overflow-hidden",style:{background:"#f5f5f0"}},vb={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-text-white/70 vfp-text-center"},bb={class:"vfp-text-lg"},yb={key:1,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-z-10"},wb={class:"vfp-flex vfp-items-center vfp-justify-between vfp-flex-shrink-0",style:{padding:"12px 16px","border-bottom":"1px solid rgba(255,255,255,0.1)"}},Ab={class:"vfp-flex-1 vfp-overflow-y-auto",style:{padding:"8px 4px"}},_b=["title","onClick","onMouseenter","onMouseleave"],xb=["title","onClick","onMouseenter","onMouseleave"],Eb=794,kb=l.defineComponent({__name:"EpubRenderer",props:{url:{}},emits:["chapterChange","fullWidthChange"],setup(u,{expose:t,emit:e}){const s=u,i=e,n=l.ref(null),a=l.ref(!0),o=l.ref(null),c=l.ref(!1),h=l.ref([]),d=l.ref(!1),f=l.ref("");let p=null,g=null,m=0,y=null;const x=()=>{var S;try{(S=g==null?void 0:g.destroy)==null||S.call(g)}catch{}try{p==null||p.destroy()}catch{}g=null,p=null,m=0,y=null},A=()=>{g==null||g.prev()},_=()=>{g==null||g.next()},E=()=>{c.value=!c.value,i("fullWidthChange",c.value),setTimeout(()=>{n.value&&g&&(g.resize(n.value.offsetWidth,n.value.offsetHeight),y&&g.display(y),L())},350)},k=()=>{d.value=!d.value},C=S=>{f.value=S,g==null||g.display(S),d.value=!1},T=S=>S===f.value;t({prevChapter:A,nextChapter:_,toggleFullWidth:E,toggleToc:k});const M=async()=>{if(n.value){a.value=!0,o.value=null,h.value=[],d.value=!1,n.value.innerHTML="",x();try{let S=s.url;s.url.startsWith("blob:")&&(S=await(await fetch(s.url)).arrayBuffer()),p=Rf(S),g=p.renderTo(n.value,{manager:"continuous",flow:"scrolled",width:"100%",height:"100%"}),g.themes.register("default",{body:{background:"#ffffff !important",color:"#1a1a1a !important","font-family":'"Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif !important',"font-size":"16px !important","line-height":"2 !important",padding:"40px 60px !important","max-width":"100% !important","box-sizing":"border-box !important","word-break":"break-word !important","overflow-wrap":"break-word !important"},p:{"text-indent":"2em !important",margin:"0.8em 0 !important"},h1:{"text-align":"center !important",margin:"1.5em 0 1em !important"},h2:{margin:"1.2em 0 0.8em !important"},h3:{margin:"1em 0 0.6em !important"},img:{"max-width":"100% !important",height:"auto !important"},a:{color:"#2563eb !important","text-decoration":"none !important"}}),g.themes.select("default"),await p.ready,p.locations.generate(1024).then(()=>{var $;if(!p)return;m=p.locations.length();const F=g==null?void 0:g.currentLocation(),V=(($=F==null?void 0:F.start)==null?void 0:$.location)??0;i("chapterChange",V+1,m)}).catch(()=>{});const R=await p.loaded.navigation;Array.isArray(R==null?void 0:R.toc)&&(h.value=R.toc),await g.display(),a.value=!1,i("chapterChange",1,m||1),g.on("relocated",F=>{var j,G,le;const V=F;if((j=V==null?void 0:V.start)!=null&&j.cfi&&(y=V.start.cfi),(G=V==null?void 0:V.start)!=null&&G.href){const bt=V.start.href,Ct=[],yt=pt=>{for(const me of pt){const nt=me.href.split("#")[0];nt&&(bt===nt||bt.endsWith("/"+nt)||bt.endsWith(nt))&&Ct.push(me.href),me.subitems&&yt(me.subitems)}};yt(h.value),Ct.length===1&&(f.value=Ct[0])}const $=(le=V==null?void 0:V.start)==null?void 0:le.location;typeof $=="number"&&m>0&&i("chapterChange",$+1,m)})}catch(S){console.error("EPUB 加载错误:",S),o.value="EPUB 文件加载失败",a.value=!1}}},P=()=>{!n.value||!g||g.resize(n.value.offsetWidth,n.value.offsetHeight)};let N=null;const H=()=>{var R;if(!N)return;const S=N;if(S.scrollTop+S.clientHeight>=S.scrollHeight-200)try{const F=g==null?void 0:g.manager;(R=F==null?void 0:F.check)==null||R.call(F,500,500)}catch{}},L=()=>{N&&(N.removeEventListener("scroll",H),N=null);const S=()=>{var R;N=((R=n.value)==null?void 0:R.querySelector(".epub-container"))??null,N?N.addEventListener("scroll",H,{passive:!0}):requestAnimationFrame(S)};requestAnimationFrame(S)};return l.onMounted(()=>{M(),window.addEventListener("resize",P),L()}),l.watch(()=>s.url,()=>M()),l.onBeforeUnmount(()=>{window.removeEventListener("resize",P),N==null||N.removeEventListener("scroll",H),x()}),(S,R)=>(l.openBlock(),l.createElementBlock("div",mb,[o.value?(l.openBlock(),l.createElementBlock("div",vb,[l.createElementVNode("p",bb,l.toDisplayString(o.value),1)])):l.createCommentVNode("",!0),a.value&&!o.value?(l.openBlock(),l.createElementBlock("div",yb,[...R[2]||(R[2]=[l.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):l.createCommentVNode("",!0),h.value.length>0?(l.openBlock(),l.createElementBlock("div",{key:2,class:"vfp-absolute vfp-inset-0 vfp-z-20 vfp-flex",style:l.normalizeStyle({opacity:d.value?1:0,pointerEvents:d.value?"auto":"none",transition:"opacity 0.3s"})},[l.createElementVNode("div",{class:"vfp-w-72 vfp-h-full vfp-flex vfp-flex-col",style:l.normalizeStyle({maxWidth:"80%",background:"rgba(0,0,0,0.9)",backdropFilter:"blur(12px)",borderRight:"1px solid rgba(255,255,255,0.1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)",transform:d.value?"translateX(0)":"translateX(-100%)",transition:"transform 0.3s ease"})},[l.createElementVNode("div",wb,[R[3]||(R[3]=l.createElementVNode("span",{style:{color:"white","font-weight":"500","font-size":"14px"}},"目录",-1)),l.createElementVNode("button",{style:{color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer",padding:"4px"},onClick:R[0]||(R[0]=F=>d.value=!1)},[l.createVNode(l.unref(W.X),{style:{width:"16px",height:"16px"}})])]),l.createElementVNode("div",Ab,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(h.value,(F,V)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:`${F.href}-${V}`},[l.createElementVNode("button",{style:l.normalizeStyle({width:"100%",textAlign:"left",padding:"8px 12px",fontSize:"14px",color:T(F.href)?"white":"rgba(255,255,255,0.7)",fontWeight:T(F.href)?"500":"400",background:T(F.href)?"rgba(255,255,255,0.15)":"none",border:"none",cursor:"pointer",borderRadius:"4px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",transition:"all 0.15s"}),title:F.label,onClick:$=>C(F.href),onMouseenter:$=>!T(F.href)&&($.target.style.background="rgba(255,255,255,0.1)"),onMouseleave:$=>!T(F.href)&&($.target.style.background="none")},l.toDisplayString(F.label.trim()),45,_b),F.subitems&&F.subitems.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(F.subitems,($,j)=>(l.openBlock(),l.createElementBlock("button",{key:`${$.href}-${j}`,style:l.normalizeStyle({width:"100%",textAlign:"left",padding:"8px 12px 8px 28px",fontSize:"13px",color:T($.href)?"white":"rgba(255,255,255,0.6)",fontWeight:T($.href)?"500":"400",background:T($.href)?"rgba(255,255,255,0.15)":"none",border:"none",cursor:"pointer",borderRadius:"4px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",transition:"all 0.15s"}),title:$.label,onClick:G=>C($.href),onMouseenter:G=>!T($.href)&&(G.target.style.background="rgba(255,255,255,0.1)"),onMouseleave:G=>!T($.href)&&(G.target.style.background="none")},l.toDisplayString($.label.trim()),45,xb))),128)):l.createCommentVNode("",!0)],64))),128))])],4),l.createElementVNode("div",{class:"vfp-flex-1",style:l.normalizeStyle({background:d.value?"rgba(0,0,0,0.3)":"transparent",transition:"background 0.3s"}),onClick:R[1]||(R[1]=F=>d.value=!1)},null,4)],4)):l.createCommentVNode("",!0),o.value?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",{key:3,ref_key:"viewerRef",ref:n,class:"vfp-h-full vfp-bg-white",style:l.normalizeStyle({width:c.value?"100%":`${Eb}px`,maxWidth:"100%",transition:"width 0.3s ease",boxShadow:"0 1px 3px rgba(0,0,0,0.12)",overflow:"hidden"})},null,4))]))}}),Sb={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Cb={class:"vfp-text-center"},Tb={class:"vfp-text-sm vfp-text-white/60"},Mb={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Rb={class:"vfp-w-full vfp-h-full vfp-relative"},Pb={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/20 vfp-backdrop-blur-sm vfp-rounded-2xl vfp-z-10"},Lb=l.defineComponent({__name:"VideoRenderer",props:{url:{}},setup(u){const t=u,e=l.ref(null),s=l.ref(!0),i=l.ref(null);let n=null;const a=()=>{if(!i.value||n)return;const o=document.createElement("video-js");o.classList.add("vjs-big-play-centered","vjs-theme-apple"),i.value.appendChild(o);const c=Me.getVideoMimeType(t.url),h=c==="video/quicktime"?[{src:t.url,type:"video/quicktime"},{src:t.url,type:"video/mp4"}]:[{src:t.url,type:c}];n=Pf(o,{controls:!0,fill:!0,preload:"auto",controlBar:{children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","remainingTimeDisplay","fullscreenToggle"],volumePanel:{inline:!1}},html5:{vhs:{overrideNative:!0},nativeVideoTracks:!1,nativeAudioTracks:!1,nativeTextTracks:!1},sources:h});const d=n.el().querySelector("video");d&&(d.style.objectFit="contain"),n.on("loadeddata",()=>{s.value=!1}),n.on("error",()=>{const f=n==null?void 0:n.error();console.error("Video.js error:",f),e.value=`视频加载失败: ${(f==null?void 0:f.message)||"未知错误"}`,s.value=!1})};return l.onMounted(a),l.watch(()=>t.url,()=>{n&&!n.isDisposed()&&n.src({src:t.url,type:Me.getVideoMimeType(t.url)})}),l.onBeforeUnmount(()=>{n&&!n.isDisposed()&&(n.dispose(),n=null)}),(o,c)=>e.value?(l.openBlock(),l.createElementBlock("div",Sb,[l.createElementVNode("div",Cb,[c[0]||(c[0]=l.createElementVNode("div",{class:"vfp-w-16 vfp-h-16 vfp-mx-auto vfp-mb-4 vfp-rounded-full vfp-bg-red-500/10 vfp-flex vfp-items-center vfp-justify-center"},[l.createElementVNode("svg",{class:"vfp-w-8 vfp-h-8 vfp-text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})])],-1)),c[1]||(c[1]=l.createElementVNode("p",{class:"vfp-text-lg vfp-font-medium vfp-text-white/90 vfp-mb-2"},"视频加载失败",-1)),l.createElementVNode("p",Tb,l.toDisplayString(e.value),1)])])):(l.openBlock(),l.createElementBlock("div",Mb,[l.createElementVNode("div",Rb,[s.value?(l.openBlock(),l.createElementBlock("div",Pb,[...c[2]||(c[2]=[l.createElementVNode("div",{class:"vfp-text-center"},[l.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-mx-auto vfp-mb-3 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"}),l.createElementVNode("p",{class:"vfp-text-sm vfp-text-white/70 vfp-font-medium"},"加载视频中...")],-1)])])):l.createCommentVNode("",!0),l.createElementVNode("div",{ref_key:"videoContainerRef",ref:i,class:"vfp-overflow-hidden vfp-w-full vfp-h-full",style:{"box-shadow":"0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05)"}},null,512)])]))}});function Nb(u){const t=l.ref(null),e=l.ref(!1),s=l.ref(!0),i=l.ref(0),n=l.ref(0),a=l.ref(1),o=l.ref(!1),c=l.ref(!1),h=l.ref(null);let d=null;const f=()=>{const _=t.value;if(!_)return;s.value=!0,h.value=null;const E=()=>{isNaN(_.currentTime)||(i.value=_.currentTime)},k=()=>{!isNaN(_.duration)&&isFinite(_.duration)&&(n.value=_.duration)},C=()=>{s.value=!1,k()},T=()=>{s.value=!0},M=()=>{s.value=!1,e.value=!0},P=()=>{e.value=!0},N=()=>{e.value=!1},H=()=>{e.value=!1},L=()=>{h.value="音频加载失败",s.value=!1};_.addEventListener("timeupdate",E),_.addEventListener("loadedmetadata",k),_.addEventListener("durationchange",k),_.addEventListener("canplay",C),_.addEventListener("waiting",T),_.addEventListener("playing",M),_.addEventListener("play",P),_.addEventListener("pause",N),_.addEventListener("ended",H),_.addEventListener("error",L),_.readyState>=3?(s.value=!1,k()):_.readyState>=1&&k(),d=()=>{_.removeEventListener("timeupdate",E),_.removeEventListener("loadedmetadata",k),_.removeEventListener("durationchange",k),_.removeEventListener("canplay",C),_.removeEventListener("waiting",T),_.removeEventListener("playing",M),_.removeEventListener("play",P),_.removeEventListener("pause",N),_.removeEventListener("ended",H),_.removeEventListener("error",L)}};return l.watch(u,()=>{d==null||d(),d=null,requestAnimationFrame(()=>f())},{flush:"post"}),l.watch(t,_=>{_&&f()},{flush:"post"}),l.onUnmounted(()=>{d==null||d(),d=null}),{audioRef:t,isPlaying:e,isLoading:s,isLoop:c,currentTime:i,duration:n,volume:a,isMuted:o,error:h,togglePlay:()=>{const _=t.value;_&&(_.paused?_.play().catch(()=>{}):_.pause())},seek:_=>{const E=t.value;E&&(E.currentTime=_,i.value=_)},skip:_=>{const E=t.value;E&&(E.currentTime=Math.max(0,Math.min(E.currentTime+_,E.duration||1/0)))},setVolume:_=>{const E=t.value;if(!E)return;const k=Math.max(0,Math.min(1,_));E.volume=k,a.value=k,k>0&&(E.muted=!1,o.value=!1)},toggleMute:()=>{const _=t.value;_&&(_.muted=!_.muted,o.value=_.muted)},toggleLoop:()=>{const _=t.value;if(!_)return;const E=!_.loop;_.loop=E,c.value=E},formatTime:Me.formatTime}}const Ib={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Fb={class:"vfp-text-white/70 vfp-text-center"},Db={class:"vfp-text-lg"},Ob={key:1,class:"vfp-flex vfp-flex-col vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-p-4 md:vfp-p-8 vfp-gap-5 md:vfp-gap-8 vfp-select-none"},Bb={class:"vfp-relative",style:{width:"260px",height:"240px"}},Vb={class:"vfp-text-center vfp-max-w-sm md:vfp-max-w-md vfp-px-4"},Hb={class:"vfp-text-lg md:vfp-text-xl vfp-font-medium vfp-mb-1 vfp-truncate",style:{color:"#e0dff0"}},$b={class:"vfp-w-full vfp-max-w-sm md:vfp-max-w-md vfp-rounded-2xl vfp-p-4 md:vfp-p-6 vfp-border",style:{background:"rgba(255,255,255,0.04)",backdropFilter:"blur(16px)",borderColor:"rgba(129,140,248,0.12)"}},zb={class:"vfp-mb-5"},jb={class:"vfp-relative vfp-h-4 vfp-flex vfp-items-center"},Wb=["max","value","disabled"],Ub={class:"vfp-flex vfp-justify-between vfp-text-xs vfp-mt-2.5",style:{color:"rgba(129,140,248,0.5)"}},Gb={style:{"font-variant-numeric":"tabular-nums"}},qb={style:{"font-variant-numeric":"tabular-nums"}},Xb={class:"vfp-flex vfp-items-center vfp-justify-center vfp-gap-3"},Yb=["aria-label"],Kb=["aria-label"],Qb=["aria-label"],Zb={class:"vfp-flex vfp-flex-col vfp-items-center vfp-gap-2",style:{height:"100px"}},Jb={class:"vfp-relative vfp-flex vfp-items-center vfp-justify-center",style:{width:"24px",height:"80px"}},t0=["value"],e0={class:"vfp-text-[10px] vfp-tabular-nums",style:{color:"rgba(129,140,248,0.5)"}},s0=["src"],i0=l.defineComponent({__name:"AudioRenderer",props:{url:{},fileName:{}},setup(u){const t=u,e=l.toRef(t,"url"),{audioRef:s,isPlaying:i,isLoop:n,currentTime:a,duration:o,volume:c,isMuted:h,error:d,togglePlay:f,seek:p,skip:g,setVolume:m,toggleMute:y,toggleLoop:x,formatTime:A}=Nb(e),_=l.ref(!1);let E=null;const k=l.ref(null),C=l.computed(()=>o.value>0?a.value/o.value:0),T=l.computed(()=>h.value||c.value===0?W.VolumeX:c.value<.5?W.Volume1:W.Volume2),M=H=>{k.value&&!k.value.contains(H.target)&&(_.value=!1)};l.onMounted(()=>{document.addEventListener("mousedown",M)}),l.onBeforeUnmount(()=>{document.removeEventListener("mousedown",M),E!==null&&clearTimeout(E)});const P=()=>{E!==null&&clearTimeout(E),_.value=!0},N=()=>{E=window.setTimeout(()=>{_.value=!1},300)};return(H,L)=>l.unref(d)?(l.openBlock(),l.createElementBlock("div",Ib,[l.createElementVNode("div",Fb,[l.createElementVNode("p",Db,l.toDisplayString(l.unref(d)),1)])])):(l.openBlock(),l.createElementBlock("div",Ob,[l.createElementVNode("div",Bb,[l.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full",style:l.normalizeStyle({width:"220px",height:"220px",top:"18px",left:"8px",background:"radial-gradient(circle, rgba(129,140,248,0.12) 0%, transparent 70%)",opacity:l.unref(i)?.7:.2,transition:"opacity 0.5s"})},null,4),l.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full vfp-overflow-hidden",style:l.normalizeStyle({width:"200px",height:"200px",top:"28px",left:"18px",background:`
13
+ radial-gradient(circle at center, transparent 95%, rgba(30,30,30,0.8) 95.5%, #111 97%),
14
+ radial-gradient(circle at center, transparent 38%, rgba(50,50,50,0.5) 38.15%, transparent 38.4%),
15
+ radial-gradient(circle at center, transparent 45%, rgba(50,50,50,0.3) 45.15%, transparent 45.4%),
16
+ radial-gradient(circle at center, transparent 52%, rgba(50,50,50,0.5) 52.15%, transparent 52.4%),
17
+ radial-gradient(circle at center, transparent 59%, rgba(50,50,50,0.3) 59.15%, transparent 59.4%),
18
+ radial-gradient(circle at center, transparent 66%, rgba(50,50,50,0.5) 66.15%, transparent 66.4%),
19
+ radial-gradient(circle at center, transparent 73%, rgba(50,50,50,0.3) 73.15%, transparent 73.4%),
20
+ radial-gradient(circle at center, transparent 80%, rgba(50,50,50,0.4) 80.15%, transparent 80.4%),
21
+ radial-gradient(circle at center, transparent 87%, rgba(50,50,50,0.3) 87.15%, transparent 87.4%),
22
+ conic-gradient(from 0deg, #1c1c1c, #232323, #1a1a1a, #262626, #1c1c1c, #212121, #1a1a1a, #252525, #1c1c1c, #232323, #1a1a1a, #262626, #1c1c1c)
23
+ `,boxShadow:l.unref(i)?"0 0 36px rgba(129,140,248,0.1), 0 8px 32px rgba(0,0,0,0.4), inset 0 0 20px rgba(0,0,0,0.4)":"0 8px 32px rgba(0,0,0,0.4), inset 0 0 20px rgba(0,0,0,0.4)",animation:"vfp-vinyl-spin 8s linear infinite",animationPlayState:l.unref(i)?"running":"paused"})},[...L[7]||(L[7]=[l.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full",style:{width:"34%",height:"34%",top:"33%",left:"33%",background:"radial-gradient(circle at 40% 38%, #818cf8, #6366f1, #4f46e5, #4338ca)",boxShadow:"inset 0 1px 3px rgba(255,255,255,0.25), inset 0 -1px 3px rgba(0,0,0,0.3), 0 0 8px rgba(0,0,0,0.3)"}},[l.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full",style:{width:"14%",height:"14%",top:"43%",left:"43%",background:"radial-gradient(circle at 40% 40%, #333, #0d0d0d)",boxShadow:"inset 0 1px 3px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,0.5)"}})],-1)])],4),l.createElementVNode("div",{class:"vfp-absolute",style:l.normalizeStyle({top:"-6px",right:"2px",width:"100px",height:"120px",transformOrigin:"76px 16px",zIndex:5,transform:l.unref(i)?"rotate(16deg)":"rotate(0deg)",transition:"transform 0.8s cubic-bezier(0.4, 0, 0.2, 1)"})},[...L[8]||(L[8]=[l.createStaticVNode('<svg width="100" height="120" viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="76" cy="16" r="13" fill="rgba(0,0,0,0.3)"></circle><circle cx="76" cy="16" r="11" fill="url(#vfp-baseGrad)"></circle><circle cx="76" cy="16" r="6" fill="url(#vfp-baseInnerGrad)"></circle><circle cx="76" cy="16" r="2.5" fill="#222" stroke="#555" stroke-width="0.5"></circle><path d="M74 22 L56 88" stroke="url(#vfp-armGrad)" stroke-width="3.5" stroke-linecap="round"></path><rect x="50" y="86" width="12" height="7" rx="1.5" fill="url(#vfp-headGrad)"></rect><rect x="52.5" y="92" width="7" height="9" rx="1" fill="url(#vfp-cartridgeGrad)"></rect><line x1="56" y1="101" x2="56" y2="105" stroke="#bbb" stroke-width="1.2" stroke-linecap="round"></line><circle cx="56" cy="105.5" r="0.8" fill="#ddd"></circle><defs><radialGradient id="vfp-baseGrad" cx="40%" cy="35%"><stop offset="0%" stop-color="#555"></stop><stop offset="100%" stop-color="#1a1a1a"></stop></radialGradient><radialGradient id="vfp-baseInnerGrad" cx="40%" cy="35%"><stop offset="0%" stop-color="#666"></stop><stop offset="100%" stop-color="#333"></stop></radialGradient><linearGradient id="vfp-armGrad" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#555"></stop><stop offset="50%" stop-color="#444"></stop><stop offset="100%" stop-color="#333"></stop></linearGradient><linearGradient id="vfp-headGrad" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#555"></stop><stop offset="100%" stop-color="#333"></stop></linearGradient><linearGradient id="vfp-cartridgeGrad" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#444"></stop><stop offset="100%" stop-color="#222"></stop></linearGradient></defs></svg>',1)])],4)]),l.createElementVNode("div",Vb,[l.createElementVNode("div",Hb,l.toDisplayString(u.fileName),1),L[9]||(L[9]=l.createElementVNode("p",{class:"vfp-text-xs vfp-tracking-widest vfp-uppercase",style:{color:"rgba(129,140,248,0.5)"}},"Audio",-1))]),l.createElementVNode("div",$b,[l.createElementVNode("div",zb,[l.createElementVNode("div",jb,[L[10]||(L[10]=l.createElementVNode("div",{class:"vfp-absolute vfp-w-full vfp-h-[5px] vfp-rounded-full",style:{background:"rgba(255,255,255,0.08)"}},null,-1)),l.createElementVNode("div",{class:"vfp-absolute vfp-h-[5px] vfp-rounded-full vfp-pointer-events-none",style:l.normalizeStyle({width:`${C.value*100}%`,background:"linear-gradient(90deg, #6366f1, #818cf8)",boxShadow:l.unref(i)?"0 0 8px rgba(129,140,248,0.4)":"none",transition:"width 0.1s linear"})},null,4),l.createElementVNode("input",{type:"range",min:"0",max:l.unref(o)>0?l.unref(o):l.unref(a)||100,step:"any",value:l.unref(a),disabled:l.unref(o)<=0,"aria-label":"播放进度",class:"audio-slider vfp-absolute vfp-w-full",onInput:L[0]||(L[0]=S=>l.unref(p)(parseFloat(S.target.value)))},null,40,Wb)]),l.createElementVNode("div",Ub,[l.createElementVNode("span",Gb,l.toDisplayString(l.unref(A)(l.unref(a))),1),l.createElementVNode("span",qb,l.toDisplayString(l.unref(o)>0?l.unref(A)(l.unref(o)):"--:--"),1)])]),l.createElementVNode("div",Xb,[l.createElementVNode("button",{class:"vfp-w-9 vfp-h-9 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors",style:l.normalizeStyle({background:l.unref(n)?"rgba(129,140,248,0.15)":"rgba(255,255,255,0.06)",color:l.unref(n)?"#818cf8":"rgba(224,223,240,0.4)",border:0,cursor:"pointer"}),"aria-label":l.unref(n)?"关闭循环":"开启循环",onClick:L[1]||(L[1]=(...S)=>l.unref(x)&&l.unref(x)(...S))},[l.createVNode(l.unref(W.Repeat),{class:"vfp-w-4 vfp-h-4"})],12,Yb),l.createElementVNode("button",{class:"vfp-w-10 vfp-h-10 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors",style:{background:"rgba(255,255,255,0.06)",color:"rgba(224,223,240,0.7)",border:0,cursor:"pointer"},"aria-label":"后退10秒",onClick:L[2]||(L[2]=S=>l.unref(g)(-10))},[l.createVNode(l.unref(W.SkipBack),{class:"vfp-w-[18px] vfp-h-[18px]"})]),l.createElementVNode("button",{class:"vfp-w-14 vfp-h-14 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center",style:{background:"linear-gradient(135deg, #818cf8, #6366f1)",color:"#fff",boxShadow:"0 4px 20px rgba(99,102,241,0.35)",border:0,cursor:"pointer"},"aria-label":l.unref(i)?"暂停":"播放",onClick:L[3]||(L[3]=(...S)=>l.unref(f)&&l.unref(f)(...S))},[l.unref(i)?(l.openBlock(),l.createBlock(l.unref(W.Pause),{key:0,class:"vfp-w-6 vfp-h-6"})):(l.openBlock(),l.createBlock(l.unref(W.Play),{key:1,class:"vfp-w-6 vfp-h-6 vfp-ml-0.5"}))],8,Kb),l.createElementVNode("button",{class:"vfp-w-10 vfp-h-10 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors",style:{background:"rgba(255,255,255,0.06)",color:"rgba(224,223,240,0.7)",border:0,cursor:"pointer"},"aria-label":"前进10秒",onClick:L[4]||(L[4]=S=>l.unref(g)(10))},[l.createVNode(l.unref(W.SkipForward),{class:"vfp-w-[18px] vfp-h-[18px]"})]),l.createElementVNode("div",{ref_key:"volumeRef",ref:k,class:"vfp-relative",onMouseenter:P,onMouseleave:N},[l.createElementVNode("button",{class:"vfp-w-9 vfp-h-9 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors",style:l.normalizeStyle({background:_.value?"rgba(129,140,248,0.15)":"rgba(255,255,255,0.06)",color:"rgba(129,140,248,0.6)",border:0,cursor:"pointer"}),"aria-label":l.unref(h)?"取消静音":"静音",onClick:L[5]||(L[5]=(...S)=>l.unref(y)&&l.unref(y)(...S))},[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(T.value),{class:"vfp-w-4 vfp-h-4"}))],12,Qb),l.createVNode(l.Transition,{name:"vfp-fade"},{default:l.withCtx(()=>[_.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:"vfp-absolute vfp-bottom-full vfp-mb-2 vfp-rounded-xl vfp-p-3 vfp-border",style:{left:"50%",marginLeft:"-27px",background:"rgba(20,20,20,0.95)",backdropFilter:"blur(16px)",borderColor:"rgba(129,140,248,0.15)"},onMouseenter:P,onMouseleave:N},[l.createElementVNode("div",Zb,[l.createElementVNode("div",Jb,[L[11]||(L[11]=l.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full",style:{width:"3px",height:"100%",background:"rgba(255,255,255,0.1)"}},null,-1)),l.createElementVNode("div",{class:"vfp-absolute vfp-bottom-0 vfp-rounded-full vfp-pointer-events-none",style:l.normalizeStyle({width:"3px",height:`${(l.unref(h)?0:l.unref(c))*100}%`,background:"#818cf8",transition:"height 0.1s linear"})},null,4),l.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.01",value:l.unref(h)?0:l.unref(c),"aria-label":"音量",class:"volume-slider-vertical vfp-absolute",style:{width:"80px",height:"24px",transform:"rotate(-90deg)","transform-origin":"center center"},onInput:L[6]||(L[6]=S=>l.unref(m)(parseFloat(S.target.value)))},null,40,t0)]),l.createElementVNode("span",e0,l.toDisplayString(Math.round((l.unref(h)?0:l.unref(c))*100)),1)])],32)):l.createCommentVNode("",!0)]),_:1})],544)])]),l.createElementVNode("audio",{ref_key:"audioRef",ref:s,src:u.url,class:"vfp-hidden"},null,8,s0)]))}}),n0={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},r0={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},a0={class:"vfp-text-white/70 vfp-text-center"},o0={class:"vfp-text-lg"},l0={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto vfp-p-4 md:vfp-p-8"},c0={class:"vfp-max-w-full md:vfp-max-w-4xl vfp-mx-auto vfp-bg-white"},h0=["innerHTML"],d0=l.defineComponent({__name:"MarkdownRenderer",props:{url:{}},setup(u){const t=u,e=l.ref(""),s=l.ref(""),i=l.ref(!0),n=l.ref(null),a=l.ref(null),o=new Lf({html:!1,linkify:!0,typographer:!1,breaks:!1});o.renderer.rules.fence=(g,m)=>{const y=g[m],A=(y.info?y.info.trim():"")||"text",_=y.content,E=btoa(unescape(encodeURIComponent(_)));return`<div class="code-block-wrapper">
24
+ <div class="code-block-header">
25
+ <span>${A}</span>
26
+ <button class="code-copy-btn" type="button" data-code="${E}" title="复制">复制</button>
27
+ </div>
28
+ <pre data-shiki-pending="1" data-lang="${A}"><code>${o.utils.escapeHtml(_)}</code></pre>
29
+ </div>`};const c=o.renderer.rules.table_open||((g,m,y,x,A)=>A.renderToken(g,m,y));o.renderer.rules.table_open=(g,m,y,x,A)=>'<div class="table-wrapper">'+c(g,m,y,x,A);const h=o.renderer.rules.table_close||((g,m,y,x,A)=>A.renderToken(g,m,y));o.renderer.rules.table_close=(g,m,y,x,A)=>h(g,m,y,x,A)+"</div>";const d=async()=>{i.value=!0,n.value=null;try{const g=await fetch(t.url);if(!g.ok)throw new Error("加载失败");const m=await g.text();e.value=m,s.value=o.render(m)}catch(g){console.error(g),n.value="Markdown 文件加载失败"}finally{i.value=!1}},f=async()=>{if(!a.value)return;const g=a.value.querySelectorAll('pre[data-shiki-pending="1"]');for(const m of g){const y=m.getAttribute("data-lang")||"text",x=m.querySelector("code"),A=(x==null?void 0:x.textContent)||"";try{const _=await md.codeToHtml(A,{lang:y,theme:"github-light"});m.outerHTML=_}catch{m.removeAttribute("data-shiki-pending")}}},p=async g=>{const m=g.target.closest(".code-copy-btn");if(!m)return;g.preventDefault();const y=m.getAttribute("data-code")||"";try{const x=decodeURIComponent(escape(atob(y)));await navigator.clipboard.writeText(x);const A=m.textContent;m.textContent="已复制",setTimeout(()=>{m.textContent=A},2e3)}catch{}};return l.onMounted(()=>{document.addEventListener("click",p)}),l.onBeforeUnmount(()=>{document.removeEventListener("click",p)}),l.watch(()=>t.url,d,{immediate:!0}),l.watch(s,async()=>{s.value&&(await l.nextTick(),f())}),(g,m)=>i.value?(l.openBlock(),l.createElementBlock("div",n0,[...m[0]||(m[0]=[l.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):n.value?(l.openBlock(),l.createElementBlock("div",r0,[l.createElementVNode("div",a0,[l.createElementVNode("p",o0,l.toDisplayString(n.value),1)])])):(l.openBlock(),l.createElementBlock("div",l0,[l.createElementVNode("div",c0,[l.createElementVNode("div",{ref_key:"containerRef",ref:a,class:"markdown-body vfp-p-6 md:vfp-p-10",innerHTML:s.value},null,8,h0)])]))}}),u0=ic(d0,[["__scopeId","data-v-ee40d321"]]),f0={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},p0={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},g0={class:"vfp-text-white/70 vfp-text-center"},m0={class:"vfp-text-lg"},v0={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto vfp-p-4 md:vfp-p-8"},b0={class:"vfp-max-w-full md:vfp-max-w-6xl vfp-mx-auto vfp-bg-white/5 vfp-backdrop-blur-sm vfp-rounded-2xl vfp-border vfp-border-white/10 vfp-overflow-hidden"},y0={class:"vfp-flex vfp-items-center vfp-gap-2 md:vfp-gap-3 vfp-px-4 vfp-py-3 md:vfp-px-6 md:vfp-py-4 vfp-bg-white/5 vfp-border-b vfp-border-white/10"},w0={class:"vfp-text-white vfp-font-medium vfp-text-sm md:vfp-text-base vfp-truncate"},A0={class:"vfp-ml-auto vfp-text-xs vfp-text-white/50 vfp-uppercase vfp-flex-shrink-0"},_0={class:"vfp-text-sm"},x0={key:0,class:"vfp-p-6 vfp-text-white/90 vfp-font-mono vfp-whitespace-pre-wrap vfp-break-words"},E0=["innerHTML"],k0=l.defineComponent({__name:"TextRenderer",props:{url:{},fileName:{}},setup(u){const t=u,e=l.ref(""),s=l.ref(""),i=l.ref(!0),n=l.ref(null),a=l.computed(()=>Me.getLanguageFromFileName(t.fileName)),o=async()=>{i.value=!0,n.value=null;try{const c=await fetch(t.url);if(!c.ok)throw new Error("加载失败");const h=await c.text();if(e.value=h,a.value!=="text")try{s.value=await md.codeToHtml(h,{lang:a.value,theme:"dark-plus"})}catch{s.value=""}else s.value=""}catch(c){console.error(c),n.value="文本文件加载失败"}finally{i.value=!1}};return l.watch(()=>t.url,o,{immediate:!0}),(c,h)=>i.value?(l.openBlock(),l.createElementBlock("div",f0,[...h[0]||(h[0]=[l.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):n.value?(l.openBlock(),l.createElementBlock("div",p0,[l.createElementVNode("div",g0,[l.createElementVNode("p",m0,l.toDisplayString(n.value),1)])])):(l.openBlock(),l.createElementBlock("div",v0,[l.createElementVNode("div",b0,[l.createElementVNode("div",y0,[l.createVNode(l.unref(W.FileText),{class:"vfp-w-4 vfp-h-4 md:vfp-w-5 md:vfp-h-5 vfp-text-white/70 vfp-flex-shrink-0"}),l.createElementVNode("span",w0,l.toDisplayString(u.fileName),1),l.createElementVNode("span",A0,l.toDisplayString(a.value),1)]),l.createElementVNode("div",_0,[s.value?(l.openBlock(),l.createElementBlock("div",{key:1,class:"shiki-wrapper",innerHTML:s.value},null,8,E0)):(l.openBlock(),l.createElementBlock("pre",x0,l.toDisplayString(e.value),1))])])]))}}),S0=ic(k0,[["__scopeId","data-v-60cd7c2c"]]),C0={class:"vfp-flex vfp-flex-col vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-p-8 vfp-gap-6"},T0={class:"vfp-w-32 vfp-h-32 vfp-rounded-full vfp-bg-white/10 vfp-flex vfp-items-center vfp-justify-center"},M0={class:"vfp-text-white vfp-text-center"},R0={class:"vfp-text-xl vfp-font-medium vfp-mb-2"},P0={class:"vfp-text-white/70"},L0=l.defineComponent({__name:"UnsupportedRenderer",props:{fileName:{},fileType:{}},emits:["download"],setup(u,{emit:t}){const e=t;return(s,i)=>(l.openBlock(),l.createElementBlock("div",C0,[l.createElementVNode("div",T0,[l.createVNode(l.unref(W.FileQuestion),{class:"vfp-w-16 vfp-h-16 vfp-text-white/70"})]),l.createElementVNode("div",M0,[l.createElementVNode("p",R0,l.toDisplayString(u.fileName),1),l.createElementVNode("p",P0,"不支持预览此文件类型 ("+l.toDisplayString(u.fileType)+")",1)]),l.createElementVNode("button",{class:"vfp-flex vfp-items-center vfp-gap-2 vfp-px-6 vfp-py-3 vfp-bg-white/10 hover:vfp-bg-white/20 vfp-backdrop-blur-sm vfp-rounded-lg vfp-text-white vfp-font-medium vfp-transition-all",onClick:i[0]||(i[0]=n=>e("download"))},[l.createVNode(l.unref(W.Download),{class:"vfp-w-5 vfp-h-5"}),i[1]||(i[1]=l.createTextVNode(" 下载文件查看 ",-1))])]))}}),N0=["tabindex"],I0={class:"vfp-flex-shrink-0 vfp-z-10 vfp-bg-black/50 vfp-backdrop-blur-md vfp-border-b vfp-border-white/10",style:{"padding-top":"env(safe-area-inset-top, 0px)"}},F0={class:"vfp-flex vfp-items-center vfp-justify-between vfp-px-3 md:vfp-px-5 vfp-py-1.5 md:vfp-py-2.5"},D0={class:"vfp-flex vfp-items-center vfp-flex-1 vfp-min-w-0 vfp-mr-2 md:vfp-mr-3"},O0={class:"vfp-text-white/90 vfp-font-medium vfp-text-xs md:vfp-text-sm vfp-truncate"},B0={class:"vfp-text-white/40 vfp-text-xs vfp-ml-2 vfp-flex-shrink-0"},V0={class:"vfp-flex vfp-items-center vfp-gap-1 md:vfp-hidden vfp-flex-shrink-0"},H0={class:"vfp-hidden md:vfp-flex vfp-items-center vfp-gap-1 vfp-flex-shrink-0"},$0=["disabled"],z0={class:"vfp-text-white/60 vfp-text-xs vfp-min-w-[3rem] vfp-text-center vfp-font-medium vfp-tabular-nums"},j0=["disabled"],W0={class:"vfp-text-white/60 vfp-text-xs vfp-min-w-[4rem] vfp-text-center vfp-font-medium vfp-tabular-nums"},U0=["title"],G0={key:0,class:"vfp-flex vfp-items-center vfp-gap-1 vfp-px-3 vfp-pb-1.5 vfp-overflow-x-auto scrollbar-hide md:vfp-hidden"},q0=["disabled"],X0={class:"vfp-text-white/60 vfp-text-xs vfp-min-w-[3rem] vfp-text-center vfp-font-medium vfp-tabular-nums"},Y0=["disabled"],K0={class:"vfp-text-white/60 vfp-text-xs vfp-min-w-[4rem] vfp-text-center vfp-font-medium vfp-tabular-nums"},Q0=["title"],Z0=2e3,J0=l.defineComponent({__name:"FilePreviewContent",props:{files:{},currentIndex:{},customRenderers:{default:()=>[]},mode:{default:"modal"}},emits:["navigate","close"],setup(u,{emit:t}){const e=u,s=t,i=l.ref(1),n=l.ref(0),a=l.ref(1),o=l.ref(1),c=l.ref(0),h=l.ref(0),d=l.ref(0),f=l.ref(null),p=l.ref(null),g=l.ref(!0);let m=null;const y=()=>{g.value=!0,m!==null&&clearTimeout(m),m=window.setTimeout(()=>{g.value=!1},Z0)},x=()=>y(),A=l.computed(()=>Me.normalizeFiles(e.files)),_=l.computed(()=>A.value[e.currentIndex]),E=l.computed(()=>_.value&&e.customRenderers.find(nt=>nt.test(_.value))||null),k=l.computed(()=>!E.value||!_.value?null:E.value.render(_.value)),C=l.computed(()=>_.value?Me.getFileType(_.value):"unsupported");l.watch(()=>e.currentIndex,()=>{i.value=1,n.value=0,a.value=1,o.value=1,c.value=0,h.value=0,g.value=!0,m!==null&&clearTimeout(m)}),l.watch([C,c,h],()=>{if(C.value==="image"&&c.value>0&&h.value>0&&f.value){const nt=f.value.clientWidth,I=f.value.clientHeight,rt=nt/c.value,st=I/h.value,at=Math.min(rt,st);i.value=Math.max(.01,Math.min(10,at))}}),l.watch(()=>A.value.length,nt=>{nt>1&&y()},{immediate:!0});const T=nt=>{nt.key==="Escape"&&e.mode==="modal"?s("close"):nt.key==="ArrowLeft"&&e.currentIndex>0?s("navigate",e.currentIndex-1):nt.key==="ArrowRight"&&e.currentIndex<A.value.length-1&&s("navigate",e.currentIndex+1)};l.onMounted(()=>{e.mode==="modal"?window.addEventListener("keydown",T):p.value&&p.value.addEventListener("keydown",T)}),l.onBeforeUnmount(()=>{m!==null&&clearTimeout(m),e.mode==="modal"?window.removeEventListener("keydown",T):p.value&&p.value.removeEventListener("keydown",T)});const M=()=>{i.value=Math.min(i.value+.1,10)},P=()=>{i.value=Math.max(i.value-.1,.01)},N=()=>{n.value=n.value+90},H=()=>{n.value=n.value-90},L=()=>{if(f.value&&c.value>0&&h.value>0){const nt=f.value.clientWidth,I=f.value.clientHeight,rt=nt/c.value,st=I/h.value,at=Math.min(rt,st);i.value=Math.max(.01,Math.min(10,at))}else i.value=1;n.value=0,d.value++},S=()=>{i.value=1,n.value=0,d.value++},R=nt=>{i.value=nt},F=()=>{i.value=1,n.value=0,d.value++},V=()=>{if(!_.value)return;const nt=document.createElement("a");nt.href=_.value.url,nt.download=_.value.name,nt.click()},$=l.computed(()=>C.value==="image"||C.value==="pdf"),j=l.computed(()=>C.value==="image"),G=l.computed(()=>C.value==="epub"),le=l.computed(()=>e.mode==="modal"),bt=l.ref(null),Ct=l.ref(0),yt=l.ref(0),pt=l.ref(!1),me=(nt,I)=>{Ct.value=nt,yt.value=I};return(nt,I)=>{var rt;return l.openBlock(),l.createElementBlock("div",{ref_key:"rootRef",ref:p,tabindex:u.mode==="embed"?0:-1,class:"vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-flex-col vfp-overflow-hidden vfp-outline-none"},[l.createElementVNode("div",I0,[l.createElementVNode("div",F0,[l.createElementVNode("div",D0,[l.createElementVNode("h2",O0,l.toDisplayString((rt=_.value)==null?void 0:rt.name),1),l.createElementVNode("span",B0,l.toDisplayString(u.currentIndex+1)+"/"+l.toDisplayString(A.value.length),1)]),l.createElementVNode("div",V0,[l.createElementVNode("button",{class:"toolbar-btn",title:"下载",onClick:V},[l.createVNode(l.unref(W.Download),{class:"vfp-w-4 vfp-h-4"})]),le.value?(l.openBlock(),l.createElementBlock("button",{key:0,class:"toolbar-btn",title:"关闭",onClick:I[0]||(I[0]=st=>s("close"))},[l.createVNode(l.unref(W.X),{class:"vfp-w-4 vfp-h-4"})])):l.createCommentVNode("",!0)]),l.createElementVNode("div",H0,[$.value?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createElementVNode("button",{class:"toolbar-btn",disabled:i.value<=.01,title:"缩小",onClick:P},[l.createVNode(l.unref(W.ZoomOut),{class:"vfp-w-4 vfp-h-4"})],8,$0),l.createElementVNode("span",z0,l.toDisplayString(Math.round(i.value*100))+"% ",1),l.createElementVNode("button",{class:"toolbar-btn",disabled:i.value>=10,title:"放大",onClick:M},[l.createVNode(l.unref(W.ZoomIn),{class:"vfp-w-4 vfp-h-4"})],8,j0),I[22]||(I[22]=l.createElementVNode("div",{class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-1"},null,-1)),C.value==="image"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createElementVNode("button",{class:"toolbar-btn",title:"适应窗口",onClick:L},[l.createVNode(l.unref(W.Scan),{class:"vfp-w-4 vfp-h-4"})]),l.createElementVNode("button",{class:"toolbar-btn",title:"原始尺寸",onClick:S},[...I[20]||(I[20]=[l.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"vfp-w-4 vfp-h-4"},[l.createElementVNode("text",{x:"12",y:"17.5","text-anchor":"middle","font-size":"20","font-weight":"bold",fill:"currentColor",stroke:"none"}," 1:1 ")],-1)])]),I[21]||(I[21]=l.createElementVNode("div",{class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-1"},null,-1))],64)):l.createCommentVNode("",!0)],64)):l.createCommentVNode("",!0),j.value?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createElementVNode("button",{class:"toolbar-btn",title:"向左旋转",onClick:H},[l.createVNode(l.unref(W.RotateCcw),{class:"vfp-w-4 vfp-h-4"})]),l.createElementVNode("button",{class:"toolbar-btn",title:"向右旋转",onClick:N},[l.createVNode(l.unref(W.RotateCw),{class:"vfp-w-4 vfp-h-4"})]),I[23]||(I[23]=l.createElementVNode("div",{class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-1"},null,-1))],64)):l.createCommentVNode("",!0),$.value||j.value?(l.openBlock(),l.createElementBlock(l.Fragment,{key:2},[l.createElementVNode("button",{class:"toolbar-btn",title:"复原",onClick:F},[l.createVNode(l.unref(W.RefreshCw),{class:"vfp-w-4 vfp-h-4"})]),I[24]||(I[24]=l.createElementVNode("div",{class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-1"},null,-1))],64)):l.createCommentVNode("",!0),G.value?(l.openBlock(),l.createElementBlock(l.Fragment,{key:3},[l.createElementVNode("button",{class:"toolbar-btn",title:"目录",onClick:I[1]||(I[1]=st=>{var at;return(at=bt.value)==null?void 0:at.toggleToc()})},[l.createVNode(l.unref(W.List),{class:"vfp-w-4 vfp-h-4"})]),I[25]||(I[25]=l.createElementVNode("div",{class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-1"},null,-1)),l.createElementVNode("button",{class:"toolbar-btn",title:"上一章",onClick:I[2]||(I[2]=st=>{var at;return(at=bt.value)==null?void 0:at.prevChapter()})},[l.createVNode(l.unref(W.ChevronLeft),{class:"vfp-w-4 vfp-h-4"})]),l.createElementVNode("span",W0,l.toDisplayString(Ct.value)+" / "+l.toDisplayString(yt.value),1),l.createElementVNode("button",{class:"toolbar-btn",title:"下一章",onClick:I[3]||(I[3]=st=>{var at;return(at=bt.value)==null?void 0:at.nextChapter()})},[l.createVNode(l.unref(W.ChevronRight),{class:"vfp-w-4 vfp-h-4"})]),I[26]||(I[26]=l.createElementVNode("div",{class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-1"},null,-1)),l.createElementVNode("button",{class:"toolbar-btn",title:pt.value?"正常宽度":"全屏宽度",onClick:I[4]||(I[4]=st=>{var at;return(at=bt.value)==null?void 0:at.toggleFullWidth()})},[pt.value?(l.openBlock(),l.createBlock(l.unref(W.Minimize2),{key:0,class:"vfp-w-4 vfp-h-4"})):(l.openBlock(),l.createBlock(l.unref(W.Maximize2),{key:1,class:"vfp-w-4 vfp-h-4"}))],8,U0),I[27]||(I[27]=l.createElementVNode("div",{class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-1"},null,-1))],64)):l.createCommentVNode("",!0),l.createElementVNode("button",{class:"toolbar-btn",title:"下载",onClick:V},[l.createVNode(l.unref(W.Download),{class:"vfp-w-4 vfp-h-4"})]),le.value?(l.openBlock(),l.createElementBlock("button",{key:4,class:"toolbar-btn",title:"关闭",onClick:I[5]||(I[5]=st=>s("close"))},[l.createVNode(l.unref(W.X),{class:"vfp-w-4 vfp-h-4"})])):l.createCommentVNode("",!0)])]),$.value||j.value||G.value?(l.openBlock(),l.createElementBlock("div",G0,[$.value?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createElementVNode("button",{class:"toolbar-btn",disabled:i.value<=.01,title:"缩小",onClick:P},[l.createVNode(l.unref(W.ZoomOut),{class:"vfp-w-4 vfp-h-4"})],8,q0),l.createElementVNode("span",X0,l.toDisplayString(Math.round(i.value*100))+"% ",1),l.createElementVNode("button",{class:"toolbar-btn",disabled:i.value>=10,title:"放大",onClick:M},[l.createVNode(l.unref(W.ZoomIn),{class:"vfp-w-4 vfp-h-4"})],8,Y0),I[30]||(I[30]=l.createElementVNode("div",{class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-0.5"},null,-1)),C.value==="image"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createElementVNode("button",{class:"toolbar-btn",title:"适应窗口",onClick:L},[l.createVNode(l.unref(W.Scan),{class:"vfp-w-4 vfp-h-4"})]),l.createElementVNode("button",{class:"toolbar-btn",title:"原始尺寸",onClick:S},[...I[28]||(I[28]=[l.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"vfp-w-4 vfp-h-4"},[l.createElementVNode("text",{x:"12",y:"17.5","text-anchor":"middle","font-size":"20","font-weight":"bold",fill:"currentColor",stroke:"none"}," 1:1 ")],-1)])]),I[29]||(I[29]=l.createElementVNode("div",{class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-0.5"},null,-1))],64)):l.createCommentVNode("",!0)],64)):l.createCommentVNode("",!0),j.value?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createElementVNode("button",{class:"toolbar-btn",title:"向左旋转",onClick:H},[l.createVNode(l.unref(W.RotateCcw),{class:"vfp-w-4 vfp-h-4"})]),l.createElementVNode("button",{class:"toolbar-btn",title:"向右旋转",onClick:N},[l.createVNode(l.unref(W.RotateCw),{class:"vfp-w-4 vfp-h-4"})]),I[31]||(I[31]=l.createElementVNode("div",{class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-0.5"},null,-1))],64)):l.createCommentVNode("",!0),l.createElementVNode("button",{class:"toolbar-btn",title:"复原",onClick:F},[l.createVNode(l.unref(W.RefreshCw),{class:"vfp-w-4 vfp-h-4"})]),G.value?(l.openBlock(),l.createElementBlock(l.Fragment,{key:2},[I[32]||(I[32]=l.createElementVNode("div",{class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-0.5"},null,-1)),l.createElementVNode("button",{class:"toolbar-btn",title:"目录",onClick:I[6]||(I[6]=st=>{var at;return(at=bt.value)==null?void 0:at.toggleToc()})},[l.createVNode(l.unref(W.List),{class:"vfp-w-4 vfp-h-4"})]),l.createElementVNode("button",{class:"toolbar-btn",title:"上一章",onClick:I[7]||(I[7]=st=>{var at;return(at=bt.value)==null?void 0:at.prevChapter()})},[l.createVNode(l.unref(W.ChevronLeft),{class:"vfp-w-4 vfp-h-4"})]),l.createElementVNode("span",K0,l.toDisplayString(Ct.value)+" / "+l.toDisplayString(yt.value),1),l.createElementVNode("button",{class:"toolbar-btn",title:"下一章",onClick:I[8]||(I[8]=st=>{var at;return(at=bt.value)==null?void 0:at.nextChapter()})},[l.createVNode(l.unref(W.ChevronRight),{class:"vfp-w-4 vfp-h-4"})]),l.createElementVNode("button",{class:"toolbar-btn",title:pt.value?"正常宽度":"全屏宽度",onClick:I[9]||(I[9]=st=>{var at;return(at=bt.value)==null?void 0:at.toggleFullWidth()})},[pt.value?(l.openBlock(),l.createBlock(l.unref(W.Minimize2),{key:0,class:"vfp-w-4 vfp-h-4"})):(l.openBlock(),l.createBlock(l.unref(W.Maximize2),{key:1,class:"vfp-w-4 vfp-h-4"}))],8,Q0)],64)):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)]),l.createElementVNode("div",{ref_key:"contentRef",ref:f,class:"vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center vfp-overflow-auto",onMousemove:x},[_.value?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[k.value?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(k.value),{key:0,file:_.value},null,8,["file"])):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[C.value==="image"?(l.openBlock(),l.createBlock(Hf,{key:0,url:_.value.url,zoom:i.value,rotation:n.value,"reset-key":d.value,"file-size":_.value.size,onZoomChange:R,onNaturalWidthChange:I[10]||(I[10]=st=>c.value=st),onNaturalHeightChange:I[11]||(I[11]=st=>h.value=st)},null,8,["url","zoom","rotation","reset-key","file-size"])):C.value==="pdf"?(l.openBlock(),l.createBlock(Fm,{key:1,url:_.value.url,zoom:i.value,"current-page":a.value,onPageChange:I[12]||(I[12]=st=>a.value=st),onTotalPagesChange:I[13]||(I[13]=st=>o.value=st),onPageWidthChange:I[14]||(I[14]=st=>c.value=st)},null,8,["url","zoom","current-page"])):C.value==="docx"?(l.openBlock(),l.createBlock(Wm,{key:2,url:_.value.url},null,8,["url"])):C.value==="xlsx"?(l.openBlock(),l.createBlock(Zm,{key:3,url:_.value.url},null,8,["url"])):C.value==="pptx"?(l.openBlock(),l.createBlock(av,{key:4,url:_.value.url},null,8,["url"])):C.value==="msg"?(l.openBlock(),l.createBlock(gb,{key:5,url:_.value.url},null,8,["url"])):C.value==="epub"?(l.openBlock(),l.createBlock(kb,{key:6,ref_key:"epubRef",ref:bt,url:_.value.url,onChapterChange:me,onFullWidthChange:I[15]||(I[15]=st=>pt.value=st)},null,8,["url"])):C.value==="video"?(l.openBlock(),l.createBlock(Lb,{key:7,url:_.value.url},null,8,["url"])):C.value==="audio"?(l.openBlock(),l.createBlock(i0,{key:8,url:_.value.url,"file-name":_.value.name},null,8,["url","file-name"])):C.value==="markdown"?(l.openBlock(),l.createBlock(u0,{key:9,url:_.value.url},null,8,["url"])):C.value==="text"?(l.openBlock(),l.createBlock(S0,{key:10,url:_.value.url,"file-name":_.value.name},null,8,["url","file-name"])):(l.openBlock(),l.createBlock(L0,{key:11,"file-name":_.value.name,"file-type":_.value.type,onDownload:V},null,8,["file-name","file-type"]))],64))],64)):l.createCommentVNode("",!0)],544),A.value.length>1?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[u.currentIndex>0?(l.openBlock(),l.createElementBlock("button",{key:0,style:l.normalizeStyle({opacity:g.value?1:0,transform:g.value?"translateY(-50%)":"translateY(-50%) translateX(-20px)",pointerEvents:g.value?"auto":"none",transition:"opacity 0.2s, transform 0.2s"}),class:"vfp-absolute vfp-z-20 vfp-left-2 md:vfp-left-4 vfp-top-1/2 vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-rounded-full vfp-bg-black/40 vfp-backdrop-blur-xl vfp-border vfp-border-white/10 vfp-flex vfp-items-center vfp-justify-center vfp-text-white hover:vfp-bg-black/60 vfp-transition-colors vfp-shadow-2xl",onClick:I[16]||(I[16]=st=>s("navigate",u.currentIndex-1)),onMouseenter:I[17]||(I[17]=st=>g.value=!0)},[l.createVNode(l.unref(W.ChevronLeft),{class:"vfp-w-5 vfp-h-5 md:vfp-w-6 md:vfp-h-6"})],36)):l.createCommentVNode("",!0),u.currentIndex<A.value.length-1?(l.openBlock(),l.createElementBlock("button",{key:1,style:l.normalizeStyle({opacity:g.value?1:0,transform:g.value?"translateY(-50%)":"translateY(-50%) translateX(20px)",pointerEvents:g.value?"auto":"none",transition:"opacity 0.2s, transform 0.2s"}),class:"vfp-absolute vfp-z-20 vfp-right-2 md:vfp-right-4 vfp-top-1/2 vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-rounded-full vfp-bg-black/40 vfp-backdrop-blur-xl vfp-border vfp-border-white/10 vfp-flex vfp-items-center vfp-justify-center vfp-text-white hover:vfp-bg-black/60 vfp-transition-colors vfp-shadow-2xl",onClick:I[18]||(I[18]=st=>s("navigate",u.currentIndex+1)),onMouseenter:I[19]||(I[19]=st=>g.value=!0)},[l.createVNode(l.unref(W.ChevronRight),{class:"vfp-w-5 vfp-h-5 md:vfp-w-6 md:vfp-h-6"})],36)):l.createCommentVNode("",!0)],64)):l.createCommentVNode("",!0)],8,N0)}}}),zh=ic(J0,[["__scopeId","data-v-e007a11f"]]);function ty(u){let t="",e="",s=!1;const i=()=>{if(s||typeof document>"u")return;t=document.body.style.overflow,e=document.body.style.paddingRight;const a=window.innerWidth-document.documentElement.clientWidth;document.body.style.overflow="hidden",a>0&&(document.body.style.paddingRight=`${a}px`),s=!0},n=()=>{!s||typeof document>"u"||(document.body.style.overflow=t,document.body.style.paddingRight=e,s=!1)};return l.onMounted(()=>{u()&&i()}),l.onUnmounted(()=>{n()}),{lock:i,unlock:n}}const ey={key:0,class:"vfp-root"},sy=l.defineComponent({__name:"FilePreviewModal",props:{files:{},currentIndex:{},isOpen:{type:Boolean},customRenderers:{default:()=>[]}},emits:["close","navigate"],setup(u,{emit:t}){const e=u,s=t,{lock:i,unlock:n}=ty(()=>e.isOpen);l.watch(()=>e.isOpen,h=>{h?i():n()});const a=()=>s("close"),o=h=>h.stopPropagation(),c=h=>h.stopPropagation();return(h,d)=>(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.createVNode(l.Transition,{name:"vfp-fade"},{default:l.withCtx(()=>[u.isOpen?(l.openBlock(),l.createElementBlock("div",ey,[l.createElementVNode("div",{class:"vfp-fixed vfp-inset-0 vfp-z-[9999] vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/80 vfp-backdrop-blur-md vfp-overflow-hidden",onClick:a,onWheel:c},[l.createElementVNode("div",{class:"vfp-relative vfp-w-full vfp-h-full",onClick:o},[l.createVNode(zh,{mode:"modal",files:u.files,"current-index":u.currentIndex,"custom-renderers":u.customRenderers,onClose:d[0]||(d[0]=f=>s("close")),onNavigate:d[1]||(d[1]=f=>s("navigate",f))},null,8,["files","current-index","custom-renderers"])])],32)])):l.createCommentVNode("",!0)]),_:1})]))}}),iy={class:"vfp-relative vfp-w-full vfp-h-full vfp-overflow-hidden vfp-bg-black/80"},ny=l.defineComponent({__name:"FilePreviewEmbed",props:{files:{},currentIndex:{default:0},customRenderers:{default:()=>[]},width:{default:"100%"},height:{default:"100%"}},emits:["navigate"],setup(u,{emit:t}){const e=u,s=t,i={width:typeof e.width=="number"?`${e.width}px`:e.width,height:typeof e.height=="number"?`${e.height}px`:e.height};return(n,a)=>(l.openBlock(),l.createElementBlock("div",{class:"vfp-root",style:i},[l.createElementVNode("div",iy,[l.createVNode(zh,{mode:"embed",files:u.files,"current-index":u.currentIndex,"custom-renderers":u.customRenderers,onNavigate:a[0]||(a[0]=o=>s("navigate",o))},null,8,["files","current-index","custom-renderers"])])]))}}),ry=If.version;Object.defineProperty(exports,"configurePdfWorker",{enumerable:!0,get:()=>Me.configurePdfWorker});Object.defineProperty(exports,"getFileType",{enumerable:!0,get:()=>Me.getFileType});Object.defineProperty(exports,"normalizeFile",{enumerable:!0,get:()=>Me.normalizeFile});Object.defineProperty(exports,"normalizeFiles",{enumerable:!0,get:()=>Me.normalizeFiles});exports.FilePreviewContent=zh;exports.FilePreviewEmbed=ny;exports.FilePreviewModal=sy;exports.VERSION=ry;
30
+ //# sourceMappingURL=index.cjs.map