collabmd 0.1.51 → 0.1.52

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 (584) hide show
  1. package/README.md +1 -1
  2. package/dist/client/assets/CodeMirrorEditor-UCMRAMCV-BEz2BKN1.js +1 -0
  3. package/dist/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  4. package/dist/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  5. package/dist/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  6. package/dist/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  7. package/dist/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  8. package/dist/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  9. package/dist/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  10. package/dist/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  11. package/dist/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  12. package/dist/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  13. package/dist/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  14. package/dist/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  15. package/dist/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  16. package/dist/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  17. package/dist/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  18. package/dist/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  19. package/dist/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  20. package/dist/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  21. package/dist/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  22. package/dist/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  23. package/dist/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  24. package/dist/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  25. package/dist/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  26. package/dist/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  27. package/dist/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  28. package/dist/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  29. package/dist/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  30. package/dist/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  31. package/dist/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  32. package/dist/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  33. package/dist/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  34. package/dist/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  35. package/dist/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  36. package/dist/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  37. package/dist/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  38. package/dist/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  39. package/dist/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  40. package/dist/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  41. package/dist/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  42. package/dist/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  43. package/dist/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  44. package/dist/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  45. package/dist/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  46. package/dist/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  47. package/dist/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  48. package/dist/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  49. package/dist/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  50. package/dist/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  51. package/dist/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  52. package/dist/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  53. package/dist/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  54. package/dist/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  55. package/dist/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  56. package/dist/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  57. package/dist/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  58. package/dist/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  59. package/dist/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  60. package/dist/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  61. package/dist/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  62. package/dist/client/assets/Middleware-DUgFSleI.js +1 -0
  63. package/dist/client/assets/_basePickBy-QJXUw_pr.js +1 -0
  64. package/dist/client/assets/_baseUniq-DR4vVjyC.js +1 -0
  65. package/dist/client/assets/abnfDiagram-O67JEVCF-Dwt6a0Ds.js +1 -0
  66. package/dist/client/assets/abnfDiagram-VCTEODGH-DxNxad6-.js +1 -0
  67. package/dist/client/assets/architecture-7GRP2DOG-BBwRXFv3.js +1 -0
  68. package/dist/client/assets/architecture-7GRP2DOG-DJVtYNt-.js +1 -0
  69. package/dist/client/assets/architectureDiagram-5GKGNRK7-C1uvg5id.js +36 -0
  70. package/dist/client/assets/architectureDiagram-NJMV4G6O-D5CGiX3G.js +36 -0
  71. package/dist/client/assets/{babel-CY5KOv-I.js → babel-Bi_28hhi.js} +1 -1
  72. package/dist/client/assets/band-D-Cum8PO.js +1 -0
  73. package/dist/client/assets/blockDiagram-BEXU5L5S-BgTM0var.js +140 -0
  74. package/dist/client/assets/blockDiagram-I7D4REHJ-B2YonsoG.js +129 -0
  75. package/dist/client/assets/{browser-BKLM0ThC-IxjwuOIz-DyJcVMFR.js → browser-BKLM0ThC-IxjwuOIz-C0mP17s1.js} +1 -1
  76. package/dist/client/assets/{browser-utils-DbXSMI-6.js → browser-utils-vlHL9goC.js} +1 -1
  77. package/dist/client/assets/{c4Diagram-7LVT6UL2-VAk1HPmz.js → c4Diagram-7LVT6UL2-r4IwomZm.js} +2 -2
  78. package/dist/client/assets/c4Diagram-YGBWAQC7-_xZPrNkB.js +38 -0
  79. package/dist/client/assets/channel-CgcHBnmr.js +1 -0
  80. package/dist/client/assets/chunk-2E4U76K2-CIQUuV9n.js +1 -0
  81. package/dist/client/assets/chunk-2Q5K7J3B-BMFG3ur0.js +1 -0
  82. package/dist/client/assets/{chunk-2ZTRR5NV-C2qZJila.js → chunk-2ZTRR5NV-CnDP55cn.js} +1 -1
  83. package/dist/client/assets/chunk-2ZTRR5NV-DcPRfelM.js +2 -0
  84. package/dist/client/assets/chunk-3FUC2YCW-8tZlhTGX.js +1 -0
  85. package/dist/client/assets/{chunk-3Z5EZCMW-DMniOlPd.js → chunk-3Z5EZCMW-BAnA6eQ7.js} +1 -1
  86. package/dist/client/assets/chunk-3Z5EZCMW-Yx4Q5AcN.js +1 -0
  87. package/dist/client/assets/chunk-4HAMMTFA-q0ldNVvr.js +62 -0
  88. package/dist/client/assets/chunk-4SOEAONT-C3fufoVl.js +40 -0
  89. package/dist/client/assets/chunk-5DYCD2WN-BKWCKnK-.js +1 -0
  90. package/dist/client/assets/{chunk-5V3GS4D5-i-ZDOEnP.js → chunk-5V3GS4D5-B5uC2oxu.js} +1 -1
  91. package/dist/client/assets/chunk-5V3GS4D5-BR7kgIgJ.js +1 -0
  92. package/dist/client/assets/chunk-5VM5RSS4-hE9rU_bl.js +15 -0
  93. package/dist/client/assets/chunk-6AEJRKK7-DTVZj5bY.js +1 -0
  94. package/dist/client/assets/{chunk-6AZGARVD-BB6FqMl-.js → chunk-6AZGARVD--pTGpDnx.js} +1 -1
  95. package/dist/client/assets/chunk-6AZGARVD-CnZDr4Cj.js +1 -0
  96. package/dist/client/assets/{chunk-6EIED4P4-DdUJkP0f.js → chunk-6EIED4P4-Bp8dpTvX.js} +1 -1
  97. package/dist/client/assets/chunk-6EIED4P4-DBVWq7Tz.js +1 -0
  98. package/dist/client/assets/{chunk-6K3QC6MW-CqVsVn-y.js → chunk-6K3QC6MW-DGVRzL6v.js} +1 -1
  99. package/dist/client/assets/chunk-6K3QC6MW-JnuvEGV4.js +1 -0
  100. package/dist/client/assets/{chunk-6TQVIW2G-DKlLbNIP.js → chunk-6TQVIW2G-BSj0l_pu.js} +1 -1
  101. package/dist/client/assets/chunk-6TQVIW2G-DgBX-Pv0.js +1 -0
  102. package/dist/client/assets/chunk-742MDFTN-D1nh6vNv.js +1 -0
  103. package/dist/client/assets/{chunk-747NJXEK-BFkZPlab.js → chunk-747NJXEK-BjqqAsS9.js} +1 -1
  104. package/dist/client/assets/chunk-747NJXEK-Cur1aosP.js +2 -0
  105. package/dist/client/assets/chunk-75Z2AOVW-DitkSoSG.js +2 -0
  106. package/dist/client/assets/chunk-7INBJB4K-CDmiHbaX.js +62 -0
  107. package/dist/client/assets/chunk-7M6MHVWA-BDakkknV.js +213 -0
  108. package/dist/client/assets/chunk-7PRAP22T-9uTvtc_-.js +1 -0
  109. package/dist/client/assets/{chunk-CLGD4ZFX-Cmtx89ht.js → chunk-CLGD4ZFX-BfYJtJm1.js} +1 -1
  110. package/dist/client/assets/chunk-DU6HZSFF-CWlP1Dk_.js +125 -0
  111. package/dist/client/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
  112. package/dist/client/assets/chunk-DYU5D34O-DN0WQZBm.js +1 -0
  113. package/dist/client/assets/{chunk-F27PBJKO-Dg3H6KLL.js → chunk-F27PBJKO-DPcsPcEs.js} +1 -1
  114. package/dist/client/assets/{chunk-FOHPRMQF-DHwB1DNv.js → chunk-FOHPRMQF-Dmmo5Kak.js} +9 -9
  115. package/dist/client/assets/chunk-FOHPRMQF-DzxwRta7.js +161 -0
  116. package/dist/client/assets/chunk-GMAD6QVW-Bgk8qnty.js +8 -0
  117. package/dist/client/assets/chunk-GNY47TPC-CTrH5O5R.js +1 -0
  118. package/dist/client/assets/{chunk-SVP7TREG-XlsB_ZMZ.js → chunk-GTNCS2PH-ChgkzEIi.js} +1 -1
  119. package/dist/client/assets/chunk-GVQU2GXP-CQ8cl-Uu.js +1 -0
  120. package/dist/client/assets/chunk-GWA4HPMP-CGmv2yIq.js +1 -0
  121. package/dist/client/assets/{chunk-I5DQTOEV-Hm2LfiYI.js → chunk-I5DQTOEV-B98XA8VK.js} +1 -1
  122. package/dist/client/assets/chunk-I5DQTOEV-aBZooNp1.js +1 -0
  123. package/dist/client/assets/{chunk-ICYGCRZG-749o-pGJ.js → chunk-ICYGCRZG-D97UeqJs.js} +1 -1
  124. package/dist/client/assets/chunk-ICYGCRZG-odvlDZyA.js +1 -0
  125. package/dist/client/assets/{chunk-IH6LHLGP-CC6I9F3i.js → chunk-IH6LHLGP-BNevEHZK.js} +1 -1
  126. package/dist/client/assets/chunk-IH6LHLGP-CvXe34hB.js +1 -0
  127. package/dist/client/assets/{chunk-IMKFNOWR-3F6NhHUP.js → chunk-IMKFNOWR-CBqxfpcP.js} +2 -2
  128. package/dist/client/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
  129. package/dist/client/assets/chunk-JWPE2WC7-GDilnS5Y.js +1 -0
  130. package/dist/client/assets/{chunk-KI3K4JFJ-Rma-0k_M.js → chunk-KI3K4JFJ-D5XCPRZv.js} +1 -1
  131. package/dist/client/assets/chunk-KI3K4JFJ-FTtDwx3-.js +1 -0
  132. package/dist/client/assets/chunk-L3NEJ4N5-BflzkdTI.js +1 -0
  133. package/dist/client/assets/{chunk-LNGE3PJU-DWpGwHrW.js → chunk-LNGE3PJU-5-SxdO55.js} +1 -1
  134. package/dist/client/assets/chunk-LNGE3PJU-5nWSl6jJ.js +34 -0
  135. package/dist/client/assets/chunk-MBY4JIJT-DTJ4UcAm.js +8 -0
  136. package/dist/client/assets/chunk-NETBCI7D-CmUwDWUZ.js +1 -0
  137. package/dist/client/assets/chunk-O7XYJQB3-D0_ZY2za.js +126 -0
  138. package/dist/client/assets/chunk-OSK3NFVY-DqeKV_pg.js +10 -0
  139. package/dist/client/assets/{chunk-OUJLGHUK-D0j2JRSg.js → chunk-OUJLGHUK-75UXlPjl.js} +1 -1
  140. package/dist/client/assets/chunk-OUJLGHUK-DA95-S9B.js +2 -0
  141. package/dist/client/assets/{chunk-P2QGCYS3-Du8EtwOa.js → chunk-P2QGCYS3-BA--DhpW.js} +1 -1
  142. package/dist/client/assets/chunk-POPQ4Y6H-V_NEc45n.js +1 -0
  143. package/dist/client/assets/chunk-PWAF6VOD-D_kLse-N.js +1 -0
  144. package/dist/client/assets/{chunk-ZPMXAHWN-Dt0TxJa6.js → chunk-RUX4WMZV-BGnd3s_C.js} +4 -4
  145. package/dist/client/assets/{chunk-SHT3W25Y-BKaI8jZO.js → chunk-SHT3W25Y-YM3S-A_M.js} +5 -5
  146. package/dist/client/assets/chunk-SVP7TREG-DdNhDOmW.js +88 -0
  147. package/dist/client/assets/{chunk-TICWLB2K-Cpp2z8yK.js → chunk-TICWLB2K-BGGgCr4x.js} +3 -3
  148. package/dist/client/assets/chunk-TLUHSLCS-DCZhIDYA.js +1 -0
  149. package/dist/client/assets/chunk-UA2S7LBM-DicYDjDM.js +1 -0
  150. package/dist/client/assets/{chunk-UY3FDG6J-CnmaAkG5.js → chunk-UY3FDG6J-DqSM_0FB.js} +1 -1
  151. package/dist/client/assets/chunk-UY3FDG6J-QT-rkt0y.js +1 -0
  152. package/dist/client/assets/chunk-WEXAMYUT-DDlVNp8J.js +1 -0
  153. package/dist/client/assets/chunk-X3CZISLH-BixgQztF.js +1 -0
  154. package/dist/client/assets/chunk-X3CZISLH-DwWpRaN8.js +1 -0
  155. package/dist/client/assets/{chunk-XHIXRSVI-BFQ6B8BE.js → chunk-XHIXRSVI-BSN7JlfK.js} +1 -1
  156. package/dist/client/assets/chunk-XHIXRSVI-DN_fEwws.js +1 -0
  157. package/dist/client/assets/chunk-XXDRQBXY-C7hQHDmQ.js +1 -0
  158. package/dist/client/assets/{chunk-XXDRQBXY-BvKO0v-W.js → chunk-XXDRQBXY-CdRN9Akd.js} +1 -1
  159. package/dist/client/assets/chunk-Y2CYZVJY-BbRBGnmc.js +1 -0
  160. package/dist/client/assets/chunk-Z7XXMR3K-P4Vaq8hD.js +10 -0
  161. package/dist/client/assets/chunk-ZIGJFQKS-b8OUHKK5.js +2 -0
  162. package/dist/client/assets/classDiagram-ZZMXUADV-QLbh_Nkf.js +1 -0
  163. package/dist/client/assets/classDiagram-v2-NBCMYWYE-3TQORq33.js +217 -0
  164. package/dist/client/assets/classDiagram-v2-VYDZK3BY-QLbh_Nkf.js +1 -0
  165. package/dist/client/assets/clone-C1hp9FUh.js +1 -0
  166. package/dist/client/assets/comment-markdown-renderer-Bxi_JRSR.js +1 -0
  167. package/dist/client/assets/comment-thread-store-CHvy8GF8.js +1 -0
  168. package/dist/client/assets/cose-bilkent-JH36ORCC-Czr0rwGr.js +1 -0
  169. package/dist/client/assets/cose-bilkent-JH36ORCC-DLmEf9HS.js +1 -0
  170. package/dist/client/assets/cynefin-OW5HDTMX-CF3N9j1_.js +1 -0
  171. package/dist/client/assets/cynefin-OW5HDTMX-e-Quc9Yl.js +1 -0
  172. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-DTnLZaO7.js +62 -0
  173. package/dist/client/assets/cynefinDiagram-VND7K2PF-DwfMZ3vk.js +62 -0
  174. package/dist/client/assets/cytoscape-cose-bilkent-NdTYBUiT.js +1 -0
  175. package/dist/client/assets/cytoscape-fcose-DE9_QRG_.js +1 -0
  176. package/dist/client/assets/cytoscape.esm-EK2DW5Qr.js +321 -0
  177. package/dist/client/assets/dagre-6A5THRUB-DewyAGK6.js +4 -0
  178. package/dist/client/assets/dagre-D7FiCLLP.js +1 -0
  179. package/dist/client/assets/{dagre-GXQ25YYZ-BSfKCfy7.js → dagre-GXQ25YYZ-Vtyx08Qh.js} +2 -2
  180. package/dist/client/assets/deferred-collab-D4cxEdad.css +1 -0
  181. package/dist/client/assets/deferred-preview-BAXYgf4T.css +1 -0
  182. package/dist/client/assets/diagram-22UHCM2B-DbZirFfl.js +200 -0
  183. package/dist/client/assets/diagram-3UASUU5V-DmhdYv6_.js +24 -0
  184. package/dist/client/assets/diagram-ATOU4E4O-B5uX-jVO.js +3 -0
  185. package/dist/client/assets/diagram-CDSNMT55-D_qyS11R.js +30 -0
  186. package/dist/client/assets/diagram-MLGK6HIB-DIBG6Ivu.js +24 -0
  187. package/dist/client/assets/diagram-MPIPVDR6-D9XsALDV.js +41 -0
  188. package/dist/client/assets/{diagram-S7CK7UJ4-D7KaM9yj.js → diagram-S7CK7UJ4-CGTzfo2f.js} +3 -3
  189. package/dist/client/assets/diagram-UQ7AKVKN-CWZS8QtB.js +41 -0
  190. package/dist/client/assets/{diagram-VSXAHHWV-B3-U-Q2E.js → diagram-VSXAHHWV-DaO1nOZF.js} +3 -3
  191. package/dist/client/assets/diagram-VX7I27RA-B54P6Cyf.js +24 -0
  192. package/dist/client/assets/diagram-Z3DM3KII-Cl2EXiXp.js +24 -0
  193. package/dist/client/assets/direct-engine-DdrQKpgq-4QysbH_V.js +5 -0
  194. package/dist/client/assets/dist-B7fBbwrO.js +1 -0
  195. package/dist/client/assets/{dist-DVXzbeDx.js → dist-BVCNc-Es.js} +1 -1
  196. package/dist/client/assets/dist-BYBF4LtZ.js +1 -0
  197. package/dist/client/assets/{dist-B_B4XLmq.js → dist-B_1hMrc6.js} +1 -1
  198. package/dist/client/assets/{dist-EWJYvBK1.js → dist-BfpAc922.js} +1 -1
  199. package/dist/client/assets/dist-BnVaoRgZ.js +1 -0
  200. package/dist/client/assets/{dist-kiD2GIsD.js → dist-Bog8M5U3.js} +6 -6
  201. package/dist/client/assets/dist-CAG5sIOj.js +1 -0
  202. package/dist/client/assets/{dist-CrWzIWEE.js → dist-CKf7LlAo.js} +1 -1
  203. package/dist/client/assets/{dist-CqXVyYoH.js → dist-CUsXdnU4.js} +1 -1
  204. package/dist/client/assets/{dist-B7XMN9AT.js → dist-CXOUa90Q.js} +1 -1
  205. package/dist/client/assets/dist-CYMCikZo.js +1 -0
  206. package/dist/client/assets/dist-CYfPeupF.js +1 -0
  207. package/dist/client/assets/dist-Ch6Sr9KF.js +28 -0
  208. package/dist/client/assets/dist-Ck-B8onw.js +2 -0
  209. package/dist/client/assets/dist-CrkYYcOU.js +1 -0
  210. package/dist/client/assets/{dist-BR81yxMt.js → dist-CsQTfQFi.js} +1 -1
  211. package/dist/client/assets/dist-Cu5Ze2cs.js +6 -0
  212. package/dist/client/assets/{dist-Drv_wZYC.js → dist-CvVoyTRF.js} +1 -1
  213. package/dist/client/assets/{dist-CbDyXgCo.js → dist-D4kDR0g8.js} +1 -1
  214. package/dist/client/assets/dist-D8LnhZzy.js +1 -0
  215. package/dist/client/assets/{dist-CELhfKzh.js → dist-DGa-2MNX.js} +2 -2
  216. package/dist/client/assets/{dist-CO0-4CuV.js → dist-DI6c02Da.js} +8 -8
  217. package/dist/client/assets/{dist-DJAMplZI.js → dist-DNONgI1P.js} +2 -2
  218. package/dist/client/assets/dist-DVBYH83t.js +1 -0
  219. package/dist/client/assets/dist-DX6qtdxv.js +1 -0
  220. package/dist/client/assets/{dist-Bx3QkS-3.js → dist-Da-jLrCf.js} +1 -1
  221. package/dist/client/assets/dist-DofvCYzJ.js +1 -0
  222. package/dist/client/assets/{dist-BzFSJM0U.js → dist-Dx37MHWs.js} +1 -1
  223. package/dist/client/assets/{dist-Bdy9ZRzd.js → dist-GTGhtpyW.js} +1 -1
  224. package/dist/client/assets/{dist-nxQErAaK.js → dist-W0FoeIxk.js} +9 -9
  225. package/dist/client/assets/{dist-By7ieqAf.js → dist-Y6zYRI-A.js} +1 -1
  226. package/dist/client/assets/{dist-Bfxzlnrf.js → dist-jVKfryIL.js} +1 -1
  227. package/dist/client/assets/{dist-DCpIH3-_.js → dist-zHDLm1oE.js} +1 -1
  228. package/dist/client/assets/{document-formatter-Qdiq9uJs.js → document-formatter-gO8qM2qY.js} +1 -1
  229. package/dist/client/assets/{drawioEditor-CHf1vtdQ.js → drawioEditor-DCkWweiy.js} +2 -2
  230. package/dist/client/assets/duration-BiuFXtXd.js +1 -0
  231. package/dist/client/assets/ebnfDiagram-PWID7BFC-PfC84FyI.js +1 -0
  232. package/dist/client/assets/ebnfDiagram-ZINNZB2B-DYvm_QtE.js +1 -0
  233. package/dist/client/assets/editor-session-DxRyr4EM.js +14 -0
  234. package/dist/client/assets/elk-276RUBZZ-B8LB3Pac.js +27 -0
  235. package/dist/client/assets/embedded-editor-base-elU0Avik.css +1 -0
  236. package/dist/client/assets/{embedpdf-DA4bA119-E8wZ11J2.js → embedpdf-DA4bA119-DsoNiPlQ.js} +4 -4
  237. package/dist/client/assets/{embedpdf-LUXDBD3-.js → embedpdf-DyOonRvx.js} +1 -1
  238. package/dist/client/assets/{en-2RFA324Y-BsuNJTcL.js → en-GNC3RJIS-CEy_oGTd.js} +1 -1
  239. package/dist/client/assets/erDiagram-OPXOYQCR-o8GRv8A_.js +99 -0
  240. package/dist/client/assets/{erDiagram-RLTQ6QDP-CWrH1UJ9.js → erDiagram-RLTQ6QDP-C9cJl5NB.js} +2 -2
  241. package/dist/client/assets/esm-BzZ1JFVo.js +65 -0
  242. package/dist/client/assets/{estree-CuT_pB8K.js → estree-DCT3Jm65.js} +4 -4
  243. package/dist/client/assets/eventmodeling-NTZA5JFV-CDy1bN6j.js +1 -0
  244. package/dist/client/assets/eventmodeling-NTZA5JFV-Dxtv5D-P.js +1 -0
  245. package/dist/client/assets/{excalidraw-element-link-iA6zo0_f.js → excalidraw-element-link-CGZ5934B.js} +1 -1
  246. package/dist/client/assets/{excalidrawEditor-DDE0n1Pk.css → excalidrawEditor-BCTFp_CV.css} +1 -1
  247. package/dist/client/assets/excalidrawEditor-BVfSxjSO.js +9 -0
  248. package/dist/client/assets/export-page-BCo_e15t.js +46 -0
  249. package/dist/client/assets/exportDocument-Ba-n1X4U.css +1 -0
  250. package/dist/client/assets/exportDocument-DP6oE_or.js +2 -0
  251. package/dist/client/assets/{fa-IR-FIYUE2GQ-C865Nx3X.js → fa-IR-I4JNTJHK-CFtHZqoT.js} +1 -1
  252. package/dist/client/assets/file-search-3hYF4cYa.js +1 -0
  253. package/dist/client/assets/flowDiagram-HODETNUW-Bq4470NR.js +1 -0
  254. package/dist/client/assets/flowDiagram-KWPJA3E3-DQG9qGiU.js +1 -0
  255. package/dist/client/assets/forth-D6RzAl64.js +1 -0
  256. package/dist/client/assets/ganttDiagram-EL5Y4UJY-x40PW0Ah.js +292 -0
  257. package/dist/client/assets/ganttDiagram-FUAMR5RP-BQpsI7gQ.js +292 -0
  258. package/dist/client/assets/gitGraph-4MIJSDKK-B-rpDYbz.js +1 -0
  259. package/dist/client/assets/gitGraph-4MIJSDKK-ZaBIE4Lb.js +1 -0
  260. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-ahsNaZsp.js +106 -0
  261. package/dist/client/assets/gitGraphDiagram-X574FWY7-wbs_2m9f.js +106 -0
  262. package/dist/client/assets/graphlib-C9Tl7QrK.js +1 -0
  263. package/dist/client/assets/{html-Cdnr2qzU.js → html-CBXMuS97.js} +2 -2
  264. package/dist/client/assets/html-DTuc_pxj.js +1 -0
  265. package/dist/client/assets/{id-ID-EOMR5R3I-CGQwUjoL.js → id-ID-2WY7E4VX-CCAeQpPr.js} +2 -2
  266. package/dist/client/assets/image-EJJKRVD3-BQfi5nWJ.js +1 -0
  267. package/dist/client/assets/{image-blob-reduce.esm-Dj7YBvMv.js → image-blob-reduce.esm-BFq-Mx5V.js} +2 -2
  268. package/dist/client/assets/index-BxAuGDoN.css +1 -0
  269. package/dist/client/assets/index-uw9O0z1c.js +1112 -0
  270. package/dist/client/assets/info-A6RAGUB7-BcGxhjED.js +1 -0
  271. package/dist/client/assets/info-A6RAGUB7-BlutK7BT.js +1 -0
  272. package/dist/client/assets/infoDiagram-27XIBGKW-MrZyptIy.js +2 -0
  273. package/dist/client/assets/infoDiagram-VRGFBTTK-KkUjDRAQ.js +2 -0
  274. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-CRy9vIS5.js → ishikawaDiagram-5VMMS53U-Bnt9yM0O.js} +2 -2
  275. package/dist/client/assets/ishikawaDiagram-OU5B5YK6-Di9BcpOY.js +70 -0
  276. package/dist/client/assets/{it-IT-FC2VTM3L-KTijNcUe.js → it-IT-INVHSAJF-DytAgndh.js} +1 -1
  277. package/dist/client/assets/javascript-B9I2pbsP.js +1 -0
  278. package/dist/client/assets/javascript-DctB8BJo.js +1 -0
  279. package/dist/client/assets/{journeyDiagram-3NMN7TZE-D4ZR_s9J.js → journeyDiagram-3NMN7TZE-Bl0abK1r.js} +1 -1
  280. package/dist/client/assets/journeyDiagram-ZHPQQLJL-J-sGrs9e.js +139 -0
  281. package/dist/client/assets/jsx-runtime-DKj5X9O4.js +1 -0
  282. package/dist/client/assets/kanban-definition-PNTS6WVX-5ZDV_yIa.js +89 -0
  283. package/dist/client/assets/{kanban-definition-UXKFOSKX-CIDTmu5g.js → kanban-definition-UXKFOSKX-DMgUfNt0.js} +10 -10
  284. package/dist/client/assets/{katex-CXMH3UgJ.js → katex-9NBMfU68.js} +2 -2
  285. package/dist/client/assets/katex-ZlcWpGUi.js +257 -0
  286. package/dist/client/assets/line-DEbP8Ok6.js +1 -0
  287. package/dist/client/assets/linear-DExL6ILt.js +1 -0
  288. package/dist/client/assets/{lobby-presence-Rdjnc0_0.js → lobby-presence-Cz5jGOPg.js} +1 -1
  289. package/dist/client/assets/{lua-CL1SqxuB.js → lua-zbJo2mq3.js} +1 -1
  290. package/dist/client/assets/{markdown-CByV-4CU.js → markdown-Bo71X2X2.js} +8 -8
  291. package/dist/client/assets/markdown-it-DpvIRaVq.js +13 -0
  292. package/dist/client/assets/markdown-math-CyyBVuDO.js +517 -0
  293. package/dist/client/assets/merge-CALoRt3l.js +1 -0
  294. package/dist/client/assets/{mermaid-parser.core-DrdLA3p0.js → mermaid-parser.core-Bpogunsh.js} +1 -1
  295. package/dist/client/assets/mermaid-parser.core-DBy--Jc0.js +3 -0
  296. package/dist/client/assets/mermaid.core-BeOUPE3Q.js +10 -0
  297. package/dist/client/assets/mindmap-definition-NLK3R4M7-ByVb-0vj.js +96 -0
  298. package/dist/client/assets/{mindmap-definition-YA3MSWOX-DO8NB9VH.js → mindmap-definition-YA3MSWOX-DBZN5_GH.js} +29 -29
  299. package/dist/client/assets/{nginx-BMaDbqW3.js → nginx-8H7HVH4w.js} +1 -1
  300. package/dist/client/assets/packet-AYTQ26CC-CqpSjTWl.js +1 -0
  301. package/dist/client/assets/packet-AYTQ26CC-DvbY8dI6.js +1 -0
  302. package/dist/client/assets/pegDiagram-GJSIUBJH-aost1sSO.js +1 -0
  303. package/dist/client/assets/pegDiagram-XKGWAZYB-DRo8CZu3.js +1 -0
  304. package/dist/client/assets/percentages-LWOC67ZH-VhvllE7L.js +1 -0
  305. package/dist/client/assets/{pica-xkWDouSg.js → pica-BPrp-GK1.js} +1 -1
  306. package/dist/client/assets/pie-DzWLGKAD.js +1 -0
  307. package/dist/client/assets/pie-WAS4IAKB-Bg2eCNl5.js +1 -0
  308. package/dist/client/assets/pie-WAS4IAKB-DWSm9SSD.js +1 -0
  309. package/dist/client/assets/pieDiagram-5QR66LMP-BICdpEuz.js +39 -0
  310. package/dist/client/assets/pieDiagram-E7YTZNPT-CZThaHsc.js +39 -0
  311. package/dist/client/assets/{preload-helper-CtT0-S4g.js → preload-helper-BAlEavIC.js} +1 -1
  312. package/dist/client/assets/preview-render-compiler-ktU0SXxY.js +43 -0
  313. package/dist/client/assets/preview-render-profile-D652PAjA.js +1 -0
  314. package/dist/client/assets/preview-render-worker-BI2bFVqM.js +575 -0
  315. package/dist/client/assets/prod-DU-0VfI7.js +145 -0
  316. package/dist/client/assets/prod-cXUNdmYV.js +1 -0
  317. package/dist/client/assets/{pug-Wky5Dnfy.js → pug-CqqUmdG7.js} +1 -1
  318. package/dist/client/assets/purify.es-go7v6Te-.js +3 -0
  319. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-fJE7iAxt.js → quadrantDiagram-AXDQQJYC-C5iowkl_.js} +3 -3
  320. package/dist/client/assets/quadrantDiagram-O4NWA36T-Bgx5bF97.js +7 -0
  321. package/dist/client/assets/quick-switcher-controller-DSlOwOsU.js +1 -0
  322. package/dist/client/assets/radar-RG4KPBEZ-BfNQUEQy.js +1 -0
  323. package/dist/client/assets/radar-RG4KPBEZ-DxExotg6.js +1 -0
  324. package/dist/client/assets/railroad-74A4TZTK-BaQ6U6eJ.js +1 -0
  325. package/dist/client/assets/railroad-74A4TZTK-FfHmeIQk.js +1 -0
  326. package/dist/client/assets/railroad-abnf-HS5TGJTU-BJ3KZw7J.js +1 -0
  327. package/dist/client/assets/railroad-abnf-HS5TGJTU-CLkdDRsJ.js +1 -0
  328. package/dist/client/assets/railroad-ebnf-LZEXJU2U-B162zvcG.js +1 -0
  329. package/dist/client/assets/railroad-ebnf-LZEXJU2U-DA0sEq7w.js +1 -0
  330. package/dist/client/assets/railroad-peg-WCYAUIDC-CGs5GeJ5.js +1 -0
  331. package/dist/client/assets/railroad-peg-WCYAUIDC-DCmlICzO.js +1 -0
  332. package/dist/client/assets/railroadDiagram-O6MQD6OU-BTt_rKjT.js +1 -0
  333. package/dist/client/assets/railroadDiagram-XR7U4H2S-DbVoNgSz.js +1 -0
  334. package/dist/client/assets/{requirementDiagram-BXWQKSXE-Balm0WW8.js → requirementDiagram-BXWQKSXE-BkvazG7r.js} +1 -1
  335. package/dist/client/assets/requirementDiagram-PLB6GJNP-BT0j9C40.js +84 -0
  336. package/dist/client/assets/sankeyDiagram-IPEJSGJF-X1BCUIrf.js +40 -0
  337. package/dist/client/assets/sankeyDiagram-P5KCCOFB-C_IemB9h.js +40 -0
  338. package/dist/client/assets/sankeyLinkHorizontal-usjP1-Cg.js +1 -0
  339. package/dist/client/assets/sequenceDiagram-PO4LG4MO-B-2QfXhV.js +169 -0
  340. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-BL1j3Sn-.js → sequenceDiagram-WJ2MYXX4-CxFBgLGd.js} +3 -3
  341. package/dist/client/assets/{sieve-BAxa3IjF.js → sieve-tLWDfEkZ.js} +1 -1
  342. package/dist/client/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -1
  343. package/dist/client/assets/sizeCapture-INFHLROL-DrzwYt5z.js +1 -0
  344. package/dist/client/assets/sl-SI-QY5KCFGA-RZhwMpQL.js +8 -0
  345. package/dist/client/assets/solr-B78wSQJQ.js +1 -0
  346. package/dist/client/assets/src-XiVvaevx.js +1 -0
  347. package/dist/client/assets/stateDiagram-D77RDMKH-BaSQ6Owj.js +1 -0
  348. package/dist/client/assets/stateDiagram-v2-GCMORJYK-CsVcfwVp.js +291 -0
  349. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CLlwrdvU.js +1 -0
  350. package/dist/client/assets/sv-SE-O3OFCY3J-DnS86_7q.js +12 -0
  351. package/dist/client/assets/swimlanes-2SLR337P-CnYTVqRX.js +1 -0
  352. package/dist/client/assets/swimlanes-42K2YHIH-CALFEmiS.js +1 -0
  353. package/dist/client/assets/swimlanesDiagram-TC7HE7FX-Bh4tmz27.js +8 -0
  354. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-xhehUG9e.js +8 -0
  355. package/dist/client/assets/th-TH-WLSZUSBX-DHehoYR2.js +1 -0
  356. package/dist/client/assets/{timeline-definition-24CTP7MA-7pch5JAr.js → timeline-definition-24CTP7MA-zse-5Dbm.js} +5 -5
  357. package/dist/client/assets/timeline-definition-EJHVYXUP-BhqPlKkN.js +120 -0
  358. package/dist/client/assets/treeView-Q6P3EWNA-BvHOzbu9.js +1 -0
  359. package/dist/client/assets/treeView-Q6P3EWNA-Cccy0ngL.js +1 -0
  360. package/dist/client/assets/treemap-CxZTjHiH.js +1 -0
  361. package/dist/client/assets/treemap-WGGIJYW6-oety7paS.js +1 -0
  362. package/dist/client/assets/treemap-WGGIJYW6-sMRCjCtX.js +1 -0
  363. package/dist/client/assets/usecaseDiagram-POWQR4AR-DR2LHQYs.js +328 -0
  364. package/dist/client/assets/v4-DDdyfk2q.js +1 -0
  365. package/dist/client/assets/{vault-api-client-QjZ_T03l.js → vault-api-client-BQxLVPeF.js} +1 -1
  366. package/dist/client/assets/vault-paths-BT-6nztu.js +1 -0
  367. package/dist/client/assets/venn.esm-C5rDfA9t.js +7 -0
  368. package/dist/client/assets/vennDiagram-4TSXK5OY-DgHr6cJD.js +28 -0
  369. package/dist/client/assets/vennDiagram-UO4OBE2U-BRwLn2Q1.js +28 -0
  370. package/dist/client/assets/{verilog-7LoJAqYT.js → verilog-CjI9Y6RI.js} +1 -1
  371. package/dist/client/assets/wardley-WFR3VGLG-BdwDpX_I.js +1 -0
  372. package/dist/client/assets/wardley-WFR3VGLG-Y7xty_3m.js +1 -0
  373. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-BbSlUwuM.js → wardleyDiagram-VM6X3IG4-9A60XZis.js} +3 -3
  374. package/dist/client/assets/wardleyDiagram-VNRHLVJA-B_tMcVFG.js +78 -0
  375. package/dist/client/assets/wiki-link-resolver-Dch88erO.js +1 -0
  376. package/dist/client/assets/{worker-engine-m0rlHn8R-eSDcDGEI.js → worker-engine-m0rlHn8R-5h66k403.js} +1 -1
  377. package/dist/client/assets/{workspace-sync-client-D4nblH_2.js → workspace-sync-client-C2pdaQUN.js} +1 -1
  378. package/dist/client/assets/xychartDiagram-PMCCYNJV-fRpZ1MA5.js +7 -0
  379. package/dist/client/assets/xychartDiagram-S5SC5T6Z-D00iy-wB.js +7 -0
  380. package/dist/client/assets/{yaml-9ltHPDNO.js → yaml-BcZaqAz8.js} +1 -1
  381. package/dist/client/assets/{yjs-provider-reset-guard-R43MnLNc.js → yjs-provider-reset-guard-DpntzUDR.js} +1 -1
  382. package/dist/client/drawio-editor.html +6 -5
  383. package/dist/client/excalidraw-editor.html +39 -32
  384. package/dist/client/export-document.html +4 -3
  385. package/dist/client/index.html +21 -14
  386. package/package.json +12 -9
  387. package/src/client/app/drawio-editor.html +1 -0
  388. package/src/client/app/excalidraw-editor.html +1 -0
  389. package/src/client/app/export-document-entry.js +1 -0
  390. package/src/client/app/export-document.html +1 -0
  391. package/src/client/app/index.html +19 -12
  392. package/src/client/application/app-shell/ui-feature-shell.js +20 -1
  393. package/src/client/application/app-shell-elements.js +2 -0
  394. package/src/client/application/diagram-preview-hydrator.js +7 -0
  395. package/src/client/application/mermaid-preview-hydrator.js +89 -3
  396. package/src/client/application/preview-diagram-utils.js +1 -0
  397. package/src/client/application/preview-render-compiler.js +2 -0
  398. package/src/client/application/preview-render-executor.js +4 -1
  399. package/src/client/application/preview-render-profile.js +8 -12
  400. package/src/client/application/preview-renderer.js +3 -0
  401. package/src/client/bootstrap/collabmd-app-shell.js +16 -7
  402. package/src/client/browser-utils.js +1 -1
  403. package/src/client/domain/excalidraw-scene.js +0 -11
  404. package/src/client/domain/file-search.js +1 -0
  405. package/src/client/domain/highlight-runtime.js +30 -3
  406. package/src/client/domain/markdown-math.js +14 -0
  407. package/src/client/export/export-host.js +3 -7
  408. package/src/client/export/export-pipeline.js +208 -21
  409. package/src/client/infrastructure/browser-preferences-port.js +8 -0
  410. package/src/client/infrastructure/editor-session.js +20 -0
  411. package/src/client/infrastructure/editor-view-adapter.js +8 -7
  412. package/src/client/infrastructure/excalidraw-room-client.js +2 -45
  413. package/src/client/infrastructure/git-api-client.js +5 -0
  414. package/src/client/infrastructure/tab-activity-lock.js +8 -4
  415. package/src/client/infrastructure/webmcp-tool-registry.js +12 -5
  416. package/src/client/presentation/bases-preview-controller.js +2 -1
  417. package/src/client/presentation/comment-markdown-renderer.js +2 -0
  418. package/src/client/presentation/comment-ui-controller.js +21 -30
  419. package/src/client/presentation/create-menu-presenter.js +16 -18
  420. package/src/client/presentation/drawio-embed-controller.js +55 -7
  421. package/src/client/presentation/excalidraw-embed-controller.js +11 -3
  422. package/src/client/presentation/file-explorer-controller.js +1 -0
  423. package/src/client/presentation/file-explorer-view.js +32 -2
  424. package/src/client/presentation/file-history-view-controller.js +6 -0
  425. package/src/client/presentation/git-diff-view-controller.js +3 -2
  426. package/src/client/presentation/git-panel-controller.js +6 -5
  427. package/src/client/presentation/image-lightbox-controller.js +7 -6
  428. package/src/client/presentation/outline-controller.js +0 -86
  429. package/src/client/presentation/quick-switcher-controller.js +50 -13
  430. package/src/client/presentation/scroll-sync-controller.js +69 -21
  431. package/src/client/styles/components/navigation.css +2 -2
  432. package/src/client/styles/deferred-collab.css +1 -0
  433. package/src/client/styles/deferred-preview.css +1 -0
  434. package/src/client/styles/features/diagram-preview.css +1 -0
  435. package/src/client/styles/features/preview-markdown.css +4 -4
  436. package/src/client/styles/foundation/themes.css +56 -271
  437. package/src/client/styles/layout/editor-page.css +0 -1
  438. package/src/client/styles/layout/shell.css +6 -0
  439. package/src/client/styles/layout/sidebar.css +3 -0
  440. package/src/client/styles/surfaces/landing-page.css +260 -0
  441. package/src/domain/agent-tool-definitions.js +45 -13
  442. package/src/domain/collabmd-content-capabilities.js +59 -4
  443. package/src/domain/collaboration-protocol.js +2 -0
  444. package/src/domain/markdown-outline.js +35 -0
  445. package/src/server/application/agent-connection-service.js +6 -2
  446. package/src/server/application/agent-content-service.js +124 -56
  447. package/src/server/auth/create-auth-service.js +40 -12
  448. package/src/server/auth/session-cookie.js +49 -38
  449. package/src/server/config/env.js +1 -1
  450. package/src/server/domain/backlink-index.js +1 -11
  451. package/src/server/domain/bases/base-query-results.js +7 -3
  452. package/src/server/domain/bases/base-query-service.js +2 -7
  453. package/src/server/domain/collaboration/collaboration-room.js +54 -16
  454. package/src/server/domain/docx-exporter.js +256 -2
  455. package/src/server/domain/hosted-workspace-contract.js +7 -0
  456. package/src/server/domain/hosted-workspace.js +29 -62
  457. package/src/server/domain/ripgrep-search-service.js +44 -28
  458. package/src/server/infrastructure/git/diff-service.js +15 -11
  459. package/src/server/infrastructure/git/git-service.js +4 -0
  460. package/src/server/infrastructure/git/image-mime.js +4 -3
  461. package/src/server/infrastructure/git/status-service.js +10 -6
  462. package/src/server/infrastructure/http/create-git-api-query-handler.js +25 -0
  463. package/src/server/infrastructure/http/create-vault-api-query-handler.js +13 -53
  464. package/src/server/infrastructure/http/http-response.js +2 -0
  465. package/src/server/infrastructure/persistence/hosted-metadata-store.js +42 -5
  466. package/src/server/infrastructure/persistence/path-utils.js +23 -3
  467. package/src/server/infrastructure/persistence/pull-backup-store.js +52 -42
  468. package/src/server/infrastructure/persistence/sidecar-store.js +7 -4
  469. package/src/server/infrastructure/persistence/vault-file-store.js +55 -168
  470. package/src/server/infrastructure/plantuml/plantuml-renderer.js +33 -0
  471. package/src/server/infrastructure/structurizr/structurizr-workspace-service.js +24 -10
  472. package/src/server/infrastructure/websocket/attach-collaboration-gateway.js +7 -3
  473. package/src/server/infrastructure/websocket/client-socket-session.js +32 -4
  474. package/src/server/infrastructure/workspace/file-system-sync-service.js +4 -2
  475. package/dist/client/assets/CodeMirrorEditor-UCMRAMCV-Crf9Y3Q6.js +0 -1
  476. package/dist/client/assets/abnfDiagram-VCTEODGH-PuinKbSQ.js +0 -1
  477. package/dist/client/assets/architecture-7GRP2DOG-BMOPAkUC.js +0 -1
  478. package/dist/client/assets/architectureDiagram-5GKGNRK7-46hPkrZv.js +0 -36
  479. package/dist/client/assets/blockDiagram-I7D4REHJ-C1S5Bzf8.js +0 -129
  480. package/dist/client/assets/channel-jwdhnPiV.js +0 -1
  481. package/dist/client/assets/chunk-2E4U76K2-Ba8Wf22k.js +0 -1
  482. package/dist/client/assets/chunk-4HAMMTFA-Ht-73lsT.js +0 -62
  483. package/dist/client/assets/chunk-5XKZK2GL-D4UAZSOJ.js +0 -1
  484. package/dist/client/assets/chunk-75Z2AOVW-B2cZexqK.js +0 -2
  485. package/dist/client/assets/chunk-DU6HZSFF-C6d6PJfE.js +0 -127
  486. package/dist/client/assets/chunk-GMAD6QVW-DUfjx_d5.js +0 -72
  487. package/dist/client/assets/chunk-GVQU2GXP-D1l7oRGR.js +0 -1
  488. package/dist/client/assets/chunk-L3NEJ4N5-BmCVn4y-.js +0 -1
  489. package/dist/client/assets/chunk-OSK3NFVY-CWHXAmfx.js +0 -10
  490. package/dist/client/assets/chunk-POPQ4Y6H-B5yJIrZE.js +0 -1
  491. package/dist/client/assets/chunk-PWAF6VOD-B3gML4ps.js +0 -1
  492. package/dist/client/assets/chunk-TLUHSLCS-Yl7B0Vrz.js +0 -1
  493. package/dist/client/assets/chunk-ZNVOA63L-BmCQjhx-.js +0 -40
  494. package/dist/client/assets/classDiagram-ZZMXUADV-BRw9vo8U.js +0 -1
  495. package/dist/client/assets/classDiagram-v2-VYDZK3BY-BRw9vo8U.js +0 -1
  496. package/dist/client/assets/comment-markdown-renderer-B9_vPc3F.js +0 -1
  497. package/dist/client/assets/comment-thread-store-NNHqRVsX.js +0 -1
  498. package/dist/client/assets/cose-bilkent-JH36ORCC-Cm_QF_yb.js +0 -1
  499. package/dist/client/assets/cynefin-OW5HDTMX-7tP7QfM3.js +0 -1
  500. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-BRoCEoZM.js +0 -62
  501. package/dist/client/assets/cytoscape.esm-B-NFISlW.js +0 -321
  502. package/dist/client/assets/dagre-PrKaheQc.js +0 -1
  503. package/dist/client/assets/deferred-collab-rBe4nuQ2.css +0 -1
  504. package/dist/client/assets/deferred-preview-pe7Iwwx3.css +0 -1
  505. package/dist/client/assets/diagram-UQ7AKVKN-JevUZuYi.js +0 -41
  506. package/dist/client/assets/diagram-VX7I27RA-pSD4HMh1.js +0 -24
  507. package/dist/client/assets/diagram-Z3DM3KII-D8r1_CIb.js +0 -24
  508. package/dist/client/assets/direct-engine-DdrQKpgq-B5zIoeQw.js +0 -5
  509. package/dist/client/assets/dist-B3HdUPsK.js +0 -1
  510. package/dist/client/assets/dist-BIRygGYH.js +0 -1
  511. package/dist/client/assets/dist-BPyOlNLY.js +0 -2
  512. package/dist/client/assets/dist-ByhQbe-x.js +0 -1
  513. package/dist/client/assets/dist-C5NkYKAa.js +0 -1
  514. package/dist/client/assets/dist-CEirJSxk.js +0 -1
  515. package/dist/client/assets/dist-CRnJ0D9h.js +0 -1
  516. package/dist/client/assets/dist-CyNrloSI.js +0 -1
  517. package/dist/client/assets/dist-D60_kdpQ.js +0 -1
  518. package/dist/client/assets/dist-Hdhj3L3t.js +0 -1
  519. package/dist/client/assets/dist-gRRhmB-2.js +0 -6
  520. package/dist/client/assets/dist-kWb2d1CH.js +0 -1
  521. package/dist/client/assets/dist-l-56SowH.js +0 -19
  522. package/dist/client/assets/dist-sLzRQQk7.js +0 -1
  523. package/dist/client/assets/ebnfDiagram-PWID7BFC-UJ0Fz5ci.js +0 -1
  524. package/dist/client/assets/editor-session-4Bn81iWm.js +0 -14
  525. package/dist/client/assets/embedded-editor-base-jK221GC8.css +0 -1
  526. package/dist/client/assets/eventmodeling-NTZA5JFV-BR2FzK4R.js +0 -1
  527. package/dist/client/assets/excalidrawEditor-WIuguTz7.js +0 -9
  528. package/dist/client/assets/export-page-AN-wI5p4.js +0 -56
  529. package/dist/client/assets/exportDocument-B7IagJhQ.css +0 -1
  530. package/dist/client/assets/exportDocument-B9xNKpQe.js +0 -2
  531. package/dist/client/assets/file-search-DDLyyLDU.js +0 -1
  532. package/dist/client/assets/flowDiagram-HODETNUW-kb1lUSBo.js +0 -1
  533. package/dist/client/assets/forth-Cezjo90N.js +0 -1
  534. package/dist/client/assets/ganttDiagram-EL5Y4UJY-BBNzDfaV.js +0 -292
  535. package/dist/client/assets/gitGraph-4MIJSDKK-DYlXv_yJ.js +0 -1
  536. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-Csf0Dm_1.js +0 -106
  537. package/dist/client/assets/graphlib-DS17s2tU.js +0 -1
  538. package/dist/client/assets/image-2QKV3NAF-BUbX0y5Y.js +0 -1
  539. package/dist/client/assets/index-BAmZnTFV.css +0 -1
  540. package/dist/client/assets/index-mWiw418b.js +0 -1111
  541. package/dist/client/assets/info-A6RAGUB7-BlU-8_xu.js +0 -1
  542. package/dist/client/assets/infoDiagram-27XIBGKW-Bzy6kCbb.js +0 -2
  543. package/dist/client/assets/javascript-BWjar7HY.js +0 -1
  544. package/dist/client/assets/javascript-D-FtdkNC.js +0 -1
  545. package/dist/client/assets/jsx-runtime-BpzPEenQ.js +0 -1
  546. package/dist/client/assets/line-DSWLHgpx.js +0 -1
  547. package/dist/client/assets/linear-n-3HSMUF.js +0 -1
  548. package/dist/client/assets/markdown-it-CocJWnjv.js +0 -13
  549. package/dist/client/assets/mermaid.core-C_FK-7n4.js +0 -1
  550. package/dist/client/assets/mermaid.core-D0cMM4Rl.js +0 -10
  551. package/dist/client/assets/packet-AYTQ26CC-BSJEH9Lb.js +0 -1
  552. package/dist/client/assets/pegDiagram-XKGWAZYB-DS6Ab21R.js +0 -1
  553. package/dist/client/assets/percentages-Q7USCRWZ-DWE6uvTs.js +0 -1
  554. package/dist/client/assets/pie-WAS4IAKB-qxv01Y8W.js +0 -1
  555. package/dist/client/assets/pieDiagram-E7YTZNPT-BbFe6Tgs.js +0 -39
  556. package/dist/client/assets/preview-render-compiler-C_7J7eia.js +0 -43
  557. package/dist/client/assets/preview-render-compiler-DzJ1KR_M.js +0 -1
  558. package/dist/client/assets/preview-render-worker-1DoIDllV.js +0 -59
  559. package/dist/client/assets/prod-D5TxmmoB.js +0 -1
  560. package/dist/client/assets/prod-pbFU4TaM.js +0 -145
  561. package/dist/client/assets/quick-switcher-controller-CUajuy78.js +0 -1
  562. package/dist/client/assets/radar-RG4KPBEZ-B6h6pWOs.js +0 -1
  563. package/dist/client/assets/railroad-74A4TZTK-CGtTWdGc.js +0 -1
  564. package/dist/client/assets/railroad-abnf-HS5TGJTU-Cq7y22IA.js +0 -1
  565. package/dist/client/assets/railroad-ebnf-LZEXJU2U-V0aQVv9m.js +0 -1
  566. package/dist/client/assets/railroad-peg-WCYAUIDC-BQiIsX_p.js +0 -1
  567. package/dist/client/assets/railroadDiagram-O6MQD6OU-CUQKqbCK.js +0 -1
  568. package/dist/client/assets/sankeyDiagram-P5KCCOFB-CcbMqrlQ.js +0 -40
  569. package/dist/client/assets/sl-SI-JRML4FIH-D53L_0S2.js +0 -6
  570. package/dist/client/assets/solr-BBopId9w.js +0 -1
  571. package/dist/client/assets/src-oBChb5qS.js +0 -1
  572. package/dist/client/assets/stateDiagram-D77RDMKH-DNi924hh.js +0 -1
  573. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-C62JEwak.js +0 -1
  574. package/dist/client/assets/sv-SE-4ZPKFFXF-DT-G7RCI.js +0 -12
  575. package/dist/client/assets/swimlanes-42K2YHIH-ColgjSH4.js +0 -1
  576. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-B9UZhEj4.js +0 -8
  577. package/dist/client/assets/th-TH-P7CTMGDK-6sy0NO7K.js +0 -1
  578. package/dist/client/assets/treeView-Q6P3EWNA-BTTYcvrF.js +0 -1
  579. package/dist/client/assets/treemap-WGGIJYW6-Cg7tyfH8.js +0 -1
  580. package/dist/client/assets/vennDiagram-4TSXK5OY-C5taziCX.js +0 -34
  581. package/dist/client/assets/wardley-WFR3VGLG-C6N1rULY.js +0 -1
  582. package/dist/client/assets/wiki-link-resolver-C2P_WmTV.js +0 -1
  583. package/dist/client/assets/xychartDiagram-S5SC5T6Z-D06X1arY.js +0 -7
  584. package/src/server/domain/collaboration/protocol.js +0 -6
@@ -0,0 +1,5 @@
1
+ import{$ as e,A as t,B as n,C as r,Ct as i,D as a,E as o,Et as s,F as c,H as l,I as u,It as d,J as f,Lt as p,Mt as m,Ot as h,St as g,Tt as _,_ as v,_t as y,at as b,b as x,bt as S,c as C,ct as w,ft as T,gt as E,it as D,jt as O,k,lt as A,m as ee,p as j,q as te,r as M,tt as N,ut as P,x as ne,y as F,yt as re}from"./embedpdf-DA4bA119-DsoNiPlQ.js";import{n as ie,t as ae}from"./browser-BKLM0ThC-IxjwuOIz-C0mP17s1.js";var oe=import.meta.url,se=async function(e={}){var t,n,r,i=e,a=new Promise((e,t)=>{n=e,r=t});`_EPDF_GetMetaKeyCount._EPDF_GetMetaKeyName._EPDF_GetMetaTrapped._EPDF_GetPageBoxByIndex._EPDF_GetPageRotationByIndex._EPDF_GetPageSizeByIndexNormalized._EPDF_HasMetaText._EPDF_IsEncrypted._EPDF_IsOwnerUnlocked._EPDF_LoadPageNormalized._EPDF_PNG_EncodeRGBA._EPDF_RemoveEncryption._EPDF_RenderAnnotBitmap._EPDF_RenderAnnotBitmapUnrotated._EPDF_SetEncryption._EPDF_SetMetaText._EPDF_SetMetaTrapped._EPDF_UnlockOwnerPermissions._EPDFAction_CreateGoTo._EPDFAction_CreateGoToNamed._EPDFAction_CreateLaunch._EPDFAction_CreateRemoteGoToByName._EPDFAction_CreateRemoteGoToDest._EPDFAction_CreateURI._EPDFAnnot_ApplyRedaction._EPDFAnnot_ClearBorderEffect._EPDFAnnot_ClearColor._EPDFAnnot_ClearMKColor._EPDFAnnot_ClearRectangleDifferences._EPDFAnnot_ExportAppearanceAsDocument._EPDFAnnot_ExportMultipleAppearancesAsDocument._EPDFAnnot_Flatten._EPDFAnnot_GenerateAppearance._EPDFAnnot_GenerateAppearanceWithBlend._EPDFAnnot_GenerateFormFieldAP._EPDFAnnot_GetAPMatrix._EPDFAnnot_GetAvailableAppearanceModes._EPDFAnnot_GetBlendMode._EPDFAnnot_GetBorderDashPattern._EPDFAnnot_GetBorderDashPatternCount._EPDFAnnot_GetBorderEffect._EPDFAnnot_GetBorderStyle._EPDFAnnot_GetButtonExportValue._EPDFAnnot_GetCalloutLine._EPDFAnnot_GetCalloutLineCount._EPDFAnnot_GetColor._EPDFAnnot_GetDefaultAppearance._EPDFAnnot_GetExtendedRotation._EPDFAnnot_GetFormFieldObjectNumber._EPDFAnnot_GetFormFieldRawValue._EPDFAnnot_GetIntent._EPDFAnnot_GetLineEndings._EPDFAnnot_GetMKColor._EPDFAnnot_GetName._EPDFAnnot_GetObjectNumber._EPDFAnnot_GetOpacity._EPDFAnnot_GetOverlayText._EPDFAnnot_GetOverlayTextRepeat._EPDFAnnot_GetRect._EPDFAnnot_GetRectangleDifferences._EPDFAnnot_GetReplyType._EPDFAnnot_GetRichContent._EPDFAnnot_GetRotate._EPDFAnnot_GetTextAlignment._EPDFAnnot_GetUnrotatedRect._EPDFAnnot_GetVerticalAlignment._EPDFAnnot_HasAppearanceStream._EPDFAnnot_SetAction._EPDFAnnot_SetAPMatrix._EPDFAnnot_SetAppearanceFromPage._EPDFAnnot_SetBorderDashPattern._EPDFAnnot_SetBorderEffect._EPDFAnnot_SetBorderStyle._EPDFAnnot_SetCalloutLine._EPDFAnnot_SetColor._EPDFAnnot_SetDefaultAppearance._EPDFAnnot_SetExtendedRotation._EPDFAnnot_SetFormFieldName._EPDFAnnot_SetFormFieldOptions._EPDFAnnot_SetFormFieldValue._EPDFAnnot_SetIntent._EPDFAnnot_SetLine._EPDFAnnot_SetLineEndings._EPDFAnnot_SetLinkedAnnot._EPDFAnnot_SetMKColor._EPDFAnnot_SetName._EPDFAnnot_SetNumberValue._EPDFAnnot_SetOpacity._EPDFAnnot_SetOverlayText._EPDFAnnot_SetOverlayTextRepeat._EPDFAnnot_SetRectangleDifferences._EPDFAnnot_SetReplyType._EPDFAnnot_SetRotate._EPDFAnnot_SetTextAlignment._EPDFAnnot_SetUnrotatedRect._EPDFAnnot_SetVerticalAlignment._EPDFAnnot_SetVertices._EPDFAnnot_ShareFormField._EPDFAnnot_UpdateAppearanceToRect._EPDFAttachment_GetDescription._EPDFAttachment_GetIntegerValue._EPDFAttachment_SetDescription._EPDFAttachment_SetSubtype._EPDFBookmark_AppendChild._EPDFBookmark_Clear._EPDFBookmark_ClearTarget._EPDFBookmark_Create._EPDFBookmark_Delete._EPDFBookmark_InsertAfter._EPDFBookmark_SetAction._EPDFBookmark_SetDest._EPDFBookmark_SetTitle._EPDFCatalog_GetLanguage._EPDFDest_CreateRemoteView._EPDFDest_CreateRemoteXYZ._EPDFDest_CreateView._EPDFDest_CreateXYZ._EPDFDoc_GetPageObjectNumberByIndex._EPDFDoc_LoadPageByObjectNumber._EPDFImageObj_SetJpeg._EPDFImageObj_SetPng._EPDFNamedDest_Remove._EPDFNamedDest_SetDest._EPDFPage_ApplyRedactions._EPDFPage_CreateAnnot._EPDFPage_CreateFormField._EPDFPage_GetAnnotByName._EPDFPage_GetAnnotByObjectNumber._EPDFPage_GetAnnotCountRaw._EPDFPage_GetAnnotRaw._EPDFPage_GetObjectNumber._EPDFPage_MoveAnnots._EPDFPage_RemoveAnnot._EPDFPage_RemoveAnnotByName._EPDFPage_RemoveAnnotByObjectNumber._EPDFPage_RemoveAnnotRaw._EPDFText_RedactInQuads._EPDFText_RedactInRect._FORM_CanRedo._FORM_CanUndo._FORM_DoDocumentAAction._FORM_DoDocumentJSAction._FORM_DoDocumentOpenAction._FORM_DoPageAAction._FORM_ForceToKillFocus._FORM_GetFocusedAnnot._FORM_GetFocusedText._FORM_GetSelectedText._FORM_IsIndexSelected._FORM_OnAfterLoadPage._FORM_OnBeforeClosePage._FORM_OnChar._FORM_OnFocus._FORM_OnKeyDown._FORM_OnKeyUp._FORM_OnLButtonDoubleClick._FORM_OnLButtonDown._FORM_OnLButtonUp._FORM_OnMouseMove._FORM_OnMouseWheel._FORM_OnRButtonDown._FORM_OnRButtonUp._FORM_Redo._FORM_ReplaceAndKeepSelection._FORM_ReplaceSelection._FORM_SelectAllText._FORM_SetFocusedAnnot._FORM_SetIndexSelected._FORM_Undo._FPDF_AddInstalledFont._FPDF_CloseDocument._FPDF_ClosePage._FPDF_CloseXObject._FPDF_CopyViewerPreferences._FPDF_CountNamedDests._FPDF_CreateClipPath._FPDF_CreateNewDocument._FPDF_DestroyClipPath._FPDF_DestroyLibrary._FPDF_DeviceToPage._FPDF_DocumentHasValidCrossReferenceTable._FPDF_FFLDraw._FPDF_FreeDefaultSystemFontInfo._FPDF_GetDefaultSystemFontInfo._FPDF_GetDefaultTTFMap._FPDF_GetDefaultTTFMapCount._FPDF_GetDefaultTTFMapEntry._FPDF_GetDocPermissions._FPDF_GetDocUserPermissions._FPDF_GetFileIdentifier._FPDF_GetFileVersion._FPDF_GetFormType._FPDF_GetLastError._FPDF_GetMetaText._FPDF_GetNamedDest._FPDF_GetNamedDestByName._FPDF_GetPageAAction._FPDF_GetPageBoundingBox._FPDF_GetPageCount._FPDF_GetPageHeight._FPDF_GetPageHeightF._FPDF_GetPageLabel._FPDF_GetPageSizeByIndex._FPDF_GetPageSizeByIndexF._FPDF_GetPageWidth._FPDF_GetPageWidthF._FPDF_GetSecurityHandlerRevision._FPDF_GetSignatureCount._FPDF_GetSignatureObject._FPDF_GetTrailerEnds._FPDF_GetXFAPacketContent._FPDF_GetXFAPacketCount._FPDF_GetXFAPacketName._FPDF_ImportNPagesToOne._FPDF_ImportPages._FPDF_ImportPagesByIndex._FPDF_InitLibrary._FPDF_InitLibraryWithConfig._FPDF_LoadCustomDocument._FPDF_LoadDocument._FPDF_LoadMemDocument._FPDF_LoadMemDocument64._FPDF_LoadPage._FPDF_LoadXFA._FPDF_MovePages._FPDF_NewFormObjectFromXObject._FPDF_NewXObjectFromPage._FPDF_PageToDevice._FPDF_RemoveFormFieldHighlight._FPDF_RenderPage_Close._FPDF_RenderPage_Continue._FPDF_RenderPageBitmap._FPDF_RenderPageBitmap_Start._FPDF_RenderPageBitmapWithColorScheme_Start._FPDF_RenderPageBitmapWithMatrix._FPDF_SaveAsCopy._FPDF_SaveWithVersion._FPDF_SetFormFieldHighlightAlpha._FPDF_SetFormFieldHighlightColor._FPDF_SetSandBoxPolicy._FPDF_SetSystemFontInfo._FPDF_StructElement_Attr_CountChildren._FPDF_StructElement_Attr_GetBlobValue._FPDF_StructElement_Attr_GetBooleanValue._FPDF_StructElement_Attr_GetChildAtIndex._FPDF_StructElement_Attr_GetCount._FPDF_StructElement_Attr_GetName._FPDF_StructElement_Attr_GetNumberValue._FPDF_StructElement_Attr_GetStringValue._FPDF_StructElement_Attr_GetType._FPDF_StructElement_Attr_GetValue._FPDF_StructElement_CountChildren._FPDF_StructElement_GetActualText._FPDF_StructElement_GetAltText._FPDF_StructElement_GetAttributeAtIndex._FPDF_StructElement_GetAttributeCount._FPDF_StructElement_GetChildAtIndex._FPDF_StructElement_GetChildMarkedContentID._FPDF_StructElement_GetID._FPDF_StructElement_GetLang._FPDF_StructElement_GetMarkedContentID._FPDF_StructElement_GetMarkedContentIdAtIndex._FPDF_StructElement_GetMarkedContentIdCount._FPDF_StructElement_GetObjType._FPDF_StructElement_GetParent._FPDF_StructElement_GetStringAttribute._FPDF_StructElement_GetTitle._FPDF_StructElement_GetType._FPDF_StructTree_Close._FPDF_StructTree_CountChildren._FPDF_StructTree_GetChildAtIndex._FPDF_StructTree_GetForPage._FPDF_VIEWERREF_GetDuplex._FPDF_VIEWERREF_GetName._FPDF_VIEWERREF_GetNumCopies._FPDF_VIEWERREF_GetPrintPageRange._FPDF_VIEWERREF_GetPrintPageRangeCount._FPDF_VIEWERREF_GetPrintPageRangeElement._FPDF_VIEWERREF_GetPrintScaling._FPDFAction_GetDest._FPDFAction_GetFilePath._FPDFAction_GetType._FPDFAction_GetURIPath._FPDFAnnot_AddFileAttachment._FPDFAnnot_AddInkStroke._FPDFAnnot_AppendAttachmentPoints._FPDFAnnot_AppendObject._FPDFAnnot_CountAttachmentPoints._FPDFAnnot_GetAP._FPDFAnnot_GetAttachmentPoints._FPDFAnnot_GetBorder._FPDFAnnot_GetColor._FPDFAnnot_GetFileAttachment._FPDFAnnot_GetFlags._FPDFAnnot_GetFocusableSubtypes._FPDFAnnot_GetFocusableSubtypesCount._FPDFAnnot_GetFontColor._FPDFAnnot_GetFontSize._FPDFAnnot_GetFormAdditionalActionJavaScript._FPDFAnnot_GetFormControlCount._FPDFAnnot_GetFormControlIndex._FPDFAnnot_GetFormFieldAlternateName._FPDFAnnot_GetFormFieldAtPoint._FPDFAnnot_GetFormFieldExportValue._FPDFAnnot_GetFormFieldFlags._FPDFAnnot_GetFormFieldName._FPDFAnnot_GetFormFieldType._FPDFAnnot_GetFormFieldValue._FPDFAnnot_GetInkListCount._FPDFAnnot_GetInkListPath._FPDFAnnot_GetLine._FPDFAnnot_GetLink._FPDFAnnot_GetLinkedAnnot._FPDFAnnot_GetNumberValue._FPDFAnnot_GetObject._FPDFAnnot_GetObjectCount._FPDFAnnot_GetOptionCount._FPDFAnnot_GetOptionLabel._FPDFAnnot_GetRect._FPDFAnnot_GetStringValue._FPDFAnnot_GetSubtype._FPDFAnnot_GetValueType._FPDFAnnot_GetVertices._FPDFAnnot_HasAttachmentPoints._FPDFAnnot_HasKey._FPDFAnnot_IsChecked._FPDFAnnot_IsObjectSupportedSubtype._FPDFAnnot_IsOptionSelected._FPDFAnnot_IsSupportedSubtype._FPDFAnnot_RemoveInkList._FPDFAnnot_RemoveObject._FPDFAnnot_SetAP._FPDFAnnot_SetAttachmentPoints._FPDFAnnot_SetBorder._FPDFAnnot_SetColor._FPDFAnnot_SetFlags._FPDFAnnot_SetFocusableSubtypes._FPDFAnnot_SetFontColor._FPDFAnnot_SetFormFieldFlags._FPDFAnnot_SetRect._FPDFAnnot_SetStringValue._FPDFAnnot_SetURI._FPDFAnnot_UpdateObject._FPDFAttachment_GetFile._FPDFAttachment_GetName._FPDFAttachment_GetStringValue._FPDFAttachment_GetSubtype._FPDFAttachment_GetValueType._FPDFAttachment_HasKey._FPDFAttachment_SetFile._FPDFAttachment_SetStringValue._FPDFAvail_Create._FPDFAvail_Destroy._FPDFAvail_GetDocument._FPDFAvail_GetFirstPageNum._FPDFAvail_IsDocAvail._FPDFAvail_IsFormAvail._FPDFAvail_IsLinearized._FPDFAvail_IsPageAvail._FPDFBitmap_Create._FPDFBitmap_CreateEx._FPDFBitmap_Destroy._FPDFBitmap_FillRect._FPDFBitmap_GetBuffer._FPDFBitmap_GetFormat._FPDFBitmap_GetHeight._FPDFBitmap_GetStride._FPDFBitmap_GetWidth._FPDFBookmark_Find._FPDFBookmark_GetAction._FPDFBookmark_GetCount._FPDFBookmark_GetDest._FPDFBookmark_GetFirstChild._FPDFBookmark_GetNextSibling._FPDFBookmark_GetTitle._FPDFCatalog_GetLanguage._FPDFCatalog_IsTagged._FPDFCatalog_SetLanguage._FPDFClipPath_CountPaths._FPDFClipPath_CountPathSegments._FPDFClipPath_GetPathSegment._FPDFDest_GetDestPageIndex._FPDFDest_GetLocationInPage._FPDFDest_GetView._FPDFDoc_AddAttachment._FPDFDoc_CloseJavaScriptAction._FPDFDoc_DeleteAttachment._FPDFDOC_ExitFormFillEnvironment._FPDFDoc_GetAttachment._FPDFDoc_GetAttachmentCount._FPDFDoc_GetJavaScriptAction._FPDFDoc_GetJavaScriptActionCount._FPDFDoc_GetPageMode._FPDFDOC_InitFormFillEnvironment._FPDFFont_Close._FPDFFont_GetAscent._FPDFFont_GetBaseFontName._FPDFFont_GetDescent._FPDFFont_GetFamilyName._FPDFFont_GetFlags._FPDFFont_GetFontData._FPDFFont_GetGlyphPath._FPDFFont_GetGlyphWidth._FPDFFont_GetIsEmbedded._FPDFFont_GetItalicAngle._FPDFFont_GetWeight._FPDFFormObj_CountObjects._FPDFFormObj_GetObject._FPDFFormObj_RemoveObject._FPDFGlyphPath_CountGlyphSegments._FPDFGlyphPath_GetGlyphPathSegment._FPDFImageObj_GetBitmap._FPDFImageObj_GetIccProfileDataDecoded._FPDFImageObj_GetImageDataDecoded._FPDFImageObj_GetImageDataRaw._FPDFImageObj_GetImageFilter._FPDFImageObj_GetImageFilterCount._FPDFImageObj_GetImageMetadata._FPDFImageObj_GetImagePixelSize._FPDFImageObj_GetRenderedBitmap._FPDFImageObj_LoadJpegFile._FPDFImageObj_LoadJpegFileInline._FPDFImageObj_SetBitmap._FPDFImageObj_SetMatrix._FPDFJavaScriptAction_GetName._FPDFJavaScriptAction_GetScript._FPDFLink_CloseWebLinks._FPDFLink_CountQuadPoints._FPDFLink_CountRects._FPDFLink_CountWebLinks._FPDFLink_Enumerate._FPDFLink_GetAction._FPDFLink_GetAnnot._FPDFLink_GetAnnotRect._FPDFLink_GetDest._FPDFLink_GetLinkAtPoint._FPDFLink_GetLinkZOrderAtPoint._FPDFLink_GetQuadPoints._FPDFLink_GetRect._FPDFLink_GetTextRange._FPDFLink_GetURL._FPDFLink_LoadWebLinks._FPDFPage_CloseAnnot._FPDFPage_CountObjects._FPDFPage_CreateAnnot._FPDFPage_Delete._FPDFPage_Flatten._FPDFPage_FormFieldZOrderAtPoint._FPDFPage_GenerateContent._FPDFPage_GetAnnot._FPDFPage_GetAnnotCount._FPDFPage_GetAnnotIndex._FPDFPage_GetArtBox._FPDFPage_GetBleedBox._FPDFPage_GetCropBox._FPDFPage_GetDecodedThumbnailData._FPDFPage_GetMediaBox._FPDFPage_GetObject._FPDFPage_GetRawThumbnailData._FPDFPage_GetRotation._FPDFPage_GetThumbnailAsBitmap._FPDFPage_GetTrimBox._FPDFPage_HasFormFieldAtPoint._FPDFPage_HasTransparency._FPDFPage_InsertClipPath._FPDFPage_InsertObject._FPDFPage_InsertObjectAtIndex._FPDFPage_New._FPDFPage_RemoveAnnot._FPDFPage_RemoveObject._FPDFPage_SetArtBox._FPDFPage_SetBleedBox._FPDFPage_SetCropBox._FPDFPage_SetMediaBox._FPDFPage_SetRotation._FPDFPage_SetTrimBox._FPDFPage_TransformAnnots._FPDFPage_TransFormWithClip._FPDFPageObj_AddMark._FPDFPageObj_CountMarks._FPDFPageObj_CreateNewPath._FPDFPageObj_CreateNewRect._FPDFPageObj_CreateTextObj._FPDFPageObj_Destroy._FPDFPageObj_GetBounds._FPDFPageObj_GetClipPath._FPDFPageObj_GetDashArray._FPDFPageObj_GetDashCount._FPDFPageObj_GetDashPhase._FPDFPageObj_GetFillColor._FPDFPageObj_GetIsActive._FPDFPageObj_GetLineCap._FPDFPageObj_GetLineJoin._FPDFPageObj_GetMark._FPDFPageObj_GetMarkedContentID._FPDFPageObj_GetMatrix._FPDFPageObj_GetRotatedBounds._FPDFPageObj_GetStrokeColor._FPDFPageObj_GetStrokeWidth._FPDFPageObj_GetType._FPDFPageObj_HasTransparency._FPDFPageObj_NewImageObj._FPDFPageObj_NewTextObj._FPDFPageObj_RemoveMark._FPDFPageObj_SetBlendMode._FPDFPageObj_SetDashArray._FPDFPageObj_SetDashPhase._FPDFPageObj_SetFillColor._FPDFPageObj_SetIsActive._FPDFPageObj_SetLineCap._FPDFPageObj_SetLineJoin._FPDFPageObj_SetMatrix._FPDFPageObj_SetStrokeColor._FPDFPageObj_SetStrokeWidth._FPDFPageObj_Transform._FPDFPageObj_TransformClipPath._FPDFPageObj_TransformF._FPDFPageObjMark_CountParams._FPDFPageObjMark_GetName._FPDFPageObjMark_GetParamBlobValue._FPDFPageObjMark_GetParamFloatValue._FPDFPageObjMark_GetParamIntValue._FPDFPageObjMark_GetParamKey._FPDFPageObjMark_GetParamStringValue._FPDFPageObjMark_GetParamValueType._FPDFPageObjMark_RemoveParam._FPDFPageObjMark_SetBlobParam._FPDFPageObjMark_SetFloatParam._FPDFPageObjMark_SetIntParam._FPDFPageObjMark_SetStringParam._FPDFPath_BezierTo._FPDFPath_Close._FPDFPath_CountSegments._FPDFPath_GetDrawMode._FPDFPath_GetPathSegment._FPDFPath_LineTo._FPDFPath_MoveTo._FPDFPath_SetDrawMode._FPDFPathSegment_GetClose._FPDFPathSegment_GetPoint._FPDFPathSegment_GetType._FPDFSignatureObj_GetByteRange._FPDFSignatureObj_GetContents._FPDFSignatureObj_GetDocMDPPermission._FPDFSignatureObj_GetReason._FPDFSignatureObj_GetSubFilter._FPDFSignatureObj_GetTime._FPDFText_ClosePage._FPDFText_CountChars._FPDFText_CountRects._FPDFText_FindClose._FPDFText_FindNext._FPDFText_FindPrev._FPDFText_FindStart._FPDFText_GetBoundedText._FPDFText_GetCharAngle._FPDFText_GetCharBox._FPDFText_GetCharIndexAtPos._FPDFText_GetCharIndexFromTextIndex._FPDFText_GetCharOrigin._FPDFText_GetFillColor._FPDFText_GetFontInfo._FPDFText_GetFontSize._FPDFText_GetFontWeight._FPDFText_GetLooseCharBox._FPDFText_GetMatrix._FPDFText_GetRect._FPDFText_GetSchCount._FPDFText_GetSchResultIndex._FPDFText_GetStrokeColor._FPDFText_GetText._FPDFText_GetTextIndexFromCharIndex._FPDFText_GetTextObject._FPDFText_GetUnicode._FPDFText_HasUnicodeMapError._FPDFText_IsGenerated._FPDFText_IsHyphen._FPDFText_LoadCidType2Font._FPDFText_LoadFont._FPDFText_LoadPage._FPDFText_LoadStandardFont._FPDFText_SetCharcodes._FPDFText_SetText._FPDFTextObj_GetFont._FPDFTextObj_GetFontSize._FPDFTextObj_GetRenderedBitmap._FPDFTextObj_GetText._FPDFTextObj_GetTextRenderMode._FPDFTextObj_SetTextRenderMode._PDFiumExt_CloseFileWriter._PDFiumExt_CloseFormFillInfo._PDFiumExt_ExitFormFillEnvironment._PDFiumExt_GetFileWriterData._PDFiumExt_GetFileWriterSize._PDFiumExt_Init._PDFiumExt_InitFormFillEnvironment._PDFiumExt_OpenFileWriter._PDFiumExt_OpenFormFillInfo._PDFiumExt_SaveAsCopy._malloc._free._memory.___indirect_function_table.onRuntimeInitialized`.split(`.`).forEach(e=>{Object.getOwnPropertyDescriptor(a,e)||Object.defineProperty(a,e,{get:()=>I(`You are getting `+e+` on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js`),set:()=>I(`You are setting `+e+` on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js`)})});var o=typeof window==`object`,s=typeof importScripts==`function`;typeof process==`object`&&typeof process.versions==`object`&&typeof process.versions.node==`string`&&process.type;var c,l,u=!o&&!s,d=Object.assign({},i),f=`./this.program`,p=``;if(u){if(typeof window==`object`||typeof importScripts==`function`)throw Error(`not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)`);l=e=>{if(typeof readbuffer==`function`)return new Uint8Array(readbuffer(e));let t=read(e,`binary`);return O(typeof t==`object`),t},c=e=>new Promise((t,n)=>{setTimeout(()=>t(l(e)))}),globalThis.clearTimeout??=e=>{},globalThis.setTimeout??=e=>typeof e==`function`?e():I(),typeof print<`u`&&(globalThis.console??={},console.log=print,console.warn=console.error=globalThis.printErr??print)}else{if(!o&&!s)throw Error(`environment detection error`);if(s?p=self.location.href:typeof document<`u`&&document.currentScript&&(p=document.currentScript.src),oe&&(p=oe),p=p.startsWith(`blob:`)?``:p.substr(0,p.replace(/[?#].*/,``).lastIndexOf(`/`)+1),typeof window!=`object`&&typeof importScripts!=`function`)throw Error(`not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)`);s&&(l=e=>{var t=new XMLHttpRequest;return t.open(`GET`,e,!1),t.responseType=`arraybuffer`,t.send(null),new Uint8Array(t.response)}),c=e=>(O(!ue(e),`readAsync does not work with file:// URLs`),fetch(e,{credentials:`same-origin`}).then(e=>e.ok?e.arrayBuffer():Promise.reject(Error(e.status+` : `+e.url))))}var m,h=i.print||console.log.bind(console),g=i.printErr||console.error.bind(console);Object.assign(i,d),d=null,m=`fetchSettings`,Object.getOwnPropertyDescriptor(i,m)&&I(`\`Module.${m}\` was supplied but \`${m}\` not included in INCOMING_MODULE_JS_API`),i.arguments&&i.arguments,me(`arguments`,`arguments_`),i.thisProgram&&(f=i.thisProgram),me(`thisProgram`,`thisProgram`),O(i.memoryInitializerPrefixURL===void 0,`Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead`),O(i.pthreadMainPrefixURL===void 0,`Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead`),O(i.cdInitializerPrefixURL===void 0,`Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead`),O(i.filePackagePrefixURL===void 0,`Module.filePackagePrefixURL option was removed, use Module.locateFile instead`),O(i.read===void 0,`Module.read option was removed`),O(i.readAsync===void 0,`Module.readAsync option was removed (modify readAsync in JS)`),O(i.readBinary===void 0,`Module.readBinary option was removed (modify readBinary in JS)`),O(i.setWindowTitle===void 0,`Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)`),O(i.TOTAL_MEMORY===void 0,`Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY`),me(`asm`,`wasmExports`),me(`readAsync`,`readAsync`),me(`readBinary`,`readBinary`),me(`setWindowTitle`,`setWindowTitle`);var _,v=i.wasmBinary;me(`wasmBinary`,`wasmBinary`),typeof WebAssembly!=`object`&&g(`no native wasm support detected`);var y,b,x,S,C,w,T,E,D=!1;function O(e,t){e||I(`Assertion failed`+(t?`: `+t:``))}function k(){var e=_.buffer;i.HEAP8=y=new Int8Array(e),i.HEAP16=x=new Int16Array(e),i.HEAPU8=b=new Uint8Array(e),i.HEAPU16=S=new Uint16Array(e),i.HEAP32=C=new Int32Array(e),i.HEAPU32=w=new Uint32Array(e),i.HEAPF32=T=new Float32Array(e),i.HEAPF64=E=new Float64Array(e)}function A(){if(!D){var e=ot();e==0&&(e+=4);var t=w[e>>2],n=w[e+4>>2];t==34821223&&n==2310721022||I(`Stack overflow! Stack cookie has been overwritten at ${H(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${H(n)} ${H(t)}`),w[0]!=1668509029&&I(`Runtime error: The application has corrupted its heap memory area (address zero)!`)}}O(!i.STACK_SIZE,`STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time`),O(typeof Int32Array<`u`&&typeof Float64Array<`u`&&Int32Array.prototype.subarray!=null&&Int32Array.prototype.set!=null,`JS engine does not provide full typed array support`),O(!i.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),O(!i.INITIAL_MEMORY,`Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically`);var ee=[],j=[],te=[],M=!1;function N(e){ee.unshift(e)}function P(e){te.unshift(e)}O(Math.imul,`This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill`),O(Math.fround,`This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill`),O(Math.clz32,`This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill`),O(Math.trunc,`This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill`);var ne=0,F=null,re=null,ie={};function ae(e){for(var t=e;;){if(!ie[e])return e;e=t+Math.random()}}function se(e){ne++,i.monitorRunDependencies?.(ne),e?(O(!ie[e]),ie[e]=1,F===null&&typeof setInterval<`u`&&(F=setInterval(()=>{if(D)return clearInterval(F),void(F=null);var e=!1;for(var t in ie)e||(e=!0,g(`still waiting on run dependencies:`)),g(`dependency: ${t}`);e&&g(`(end of list)`)},1e4))):g(`warning: run dependency added without ID`)}function ce(e){if(ne--,i.monitorRunDependencies?.(ne),e?(O(ie[e]),delete ie[e]):g(`warning: run dependency removed without ID`),ne==0&&(F!==null&&(clearInterval(F),F=null),re)){var t=re;re=null,t()}}function I(e){i.onAbort?.(e),g(e=`Aborted(`+e+`)`),D=!0;var t=new WebAssembly.RuntimeError(e);throw r(t),t}var L,R,z,le=e=>e.startsWith(`data:application/octet-stream;base64,`),ue=e=>e.startsWith(`file://`);function B(e,t){return(...n)=>{O(M,`native function \`${e}\` called before runtime initialization`);var r=Q[e];return O(r,`exported native function \`${e}\` not found`),O(n.length<=t,`native function \`${e}\` called with ${n.length} args but expects ${t}`),r(...n)}}function de(){if(i.locateFile){var e=`pdfium.wasm`;return le(e)?e:(t=e,i.locateFile?i.locateFile(t,p):p+t)}var t;return u?`pdfium.wasm`:new URL(new URL(`pdfium-RAgkpwfK.wasm`,import.meta.url).href,``+import.meta.url).href}function fe(e){if(e==L&&v)return new Uint8Array(v);if(l)return l(e);throw`both async and sync fetching of the wasm failed`}function pe(e,t,n){return function(e){return v?Promise.resolve().then(()=>fe(e)):c(e).then(e=>new Uint8Array(e),()=>fe(e))}(e).then(e=>WebAssembly.instantiate(e,t)).then(n,e=>{g(`failed to asynchronously prepare wasm: ${e}`),ue(L)&&g(`warning: Loading from a file URI (${L}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`),I(e)})}if((()=>{var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,t[0]!==115||t[1]!==99)throw`Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)`})(),i.ENVIRONMENT)throw Error(`Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)`);function me(e,t,n=!0){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get(){I(`\`Module.${e}\` has been replaced by \`${t}\``+(n?` (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)`:``))}})}function he(e){return e===`FS_createPath`||e===`FS_createDataFile`||e===`FS_createPreloadedFile`||e===`FS_unlink`||e===`addRunDependency`||e===`FS_createLazyFile`||e===`FS_createDevice`||e===`removeRunDependency`}function ge(e,t){typeof globalThis>`u`||Object.getOwnPropertyDescriptor(globalThis,e)||Object.defineProperty(globalThis,e,{configurable:!0,get(){t()}})}function _e(e,t){ge(e,()=>{G(`\`${e}\` is not longer defined by emscripten. ${t}`)})}function ve(e){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get(){var t=`'${e}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;he(e)&&(t+=`. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you`),I(t)}})}_e(`buffer`,`Please use HEAP8.buffer or wasmMemory.buffer`),_e(`asm`,`Please use wasmExports instead`);var V=e=>{e.forEach(e=>e(i))};i.noExitRuntime;var H=e=>(O(typeof e==`number`),`0x`+(e>>>=0).toString(16).padStart(8,`0`)),U=e=>st(e),W=()=>lt(),G=e=>{G.shown||={},G.shown[e]||(G.shown[e]=1,g(e))},ye=typeof TextDecoder<`u`?new TextDecoder:void 0,be=(e,t=0,n=NaN)=>{for(var r=t+n,i=t;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&ye)return ye.decode(e.subarray(t,i));for(var a=``;t<i;){var o=e[t++];if(128&o){var s=63&e[t++];if((224&o)!=192){var c=63&e[t++];if((240&o)==224?o=(15&o)<<12|s<<6|c:((248&o)!=240&&G(`Invalid UTF-8 leading byte `+H(o)+` encountered when deserializing a UTF-8 string in wasm memory to a JS string!`),o=(7&o)<<18|s<<12|c<<6|63&e[t++]),o<65536)a+=String.fromCharCode(o);else{var l=o-65536;a+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else a+=String.fromCharCode((31&o)<<6|s)}else a+=String.fromCharCode(o)}return a},xe=(e,t)=>(O(typeof e==`number`,`UTF8ToString expects a number (got ${typeof e})`),e?be(b,e,t):``);function Se(){O(X.varargs!=null);var e=C[X.varargs>>2];return X.varargs+=4,e}var Ce=Se,K={isAbs:e=>e.charAt(0)===`/`,splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];i===`.`?e.splice(r,1):i===`..`?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift(`..`);return e},normalize:e=>{var t=K.isAbs(e),n=e.substr(-1)===`/`;return(e=K.normalizeArray(e.split(`/`).filter(e=>!!e),!t).join(`/`))||t||(e=`.`),e&&n&&(e+=`/`),(t?`/`:``)+e},dirname:e=>{var t=K.splitPath(e),n=t[0],r=t[1];return n||r?(r&&=r.substr(0,r.length-1),n+r):`.`},basename:e=>{if(e===`/`)return`/`;var t=(e=(e=K.normalize(e)).replace(/\/$/,``)).lastIndexOf(`/`);return t===-1?e:e.substr(t+1)},join:(...e)=>K.normalize(e.join(`/`)),join2:(e,t)=>K.normalize(e+`/`+t)},we=e=>(we=(()=>{if(typeof crypto==`object`&&typeof crypto.getRandomValues==`function`)return e=>crypto.getRandomValues(e);I(`no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: (array) => { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };`)})())(e),q={resolve:(...e)=>{for(var t=``,n=!1,r=e.length-1;r>=-1&&!n;r--){var i=r>=0?e[r]:Y.cwd();if(typeof i!=`string`)throw TypeError(`Arguments to path.resolve must be strings`);if(!i)return``;t=i+`/`+t,n=K.isAbs(i)}return(n?`/`:``)+(t=K.normalizeArray(t.split(`/`).filter(e=>!!e),!n).join(`/`))||`.`},relative:(e,t)=>{function n(e){for(var t=0;t<e.length&&e[t]===``;t++);for(var n=e.length-1;n>=0&&e[n]===``;n--);return t>n?[]:e.slice(t,n-t+1)}e=q.resolve(e).substr(1),t=q.resolve(t).substr(1);for(var r=n(e.split(`/`)),i=n(t.split(`/`)),a=Math.min(r.length,i.length),o=a,s=0;s<a;s++)if(r[s]!==i[s]){o=s;break}var c=[];for(s=o;s<r.length;s++)c.push(`..`);return(c=c.concat(i.slice(o))).join(`/`)}},Te=[],Ee=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},De=(e,t,n,r)=>{if(O(typeof e==`string`,`stringToUTF8Array expects a string (got ${typeof e})`),!(r>0))return 0;for(var i=n,a=n+r-1,o=0;o<e.length;++o){var s=e.charCodeAt(o);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),s<=127){if(n>=a)break;t[n++]=s}else if(s<=2047){if(n+1>=a)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(n+2>=a)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(n+3>=a)break;s>1114111&&G(`Invalid Unicode code point `+H(s)+` encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).`),t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}}return t[n]=0,n-i};function Oe(e,t,n){var r=Ee(e)+1,i=Array(r);return i.length=De(e,i,0,i.length),i}var ke,Ae,je={ttys:[],init(){},shutdown(){},register(e,t){je.ttys[e]={input:[],output:[],ops:t},Y.registerDevice(e,je.stream_ops)},stream_ops:{open(e){var t=je.ttys[e.node.rdev];if(!t)throw new Y.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,i){if(!e.tty||!e.tty.ops.get_char)throw new Y.ErrnoError(60);for(var a=0,o=0;o<r;o++){var s;try{s=e.tty.ops.get_char(e.tty)}catch{throw new Y.ErrnoError(29)}if(s===void 0&&a===0)throw new Y.ErrnoError(6);if(s==null)break;a++,t[n+o]=s}return a&&(e.node.timestamp=Date.now()),a},write(e,t,n,r,i){if(!e.tty||!e.tty.ops.put_char)throw new Y.ErrnoError(60);try{for(var a=0;a<r;a++)e.tty.ops.put_char(e.tty,t[n+a])}catch{throw new Y.ErrnoError(29)}return r&&(e.node.timestamp=Date.now()),a}},default_tty_ops:{get_char:e=>(()=>{if(!Te.length){var e=null;if(typeof window<`u`&&typeof window.prompt==`function`?(e=window.prompt(`Input: `))!==null&&(e+=`
2
+ `):typeof readline==`function`&&(e=readline())&&(e+=`
3
+ `),!e)return null;Te=Oe(e)}return Te.shift()})(),put_char(e,t){t===null||t===10?(h(be(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(h(be(e.output)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,n)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){t===null||t===10?(g(be(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(g(be(e.output)),e.output=[])}}},Me=(e,t)=>(O(t,`alignment argument is required`),Math.ceil(e/t)*t),Ne=e=>{e=Me(e,65536);var t=it(65536,e);return t&&((e,t)=>{b.fill(0,e,e+t)})(t,e),t},J={ops_table:null,mount:e=>J.createNode(null,`/`,16895,0),createNode(e,t,n,r){if(Y.isBlkdev(n)||Y.isFIFO(n))throw new Y.ErrnoError(63);J.ops_table||={dir:{node:{getattr:J.node_ops.getattr,setattr:J.node_ops.setattr,lookup:J.node_ops.lookup,mknod:J.node_ops.mknod,rename:J.node_ops.rename,unlink:J.node_ops.unlink,rmdir:J.node_ops.rmdir,readdir:J.node_ops.readdir,symlink:J.node_ops.symlink},stream:{llseek:J.stream_ops.llseek}},file:{node:{getattr:J.node_ops.getattr,setattr:J.node_ops.setattr},stream:{llseek:J.stream_ops.llseek,read:J.stream_ops.read,write:J.stream_ops.write,allocate:J.stream_ops.allocate,mmap:J.stream_ops.mmap,msync:J.stream_ops.msync}},link:{node:{getattr:J.node_ops.getattr,setattr:J.node_ops.setattr,readlink:J.node_ops.readlink},stream:{}},chrdev:{node:{getattr:J.node_ops.getattr,setattr:J.node_ops.setattr},stream:Y.chrdev_stream_ops}};var i=Y.createNode(e,t,n,r);return Y.isDir(i.mode)?(i.node_ops=J.ops_table.dir.node,i.stream_ops=J.ops_table.dir.stream,i.contents={}):Y.isFile(i.mode)?(i.node_ops=J.ops_table.file.node,i.stream_ops=J.ops_table.file.stream,i.usedBytes=0,i.contents=null):Y.isLink(i.mode)?(i.node_ops=J.ops_table.link.node,i.stream_ops=J.ops_table.link.stream):Y.isChrdev(i.mode)&&(i.node_ops=J.ops_table.chrdev.node,i.stream_ops=J.ops_table.chrdev.stream),i.timestamp=Date.now(),e&&(e.contents[t]=i,e.timestamp=i.timestamp),i},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array,expandFileStorage(e,t){var n=e.contents?e.contents.length:0;if(!(n>=t)){t=Math.max(t,n*(n<1048576?2:1.125)>>>0),n!=0&&(t=Math.max(t,256));var r=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(r.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t){if(t==0)e.contents=null,e.usedBytes=0;else{var n=e.contents;e.contents=new Uint8Array(t),n&&e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}}},node_ops:{getattr(e){var t={};return t.dev=Y.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,t.size=Y.isDir(e.mode)?4096:Y.isFile(e.mode)?e.usedBytes:Y.isLink(e.mode)?e.link.length:0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){t.mode!==void 0&&(e.mode=t.mode),t.timestamp!==void 0&&(e.timestamp=t.timestamp),t.size!==void 0&&J.resizeFileStorage(e,t.size)},lookup(e,t){throw Y.genericErrors[44]},mknod:(e,t,n,r)=>J.createNode(e,t,n,r),rename(e,t,n){if(Y.isDir(e.mode)){var r;try{r=Y.lookupNode(t,n)}catch{}if(r)for(var i in r.contents)throw new Y.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=n,t.contents[n]=e,t.timestamp=e.parent.timestamp},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){for(var n in Y.lookupNode(e,t).contents)throw new Y.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[`.`,`..`];for(var n of Object.keys(e.contents))t.push(n);return t},symlink(e,t,n){var r=J.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!Y.isLink(e.mode))throw new Y.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,i){var a=e.node.contents;if(i>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-i,r);if(O(o>=0),o>8&&a.subarray)t.set(a.subarray(i,i+o),n);else for(var s=0;s<o;s++)t[n+s]=a[i+s];return o},write(e,t,n,r,i,a){if(O(!(t instanceof ArrayBuffer)),t.buffer===y.buffer&&(a=!1),!r)return 0;var o=e.node;if(o.timestamp=Date.now(),t.subarray&&(!o.contents||o.contents.subarray)){if(a)return O(i===0,`canOwn must imply no weird position inside the file`),o.contents=t.subarray(n,n+r),o.usedBytes=r,r;if(o.usedBytes===0&&i===0)return o.contents=t.slice(n,n+r),o.usedBytes=r,r;if(i+r<=o.usedBytes)return o.contents.set(t.subarray(n,n+r),i),r}if(J.expandFileStorage(o,i+r),o.contents.subarray&&t.subarray)o.contents.set(t.subarray(n,n+r),i);else for(var s=0;s<r;s++)o.contents[i+s]=t[n+s];return o.usedBytes=Math.max(o.usedBytes,i+r),r},llseek(e,t,n){var r=t;if(n===1?r+=e.position:n===2&&Y.isFile(e.node.mode)&&(r+=e.node.usedBytes),r<0)throw new Y.ErrnoError(28);return r},allocate(e,t,n){J.expandFileStorage(e.node,t+n),e.node.usedBytes=Math.max(e.node.usedBytes,t+n)},mmap(e,t,n,r,i){if(!Y.isFile(e.node.mode))throw new Y.ErrnoError(43);var a,o,s=e.node.contents;if(2&i||!s||s.buffer!==y.buffer){if(o=!0,!(a=Ne(t)))throw new Y.ErrnoError(48);s&&((n>0||n+t<s.length)&&(s=s.subarray?s.subarray(n,n+t):Array.prototype.slice.call(s,n,n+t)),y.set(s,a))}else o=!1,a=s.byteOffset;return{ptr:a,allocated:o}},msync:(e,t,n,r,i)=>(J.stream_ops.write(e,t,0,r,n,!1),0)}},Pe=i.preloadPlugins||[],Fe=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},Ie={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},Y={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:`/`,initialized:!1,ignorePermissions:!0,ErrnoError:class extends Error{constructor(e){for(var t in super(M?(e=>xe(nt(e)))(e):``),this.name=`ErrnoError`,this.errno=e,Ie)if(Ie[t]===e){this.code=t;break}}},genericErrors:{},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(e){this.node=e}get isRead(){return(2097155&this.flags)!=1}get isWrite(){return!!(2097155&this.flags)}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,t,n,r){e||=this,this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Y.nextInode++,this.name=t,this.mode=n,this.node_ops={},this.stream_ops={},this.rdev=r,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return Y.isDir(this.mode)}get isDevice(){return Y.isChrdev(this.mode)}},lookupPath(e,t={}){if(!(e=q.resolve(e)))return{path:``,node:null};if((t=Object.assign({follow_mount:!0,recurse_count:0},t)).recurse_count>8)throw new Y.ErrnoError(32);for(var n=e.split(`/`).filter(e=>!!e),r=Y.root,i=`/`,a=0;a<n.length;a++){var o=a===n.length-1;if(o&&t.parent)break;if(r=Y.lookupNode(r,n[a]),i=K.join2(i,n[a]),Y.isMountpoint(r)&&(!o||o&&t.follow_mount)&&(r=r.mounted.root),!o||t.follow)for(var s=0;Y.isLink(r.mode);){var c=Y.readlink(i);if(i=q.resolve(K.dirname(i),c),r=Y.lookupPath(i,{recurse_count:t.recurse_count+1}).node,s++>40)throw new Y.ErrnoError(32)}}return{path:i,node:r}},getPath(e){for(var t;;){if(Y.isRoot(e)){var n=e.mount.mountpoint;return t?n[n.length-1]===`/`?n+t:`${n}/${t}`:n}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r)|0;return(e+n>>>0)%Y.nameTable.length},hashAddNode(e){var t=Y.hashName(e.parent.id,e.name);e.name_next=Y.nameTable[t],Y.nameTable[t]=e},hashRemoveNode(e){var t=Y.hashName(e.parent.id,e.name);if(Y.nameTable[t]===e)Y.nameTable[t]=e.name_next;else for(var n=Y.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=Y.mayLookup(e);if(n)throw new Y.ErrnoError(n);for(var r=Y.hashName(e.id,t),i=Y.nameTable[r];i;i=i.name_next){var a=i.name;if(i.parent.id===e.id&&a===t)return i}return Y.lookup(e,t)},createNode(e,t,n,r){O(typeof e==`object`);var i=new Y.FSNode(e,t,n,r);return Y.hashAddNode(i),i},destroyNode(e){Y.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>(61440&e)==32768,isDir:e=>(61440&e)==16384,isLink:e=>(61440&e)==40960,isChrdev:e=>(61440&e)==8192,isBlkdev:e=>(61440&e)==24576,isFIFO:e=>(61440&e)==4096,isSocket:e=>!(49152&~e),flagsToPermissionString(e){var t=[`r`,`w`,`rw`][3&e];return 512&e&&(t+=`w`),t},nodePermissions:(e,t)=>Y.ignorePermissions||(!t.includes(`r`)||292&e.mode)&&(!t.includes(`w`)||146&e.mode)&&(!t.includes(`x`)||73&e.mode)?0:2,mayLookup(e){return Y.isDir(e.mode)?Y.nodePermissions(e,`x`)||(e.node_ops.lookup?0:2):54},mayCreate(e,t){try{return Y.lookupNode(e,t),20}catch{}return Y.nodePermissions(e,`wx`)},mayDelete(e,t,n){var r;try{r=Y.lookupNode(e,t)}catch(e){return e.errno}var i=Y.nodePermissions(e,`wx`);if(i)return i;if(n){if(!Y.isDir(r.mode))return 54;if(Y.isRoot(r)||Y.getPath(r)===Y.cwd())return 10}else if(Y.isDir(r.mode))return 31;return 0},mayOpen:(e,t)=>e?Y.isLink(e.mode)?32:Y.isDir(e.mode)&&(Y.flagsToPermissionString(t)!==`r`||512&t)?31:Y.nodePermissions(e,Y.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Y.MAX_OPEN_FDS;e++)if(!Y.streams[e])return e;throw new Y.ErrnoError(33)},getStreamChecked(e){var t=Y.getStream(e);if(!t)throw new Y.ErrnoError(8);return t},getStream:e=>Y.streams[e],createStream:(e,t=-1)=>(O(t>=-1),e=Object.assign(new Y.FSStream,e),t==-1&&(t=Y.nextfd()),e.fd=t,Y.streams[t]=e,e),closeStream(e){Y.streams[e]=null},dupStream(e,t=-1){var n=Y.createStream(e,t);return n.stream_ops?.dup?.(n),n},chrdev_stream_ops:{open(e){e.stream_ops=Y.getDevice(e.node.rdev).stream_ops,e.stream_ops.open?.(e)},llseek(){throw new Y.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Y.devices[e]={stream_ops:t}},getDevice:e=>Y.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){typeof e==`function`&&(t=e,e=!1),Y.syncFSRequests++,Y.syncFSRequests>1&&g(`warning: ${Y.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=Y.getMounts(Y.root.mount),r=0;function i(e){return O(Y.syncFSRequests>0),Y.syncFSRequests--,t(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,i(e));++r>=n.length&&i(null)}n.forEach(t=>{if(!t.type.syncfs)return a(null);t.type.syncfs(t,e,a)})},mount(e,t,n){if(typeof e==`string`)throw e;var r,i=n===`/`,a=!n;if(i&&Y.root)throw new Y.ErrnoError(10);if(!i&&!a){var o=Y.lookupPath(n,{follow_mount:!1});if(n=o.path,r=o.node,Y.isMountpoint(r))throw new Y.ErrnoError(10);if(!Y.isDir(r.mode))throw new Y.ErrnoError(54)}var s={type:e,opts:t,mountpoint:n,mounts:[]},c=e.mount(s);return c.mount=s,s.root=c,i?Y.root=c:r&&(r.mounted=s,r.mount&&r.mount.mounts.push(s)),c},unmount(e){var t=Y.lookupPath(e,{follow_mount:!1});if(!Y.isMountpoint(t.node))throw new Y.ErrnoError(28);var n=t.node,r=n.mounted,i=Y.getMounts(r);Object.keys(Y.nameTable).forEach(e=>{for(var t=Y.nameTable[e];t;){var n=t.name_next;i.includes(t.mount)&&Y.destroyNode(t),t=n}}),n.mounted=null;var a=n.mount.mounts.indexOf(r);O(a!==-1),n.mount.mounts.splice(a,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,n){var r=Y.lookupPath(e,{parent:!0}).node,i=K.basename(e);if(!i||i===`.`||i===`..`)throw new Y.ErrnoError(28);var a=Y.mayCreate(r,i);if(a)throw new Y.ErrnoError(a);if(!r.node_ops.mknod)throw new Y.ErrnoError(63);return r.node_ops.mknod(r,i,t,n)},create:(e,t)=>(t=t===void 0?438:t,t&=4095,t|=32768,Y.mknod(e,t,0)),mkdir:(e,t)=>(t=t===void 0?511:t,t&=1023,t|=16384,Y.mknod(e,t,0)),mkdirTree(e,t){for(var n=e.split(`/`),r=``,i=0;i<n.length;++i)if(n[i]){r+=`/`+n[i];try{Y.mkdir(r,t)}catch(e){if(e.errno!=20)throw e}}},mkdev:(e,t,n)=>(n===void 0&&(n=t,t=438),t|=8192,Y.mknod(e,t,n)),symlink(e,t){if(!q.resolve(e))throw new Y.ErrnoError(44);var n=Y.lookupPath(t,{parent:!0}).node;if(!n)throw new Y.ErrnoError(44);var r=K.basename(t),i=Y.mayCreate(n,r);if(i)throw new Y.ErrnoError(i);if(!n.node_ops.symlink)throw new Y.ErrnoError(63);return n.node_ops.symlink(n,r,e)},rename(e,t){var n,r,i=K.dirname(e),a=K.dirname(t),o=K.basename(e),s=K.basename(t);if(n=Y.lookupPath(e,{parent:!0}).node,r=Y.lookupPath(t,{parent:!0}).node,!n||!r)throw new Y.ErrnoError(44);if(n.mount!==r.mount)throw new Y.ErrnoError(75);var c,l=Y.lookupNode(n,o),u=q.relative(e,a);if(u.charAt(0)!==`.`)throw new Y.ErrnoError(28);if((u=q.relative(t,i)).charAt(0)!==`.`)throw new Y.ErrnoError(55);try{c=Y.lookupNode(r,s)}catch{}if(l!==c){var d=Y.isDir(l.mode),f=Y.mayDelete(n,o,d);if(f||=c?Y.mayDelete(r,s,d):Y.mayCreate(r,s))throw new Y.ErrnoError(f);if(!n.node_ops.rename)throw new Y.ErrnoError(63);if(Y.isMountpoint(l)||c&&Y.isMountpoint(c))throw new Y.ErrnoError(10);if(r!==n&&(f=Y.nodePermissions(n,`w`)))throw new Y.ErrnoError(f);Y.hashRemoveNode(l);try{n.node_ops.rename(l,r,s),l.parent=r}catch(e){throw e}finally{Y.hashAddNode(l)}}},rmdir(e){var t=Y.lookupPath(e,{parent:!0}).node,n=K.basename(e),r=Y.lookupNode(t,n),i=Y.mayDelete(t,n,!0);if(i)throw new Y.ErrnoError(i);if(!t.node_ops.rmdir)throw new Y.ErrnoError(63);if(Y.isMountpoint(r))throw new Y.ErrnoError(10);t.node_ops.rmdir(t,n),Y.destroyNode(r)},readdir(e){var t=Y.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new Y.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=Y.lookupPath(e,{parent:!0}).node;if(!t)throw new Y.ErrnoError(44);var n=K.basename(e),r=Y.lookupNode(t,n),i=Y.mayDelete(t,n,!1);if(i)throw new Y.ErrnoError(i);if(!t.node_ops.unlink)throw new Y.ErrnoError(63);if(Y.isMountpoint(r))throw new Y.ErrnoError(10);t.node_ops.unlink(t,n),Y.destroyNode(r)},readlink(e){var t=Y.lookupPath(e).node;if(!t)throw new Y.ErrnoError(44);if(!t.node_ops.readlink)throw new Y.ErrnoError(28);return q.resolve(Y.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var n=Y.lookupPath(e,{follow:!t}).node;if(!n)throw new Y.ErrnoError(44);if(!n.node_ops.getattr)throw new Y.ErrnoError(63);return n.node_ops.getattr(n)},lstat:e=>Y.stat(e,!0),chmod(e,t,n){var r;if(!(r=typeof e==`string`?Y.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new Y.ErrnoError(63);r.node_ops.setattr(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})},lchmod(e,t){Y.chmod(e,t,!0)},fchmod(e,t){var n=Y.getStreamChecked(e);Y.chmod(n.node,t)},chown(e,t,n,r){var i;if(!(i=typeof e==`string`?Y.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new Y.ErrnoError(63);i.node_ops.setattr(i,{timestamp:Date.now()})},lchown(e,t,n){Y.chown(e,t,n,!0)},fchown(e,t,n){var r=Y.getStreamChecked(e);Y.chown(r.node,t,n)},truncate(e,t){if(t<0)throw new Y.ErrnoError(28);var n;if(!(n=typeof e==`string`?Y.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new Y.ErrnoError(63);if(Y.isDir(n.mode))throw new Y.ErrnoError(31);if(!Y.isFile(n.mode))throw new Y.ErrnoError(28);var r=Y.nodePermissions(n,`w`);if(r)throw new Y.ErrnoError(r);n.node_ops.setattr(n,{size:t,timestamp:Date.now()})},ftruncate(e,t){var n=Y.getStreamChecked(e);if(!(2097155&n.flags))throw new Y.ErrnoError(28);Y.truncate(n.node,t)},utime(e,t,n){var r=Y.lookupPath(e,{follow:!0}).node;r.node_ops.setattr(r,{timestamp:Math.max(t,n)})},open(e,t,n){if(e===``)throw new Y.ErrnoError(44);var r;if(n=64&(t=typeof t==`string`?(e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(t===void 0)throw Error(`Unknown file open mode: ${e}`);return t})(t):t)?4095&(n=n===void 0?438:n)|32768:0,typeof e==`object`)r=e;else{e=K.normalize(e);try{r=Y.lookupPath(e,{follow:!(131072&t)}).node}catch{}}var a=!1;if(64&t){if(r){if(128&t)throw new Y.ErrnoError(20)}else r=Y.mknod(e,n,0),a=!0}if(!r)throw new Y.ErrnoError(44);if(Y.isChrdev(r.mode)&&(t&=-513),65536&t&&!Y.isDir(r.mode))throw new Y.ErrnoError(54);if(!a){var o=Y.mayOpen(r,t);if(o)throw new Y.ErrnoError(o)}512&t&&!a&&Y.truncate(r,0),t&=-131713;var s=Y.createStream({node:r,path:Y.getPath(r),flags:t,seekable:!0,position:0,stream_ops:r.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!i.logReadFiles||1&t||e in Y.readFiles||(Y.readFiles[e]=1),s},close(e){if(Y.isClosed(e))throw new Y.ErrnoError(8);e.getdents&&=null;try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Y.closeStream(e.fd)}e.fd=null},isClosed:e=>e.fd===null,llseek(e,t,n){if(Y.isClosed(e))throw new Y.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Y.ErrnoError(70);if(n!=0&&n!=1&&n!=2)throw new Y.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,i){if(O(n>=0),r<0||i<0)throw new Y.ErrnoError(28);if(Y.isClosed(e)||(2097155&e.flags)==1)throw new Y.ErrnoError(8);if(Y.isDir(e.node.mode))throw new Y.ErrnoError(31);if(!e.stream_ops.read)throw new Y.ErrnoError(28);var a=i!==void 0;if(a){if(!e.seekable)throw new Y.ErrnoError(70)}else i=e.position;var o=e.stream_ops.read(e,t,n,r,i);return a||(e.position+=o),o},write(e,t,n,r,i,a){if(O(n>=0),r<0||i<0)throw new Y.ErrnoError(28);if(Y.isClosed(e)||!(2097155&e.flags))throw new Y.ErrnoError(8);if(Y.isDir(e.node.mode))throw new Y.ErrnoError(31);if(!e.stream_ops.write)throw new Y.ErrnoError(28);e.seekable&&1024&e.flags&&Y.llseek(e,0,2);var o=i!==void 0;if(o){if(!e.seekable)throw new Y.ErrnoError(70)}else i=e.position;var s=e.stream_ops.write(e,t,n,r,i,a);return o||(e.position+=s),s},allocate(e,t,n){if(Y.isClosed(e))throw new Y.ErrnoError(8);if(t<0||n<=0)throw new Y.ErrnoError(28);if(!(2097155&e.flags))throw new Y.ErrnoError(8);if(!Y.isFile(e.node.mode)&&!Y.isDir(e.node.mode))throw new Y.ErrnoError(43);if(!e.stream_ops.allocate)throw new Y.ErrnoError(138);e.stream_ops.allocate(e,t,n)},mmap(e,t,n,r,i){if(2&r&&!(2&i)&&(2097155&e.flags)!=2||(2097155&e.flags)==1)throw new Y.ErrnoError(2);if(!e.stream_ops.mmap)throw new Y.ErrnoError(43);if(!t)throw new Y.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,i)},msync:(e,t,n,r,i)=>(O(n>=0),e.stream_ops.msync?e.stream_ops.msync(e,t,n,r,i):0),ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new Y.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||`binary`,t.encoding!==`utf8`&&t.encoding!==`binary`)throw Error(`Invalid encoding type "${t.encoding}"`);var n,r=Y.open(e,t.flags),i=Y.stat(e).size,a=new Uint8Array(i);return Y.read(r,a,0,i,0),t.encoding===`utf8`?n=be(a):t.encoding===`binary`&&(n=a),Y.close(r),n},writeFile(e,t,n={}){n.flags=n.flags||577;var r=Y.open(e,n.flags,n.mode);if(typeof t==`string`){var i=new Uint8Array(Ee(t)+1),a=De(t,i,0,i.length);Y.write(r,i,0,a,void 0,n.canOwn)}else{if(!ArrayBuffer.isView(t))throw Error(`Unsupported data type`);Y.write(r,t,0,t.byteLength,void 0,n.canOwn)}Y.close(r)},cwd:()=>Y.currentPath,chdir(e){var t=Y.lookupPath(e,{follow:!0});if(t.node===null)throw new Y.ErrnoError(44);if(!Y.isDir(t.node.mode))throw new Y.ErrnoError(54);var n=Y.nodePermissions(t.node,`x`);if(n)throw new Y.ErrnoError(n);Y.currentPath=t.path},createDefaultDirectories(){Y.mkdir(`/tmp`),Y.mkdir(`/home`),Y.mkdir(`/home/web_user`)},createDefaultDevices(){Y.mkdir(`/dev`),Y.registerDevice(Y.makedev(1,3),{read:()=>0,write:(e,t,n,r,i)=>r}),Y.mkdev(`/dev/null`,Y.makedev(1,3)),je.register(Y.makedev(5,0),je.default_tty_ops),je.register(Y.makedev(6,0),je.default_tty1_ops),Y.mkdev(`/dev/tty`,Y.makedev(5,0)),Y.mkdev(`/dev/tty1`,Y.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(t===0&&(t=we(e).byteLength),e[--t]);Y.createDevice(`/dev`,`random`,n),Y.createDevice(`/dev`,`urandom`,n),Y.mkdir(`/dev/shm`),Y.mkdir(`/dev/shm/tmp`)},createSpecialDirectories(){Y.mkdir(`/proc`);var e=Y.mkdir(`/proc/self`);Y.mkdir(`/proc/self/fd`),Y.mount({mount(){var t=Y.createNode(e,`fd`,16895,73);return t.node_ops={lookup(e,t){var n=+t,r=Y.getStreamChecked(n),i={parent:null,mount:{mountpoint:`fake`},node_ops:{readlink:()=>r.path}};return i.parent=i,i}},t}},{},`/proc/self/fd`)},createStandardStreams(e,t,n){e?Y.createDevice(`/dev`,`stdin`,e):Y.symlink(`/dev/tty`,`/dev/stdin`),t?Y.createDevice(`/dev`,`stdout`,null,t):Y.symlink(`/dev/tty`,`/dev/stdout`),n?Y.createDevice(`/dev`,`stderr`,null,n):Y.symlink(`/dev/tty1`,`/dev/stderr`);var r=Y.open(`/dev/stdin`,0),i=Y.open(`/dev/stdout`,1),a=Y.open(`/dev/stderr`,1);O(r.fd===0,`invalid handle for stdin (${r.fd})`),O(i.fd===1,`invalid handle for stdout (${i.fd})`),O(a.fd===2,`invalid handle for stderr (${a.fd})`)},staticInit(){[44].forEach(e=>{Y.genericErrors[e]=new Y.ErrnoError(e),Y.genericErrors[e].stack=`<generic error, no stack>`}),Y.nameTable=Array(4096),Y.mount(J,{},`/`),Y.createDefaultDirectories(),Y.createDefaultDevices(),Y.createSpecialDirectories(),Y.filesystems={MEMFS:J}},init(e,t,n){O(!Y.initialized,`FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)`),Y.initialized=!0,e??=i.stdin,t??=i.stdout,n??=i.stderr,Y.createStandardStreams(e,t,n)},quit(){Y.initialized=!1,rt(0);for(var e=0;e<Y.streams.length;e++){var t=Y.streams[e];t&&Y.close(t)}},findObject(e,t){var n=Y.analyzePath(e,t);return n.exists?n.object:null},analyzePath(e,t){try{e=(r=Y.lookupPath(e,{follow:!t})).path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var r=Y.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=r.path,n.parentObject=r.node,n.name=K.basename(e),r=Y.lookupPath(e,{follow:!t}),n.exists=!0,n.path=r.path,n.object=r.node,n.name=r.node.name,n.isRoot=r.path===`/`}catch(e){n.error=e.errno}return n},createPath(e,t,n,r){e=typeof e==`string`?e:Y.getPath(e);for(var i=t.split(`/`).reverse();i.length;){var a=i.pop();if(a){var o=K.join2(e,a);try{Y.mkdir(o)}catch{}e=o}}return o},createFile(e,t,n,r,i){var a=K.join2(typeof e==`string`?e:Y.getPath(e),t),o=Fe(r,i);return Y.create(a,o)},createDataFile(e,t,n,r,i,a){var o=t;e&&(e=typeof e==`string`?e:Y.getPath(e),o=t?K.join2(e,t):e);var s=Fe(r,i),c=Y.create(o,s);if(n){if(typeof n==`string`){for(var l=Array(n.length),u=0,d=n.length;u<d;++u)l[u]=n.charCodeAt(u);n=l}Y.chmod(c,146|s);var f=Y.open(c,577);Y.write(f,n,0,n.length,0,a),Y.close(f),Y.chmod(c,s)}},createDevice(e,t,n,r){var i=K.join2(typeof e==`string`?e:Y.getPath(e),t),a=Fe(!!n,!!r);Y.createDevice.major??=64;var o=Y.makedev(Y.createDevice.major++,0);return Y.registerDevice(o,{open(e){e.seekable=!1},close(e){r?.buffer?.length&&r(10)},read(e,t,r,i,a){for(var o=0,s=0;s<i;s++){var c;try{c=n()}catch{throw new Y.ErrnoError(29)}if(c===void 0&&o===0)throw new Y.ErrnoError(6);if(c==null)break;o++,t[r+s]=c}return o&&(e.node.timestamp=Date.now()),o},write(e,t,n,i,a){for(var o=0;o<i;o++)try{r(t[n+o])}catch{throw new Y.ErrnoError(29)}return i&&(e.node.timestamp=Date.now()),o}}),Y.mkdev(i,a,o)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<`u`)throw Error(`Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.`);try{e.contents=l(e.url),e.usedBytes=e.contents.length}catch{throw new Y.ErrnoError(29)}},createLazyFile(e,t,n,r,i){class a{constructor(){this.lengthKnown=!1,this.chunks=[]}get(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,n=e/this.chunkSize|0;return this.getter(n)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;if(e.open(`HEAD`,n,!1),e.send(null),!(e.status>=200&&e.status<300||e.status===304))throw Error(`Couldn't load `+n+`. Status: `+e.status);var t,r=Number(e.getResponseHeader(`Content-length`)),i=(t=e.getResponseHeader(`Accept-Ranges`))&&t===`bytes`,a=(t=e.getResponseHeader(`Content-Encoding`))&&t===`gzip`,o=1048576;i||(o=r);var s=this;s.setDataGetter(e=>{var t=e*o,i=(e+1)*o-1;if(i=Math.min(i,r-1),s.chunks[e]===void 0&&(s.chunks[e]=((e,t)=>{if(e>t)throw Error(`invalid range (`+e+`, `+t+`) or no bytes requested!`);if(t>r-1)throw Error(`only `+r+` bytes available! programmer error!`);var i=new XMLHttpRequest;if(i.open(`GET`,n,!1),r!==o&&i.setRequestHeader(`Range`,`bytes=`+e+`-`+t),i.responseType=`arraybuffer`,i.overrideMimeType&&i.overrideMimeType(`text/plain; charset=x-user-defined`),i.send(null),!(i.status>=200&&i.status<300||i.status===304))throw Error(`Couldn't load `+n+`. Status: `+i.status);return i.response===void 0?Oe(i.responseText||``):new Uint8Array(i.response||[])})(t,i)),s.chunks[e]===void 0)throw Error(`doXHR failed!`);return s.chunks[e]}),!a&&r||(o=r=1,r=this.getter(0).length,o=r,h(`LazyFiles on gzip forces download of the whole file when length is accessed`)),this._length=r,this._chunkSize=o,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<`u`){if(!s)throw`Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc`;var o={isDevice:!1,contents:new a}}else o={isDevice:!1,url:n};var c=Y.createFile(e,t,o,r,i);o.contents?c.contents=o.contents:o.url&&(c.contents=null,c.url=o.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var l={};function u(e,t,n,r,i){var a=e.node.contents;if(i>=a.length)return 0;var o=Math.min(a.length-i,r);if(O(o>=0),a.slice)for(var s=0;s<o;s++)t[n+s]=a[i+s];else for(s=0;s<o;s++)t[n+s]=a.get(i+s);return o}return Object.keys(c.stream_ops).forEach(e=>{var t=c.stream_ops[e];l[e]=(...e)=>(Y.forceLoadFile(c),t(...e))}),l.read=(e,t,n,r,i)=>(Y.forceLoadFile(c),u(e,t,n,r,i)),l.mmap=(e,t,n,r,i)=>{Y.forceLoadFile(c);var a=Ne(t);if(!a)throw new Y.ErrnoError(48);return u(e,y,a,t,n),{ptr:a,allocated:!0}},c.stream_ops=l,c},absolutePath(){I(`FS.absolutePath has been removed; use PATH_FS.resolve instead`)},createFolder(){I(`FS.createFolder has been removed; use FS.mkdir instead`)},createLink(){I(`FS.createLink has been removed; use FS.symlink instead`)},joinPath(){I(`FS.joinPath has been removed; use PATH.join instead`)},mmapAlloc(){I(`FS.mmapAlloc has been replaced by the top level function mmapAlloc`)},standardizePath(){I(`FS.standardizePath has been removed; use PATH.normalize instead`)}},X={DEFAULT_POLLMASK:5,calculateAt(e,t,n){if(K.isAbs(t))return t;var r=e===-100?Y.cwd():X.getStreamFromFD(e).path;if(t.length==0){if(!n)throw new Y.ErrnoError(44);return r}return K.join2(r,t)},doStat(e,t,n){var r=e(t);C[n>>2]=r.dev,C[n+4>>2]=r.mode,w[n+8>>2]=r.nlink,C[n+12>>2]=r.uid,C[n+16>>2]=r.gid,C[n+20>>2]=r.rdev,z=[r.size>>>0,(R=r.size,+Math.abs(R)>=1?R>0?Math.floor(R/4294967296)>>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],C[n+24>>2]=z[0],C[n+28>>2]=z[1],C[n+32>>2]=4096,C[n+36>>2]=r.blocks;var i=r.atime.getTime(),a=r.mtime.getTime(),o=r.ctime.getTime();return z=[Math.floor(i/1e3)>>>0,(R=Math.floor(i/1e3),+Math.abs(R)>=1?R>0?Math.floor(R/4294967296)>>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],C[n+40>>2]=z[0],C[n+44>>2]=z[1],w[n+48>>2]=i%1e3*1e3*1e3,z=[Math.floor(a/1e3)>>>0,(R=Math.floor(a/1e3),+Math.abs(R)>=1?R>0?Math.floor(R/4294967296)>>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],C[n+56>>2]=z[0],C[n+60>>2]=z[1],w[n+64>>2]=a%1e3*1e3*1e3,z=[Math.floor(o/1e3)>>>0,(R=Math.floor(o/1e3),+Math.abs(R)>=1?R>0?Math.floor(R/4294967296)>>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],C[n+72>>2]=z[0],C[n+76>>2]=z[1],w[n+80>>2]=o%1e3*1e3*1e3,z=[r.ino>>>0,(R=r.ino,+Math.abs(R)>=1?R>0?Math.floor(R/4294967296)>>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],C[n+88>>2]=z[0],C[n+92>>2]=z[1],0},doMsync(e,t,n,r,i){if(!Y.isFile(t.node.mode))throw new Y.ErrnoError(43);if(2&r)return 0;var a=b.slice(e,e+n);Y.msync(t,a,i,n,r)},getStreamFromFD:e=>Y.getStreamChecked(e),varargs:void 0,getStr:e=>xe(e)},Le=(e,t)=>(O(e==e>>>0||e==(0|e)),O(t===(0|t)),t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN),Re=(e,t,n)=>(O(typeof n==`number`,`stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!`),De(e,b,t,n)),ze=[0,31,60,91,121,152,182,213,244,274,305,335],Be=[0,31,59,90,120,151,181,212,243,273,304,334],Ve=e=>{var t=_.buffer,n=(e-t.byteLength+65535)/65536|0;try{return _.grow(n),k(),1}catch(n){g(`growMemory: Attempted to grow heap from ${t.byteLength} bytes to ${e} bytes, but got error: ${n}`)}},He={},Ue=()=>{if(!Ue.strings){var e={USER:`web_user`,LOGNAME:`web_user`,PATH:`/`,PWD:`/`,HOME:`/home/web_user`,LANG:(typeof navigator==`object`&&navigator.languages&&navigator.languages[0]||`C`).replace(`-`,`_`)+`.UTF-8`,_:f||`./this.program`};for(var t in He)He[t]===void 0?delete e[t]:e[t]=He[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);Ue.strings=n}return Ue.strings},We=[],Z=e=>{var t=We[e];return t||(e>=We.length&&(We.length=e+1),We[e]=t=ke.get(e)),O(ke.get(e)==t,`JavaScript-side Wasm function table mirror is out of date!`),t},Ge=typeof TextDecoder<`u`?new TextDecoder(`utf-16le`):void 0,Ke=(e,t)=>{O(e<16384),e<128?t.push(e):t.push(e%128|128,e>>7)},qe=(e,t)=>{if(O(!t.includes(`j`),`i64 not permitted in function signatures when WASM_BIGINT is disabled`),typeof WebAssembly.Function==`function`)return new WebAssembly.Function((e=>{O(!e.includes(`j`),`i64 not permitted in function signatures when WASM_BIGINT is disabled`);for(var t={i:`i32`,j:`i64`,f:`f32`,d:`f64`,e:`externref`,p:`i32`},n={parameters:[],results:e[0]==`v`?[]:[t[e[0]]]},r=1;r<e.length;++r)O(e[r]in t,`invalid signature char: `+e[r]),n.parameters.push(t[e[r]]);return n})(t),e);var n=[1];((e,t)=>{var n=e.slice(0,1),r=e.slice(1),i={i:127,p:127,j:126,f:125,d:124,e:111};t.push(96),Ke(r.length,t);for(var a=0;a<r.length;++a)O(r[a]in i,`invalid signature char: `+r[a]),t.push(i[r[a]]);n==`v`?t.push(0):t.push(1,i[n])})(t,n);var r=[0,97,115,109,1,0,0,0,1];Ke(n.length,r),r.push(...n),r.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var i=new WebAssembly.Module(new Uint8Array(r));return new WebAssembly.Instance(i,{e:{f:e}}).exports.f},Je=e=>(Ae||(Ae=new WeakMap,((e,t)=>{if(Ae)for(var n=e;n<e+t;n++){var r=Z(n);r&&Ae.set(r,n)}})(0,ke.length)),Ae.get(e)||0),Ye=[],Xe=(e,t)=>{ke.set(e,t),We[e]=ke.get(e)},Ze=e=>ct(e),Qe=(e,t,n,r,a)=>{var o={string:e=>{var t=0;return e!=null&&e!==0&&(t=(e=>{var t=Ee(e)+1,n=Ze(t);return Re(e,n,t),n})(e)),t},array:e=>{var t,n,r=Ze(e.length);return n=r,O((t=e).length>=0,`writeArrayToMemory array must have a length (should be an array or typed array)`),y.set(t,n),r}},s=(e=>{var t=i[`_`+e];return O(t,`Cannot call unknown function `+e+`, make sure it is exported`),t})(e),c=[],l=0;if(O(t!==`array`,`Return type should not be "array".`),r)for(var u=0;u<r.length;u++){var d=o[n[u]];d?(l===0&&(l=W()),c[u]=d(r[u])):c[u]=r[u]}var f=s(...c);return f=function(e){return l!==0&&U(l),function(e){return t===`string`?xe(e):t===`boolean`?!!e:e}(e)}(f)};Y.createPreloadedFile=(e,t,n,r,i,a,o,s,l,u)=>{var d=t?q.resolve(K.join2(e,t)):e,f=ae(`cp ${d}`);function p(n){function c(n){u?.(),s||((e,t,n,r,i,a)=>{Y.createDataFile(e,t,n,r,i,a)})(e,t,n,r,i,l),a?.(),ce(f)}((e,t,n,r)=>{typeof Browser<`u`&&Browser.init();var i=!1;return Pe.forEach(a=>{i||a.canHandle(t)&&(a.handle(e,t,n,r),i=!0)}),i})(n,d,c,()=>{o?.(),ce(f)})||c(n)}se(f),typeof n==`string`?((e,t,n)=>{var r=ae(`al ${e}`);c(e).then(n=>{O(n,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(n)),r&&ce(r)},t=>{if(!n)throw`Loading data file "${e}" failed.`;n()}),r&&se(r)})(n,p,o):p(n)},Y.staticInit();var $e={__assert_fail:(e,t,n,r)=>{I(`Assertion failed: ${xe(e)}, at: `+[t?xe(t):`unknown filename`,n,r?xe(r):`unknown function`])},__syscall_fcntl64:function(e,t,n){X.varargs=n;try{var r=X.getStreamFromFD(e);switch(t){case 0:if((i=Se())<0)return-28;for(;Y.streams[i];)i++;return Y.dupStream(r,i).fd;case 1:case 2:case 13:case 14:return 0;case 3:return r.flags;case 4:var i=Se();return r.flags|=i,0;case 12:return i=Ce(),x[i+0>>1]=2,0}return-28}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}},__syscall_fstat64:function(e,t){try{var n=X.getStreamFromFD(e);return X.doStat(Y.stat,n.path,t)}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}},__syscall_ftruncate64:function(e,t,n){var r=Le(t,n);try{return isNaN(r)?61:(Y.ftruncate(e,r),0)}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}},__syscall_getdents64:function(e,t,n){try{var r=X.getStreamFromFD(e);r.getdents||=Y.readdir(r.path);for(var i=280,a=0,o=Y.llseek(r,0,1),s=Math.floor(o/i);s<r.getdents.length&&a+i<=n;){var c,l,u=r.getdents[s];if(u===`.`)c=r.node.id,l=4;else if(u===`..`)c=Y.lookupPath(r.path,{parent:!0}).node.id,l=4;else{var d=Y.lookupNode(r.node,u);c=d.id,l=Y.isChrdev(d.mode)?2:Y.isDir(d.mode)?4:Y.isLink(d.mode)?10:8}O(c),z=[c>>>0,(R=c,+Math.abs(R)>=1?R>0?Math.floor(R/4294967296)>>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],C[t+a>>2]=z[0],C[t+a+4>>2]=z[1],z=[(s+1)*i>>>0,(R=(s+1)*i,+Math.abs(R)>=1?R>0?Math.floor(R/4294967296)>>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],C[t+a+8>>2]=z[0],C[t+a+12>>2]=z[1],x[t+a+16>>1]=280,y[t+a+18]=l,Re(u,t+a+19,256),a+=i,s+=1}return Y.llseek(r,s*i,0),a}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}},__syscall_ioctl:function(e,t,n){X.varargs=n;try{var r=X.getStreamFromFD(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return r.tty?0:-59;case 21505:if(!r.tty)return-59;if(r.tty.ops.ioctl_tcgets){var i=r.tty.ops.ioctl_tcgets(r),a=Ce();C[a>>2]=i.c_iflag||0,C[a+4>>2]=i.c_oflag||0,C[a+8>>2]=i.c_cflag||0,C[a+12>>2]=i.c_lflag||0;for(var o=0;o<32;o++)y[a+o+17]=i.c_cc[o]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!r.tty)return-59;if(r.tty.ops.ioctl_tcsets){a=Ce();var s=C[a>>2],c=C[a+4>>2],l=C[a+8>>2],u=C[a+12>>2],d=[];for(o=0;o<32;o++)d.push(y[a+o+17]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:s,c_oflag:c,c_cflag:l,c_lflag:u,c_cc:d})}return 0;case 21519:return r.tty?(a=Ce(),C[a>>2]=0,0):-59;case 21520:return r.tty?-28:-59;case 21531:return a=Ce(),Y.ioctl(r,t,a);case 21523:if(!r.tty)return-59;if(r.tty.ops.ioctl_tiocgwinsz){var f=r.tty.ops.ioctl_tiocgwinsz(r.tty);a=Ce(),x[a>>1]=f[0],x[a+2>>1]=f[1]}return 0;default:return-28}}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}},__syscall_lstat64:function(e,t){try{return e=X.getStr(e),X.doStat(Y.lstat,e,t)}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}},__syscall_newfstatat:function(e,t,n,r){try{t=X.getStr(t);var i=256&r,a=4096&r;return O(!(r&=-6401),`unknown flags in __syscall_newfstatat: ${r}`),t=X.calculateAt(e,t,a),X.doStat(i?Y.lstat:Y.stat,t,n)}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}},__syscall_openat:function(e,t,n,r){X.varargs=r;try{t=X.getStr(t),t=X.calculateAt(e,t);var i=r?Se():0;return Y.open(t,n,i).fd}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}},__syscall_rmdir:function(e){try{return e=X.getStr(e),Y.rmdir(e),0}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}},__syscall_stat64:function(e,t){try{return e=X.getStr(e),X.doStat(Y.stat,e,t)}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}},__syscall_unlinkat:function(e,t,n){try{return t=X.getStr(t),t=X.calculateAt(e,t),n===0?Y.unlink(t):n===512?Y.rmdir(t):I(`Invalid flags passed to unlinkat`),0}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}},_abort_js:()=>{I(`native code called abort()`)},_emscripten_memcpy_js:(e,t,n)=>b.copyWithin(e,t,t+n),_emscripten_throw_longjmp:()=>{throw 1/0},_gmtime_js:function(e,t,n){var r=Le(e,t),i=new Date(1e3*r);C[n>>2]=i.getUTCSeconds(),C[n+4>>2]=i.getUTCMinutes(),C[n+8>>2]=i.getUTCHours(),C[n+12>>2]=i.getUTCDate(),C[n+16>>2]=i.getUTCMonth(),C[n+20>>2]=i.getUTCFullYear()-1900,C[n+24>>2]=i.getUTCDay();var a=Date.UTC(i.getUTCFullYear(),0,1,0,0,0,0),o=(i.getTime()-a)/864e5|0;C[n+28>>2]=o},_localtime_js:function(e,t,n){var r=Le(e,t),i=new Date(1e3*r);C[n>>2]=i.getSeconds(),C[n+4>>2]=i.getMinutes(),C[n+8>>2]=i.getHours(),C[n+12>>2]=i.getDate(),C[n+16>>2]=i.getMonth(),C[n+20>>2]=i.getFullYear()-1900,C[n+24>>2]=i.getDay();var a=0|(e=>{var t;return((t=e.getFullYear())%4!=0||t%100==0&&t%400!=0?Be:ze)[e.getMonth()]+e.getDate()-1})(i);C[n+28>>2]=a,C[n+36>>2]=-60*i.getTimezoneOffset();var o=new Date(i.getFullYear(),0,1),s=new Date(i.getFullYear(),6,1).getTimezoneOffset(),c=o.getTimezoneOffset(),l=0|(s!=c&&i.getTimezoneOffset()==Math.min(c,s));C[n+32>>2]=l},_tzset_js:(e,t,n,r)=>{var i=new Date().getFullYear(),a=new Date(i,0,1),o=new Date(i,6,1),s=a.getTimezoneOffset(),c=o.getTimezoneOffset(),l=Math.max(s,c);w[e>>2]=60*l,C[t>>2]=Number(s!=c);var u=e=>{var t=e>=0?`-`:`+`,n=Math.abs(e);return`UTC${t}${String(Math.floor(n/60)).padStart(2,`0`)}${String(n%60).padStart(2,`0`)}`},d=u(s),f=u(c);O(d),O(f),O(Ee(d)<=16,`timezone name truncated to fit in TZNAME_MAX (${d})`),O(Ee(f)<=16,`timezone name truncated to fit in TZNAME_MAX (${f})`),c<s?(Re(d,n,17),Re(f,r,17)):(Re(d,r,17),Re(f,n,17))},emscripten_date_now:()=>Date.now(),emscripten_resize_heap:e=>{var t=b.length;O((e>>>=0)>t);var n=2147483648;if(e>n)return g(`Cannot enlarge memory, requested ${e} bytes, but the limit is 2147483648 bytes!`),!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);i=Math.min(i,e+100663296);var a=Math.min(n,Me(Math.max(e,i),65536));if(Ve(a))return!0}return g(`Failed to grow the heap from ${t} bytes to ${a} bytes, not enough memory!`),!1},environ_get:(e,t)=>{var n=0;return Ue().forEach((r,i)=>{var a=t+n;w[e+4*i>>2]=a,((e,t)=>{for(var n=0;n<e.length;++n)O(e.charCodeAt(n)===(255&e.charCodeAt(n))),y[t++]=e.charCodeAt(n);y[t]=0})(r,a),n+=r.length+1}),0},environ_sizes_get:(e,t)=>{var n=Ue();w[e>>2]=n.length;var r=0;return n.forEach(e=>r+=e.length+1),w[t>>2]=r,0},fd_close:function(e){try{var t=X.getStreamFromFD(e);return Y.close(t),0}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return e.errno}},fd_read:function(e,t,n,r){try{var i=((e,t,n,r)=>{for(var i=0,a=0;a<n;a++){var o=w[t>>2],s=w[t+4>>2];t+=8;var c=Y.read(e,y,o,s,r);if(c<0)return-1;if(i+=c,c<s)break}return i})(X.getStreamFromFD(e),t,n);return w[r>>2]=i,0}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return e.errno}},fd_seek:function(e,t,n,r,i){var a=Le(t,n);try{if(isNaN(a))return 61;var o=X.getStreamFromFD(e);return Y.llseek(o,a,r),z=[o.position>>>0,(R=o.position,+Math.abs(R)>=1?R>0?Math.floor(R/4294967296)>>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],C[i>>2]=z[0],C[i+4>>2]=z[1],o.getdents&&a===0&&r===0&&(o.getdents=null),0}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return e.errno}},fd_sync:function(e){try{var t=X.getStreamFromFD(e);return t.stream_ops?.fsync?t.stream_ops.fsync(t):0}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return e.errno}},fd_write:function(e,t,n,r){try{var i=((e,t,n,r)=>{for(var i=0,a=0;a<n;a++){var o=w[t>>2],s=w[t+4>>2];t+=8;var c=Y.write(e,y,o,s,r);if(c<0)return-1;if(i+=c,c<s)break}return i})(X.getStreamFromFD(e),t,n);return w[r>>2]=i,0}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return e.errno}},invoke_ii:function(e,t){var n=W();try{return Z(e)(t)}catch(e){if(U(n),e!==e+0)throw e;$(1,0)}},invoke_iii:function(e,t,n){var r=W();try{return Z(e)(t,n)}catch(e){if(U(r),e!==e+0)throw e;$(1,0)}},invoke_iiii:function(e,t,n,r){var i=W();try{return Z(e)(t,n,r)}catch(e){if(U(i),e!==e+0)throw e;$(1,0)}},invoke_iiiii:function(e,t,n,r,i){var a=W();try{return Z(e)(t,n,r,i)}catch(e){if(U(a),e!==e+0)throw e;$(1,0)}},invoke_v:function(e){var t=W();try{Z(e)()}catch(e){if(U(t),e!==e+0)throw e;$(1,0)}},invoke_vi:function(e,t){var n=W();try{Z(e)(t)}catch(e){if(U(n),e!==e+0)throw e;$(1,0)}},invoke_vii:function(e,t,n){var r=W();try{Z(e)(t,n)}catch(e){if(U(r),e!==e+0)throw e;$(1,0)}},invoke_viii:function(e,t,n,r){var i=W();try{Z(e)(t,n,r)}catch(e){if(U(i),e!==e+0)throw e;$(1,0)}},invoke_viiii:function(e,t,n,r,i){var a=W();try{Z(e)(t,n,r,i)}catch(e){if(U(a),e!==e+0)throw e;$(1,0)}},invoke_viiiiiiiii:function(e,t,n,r,i,a,o,s,c,l){var u=W();try{Z(e)(t,n,r,i,a,o,s,c,l)}catch(e){if(U(u),e!==e+0)throw e;$(1,0)}}},Q=function(){var e={env:$e,wasi_snapshot_preview1:$e};function t(e,t){var n;return Q=e.exports,i.wasmExports=Q,O(_=Q.memory,`memory not found in wasm exports`),k(),O(ke=Q.__indirect_function_table,`table not found in wasm exports`),n=Q.__wasm_call_ctors,j.unshift(n),ce(`wasm-instantiate`),Q}se(`wasm-instantiate`);var n,a,o,s,c=i;if(i.instantiateWasm)try{return i.instantiateWasm(e,t)}catch(e){g(`Module.instantiateWasm callback failed with error: ${e}`),r(e)}return L??=de(),(n=v,a=L,o=e,s=function(e){O(i===c,`the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?`),c=null,t(e.instance)},n||typeof WebAssembly.instantiateStreaming!=`function`||le(a)||typeof fetch!=`function`?pe(a,o,s):fetch(a,{credentials:`same-origin`}).then(e=>WebAssembly.instantiateStreaming(e,o).then(s,function(e){return g(`wasm streaming compile failed: ${e}`),g(`falling back to ArrayBuffer instantiation`),pe(a,o,s)}))).catch(r),{}}();i._PDFiumExt_Init=B(`PDFiumExt_Init`,0),i._FPDF_InitLibraryWithConfig=B(`FPDF_InitLibraryWithConfig`,1),i._PDFiumExt_OpenFileWriter=B(`PDFiumExt_OpenFileWriter`,0),i._PDFiumExt_GetFileWriterSize=B(`PDFiumExt_GetFileWriterSize`,1),i._PDFiumExt_GetFileWriterData=B(`PDFiumExt_GetFileWriterData`,3),i._PDFiumExt_CloseFileWriter=B(`PDFiumExt_CloseFileWriter`,1),i._PDFiumExt_SaveAsCopy=B(`PDFiumExt_SaveAsCopy`,2),i._FPDF_SaveAsCopy=B(`FPDF_SaveAsCopy`,3),i._PDFiumExt_OpenFormFillInfo=B(`PDFiumExt_OpenFormFillInfo`,0),i._PDFiumExt_CloseFormFillInfo=B(`PDFiumExt_CloseFormFillInfo`,1),i._PDFiumExt_InitFormFillEnvironment=B(`PDFiumExt_InitFormFillEnvironment`,2),i._FPDFDOC_InitFormFillEnvironment=B(`FPDFDOC_InitFormFillEnvironment`,2),i._PDFiumExt_ExitFormFillEnvironment=B(`PDFiumExt_ExitFormFillEnvironment`,1),i._FPDFDOC_ExitFormFillEnvironment=B(`FPDFDOC_ExitFormFillEnvironment`,1),i._EPDFNamedDest_SetDest=B(`EPDFNamedDest_SetDest`,3),i._EPDFNamedDest_Remove=B(`EPDFNamedDest_Remove`,2),i._EPDFDest_CreateView=B(`EPDFDest_CreateView`,4),i._EPDFDest_CreateXYZ=B(`EPDFDest_CreateXYZ`,7),i._EPDFDest_CreateRemoteView=B(`EPDFDest_CreateRemoteView`,5),i._EPDFDest_CreateRemoteXYZ=B(`EPDFDest_CreateRemoteXYZ`,8),i._EPDFAction_CreateGoTo=B(`EPDFAction_CreateGoTo`,2),i._EPDFAction_CreateGoToNamed=B(`EPDFAction_CreateGoToNamed`,2),i._EPDFAction_CreateLaunch=B(`EPDFAction_CreateLaunch`,2),i._EPDFAction_CreateRemoteGoToByName=B(`EPDFAction_CreateRemoteGoToByName`,3),i._EPDFAction_CreateRemoteGoToDest=B(`EPDFAction_CreateRemoteGoToDest`,3),i._EPDFAction_CreateURI=B(`EPDFAction_CreateURI`,2),i._EPDFBookmark_Create=B(`EPDFBookmark_Create`,2),i._EPDFBookmark_Delete=B(`EPDFBookmark_Delete`,2),i._EPDFBookmark_AppendChild=B(`EPDFBookmark_AppendChild`,3),i._EPDFBookmark_InsertAfter=B(`EPDFBookmark_InsertAfter`,4),i._EPDFBookmark_Clear=B(`EPDFBookmark_Clear`,1),i._EPDFBookmark_SetTitle=B(`EPDFBookmark_SetTitle`,2),i._EPDFBookmark_SetDest=B(`EPDFBookmark_SetDest`,3),i._EPDFBookmark_SetAction=B(`EPDFBookmark_SetAction`,3),i._EPDFBookmark_ClearTarget=B(`EPDFBookmark_ClearTarget`,1),i._EPDF_PNG_EncodeRGBA=B(`EPDF_PNG_EncodeRGBA`,6),i._FPDFAnnot_IsSupportedSubtype=B(`FPDFAnnot_IsSupportedSubtype`,1),i._FPDFPage_CreateAnnot=B(`FPDFPage_CreateAnnot`,2),i._FPDFPage_GetAnnotCount=B(`FPDFPage_GetAnnotCount`,1),i._FPDFPage_GetAnnot=B(`FPDFPage_GetAnnot`,2),i._FPDFPage_GetAnnotIndex=B(`FPDFPage_GetAnnotIndex`,2),i._FPDFPage_CloseAnnot=B(`FPDFPage_CloseAnnot`,1),i._FPDFPage_RemoveAnnot=B(`FPDFPage_RemoveAnnot`,2),i._FPDFAnnot_GetSubtype=B(`FPDFAnnot_GetSubtype`,1),i._FPDFAnnot_IsObjectSupportedSubtype=B(`FPDFAnnot_IsObjectSupportedSubtype`,1),i._FPDFAnnot_UpdateObject=B(`FPDFAnnot_UpdateObject`,2),i._FPDFAnnot_AddInkStroke=B(`FPDFAnnot_AddInkStroke`,3),i._FPDFAnnot_RemoveInkList=B(`FPDFAnnot_RemoveInkList`,1),i._FPDFAnnot_AppendObject=B(`FPDFAnnot_AppendObject`,2),i._FPDFAnnot_GetObjectCount=B(`FPDFAnnot_GetObjectCount`,1),i._FPDFAnnot_GetObject=B(`FPDFAnnot_GetObject`,2),i._FPDFAnnot_RemoveObject=B(`FPDFAnnot_RemoveObject`,2),i._FPDFAnnot_SetColor=B(`FPDFAnnot_SetColor`,6),i._FPDFAnnot_GetColor=B(`FPDFAnnot_GetColor`,6),i._FPDFAnnot_HasAttachmentPoints=B(`FPDFAnnot_HasAttachmentPoints`,1),i._FPDFAnnot_SetAttachmentPoints=B(`FPDFAnnot_SetAttachmentPoints`,3),i._FPDFAnnot_AppendAttachmentPoints=B(`FPDFAnnot_AppendAttachmentPoints`,2),i._FPDFAnnot_CountAttachmentPoints=B(`FPDFAnnot_CountAttachmentPoints`,1),i._FPDFAnnot_GetAttachmentPoints=B(`FPDFAnnot_GetAttachmentPoints`,3),i._FPDFAnnot_SetRect=B(`FPDFAnnot_SetRect`,2),i._FPDFAnnot_GetRect=B(`FPDFAnnot_GetRect`,2),i._FPDFAnnot_GetVertices=B(`FPDFAnnot_GetVertices`,3),i._FPDFAnnot_GetInkListCount=B(`FPDFAnnot_GetInkListCount`,1),i._FPDFAnnot_GetInkListPath=B(`FPDFAnnot_GetInkListPath`,4),i._FPDFAnnot_GetLine=B(`FPDFAnnot_GetLine`,3),i._FPDFAnnot_SetBorder=B(`FPDFAnnot_SetBorder`,4),i._FPDFAnnot_GetBorder=B(`FPDFAnnot_GetBorder`,4),i._FPDFAnnot_HasKey=B(`FPDFAnnot_HasKey`,2),i._FPDFAnnot_GetValueType=B(`FPDFAnnot_GetValueType`,2),i._FPDFAnnot_SetStringValue=B(`FPDFAnnot_SetStringValue`,3),i._FPDFAnnot_GetStringValue=B(`FPDFAnnot_GetStringValue`,4),i._FPDFAnnot_GetNumberValue=B(`FPDFAnnot_GetNumberValue`,3),i._EPDFAnnot_SetNumberValue=B(`EPDFAnnot_SetNumberValue`,3),i._FPDFAnnot_SetAP=B(`FPDFAnnot_SetAP`,3),i._FPDFAnnot_GetAP=B(`FPDFAnnot_GetAP`,4),i._FPDFAnnot_GetLinkedAnnot=B(`FPDFAnnot_GetLinkedAnnot`,2),i._FPDFAnnot_GetFlags=B(`FPDFAnnot_GetFlags`,1),i._FPDFAnnot_SetFlags=B(`FPDFAnnot_SetFlags`,2),i._FPDFAnnot_GetFormFieldFlags=B(`FPDFAnnot_GetFormFieldFlags`,2),i._FPDFAnnot_SetFormFieldFlags=B(`FPDFAnnot_SetFormFieldFlags`,3),i._FPDFAnnot_GetFormFieldAtPoint=B(`FPDFAnnot_GetFormFieldAtPoint`,3),i._FPDFAnnot_GetFormFieldName=B(`FPDFAnnot_GetFormFieldName`,4),i._FPDFAnnot_GetFormFieldType=B(`FPDFAnnot_GetFormFieldType`,2),i._FPDFAnnot_GetFormAdditionalActionJavaScript=B(`FPDFAnnot_GetFormAdditionalActionJavaScript`,5),i._FPDFAnnot_GetFormFieldAlternateName=B(`FPDFAnnot_GetFormFieldAlternateName`,4),i._FPDFAnnot_GetFormFieldValue=B(`FPDFAnnot_GetFormFieldValue`,4),i._FPDFAnnot_GetOptionCount=B(`FPDFAnnot_GetOptionCount`,2),i._FPDFAnnot_GetOptionLabel=B(`FPDFAnnot_GetOptionLabel`,5),i._FPDFAnnot_IsOptionSelected=B(`FPDFAnnot_IsOptionSelected`,3),i._FPDFAnnot_GetFontSize=B(`FPDFAnnot_GetFontSize`,3),i._FPDFAnnot_SetFontColor=B(`FPDFAnnot_SetFontColor`,5),i._FPDFAnnot_GetFontColor=B(`FPDFAnnot_GetFontColor`,5),i._FPDFAnnot_IsChecked=B(`FPDFAnnot_IsChecked`,2),i._FPDFAnnot_SetFocusableSubtypes=B(`FPDFAnnot_SetFocusableSubtypes`,3),i._FPDFAnnot_GetFocusableSubtypesCount=B(`FPDFAnnot_GetFocusableSubtypesCount`,1),i._FPDFAnnot_GetFocusableSubtypes=B(`FPDFAnnot_GetFocusableSubtypes`,3),i._FPDFAnnot_GetLink=B(`FPDFAnnot_GetLink`,1),i._FPDFAnnot_GetFormControlCount=B(`FPDFAnnot_GetFormControlCount`,2),i._FPDFAnnot_GetFormControlIndex=B(`FPDFAnnot_GetFormControlIndex`,2),i._FPDFAnnot_GetFormFieldExportValue=B(`FPDFAnnot_GetFormFieldExportValue`,4),i._FPDFAnnot_SetURI=B(`FPDFAnnot_SetURI`,2),i._EPDFAnnot_SetAction=B(`EPDFAnnot_SetAction`,2),i._FPDFAnnot_GetFileAttachment=B(`FPDFAnnot_GetFileAttachment`,1),i._FPDFAnnot_AddFileAttachment=B(`FPDFAnnot_AddFileAttachment`,2),i._EPDFAnnot_SetColor=B(`EPDFAnnot_SetColor`,5),i._EPDFAnnot_GetColor=B(`EPDFAnnot_GetColor`,5),i._EPDFAnnot_ClearColor=B(`EPDFAnnot_ClearColor`,2),i._EPDFAnnot_SetOpacity=B(`EPDFAnnot_SetOpacity`,2),i._EPDFAnnot_GetOpacity=B(`EPDFAnnot_GetOpacity`,2),i._EPDFAnnot_GetBorderEffect=B(`EPDFAnnot_GetBorderEffect`,2),i._EPDFAnnot_SetBorderEffect=B(`EPDFAnnot_SetBorderEffect`,2),i._EPDFAnnot_ClearBorderEffect=B(`EPDFAnnot_ClearBorderEffect`,1),i._EPDFAnnot_GetRectangleDifferences=B(`EPDFAnnot_GetRectangleDifferences`,5),i._EPDFAnnot_SetRectangleDifferences=B(`EPDFAnnot_SetRectangleDifferences`,5),i._EPDFAnnot_ClearRectangleDifferences=B(`EPDFAnnot_ClearRectangleDifferences`,1),i._EPDFAnnot_GetBorderDashPatternCount=B(`EPDFAnnot_GetBorderDashPatternCount`,1),i._EPDFAnnot_GetBorderDashPattern=B(`EPDFAnnot_GetBorderDashPattern`,3),i._EPDFAnnot_SetBorderDashPattern=B(`EPDFAnnot_SetBorderDashPattern`,3),i._EPDFAnnot_GetBorderStyle=B(`EPDFAnnot_GetBorderStyle`,2),i._EPDFAnnot_SetBorderStyle=B(`EPDFAnnot_SetBorderStyle`,3),i._EPDFAnnot_GenerateAppearance=B(`EPDFAnnot_GenerateAppearance`,1),i._EPDFAnnot_GenerateAppearanceWithBlend=B(`EPDFAnnot_GenerateAppearanceWithBlend`,2),i._EPDFAnnot_GetBlendMode=B(`EPDFAnnot_GetBlendMode`,1),i._EPDFAnnot_SetIntent=B(`EPDFAnnot_SetIntent`,2),i._EPDFAnnot_GetIntent=B(`EPDFAnnot_GetIntent`,3),i._EPDFAnnot_GetRichContent=B(`EPDFAnnot_GetRichContent`,3),i._EPDFAnnot_SetLineEndings=B(`EPDFAnnot_SetLineEndings`,3),i._EPDFAnnot_GetLineEndings=B(`EPDFAnnot_GetLineEndings`,3),i._EPDFAnnot_SetVertices=B(`EPDFAnnot_SetVertices`,3),i._EPDFAnnot_SetLine=B(`EPDFAnnot_SetLine`,3),i._EPDFAnnot_SetDefaultAppearance=B(`EPDFAnnot_SetDefaultAppearance`,6),i._EPDFAnnot_GetDefaultAppearance=B(`EPDFAnnot_GetDefaultAppearance`,6),i._EPDFAnnot_SetTextAlignment=B(`EPDFAnnot_SetTextAlignment`,2),i._EPDFAnnot_GetTextAlignment=B(`EPDFAnnot_GetTextAlignment`,1),i._EPDFAnnot_SetVerticalAlignment=B(`EPDFAnnot_SetVerticalAlignment`,2),i._EPDFAnnot_GetVerticalAlignment=B(`EPDFAnnot_GetVerticalAlignment`,1),i._EPDFPage_GetAnnotByName=B(`EPDFPage_GetAnnotByName`,2),i._EPDFPage_RemoveAnnotByName=B(`EPDFPage_RemoveAnnotByName`,2),i._EPDFAnnot_SetLinkedAnnot=B(`EPDFAnnot_SetLinkedAnnot`,3),i._EPDFPage_GetAnnotCountRaw=B(`EPDFPage_GetAnnotCountRaw`,2),i._EPDFPage_GetAnnotRaw=B(`EPDFPage_GetAnnotRaw`,3),i._EPDFPage_RemoveAnnotRaw=B(`EPDFPage_RemoveAnnotRaw`,3),i._EPDFAnnot_SetName=B(`EPDFAnnot_SetName`,2),i._EPDFAnnot_GetName=B(`EPDFAnnot_GetName`,1),i._EPDFAnnot_UpdateAppearanceToRect=B(`EPDFAnnot_UpdateAppearanceToRect`,2),i._EPDFPage_CreateAnnot=B(`EPDFPage_CreateAnnot`,2),i._EPDFAnnot_SetRotate=B(`EPDFAnnot_SetRotate`,2),i._EPDFAnnot_GetRotate=B(`EPDFAnnot_GetRotate`,2),i._EPDFAnnot_GetReplyType=B(`EPDFAnnot_GetReplyType`,1),i._EPDFAnnot_SetReplyType=B(`EPDFAnnot_SetReplyType`,2),i._EPDFAnnot_SetOverlayText=B(`EPDFAnnot_SetOverlayText`,2),i._EPDFAnnot_GetOverlayText=B(`EPDFAnnot_GetOverlayText`,3),i._EPDFAnnot_SetOverlayTextRepeat=B(`EPDFAnnot_SetOverlayTextRepeat`,2),i._EPDFAnnot_GetOverlayTextRepeat=B(`EPDFAnnot_GetOverlayTextRepeat`,1),i._EPDFAnnot_ApplyRedaction=B(`EPDFAnnot_ApplyRedaction`,2),i._EPDFPage_ApplyRedactions=B(`EPDFPage_ApplyRedactions`,1),i._EPDFAnnot_Flatten=B(`EPDFAnnot_Flatten`,2),i._EPDFAnnot_SetAppearanceFromPage=B(`EPDFAnnot_SetAppearanceFromPage`,3),i._EPDFAnnot_ExportAppearanceAsDocument=B(`EPDFAnnot_ExportAppearanceAsDocument`,1),i._EPDFAnnot_ExportMultipleAppearancesAsDocument=B(`EPDFAnnot_ExportMultipleAppearancesAsDocument`,2),i._EPDFAnnot_SetExtendedRotation=B(`EPDFAnnot_SetExtendedRotation`,2),i._EPDFAnnot_GetExtendedRotation=B(`EPDFAnnot_GetExtendedRotation`,2),i._EPDFAnnot_SetUnrotatedRect=B(`EPDFAnnot_SetUnrotatedRect`,2),i._EPDFAnnot_GetUnrotatedRect=B(`EPDFAnnot_GetUnrotatedRect`,2),i._EPDFAnnot_GetRect=B(`EPDFAnnot_GetRect`,2),i._EPDFAnnot_SetAPMatrix=B(`EPDFAnnot_SetAPMatrix`,3),i._EPDFAnnot_GetAPMatrix=B(`EPDFAnnot_GetAPMatrix`,3),i._EPDFAnnot_GetAvailableAppearanceModes=B(`EPDFAnnot_GetAvailableAppearanceModes`,1),i._EPDFAnnot_HasAppearanceStream=B(`EPDFAnnot_HasAppearanceStream`,2),i._EPDFAnnot_SetMKColor=B(`EPDFAnnot_SetMKColor`,5),i._EPDFAnnot_GetMKColor=B(`EPDFAnnot_GetMKColor`,5),i._EPDFAnnot_ClearMKColor=B(`EPDFAnnot_ClearMKColor`,2),i._EPDFPage_CreateFormField=B(`EPDFPage_CreateFormField`,4),i._EPDFAnnot_GenerateFormFieldAP=B(`EPDFAnnot_GenerateFormFieldAP`,1),i._EPDFAnnot_GetButtonExportValue=B(`EPDFAnnot_GetButtonExportValue`,3),i._EPDFAnnot_GetFormFieldRawValue=B(`EPDFAnnot_GetFormFieldRawValue`,4),i._EPDFAnnot_SetFormFieldValue=B(`EPDFAnnot_SetFormFieldValue`,3),i._EPDFAnnot_SetFormFieldName=B(`EPDFAnnot_SetFormFieldName`,3),i._EPDFAnnot_GetFormFieldObjectNumber=B(`EPDFAnnot_GetFormFieldObjectNumber`,2),i._EPDFAnnot_ShareFormField=B(`EPDFAnnot_ShareFormField`,3),i._EPDFAnnot_GetCalloutLineCount=B(`EPDFAnnot_GetCalloutLineCount`,1),i._EPDFAnnot_GetCalloutLine=B(`EPDFAnnot_GetCalloutLine`,3),i._EPDFAnnot_SetCalloutLine=B(`EPDFAnnot_SetCalloutLine`,3),i._EPDFAnnot_SetFormFieldOptions=B(`EPDFAnnot_SetFormFieldOptions`,4),i._EPDFAnnot_GetObjectNumber=B(`EPDFAnnot_GetObjectNumber`,1),i._EPDFPage_GetAnnotByObjectNumber=B(`EPDFPage_GetAnnotByObjectNumber`,2),i._EPDFPage_RemoveAnnot=B(`EPDFPage_RemoveAnnot`,2),i._EPDFPage_RemoveAnnotByObjectNumber=B(`EPDFPage_RemoveAnnotByObjectNumber`,2),i._EPDFPage_MoveAnnots=B(`EPDFPage_MoveAnnots`,4),i._FPDFDoc_GetAttachmentCount=B(`FPDFDoc_GetAttachmentCount`,1),i._FPDFDoc_AddAttachment=B(`FPDFDoc_AddAttachment`,2),i._FPDFDoc_GetAttachment=B(`FPDFDoc_GetAttachment`,2),i._FPDFDoc_DeleteAttachment=B(`FPDFDoc_DeleteAttachment`,2),i._FPDFAttachment_GetName=B(`FPDFAttachment_GetName`,3),i._FPDFAttachment_HasKey=B(`FPDFAttachment_HasKey`,2),i._FPDFAttachment_GetValueType=B(`FPDFAttachment_GetValueType`,2),i._FPDFAttachment_SetStringValue=B(`FPDFAttachment_SetStringValue`,3),i._FPDFAttachment_GetStringValue=B(`FPDFAttachment_GetStringValue`,4),i._FPDFAttachment_SetFile=B(`FPDFAttachment_SetFile`,4),i._FPDFAttachment_GetFile=B(`FPDFAttachment_GetFile`,4),i._FPDFAttachment_GetSubtype=B(`FPDFAttachment_GetSubtype`,3),i._EPDFAttachment_SetSubtype=B(`EPDFAttachment_SetSubtype`,2),i._EPDFAttachment_SetDescription=B(`EPDFAttachment_SetDescription`,2),i._EPDFAttachment_GetDescription=B(`EPDFAttachment_GetDescription`,3),i._EPDFAttachment_GetIntegerValue=B(`EPDFAttachment_GetIntegerValue`,3),i._FPDFCatalog_IsTagged=B(`FPDFCatalog_IsTagged`,1),i._FPDFCatalog_GetLanguage=B(`FPDFCatalog_GetLanguage`,3),i._FPDFCatalog_SetLanguage=B(`FPDFCatalog_SetLanguage`,2),i._EPDFCatalog_GetLanguage=B(`EPDFCatalog_GetLanguage`,3),i._FPDFAvail_Create=B(`FPDFAvail_Create`,2),i._FPDFAvail_Destroy=B(`FPDFAvail_Destroy`,1),i._FPDFAvail_IsDocAvail=B(`FPDFAvail_IsDocAvail`,2),i._FPDFAvail_GetDocument=B(`FPDFAvail_GetDocument`,2),i._FPDFAvail_GetFirstPageNum=B(`FPDFAvail_GetFirstPageNum`,1),i._FPDFAvail_IsPageAvail=B(`FPDFAvail_IsPageAvail`,3),i._FPDFAvail_IsFormAvail=B(`FPDFAvail_IsFormAvail`,2),i._FPDFAvail_IsLinearized=B(`FPDFAvail_IsLinearized`,1),i._FPDFBookmark_GetFirstChild=B(`FPDFBookmark_GetFirstChild`,2),i._FPDFBookmark_GetNextSibling=B(`FPDFBookmark_GetNextSibling`,2),i._FPDFBookmark_GetTitle=B(`FPDFBookmark_GetTitle`,3),i._FPDFBookmark_GetCount=B(`FPDFBookmark_GetCount`,1),i._FPDFBookmark_Find=B(`FPDFBookmark_Find`,2),i._FPDFBookmark_GetDest=B(`FPDFBookmark_GetDest`,2),i._FPDFBookmark_GetAction=B(`FPDFBookmark_GetAction`,1),i._FPDFAction_GetType=B(`FPDFAction_GetType`,1),i._FPDFAction_GetDest=B(`FPDFAction_GetDest`,2),i._FPDFAction_GetFilePath=B(`FPDFAction_GetFilePath`,3),i._FPDFAction_GetURIPath=B(`FPDFAction_GetURIPath`,4),i._FPDFDest_GetDestPageIndex=B(`FPDFDest_GetDestPageIndex`,2),i._FPDFDest_GetView=B(`FPDFDest_GetView`,3),i._FPDFDest_GetLocationInPage=B(`FPDFDest_GetLocationInPage`,7),i._FPDFLink_GetLinkAtPoint=B(`FPDFLink_GetLinkAtPoint`,3),i._FPDFLink_GetLinkZOrderAtPoint=B(`FPDFLink_GetLinkZOrderAtPoint`,3),i._FPDFLink_GetDest=B(`FPDFLink_GetDest`,2),i._FPDFLink_GetAction=B(`FPDFLink_GetAction`,1),i._FPDFLink_Enumerate=B(`FPDFLink_Enumerate`,3),i._FPDFLink_GetAnnot=B(`FPDFLink_GetAnnot`,2),i._FPDFLink_GetAnnotRect=B(`FPDFLink_GetAnnotRect`,2),i._FPDFLink_CountQuadPoints=B(`FPDFLink_CountQuadPoints`,1),i._FPDFLink_GetQuadPoints=B(`FPDFLink_GetQuadPoints`,3),i._FPDF_GetPageAAction=B(`FPDF_GetPageAAction`,2),i._FPDF_GetFileIdentifier=B(`FPDF_GetFileIdentifier`,4),i._FPDF_GetMetaText=B(`FPDF_GetMetaText`,4),i._FPDF_GetPageLabel=B(`FPDF_GetPageLabel`,4),i._EPDF_SetMetaText=B(`EPDF_SetMetaText`,3),i._EPDF_HasMetaText=B(`EPDF_HasMetaText`,2),i._EPDF_GetMetaTrapped=B(`EPDF_GetMetaTrapped`,1),i._EPDF_SetMetaTrapped=B(`EPDF_SetMetaTrapped`,2),i._EPDF_GetMetaKeyCount=B(`EPDF_GetMetaKeyCount`,2),i._EPDF_GetMetaKeyName=B(`EPDF_GetMetaKeyName`,5),i._FPDFPageObj_NewImageObj=B(`FPDFPageObj_NewImageObj`,1),i._FPDFImageObj_LoadJpegFile=B(`FPDFImageObj_LoadJpegFile`,4),i._FPDFImageObj_LoadJpegFileInline=B(`FPDFImageObj_LoadJpegFileInline`,4),i._FPDFImageObj_SetMatrix=B(`FPDFImageObj_SetMatrix`,7),i._FPDFImageObj_SetBitmap=B(`FPDFImageObj_SetBitmap`,4),i._FPDFImageObj_GetBitmap=B(`FPDFImageObj_GetBitmap`,1),i._FPDFImageObj_GetRenderedBitmap=B(`FPDFImageObj_GetRenderedBitmap`,3),i._FPDFImageObj_GetImageDataDecoded=B(`FPDFImageObj_GetImageDataDecoded`,3),i._FPDFImageObj_GetImageDataRaw=B(`FPDFImageObj_GetImageDataRaw`,3),i._FPDFImageObj_GetImageFilterCount=B(`FPDFImageObj_GetImageFilterCount`,1),i._FPDFImageObj_GetImageFilter=B(`FPDFImageObj_GetImageFilter`,4),i._FPDFImageObj_GetImageMetadata=B(`FPDFImageObj_GetImageMetadata`,3),i._FPDFImageObj_GetImagePixelSize=B(`FPDFImageObj_GetImagePixelSize`,3),i._FPDFImageObj_GetIccProfileDataDecoded=B(`FPDFImageObj_GetIccProfileDataDecoded`,5),i._EPDFImageObj_SetPng=B(`EPDFImageObj_SetPng`,5),i._EPDFImageObj_SetJpeg=B(`EPDFImageObj_SetJpeg`,5),i._FPDF_CreateNewDocument=B(`FPDF_CreateNewDocument`,0),i._FPDFPage_Delete=B(`FPDFPage_Delete`,2),i._FPDF_MovePages=B(`FPDF_MovePages`,4),i._FPDFPage_New=B(`FPDFPage_New`,4),i._FPDFPage_GetRotation=B(`FPDFPage_GetRotation`,1),i._FPDFPage_InsertObject=B(`FPDFPage_InsertObject`,2),i._FPDFPage_InsertObjectAtIndex=B(`FPDFPage_InsertObjectAtIndex`,3),i._FPDFPage_RemoveObject=B(`FPDFPage_RemoveObject`,2),i._FPDFPage_CountObjects=B(`FPDFPage_CountObjects`,1),i._FPDFPage_GetObject=B(`FPDFPage_GetObject`,2),i._FPDFPage_HasTransparency=B(`FPDFPage_HasTransparency`,1),i._FPDFPageObj_Destroy=B(`FPDFPageObj_Destroy`,1),i._FPDFPageObj_GetMarkedContentID=B(`FPDFPageObj_GetMarkedContentID`,1),i._FPDFPageObj_CountMarks=B(`FPDFPageObj_CountMarks`,1),i._FPDFPageObj_GetMark=B(`FPDFPageObj_GetMark`,2),i._FPDFPageObj_AddMark=B(`FPDFPageObj_AddMark`,2),i._FPDFPageObj_RemoveMark=B(`FPDFPageObj_RemoveMark`,2),i._FPDFPageObjMark_GetName=B(`FPDFPageObjMark_GetName`,4),i._FPDFPageObjMark_CountParams=B(`FPDFPageObjMark_CountParams`,1),i._FPDFPageObjMark_GetParamKey=B(`FPDFPageObjMark_GetParamKey`,5),i._FPDFPageObjMark_GetParamValueType=B(`FPDFPageObjMark_GetParamValueType`,2),i._FPDFPageObjMark_GetParamIntValue=B(`FPDFPageObjMark_GetParamIntValue`,3),i._FPDFPageObjMark_GetParamFloatValue=B(`FPDFPageObjMark_GetParamFloatValue`,3),i._FPDFPageObjMark_GetParamStringValue=B(`FPDFPageObjMark_GetParamStringValue`,5),i._FPDFPageObjMark_GetParamBlobValue=B(`FPDFPageObjMark_GetParamBlobValue`,5),i._FPDFPageObj_HasTransparency=B(`FPDFPageObj_HasTransparency`,1),i._FPDFPageObjMark_SetIntParam=B(`FPDFPageObjMark_SetIntParam`,5),i._FPDFPageObjMark_SetFloatParam=B(`FPDFPageObjMark_SetFloatParam`,5),i._FPDFPageObjMark_SetStringParam=B(`FPDFPageObjMark_SetStringParam`,5),i._FPDFPageObjMark_SetBlobParam=B(`FPDFPageObjMark_SetBlobParam`,6),i._FPDFPageObjMark_RemoveParam=B(`FPDFPageObjMark_RemoveParam`,3),i._FPDFPageObj_GetType=B(`FPDFPageObj_GetType`,1),i._FPDFPageObj_GetIsActive=B(`FPDFPageObj_GetIsActive`,2),i._FPDFPageObj_SetIsActive=B(`FPDFPageObj_SetIsActive`,2),i._FPDFPage_GenerateContent=B(`FPDFPage_GenerateContent`,1),i._FPDFPageObj_Transform=B(`FPDFPageObj_Transform`,7),i._FPDFPageObj_TransformF=B(`FPDFPageObj_TransformF`,2),i._FPDFPageObj_GetMatrix=B(`FPDFPageObj_GetMatrix`,2),i._FPDFPageObj_SetMatrix=B(`FPDFPageObj_SetMatrix`,2),i._FPDFPageObj_SetBlendMode=B(`FPDFPageObj_SetBlendMode`,2),i._FPDFPage_TransformAnnots=B(`FPDFPage_TransformAnnots`,7),i._FPDFPage_SetRotation=B(`FPDFPage_SetRotation`,2),i._FPDFPageObj_SetFillColor=B(`FPDFPageObj_SetFillColor`,5),i._FPDFPageObj_GetFillColor=B(`FPDFPageObj_GetFillColor`,5),i._FPDFPageObj_GetBounds=B(`FPDFPageObj_GetBounds`,5),i._FPDFPageObj_GetRotatedBounds=B(`FPDFPageObj_GetRotatedBounds`,2),i._FPDFPageObj_SetStrokeColor=B(`FPDFPageObj_SetStrokeColor`,5),i._FPDFPageObj_GetStrokeColor=B(`FPDFPageObj_GetStrokeColor`,5),i._FPDFPageObj_SetStrokeWidth=B(`FPDFPageObj_SetStrokeWidth`,2),i._FPDFPageObj_GetStrokeWidth=B(`FPDFPageObj_GetStrokeWidth`,2),i._FPDFPageObj_GetLineJoin=B(`FPDFPageObj_GetLineJoin`,1),i._FPDFPageObj_SetLineJoin=B(`FPDFPageObj_SetLineJoin`,2),i._FPDFPageObj_GetLineCap=B(`FPDFPageObj_GetLineCap`,1),i._FPDFPageObj_SetLineCap=B(`FPDFPageObj_SetLineCap`,2),i._FPDFPageObj_GetDashPhase=B(`FPDFPageObj_GetDashPhase`,2),i._FPDFPageObj_SetDashPhase=B(`FPDFPageObj_SetDashPhase`,2),i._FPDFPageObj_GetDashCount=B(`FPDFPageObj_GetDashCount`,1),i._FPDFPageObj_GetDashArray=B(`FPDFPageObj_GetDashArray`,3),i._FPDFPageObj_SetDashArray=B(`FPDFPageObj_SetDashArray`,4),i._FPDFFormObj_CountObjects=B(`FPDFFormObj_CountObjects`,1),i._FPDFFormObj_GetObject=B(`FPDFFormObj_GetObject`,2),i._FPDFFormObj_RemoveObject=B(`FPDFFormObj_RemoveObject`,2),i._FPDFPageObj_CreateNewPath=B(`FPDFPageObj_CreateNewPath`,2),i._FPDFPageObj_CreateNewRect=B(`FPDFPageObj_CreateNewRect`,4),i._FPDFPath_CountSegments=B(`FPDFPath_CountSegments`,1),i._FPDFPath_GetPathSegment=B(`FPDFPath_GetPathSegment`,2),i._FPDFPath_MoveTo=B(`FPDFPath_MoveTo`,3),i._FPDFPath_LineTo=B(`FPDFPath_LineTo`,3),i._FPDFPath_BezierTo=B(`FPDFPath_BezierTo`,7),i._FPDFPath_Close=B(`FPDFPath_Close`,1),i._FPDFPath_SetDrawMode=B(`FPDFPath_SetDrawMode`,3),i._FPDFPath_GetDrawMode=B(`FPDFPath_GetDrawMode`,3),i._FPDFPathSegment_GetPoint=B(`FPDFPathSegment_GetPoint`,3),i._FPDFPathSegment_GetType=B(`FPDFPathSegment_GetType`,1),i._FPDFPathSegment_GetClose=B(`FPDFPathSegment_GetClose`,1),i._FPDFPageObj_NewTextObj=B(`FPDFPageObj_NewTextObj`,3),i._FPDFText_SetText=B(`FPDFText_SetText`,2),i._FPDFText_SetCharcodes=B(`FPDFText_SetCharcodes`,3),i._FPDFText_LoadFont=B(`FPDFText_LoadFont`,5),i._FPDFText_LoadStandardFont=B(`FPDFText_LoadStandardFont`,2),i._FPDFText_LoadCidType2Font=B(`FPDFText_LoadCidType2Font`,6),i._FPDFTextObj_GetFontSize=B(`FPDFTextObj_GetFontSize`,2),i._FPDFTextObj_GetText=B(`FPDFTextObj_GetText`,4),i._FPDFTextObj_GetRenderedBitmap=B(`FPDFTextObj_GetRenderedBitmap`,4),i._FPDFFont_Close=B(`FPDFFont_Close`,1),i._FPDFPageObj_CreateTextObj=B(`FPDFPageObj_CreateTextObj`,3),i._FPDFTextObj_GetTextRenderMode=B(`FPDFTextObj_GetTextRenderMode`,1),i._FPDFTextObj_SetTextRenderMode=B(`FPDFTextObj_SetTextRenderMode`,2),i._FPDFTextObj_GetFont=B(`FPDFTextObj_GetFont`,1),i._FPDFFont_GetBaseFontName=B(`FPDFFont_GetBaseFontName`,3),i._FPDFFont_GetFamilyName=B(`FPDFFont_GetFamilyName`,3),i._FPDFFont_GetFontData=B(`FPDFFont_GetFontData`,4),i._FPDFFont_GetIsEmbedded=B(`FPDFFont_GetIsEmbedded`,1),i._FPDFFont_GetFlags=B(`FPDFFont_GetFlags`,1),i._FPDFFont_GetWeight=B(`FPDFFont_GetWeight`,1),i._FPDFFont_GetItalicAngle=B(`FPDFFont_GetItalicAngle`,2),i._FPDFFont_GetAscent=B(`FPDFFont_GetAscent`,3),i._FPDFFont_GetDescent=B(`FPDFFont_GetDescent`,3),i._FPDFFont_GetGlyphWidth=B(`FPDFFont_GetGlyphWidth`,4),i._FPDFFont_GetGlyphPath=B(`FPDFFont_GetGlyphPath`,3),i._FPDFGlyphPath_CountGlyphSegments=B(`FPDFGlyphPath_CountGlyphSegments`,1),i._FPDFGlyphPath_GetGlyphPathSegment=B(`FPDFGlyphPath_GetGlyphPathSegment`,2),i._EPDFText_RedactInRect=B(`EPDFText_RedactInRect`,4),i._EPDFText_RedactInQuads=B(`EPDFText_RedactInQuads`,5),i._FPDFDoc_GetPageMode=B(`FPDFDoc_GetPageMode`,1),i._FPDFPage_Flatten=B(`FPDFPage_Flatten`,2),i._FPDFPage_HasFormFieldAtPoint=B(`FPDFPage_HasFormFieldAtPoint`,4),i._FPDFPage_FormFieldZOrderAtPoint=B(`FPDFPage_FormFieldZOrderAtPoint`,4),i._malloc=B(`malloc`,1),i._free=B(`free`,1),i._FORM_OnMouseMove=B(`FORM_OnMouseMove`,5),i._FORM_OnMouseWheel=B(`FORM_OnMouseWheel`,6),i._FORM_OnFocus=B(`FORM_OnFocus`,5),i._FORM_OnLButtonDown=B(`FORM_OnLButtonDown`,5),i._FORM_OnLButtonUp=B(`FORM_OnLButtonUp`,5),i._FORM_OnLButtonDoubleClick=B(`FORM_OnLButtonDoubleClick`,5),i._FORM_OnRButtonDown=B(`FORM_OnRButtonDown`,5),i._FORM_OnRButtonUp=B(`FORM_OnRButtonUp`,5),i._FORM_OnKeyDown=B(`FORM_OnKeyDown`,4),i._FORM_OnKeyUp=B(`FORM_OnKeyUp`,4),i._FORM_OnChar=B(`FORM_OnChar`,4),i._FORM_GetFocusedText=B(`FORM_GetFocusedText`,4),i._FORM_GetSelectedText=B(`FORM_GetSelectedText`,4),i._FORM_ReplaceAndKeepSelection=B(`FORM_ReplaceAndKeepSelection`,3),i._FORM_ReplaceSelection=B(`FORM_ReplaceSelection`,3),i._FORM_SelectAllText=B(`FORM_SelectAllText`,2),i._FORM_CanUndo=B(`FORM_CanUndo`,2),i._FORM_CanRedo=B(`FORM_CanRedo`,2),i._FORM_Undo=B(`FORM_Undo`,2),i._FORM_Redo=B(`FORM_Redo`,2),i._FORM_ForceToKillFocus=B(`FORM_ForceToKillFocus`,1),i._FORM_GetFocusedAnnot=B(`FORM_GetFocusedAnnot`,3),i._FORM_SetFocusedAnnot=B(`FORM_SetFocusedAnnot`,2),i._FPDF_FFLDraw=B(`FPDF_FFLDraw`,9),i._FPDF_SetFormFieldHighlightColor=B(`FPDF_SetFormFieldHighlightColor`,3),i._FPDF_SetFormFieldHighlightAlpha=B(`FPDF_SetFormFieldHighlightAlpha`,2),i._FPDF_RemoveFormFieldHighlight=B(`FPDF_RemoveFormFieldHighlight`,1),i._FORM_OnAfterLoadPage=B(`FORM_OnAfterLoadPage`,2),i._FORM_OnBeforeClosePage=B(`FORM_OnBeforeClosePage`,2),i._FORM_DoDocumentJSAction=B(`FORM_DoDocumentJSAction`,1),i._FORM_DoDocumentOpenAction=B(`FORM_DoDocumentOpenAction`,1),i._FORM_DoDocumentAAction=B(`FORM_DoDocumentAAction`,2),i._FORM_DoPageAAction=B(`FORM_DoPageAAction`,3),i._FORM_SetIndexSelected=B(`FORM_SetIndexSelected`,4),i._FORM_IsIndexSelected=B(`FORM_IsIndexSelected`,3),i._FPDFDoc_GetJavaScriptActionCount=B(`FPDFDoc_GetJavaScriptActionCount`,1),i._FPDFDoc_GetJavaScriptAction=B(`FPDFDoc_GetJavaScriptAction`,2),i._FPDFDoc_CloseJavaScriptAction=B(`FPDFDoc_CloseJavaScriptAction`,1),i._FPDFJavaScriptAction_GetName=B(`FPDFJavaScriptAction_GetName`,3),i._FPDFJavaScriptAction_GetScript=B(`FPDFJavaScriptAction_GetScript`,3),i._FPDF_ImportPagesByIndex=B(`FPDF_ImportPagesByIndex`,5),i._FPDF_ImportPages=B(`FPDF_ImportPages`,4),i._FPDF_ImportNPagesToOne=B(`FPDF_ImportNPagesToOne`,5),i._FPDF_NewXObjectFromPage=B(`FPDF_NewXObjectFromPage`,3),i._FPDF_CloseXObject=B(`FPDF_CloseXObject`,1),i._FPDF_NewFormObjectFromXObject=B(`FPDF_NewFormObjectFromXObject`,1),i._FPDF_CopyViewerPreferences=B(`FPDF_CopyViewerPreferences`,2),i._FPDF_RenderPageBitmapWithColorScheme_Start=B(`FPDF_RenderPageBitmapWithColorScheme_Start`,10),i._FPDF_RenderPageBitmap_Start=B(`FPDF_RenderPageBitmap_Start`,9),i._FPDF_RenderPage_Continue=B(`FPDF_RenderPage_Continue`,2),i._FPDF_RenderPage_Close=B(`FPDF_RenderPage_Close`,1),i._FPDF_SaveWithVersion=B(`FPDF_SaveWithVersion`,4),i._FPDFText_GetCharIndexFromTextIndex=B(`FPDFText_GetCharIndexFromTextIndex`,2),i._FPDFText_GetTextIndexFromCharIndex=B(`FPDFText_GetTextIndexFromCharIndex`,2),i._FPDF_GetSignatureCount=B(`FPDF_GetSignatureCount`,1),i._FPDF_GetSignatureObject=B(`FPDF_GetSignatureObject`,2),i._FPDFSignatureObj_GetContents=B(`FPDFSignatureObj_GetContents`,3),i._FPDFSignatureObj_GetByteRange=B(`FPDFSignatureObj_GetByteRange`,3),i._FPDFSignatureObj_GetSubFilter=B(`FPDFSignatureObj_GetSubFilter`,3),i._FPDFSignatureObj_GetReason=B(`FPDFSignatureObj_GetReason`,3),i._FPDFSignatureObj_GetTime=B(`FPDFSignatureObj_GetTime`,3),i._FPDFSignatureObj_GetDocMDPPermission=B(`FPDFSignatureObj_GetDocMDPPermission`,1),i._FPDF_StructTree_GetForPage=B(`FPDF_StructTree_GetForPage`,1),i._FPDF_StructTree_Close=B(`FPDF_StructTree_Close`,1),i._FPDF_StructTree_CountChildren=B(`FPDF_StructTree_CountChildren`,1),i._FPDF_StructTree_GetChildAtIndex=B(`FPDF_StructTree_GetChildAtIndex`,2),i._FPDF_StructElement_GetAltText=B(`FPDF_StructElement_GetAltText`,3),i._FPDF_StructElement_GetActualText=B(`FPDF_StructElement_GetActualText`,3),i._FPDF_StructElement_GetID=B(`FPDF_StructElement_GetID`,3),i._FPDF_StructElement_GetLang=B(`FPDF_StructElement_GetLang`,3),i._FPDF_StructElement_GetAttributeCount=B(`FPDF_StructElement_GetAttributeCount`,1),i._FPDF_StructElement_GetAttributeAtIndex=B(`FPDF_StructElement_GetAttributeAtIndex`,2),i._FPDF_StructElement_GetStringAttribute=B(`FPDF_StructElement_GetStringAttribute`,4),i._FPDF_StructElement_GetMarkedContentID=B(`FPDF_StructElement_GetMarkedContentID`,1),i._FPDF_StructElement_GetType=B(`FPDF_StructElement_GetType`,3),i._FPDF_StructElement_GetObjType=B(`FPDF_StructElement_GetObjType`,3),i._FPDF_StructElement_GetTitle=B(`FPDF_StructElement_GetTitle`,3),i._FPDF_StructElement_CountChildren=B(`FPDF_StructElement_CountChildren`,1),i._FPDF_StructElement_GetChildAtIndex=B(`FPDF_StructElement_GetChildAtIndex`,2),i._FPDF_StructElement_GetChildMarkedContentID=B(`FPDF_StructElement_GetChildMarkedContentID`,2),i._FPDF_StructElement_GetParent=B(`FPDF_StructElement_GetParent`,1),i._FPDF_StructElement_Attr_GetCount=B(`FPDF_StructElement_Attr_GetCount`,1),i._FPDF_StructElement_Attr_GetName=B(`FPDF_StructElement_Attr_GetName`,5),i._FPDF_StructElement_Attr_GetValue=B(`FPDF_StructElement_Attr_GetValue`,2),i._FPDF_StructElement_Attr_GetType=B(`FPDF_StructElement_Attr_GetType`,1),i._FPDF_StructElement_Attr_GetBooleanValue=B(`FPDF_StructElement_Attr_GetBooleanValue`,2),i._FPDF_StructElement_Attr_GetNumberValue=B(`FPDF_StructElement_Attr_GetNumberValue`,2),i._FPDF_StructElement_Attr_GetStringValue=B(`FPDF_StructElement_Attr_GetStringValue`,4),i._FPDF_StructElement_Attr_GetBlobValue=B(`FPDF_StructElement_Attr_GetBlobValue`,4),i._FPDF_StructElement_Attr_CountChildren=B(`FPDF_StructElement_Attr_CountChildren`,1),i._FPDF_StructElement_Attr_GetChildAtIndex=B(`FPDF_StructElement_Attr_GetChildAtIndex`,2),i._FPDF_StructElement_GetMarkedContentIdCount=B(`FPDF_StructElement_GetMarkedContentIdCount`,1),i._FPDF_StructElement_GetMarkedContentIdAtIndex=B(`FPDF_StructElement_GetMarkedContentIdAtIndex`,2),i._FPDF_AddInstalledFont=B(`FPDF_AddInstalledFont`,3),i._FPDF_SetSystemFontInfo=B(`FPDF_SetSystemFontInfo`,1),i._FPDF_GetDefaultTTFMap=B(`FPDF_GetDefaultTTFMap`,0),i._FPDF_GetDefaultTTFMapCount=B(`FPDF_GetDefaultTTFMapCount`,0),i._FPDF_GetDefaultTTFMapEntry=B(`FPDF_GetDefaultTTFMapEntry`,1),i._FPDF_GetDefaultSystemFontInfo=B(`FPDF_GetDefaultSystemFontInfo`,0),i._FPDF_FreeDefaultSystemFontInfo=B(`FPDF_FreeDefaultSystemFontInfo`,1),i._FPDFText_LoadPage=B(`FPDFText_LoadPage`,1),i._FPDFText_ClosePage=B(`FPDFText_ClosePage`,1),i._FPDFText_CountChars=B(`FPDFText_CountChars`,1),i._FPDFText_GetUnicode=B(`FPDFText_GetUnicode`,2),i._FPDFText_GetTextObject=B(`FPDFText_GetTextObject`,2),i._FPDFText_IsGenerated=B(`FPDFText_IsGenerated`,2),i._FPDFText_IsHyphen=B(`FPDFText_IsHyphen`,2),i._FPDFText_HasUnicodeMapError=B(`FPDFText_HasUnicodeMapError`,2),i._FPDFText_GetFontSize=B(`FPDFText_GetFontSize`,2),i._FPDFText_GetFontInfo=B(`FPDFText_GetFontInfo`,5),i._FPDFText_GetFontWeight=B(`FPDFText_GetFontWeight`,2),i._FPDFText_GetFillColor=B(`FPDFText_GetFillColor`,6),i._FPDFText_GetStrokeColor=B(`FPDFText_GetStrokeColor`,6),i._FPDFText_GetCharAngle=B(`FPDFText_GetCharAngle`,2),i._FPDFText_GetCharBox=B(`FPDFText_GetCharBox`,6),i._FPDFText_GetLooseCharBox=B(`FPDFText_GetLooseCharBox`,3),i._FPDFText_GetMatrix=B(`FPDFText_GetMatrix`,3),i._FPDFText_GetCharOrigin=B(`FPDFText_GetCharOrigin`,4),i._FPDFText_GetCharIndexAtPos=B(`FPDFText_GetCharIndexAtPos`,5),i._FPDFText_GetText=B(`FPDFText_GetText`,4),i._FPDFText_CountRects=B(`FPDFText_CountRects`,3),i._FPDFText_GetRect=B(`FPDFText_GetRect`,6),i._FPDFText_GetBoundedText=B(`FPDFText_GetBoundedText`,7),i._FPDFText_FindStart=B(`FPDFText_FindStart`,4),i._FPDFText_FindNext=B(`FPDFText_FindNext`,1),i._FPDFText_FindPrev=B(`FPDFText_FindPrev`,1),i._FPDFText_GetSchResultIndex=B(`FPDFText_GetSchResultIndex`,1),i._FPDFText_GetSchCount=B(`FPDFText_GetSchCount`,1),i._FPDFText_FindClose=B(`FPDFText_FindClose`,1),i._FPDFLink_LoadWebLinks=B(`FPDFLink_LoadWebLinks`,1),i._FPDFLink_CountWebLinks=B(`FPDFLink_CountWebLinks`,1),i._FPDFLink_GetURL=B(`FPDFLink_GetURL`,4),i._FPDFLink_CountRects=B(`FPDFLink_CountRects`,2),i._FPDFLink_GetRect=B(`FPDFLink_GetRect`,7),i._FPDFLink_GetTextRange=B(`FPDFLink_GetTextRange`,4),i._FPDFLink_CloseWebLinks=B(`FPDFLink_CloseWebLinks`,1),i._FPDFPage_GetDecodedThumbnailData=B(`FPDFPage_GetDecodedThumbnailData`,3),i._FPDFPage_GetRawThumbnailData=B(`FPDFPage_GetRawThumbnailData`,3),i._FPDFPage_GetThumbnailAsBitmap=B(`FPDFPage_GetThumbnailAsBitmap`,1),i._FPDFPage_SetMediaBox=B(`FPDFPage_SetMediaBox`,5),i._FPDFPage_SetCropBox=B(`FPDFPage_SetCropBox`,5),i._FPDFPage_SetBleedBox=B(`FPDFPage_SetBleedBox`,5),i._FPDFPage_SetTrimBox=B(`FPDFPage_SetTrimBox`,5),i._FPDFPage_SetArtBox=B(`FPDFPage_SetArtBox`,5),i._FPDFPage_GetMediaBox=B(`FPDFPage_GetMediaBox`,5),i._FPDFPage_GetCropBox=B(`FPDFPage_GetCropBox`,5),i._FPDFPage_GetBleedBox=B(`FPDFPage_GetBleedBox`,5),i._FPDFPage_GetTrimBox=B(`FPDFPage_GetTrimBox`,5),i._FPDFPage_GetArtBox=B(`FPDFPage_GetArtBox`,5),i._FPDFPage_TransFormWithClip=B(`FPDFPage_TransFormWithClip`,3),i._FPDFPageObj_TransformClipPath=B(`FPDFPageObj_TransformClipPath`,7),i._FPDFPageObj_GetClipPath=B(`FPDFPageObj_GetClipPath`,1),i._FPDFClipPath_CountPaths=B(`FPDFClipPath_CountPaths`,1),i._FPDFClipPath_CountPathSegments=B(`FPDFClipPath_CountPathSegments`,2),i._FPDFClipPath_GetPathSegment=B(`FPDFClipPath_GetPathSegment`,3),i._FPDF_CreateClipPath=B(`FPDF_CreateClipPath`,4),i._FPDF_DestroyClipPath=B(`FPDF_DestroyClipPath`,1),i._FPDFPage_InsertClipPath=B(`FPDFPage_InsertClipPath`,2),i._FPDF_InitLibrary=B(`FPDF_InitLibrary`,0),i._FPDF_DestroyLibrary=B(`FPDF_DestroyLibrary`,0),i._FPDF_SetSandBoxPolicy=B(`FPDF_SetSandBoxPolicy`,2),i._FPDF_LoadDocument=B(`FPDF_LoadDocument`,2),i._FPDF_GetFormType=B(`FPDF_GetFormType`,1),i._FPDF_LoadXFA=B(`FPDF_LoadXFA`,1),i._FPDF_LoadMemDocument=B(`FPDF_LoadMemDocument`,3),i._FPDF_LoadMemDocument64=B(`FPDF_LoadMemDocument64`,3),i._FPDF_LoadCustomDocument=B(`FPDF_LoadCustomDocument`,2),i._FPDF_GetFileVersion=B(`FPDF_GetFileVersion`,2),i._FPDF_DocumentHasValidCrossReferenceTable=B(`FPDF_DocumentHasValidCrossReferenceTable`,1),i._FPDF_GetDocPermissions=B(`FPDF_GetDocPermissions`,1),i._FPDF_GetDocUserPermissions=B(`FPDF_GetDocUserPermissions`,1),i._FPDF_GetSecurityHandlerRevision=B(`FPDF_GetSecurityHandlerRevision`,1),i._EPDF_SetEncryption=B(`EPDF_SetEncryption`,4),i._EPDF_RemoveEncryption=B(`EPDF_RemoveEncryption`,1),i._EPDF_UnlockOwnerPermissions=B(`EPDF_UnlockOwnerPermissions`,2),i._EPDF_IsEncrypted=B(`EPDF_IsEncrypted`,1),i._EPDF_IsOwnerUnlocked=B(`EPDF_IsOwnerUnlocked`,1),i._FPDF_GetPageCount=B(`FPDF_GetPageCount`,1),i._FPDF_LoadPage=B(`FPDF_LoadPage`,2),i._EPDFDoc_LoadPageByObjectNumber=B(`EPDFDoc_LoadPageByObjectNumber`,2),i._EPDFDoc_GetPageObjectNumberByIndex=B(`EPDFDoc_GetPageObjectNumberByIndex`,2),i._EPDFPage_GetObjectNumber=B(`EPDFPage_GetObjectNumber`,1),i._FPDF_GetPageWidthF=B(`FPDF_GetPageWidthF`,1),i._FPDF_GetPageWidth=B(`FPDF_GetPageWidth`,1),i._FPDF_GetPageHeightF=B(`FPDF_GetPageHeightF`,1),i._FPDF_GetPageHeight=B(`FPDF_GetPageHeight`,1),i._FPDF_GetPageBoundingBox=B(`FPDF_GetPageBoundingBox`,2),i._FPDF_RenderPageBitmap=B(`FPDF_RenderPageBitmap`,8),i._FPDF_RenderPageBitmapWithMatrix=B(`FPDF_RenderPageBitmapWithMatrix`,5),i._EPDF_RenderAnnotBitmap=B(`EPDF_RenderAnnotBitmap`,6),i._EPDF_RenderAnnotBitmapUnrotated=B(`EPDF_RenderAnnotBitmapUnrotated`,6),i._FPDF_ClosePage=B(`FPDF_ClosePage`,1),i._FPDF_CloseDocument=B(`FPDF_CloseDocument`,1),i._FPDF_GetLastError=B(`FPDF_GetLastError`,0),i._FPDF_DeviceToPage=B(`FPDF_DeviceToPage`,10),i._FPDF_PageToDevice=B(`FPDF_PageToDevice`,10),i._FPDFBitmap_Create=B(`FPDFBitmap_Create`,3),i._FPDFBitmap_CreateEx=B(`FPDFBitmap_CreateEx`,5),i._FPDFBitmap_GetFormat=B(`FPDFBitmap_GetFormat`,1),i._FPDFBitmap_FillRect=B(`FPDFBitmap_FillRect`,6),i._FPDFBitmap_GetBuffer=B(`FPDFBitmap_GetBuffer`,1),i._FPDFBitmap_GetWidth=B(`FPDFBitmap_GetWidth`,1),i._FPDFBitmap_GetHeight=B(`FPDFBitmap_GetHeight`,1),i._FPDFBitmap_GetStride=B(`FPDFBitmap_GetStride`,1),i._FPDFBitmap_Destroy=B(`FPDFBitmap_Destroy`,1),i._FPDF_GetPageSizeByIndexF=B(`FPDF_GetPageSizeByIndexF`,3),i._EPDF_GetPageRotationByIndex=B(`EPDF_GetPageRotationByIndex`,2),i._EPDF_GetPageBoxByIndex=B(`EPDF_GetPageBoxByIndex`,4),i._EPDF_GetPageSizeByIndexNormalized=B(`EPDF_GetPageSizeByIndexNormalized`,3),i._EPDF_LoadPageNormalized=B(`EPDF_LoadPageNormalized`,3),i._FPDF_GetPageSizeByIndex=B(`FPDF_GetPageSizeByIndex`,4),i._FPDF_VIEWERREF_GetPrintScaling=B(`FPDF_VIEWERREF_GetPrintScaling`,1),i._FPDF_VIEWERREF_GetNumCopies=B(`FPDF_VIEWERREF_GetNumCopies`,1),i._FPDF_VIEWERREF_GetPrintPageRange=B(`FPDF_VIEWERREF_GetPrintPageRange`,1),i._FPDF_VIEWERREF_GetPrintPageRangeCount=B(`FPDF_VIEWERREF_GetPrintPageRangeCount`,1),i._FPDF_VIEWERREF_GetPrintPageRangeElement=B(`FPDF_VIEWERREF_GetPrintPageRangeElement`,2),i._FPDF_VIEWERREF_GetDuplex=B(`FPDF_VIEWERREF_GetDuplex`,1),i._FPDF_VIEWERREF_GetName=B(`FPDF_VIEWERREF_GetName`,4),i._FPDF_CountNamedDests=B(`FPDF_CountNamedDests`,1),i._FPDF_GetNamedDestByName=B(`FPDF_GetNamedDestByName`,2),i._FPDF_GetNamedDest=B(`FPDF_GetNamedDest`,4),i._FPDF_GetXFAPacketCount=B(`FPDF_GetXFAPacketCount`,1),i._FPDF_GetXFAPacketName=B(`FPDF_GetXFAPacketName`,4),i._FPDF_GetXFAPacketContent=B(`FPDF_GetXFAPacketContent`,5),i._FPDF_GetTrailerEnds=B(`FPDF_GetTrailerEnds`,3);var et,tt,nt=B(`strerror`,1),rt=B(`fflush`,1),it=B(`emscripten_builtin_memalign`,2),$=B(`setThrew`,2),at=()=>(at=Q.emscripten_stack_init)(),ot=()=>(ot=Q.emscripten_stack_get_end)(),st=e=>(st=Q._emscripten_stack_restore)(e),ct=e=>(ct=Q._emscripten_stack_alloc)(e),lt=()=>(lt=Q.emscripten_stack_get_current)();function ut(){var e;at(),O(!(3&(e=ot()))),e==0&&(e+=4),w[e>>2]=34821223,w[e+4>>2]=2310721022,w[0]=1668509029}function dt(){var e;function t(){et||(et=1,i.calledRun=1,D||(O(!M),M=!0,A(),i.noFSInit||Y.initialized||Y.init(),Y.ignorePermissions=!1,V(j),n(i),i.onRuntimeInitialized?.(),O(!i._main,`compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]`),function(){A();var e=i.postRun;e&&(typeof e==`function`&&(e=[e]),e.forEach(P)),V(te)}()))}ne>0||(ut(),!tt&&(tt=1,(e=i.preRun)&&(typeof e==`function`&&(e=[e]),e.forEach(N)),V(ee),ne>0)||(i.setStatus?(i.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>i.setStatus(``),1),t()},1)):t(),A()))}if(i.dynCall_j=B(`dynCall_j`,1),i.dynCall_ji=B(`dynCall_ji`,2),i.dynCall_iiij=B(`dynCall_iiij`,5),i.dynCall_jji=B(`dynCall_jji`,4),i.dynCall_iji=B(`dynCall_iji`,4),i.dynCall_viijii=B(`dynCall_viijii`,7),i.dynCall_jij=B(`dynCall_jij`,4),i.dynCall_iij=B(`dynCall_iij`,4),i.dynCall_iiji=B(`dynCall_iiji`,5),i.dynCall_jiji=B(`dynCall_jiji`,5),i.dynCall_iiiiij=B(`dynCall_iiiiij`,7),i.dynCall_iiiiijj=B(`dynCall_iiiiijj`,9),i.dynCall_iiiiiijj=B(`dynCall_iiiiiijj`,10),i.dynCall_viji=B(`dynCall_viji`,5),i.wasmExports=Q,i.ccall=Qe,i.cwrap=(e,t,n,r)=>(...r)=>Qe(e,t,n,r),i.addFunction=(e,t)=>{O(e!==void 0);var n=Je(e);if(n)return n;var r=(()=>{if(Ye.length)return Ye.pop();try{ke.grow(1)}catch(e){throw e instanceof RangeError?`Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.`:e}return ke.length-1})();try{Xe(r,e)}catch(n){if(!(n instanceof TypeError))throw n;O(t!==void 0,`Missing signature argument to addFunction: `+e),Xe(r,qe(e,t))}return Ae.set(e,r),r},i.removeFunction=e=>{Ae.delete(Z(e)),Xe(e,null),Ye.push(e)},i.setValue=function(e,t,n=`i8`){switch(n.endsWith(`*`)&&(n=`*`),n){case`i1`:case`i8`:y[e]=t;break;case`i16`:x[e>>1]=t;break;case`i32`:C[e>>2]=t;break;case`i64`:I(`to do setValue(i64) use WASM_BIGINT`);case`float`:T[e>>2]=t;break;case`double`:E[e>>3]=t;break;case`*`:w[e>>2]=t;break;default:I(`invalid type for setValue: ${n}`)}},i.getValue=function(e,t=`i8`){switch(t.endsWith(`*`)&&(t=`*`),t){case`i1`:case`i8`:return y[e];case`i16`:return x[e>>1];case`i32`:return C[e>>2];case`i64`:I(`to do getValue(i64) use WASM_BIGINT`);case`float`:return T[e>>2];case`double`:return E[e>>3];case`*`:return w[e>>2];default:I(`invalid type for getValue: ${t}`)}},i.UTF8ToString=xe,i.stringToUTF8=Re,i.UTF16ToString=(e,t)=>{O(e%2==0,`Pointer passed to UTF16ToString must be aligned to two bytes!`);for(var n=e,r=n>>1,i=r+t/2;!(r>=i)&&S[r];)++r;if((n=r<<1)-e>32&&Ge)return Ge.decode(b.subarray(e,n));for(var a=``,o=0;!(o>=t/2);++o){var s=x[e+2*o>>1];if(s==0)break;a+=String.fromCharCode(s)}return a},i.stringToUTF16=(e,t,n)=>{if(O(t%2==0,`Pointer passed to stringToUTF16 must be aligned to two bytes!`),O(typeof n==`number`,`stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!`),n??=2147483647,n<2)return 0;for(var r=t,i=(n-=2)<2*e.length?n/2:e.length,a=0;a<i;++a){var o=e.charCodeAt(a);x[t>>1]=o,t+=2}return x[t>>1]=0,t-r},`writeI53ToI64.writeI53ToI64Clamped.writeI53ToI64Signaling.writeI53ToU64Clamped.writeI53ToU64Signaling.readI53FromI64.readI53FromU64.convertI32PairToI53.convertU32PairToI53.getTempRet0.setTempRet0.exitJS.inetPton4.inetNtop4.inetPton6.inetNtop6.readSockaddr.writeSockaddr.emscriptenLog.readEmAsmArgs.jstoi_q.listenOnce.autoResumeAudioContext.dynCallLegacy.getDynCaller.dynCall.handleException.keepRuntimeAlive.runtimeKeepalivePush.runtimeKeepalivePop.callUserCallback.maybeExit.asmjsMangle.HandleAllocator.getNativeTypeSize.STACK_SIZE.STACK_ALIGN.POINTER_SIZE.ASSERTIONS.reallyNegative.unSign.strLen.reSign.formatString.intArrayToString.AsciiToString.lengthBytesUTF16.UTF32ToString.stringToUTF32.lengthBytesUTF32.stringToNewUTF8.registerKeyEventCallback.maybeCStringToJsString.findEventTarget.getBoundingClientRect.fillMouseEventData.registerMouseEventCallback.registerWheelEventCallback.registerUiEventCallback.registerFocusEventCallback.fillDeviceOrientationEventData.registerDeviceOrientationEventCallback.fillDeviceMotionEventData.registerDeviceMotionEventCallback.screenOrientation.fillOrientationChangeEventData.registerOrientationChangeEventCallback.fillFullscreenChangeEventData.registerFullscreenChangeEventCallback.JSEvents_requestFullscreen.JSEvents_resizeCanvasForFullscreen.registerRestoreOldStyle.hideEverythingExceptGivenElement.restoreHiddenElements.setLetterbox.softFullscreenResizeWebGLRenderTarget.doRequestFullscreen.fillPointerlockChangeEventData.registerPointerlockChangeEventCallback.registerPointerlockErrorEventCallback.requestPointerLock.fillVisibilityChangeEventData.registerVisibilityChangeEventCallback.registerTouchEventCallback.fillGamepadEventData.registerGamepadEventCallback.registerBeforeUnloadEventCallback.fillBatteryEventData.battery.registerBatteryEventCallback.setCanvasElementSize.getCanvasElementSize.jsStackTrace.getCallstack.convertPCtoSourceLocation.checkWasiClock.wasiRightsToMuslOFlags.wasiOFlagsToMuslOFlags.createDyncallWrapper.safeSetTimeout.setImmediateWrapped.clearImmediateWrapped.polyfillSetImmediate.registerPostMainLoop.registerPreMainLoop.getPromise.makePromise.idsToPromises.makePromiseCallback.ExceptionInfo.findMatchingCatch.Browser_asyncPrepareDataCounter.safeRequestAnimationFrame.arraySum.addDays.getSocketFromFD.getSocketAddress.FS_unlink.FS_mkdirTree._setNetworkCallback.heapObjectForWebGLType.toTypedArrayIndex.webgl_enable_ANGLE_instanced_arrays.webgl_enable_OES_vertex_array_object.webgl_enable_WEBGL_draw_buffers.webgl_enable_WEBGL_multi_draw.webgl_enable_EXT_polygon_offset_clamp.webgl_enable_EXT_clip_control.webgl_enable_WEBGL_polygon_mode.emscriptenWebGLGet.computeUnpackAlignedImageSize.colorChannelsInGlTextureFormat.emscriptenWebGLGetTexPixelData.emscriptenWebGLGetUniform.webglGetUniformLocation.webglPrepareUniformLocationsBeforeFirstUse.webglGetLeftBracePos.emscriptenWebGLGetVertexAttrib.__glGetActiveAttribOrUniform.writeGLArray.registerWebGlEventCallback.runAndAbortIfError.ALLOC_NORMAL.ALLOC_STACK.allocate.writeStringToMemory.writeAsciiToMemory.setErrNo.demangle.stackTrace`.split(`.`).forEach(function(e){ge(e,()=>{var t=`\`${e}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`,n=e;n.startsWith(`_`)||(n=`$`+e),t+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${n}')`,he(e)&&(t+=`. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you`),G(t)}),ve(e)}),`run.addOnPreRun.addOnInit.addOnPreMain.addOnExit.addOnPostRun.addRunDependency.removeRunDependency.out.err.callMain.abort.wasmMemory.writeStackCookie.checkStackCookie.convertI32PairToI53Checked.stackSave.stackRestore.stackAlloc.ptrToString.zeroMemory.getHeapMax.growMemory.ENV.ERRNO_CODES.strError.DNS.Protocols.Sockets.initRandomFill.randomFill.timers.warnOnce.readEmAsmArgsArray.jstoi_s.getExecutableName.asyncLoad.alignMemory.mmapAlloc.wasmTable.noExitRuntime.getCFunc.uleb128Encode.sigToWasmTypes.generateFuncType.convertJsFunctionToWasm.freeTableIndexes.functionsInTableMap.getEmptyTableSlot.updateTableMap.getFunctionAddress.PATH.PATH_FS.UTF8Decoder.UTF8ArrayToString.stringToUTF8Array.lengthBytesUTF8.intArrayFromString.stringToAscii.UTF16Decoder.stringToUTF8OnStack.writeArrayToMemory.JSEvents.specialHTMLTargets.findCanvasEventTarget.currentFullscreenStrategy.restoreOldWindowedStyle.UNWIND_CACHE.ExitStatus.getEnvStrings.doReadv.doWritev.promiseMap.uncaughtExceptionCount.exceptionLast.exceptionCaught.Browser.getPreloadedImageData__data.wget.MONTH_DAYS_REGULAR.MONTH_DAYS_LEAP.MONTH_DAYS_REGULAR_CUMULATIVE.MONTH_DAYS_LEAP_CUMULATIVE.isLeapYear.ydayFromDate.SYSCALLS.preloadPlugins.FS_createPreloadedFile.FS_modeStringToFlags.FS_getMode.FS_stdin_getChar_buffer.FS_stdin_getChar.FS_createPath.FS_createDevice.FS_readFile.FS.FS_createDataFile.FS_createLazyFile.MEMFS.TTY.PIPEFS.SOCKFS.tempFixedLengthArray.miniTempWebGLFloatBuffers.miniTempWebGLIntBuffers.GL.AL.GLUT.EGL.GLEW.IDBStore.SDL.SDL_gfx.allocateUTF8.allocateUTF8OnStack.print.printErr`.split(`.`).forEach(ve),re=function e(){et||dt(),et||(re=e)},i.preInit)for(typeof i.preInit==`function`&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();dt(),t=a;for(let t of Object.keys(i))t in e||Object.defineProperty(e,t,{configurable:!0,get(){I(`Access to module property ('${t}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)}});return t},ce={EPDF_GetMetaKeyCount:[[`number`,`boolean`],`number`],EPDF_GetMetaKeyName:[[`number`,`number`,`boolean`,`number`,`number`],`number`],EPDF_GetMetaTrapped:[[`number`],`number`],EPDF_GetPageBoxByIndex:[[`number`,`number`,`number`,`number`],`boolean`],EPDF_GetPageRotationByIndex:[[`number`,`number`],`number`],EPDF_GetPageSizeByIndexNormalized:[[`number`,`number`,`number`],`boolean`],EPDF_HasMetaText:[[`number`,`string`],`boolean`],EPDF_IsEncrypted:[[`number`],`boolean`],EPDF_IsOwnerUnlocked:[[`number`],`boolean`],EPDF_LoadPageNormalized:[[`number`,`number`,`number`],`number`],EPDF_PNG_EncodeRGBA:[[`number`,`number`,`number`,`number`,`number`,`number`],`number`],EPDF_RemoveEncryption:[[`number`],`boolean`],EPDF_RenderAnnotBitmap:[[`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],EPDF_RenderAnnotBitmapUnrotated:[[`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],EPDF_SetEncryption:[[`number`,`string`,`string`,`number`],`boolean`],EPDF_SetMetaText:[[`number`,`string`,`number`],`boolean`],EPDF_SetMetaTrapped:[[`number`,`number`],`boolean`],EPDF_UnlockOwnerPermissions:[[`number`,`string`],`boolean`],EPDFAction_CreateGoTo:[[`number`,`number`],`number`],EPDFAction_CreateGoToNamed:[[`number`,`string`],`number`],EPDFAction_CreateLaunch:[[`number`,`number`],`number`],EPDFAction_CreateRemoteGoToByName:[[`number`,`number`,`number`],`number`],EPDFAction_CreateRemoteGoToDest:[[`number`,`number`,`number`],`number`],EPDFAction_CreateURI:[[`number`,`string`],`number`],EPDFAnnot_ApplyRedaction:[[`number`,`number`],`boolean`],EPDFAnnot_ClearBorderEffect:[[`number`],`boolean`],EPDFAnnot_ClearColor:[[`number`,`number`],`boolean`],EPDFAnnot_ClearMKColor:[[`number`,`number`],`boolean`],EPDFAnnot_ClearRectangleDifferences:[[`number`],`boolean`],EPDFAnnot_ExportAppearanceAsDocument:[[`number`],`number`],EPDFAnnot_ExportMultipleAppearancesAsDocument:[[`number`,`number`],`number`],EPDFAnnot_Flatten:[[`number`,`number`],`boolean`],EPDFAnnot_GenerateAppearance:[[`number`],`boolean`],EPDFAnnot_GenerateAppearanceWithBlend:[[`number`,`number`],`boolean`],EPDFAnnot_GenerateFormFieldAP:[[`number`],`boolean`],EPDFAnnot_GetAPMatrix:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_GetAvailableAppearanceModes:[[`number`],`number`],EPDFAnnot_GetBlendMode:[[`number`],`number`],EPDFAnnot_GetBorderDashPattern:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_GetBorderDashPatternCount:[[`number`],`number`],EPDFAnnot_GetBorderEffect:[[`number`,`number`],`boolean`],EPDFAnnot_GetBorderStyle:[[`number`,`number`],`number`],EPDFAnnot_GetButtonExportValue:[[`number`,`number`,`number`],`number`],EPDFAnnot_GetCalloutLine:[[`number`,`number`,`number`],`number`],EPDFAnnot_GetCalloutLineCount:[[`number`],`number`],EPDFAnnot_GetColor:[[`number`,`number`,`number`,`number`,`number`],`boolean`],EPDFAnnot_GetDefaultAppearance:[[`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],EPDFAnnot_GetExtendedRotation:[[`number`,`number`],`boolean`],EPDFAnnot_GetFormFieldObjectNumber:[[`number`,`number`],`number`],EPDFAnnot_GetFormFieldRawValue:[[`number`,`number`,`number`,`number`],`number`],EPDFAnnot_GetIntent:[[`number`,`number`,`number`],`number`],EPDFAnnot_GetLineEndings:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_GetMKColor:[[`number`,`number`,`number`,`number`,`number`],`boolean`],EPDFAnnot_GetName:[[`number`],`number`],EPDFAnnot_GetObjectNumber:[[`number`],`number`],EPDFAnnot_GetOpacity:[[`number`,`number`],`boolean`],EPDFAnnot_GetOverlayText:[[`number`,`number`,`number`],`number`],EPDFAnnot_GetOverlayTextRepeat:[[`number`],`boolean`],EPDFAnnot_GetRect:[[`number`,`number`],`boolean`],EPDFAnnot_GetRectangleDifferences:[[`number`,`number`,`number`,`number`,`number`],`boolean`],EPDFAnnot_GetReplyType:[[`number`],`number`],EPDFAnnot_GetRichContent:[[`number`,`number`,`number`],`number`],EPDFAnnot_GetRotate:[[`number`,`number`],`boolean`],EPDFAnnot_GetTextAlignment:[[`number`],`number`],EPDFAnnot_GetUnrotatedRect:[[`number`,`number`],`boolean`],EPDFAnnot_GetVerticalAlignment:[[`number`],`number`],EPDFAnnot_HasAppearanceStream:[[`number`,`number`],`boolean`],EPDFAnnot_SetAction:[[`number`,`number`],`boolean`],EPDFAnnot_SetAPMatrix:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_SetAppearanceFromPage:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_SetBorderDashPattern:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_SetBorderEffect:[[`number`,`number`],`boolean`],EPDFAnnot_SetBorderStyle:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_SetCalloutLine:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_SetColor:[[`number`,`number`,`number`,`number`,`number`],`boolean`],EPDFAnnot_SetDefaultAppearance:[[`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],EPDFAnnot_SetExtendedRotation:[[`number`,`number`],`boolean`],EPDFAnnot_SetFormFieldName:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_SetFormFieldOptions:[[`number`,`number`,`number`,`number`],`boolean`],EPDFAnnot_SetFormFieldValue:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_SetIntent:[[`number`,`string`],`boolean`],EPDFAnnot_SetLine:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_SetLineEndings:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_SetLinkedAnnot:[[`number`,`string`,`number`],`boolean`],EPDFAnnot_SetMKColor:[[`number`,`number`,`number`,`number`,`number`],`boolean`],EPDFAnnot_SetName:[[`number`,`number`],`boolean`],EPDFAnnot_SetNumberValue:[[`number`,`string`,`number`],`boolean`],EPDFAnnot_SetOpacity:[[`number`,`number`],`boolean`],EPDFAnnot_SetOverlayText:[[`number`,`number`],`boolean`],EPDFAnnot_SetOverlayTextRepeat:[[`number`,`boolean`],`boolean`],EPDFAnnot_SetRectangleDifferences:[[`number`,`number`,`number`,`number`,`number`],`boolean`],EPDFAnnot_SetReplyType:[[`number`,`number`],`boolean`],EPDFAnnot_SetRotate:[[`number`,`number`],`boolean`],EPDFAnnot_SetTextAlignment:[[`number`,`number`],`boolean`],EPDFAnnot_SetUnrotatedRect:[[`number`,`number`],`boolean`],EPDFAnnot_SetVerticalAlignment:[[`number`,`number`],`boolean`],EPDFAnnot_SetVertices:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_ShareFormField:[[`number`,`number`,`number`],`boolean`],EPDFAnnot_UpdateAppearanceToRect:[[`number`,`number`],`boolean`],EPDFAttachment_GetDescription:[[`number`,`number`,`number`],`number`],EPDFAttachment_GetIntegerValue:[[`number`,`string`,`number`],`boolean`],EPDFAttachment_SetDescription:[[`number`,`number`],`boolean`],EPDFAttachment_SetSubtype:[[`number`,`string`],`boolean`],EPDFBookmark_AppendChild:[[`number`,`number`,`number`],`number`],EPDFBookmark_Clear:[[`number`],`boolean`],EPDFBookmark_ClearTarget:[[`number`],`boolean`],EPDFBookmark_Create:[[`number`,`number`],`number`],EPDFBookmark_Delete:[[`number`,`number`],`boolean`],EPDFBookmark_InsertAfter:[[`number`,`number`,`number`,`number`],`number`],EPDFBookmark_SetAction:[[`number`,`number`,`number`],`boolean`],EPDFBookmark_SetDest:[[`number`,`number`,`number`],`boolean`],EPDFBookmark_SetTitle:[[`number`,`number`],`boolean`],EPDFCatalog_GetLanguage:[[`number`,`number`,`number`],`number`],EPDFDest_CreateRemoteView:[[`number`,`number`,`number`,`number`,`number`],`number`],EPDFDest_CreateRemoteXYZ:[[`number`,`number`,`boolean`,`number`,`boolean`,`number`,`boolean`,`number`],`number`],EPDFDest_CreateView:[[`number`,`number`,`number`,`number`],`number`],EPDFDest_CreateXYZ:[[`number`,`boolean`,`number`,`boolean`,`number`,`boolean`,`number`],`number`],EPDFDoc_GetPageObjectNumberByIndex:[[`number`,`number`],`number`],EPDFDoc_LoadPageByObjectNumber:[[`number`,`number`],`number`],EPDFImageObj_SetJpeg:[[`number`,`number`,`number`,`number`,`number`],`boolean`],EPDFImageObj_SetPng:[[`number`,`number`,`number`,`number`,`number`],`boolean`],EPDFNamedDest_Remove:[[`number`,`string`],`boolean`],EPDFNamedDest_SetDest:[[`number`,`string`,`number`],`boolean`],EPDFPage_ApplyRedactions:[[`number`],`boolean`],EPDFPage_CreateAnnot:[[`number`,`number`],`number`],EPDFPage_CreateFormField:[[`number`,`number`,`number`,`number`],`number`],EPDFPage_GetAnnotByName:[[`number`,`number`],`number`],EPDFPage_GetAnnotByObjectNumber:[[`number`,`number`],`number`],EPDFPage_GetAnnotCountRaw:[[`number`,`number`],`number`],EPDFPage_GetAnnotRaw:[[`number`,`number`,`number`],`number`],EPDFPage_GetObjectNumber:[[`number`],`number`],EPDFPage_MoveAnnots:[[`number`,`number`,`number`,`number`],`boolean`],EPDFPage_RemoveAnnot:[[`number`,`number`],`boolean`],EPDFPage_RemoveAnnotByName:[[`number`,`number`],`boolean`],EPDFPage_RemoveAnnotByObjectNumber:[[`number`,`number`],`boolean`],EPDFPage_RemoveAnnotRaw:[[`number`,`number`,`number`],`boolean`],EPDFText_RedactInQuads:[[`number`,`number`,`number`,`boolean`,`boolean`],`boolean`],EPDFText_RedactInRect:[[`number`,`number`,`boolean`,`boolean`],`boolean`],FORM_CanRedo:[[`number`,`number`],`boolean`],FORM_CanUndo:[[`number`,`number`],`boolean`],FORM_DoDocumentAAction:[[`number`,`number`],null],FORM_DoDocumentJSAction:[[`number`],null],FORM_DoDocumentOpenAction:[[`number`],null],FORM_DoPageAAction:[[`number`,`number`,`number`],null],FORM_ForceToKillFocus:[[`number`],`boolean`],FORM_GetFocusedAnnot:[[`number`,`number`,`number`],`boolean`],FORM_GetFocusedText:[[`number`,`number`,`number`,`number`],`number`],FORM_GetSelectedText:[[`number`,`number`,`number`,`number`],`number`],FORM_IsIndexSelected:[[`number`,`number`,`number`],`boolean`],FORM_OnAfterLoadPage:[[`number`,`number`],null],FORM_OnBeforeClosePage:[[`number`,`number`],null],FORM_OnChar:[[`number`,`number`,`number`,`number`],`boolean`],FORM_OnFocus:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FORM_OnKeyDown:[[`number`,`number`,`number`,`number`],`boolean`],FORM_OnKeyUp:[[`number`,`number`,`number`,`number`],`boolean`],FORM_OnLButtonDoubleClick:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FORM_OnLButtonDown:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FORM_OnLButtonUp:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FORM_OnMouseMove:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FORM_OnMouseWheel:[[`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FORM_OnRButtonDown:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FORM_OnRButtonUp:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FORM_Redo:[[`number`,`number`],`boolean`],FORM_ReplaceAndKeepSelection:[[`number`,`number`,`number`],null],FORM_ReplaceSelection:[[`number`,`number`,`number`],null],FORM_SelectAllText:[[`number`,`number`],`boolean`],FORM_SetFocusedAnnot:[[`number`,`number`],`boolean`],FORM_SetIndexSelected:[[`number`,`number`,`number`,`boolean`],`boolean`],FORM_Undo:[[`number`,`number`],`boolean`],FPDF_AddInstalledFont:[[`number`,`number`,`number`],null],FPDF_CloseDocument:[[`number`],null],FPDF_ClosePage:[[`number`],null],FPDF_CloseXObject:[[`number`],null],FPDF_CopyViewerPreferences:[[`number`,`number`],`boolean`],FPDF_CountNamedDests:[[`number`],`number`],FPDF_CreateClipPath:[[`number`,`number`,`number`,`number`],`number`],FPDF_CreateNewDocument:[[],`number`],FPDF_DestroyClipPath:[[`number`],null],FPDF_DestroyLibrary:[[],null],FPDF_DeviceToPage:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FPDF_DocumentHasValidCrossReferenceTable:[[`number`],`boolean`],FPDF_FFLDraw:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`],null],FPDF_FreeDefaultSystemFontInfo:[[`number`],null],FPDF_GetDefaultSystemFontInfo:[[],`number`],FPDF_GetDefaultTTFMap:[[],`number`],FPDF_GetDefaultTTFMapCount:[[],`number`],FPDF_GetDefaultTTFMapEntry:[[`number`],`number`],FPDF_GetDocPermissions:[[`number`],`number`],FPDF_GetDocUserPermissions:[[`number`],`number`],FPDF_GetFileIdentifier:[[`number`,`number`,`number`,`number`],`number`],FPDF_GetFileVersion:[[`number`,`number`],`boolean`],FPDF_GetFormType:[[`number`],`number`],FPDF_GetLastError:[[],`number`],FPDF_GetMetaText:[[`number`,`string`,`number`,`number`],`number`],FPDF_GetNamedDest:[[`number`,`number`,`number`,`number`],`number`],FPDF_GetNamedDestByName:[[`number`,`string`],`number`],FPDF_GetPageAAction:[[`number`,`number`],`number`],FPDF_GetPageBoundingBox:[[`number`,`number`],`boolean`],FPDF_GetPageCount:[[`number`],`number`],FPDF_GetPageHeight:[[`number`],`number`],FPDF_GetPageHeightF:[[`number`],`number`],FPDF_GetPageLabel:[[`number`,`number`,`number`,`number`],`number`],FPDF_GetPageSizeByIndex:[[`number`,`number`,`number`,`number`],`number`],FPDF_GetPageSizeByIndexF:[[`number`,`number`,`number`],`boolean`],FPDF_GetPageWidth:[[`number`],`number`],FPDF_GetPageWidthF:[[`number`],`number`],FPDF_GetSecurityHandlerRevision:[[`number`],`number`],FPDF_GetSignatureCount:[[`number`],`number`],FPDF_GetSignatureObject:[[`number`,`number`],`number`],FPDF_GetTrailerEnds:[[`number`,`number`,`number`],`number`],FPDF_GetXFAPacketContent:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDF_GetXFAPacketCount:[[`number`],`number`],FPDF_GetXFAPacketName:[[`number`,`number`,`number`,`number`],`number`],FPDF_ImportNPagesToOne:[[`number`,`number`,`number`,`number`,`number`],`number`],FPDF_ImportPages:[[`number`,`number`,`string`,`number`],`boolean`],FPDF_ImportPagesByIndex:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDF_InitLibrary:[[],null],FPDF_InitLibraryWithConfig:[[`number`],null],FPDF_LoadCustomDocument:[[`number`,`string`],`number`],FPDF_LoadDocument:[[`number`,`string`],`number`],FPDF_LoadMemDocument:[[`number`,`number`,`string`],`number`],FPDF_LoadMemDocument64:[[`number`,`number`,`string`],`number`],FPDF_LoadPage:[[`number`,`number`],`number`],FPDF_LoadXFA:[[`number`],`boolean`],FPDF_MovePages:[[`number`,`number`,`number`,`number`],`boolean`],FPDF_NewFormObjectFromXObject:[[`number`],`number`],FPDF_NewXObjectFromPage:[[`number`,`number`,`number`],`number`],FPDF_PageToDevice:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FPDF_RemoveFormFieldHighlight:[[`number`],null],FPDF_RenderPage_Close:[[`number`],null],FPDF_RenderPage_Continue:[[`number`,`number`],`number`],FPDF_RenderPageBitmap:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`],null],FPDF_RenderPageBitmap_Start:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`],`number`],FPDF_RenderPageBitmapWithColorScheme_Start:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`],`number`],FPDF_RenderPageBitmapWithMatrix:[[`number`,`number`,`number`,`number`,`number`],null],FPDF_SaveAsCopy:[[`number`,`number`,`number`],`boolean`],FPDF_SaveWithVersion:[[`number`,`number`,`number`,`number`],`boolean`],FPDF_SetFormFieldHighlightAlpha:[[`number`,`number`],null],FPDF_SetFormFieldHighlightColor:[[`number`,`number`,`number`],null],FPDF_SetSandBoxPolicy:[[`number`,`boolean`],null],FPDF_SetSystemFontInfo:[[`number`],null],FPDF_StructElement_Attr_CountChildren:[[`number`],`number`],FPDF_StructElement_Attr_GetBlobValue:[[`number`,`number`,`number`,`number`],`boolean`],FPDF_StructElement_Attr_GetBooleanValue:[[`number`,`number`],`boolean`],FPDF_StructElement_Attr_GetChildAtIndex:[[`number`,`number`],`number`],FPDF_StructElement_Attr_GetCount:[[`number`],`number`],FPDF_StructElement_Attr_GetName:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDF_StructElement_Attr_GetNumberValue:[[`number`,`number`],`boolean`],FPDF_StructElement_Attr_GetStringValue:[[`number`,`number`,`number`,`number`],`boolean`],FPDF_StructElement_Attr_GetType:[[`number`],`number`],FPDF_StructElement_Attr_GetValue:[[`number`,`string`],`number`],FPDF_StructElement_CountChildren:[[`number`],`number`],FPDF_StructElement_GetActualText:[[`number`,`number`,`number`],`number`],FPDF_StructElement_GetAltText:[[`number`,`number`,`number`],`number`],FPDF_StructElement_GetAttributeAtIndex:[[`number`,`number`],`number`],FPDF_StructElement_GetAttributeCount:[[`number`],`number`],FPDF_StructElement_GetChildAtIndex:[[`number`,`number`],`number`],FPDF_StructElement_GetChildMarkedContentID:[[`number`,`number`],`number`],FPDF_StructElement_GetID:[[`number`,`number`,`number`],`number`],FPDF_StructElement_GetLang:[[`number`,`number`,`number`],`number`],FPDF_StructElement_GetMarkedContentID:[[`number`],`number`],FPDF_StructElement_GetMarkedContentIdAtIndex:[[`number`,`number`],`number`],FPDF_StructElement_GetMarkedContentIdCount:[[`number`],`number`],FPDF_StructElement_GetObjType:[[`number`,`number`,`number`],`number`],FPDF_StructElement_GetParent:[[`number`],`number`],FPDF_StructElement_GetStringAttribute:[[`number`,`string`,`number`,`number`],`number`],FPDF_StructElement_GetTitle:[[`number`,`number`,`number`],`number`],FPDF_StructElement_GetType:[[`number`,`number`,`number`],`number`],FPDF_StructTree_Close:[[`number`],null],FPDF_StructTree_CountChildren:[[`number`],`number`],FPDF_StructTree_GetChildAtIndex:[[`number`,`number`],`number`],FPDF_StructTree_GetForPage:[[`number`],`number`],FPDF_VIEWERREF_GetDuplex:[[`number`],`number`],FPDF_VIEWERREF_GetName:[[`number`,`string`,`number`,`number`],`number`],FPDF_VIEWERREF_GetNumCopies:[[`number`],`number`],FPDF_VIEWERREF_GetPrintPageRange:[[`number`],`number`],FPDF_VIEWERREF_GetPrintPageRangeCount:[[`number`],`number`],FPDF_VIEWERREF_GetPrintPageRangeElement:[[`number`,`number`],`number`],FPDF_VIEWERREF_GetPrintScaling:[[`number`],`boolean`],FPDFAction_GetDest:[[`number`,`number`],`number`],FPDFAction_GetFilePath:[[`number`,`number`,`number`],`number`],FPDFAction_GetType:[[`number`],`number`],FPDFAction_GetURIPath:[[`number`,`number`,`number`,`number`],`number`],FPDFAnnot_AddFileAttachment:[[`number`,`number`],`number`],FPDFAnnot_AddInkStroke:[[`number`,`number`,`number`],`number`],FPDFAnnot_AppendAttachmentPoints:[[`number`,`number`],`boolean`],FPDFAnnot_AppendObject:[[`number`,`number`],`boolean`],FPDFAnnot_CountAttachmentPoints:[[`number`],`number`],FPDFAnnot_GetAP:[[`number`,`number`,`number`,`number`],`number`],FPDFAnnot_GetAttachmentPoints:[[`number`,`number`,`number`],`boolean`],FPDFAnnot_GetBorder:[[`number`,`number`,`number`,`number`],`boolean`],FPDFAnnot_GetColor:[[`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFAnnot_GetFileAttachment:[[`number`],`number`],FPDFAnnot_GetFlags:[[`number`],`number`],FPDFAnnot_GetFocusableSubtypes:[[`number`,`number`,`number`],`boolean`],FPDFAnnot_GetFocusableSubtypesCount:[[`number`],`number`],FPDFAnnot_GetFontColor:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFAnnot_GetFontSize:[[`number`,`number`,`number`],`boolean`],FPDFAnnot_GetFormAdditionalActionJavaScript:[[`number`,`number`,`number`,`number`,`number`],`number`],FPDFAnnot_GetFormControlCount:[[`number`,`number`],`number`],FPDFAnnot_GetFormControlIndex:[[`number`,`number`],`number`],FPDFAnnot_GetFormFieldAlternateName:[[`number`,`number`,`number`,`number`],`number`],FPDFAnnot_GetFormFieldAtPoint:[[`number`,`number`,`number`],`number`],FPDFAnnot_GetFormFieldExportValue:[[`number`,`number`,`number`,`number`],`number`],FPDFAnnot_GetFormFieldFlags:[[`number`,`number`],`number`],FPDFAnnot_GetFormFieldName:[[`number`,`number`,`number`,`number`],`number`],FPDFAnnot_GetFormFieldType:[[`number`,`number`],`number`],FPDFAnnot_GetFormFieldValue:[[`number`,`number`,`number`,`number`],`number`],FPDFAnnot_GetInkListCount:[[`number`],`number`],FPDFAnnot_GetInkListPath:[[`number`,`number`,`number`,`number`],`number`],FPDFAnnot_GetLine:[[`number`,`number`,`number`],`boolean`],FPDFAnnot_GetLink:[[`number`],`number`],FPDFAnnot_GetLinkedAnnot:[[`number`,`string`],`number`],FPDFAnnot_GetNumberValue:[[`number`,`string`,`number`],`boolean`],FPDFAnnot_GetObject:[[`number`,`number`],`number`],FPDFAnnot_GetObjectCount:[[`number`],`number`],FPDFAnnot_GetOptionCount:[[`number`,`number`],`number`],FPDFAnnot_GetOptionLabel:[[`number`,`number`,`number`,`number`,`number`],`number`],FPDFAnnot_GetRect:[[`number`,`number`],`boolean`],FPDFAnnot_GetStringValue:[[`number`,`string`,`number`,`number`],`number`],FPDFAnnot_GetSubtype:[[`number`],`number`],FPDFAnnot_GetValueType:[[`number`,`string`],`number`],FPDFAnnot_GetVertices:[[`number`,`number`,`number`],`number`],FPDFAnnot_HasAttachmentPoints:[[`number`],`boolean`],FPDFAnnot_HasKey:[[`number`,`string`],`boolean`],FPDFAnnot_IsChecked:[[`number`,`number`],`boolean`],FPDFAnnot_IsObjectSupportedSubtype:[[`number`],`boolean`],FPDFAnnot_IsOptionSelected:[[`number`,`number`,`number`],`boolean`],FPDFAnnot_IsSupportedSubtype:[[`number`],`boolean`],FPDFAnnot_RemoveInkList:[[`number`],`boolean`],FPDFAnnot_RemoveObject:[[`number`,`number`],`boolean`],FPDFAnnot_SetAP:[[`number`,`number`,`number`],`boolean`],FPDFAnnot_SetAttachmentPoints:[[`number`,`number`,`number`],`boolean`],FPDFAnnot_SetBorder:[[`number`,`number`,`number`,`number`],`boolean`],FPDFAnnot_SetColor:[[`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFAnnot_SetFlags:[[`number`,`number`],`boolean`],FPDFAnnot_SetFocusableSubtypes:[[`number`,`number`,`number`],`boolean`],FPDFAnnot_SetFontColor:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFAnnot_SetFormFieldFlags:[[`number`,`number`,`number`],`boolean`],FPDFAnnot_SetRect:[[`number`,`number`],`boolean`],FPDFAnnot_SetStringValue:[[`number`,`string`,`number`],`boolean`],FPDFAnnot_SetURI:[[`number`,`number`],`boolean`],FPDFAnnot_UpdateObject:[[`number`,`number`],`boolean`],FPDFAttachment_GetFile:[[`number`,`number`,`number`,`number`],`boolean`],FPDFAttachment_GetName:[[`number`,`number`,`number`],`number`],FPDFAttachment_GetStringValue:[[`number`,`string`,`number`,`number`],`number`],FPDFAttachment_GetSubtype:[[`number`,`number`,`number`],`number`],FPDFAttachment_GetValueType:[[`number`,`string`],`number`],FPDFAttachment_HasKey:[[`number`,`string`],`boolean`],FPDFAttachment_SetFile:[[`number`,`number`,`number`,`number`],`boolean`],FPDFAttachment_SetStringValue:[[`number`,`string`,`number`],`boolean`],FPDFAvail_Create:[[`number`,`number`],`number`],FPDFAvail_Destroy:[[`number`],null],FPDFAvail_GetDocument:[[`number`,`string`],`number`],FPDFAvail_GetFirstPageNum:[[`number`],`number`],FPDFAvail_IsDocAvail:[[`number`,`number`],`number`],FPDFAvail_IsFormAvail:[[`number`,`number`],`number`],FPDFAvail_IsLinearized:[[`number`],`number`],FPDFAvail_IsPageAvail:[[`number`,`number`,`number`],`number`],FPDFBitmap_Create:[[`number`,`number`,`number`],`number`],FPDFBitmap_CreateEx:[[`number`,`number`,`number`,`number`,`number`],`number`],FPDFBitmap_Destroy:[[`number`],null],FPDFBitmap_FillRect:[[`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFBitmap_GetBuffer:[[`number`],`number`],FPDFBitmap_GetFormat:[[`number`],`number`],FPDFBitmap_GetHeight:[[`number`],`number`],FPDFBitmap_GetStride:[[`number`],`number`],FPDFBitmap_GetWidth:[[`number`],`number`],FPDFBookmark_Find:[[`number`,`number`],`number`],FPDFBookmark_GetAction:[[`number`],`number`],FPDFBookmark_GetCount:[[`number`],`number`],FPDFBookmark_GetDest:[[`number`,`number`],`number`],FPDFBookmark_GetFirstChild:[[`number`,`number`],`number`],FPDFBookmark_GetNextSibling:[[`number`,`number`],`number`],FPDFBookmark_GetTitle:[[`number`,`number`,`number`],`number`],FPDFCatalog_GetLanguage:[[`number`,`number`,`number`],`number`],FPDFCatalog_IsTagged:[[`number`],`boolean`],FPDFCatalog_SetLanguage:[[`number`,`number`],`boolean`],FPDFClipPath_CountPaths:[[`number`],`number`],FPDFClipPath_CountPathSegments:[[`number`,`number`],`number`],FPDFClipPath_GetPathSegment:[[`number`,`number`,`number`],`number`],FPDFDest_GetDestPageIndex:[[`number`,`number`],`number`],FPDFDest_GetLocationInPage:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFDest_GetView:[[`number`,`number`,`number`],`number`],FPDFDoc_AddAttachment:[[`number`,`number`],`number`],FPDFDoc_CloseJavaScriptAction:[[`number`],null],FPDFDoc_DeleteAttachment:[[`number`,`number`],`boolean`],FPDFDOC_ExitFormFillEnvironment:[[`number`],null],FPDFDoc_GetAttachment:[[`number`,`number`],`number`],FPDFDoc_GetAttachmentCount:[[`number`],`number`],FPDFDoc_GetJavaScriptAction:[[`number`,`number`],`number`],FPDFDoc_GetJavaScriptActionCount:[[`number`],`number`],FPDFDoc_GetPageMode:[[`number`],`number`],FPDFDOC_InitFormFillEnvironment:[[`number`,`number`],`number`],FPDFFont_Close:[[`number`],null],FPDFFont_GetAscent:[[`number`,`number`,`number`],`boolean`],FPDFFont_GetBaseFontName:[[`number`,`number`,`number`],`number`],FPDFFont_GetDescent:[[`number`,`number`,`number`],`boolean`],FPDFFont_GetFamilyName:[[`number`,`number`,`number`],`number`],FPDFFont_GetFlags:[[`number`],`number`],FPDFFont_GetFontData:[[`number`,`number`,`number`,`number`],`boolean`],FPDFFont_GetGlyphPath:[[`number`,`number`,`number`],`number`],FPDFFont_GetGlyphWidth:[[`number`,`number`,`number`,`number`],`boolean`],FPDFFont_GetIsEmbedded:[[`number`],`number`],FPDFFont_GetItalicAngle:[[`number`,`number`],`boolean`],FPDFFont_GetWeight:[[`number`],`number`],FPDFFormObj_CountObjects:[[`number`],`number`],FPDFFormObj_GetObject:[[`number`,`number`],`number`],FPDFFormObj_RemoveObject:[[`number`,`number`],`boolean`],FPDFGlyphPath_CountGlyphSegments:[[`number`],`number`],FPDFGlyphPath_GetGlyphPathSegment:[[`number`,`number`],`number`],FPDFImageObj_GetBitmap:[[`number`],`number`],FPDFImageObj_GetIccProfileDataDecoded:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFImageObj_GetImageDataDecoded:[[`number`,`number`,`number`],`number`],FPDFImageObj_GetImageDataRaw:[[`number`,`number`,`number`],`number`],FPDFImageObj_GetImageFilter:[[`number`,`number`,`number`,`number`],`number`],FPDFImageObj_GetImageFilterCount:[[`number`],`number`],FPDFImageObj_GetImageMetadata:[[`number`,`number`,`number`],`boolean`],FPDFImageObj_GetImagePixelSize:[[`number`,`number`,`number`],`boolean`],FPDFImageObj_GetRenderedBitmap:[[`number`,`number`,`number`],`number`],FPDFImageObj_LoadJpegFile:[[`number`,`number`,`number`,`number`],`boolean`],FPDFImageObj_LoadJpegFileInline:[[`number`,`number`,`number`,`number`],`boolean`],FPDFImageObj_SetBitmap:[[`number`,`number`,`number`,`number`],`boolean`],FPDFImageObj_SetMatrix:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFJavaScriptAction_GetName:[[`number`,`number`,`number`],`number`],FPDFJavaScriptAction_GetScript:[[`number`,`number`,`number`],`number`],FPDFLink_CloseWebLinks:[[`number`],null],FPDFLink_CountQuadPoints:[[`number`],`number`],FPDFLink_CountRects:[[`number`,`number`],`number`],FPDFLink_CountWebLinks:[[`number`],`number`],FPDFLink_Enumerate:[[`number`,`number`,`number`],`boolean`],FPDFLink_GetAction:[[`number`],`number`],FPDFLink_GetAnnot:[[`number`,`number`],`number`],FPDFLink_GetAnnotRect:[[`number`,`number`],`boolean`],FPDFLink_GetDest:[[`number`,`number`],`number`],FPDFLink_GetLinkAtPoint:[[`number`,`number`,`number`],`number`],FPDFLink_GetLinkZOrderAtPoint:[[`number`,`number`,`number`],`number`],FPDFLink_GetQuadPoints:[[`number`,`number`,`number`],`boolean`],FPDFLink_GetRect:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFLink_GetTextRange:[[`number`,`number`,`number`,`number`],`boolean`],FPDFLink_GetURL:[[`number`,`number`,`number`,`number`],`number`],FPDFLink_LoadWebLinks:[[`number`],`number`],FPDFPage_CloseAnnot:[[`number`],null],FPDFPage_CountObjects:[[`number`],`number`],FPDFPage_CreateAnnot:[[`number`,`number`],`number`],FPDFPage_Delete:[[`number`,`number`],null],FPDFPage_Flatten:[[`number`,`number`],`number`],FPDFPage_FormFieldZOrderAtPoint:[[`number`,`number`,`number`,`number`],`number`],FPDFPage_GenerateContent:[[`number`],`boolean`],FPDFPage_GetAnnot:[[`number`,`number`],`number`],FPDFPage_GetAnnotCount:[[`number`],`number`],FPDFPage_GetAnnotIndex:[[`number`,`number`],`number`],FPDFPage_GetArtBox:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFPage_GetBleedBox:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFPage_GetCropBox:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFPage_GetDecodedThumbnailData:[[`number`,`number`,`number`],`number`],FPDFPage_GetMediaBox:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFPage_GetObject:[[`number`,`number`],`number`],FPDFPage_GetRawThumbnailData:[[`number`,`number`,`number`],`number`],FPDFPage_GetRotation:[[`number`],`number`],FPDFPage_GetThumbnailAsBitmap:[[`number`],`number`],FPDFPage_GetTrimBox:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFPage_HasFormFieldAtPoint:[[`number`,`number`,`number`,`number`],`number`],FPDFPage_HasTransparency:[[`number`],`boolean`],FPDFPage_InsertClipPath:[[`number`,`number`],null],FPDFPage_InsertObject:[[`number`,`number`],null],FPDFPage_InsertObjectAtIndex:[[`number`,`number`,`number`],`boolean`],FPDFPage_New:[[`number`,`number`,`number`,`number`],`number`],FPDFPage_RemoveAnnot:[[`number`,`number`],`boolean`],FPDFPage_RemoveObject:[[`number`,`number`],`boolean`],FPDFPage_SetArtBox:[[`number`,`number`,`number`,`number`,`number`],null],FPDFPage_SetBleedBox:[[`number`,`number`,`number`,`number`,`number`],null],FPDFPage_SetCropBox:[[`number`,`number`,`number`,`number`,`number`],null],FPDFPage_SetMediaBox:[[`number`,`number`,`number`,`number`,`number`],null],FPDFPage_SetRotation:[[`number`,`number`],null],FPDFPage_SetTrimBox:[[`number`,`number`,`number`,`number`,`number`],null],FPDFPage_TransformAnnots:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`],null],FPDFPage_TransFormWithClip:[[`number`,`number`,`number`],`boolean`],FPDFPageObj_AddMark:[[`number`,`string`],`number`],FPDFPageObj_CountMarks:[[`number`],`number`],FPDFPageObj_CreateNewPath:[[`number`,`number`],`number`],FPDFPageObj_CreateNewRect:[[`number`,`number`,`number`,`number`],`number`],FPDFPageObj_CreateTextObj:[[`number`,`number`,`number`],`number`],FPDFPageObj_Destroy:[[`number`],null],FPDFPageObj_GetBounds:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFPageObj_GetClipPath:[[`number`],`number`],FPDFPageObj_GetDashArray:[[`number`,`number`,`number`],`boolean`],FPDFPageObj_GetDashCount:[[`number`],`number`],FPDFPageObj_GetDashPhase:[[`number`,`number`],`boolean`],FPDFPageObj_GetFillColor:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFPageObj_GetIsActive:[[`number`,`number`],`boolean`],FPDFPageObj_GetLineCap:[[`number`],`number`],FPDFPageObj_GetLineJoin:[[`number`],`number`],FPDFPageObj_GetMark:[[`number`,`number`],`number`],FPDFPageObj_GetMarkedContentID:[[`number`],`number`],FPDFPageObj_GetMatrix:[[`number`,`number`],`boolean`],FPDFPageObj_GetRotatedBounds:[[`number`,`number`],`boolean`],FPDFPageObj_GetStrokeColor:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFPageObj_GetStrokeWidth:[[`number`,`number`],`boolean`],FPDFPageObj_GetType:[[`number`],`number`],FPDFPageObj_HasTransparency:[[`number`],`boolean`],FPDFPageObj_NewImageObj:[[`number`],`number`],FPDFPageObj_NewTextObj:[[`number`,`string`,`number`],`number`],FPDFPageObj_RemoveMark:[[`number`,`number`],`boolean`],FPDFPageObj_SetBlendMode:[[`number`,`string`],null],FPDFPageObj_SetDashArray:[[`number`,`number`,`number`,`number`],`boolean`],FPDFPageObj_SetDashPhase:[[`number`,`number`],`boolean`],FPDFPageObj_SetFillColor:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFPageObj_SetIsActive:[[`number`,`boolean`],`boolean`],FPDFPageObj_SetLineCap:[[`number`,`number`],`boolean`],FPDFPageObj_SetLineJoin:[[`number`,`number`],`boolean`],FPDFPageObj_SetMatrix:[[`number`,`number`],`boolean`],FPDFPageObj_SetStrokeColor:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFPageObj_SetStrokeWidth:[[`number`,`number`],`boolean`],FPDFPageObj_Transform:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`],null],FPDFPageObj_TransformClipPath:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`],null],FPDFPageObj_TransformF:[[`number`,`number`],`boolean`],FPDFPageObjMark_CountParams:[[`number`],`number`],FPDFPageObjMark_GetName:[[`number`,`number`,`number`,`number`],`boolean`],FPDFPageObjMark_GetParamBlobValue:[[`number`,`string`,`number`,`number`,`number`],`boolean`],FPDFPageObjMark_GetParamFloatValue:[[`number`,`string`,`number`],`boolean`],FPDFPageObjMark_GetParamIntValue:[[`number`,`string`,`number`],`boolean`],FPDFPageObjMark_GetParamKey:[[`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFPageObjMark_GetParamStringValue:[[`number`,`string`,`number`,`number`,`number`],`boolean`],FPDFPageObjMark_GetParamValueType:[[`number`,`string`],`number`],FPDFPageObjMark_RemoveParam:[[`number`,`number`,`string`],`boolean`],FPDFPageObjMark_SetBlobParam:[[`number`,`number`,`number`,`string`,`number`,`number`],`boolean`],FPDFPageObjMark_SetFloatParam:[[`number`,`number`,`number`,`string`,`number`],`boolean`],FPDFPageObjMark_SetIntParam:[[`number`,`number`,`number`,`string`,`number`],`boolean`],FPDFPageObjMark_SetStringParam:[[`number`,`number`,`number`,`string`,`string`],`boolean`],FPDFPath_BezierTo:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFPath_Close:[[`number`],`boolean`],FPDFPath_CountSegments:[[`number`],`number`],FPDFPath_GetDrawMode:[[`number`,`number`,`number`],`boolean`],FPDFPath_GetPathSegment:[[`number`,`number`],`number`],FPDFPath_LineTo:[[`number`,`number`,`number`],`boolean`],FPDFPath_MoveTo:[[`number`,`number`,`number`],`boolean`],FPDFPath_SetDrawMode:[[`number`,`number`,`boolean`],`boolean`],FPDFPathSegment_GetClose:[[`number`],`boolean`],FPDFPathSegment_GetPoint:[[`number`,`number`,`number`],`boolean`],FPDFPathSegment_GetType:[[`number`],`number`],FPDFSignatureObj_GetByteRange:[[`number`,`number`,`number`],`number`],FPDFSignatureObj_GetContents:[[`number`,`number`,`number`],`number`],FPDFSignatureObj_GetDocMDPPermission:[[`number`],`number`],FPDFSignatureObj_GetReason:[[`number`,`number`,`number`],`number`],FPDFSignatureObj_GetSubFilter:[[`number`,`number`,`number`],`number`],FPDFSignatureObj_GetTime:[[`number`,`number`,`number`],`number`],FPDFText_ClosePage:[[`number`],null],FPDFText_CountChars:[[`number`],`number`],FPDFText_CountRects:[[`number`,`number`,`number`],`number`],FPDFText_FindClose:[[`number`],null],FPDFText_FindNext:[[`number`],`boolean`],FPDFText_FindPrev:[[`number`],`boolean`],FPDFText_FindStart:[[`number`,`number`,`number`,`number`],`number`],FPDFText_GetBoundedText:[[`number`,`number`,`number`,`number`,`number`,`number`,`number`],`number`],FPDFText_GetCharAngle:[[`number`,`number`],`number`],FPDFText_GetCharBox:[[`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFText_GetCharIndexAtPos:[[`number`,`number`,`number`,`number`,`number`],`number`],FPDFText_GetCharIndexFromTextIndex:[[`number`,`number`],`number`],FPDFText_GetCharOrigin:[[`number`,`number`,`number`,`number`],`boolean`],FPDFText_GetFillColor:[[`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFText_GetFontInfo:[[`number`,`number`,`number`,`number`,`number`],`number`],FPDFText_GetFontSize:[[`number`,`number`],`number`],FPDFText_GetFontWeight:[[`number`,`number`],`number`],FPDFText_GetLooseCharBox:[[`number`,`number`,`number`],`boolean`],FPDFText_GetMatrix:[[`number`,`number`,`number`],`boolean`],FPDFText_GetRect:[[`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFText_GetSchCount:[[`number`],`number`],FPDFText_GetSchResultIndex:[[`number`],`number`],FPDFText_GetStrokeColor:[[`number`,`number`,`number`,`number`,`number`,`number`],`boolean`],FPDFText_GetText:[[`number`,`number`,`number`,`number`],`number`],FPDFText_GetTextIndexFromCharIndex:[[`number`,`number`],`number`],FPDFText_GetTextObject:[[`number`,`number`],`number`],FPDFText_GetUnicode:[[`number`,`number`],`number`],FPDFText_HasUnicodeMapError:[[`number`,`number`],`number`],FPDFText_IsGenerated:[[`number`,`number`],`number`],FPDFText_IsHyphen:[[`number`,`number`],`number`],FPDFText_LoadCidType2Font:[[`number`,`number`,`number`,`string`,`number`,`number`],`number`],FPDFText_LoadFont:[[`number`,`number`,`number`,`number`,`boolean`],`number`],FPDFText_LoadPage:[[`number`],`number`],FPDFText_LoadStandardFont:[[`number`,`string`],`number`],FPDFText_SetCharcodes:[[`number`,`number`,`number`],`boolean`],FPDFText_SetText:[[`number`,`number`],`boolean`],FPDFTextObj_GetFont:[[`number`],`number`],FPDFTextObj_GetFontSize:[[`number`,`number`],`boolean`],FPDFTextObj_GetRenderedBitmap:[[`number`,`number`,`number`,`number`],`number`],FPDFTextObj_GetText:[[`number`,`number`,`number`,`number`],`number`],FPDFTextObj_GetTextRenderMode:[[`number`],`number`],FPDFTextObj_SetTextRenderMode:[[`number`,`number`],`boolean`],PDFiumExt_CloseFileWriter:[[`number`],null],PDFiumExt_CloseFormFillInfo:[[`number`],null],PDFiumExt_ExitFormFillEnvironment:[[`number`],null],PDFiumExt_GetFileWriterData:[[`number`,`number`,`number`],`number`],PDFiumExt_GetFileWriterSize:[[`number`],`number`],PDFiumExt_Init:[[],null],PDFiumExt_InitFormFillEnvironment:[[`number`,`number`],`number`],PDFiumExt_OpenFileWriter:[[],`number`],PDFiumExt_OpenFormFillInfo:[[],`number`],PDFiumExt_SaveAsCopy:[[`number`,`number`],`number`]};async function I(e){return async function(e){let t={pdfium:e};for(let n in ce){let r=n,i=ce[r][0],a=ce[r][1];t[r]=e.cwrap(n,a,i)}return t}(await se(e))}function L(e,t,n,r=100){let i=e.wasmExports.malloc(r);for(let t=0;t<r;t++)e.HEAP8[i+t]=0;let a=t(i,r),o;if(a>r){e.wasmExports.free(i),i=e.wasmExports.malloc(a);for(let t=0;t<a;t++)e.HEAP8[i+t]=0;t(i,a),o=n(i)}else o=n(i);return e.wasmExports.free(i),o}function R(e,t){let n=t(0,0),r=e.wasmExports.malloc(n);t(r,n);let i=new ArrayBuffer(n),a=new DataView(i);for(let t=0;t<n;t++)a.setInt8(t,e.getValue(r+t,`i8`));return e.wasmExports.free(r),i}var z=new Set([`Title`,`Author`,`Subject`,`Keywords`,`Producer`,`Creator`,`CreationDate`,`ModDate`,`Trapped`]);function le(e){if(!e||e.length>127||z.has(e)||e[0]===`/`)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n>126)return!1}return!0}var ue=e=>e,B={pageTtl:5e3,maxPagesPerDocument:10,normalizeRotation:!1},de=class{constructor(e,t,n={}){this.pdfium=e,this.memoryManager=t,this.docs=new Map,this.config={...B,...n}}setDocument(e,t,n,r=!1){let i=this.docs.get(e);if(!i){let a={...this.config,normalizeRotation:r};i=new fe(t,n,this.pdfium,this.memoryManager,a),this.docs.set(e,i)}}getContext(e){return this.docs.get(e)}closeDocument(e){let t=this.docs.get(e);return!!t&&(this.docs.delete(e),t.dispose(),!0)}closeAllDocuments(){for(let e of this.docs.values())e.dispose();this.docs.clear()}updateConfig(e){Object.assign(this.config,e);for(let e of this.docs.values())e.updateConfig(this.config)}getCacheStats(){let e={},t=0;for(let[n,r]of this.docs.entries()){let i=r.getCacheSize();e[n]=i,t+=i}return{documents:this.docs.size,totalPages:t,pagesByDocument:e}}},fe=class{constructor(e,t,n,r,i){this.filePtr=e,this.docPtr=t,this.memoryManager=r,this.disposed=!1,this.normalizeRotation=i.normalizeRotation,this.pageCache=new pe(n,t,i)}acquirePage(e){return this.pageCache.acquire(e)}borrowPage(e,t){return this.pageCache.borrowPage(e,t)}updateConfig(e){this.pageCache.updateConfig(e)}getCacheSize(){return this.pageCache.size()}dispose(){this.disposed||(this.disposed=!0,this.pageCache.forceReleaseAll(),this.pageCache.pdf.FPDF_CloseDocument(this.docPtr),this.memoryManager.free(this.filePtr))}},pe=class{constructor(e,t,n){this.pdf=e,this.docPtr=t,this.cache=new Map,this.accessOrder=[],this.config=n}acquire(e){let t=this.cache.get(e);if(!t){let n;this.evictIfNeeded(),n=this.config.normalizeRotation?this.pdf.EPDF_LoadPageNormalized(this.docPtr,e,0):this.pdf.FPDF_LoadPage(this.docPtr,e),t=new me(this.pdf,this.docPtr,e,n,this.config.pageTtl,()=>{this.cache.delete(e),this.removeFromAccessOrder(e)}),this.cache.set(e,t)}return this.updateAccessOrder(e),t.clearExpiryTimer(),t.bumpRefCount(),t}borrowPage(e,t){let n=this.cache.has(e),r=this.acquire(e);try{return t(r)}finally{n?r.release():r.disposeImmediate()}}forceReleaseAll(){for(let e of this.cache.values())e.disposeImmediate();this.cache.clear(),this.accessOrder.length=0}updateConfig(e){this.config=e;for(let t of this.cache.values())t.updateTtl(e.pageTtl);this.evictIfNeeded()}size(){return this.cache.size}evictIfNeeded(){for(;this.cache.size>=this.config.maxPagesPerDocument;){let e=this.accessOrder[0];if(e===void 0)break;{let t=this.cache.get(e);if(t){if(t.getRefCount()!==0)break;t.disposeImmediate()}else this.removeFromAccessOrder(e)}}}updateAccessOrder(e){this.removeFromAccessOrder(e),this.accessOrder.push(e)}removeFromAccessOrder(e){let t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1)}},me=class{constructor(e,t,n,r,i,a){this.pdf=e,this.docPtr=t,this.pageIdx=n,this.pagePtr=r,this.onFinalDispose=a,this.refCount=0,this.disposed=!1,this.ttl=i}bumpRefCount(){if(this.disposed)throw Error(`Context already disposed`);this.refCount++}getRefCount(){return this.refCount}clearExpiryTimer(){this.expiryTimer&&=(clearTimeout(this.expiryTimer),void 0)}updateTtl(e){this.ttl=e,this.expiryTimer&&this.refCount===0&&(this.clearExpiryTimer(),this.expiryTimer=setTimeout(()=>this.disposeImmediate(),this.ttl))}release(){this.disposed||(this.refCount--,this.refCount===0&&(this.expiryTimer=setTimeout(()=>this.disposeImmediate(),this.ttl)))}disposeImmediate(){this.disposed||(this.disposed=!0,this.clearExpiryTimer(),this.textPagePtr!==void 0&&this.pdf.FPDFText_ClosePage(this.textPagePtr),this.pdf.FPDF_ClosePage(this.pagePtr),this.onFinalDispose())}getTextPage(){return this.ensureAlive(),this.textPagePtr===void 0&&(this.textPagePtr=this.pdf.FPDFText_LoadPage(this.pagePtr)),this.textPagePtr}withAnnotation(e,t){this.ensureAlive();let n=this.pdf.FPDFPage_GetAnnot(this.pagePtr,e);try{return t(n)}finally{this.pdf.FPDFPage_CloseAnnot(n)}}withFormHandle(e){this.ensureAlive();let t=this.pdf.PDFiumExt_OpenFormFillInfo(),n=this.pdf.PDFiumExt_InitFormFillEnvironment(this.docPtr,t);this.pdf.FORM_OnAfterLoadPage(this.pagePtr,n);try{return e(n)}finally{this.pdf.FORM_OnBeforeClosePage(this.pagePtr,n),this.pdf.PDFiumExt_ExitFormFillEnvironment(n),this.pdf.PDFiumExt_CloseFormFillInfo(t)}}ensureAlive(){if(this.disposed)throw Error(`PageContext already disposed`)}},he={MAX_TOTAL_MEMORY:2147483648},ge=`PDFiumEngine`,_e=`MemoryManager`,ve=class{constructor(e,t){this.pdfiumModule=e,this.logger=t,this.allocations=new Map,this.totalAllocated=0}malloc(e){if(this.totalAllocated+e>he.MAX_TOTAL_MEMORY)throw Error(`Total memory usage would exceed limit: ${this.totalAllocated+e} > ${he.MAX_TOTAL_MEMORY}`);let t=this.pdfiumModule.pdfium.wasmExports.malloc(e);if(!t)throw Error(`Failed to allocate ${e} bytes`);let n={ptr:t,size:e,timestamp:Date.now(),stack:this.logger.isEnabled(`debug`)?Error().stack:void 0};return this.allocations.set(t,n),this.totalAllocated+=e,t}free(e){let t=this.allocations.get(e);t?(this.totalAllocated-=t.size,this.allocations.delete(e)):this.logger.warn(ge,_e,`Freeing untracked pointer: ${e}`),this.pdfiumModule.pdfium.wasmExports.free(e)}getStats(){return{totalAllocated:this.totalAllocated,allocationCount:this.allocations.size,allocations:this.logger.isEnabled(`debug`)?Array.from(this.allocations.values()):[]}}checkLeaks(){if(this.allocations.size>0){this.logger.warn(ge,_e,`Potential memory leak: ${this.allocations.size} unfreed allocations`);for(let[e,t]of this.allocations)this.logger.warn(ge,_e,` - ${e}: ${t.size} bytes`,t.stack)}}},V=`pdfium`,H=`font-fallback`,U=class{constructor(e,t=new A){this.fontHandles=new Map,this.fontCache=new Map,this.nextHandleId=1,this.module=null,this.enabled=!1,this.structPtr=0,this.releaseFnPtr=0,this.enumFontsFnPtr=0,this.mapFontFnPtr=0,this.getFontFnPtr=0,this.getFontDataFnPtr=0,this.getFaceNameFnPtr=0,this.getFontCharsetFnPtr=0,this.deleteFontFnPtr=0,this.fontConfig=e,this.logger=t}initialize(e){if(this.enabled)return void this.logger.warn(V,H,`Font fallback already initialized`);this.module=e;let t=e.pdfium;if(typeof t.addFunction==`function`)try{if(this.structPtr=t.wasmExports.malloc(36),!this.structPtr)throw Error(`Failed to allocate FPDF_SYSFONTINFO struct`);for(let e=0;e<36;e++)t.setValue(this.structPtr+e,0,`i8`);this.releaseFnPtr=t.addFunction(e=>{},`vi`),this.enumFontsFnPtr=t.addFunction((e,t)=>{},`vii`),this.mapFontFnPtr=t.addFunction((e,n,r,i,a,o,s)=>{let c=o?t.UTF8ToString(o):``,l=this.mapFont(n,r,i,a,c);return s&&t.setValue(s,0,`i32`),l},`iiiiiiii`),this.getFontFnPtr=t.addFunction((e,n)=>{let r=n?t.UTF8ToString(n):``;return this.mapFont(400,0,0,0,r)},`iii`),this.getFontDataFnPtr=t.addFunction((e,t,n,r,i)=>this.getFontData(t,n,r,i),`iiiiii`),this.getFaceNameFnPtr=t.addFunction((e,t,n,r)=>0,`iiiii`),this.getFontCharsetFnPtr=t.addFunction((e,t)=>this.fontHandles.get(t)?.charset??0,`iii`),this.deleteFontFnPtr=t.addFunction((e,t)=>{this.deleteFont(t)},`vii`),t.setValue(this.structPtr+0,1,`i32`),t.setValue(this.structPtr+4,this.releaseFnPtr,`i32`),t.setValue(this.structPtr+8,this.enumFontsFnPtr,`i32`),t.setValue(this.structPtr+12,this.mapFontFnPtr,`i32`),t.setValue(this.structPtr+16,this.getFontFnPtr,`i32`),t.setValue(this.structPtr+20,this.getFontDataFnPtr,`i32`),t.setValue(this.structPtr+24,this.getFaceNameFnPtr,`i32`),t.setValue(this.structPtr+28,this.getFontCharsetFnPtr,`i32`),t.setValue(this.structPtr+32,this.deleteFontFnPtr,`i32`),e.FPDF_SetSystemFontInfo(this.structPtr),this.enabled=!0,this.logger.info(V,H,`Font fallback system initialized (pure TypeScript)`,Object.keys(this.fontConfig.fonts))}catch(e){throw this.logger.error(V,H,`Failed to initialize font fallback`,e),this.cleanup(),e}else this.logger.error(V,H,`addFunction not available. Make sure WASM is compiled with -sALLOW_TABLE_GROWTH`)}disable(){this.enabled&&this.module&&(this.module.FPDF_SetSystemFontInfo(0),this.cleanup(),this.enabled=!1,this.logger.debug(V,H,`Font fallback system disabled`))}cleanup(){if(!this.module)return;let e=this.module.pdfium;this.structPtr&&=(e.wasmExports.free(this.structPtr),0);let t=t=>{if(t&&typeof e.removeFunction==`function`)try{e.removeFunction(t)}catch{}};t(this.releaseFnPtr),t(this.enumFontsFnPtr),t(this.mapFontFnPtr),t(this.getFontFnPtr),t(this.getFontDataFnPtr),t(this.getFaceNameFnPtr),t(this.getFontCharsetFnPtr),t(this.deleteFontFnPtr),this.releaseFnPtr=0,this.enumFontsFnPtr=0,this.mapFontFnPtr=0,this.getFontFnPtr=0,this.getFontDataFnPtr=0,this.getFaceNameFnPtr=0,this.getFontCharsetFnPtr=0,this.deleteFontFnPtr=0}isEnabled(){return this.enabled}getStats(){return{handleCount:this.fontHandles.size,cacheSize:this.fontCache.size,cachedUrls:Array.from(this.fontCache.keys())}}async preloadFonts(e){let t=e.map(e=>this.getFontUrlForCharset(e)).filter(e=>e!==null),n=[...new Set(t)];await Promise.all(n.map(async e=>{if(!this.fontCache.has(e))try{let t=await this.fetchFontAsync(e);t&&(this.fontCache.set(e,t),this.logger.debug(V,H,`Pre-loaded font: ${e}`))}catch(t){this.logger.warn(V,H,`Failed to pre-load font: ${e}`,t)}}))}mapFont(e,t,n,r,i){let a=t!==0;this.logger.debug(V,H,`MapFont called`,{weight:e,italic:a,charset:n,pitchFamily:r,face:i});let o=this.findBestFontMatch(n,e,a);if(!o)return this.logger.debug(V,H,`No font configured for charset ${n}`),0;let s={id:this.nextHandleId++,charset:n,weight:e,italic:a,url:o.url,data:null};return this.fontHandles.set(s.id,s),this.logger.debug(V,H,`Created font handle ${s.id} for ${o.url} (requested: weight=${e}, italic=${a}, matched: weight=${o.matchedWeight}, italic=${o.matchedItalic})`),s.id}getFontData(e,t,n,r){let i=this.fontHandles.get(e);if(!i)return this.logger.warn(V,H,`Unknown font handle: ${e}`),0;if(i.data||(this.fontCache.has(i.url)?i.data=this.fontCache.get(i.url):(i.data=this.fetchFontSync(i.url),i.data&&this.fontCache.set(i.url,i.data))),!i.data)return this.logger.warn(V,H,`Failed to load font: ${i.url}`),0;let a=i.data;return t===0?(n===0||r<a.length||this.module&&(this.module.pdfium.HEAPU8.set(a,n),this.logger.debug(V,H,`Copied ${a.length} bytes to buffer for handle ${e}`)),a.length):(this.logger.debug(V,H,`Table ${t} requested - returning 0 to request whole file`),0)}deleteFont(e){this.fontHandles.get(e)&&(this.logger.debug(V,H,`Deleting font handle ${e}`),this.fontHandles.delete(e))}findBestFontMatch(e,t,n){let{fonts:r,defaultFont:i,baseUrl:a}=this.fontConfig,o=r[e]??i;if(!o)return null;let s=this.normalizeToVariants(o);if(s.length===0)return null;let c=this.selectBestVariant(s,t,n),l=c.url;return!a||l.startsWith(`http://`)||l.startsWith(`https://`)||l.startsWith(`/`)||(l=`${a}/${l}`),{url:l,matchedWeight:c.weight??400,matchedItalic:c.italic??!1}}normalizeToVariants(e){return typeof e==`string`?[{url:e,weight:400,italic:!1}]:Array.isArray(e)?e.map(e=>({url:e.url,weight:e.weight??400,italic:e.italic??!1})):[{url:e.url,weight:e.weight??400,italic:e.italic??!1}]}selectBestVariant(e,t,n){if(e.length===1)return e[0];let r=e.filter(e=>(e.italic??!1)===n),i=r.length>0?r:e,a=i[0],o=Math.abs((a.weight??400)-t);for(let e of i){let n=e.weight??400,r=Math.abs(n-t);if(r<o)a=e,o=r;else if(r===o){let r=a.weight??400;t>=500?n>r&&(a=e):n<r&&(a=e)}}return a}getFontUrlForCharset(e){return this.findBestFontMatch(e,400,!1)?.url??null}fetchFontSync(e){if(this.logger.debug(V,H,`Fetching font synchronously: ${e}`),this.fontConfig.fontLoader)try{let t=this.fontConfig.fontLoader(e);return t?this.logger.info(V,H,`Loaded font via custom loader: ${e} (${t.length} bytes)`):this.logger.warn(V,H,`Custom font loader returned null for: ${e}`),t}catch(t){return this.logger.error(V,H,`Error in custom font loader: ${e}`,t),null}try{let t=new XMLHttpRequest;if(t.open(`GET`,e,!1),t.responseType=`arraybuffer`,t.send(),t.status===200){let n=new Uint8Array(t.response);return this.logger.info(V,H,`Loaded font: ${e} (${n.length} bytes)`),n}return this.logger.error(V,H,`Failed to load font: ${e} (HTTP ${t.status})`),null}catch(t){return this.logger.error(V,H,`Error fetching font: ${e}`,t),null}}async fetchFontAsync(e){if(this.fontConfig.fontLoader)try{return this.fontConfig.fontLoader(e)}catch{return null}try{let t=await fetch(e);if(t.ok){let e=await t.arrayBuffer();return new Uint8Array(e)}return null}catch{return null}}},W=`PDFiumEngine`,G=`Engine`,ye=class{constructor(e,t={}){this.pdfiumModule=e,this.memoryLeakCheckInterval=null,this.fontFallbackManager=null;let{logger:n=new A,fontFallback:r}=t;this.logger=n,this.memoryManager=new ve(this.pdfiumModule,this.logger),this.cache=new de(this.pdfiumModule,this.memoryManager),this.logger.isEnabled(`debug`)&&(this.memoryLeakCheckInterval=setInterval(()=>{this.memoryManager.checkLeaks()},1e4)),this.logger.debug(W,G,`initialize`),this.logger.perf(W,G,`Initialize`,`Begin`,`General`),this.pdfiumModule.PDFiumExt_Init(),this.logger.perf(W,G,`Initialize`,`End`,`General`),r&&(this.fontFallbackManager=new U(r,this.logger),this.fontFallbackManager.initialize(this.pdfiumModule),this.logger.info(W,G,`Font fallback system enabled`))}destroy(){return this.logger.debug(W,G,`destroy`),this.logger.perf(W,G,`Destroy`,`Begin`,`General`),this.fontFallbackManager&&=(this.fontFallbackManager.disable(),null),this.pdfiumModule.FPDF_DestroyLibrary(),this.memoryLeakCheckInterval&&=(clearInterval(this.memoryLeakCheckInterval),null),this.logger.perf(W,G,`Destroy`,`End`,`General`),P.resolve(!0)}getFontFallbackManager(){return this.fontFallbackManager}withWString(e,t){let n=2*(e.length+1),r=this.memoryManager.malloc(n);try{return this.pdfiumModule.pdfium.stringToUTF16(e,r,n),t(r)}finally{this.memoryManager.free(r)}}withFloatArray(e,t){let n=e??[],r=4*n.length,i=r?this.memoryManager.malloc(r):0;try{if(r)for(let e=0;e<n.length;e++)this.pdfiumModule.pdfium.setValue(i+4*e,n[e],`float`);return t(i,n.length)}finally{r&&this.memoryManager.free(i)}}openDocumentBuffer(e,t){this.logger.debug(W,G,`openDocumentBuffer`,e,t),this.logger.perf(W,G,`OpenDocumentBuffer`,`Begin`,e.id);let n=t?.normalizeRotation??!1,r=new Uint8Array(e.content),i=r.length,a=this.memoryManager.malloc(i);this.pdfiumModule.pdfium.HEAPU8.set(r,a);let o=this.pdfiumModule.FPDF_LoadMemDocument(a,i,t?.password??``);if(!o){let t=this.pdfiumModule.FPDF_GetLastError();return this.logger.error(W,G,`FPDF_LoadMemDocument failed with ${t}`),this.memoryManager.free(a),this.logger.perf(W,G,`OpenDocumentBuffer`,`End`,e.id),P.reject({code:t,message:`FPDF_LoadMemDocument failed`})}let s=this.pdfiumModule.FPDF_GetPageCount(o),c=[],l=this.memoryManager.malloc(8),u=this.memoryManager.malloc(16);for(let t=0;t<s;t++){if(!(n?this.pdfiumModule.EPDF_GetPageSizeByIndexNormalized(o,t,l):this.pdfiumModule.FPDF_GetPageSizeByIndexF(o,t,l))){let t=this.pdfiumModule.FPDF_GetLastError();return this.logger.error(W,G,`${n?`EPDF_GetPageSizeByIndexNormalized`:`FPDF_GetPageSizeByIndexF`} failed with ${t}`),this.memoryManager.free(l),this.memoryManager.free(u),this.pdfiumModule.FPDF_CloseDocument(o),this.memoryManager.free(a),this.logger.perf(W,G,`OpenDocumentBuffer`,`End`,e.id),P.reject({code:t,message:(n?`EPDF_GetPageSizeByIndexNormalized`:`FPDF_GetPageSizeByIndexF`)+` failed`})}let r=this.pdfiumModule.EPDF_GetPageRotationByIndex(o,t),i=this.pdfiumModule.EPDFDoc_GetPageObjectNumberByIndex(o,t),s=this.readPageBoxes(o,t,u),d={index:t,size:{width:this.pdfiumModule.pdfium.getValue(l,`float`),height:this.pdfiumModule.pdfium.getValue(l+4,`float`)},rotation:r,objectNumber:i,boxes:s};c.push(d)}this.memoryManager.free(l),this.memoryManager.free(u);let d=this.pdfiumModule.EPDF_IsEncrypted(o),f=this.pdfiumModule.EPDF_IsOwnerUnlocked(o),p=this.pdfiumModule.FPDF_GetDocPermissions(o),m={id:e.id,pageCount:s,pages:c,isEncrypted:d,isOwnerUnlocked:f,permissions:p,normalizedRotation:n};return this.cache.setDocument(e.id,a,o,n),this.logger.perf(W,G,`OpenDocumentBuffer`,`End`,e.id),P.resolve(m)}createDocument(e){this.logger.debug(W,G,`createDocument`,e),this.logger.perf(W,G,`CreateDocument`,`Begin`,e);let t=this.pdfiumModule.FPDF_CreateNewDocument();if(!t)return this.logger.perf(W,G,`CreateDocument`,`End`,e),P.reject({code:g.CantCreateNewDoc,message:`can not create new document`});let n={id:e,pageCount:0,pages:[],isEncrypted:!1,isOwnerUnlocked:!0,permissions:4294967295,normalizedRotation:!1};return this.cache.setDocument(e,0,t,!1),this.logger.perf(W,G,`CreateDocument`,`End`,e),P.resolve(n)}getMetadata(e){this.logger.debug(W,G,`getMetadata`,e),this.logger.perf(W,G,`GetMetadata`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(W,G,`GetMetadata`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let n=this.readMetaText(t.docPtr,`CreationDate`),r=this.readMetaText(t.docPtr,`ModDate`),i={title:this.readMetaText(t.docPtr,`Title`),author:this.readMetaText(t.docPtr,`Author`),subject:this.readMetaText(t.docPtr,`Subject`),keywords:this.readMetaText(t.docPtr,`Keywords`),producer:this.readMetaText(t.docPtr,`Producer`),creator:this.readMetaText(t.docPtr,`Creator`),creationDate:n?m(n)??null:null,modificationDate:r?m(r)??null:null,trapped:this.getMetaTrapped(t.docPtr),custom:this.readAllMeta(t.docPtr,!0)};return this.logger.perf(W,G,`GetMetadata`,`End`,e.id),P.resolve(i)}setMetadata(e,t){this.logger.debug(W,G,`setMetadata`,e,t),this.logger.perf(W,G,`SetMetadata`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(W,G,`SetMetadata`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let r=[[`title`,`Title`],[`author`,`Author`],[`subject`,`Subject`],[`keywords`,`Keywords`],[`producer`,`Producer`],[`creator`,`Creator`]],i=!0;for(let[e,a]of r){let r=t[e];if(r===void 0)continue;let o=r===null?null:r;this.setMetaText(n.docPtr,a,o)||(i=!1)}let a=(e,r)=>{let a=t[e];if(a===void 0)return;if(a===null)return void(this.setMetaText(n.docPtr,r,null)||(i=!1));let o=d(a);this.setMetaText(n.docPtr,r,o)||(i=!1)};if(a(`creationDate`,`CreationDate`),a(`modificationDate`,`ModDate`),t.trapped!==void 0&&(this.setMetaTrapped(n.docPtr,t.trapped??null)||(i=!1)),t.custom!==void 0)for(let[e,r]of Object.entries(t.custom))le(e)?this.setMetaText(n.docPtr,e,r??null)||(i=!1):this.logger.warn(W,G,`Invalid custom metadata key skipped`,e);return this.logger.perf(W,G,`SetMetadata`,`End`,e.id),i?P.resolve(!0):P.reject({code:g.Unknown,message:`one or more metadata fields could not be written`})}getDocPermissions(e){this.logger.debug(W,G,`getDocPermissions`,e),this.logger.perf(W,G,`getDocPermissions`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(W,G,`getDocPermissions`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.FPDF_GetDocPermissions(t.docPtr);return P.resolve(n)}getDocUserPermissions(e){this.logger.debug(W,G,`getDocUserPermissions`,e),this.logger.perf(W,G,`getDocUserPermissions`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(W,G,`getDocUserPermissions`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.FPDF_GetDocUserPermissions(t.docPtr);return P.resolve(n)}getSignatures(e){this.logger.debug(W,G,`getSignatures`,e),this.logger.perf(W,G,`GetSignatures`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(W,G,`GetSignatures`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let n=[],r=this.pdfiumModule.FPDF_GetSignatureCount(t.docPtr);for(let e=0;e<r;e++){let r=this.pdfiumModule.FPDF_GetSignatureObject(t.docPtr,e),i=R(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFSignatureObj_GetContents(r,e,t)),a=R(this.pdfiumModule.pdfium,(e,t)=>4*this.pdfiumModule.FPDFSignatureObj_GetByteRange(r,e,t)),o=R(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFSignatureObj_GetSubFilter(r,e,t)),s=L(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFSignatureObj_GetReason(r,e,t),this.pdfiumModule.pdfium.UTF16ToString),c=L(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFSignatureObj_GetTime(r,e,t),this.pdfiumModule.pdfium.UTF8ToString),l=this.pdfiumModule.FPDFSignatureObj_GetDocMDPPermission(r);n.push({contents:i,byteRange:a,subFilter:o,reason:s,time:c,docMDP:l})}return this.logger.perf(W,G,`GetSignatures`,`End`,e.id),P.resolve(n)}getBookmarks(e){this.logger.debug(W,G,`getBookmarks`,e),this.logger.perf(W,G,`GetBookmarks`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(W,G,`getBookmarks`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let n=this.readPdfBookmarks(t.docPtr,0);return this.logger.perf(W,G,`GetBookmarks`,`End`,e.id),P.resolve({bookmarks:n})}setBookmarks(e,t){this.logger.debug(W,G,`setBookmarks`,e,t),this.logger.perf(W,G,`SetBookmarks`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(W,G,`SetBookmarks`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});if(!this.pdfiumModule.EPDFBookmark_Clear(n.docPtr))return this.logger.perf(W,G,`SetBookmarks`,`End`,e.id),P.reject({code:g.Unknown,message:`failed to clear existing bookmarks`});let r=(e,t)=>{for(let i of t){let t=this.withWString(i.title??``,t=>this.pdfiumModule.EPDFBookmark_AppendChild(n.docPtr,e,t));if(!t||i.target&&!this.applyBookmarkTarget(n.docPtr,t,i.target)||i.children?.length&&!r(t,i.children))return!1}return!0},i=r(0,t);return this.logger.perf(W,G,`SetBookmarks`,`End`,e.id),i?P.resolve(!0):P.reject({code:g.Unknown,message:`failed to build bookmark tree`})}deleteBookmarks(e){this.logger.debug(W,G,`deleteBookmarks`,e),this.logger.perf(W,G,`DeleteBookmarks`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(W,G,`DeleteBookmarks`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.EPDFBookmark_Clear(t.docPtr);return this.logger.perf(W,G,`DeleteBookmarks`,`End`,e.id),n?P.resolve(!0):P.reject({code:g.Unknown,message:`failed to clear bookmarks`})}renderPageRaw(e,t,n){this.logger.debug(W,G,`renderPage`,e,t,n),this.logger.perf(W,G,`RenderPage`,`Begin`,`${e.id}-${t.index}`);let r={origin:{x:0,y:0},size:t.size},i=this.renderRectEncoded(e,t,r,n);return this.logger.perf(W,G,`RenderPage`,`End`,`${e.id}-${t.index}`),i}renderPageRect(e,t,n,r){this.logger.debug(W,G,`renderPageRect`,e,t,n,r),this.logger.perf(W,G,`RenderPageRect`,`Begin`,`${e.id}-${t.index}`);let i=this.renderRectEncoded(e,t,n,r);return this.logger.perf(W,G,`RenderPageRect`,`End`,`${e.id}-${t.index}`),i}getDocumentJavaScriptActions(e){this.logger.debug(W,G,`getDocumentJavaScriptActions`,e);let t=this.cache.getContext(e.id);if(!t)return P.reject({code:g.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.FPDFDoc_GetJavaScriptActionCount(t.docPtr);if(n<0)return P.reject({code:g.Unknown,message:`failed to read document javascript actions`});let r=[];for(let e=0;e<n;e++){let n=this.pdfiumModule.FPDFDoc_GetJavaScriptAction(t.docPtr,e);if(n)try{let t=L(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFJavaScriptAction_GetName(n,e,t),this.pdfiumModule.pdfium.UTF16ToString)??``,i=L(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFJavaScriptAction_GetScript(n,e,t),this.pdfiumModule.pdfium.UTF16ToString)??``;if(!i)continue;r.push({id:`document:${e}:${t}`,trigger:E.DocumentNamed,name:t,script:i})}finally{this.pdfiumModule.FPDFDoc_CloseJavaScriptAction(n)}}return P.resolve(r)}getPageAnnoWidgets(e,t){this.logger.debug(W,G,`getPageAnnoWidgets`,e,t),this.logger.perf(W,G,`GetPageAnnoWidgets`,`Begin`,`${e.id}-${t.index}`);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(W,G,`GetPageAnnoWidgets`,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let r=this.readPageAnnoWidgets(e,n,t);return this.logger.perf(W,G,`GetPageAnnoWidgets`,`End`,`${e.id}-${t.index}`),this.logger.debug(W,G,`GetPageAnnoWidgets`,`${e.id}-${t.index}`,r),P.resolve(r)}getPageWidgetJavaScriptActions(e,t){this.logger.debug(W,G,`getPageWidgetJavaScriptActions`,e,t);let n=this.cache.getContext(e.id);if(!n)return P.reject({code:g.DocNotOpen,message:`document does not open`});let r=[];return n.borrowPage(t.index,e=>{e.withFormHandle(n=>{let i=this.pdfiumModule.FPDFPage_GetAnnotCount(e.pagePtr);for(let a=0;a<i;a++)e.withAnnotation(a,e=>{if(this.pdfiumModule.FPDFAnnot_GetSubtype(e)!==M.WIDGET)return;let i=this.getAnnotString(e,`NM`);i||(i=j(),this.setAnnotString(e,`NM`,i));let a=L(this.pdfiumModule.pdfium,(t,r)=>this.pdfiumModule.FPDFAnnot_GetFormFieldName(n,e,t,r),this.pdfiumModule.pdfium.UTF16ToString)??``,o=[{event:D.KEY_STROKE,eventType:h.Keystroke,trigger:E.WidgetKeystroke},{event:D.FORMAT,eventType:h.Format,trigger:E.WidgetFormat},{event:D.VALIDATE,eventType:h.Validate,trigger:E.WidgetValidate},{event:D.CALCULATE,eventType:h.Calculate,trigger:E.WidgetCalculate}];for(let s of o){let o=L(this.pdfiumModule.pdfium,(t,r)=>this.pdfiumModule.FPDFAnnot_GetFormAdditionalActionJavaScript(n,e,s.event,t,r),this.pdfiumModule.pdfium.UTF16ToString)??``;o&&r.push({id:`widget:${t.index}:${i}:${s.eventType}`,trigger:s.trigger,eventType:s.eventType,pageIndex:t.index,annotationId:i,fieldName:a,script:o})}})})}),P.resolve(r)}regenerateWidgetAppearances(e,t,n){let r=this.cache.getContext(e.id);if(!r)return P.reject({code:g.DocNotOpen,message:`document does not open`});let i=new Set(n),a=0;return r.borrowPage(t.index,e=>{let t=this.pdfiumModule.FPDFPage_GetAnnotCount(e.pagePtr);for(let n=0;n<t;n++)e.withAnnotation(n,e=>{let t=this.getAnnotString(e,`NM`);t&&i.has(t)&&(this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(e),a++)});a>0&&this.pdfiumModule.FPDFPage_GenerateContent(e.pagePtr)}),P.resolve(a>0)}getPageAnnotations(e,t){this.logger.debug(W,G,`getPageAnnotations`,e,t),this.logger.perf(W,G,`GetPageAnnotations`,`Begin`,`${e.id}-${t.index}`);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(W,G,`GetPageAnnotations`,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let r=this.readPageAnnotations(e,n,t);return this.logger.perf(W,G,`GetPageAnnotations`,`End`,`${e.id}-${t.index}`),this.logger.debug(W,G,`GetPageAnnotations`,`${e.id}-${t.index}`,r),P.resolve(r)}createPageAnnotation(e,t,r,i){this.logger.debug(W,G,`createPageAnnotation`,e,t,r),this.logger.perf(W,G,`CreatePageAnnotation`,`Begin`,`${e.id}-${t.index}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(W,G,`CreatePageAnnotation`,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let o=a.acquirePage(t.index),s,c,l;if(r.type===M.WIDGET){let e=r;c=this.pdfiumModule.PDFiumExt_OpenFormFillInfo(),l=this.pdfiumModule.PDFiumExt_InitFormFillEnvironment(a.docPtr,c),this.pdfiumModule.FORM_OnAfterLoadPage(o.pagePtr,l);let t=e.field?.name??``;s=this.withWString(t,t=>this.pdfiumModule.EPDFPage_CreateFormField(o.pagePtr,l,e.field.type,t))}else s=this.pdfiumModule.EPDFPage_CreateAnnot(o.pagePtr,r.type);if(!s)return this.logger.perf(W,G,`CreatePageAnnotation`,`End`,`${e.id}-${t.index}`),o.release(),P.reject({code:g.CantCreateAnnot,message:`can not create annotation with specified type`});if(r.id||=j(),!this.setAnnotString(s,`NM`,r.id))return this.pdfiumModule.FPDFPage_CloseAnnot(s),o.release(),P.reject({code:g.CantSetAnnotString,message:`can not set the name of the annotation`});if(!this.setPageAnnoRect(e,t,s,r.rect))return this.pdfiumModule.FPDFPage_CloseAnnot(s),o.release(),this.logger.perf(W,G,`CreatePageAnnotation`,`End`,`${e.id}-${t.index}`),P.reject({code:g.CantSetAnnotRect,message:`can not set the rect of the annotation`});let u=this.prepareAnnotationForSave(r),d=!1;switch(u.type){case M.INK:d=this.addInkStroke(e,t,o.pagePtr,s,u);break;case M.STAMP:d=this.addStampContent(e,a.docPtr,t,o.pagePtr,s,u,i);break;case M.TEXT:d=this.addTextContent(e,t,o.pagePtr,s,u);break;case M.FREETEXT:d=this.addFreeTextContent(e,t,o.pagePtr,s,u);break;case M.LINE:d=this.addLineContent(e,t,o.pagePtr,s,u);break;case M.POLYLINE:case M.POLYGON:d=this.addPolyContent(e,t,o.pagePtr,s,u);break;case M.CIRCLE:case M.SQUARE:d=this.addShapeContent(e,t,o.pagePtr,s,u);break;case M.UNDERLINE:case M.STRIKEOUT:case M.SQUIGGLY:case M.HIGHLIGHT:d=this.addTextMarkupContent(e,t,o.pagePtr,s,u);break;case M.LINK:d=this.addLinkContent(e,t,a.docPtr,o.pagePtr,s,u);break;case M.CARET:d=this.addCaretContent(e,t,o.pagePtr,s,u);break;case M.REDACT:d=this.addRedactContent(e,t,o.pagePtr,s,u);break;case M.WIDGET:{let e=u;if(l!==void 0)switch(e.field.type){case n.TEXTFIELD:d=this.addTextFieldContent(l,s,e);break;case n.CHECKBOX:case n.RADIOBUTTON:d=this.addToggleFieldContent(l,s,e);break;case n.COMBOBOX:case n.LISTBOX:d=this.addChoiceFieldContent(l,s,e)}break}}return l!==void 0&&(this.pdfiumModule.FORM_OnBeforeClosePage(o.pagePtr,l),this.pdfiumModule.PDFiumExt_ExitFormFillEnvironment(l)),c!==void 0&&this.pdfiumModule.PDFiumExt_CloseFormFillInfo(c),d?(r.type===M.WIDGET?this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(s):r.blendMode===void 0?this.pdfiumModule.EPDFAnnot_GenerateAppearance(s):this.pdfiumModule.EPDFAnnot_GenerateAppearanceWithBlend(s,r.blendMode),this.pdfiumModule.FPDFPage_GenerateContent(o.pagePtr),this.pdfiumModule.FPDFPage_CloseAnnot(s),o.release(),this.logger.perf(W,G,`CreatePageAnnotation`,`End`,`${e.id}-${t.index}`),P.resolve(r.id)):(this.removeAnnotationByName(o.pagePtr,r.id),this.pdfiumModule.FPDFPage_CloseAnnot(s),o.release(),this.logger.perf(W,G,`CreatePageAnnotation`,`End`,`${e.id}-${t.index}`),P.reject({code:g.CantSetAnnotContent,message:`can not add content of the annotation`}))}updatePageAnnotation(e,t,r,i){this.logger.debug(W,G,`updatePageAnnotation`,e,t,r),this.logger.perf(W,G,`UpdatePageAnnotation`,`Begin`,`${e.id}-${t.index}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(W,G,`UpdatePageAnnotation`,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let o=a.acquirePage(t.index),s=this.getAnnotationByName(o.pagePtr,r.id);if(!s)return o.release(),this.logger.perf(W,G,`UpdatePageAnnotation`,`End`,`${e.id}-${t.index}`),P.reject({code:g.NotFound,message:`annotation not found`});if(!this.setPageAnnoRect(e,t,s,r.rect))return this.pdfiumModule.FPDFPage_CloseAnnot(s),o.release(),this.logger.perf(W,G,`UpdatePageAnnotation`,`End`,`${e.id}-${t.index}`),P.reject({code:g.CantSetAnnotRect,message:`failed to move annotation`});let c=this.prepareAnnotationForSave(r),l=!1;switch(c.type){case M.INK:if(!this.pdfiumModule.FPDFAnnot_RemoveInkList(s))break;l=this.addInkStroke(e,t,o.pagePtr,s,c);break;case M.STAMP:l=this.addStampContent(e,a.docPtr,t,o.pagePtr,s,c);break;case M.TEXT:l=this.addTextContent(e,t,o.pagePtr,s,c);break;case M.FREETEXT:l=this.addFreeTextContent(e,t,o.pagePtr,s,c);break;case M.CIRCLE:case M.SQUARE:l=this.addShapeContent(e,t,o.pagePtr,s,c);break;case M.LINE:l=this.addLineContent(e,t,o.pagePtr,s,c);break;case M.POLYGON:case M.POLYLINE:l=this.addPolyContent(e,t,o.pagePtr,s,c);break;case M.HIGHLIGHT:case M.UNDERLINE:case M.STRIKEOUT:case M.SQUIGGLY:l=this.addTextMarkupContent(e,t,o.pagePtr,s,c);break;case M.LINK:l=this.addLinkContent(e,t,a.docPtr,o.pagePtr,s,c);break;case M.CARET:l=this.addCaretContent(e,t,o.pagePtr,s,c);break;case M.REDACT:l=this.addRedactContent(e,t,o.pagePtr,s,c);break;case M.WIDGET:{let e=c;o.withFormHandle(t=>{switch(e.field.type){case n.TEXTFIELD:l=this.addTextFieldContent(t,s,e);break;case n.CHECKBOX:case n.RADIOBUTTON:l=this.addToggleFieldContent(t,s,e);break;case n.COMBOBOX:case n.LISTBOX:l=this.addChoiceFieldContent(t,s,e)}});break}default:l=!1}return l&&!1!==i?.regenerateAppearance&&(r.type===M.WIDGET?this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(s):r.blendMode===void 0?this.pdfiumModule.EPDFAnnot_GenerateAppearance(s):this.pdfiumModule.EPDFAnnot_GenerateAppearanceWithBlend(s,r.blendMode),this.pdfiumModule.FPDFPage_GenerateContent(o.pagePtr)),this.pdfiumModule.FPDFPage_CloseAnnot(s),o.release(),this.logger.perf(W,G,`UpdatePageAnnotation`,`End`,`${e.id}-${t.index}`),l?P.resolve(!0):P.reject({code:g.CantSetAnnotContent,message:`failed to update annotation`})}removePageAnnotation(e,t,n){this.logger.debug(W,G,`removePageAnnotation`,e,t,n),this.logger.perf(W,G,`RemovePageAnnotation`,`Begin`,`${e.id}-${t.index}`);let r=this.cache.getContext(e.id);if(!r)return this.logger.perf(W,G,`RemovePageAnnotation`,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let i=r.acquirePage(t.index),a=!1;return a=this.removeAnnotationByName(i.pagePtr,n.id),a?(a=this.pdfiumModule.FPDFPage_GenerateContent(i.pagePtr),a||this.logger.error(W,G,`FPDFPage_GenerateContent Failed`,`${e.id}-${t.index}`)):this.logger.error(W,G,`FPDFPage_RemoveAnnot Failed`,`${e.id}-${t.index}`),i.release(),this.logger.perf(W,G,`RemovePageAnnotation`,`End`,`${e.id}-${t.index}`),P.resolve(a)}getPageTextRects(e,t){this.logger.debug(W,G,`getPageTextRects`,e,t),this.logger.perf(W,G,`GetPageTextRects`,`Begin`,`${e.id}-${t.index}`);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(W,G,`GetPageTextRects`,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let r=n.acquirePage(t.index),i=this.pdfiumModule.FPDFText_LoadPage(r.pagePtr),a=this.readPageTextRects(t,r.docPtr,r.pagePtr,i);return this.pdfiumModule.FPDFText_ClosePage(i),r.release(),this.logger.perf(W,G,`GetPageTextRects`,`End`,`${e.id}-${t.index}`),P.resolve(a)}renderThumbnailRaw(e,t,n){let{scaleFactor:r=1,...i}=n??{};if(this.logger.debug(W,G,`renderThumbnail`,e,t,n),this.logger.perf(W,G,`RenderThumbnail`,`Begin`,`${e.id}-${t.index}`),!this.cache.getContext(e.id))return this.logger.perf(W,G,`RenderThumbnail`,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let a=this.renderPageRaw(e,t,{scaleFactor:Math.max(r,.5),...i});return this.logger.perf(W,G,`RenderThumbnail`,`End`,`${e.id}-${t.index}`),a}getAttachments(e){this.logger.debug(W,G,`getAttachments`,e),this.logger.perf(W,G,`GetAttachments`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(W,G,`GetAttachments`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let n=[],r=this.pdfiumModule.FPDFDoc_GetAttachmentCount(t.docPtr);for(let e=0;e<r;e++){let r=this.readPdfAttachment(t.docPtr,e);n.push(r)}return this.logger.perf(W,G,`GetAttachments`,`End`,e.id),P.resolve(n)}addAttachment(e,t){this.logger.debug(W,G,`addAttachment`,e,t?.name),this.logger.perf(W,G,`AddAttachment`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(W,G,`AddAttachment`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let{name:r,description:i,mimeType:a,data:o}=t??{};if(!r)return this.logger.perf(W,G,`AddAttachment`,`End`,e.id),P.reject({code:g.NotFound,message:`attachment name is required`});if(!o||o.byteLength===0)return this.logger.perf(W,G,`AddAttachment`,`End`,e.id),P.reject({code:g.NotFound,message:`attachment data is empty`});let s=this.withWString(r,e=>this.pdfiumModule.FPDFDoc_AddAttachment(n.docPtr,e));if(!s)return this.logger.perf(W,G,`AddAttachment`,`End`,e.id),P.reject({code:g.Unknown,message:`An attachment named "${r}" already exists`});this.withWString(i,e=>this.pdfiumModule.EPDFAttachment_SetDescription(s,e)),this.pdfiumModule.EPDFAttachment_SetSubtype(s,a);let c=o instanceof Uint8Array?o:new Uint8Array(o),l=c.byteLength,u=this.memoryManager.malloc(l);try{if(this.pdfiumModule.pdfium.HEAPU8.set(c,u),!this.pdfiumModule.FPDFAttachment_SetFile(s,n.docPtr,u,l))return this.logger.perf(W,G,`AddAttachment`,`End`,e.id),P.reject({code:g.Unknown,message:`failed to write attachment bytes`})}finally{this.memoryManager.free(u)}return this.logger.perf(W,G,`AddAttachment`,`End`,e.id),P.resolve(!0)}removeAttachment(e,t){this.logger.debug(W,G,`deleteAttachment`,e,t),this.logger.perf(W,G,`DeleteAttachment`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(W,G,`DeleteAttachment`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let r=this.pdfiumModule.FPDFDoc_GetAttachmentCount(n.docPtr);if(t.index<0||t.index>=r)return this.logger.perf(W,G,`DeleteAttachment`,`End`,e.id),P.reject({code:g.Unknown,message:`attachment index ${t.index} out of range`});let i=this.pdfiumModule.FPDFDoc_DeleteAttachment(n.docPtr,t.index);return this.logger.perf(W,G,`DeleteAttachment`,`End`,e.id),i?P.resolve(!0):P.reject({code:g.Unknown,message:`failed to delete attachment`})}readAttachmentContent(e,t){this.logger.debug(W,G,`readAttachmentContent`,e,t),this.logger.perf(W,G,`ReadAttachmentContent`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(W,G,`ReadAttachmentContent`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let r=this.pdfiumModule.FPDFDoc_GetAttachment(n.docPtr,t.index),i=this.memoryManager.malloc(4);if(!this.pdfiumModule.FPDFAttachment_GetFile(r,0,0,i))return this.memoryManager.free(i),this.logger.perf(W,G,`ReadAttachmentContent`,`End`,e.id),P.reject({code:g.CantReadAttachmentSize,message:`can not read attachment size`});let a=this.pdfiumModule.pdfium.getValue(i,`i32`)>>>0,o=this.memoryManager.malloc(a);if(!this.pdfiumModule.FPDFAttachment_GetFile(r,o,a,i))return this.memoryManager.free(i),this.memoryManager.free(o),this.logger.perf(W,G,`ReadAttachmentContent`,`End`,e.id),P.reject({code:g.CantReadAttachmentContent,message:`can not read attachment content`});let s=new ArrayBuffer(a),c=new DataView(s);for(let e=0;e<a;e++)c.setInt8(e,this.pdfiumModule.pdfium.getValue(o+e,`i8`));return this.memoryManager.free(i),this.memoryManager.free(o),this.logger.perf(W,G,`ReadAttachmentContent`,`End`,e.id),P.resolve(s)}setFormFieldValue(e,t,n,r){this.logger.debug(W,G,`SetFormFieldValue`,e,n,r),this.logger.perf(W,G,`SetFormFieldValue`,`Begin`,`${e.id}-${n.id}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.debug(W,G,`SetFormFieldValue`,`document is not opened`),this.logger.perf(W,G,`SetFormFieldValue`,`End`,`${e.id}-${n.id}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let a=i.acquirePage(t.index);try{return a.withFormHandle(e=>{let t=this.getAnnotationByName(a.pagePtr,n.id);if(!t)return P.reject({code:g.NotFound,message:`annotation not found`});try{if(!this.pdfiumModule.FORM_SetFocusedAnnot(e,t))return P.reject({code:g.CantFocusAnnot,message:`failed to set focused annotation`});switch(r.kind){case`text`:{if(!this.pdfiumModule.FORM_SelectAllText(e,a.pagePtr))return this.pdfiumModule.FORM_ForceToKillFocus(e),P.reject({code:g.CantSelectText,message:`failed to select all text`});let t=2*(r.text.length+1),n=this.memoryManager.malloc(t);this.pdfiumModule.pdfium.stringToUTF16(r.text,n,t),this.pdfiumModule.FORM_ReplaceSelection(e,a.pagePtr,n),this.memoryManager.free(n);break}case`selection`:if(!this.pdfiumModule.FORM_SetIndexSelected(e,a.pagePtr,r.index,r.isSelected))return this.pdfiumModule.FORM_ForceToKillFocus(e),P.reject({code:g.CantSelectOption,message:`failed to set index selected`});break;case`checked`:if(!!this.pdfiumModule.FPDFAnnot_IsChecked(e,t)!==r.checked&&!this.pdfiumModule.FORM_OnChar(e,a.pagePtr,13,0))return this.pdfiumModule.FORM_ForceToKillFocus(e),P.reject({code:g.CantCheckField,message:`failed to set field checked`})}return this.pdfiumModule.FORM_ForceToKillFocus(e),this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(t),P.resolve(!0)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(t)}})}finally{a.release()}}setFormFieldState(e,t,r,i){this.logger.debug(W,G,`SetFormFieldState`,e,r,i),this.logger.perf(W,G,`SetFormFieldState`,`Begin`,`${e.id}-${r.id}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.debug(W,G,`SetFormFieldState`,`document is not opened`),this.logger.perf(W,G,`SetFormFieldState`,`End`,`${e.id}-${r.id}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let o=a.acquirePage(t.index);try{return o.withFormHandle(t=>{let a=this.getAnnotationByName(o.pagePtr,r.id);if(!a)return P.reject({code:g.NotFound,message:`annotation not found`});try{if(!this.pdfiumModule.FORM_SetFocusedAnnot(t,a))return P.reject({code:g.CantFocusAnnot,message:`failed to set focused annotation`});switch(i.type){case n.TEXTFIELD:{if(!this.pdfiumModule.FORM_SelectAllText(t,o.pagePtr))return this.pdfiumModule.FORM_ForceToKillFocus(t),P.reject({code:g.CantSelectText,message:`failed to select all text`});let e=2*(i.value.length+1),n=this.memoryManager.malloc(e);this.pdfiumModule.pdfium.stringToUTF16(i.value,n,e),this.pdfiumModule.FORM_ReplaceSelection(t,o.pagePtr,n),this.memoryManager.free(n);break}case n.CHECKBOX:case n.RADIOBUTTON:if(!!this.pdfiumModule.FPDFAnnot_IsChecked(t,a)!=(r.exportValue!=null&&i.value===r.exportValue)&&!this.pdfiumModule.FORM_OnChar(t,o.pagePtr,13,0))return this.pdfiumModule.FORM_ForceToKillFocus(t),P.reject({code:g.CantCheckField,message:`failed to set field checked`});break;case n.COMBOBOX:{let e=i.options.findIndex(e=>e.isSelected);if(e>=0&&!this.pdfiumModule.FORM_SetIndexSelected(t,o.pagePtr,e,!0))return this.pdfiumModule.FORM_ForceToKillFocus(t),P.reject({code:g.CantSelectOption,message:`failed to set index selected`});break}case n.LISTBOX:for(let e=0;e<i.options.length;e++)if(!this.pdfiumModule.FORM_SetIndexSelected(t,o.pagePtr,e,i.options[e].isSelected))return this.pdfiumModule.FORM_ForceToKillFocus(t),P.reject({code:g.CantSelectOption,message:`failed to set index selected`})}return this.pdfiumModule.FORM_ForceToKillFocus(t),i.type!==n.CHECKBOX&&i.type!==n.RADIOBUTTON&&this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(a),this.logger.perf(W,G,`SetFormFieldState`,`End`,`${e.id}-${r.id}`),P.resolve(!0)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(a)}})}finally{o.release()}}renameWidgetField(e,t,n,r){this.logger.debug(W,G,`RenameWidgetField`,e,n,r),this.logger.perf(W,G,`RenameWidgetField`,`Begin`,`${e.id}-${n.id}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(W,G,`RenameWidgetField`,`End`,`${e.id}-${n.id}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let a=i.acquirePage(t.index);try{return a.withFormHandle(t=>{let i=this.getAnnotationByName(a.pagePtr,n.id);if(!i)return P.reject({code:g.NotFound,message:`annotation not found`});try{return this.withWString(r,e=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(t,i,e))?(this.logger.perf(W,G,`RenameWidgetField`,`End`,`${e.id}-${n.id}`),P.resolve(!0)):P.reject({code:g.CantSetAnnotString,message:`failed to rename widget field`})}finally{this.pdfiumModule.FPDFPage_CloseAnnot(i)}})}finally{a.release()}}shareWidgetField(e,t,n,r,i){this.logger.debug(W,G,`ShareWidgetField`,e,n,i),this.logger.perf(W,G,`ShareWidgetField`,`Begin`,`${e.id}-${n.id}-${i.id}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(W,G,`ShareWidgetField`,`End`,`${e.id}-${n.id}-${i.id}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let o=a.acquirePage(t.index),s=r.index===t.index?o:a.acquirePage(r.index);try{return o.withFormHandle(t=>{let r=!1;s!==o&&(this.pdfiumModule.FORM_OnAfterLoadPage(s.pagePtr,t),r=!0);let a=this.getAnnotationByName(o.pagePtr,n.id),c=this.getAnnotationByName(s.pagePtr,i.id);if(!a||!c)return a&&this.pdfiumModule.FPDFPage_CloseAnnot(a),c&&this.pdfiumModule.FPDFPage_CloseAnnot(c),r&&this.pdfiumModule.FORM_OnBeforeClosePage(s.pagePtr,t),P.reject({code:g.NotFound,message:`annotation not found`});try{return this.pdfiumModule.EPDFAnnot_ShareFormField(t,a,c)?(this.logger.perf(W,G,`ShareWidgetField`,`End`,`${e.id}-${n.id}-${i.id}`),P.resolve(!0)):P.reject({code:g.Unknown,message:`failed to share widget field`})}finally{this.pdfiumModule.FPDFPage_CloseAnnot(a),this.pdfiumModule.FPDFPage_CloseAnnot(c),r&&this.pdfiumModule.FORM_OnBeforeClosePage(s.pagePtr,t)}})}finally{o.release(),s!==o&&s.release()}}flattenPage(e,t,n){let{flag:r=y.Display}=n??{};this.logger.debug(W,G,`flattenPage`,e,t,r),this.logger.perf(W,G,`flattenPage`,`Begin`,e.id);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(W,G,`flattenPage`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let a=i.acquirePage(t.index),o=this.pdfiumModule.FPDFPage_Flatten(a.pagePtr,r);return a.release(),this.logger.perf(W,G,`flattenPage`,`End`,e.id),P.resolve(o)}extractPages(e,t){this.logger.debug(W,G,`extractPages`,e,t),this.logger.perf(W,G,`ExtractPages`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(W,G,`ExtractPages`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let r=this.pdfiumModule.FPDF_CreateNewDocument();if(!r)return this.logger.perf(W,G,`ExtractPages`,`End`,e.id),P.reject({code:g.CantCreateNewDoc,message:`can not create new document`});let i=this.memoryManager.malloc(4*t.length);for(let e=0;e<t.length;e++)this.pdfiumModule.pdfium.setValue(i+4*e,t[e],`i32`);if(!this.pdfiumModule.FPDF_ImportPagesByIndex(r,n.docPtr,i,t.length,0))return this.pdfiumModule.FPDF_CloseDocument(r),this.logger.perf(W,G,`ExtractPages`,`End`,e.id),P.reject({code:g.CantImportPages,message:`can not import pages to new document`});let a=this.saveDocument(r);return this.pdfiumModule.FPDF_CloseDocument(r),this.logger.perf(W,G,`ExtractPages`,`End`,e.id),P.resolve(a)}importPages(e,t,n,r){this.logger.debug(W,G,`importPages`,e.id,t.id,n),this.logger.perf(W,G,`ImportPages`,`Begin`,e.id);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(W,G,`ImportPages`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`destination document is not open`});let a=this.cache.getContext(t.id);if(!a)return this.logger.perf(W,G,`ImportPages`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`source document is not open`});let o=r??this.pdfiumModule.FPDF_GetPageCount(i.docPtr),s=this.memoryManager.malloc(4*n.length);for(let e=0;e<n.length;e++)this.pdfiumModule.pdfium.setValue(s+4*e,n[e],`i32`);if(!this.pdfiumModule.FPDF_ImportPagesByIndex(i.docPtr,a.docPtr,s,n.length,o))return this.memoryManager.free(s),this.logger.perf(W,G,`ImportPages`,`End`,e.id),P.reject({code:g.CantImportPages,message:`can not import pages into destination document`});this.memoryManager.free(s);let c=[],l=this.memoryManager.malloc(8),u=i.normalizeRotation;for(let t=0;t<n.length;t++){let n=o+t;if(!(u?this.pdfiumModule.EPDF_GetPageSizeByIndexNormalized(i.docPtr,n,l):this.pdfiumModule.FPDF_GetPageSizeByIndexF(i.docPtr,n,l)))return this.memoryManager.free(l),this.logger.perf(W,G,`ImportPages`,`End`,e.id),P.reject({code:g.Unknown,message:`failed to read metadata for imported page ${n}`});let r=this.pdfiumModule.EPDF_GetPageRotationByIndex(i.docPtr,n),a=this.pdfiumModule.EPDFDoc_GetPageObjectNumberByIndex(i.docPtr,n);c.push({index:n,size:{width:this.pdfiumModule.pdfium.getValue(l,`float`),height:this.pdfiumModule.pdfium.getValue(l+4,`float`)},rotation:r,objectNumber:a})}return this.memoryManager.free(l),this.logger.perf(W,G,`ImportPages`,`End`,e.id),P.resolve(c)}deletePage(e,t){this.logger.debug(W,G,`deletePage`,e.id,t),this.logger.perf(W,G,`DeletePage`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(W,G,`DeletePage`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document is not open`});let r=this.pdfiumModule.FPDF_GetPageCount(n.docPtr);return t<0||t>=r?(this.logger.perf(W,G,`DeletePage`,`End`,e.id),P.reject({code:g.CantDeletePage,message:`page index ${t} out of range (0..${r-1})`})):(this.pdfiumModule.FPDFPage_Delete(n.docPtr,t),this.logger.perf(W,G,`DeletePage`,`End`,e.id),P.resolve(!0))}extractText(e,t){this.logger.debug(W,G,`extractText`,e,t),this.logger.perf(W,G,`ExtractText`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(W,G,`ExtractText`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let r=[];for(let e=0;e<t.length;e++){let i=n.acquirePage(t[e]),a=this.pdfiumModule.FPDFText_LoadPage(i.pagePtr),o=this.pdfiumModule.FPDFText_CountChars(a),s=this.memoryManager.malloc(2*(o+1));this.pdfiumModule.FPDFText_GetText(a,0,o,s);let c=this.pdfiumModule.pdfium.UTF16ToString(s);this.memoryManager.free(s),r.push(c),this.pdfiumModule.FPDFText_ClosePage(a),i.release()}let i=r.join(`
4
+
5
+ `);return this.logger.perf(W,G,`ExtractText`,`End`,e.id),P.resolve(i)}getTextSlices(e,t){if(this.logger.debug(W,G,`getTextSlices`,e,t),this.logger.perf(W,G,`GetTextSlices`,`Begin`,e.id),t.length===0)return this.logger.perf(W,G,`GetTextSlices`,`End`,e.id),P.resolve([]);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(W,G,`GetTextSlices`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});try{let r=Array(t.length),i=new Map;t.forEach((e,t)=>{(i.get(e.pageIndex)??i.set(e.pageIndex,[]).get(e.pageIndex)).push({slice:e,pos:t})});for(let[e,t]of i){let i=n.acquirePage(e),a=i.getTextPage();for(let{slice:e,pos:n}of t){let t=this.memoryManager.malloc(2*(e.charCount+1));this.pdfiumModule.FPDFText_GetText(a,e.charIndex,e.charCount,t),r[n]=o(this.pdfiumModule.pdfium.UTF16ToString(t)),this.memoryManager.free(t)}i.release()}return this.logger.perf(W,G,`GetTextSlices`,`End`,e.id),P.resolve(r)}catch(t){return this.logger.error(W,G,`getTextSlices error`,t),this.logger.perf(W,G,`GetTextSlices`,`End`,e.id),P.reject({code:g.Unknown,message:String(t)})}}merge(e){this.logger.debug(W,G,`merge`,e);let t=e.map(e=>e.id).join(`.`);this.logger.perf(W,G,`Merge`,`Begin`,t);let n=this.pdfiumModule.FPDF_CreateNewDocument();if(!n)return this.logger.perf(W,G,`Merge`,`End`,t),P.reject({code:g.CantCreateNewDoc,message:`can not create new document`});let r=[];for(let i of e.reverse()){let e=new Uint8Array(i.content),a=e.length,o=this.memoryManager.malloc(a);this.pdfiumModule.pdfium.HEAPU8.set(e,o);let s=this.pdfiumModule.FPDF_LoadMemDocument(o,a,``);if(!s){let e=this.pdfiumModule.FPDF_GetLastError();this.logger.error(W,G,`FPDF_LoadMemDocument failed with ${e}`),this.memoryManager.free(o);for(let e of r)this.pdfiumModule.FPDF_CloseDocument(e.docPtr),this.memoryManager.free(e.filePtr);return this.logger.perf(W,G,`Merge`,`End`,t),P.reject({code:e,message:`FPDF_LoadMemDocument failed`})}if(r.push({filePtr:o,docPtr:s}),!this.pdfiumModule.FPDF_ImportPages(n,s,``,0)){this.pdfiumModule.FPDF_CloseDocument(n);for(let e of r)this.pdfiumModule.FPDF_CloseDocument(e.docPtr),this.memoryManager.free(e.filePtr);return this.logger.perf(W,G,`Merge`,`End`,t),P.reject({code:g.CantImportPages,message:`can not import pages to new document`})}}let i=this.saveDocument(n);this.pdfiumModule.FPDF_CloseDocument(n);for(let e of r)this.pdfiumModule.FPDF_CloseDocument(e.docPtr),this.memoryManager.free(e.filePtr);let a={id:`${Math.random()}`,content:i};return this.logger.perf(W,G,`Merge`,`End`,t),P.resolve(a)}mergePages(e){let t=e.map(e=>`${e.docId}:${e.pageIndices.join(`,`)}`).join(`|`);this.logger.debug(W,G,`mergePages`,e),this.logger.perf(W,G,`MergePages`,`Begin`,t);let n=this.pdfiumModule.FPDF_CreateNewDocument();if(!n)return this.logger.perf(W,G,`MergePages`,`End`,t),P.reject({code:g.CantCreateNewDoc,message:`Cannot create new document`});try{for(let t of[...e].reverse()){let e=this.cache.getContext(t.docId);if(!e){this.logger.warn(W,G,`Document ${t.docId} is not open, skipping`);continue}let r=this.pdfiumModule.FPDF_GetPageCount(e.docPtr),i=t.pageIndices.filter(e=>e>=0&&e<r);if(i.length===0)continue;let a=i.map(e=>e+1).join(`,`);try{if(!this.pdfiumModule.FPDF_ImportPages(n,e.docPtr,a,0))throw Error(`Failed to import pages ${a} from document ${t.docId}`)}finally{}}let r=this.saveDocument(n),i={id:`${Math.random()}`,content:r};return this.logger.perf(W,G,`MergePages`,`End`,t),P.resolve(i)}catch(e){return this.logger.error(W,G,`mergePages failed`,e),this.logger.perf(W,G,`MergePages`,`End`,t),P.reject({code:g.CantImportPages,message:e instanceof Error?e.message:`Failed to merge pages`})}finally{n&&this.pdfiumModule.FPDF_CloseDocument(n)}}setDocumentEncryption(e,t,n,r){this.logger.debug(W,G,`setDocumentEncryption`,e,r);let i=this.cache.getContext(e.id);if(!i)return P.reject({code:g.DocNotOpen,message:`document does not open`});let a=this.pdfiumModule.EPDF_SetEncryption(i.docPtr,t,n,r);return P.resolve(a)}removeEncryption(e){this.logger.debug(W,G,`removeEncryption`,e);let t=this.cache.getContext(e.id);if(!t)return P.reject({code:g.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.EPDF_RemoveEncryption(t.docPtr);return P.resolve(n)}unlockOwnerPermissions(e,t){this.logger.debug(W,G,`unlockOwnerPermissions`,e.id);let n=this.cache.getContext(e.id);if(!n)return P.reject({code:g.DocNotOpen,message:`document does not open`});let r=this.pdfiumModule.EPDF_UnlockOwnerPermissions(n.docPtr,t);return P.resolve(r)}isEncrypted(e){this.logger.debug(W,G,`isEncrypted`,e.id);let t=this.cache.getContext(e.id);if(!t)return P.reject({code:g.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.EPDF_IsEncrypted(t.docPtr);return P.resolve(n)}isOwnerUnlocked(e){this.logger.debug(W,G,`isOwnerUnlocked`,e.id);let t=this.cache.getContext(e.id);if(!t)return P.reject({code:g.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.EPDF_IsOwnerUnlocked(t.docPtr);return P.resolve(n)}saveAsCopy(e){this.logger.debug(W,G,`saveAsCopy`,e),this.logger.perf(W,G,`SaveAsCopy`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(W,G,`SaveAsCopy`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let n=this.saveDocument(t.docPtr);return this.logger.perf(W,G,`SaveAsCopy`,`End`,e.id),P.resolve(n)}closeDocument(e){return this.logger.debug(W,G,`closeDocument`,e),this.logger.perf(W,G,`CloseDocument`,`Begin`,e.id),this.cache.closeDocument(e.id),this.logger.perf(W,G,`CloseDocument`,`End`,e.id),P.resolve(!0)}closeAllDocuments(){return this.logger.debug(W,G,`closeAllDocuments`),this.logger.perf(W,G,`CloseAllDocuments`,`Begin`),this.cache.closeAllDocuments(),this.logger.perf(W,G,`CloseAllDocuments`,`End`),P.resolve(!0)}addTextContent(e,t,n,r,i){if(!this.setAnnotationName(r,i.name??i.icon??ee.Comment)||i.state&&!this.setAnnotString(r,`State`,i.state)||i.stateModel&&!this.setAnnotString(r,`StateModel`,i.stateModel)||!this.setAnnotationOpacity(r,i.opacity??1))return!1;let a=i.strokeColor??i.color??`#FFFF00`;return!!this.setAnnotationColor(r,a,f.Color)&&!(!i.flags&&!this.setAnnotationFlags(r,[`print`,`noZoom`,`noRotate`]))&&this.applyBaseAnnotationProperties(e,t,n,r,i)}addCaretContent(e,t,n,r,i){return i.strokeColor&&this.setAnnotationColor(r,i.strokeColor,f.Color),i.opacity!==void 0&&this.setAnnotationOpacity(r,i.opacity),i.intent&&this.setAnnotIntent(r,i.intent),this.setRectangleDifferences(r,i.rectangleDifferences),this.applyBaseAnnotationProperties(e,t,n,r,i)}addFreeTextContent(e,t,n,r,i){if(!this.setBorderStyle(r,N.SOLID,i.strokeWidth??0)||!this.setAnnotationOpacity(r,i.opacity??1)||!this.setAnnotationTextAlignment(r,i.textAlign)||!this.setAnnotationVerticalAlignment(r,i.verticalAlign))return!1;let a=i.strokeColor??i.fontColor;if(!this.setAnnotationDefaultAppearance(r,i.fontFamily===c.Unknown?c.Helvetica:i.fontFamily,i.fontSize,a)||(i.strokeColor&&i.strokeColor!==i.fontColor&&this.setAnnotationColor(r,i.fontColor,f.TextColor),i.intent&&!this.setAnnotIntent(r,i.intent))||i.calloutLine&&i.calloutLine.length>=2&&!this.setCalloutLine(e,t,r,i.calloutLine)||i.lineEnding!==void 0&&!this.setLineEndings(r,s.None,i.lineEnding))return!1;let o=i.color??i.backgroundColor;if(o&&o!==`transparent`){if(!this.setAnnotationColor(r,o??`#FFFFFF`,f.Color))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,f.Color))return!1;return this.setRectangleDifferences(r,i.rectangleDifferences),this.applyBaseAnnotationProperties(e,t,n,r,i)}addTextFieldContent(e,n,r){if(!this.setAnnotationDefaultAppearance(n,r.fontFamily,r.fontSize,r.fontColor)||!this.setBorderStyle(n,N.SOLID,r.strokeWidth??1))return!1;r.strokeColor&&r.strokeColor!==`transparent`?this.setMKColor(n,0,r.strokeColor):this.clearMKColor(n,0),r.color&&r.color!==`transparent`?this.setMKColor(n,1,r.color):this.clearMKColor(n,1);let i=r.field.flag??t.NONE;this.pdfiumModule.FPDFAnnot_SetFormFieldFlags(e,n,i),r.field.name&&this.withWString(r.field.name,t=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(e,n,t)),this.withWString(r.field.value??``,t=>this.pdfiumModule.EPDFAnnot_SetFormFieldValue(e,n,t));let a=r.field;return a.maxLen!=null&&a.maxLen>0&&this.pdfiumModule.EPDFAnnot_SetNumberValue(n,`MaxLen`,a.maxLen),!0}addToggleFieldContent(e,r,i){if(!this.setBorderStyle(r,N.SOLID,i.strokeWidth??1))return!1;i.strokeColor&&i.strokeColor!==`transparent`?this.setMKColor(r,0,i.strokeColor):this.clearMKColor(r,0),i.color&&i.color!==`transparent`?this.setMKColor(r,1,i.color):this.clearMKColor(r,1);let a=i.field.flag??t.NONE;return i.field.type===n.RADIOBUTTON&&(a|=t.BUTTON_RADIO|t.BUTTON_NOTOGGLETOOFF),this.pdfiumModule.FPDFAnnot_SetFormFieldFlags(e,r,a),i.field.name&&this.withWString(i.field.name,t=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(e,r,t)),!0}addChoiceFieldContent(e,r,i){if(!this.setAnnotationDefaultAppearance(r,i.fontFamily,i.fontSize,i.fontColor)||!this.setBorderStyle(r,N.SOLID,i.strokeWidth??1))return!1;i.strokeColor&&i.strokeColor!==`transparent`?this.setMKColor(r,0,i.strokeColor):this.clearMKColor(r,0),i.color&&i.color!==`transparent`?this.setMKColor(r,1,i.color):this.clearMKColor(r,1);let a=i.field.flag??t.NONE;i.field.type===n.COMBOBOX&&(a|=1<<17),this.pdfiumModule.FPDFAnnot_SetFormFieldFlags(e,r,a),i.field.name&&this.withWString(i.field.name,t=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(e,r,t));let o=i.field.options??[];if(o.length>0){let t=this.memoryManager.malloc(o.length*4),n=[];try{for(let e=0;e<o.length;e++){let r=o[e].label,i=2*(r.length+1),a=this.memoryManager.malloc(i);this.pdfiumModule.pdfium.stringToUTF16(r,a,i),n.push(a),this.pdfiumModule.pdfium.setValue(t+e*4,a,`*`)}this.pdfiumModule.EPDFAnnot_SetFormFieldOptions(e,r,t,o.length)}finally{for(let e of n)this.memoryManager.free(ue(e));this.memoryManager.free(t)}}let s=o.find(e=>e.isSelected)?.label??i.field.value??``;return this.withWString(s,t=>this.pdfiumModule.EPDFAnnot_SetFormFieldValue(e,r,t)),!0}setMKColor(e,t,n){let{red:r,green:i,blue:a}=O(n);return this.pdfiumModule.EPDFAnnot_SetMKColor(e,t,255&r,255&i,255&a)}clearMKColor(e,t){return this.pdfiumModule.EPDFAnnot_ClearMKColor(e,t)}getMKColor(e,t){let n=this.memoryManager.malloc(4),r=this.memoryManager.malloc(4),i=this.memoryManager.malloc(4);try{if(!this.pdfiumModule.EPDFAnnot_GetMKColor(e,t,n,r,i))return;let a=255&this.pdfiumModule.pdfium.getValue(n,`i32`),o=255&this.pdfiumModule.pdfium.getValue(r,`i32`),s=255&this.pdfiumModule.pdfium.getValue(i,`i32`);return w({red:a,green:o,blue:s})}finally{this.memoryManager.free(i),this.memoryManager.free(r),this.memoryManager.free(n)}}addInkStroke(e,t,n,r,i){if(!this.setBorderStyle(r,N.SOLID,i.strokeWidth)||!this.setInkList(e,t,r,i.inkList)||!this.setAnnotationOpacity(r,i.opacity??1))return!1;let a=i.strokeColor??i.color??`#FFFF00`;return!!this.setAnnotationColor(r,a,f.Color)&&this.applyBaseAnnotationProperties(e,t,n,r,i)}addLineContent(e,t,n,r,i){if(!this.setLinePoints(e,t,r,i.linePoints.start,i.linePoints.end)||!this.setLineEndings(r,i.lineEndings?.start??s.None,i.lineEndings?.end??s.None)||!this.setBorderStyle(r,i.strokeStyle,i.strokeWidth)||!this.setBorderDashPattern(r,i.strokeDashArray??[])||i.intent&&!this.setAnnotIntent(r,i.intent))return!1;if(i.color&&i.color!==`transparent`){if(!this.setAnnotationColor(r,i.color??`#FFFF00`,f.InteriorColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,f.InteriorColor))return!1;return!!this.setAnnotationOpacity(r,i.opacity??1)&&!!this.setAnnotationColor(r,i.strokeColor??`#FFFF00`,f.Color)&&this.applyBaseAnnotationProperties(e,t,n,r,i)}addPolyContent(e,t,n,r,i){if(i.type===M.POLYLINE&&!this.setLineEndings(r,i.lineEndings?.start??s.None,i.lineEndings?.end??s.None)||!this.setPdfAnnoVertices(e,t,r,i.vertices)||!this.setBorderStyle(r,i.strokeStyle,i.strokeWidth)||!this.setBorderDashPattern(r,i.strokeDashArray??[])||i.intent&&!this.setAnnotIntent(r,i.intent))return!1;if(i.color&&i.color!==`transparent`){if(!this.setAnnotationColor(r,i.color??`#FFFF00`,f.InteriorColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,f.InteriorColor))return!1;if(!this.setAnnotationOpacity(r,i.opacity??1)||!this.setAnnotationColor(r,i.strokeColor??`#FFFF00`,f.Color))return!1;if(i.type===M.POLYGON){let e=i;this.setRectangleDifferences(r,e.rectangleDifferences),this.setBorderEffect(r,e.cloudyBorderIntensity)}return this.applyBaseAnnotationProperties(e,t,n,r,i)}addLinkContent(e,t,n,r,i,a){let o=a.strokeStyle??N.UNDERLINE,s=a.strokeWidth??2;return!!this.setBorderStyle(i,o,s)&&!(a.strokeDashArray&&!this.setBorderDashPattern(i,a.strokeDashArray))&&!(a.strokeColor&&!this.setAnnotationColor(i,a.strokeColor,f.Color))&&!(a.target&&!this.applyLinkTarget(n,i,a.target))&&this.applyBaseAnnotationProperties(e,t,r,i,a)}addShapeContent(e,t,n,r,i){if(!this.setBorderStyle(r,i.strokeStyle,i.strokeWidth)||!this.setBorderDashPattern(r,i.strokeDashArray??[]))return!1;if(i.color&&i.color!==`transparent`){if(!this.setAnnotationColor(r,i.color??`#FFFF00`,f.InteriorColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,f.InteriorColor))return!1;return!!this.setAnnotationOpacity(r,i.opacity??1)&&!!this.setAnnotationColor(r,i.strokeColor??`#FFFF00`,f.Color)&&(this.setRectangleDifferences(r,i.rectangleDifferences),this.setBorderEffect(r,i.cloudyBorderIntensity),this.applyBaseAnnotationProperties(e,t,n,r,i))}addTextMarkupContent(e,t,n,r,i){if(!this.syncQuadPointsAnno(e,t,r,i.segmentRects)||!this.setAnnotationOpacity(r,i.opacity??1))return!1;let a=i.strokeColor??i.color??`#FFFF00`;return!!this.setAnnotationColor(r,a,f.Color)&&this.applyBaseAnnotationProperties(e,t,n,r,i)}addRedactContent(e,t,n,r,i){if(!this.syncQuadPointsAnno(e,t,r,i.segmentRects)||!this.setAnnotationOpacity(r,i.opacity??1))return!1;if(i.color&&i.color!==`transparent`){if(!this.setAnnotationColor(r,i.color,f.InteriorColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,f.InteriorColor))return!1;if(i.overlayColor&&i.overlayColor!==`transparent`){if(!this.setAnnotationColor(r,i.overlayColor,f.OverlayColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,f.OverlayColor))return!1;if(i.strokeColor&&i.strokeColor!==`transparent`){if(!this.setAnnotationColor(r,i.strokeColor,f.Color))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,f.Color))return!1;if(!this.setOverlayText(r,i.overlayText)||i.overlayTextRepeat!==void 0&&!this.setOverlayTextRepeat(r,i.overlayTextRepeat))return!1;if(i.fontFamily!==void 0||i.fontSize!==void 0){let e=i.fontFamily==null||i.fontFamily===c.Unknown?c.Helvetica:i.fontFamily;if(!this.setAnnotationDefaultAppearance(r,e,i.fontSize??12,i.fontColor??`#000000`))return!1}return!(i.textAlign!==void 0&&!this.setAnnotationTextAlignment(r,i.textAlign))&&this.applyBaseAnnotationProperties(e,t,n,r,i)}addStampContent(e,t,n,i,a,o,s){let c=o.name??o.icon;if(c&&!this.setAnnotationName(a,c))return!1;if(s&&`data`in s&&s.data){let r=x(s.data);if(!r)return!1;if(r.mimeType===`application/pdf`){if(!this.setAppearanceFromPdf(t,a,s.data))return!1}else{for(let e=this.pdfiumModule.FPDFAnnot_GetObjectCount(a)-1;e>=0;e--)this.pdfiumModule.FPDFAnnot_RemoveObject(a,e);if(r.mimeType===`image/png`){if(!this.addPngImageObject(e,t,n,i,a,o.rect,s.data))return!1}else if(r.mimeType===`image/jpeg`&&!this.addJpegImageObject(e,t,n,i,a,o.rect,s.data))return!1}}else if(s&&`imageData`in s&&s.imageData){for(let e=this.pdfiumModule.FPDFAnnot_GetObjectCount(a)-1;e>=0;e--)this.pdfiumModule.FPDFAnnot_RemoveObject(a,e);if(!this.addImageObject(e,t,n,i,a,o.rect,s.imageData))return!1}else if(s&&`appearance`in s&&s.appearance&&!this.setAppearanceFromPdf(t,a,s.appearance))return!1;return!!this.applyBaseAnnotationProperties(e,n,i,a,o)&&!!this.pdfiumModule.EPDFAnnot_UpdateAppearanceToRect(a,r.Cover)}setAppearanceFromPdf(e,t,n){let r=new Uint8Array(n),i=this.memoryManager.malloc(r.byteLength);this.pdfiumModule.pdfium.HEAPU8.set(r,i);let a=this.pdfiumModule.FPDF_LoadMemDocument(i,r.byteLength,``);if(!a)return this.memoryManager.free(i),!1;let o=this.pdfiumModule.EPDFAnnot_SetAppearanceFromPage(t,a,0);return this.pdfiumModule.FPDF_CloseDocument(a),this.memoryManager.free(i),!!o}addImageObject(e,t,n,r,i,a,o){let s=o.width*o.height,c=this.memoryManager.malloc(4*s);if(!c)return!1;for(let e=0;e<s;e++){let t=o.data[4*e],n=o.data[4*e+1],r=o.data[4*e+2],i=o.data[4*e+3];this.pdfiumModule.pdfium.setValue(c+4*e,r,`i8`),this.pdfiumModule.pdfium.setValue(c+4*e+1,n,`i8`),this.pdfiumModule.pdfium.setValue(c+4*e+2,t,`i8`),this.pdfiumModule.pdfium.setValue(c+4*e+3,i,`i8`)}let l=this.pdfiumModule.FPDFBitmap_CreateEx(o.width,o.height,4,c,0);if(!l)return this.memoryManager.free(c),!1;let u=this.pdfiumModule.FPDFPageObj_NewImageObj(t);if(!u)return this.pdfiumModule.FPDFBitmap_Destroy(l),this.memoryManager.free(c),!1;if(!this.pdfiumModule.FPDFImageObj_SetBitmap(r,0,u,l))return this.pdfiumModule.FPDFBitmap_Destroy(l),this.pdfiumModule.FPDFPageObj_Destroy(u),this.memoryManager.free(c),!1;let d=this.memoryManager.malloc(24);if(this.pdfiumModule.pdfium.setValue(d,a.size.width,`float`),this.pdfiumModule.pdfium.setValue(d+4,0,`float`),this.pdfiumModule.pdfium.setValue(d+8,0,`float`),this.pdfiumModule.pdfium.setValue(d+12,a.size.height,`float`),this.pdfiumModule.pdfium.setValue(d+16,0,`float`),this.pdfiumModule.pdfium.setValue(d+20,0,`float`),!this.pdfiumModule.FPDFPageObj_SetMatrix(u,d))return this.memoryManager.free(d),this.pdfiumModule.FPDFBitmap_Destroy(l),this.pdfiumModule.FPDFPageObj_Destroy(u),this.memoryManager.free(c),!1;this.memoryManager.free(d);let f=this.convertDevicePointToPagePoint(e,n,{x:a.origin.x,y:a.origin.y+a.size.height});return this.pdfiumModule.FPDFPageObj_Transform(u,1,0,0,1,f.x,f.y),this.pdfiumModule.FPDFAnnot_AppendObject(i,u)?(this.pdfiumModule.FPDFBitmap_Destroy(l),this.memoryManager.free(c),!0):(this.pdfiumModule.FPDFBitmap_Destroy(l),this.pdfiumModule.FPDFPageObj_Destroy(u),this.memoryManager.free(c),!1)}addPngImageObject(e,t,n,r,i,a,o){let s=this.pdfiumModule.FPDFPageObj_NewImageObj(t);if(!s)return!1;let c=new Uint8Array(o),l=this.memoryManager.malloc(c.byteLength);if(!l)return this.pdfiumModule.FPDFPageObj_Destroy(s),!1;if(this.pdfiumModule.pdfium.HEAPU8.set(c,l),!this.pdfiumModule.EPDFImageObj_SetPng(r,0,s,l,c.byteLength))return this.memoryManager.free(l),this.pdfiumModule.FPDFPageObj_Destroy(s),!1;this.memoryManager.free(l);let u=this.memoryManager.malloc(24);if(this.pdfiumModule.pdfium.setValue(u,a.size.width,`float`),this.pdfiumModule.pdfium.setValue(u+4,0,`float`),this.pdfiumModule.pdfium.setValue(u+8,0,`float`),this.pdfiumModule.pdfium.setValue(u+12,a.size.height,`float`),this.pdfiumModule.pdfium.setValue(u+16,0,`float`),this.pdfiumModule.pdfium.setValue(u+20,0,`float`),!this.pdfiumModule.FPDFPageObj_SetMatrix(s,u))return this.memoryManager.free(u),this.pdfiumModule.FPDFPageObj_Destroy(s),!1;this.memoryManager.free(u);let d=this.convertDevicePointToPagePoint(e,n,{x:a.origin.x,y:a.origin.y+a.size.height});return this.pdfiumModule.FPDFPageObj_Transform(s,1,0,0,1,d.x,d.y),!!this.pdfiumModule.FPDFAnnot_AppendObject(i,s)||(this.pdfiumModule.FPDFPageObj_Destroy(s),!1)}addJpegImageObject(e,t,n,r,i,a,o){let s=this.pdfiumModule.FPDFPageObj_NewImageObj(t);if(!s)return!1;let c=new Uint8Array(o),l=this.memoryManager.malloc(c.byteLength);if(!l)return this.pdfiumModule.FPDFPageObj_Destroy(s),!1;if(this.pdfiumModule.pdfium.HEAPU8.set(c,l),!this.pdfiumModule.EPDFImageObj_SetJpeg(r,0,s,l,c.byteLength))return this.memoryManager.free(l),this.pdfiumModule.FPDFPageObj_Destroy(s),!1;this.memoryManager.free(l);let u=this.memoryManager.malloc(24);if(this.pdfiumModule.pdfium.setValue(u,a.size.width,`float`),this.pdfiumModule.pdfium.setValue(u+4,0,`float`),this.pdfiumModule.pdfium.setValue(u+8,0,`float`),this.pdfiumModule.pdfium.setValue(u+12,a.size.height,`float`),this.pdfiumModule.pdfium.setValue(u+16,0,`float`),this.pdfiumModule.pdfium.setValue(u+20,0,`float`),!this.pdfiumModule.FPDFPageObj_SetMatrix(s,u))return this.memoryManager.free(u),this.pdfiumModule.FPDFPageObj_Destroy(s),!1;this.memoryManager.free(u);let d=this.convertDevicePointToPagePoint(e,n,{x:a.origin.x,y:a.origin.y+a.size.height});return this.pdfiumModule.FPDFPageObj_Transform(s,1,0,0,1,d.x,d.y),!!this.pdfiumModule.FPDFAnnot_AppendObject(i,s)||(this.pdfiumModule.FPDFPageObj_Destroy(s),!1)}saveDocument(e){let t=this.pdfiumModule.PDFiumExt_OpenFileWriter();this.pdfiumModule.PDFiumExt_SaveAsCopy(e,t);let n=this.pdfiumModule.PDFiumExt_GetFileWriterSize(t),r=this.memoryManager.malloc(n);this.pdfiumModule.PDFiumExt_GetFileWriterData(t,r,n);let i=new ArrayBuffer(n),a=new DataView(i);for(let e=0;e<n;e++)a.setInt8(e,this.pdfiumModule.pdfium.getValue(r+e,`i8`));return this.memoryManager.free(r),this.pdfiumModule.PDFiumExt_CloseFileWriter(t),i}readCatalogLanguage(e){let t=this.pdfiumModule.EPDFCatalog_GetLanguage(e,0,0)>>>0;return t===0?null:t===2?``:L(this.pdfiumModule.pdfium,(t,n)=>this.pdfiumModule.EPDFCatalog_GetLanguage(e,t,n),this.pdfiumModule.pdfium.UTF16ToString,t)}readMetaText(e,t){if(!this.pdfiumModule.EPDF_HasMetaText(e,t))return null;let n=this.pdfiumModule.FPDF_GetMetaText(e,t,0,0);return n===2?``:L(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.FPDF_GetMetaText(e,t,n,r),this.pdfiumModule.pdfium.UTF16ToString,n)}setMetaText(e,t,n){if(n==null||n.length===0)return!!this.pdfiumModule.EPDF_SetMetaText(e,t,0);let r=2*(n.length+1),i=this.memoryManager.malloc(r);try{return this.pdfiumModule.pdfium.stringToUTF16(n,i,r),!!this.pdfiumModule.EPDF_SetMetaText(e,t,i)}finally{this.memoryManager.free(i)}}getMetaTrapped(e){let t=Number(this.pdfiumModule.EPDF_GetMetaTrapped(e));switch(t){case C.NotSet:case C.True:case C.False:case C.Unknown:return t;default:return C.Unknown}}setMetaTrapped(e,t){let n=t==null||t===void 0?C.NotSet:t;return(n===C.NotSet||n===C.True||n===C.False||n===C.Unknown)&&!!this.pdfiumModule.EPDF_SetMetaTrapped(e,n)}getMetaKeyCount(e,t){return 0|Number(this.pdfiumModule.EPDF_GetMetaKeyCount(e,t))}getMetaKeyName(e,t,n){let r=this.pdfiumModule.EPDF_GetMetaKeyName(e,t,n,0,0);return r?L(this.pdfiumModule.pdfium,(r,i)=>this.pdfiumModule.EPDF_GetMetaKeyName(e,t,n,r,i),this.pdfiumModule.pdfium.UTF8ToString,r):null}readAllMeta(e,t=!0){let n=this.getMetaKeyCount(e,t),r={};for(let i=0;i<n;i++){let n=this.getMetaKeyName(e,i,t);n&&(r[n]=this.readMetaText(e,n))}return r}readPdfBookmarks(e,t=0){let n=this.pdfiumModule.FPDFBookmark_GetFirstChild(e,t),r=[];for(;n;){let t=this.readPdfBookmark(e,n);r.push(t),n=this.pdfiumModule.FPDFBookmark_GetNextSibling(e,n)}return r}readPdfBookmark(e,t){let n=L(this.pdfiumModule.pdfium,(e,n)=>this.pdfiumModule.FPDFBookmark_GetTitle(t,e,n),this.pdfiumModule.pdfium.UTF16ToString),r=this.readPdfBookmarks(e,t);return{title:n,target:this.readPdfBookmarkTarget(e,()=>this.pdfiumModule.FPDFBookmark_GetAction(t),()=>this.pdfiumModule.FPDFBookmark_GetDest(e,t)),children:r}}readPageTextRects(e,t,n,r){let i=this.pdfiumModule.FPDFText_CountRects(r,0,-1),a=[];for(let t=0;t<i;t++){let i=this.memoryManager.malloc(8),o=this.memoryManager.malloc(8),s=this.memoryManager.malloc(8),c=this.memoryManager.malloc(8);if(!this.pdfiumModule.FPDFText_GetRect(r,t,o,i,s,c)){this.memoryManager.free(o),this.memoryManager.free(i),this.memoryManager.free(s),this.memoryManager.free(c);continue}let l=this.pdfiumModule.pdfium.getValue(o,`double`),u=this.pdfiumModule.pdfium.getValue(i,`double`),d=this.pdfiumModule.pdfium.getValue(s,`double`),f=this.pdfiumModule.pdfium.getValue(c,`double`);this.memoryManager.free(o),this.memoryManager.free(i),this.memoryManager.free(s),this.memoryManager.free(c);let p=this.memoryManager.malloc(4),m=this.memoryManager.malloc(4);this.pdfiumModule.FPDF_PageToDevice(n,0,0,e.size.width,e.size.height,0,l,u,p,m);let h=this.pdfiumModule.pdfium.getValue(p,`i32`),g=this.pdfiumModule.pdfium.getValue(m,`i32`);this.memoryManager.free(p),this.memoryManager.free(m);let _={origin:{x:h,y:g},size:{width:Math.ceil(Math.abs(d-l)),height:Math.ceil(Math.abs(u-f))}},v=this.pdfiumModule.FPDFText_GetBoundedText(r,l,u,d,f,0,0),y=2*(v+1),b=this.memoryManager.malloc(y);this.pdfiumModule.FPDFText_GetBoundedText(r,l,u,d,f,b,v);let x=this.pdfiumModule.pdfium.UTF16ToString(b);this.memoryManager.free(b);let S=this.pdfiumModule.FPDFText_GetCharIndexAtPos(r,l,u,2,2),C=``,w=_.size.height;if(S>=0){w=this.pdfiumModule.FPDFText_GetFontSize(r,S);let e=this.pdfiumModule.FPDFText_GetFontInfo(r,S,0,0,0)+1,t=this.memoryManager.malloc(e),n=this.memoryManager.malloc(4);this.pdfiumModule.FPDFText_GetFontInfo(r,S,t,e,n),C=this.pdfiumModule.pdfium.UTF8ToString(t),this.memoryManager.free(t),this.memoryManager.free(n)}let T={content:x,rect:_,font:{family:C,size:w}};a.push(T)}return a}getPageGeometry(e,t){let n=`getPageGeometry`;this.logger.perf(W,G,n,`Begin`,e.id);let r=this.cache.getContext(e.id);if(!r)return this.logger.perf(W,G,n,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let i=r.acquirePage(t.index),a=i.getTextPage(),o=this.pdfiumModule.FPDFText_CountChars(a),s=[];for(let e=0;e<o;e++){let n=this.readGlyphInfo(t,i.pagePtr,a,e);s.push(n)}let c=this.buildRunsFromGlyphs(s,a);return i.release(),this.logger.perf(W,G,n,`End`,e.id),P.resolve({runs:c})}buildRunsFromGlyphs(e,t){let n=[],r=null,i=null,a=null;for(let o=0;o<e.length;o++){let s=e[o],c=this.pdfiumModule.FPDFText_GetTextObject(t,o);if(c!==i&&(i=c,r={rect:{x:s.origin.x,y:s.origin.y,width:s.size.width,height:s.size.height},charStart:o,glyphs:[],fontSize:this.pdfiumModule.FPDFText_GetFontSize(t,o)},a={minX:s.origin.x,minY:s.origin.y,maxX:s.origin.x+s.size.width,maxY:s.origin.y+s.size.height},n.push(r)),r.glyphs.push({x:s.origin.x,y:s.origin.y,width:s.size.width,height:s.size.height,flags:s.isEmpty?2:+!!s.isSpace,...s.tightOrigin&&{tightX:s.tightOrigin.x,tightY:s.tightOrigin.y},...s.tightSize&&{tightWidth:s.tightSize.width,tightHeight:s.tightSize.height}}),s.isEmpty)continue;let l=s.origin.x+s.size.width,u=s.origin.y+s.size.height;a.minX=Math.min(a.minX,s.origin.x),a.minY=Math.min(a.minY,s.origin.y),a.maxX=Math.max(a.maxX,l),a.maxY=Math.max(a.maxY,u),r.rect.x=a.minX,r.rect.y=a.minY,r.rect.width=a.maxX-a.minX,r.rect.height=a.maxY-a.minY}return n}getPageTextRuns(e,t){let n=`getPageTextRuns`;this.logger.perf(W,G,n,`Begin`,e.id);let r=this.cache.getContext(e.id);if(!r)return this.logger.perf(W,G,n,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let i=r.acquirePage(t.index),a=i.getTextPage(),s=this.pdfiumModule.FPDFText_CountChars(a),c=[],l=0,u=null,d=null,f=0,p=null,m=null,h=e=>{if(u===null||d===null||p===null||m===null)return;let t=e-l;if(t<=0)return;let n=this.memoryManager.malloc(2*(t+1));this.pdfiumModule.FPDFText_GetText(a,l,t,n);let r=o(this.pdfiumModule.pdfium.UTF16ToString(n));this.memoryManager.free(n),c.push({text:r,rect:{origin:{x:m.minX,y:m.minY},size:{width:Math.max(1,m.maxX-m.minX),height:Math.max(1,m.maxY-m.minY)}},font:d,fontSize:f,color:p,charIndex:l,charCount:t})},_=this.memoryManager.malloc(4),v=this.memoryManager.malloc(4),y=this.memoryManager.malloc(4),b=this.memoryManager.malloc(4),x=this.memoryManager.malloc(16),S=this.memoryManager.malloc(4),C=this.memoryManager.malloc(4),w=this.memoryManager.malloc(4),T=this.memoryManager.malloc(4),E=this.memoryManager.malloc(4);for(let e=0;e<s;e++){let n=this.pdfiumModule.FPDFText_GetUnicode(a,e);if(n===65534||n===65533)continue;let r=this.pdfiumModule.FPDFText_GetTextObject(a,e);if(r===0)continue;let o=this.pdfiumModule.FPDFText_GetFontSize(a,e);this.pdfiumModule.FPDFText_GetFillColor(a,e,_,v,y,b);let s=255&this.pdfiumModule.pdfium.getValue(_,`i32`),c=255&this.pdfiumModule.pdfium.getValue(v,`i32`),g=255&this.pdfiumModule.pdfium.getValue(y,`i32`),D=255&this.pdfiumModule.pdfium.getValue(b,`i32`),O=this.readFontInfoFromTextObject(r,E);if((u===null||r!==u||O.name!==d.name||Math.abs(o-f)>.01||s!==p.red||c!==p.green||g!==p.blue)&&(h(e),u=r,d=O,f=o,p={red:s,green:c,blue:g,alpha:D},l=e,m=null),this.pdfiumModule.FPDFText_GetLooseCharBox(a,e,x)){let e=this.pdfiumModule.pdfium.getValue(x,`float`),n=this.pdfiumModule.pdfium.getValue(x+4,`float`),r=this.pdfiumModule.pdfium.getValue(x+8,`float`),a=this.pdfiumModule.pdfium.getValue(x+12,`float`);if(e!==r&&n!==a){this.pdfiumModule.FPDF_PageToDevice(i.pagePtr,0,0,t.size.width,t.size.height,0,e,n,S,C),this.pdfiumModule.FPDF_PageToDevice(i.pagePtr,0,0,t.size.width,t.size.height,0,r,a,w,T);let o=this.pdfiumModule.pdfium.getValue(S,`i32`),s=this.pdfiumModule.pdfium.getValue(C,`i32`),c=this.pdfiumModule.pdfium.getValue(w,`i32`),l=this.pdfiumModule.pdfium.getValue(T,`i32`),u=Math.min(o,c),d=Math.min(s,l),f=Math.abs(c-o),p=Math.abs(l-s);m===null?m={minX:u,minY:d,maxX:u+f,maxY:d+p}:(m.minX=Math.min(m.minX,u),m.minY=Math.min(m.minY,d),m.maxX=Math.max(m.maxX,u+f),m.maxY=Math.max(m.maxY,d+p))}}}return h(s),[_,v,y,b,x,S,C,w,T,E].forEach(e=>this.memoryManager.free(e)),i.release(),this.logger.perf(W,G,n,`End`,e.id),P.resolve({runs:c})}readFontInfoFromTextObject(e,t){let n=this.pdfiumModule.FPDFTextObj_GetFont(e),r=``,i=``,a=400,o=!1,s=!1,c=!1;if(n){let e=this.pdfiumModule.FPDFFont_GetBaseFontName(n,0,0);if(e>0){let t=this.memoryManager.malloc(e+1);this.pdfiumModule.FPDFFont_GetBaseFontName(n,t,e+1),r=this.pdfiumModule.pdfium.UTF8ToString(t),this.memoryManager.free(t)}let l=this.pdfiumModule.FPDFFont_GetFamilyName(n,0,0);if(l>0){let e=this.memoryManager.malloc(l+1);this.pdfiumModule.FPDFFont_GetFamilyName(n,e,l+1),i=this.pdfiumModule.pdfium.UTF8ToString(e),this.memoryManager.free(e)}a=this.pdfiumModule.FPDFFont_GetWeight(n),c=this.pdfiumModule.FPDFFont_GetIsEmbedded(n)!==0,this.pdfiumModule.FPDFFont_GetItalicAngle(n,t)&&(o=this.pdfiumModule.pdfium.getValue(t,`i32`)!==0),s=!!(1&this.pdfiumModule.FPDFFont_GetFlags(n))}return{name:r,familyName:i,weight:a,italic:o,monospaced:s,embedded:c}}readGlyphInfo(e,t,n,r){let i=this.memoryManager.malloc(4),a=this.memoryManager.malloc(4),o=this.memoryManager.malloc(4),s=this.memoryManager.malloc(4),c=this.memoryManager.malloc(16),l=this.memoryManager.malloc(8),u=this.memoryManager.malloc(8),d=this.memoryManager.malloc(8),f=this.memoryManager.malloc(8),p=[c,i,a,o,s,l,u,d,f],m,h,g=0,_=0,v=0,y=0,b=!1;if(this.pdfiumModule.FPDFText_GetLooseCharBox(n,r,c)){let x=this.pdfiumModule.pdfium.getValue(c,`float`),S=this.pdfiumModule.pdfium.getValue(c+4,`float`),C=this.pdfiumModule.pdfium.getValue(c+8,`float`),w=this.pdfiumModule.pdfium.getValue(c+12,`float`);if(x===C||S===w)return p.forEach(e=>this.memoryManager.free(e)),{origin:{x:0,y:0},size:{width:0,height:0},isEmpty:!0};this.pdfiumModule.FPDF_PageToDevice(t,0,0,e.size.width,e.size.height,0,x,S,i,a),this.pdfiumModule.FPDF_PageToDevice(t,0,0,e.size.width,e.size.height,0,C,w,o,s);let T=this.pdfiumModule.pdfium.getValue(i,`i32`),E=this.pdfiumModule.pdfium.getValue(a,`i32`),D=this.pdfiumModule.pdfium.getValue(o,`i32`),O=this.pdfiumModule.pdfium.getValue(s,`i32`);if(g=Math.min(T,D),_=Math.min(E,O),v=Math.max(1,Math.abs(D-T)),y=Math.max(1,Math.abs(O-E)),this.pdfiumModule.FPDFText_GetCharBox(n,r,l,u,d,f)){let n=this.pdfiumModule.pdfium.getValue(l,`double`),r=this.pdfiumModule.pdfium.getValue(u,`double`),c=this.pdfiumModule.pdfium.getValue(d,`double`),p=this.pdfiumModule.pdfium.getValue(f,`double`);this.pdfiumModule.FPDF_PageToDevice(t,0,0,e.size.width,e.size.height,0,n,p,i,a),this.pdfiumModule.FPDF_PageToDevice(t,0,0,e.size.width,e.size.height,0,r,c,o,s);let g=this.pdfiumModule.pdfium.getValue(i,`i32`),_=this.pdfiumModule.pdfium.getValue(a,`i32`),v=this.pdfiumModule.pdfium.getValue(o,`i32`),y=this.pdfiumModule.pdfium.getValue(s,`i32`);m={x:Math.min(g,v),y:Math.min(_,y)},h={width:Math.max(1,Math.abs(v-g)),height:Math.max(1,Math.abs(y-_))}}b=this.pdfiumModule.FPDFText_GetUnicode(n,r)===32}return p.forEach(e=>this.memoryManager.free(e)),{origin:{x:g,y:_},size:{width:v,height:y},...m&&{tightOrigin:m},...h&&{tightSize:h},...b&&{isSpace:b}}}getPageGlyphs(e,t){this.logger.debug(W,G,`getPageGlyphs`,e,t),this.logger.perf(W,G,`getPageGlyphs`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(W,G,`getPageGlyphs`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`document does not open`});let r=n.acquirePage(t.index),i=r.getTextPage(),a=this.pdfiumModule.FPDFText_CountChars(i),o=Array(a);for(let e=0;e<a;e++){let n=this.readGlyphInfo(t,r.pagePtr,i,e);n.isEmpty||(o[e]={...n})}return r.release(),this.logger.perf(W,G,`getPageGlyphs`,`End`,e.id),P.resolve(o)}readCharBox(e,t,n,r){let i=this.memoryManager.malloc(8),a=this.memoryManager.malloc(8),o=this.memoryManager.malloc(8),s=this.memoryManager.malloc(8),c=0,l=0,u=0,d=0;if(this.pdfiumModule.FPDFText_GetCharBox(n,r,a,s,o,i)){let n=this.pdfiumModule.pdfium.getValue(i,`double`),r=this.pdfiumModule.pdfium.getValue(a,`double`),f=this.pdfiumModule.pdfium.getValue(o,`double`),p=this.pdfiumModule.pdfium.getValue(s,`double`),m=this.memoryManager.malloc(4),h=this.memoryManager.malloc(4);this.pdfiumModule.FPDF_PageToDevice(t,0,0,e.size.width,e.size.height,0,r,n,m,h),c=this.pdfiumModule.pdfium.getValue(m,`i32`),l=this.pdfiumModule.pdfium.getValue(h,`i32`),this.memoryManager.free(m),this.memoryManager.free(h),u=Math.ceil(Math.abs(p-r)),d=Math.ceil(Math.abs(n-f))}return this.memoryManager.free(i),this.memoryManager.free(a),this.memoryManager.free(o),this.memoryManager.free(s),{origin:{x:c,y:l},size:{width:u,height:d}}}readPageAnnotations(e,t,n){return t.borrowPage(n.index,r=>r.withFormHandle(i=>{let a=this.pdfiumModule.FPDFPage_GetAnnotCount(r.pagePtr),o=[];for(let s=0;s<a;s++)r.withAnnotation(s,r=>{let a=this.readPageAnnotation(e,t.docPtr,n,r,i);a&&o.push(a)});return o}))}readPageAnnoWidgets(e,t,n){return t.borrowPage(n.index,t=>t.withFormHandle(r=>{let i=this.pdfiumModule.FPDFPage_GetAnnotCount(t.pagePtr),a=[];for(let o=0;o<i;o++)t.withAnnotation(o,t=>{let i=this.readPageAnnoWidget(e,n,t,r);i&&a.push(i)});return a}))}readPageAnnotationsRaw(e,t,n,r){let i=this.pdfiumModule.EPDFPage_GetAnnotCountRaw(t.docPtr,n.index);if(i<=0)return[];let a=[];for(let o=0;o<i;++o){let i=this.pdfiumModule.EPDFPage_GetAnnotRaw(t.docPtr,n.index,o);if(i)try{let o=this.readPageAnnotation(e,t.docPtr,n,i,r);o&&a.push(o)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(i)}}return a}readPageAnnoWidget(e,t,n,r){let i=this.getAnnotString(n,`NM`);if(i||(i=j(),this.setAnnotString(n,`NM`,i)),this.pdfiumModule.FPDFAnnot_GetSubtype(n)===M.WIDGET)return this.readPdfWidgetAnno(e,t,n,r,i)}getPageAnnotationsRaw(e,t){this.logger.debug(W,G,`getPageAnnotationsRaw`,e,t),this.logger.perf(W,G,`GetPageAnnotationsRaw`,`Begin`,`${e.id}-${t.index}`);let n=this.cache.getContext(e.id);if(!n)return P.reject({code:g.DocNotOpen,message:`document does not open`});let r=this.pdfiumModule.PDFiumExt_OpenFormFillInfo(),i=this.pdfiumModule.PDFiumExt_InitFormFillEnvironment(n.docPtr,r);try{let r=this.readPageAnnotationsRaw(e,n,t,i);return this.logger.perf(W,G,`GetPageAnnotationsRaw`,`End`,`${e.id}-${t.index}`),this.logger.debug(W,G,`getPageAnnotationsRaw`,`${e.id}-${t.index}`,r),P.resolve(r)}finally{this.pdfiumModule.PDFiumExt_ExitFormFillEnvironment(i),this.pdfiumModule.PDFiumExt_CloseFormFillInfo(r)}}readPageAnnotation(e,t,n,r,i){let a=this.getAnnotString(r,`NM`);a||(a=j(),this.setAnnotString(r,`NM`,a));let o=this.pdfiumModule.FPDFAnnot_GetSubtype(r),s;switch(o){case M.TEXT:s=this.readPdfTextAnno(e,n,r,a);break;case M.FREETEXT:s=this.readPdfFreeTextAnno(e,n,r,a);break;case M.LINK:s=this.readPdfLinkAnno(e,n,t,r,a);break;case M.WIDGET:if(i!==void 0)return this.readPdfWidgetAnno(e,n,r,i,a);break;case M.FILEATTACHMENT:s=this.readPdfFileAttachmentAnno(e,n,r,a);break;case M.INK:s=this.readPdfInkAnno(e,n,r,a);break;case M.POLYGON:s=this.readPdfPolygonAnno(e,n,r,a);break;case M.POLYLINE:s=this.readPdfPolylineAnno(e,n,r,a);break;case M.LINE:s=this.readPdfLineAnno(e,n,r,a);break;case M.HIGHLIGHT:s=this.readPdfHighlightAnno(e,n,r,a);break;case M.STAMP:s=this.readPdfStampAnno(e,n,r,a);break;case M.SQUARE:s=this.readPdfSquareAnno(e,n,r,a);break;case M.CIRCLE:s=this.readPdfCircleAnno(e,n,r,a);break;case M.UNDERLINE:s=this.readPdfUnderlineAnno(e,n,r,a);break;case M.SQUIGGLY:s=this.readPdfSquigglyAnno(e,n,r,a);break;case M.STRIKEOUT:s=this.readPdfStrikeOutAnno(e,n,r,a);break;case M.CARET:s=this.readPdfCaretAnno(e,n,r,a);break;case M.REDACT:s=this.readPdfRedactAnno(e,n,r,a);break;default:s=this.readPdfAnno(e,n,o,r,a)}if(s){s=this.reverseRotateAnnotationOnLoad(s);let e=this.pdfiumModule.EPDFAnnot_GetAvailableAppearanceModes(r);e&&(s.appearanceModes=e)}return s}reverseRotateAnnotationOnLoad(e){let t=e.rotation,n=e.unrotatedRect;if(!t||t===0||!n)return e;let r={x:n.origin.x+n.size.width/2,y:n.origin.y+n.size.height/2};switch(e.type){case M.INK:{let n=e,i=n.inkList.map(e=>({points:e.points.map(e=>this.rotatePointForSave(e,r,-t))}));return{...n,inkList:i}}case M.LINE:{let n=e;return{...n,linePoints:{start:this.rotatePointForSave(n.linePoints.start,r,-t),end:this.rotatePointForSave(n.linePoints.end,r,-t)}}}case M.POLYGON:{let n=e;return{...n,vertices:n.vertices.map(e=>this.rotatePointForSave(e,r,-t))}}case M.POLYLINE:{let n=e;return{...n,vertices:n.vertices.map(e=>this.rotatePointForSave(e,r,-t))}}default:return e}}readAnnotationColor(e,t=f.Color){let n=this.memoryManager.malloc(4),r=this.memoryManager.malloc(4),i=this.memoryManager.malloc(4),a;return this.pdfiumModule.EPDFAnnot_GetColor(e,t,n,r,i)&&(a={red:255&this.pdfiumModule.pdfium.getValue(n,`i32`),green:255&this.pdfiumModule.pdfium.getValue(r,`i32`),blue:255&this.pdfiumModule.pdfium.getValue(i,`i32`)}),this.memoryManager.free(n),this.memoryManager.free(r),this.memoryManager.free(i),a}getAnnotationColor(e,t=f.Color){let n=this.readAnnotationColor(e,t);return n?w(n):void 0}setAnnotationColor(e,t,n=f.Color){let r=O(t);return this.pdfiumModule.EPDFAnnot_SetColor(e,n,255&r.red,255&r.green,255&r.blue)}getAnnotationOpacity(e){let t=this.memoryManager.malloc(4),n=this.pdfiumModule.EPDFAnnot_GetOpacity(e,t)?this.pdfiumModule.pdfium.getValue(t,`i32`):255;return this.memoryManager.free(t),p(n)}setAnnotationOpacity(e,t){let n=b(t);return this.pdfiumModule.EPDFAnnot_SetOpacity(e,255&n)}getAnnotationRotation(e){let t=this.memoryManager.malloc(4);if(!this.pdfiumModule.EPDFAnnot_GetRotate(e,t))return this.memoryManager.free(t),0;let n=this.pdfiumModule.pdfium.getValue(t,`float`);return this.memoryManager.free(t),n}setAnnotationRotation(e,t){return!!this.pdfiumModule.EPDFAnnot_SetRotate(e,t)}getAnnotExtendedRotation(e){let t=this.memoryManager.malloc(4);if(!this.pdfiumModule.EPDFAnnot_GetExtendedRotation(e,t))return this.memoryManager.free(t),0;let n=this.pdfiumModule.pdfium.getValue(t,`float`);return this.memoryManager.free(t),n}setAnnotExtendedRotation(e,t){return!!this.pdfiumModule.EPDFAnnot_SetExtendedRotation(e,t)}readAnnotUnrotatedRect(e){let t=this.memoryManager.malloc(16);if(!this.pdfiumModule.EPDFAnnot_GetUnrotatedRect(e,t))return this.memoryManager.free(t),null;let n=this.pdfiumModule.pdfium.getValue(t,`float`),r=this.pdfiumModule.pdfium.getValue(t+4,`float`),i=this.pdfiumModule.pdfium.getValue(t+8,`float`),a=this.pdfiumModule.pdfium.getValue(t+12,`float`);return this.memoryManager.free(t),n===0&&r===0&&i===0&&a===0?null:{left:n,top:r,right:i,bottom:a}}setAnnotUnrotatedRect(e,t,n,r){let i=r.origin.x,a=r.origin.y,o=r.origin.x+r.size.width,s=r.origin.y+r.size.height,c=this.convertDevicePointToPagePoint(e,t,{x:i,y:a}),l=this.convertDevicePointToPagePoint(e,t,{x:o,y:a}),u=this.convertDevicePointToPagePoint(e,t,{x:o,y:s}),d=this.convertDevicePointToPagePoint(e,t,{x:i,y:s}),f=Math.min(c.x,l.x,u.x,d.x),p=Math.max(c.x,l.x,u.x,d.x),m=Math.min(c.y,l.y,u.y,d.y),h=Math.max(c.y,l.y,u.y,d.y);f>p&&([f,p]=[p,f]),m>h&&([m,h]=[h,m]);let g=this.memoryManager.malloc(16),_=this.pdfiumModule.pdfium;_.setValue(g+0,f,`float`),_.setValue(g+4,h,`float`),_.setValue(g+8,p,`float`),_.setValue(g+12,m,`float`);let v=this.pdfiumModule.EPDFAnnot_SetUnrotatedRect(n,g);return this.memoryManager.free(g),!!v}getAnnotationTextAlignment(e){return this.pdfiumModule.EPDFAnnot_GetTextAlignment(e)}setAnnotationTextAlignment(e,t){return!!this.pdfiumModule.EPDFAnnot_SetTextAlignment(e,t)}getAnnotationVerticalAlignment(e){return this.pdfiumModule.EPDFAnnot_GetVerticalAlignment(e)}setAnnotationVerticalAlignment(e,t){return!!this.pdfiumModule.EPDFAnnot_SetVerticalAlignment(e,t)}getOverlayText(e){let t=this.pdfiumModule.EPDFAnnot_GetOverlayText(e,0,0);if(t===0)return;let n=2*(t+1),r=this.memoryManager.malloc(n);this.pdfiumModule.EPDFAnnot_GetOverlayText(e,r,n);let i=this.pdfiumModule.pdfium.UTF16ToString(r);return this.memoryManager.free(r),i||void 0}setOverlayText(e,t){return t?this.withWString(t,t=>this.pdfiumModule.EPDFAnnot_SetOverlayText(e,t)):this.pdfiumModule.EPDFAnnot_SetOverlayText(e,0)}getOverlayTextRepeat(e){return this.pdfiumModule.EPDFAnnot_GetOverlayTextRepeat(e)}setOverlayTextRepeat(e,t){return this.pdfiumModule.EPDFAnnot_SetOverlayTextRepeat(e,t)}getAnnotationDefaultAppearance(e){let t=this.memoryManager.malloc(4),n=this.memoryManager.malloc(4),r=this.memoryManager.malloc(4),i=this.memoryManager.malloc(4),a=this.memoryManager.malloc(4);if(!this.pdfiumModule.EPDFAnnot_GetDefaultAppearance(e,t,n,r,i,a))return void[t,n,r,i,a].forEach(e=>this.memoryManager.free(e));let o=this.pdfiumModule.pdfium,s=o.getValue(t,`i32`),c=o.getValue(n,`float`),l=255&o.getValue(r,`i32`),u=255&o.getValue(i,`i32`),d=255&o.getValue(a,`i32`);return[t,n,r,i,a].forEach(e=>this.memoryManager.free(e)),{fontFamily:s,fontSize:c,fontColor:w({red:l,green:u,blue:d})}}setAnnotationDefaultAppearance(e,t,n,r){let{red:i,green:a,blue:o}=O(r);return!!this.pdfiumModule.EPDFAnnot_SetDefaultAppearance(e,t,n,255&i,255&a,255&o)}getBorderStyle(e){let t=this.memoryManager.malloc(4),n=0,r=N.UNKNOWN,i=!1;return r=this.pdfiumModule.EPDFAnnot_GetBorderStyle(e,t),n=this.pdfiumModule.pdfium.getValue(t,`float`),i=r!==N.UNKNOWN,this.memoryManager.free(t),{ok:i,style:r,width:n}}setBorderStyle(e,t,n){let r=t===N.CLOUDY?N.SOLID:t;return this.pdfiumModule.EPDFAnnot_SetBorderStyle(e,r,n)}getAnnotationName(e){return this.pdfiumModule.EPDFAnnot_GetName(e)}setAnnotationName(e,t){return this.pdfiumModule.EPDFAnnot_SetName(e,t)}getReplyType(e){return this.pdfiumModule.EPDFAnnot_GetReplyType(e)}setReplyType(e,t){return this.pdfiumModule.EPDFAnnot_SetReplyType(e,t??ne.Unknown)}getBorderEffect(e){let t=this.memoryManager.malloc(4),n=!!this.pdfiumModule.EPDFAnnot_GetBorderEffect(e,t),r=n?this.pdfiumModule.pdfium.getValue(t,`float`):0;return this.memoryManager.free(t),{ok:n,intensity:r}}getRectangleDifferences(e){let t=this.memoryManager.malloc(4),n=this.memoryManager.malloc(4),r=this.memoryManager.malloc(4),i=this.memoryManager.malloc(4),a=!!this.pdfiumModule.EPDFAnnot_GetRectangleDifferences(e,t,n,r,i),o=this.pdfiumModule.pdfium,s=o.getValue(t,`float`),c=o.getValue(n,`float`),l=o.getValue(r,`float`),u=o.getValue(i,`float`);return this.memoryManager.free(t),this.memoryManager.free(n),this.memoryManager.free(r),this.memoryManager.free(i),{ok:a,left:s,top:u,right:l,bottom:c}}setRectangleDifferences(e,t){return t?this.pdfiumModule.EPDFAnnot_SetRectangleDifferences(e,t.left,t.bottom,t.right,t.top):this.pdfiumModule.EPDFAnnot_ClearRectangleDifferences(e)}setBorderEffect(e,t){return t===void 0||t<=0?this.pdfiumModule.EPDFAnnot_ClearBorderEffect(e):this.pdfiumModule.EPDFAnnot_SetBorderEffect(e,t)}getAnnotationDate(e,t){let n=this.getAnnotString(e,t);return n?m(n):void 0}setAnnotationDate(e,t,n){let r=d(n);return this.setAnnotString(e,t,r)}getAttachmentDate(e,t){let n=this.getAttachmentString(e,t);return n?m(n):void 0}setAttachmentDate(e,t,n){let r=d(n);return this.setAttachmentString(e,t,r)}getBorderDashPattern(e){let t=this.pdfiumModule.EPDFAnnot_GetBorderDashPatternCount(e);if(t===0)return{ok:!1,pattern:[]};let n=this.memoryManager.malloc(4*t),r=!!this.pdfiumModule.EPDFAnnot_GetBorderDashPattern(e,n,t),i=[];if(r){let e=this.pdfiumModule.pdfium;for(let r=0;r<t;r++)i.push(e.getValue(n+4*r,`float`))}return this.memoryManager.free(n),{ok:r,pattern:i}}setBorderDashPattern(e,t){if(!t||t.length===0)return this.pdfiumModule.EPDFAnnot_SetBorderDashPattern(e,0,0);let n=t.map(e=>Number.isFinite(e)&&e>0?e:0).filter(e=>e>0);if(n.length===0)return this.pdfiumModule.EPDFAnnot_SetBorderDashPattern(e,0,0);let r=4*n.length,i=this.memoryManager.malloc(r);for(let e=0;e<n.length;e++)this.pdfiumModule.pdfium.setValue(i+4*e,n[e],`float`);let a=!!this.pdfiumModule.EPDFAnnot_SetBorderDashPattern(e,i,n.length);return this.memoryManager.free(i),a}getLineEndings(e){let t=this.memoryManager.malloc(4),n=this.memoryManager.malloc(4);if(!this.pdfiumModule.EPDFAnnot_GetLineEndings(e,t,n))return this.memoryManager.free(t),void this.memoryManager.free(n);let r=this.pdfiumModule.pdfium.getValue(t,`i32`),i=this.pdfiumModule.pdfium.getValue(n,`i32`);return this.memoryManager.free(t),this.memoryManager.free(n),{start:r,end:i}}setLineEndings(e,t,n){return!!this.pdfiumModule.EPDFAnnot_SetLineEndings(e,t,n)}getLinePoints(e,t,n){let r=this.memoryManager.malloc(8),i=this.memoryManager.malloc(8);if(!this.pdfiumModule.FPDFAnnot_GetLine(n,r,i))return this.memoryManager.free(r),void this.memoryManager.free(i);let a=this.pdfiumModule.pdfium,o=a.getValue(r+0,`float`),s=a.getValue(r+4,`float`),c=a.getValue(i+0,`float`),l=a.getValue(i+4,`float`);return this.memoryManager.free(r),this.memoryManager.free(i),{start:this.convertPagePointToDevicePoint(e,t,{x:o,y:s}),end:this.convertPagePointToDevicePoint(e,t,{x:c,y:l})}}setLinePoints(e,t,n,r,i){let a=this.convertDevicePointToPagePoint(e,t,r),o=this.convertDevicePointToPagePoint(e,t,i);if(!a||!o)return!1;let s=this.memoryManager.malloc(16),c=this.pdfiumModule.pdfium;c.setValue(s+0,a.x,`float`),c.setValue(s+4,a.y,`float`),c.setValue(s+8,o.x,`float`),c.setValue(s+12,o.y,`float`);let l=this.pdfiumModule.EPDFAnnot_SetLine(n,s,s+8);return this.memoryManager.free(s),!!l}getQuadPointsAnno(e,t,n){let r=this.pdfiumModule.FPDFAnnot_CountAttachmentPoints(n);if(r===0)return[];let i=[];for(let a=0;a<r;a++){let r=this.memoryManager.malloc(32);if(this.pdfiumModule.FPDFAnnot_GetAttachmentPoints(n,a,r)){let n=[],a=[];for(let e=0;e<4;e++){let t=r+8*e;n.push(this.pdfiumModule.pdfium.getValue(t,`float`)),a.push(this.pdfiumModule.pdfium.getValue(t+4,`float`))}let o=this.convertPagePointToDevicePoint(e,t,{x:n[0],y:a[0]}),s=this.convertPagePointToDevicePoint(e,t,{x:n[1],y:a[1]}),c=this.convertPagePointToDevicePoint(e,t,{x:n[2],y:a[2]}),l=this.convertPagePointToDevicePoint(e,t,{x:n[3],y:a[3]});i.push({p1:o,p2:s,p3:c,p4:l})}this.memoryManager.free(r)}return i.map(te)}syncQuadPointsAnno(t,n,r,i){let a=this.pdfiumModule.pdfium,o=this.pdfiumModule.FPDFAnnot_CountAttachmentPoints(r),s=this.memoryManager.malloc(32),c=r=>{let i=e(r),o=this.convertDevicePointToPagePoint(t,n,i.p1),c=this.convertDevicePointToPagePoint(t,n,i.p2),l=this.convertDevicePointToPagePoint(t,n,i.p3),u=this.convertDevicePointToPagePoint(t,n,i.p4);a.setValue(s+0,o.x,`float`),a.setValue(s+4,o.y,`float`),a.setValue(s+8,c.x,`float`),a.setValue(s+12,c.y,`float`),a.setValue(s+16,u.x,`float`),a.setValue(s+20,u.y,`float`),a.setValue(s+24,l.x,`float`),a.setValue(s+28,l.y,`float`)},l=Math.min(o,i.length);for(let e=0;e<l;e++)if(c(i[e]),!this.pdfiumModule.FPDFAnnot_SetAttachmentPoints(r,e,s))return this.memoryManager.free(s),!1;for(let e=o;e<i.length;e++)if(c(i[e]),!this.pdfiumModule.FPDFAnnot_AppendAttachmentPoints(r,s))return this.memoryManager.free(s),!1;return this.memoryManager.free(s),!0}redactTextInRects(e,t,n,r){let{recurseForms:i=!0,drawBlackBoxes:a=!1}=r??{};this.logger.debug(`PDFiumEngine`,`Engine`,`redactTextInQuads`,e.id,t.index,n.length);let o=`RedactTextInQuads`;this.logger.perf(`PDFiumEngine`,`Engine`,o,`Begin`,`${e.id}-${t.index}`);let s=this.cache.getContext(e.id);if(!s)return this.logger.perf(`PDFiumEngine`,`Engine`,o,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let c=(n??[]).filter(e=>e&&Number.isFinite(e.origin?.x)&&Number.isFinite(e.origin?.y)&&Number.isFinite(e.size?.width)&&Number.isFinite(e.size?.height)&&e.size.width>0&&e.size.height>0);if(c.length===0)return this.logger.perf(`PDFiumEngine`,`Engine`,o,`End`,`${e.id}-${t.index}`),P.resolve(!1);let l=s.acquirePage(t.index),{ptr:u,count:d}=this.allocFSQuadsBufferFromRects(e,t,c),f=!1;try{f=!!this.pdfiumModule.EPDFText_RedactInQuads(l.pagePtr,u,d,!!i,!1)}finally{this.memoryManager.free(u)}return f&&=!!this.pdfiumModule.FPDFPage_GenerateContent(l.pagePtr),l.disposeImmediate(),this.logger.perf(`PDFiumEngine`,`Engine`,o,`End`,`${e.id}-${t.index}`),P.resolve(!!f)}applyRedaction(e,t,n){this.logger.debug(W,G,`applyRedaction`,e.id,t.index,n.id);let r=`ApplyRedaction`;this.logger.perf(W,G,r,`Begin`,`${e.id}-${t.index}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let a=i.acquirePage(t.index),o=this.getAnnotationByName(a.pagePtr,n.id);if(!o)return a.release(),this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`),P.reject({code:g.NotFound,message:`annotation not found`});let s=this.pdfiumModule.EPDFAnnot_ApplyRedaction(a.pagePtr,o);return this.pdfiumModule.FPDFPage_CloseAnnot(o),s&&this.pdfiumModule.FPDFPage_GenerateContent(a.pagePtr),a.disposeImmediate(),this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`),P.resolve(!!s)}applyAllRedactions(e,t){this.logger.debug(W,G,`applyAllRedactions`,e.id,t.index);let n=`ApplyAllRedactions`;this.logger.perf(W,G,n,`Begin`,`${e.id}-${t.index}`);let r=this.cache.getContext(e.id);if(!r)return this.logger.perf(W,G,n,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let i=r.acquirePage(t.index),a=this.pdfiumModule.EPDFPage_ApplyRedactions(i.pagePtr);return a&&this.pdfiumModule.FPDFPage_GenerateContent(i.pagePtr),i.disposeImmediate(),this.logger.perf(W,G,n,`End`,`${e.id}-${t.index}`),P.resolve(!!a)}flattenAnnotation(e,t,n){this.logger.debug(W,G,`flattenAnnotation`,e.id,t.index,n.id);let r=`FlattenAnnotation`;this.logger.perf(W,G,r,`Begin`,`${e.id}-${t.index}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let a=i.acquirePage(t.index),o=this.getAnnotationByName(a.pagePtr,n.id);if(!o)return a.release(),this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`),P.reject({code:g.NotFound,message:`annotation not found`});let s=this.pdfiumModule.EPDFAnnot_Flatten(a.pagePtr,o);return this.pdfiumModule.FPDFPage_CloseAnnot(o),s&&this.pdfiumModule.FPDFPage_GenerateContent(a.pagePtr),a.disposeImmediate(),this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`),P.resolve(!!s)}exportAnnotationAppearanceAsPdf(e,t,n){this.logger.debug(W,G,`exportAnnotationAppearanceAsPdf`,e.id,t.index,n.id);let r=`ExportAnnotationAppearanceAsPdf`;this.logger.perf(W,G,r,`Begin`,`${e.id}-${t.index}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let a=i.acquirePage(t.index),o=this.getAnnotationByName(a.pagePtr,n.id);if(!o)return a.release(),this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`),P.reject({code:g.NotFound,message:`annotation not found`});let s=this.pdfiumModule.EPDFAnnot_ExportAppearanceAsDocument(o);if(this.pdfiumModule.FPDFPage_CloseAnnot(o),!s)return a.release(),this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`),P.reject({code:g.CantCreateNewDoc,message:`can not export annotation as pdf`});try{return P.resolve(this.saveDocument(s))}finally{this.pdfiumModule.FPDF_CloseDocument(s),a.release(),this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`)}}exportAnnotationsAppearanceAsPdf(e,t,n){this.logger.debug(W,G,`exportAnnotationsAppearanceAsPdf`,e.id,t.index,n.map(e=>e.id));let r=`ExportAnnotationsAppearanceAsPdf`;this.logger.perf(W,G,r,`Begin`,`${e.id}-${t.index}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});if(n.length===0)return this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`),P.reject({code:g.NotFound,message:`no annotations provided`});let a=i.acquirePage(t.index),o=[];for(let i of n){let n=this.getAnnotationByName(a.pagePtr,i.id);if(!n){for(let e of o)this.pdfiumModule.FPDFPage_CloseAnnot(e);return a.release(),this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`),P.reject({code:g.NotFound,message:`annotation not found: ${i.id}`})}o.push(n)}let s=4*o.length,c=this.memoryManager.malloc(s);for(let e=0;e<o.length;e++)this.pdfiumModule.pdfium.setValue(c+4*e,o[e],`i32`);let l=this.pdfiumModule.EPDFAnnot_ExportMultipleAppearancesAsDocument(c,o.length);this.memoryManager.free(c);for(let e of o)this.pdfiumModule.FPDFPage_CloseAnnot(e);if(!l)return a.release(),this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`),P.reject({code:g.CantCreateNewDoc,message:`can not export annotations as pdf`});try{return P.resolve(this.saveDocument(l))}finally{this.pdfiumModule.FPDF_CloseDocument(l),a.release(),this.logger.perf(W,G,r,`End`,`${e.id}-${t.index}`)}}allocFSQuadsBufferFromRects(t,n,r){let i=r.length,a=this.memoryManager.malloc(32*i),o=this.pdfiumModule.pdfium;for(let s=0;s<i;s++){let i=r[s],c=e(i),l=this.convertDevicePointToPagePoint(t,n,c.p1),u=this.convertDevicePointToPagePoint(t,n,c.p2),d=this.convertDevicePointToPagePoint(t,n,c.p3),f=this.convertDevicePointToPagePoint(t,n,c.p4),p=a+32*s;o.setValue(p+0,l.x,`float`),o.setValue(p+4,l.y,`float`),o.setValue(p+8,u.x,`float`),o.setValue(p+12,u.y,`float`),o.setValue(p+16,f.x,`float`),o.setValue(p+20,f.y,`float`),o.setValue(p+24,d.x,`float`),o.setValue(p+28,d.y,`float`)}return{ptr:a,count:i}}getInkList(e,t,n){let r=[],i=this.pdfiumModule.FPDFAnnot_GetInkListCount(n);if(i<=0)return r;let a=this.pdfiumModule.pdfium;for(let o=0;o<i;o++){let i=[],s=this.pdfiumModule.FPDFAnnot_GetInkListPath(n,o,0,0);if(s>0){let r=this.memoryManager.malloc(8*s);this.pdfiumModule.FPDFAnnot_GetInkListPath(n,o,r,s);for(let n=0;n<s;n++){let o=r+8*n,s=a.getValue(o+0,`float`),c=a.getValue(o+4,`float`),l=this.convertPagePointToDevicePoint(e,t,{x:s,y:c});i.push({x:l.x,y:l.y})}this.memoryManager.free(r)}r.push({points:i})}return r}setInkList(e,t,n,r){let i=this.pdfiumModule.pdfium;for(let a of r){let r=a.points.length;if(r===0)continue;let o=this.memoryManager.malloc(8*r);for(let n=0;n<r;n++){let r=a.points[n],s=this.convertDevicePointToPagePoint(e,t,r);i.setValue(o+8*n+0,s.x,`float`),i.setValue(o+8*n+4,s.y,`float`)}let s=this.pdfiumModule.FPDFAnnot_AddInkStroke(n,o,r);if(this.memoryManager.free(o),s===-1)return!1}return!0}readPdfTextAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.getAnnotString(n,`State`),s=this.getAnnotString(n,`StateModel`),c=this.getAnnotationColor(n),l=this.getAnnotationOpacity(n),u=this.getAnnotationName(n);return{pageIndex:t.index,id:r,type:M.TEXT,rect:a,strokeColor:c??`#FFFF00`,color:c??`#FFFF00`,opacity:l,state:o,stateModel:s,name:u,icon:u,...this.readBaseAnnotationProperties(e,t,n)}}readPdfFreeTextAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.getAnnotString(n,`DS`),s=this.getAnnotationDefaultAppearance(n),l=this.getAnnotationColor(n),u=this.getAnnotationColor(n,f.TextColor),d=this.getBorderStyle(n),p=this.getAnnotationTextAlignment(n),m=this.getAnnotationVerticalAlignment(n),h=this.getAnnotationOpacity(n),g=this.getAnnotRichContent(n),_=this.getRectangleDifferences(n),v=this.getAnnotIntent(n),y=this.getCalloutLine(e,t,n),b=this.getLineEndings(n);return{pageIndex:t.index,id:r,type:M.FREETEXT,rect:a,fontFamily:s?.fontFamily??c.Unknown,fontSize:s?.fontSize??12,fontColor:u??s?.fontColor??`#000000`,verticalAlign:m,color:l,backgroundColor:l,opacity:h,textAlign:p,defaultStyle:o,richContent:g,..._.ok&&{rectangleDifferences:{left:_.left,top:_.top,right:_.right,bottom:_.bottom}},...v&&{intent:v},...y&&{calloutLine:y},...b&&{lineEnding:b.end},...d.width>0?{strokeWidth:d.width,strokeColor:s?.fontColor??`#000000`}:v===`FreeTextCallout`?{strokeWidth:1,strokeColor:s?.fontColor??`#000000`}:{},...this.readBaseAnnotationProperties(e,t,n)}}readPdfLinkAnno(e,t,n,r,i){let a=this.pdfiumModule.FPDFAnnot_GetLink(r);if(!a)return;let o=this.readPageAnnoRect(r),s=this.convertPageRectToDeviceRect(e,t,o),{style:c,width:l}=this.getBorderStyle(r),u=this.getAnnotationColor(r,f.Color),d;if(c===N.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(r);e&&(d=t)}let p=this.readPdfLinkAnnoTarget(n,()=>this.pdfiumModule.FPDFLink_GetAction(a),()=>this.pdfiumModule.FPDFLink_GetDest(n,a));return{pageIndex:t.index,id:i,type:M.LINK,rect:s,target:p,strokeColor:u,strokeWidth:l,strokeStyle:c,strokeDashArray:d,...this.readBaseAnnotationProperties(e,t,r)}}readPdfWidgetAnno(e,t,n,r,i){let a=this.readPageAnnoRect(n);this.getAnnotationFlags(n);let o=this.getAnnotationDefaultAppearance(n),s=this.convertPageRectToDeviceRect(e,t,a),l=this.readPdfWidgetAnnoField(r,n),u=this.readButtonExportValue(n),d=this.getMKColor(n,0),f=this.getMKColor(n,1),{width:p}=this.getBorderStyle(n);return{pageIndex:t.index,id:i,type:M.WIDGET,fontFamily:o?.fontFamily??c.Unknown,fontSize:o?.fontSize??12,fontColor:o?.fontColor??`#000000`,rect:s,field:l,...u!==void 0&&{exportValue:u},strokeWidth:p,strokeColor:d??`transparent`,color:f??`transparent`,...this.readBaseAnnotationProperties(e,t,n)}}readPdfFileAttachmentAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i);return{pageIndex:t.index,id:r,type:M.FILEATTACHMENT,rect:a,...this.readBaseAnnotationProperties(e,t,n)}}readPdfInkAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.getAnnotationColor(n)??`#FF0000`,s=this.getAnnotationOpacity(n),{width:c}=this.getBorderStyle(n),l=this.getInkList(e,t,n),u=this.getAnnotIntent(n);return{pageIndex:t.index,id:r,type:M.INK,rect:a,...u&&{intent:u},strokeColor:o,color:o,opacity:s,strokeWidth:c===0?1:c,inkList:l,...this.readBaseAnnotationProperties(e,t,n)}}readPdfPolygonAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.readPdfAnnoVertices(e,t,n),s=this.getAnnotationColor(n),c=this.getAnnotationColor(n,f.InteriorColor),l=this.getAnnotationOpacity(n),{style:u,width:d}=this.getBorderStyle(n),p;if(u===N.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(p=t)}if(o.length>1){let e=o[0],t=o[o.length-1];e.x===t.x&&e.y===t.y&&o.pop()}let m=this.getRectangleDifferences(n),h=this.getBorderEffect(n);return{pageIndex:t.index,id:r,type:M.POLYGON,rect:a,strokeColor:s??`#FF0000`,color:c??`transparent`,opacity:l,strokeWidth:d===0?1:d,strokeStyle:u,strokeDashArray:p,vertices:o,...h.ok&&{cloudyBorderIntensity:h.intensity},...m.ok&&{rectangleDifferences:{left:m.left,top:m.top,right:m.right,bottom:m.bottom}},...this.readBaseAnnotationProperties(e,t,n)}}readPdfPolylineAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.readPdfAnnoVertices(e,t,n),s=this.getAnnotationColor(n),c=this.getAnnotationColor(n,f.InteriorColor),l=this.getAnnotationOpacity(n),{style:u,width:d}=this.getBorderStyle(n),p;if(u===N.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(p=t)}let m=this.getLineEndings(n);return{pageIndex:t.index,id:r,type:M.POLYLINE,rect:a,strokeColor:s??`#FF0000`,color:c??`transparent`,opacity:l,strokeWidth:d===0?1:d,strokeStyle:u,strokeDashArray:p,lineEndings:m,vertices:o,...this.readBaseAnnotationProperties(e,t,n)}}readPdfLineAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.getLinePoints(e,t,n),c=this.getLineEndings(n),l=this.getAnnotationColor(n),u=this.getAnnotationColor(n,f.InteriorColor),d=this.getAnnotationOpacity(n),{style:p,width:m}=this.getBorderStyle(n),h;if(p===N.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(h=t)}return{pageIndex:t.index,id:r,type:M.LINE,rect:a,strokeWidth:m===0?1:m,strokeStyle:p,strokeDashArray:h,strokeColor:l??`#FF0000`,color:u??`transparent`,opacity:d,linePoints:o||{start:{x:0,y:0},end:{x:0,y:0}},lineEndings:c||{start:s.None,end:s.None},...this.readBaseAnnotationProperties(e,t,n)}}readPdfHighlightAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.getQuadPointsAnno(e,t,n),s=this.getAnnotationColor(n)??`#FFFF00`,c=this.getAnnotationOpacity(n);return{pageIndex:t.index,id:r,type:M.HIGHLIGHT,rect:a,segmentRects:o,strokeColor:s,color:s,opacity:c,...this.readBaseAnnotationProperties(e,t,n)}}readPdfUnderlineAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.getQuadPointsAnno(e,t,n),s=this.getAnnotationColor(n)??`#FF0000`,c=this.getAnnotationOpacity(n);return{pageIndex:t.index,id:r,type:M.UNDERLINE,rect:a,segmentRects:o,strokeColor:s,color:s,opacity:c,...this.readBaseAnnotationProperties(e,t,n)}}readPdfStrikeOutAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.getQuadPointsAnno(e,t,n),s=this.getAnnotationColor(n)??`#FF0000`,c=this.getAnnotationOpacity(n);return{pageIndex:t.index,id:r,type:M.STRIKEOUT,rect:a,segmentRects:o,strokeColor:s,color:s,opacity:c,...this.readBaseAnnotationProperties(e,t,n)}}readPdfSquigglyAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.getQuadPointsAnno(e,t,n),s=this.getAnnotationColor(n)??`#FF0000`,c=this.getAnnotationOpacity(n);return{pageIndex:t.index,id:r,type:M.SQUIGGLY,rect:a,segmentRects:o,strokeColor:s,color:s,opacity:c,...this.readBaseAnnotationProperties(e,t,n)}}readPdfCaretAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.getAnnotationColor(n),s=this.getAnnotationOpacity(n),c=this.getAnnotIntent(n),l=this.getRectangleDifferences(n);return{pageIndex:t.index,id:r,type:M.CARET,rect:a,strokeColor:o,opacity:s,intent:c,...l.ok&&{rectangleDifferences:{left:l.left,top:l.top,right:l.right,bottom:l.bottom}},...this.readBaseAnnotationProperties(e,t,n)}}readPdfRedactAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.getQuadPointsAnno(e,t,n),s=this.getAnnotationColor(n,f.InteriorColor),c=this.getAnnotationColor(n,f.OverlayColor),l=this.getAnnotationColor(n,f.Color),u=this.getAnnotationOpacity(n),d=this.getOverlayText(n),p=this.getOverlayTextRepeat(n),m=this.getAnnotationDefaultAppearance(n),h=this.getAnnotationTextAlignment(n);return{pageIndex:t.index,id:r,type:M.REDACT,rect:a,segmentRects:o,color:s,overlayColor:c,strokeColor:l,opacity:u,overlayText:d,overlayTextRepeat:p,fontFamily:m?.fontFamily,fontSize:m?.fontSize,fontColor:m?.fontColor,textAlign:h,...this.readBaseAnnotationProperties(e,t,n)}}readPdfStampAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.getAnnotationName(n);return{pageIndex:t.index,id:r,type:M.STAMP,rect:a,name:o,icon:o,...this.readBaseAnnotationProperties(e,t,n)}}readPdfPageObject(e){switch(this.pdfiumModule.FPDFPageObj_GetType(e)){case F.PATH:return this.readPathObject(e);case F.IMAGE:return this.readImageObject(e);case F.FORM:return this.readFormObject(e)}}readPathObject(e){let t=this.pdfiumModule.FPDFPath_CountSegments(e),n=this.memoryManager.malloc(4),r=this.memoryManager.malloc(4),i=this.memoryManager.malloc(4),a=this.memoryManager.malloc(4);this.pdfiumModule.FPDFPageObj_GetBounds(e,n,r,i,a);let o={left:this.pdfiumModule.pdfium.getValue(n,`float`),bottom:this.pdfiumModule.pdfium.getValue(r,`float`),right:this.pdfiumModule.pdfium.getValue(i,`float`),top:this.pdfiumModule.pdfium.getValue(a,`float`)};this.memoryManager.free(n),this.memoryManager.free(r),this.memoryManager.free(i),this.memoryManager.free(a);let s=[];for(let n=0;n<t;n++){let t=this.readPdfSegment(e,n);s.push(t)}let c=this.readPdfPageObjectTransformMatrix(e);return{type:F.PATH,bounds:o,segments:s,matrix:c}}readPdfSegment(e,t){let n=this.pdfiumModule.FPDFPath_GetPathSegment(e,t),r=this.pdfiumModule.FPDFPathSegment_GetType(n),i=this.pdfiumModule.FPDFPathSegment_GetClose(n),a=this.memoryManager.malloc(4),o=this.memoryManager.malloc(4);this.pdfiumModule.FPDFPathSegment_GetPoint(n,a,o);let s=this.pdfiumModule.pdfium.getValue(a,`float`),c=this.pdfiumModule.pdfium.getValue(o,`float`);return this.memoryManager.free(a),this.memoryManager.free(o),{type:r,point:{x:s,y:c},isClosed:i}}readImageObject(e){let t=this.pdfiumModule.FPDFImageObj_GetBitmap(e),n=this.pdfiumModule.FPDFBitmap_GetBuffer(t),r=this.pdfiumModule.FPDFBitmap_GetWidth(t),i=this.pdfiumModule.FPDFBitmap_GetHeight(t),a=this.pdfiumModule.FPDFBitmap_GetFormat(t),o=r*i,s=new Uint8ClampedArray(4*o);for(let e=0;e<o;e++)if(a===2){let t=this.pdfiumModule.pdfium.getValue(n+3*e,`i8`),r=this.pdfiumModule.pdfium.getValue(n+3*e+1,`i8`),i=this.pdfiumModule.pdfium.getValue(n+3*e+2,`i8`);s[4*e]=i,s[4*e+1]=r,s[4*e+2]=t,s[4*e+3]=100}let c={data:s,width:r,height:i},l=this.readPdfPageObjectTransformMatrix(e);return{type:F.IMAGE,imageData:c,matrix:l}}readFormObject(e){let t=this.pdfiumModule.FPDFFormObj_CountObjects(e),n=[];for(let r=0;r<t;r++){let t=this.pdfiumModule.FPDFFormObj_GetObject(e,r),i=this.readPdfPageObject(t);i&&n.push(i)}let r=this.readPdfPageObjectTransformMatrix(e);return{type:F.FORM,objects:n,matrix:r}}readPdfPageObjectTransformMatrix(e){let t=this.memoryManager.malloc(24);if(this.pdfiumModule.FPDFPageObj_GetMatrix(e,t)){let e=this.pdfiumModule.pdfium.getValue(t,`float`),n=this.pdfiumModule.pdfium.getValue(t+4,`float`),r=this.pdfiumModule.pdfium.getValue(t+8,`float`),i=this.pdfiumModule.pdfium.getValue(t+12,`float`),a=this.pdfiumModule.pdfium.getValue(t+16,`float`),o=this.pdfiumModule.pdfium.getValue(t+20,`float`);return this.memoryManager.free(t),{a:e,b:n,c:r,d:i,e:a,f:o}}return this.memoryManager.free(t),{a:1,b:0,c:0,d:1,e:0,f:0}}readStampAnnotationContents(e){let t=[],n=this.pdfiumModule.FPDFAnnot_GetObjectCount(e);for(let r=0;r<n;r++){let n=this.pdfiumModule.FPDFAnnot_GetObject(e,r),i=this.readPdfPageObject(n);i&&t.push(i)}return t}getStrokeWidth(e){let t=this.memoryManager.malloc(4),n=this.memoryManager.malloc(4),r=this.memoryManager.malloc(4),i=this.pdfiumModule.FPDFAnnot_GetBorder(e,t,n,r)?this.pdfiumModule.pdfium.getValue(r,`float`):1;return this.memoryManager.free(t),this.memoryManager.free(n),this.memoryManager.free(r),i}getAnnotationFlags(e){let t=this.pdfiumModule.FPDFAnnot_GetFlags(e);return re(t)}setAnnotationFlags(e,t){let n=S(t);return this.pdfiumModule.FPDFAnnot_SetFlags(e,n)}readPdfCircleAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.getAnnotationColor(n,f.InteriorColor),s=this.getAnnotationColor(n),c=this.getAnnotationOpacity(n),{style:l,width:u}=this.getBorderStyle(n),d;if(l===N.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(d=t)}let p=this.getRectangleDifferences(n),m=this.getBorderEffect(n);return{pageIndex:t.index,id:r,type:M.CIRCLE,rect:a,color:o??`transparent`,opacity:c,strokeWidth:u,strokeColor:s??`#FF0000`,strokeStyle:l,...d!==void 0&&{strokeDashArray:d},...m.ok&&{cloudyBorderIntensity:m.intensity},...p.ok&&{rectangleDifferences:{left:p.left,top:p.top,right:p.right,bottom:p.bottom}},...this.readBaseAnnotationProperties(e,t,n)}}readPdfSquareAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),o=this.getAnnotationColor(n,f.InteriorColor),s=this.getAnnotationColor(n),c=this.getAnnotationOpacity(n),{style:l,width:u}=this.getBorderStyle(n),d;if(l===N.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(d=t)}let p=this.getRectangleDifferences(n),m=this.getBorderEffect(n);return{pageIndex:t.index,id:r,type:M.SQUARE,rect:a,color:o??`transparent`,opacity:c,strokeColor:s??`#FF0000`,strokeWidth:u,strokeStyle:l,...d!==void 0&&{strokeDashArray:d},...m.ok&&{cloudyBorderIntensity:m.intensity},...p.ok&&{rectangleDifferences:{left:p.left,top:p.top,right:p.right,bottom:p.bottom}},...this.readBaseAnnotationProperties(e,t,n)}}readPdfAnno(e,t,n,r,i){let a=this.readPageAnnoRect(r),o=this.convertPageRectToDeviceRect(e,t,a);return{pageIndex:t.index,id:i,type:n,rect:o,...this.readBaseAnnotationProperties(e,t,r)}}getInReplyToId(e){let t=this.pdfiumModule.FPDFAnnot_GetLinkedAnnot(e,`IRT`);if(!t)return;let n=this.getAnnotString(t,`NM`);return n||(n=j(),this.setAnnotString(t,`NM`,n)),this.pdfiumModule.FPDFPage_CloseAnnot(t),n}setInReplyToId(e,t,n){if(!n)return this.pdfiumModule.EPDFAnnot_SetLinkedAnnot(t,`IRT`,0);let r=this.getAnnotationByName(e,n);return!!r&&this.pdfiumModule.EPDFAnnot_SetLinkedAnnot(t,`IRT`,r)}rotatePointForSave(e,t,n){let r=n*Math.PI/180,i=Math.cos(r),a=Math.sin(r),o=e.x-t.x,s=e.y-t.y;return{x:t.x+o*i-s*a,y:t.y+o*a+s*i}}prepareAnnotationForSave(e){let t=e.rotation,n=e.unrotatedRect;if(!t||t===0||!n)return e;let r={x:n.origin.x+n.size.width/2,y:n.origin.y+n.size.height/2};switch(e.type){case M.INK:{let n=e,i=n.inkList.map(e=>({points:e.points.map(e=>this.rotatePointForSave(e,r,t))}));return{...n,inkList:i}}case M.LINE:{let n=e;return{...n,linePoints:{start:this.rotatePointForSave(n.linePoints.start,r,t),end:this.rotatePointForSave(n.linePoints.end,r,t)}}}case M.POLYGON:{let n=e;return{...n,vertices:n.vertices.map(e=>this.rotatePointForSave(e,r,t))}}case M.POLYLINE:{let n=e;return{...n,vertices:n.vertices.map(e=>this.rotatePointForSave(e,r,t))}}default:return e}}applyBaseAnnotationProperties(e,t,n,r,i){if(!this.setAnnotString(r,`T`,i.author||``)||!this.setAnnotString(r,`Contents`,i.contents??``)||i.subject&&!this.setAnnotString(r,`Subj`,i.subject)||i.modified&&!this.setAnnotationDate(r,`M`,i.modified)||i.created&&!this.setAnnotationDate(r,`CreationDate`,i.created)||i.flags&&!this.setAnnotationFlags(r,i.flags))return!1;let a=this.getAnnotCustom(r)??{},o={...a,...i.custom??{}};if(delete o.unrotatedRect,delete o.rotation,Object.keys(o).length>0){if(!this.setAnnotCustom(r,o))return!1}else if(Object.keys(a).length>0&&!this.setAnnotCustom(r,null))return!1;if(i.rotation!==void 0){let e=i.rotation?(360-i.rotation)%360:0;this.setAnnotExtendedRotation(r,e)}return i.unrotatedRect?this.setAnnotUnrotatedRect(e,t,r,i.unrotatedRect):i.rotation&&i.rotation!==0&&this.setAnnotUnrotatedRect(e,t,r,i.rect),!!this.setInReplyToId(n,r,i.inReplyToId)&&!!this.setReplyType(r,i.replyType)}readBaseAnnotationProperties(e,t,n){let r=this.getAnnotString(n,`T`),i=this.getAnnotString(n,`Contents`)||``,a=this.getAnnotationDate(n,`M`),o=this.getAnnotationDate(n,`CreationDate`),s=this.getAnnotString(n,`Subj`),c=this.getAnnotationFlags(n),l=this.getAnnotCustom(n),u=this.getInReplyToId(n),d=this.getReplyType(n),f=this.pdfiumModule.EPDFAnnot_GetBlendMode(n),p=this.getAnnotExtendedRotation(n),m=p===0?0:(360-p)%360,h=this.readAnnotUnrotatedRect(n),g=h?this.convertPageRectToDeviceRect(e,t,h):void 0;return{author:r,contents:i,modified:a,created:o,flags:c,custom:l,blendMode:f,...s&&{subject:s},...u&&{inReplyToId:u},...d&&d!==ne.Reply&&{replyType:d},...m!==0&&{rotation:m},...g!==void 0&&{unrotatedRect:g}}}getAnnotString(e,t){let n=this.pdfiumModule.FPDFAnnot_GetStringValue(e,t,0,0);if(n===0)return;let r=2*(n+1),i=this.memoryManager.malloc(r);this.pdfiumModule.FPDFAnnot_GetStringValue(e,t,i,r);let a=this.pdfiumModule.pdfium.UTF16ToString(i);return this.memoryManager.free(i),a||void 0}readButtonExportValue(e){let t=this.pdfiumModule.EPDFAnnot_GetButtonExportValue(e,0,0);if(t===0)return;let n=2*(t+1),r=this.memoryManager.malloc(n);this.pdfiumModule.EPDFAnnot_GetButtonExportValue(e,r,n);let i=this.pdfiumModule.pdfium.UTF16ToString(r);return this.memoryManager.free(r),i||void 0}getAttachmentString(e,t){let n=this.pdfiumModule.FPDFAttachment_GetStringValue(e,t,0,0);if(n===0)return;let r=2*(n+1),i=this.memoryManager.malloc(r);this.pdfiumModule.FPDFAttachment_GetStringValue(e,t,i,r);let a=this.pdfiumModule.pdfium.UTF16ToString(i);return this.memoryManager.free(i),a||void 0}getAttachmentNumber(e,t){let n=this.memoryManager.malloc(4);try{return this.pdfiumModule.EPDFAttachment_GetIntegerValue(e,t,n)?this.pdfiumModule.pdfium.getValue(n,`i32`)>>>0:void 0}finally{this.memoryManager.free(n)}}getAnnotCustom(e){let t=this.getAnnotString(e,`EPDFCustom`);if(t)try{return JSON.parse(t)}catch(e){console.warn(`Failed to parse annotation custom data as JSON:`,e),console.warn(`Invalid JSON string:`,t);return}}setAnnotCustom(e,t){if(t==null)return this.setAnnotString(e,`EPDFCustom`,``);try{let n=JSON.stringify(t);return this.setAnnotString(e,`EPDFCustom`,n)}catch(e){return console.warn(`Failed to stringify annotation custom data as JSON:`,e),console.warn(`Invalid data object:`,t),!1}}getAnnotIntent(e){let t=this.pdfiumModule.EPDFAnnot_GetIntent(e,0,0);if(t===0)return;let n=2*(t+1),r=this.memoryManager.malloc(n);this.pdfiumModule.EPDFAnnot_GetIntent(e,r,n);let i=this.pdfiumModule.pdfium.UTF16ToString(r);return this.memoryManager.free(r),i&&i!==`undefined`?i:void 0}setAnnotIntent(e,t){return this.pdfiumModule.EPDFAnnot_SetIntent(e,t)}getAnnotRichContent(e){let t=this.pdfiumModule.EPDFAnnot_GetRichContent(e,0,0);if(t===0)return;let n=2*(t+1),r=this.memoryManager.malloc(n);this.pdfiumModule.EPDFAnnot_GetRichContent(e,r,n);let i=this.pdfiumModule.pdfium.UTF16ToString(r);return this.memoryManager.free(r),i||void 0}getAnnotationByName(e,t){return this.withWString(t,t=>this.pdfiumModule.EPDFPage_GetAnnotByName(e,t))}removeAnnotationByName(e,t){return this.withWString(t,t=>this.pdfiumModule.EPDFPage_RemoveAnnotByName(e,t))}setAnnotString(e,t,n){return this.withWString(n,n=>this.pdfiumModule.FPDFAnnot_SetStringValue(e,t,n))}setAttachmentString(e,t,n){return this.withWString(n,n=>this.pdfiumModule.FPDFAttachment_SetStringValue(e,t,n))}readPdfAnnoVertices(e,t,n){let r=[],i=this.pdfiumModule.FPDFAnnot_GetVertices(n,0,0),a=this.memoryManager.malloc(8*i);this.pdfiumModule.FPDFAnnot_GetVertices(n,a,i);for(let n=0;n<i;n++){let i=this.pdfiumModule.pdfium.getValue(a+8*n,`float`),o=this.pdfiumModule.pdfium.getValue(a+8*n+4,`float`),{x:s,y:c}=this.convertPagePointToDevicePoint(e,t,{x:i,y:o}),l=r[r.length-1];l&&l.x===s&&l.y===c||r.push({x:s,y:c})}return this.memoryManager.free(a),r}setPdfAnnoVertices(e,t,n,r){let i=this.pdfiumModule.pdfium,a=this.memoryManager.malloc(8*r.length);r.forEach((n,r)=>{let o=this.convertDevicePointToPagePoint(e,t,n);i.setValue(a+8*r+0,o.x,`float`),i.setValue(a+8*r+4,o.y,`float`)});let o=this.pdfiumModule.EPDFAnnot_SetVertices(n,a,r.length);return this.memoryManager.free(a),o}getCalloutLine(e,t,n){let r=this.pdfiumModule.EPDFAnnot_GetCalloutLineCount(n);if(r===0)return;let i=this.memoryManager.malloc(8*r);if(this.pdfiumModule.EPDFAnnot_GetCalloutLine(n,i,r)===0)return void this.memoryManager.free(i);let a=[];for(let n=0;n<r;n++){let r=this.pdfiumModule.pdfium.getValue(i+8*n,`float`),o=this.pdfiumModule.pdfium.getValue(i+8*n+4,`float`);a.push(this.convertPagePointToDevicePoint(e,t,{x:r,y:o}))}return this.memoryManager.free(i),a}setCalloutLine(e,t,n,r){let i=this.pdfiumModule.pdfium,a=this.memoryManager.malloc(8*r.length);r.forEach((n,r)=>{let o=this.convertDevicePointToPagePoint(e,t,n);i.setValue(a+8*r+0,o.x,`float`),i.setValue(a+8*r+4,o.y,`float`)});let o=this.pdfiumModule.EPDFAnnot_SetCalloutLine(n,a,r.length);return this.memoryManager.free(a),o}readPdfBookmarkTarget(e,t,n){let r=t();if(r)return{type:`action`,action:this.readPdfAction(e,r)};{let t=n();if(t)return{type:`destination`,destination:this.readPdfDestination(e,t)}}}readPdfWidgetAnnoField(e,t){let r=this.pdfiumModule.FPDFAnnot_GetFormFieldFlags(e,t),i=this.pdfiumModule.FPDFAnnot_GetFormFieldType(e,t),a=L(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.FPDFAnnot_GetFormFieldName(e,t,n,r),this.pdfiumModule.pdfium.UTF16ToString),o=L(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.FPDFAnnot_GetFormFieldAlternateName(e,t,n,r),this.pdfiumModule.pdfium.UTF16ToString),s=L(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.EPDFAnnot_GetFormFieldRawValue(e,t,n,r),this.pdfiumModule.pdfium.UTF16ToString),c=this.pdfiumModule.EPDFAnnot_GetFormFieldObjectNumber(e,t),l={flag:r,name:a,alternateName:o,value:s,fieldObjectId:c>0?c:void 0};switch(i){case n.TEXTFIELD:{let e,n=this.memoryManager.malloc(4);return this.pdfiumModule.FPDFAnnot_GetNumberValue(t,`MaxLen`,n)&&(e=this.pdfiumModule.pdfium.getValue(n,`float`)),this.memoryManager.free(n),{...l,type:i,maxLen:e}}case n.CHECKBOX:return{...l,type:i};case n.RADIOBUTTON:case n.COMBOBOX:case n.LISTBOX:return{...l,type:i,options:this.readWidgetOptions(e,t)};case n.PUSHBUTTON:case n.SIGNATURE:default:return{...l,type:i}}}readWidgetOptions(e,t){let n=[],r=this.pdfiumModule.FPDFAnnot_GetOptionCount(e,t);for(let i=0;i<r;i++){let r=L(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.FPDFAnnot_GetOptionLabel(e,t,i,n,r),this.pdfiumModule.pdfium.UTF16ToString),a=this.pdfiumModule.FPDFAnnot_IsOptionSelected(e,t,i);n.push({label:r,isSelected:a})}return n}renderPageAnnotationRaw(e,t,n,r){let{scaleFactor:a=1,rotation:o=l.Degree0,dpr:s=1,mode:c=u.Normal}=r??{};this.logger.debug(W,G,`renderPageAnnotation`,e,t,n,r),this.logger.perf(W,G,`RenderPageAnnotation`,`Begin`,`${e.id}-${t.index}-${n.id}`);let d=new v,f=this.cache.getContext(e.id);if(!f)return this.logger.perf(W,G,`RenderPageAnnotation`,`End`,`${e.id}-${t.index}-${n.id}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let p=f.acquirePage(t.index),m=this.getAnnotationByName(p.pagePtr,n.id);if(!m)return this.logger.perf(W,G,`RenderPageAnnotation`,`End`,`${e.id}-${t.index}-${n.id}`),p.release(),P.reject({code:g.NotFound,message:`annotation not found`});let h=!!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(m,c);if(h||n.type!==M.WIDGET||this.pdfiumModule.FPDFAnnot_HasKey(m,`AP`)||(this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(m),h=!!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(m,c)),!h)return this.pdfiumModule.FPDFPage_CloseAnnot(m),p.release(),this.logger.perf(W,G,`RenderPageAnnotation`,`End`,`${e.id}-${t.index}-${n.id}`),d.resolve({data:new Uint8ClampedArray(4),width:1,height:1}),d;let y=Math.max(.01,a*s),b=!!r?.unrotated&&!!n.unrotatedRect,x=b?n.unrotatedRect:n.rect,S=_(T(t.size,x,o,y)),C=Math.max(1,S.size.width),w=Math.max(1,S.size.height),E=4*C,D=E*w,O=this.memoryManager.malloc(D),k=this.pdfiumModule.FPDFBitmap_CreateEx(C,w,4,O,E);this.pdfiumModule.FPDFBitmap_FillRect(k,0,0,C,w,0);let A=i(x,o,C,w),ee=this.memoryManager.malloc(24);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,ee,6).set([A.a,A.b,A.c,A.d,A.e,A.f]);let j=!1;try{j=b?!!this.pdfiumModule.EPDF_RenderAnnotBitmapUnrotated(k,p.pagePtr,m,c,ee,16):!!this.pdfiumModule.EPDF_RenderAnnotBitmap(k,p.pagePtr,m,c,ee,16)}finally{this.memoryManager.free(ee),this.pdfiumModule.FPDFBitmap_Destroy(k),this.pdfiumModule.FPDFPage_CloseAnnot(m),p.release()}if(!j)return this.memoryManager.free(O),this.logger.perf(W,G,`RenderPageAnnotation`,`End`,`${e.id}-${t.index}-${n.id}`),P.reject({code:g.Unknown,message:`EPDF_RenderAnnotBitmap failed`});let te=this.pdfiumModule.pdfium.HEAPU8.subarray(O,O+D),N={data:new Uint8ClampedArray(te),width:C,height:w};return d.resolve(N),this.memoryManager.free(O),d}renderPageAnnotationsRaw(e,t,n){let{scaleFactor:r=1,rotation:i=l.Degree0,dpr:a=1}=n??{};this.logger.debug(W,G,`renderPageAnnotationsRaw`,e,t,n),this.logger.perf(W,G,`RenderPageAnnotationsRaw`,`Begin`,`${e.id}-${t.index}`);let o=this.cache.getContext(e.id);if(!o)return this.logger.perf(W,G,`RenderPageAnnotationsRaw`,`End`,`${e.id}-${t.index}`),P.reject({code:g.DocNotOpen,message:`document does not open`});let s=o.acquirePage(t.index),c={},d=Math.max(.01,r*a),f=this.pdfiumModule.FPDFPage_GetAnnotCount(s.pagePtr);for(let n=0;n<f;n++){let r=this.pdfiumModule.FPDFPage_GetAnnot(s.pagePtr,n);if(r)try{let n=this.getAnnotString(r,`NM`);if(!n||this.getAnnotExtendedRotation(r)!==0&&this.readAnnotUnrotatedRect(r))continue;let a=this.pdfiumModule.EPDFAnnot_GetAvailableAppearanceModes(r);if(!a)continue;let o={},l=[{bit:1,mode:u.Normal,key:`normal`},{bit:2,mode:u.Rollover,key:`rollover`},{bit:4,mode:u.Down,key:`down`}];for(let{bit:n,mode:c,key:u}of l){if(!(a&n))continue;let l=this.renderSingleAnnotAppearance(e,t,s,r,c,i,d);l&&(o[u]=l)}(o.normal||o.rollover||o.down)&&(c[n]=o)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(r)}}s.release(),this.logger.perf(W,G,`RenderPageAnnotationsRaw`,`End`,`${e.id}-${t.index}`);let p=new v;return p.resolve(c),p}renderSingleAnnotAppearance(e,t,n,r,a,o,s){if(!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(r,a)&&(this.pdfiumModule.FPDFAnnot_GetSubtype(r)!==M.WIDGET||this.pdfiumModule.FPDFAnnot_HasKey(r,`AP`)||(this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(r),!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(r,a))))return null;let c=this.readPageAnnoRect(r),l=this.convertPageRectToDeviceRect(e,t,c),u=_(T(t.size,l,o,s)),d=Math.max(1,u.size.width),f=Math.max(1,u.size.height),p=4*d,m=p*f,h=this.memoryManager.malloc(m),g=this.pdfiumModule.FPDFBitmap_CreateEx(d,f,4,h,p);this.pdfiumModule.FPDFBitmap_FillRect(g,0,0,d,f,0);let v=i(l,o,d,f),y=this.memoryManager.malloc(24);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,y,6).set([v.a,v.b,v.c,v.d,v.e,v.f]);let b=!1;try{b=!!this.pdfiumModule.EPDF_RenderAnnotBitmap(g,n.pagePtr,r,a,y,16)}finally{this.memoryManager.free(y),this.pdfiumModule.FPDFBitmap_Destroy(g)}if(!b)return this.memoryManager.free(h),null;let x=this.pdfiumModule.pdfium.HEAPU8.subarray(h,h+m),S={data:new Uint8ClampedArray(x),width:d,height:f};return this.memoryManager.free(h),{data:S,rect:l}}renderRectEncoded(e,t,n,r){let a=new v,o=r?.rotation??l.Degree0,s=this.cache.getContext(e.id);if(!s)return P.reject({code:g.DocNotOpen,message:`document does not open`});let c=Math.max(.01,r?.scaleFactor??1)*Math.max(1,r?.dpr??1),u=n.size.width,d=n.size.height,f=!(1&~o),p=Math.max(1,Math.round((f?d:u)*c)),m=Math.max(1,Math.round((f?u:d)*c)),h=4*p,_=h*m,y=s.acquirePage(t.index),b=r?.withForms??!1,x=this.memoryManager.malloc(_),S=this.pdfiumModule.FPDFBitmap_CreateEx(p,m,4,x,h),C=r?.transparentBackground?0:4294967295;this.pdfiumModule.FPDFBitmap_FillRect(S,0,0,p,m,C);let w=i(n,o,p,m),T=this.memoryManager.malloc(24);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,T,6).set([w.a,w.b,w.c,w.d,w.e,w.f]);let E=this.memoryManager.malloc(16);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,E,4).set([0,0,p,m]);let D=16;r!=null&&r.withAnnotations&&(D|=1);try{this.pdfiumModule.FPDF_RenderPageBitmapWithMatrix(S,y.pagePtr,T,E,D),b&&y.withFormHandle(e=>{let{startX:r,startY:i,formsWidth:a,formsHeight:s}=function(e,t,n,r){let i=t.origin.x,a=t.origin.y,o=i+t.size.width,s=a+t.size.height,c=n.width,u=n.height,d=Math.hypot(e.a,e.b),f=Math.hypot(e.c,e.d),p=!(1&~r),m=p?Math.max(1,Math.round(u*d)):Math.max(1,Math.round(c*d)),h=p?Math.max(1,Math.round(c*f)):Math.max(1,Math.round(u*f)),g,_;switch(r){case l.Degree0:g=-Math.round(i*d),_=-Math.round(a*f);break;case l.Degree90:g=Math.round((s-u)*d),_=-Math.round(i*f);break;case l.Degree180:g=Math.round((o-c)*d),_=Math.round((s-u)*f);break;case l.Degree270:g=-Math.round(a*d),_=Math.round((o-c)*f);break;default:g=-Math.round(i*d),_=-Math.round(a*f)}return{startX:g,startY:_,formsWidth:m,formsHeight:h,scaleX:d,scaleY:f}}(w,n,t.size,o);this.pdfiumModule.FPDF_FFLDraw(e,S,y.pagePtr,r,i,a,s,o,D)})}finally{y.release(),this.memoryManager.free(T),this.memoryManager.free(E)}this.logger.perf(W,G,`RenderRectEncodedData`,`Begin`,`${e.id}-${t.index}`);let O=this.pdfiumModule.pdfium.HEAPU8.subarray(x,x+_);this.logger.perf(W,G,`RenderRectEncodedData`,`End`,`${e.id}-${t.index}`),this.logger.perf(W,G,`RenderRectEncodedImageData`,`Begin`,`${e.id}-${t.index}`);let k={data:new Uint8ClampedArray(O),width:p,height:m};return this.logger.perf(W,G,`RenderRectEncodedImageData`,`End`,`${e.id}-${t.index}`),a.resolve(k),this.pdfiumModule.FPDFBitmap_Destroy(S),this.memoryManager.free(x),a}readPdfLinkAnnoTarget(e,t,n){let r=n();if(r)return{type:`destination`,destination:this.readPdfDestination(e,r)};{let n=t();if(n)return{type:`action`,action:this.readPdfAction(e,n)}}}createLocalDestPtr(e,t){let n=this.pdfiumModule.FPDF_LoadPage(e,t.pageIndex);if(!n)return 0;try{if(t.zoom.mode===k.XYZ){let{x:e,y:r,zoom:i}=t.zoom.params;return this.pdfiumModule.EPDFDest_CreateXYZ(n,!0,e,!0,r,!0,i)}let e,r=[];switch(t.zoom.mode){case k.FitPage:e=k.FitPage;break;case k.FitHorizontal:e=k.FitHorizontal,r=[t.view?.[0]??0];break;case k.FitVertical:e=k.FitVertical,r=[t.view?.[0]??0];break;case k.FitRectangle:{let n=t.view??[];r=[n[0]??0,n[1]??0,n[2]??0,n[3]??0],e=k.FitRectangle}break;case k.Unknown:default:return 0}return this.withFloatArray(r,(t,r)=>this.pdfiumModule.EPDFDest_CreateView(n,e,t,r))}finally{this.pdfiumModule.FPDF_ClosePage(n)}}applyBookmarkTarget(e,t,n){if(n.type===`destination`){let r=this.createLocalDestPtr(e,n.destination);return r?!!this.pdfiumModule.EPDFBookmark_SetDest(e,t,r):!1}let r=n.action;switch(r.type){case a.Goto:{let n=this.createLocalDestPtr(e,r.destination);if(!n)return!1;let i=this.pdfiumModule.EPDFAction_CreateGoTo(e,n);return!!i&&!!this.pdfiumModule.EPDFBookmark_SetAction(e,t,i)}case a.URI:{let n=this.pdfiumModule.EPDFAction_CreateURI(e,r.uri);return!!n&&!!this.pdfiumModule.EPDFBookmark_SetAction(e,t,n)}case a.LaunchAppOrOpenFile:{let n=this.withWString(r.path,t=>this.pdfiumModule.EPDFAction_CreateLaunch(e,t));return!!n&&!!this.pdfiumModule.EPDFBookmark_SetAction(e,t,n)}case a.RemoteGoto:case a.Unsupported:default:return!1}}applyLinkTarget(e,t,n){if(n.type===`destination`){let r=this.createLocalDestPtr(e,n.destination);if(!r)return!1;let i=this.pdfiumModule.EPDFAction_CreateGoTo(e,r);return!!i&&!!this.pdfiumModule.EPDFAnnot_SetAction(t,i)}let r=n.action;switch(r.type){case a.Goto:{let n=this.createLocalDestPtr(e,r.destination);if(!n)return!1;let i=this.pdfiumModule.EPDFAction_CreateGoTo(e,n);return!!i&&!!this.pdfiumModule.EPDFAnnot_SetAction(t,i)}case a.URI:{let n=this.pdfiumModule.EPDFAction_CreateURI(e,r.uri);return!!n&&!!this.pdfiumModule.EPDFAnnot_SetAction(t,n)}case a.LaunchAppOrOpenFile:{let n=this.withWString(r.path,t=>this.pdfiumModule.EPDFAction_CreateLaunch(e,t));return!!n&&!!this.pdfiumModule.EPDFAnnot_SetAction(t,n)}case a.RemoteGoto:case a.Unsupported:default:return!1}}readPdfAction(e,t){let n;switch(this.pdfiumModule.FPDFAction_GetType(t)){case a.Unsupported:n={type:a.Unsupported};break;case a.Goto:{let r=this.pdfiumModule.FPDFAction_GetDest(e,t);if(r){let t=this.readPdfDestination(e,r);n={type:a.Goto,destination:t}}else n={type:a.Unsupported}}break;case a.RemoteGoto:n={type:a.Unsupported};break;case a.URI:{let r=L(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.FPDFAction_GetURIPath(e,t,n,r),this.pdfiumModule.pdfium.UTF8ToString);n={type:a.URI,uri:r}}break;case a.LaunchAppOrOpenFile:{let e=L(this.pdfiumModule.pdfium,(e,n)=>this.pdfiumModule.FPDFAction_GetFilePath(t,e,n),this.pdfiumModule.pdfium.UTF8ToString);n={type:a.LaunchAppOrOpenFile,path:e}}}return n}readPdfDestination(e,t){let n=this.pdfiumModule.FPDFDest_GetDestPageIndex(e,t),r=this.memoryManager.malloc(4),i=this.memoryManager.malloc(16),a=this.pdfiumModule.FPDFDest_GetView(t,r,i),o=this.pdfiumModule.pdfium.getValue(r,`i32`),s=[];for(let e=0;e<o;e++){let t=i+4*e;s.push(this.pdfiumModule.pdfium.getValue(t,`float`))}if(this.memoryManager.free(r),this.memoryManager.free(i),a===k.XYZ){let e=this.memoryManager.malloc(1),r=this.memoryManager.malloc(1),i=this.memoryManager.malloc(1),o=this.memoryManager.malloc(4),c=this.memoryManager.malloc(4),l=this.memoryManager.malloc(4);if(this.pdfiumModule.FPDFDest_GetLocationInPage(t,e,r,i,o,c,l)){let t=this.pdfiumModule.pdfium.getValue(e,`i8`),u=this.pdfiumModule.pdfium.getValue(r,`i8`),d=this.pdfiumModule.pdfium.getValue(i,`i8`),f=t?this.pdfiumModule.pdfium.getValue(o,`float`):0,p=u?this.pdfiumModule.pdfium.getValue(c,`float`):0,m=d?this.pdfiumModule.pdfium.getValue(l,`float`):0;return this.memoryManager.free(e),this.memoryManager.free(r),this.memoryManager.free(i),this.memoryManager.free(o),this.memoryManager.free(c),this.memoryManager.free(l),{pageIndex:n,zoom:{mode:a,params:{x:f,y:p,zoom:m}},view:s}}return this.memoryManager.free(e),this.memoryManager.free(r),this.memoryManager.free(i),this.memoryManager.free(o),this.memoryManager.free(c),this.memoryManager.free(l),{pageIndex:n,zoom:{mode:a,params:{x:0,y:0,zoom:0}},view:s}}return{pageIndex:n,zoom:{mode:a},view:s}}readPdfAttachment(e,t){let n=this.pdfiumModule.FPDFDoc_GetAttachment(e,t),r=L(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFAttachment_GetName(n,e,t),this.pdfiumModule.pdfium.UTF16ToString),i=L(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.EPDFAttachment_GetDescription(n,e,t),this.pdfiumModule.pdfium.UTF16ToString),a=L(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFAttachment_GetSubtype(n,e,t),this.pdfiumModule.pdfium.UTF16ToString),o=this.getAttachmentDate(n,`CreationDate`),s=L(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFAttachment_GetStringValue(n,`Checksum`,e,t),this.pdfiumModule.pdfium.UTF16ToString);return{index:t,name:r,description:i,mimeType:a,size:this.getAttachmentNumber(n,`Size`),creationDate:o,checksum:s}}readPageBoxes(e,t,n){let r=r=>{if(this.pdfiumModule.EPDF_GetPageBoxByIndex(e,t,r,n))return{left:this.pdfiumModule.pdfium.getValue(n,`float`),top:this.pdfiumModule.pdfium.getValue(n+4,`float`),right:this.pdfiumModule.pdfium.getValue(n+8,`float`),bottom:this.pdfiumModule.pdfium.getValue(n+12,`float`)}},i=r(0),a=r(1);if(!i||!a)return;let o={media:i,crop:a},s=r(2);s&&(o.bleed=s);let c=r(3);c&&(o.trim=c);let l=r(4);return l&&(o.art=l),o}getPageOrigin(e){let t=e.boxes?.crop;return t?{x:t.left,y:t.bottom}:{x:0,y:0}}convertDevicePointToPagePoint(e,t,n){let r=t.size.width,i=t.size.height,a=e.normalizedRotation?0:3&t.rotation,o=this.getPageOrigin(t),s;return s=a===0?{x:n.x,y:i-n.y}:a===1?{x:n.y,y:n.x}:a===2?{x:r-n.x,y:n.y}:{x:i-n.y,y:r-n.x},{x:s.x+o.x,y:s.y+o.y}}convertPagePointToDevicePoint(e,t,n){let r=t.size.width,i=t.size.height,a=e.normalizedRotation?0:3&t.rotation,o=this.getPageOrigin(t),s=n.x-o.x,c=n.y-o.y;return a===0?{x:s,y:i-c}:a===1?{x:c,y:s}:a===2?{x:r-s,y:c}:{x:r-c,y:i-s}}convertPageRectToDeviceRect(e,t,n){let{x:r,y:i}=this.convertPagePointToDevicePoint(e,t,{x:n.left,y:n.top});return{origin:{x:r,y:i},size:{width:Math.abs(n.right-n.left),height:Math.abs(n.top-n.bottom)}}}readPageAnnoAppearanceStreams(e){return{normal:this.readPageAnnoAppearanceStream(e,u.Normal),rollover:this.readPageAnnoAppearanceStream(e,u.Rollover),down:this.readPageAnnoAppearanceStream(e,u.Down)}}readPageAnnoAppearanceStream(e,t=u.Normal){let n=2*(this.pdfiumModule.FPDFAnnot_GetAP(e,t,0,0)+1),r=this.memoryManager.malloc(n);this.pdfiumModule.FPDFAnnot_GetAP(e,t,r,n);let i=this.pdfiumModule.pdfium.UTF16ToString(r);return this.memoryManager.free(r),i}setPageAnnoAppearanceStream(e,t=u.Normal,n){let r=2*(n.length+1),i=this.memoryManager.malloc(r);try{return this.pdfiumModule.pdfium.stringToUTF16(n,i,r),!!this.pdfiumModule.FPDFAnnot_SetAP(e,t,i)}finally{this.memoryManager.free(i)}}setPageAnnoRect(e,t,n,r){let i=r.origin.x,a=r.origin.y,o=r.origin.x+r.size.width,s=r.origin.y+r.size.height,c=this.convertDevicePointToPagePoint(e,t,{x:i,y:a}),l=this.convertDevicePointToPagePoint(e,t,{x:o,y:a}),u=this.convertDevicePointToPagePoint(e,t,{x:o,y:s}),d=this.convertDevicePointToPagePoint(e,t,{x:i,y:s}),f=Math.min(c.x,l.x,u.x,d.x),p=Math.max(c.x,l.x,u.x,d.x),m=Math.min(c.y,l.y,u.y,d.y),h=Math.max(c.y,l.y,u.y,d.y);f>p&&([f,p]=[p,f]),m>h&&([m,h]=[h,m]);let g=this.memoryManager.malloc(16),_=this.pdfiumModule.pdfium;_.setValue(g+0,f,`float`),_.setValue(g+4,h,`float`),_.setValue(g+8,p,`float`),_.setValue(g+12,m,`float`);let v=this.pdfiumModule.FPDFAnnot_SetRect(n,g);return this.memoryManager.free(g),!!v}readPageAnnoRect(e){let t=this.memoryManager.malloc(16),n={left:0,top:0,right:0,bottom:0};return this.pdfiumModule.EPDFAnnot_GetRect(e,t)&&(n.left=this.pdfiumModule.pdfium.getValue(t,`float`),n.top=this.pdfiumModule.pdfium.getValue(t+4,`float`),n.right=this.pdfiumModule.pdfium.getValue(t+8,`float`),n.bottom=this.pdfiumModule.pdfium.getValue(t+12,`float`)),this.memoryManager.free(t),n}getHighlightRects(e,t,n,r,i){let a=this.pdfiumModule.FPDFText_CountRects(n,r,i),o=[],s=this.memoryManager.malloc(8),c=this.memoryManager.malloc(8),l=this.memoryManager.malloc(8),u=this.memoryManager.malloc(8);for(let r=0;r<a;r++){if(!this.pdfiumModule.FPDFText_GetRect(n,r,s,c,l,u))continue;let i=this.pdfiumModule.pdfium.getValue(s,`double`),a=this.pdfiumModule.pdfium.getValue(c,`double`),d=this.pdfiumModule.pdfium.getValue(l,`double`),f=this.pdfiumModule.pdfium.getValue(u,`double`),p=this.convertPagePointToDevicePoint(e,t,{x:i,y:a}),m=this.convertPagePointToDevicePoint(e,t,{x:d,y:a}),h=this.convertPagePointToDevicePoint(e,t,{x:d,y:f}),g=this.convertPagePointToDevicePoint(e,t,{x:i,y:f}),_=[p.x,m.x,h.x,g.x],v=[p.y,m.y,h.y,g.y],y=Math.min(..._),b=Math.min(...v),x=Math.max(..._)-y,S=Math.max(...v)-b;o.push({origin:{x:y,y:b},size:{width:Math.ceil(x),height:Math.ceil(S)}})}return this.memoryManager.free(s),this.memoryManager.free(c),this.memoryManager.free(l),this.memoryManager.free(u),o}searchInPage(e,t,n,r){this.logger.debug(W,G,`searchInPage`,e,t,n,r),this.logger.perf(W,G,`SearchInPage`,`Begin`,`${e.id}-${t.index}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(W,G,`PreparePrintDocument`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`Document is not open`});let a=2*(n.length+1),o=this.memoryManager.malloc(a);this.pdfiumModule.pdfium.stringToUTF16(n,o,a);try{let n=this.searchAllInPage(e,i,t,o,r);return P.resolve(n)}finally{this.memoryManager.free(o)}}getAnnotationsBatch(e,t){this.logger.debug(W,G,`getAnnotationsBatch`,e.id,t.length);let n=new v;return queueMicrotask(()=>{this.logger.perf(W,G,`GetAnnotationsBatch`,`Begin`,e.id);let r=this.cache.getContext(e.id);if(!r)return void n.reject({code:g.DocNotOpen,message:`Document is not open`});let i={},a=t.length,o=this.pdfiumModule.PDFiumExt_OpenFormFillInfo(),s=this.pdfiumModule.PDFiumExt_InitFormFillEnvironment(r.docPtr,o);try{for(let o=0;o<t.length;o++){let c=t[o],l=this.readPageAnnotationsRaw(e,r,c,s);i[c.index]=l,n.progress({pageIndex:c.index,result:l,completed:o+1,total:a})}}finally{this.pdfiumModule.PDFiumExt_ExitFormFillEnvironment(s),this.pdfiumModule.PDFiumExt_CloseFormFillInfo(o)}this.logger.perf(W,G,`GetAnnotationsBatch`,`End`,e.id),n.resolve(i)}),n}searchBatch(e,t,n,r){this.logger.debug(W,G,`searchBatch`,e.id,t.length,n);let i=new v;return queueMicrotask(()=>{this.logger.perf(W,G,`SearchBatch`,`Begin`,e.id);let a=this.cache.getContext(e.id);if(!a)return void i.reject({code:g.DocNotOpen,message:`Document is not open`});let o=2*(n.length+1),s=this.memoryManager.malloc(o);this.pdfiumModule.pdfium.stringToUTF16(n,s,o);try{let n={},o=t.length;for(let c=0;c<t.length;c++){let l=t[c],u=this.searchAllInPage(e,a,l,s,r);n[l.index]=u,i.progress({pageIndex:l.index,result:u,completed:c+1,total:o})}this.logger.perf(W,G,`SearchBatch`,`End`,e.id),i.resolve(n)}finally{this.memoryManager.free(s)}}),i}buildContext(e,t,n,r=30){let i=/[\s\u00A0.,;:!?()\[\]{}<>/\\\-"'`"”\u2013\u2014]/,a=t;for(;a>0&&i.test(e[a-1]);)a--;let o=0;for(;a>0&&o<r;)a--,i.test(e[a])||o++;a=(t=>{for(;t>0&&!i.test(e[t-1]);)t--;return t})(a);let s=t+n;for(;s<e.length&&i.test(e[s]);)s++;for(o=0;s<e.length&&o<r;)i.test(e[s])||o++,s++;s=(t=>{for(;t<e.length&&!i.test(e[t]);)t++;return t})(s);let c=e.slice(a,t).replace(/\s+/g,` `).trimStart(),l=e.slice(t,t+n),u=e.slice(t+n,s).replace(/\s+/g,` `).trimEnd();return{before:this.tidy(c),match:this.tidy(l),after:this.tidy(u),truncatedLeft:a>0,truncatedRight:s<e.length}}tidy(e){return e.replace(/-\uFFFE\s*/g,``).replace(/[\uFFFE\u00AD\u200B\u2060\uFEFF]/g,``).replace(/\s+/g,` `)}searchAllInPage(e,t,n,r,i){return t.borrowPage(n.index,t=>{let a=t.getTextPage(),o=this.pdfiumModule.FPDFText_CountChars(a),s=this.memoryManager.malloc(2*(o+1));this.pdfiumModule.FPDFText_GetText(a,0,o,s);let c=this.pdfiumModule.pdfium.UTF16ToString(s);this.memoryManager.free(s);let l=[],u=this.pdfiumModule.FPDFText_FindStart(a,r,i,0);for(;this.pdfiumModule.FPDFText_FindNext(u);){let t=this.pdfiumModule.FPDFText_GetSchResultIndex(u),r=this.pdfiumModule.FPDFText_GetSchCount(u),i=this.getHighlightRects(e,n,a,t,r),o=this.buildContext(c,t,r);l.push({pageIndex:n.index,charIndex:t,charCount:r,rects:i,context:o})}return this.pdfiumModule.FPDFText_FindClose(u),l})}preparePrintDocument(e,t){let{includeAnnotations:n=!0,pageRange:r=null}=t??{};this.logger.debug(W,G,`preparePrintDocument`,e,t),this.logger.perf(W,G,`PreparePrintDocument`,`Begin`,e.id);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(W,G,`PreparePrintDocument`,`End`,e.id),P.reject({code:g.DocNotOpen,message:`Document is not open`});let a=this.pdfiumModule.FPDF_CreateNewDocument();if(!a)return this.logger.perf(W,G,`PreparePrintDocument`,`End`,e.id),P.reject({code:g.CantCreateNewDoc,message:`Cannot create print document`});try{let t=this.sanitizePageRange(r,e.pageCount);if(!this.pdfiumModule.FPDF_ImportPages(a,i.docPtr,t??``,0))return this.pdfiumModule.FPDF_CloseDocument(a),this.logger.error(W,G,`Failed to import pages for printing`),this.logger.perf(W,G,`PreparePrintDocument`,`End`,e.id),P.reject({code:g.CantImportPages,message:`Failed to import pages for printing`});if(!n){let t=this.removeAnnotationsFromPrintDocument(a);if(!t.success)return this.pdfiumModule.FPDF_CloseDocument(a),this.logger.error(W,G,`Failed to remove annotations: ${t.error}`),this.logger.perf(W,G,`PreparePrintDocument`,`End`,e.id),P.reject({code:g.Unknown,message:`Failed to prepare print document: ${t.error}`});this.logger.debug(W,G,`Removed ${t.annotationsRemoved} annotations from ${t.pagesProcessed} pages`)}let o=this.saveDocument(a);return this.pdfiumModule.FPDF_CloseDocument(a),this.logger.perf(W,G,`PreparePrintDocument`,`End`,e.id),P.resolve(o)}catch(t){return a&&this.pdfiumModule.FPDF_CloseDocument(a),this.logger.error(W,G,`preparePrintDocument failed`,t),this.logger.perf(W,G,`PreparePrintDocument`,`End`,e.id),P.reject({code:g.Unknown,message:t instanceof Error?t.message:`Failed to prepare print document`})}}removeAnnotationsFromPrintDocument(e){let t=0,n=0;try{let r=this.pdfiumModule.FPDF_GetPageCount(e);for(let i=0;i<r;i++){let r=this.pdfiumModule.EPDFPage_GetAnnotCountRaw(e,i);if(r<=0){n++;continue}let a=0;for(let n=r-1;n>=0;n--)this.pdfiumModule.EPDFPage_RemoveAnnotRaw(e,i,n)?(a++,t++):this.logger.warn(W,G,`Failed to remove annotation ${n} from page ${i}`);if(a>0){let t=this.pdfiumModule.FPDF_LoadPage(e,i);t&&(this.pdfiumModule.FPDFPage_GenerateContent(t),this.pdfiumModule.FPDF_ClosePage(t))}n++}return{success:!0,annotationsRemoved:t,pagesProcessed:n}}catch(e){return{success:!1,annotationsRemoved:t,pagesProcessed:n,error:e instanceof Error?e.message:`Unknown error during annotation removal`}}}sanitizePageRange(e,t){if(!e||e.trim()===``)return null;try{let n=[],r=e.split(`,`);for(let e of r){let r=e.trim();if(r.includes(`-`)){let[e,i]=r.split(`-`).map(e=>e.trim()),a=parseInt(e,10),o=parseInt(i,10);if(isNaN(a)||isNaN(o)){this.logger.warn(W,G,`Invalid range: ${r}`);continue}let s=Math.max(1,Math.min(a,t)),c=Math.max(1,Math.min(o,t));for(let e=s;e<=c;e++)n.includes(e)||n.push(e)}else{let e=parseInt(r,10);if(isNaN(e)){this.logger.warn(W,G,`Invalid page number: ${r}`);continue}let i=Math.max(1,Math.min(e,t));n.includes(i)||n.push(i)}}if(n.length===0)return this.logger.warn(W,G,`No valid pages in range, using all pages`),null;n.sort((e,t)=>e-t);let i=[],a=n[0],o=n[0];for(let e=1;e<n.length;e++)n[e]===o+1||(a===o?i.push(a.toString()):o-a===1?(i.push(a.toString()),i.push(o.toString())):i.push(`${a}-${o}`),a=n[e]),o=n[e];a===o?i.push(a.toString()):o-a===1?(i.push(a.toString()),i.push(o.toString())):i.push(`${a}-${o}`);let s=i.join(`,`);return this.logger.debug(W,G,`Sanitized page range: "${e}" -> "${s}"`),s}catch(e){return this.logger.error(W,G,`Error sanitizing page range: ${e}`),null}}};async function be(e,t){let n=new ye(await I({wasmBinary:await(await fetch(e)).arrayBuffer()}),{logger:t?.logger,fontFallback:t?.fontFallback});return new ae(n,{imageConverter:ie,logger:t?.logger})}export{be as createPdfiumEngine};