@openlist-frontend/openlist-frontend 4.0.9 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (514) hide show
  1. package/dist/VERSION +1 -1
  2. package/dist/assets/{2fa-2cc2atzU.js → 2fa-QoYFzgIF.js} +1 -1
  3. package/dist/assets/{2fa-legacy-Bv6NDiiZ.js → 2fa-legacy-DAkfvuaM.js} +1 -1
  4. package/dist/assets/About-B7Kvo1aB.js +1 -0
  5. package/dist/assets/{About-legacy-QsfCSVxq.js → About-legacy-DVj51Yvw.js} +1 -1
  6. package/dist/assets/AddOrEdit-BO6ufF5N.js +1 -0
  7. package/dist/assets/{AddOrEdit-B2PSnD-9.js → AddOrEdit-BnhxwceZ.js} +1 -1
  8. package/dist/assets/{AddOrEdit-DKPH7EZ_.js → AddOrEdit-DjfJsYrk.js} +1 -1
  9. package/dist/assets/{AddOrEdit-legacy-DxIDnAk7.js → AddOrEdit-legacy-Bg4C0OQU.js} +1 -1
  10. package/dist/assets/{AddOrEdit-legacy-COHYBFCt.js → AddOrEdit-legacy-CyctaWfp.js} +1 -1
  11. package/dist/assets/AddOrEdit-legacy-f8K0IUMl.js +1 -0
  12. package/dist/assets/Common-Dpk1gc-_.js +1 -0
  13. package/dist/assets/Common-legacy-BmK8ewzu.js +1 -0
  14. package/dist/assets/{Copy-CENvweJK.js → Copy-CqqotY0z.js} +1 -1
  15. package/dist/assets/{Copy-legacy-D_8otiMK.js → Copy-legacy-BruqHTeV.js} +1 -1
  16. package/dist/assets/Decompress-DLkWzQ3S.js +1 -0
  17. package/dist/assets/{Decompress-legacy-Dv_Jku2u.js → Decompress-legacy-DAB5qPVJ.js} +1 -1
  18. package/dist/assets/{DeletePopover-BFBUMopn.js → DeletePopover-CJe1R9Ss.js} +1 -1
  19. package/dist/assets/{DeletePopover-legacy-BEDnzn-m.js → DeletePopover-legacy-DXKXbGri.js} +1 -1
  20. package/dist/assets/{File-DOBK5V8m.js → File-Dfqdcr_u.js} +2 -2
  21. package/dist/assets/{File-legacy-D1ODACuv.js → File-legacy-CQVS1Vpk.js} +1 -1
  22. package/dist/assets/{Folder-CGWdNP6D.js → Folder-1H_XPHli.js} +3 -3
  23. package/dist/assets/{Folder-legacy-YsG9JF-C.js → Folder-legacy-DBPPt3z3.js} +2 -2
  24. package/dist/assets/FolderTree-legacy-BSV4stNN.js +1 -0
  25. package/dist/assets/FolderTree-tZ6zUZ7j.js +1 -0
  26. package/dist/assets/Grid-BrJTEWW6.js +1 -0
  27. package/dist/assets/Grid-legacy-CmmbMWtK.js +1 -0
  28. package/dist/assets/GridItem-IiSsrrRE.js +1 -0
  29. package/dist/assets/GridItem-legacy-Dd_rurIk.js +1 -0
  30. package/dist/assets/{ImageWithError-gG_AK8KG.js → ImageWithError-CSUD2e5_.js} +1 -1
  31. package/dist/assets/{ImageWithError-legacy-B07XhroH.js → ImageWithError-legacy-bpUxh_rg.js} +1 -1
  32. package/dist/assets/Images-legacy-Bloy8aMr.js +1 -0
  33. package/dist/assets/Images-ohOuh-tZ.js +1 -0
  34. package/dist/assets/Layout-CTXbLLrz.js +6 -0
  35. package/dist/assets/Layout-legacy-BEddNSfP.js +6 -0
  36. package/dist/assets/List-CioFfC3F.js +1 -0
  37. package/dist/assets/List-legacy-3BnwxKd9.js +1 -0
  38. package/dist/assets/{Messenger-Dmz66wIv.js → Messenger-BwX5Ot-u.js} +1 -1
  39. package/dist/assets/{Messenger-legacy-DEa2mtGl.js → Messenger-legacy-BdURBipq.js} +1 -1
  40. package/dist/assets/{Metas-BV8fZzUC.js → Metas-C-KooGDN.js} +1 -1
  41. package/dist/assets/{Metas-legacy-Dsed9U0b.js → Metas-legacy-DNSLvcPZ.js} +1 -1
  42. package/dist/assets/{Move-CjmsQ4oK.js → Move-BmKqqWgw.js} +1 -1
  43. package/dist/assets/{Move-legacy-BJYFMCwm.js → Move-legacy-r10bw0e-.js} +1 -1
  44. package/dist/assets/Other-DvpG5x28.js +1 -0
  45. package/dist/assets/Other-legacy-CpHIszvT.js +1 -0
  46. package/dist/assets/PackageDownload-B9EgcsaJ.js +1 -0
  47. package/dist/assets/{PackageDownload-legacy-DghWe59X.js → PackageDownload-legacy-DSGHgtWt.js} +1 -1
  48. package/dist/assets/{Paginator-CfTq8QGy.js → Paginator-DRB7Z41C.js} +1 -1
  49. package/dist/assets/{Paginator-legacy-BBwW9rLz.js → Paginator-legacy-DTdrq2lp.js} +1 -1
  50. package/dist/assets/{Password-_jCVU1BX.js → Password-B11wTWqR.js} +1 -1
  51. package/dist/assets/{Password-legacy-B7VWpO0t.js → Password-legacy-BGfOD_8_.js} +1 -1
  52. package/dist/assets/{Profile-DQqzso6r.js → Profile-C1cliTl8.js} +1 -1
  53. package/dist/assets/{Profile-legacy-DxHXHWHS.js → Profile-legacy-GCM5na_Q.js} +1 -1
  54. package/dist/assets/{PublicKeys-BUewmKb-.js → PublicKeys-Bx-4Shpz.js} +1 -1
  55. package/dist/assets/{PublicKeys-legacy-L19QKXEm.js → PublicKeys-legacy-Dq05MCbe.js} +1 -1
  56. package/dist/assets/{ResponsiveGrid-DBqpPiu2.js → ResponsiveGrid-BoOhAULT.js} +1 -1
  57. package/dist/assets/{ResponsiveGrid-legacy-io27eqXp.js → ResponsiveGrid-legacy-1sf4PYbB.js} +1 -1
  58. package/dist/assets/{S3-Ue8_AwRX.js → S3-Do-y1BLJ.js} +1 -1
  59. package/dist/assets/{S3-legacy-BEIExV0a.js → S3-legacy-DpBe-p2k.js} +1 -1
  60. package/dist/assets/{SettingItem-CoyA-wst.js → SettingItem-CG5PkkHH.js} +1 -1
  61. package/dist/assets/{SettingItem-legacy-FkrTuUbn.js → SettingItem-legacy-B4Pb_Xz0.js} +1 -1
  62. package/dist/assets/{Storages-B0zOmRwd.js → Storages-C_m4s20G.js} +1 -1
  63. package/dist/assets/{Storages-legacy-CBl6TdCy.js → Storages-legacy-DXs5dP9Y.js} +1 -1
  64. package/dist/assets/{Upload-y6lHsBbS.js → Upload-CKRnF4DO.js} +1 -1
  65. package/dist/assets/{Upload-9DDOLajr.js → Upload-aH9yNoOD.js} +1 -1
  66. package/dist/assets/{Upload-legacy-uISx3f64.js → Upload-legacy-CxFEzbZB.js} +1 -1
  67. package/dist/assets/{Upload-legacy-BX35PWMt.js → Upload-legacy-Duci8WH8.js} +1 -1
  68. package/dist/assets/Users-BnHY9262.js +1 -0
  69. package/dist/assets/Users-legacy-_OwnC7o5.js +1 -0
  70. package/dist/assets/{Wether-enRDnS5x.js → Wether-CG_Kg5-q.js} +1 -1
  71. package/dist/assets/{Wether-legacy-CUYxMAIK.js → Wether-legacy-Bdidv3LZ.js} +1 -1
  72. package/dist/assets/{aliyun_office-4kFcJSQ7.js → aliyun_office-B1HBHrPf.js} +1 -1
  73. package/dist/assets/{aliyun_office-legacy-CeoV_l42.js → aliyun_office-legacy-DTmek5GS.js} +1 -1
  74. package/dist/{lite/assets/aliyun_video-b2790a1e.js → assets/aliyun_video-U-pLeC7E.js} +1 -1
  75. package/dist/assets/aliyun_video-legacy-DTBjmE9W.js +1 -0
  76. package/dist/assets/archive-DOr7Dqax.js +1 -0
  77. package/dist/assets/archive-legacy-wJmPUETd.js +1 -0
  78. package/dist/{lite/assets/asciinema-03a03960.js → assets/asciinema-ZQcYEkAW.js} +1 -1
  79. package/dist/assets/asciinema-legacy-zxAySqsq.js +1 -0
  80. package/dist/assets/audio-CRzHxaoi.js +1 -0
  81. package/dist/assets/audio-legacy-Feenv18g.js +1 -0
  82. package/dist/assets/{backup-restore-C5uaukNL.js → backup-restore-DI3_7B-r.js} +1 -1
  83. package/dist/assets/{backup-restore-legacy-BNzSREad.js → backup-restore-legacy-Buh90yQQ.js} +1 -1
  84. package/dist/assets/{entry-CzYCw4_c.js → entry-B8RFtHi3.js} +1 -1
  85. package/dist/assets/{entry-8adOMWDV.js → entry-B98kaxtp.js} +1 -1
  86. package/dist/assets/{entry-legacy-BJi3IsKO.js → entry-legacy-ClQCsMpg.js} +1 -1
  87. package/dist/assets/{entry-legacy-CPgG9LS1.js → entry-legacy-CvWDK9vA.js} +1 -1
  88. package/dist/assets/flash-06hWdflD.js +1 -0
  89. package/dist/assets/flash-legacy-CEkIWCeS.js +1 -0
  90. package/dist/assets/heic-Dcuye9xt.js +1 -0
  91. package/dist/assets/heic-legacy-C297mKdd.js +1 -0
  92. package/dist/{lite/assets/helper-59016ddf.js → assets/helper-D_ZwLK_B.js} +1 -1
  93. package/dist/assets/{helper-CJdkogiC.js → helper-EtkfBFKy.js} +1 -1
  94. package/dist/assets/{helper-legacy-B4Xut8Z5.js → helper-legacy-BZAtBbx-.js} +1 -1
  95. package/dist/assets/helper-legacy-Crstiw7Q.js +1 -0
  96. package/dist/assets/{hls-CdGSrFYh.js → hls-Ct2iKFyb.js} +1 -1
  97. package/dist/assets/{hls-legacy-BR5PAXA5.js → hls-legacy-D8ZW6jtp.js} +1 -1
  98. package/dist/{lite/assets/html-a748c03a.js → assets/html-Der_HXVQ.js} +1 -1
  99. package/dist/assets/{html-legacy-DS9vIClh.js → html-legacy-qRV9zl9j.js} +1 -1
  100. package/dist/assets/{icon-CgK9sKtW.js → icon-Di-A6oGV.js} +1 -1
  101. package/dist/assets/{icon-legacy-jbuQXJrW.js → icon-legacy-RrRPpu72.js} +1 -1
  102. package/dist/assets/image-Dcp8UQSC.js +1 -0
  103. package/dist/assets/image-legacy-MktRWNPk.js +1 -0
  104. package/dist/{lite/assets/index-b8211a8c.js → assets/index-39alBTSo.js} +1 -1
  105. package/dist/assets/{index-BS5bVjs5.js → index-BQ3fKbcZ.js} +1 -1
  106. package/dist/assets/{index-CSwg5QXS.js → index-BeFrtC4h.js} +6 -6
  107. package/dist/assets/{index-DOY4u_GJ.js → index-DQgSmKvW.js} +1 -1
  108. package/dist/{lite/assets/index-dfffd899.js → assets/index-DnhdS7oh.js} +1 -1
  109. package/dist/assets/{index-DqW5xUnX.js → index-KrJvblBL.js} +1 -1
  110. package/dist/assets/{index-BJaZW_cl.js → index-U2hEgx40.js} +1 -1
  111. package/dist/assets/{index-BClBcNEu.js → index-ZTxfPVQc.js} +1 -1
  112. package/dist/assets/{index-DV8SB530.js → index-cDisVFxX.js} +1 -1
  113. package/dist/assets/{index-legacy-CDfFAMGs.js → index-legacy--GMgRmYe.js} +1 -1
  114. package/dist/assets/{index-legacy-CwvCVg8-.js → index-legacy-B1wMIUVA.js} +1 -1
  115. package/dist/assets/{index-legacy-nH7bmAdo.js → index-legacy-BDBjlhRR.js} +1 -1
  116. package/dist/assets/{index-legacy-zjwrrR91.js → index-legacy-BDOGUGER.js} +1 -1
  117. package/dist/assets/{index-legacy-Ctuk5AXi.js → index-legacy-BHlOEqoB.js} +1 -1
  118. package/dist/assets/{index-legacy-DkZZKHvO.js → index-legacy-BZ7kWilP.js} +1 -1
  119. package/dist/assets/{index-legacy-C5X1tU4Z.js → index-legacy-BsAqemlM.js} +1 -1
  120. package/dist/assets/index-legacy-C_fp4R35.js +1 -0
  121. package/dist/assets/{index-legacy-CtC7fn6O.js → index-legacy-CfXu3iPN.js} +4 -4
  122. package/dist/assets/index-legacy-CiO_xwp7.js +1 -0
  123. package/dist/assets/index-uMglY6aV.js +2 -0
  124. package/dist/assets/{indexes-Ba0IqlDk.js → indexes-DHzNsR3X.js} +1 -1
  125. package/dist/assets/{indexes-legacy-DOV4Irpp.js → indexes-legacy-CYDIc_-J.js} +1 -1
  126. package/dist/assets/ipa-Bvq4GufD.js +1 -0
  127. package/dist/assets/ipa-legacy-CXj6nWH_.js +1 -0
  128. package/dist/assets/markdown-BTG5QgAB.js +1 -0
  129. package/dist/assets/markdown-legacy-B4FJ2KYb.js +1 -0
  130. package/dist/assets/markdown_with_word_wrap-legacy-BfAsPsKl.js +1 -0
  131. package/dist/assets/markdown_with_word_wrap-sqgjsEFq.js +1 -0
  132. package/dist/assets/offline_download-DSXlv_fS.js +1 -0
  133. package/dist/assets/{offline_download-legacy-TAKRiM_z.js → offline_download-legacy-IVHhY0Fl.js} +1 -1
  134. package/dist/assets/pdf-hzVb4Kgy.js +1 -0
  135. package/dist/assets/pdf-legacy-WbGyXlrg.js +45 -0
  136. package/dist/assets/{pdf.worker.min--PgD6g2g.mjs → pdf.worker.min-DbR_HJhJ.js} +4 -4
  137. package/dist/assets/plist-2Y50jjt-.js +1 -0
  138. package/dist/assets/plist-legacy-B8d_27Yt.js +1 -0
  139. package/dist/assets/{style-QIM1DiTv.js → style-Mplh4sB8.js} +1 -1
  140. package/dist/assets/{style-legacy-DqRFDAwL.js → style-legacy-Cxcb54Ge.js} +1 -1
  141. package/dist/assets/text-editor-DGAoQNZR.js +1 -0
  142. package/dist/assets/text-editor-legacy-B2-OWm_i.js +1 -0
  143. package/dist/assets/{url-BdlNs2qR.js → url-95TlThfV.js} +1 -1
  144. package/dist/assets/{url-legacy-BObEvUIa.js → url-legacy-BhY0uecs.js} +1 -1
  145. package/dist/assets/{useTitle-DVdBzpBf.js → useTitle-QM9-qgni.js} +1 -1
  146. package/dist/assets/{useTitle-legacy-CeyL-0_E.js → useTitle-legacy-D5B3yBZZ.js} +1 -1
  147. package/dist/assets/video-KiVJHX0P.js +7 -0
  148. package/dist/assets/video-legacy-BrJOpPW-.js +9 -0
  149. package/dist/assets/{video360-Ceo5Bzr3.js → video360-HOYCbLmb.js} +1 -1
  150. package/dist/assets/{video360-legacy-DKyKnnjk.js → video360-legacy-BHwShuvc.js} +1 -1
  151. package/dist/assets/{video_box-BSgDB9Qt.js → video_box-0_m4vtRE.js} +2 -2
  152. package/dist/assets/{video_box-legacy-OIbbmS-k.js → video_box-legacy-DVP4wTZQ.js} +1 -1
  153. package/dist/i18n.tar.gz +0 -0
  154. package/dist/index.html +11 -11
  155. package/dist/lite/VERSION +1 -1
  156. package/dist/lite/assets/2fa-Bpxh448n.js +1 -0
  157. package/dist/lite/assets/2fa-legacy-DwWWjhKd.js +1 -0
  158. package/dist/lite/assets/About-ArjASC3Q.js +1 -0
  159. package/dist/lite/assets/About-legacy-Bj3uriA_.js +1 -0
  160. package/dist/lite/assets/AddOrEdit-B3LjAnjt.js +1 -0
  161. package/dist/lite/assets/AddOrEdit-BAx3eDaB.js +1 -0
  162. package/dist/lite/assets/AddOrEdit-DF0Uwc_L.js +1 -0
  163. package/dist/lite/assets/AddOrEdit-legacy-BiTUAbBy.js +1 -0
  164. package/dist/lite/assets/AddOrEdit-legacy-CA9WRPx4.js +1 -0
  165. package/dist/lite/assets/AddOrEdit-legacy-Dfi2IkNZ.js +1 -0
  166. package/dist/lite/assets/Common-BzbR55Cb.js +1 -0
  167. package/dist/lite/assets/Common-legacy-3RN_unfO.js +1 -0
  168. package/dist/lite/assets/Copy-DiJEbe33.js +1 -0
  169. package/dist/lite/assets/Copy-legacy-Cde3ux6l.js +1 -0
  170. package/dist/lite/assets/Decompress-CFzo8jdo.js +1 -0
  171. package/dist/lite/assets/Decompress-legacy-DsqpmmrM.js +1 -0
  172. package/dist/lite/assets/{DeletePopover-239d6d9d.js → DeletePopover-Cvk3C2o6.js} +1 -1
  173. package/dist/lite/assets/DeletePopover-legacy-Dfx3CmJo.js +1 -0
  174. package/dist/lite/assets/File-cqzoU4-v.js +2 -0
  175. package/dist/lite/assets/File-legacy-DdJSf0C9.js +1 -0
  176. package/dist/lite/assets/Folder-Do8UmR7t.js +115 -0
  177. package/dist/lite/assets/Folder-legacy-CmfB2sKk.js +43 -0
  178. package/dist/lite/assets/{Folder-6651c4e8.css → Folder-pZUjROFs.css} +1 -1
  179. package/dist/lite/assets/FolderTree-CFJsWcYU.js +1 -0
  180. package/dist/lite/assets/FolderTree-legacy-CPmKKEH_.js +1 -0
  181. package/dist/lite/assets/Grid-Cb4KcOOA.js +1 -0
  182. package/dist/lite/assets/Grid-legacy-BS9-SmUZ.js +1 -0
  183. package/dist/lite/assets/GridItem-DWKtcQLG.js +1 -0
  184. package/dist/lite/assets/GridItem-legacy-D1hKWaXY.js +1 -0
  185. package/dist/lite/assets/{ImageWithError-7a45dab8.js → ImageWithError-BS_j8_6Y.js} +1 -1
  186. package/dist/lite/assets/ImageWithError-legacy-Ce8hrBNL.js +1 -0
  187. package/dist/lite/assets/Images-CMH8hgp4.js +1 -0
  188. package/dist/lite/assets/Images-legacy-CC9la4S2.js +1 -0
  189. package/dist/lite/assets/Layout-jFFnLZug.js +6 -0
  190. package/dist/lite/assets/Layout-legacy-sqNeJgu3.js +6 -0
  191. package/dist/lite/assets/List-BsIOu856.js +1 -0
  192. package/dist/lite/assets/List-legacy-Btd-Aw-v.js +1 -0
  193. package/dist/lite/assets/Messenger-h8Gtjg9d.js +1 -0
  194. package/dist/lite/assets/Messenger-legacy-MSqQNafv.js +1 -0
  195. package/dist/lite/assets/Metas-ChO30D8Y.js +1 -0
  196. package/dist/lite/assets/Metas-legacy-BYtt6Ssn.js +1 -0
  197. package/dist/lite/assets/Move-JKMnsjzW.js +1 -0
  198. package/dist/lite/assets/Move-legacy-io1yEHph.js +1 -0
  199. package/dist/lite/assets/Other-DkvzL5dr.js +1 -0
  200. package/dist/lite/assets/Other-legacy-en5g3QVf.js +1 -0
  201. package/dist/lite/assets/PackageDownload-A3XlgYaK.js +1 -0
  202. package/dist/lite/assets/PackageDownload-legacy-Bsc8kCYa.js +1 -0
  203. package/dist/lite/assets/{Paginator-c6bbb723.js → Paginator-DYHEaUXh.js} +1 -1
  204. package/dist/lite/assets/Paginator-legacy-CHY0GWFh.js +1 -0
  205. package/dist/lite/assets/Password-DFzvuu_a.js +1 -0
  206. package/dist/lite/assets/Password-legacy-D3G8Nj3a.js +1 -0
  207. package/dist/lite/assets/{Profile-8e13fe60.js → Profile-D7CiDttN.js} +1 -1
  208. package/dist/lite/assets/Profile-legacy-CWckDtrc.js +1 -0
  209. package/dist/lite/assets/PublicKeys-legacy-U88DZl4m.js +1 -0
  210. package/dist/lite/assets/PublicKeys-wq_H67SA.js +1 -0
  211. package/dist/lite/assets/ResponsiveGrid-legacy-q5IrbTkd.js +1 -0
  212. package/dist/lite/assets/ResponsiveGrid-xgt3u3bA.js +1 -0
  213. package/dist/lite/assets/S3-BbQW41ep.js +1 -0
  214. package/dist/lite/assets/S3-legacy-DGp5ZhSq.js +1 -0
  215. package/dist/lite/assets/SettingItem-legacy-DcZ5E_l_.js +1 -0
  216. package/dist/lite/assets/SettingItem-roKcFMua.js +1 -0
  217. package/dist/lite/assets/Storages-BaIcw41y.js +1 -0
  218. package/dist/lite/assets/Storages-legacy-CFy4b4ek.js +1 -0
  219. package/dist/lite/assets/Upload-DHbPCUwq.js +5 -0
  220. package/dist/lite/assets/Upload-RIL7iquw.js +1 -0
  221. package/dist/lite/assets/Upload-legacy-3NfgdpZd.js +1 -0
  222. package/dist/lite/assets/Upload-legacy-poADpzfh.js +6 -0
  223. package/dist/lite/assets/Users-BAqP24Qw.js +1 -0
  224. package/dist/lite/assets/Users-legacy-C0mMiKMz.js +1 -0
  225. package/dist/lite/assets/Wether-DK3WDUbh.js +1 -0
  226. package/dist/lite/assets/Wether-legacy-Cavl6pKD.js +1 -0
  227. package/dist/lite/assets/aliyun_office-DBqDX_hp.js +1 -0
  228. package/dist/lite/assets/aliyun_office-legacy-_79ghtZB.js +1 -0
  229. package/dist/lite/assets/aliyun_video-CZcF0Nna.js +1 -0
  230. package/dist/lite/assets/aliyun_video-legacy-Ct0Zt1SB.js +1 -0
  231. package/dist/lite/assets/archive-1Ny6qOnL.js +1 -0
  232. package/dist/lite/assets/archive-legacy-BkYvaOrc.js +1 -0
  233. package/dist/lite/assets/asciinema-legacy-vQ791H0a.js +1 -0
  234. package/dist/lite/assets/asciinema-sSQhDJ1O.js +1 -0
  235. package/dist/lite/assets/audio-CpqrlW8K.js +1 -0
  236. package/dist/lite/assets/{audio-43f4c02b.css → audio-DVCFhzL6.css} +1 -1
  237. package/dist/lite/assets/audio-legacy-BXgPWYfA.js +1 -0
  238. package/dist/lite/assets/{backup-restore-a1922c8b.js → backup-restore-DoLA2IME.js} +1 -1
  239. package/dist/lite/assets/backup-restore-legacy-DNPfsuAH.js +1 -0
  240. package/dist/lite/assets/entry-BtEOFyfY.js +1 -0
  241. package/dist/lite/assets/entry-DtuXLztK.js +1 -0
  242. package/dist/lite/assets/entry-legacy-BxiK1GJf.js +1 -0
  243. package/dist/lite/assets/entry-legacy-Du4R67kT.js +1 -0
  244. package/dist/lite/assets/{flash-9e68a05e.js → flash-Djj83tqh.js} +1 -1
  245. package/dist/lite/assets/flash-legacy-BRVpO4r6.js +1 -0
  246. package/dist/lite/assets/heic-NwUjtcuG.js +1 -0
  247. package/dist/lite/assets/heic-legacy-B3T6GJ6D.js +1 -0
  248. package/dist/lite/assets/helper-Ch7ToGeM.js +1 -0
  249. package/dist/lite/assets/helper-DwX_dOuD.js +1 -0
  250. package/dist/lite/assets/helper-legacy-B5KaTScg.js +1 -0
  251. package/dist/lite/assets/helper-legacy-DcsEUFIj.js +1 -0
  252. package/dist/lite/assets/hls-DBosaSUe.js +6 -0
  253. package/dist/lite/assets/hls-legacy-DgOWpufA.js +8 -0
  254. package/dist/{assets/html-CBeb2Gu_.js → lite/assets/html-Ba6vHZ_J.js} +1 -1
  255. package/dist/lite/assets/html-legacy-Mvg6eZYQ.js +1 -0
  256. package/dist/lite/assets/{icon-cb9eb834.js → icon-ceZ0r1RC.js} +1 -1
  257. package/dist/lite/assets/icon-legacy-BoOzfCLN.js +1 -0
  258. package/dist/lite/assets/image-Bu07NFPt.js +1 -0
  259. package/dist/lite/assets/image-legacy-N3F4kT0B.js +1 -0
  260. package/dist/lite/assets/index-B_TdULNl.js +21 -0
  261. package/dist/{assets/index-DNDW0loe.js → lite/assets/index-BcZBdJ0I.js} +1 -1
  262. package/dist/lite/assets/index-Bn2D_UmB.js +2 -0
  263. package/dist/lite/assets/index-C3V6yVI8.js +1 -0
  264. package/dist/lite/assets/{index-a14fae00.js → index-CRXmqRYq.js} +1 -1
  265. package/dist/lite/assets/{index-6a28cbb7.js → index-C_aiEtJn.js} +1 -1
  266. package/dist/lite/assets/index-C_jPYH9Z.js +1 -0
  267. package/dist/{assets/index-C7ih00qx.js → lite/assets/index-Dqq7pWSD.js} +1 -1
  268. package/dist/lite/assets/{index-67a90f4f.js → index-HMcyQa6d.js} +1 -1
  269. package/dist/lite/assets/index-e42Miit8.js +14 -0
  270. package/dist/lite/assets/index-legacy-BVyUBVta.js +1 -0
  271. package/dist/lite/assets/index-legacy-CLqrKPV_.js +1 -0
  272. package/dist/lite/assets/index-legacy-CVBschDa.js +1 -0
  273. package/dist/lite/assets/index-legacy-CzA4JGfb.js +28 -0
  274. package/dist/lite/assets/index-legacy-D0eoTtsv.js +1 -0
  275. package/dist/lite/assets/index-legacy-DCVYtsVs.js +1 -0
  276. package/dist/lite/assets/index-legacy-Dc8ardce.js +1 -0
  277. package/dist/lite/assets/index-legacy-DrvGupqT.js +1 -0
  278. package/dist/lite/assets/index-legacy-biWX0Baf.js +1 -0
  279. package/dist/lite/assets/index-legacy-d-CZR28M.js +18 -0
  280. package/dist/lite/assets/indexes-CR9gvSWH.js +1 -0
  281. package/dist/lite/assets/indexes-legacy-DFzWwoPv.js +1 -0
  282. package/dist/lite/assets/ipa-DwQ4X4s4.js +1 -0
  283. package/dist/lite/assets/ipa-legacy-BCZ_Zc3J.js +1 -0
  284. package/dist/lite/assets/item_type-legacy-NfhfVKtF.js +1 -0
  285. package/dist/lite/assets/markdown-B4ybtoLY.js +1 -0
  286. package/dist/lite/assets/markdown-legacy-DUdUSvRx.js +1 -0
  287. package/dist/lite/assets/markdown_with_word_wrap-C6ZJsL5G.js +1 -0
  288. package/dist/lite/assets/markdown_with_word_wrap-legacy-D6JpLTGQ.js +1 -0
  289. package/dist/lite/assets/offline_download-B5VAjVkY.js +1 -0
  290. package/dist/lite/assets/offline_download-legacy-iaAjOlRE.js +1 -0
  291. package/dist/lite/assets/plist-BPhLI2sw.js +1 -0
  292. package/dist/lite/assets/plist-legacy-D1tXE2us.js +1 -0
  293. package/dist/lite/assets/polyfills-legacy-fFt7otW2.js +4 -0
  294. package/dist/lite/assets/style-DhbY8MLj.js +1 -0
  295. package/dist/lite/assets/style-legacy-BCQSOKfk.js +1 -0
  296. package/dist/lite/assets/text-editor-CyJ0Qq4M.js +1 -0
  297. package/dist/lite/assets/text-editor-legacy-DShJUMbE.js +1 -0
  298. package/dist/lite/assets/url-CT_IfmFh.js +1 -0
  299. package/dist/lite/assets/url-legacy-Ct_LVIpR.js +1 -0
  300. package/dist/lite/assets/useTitle-Eavd_FAg.js +1 -0
  301. package/dist/lite/assets/useTitle-legacy-mcHxhUhu.js +1 -0
  302. package/dist/lite/assets/video-DbnoLf1P.js +7 -0
  303. package/dist/lite/assets/video-legacy-CwAVgHet.js +9 -0
  304. package/dist/lite/assets/video360-legacy-DXyquQE4.js +16 -0
  305. package/dist/lite/assets/video360-qu887L1T.js +14 -0
  306. package/dist/lite/assets/video_box-DtlDzrz5.js +6 -0
  307. package/dist/lite/assets/video_box-legacy-zTy3pZGq.js +8 -0
  308. package/dist/lite/assets/webauthn-json.browser-ponyfill-legacy-8XJfKV2b.js +1 -0
  309. package/dist/lite/i18n.tar.gz +0 -0
  310. package/dist/lite/index.html +12 -19
  311. package/dist/lite/static/manifest.json +1 -1
  312. package/package.json +1 -1
  313. package/dist/assets/About-Cu11TW0D.js +0 -1
  314. package/dist/assets/AddOrEdit-B7sPaR10.js +0 -1
  315. package/dist/assets/AddOrEdit-legacy-BLNrBEUZ.js +0 -1
  316. package/dist/assets/Common-CrTYhaeL.js +0 -1
  317. package/dist/assets/Common-legacy-CYNGdYU-.js +0 -1
  318. package/dist/assets/Decompress-CzLWbcw1.js +0 -1
  319. package/dist/assets/FolderTree-BopfuzE_.js +0 -1
  320. package/dist/assets/FolderTree-legacy-DH3Vf9XJ.js +0 -1
  321. package/dist/assets/Grid-DPqNI8Qb.js +0 -1
  322. package/dist/assets/Grid-legacy-BgCqAxPk.js +0 -1
  323. package/dist/assets/GridItem-DKsYPXRd.js +0 -1
  324. package/dist/assets/GridItem-legacy-B5BlOcYb.js +0 -1
  325. package/dist/assets/Images-OiLzswiq.js +0 -1
  326. package/dist/assets/Images-legacy-ByM1mPR1.js +0 -1
  327. package/dist/assets/Layout-CyS6jJ_b.js +0 -6
  328. package/dist/assets/Layout-legacy-D9Zk98K6.js +0 -6
  329. package/dist/assets/List-CZc2zrbB.js +0 -1
  330. package/dist/assets/List-legacy-CFAZAIBP.js +0 -1
  331. package/dist/assets/Other-DXc0kpSC.js +0 -1
  332. package/dist/assets/Other-legacy-38X7w6nZ.js +0 -1
  333. package/dist/assets/PackageDownload-CwKBLgrB.js +0 -1
  334. package/dist/assets/Users-BNQGZuWH.js +0 -1
  335. package/dist/assets/Users-legacy-BINPeiuk.js +0 -1
  336. package/dist/assets/aliyun_video-CwA2k3Pu.js +0 -1
  337. package/dist/assets/aliyun_video-legacy-BpsCIyHp.js +0 -1
  338. package/dist/assets/archive-96T1hx83.js +0 -1
  339. package/dist/assets/archive-legacy-DNLQfLr5.js +0 -1
  340. package/dist/assets/asciinema-CyHXgEN-.js +0 -1
  341. package/dist/assets/asciinema-legacy-t3iZqcax.js +0 -1
  342. package/dist/assets/audio-DSt_Oo19.js +0 -1
  343. package/dist/assets/audio-legacy-BhsBrhkI.js +0 -1
  344. package/dist/assets/flash-Be81XNne.js +0 -1
  345. package/dist/assets/flash-legacy-CPqjLHQp.js +0 -1
  346. package/dist/assets/heic-DpvwRot7.js +0 -1
  347. package/dist/assets/heic-legacy-BoU2N_4X.js +0 -1
  348. package/dist/assets/helper-Ha9z54Sm.js +0 -1
  349. package/dist/assets/helper-legacy-CiLX6aDH.js +0 -1
  350. package/dist/assets/image-DK0tWDig.js +0 -1
  351. package/dist/assets/image-legacy-BpyMVaKK.js +0 -1
  352. package/dist/assets/index-D0sWo-se.js +0 -2
  353. package/dist/assets/index-legacy-BYcwzmYP.js +0 -1
  354. package/dist/assets/index-legacy-DIduvs2M.js +0 -1
  355. package/dist/assets/ipa-CThENlHd.js +0 -1
  356. package/dist/assets/ipa-legacy-ruQ-749T.js +0 -1
  357. package/dist/assets/markdown-DAEQr1YU.js +0 -1
  358. package/dist/assets/markdown-legacy-DtXqlrxB.js +0 -1
  359. package/dist/assets/markdown_with_word_wrap-D_gGyBgt.js +0 -1
  360. package/dist/assets/markdown_with_word_wrap-legacy-D-tfNhGw.js +0 -1
  361. package/dist/assets/offline_download--qix7jck.js +0 -1
  362. package/dist/assets/pdf-DS1TLqP2.js +0 -1
  363. package/dist/assets/pdf-legacy-BF9lSw5M.js +0 -45
  364. package/dist/assets/plist-BdQrMloW.js +0 -1
  365. package/dist/assets/plist-legacy-Dzyq_tdc.js +0 -1
  366. package/dist/assets/text-editor-BvoSciLk.js +0 -1
  367. package/dist/assets/text-editor-legacy-AXNOcpgF.js +0 -1
  368. package/dist/assets/video-legacy-DYsnLlgJ.js +0 -9
  369. package/dist/assets/video-oPytqEM3.js +0 -7
  370. package/dist/lite/assets/2fa-d2e88785.js +0 -1
  371. package/dist/lite/assets/2fa-legacy-300dfa68.js +0 -1
  372. package/dist/lite/assets/About-e76de340.js +0 -1
  373. package/dist/lite/assets/About-legacy-79773dac.js +0 -1
  374. package/dist/lite/assets/AddOrEdit-3d3353a8.js +0 -1
  375. package/dist/lite/assets/AddOrEdit-807696e5.js +0 -1
  376. package/dist/lite/assets/AddOrEdit-d6caff63.js +0 -1
  377. package/dist/lite/assets/AddOrEdit-legacy-8f86f1ff.js +0 -1
  378. package/dist/lite/assets/AddOrEdit-legacy-9983f6e1.js +0 -1
  379. package/dist/lite/assets/AddOrEdit-legacy-d0c7c380.js +0 -1
  380. package/dist/lite/assets/Common-9c9167f7.js +0 -1
  381. package/dist/lite/assets/Common-legacy-d52fea2b.js +0 -1
  382. package/dist/lite/assets/Copy-104d7d48.js +0 -1
  383. package/dist/lite/assets/Copy-legacy-e1bce4e6.js +0 -1
  384. package/dist/lite/assets/Decompress-62fd7241.js +0 -1
  385. package/dist/lite/assets/Decompress-legacy-bd78eb4f.js +0 -1
  386. package/dist/lite/assets/DeletePopover-legacy-f4764c72.js +0 -1
  387. package/dist/lite/assets/File-9bb7b3b6.js +0 -1
  388. package/dist/lite/assets/File-legacy-dbaad256.js +0 -1
  389. package/dist/lite/assets/Folder-80505a0c.js +0 -114
  390. package/dist/lite/assets/Folder-legacy-dbe7957d.js +0 -49
  391. package/dist/lite/assets/FolderTree-a7545b65.js +0 -1
  392. package/dist/lite/assets/FolderTree-legacy-cc6e2591.js +0 -1
  393. package/dist/lite/assets/Grid-2ea09356.js +0 -1
  394. package/dist/lite/assets/Grid-legacy-7e146882.js +0 -1
  395. package/dist/lite/assets/GridItem-a16cc1c5.js +0 -1
  396. package/dist/lite/assets/GridItem-legacy-3d2048e2.js +0 -1
  397. package/dist/lite/assets/ImageWithError-legacy-c2f680e8.js +0 -1
  398. package/dist/lite/assets/Images-137f7509.js +0 -1
  399. package/dist/lite/assets/Images-legacy-a43b6098.js +0 -1
  400. package/dist/lite/assets/Layout-ac0937fd.js +0 -5
  401. package/dist/lite/assets/Layout-legacy-0be654c6.js +0 -6
  402. package/dist/lite/assets/List-64c7752c.js +0 -1
  403. package/dist/lite/assets/List-legacy-913c133e.js +0 -1
  404. package/dist/lite/assets/Messenger-254abffb.js +0 -1
  405. package/dist/lite/assets/Messenger-legacy-97283620.js +0 -1
  406. package/dist/lite/assets/Metas-1bad1832.js +0 -1
  407. package/dist/lite/assets/Metas-legacy-7042cb89.js +0 -1
  408. package/dist/lite/assets/Other-29b70647.js +0 -1
  409. package/dist/lite/assets/Other-legacy-607dbff6.js +0 -1
  410. package/dist/lite/assets/PackageDownload-e264bfda.js +0 -1
  411. package/dist/lite/assets/PackageDownload-legacy-55a29bc7.js +0 -1
  412. package/dist/lite/assets/Paginator-legacy-612bab7f.js +0 -1
  413. package/dist/lite/assets/Password-647ac2f5.js +0 -1
  414. package/dist/lite/assets/Password-legacy-2e2010d5.js +0 -1
  415. package/dist/lite/assets/Profile-legacy-93d7fe2b.js +0 -1
  416. package/dist/lite/assets/PublicKeys-7daab5c3.js +0 -1
  417. package/dist/lite/assets/PublicKeys-legacy-83570ba5.js +0 -1
  418. package/dist/lite/assets/ResponsiveGrid-f263846b.js +0 -1
  419. package/dist/lite/assets/ResponsiveGrid-legacy-a8200443.js +0 -1
  420. package/dist/lite/assets/S3-40b2a439.js +0 -1
  421. package/dist/lite/assets/S3-legacy-310983e4.js +0 -1
  422. package/dist/lite/assets/SettingItem-72aa2179.js +0 -1
  423. package/dist/lite/assets/SettingItem-legacy-91ff3c53.js +0 -1
  424. package/dist/lite/assets/Storages-90b21781.js +0 -1
  425. package/dist/lite/assets/Storages-legacy-49b7b995.js +0 -1
  426. package/dist/lite/assets/Upload-9447b1be.js +0 -5
  427. package/dist/lite/assets/Upload-98dd51d8.js +0 -1
  428. package/dist/lite/assets/Upload-legacy-3b92717c.js +0 -6
  429. package/dist/lite/assets/Upload-legacy-ac99e541.js +0 -1
  430. package/dist/lite/assets/Users-30333127.js +0 -1
  431. package/dist/lite/assets/Users-legacy-0719c277.js +0 -1
  432. package/dist/lite/assets/Wether-b430b024.js +0 -1
  433. package/dist/lite/assets/Wether-legacy-274cd4f2.js +0 -1
  434. package/dist/lite/assets/aliyun_office-b0b45663.js +0 -1
  435. package/dist/lite/assets/aliyun_office-legacy-2d148972.js +0 -1
  436. package/dist/lite/assets/aliyun_video-legacy-6a647909.js +0 -1
  437. package/dist/lite/assets/archive-25c8ef3b.js +0 -1
  438. package/dist/lite/assets/archive-legacy-348dc806.js +0 -1
  439. package/dist/lite/assets/asciinema-legacy-1917d686.js +0 -1
  440. package/dist/lite/assets/audio-ea14d1c5.js +0 -1
  441. package/dist/lite/assets/audio-legacy-303c3bd9.js +0 -1
  442. package/dist/lite/assets/backup-restore-legacy-d4b0f25c.js +0 -1
  443. package/dist/lite/assets/entry-27030f25.js +0 -1
  444. package/dist/lite/assets/entry-f2e52067.js +0 -1
  445. package/dist/lite/assets/entry-legacy-a1d93529.js +0 -1
  446. package/dist/lite/assets/entry-legacy-fd98eab3.js +0 -1
  447. package/dist/lite/assets/flash-legacy-80373572.js +0 -1
  448. package/dist/lite/assets/heic-2554ec65.js +0 -1
  449. package/dist/lite/assets/heic-legacy-2c1c78ca.js +0 -1
  450. package/dist/lite/assets/helper-af29c315.js +0 -1
  451. package/dist/lite/assets/helper-legacy-25bddff0.js +0 -1
  452. package/dist/lite/assets/helper-legacy-94b49e67.js +0 -1
  453. package/dist/lite/assets/hls-e031156d.js +0 -6
  454. package/dist/lite/assets/hls-legacy-20bdc1ee.js +0 -8
  455. package/dist/lite/assets/html-legacy-619368c0.js +0 -1
  456. package/dist/lite/assets/icon-legacy-eb0f5143.js +0 -1
  457. package/dist/lite/assets/image-c8b0bac2.js +0 -1
  458. package/dist/lite/assets/image-legacy-7afc3d49.js +0 -1
  459. package/dist/lite/assets/index-3f395f83.js +0 -14
  460. package/dist/lite/assets/index-53a1dd81.js +0 -20
  461. package/dist/lite/assets/index-83750b21.js +0 -1
  462. package/dist/lite/assets/index-9d2d674f.js +0 -1
  463. package/dist/lite/assets/index-b94004c5.js +0 -1
  464. package/dist/lite/assets/index-legacy-17656f04.js +0 -1
  465. package/dist/lite/assets/index-legacy-3d6bd4ab.js +0 -1
  466. package/dist/lite/assets/index-legacy-52bb5f2d.js +0 -1
  467. package/dist/lite/assets/index-legacy-6dddbd7f.js +0 -18
  468. package/dist/lite/assets/index-legacy-737b5776.js +0 -1
  469. package/dist/lite/assets/index-legacy-a79f37d7.js +0 -27
  470. package/dist/lite/assets/index-legacy-b6946699.js +0 -1
  471. package/dist/lite/assets/index-legacy-d4734338.js +0 -1
  472. package/dist/lite/assets/index-legacy-e78804fc.js +0 -1
  473. package/dist/lite/assets/index-legacy-e78c6961.js +0 -1
  474. package/dist/lite/assets/indexes-8d6a3830.js +0 -1
  475. package/dist/lite/assets/indexes-legacy-8aad9cf2.js +0 -1
  476. package/dist/lite/assets/ipa-14799eac.js +0 -1
  477. package/dist/lite/assets/ipa-legacy-05317cab.js +0 -1
  478. package/dist/lite/assets/item_type-legacy-d49ae974.js +0 -1
  479. package/dist/lite/assets/markdown-438acebf.js +0 -1
  480. package/dist/lite/assets/markdown-legacy-85cc7347.js +0 -1
  481. package/dist/lite/assets/markdown_with_word_wrap-02b3d898.js +0 -1
  482. package/dist/lite/assets/markdown_with_word_wrap-legacy-c80bbc34.js +0 -1
  483. package/dist/lite/assets/offline_download-64a4f5ec.js +0 -1
  484. package/dist/lite/assets/offline_download-legacy-13c80c46.js +0 -1
  485. package/dist/lite/assets/plist-caa63a1c.js +0 -1
  486. package/dist/lite/assets/plist-legacy-97df7129.js +0 -1
  487. package/dist/lite/assets/polyfills-legacy-84c7163c.js +0 -1
  488. package/dist/lite/assets/style-da60bdcd.js +0 -1
  489. package/dist/lite/assets/style-legacy-56f6ffc2.js +0 -1
  490. package/dist/lite/assets/text-editor-faffc12e.js +0 -1
  491. package/dist/lite/assets/text-editor-legacy-c28b9e68.js +0 -1
  492. package/dist/lite/assets/url-e7419bc0.js +0 -1
  493. package/dist/lite/assets/url-legacy-c605c2b3.js +0 -1
  494. package/dist/lite/assets/useTitle-3c39724b.js +0 -1
  495. package/dist/lite/assets/useTitle-legacy-f359aa82.js +0 -1
  496. package/dist/lite/assets/video-bdb2443b.js +0 -7
  497. package/dist/lite/assets/video-legacy-aaca36d8.js +0 -9
  498. package/dist/lite/assets/video360-8fe849f4.js +0 -14
  499. package/dist/lite/assets/video360-legacy-60cbacb5.js +0 -16
  500. package/dist/lite/assets/video_box-cfac536c.js +0 -6
  501. package/dist/lite/assets/video_box-legacy-6b3ebc5b.js +0 -8
  502. package/dist/lite/assets/webauthn-json.browser-ponyfill-legacy-456cc8e1.js +0 -1
  503. /package/dist/lite/assets/{asciinema-9107553b.css → asciinema-CxBn2iyI.css} +0 -0
  504. /package/dist/lite/assets/{index-c0564af7.css → index-DYLAoZjS.css} +0 -0
  505. /package/dist/lite/assets/{item_type-32dc6fdf.js → item_type-CV3e5W3l.js} +0 -0
  506. /package/dist/lite/assets/{lg-f2fe1c00.svg → lg-B0dIV2BS.svg} +0 -0
  507. /package/dist/lite/assets/{lg-fefc5c0d.woff → lg-CosQH4Cu.woff} +0 -0
  508. /package/dist/lite/assets/{lg-22b72ba5.ttf → lg-oyjwlqP2.ttf} +0 -0
  509. /package/dist/lite/assets/{loading-298ad3ff.gif → loading-BZOHaeKn.gif} +0 -0
  510. /package/dist/lite/assets/{style-a6d16836.css → style-qq4T_k44.css} +0 -0
  511. /package/dist/lite/assets/{subtitles-octopus-worker-f95f2186.js → subtitles-octopus-worker-BE_B0Qbi.js} +0 -0
  512. /package/dist/lite/assets/{subtitles-octopus-worker-62892886.wasm → subtitles-octopus-worker-DBPz2dPT.wasm} +0 -0
  513. /package/dist/lite/assets/{video360-f0192288.css → video360-Cpoa0Nlv.css} +0 -0
  514. /package/dist/lite/assets/{webauthn-json.browser-ponyfill-29d8152c.js → webauthn-json.browser-ponyfill-CVZeZdny.js} +0 -0
@@ -0,0 +1 @@
1
+ var DA=Object.defineProperty;var bw=h=>{throw TypeError(h)};var NA=(h,t,e)=>t in h?DA(h,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[t]=e;var k=(h,t,e)=>NA(h,typeof t!="symbol"?t+"":t,e),cp=(h,t,e)=>t.has(h)||bw("Cannot "+e);var r=(h,t,e)=>(cp(h,t,"read from private field"),e?e.call(h):t.get(h)),m=(h,t,e)=>t.has(h)?bw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(h):t.set(h,e),f=(h,t,e,i)=>(cp(h,t,"write to private field"),i?i.call(h,e):t.set(h,e),e),p=(h,t,e)=>(cp(h,t,"access private method"),e);var se=(h,t,e,i)=>({set _(s){f(h,t,s,e)},get _(){return r(h,t,i)}});import{e8 as FA,dK as OA,e9 as ww,bT as BA,ea as VA,B as zi,eb as HA,N as xc,C as tf,cu as jA,av as qb,e7 as Yv,aZ as Kv,D as O,bV as $A,R as pg,ck as Zv,dH as Qv,ec as UA,ed as WA,aS as Rn,a8 as zA,aY as GA,cR as XA,ak as Xr,au as mg,ad as bg,o as Jv,aV as ta,aA as On,ae as qA,S as kc,O as YA,an as Jo,ee as KA,ef as ZA,di as dp,eg as QA,aJ as JA,az as tE,K as ty,aF as eE,eh as vw,ei as yw,aG as _w,ej as iE,I as sE}from"./index-BeFrtC4h.js";const Ie=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Np=[.001,0,0,.001,0,0],up=1.35,ri={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ps={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},ey="pdfjs_internal_editor_",Y={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,SIGNATURE:101,COMMENT:102},nt={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_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},nE={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},me={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Ef={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Bt={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,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},Vo={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Jg={ERRORS:0,WARNINGS:1,INFOS:5},wg={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,rawFillPath:94},lf={moveTo:0,lineTo:1,curveTo:2,closePath:3},rE={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let tp=Jg.WARNINGS;function aE(h){Number.isInteger(h)&&(tp=h)}function oE(){return tp}function ep(h){tp>=Jg.INFOS&&console.log("Info: ".concat(h))}function Z(h){tp>=Jg.WARNINGS&&console.log("Warning: ".concat(h))}function pt(h){throw new Error(h)}function Ht(h,t){h||pt(t)}function lE(h){switch(h==null?void 0:h.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function iy(h,t=null,e=null){if(!h)return null;if(e&&typeof h=="string"){if(e.addDefaultProtocol&&h.startsWith("www.")){const s=h.match(/\./g);(s==null?void 0:s.length)>=2&&(h="http://".concat(h))}if(e.tryConvertEncoding)try{h=fE(h)}catch(s){}}const i=t?URL.parse(h,t):URL.parse(h);return lE(i)?i:null}function sy(h,t,e=!1){const i=URL.parse(h);return i?(i.hash=t,i.href):e&&iy(h,"http://example.com")?h.split("#",1)[0]+"".concat(t?"#".concat(t):""):""}function st(h,t,e,i=!1){return Object.defineProperty(h,t,{value:e,enumerable:!i,configurable:!0,writable:!1}),e}const Fo=function(){function t(e,i){this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t}();class Aw extends Fo{constructor(t,e){super(t,"PasswordException"),this.code=e}}class fp extends Fo{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}let Fp=class extends Fo{constructor(t){super(t,"InvalidPDFException")}},vg=class extends Fo{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}};class hE extends Fo{constructor(t){super(t,"FormatError")}}let qr=class extends Fo{constructor(t){super(t,"AbortException")}};function ny(h){(typeof h!="object"||(h==null?void 0:h.length)===void 0)&&pt("Invalid argument for bytesToString");const t=h.length,e=8192;if(t<e)return String.fromCharCode.apply(null,h);const i=[];for(let s=0;s<t;s+=e){const n=Math.min(s+e,t),a=h.subarray(s,n);i.push(String.fromCharCode.apply(null,a))}return i.join("")}function ef(h){typeof h!="string"&&pt("Invalid argument for stringToBytes");const t=h.length,e=new Uint8Array(t);for(let i=0;i<t;++i)e[i]=h.charCodeAt(i)&255;return e}function cE(h){return String.fromCharCode(h>>24&255,h>>16&255,h>>8&255,h&255)}function dE(){const h=new Uint8Array(4);return h[0]=1,new Uint32Array(h.buffer,0,1)[0]===1}function uE(){try{return new Function(""),!0}catch(h){return!1}}class pe{static get isLittleEndian(){return st(this,"isLittleEndian",dE())}static get isEvalSupported(){return st(this,"isEvalSupported",uE())}static get isOffscreenCanvasSupported(){return st(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return st(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:t,userAgent:e}=navigator;return st(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){var t,e;return st(this,"isCSSRoundSupported",(e=(t=globalThis.CSS)==null?void 0:t.supports)==null?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const gp=Array.from(Array(256).keys(),h=>h.toString(16).padStart(2,"0"));var Tn,kp,Sf,Op;let q=(kp=class{static makeHexColor(t,e,i){return"#".concat(gp[t]).concat(gp[e]).concat(gp[i])}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),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,i=0){const s=t[i],n=t[i+1];t[i]=s*e[0]+n*e[2]+e[4],t[i+1]=s*e[1]+n*e[3]+e[5]}static applyTransformToBezier(t,e,i=0){const s=e[0],n=e[1],a=e[2],o=e[3],l=e[4],c=e[5];for(let d=0;d<6;d+=2){const u=t[i+d],g=t[i+d+1];t[i+d]=u*s+g*a+l,t[i+d+1]=u*n+g*o+c}}static applyInverseTransform(t,e){const i=t[0],s=t[1],n=e[0]*e[3]-e[1]*e[2];t[0]=(i*e[3]-s*e[2]+e[2]*e[5]-e[4]*e[3])/n,t[1]=(-i*e[1]+s*e[0]+e[4]*e[1]-e[5]*e[0])/n}static axialAlignedBoundingBox(t,e,i){const s=e[0],n=e[1],a=e[2],o=e[3],l=e[4],c=e[5],d=t[0],u=t[1],g=t[2],b=t[3];let w=s*d+l,v=w,A=s*g+l,y=A,S=o*u+c,_=S,E=o*b+c,P=E;if(n!==0||a!==0){const x=n*d,T=n*g,I=a*u,C=a*b;w+=I,y+=I,A+=C,v+=C,S+=x,P+=x,E+=T,_+=T}i[0]=Math.min(i[0],w,A,v,y),i[1]=Math.min(i[1],S,E,_,P),i[2]=Math.max(i[2],w,A,v,y),i[3]=Math.max(i[3],S,E,_,P)}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,e){const i=t[0],s=t[1],n=t[2],a=t[3],o=i**2+s**2,l=i*n+s*a,c=n**2+a**2,d=(o+c)/2,u=Math.sqrt(d**2-(o*c-l**2));e[0]=Math.sqrt(d+u||1),e[1]=Math.sqrt(d-u||1)}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 i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>s)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:[i,n,s,a]}static pointBoundingBox(t,e,i){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}static rectBoundingBox(t,e,i,s,n){n[0]=Math.min(n[0],t,i),n[1]=Math.min(n[1],e,s),n[2]=Math.max(n[2],t,i),n[3]=Math.max(n[3],e,s)}static bezierBoundingBox(t,e,i,s,n,a,o,l,c){c[0]=Math.min(c[0],t,o),c[1]=Math.min(c[1],e,l),c[2]=Math.max(c[2],t,o),c[3]=Math.max(c[3],e,l),p(this,Tn,Op).call(this,t,i,n,o,e,s,a,l,3*(-t+3*(i-n)+o),6*(t-2*i+n),3*(i-t),c),p(this,Tn,Op).call(this,t,i,n,o,e,s,a,l,3*(-e+3*(s-a)+l),6*(e-2*s+a),3*(s-e),c)}},Tn=new WeakSet,Sf=function(t,e,i,s,n,a,o,l,c,d){if(c<=0||c>=1)return;const u=1-c,g=c*c,b=g*c,w=u*(u*(u*t+3*c*e)+3*g*i)+b*s,v=u*(u*(u*n+3*c*a)+3*g*o)+b*l;d[0]=Math.min(d[0],w),d[1]=Math.min(d[1],v),d[2]=Math.max(d[2],w),d[3]=Math.max(d[3],v)},Op=function(t,e,i,s,n,a,o,l,c,d,u,g){if(Math.abs(c)<1e-12){Math.abs(d)>=1e-12&&p(this,Tn,Sf).call(this,t,e,i,s,n,a,o,l,-u/d,g);return}const b=d**2-4*u*c;if(b<0)return;const w=Math.sqrt(b),v=2*c;p(this,Tn,Sf).call(this,t,e,i,s,n,a,o,l,(-d+w)/v,g),p(this,Tn,Sf).call(this,t,e,i,s,n,a,o,l,(-d-w)/v,g)},m(kp,Tn),kp);function fE(h){return decodeURIComponent(escape(h))}let pp=null,Ew=null;function gE(h){return pp||(pp=/([\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,Ew=new Map([["ſt","ſt"]])),h.replaceAll(pp,(t,e,i)=>e?e.normalize("NFKC"):Ew.get(i))}function ry(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const h=new Uint8Array(32);return crypto.getRandomValues(h),ny(h)}const Yb="pdfjs_internal_id_";function pE(h,t,e){if(!Array.isArray(e)||e.length<2)return!1;const[i,s,...n]=e;if(!h(i)&&!Number.isInteger(i)||!t(s))return!1;const a=n.length;let o=!0;switch(s.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return a===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(a!==4)return!1;o=!1;break;default:return!1}for(const l of n)if(!(typeof l=="number"||o&&l===null))return!1;return!0}function Le(h,t,e){return Math.min(Math.max(h,t),e)}function ay(h){return Uint8Array.prototype.toBase64?h.toBase64():btoa(ny(h))}function mE(h){return Uint8Array.fromBase64?Uint8Array.fromBase64(h):ef(atob(h))}typeof Promise.try!="function"&&(Promise.try=function(h,...t){return new Promise(e=>{e(h(...t))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(h){return h.reduce((t,e)=>t+e,0)});const Is="http://www.w3.org/2000/svg";var Ss;let Yr=(Ss=class{},k(Ss,"CSS",96),k(Ss,"PDF",72),k(Ss,"PDF_TO_CSS_UNITS",Ss.CSS/Ss.PDF),Ss);async function sf(h,t="text"){if(Qh(h,document.baseURI)){const e=await fetch(h);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,i)=>{const s=new XMLHttpRequest;s.open("GET",h,!0),s.responseType=t,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(s.status===200||s.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(s.response);return}e(s.responseText);return}i(new Error(s.statusText))}},s.send(null)})}class nf{constructor({viewBox:t,userUnit:e,scale:i,rotation:s,offsetX:n=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=t,this.userUnit=e,this.scale=i,this.rotation=s,this.offsetX=n,this.offsetY=a,i*=e;const l=(t[2]+t[0])/2,c=(t[3]+t[1])/2;let d,u,g,b;switch(s%=360,s<0&&(s+=360),s){case 180:d=-1,u=0,g=0,b=1;break;case 90:d=0,u=1,g=1,b=0;break;case 270:d=0,u=-1,g=-1,b=0;break;case 0:d=1,u=0,g=0,b=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(g=-g,b=-b);let w,v,A,y;d===0?(w=Math.abs(c-t[1])*i+n,v=Math.abs(l-t[0])*i+a,A=(t[3]-t[1])*i,y=(t[2]-t[0])*i):(w=Math.abs(l-t[0])*i+n,v=Math.abs(c-t[1])*i+a,A=(t[2]-t[0])*i,y=(t[3]-t[1])*i),this.transform=[d*i,u*i,g*i,b*i,w-d*i*l-g*i*c,v-u*i*l-b*i*c],this.width=A,this.height=y}get rawDims(){const t=this.viewBox;return st(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:i=this.offsetX,offsetY:s=this.offsetY,dontFlip:n=!1}={}){return new nf({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:n})}convertToViewportPoint(t,e){const i=[t,e];return q.applyTransform(i,this.transform),i}convertToViewportRectangle(t){const e=[t[0],t[1]];q.applyTransform(e,this.transform);const i=[t[2],t[3]];return q.applyTransform(i,this.transform),[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){const i=[t,e];return q.applyInverseTransform(i,this.transform),i}}let Uh=class extends Fo{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};function ip(h){const t=h.length;let e=0;for(;e<t&&h[e].trim()==="";)e++;return h.substring(e,e+5).toLowerCase()==="data:"}function Kb(h){return typeof h=="string"&&/\.pdf$/i.test(h)}function bE(h){return[h]=h.split(/[#?]/,1),h.substring(h.lastIndexOf("/")+1)}function oy(h,t="document.pdf"){if(typeof h!="string")return t;if(ip(h))return Z('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const i=(o=>{try{return new URL(o)}catch(l){try{return new URL(decodeURIComponent(o))}catch(c){try{return new URL(o,"https://foo.bar")}catch(d){try{return new URL(decodeURIComponent(o),"https://foo.bar")}catch(u){return null}}}}})(h);if(!i)return t;const s=o=>{try{let l=decodeURIComponent(o);return l.includes("/")?(l=l.split("/").at(-1),l.test(/^\.pdf$/i)?l:o):l}catch(l){return o}},n=/\.pdf$/i,a=i.pathname.split("/").at(-1);if(n.test(a))return s(a);if(i.searchParams.size>0){const o=Array.from(i.searchParams.values()).reverse();for(const c of o)if(n.test(c))return s(c);const l=Array.from(i.searchParams.keys()).reverse();for(const c of l)if(n.test(c))return s(c)}if(i.hash){const l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(l)return s(l[0])}return t}class Sw{constructor(){k(this,"started",Object.create(null));k(this,"times",[])}time(t){t in this.started&&Z("Timer is already running for ".concat(t)),this.started[t]=Date.now()}timeEnd(t){t in this.started||Z("Timer has not been started for ".concat(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:i}of this.times)e=Math.max(i.length,e);for(const{name:i,start:s,end:n}of this.times)t.push("".concat(i.padEnd(e)," ").concat(n-s,"ms\n"));return t.join("")}}function Qh(h,t){const e=t?URL.parse(h,t):URL.parse(h);return(e==null?void 0:e.protocol)==="http:"||(e==null?void 0:e.protocol)==="https:"}function Ci(h){h.preventDefault()}function Vt(h){h.preventDefault(),h.stopPropagation()}function wE(h){console.log("Deprecated API usage: "+h)}var Dp,Hc;let Dc=(Dp=class{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;r(this,Hc)||f(this,Hc,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=r(this,Hc).exec(t);if(!e)return null;const i=parseInt(e[1],10);let s=parseInt(e[2],10);s=s>=1&&s<=12?s-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 l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const c=e[7]||"Z";let d=parseInt(e[8],10);d=d>=0&&d<=23?d:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,c==="-"?(a+=d,o+=u):c==="+"&&(a-=d,o-=u),new Date(Date.UTC(i,s,n,a,o,l))}},Hc=new WeakMap,m(Dp,Hc),Dp);function ly(h,{scale:t=1,rotation:e=0}){const{width:i,height:s}=h.attributes.style,n=[0,0,parseInt(i),parseInt(s)];return new nf({viewBox:n,userUnit:1,scale:t,rotation:e})}function sp(h){if(h.startsWith("#")){const t=parseInt(h.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return h.startsWith("rgb(")?h.slice(4,-1).split(",").map(t=>parseInt(t)):h.startsWith("rgba(")?h.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(Z('Not a valid color format: "'.concat(h,'"')),[0,0,0])}function vE(h){const t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(const e of h.keys()){t.style.color=e;const i=window.getComputedStyle(t).color;h.set(e,sp(i))}t.remove()}function Ct(h){const{a:t,b:e,c:i,d:s,e:n,f:a}=h.getTransform();return[t,e,i,s,n,a]}function Yi(h){const{a:t,b:e,c:i,d:s,e:n,f:a}=h.getTransform().invertSelf();return[t,e,i,s,n,a]}function Mo(h,t,e=!1,i=!0){if(t instanceof nf){const{pageWidth:s,pageHeight:n}=t.rawDims,{style:a}=h,o=pe.isCSSRoundSupported,l="var(--total-scale-factor) * ".concat(s,"px"),c="var(--total-scale-factor) * ".concat(n,"px"),d=o?"round(down, ".concat(l,", var(--scale-round-x))"):"calc(".concat(l,")"),u=o?"round(down, ".concat(c,", var(--scale-round-y))"):"calc(".concat(c,")");!e||t.rotation%180===0?(a.width=d,a.height=u):(a.width=u,a.height=d)}i&&h.setAttribute("data-main-rotation",t.rotation)}let ko=class Bp{constructor(){const{pixelRatio:t}=Bp;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,i,s,n=-1){let a=1/0,o=1/0,l=1/0;i=Bp.capPixels(i,n),i>0&&(a=Math.sqrt(i/(t*e))),s!==-1&&(o=s/t,l=s/e);const c=Math.min(a,o,l);return this.sx>c||this.sy>c?(this.sx=c,this.sy=c,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){const i=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,i):i}return t}};const Vp=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];var Hn,jn,pi,Fs,jc,ol,ll,$c,Lg,hy,ge,cy,dy,Ho,Jh;const ks=class ks{constructor(t){m(this,ge);m(this,Hn,null);m(this,jn,null);m(this,pi);m(this,Fs,null);m(this,jc,null);m(this,ol,null);m(this,ll,null);f(this,pi,t),r(ks,$c)||f(ks,$c,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",signature:"pdfjs-editor-remove-signature-button"}))}render(){const t=f(this,Hn,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=r(this,pi)._uiManager._signal;t.addEventListener("contextmenu",Ci,{signal:e}),t.addEventListener("pointerdown",p(ks,Lg,hy),{signal:e});const i=f(this,Fs,document.createElement("div"));i.className="buttons",t.append(i);const s=r(this,pi).toolbarPosition;if(s){const{style:n}=t,a=r(this,pi)._uiManager.direction==="ltr"?1-s[0]:s[0];n.insetInlineEnd="".concat(100*a,"%"),n.top="calc(".concat(100*s[1],"% + var(--editor-toolbar-vert-offset))")}return t}get div(){return r(this,Hn)}hide(){var t;r(this,Hn).classList.add("hidden"),(t=r(this,jn))==null||t.hideDropdown()}show(){var t,e;r(this,Hn).classList.remove("hidden"),(t=r(this,jc))==null||t.shown(),(e=r(this,ol))==null||e.shown()}addDeleteButton(){const{editorType:t,_uiManager:e}=r(this,pi),i=document.createElement("button");i.className="delete",i.tabIndex=0,i.setAttribute("data-l10n-id",r(ks,$c)[t]),p(this,ge,Ho).call(this,i),i.addEventListener("click",s=>{e.delete()},{signal:e._signal}),r(this,Fs).append(i)}async addAltText(t){const e=await t.render();p(this,ge,Ho).call(this,e),r(this,Fs).append(e,r(this,ge,Jh)),f(this,jc,t)}addComment(t){if(r(this,ol))return;const e=t.render();e&&(p(this,ge,Ho).call(this,e),r(this,Fs).prepend(e,r(this,ge,Jh)),f(this,ol,t),t.toolbar=this)}addColorPicker(t){if(r(this,jn))return;f(this,jn,t);const e=t.renderButton();p(this,ge,Ho).call(this,e),r(this,Fs).append(e,r(this,ge,Jh))}async addEditSignatureButton(t){const e=f(this,ll,await t.renderEditButton(r(this,pi)));p(this,ge,Ho).call(this,e),r(this,Fs).append(e,r(this,ge,Jh))}async addButton(t,e){switch(t){case"colorPicker":this.addColorPicker(e);break;case"altText":await this.addAltText(e);break;case"editSignature":await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(e);break}}updateEditSignatureButton(t){r(this,ll)&&(r(this,ll).title=t)}remove(){var t;r(this,Hn).remove(),(t=r(this,jn))==null||t.destroy(),f(this,jn,null)}};Hn=new WeakMap,jn=new WeakMap,pi=new WeakMap,Fs=new WeakMap,jc=new WeakMap,ol=new WeakMap,ll=new WeakMap,$c=new WeakMap,Lg=new WeakSet,hy=function(t){t.stopPropagation()},ge=new WeakSet,cy=function(t){r(this,pi)._focusEventsAllowed=!1,Vt(t)},dy=function(t){r(this,pi)._focusEventsAllowed=!0,Vt(t)},Ho=function(t){const e=r(this,pi)._uiManager._signal;t.addEventListener("focusin",p(this,ge,cy).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",p(this,ge,dy).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Ci,{signal:e})},Jh=function(){const t=document.createElement("div");return t.className="divider",t},m(ks,Lg),m(ks,$c,null);let Hp=ks;var Uc,fa,ga,Zr,uy,fy,gy;class yE{constructor(t){m(this,Zr);m(this,Uc,null);m(this,fa,null);m(this,ga);f(this,ga,t)}show(t,e,i){const[s,n]=p(this,Zr,fy).call(this,e,i),{style:a}=r(this,fa)||f(this,fa,p(this,Zr,uy).call(this));t.append(r(this,fa)),a.insetInlineEnd="".concat(100*s,"%"),a.top="calc(".concat(100*n,"% + var(--editor-toolbar-vert-offset))")}hide(){r(this,fa).remove()}}Uc=new WeakMap,fa=new WeakMap,ga=new WeakMap,Zr=new WeakSet,uy=function(){const t=f(this,fa,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Ci,{signal:r(this,ga)._signal});const e=f(this,Uc,document.createElement("div"));return e.className="buttons",t.append(e),p(this,Zr,gy).call(this),t},fy=function(t,e){let i=0,s=0;for(const n of t){const a=n.y+n.height;if(a<i)continue;const o=n.x+(e?n.width:0);if(a>i){s=o,i=a;continue}e?o>s&&(s=o):o<s&&(s=o)}return[e?1-s:s,i]},gy=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 i=r(this,ga)._signal;t.addEventListener("contextmenu",Ci,{signal:i}),t.addEventListener("click",()=>{r(this,ga).highlightSelection("floating_button")},{signal:i}),r(this,Uc).append(t)};function py(h,t,e){for(const i of e)t.addEventListener(i,h[i].bind(h))}var Rg;class _E{constructor(){m(this,Rg,0)}get id(){return"".concat(ey).concat(se(this,Rg)._++)}}Rg=new WeakMap;var hl,Wc,we,cl,Pf;const dw=class dw{constructor(){m(this,cl);m(this,hl,ry());m(this,Wc,0);m(this,we,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>',i=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),s=new Image;s.src=t;const n=s.decode().then(()=>(i.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(i.getImageData(0,0,1,1).data.buffer)[0]===0));return st(this,"_isSVGFittingCanvas",n)}async getFromFile(t){const{lastModified:e,name:i,size:s,type:n}=t;return p(this,cl,Pf).call(this,"".concat(e,"_").concat(i,"_").concat(s,"_").concat(n),t)}async getFromUrl(t){return p(this,cl,Pf).call(this,t,t)}async getFromBlob(t,e){const i=await e;return p(this,cl,Pf).call(this,t,i)}async getFromId(t){r(this,we)||f(this,we,new Map);const e=r(this,we).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:i}=e;return delete e.blobPromise,this.getFromBlob(e.id,i)}return this.getFromUrl(e.url)}getFromCanvas(t,e){r(this,we)||f(this,we,new Map);let i=r(this,we).get(t);if(i!=null&&i.bitmap)return i.refCounter+=1,i;const s=new OffscreenCanvas(e.width,e.height);return s.getContext("2d").drawImage(e,0,0),i={bitmap:s.transferToImageBitmap(),id:"image_".concat(r(this,hl),"_").concat(se(this,Wc)._++),refCounter:1,isSvg:!1},r(this,we).set(t,i),r(this,we).set(i.id,i),i}getSvgUrl(t){const e=r(this,we).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){var s;r(this,we)||f(this,we,new Map);const e=r(this,we).get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;const{bitmap:i}=e;if(!e.url&&!e.file){const n=new OffscreenCanvas(i.width,i.height);n.getContext("bitmaprenderer").transferFromImageBitmap(i),e.blobPromise=n.convertToBlob()}(s=i.close)==null||s.call(i),e.bitmap=null}isValidId(t){return t.startsWith("image_".concat(r(this,hl),"_"))}};hl=new WeakMap,Wc=new WeakMap,we=new WeakMap,cl=new WeakSet,Pf=async function(t,e){r(this,we)||f(this,we,new Map);let i=r(this,we).get(t);if(i===null)return null;if(i!=null&&i.bitmap)return i.refCounter+=1,i;try{i||(i={bitmap:null,id:"image_".concat(r(this,hl),"_").concat(se(this,Wc)._++),refCounter:0,isSvg:!1});let s;if(typeof e=="string"?(i.url=e,s=await sf(e,"blob")):e instanceof File?s=i.file=e:e instanceof Blob&&(s=e),s.type==="image/svg+xml"){const n=dw._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((c,d)=>{o.onload=()=>{i.bitmap=o,i.isSvg=!0,c()},a.onload=async()=>{const u=i.svgUrl=a.result;o.src=await n?"".concat(u,"#svgView(preserveAspectRatio(none))"):u},o.onerror=a.onerror=d});a.readAsDataURL(s),await l}else i.bitmap=await createImageBitmap(s);i.refCounter=1}catch(s){Z(s),i=null}return r(this,we).set(t,i),i&&r(this,we).set(i.id,i),i};let jp=dw;var Dt,$n,zc,xt;class AE{constructor(t=128){m(this,Dt,[]);m(this,$n,!1);m(this,zc);m(this,xt,-1);f(this,zc,t)}add({cmd:t,undo:e,post:i,mustExec:s,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(s&&t(),r(this,$n))return;const l={cmd:t,undo:e,post:i,type:n};if(r(this,xt)===-1){r(this,Dt).length>0&&(r(this,Dt).length=0),f(this,xt,0),r(this,Dt).push(l);return}if(a&&r(this,Dt)[r(this,xt)].type===n){o&&(l.undo=r(this,Dt)[r(this,xt)].undo),r(this,Dt)[r(this,xt)]=l;return}const c=r(this,xt)+1;c===r(this,zc)?r(this,Dt).splice(0,1):(f(this,xt,c),c<r(this,Dt).length&&r(this,Dt).splice(c)),r(this,Dt).push(l)}undo(){if(r(this,xt)===-1)return;f(this,$n,!0);const{undo:t,post:e}=r(this,Dt)[r(this,xt)];t(),e==null||e(),f(this,$n,!1),f(this,xt,r(this,xt)-1)}redo(){if(r(this,xt)<r(this,Dt).length-1){f(this,xt,r(this,xt)+1),f(this,$n,!0);const{cmd:t,post:e}=r(this,Dt)[r(this,xt)];t(),e==null||e(),f(this,$n,!1)}}hasSomethingToUndo(){return r(this,xt)!==-1}hasSomethingToRedo(){return r(this,xt)<r(this,Dt).length-1}cleanType(t){if(r(this,xt)!==-1){for(let e=r(this,xt);e>=0;e--)if(r(this,Dt)[e].type!==t){r(this,Dt).splice(e+1,r(this,xt)-e),f(this,xt,e);return}r(this,Dt).length=0,f(this,xt,-1)}}destroy(){f(this,Dt,null)}}Dt=new WeakMap,$n=new WeakMap,zc=new WeakMap,xt=new WeakMap;var Mg,my;class rf{constructor(t){m(this,Mg);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=pe.platform;for(const[i,s,n={}]of t)for(const a of i){const o=a.startsWith("mac+");e&&o?(this.callbacks.set(a.slice(4),{callback:s,options:n}),this.allKeys.add(a.split("+").at(-1))):!e&&!o&&(this.callbacks.set(a,{callback:s,options:n}),this.allKeys.add(a.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get(p(this,Mg,my).call(this,e));if(!i)return;const{callback:s,options:{bubbles:n=!1,args:a=[],checker:o=null}}=i;o&&!o(t,e)||(s.bind(t,...a,e)(),n||Vt(e))}}Mg=new WeakSet,my=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 kg=class kg{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return vE(t),st(this,"_colors",t)}convert(t){const e=sp(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[i,s]of this._colors)if(s.every((n,a)=>n===e[a]))return kg._colorsMapping.get(i);return e}getHexCode(t){const e=this._colors.get(t);return e?q.makeHexColor(...e):t}};k(kg,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let $p=kg;var dl,Ue,Ut,ne,ul,Os,fl,mi,pa,Un,Wn,gl,ma,ts,Ii,ba,Gc,Xc,pl,qc,es,zn,ml,Gn,is,Dg,Xn,Yc,qn,wa,bl,Yn,Kc,Yt,ut,Bs,Kn,Zn,Zc,Qc,Qn,ss,Vs,Jc,td,bi,xn,F,xf,Up,by,wy,Cf,vy,yy,_y,Wp,Ay,zp,Gp,Ey,Ae,Ls,Sy,Py,Xp,xy,tc,qp;let Nc=(xn=class{constructor(t,e,i,s,n,a,o,l,c,d,u,g,b,w,v,A){m(this,F);m(this,dl,new AbortController);m(this,Ue,null);m(this,Ut,new Map);m(this,ne,new Map);m(this,ul,null);m(this,Os,null);m(this,fl,null);m(this,mi,new AE);m(this,pa,null);m(this,Un,null);m(this,Wn,null);m(this,gl,0);m(this,ma,new Set);m(this,ts,null);m(this,Ii,null);m(this,ba,new Set);k(this,"_editorUndoBar",null);m(this,Gc,!1);m(this,Xc,!1);m(this,pl,!1);m(this,qc,null);m(this,es,null);m(this,zn,null);m(this,ml,null);m(this,Gn,!1);m(this,is,null);m(this,Dg,new _E);m(this,Xn,!1);m(this,Yc,!1);m(this,qn,null);m(this,wa,null);m(this,bl,null);m(this,Yn,null);m(this,Kc,null);m(this,Yt,Y.NONE);m(this,ut,new Set);m(this,Bs,null);m(this,Kn,null);m(this,Zn,null);m(this,Zc,null);m(this,Qc,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});m(this,Qn,[0,0]);m(this,ss,null);m(this,Vs,null);m(this,Jc,null);m(this,td,null);m(this,bi,null);const y=this._signal=r(this,dl).signal;f(this,Vs,t),f(this,Jc,e),f(this,td,i),f(this,ul,s),f(this,pa,n),f(this,Kn,a),this._eventBus=o,o._on("editingaction",this.onEditingAction.bind(this),{signal:y}),o._on("pagechanging",this.onPageChanging.bind(this),{signal:y}),o._on("scalechanging",this.onScaleChanging.bind(this),{signal:y}),o._on("rotationchanging",this.onRotationChanging.bind(this),{signal:y}),o._on("setpreference",this.onSetPreference.bind(this),{signal:y}),o._on("switchannotationeditorparams",S=>this.updateParams(S.type,S.value),{signal:y}),p(this,F,vy).call(this),p(this,F,Ey).call(this),p(this,F,Wp).call(this),f(this,Os,l.annotationStorage),f(this,qc,l.filterFactory),f(this,Zn,c),f(this,ml,d||null),f(this,Gc,u),f(this,Xc,g),f(this,pl,b),f(this,Kc,w||null),this.viewParameters={realScale:Yr.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=v||null,this._supportsPinchToZoom=A!==!1}static get _keyboardManager(){const t=xn.prototype,e=a=>r(a,Vs).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),i=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},s=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return st(this,"_keyboardManager",new rf([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["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:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,Vs).contains(o)&&!a.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,Vs).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}destroy(){var t,e,i,s,n,a,o,l,c;(t=r(this,bi))==null||t.resolve(),f(this,bi,null),(e=r(this,dl))==null||e.abort(),f(this,dl,null),this._signal=null;for(const d of r(this,ne).values())d.destroy();r(this,ne).clear(),r(this,Ut).clear(),r(this,ba).clear(),(i=r(this,Yn))==null||i.clear(),f(this,Ue,null),r(this,ut).clear(),r(this,mi).destroy(),(s=r(this,ul))==null||s.destroy(),(n=r(this,pa))==null||n.destroy(),(a=r(this,Kn))==null||a.destroy(),(o=r(this,is))==null||o.hide(),f(this,is,null),(l=r(this,bl))==null||l.destroy(),f(this,bl,null),r(this,es)&&(clearTimeout(r(this,es)),f(this,es,null)),r(this,ss)&&(clearTimeout(r(this,ss)),f(this,ss,null)),(c=this._editorUndoBar)==null||c.destroy()}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return r(this,Kc)}get useNewAltTextFlow(){return r(this,Xc)}get useNewAltTextWhenAddingImage(){return r(this,pl)}get hcmFilter(){return st(this,"hcmFilter",r(this,Zn)?r(this,qc).addHCMFilter(r(this,Zn).foreground,r(this,Zn).background):"none")}get direction(){return st(this,"direction",getComputedStyle(r(this,Vs)).direction)}get _highlightColors(){return st(this,"_highlightColors",r(this,ml)?new Map(r(this,ml).split(",").map(t=>(t=t.split("=").map(e=>e.trim()),t[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){const{_highlightColors:t}=this;if(!t)return st(this,"highlightColors",null);const e=new Map,i=!!r(this,Zn);for(const[s,n]of t){const a=s.endsWith("_HCM");if(i&&a){e.set(s.replace("_HCM",""),n);continue}!i&&!a&&e.set(s,n)}return st(this,"highlightColors",e)}get highlightColorNames(){return st(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;const e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),f(this,Wn,t)}setMainHighlightColorPicker(t){f(this,bl,t)}editAltText(t,e=!1){var i;(i=r(this,ul))==null||i.editAltText(this,t,e)}hasCommentManager(){return!!r(this,pa)}editComment(t,e){var i;(i=r(this,pa))==null||i.open(this,t,e)}getSignature(t){var e;(e=r(this,Kn))==null||e.getSignature({uiManager:this,editor:t})}get signatureManager(){return r(this,Kn)}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":f(this,pl,e);break}}onPageChanging({pageNumber:t}){f(this,gl,t-1)}focusMainContainer(){r(this,Vs).focus()}findParent(t,e){for(const i of r(this,ne).values()){const{x:s,y:n,width:a,height:o}=i.div.getBoundingClientRect();if(t>=s&&t<=s+a&&e>=n&&e<=n+o)return i}return null}disableUserSelect(t=!1){r(this,Jc).classList.toggle("noUserSelect",t)}addShouldRescale(t){r(this,ba).add(t)}removeShouldRescale(t){r(this,ba).delete(t)}onScaleChanging({scale:t}){var e;this.commitOrRemove(),this.viewParameters.realScale=t*Yr.PDF_TO_CSS_UNITS;for(const i of r(this,ba))i.onScaleChanging();(e=r(this,Wn))==null||e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t=""){const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:i,anchorOffset:s,focusNode:n,focusOffset:a}=e,o=e.toString(),c=p(this,F,xf).call(this,e).closest(".textLayer"),d=this.getSelectionBoxes(c);if(!d)return;e.empty();const u=p(this,F,Up).call(this,c),g=r(this,Yt)===Y.NONE,b=()=>{u==null||u.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:i,anchorOffset:s,focusNode:n,focusOffset:a,text:o}),g&&this.showAllEditors("highlight",!0,!0)};if(g){this.switchToMode(Y.HIGHLIGHT,b);return}b()}addToAnnotationStorage(t){!t.isEmpty()&&r(this,Os)&&!r(this,Os).has(t.id)&&r(this,Os).setValue(t.id,t)}a11yAlert(t,e=null){const i=r(this,td);i&&(i.setAttribute("data-l10n-id",t),e?i.setAttribute("data-l10n-args",JSON.stringify(e)):i.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,r(this,Gn)&&(f(this,Gn,!1),p(this,F,Cf).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of r(this,ut))if(e.div.contains(t)){f(this,wa,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!r(this,wa))return;const[t,e]=r(this,wa);f(this,wa,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){p(this,F,Wp).call(this),p(this,F,zp).call(this)}removeEditListeners(){p(this,F,Ay).call(this),p(this,F,Gp).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const i of r(this,Ii))if(i.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const e of t.dataTransfer.items)for(const i of r(this,Ii))if(i.isHandlingMimeForPasting(e.type)){i.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var i;if(t.preventDefault(),(i=r(this,Ue))==null||i.commitOrRemove(),!this.hasSelection)return;const e=[];for(const s of r(this,ut)){const n=s.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,Ii))if(a.isHandlingMimeForPasting(n.type)){a.paste(n,this.currentLayer);return}let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(n){Z('paste: "'.concat(n.message,'".'));return}if(!Array.isArray(i))return;this.unselectAll();const s=this.currentLayer;try{const n=[];for(const l of i){const c=await s.deserialize(l);if(!c)return;n.push(c)}const a=()=>{for(const l of n)p(this,F,Xp).call(this,l);p(this,F,qp).call(this,n)},o=()=>{for(const l of n)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(n){Z('paste: "'.concat(n.message,'".'))}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),r(this,Yt)!==Y.NONE&&!this.isEditorHandlingKeyboard&&xn._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,r(this,Gn)&&(f(this,Gn,!1),p(this,F,Cf).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?(p(this,F,yy).call(this),p(this,F,zp).call(this),p(this,F,Ae).call(this,{isEditing:r(this,Yt)!==Y.NONE,isEmpty:p(this,F,tc).call(this),hasSomethingToUndo:r(this,mi).hasSomethingToUndo(),hasSomethingToRedo:r(this,mi).hasSomethingToRedo(),hasSelectedEditor:!1})):(p(this,F,_y).call(this),p(this,F,Gp).call(this),p(this,F,Ae).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!r(this,Ii)){f(this,Ii,t);for(const e of r(this,Ii))p(this,F,Ls).call(this,e.defaultPropertiesToUpdate)}}getId(){return r(this,Dg).id}get currentLayer(){return r(this,ne).get(r(this,gl))}getLayer(t){return r(this,ne).get(t)}get currentPageIndex(){return r(this,gl)}addLayer(t){r(this,ne).set(t.pageIndex,t),r(this,Xn)?t.enable():t.disable()}removeLayer(t){r(this,ne).delete(t.pageIndex)}async updateMode(t,e=null,i=!1,s=!1,n=!1){var a,o,l;if(r(this,Yt)!==t&&!(r(this,bi)&&(await r(this,bi).promise,!r(this,bi)))){if(f(this,bi,Promise.withResolvers()),(a=r(this,Wn))==null||a.commitOrRemove(),f(this,Yt,t),t===Y.NONE){this.setEditingState(!1),p(this,F,Py).call(this),(o=this._editorUndoBar)==null||o.hide(),r(this,bi).resolve();return}t===Y.SIGNATURE&&await((l=r(this,Kn))==null?void 0:l.loadSignatures()),this.setEditingState(!0),await p(this,F,Sy).call(this),this.unselectAll();for(const c of r(this,ne).values())c.updateMode(t);if(!e){i&&this.addNewEditorFromKeyboard(),r(this,bi).resolve();return}for(const c of r(this,Ut).values())c.annotationElementId===e||c.id===e?(this.setSelected(c),n?c.editComment():s&&c.enterInEditMode()):c.unselect();r(this,bi).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==r(this,Yt)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(r(this,Ii)){switch(t){case nt.CREATE:this.currentLayer.addNewEditor(e);return;case nt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(r(this,Zc)||f(this,Zc,new Map)).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(const i of r(this,ut))i.updateParams(t,e);else for(const i of r(this,Ii))i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){var n,a;for(const o of r(this,Ut).values())o.editorType===t&&o.show(e);((a=(n=r(this,Zc))==null?void 0:n.get(nt.HIGHLIGHT_SHOW_ALL))!=null?a:!0)!==e&&p(this,F,Ls).call(this,[[nt.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(r(this,Yc)!==t){f(this,Yc,t);for(const e of r(this,ne).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const i of r(this,Ut).values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return r(this,Ut).get(t)}addEditor(t){r(this,Ut).set(t.id,t)}removeEditor(t){var e,i;t.div.contains(document.activeElement)&&(r(this,es)&&clearTimeout(r(this,es)),f(this,es,setTimeout(()=>{this.focusMainContainer(),f(this,es,null)},0))),r(this,Ut).delete(t.id),t.annotationElementId&&((e=r(this,Yn))==null||e.delete(t.annotationElementId)),this.unselect(t),(!t.annotationElementId||!r(this,ma).has(t.annotationElementId))&&((i=r(this,Os))==null||i.remove(t.id))}addDeletedAnnotationElement(t){r(this,ma).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return r(this,ma).has(t)}removeDeletedAnnotationElement(t){r(this,ma).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){r(this,Ue)!==t&&(f(this,Ue,t),t&&p(this,F,Ls).call(this,t.propertiesToUpdate))}updateUI(t){r(this,F,xy)===t&&p(this,F,Ls).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){p(this,F,Ls).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(r(this,ut).has(t)){r(this,ut).delete(t),t.unselect(),p(this,F,Ae).call(this,{hasSelectedEditor:this.hasSelection});return}r(this,ut).add(t),t.select(),p(this,F,Ls).call(this,t.propertiesToUpdate),p(this,F,Ae).call(this,{hasSelectedEditor:!0})}setSelected(t){var e;this.updateToolbar({mode:t.mode,editId:t.id}),(e=r(this,Wn))==null||e.commitOrRemove();for(const i of r(this,ut))i!==t&&i.unselect();r(this,ut).clear(),r(this,ut).add(t),t.select(),p(this,F,Ls).call(this,t.propertiesToUpdate),p(this,F,Ae).call(this,{hasSelectedEditor:!0})}isSelected(t){return r(this,ut).has(t)}get firstSelectedEditor(){return r(this,ut).values().next().value}unselect(t){t.unselect(),r(this,ut).delete(t),p(this,F,Ae).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return r(this,ut).size!==0}get isEnterHandled(){return r(this,ut).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var t;r(this,mi).undo(),p(this,F,Ae).call(this,{hasSomethingToUndo:r(this,mi).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:p(this,F,tc).call(this)}),(t=this._editorUndoBar)==null||t.hide()}redo(){r(this,mi).redo(),p(this,F,Ae).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:r(this,mi).hasSomethingToRedo(),isEmpty:p(this,F,tc).call(this)})}addCommands(t){r(this,mi).add(t),p(this,F,Ae).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:p(this,F,tc).call(this)})}cleanUndoStack(t){r(this,mi).cleanType(t)}delete(){var n;this.commitOrRemove();const t=(n=this.currentLayer)==null?void 0:n.endDrawingSession(!0);if(!this.hasSelection&&!t)return;const e=t?[t]:[...r(this,ut)],i=()=>{var a;(a=this._editorUndoBar)==null||a.show(s,e.length===1?e[0].editorType:e.length);for(const o of e)o.remove()},s=()=>{for(const a of e)p(this,F,Xp).call(this,a)};this.addCommands({cmd:i,undo:s,mustExec:!0})}commitOrRemove(){var t;(t=r(this,Ue))==null||t.commitOrRemove()}hasSomethingToControl(){return r(this,Ue)||this.hasSelection}selectAll(){for(const t of r(this,ut))t.commit();p(this,F,qp).call(this,r(this,Ut).values())}unselectAll(){var t;if(!(r(this,Ue)&&(r(this,Ue).commitOrRemove(),r(this,Yt)!==Y.NONE))&&!((t=r(this,Wn))!=null&&t.commitOrRemove())&&this.hasSelection){for(const e of r(this,ut))e.unselect();r(this,ut).clear(),p(this,F,Ae).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;r(this,Qn)[0]+=t,r(this,Qn)[1]+=e;const[s,n]=r(this,Qn),a=[...r(this,ut)],o=1e3;r(this,ss)&&clearTimeout(r(this,ss)),f(this,ss,setTimeout(()=>{f(this,ss,null),r(this,Qn)[0]=r(this,Qn)[1]=0,this.addCommands({cmd:()=>{for(const l of a)r(this,Ut).has(l.id)&&(l.translateInPage(s,n),l.translationDone())},undo:()=>{for(const l of a)r(this,Ut).has(l.id)&&(l.translateInPage(-s,-n),l.translationDone())},mustExec:!1})},o));for(const l of a)l.translateInPage(t,e),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),f(this,ts,new Map);for(const t of r(this,ut))r(this,ts).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!r(this,ts))return!1;this.disableUserSelect(!1);const t=r(this,ts);f(this,ts,null);let e=!1;for(const[{x:s,y:n,pageIndex:a},o]of t)o.newX=s,o.newY=n,o.newPageIndex=a,e||(e=s!==o.savedX||n!==o.savedY||a!==o.savedPageIndex);if(!e)return!1;const i=(s,n,a,o)=>{if(r(this,Ut).has(s.id)){const l=r(this,ne).get(o);l?s._setParentAndPosition(l,n,a):(s.pageIndex=o,s.x=n,s.y=a)}};return this.addCommands({cmd:()=>{for(const[s,{newX:n,newY:a,newPageIndex:o}]of t)i(s,n,a,o)},undo:()=>{for(const[s,{savedX:n,savedY:a,savedPageIndex:o}]of t)i(s,n,a,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(r(this,ts))for(const i of r(this,ts).keys())i.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,ut).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return r(this,Ue)===t}getActive(){return r(this,Ue)}getMode(){return r(this,Yt)}get imageManager(){return st(this,"imageManager",new jp)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let c=0,d=e.rangeCount;c<d;c++)if(!t.contains(e.getRangeAt(c).commonAncestorContainer))return null;const{x:i,y:s,width:n,height:a}=t.getBoundingClientRect();let o;switch(t.getAttribute("data-main-rotation")){case"90":o=(c,d,u,g)=>({x:(d-s)/a,y:1-(c+u-i)/n,width:g/a,height:u/n});break;case"180":o=(c,d,u,g)=>({x:1-(c+u-i)/n,y:1-(d+g-s)/a,width:u/n,height:g/a});break;case"270":o=(c,d,u,g)=>({x:1-(d+g-s)/a,y:(c-i)/n,width:g/a,height:u/n});break;default:o=(c,d,u,g)=>({x:(c-i)/n,y:(d-s)/a,width:u/n,height:g/a});break}const l=[];for(let c=0,d=e.rangeCount;c<d;c++){const u=e.getRangeAt(c);if(!u.collapsed)for(const{x:g,y:b,width:w,height:v}of u.getClientRects())w===0||v===0||l.push(o(g,b,w,v))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:t,id:e}){(r(this,fl)||f(this,fl,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;(e=r(this,fl))==null||e.delete(t)}renderAnnotationElement(t){var s;const e=(s=r(this,fl))==null?void 0:s.get(t.data.id);if(!e)return;const i=r(this,Os).getRawValue(e);i&&(r(this,Yt)===Y.NONE&&!i.hasBeenModified||i.renderAnnotationElement(t))}setMissingCanvas(t,e,i){var n;const s=(n=r(this,Yn))==null?void 0:n.get(t);s&&(s.setCanvas(e,i),r(this,Yn).delete(t))}addMissingCanvas(t,e){(r(this,Yn)||f(this,Yn,new Map)).set(t,e)}},dl=new WeakMap,Ue=new WeakMap,Ut=new WeakMap,ne=new WeakMap,ul=new WeakMap,Os=new WeakMap,fl=new WeakMap,mi=new WeakMap,pa=new WeakMap,Un=new WeakMap,Wn=new WeakMap,gl=new WeakMap,ma=new WeakMap,ts=new WeakMap,Ii=new WeakMap,ba=new WeakMap,Gc=new WeakMap,Xc=new WeakMap,pl=new WeakMap,qc=new WeakMap,es=new WeakMap,zn=new WeakMap,ml=new WeakMap,Gn=new WeakMap,is=new WeakMap,Dg=new WeakMap,Xn=new WeakMap,Yc=new WeakMap,qn=new WeakMap,wa=new WeakMap,bl=new WeakMap,Yn=new WeakMap,Kc=new WeakMap,Yt=new WeakMap,ut=new WeakMap,Bs=new WeakMap,Kn=new WeakMap,Zn=new WeakMap,Zc=new WeakMap,Qc=new WeakMap,Qn=new WeakMap,ss=new WeakMap,Vs=new WeakMap,Jc=new WeakMap,td=new WeakMap,bi=new WeakMap,F=new WeakSet,xf=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},Up=function(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const i of r(this,ne).values())if(i.hasTextLayer(t))return i;return null},by=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const i=p(this,F,xf).call(this,t).closest(".textLayer"),s=this.getSelectionBoxes(i);s&&(r(this,is)||f(this,is,new yE(this)),r(this,is).show(i,s,this.direction==="ltr"))},wy=function(){var n,a,o;const t=document.getSelection();if(!t||t.isCollapsed){r(this,Bs)&&((n=r(this,is))==null||n.hide(),f(this,Bs,null),p(this,F,Ae).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=t;if(e===r(this,Bs))return;const s=p(this,F,xf).call(this,t).closest(".textLayer");if(!s){r(this,Bs)&&((a=r(this,is))==null||a.hide(),f(this,Bs,null),p(this,F,Ae).call(this,{hasSelectedText:!1}));return}if((o=r(this,is))==null||o.hide(),f(this,Bs,e),p(this,F,Ae).call(this,{hasSelectedText:!0}),!(r(this,Yt)!==Y.HIGHLIGHT&&r(this,Yt)!==Y.NONE)&&(r(this,Yt)===Y.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),f(this,Gn,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=r(this,Yt)===Y.HIGHLIGHT?p(this,F,Up).call(this,s):null;l==null||l.toggleDrawing();const c=new AbortController,d=this.combinedSignal(c),u=g=>{g.type==="pointerup"&&g.button!==0||(c.abort(),l==null||l.toggleDrawing(!0),g.type==="pointerup"&&p(this,F,Cf).call(this,"main_toolbar"))};window.addEventListener("pointerup",u,{signal:d}),window.addEventListener("blur",u,{signal:d})}},Cf=function(t=""){r(this,Yt)===Y.HIGHLIGHT?this.highlightSelection(t):r(this,Gc)&&p(this,F,by).call(this)},vy=function(){document.addEventListener("selectionchange",p(this,F,wy).bind(this),{signal:this._signal})},yy=function(){if(r(this,zn))return;f(this,zn,new AbortController);const t=this.combinedSignal(r(this,zn));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},_y=function(){var t;(t=r(this,zn))==null||t.abort(),f(this,zn,null)},Wp=function(){if(r(this,qn))return;f(this,qn,new AbortController);const t=this.combinedSignal(r(this,qn));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},Ay=function(){var t;(t=r(this,qn))==null||t.abort(),f(this,qn,null)},zp=function(){if(r(this,Un))return;f(this,Un,new AbortController);const t=this.combinedSignal(r(this,Un));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})},Gp=function(){var t;(t=r(this,Un))==null||t.abort(),f(this,Un,null)},Ey=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},Ae=function(t){Object.entries(t).some(([i,s])=>r(this,Qc)[i]!==s)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(r(this,Qc),t)}),r(this,Yt)===Y.HIGHLIGHT&&t.hasSelectedEditor===!1&&p(this,F,Ls).call(this,[[nt.HIGHLIGHT_FREE,!0]]))},Ls=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},Sy=async function(){if(!r(this,Xn)){f(this,Xn,!0);const t=[];for(const e of r(this,ne).values())t.push(e.enable());await Promise.all(t);for(const e of r(this,Ut).values())e.enable()}},Py=function(){if(this.unselectAll(),r(this,Xn)){f(this,Xn,!1);for(const t of r(this,ne).values())t.disable();for(const t of r(this,Ut).values())t.disable()}},Xp=function(t){const e=r(this,ne).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},xy=function(){let t=null;for(t of r(this,ut));return t},tc=function(){if(r(this,Ut).size===0)return!0;if(r(this,Ut).size===1)for(const t of r(this,Ut).values())return t.isEmpty();return!1},qp=function(t){for(const e of r(this,ut))e.unselect();r(this,ut).clear();for(const e of t)e.isEmpty()||(r(this,ut).add(e),e.select());p(this,F,Ae).call(this,{hasSelectedEditor:this.hasSelection})},k(xn,"TRANSLATE_SMALL",1),k(xn,"TRANSLATE_BIG",10),xn);var Kt,ns,Li,wl,rs,We,vl,as,De,Hs,va,os,Jn,Gi,ec,Tf;const Ee=class Ee{constructor(t){m(this,Gi);m(this,Kt,null);m(this,ns,!1);m(this,Li,null);m(this,wl,null);m(this,rs,null);m(this,We,null);m(this,vl,!1);m(this,as,null);m(this,De,null);m(this,Hs,null);m(this,va,null);m(this,os,!1);f(this,De,t),f(this,os,t._uiManager.useNewAltTextFlow),r(Ee,Jn)||f(Ee,Jn,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){var e;(e=Ee._l10n)!=null||(Ee._l10n=t)}async render(){const t=f(this,Li,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=f(this,wl,document.createElement("span"));t.append(e),r(this,os)?(t.classList.add("new"),t.setAttribute("data-l10n-id",r(Ee,Jn).missing),e.setAttribute("data-l10n-id",r(Ee,Jn)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const i=r(this,De)._uiManager._signal;t.addEventListener("contextmenu",Ci,{signal:i}),t.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:i});const s=n=>{n.preventDefault(),r(this,De)._uiManager.editAltText(r(this,De)),r(this,os)&&r(this,De)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:r(this,Gi,ec)}})};return t.addEventListener("click",s,{capture:!0,signal:i}),t.addEventListener("keydown",n=>{n.target===t&&n.key==="Enter"&&(f(this,vl,!0),s(n))},{signal:i}),await p(this,Gi,Tf).call(this),t}finish(){r(this,Li)&&(r(this,Li).focus({focusVisible:r(this,vl)}),f(this,vl,!1))}isEmpty(){return r(this,os)?r(this,Kt)===null:!r(this,Kt)&&!r(this,ns)}hasData(){return r(this,os)?r(this,Kt)!==null||!!r(this,Hs):this.isEmpty()}get guessedText(){return r(this,Hs)}async setGuessedText(t){r(this,Kt)===null&&(f(this,Hs,t),f(this,va,await Ee._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),p(this,Gi,Tf).call(this))}toggleAltTextBadge(t=!1){var e;if(!r(this,os)||r(this,Kt)){(e=r(this,as))==null||e.remove(),f(this,as,null);return}if(!r(this,as)){const i=f(this,as,document.createElement("div"));i.className="noAltTextBadge",r(this,De).div.append(i)}r(this,as).classList.toggle("hidden",!t)}serialize(t){let e=r(this,Kt);return!t&&r(this,Hs)===e&&(e=r(this,va)),{altText:e,decorative:r(this,ns),guessedText:r(this,Hs),textWithDisclaimer:r(this,va)}}get data(){return{altText:r(this,Kt),decorative:r(this,ns)}}set data({altText:t,decorative:e,guessedText:i,textWithDisclaimer:s,cancel:n=!1}){i&&(f(this,Hs,i),f(this,va,s)),!(r(this,Kt)===t&&r(this,ns)===e)&&(n||(f(this,Kt,t),f(this,ns,e)),p(this,Gi,Tf).call(this))}toggle(t=!1){r(this,Li)&&(!t&&r(this,We)&&(clearTimeout(r(this,We)),f(this,We,null)),r(this,Li).disabled=!t)}shown(){r(this,De)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:r(this,Gi,ec)}})}destroy(){var t,e;(t=r(this,Li))==null||t.remove(),f(this,Li,null),f(this,wl,null),f(this,rs,null),(e=r(this,as))==null||e.remove(),f(this,as,null)}};Kt=new WeakMap,ns=new WeakMap,Li=new WeakMap,wl=new WeakMap,rs=new WeakMap,We=new WeakMap,vl=new WeakMap,as=new WeakMap,De=new WeakMap,Hs=new WeakMap,va=new WeakMap,os=new WeakMap,Jn=new WeakMap,Gi=new WeakSet,ec=function(){return r(this,Kt)&&"added"||r(this,Kt)===null&&this.guessedText&&"review"||"missing"},Tf=async function(){var s,n,a;const t=r(this,Li);if(!t)return;if(r(this,os)){if(t.classList.toggle("done",!!r(this,Kt)),t.setAttribute("data-l10n-id",r(Ee,Jn)[r(this,Gi,ec)]),(s=r(this,wl))==null||s.setAttribute("data-l10n-id",r(Ee,Jn)["".concat(r(this,Gi,ec),"-label")]),!r(this,Kt)){(n=r(this,rs))==null||n.remove();return}}else{if(!r(this,Kt)&&!r(this,ns)){t.classList.remove("done"),(a=r(this,rs))==null||a.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=r(this,rs);if(!e){f(this,rs,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id="alt-text-tooltip-".concat(r(this,De).id);const o=100,l=r(this,De)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(r(this,We)),f(this,We,null)},{once:!0}),t.addEventListener("mouseenter",()=>{f(this,We,setTimeout(()=>{f(this,We,null),r(this,rs).classList.add("show"),r(this,De)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),t.addEventListener("mouseleave",()=>{var c;r(this,We)&&(clearTimeout(r(this,We)),f(this,We,null)),(c=r(this,rs))==null||c.classList.remove("show")},{signal:l})}r(this,ns)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=r(this,Kt)),e.parentNode||t.append(e);const i=r(this,De).getElementForAltText();i==null||i.setAttribute("aria-describedby",e.id)},m(Ee,Jn,null),k(Ee,"_l10n",null);let yg=Ee;var ls,ya,Ri,ed,js,yl,tr;class hf{constructor(t){m(this,ls,null);m(this,ya,!1);m(this,Ri,null);m(this,ed,null);m(this,js,null);m(this,yl,null);m(this,tr,!1);f(this,Ri,t),this.toolbar=null}render(){if(!r(this,Ri)._uiManager.hasCommentManager())return null;const t=f(this,ls,document.createElement("button"));t.className="comment",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button");const e=r(this,Ri)._uiManager._signal;t.addEventListener("contextmenu",Ci,{signal:e}),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:e});const i=s=>{s.preventDefault(),this.edit()};return t.addEventListener("click",i,{capture:!0,signal:e}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(f(this,ya,!0),i(s))},{signal:e}),t}edit(){const{bottom:t,left:e,right:i}=r(this,Ri).getClientDimensions(),s={top:t};r(this,Ri)._uiManager.direction==="ltr"?s.right=i:s.left=e,r(this,Ri)._uiManager.editComment(r(this,Ri),s)}finish(){r(this,ls)&&(r(this,ls).focus({focusVisible:r(this,ya)}),f(this,ya,!1))}isDeleted(){return r(this,tr)||r(this,js)===""}hasBeenEdited(){return this.isDeleted()||r(this,js)!==r(this,ed)}serialize(){return this.data}get data(){return{text:r(this,js),date:r(this,yl),deleted:r(this,tr)}}set data(t){if(t===null){f(this,js,""),f(this,tr,!0);return}f(this,js,t),f(this,yl,new Date),f(this,tr,!1)}setInitialText(t){f(this,ed,t),this.data=t}toggle(t=!1){r(this,ls)&&(r(this,ls).disabled=!t)}shown(){}destroy(){var t;(t=r(this,ls))==null||t.remove(),f(this,ls,null),f(this,js,""),f(this,yl,null),f(this,Ri,null),f(this,ya,!1),f(this,tr,!1)}}ls=new WeakMap,ya=new WeakMap,Ri=new WeakMap,ed=new WeakMap,js=new WeakMap,yl=new WeakMap,tr=new WeakMap;var _l,_a,id,sd,nd,rd,ad,$s,Aa,Us,Ea,Ws,Qr,Ty,Iy,Ly,Al;let Cy=(Al=class{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:i=null,onPinchStart:s=null,onPinching:n=null,onPinchEnd:a=null,signal:o}){m(this,Qr);m(this,_l);m(this,_a,!1);m(this,id,null);m(this,sd);m(this,nd);m(this,rd);m(this,ad);m(this,$s,null);m(this,Aa);m(this,Us,null);m(this,Ea);m(this,Ws,null);f(this,_l,t),f(this,id,i),f(this,sd,e),f(this,nd,s),f(this,rd,n),f(this,ad,a),f(this,Ea,new AbortController),f(this,Aa,AbortSignal.any([o,r(this,Ea).signal])),t.addEventListener("touchstart",p(this,Qr,Ty).bind(this),{passive:!1,signal:r(this,Aa)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/ko.pixelRatio}destroy(){var t,e;(t=r(this,Ea))==null||t.abort(),f(this,Ea,null),(e=r(this,$s))==null||e.abort(),f(this,$s,null)}},_l=new WeakMap,_a=new WeakMap,id=new WeakMap,sd=new WeakMap,nd=new WeakMap,rd=new WeakMap,ad=new WeakMap,$s=new WeakMap,Aa=new WeakMap,Us=new WeakMap,Ea=new WeakMap,Ws=new WeakMap,Qr=new WeakSet,Ty=function(t){var s,n,a;if((s=r(this,sd))!=null&&s.call(this))return;if(t.touches.length===1){if(r(this,$s))return;const o=f(this,$s,new AbortController),l=AbortSignal.any([r(this,Aa),o.signal]),c=r(this,_l),d={capture:!0,signal:l,passive:!1},u=g=>{var b;g.pointerType==="touch"&&((b=r(this,$s))==null||b.abort(),f(this,$s,null))};c.addEventListener("pointerdown",g=>{g.pointerType==="touch"&&(Vt(g),u(g))},d),c.addEventListener("pointerup",u,d),c.addEventListener("pointercancel",u,d);return}if(!r(this,Ws)){f(this,Ws,new AbortController);const o=AbortSignal.any([r(this,Aa),r(this,Ws).signal]),l=r(this,_l),c={signal:o,capture:!1,passive:!1};l.addEventListener("touchmove",p(this,Qr,Iy).bind(this),c);const d=p(this,Qr,Ly).bind(this);l.addEventListener("touchend",d,c),l.addEventListener("touchcancel",d,c),c.capture=!0,l.addEventListener("pointerdown",Vt,c),l.addEventListener("pointermove",Vt,c),l.addEventListener("pointercancel",Vt,c),l.addEventListener("pointerup",Vt,c),(n=r(this,nd))==null||n.call(this)}if(Vt(t),t.touches.length!==2||(a=r(this,id))!=null&&a.call(this)){f(this,Us,null);return}let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]),f(this,Us,{touch0X:e.screenX,touch0Y:e.screenY,touch1X:i.screenX,touch1Y:i.screenY})},Iy=function(t){var E;if(!r(this,Us)||t.touches.length!==2)return;Vt(t);let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]);const{screenX:s,screenY:n}=e,{screenX:a,screenY:o}=i,l=r(this,Us),{touch0X:c,touch0Y:d,touch1X:u,touch1Y:g}=l,b=u-c,w=g-d,v=a-s,A=o-n,y=Math.hypot(v,A)||1,S=Math.hypot(b,w)||1;if(!r(this,_a)&&Math.abs(S-y)<=Al.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=s,l.touch0Y=n,l.touch1X=a,l.touch1Y=o,!r(this,_a)){f(this,_a,!0);return}const _=[(s+a)/2,(n+o)/2];(E=r(this,rd))==null||E.call(this,_,S,y)},Ly=function(t){var e;t.touches.length>=2||(r(this,Ws)&&(r(this,Ws).abort(),f(this,Ws,null),(e=r(this,ad))==null||e.call(this)),r(this,Us)&&(Vt(t),f(this,Us,null),f(this,_a,!1)))},Al);var Sa,Mi,At,re,El,er,od,Pa,ae,xa,zs,ir,ld,Ca,ze,hd,Ta,Gs,hs,Sl,Pl,wi,Ia,cd,Ng,K,Yp,dd,Kp,If,Ry,My,Zp,Lf,Qp,ky,Dy,Ny,Jp,Fy,tm,Oy,By,Vy,em,ic;const et=class et{constructor(t){m(this,K);m(this,Sa,null);m(this,Mi,null);m(this,At,null);m(this,re,null);m(this,El,!1);m(this,er,null);m(this,od,"");m(this,Pa,!1);m(this,ae,null);m(this,xa,null);m(this,zs,null);m(this,ir,null);m(this,ld,"");m(this,Ca,!1);m(this,ze,null);m(this,hd,!1);m(this,Ta,!1);m(this,Gs,!1);m(this,hs,null);m(this,Sl,0);m(this,Pl,0);m(this,wi,null);m(this,Ia,null);k(this,"isSelected",!1);k(this,"_isCopy",!1);k(this,"_editToolbar",null);k(this,"_initialOptions",Object.create(null));k(this,"_initialData",null);k(this,"_isVisible",!0);k(this,"_uiManager",null);k(this,"_focusEventsAllowed",!0);m(this,cd,!1);m(this,Ng,et._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,this.annotationElementId=t.annotationElementId||null;const{rotation:e,rawDims:{pageWidth:i,pageHeight:s,pageX:n,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[n,a];const[o,l]=this.parentDimensions;this.x=t.x/o,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=et.prototype._resizeWithKeyboard,e=Nc.TRANSLATE_SMALL,i=Nc.TRANSLATE_BIG;return st(this,"_resizerKeyboardManager",new rf([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],et.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return st(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new EE({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){var s;if((s=et._l10n)!=null||(et._l10n=t),et._l10nResizer||(et._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"})),et._borderLineWidth!==-1)return;const i=getComputedStyle(document.documentElement);et._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){pt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return r(this,cd)}set _isDraggable(t){var e;f(this,cd,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,Ng)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):p(this,K,ic).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&(r(this,Ca)?f(this,Ca,!1):this.parent.setSelected(this))}focusout(t){var i;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const e=t.relatedTarget;e!=null&&e.closest("#".concat(this.id))||(t.preventDefault(),(i=this.parent)!=null&&i.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,s){const[n,a]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(t+i)/n,this.y=(e+s)/a,this.fixAndSetPosition()}_moveAfterPaste(t,e){const[i,s]=this.parentDimensions;this.setAt(t*i,e*s,this.width*i,this.height*s),this._onTranslated()}translate(t,e){p(this,K,Yp).call(this,this.parentDimensions,t,e)}translateInPage(t,e){r(this,ze)||f(this,ze,[this.x,this.y,this.width,this.height]),p(this,K,Yp).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){r(this,ze)||f(this,ze,[this.x,this.y,this.width,this.height]);const{div:i,parentDimensions:[s,n]}=this;if(this.x+=t/s,this.y+=e/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:g}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,g)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this;const[l,c]=this.getBaseTranslation();a+=l,o+=c;const{style:d}=i;d.left="".concat((100*a).toFixed(2),"%"),d.top="".concat((100*o).toFixed(2),"%"),this._onTranslating(a,o),i.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!r(this,ze)&&(r(this,ze)[0]!==this.x||r(this,ze)[1]!==this.y)}get _hasBeenResized(){return!!r(this,ze)&&(r(this,ze)[2]!==this.width||r(this,ze)[3]!==this.height)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:i}=et,s=i/t,n=i/e;switch(this.rotation){case 90:return[-s,n];case 180:return[s,n];case 270:return[s,-n];default:return[-s,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const{div:{style:e},pageDimensions:[i,s]}=this;let{x:n,y:a,width:o,height:l}=this;if(o*=i,l*=s,n*=i,a*=s,this._mustFixPosition)switch(t){case 0:n=Le(n,0,i-o),a=Le(a,0,s-l);break;case 90:n=Le(n,0,i-l),a=Le(a,o,s);break;case 180:n=Le(n,o,i),a=Le(a,l,s);break;case 270:n=Le(n,l,i),a=Le(a,0,s-o);break}this.x=n/=i,this.y=a/=s;const[c,d]=this.getBaseTranslation();n+=c,a+=d,e.left="".concat((100*n).toFixed(2),"%"),e.top="".concat((100*a).toFixed(2),"%"),this.moveInDOM()}screenToPageTranslation(t,e){var i;return p(i=et,dd,Kp).call(i,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var i;return p(i=et,dd,Kp).call(i,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,i]}=this;return[e*t,i*t]}setDims(t,e){const[i,s]=this.parentDimensions,{style:n}=this.div;n.width="".concat((100*t/i).toFixed(2),"%"),r(this,Pa)||(n.height="".concat((100*e/s).toFixed(2),"%"))}fixDims(){const{style:t}=this.div,{height:e,width:i}=t,s=i.endsWith("%"),n=!r(this,Pa)&&e.endsWith("%");if(s&&n)return;const[a,o]=this.parentDimensions;s||(t.width="".concat((100*parseFloat(i)/a).toFixed(2),"%")),!r(this,Pa)&&!n&&(t.height="".concat((100*parseFloat(e)/o).toFixed(2),"%"))}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(t*1e4)/1e4}_onResizing(){}altTextFinish(){var t;(t=r(this,At))==null||t.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||r(this,Ta))return this._editToolbar;this._editToolbar=new Hp(this),this.div.append(this._editToolbar.render()),this._editToolbar.addButton("comment",this.addCommentButton());const{toolbarButtons:t}=this;if(t)for(const[e,i]of t)await this._editToolbar.addButton(e,i);return this._editToolbar.addButton("delete"),this._editToolbar}removeEditToolbar(){var t;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(t=r(this,At))==null||t.destroy())}addContainer(t){var i;const e=(i=this._editToolbar)==null?void 0:i.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return r(this,At)||(yg.initialize(et._l10n),f(this,At,new yg(this)),r(this,Sa)&&(r(this,At).data=r(this,Sa),f(this,Sa,null))),r(this,At)}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,e;return(e=(t=r(this,At))==null?void 0:t.hasData())!=null?e:!1}addCommentButton(){return r(this,re)?r(this,re):f(this,re,new hf(this))}get commentColor(){return null}get comment(){const t=r(this,re);return{text:t.data.text,date:t.data.date,deleted:t.isDeleted(),color:this.commentColor}}set comment(t){r(this,re)||f(this,re,new hf(this)),r(this,re).data=t}setCommentData(t){r(this,re)||f(this,re,new hf(this)),r(this,re).setInitialText(t)}get hasEditedComment(){var t;return(t=r(this,re))==null?void 0:t.hasBeenEdited()}async editComment(){r(this,re)||f(this,re,new hf(this)),r(this,re).edit()}addComment(t){this.hasEditedComment&&(t.popup={contents:this.comment.text,deleted:this.comment.deleted})}render(){var a;const t=this.div=document.createElement("div");t.setAttribute("data-editor-rotation",(360-this.rotation)%360),t.className=this.name,t.setAttribute("id",this.id),t.tabIndex=r(this,El)?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),p(this,K,tm).call(this);const[e,i]=this.parentDimensions;this.parentRotation%180!==0&&(t.style.maxWidth="".concat((100*i/e).toFixed(2),"%"),t.style.maxHeight="".concat((100*e/i).toFixed(2),"%"));const[s,n]=this.getInitialTranslation();return this.translate(s,n),py(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(r(this,Ia)||f(this,Ia,new Cy({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:p(this,K,ky).bind(this),onPinching:p(this,K,Dy).bind(this),onPinchEnd:p(this,K,Ny).bind(this),signal:this._uiManager._signal}))),(a=this._uiManager._editorUndoBar)==null||a.hide(),t}pointerdown(t){const{isMac:e}=pe.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(f(this,Ca,!0),this._isDraggable){p(this,K,Fy).call(this,t);return}p(this,K,Jp).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){r(this,hs)&&clearTimeout(r(this,hs)),f(this,hs,setTimeout(()=>{var t;f(this,hs,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,i=this.rotation){const s=this.parentScale,[n,a]=this.pageDimensions,[o,l]=this.pageTranslation,c=t/s,d=e/s,u=this.x*n,g=this.y*a,b=this.width*n,w=this.height*a;switch(i){case 0:return[u+c+o,a-g-d-w+l,u+c+b+o,a-g-d+l];case 90:return[u+d+o,a-g+c+l,u+d+w+o,a-g+c+b+l];case 180:return[u-c-b+o,a-g+d+l,u-c+o,a-g+d+w+l];case 270:return[u-d-w+o,a-g-c-b+l,u-d+o,a-g-c+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,s,n,a]=t,o=n-i,l=a-s;switch(this.rotation){case 0:return[i,e-a,o,l];case 90:return[i,e-s,l,o];case 180:return[n,e-s,o,l];case 270:return[n,e-a,l,o];default:throw new Error("Invalid rotation")}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),f(this,Ta,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),f(this,Ta,!1),!0):!1}isInEditMode(){return r(this,Ta)}shouldGetKeyboardEvents(){return r(this,Gs)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:t,left:e,bottom:i,right:s}=this.getClientDimensions(),{innerHeight:n,innerWidth:a}=window;return e<a&&s>0&&t<n&&i>0}rebuild(){p(this,K,tm).call(this)}rotate(t){}resize(){}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){pt("An editor must be serializable")}static async deserialize(t,e,i){const s=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i,annotationElementId:t.annotationElementId});s.rotation=t.rotation,f(s,Sa,t.accessibilityData),s._isCopy=t.isCopy||!1;const[n,a]=s.pageDimensions,[o,l,c,d]=s.getRectInCurrentCoords(t.rect,a);return s.x=o/n,s.y=l/a,s.width=c/n,s.height=d/a,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var t,e;if((t=r(this,ir))==null||t.abort(),f(this,ir,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),r(this,hs)&&(clearTimeout(r(this,hs)),f(this,hs,null)),p(this,K,ic).call(this),this.removeEditToolbar(),r(this,wi)){for(const i of r(this,wi).values())clearTimeout(i);f(this,wi,null)}this.parent=null,(e=r(this,Ia))==null||e.destroy(),f(this,Ia,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(p(this,K,Ry).call(this),r(this,ae).classList.remove("hidden"))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),f(this,zs,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=r(this,ae).children;if(!r(this,Mi)){f(this,Mi,Array.from(e));const a=p(this,K,Oy).bind(this),o=p(this,K,By).bind(this),l=this._uiManager._signal;for(const c of r(this,Mi)){const d=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",a,{signal:l}),c.addEventListener("blur",o,{signal:l}),c.addEventListener("focus",p(this,K,Vy).bind(this,d),{signal:l}),c.setAttribute("data-l10n-id",et._l10nResizer[d])}}const i=r(this,Mi)[0];let s=0;for(const a of e){if(a===i)break;s++}const n=(360-this.rotation+this.parentRotation)%360/90*(r(this,Mi).length/4);if(n!==s){if(n<s)for(let o=0;o<s-n;o++)r(this,ae).append(r(this,ae).firstChild);else if(n>s)for(let o=0;o<n-s;o++)r(this,ae).firstChild.before(r(this,ae).lastChild);let a=0;for(const o of e){const c=r(this,Mi)[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",et._l10nResizer[c])}}p(this,K,em).call(this,0),f(this,Gs,!0),r(this,ae).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){r(this,Gs)&&p(this,K,Qp).call(this,r(this,ld),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){p(this,K,ic).call(this),this.div.focus()}select(){var t,e,i;if(!(this.isSelected&&this._editToolbar)){if(this.isSelected=!0,this.makeResizable(),(t=this.div)==null||t.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var s,n;(s=this.div)!=null&&s.classList.contains("selectedEditor")&&((n=this._editToolbar)==null||n.show())});return}(e=this._editToolbar)==null||e.show(),(i=r(this,At))==null||i.toggleAltTextBadge(!1)}}unselect(){var t,e,i,s,n;this.isSelected&&(this.isSelected=!1,(t=r(this,ae))==null||t.classList.add("hidden"),(e=this.div)==null||e.classList.remove("selectedEditor"),(i=this.div)!=null&&i.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(s=this._editToolbar)==null||s.hide(),(n=r(this,At))==null||n.toggleAltTextBadge(!0))}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id})}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return r(this,hd)}set isEditing(t){f(this,hd,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){f(this,Pa,!0);const i=t/e,{style:s}=this.div;s.aspectRatio=i,s.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,wi)||f(this,wi,new Map);const{action:i}=t;let s=r(this,wi).get(i);s&&clearTimeout(s),s=setTimeout(()=>{this._reportTelemetry(t),r(this,wi).delete(i),r(this,wi).size===0&&f(this,wi,null)},et._telemetryTimeout),r(this,wi).set(i,s);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),f(this,El,!1)}disable(){this.div&&(this.div.tabIndex=-1),f(this,El,!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 i=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),i.before(e)}return e}resetAnnotationElement(t){const{firstChild:e}=t.container;(e==null?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};Sa=new WeakMap,Mi=new WeakMap,At=new WeakMap,re=new WeakMap,El=new WeakMap,er=new WeakMap,od=new WeakMap,Pa=new WeakMap,ae=new WeakMap,xa=new WeakMap,zs=new WeakMap,ir=new WeakMap,ld=new WeakMap,Ca=new WeakMap,ze=new WeakMap,hd=new WeakMap,Ta=new WeakMap,Gs=new WeakMap,hs=new WeakMap,Sl=new WeakMap,Pl=new WeakMap,wi=new WeakMap,Ia=new WeakMap,cd=new WeakMap,Ng=new WeakMap,K=new WeakSet,Yp=function([t,e],i,s){[i,s]=this.screenToPageTranslation(i,s),this.x+=i/t,this.y+=s/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},dd=new WeakSet,Kp=function(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},If=function(t){switch(t){case 90:{const[e,i]=this.pageDimensions;return[0,-e/i,i/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,i]=this.pageDimensions;return[0,e/i,-i/e,0]}default:return[1,0,0,1]}},Ry=function(){if(r(this,ae))return;f(this,ae,document.createElement("div")),r(this,ae).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 i of t){const s=document.createElement("div");r(this,ae).append(s),s.classList.add("resizer",i),s.setAttribute("data-resizer-name",i),s.addEventListener("pointerdown",p(this,K,My).bind(this,i),{signal:e}),s.addEventListener("contextmenu",Ci,{signal:e}),s.tabIndex=-1}this.div.prepend(r(this,ae))},My=function(t,e){var d;e.preventDefault();const{isMac:i}=pe.platform;if(e.button!==0||e.ctrlKey&&i)return;(d=r(this,At))==null||d.toggle(!1);const s=this._isDraggable;this._isDraggable=!1,f(this,xa,[e.screenX,e.screenY]);const n=new AbortController,a=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",p(this,K,Qp).bind(this,t),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",Vt,{passive:!1,signal:a}),window.addEventListener("contextmenu",Ci,{signal:a}),f(this,zs,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const c=()=>{var u;n.abort(),this.parent.togglePointerEvents(!0),(u=r(this,At))==null||u.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=o,this.div.style.cursor=l,p(this,K,Lf).call(this)};window.addEventListener("pointerup",c,{signal:a}),window.addEventListener("blur",c,{signal:a})},Zp=function(t,e,i,s){this.width=i,this.height=s,this.x=t,this.y=e;const[n,a]=this.parentDimensions;this.setDims(n*i,a*s),this.fixAndSetPosition(),this._onResized()},Lf=function(){if(!r(this,zs))return;const{savedX:t,savedY:e,savedWidth:i,savedHeight:s}=r(this,zs);f(this,zs,null);const n=this.x,a=this.y,o=this.width,l=this.height;n===t&&a===e&&o===i&&l===s||this.addCommands({cmd:p(this,K,Zp).bind(this,n,a,o,l),undo:p(this,K,Zp).bind(this,t,e,i,s),mustExec:!0})},Qp=function(t,e){const[i,s]=this.parentDimensions,n=this.x,a=this.y,o=this.width,l=this.height,c=et.MIN_SIZE/i,d=et.MIN_SIZE/s,u=p(this,K,If).call(this,this.rotation),g=(V,N)=>[u[0]*V+u[2]*N,u[1]*V+u[3]*N],b=p(this,K,If).call(this,360-this.rotation),w=(V,N)=>[b[0]*V+b[2]*N,b[1]*V+b[3]*N];let v,A,y=!1,S=!1;switch(t){case"topLeft":y=!0,v=(V,N)=>[0,0],A=(V,N)=>[V,N];break;case"topMiddle":v=(V,N)=>[V/2,0],A=(V,N)=>[V/2,N];break;case"topRight":y=!0,v=(V,N)=>[V,0],A=(V,N)=>[0,N];break;case"middleRight":S=!0,v=(V,N)=>[V,N/2],A=(V,N)=>[0,N/2];break;case"bottomRight":y=!0,v=(V,N)=>[V,N],A=(V,N)=>[0,0];break;case"bottomMiddle":v=(V,N)=>[V/2,N],A=(V,N)=>[V/2,0];break;case"bottomLeft":y=!0,v=(V,N)=>[0,N],A=(V,N)=>[V,0];break;case"middleLeft":S=!0,v=(V,N)=>[0,N/2],A=(V,N)=>[V,N/2];break}const _=v(o,l),E=A(o,l);let P=g(...E);const x=et._round(n+P[0]),T=et._round(a+P[1]);let I=1,C=1,L,M;if(e.fromKeyboard)({deltaX:L,deltaY:M}=e);else{const{screenX:V,screenY:N}=e,[mt,_t]=r(this,xa);[L,M]=this.screenToPageTranslation(V-mt,N-_t),r(this,xa)[0]=V,r(this,xa)[1]=N}if([L,M]=w(L/i,M/s),y){const V=Math.hypot(o,l);I=C=Math.max(Math.min(Math.hypot(E[0]-_[0]-L,E[1]-_[1]-M)/V,1/o,1/l),c/o,d/l)}else S?I=Le(Math.abs(E[0]-_[0]-L),c,1)/o:C=Le(Math.abs(E[1]-_[1]-M),d,1)/l;const G=et._round(o*I),W=et._round(l*C);P=g(...A(G,W));const $=x-P[0],Tt=T-P[1];r(this,ze)||f(this,ze,[this.x,this.y,this.width,this.height]),this.width=G,this.height=W,this.x=$,this.y=Tt,this.setDims(i*G,s*W),this.fixAndSetPosition(),this._onResizing()},ky=function(){var t;f(this,zs,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(t=r(this,At))==null||t.toggle(!1),this.parent.togglePointerEvents(!1)},Dy=function(t,e,i){let n=.7*(i/e)+1-.7;if(n===1)return;const a=p(this,K,If).call(this,this.rotation),o=(x,T)=>[a[0]*x+a[2]*T,a[1]*x+a[3]*T],[l,c]=this.parentDimensions,d=this.x,u=this.y,g=this.width,b=this.height,w=et.MIN_SIZE/l,v=et.MIN_SIZE/c;n=Math.max(Math.min(n,1/g,1/b),w/g,v/b);const A=et._round(g*n),y=et._round(b*n);if(A===g&&y===b)return;r(this,ze)||f(this,ze,[d,u,g,b]);const S=o(g/2,b/2),_=et._round(d+S[0]),E=et._round(u+S[1]),P=o(A/2,y/2);this.x=_-P[0],this.y=E-P[1],this.width=A,this.height=y,this.setDims(l*A,c*y),this.fixAndSetPosition(),this._onResizing()},Ny=function(){var t;(t=r(this,At))==null||t.toggle(!0),this.parent.togglePointerEvents(!0),p(this,K,Lf).call(this)},Jp=function(t){const{isMac:e}=pe.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Fy=function(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();let i=!1;const s=new AbortController,n=this._uiManager.combinedSignal(s),a={capture:!0,passive:!1,signal:n},o=c=>{s.abort(),f(this,er,null),f(this,Ca,!1),this._uiManager.endDragSession()||p(this,K,Jp).call(this,c),i&&this._onStopDragging()};e&&(f(this,Sl,t.clientX),f(this,Pl,t.clientY),f(this,er,t.pointerId),f(this,od,t.pointerType),window.addEventListener("pointermove",c=>{i||(i=!0,this._onStartDragging());const{clientX:d,clientY:u,pointerId:g}=c;if(g!==r(this,er)){Vt(c);return}const[b,w]=this.screenToPageTranslation(d-r(this,Sl),u-r(this,Pl));f(this,Sl,d),f(this,Pl,u),this._uiManager.dragSelectedEditors(b,w)},a),window.addEventListener("touchmove",Vt,a),window.addEventListener("pointerdown",c=>{c.pointerType===r(this,od)&&(r(this,Ia)||c.isPrimary)&&o(c),Vt(c)},a));const l=c=>{if(!r(this,er)||r(this,er)===c.pointerId){o(c);return}Vt(c)};window.addEventListener("pointerup",l,{signal:n}),window.addEventListener("blur",l,{signal:n})},tm=function(){if(r(this,ir)||!this.div)return;f(this,ir,new AbortController);const t=this._uiManager.combinedSignal(r(this,ir));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},Oy=function(t){et._resizerKeyboardManager.exec(this,t)},By=function(t){var e;r(this,Gs)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==r(this,ae)&&p(this,K,ic).call(this)},Vy=function(t){f(this,ld,r(this,Gs)?t:"")},em=function(t){if(r(this,Mi))for(const e of r(this,Mi))e.tabIndex=t},ic=function(){f(this,Gs,!1),p(this,K,em).call(this,-1),p(this,K,Lf).call(this)},m(et,dd),k(et,"_l10n",null),k(et,"_l10nResizer",null),k(et,"_borderLineWidth",-1),k(et,"_colorManager",new $p),k(et,"_zIndex",1),k(et,"_telemetryTimeout",1e3);let vt=et;class EE extends vt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Pw=3285377520,gi=4294901760,Ki=65535;class Hy{constructor(t){this.h1=t?t&4294967295:Pw,this.h2=t?t&4294967295:Pw}update(t){let e,i;if(typeof t=="string"){e=new Uint8Array(t.length*2),i=0;for(let v=0,A=t.length;v<A;v++){const y=t.charCodeAt(v);y<=255?e[i++]=y:(e[i++]=y>>>8,e[i++]=y&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),i=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const s=i>>2,n=i-s*4,a=new Uint32Array(e.buffer,0,s);let o=0,l=0,c=this.h1,d=this.h2;const u=3432918353,g=461845907,b=u&Ki,w=g&Ki;for(let v=0;v<s;v++)v&1?(o=a[v],o=o*u&gi|o*b&Ki,o=o<<15|o>>>17,o=o*g&gi|o*w&Ki,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(l=a[v],l=l*u&gi|l*b&Ki,l=l<<15|l>>>17,l=l*g&gi|l*w&Ki,d^=l,d=d<<13|d>>>19,d=d*5+3864292196);switch(o=0,n){case 3:o^=e[s*4+2]<<16;case 2:o^=e[s*4+1]<<8;case 1:o^=e[s*4],o=o*u&gi|o*b&Ki,o=o<<15|o>>>17,o=o*g&gi|o*w&Ki,s&1?c^=o:d^=o}this.h1=c,this.h2=d}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&gi|t*36045&Ki,e=e*4283543511&gi|((e<<16|t>>>16)*2950163797&gi)>>>16,t^=e>>>1,t=t*444984403&gi|t*60499&Ki,e=e*3301882366&gi|((e<<16|t>>>16)*3120437893&gi)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const im=Object.freeze({map:null,hash:"",transfer:void 0});var La,Ra,oe,Fg,jy;class Zb{constructor(){m(this,Fg);m(this,La,!1);m(this,Ra,null);m(this,oe,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=r(this,oe).get(t);return i===void 0?e:Object.assign(e,i)}getRawValue(t){return r(this,oe).get(t)}remove(t){if(r(this,oe).delete(t),r(this,oe).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const e of r(this,oe).values())if(e instanceof vt)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=r(this,oe).get(t);let s=!1;if(i!==void 0)for(const[n,a]of Object.entries(e))i[n]!==a&&(s=!0,i[n]=a);else s=!0,r(this,oe).set(t,e);s&&p(this,Fg,jy).call(this),e instanceof vt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type)}has(t){return r(this,oe).has(t)}get size(){return r(this,oe).size}resetModified(){r(this,La)&&(f(this,La,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new $y(this)}get serializable(){if(r(this,oe).size===0)return im;const t=new Map,e=new Hy,i=[],s=Object.create(null);let n=!1;for(const[a,o]of r(this,oe)){const l=o instanceof vt?o.serialize(!1,s):o;l&&(t.set(a,l),e.update("".concat(a,":").concat(JSON.stringify(l))),n||(n=!!l.bitmap))}if(n)for(const a of t.values())a.bitmap&&i.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:im}get editorStats(){var i;let t=null;const e=new Map;for(const s of r(this,oe).values()){if(!(s instanceof vt))continue;const n=s.telemetryFinalData;if(!n)continue;const{type:a}=n;e.has(a)||e.set(a,Object.getPrototypeOf(s).constructor),t||(t=Object.create(null));const o=t[a]||(t[a]=new Map);for(const[l,c]of Object.entries(n)){if(l==="type")continue;let d=o.get(l);d||(d=new Map,o.set(l,d));const u=(i=d.get(c))!=null?i:0;d.set(c,u+1)}}for(const[s,n]of e)t[s]=n.computeTelemetryFinalData(t[s]);return t}resetModifiedIds(){f(this,Ra,null)}get modifiedIds(){if(r(this,Ra))return r(this,Ra);const t=[];for(const e of r(this,oe).values())!(e instanceof vt)||!e.annotationElementId||!e.serialize()||t.push(e.annotationElementId);return f(this,Ra,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return r(this,oe).entries()}}La=new WeakMap,Ra=new WeakMap,oe=new WeakMap,Fg=new WeakSet,jy=function(){r(this,La)||(f(this,La,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var ud;class $y extends Zb{constructor(e){super();m(this,ud);const{map:i,hash:s,transfer:n}=e.serializable,a=structuredClone(i,n?{transfer:n}:null);f(this,ud,{map:a,hash:s,transfer:n})}get print(){pt("Should not call PrintAnnotationStorage.print")}get serializable(){return r(this,ud)}get modifiedIds(){return st(this,"modifiedIds",{ids:new Set,hash:""})}}ud=new WeakMap;var xl;class SE{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){m(this,xl,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,xl).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:i}){if(!(!t||r(this,xl).has(t.loadedName))){if(Ht(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:s,src:n,style:a}=t,o=new FontFace(s,n,a);this.addNativeFontFace(o);try{await o.load(),r(this,xl).add(s),i==null||i(t)}catch(l){Z("Cannot load system font: ".concat(t.baseFontName,", installing it could help to improve PDF rendering.")),this.removeNativeFontFace(o)}return}pt("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 i=t.createNativeFontFace();if(i){this.addNativeFontFace(i);try{await i.loaded}catch(s){throw Z("Failed to load font '".concat(i.family,"': '").concat(s,"'.")),t.disableFontFace=!0,s}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(i=>{const s=this._queueLoadingCallback(i);this._prepareFontLoadEvent(t,s)})}}get isFontLoadingAPISupported(){var e;const t=!!((e=this._document)!=null&&e.fonts);return st(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return st(this,"isSyncFontLoadingSupported",Ie||pe.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(Ht(!s.done,"completeRequest() cannot be called twice."),s.done=!0;i.length>0&&i[0].done;){const n=i.shift();setTimeout(n.callback,0)}}const{loadingRequests:i}=this,s={done:!1,complete:e,callback:t};return i.push(s),s}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return st(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function i(E,P){return E.charCodeAt(P)<<24|E.charCodeAt(P+1)<<16|E.charCodeAt(P+2)<<8|E.charCodeAt(P+3)&255}function s(E,P,x,T){const I=E.substring(0,P),C=E.substring(P+x);return I+T+C}let n,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const l=o.getContext("2d");let c=0;function d(E,P){if(++c>30){Z("Load test font never loaded."),P();return}if(l.font="30px "+E,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){P();return}setTimeout(d.bind(null,E,P))}const u="lt".concat(Date.now()).concat(this.loadTestFontId++);let g=this._loadTestFont;g=s(g,976,u.length,u);const w=16,v=1482184792;let A=i(g,w);for(n=0,a=u.length-3;n<a;n+=4)A=A-v+i(u,n)|0;n<u.length&&(A=A-v+i(u+"XXX",n)|0),g=s(g,w,4,cE(A));const y="url(data:font/opentype;base64,".concat(btoa(g),");"),S='@font-face {font-family:"'.concat(u,'";src:').concat(y,"}");this.insertRule(S);const _=this._document.createElement("div");_.style.visibility="hidden",_.style.width=_.style.height="10px",_.style.position="absolute",_.style.top=_.style.left="0px";for(const E of[t.loadedName,u]){const P=this._document.createElement("span");P.textContent="Hi",P.style.fontFamily=E,_.append(P)}this._document.body.append(_),d(u,()=>{_.remove(),e.complete()})}}xl=new WeakMap;class PE{constructor(t,e=null){this.compiledGlyphs=Object.create(null);for(const i in t)this[i]=t[i];this._inspectFont=e}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const i={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(i.style="oblique ".concat(this.cssFontInfo.italicAngle,"deg")),t=new FontFace(this.cssFontInfo.fontFamily,this.data,i)}return(e=this._inspectFont)==null||e.call(this,this),t}createFontFaceRule(){var i;if(!this.data||this.disableFontFace)return null;const t="url(data:".concat(this.mimetype,";base64,").concat(ay(this.data),");");let e;if(!this.cssFontInfo)e='@font-face {font-family:"'.concat(this.loadedName,'";src:').concat(t,"}");else{let s="font-weight: ".concat(this.cssFontInfo.fontWeight,";");this.cssFontInfo.italicAngle&&(s+="font-style: oblique ".concat(this.cssFontInfo.italicAngle,"deg;")),e='@font-face {font-family:"'.concat(this.cssFontInfo.fontFamily,'";').concat(s,"src:").concat(t,"}")}return(i=this._inspectFont)==null||i.call(this,this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];const i=this.loadedName+"_path_"+e;let s;try{s=t.get(i)}catch(a){Z('getPathGenerator - ignoring character: "'.concat(a,'".'))}const n=new Path2D(s||"");return this.fontExtraProperties||t.delete(i),this.compiledGlyphs[e]=n}}function xE(h){if(h instanceof URL)return h.href;if(typeof h=="string"){if(Ie)return h;const t=URL.parse(h,window.location);if(t)return t.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function CE(h){if(Ie&&typeof Buffer<"u"&&h instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(h instanceof Uint8Array&&h.byteLength===h.buffer.byteLength)return h;if(typeof h=="string")return ef(h);if(h instanceof ArrayBuffer||ArrayBuffer.isView(h)||typeof h=="object"&&!isNaN(h==null?void 0:h.length))return new Uint8Array(h);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function cf(h){if(typeof h!="string")return null;if(h.endsWith("/"))return h;throw new Error('Invalid factory url: "'.concat(h,'" must include trailing slash.'))}const sm=h=>typeof h=="object"&&Number.isInteger(h==null?void 0:h.num)&&h.num>=0&&Number.isInteger(h==null?void 0:h.gen)&&h.gen>=0,TE=h=>typeof h=="object"&&typeof(h==null?void 0:h.name)=="string",IE=pE.bind(null,sm,TE);var Xs,Og;class LE{constructor(){m(this,Xs,new Map);m(this,Og,Promise.resolve())}postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};r(this,Og).then(()=>{for(const[s]of r(this,Xs))s.call(this,i)})}addEventListener(t,e,i=null){let s=null;if((i==null?void 0:i.signal)instanceof AbortSignal){const{signal:n}=i;if(n.aborted){Z("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(t,e);s=()=>n.removeEventListener("abort",a),n.addEventListener("abort",a)}r(this,Xs).set(e,s)}removeEventListener(t,e){const i=r(this,Xs).get(e);i==null||i(),r(this,Xs).delete(e)}terminate(){for(const[,t]of r(this,Xs))t==null||t();r(this,Xs).clear()}}Xs=new WeakMap,Og=new WeakMap;const df={DATA:1,ERROR:2},Ot={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function xw(){}function ke(h){if(h instanceof qr||h instanceof Fp||h instanceof Aw||h instanceof vg||h instanceof fp)return h;switch(h instanceof Error||typeof h=="object"&&h!==null||pt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),h.name){case"AbortException":return new qr(h.message);case"InvalidPDFException":return new Fp(h.message);case"PasswordException":return new Aw(h.message,h.code);case"ResponseException":return new vg(h.message,h.status,h.missing);case"UnknownErrorException":return new fp(h.message,h.details)}return new fp(h.message,h.toString())}var Cl,xi,Uy,Wy,zy,Rf;class sc{constructor(t,e,i){m(this,xi);m(this,Cl,new AbortController);this.sourceName=t,this.targetName=e,this.comObj=i,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),i.addEventListener("message",p(this,xi,Uy).bind(this),{signal:r(this,Cl).signal})}on(t,e){const i=this.actionHandler;if(i[t])throw new Error('There is already an actionName called "'.concat(t,'"'));i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const s=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[s]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},i)}catch(a){n.reject(a)}return n.promise}sendWithStream(t,e,i,s){const n=this.streamId++,a=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:c=>{const d=Promise.withResolvers();return this.streamControllers[n]={controller:c,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:a,targetName:o,action:t,streamId:n,data:e,desiredSize:c.desiredSize},s),d.promise},pull:c=>{const d=Promise.withResolvers();return this.streamControllers[n].pullCall=d,l.postMessage({sourceName:a,targetName:o,stream:Ot.PULL,streamId:n,desiredSize:c.desiredSize}),d.promise},cancel:c=>{Ht(c instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[n].cancelCall=d,this.streamControllers[n].isClosed=!0,l.postMessage({sourceName:a,targetName:o,stream:Ot.CANCEL,streamId:n,reason:ke(c)}),d.promise}},i)}destroy(){var t;(t=r(this,Cl))==null||t.abort(),f(this,Cl,null)}}Cl=new WeakMap,xi=new WeakSet,Uy=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){p(this,xi,zy).call(this,t);return}if(t.callback){const i=t.callbackId,s=this.callbackCapabilities[i];if(!s)throw new Error("Cannot resolve callback ".concat(i));if(delete this.callbackCapabilities[i],t.callback===df.DATA)s.resolve(t.data);else if(t.callback===df.ERROR)s.reject(ke(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: ".concat(t.action));if(t.callbackId){const i=this.sourceName,s=t.sourceName,n=this.comObj;Promise.try(e,t.data).then(function(a){n.postMessage({sourceName:i,targetName:s,callback:df.DATA,callbackId:t.callbackId,data:a})},function(a){n.postMessage({sourceName:i,targetName:s,callback:df.ERROR,callbackId:t.callbackId,reason:ke(a)})});return}if(t.streamId){p(this,xi,Wy).call(this,t);return}e(t.data)},Wy=function(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,n=this.comObj,a=this,o=this.actionHandler[t.action],l={enqueue(c,d=1,u){if(this.isCancelled)return;const g=this.desiredSize;this.desiredSize-=d,g>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:i,targetName:s,stream:Ot.ENQUEUE,streamId:e,chunk:c},u)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:Ot.CLOSE,streamId:e}),delete a.streamSinks[e])},error(c){Ht(c instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:Ot.ERROR,streamId:e,reason:ke(c)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[e]=l,Promise.try(o,t.data,l).then(function(){n.postMessage({sourceName:i,targetName:s,stream:Ot.START_COMPLETE,streamId:e,success:!0})},function(c){n.postMessage({sourceName:i,targetName:s,stream:Ot.START_COMPLETE,streamId:e,reason:ke(c)})})},zy=function(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,n=this.comObj,a=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case Ot.START_COMPLETE:t.success?a.startCall.resolve():a.startCall.reject(ke(t.reason));break;case Ot.PULL_COMPLETE:t.success?a.pullCall.resolve():a.pullCall.reject(ke(t.reason));break;case Ot.PULL:if(!o){n.postMessage({sourceName:i,targetName:s,stream:Ot.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,Promise.try(o.onPull||xw).then(function(){n.postMessage({sourceName:i,targetName:s,stream:Ot.PULL_COMPLETE,streamId:e,success:!0})},function(c){n.postMessage({sourceName:i,targetName:s,stream:Ot.PULL_COMPLETE,streamId:e,reason:ke(c)})});break;case Ot.ENQUEUE:if(Ht(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case Ot.CLOSE:if(Ht(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),p(this,xi,Rf).call(this,a,e);break;case Ot.ERROR:Ht(a,"error should have stream controller"),a.controller.error(ke(t.reason)),p(this,xi,Rf).call(this,a,e);break;case Ot.CANCEL_COMPLETE:t.success?a.cancelCall.resolve():a.cancelCall.reject(ke(t.reason)),p(this,xi,Rf).call(this,a,e);break;case Ot.CANCEL:if(!o)break;const l=ke(t.reason);Promise.try(o.onCancel||xw,l).then(function(){n.postMessage({sourceName:i,targetName:s,stream:Ot.CANCEL_COMPLETE,streamId:e,success:!0})},function(c){n.postMessage({sourceName:i,targetName:s,stream:Ot.CANCEL_COMPLETE,streamId:e,reason:ke(c)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},Rf=async function(t,e){var i,s,n;await Promise.allSettled([(i=t.startCall)==null?void 0:i.promise,(s=t.pullCall)==null?void 0:s.promise,(n=t.cancelCall)==null?void 0:n.promise]),delete this.streamControllers[e]};var fd;class Gy{constructor({enableHWA:t=!1}){m(this,fd,!1);f(this,fd,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!r(this,fd)})}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}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){pt("Abstract method `_createCanvas` called.")}}fd=new WeakMap;class RE extends Gy{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}}class Xy{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(i=>({cMapData:i,isCompressed:this.isCompressed})).catch(i=>{throw new Error("Unable to load ".concat(this.isCompressed?"binary ":"","CMap at: ").concat(e))})}async _fetch(t){pt("Abstract method `_fetch` called.")}}class Cw extends Xy{async _fetch(t){const e=await sf(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):ef(e)}}class qy{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,s,n){return"none"}destroy(t=!1){}}var Ma,Tl,qs,Ys,ve,ka,Da,B,be,nc,jo,Mf,$o,Yy,nm,Uo,rc,ac,rm,oc;class ME extends qy{constructor({docId:e,ownerDocument:i=globalThis.document}){super();m(this,B);m(this,Ma);m(this,Tl);m(this,qs);m(this,Ys);m(this,ve);m(this,ka);m(this,Da,0);f(this,Ys,e),f(this,ve,i)}addFilter(e){if(!e)return"none";let i=r(this,B,be).get(e);if(i)return i;const[s,n,a]=p(this,B,Mf).call(this,e),o=e.length===1?s:"".concat(s).concat(n).concat(a);if(i=r(this,B,be).get(o),i)return r(this,B,be).set(e,i),i;const l="g_".concat(r(this,Ys),"_transfer_map_").concat(se(this,Da)._++),c=p(this,B,$o).call(this,l);r(this,B,be).set(e,c),r(this,B,be).set(o,c);const d=p(this,B,Uo).call(this,l);return p(this,B,ac).call(this,s,n,a,d),c}addHCMFilter(e,i){var w;const s="".concat(e,"-").concat(i),n="base";let a=r(this,B,nc).get(n);if((a==null?void 0:a.key)===s||(a?((w=a.filter)==null||w.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},r(this,B,nc).set(n,a)),!e||!i))return a.url;const o=p(this,B,oc).call(this,e);e=q.makeHexColor(...o);const l=p(this,B,oc).call(this,i);if(i=q.makeHexColor(...l),r(this,B,jo).style.color="",e==="#000000"&&i==="#ffffff"||e===i)return a.url;const c=new Array(256);for(let v=0;v<=255;v++){const A=v/255;c[v]=A<=.03928?A/12.92:((A+.055)/1.055)**2.4}const d=c.join(","),u="g_".concat(r(this,Ys),"_hcm_filter"),g=a.filter=p(this,B,Uo).call(this,u);p(this,B,ac).call(this,d,d,d,g),p(this,B,nm).call(this,g);const b=(v,A)=>{const y=o[v]/255,S=l[v]/255,_=new Array(A+1);for(let E=0;E<=A;E++)_[E]=y+E/A*(S-y);return _.join(",")};return p(this,B,ac).call(this,b(0,5),b(1,5),b(2,5),g),a.url=p(this,B,$o).call(this,u),a.url}addAlphaFilter(e){let i=r(this,B,be).get(e);if(i)return i;const[s]=p(this,B,Mf).call(this,[e]),n="alpha_".concat(s);if(i=r(this,B,be).get(n),i)return r(this,B,be).set(e,i),i;const a="g_".concat(r(this,Ys),"_alpha_map_").concat(se(this,Da)._++),o=p(this,B,$o).call(this,a);r(this,B,be).set(e,o),r(this,B,be).set(n,o);const l=p(this,B,Uo).call(this,a);return p(this,B,rm).call(this,s,l),o}addLuminosityFilter(e){let i=r(this,B,be).get(e||"luminosity");if(i)return i;let s,n;if(e?([s]=p(this,B,Mf).call(this,[e]),n="luminosity_".concat(s)):n="luminosity",i=r(this,B,be).get(n),i)return r(this,B,be).set(e,i),i;const a="g_".concat(r(this,Ys),"_luminosity_map_").concat(se(this,Da)._++),o=p(this,B,$o).call(this,a);r(this,B,be).set(e,o),r(this,B,be).set(n,o);const l=p(this,B,Uo).call(this,a);return p(this,B,Yy).call(this,l),e&&p(this,B,rm).call(this,s,l),o}addHighlightHCMFilter(e,i,s,n,a){var S;const o="".concat(i,"-").concat(s,"-").concat(n,"-").concat(a);let l=r(this,B,nc).get(e);if((l==null?void 0:l.key)===o||(l?((S=l.filter)==null||S.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},r(this,B,nc).set(e,l)),!i||!s))return l.url;const[c,d]=[i,s].map(p(this,B,oc).bind(this));let u=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),g=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[b,w]=[n,a].map(p(this,B,oc).bind(this));g<u&&([u,g,b,w]=[g,u,w,b]),r(this,B,jo).style.color="";const v=(_,E,P)=>{const x=new Array(256),T=(g-u)/P,I=_/255,C=(E-_)/(255*P);let L=0;for(let M=0;M<=P;M++){const G=Math.round(u+M*T),W=I+M*C;for(let $=L;$<=G;$++)x[$]=W;L=G+1}for(let M=L;M<256;M++)x[M]=x[L-1];return x.join(",")},A="g_".concat(r(this,Ys),"_hcm_").concat(e,"_filter"),y=l.filter=p(this,B,Uo).call(this,A);return p(this,B,nm).call(this,y),p(this,B,ac).call(this,v(b[0],w[0],5),v(b[1],w[1],5),v(b[2],w[2],5),y),l.url=p(this,B,$o).call(this,A),l.url}destroy(e=!1){var i,s,n,a;e&&((i=r(this,ka))!=null&&i.size)||((s=r(this,qs))==null||s.parentNode.parentNode.remove(),f(this,qs,null),(n=r(this,Tl))==null||n.clear(),f(this,Tl,null),(a=r(this,ka))==null||a.clear(),f(this,ka,null),f(this,Da,0))}}Ma=new WeakMap,Tl=new WeakMap,qs=new WeakMap,Ys=new WeakMap,ve=new WeakMap,ka=new WeakMap,Da=new WeakMap,B=new WeakSet,be=function(){return r(this,Tl)||f(this,Tl,new Map)},nc=function(){return r(this,ka)||f(this,ka,new Map)},jo=function(){if(!r(this,qs)){const e=r(this,ve).createElement("div"),{style:i}=e;i.visibility="hidden",i.contain="strict",i.width=i.height=0,i.position="absolute",i.top=i.left=0,i.zIndex=-1;const s=r(this,ve).createElementNS(Is,"svg");s.setAttribute("width",0),s.setAttribute("height",0),f(this,qs,r(this,ve).createElementNS(Is,"defs")),e.append(s),s.append(r(this,qs)),r(this,ve).body.append(e)}return r(this,qs)},Mf=function(e){if(e.length===1){const c=e[0],d=new Array(256);for(let g=0;g<256;g++)d[g]=c[g]/255;const u=d.join(",");return[u,u,u]}const[i,s,n]=e,a=new Array(256),o=new Array(256),l=new Array(256);for(let c=0;c<256;c++)a[c]=i[c]/255,o[c]=s[c]/255,l[c]=n[c]/255;return[a.join(","),o.join(","),l.join(",")]},$o=function(e){if(r(this,Ma)===void 0){f(this,Ma,"");const i=r(this,ve).URL;i!==r(this,ve).baseURI&&(ip(i)?Z('#createUrl: ignore "data:"-URL for performance reasons.'):f(this,Ma,sy(i,"")))}return"url(".concat(r(this,Ma),"#").concat(e,")")},Yy=function(e){const i=r(this,ve).createElementNS(Is,"feColorMatrix");i.setAttribute("type","matrix"),i.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(i)},nm=function(e){const i=r(this,ve).createElementNS(Is,"feColorMatrix");i.setAttribute("type","matrix"),i.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(i)},Uo=function(e){const i=r(this,ve).createElementNS(Is,"filter");return i.setAttribute("color-interpolation-filters","sRGB"),i.setAttribute("id",e),r(this,B,jo).append(i),i},rc=function(e,i,s){const n=r(this,ve).createElementNS(Is,i);n.setAttribute("type","discrete"),n.setAttribute("tableValues",s),e.append(n)},ac=function(e,i,s,n){const a=r(this,ve).createElementNS(Is,"feComponentTransfer");n.append(a),p(this,B,rc).call(this,a,"feFuncR",e),p(this,B,rc).call(this,a,"feFuncG",i),p(this,B,rc).call(this,a,"feFuncB",s)},rm=function(e,i){const s=r(this,ve).createElementNS(Is,"feComponentTransfer");i.append(s),p(this,B,rc).call(this,s,"feFuncA",e)},oc=function(e){return r(this,B,jo).style.color=e,sp(getComputedStyle(r(this,B,jo)).getPropertyValue("color"))};class Ky{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="".concat(this.baseUrl).concat(t);return this._fetch(e).catch(i=>{throw new Error("Unable to load font data at: ".concat(e))})}async _fetch(t){pt("Abstract method `_fetch` called.")}}class Tw extends Ky{async _fetch(t){const e=await sf(t,"arraybuffer");return new Uint8Array(e)}}class Zy{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!t)throw new Error("Wasm filename must be specified.");const e="".concat(this.baseUrl).concat(t);return this._fetch(e).catch(i=>{throw new Error("Unable to load wasm data at: ".concat(e))})}async _fetch(t){pt("Abstract method `_fetch` called.")}}class Iw extends Zy{async _fetch(t){const e=await sf(t,"arraybuffer");return new Uint8Array(e)}}Ie&&Z("Please use the `legacy` build in Node.js environments.");async function Qb(h){const e=await process.getBuiltinModule("fs").promises.readFile(h);return new Uint8Array(e)}class kE extends qy{}class DE extends Gy{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(t,e)}}class NE extends Xy{async _fetch(t){return Qb(t)}}class FE extends Ky{async _fetch(t){return Qb(t)}}class OE extends Zy{async _fetch(t){return Qb(t)}}const ue={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function am(h,t){if(!t)return;const e=t[2]-t[0],i=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],e,i),h.clip(s)}class Jb{isModifyingCurrentTransform(){return!1}getPattern(){pt("Abstract method `getPattern` called.")}}class BE extends Jb{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 i of this._colorStops)e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,s){let n;if(s===ue.STROKE||s===ue.FILL){const a=e.current.getClippedPathBoundingBox(s,Ct(t))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,l=Math.ceil(a[3]-a[1])||1,c=e.cachedCanvases.getCanvas("pattern",o,l),d=c.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]),i=q.transform(i,[1,0,0,1,a[0],a[1]]),d.transform(...e.baseTransform),this.matrix&&d.transform(...this.matrix),am(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),n=t.createPattern(c.canvas,"no-repeat");const u=new DOMMatrix(i);n.setTransform(u)}else am(t,this._bbox),n=this._createGradient(t);return n}}function mp(h,t,e,i,s,n,a,o){const l=t.coords,c=t.colors,d=h.data,u=h.width*4;let g;l[e+1]>l[i+1]&&(g=e,e=i,i=g,g=n,n=a,a=g),l[i+1]>l[s+1]&&(g=i,i=s,s=g,g=a,a=o,o=g),l[e+1]>l[i+1]&&(g=e,e=i,i=g,g=n,n=a,a=g);const b=(l[e]+t.offsetX)*t.scaleX,w=(l[e+1]+t.offsetY)*t.scaleY,v=(l[i]+t.offsetX)*t.scaleX,A=(l[i+1]+t.offsetY)*t.scaleY,y=(l[s]+t.offsetX)*t.scaleX,S=(l[s+1]+t.offsetY)*t.scaleY;if(w>=S)return;const _=c[n],E=c[n+1],P=c[n+2],x=c[a],T=c[a+1],I=c[a+2],C=c[o],L=c[o+1],M=c[o+2],G=Math.round(w),W=Math.round(S);let $,Tt,V,N,mt,_t,fi,qi;for(let qt=G;qt<=W;qt++){if(qt<A){const It=qt<w?0:(w-qt)/(w-A);$=b-(b-v)*It,Tt=_-(_-x)*It,V=E-(E-T)*It,N=P-(P-I)*It}else{let It;qt>S?It=1:A===S?It=0:It=(A-qt)/(A-S),$=v-(v-y)*It,Tt=x-(x-C)*It,V=T-(T-L)*It,N=I-(I-M)*It}let kt;qt<w?kt=0:qt>S?kt=1:kt=(w-qt)/(w-S),mt=b-(b-y)*kt,_t=_-(_-C)*kt,fi=E-(E-L)*kt,qi=P-(P-M)*kt;const Bo=Math.round(Math.min($,mt)),Mn=Math.round(Math.max($,mt));let kn=u*qt+Bo*4;for(let It=Bo;It<=Mn;It++)kt=($-It)/($-mt),kt<0?kt=0:kt>1&&(kt=1),d[kn++]=Tt-(Tt-_t)*kt|0,d[kn++]=V-(V-fi)*kt|0,d[kn++]=N-(N-qi)*kt|0,d[kn++]=255}}function VE(h,t,e){const i=t.coords,s=t.colors;let n,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(i.length/o)-1,c=o-1;for(n=0;n<l;n++){let d=n*o;for(let u=0;u<c;u++,d++)mp(h,e,i[d],i[d+1],i[d+o],s[d],s[d+1],s[d+o]),mp(h,e,i[d+o+1],i[d+1],i[d+o],s[d+o+1],s[d+1],s[d+o])}break;case"triangles":for(n=0,a=i.length;n<a;n+=3)mp(h,e,i[n],i[n+1],i[n+2],s[n],s[n+1],s[n+2]);break;default:throw new Error("illegal figure")}}class HE extends Jb{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null}_createMeshCanvas(t,e,i){const o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),c=Math.ceil(this._bounds[2])-o,d=Math.ceil(this._bounds[3])-l,u=Math.min(Math.ceil(Math.abs(c*t[0]*1.1)),3e3),g=Math.min(Math.ceil(Math.abs(d*t[1]*1.1)),3e3),b=c/u,w=d/g,v={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-l,scaleX:1/b,scaleY:1/w},A=u+2*2,y=g+2*2,S=i.getCanvas("mesh",A,y),_=S.context,E=_.createImageData(u,g);if(e){const x=E.data;for(let T=0,I=x.length;T<I;T+=4)x[T]=e[0],x[T+1]=e[1],x[T+2]=e[2],x[T+3]=255}for(const x of this._figures)VE(E,x,v);return _.putImageData(E,2,2),{canvas:S.canvas,offsetX:o-2*b,offsetY:l-2*w,scaleX:b,scaleY:w}}isModifyingCurrentTransform(){return!0}getPattern(t,e,i,s){am(t,this._bbox);const n=new Float32Array(2);if(s===ue.SHADING)q.singularValueDecompose2dScale(Ct(t),n);else if(this.matrix){q.singularValueDecompose2dScale(this.matrix,n);const[o,l]=n;q.singularValueDecompose2dScale(e.baseTransform,n),n[0]*=o,n[1]*=l}else q.singularValueDecompose2dScale(e.baseTransform,n);const a=this._createMeshCanvas(n,s===ue.SHADING?null:this._background,e.cachedCanvases);return s!==ue.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 jE extends Jb{getPattern(){return"hotpink"}}function $E(h){switch(h[0]){case"RadialAxial":return new BE(h);case"Mesh":return new HE(h);case"Dummy":return new jE}throw new Error("Unknown IR type: ".concat(h[0]))}const Lw={COLORED:1,UNCOLORED:2},Bg=class Bg{constructor(t,e,i,s){this.color=t[1],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.ctx=e,this.canvasGraphicsFactory=i,this.baseTransform=s}createPatternCanvas(t){const{bbox:e,operatorList:i,paintType:s,tilingType:n,color:a,canvasGraphicsFactory:o}=this;let{xstep:l,ystep:c}=this;l=Math.abs(l),c=Math.abs(c),ep("TilingType: "+n);const d=e[0],u=e[1],g=e[2],b=e[3],w=g-d,v=b-u,A=new Float32Array(2);q.singularValueDecompose2dScale(this.matrix,A);const[y,S]=A;q.singularValueDecompose2dScale(this.baseTransform,A);const _=y*A[0],E=S*A[1];let P=w,x=v,T=!1,I=!1;const C=Math.ceil(l*_),L=Math.ceil(c*E),M=Math.ceil(w*_),G=Math.ceil(v*E);C>=M?P=l:T=!0,L>=G?x=c:I=!0;const W=this.getSizeAndScale(P,this.ctx.canvas.width,_),$=this.getSizeAndScale(x,this.ctx.canvas.height,E),Tt=t.cachedCanvases.getCanvas("pattern",W.size,$.size),V=Tt.context,N=o.createCanvasGraphics(V);if(N.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(N,s,a),V.translate(-W.scale*d,-$.scale*u),N.transform(W.scale,0,0,$.scale,0,0),V.save(),this.clipBbox(N,d,u,g,b),N.baseTransform=Ct(N.ctx),N.executeOperatorList(i),N.endDrawing(),V.restore(),T||I){const mt=Tt.canvas;T&&(P=l),I&&(x=c);const _t=this.getSizeAndScale(P,this.ctx.canvas.width,_),fi=this.getSizeAndScale(x,this.ctx.canvas.height,E),qi=_t.size,qt=fi.size,kt=t.cachedCanvases.getCanvas("pattern-workaround",qi,qt),Bo=kt.context,Mn=T?Math.floor(w/l):0,kn=I?Math.floor(v/c):0;for(let It=0;It<=Mn;It++)for(let Wh=0;Wh<=kn;Wh++)Bo.drawImage(mt,qi*It,qt*Wh,qi,qt,0,0,qi,qt);return{canvas:kt.canvas,scaleX:_t.scale,scaleY:fi.scale,offsetX:d,offsetY:u}}return{canvas:Tt.canvas,scaleX:W.scale,scaleY:$.scale,offsetX:d,offsetY:u}}getSizeAndScale(t,e,i){const s=Math.max(Bg.MAX_PATTERN_SIZE,e);let n=Math.ceil(t*i);return n>=s?n=s:i=n/t,{scale:i,size:n}}clipBbox(t,e,i,s,n){const a=s-e,o=n-i;t.ctx.rect(e,i,a,o),q.axialAlignedBoundingBox([e,i,s,n],Ct(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const s=t.ctx,n=t.current;switch(e){case Lw.COLORED:const{fillStyle:a,strokeStyle:o}=this.ctx;s.fillStyle=n.fillColor=a,s.strokeStyle=n.strokeColor=o;break;case Lw.UNCOLORED:s.fillStyle=s.strokeStyle=i,n.fillColor=n.strokeColor=i;break;default:throw new hE("Unsupported paint type: ".concat(e))}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,s){let n=i;s!==ue.SHADING&&(n=q.transform(n,e.baseTransform),this.matrix&&(n=q.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 l=t.createPattern(a.canvas,"repeat");return l.setTransform(o),l}};k(Bg,"MAX_PATTERN_SIZE",3e3);let om=Bg;function UE({src:h,srcPos:t=0,dest:e,width:i,height:s,nonBlackColor:n=4294967295,inverseDecode:a=!1}){const o=pe.isLittleEndian?4278190080:255,[l,c]=a?[n,o]:[o,n],d=i>>3,u=i&7,g=h.length;e=new Uint32Array(e.buffer);let b=0;for(let w=0;w<s;w++){for(const A=t+d;t<A;t++){const y=t<g?h[t]:255;e[b++]=y&128?c:l,e[b++]=y&64?c:l,e[b++]=y&32?c:l,e[b++]=y&16?c:l,e[b++]=y&8?c:l,e[b++]=y&4?c:l,e[b++]=y&2?c:l,e[b++]=y&1?c:l}if(u===0)continue;const v=t<g?h[t++]:255;for(let A=0;A<u;A++)e[b++]=v&1<<7-A?c:l}return{srcPos:t,destPos:b}}const Rw=16,Mw=100,WE=15,kw=10,Ve=16,bp=new DOMMatrix,oi=new Float32Array(2),tl=new Float32Array([1/0,1/0,-1/0,-1/0]);function zE(h,t){if(h._removeMirroring)throw new Error("Context is already forwarding operations.");h.__originalSave=h.save,h.__originalRestore=h.restore,h.__originalRotate=h.rotate,h.__originalScale=h.scale,h.__originalTranslate=h.translate,h.__originalTransform=h.transform,h.__originalSetTransform=h.setTransform,h.__originalResetTransform=h.resetTransform,h.__originalClip=h.clip,h.__originalMoveTo=h.moveTo,h.__originalLineTo=h.lineTo,h.__originalBezierCurveTo=h.bezierCurveTo,h.__originalRect=h.rect,h.__originalClosePath=h.closePath,h.__originalBeginPath=h.beginPath,h._removeMirroring=()=>{h.save=h.__originalSave,h.restore=h.__originalRestore,h.rotate=h.__originalRotate,h.scale=h.__originalScale,h.translate=h.__originalTranslate,h.transform=h.__originalTransform,h.setTransform=h.__originalSetTransform,h.resetTransform=h.__originalResetTransform,h.clip=h.__originalClip,h.moveTo=h.__originalMoveTo,h.lineTo=h.__originalLineTo,h.bezierCurveTo=h.__originalBezierCurveTo,h.rect=h.__originalRect,h.closePath=h.__originalClosePath,h.beginPath=h.__originalBeginPath,delete h._removeMirroring},h.save=function(){t.save(),this.__originalSave()},h.restore=function(){t.restore(),this.__originalRestore()},h.translate=function(e,i){t.translate(e,i),this.__originalTranslate(e,i)},h.scale=function(e,i){t.scale(e,i),this.__originalScale(e,i)},h.transform=function(e,i,s,n,a,o){t.transform(e,i,s,n,a,o),this.__originalTransform(e,i,s,n,a,o)},h.setTransform=function(e,i,s,n,a,o){t.setTransform(e,i,s,n,a,o),this.__originalSetTransform(e,i,s,n,a,o)},h.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},h.rotate=function(e){t.rotate(e),this.__originalRotate(e)},h.clip=function(e){t.clip(e),this.__originalClip(e)},h.moveTo=function(e,i){t.moveTo(e,i),this.__originalMoveTo(e,i)},h.lineTo=function(e,i){t.lineTo(e,i),this.__originalLineTo(e,i)},h.bezierCurveTo=function(e,i,s,n,a,o){t.bezierCurveTo(e,i,s,n,a,o),this.__originalBezierCurveTo(e,i,s,n,a,o)},h.rect=function(e,i,s,n){t.rect(e,i,s,n),this.__originalRect(e,i,s,n)},h.closePath=function(){t.closePath(),this.__originalClosePath()},h.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class GE{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let s;return this.cache[t]!==void 0?(s=this.cache[t],this.canvasFactory.reset(s,e,i)):(s=this.canvasFactory.create(e,i),this.cache[t]=s),s}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 uf(h,t,e,i,s,n,a,o,l,c){const[d,u,g,b,w,v]=Ct(h);if(u===0&&g===0){const S=a*d+w,_=Math.round(S),E=o*b+v,P=Math.round(E),x=(a+l)*d+w,T=Math.abs(Math.round(x)-_)||1,I=(o+c)*b+v,C=Math.abs(Math.round(I)-P)||1;return h.setTransform(Math.sign(d),0,0,Math.sign(b),_,P),h.drawImage(t,e,i,s,n,0,0,T,C),h.setTransform(d,u,g,b,w,v),[T,C]}if(d===0&&b===0){const S=o*g+w,_=Math.round(S),E=a*u+v,P=Math.round(E),x=(o+c)*g+w,T=Math.abs(Math.round(x)-_)||1,I=(a+l)*u+v,C=Math.abs(Math.round(I)-P)||1;return h.setTransform(0,Math.sign(u),Math.sign(g),0,_,P),h.drawImage(t,e,i,s,n,0,0,C,T),h.setTransform(d,u,g,b,w,v),[C,T]}h.drawImage(t,e,i,s,n,a,o,l,c);const A=Math.hypot(d,u),y=Math.hypot(g,b);return[A*l,y*c]}class Dw{constructor(t,e){k(this,"alphaIsShape",!1);k(this,"fontSize",0);k(this,"fontSizeScale",1);k(this,"textMatrix",null);k(this,"textMatrixScale",1);k(this,"fontMatrix",Np);k(this,"leading",0);k(this,"x",0);k(this,"y",0);k(this,"lineX",0);k(this,"lineY",0);k(this,"charSpacing",0);k(this,"wordSpacing",0);k(this,"textHScale",1);k(this,"textRenderingMode",me.FILL);k(this,"textRise",0);k(this,"fillColor","#000000");k(this,"strokeColor","#000000");k(this,"patternFill",!1);k(this,"patternStroke",!1);k(this,"fillAlpha",1);k(this,"strokeAlpha",1);k(this,"lineWidth",1);k(this,"activeSMask",null);k(this,"transferMaps","none");this.clipBox=new Float32Array([0,0,t,e]),this.minMax=tl.slice()}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t}getPathBoundingBox(t=ue.FILL,e=null){const i=this.minMax.slice();if(t===ue.STROKE){e||pt("Stroke bounding box must include transform."),q.singularValueDecompose2dScale(e,oi);const s=oi[0]*this.lineWidth/2,n=oi[1]*this.lineWidth/2;i[0]-=s,i[1]-=n,i[2]+=s,i[3]+=n}return i}updateClipFromPath(){const t=q.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(tl,0)}getClippedPathBoundingBox(t=ue.FILL,e=null){return q.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function Nw(h,t){if(t instanceof ImageData){h.putImageData(t,0,0);return}const e=t.height,i=t.width,s=e%Ve,n=(e-s)/Ve,a=s===0?n:n+1,o=h.createImageData(i,Ve);let l=0,c;const d=t.data,u=o.data;let g,b,w,v;if(t.kind===Ef.GRAYSCALE_1BPP){const A=d.byteLength,y=new Uint32Array(u.buffer,0,u.byteLength>>2),S=y.length,_=i+7>>3,E=4294967295,P=pe.isLittleEndian?4278190080:255;for(g=0;g<a;g++){for(w=g<n?Ve:s,c=0,b=0;b<w;b++){const x=A-l;let T=0;const I=x>_?i:x*8-7,C=I&-8;let L=0,M=0;for(;T<C;T+=8)M=d[l++],y[c++]=M&128?E:P,y[c++]=M&64?E:P,y[c++]=M&32?E:P,y[c++]=M&16?E:P,y[c++]=M&8?E:P,y[c++]=M&4?E:P,y[c++]=M&2?E:P,y[c++]=M&1?E:P;for(;T<I;T++)L===0&&(M=d[l++],L=128),y[c++]=M&L?E:P,L>>=1}for(;c<S;)y[c++]=0;h.putImageData(o,0,g*Ve)}}else if(t.kind===Ef.RGBA_32BPP){for(b=0,v=i*Ve*4,g=0;g<n;g++)u.set(d.subarray(l,l+v)),l+=v,h.putImageData(o,0,b),b+=Ve;g<a&&(v=i*s*4,u.set(d.subarray(l,l+v)),h.putImageData(o,0,b))}else if(t.kind===Ef.RGB_24BPP)for(w=Ve,v=i*w,g=0;g<a;g++){for(g>=n&&(w=s,v=i*w),c=0,b=v;b--;)u[c++]=d[l++],u[c++]=d[l++],u[c++]=d[l++],u[c++]=255;h.putImageData(o,0,g*Ve)}else throw new Error("bad image kind: ".concat(t.kind))}function Fw(h,t){if(t.bitmap){h.drawImage(t.bitmap,0,0);return}const e=t.height,i=t.width,s=e%Ve,n=(e-s)/Ve,a=s===0?n:n+1,o=h.createImageData(i,Ve);let l=0;const c=t.data,d=o.data;for(let u=0;u<a;u++){const g=u<n?Ve:s;({srcPos:l}=UE({src:c,srcPos:l,dest:d,width:i,height:g,nonBlackColor:0})),h.putImageData(o,0,u*Ve)}}function zh(h,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const i of e)h[i]!==void 0&&(t[i]=h[i]);h.setLineDash!==void 0&&(t.setLineDash(h.getLineDash()),t.lineDashOffset=h.lineDashOffset)}function ff(h){h.strokeStyle=h.fillStyle="#000000",h.fillRule="nonzero",h.globalAlpha=1,h.lineWidth=1,h.lineCap="butt",h.lineJoin="miter",h.miterLimit=10,h.globalCompositeOperation="source-over",h.font="10px sans-serif",h.setLineDash!==void 0&&(h.setLineDash([]),h.lineDashOffset=0);const{filter:t}=h;t!=="none"&&t!==""&&(h.filter="none")}function Ow(h,t){if(t)return!0;q.singularValueDecompose2dScale(h,oi);const e=Math.fround(ko.pixelRatio*Yr.PDF_TO_CSS_UNITS);return oi[0]<=e&&oi[1]<=e}const XE=["butt","round","square"],qE=["miter","round","bevel"],YE={},Bw={};var Xi,lm,hm,cm;const uw=class uw{constructor(t,e,i,s,n,{optionalContentConfig:a,markedContentStack:o=null},l,c){m(this,Xi);this.ctx=t,this.current=new Dw(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=i,this.canvasFactory=s,this.filterFactory=n,this.groupStack=[],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 GE(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,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:i=!1,background:s=null}){const n=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,n,a),this.ctx.fillStyle=o,i){const l=this.cachedCanvases.getCanvas("transparent",n,a);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...Ct(this.compositeCtx))}this.ctx.save(),ff(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=Ct(this.ctx)}executeOperatorList(t,e,i,s){const n=t.argsArray,a=t.fnArray;let o=e||0;const l=n.length;if(l===o)return o;const c=l-o>kw&&typeof i=="function",d=c?Date.now()+WE:0;let u=0;const g=this.commonObjs,b=this.objs;let w;for(;;){if(s!==void 0&&o===s.nextBreakPoint)return s.breakIt(o,i),o;if(w=a[o],w!==wg.dependency)this[w].apply(this,n[o]);else for(const v of n[o]){const A=v.startsWith("g_")?g:b;if(!A.has(v))return A.get(v,i),o}if(o++,o===l)return o;if(c&&++u>kw){if(Date.now()>d)return i(),o;u=0}}}endDrawing(){p(this,Xi,lm).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(),p(this,Xi,hm).call(this)}_scaleImage(t,e){var g,b;const i=(g=t.width)!=null?g:t.displayWidth,s=(b=t.height)!=null?b:t.displayHeight;let n=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),o=i,l=s,c="prescale1",d,u;for(;n>2&&o>1||a>2&&l>1;){let w=o,v=l;n>2&&o>1&&(w=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),n/=o/w),a>2&&l>1&&(v=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,a/=l/v),d=this.cachedCanvases.getCanvas(c,w,v),u=d.context,u.clearRect(0,0,w,v),u.drawImage(t,0,0,o,l,0,0,w,v),t=d.canvas,o=w,l=v,c=c==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:o,paintHeight:l}}_createMaskCanvas(t){const e=this.ctx,{width:i,height:s}=t,n=this.current.fillColor,a=this.current.patternFill,o=Ct(e);let l,c,d,u;if((t.bitmap||t.data)&&t.count>1){const C=t.bitmap||t.data.buffer;c=JSON.stringify(a?o:[o.slice(0,4),n]),l=this._cachedBitmapsMap.get(C),l||(l=new Map,this._cachedBitmapsMap.set(C,l));const L=l.get(c);if(L&&!a){const M=Math.round(Math.min(o[0],o[2])+o[4]),G=Math.round(Math.min(o[1],o[3])+o[5]);return{canvas:L,offsetX:M,offsetY:G}}d=L}d||(u=this.cachedCanvases.getCanvas("maskCanvas",i,s),Fw(u.context,t));let g=q.transform(o,[1/i,0,0,-1/s,0,0]);g=q.transform(g,[1,0,0,1,0,-s]);const b=tl.slice();q.axialAlignedBoundingBox([0,0,i,s],g,b);const[w,v,A,y]=b,S=Math.round(A-w)||1,_=Math.round(y-v)||1,E=this.cachedCanvases.getCanvas("fillCanvas",S,_),P=E.context,x=w,T=v;P.translate(-x,-T),P.transform(...g),d||(d=this._scaleImage(u.canvas,Yi(P)),d=d.img,l&&a&&l.set(c,d)),P.imageSmoothingEnabled=Ow(Ct(P),t.interpolate),uf(P,d,0,0,d.width,d.height,0,0,i,s),P.globalCompositeOperation="source-in";const I=q.transform(Yi(P),[1,0,0,1,-x,-T]);return P.fillStyle=a?n.getPattern(e,this,I,ue.FILL):n,P.fillRect(0,0,i,s),l&&!a&&(this.cachedCanvases.delete("fillCanvas"),l.set(c,E.canvas)),{canvas:E.canvas,offsetX:Math.round(x),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=XE[t]}setLineJoin(t){this.ctx.lineJoin=qE[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,i]of t)switch(e){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.ctx.globalAlpha=this.current.fillAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i);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,i="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(i,t,e);this.suspendedCtx=this.ctx;const n=this.ctx=s.context;n.setTransform(this.suspendedCtx.getTransform()),zh(this.suspendedCtx,n),zE(n,this.suspendedCtx),this.setGState([["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),zh(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,i=this.suspendedCtx;this.composeSMask(i,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,i,s){const n=s[0],a=s[1],o=s[2]-n,l=s[3]-a;o===0||l===0||(this.genericComposeSMask(e.context,i,o,l,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(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,s,n,a,o,l,c,d,u){let g=t.canvas,b=l-d,w=c-u;if(a)if(b<0||w<0||b+i>g.width||w+s>g.height){const A=this.cachedCanvases.getCanvas("maskExtension",i,s),y=A.context;y.drawImage(g,-b,-w),y.globalCompositeOperation="destination-atop",y.fillStyle=a,y.fillRect(0,0,i,s),y.globalCompositeOperation="source-over",g=A.canvas,b=w=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const A=new Path2D;A.rect(b,w,i,s),t.clip(A),t.globalCompositeOperation="destination-atop",t.fillStyle=a,t.fillRect(b,w,i,s),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 v=new Path2D;v.rect(l,c,i,s),e.clip(v),e.globalCompositeOperation="destination-in",e.drawImage(g,b,w,i,s,l,c,i,s),e.restore()}save(){this.inSMaskMode&&zh(this.ctx,this.suspendedCtx),this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){if(this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&zh(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,i,s,n,a){this.ctx.transform(t,e,i,s,n,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){let[s]=e;if(!i){s||(s=e[0]=new Path2D),this[t](s);return}if(!(s instanceof Path2D)){const n=e[0]=new Path2D;for(let a=0,o=s.length;a<o;)switch(s[a++]){case lf.moveTo:n.moveTo(s[a++],s[a++]);break;case lf.lineTo:n.lineTo(s[a++],s[a++]);break;case lf.curveTo:n.bezierCurveTo(s[a++],s[a++],s[a++],s[a++],s[a++],s[a++]);break;case lf.closePath:n.closePath();break;default:Z("Unrecognized drawing path operator: ".concat(s[a-1]));break}s=n}q.axialAlignedBoundingBox(i,Ct(this.ctx),this.current.minMax),this[t](s)}closePath(){this.ctx.closePath()}stroke(t,e=!0){const i=this.ctx,s=this.current.strokeColor;if(i.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof s=="object"&&(s!=null&&s.getPattern)){const n=s.isModifyingCurrentTransform()?i.getTransform():null;if(i.save(),i.strokeStyle=s.getPattern(i,this,Yi(i),ue.STROKE),n){const a=new Path2D;a.addPath(t,i.getTransform().invertSelf().multiplySelf(n)),t=a}this.rescaleAndStroke(t,!1),i.restore()}else this.rescaleAndStroke(t,!0);e&&this.consumePath(t,this.current.getClippedPathBoundingBox(ue.STROKE,Ct(this.ctx))),i.globalAlpha=this.current.fillAlpha}closeStroke(t){this.stroke(t)}fill(t,e=!0){const i=this.ctx,s=this.current.fillColor,n=this.current.patternFill;let a=!1;if(n){const l=s.isModifyingCurrentTransform()?i.getTransform():null;if(i.save(),i.fillStyle=s.getPattern(i,this,Yi(i),ue.FILL),l){const c=new Path2D;c.addPath(t,i.getTransform().invertSelf().multiplySelf(l)),t=c}a=!0}const o=this.current.getClippedPathBoundingBox();this.contentVisible&&o!==null&&(this.pendingEOFill?(i.fill(t,"evenodd"),this.pendingEOFill=!1):i.fill(t)),a&&i.restore(),e&&this.consumePath(t,o)}eoFill(t){this.pendingEOFill=!0,this.fill(t)}fillStroke(t){this.fill(t,!1),this.stroke(t,!1),this.consumePath(t)}eoFillStroke(t){this.pendingEOFill=!0,this.fillStroke(t)}closeFillStroke(t){this.fillStroke(t)}closeEOFillStroke(t){this.pendingEOFill=!0,this.fillStroke(t)}endPath(t){this.consumePath(t)}rawFillPath(t){this.ctx.fill(t)}clip(){this.pendingClip=YE}eoClip(){this.pendingClip=Bw}beginText(){this.current.textMatrix=null,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)return;const i=new Path2D,s=e.getTransform().invertSelf();for(const{transform:n,x:a,y:o,fontSize:l,path:c}of t)c&&i.addPath(c,new DOMMatrix(n).preMultiplySelf(s).translate(a,o).scale(l,-l));e.clip(i),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 i=this.commonObjs.get(t),s=this.current;if(!i)throw new Error("Can't find font for ".concat(t));if(s.fontMatrix=i.fontMatrix||Np,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&Z("Invalid font matrix for font "+t),e<0?(e=-e,s.fontDirection=-1):s.fontDirection=1,this.current.font=i,this.current.fontSize=e,i.isType3Font)return;const n=i.loadedName||"sans-serif",a=((d=i.systemFontInfo)==null?void 0:d.css)||'"'.concat(n,'", ').concat(i.fallbackName);let o="normal";i.black?o="900":i.bold&&(o="bold");const l=i.italic?"italic":"normal";let c=e;e<Rw?c=Rw:e>Mw&&(c=Mw),this.current.fontSizeScale=e/c,this.ctx.font="".concat(l," ").concat(o," ").concat(c,"px ").concat(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){const{current:e}=this;e.textMatrix=t,e.textMatrixScale=Math.hypot(t[0],t[1]),e.x=e.lineX=0,e.y=e.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,i,s,n){const a=this.ctx,o=this.current,l=o.font,c=o.textRenderingMode,d=o.fontSize/o.fontSizeScale,u=c&me.FILL_STROKE_MASK,g=!!(c&me.ADD_TO_PATH_FLAG),b=o.patternFill&&!l.missingFile,w=o.patternStroke&&!l.missingFile;let v;if((l.disableFontFace||g||b||w)&&!l.missingFile&&(v=l.getPathGenerator(this.commonObjs,t)),v&&(l.disableFontFace||b||w)){a.save(),a.translate(e,i),a.scale(d,-d);let A;if((u===me.FILL||u===me.FILL_STROKE)&&(s?(A=a.getTransform(),a.setTransform(...s),a.fill(p(this,Xi,cm).call(this,v,A,s))):a.fill(v)),u===me.STROKE||u===me.FILL_STROKE)if(n){A||(A=a.getTransform()),a.setTransform(...n);const{a:y,b:S,c:_,d:E}=A,P=q.inverseTransform(n),x=q.transform([y,S,_,E,0,0],P);q.singularValueDecompose2dScale(x,oi),a.lineWidth*=Math.max(oi[0],oi[1])/d,a.stroke(p(this,Xi,cm).call(this,v,A,n))}else a.lineWidth/=d,a.stroke(v);a.restore()}else(u===me.FILL||u===me.FILL_STROKE)&&a.fillText(t,e,i),(u===me.STROKE||u===me.FILL_STROKE)&&a.strokeText(t,e,i);g&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Ct(a),x:e,y:i,fontSize:d,path:v})}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 i=!1;for(let s=3;s<e.length;s+=4)if(e[s]>0&&e[s]<255){i=!0;break}return st(this,"isFontSubpixelAAEnabled",i)}showText(t){const e=this.current,i=e.font;if(i.isType3Font)return this.showType3Text(t);const s=e.fontSize;if(s===0)return;const n=this.ctx,a=e.fontSizeScale,o=e.charSpacing,l=e.wordSpacing,c=e.fontDirection,d=e.textHScale*c,u=t.length,g=i.vertical,b=g?1:-1,w=i.defaultVMetrics,v=s*e.fontMatrix[0],A=e.textRenderingMode===me.FILL&&!i.disableFontFace&&!e.patternFill;n.save(),e.textMatrix&&n.transform(...e.textMatrix),n.translate(e.x,e.y+e.textRise),c>0?n.scale(d,-1):n.scale(d,1);let y,S;if(e.patternFill){n.save();const T=e.fillColor.getPattern(n,this,Yi(n),ue.FILL);y=Ct(n),n.restore(),n.fillStyle=T}if(e.patternStroke){n.save();const T=e.strokeColor.getPattern(n,this,Yi(n),ue.STROKE);S=Ct(n),n.restore(),n.strokeStyle=T}let _=e.lineWidth;const E=e.textMatrixScale;if(E===0||_===0){const T=e.textRenderingMode&me.FILL_STROKE_MASK;(T===me.STROKE||T===me.FILL_STROKE)&&(_=this.getSinglePixelWidth())}else _/=E;if(a!==1&&(n.scale(a,a),_/=a),n.lineWidth=_,i.isInvalidPDFjsFont){const T=[];let I=0;for(const C of t)T.push(C.unicode),I+=C.width;n.fillText(T.join(""),0,0),e.x+=I*v*d,n.restore(),this.compose();return}let P=0,x;for(x=0;x<u;++x){const T=t[x];if(typeof T=="number"){P+=b*T*s/1e3;continue}let I=!1;const C=(T.isSpace?l:0)+o,L=T.fontChar,M=T.accent;let G,W,$=T.width;if(g){const V=T.vmetric||w,N=-(T.vmetric?V[1]:$*.5)*v,mt=V[2]*v;$=V?-V[0]:$,G=N/a,W=(P+mt)/a}else G=P/a,W=0;if(i.remeasure&&$>0){const V=n.measureText(L).width*1e3/s*a;if($<V&&this.isFontSubpixelAAEnabled){const N=$/V;I=!0,n.save(),n.scale(N,1),G/=N}else $!==V&&(G+=($-V)/2e3*s/a)}if(this.contentVisible&&(T.isInFont||i.missingFile)){if(A&&!M)n.fillText(L,G,W);else if(this.paintChar(L,G,W,y,S),M){const V=G+s*M.offset.x/a,N=W-s*M.offset.y/a;this.paintChar(M.fontChar,V,N,y,S)}}const Tt=g?$*v-C*c:$*v+C*c;P+=Tt,I&&n.restore()}g?e.y-=P:e.x+=P*d,n.restore(),this.compose()}showType3Text(t){const e=this.ctx,i=this.current,s=i.font,n=i.fontSize,a=i.fontDirection,o=s.vertical?1:-1,l=i.charSpacing,c=i.wordSpacing,d=i.textHScale*a,u=i.fontMatrix||Np,g=t.length,b=i.textRenderingMode===me.INVISIBLE;let w,v,A,y;if(!(b||n===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),i.textMatrix&&e.transform(...i.textMatrix),e.translate(i.x,i.y+i.textRise),e.scale(d,a),w=0;w<g;++w){if(v=t[w],typeof v=="number"){y=o*v*n/1e3,this.ctx.translate(y,0),i.x+=y*d;continue}const S=(v.isSpace?c:0)+l,_=s.charProcOperatorList[v.operatorListId];_?this.contentVisible&&(this.save(),e.scale(n,n),e.transform(...u),this.executeOperatorList(_),this.restore()):Z('Type3 character "'.concat(v.operatorListId,'" is not available.'));const E=[v.width,0];q.applyTransform(E,u),A=E[0]*n+S,e.translate(A,0),i.x+=A*d}e.restore()}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,i,s,n,a){const o=new Path2D;o.rect(i,s,n-i,a-s),this.ctx.clip(o),this.endPath()}getColorN_Pattern(t){let e;if(t[0]==="TilingPattern"){const i=this.baseTransform||Ct(this.ctx),s={createCanvasGraphics:n=>new uw(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new om(t,this.ctx,s,i)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t){this.ctx.strokeStyle=this.current.strokeColor=t,this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t){this.ctx.fillStyle=this.current.fillColor=t,this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e=null){let i;return this.cachedPatterns.has(t)?i=this.cachedPatterns.get(t):(i=$E(this.getObject(t)),this.cachedPatterns.set(t,i)),e&&(i.matrix=e),i}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const i=this._getPattern(t);e.fillStyle=i.getPattern(e,this,Yi(e),ue.SHADING);const s=Yi(e);if(s){const{width:n,height:a}=e.canvas,o=tl.slice();q.axialAlignedBoundingBox([0,0,n,a],s,o);const[l,c,d,u]=o;this.ctx.fillRect(l,c,d-l,u-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){pt("Should not call beginInlineImage")}beginImageData(){pt("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=Ct(this.ctx),e)){q.axialAlignedBoundingBox(e,this.baseTransform,this.current.minMax);const[i,s,n,a]=e,o=new Path2D;o.rect(i,s,n-i,a-s),this.ctx.clip(o),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||ep("TODO: Support non-isolated groups."),t.knockout&&Z("Knockout groups not supported.");const i=Ct(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let s=tl.slice();q.axialAlignedBoundingBox(t.bbox,Ct(e),s);const n=[0,0,e.canvas.width,e.canvas.height];s=q.intersect(s,n)||[0,0,0,0];const a=Math.floor(s[0]),o=Math.floor(s[1]),l=Math.max(Math.ceil(s[2])-a,1),c=Math.max(Math.ceil(s[3])-o,1);this.current.startNewPathAndClipBox([0,0,l,c]);let d="groupAt"+this.groupLevel;t.smask&&(d+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(d,l,c),g=u.context;g.translate(-a,-o),g.transform(...i);let b=new Path2D;const[w,v,A,y]=t.bbox;if(b.rect(w,v,A-w,y-v),t.matrix){const S=new Path2D;S.addPath(b,new DOMMatrix(t.matrix)),b=S}g.clip(b),t.smask?this.smaskStack.push({canvas:u.canvas,context:g,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()),zh(e,g),this.ctx=g,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,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const s=Ct(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...s);const n=tl.slice();q.axialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],s,n),this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(t,e,i,s,n){if(p(this,Xi,lm).call(this),ff(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){i=i.slice(),i[4]-=e[0],i[5]-=e[1],e=e.slice(),e[0]=e[1]=0,e[2]=a,e[3]=o,q.singularValueDecompose2dScale(Ct(this.ctx),oi);const{viewportScale:l}=this,c=Math.ceil(a*this.outputScaleX*l),d=Math.ceil(o*this.outputScaleY*l);this.annotationCanvas=this.canvasFactory.create(c,d);const{canvas:u,context:g}=this.annotationCanvas;this.annotationCanvasMap.set(t,u),this.annotationCanvas.savedCtx=this.ctx,this.ctx=g,this.ctx.save(),this.ctx.setTransform(oi[0],0,0,-oi[1],0,o*oi[1]),ff(this.ctx)}else{ff(this.ctx),this.endPath();const l=new Path2D;l.rect(e[0],e[1],a,o),this.ctx.clip(l)}}this.current=new Dw(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),p(this,Xi,hm).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 i=this.ctx,s=this._createMaskCanvas(t),n=s.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(n,s.offsetX,s.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,i=0,s=0,n,a){if(!this.contentVisible)return;t=this.getObject(t.data,t);const o=this.ctx;o.save();const l=Ct(o);o.transform(e,i,s,n,0,0);const c=this._createMaskCanvas(t);o.setTransform(1,0,0,1,c.offsetX-l[4],c.offsetY-l[5]);for(let d=0,u=a.length;d<u;d+=2){const g=q.transform(l,[e,i,s,n,a[d],a[d+1]]);o.drawImage(c.canvas,g[4],g[5])}o.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,i=this.current.fillColor,s=this.current.patternFill;for(const n of t){const{data:a,width:o,height:l,transform:c}=n,d=this.cachedCanvases.getCanvas("maskCanvas",o,l),u=d.context;u.save();const g=this.getObject(a,n);Fw(u,g),u.globalCompositeOperation="source-in",u.fillStyle=s?i.getPattern(u,this,Yi(e),ue.FILL):i,u.fillRect(0,0,o,l),u.restore(),e.save(),e.transform(...c),e.scale(1,-1),uf(e,d.canvas,0,0,o,l,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);if(!e){Z("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e)}paintImageXObjectRepeat(t,e,i,s){if(!this.contentVisible)return;const n=this.getObject(t);if(!n){Z("Dependent image isn't ready yet");return}const a=n.width,o=n.height,l=[];for(let c=0,d=s.length;c<d;c+=2)l.push({transform:[e,0,0,i,s[c],s[c+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(n,l)}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:i,height:s}=t,n=this.cachedCanvases.getCanvas("inlineImage",i,s),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,i=t.height,s=this.ctx;this.save();const{filter:n}=s;n!=="none"&&n!==""&&(s.filter="none"),s.scale(1/e,-1/i);let a;if(t.bitmap)a=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)a=t;else{const c=this.cachedCanvases.getCanvas("inlineImage",e,i).context;Nw(c,t),a=this.applyTransferMapsToCanvas(c)}const o=this._scaleImage(a,Yi(s));s.imageSmoothingEnabled=Ow(Ct(s),t.interpolate),uf(s,o.img,0,0,o.paintWidth,o.paintHeight,0,-i,e,i),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const i=this.ctx;let s;if(t.bitmap)s=t.bitmap;else{const n=t.width,a=t.height,l=this.cachedCanvases.getCanvas("inlineImage",n,a).context;Nw(l,t),s=this.applyTransferMapsToCanvas(l)}for(const n of e)i.save(),i.transform(...n.transform),i.scale(1,-1),uf(i,s,n.x,n.y,n.w,n.h,0,-1,1,1),i.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,e){const i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const s=this.ctx;this.pendingClip&&(i||(this.pendingClip===Bw?s.clip(t,"evenodd"):s.clip(t)),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=Ct(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]),i=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:e,b:i,c:s,d:n}=this.ctx.getTransform();let a,o;if(i===0&&s===0){const l=Math.abs(e),c=Math.abs(n);if(l===c)if(t===0)a=o=1/l;else{const d=l*t;a=o=d<1?1/d:1}else if(t===0)a=1/l,o=1/c;else{const d=l*t,u=c*t;a=d<1?1/d:1,o=u<1?1/u:1}}else{const l=Math.abs(e*n-i*s),c=Math.hypot(e,i),d=Math.hypot(s,n);if(t===0)a=d/l,o=c/l;else{const u=t*l;a=d>u?d/u:1,o=c>u?c/u:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,e){const{ctx:i,current:{lineWidth:s}}=this,[n,a]=this.getScaleForStroking();if(n===a){i.lineWidth=(s||1)*n,i.stroke(t);return}const o=i.getLineDash();e&&i.save(),i.scale(n,a),bp.a=1/n,bp.d=1/a;const l=new Path2D;if(l.addPath(t,bp),o.length>0){const c=Math.max(n,a);i.setLineDash(o.map(d=>d/c)),i.lineDashOffset/=c}i.lineWidth=s||1,i.stroke(l),e&&i.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};Xi=new WeakSet,lm=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)},hm=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}}},cm=function(t,e,i){const s=new Path2D;return s.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),s};let sl=uw;for(const h in wg)sl.prototype[h]!==void 0&&(sl.prototype[wg[h]]=sl.prototype[h]);var Af,gd,pd;let Vn=(Af=class{static get workerPort(){return r(this,gd)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");f(this,gd,t)}static get workerSrc(){return r(this,pd)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");f(this,pd,t)}},gd=new WeakMap,pd=new WeakMap,m(Af,gd,null),m(Af,pd,""),Af);var Il,md;class KE{constructor({parsedData:t,rawData:e}){m(this,Il);m(this,md);f(this,Il,t),f(this,md,e)}getRaw(){return r(this,md)}get(t){var e;return(e=r(this,Il).get(t))!=null?e:null}[Symbol.iterator](){return r(this,Il).entries()}}Il=new WeakMap,md=new WeakMap;const Wo=Symbol("INTERNAL");var bd,wd,vd,Ll;class ZE{constructor(t,{name:e,intent:i,usage:s,rbGroups:n}){m(this,bd,!1);m(this,wd,!1);m(this,vd,!1);m(this,Ll,!0);f(this,bd,!!(t&ri.DISPLAY)),f(this,wd,!!(t&ri.PRINT)),this.name=e,this.intent=i,this.usage=s,this.rbGroups=n}get visible(){if(r(this,vd))return r(this,Ll);if(!r(this,Ll))return!1;const{print:t,view:e}=this.usage;return r(this,bd)?(e==null?void 0:e.viewState)!=="OFF":r(this,wd)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,i=!1){t!==Wo&&pt("Internal method `_setVisible` called."),f(this,vd,i),f(this,Ll,e)}}bd=new WeakMap,wd=new WeakMap,vd=new WeakMap,Ll=new WeakMap;var sr,ft,Rl,Ml,yd,dm;class QE{constructor(t,e=ri.DISPLAY){m(this,yd);m(this,sr,null);m(this,ft,new Map);m(this,Rl,null);m(this,Ml,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,f(this,Ml,t.order);for(const i of t.groups)r(this,ft).set(i.id,new ZE(e,i));if(t.baseState==="OFF")for(const i of r(this,ft).values())i._setVisible(Wo,!1);for(const i of t.on)r(this,ft).get(i)._setVisible(Wo,!0);for(const i of t.off)r(this,ft).get(i)._setVisible(Wo,!1);f(this,Rl,this.getHash())}}isVisible(t){if(r(this,ft).size===0)return!0;if(!t)return ep("Optional content group not defined."),!0;if(t.type==="OCG")return r(this,ft).has(t.id)?r(this,ft).get(t.id).visible:(Z("Optional content group not found: ".concat(t.id)),!0);if(t.type==="OCMD"){if(t.expression)return p(this,yd,dm).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!r(this,ft).has(e))return Z("Optional content group not found: ".concat(e)),!0;if(r(this,ft).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!r(this,ft).has(e))return Z("Optional content group not found: ".concat(e)),!0;if(!r(this,ft).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!r(this,ft).has(e))return Z("Optional content group not found: ".concat(e)),!0;if(!r(this,ft).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!r(this,ft).has(e))return Z("Optional content group not found: ".concat(e)),!0;if(r(this,ft).get(e).visible)return!1}return!0}return Z("Unknown optional content policy ".concat(t.policy,".")),!0}return Z("Unknown group type ".concat(t.type,".")),!0}setVisibility(t,e=!0,i=!0){var n;const s=r(this,ft).get(t);if(!s){Z("Optional content group not found: ".concat(t));return}if(i&&e&&s.rbGroups.length)for(const a of s.rbGroups)for(const o of a)o!==t&&((n=r(this,ft).get(o))==null||n._setVisible(Wo,!1,!0));s._setVisible(Wo,!!e,!0),f(this,sr,null)}setOCGState({state:t,preserveRB:e}){let i;for(const s of t){switch(s){case"ON":case"OFF":case"Toggle":i=s;continue}const n=r(this,ft).get(s);if(n)switch(i){case"ON":this.setVisibility(s,!0,e);break;case"OFF":this.setVisibility(s,!1,e);break;case"Toggle":this.setVisibility(s,!n.visible,e);break}}f(this,sr,null)}get hasInitialVisibility(){return r(this,Rl)===null||this.getHash()===r(this,Rl)}getOrder(){return r(this,ft).size?r(this,Ml)?r(this,Ml).slice():[...r(this,ft).keys()]:null}getGroup(t){return r(this,ft).get(t)||null}getHash(){if(r(this,sr)!==null)return r(this,sr);const t=new Hy;for(const[e,i]of r(this,ft))t.update("".concat(e,":").concat(i.visible));return f(this,sr,t.hexdigest())}[Symbol.iterator](){return r(this,ft).entries()}}sr=new WeakMap,ft=new WeakMap,Rl=new WeakMap,Ml=new WeakMap,yd=new WeakSet,dm=function(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let s=1;s<e;s++){const n=t[s];let a;if(Array.isArray(n))a=p(this,yd,dm).call(this,n);else if(r(this,ft).has(n))a=r(this,ft).get(n).visible;else return Z("Optional content group not found: ".concat(n)),!0;switch(i){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return i==="And"};class JE{constructor(t,{disableRange:e=!1,disableStream:i=!1}){Ht(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:s,initialData:n,progressiveDone:a,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=o,(n==null?void 0:n.length)>0){const l=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!i,this._isRangeSupported=!e,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((l,c)=>{this._onReceiveData({begin:l,chunk:c})}),t.addProgressListener((l,c)=>{this._onProgress({loaded:l,total:c})}),t.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){const i=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i);else{const s=this._rangeReaders.some(function(n){return n._begin!==t?!1:(n._enqueue(i),!0)});Ht(s,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t,e;return(e=(t=this._fullRequestReader)==null?void 0:t._loaded)!=null?e:0}_onProgress(t){var e,i,s,n;t.total===void 0?(i=(e=this._rangeReaders[0])==null?void 0:e.onProgress)==null||i.call(e,{loaded:t.loaded}):(n=(s=this._fullRequestReader)==null?void 0:s.onProgress)==null||n.call(s,{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(){Ht(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new tS(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new eS(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const i of this._rangeReaders.slice(0))i.cancel(t);this._pdfDataRangeTransport.abort()}}class tS{constructor(t,e,i=!1,s=null){this._stream=t,this._done=i||!1,this._filename=Kb(s)?s: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 eS{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,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 i of this._requests)i.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 iS(h){let t=!0,e=i("filename\\*","i").exec(h);if(e){e=e[1];let d=o(e);return d=unescape(d),d=l(d),d=c(d),n(d)}if(e=a(h),e){const d=c(e);return n(d)}if(e=i("filename","i").exec(h),e){e=e[1];let d=o(e);return d=c(d),n(d)}function i(d,u){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function s(d,u){if(d){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const g=new TextDecoder(d,{fatal:!0}),b=ef(u);u=g.decode(b),t=!1}catch(g){}}return u}function n(d){return t&&/[\x80-\xff]/.test(d)&&(d=s("utf-8",d),t&&(d=s("iso-8859-1",d))),d}function a(d){const u=[];let g;const b=i("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(g=b.exec(d))!==null;){let[,v,A,y]=g;if(v=parseInt(v,10),v in u){if(v===0)break;continue}u[v]=[A,y]}const w=[];for(let v=0;v<u.length&&v in u;++v){let[A,y]=u[v];y=o(y),A&&(y=unescape(y),v===0&&(y=l(y))),w.push(y)}return w.join("")}function o(d){if(d.startsWith('"')){const u=d.slice(1).split('\\"');for(let g=0;g<u.length;++g){const b=u[g].indexOf('"');b!==-1&&(u[g]=u[g].slice(0,b),u.length=g+1),u[g]=u[g].replaceAll(/\\(.)/g,"$1")}d=u.join('"')}return d}function l(d){const u=d.indexOf("'");if(u===-1)return d;const g=d.slice(0,u),w=d.slice(u+1).replace(/^[^']*'/,"");return s(g,w)}function c(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(u,g,b,w){if(b==="q"||b==="Q")return w=w.replaceAll("_"," "),w=w.replaceAll(/=([0-9a-fA-F]{2})/g,function(v,A){return String.fromCharCode(parseInt(A,16))}),s(g,w);try{w=atob(w)}catch(v){}return s(g,w)})}return""}function Qy(h,t){const e=new Headers;if(!h||!t||typeof t!="object")return e;for(const i in t){const s=t[i];s!==void 0&&e.append(i,s)}return e}function np(h){var t,e;return(e=(t=URL.parse(h))==null?void 0:t.origin)!=null?e:null}function Jy({responseHeaders:h,isHttp:t,rangeChunkSize:e,disableRange:i}){const s={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(h.get("Content-Length"),10);return!Number.isInteger(n)||(s.suggestedLength=n,n<=2*e)||i||!t||h.get("Accept-Ranges")!=="bytes"||(h.get("Content-Encoding")||"identity")!=="identity"||(s.allowRangeRequests=!0),s}function t0(h){const t=h.get("Content-Disposition");if(t){let e=iS(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch(i){}if(Kb(e))return e}return null}function af(h,t){return new vg("Unexpected server response (".concat(h,') while retrieving PDF "').concat(t,'".'),h,h===404||h===0&&t.startsWith("file:"))}function e0(h){return h===200||h===206}function i0(h,t,e){return{method:"GET",headers:h,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function s0(h){return h instanceof Uint8Array?h.buffer:h instanceof ArrayBuffer?h:(Z("getArrayBuffer - unexpected data format: ".concat(h)),new Uint8Array(h).buffer)}class sS{constructor(t){k(this,"_responseOrigin",null);this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=Qy(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return(e=(t=this._fullRequestReader)==null?void 0:t._loaded)!=null?e:0}getFullReader(){return Ht(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new nS(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new rS(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class nS{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 i=new Headers(t.headers),s=e.url;fetch(s,i0(i,this._withCredentials,this._abortController)).then(n=>{if(t._responseOrigin=np(n.url),!e0(n.status))throw af(n.status,s);this._reader=n.body.getReader(),this._headersCapability.resolve();const a=n.headers,{allowRangeRequests:o,suggestedLength:l}=Jy({responseHeaders:a,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=l||this._contentLength,this._filename=t0(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new qr("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 i;await this._headersCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(i=this.onProgress)==null||i.call(this,{loaded:this._loaded,total:this._contentLength}),{value:s0(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class rS{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const s=t.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController;const n=new Headers(t.headers);n.append("Range","bytes=".concat(e,"-").concat(i-1));const a=s.url;fetch(a,i0(n,this._withCredentials,this._abortController)).then(o=>{const l=np(o.url);if(l!==t._responseOrigin)throw new Error('Expected range response-origin "'.concat(l,'" to match "').concat(t._responseOrigin,'".'));if(!e0(o.status))throw af(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 i;await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(i=this.onProgress)==null||i.call(this,{loaded:this._loaded}),{value:s0(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}const wp=200,vp=206;function aS(h){const t=h.response;return typeof t!="string"?t:ef(t).buffer}class oS{constructor({url:t,httpHeaders:e,withCredentials:i}){k(this,"_responseOrigin",null);this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=Qy(this.isHttp,e),this.withCredentials=i||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(t){const e=new XMLHttpRequest,i=this.currXhrId++,s=this.pendingRequests[i]={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=".concat(t.begin,"-").concat(t.end-1)),s.expectedStatus=vp):s.expectedStatus=wp,e.responseType="arraybuffer",Ht(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>{t.onError(e.status)},e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),s.onHeadersReceived=t.onHeadersReceived,s.onDone=t.onDone,s.onError=t.onError,s.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){var s;const i=this.pendingRequests[t];i&&((s=i.onProgress)==null||s.call(i,e))}onStateChange(t,e){const i=this.pendingRequests[t];if(!i)return;const s=i.xhr;if(s.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),s.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],s.status===0&&this.isHttp){i.onError(s.status);return}const n=s.status||wp;if(!(n===wp&&i.expectedStatus===vp)&&n!==i.expectedStatus){i.onError(s.status);return}const o=aS(s);if(n===vp){const l=s.getResponseHeader("Content-Range"),c=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);c?i.onDone({begin:parseInt(c[1],10),chunk:o}):(Z('Missing or invalid "Content-Range" header.'),i.onError(0))}else o?i.onDone({begin:0,chunk:o}):i.onError(s.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 lS{constructor(t){this._source=t,this._manager=new oS(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 Ht(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new hS(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new cS(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class hS{constructor(t,e){this._manager=t,this._url=e.url,this._fullRequestId=t.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),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);this._manager._responseOrigin=np(e.responseURL);const i=e.getAllResponseHeaders(),s=new Headers(i?i.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(o=>{const[l,...c]=o.split(": ");return[l,c.join(": ")]}):[]),{allowRangeRequests:n,suggestedLength:a}=Jy({responseHeaders:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=t0(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=af(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(await this._headersCapability.promise,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 cS{constructor(t,e,i){this._manager=t,this._url=t.url,this._requestId=t.request({begin:e,end:i,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var e;const t=np((e=this._manager.getRequestXhr(this._requestId))==null?void 0:e.responseURL);t!==this._manager._responseOrigin&&(this._storedError=new Error('Expected range response-origin "'.concat(t,'" to match "').concat(this._manager._responseOrigin,'".')),this._onError(0))}_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 i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){var e;(e=this._storedError)!=null||(this._storedError=af(t,this._url));for(const i of this._requests)i.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 dS=/^[a-z][a-z0-9\-+.]+:/i;function uS(h){if(dS.test(h))return new URL(h);const t=process.getBuiltinModule("url");return new URL(t.pathToFileURL(h))}class fS{constructor(t){this.source=t,this.url=uS(t.url),Ht(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return(e=(t=this._fullRequestReader)==null?void 0:t._loaded)!=null?e:0}getFullReader(){return Ht(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new gS(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new pS(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class gS{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();const i=process.getBuiltinModule("fs");i.promises.lstat(this._url).then(s=>{this._contentLength=s.size,this._setReadableStream(i.createReadStream(this._url)),this._headersCapability.resolve()},s=>{s.code==="ENOENT"&&(s=af(0,this._url.href)),this._storedError=s,this._headersCapability.reject(s)})}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 i;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,(i=this.onProgress)==null||i.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 qr("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class pS{constructor(t,e,i){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const s=t.source;this._isStreamingSupported=!s.disableStream;const n=process.getBuiltinModule("fs");this._setReadableStream(n.createReadStream(this._url,{start:e,end:i-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var i;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,(i=this.onProgress)==null||i.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)}}const Gh=Symbol("INITIAL_DATA");var Ge,_d,um;class n0{constructor(){m(this,_d);m(this,Ge,Object.create(null))}get(t,e=null){if(e){const s=p(this,_d,um).call(this,t);return s.promise.then(()=>e(s.data)),null}const i=r(this,Ge)[t];if(!i||i.data===Gh)throw new Error("Requesting object that isn't resolved yet ".concat(t,"."));return i.data}has(t){const e=r(this,Ge)[t];return!!e&&e.data!==Gh}delete(t){const e=r(this,Ge)[t];return!e||e.data===Gh?!1:(delete r(this,Ge)[t],!0)}resolve(t,e=null){const i=p(this,_d,um).call(this,t);i.data=e,i.resolve()}clear(){var t;for(const e in r(this,Ge)){const{data:i}=r(this,Ge)[e];(t=i==null?void 0:i.bitmap)==null||t.close()}f(this,Ge,Object.create(null))}*[Symbol.iterator](){for(const t in r(this,Ge)){const{data:e}=r(this,Ge)[t];e!==Gh&&(yield[t,e])}}}Ge=new WeakMap,_d=new WeakSet,um=function(t){var e;return(e=r(this,Ge))[t]||(e[t]={...Promise.withResolvers(),data:Gh})};const mS=1e5,Vw=30;var Xv,nr,Ne,Ad,Ed,Na,Ks,Sd,Pd,Fa,kl,Dl,rr,Nl,xd,Fl,Oa,Cd,Td,Mt,Ol,Ba,Id,ar,Bl,Ln,r0,a0,gm,di,kf,pm,o0,l0;let fm=(Mt=class{constructor({textContentSource:t,container:e,viewport:i}){m(this,Ln);m(this,nr,Promise.withResolvers());m(this,Ne,null);m(this,Ad,!1);m(this,Ed,!!((Xv=globalThis.FontInspector)!=null&&Xv.enabled));m(this,Na,null);m(this,Ks,null);m(this,Sd,0);m(this,Pd,0);m(this,Fa,null);m(this,kl,null);m(this,Dl,0);m(this,rr,0);m(this,Nl,Object.create(null));m(this,xd,[]);m(this,Fl,null);m(this,Oa,[]);m(this,Cd,new WeakMap);m(this,Td,null);var l;if(t instanceof ReadableStream)f(this,Fl,t);else if(typeof t=="object")f(this,Fl,new ReadableStream({start(c){c.enqueue(t),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');f(this,Ne,f(this,kl,e)),f(this,rr,i.scale*ko.pixelRatio),f(this,Dl,i.rotation),f(this,Ks,{div:null,properties:null,ctx:null});const{pageWidth:s,pageHeight:n,pageX:a,pageY:o}=i.rawDims;f(this,Td,[1,0,0,-1,-a,o+n]),f(this,Pd,s),f(this,Sd,n),p(l=Mt,di,o0).call(l),Mo(e,i),r(this,nr).promise.finally(()=>{r(Mt,Bl).delete(this),f(this,Ks,null),f(this,Nl,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=pe.platform;return st(this,"fontFamilyMap",new Map([["sans-serif","".concat(t&&e?"Calibri, ":"","sans-serif")],["monospace","".concat(t&&e?"Lucida Console, ":"","monospace")]]))}render(){const t=()=>{r(this,Fa).read().then(({value:e,done:i})=>{var s;if(i){r(this,nr).resolve();return}(s=r(this,Na))!=null||f(this,Na,e.lang),Object.assign(r(this,Nl),e.styles),p(this,Ln,r0).call(this,e.items),t()},r(this,nr).reject)};return f(this,Fa,r(this,Fl).getReader()),r(Mt,Bl).add(this),t(),r(this,nr).promise}update({viewport:t,onBefore:e=null}){var n;const i=t.scale*ko.pixelRatio,s=t.rotation;if(s!==r(this,Dl)&&(e==null||e(),f(this,Dl,s),Mo(r(this,kl),{rotation:s})),i!==r(this,rr)){e==null||e(),f(this,rr,i);const a={div:null,properties:null,ctx:p(n=Mt,di,kf).call(n,r(this,Na))};for(const o of r(this,Oa))a.properties=r(this,Cd).get(o),a.div=o,p(this,Ln,gm).call(this,a)}}cancel(){var e;const t=new qr("TextLayer task cancelled.");(e=r(this,Fa))==null||e.cancel(t).catch(()=>{}),f(this,Fa,null),r(this,nr).reject(t)}get textDivs(){return r(this,Oa)}get textContentItemsStr(){return r(this,xd)}static cleanup(){if(!(r(this,Bl).size>0)){r(this,Ol).clear();for(const{canvas:t}of r(this,Ba).values())t.remove();r(this,Ba).clear()}}},nr=new WeakMap,Ne=new WeakMap,Ad=new WeakMap,Ed=new WeakMap,Na=new WeakMap,Ks=new WeakMap,Sd=new WeakMap,Pd=new WeakMap,Fa=new WeakMap,kl=new WeakMap,Dl=new WeakMap,rr=new WeakMap,Nl=new WeakMap,xd=new WeakMap,Fl=new WeakMap,Oa=new WeakMap,Cd=new WeakMap,Td=new WeakMap,Ol=new WeakMap,Ba=new WeakMap,Id=new WeakMap,ar=new WeakMap,Bl=new WeakMap,Ln=new WeakSet,r0=function(t){var s,n,a;if(r(this,Ad))return;(a=(n=r(this,Ks)).ctx)!=null||(n.ctx=p(s=Mt,di,kf).call(s,r(this,Na)));const e=r(this,Oa),i=r(this,xd);for(const o of t){if(e.length>mS){Z("Ignoring additional textDivs for performance reasons."),f(this,Ad,!0);return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){const l=r(this,Ne);f(this,Ne,document.createElement("span")),r(this,Ne).classList.add("markedContent"),o.id&&r(this,Ne).setAttribute("id","".concat(o.id)),l.append(r(this,Ne))}else o.type==="endMarkedContent"&&f(this,Ne,r(this,Ne).parentNode);continue}i.push(o.str),p(this,Ln,a0).call(this,o)}},a0=function(t){var v;const e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};r(this,Oa).push(e);const s=q.transform(r(this,Td),t.transform);let n=Math.atan2(s[1],s[0]);const a=r(this,Nl)[t.fontName];a.vertical&&(n+=Math.PI/2);let o=r(this,Ed)&&a.fontSubstitution||a.fontFamily;o=Mt.fontFamilyMap.get(o)||o;const l=Math.hypot(s[2],s[3]),c=l*p(v=Mt,di,l0).call(v,o,a,r(this,Na));let d,u;n===0?(d=s[4],u=s[5]-c):(d=s[4]+c*Math.sin(n),u=s[5]-c*Math.cos(n));const g="calc(var(--total-scale-factor) *",b=e.style;r(this,Ne)===r(this,kl)?(b.left="".concat((100*d/r(this,Pd)).toFixed(2),"%"),b.top="".concat((100*u/r(this,Sd)).toFixed(2),"%")):(b.left="".concat(g).concat(d.toFixed(2),"px)"),b.top="".concat(g).concat(u.toFixed(2),"px)")),b.fontSize="".concat(g).concat((r(Mt,ar)*l).toFixed(2),"px)"),b.fontFamily=o,i.fontSize=l,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,r(this,Ed)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),n!==0&&(i.angle=n*(180/Math.PI));let w=!1;if(t.str.length>1)w=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const A=Math.abs(t.transform[0]),y=Math.abs(t.transform[3]);A!==y&&Math.max(A,y)/Math.min(A,y)>1.5&&(w=!0)}if(w&&(i.canvasWidth=a.vertical?t.height:t.width),r(this,Cd).set(e,i),r(this,Ks).div=e,r(this,Ks).properties=i,p(this,Ln,gm).call(this,r(this,Ks)),i.hasText&&r(this,Ne).append(e),i.hasEOL){const A=document.createElement("br");A.setAttribute("role","presentation"),r(this,Ne).append(A)}},gm=function(t){var o;const{div:e,properties:i,ctx:s}=t,{style:n}=e;let a="";if(r(Mt,ar)>1&&(a="scale(".concat(1/r(Mt,ar),")")),i.canvasWidth!==0&&i.hasText){const{fontFamily:l}=n,{canvasWidth:c,fontSize:d}=i;p(o=Mt,di,pm).call(o,s,d*r(this,rr),l);const{width:u}=s.measureText(e.textContent);u>0&&(a="scaleX(".concat(c*r(this,rr)/u,") ").concat(a))}i.angle!==0&&(a="rotate(".concat(i.angle,"deg) ").concat(a)),a.length>0&&(n.transform=a)},di=new WeakSet,kf=function(t=null){let e=r(this,Ba).get(t||(t=""));if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),r(this,Ba).set(t,e),r(this,Id).set(e,{size:0,family:""})}return e},pm=function(t,e,i){const s=r(this,Id).get(t);e===s.size&&i===s.family||(t.font="".concat(e,"px ").concat(i),s.size=e,s.family=i)},o0=function(){if(r(this,ar)!==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),f(this,ar,t.getBoundingClientRect().height),t.remove()},l0=function(t,e,i){const s=r(this,Ol).get(t);if(s)return s;const n=p(this,di,kf).call(this,i);n.canvas.width=n.canvas.height=Vw,p(this,di,pm).call(this,n,Vw,t);const a=n.measureText(""),o=a.fontBoundingBoxAscent,l=Math.abs(a.fontBoundingBoxDescent);n.canvas.width=n.canvas.height=0;let c=.8;return o?c=o/(o+l):(pe.platform.isFirefox&&Z("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?c=e.ascent:e.descent&&(c=1+e.descent)),r(this,Ol).set(t,c),c},m(Mt,di),m(Mt,Ol,new Map),m(Mt,Ba,new Map),m(Mt,Id,new WeakMap),m(Mt,ar,null),m(Mt,Bl,new Set),Mt);class Fc{static textContent(t){const e=[],i={items:e,styles:Object.create(null)};function s(n){var l;if(!n)return;let a=null;const o=n.name;if(o==="#text")a=n.value;else if(Fc.shouldBuildText(o))(l=n==null?void 0:n.attributes)!=null&&l.textContent?a=n.attributes.textContent:n.value&&(a=n.value);else return;if(a!==null&&e.push({str:a}),!!n.children)for(const c of n.children)s(c)}return s(t),i}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const bS=100;function h0(h={}){var gw,pw;typeof h=="string"||h instanceof URL?h={url:h}:(h instanceof ArrayBuffer||ArrayBuffer.isView(h))&&(h={data:h});const t=new mm,{docId:e}=t,i=h.url?xE(h.url):null,s=h.data?CE(h.data):null,n=h.httpHeaders||null,a=h.withCredentials===!0,o=(gw=h.password)!=null?gw:null,l=h.range instanceof c0?h.range:null,c=Number.isInteger(h.rangeChunkSize)&&h.rangeChunkSize>0?h.rangeChunkSize:2**16;let d=h.worker instanceof bm?h.worker:null;const u=h.verbosity,g=typeof h.docBaseUrl=="string"&&!ip(h.docBaseUrl)?h.docBaseUrl:null,b=cf(h.cMapUrl),w=h.cMapPacked!==!1,v=h.CMapReaderFactory||(Ie?NE:Cw),A=cf(h.iccUrl),y=cf(h.standardFontDataUrl),S=h.StandardFontDataFactory||(Ie?FE:Tw),_=cf(h.wasmUrl),E=h.WasmFactory||(Ie?OE:Iw),P=h.stopAtErrors!==!0,x=Number.isInteger(h.maxImageSize)&&h.maxImageSize>-1?h.maxImageSize:-1,T=h.isEvalSupported!==!1,I=typeof h.isOffscreenCanvasSupported=="boolean"?h.isOffscreenCanvasSupported:!Ie,C=typeof h.isImageDecoderSupported=="boolean"?h.isImageDecoderSupported:!Ie&&(pe.platform.isFirefox||!globalThis.chrome),L=Number.isInteger(h.canvasMaxAreaInBytes)?h.canvasMaxAreaInBytes:-1,M=typeof h.disableFontFace=="boolean"?h.disableFontFace:Ie,G=h.fontExtraProperties===!0,W=h.enableXfa===!0,$=h.ownerDocument||globalThis.document,Tt=h.disableRange===!0,V=h.disableStream===!0,N=h.disableAutoFetch===!0,mt=h.pdfBug===!0,_t=h.CanvasFactory||(Ie?DE:RE),fi=h.FilterFactory||(Ie?kE:ME),qi=h.enableHWA===!0,qt=h.useWasm!==!1,kt=l?l.length:(pw=h.length)!=null?pw:NaN,Bo=typeof h.useSystemFonts=="boolean"?h.useSystemFonts:!Ie&&!M,Mn=typeof h.useWorkerFetch=="boolean"?h.useWorkerFetch:!!(v===Cw&&S===Tw&&E===Iw&&b&&y&&_&&Qh(b,document.baseURI)&&Qh(y,document.baseURI)&&Qh(_,document.baseURI)),kn=null;aE(u);const It={canvasFactory:new _t({ownerDocument:$,enableHWA:qi}),filterFactory:new fi({docId:e,ownerDocument:$}),cMapReaderFactory:Mn?null:new v({baseUrl:b,isCompressed:w}),standardFontDataFactory:Mn?null:new S({baseUrl:y}),wasmFactory:Mn?null:new E({baseUrl:_})};d||(d=bm.create({verbosity:u,port:Vn.workerPort}),t._worker=d);const Wh={docId:e,apiVersion:"5.4.54",data:s,password:o,disableAutoFetch:N,rangeChunkSize:c,length:kt,docBaseUrl:g,enableXfa:W,evaluatorOptions:{maxImageSize:x,disableFontFace:M,ignoreErrors:P,isEvalSupported:T,isOffscreenCanvasSupported:I,isImageDecoderSupported:C,canvasMaxAreaInBytes:L,fontExtraProperties:G,useSystemFonts:Bo,useWasm:qt,useWorkerFetch:Mn,cMapUrl:b,iccUrl:A,standardFontDataUrl:y,wasmUrl:_}},RA={ownerDocument:$,pdfBug:mt,styleElement:kn,loadingParams:{disableAutoFetch:N,enableXfa:W}};return d.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const MA=d.messageHandler.sendWithPromise("GetDocRequest",Wh,s?[s.buffer]:null);let lp;if(l)lp=new JE(l,{disableRange:Tt,disableStream:V});else if(!s){if(!i)throw new Error("getDocument - no `url` parameter provided.");const hp=Qh(i)?sS:Ie?fS:lS;lp=new hp({url:i,length:kt,httpHeaders:n,withCredentials:a,rangeChunkSize:c,disableRange:Tt,disableStream:V})}return MA.then(hp=>{if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const mw=new sc(e,hp,d.port),kA=new yS(mw,t,lp,RA,It,qi);t._transport=kA,mw.send("Ready",null)})}).catch(t._capability.reject),t}var Vg;const Hg=class Hg{constructor(){k(this,"_capability",Promise.withResolvers());k(this,"_transport",null);k(this,"_worker",null);k(this,"docId","d".concat(se(Hg,Vg)._++));k(this,"destroyed",!1);k(this,"onPassword",null);k(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var t,e,i,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(n){throw(i=this._worker)!=null&&i.port&&delete this._worker._pendingDestroy,n}this._transport=null,(s=this._worker)==null||s.destroy(),this._worker=null}async getData(){return this._transport.getData()}};Vg=new WeakMap,m(Hg,Vg,0);let mm=Hg;var Va,Ld,Rd,Md,kd,qv;let c0=(qv=class{constructor(t,e,i=!1,s=null){m(this,Va,Promise.withResolvers());m(this,Ld,[]);m(this,Rd,[]);m(this,Md,[]);m(this,kd,[]);this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=s}addRangeListener(t){r(this,kd).push(t)}addProgressListener(t){r(this,Md).push(t)}addProgressiveReadListener(t){r(this,Rd).push(t)}addProgressiveDoneListener(t){r(this,Ld).push(t)}onDataRange(t,e){for(const i of r(this,kd))i(t,e)}onDataProgress(t,e){r(this,Va).promise.then(()=>{for(const i of r(this,Md))i(t,e)})}onDataProgressiveRead(t){r(this,Va).promise.then(()=>{for(const e of r(this,Rd))e(t)})}onDataProgressiveDone(){r(this,Va).promise.then(()=>{for(const t of r(this,Ld))t()})}transportReady(){r(this,Va).resolve()}requestDataRange(t,e){pt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},Va=new WeakMap,Ld=new WeakMap,Rd=new WeakMap,Md=new WeakMap,kd=new WeakMap,qv);class wS{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 st(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 Zs,Ha,lc;class vS{constructor(t,e,i,s=!1){m(this,Ha);m(this,Zs,!1);this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new Sw:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new n0,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:i=0,offsetY:s=0,dontFlip:n=!1}={}){return new nf({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:s,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 st(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,canvas:e=t.canvas,viewport:i,intent:s="display",annotationMode:n=Ps.ENABLE,transform:a=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:c=null,pageColors:d=null,printAnnotationStorage:u=null,isEditing:g=!1}){var P,x;(P=this._stats)==null||P.time("Overall");const b=this._transport.getRenderingIntent(s,n,u,g),{renderingIntent:w,cacheKey:v}=b;f(this,Zs,!1),l||(l=this._transport.getOptionalContentConfig(w));let A=this._intentStates.get(v);A||(A=Object.create(null),this._intentStates.set(v,A)),A.streamReaderCancelTimeout&&(clearTimeout(A.streamReaderCancelTimeout),A.streamReaderCancelTimeout=null);const y=!!(w&ri.PRINT);A.displayReadyCapability||(A.displayReadyCapability=Promise.withResolvers(),A.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(x=this._stats)==null||x.time("Page Request"),this._pumpOperatorList(b));const S=T=>{var I;A.renderTasks.delete(_),y&&f(this,Zs,!0),p(this,Ha,lc).call(this),T?(_.capability.reject(T),this._abortOperatorList({intentState:A,reason:T instanceof Error?T:new Error(T)})):_.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(I=globalThis.Stats)!=null&&I.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},_=new wm({callback:S,params:{canvas:e,canvasContext:t,viewport:i,transform:a,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:A.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!y,pdfBug:this._pdfBug,pageColors:d,enableHWA:this._transport.enableHWA});(A.renderTasks||(A.renderTasks=new Set)).add(_);const E=_.task;return Promise.all([A.displayReadyCapability.promise,l]).then(([T,I])=>{var C;if(this.destroyed){S();return}if((C=this._stats)==null||C.time("Rendering"),!(I.renderingIntent&w))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");_.initializeGraphics({transparency:T,optionalContentConfig:I}),_.operatorListChanged()}).catch(S),E}getOperatorList({intent:t="display",annotationMode:e=Ps.ENABLE,printAnnotationStorage:i=null,isEditing:s=!1}={}){var c;function n(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const a=this._transport.getRenderingIntent(t,e,i,s,!0);let o=this._intentStates.get(a.cacheKey);o||(o=Object.create(null),this._intentStates.set(a.cacheKey,o));let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=n,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(c=this._stats)==null||c.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(s){return s.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(i=>Fc.textContent(i));const e=this.streamTextContent(t);return new Promise(function(i,s){function n(){a.read().then(function({value:l,done:c}){var d;if(c){i(o);return}(d=o.lang)!=null||(o.lang=l.lang),Object.assign(o.styles,l.styles),o.items.push(...l.items),n()},s)}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 i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),f(this,Zs,!1),Promise.all(t)}cleanup(t=!1){f(this,Zs,!0);const e=p(this,Ha,lc).call(this);return t&&e&&this._stats&&(this._stats=new Sw),e}_startRenderPage(t,e){var s,n;const i=this._intentStates.get(e);i&&((s=this._stats)==null||s.timeEnd("Page Request"),(n=i.displayReadyCapability)==null||n.resolve(t))}_renderPageChunk(t,e){for(let i=0,s=t.length;i<s;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const i of e.renderTasks)i.operatorListChanged();t.lastChunk&&p(this,Ha,lc).call(this)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:i,modifiedIds:s}){const{map:n,transfer:a}=i,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:n,modifiedIds:s},a).getReader(),c=this._intentStates.get(e);c.streamReader=l;const d=()=>{l.read().then(({value:u,done:g})=>{if(g){c.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(u,c),d())},u=>{if(c.streamReader=null,!this._transport.destroyed){if(c.operatorList){c.operatorList.lastChunk=!0;for(const g of c.renderTasks)g.operatorListChanged();p(this,Ha,lc).call(this)}if(c.displayReadyCapability)c.displayReadyCapability.reject(u);else if(c.opListReadCapability)c.opListReadCapability.reject(u);else throw u}})};d()}_abortOperatorList({intentState:t,reason:e,force:i=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!i){if(t.renderTasks.size>0)return;if(e instanceof Uh){let s=bS;e.extraDelay>0&&e.extraDelay<1e3&&(s+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},s);return}}if(t.streamReader.cancel(new qr(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[s,n]of this._intentStates)if(n===t){this._intentStates.delete(s);break}this.cleanup()}}}get stats(){return this._stats}}Zs=new WeakMap,Ha=new WeakSet,lc=function(){if(!r(this,Zs)||this.destroyed)return!1;for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),f(this,Zs,!1),!0};var or,ki,Qs,ja,bt,jg,$a,Ua,Re,Df,d0,u0,hc,Vl,Nf;let bm=(bt=class{constructor({name:t=null,port:e=null,verbosity:i=oE()}={}){m(this,Re);m(this,or,Promise.withResolvers());m(this,ki,null);m(this,Qs,null);m(this,ja,null);if(this.name=t,this.destroyed=!1,this.verbosity=i,e){if(r(bt,Ua).has(e))throw new Error("Cannot use more than one PDFWorker per port.");r(bt,Ua).set(e,this),p(this,Re,d0).call(this,e)}else p(this,Re,u0).call(this)}get promise(){return r(this,or).promise}get port(){return r(this,Qs)}get messageHandler(){return r(this,ki)}destroy(){var t,e;this.destroyed=!0,(t=r(this,ja))==null||t.terminate(),f(this,ja,null),r(bt,Ua).delete(r(this,Qs)),f(this,Qs,null),(e=r(this,ki))==null||e.destroy(),f(this,ki,null)}static create(t){const e=r(this,Ua).get(t==null?void 0:t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new bt(t)}static get workerSrc(){if(Vn.workerSrc)return Vn.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return st(this,"_setupFakeWorkerGlobal",(async()=>r(this,Vl,Nf)?r(this,Vl,Nf):(await import(this.workerSrc)).WorkerMessageHandler)())}},or=new WeakMap,ki=new WeakMap,Qs=new WeakMap,ja=new WeakMap,jg=new WeakMap,$a=new WeakMap,Ua=new WeakMap,Re=new WeakSet,Df=function(){r(this,or).resolve(),r(this,ki).send("configure",{verbosity:this.verbosity})},d0=function(t){f(this,Qs,t),f(this,ki,new sc("main","worker",t)),r(this,ki).on("ready",()=>{}),p(this,Re,Df).call(this)},u0=function(){if(r(bt,$a)||r(bt,Vl,Nf)){p(this,Re,hc).call(this);return}let{workerSrc:t}=bt;try{bt._isSameOrigin(window.location,t)||(t=bt._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new sc("main","worker",e),s=()=>{n.abort(),i.destroy(),e.terminate(),this.destroyed?r(this,or).reject(new Error("Worker was destroyed")):p(this,Re,hc).call(this)},n=new AbortController;e.addEventListener("error",()=>{r(this,ja)||s()},{signal:n.signal}),i.on("test",o=>{if(n.abort(),this.destroyed||!o){s();return}f(this,ki,i),f(this,Qs,e),f(this,ja,e),p(this,Re,Df).call(this)}),i.on("ready",o=>{if(n.abort(),this.destroyed){s();return}try{a()}catch(l){p(this,Re,hc).call(this)}});const a=()=>{const o=new Uint8Array;i.send("test",o,[o.buffer])};a();return}catch(e){ep("The worker has been disabled.")}p(this,Re,hc).call(this)},hc=function(){r(bt,$a)||(Z("Setting up fake worker."),f(bt,$a,!0)),bt._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){r(this,or).reject(new Error("Worker was destroyed"));return}const e=new LE;f(this,Qs,e);const i="fake".concat(se(bt,jg)._++),s=new sc(i+"_worker",i,e);t.setup(s,e),f(this,ki,new sc(i,i+"_worker",e)),p(this,Re,Df).call(this)}).catch(t=>{r(this,or).reject(new Error('Setting up fake worker failed: "'.concat(t.message,'".')))})},Vl=new WeakSet,Nf=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch(e){return null}},m(bt,Vl),m(bt,jg,0),m(bt,$a,!1),m(bt,Ua,new WeakMap),Ie&&(f(bt,$a,!0),Vn.workerSrc||(Vn.workerSrc="./pdf.worker.mjs")),bt._isSameOrigin=(t,e)=>{const i=URL.parse(t);if(!(i!=null&&i.origin)||i.origin==="null")return!1;const s=new URL(e,i);return i.origin===s.origin},bt._createCDNWrapper=t=>{const e='await import("'.concat(t,'");');return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},bt.fromPort=t=>{if(wE("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!(t!=null&&t.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return bt.create(t)},bt);var Js,cs,Hl,jl,tn,Wa,cc;class yS{constructor(t,e,i,s,n,a){m(this,Wa);m(this,Js,new Map);m(this,cs,new Map);m(this,Hl,new Map);m(this,jl,new Map);m(this,tn,null);this.messageHandler=t,this.loadingTask=e,this.commonObjs=new n0,this.fontLoader=new SE({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.wasmFactory=n.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=a,this.setupMessageHandler()}get annotationStorage(){return st(this,"annotationStorage",new Zb)}getRenderingIntent(t,e=Ps.ENABLE,i=null,s=!1,n=!1){let a=ri.DISPLAY,o=im;switch(t){case"any":a=ri.ANY;break;case"display":break;case"print":a=ri.PRINT;break;default:Z("getRenderingIntent - invalid intent: ".concat(t))}const l=a&ri.PRINT&&i instanceof $y?i:this.annotationStorage;switch(e){case Ps.DISABLE:a+=ri.ANNOTATIONS_DISABLE;break;case Ps.ENABLE:break;case Ps.ENABLE_FORMS:a+=ri.ANNOTATIONS_FORMS;break;case Ps.ENABLE_STORAGE:a+=ri.ANNOTATIONS_STORAGE,o=l.serializable;break;default:Z("getRenderingIntent - invalid annotationMode: ".concat(e))}s&&(a+=ri.IS_EDITING),n&&(a+=ri.OPLIST);const{ids:c,hash:d}=l.modifiedIds,u=[a,o.hash,d];return{renderingIntent:a,cacheKey:u.join("_"),annotationStorageSerializable:o,modifiedIds:c}}destroy(){var i;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(i=r(this,tn))==null||i.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const s of r(this,cs).values())t.push(s._destroy());r(this,cs).clear(),r(this,Hl).clear(),r(this,jl).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var s,n;this.commonObjs.clear(),this.fontLoader.clear(),r(this,Js).clear(),this.filterFactory.destroy(),fm.cleanup(),(s=this._networkStream)==null||s.cancelAllRequests(new qr("Worker was terminated.")),(n=this.messageHandler)==null||n.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(i,s)=>{Ht(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=n=>{this._lastProgress={loaded:n.loaded,total:n.total}},s.onPull=()=>{this._fullReader.read().then(function({value:n,done:a}){if(a){s.close();return}Ht(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{s.error(n)})},s.onCancel=n=>{this._fullReader.cancel(n),s.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("ReaderHeadersReady",async i=>{var o;await this._fullReader.headersReady;const{isStreamingSupported:s,isRangeSupported:n,contentLength:a}=this._fullReader;return(!s||!n)&&(this._lastProgress&&((o=e.onProgress)==null||o.call(e,this._lastProgress)),this._fullReader.onProgress=l=>{var c;(c=e.onProgress)==null||c.call(e,{loaded:l.loaded,total:l.total})}),{isStreamingSupported:s,isRangeSupported:n,contentLength:a}}),t.on("GetRangeReader",(i,s)=>{Ht(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(i.begin,i.end);if(!n){s.close();return}s.onPull=()=>{n.read().then(function({value:a,done:o}){if(o){s.close();return}Ht(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{s.error(a)})},s.onCancel=a=>{n.cancel(a),s.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("GetDoc",({pdfInfo:i})=>{this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new wS(i,this))}),t.on("DocException",i=>{e._capability.reject(ke(i))}),t.on("PasswordRequest",i=>{f(this,tn,Promise.withResolvers());try{if(!e.onPassword)throw ke(i);const s=n=>{n instanceof Error?r(this,tn).reject(n):r(this,tn).resolve({password:n})};e.onPassword(s,i.code)}catch(s){r(this,tn).reject(s)}return r(this,tn).promise}),t.on("DataLoaded",i=>{var s;(s=e.onProgress)==null||s.call(e,{loaded:i.length,total:i.length}),this.downloadInfoCapability.resolve(i)}),t.on("StartRenderPage",i=>{if(this.destroyed)return;r(this,cs).get(i.pageIndex)._startRenderPage(i.transparency,i.cacheKey)}),t.on("commonobj",([i,s,n])=>{var a;if(this.destroyed||this.commonObjs.has(i))return null;switch(s){case"Font":if("error"in n){const d=n.error;Z("Error during font loading: ".concat(d)),this.commonObjs.resolve(i,d);break}const o=this._params.pdfBug&&((a=globalThis.FontInspector)!=null&&a.enabled)?(d,u)=>globalThis.FontInspector.fontAdded(d,u):null,l=new PE(n,o);this.fontLoader.bind(l).catch(()=>t.sendWithPromise("FontFallback",{id:i})).finally(()=>{!l.fontExtraProperties&&l.data&&(l.data=null),this.commonObjs.resolve(i,l)});break;case"CopyLocalImage":const{imageRef:c}=n;Ht(c,"The imageRef must be defined.");for(const d of r(this,cs).values())for(const[,u]of d.objs)if((u==null?void 0:u.ref)===c)return u.dataLen?(this.commonObjs.resolve(i,structuredClone(u)),u.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(i,n);break;default:throw new Error("Got unknown common object type ".concat(s))}return null}),t.on("obj",([i,s,n,a])=>{var l;if(this.destroyed)return;const o=r(this,cs).get(s);if(!o.objs.has(i)){if(o._intentStates.size===0){(l=a==null?void 0:a.bitmap)==null||l.close();return}switch(n){case"Image":case"Pattern":o.objs.resolve(i,a);break;default:throw new Error("Got unknown object type ".concat(n))}}}),t.on("DocProgress",i=>{var s;this.destroyed||(s=e.onProgress)==null||s.call(e,{loaded:i.loaded,total:i.total})}),t.on("FetchBinaryData",async i=>{if(this.destroyed)throw new Error("Worker was destroyed.");const s=this[i.type];if(!s)throw new Error("".concat(i.type," not initialized, see the `useWorkerFetch` parameter."));return s.fetch(i)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var i,s;this.annotationStorage.size<=0&&Z("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=(i=this._fullReader)==null?void 0:i.filename)!=null?s: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,i=r(this,Hl).get(e);if(i)return i;const s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&r(this,jl).set(n.refStr,t);const a=new vS(e,n,this,this._params.pdfBug);return r(this,cs).set(e,a),a});return r(this,Hl).set(e,s),s}getPageIndex(t){return sm(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 p(this,Wa,cc).call(this,"GetFieldObjects")}hasJSActions(){return p(this,Wa,cc).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 p(this,Wa,cc).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 p(this,Wa,cc).call(this,"GetOptionalContentConfig").then(e=>new QE(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=r(this,Js).get(t);if(e)return e;const i=this.messageHandler.sendWithPromise(t,null).then(s=>{var n,a,o,l;return{info:s[0],metadata:s[1]?new KE(s[1]):null,contentDispositionFilename:(a=(n=this._fullReader)==null?void 0:n.filename)!=null?a:null,contentLength:(l=(o=this._fullReader)==null?void 0:o.contentLength)!=null?l:null}});return r(this,Js).set(t,i),i}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,cs).values())if(!e.cleanup())throw new Error("startCleanup: Page ".concat(e.pageNumber," is currently rendering."));this.commonObjs.clear(),t||this.fontLoader.clear(),r(this,Js).clear(),this.filterFactory.destroy(!0),fm.cleanup()}}cachedPageNumber(t){var i;if(!sm(t))return null;const e=t.gen===0?"".concat(t.num,"R"):"".concat(t.num,"R").concat(t.gen);return(i=r(this,jl).get(e))!=null?i:null}}Js=new WeakMap,cs=new WeakMap,Hl=new WeakMap,jl=new WeakMap,tn=new WeakMap,Wa=new WeakSet,cc=function(t,e=null){const i=r(this,Js).get(t);if(i)return i;const s=this.messageHandler.sendWithPromise(t,e);return r(this,Js).set(t,s),s};var lr;class _S{constructor(t){m(this,lr,null);k(this,"onContinue",null);k(this,"onError",null);f(this,lr,t)}get promise(){return r(this,lr).capability.promise}cancel(t=0){r(this,lr).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=r(this,lr).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=r(this,lr);return t.form||t.canvas&&(e==null?void 0:e.size)>0}}lr=new WeakMap;var hr,za;const ca=class ca{constructor({callback:t,params:e,objs:i,commonObjs:s,annotationCanvasMap:n,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:d=!1,pdfBug:u=!1,pageColors:g=null,enableHWA:b=!1}){m(this,hr,null);this.callback=t,this.params=e,this.objs=i,this.commonObjs=s,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=c,this._pdfBug=u,this.pageColors=g,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 _S(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.canvas,this._canvasContext=e.canvas?null:e.canvasContext,this._enableHWA=b}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){var o,l;if(this.cancelled)return;if(this._canvas){if(r(ca,za).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(ca,za).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{viewport:i,transform:s,background:n}=this.params,a=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new sl(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:i,transparency:t,background:n}),this.operatorListIdx=0,this.graphicsReady=!0,(l=this.graphicsReadyCallback)==null||l.call(this)}cancel(t=null,e=0){var i,s,n;this.running=!1,this.cancelled=!0,(i=this.gfx)==null||i.endDrawing(),r(this,hr)&&(window.cancelAnimationFrame(r(this,hr)),f(this,hr,null)),r(ca,za).delete(this._canvas),t||(t=new Uh("Rendering cancelled, page ".concat(this._pageIndex+1),e)),this.callback(t),(n=(s=this.task).onError)==null||n.call(s,t)}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?f(this,hr,window.requestAnimationFrame(()=>{f(this,hr,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(ca,za).delete(this._canvas),this.callback())))}};hr=new WeakMap,za=new WeakMap,m(ca,za,new WeakSet);let wm=ca;const AS="5.4.54",ES="295fb3ec4";var Xe,Ga,$l,Wt,Dd,Ul,en,Nd,cr,Di,ce,Fd,gt,vm,ym,_m,ea,g0,Dn;let f0=(ce=class{constructor({editor:t=null,uiManager:e=null}){m(this,gt);m(this,Xe,null);m(this,Ga,null);m(this,$l);m(this,Wt,null);m(this,Dd,!1);m(this,Ul,!1);m(this,en,null);m(this,Nd);m(this,cr,null);m(this,Di,null);var i,s;t?(f(this,Ul,!1),f(this,en,t)):f(this,Ul,!0),f(this,Di,(t==null?void 0:t._uiManager)||e),f(this,Nd,r(this,Di)._eventBus),f(this,$l,((i=t==null?void 0:t.color)==null?void 0:i.toUpperCase())||((s=r(this,Di))==null?void 0:s.highlightColors.values().next().value)||"#FFFF98"),r(ce,Fd)||f(ce,Fd,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 st(this,"_keyboardManager",new rf([[["Escape","mac+Escape"],ce.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],ce.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],ce.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],ce.prototype._moveToPrevious],[["Home","mac+Home"],ce.prototype._moveToBeginning],[["End","mac+End"],ce.prototype._moveToEnd]]))}renderButton(){const t=f(this,Xe,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",r(this,en)&&(t.ariaControls="".concat(r(this,en).id,"_colorpicker_dropdown"));const e=r(this,Di)._signal;t.addEventListener("click",p(this,gt,ea).bind(this),{signal:e}),t.addEventListener("keydown",p(this,gt,_m).bind(this),{signal:e});const i=f(this,Ga,document.createElement("span"));return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=r(this,$l),t.append(i),t}renderMainDropdown(){const t=f(this,Wt,p(this,gt,vm).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===r(this,Xe)){p(this,gt,ea).call(this,t);return}const e=t.target.getAttribute("data-color");e&&p(this,gt,ym).call(this,e,t)}_moveToNext(t){var e,i;if(!r(this,gt,Dn)){p(this,gt,ea).call(this,t);return}if(t.target===r(this,Xe)){(e=r(this,Wt).firstChild)==null||e.focus();return}(i=t.target.nextSibling)==null||i.focus()}_moveToPrevious(t){var e,i;if(t.target===((e=r(this,Wt))==null?void 0:e.firstChild)||t.target===r(this,Xe)){r(this,gt,Dn)&&this._hideDropdownFromKeyboard();return}r(this,gt,Dn)||p(this,gt,ea).call(this,t),(i=t.target.previousSibling)==null||i.focus()}_moveToBeginning(t){var e;if(!r(this,gt,Dn)){p(this,gt,ea).call(this,t);return}(e=r(this,Wt).firstChild)==null||e.focus()}_moveToEnd(t){var e;if(!r(this,gt,Dn)){p(this,gt,ea).call(this,t);return}(e=r(this,Wt).lastChild)==null||e.focus()}hideDropdown(){var t,e;(t=r(this,Wt))==null||t.classList.add("hidden"),r(this,Xe).ariaExpanded="false",(e=r(this,cr))==null||e.abort(),f(this,cr,null)}_hideDropdownFromKeyboard(){var t;if(!r(this,Ul)){if(!r(this,gt,Dn)){(t=r(this,en))==null||t.unselect();return}this.hideDropdown(),r(this,Xe).focus({preventScroll:!0,focusVisible:r(this,Dd)})}}updateColor(t){if(r(this,Ga)&&(r(this,Ga).style.backgroundColor=t),!r(this,Wt))return;const e=r(this,Di).highlightColors.values();for(const i of r(this,Wt).children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){var t,e;(t=r(this,Xe))==null||t.remove(),f(this,Xe,null),f(this,Ga,null),(e=r(this,Wt))==null||e.remove(),f(this,Wt,null)}},Xe=new WeakMap,Ga=new WeakMap,$l=new WeakMap,Wt=new WeakMap,Dd=new WeakMap,Ul=new WeakMap,en=new WeakMap,Nd=new WeakMap,cr=new WeakMap,Di=new WeakMap,Fd=new WeakMap,gt=new WeakSet,vm=function(){const t=document.createElement("div"),e=r(this,Di)._signal;t.addEventListener("contextmenu",Ci,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),r(this,en)&&(t.id="".concat(r(this,en).id,"_colorpicker_dropdown"));for(const[i,s]of r(this,Di).highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",s),n.title=i,n.setAttribute("data-l10n-id",r(ce,Fd)[i]);const a=document.createElement("span");n.append(a),a.className="swatch",a.style.backgroundColor=s,n.ariaSelected=s===r(this,$l),n.addEventListener("click",p(this,gt,ym).bind(this,s),{signal:e}),t.append(n)}return t.addEventListener("keydown",p(this,gt,_m).bind(this),{signal:e}),t},ym=function(t,e){e.stopPropagation(),r(this,Nd).dispatch("switchannotationeditorparams",{source:this,type:nt.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)},_m=function(t){ce._keyboardManager.exec(this,t)},ea=function(t){if(r(this,gt,Dn)){this.hideDropdown();return}if(f(this,Dd,t.detail===0),r(this,cr)||(f(this,cr,new AbortController),window.addEventListener("pointerdown",p(this,gt,g0).bind(this),{signal:r(this,Di).combinedSignal(r(this,cr))})),r(this,Xe).ariaExpanded="true",r(this,Wt)){r(this,Wt).classList.remove("hidden");return}const e=f(this,Wt,p(this,gt,vm).call(this));r(this,Xe).append(e)},g0=function(t){var e;(e=r(this,Wt))!=null&&e.contains(t.target)||this.hideDropdown()},Dn=function(){return r(this,Wt)&&!r(this,Wt).classList.contains("hidden")},m(ce,Fd,null),ce);var ds,Od,Wl,Bd;const da=class da{constructor(t){m(this,ds,null);m(this,Od,null);m(this,Wl,null);f(this,Od,t),f(this,Wl,t._uiManager),r(da,Bd)||f(da,Bd,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(r(this,ds))return r(this,ds);const{editorType:t,colorType:e,colorValue:i}=r(this,Od),s=f(this,ds,document.createElement("input"));return s.type="color",s.value=i||"#000000",s.className="basicColorPicker",s.tabIndex=0,s.setAttribute("data-l10n-id",r(da,Bd)[t]),s.addEventListener("input",()=>{r(this,Wl).updateParams(e,s.value)},{signal:r(this,Wl)._signal}),s}update(t){r(this,ds)&&(r(this,ds).value=t)}destroy(){var t;(t=r(this,ds))==null||t.remove(),f(this,ds,null)}hideDropdown(){}};ds=new WeakMap,Od=new WeakMap,Wl=new WeakMap,Bd=new WeakMap,m(da,Bd,null);let _g=da;function Hw(h){return Math.floor(Math.max(0,Math.min(1,h))*255).toString(16).padStart(2,"0")}function Xh(h){return Math.max(0,Math.min(255,255*h))}class jw{static CMYK_G([t,e,i,s]){return["G",1-Math.min(1,.3*t+.59*i+.11*e+s)]}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=Xh(t),[t,t,t]}static G_HTML([t]){const e=Hw(t);return"#".concat(e).concat(e).concat(e)}static RGB_G([t,e,i]){return["G",.3*t+.59*e+.11*i]}static RGB_rgb(t){return t.map(Xh)}static RGB_HTML(t){return"#".concat(t.map(Hw).join(""))}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,i,s]){return["RGB",1-Math.min(1,t+s),1-Math.min(1,i+s),1-Math.min(1,e+s)]}static CMYK_rgb([t,e,i,s]){return[Xh(1-Math.min(1,t+s)),Xh(1-Math.min(1,i+s)),Xh(1-Math.min(1,e+s))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,i]){const s=1-t,n=1-e,a=1-i,o=Math.min(s,n,a);return["CMYK",s,n,a,o]}}class SS{create(t,e,i=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),i||(s.setAttribute("width","".concat(t,"px")),s.setAttribute("height","".concat(e,"px"))),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox","0 0 ".concat(t," ").concat(e)),s}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){pt("Abstract method `_createSVG` called.")}}let Ag=class extends SS{_createSVG(t){return document.createElementNS(Is,t)}},p0=class{static setupStorage(t,e,i,s,n){const a=s.getValue(e,{value:null});switch(i.name){case"textarea":if(a.value!==null&&(t.textContent=a.value),n==="print")break;t.addEventListener("input",o=>{s.setValue(e,{value:o.target.value})});break;case"input":if(i.attributes.type==="radio"||i.attributes.type==="checkbox"){if(a.value===i.attributes.xfaOn?t.setAttribute("checked",!0):a.value===i.attributes.xfaOff&&t.removeAttribute("checked"),n==="print")break;t.addEventListener("change",o=>{s.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=>{s.setValue(e,{value:o.target.value})})}break;case"select":if(a.value!==null){t.setAttribute("value",a.value);for(const o of i.children)o.attributes.value===a.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{const l=o.target.options,c=l.selectedIndex===-1?"":l[l.selectedIndex].value;s.setValue(e,{value:c})});break}}static setAttributes({html:t,element:e,storage:i=null,intent:s,linkService:n}){const{attributes:a}=e,o=t instanceof HTMLAnchorElement;a.type==="radio"&&(a.name="".concat(a.name,"-").concat(s));for(const[l,c]of Object.entries(a))if(c!=null)switch(l){case"class":c.length&&t.setAttribute(l,c.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",c);break;case"style":Object.assign(t.style,c);break;case"textContent":t.textContent=c;break;default:(!o||l!=="href"&&l!=="newWindow")&&t.setAttribute(l,c)}o&&n.addLinkAttributes(t,a.href,a.newWindow),i&&a.dataId&&this.setupStorage(t,a.dataId,e,i)}static render(t){var u,g;const e=t.annotationStorage,i=t.linkService,s=t.xfaHtml,n=t.intent||"display",a=document.createElement(s.name);s.attributes&&this.setAttributes({html:a,element:s,intent:n,linkService:i});const o=n!=="richText",l=t.div;if(l.append(a),t.viewport){const b="matrix(".concat(t.viewport.transform.join(","),")");l.style.transform=b}o&&l.setAttribute("class","xfaLayer xfaFont");const c=[];if(s.children.length===0){if(s.value){const b=document.createTextNode(s.value);a.append(b),o&&Fc.shouldBuildText(s.name)&&c.push(b)}return{textDivs:c}}const d=[[s,-1,a]];for(;d.length>0;){const[b,w,v]=d.at(-1);if(w+1===b.children.length){d.pop();continue}const A=b.children[++d.at(-1)[1]];if(A===null)continue;const{name:y}=A;if(y==="#text"){const _=document.createTextNode(A.value);c.push(_),v.append(_);continue}const S=(u=A==null?void 0:A.attributes)!=null&&u.xmlns?document.createElementNS(A.attributes.xmlns,y):document.createElement(y);if(v.append(S),A.attributes&&this.setAttributes({html:S,element:A,storage:e,intent:n,linkService:i}),((g=A.children)==null?void 0:g.length)>0)d.push([A,-1,S]);else if(A.value){const _=document.createTextNode(A.value);o&&Fc.shouldBuildText(y)&&c.push(_),S.append(_)}}for(const b of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))b.setAttribute("readOnly",!0);return{textDivs:c}}static update(t){const e="matrix(".concat(t.viewport.transform.join(","),")");t.div.style.transform=e,t.div.hidden=!1}};const PS=9,Do=new WeakSet,xS=new Date().getTimezoneOffset()*60*1e3;class $w{static create(t){switch(t.data.annotationType){case Bt.LINK:return new tw(t);case Bt.TEXT:return new CS(t);case Bt.WIDGET:switch(t.data.fieldType){case"Tx":return new TS(t);case"Btn":return t.data.radioButton?new w0(t):t.data.checkBox?new LS(t):new RS(t);case"Ch":return new MS(t);case"Sig":return new IS(t)}return new Oo(t);case Bt.POPUP:return new Em(t);case Bt.FREETEXT:return new E0(t);case Bt.LINE:return new DS(t);case Bt.SQUARE:return new NS(t);case Bt.CIRCLE:return new FS(t);case Bt.POLYLINE:return new S0(t);case Bt.CARET:return new BS(t);case Bt.INK:return new ew(t);case Bt.POLYGON:return new OS(t);case Bt.HIGHLIGHT:return new P0(t);case Bt.UNDERLINE:return new VS(t);case Bt.SQUIGGLY:return new HS(t);case Bt.STRIKEOUT:return new jS(t);case Bt.STAMP:return new x0(t);case Bt.FILEATTACHMENT:return new $S(t);default:return new Ft(t)}}}var Xa,zl,sn,Vd,Am;const fw=class fw{constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:s=!1}={}){m(this,Vd);m(this,Xa,null);m(this,zl,!1);m(this,sn,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(i)),s&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t!=null&&t.str||e!=null&&e.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return fw._hasPopupData(this.data)}updateEdited(t){var n;if(!this.container)return;t.rect&&(r(this,Xa)||f(this,Xa,{rect:this.data.rect.slice(0)}));const{rect:e,popup:i}=t;e&&p(this,Vd,Am).call(this,e);let s=((n=r(this,sn))==null?void 0:n.popup)||this.popup;!s&&(i!=null&&i.text)&&(this._createPopup(i),s=r(this,sn).popup),s&&(s.updateEdited(t),i!=null&&i.deleted&&(s.remove(),f(this,sn,null),this.popup=null))}resetEdited(){var t;r(this,Xa)&&(p(this,Vd,Am).call(this,r(this,Xa).rect),(t=r(this,sn))==null||t.popup.resetEdited(),f(this,Xa,null))}_createContainer(t){const{data:e,parent:{page:i,viewport:s}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),!(this instanceof Oo)&&!(this instanceof tw)&&(n.tabIndex=0);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 Em){const{rotation:v}=e;return!e.hasOwnCanvas&&v!==0&&this.setRotation(v,n),n}const{width:o,height:l}=this;if(!t&&e.borderStyle.width>0){a.borderWidth="".concat(e.borderStyle.width,"px");const v=e.borderStyle.horizontalCornerRadius,A=e.borderStyle.verticalCornerRadius;if(v>0||A>0){const S="calc(".concat(v,"px * var(--total-scale-factor)) / calc(").concat(A,"px * var(--total-scale-factor))");a.borderRadius=S}else if(this instanceof w0){const S="calc(".concat(o,"px * var(--total-scale-factor)) / calc(").concat(l,"px * var(--total-scale-factor))");a.borderRadius=S}switch(e.borderStyle.style){case Vo.SOLID:a.borderStyle="solid";break;case Vo.DASHED:a.borderStyle="dashed";break;case Vo.BEVELED:Z("Unimplemented border style: beveled");break;case Vo.INSET:Z("Unimplemented border style: inset");break;case Vo.UNDERLINE:a.borderBottomStyle="solid";break}const y=e.borderColor||null;y?(f(this,zl,!0),a.borderColor=q.makeHexColor(y[0]|0,y[1]|0,y[2]|0)):a.borderWidth=0}const c=q.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:d,pageHeight:u,pageX:g,pageY:b}=s.rawDims;a.left="".concat(100*(c[0]-g)/d,"%"),a.top="".concat(100*(c[1]-b)/u,"%");const{rotation:w}=e;return e.hasOwnCanvas||w===0?(a.width="".concat(100*o/d,"%"),a.height="".concat(100*l/u,"%")):this.setRotation(w,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:i,pageHeight:s}=this.parent.viewport.rawDims;let{width:n,height:a}=this;t%180!==0&&([n,a]=[a,n]),e.style.width="".concat(100*n/i,"%"),e.style.height="".concat(100*a/s,"%"),e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,i,s)=>{const n=s.detail[e],a=n[0],o=n.slice(1);s.target.style[i]=jw["".concat(a,"_HTML")](o),this.annotationStorage.setValue(this.data.id,{[i]:jw["".concat(a,"_rgb")](o)})};return st(this,"_commonActions",{display:e=>{const{display:i}=e.detail,s=i%2===1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:i===1||i===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:i}=e.detail;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:i,noView:i})},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 i=e.detail.rotation;this.setRotation(i),this.annotationStorage.setValue(this.data.id,{rotation:i})}})}_dispatchEventFromSandbox(t,e){const i=this._commonActions;for(const s of Object.keys(e.detail)){const n=t[s]||i[s];n==null||n(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[s,n]of Object.entries(e)){const a=i[s];if(a){const o={detail:{[s]:n},target:t};a(o),delete e[s]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,i,s,n]=this.data.rect.map(v=>Math.fround(v));if(t.length===8){const[v,A,y,S]=t.subarray(2,6);if(s===v&&n===A&&e===y&&i===S)return}const{style:a}=this.container;let o;if(r(this,zl)){const{borderColor:v,borderWidth:A}=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="'.concat(v,'" stroke-width="').concat(A,'">')],this.container.classList.add("hasBorder")}const l=s-e,c=n-i,{svgFactory:d}=this,u=d.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0),u.role="none";const g=d.createElement("defs");u.append(g);const b=d.createElement("clipPath"),w="clippath_".concat(this.data.id);b.setAttribute("id",w),b.setAttribute("clipPathUnits","objectBoundingBox"),g.append(b);for(let v=2,A=t.length;v<A;v+=8){const y=t[v],S=t[v+1],_=t[v+2],E=t[v+3],P=d.createElement("rect"),x=(_-e)/l,T=(n-S)/c,I=(y-_)/l,C=(S-E)/c;P.setAttribute("x",x),P.setAttribute("y",T),P.setAttribute("width",I),P.setAttribute("height",C),b.append(P),o==null||o.push('<rect vector-effect="non-scaling-stroke" x="'.concat(x,'" y="').concat(T,'" width="').concat(I,'" height="').concat(C,'"/>'))}r(this,zl)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(u),this.container.style.clipPath="url(#".concat(w,")")}_createPopup(t=null){const{data:e}=this;let i,s;t?(i={str:t.text},s=t.date):(i=e.contentsObj,s=e.modificationDate);const n=f(this,sn,new Em({data:{color:e.color,titleObj:e.titleObj,modificationDate:s,contentsObj:i,richText:e.richText,parentRect:e.rect,borderStyle:0,id:"popup_".concat(e.id),rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}));this.parent.div.append(n.render())}get hasPopupElement(){return!!(r(this,sn)||this.popup||this.data.popupRef)}render(){pt("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const i=[];if(this._fieldObjects){const s=this._fieldObjects[t];if(s)for(const{page:n,id:a,exportValues:o}of s){if(n===-1||a===e)continue;const l=typeof o=="string"?o:null,c=document.querySelector('[data-element-id="'.concat(a,'"]'));if(c&&!Do.has(c)){Z("_getElementsByName - element not allowed: ".concat(a));continue}i.push({id:a,exportValue:l,domElement:c})}return i}for(const s of document.getElementsByName(t)){const{exportValue:n}=s,a=s.getAttribute("data-element-id");a!==e&&Do.has(s)&&i.push({id:a,exportValue:n,domElement:s})}return i}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 i;(i=this.linkService.eventBus)==null||i.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};Xa=new WeakMap,zl=new WeakMap,sn=new WeakMap,Vd=new WeakSet,Am=function(t){const{container:{style:e},data:{rect:i,rotation:s},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:l}}}}=this;i==null||i.splice(0,4,...t),e.left="".concat(100*(t[0]-o)/n,"%"),e.top="".concat(100*(a-t[3]+l)/a,"%"),s===0?(e.width="".concat(100*(t[2]-t[0])/n,"%"),e.height="".concat(100*(t[3]-t[1])/a,"%")):this.setRotation(s)};let Ft=fw;var hi,ia,m0,b0;class tw extends Ft{constructor(e,i=null){super(e,{isRenderable:!0,ignoreBorder:!!(i!=null&&i.ignoreBorder),createQuadrilaterals:!0});m(this,hi);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:i}=this,s=document.createElement("a");s.setAttribute("data-element-id",e.id);let n=!1;return e.url?(i.addLinkAttributes(s,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(s,e.action,e.overlaidText),n=!0):e.attachment?(p(this,hi,m0).call(this,s,e.attachment,e.overlaidText,e.attachmentDest),n=!0):e.setOCGState?(p(this,hi,b0).call(this,s,e.setOCGState,e.overlaidText),n=!0):e.dest?(this._bindLink(s,e.dest,e.overlaidText),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,e),n=!0),e.resetForm?(this._bindResetFormAction(s,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(s,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(s),this.container}_bindLink(e,i,s=""){e.href=this.linkService.getDestinationHash(i),e.onclick=()=>(i&&this.linkService.goToDestination(i),!1),(i||i==="")&&p(this,hi,ia).call(this),s&&(e.title=s)}_bindNamedAction(e,i,s=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(i),!1),s&&(e.title=s),p(this,hi,ia).call(this)}_bindJSAction(e,i){e.href=this.linkService.getAnchorUrl("");const s=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(i.actions)){const a=s.get(n);a&&(e[a]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i.id,name:n}}),!1})}i.overlaidText&&(e.title=i.overlaidText),e.onclick||(e.onclick=()=>!1),p(this,hi,ia).call(this)}_bindResetFormAction(e,i){const s=e.onclick;if(s||(e.href=this.linkService.getAnchorUrl("")),p(this,hi,ia).call(this),!this._fieldObjects){Z('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),s||(e.onclick=()=>!1);return}e.onclick=()=>{var u;s==null||s();const{fields:n,refs:a,include:o}=i,l=[];if(n.length!==0||a.length!==0){const g=new Set(a);for(const b of n){const w=this._fieldObjects[b]||[];for(const{id:v}of w)g.add(v)}for(const b of Object.values(this._fieldObjects))for(const w of b)g.has(w.id)===o&&l.push(w)}else for(const g of Object.values(this._fieldObjects))l.push(...g);const c=this.annotationStorage,d=[];for(const g of l){const{id:b}=g;switch(d.push(b),g.type){case"text":{const v=g.defaultValue||"";c.setValue(b,{value:v});break}case"checkbox":case"radiobutton":{const v=g.defaultValue===g.exportValues;c.setValue(b,{value:v});break}case"combobox":case"listbox":{const v=g.defaultValue||"";c.setValue(b,{value:v});break}default:continue}const w=document.querySelector('[data-element-id="'.concat(b,'"]'));if(w){if(!Do.has(w)){Z("_bindResetFormAction - element not allowed: ".concat(b));continue}}else continue;w.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((u=this.linkService.eventBus)==null||u.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}hi=new WeakSet,ia=function(){this.container.setAttribute("data-internal-link","")},m0=function(e,i,s="",n=null){e.href=this.linkService.getAnchorUrl(""),i.description?e.title=i.description:s&&(e.title=s),e.onclick=()=>{var a;return(a=this.downloadManager)==null||a.openOrDownloadData(i.content,i.filename,n),!1},p(this,hi,ia).call(this)},b0=function(e,i,s=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(i),!1),s&&(e.title=s),p(this,hi,ia).call(this)};class CS extends Ft{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 Oo extends Ft{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 pe.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,s,n){i.includes("mouse")?t.addEventListener(i,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:n(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):t.addEventListener(i,a=>{var o;if(i==="blur"){if(!e.focused||!a.relatedTarget)return;e.focused=!1}else if(i==="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:s,value:n(a)}}))})}_setEventListeners(t,e,i,s){var n,a,o;for(const[l,c]of i)(c==="Action"||(n=this.data.actions)!=null&&n[c])&&((c==="Focus"||c==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,l,c,s),c==="Focus"&&!((a=this.data.actions)!=null&&a.Blur)?this._setEventListener(t,e,"blur","Blur",null):c==="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":q.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||PS,n=t.style;let a;const o=2,l=c=>Math.round(10*c)/10;if(this.data.multiLine){const c=Math.abs(this.data.rect[3]-this.data.rect[1]-o),d=Math.round(c/(up*s))||1,u=c/d;a=Math.min(s,l(u/up))}else{const c=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(s,l(c/up))}n.fontSize="calc(".concat(a,"px * var(--total-scale-factor))"),n.color=q.makeHexColor(i[0],i[1],i[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 TS extends Oo{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,i,s){const n=this.annotationStorage;for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=i),n.setValue(a.id,{[s]:i})}render(){var s,n;const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const a=t.getValue(e,{value:this.data.fieldValue});let o=a.value||"";const l=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let c=a.formattedValue||((s=this.data.textContent)==null?void 0:s.join("\n"))||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const d={userValue:o,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=c!=null?c:o,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type=this.data.password?"password":"text",i.setAttribute("value",c!=null?c:o),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),Do.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=0;const{datetimeFormat:u,datetimeType:g,timeStep:b}=this.data,w=!!g&&this.enableScripting;u&&(i.title=u),this._setRequired(i,this.data.required),l&&(i.maxLength=l),i.addEventListener("input",A=>{t.setValue(e,{value:A.target.value}),this.setPropertyOnSiblings(i,"value",A.target.value,"value"),d.formattedValue=null}),i.addEventListener("resetform",A=>{var S;const y=(S=this.data.defaultFieldValue)!=null?S:"";i.value=d.userValue=y,d.formattedValue=null});let v=A=>{const{formattedValue:y}=d;y!=null&&(A.target.value=y),A.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",y=>{var _;if(d.focused)return;const{target:S}=y;if(w&&(S.type=g,b&&(S.step=b)),d.userValue){const E=d.userValue;if(w)if(g==="time"){const P=new Date(E),x=[P.getHours(),P.getMinutes(),P.getSeconds()];S.value=x.map(T=>T.toString().padStart(2,"0")).join(":")}else S.value=new Date(E-xS).toISOString().split(g==="date"?"T":".",1)[0];else S.value=E}d.lastCommittedValue=S.value,d.commitKey=1,(_=this.data.actions)!=null&&_.Focus||(d.focused=!0)}),i.addEventListener("updatefromsandbox",y=>{this.showElementAndHideCanvas(y.target);const S={value(_){var E;d.userValue=(E=_.detail.value)!=null?E:"",w||t.setValue(e,{value:d.userValue.toString()}),_.target.value=d.userValue},formattedValue(_){const{formattedValue:E}=_.detail;d.formattedValue=E,E!=null&&_.target!==document.activeElement&&(_.target.value=E);const P={formattedValue:E};w&&(P.value=E),t.setValue(e,P)},selRange(_){_.target.setSelectionRange(..._.detail.selRange)},charLimit:_=>{var T;const{charLimit:E}=_.detail,{target:P}=_;if(E===0){P.removeAttribute("maxLength");return}P.setAttribute("maxLength",E);let x=d.userValue;!x||x.length<=E||(x=x.slice(0,E),P.value=d.userValue=x,t.setValue(e,{value:x}),(T=this.linkService.eventBus)==null||T.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:x,willCommit:!0,commitKey:1,selStart:P.selectionStart,selEnd:P.selectionEnd}}))}};this._dispatchEventFromSandbox(S,y)}),i.addEventListener("keydown",y=>{var E;d.commitKey=1;let S=-1;if(y.key==="Escape"?S=0:y.key==="Enter"&&!this.data.multiLine?S=2:y.key==="Tab"&&(d.commitKey=3),S===-1)return;const{value:_}=y.target;d.lastCommittedValue!==_&&(d.lastCommittedValue=_,d.userValue=_,(E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,willCommit:!0,commitKey:S,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});const A=v;v=null,i.addEventListener("blur",y=>{var E,P;if(!d.focused||!y.relatedTarget)return;(E=this.data.actions)!=null&&E.Blur||(d.focused=!1);const{target:S}=y;let{value:_}=S;if(w){if(_&&g==="time"){const x=_.split(":").map(T=>parseInt(T,10));_=new Date(2e3,0,1,x[0],x[1],x[2]||0).valueOf(),S.step=""}else _=new Date(_).valueOf();S.type="text"}d.userValue=_,d.lastCommittedValue!==_&&((P=this.linkService.eventBus)==null||P.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,willCommit:!0,commitKey:d.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}})),A(y)}),(n=this.data.actions)!=null&&n.Keystroke&&i.addEventListener("beforeinput",y=>{var C;d.lastCommittedValue=null;const{data:S,target:_}=y,{value:E,selectionStart:P,selectionEnd:x}=_;let T=P,I=x;switch(y.inputType){case"deleteWordBackward":{const L=E.substring(0,P).match(/\w*[^\w]*$/);L&&(T-=L[0].length);break}case"deleteWordForward":{const L=E.substring(P).match(/^[^\w]*\w*/);L&&(I+=L[0].length);break}case"deleteContentBackward":P===x&&(T-=1);break;case"deleteContentForward":P===x&&(I+=1);break}y.preventDefault(),(C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:E,change:S||"",willCommit:!1,selStart:T,selEnd:I}})}),this._setEventListeners(i,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],y=>y.target.value)}if(v&&i.addEventListener("blur",v),this.data.comb){const y=(this.data.rect[2]-this.data.rect[0])/l;i.classList.add("comb"),i.style.letterSpacing="calc(".concat(y,"px * var(--total-scale-factor) - 1ch)")}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class IS extends Oo{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class LS extends Oo{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;typeof s=="string"&&(s=s!=="Off",t.setValue(i,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return Do.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=0,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const c of this._getElementsByName(o,i)){const d=l&&c.exportValue===e.exportValue;c.domElement&&(c.domElement.checked=d),t.setValue(c.id,{value:d})}t.setValue(i,{value:l})}),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(l){l.target.checked=l.detail.value!=="Off",t.setValue(i,{value:l.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 w0 extends Oo{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if(typeof s=="string"&&(s=s!==e.buttonValue,t.setValue(i,{value:s})),s)for(const a of this._getElementsByName(e.fieldName,i))t.setValue(a.id,{value:!1});const n=document.createElement("input");if(Do.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.tabIndex=0,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const c of this._getElementsByName(o,i))t.setValue(c.id,{value:!1});t.setValue(i,{value:l})}),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 l={value:c=>{const d=a===c.detail.value;for(const u of this._getElementsByName(c.target.name)){const g=d&&u.id===i;u.domElement&&(u.domElement.checked=g),t.setValue(u.id,{value:g})}}};this._dispatchEventFromSandbox(l,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 RS extends tw{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",i=>{this._dispatchEventFromSandbox({},i)})),t}}class MS extends Oo{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),s=document.createElement("select");Do.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=0;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",d=>{const u=this.data.defaultFieldValue;for(const g of s.options)g.selected=g.value===u});for(const d of this.data.options){const u=document.createElement("option");u.textContent=d.displayValue,u.value=d.exportValue,i.value.includes(d.exportValue)&&(u.setAttribute("selected",!0),n=!1),s.append(u)}let a=null;if(n){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),s.prepend(d),a=()=>{d.remove(),s.removeEventListener("input",a),a=null},s.addEventListener("input",a)}const o=d=>{const u=d?"value":"textContent",{options:g,multiple:b}=s;return b?Array.prototype.filter.call(g,w=>w.selected).map(w=>w[u]):g.selectedIndex===-1?null:g[g.selectedIndex][u]};let l=o(!1);const c=d=>{const u=d.target.options;return Array.prototype.map.call(u,g=>({displayValue:g.textContent,exportValue:g.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",d=>{const u={value(g){a==null||a();const b=g.detail.value,w=new Set(Array.isArray(b)?b:[b]);for(const v of s.options)v.selected=w.has(v.value);t.setValue(e,{value:o(!0)}),l=o(!1)},multipleSelection(g){s.multiple=!0},remove(g){const b=s.options,w=g.detail.remove;b[w].selected=!1,s.remove(w),b.length>0&&Array.prototype.findIndex.call(b,A=>A.selected)===-1&&(b[0].selected=!0),t.setValue(e,{value:o(!0),items:c(g)}),l=o(!1)},clear(g){for(;s.length!==0;)s.remove(0);t.setValue(e,{value:null,items:[]}),l=o(!1)},insert(g){const{index:b,displayValue:w,exportValue:v}=g.detail.insert,A=s.children[b],y=document.createElement("option");y.textContent=w,y.value=v,A?A.before(y):s.append(y),t.setValue(e,{value:o(!0),items:c(g)}),l=o(!1)},items(g){const{items:b}=g.detail;for(;s.length!==0;)s.remove(0);for(const w of b){const{displayValue:v,exportValue:A}=w,y=document.createElement("option");y.textContent=v,y.value=A,s.append(y)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:o(!0),items:c(g)}),l=o(!1)},indices(g){const b=new Set(g.detail.indices);for(const w of g.target.options)w.selected=b.has(w.index);t.setValue(e,{value:o(!0)}),l=o(!1)},editable(g){g.target.disabled=!g.detail.editable}};this._dispatchEventFromSandbox(u,d)}),s.addEventListener("input",d=>{var b;const u=o(!0),g=o(!1);t.setValue(e,{value:u}),d.preventDefault(),(b=this.linkService.eventBus)==null||b.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:l,change:g,changeEx:u,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,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)):s.addEventListener("input",function(d){t.setValue(e,{value:o(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Em extends Ft{constructor(t){const{data:e,elements:i}=t;super(t,{isRenderable:Ft._hasPopupData(e)}),this.elements=i,this.popup=null}render(){const{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";const e=this.popup=new kS({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,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}),i=[];for(const s of this.elements)s.popup=e,s.container.ariaHasPopup="dialog",i.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(s=>"".concat(Yb).concat(s)).join(",")),this.container}}var Gl,$g,Ug,Xl,ql,Lt,nn,dr,Yl,Hd,Kl,us,qe,ur,rn,jd,an,Zl,qa,fr,lt,Ff,Of,Sm,v0,y0,_0,A0,Bf,Vf,Pm;class kS{constructor({container:t,color:e,elements:i,titleObj:s,modificationDate:n,contentsObj:a,richText:o,parent:l,rect:c,parentRect:d,open:u}){m(this,lt);m(this,Gl,p(this,lt,_0).bind(this));m(this,$g,p(this,lt,Pm).bind(this));m(this,Ug,p(this,lt,Vf).bind(this));m(this,Xl,p(this,lt,Bf).bind(this));m(this,ql,null);m(this,Lt,null);m(this,nn,null);m(this,dr,null);m(this,Yl,null);m(this,Hd,null);m(this,Kl,null);m(this,us,!1);m(this,qe,null);m(this,ur,null);m(this,rn,null);m(this,jd,null);m(this,an,null);m(this,Zl,null);m(this,qa,null);m(this,fr,!1);f(this,Lt,t),f(this,Zl,s),f(this,nn,a),f(this,an,o),f(this,Hd,l),f(this,ql,e),f(this,jd,c),f(this,Kl,d),f(this,Yl,i),f(this,dr,Dc.toDateObject(n)),this.trigger=i.flatMap(g=>g.getElementsToTriggerPopup()),p(this,lt,Ff).call(this),r(this,Lt).hidden=!0,u&&p(this,lt,Bf).call(this)}render(){var s;if(r(this,qe))return;const t=f(this,qe,document.createElement("div"));if(t.className="popup",r(this,ql)){const n=t.style.outlineColor=q.makeHexColor(...r(this,ql));t.style.backgroundColor="color-mix(in srgb, ".concat(n," 30%, white)")}const e=document.createElement("span");if(e.className="header",(s=r(this,Zl))!=null&&s.str){const n=document.createElement("span");n.className="title",e.append(n),{dir:n.dir,str:n.textContent}=r(this,Zl)}if(t.append(e),r(this,dr)){const n=document.createElement("time");n.className="popupDate",n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:r(this,dr).valueOf()})),n.dateTime=r(this,dr).toISOString(),e.append(n)}const i=r(this,lt,Of);if(i)p0.render({xfaHtml:i,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const n=this._formatContents(r(this,nn));t.append(n)}r(this,Lt).append(t)}_formatContents({str:t,dir:e}){const i=document.createElement("p");i.classList.add("popupContent"),i.dir=e;const s=t.split(/(?:\r\n?|\n)/);for(let n=0,a=s.length;n<a;++n){const o=s[n];i.append(document.createTextNode(o)),n<a-1&&i.append(document.createElement("br"))}return i}updateEdited({rect:t,popup:e,deleted:i}){var s;if(i||e!=null&&e.deleted){this.remove();return}p(this,lt,Ff).call(this),r(this,qa)||f(this,qa,{contentsObj:r(this,nn),richText:r(this,an)}),t&&f(this,rn,null),e&&(f(this,an,p(this,lt,y0).call(this,e.text)),f(this,dr,Dc.toDateObject(e.date)),f(this,nn,null)),(s=r(this,qe))==null||s.remove(),f(this,qe,null)}resetEdited(){var t;r(this,qa)&&({contentsObj:se(this,nn)._,richText:se(this,an)._}=r(this,qa),f(this,qa,null),(t=r(this,qe))==null||t.remove(),f(this,qe,null),f(this,rn,null))}remove(){var t,e;(t=r(this,ur))==null||t.abort(),f(this,ur,null),(e=r(this,qe))==null||e.remove(),f(this,qe,null),f(this,fr,!1),f(this,us,!1);for(const i of this.trigger)i.classList.remove("popupTriggerArea")}forceHide(){f(this,fr,this.isVisible),r(this,fr)&&(r(this,Lt).hidden=!0)}maybeShow(){p(this,lt,Ff).call(this),r(this,fr)&&(r(this,qe)||p(this,lt,Vf).call(this),f(this,fr,!1),r(this,Lt).hidden=!1)}get isVisible(){return r(this,Lt).hidden===!1}}Gl=new WeakMap,$g=new WeakMap,Ug=new WeakMap,Xl=new WeakMap,ql=new WeakMap,Lt=new WeakMap,nn=new WeakMap,dr=new WeakMap,Yl=new WeakMap,Hd=new WeakMap,Kl=new WeakMap,us=new WeakMap,qe=new WeakMap,ur=new WeakMap,rn=new WeakMap,jd=new WeakMap,an=new WeakMap,Zl=new WeakMap,qa=new WeakMap,fr=new WeakMap,lt=new WeakSet,Ff=function(){var e;if(r(this,ur))return;f(this,ur,new AbortController);const{signal:t}=r(this,ur);for(const i of this.trigger)i.addEventListener("click",r(this,Xl),{signal:t}),i.addEventListener("mouseenter",r(this,Ug),{signal:t}),i.addEventListener("mouseleave",r(this,$g),{signal:t}),i.classList.add("popupTriggerArea");for(const i of r(this,Yl))(e=i.container)==null||e.addEventListener("keydown",r(this,Gl),{signal:t})},Of=function(){const t=r(this,an),e=r(this,nn);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&r(this,an).html||null},Sm=function(){var t,e,i;return((i=(e=(t=r(this,lt,Of))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:i.fontSize)||0},v0=function(){var t,e,i;return((i=(e=(t=r(this,lt,Of))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:i.color)||null},y0=function(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},s={style:{color:r(this,lt,v0),fontSize:r(this,lt,Sm)?"calc(".concat(r(this,lt,Sm),"px * var(--total-scale-factor))"):""}};for(const n of t.split("\n"))e.push({name:"span",value:n,attributes:s});return i},_0=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&r(this,us))&&p(this,lt,Bf).call(this)},A0=function(){if(r(this,rn)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:s,pageY:n}}}=r(this,Hd);let a=!!r(this,Kl),o=a?r(this,Kl):r(this,jd);for(const w of r(this,Yl))if(!o||q.intersect(w.data.rect,o)!==null){o=w.data.rect,a=!0;break}const l=q.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,u=l[0]+d,g=l[1];f(this,rn,[100*(u-s)/e,100*(g-n)/i]);const{style:b}=r(this,Lt);b.left="".concat(r(this,rn)[0],"%"),b.top="".concat(r(this,rn)[1],"%")},Bf=function(){f(this,us,!r(this,us)),r(this,us)?(p(this,lt,Vf).call(this),r(this,Lt).addEventListener("click",r(this,Xl)),r(this,Lt).addEventListener("keydown",r(this,Gl))):(p(this,lt,Pm).call(this),r(this,Lt).removeEventListener("click",r(this,Xl)),r(this,Lt).removeEventListener("keydown",r(this,Gl)))},Vf=function(){r(this,qe)||this.render(),this.isVisible?r(this,us)&&r(this,Lt).classList.add("focused"):(p(this,lt,A0).call(this),r(this,Lt).hidden=!1,r(this,Lt).style.zIndex=parseInt(r(this,Lt).style.zIndex)+1e3)},Pm=function(){r(this,Lt).classList.remove("focused"),!(r(this,us)||!this.isVisible)&&(r(this,Lt).hidden=!0,r(this,Lt).style.zIndex=parseInt(r(this,Lt).style.zIndex)-1e3)};class E0 extends Ft{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=Y.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 i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var $d;class DS extends Ft{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,$d,null)}render(){this.container.classList.add("lineAnnotation");const{data:e,width:i,height:s}=this,n=this.svgFactory.create(i,s,!0),a=f(this,$d,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,$d)}addHighlightArea(){this.container.classList.add("highlightArea")}}$d=new WeakMap;var Ud;class NS extends Ft{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Ud,null)}render(){this.container.classList.add("squareAnnotation");const{data:e,width:i,height:s}=this,n=this.svgFactory.create(i,s,!0),a=e.borderStyle.width,o=f(this,Ud,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",i-a),o.setAttribute("height",s-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,Ud)}addHighlightArea(){this.container.classList.add("highlightArea")}}Ud=new WeakMap;var Wd;class FS extends Ft{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Wd,null)}render(){this.container.classList.add("circleAnnotation");const{data:e,width:i,height:s}=this,n=this.svgFactory.create(i,s,!0),a=e.borderStyle.width,o=f(this,Wd,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",i/2),o.setAttribute("cy",s/2),o.setAttribute("rx",i/2-a/2),o.setAttribute("ry",s/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,Wd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Wd=new WeakMap;var zd;class S0 extends Ft{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,zd,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:i,borderStyle:s,popupRef:n},width:a,height:o}=this;if(!i)return this.container;const l=this.svgFactory.create(a,o,!0);let c=[];for(let u=0,g=i.length;u<g;u+=2){const b=i[u]-e[0],w=e[3]-i[u+1];c.push("".concat(b,",").concat(w))}c=c.join(" ");const d=f(this,zd,this.svgFactory.createElement(this.svgElementName));return d.setAttribute("points",c),d.setAttribute("stroke-width",s.width||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),l.append(d),this.container.append(l),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,zd)}addHighlightArea(){this.container.classList.add("highlightArea")}}zd=new WeakMap;class OS extends S0{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class BS extends Ft{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 Gd,Ya,Xd,xm;class ew extends Ft{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Xd);m(this,Gd,null);m(this,Ya,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?Y.HIGHLIGHT:Y.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,rotation:i,inkLists:s,borderStyle:n,popupRef:a}}=this,{transform:o,width:l,height:c}=p(this,Xd,xm).call(this,i,e),d=this.svgFactory.create(l,c,!0),u=f(this,Gd,this.svgFactory.createElement("svg:g"));d.append(u),u.setAttribute("stroke-width",n.width||1),u.setAttribute("stroke-linecap","round"),u.setAttribute("stroke-linejoin","round"),u.setAttribute("stroke-miterlimit",10),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),u.setAttribute("transform",o);for(let g=0,b=s.length;g<b;g++){const w=this.svgFactory.createElement(this.svgElementName);r(this,Ya).push(w),w.setAttribute("points",s[g].join(",")),u.append(w)}return!a&&this.hasPopupData&&this._createPopup(),this.container.append(d),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);const{thickness:i,points:s,rect:n}=e,a=r(this,Gd);if(i>=0&&a.setAttribute("stroke-width",i||1),s)for(let o=0,l=r(this,Ya).length;o<l;o++)r(this,Ya)[o].setAttribute("points",s[o].join(","));if(n){const{transform:o,width:l,height:c}=p(this,Xd,xm).call(this,this.data.rotation,n);a.parentElement.setAttribute("viewBox","0 0 ".concat(l," ").concat(c)),a.setAttribute("transform",o)}}getElementsToTriggerPopup(){return r(this,Ya)}addHighlightArea(){this.container.classList.add("highlightArea")}}Gd=new WeakMap,Ya=new WeakMap,Xd=new WeakSet,xm=function(e,i){switch(e){case 90:return{transform:"rotate(90) translate(".concat(-i[0],",").concat(i[1],") scale(1,-1)"),width:i[3]-i[1],height:i[2]-i[0]};case 180:return{transform:"rotate(180) translate(".concat(-i[2],",").concat(i[1],") scale(1,-1)"),width:i[2]-i[0],height:i[3]-i[1]};case 270:return{transform:"rotate(270) translate(".concat(-i[2],",").concat(i[3],") scale(1,-1)"),width:i[3]-i[1],height:i[2]-i[0]};default:return{transform:"translate(".concat(-i[0],",").concat(i[3],") scale(1,-1)"),width:i[2]-i[0],height:i[3]-i[1]}}};class P0 extends Ft{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Y.HIGHLIGHT}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){const i=document.createElement("mark");i.classList.add("overlaidText"),i.textContent=t,this.container.append(i)}return this.container}}class VS extends Ft{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),t){const i=document.createElement("u");i.classList.add("overlaidText"),i.textContent=t,this.container.append(i)}return this.container}}class HS extends Ft{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),t){const i=document.createElement("u");i.classList.add("overlaidText"),i.textContent=t,this.container.append(i)}return this.container}}class jS extends Ft{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),t){const i=document.createElement("s");i.classList.add("overlaidText"),i.textContent=t,this.container.append(i)}return this.container}}class x0 extends Ft{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Y.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 qd,Yd,Cm;class $S extends Ft{constructor(e){var s;super(e,{isRenderable:!0});m(this,Yd);m(this,qd,null);const{file:i}=this.data;this.filename=i.filename,this.content=i.content,(s=this.linkService.eventBus)==null||s.dispatch("fileattachmentannotation",{source:this,...i})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:i}=this;let s;i.hasAppearance||i.fillAlpha===0?s=document.createElement("div"):(s=document.createElement("img"),s.src="".concat(this.imageResourcesPath,"annotation-").concat(/paperclip/i.test(i.name)?"paperclip":"pushpin",".svg"),i.fillAlpha&&i.fillAlpha<1&&(s.style="filter: opacity(".concat(Math.round(i.fillAlpha*100),"%);"))),s.addEventListener("dblclick",p(this,Yd,Cm).bind(this)),f(this,qd,s);const{isMac:n}=pe.platform;return e.addEventListener("keydown",a=>{a.key==="Enter"&&(n?a.metaKey:a.ctrlKey)&&p(this,Yd,Cm).call(this)}),!i.popupRef&&this.hasPopupData?this._createPopup():s.classList.add("popupTriggerArea"),e.append(s),e}getElementsToTriggerPopup(){return r(this,qd)}addHighlightArea(){this.container.classList.add("highlightArea")}}qd=new WeakMap,Yd=new WeakSet,Cm=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var Kd,Ka,gr,Zd,Jr,Tm,Im,Ql;let US=(Ql=class{constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:s,page:n,viewport:a,structTreeLayer:o}){m(this,Jr);m(this,Kd,null);m(this,Ka,null);m(this,gr,new Map);m(this,Zd,null);this.div=t,f(this,Kd,e),f(this,Ka,i),f(this,Zd,o||null),this.page=n,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=s}hasEditableAnnotations(){return r(this,gr).size>0}async render(t){var a;const{annotations:e}=t,i=this.div;Mo(i,this.viewport);const s=new Map,n={data:null,layer:i,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Ag,annotationStorage:t.annotationStorage||new Zb,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const o of e){if(o.noHTML)continue;const l=o.annotationType===Bt.POPUP;if(l){const u=s.get(o.id);if(!u)continue;n.elements=u}else if(o.rect[2]===o.rect[0]||o.rect[3]===o.rect[1])continue;n.data=o;const c=$w.create(n);if(!c.isRenderable)continue;if(!l&&o.popupRef){const u=s.get(o.popupRef);u?u.push(c):s.set(o.popupRef,[c])}const d=c.render();o.hidden&&(d.style.visibility="hidden"),await p(this,Jr,Tm).call(this,d,o.id,n.elements),c._isEditable&&(r(this,gr).set(c.data.id,c),(a=this._annotationEditorUIManager)==null||a.renderAnnotationElement(c))}p(this,Jr,Im).call(this)}async addLinkAnnotations(t,e){const i={data:null,layer:this.div,linkService:e,svgFactory:new Ag,parent:this};for(const s of t){s.borderStyle||(s.borderStyle=Ql._defaultBorderStyle),i.data=s;const n=$w.create(i);if(!n.isRenderable)continue;const a=n.render();await p(this,Jr,Tm).call(this,a,s.id,null)}}update({viewport:t}){const e=this.div;this.viewport=t,Mo(e,{rotation:t.rotation}),p(this,Jr,Im).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(r(this,gr).values())}getEditableAnnotation(t){return r(this,gr).get(t)}static get _defaultBorderStyle(){return st(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Vo.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},Kd=new WeakMap,Ka=new WeakMap,gr=new WeakMap,Zd=new WeakMap,Jr=new WeakSet,Tm=async function(t,e,i){var o,l;const s=t.firstChild||t,n=s.id="".concat(Yb).concat(e),a=await((o=r(this,Zd))==null?void 0:o.getAriaAttributes(n));if(a)for(const[c,d]of a)s.setAttribute(c,d);i?i.at(-1).container.after(t):(this.div.append(t),(l=r(this,Kd))==null||l.moveElementInDOM(this.div,t,s,!1))},Im=function(){var e;if(!r(this,Ka))return;const t=this.div;for(const[i,s]of r(this,Ka)){const n=t.querySelector('[data-annotation-id="'.concat(i,'"]'));if(!n)continue;s.className="annotationContent";const{firstChild:a}=n;a?a.nodeName==="CANVAS"?a.replaceWith(s):a.classList.contains("annotationContent")?a.after(s):a.before(s):n.append(s);const o=r(this,gr).get(i);o&&(o._hasNoCanvas?((e=this._annotationEditorUIManager)==null||e.setMissingCanvas(i,n.id,s),o._hasNoCanvas=!1):o.canvas=s)}r(this,Ka).clear()},Ql);const gf=/\r\n?|\n/g;var vi,Ye,Qd,Za,Ke,$t,C0,T0,I0,Hf,In,jf,$f,L0,Rm,R0;const wt=class wt extends vt{constructor(e){super({...e,name:"freeTextEditor"});m(this,$t);m(this,vi);m(this,Ye,"");m(this,Qd,"".concat(this.id,"-editor"));m(this,Za,null);m(this,Ke);k(this,"_colorPicker",null);f(this,vi,e.color||wt._defaultColor||vt._defaultLineColor),f(this,Ke,e.fontSize||wt._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static get _keyboardManager(){const e=wt.prototype,i=a=>a.isEmpty(),s=Nc.TRANSLATE_SMALL,n=Nc.TRANSLATE_BIG;return st(this,"_keyboardManager",new rf([[["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:[-s,0],checker:i}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:i}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[s,0],checker:i}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[n,0],checker:i}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-s],checker:i}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:i}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,s],checker:i}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,n],checker:i}]]))}static initialize(e,i){vt.initialize(e,i);const s=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(s.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,i){switch(e){case nt.FREETEXT_SIZE:wt._defaultFontSize=i;break;case nt.FREETEXT_COLOR:wt._defaultColor=i;break}}updateParams(e,i){switch(e){case nt.FREETEXT_SIZE:p(this,$t,C0).call(this,i);break;case nt.FREETEXT_COLOR:p(this,$t,T0).call(this,i);break}}static get defaultPropertiesToUpdate(){return[[nt.FREETEXT_SIZE,wt._defaultFontSize],[nt.FREETEXT_COLOR,wt._defaultColor||vt._defaultLineColor]]}get propertiesToUpdate(){return[[nt.FREETEXT_SIZE,r(this,Ke)],[nt.FREETEXT_COLOR,r(this,vi)]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new _g(this)),[["colorPicker",this._colorPicker]]}get colorType(){return nt.FREETEXT_COLOR}get colorValue(){return r(this,vi)}_translateEmpty(e,i){this._uiManager.translateSelectedEditors(e,i,!0)}getInitialTranslation(){const e=this.parentScale;return[-wt._internalPadding*e,-(wt._internalPadding+r(this,Ke))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),f(this,Za,new AbortController);const e=this._uiManager.combinedSignal(r(this,Za));return 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}),!0}disableEditMode(){var e;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",r(this,Qd)),this._isDraggable=!0,(e=r(this,Za))==null||e.abort(),f(this,Za,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){var i;this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),(i=this._initialOptions)!=null&&i.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,Ye),i=f(this,Ye,p(this,$t,I0).call(this).trimEnd());if(e===i)return;const s=n=>{if(f(this,Ye,n),!n){this.remove();return}p(this,$t,$f).call(this),this._uiManager.rebuild(this),p(this,$t,Hf).call(this)};this.addCommands({cmd:()=>{s(i)},undo:()=>{s(e)},mustExec:!1}),p(this,$t,Hf).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){wt._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)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,i;(this._isCopy||this.annotationElementId)&&(e=this.x,i=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",r(this,Qd)),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:s}=this.editorDiv;if(s.fontSize="calc(".concat(r(this,Ke),"px * var(--total-scale-factor))"),s.color=r(this,vi),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[n,a]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[l,c]=this.getInitialTranslation();[l,c]=this.pageTranslationToScreen(l,c);const[d,u]=this.pageDimensions,[g,b]=this.pageTranslation;let w,v;switch(this.rotation){case 0:w=e+(o[0]-g)/d,v=i+this.height-(o[1]-b)/u;break;case 90:w=e+(o[0]-g)/d,v=i-(o[1]-b)/u,[l,c]=[c,-l];break;case 180:w=e-this.width+(o[0]-g)/d,v=i-(o[1]-b)/u,[l,c]=[-l,-c];break;case 270:w=e+(o[0]-g-this.height*u)/d,v=i+(o[1]-b-this.width*d)/u,[l,c]=[-c,l];break}this.setAt(w*n,v*a,l,c)}else this._moveAfterPaste(e,i);p(this,$t,$f).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var w,v,A;const i=e.clipboardData||window.clipboardData,{types:s}=i;if(s.length===1&&s[0]==="text/plain")return;e.preventDefault();const n=p(w=wt,In,Rm).call(w,i.getData("text")||"").replaceAll(gf,"\n");if(!n)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!n.includes("\n")){o.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:l,startOffset:c}=o,d=[],u=[];if(l.nodeType===Node.TEXT_NODE){const y=l.parentElement;if(u.push(l.nodeValue.slice(c).replaceAll(gf,"")),y!==this.editorDiv){let S=d;for(const _ of this.editorDiv.childNodes){if(_===y){S=u;continue}S.push(p(v=wt,In,jf).call(v,_))}}d.push(l.nodeValue.slice(0,c).replaceAll(gf,""))}else if(l===this.editorDiv){let y=d,S=0;for(const _ of this.editorDiv.childNodes)S++===c&&(y=u),y.push(p(A=wt,In,jf).call(A,_))}f(this,Ye,"".concat(d.join("\n")).concat(n).concat(u.join("\n"))),p(this,$t,$f).call(this);const g=new Range;let b=Math.sumPrecise(d.map(y=>y.length));for(const{firstChild:y}of this.editorDiv.childNodes)if(y.nodeType===Node.TEXT_NODE){const S=y.nodeValue.length;if(b<=S){g.setStart(y,b),g.setEnd(y,b);break}b-=S}a.removeAllRanges(),a.addRange(g)}get contentDiv(){return this.editorDiv}static async deserialize(e,i,s){var o;let n=null;if(e instanceof E0){const{data:{defaultAppearanceData:{fontSize:l,fontColor:c},rect:d,rotation:u,id:g,popupRef:b,contentsObj:w},textContent:v,textPosition:A,parent:{page:{pageNumber:y}}}=e;if(!v||v.length===0)return null;n=e={annotationType:Y.FREETEXT,color:Array.from(c),fontSize:l,value:v.join("\n"),position:A,pageIndex:y-1,rect:d.slice(0),rotation:u,annotationElementId:g,id:g,deleted:!1,popupRef:b,comment:(w==null?void 0:w.str)||null}}const a=await super.deserialize(e,i,s);return f(a,Ke,e.fontSize),f(a,vi,q.makeHexColor(...e.color)),f(a,Ye,p(o=wt,In,Rm).call(o,e.value)),a._initialData=n,e.comment&&a.setCommentData(e.comment),a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i=wt._internalPadding*this.parentScale,s=this.getRect(i,i),n=vt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:r(this,vi)),a={annotationType:Y.FREETEXT,color:n,fontSize:r(this,Ke),value:p(this,$t,L0).call(this),pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return this.addComment(a),e?(a.isCopy=!0,a):this.annotationElementId&&!p(this,$t,R0).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(e){const i=super.renderAnnotationElement(e),{style:s}=i;s.fontSize="calc(".concat(r(this,Ke),"px * var(--total-scale-factor))"),s.color=r(this,vi),i.replaceChildren();for(const o of r(this,Ye).split("\n")){const l=document.createElement("div");l.append(o?document.createTextNode(o):document.createElement("br")),i.append(l)}const n=wt._internalPadding*this.parentScale,a={rect:this.getRect(n,n)};return a.popup=this.hasEditedComment?this.comment:{text:r(this,Ye)},e.updateEdited(a),i}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};vi=new WeakMap,Ye=new WeakMap,Qd=new WeakMap,Za=new WeakMap,Ke=new WeakMap,$t=new WeakSet,C0=function(e){const i=n=>{this.editorDiv.style.fontSize="calc(".concat(n,"px * var(--total-scale-factor))"),this.translate(0,-(n-r(this,Ke))*this.parentScale),f(this,Ke,n),p(this,$t,Hf).call(this)},s=r(this,Ke);this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:nt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},T0=function(e){const i=n=>{var a;f(this,vi,this.editorDiv.style.color=n),(a=this._colorPicker)==null||a.update(n)},s=r(this,vi);this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:nt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},I0=function(){var s;const e=[];this.editorDiv.normalize();let i=null;for(const n of this.editorDiv.childNodes)(i==null?void 0:i.nodeType)===Node.TEXT_NODE&&n.nodeName==="BR"||(e.push(p(s=wt,In,jf).call(s,n)),i=n);return e.join("\n")},Hf=function(){const[e,i]=this.parentDimensions;let s;if(this.isAttachedToDOM)s=this.div.getBoundingClientRect();else{const{currentLayer:n,div:a}=this,o=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",n.div.append(this.div),s=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=s.width/e,this.height=s.height/i):(this.width=s.height/e,this.height=s.width/i),this.fixAndSetPosition()},In=new WeakSet,jf=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(gf,"")},$f=function(){if(this.editorDiv.replaceChildren(),!!r(this,Ye))for(const e of r(this,Ye).split("\n")){const i=document.createElement("div");i.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(i)}},L0=function(){return r(this,Ye).replaceAll(" "," ")},Rm=function(e){return e.replaceAll(" "," ")},R0=function(e){const{value:i,fontSize:s,color:n,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==i||e.fontSize!==s||e.color.some((o,l)=>o!==n[l])||e.pageIndex!==a},m(wt,In),k(wt,"_freeTextDefaultContent",""),k(wt,"_internalPadding",0),k(wt,"_defaultColor",null),k(wt,"_defaultFontSize",10),k(wt,"_type","freetext"),k(wt,"_editorType",Y.FREETEXT);let Lm=wt;class H{toSVGPath(){pt("Abstract method `toSVGPath` must be implemented.")}get box(){pt("Abstract getter `box` must be implemented.")}serialize(t,e){pt("Abstract method `serialize` must be implemented.")}static _rescale(t,e,i,s,n,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o]*s,a[o+1]=i+t[o+1]*n;return a}static _rescaleAndSwap(t,e,i,s,n,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o+1]*s,a[o+1]=i+t[o]*n;return a}static _translate(t,e,i,s){s||(s=new Float32Array(t.length));for(let n=0,a=t.length;n<a;n+=2)s[n]=e+t[n],s[n+1]=i+t[n+1];return s}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,i,s,n){switch(n){case 90:return[1-e/i,t/s];case 180:return[1-t/i,1-e/s];case 270:return[e/i,1-t/s];default:return[t/i,e/s]}}static _normalizePagePoint(t,e,i){switch(i){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,i,s,n,a){return[(t+5*i)/6,(e+5*s)/6,(5*i+n)/6,(5*s+a)/6,(i+n)/2,(s+a)/2]}}k(H,"PRECISION",1e-4);var Ze,Ni,Jl,th,fs,it,Qa,Ja,Jd,tu,eh,ih,pr,eu,Wg,zg,Xt,dc,M0,k0,D0,N0,F0,O0;const Ds=class Ds{constructor({x:t,y:e},i,s,n,a,o=0){m(this,Xt);m(this,Ze);m(this,Ni,[]);m(this,Jl);m(this,th);m(this,fs,[]);m(this,it,new Float32Array(18));m(this,Qa);m(this,Ja);m(this,Jd);m(this,tu);m(this,eh);m(this,ih);m(this,pr,[]);f(this,Ze,i),f(this,ih,n*s),f(this,th,a),r(this,it).set([NaN,NaN,NaN,NaN,t,e],6),f(this,Jl,o),f(this,tu,r(Ds,eu)*s),f(this,Jd,r(Ds,zg)*s),f(this,eh,s),r(this,pr).push(t,e)}isEmpty(){return isNaN(r(this,it)[8])}add({x:t,y:e}){var C;f(this,Qa,t),f(this,Ja,e);const[i,s,n,a]=r(this,Ze);let[o,l,c,d]=r(this,it).subarray(8,12);const u=t-c,g=e-d,b=Math.hypot(u,g);if(b<r(this,Jd))return!1;const w=b-r(this,tu),v=w/b,A=v*u,y=v*g;let S=o,_=l;o=c,l=d,c+=A,d+=y,(C=r(this,pr))==null||C.push(t,e);const E=-y/w,P=A/w,x=E*r(this,ih),T=P*r(this,ih);return r(this,it).set(r(this,it).subarray(2,8),0),r(this,it).set([c+x,d+T],4),r(this,it).set(r(this,it).subarray(14,18),12),r(this,it).set([c-x,d-T],16),isNaN(r(this,it)[6])?(r(this,fs).length===0&&(r(this,it).set([o+x,l+T],2),r(this,fs).push(NaN,NaN,NaN,NaN,(o+x-i)/n,(l+T-s)/a),r(this,it).set([o-x,l-T],14),r(this,Ni).push(NaN,NaN,NaN,NaN,(o-x-i)/n,(l-T-s)/a)),r(this,it).set([S,_,o,l,c,d],6),!this.isEmpty()):(r(this,it).set([S,_,o,l,c,d],6),Math.abs(Math.atan2(_-l,S-o)-Math.atan2(y,A))<Math.PI/2?([o,l,c,d]=r(this,it).subarray(2,6),r(this,fs).push(NaN,NaN,NaN,NaN,((o+c)/2-i)/n,((l+d)/2-s)/a),[o,l,S,_]=r(this,it).subarray(14,18),r(this,Ni).push(NaN,NaN,NaN,NaN,((S+o)/2-i)/n,((_+l)/2-s)/a),!0):([S,_,o,l,c,d]=r(this,it).subarray(0,6),r(this,fs).push(((S+5*o)/6-i)/n,((_+5*l)/6-s)/a,((5*o+c)/6-i)/n,((5*l+d)/6-s)/a,((o+c)/2-i)/n,((l+d)/2-s)/a),[c,d,o,l,S,_]=r(this,it).subarray(12,18),r(this,Ni).push(((S+5*o)/6-i)/n,((_+5*l)/6-s)/a,((5*o+c)/6-i)/n,((5*l+d)/6-s)/a,((o+c)/2-i)/n,((l+d)/2-s)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const t=r(this,fs),e=r(this,Ni);if(isNaN(r(this,it)[6])&&!this.isEmpty())return p(this,Xt,M0).call(this);const i=[];i.push("M".concat(t[4]," ").concat(t[5]));for(let s=6;s<t.length;s+=6)isNaN(t[s])?i.push("L".concat(t[s+4]," ").concat(t[s+5])):i.push("C".concat(t[s]," ").concat(t[s+1]," ").concat(t[s+2]," ").concat(t[s+3]," ").concat(t[s+4]," ").concat(t[s+5]));p(this,Xt,D0).call(this,i);for(let s=e.length-6;s>=6;s-=6)isNaN(e[s])?i.push("L".concat(e[s+4]," ").concat(e[s+5])):i.push("C".concat(e[s]," ").concat(e[s+1]," ").concat(e[s+2]," ").concat(e[s+3]," ").concat(e[s+4]," ").concat(e[s+5]));return p(this,Xt,k0).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,s,n,a){return new B0(t,e,i,s,n,a)}getOutlines(){var u,g;const t=r(this,fs),e=r(this,Ni),i=r(this,it),[s,n,a,o]=r(this,Ze),l=new Float32Array(((g=(u=r(this,pr))==null?void 0:u.length)!=null?g:0)+2);for(let b=0,w=l.length-2;b<w;b+=2)l[b]=(r(this,pr)[b]-s)/a,l[b+1]=(r(this,pr)[b+1]-n)/o;if(l[l.length-2]=(r(this,Qa)-s)/a,l[l.length-1]=(r(this,Ja)-n)/o,isNaN(i[6])&&!this.isEmpty())return p(this,Xt,N0).call(this,l);const c=new Float32Array(r(this,fs).length+24+r(this,Ni).length);let d=t.length;for(let b=0;b<d;b+=2){if(isNaN(t[b])){c[b]=c[b+1]=NaN;continue}c[b]=t[b],c[b+1]=t[b+1]}d=p(this,Xt,O0).call(this,c,d);for(let b=e.length-6;b>=6;b-=6)for(let w=0;w<6;w+=2){if(isNaN(e[b+w])){c[d]=c[d+1]=NaN,d+=2;continue}c[d]=e[b+w],c[d+1]=e[b+w+1],d+=2}return p(this,Xt,F0).call(this,c,d),this.newFreeDrawOutline(c,l,r(this,Ze),r(this,eh),r(this,Jl),r(this,th))}};Ze=new WeakMap,Ni=new WeakMap,Jl=new WeakMap,th=new WeakMap,fs=new WeakMap,it=new WeakMap,Qa=new WeakMap,Ja=new WeakMap,Jd=new WeakMap,tu=new WeakMap,eh=new WeakMap,ih=new WeakMap,pr=new WeakMap,eu=new WeakMap,Wg=new WeakMap,zg=new WeakMap,Xt=new WeakSet,dc=function(){const t=r(this,it).subarray(4,6),e=r(this,it).subarray(16,18),[i,s,n,a]=r(this,Ze);return[(r(this,Qa)+(t[0]-e[0])/2-i)/n,(r(this,Ja)+(t[1]-e[1])/2-s)/a,(r(this,Qa)+(e[0]-t[0])/2-i)/n,(r(this,Ja)+(e[1]-t[1])/2-s)/a]},M0=function(){const[t,e,i,s]=r(this,Ze),[n,a,o,l]=p(this,Xt,dc).call(this);return"M".concat((r(this,it)[2]-t)/i," ").concat((r(this,it)[3]-e)/s," L").concat((r(this,it)[4]-t)/i," ").concat((r(this,it)[5]-e)/s," L").concat(n," ").concat(a," L").concat(o," ").concat(l," L").concat((r(this,it)[16]-t)/i," ").concat((r(this,it)[17]-e)/s," L").concat((r(this,it)[14]-t)/i," ").concat((r(this,it)[15]-e)/s," Z")},k0=function(t){const e=r(this,Ni);t.push("L".concat(e[4]," ").concat(e[5]," Z"))},D0=function(t){const[e,i,s,n]=r(this,Ze),a=r(this,it).subarray(4,6),o=r(this,it).subarray(16,18),[l,c,d,u]=p(this,Xt,dc).call(this);t.push("L".concat((a[0]-e)/s," ").concat((a[1]-i)/n," L").concat(l," ").concat(c," L").concat(d," ").concat(u," L").concat((o[0]-e)/s," ").concat((o[1]-i)/n))},N0=function(t){const e=r(this,it),[i,s,n,a]=r(this,Ze),[o,l,c,d]=p(this,Xt,dc).call(this),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(e[2]-i)/n,(e[3]-s)/a,NaN,NaN,NaN,NaN,(e[4]-i)/n,(e[5]-s)/a,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,c,d,NaN,NaN,NaN,NaN,(e[16]-i)/n,(e[17]-s)/a,NaN,NaN,NaN,NaN,(e[14]-i)/n,(e[15]-s)/a],0),this.newFreeDrawOutline(u,t,r(this,Ze),r(this,eh),r(this,Jl),r(this,th))},F0=function(t,e){const i=r(this,Ni);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+=6},O0=function(t,e){const i=r(this,it).subarray(4,6),s=r(this,it).subarray(16,18),[n,a,o,l]=r(this,Ze),[c,d,u,g]=p(this,Xt,dc).call(this);return t.set([NaN,NaN,NaN,NaN,(i[0]-n)/o,(i[1]-a)/l,NaN,NaN,NaN,NaN,c,d,NaN,NaN,NaN,NaN,u,g,NaN,NaN,NaN,NaN,(s[0]-n)/o,(s[1]-a)/l],e),e+=24},m(Ds,eu,8),m(Ds,Wg,2),m(Ds,zg,r(Ds,eu)+r(Ds,Wg));let Eg=Ds;var sh,to,on,iu,Qe,su,Nt,Gg,V0;class B0 extends H{constructor(e,i,s,n,a,o){super();m(this,Gg);m(this,sh);m(this,to,new Float32Array(4));m(this,on);m(this,iu);m(this,Qe);m(this,su);m(this,Nt);f(this,Nt,e),f(this,Qe,i),f(this,sh,s),f(this,su,n),f(this,on,a),f(this,iu,o),this.lastPoint=[NaN,NaN],p(this,Gg,V0).call(this,o);const[l,c,d,u]=r(this,to);for(let g=0,b=e.length;g<b;g+=2)e[g]=(e[g]-l)/d,e[g+1]=(e[g+1]-c)/u;for(let g=0,b=i.length;g<b;g+=2)i[g]=(i[g]-l)/d,i[g+1]=(i[g+1]-c)/u}toSVGPath(){const e=["M".concat(r(this,Nt)[4]," ").concat(r(this,Nt)[5])];for(let i=6,s=r(this,Nt).length;i<s;i+=6){if(isNaN(r(this,Nt)[i])){e.push("L".concat(r(this,Nt)[i+4]," ").concat(r(this,Nt)[i+5]));continue}e.push("C".concat(r(this,Nt)[i]," ").concat(r(this,Nt)[i+1]," ").concat(r(this,Nt)[i+2]," ").concat(r(this,Nt)[i+3]," ").concat(r(this,Nt)[i+4]," ").concat(r(this,Nt)[i+5]))}return e.push("Z"),e.join(" ")}serialize([e,i,s,n],a){const o=s-e,l=n-i;let c,d;switch(a){case 0:c=H._rescale(r(this,Nt),e,n,o,-l),d=H._rescale(r(this,Qe),e,n,o,-l);break;case 90:c=H._rescaleAndSwap(r(this,Nt),e,i,o,l),d=H._rescaleAndSwap(r(this,Qe),e,i,o,l);break;case 180:c=H._rescale(r(this,Nt),s,i,-o,l),d=H._rescale(r(this,Qe),s,i,-o,l);break;case 270:c=H._rescaleAndSwap(r(this,Nt),s,n,-o,-l),d=H._rescaleAndSwap(r(this,Qe),s,n,-o,-l);break}return{outline:Array.from(c),points:[Array.from(d)]}}get box(){return r(this,to)}newOutliner(e,i,s,n,a,o=0){return new Eg(e,i,s,n,a,o)}getNewOutline(e,i){const[s,n,a,o]=r(this,to),[l,c,d,u]=r(this,sh),g=a*d,b=o*u,w=s*d+l,v=n*u+c,A=this.newOutliner({x:r(this,Qe)[0]*g+w,y:r(this,Qe)[1]*b+v},r(this,sh),r(this,su),e,r(this,iu),i!=null?i:r(this,on));for(let y=2;y<r(this,Qe).length;y+=2)A.add({x:r(this,Qe)[y]*g+w,y:r(this,Qe)[y+1]*b+v});return A.getOutlines()}}sh=new WeakMap,to=new WeakMap,on=new WeakMap,iu=new WeakMap,Qe=new WeakMap,su=new WeakMap,Nt=new WeakMap,Gg=new WeakSet,V0=function(e){const i=r(this,Nt);let s=i[4],n=i[5];const a=[s,n,s,n];let o=s,l=n;const c=e?Math.max:Math.min;for(let u=6,g=i.length;u<g;u+=6){const b=i[u+4],w=i[u+5];if(isNaN(i[u]))q.pointBoundingBox(b,w,a),l<w?(o=b,l=w):l===w&&(o=c(o,b));else{const v=[1/0,1/0,-1/0,-1/0];q.bezierBoundingBox(s,n,...i.slice(u,u+6),v),q.rectBoundingBox(...v,a),l<v[3]?(o=v[2],l=v[3]):l===v[3]&&(o=c(o,v[2]))}s=b,n=w}const d=r(this,to);d[0]=a[0]-r(this,on),d[1]=a[1]-r(this,on),d[2]=a[2]-a[0]+2*r(this,on),d[3]=a[3]-a[1]+2*r(this,on),this.lastPoint=[o,l]};var nu,ru,mr,Fi,Me,H0,Uf,j0,$0,km;class Mm{constructor(t,e=0,i=0,s=!0){m(this,Me);m(this,nu);m(this,ru);m(this,mr,[]);m(this,Fi,[]);const n=[1/0,1/0,-1/0,-1/0],a=10**-4;for(const{x:b,y:w,width:v,height:A}of t){const y=Math.floor((b-e)/a)*a,S=Math.ceil((b+v+e)/a)*a,_=Math.floor((w-e)/a)*a,E=Math.ceil((w+A+e)/a)*a,P=[y,_,E,!0],x=[S,_,E,!1];r(this,mr).push(P,x),q.rectBoundingBox(y,_,S,E,n)}const o=n[2]-n[0]+2*i,l=n[3]-n[1]+2*i,c=n[0]-i,d=n[1]-i,u=r(this,mr).at(s?-1:-2),g=[u[0],u[2]];for(const b of r(this,mr)){const[w,v,A]=b;b[0]=(w-c)/o,b[1]=(v-d)/l,b[2]=(A-d)/l}f(this,nu,new Float32Array([c,d,o,l])),f(this,ru,g)}getOutlines(){r(this,mr).sort((e,i)=>e[0]-i[0]||e[1]-i[1]||e[2]-i[2]);const t=[];for(const e of r(this,mr))e[3]?(t.push(...p(this,Me,km).call(this,e)),p(this,Me,j0).call(this,e)):(p(this,Me,$0).call(this,e),t.push(...p(this,Me,km).call(this,e)));return p(this,Me,H0).call(this,t)}}nu=new WeakMap,ru=new WeakMap,mr=new WeakMap,Fi=new WeakMap,Me=new WeakSet,H0=function(t){const e=[],i=new Set;for(const a of t){const[o,l,c]=a;e.push([o,l,a],[o,c,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 l=e[a][2],c=e[a+1][2];l.push(c),c.push(l),i.add(l),i.add(c)}const s=[];let n;for(;i.size>0;){const a=i.values().next().value;let[o,l,c,d,u]=a;i.delete(a);let g=o,b=l;for(n=[o,c],s.push(n);;){let w;if(i.has(d))w=d;else if(i.has(u))w=u;else break;i.delete(w),[o,l,c,d,u]=w,g!==o&&(n.push(g,b,o,b===l?l:c),g=o),b=b===l?c:l}n.push(g,b)}return new WS(s,r(this,nu),r(this,ru))},Uf=function(t){const e=r(this,Fi);let i=0,s=e.length-1;for(;i<=s;){const n=i+s>>1,a=e[n][0];if(a===t)return n;a<t?i=n+1:s=n-1}return s+1},j0=function([,t,e]){const i=p(this,Me,Uf).call(this,t);r(this,Fi).splice(i,0,[t,e])},$0=function([,t,e]){const i=p(this,Me,Uf).call(this,t);for(let s=i;s<r(this,Fi).length;s++){const[n,a]=r(this,Fi)[s];if(n!==t)break;if(n===t&&a===e){r(this,Fi).splice(s,1);return}}for(let s=i-1;s>=0;s--){const[n,a]=r(this,Fi)[s];if(n!==t)break;if(n===t&&a===e){r(this,Fi).splice(s,1);return}}},km=function(t){const[e,i,s]=t,n=[[e,i,s]],a=p(this,Me,Uf).call(this,s);for(let o=0;o<a;o++){const[l,c]=r(this,Fi)[o];for(let d=0,u=n.length;d<u;d++){const[,g,b]=n[d];if(!(c<=g||b<=l)){if(g>=l){if(b>c)n[d][1]=c;else{if(u===1)return[];n.splice(d,1),d--,u--}continue}n[d][2]=l,b>c&&n.push([e,c,b])}}}return n};var au,nh;class WS extends H{constructor(e,i,s){super();m(this,au);m(this,nh);f(this,nh,e),f(this,au,i),this.lastPoint=s}toSVGPath(){const e=[];for(const i of r(this,nh)){let[s,n]=i;e.push("M".concat(s," ").concat(n));for(let a=2;a<i.length;a+=2){const o=i[a],l=i[a+1];o===s?(e.push("V".concat(l)),n=l):l===n&&(e.push("H".concat(o)),s=o)}e.push("Z")}return e.join(" ")}serialize([e,i,s,n],a){const o=[],l=s-e,c=n-i;for(const d of r(this,nh)){const u=new Array(d.length);for(let g=0;g<d.length;g+=2)u[g]=e+d[g]*l,u[g+1]=n-d[g+1]*c;o.push(u)}return o}get box(){return r(this,au)}get classNamesForOutlining(){return["highlightOutline"]}}au=new WeakMap,nh=new WeakMap;class Dm extends Eg{newFreeDrawOutline(t,e,i,s,n,a){return new zS(t,e,i,s,n,a)}}class zS extends B0{newOutliner(t,e,i,s,n,a=0){return new Dm(t,e,i,s,n,a)}}var rh,ou,ln,eo,lu,Fe,hu,cu,io,yi,Je,le,ah,hn,ye,oh,_i,du,J,Nm,Wf,U0,W0,z0,Fm,sa,Pi,zo,G0,zf,uc,X0,q0,Y0,K0,Z0;const ht=class ht extends vt{constructor(e){super({...e,name:"highlightEditor"});m(this,J);m(this,rh,null);m(this,ou,0);m(this,ln);m(this,eo,null);m(this,lu,null);m(this,Fe,null);m(this,hu,null);m(this,cu,0);m(this,io,null);m(this,yi,null);m(this,Je,null);m(this,le,!1);m(this,ah,null);m(this,hn);m(this,ye,null);m(this,oh,"");m(this,_i);m(this,du,"");this.color=e.color||ht._defaultColor,f(this,_i,e.thickness||ht._defaultThickness),f(this,hn,e.opacity||ht._defaultOpacity),f(this,ln,e.boxes||null),f(this,du,e.methodOfCreation||""),f(this,oh,e.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",e.highlightId>-1?(f(this,le,!0),p(this,J,Wf).call(this,e),p(this,J,sa).call(this)):r(this,ln)&&(f(this,rh,e.anchorNode),f(this,ou,e.anchorOffset),f(this,hu,e.focusNode),f(this,cu,e.focusOffset),p(this,J,Nm).call(this),p(this,J,sa).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const e=ht.prototype;return st(this,"_keyboardManager",new rf([[["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,le)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:r(this,_i),methodOfCreation:r(this,du)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}get commentColor(){return this.color}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,i){var s;vt.initialize(e,i),ht._defaultColor||(ht._defaultColor=((s=i.highlightColors)==null?void 0:s.values().next().value)||"#fff066")}static updateDefaultParams(e,i){switch(e){case nt.HIGHLIGHT_COLOR:ht._defaultColor=i;break;case nt.HIGHLIGHT_THICKNESS:ht._defaultThickness=i;break}}translateInPage(e,i){}get toolbarPosition(){return r(this,ah)}updateParams(e,i){switch(e){case nt.HIGHLIGHT_COLOR:p(this,J,U0).call(this,i);break;case nt.HIGHLIGHT_THICKNESS:p(this,J,W0).call(this,i);break}}static get defaultPropertiesToUpdate(){return[[nt.HIGHLIGHT_COLOR,ht._defaultColor],[nt.HIGHLIGHT_THICKNESS,ht._defaultThickness]]}get propertiesToUpdate(){return[[nt.HIGHLIGHT_COLOR,this.color||ht._defaultColor],[nt.HIGHLIGHT_THICKNESS,r(this,_i)||ht._defaultThickness],[nt.HIGHLIGHT_FREE,r(this,le)]]}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",f(this,lu,new f0({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(p(this,J,uc).call(this))}getBaseTranslation(){return[0,0]}getRect(e,i){return super.getRect(e,i,p(this,J,uc).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){p(this,J,Fm).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(p(this,J,sa).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var s;let i=!1;this.parent&&!e?p(this,J,Fm).call(this):e&&(p(this,J,sa).call(this,e),i=!this.parent&&((s=this.div)==null?void 0:s.classList.contains("selectedEditor"))),super.setParent(e),this.show(this._isVisible),i&&this.select()}rotate(e){var n,a,o;const{drawLayer:i}=this.parent;let s;r(this,le)?(e=(e-this.rotation+360)%360,s=p(n=ht,Pi,zo).call(n,r(this,yi).box,e)):s=p(a=ht,Pi,zo).call(a,[this.x,this.y,this.width,this.height],e),i.updateProperties(r(this,Je),{bbox:s,root:{"data-main-rotation":e}}),i.updateProperties(r(this,ye),{bbox:p(o=ht,Pi,zo).call(o,r(this,Fe).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;const e=super.render();r(this,oh)&&(e.setAttribute("aria-label",r(this,oh)),e.setAttribute("role","mark")),r(this,le)?e.classList.add("free"):this.div.addEventListener("keydown",p(this,J,G0).bind(this),{signal:this._uiManager._signal});const i=f(this,io,document.createElement("div"));e.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",i.style.clipPath=r(this,eo);const[s,n]=this.parentDimensions;return this.setDims(this.width*s,this.height*n),py(this,r(this,io),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){var e;this.isSelected||(e=this.parent)==null||e.drawLayer.updateProperties(r(this,ye),{rootClass:{hovered:!0}})}pointerleave(){var e;this.isSelected||(e=this.parent)==null||e.drawLayer.updateProperties(r(this,ye),{rootClass:{hovered:!1}})}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:p(this,J,zf).call(this,!0);break;case 1:case 3:p(this,J,zf).call(this,!1);break}}select(){var e;super.select(),r(this,ye)&&((e=this.parent)==null||e.drawLayer.updateProperties(r(this,ye),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var e;super.unselect(),r(this,ye)&&((e=this.parent)==null||e.drawLayer.updateProperties(r(this,ye),{rootClass:{selected:!1}}),r(this,le)||p(this,J,zf).call(this,!1))}get _mustFixPosition(){return!r(this,le)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(r(this,Je),{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(r(this,ye),{rootClass:{hidden:!e}}))}static startHighlighting(e,i,{target:s,x:n,y:a}){const{x:o,y:l,width:c,height:d}=s.getBoundingClientRect(),u=new AbortController,g=e.combinedSignal(u),b=w=>{u.abort(),p(this,Pi,K0).call(this,e,w)};window.addEventListener("blur",b,{signal:g}),window.addEventListener("pointerup",b,{signal:g}),window.addEventListener("pointerdown",Vt,{capture:!0,passive:!1,signal:g}),window.addEventListener("contextmenu",Ci,{signal:g}),s.addEventListener("pointermove",p(this,Pi,Y0).bind(this,e),{signal:g}),this._freeHighlight=new Dm({x:n,y:a},[o,l,c,d],e.scale,this._defaultThickness/2,i,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(e,i,s){var v,A,y,S;let n=null;if(e instanceof P0){const{data:{quadPoints:_,rect:E,rotation:P,id:x,color:T,opacity:I,popupRef:C,contentsObj:L},parent:{page:{pageNumber:M}}}=e;n=e={annotationType:Y.HIGHLIGHT,color:Array.from(T),opacity:I,quadPoints:_,boxes:null,pageIndex:M-1,rect:E.slice(0),rotation:P,annotationElementId:x,id:x,deleted:!1,popupRef:C,comment:(L==null?void 0:L.str)||null}}else if(e instanceof ew){const{data:{inkLists:_,rect:E,rotation:P,id:x,color:T,borderStyle:{rawWidth:I},popupRef:C,contentsObj:L},parent:{page:{pageNumber:M}}}=e;n=e={annotationType:Y.HIGHLIGHT,color:Array.from(T),thickness:I,inkLists:_,boxes:null,pageIndex:M-1,rect:E.slice(0),rotation:P,annotationElementId:x,id:x,deleted:!1,popupRef:C,comment:(L==null?void 0:L.str)||null}}const{color:a,quadPoints:o,inkLists:l,opacity:c}=e,d=await super.deserialize(e,i,s);d.color=q.makeHexColor(...a),f(d,hn,c||1),l&&f(d,_i,e.thickness),d._initialData=n,e.comment&&d.setCommentData(e.comment);const[u,g]=d.pageDimensions,[b,w]=d.pageTranslation;if(o){const _=f(d,ln,[]);for(let E=0;E<o.length;E+=8)_.push({x:(o[E]-b)/u,y:1-(o[E+1]-w)/g,width:(o[E+2]-o[E])/u,height:(o[E+1]-o[E+5])/g});p(v=d,J,Nm).call(v),p(A=d,J,sa).call(A),d.rotate(d.rotation)}else if(l){f(d,le,!0);const _=l[0],E={x:_[0]-b,y:g-(_[1]-w)},P=new Dm(E,[0,0,u,g],1,r(d,_i)/2,!0,.001);for(let I=0,C=_.length;I<C;I+=2)E.x=_[I]-b,E.y=g-(_[I+1]-w),P.add(E);const{id:x,clipPathId:T}=i.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:d.color,"fill-opacity":d._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:P.toSVGPath()}},!0,!0);p(y=d,J,Wf).call(y,{highlightOutlines:P.getOutlines(),highlightId:x,clipPathId:T}),p(S=d,J,sa).call(S),d.rotate(d.parentRotation)}return d}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const i=this.getRect(0,0),s=vt._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),n={annotationType:Y.HIGHLIGHT,color:s,opacity:r(this,hn),thickness:r(this,_i),quadPoints:p(this,J,X0).call(this),outlines:p(this,J,q0).call(this,i),pageIndex:this.pageIndex,rect:i,rotation:p(this,J,uc).call(this),structTreeParentId:this._structTreeParentId};return this.addComment(n),this.annotationElementId&&!p(this,J,Z0).call(this,n)?null:(n.id=this.annotationElementId,n)}renderAnnotationElement(e){const i={rect:this.getRect(0,0)};return this.hasEditedComment&&(i.popup=this.comment),e.updateEdited(i),null}static canCreateNewEmptyEditor(){return!1}};rh=new WeakMap,ou=new WeakMap,ln=new WeakMap,eo=new WeakMap,lu=new WeakMap,Fe=new WeakMap,hu=new WeakMap,cu=new WeakMap,io=new WeakMap,yi=new WeakMap,Je=new WeakMap,le=new WeakMap,ah=new WeakMap,hn=new WeakMap,ye=new WeakMap,oh=new WeakMap,_i=new WeakMap,du=new WeakMap,J=new WeakSet,Nm=function(){const e=new Mm(r(this,ln),.001);f(this,yi,e.getOutlines()),[this.x,this.y,this.width,this.height]=r(this,yi).box;const i=new Mm(r(this,ln),.0025,.001,this._uiManager.direction==="ltr");f(this,Fe,i.getOutlines());const{lastPoint:s}=r(this,Fe);f(this,ah,[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height])},Wf=function({highlightOutlines:e,highlightId:i,clipPathId:s}){var u,g;if(f(this,yi,e),f(this,Fe,e.getNewOutline(r(this,_i)/2+1.5,.0025)),i>=0)f(this,Je,i),f(this,eo,s),this.parent.drawLayer.finalizeDraw(i,{bbox:e.box,path:{d:e.toSVGPath()}}),f(this,ye,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:r(this,Fe).box,path:{d:r(this,Fe).toSVGPath()}},!0));else if(this.parent){const b=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(r(this,Je),{bbox:p(u=ht,Pi,zo).call(u,r(this,yi).box,(b-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(r(this,ye),{bbox:p(g=ht,Pi,zo).call(g,r(this,Fe).box,b),path:{d:r(this,Fe).toSVGPath()}})}const[a,o,l,c]=e.box;switch(this.rotation){case 0:this.x=a,this.y=o,this.width=l,this.height=c;break;case 90:{const[b,w]=this.parentDimensions;this.x=o,this.y=1-a,this.width=l*w/b,this.height=c*b/w;break}case 180:this.x=1-a,this.y=1-o,this.width=l,this.height=c;break;case 270:{const[b,w]=this.parentDimensions;this.x=1-o,this.y=a,this.width=l*w/b,this.height=c*b/w;break}}const{lastPoint:d}=r(this,Fe);f(this,ah,[(d[0]-a)/l,(d[1]-o)/c])},U0=function(e){const i=(a,o)=>{var l,c;this.color=a,f(this,hn,o),(l=this.parent)==null||l.drawLayer.updateProperties(r(this,Je),{root:{fill:a,"fill-opacity":o}}),(c=r(this,lu))==null||c.updateColor(a)},s=this.color,n=r(this,hn);this.addCommands({cmd:i.bind(this,e,ht._defaultOpacity),undo:i.bind(this,s,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:nt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0)},W0=function(e){const i=r(this,_i),s=n=>{f(this,_i,n),p(this,J,z0).call(this,n)};this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:nt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},z0=function(e){if(!r(this,le))return;p(this,J,Wf).call(this,{highlightOutlines:r(this,yi).getNewOutline(e/2)}),this.fixAndSetPosition();const[i,s]=this.parentDimensions;this.setDims(this.width*i,this.height*s)},Fm=function(){r(this,Je)===null||!this.parent||(this.parent.drawLayer.remove(r(this,Je)),f(this,Je,null),this.parent.drawLayer.remove(r(this,ye)),f(this,ye,null))},sa=function(e=this.parent){r(this,Je)===null&&({id:se(this,Je)._,clipPathId:se(this,eo)._}=e.drawLayer.draw({bbox:r(this,yi).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":r(this,hn)},rootClass:{highlight:!0,free:r(this,le)},path:{d:r(this,yi).toSVGPath()}},!1,!0),f(this,ye,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:r(this,le)},bbox:r(this,Fe).box,path:{d:r(this,Fe).toSVGPath()}},r(this,le))),r(this,io)&&(r(this,io).style.clipPath=r(this,eo)))},Pi=new WeakSet,zo=function([e,i,s,n],a){switch(a){case 90:return[1-i-n,e,n,s];case 180:return[1-e-s,1-i-n,s,n];case 270:return[i,1-e-s,n,s]}return[e,i,s,n]},G0=function(e){ht._keyboardManager.exec(this,e)},zf=function(e){if(!r(this,rh))return;const i=window.getSelection();e?i.setPosition(r(this,rh),r(this,ou)):i.setPosition(r(this,hu),r(this,cu))},uc=function(){return r(this,le)?this.rotation:0},X0=function(){if(r(this,le))return null;const[e,i]=this.pageDimensions,[s,n]=this.pageTranslation,a=r(this,ln),o=new Float32Array(a.length*8);let l=0;for(const{x:c,y:d,width:u,height:g}of a){const b=c*e+s,w=(1-d)*i+n;o[l]=o[l+4]=b,o[l+1]=o[l+3]=w,o[l+2]=o[l+6]=b+u*e,o[l+5]=o[l+7]=w-g*i,l+=8}return o},q0=function(e){return r(this,yi).serialize(e,p(this,J,uc).call(this))},Y0=function(e,i){this._freeHighlight.add(i)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},K0=function(e,i){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(i,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},Z0=function(e){const{color:i}=this._initialData;return this.hasEditedComment||e.color.some((s,n)=>s!==i[n])},m(ht,Pi),k(ht,"_defaultColor",null),k(ht,"_defaultOpacity",1),k(ht,"_defaultThickness",12),k(ht,"_type","highlight"),k(ht,"_editorType",Y.HIGHLIGHT),k(ht,"_freeHighlightId",-1),k(ht,"_freeHighlight",null),k(ht,"_freeHighlightClipId","");let Sg=ht;var so;class Q0{constructor(){m(this,so,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(const[e,i]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,i)}updateSVGProperty(t,e){r(this,so)[t]=e}toSVGProperties(){const t=r(this,so);return f(this,so,Object.create(null)),{root:t}}reset(){f(this,so,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){pt("Not implemented")}}so=new WeakMap;var ti,lh,Zt,no,ro,br,wr,vr,ao,at,Om,Bm,Vm,fc,J0,Gf,gc,Go;const j=class j extends vt{constructor(e){super(e);m(this,at);m(this,ti,null);m(this,lh);k(this,"_colorPicker",null);k(this,"_drawId",null);f(this,lh,e.mustBeCommitted||!1),this._addOutlines(e)}_addOutlines(e){e.drawOutlines&&(p(this,at,Om).call(this,e),p(this,at,fc).call(this))}static _mergeSVGProperties(e,i){const s=new Set(Object.keys(e));for(const[n,a]of Object.entries(i))s.has(n)?Object.assign(e[n],a):e[n]=a;return e}static getDefaultDrawingOptions(e){pt("Not implemented")}static get typesMap(){pt("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,i){const s=this.typesMap.get(e);s&&this._defaultDrawingOptions.updateProperty(s,i),this._currentParent&&(r(j,Zt).updateProperty(s,i),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,i){const s=this.constructor.typesMap.get(e);s&&this._updateProperty(e,s,i)}static get defaultPropertiesToUpdate(){const e=[],i=this._defaultDrawingOptions;for(const[s,n]of this.typesMap)e.push([s,i[n]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:i}=this;for(const[s,n]of this.constructor.typesMap)e.push([s,i[n]]);return e}_updateProperty(e,i,s){const n=this._drawingOptions,a=n[i],o=l=>{var d,u;n.updateProperty(i,l);const c=r(this,ti).updateProperty(i,l);c&&p(this,at,gc).call(this,c),(d=this.parent)==null||d.drawLayer.updateProperties(this._drawId,n.toSVGProperties()),e===this.colorType&&((u=this._colorPicker)==null||u.update(l))};this.addCommands({cmd:o.bind(this,s),undo:o.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,j._mergeSVGProperties(r(this,ti).getPathResizingSVGProperties(p(this,at,Gf).call(this)),{bbox:p(this,at,Go).call(this)}))}_onResized(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,j._mergeSVGProperties(r(this,ti).getPathResizedSVGProperties(p(this,at,Gf).call(this)),{bbox:p(this,at,Go).call(this)}))}_onTranslating(e,i){var s;(s=this.parent)==null||s.drawLayer.updateProperties(this._drawId,{bbox:p(this,at,Go).call(this)})}_onTranslated(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,j._mergeSVGProperties(r(this,ti).getPathTranslatedSVGProperties(p(this,at,Gf).call(this),this.parentDimensions),{bbox:p(this,at,Go).call(this)}))}_onStartDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,r(this,lh)&&(f(this,lh,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){p(this,at,Vm).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(p(this,at,fc).call(this),p(this,at,gc).call(this,r(this,ti).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var s;let i=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),p(this,at,Vm).call(this)):e&&(this._uiManager.addShouldRescale(this),p(this,at,fc).call(this,e),i=!this.parent&&((s=this.div)==null?void 0:s.classList.contains("selectedEditor"))),super.setParent(e),i&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,j._mergeSVGProperties({bbox:p(this,at,Go).call(this)},r(this,ti).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&p(this,at,gc).call(this,r(this,ti).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,i;this._isCopy&&(e=this.x,i=this.y);const s=super.render();s.classList.add("draw");const n=document.createElement("div");s.append(n),n.setAttribute("aria-hidden","true"),n.className="internal";const[a,o]=this.parentDimensions;return this.setDims(this.width*a,this.height*o),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,i),s}static createDrawerInstance(e,i,s,n,a){pt("Not implemented")}static startDrawing(e,i,s,n){var A,y;const{target:a,offsetX:o,offsetY:l,pointerId:c,pointerType:d}=n;if(r(j,wr)&&r(j,wr)!==d)return;const{viewport:{rotation:u}}=e,{width:g,height:b}=a.getBoundingClientRect(),w=f(j,no,new AbortController),v=e.combinedSignal(w);if(r(j,br)||f(j,br,c),(A=r(j,wr))!=null||f(j,wr,d),window.addEventListener("pointerup",S=>{var _;r(j,br)===S.pointerId?this._endDraw(S):(_=r(j,vr))==null||_.delete(S.pointerId)},{signal:v}),window.addEventListener("pointercancel",S=>{var _;r(j,br)===S.pointerId?this._currentParent.endDrawingSession():(_=r(j,vr))==null||_.delete(S.pointerId)},{signal:v}),window.addEventListener("pointerdown",S=>{r(j,wr)===S.pointerType&&((r(j,vr)||f(j,vr,new Set)).add(S.pointerId),r(j,Zt).isCancellable()&&(r(j,Zt).removeLastElement(),r(j,Zt).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:v}),window.addEventListener("contextmenu",Ci,{signal:v}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:v}),a.addEventListener("touchmove",S=>{S.timeStamp===r(j,ao)&&Vt(S)},{signal:v}),e.toggleDrawing(),(y=i._editorUndoBar)==null||y.hide(),r(j,Zt)){e.drawLayer.updateProperties(this._currentDrawId,r(j,Zt).startNew(o,l,g,b,u));return}i.updateUIForDefaultProperties(this),f(j,Zt,this.createDrawerInstance(o,l,g,b,u)),f(j,ro,this.getDefaultDrawingOptions()),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(r(j,ro).toSVGProperties(),r(j,Zt).defaultSVGProperties),!0,!1)}static _drawMove(e){var a;if(f(j,ao,-1),!r(j,Zt))return;const{offsetX:i,offsetY:s,pointerId:n}=e;if(r(j,br)===n){if(((a=r(j,vr))==null?void 0:a.size)>=1){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,r(j,Zt).add(i,s)),f(j,ao,e.timeStamp),Vt(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,f(j,Zt,null),f(j,ro,null),f(j,wr,null),f(j,ao,NaN)),r(j,no)&&(r(j,no).abort(),f(j,no,null),f(j,br,NaN),f(j,vr,null))}static _endDraw(e){const i=this._currentParent;if(i){if(i.toggleDrawing(!0),this._cleanup(!1),(e==null?void 0:e.target)===i.div&&i.drawLayer.updateProperties(this._currentDrawId,r(j,Zt).end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){const s=r(j,Zt),n=this._currentDrawId,a=s.getLastElement();i.addCommands({cmd:()=>{i.drawLayer.updateProperties(n,s.setLastElement(a))},undo:()=>{i.drawLayer.updateProperties(n,s.removeLastElement())},mustExec:!1,type:nt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){const i=this._currentParent;if(!i)return null;if(i.toggleDrawing(!0),i.cleanUndoStack(nt.DRAW_STEP),!r(j,Zt).isEmpty()){const{pageDimensions:[s,n],scale:a}=i,o=i.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:r(j,Zt).getOutlines(s*a,n*a,a,this._INNER_MARGIN),drawingOptions:r(j,ro),mustBeCommitted:!e});return this._cleanup(!0),o}return i.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,i,s,n,a,o){pt("Not implemented")}static async deserialize(e,i,s){var u,g;const{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:l}}=i.viewport,c=this.deserializeDraw(o,l,n,a,this._INNER_MARGIN,e),d=await super.deserialize(e,i,s);return d.createDrawingOptions(e),p(u=d,at,Om).call(u,{drawOutlines:c}),p(g=d,at,fc).call(g),d.onScaleChanging(),d.rotate(),d}serializeDraw(e){const[i,s]=this.pageTranslation,[n,a]=this.pageDimensions;return r(this,ti).serialize([i,s,n,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};ti=new WeakMap,lh=new WeakMap,Zt=new WeakMap,no=new WeakMap,ro=new WeakMap,br=new WeakMap,wr=new WeakMap,vr=new WeakMap,ao=new WeakMap,at=new WeakSet,Om=function({drawOutlines:e,drawId:i,drawingOptions:s}){f(this,ti,e),this._drawingOptions||(this._drawingOptions=s),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-".concat(this.editorType,"-added-alert")),i>=0?(this._drawId=i,this.parent.drawLayer.finalizeDraw(i,e.defaultProperties)):this._drawId=p(this,at,Bm).call(this,e,this.parent),p(this,at,gc).call(this,e.box)},Bm=function(e,i){const{id:s}=i.drawLayer.draw(j._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return s},Vm=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},fc=function(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=p(this,at,Bm).call(this,r(this,ti),e)}},J0=function([e,i,s,n]){const{parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[i,1-e,s*(o/a),n*(a/o)];case 180:return[1-e,1-i,s,n];case 270:return[1-i,e,s*(o/a),n*(a/o)];default:return[e,i,s,n]}},Gf=function(){const{x:e,y:i,width:s,height:n,parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[1-i,e,s*(a/o),n*(o/a)];case 180:return[1-e,1-i,s,n];case 270:return[i,1-e,s*(a/o),n*(o/a)];default:return[e,i,s,n]}},gc=function(e){if([this.x,this.y,this.width,this.height]=p(this,at,J0).call(this,e),this.div){this.fixAndSetPosition();const[i,s]=this.parentDimensions;this.setDims(this.width*i,this.height*s)}this._onResized()},Go=function(){const{x:e,y:i,width:s,height:n,rotation:a,parentRotation:o,parentDimensions:[l,c]}=this;switch((a*4+o)/90){case 1:return[1-i-n,e,n,s];case 2:return[1-e-s,1-i-n,s,n];case 3:return[i,1-e-s,n,s];case 4:return[e,i-s*(l/c),n*(c/l),s*(l/c)];case 5:return[1-i,e,s*(l/c),n*(c/l)];case 6:return[1-e-n*(c/l),1-i,n*(c/l),s*(l/c)];case 7:return[i-s*(l/c),1-e-n*(c/l),s*(l/c),n*(c/l)];case 8:return[e-s,i-n,s,n];case 9:return[1-i,e-s,n,s];case 10:return[1-e,1-i,s,n];case 11:return[i-n,1-e,n,s];case 12:return[e-n*(c/l),i,n*(c/l),s*(l/c)];case 13:return[1-i-s*(l/c),e-n*(c/l),s*(l/c),n*(c/l)];case 14:return[1-e,1-i-s*(l/c),n*(c/l),s*(l/c)];case 15:return[i,1-e,s*(l/c),n*(c/l)];default:return[e,i,s,n]}},k(j,"_currentDrawId",-1),k(j,"_currentParent",null),m(j,Zt,null),m(j,no,null),m(j,ro,null),m(j,br,NaN),m(j,wr,null),m(j,vr,null),m(j,ao,NaN),k(j,"_INNER_MARGIN",3);let Pg=j;var gs,Qt,Jt,oo,hh,Se,he,Ai,lo,ho,co,ch,Xf;class GS{constructor(t,e,i,s,n,a){m(this,ch);m(this,gs,new Float64Array(6));m(this,Qt);m(this,Jt);m(this,oo);m(this,hh);m(this,Se);m(this,he,"");m(this,Ai,0);m(this,lo,new of);m(this,ho);m(this,co);f(this,ho,i),f(this,co,s),f(this,oo,n),f(this,hh,a),[t,e]=p(this,ch,Xf).call(this,t,e);const o=f(this,Qt,[NaN,NaN,NaN,NaN,t,e]);f(this,Se,[t,e]),f(this,Jt,[{line:o,points:r(this,Se)}]),r(this,gs).set(o,0)}updateProperty(t,e){t==="stroke-width"&&f(this,hh,e)}isEmpty(){return!r(this,Jt)||r(this,Jt).length===0}isCancellable(){return r(this,Se).length<=10}add(t,e){[t,e]=p(this,ch,Xf).call(this,t,e);const[i,s,n,a]=r(this,gs).subarray(2,6),o=t-n,l=e-a;return Math.hypot(r(this,ho)*o,r(this,co)*l)<=2?null:(r(this,Se).push(t,e),isNaN(i)?(r(this,gs).set([n,a,t,e],2),r(this,Qt).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(r(this,gs)[0])&&r(this,Qt).splice(6,6),r(this,gs).set([i,s,n,a,t,e],0),r(this,Qt).push(...H.createBezierPoints(i,s,n,a,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){const i=this.add(t,e);return i||(r(this,Se).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,s,n){f(this,ho,i),f(this,co,s),f(this,oo,n),[t,e]=p(this,ch,Xf).call(this,t,e);const a=f(this,Qt,[NaN,NaN,NaN,NaN,t,e]);f(this,Se,[t,e]);const o=r(this,Jt).at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),r(this,Jt).push({line:a,points:r(this,Se)}),r(this,gs).set(a,0),f(this,Ai,0),this.toSVGPath(),null}getLastElement(){return r(this,Jt).at(-1)}setLastElement(t){return r(this,Jt)?(r(this,Jt).push(t),f(this,Qt,t.line),f(this,Se,t.points),f(this,Ai,0),{path:{d:this.toSVGPath()}}):r(this,lo).setLastElement(t)}removeLastElement(){if(!r(this,Jt))return r(this,lo).removeLastElement();r(this,Jt).pop(),f(this,he,"");for(let t=0,e=r(this,Jt).length;t<e;t++){const{line:i,points:s}=r(this,Jt)[t];f(this,Qt,i),f(this,Se,s),f(this,Ai,0),this.toSVGPath()}return{path:{d:r(this,he)}}}toSVGPath(){const t=H.svgRound(r(this,Qt)[4]),e=H.svgRound(r(this,Qt)[5]);if(r(this,Se).length===2)return f(this,he,"".concat(r(this,he)," M ").concat(t," ").concat(e," Z")),r(this,he);if(r(this,Se).length<=6){const s=r(this,he).lastIndexOf("M");f(this,he,"".concat(r(this,he).slice(0,s)," M ").concat(t," ").concat(e)),f(this,Ai,6)}if(r(this,Se).length===4){const s=H.svgRound(r(this,Qt)[10]),n=H.svgRound(r(this,Qt)[11]);return f(this,he,"".concat(r(this,he)," L ").concat(s," ").concat(n)),f(this,Ai,12),r(this,he)}const i=[];r(this,Ai)===0&&(i.push("M ".concat(t," ").concat(e)),f(this,Ai,6));for(let s=r(this,Ai),n=r(this,Qt).length;s<n;s+=6){const[a,o,l,c,d,u]=r(this,Qt).slice(s,s+6).map(H.svgRound);i.push("C".concat(a," ").concat(o," ").concat(l," ").concat(c," ").concat(d," ").concat(u))}return f(this,he,r(this,he)+i.join(" ")),f(this,Ai,r(this,Qt).length),r(this,he)}getOutlines(t,e,i,s){const n=r(this,Jt).at(-1);return n.line=new Float32Array(n.line),n.points=new Float32Array(n.points),r(this,lo).build(r(this,Jt),t,e,i,r(this,oo),r(this,hh),s),f(this,gs,null),f(this,Qt,null),f(this,Jt,null),f(this,he,null),r(this,lo)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}gs=new WeakMap,Qt=new WeakMap,Jt=new WeakMap,oo=new WeakMap,hh=new WeakMap,Se=new WeakMap,he=new WeakMap,Ai=new WeakMap,lo=new WeakMap,ho=new WeakMap,co=new WeakMap,ch=new WeakSet,Xf=function(t,e){return H._normalizePoint(t,e,r(this,ho),r(this,co),r(this,oo))};var Pe,uu,fu,ei,ps,ms,dh,uh,uo,fe,Rs,t_,e_,i_;class of extends H{constructor(){super(...arguments);m(this,fe);m(this,Pe);m(this,uu,0);m(this,fu);m(this,ei);m(this,ps);m(this,ms);m(this,dh);m(this,uh);m(this,uo)}build(e,i,s,n,a,o,l){f(this,ps,i),f(this,ms,s),f(this,dh,n),f(this,uh,a),f(this,uo,o),f(this,fu,l!=null?l:0),f(this,ei,e),p(this,fe,e_).call(this)}get thickness(){return r(this,uo)}setLastElement(e){return r(this,ei).push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return r(this,ei).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:i}of r(this,ei)){if(e.push("M".concat(H.svgRound(i[4])," ").concat(H.svgRound(i[5]))),i.length===6){e.push("Z");continue}if(i.length===12&&isNaN(i[6])){e.push("L".concat(H.svgRound(i[10])," ").concat(H.svgRound(i[11])));continue}for(let s=6,n=i.length;s<n;s+=6){const[a,o,l,c,d,u]=i.subarray(s,s+6).map(H.svgRound);e.push("C".concat(a," ").concat(o," ").concat(l," ").concat(c," ").concat(d," ").concat(u))}}return e.join("")}serialize([e,i,s,n],a){const o=[],l=[],[c,d,u,g]=p(this,fe,t_).call(this);let b,w,v,A,y,S,_,E,P;switch(r(this,uh)){case 0:P=H._rescale,b=e,w=i+n,v=s,A=-n,y=e+c*s,S=i+(1-d-g)*n,_=e+(c+u)*s,E=i+(1-d)*n;break;case 90:P=H._rescaleAndSwap,b=e,w=i,v=s,A=n,y=e+d*s,S=i+c*n,_=e+(d+g)*s,E=i+(c+u)*n;break;case 180:P=H._rescale,b=e+s,w=i,v=-s,A=n,y=e+(1-c-u)*s,S=i+d*n,_=e+(1-c)*s,E=i+(d+g)*n;break;case 270:P=H._rescaleAndSwap,b=e+s,w=i+n,v=-s,A=-n,y=e+(1-d-g)*s,S=i+(1-c-u)*n,_=e+(1-d)*s,E=i+(1-c)*n;break}for(const{line:x,points:T}of r(this,ei))o.push(P(x,b,w,v,A,a?new Array(x.length):null)),l.push(P(T,b,w,v,A,a?new Array(T.length):null));return{lines:o,points:l,rect:[y,S,_,E]}}static deserialize(e,i,s,n,a,{paths:{lines:o,points:l},rotation:c,thickness:d}){const u=[];let g,b,w,v,A;switch(c){case 0:A=H._rescale,g=-e/s,b=i/n+1,w=1/s,v=-1/n;break;case 90:A=H._rescaleAndSwap,g=-i/n,b=-e/s,w=1/n,v=1/s;break;case 180:A=H._rescale,g=e/s+1,b=-i/n,w=-1/s,v=1/n;break;case 270:A=H._rescaleAndSwap,g=i/n+1,b=e/s+1,w=-1/n,v=-1/s;break}if(!o){o=[];for(const S of l){const _=S.length;if(_===2){o.push(new Float32Array([NaN,NaN,NaN,NaN,S[0],S[1]]));continue}if(_===4){o.push(new Float32Array([NaN,NaN,NaN,NaN,S[0],S[1],NaN,NaN,NaN,NaN,S[2],S[3]]));continue}const E=new Float32Array(3*(_-2));o.push(E);let[P,x,T,I]=S.subarray(0,4);E.set([NaN,NaN,NaN,NaN,P,x],0);for(let C=4;C<_;C+=2){const L=S[C],M=S[C+1];E.set(H.createBezierPoints(P,x,T,I,L,M),(C-2)*3),[P,x,T,I]=[T,I,L,M]}}}for(let S=0,_=o.length;S<_;S++)u.push({line:A(o[S].map(E=>E!=null?E:NaN),g,b,w,v),points:A(l[S].map(E=>E!=null?E:NaN),g,b,w,v)});const y=new this.prototype.constructor;return y.build(u,s,n,1,c,d,a),y}get box(){return r(this,Pe)}updateProperty(e,i){return e==="stroke-width"?p(this,fe,i_).call(this,i):null}updateParentDimensions([e,i],s){const[n,a]=p(this,fe,Rs).call(this);f(this,ps,e),f(this,ms,i),f(this,dh,s);const[o,l]=p(this,fe,Rs).call(this),c=o-n,d=l-a,u=r(this,Pe);return u[0]-=c,u[1]-=d,u[2]+=2*c,u[3]+=2*d,u}updateRotation(e){return f(this,uu,e),{path:{transform:this.rotationTransform}}}get viewBox(){return r(this,Pe).map(H.svgRound).join(" ")}get defaultProperties(){const[e,i]=r(this,Pe);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(H.svgRound(e)," ").concat(H.svgRound(i))}}}get rotationTransform(){const[,,e,i]=r(this,Pe);let s=0,n=0,a=0,o=0,l=0,c=0;switch(r(this,uu)){case 90:n=i/e,a=-e/i,l=e;break;case 180:s=-1,o=-1,l=e,c=i;break;case 270:n=-i/e,a=e/i,c=i;break;default:return""}return"matrix(".concat(s," ").concat(n," ").concat(a," ").concat(o," ").concat(H.svgRound(l)," ").concat(H.svgRound(c),")")}getPathResizingSVGProperties([e,i,s,n]){const[a,o]=p(this,fe,Rs).call(this),[l,c,d,u]=r(this,Pe);if(Math.abs(d-a)<=H.PRECISION||Math.abs(u-o)<=H.PRECISION){const A=e+s/2-(l+d/2),y=i+n/2-(c+u/2);return{path:{"transform-origin":"".concat(H.svgRound(e)," ").concat(H.svgRound(i)),transform:"".concat(this.rotationTransform," translate(").concat(A," ").concat(y,")")}}}const g=(s-2*a)/(d-2*a),b=(n-2*o)/(u-2*o),w=d/s,v=u/n;return{path:{"transform-origin":"".concat(H.svgRound(l)," ").concat(H.svgRound(c)),transform:"".concat(this.rotationTransform," scale(").concat(w," ").concat(v,") ")+"translate(".concat(H.svgRound(a)," ").concat(H.svgRound(o),") scale(").concat(g," ").concat(b,") ")+"translate(".concat(H.svgRound(-a)," ").concat(H.svgRound(-o),")")}}}getPathResizedSVGProperties([e,i,s,n]){const[a,o]=p(this,fe,Rs).call(this),l=r(this,Pe),[c,d,u,g]=l;if(l[0]=e,l[1]=i,l[2]=s,l[3]=n,Math.abs(u-a)<=H.PRECISION||Math.abs(g-o)<=H.PRECISION){const y=e+s/2-(c+u/2),S=i+n/2-(d+g/2);for(const{line:_,points:E}of r(this,ei))H._translate(_,y,S,_),H._translate(E,y,S,E);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(H.svgRound(e)," ").concat(H.svgRound(i)),transform:this.rotationTransform||null,d:this.toSVGPath()}}}const b=(s-2*a)/(u-2*a),w=(n-2*o)/(g-2*o),v=-b*(c+a)+e+a,A=-w*(d+o)+i+o;if(b!==1||w!==1||v!==0||A!==0)for(const{line:y,points:S}of r(this,ei))H._rescale(y,v,A,b,w,y),H._rescale(S,v,A,b,w,S);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(H.svgRound(e)," ").concat(H.svgRound(i)),transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,i],s){const[n,a]=s,o=r(this,Pe),l=e-o[0],c=i-o[1];if(r(this,ps)===n&&r(this,ms)===a)for(const{line:d,points:u}of r(this,ei))H._translate(d,l,c,d),H._translate(u,l,c,u);else{const d=r(this,ps)/n,u=r(this,ms)/a;f(this,ps,n),f(this,ms,a);for(const{line:g,points:b}of r(this,ei))H._rescale(g,l,c,d,u,g),H._rescale(b,l,c,d,u,b);o[2]*=d,o[3]*=u}return o[0]=e,o[1]=i,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":"".concat(H.svgRound(e)," ").concat(H.svgRound(i))}}}get defaultSVGProperties(){const e=r(this,Pe);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":"".concat(H.svgRound(e[0])," ").concat(H.svgRound(e[1])),transform:this.rotationTransform||null},bbox:e}}}Pe=new WeakMap,uu=new WeakMap,fu=new WeakMap,ei=new WeakMap,ps=new WeakMap,ms=new WeakMap,dh=new WeakMap,uh=new WeakMap,uo=new WeakMap,fe=new WeakSet,Rs=function(e=r(this,uo)){const i=r(this,fu)+e/2*r(this,dh);return r(this,uh)%180===0?[i/r(this,ps),i/r(this,ms)]:[i/r(this,ms),i/r(this,ps)]},t_=function(){const[e,i,s,n]=r(this,Pe),[a,o]=p(this,fe,Rs).call(this,0);return[e+a,i+o,s-2*a,n-2*o]},e_=function(){const e=f(this,Pe,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:n}of r(this,ei)){if(n.length<=12){for(let l=4,c=n.length;l<c;l+=6)q.pointBoundingBox(n[l],n[l+1],e);continue}let a=n[4],o=n[5];for(let l=6,c=n.length;l<c;l+=6){const[d,u,g,b,w,v]=n.subarray(l,l+6);q.bezierBoundingBox(a,o,d,u,g,b,w,v,e),a=w,o=v}}const[i,s]=p(this,fe,Rs).call(this);e[0]=Le(e[0]-i,0,1),e[1]=Le(e[1]-s,0,1),e[2]=Le(e[2]+i,0,1),e[3]=Le(e[3]+s,0,1),e[2]-=e[0],e[3]-=e[1]},i_=function(e){const[i,s]=p(this,fe,Rs).call(this);f(this,uo,e);const[n,a]=p(this,fe,Rs).call(this),[o,l]=[n-i,a-s],c=r(this,Pe);return c[0]-=o,c[1]-=l,c[2]+=2*o,c[3]+=2*l,c};class rp extends Q0{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:vt._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){t==="stroke-width"&&(e!=null||(e=this["stroke-width"]),e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){const t=new rp(this._viewParameters);return t.updateAll(this),t}}var Xg,s_;const el=class el extends Pg{constructor(e){super({...e,name:"inkEditor"});m(this,Xg);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,i){vt.initialize(e,i),this._defaultDrawingOptions=new rp(i.viewParameters)}static getDefaultDrawingOptions(e){const i=this._defaultDrawingOptions.clone();return i.updateProperties(e),i}static get supportMultipleDrawings(){return!0}static get typesMap(){return st(this,"typesMap",new Map([[nt.INK_THICKNESS,"stroke-width"],[nt.INK_COLOR,"stroke"],[nt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,i,s,n,a){return new GS(e,i,s,n,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,i,s,n,a,o){return of.deserialize(e,i,s,n,a,o)}static async deserialize(e,i,s){let n=null;if(e instanceof ew){const{data:{inkLists:o,rect:l,rotation:c,id:d,color:u,opacity:g,borderStyle:{rawWidth:b},popupRef:w,contentsObj:v},parent:{page:{pageNumber:A}}}=e;n=e={annotationType:Y.INK,color:Array.from(u),thickness:b,opacity:g,paths:{points:o},boxes:null,pageIndex:A-1,rect:l.slice(0),rotation:c,annotationElementId:d,id:d,deleted:!1,popupRef:w,comment:(v==null?void 0:v.str)||null}}const a=await super.deserialize(e,i,s);return a._initialData=n,e.comment&&a.setCommentData(e.comment),a}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new _g(this)),[["colorPicker",this._colorPicker]]}get colorType(){return nt.INK_COLOR}get colorValue(){return this._drawingOptions.stroke}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:i,parent:s}=this;i.updateSVGProperty("stroke-width"),s.drawLayer.updateProperties(e,i.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:i,opacity:s}){this._drawingOptions=el.getDefaultDrawingOptions({stroke:q.makeHexColor(...e),"stroke-width":i,"stroke-opacity":s})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:i,points:s,rect:n}=this.serializeDraw(e),{_drawingOptions:{stroke:a,"stroke-opacity":o,"stroke-width":l}}=this,c={annotationType:Y.INK,color:vt._colorManager.convert(a),opacity:o,thickness:l,paths:{lines:i,points:s},pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return this.addComment(c),e?(c.isCopy=!0,c):this.annotationElementId&&!p(this,Xg,s_).call(this,c)?null:(c.id=this.annotationElementId,c)}renderAnnotationElement(e){const{points:i,rect:s}=this.serializeDraw(!1),n={rect:s,thickness:this._drawingOptions["stroke-width"],points:i};return this.hasEditedComment&&(n.popup=this.comment),e.updateEdited(n),null}};Xg=new WeakSet,s_=function(e){const{color:i,thickness:s,opacity:n,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((o,l)=>o!==i[l])||e.thickness!==s||e.opacity!==n||e.pageIndex!==a},k(el,"_type","ink"),k(el,"_editorType",Y.INK),k(el,"_defaultDrawingOptions",null);let Hm=el;class jm extends of{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}const pf=8,qh=3;var Zh,fo,dt,$m,Oi,n_,r_,Um,qf,a_,o_,l_,Wm,zm,h_;let Xo=(Zh=class{static extractContoursFromText(t,{fontFamily:e,fontStyle:i,fontWeight:s},n,a,o,l){let c=new OffscreenCanvas(1,1),d=c.getContext("2d",{alpha:!1});const u=200,g=d.font="".concat(i," ").concat(s," ").concat(u,"px ").concat(e),{actualBoundingBoxLeft:b,actualBoundingBoxRight:w,actualBoundingBoxAscent:v,actualBoundingBoxDescent:A,fontBoundingBoxAscent:y,fontBoundingBoxDescent:S,width:_}=d.measureText(t),E=1.5,P=Math.ceil(Math.max(Math.abs(b)+Math.abs(w)||0,_)*E),x=Math.ceil(Math.max(Math.abs(v)+Math.abs(A)||u,Math.abs(y)+Math.abs(S)||u)*E);c=new OffscreenCanvas(P,x),d=c.getContext("2d",{alpha:!0,willReadFrequently:!0}),d.font=g,d.filter="grayscale(1)",d.fillStyle="white",d.fillRect(0,0,P,x),d.fillStyle="black",d.fillText(t,P*(E-1)/2,x*(3-E)/2);const T=p(this,dt,Wm).call(this,d.getImageData(0,0,P,x).data),I=p(this,dt,l_).call(this,T),C=p(this,dt,zm).call(this,I),L=p(this,dt,Um).call(this,T,P,x,C);return this.processDrawnLines({lines:{curves:L,width:P,height:x},pageWidth:n,pageHeight:a,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(t,e,i,s,n){const[a,o,l]=p(this,dt,h_).call(this,t),[c,d]=p(this,dt,o_).call(this,a,o,l,Math.hypot(o,l)*r(this,fo).sigmaSFactor,r(this,fo).sigmaR,r(this,fo).kernelSize),u=p(this,dt,zm).call(this,d),g=p(this,dt,Um).call(this,c,o,l,u);return this.processDrawnLines({lines:{curves:g,width:o,height:l},pageWidth:e,pageHeight:i,rotation:s,innerMargin:n,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:i,rotation:s,innerMargin:n,mustSmooth:a,areContours:o}){var S;s%180!==0&&([e,i]=[i,e]);const{curves:l,width:c,height:d}=t,u=(S=t.thickness)!=null?S:0,g=[],b=Math.min(e/c,i/d),w=b/e,v=b/i,A=[];for(const{points:_}of l){const E=a?p(this,dt,a_).call(this,_):_;if(!E)continue;A.push(E);const P=E.length,x=new Float32Array(P),T=new Float32Array(3*(P===2?2:P-2));if(g.push({line:T,points:x}),P===2){x[0]=E[0]*w,x[1]=E[1]*v,T.set([NaN,NaN,NaN,NaN,x[0],x[1]],0);continue}let[I,C,L,M]=E;I*=w,C*=v,L*=w,M*=v,x.set([I,C,L,M],0),T.set([NaN,NaN,NaN,NaN,I,C],0);for(let G=4;G<P;G+=2){const W=x[G]=E[G]*w,$=x[G+1]=E[G+1]*v;T.set(H.createBezierPoints(I,C,L,M,W,$),(G-2)*3),[I,C,L,M]=[L,M,W,$]}}if(g.length===0)return null;const y=o?new jm:new of;return y.build(g,e,i,1,s,o?0:u,n),{outline:y,newCurves:A,areContours:o,thickness:u,width:c,height:d}}static async compressSignature({outlines:t,areContours:e,thickness:i,width:s,height:n}){let a=1/0,o=-1/0,l=0;for(const _ of t){l+=_.length;for(let E=2,P=_.length;E<P;E++){const x=_[E]-_[E-2];a=Math.min(a,x),o=Math.max(o,x)}}let c;a>=-128&&o<=127?c=Int8Array:a>=-32768&&o<=32767?c=Int16Array:c=Int32Array;const d=t.length,u=pf+qh*d,g=new Uint32Array(u);let b=0;g[b++]=u*Uint32Array.BYTES_PER_ELEMENT+(l-2*d)*c.BYTES_PER_ELEMENT,g[b++]=0,g[b++]=s,g[b++]=n,g[b++]=e?0:1,g[b++]=Math.max(0,Math.floor(i!=null?i:0)),g[b++]=d,g[b++]=c.BYTES_PER_ELEMENT;for(const _ of t)g[b++]=_.length-2,g[b++]=_[0],g[b++]=_[1];const w=new CompressionStream("deflate-raw"),v=w.writable.getWriter();await v.ready,v.write(g);const A=c.prototype.constructor;for(const _ of t){const E=new A(_.length-2);for(let P=2,x=_.length;P<x;P++)E[P-2]=_[P]-_[P-2];v.write(E)}v.close();const y=await new Response(w.readable).arrayBuffer(),S=new Uint8Array(y);return ay(S)}static async decompressSignature(t){try{const e=mE(t),{readable:i,writable:s}=new DecompressionStream("deflate-raw"),n=s.getWriter();await n.ready,n.write(e).then(async()=>{await n.ready,await n.close()}).catch(()=>{});let a=null,o=0;for await(const _ of i)a||(a=new Uint8Array(new Uint32Array(_.buffer,0,4)[0])),a.set(_,o),o+=_.length;const l=new Uint32Array(a.buffer,0,a.length>>2),c=l[1];if(c!==0)throw new Error("Invalid version: ".concat(c));const d=l[2],u=l[3],g=l[4]===0,b=l[5],w=l[6],v=l[7],A=[],y=(pf+qh*w)*Uint32Array.BYTES_PER_ELEMENT;let S;switch(v){case Int8Array.BYTES_PER_ELEMENT:S=new Int8Array(a.buffer,y);break;case Int16Array.BYTES_PER_ELEMENT:S=new Int16Array(a.buffer,y);break;case Int32Array.BYTES_PER_ELEMENT:S=new Int32Array(a.buffer,y);break}o=0;for(let _=0;_<w;_++){const E=l[qh*_+pf],P=new Float32Array(E+2);A.push(P);for(let x=0;x<qh-1;x++)P[x]=l[qh*_+pf+x+1];for(let x=0;x<E;x++)P[x+2]=P[x]+S[o++]}return{areContours:g,thickness:b,outlines:A,width:d,height:u}}catch(e){return Z("decompressSignature: ".concat(e)),null}}},fo=new WeakMap,dt=new WeakSet,$m=function(t,e,i,s){return i-=t,s-=e,i===0?s>0?0:4:i===1?s+6:2-s},Oi=new WeakMap,n_=function(t,e,i,s,n,a,o){const l=p(this,dt,$m).call(this,i,s,n,a);for(let c=0;c<8;c++){const d=(-c+l-o+16)%8,u=r(this,Oi)[2*d],g=r(this,Oi)[2*d+1];if(t[(i+u)*e+(s+g)]!==0)return d}return-1},r_=function(t,e,i,s,n,a,o){const l=p(this,dt,$m).call(this,i,s,n,a);for(let c=0;c<8;c++){const d=(c+l+o+16)%8,u=r(this,Oi)[2*d],g=r(this,Oi)[2*d+1];if(t[(i+u)*e+(s+g)]!==0)return d}return-1},Um=function(t,e,i,s){const n=t.length,a=new Int32Array(n);for(let d=0;d<n;d++)a[d]=t[d]<=s?1:0;for(let d=1;d<i-1;d++)a[d*e]=a[d*e+e-1]=0;for(let d=0;d<e;d++)a[d]=a[e*i-1-d]=0;let o=1,l;const c=[];for(let d=1;d<i-1;d++){l=1;for(let u=1;u<e-1;u++){const g=d*e+u,b=a[g];if(b===0)continue;let w=d,v=u;if(b===1&&a[g-1]===0)o+=1,v-=1;else if(b>=1&&a[g+1]===0)o+=1,v+=1,b>1&&(l=b);else{b!==1&&(l=Math.abs(b));continue}const A=[u,d],y=v===u+1,S={isHole:y,points:A,id:o,parent:0};c.push(S);let _;for(const M of c)if(M.id===l){_=M;break}_?_.isHole?S.parent=y?_.parent:l:S.parent=y?l:_.parent:S.parent=y?l:0;const E=p(this,dt,n_).call(this,a,e,d,u,w,v,0);if(E===-1){a[g]=-o,a[g]!==1&&(l=Math.abs(a[g]));continue}let P=r(this,Oi)[2*E],x=r(this,Oi)[2*E+1];const T=d+P,I=u+x;w=T,v=I;let C=d,L=u;for(;;){const M=p(this,dt,r_).call(this,a,e,C,L,w,v,1);P=r(this,Oi)[2*M],x=r(this,Oi)[2*M+1];const G=C+P,W=L+x;A.push(W,G);const $=C*e+L;if(a[$+1]===0?a[$]=-o:a[$]===1&&(a[$]=o),G===d&&W===u&&C===T&&L===I){a[g]!==1&&(l=Math.abs(a[g]));break}else w=C,v=L,C=G,L=W}}}return c},qf=function(t,e,i,s){if(i-e<=4){for(let T=e;T<i-2;T+=2)s.push(t[T],t[T+1]);return}const n=t[e],a=t[e+1],o=t[i-4]-n,l=t[i-3]-a,c=Math.hypot(o,l),d=o/c,u=l/c,g=d*a-u*n,b=l/o,w=1/c,v=Math.atan(b),A=Math.cos(v),y=Math.sin(v),S=w*(Math.abs(A)+Math.abs(y)),_=w*(1-S+S**2),E=Math.max(Math.atan(Math.abs(y+A)*_),Math.atan(Math.abs(y-A)*_));let P=0,x=e;for(let T=e+2;T<i-2;T+=2){const I=Math.abs(g-d*t[T+1]+u*t[T]);I>P&&(x=T,P=I)}P>(c*E)**2?(p(this,dt,qf).call(this,t,e,x+2,s),p(this,dt,qf).call(this,t,x,i,s)):s.push(n,a)},a_=function(t){const e=[],i=t.length;return p(this,dt,qf).call(this,t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e},o_=function(t,e,i,s,n,a){const o=new Float32Array(a**2),l=-2*s**2,c=a>>1;for(let v=0;v<a;v++){const A=(v-c)**2;for(let y=0;y<a;y++)o[v*a+y]=Math.exp((A+(y-c)**2)/l)}const d=new Float32Array(256),u=-2*n**2;for(let v=0;v<256;v++)d[v]=Math.exp(v**2/u);const g=t.length,b=new Uint8Array(g),w=new Uint32Array(256);for(let v=0;v<i;v++)for(let A=0;A<e;A++){const y=v*e+A,S=t[y];let _=0,E=0;for(let x=0;x<a;x++){const T=v+x-c;if(!(T<0||T>=i))for(let I=0;I<a;I++){const C=A+I-c;if(C<0||C>=e)continue;const L=t[T*e+C],M=o[x*a+I]*d[Math.abs(L-S)];_+=L*M,E+=M}}const P=b[y]=Math.round(_/E);w[P]++}return[b,w]},l_=function(t){const e=new Uint32Array(256);for(const i of t)e[i]++;return e},Wm=function(t){const e=t.length,i=new Uint8ClampedArray(e>>2);let s=-1/0,n=1/0;for(let o=0,l=i.length;o<l;o++){const c=i[o]=t[o<<2];s=Math.max(s,c),n=Math.min(n,c)}const a=255/(s-n);for(let o=0,l=i.length;o<l;o++)i[o]=(i[o]-n)*a;return i},zm=function(t){let e,i=-1/0,s=-1/0;const n=t.findIndex(l=>l!==0);let a=n,o=n;for(e=n;e<256;e++){const l=t[e];l>i&&(e-a>s&&(s=e-a,o=e-1),i=l,a=e)}for(e=o-1;e>=0&&!(t[e]>t[e+1]);e--);return e},h_=function(t){const e=t,{width:i,height:s}=t,{maxDim:n}=r(this,fo);let a=i,o=s;if(i>n||s>n){let g=i,b=s,w=Math.log2(Math.max(i,s)/n);const v=Math.floor(w);w=w===v?v-1:v;for(let y=0;y<w;y++){a=Math.ceil(g/2),o=Math.ceil(b/2);const S=new OffscreenCanvas(a,o);S.getContext("2d").drawImage(t,0,0,g,b,0,0,a,o),g=a,b=o,t!==e&&t.close(),t=S.transferToImageBitmap()}const A=Math.min(n/a,n/o);a=Math.round(a*A),o=Math.round(o*A)}const c=new OffscreenCanvas(a,o).getContext("2d",{willReadFrequently:!0});c.fillStyle="white",c.fillRect(0,0,a,o),c.filter="grayscale(1)",c.drawImage(t,0,0,t.width,t.height,0,0,a,o);const d=c.getImageData(0,0,a,o).data;return[p(this,dt,Wm).call(this,d),a,o]},m(Zh,dt),m(Zh,fo,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),m(Zh,Oi,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1])),Zh);class iw extends Q0{constructor(){super(),super.updateProperties({fill:vt._defaultLineColor,"stroke-width":0})}clone(){const t=new iw;return t.updateAll(this),t}}class sw extends rp{constructor(t){super(t),super.updateProperties({stroke:vt._defaultLineColor,"stroke-width":1})}clone(){const t=new sw(this._viewParameters);return t.updateAll(this),t}}var yr,bs,_r,go;const $e=class $e extends Pg{constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});m(this,yr,!1);m(this,bs,null);m(this,_r,null);m(this,go,null);this._willKeepAspectRatio=!0,f(this,_r,e.signatureData||null),f(this,bs,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,i){vt.initialize(e,i),this._defaultDrawingOptions=new iw,this._defaultDrawnSignatureOptions=new sw(i.viewParameters)}static getDefaultDrawingOptions(e){const i=this._defaultDrawingOptions.clone();return i.updateProperties(e),i}static get supportMultipleDrawings(){return!1}static get typesMap(){return st(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!r(this,bs)}}static computeTelemetryFinalData(e){var s,n;const i=e.get("hasDescription");return{hasAltText:(s=i.get(!0))!=null?s:0,hasNoAltText:(n=i.get(!1))!=null?n:0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,i;const{_isCopy:s}=this;if(s&&(this._isCopy=!1,e=this.x,i=this.y),super.render(),this._drawId===null)if(r(this,_r)){const{lines:n,mustSmooth:a,areContours:o,description:l,uuid:c,heightInPage:d}=r(this,_r),{rawDims:{pageWidth:u,pageHeight:g},rotation:b}=this.parent.viewport,w=Xo.processDrawnLines({lines:n,pageWidth:u,pageHeight:g,rotation:b,innerMargin:$e._INNER_MARGIN,mustSmooth:a,areContours:o});this.addSignature(w,d,l,c)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:r(this,bs)||""}));return s&&(this._isCopy=!0,this._moveAfterPaste(e,i)),this.div}setUuid(e){f(this,go,e),this.addEditToolbar()}getUuid(){return r(this,go)}get description(){return r(this,bs)}set description(e){f(this,bs,e),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:e})),super.addEditToolbar().then(i=>{i==null||i.updateEditSignatureButton(e)}))}getSignaturePreview(){const{newCurves:e,areContours:i,thickness:s,width:n,height:a}=r(this,_r),o=Math.max(n,a),l=Xo.processDrawnLines({lines:{curves:e.map(c=>({points:c})),thickness:s,width:n,height:a},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:i});return{areContours:i,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,i,s,n){const{x:a,y:o}=this,{outline:l}=f(this,_r,e);f(this,yr,l instanceof jm),this.description=s;let c;r(this,yr)?c=$e.getDefaultDrawingOptions():(c=$e._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:c});const[d,u]=this.parentDimensions,[,g]=this.pageDimensions;let b=i/g;b=b>=1?.5:b,this.width*=b/this.height,this.width>=1&&(b*=.9/this.width,this.width=.9),this.height=b,this.setDims(d*this.width,u*this.height),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(n),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!n,hasDescription:!!s}}),this.div.hidden=!1}getFromImage(e){const{rawDims:{pageWidth:i,pageHeight:s},rotation:n}=this.parent.viewport;return Xo.process(e,i,s,n,$e._INNER_MARGIN)}getFromText(e,i){const{rawDims:{pageWidth:s,pageHeight:n},rotation:a}=this.parent.viewport;return Xo.extractContoursFromText(e,i,s,n,a,$e._INNER_MARGIN)}getDrawnSignature(e){const{rawDims:{pageWidth:i,pageHeight:s},rotation:n}=this.parent.viewport;return Xo.processDrawnLines({lines:e,pageWidth:i,pageHeight:s,rotation:n,innerMargin:$e._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:i}){e?this._drawingOptions=$e.getDefaultDrawingOptions():(this._drawingOptions=$e._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":i}))}serialize(e=!1){if(this.isEmpty())return null;const{lines:i,points:s,rect:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":a}}=this,o={annotationType:Y.SIGNATURE,isSignature:!0,areContours:r(this,yr),color:[0,0,0],thickness:r(this,yr)?0:a,pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return this.addComment(o),e?(o.paths={lines:i,points:s},o.uuid=r(this,go),o.isCopy=!0):o.lines=i,r(this,bs)&&(o.accessibilityData={type:"Figure",alt:r(this,bs)}),o}static deserializeDraw(e,i,s,n,a,o){return o.areContours?jm.deserialize(e,i,s,n,a,o):of.deserialize(e,i,s,n,a,o)}static async deserialize(e,i,s){var a;const n=await super.deserialize(e,i,s);return f(n,yr,e.areContours),n.description=((a=e.accessibilityData)==null?void 0:a.alt)||"",f(n,go,e.uuid),n}};yr=new WeakMap,bs=new WeakMap,_r=new WeakMap,go=new WeakMap,k($e,"_type","signature"),k($e,"_editorType",Y.SIGNATURE),k($e,"_defaultDrawingOptions",null);let Gm=$e;var Et,te,Ar,cn,Er,fh,dn,po,ws,ii,gh,ot,pc,mc,Yf,Kf,Zf,qm,Qf,c_;class Xm extends vt{constructor(e){super({...e,name:"stampEditor"});m(this,ot);m(this,Et,null);m(this,te,null);m(this,Ar,null);m(this,cn,null);m(this,Er,null);m(this,fh,"");m(this,dn,null);m(this,po,!1);m(this,ws,null);m(this,ii,!1);m(this,gh,!1);f(this,cn,e.bitmapUrl),f(this,Er,e.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,i){vt.initialize(e,i)}static isHandlingMimeForPasting(e){return Vp.includes(e)}static paste(e,i){i.pasteEditor({mode:Y.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){var s,n;const i=e.get("hasAltText");return{hasAltText:(s=i.get(!0))!=null?s:0,hasNoAltText:(n=i.get(!1))!=null?n:0}}async mlGuessAltText(e=null,i=!0){if(this.hasAltTextData())return null;const{mlManager:s}=this._uiManager;if(!s)throw new Error("No ML.");if(!await s.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,l=await s.guess({name:"altText",request:{data:n,width:a,height:o,channels:n.length/(a*o)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const c=l.output;return await this.setGuessedAltText(c),i&&!this.hasAltTextData()&&(this.altTextData={alt:c,decorative:!1}),c}remove(){var e;r(this,te)&&(f(this,Et,null),this._uiManager.imageManager.deleteId(r(this,te)),(e=r(this,dn))==null||e.remove(),f(this,dn,null),r(this,ws)&&(clearTimeout(r(this,ws)),f(this,ws,null))),super.remove()}rebuild(){if(!this.parent){r(this,te)&&p(this,ot,Yf).call(this);return}super.rebuild(),this.div!==null&&(r(this,te)&&r(this,dn)===null&&p(this,ot,Yf).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(r(this,Ar)||r(this,Et)||r(this,cn)||r(this,Er)||r(this,te)||r(this,po))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,i;return this._isCopy&&(e=this.x,i=this.y),super.render(),this.div.hidden=!0,this.createAltText(),r(this,po)||(r(this,Et)?p(this,ot,Kf).call(this):p(this,ot,Yf).call(this)),this._isCopy&&this._moveAfterPaste(e,i),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,i){const{id:s,bitmap:n}=this._uiManager.imageManager.getFromCanvas(e,i);i.remove(),s&&this._uiManager.imageManager.isValidId(s)&&(f(this,te,s),n&&f(this,Et,n),f(this,po,!1),p(this,ot,Kf).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;r(this,ws)!==null&&clearTimeout(r(this,ws)),f(this,ws,setTimeout(()=>{f(this,ws,null),p(this,ot,qm).call(this)},200))}copyCanvas(e,i,s=!1){var b;e||(e=224);const{width:n,height:a}=r(this,Et),o=new ko;let l=r(this,Et),c=n,d=a,u=null;if(i){if(n>i||a>i){const I=Math.min(i/n,i/a);c=Math.floor(n*I),d=Math.floor(a*I)}u=document.createElement("canvas");const w=u.width=Math.ceil(c*o.sx),v=u.height=Math.ceil(d*o.sy);r(this,ii)||(l=p(this,ot,Zf).call(this,w,v));const A=u.getContext("2d");A.filter=this._uiManager.hcmFilter;let y="white",S="#cfcfd8";this._uiManager.hcmFilter!=="none"?S="black":(b=window.matchMedia)!=null&&b.call(window,"(prefers-color-scheme: dark)").matches&&(y="#8f8f9d",S="#42414d");const _=15,E=_*o.sx,P=_*o.sy,x=new OffscreenCanvas(E*2,P*2),T=x.getContext("2d");T.fillStyle=y,T.fillRect(0,0,E*2,P*2),T.fillStyle=S,T.fillRect(0,0,E,P),T.fillRect(E,P,E,P),A.fillStyle=A.createPattern(x,"repeat"),A.fillRect(0,0,w,v),A.drawImage(l,0,0,l.width,l.height,0,0,w,v)}let g=null;if(s){let w,v;if(o.symmetric&&l.width<e&&l.height<e)w=l.width,v=l.height;else if(l=r(this,Et),n>e||a>e){const S=Math.min(e/n,e/a);w=Math.floor(n*S),v=Math.floor(a*S),r(this,ii)||(l=p(this,ot,Zf).call(this,w,v))}const y=new OffscreenCanvas(w,v).getContext("2d",{willReadFrequently:!0});y.drawImage(l,0,0,l.width,l.height,0,0,w,v),g={width:w,height:v,data:y.getImageData(0,0,w,v).data}}return{canvas:u,width:c,height:d,imageData:g}}static async deserialize(e,i,s){var A;let n=null,a=!1;if(e instanceof x0){const{data:{rect:y,rotation:S,id:_,structParent:E,popupRef:P,contentsObj:x},container:T,parent:{page:{pageNumber:I}},canvas:C}=e;let L,M;C?(delete e.canvas,{id:L,bitmap:M}=s.imageManager.getFromCanvas(T.id,C),C.remove()):(a=!0,e._hasNoCanvas=!0);const G=((A=await i._structTree.getAriaAttributes("".concat(Yb).concat(_)))==null?void 0:A.get("aria-label"))||"";n=e={annotationType:Y.STAMP,bitmapId:L,bitmap:M,pageIndex:I-1,rect:y.slice(0),rotation:S,annotationElementId:_,id:_,deleted:!1,accessibilityData:{decorative:!1,altText:G},isSvg:!1,structParent:E,popupRef:P,comment:(x==null?void 0:x.str)||null}}const o=await super.deserialize(e,i,s),{rect:l,bitmap:c,bitmapUrl:d,bitmapId:u,isSvg:g,accessibilityData:b}=e;a?(s.addMissingCanvas(e.id,o),f(o,po,!0)):u&&s.imageManager.isValidId(u)?(f(o,te,u),c&&f(o,Et,c)):f(o,cn,d),f(o,ii,g);const[w,v]=o.pageDimensions;return o.width=(l[2]-l[0])/w,o.height=(l[3]-l[1])/v,b&&(o.altTextData=b),o._initialData=n,e.comment&&o.setCommentData(e.comment),f(o,gh,!!n),o}serialize(e=!1,i=null){var l;if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s={annotationType:Y.STAMP,bitmapId:r(this,te),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:r(this,ii),structTreeParentId:this._structTreeParentId};if(this.addComment(s),e)return s.bitmapUrl=p(this,ot,Qf).call(this,!0),s.accessibilityData=this.serializeAltText(!0),s.isCopy=!0,s;const{decorative:n,altText:a}=this.serializeAltText(!1);if(!n&&a&&(s.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const c=p(this,ot,c_).call(this,s);if(c.isSame)return null;c.isSameAltText?delete s.accessibilityData:s.accessibilityData.structParent=(l=this._initialData.structParent)!=null?l:-1}if(s.id=this.annotationElementId,i===null)return s;i.stamps||(i.stamps=new Map);const o=r(this,ii)?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(!i.stamps.has(r(this,te)))i.stamps.set(r(this,te),{area:o,serialized:s}),s.bitmap=p(this,ot,Qf).call(this,!1);else if(r(this,ii)){const c=i.stamps.get(r(this,te));o>c.area&&(c.area=o,c.serialized.bitmap.close(),c.serialized.bitmap=p(this,ot,Qf).call(this,!1))}return s}renderAnnotationElement(e){const i={rect:this.getRect(0,0)};return this.hasEditedComment&&(i.popup=this.comment),e.updateEdited(i),null}}Et=new WeakMap,te=new WeakMap,Ar=new WeakMap,cn=new WeakMap,Er=new WeakMap,fh=new WeakMap,dn=new WeakMap,po=new WeakMap,ws=new WeakMap,ii=new WeakMap,gh=new WeakMap,ot=new WeakSet,pc=function(e,i=!1){if(!e){this.remove();return}f(this,Et,e.bitmap),i||(f(this,te,e.id),f(this,ii,e.isSvg)),e.file&&f(this,fh,e.file.name),p(this,ot,Kf).call(this)},mc=function(){if(f(this,Ar,null),this._uiManager.enableWaiting(!1),!!r(this,dn)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Et)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Et)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch(e){}}this.div.focus()}},Yf=function(){if(r(this,te)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(r(this,te)).then(s=>p(this,ot,pc).call(this,s,!0)).finally(()=>p(this,ot,mc).call(this));return}if(r(this,cn)){const s=r(this,cn);f(this,cn,null),this._uiManager.enableWaiting(!0),f(this,Ar,this._uiManager.imageManager.getFromUrl(s).then(n=>p(this,ot,pc).call(this,n)).finally(()=>p(this,ot,mc).call(this)));return}if(r(this,Er)){const s=r(this,Er);f(this,Er,null),this._uiManager.enableWaiting(!0),f(this,Ar,this._uiManager.imageManager.getFromFile(s).then(n=>p(this,ot,pc).call(this,n)).finally(()=>p(this,ot,mc).call(this)));return}const e=document.createElement("input");e.type="file",e.accept=Vp.join(",");const i=this._uiManager._signal;f(this,Ar,new Promise(s=>{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}}),p(this,ot,pc).call(this,n)}s()},{signal:i}),e.addEventListener("cancel",()=>{this.remove(),s()},{signal:i})}).finally(()=>p(this,ot,mc).call(this))),e.click()},Kf=function(){var u;const{div:e}=this;let{width:i,height:s}=r(this,Et);const[n,a]=this.pageDimensions,o=.75;if(this.width)i=this.width*n,s=this.height*a;else if(i>o*n||s>o*a){const g=Math.min(o*n/i,o*a/s);i*=g,s*=g}const[l,c]=this.parentDimensions;this.setDims(i*l/n,s*c/a),this._uiManager.enableWaiting(!1);const d=f(this,dn,document.createElement("canvas"));d.setAttribute("role","img"),this.addContainer(d),this.width=i/n,this.height=s/a,(u=this._initialOptions)!=null&&u.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),p(this,ot,qm).call(this),r(this,gh)||(this.parent.addUndoableEditor(this),f(this,gh,!0)),this._reportTelemetry({action:"inserted_image"}),r(this,fh)&&this.div.setAttribute("aria-description",r(this,fh)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},Zf=function(e,i){const{width:s,height:n}=r(this,Et);let a=s,o=n,l=r(this,Et);for(;a>2*e||o>2*i;){const c=a,d=o;a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),o>2*i&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const u=new OffscreenCanvas(a,o);u.getContext("2d").drawImage(l,0,0,c,d,0,0,a,o),l=u.transferToImageBitmap()}return l},qm=function(){const[e,i]=this.parentDimensions,{width:s,height:n}=this,a=new ko,o=Math.ceil(s*e*a.sx),l=Math.ceil(n*i*a.sy),c=r(this,dn);if(!c||c.width===o&&c.height===l)return;c.width=o,c.height=l;const d=r(this,ii)?r(this,Et):p(this,ot,Zf).call(this,o,l),u=c.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(d,0,0,d.width,d.height,0,0,o,l)},Qf=function(e){if(e){if(r(this,ii)){const n=this._uiManager.imageManager.getSvgUrl(r(this,te));if(n)return n}const i=document.createElement("canvas");return{width:i.width,height:i.height}=r(this,Et),i.getContext("2d").drawImage(r(this,Et),0,0),i.toDataURL()}if(r(this,ii)){const[i,s]=this.pageDimensions,n=Math.round(this.width*i*Yr.PDF_TO_CSS_UNITS),a=Math.round(this.height*s*Yr.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(n,a);return o.getContext("2d").drawImage(r(this,Et),0,0,r(this,Et).width,r(this,Et).height,0,0,n,a),o.transferToImageBitmap()}return structuredClone(r(this,Et))},c_=function(e){var o;const{pageIndex:i,accessibilityData:{altText:s}}=this._initialData,n=e.pageIndex===i,a=(((o=e.accessibilityData)==null?void 0:o.alt)||"")===s;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&n&&a,isSameAltText:a}},k(Xm,"_type","stamp"),k(Xm,"_editorType",Y.STAMP);var mo,ph,vs,Sr,un,si,Pr,mh,bo,Bi,fn,ee,gn,xr,bh,z,He,Cr,Pt,d_,Zi,Ym,Km,Jf;let XS=(He=class{constructor({uiManager:t,pageIndex:e,div:i,structTreeLayer:s,accessibilityManager:n,annotationLayer:a,drawLayer:o,textLayer:l,viewport:c,l10n:d}){m(this,Pt);m(this,mo);m(this,ph,!1);m(this,vs,null);m(this,Sr,null);m(this,un,null);m(this,si,new Map);m(this,Pr,!1);m(this,mh,!1);m(this,bo,!1);m(this,Bi,null);m(this,fn,null);m(this,ee,null);m(this,gn,null);m(this,xr,null);m(this,bh,-1);m(this,z);const u=[...r(He,Cr).values()];if(!He._initialized){He._initialized=!0;for(const g of u)g.initialize(d,t)}t.registerEditorTypes(u),f(this,z,t),this.pageIndex=e,this.div=i,f(this,mo,n),f(this,vs,a),this.viewport=c,f(this,ee,l),this.drawLayer=o,this._structTree=s,r(this,z).addLayer(this)}get isEmpty(){return r(this,si).size===0}get isInvisible(){return this.isEmpty&&r(this,z).getMode()===Y.NONE}updateToolbar(t){r(this,z).updateToolbar(t)}updateMode(t=r(this,z).getMode()){switch(p(this,Pt,Jf).call(this),t){case Y.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Y.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Y.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 i of r(He,Cr).values())e.toggle("".concat(i._type,"Editing"),t===i._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===((e=r(this,ee))==null?void 0:e.div)}setEditingState(t){r(this,z).setEditingState(t)}addCommands(t){r(this,z).addCommands(t)}cleanUndoStack(t){r(this,z).cleanUndoStack(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,vs))==null||e.div.classList.toggle("disabled",!t)}async enable(){var i;f(this,bo,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),(i=r(this,xr))==null||i.abort(),f(this,xr,null);const t=new Set;for(const s of r(this,si).values())s.enableEditing(),s.show(!0),s.annotationElementId&&(r(this,z).removeChangedExistingAnnotation(s),t.add(s.annotationElementId));if(!r(this,vs)){f(this,bo,!1);return}const e=r(this,vs).getEditableAnnotations();for(const s of e){if(s.hide(),r(this,z).isDeletedAnnotationElement(s.data.id)||t.has(s.data.id))continue;const n=await this.deserialize(s);n&&(this.addOrRebuild(n),n.enableEditing())}f(this,bo,!1)}disable(){var s;if(f(this,mh,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),r(this,ee)&&!r(this,xr)){f(this,xr,new AbortController);const n=r(this,z).combinedSignal(r(this,xr));r(this,ee).div.addEventListener("pointerdown",a=>{const{clientX:l,clientY:c,timeStamp:d}=a,u=r(this,bh);if(d-u>500){f(this,bh,d);return}f(this,bh,-1);const{classList:g}=this.div;g.toggle("getElements",!0);const b=document.elementsFromPoint(l,c);if(g.toggle("getElements",!1),!this.div.contains(b[0]))return;let w;const v=new RegExp("^".concat(ey,"[0-9]+$"));for(const y of b)if(v.test(y.id)){w=y.id;break}if(!w)return;const A=r(this,si).get(w);(A==null?void 0:A.annotationElementId)===null&&(a.stopPropagation(),a.preventDefault(),A.dblclick())},{signal:n,capture:!0})}const t=new Map,e=new Map;for(const n of r(this,si).values())if(n.disableEditing(),!!n.annotationElementId){if(n.serialize()!==null){t.set(n.annotationElementId,n);continue}else e.set(n.annotationElementId,n);(s=this.getEditableAnnotation(n.annotationElementId))==null||s.show(),n.remove()}if(r(this,vs)){const n=r(this,vs).getEditableAnnotations();for(const a of n){const{id:o}=a.data;if(r(this,z).isDeletedAnnotationElement(o)){a.updateEdited({deleted:!0});continue}let l=e.get(o);if(l){l.resetAnnotationElement(a),l.show(!1),a.show();continue}l=t.get(o),l&&(r(this,z).addChangedExistingAnnotation(l),l.renderAnnotationElement(a)&&l.show(!1)),a.show()}}p(this,Pt,Jf).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:i}=this.div;for(const n of r(He,Cr).values())i.remove("".concat(n._type,"Editing"));this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),f(this,mh,!1)}getEditableAnnotation(t){var e;return((e=r(this,vs))==null?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){r(this,z).getActive()!==t&&r(this,z).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(t=r(this,ee))!=null&&t.div&&!r(this,gn)){f(this,gn,new AbortController);const e=r(this,z).combinedSignal(r(this,gn));r(this,ee).div.addEventListener("pointerdown",p(this,Pt,d_).bind(this),{signal:e}),r(this,ee).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(t=r(this,ee))!=null&&t.div&&r(this,gn)&&(r(this,gn).abort(),f(this,gn,null),r(this,ee).div.classList.remove("highlighting"))}enableClick(){if(r(this,Sr))return;f(this,Sr,new AbortController);const t=r(this,z).combinedSignal(r(this,Sr));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});const e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){var t;(t=r(this,Sr))==null||t.abort(),f(this,Sr,null)}attach(t){r(this,si).set(t.id,t);const{annotationElementId:e}=t;e&&r(this,z).isDeletedAnnotationElement(e)&&r(this,z).removeDeletedAnnotationElement(t)}detach(t){var e;r(this,si).delete(t.id),(e=r(this,mo))==null||e.removePointerInTextLayer(t.contentDiv),!r(this,mh)&&t.annotationElementId&&r(this,z).addDeletedAnnotationElement(t)}remove(t){this.detach(t),r(this,z).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(r(this,z).addDeletedAnnotationElement(t.annotationElementId),vt.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,z).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!r(this,bo)),r(this,z).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var i;if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!r(this,un)&&(t._focusEventsAllowed=!1,f(this,un,setTimeout(()=>{f(this,un,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:r(this,z)._signal}),e.focus())},0))),t._structTreeParentId=(i=r(this,mo))==null?void 0:i.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),i=()=>{t.remove()};this.addCommands({cmd:e,undo:i,mustExec:!1})}getNextId(){return r(this,z).getId()}combinedSignal(t){return r(this,z).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return(t=r(this,Pt,Zi))==null?void 0:t.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await r(this,z).updateMode(t.mode);const{offsetX:i,offsetY:s}=p(this,Pt,Km).call(this),n=this.getNextId(),a=p(this,Pt,Ym).call(this,{parent:this,id:n,x:i,y:s,uiManager:r(this,z),isCentered:!0,...e});a&&this.add(a)}async deserialize(t){var e,i;return await((i=r(He,Cr).get((e=t.annotationType)!=null?e:t.annotationEditorType))==null?void 0:i.deserialize(t,this,r(this,z)))||null}createAndAddNewEditor(t,e,i={}){const s=this.getNextId(),n=p(this,Pt,Ym).call(this,{parent:this,id:s,x:t.offsetX,y:t.offsetY,uiManager:r(this,z),isCentered:e,...i});return n&&this.add(n),n}addNewEditor(t={}){this.createAndAddNewEditor(p(this,Pt,Km).call(this),!0,t)}setSelected(t){r(this,z).setSelected(t)}toggleSelected(t){r(this,z).toggleSelected(t)}unselect(t){r(this,z).unselect(t)}pointerup(t){var s;const{isMac:e}=pe.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!r(this,Pr)||(f(this,Pr,!1),(s=r(this,Pt,Zi))!=null&&s.isDrawer&&r(this,Pt,Zi).supportMultipleDrawings))return;if(!r(this,ph)){f(this,ph,!0);return}const i=r(this,z).getMode();if(i===Y.STAMP||i===Y.SIGNATURE){r(this,z).unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){var s;if(r(this,z).getMode()===Y.HIGHLIGHT&&this.enableTextSelection(),r(this,Pr)){f(this,Pr,!1);return}const{isMac:e}=pe.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(f(this,Pr,!0),(s=r(this,Pt,Zi))!=null&&s.isDrawer){this.startDrawingSession(t);return}const i=r(this,z).getActive();f(this,ph,!i||i.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),r(this,Bi)){r(this,Pt,Zi).startDrawing(this,r(this,z),!1,t);return}r(this,z).setCurrentDrawingSession(this),f(this,Bi,new AbortController);const e=r(this,z).combinedSignal(r(this,Bi));this.div.addEventListener("blur",({relatedTarget:i})=>{i&&!this.div.contains(i)&&(f(this,fn,null),this.commitOrRemove())},{signal:e}),r(this,Pt,Zi).startDrawing(this,r(this,z),!1,t)}pause(t){if(t){const{activeElement:e}=document;this.div.contains(e)&&f(this,fn,e);return}r(this,fn)&&setTimeout(()=>{var e;(e=r(this,fn))==null||e.focus(),f(this,fn,null)},0)}endDrawingSession(t=!1){return r(this,Bi)?(r(this,z).setCurrentDrawingSession(null),r(this,Bi).abort(),f(this,Bi,null),f(this,fn,null),r(this,Pt,Zi).endDrawing(t)):null}findNewParent(t,e,i){const s=r(this,z).findParent(e,i);return s===null||s===this?!1:(s.changeParent(t),!0)}commitOrRemove(){return r(this,Bi)?(this.endDrawingSession(),!0):!1}onScaleChanging(){r(this,Bi)&&r(this,Pt,Zi).onScaleChangingWhenDrawing(this)}destroy(){var t,e;this.commitOrRemove(),((t=r(this,z).getActive())==null?void 0:t.parent)===this&&(r(this,z).commitOrRemove(),r(this,z).setActiveEditor(null)),r(this,un)&&(clearTimeout(r(this,un)),f(this,un,null));for(const i of r(this,si).values())(e=r(this,mo))==null||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove();this.div=null,r(this,si).clear(),r(this,z).removeLayer(this)}render({viewport:t}){this.viewport=t,Mo(this.div,t);for(const e of r(this,z).getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){r(this,z).commitOrRemove(),p(this,Pt,Jf).call(this);const e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,Mo(this.div,{rotation:i}),e!==i)for(const s of r(this,si).values())s.rotate(i)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return r(this,z).viewParameters.realScale}},mo=new WeakMap,ph=new WeakMap,vs=new WeakMap,Sr=new WeakMap,un=new WeakMap,si=new WeakMap,Pr=new WeakMap,mh=new WeakMap,bo=new WeakMap,Bi=new WeakMap,fn=new WeakMap,ee=new WeakMap,gn=new WeakMap,xr=new WeakMap,bh=new WeakMap,z=new WeakMap,Cr=new WeakMap,Pt=new WeakSet,d_=function(t){r(this,z).unselectAll();const{target:e}=t;if(e===r(this,ee).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&r(this,ee).div.contains(e)){const{isMac:i}=pe.platform;if(t.button!==0||t.ctrlKey&&i)return;r(this,z).showAllEditors("highlight",!0,!0),r(this,ee).div.classList.add("free"),this.toggleDrawing(),Sg.startHighlighting(this,r(this,z).direction==="ltr",{target:r(this,ee).div,x:t.x,y:t.y}),r(this,ee).div.addEventListener("pointerup",()=>{r(this,ee).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:r(this,z)._signal}),t.preventDefault()}},Zi=function(){return r(He,Cr).get(r(this,z).getMode())},Ym=function(t){const e=r(this,Pt,Zi);return e?new e.prototype.constructor(t):null},Km=function(){const{x:t,y:e,width:i,height:s}=this.div.getBoundingClientRect(),n=Math.max(0,t),a=Math.max(0,e),o=Math.min(window.innerWidth,t+i),l=Math.min(window.innerHeight,e+s),c=(n+o)/2-t,d=(a+l)/2-e,[u,g]=this.viewport.rotation%180===0?[c,d]:[d,c];return{offsetX:u,offsetY:g}},Jf=function(){for(const t of r(this,si).values())t.isEmpty()&&t.remove()},k(He,"_initialized",!1),m(He,Cr,new Map([Lm,Hm,Xm,Sg,Gm].map(t=>[t._editorType,t]))),He);var Vi,xe,wo,Rt,gu,qg,u_,xs,Zm,f_,Qm;let qS=(Rt=class{constructor({pageIndex:t}){m(this,xs);m(this,Vi,null);m(this,xe,new Map);m(this,wo,new Map);this.pageIndex=t}setParent(t){if(!r(this,Vi)){f(this,Vi,t);return}if(r(this,Vi)!==t){if(r(this,xe).size>0)for(const e of r(this,xe).values())e.remove(),t.append(e);f(this,Vi,t)}}static get _svgFactory(){return st(this,"_svgFactory",new Ag)}draw(t,e=!1,i=!1){const s=se(Rt,gu)._++,n=p(this,xs,Zm).call(this),a=Rt._svgFactory.createElement("defs");n.append(a);const o=Rt._svgFactory.createElement("path");a.append(o);const l="path_p".concat(this.pageIndex,"_").concat(s);o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),e&&r(this,wo).set(s,o);const c=i?p(this,xs,f_).call(this,a,l):null,d=Rt._svgFactory.createElement("use");return n.append(d),d.setAttribute("href","#".concat(l)),this.updateProperties(n,t),r(this,xe).set(s,n),{id:s,clipPathId:"url(#".concat(c,")")}}drawOutline(t,e){const i=se(Rt,gu)._++,s=p(this,xs,Zm).call(this),n=Rt._svgFactory.createElement("defs");s.append(n);const a=Rt._svgFactory.createElement("path");n.append(a);const o="path_p".concat(this.pageIndex,"_").concat(i);a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke");let l;if(e){const u=Rt._svgFactory.createElement("mask");n.append(u),l="mask_p".concat(this.pageIndex,"_").concat(i),u.setAttribute("id",l),u.setAttribute("maskUnits","objectBoundingBox");const g=Rt._svgFactory.createElement("rect");u.append(g),g.setAttribute("width","1"),g.setAttribute("height","1"),g.setAttribute("fill","white");const b=Rt._svgFactory.createElement("use");u.append(b),b.setAttribute("href","#".concat(o)),b.setAttribute("stroke","none"),b.setAttribute("fill","black"),b.setAttribute("fill-rule","nonzero"),b.classList.add("mask")}const c=Rt._svgFactory.createElement("use");s.append(c),c.setAttribute("href","#".concat(o)),l&&c.setAttribute("mask","url(#".concat(l,")"));const d=c.cloneNode();return s.append(d),c.classList.add("mainOutline"),d.classList.add("secondaryOutline"),this.updateProperties(s,t),r(this,xe).set(i,s),i}finalizeDraw(t,e){r(this,wo).delete(t),this.updateProperties(t,e)}updateProperties(t,e){var l;if(!e)return;const{root:i,bbox:s,rootClass:n,path:a}=e,o=typeof t=="number"?r(this,xe).get(t):t;if(o){if(i&&p(this,xs,Qm).call(this,o,i),s&&p(l=Rt,qg,u_).call(l,o,s),n){const{classList:c}=o;for(const[d,u]of Object.entries(n))c.toggle(d,u)}if(a){const d=o.firstChild.firstChild;p(this,xs,Qm).call(this,d,a)}}}updateParent(t,e){if(e===this)return;const i=r(this,xe).get(t);i&&(r(e,Vi).append(i),r(this,xe).delete(t),r(e,xe).set(t,i))}remove(t){r(this,wo).delete(t),r(this,Vi)!==null&&(r(this,xe).get(t).remove(),r(this,xe).delete(t))}destroy(){f(this,Vi,null);for(const t of r(this,xe).values())t.remove();r(this,xe).clear(),r(this,wo).clear()}},Vi=new WeakMap,xe=new WeakMap,wo=new WeakMap,gu=new WeakMap,qg=new WeakSet,u_=function(t,[e,i,s,n]){const{style:a}=t;a.top="".concat(100*i,"%"),a.left="".concat(100*e,"%"),a.width="".concat(100*s,"%"),a.height="".concat(100*n,"%")},xs=new WeakSet,Zm=function(){const t=Rt._svgFactory.create(1,1,!0);return r(this,Vi).append(t),t.setAttribute("aria-hidden",!0),t},f_=function(t,e){const i=Rt._svgFactory.createElement("clipPath");t.append(i);const s="clip_".concat(e);i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");const n=Rt._svgFactory.createElement("use");return i.append(n),n.setAttribute("href","#".concat(e)),n.classList.add("clip"),s},Qm=function(t,e){for(const[i,s]of Object.entries(e))s===null?t.removeAttribute(i):t.setAttribute(i,s)},m(Rt,qg),m(Rt,gu,0),Rt);globalThis._pdfjsTestingUtils={HighlightOutliner:Mm};globalThis.pdfjsLib={AbortException:qr,AnnotationEditorLayer:XS,AnnotationEditorParamsType:nt,AnnotationEditorType:Y,AnnotationEditorUIManager:Nc,AnnotationLayer:US,AnnotationMode:Ps,AnnotationType:Bt,build:ES,ColorPicker:f0,createValidAbsoluteUrl:iy,DOMSVGFactory:Ag,DrawLayer:qS,FeatureTest:pe,fetchData:sf,getDocument:h0,getFilenameFromUrl:bE,getPdfFilenameFromUrl:oy,getRGB:sp,getUuid:ry,getXfaPageViewport:ly,GlobalWorkerOptions:Vn,ImageKind:Ef,InvalidPDFException:Fp,isDataScheme:ip,isPdfFile:Kb,isValidExplicitDest:IE,MathClamp:Le,noContextMenu:Ci,normalizeUnicode:gE,OPS:wg,OutputScale:ko,PasswordResponses:rE,PDFDataRangeTransport:c0,PDFDateString:Dc,PDFWorker:bm,PermissionFlag:nE,PixelsPerInch:Yr,RenderingCancelledException:Uh,ResponseException:vg,setLayerDimensions:Mo,shadow:st,SignatureExtractor:Xo,stopEvent:Vt,SupportedImageMimeTypes:Vp,TextLayer:fm,TouchManager:Cy,updateUrlHash:sy,Util:q,VerbosityLevel:Jg,version:AS,XfaLayer:p0};const{AbortException:YS,AnnotationEditorLayer:KS,AnnotationEditorParamsType:fT,AnnotationEditorType:je,AnnotationEditorUIManager:ZS,AnnotationLayer:QS,AnnotationMode:Sn,AnnotationType:g_,build:gT,ColorPicker:pT,createValidAbsoluteUrl:p_,DOMSVGFactory:mT,DrawLayer:JS,FeatureTest:tP,fetchData:Uw,getDocument:bT,getFilenameFromUrl:wT,getPdfFilenameFromUrl:eP,getRGB:vT,getUuid:yT,getXfaPageViewport:_T,GlobalWorkerOptions:AT,ImageKind:ET,InvalidPDFException:ST,isDataScheme:PT,isPdfFile:iP,isValidExplicitDest:sP,MathClamp:m_,noContextMenu:xT,normalizeUnicode:nP,OPS:CT,OutputScale:tg,PasswordResponses:TT,PDFDataRangeTransport:IT,PDFDateString:LT,PDFWorker:RT,PermissionFlag:mf,PixelsPerInch:Ns,RenderingCancelledException:Jm,ResponseException:MT,setLayerDimensions:b_,shadow:xg,SignatureExtractor:kT,stopEvent:tb,SupportedImageMimeTypes:DT,TextLayer:rP,TouchManager:NT,updateUrlHash:aP,Util:nw,VerbosityLevel:FT,version:Ww,XfaLayer:yp}=globalThis.pdfjsLib,oP="auto",w_=1,zw=1.1,lP=.1,hP=10,_p=0,cP=1.25,Gw=40,Xw=5,ct={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},nl={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},Es={DISABLE:0,ENABLE:1,ENABLE_PERMISSIONS:2},rt={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},_e={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};function v_(h,t,e=!1){let i=h.offsetParent;if(!i){console.error("offsetParent is not set -- cannot scroll");return}let s=h.offsetTop+h.clientTop,n=h.offsetLeft+h.clientLeft;for(;i.clientHeight===i.scrollHeight&&i.clientWidth===i.scrollWidth||e&&(i.classList.contains("markedContent")||getComputedStyle(i).overflow==="hidden");)if(s+=i.offsetTop,n+=i.offsetLeft,i=i.offsetParent,!i)return;t&&(t.top!==void 0&&(s+=t.top),t.left!==void 0&&(n+=t.left,i.scrollLeft=n)),i.scrollTop=s}function dP(h,t,e=void 0){const i=function(a){n||(n=window.requestAnimationFrame(function(){n=null;const l=h.scrollLeft,c=s.lastX;l!==c&&(s.right=l>c),s.lastX=l;const d=h.scrollTop,u=s.lastY;d!==u&&(s.down=d>u),s.lastY=d,t(s)}))},s={right:!0,down:!0,lastX:h.scrollLeft,lastY:h.scrollTop,_eventHandler:i};let n=null;return h.addEventListener("scroll",i,{useCapture:!0,signal:e}),e==null||e.addEventListener("abort",()=>window.cancelAnimationFrame(n),{once:!0}),s}function ap(h){const t=new Map;for(const[e,i]of new URLSearchParams(h))t.set(e.toLowerCase(),i);return t}const qw=/[\x00-\x1F]/g;function Cc(h,t=!1){return qw.test(h)?t?h.replaceAll(qw,e=>e==="\0"?"":" "):h.replaceAll("\0",""):h}function Oc(h,t,e=0){let i=e,s=h.length-1;if(s<0||!t(h[s]))return h.length;if(t(h[i]))return i;for(;i<s;){const n=i+s>>1,a=h[n];t(a)?s=n:i=n+1}return i}function Yw(h){if(Math.floor(h)===h)return[h,1];const t=1/h,e=8;if(t>e)return[1,e];if(Math.floor(t)===t)return[1,t];const i=h>1?t:h;let s=0,n=1,a=1,o=1;for(;;){const c=s+a,d=n+o;if(d>e)break;i<=c/d?(a=c,o=d):(s=c,n=d)}let l;return i-s/n<a/o-i?l=i===h?[s,n]:[n,s]:l=i===h?[a,o]:[o,a],l}function bf(h,t){return h-h%t}function uP(h,t,e){if(h<2)return h;let i=t[h].div,s=i.offsetTop+i.clientTop;s>=e&&(i=t[h-1].div,s=i.offsetTop+i.clientTop);for(let n=h-2;n>=0&&(i=t[n].div,!(i.offsetTop+i.clientTop+i.clientHeight<=s));--n)h=n;return h}function fP({scrollEl:h,views:t,sortByVisibility:e=!1,horizontal:i=!1,rtl:s=!1}){const n=h.scrollTop,a=n+h.clientHeight,o=h.scrollLeft,l=o+h.clientWidth;function c(S){const _=S.div;return _.offsetTop+_.clientTop+_.clientHeight>n}function d(S){const _=S.div,E=_.offsetLeft+_.clientLeft,P=E+_.clientWidth;return s?E<l:P>o}const u=[],g=new Set,b=t.length;let w=Oc(t,i?d:c);w>0&&w<b&&!i&&(w=uP(w,t,n));let v=i?l:-1;for(let S=w;S<b;S++){const _=t[S],E=_.div,P=E.offsetLeft+E.clientLeft,x=E.offsetTop+E.clientTop,T=E.clientWidth,I=E.clientHeight,C=P+T,L=x+I;if(v===-1)L>=a&&(v=L);else if((i?P:x)>v)break;if(L<=n||x>=a||C<=o||P>=l)continue;const M=Math.max(0,n-x),G=Math.max(0,o-P),W=M+Math.max(0,L-a),$=G+Math.max(0,C-l),Tt=(I-W)/I,V=(T-$)/T,N=Tt*V*100|0;u.push({id:_.id,x:P,y:x,visibleArea:N===100?null:{minX:G,minY:M,maxX:Math.min(C,l)-P,maxY:Math.min(L,a)-x},view:_,percent:N,widthPercent:V*100|0}),g.add(_.id)}const A=u[0],y=u.at(-1);return e&&u.sort(function(S,_){const E=S.percent-_.percent;return Math.abs(E)>.001?-E:S.id-_.id}),{first:A,last:y,views:u,ids:g}}function y_(h){return Number.isInteger(h)&&h%90===0}function gP(h){return Number.isInteger(h)&&Object.values(rt).includes(h)&&h!==rt.UNKNOWN}function pP(h){return Number.isInteger(h)&&Object.values(_e).includes(h)&&h!==_e.UNKNOWN}function Kw(h){return h.width<=h.height}new Promise(function(h){window.requestAnimationFrame(h)});const mP=document.documentElement.style;var Tr,vo,Ir,wh,yo;class bP{constructor(t){m(this,Tr,null);m(this,vo,null);m(this,Ir,0);m(this,wh,null);m(this,yo,!0);f(this,Tr,t.classList),f(this,wh,t.style)}get percent(){return r(this,Ir)}set percent(t){if(f(this,Ir,m_(t,0,100)),isNaN(t)){r(this,Tr).add("indeterminate");return}r(this,Tr).remove("indeterminate"),r(this,wh).setProperty("--progressBar-percent","".concat(r(this,Ir),"%"))}setWidth(t){if(!t)return;const i=t.parentNode.offsetWidth-t.offsetWidth;i>0&&r(this,wh).setProperty("--progressBar-end-offset","".concat(i,"px"))}setDisableAutoFetch(t=5e3){r(this,Ir)===100||isNaN(r(this,Ir))||(r(this,vo)&&clearTimeout(r(this,vo)),this.show(),f(this,vo,setTimeout(()=>{f(this,vo,null),this.hide()},t)))}hide(){r(this,yo)&&(f(this,yo,!1),r(this,Tr).add("hidden"))}show(){r(this,yo)||(f(this,yo,!0),r(this,Tr).remove("hidden"))}}Tr=new WeakMap,vo=new WeakMap,Ir=new WeakMap,wh=new WeakMap,yo=new WeakMap;function wP(h){let t=rt.VERTICAL,e=_e.NONE;switch(h){case"SinglePage":t=rt.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=rt.PAGE;case"TwoColumnLeft":e=_e.ODD;break;case"TwoPageRight":t=rt.PAGE;case"TwoColumnRight":e=_e.EVEN;break}return{scrollMode:t,spreadMode:e}}const wf=function(){const h=document.createElement("div");return h.style.width="round(down, calc(1.6666666666666665 * 792px), 1px)",h.style.width==="calc(1320px)"?Math.fround:t=>t}(),Ti={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};function vP(h){return h<11904}function yP(h){return(h&65408)===0}function _P(h){return h>=97&&h<=122||h>=65&&h<=90}function AP(h){return h>=48&&h<=57}function EP(h){return h===32||h===9||h===13||h===10}function SP(h){return h>=13312&&h<=40959||h>=63744&&h<=64255}function PP(h){return h>=12448&&h<=12543}function xP(h){return h>=12352&&h<=12447}function CP(h){return h>=65376&&h<=65439}function TP(h){return(h&65408)===3584}function vf(h){return vP(h)?yP(h)?EP(h)?Ti.SPACE:_P(h)||AP(h)||h===95?Ti.ALPHA_LETTER:Ti.PUNCT:TP(h)?Ti.THAI_LETTER:h===160?Ti.SPACE:Ti.ALPHA_LETTER:SP(h)?Ti.HAN_LETTER:PP(h)?Ti.KATAKANA_LETTER:xP(h)?Ti.HIRAGANA_LETTER:CP(h)?Ti.HALFWIDTH_KATAKANA_LETTER:Ti.ALPHA_LETTER}let Zw;function IP(){return Zw||(Zw=" ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩"),Zw}const Nn={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},LP=250,RP=-50,MP=-400,Qw={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},Jw=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let tv;const kP=new RegExp("\\p{M}+","gu"),DP=new RegExp("([.*+?^${}()|[\\]\\\\])|(\\p{P})|(\\s+)|(\\p{M})|(\\p{L})","gu"),NP=new RegExp("([^\\p{M}])\\p{M}*$","u"),FP=new RegExp("^\\p{M}*([^\\p{M}])","u"),OP=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,ev=new Map,BP="[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]",iv=new Map;let Ap=null,Ep=null;function eg(h,t={}){var S;const e=[];let i;for(;(i=OP.exec(h))!==null;){let{index:_}=i;for(const E of i[0]){let P=ev.get(E);P||(P=E.normalize("NFD").length,ev.set(E,P)),e.push([P,_++])}}const s=e.length>0,n=(S=t.ignoreDashEOL)!=null?S:!1;let a;if(!s&&Ap)a=Ap;else if(s&&Ep)a=Ep;else{const _=Object.keys(Qw).join(""),E=IP(),I=["[".concat(_,"]"),"[".concat(E,"]"),"".concat("(?:゙|゚)","\\n"),"\\p{M}+(?:-\\n)?","".concat("\\p{Ll}-\\n(?=\\p{Ll})|\\p{Lu}-\\n(?=\\p{L})"),"\\S-\\n","".concat("(?:\\p{Ideographic}|[぀-ヿ])","\\n"),"\\n",s?BP:"\\u0000"];a=new RegExp(I.map(C=>"(".concat(C,")")).join("|"),"gum"),s?Ep=a:Ap=a}const o=[];for(;(i=kP.exec(h))!==null;)o.push([i[0].length,i.index]);let l=h.normalize("NFD");const c=[0,0];let d=0,u=0,g=0,b=0,w=0,v=!1;l=l.replace(a,(_,E,P,x,T,I,C,L,M,G,W)=>{var $,Tt,V;if(W-=b,E){const N=Qw[E],mt=N.length;for(let _t=1;_t<mt;_t++)c.push(W-g+_t,g-_t);return g-=mt-1,N}if(P){let N=iv.get(P);N||(N=P.normalize("NFKC"),iv.set(P,N));const mt=N.length;for(let _t=1;_t<mt;_t++)c.push(W-g+_t,g-_t);return g-=mt-1,N}if(x)return v=!0,W+w===(($=o[d])==null?void 0:$[1])?++d:(c.push(W-1-g+1,g-1),g-=1,b+=1),c.push(W-g+1,g),b+=1,w+=1,x.charAt(0);if(T){const N=T.endsWith("\n"),mt=N?T.length-2:T.length;v=!0;let _t=mt;W+w===((Tt=o[d])==null?void 0:Tt[1])&&(_t-=o[d][0],++d);for(let fi=1;fi<=_t;fi++)c.push(W-1-g+fi,g-fi);return g-=_t,b+=_t,N?(W+=mt-1,c.push(W-g+1,1+g),g+=1,b+=1,w+=1,T.slice(0,mt)):T}if(I){if(n)return b+=1,w+=1,I.slice(0,-1);const N=I.length-2;return c.push(W-g+N,1+g),g+=1,b+=1,w+=1,I.slice(0,-2)}if(C)return b+=1,w+=1,C.slice(0,-1);if(L){const N=L.length-1;return c.push(W-g+N,g),b+=1,w+=1,L.slice(0,-1)}if(M)return c.push(W-g+1,g-1),g-=1,b+=1,w+=1," ";if(W+w===((V=e[u])==null?void 0:V[1])){const N=e[u][0]-1;++u;for(let mt=1;mt<=N;mt++)c.push(W-(g-mt),g-mt);g-=N,b+=N}return G}),c.push(l.length,g);const A=new Uint32Array(c.length>>1),y=new Int32Array(c.length>>1);for(let _=0,E=c.length;_<E;_+=2)A[_>>1]=c[_],y[_>>1]=c[_+1];return[l,[A,y],v]}function __(h,t,e){if(!h)return[t,e];const[i,s]=h,n=t,a=t+e-1;let o=Oc(i,g=>g>=n);i[o]>n&&--o;let l=Oc(i,g=>g>=a,o);i[l]>a&&--l;const c=n+s[o],u=a+s[l]+1-c;return[c,u]}var zt,vh,_o,U,E_,eb,ib,S_,P_,sb,x_,C_,ig,bc,qo,T_,nb,rb,sg,I_,ab,ob,wc;class A_{constructor({linkService:t,eventBus:e,updateMatchesCountOnProgress:i=!0}){m(this,U);m(this,zt,null);m(this,vh,!0);m(this,_o,0);this._linkService=t,this._eventBus=e,f(this,vh,i),this.onIsPageVisible=null,p(this,U,eb).call(this),e._on("find",p(this,U,E_).bind(this)),e._on("findbarclose",p(this,U,I_).bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return r(this,zt)}setDocument(t){this._pdfDocument&&p(this,U,eb).call(this),t&&(this._pdfDocument=t,this._firstPageCapability.resolve())}scrollMatchIntoView({element:t=null,selectedLeft:e=0,pageIndex:i=-1,matchIndex:s=-1}){if(!this._scrollMatches||!t)return;if(s===-1||s!==this._selected.matchIdx)return;if(i===-1||i!==this._selected.pageIdx)return;this._scrollMatches=!1;const n={top:RP,left:e+MP};v_(t,n,!0)}match(t,e,i){const s=this._hasDiacritics[i];let n=!1;if(typeof t=="string"?[n,t]=p(this,U,sb).call(this,t,s):t=t.sort().reverse().map(u=>{const[g,b]=p(this,U,sb).call(this,u,s);return n||(n=g),"(".concat(b,")")}).join("|"),!t)return;const{caseSensitive:a,entireWord:o}=r(this,zt),l="g".concat(n?"u":"").concat(a?"":"i");t=new RegExp(t,l);const c=[];let d;for(;(d=t.exec(e))!==null;)o&&!p(this,U,P_).call(this,e,d.index,d[0].length)||c.push({index:d.index,length:d[0].length});return c}}zt=new WeakMap,vh=new WeakMap,_o=new WeakMap,U=new WeakSet,E_=function(t){if(!t)return;const e=this._pdfDocument,{type:i}=t;(r(this,zt)===null||p(this,U,S_).call(this,t))&&(this._dirtyMatch=!0),f(this,zt,t),i!=="highlightallchange"&&p(this,U,wc).call(this,Nn.PENDING),this._firstPageCapability.promise.then(()=>{if(!this._pdfDocument||e&&this._pdfDocument!==e)return;p(this,U,C_).call(this);const s=!this._highlightMatches,n=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),i?this._dirtyMatch?p(this,U,qo).call(this):i==="again"?(p(this,U,qo).call(this),s&&r(this,zt).highlightAll&&p(this,U,bc).call(this)):i==="highlightallchange"?(n?p(this,U,qo).call(this):this._highlightMatches=!0,p(this,U,bc).call(this)):p(this,U,qo).call(this):this._findTimeout=setTimeout(()=>{p(this,U,qo).call(this),this._findTimeout=null},LP)})},eb=function(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],f(this,_o,0),f(this,zt,null),this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this._firstPageCapability=Promise.withResolvers()},ib=function(){const{query:t}=r(this,zt);return typeof t=="string"?(t!==this._rawQuery&&(this._rawQuery=t,[this._normalizedQuery]=eg(t)),this._normalizedQuery):(t||[]).filter(e=>!!e).map(e=>eg(e)[0])},S_=function(t){var a,o;const e=t.query,i=r(this,zt).query,s=typeof e;if(s!==typeof i)return!0;if(s==="string"){if(e!==i)return!0}else if(JSON.stringify(e)!==JSON.stringify(i))return!0;switch(t.type){case"again":const l=this._selected.pageIdx+1,c=this._linkService;return l>=1&&l<=c.pagesCount&&l!==c.page&&!((o=(a=this.onIsPageVisible)==null?void 0:a.call(this,l))==null||o);case"highlightallchange":return!1}return!0},P_=function(t,e,i){let s=t.slice(0,e).match(NP);if(s){const n=t.charCodeAt(e),a=s[1].charCodeAt(0);if(vf(n)===vf(a))return!1}if(s=t.slice(e+i).match(FP),s){const n=t.charCodeAt(e+i-1),a=s[1].charCodeAt(0);if(vf(n)===vf(a))return!1}return!0},sb=function(t,e){const{matchDiacritics:i}=r(this,zt);let s=!1;t=t.replaceAll(DP,(a,o,l,c,d,u)=>o?"[ ]*\\".concat(o,"[ ]*"):l?"[ ]*".concat(l,"[ ]*"):c?"[ ]+":i?d||u:d?Jw.has(d.charCodeAt(0))?d:"":e?(s=!0,"".concat(u,"\\p{M}*")):u);const n="[ ]*";return t.endsWith(n)&&(t=t.slice(0,t.length-n.length)),i&&e&&(tv||(tv=String.fromCharCode(...Jw)),s=!0,t="".concat(t,"(?=[").concat(tv,"]|[^\\p{M}]|$)")),[s,t]},x_=function(t){if(!r(this,zt))return;const e=r(this,U,ib);if(e.length===0)return;const i=this._pageContents[t],s=this.match(e,i,t),n=this._pageMatches[t]=[],a=this._pageMatchesLength[t]=[],o=this._pageDiffs[t];s==null||s.forEach(({index:c,length:d})=>{const[u,g]=__(o,c,d);g&&(n.push(u),a.push(g))}),r(this,zt).highlightAll&&p(this,U,ig).call(this,t),this._resumePageIdx===t&&(this._resumePageIdx=null,p(this,U,nb).call(this));const l=n.length;this._matchesCountTotal+=l,r(this,vh)?l>0&&p(this,U,ob).call(this):++se(this,_o)._===this._linkService.pagesCount&&p(this,U,ob).call(this)},C_=function(){if(this._extractTextPromises.length>0)return;let t=Promise.resolve();const e={disableNormalization:!0},i=this._pdfDocument;for(let s=0,n=this._linkService.pagesCount;s<n;s++){const{promise:a,resolve:o}=Promise.withResolvers();this._extractTextPromises[s]=a,t=t.then(async()=>{if(i!==this._pdfDocument){o();return}await i.getPage(s+1).then(l=>l.getTextContent(e)).then(l=>{const c=[];for(const d of l.items)c.push(d.str),d.hasEOL&&c.push("\n");[this._pageContents[s],this._pageDiffs[s],this._hasDiacritics[s]]=eg(c.join("")),o()},l=>{console.error("Unable to get text content for page ".concat(s+1),l),this._pageContents[s]="",this._pageDiffs[s]=null,this._hasDiacritics[s]=!1,o()})})}},ig=function(t){this._scrollMatches&&this._selected.pageIdx===t&&(this._linkService.page=t+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:t})},bc=function(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})},qo=function(){const t=r(this,zt).findPrevious,e=this._linkService.page-1,i=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=e,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,f(this,_o,0),this._matchesCountTotal=0,p(this,U,bc).call(this);for(let a=0;a<i;a++)this._pendingFindMatches.has(a)||(this._pendingFindMatches.add(a),this._extractTextPromises[a].then(()=>{this._pendingFindMatches.delete(a),p(this,U,x_).call(this,a)}))}if(r(this,U,ib).length===0){p(this,U,wc).call(this,Nn.FOUND);return}if(this._resumePageIdx)return;const n=this._offset;if(this._pagesToSearch=i,n.matchIdx!==null){const a=this._pageMatches[n.pageIdx].length;if(!t&&n.matchIdx+1<a||t&&n.matchIdx>0){n.matchIdx=t?n.matchIdx-1:n.matchIdx+1,p(this,U,sg).call(this,!0);return}p(this,U,rb).call(this,t)}p(this,U,nb).call(this)},T_=function(t){const e=this._offset,i=t.length,s=r(this,zt).findPrevious;return i?(e.matchIdx=s?i-1:0,p(this,U,sg).call(this,!0),!0):(p(this,U,rb).call(this,s),e.wrapped&&(e.matchIdx=null,this._pagesToSearch<0)?(p(this,U,sg).call(this,!1),!0):!1)},nb=function(){this._resumePageIdx!==null&&console.error("There can only be one pending page.");let t=null;do{const e=this._offset.pageIdx;if(t=this._pageMatches[e],!t){this._resumePageIdx=e;break}}while(!p(this,U,T_).call(this,t))},rb=function(t){const e=this._offset,i=this._linkService.pagesCount;e.pageIdx=t?e.pageIdx-1:e.pageIdx+1,e.matchIdx=null,this._pagesToSearch--,(e.pageIdx>=i||e.pageIdx<0)&&(e.pageIdx=t?i-1:0,e.wrapped=!0)},sg=function(t=!1){let e=Nn.NOT_FOUND;const i=this._offset.wrapped;if(this._offset.wrapped=!1,t){const s=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,e=i?Nn.WRAPPED:Nn.FOUND,s!==-1&&s!==this._selected.pageIdx&&p(this,U,ig).call(this,s)}p(this,U,wc).call(this,e,r(this,zt).findPrevious),this._selected.pageIdx!==-1&&(this._scrollMatches=!0,p(this,U,ig).call(this,this._selected.pageIdx))},I_=function(t){const e=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||e&&this._pdfDocument!==e||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),p(this,U,wc).call(this,Nn.FOUND),this._highlightMatches=!1,p(this,U,bc).call(this))})},ab=function(){var n;const{pageIdx:t,matchIdx:e}=this._selected;let i=0,s=this._matchesCountTotal;if(e!==-1){for(let a=0;a<t;a++)i+=((n=this._pageMatches[a])==null?void 0:n.length)||0;i+=e+1}return(i<1||i>s)&&(i=s=0),{current:i,total:s}},ob=function(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:p(this,U,ab).call(this)})},wc=function(t,e=!1){var i,s,n,a;!r(this,vh)&&(r(this,_o)!==this._linkService.pagesCount||t===Nn.PENDING)||this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:t,previous:e,entireWord:(s=(i=r(this,zt))==null?void 0:i.entireWord)!=null?s:null,matchesCount:p(this,U,ab).call(this),rawQuery:(a=(n=r(this,zt))==null?void 0:n.query)!=null?a:null})};const VP="noopener noreferrer nofollow",na={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};class rw{constructor({eventBus:t,externalLinkTarget:e=null,externalLinkRel:i=null,ignoreDestinationZoom:s=!1}={}){k(this,"externalLinkEnabled",!0);this.eventBus=t,this.externalLinkTarget=e,this.externalLinkRel=i,this._ignoreDestinationZoom=s,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(t,e=null){this.baseUrl=e,this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setHistory(t){this.pdfHistory=t}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfDocument?this.pdfViewer.currentPageNumber:1}set page(t){this.pdfDocument&&(this.pdfViewer.currentPageNumber=t)}get rotation(){return this.pdfDocument?this.pdfViewer.pagesRotation:0}set rotation(t){this.pdfDocument&&(this.pdfViewer.pagesRotation=t)}get isInPresentationMode(){return this.pdfDocument?this.pdfViewer.isInPresentationMode:!1}async goToDestination(t){if(!this.pdfDocument)return;let e,i,s;if(typeof t=="string"?(e=t,i=await this.pdfDocument.getDestination(t)):(e=null,i=await t),!Array.isArray(i)){console.error('goToDestination: "'.concat(i,'" is not a valid destination array, for dest="').concat(t,'".'));return}const[n]=i;if(n&&typeof n=="object"){if(s=this.pdfDocument.cachedPageNumber(n),!s)try{s=await this.pdfDocument.getPageIndex(n)+1}catch(o){console.error('goToDestination: "'.concat(n,'" is not a valid page reference, for dest="').concat(t,'".'));return}}else Number.isInteger(n)&&(s=n+1);if(!s||s<1||s>this.pagesCount){console.error('goToDestination: "'.concat(s,'" is not a valid page number, for dest="').concat(t,'".'));return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:e,explicitDest:i,pageNumber:s})),this.pdfViewer.scrollPageIntoView({pageNumber:s,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom});const a=new AbortController;this.eventBus._on("textlayerrendered",o=>{o.pageNumber===s&&(o.source.textLayer.div.focus(),a.abort())},{signal:a.signal})}goToPage(t){if(!this.pdfDocument)return;const e=typeof t=="string"&&this.pdfViewer.pageLabelToPageNumber(t)||t|0;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount)){console.error('PDFLinkService.goToPage: "'.concat(t,'" is not a valid page.'));return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(e)),this.pdfViewer.scrollPageIntoView({pageNumber:e})}addLinkAttributes(t,e,i=!1){if(!e||typeof e!="string")throw new Error('A valid "url" parameter must provided.');const s=i?na.BLANK:this.externalLinkTarget,n=this.externalLinkRel;this.externalLinkEnabled?t.href=t.title=e:(t.href="",t.title="Disabled: ".concat(e),t.onclick=()=>!1);let a="";switch(s){case na.NONE:break;case na.SELF:a="_self";break;case na.BLANK:a="_blank";break;case na.PARENT:a="_parent";break;case na.TOP:a="_top";break}t.target=a,t.rel=typeof n=="string"?n:VP}getDestinationHash(t){if(typeof t=="string"){if(t.length>0)return this.getAnchorUrl("#"+escape(t))}else if(Array.isArray(t)){const e=JSON.stringify(t);if(e.length>0)return this.getAnchorUrl("#"+escape(e))}return this.getAnchorUrl("")}getAnchorUrl(t){return this.baseUrl?this.baseUrl+t:t}setHash(t){if(!this.pdfDocument)return;let e,i;if(t.includes("=")){const s=ap(t);if(s.has("search")){const n=s.get("search").replaceAll('"',""),a=s.get("phrase")==="true";this.eventBus.dispatch("findfromurlhash",{source:this,query:a?n:n.match(/\S+/g)})}if(s.has("page")&&(e=s.get("page")|0||1),s.has("zoom")){const n=s.get("zoom").split(","),a=n[0],o=parseFloat(a);a.includes("Fit")?a==="Fit"||a==="FitB"?i=[null,{name:a}]:a==="FitH"||a==="FitBH"||a==="FitV"||a==="FitBV"?i=[null,{name:a},n.length>1?n[1]|0:null]:a==="FitR"?n.length!==5?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:a},n[1]|0,n[2]|0,n[3]|0,n[4]|0]:console.error('PDFLinkService.setHash: "'.concat(a,'" is not a valid zoom value.')):i=[null,{name:"XYZ"},n.length>1?n[1]|0:null,n.length>2?n[2]|0:null,o?o/100:a]}i?this.pdfViewer.scrollPageIntoView({pageNumber:e||this.page,destArray:i,allowNegativeOffset:!0}):e&&(this.page=e),s.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:s.get("pagemode")}),s.has("nameddest")&&this.goToDestination(s.get("nameddest"));return}i=unescape(t);try{i=JSON.parse(i),Array.isArray(i)||(i=i.toString())}catch(s){}if(typeof i=="string"||sP(i)){this.goToDestination(i);return}console.error('PDFLinkService.setHash: "'.concat(unescape(t),'" is not a valid destination.'))}executeNamedAction(t){var e,i;if(this.pdfDocument){switch(t){case"GoBack":(e=this.pdfHistory)==null||e.back();break;case"GoForward":(i=this.pdfHistory)==null||i.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1;break}this.eventBus.dispatch("namedaction",{source:this,action:t})}}async executeSetOCGState(t){if(!this.pdfDocument)return;const e=this.pdfDocument,i=await this.pdfViewer.optionalContentConfigPromise;e===this.pdfDocument&&(i.setOCGState(t),this.pdfViewer.optionalContentConfigPromise=Promise.resolve(i))}}class op extends rw{setDocument(t,e=null){}}var Lr,pu,mu,Rr,bu,Cs,lb,hb,R_;class L_{constructor({pdfPage:t,linkService:e,downloadManager:i,annotationStorage:s=null,imageResourcesPath:n="",renderForms:a=!0,enableScripting:o=!1,hasJSActionsPromise:l=null,fieldObjectsPromise:c=null,annotationCanvasMap:d=null,accessibilityManager:u=null,annotationEditorUIManager:g=null,onAppend:b=null}){m(this,Cs);m(this,Lr,null);m(this,pu,!1);m(this,mu,null);m(this,Rr,null);m(this,bu,!1);this.pdfPage=t,this.linkService=e,this.downloadManager=i,this.imageResourcesPath=n,this.renderForms=a,this.annotationStorage=s,this.enableScripting=o,this._hasJSActionsPromise=l||Promise.resolve(!1),this._fieldObjectsPromise=c||Promise.resolve(null),this._annotationCanvasMap=d,this._accessibilityManager=u,this._annotationEditorUIManager=g,f(this,mu,b),this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=e.eventBus}async render({viewport:t,intent:e="display",structTreeLayer:i=null}){var l,c;if(this.div){if(this._cancelled||!this.annotationLayer)return;this.annotationLayer.update({viewport:t.clone({dontFlip:!0})});return}const[s,n,a]=await Promise.all([this.pdfPage.getAnnotations({intent:e}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled)return;const o=this.div=document.createElement("div");if(o.className="annotationLayer",(l=r(this,mu))==null||l.call(this,o),s.length===0){f(this,Lr,s),this.hide(!0);return}p(this,Cs,lb).call(this,t,i),await this.annotationLayer.render({annotations:s,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:n,fieldObjects:a}),f(this,Lr,s),this.linkService.isInPresentationMode&&p(this,Cs,hb).call(this,nl.FULLSCREEN),r(this,Rr)||(f(this,Rr,new AbortController),(c=this._eventBus)==null||c._on("presentationmodechanged",d=>{p(this,Cs,hb).call(this,d.state)},{signal:r(this,Rr).signal}))}cancel(){var t;this._cancelled=!0,(t=r(this,Rr))==null||t.abort(),f(this,Rr,null)}hide(t=!1){f(this,pu,!t),this.div&&(this.div.hidden=!0)}hasEditableAnnotations(){var t;return!!((t=this.annotationLayer)!=null&&t.hasEditableAnnotations())}async injectLinkAnnotations({inferredLinks:t,viewport:e,structTreeLayer:i=null}){if(r(this,Lr)===null)throw new Error("`render` method must be called before `injectLinkAnnotations`.");if(this._cancelled||r(this,bu))return;f(this,bu,!0);const s=r(this,Lr).length?p(this,Cs,R_).call(this,t):t;s.length&&(this.annotationLayer||(p(this,Cs,lb).call(this,e,i),b_(this.div,e)),await this.annotationLayer.addLinkAnnotations(s,this.linkService),r(this,pu)||(this.div.hidden=!1))}}Lr=new WeakMap,pu=new WeakMap,mu=new WeakMap,Rr=new WeakMap,bu=new WeakMap,Cs=new WeakSet,lb=function(t,e){this.annotationLayer=new QS({div:this.div,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,page:this.pdfPage,viewport:t.clone({dontFlip:!0}),structTreeLayer:e})},hb=function(t){if(!this.div)return;let e=!1;switch(t){case nl.FULLSCREEN:e=!0;break;case nl.NORMAL:break;default:return}for(const i of this.div.childNodes)i.hasAttribute("data-internal-link")||(i.inert=e)},R_=function(t){function e(n){if(!n.quadPoints)return[n.rect];const a=[];for(let o=2,l=n.quadPoints.length;o<l;o+=8){const c=n.quadPoints[o],d=n.quadPoints[o+1],u=n.quadPoints[o+2],g=n.quadPoints[o+3];a.push([u,g,c,d])}return a}function i(n,a){const o=[],l=e(n),c=e(a);for(const d of l)for(const u of c){const g=nw.intersect(d,u);g&&o.push(g)}return o}function s(n){let a=0;for(const o of n)a+=Math.abs((o[2]-o[0])*(o[3]-o[1]));return a}return t.filter(n=>{let a;for(const o of r(this,Lr)){if(o.annotationType!==g_.LINK||!o.url)continue;const l=i(o,n);if(l.length!==0&&(a!=null||(a=s(e(n))),s(l)/a>.5))return!1}return!0})};function sv(h,t){const e=document.createElement("a");if(!e.click)throw new Error('DownloadManager: "a.click()" is not supported.');e.href=h,e.target="_parent","download"in e&&(e.download=t),(document.body||document.documentElement).append(e),e.click(),e.remove()}var Xb;class M_{constructor(){m(this,Xb,new WeakMap)}downloadData(t,e,i){const s=URL.createObjectURL(new Blob([t],{type:i}));sv(s,e)}openOrDownloadData(t,e,i=null){const n=iP(e)?"application/pdf":"";return this.downloadData(t,e,n),!1}download(t,e,i){let s;if(t)s=URL.createObjectURL(new Blob([t],{type:"application/pdf"}));else{if(!p_(e,"http://example.com")){console.error("download - not a valid URL: ".concat(e));return}s=e+"#pdfjs.action=download"}sv(s,i)}}Xb=new WeakMap;const nv={EVENT:"event",TIMEOUT:"timeout"};async function HP({target:h,name:t,delay:e=0}){if(typeof h!="object"||!(Number.isInteger(e)&&e>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");const{promise:i,resolve:s}=Promise.withResolvers(),n=new AbortController;function a(c){n.abort(),clearTimeout(l),s(c)}const o=h instanceof aw?"_on":"addEventListener";h[o](t,a.bind(null,nv.EVENT),{signal:n.signal});const l=setTimeout(a.bind(null,nv.TIMEOUT),e);return i}var yh;class aw{constructor(){m(this,yh,Object.create(null))}on(t,e,i=null){this._on(t,e,{external:!0,once:i==null?void 0:i.once,signal:i==null?void 0:i.signal})}off(t,e,i=null){this._off(t,e)}dispatch(t,e){const i=r(this,yh)[t];if(!i||i.length===0)return;let s;for(const{listener:n,external:a,once:o}of i.slice(0)){if(o&&this._off(t,n),a){(s||(s=[])).push(n);continue}n(e)}if(s){for(const n of s)n(e);s=null}}_on(t,e,i=null){var a;let s=null;if((i==null?void 0:i.signal)instanceof AbortSignal){const{signal:o}=i;if(o.aborted){console.error("Cannot use an `aborted` signal.");return}const l=()=>this._off(t,e);s=()=>o.removeEventListener("abort",l),o.addEventListener("abort",l)}((a=r(this,yh))[t]||(a[t]=[])).push({listener:e,external:(i==null?void 0:i.external)===!0,once:(i==null?void 0:i.once)===!0,rmAbort:s})}_off(t,e,i=null){var n;const s=r(this,yh)[t];if(s)for(let a=0,o=s.length;a<o;a++){const l=s[a];if(l.listener===e){(n=l.rmAbort)==null||n.call(l),s.splice(a,1);return}}}}yh=new WeakMap;class rl{constructor(t){this.value=t}valueOf(){return this.value}}class jt extends rl{constructor(t="???"){super(t)}toString(t){return"{".concat(this.value,"}")}}class Cn extends rl{constructor(t,e={}){super(t),this.opts=e}toString(t){if(t)try{return t.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(e){t.reportError(e)}return this.value.toString(10)}}class Kr extends rl{static supportsValue(t){if(typeof t=="number"||t instanceof Date)return!0;if(t instanceof rl)return Kr.supportsValue(t.valueOf());if("Temporal"in globalThis){const e=globalThis.Temporal;if(t instanceof e.Instant||t instanceof e.PlainDateTime||t instanceof e.PlainDate||t instanceof e.PlainMonthDay||t instanceof e.PlainTime||t instanceof e.PlainYearMonth)return!0}return!1}constructor(t,e={}){t instanceof Kr?(e={...t.opts,...e},t=t.value):t instanceof rl&&(t=t.valueOf()),typeof t=="object"&&"calendarId"in t&&e.calendar===void 0&&(e={...e,calendar:t.calendarId}),super(t),this.opts=e}[Symbol.toPrimitive](t){return t==="string"?this.toString():this.toNumber()}toNumber(){const t=this.value;if(typeof t=="number")return t;if(t instanceof Date)return t.getTime();if("epochMilliseconds"in t)return t.epochMilliseconds;if("toZonedDateTime"in t)return t.toZonedDateTime("UTC").epochMilliseconds;throw new TypeError("Unwrapping a non-number value as a number")}toString(t){if(t)try{return t.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(e){t.reportError(e)}return typeof this.value=="number"||this.value instanceof Date?new Date(this.value).toISOString():this.value.toString()}}const rv=100,jP="⁨",$P="⁩";function UP(h,t,e){if(e===t||e instanceof Cn&&t instanceof Cn&&e.value===t.value)return!0;if(t instanceof Cn&&typeof e=="string"){let i=h.memoizeIntlObject(Intl.PluralRules,t.opts).select(t.value);if(e===i)return!0}return!1}function av(h,t,e){return t[e]?Hh(h,t[e].value):(h.reportError(new RangeError("No default")),new jt)}function cb(h,t){const e=[],i=Object.create(null);for(const s of t)s.type==="narg"?i[s.name]=Bc(h,s.value):e.push(Bc(h,s));return{positional:e,named:i}}function Bc(h,t){switch(t.type){case"str":return t.value;case"num":return new Cn(t.value,{minimumFractionDigits:t.precision});case"var":return WP(h,t);case"mesg":return zP(h,t);case"term":return GP(h,t);case"func":return XP(h,t);case"select":return qP(h,t);default:return new jt}}function WP(h,{name:t}){let e;if(h.params)if(Object.prototype.hasOwnProperty.call(h.params,t))e=h.params[t];else return new jt("$".concat(t));else if(h.args&&Object.prototype.hasOwnProperty.call(h.args,t))e=h.args[t];else return h.reportError(new ReferenceError("Unknown variable: $".concat(t))),new jt("$".concat(t));if(e instanceof rl)return e;switch(typeof e){case"string":return e;case"number":return new Cn(e);case"object":if(Kr.supportsValue(e))return new Kr(e);default:return h.reportError(new TypeError("Variable type not supported: $".concat(t,", ").concat(typeof e))),new jt("$".concat(t))}}function zP(h,{name:t,attr:e}){const i=h.bundle._messages.get(t);if(!i)return h.reportError(new ReferenceError("Unknown message: ".concat(t))),new jt(t);if(e){const s=i.attributes[e];return s?Hh(h,s):(h.reportError(new ReferenceError("Unknown attribute: ".concat(e))),new jt("".concat(t,".").concat(e)))}return i.value?Hh(h,i.value):(h.reportError(new ReferenceError("No value: ".concat(t))),new jt(t))}function GP(h,{name:t,attr:e,args:i}){const s="-".concat(t),n=h.bundle._terms.get(s);if(!n)return h.reportError(new ReferenceError("Unknown term: ".concat(s))),new jt(s);if(e){const o=n.attributes[e];if(o){h.params=cb(h,i).named;const l=Hh(h,o);return h.params=null,l}return h.reportError(new ReferenceError("Unknown attribute: ".concat(e))),new jt("".concat(s,".").concat(e))}h.params=cb(h,i).named;const a=Hh(h,n.value);return h.params=null,a}function XP(h,{name:t,args:e}){let i=h.bundle._functions[t];if(!i)return h.reportError(new ReferenceError("Unknown function: ".concat(t,"()"))),new jt("".concat(t,"()"));if(typeof i!="function")return h.reportError(new TypeError("Function ".concat(t,"() is not callable"))),new jt("".concat(t,"()"));try{let s=cb(h,e);return i(s.positional,s.named)}catch(s){return h.reportError(s),new jt("".concat(t,"()"))}}function qP(h,{selector:t,variants:e,star:i}){let s=Bc(h,t);if(s instanceof jt)return av(h,e,i);for(const n of e){const a=Bc(h,n.key);if(UP(h,s,a))return Hh(h,n.value)}return av(h,e,i)}function k_(h,t){if(h.dirty.has(t))return h.reportError(new RangeError("Cyclic reference")),new jt;h.dirty.add(t);const e=[],i=h.bundle._useIsolating&&t.length>1;for(const s of t){if(typeof s=="string"){e.push(h.bundle._transform(s));continue}if(h.placeables++,h.placeables>rv)throw h.dirty.delete(t),new RangeError("Too many placeables expanded: ".concat(h.placeables,", ")+"max allowed is ".concat(rv));i&&e.push(jP),e.push(Bc(h,s).toString(h)),i&&e.push($P)}return h.dirty.delete(t),e.join("")}function Hh(h,t){return typeof t=="string"?h.bundle._transform(t):k_(h,t)}class YP{constructor(t,e,i){this.dirty=new WeakSet,this.params=null,this.placeables=0,this.bundle=t,this.errors=e,this.args=i}reportError(t){if(!this.errors||!(t instanceof Error))throw t;this.errors.push(t)}memoizeIntlObject(t,e){let i=this.bundle._intls.get(t);i||(i={},this.bundle._intls.set(t,i));let s=JSON.stringify(e);return i[s]||(i[s]=new t(this.bundle.locales,e)),i[s]}}function db(h,t){const e=Object.create(null);for(const[i,s]of Object.entries(h))t.includes(i)&&(e[i]=s.valueOf());return e}const ov=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function KP(h,t){let e=h[0];if(e instanceof jt)return new jt("NUMBER(".concat(e.valueOf(),")"));if(e instanceof Cn)return new Cn(e.valueOf(),{...e.opts,...db(t,ov)});if(e instanceof Kr)return new Cn(e.toNumber(),{...db(t,ov)});throw new TypeError("Invalid argument to NUMBER")}const ZP=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function QP(h,t){let e=h[0];if(e instanceof jt)return new jt("DATETIME(".concat(e.valueOf(),")"));if(e instanceof Kr||e instanceof Cn)return new Kr(e,db(t,ZP));throw new TypeError("Invalid argument to DATETIME")}const lv=new Map;function JP(h){const t=Array.isArray(h)?h.join(" "):h;let e=lv.get(t);return e===void 0&&(e=new Map,lv.set(t,e)),e}class tx{constructor(t,{functions:e,useIsolating:i=!0,transform:s=n=>n}={}){this._terms=new Map,this._messages=new Map,this.locales=Array.isArray(t)?t:[t],this._functions={NUMBER:KP,DATETIME:QP,...e},this._useIsolating=i,this._transform=s,this._intls=JP(t)}hasMessage(t){return this._messages.has(t)}getMessage(t){return this._messages.get(t)}addResource(t,{allowOverrides:e=!1}={}){const i=[];for(let s=0;s<t.body.length;s++){let n=t.body[s];if(n.id.startsWith("-")){if(e===!1&&this._terms.has(n.id)){i.push(new Error('Attempt to override an existing term: "'.concat(n.id,'"')));continue}this._terms.set(n.id,n)}else{if(e===!1&&this._messages.has(n.id)){i.push(new Error('Attempt to override an existing message: "'.concat(n.id,'"')));continue}this._messages.set(n.id,n)}}return i}formatPattern(t,e=null,i=null){if(typeof t=="string")return this._transform(t);let s=new YP(this,i,e);try{return k_(s,t).toString(s)}catch(n){if(s.errors&&n instanceof Error)return s.errors.push(n),new jt().toString(s);throw n}}}const Sp=/^(-?[a-zA-Z][\w-]*) *= */gm,hv=/\.([a-zA-Z][\w-]*) *= */y,ex=/\*?\[/y,Pp=/(-?[0-9]+(?:\.([0-9]+))?)/y,ix=/([a-zA-Z][\w-]*)/y,cv=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,sx=/^[A-Z][A-Z0-9_-]*$/,yf=/([^{}\n\r]+)/y,nx=/([^\\"\n\r]*)/y,dv=/\\([\\"])/y,uv=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,rx=/^\n+/,fv=/ +$/,ax=/ *\r?\n/g,ox=/( *)$/,lx=/{\s*/y,gv=/\s*}/y,hx=/\[\s*/y,cx=/\s*] */y,dx=/\s*\(\s*/y,ux=/\s*->\s*/y,fx=/\s*:\s*/y,gx=/\s*,?\s*/y,px=/\s+/y;class mx{constructor(t){this.body=[],Sp.lastIndex=0;let e=0;for(;;){let C=Sp.exec(t);if(C===null)break;e=Sp.lastIndex;try{this.body.push(l(C[1]))}catch(L){if(L instanceof SyntaxError)continue;throw L}}function i(C){return C.lastIndex=e,C.test(t)}function s(C,L){if(t[e]===C)return e++,!0;if(L)throw new L("Expected ".concat(C));return!1}function n(C,L){if(i(C))return e=C.lastIndex,!0;if(L)throw new L("Expected ".concat(C.toString()));return!1}function a(C){C.lastIndex=e;let L=C.exec(t);if(L===null)throw new SyntaxError("Expected ".concat(C.toString()));return e=C.lastIndex,L}function o(C){return a(C)[1]}function l(C){let L=d(),M=c();if(L===null&&Object.keys(M).length===0)throw new SyntaxError("Expected message value or attributes");return{id:C,value:L,attributes:M}}function c(){let C=Object.create(null);for(;i(hv);){let L=o(hv),M=d();if(M===null)throw new SyntaxError("Expected attribute value");C[L]=M}return C}function d(){let C;if(i(yf)&&(C=o(yf)),t[e]==="{"||t[e]==="}")return u(C?[C]:[],1/0);let L=x();return L?C?u([C,L],L.length):(L.value=T(L.value,rx),u([L],L.length)):C?T(C,fv):null}function u(C=[],L){for(;;){if(i(yf)){C.push(o(yf));continue}if(t[e]==="{"){C.push(g());continue}if(t[e]==="}")throw new SyntaxError("Unbalanced closing brace");let $=x();if($){C.push($),L=Math.min(L,$.length);continue}break}let M=C.length-1,G=C[M];typeof G=="string"&&(C[M]=T(G,fv));let W=[];for(let $ of C)$ instanceof pv&&($=$.value.slice(0,$.value.length-L)),$&&W.push($);return W}function g(){n(lx,SyntaxError);let C=b();if(n(gv))return C;if(n(ux)){let L=A();return n(gv,SyntaxError),{type:"select",selector:C,...L}}throw new SyntaxError("Unclosed placeable")}function b(){if(t[e]==="{")return g();if(i(cv)){let[,C,L,M=null]=a(cv);if(C==="$")return{type:"var",name:L};if(n(dx)){let G=w();if(C==="-")return{type:"term",name:L,attr:M,args:G};if(sx.test(L))return{type:"func",name:L,args:G};throw new SyntaxError("Function names must be all upper-case")}return C==="-"?{type:"term",name:L,attr:M,args:[]}:{type:"mesg",name:L,attr:M}}return S()}function w(){let C=[];for(;;){switch(t[e]){case")":return e++,C;case void 0:throw new SyntaxError("Unclosed argument list")}C.push(v()),n(gx)}}function v(){let C=b();return C.type!=="mesg"?C:n(fx)?{type:"narg",name:C.name,value:S()}:C}function A(){let C=[],L=0,M;for(;i(ex);){s("*")&&(M=L);let G=y(),W=d();if(W===null)throw new SyntaxError("Expected variant value");C[L++]={key:G,value:W}}if(L===0)return null;if(M===void 0)throw new SyntaxError("Expected default variant");return{variants:C,star:M}}function y(){n(hx,SyntaxError);let C;return i(Pp)?C=_():C={type:"str",value:o(ix)},n(cx,SyntaxError),C}function S(){if(i(Pp))return _();if(t[e]==='"')return E();throw new SyntaxError("Invalid expression")}function _(){let[,C,L=""]=a(Pp),M=L.length;return{type:"num",value:parseFloat(C),precision:M}}function E(){s('"',SyntaxError);let C="";for(;;){if(C+=o(nx),t[e]==="\\"){C+=P();continue}if(s('"'))return{type:"str",value:C};throw new SyntaxError("Unclosed string literal")}}function P(){if(i(dv))return o(dv);if(i(uv)){let[,C,L]=a(uv),M=parseInt(C||L,16);return M<=55295||57344<=M?String.fromCodePoint(M):"�"}throw new SyntaxError("Unknown escape sequence")}function x(){let C=e;switch(n(px),t[e]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return I(t.slice(C,e))}return t[e-1]===" "?I(t.slice(C,e)):!1}function T(C,L){return C.replace(L,"")}function I(C){let L=C.replace(ax,"\n"),M=ox.exec(C)[1].length;return new pv(L,M)}}}class pv{constructor(t,e){this.value=t,this.length=e}}const bx=/<|&#?\w+;/,wx={"http://www.w3.org/1999/xhtml":["em","strong","small","s","cite","q","dfn","abbr","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","bdi","bdo","span","br","wbr"]},vx={"http://www.w3.org/1999/xhtml":{global:["title","aria-description","aria-label","aria-valuetext"],a:["download"],area:["download","alt"],input:["alt","placeholder"],menuitem:["label"],menu:["label"],optgroup:["label"],option:["label"],track:["label"],img:["alt"],textarea:["placeholder"],th:["abbr"]},"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul":{global:["accesskey","aria-label","aria-valuetext","label","title","tooltiptext"],description:["value"],key:["key","keycode"],label:["value"],textbox:["placeholder","value"]}};function yx(h,t){const{value:e}=t;if(typeof e=="string")if(h.localName==="title"&&h.namespaceURI==="http://www.w3.org/1999/xhtml")h.textContent=e;else if(!bx.test(e))h.textContent=e;else{const i=h.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","template");i.innerHTML=e,_x(i.content,h)}D_(t,h)}function _x(h,t){for(const e of h.childNodes)if(e.nodeType!==e.TEXT_NODE){if(e.hasAttribute("data-l10n-name")){const i=Ex(t,e);h.replaceChild(i,e);continue}if(Px(e)){const i=Sx(e);h.replaceChild(i,e);continue}console.warn('An element of forbidden type "'.concat(e.localName,'" was found in ')+"the translation. Only safe text-level elements and elements with data-l10n-name are allowed."),h.replaceChild(ub(e),e)}t.textContent="",t.appendChild(h)}function Ax(h,t){if(!h)return!1;for(let e of h)if(e.name===t)return!0;return!1}function D_(h,t){const e=t.hasAttribute("data-l10n-attrs")?t.getAttribute("data-l10n-attrs").split(",").map(i=>i.trim()):null;for(const i of Array.from(t.attributes))mv(i.name,t,e)&&!Ax(h.attributes,i.name)&&t.removeAttribute(i.name);if(h.attributes)for(const i of Array.from(h.attributes))mv(i.name,t,e)&&t.getAttribute(i.name)!==i.value&&t.setAttribute(i.name,i.value)}function Ex(h,t){const e=t.getAttribute("data-l10n-name"),i=h.querySelector('[data-l10n-name="'.concat(e,'"]'));if(!i)return console.warn('An element named "'.concat(e,"\" wasn't found in the source.")),ub(t);if(i.localName!==t.localName)return console.warn('An element named "'.concat(e,'" was found in the translation ')+"but its type ".concat(t.localName," didn't match the ")+"element found in the source (".concat(i.localName,").")),ub(t);h.removeChild(i);const s=i.cloneNode(!1);return N_(t,s)}function Sx(h){const t=h.ownerDocument.createElement(h.localName);return N_(h,t)}function ub(h){return h.ownerDocument.createTextNode(h.textContent)}function Px(h){const t=wx[h.namespaceURI];return t&&t.includes(h.localName)}function mv(h,t,e=null){if(e&&e.includes(h))return!0;const i=vx[t.namespaceURI];if(!i)return!1;const s=h.toLowerCase(),n=t.localName;if(i.global.includes(s))return!0;if(!i[n])return!1;if(i[n].includes(s))return!0;if(t.namespaceURI==="http://www.w3.org/1999/xhtml"&&n==="input"&&s==="value"){const a=t.type.toLowerCase();if(a==="submit"||a==="button"||a==="reset")return!0}return!1}function N_(h,t){return t.textContent=h.textContent,D_(h,t),t}class xx extends Array{static from(t){return t instanceof this?t:new this(t)}}class Cx extends xx{constructor(t){if(super(),Symbol.asyncIterator in Object(t))this.iterator=t[Symbol.asyncIterator]();else if(Symbol.iterator in Object(t))this.iterator=t[Symbol.iterator]();else throw new TypeError("Argument must implement the iteration protocol.")}[Symbol.asyncIterator](){const t=this;let e=0;return{async next(){return t.length<=e&&t.push(t.iterator.next()),t[e++]}}}async touchNext(t=1){let e=0;for(;e++<t;){const i=this[this.length-1];if(i&&(await i).done)break;this.push(this.iterator.next())}return this[this.length-1]}}class Tx{constructor(t=[],e){this.resourceIds=t,this.generateBundles=e,this.onChange(!0)}addResourceIds(t,e=!1){return this.resourceIds.push(...t),this.onChange(e),this.resourceIds.length}removeResourceIds(t){return this.resourceIds=this.resourceIds.filter(e=>!t.includes(e)),this.onChange(),this.resourceIds.length}async formatWithFallback(t,e){const i=[];let s=!1;for await(const n of this.bundles){s=!0;const a=Rx(e,n,t,i);if(a.size===0)break;if(typeof console<"u"){const o=n.locales[0],l=Array.from(a).join(", ");console.warn("[fluent] Missing translations in ".concat(o,": ").concat(l))}}return!s&&typeof console<"u"&&console.warn("[fluent] Request for keys failed because no resource bundles got generated.\n keys: ".concat(JSON.stringify(t),".\n resourceIds: ").concat(JSON.stringify(this.resourceIds),".")),i}formatMessages(t){return this.formatWithFallback(t,Lx)}formatValues(t){return this.formatWithFallback(t,Ix)}async formatValue(t,e){const[i]=await this.formatValues([{id:t,args:e}]);return i}handleEvent(){this.onChange()}onChange(t=!1){this.bundles=Cx.from(this.generateBundles(this.resourceIds)),t&&this.bundles.touchNext(2)}}function Ix(h,t,e,i){return e.value?h.formatPattern(e.value,i,t):null}function Lx(h,t,e,i){const s={value:null,attributes:null};e.value&&(s.value=h.formatPattern(e.value,i,t));let n=Object.keys(e.attributes);if(n.length>0){s.attributes=new Array(n.length);for(let[a,o]of n.entries()){let l=h.formatPattern(e.attributes[o],i,t);s.attributes[a]={name:o,value:l}}}return s}function Rx(h,t,e,i){const s=[],n=new Set;return e.forEach(({id:a,args:o},l)=>{if(i[l]!==void 0)return;let c=t.getMessage(a);if(c){if(s.length=0,i[l]=h(t,s,c,o),s.length>0&&typeof console<"u"){const d=t.locales[0],u=s.join(", ");console.warn("[fluent][resolver] errors in ".concat(d,"/").concat(a,": ").concat(u,"."))}}else n.add(a)}),n}const ra="data-l10n-id",Yh="data-l10n-args",Mx="[".concat(ra,"]");class kx extends Tx{constructor(t,e){super(t,e),this.roots=new Set,this.pendingrAF=null,this.pendingElements=new Set,this.windowElement=null,this.mutationObserver=null,this.observerConfig={attributes:!0,characterData:!1,childList:!0,subtree:!0,attributeFilter:[ra,Yh]}}onChange(t=!1){super.onChange(t),this.roots&&this.translateRoots()}setAttributes(t,e,i){return t.setAttribute(ra,e),i?t.setAttribute(Yh,JSON.stringify(i)):t.removeAttribute(Yh),t}getAttributes(t){return{id:t.getAttribute(ra),args:JSON.parse(t.getAttribute(Yh)||null)}}connectRoot(t){for(const e of this.roots)if(e===t||e.contains(t)||t.contains(e))throw new Error("Cannot add a root that overlaps with existing root.");if(this.windowElement){if(this.windowElement!==t.ownerDocument.defaultView)throw new Error("Cannot connect a root:\n DOMLocalization already has a root from a different window.")}else this.windowElement=t.ownerDocument.defaultView,this.mutationObserver=new this.windowElement.MutationObserver(e=>this.translateMutations(e));this.roots.add(t),this.mutationObserver.observe(t,this.observerConfig)}disconnectRoot(t){return this.roots.delete(t),this.pauseObserving(),this.roots.size===0?(this.mutationObserver=null,this.windowElement&&this.pendingrAF&&this.windowElement.cancelAnimationFrame(this.pendingrAF),this.windowElement=null,this.pendingrAF=null,this.pendingElements.clear(),!0):(this.resumeObserving(),!1)}translateRoots(){const t=Array.from(this.roots);return Promise.all(t.map(e=>this.translateFragment(e)))}pauseObserving(){this.mutationObserver&&(this.translateMutations(this.mutationObserver.takeRecords()),this.mutationObserver.disconnect())}resumeObserving(){if(this.mutationObserver)for(const t of this.roots)this.mutationObserver.observe(t,this.observerConfig)}translateMutations(t){for(const e of t)switch(e.type){case"attributes":e.target.hasAttribute("data-l10n-id")&&this.pendingElements.add(e.target);break;case"childList":for(const i of e.addedNodes)if(i.nodeType===i.ELEMENT_NODE)if(i.childElementCount)for(const s of this.getTranslatables(i))this.pendingElements.add(s);else i.hasAttribute(ra)&&this.pendingElements.add(i);break}this.pendingElements.size>0&&this.pendingrAF===null&&(this.pendingrAF=this.windowElement.requestAnimationFrame(()=>{this.translateElements(Array.from(this.pendingElements)),this.pendingElements.clear(),this.pendingrAF=null}))}translateFragment(t){return this.translateElements(this.getTranslatables(t))}async translateElements(t){if(!t.length)return;const e=t.map(this.getKeysForElement),i=await this.formatMessages(e);return this.applyTranslations(t,i)}applyTranslations(t,e){this.pauseObserving();for(let i=0;i<t.length;i++)e[i]!==void 0&&yx(t[i],e[i]);this.resumeObserving()}getTranslatables(t){const e=Array.from(t.querySelectorAll(Mx));return typeof t.hasAttribute=="function"&&t.hasAttribute(ra)&&e.push(t),e}getKeysForElement(t){return{id:t.getAttribute(ra),args:JSON.parse(t.getAttribute(Yh)||null)}}}var wu,Mr,_h,Oe,jh,F_,O_;const Mc=class Mc{constructor({lang:t,isRTL:e},i=null){m(this,wu);m(this,Mr);m(this,_h);m(this,Oe);var s,n;f(this,_h,p(s=Mc,jh,F_).call(s,t)),f(this,Oe,i),f(this,wu,(e!=null?e:p(n=Mc,jh,O_).call(n,r(this,_h)))?"rtl":"ltr")}_setL10n(t){f(this,Oe,t)}getLanguage(){return r(this,_h)}getDirection(){return r(this,wu)}async get(t,e=null,i){var n;return Array.isArray(t)?(t=t.map(o=>({id:o})),(await r(this,Oe).formatMessages(t)).map(o=>o.value)):((n=(await r(this,Oe).formatMessages([{id:t,args:e}]))[0])==null?void 0:n.value)||i}async translate(t){(r(this,Mr)||f(this,Mr,new Set)).add(t);try{r(this,Oe).connectRoot(t),await r(this,Oe).translateRoots()}catch(e){}}async translateOnce(t){try{await r(this,Oe).translateElements([t])}catch(e){console.error("translateOnce:",e)}}async destroy(){if(r(this,Mr)){for(const t of r(this,Mr))r(this,Oe).disconnectRoot(t);r(this,Mr).clear(),f(this,Mr,null)}r(this,Oe).pauseObserving()}pause(){r(this,Oe).pauseObserving()}resume(){r(this,Oe).resumeObserving()}};wu=new WeakMap,Mr=new WeakMap,_h=new WeakMap,Oe=new WeakMap,jh=new WeakSet,F_=function(t){return t=(t==null?void 0:t.toLowerCase())||"en-us",{en:"en-us",es:"es-es",fy:"fy-nl",ga:"ga-ie",gu:"gu-in",hi:"hi-in",hy:"hy-am",nb:"nb-no",ne:"ne-np",nn:"nn-no",pa:"pa-in",pt:"pt-pt",sv:"sv-se",zh:"zh-cn"}[t]||t},O_=function(t){const e=t.split("-",1)[0];return["ar","he","fa","ps","ur"].includes(e)},m(Mc,jh);let fb=Mc;function Dx(){const{isAndroid:h,isLinux:t,isMac:e,isWindows:i}=tP.platform;return t?"linux":i?"windows":e?"macos":h?"android":"other"}function bv(h,t){const e=new mx(t),i=new tx(h,{functions:{PLATFORM:Dx}}),s=i.addResource(e);return s.length&&console.error("L10n errors",s),i}var ui,B_,V_,H_,j_,gb;const ua=class ua extends fb{constructor(t){super({lang:t});const e=t?p(ua,ui,B_).bind(ua,"en-us",this.getLanguage()):p(ua,ui,j_).bind(ua,this.getLanguage());this._setL10n(new kx([],e))}};ui=new WeakSet,B_=async function*(t,e){const{baseURL:i,paths:s}=await p(this,ui,H_).call(this),n=[e];if(t!==e){const o=e.split("-",1)[0];o!==e&&n.push(o),n.push(t)}const a=n.map(o=>[o,p(this,ui,V_).call(this,o,i,s)]);for(const[o,l]of a){const c=await l;c?yield c:o==="en-us"&&(yield p(this,ui,gb).call(this,o))}},V_=async function(t,e,i){const s=i[t];if(!s)return null;const n=new URL(s,e),a=await Uw(n,"text");return bv(t,a)},H_=async function(){try{const{href:t}=document.querySelector('link[type="application/l10n"]'),e=await Uw(t,"json");return{baseURL:t.substring(0,t.lastIndexOf("/")+1)||"./",paths:e}}catch(t){}return{baseURL:"./",paths:Object.create(null)}},j_=async function*(t){yield p(this,ui,gb).call(this,t)},gb=async function(t){return bv(t,'pdfjs-previous-button =\n .title = Previous Page\npdfjs-previous-button-label = Previous\npdfjs-next-button =\n .title = Next Page\npdfjs-next-button-label = Next\npdfjs-page-input =\n .title = Page\npdfjs-of-pages = of { $pagesCount }\npdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })\npdfjs-zoom-out-button =\n .title = Zoom Out\npdfjs-zoom-out-button-label = Zoom Out\npdfjs-zoom-in-button =\n .title = Zoom In\npdfjs-zoom-in-button-label = Zoom In\npdfjs-zoom-select =\n .title = Zoom\npdfjs-presentation-mode-button =\n .title = Switch to Presentation Mode\npdfjs-presentation-mode-button-label = Presentation Mode\npdfjs-open-file-button =\n .title = Open File\npdfjs-open-file-button-label = Open\npdfjs-print-button =\n .title = Print\npdfjs-print-button-label = Print\npdfjs-save-button =\n .title = Save\npdfjs-save-button-label = Save\npdfjs-download-button =\n .title = Download\npdfjs-download-button-label = Download\npdfjs-bookmark-button =\n .title = Current Page (View URL from Current Page)\npdfjs-bookmark-button-label = Current Page\npdfjs-tools-button =\n .title = Tools\npdfjs-tools-button-label = Tools\npdfjs-first-page-button =\n .title = Go to First Page\npdfjs-first-page-button-label = Go to First Page\npdfjs-last-page-button =\n .title = Go to Last Page\npdfjs-last-page-button-label = Go to Last Page\npdfjs-page-rotate-cw-button =\n .title = Rotate Clockwise\npdfjs-page-rotate-cw-button-label = Rotate Clockwise\npdfjs-page-rotate-ccw-button =\n .title = Rotate Counterclockwise\npdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise\npdfjs-cursor-text-select-tool-button =\n .title = Enable Text Selection Tool\npdfjs-cursor-text-select-tool-button-label = Text Selection Tool\npdfjs-cursor-hand-tool-button =\n .title = Enable Hand Tool\npdfjs-cursor-hand-tool-button-label = Hand Tool\npdfjs-scroll-page-button =\n .title = Use Page Scrolling\npdfjs-scroll-page-button-label = Page Scrolling\npdfjs-scroll-vertical-button =\n .title = Use Vertical Scrolling\npdfjs-scroll-vertical-button-label = Vertical Scrolling\npdfjs-scroll-horizontal-button =\n .title = Use Horizontal Scrolling\npdfjs-scroll-horizontal-button-label = Horizontal Scrolling\npdfjs-scroll-wrapped-button =\n .title = Use Wrapped Scrolling\npdfjs-scroll-wrapped-button-label = Wrapped Scrolling\npdfjs-spread-none-button =\n .title = Do not join page spreads\npdfjs-spread-none-button-label = No Spreads\npdfjs-spread-odd-button =\n .title = Join page spreads starting with odd-numbered pages\npdfjs-spread-odd-button-label = Odd Spreads\npdfjs-spread-even-button =\n .title = Join page spreads starting with even-numbered pages\npdfjs-spread-even-button-label = Even Spreads\npdfjs-document-properties-button =\n .title = Document Properties…\npdfjs-document-properties-button-label = Document Properties…\npdfjs-document-properties-file-name = File name:\npdfjs-document-properties-file-size = File size:\npdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)\npdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)\npdfjs-document-properties-title = Title:\npdfjs-document-properties-author = Author:\npdfjs-document-properties-subject = Subject:\npdfjs-document-properties-keywords = Keywords:\npdfjs-document-properties-creation-date = Creation Date:\npdfjs-document-properties-modification-date = Modification Date:\npdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }\npdfjs-document-properties-creator = Creator:\npdfjs-document-properties-producer = PDF Producer:\npdfjs-document-properties-version = PDF Version:\npdfjs-document-properties-page-count = Page Count:\npdfjs-document-properties-page-size = Page Size:\npdfjs-document-properties-page-size-unit-inches = in\npdfjs-document-properties-page-size-unit-millimeters = mm\npdfjs-document-properties-page-size-orientation-portrait = portrait\npdfjs-document-properties-page-size-orientation-landscape = landscape\npdfjs-document-properties-page-size-name-a-three = A3\npdfjs-document-properties-page-size-name-a-four = A4\npdfjs-document-properties-page-size-name-letter = Letter\npdfjs-document-properties-page-size-name-legal = Legal\npdfjs-document-properties-page-size-dimension-string = { $width } × { $height } { $unit } ({ $orientation })\npdfjs-document-properties-page-size-dimension-name-string = { $width } × { $height } { $unit } ({ $name }, { $orientation })\npdfjs-document-properties-linearized = Fast Web View:\npdfjs-document-properties-linearized-yes = Yes\npdfjs-document-properties-linearized-no = No\npdfjs-document-properties-close-button = Close\npdfjs-print-progress-message = Preparing document for printing…\npdfjs-print-progress-percent = { $progress }%\npdfjs-print-progress-close-button = Cancel\npdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.\npdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.\npdfjs-toggle-sidebar-button =\n .title = Toggle Sidebar\npdfjs-toggle-sidebar-notification-button =\n .title = Toggle Sidebar (document contains outline/attachments/layers)\npdfjs-toggle-sidebar-button-label = Toggle Sidebar\npdfjs-document-outline-button =\n .title = Show Document Outline (double-click to expand/collapse all items)\npdfjs-document-outline-button-label = Document Outline\npdfjs-attachments-button =\n .title = Show Attachments\npdfjs-attachments-button-label = Attachments\npdfjs-layers-button =\n .title = Show Layers (double-click to reset all layers to the default state)\npdfjs-layers-button-label = Layers\npdfjs-thumbs-button =\n .title = Show Thumbnails\npdfjs-thumbs-button-label = Thumbnails\npdfjs-current-outline-item-button =\n .title = Find Current Outline Item\npdfjs-current-outline-item-button-label = Current Outline Item\npdfjs-findbar-button =\n .title = Find in Document\npdfjs-findbar-button-label = Find\npdfjs-additional-layers = Additional Layers\npdfjs-thumb-page-title =\n .title = Page { $page }\npdfjs-thumb-page-canvas =\n .aria-label = Thumbnail of Page { $page }\npdfjs-find-input =\n .title = Find\n .placeholder = Find in document…\npdfjs-find-previous-button =\n .title = Find the previous occurrence of the phrase\npdfjs-find-previous-button-label = Previous\npdfjs-find-next-button =\n .title = Find the next occurrence of the phrase\npdfjs-find-next-button-label = Next\npdfjs-find-highlight-checkbox = Highlight All\npdfjs-find-match-case-checkbox-label = Match Case\npdfjs-find-match-diacritics-checkbox-label = Match Diacritics\npdfjs-find-entire-word-checkbox-label = Whole Words\npdfjs-find-reached-top = Reached top of document, continued from bottom\npdfjs-find-reached-bottom = Reached end of document, continued from top\npdfjs-find-match-count =\n { $total ->\n [one] { $current } of { $total } match\n *[other] { $current } of { $total } matches\n }\npdfjs-find-match-count-limit =\n { $limit ->\n [one] More than { $limit } match\n *[other] More than { $limit } matches\n }\npdfjs-find-not-found = Phrase not found\npdfjs-page-scale-width = Page Width\npdfjs-page-scale-fit = Page Fit\npdfjs-page-scale-auto = Automatic Zoom\npdfjs-page-scale-actual = Actual Size\npdfjs-page-scale-percent = { $scale }%\npdfjs-page-landmark =\n .aria-label = Page { $page }\npdfjs-loading-error = An error occurred while loading the PDF.\npdfjs-invalid-file-error = Invalid or corrupted PDF file.\npdfjs-missing-file-error = Missing PDF file.\npdfjs-unexpected-response-error = Unexpected server response.\npdfjs-rendering-error = An error occurred while rendering the page.\npdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }\npdfjs-text-annotation-type =\n .alt = [{ $type } Annotation]\npdfjs-password-label = Enter the password to open this PDF file.\npdfjs-password-invalid = Invalid password. Please try again.\npdfjs-password-ok-button = OK\npdfjs-password-cancel-button = Cancel\npdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.\npdfjs-editor-free-text-button =\n .title = Text\npdfjs-editor-color-picker-free-text-input =\n .title = Change text color\npdfjs-editor-free-text-button-label = Text\npdfjs-editor-ink-button =\n .title = Draw\npdfjs-editor-color-picker-ink-input =\n .title = Change drawing color\npdfjs-editor-ink-button-label = Draw\npdfjs-editor-stamp-button =\n .title = Add or edit images\npdfjs-editor-stamp-button-label = Add or edit images\npdfjs-editor-highlight-button =\n .title = Highlight\npdfjs-editor-highlight-button-label = Highlight\npdfjs-highlight-floating-button1 =\n .title = Highlight\n .aria-label = Highlight\npdfjs-highlight-floating-button-label = Highlight\npdfjs-editor-signature-button =\n .title = Add signature\npdfjs-editor-signature-button-label = Add signature\npdfjs-editor-highlight-editor =\n .aria-label = Highlight editor\npdfjs-editor-ink-editor =\n .aria-label = Drawing editor\npdfjs-editor-signature-editor1 =\n .aria-description = Signature editor: { $description }\npdfjs-editor-stamp-editor =\n .aria-label = Image editor\npdfjs-editor-remove-ink-button =\n .title = Remove drawing\npdfjs-editor-remove-freetext-button =\n .title = Remove text\npdfjs-editor-remove-stamp-button =\n .title = Remove image\npdfjs-editor-remove-highlight-button =\n .title = Remove highlight\npdfjs-editor-remove-signature-button =\n .title = Remove signature\npdfjs-editor-free-text-color-input = Color\npdfjs-editor-free-text-size-input = Size\npdfjs-editor-ink-color-input = Color\npdfjs-editor-ink-thickness-input = Thickness\npdfjs-editor-ink-opacity-input = Opacity\npdfjs-editor-stamp-add-image-button =\n .title = Add image\npdfjs-editor-stamp-add-image-button-label = Add image\npdfjs-editor-free-highlight-thickness-input = Thickness\npdfjs-editor-free-highlight-thickness-title =\n .title = Change thickness when highlighting items other than text\npdfjs-editor-add-signature-container =\n .aria-label = Signature controls and saved signatures\npdfjs-editor-signature-add-signature-button =\n .title = Add new signature\npdfjs-editor-signature-add-signature-button-label = Add new signature\npdfjs-editor-add-saved-signature-button =\n .title = Saved signature: { $description }\npdfjs-free-text2 =\n .aria-label = Text Editor\n .default-content = Start typing…\npdfjs-editor-alt-text-button =\n .aria-label = Alt text\npdfjs-editor-alt-text-button-label = Alt text\npdfjs-editor-alt-text-edit-button =\n .aria-label = Edit alt text\npdfjs-editor-alt-text-dialog-label = Choose an option\npdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can’t see the image or when it doesn’t load.\npdfjs-editor-alt-text-add-description-label = Add a description\npdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.\npdfjs-editor-alt-text-mark-decorative-label = Mark as decorative\npdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.\npdfjs-editor-alt-text-cancel-button = Cancel\npdfjs-editor-alt-text-save-button = Save\npdfjs-editor-alt-text-decorative-tooltip = Marked as decorative\npdfjs-editor-alt-text-textarea =\n .placeholder = For example, “A young man sits down at a table to eat a meal”\npdfjs-editor-resizer-top-left =\n .aria-label = Top left corner — resize\npdfjs-editor-resizer-top-middle =\n .aria-label = Top middle — resize\npdfjs-editor-resizer-top-right =\n .aria-label = Top right corner — resize\npdfjs-editor-resizer-middle-right =\n .aria-label = Middle right — resize\npdfjs-editor-resizer-bottom-right =\n .aria-label = Bottom right corner — resize\npdfjs-editor-resizer-bottom-middle =\n .aria-label = Bottom middle — resize\npdfjs-editor-resizer-bottom-left =\n .aria-label = Bottom left corner — resize\npdfjs-editor-resizer-middle-left =\n .aria-label = Middle left — resize\npdfjs-editor-highlight-colorpicker-label = Highlight color\npdfjs-editor-colorpicker-button =\n .title = Change color\npdfjs-editor-colorpicker-dropdown =\n .aria-label = Color choices\npdfjs-editor-colorpicker-yellow =\n .title = Yellow\npdfjs-editor-colorpicker-green =\n .title = Green\npdfjs-editor-colorpicker-blue =\n .title = Blue\npdfjs-editor-colorpicker-pink =\n .title = Pink\npdfjs-editor-colorpicker-red =\n .title = Red\npdfjs-editor-highlight-show-all-button-label = Show all\npdfjs-editor-highlight-show-all-button =\n .title = Show all\npdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)\npdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)\npdfjs-editor-new-alt-text-textarea =\n .placeholder = Write your description here…\npdfjs-editor-new-alt-text-description = Short description for people who can’t see the image or when the image doesn’t load.\npdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.\npdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more\npdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically\npdfjs-editor-new-alt-text-not-now-button = Not now\npdfjs-editor-new-alt-text-error-title = Couldn’t create alt text automatically\npdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.\npdfjs-editor-new-alt-text-error-close-button = Close\npdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\n .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\npdfjs-editor-new-alt-text-added-button =\n .aria-label = Alt text added\npdfjs-editor-new-alt-text-added-button-label = Alt text added\npdfjs-editor-new-alt-text-missing-button =\n .aria-label = Missing alt text\npdfjs-editor-new-alt-text-missing-button-label = Missing alt text\npdfjs-editor-new-alt-text-to-review-button =\n .aria-label = Review alt text\npdfjs-editor-new-alt-text-to-review-button-label = Review alt text\npdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }\npdfjs-image-alt-text-settings-button =\n .title = Image alt text settings\npdfjs-image-alt-text-settings-button-label = Image alt text settings\npdfjs-editor-alt-text-settings-dialog-label = Image alt text settings\npdfjs-editor-alt-text-settings-automatic-title = Automatic alt text\npdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically\npdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who can’t see the image or when the image doesn’t load.\npdfjs-editor-alt-text-settings-download-model-label = Alt text AI model ({ $totalSize } MB)\npdfjs-editor-alt-text-settings-ai-model-description = Runs locally on your device so your data stays private. Required for automatic alt text.\npdfjs-editor-alt-text-settings-delete-model-button = Delete\npdfjs-editor-alt-text-settings-download-model-button = Download\npdfjs-editor-alt-text-settings-downloading-model-button = Downloading…\npdfjs-editor-alt-text-settings-editor-title = Alt text editor\npdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image\npdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.\npdfjs-editor-alt-text-settings-close-button = Close\npdfjs-editor-highlight-added-alert = Highlight added\npdfjs-editor-freetext-added-alert = Text added\npdfjs-editor-ink-added-alert = Drawing added\npdfjs-editor-stamp-added-alert = Image added\npdfjs-editor-signature-added-alert = Signature added\npdfjs-editor-undo-bar-message-highlight = Highlight removed\npdfjs-editor-undo-bar-message-freetext = Text removed\npdfjs-editor-undo-bar-message-ink = Drawing removed\npdfjs-editor-undo-bar-message-stamp = Image removed\npdfjs-editor-undo-bar-message-signature = Signature removed\npdfjs-editor-undo-bar-message-multiple =\n { $count ->\n [one] { $count } annotation removed\n *[other] { $count } annotations removed\n }\npdfjs-editor-undo-bar-undo-button =\n .title = Undo\npdfjs-editor-undo-bar-undo-button-label = Undo\npdfjs-editor-undo-bar-close-button =\n .title = Close\npdfjs-editor-undo-bar-close-button-label = Close\npdfjs-editor-add-signature-dialog-label = This modal allows the user to create a signature to add to a PDF document. The user can edit the name (which also serves as the alt text), and optionally save the signature for repeated use.\npdfjs-editor-add-signature-dialog-title = Add a signature\npdfjs-editor-add-signature-type-button = Type\n .title = Type\npdfjs-editor-add-signature-draw-button = Draw\n .title = Draw\npdfjs-editor-add-signature-image-button = Image\n .title = Image\npdfjs-editor-add-signature-type-input =\n .aria-label = Type your signature\n .placeholder = Type your signature\npdfjs-editor-add-signature-draw-placeholder = Draw your signature\npdfjs-editor-add-signature-draw-thickness-range-label = Thickness\npdfjs-editor-add-signature-draw-thickness-range =\n .title = Drawing thickness: { $thickness }\npdfjs-editor-add-signature-image-placeholder = Drag a file here to upload\npdfjs-editor-add-signature-image-browse-link =\n { PLATFORM() ->\n [macos] Or choose image files\n *[other] Or browse image files\n }\npdfjs-editor-add-signature-description-label = Description (alt text)\npdfjs-editor-add-signature-description-input =\n .title = Description (alt text)\npdfjs-editor-add-signature-description-default-when-drawing = Signature\npdfjs-editor-add-signature-clear-button-label = Clear signature\npdfjs-editor-add-signature-clear-button =\n .title = Clear signature\npdfjs-editor-add-signature-save-checkbox = Save signature\npdfjs-editor-add-signature-save-warning-message = You’ve reached the limit of 5 saved signatures. Remove one to save more.\npdfjs-editor-add-signature-image-upload-error-title = Couldn’t upload image\npdfjs-editor-add-signature-image-upload-error-description = Check your network connection or try another image.\npdfjs-editor-add-signature-image-no-data-error-title = Can’t convert this image into a signature\npdfjs-editor-add-signature-image-no-data-error-description = Please try uploading a different image.\npdfjs-editor-add-signature-error-close-button = Close\npdfjs-editor-add-signature-cancel-button = Cancel\npdfjs-editor-add-signature-add-button = Add\npdfjs-editor-delete-signature-button1 =\n .title = Remove saved signature\npdfjs-editor-delete-signature-button-label1 = Remove saved signature\npdfjs-editor-add-signature-edit-button-label = Edit description\npdfjs-editor-edit-signature-dialog-title = Edit description\npdfjs-editor-edit-signature-update-button = Update\npdfjs-editor-edit-comment-actions-button-label = Actions\npdfjs-editor-edit-comment-actions-button =\n .title = Actions\npdfjs-editor-edit-comment-close-button-label = Close\npdfjs-editor-edit-comment-close-button =\n .title = Close\npdfjs-editor-edit-comment-actions-edit-button-label = Edit\npdfjs-editor-edit-comment-actions-delete-button-label = Delete\npdfjs-editor-edit-comment-manager-text-input =\n .placeholder = Enter your comment\npdfjs-editor-edit-comment-manager-cancel-button = Cancel\npdfjs-editor-edit-comment-manager-save-button = Save\npdfjs-editor-edit-comment-button =\n .title = Edit comment')},m(ua,ui);let No=ua;const Nx=1e3,Fx=50,Ox=1e3;function xp(){return document.location.hash}var kr,Q,Ms,ng,rg,vc,ag,pb,$_,U_,mb,W_,z_;class Bx{constructor({linkService:t,eventBus:e}){m(this,Q);m(this,kr,null);this.linkService=t,this.eventBus=e,this._initialized=!1,this._fingerprint="",this.reset(),this.eventBus._on("pagesinit",()=>{this._isPagesLoaded=!1,this.eventBus._on("pagesloaded",i=>{this._isPagesLoaded=!!i.pagesCount},{once:!0})})}initialize({fingerprint:t,resetHistory:e=!1,updateUrl:i=!1}){if(!t||typeof t!="string"){console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const s=this._fingerprint!==""&&this._fingerprint!==t;this._fingerprint=t,this._updateUrl=i===!0,this._initialized=!0,p(this,Q,W_).call(this);const n=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=xp(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!p(this,Q,vc).call(this,n,!0)||e){const{hash:o,page:l,rotation:c}=p(this,Q,pb).call(this,!0);if(!o||s||e){p(this,Q,Ms).call(this,null,!0);return}p(this,Q,Ms).call(this,{hash:o,page:l,rotation:c},!0);return}const a=n.destination;p(this,Q,ag).call(this,a,n.uid,!0),a.rotation!==void 0&&(this._initialRotation=a.rotation),a.dest?(this._initialBookmark=JSON.stringify(a.dest),this._destination.page=null):a.hash?this._initialBookmark=a.hash:a.page&&(this._initialBookmark="page=".concat(a.page))}reset(){this._initialized&&(p(this,Q,mb).call(this),this._initialized=!1,p(this,Q,z_).call(this)),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:t=null,explicitDest:e,pageNumber:i}){if(!this._initialized)return;if(t&&typeof t!="string"){console.error("PDFHistory.push: "+'"'.concat(t,'" is not a valid namedDest parameter.'));return}else if(Array.isArray(e)){if(!p(this,Q,rg).call(this,i)&&(i!==null||this._destination)){console.error("PDFHistory.push: "+'"'.concat(i,'" is not a valid pageNumber parameter.'));return}}else{console.error("PDFHistory.push: "+'"'.concat(e,'" is not a valid explicitDest parameter.'));return}const s=t||JSON.stringify(e);if(!s)return;let n=!1;if(this._destination&&(Vx(this._destination.hash,s)||Hx(this._destination.dest,e))){if(this._destination.page)return;n=!0}this._popStateInProgress&&!n||(p(this,Q,Ms).call(this,{dest:e,hash:s,page:i,rotation:this.linkService.rotation},n),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(t){var e;if(this._initialized){if(!p(this,Q,rg).call(this,t)){console.error('PDFHistory.pushPage: "'.concat(t,'" is not a valid page number.'));return}((e=this._destination)==null?void 0:e.page)!==t&&(this._popStateInProgress||(p(this,Q,Ms).call(this,{dest:null,hash:"page=".concat(t),page:t,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1}))))}}pushCurrentPosition(){!this._initialized||this._popStateInProgress||p(this,Q,ng).call(this)}back(){if(!this._initialized||this._popStateInProgress)return;const t=window.history.state;p(this,Q,vc).call(this,t)&&t.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const t=window.history.state;p(this,Q,vc).call(this,t)&&t.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}}kr=new WeakMap,Q=new WeakSet,Ms=function(t,e=!1){const i=e||!this._destination,s={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:t};p(this,Q,ag).call(this,t,s.uid);let n;if(this._updateUrl&&(t!=null&&t.hash)){const{href:a,protocol:o}=document.location;o!=="file:"&&(n=aP(a,t.hash))}i?window.history.replaceState(s,"",n):window.history.pushState(s,"",n)},ng=function(t=!1){if(!this._position)return;let e=this._position;if(t&&(e=Object.assign(Object.create(null),this._position),e.temporary=!0),!this._destination){p(this,Q,Ms).call(this,e);return}if(this._destination.temporary){p(this,Q,Ms).call(this,e,!0);return}if(this._destination.hash===e.hash||!this._destination.page&&this._numPositionUpdates<=Fx)return;let i=!1;if(this._destination.page>=e.first&&this._destination.page<=e.page){if(this._destination.dest!==void 0||!this._destination.first)return;i=!0}p(this,Q,Ms).call(this,e,i)},rg=function(t){return Number.isInteger(t)&&t>0&&t<=this.linkService.pagesCount},vc=function(t,e=!1){if(!t)return!1;if(t.fingerprint!==this._fingerprint)if(e){if(typeof t.fingerprint!="string"||t.fingerprint.length!==this._fingerprint.length)return!1;const[i]=performance.getEntriesByType("navigation");if((i==null?void 0:i.type)!=="reload")return!1}else return!1;return!(!Number.isInteger(t.uid)||t.uid<0||t.destination===null||typeof t.destination!="object")},ag=function(t,e,i=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),i&&(t!=null&&t.temporary)&&delete t.temporary,this._destination=t,this._uid=e,this._maxUid=Math.max(this._maxUid,e),this._numPositionUpdates=0},pb=function(t=!1){const e=unescape(xp()).substring(1),i=ap(e),s=i.get("nameddest")||"";let n=i.get("page")|0;return(!p(this,Q,rg).call(this,n)||t&&s.length>0)&&(n=null),{hash:e,page:n,rotation:this.linkService.rotation}},$_=function({location:t}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:t.pdfOpenParams.substring(1),page:this.linkService.page,first:t.pageNumber,rotation:t.rotation},!this._popStateInProgress&&(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||p(this,Q,ng).call(this,!0),this._updateViewareaTimeout=null},Ox))},U_=function({state:t}){const e=xp(),i=this._currentHash!==e;if(this._currentHash=e,!t){this._uid++;const{hash:n,page:a,rotation:o}=p(this,Q,pb).call(this);p(this,Q,Ms).call(this,{hash:n,page:a,rotation:o},!0);return}if(!p(this,Q,vc).call(this,t))return;this._popStateInProgress=!0,i&&(this._blockHashChange++,HP({target:window,name:"hashchange",delay:Nx}).then(()=>{this._blockHashChange--}));const s=t.destination;p(this,Q,ag).call(this,s,t.uid,!0),y_(s.rotation)&&(this.linkService.rotation=s.rotation),s.dest?this.linkService.goToDestination(s.dest):s.hash?this.linkService.setHash(s.hash):s.page&&(this.linkService.page=s.page),Promise.resolve().then(()=>{this._popStateInProgress=!1})},mb=function(){(!this._destination||this._destination.temporary)&&p(this,Q,ng).call(this)},W_=function(){if(r(this,kr))return;f(this,kr,new AbortController);const{signal:t}=r(this,kr);this.eventBus._on("updateviewarea",p(this,Q,$_).bind(this),{signal:t}),window.addEventListener("popstate",p(this,Q,U_).bind(this),{signal:t}),window.addEventListener("pagehide",p(this,Q,mb).bind(this),{signal:t})},z_=function(){var t;(t=r(this,kr))==null||t.abort(),f(this,kr,null)};function Vx(h,t){return typeof h!="string"||typeof t!="string"?!1:h===t||ap(h).get("nameddest")===t}function Hx(h,t){function e(i,s){if(typeof i!=typeof s||Array.isArray(i)||Array.isArray(s))return!1;if(i!==null&&typeof i=="object"&&s!==null){if(Object.keys(i).length!==Object.keys(s).length)return!1;for(const n in i)if(!e(i[n],s[n]))return!1;return!0}return i===s||Number.isNaN(i)&&Number.isNaN(s)}if(!(Array.isArray(h)&&Array.isArray(t))||h.length!==t.length)return!1;for(let i=0,s=h.length;i<s;i++)if(!e(h[i],t[i]))return!1;return!0}var vu,yu,_u,Au,Eu,Ah;class jx{constructor(t){m(this,vu,null);m(this,yu,null);m(this,_u,null);m(this,Au,null);m(this,Eu,null);m(this,Ah);this.pdfPage=t.pdfPage,this.accessibilityManager=t.accessibilityManager,this.l10n=t.l10n,this.l10n||(this.l10n=new No),this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,f(this,Ah,t.uiManager),f(this,vu,t.annotationLayer||null),f(this,Eu,t.textLayer||null),f(this,yu,t.drawLayer||null),f(this,_u,t.onAppend||null),f(this,Au,t.structTreeLayer||null)}async render({viewport:t,intent:e="display"}){var a;if(e!=="display"||this._cancelled)return;const i=t.clone({dontFlip:!0});if(this.div){this.annotationEditorLayer.update({viewport:i}),this.show();return}const s=this.div=document.createElement("div");s.className="annotationEditorLayer",s.hidden=!0,s.dir=r(this,Ah).direction,(a=r(this,_u))==null||a.call(this,s),this.annotationEditorLayer=new KS({uiManager:r(this,Ah),div:s,structTreeLayer:r(this,Au),accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage.pageNumber-1,l10n:this.l10n,viewport:i,annotationLayer:r(this,vu),textLayer:r(this,Eu),drawLayer:r(this,yu)});const n={viewport:i,div:s,annotations:null,intent:e};this.annotationEditorLayer.render(n),this.show()}cancel(){this._cancelled=!0,this.div&&this.annotationEditorLayer.destroy()}hide(){this.div&&(this.annotationEditorLayer.pause(!0),this.div.hidden=!0)}show(){!this.div||this.annotationEditorLayer.isInvisible||(this.div.hidden=!1,this.annotationEditorLayer.pause(!1))}}vu=new WeakMap,yu=new WeakMap,_u=new WeakMap,Au=new WeakMap,Eu=new WeakMap,Ah=new WeakMap;{var bb=new Map;const{maxTouchPoints:h,platform:t,userAgent:e}=navigator,i=/Android/.test(e),s=/\b(iPad|iPhone|iPod)(?=;)/.test(e)||t==="MacIntel"&&h>1;(function(){(s||i)&&bb.set("maxCanvasPixels",5242880)})(),function(){i&&bb.set("useSystemFonts",!1)}()}const R={BROWSER:1,VIEWER:2,API:4,WORKER:8,EVENT_DISPATCH:16,PREFERENCE:128},wb={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},Pn={allowedGlobalEvents:{value:null,kind:R.BROWSER},canvasMaxAreaInBytes:{value:-1,kind:R.BROWSER+R.API},isInAutomation:{value:!1,kind:R.BROWSER},localeProperties:{value:{lang:navigator.language||"en-US"},kind:R.BROWSER},maxCanvasDim:{value:32767,kind:R.BROWSER+R.VIEWER},nimbusDataStr:{value:"",kind:R.BROWSER},supportsCaretBrowsingMode:{value:!1,kind:R.BROWSER},supportsDocumentFonts:{value:!0,kind:R.BROWSER},supportsIntegratedFind:{value:!1,kind:R.BROWSER},supportsMouseWheelZoomCtrlKey:{value:!0,kind:R.BROWSER},supportsMouseWheelZoomMetaKey:{value:!0,kind:R.BROWSER},supportsPinchToZoom:{value:!0,kind:R.BROWSER},supportsPrinting:{value:!0,kind:R.BROWSER},toolbarDensity:{value:0,kind:R.BROWSER+R.EVENT_DISPATCH},altTextLearnMoreUrl:{value:"",kind:R.VIEWER+R.PREFERENCE},annotationEditorMode:{value:0,kind:R.VIEWER+R.PREFERENCE},annotationMode:{value:2,kind:R.VIEWER+R.PREFERENCE},capCanvasAreaFactor:{value:200,kind:R.VIEWER+R.PREFERENCE},cursorToolOnLoad:{value:0,kind:R.VIEWER+R.PREFERENCE},debuggerSrc:{value:"./debugger.mjs",kind:R.VIEWER},defaultZoomDelay:{value:400,kind:R.VIEWER+R.PREFERENCE},defaultZoomValue:{value:"",kind:R.VIEWER+R.PREFERENCE},disableHistory:{value:!1,kind:R.VIEWER},disablePageLabels:{value:!1,kind:R.VIEWER+R.PREFERENCE},enableAltText:{value:!1,kind:R.VIEWER+R.PREFERENCE},enableAltTextModelDownload:{value:!0,kind:R.VIEWER+R.PREFERENCE+R.EVENT_DISPATCH},enableAutoLinking:{value:!0,kind:R.VIEWER+R.PREFERENCE},enableComment:{value:!1,kind:R.VIEWER+R.PREFERENCE},enableDetailCanvas:{value:!0,kind:R.VIEWER},enableGuessAltText:{value:!0,kind:R.VIEWER+R.PREFERENCE+R.EVENT_DISPATCH},enableHighlightFloatingButton:{value:!1,kind:R.VIEWER+R.PREFERENCE},enableNewAltTextWhenAddingImage:{value:!0,kind:R.VIEWER+R.PREFERENCE},enablePermissions:{value:!1,kind:R.VIEWER+R.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:R.VIEWER+R.PREFERENCE},enableScripting:{value:!0,kind:R.VIEWER+R.PREFERENCE},enableSignatureEditor:{value:!1,kind:R.VIEWER+R.PREFERENCE},enableUpdatedAddImage:{value:!1,kind:R.VIEWER+R.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:R.VIEWER},externalLinkTarget:{value:0,kind:R.VIEWER+R.PREFERENCE},highlightEditorColors:{value:"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F,yellow_HCM=#FFFFCC,green_HCM=#53FFBC,blue_HCM=#80EBFF,pink_HCM=#F6B8FF,red_HCM=#C50043",kind:R.VIEWER+R.PREFERENCE},historyUpdateUrl:{value:!1,kind:R.VIEWER+R.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:R.VIEWER+R.PREFERENCE},imageResourcesPath:{value:"./images/",kind:R.VIEWER},maxCanvasPixels:{value:2**25,kind:R.VIEWER},minDurationToUpdateCanvas:{value:500,kind:R.VIEWER},forcePageColors:{value:!1,kind:R.VIEWER+R.PREFERENCE},pageColorsBackground:{value:"Canvas",kind:R.VIEWER+R.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:R.VIEWER+R.PREFERENCE},pdfBugEnabled:{value:!1,kind:R.VIEWER+R.PREFERENCE},printResolution:{value:150,kind:R.VIEWER},sidebarViewOnLoad:{value:-1,kind:R.VIEWER+R.PREFERENCE},scrollModeOnLoad:{value:-1,kind:R.VIEWER+R.PREFERENCE},spreadModeOnLoad:{value:-1,kind:R.VIEWER+R.PREFERENCE},textLayerMode:{value:1,kind:R.VIEWER+R.PREFERENCE},viewerCssTheme:{value:0,kind:R.VIEWER+R.PREFERENCE},viewOnLoad:{value:0,kind:R.VIEWER+R.PREFERENCE},cMapPacked:{value:!0,kind:R.API},cMapUrl:{value:"../web/cmaps/",kind:R.API},disableAutoFetch:{value:!1,kind:R.API+R.PREFERENCE},disableFontFace:{value:!1,kind:R.API+R.PREFERENCE},disableRange:{value:!1,kind:R.API+R.PREFERENCE},disableStream:{value:!1,kind:R.API+R.PREFERENCE},docBaseUrl:{value:"",kind:R.API},enableHWA:{value:!0,kind:R.API+R.VIEWER+R.PREFERENCE},enableXfa:{value:!0,kind:R.API+R.PREFERENCE},fontExtraProperties:{value:!1,kind:R.API},iccUrl:{value:"../web/iccs/",kind:R.API},isEvalSupported:{value:!0,kind:R.API},isOffscreenCanvasSupported:{value:!0,kind:R.API},maxImageSize:{value:-1,kind:R.API},pdfBug:{value:!1,kind:R.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:R.API},useSystemFonts:{value:void 0,kind:R.API,type:wb.BOOLEAN+wb.UNDEFINED},verbosity:{value:1,kind:R.API},wasmUrl:{value:"../web/wasm/",kind:R.API},workerPort:{value:null,kind:R.WORKER},workerSrc:{value:"../build/pdf.worker.mjs",kind:R.WORKER}};Pn.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:R.VIEWER},Pn.sandboxBundleSrc={value:"../build/pdf.sandbox.mjs",kind:R.VIEWER},Pn.enableFakeMLManager={value:!0,kind:R.VIEWER};Pn.disablePreferences={value:!1,kind:R.VIEWER};var Dr;const Ji=class Ji{static get(t){return r(this,Dr).get(t)}static getAll(t=null,e=!1){const i=Object.create(null);for(const s in Pn){const n=Pn[s];t&&!(t&n.kind)||(i[s]=e?n.value:r(this,Dr).get(s))}return i}static set(t,e){this.setAll({[t]:e})}static setAll(t,e=!1){this._hasInvokedSet||(this._hasInvokedSet=!0);let i;for(const s in t){const n=Pn[s],a=t[s];if(!n||!(typeof a==typeof n.value||wb[(typeof a).toUpperCase()]&n.type))continue;const{kind:o}=n;e&&!(o&R.BROWSER||o&R.PREFERENCE)||(this.eventBus&&o&R.EVENT_DISPATCH&&(i||(i=new Map)).set(s,a),r(this,Dr).set(s,a))}if(i)for(const[s,n]of i)this.eventBus.dispatch(s.toLowerCase(),{source:this,value:n})}};Dr=new WeakMap,k(Ji,"eventBus"),m(Ji,Dr,new Map),(()=>{for(const t in Pn)r(Ji,Dr).set(t,Pn[t].value);for(const[t,e]of bb)r(Ji,Dr).set(t,e);Ji._hasInvokedSet=!1,Ji._checkDisablePreferences=()=>Ji.get("disablePreferences")?!0:(Ji._hasInvokedSet&&console.warn('The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.'),!1)})();let Tc=Ji;function wv({width:h,height:t,left:e,top:i},s){if(h===0||t===0)return null;const n=s.textLayer.div.getBoundingClientRect(),a=s.getPagePoint(e-n.left,i-n.top),o=s.getPagePoint(e-n.left+h,i-n.top+t);return nw.normalizeRect([a[0],a[1],o[0],o[1]])}function $x(h,t){const e=h.getClientRects();if(e.length===1)return{rect:wv(e[0],t)};const i=[1/0,1/0,-1/0,-1/0],s=[];let n=0;for(const a of e){const o=wv(a,t);o!==null&&(s[n]=s[n+4]=o[0],s[n+1]=s[n+3]=o[3],s[n+2]=s[n+6]=o[2],s[n+5]=s[n+7]=o[1],nw.rectBoundingBox(...o,i),n+=8)}return{quadPoints:s,rect:i}}function vv(h,t){let e=h;do{if(e.nodeType===Node.TEXT_NODE){const i=e.textContent.length;if(t<=i)return[e,t];t-=i}else if(e.firstChild){e=e.firstChild;continue}for(;!e.nextSibling&&e!==h;)e=e.parentNode;e!==h&&(e=e.nextSibling)}while(e!==h);throw new Error("Offset is bigger than container's contents length.")}function Ux({url:h,index:t,length:e},i,s){const n=i._textHighlighter,[{begin:a,end:o}]=n._convertMatches([t],[e]),l=new Range;return l.setStart(...vv(n.textDivs[a.divIdx],a.offset)),l.setEnd(...vv(n.textDivs[o.divIdx],o.offset)),{id:"inferred_link_".concat(s),unsafeUrl:h,url:h,annotationType:g_.LINK,rotation:0,...$x(l,i),borderStyle:null}}var Yg,Su;class vb{static findLinks(t){var a;(a=r(this,Su))!=null||f(this,Su,new RegExp("\\b(?:https?:\\/\\/|mailto:|www\\.)(?:[\\S--[\\p{P}<>]]|\\/|[\\S--[\\[\\]]]+[\\S--[\\p{P}<>]])+|\\b[\\S--[@\\p{Ps}\\p{Pe}<>]]+@([\\S--[\\p{P}<>]]+(?:\\.[\\S--[\\p{P}<>]]+)+)","gmv"));const[e,i]=eg(t,{ignoreDashEOL:!0}),s=e.matchAll(r(this,Su)),n=[];for(const o of s){const[l,c]=o;let d;if(l.startsWith("www.")||l.startsWith("http://")||l.startsWith("https://"))d=l;else if(URL.canParse("http://".concat(c)))d=l.startsWith("mailto:")?l:"mailto:".concat(l);else continue;const u=p_(d,null,{addDefaultProtocol:!0});if(u){const[g,b]=__(i,o.index,l.length);n.push({url:u.href,index:g,length:b})}}return n}static processLinks(t){return this.findLinks(t._textHighlighter.textContentItemsStr.join("\n")).map(e=>Ux(e,t,se(this,Yg)._++))}}Yg=new WeakMap,Su=new WeakMap,m(vb,Yg,0),m(vb,Su);var Nr,Eh,Sh,Ph,pn,Fr,mn,Kg,Pu,yb;class G_{constructor(t){m(this,Pu);m(this,Nr,null);m(this,Eh,0);m(this,Sh,null);m(this,Ph,ct.INITIAL);m(this,pn,null);m(this,Fr,0);m(this,mn,null);k(this,"canvas",null);k(this,"div",null);k(this,"eventBus",null);k(this,"id",null);k(this,"pageColors",null);k(this,"renderingQueue",null);k(this,"renderTask",null);k(this,"resume",null);m(this,Kg,t=>{var e;if((e=r(this,pn))==null||e.call(this,!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this)){this.renderingState=ct.PAUSED,this.resume=()=>{this.renderingState=ct.RUNNING,t()};return}t()});var e;this.eventBus=t.eventBus,this.id=t.id,this.pageColors=t.pageColors||null,this.renderingQueue=t.renderingQueue,f(this,Eh,(e=t.minDurationToUpdateCanvas)!=null?e:500)}get renderingState(){return r(this,Ph)}set renderingState(t){var e;if(t!==r(this,Ph))switch(f(this,Ph,t),r(this,Nr)&&(clearTimeout(r(this,Nr)),f(this,Nr,null)),t){case ct.PAUSED:this.div.classList.remove("loading"),f(this,Fr,0),(e=r(this,pn))==null||e.call(this,!1);break;case ct.RUNNING:this.div.classList.add("loadingIcon"),f(this,Nr,setTimeout(()=>{this.div.classList.add("loading"),f(this,Nr,null)},0)),f(this,Fr,Date.now());break;case ct.INITIAL:case ct.FINISHED:this.div.classList.remove("loadingIcon","loading"),f(this,Fr,0);break}}_createCanvas(t,e=!1){const{pageColors:i}=this,s=!!(i!=null&&i.background&&(i!=null&&i.foreground)),n=this.canvas,a=!n&&!s&&!e;let o=this.canvas=document.createElement("canvas");return f(this,pn,l=>{if(a){let c=r(this,mn);if(!l&&r(this,Eh)>0){if(Date.now()-r(this,Fr)<r(this,Eh))return;c||(c=f(this,mn,o),o=this.canvas=o.cloneNode(!1),t(o))}if(c){o.getContext("2d",{alpha:!1}).drawImage(c,0,0),l?p(this,Pu,yb).call(this):f(this,Fr,Date.now());return}t(o),f(this,pn,null);return}l&&(n?(n.replaceWith(o),n.width=n.height=0):t(o))}),{canvas:o,prevCanvas:n}}_resetCanvas(){const{canvas:t}=this;t&&(t.remove(),t.width=t.height=0,this.canvas=null,p(this,Pu,yb).call(this))}async _drawCanvas(t,e,i){var a,o;const s=this.renderTask=this.pdfPage.render(t);s.onContinue=r(this,Kg),s.onError=l=>{l instanceof Jm&&(e(),f(this,Sh,null))};let n=null;try{await s.promise,(a=r(this,pn))==null||a.call(this,!0)}catch(l){if(l instanceof Jm)return;n=l,(o=r(this,pn))==null||o.call(this,!0)}finally{f(this,Sh,n),s===this.renderTask&&(this.renderTask=null)}if(this.renderingState=ct.FINISHED,i(s),n)throw n}cancelRendering({cancelExtraDelay:t=0}={}){this.renderTask&&(this.renderTask.cancel(t),this.renderTask=null),this.resume=null}dispatchPageRender(){this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id})}dispatchPageRendered(t,e){this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:t,isDetailView:e,timestamp:performance.now(),error:r(this,Sh)})}}Nr=new WeakMap,Eh=new WeakMap,Sh=new WeakMap,Ph=new WeakMap,pn=new WeakMap,Fr=new WeakMap,mn=new WeakMap,Kg=new WeakMap,Pu=new WeakSet,yb=function(){r(this,mn)&&(r(this,mn).width=r(this,mn).height=0,f(this,mn,null))};var ys;class Wx{constructor(t){m(this,ys,null);this.pageIndex=t.pageIndex}async render({intent:t="display"}){t!=="display"||r(this,ys)||this._cancelled||f(this,ys,new JS({pageIndex:this.pageIndex}))}cancel(){this._cancelled=!0,r(this,ys)&&(r(this,ys).destroy(),f(this,ys,null))}setParent(t){var e;(e=r(this,ys))==null||e.setParent(t)}getDrawLayer(){return r(this,ys)}}ys=new WeakMap;var Hi,Zg,X_;class zx extends G_{constructor({pageView:e}){super(e);m(this,Zg);m(this,Hi,null);k(this,"renderingCancelled",!1);this.pageView=e,this.renderingId="detail"+this.id,this.div=e.div}setPdfPage(e){this.pageView.setPdfPage(e)}get pdfPage(){return this.pageView.pdfPage}get renderingState(){return super.renderingState}set renderingState(e){this.renderingCancelled=!1,super.renderingState=e}reset({keepCanvas:e=!1}={}){const i=this.renderingCancelled||this.renderingState===ct.RUNNING||this.renderingState===ct.PAUSED;this.cancelRendering(),this.renderingState=ct.INITIAL,this.renderingCancelled=i,e||this._resetCanvas()}update({visibleArea:e=null,underlyingViewUpdated:i=!1}={}){if(i){this.cancelRendering(),this.renderingState=ct.INITIAL;return}if(!p(this,Zg,X_).call(this,e))return;const{viewport:s,maxCanvasPixels:n,capCanvasAreaFactor:a}=this.pageView,o=e.maxX-e.minX,l=e.maxY-e.minY,c=o*l*tg.pixelRatio**2,u=(Math.sqrt(tg.capPixels(n,a)/c)-1)/2;let g=Math.min(1,u);g<0&&(g=0);const b=o*g,w=l*g,v=Math.max(0,e.minX-b),A=Math.min(s.width,e.maxX+b),y=Math.max(0,e.minY-w),S=Math.min(s.height,e.maxY+w),_=A-v,E=S-y;f(this,Hi,{minX:v,minY:y,width:_,height:E,scale:s.scale}),this.reset({keepCanvas:!0})}async draw(){if(this.pageView.detailView!==this)return;const e=this.pageView.renderingState===ct.FINISHED||this.renderingState===ct.FINISHED;this.renderingState!==ct.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:i,pdfPage:s,viewport:n}=this.pageView;if(!s)throw this.renderingState=ct.FINISHED,new Error("pdfPage is not loaded");this.renderingState=ct.RUNNING;const a=this.pageView._ensureCanvasWrapper(),{canvas:o,prevCanvas:l}=this._createCanvas(A=>{var y;((y=a.firstElementChild)==null?void 0:y.tagName)==="CANVAS"?a.firstElementChild.after(A):a.prepend(A)},e);o.setAttribute("aria-hidden","true");const{width:c,height:d}=n,u=r(this,Hi),{pixelRatio:g}=tg,b=[g,0,0,g,-u.minX*g,-u.minY*g];o.width=u.width*g,o.height=u.height*g;const{style:w}=o;w.width="".concat(u.width*100/c,"%"),w.height="".concat(u.height*100/d,"%"),w.top="".concat(u.minY*100/d,"%"),w.left="".concat(u.minX*100/c,"%");const v=this._drawCanvas(this.pageView._getRenderingContext(o,b),()=>{var A;(A=this.canvas)==null||A.remove(),this.canvas=l},()=>{this.dispatchPageRendered(!1,!0)});return i.setAttribute("data-loaded",!0),this.dispatchPageRender(),v}}Hi=new WeakMap,Zg=new WeakSet,X_=function(e){if(!r(this,Hi))return!0;const i=r(this,Hi).minX,s=r(this,Hi).minY,n=r(this,Hi).width+i,a=r(this,Hi).height+s;if(e.minX<i||e.minY<s||e.maxX>n||e.maxY>a)return!0;const{width:o,height:l,scale:c}=this.pageView.viewport;if(r(this,Hi).scale!==c)return!0;const d=e.minX-i,u=n-e.maxX,g=e.minY-s,b=a-e.maxY,w=.5,v=(1+w)/w;return i>0&&u/d>v||n<o&&d/u>v||s>0&&b/g>v||a<l&&g/b>v};const yv={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},Gx=/^H(\d+)$/;var xh,ji,Ch,Th,Ih,Or,Ts,_b,Y_,Ab;class q_{constructor(t,e){m(this,Ts);m(this,xh);m(this,ji,null);m(this,Ch);m(this,Th,new Map);m(this,Ih);m(this,Or,null);f(this,xh,t.getStructTree()),f(this,Ih,e)}async render(){var s;if(r(this,Ch))return r(this,Ch);const{promise:t,resolve:e,reject:i}=Promise.withResolvers();f(this,Ch,t);try{f(this,ji,p(this,Ts,Ab).call(this,await r(this,xh)))}catch(n){i(n)}return f(this,xh,null),(s=r(this,ji))==null||s.classList.add("structTree"),e(r(this,ji)),t}async getAriaAttributes(t){try{return await this.render(),r(this,Th).get(t)}catch(e){}return null}hide(){r(this,ji)&&!r(this,ji).hidden&&(r(this,ji).hidden=!0)}show(){var t;(t=r(this,ji))!=null&&t.hidden&&(r(this,ji).hidden=!1)}addElementsToTextLayer(){var t;if(r(this,Or)){for(const[e,i]of r(this,Or))(t=document.getElementById(e))==null||t.append(i);r(this,Or).clear(),f(this,Or,null)}}}xh=new WeakMap,ji=new WeakMap,Ch=new WeakMap,Th=new WeakMap,Ih=new WeakMap,Or=new WeakMap,Ts=new WeakSet,_b=function(t,e){const{alt:i,id:s,lang:n}=t;if(i!==void 0){let a=!1;const o=Cc(i);for(const l of t.children)if(l.type==="annotation"){let c=r(this,Th).get(l.id);c||(c=new Map,r(this,Th).set(l.id,c)),c.set("aria-label",o),a=!0}a||e.setAttribute("aria-label",o)}s!==void 0&&e.setAttribute("aria-owns",s),n!==void 0&&e.setAttribute("lang",Cc(n,!0))},Y_=function(t,e){const{alt:i,bbox:s,children:n}=t,a=n==null?void 0:n[0];if(!r(this,Ih)||!i||!s||(a==null?void 0:a.type)!=="content")return!1;const{id:o}=a;if(!o)return!1;e.setAttribute("aria-owns",o);const l=document.createElement("span");(r(this,Or)||f(this,Or,new Map)).set(o,l),l.setAttribute("role","img"),l.setAttribute("aria-label",Cc(i));const{pageHeight:c,pageX:d,pageY:u}=r(this,Ih),g="calc(var(--total-scale-factor) *",{style:b}=l;return b.width="".concat(g).concat(s[2]-s[0],"px)"),b.height="".concat(g).concat(s[3]-s[1],"px)"),b.left="".concat(g).concat(s[0]-d,"px)"),b.top="".concat(g).concat(c-s[3]+u,"px)"),!0},Ab=function(t){if(!t)return null;const e=document.createElement("span");if("role"in t){const{role:i}=t,s=i.match(Gx);if(s?(e.setAttribute("role","heading"),e.setAttribute("aria-level",s[1])):yv[i]&&e.setAttribute("role",yv[i]),i==="Figure"&&p(this,Ts,Y_).call(this,t,e))return e}if(p(this,Ts,_b).call(this,t,e),t.children)if(t.children.length===1&&"id"in t.children[0])p(this,Ts,_b).call(this,t.children[0],e);else for(const i of t.children)e.append(p(this,Ts,Ab).call(this,i));return e};var bn,Ei,wn,Br,Lh,og,xu,Sb;const il=class il{constructor(){m(this,xu);m(this,bn,!1);m(this,Ei,null);m(this,wn,new Map);m(this,Br,new Map)}setTextMapping(t){f(this,Ei,t)}enable(){if(r(this,bn))throw new Error("TextAccessibilityManager is already enabled.");if(!r(this,Ei))throw new Error("Text divs and strings have not been set.");if(f(this,bn,!0),f(this,Ei,r(this,Ei).slice()),r(this,Ei).sort(p(il,Lh,og)),r(this,wn).size>0){const t=r(this,Ei);for(const[e,i]of r(this,wn)){if(!document.getElementById(e)){r(this,wn).delete(e);continue}p(this,xu,Sb).call(this,e,t[i])}}for(const[t,e]of r(this,Br))this.addPointerInTextLayer(t,e);r(this,Br).clear()}disable(){r(this,bn)&&(r(this,Br).clear(),f(this,Ei,null),f(this,bn,!1))}removePointerInTextLayer(t){if(!r(this,bn)){r(this,Br).delete(t);return}const e=r(this,Ei);if(!e||e.length===0)return;const{id:i}=t,s=r(this,wn).get(i);if(s===void 0)return;const n=e[s];r(this,wn).delete(i);let a=n.getAttribute("aria-owns");a!=null&&a.includes(i)&&(a=a.split(" ").filter(o=>o!==i).join(" "),a?n.setAttribute("aria-owns",a):(n.removeAttribute("aria-owns"),n.setAttribute("role","presentation")))}addPointerInTextLayer(t,e){const{id:i}=t;if(!i)return null;if(!r(this,bn))return r(this,Br).set(t,e),null;e&&this.removePointerInTextLayer(t);const s=r(this,Ei);if(!s||s.length===0)return null;const n=Oc(s,c=>{var d;return p(d=il,Lh,og).call(d,t,c)<0}),a=Math.max(0,n-1),o=s[a];p(this,xu,Sb).call(this,i,o),r(this,wn).set(i,a);const l=o.parentNode;return l!=null&&l.classList.contains("markedContent")?l.id:null}moveElementInDOM(t,e,i,s){const n=this.addPointerInTextLayer(i,s);if(!t.hasChildNodes())return t.append(e),n;const a=Array.from(t.childNodes).filter(c=>c!==e);if(a.length===0)return n;const o=i||e,l=Oc(a,c=>{var d;return p(d=il,Lh,og).call(d,o,c)<0});return l===0?a[0].before(e):a[l-1].after(e),n}};bn=new WeakMap,Ei=new WeakMap,wn=new WeakMap,Br=new WeakMap,Lh=new WeakSet,og=function(t,e){const i=t.getBoundingClientRect(),s=e.getBoundingClientRect();if(i.width===0&&i.height===0)return 1;if(s.width===0&&s.height===0)return-1;const n=i.y,a=i.y+i.height,o=i.y+i.height/2,l=s.y,c=s.y+s.height,d=s.y+s.height/2;if(o<=l&&d>=a)return-1;if(d<=n&&o>=c)return 1;const u=i.x+i.width/2,g=s.x+s.width/2;return u-g},xu=new WeakSet,Sb=function(t,e){const i=e.getAttribute("aria-owns");i!=null&&i.includes(t)||e.setAttribute("aria-owns",i?"".concat(i," ").concat(t):t),e.removeAttribute("role")},m(il,Lh);let Eb=il;var Vr;class Xx{constructor({findController:t,eventBus:e,pageIndex:i}){m(this,Vr,null);this.findController=t,this.matches=[],this.eventBus=e,this.pageIdx=i,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(t,e){this.textDivs=t,this.textContentItemsStr=e}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,r(this,Vr)||(f(this,Vr,new AbortController),this.eventBus._on("updatetextlayermatches",t=>{(t.pageIndex===this.pageIdx||t.pageIndex===-1)&&this._updateMatches()},{signal:r(this,Vr).signal})),this._updateMatches()}disable(){var t;this.enabled&&(this.enabled=!1,(t=r(this,Vr))==null||t.abort(),f(this,Vr,null),this._updateMatches(!0))}_convertMatches(t,e){if(!t)return[];const{textContentItemsStr:i}=this;let s=0,n=0;const a=i.length-1,o=[];for(let l=0,c=t.length;l<c;l++){let d=t[l];for(;s!==a&&d>=n+i[s].length;)n+=i[s].length,s++;s===i.length&&console.error("Could not find a matching mapping");const u={begin:{divIdx:s,offset:d-n}};for(d+=e[l];s!==a&&d>n+i[s].length;)n+=i[s].length,s++;u.end={divIdx:s,offset:d-n},o.push(u)}return o}_renderMatches(t){if(t.length===0)return;const{findController:e,pageIdx:i}=this,{textContentItemsStr:s,textDivs:n}=this,a=i===e.selected.pageIdx,o=e.selected.matchIdx,l=e.state.highlightAll;let c=null;const d={offset:void 0};function u(y,S){const _=y.divIdx;return n[_].textContent="",g(_,0,y.offset,S)}function g(y,S,_,E){let P=n[y];if(P.nodeType===Node.TEXT_NODE){const I=document.createElement("span");P.before(I),I.append(P),n[y]=I,P=I}const x=s[y].substring(S,_),T=document.createTextNode(x);if(E){const I=document.createElement("span");if(I.className="".concat(E," appended"),I.append(T),P.append(I),E.includes("selected")){const{left:C}=I.getClientRects()[0],L=P.getBoundingClientRect().left;return C-L}return 0}return P.append(T),0}let b=o,w=b+1;if(l)b=0,w=t.length;else if(!a)return;let v=-1,A=-1;for(let y=b;y<w;y++){const S=t[y],_=S.begin;if(_.divIdx===v&&_.offset===A)continue;v=_.divIdx,A=_.offset;const E=S.end,P=a&&y===o,x=P?" selected":"";let T=0;if(!c||_.divIdx!==c.divIdx?(c!==null&&g(c.divIdx,c.offset,d.offset),u(_)):g(c.divIdx,c.offset,_.offset),_.divIdx===E.divIdx)T=g(_.divIdx,_.offset,E.offset,"highlight"+x);else{T=g(_.divIdx,_.offset,d.offset,"highlight begin"+x);for(let I=_.divIdx+1,C=E.divIdx;I<C;I++)n[I].className="highlight middle"+x;u(E,"highlight end"+x)}c=E,P&&e.scrollMatchIntoView({element:n[_.divIdx],selectedLeft:T,pageIndex:i,matchIndex:o})}c&&g(c.divIdx,c.offset,d.offset)}_updateMatches(t=!1){if(!this.enabled&&!t)return;const{findController:e,matches:i,pageIdx:s}=this,{textContentItemsStr:n,textDivs:a}=this;let o=-1;for(const d of i){const u=Math.max(o,d.begin.divIdx);for(let g=u,b=d.end.divIdx;g<=b;g++){const w=a[g];w.textContent=n[g],w.className=""}o=d.end.divIdx+1}if(!(e!=null&&e.highlightMatches)||t)return;const l=e.pageMatches[s]||null,c=e.pageMatchesLength[s]||null;this.matches=this._convertMatches(l,c),this._renderMatches(this.matches)}}Vr=new WeakMap;var Cu,Tu,Ao,_s,Be,Hr,Qg,K_,$h,Z_,Q_;const Bn=class Bn{constructor({pdfPage:t,highlighter:e=null,accessibilityManager:i=null,enablePermissions:s=!1,onAppend:n=null}){m(this,Qg);m(this,Cu,!1);m(this,Tu,null);m(this,Ao,!1);m(this,_s,null);this.pdfPage=t,this.highlighter=e,this.accessibilityManager=i,f(this,Cu,s===!0),f(this,Tu,n),this.div=document.createElement("div"),this.div.tabIndex=0,this.div.className="textLayer"}async render({viewport:t,textContentParams:e=null}){var a,o,l,c,d;if(r(this,Ao)&&r(this,_s)){r(this,_s).update({viewport:t,onBefore:this.hide.bind(this)}),this.show();return}this.cancel(),f(this,_s,new rP({textContentSource:this.pdfPage.streamTextContent(e||{includeMarkedContent:!0,disableNormalization:!0}),container:this.div,viewport:t}));const{textDivs:i,textContentItemsStr:s}=r(this,_s);(a=this.highlighter)==null||a.setTextMapping(i,s),(o=this.accessibilityManager)==null||o.setTextMapping(i),await r(this,_s).render(),f(this,Ao,!0);const n=document.createElement("div");n.className="endOfContent",this.div.append(n),p(this,Qg,K_).call(this,n),(l=r(this,Tu))==null||l.call(this,this.div),(c=this.highlighter)==null||c.enable(),(d=this.accessibilityManager)==null||d.enable()}hide(){var t;!this.div.hidden&&r(this,Ao)&&((t=this.highlighter)==null||t.disable(),this.div.hidden=!0)}show(){var t;this.div.hidden&&r(this,Ao)&&(this.div.hidden=!1,(t=this.highlighter)==null||t.enable())}cancel(){var t,e,i,s;(t=r(this,_s))==null||t.cancel(),f(this,_s,null),(e=this.highlighter)==null||e.disable(),(i=this.accessibilityManager)==null||i.disable(),p(s=Bn,$h,Z_).call(s,this.div)}};Cu=new WeakMap,Tu=new WeakMap,Ao=new WeakMap,_s=new WeakMap,Be=new WeakMap,Hr=new WeakMap,Qg=new WeakSet,K_=function(t){var i;const{div:e}=this;e.addEventListener("mousedown",()=>{e.classList.add("selecting")}),e.addEventListener("copy",s=>{if(!r(this,Cu)){const n=document.getSelection();s.clipboardData.setData("text/plain",Cc(nP(n.toString())))}tb(s)}),r(Bn,Be).set(e,t),p(i=Bn,$h,Q_).call(i)},$h=new WeakSet,Z_=function(t){var e;r(this,Be).delete(t),r(this,Be).size===0&&((e=r(this,Hr))==null||e.abort(),f(this,Hr,null))},Q_=function(){if(r(this,Hr))return;f(this,Hr,new AbortController);const{signal:t}=r(this,Hr),e=(a,o)=>{o.append(a),a.style.width="",a.style.height="",o.classList.remove("selecting")};let i=!1;document.addEventListener("pointerdown",()=>{i=!0},{signal:t}),document.addEventListener("pointerup",()=>{i=!1,r(this,Be).forEach(e)},{signal:t}),window.addEventListener("blur",()=>{i=!1,r(this,Be).forEach(e)},{signal:t}),document.addEventListener("keyup",()=>{i||r(this,Be).forEach(e)},{signal:t});var s,n;document.addEventListener("selectionchange",()=>{var b;const a=document.getSelection();if(a.rangeCount===0){r(this,Be).forEach(e);return}const o=new Set;for(let w=0;w<a.rangeCount;w++){const v=a.getRangeAt(w);for(const A of r(this,Be).keys())!o.has(A)&&v.intersectsNode(A)&&o.add(A)}for(const[w,v]of r(this,Be))o.has(w)?w.classList.add("selecting"):e(v,w);if(s!=null||(s=getComputedStyle(r(this,Be).values().next().value).getPropertyValue("-moz-user-select")==="none"),s)return;const l=a.getRangeAt(0),c=n&&(l.compareBoundaryPoints(Range.END_TO_END,n)===0||l.compareBoundaryPoints(Range.START_TO_END,n)===0);let d=c?l.startContainer:l.endContainer;if(d.nodeType===Node.TEXT_NODE&&(d=d.parentNode),!c&&l.endOffset===0)do{for(;!d.previousSibling;)d=d.parentNode;d=d.previousSibling}while(!d.childNodes.length);const u=(b=d.parentElement)==null?void 0:b.closest(".textLayer"),g=r(this,Be).get(u);g&&(g.style.width=u.style.width,g.style.height=u.style.height,d.parentElement.insertBefore(g,c?d:d.nextSibling)),n=l.cloneRange()},{signal:t})},m(Bn,$h),m(Bn,Be,new Map),m(Bn,Hr,null);let Cg=Bn;class ow{constructor({pdfPage:t,annotationStorage:e=null,linkService:i,xfaHtml:s=null}){this.pdfPage=t,this.annotationStorage=e,this.linkService=i,this.xfaHtml=s,this.div=null,this._cancelled=!1}async render({viewport:t,intent:e="display"}){if(e==="print"){const n={viewport:t.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:e};return this.div=document.createElement("div"),n.div=this.div,yp.render(n)}const i=await this.pdfPage.getXfa();if(this._cancelled||!i)return{textDivs:[]};const s={viewport:t.clone({dontFlip:!0}),div:this.div,xfaHtml:i,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:e};return this.div?yp.update(s):(this.div=document.createElement("div"),s.div=this.div,yp.render(s))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}const qx={annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsPromise:null,get linkService(){return new op}},Yx=new Map([["canvasWrapper",0],["textLayer",1],["annotationLayer",2],["annotationEditorLayer",3],["xfaLayer",3]]);var Eo,jr,Iu,Lu,Ru,$r,Ur,Rh,Mu,ku,Du,Mh,Nu,vn,Wr,tt,Yo,lg,yc,Pb,xb,Cb,Tb,Ib,tA,eA,iA,Lb;class J_ extends G_{constructor(e){var a,o,l,c,d,u,g;super(e);m(this,tt);m(this,Eo,Sn.ENABLE_FORMS);m(this,jr,null);m(this,Iu,!0);m(this,Lu,!1);m(this,Ru,!1);m(this,$r,null);m(this,Ur,!1);m(this,Rh,null);m(this,Mu,null);m(this,ku,1);m(this,Du,1);m(this,Mh,Es.ENABLE);m(this,Nu,1);m(this,vn,{directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0});m(this,Wr,[null,null,null,null]);const i=e.container,s=e.defaultViewport;this.renderingId="page"+this.id,f(this,$r,e.layerProperties||qx),this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=e.scale||w_,this.viewport=s,this.pdfPageRotate=s.rotation,this._optionalContentConfigPromise=e.optionalContentConfigPromise||null,f(this,Mh,(a=e.textLayerMode)!=null?a:Es.ENABLE),f(this,Eo,(o=e.annotationMode)!=null?o:Sn.ENABLE_FORMS),this.imageResourcesPath=e.imageResourcesPath||"",this.enableDetailCanvas=(l=e.enableDetailCanvas)!=null?l:!0,this.maxCanvasPixels=(c=e.maxCanvasPixels)!=null?c:Tc.get("maxCanvasPixels"),this.maxCanvasDim=e.maxCanvasDim||Tc.get("maxCanvasDim"),this.capCanvasAreaFactor=(d=e.capCanvasAreaFactor)!=null?d:Tc.get("capCanvasAreaFactor"),f(this,Iu,e.enableAutoLinking!==!1),this.l10n=e.l10n,this.l10n||(this.l10n=new No),this._isStandalone=!((u=this.renderingQueue)!=null&&u.hasViewer()),this._container=i,this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.xfaLayer=null,this.structTreeLayer=null,this.drawLayer=null,this.detailView=null;const n=document.createElement("div");if(n.className="page",n.setAttribute("data-page-number",this.id),n.setAttribute("role","region"),n.setAttribute("data-l10n-id","pdfjs-page-landmark"),n.setAttribute("data-l10n-args",JSON.stringify({page:this.id})),this.div=n,p(this,tt,lg).call(this),i==null||i.append(n),this._isStandalone){i==null||i.style.setProperty("--scale-factor",this.scale*Ns.PDF_TO_CSS_UNITS),(g=this.pageColors)!=null&&g.background&&(i==null||i.style.setProperty("--page-bg-color",this.pageColors.background));const{optionalContentConfigPromise:b}=e;b&&b.then(w=>{b===this._optionalContentConfigPromise&&(r(this,vn).initialOptionalContent=w.hasInitialVisibility)}),e.l10n||this.l10n.translate(this.div)}}setPdfPage(e){var s,n,a,o;this._isStandalone&&(((s=this.pageColors)==null?void 0:s.foreground)==="CanvasText"||((n=this.pageColors)==null?void 0:n.background)==="Canvas")&&((a=this._container)==null||a.style.setProperty("--hcm-highlight-filter",e.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),(o=this._container)==null||o.style.setProperty("--hcm-highlight-selected-filter",e.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","Highlight"))),this.pdfPage=e,this.pdfPageRotate=e.rotate;const i=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*Ns.PDF_TO_CSS_UNITS,rotation:i}),p(this,tt,lg).call(this),this.reset()}destroy(){var e;this.reset(),(e=this.pdfPage)==null||e.cleanup()}hasEditableAnnotations(){var e;return!!((e=this.annotationLayer)!=null&&e.hasEditableAnnotations())}get _textHighlighter(){return xg(this,"_textHighlighter",new Xx({pageIndex:this.id-1,eventBus:this.eventBus,findController:r(this,$r).findController}))}_resetCanvas(){super._resetCanvas(),f(this,Rh,null)}reset({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:i=!1,keepXfaLayer:s=!1,keepTextLayer:n=!1,keepCanvasWrapper:a=!1,preserveDetailViewState:o=!1}={}){var v,A,y,S,_,E;this.cancelRendering({keepAnnotationLayer:e,keepAnnotationEditorLayer:i,keepXfaLayer:s,keepTextLayer:n}),this.renderingState=ct.INITIAL;const l=this.div,c=l.childNodes,d=e&&((v=this.annotationLayer)==null?void 0:v.div)||null,u=i&&((A=this.annotationEditorLayer)==null?void 0:A.div)||null,g=s&&((y=this.xfaLayer)==null?void 0:y.div)||null,b=n&&((S=this.textLayer)==null?void 0:S.div)||null,w=a&&r(this,jr)||null;for(let P=c.length-1;P>=0;P--){const x=c[P];switch(x){case d:case u:case g:case b:case w:continue}x.remove();const T=r(this,Wr).indexOf(x);T>=0&&(r(this,Wr)[T]=null)}l.removeAttribute("data-loaded"),d&&this.annotationLayer.hide(),u&&this.annotationEditorLayer.hide(),g&&this.xfaLayer.hide(),b&&this.textLayer.hide(),(_=this.structTreeLayer)==null||_.hide(),!a&&r(this,jr)&&(f(this,jr,null),this._resetCanvas()),o||((E=this.detailView)==null||E.reset({keepCanvas:a}),a||(this.detailView=null))}toggleEditingMode(e){f(this,Ru,e),this.hasEditableAnnotations()&&this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}updateVisibleArea(e){var i;this.enableDetailCanvas&&(r(this,Ur)&&this.maxCanvasPixels>0&&e?((i=this.detailView)!=null||(this.detailView=new zx({pageView:this})),this.detailView.update({visibleArea:e})):this.detailView&&(this.detailView.reset(),this.detailView=null))}update({scale:e=0,rotation:i=null,optionalContentConfigPromise:s=null,drawingDelay:n=-1}){var o,l,c;this.scale=e||this.scale,typeof i=="number"&&(this.rotation=i),s instanceof Promise&&(this._optionalContentConfigPromise=s,s.then(d=>{s===this._optionalContentConfigPromise&&(r(this,vn).initialOptionalContent=d.hasInitialVisibility)})),r(this,vn).directDrawing=!0;const a=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*Ns.PDF_TO_CSS_UNITS,rotation:a}),p(this,tt,lg).call(this),this._isStandalone&&((o=this._container)==null||o.style.setProperty("--scale-factor",this.viewport.scale)),p(this,tt,Lb).call(this),this.canvas){const d=r(this,Lu)&&r(this,Ur),u=n>=0&&n<1e3;if(u||d){u&&!d&&this.renderingState!==ct.FINISHED&&(this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:n}),this.renderingState=ct.FINISHED,r(this,vn).directDrawing=!1),this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!u,hideTextLayer:u}),u||((l=this.detailView)==null||l.update({underlyingViewUpdated:!0}),this.dispatchPageRendered(!0,!1));return}}this.cssTransform({}),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0,preserveDetailViewState:!0}),(c=this.detailView)==null||c.update({underlyingViewUpdated:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:i=!1,keepXfaLayer:s=!1,keepTextLayer:n=!1,cancelExtraDelay:a=0}={}){var o;super.cancelRendering({cancelExtraDelay:a}),this.textLayer&&(!n||!this.textLayer.div)&&(this.textLayer.cancel(),this.textLayer=null),this.annotationLayer&&(!e||!this.annotationLayer.div)&&(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),this.annotationEditorLayer&&(!i||!this.annotationEditorLayer.div)&&(this.drawLayer&&(this.drawLayer.cancel(),this.drawLayer=null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),this.xfaLayer&&(!s||!this.xfaLayer.div)&&(this.xfaLayer.cancel(),this.xfaLayer=null,(o=this._textHighlighter)==null||o.disable())}cssTransform({redrawAnnotationLayer:e=!1,redrawAnnotationEditorLayer:i=!1,redrawXfaLayer:s=!1,redrawTextLayer:n=!1,hideTextLayer:a=!1}){var c;const{canvas:o}=this;if(!o)return;const l=r(this,Rh);if(this.viewport!==l){const d=(360+this.viewport.rotation-l.rotation)%360;if(d===90||d===270){const{width:u,height:g}=this.viewport,b=g/u,w=u/g;o.style.transform="rotate(".concat(d,"deg) scale(").concat(b,",").concat(w,")")}else o.style.transform=d===0?"":"rotate(".concat(d,"deg)")}e&&this.annotationLayer&&p(this,tt,Pb).call(this),i&&this.annotationEditorLayer&&(this.drawLayer&&p(this,tt,Cb).call(this),p(this,tt,xb).call(this)),s&&this.xfaLayer&&p(this,tt,Tb).call(this),this.textLayer&&(a?(this.textLayer.hide(),(c=this.structTreeLayer)==null||c.hide()):n&&p(this,tt,Ib).call(this))}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,i){return this.viewport.convertToPdfPoint(e,i)}_ensureCanvasWrapper(){let e=r(this,jr);return e||(e=f(this,jr,document.createElement("div")),e.classList.add("canvasWrapper"),p(this,tt,Yo).call(this,e,"canvasWrapper")),e}_getRenderingContext(e,i){return{canvas:e,transform:i,viewport:this.viewport,annotationMode:r(this,Eo),optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors,isEditing:r(this,Ru)}}async draw(){this.renderingState!==ct.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:e,l10n:i,pdfPage:s,viewport:n}=this;if(!s)throw this.renderingState=ct.FINISHED,new Error("pdfPage is not loaded");this.renderingState=ct.RUNNING;const a=this._ensureCanvasWrapper();if(!this.textLayer&&r(this,Mh)!==Es.DISABLE&&!s.isPureXfa&&(this._accessibilityManager||(this._accessibilityManager=new Eb),this.textLayer=new Cg({pdfPage:s,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:r(this,Mh)===Es.ENABLE_PERMISSIONS,onAppend:E=>{this.l10n.pause(),p(this,tt,Yo).call(this,E,"textLayer"),this.l10n.resume()}})),!this.annotationLayer&&r(this,Eo)!==Sn.DISABLE){const{annotationStorage:E,annotationEditorUIManager:P,downloadManager:x,enableScripting:T,fieldObjectsPromise:I,hasJSActionsPromise:C,linkService:L}=r(this,$r);this._annotationCanvasMap||(this._annotationCanvasMap=new Map),this.annotationLayer=new L_({pdfPage:s,annotationStorage:E,imageResourcesPath:this.imageResourcesPath,renderForms:r(this,Eo)===Sn.ENABLE_FORMS,linkService:L,downloadManager:x,enableScripting:T,hasJSActionsPromise:C,fieldObjectsPromise:I,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:P,onAppend:M=>{p(this,tt,Yo).call(this,M,"annotationLayer")}})}const{width:o,height:l}=n;f(this,Rh,n);const{canvas:c,prevCanvas:d}=this._createCanvas(E=>{a.prepend(E)});c.setAttribute("role","presentation"),this.outputScale||p(this,tt,Lb).call(this);const{outputScale:u}=this;f(this,Lu,r(this,Ur));const g=Yw(u.sx),b=Yw(u.sy),w=c.width=bf(wf(o*u.sx),g[0]),v=c.height=bf(wf(l*u.sy),b[0]),A=bf(wf(o),g[1]),y=bf(wf(l),b[1]);u.sx=w/A,u.sy=v/y,r(this,ku)!==g[1]&&(e.style.setProperty("--scale-round-x","".concat(g[1],"px")),f(this,ku,g[1])),r(this,Du)!==b[1]&&(e.style.setProperty("--scale-round-y","".concat(b[1],"px")),f(this,Du,b[1]));const S=u.scaled?[u.sx,0,0,u.sy,0,0]:null,_=this._drawCanvas(this._getRenderingContext(c,S),()=>{d==null||d.remove(),this._resetCanvas()},E=>{r(this,vn).regularAnnotations=!E.separateAnnots,this.dispatchPageRendered(!1,!1)}).then(async()=>{var x;this.structTreeLayer||(this.structTreeLayer=new q_(s,n.rawDims));const E=p(this,tt,Ib).call(this);this.annotationLayer&&(await p(this,tt,Pb).call(this),r(this,Iu)&&this.annotationLayer&&this.textLayer&&await p(this,tt,iA).call(this,E));const{annotationEditorUIManager:P}=r(this,$r);P&&(this.drawLayer||(this.drawLayer=new Wx({pageIndex:this.id})),await p(this,tt,Cb).call(this),this.drawLayer.setParent(a),this.annotationEditorLayer||(this.annotationEditorLayer=new jx({uiManager:P,pdfPage:s,l10n:i,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:(x=this.annotationLayer)==null?void 0:x.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:T=>{p(this,tt,Yo).call(this,T,"annotationEditorLayer")}})),p(this,tt,xb).call(this))});if(s.isPureXfa){if(!this.xfaLayer){const{annotationStorage:E,linkService:P}=r(this,$r);this.xfaLayer=new ow({pdfPage:s,annotationStorage:E,linkService:P})}p(this,tt,Tb).call(this)}return e.setAttribute("data-loaded",!0),this.dispatchPageRender(),_}setPageLabel(e){var i;this.pageLabel=typeof e=="string"?e:null,this.div.setAttribute("data-l10n-args",JSON.stringify({page:(i=this.pageLabel)!=null?i:this.id})),this.pageLabel!==null?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{directDrawing:e,initialOptionalContent:i,regularAnnotations:s}=r(this,vn);return e&&i&&s?this.canvas:null}}Eo=new WeakMap,jr=new WeakMap,Iu=new WeakMap,Lu=new WeakMap,Ru=new WeakMap,$r=new WeakMap,Ur=new WeakMap,Rh=new WeakMap,Mu=new WeakMap,ku=new WeakMap,Du=new WeakMap,Mh=new WeakMap,Nu=new WeakMap,vn=new WeakMap,Wr=new WeakMap,tt=new WeakSet,Yo=function(e,i){const s=Yx.get(i),n=r(this,Wr)[s];if(r(this,Wr)[s]=e,n){n.replaceWith(e);return}for(let a=s-1;a>=0;a--){const o=r(this,Wr)[a];if(o){o.after(e);return}}this.div.prepend(e)},lg=function(){const{div:e,viewport:i}=this;if(i.userUnit!==r(this,Nu)&&(i.userUnit!==1?e.style.setProperty("--user-unit",i.userUnit):e.style.removeProperty("--user-unit"),f(this,Nu,i.userUnit)),this.pdfPage){if(r(this,Mu)===i.rotation)return;f(this,Mu,i.rotation)}b_(e,i,!0,!1)},yc=function(e,i){this.eventBus.dispatch(e,{source:this,pageNumber:this.id,error:i})},Pb=async function(){let e=null;try{await this.annotationLayer.render({viewport:this.viewport,intent:"display",structTreeLayer:this.structTreeLayer})}catch(i){console.error("#renderAnnotationLayer:",i),e=i}finally{p(this,tt,yc).call(this,"annotationlayerrendered",e)}},xb=async function(){let e=null;try{await this.annotationEditorLayer.render({viewport:this.viewport,intent:"display"})}catch(i){console.error("#renderAnnotationEditorLayer:",i),e=i}finally{p(this,tt,yc).call(this,"annotationeditorlayerrendered",e)}},Cb=async function(){try{await this.drawLayer.render({intent:"display"})}catch(e){console.error("#renderDrawLayer:",e)}},Tb=async function(){var i;let e=null;try{const s=await this.xfaLayer.render({viewport:this.viewport,intent:"display"});s!=null&&s.textDivs&&this._textHighlighter&&p(this,tt,eA).call(this,s.textDivs)}catch(s){console.error("#renderXfaLayer:",s),e=s}finally{(i=this.xfaLayer)!=null&&i.div&&(this.l10n.pause(),p(this,tt,Yo).call(this,this.xfaLayer.div,"xfaLayer"),this.l10n.resume()),p(this,tt,yc).call(this,"xfalayerrendered",e)}},Ib=async function(){if(!this.textLayer)return;let e=null;try{await this.textLayer.render({viewport:this.viewport})}catch(i){if(i instanceof YS)return;console.error("#renderTextLayer:",i),e=i}p(this,tt,yc).call(this,"textlayerrendered",e),p(this,tt,tA).call(this)},tA=async function(){var i,s,n;if(!this.textLayer)return;const e=await((i=this.structTreeLayer)==null?void 0:i.render());e&&(this.l10n.pause(),(s=this.structTreeLayer)==null||s.addElementsToTextLayer(),this.canvas&&e.parentNode!==this.canvas&&this.canvas.append(e),this.l10n.resume()),(n=this.structTreeLayer)==null||n.show()},eA=async function(e){const i=await this.pdfPage.getTextContent(),s=[];for(const n of i.items)s.push(n.str);this._textHighlighter.setTextMapping(e,s),this._textHighlighter.enable()},iA=async function(e){try{if(await e,!this.annotationLayer)return;await this.annotationLayer.injectLinkAnnotations({inferredLinks:vb.processLinks(this),viewport:this.viewport,structTreeLayer:this.structTreeLayer})}catch(i){console.error("#injectLinkAnnotations:",i)}},Lb=function(){const{width:e,height:i}=this.viewport,s=this.outputScale=new tg;if(this.maxCanvasPixels===0){const n=1/this.scale;s.sx*=n,s.sy*=n,f(this,Ur,!0)}else f(this,Ur,s.limitCanvas(e,i,this.maxCanvasPixels,this.maxCanvasDim,this.capCanvasAreaFactor))};async function Kx(h){const t="",e="",{info:i,metadata:s,contentDispositionFilename:n,contentLength:a}=await h.getMetadata();return{...i,baseURL:e,filesize:a||(await h.getDownloadInfo()).length,filename:n||eP(t),metadata:s==null?void 0:s.getRaw(),authors:s==null?void 0:s.get("dc:creator"),numPages:h.numPages,URL:t}}class Zx{constructor(t){this._ready=new Promise((e,i)=>{import(t).then(n=>{e(n.QuickJSSandbox())}).catch(i)})}async createSandbox(t){(await this._ready).create(t)}async dispatchEventInSandbox(t){const e=await this._ready;setTimeout(()=>e.dispatchEvent(t),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}var As,So,Fu,Po,xo,Ou,Ce,yn,kh,Gt,Si,ie,sA,hg,Rb,nA,_c;class Qx{constructor({eventBus:t,externalServices:e=null,docProperties:i=null}){m(this,ie);m(this,As,null);m(this,So,null);m(this,Fu,null);m(this,Po,null);m(this,xo,null);m(this,Ou,null);m(this,Ce,null);m(this,yn,null);m(this,kh,!1);m(this,Gt,null);m(this,Si,null);f(this,xo,t),f(this,Ou,e),f(this,Fu,i)}setViewer(t){f(this,yn,t)}async setDocument(t){var o;if(r(this,Ce)&&await p(this,ie,_c).call(this),f(this,Ce,t),!t)return;const[e,i,s]=await Promise.all([t.getFieldObjects(),t.getCalculationOrderIds(),t.getJSActions()]);if(!e&&!s){await p(this,ie,_c).call(this);return}if(t!==r(this,Ce))return;try{f(this,Gt,p(this,ie,nA).call(this))}catch(l){console.error("setDocument:",l),await p(this,ie,_c).call(this);return}const n=r(this,xo);f(this,Po,new AbortController);const{signal:a}=r(this,Po);n._on("updatefromsandbox",l=>{(l==null?void 0:l.source)===window&&p(this,ie,sA).call(this,l.detail)},{signal:a}),n._on("dispatcheventinsandbox",l=>{var c;(c=r(this,Gt))==null||c.dispatchEventInSandbox(l.detail)},{signal:a}),n._on("pagechanging",({pageNumber:l,previous:c})=>{l!==c&&(p(this,ie,Rb).call(this,c),p(this,ie,hg).call(this,l))},{signal:a}),n._on("pagerendered",({pageNumber:l})=>{this._pageOpenPending.has(l)&&l===r(this,yn).currentPageNumber&&p(this,ie,hg).call(this,l)},{signal:a}),n._on("pagesdestroy",async()=>{var l,c;await p(this,ie,Rb).call(this,r(this,yn).currentPageNumber),await((l=r(this,Gt))==null?void 0:l.dispatchEventInSandbox({id:"doc",name:"WillClose"})),(c=r(this,As))==null||c.resolve()},{signal:a});try{const l=await r(this,Fu).call(this,t);if(t!==r(this,Ce))return;await r(this,Gt).createSandbox({objects:e,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...l,actions:s}}),n.dispatch("sandboxcreated",{source:this})}catch(l){console.error("setDocument:",l),await p(this,ie,_c).call(this);return}await((o=r(this,Gt))==null?void 0:o.dispatchEventInSandbox({id:"doc",name:"Open"})),await p(this,ie,hg).call(this,r(this,yn).currentPageNumber,!0),Promise.resolve().then(()=>{t===r(this,Ce)&&f(this,kh,!0)})}async dispatchWillSave(){var t;return(t=r(this,Gt))==null?void 0:t.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(){var t;return(t=r(this,Gt))==null?void 0:t.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(){var t;if(r(this,Gt)){await((t=r(this,Si))==null?void 0:t.promise),f(this,Si,Promise.withResolvers());try{await r(this,Gt).dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(e){throw r(this,Si).resolve(),f(this,Si,null),e}await r(this,Si).promise}}async dispatchDidPrint(){var t;return(t=r(this,Gt))==null?void 0:t.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){var t;return((t=r(this,So))==null?void 0:t.promise)||null}get ready(){return r(this,kh)}get _pageOpenPending(){return xg(this,"_pageOpenPending",new Set)}get _visitedPages(){return xg(this,"_visitedPages",new Map)}}As=new WeakMap,So=new WeakMap,Fu=new WeakMap,Po=new WeakMap,xo=new WeakMap,Ou=new WeakMap,Ce=new WeakMap,yn=new WeakMap,kh=new WeakMap,Gt=new WeakMap,Si=new WeakMap,ie=new WeakSet,sA=async function(t){var c,d;const e=r(this,yn),i=e.isInPresentationMode||e.isChangingPresentationMode,{id:s,siblings:n,command:a,value:o}=t;if(!s){switch(a){case"clear":console.clear();break;case"error":console.error(o);break;case"layout":if(!i){const u=wP(o);e.spreadMode=u.spreadMode}break;case"page-num":e.currentPageNumber=o+1;break;case"print":await e.pagesPromise,r(this,xo).dispatch("print",{source:this});break;case"println":console.log(o);break;case"zoom":i||(e.currentScaleValue=o);break;case"SaveAs":r(this,xo).dispatch("download",{source:this});break;case"FirstPage":e.currentPageNumber=1;break;case"LastPage":e.currentPageNumber=e.pagesCount;break;case"NextPage":e.nextPage();break;case"PrevPage":e.previousPage();break;case"ZoomViewIn":i||e.increaseScale();break;case"ZoomViewOut":i||e.decreaseScale();break;case"WillPrintFinished":(c=r(this,Si))==null||c.resolve(),f(this,Si,null);break}return}if(i&&t.focus)return;delete t.id,delete t.siblings;const l=n?[s,...n]:[s];for(const u of l){const g=document.querySelector('[data-element-id="'.concat(u,'"]'));g?g.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:t})):(d=r(this,Ce))==null||d.annotationStorage.setValue(u,t)}},hg=async function(t,e=!1){const i=r(this,Ce),s=this._visitedPages;if(e&&f(this,As,Promise.withResolvers()),!r(this,As))return;const n=r(this,yn).getPageView(t-1);if((n==null?void 0:n.renderingState)!==ct.FINISHED){this._pageOpenPending.add(t);return}this._pageOpenPending.delete(t);const a=(async()=>{var l,c;const o=await(s.has(t)?null:(l=n.pdfPage)==null?void 0:l.getJSActions());i===r(this,Ce)&&await((c=r(this,Gt))==null?void 0:c.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:t,actions:o}))})();s.set(t,a)},Rb=async function(t){var n;const e=r(this,Ce),i=this._visitedPages;if(!r(this,As)||this._pageOpenPending.has(t))return;const s=i.get(t);s&&(i.set(t,null),await s,e===r(this,Ce)&&await((n=r(this,Gt))==null?void 0:n.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:t})))},nA=function(){if(f(this,So,Promise.withResolvers()),r(this,Gt))throw new Error("#initScripting: Scripting already exists.");return r(this,Ou).createScripting()},_c=async function(){var t,e,i,s;if(!r(this,Gt)){f(this,Ce,null),(t=r(this,So))==null||t.resolve();return}r(this,As)&&(await Promise.race([r(this,As).promise,new Promise(n=>{setTimeout(n,1e3)})]).catch(()=>{}),f(this,As,null)),f(this,Ce,null);try{await r(this,Gt).destroySandbox()}catch(n){}(e=r(this,Si))==null||e.reject(new Error("Scripting destroyed.")),f(this,Si,null),(i=r(this,Po))==null||i.abort(),f(this,Po,null),this._pageOpenPending.clear(),this._visitedPages.clear(),f(this,Gt,null),f(this,kh,!1),(s=r(this,So))==null||s.resolve()};class Jx extends Qx{constructor(t){t.externalServices||window.addEventListener("updatefromsandbox",e=>{t.eventBus.dispatch("updatefromsandbox",{source:window,detail:e.detail})}),t.externalServices||(t.externalServices={createScripting:()=>new Zx(t.sandboxBundleSrc)}),t.docProperties||(t.docProperties=e=>Kx(e)),super(t)}}const tC=3e4;let eC=class{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1,Object.defineProperty(this,"hasViewer",{value:()=>!!this.pdfViewer})}setViewer(t){this.pdfViewer=t}setThumbnailViewer(t){this.pdfThumbnailViewer=t}isHighestPriority(t){return this.highestPriorityPage===t.renderingId}renderHighestPriority(t){var e;this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),!this.pdfViewer.forceRendering(t)&&(this.isThumbnailViewEnabled&&((e=this.pdfThumbnailViewer)!=null&&e.forceRendering())||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),tC)))}getHighestPriority(t,e,i,s=!1,n=!1){const a=t.views,o=a.length;if(o===0)return null;for(let g=0;g<o;g++){const b=a[g].view;if(!this.isViewFinished(b))return b}if(!n)for(let g=0;g<o;g++){const{detailView:b}=a[g].view;if(b&&!this.isViewFinished(b))return b}const l=t.first.id,c=t.last.id;if(c-l+1>o){const g=t.ids;for(let b=1,w=c-l;b<w;b++){const v=i?l+b:c-b;if(g.has(v))continue;const A=e[v-1];if(!this.isViewFinished(A))return A}}let d=i?c:l-2,u=e[d];return u&&!this.isViewFinished(u)||s&&(d+=i?1:-1,u=e[d],u&&!this.isViewFinished(u))?u:null}isViewFinished(t){return t.renderingState===ct.FINISHED}renderView(t){switch(t.renderingState){case ct.FINISHED:return!1;case ct.PAUSED:this.highestPriorityPage=t.renderingId,t.resume();break;case ct.RUNNING:this.highestPriorityPage=t.renderingId;break;case ct.INITIAL:this.highestPriorityPage=t.renderingId,t.draw().finally(()=>{this.renderHighestPriority()}).catch(e=>{e instanceof Jm||console.error("renderView:",e)});break}return!0}};const _v=10,_f={FORCE_SCROLL_MODE_PAGE:1e4,FORCE_LAZY_PAGE_INIT:5e3,PAUSE_EAGER_PAGE_INIT:250};function Av(h){return Object.values(je).includes(h)&&h!==je.DISABLE}var _n,Co,Bu,Mb;class iC{constructor(t){m(this,Bu);m(this,_n,new Set);m(this,Co,0);f(this,Co,t)}push(t){const e=r(this,_n);e.has(t)&&e.delete(t),e.add(t),e.size>r(this,Co)&&p(this,Bu,Mb).call(this)}resize(t,e=null){f(this,Co,t);const i=r(this,_n);if(e){const s=i.size;let n=1;for(const a of i)if(e.has(a.id)&&(i.delete(a),i.add(a)),++n>s)break}for(;i.size>r(this,Co);)p(this,Bu,Mb).call(this)}has(t){return r(this,_n).has(t)}[Symbol.iterator](){return r(this,_n).keys()}}_n=new WeakMap,Co=new WeakMap,Bu=new WeakSet,Mb=function(){const t=r(this,_n).keys().next().value;t==null||t.destroy(),r(this,_n).delete(t)};var An,Vu,Hu,$i,ni,To,ju,$u,Uu,Wu,zu,Gu,Xu,qu,Yu,zr,Ku,Dh,Ui,Io,Lo,Nh,Gr,Fh,Zu,Oh,Ro,En,Bh,Qu,Vh,Ju,X,rA,aA,oA,Ac,cg,lA,kb,hA,Fn,Db,cA,dA,uA,Nb,fA,Fb,dg,Ob;class lw{constructor(t){m(this,X);m(this,An,null);m(this,Vu,null);m(this,Hu,null);m(this,$i,je.NONE);m(this,ni,null);m(this,To,Sn.ENABLE_FORMS);m(this,ju,null);m(this,$u,null);m(this,Uu,null);m(this,Wu,!1);m(this,zu,!1);m(this,Gu,!1);m(this,Xu,!1);m(this,qu,!1);m(this,Yu,!0);m(this,zr,null);m(this,Ku,0);m(this,Dh,null);m(this,Ui,null);m(this,Io,null);m(this,Lo,null);m(this,Nh,!1);m(this,Gr,null);m(this,Fh,!1);m(this,Zu,0);m(this,Oh,new ResizeObserver(p(this,X,fA).bind(this)));m(this,Ro,null);m(this,En,null);m(this,Bh,null);m(this,Qu,!0);m(this,Vh,Es.ENABLE);m(this,Ju,null);var s,n,a,o,l,c,d;const e="5.4.54";if(Ww!==e)throw new Error('The API version "'.concat(Ww,'" does not match the Viewer version "').concat(e,'".'));if(this.container=t.container,this.viewer=t.viewer||t.container.firstElementChild,f(this,Ju,t.viewerAlert||null),((s=this.container)==null?void 0:s.tagName)!=="DIV"||((n=this.viewer)==null?void 0:n.tagName)!=="DIV")throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&getComputedStyle(this.container).position!=="absolute")throw new Error("The `container` must be absolutely positioned.");r(this,Oh).observe(this.container),this.eventBus=t.eventBus,this.linkService=t.linkService||new op,this.downloadManager=t.downloadManager||null,this.findController=t.findController||null,f(this,Vu,t.altTextManager||null),f(this,ju,t.commentManager||null),f(this,Bh,t.signatureManager||null),f(this,Uu,t.editorUndoBar||null),this.findController&&(this.findController.onIsPageVisible=u=>this._getVisiblePages().ids.has(u)),this._scriptingManager=t.scriptingManager||null,f(this,Vh,(a=t.textLayerMode)!=null?a:Es.ENABLE),f(this,To,(o=t.annotationMode)!=null?o:Sn.ENABLE_FORMS),f(this,$i,(l=t.annotationEditorMode)!=null?l:je.NONE),f(this,Hu,t.annotationEditorHighlightColors||null),f(this,zu,t.enableHighlightFloatingButton===!0),f(this,Xu,t.enableUpdatedAddImage===!0),f(this,qu,t.enableNewAltTextWhenAddingImage===!0),this.imageResourcesPath=t.imageResourcesPath||"",this.enablePrintAutoRotate=t.enablePrintAutoRotate||!1,this.removePageBorders=t.removePageBorders||!1,this.maxCanvasPixels=t.maxCanvasPixels,this.maxCanvasDim=t.maxCanvasDim,this.capCanvasAreaFactor=t.capCanvasAreaFactor,this.enableDetailCanvas=(c=t.enableDetailCanvas)!=null?c:!0,this.l10n=t.l10n,this.l10n||(this.l10n=new No),f(this,Gu,t.enablePermissions||!1),this.pageColors=t.pageColors||null,f(this,Dh,t.mlManager||null),f(this,Wu,t.enableHWA||!1),f(this,Qu,t.supportsPinchToZoom!==!1),f(this,Yu,t.enableAutoLinking!==!1),f(this,Ku,(d=t.minDurationToUpdateCanvas)!=null?d:500),this.defaultRenderingQueue=!t.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new eC,this.renderingQueue.setViewer(this)):this.renderingQueue=t.renderingQueue;const{abortSignal:i}=t;i==null||i.addEventListener("abort",()=>{r(this,Oh).disconnect(),f(this,Oh,null)},{once:!0}),this.scroll=dP(this.container,this._scrollUpdate.bind(this),i),this.presentationModeState=nl.UNKNOWN,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),p(this,X,Nb).call(this),this.eventBus._on("thumbnailrendered",({pageNumber:u,pdfPage:g})=>{const b=this._pages[u-1];r(this,An).has(b)||g==null||g.cleanup()}),t.l10n||this.l10n.translate(this.container)}get pagesCount(){return this._pages.length}getPageView(t){return this._pages[t]}getCachedPageViews(){return new Set(r(this,An))}get pageViewsReady(){return this._pages.every(t=>t==null?void 0:t.pdfPage)}get renderForms(){return r(this,To)===Sn.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(t){if(!Number.isInteger(t))throw new Error("Invalid page number.");this.pdfDocument&&(this._setCurrentPageNumber(t,!0)||console.error('currentPageNumber: "'.concat(t,'" is not a valid page.')))}_setCurrentPageNumber(t,e=!1){var s,n;if(this._currentPageNumber===t)return e&&p(this,X,Db).call(this),!0;if(!(0<t&&t<=this.pagesCount))return!1;const i=this._currentPageNumber;return this._currentPageNumber=t,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:t,pageLabel:(n=(s=this._pageLabels)==null?void 0:s[t-1])!=null?n:null,previous:i}),e&&p(this,X,Db).call(this),!0}get currentPageLabel(){var t,e;return(e=(t=this._pageLabels)==null?void 0:t[this._currentPageNumber-1])!=null?e:null}set currentPageLabel(t){if(!this.pdfDocument)return;let e=t|0;if(this._pageLabels){const i=this._pageLabels.indexOf(t);i>=0&&(e=i+1)}this._setCurrentPageNumber(e,!0)||console.error('currentPageLabel: "'.concat(t,'" is not a valid page.'))}get currentScale(){return this._currentScale!==_p?this._currentScale:w_}set currentScale(t){if(isNaN(t))throw new Error("Invalid numeric scale.");this.pdfDocument&&p(this,X,Fn).call(this,t,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(t){this.pdfDocument&&p(this,X,Fn).call(this,t,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(t){if(!y_(t))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument||(t%=360,t<0&&(t+=360),this._pagesRotation===t))return;this._pagesRotation=t;const e=this._currentPageNumber;this.refresh(!0,{rotation:t}),this._currentScaleValue&&p(this,X,Fn).call(this,this._currentScaleValue,{noScroll:!0}),this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:t,pageNumber:e}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){const t=this;return xg(this,"_layerProperties",{get annotationEditorUIManager(){return r(t,ni)},get annotationStorage(){var e;return(e=t.pdfDocument)==null?void 0:e.annotationStorage},get downloadManager(){return t.downloadManager},get enableScripting(){return!!t._scriptingManager},get fieldObjectsPromise(){var e;return(e=t.pdfDocument)==null?void 0:e.getFieldObjects()},get findController(){return t.findController},get hasJSActionsPromise(){var e;return(e=t.pdfDocument)==null?void 0:e.hasJSActions()},get linkService(){return t.linkService}})}async getAllText(){const t=[],e=[];for(let i=1,s=this.pdfDocument.numPages;i<=s;++i){if(r(this,Fh))return null;e.length=0;const n=await this.pdfDocument.getPage(i),{items:a}=await n.getTextContent();for(const o of a)o.str&&e.push(o.str),o.hasEOL&&e.push("\n");t.push(Cc(e.join("")))}return t.join("\n")}setDocument(t){var g,b,w;if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),(g=this.findController)==null||g.setDocument(null),(b=this._scriptingManager)==null||b.setDocument(null),(w=r(this,ni))==null||w.destroy(),f(this,ni,null)),this.pdfDocument=t,!t)return;const e=t.numPages,i=t.getPage(1),s=t.getOptionalContentConfig({intent:"display"}),n=r(this,Gu)?t.getPermissions():Promise.resolve(),{eventBus:a,pageColors:o,viewer:l}=this;f(this,zr,new AbortController);const{signal:c}=r(this,zr);if(e>_f.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const v=this._scrollMode=rt.PAGE;a.dispatch("scrollmodechanged",{source:this,mode:v})}this._pagesCapability.promise.then(()=>{a.dispatch("pagesloaded",{source:this,pagesCount:e})},()=>{});const d=v=>{const A=this._pages[v.pageNumber-1];A&&r(this,An).push(A)};a._on("pagerender",d,{signal:c});const u=v=>{v.cssTransform||v.isDetailView||(this._onePageRenderedCapability.resolve({timestamp:v.timestamp}),a._off("pagerendered",u))};a._on("pagerendered",u,{signal:c}),Promise.all([i,n]).then(([v,A])=>{var T;if(t!==this.pdfDocument)return;this._firstPageCapability.resolve(v),this._optionalContentConfigPromise=s;const{annotationEditorMode:y,annotationMode:S,textLayerMode:_}=p(this,X,rA).call(this,A);if(_!==Es.DISABLE){const I=f(this,Gr,document.createElement("div"));I.id="hiddenCopyElement",l.before(I)}if(y!==je.DISABLE){const I=y;t.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):Av(I)?(f(this,ni,new ZS(this.container,l,r(this,Ju),r(this,Vu),r(this,ju),r(this,Bh),a,t,o,r(this,Hu),r(this,zu),r(this,Xu),r(this,qu),r(this,Dh),r(this,Uu),r(this,Qu))),a.dispatch("annotationeditoruimanager",{source:this,uiManager:r(this,ni)}),I!==je.NONE&&(p(this,X,Ob).call(this,I),r(this,ni).updateMode(I))):console.error("Invalid AnnotationEditor mode: ".concat(I))}const E=this._scrollMode===rt.PAGE?null:l,P=this.currentScale,x=v.getViewport({scale:P*Ns.PDF_TO_CSS_UNITS});l.style.setProperty("--scale-factor",x.scale),o!=null&&o.background&&l.style.setProperty("--page-bg-color",o.background),((o==null?void 0:o.foreground)==="CanvasText"||(o==null?void 0:o.background)==="Canvas")&&(l.style.setProperty("--hcm-highlight-filter",t.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),l.style.setProperty("--hcm-highlight-selected-filter",t.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","ButtonText")));for(let I=1;I<=e;++I){const C=new J_({container:E,eventBus:a,id:I,scale:P,defaultViewport:x.clone(),optionalContentConfigPromise:s,renderingQueue:this.renderingQueue,textLayerMode:_,annotationMode:S,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableDetailCanvas:this.enableDetailCanvas,pageColors:o,l10n:this.l10n,layerProperties:this._layerProperties,enableHWA:r(this,Wu),enableAutoLinking:r(this,Yu),minDurationToUpdateCanvas:r(this,Ku)});this._pages.push(C)}(T=this._pages[0])==null||T.setPdfPage(v),this._scrollMode===rt.PAGE?p(this,X,Ac).call(this):this._spreadMode!==_e.NONE&&this._updateSpreadMode(),p(this,X,aA).call(this,c).then(async()=>{var C,L;if(t!==this.pdfDocument)return;if((C=this.findController)==null||C.setDocument(t),(L=this._scriptingManager)==null||L.setDocument(t),r(this,Gr)&&document.addEventListener("copy",p(this,X,oA).bind(this,_),{signal:c}),r(this,ni)&&a.dispatch("annotationeditormodechanged",{source:this,mode:r(this,$i)}),t.loadingParams.disableAutoFetch||e>_f.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let I=e-1;if(I<=0){this._pagesCapability.resolve();return}for(let M=2;M<=e;++M){const G=t.getPage(M).then(W=>{const $=this._pages[M-1];$.pdfPage||$.setPdfPage(W),--I===0&&this._pagesCapability.resolve()},W=>{console.error("Unable to get page ".concat(M," to initialize viewer"),W),--I===0&&this._pagesCapability.resolve()});M%_f.PAUSE_EAGER_PAGE_INIT===0&&await G}}),a.dispatch("pagesinit",{source:this}),t.getMetadata().then(({info:I})=>{t===this.pdfDocument&&I.Language&&(l.lang=I.Language)}),this.defaultRenderingQueue&&this.update()}).catch(v=>{console.error("Unable to initialize viewer",v),this._pagesCapability.reject(v)})}setPageLabels(t){var e,i;if(this.pdfDocument){t?Array.isArray(t)&&this.pdfDocument.numPages===t.length?this._pageLabels=t:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let s=0,n=this._pages.length;s<n;s++)this._pages[s].setPageLabel((i=(e=this._pageLabels)==null?void 0:e[s])!=null?i:null)}}_resetView(){var t,e;this._pages=[],this._currentPageNumber=1,this._currentScale=_p,this._currentScaleValue=null,this._pageLabels=null,f(this,An,new iC(_v)),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=Promise.withResolvers(),this._onePageRenderedCapability=Promise.withResolvers(),this._pagesCapability=Promise.withResolvers(),this._scrollMode=rt.VERTICAL,this._previousScrollMode=rt.UNKNOWN,this._spreadMode=_e.NONE,f(this,Ro,{previousPageNumber:1,scrollDown:!0,pages:[]}),(t=r(this,zr))==null||t.abort(),f(this,zr,null),this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),(e=r(this,Gr))==null||e.remove(),f(this,Gr,null),p(this,X,Fb).call(this),p(this,X,dg).call(this)}_scrollUpdate(){this.pagesCount!==0&&(r(this,Ui)&&clearTimeout(r(this,Ui)),f(this,Ui,setTimeout(()=>{f(this,Ui,null),this.update()},100)),this.update())}pageLabelToPageNumber(t){if(!this._pageLabels)return null;const e=this._pageLabels.indexOf(t);return e<0?null:e+1}scrollPageIntoView({pageNumber:t,destArray:e=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:s=!1}){if(!this.pdfDocument)return;const n=Number.isInteger(t)&&this._pages[t-1];if(!n){console.error('scrollPageIntoView: "'.concat(t,'" is not a valid pageNumber parameter.'));return}if(this.isInPresentationMode||!e){this._setCurrentPageNumber(t,!0);return}let a=0,o=0,l=0,c=0,d,u;const g=n.rotation%180!==0,b=(g?n.height:n.width)/n.scale/Ns.PDF_TO_CSS_UNITS,w=(g?n.width:n.height)/n.scale/Ns.PDF_TO_CSS_UNITS;let v=0;switch(e[1].name){case"XYZ":a=e[2],o=e[3],v=e[4],a=a!==null?a:0,o=o!==null?o:w;break;case"Fit":case"FitB":v="page-fit";break;case"FitH":case"FitBH":o=e[2],v="page-width",o===null&&this._location?(a=this._location.left,o=this._location.top):(typeof o!="number"||o<0)&&(o=w);break;case"FitV":case"FitBV":a=e[2],l=b,c=w,v="page-height";break;case"FitR":a=e[2],o=e[3],l=e[4]-a,c=e[5]-o;let _=Gw,E=Xw;this.removePageBorders&&(_=E=0),d=(this.container.clientWidth-_)/l/Ns.PDF_TO_CSS_UNITS,u=(this.container.clientHeight-E)/c/Ns.PDF_TO_CSS_UNITS,v=Math.min(Math.abs(d),Math.abs(u));break;default:console.error('scrollPageIntoView: "'.concat(e[1].name,'" is not a valid destination type.'));return}if(s||(v&&v!==this._currentScale?this.currentScaleValue=v:this._currentScale===_p&&(this.currentScaleValue=oP)),v==="page-fit"&&!e[4]){p(this,X,cg).call(this,n);return}const A=[n.viewport.convertToViewportPoint(a,o),n.viewport.convertToViewportPoint(a+l,o+c)];let y=Math.min(A[0][0],A[1][0]),S=Math.min(A[0][1],A[1][1]);i||(y=Math.max(y,0),S=Math.max(S,0)),p(this,X,cg).call(this,n,{left:y,top:S})}_updateLocation(t){const e=this._currentScale,i=this._currentScaleValue,s=parseFloat(i)===e?Math.round(e*1e4)/100:i,n=t.id,a=this._pages[n-1],o=this.container,l=a.getPagePoint(o.scrollLeft-t.x,o.scrollTop-t.y),c=Math.round(l[0]),d=Math.round(l[1]);let u="#page=".concat(n);this.isInPresentationMode||(u+="&zoom=".concat(s,",").concat(c,",").concat(d)),this._location={pageNumber:n,scale:s,top:d,left:c,rotation:this._pagesRotation,pdfOpenParams:u}}update(){const t=this._getVisiblePages(),e=t.views,i=e.length;if(i===0)return;const s=Math.max(_v,2*i+1);r(this,An).resize(s,t.ids);for(const{view:l,visibleArea:c}of e)l.updateVisibleArea(c);for(const l of r(this,An))t.ids.has(l.id)||l.updateVisibleArea(null);this.renderingQueue.renderHighestPriority(t);const n=this._spreadMode===_e.NONE&&(this._scrollMode===rt.PAGE||this._scrollMode===rt.VERTICAL),a=this._currentPageNumber;let o=!1;for(const l of e){if(l.percent<100)break;if(l.id===a&&n){o=!0;break}}this._setCurrentPageNumber(o?a:e[0].id),this._updateLocation(t.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}containsElement(t){return this.container.contains(t)}focus(){this.container.focus()}get _isContainerRtl(){return getComputedStyle(this.container).direction==="rtl"}get isInPresentationMode(){return this.presentationModeState===nl.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===nl.CHANGING}get isHorizontalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const t=this._scrollMode===rt.PAGE?r(this,Ro).pages:this._pages,e=this._scrollMode===rt.HORIZONTAL,i=e&&this._isContainerRtl;return fP({scrollEl:this.container,views:t,sortByVisibility:!0,horizontal:e,rtl:i})}cleanup(){for(const t of this._pages)t.renderingState!==ct.FINISHED&&t.reset()}_cancelRendering(){for(const t of this._pages)t.cancelRendering()}forceRendering(t){const e=t||this._getVisiblePages(),i=p(this,X,uA).call(this,e),s=this._spreadMode!==_e.NONE&&this._scrollMode!==rt.HORIZONTAL,n=r(this,En)!==null||r(this,Ui)!==null&&e.views.some(o=>{var l;return(l=o.detailView)==null?void 0:l.renderingCancelled}),a=this.renderingQueue.getHighestPriority(e,this._pages,i,s,n);return a?(p(this,X,dA).call(this,a).then(()=>{this.renderingQueue.renderView(a)}),!0):!1}get hasEqualPageSizes(){const t=this._pages[0];for(let e=1,i=this._pages.length;e<i;++e){const s=this._pages[e];if(s.width!==t.width||s.height!==t.height)return!1}return!0}getPagesOverview(){let t;return this._pages.map(e=>{const i=e.pdfPage.getViewport({scale:1}),s=Kw(i);if(t===void 0)t=s;else if(this.enablePrintAutoRotate&&s!==t)return{width:i.height,height:i.width,rotation:(i.rotation-90)%360};return{width:i.width,height:i.height,rotation:i.rotation}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig({intent:"display"})):Promise.resolve(null)}set optionalContentConfigPromise(t){if(!(t instanceof Promise))throw new Error("Invalid optionalContentConfigPromise: ".concat(t));this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=t,this.refresh(!1,{optionalContentConfigPromise:t}),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:t}))}get scrollMode(){return this._scrollMode}set scrollMode(t){if(this._scrollMode!==t){if(!gP(t))throw new Error("Invalid scroll mode: ".concat(t));this.pagesCount>_f.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=t,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:t}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(t=null){const e=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",e===rt.HORIZONTAL),i.classList.toggle("scrollWrapped",e===rt.WRAPPED),!(!this.pdfDocument||!t)&&(e===rt.PAGE?p(this,X,Ac).call(this):this._previousScrollMode===rt.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&p(this,X,Fn).call(this,this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(t,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(t){if(this._spreadMode!==t){if(!pP(t))throw new Error("Invalid spread mode: ".concat(t));this._spreadMode=t,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:t}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(t=null){if(!this.pdfDocument)return;const e=this.viewer,i=this._pages;if(this._scrollMode===rt.PAGE)p(this,X,Ac).call(this);else if(e.textContent="",this._spreadMode===_e.NONE)for(const s of this._pages)e.append(s.div);else{const s=this._spreadMode-1;let n=null;for(let a=0,o=i.length;a<o;++a)n===null?(n=document.createElement("div"),n.className="spread",e.append(n)):a%2===s&&(n=n.cloneNode(!1),e.append(n)),n.append(i[a].div)}t&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&p(this,X,Fn).call(this,this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(t,!0),this.update())}_getPageAdvance(t,e=!1){switch(this._scrollMode){case rt.WRAPPED:{const{views:i}=this._getVisiblePages(),s=new Map;for(const{id:n,y:a,percent:o,widthPercent:l}of i){if(o===0||l<100)continue;let c=s.get(a);c||s.set(a,c||(c=[])),c.push(n)}for(const n of s.values()){const a=n.indexOf(t);if(a===-1)continue;const o=n.length;if(o===1)break;if(e)for(let l=a-1,c=0;l>=c;l--){const d=n[l],u=n[l+1]-1;if(d<u)return t-u}else for(let l=a+1,c=o;l<c;l++){const d=n[l],u=n[l-1]+1;if(d>u)return u-t}if(e){const l=n[0];if(l<t)return t-l+1}else{const l=n[o-1];if(l>t)return l-t+1}break}break}case rt.HORIZONTAL:break;case rt.PAGE:case rt.VERTICAL:{if(this._spreadMode===_e.NONE)break;const i=this._spreadMode-1;if(e&&t%2!==i)break;if(!e&&t%2===i)break;const{views:s}=this._getVisiblePages(),n=e?t-1:t+1;for(const{id:a,percent:o,widthPercent:l}of s)if(a===n){if(o>0&&l===100)return 2;break}break}}return 1}nextPage(){const t=this._currentPageNumber,e=this.pagesCount;if(t>=e)return!1;const i=this._getPageAdvance(t,!1)||1;return this.currentPageNumber=Math.min(t+i,e),!0}previousPage(){const t=this._currentPageNumber;if(t<=1)return!1;const e=this._getPageAdvance(t,!0)||1;return this.currentPageNumber=Math.max(t-e,1),!0}updateScale({drawingDelay:t,scaleFactor:e=null,steps:i=null,origin:s}){if(i===null&&e===null)throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let n=this._currentScale;if(e>0&&e!==1)n=Math.round(n*e*100)/100;else if(i){const a=i>0?zw:1/zw,o=i>0?Math.ceil:Math.floor;i=Math.abs(i);do n=o((n*a).toFixed(2)*10)/10;while(--i>0)}n=m_(n,lP,hP),p(this,X,Fn).call(this,n,{noScroll:!1,drawingDelay:t,origin:s})}increaseScale(t={}){var e;this.updateScale({...t,steps:(e=t.steps)!=null?e:1})}decreaseScale(t={}){var e;this.updateScale({...t,steps:-((e=t.steps)!=null?e:1)})}get containerTopLeft(){return r(this,$u)||f(this,$u,[this.container.offsetTop,this.container.offsetLeft])}get annotationEditorMode(){return r(this,ni)?r(this,$i):je.DISABLE}set annotationEditorMode({mode:t,editId:e=null,isFromKeyboard:i=!1,mustEnterInEditMode:s=!1,editComment:n=!1}){if(!r(this,ni))throw new Error("The AnnotationEditor is not enabled.");if(r(this,$i)===t)return;if(!Av(t))throw new Error("Invalid AnnotationEditor mode: ".concat(t));if(!this.pdfDocument)return;p(this,X,Ob).call(this,t);const{eventBus:a,pdfDocument:o}=this,l=async()=>{p(this,X,dg).call(this),f(this,$i,t),await r(this,ni).updateMode(t,e,i,s,n),!(t!==r(this,$i)||o!==this.pdfDocument)&&a.dispatch("annotationeditormodechanged",{source:this,mode:t})};if(t===je.NONE||r(this,$i)===je.NONE){const c=t!==je.NONE;c||this.pdfDocument.annotationStorage.resetModifiedIds();for(const u of this._pages)u.toggleEditingMode(c);const d=p(this,X,cA).call(this);if(c&&d){p(this,X,dg).call(this),f(this,Io,new AbortController);const u=AbortSignal.any([r(this,zr).signal,r(this,Io).signal]);a._on("pagerendered",({pageNumber:g})=>{d.delete(g),d.size===0&&f(this,Lo,setTimeout(l,0))},{signal:u});return}}l()}refresh(t=!1,e=Object.create(null)){if(this.pdfDocument){for(const i of this._pages)i.update(e);p(this,X,Fb).call(this),t||this.update()}}}An=new WeakMap,Vu=new WeakMap,Hu=new WeakMap,$i=new WeakMap,ni=new WeakMap,To=new WeakMap,ju=new WeakMap,$u=new WeakMap,Uu=new WeakMap,Wu=new WeakMap,zu=new WeakMap,Gu=new WeakMap,Xu=new WeakMap,qu=new WeakMap,Yu=new WeakMap,zr=new WeakMap,Ku=new WeakMap,Dh=new WeakMap,Ui=new WeakMap,Io=new WeakMap,Lo=new WeakMap,Nh=new WeakMap,Gr=new WeakMap,Fh=new WeakMap,Zu=new WeakMap,Oh=new WeakMap,Ro=new WeakMap,En=new WeakMap,Bh=new WeakMap,Qu=new WeakMap,Vh=new WeakMap,Ju=new WeakMap,X=new WeakSet,rA=function(t){const e={annotationEditorMode:r(this,$i),annotationMode:r(this,To),textLayerMode:r(this,Vh)};return t&&(!t.includes(mf.COPY)&&r(this,Vh)===Es.ENABLE&&(e.textLayerMode=Es.ENABLE_PERMISSIONS),t.includes(mf.MODIFY_CONTENTS)||(e.annotationEditorMode=je.DISABLE),!t.includes(mf.MODIFY_ANNOTATIONS)&&!t.includes(mf.FILL_INTERACTIVE_FORMS)&&r(this,To)===Sn.ENABLE_FORMS&&(e.annotationMode=Sn.ENABLE)),e},aA=async function(t){if(document.visibilityState==="hidden"||!this.container.offsetParent||this._getVisiblePages().views.length===0)return;const e=Promise.withResolvers(),i=new AbortController;document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&e.resolve()},{signal:AbortSignal.any([t,i.signal])}),await Promise.race([this._onePageRenderedCapability.promise,e.promise]),i.abort()},oA=function(t,e){const i=document.getSelection(),{focusNode:s,anchorNode:n}=i;if(n&&s&&i.containsNode(r(this,Gr))){if(r(this,Nh)||t===Es.ENABLE_PERMISSIONS){tb(e);return}f(this,Nh,!0);const{classList:a}=this.viewer;a.add("copyAll");const o=new AbortController;window.addEventListener("keydown",l=>f(this,Fh,l.key==="Escape"),{signal:o.signal}),this.getAllText().then(async l=>{l!==null&&await navigator.clipboard.writeText(l)}).catch(l=>{console.warn("Something goes wrong when extracting the text: ".concat(l.message))}).finally(()=>{f(this,Nh,!1),f(this,Fh,!1),o.abort(),a.remove("copyAll")}),tb(e)}},Ac=function(){if(this._scrollMode!==rt.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const t=this._currentPageNumber,e=r(this,Ro),i=this.viewer;if(i.textContent="",e.pages.length=0,this._spreadMode===_e.NONE&&!this.isInPresentationMode){const s=this._pages[t-1];i.append(s.div),e.pages.push(s)}else{const s=new Set,n=this._spreadMode-1;n===-1?s.add(t-1):t%2!==n?(s.add(t-1),s.add(t)):(s.add(t-2),s.add(t-1));const a=document.createElement("div");if(a.className="spread",this.isInPresentationMode){const o=document.createElement("div");o.className="dummyPage",a.append(o)}for(const o of s){const l=this._pages[o];l&&(a.append(l.div),e.pages.push(l))}i.append(a)}e.scrollDown=t>=e.previousPageNumber,e.previousPageNumber=t},cg=function(t,e=null){const{div:i,id:s}=t;if(this._currentPageNumber!==s&&this._setCurrentPageNumber(s),this._scrollMode===rt.PAGE&&(p(this,X,Ac).call(this),this.update()),!e&&!this.isInPresentationMode){const n=i.offsetLeft+i.clientLeft,a=n+i.clientWidth,{scrollLeft:o,clientWidth:l}=this.container;(this._scrollMode===rt.HORIZONTAL||n<o||a>o+l)&&(e={left:0,top:0})}v_(i,e),!this._currentScaleValue&&this._location&&(this._location=null)},lA=function(t){return t===this._currentScale||Math.abs(t-this._currentScale)<1e-15},kb=function(t,e,{noScroll:i=!1,preset:s=!1,drawingDelay:n=-1,origin:a=null}){if(this._currentScaleValue=e.toString(),p(this,X,lA).call(this,t)){s&&this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:e});return}this.viewer.style.setProperty("--scale-factor",t*Ns.PDF_TO_CSS_UNITS);const o=n>=0&&n<1e3;this.refresh(!0,{scale:t,drawingDelay:o?n:-1}),o&&f(this,En,setTimeout(()=>{f(this,En,null),this.refresh()},n));const l=this._currentScale;if(this._currentScale=t,!i){let c=this._currentPageNumber,d;if(this._location&&!(this.isInPresentationMode||this.isChangingPresentationMode)&&(c=this._location.pageNumber,d=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:c,destArray:d,allowNegativeOffset:!0}),Array.isArray(a)){const u=t/l-1,[g,b]=this.containerTopLeft;this.container.scrollLeft+=(a[0]-b)*u,this.container.scrollTop+=(a[1]-g)*u}}this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:s?e:void 0}),this.defaultRenderingQueue&&this.update()},hA=function(){return this._spreadMode!==_e.NONE&&this._scrollMode!==rt.HORIZONTAL?2:1},Fn=function(t,e){let i=parseFloat(t);if(i>0)e.preset=!1,p(this,X,kb).call(this,i,t,e);else{const s=this._pages[this._currentPageNumber-1];if(!s)return;let n=Gw,a=Xw;this.isInPresentationMode?(n=a=4,this._spreadMode!==_e.NONE&&(n*=2)):this.removePageBorders?n=a=0:this._scrollMode===rt.HORIZONTAL&&([n,a]=[a,n]);const o=(this.container.clientWidth-n)/s.width*s.scale/r(this,X,hA),l=(this.container.clientHeight-a)/s.height*s.scale;switch(t){case"page-actual":i=1;break;case"page-width":i=o;break;case"page-height":i=l;break;case"page-fit":i=Math.min(o,l);break;case"auto":const c=Kw(s)?o:Math.min(l,o);i=Math.min(cP,c);break;default:console.error('#setScale: "'.concat(t,'" is an unknown zoom value.'));return}e.preset=!0,p(this,X,kb).call(this,i,t,e)}},Db=function(){const t=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&p(this,X,Fn).call(this,this._currentScaleValue,{noScroll:!0}),p(this,X,cg).call(this,t)},cA=function(){const t=this._getVisiblePages(),e=[],{ids:i,views:s}=t;for(const n of s){const{view:a}=n;if(!a.hasEditableAnnotations()){i.delete(a.id);continue}e.push(n)}return e.length===0?null:(this.renderingQueue.renderHighestPriority({first:e[0],last:e.at(-1),views:e,ids:i}),i)},dA=async function(t){if(t.pdfPage)return t.pdfPage;try{const e=await this.pdfDocument.getPage(t.id);return t.pdfPage||t.setPdfPage(e),e}catch(e){return console.error("Unable to get page for page view",e),null}},uA=function(t){var e,i;if(((e=t.first)==null?void 0:e.id)===1)return!0;if(((i=t.last)==null?void 0:i.id)===this.pagesCount)return!1;switch(this._scrollMode){case rt.PAGE:return r(this,Ro).scrollDown;case rt.HORIZONTAL:return this.scroll.right}return this.scroll.down},Nb=function(t=this.container.clientHeight){t!==r(this,Zu)&&(f(this,Zu,t),mP.setProperty("--viewer-container-height","".concat(t,"px")))},fA=function(t){for(const e of t)if(e.target===this.container){p(this,X,Nb).call(this,Math.floor(e.borderBoxSize[0].blockSize)),f(this,$u,null);break}},Fb=function(){r(this,En)!==null&&(clearTimeout(r(this,En)),f(this,En,null)),r(this,Ui)!==null&&(clearTimeout(r(this,Ui)),f(this,Ui,null))},dg=function(){var t;(t=r(this,Io))==null||t.abort(),f(this,Io,null),r(this,Lo)!==null&&(clearTimeout(r(this,Lo)),f(this,Lo,null))},Ob=function(t){var e,i;switch(t){case je.STAMP:(e=r(this,Dh))==null||e.loadModel("altText");break;case je.SIGNATURE:(i=r(this,Bh))==null||i.loadSignatures();break}};class gA extends lw{_resetView(){super._resetView(),this._scrollMode=rt.PAGE,this._spreadMode=_e.NONE}set scrollMode(t){}_updateScrollMode(){}set spreadMode(t){}_updateSpreadMode(){}}globalThis.pdfjsViewer={AnnotationLayerBuilder:L_,DownloadManager:M_,EventBus:aw,FindState:Nn,GenericL10n:No,LinkTarget:na,parseQueryString:ap,PDFFindController:A_,PDFHistory:Bx,PDFLinkService:rw,PDFPageView:J_,PDFScriptingManager:Jx,PDFSinglePageViewer:gA,PDFViewer:lw,ProgressBar:bP,RenderingStates:ct,ScrollMode:rt,SimpleLinkService:op,SpreadMode:_e,StructTreeLayerBuilder:q_,TextLayerBuilder:Cg,XfaLayerBuilder:ow};const Ev=h=>{let t;const e=new Set,i=(c,d)=>{const u=typeof c=="function"?c(t):c;if(!Object.is(u,t)){const g=t;t=(d!=null?d:typeof u!="object"||u===null)?u:Object.assign({},t,u),e.forEach(b=>b(t,g))}},s=()=>t,o={setState:i,getState:s,getInitialState:()=>l,subscribe:c=>(e.add(c),()=>e.delete(c))},l=t=h(i,s,o);return o},sC=h=>h?Ev(h):Ev;function ci(h,t,e,i){function s(n){return n instanceof e?n:new e(function(a){a(n)})}return new(e||(e=Promise))(function(n,a){function o(d){try{c(i.next(d))}catch(u){a(u)}}function l(d){try{c(i.throw(d))}catch(u){a(u)}}function c(d){d.done?n(d.value):s(d.value).then(o,l)}c((i=i.apply(h,t||[])).next())})}function D(h,t,e,i){if(e==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?h!==t||!i:!t.has(h))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?i:e==="a"?i.call(h):i?i.value:t.get(h)}function yt(h,t,e,i,s){if(typeof t=="function"?h!==t||!s:!t.has(h))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s?s.value=e:t.set(h,e),e}const de={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},ha={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},nC={ENABLE:1},Tg={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},Vc={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};class rC{constructor(){const t=window.devicePixelRatio||1;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}}function aC(h,t,e=!1){let i=h.offsetParent;if(!i){console.error("offsetParent is not set -- cannot scroll");return}let s=h.offsetTop+h.clientTop,n=h.offsetLeft+h.clientLeft;for(;i.clientHeight===i.scrollHeight&&i.clientWidth===i.scrollWidth||e&&(i.classList.contains("markedContent")||getComputedStyle(i).overflow==="hidden");)if(s+=i.offsetTop,n+=i.offsetLeft,i=i.offsetParent,!i)return;t&&(t.top!==void 0&&(s+=t.top),t.left!==void 0&&(n+=t.left,i.scrollLeft=n)),i.scrollTop=s}function oC(h,t,e=void 0){const i=function(a){n||(n=window.requestAnimationFrame(function(){n=null;const l=h.scrollLeft,c=s.lastX;l!==c&&(s.right=l>c),s.lastX=l;const d=h.scrollTop,u=s.lastY;d!==u&&(s.down=d>u),s.lastY=d,t(s)}))},s={right:!0,down:!0,lastX:h.scrollLeft,lastY:h.scrollTop,_eventHandler:i};let n=null;return h.addEventListener("scroll",i,{useCapture:!0,signal:e}),e==null||e.addEventListener("abort",()=>window.cancelAnimationFrame(n),{once:!0}),s}function lC(h,t,e=0){let i=e,s=h.length-1;if(s<0||!t(h[s]))return h.length;if(t(h[i]))return i;for(;i<s;){const n=i+s>>1,a=h[n];t(a)?s=n:i=n+1}return i}function hC({view:h,userUnit:t,rotate:e}){const[i,s,n,a]=h,o=e%180!==0,l=(n-i)/72*t,c=(a-s)/72*t;return{width:o?c:l,height:o?l:c}}function cC(h,t,e){if(h<2)return h;let i=t[h].div,s=i.offsetTop+i.clientTop;s>=e&&(i=t[h-1].div,s=i.offsetTop+i.clientTop);for(let n=h-2;n>=0&&(i=t[n].div,!(i.offsetTop+i.clientTop+i.clientHeight<=s));--n)h=n;return h}function dC({scrollEl:h,views:t,sortByVisibility:e=!1,horizontal:i=!1,rtl:s=!1}){const n=h.scrollTop,a=n+h.clientHeight,o=h.scrollLeft,l=o+h.clientWidth;function c(S){const _=S.div;return _.offsetTop+_.clientTop+_.clientHeight>n}function d(S){const _=S.div,E=_.offsetLeft+_.clientLeft,P=E+_.clientWidth;return s?E<l:P>o}const u=[],g=new Set,b=t.length;let w=lC(t,i?d:c);w>0&&w<b&&!i&&(w=cC(w,t,n));let v=i?l:-1;for(let S=w;S<b;S++){const _=t[S],E=_.div,P=E.offsetLeft+E.clientLeft,x=E.offsetTop+E.clientTop,T=E.clientWidth,I=E.clientHeight,C=P+T,L=x+I;if(v===-1)L>=a&&(v=L);else if((i?P:x)>v)break;if(L<=n||x>=a||C<=o||P>=l)continue;const M=Math.max(0,n-x)+Math.max(0,L-a),G=Math.max(0,o-P)+Math.max(0,C-l),W=(I-M)/I,$=(T-G)/T,Tt=W*$*100|0;u.push({id:_.id,x:P,y:x,view:_,percent:Tt,widthPercent:$*100|0}),g.add(_.id)}const A=u[0],y=u.at(-1);return e&&u.sort(function(S,_){const E=S.percent-_.percent;return Math.abs(E)>.001?-E:S.id-_.id}),{first:A,last:y,views:u,ids:g}}function uC(h){let t=Math.hypot(h.deltaX,h.deltaY);const e=Math.atan2(h.deltaY,h.deltaX);return-.25*Math.PI<e&&e<.75*Math.PI&&(t=-t),t}function fC(h){const t=h.deltaMode;let e=uC(h);const i=30,s=30;return t===WheelEvent.DOM_DELTA_PIXEL?e/=i*s:t===WheelEvent.DOM_DELTA_LINE&&(e/=s),e}function pA(h){return Number.isInteger(h)&&h%90===0}function gC(h){return Number.isInteger(h)&&Object.values(Tg).includes(h)&&h!==Tg.UNKNOWN}function pC(h){return Number.isInteger(h)&&Object.values(Vc).includes(h)&&h!==Vc.UNKNOWN}function mC(h){return h.width<=h.height}new Promise(function(h){window.requestAnimationFrame(h)});document.documentElement.style;(function(){const h=document.createElement("div");return h.style.width="round(down, calc(1.6666666666666665 * 792px), 1px)",h.style.width==="calc(1320px)"?Math.fround:t=>t})();const bC=3e4;class wC{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1,Object.defineProperty(this,"hasViewer",{value:()=>!!this.pdfViewer})}setViewer(t){this.pdfViewer=t}setThumbnailViewer(t){this.pdfThumbnailViewer=t}isHighestPriority(t){return this.highestPriorityPage===t.renderingId}renderHighestPriority(t){var e;this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),!this.pdfViewer.forceRendering(t)&&(this.isThumbnailViewEnabled&&(!((e=this.pdfThumbnailViewer)===null||e===void 0)&&e.forceRendering())||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),bC)))}getHighestPriority(t,e,i,s=!1){const n=t.views,a=n.length;if(a===0)return null;for(let u=0;u<a;u++){const g=n[u].view;if(!this.isViewFinished(g))return g}const o=t.first.id,l=t.last.id;if(l-o+1>a){const u=t.ids;for(let g=1,b=l-o;g<b;g++){const w=i?o+g:l-g;if(u.has(w))continue;const v=e[w-1];if(!this.isViewFinished(v))return v}}let c=i?l:o-2,d=e[c];return d&&!this.isViewFinished(d)||s&&(c+=i?1:-1,d=e[c],d&&!this.isViewFinished(d))?d:null}isViewFinished(t){return t.renderingState===de.FINISHED}renderView(t){switch(t.renderingState){case de.FINISHED:return!1;case de.PAUSED:this.highestPriorityPage=t.renderingId,t.resume();break;case de.RUNNING:this.highestPriorityPage=t.renderingId;break;case de.INITIAL:this.highestPriorityPage=t.renderingId,t.draw().finally(()=>{this.renderHighestPriority()}).catch(e=>{e instanceof Uh||console.error("renderView:",e)});break}return!0}}var Ec,Sc,Wi,Bb,Vb,Hb,jb,Sv;const Pv=2,xv=3;class hw{static getCanvas(t,e){const i=yt(this,Ec,D(this,Ec,"f",Sc)||document.createElement("canvas"),"f",Sc);i.width=t,i.height=e;const s=i.getContext("2d",{alpha:!1});return s.save(),s.fillStyle="rgb(255, 255, 255)",s.fillRect(0,0,t,e),s.restore(),[i,i.getContext("2d")]}static destroyCanvas(){const t=D(this,Ec,"f",Sc);t&&(t.width=0,t.height=0),yt(this,Ec,null,"f",Sc)}}Ec=hw;Sc={value:null};class vC{constructor({container:t,eventBus:e,id:i,defaultViewport:s,optionalContentConfigPromise:n,linkService:a,renderingQueue:o,pageColors:l,enableHWA:c,store:d,thumbnailWidth:u}){Wi.add(this),this.id=i,this.renderingId="thumbnail"+i,this.pageLabel=null,this.pdfPage=null,this.rotation=0,this.viewport=s,this.pdfPageRotate=s.rotation,this._optionalContentConfigPromise=n||null,this.pageColors=l||null,this.enableHWA=c||!1,this.eventBus=e,this.linkService=a,this.renderingQueue=o,this.renderTask=null,this.renderingState=de.INITIAL,this.resume=null,this.store=d,this.thumbnailWidth=u,this.loaded=!1;const g=document.createElement("div");g.className="thumbnail pdfSlickThumbHolder",g.setAttribute("data-page-number",this.id.toString()),this.div=g,D(this,Wi,"m",Bb).call(this),t.append(g)}setPdfPage(t){this.pdfPage=t,this.pdfPageRotate=t.rotate;const e=(this.rotation+this.pdfPageRotate)%360;this.viewport=t.getViewport({scale:1,rotation:e}),this.reset()}reset(){this.cancelRendering(),this.renderingState=de.INITIAL,this.div.removeAttribute("data-loaded"),this.loaded=!1,D(this,Wi,"m",Bb).call(this)}update({rotation:t=null}){typeof t=="number"&&(this.rotation=t);const e=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:e}),this.reset()}cancelRendering(){this.renderTask&&(this.renderTask.cancel(),this.renderTask=null),this.resume=null}draw(){return ci(this,void 0,void 0,function*(){if(this.renderingState!==de.INITIAL){console.error("Must be in new state before drawing");return}const{pdfPage:t}=this;if(!t)throw this.renderingState=de.FINISHED,new Error("pdfPage is not loaded");this.renderingState=de.RUNNING;const{ctx:e,canvas:i,transform:s}=D(this,Wi,"m",Vb).call(this,Pv),n=this.viewport.clone({scale:Pv*this.scale}),a=d=>{if(!this.renderingQueue.isHighestPriority(this)){this.renderingState=de.PAUSED,this.resume=()=>{this.renderingState=de.RUNNING,d()};return}d()},o={canvasContext:e,transform:s,viewport:n,optionalContentConfigPromise:this._optionalContentConfigPromise,pageColors:this.pageColors},l=this.renderTask=t.render(o);l.onContinue=a;const c=l.promise.then(()=>D(this,Wi,"m",jb).call(this,l,i),d=>D(this,Wi,"m",jb).call(this,l,i,d));return c.finally(()=>{i.width=0,i.height=0,this.eventBus.dispatch("thumbnailrendered",{source:this,pageNumber:this.id,pdfPage:this.pdfPage})}),c})}setImage(t){if(this.renderingState!==de.INITIAL)return;const{thumbnailCanvas:e,pdfPage:i,scale:s}=t;e&&(this.pdfPage||this.setPdfPage(i),!(s<this.scale)&&(this.renderingState=de.FINISHED,D(this,Wi,"m",Hb).call(this,e)))}setPageLabel(t){this.pageLabel=typeof t=="string"?t:null}}Wi=new WeakSet,Bb=function(){const{width:t,height:e}=this.viewport,i=t/e;this.canvasWidth=this.thumbnailWidth,this.canvasHeight=this.canvasWidth/i|0,this.scale=this.canvasWidth/t;const{style:s}=this.div;s.setProperty("--thumbnail-width","".concat(this.canvasWidth,"px")),s.setProperty("--thumbnail-height","".concat(this.canvasHeight,"px"))},Vb=function(t=1,e=this.enableHWA){const i=document.createElement("canvas"),s=i.getContext("2d",{alpha:!1,willReadFrequently:!e}),n=new rC;i.width=t*this.canvasWidth*n.sx|0,i.height=t*this.canvasHeight*n.sy|0;const a=n.scaled?[n.sx,0,0,n.sy,0,0]:null;return{ctx:s,canvas:i,transform:a}},Hb=function(t){if(this.renderingState!==de.FINISHED)throw new Error("#convertCanvasToImage: Rendering has not finished.");const e=D(this,Wi,"m",Sv).call(this,t);this.src=e.toDataURL(),this.div.setAttribute("data-loaded","true"),this.loaded=!0,this.store.getState()._setThumbnailView(this.id,this),e.width=0,e.height=0},jb=function(t,e){return ci(this,arguments,void 0,function*(i,s,n=null){if(i===this.renderTask&&(this.renderTask=null),!(n instanceof Uh)&&(this.renderingState=de.FINISHED,D(this,Wi,"m",Hb).call(this,s),n))throw n})},Sv=function(t){const{ctx:e,canvas:i}=D(this,Wi,"m",Vb).call(this,1,!0);if(t.width<=2*i.width)return e.drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),i;let s=i.width<<xv,n=i.height<<xv;const[a,o]=hw.getCanvas(s,n);for(;s>t.width||n>t.height;)s>>=1,n>>=1;for(o.drawImage(t,0,0,t.width,t.height,0,0,s,n);s>2*i.width;)o.drawImage(a,0,0,s,n,0,0,s>>1,n>>1),s>>=1,n>>=1;return e.drawImage(a,0,0,s,n,0,0,i.width,i.height),i};var Qi,mA,$b,Ub,bA,wA,vA;const yC=-19,Cp="selected";class _C{constructor({container:t,eventBus:e,linkService:i,renderingQueue:s,pageColors:n,abortSignal:a,enableHWA:o,store:l,thumbnailWidth:c}){Qi.add(this),this.container=t,this.eventBus=e,this.linkService=i,this.renderingQueue=s,this.pageColors=n||null,this.enableHWA=o||!1,this.store=l,this.thumbnailWidth=c,this.scroll=oC(this.container,D(this,Qi,"m",mA).bind(this),a),D(this,Qi,"m",Ub).call(this)}getThumbnail(t){return this._thumbnails[t]}scrollThumbnailIntoView(t){if(!this.pdfDocument)return;const e=this._thumbnails[t-1];if(!e){console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');return}t!==this._currentPageNumber&&(this._thumbnails[this._currentPageNumber-1].div.classList.remove(Cp),e.div.classList.add(Cp));const{first:i,last:s,views:n}=D(this,Qi,"m",$b).call(this);if(n.length>0){let a=!1;if(t<=i.id||t>=s.id)a=!0;else for(const{id:o,percent:l}of n)if(o===t){a=l<100;break}a&&aC(e.div,{top:yC})}this._currentPageNumber=t}get pagesRotation(){return this._pagesRotation}set pagesRotation(t){if(!pA(t))throw new Error("Invalid thumbnails rotation angle.");if(!this.pdfDocument||this._pagesRotation===t)return;this._pagesRotation=t;const e={rotation:t};for(const i of this._thumbnails)i.update(e)}cleanup(){for(const t of this._thumbnails)t.renderingState!==de.FINISHED&&t.reset();hw.destroyCanvas()}setDocument(t){if(this.pdfDocument&&(D(this,Qi,"m",bA).call(this),D(this,Qi,"m",Ub).call(this)),this.pdfDocument=t,!t)return;const e=t.getPage(1),i=t.getOptionalContentConfig({intent:"display"});e.then(s=>{var n;const a=t.numPages,o=s.getViewport({scale:1});for(let c=1;c<=a;++c){const d=new vC({container:this.container,eventBus:this.eventBus,id:c,defaultViewport:o.clone(),optionalContentConfigPromise:i,linkService:this.linkService,renderingQueue:this.renderingQueue,pageColors:this.pageColors,enableHWA:this.enableHWA,store:this.store,thumbnailWidth:this.thumbnailWidth});this._thumbnails.push(d)}(n=this._thumbnails[0])===null||n===void 0||n.setPdfPage(s),this._thumbnails[this._currentPageNumber-1].div.classList.add(Cp),this.store.getState()._setThumbnailsViews(this._thumbnails)}).catch(s=>{console.error("Unable to initialize thumbnail viewer",s)})}setPageLabels(t){var e,i;if(this.pdfDocument){t?Array.isArray(t)&&this.pdfDocument.numPages===t.length?this._pageLabels=t:(this._pageLabels=null,console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let s=0,n=this._thumbnails.length;s<n;s++)this._thumbnails[s].setPageLabel((i=(e=this._pageLabels)===null||e===void 0?void 0:e[s])!==null&&i!==void 0?i:null)}}forceRendering(){const t=D(this,Qi,"m",$b).call(this),e=D(this,Qi,"m",vA).call(this,t),i=this.renderingQueue.getHighestPriority(t,this._thumbnails,e);return i?(D(this,Qi,"m",wA).call(this,i).then(()=>{this.renderingQueue.renderView(i)}),!0):!1}}Qi=new WeakSet,mA=function(){this.renderingQueue.renderHighestPriority()},$b=function(){return dC({scrollEl:this.container,views:this._thumbnails})},Ub=function(){this._thumbnails=[],this._currentPageNumber=1,this._pageLabels=null,this._pagesRotation=0,this.container.textContent=""},bA=function(){for(const t of this._thumbnails)t.cancelRendering()},wA=function(t){return ci(this,void 0,void 0,function*(){if(t.pdfPage)return t.pdfPage;try{const e=yield this.pdfDocument.getPage(t.id);return t.pdfPage||t.setPdfPage(e),e}catch(e){return console.error("Unable to get page for thumb view",e),null}})},vA=function(t){var e,i;return((e=t.first)===null||e===void 0?void 0:e.id)===1?!0:((i=t.last)===null||i===void 0?void 0:i.id)===this._thumbnails.length?!1:this.scroll.down};function AC(h,t){const e=t.allXfaHtml,i=new op,s=Math.round(Yr.PDF_TO_CSS_UNITS*100)/100;for(const n of e==null?void 0:e.children){const a=document.createElement("div");a.className="xfaPrintedPage",h.append(a);const o=new ow({pdfPage:null,annotationStorage:t.annotationStorage,linkService:i,xfaHtml:n}),l=ly(n,{scale:s});o.render({viewport:l,intent:"print"}),a.append(o.div)}}let Ic=null;function EC(h,t,e,i,s,n,a){const o=h.scratchCanvas,l=s/Yr.PDF;o.width=Math.floor(i.width*l),o.height=Math.floor(i.height*l);const c=o.getContext("2d");return c.save(),c.fillStyle="rgb(255, 255, 255)",c.fillRect(0,0,o.width,o.height),c.restore(),Promise.all([t.getPage(e),a]).then(function([d,u]){const g={canvasContext:c,transform:[l,0,0,l,0,0],viewport:d.getViewport({scale:1,rotation:i.rotation}),intent:"print",annotationMode:Ps.ENABLE_STORAGE,optionalContentConfigPromise:n,printAnnotationStorage:u};return d.render(g).promise.catch(w=>{throw w instanceof Uh||console.error(w),w})})}class SC{constructor({pdfDocument:t,pagesOverview:e,printContainer:i,printResolution:s,printAnnotationStoragePromise:n=null}){this.pdfDocument=t,this.pagesOverview=e,this.printContainer=i,this._printResolution=s||150,this._optionalContentConfigPromise=t.getOptionalContentConfig({intent:"print"}),this._printAnnotationStoragePromise=n||Promise.resolve(),this.currentPage=-1,this.scratchCanvas=document.createElement("canvas")}layout(){this.throwIfInactive();const t=document.querySelector("body");t.setAttribute("data-pdfjsprinting","true");const{width:e,height:i}=this.pagesOverview[0];this.pagesOverview.every(n=>n.width===e&&n.height===i)||console.warn("Not all pages have the same size. The printed result may be incorrect!"),this.pageStyleSheet=document.createElement("style"),this.pageStyleSheet.textContent="@page { size: ".concat(e,"pt ").concat(i,"pt;}"),t.append(this.pageStyleSheet)}destroy(){if(Ic!==this)return;this.printContainer.textContent="",document.querySelector("body").removeAttribute("data-pdfjsprinting"),this.pageStyleSheet&&(this.pageStyleSheet.remove(),this.pageStyleSheet=null),this.scratchCanvas.width=this.scratchCanvas.height=0,this.scratchCanvas=null,Ic=null}renderPages(t){if(this.pdfDocument.isPureXfa)return AC(this.printContainer,this.pdfDocument),Promise.resolve();const e=this.pagesOverview.length,i=(s,n)=>{if(this.throwIfInactive(),++this.currentPage>=e){t({index:e,total:e}),s();return}const a=this.currentPage;t({index:a,total:e}),EC(this,this.pdfDocument,a+1,this.pagesOverview[a],this._printResolution,this._optionalContentConfigPromise,this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then(function(){i(s,n)},n)};return new Promise(i)}useRenderedPage(){this.throwIfInactive();const t=document.createElement("img");this.scratchCanvas.toBlob(a=>{t.src=URL.createObjectURL(a)});const e=document.createElement("div");e.className="printedPage",e.append(t),this.printContainer.append(e);const{promise:i,resolve:s,reject:n}=Promise.withResolvers();return t.onload=s,t.onerror=n,i.catch(()=>{}).then(()=>{URL.revokeObjectURL(t.src)}),i}performPrint(){return this.throwIfInactive(),new Promise(t=>{setTimeout(()=>{if(!this.active){t();return}window.print(),setTimeout(t,20)},0)})}get active(){return this===Ic}throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}}const yA={instance:{supportsPrinting:!0,createPrintService(h){if(Ic)throw new Error("The print service is created and active.");return Ic=new SC(h)}}};var St,Lc,Te,aa,oa,Cv,Rc,Tv,Iv,Lv,Rv,Tp,Mv,Kh,kv,Dv,Nv,_A,Wb;const PC=3e3,Fv="pdfPresentationMode",Ip="pdfPresentationModeControls",xC=50,CC=.1,Ov=50,Lp=Math.PI/6;class TC{constructor({container:t,pdfViewer:e,eventBus:i}){St.add(this),Lc.set(this,ha.UNKNOWN),Te.set(this,null),aa.set(this,null),oa.set(this,null),this.container=t,this.pdfViewer=e,this.eventBus=i,this.contextMenuOpen=!1,this.mouseScrollTimeStamp=0,this.mouseScrollDelta=0,this.touchSwipeState=null}request(){return ci(this,void 0,void 0,function*(){const{container:t,pdfViewer:e}=this;if(this.active||!e.pagesCount||!t.requestFullscreen)return!1;D(this,St,"m",_A).call(this),D(this,St,"m",Rc).call(this,ha.CHANGING);const i=t.requestFullscreen();yt(this,Te,{pageNumber:e.currentPageNumber,scaleValue:e.currentScaleValue,scrollMode:e.scrollMode,spreadMode:null,annotationEditorMode:null}),e.spreadMode!==Vc.NONE&&!(e.pageViewsReady&&e.hasEqualPageSizes)&&(console.warn("Ignoring Spread modes when entering PresentationMode, since the document may contain varying page sizes."),D(this,Te,"f").spreadMode=e.spreadMode),e.annotationEditorMode!==Y.DISABLE&&(D(this,Te,"f").annotationEditorMode=e.annotationEditorMode);try{return yield i,e.focus(),!0}catch(s){D(this,St,"m",Wb).call(this),D(this,St,"m",Rc).call(this,ha.NORMAL)}return!1})}get active(){return D(this,Lc,"f")===ha.CHANGING||D(this,Lc,"f")===ha.FULLSCREEN}}Lc=new WeakMap,Te=new WeakMap,aa=new WeakMap,oa=new WeakMap,St=new WeakSet,Cv=function(t){if(!this.active)return;t.preventDefault();const e=fC(t),i=Date.now(),s=this.mouseScrollTimeStamp;if(!(i>s&&i-s<xC)&&((this.mouseScrollDelta>0&&e<0||this.mouseScrollDelta<0&&e>0)&&D(this,St,"m",Kh).call(this),this.mouseScrollDelta+=e,Math.abs(this.mouseScrollDelta)>=CC)){const n=this.mouseScrollDelta;D(this,St,"m",Kh).call(this),(n>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=i)}},Rc=function(t){yt(this,Lc,t),this.eventBus.dispatch("presentationmodechanged",{source:this,state:t})},Tv=function(){var t;D(this,St,"m",Rc).call(this,ha.FULLSCREEN),this.container.classList.add(Fv),setTimeout(()=>{this.pdfViewer.scrollMode=Tg.PAGE,D(this,Te,"f").spreadMode!==null&&(this.pdfViewer.spreadMode=Vc.NONE),this.pdfViewer.currentPageNumber=D(this,Te,"f").pageNumber,this.pdfViewer.currentScaleValue="page-fit",D(this,Te,"f").annotationEditorMode!==null&&(this.pdfViewer.annotationEditorMode={mode:Y.NONE})},0),D(this,St,"m",Dv).call(this),D(this,St,"m",Tp).call(this),this.contextMenuOpen=!1,(t=document.getSelection())===null||t===void 0||t.empty()},Iv=function(){const t=this.pdfViewer.currentPageNumber;this.container.classList.remove(Fv),setTimeout(()=>{D(this,St,"m",Wb).call(this),D(this,St,"m",Rc).call(this,ha.NORMAL),this.pdfViewer.scrollMode=D(this,Te,"f").scrollMode,D(this,Te,"f").spreadMode!==null&&(this.pdfViewer.spreadMode=D(this,Te,"f").spreadMode),this.pdfViewer.currentScaleValue=D(this,Te,"f").scaleValue,this.pdfViewer.currentPageNumber=t,D(this,Te,"f").annotationEditorMode!==null&&(this.pdfViewer.annotationEditorMode={mode:D(this,Te,"f").annotationEditorMode}),yt(this,Te,null)},0),D(this,St,"m",Nv).call(this),D(this,St,"m",Mv).call(this),D(this,St,"m",Kh).call(this),this.contextMenuOpen=!1},Lv=function(t){var e;if(this.contextMenuOpen){this.contextMenuOpen=!1,t.preventDefault();return}t.button===0&&(t.target.href&&(!((e=t.target.parentNode)===null||e===void 0)&&e.hasAttribute("data-internal-link"))||(t.preventDefault(),t.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()))},Rv=function(){this.contextMenuOpen=!0},Tp=function(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(Ip),this.controlsTimeout=setTimeout(()=>{this.container.classList.remove(Ip),delete this.controlsTimeout},PC)},Mv=function(){this.controlsTimeout&&(clearTimeout(this.controlsTimeout),this.container.classList.remove(Ip),delete this.controlsTimeout)},Kh=function(){this.mouseScrollTimeStamp=0,this.mouseScrollDelta=0},kv=function(t){if(this.active){if(t.touches.length>1){this.touchSwipeState=null;return}switch(t.type){case"touchstart":this.touchSwipeState={startX:t.touches[0].pageX,startY:t.touches[0].pageY,endX:t.touches[0].pageX,endY:t.touches[0].pageY};break;case"touchmove":if(this.touchSwipeState===null)return;this.touchSwipeState.endX=t.touches[0].pageX,this.touchSwipeState.endY=t.touches[0].pageY,t.preventDefault();break;case"touchend":if(this.touchSwipeState===null)return;let e=0;const i=this.touchSwipeState.endX-this.touchSwipeState.startX,s=this.touchSwipeState.endY-this.touchSwipeState.startY,n=Math.abs(Math.atan2(s,i));Math.abs(i)>Ov&&(n<=Lp||n>=Math.PI-Lp)?e=i:Math.abs(s)>Ov&&Math.abs(n-Math.PI/2)<=Lp&&(e=s),e>0?this.pdfViewer.previousPage():e<0&&this.pdfViewer.nextPage();break}}},Dv=function(){if(D(this,oa,"f"))return;yt(this,oa,new AbortController);const{signal:t}=D(this,oa,"f"),e=D(this,St,"m",kv).bind(this);window.addEventListener("mousemove",D(this,St,"m",Tp).bind(this),{signal:t}),window.addEventListener("mousedown",D(this,St,"m",Lv).bind(this),{signal:t}),window.addEventListener("wheel",D(this,St,"m",Cv).bind(this),{passive:!1,signal:t}),window.addEventListener("keydown",D(this,St,"m",Kh).bind(this),{signal:t}),window.addEventListener("contextmenu",D(this,St,"m",Rv).bind(this),{signal:t}),window.addEventListener("touchstart",e,{signal:t}),window.addEventListener("touchmove",e,{signal:t}),window.addEventListener("touchend",e,{signal:t})},Nv=function(){var t;(t=D(this,oa,"f"))===null||t===void 0||t.abort(),yt(this,oa,null)},_A=function(){D(this,aa,"f")||(yt(this,aa,new AbortController),window.addEventListener("fullscreenchange",()=>{document.fullscreenElement?D(this,St,"m",Tv).call(this):D(this,St,"m",Iv).call(this)},{signal:D(this,aa,"f").signal}))},Wb=function(){var t;(t=D(this,aa,"f"))===null||t===void 0||t.abort(),yt(this,aa,null)};const IC={isDocumentLoaded:!1,pagesReady:!1,url:null,numPages:0,pageNumber:0,scale:0,scaleValue:"auto",pagesRotation:0,spreadMode:Vc.UNKNOWN,scrollMode:Tg.UNKNOWN,documentOutline:null,attachments:new Map,thumbnails:new Map,thumbnailViews:new Map,annotationEditorMode:Y.NONE,pdfSlick:null},AA=()=>sC((h,t)=>Object.assign(Object.assign({},IC),{_setThumbnailView:(e,i)=>{const s=new Map(t().thumbnails),n=new Map(t().thumbnailViews),{canvasWidth:a,canvasHeight:o,scale:l,rotation:c,loaded:d,pageLabel:u,src:g=null}=i;n.set(e,i),s.set(e,{pageNumber:e,width:a,height:o,scale:l,rotation:c,loaded:d,pageLabel:u,src:g}),h({thumbnailViews:n,thumbnails:s})},_setThumbnailsViews:e=>{const i=new Map(e.map(n=>[n.id,n])),s=new Map(e.map(n=>{const{canvasWidth:a,canvasHeight:o,scale:l,rotation:c,loaded:d,pageLabel:u,src:g=null}=n;return[n.id,{pageNumber:n.id,width:a,height:o,scale:l,rotation:c,loaded:d,pageLabel:u,src:g}]}));h({thumbnailViews:i,thumbnails:s})}}));var ug,li,Ko,Zo,EA,SA;class LC{constructor({eventBus:t,slick:e,printDialog:i}){ug.add(this),li.set(this,null),Ko.set(this,null),Zo.set(this,null),this.eventBus=t,this.slick=e,this.printDialog=i!=null?i:null,this.bindEvents()}get supportsPrinting(){return yA.instance.supportsPrinting}get printing(){return!!D(this,li,"f")}print(){return ci(this,void 0,void 0,function*(){var t,e;if(this.supportsPrinting){if(this.printing){console.warn("Ignored pdf print because of a pending print job.");return}yield(t=this.printDialog)===null||t===void 0?void 0:t.open({close:()=>this.abort()});try{this.eventBus.dispatch("beforeprint",{source:this})}finally{if(!this.printing)console.error("Expected print service to be initialized."),(e=this.printDialog)===null||e===void 0||e.close();else{const i=D(this,li,"f");yield i.renderPages(s=>{var n;return(n=this.printDialog)===null||n===void 0?void 0:n.progress(s)}).then(()=>i.performPrint()).catch(()=>{}).then(()=>{i===D(this,li,"f")&&this.abort()})}}}})}abort(){var t;D(this,li,"f")&&(D(this,li,"f").destroy(),(t=this.printDialog)===null||t===void 0||t.close(),this.eventBus.dispatch("afterprint",{source:this}))}bindEvents(){yt(this,Ko,new AbortController);const{signal:t}=D(this,Ko,"f"),e={signal:t};this.eventBus._on("beforeprint",D(this,ug,"m",EA).bind(this),e),this.eventBus._on("afterprint",D(this,ug,"m",SA).bind(this),e),window.addEventListener("beforeprint",()=>this.eventBus.dispatch("beforeprint",{source:window}),e),window.addEventListener("afterprint",()=>this.eventBus.dispatch("afterprint",{source:window}),e),window.addEventListener("keydown",i=>{i.keyCode===80&&(i.ctrlKey||i.metaKey)&&!i.altKey&&(!i.shiftKey||window.chrome||window.opera)&&(this.print(),i.preventDefault(),i.stopImmediatePropagation())},{signal:t,capture:!0})}unbindEvents(){var t;(t=D(this,Ko,"f"))===null||t===void 0||t.abort(),yt(this,Ko,null)}}li=new WeakMap,Ko=new WeakMap,Zo=new WeakMap,ug=new WeakSet,EA=function(){if(!D(this,li,"f")&&this.supportsPrinting){if(!this.slick.viewer.pageViewsReady){this.slick.l10n.get("printing_not_ready",null).then(t=>{window.alert(t)});return}yt(this,Zo,RC()),yt(this,li,yA.instance.createPrintService({pdfDocument:this.slick.document,pagesOverview:this.slick.viewer.getPagesOverview(),printContainer:D(this,Zo,"f").element,printResolution:this.slick.printResolution,optionalContentConfigPromise:null,printAnnotationStoragePromise:null})),this.slick.forceRendering(),D(this,li,"f").layout()}},SA=function(){var t,e,i;D(this,li,"f")&&(D(this,li,"f").destroy(),yt(this,li,null),(t=this.printDialog)===null||t===void 0||t.close(),(e=D(this,Zo,"f"))===null||e===void 0||e.remove(),yt(this,Zo,null),(i=this.slick.document)===null||i===void 0||i.annotationStorage.resetModified()),this.slick.forceRendering()};function RC(){const h=document.createElement("div");h.classList.add("pdfSlickPrintContainer"),document.body.append(h);const t=document.createElement("style");return t.textContent="\n@page {\n margin: 0;\n}\n\n.pdfSlickPrintContainer {\n display: none;\n}\n\n@media print {\n body {\n background: rgb(0 0 0 / 0) none;\n }\n\n body[data-pdfjsprinting] > *:not(.pdfSlickPrintContainer) {\n display: none;\n }\n\n body[data-pdfjsprinting] .pdfSlickPrintContainer {\n display: block;\n }\n\n .pdfSlickPrintContainer {\n height: 100%;\n }\n\n /* wrapper around (scaled) print canvas elements */\n .pdfSlickPrintContainer > .printedPage {\n page-break-after: always;\n page-break-inside: avoid;\n\n /* The wrapper always cover the whole page. */\n height: 100%;\n width: 100%;\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .pdfSlickPrintContainer > .xfaPrintedPage .xfaPage {\n position: absolute;\n }\n\n .pdfSlickPrintContainer > .xfaPrintedPage {\n page-break-after: always;\n page-break-inside: avoid;\n width: 100%;\n height: 100%;\n position: relative;\n }\n\n .pdfSlickPrintContainer > .printedPage :is(canvas, img) {\n /* The intrinsic canvas / image size will make sure that we fit the page. */\n max-width: 100%;\n max-height: 100%;\n\n direction: ltr;\n display: block;\n }\n}",document.body.append(t),{get element(){return h},remove:()=>{h.remove(),t.remove()}}}class cw{static create(){let t=document.querySelector("#printServiceDialog");if(!t){const e=(i,s,n)=>{const a=document.createElement(i);return Object.entries(s).forEach(([o,l])=>a.setAttribute(o,l)),a.append(...n),a};t=e("dialog",{id:"printServiceDialog",class:"pdfSlick-dialog",style:"min-width: 200px;"},[e("div",{class:"row"},[e("span",{"data-l10n-id":"pdfjs-print-progress-message"},["Preparing document for printing…"])]),e("div",{class:"row"},[e("progress",{value:"0",max:"100"},[]),e("span",{"data-l10n-id":"pdfjs-print-progress-percent","data-l10n-args":'{ "progress": 0 }',class:"relative-progress"},["0%"])]),e("div",{class:"buttonRow"},[e("button",{id:"printCancel",class:"dialogButton",type:"button"},[e("span",{"data-l10n-id":"pdfjs-print-progress-close-button"},["Cancel"])])])]),document.body.append(t)}return new cw(t)}constructor(t){this.dialog=t}open(t){return ci(this,void 0,void 0,function*(){const e=this.dialog.querySelector("#printCancel"),i=()=>{var s;this.dialog.removeEventListener("close",i),this.dialog.removeEventListener("cancel",i),e==null||e.removeEventListener("click",i),(s=t==null?void 0:t.close)===null||s===void 0||s.call(t),this.close()};this.dialog.addEventListener("close",i),this.dialog.addEventListener("cancel",i),e==null||e.addEventListener("click",i),this.dialog.showModal()})}close(){this.dialog.close()}progress({index:t,total:e}){const i=Math.round(100*t/e),s=this.dialog.querySelector("progress"),n=this.dialog.querySelector(".relative-progress");s.value=i,n.setAttribute("data-l10n-args",JSON.stringify({progress:i}))}}var ai,Qo,zb,Gb,Ig,la,fg,gg,Pc,al,PA,xA,Bv,CA,Vv,Hv,jv,$v,Uv,Wv,zv;Vn.workerSrc=new URL( window.__dynamic_base__+"/assets/pdf.worker.min-DbR_HJhJ.js",import.meta.url).toString();const MC={"8.5x11":"Letter","8.5x14":"Legal"},Gv={"297x420":"A3","210x297":"A4"};function Rp(h,t,e){const i=t?h.width:h.height,s=t?h.height:h.width;return e["".concat(i,"x").concat(s)]}class kC{constructor({container:t,viewer:e,thumbs:i,store:s=AA(),options:n,onError:a,printDialog:o}){var l,c,d,u,g,b,w,v,A,y,S,_,E,P,x;ai.add(this),Qo.set(this,void 0),zb.set(this,void 0),Gb.set(this,void 0),Ig.set(this,void 0),la.set(this,void 0),this.downloadManager=null,this.findController=null,this.pdfPresentationMode=null,this.document=null,fg.set(this,void 0),gg.set(this,void 0),Pc.set(this,void 0),al.set(this,void 0),yt(this,zb,t),yt(this,Gb,e),yt(this,Ig,i),yt(this,Pc,a),this.l10n=(l=n==null?void 0:n.l10n)!==null&&l!==void 0?l:new No(navigator.language),this.downloadManager=new M_,this.textLayerMode=(c=n==null?void 0:n.textLayerMode)!==null&&c!==void 0?c:nC.ENABLE,yt(this,fg,(d=n==null?void 0:n.annotationMode)!==null&&d!==void 0?d:Ps.ENABLE_FORMS),yt(this,gg,(u=n==null?void 0:n.annotationEditorMode)!==null&&u!==void 0?u:Y.NONE),this.annotationEditorHighlightColors=(g=n==null?void 0:n.annotationEditorHighlightColors)!==null&&g!==void 0?g:"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F",this.removePageBorders=(b=n==null?void 0:n.removePageBorders)!==null&&b!==void 0?b:!1,this.singlePageViewer=(w=n==null?void 0:n.singlePageViewer)!==null&&w!==void 0?w:!1,this.enablePrintAutoRotate=(v=n==null?void 0:n.enablePrintAutoRotate)!==null&&v!==void 0?v:!1,this.useOnlyCssZoom=(A=n==null?void 0:n.useOnlyCssZoom)!==null&&A!==void 0?A:!1,this.pageColors=(y=n==null?void 0:n.pageColors)!==null&&y!==void 0?y:null,this.maxCanvasPixels=(S=n==null?void 0:n.maxCanvasPixels)!==null&&S!==void 0?S:16777216,this.printResolution=(_=n==null?void 0:n.printResolution)!==null&&_!==void 0?_:96,this.thumbnailWidth=(E=n==null?void 0:n.thumbnailWidth)!==null&&E!==void 0?E:125,this.getDocumentParams=(P=n==null?void 0:n.getDocumentParams)!==null&&P!==void 0?P:{},this.pageColors&&!(CSS.supports("color",this.pageColors.background)&&CSS.supports("color",this.pageColors.foreground))&&((this.pageColors.background||this.pageColors.foreground)&&console.warn("PDFViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used."),this.pageColors=null),this.store=s;const T=new wC;T.onIdle=this._cleanup.bind(this),T.isThumbnailViewEnabled=!0,yt(this,Qo,T);const I=new aw,C=new rw({eventBus:I,externalLinkTarget:2,externalLinkRel:"noopener noreferrer nofollow",ignoreDestinationZoom:!1}),L=new A_({eventBus:I,linkService:C}),M=Object.assign(Object.assign({container:t},e&&{viewer:e}),{eventBus:I,linkService:C,findController:L,renderingQueue:T,textLayerMode:this.textLayerMode,annotationEditorHighlightColors:this.annotationEditorHighlightColors,l10n:this.l10n,annotationMode:D(this,fg,"f"),annotationEditorMode:D(this,gg,"f"),removePageBorders:this.removePageBorders,imageResourcesPath:"/images/"}),G=this.singlePageViewer?new gA(M):new lw(M);T.setViewer(G),i&&(this.thumbnailViewer=new _C({container:i,eventBus:I,linkService:C,renderingQueue:T,pageColors:this.pageColors,enableHWA:void 0,store:s,thumbnailWidth:this.thumbnailWidth}),T.setThumbnailViewer(this.thumbnailViewer)),document.fullscreenEnabled&&(this.pdfPresentationMode=new TC({container:t,pdfViewer:G,eventBus:I})),this.eventBus=I,this.linkService=C,this.findController=L,this.viewer=G,this.linkService.setViewer(G),yt(this,la,new LC({eventBus:I,slick:this,printDialog:o!=null?o:cw.create()}));const W=(x=n==null?void 0:n.scaleValue)!==null&&x!==void 0?x:"auto";this.store.setState({scaleValue:W})}loadDocument(t,e){return ci(this,void 0,void 0,function*(){var i,s,n,a,o;if(this.url&&typeof this.url=="string")try{URL.revokeObjectURL(this.url)}catch(l){}try{(i=this.document)===null||i===void 0||i.destroy(),(s=this.viewer)===null||s===void 0||s.cleanup(),t instanceof URL?this.url=t.toString():t instanceof ArrayBuffer?this.url=URL.createObjectURL(new Blob([t],{type:"application/pdf"})):this.url=t;const l=(n=e==null?void 0:e.filename)!==null&&n!==void 0?n:oy((a=this.url)===null||a===void 0?void 0:a.toString());this.filename=l;const c=h0(Object.assign(Object.assign({},this.getDocumentParams),{url:this.url,isEvalSupported:!1}));e!=null&&e.onProgress&&(c.onProgress=e.onProgress);const d=yield c.promise;this.document=d,this.viewer.setDocument(this.document),this.linkService.setDocument(this.document),this.thumbnailViewer&&((o=this.thumbnailViewer)===null||o===void 0||o.setDocument(d)),D(this,ai,"m",CA).call(this),yield D(this,ai,"m",PA).call(this),this.store.setState({filename:l,numPages:d.numPages,pageNumber:1,isDocumentLoaded:!0,url:t.toString()});const u=yield d.getAttachments(),g=new Map(Object.keys(u!=null?u:{}).sort((b,w)=>b.toLowerCase().localeCompare(w.toLowerCase())).map(b=>[b,u[b]]));this.store.setState({attachments:g}),yield D(this,ai,"m",xA).call(this),this.forceRendering()}catch(l){D(this,Pc,"f")&&D(this,Pc,"f").call(this,l)}})}forceRendering(t=!0){D(this,Qo,"f").printing=!!D(this,la,"f").printing,D(this,Qo,"f").isThumbnailViewEnabled=t,D(this,Qo,"f").renderHighestPriority()}gotoPage(t){this.linkService.goToPage(t)}openOrDownloadData(t,e){var i;(i=this.downloadManager)===null||i===void 0||i.openOrDownloadData(t,e)}download(){return ci(this,void 0,void 0,function*(){var t,e;const i=this.url,{filename:s}=this;try{const n=yield this.document.getData(),a=new Blob([n],{type:"application/pdf"});yield(t=this.downloadManager)===null||t===void 0?void 0:t.download(a,i,s)}catch(n){yield(e=this.downloadManager)===null||e===void 0?void 0:e.download(null,i,s)}})}save(){return ci(this,void 0,void 0,function*(){var t;const e=this.url,{filename:i}=this;try{const s=yield this.document.saveDocument(),n=new Blob([s],{type:"application/pdf"});yield(t=this.downloadManager)===null||t===void 0?void 0:t.download(n,e,i)}catch(s){console.error("Error when saving the document: ".concat(s.message)),yield this.download()}finally{}})}downloadOrSave(){var t;const{annotationStorage:e}=(t=this.document)!==null&&t!==void 0?t:{};e&&e.size>0?this.save():this.download()}get supportsPrinting(){return D(this,la,"f").supportsPrinting}requestPresentationMode(){var t;(t=this.pdfPresentationMode)===null||t===void 0||t.request()}triggerPrinting(){D(this,la,"f").print()}unbindEvents(){var t;(t=D(this,al,"f"))===null||t===void 0||t.abort(),yt(this,al,null),D(this,la,"f").unbindEvents()}_cleanup(){var t;if(this.document)try{this.viewer.cleanup(),(t=this.thumbnailViewer)===null||t===void 0||t.cleanup(),this.document.cleanup()}catch(e){console.error("Unable to perform cleanup",e)}}setAnnotationEditorMode(t){this.viewer.annotationEditorMode={mode:t},this.dispatch("switchannotationeditormode",{source:this,mode:t}),this.store.setState({annotationEditorMode:t})}setAnnotationEditorParams(t){const e=Array.isArray(t)?t:[t];for(const i of e)this.dispatch("switchannotationeditorparams",{source:this,type:i.type,value:i.value})}setHighlightDefaultColor(t){this.setAnnotationEditorMode(Y.HIGHLIGHT),this.setAnnotationEditorParams([{type:nt.HIGHLIGHT_DEFAULT_COLOR,value:t}]),this.store.setState({highlightDefaultColor:t})}setSpreadMode(t){pC(t)&&(this.viewer.spreadMode=t,this.dispatch("switchspreadmode",{mode:t}))}setScrollMode(t){gC(t)&&(this.viewer.scrollMode=t,this.dispatch("switchscrollmode",{mode:t}))}setRotation(t){pA(t)&&(this.viewer.pagesRotation=t)}getPagesOverview(){var t,e;try{return(e=(t=this.viewer)===null||t===void 0?void 0:t.getPagesOverview())!==null&&e!==void 0?e:[]}catch(i){return[]}}increaseScale(){this.viewer.increaseScale()}decreaseScale(){this.viewer.decreaseScale()}set currentScaleValue(t){this.viewer.currentScaleValue=t}set currentScale(t){this.viewer.currentScale=t}getPageView(t){return this.viewer.getPageView(t)}on(t,e,i){this.eventBus.on(t,e,i)}off(t,e,i){this.eventBus.off(t,e,i)}dispatch(t,e){this.eventBus.dispatch(t,e)}}Qo=new WeakMap,zb=new WeakMap,Gb=new WeakMap,Ig=new WeakMap,la=new WeakMap,fg=new WeakMap,gg=new WeakMap,Pc=new WeakMap,al=new WeakMap,ai=new WeakSet,PA=function(){return ci(this,void 0,void 0,function*(){var t;const i=(t=yield this.document.getPageLabels())!==null&&t!==void 0?t:[],s=i.length;let n=0,a=0;for(let c=0;c<s;c++){const d=i[c];if(d===(c+1).toString())n++;else if(d==="")a++;else break}if(n>=s||a>=s)return;const{viewer:o,thumbnailViewer:l}=this;o.setPageLabels(i),l==null||l.setPageLabels(i)})},xA=function(){return ci(this,void 0,void 0,function*(){const{info:t,contentLength:e}=yield this.document.getMetadata(),i=yield this.document.getPage(this.store.getState().pageNumber).then(s=>D(this,ai,"m",Bv).call(this,hC(s),0));this.store.setState({filesize:e,title:t.Title,author:t.Author,subject:t.Subject,keywords:t.Keywords,creator:t.Creator,producer:t.Producer,version:t.PDFFormatVersion,creationDate:Dc.toDateObject(t.CreationDate),modificationDate:Dc.toDateObject(t.ModDate),isLinearized:t.IsLinearized,pageSize:i})})},Bv=function(t,e){return ci(this,void 0,void 0,function*(){if(!t)return;e%180!==0&&(t={width:t.height,height:t.width});const i=mC(t);let s={width:Math.round(t.width*100)/100,height:Math.round(t.height*100)/100},n={width:Math.round(t.width*25.4*10)/10,height:Math.round(t.height*25.4*10)/10},a=Rp(s,i,MC)||Rp(n,i,Gv);if(!a&&!(Number.isInteger(n.width)&&Number.isInteger(n.height))){const g={width:t.width*25.4,height:t.height*25.4},b={width:Math.round(n.width),height:Math.round(n.height)};Math.abs(g.width-b.width)<.1&&Math.abs(g.height-b.height)<.1&&(a=Rp(b,i,Gv),a&&(s={width:Math.round(b.width/25.4*100)/100,height:Math.round(b.height/25.4*100)/100},n=b))}const[{width:o,height:l},c,d,u]=yield Promise.all([s,this.l10n.get("document_properties_page_size_unit_inches",null),a&&this.l10n.get("document_properties_page_size_name_".concat(a.toLowerCase()),null),this.l10n.get("document_properties_page_size_orientation_".concat(i?"portrait":"landscape"),null)]);return{width:o.toLocaleString(),height:l.toLocaleString(),unit:c,name:d,orientation:u}})},CA=function(){yt(this,al,new AbortController);const{signal:t}=D(this,al,"f"),e={signal:t};this.eventBus._on("pagesinit",D(this,ai,"m",Vv).bind(this),e),this.eventBus._on("scalechanging",D(this,ai,"m",Uv).bind(this),e),this.eventBus._on("pagechanging",D(this,ai,"m",Wv).bind(this),e),this.eventBus._on("pagerendered",D(this,ai,"m",zv).bind(this),e),this.eventBus._on("rotationchanging",D(this,ai,"m",Hv).bind(this),e),this.eventBus._on("switchspreadmode",D(this,ai,"m",jv).bind(this),e),this.eventBus._on("switchscrollmode",D(this,ai,"m",$v).bind(this),e)},Vv=function(t){return ci(this,arguments,void 0,function*({source:e}){var i;const s=yield(i=this.document)===null||i===void 0?void 0:i.getOutline(),n=this.store.getState().scaleValue;e.currentScale=1,e.currentScaleValue="auto",this.store.setState({documentOutline:s,pageNumber:1,scaleValue:n,pagesReady:!0})})},Hv=function({pagesRotation:t,pageNumber:e}){this.store.setState({pagesRotation:t}),this.thumbnailViewer&&(this.thumbnailViewer.pagesRotation=t),this.forceRendering(),this.viewer.currentPageNumber=e},jv=function({mode:t}){this.store.setState({spreadMode:t})},$v=function({mode:t}){this.store.setState({scrollMode:t})},Uv=function({scale:t,presetValue:e}){this.store.setState({scale:t,scaleValue:e}),this.viewer.update()},Wv=function({pageNumber:t}){var e;(e=this.thumbnailViewer)===null||e===void 0||e.scrollThumbnailIntoView(t),this.store.setState({pageNumber:t})},zv=function({pageNumber:t,error:e}){var i;if(D(this,Ig,"f")){const s=this.viewer.getPageView(t-1),n=(i=this.thumbnailViewer)===null||i===void 0?void 0:i.getThumbnail(t-1);s&&n&&n.setImage(s)}};function DC(h){const t={...h},e={...h},i={},s=a=>{let o=i[a];if(!o){if(!VA())return t[a];i[a]=o=zi(t[a],{internal:!0}),delete t[a]}return o[0]()};for(const a in h)Object.defineProperty(e,a,{get:()=>s(a),enumerable:!0});const n=(a,o)=>{const l=i[a];if(l)return l[1](o);a in t&&(t[a]=ww(o,t[a]))};return[e,(a,o)=>{if(FA(a)){const l=OA(()=>Object.entries(ww(a,e)));BA(()=>{for(const[c,d]of l)n(c,()=>d)})}else n(a,o);return e}]}const TA={width:null,height:null};function Mp(h){if(!h)return{...TA};const{width:t,height:e}=h.getBoundingClientRect();return{width:t,height:e}}function IA(h){const t=typeof h=="function",[e,i]=DC(HA.context||t?TA:Mp(h)),s=new ResizeObserver(([n])=>i(Mp(n.target)));return xc(()=>s.disconnect()),t?tf(()=>{const n=h();n&&(i(Mp(n)),s.observe(n),xc(()=>s.unobserve(n)))}):(s.observe(h),xc(()=>s.unobserve(h))),e}var NC=qb('<div id=viewerContainer><div id=viewer class="pdfSlickViewer pdfViewer">');function FC(h){const[t,e]=zi(),i=IA(t);return tf(()=>{var s;i.width&&i.height&&(h.store.pdfSlick&&(h.store.scaleValue==="auto"||h.store.scaleValue==="page-fit"||h.store.scaleValue==="page-width")&&(h.store.pdfSlick.viewer.currentScaleValue=h.store.scaleValue),(s=h.store.pdfSlick)==null||s.viewer.update())}),(()=>{var s=NC();return Yv(n=>{h.viewerRef(n),e(n)},s),s.style.setProperty("position","absolute"),s.style.setProperty("inset","0"),s.style.setProperty("overflow","auto"),Zv(()=>{var n;return Qv(s,"pdfSlickContainer ".concat((n=h.class)!=null?n:""))}),s})()}var OC=qb("<div>");function BC(h){const[t,e]=zi(),i=IA(t);return tf(()=>{var s;i.width&&i.height&&((s=h.store.pdfSlick)==null||s.forceRendering())}),(()=>{var s=OC();return Yv(n=>{h.thumbsRef(n),e(n)},s),s.style.setProperty("position","absolute"),s.style.setProperty("overflow","auto"),s.style.setProperty("inset","0"),Kv(s,O(pg,{get each(){return Array.from(h.store.thumbnailViews)},children:([n,a])=>O($A,{get mount(){return a.div},get children(){var o;return h.children({pageNumber:n,width:a.canvasWidth,height:a.canvasHeight,scale:a.scale,src:(o=a==null?void 0:a.src)!=null?o:null,rotation:a.rotation,pageLabel:a.pageLabel,loaded:a.loaded})}})})),Zv(n=>{var l,c;var a=(l=h.class)!=null?l:"",o=(c=h.classList)!=null?c:{};return a!==n.e&&Qv(s,n.e=a),n.t=UA(s,o,n.t),n},{e:void 0,t:void 0}),s})()}function VC(h,t=h.getState,e){const i=t(h.getState()),[s,n]=jA(i),a=(l,c)=>{t(c);const d=t(l);n(WA(d))},o=h.subscribe(a);return xc(()=>o()),s}const HC=(h,t)=>{const[e,i]=zi(!1),[s,n]=zi(!1),[a,o]=zi(null),[l,c]=zi(null),[d,u]=zi(null),[g,b]=zi(null),w=AA(),v=VC(w),A=S=>{o(S),n(!0)},y=S=>{c(S)};return tf(()=>{if(h&&s()){const S=new kC({container:a(),thumbs:l(),store:w,options:t,onError:_=>u(_)});b(S),w.setState({pdfSlick:S}),S.loadDocument(h,t).then(()=>{i(!0)})}}),{isDocumentLoaded:e,viewerRef:A,thumbsRef:y,pdfSlick:g,pdfSlickStore:v,PDFSlickViewer:FC,PDFSlickThumbnails:BC,error:d}};function jC(h){return Rn({a:{fill:"currentColor",viewBox:"0 0 16 16"},c:'<path fill-rule="evenodd" d="m7.976 10.072 4.357-4.357.62.618L8.284 11h-.618L3 6.333l.619-.618 4.357 4.357z" clip-rule="evenodd"/>'},h)}function $C(h){return Rn({a:{fill:"currentColor",viewBox:"0 0 16 16"},c:'<path fill-rule="evenodd" d="m8.024 5.928-4.357 4.357-.62-.618L7.716 5h.618L13 9.667l-.619.618-4.357-4.357z" clip-rule="evenodd"/>'},h)}function UC(h){return Rn({a:{fill:"currentColor",viewBox:"0 0 16 16"},c:'<path fill-rule="evenodd" d="m8 8.707 3.646 3.647.708-.707L8.707 8l3.647-3.646-.707-.708L8 7.293 4.354 3.646l-.707.708L7.293 8l-3.646 3.646.707.708L8 8.707z" clip-rule="evenodd"/>'},h)}function WC(h){return Rn({a:{fill:"currentColor",viewBox:"0 0 16 16"},c:'<path d="M2 1 1 2v12l1 1h12l1-1V2l-1-1H2Zm0 13V2h4v12H2Zm5 0V2h7v12H7Z"/>'},h)}function zC(h){return Rn({a:{fill:"currentColor",viewBox:"0 0 16 16"},c:'<path fill-rule="evenodd" d="M2 1 1 2v12l1 1h12l1-1V2l-1-1H2Zm12 13H7V2h7v12Z" clip-rule="evenodd"/>'},h)}function GC(h){return Rn({a:{fill:"currentColor",viewBox:"0 0 16 16"},c:'<path d="M2 5.56 2.413 5h11.194l.393.54L8.373 11h-.827L2 5.56z"/>'},h)}function XC(h){return Rn({a:{fill:"currentColor",viewBox:"0 0 16 16"},c:'<path d="M5.56 14 5 13.587V2.393L5.54 2 11 7.627v.827L5.56 14z"/>'},h)}function qC(h){return Rn({a:{fill:"currentColor",viewBox:"0 0 16 16"},c:'<path fill-rule="evenodd" d="M12.027 6.149a5.52 5.52 0 0 1-1.27 3.908l4.26 4.26-.7.71-4.26-4.27a5.52 5.52 0 1 1 1.97-4.608zm-5.45 4.888a4.51 4.51 0 0 0 3.18-1.32l-.04.02a4.51 4.51 0 0 0 1.36-3.2 4.5 4.5 0 1 0-4.5 4.5zm2.44-4v-1h-2v-2h-1v2h-2v1h2v2h1v-2h2z" clip-rule="evenodd"/>'},h)}function YC(h){return Rn({a:{fill:"currentColor",viewBox:"0 0 16 16"},c:'<path fill-rule="evenodd" d="M12.027 6.149a5.52 5.52 0 0 1-1.27 3.908l4.26 4.26-.7.71-4.26-4.27a5.52 5.52 0 1 1 1.97-4.608zm-5.45 4.888a4.51 4.51 0 0 0 3.18-1.32l-.04.02a4.51 4.51 0 0 0 1.36-3.2 4.5 4.5 0 1 0-4.5 4.5zm-2.54-4.98h5v1h-5v-1z" clip-rule="evenodd"/>'},h)}var KC=qb("<form>");const BT=()=>{const{viewerRef:h,pdfSlickStore:t,PDFSlickViewer:e}=HC(zA.raw_url),[i,s]=zi(1),{isOpen:n,onToggle:a,onClose:o}=GA(),l=d=>{var g;d.preventDefault();const u=parseInt(i()+"");Number.isInteger(u)&&u>0&&u<=t.numPages?(g=t.pdfSlick)==null||g.linkService.goToPage(u):s(t.pageNumber)},c=({pageNumber:d})=>s(d);return tf(()=>{t.pdfSlick&&t.pdfSlick.on("pagechanging",c)}),xc(()=>{t.pdfSlick&&t.pdfSlick.off("pagechanging",c)}),O(Xr,{w:"$full",h:"70vh",pos:"relative",display:"flex",get children(){return[O(QC,{store:t,get isOpen(){return n()},onClose:o}),O(XA,{w:"$full",h:"$full",pos:"relative",flex:1,get children(){return[O(JC,{store:t,get isOpen(){return n()},onToggle:a,wantedPageNumber:i,onPageNumberChange:s,onPageNumberSubmit:l}),O(e,{store:t,viewerRef:h})]}})]}})},ZC=h=>{const[t,e]=zi(!0),i=()=>h.item.items&&h.item.items.length>0,s=()=>{var n;h.item.dest&&((n=h.store.pdfSlick)!=null&&n.linkService)&&h.store.pdfSlick.linkService.goToDestination(h.item.dest)};return O(Xr,{mb:"$1",get children(){return[O(mg,{spacing:"$1",alignItems:"center",get children(){return[O(kc,{get when(){return i()},get fallback(){return O(Xr,{w:"16px"})},get children(){return O(On,{size:"xs",variant:"ghost","aria-label":"Toggle",get icon(){return Jo(()=>!!t())()?O(GC,{}):O(XC,{})},minW:"16px",h:"16px",onClick:()=>e(!t())})}}),O(ty,{variant:"ghost",size:"sm",justifyContent:"flex-start",flex:1,fontSize:"$sm",fontWeight:"$normal",py:"$1",px:"$2",h:"auto",minH:"$6",textAlign:"left",overflow:"hidden",onClick:s,_hover:{backgroundColor:"$neutral3"},get title(){return h.item.title},color:"$neutral12",get children(){return h.item.title}})]}}),O(kc,{get when(){return Jo(()=>!!i())()&&t()},get children(){return O(Xr,{get pl(){return"".concat((h.level+1)*16,"px")},get children(){return O(LA,{get items(){return h.item.items},get level(){return h.level+1},get store(){return h.store}})}})}})]}})},LA=h=>!h.items||h.items.length===0?null:O(pg,{get each(){return h.items},children:t=>O(ZC,{item:t,get level(){return h.level||0},get store(){return h.store}})}),QC=h=>{const t=Jv();return O(kc,{get when(){return h.isOpen},get children(){return O(Xr,{w:"280px",h:"$full",bgColor:"$neutral1",borderRight:"1px solid $neutral6",display:"flex",flexDirection:"column",transition:"all 0.3s ease",zIndex:"10",get children(){return[O(mg,{spacing:"$2",p:"$3",borderBottom:"1px solid $neutral6",bgColor:"$neutral2",get children(){return[O(bg,{fontWeight:"$semibold",color:"$neutral12",get children(){return t("home.preview.pdf.document_outline")}}),O(Xr,{flex:1}),O(ta,{withArrow:!0,get label(){return t("home.preview.pdf.close_sidebar")},get children(){return O(On,{size:"sm",get"aria-label"(){return t("home.preview.pdf.close_sidebar")},get icon(){return O(UC,{})},get onClick(){return h.onClose}})}})]}}),O(Xr,{flex:1,overflow:"auto",p:"$3",get children(){return O(qA,{spacing:"$2",alignItems:"stretch",get children(){return O(kc,{get when(){return h.store.documentOutline&&h.store.documentOutline.length>0},get fallback(){return O(bg,{size:"sm",color:"$neutral11",textAlign:"center",mt:"$4",get children(){return t("home.preview.pdf.no_outline")}})},get children(){return O(LA,{get items(){return h.store.documentOutline},get store(){return h.store}})}})}})}})]}})}})},JC=h=>{const t=Jv();let e;const i=[["auto",t("home.preview.pdf.zoom_auto")],["page-actual",t("home.preview.pdf.zoom_actual")],["page-fit",t("home.preview.pdf.zoom_fit")],["page-width",t("home.preview.pdf.zoom_width")]],s=[[.5,t("home.preview.pdf.zoom_50")],[.75,t("home.preview.pdf.zoom_75")],[1,t("home.preview.pdf.zoom_100")],[1.25,t("home.preview.pdf.zoom_125")],[1.5,t("home.preview.pdf.zoom_150")],[2,t("home.preview.pdf.zoom_200")]],n=YA(()=>{if(h.store.scaleValue){const c=i.find(([d])=>d===h.store.scaleValue);if(c)return c[1]}return"".concat(Math.floor(h.store.scale*100),"%")}),a=c=>{h.store.pdfSlick&&(h.store.pdfSlick.currentScaleValue=c)},o=c=>{h.store.pdfSlick&&(h.store.pdfSlick.currentScale=c)},l=()=>h.store.annotationEditorMode===Y.INK;return O(Xr,{pos:"absolute",left:"50%",transform:"translateX(-50%)",display:"flex",zIndex:"1",css:{top:"$2",bottom:"auto","@sm":{top:"auto",bottom:"$2"}},get children(){return O(mg,{spacing:"$4",w:"auto",p:"$2",rounded:"$lg",shadow:"$lg",bgColor:"$neutral1",opacity:"0.7",transition:"all 0.2s ease-in-out",_hover:{opacity:"1"},css:{scale:"0.7","@sm":{scale:"1"}},get children(){return[O(kc,{get when(){return h.store.documentOutline&&h.store.documentOutline.length>0},get children(){return O(ta,{withArrow:!0,get label(){return t("home.preview.pdf.toggle_sidebar")},get children(){return O(On,{size:"sm",colorScheme:"neutral",get"aria-label"(){return t("home.preview.pdf.toggle_sidebar")},get icon(){return Jo(()=>!!h.isOpen)()?O(WC,{}):O(zC,{})},get onClick(){return h.onToggle}})}})}}),O(ta,{withArrow:!0,get label(){return t("home.preview.pdf.toggle_pen")},get children(){return O(On,{size:"sm",get"aria-label"(){return t("home.preview.pdf.toggle_pen")},get colorScheme(){return l()&&"primary"||"neutral"},onClick:()=>{var d,u;const c=l()?Y.NONE:Y.INK;(d=h.store.pdfSlick)==null||d.setAnnotationEditorMode(c),(u=h.store.pdfSlick)==null||u.setAnnotationEditorParams({type:nt.INK_COLOR,value:"#ff0000"})},get icon(){return Jo(()=>!!l())()&&O(KA,{})||O(ZA,{})}})}}),O(dp,{orientation:"vertical",h:"24px"}),O(QA,{colorScheme:"neutral",attached:!0,get children(){return[O(ta,{withArrow:!0,get label(){return t("home.preview.pdf.zoom_out")},get children(){return O(On,{size:"sm",get"aria-label"(){return t("home.preview.pdf.zoom_out")},get disabled(){return!h.store.pdfSlick||h.store.scale<=.25},onClick:()=>{var c,d;return(d=(c=h.store.pdfSlick)==null?void 0:c.viewer)==null?void 0:d.decreaseScale()},get icon(){return O(YC,{})}})}}),O(JA,{motionPreset:"scale-bottom-left",get children(){return[O(tE,{as:ty,size:"sm",minW:"60px",get children(){return O(bg,{size:"sm",get children(){return Jo(()=>!!h.store.pdfSlick)()?n():t("home.preview.pdf.loading")}})}}),O(eE,{get children(){return[O(vw,{get children(){return[O(yw,{get children(){return t("home.preview.pdf.zoom_presets")}}),O(pg,{each:i,children:c=>O(_w,{onSelect:()=>a(c[0]),get children(){return c[1]}})})]}}),O(dp,{role:"presentation",my:"$1"}),O(vw,{get children(){return[O(yw,{get children(){return t("home.preview.pdf.zoom_levels")}}),O(pg,{each:s,children:c=>O(_w,{onSelect:()=>o(c[0]),get children(){return c[1]}})})]}})]}})]}}),O(ta,{withArrow:!0,get label(){return t("home.preview.pdf.zoom_in")},get children(){return O(On,{size:"sm",get"aria-label"(){return t("home.preview.pdf.zoom_in")},get disabled(){return!h.store.pdfSlick||h.store.scale>=5},onClick:()=>{var c,d;return(d=(c=h.store.pdfSlick)==null?void 0:c.viewer)==null?void 0:d.increaseScale()},get icon(){return O(qC,{})}})}})]}}),O(dp,{orientation:"vertical",h:"24px"}),O(mg,{spacing:"$2",alignItems:"center",get children(){return[(()=>{var c=KC();return iE(c,"submit",h.onPageNumberSubmit),Kv(c,O(sE,{size:"sm",ref(d){var u=e;typeof u=="function"?u(d):e=d},type:"text",get value(){return h.wantedPageNumber()},w:"50px",textAlign:"center",onFocus:()=>e.select(),onChange:d=>h.onPageNumberChange(d.currentTarget.value)})),c})(),O(bg,{size:"sm",minW:"$full",get children(){return["/ ",Jo(()=>h.store.numPages)]}})]}}),O(ta,{withArrow:!0,get label(){return t("home.preview.pdf.prev_page")},get children(){return O(On,{size:"sm",get"aria-label"(){return t("home.preview.pdf.prev_page")},colorScheme:"neutral",get disabled(){return h.store.pageNumber<=1},onClick:()=>{var c,d;return(d=(c=h.store.pdfSlick)==null?void 0:c.viewer)==null?void 0:d.previousPage()},get icon(){return O($C,{})}})}}),O(ta,{withArrow:!0,get label(){return t("home.preview.pdf.next_page")},get children(){return O(On,{size:"sm",get"aria-label"(){return t("home.preview.pdf.next_page")},colorScheme:"neutral",get disabled(){return!h.store.pdfSlick||h.store.pageNumber>=h.store.numPages},onClick:()=>{var c,d;return(d=(c=h.store.pdfSlick)==null?void 0:c.viewer)==null?void 0:d.nextPage()},get icon(){return O(jC,{})}})}})]}})}})};export{BT as default};