@fudanda/admin-antd 0.0.0-stage → 2.20261024.1-beta.1

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 (482) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +58 -3
  3. package/THIRD_PARTY_NOTICES.md +55 -0
  4. package/dist/assets/libarchive-DxGirPmi.wasm +0 -0
  5. package/dist/assets/pdfium-BJ2Yip8Q.wasm +0 -0
  6. package/dist/assets/ppt-font-cjk-DxgKpThH.otf +0 -0
  7. package/dist/assets/ppt-native-Cz5DBbag.wasm +0 -0
  8. package/dist/assets/pptx.worker-CtaL8LO_.js +30 -0
  9. package/dist/assets/worker-C5LZNsKY.mjs +1650 -0
  10. package/dist/assets/worker-CDeo9jS-.js +40 -0
  11. package/dist/assets/worker-bundle-Dx5mKZOL.js +6 -0
  12. package/dist/automation.d.ts +3 -0
  13. package/dist/automation.js +15 -0
  14. package/dist/chunks/App-DNjXLysb.js +79 -0
  15. package/dist/chunks/AppModal-DJzQA6FR.js +1 -0
  16. package/dist/chunks/ArcBaseAdmin-BZrHGq2f.js +1 -0
  17. package/dist/chunks/ConfigurableTable-DzmZDd8F.js +55 -0
  18. package/dist/chunks/DashboardPage-BohGodSl.js +22 -0
  19. package/dist/chunks/DataScopePanel-B2-x8Jcz.js +1 -0
  20. package/dist/chunks/DateTimeText-CIt0Qy45.js +1 -0
  21. package/dist/chunks/DepartmentsPage-DMWY__Y_.js +1 -0
  22. package/dist/chunks/DictTag-2-adKbYg.js +1 -0
  23. package/dist/chunks/DictsPage-DILDyHi-.js +15 -0
  24. package/dist/chunks/EditFormModal-DNHOZHxM.js +1 -0
  25. package/dist/chunks/EmptyIllustration-DUC3RZmF.js +1 -0
  26. package/dist/chunks/EntityContextRuntime-DMklAv-k.js +1 -0
  27. package/dist/chunks/EntityContextRuntime-sslBZqYD.js +1 -0
  28. package/dist/chunks/EntityRelationButton-DWn1rC2J.js +8 -0
  29. package/dist/chunks/ExportButton-AzH4D0oW.js +1 -0
  30. package/dist/chunks/FileNameCell-DPyi64Rv.js +1 -0
  31. package/dist/chunks/FileStorageConfigsPage-CzuOgeK0.js +15 -0
  32. package/dist/chunks/FileTypeIcon-DIih3XQG.js +1 -0
  33. package/dist/chunks/FileViewerPreviewPanel-CMqVtGCr.js +41 -0
  34. package/dist/chunks/FilesPage-BaEBCOCs.js +43 -0
  35. package/dist/chunks/IdentitySecurityPage-BO7nY8id.js +1 -0
  36. package/dist/chunks/JsonPreviewPanel-Dhbza-Uu.js +1 -0
  37. package/dist/chunks/LogStatsScaffold-CLycj3da.js +1 -0
  38. package/dist/chunks/LoginLogsPage-DTmHi8u0.js +1 -0
  39. package/dist/chunks/LoginLogsTable-DVmHnC6V.js +1 -0
  40. package/dist/chunks/MarkdownPreviewPanel-DoiaAeRv.js +51 -0
  41. package/dist/chunks/MasterDetailLayout-sjPWw8BI.js +8 -0
  42. package/dist/chunks/MemberAssignmentSheet-Czbt6_zv.js +1 -0
  43. package/dist/chunks/MenuCommandPalette-BCOzf-Kq.js +8 -0
  44. package/dist/chunks/MenusPage-DN8DTGB1.js +1 -0
  45. package/dist/chunks/ModalFooter-RMlvqrO9.js +1 -0
  46. package/dist/chunks/MonacoPreviewPanel-Dnz7xpWP.js +1 -0
  47. package/dist/chunks/NavListPanel-vjIOIqK0.js +1 -0
  48. package/dist/chunks/OnlineSessionsPage-FoHYZKlR.js +1 -0
  49. package/dist/chunks/OperationLogsPage-BeRnGcBJ.js +1 -0
  50. package/dist/chunks/OperationLogsTable-COI-Lp-y.js +1 -0
  51. package/dist/chunks/PDFPreviewPanel-BIQuBnZZ.js +37 -0
  52. package/dist/chunks/PasswordInput-DGEJO9yx.js +1 -0
  53. package/dist/chunks/PositionsPage-DohI0luX.js +1 -0
  54. package/dist/chunks/PreferencesSheetBody-B9niQABW.js +43 -0
  55. package/dist/chunks/ProfilePage-CVTRv7xb.js +15 -0
  56. package/dist/chunks/RelationPanel-B1X6AVaM.js +36 -0
  57. package/dist/chunks/ResponsiveTableActions-y54aSdhs.js +1 -0
  58. package/dist/chunks/RolesPage-CtUw93L8.js +1 -0
  59. package/dist/chunks/ScrollArea-DqjJmHDN.js +11 -0
  60. package/dist/chunks/SearchToolbar-CvgYKUjr.js +1 -0
  61. package/dist/chunks/SessionClientTag-DIwnYodW.js +22 -0
  62. package/dist/chunks/SessionConflictModal-BLNuDsN_.js +1 -0
  63. package/dist/chunks/SettingRow-DVNmTJWC.js +1 -0
  64. package/dist/chunks/SettingsPage-BRnCxYQm.js +26 -0
  65. package/dist/chunks/StatCard-Czjfs0fa.js +4 -0
  66. package/dist/chunks/UTIF-QUtClmQd.js +1 -0
  67. package/dist/chunks/UserAvatar-B8CFnTCn.js +1 -0
  68. package/dist/chunks/UserDisplay-J0Re8z-7.js +1 -0
  69. package/dist/chunks/UserGroupsPage-CNwbejx-.js +1 -0
  70. package/dist/chunks/UserLogsPanels-BHeSxWrk.js +36 -0
  71. package/dist/chunks/UserTransferSelect-CAeyxdor.js +22 -0
  72. package/dist/chunks/UsersPage-BXt9fOru.js +36 -0
  73. package/dist/chunks/abnfDiagram-VCTEODGH-Z6OhNjoW.js +1 -0
  74. package/dist/chunks/activity-DBu4axwF.js +8 -0
  75. package/dist/chunks/arc-B3K1fDeF.js +1 -0
  76. package/dist/chunks/architecture-7GRP2DOG-CMtoOwin.js +1 -0
  77. package/dist/chunks/architectureDiagram-5GKGNRK7-V5A7S5fY.js +36 -0
  78. package/dist/chunks/archive-B_IKvysI.js +72 -0
  79. package/dist/chunks/array-BrHhzP_A.js +1 -0
  80. package/dist/chunks/arrow-left-CsxBMzKY.js +8 -0
  81. package/dist/chunks/avsc-C0VoJRmm.js +160 -0
  82. package/dist/chunks/blockDiagram-I7D4REHJ-CFKGJkc_.js +129 -0
  83. package/dist/chunks/browser-BKLM0ThC-mnGPrtB_.js +1 -0
  84. package/dist/chunks/browser-index-JqxD-45S.js +1 -0
  85. package/dist/chunks/builtin_esm-external-require-react-BsBndGeN.js +1 -0
  86. package/dist/chunks/bundle-DbfUnEV1.js +29 -0
  87. package/dist/chunks/c4Diagram-7LVT6UL2-BqYYoXPe.js +38 -0
  88. package/dist/chunks/channel-C9Dr7Z-W.js +1 -0
  89. package/dist/chunks/chart-data-DImT_Mzn.js +5 -0
  90. package/dist/chunks/chart-renderer-k-Rd8vdL.js +7 -0
  91. package/dist/chunks/chevron-down-mn2tSKQd.js +8 -0
  92. package/dist/chunks/chevron-right-EBApfX6q.js +15 -0
  93. package/dist/chunks/chevrons-up-down-2M6hY6wt.js +15 -0
  94. package/dist/chunks/chunk-2E4U76K2-DNbbdpCx.js +1 -0
  95. package/dist/chunks/chunk-2Q5K7J3B-CmAE3Vs0.js +1 -0
  96. package/dist/chunks/chunk-2ZTRR5NV-BjsSRgBv.js +2 -0
  97. package/dist/chunks/chunk-3Z5EZCMW-uYiqz-6y.js +1 -0
  98. package/dist/chunks/chunk-4HAMMTFA-Aw59LwS3.js +62 -0
  99. package/dist/chunks/chunk-5V3GS4D5-B_CVcJic.js +1 -0
  100. package/dist/chunks/chunk-5VM5RSS4-DMlsEAcl.js +15 -0
  101. package/dist/chunks/chunk-6AZGARVD-CgAiC5mV.js +1 -0
  102. package/dist/chunks/chunk-6EIED4P4-CXz5D9B0.js +1 -0
  103. package/dist/chunks/chunk-6K3QC6MW-DtaQ52mY.js +1 -0
  104. package/dist/chunks/chunk-6TQVIW2G-D0YDxefI.js +1 -0
  105. package/dist/chunks/chunk-747NJXEK-DGoElbDa.js +2 -0
  106. package/dist/chunks/chunk-75Z2AOVW-IO9R6faP.js +2 -0
  107. package/dist/chunks/chunk-CLGD4ZFX-tRS89bnq.js +1 -0
  108. package/dist/chunks/chunk-DU6HZSFF-Bx48E1rg.js +125 -0
  109. package/dist/chunks/chunk-F27PBJKO-DtLva7y0.js +1 -0
  110. package/dist/chunks/chunk-FOHPRMQF-B8MMrnxV.js +255 -0
  111. package/dist/chunks/chunk-GMAD6QVW-D41KnniX.js +72 -0
  112. package/dist/chunks/chunk-GVQU2GXP-CVzgM_ui.js +1 -0
  113. package/dist/chunks/chunk-I5DQTOEV-CoecQT42.js +1 -0
  114. package/dist/chunks/chunk-ICYGCRZG-lH3opfCY.js +1 -0
  115. package/dist/chunks/chunk-IH6LHLGP-tD-j3Rsy.js +1 -0
  116. package/dist/chunks/chunk-IMKFNOWR-CL9pLQhV.js +231 -0
  117. package/dist/chunks/chunk-JWPE2WC7-Wk0BVLn5.js +1 -0
  118. package/dist/chunks/chunk-KI3K4JFJ-C-3Y_9er.js +1 -0
  119. package/dist/chunks/chunk-L3NEJ4N5-CmvrS7Dt.js +1 -0
  120. package/dist/chunks/chunk-LNGE3PJU-BP1fsJRz.js +34 -0
  121. package/dist/chunks/chunk-OSK3NFVY-C9uWOXTC.js +10 -0
  122. package/dist/chunks/chunk-OUJLGHUK-Cm55l9bx.js +2 -0
  123. package/dist/chunks/chunk-P2QGCYS3-C9bc1yiM.js +1 -0
  124. package/dist/chunks/chunk-POPQ4Y6H-P1s5xaxM.js +1 -0
  125. package/dist/chunks/chunk-PWAF6VOD-IORmPx9D.js +1 -0
  126. package/dist/chunks/chunk-SHT3W25Y-Bip4melZ.js +168 -0
  127. package/dist/chunks/chunk-SVP7TREG-BKCgUOuy.js +88 -0
  128. package/dist/chunks/chunk-TICWLB2K-12W2EmSx.js +206 -0
  129. package/dist/chunks/chunk-TLUHSLCS-DsqF476v.js +1 -0
  130. package/dist/chunks/chunk-UY3FDG6J-71d_M6t3.js +1 -0
  131. package/dist/chunks/chunk-XHIXRSVI-C2X1-xC6.js +1 -0
  132. package/dist/chunks/chunk-XXDRQBXY-Bl6AoSZF.js +1 -0
  133. package/dist/chunks/chunk-Y2CYZVJY-DjEHBC-3.js +1 -0
  134. package/dist/chunks/circle-check-RKAno__V.js +8 -0
  135. package/dist/chunks/circle-x-BB5x-D-8.js +8 -0
  136. package/dist/chunks/classDiagram-ZZMXUADV-CZrpYcfK.js +1 -0
  137. package/dist/chunks/classDiagram-v2-VYDZK3BY-CZrpYcfK.js +1 -0
  138. package/dist/chunks/clipboard-ERcMSMRH.js +1 -0
  139. package/dist/chunks/clock-CniP1gZS.js +8 -0
  140. package/dist/chunks/confirm-BtBBEqk8.js +1 -0
  141. package/dist/chunks/controls-C5dPckUT.js +1 -0
  142. package/dist/chunks/copy-ofLPH1I0.js +8 -0
  143. package/dist/chunks/cose-bilkent-JH36ORCC-D9OUqkk5.js +1 -0
  144. package/dist/chunks/createLucideIcon-BtwfYE6A.js +83 -0
  145. package/dist/chunks/cynefin-OW5HDTMX-B8_kUynj.js +1 -0
  146. package/dist/chunks/cynefinDiagram-5FMLGOSQ-DhQChnCg.js +62 -0
  147. package/dist/chunks/cytoscape.esm-wDUnleWx.js +339 -0
  148. package/dist/chunks/dagre-GXQ25YYZ-CfbwC_a5.js +4 -0
  149. package/dist/chunks/dagre-ZVAWSfFw.js +1 -0
  150. package/dist/chunks/data-B05HzECj.js +28 -0
  151. package/dist/chunks/date-picker-CPUxgHVv.js +1 -0
  152. package/dist/chunks/defaultLocale-BvxIcb9Y.js +1 -0
  153. package/dist/chunks/deleteAction-CCocr5uV.js +1 -0
  154. package/dist/chunks/diagram-D9cwc7QH.js +5 -0
  155. package/dist/chunks/diagram-S7CK7UJ4-DVPbdtMm.js +30 -0
  156. package/dist/chunks/diagram-UQ7AKVKN-D_ZBhGLL.js +41 -0
  157. package/dist/chunks/diagram-VSXAHHWV-Dqypp-OX.js +3 -0
  158. package/dist/chunks/diagram-VX7I27RA-CbWJVJ_L.js +24 -0
  159. package/dist/chunks/diagram-Z3DM3KII-CUyP4-RY.js +24 -0
  160. package/dist/chunks/direct-engine-thps0u7R.js +5 -0
  161. package/dist/chunks/dist-Bauqz5on.js +1 -0
  162. package/dist/chunks/dist-CWj_XYki.js +1 -0
  163. package/dist/chunks/dist-D_KGQS7-.js +11 -0
  164. package/dist/chunks/dist-DdW4yNBK.js +1 -0
  165. package/dist/chunks/docx-preview-CPN81HCr.js +11 -0
  166. package/dist/chunks/download--5IybXxz.js +8 -0
  167. package/dist/chunks/drawing-D2Qrun-P.js +48 -0
  168. package/dist/chunks/ebnfDiagram-PWID7BFC-C5NMigjm.js +1 -0
  169. package/dist/chunks/ellipsis-Dux1Nxa5.js +8 -0
  170. package/dist/chunks/email-ByshRsFv.js +61 -0
  171. package/dist/chunks/emailHtml-BAKcRhSm.js +1 -0
  172. package/dist/chunks/erDiagram-RLTQ6QDP-B5rUHJPJ.js +99 -0
  173. package/dist/chunks/eventmodeling-NTZA5JFV-C74no5BH.js +1 -0
  174. package/dist/chunks/export-BkwewH6Q.js +1 -0
  175. package/dist/chunks/export-DlTz5dc2.js +341 -0
  176. package/dist/chunks/eye-off-BtJoIT5n.js +8 -0
  177. package/dist/chunks/feedback-BnjMKZpz.js +1 -0
  178. package/dist/chunks/file-utils-DyvnVEoH.js +1 -0
  179. package/dist/chunks/fit-CsnhEncA.js +1 -0
  180. package/dist/chunks/flowDiagram-HODETNUW-BuMvaSeo.js +1 -0
  181. package/dist/chunks/form-CQutQFiD.js +1 -0
  182. package/dist/chunks/funnel-BwQjQI4Y.js +8 -0
  183. package/dist/chunks/ganttDiagram-EL5Y4UJY-DIAlbvVg.js +292 -0
  184. package/dist/chunks/geo-DR0fL7r2.js +38 -0
  185. package/dist/chunks/gitGraph-4MIJSDKK-Ce5mOfp1.js +1 -0
  186. package/dist/chunks/gitGraphDiagram-WWUBYQGX-DN3G9xiQ.js +106 -0
  187. package/dist/chunks/graphlib-CYBMTUbW.js +1 -0
  188. package/dist/chunks/icons-CbRx5Om7.js +1 -0
  189. package/dist/chunks/illustrations-DT1eq6jI.js +1 -0
  190. package/dist/chunks/image-ez9hvzKT.js +17 -0
  191. package/dist/chunks/index.es-OAWlVkoK.js +16 -0
  192. package/dist/chunks/info-A6RAGUB7-BP6lMBIR.js +1 -0
  193. package/dist/chunks/info-BQa8C31Y.js +8 -0
  194. package/dist/chunks/infoDiagram-27XIBGKW-BhQtr_Ti.js +2 -0
  195. package/dist/chunks/init-Ca_Ibf4y.js +1 -0
  196. package/dist/chunks/ishikawaDiagram-5VMMS53U-CLR6CAi4.js +70 -0
  197. package/dist/chunks/journeyDiagram-3NMN7TZE-_-Q7sjsP.js +139 -0
  198. package/dist/chunks/json-viewer-DHYRjY8I.js +1 -0
  199. package/dist/chunks/jszip.min-hNOoGCeG.js +14 -0
  200. package/dist/chunks/kanban-definition-UXKFOSKX-D97mHeUZ.js +89 -0
  201. package/dist/chunks/katex-D5qu7EYh.js +257 -0
  202. package/dist/chunks/layout-grid-Bp9bwiQZ.js +8 -0
  203. package/dist/chunks/lib-BlRm3nk1.js +15 -0
  204. package/dist/chunks/lib-C1nFUu19.js +4 -0
  205. package/dist/chunks/lib-CqYXBtHb.js +1 -0
  206. package/dist/chunks/libarchive-DRzzJvQl.js +7 -0
  207. package/dist/chunks/line-BV7qVRkM.js +1 -0
  208. package/dist/chunks/line-qVHaOdPp.js +1 -0
  209. package/dist/chunks/linear-DXABSWHW.js +1 -0
  210. package/dist/chunks/list-0CbyOlT9.js +1 -0
  211. package/dist/chunks/list-DCcWnjUg.js +8 -0
  212. package/dist/chunks/listTableProps-DDynsnLF.js +1 -0
  213. package/dist/chunks/log-in-OzbNes8i.js +8 -0
  214. package/dist/chunks/lucide-react-VfAPsQQ5.js +8 -0
  215. package/dist/chunks/maplibre-gl-Bxi83GUP.js +819 -0
  216. package/dist/chunks/maplibre-shared-Oo0L8Lll.js +6 -0
  217. package/dist/chunks/maximize-CnmQ11E7.js +8 -0
  218. package/dist/chunks/media-DoGe_p4O.js +1 -0
  219. package/dist/chunks/menu-mQgsexFx.js +15 -0
  220. package/dist/chunks/mermaid-parser.core-DvCAQkzY.js +3 -0
  221. package/dist/chunks/mermaid.core-CxOC6yPr.js +15 -0
  222. package/dist/chunks/messages-CFyOVxEM.js +1 -0
  223. package/dist/chunks/mindmap-definition-YA3MSWOX-A2UgnMwx.js +96 -0
  224. package/dist/chunks/minimize-Bpau_zCe.js +8 -0
  225. package/dist/chunks/msg-BzZbudMm.js +7 -0
  226. package/dist/chunks/ofd-C7DKqJ6Z.js +33 -0
  227. package/dist/chunks/ofd-DrJyXIpS.js +14 -0
  228. package/dist/chunks/openDocument-DGzqlyJg.js +12 -0
  229. package/dist/chunks/options-B65xkxOY.js +1 -0
  230. package/dist/chunks/ordinal-NuFkISw7.js +1 -0
  231. package/dist/chunks/packet-AYTQ26CC-DS6h3a5l.js +1 -0
  232. package/dist/chunks/panzoom.es-DnuzxUQi.js +1 -0
  233. package/dist/chunks/parse-6ZQGx714.js +1 -0
  234. package/dist/chunks/parser-DC3PvpL4.js +72 -0
  235. package/dist/chunks/path-VUNELGFR.js +1 -0
  236. package/dist/chunks/pegDiagram-XKGWAZYB-DxQqpKfh.js +1 -0
  237. package/dist/chunks/pie-WAS4IAKB-BsaegmNA.js +1 -0
  238. package/dist/chunks/pieDiagram-E7YTZNPT-BUsnkTkJ.js +39 -0
  239. package/dist/chunks/postal-mime-DMcA5b7k.js +28 -0
  240. package/dist/chunks/ppt-B0WY5Gks.js +30 -0
  241. package/dist/chunks/ppt-BIiNnCyj.js +1 -0
  242. package/dist/chunks/pptx-DX5KDFZ7.js +109 -0
  243. package/dist/chunks/preload-helper-C-73SErw.js +1 -0
  244. package/dist/chunks/print-mask-Dguzv0rv.js +17 -0
  245. package/dist/chunks/printLayout-oeudvFkr.js +34 -0
  246. package/dist/chunks/printMask-LefOTJqk.js +8 -0
  247. package/dist/chunks/psd-hjeNFQZ-.js +36 -0
  248. package/dist/chunks/purify.es-BsWMI_aG.js +5 -0
  249. package/dist/chunks/quadrantDiagram-AXDQQJYC-BmQNSzhY.js +7 -0
  250. package/dist/chunks/radar-RG4KPBEZ-BoHdw2h7.js +1 -0
  251. package/dist/chunks/railroad-74A4TZTK-BifJffb4.js +1 -0
  252. package/dist/chunks/railroad-abnf-HS5TGJTU-CMEPumRO.js +1 -0
  253. package/dist/chunks/railroad-ebnf-LZEXJU2U-B06BgAeN.js +1 -0
  254. package/dist/chunks/railroad-peg-WCYAUIDC-CMjriUEs.js +1 -0
  255. package/dist/chunks/railroadDiagram-O6MQD6OU-B2t5KY26.js +1 -0
  256. package/dist/chunks/react-runtime-x2lFbSKq.js +11 -0
  257. package/dist/chunks/refresh-cw-Dz8O9-Hp.js +8 -0
  258. package/dist/chunks/rendered-slot-YhfmcMJr.js +1 -0
  259. package/dist/chunks/requirementDiagram-BXWQKSXE-CBBfNOAp.js +84 -0
  260. package/dist/chunks/rolldown-runtime-BKuNeK48.js +1 -0
  261. package/dist/chunks/rotate-ccw-D2__Zisi.js +8 -0
  262. package/dist/chunks/rotate-cw-BSTVLlWY.js +8 -0
  263. package/dist/chunks/rough.esm-CVrpq1dW.js +1 -0
  264. package/dist/chunks/sankeyDiagram-P5KCCOFB-Cp8SrFyb.js +40 -0
  265. package/dist/chunks/save-w-NwiMMY.js +8 -0
  266. package/dist/chunks/search-DYZU68h1.js +8 -0
  267. package/dist/chunks/search-filters-CRIhZ0gL.js +1 -0
  268. package/dist/chunks/sequenceDiagram-WJ2MYXX4-PDtVfEoj.js +162 -0
  269. package/dist/chunks/shield-alert-De_Hx56I.js +8 -0
  270. package/dist/chunks/sizeCapture-INFHLROL-DA-kAaXB.js +1 -0
  271. package/dist/chunks/skeleton-CrjMjJNr.js +1 -0
  272. package/dist/chunks/spreadsheet-BzbBEhmY.js +1 -0
  273. package/dist/chunks/spreadsheet-LR3SOG-x.js +58 -0
  274. package/dist/chunks/sql-wasm-browser-CFddXd9f.js +2 -0
  275. package/dist/chunks/src-C1iDJpBK.js +1 -0
  276. package/dist/chunks/src-vLpLkuQx.js +1 -0
  277. package/dist/chunks/stateDiagram-D77RDMKH-C1Sx8KUD.js +1 -0
  278. package/dist/chunks/stateDiagram-v2-MP3YSRHH-7wYLSzBX.js +1 -0
  279. package/dist/chunks/swimlanes-42K2YHIH-BmybX9eL.js +1 -0
  280. package/dist/chunks/swimlanesDiagram-VR7AAH4N-DxhXklfm.js +8 -0
  281. package/dist/chunks/tabs-BobA_IcO.js +1 -0
  282. package/dist/chunks/theme-controller-D-ATwFal.js +1 -0
  283. package/dist/chunks/timeline-definition-24CTP7MA-QS9QNm2i.js +120 -0
  284. package/dist/chunks/tinycolor-CG1wnM-U.js +1 -0
  285. package/dist/chunks/togeojson.es-BE8iM7U6.js +1 -0
  286. package/dist/chunks/toolbar-controls-CThS0xuP.js +15 -0
  287. package/dist/chunks/trash-tHBT8Mpw.js +8 -0
  288. package/dist/chunks/treeView-Q6P3EWNA-CN0l7whJ.js +1 -0
  289. package/dist/chunks/treemap-WGGIJYW6-C4P1fQxS.js +1 -0
  290. package/dist/chunks/typography-DKK_iHcj.js +1 -0
  291. package/dist/chunks/ui-BFsHoY7a.js +1 -0
  292. package/dist/chunks/ui-utils-ClxYogUQ.js +1 -0
  293. package/dist/chunks/upload-M-n6woFv.js +8 -0
  294. package/dist/chunks/useCrudOperationColumn-D935tixd.js +1 -0
  295. package/dist/chunks/useListPage-CbcOQG4m.js +1 -0
  296. package/dist/chunks/useModalViewport-HF7te75S.js +1 -0
  297. package/dist/chunks/useRowSelection-4GOMFmjG.js +1 -0
  298. package/dist/chunks/useStatusToggle-B2qZaoc-.js +1 -0
  299. package/dist/chunks/user-round-kYfBkPNu.js +15 -0
  300. package/dist/chunks/users-BXZLb4TY.js +8 -0
  301. package/dist/chunks/vennDiagram-4TSXK5OY-CVd73ycc.js +34 -0
  302. package/dist/chunks/view-B8ZvC8z3.js +1 -0
  303. package/dist/chunks/viewer-Ct88ypIL.js +24 -0
  304. package/dist/chunks/wardley-WFR3VGLG-cG9pRFwD.js +1 -0
  305. package/dist/chunks/wardleyDiagram-VM6X3IG4-B42d0Gqz.js +78 -0
  306. package/dist/chunks/wordDoc-BZY3ZnxN.js +152 -0
  307. package/dist/chunks/wordDocx-Bt2mlB3C.js +77 -0
  308. package/dist/chunks/wordMl-Y_ghyTZ8.js +1 -0
  309. package/dist/chunks/worker-engine-B4e92GsN.js +17369 -0
  310. package/dist/chunks/x-Ak9hw1R9.js +8 -0
  311. package/dist/chunks/xmind-CF9YwkOD.js +58 -0
  312. package/dist/chunks/xychartDiagram-S5SC5T6Z-B_Owv9Ho.js +7 -0
  313. package/dist/file-viewer/flyfish-viewer-assets.json +46 -0
  314. package/dist/file-viewer/vendor/docx/docx.worker.js +5 -0
  315. package/dist/file-viewer/vendor/docx/jszip.min.js +13 -0
  316. package/dist/file-viewer/vendor/xlsx/sheet.worker.js +107 -0
  317. package/dist/file-viewer/wasm/data/sql-wasm.wasm +0 -0
  318. package/dist/index.d.ts +5 -0
  319. package/dist/index.js +1 -0
  320. package/dist/public/avatars/avatar-01.svg +1 -0
  321. package/dist/public/avatars/avatar-02.svg +1 -0
  322. package/dist/public/avatars/avatar-03.svg +1 -0
  323. package/dist/public/avatars/avatar-04.svg +1 -0
  324. package/dist/public/avatars/avatar-05.svg +1 -0
  325. package/dist/public/avatars/avatar-06.svg +1 -0
  326. package/dist/public/avatars/avatar-07.svg +1 -0
  327. package/dist/public/avatars/avatar-08.svg +1 -0
  328. package/dist/public/avatars/avatar-09.svg +1 -0
  329. package/dist/public/avatars/avatar-10.svg +1 -0
  330. package/dist/public/avatars/avatar-11.svg +1 -0
  331. package/dist/public/avatars/avatar-12.svg +1 -0
  332. package/dist/public/monaco/vs/abap-D-t0cyap.js +1 -0
  333. package/dist/public/monaco/vs/apex-CcIm7xu6.js +1 -0
  334. package/dist/public/monaco/vs/assets/css.worker-URu8fCFR.js +97 -0
  335. package/dist/public/monaco/vs/assets/editor.worker-lj3bdIIn.js +30 -0
  336. package/dist/public/monaco/vs/assets/editorWebWorkerMain-CA_vMoUU.js +30 -0
  337. package/dist/public/monaco/vs/assets/html.worker-D1SL3iM8.js +474 -0
  338. package/dist/public/monaco/vs/assets/json.worker-CoJx_OPf.js +62 -0
  339. package/dist/public/monaco/vs/assets/ts.worker-BWKtMYOk.js +67722 -0
  340. package/dist/public/monaco/vs/azcli-BA0tQDCg.js +1 -0
  341. package/dist/public/monaco/vs/basic-languages/monaco.contribution.js +1 -0
  342. package/dist/public/monaco/vs/bat-C397hTD6.js +1 -0
  343. package/dist/public/monaco/vs/bicep-DF5aW17k.js +2 -0
  344. package/dist/public/monaco/vs/cameligo-plsz8qhj.js +1 -0
  345. package/dist/public/monaco/vs/clojure-Y2auQMzK.js +1 -0
  346. package/dist/public/monaco/vs/coffee-Bu45yuWE.js +1 -0
  347. package/dist/public/monaco/vs/cpp-CkKPQIni.js +1 -0
  348. package/dist/public/monaco/vs/csharp-CX28MZyh.js +1 -0
  349. package/dist/public/monaco/vs/csp-D8uWnyxW.js +1 -0
  350. package/dist/public/monaco/vs/css-CaeNmE3S.js +3 -0
  351. package/dist/public/monaco/vs/css.worker-CyhWkhHo.js +1 -0
  352. package/dist/public/monaco/vs/cssMode-CV6Ay48H.js +1 -0
  353. package/dist/public/monaco/vs/cypher-DVThT8BS.js +1 -0
  354. package/dist/public/monaco/vs/dart-CmGfCvrO.js +1 -0
  355. package/dist/public/monaco/vs/dockerfile-CZqqYdch.js +1 -0
  356. package/dist/public/monaco/vs/ecl-30fUercY.js +1 -0
  357. package/dist/public/monaco/vs/editor/editor.main.css +1 -0
  358. package/dist/public/monaco/vs/editor/editor.main.js +1 -0
  359. package/dist/public/monaco/vs/editor-KLE6jdfb.js +831 -0
  360. package/dist/public/monaco/vs/editor.js +1 -0
  361. package/dist/public/monaco/vs/editorWorkerHost-fVE1cjcC.js +35 -0
  362. package/dist/public/monaco/vs/elixir-xjPaIfzF.js +1 -0
  363. package/dist/public/monaco/vs/flow9-DqtmStfK.js +1 -0
  364. package/dist/public/monaco/vs/freemarker2-FWreY7v7.js +3 -0
  365. package/dist/public/monaco/vs/fsharp-BOMdg4U1.js +1 -0
  366. package/dist/public/monaco/vs/go-D_hbi-Jt.js +1 -0
  367. package/dist/public/monaco/vs/graphql-CKUU4kLG.js +1 -0
  368. package/dist/public/monaco/vs/handlebars-CZi4pHCH.js +1 -0
  369. package/dist/public/monaco/vs/hcl-DTaboeZW.js +1 -0
  370. package/dist/public/monaco/vs/html-j_7ZTNRU.js +1 -0
  371. package/dist/public/monaco/vs/html.worker-CA3iAimZ.js +1 -0
  372. package/dist/public/monaco/vs/htmlMode-27by_KM4.js +1 -0
  373. package/dist/public/monaco/vs/index-049xrXrp.js +1 -0
  374. package/dist/public/monaco/vs/index-CBVt3dzv.js +5 -0
  375. package/dist/public/monaco/vs/index.js +1 -0
  376. package/dist/public/monaco/vs/ini-CsNwO04R.js +1 -0
  377. package/dist/public/monaco/vs/initialize-DL0l1TGY.js +1 -0
  378. package/dist/public/monaco/vs/java-CI4ZMsH9.js +1 -0
  379. package/dist/public/monaco/vs/javascript-DTJl4Jn1.js +1 -0
  380. package/dist/public/monaco/vs/json.worker-BizpAl9O.js +1 -0
  381. package/dist/public/monaco/vs/jsonMode-DLUiMUrI.js +1 -0
  382. package/dist/public/monaco/vs/julia-BwzEvaQw.js +1 -0
  383. package/dist/public/monaco/vs/kotlin-IUYPiTV8.js +1 -0
  384. package/dist/public/monaco/vs/language/css/monaco.contribution.js +1 -0
  385. package/dist/public/monaco/vs/language/html/monaco.contribution.js +1 -0
  386. package/dist/public/monaco/vs/language/json/monaco.contribution.js +1 -0
  387. package/dist/public/monaco/vs/language/typescript/monaco.contribution.js +1 -0
  388. package/dist/public/monaco/vs/less-C0eDYdqa.js +2 -0
  389. package/dist/public/monaco/vs/lexon-iON-Kj97.js +1 -0
  390. package/dist/public/monaco/vs/liquid-CLJYelW6.js +1 -0
  391. package/dist/public/monaco/vs/loader.js +1368 -0
  392. package/dist/public/monaco/vs/lspLanguageFeatures-BIkJOWLw.js +2 -0
  393. package/dist/public/monaco/vs/lua-DtygF91M.js +1 -0
  394. package/dist/public/monaco/vs/m3-CsR4AuFi.js +1 -0
  395. package/dist/public/monaco/vs/main-BEx-Fmlo.js +15 -0
  396. package/dist/public/monaco/vs/main-DsK8pnKg.js +3 -0
  397. package/dist/public/monaco/vs/markdown-C_rD0bIw.js +1 -0
  398. package/dist/public/monaco/vs/mdx-CpzZIPHF.js +1 -0
  399. package/dist/public/monaco/vs/mips-CiYP61RB.js +1 -0
  400. package/dist/public/monaco/vs/monaco.contribution-9cKT3C7t.js +1 -0
  401. package/dist/public/monaco/vs/monaco.contribution-BE88ZNGY.js +1 -0
  402. package/dist/public/monaco/vs/monaco.contribution-BPhsneLd.js +1 -0
  403. package/dist/public/monaco/vs/monaco.contribution-BgRy6xDf.js +1 -0
  404. package/dist/public/monaco/vs/msdax-C38-sJlp.js +1 -0
  405. package/dist/public/monaco/vs/mysql-CdtbpvbG.js +1 -0
  406. package/dist/public/monaco/vs/nls/lang/cs.d.ts +1 -0
  407. package/dist/public/monaco/vs/nls/lang/cs.js +9 -0
  408. package/dist/public/monaco/vs/nls/lang/de.d.ts +1 -0
  409. package/dist/public/monaco/vs/nls/lang/de.js +9 -0
  410. package/dist/public/monaco/vs/nls/lang/es.d.ts +1 -0
  411. package/dist/public/monaco/vs/nls/lang/es.js +9 -0
  412. package/dist/public/monaco/vs/nls/lang/fr.d.ts +1 -0
  413. package/dist/public/monaco/vs/nls/lang/fr.js +9 -0
  414. package/dist/public/monaco/vs/nls/lang/it.d.ts +1 -0
  415. package/dist/public/monaco/vs/nls/lang/it.js +9 -0
  416. package/dist/public/monaco/vs/nls/lang/ja.d.ts +1 -0
  417. package/dist/public/monaco/vs/nls/lang/ja.js +9 -0
  418. package/dist/public/monaco/vs/nls/lang/ko.d.ts +1 -0
  419. package/dist/public/monaco/vs/nls/lang/ko.js +9 -0
  420. package/dist/public/monaco/vs/nls/lang/pl.d.ts +1 -0
  421. package/dist/public/monaco/vs/nls/lang/pl.js +9 -0
  422. package/dist/public/monaco/vs/nls/lang/pt-br.d.ts +1 -0
  423. package/dist/public/monaco/vs/nls/lang/pt-br.js +9 -0
  424. package/dist/public/monaco/vs/nls/lang/ru.d.ts +1 -0
  425. package/dist/public/monaco/vs/nls/lang/ru.js +9 -0
  426. package/dist/public/monaco/vs/nls/lang/tr.d.ts +1 -0
  427. package/dist/public/monaco/vs/nls/lang/tr.js +9 -0
  428. package/dist/public/monaco/vs/nls/lang/zh-cn.d.ts +1 -0
  429. package/dist/public/monaco/vs/nls/lang/zh-cn.js +9 -0
  430. package/dist/public/monaco/vs/nls/lang/zh-tw.d.ts +1 -0
  431. package/dist/public/monaco/vs/nls/lang/zh-tw.js +9 -0
  432. package/dist/public/monaco/vs/nls.messages-loader.js +1 -0
  433. package/dist/public/monaco/vs/objective-c-CntZFaHX.js +1 -0
  434. package/dist/public/monaco/vs/pascal-r6kuqfl_.js +1 -0
  435. package/dist/public/monaco/vs/pascaligo-BiXoTmXh.js +1 -0
  436. package/dist/public/monaco/vs/perl-DABw_TcH.js +1 -0
  437. package/dist/public/monaco/vs/pgsql-me_jFXeX.js +1 -0
  438. package/dist/public/monaco/vs/php-D_kh-9LK.js +1 -0
  439. package/dist/public/monaco/vs/pla-VfZjczW0.js +1 -0
  440. package/dist/public/monaco/vs/postiats-BBSzz8Pk.js +1 -0
  441. package/dist/public/monaco/vs/powerquery-Dt-g_2cc.js +1 -0
  442. package/dist/public/monaco/vs/powershell-B-7ap1zc.js +1 -0
  443. package/dist/public/monaco/vs/protobuf-BmtuEB1A.js +2 -0
  444. package/dist/public/monaco/vs/pug-BRpRNeEb.js +1 -0
  445. package/dist/public/monaco/vs/python-CqWUUgfu.js +1 -0
  446. package/dist/public/monaco/vs/qsharp-BzsFaUU9.js +1 -0
  447. package/dist/public/monaco/vs/r-f8dDdrp4.js +1 -0
  448. package/dist/public/monaco/vs/razor-hok5y9Km.js +1 -0
  449. package/dist/public/monaco/vs/redis-fvZQY4PI.js +1 -0
  450. package/dist/public/monaco/vs/redshift-45Et0LQi.js +1 -0
  451. package/dist/public/monaco/vs/restructuredtext-C7UUFKFD.js +1 -0
  452. package/dist/public/monaco/vs/ruby-CZO8zYTz.js +1 -0
  453. package/dist/public/monaco/vs/rust-Bfetafyc.js +1 -0
  454. package/dist/public/monaco/vs/sb-3GYllVck.js +1 -0
  455. package/dist/public/monaco/vs/scala-foMgrKo1.js +1 -0
  456. package/dist/public/monaco/vs/scheme-CHdMtr7p.js +1 -0
  457. package/dist/public/monaco/vs/scss-C1cmLt9V.js +3 -0
  458. package/dist/public/monaco/vs/shell-ClXCKCEW.js +1 -0
  459. package/dist/public/monaco/vs/solidity-MZ6ExpPy.js +1 -0
  460. package/dist/public/monaco/vs/sophia-DWkuSsPQ.js +1 -0
  461. package/dist/public/monaco/vs/sparql-AUGFYSyk.js +1 -0
  462. package/dist/public/monaco/vs/sql-32GpJSV2.js +1 -0
  463. package/dist/public/monaco/vs/st-CuDFIVZ_.js +1 -0
  464. package/dist/public/monaco/vs/swift-t-PfMj7W.js +1 -0
  465. package/dist/public/monaco/vs/systemverilog-Ch4vA8Yt.js +1 -0
  466. package/dist/public/monaco/vs/tcl-D74tq1nH.js +1 -0
  467. package/dist/public/monaco/vs/toggleHighContrast-qGX7E9o7.js +61 -0
  468. package/dist/public/monaco/vs/ts.worker-2QLmBukE.js +1 -0
  469. package/dist/public/monaco/vs/tsMode-B0S_kp2q.js +11 -0
  470. package/dist/public/monaco/vs/twig-C6taOxMV.js +1 -0
  471. package/dist/public/monaco/vs/typescript-_2t_511t.js +1 -0
  472. package/dist/public/monaco/vs/typespec-8OfoLt6R.js +1 -0
  473. package/dist/public/monaco/vs/vb-Dyb2648j.js +1 -0
  474. package/dist/public/monaco/vs/wgsl-BhLXMOR0.js +298 -0
  475. package/dist/public/monaco/vs/workers-BBttULjf.js +1 -0
  476. package/dist/public/monaco/vs/xml-cZjNDqDT.js +1 -0
  477. package/dist/public/monaco/vs/yaml-A1fOIdH6.js +1 -0
  478. package/dist/src-LbWcrSWe.js +3 -0
  479. package/dist/styles.css +2 -0
  480. package/dist/styles.d.ts +1 -0
  481. package/dist/types.d.ts +1 -0
  482. package/package.json +113 -4
@@ -0,0 +1,5 @@
1
+ import{n as e}from"./rolldown-runtime-BKuNeK48.js";import{$ as t,A as n,B as r,C as i,D as a,F as o,I as s,K as c,L as l,M as u,N as d,O as f,Q as p,R as m,S as h,T as g,V as _,Y as v,Z as y,_ as b,a as x,c as S,d as C,f as w,g as T,h as E,i as D,j as O,l as k,o as A,p as j,q as ee,r as te,s as M,t as N,u as P,v as ne,w as F,x as re,y as ie,z as ae}from"./dist-CWj_XYki.js";import{a as oe,i as se,r as ce,t as le}from"./browser-BKLM0ThC-mnGPrtB_.js";async function ue(e){let t={pdfium:e};for(let n in pe){let r=n,i=pe[r][0],a=pe[r][1];t[r]=e.cwrap(n,a,i)}return t}async function de(e){return ue(await fe(e))}var fe,pe;function me(){return(me=e((()=>{fe=(()=>{var e=import.meta.url;return(async function(t={}){var n,r=t,i,a,o=new Promise((e,t)=>{i=e,a=t});(/* @__PURE__ */ `_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(o,e)||Object.defineProperty(o,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 s=typeof window==`object`,c=typeof importScripts==`function`;typeof process==`object`&&typeof process.versions==`object`&&typeof process.versions.node==`string`&&process.type;var l=!s&&!c,u,d=Object.assign({},r),f=`./this.program`,p=``;function m(e){return r.locateFile?r.locateFile(e,p):p+e}var h,g;if(l){if(typeof process==`object`&&typeof u==`function`||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?)`);g=e=>{if(typeof readbuffer==`function`)return new Uint8Array(readbuffer(e));let t=read(e,`binary`);return S(typeof t==`object`),t},h=e=>new Promise((t,n)=>{setTimeout(()=>t(g(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(s||c){if(c?p=self.location.href:typeof document<`u`&&document.currentScript&&(p=document.currentScript.src),e&&(p=e),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?)`);c&&(g=e=>{var t=new XMLHttpRequest;return t.open(`GET`,e,!1),t.responseType=`arraybuffer`,t.send(null),new Uint8Array(t.response)}),h=e=>(S(!_e(e),`readAsync does not work with file:// URLs`),fetch(e,{credentials:`same-origin`}).then(e=>e.ok?e.arrayBuffer():Promise.reject(/* @__PURE__ */ Error(e.status+` : `+e.url))))}else throw Error(`environment detection error`);var _=r.print||console.log.bind(console),v=r.printErr||console.error.bind(console);Object.assign(r,d),d=null,gn(),r.arguments&&r.arguments,V(`arguments`,`arguments_`),r.thisProgram&&(f=r.thisProgram),V(`thisProgram`,`thisProgram`),S(r.memoryInitializerPrefixURL===void 0,`Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead`),S(r.pthreadMainPrefixURL===void 0,`Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead`),S(r.cdInitializerPrefixURL===void 0,`Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead`),S(r.filePackagePrefixURL===void 0,`Module.filePackagePrefixURL option was removed, use Module.locateFile instead`),S(r.read===void 0,`Module.read option was removed`),S(r.readAsync===void 0,`Module.readAsync option was removed (modify readAsync in JS)`),S(r.readBinary===void 0,`Module.readBinary option was removed (modify readBinary in JS)`),S(r.setWindowTitle===void 0,`Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)`),S(r.TOTAL_MEMORY===void 0,`Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY`),V(`asm`,`wasmExports`),V(`readAsync`,`readAsync`),V(`readBinary`,`readBinary`),V(`setWindowTitle`,`setWindowTitle`);var y=r.wasmBinary;V(`wasmBinary`,`wasmBinary`),typeof WebAssembly!=`object`&&v(`no native wasm support detected`);var b,x=!1;function S(e,t){e||I(`Assertion failed`+(t?`: `+t:``))}var C,w,T,E,D,O,k,A;function j(){var e=b.buffer;r.HEAP8=C=new Int8Array(e),r.HEAP16=T=new Int16Array(e),r.HEAPU8=w=new Uint8Array(e),r.HEAPU16=E=new Uint16Array(e),r.HEAP32=D=new Int32Array(e),r.HEAPU32=O=new Uint32Array(e),r.HEAPF32=k=new Float32Array(e),r.HEAPF64=A=new Float64Array(e)}S(!r.STACK_SIZE,`STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time`),S(typeof Int32Array<`u`&&typeof Float64Array<`u`&&Int32Array.prototype.subarray!=null&&Int32Array.prototype.set!=null,`JS engine does not provide full typed array support`),S(!r.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),S(!r.INITIAL_MEMORY,`Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically`);function ee(){var e=Sn();S(!(e&3)),e==0&&(e+=4),O[e>>2]=34821223,O[e+4>>2]=2310721022,O[0]=1668509029}function te(){if(!x){var e=Sn();e==0&&(e+=4);var t=O[e>>2],n=O[e+4>>2];(t!=34821223||n!=2310721022)&&I(`Stack overflow! Stack cookie has been overwritten at ${Ne(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${Ne(n)} ${Ne(t)}`),O[0]!=1668509029&&I(`Runtime error: The application has corrupted its heap memory area (address zero)!`)}}var M=[],N=[],P=[],ne=!1;function F(){var e=r.preRun;e&&(typeof e==`function`&&(e=[e]),e.forEach(ae)),je(M)}function re(){S(!ne),ne=!0,te(),!r.noFSInit&&!Y.initialized&&Y.init(),Y.ignorePermissions=!1,je(N)}function ie(){te();var e=r.postRun;e&&(typeof e==`function`&&(e=[e]),e.forEach(se)),je(P)}function ae(e){M.unshift(e)}function oe(e){N.unshift(e)}function se(e){P.unshift(e)}S(Math.imul,`This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill`),S(Math.fround,`This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill`),S(Math.clz32,`This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill`),S(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 ce=0,le=null,ue=null,de={};function fe(e){for(var t=e;;){if(!de[e])return e;e=t+Math.random()}}function pe(e){ce++,r.monitorRunDependencies?.(ce),e?(S(!de[e]),de[e]=1,le===null&&typeof setInterval<`u`&&(le=setInterval(()=>{if(x)clearInterval(le),le=null;else{var e=!1;for(var t in de)e||(e=!0,v(`still waiting on run dependencies:`)),v(`dependency: ${t}`);e&&v(`(end of list)`)}},1e4))):v(`warning: run dependency added without ID`)}function me(e){if(ce--,r.monitorRunDependencies?.(ce),e?(S(de[e]),delete de[e]):v(`warning: run dependency removed without ID`),ce==0&&(le!==null&&(clearInterval(le),le=null),ue)){var t=ue;ue=null,t()}}function I(e){r.onAbort?.(e),e=`Aborted(`+e+`)`,v(e),x=!0;var t=new WebAssembly.RuntimeError(e);throw a(t),t}var he=`data:application/octet-stream;base64,`,ge=e=>e.startsWith(he),_e=e=>e.startsWith(`file://`);function L(e,t){return(...n)=>{S(ne,`native function \`${e}\` called before runtime initialization`);var r=Q[e];return S(r,`exported native function \`${e}\` not found`),S(n.length<=t,`native function \`${e}\` called with ${n.length} args but expects ${t}`),r(...n)}}function ve(){if(r.locateFile){var e=`pdfium.wasm`;return ge(e)?e:m(e)}return l?`pdfium.wasm`:new URL(new URL(`../assets/pdfium-BJ2Yip8Q.wasm`,import.meta.url).href,``+import.meta.url).href}var R;function ye(e){if(e==R&&y)return new Uint8Array(y);if(g)return g(e);throw`both async and sync fetching of the wasm failed`}function be(e){return y?Promise.resolve().then(()=>ye(e)):h(e).then(e=>new Uint8Array(e),()=>ye(e))}function xe(e,t,n){return be(e).then(e=>WebAssembly.instantiate(e,t)).then(n,e=>{v(`failed to asynchronously prepare wasm: ${e}`),_e(R)&&v(`warning: Loading from a file URI (${R}) 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)})}function Se(e,t,n,r){return!e&&typeof WebAssembly.instantiateStreaming==`function`&&!ge(t)&&typeof fetch==`function`?fetch(t,{credentials:`same-origin`}).then(e=>WebAssembly.instantiateStreaming(e,n).then(r,function(e){return v(`wasm streaming compile failed: ${e}`),v(`falling back to ArrayBuffer instantiation`),xe(t,n,r)})):xe(t,n,r)}function Ce(){return{env:_n,wasi_snapshot_preview1:_n}}function we(){var e=Ce();function t(e,t){return Q=e.exports,r.wasmExports=Q,b=Q.memory,S(b,`memory not found in wasm exports`),j(),qt=Q.__indirect_function_table,S(qt,`table not found in wasm exports`),oe(Q.__wasm_call_ctors),me(`wasm-instantiate`),Q}pe(`wasm-instantiate`);var n=r;function i(e){S(r===n,`the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?`),n=null,t(e.instance)}if(r.instantiateWasm)try{return r.instantiateWasm(e,t)}catch(e){v(`Module.instantiateWasm callback failed with error: ${e}`),a(e)}return R??=ve(),Se(y,R,e,i).catch(a),{}}var z,B;if((()=>{var e=/* @__PURE__ */ 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)`})(),r.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 V(e,t,n=!0){Object.getOwnPropertyDescriptor(r,e)||Object.defineProperty(r,e,{configurable:!0,get(){let r=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)`:``;I(`\`Module.${e}\` has been replaced by \`${t}\``+r)}})}function Te(e){Object.getOwnPropertyDescriptor(r,e)&&I(`\`Module.${e}\` was supplied but \`${e}\` not included in INCOMING_MODULE_JS_API`)}function Ee(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 De(e,t){typeof globalThis<`u`&&!Object.getOwnPropertyDescriptor(globalThis,e)&&Object.defineProperty(globalThis,e,{configurable:!0,get(){t()}})}function Oe(e,t){De(e,()=>{W(`\`${e}\` is not longer defined by emscripten. ${t}`)})}Oe(`buffer`,`Please use HEAP8.buffer or wasmMemory.buffer`),Oe(`asm`,`Please use wasmExports instead`);function ke(e){De(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}')`,Ee(e)&&(t+=`. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you`),W(t)}),Ae(e)}function Ae(e){Object.getOwnPropertyDescriptor(r,e)||Object.defineProperty(r,e,{configurable:!0,get(){var t=`'${e}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;Ee(e)&&(t+=`. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you`),I(t)}})}var je=e=>{e.forEach(e=>e(r))};function Me(e,t=`i8`){switch(t.endsWith(`*`)&&(t=`*`),t){case`i1`:return C[e];case`i8`:return C[e];case`i16`:return T[e>>1];case`i32`:return D[e>>2];case`i64`:I(`to do getValue(i64) use WASM_BIGINT`);case`float`:return k[e>>2];case`double`:return A[e>>3];case`*`:return O[e>>2];default:I(`invalid type for getValue: ${t}`)}}r.noExitRuntime;var Ne=e=>(S(typeof e==`number`),e>>>=0,`0x`+e.toString(16).padStart(8,`0`));function Pe(e,t,n=`i8`){switch(n.endsWith(`*`)&&(n=`*`),n){case`i1`:C[e]=t;break;case`i8`:C[e]=t;break;case`i16`:T[e>>1]=t;break;case`i32`:D[e>>2]=t;break;case`i64`:I(`to do setValue(i64) use WASM_BIGINT`);case`float`:k[e>>2]=t;break;case`double`:A[e>>3]=t;break;case`*`:O[e>>2]=t;break;default:I(`invalid type for setValue: ${n}`)}}var H=e=>Cn(e),U=()=>Tn(),W=e=>{W.shown||={},W.shown[e]||(W.shown[e]=1,v(e))},G=typeof TextDecoder<`u`?new TextDecoder:void 0,K=(e,t=0,n=NaN)=>{for(var r=t+n,i=t;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&G)return G.decode(e.subarray(t,i));for(var a=``;t<i;){var o=e[t++];if(!(o&128))a+=String.fromCharCode(o);else{var s=e[t++]&63;if((o&224)==192)a+=String.fromCharCode((o&31)<<6|s);else{var c=e[t++]&63;if((o&240)==224?o=(o&15)<<12|s<<6|c:((o&248)!=240&&W(`Invalid UTF-8 leading byte `+Ne(o)+` encountered when deserializing a UTF-8 string in wasm memory to a JS string!`),o=(o&7)<<18|s<<12|c<<6|e[t++]&63),o<65536)a+=String.fromCharCode(o);else{var l=o-65536;a+=String.fromCharCode(55296|l>>10,56320|l&1023)}}}}return a},Fe=(e,t)=>(S(typeof e==`number`,`UTF8ToString expects a number (got ${typeof e})`),e?K(w,e,t):``),Ie=(e,t,n,r)=>{I(`Assertion failed: ${Fe(e)}, at: `+[t?Fe(t):`unknown filename`,n,r?Fe(r):`unknown function`])};function Le(){S(X.varargs!=null);var e=D[X.varargs>>2];return X.varargs+=4,e}var Re=Le,q={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=q.isAbs(e),n=e.substr(-1)===`/`;return e=q.normalizeArray(e.split(`/`).filter(e=>!!e),!t).join(`/`),!e&&!t&&(e=`.`),e&&n&&(e+=`/`),(t?`/`:``)+e},dirname:e=>{var t=q.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`/`;e=q.normalize(e),e=e.replace(/\/$/,``);var t=e.lastIndexOf(`/`);return t===-1?e:e.substr(t+1)},join:(...e)=>q.normalize(e.join(`/`)),join2:(e,t)=>q.normalize(e+`/`+t)},ze=()=>{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 } };`)},Be=e=>(Be=ze())(e),Ve={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=q.isAbs(i)}return t=q.normalizeArray(t.split(`/`).filter(e=>!!e),!n).join(`/`),(n?`/`:``)+t||`.`},relative:(e,t)=>{e=Ve.resolve(e).substr(1),t=Ve.resolve(t).substr(1);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)}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}for(var c=[],s=o;s<r.length;s++)c.push(`..`);return c=c.concat(i.slice(o)),c.join(`/`)}},He=[],Ue=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},We=(e,t,n,r)=>{if(S(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){var c=e.charCodeAt(++o);s=65536+((s&1023)<<10)|c&1023}if(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|s&63}else if(s<=65535){if(n+2>=a)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|s&63}else{if(n+3>=a)break;s>1114111&&W(`Invalid Unicode code point `+Ne(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|s&63}}return t[n]=0,n-i};function Ge(e,t,n){var r=Ue(e)+1,i=Array(r);return i.length=We(e,i,0,i.length),i}var Ke=()=>{if(!He.length){var e=null;if(typeof window<`u`&&typeof window.prompt==`function`?(e=window.prompt(`Input: `),e!==null&&(e+=`
2
+ `)):typeof readline==`function`&&(e=readline(),e&&(e+=`
3
+ `)),!e)return null;He=Ge(e)}return He.shift()},qe={ttys:[],init(){},shutdown(){},register(e,t){qe.ttys[e]={input:[],output:[],ops:t},Y.registerDevice(e,qe.stream_ops)},stream_ops:{open(e){var t=qe.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){return Ke()},put_char(e,t){t===null||t===10?(_(K(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(_(K(e.output)),e.output=[])},ioctl_tcgets(e){return{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){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,t){t===null||t===10?(v(K(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(v(K(e.output)),e.output=[])}}},Je=(e,t)=>{w.fill(0,e,e+t)},Ye=(e,t)=>(S(t,`alignment argument is required`),Math.ceil(e/t)*t),Xe=e=>{e=Ye(e,65536);var t=bn(65536,e);return t&&Je(t,e),t},J={ops_table:null,mount(e){return 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){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):/* @__PURE__ */ 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){return 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(S(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(S(!(t instanceof ArrayBuffer)),t.buffer===C.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 S(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(!(i&2)&&s&&s.buffer===C.buffer)o=!1,a=s.byteOffset;else{if(o=!0,a=Xe(t),!a)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)),C.set(s,a))}return{ptr:a,allocated:o}},msync(e,t,n,r,i){return J.stream_ops.write(e,t,0,r,n,!1),0}}},Ze=(e,t,n,r)=>{var i=fe(`al ${e}`);h(e).then(n=>{S(n,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(n)),i&&me(i)},t=>{if(n)n();else throw`Loading data file "${e}" failed.`}),i&&pe(i)},Qe=(e,t,n,r,i,a)=>{Y.createDataFile(e,t,n,r,i,a)},$e=r.preloadPlugins||[],et=(e,t,n,r)=>{typeof Browser<`u`&&Browser.init();var i=!1;return $e.forEach(a=>{i||a.canHandle(t)&&(a.handle(e,t,n,r),i=!0)}),i},tt=(e,t,n,r,i,a,o,s,c,l)=>{var u=t?Ve.resolve(q.join2(e,t)):e,d=fe(`cp ${u}`);function f(n){function f(n){l?.(),s||Qe(e,t,n,r,i,c),a?.(),me(d)}et(n,u,f,()=>{o?.(),me(d)})||f(n)}pe(d),typeof n==`string`?Ze(n,f,o):f(n)},nt=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},rt=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},it=e=>Fe(vn(e)),at={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(ne?it(e):``),this.name=`ErrnoError`,this.errno=e,at)if(at[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(this.flags&2097155)!=1}get isWrite(){return!!(this.flags&2097155)}get isAppend(){return this.flags&1024}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=Ve.resolve(e),!e)return{path:``,node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),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=q.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=Ve.resolve(q.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){S(typeof e==`object`);var i=new Y.FSNode(e,t,n,r);return Y.hashAddNode(i),i},destroyNode(e){Y.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)==32768},isDir(e){return(e&61440)==16384},isLink(e){return(e&61440)==40960},isChrdev(e){return(e&61440)==8192},isBlkdev(e){return(e&61440)==24576},isFIFO(e){return(e&61440)==4096},isSocket(e){return(e&49152)==49152},flagsToPermissionString(e){var t=[`r`,`w`,`rw`][e&3];return e&512&&(t+=`w`),t},nodePermissions(e,t){return Y.ignorePermissions?0:t.includes(`r`)&&!(e.mode&292)||t.includes(`w`)&&!(e.mode&146)||t.includes(`x`)&&!(e.mode&73)?2:0},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){return e?Y.isLink(e.mode)?32:Y.isDir(e.mode)&&(Y.flagsToPermissionString(t)!==`r`||t&512)?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){return S(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=>e&255,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&&v(`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 S(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=n===`/`,i=!n,a;if(r&&Y.root)throw new Y.ErrnoError(10);if(!r&&!i){var o=Y.lookupPath(n,{follow_mount:!1});if(n=o.path,a=o.node,Y.isMountpoint(a))throw new Y.ErrnoError(10);if(!Y.isDir(a.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,r?Y.root=c:a&&(a.mounted=s,a.mount&&a.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);S(a!==-1),n.mount.mounts.splice(a,1)},lookup(e,t){return e.node_ops.lookup(e,t)},mknod(e,t,n){var r=Y.lookupPath(e,{parent:!0}).node,i=q.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){return t=t===void 0?438:t,t&=4095,t|=32768,Y.mknod(e,t,0)},mkdir(e,t){return 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){return n===void 0&&(n=t,t=438),t|=8192,Y.mknod(e,t,n)},symlink(e,t){if(!Ve.resolve(e))throw new Y.ErrnoError(44);var n=Y.lookupPath(t,{parent:!0}).node;if(!n)throw new Y.ErrnoError(44);var r=q.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=q.dirname(e),r=q.dirname(t),i=q.basename(e),a=q.basename(t),o=Y.lookupPath(e,{parent:!0}),s=o.node,c;if(o=Y.lookupPath(t,{parent:!0}),c=o.node,!s||!c)throw new Y.ErrnoError(44);if(s.mount!==c.mount)throw new Y.ErrnoError(75);var l=Y.lookupNode(s,i),u=Ve.relative(e,r);if(u.charAt(0)!==`.`)throw new Y.ErrnoError(28);if(u=Ve.relative(t,n),u.charAt(0)!==`.`)throw new Y.ErrnoError(55);var d;try{d=Y.lookupNode(c,a)}catch{}if(l!==d){var f=Y.isDir(l.mode),p=Y.mayDelete(s,i,f);if(p||(p=d?Y.mayDelete(c,a,f):Y.mayCreate(c,a),p))throw new Y.ErrnoError(p);if(!s.node_ops.rename)throw new Y.ErrnoError(63);if(Y.isMountpoint(l)||d&&Y.isMountpoint(d))throw new Y.ErrnoError(10);if(c!==s&&(p=Y.nodePermissions(s,`w`),p))throw new Y.ErrnoError(p);Y.hashRemoveNode(l);try{s.node_ops.rename(l,c,a),l.parent=c}catch(e){throw e}finally{Y.hashAddNode(l)}}},rmdir(e){var t=Y.lookupPath(e,{parent:!0}).node,n=q.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=q.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 Ve.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){return Y.stat(e,!0)},chmod(e,t,n){var r=typeof e==`string`?Y.lookupPath(e,{follow:!n}).node:e;if(!r.node_ops.setattr)throw new Y.ErrnoError(63);r.node_ops.setattr(r,{mode:t&4095|r.mode&-4096,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=typeof e==`string`?Y.lookupPath(e,{follow:!r}).node:e;if(!i.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=typeof e==`string`?Y.lookupPath(e,{follow:!0}).node:e;if(!n.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(!(n.flags&2097155))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);t=typeof t==`string`?nt(t):t,t&64?(n=n===void 0?438:n,n=n&4095|32768):n=0;var i;if(typeof e==`object`)i=e;else{e=q.normalize(e);try{i=Y.lookupPath(e,{follow:!(t&131072)}).node}catch{}}var a=!1;if(t&64){if(i){if(t&128)throw new Y.ErrnoError(20)}else i=Y.mknod(e,n,0),a=!0}if(!i)throw new Y.ErrnoError(44);if(Y.isChrdev(i.mode)&&(t&=-513),t&65536&&!Y.isDir(i.mode))throw new Y.ErrnoError(54);if(!a){var o=Y.mayOpen(i,t);if(o)throw new Y.ErrnoError(o)}t&512&&!a&&Y.truncate(i,0),t&=-131713;var s=Y.createStream({node:i,path:Y.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),r.logReadFiles&&!(t&1)&&(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){return 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(S(n>=0),r<0||i<0)throw new Y.ErrnoError(28);if(Y.isClosed(e)||(e.flags&2097155)==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)i=e.position;else if(!e.seekable)throw new Y.ErrnoError(70);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(S(n>=0),r<0||i<0)throw new Y.ErrnoError(28);if(Y.isClosed(e)||!(e.flags&2097155))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&&e.flags&1024&&Y.llseek(e,0,2);var o=i!==void 0;if(!o)i=e.position;else if(!e.seekable)throw new Y.ErrnoError(70);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(!(e.flags&2097155))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(r&2&&!(i&2)&&(e.flags&2097155)!=2||(e.flags&2097155)==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){return S(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=K(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(Ue(t)+1),a=We(t,i,0,i.length);Y.write(r,i,0,a,void 0,n.canOwn)}else if(ArrayBuffer.isView(t))Y.write(r,t,0,t.byteLength,void 0,n.canOwn);else throw Error(`Unsupported data type`);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)),qe.register(Y.makedev(5,0),qe.default_tty_ops),qe.register(Y.makedev(6,0),qe.default_tty1_ops),Y.mkdev(`/dev/tty`,Y.makedev(5,0)),Y.mkdev(`/dev/tty1`,Y.makedev(6,0));var e=/* @__PURE__ */ new Uint8Array(1024),t=0,n=()=>(t===0&&(t=Be(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);S(r.fd===0,`invalid handle for stdin (${r.fd})`),S(i.fd===1,`invalid handle for stdout (${i.fd})`),S(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){S(!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??=r.stdin,t??=r.stdout,n??=r.stderr,Y.createStandardStreams(e,t,n)},quit(){Y.initialized=!1,yn(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{var n=Y.lookupPath(e,{follow:!t});e=n.path}catch{}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=Y.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=q.basename(e),n=Y.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot=n.path===`/`}catch(e){r.error=e.errno}return r},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=q.join2(e,a);try{Y.mkdir(o)}catch{}e=o}}return o},createFile(e,t,n,r,i){var a=q.join2(typeof e==`string`?e:Y.getPath(e),t),o=rt(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?q.join2(e,t):e);var s=rt(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,s|146);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=q.join2(typeof e==`string`?e:Y.getPath(e),t),a=rt(!!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=g(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=Number(e.getResponseHeader(`Content-length`)),r,i=(r=e.getResponseHeader(`Accept-Ranges`))&&r===`bytes`,a=(r=e.getResponseHeader(`Content-Encoding`))&&r===`gzip`,o=1048576;i||(o=t);var s=(e,r)=>{if(e>r)throw Error(`invalid range (`+e+`, `+r+`) or no bytes requested!`);if(r>t-1)throw Error(`only `+t+` bytes available! programmer error!`);var i=new XMLHttpRequest;if(i.open(`GET`,n,!1),t!==o&&i.setRequestHeader(`Range`,`bytes=`+e+`-`+r),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?Ge(i.responseText||``):new Uint8Array(i.response||[])},c=this;c.setDataGetter(e=>{var n=e*o,r=(e+1)*o-1;if(r=Math.min(r,t-1),c.chunks[e]===void 0&&(c.chunks[e]=s(n,r)),c.chunks[e]===void 0)throw Error(`doXHR failed!`);return c.chunks[e]}),(a||!t)&&(o=t=1,t=this.getter(0).length,o=t,_(`LazyFiles on gzip forces download of the whole file when length is accessed`)),this._length=t,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(!c)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 var o={isDevice:!1,url:n};var s=Y.createFile(e,t,o,r,i);o.contents?s.contents=o.contents:o.url&&(s.contents=null,s.url=o.url),Object.defineProperties(s,{usedBytes:{get:function(){return this.contents.length}}});var l={};Object.keys(s.stream_ops).forEach(e=>{var t=s.stream_ops[e];l[e]=(...e)=>(Y.forceLoadFile(s),t(...e))});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(S(o>=0),a.slice)for(var s=0;s<o;s++)t[n+s]=a[i+s];else for(var s=0;s<o;s++)t[n+s]=a.get(i+s);return o}return l.read=(e,t,n,r,i)=>(Y.forceLoadFile(s),u(e,t,n,r,i)),l.mmap=(e,t,n,r,i)=>{Y.forceLoadFile(s);var a=Xe(t);if(!a)throw new Y.ErrnoError(48);return u(e,C,a,t,n),{ptr:a,allocated:!0}},s.stream_ops=l,s},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(q.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 q.join2(r,t)},doStat(e,t,n){var r=e(t);D[n>>2]=r.dev,D[n+4>>2]=r.mode,O[n+8>>2]=r.nlink,D[n+12>>2]=r.uid,D[n+16>>2]=r.gid,D[n+20>>2]=r.rdev,B=[r.size>>>0,(z=r.size,+Math.abs(z)>=1?z>0?Math.floor(z/4294967296)>>>0:~~+Math.ceil((z-+(~~z>>>0))/4294967296)>>>0:0)],D[n+24>>2]=B[0],D[n+28>>2]=B[1],D[n+32>>2]=4096,D[n+36>>2]=r.blocks;var i=r.atime.getTime(),a=r.mtime.getTime(),o=r.ctime.getTime();return B=[Math.floor(i/1e3)>>>0,(z=Math.floor(i/1e3),+Math.abs(z)>=1?z>0?Math.floor(z/4294967296)>>>0:~~+Math.ceil((z-+(~~z>>>0))/4294967296)>>>0:0)],D[n+40>>2]=B[0],D[n+44>>2]=B[1],O[n+48>>2]=i%1e3*1e3*1e3,B=[Math.floor(a/1e3)>>>0,(z=Math.floor(a/1e3),+Math.abs(z)>=1?z>0?Math.floor(z/4294967296)>>>0:~~+Math.ceil((z-+(~~z>>>0))/4294967296)>>>0:0)],D[n+56>>2]=B[0],D[n+60>>2]=B[1],O[n+64>>2]=a%1e3*1e3*1e3,B=[Math.floor(o/1e3)>>>0,(z=Math.floor(o/1e3),+Math.abs(z)>=1?z>0?Math.floor(z/4294967296)>>>0:~~+Math.ceil((z-+(~~z>>>0))/4294967296)>>>0:0)],D[n+72>>2]=B[0],D[n+76>>2]=B[1],O[n+80>>2]=o%1e3*1e3*1e3,B=[r.ino>>>0,(z=r.ino,+Math.abs(z)>=1?z>0?Math.floor(z/4294967296)>>>0:~~+Math.ceil((z-+(~~z>>>0))/4294967296)>>>0:0)],D[n+88>>2]=B[0],D[n+92>>2]=B[1],0},doMsync(e,t,n,r,i){if(!Y.isFile(t.node.mode))throw new Y.ErrnoError(43);if(r&2)return 0;var a=w.slice(e,e+n);Y.msync(t,a,i,n,r)},getStreamFromFD(e){return Y.getStreamChecked(e)},varargs:void 0,getStr(e){return Fe(e)}};function ot(e,t,n){X.varargs=n;try{var r=X.getStreamFromFD(e);switch(t){case 0:var i=Le();if(i<0)return-28;for(;Y.streams[i];)i++;return Y.dupStream(r,i).fd;case 1:case 2:return 0;case 3:return r.flags;case 4:var i=Le();return r.flags|=i,0;case 12:var i=Re(),a=0;return T[i+a>>1]=2,0;case 13:case 14:return 0}return-28}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function st(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}}var ct=(e,t)=>(S(e==e>>>0||e==(e|0)),S(t===(t|0)),t+2097152>>>0<4194305-!!e?(e>>>0)+t*4294967296:NaN);function lt(e,t,n){var r=ct(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}}var ut=(e,t,n)=>(S(typeof n==`number`,`stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!`),We(e,w,t,n));function dt(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}S(c),B=[c>>>0,(z=c,+Math.abs(z)>=1?z>0?Math.floor(z/4294967296)>>>0:~~+Math.ceil((z-+(~~z>>>0))/4294967296)>>>0:0)],D[t+a>>2]=B[0],D[t+a+4>>2]=B[1],B=[(s+1)*i>>>0,(z=(s+1)*i,+Math.abs(z)>=1?z>0?Math.floor(z/4294967296)>>>0:~~+Math.ceil((z-+(~~z>>>0))/4294967296)>>>0:0)],D[t+a+8>>2]=B[0],D[t+a+12>>2]=B[1],T[t+a+16>>1]=280,C[t+a+18]=l,ut(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}}function ft(e,t,n){X.varargs=n;try{var r=X.getStreamFromFD(e);switch(t){case 21509: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=Re();D[a>>2]=i.c_iflag||0,D[a+4>>2]=i.c_oflag||0,D[a+8>>2]=i.c_cflag||0,D[a+12>>2]=i.c_lflag||0;for(var o=0;o<32;o++)C[a+o+17]=i.c_cc[o]||0;return 0}return 0;case 21510:case 21511:case 21512:return r.tty?0:-59;case 21506:case 21507:case 21508:if(!r.tty)return-59;if(r.tty.ops.ioctl_tcsets){for(var a=Re(),s=D[a>>2],c=D[a+4>>2],l=D[a+8>>2],u=D[a+12>>2],d=[],o=0;o<32;o++)d.push(C[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:if(!r.tty)return-59;var a=Re();return D[a>>2]=0,0;case 21520:return r.tty?-28:-59;case 21531:var a=Re();return 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=Re();T[a>>1]=f[0],T[a+2>>1]=f[1]}return 0;case 21524:return r.tty?0:-59;case 21515:return r.tty?0:-59;default:return-28}}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function pt(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}}function mt(e,t,n,r){try{t=X.getStr(t);var i=r&256,a=r&4096;return r&=-6401,S(!r,`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}}function ht(e,t,n,r){X.varargs=r;try{t=X.getStr(t),t=X.calculateAt(e,t);var i=r?Le():0;return Y.open(t,n,i).fd}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function gt(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}}function _t(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}}function vt(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}}var yt=()=>{I(`native code called abort()`)},bt=(e,t,n)=>w.copyWithin(e,t,t+n),xt=()=>{throw 1/0};function St(e,t,n){var r=ct(e,t),i=/* @__PURE__ */ new Date(r*1e3);D[n>>2]=i.getUTCSeconds(),D[n+4>>2]=i.getUTCMinutes(),D[n+8>>2]=i.getUTCHours(),D[n+12>>2]=i.getUTCDate(),D[n+16>>2]=i.getUTCMonth(),D[n+20>>2]=i.getUTCFullYear()-1900,D[n+24>>2]=i.getUTCDay();var a=Date.UTC(i.getUTCFullYear(),0,1,0,0,0,0),o=(i.getTime()-a)/864e5|0;D[n+28>>2]=o}var Ct=e=>e%4==0&&(e%100!=0||e%400==0),wt=[0,31,60,91,121,152,182,213,244,274,305,335],Tt=[0,31,59,90,120,151,181,212,243,273,304,334],Et=e=>(Ct(e.getFullYear())?wt:Tt)[e.getMonth()]+e.getDate()-1;function Dt(e,t,n){var r=ct(e,t),i=/* @__PURE__ */ new Date(r*1e3);D[n>>2]=i.getSeconds(),D[n+4>>2]=i.getMinutes(),D[n+8>>2]=i.getHours(),D[n+12>>2]=i.getDate(),D[n+16>>2]=i.getMonth(),D[n+20>>2]=i.getFullYear()-1900,D[n+24>>2]=i.getDay();var a=Et(i)|0;D[n+28>>2]=a,D[n+36>>2]=-(i.getTimezoneOffset()*60);var o=new Date(i.getFullYear(),0,1),s=new Date(i.getFullYear(),6,1).getTimezoneOffset(),c=o.getTimezoneOffset(),l=(s!=c&&i.getTimezoneOffset()==Math.min(c,s))|0;D[n+32>>2]=l}var Ot=(e,t,n,r)=>{var i=(/* @__PURE__ */ 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);O[e>>2]=l*60,D[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);S(d),S(f),S(Ue(d)<=16,`timezone name truncated to fit in TZNAME_MAX (${d})`),S(Ue(f)<=16,`timezone name truncated to fit in TZNAME_MAX (${f})`),c<s?(ut(d,n,17),ut(f,r,17)):(ut(d,r,17),ut(f,n,17))},kt=()=>Date.now(),At=()=>2147483648,jt=e=>{var t=b.buffer,n=(e-t.byteLength+65535)/65536|0;try{return b.grow(n),j(),1}catch(n){v(`growMemory: Attempted to grow heap from ${t.byteLength} bytes to ${e} bytes, but got error: ${n}`)}},Mt=e=>{var t=w.length;e>>>=0,S(e>t);var n=At();if(e>n)return v(`Cannot enlarge memory, requested ${e} bytes, but the limit is ${n} 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,Ye(Math.max(e,i),65536));if(jt(a))return!0}return v(`Failed to grow the heap from ${t} bytes to ${a} bytes, not enough memory!`),!1},Nt={},Pt=()=>f||`./this.program`,Ft=()=>{if(!Ft.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`,_:Pt()};for(var t in Nt)Nt[t]===void 0?delete e[t]:e[t]=Nt[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);Ft.strings=n}return Ft.strings},It=(e,t)=>{for(var n=0;n<e.length;++n)S(e.charCodeAt(n)===(e.charCodeAt(n)&255)),C[t++]=e.charCodeAt(n);C[t]=0},Lt=(e,t)=>{var n=0;return Ft().forEach((r,i)=>{var a=t+n;O[e+i*4>>2]=a,It(r,a),n+=r.length+1}),0},Rt=(e,t)=>{var n=Ft();O[e>>2]=n.length;var r=0;return n.forEach(e=>r+=e.length+1),O[t>>2]=r,0};function zt(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}}var Bt=(e,t,n,r)=>{for(var i=0,a=0;a<n;a++){var o=O[t>>2],s=O[t+4>>2];t+=8;var c=Y.read(e,C,o,s,r);if(c<0)return-1;if(i+=c,c<s)break}return i};function Vt(e,t,n,r){try{var i=Bt(X.getStreamFromFD(e),t,n);return O[r>>2]=i,0}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function Ht(e,t,n,r,i){var a=ct(t,n);try{if(isNaN(a))return 61;var o=X.getStreamFromFD(e);return Y.llseek(o,a,r),B=[o.position>>>0,(z=o.position,+Math.abs(z)>=1?z>0?Math.floor(z/4294967296)>>>0:~~+Math.ceil((z-+(~~z>>>0))/4294967296)>>>0:0)],D[i>>2]=B[0],D[i+4>>2]=B[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}}function Ut(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}}var Wt=(e,t,n,r)=>{for(var i=0,a=0;a<n;a++){var o=O[t>>2],s=O[t+4>>2];t+=8;var c=Y.write(e,C,o,s,r);if(c<0)return-1;if(i+=c,c<s)break}return i};function Gt(e,t,n,r){try{var i=Wt(X.getStreamFromFD(e),t,n);return O[r>>2]=i,0}catch(e){if(Y===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}var Kt=[],qt,Z=e=>{var t=Kt[e];return t||(e>=Kt.length&&(Kt.length=e+1),Kt[e]=t=qt.get(e)),S(qt.get(e)==t,`JavaScript-side Wasm function table mirror is out of date!`),t},Jt=typeof TextDecoder<`u`?new TextDecoder(`utf-16le`):void 0,Yt=(e,t)=>{S(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)&&E[r];)++r;if(n=r<<1,n-e>32&&Jt)return Jt.decode(w.subarray(e,n));for(var a=``,o=0;!(o>=t/2);++o){var s=T[e+o*2>>1];if(s==0)break;a+=String.fromCharCode(s)}return a},Xt=(e,t)=>{S(e<16384),e<128?t.push(e):t.push(e%128|128,e>>7)},Zt=e=>{S(!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)S(e[r]in t,`invalid signature char: `+e[r]),n.parameters.push(t[e[r]]);return n},Qt=(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),Xt(r.length,t);for(var a=0;a<r.length;++a)S(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=(e,t)=>{if(S(!t.includes(`j`),`i64 not permitted in function signatures when WASM_BIGINT is disabled`),typeof WebAssembly.Function==`function`)return new WebAssembly.Function(Zt(t),e);var n=[1];Qt(t,n);var r=[0,97,115,109,1,0,0,0,1];Xt(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},en=(e,t)=>{if(tn)for(var n=e;n<e+t;n++){var r=Z(n);r&&tn.set(r,n)}},tn,nn=e=>(tn||(tn=/* @__PURE__ */ new WeakMap,en(0,qt.length)),tn.get(e)||0),rn=[],an=()=>{if(rn.length)return rn.pop();try{qt.grow(1)}catch(e){throw e instanceof RangeError?`Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.`:e}return qt.length-1},on=(e,t)=>{qt.set(e,t),Kt[e]=qt.get(e)},sn=(e,t)=>{S(e!==void 0);var n=nn(e);if(n)return n;var r=an();try{on(r,e)}catch(n){if(!(n instanceof TypeError))throw n;S(t!==void 0,`Missing signature argument to addFunction: `+e),on(r,$t(e,t))}return tn.set(e,r),r},cn=e=>{var t=r[`_`+e];return S(t,`Cannot call unknown function `+e+`, make sure it is exported`),t},ln=(e,t)=>{S(e.length>=0,`writeArrayToMemory array must have a length (should be an array or typed array)`),C.set(e,t)},un=e=>wn(e),dn=e=>{var t=Ue(e)+1,n=un(t);return ut(e,n,t),n},fn=(e,t,n,r,i)=>{var a={string:e=>{var t=0;return e!=null&&e!==0&&(t=dn(e)),t},array:e=>{var t=un(e.length);return ln(e,t),t}};function o(e){return t===`string`?Fe(e):t===`boolean`?!!e:e}var s=cn(e),c=[],l=0;if(S(t!==`array`,`Return type should not be "array".`),r)for(var u=0;u<r.length;u++){var d=a[n[u]];d?(l===0&&(l=U()),c[u]=d(r[u])):c[u]=r[u]}var f=s(...c);function p(e){return l!==0&&H(l),o(e)}return f=p(f),f},pn=(e,t,n,r)=>(...r)=>fn(e,t,n,r),mn=e=>{tn.delete(Z(e)),on(e,null),rn.push(e)},hn=(e,t,n)=>{if(S(t%2==0,`Pointer passed to stringToUTF16 must be aligned to two bytes!`),S(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;n-=2;for(var r=t,i=n<e.length*2?n/2:e.length,a=0;a<i;++a){var o=e.charCodeAt(a);T[t>>1]=o,t+=2}return T[t>>1]=0,t-r};Y.createPreloadedFile=tt,Y.staticInit();function gn(){Te(`fetchSettings`)}var _n={__assert_fail:Ie,__syscall_fcntl64:ot,__syscall_fstat64:st,__syscall_ftruncate64:lt,__syscall_getdents64:dt,__syscall_ioctl:ft,__syscall_lstat64:pt,__syscall_newfstatat:mt,__syscall_openat:ht,__syscall_rmdir:gt,__syscall_stat64:_t,__syscall_unlinkat:vt,_abort_js:yt,_emscripten_memcpy_js:bt,_emscripten_throw_longjmp:xt,_gmtime_js:St,_localtime_js:Dt,_tzset_js:Ot,emscripten_date_now:kt,emscripten_resize_heap:Mt,environ_get:Lt,environ_sizes_get:Rt,fd_close:zt,fd_read:Vt,fd_seek:Ht,fd_sync:Ut,fd_write:Gt,invoke_ii:Dn,invoke_iii:On,invoke_iiii:kn,invoke_iiiii:An,invoke_v:Nn,invoke_vi:Mn,invoke_vii:jn,invoke_viii:En,invoke_viiii:Pn,invoke_viiiiiiiii:Fn},Q=we();r._PDFiumExt_Init=L(`PDFiumExt_Init`,0),r._FPDF_InitLibraryWithConfig=L(`FPDF_InitLibraryWithConfig`,1),r._PDFiumExt_OpenFileWriter=L(`PDFiumExt_OpenFileWriter`,0),r._PDFiumExt_GetFileWriterSize=L(`PDFiumExt_GetFileWriterSize`,1),r._PDFiumExt_GetFileWriterData=L(`PDFiumExt_GetFileWriterData`,3),r._PDFiumExt_CloseFileWriter=L(`PDFiumExt_CloseFileWriter`,1),r._PDFiumExt_SaveAsCopy=L(`PDFiumExt_SaveAsCopy`,2),r._FPDF_SaveAsCopy=L(`FPDF_SaveAsCopy`,3),r._PDFiumExt_OpenFormFillInfo=L(`PDFiumExt_OpenFormFillInfo`,0),r._PDFiumExt_CloseFormFillInfo=L(`PDFiumExt_CloseFormFillInfo`,1),r._PDFiumExt_InitFormFillEnvironment=L(`PDFiumExt_InitFormFillEnvironment`,2),r._FPDFDOC_InitFormFillEnvironment=L(`FPDFDOC_InitFormFillEnvironment`,2),r._PDFiumExt_ExitFormFillEnvironment=L(`PDFiumExt_ExitFormFillEnvironment`,1),r._FPDFDOC_ExitFormFillEnvironment=L(`FPDFDOC_ExitFormFillEnvironment`,1),r._EPDFNamedDest_SetDest=L(`EPDFNamedDest_SetDest`,3),r._EPDFNamedDest_Remove=L(`EPDFNamedDest_Remove`,2),r._EPDFDest_CreateView=L(`EPDFDest_CreateView`,4),r._EPDFDest_CreateXYZ=L(`EPDFDest_CreateXYZ`,7),r._EPDFDest_CreateRemoteView=L(`EPDFDest_CreateRemoteView`,5),r._EPDFDest_CreateRemoteXYZ=L(`EPDFDest_CreateRemoteXYZ`,8),r._EPDFAction_CreateGoTo=L(`EPDFAction_CreateGoTo`,2),r._EPDFAction_CreateGoToNamed=L(`EPDFAction_CreateGoToNamed`,2),r._EPDFAction_CreateLaunch=L(`EPDFAction_CreateLaunch`,2),r._EPDFAction_CreateRemoteGoToByName=L(`EPDFAction_CreateRemoteGoToByName`,3),r._EPDFAction_CreateRemoteGoToDest=L(`EPDFAction_CreateRemoteGoToDest`,3),r._EPDFAction_CreateURI=L(`EPDFAction_CreateURI`,2),r._EPDFBookmark_Create=L(`EPDFBookmark_Create`,2),r._EPDFBookmark_Delete=L(`EPDFBookmark_Delete`,2),r._EPDFBookmark_AppendChild=L(`EPDFBookmark_AppendChild`,3),r._EPDFBookmark_InsertAfter=L(`EPDFBookmark_InsertAfter`,4),r._EPDFBookmark_Clear=L(`EPDFBookmark_Clear`,1),r._EPDFBookmark_SetTitle=L(`EPDFBookmark_SetTitle`,2),r._EPDFBookmark_SetDest=L(`EPDFBookmark_SetDest`,3),r._EPDFBookmark_SetAction=L(`EPDFBookmark_SetAction`,3),r._EPDFBookmark_ClearTarget=L(`EPDFBookmark_ClearTarget`,1),r._EPDF_PNG_EncodeRGBA=L(`EPDF_PNG_EncodeRGBA`,6),r._FPDFAnnot_IsSupportedSubtype=L(`FPDFAnnot_IsSupportedSubtype`,1),r._FPDFPage_CreateAnnot=L(`FPDFPage_CreateAnnot`,2),r._FPDFPage_GetAnnotCount=L(`FPDFPage_GetAnnotCount`,1),r._FPDFPage_GetAnnot=L(`FPDFPage_GetAnnot`,2),r._FPDFPage_GetAnnotIndex=L(`FPDFPage_GetAnnotIndex`,2),r._FPDFPage_CloseAnnot=L(`FPDFPage_CloseAnnot`,1),r._FPDFPage_RemoveAnnot=L(`FPDFPage_RemoveAnnot`,2),r._FPDFAnnot_GetSubtype=L(`FPDFAnnot_GetSubtype`,1),r._FPDFAnnot_IsObjectSupportedSubtype=L(`FPDFAnnot_IsObjectSupportedSubtype`,1),r._FPDFAnnot_UpdateObject=L(`FPDFAnnot_UpdateObject`,2),r._FPDFAnnot_AddInkStroke=L(`FPDFAnnot_AddInkStroke`,3),r._FPDFAnnot_RemoveInkList=L(`FPDFAnnot_RemoveInkList`,1),r._FPDFAnnot_AppendObject=L(`FPDFAnnot_AppendObject`,2),r._FPDFAnnot_GetObjectCount=L(`FPDFAnnot_GetObjectCount`,1),r._FPDFAnnot_GetObject=L(`FPDFAnnot_GetObject`,2),r._FPDFAnnot_RemoveObject=L(`FPDFAnnot_RemoveObject`,2),r._FPDFAnnot_SetColor=L(`FPDFAnnot_SetColor`,6),r._FPDFAnnot_GetColor=L(`FPDFAnnot_GetColor`,6),r._FPDFAnnot_HasAttachmentPoints=L(`FPDFAnnot_HasAttachmentPoints`,1),r._FPDFAnnot_SetAttachmentPoints=L(`FPDFAnnot_SetAttachmentPoints`,3),r._FPDFAnnot_AppendAttachmentPoints=L(`FPDFAnnot_AppendAttachmentPoints`,2),r._FPDFAnnot_CountAttachmentPoints=L(`FPDFAnnot_CountAttachmentPoints`,1),r._FPDFAnnot_GetAttachmentPoints=L(`FPDFAnnot_GetAttachmentPoints`,3),r._FPDFAnnot_SetRect=L(`FPDFAnnot_SetRect`,2),r._FPDFAnnot_GetRect=L(`FPDFAnnot_GetRect`,2),r._FPDFAnnot_GetVertices=L(`FPDFAnnot_GetVertices`,3),r._FPDFAnnot_GetInkListCount=L(`FPDFAnnot_GetInkListCount`,1),r._FPDFAnnot_GetInkListPath=L(`FPDFAnnot_GetInkListPath`,4),r._FPDFAnnot_GetLine=L(`FPDFAnnot_GetLine`,3),r._FPDFAnnot_SetBorder=L(`FPDFAnnot_SetBorder`,4),r._FPDFAnnot_GetBorder=L(`FPDFAnnot_GetBorder`,4),r._FPDFAnnot_HasKey=L(`FPDFAnnot_HasKey`,2),r._FPDFAnnot_GetValueType=L(`FPDFAnnot_GetValueType`,2),r._FPDFAnnot_SetStringValue=L(`FPDFAnnot_SetStringValue`,3),r._FPDFAnnot_GetStringValue=L(`FPDFAnnot_GetStringValue`,4),r._FPDFAnnot_GetNumberValue=L(`FPDFAnnot_GetNumberValue`,3),r._EPDFAnnot_SetNumberValue=L(`EPDFAnnot_SetNumberValue`,3),r._FPDFAnnot_SetAP=L(`FPDFAnnot_SetAP`,3),r._FPDFAnnot_GetAP=L(`FPDFAnnot_GetAP`,4),r._FPDFAnnot_GetLinkedAnnot=L(`FPDFAnnot_GetLinkedAnnot`,2),r._FPDFAnnot_GetFlags=L(`FPDFAnnot_GetFlags`,1),r._FPDFAnnot_SetFlags=L(`FPDFAnnot_SetFlags`,2),r._FPDFAnnot_GetFormFieldFlags=L(`FPDFAnnot_GetFormFieldFlags`,2),r._FPDFAnnot_SetFormFieldFlags=L(`FPDFAnnot_SetFormFieldFlags`,3),r._FPDFAnnot_GetFormFieldAtPoint=L(`FPDFAnnot_GetFormFieldAtPoint`,3),r._FPDFAnnot_GetFormFieldName=L(`FPDFAnnot_GetFormFieldName`,4),r._FPDFAnnot_GetFormFieldType=L(`FPDFAnnot_GetFormFieldType`,2),r._FPDFAnnot_GetFormAdditionalActionJavaScript=L(`FPDFAnnot_GetFormAdditionalActionJavaScript`,5),r._FPDFAnnot_GetFormFieldAlternateName=L(`FPDFAnnot_GetFormFieldAlternateName`,4),r._FPDFAnnot_GetFormFieldValue=L(`FPDFAnnot_GetFormFieldValue`,4),r._FPDFAnnot_GetOptionCount=L(`FPDFAnnot_GetOptionCount`,2),r._FPDFAnnot_GetOptionLabel=L(`FPDFAnnot_GetOptionLabel`,5),r._FPDFAnnot_IsOptionSelected=L(`FPDFAnnot_IsOptionSelected`,3),r._FPDFAnnot_GetFontSize=L(`FPDFAnnot_GetFontSize`,3),r._FPDFAnnot_SetFontColor=L(`FPDFAnnot_SetFontColor`,5),r._FPDFAnnot_GetFontColor=L(`FPDFAnnot_GetFontColor`,5),r._FPDFAnnot_IsChecked=L(`FPDFAnnot_IsChecked`,2),r._FPDFAnnot_SetFocusableSubtypes=L(`FPDFAnnot_SetFocusableSubtypes`,3),r._FPDFAnnot_GetFocusableSubtypesCount=L(`FPDFAnnot_GetFocusableSubtypesCount`,1),r._FPDFAnnot_GetFocusableSubtypes=L(`FPDFAnnot_GetFocusableSubtypes`,3),r._FPDFAnnot_GetLink=L(`FPDFAnnot_GetLink`,1),r._FPDFAnnot_GetFormControlCount=L(`FPDFAnnot_GetFormControlCount`,2),r._FPDFAnnot_GetFormControlIndex=L(`FPDFAnnot_GetFormControlIndex`,2),r._FPDFAnnot_GetFormFieldExportValue=L(`FPDFAnnot_GetFormFieldExportValue`,4),r._FPDFAnnot_SetURI=L(`FPDFAnnot_SetURI`,2),r._EPDFAnnot_SetAction=L(`EPDFAnnot_SetAction`,2),r._FPDFAnnot_GetFileAttachment=L(`FPDFAnnot_GetFileAttachment`,1),r._FPDFAnnot_AddFileAttachment=L(`FPDFAnnot_AddFileAttachment`,2),r._EPDFAnnot_SetColor=L(`EPDFAnnot_SetColor`,5),r._EPDFAnnot_GetColor=L(`EPDFAnnot_GetColor`,5),r._EPDFAnnot_ClearColor=L(`EPDFAnnot_ClearColor`,2),r._EPDFAnnot_SetOpacity=L(`EPDFAnnot_SetOpacity`,2),r._EPDFAnnot_GetOpacity=L(`EPDFAnnot_GetOpacity`,2),r._EPDFAnnot_GetBorderEffect=L(`EPDFAnnot_GetBorderEffect`,2),r._EPDFAnnot_SetBorderEffect=L(`EPDFAnnot_SetBorderEffect`,2),r._EPDFAnnot_ClearBorderEffect=L(`EPDFAnnot_ClearBorderEffect`,1),r._EPDFAnnot_GetRectangleDifferences=L(`EPDFAnnot_GetRectangleDifferences`,5),r._EPDFAnnot_SetRectangleDifferences=L(`EPDFAnnot_SetRectangleDifferences`,5),r._EPDFAnnot_ClearRectangleDifferences=L(`EPDFAnnot_ClearRectangleDifferences`,1),r._EPDFAnnot_GetBorderDashPatternCount=L(`EPDFAnnot_GetBorderDashPatternCount`,1),r._EPDFAnnot_GetBorderDashPattern=L(`EPDFAnnot_GetBorderDashPattern`,3),r._EPDFAnnot_SetBorderDashPattern=L(`EPDFAnnot_SetBorderDashPattern`,3),r._EPDFAnnot_GetBorderStyle=L(`EPDFAnnot_GetBorderStyle`,2),r._EPDFAnnot_SetBorderStyle=L(`EPDFAnnot_SetBorderStyle`,3),r._EPDFAnnot_GenerateAppearance=L(`EPDFAnnot_GenerateAppearance`,1),r._EPDFAnnot_GenerateAppearanceWithBlend=L(`EPDFAnnot_GenerateAppearanceWithBlend`,2),r._EPDFAnnot_GetBlendMode=L(`EPDFAnnot_GetBlendMode`,1),r._EPDFAnnot_SetIntent=L(`EPDFAnnot_SetIntent`,2),r._EPDFAnnot_GetIntent=L(`EPDFAnnot_GetIntent`,3),r._EPDFAnnot_GetRichContent=L(`EPDFAnnot_GetRichContent`,3),r._EPDFAnnot_SetLineEndings=L(`EPDFAnnot_SetLineEndings`,3),r._EPDFAnnot_GetLineEndings=L(`EPDFAnnot_GetLineEndings`,3),r._EPDFAnnot_SetVertices=L(`EPDFAnnot_SetVertices`,3),r._EPDFAnnot_SetLine=L(`EPDFAnnot_SetLine`,3),r._EPDFAnnot_SetDefaultAppearance=L(`EPDFAnnot_SetDefaultAppearance`,6),r._EPDFAnnot_GetDefaultAppearance=L(`EPDFAnnot_GetDefaultAppearance`,6),r._EPDFAnnot_SetTextAlignment=L(`EPDFAnnot_SetTextAlignment`,2),r._EPDFAnnot_GetTextAlignment=L(`EPDFAnnot_GetTextAlignment`,1),r._EPDFAnnot_SetVerticalAlignment=L(`EPDFAnnot_SetVerticalAlignment`,2),r._EPDFAnnot_GetVerticalAlignment=L(`EPDFAnnot_GetVerticalAlignment`,1),r._EPDFPage_GetAnnotByName=L(`EPDFPage_GetAnnotByName`,2),r._EPDFPage_RemoveAnnotByName=L(`EPDFPage_RemoveAnnotByName`,2),r._EPDFAnnot_SetLinkedAnnot=L(`EPDFAnnot_SetLinkedAnnot`,3),r._EPDFPage_GetAnnotCountRaw=L(`EPDFPage_GetAnnotCountRaw`,2),r._EPDFPage_GetAnnotRaw=L(`EPDFPage_GetAnnotRaw`,3),r._EPDFPage_RemoveAnnotRaw=L(`EPDFPage_RemoveAnnotRaw`,3),r._EPDFAnnot_SetName=L(`EPDFAnnot_SetName`,2),r._EPDFAnnot_GetName=L(`EPDFAnnot_GetName`,1),r._EPDFAnnot_UpdateAppearanceToRect=L(`EPDFAnnot_UpdateAppearanceToRect`,2),r._EPDFPage_CreateAnnot=L(`EPDFPage_CreateAnnot`,2),r._EPDFAnnot_SetRotate=L(`EPDFAnnot_SetRotate`,2),r._EPDFAnnot_GetRotate=L(`EPDFAnnot_GetRotate`,2),r._EPDFAnnot_GetReplyType=L(`EPDFAnnot_GetReplyType`,1),r._EPDFAnnot_SetReplyType=L(`EPDFAnnot_SetReplyType`,2),r._EPDFAnnot_SetOverlayText=L(`EPDFAnnot_SetOverlayText`,2),r._EPDFAnnot_GetOverlayText=L(`EPDFAnnot_GetOverlayText`,3),r._EPDFAnnot_SetOverlayTextRepeat=L(`EPDFAnnot_SetOverlayTextRepeat`,2),r._EPDFAnnot_GetOverlayTextRepeat=L(`EPDFAnnot_GetOverlayTextRepeat`,1),r._EPDFAnnot_ApplyRedaction=L(`EPDFAnnot_ApplyRedaction`,2),r._EPDFPage_ApplyRedactions=L(`EPDFPage_ApplyRedactions`,1),r._EPDFAnnot_Flatten=L(`EPDFAnnot_Flatten`,2),r._EPDFAnnot_SetAppearanceFromPage=L(`EPDFAnnot_SetAppearanceFromPage`,3),r._EPDFAnnot_ExportAppearanceAsDocument=L(`EPDFAnnot_ExportAppearanceAsDocument`,1),r._EPDFAnnot_ExportMultipleAppearancesAsDocument=L(`EPDFAnnot_ExportMultipleAppearancesAsDocument`,2),r._EPDFAnnot_SetExtendedRotation=L(`EPDFAnnot_SetExtendedRotation`,2),r._EPDFAnnot_GetExtendedRotation=L(`EPDFAnnot_GetExtendedRotation`,2),r._EPDFAnnot_SetUnrotatedRect=L(`EPDFAnnot_SetUnrotatedRect`,2),r._EPDFAnnot_GetUnrotatedRect=L(`EPDFAnnot_GetUnrotatedRect`,2),r._EPDFAnnot_GetRect=L(`EPDFAnnot_GetRect`,2),r._EPDFAnnot_SetAPMatrix=L(`EPDFAnnot_SetAPMatrix`,3),r._EPDFAnnot_GetAPMatrix=L(`EPDFAnnot_GetAPMatrix`,3),r._EPDFAnnot_GetAvailableAppearanceModes=L(`EPDFAnnot_GetAvailableAppearanceModes`,1),r._EPDFAnnot_HasAppearanceStream=L(`EPDFAnnot_HasAppearanceStream`,2),r._EPDFAnnot_SetMKColor=L(`EPDFAnnot_SetMKColor`,5),r._EPDFAnnot_GetMKColor=L(`EPDFAnnot_GetMKColor`,5),r._EPDFAnnot_ClearMKColor=L(`EPDFAnnot_ClearMKColor`,2),r._EPDFPage_CreateFormField=L(`EPDFPage_CreateFormField`,4),r._EPDFAnnot_GenerateFormFieldAP=L(`EPDFAnnot_GenerateFormFieldAP`,1),r._EPDFAnnot_GetButtonExportValue=L(`EPDFAnnot_GetButtonExportValue`,3),r._EPDFAnnot_GetFormFieldRawValue=L(`EPDFAnnot_GetFormFieldRawValue`,4),r._EPDFAnnot_SetFormFieldValue=L(`EPDFAnnot_SetFormFieldValue`,3),r._EPDFAnnot_SetFormFieldName=L(`EPDFAnnot_SetFormFieldName`,3),r._EPDFAnnot_GetFormFieldObjectNumber=L(`EPDFAnnot_GetFormFieldObjectNumber`,2),r._EPDFAnnot_ShareFormField=L(`EPDFAnnot_ShareFormField`,3),r._EPDFAnnot_GetCalloutLineCount=L(`EPDFAnnot_GetCalloutLineCount`,1),r._EPDFAnnot_GetCalloutLine=L(`EPDFAnnot_GetCalloutLine`,3),r._EPDFAnnot_SetCalloutLine=L(`EPDFAnnot_SetCalloutLine`,3),r._EPDFAnnot_SetFormFieldOptions=L(`EPDFAnnot_SetFormFieldOptions`,4),r._EPDFAnnot_GetObjectNumber=L(`EPDFAnnot_GetObjectNumber`,1),r._EPDFPage_GetAnnotByObjectNumber=L(`EPDFPage_GetAnnotByObjectNumber`,2),r._EPDFPage_RemoveAnnot=L(`EPDFPage_RemoveAnnot`,2),r._EPDFPage_RemoveAnnotByObjectNumber=L(`EPDFPage_RemoveAnnotByObjectNumber`,2),r._EPDFPage_MoveAnnots=L(`EPDFPage_MoveAnnots`,4),r._FPDFDoc_GetAttachmentCount=L(`FPDFDoc_GetAttachmentCount`,1),r._FPDFDoc_AddAttachment=L(`FPDFDoc_AddAttachment`,2),r._FPDFDoc_GetAttachment=L(`FPDFDoc_GetAttachment`,2),r._FPDFDoc_DeleteAttachment=L(`FPDFDoc_DeleteAttachment`,2),r._FPDFAttachment_GetName=L(`FPDFAttachment_GetName`,3),r._FPDFAttachment_HasKey=L(`FPDFAttachment_HasKey`,2),r._FPDFAttachment_GetValueType=L(`FPDFAttachment_GetValueType`,2),r._FPDFAttachment_SetStringValue=L(`FPDFAttachment_SetStringValue`,3),r._FPDFAttachment_GetStringValue=L(`FPDFAttachment_GetStringValue`,4),r._FPDFAttachment_SetFile=L(`FPDFAttachment_SetFile`,4),r._FPDFAttachment_GetFile=L(`FPDFAttachment_GetFile`,4),r._FPDFAttachment_GetSubtype=L(`FPDFAttachment_GetSubtype`,3),r._EPDFAttachment_SetSubtype=L(`EPDFAttachment_SetSubtype`,2),r._EPDFAttachment_SetDescription=L(`EPDFAttachment_SetDescription`,2),r._EPDFAttachment_GetDescription=L(`EPDFAttachment_GetDescription`,3),r._EPDFAttachment_GetIntegerValue=L(`EPDFAttachment_GetIntegerValue`,3),r._FPDFCatalog_IsTagged=L(`FPDFCatalog_IsTagged`,1),r._FPDFCatalog_GetLanguage=L(`FPDFCatalog_GetLanguage`,3),r._FPDFCatalog_SetLanguage=L(`FPDFCatalog_SetLanguage`,2),r._EPDFCatalog_GetLanguage=L(`EPDFCatalog_GetLanguage`,3),r._FPDFAvail_Create=L(`FPDFAvail_Create`,2),r._FPDFAvail_Destroy=L(`FPDFAvail_Destroy`,1),r._FPDFAvail_IsDocAvail=L(`FPDFAvail_IsDocAvail`,2),r._FPDFAvail_GetDocument=L(`FPDFAvail_GetDocument`,2),r._FPDFAvail_GetFirstPageNum=L(`FPDFAvail_GetFirstPageNum`,1),r._FPDFAvail_IsPageAvail=L(`FPDFAvail_IsPageAvail`,3),r._FPDFAvail_IsFormAvail=L(`FPDFAvail_IsFormAvail`,2),r._FPDFAvail_IsLinearized=L(`FPDFAvail_IsLinearized`,1),r._FPDFBookmark_GetFirstChild=L(`FPDFBookmark_GetFirstChild`,2),r._FPDFBookmark_GetNextSibling=L(`FPDFBookmark_GetNextSibling`,2),r._FPDFBookmark_GetTitle=L(`FPDFBookmark_GetTitle`,3),r._FPDFBookmark_GetCount=L(`FPDFBookmark_GetCount`,1),r._FPDFBookmark_Find=L(`FPDFBookmark_Find`,2),r._FPDFBookmark_GetDest=L(`FPDFBookmark_GetDest`,2),r._FPDFBookmark_GetAction=L(`FPDFBookmark_GetAction`,1),r._FPDFAction_GetType=L(`FPDFAction_GetType`,1),r._FPDFAction_GetDest=L(`FPDFAction_GetDest`,2),r._FPDFAction_GetFilePath=L(`FPDFAction_GetFilePath`,3),r._FPDFAction_GetURIPath=L(`FPDFAction_GetURIPath`,4),r._FPDFDest_GetDestPageIndex=L(`FPDFDest_GetDestPageIndex`,2),r._FPDFDest_GetView=L(`FPDFDest_GetView`,3),r._FPDFDest_GetLocationInPage=L(`FPDFDest_GetLocationInPage`,7),r._FPDFLink_GetLinkAtPoint=L(`FPDFLink_GetLinkAtPoint`,3),r._FPDFLink_GetLinkZOrderAtPoint=L(`FPDFLink_GetLinkZOrderAtPoint`,3),r._FPDFLink_GetDest=L(`FPDFLink_GetDest`,2),r._FPDFLink_GetAction=L(`FPDFLink_GetAction`,1),r._FPDFLink_Enumerate=L(`FPDFLink_Enumerate`,3),r._FPDFLink_GetAnnot=L(`FPDFLink_GetAnnot`,2),r._FPDFLink_GetAnnotRect=L(`FPDFLink_GetAnnotRect`,2),r._FPDFLink_CountQuadPoints=L(`FPDFLink_CountQuadPoints`,1),r._FPDFLink_GetQuadPoints=L(`FPDFLink_GetQuadPoints`,3),r._FPDF_GetPageAAction=L(`FPDF_GetPageAAction`,2),r._FPDF_GetFileIdentifier=L(`FPDF_GetFileIdentifier`,4),r._FPDF_GetMetaText=L(`FPDF_GetMetaText`,4),r._FPDF_GetPageLabel=L(`FPDF_GetPageLabel`,4),r._EPDF_SetMetaText=L(`EPDF_SetMetaText`,3),r._EPDF_HasMetaText=L(`EPDF_HasMetaText`,2),r._EPDF_GetMetaTrapped=L(`EPDF_GetMetaTrapped`,1),r._EPDF_SetMetaTrapped=L(`EPDF_SetMetaTrapped`,2),r._EPDF_GetMetaKeyCount=L(`EPDF_GetMetaKeyCount`,2),r._EPDF_GetMetaKeyName=L(`EPDF_GetMetaKeyName`,5),r._FPDFPageObj_NewImageObj=L(`FPDFPageObj_NewImageObj`,1),r._FPDFImageObj_LoadJpegFile=L(`FPDFImageObj_LoadJpegFile`,4),r._FPDFImageObj_LoadJpegFileInline=L(`FPDFImageObj_LoadJpegFileInline`,4),r._FPDFImageObj_SetMatrix=L(`FPDFImageObj_SetMatrix`,7),r._FPDFImageObj_SetBitmap=L(`FPDFImageObj_SetBitmap`,4),r._FPDFImageObj_GetBitmap=L(`FPDFImageObj_GetBitmap`,1),r._FPDFImageObj_GetRenderedBitmap=L(`FPDFImageObj_GetRenderedBitmap`,3),r._FPDFImageObj_GetImageDataDecoded=L(`FPDFImageObj_GetImageDataDecoded`,3),r._FPDFImageObj_GetImageDataRaw=L(`FPDFImageObj_GetImageDataRaw`,3),r._FPDFImageObj_GetImageFilterCount=L(`FPDFImageObj_GetImageFilterCount`,1),r._FPDFImageObj_GetImageFilter=L(`FPDFImageObj_GetImageFilter`,4),r._FPDFImageObj_GetImageMetadata=L(`FPDFImageObj_GetImageMetadata`,3),r._FPDFImageObj_GetImagePixelSize=L(`FPDFImageObj_GetImagePixelSize`,3),r._FPDFImageObj_GetIccProfileDataDecoded=L(`FPDFImageObj_GetIccProfileDataDecoded`,5),r._EPDFImageObj_SetPng=L(`EPDFImageObj_SetPng`,5),r._EPDFImageObj_SetJpeg=L(`EPDFImageObj_SetJpeg`,5),r._FPDF_CreateNewDocument=L(`FPDF_CreateNewDocument`,0),r._FPDFPage_Delete=L(`FPDFPage_Delete`,2),r._FPDF_MovePages=L(`FPDF_MovePages`,4),r._FPDFPage_New=L(`FPDFPage_New`,4),r._FPDFPage_GetRotation=L(`FPDFPage_GetRotation`,1),r._FPDFPage_InsertObject=L(`FPDFPage_InsertObject`,2),r._FPDFPage_InsertObjectAtIndex=L(`FPDFPage_InsertObjectAtIndex`,3),r._FPDFPage_RemoveObject=L(`FPDFPage_RemoveObject`,2),r._FPDFPage_CountObjects=L(`FPDFPage_CountObjects`,1),r._FPDFPage_GetObject=L(`FPDFPage_GetObject`,2),r._FPDFPage_HasTransparency=L(`FPDFPage_HasTransparency`,1),r._FPDFPageObj_Destroy=L(`FPDFPageObj_Destroy`,1),r._FPDFPageObj_GetMarkedContentID=L(`FPDFPageObj_GetMarkedContentID`,1),r._FPDFPageObj_CountMarks=L(`FPDFPageObj_CountMarks`,1),r._FPDFPageObj_GetMark=L(`FPDFPageObj_GetMark`,2),r._FPDFPageObj_AddMark=L(`FPDFPageObj_AddMark`,2),r._FPDFPageObj_RemoveMark=L(`FPDFPageObj_RemoveMark`,2),r._FPDFPageObjMark_GetName=L(`FPDFPageObjMark_GetName`,4),r._FPDFPageObjMark_CountParams=L(`FPDFPageObjMark_CountParams`,1),r._FPDFPageObjMark_GetParamKey=L(`FPDFPageObjMark_GetParamKey`,5),r._FPDFPageObjMark_GetParamValueType=L(`FPDFPageObjMark_GetParamValueType`,2),r._FPDFPageObjMark_GetParamIntValue=L(`FPDFPageObjMark_GetParamIntValue`,3),r._FPDFPageObjMark_GetParamFloatValue=L(`FPDFPageObjMark_GetParamFloatValue`,3),r._FPDFPageObjMark_GetParamStringValue=L(`FPDFPageObjMark_GetParamStringValue`,5),r._FPDFPageObjMark_GetParamBlobValue=L(`FPDFPageObjMark_GetParamBlobValue`,5),r._FPDFPageObj_HasTransparency=L(`FPDFPageObj_HasTransparency`,1),r._FPDFPageObjMark_SetIntParam=L(`FPDFPageObjMark_SetIntParam`,5),r._FPDFPageObjMark_SetFloatParam=L(`FPDFPageObjMark_SetFloatParam`,5),r._FPDFPageObjMark_SetStringParam=L(`FPDFPageObjMark_SetStringParam`,5),r._FPDFPageObjMark_SetBlobParam=L(`FPDFPageObjMark_SetBlobParam`,6),r._FPDFPageObjMark_RemoveParam=L(`FPDFPageObjMark_RemoveParam`,3),r._FPDFPageObj_GetType=L(`FPDFPageObj_GetType`,1),r._FPDFPageObj_GetIsActive=L(`FPDFPageObj_GetIsActive`,2),r._FPDFPageObj_SetIsActive=L(`FPDFPageObj_SetIsActive`,2),r._FPDFPage_GenerateContent=L(`FPDFPage_GenerateContent`,1),r._FPDFPageObj_Transform=L(`FPDFPageObj_Transform`,7),r._FPDFPageObj_TransformF=L(`FPDFPageObj_TransformF`,2),r._FPDFPageObj_GetMatrix=L(`FPDFPageObj_GetMatrix`,2),r._FPDFPageObj_SetMatrix=L(`FPDFPageObj_SetMatrix`,2),r._FPDFPageObj_SetBlendMode=L(`FPDFPageObj_SetBlendMode`,2),r._FPDFPage_TransformAnnots=L(`FPDFPage_TransformAnnots`,7),r._FPDFPage_SetRotation=L(`FPDFPage_SetRotation`,2),r._FPDFPageObj_SetFillColor=L(`FPDFPageObj_SetFillColor`,5),r._FPDFPageObj_GetFillColor=L(`FPDFPageObj_GetFillColor`,5),r._FPDFPageObj_GetBounds=L(`FPDFPageObj_GetBounds`,5),r._FPDFPageObj_GetRotatedBounds=L(`FPDFPageObj_GetRotatedBounds`,2),r._FPDFPageObj_SetStrokeColor=L(`FPDFPageObj_SetStrokeColor`,5),r._FPDFPageObj_GetStrokeColor=L(`FPDFPageObj_GetStrokeColor`,5),r._FPDFPageObj_SetStrokeWidth=L(`FPDFPageObj_SetStrokeWidth`,2),r._FPDFPageObj_GetStrokeWidth=L(`FPDFPageObj_GetStrokeWidth`,2),r._FPDFPageObj_GetLineJoin=L(`FPDFPageObj_GetLineJoin`,1),r._FPDFPageObj_SetLineJoin=L(`FPDFPageObj_SetLineJoin`,2),r._FPDFPageObj_GetLineCap=L(`FPDFPageObj_GetLineCap`,1),r._FPDFPageObj_SetLineCap=L(`FPDFPageObj_SetLineCap`,2),r._FPDFPageObj_GetDashPhase=L(`FPDFPageObj_GetDashPhase`,2),r._FPDFPageObj_SetDashPhase=L(`FPDFPageObj_SetDashPhase`,2),r._FPDFPageObj_GetDashCount=L(`FPDFPageObj_GetDashCount`,1),r._FPDFPageObj_GetDashArray=L(`FPDFPageObj_GetDashArray`,3),r._FPDFPageObj_SetDashArray=L(`FPDFPageObj_SetDashArray`,4),r._FPDFFormObj_CountObjects=L(`FPDFFormObj_CountObjects`,1),r._FPDFFormObj_GetObject=L(`FPDFFormObj_GetObject`,2),r._FPDFFormObj_RemoveObject=L(`FPDFFormObj_RemoveObject`,2),r._FPDFPageObj_CreateNewPath=L(`FPDFPageObj_CreateNewPath`,2),r._FPDFPageObj_CreateNewRect=L(`FPDFPageObj_CreateNewRect`,4),r._FPDFPath_CountSegments=L(`FPDFPath_CountSegments`,1),r._FPDFPath_GetPathSegment=L(`FPDFPath_GetPathSegment`,2),r._FPDFPath_MoveTo=L(`FPDFPath_MoveTo`,3),r._FPDFPath_LineTo=L(`FPDFPath_LineTo`,3),r._FPDFPath_BezierTo=L(`FPDFPath_BezierTo`,7),r._FPDFPath_Close=L(`FPDFPath_Close`,1),r._FPDFPath_SetDrawMode=L(`FPDFPath_SetDrawMode`,3),r._FPDFPath_GetDrawMode=L(`FPDFPath_GetDrawMode`,3),r._FPDFPathSegment_GetPoint=L(`FPDFPathSegment_GetPoint`,3),r._FPDFPathSegment_GetType=L(`FPDFPathSegment_GetType`,1),r._FPDFPathSegment_GetClose=L(`FPDFPathSegment_GetClose`,1),r._FPDFPageObj_NewTextObj=L(`FPDFPageObj_NewTextObj`,3),r._FPDFText_SetText=L(`FPDFText_SetText`,2),r._FPDFText_SetCharcodes=L(`FPDFText_SetCharcodes`,3),r._FPDFText_LoadFont=L(`FPDFText_LoadFont`,5),r._FPDFText_LoadStandardFont=L(`FPDFText_LoadStandardFont`,2),r._FPDFText_LoadCidType2Font=L(`FPDFText_LoadCidType2Font`,6),r._FPDFTextObj_GetFontSize=L(`FPDFTextObj_GetFontSize`,2),r._FPDFTextObj_GetText=L(`FPDFTextObj_GetText`,4),r._FPDFTextObj_GetRenderedBitmap=L(`FPDFTextObj_GetRenderedBitmap`,4),r._FPDFFont_Close=L(`FPDFFont_Close`,1),r._FPDFPageObj_CreateTextObj=L(`FPDFPageObj_CreateTextObj`,3),r._FPDFTextObj_GetTextRenderMode=L(`FPDFTextObj_GetTextRenderMode`,1),r._FPDFTextObj_SetTextRenderMode=L(`FPDFTextObj_SetTextRenderMode`,2),r._FPDFTextObj_GetFont=L(`FPDFTextObj_GetFont`,1),r._FPDFFont_GetBaseFontName=L(`FPDFFont_GetBaseFontName`,3),r._FPDFFont_GetFamilyName=L(`FPDFFont_GetFamilyName`,3),r._FPDFFont_GetFontData=L(`FPDFFont_GetFontData`,4),r._FPDFFont_GetIsEmbedded=L(`FPDFFont_GetIsEmbedded`,1),r._FPDFFont_GetFlags=L(`FPDFFont_GetFlags`,1),r._FPDFFont_GetWeight=L(`FPDFFont_GetWeight`,1),r._FPDFFont_GetItalicAngle=L(`FPDFFont_GetItalicAngle`,2),r._FPDFFont_GetAscent=L(`FPDFFont_GetAscent`,3),r._FPDFFont_GetDescent=L(`FPDFFont_GetDescent`,3),r._FPDFFont_GetGlyphWidth=L(`FPDFFont_GetGlyphWidth`,4),r._FPDFFont_GetGlyphPath=L(`FPDFFont_GetGlyphPath`,3),r._FPDFGlyphPath_CountGlyphSegments=L(`FPDFGlyphPath_CountGlyphSegments`,1),r._FPDFGlyphPath_GetGlyphPathSegment=L(`FPDFGlyphPath_GetGlyphPathSegment`,2),r._EPDFText_RedactInRect=L(`EPDFText_RedactInRect`,4),r._EPDFText_RedactInQuads=L(`EPDFText_RedactInQuads`,5),r._FPDFDoc_GetPageMode=L(`FPDFDoc_GetPageMode`,1),r._FPDFPage_Flatten=L(`FPDFPage_Flatten`,2),r._FPDFPage_HasFormFieldAtPoint=L(`FPDFPage_HasFormFieldAtPoint`,4),r._FPDFPage_FormFieldZOrderAtPoint=L(`FPDFPage_FormFieldZOrderAtPoint`,4),r._malloc=L(`malloc`,1),r._free=L(`free`,1),r._FORM_OnMouseMove=L(`FORM_OnMouseMove`,5),r._FORM_OnMouseWheel=L(`FORM_OnMouseWheel`,6),r._FORM_OnFocus=L(`FORM_OnFocus`,5),r._FORM_OnLButtonDown=L(`FORM_OnLButtonDown`,5),r._FORM_OnLButtonUp=L(`FORM_OnLButtonUp`,5),r._FORM_OnLButtonDoubleClick=L(`FORM_OnLButtonDoubleClick`,5),r._FORM_OnRButtonDown=L(`FORM_OnRButtonDown`,5),r._FORM_OnRButtonUp=L(`FORM_OnRButtonUp`,5),r._FORM_OnKeyDown=L(`FORM_OnKeyDown`,4),r._FORM_OnKeyUp=L(`FORM_OnKeyUp`,4),r._FORM_OnChar=L(`FORM_OnChar`,4),r._FORM_GetFocusedText=L(`FORM_GetFocusedText`,4),r._FORM_GetSelectedText=L(`FORM_GetSelectedText`,4),r._FORM_ReplaceAndKeepSelection=L(`FORM_ReplaceAndKeepSelection`,3),r._FORM_ReplaceSelection=L(`FORM_ReplaceSelection`,3),r._FORM_SelectAllText=L(`FORM_SelectAllText`,2),r._FORM_CanUndo=L(`FORM_CanUndo`,2),r._FORM_CanRedo=L(`FORM_CanRedo`,2),r._FORM_Undo=L(`FORM_Undo`,2),r._FORM_Redo=L(`FORM_Redo`,2),r._FORM_ForceToKillFocus=L(`FORM_ForceToKillFocus`,1),r._FORM_GetFocusedAnnot=L(`FORM_GetFocusedAnnot`,3),r._FORM_SetFocusedAnnot=L(`FORM_SetFocusedAnnot`,2),r._FPDF_FFLDraw=L(`FPDF_FFLDraw`,9),r._FPDF_SetFormFieldHighlightColor=L(`FPDF_SetFormFieldHighlightColor`,3),r._FPDF_SetFormFieldHighlightAlpha=L(`FPDF_SetFormFieldHighlightAlpha`,2),r._FPDF_RemoveFormFieldHighlight=L(`FPDF_RemoveFormFieldHighlight`,1),r._FORM_OnAfterLoadPage=L(`FORM_OnAfterLoadPage`,2),r._FORM_OnBeforeClosePage=L(`FORM_OnBeforeClosePage`,2),r._FORM_DoDocumentJSAction=L(`FORM_DoDocumentJSAction`,1),r._FORM_DoDocumentOpenAction=L(`FORM_DoDocumentOpenAction`,1),r._FORM_DoDocumentAAction=L(`FORM_DoDocumentAAction`,2),r._FORM_DoPageAAction=L(`FORM_DoPageAAction`,3),r._FORM_SetIndexSelected=L(`FORM_SetIndexSelected`,4),r._FORM_IsIndexSelected=L(`FORM_IsIndexSelected`,3),r._FPDFDoc_GetJavaScriptActionCount=L(`FPDFDoc_GetJavaScriptActionCount`,1),r._FPDFDoc_GetJavaScriptAction=L(`FPDFDoc_GetJavaScriptAction`,2),r._FPDFDoc_CloseJavaScriptAction=L(`FPDFDoc_CloseJavaScriptAction`,1),r._FPDFJavaScriptAction_GetName=L(`FPDFJavaScriptAction_GetName`,3),r._FPDFJavaScriptAction_GetScript=L(`FPDFJavaScriptAction_GetScript`,3),r._FPDF_ImportPagesByIndex=L(`FPDF_ImportPagesByIndex`,5),r._FPDF_ImportPages=L(`FPDF_ImportPages`,4),r._FPDF_ImportNPagesToOne=L(`FPDF_ImportNPagesToOne`,5),r._FPDF_NewXObjectFromPage=L(`FPDF_NewXObjectFromPage`,3),r._FPDF_CloseXObject=L(`FPDF_CloseXObject`,1),r._FPDF_NewFormObjectFromXObject=L(`FPDF_NewFormObjectFromXObject`,1),r._FPDF_CopyViewerPreferences=L(`FPDF_CopyViewerPreferences`,2),r._FPDF_RenderPageBitmapWithColorScheme_Start=L(`FPDF_RenderPageBitmapWithColorScheme_Start`,10),r._FPDF_RenderPageBitmap_Start=L(`FPDF_RenderPageBitmap_Start`,9),r._FPDF_RenderPage_Continue=L(`FPDF_RenderPage_Continue`,2),r._FPDF_RenderPage_Close=L(`FPDF_RenderPage_Close`,1),r._FPDF_SaveWithVersion=L(`FPDF_SaveWithVersion`,4),r._FPDFText_GetCharIndexFromTextIndex=L(`FPDFText_GetCharIndexFromTextIndex`,2),r._FPDFText_GetTextIndexFromCharIndex=L(`FPDFText_GetTextIndexFromCharIndex`,2),r._FPDF_GetSignatureCount=L(`FPDF_GetSignatureCount`,1),r._FPDF_GetSignatureObject=L(`FPDF_GetSignatureObject`,2),r._FPDFSignatureObj_GetContents=L(`FPDFSignatureObj_GetContents`,3),r._FPDFSignatureObj_GetByteRange=L(`FPDFSignatureObj_GetByteRange`,3),r._FPDFSignatureObj_GetSubFilter=L(`FPDFSignatureObj_GetSubFilter`,3),r._FPDFSignatureObj_GetReason=L(`FPDFSignatureObj_GetReason`,3),r._FPDFSignatureObj_GetTime=L(`FPDFSignatureObj_GetTime`,3),r._FPDFSignatureObj_GetDocMDPPermission=L(`FPDFSignatureObj_GetDocMDPPermission`,1),r._FPDF_StructTree_GetForPage=L(`FPDF_StructTree_GetForPage`,1),r._FPDF_StructTree_Close=L(`FPDF_StructTree_Close`,1),r._FPDF_StructTree_CountChildren=L(`FPDF_StructTree_CountChildren`,1),r._FPDF_StructTree_GetChildAtIndex=L(`FPDF_StructTree_GetChildAtIndex`,2),r._FPDF_StructElement_GetAltText=L(`FPDF_StructElement_GetAltText`,3),r._FPDF_StructElement_GetActualText=L(`FPDF_StructElement_GetActualText`,3),r._FPDF_StructElement_GetID=L(`FPDF_StructElement_GetID`,3),r._FPDF_StructElement_GetLang=L(`FPDF_StructElement_GetLang`,3),r._FPDF_StructElement_GetAttributeCount=L(`FPDF_StructElement_GetAttributeCount`,1),r._FPDF_StructElement_GetAttributeAtIndex=L(`FPDF_StructElement_GetAttributeAtIndex`,2),r._FPDF_StructElement_GetStringAttribute=L(`FPDF_StructElement_GetStringAttribute`,4),r._FPDF_StructElement_GetMarkedContentID=L(`FPDF_StructElement_GetMarkedContentID`,1),r._FPDF_StructElement_GetType=L(`FPDF_StructElement_GetType`,3),r._FPDF_StructElement_GetObjType=L(`FPDF_StructElement_GetObjType`,3),r._FPDF_StructElement_GetTitle=L(`FPDF_StructElement_GetTitle`,3),r._FPDF_StructElement_CountChildren=L(`FPDF_StructElement_CountChildren`,1),r._FPDF_StructElement_GetChildAtIndex=L(`FPDF_StructElement_GetChildAtIndex`,2),r._FPDF_StructElement_GetChildMarkedContentID=L(`FPDF_StructElement_GetChildMarkedContentID`,2),r._FPDF_StructElement_GetParent=L(`FPDF_StructElement_GetParent`,1),r._FPDF_StructElement_Attr_GetCount=L(`FPDF_StructElement_Attr_GetCount`,1),r._FPDF_StructElement_Attr_GetName=L(`FPDF_StructElement_Attr_GetName`,5),r._FPDF_StructElement_Attr_GetValue=L(`FPDF_StructElement_Attr_GetValue`,2),r._FPDF_StructElement_Attr_GetType=L(`FPDF_StructElement_Attr_GetType`,1),r._FPDF_StructElement_Attr_GetBooleanValue=L(`FPDF_StructElement_Attr_GetBooleanValue`,2),r._FPDF_StructElement_Attr_GetNumberValue=L(`FPDF_StructElement_Attr_GetNumberValue`,2),r._FPDF_StructElement_Attr_GetStringValue=L(`FPDF_StructElement_Attr_GetStringValue`,4),r._FPDF_StructElement_Attr_GetBlobValue=L(`FPDF_StructElement_Attr_GetBlobValue`,4),r._FPDF_StructElement_Attr_CountChildren=L(`FPDF_StructElement_Attr_CountChildren`,1),r._FPDF_StructElement_Attr_GetChildAtIndex=L(`FPDF_StructElement_Attr_GetChildAtIndex`,2),r._FPDF_StructElement_GetMarkedContentIdCount=L(`FPDF_StructElement_GetMarkedContentIdCount`,1),r._FPDF_StructElement_GetMarkedContentIdAtIndex=L(`FPDF_StructElement_GetMarkedContentIdAtIndex`,2),r._FPDF_AddInstalledFont=L(`FPDF_AddInstalledFont`,3),r._FPDF_SetSystemFontInfo=L(`FPDF_SetSystemFontInfo`,1),r._FPDF_GetDefaultTTFMap=L(`FPDF_GetDefaultTTFMap`,0),r._FPDF_GetDefaultTTFMapCount=L(`FPDF_GetDefaultTTFMapCount`,0),r._FPDF_GetDefaultTTFMapEntry=L(`FPDF_GetDefaultTTFMapEntry`,1),r._FPDF_GetDefaultSystemFontInfo=L(`FPDF_GetDefaultSystemFontInfo`,0),r._FPDF_FreeDefaultSystemFontInfo=L(`FPDF_FreeDefaultSystemFontInfo`,1),r._FPDFText_LoadPage=L(`FPDFText_LoadPage`,1),r._FPDFText_ClosePage=L(`FPDFText_ClosePage`,1),r._FPDFText_CountChars=L(`FPDFText_CountChars`,1),r._FPDFText_GetUnicode=L(`FPDFText_GetUnicode`,2),r._FPDFText_GetTextObject=L(`FPDFText_GetTextObject`,2),r._FPDFText_IsGenerated=L(`FPDFText_IsGenerated`,2),r._FPDFText_IsHyphen=L(`FPDFText_IsHyphen`,2),r._FPDFText_HasUnicodeMapError=L(`FPDFText_HasUnicodeMapError`,2),r._FPDFText_GetFontSize=L(`FPDFText_GetFontSize`,2),r._FPDFText_GetFontInfo=L(`FPDFText_GetFontInfo`,5),r._FPDFText_GetFontWeight=L(`FPDFText_GetFontWeight`,2),r._FPDFText_GetFillColor=L(`FPDFText_GetFillColor`,6),r._FPDFText_GetStrokeColor=L(`FPDFText_GetStrokeColor`,6),r._FPDFText_GetCharAngle=L(`FPDFText_GetCharAngle`,2),r._FPDFText_GetCharBox=L(`FPDFText_GetCharBox`,6),r._FPDFText_GetLooseCharBox=L(`FPDFText_GetLooseCharBox`,3),r._FPDFText_GetMatrix=L(`FPDFText_GetMatrix`,3),r._FPDFText_GetCharOrigin=L(`FPDFText_GetCharOrigin`,4),r._FPDFText_GetCharIndexAtPos=L(`FPDFText_GetCharIndexAtPos`,5),r._FPDFText_GetText=L(`FPDFText_GetText`,4),r._FPDFText_CountRects=L(`FPDFText_CountRects`,3),r._FPDFText_GetRect=L(`FPDFText_GetRect`,6),r._FPDFText_GetBoundedText=L(`FPDFText_GetBoundedText`,7),r._FPDFText_FindStart=L(`FPDFText_FindStart`,4),r._FPDFText_FindNext=L(`FPDFText_FindNext`,1),r._FPDFText_FindPrev=L(`FPDFText_FindPrev`,1),r._FPDFText_GetSchResultIndex=L(`FPDFText_GetSchResultIndex`,1),r._FPDFText_GetSchCount=L(`FPDFText_GetSchCount`,1),r._FPDFText_FindClose=L(`FPDFText_FindClose`,1),r._FPDFLink_LoadWebLinks=L(`FPDFLink_LoadWebLinks`,1),r._FPDFLink_CountWebLinks=L(`FPDFLink_CountWebLinks`,1),r._FPDFLink_GetURL=L(`FPDFLink_GetURL`,4),r._FPDFLink_CountRects=L(`FPDFLink_CountRects`,2),r._FPDFLink_GetRect=L(`FPDFLink_GetRect`,7),r._FPDFLink_GetTextRange=L(`FPDFLink_GetTextRange`,4),r._FPDFLink_CloseWebLinks=L(`FPDFLink_CloseWebLinks`,1),r._FPDFPage_GetDecodedThumbnailData=L(`FPDFPage_GetDecodedThumbnailData`,3),r._FPDFPage_GetRawThumbnailData=L(`FPDFPage_GetRawThumbnailData`,3),r._FPDFPage_GetThumbnailAsBitmap=L(`FPDFPage_GetThumbnailAsBitmap`,1),r._FPDFPage_SetMediaBox=L(`FPDFPage_SetMediaBox`,5),r._FPDFPage_SetCropBox=L(`FPDFPage_SetCropBox`,5),r._FPDFPage_SetBleedBox=L(`FPDFPage_SetBleedBox`,5),r._FPDFPage_SetTrimBox=L(`FPDFPage_SetTrimBox`,5),r._FPDFPage_SetArtBox=L(`FPDFPage_SetArtBox`,5),r._FPDFPage_GetMediaBox=L(`FPDFPage_GetMediaBox`,5),r._FPDFPage_GetCropBox=L(`FPDFPage_GetCropBox`,5),r._FPDFPage_GetBleedBox=L(`FPDFPage_GetBleedBox`,5),r._FPDFPage_GetTrimBox=L(`FPDFPage_GetTrimBox`,5),r._FPDFPage_GetArtBox=L(`FPDFPage_GetArtBox`,5),r._FPDFPage_TransFormWithClip=L(`FPDFPage_TransFormWithClip`,3),r._FPDFPageObj_TransformClipPath=L(`FPDFPageObj_TransformClipPath`,7),r._FPDFPageObj_GetClipPath=L(`FPDFPageObj_GetClipPath`,1),r._FPDFClipPath_CountPaths=L(`FPDFClipPath_CountPaths`,1),r._FPDFClipPath_CountPathSegments=L(`FPDFClipPath_CountPathSegments`,2),r._FPDFClipPath_GetPathSegment=L(`FPDFClipPath_GetPathSegment`,3),r._FPDF_CreateClipPath=L(`FPDF_CreateClipPath`,4),r._FPDF_DestroyClipPath=L(`FPDF_DestroyClipPath`,1),r._FPDFPage_InsertClipPath=L(`FPDFPage_InsertClipPath`,2),r._FPDF_InitLibrary=L(`FPDF_InitLibrary`,0),r._FPDF_DestroyLibrary=L(`FPDF_DestroyLibrary`,0),r._FPDF_SetSandBoxPolicy=L(`FPDF_SetSandBoxPolicy`,2),r._FPDF_LoadDocument=L(`FPDF_LoadDocument`,2),r._FPDF_GetFormType=L(`FPDF_GetFormType`,1),r._FPDF_LoadXFA=L(`FPDF_LoadXFA`,1),r._FPDF_LoadMemDocument=L(`FPDF_LoadMemDocument`,3),r._FPDF_LoadMemDocument64=L(`FPDF_LoadMemDocument64`,3),r._FPDF_LoadCustomDocument=L(`FPDF_LoadCustomDocument`,2),r._FPDF_GetFileVersion=L(`FPDF_GetFileVersion`,2),r._FPDF_DocumentHasValidCrossReferenceTable=L(`FPDF_DocumentHasValidCrossReferenceTable`,1),r._FPDF_GetDocPermissions=L(`FPDF_GetDocPermissions`,1),r._FPDF_GetDocUserPermissions=L(`FPDF_GetDocUserPermissions`,1),r._FPDF_GetSecurityHandlerRevision=L(`FPDF_GetSecurityHandlerRevision`,1),r._EPDF_SetEncryption=L(`EPDF_SetEncryption`,4),r._EPDF_RemoveEncryption=L(`EPDF_RemoveEncryption`,1),r._EPDF_UnlockOwnerPermissions=L(`EPDF_UnlockOwnerPermissions`,2),r._EPDF_IsEncrypted=L(`EPDF_IsEncrypted`,1),r._EPDF_IsOwnerUnlocked=L(`EPDF_IsOwnerUnlocked`,1),r._FPDF_GetPageCount=L(`FPDF_GetPageCount`,1),r._FPDF_LoadPage=L(`FPDF_LoadPage`,2),r._EPDFDoc_LoadPageByObjectNumber=L(`EPDFDoc_LoadPageByObjectNumber`,2),r._EPDFDoc_GetPageObjectNumberByIndex=L(`EPDFDoc_GetPageObjectNumberByIndex`,2),r._EPDFPage_GetObjectNumber=L(`EPDFPage_GetObjectNumber`,1),r._FPDF_GetPageWidthF=L(`FPDF_GetPageWidthF`,1),r._FPDF_GetPageWidth=L(`FPDF_GetPageWidth`,1),r._FPDF_GetPageHeightF=L(`FPDF_GetPageHeightF`,1),r._FPDF_GetPageHeight=L(`FPDF_GetPageHeight`,1),r._FPDF_GetPageBoundingBox=L(`FPDF_GetPageBoundingBox`,2),r._FPDF_RenderPageBitmap=L(`FPDF_RenderPageBitmap`,8),r._FPDF_RenderPageBitmapWithMatrix=L(`FPDF_RenderPageBitmapWithMatrix`,5),r._EPDF_RenderAnnotBitmap=L(`EPDF_RenderAnnotBitmap`,6),r._EPDF_RenderAnnotBitmapUnrotated=L(`EPDF_RenderAnnotBitmapUnrotated`,6),r._FPDF_ClosePage=L(`FPDF_ClosePage`,1),r._FPDF_CloseDocument=L(`FPDF_CloseDocument`,1),r._FPDF_GetLastError=L(`FPDF_GetLastError`,0),r._FPDF_DeviceToPage=L(`FPDF_DeviceToPage`,10),r._FPDF_PageToDevice=L(`FPDF_PageToDevice`,10),r._FPDFBitmap_Create=L(`FPDFBitmap_Create`,3),r._FPDFBitmap_CreateEx=L(`FPDFBitmap_CreateEx`,5),r._FPDFBitmap_GetFormat=L(`FPDFBitmap_GetFormat`,1),r._FPDFBitmap_FillRect=L(`FPDFBitmap_FillRect`,6),r._FPDFBitmap_GetBuffer=L(`FPDFBitmap_GetBuffer`,1),r._FPDFBitmap_GetWidth=L(`FPDFBitmap_GetWidth`,1),r._FPDFBitmap_GetHeight=L(`FPDFBitmap_GetHeight`,1),r._FPDFBitmap_GetStride=L(`FPDFBitmap_GetStride`,1),r._FPDFBitmap_Destroy=L(`FPDFBitmap_Destroy`,1),r._FPDF_GetPageSizeByIndexF=L(`FPDF_GetPageSizeByIndexF`,3),r._EPDF_GetPageRotationByIndex=L(`EPDF_GetPageRotationByIndex`,2),r._EPDF_GetPageBoxByIndex=L(`EPDF_GetPageBoxByIndex`,4),r._EPDF_GetPageSizeByIndexNormalized=L(`EPDF_GetPageSizeByIndexNormalized`,3),r._EPDF_LoadPageNormalized=L(`EPDF_LoadPageNormalized`,3),r._FPDF_GetPageSizeByIndex=L(`FPDF_GetPageSizeByIndex`,4),r._FPDF_VIEWERREF_GetPrintScaling=L(`FPDF_VIEWERREF_GetPrintScaling`,1),r._FPDF_VIEWERREF_GetNumCopies=L(`FPDF_VIEWERREF_GetNumCopies`,1),r._FPDF_VIEWERREF_GetPrintPageRange=L(`FPDF_VIEWERREF_GetPrintPageRange`,1),r._FPDF_VIEWERREF_GetPrintPageRangeCount=L(`FPDF_VIEWERREF_GetPrintPageRangeCount`,1),r._FPDF_VIEWERREF_GetPrintPageRangeElement=L(`FPDF_VIEWERREF_GetPrintPageRangeElement`,2),r._FPDF_VIEWERREF_GetDuplex=L(`FPDF_VIEWERREF_GetDuplex`,1),r._FPDF_VIEWERREF_GetName=L(`FPDF_VIEWERREF_GetName`,4),r._FPDF_CountNamedDests=L(`FPDF_CountNamedDests`,1),r._FPDF_GetNamedDestByName=L(`FPDF_GetNamedDestByName`,2),r._FPDF_GetNamedDest=L(`FPDF_GetNamedDest`,4),r._FPDF_GetXFAPacketCount=L(`FPDF_GetXFAPacketCount`,1),r._FPDF_GetXFAPacketName=L(`FPDF_GetXFAPacketName`,4),r._FPDF_GetXFAPacketContent=L(`FPDF_GetXFAPacketContent`,5),r._FPDF_GetTrailerEnds=L(`FPDF_GetTrailerEnds`,3);var vn=L(`strerror`,1),yn=L(`fflush`,1),bn=L(`emscripten_builtin_memalign`,2),$=L(`setThrew`,2),xn=()=>(xn=Q.emscripten_stack_init)(),Sn=()=>(Sn=Q.emscripten_stack_get_end)(),Cn=e=>(Cn=Q._emscripten_stack_restore)(e),wn=e=>(wn=Q._emscripten_stack_alloc)(e),Tn=()=>(Tn=Q.emscripten_stack_get_current)();r.dynCall_j=L(`dynCall_j`,1),r.dynCall_ji=L(`dynCall_ji`,2),r.dynCall_iiij=L(`dynCall_iiij`,5),r.dynCall_jji=L(`dynCall_jji`,4),r.dynCall_iji=L(`dynCall_iji`,4),r.dynCall_viijii=L(`dynCall_viijii`,7),r.dynCall_jij=L(`dynCall_jij`,4),r.dynCall_iij=L(`dynCall_iij`,4),r.dynCall_iiji=L(`dynCall_iiji`,5),r.dynCall_jiji=L(`dynCall_jiji`,5),r.dynCall_iiiiij=L(`dynCall_iiiiij`,7),r.dynCall_iiiiijj=L(`dynCall_iiiiijj`,9),r.dynCall_iiiiiijj=L(`dynCall_iiiiiijj`,10),r.dynCall_viji=L(`dynCall_viji`,5);function En(e,t,n,r){var i=U();try{Z(e)(t,n,r)}catch(e){if(H(i),e!==e+0)throw e;$(1,0)}}function Dn(e,t){var n=U();try{return Z(e)(t)}catch(e){if(H(n),e!==e+0)throw e;$(1,0)}}function On(e,t,n){var r=U();try{return Z(e)(t,n)}catch(e){if(H(r),e!==e+0)throw e;$(1,0)}}function kn(e,t,n,r){var i=U();try{return Z(e)(t,n,r)}catch(e){if(H(i),e!==e+0)throw e;$(1,0)}}function An(e,t,n,r,i){var a=U();try{return Z(e)(t,n,r,i)}catch(e){if(H(a),e!==e+0)throw e;$(1,0)}}function jn(e,t,n){var r=U();try{Z(e)(t,n)}catch(e){if(H(r),e!==e+0)throw e;$(1,0)}}function Mn(e,t){var n=U();try{Z(e)(t)}catch(e){if(H(n),e!==e+0)throw e;$(1,0)}}function Nn(e){var t=U();try{Z(e)()}catch(e){if(H(t),e!==e+0)throw e;$(1,0)}}function Pn(e,t,n,r,i){var a=U();try{Z(e)(t,n,r,i)}catch(e){if(H(a),e!==e+0)throw e;$(1,0)}}function Fn(e,t,n,r,i,a,o,s,c,l){var u=U();try{Z(e)(t,n,r,i,a,o,s,c,l)}catch(e){if(H(u),e!==e+0)throw e;$(1,0)}}r.wasmExports=Q,r.ccall=fn,r.cwrap=pn,r.addFunction=sn,r.removeFunction=mn,r.setValue=Pe,r.getValue=Me,r.UTF8ToString=Fe,r.stringToUTF8=ut,r.UTF16ToString=Yt,r.stringToUTF16=hn,(/* @__PURE__ */ `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(ke),(/* @__PURE__ */ `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(Ae);var In,Ln;ue=function e(){In||zn(),In||(ue=e)};function Rn(){xn(),ee()}function zn(){if(ce>0||(Rn(),!Ln&&(Ln=1,F(),ce>0)))return;function e(){In||(In=1,r.calledRun=1,!x&&(re(),i(r),r.onRuntimeInitialized?.(),S(!r._main,`compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]`),ie()))}r.setStatus?(r.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>r.setStatus(``),1),e()},1)):e(),te()}if(r.preInit)for(typeof r.preInit==`function`&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();zn(),n=o;for(let e of Object.keys(r))e in t||Object.defineProperty(t,e,{configurable:!0,get(){I(`Access to module property ('${e}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)}});return n})})(),pe={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`]}})))()}function I(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 he(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}function ge(e){if(!e||e.length>127||ve.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}function _e(e,t,n,r){let i=t.origin.x,o=t.origin.y,s=i+t.size.width,c=o+t.size.height,l=n.width,u=n.height,d=Math.hypot(e.a,e.b),f=Math.hypot(e.c,e.d),p=(r&1)==1,m=p?Math.max(1,Math.round(u*d)):Math.max(1,Math.round(l*d)),h=p?Math.max(1,Math.round(l*f)):Math.max(1,Math.round(u*f)),g,_;switch(r){case a.Degree0:g=-Math.round(i*d),_=-Math.round(o*f);break;case a.Degree90:g=Math.round((c-u)*d),_=-Math.round(i*f);break;case a.Degree180:g=Math.round((s-l)*d),_=Math.round((c-u)*f);break;case a.Degree270:g=-Math.round(o*d),_=Math.round((s-l)*f);break;default:g=-Math.round(i*d),_=-Math.round(o*f)}return{startX:g,startY:_,formsWidth:m,formsHeight:h,scaleX:d,scaleY:f}}async function L(e,t){let n=await de({wasmBinary:await(await fetch(e)).arrayBuffer()}),r=new Fe(n,{logger:t?.logger,fontFallback:t?.fontFallback});return new se(r,{imageConverter:le,logger:t?.logger})}var ve,R,ye,be,xe,Se,Ce,we,z,B,V,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,H,U,W,G,K,Fe;function Ie(){return(Ie=e((()=>{me(),o(),oe(),ce(),ve=/* @__PURE__ */ new Set([`Title`,`Author`,`Subject`,`Keywords`,`Producer`,`Creator`,`CreationDate`,`ModDate`,`Trapped`]),R=e=>e,ye={pageTtl:5e3,maxPagesPerDocument:10,normalizeRotation:!1},be=class{constructor(e,t,n={}){this.pdfium=e,this.memoryManager=t,this.docs=/* @__PURE__ */ new Map,this.config={...ye,...n}}setDocument(e,t,n,r=!1){let i=this.docs.get(e);if(!i){let a={...this.config,normalizeRotation:r};i=new xe(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):!1}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}}},xe=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 Se(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(R(this.filePtr)))}},Se=class{constructor(e,t,n){this.pdf=e,this.docPtr=t,this.cache=/* @__PURE__ */ new Map,this.accessOrder=[],this.config=n}acquire(e){let t=this.cache.get(e);if(!t){this.evictIfNeeded();let n;n=this.config.normalizeRotation?this.pdf.EPDF_LoadPageNormalized(this.docPtr,e,0):this.pdf.FPDF_LoadPage(this.docPtr,e),t=new Ce(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){let t=this.cache.get(e);if(t){if(t.getRefCount()===0)t.disposeImmediate();else break}else this.removeFromAccessOrder(e)}else break}}updateAccessOrder(e){this.removeFromAccessOrder(e),this.accessOrder.push(e)}removeFromAccessOrder(e){let t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1)}},Ce=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`)}},we={MEMORY:{MAX_TOTAL_MEMORY:2147483648}},z=`PDFiumEngine`,B=`MemoryManager`,V=class{constructor(e,t){this.pdfiumModule=e,this.logger=t,this.allocations=/* @__PURE__ */ new Map,this.totalAllocated=0}malloc(e){if(this.totalAllocated+e>we.MEMORY.MAX_TOTAL_MEMORY)throw Error(`Total memory usage would exceed limit: ${this.totalAllocated+e} > ${we.MEMORY.MAX_TOTAL_MEMORY}`);let t=this.pdfiumModule.pdfium.wasmExports.malloc(e);if(!t)throw Error(`Failed to allocate ${e} bytes`);let n={ptr:R(t),size:e,timestamp:Date.now(),stack:this.logger.isEnabled(`debug`)?(/* @__PURE__ */ Error()).stack:void 0};return this.allocations.set(t,n),this.totalAllocated+=e,R(t)}free(e){let t=this.allocations.get(e);t?(this.totalAllocated-=t.size,this.allocations.delete(e)):this.logger.warn(z,B,`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(z,B,`Potential memory leak: ${this.allocations.size} unfreed allocations`);for(let[e,t]of this.allocations)this.logger.warn(z,B,` - ${e}: ${t.size} bytes`,t.stack)}}},Te=36,Ee=0,De=4,Oe=8,ke=12,Ae=16,je=20,Me=24,Ne=28,Pe=32,H=`pdfium`,U=`font-fallback`,W=class{constructor(e,t=new te){this.fontHandles=/* @__PURE__ */ new Map,this.fontCache=/* @__PURE__ */ 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){this.logger.warn(H,U,`Font fallback already initialized`);return}this.module=e;let t=e.pdfium;if(typeof t.addFunction!=`function`)this.logger.error(H,U,`addFunction not available. Make sure WASM is compiled with -sALLOW_TABLE_GROWTH`);else try{if(this.structPtr=t.wasmExports.malloc(Te),!this.structPtr)throw Error(`Failed to allocate FPDF_SYSFONTINFO struct`);for(let e=0;e<Te;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+Ee,1,`i32`),t.setValue(this.structPtr+De,this.releaseFnPtr,`i32`),t.setValue(this.structPtr+Oe,this.enumFontsFnPtr,`i32`),t.setValue(this.structPtr+ke,this.mapFontFnPtr,`i32`),t.setValue(this.structPtr+Ae,this.getFontFnPtr,`i32`),t.setValue(this.structPtr+je,this.getFontDataFnPtr,`i32`),t.setValue(this.structPtr+Me,this.getFaceNameFnPtr,`i32`),t.setValue(this.structPtr+Ne,this.getFontCharsetFnPtr,`i32`),t.setValue(this.structPtr+Pe,this.deleteFontFnPtr,`i32`),e.FPDF_SetSystemFontInfo(this.structPtr),this.enabled=!0,this.logger.info(H,U,`Font fallback system initialized (pure TypeScript)`,Object.keys(this.fontConfig.fonts))}catch(e){throw this.logger.error(H,U,`Failed to initialize font fallback`,e),this.cleanup(),e}}disable(){this.enabled&&this.module&&(this.module.FPDF_SetSystemFontInfo(0),this.cleanup(),this.enabled=!1,this.logger.debug(H,U,`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(H,U,`Pre-loaded font: ${e}`))}catch(t){this.logger.warn(H,U,`Failed to pre-load font: ${e}`,t)}}))}mapFont(e,t,n,r,i){let a=t!==0;this.logger.debug(H,U,`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(H,U,`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(H,U,`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(H,U,`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(H,U,`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(H,U,`Copied ${a.length} bytes to buffer for handle ${e}`)),a.length):(this.logger.debug(H,U,`Table ${t} requested - returning 0 to request whole file`),0)}deleteFont(e){this.fontHandles.get(e)&&(this.logger.debug(H,U,`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(H,U,`Fetching font synchronously: ${e}`),this.fontConfig.fontLoader)try{let t=this.fontConfig.fontLoader(e);return t?this.logger.info(H,U,`Loaded font via custom loader: ${e} (${t.length} bytes)`):this.logger.warn(H,U,`Custom font loader returned null for: ${e}`),t}catch(t){return this.logger.error(H,U,`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(H,U,`Loaded font: ${e} (${n.length} bytes)`),n}return this.logger.error(H,U,`Failed to load font: ${e} (HTTP ${t.status})`),null}catch(t){return this.logger.error(H,U,`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}}},G=`PDFiumEngine`,K=`Engine`,Fe=class{constructor(e,t={}){this.pdfiumModule=e,this.memoryLeakCheckInterval=null,this.fontFallbackManager=null;let{logger:n=new te,fontFallback:r}=t;this.logger=n,this.memoryManager=new V(this.pdfiumModule,this.logger),this.cache=new be(this.pdfiumModule,this.memoryManager),this.logger.isEnabled(`debug`)&&(this.memoryLeakCheckInterval=setInterval(()=>{this.memoryManager.checkLeaks()},1e4)),this.logger.debug(G,K,`initialize`),this.logger.perf(G,K,`Initialize`,`Begin`,`General`),this.pdfiumModule.PDFiumExt_Init(),this.logger.perf(G,K,`Initialize`,`End`,`General`),r&&(this.fontFallbackManager=new W(r,this.logger),this.fontFallbackManager.initialize(this.pdfiumModule),this.logger.info(G,K,`Font fallback system enabled`))}destroy(){return this.logger.debug(G,K,`destroy`),this.logger.perf(G,K,`Destroy`,`Begin`,`General`),this.fontFallbackManager&&=(this.fontFallbackManager.disable(),null),this.pdfiumModule.FPDF_DestroyLibrary(),this.memoryLeakCheckInterval&&=(clearInterval(this.memoryLeakCheckInterval),null),this.logger.perf(G,K,`Destroy`,`End`,`General`),i.resolve(!0)}getFontFallbackManager(){return this.fontFallbackManager}withWString(e,t){let n=(e.length+1)*2,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=n.length*4,i=r?this.memoryManager.malloc(r):R(0);try{if(r)for(let e=0;e<n.length;e++)this.pdfiumModule.pdfium.setValue(i+e*4,n[e],`float`);return t(i,n.length)}finally{r&&this.memoryManager.free(i)}}openDocumentBuffer(e,t){this.logger.debug(G,K,`openDocumentBuffer`,e,t),this.logger.perf(G,K,`OpenDocumentBuffer`,`Begin`,e.id);let n=t?.normalizeRotation??!1,r=new Uint8Array(e.content),a=r.length,o=this.memoryManager.malloc(a);this.pdfiumModule.pdfium.HEAPU8.set(r,o);let s=this.pdfiumModule.FPDF_LoadMemDocument(o,a,t?.password??``);if(!s){let t=this.pdfiumModule.FPDF_GetLastError();return this.logger.error(G,K,`FPDF_LoadMemDocument failed with ${t}`),this.memoryManager.free(o),this.logger.perf(G,K,`OpenDocumentBuffer`,`End`,e.id),i.reject({code:t,message:`FPDF_LoadMemDocument failed`})}let c=this.pdfiumModule.FPDF_GetPageCount(s),l=[],u=this.memoryManager.malloc(8),d=this.memoryManager.malloc(16);for(let t=0;t<c;t++){if(!(n?this.pdfiumModule.EPDF_GetPageSizeByIndexNormalized(s,t,u):this.pdfiumModule.FPDF_GetPageSizeByIndexF(s,t,u))){let t=this.pdfiumModule.FPDF_GetLastError();return this.logger.error(G,K,`${n?`EPDF_GetPageSizeByIndexNormalized`:`FPDF_GetPageSizeByIndexF`} failed with ${t}`),this.memoryManager.free(u),this.memoryManager.free(d),this.pdfiumModule.FPDF_CloseDocument(s),this.memoryManager.free(o),this.logger.perf(G,K,`OpenDocumentBuffer`,`End`,e.id),i.reject({code:t,message:`${n?`EPDF_GetPageSizeByIndexNormalized`:`FPDF_GetPageSizeByIndexF`} failed`})}let r=this.pdfiumModule.EPDF_GetPageRotationByIndex(s,t),a=this.pdfiumModule.EPDFDoc_GetPageObjectNumberByIndex(s,t),c=this.readPageBoxes(s,t,d),f={index:t,size:{width:this.pdfiumModule.pdfium.getValue(u,`float`),height:this.pdfiumModule.pdfium.getValue(u+4,`float`)},rotation:r,objectNumber:a,boxes:c};l.push(f)}this.memoryManager.free(u),this.memoryManager.free(d);let f=this.pdfiumModule.EPDF_IsEncrypted(s),p=this.pdfiumModule.EPDF_IsOwnerUnlocked(s),m=this.pdfiumModule.FPDF_GetDocPermissions(s),h={id:e.id,pageCount:c,pages:l,isEncrypted:f,isOwnerUnlocked:p,permissions:m,normalizedRotation:n};return this.cache.setDocument(e.id,o,s,n),this.logger.perf(G,K,`OpenDocumentBuffer`,`End`,e.id),i.resolve(h)}createDocument(e){this.logger.debug(G,K,`createDocument`,e),this.logger.perf(G,K,`CreateDocument`,`Begin`,e);let t=this.pdfiumModule.FPDF_CreateNewDocument();if(!t)return this.logger.perf(G,K,`CreateDocument`,`End`,e),i.reject({code:E.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(G,K,`CreateDocument`,`End`,e),i.resolve(n)}getMetadata(e){this.logger.debug(G,K,`getMetadata`,e),this.logger.perf(G,K,`GetMetadata`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,K,`GetMetadata`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let n=this.readMetaText(t.docPtr,`CreationDate`),r=this.readMetaText(t.docPtr,`ModDate`),a={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?ae(n)??null:null,modificationDate:r?ae(r)??null:null,trapped:this.getMetaTrapped(t.docPtr),custom:this.readAllMeta(t.docPtr,!0)};return this.logger.perf(G,K,`GetMetadata`,`End`,e.id),i.resolve(a)}setMetadata(e,t){this.logger.debug(G,K,`setMetadata`,e,t),this.logger.perf(G,K,`SetMetadata`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,K,`SetMetadata`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let r=[[`title`,`Title`],[`author`,`Author`],[`subject`,`Subject`],[`keywords`,`Keywords`],[`producer`,`Producer`],[`creator`,`Creator`]],a=!0;for(let[e,i]of r){let r=t[e];if(r===void 0)continue;let o=r===null?null:r;this.setMetaText(n.docPtr,i,o)||(a=!1)}let o=(e,r)=>{let i=t[e];if(i===void 0)return;if(i===null){this.setMetaText(n.docPtr,r,null)||(a=!1);return}let o=O(i);this.setMetaText(n.docPtr,r,o)||(a=!1)};if(o(`creationDate`,`CreationDate`),o(`modificationDate`,`ModDate`),t.trapped!==void 0&&(this.setMetaTrapped(n.docPtr,t.trapped??null)||(a=!1)),t.custom!==void 0)for(let[e,r]of Object.entries(t.custom))ge(e)?this.setMetaText(n.docPtr,e,r??null)||(a=!1):this.logger.warn(G,K,`Invalid custom metadata key skipped`,e);return this.logger.perf(G,K,`SetMetadata`,`End`,e.id),a?i.resolve(!0):i.reject({code:E.Unknown,message:`one or more metadata fields could not be written`})}getDocPermissions(e){this.logger.debug(G,K,`getDocPermissions`,e),this.logger.perf(G,K,`getDocPermissions`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,K,`getDocPermissions`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.FPDF_GetDocPermissions(t.docPtr);return i.resolve(n)}getDocUserPermissions(e){this.logger.debug(G,K,`getDocUserPermissions`,e),this.logger.perf(G,K,`getDocUserPermissions`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,K,`getDocUserPermissions`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.FPDF_GetDocUserPermissions(t.docPtr);return i.resolve(n)}getSignatures(e){this.logger.debug(G,K,`getSignatures`,e),this.logger.perf(G,K,`GetSignatures`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,K,`GetSignatures`,`End`,e.id),i.reject({code:E.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=he(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFSignatureObj_GetContents(r,e,t)),a=he(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFSignatureObj_GetByteRange(r,e,t)*4),o=he(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFSignatureObj_GetSubFilter(r,e,t)),s=I(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFSignatureObj_GetReason(r,e,t),this.pdfiumModule.pdfium.UTF16ToString),c=I(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(G,K,`GetSignatures`,`End`,e.id),i.resolve(n)}getBookmarks(e){this.logger.debug(G,K,`getBookmarks`,e),this.logger.perf(G,K,`GetBookmarks`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,K,`getBookmarks`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let n=this.readPdfBookmarks(t.docPtr,0);return this.logger.perf(G,K,`GetBookmarks`,`End`,e.id),i.resolve({bookmarks:n})}setBookmarks(e,t){this.logger.debug(G,K,`setBookmarks`,e,t),this.logger.perf(G,K,`SetBookmarks`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,K,`SetBookmarks`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});if(!this.pdfiumModule.EPDFBookmark_Clear(n.docPtr))return this.logger.perf(G,K,`SetBookmarks`,`End`,e.id),i.reject({code:E.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},a=r(0,t);return this.logger.perf(G,K,`SetBookmarks`,`End`,e.id),a?i.resolve(!0):i.reject({code:E.Unknown,message:`failed to build bookmark tree`})}deleteBookmarks(e){this.logger.debug(G,K,`deleteBookmarks`,e),this.logger.perf(G,K,`DeleteBookmarks`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,K,`DeleteBookmarks`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.EPDFBookmark_Clear(t.docPtr);return this.logger.perf(G,K,`DeleteBookmarks`,`End`,e.id),n?i.resolve(!0):i.reject({code:E.Unknown,message:`failed to clear bookmarks`})}renderPageRaw(e,t,n){this.logger.debug(G,K,`renderPage`,e,t,n),this.logger.perf(G,K,`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(G,K,`RenderPage`,`End`,`${e.id}-${t.index}`),i}renderPageRect(e,t,n,r){this.logger.debug(G,K,`renderPageRect`,e,t,n,r),this.logger.perf(G,K,`RenderPageRect`,`Begin`,`${e.id}-${t.index}`);let i=this.renderRectEncoded(e,t,n,r);return this.logger.perf(G,K,`RenderPageRect`,`End`,`${e.id}-${t.index}`),i}getDocumentJavaScriptActions(e){this.logger.debug(G,K,`getDocumentJavaScriptActions`,e);let t=this.cache.getContext(e.id);if(!t)return i.reject({code:E.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.FPDFDoc_GetJavaScriptActionCount(t.docPtr);if(n<0)return i.reject({code:E.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=I(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFJavaScriptAction_GetName(n,e,t),this.pdfiumModule.pdfium.UTF16ToString)??``,i=I(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:T.DocumentNamed,name:t,script:i})}finally{this.pdfiumModule.FPDFDoc_CloseJavaScriptAction(n)}}return i.resolve(r)}getPageAnnoWidgets(e,t){this.logger.debug(G,K,`getPageAnnoWidgets`,e,t),this.logger.perf(G,K,`GetPageAnnoWidgets`,`Begin`,`${e.id}-${t.index}`);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,K,`GetPageAnnoWidgets`,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let r=this.readPageAnnoWidgets(e,n,t);return this.logger.perf(G,K,`GetPageAnnoWidgets`,`End`,`${e.id}-${t.index}`),this.logger.debug(G,K,`GetPageAnnoWidgets`,`${e.id}-${t.index}`,r),i.resolve(r)}getPageWidgetJavaScriptActions(e,t){this.logger.debug(G,K,`getPageWidgetJavaScriptActions`,e,t);let n=this.cache.getContext(e.id);if(!n)return i.reject({code:E.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)!==j.WIDGET)return;let i=this.getAnnotString(e,`NM`);i||(i=y(),this.setAnnotString(e,`NM`,i));let a=I(this.pdfiumModule.pdfium,(t,r)=>this.pdfiumModule.FPDFAnnot_GetFormFieldName(n,e,t,r),this.pdfiumModule.pdfium.UTF16ToString)??``,o=[{event:D.KEY_STROKE,eventType:b.Keystroke,trigger:T.WidgetKeystroke},{event:D.FORMAT,eventType:b.Format,trigger:T.WidgetFormat},{event:D.VALIDATE,eventType:b.Validate,trigger:T.WidgetValidate},{event:D.CALCULATE,eventType:b.Calculate,trigger:T.WidgetCalculate}];for(let s of o){let o=I(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})}})})}),i.resolve(r)}regenerateWidgetAppearances(e,t,n){let r=this.cache.getContext(e.id);if(!r)return i.reject({code:E.DocNotOpen,message:`document does not open`});let a=new Set(n),o=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&&a.has(t)&&(this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(e),o++)});o>0&&this.pdfiumModule.FPDFPage_GenerateContent(e.pagePtr)}),i.resolve(o>0)}getPageAnnotations(e,t){this.logger.debug(G,K,`getPageAnnotations`,e,t),this.logger.perf(G,K,`GetPageAnnotations`,`Begin`,`${e.id}-${t.index}`);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,K,`GetPageAnnotations`,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let r=this.readPageAnnotations(e,n,t);return this.logger.perf(G,K,`GetPageAnnotations`,`End`,`${e.id}-${t.index}`),this.logger.debug(G,K,`GetPageAnnotations`,`${e.id}-${t.index}`,r),i.resolve(r)}createPageAnnotation(e,t,n,r){this.logger.debug(G,K,`createPageAnnotation`,e,t,n),this.logger.perf(G,K,`CreatePageAnnotation`,`Begin`,`${e.id}-${t.index}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(G,K,`CreatePageAnnotation`,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let o=a.acquirePage(t.index),s,c,l;if(n.type===j.WIDGET){let e=n;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,n.type);if(!s)return this.logger.perf(G,K,`CreatePageAnnotation`,`End`,`${e.id}-${t.index}`),o.release(),i.reject({code:E.CantCreateAnnot,message:`can not create annotation with specified type`});if(n.id||=y(),!this.setAnnotString(s,`NM`,n.id))return this.pdfiumModule.FPDFPage_CloseAnnot(s),o.release(),i.reject({code:E.CantSetAnnotString,message:`can not set the name of the annotation`});if(!this.setPageAnnoRect(e,t,s,n.rect))return this.pdfiumModule.FPDFPage_CloseAnnot(s),o.release(),this.logger.perf(G,K,`CreatePageAnnotation`,`End`,`${e.id}-${t.index}`),i.reject({code:E.CantSetAnnotRect,message:`can not set the rect of the annotation`});let u=this.prepareAnnotationForSave(n),d=!1;switch(u.type){case j.INK:d=this.addInkStroke(e,t,o.pagePtr,s,u);break;case j.STAMP:d=this.addStampContent(e,a.docPtr,t,o.pagePtr,s,u,r);break;case j.TEXT:d=this.addTextContent(e,t,o.pagePtr,s,u);break;case j.FREETEXT:d=this.addFreeTextContent(e,t,o.pagePtr,s,u);break;case j.LINE:d=this.addLineContent(e,t,o.pagePtr,s,u);break;case j.POLYLINE:case j.POLYGON:d=this.addPolyContent(e,t,o.pagePtr,s,u);break;case j.CIRCLE:case j.SQUARE:d=this.addShapeContent(e,t,o.pagePtr,s,u);break;case j.UNDERLINE:case j.STRIKEOUT:case j.SQUIGGLY:case j.HIGHLIGHT:d=this.addTextMarkupContent(e,t,o.pagePtr,s,u);break;case j.LINK:d=this.addLinkContent(e,t,a.docPtr,o.pagePtr,s,u);break;case j.CARET:d=this.addCaretContent(e,t,o.pagePtr,s,u);break;case j.REDACT:d=this.addRedactContent(e,t,o.pagePtr,s,u);break;case j.WIDGET:{let e=u;if(l!==void 0)switch(e.field.type){case A.TEXTFIELD:d=this.addTextFieldContent(l,s,e);break;case A.CHECKBOX:case A.RADIOBUTTON:d=this.addToggleFieldContent(l,s,e);break;case A.COMBOBOX:case A.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?(n.type===j.WIDGET?this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(s):n.blendMode===void 0?this.pdfiumModule.EPDFAnnot_GenerateAppearance(s):this.pdfiumModule.EPDFAnnot_GenerateAppearanceWithBlend(s,n.blendMode),this.pdfiumModule.FPDFPage_GenerateContent(o.pagePtr),this.pdfiumModule.FPDFPage_CloseAnnot(s),o.release(),this.logger.perf(G,K,`CreatePageAnnotation`,`End`,`${e.id}-${t.index}`),i.resolve(n.id)):(this.removeAnnotationByName(o.pagePtr,n.id),this.pdfiumModule.FPDFPage_CloseAnnot(s),o.release(),this.logger.perf(G,K,`CreatePageAnnotation`,`End`,`${e.id}-${t.index}`),i.reject({code:E.CantSetAnnotContent,message:`can not add content of the annotation`}))}updatePageAnnotation(e,t,n,r){this.logger.debug(G,K,`updatePageAnnotation`,e,t,n),this.logger.perf(G,K,`UpdatePageAnnotation`,`Begin`,`${e.id}-${t.index}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(G,K,`UpdatePageAnnotation`,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let o=a.acquirePage(t.index),s=this.getAnnotationByName(o.pagePtr,n.id);if(!s)return o.release(),this.logger.perf(G,K,`UpdatePageAnnotation`,`End`,`${e.id}-${t.index}`),i.reject({code:E.NotFound,message:`annotation not found`});if(!this.setPageAnnoRect(e,t,s,n.rect))return this.pdfiumModule.FPDFPage_CloseAnnot(s),o.release(),this.logger.perf(G,K,`UpdatePageAnnotation`,`End`,`${e.id}-${t.index}`),i.reject({code:E.CantSetAnnotRect,message:`failed to move annotation`});let c=this.prepareAnnotationForSave(n),l=!1;switch(c.type){case j.INK:if(!this.pdfiumModule.FPDFAnnot_RemoveInkList(s))break;l=this.addInkStroke(e,t,o.pagePtr,s,c);break;case j.STAMP:l=this.addStampContent(e,a.docPtr,t,o.pagePtr,s,c);break;case j.TEXT:l=this.addTextContent(e,t,o.pagePtr,s,c);break;case j.FREETEXT:l=this.addFreeTextContent(e,t,o.pagePtr,s,c);break;case j.CIRCLE:case j.SQUARE:l=this.addShapeContent(e,t,o.pagePtr,s,c);break;case j.LINE:l=this.addLineContent(e,t,o.pagePtr,s,c);break;case j.POLYGON:case j.POLYLINE:l=this.addPolyContent(e,t,o.pagePtr,s,c);break;case j.HIGHLIGHT:case j.UNDERLINE:case j.STRIKEOUT:case j.SQUIGGLY:l=this.addTextMarkupContent(e,t,o.pagePtr,s,c);break;case j.LINK:l=this.addLinkContent(e,t,a.docPtr,o.pagePtr,s,c);break;case j.CARET:l=this.addCaretContent(e,t,o.pagePtr,s,c);break;case j.REDACT:l=this.addRedactContent(e,t,o.pagePtr,s,c);break;case j.WIDGET:{let e=c;o.withFormHandle(t=>{switch(e.field.type){case A.TEXTFIELD:l=this.addTextFieldContent(t,s,e);break;case A.CHECKBOX:case A.RADIOBUTTON:l=this.addToggleFieldContent(t,s,e);break;case A.COMBOBOX:case A.LISTBOX:l=this.addChoiceFieldContent(t,s,e)}});break}default:l=!1}return l&&r?.regenerateAppearance!==!1&&(n.type===j.WIDGET?this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(s):n.blendMode===void 0?this.pdfiumModule.EPDFAnnot_GenerateAppearance(s):this.pdfiumModule.EPDFAnnot_GenerateAppearanceWithBlend(s,n.blendMode),this.pdfiumModule.FPDFPage_GenerateContent(o.pagePtr)),this.pdfiumModule.FPDFPage_CloseAnnot(s),o.release(),this.logger.perf(G,K,`UpdatePageAnnotation`,`End`,`${e.id}-${t.index}`),l?i.resolve(!0):i.reject({code:E.CantSetAnnotContent,message:`failed to update annotation`})}removePageAnnotation(e,t,n){this.logger.debug(G,K,`removePageAnnotation`,e,t,n),this.logger.perf(G,K,`RemovePageAnnotation`,`Begin`,`${e.id}-${t.index}`);let r=this.cache.getContext(e.id);if(!r)return this.logger.perf(G,K,`RemovePageAnnotation`,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let a=r.acquirePage(t.index),o=!1;return o=this.removeAnnotationByName(a.pagePtr,n.id),o?(o=this.pdfiumModule.FPDFPage_GenerateContent(a.pagePtr),o||this.logger.error(G,K,`FPDFPage_GenerateContent Failed`,`${e.id}-${t.index}`)):this.logger.error(G,K,`FPDFPage_RemoveAnnot Failed`,`${e.id}-${t.index}`),a.release(),this.logger.perf(G,K,`RemovePageAnnotation`,`End`,`${e.id}-${t.index}`),i.resolve(o)}getPageTextRects(e,t){this.logger.debug(G,K,`getPageTextRects`,e,t),this.logger.perf(G,K,`GetPageTextRects`,`Begin`,`${e.id}-${t.index}`);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,K,`GetPageTextRects`,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let r=n.acquirePage(t.index),a=this.pdfiumModule.FPDFText_LoadPage(r.pagePtr),o=this.readPageTextRects(t,r.docPtr,r.pagePtr,a);return this.pdfiumModule.FPDFText_ClosePage(a),r.release(),this.logger.perf(G,K,`GetPageTextRects`,`End`,`${e.id}-${t.index}`),i.resolve(o)}renderThumbnailRaw(e,t,n){let{scaleFactor:r=1,...a}=n??{};if(this.logger.debug(G,K,`renderThumbnail`,e,t,n),this.logger.perf(G,K,`RenderThumbnail`,`Begin`,`${e.id}-${t.index}`),!this.cache.getContext(e.id))return this.logger.perf(G,K,`RenderThumbnail`,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let o=this.renderPageRaw(e,t,{scaleFactor:Math.max(r,.5),...a});return this.logger.perf(G,K,`RenderThumbnail`,`End`,`${e.id}-${t.index}`),o}getAttachments(e){this.logger.debug(G,K,`getAttachments`,e),this.logger.perf(G,K,`GetAttachments`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,K,`GetAttachments`,`End`,e.id),i.reject({code:E.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(G,K,`GetAttachments`,`End`,e.id),i.resolve(n)}addAttachment(e,t){this.logger.debug(G,K,`addAttachment`,e,t?.name),this.logger.perf(G,K,`AddAttachment`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,K,`AddAttachment`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let{name:r,description:a,mimeType:o,data:s}=t??{};if(!r)return this.logger.perf(G,K,`AddAttachment`,`End`,e.id),i.reject({code:E.NotFound,message:`attachment name is required`});if(!s||(s instanceof Uint8Array,s.byteLength===0))return this.logger.perf(G,K,`AddAttachment`,`End`,e.id),i.reject({code:E.NotFound,message:`attachment data is empty`});let c=this.withWString(r,e=>this.pdfiumModule.FPDFDoc_AddAttachment(n.docPtr,e));if(!c)return this.logger.perf(G,K,`AddAttachment`,`End`,e.id),i.reject({code:E.Unknown,message:`An attachment named "${r}" already exists`});this.withWString(a,e=>this.pdfiumModule.EPDFAttachment_SetDescription(c,e)),this.pdfiumModule.EPDFAttachment_SetSubtype(c,o);let l=s instanceof Uint8Array?s:new Uint8Array(s),u=l.byteLength,d=this.memoryManager.malloc(u);try{if(this.pdfiumModule.pdfium.HEAPU8.set(l,d),!this.pdfiumModule.FPDFAttachment_SetFile(c,n.docPtr,d,u))return this.logger.perf(G,K,`AddAttachment`,`End`,e.id),i.reject({code:E.Unknown,message:`failed to write attachment bytes`})}finally{this.memoryManager.free(d)}return this.logger.perf(G,K,`AddAttachment`,`End`,e.id),i.resolve(!0)}removeAttachment(e,t){this.logger.debug(G,K,`deleteAttachment`,e,t),this.logger.perf(G,K,`DeleteAttachment`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,K,`DeleteAttachment`,`End`,e.id),i.reject({code:E.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(G,K,`DeleteAttachment`,`End`,e.id),i.reject({code:E.Unknown,message:`attachment index ${t.index} out of range`});let a=this.pdfiumModule.FPDFDoc_DeleteAttachment(n.docPtr,t.index);return this.logger.perf(G,K,`DeleteAttachment`,`End`,e.id),a?i.resolve(!0):i.reject({code:E.Unknown,message:`failed to delete attachment`})}readAttachmentContent(e,t){this.logger.debug(G,K,`readAttachmentContent`,e,t),this.logger.perf(G,K,`ReadAttachmentContent`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,K,`ReadAttachmentContent`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let r=this.pdfiumModule.FPDFDoc_GetAttachment(n.docPtr,t.index),a=this.memoryManager.malloc(4);if(!this.pdfiumModule.FPDFAttachment_GetFile(r,0,0,a))return this.memoryManager.free(a),this.logger.perf(G,K,`ReadAttachmentContent`,`End`,e.id),i.reject({code:E.CantReadAttachmentSize,message:`can not read attachment size`});let o=this.pdfiumModule.pdfium.getValue(a,`i32`)>>>0,s=this.memoryManager.malloc(o);if(!this.pdfiumModule.FPDFAttachment_GetFile(r,s,o,a))return this.memoryManager.free(a),this.memoryManager.free(s),this.logger.perf(G,K,`ReadAttachmentContent`,`End`,e.id),i.reject({code:E.CantReadAttachmentContent,message:`can not read attachment content`});let c=new ArrayBuffer(o),l=new DataView(c);for(let e=0;e<o;e++)l.setInt8(e,this.pdfiumModule.pdfium.getValue(s+e,`i8`));return this.memoryManager.free(a),this.memoryManager.free(s),this.logger.perf(G,K,`ReadAttachmentContent`,`End`,e.id),i.resolve(c)}setFormFieldValue(e,t,n,r){this.logger.debug(G,K,`SetFormFieldValue`,e,n,r),this.logger.perf(G,K,`SetFormFieldValue`,`Begin`,`${e.id}-${n.id}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.debug(G,K,`SetFormFieldValue`,`document is not opened`),this.logger.perf(G,K,`SetFormFieldValue`,`End`,`${e.id}-${n.id}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let o=a.acquirePage(t.index);try{return o.withFormHandle(e=>{let t=this.getAnnotationByName(o.pagePtr,n.id);if(!t)return i.reject({code:E.NotFound,message:`annotation not found`});try{if(!this.pdfiumModule.FORM_SetFocusedAnnot(e,t))return i.reject({code:E.CantFocusAnnot,message:`failed to set focused annotation`});switch(r.kind){case`text`:{if(!this.pdfiumModule.FORM_SelectAllText(e,o.pagePtr))return this.pdfiumModule.FORM_ForceToKillFocus(e),i.reject({code:E.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,o.pagePtr,n),this.memoryManager.free(n);break}case`selection`:if(!this.pdfiumModule.FORM_SetIndexSelected(e,o.pagePtr,r.index,r.isSelected))return this.pdfiumModule.FORM_ForceToKillFocus(e),i.reject({code:E.CantSelectOption,message:`failed to set index selected`});break;case`checked`:if(!!this.pdfiumModule.FPDFAnnot_IsChecked(e,t)!==r.checked&&!this.pdfiumModule.FORM_OnChar(e,o.pagePtr,13,0))return this.pdfiumModule.FORM_ForceToKillFocus(e),i.reject({code:E.CantCheckField,message:`failed to set field checked`})}return this.pdfiumModule.FORM_ForceToKillFocus(e),this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(t),i.resolve(!0)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(t)}})}finally{o.release()}}setFormFieldState(e,t,n,r){this.logger.debug(G,K,`SetFormFieldState`,e,n,r),this.logger.perf(G,K,`SetFormFieldState`,`Begin`,`${e.id}-${n.id}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.debug(G,K,`SetFormFieldState`,`document is not opened`),this.logger.perf(G,K,`SetFormFieldState`,`End`,`${e.id}-${n.id}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let o=a.acquirePage(t.index);try{return o.withFormHandle(t=>{let a=this.getAnnotationByName(o.pagePtr,n.id);if(!a)return i.reject({code:E.NotFound,message:`annotation not found`});try{if(!this.pdfiumModule.FORM_SetFocusedAnnot(t,a))return i.reject({code:E.CantFocusAnnot,message:`failed to set focused annotation`});switch(r.type){case A.TEXTFIELD:{if(!this.pdfiumModule.FORM_SelectAllText(t,o.pagePtr))return this.pdfiumModule.FORM_ForceToKillFocus(t),i.reject({code:E.CantSelectText,message:`failed to select all text`});let e=2*(r.value.length+1),n=this.memoryManager.malloc(e);this.pdfiumModule.pdfium.stringToUTF16(r.value,n,e),this.pdfiumModule.FORM_ReplaceSelection(t,o.pagePtr,n),this.memoryManager.free(n);break}case A.CHECKBOX:case A.RADIOBUTTON:if(!!this.pdfiumModule.FPDFAnnot_IsChecked(t,a)!=(n.exportValue!=null&&r.value===n.exportValue)&&!this.pdfiumModule.FORM_OnChar(t,o.pagePtr,13,0))return this.pdfiumModule.FORM_ForceToKillFocus(t),i.reject({code:E.CantCheckField,message:`failed to set field checked`});break;case A.COMBOBOX:{let e=r.options.findIndex(e=>e.isSelected);if(e>=0&&!this.pdfiumModule.FORM_SetIndexSelected(t,o.pagePtr,e,!0))return this.pdfiumModule.FORM_ForceToKillFocus(t),i.reject({code:E.CantSelectOption,message:`failed to set index selected`});break}case A.LISTBOX:for(let e=0;e<r.options.length;e++)if(!this.pdfiumModule.FORM_SetIndexSelected(t,o.pagePtr,e,r.options[e].isSelected))return this.pdfiumModule.FORM_ForceToKillFocus(t),i.reject({code:E.CantSelectOption,message:`failed to set index selected`})}return this.pdfiumModule.FORM_ForceToKillFocus(t),r.type!==A.CHECKBOX&&r.type!==A.RADIOBUTTON&&this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(a),this.logger.perf(G,K,`SetFormFieldState`,`End`,`${e.id}-${n.id}`),i.resolve(!0)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(a)}})}finally{o.release()}}renameWidgetField(e,t,n,r){this.logger.debug(G,K,`RenameWidgetField`,e,n,r),this.logger.perf(G,K,`RenameWidgetField`,`Begin`,`${e.id}-${n.id}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(G,K,`RenameWidgetField`,`End`,`${e.id}-${n.id}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let o=a.acquirePage(t.index);try{return o.withFormHandle(t=>{let a=this.getAnnotationByName(o.pagePtr,n.id);if(!a)return i.reject({code:E.NotFound,message:`annotation not found`});try{return this.withWString(r,e=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(t,a,e))?(this.logger.perf(G,K,`RenameWidgetField`,`End`,`${e.id}-${n.id}`),i.resolve(!0)):i.reject({code:E.CantSetAnnotString,message:`failed to rename widget field`})}finally{this.pdfiumModule.FPDFPage_CloseAnnot(a)}})}finally{o.release()}}shareWidgetField(e,t,n,r,a){this.logger.debug(G,K,`ShareWidgetField`,e,n,a),this.logger.perf(G,K,`ShareWidgetField`,`Begin`,`${e.id}-${n.id}-${a.id}`);let o=this.cache.getContext(e.id);if(!o)return this.logger.perf(G,K,`ShareWidgetField`,`End`,`${e.id}-${n.id}-${a.id}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let s=o.acquirePage(t.index),c=r.index===t.index?s:o.acquirePage(r.index);try{return s.withFormHandle(t=>{let r=!1;c!==s&&(this.pdfiumModule.FORM_OnAfterLoadPage(c.pagePtr,t),r=!0);let o=this.getAnnotationByName(s.pagePtr,n.id),l=this.getAnnotationByName(c.pagePtr,a.id);if(!o||!l)return o&&this.pdfiumModule.FPDFPage_CloseAnnot(o),l&&this.pdfiumModule.FPDFPage_CloseAnnot(l),r&&this.pdfiumModule.FORM_OnBeforeClosePage(c.pagePtr,t),i.reject({code:E.NotFound,message:`annotation not found`});try{return this.pdfiumModule.EPDFAnnot_ShareFormField(t,o,l)?(this.logger.perf(G,K,`ShareWidgetField`,`End`,`${e.id}-${n.id}-${a.id}`),i.resolve(!0)):i.reject({code:E.Unknown,message:`failed to share widget field`})}finally{this.pdfiumModule.FPDFPage_CloseAnnot(o),this.pdfiumModule.FPDFPage_CloseAnnot(l),r&&this.pdfiumModule.FORM_OnBeforeClosePage(c.pagePtr,t)}})}finally{s.release(),c!==s&&c.release()}}flattenPage(e,t,n){let{flag:r=ne.Display}=n??{};this.logger.debug(G,K,`flattenPage`,e,t,r),this.logger.perf(G,K,`flattenPage`,`Begin`,e.id);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(G,K,`flattenPage`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let o=a.acquirePage(t.index),s=this.pdfiumModule.FPDFPage_Flatten(o.pagePtr,r);return o.release(),this.logger.perf(G,K,`flattenPage`,`End`,e.id),i.resolve(s)}extractPages(e,t){this.logger.debug(G,K,`extractPages`,e,t),this.logger.perf(G,K,`ExtractPages`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,K,`ExtractPages`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let r=this.pdfiumModule.FPDF_CreateNewDocument();if(!r)return this.logger.perf(G,K,`ExtractPages`,`End`,e.id),i.reject({code:E.CantCreateNewDoc,message:`can not create new document`});let a=this.memoryManager.malloc(t.length*4);for(let e=0;e<t.length;e++)this.pdfiumModule.pdfium.setValue(a+e*4,t[e],`i32`);if(!this.pdfiumModule.FPDF_ImportPagesByIndex(r,n.docPtr,a,t.length,0))return this.pdfiumModule.FPDF_CloseDocument(r),this.logger.perf(G,K,`ExtractPages`,`End`,e.id),i.reject({code:E.CantImportPages,message:`can not import pages to new document`});let o=this.saveDocument(r);return this.pdfiumModule.FPDF_CloseDocument(r),this.logger.perf(G,K,`ExtractPages`,`End`,e.id),i.resolve(o)}importPages(e,t,n,r){this.logger.debug(G,K,`importPages`,e.id,t.id,n),this.logger.perf(G,K,`ImportPages`,`Begin`,e.id);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(G,K,`ImportPages`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`destination document is not open`});let o=this.cache.getContext(t.id);if(!o)return this.logger.perf(G,K,`ImportPages`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`source document is not open`});let s=r??this.pdfiumModule.FPDF_GetPageCount(a.docPtr),c=this.memoryManager.malloc(n.length*4);for(let e=0;e<n.length;e++)this.pdfiumModule.pdfium.setValue(c+e*4,n[e],`i32`);if(!this.pdfiumModule.FPDF_ImportPagesByIndex(a.docPtr,o.docPtr,c,n.length,s))return this.memoryManager.free(c),this.logger.perf(G,K,`ImportPages`,`End`,e.id),i.reject({code:E.CantImportPages,message:`can not import pages into destination document`});this.memoryManager.free(c);let l=[],u=this.memoryManager.malloc(8),d=a.normalizeRotation;for(let t=0;t<n.length;t++){let n=s+t;if(!(d?this.pdfiumModule.EPDF_GetPageSizeByIndexNormalized(a.docPtr,n,u):this.pdfiumModule.FPDF_GetPageSizeByIndexF(a.docPtr,n,u)))return this.memoryManager.free(u),this.logger.perf(G,K,`ImportPages`,`End`,e.id),i.reject({code:E.Unknown,message:`failed to read metadata for imported page ${n}`});let r=this.pdfiumModule.EPDF_GetPageRotationByIndex(a.docPtr,n),o=this.pdfiumModule.EPDFDoc_GetPageObjectNumberByIndex(a.docPtr,n);l.push({index:n,size:{width:this.pdfiumModule.pdfium.getValue(u,`float`),height:this.pdfiumModule.pdfium.getValue(u+4,`float`)},rotation:r,objectNumber:o})}return this.memoryManager.free(u),this.logger.perf(G,K,`ImportPages`,`End`,e.id),i.resolve(l)}deletePage(e,t){this.logger.debug(G,K,`deletePage`,e.id,t),this.logger.perf(G,K,`DeletePage`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,K,`DeletePage`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document is not open`});let r=this.pdfiumModule.FPDF_GetPageCount(n.docPtr);return t<0||t>=r?(this.logger.perf(G,K,`DeletePage`,`End`,e.id),i.reject({code:E.CantDeletePage,message:`page index ${t} out of range (0..${r-1})`})):(this.pdfiumModule.FPDFPage_Delete(n.docPtr,t),this.logger.perf(G,K,`DeletePage`,`End`,e.id),i.resolve(!0))}extractText(e,t){this.logger.debug(G,K,`extractText`,e,t),this.logger.perf(G,K,`ExtractText`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,K,`ExtractText`,`End`,e.id),i.reject({code:E.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((o+1)*2);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 a=r.join(`
4
+
5
+ `);return this.logger.perf(G,K,`ExtractText`,`End`,e.id),i.resolve(a)}getTextSlices(e,t){if(this.logger.debug(G,K,`getTextSlices`,e,t),this.logger.perf(G,K,`GetTextSlices`,`Begin`,e.id),t.length===0)return this.logger.perf(G,K,`GetTextSlices`,`End`,e.id),i.resolve([]);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,K,`GetTextSlices`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});try{let r=Array(t.length),a=/* @__PURE__ */ new Map;t.forEach((e,t)=>{(a.get(e.pageIndex)??a.set(e.pageIndex,[]).get(e.pageIndex)).push({slice:e,pos:t})});for(let[e,t]of a){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]=c(this.pdfiumModule.pdfium.UTF16ToString(t)),this.memoryManager.free(t)}i.release()}return this.logger.perf(G,K,`GetTextSlices`,`End`,e.id),i.resolve(r)}catch(t){return this.logger.error(G,K,`getTextSlices error`,t),this.logger.perf(G,K,`GetTextSlices`,`End`,e.id),i.reject({code:E.Unknown,message:String(t)})}}merge(e){this.logger.debug(G,K,`merge`,e);let t=e.map(e=>e.id).join(`.`);this.logger.perf(G,K,`Merge`,`Begin`,t);let n=this.pdfiumModule.FPDF_CreateNewDocument();if(!n)return this.logger.perf(G,K,`Merge`,`End`,t),i.reject({code:E.CantCreateNewDoc,message:`can not create new document`});let r=[];for(let a of e.reverse()){let e=new Uint8Array(a.content),o=e.length,s=this.memoryManager.malloc(o);this.pdfiumModule.pdfium.HEAPU8.set(e,s);let c=this.pdfiumModule.FPDF_LoadMemDocument(s,o,``);if(!c){let e=this.pdfiumModule.FPDF_GetLastError();this.logger.error(G,K,`FPDF_LoadMemDocument failed with ${e}`),this.memoryManager.free(s);for(let e of r)this.pdfiumModule.FPDF_CloseDocument(e.docPtr),this.memoryManager.free(e.filePtr);return this.logger.perf(G,K,`Merge`,`End`,t),i.reject({code:e,message:`FPDF_LoadMemDocument failed`})}if(r.push({filePtr:s,docPtr:c}),!this.pdfiumModule.FPDF_ImportPages(n,c,``,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(G,K,`Merge`,`End`,t),i.reject({code:E.CantImportPages,message:`can not import pages to new document`})}}let a=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 o={id:`${Math.random()}`,content:a};return this.logger.perf(G,K,`Merge`,`End`,t),i.resolve(o)}mergePages(e){let t=e.map(e=>`${e.docId}:${e.pageIndices.join(`,`)}`).join(`|`);this.logger.debug(G,K,`mergePages`,e),this.logger.perf(G,K,`MergePages`,`Begin`,t);let n=this.pdfiumModule.FPDF_CreateNewDocument();if(!n)return this.logger.perf(G,K,`MergePages`,`End`,t),i.reject({code:E.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(G,K,`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),a={id:`${Math.random()}`,content:r};return this.logger.perf(G,K,`MergePages`,`End`,t),i.resolve(a)}catch(e){return this.logger.error(G,K,`mergePages failed`,e),this.logger.perf(G,K,`MergePages`,`End`,t),i.reject({code:E.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(G,K,`setDocumentEncryption`,e,r);let a=this.cache.getContext(e.id);if(!a)return i.reject({code:E.DocNotOpen,message:`document does not open`});let o=this.pdfiumModule.EPDF_SetEncryption(a.docPtr,t,n,r);return i.resolve(o)}removeEncryption(e){this.logger.debug(G,K,`removeEncryption`,e);let t=this.cache.getContext(e.id);if(!t)return i.reject({code:E.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.EPDF_RemoveEncryption(t.docPtr);return i.resolve(n)}unlockOwnerPermissions(e,t){this.logger.debug(G,K,`unlockOwnerPermissions`,e.id);let n=this.cache.getContext(e.id);if(!n)return i.reject({code:E.DocNotOpen,message:`document does not open`});let r=this.pdfiumModule.EPDF_UnlockOwnerPermissions(n.docPtr,t);return i.resolve(r)}isEncrypted(e){this.logger.debug(G,K,`isEncrypted`,e.id);let t=this.cache.getContext(e.id);if(!t)return i.reject({code:E.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.EPDF_IsEncrypted(t.docPtr);return i.resolve(n)}isOwnerUnlocked(e){this.logger.debug(G,K,`isOwnerUnlocked`,e.id);let t=this.cache.getContext(e.id);if(!t)return i.reject({code:E.DocNotOpen,message:`document does not open`});let n=this.pdfiumModule.EPDF_IsOwnerUnlocked(t.docPtr);return i.resolve(n)}saveAsCopy(e){this.logger.debug(G,K,`saveAsCopy`,e),this.logger.perf(G,K,`SaveAsCopy`,`Begin`,e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,K,`SaveAsCopy`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let n=this.saveDocument(t.docPtr);return this.logger.perf(G,K,`SaveAsCopy`,`End`,e.id),i.resolve(n)}closeDocument(e){return this.logger.debug(G,K,`closeDocument`,e),this.logger.perf(G,K,`CloseDocument`,`Begin`,e.id),this.cache.closeDocument(e.id),this.logger.perf(G,K,`CloseDocument`,`End`,e.id),i.resolve(!0)}closeAllDocuments(){return this.logger.debug(G,K,`closeAllDocuments`),this.logger.perf(G,K,`CloseAllDocuments`,`Begin`),this.cache.closeAllDocuments(),this.logger.perf(G,K,`CloseAllDocuments`,`End`),i.resolve(!0)}addTextContent(e,t,n,r,i){if(!this.setAnnotationName(r,i.name??i.icon??C.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,k.Color)||!i.flags&&!this.setAnnotationFlags(r,[`print`,`noZoom`,`noRotate`])?!1:this.applyBaseAnnotationProperties(e,t,n,r,i)}addCaretContent(e,t,n,r,i){return i.strokeColor&&this.setAnnotationColor(r,i.strokeColor,k.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,S.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===h.Unknown?h.Helvetica:i.fontFamily,i.fontSize,a)||(i.strokeColor&&i.strokeColor!==i.fontColor&&this.setAnnotationColor(r,i.fontColor,k.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,P.None,i.lineEnding))return!1;let o=i.color??i.backgroundColor;if(!o||o===`transparent`){if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,k.Color))return!1}else if(!this.setAnnotationColor(r,o??`#FFFFFF`,k.Color))return!1;return this.setRectangleDifferences(r,i.rectangleDifferences),this.applyBaseAnnotationProperties(e,t,n,r,i)}addTextFieldContent(e,t,n){if(!this.setAnnotationDefaultAppearance(t,n.fontFamily,n.fontSize,n.fontColor)||!this.setBorderStyle(t,S.SOLID,n.strokeWidth??1))return!1;n.strokeColor&&n.strokeColor!==`transparent`?this.setMKColor(t,0,n.strokeColor):this.clearMKColor(t,0),n.color&&n.color!==`transparent`?this.setMKColor(t,1,n.color):this.clearMKColor(t,1);let r=n.field.flag??x.NONE;this.pdfiumModule.FPDFAnnot_SetFormFieldFlags(e,t,r),n.field.name&&this.withWString(n.field.name,n=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(e,t,n)),this.withWString(n.field.value??``,n=>this.pdfiumModule.EPDFAnnot_SetFormFieldValue(e,t,n));let i=n.field;return i.maxLen!=null&&i.maxLen>0&&this.pdfiumModule.EPDFAnnot_SetNumberValue(t,`MaxLen`,i.maxLen),!0}addToggleFieldContent(e,t,n){if(!this.setBorderStyle(t,S.SOLID,n.strokeWidth??1))return!1;n.strokeColor&&n.strokeColor!==`transparent`?this.setMKColor(t,0,n.strokeColor):this.clearMKColor(t,0),n.color&&n.color!==`transparent`?this.setMKColor(t,1,n.color):this.clearMKColor(t,1);let r=n.field.flag??x.NONE;return n.field.type===A.RADIOBUTTON&&(r|=x.BUTTON_RADIO|x.BUTTON_NOTOGGLETOOFF),this.pdfiumModule.FPDFAnnot_SetFormFieldFlags(e,t,r),n.field.name&&this.withWString(n.field.name,n=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(e,t,n)),!0}addChoiceFieldContent(e,t,n){if(!this.setAnnotationDefaultAppearance(t,n.fontFamily,n.fontSize,n.fontColor)||!this.setBorderStyle(t,S.SOLID,n.strokeWidth??1))return!1;n.strokeColor&&n.strokeColor!==`transparent`?this.setMKColor(t,0,n.strokeColor):this.clearMKColor(t,0),n.color&&n.color!==`transparent`?this.setMKColor(t,1,n.color):this.clearMKColor(t,1);let r=n.field.flag??x.NONE;n.field.type===A.COMBOBOX&&(r|=1<<17),this.pdfiumModule.FPDFAnnot_SetFormFieldFlags(e,t,r),n.field.name&&this.withWString(n.field.name,n=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(e,t,n));let i=n.field.options??[];if(i.length>0){let n=this.memoryManager.malloc(i.length*4),r=[];try{for(let e=0;e<i.length;e++){let t=i[e].label,a=(t.length+1)*2,o=this.memoryManager.malloc(a);this.pdfiumModule.pdfium.stringToUTF16(t,o,a),r.push(o),this.pdfiumModule.pdfium.setValue(n+e*4,o,`*`)}this.pdfiumModule.EPDFAnnot_SetFormFieldOptions(e,t,n,i.length)}finally{for(let e of r)this.memoryManager.free(R(e));this.memoryManager.free(n)}}let a=i.find(e=>e.isSelected)?.label??n.field.value??``;return this.withWString(a,n=>this.pdfiumModule.EPDFAnnot_SetFormFieldValue(e,t,n)),!0}setMKColor(e,t,n){let{red:r,green:i,blue:a}=p(n);return this.pdfiumModule.EPDFAnnot_SetMKColor(e,t,r&255,i&255,a&255)}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=this.pdfiumModule.pdfium.getValue(n,`i32`)&255,o=this.pdfiumModule.pdfium.getValue(r,`i32`)&255,s=this.pdfiumModule.pdfium.getValue(i,`i32`)&255;return m({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,S.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,k.Color)?this.applyBaseAnnotationProperties(e,t,n,r,i):!1}addLineContent(e,t,n,r,i){if(!this.setLinePoints(e,t,r,i.linePoints.start,i.linePoints.end)||!this.setLineEndings(r,i.lineEndings?.start??P.None,i.lineEndings?.end??P.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.pdfiumModule.EPDFAnnot_ClearColor(r,k.InteriorColor))return!1}else if(!this.setAnnotationColor(r,i.color??`#FFFF00`,k.InteriorColor))return!1;return!this.setAnnotationOpacity(r,i.opacity??1)||!this.setAnnotationColor(r,i.strokeColor??`#FFFF00`,k.Color)?!1:this.applyBaseAnnotationProperties(e,t,n,r,i)}addPolyContent(e,t,n,r,i){if(i.type===j.POLYLINE&&!this.setLineEndings(r,i.lineEndings?.start??P.None,i.lineEndings?.end??P.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.pdfiumModule.EPDFAnnot_ClearColor(r,k.InteriorColor))return!1}else if(!this.setAnnotationColor(r,i.color??`#FFFF00`,k.InteriorColor))return!1;if(!this.setAnnotationOpacity(r,i.opacity??1)||!this.setAnnotationColor(r,i.strokeColor??`#FFFF00`,k.Color))return!1;if(i.type===j.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??S.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,k.Color)||a.target&&!this.applyLinkTarget(n,i,a.target)?!1: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.pdfiumModule.EPDFAnnot_ClearColor(r,k.InteriorColor))return!1}else if(!this.setAnnotationColor(r,i.color??`#FFFF00`,k.InteriorColor))return!1;return!this.setAnnotationOpacity(r,i.opacity??1)||!this.setAnnotationColor(r,i.strokeColor??`#FFFF00`,k.Color)?!1:(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,k.Color)?this.applyBaseAnnotationProperties(e,t,n,r,i):!1}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.pdfiumModule.EPDFAnnot_ClearColor(r,k.InteriorColor))return!1}else if(!this.setAnnotationColor(r,i.color,k.InteriorColor))return!1;if(!i.overlayColor||i.overlayColor===`transparent`){if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,k.OverlayColor))return!1}else if(!this.setAnnotationColor(r,i.overlayColor,k.OverlayColor))return!1;if(!i.strokeColor||i.strokeColor===`transparent`){if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,k.Color))return!1}else if(!this.setAnnotationColor(r,i.strokeColor,k.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===h.Unknown?h.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)?!1:this.applyBaseAnnotationProperties(e,t,n,r,i)}addStampContent(e,t,n,r,i,a,o){let s=a.name??a.icon;if(s&&!this.setAnnotationName(i,s))return!1;if(o&&`data`in o&&o.data){let s=d(o.data);if(!s)return!1;if(s.mimeType===`application/pdf`){if(!this.setAppearanceFromPdf(t,i,o.data))return!1}else{for(let e=this.pdfiumModule.FPDFAnnot_GetObjectCount(i)-1;e>=0;e--)this.pdfiumModule.FPDFAnnot_RemoveObject(i,e);if(s.mimeType===`image/png`){if(!this.addPngImageObject(e,t,n,r,i,a.rect,o.data))return!1}else if(s.mimeType===`image/jpeg`&&!this.addJpegImageObject(e,t,n,r,i,a.rect,o.data))return!1}}else if(o&&`imageData`in o&&o.imageData){for(let e=this.pdfiumModule.FPDFAnnot_GetObjectCount(i)-1;e>=0;e--)this.pdfiumModule.FPDFAnnot_RemoveObject(i,e);if(!this.addImageObject(e,t,n,r,i,a.rect,o.imageData))return!1}else if(o&&`appearance`in o&&o.appearance&&!this.setAppearanceFromPdf(t,i,o.appearance))return!1;return this.applyBaseAnnotationProperties(e,n,r,i,a)?!!this.pdfiumModule.EPDFAnnot_UpdateAppearanceToRect(i,re.Cover):!1}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[e*4],n=o.data[e*4+1],r=o.data[e*4+2],i=o.data[e*4+3];this.pdfiumModule.pdfium.setValue(c+e*4,r,`i8`),this.pdfiumModule.pdfium.setValue(c+e*4+1,n,`i8`),this.pdfiumModule.pdfium.setValue(c+e*4+2,t,`i8`),this.pdfiumModule.pdfium.setValue(c+e*4+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)?!0:(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)?!0:(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?``:I(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?``:I(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 F.NotSet:case F.True:case F.False:case F.Unknown:return t;default:return F.Unknown}}setMetaTrapped(e,t){let n=t==null||t===void 0?F.NotSet:t;return n!==F.NotSet&&n!==F.True&&n!==F.False&&n!==F.Unknown?!1:!!this.pdfiumModule.EPDF_SetMetaTrapped(e,n)}getMetaKeyCount(e,t){return Number(this.pdfiumModule.EPDF_GetMetaKeyCount(e,t))|0}getMetaKeyName(e,t,n){let r=this.pdfiumModule.EPDF_GetMetaKeyName(e,t,n,0,0);return r?I(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=I(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=(v+1)*2,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(G,K,n,`Begin`,e.id);let r=this.cache.getContext(e.id);if(!r)return this.logger.perf(G,K,n,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let a=r.acquirePage(t.index),o=a.getTextPage(),s=this.pdfiumModule.FPDFText_CountChars(o),c=[];for(let e=0;e<s;e++){let n=this.readGlyphInfo(t,a.pagePtr,o,e);c.push(n)}let l=this.buildRunsFromGlyphs(c,o);return a.release(),this.logger.perf(G,K,n,`End`,e.id),i.resolve({runs:l})}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(G,K,n,`Begin`,e.id);let r=this.cache.getContext(e.id);if(!r)return this.logger.perf(G,K,n,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let a=r.acquirePage(t.index),o=a.getTextPage(),s=this.pdfiumModule.FPDFText_CountChars(o),l=[],u=0,d=null,f=null,p=0,m=null,h=null,g=e=>{if(d===null||f===null||m===null||h===null)return;let t=e-u;if(t<=0)return;let n=this.memoryManager.malloc(2*(t+1));this.pdfiumModule.FPDFText_GetText(o,u,t,n);let r=c(this.pdfiumModule.pdfium.UTF16ToString(n));this.memoryManager.free(n),l.push({text:r,rect:{origin:{x:h.minX,y:h.minY},size:{width:Math.max(1,h.maxX-h.minX),height:Math.max(1,h.maxY-h.minY)}},font:f,fontSize:p,color:m,charIndex:u,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),D=this.memoryManager.malloc(4);for(let e=0;e<s;e++){let n=this.pdfiumModule.FPDFText_GetUnicode(o,e);if(n===65534||n===65533)continue;let r=this.pdfiumModule.FPDFText_GetTextObject(o,e);if(r===0)continue;let i=this.pdfiumModule.FPDFText_GetFontSize(o,e);this.pdfiumModule.FPDFText_GetFillColor(o,e,_,v,y,b);let s=this.pdfiumModule.pdfium.getValue(_,`i32`)&255,c=this.pdfiumModule.pdfium.getValue(v,`i32`)&255,l=this.pdfiumModule.pdfium.getValue(y,`i32`)&255,E=this.pdfiumModule.pdfium.getValue(b,`i32`)&255,O=this.readFontInfoFromTextObject(r,D);if((d===null||r!==d||O.name!==f.name||Math.abs(i-p)>.01||s!==m.red||c!==m.green||l!==m.blue)&&(g(e),d=r,f=O,p=i,m={red:s,green:c,blue:l,alpha:E},u=e,h=null),this.pdfiumModule.FPDFText_GetLooseCharBox(o,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`),i=this.pdfiumModule.pdfium.getValue(x+12,`float`);if(e!==r&&n!==i){this.pdfiumModule.FPDF_PageToDevice(a.pagePtr,0,0,t.size.width,t.size.height,0,e,n,S,C),this.pdfiumModule.FPDF_PageToDevice(a.pagePtr,0,0,t.size.width,t.size.height,0,r,i,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);h===null?h={minX:u,minY:d,maxX:u+f,maxY:d+p}:(h.minX=Math.min(h.minX,u),h.minY=Math.min(h.minY,d),h.maxX=Math.max(h.maxX,u+f),h.maxY=Math.max(h.maxY,d+p))}}}return g(s),[_,v,y,b,x,S,C,w,T,D].forEach(e=>this.memoryManager.free(e)),a.release(),this.logger.perf(G,K,n,`End`,e.id),i.resolve({runs:l})}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=!!(this.pdfiumModule.FPDFFont_GetFlags(n)&1)}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=0,h=0,g=0,_=0,v=!1,y,b;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(m=Math.min(T,D),h=Math.min(E,O),g=Math.max(1,Math.abs(D-T)),_=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 m=this.pdfiumModule.pdfium.getValue(i,`i32`),h=this.pdfiumModule.pdfium.getValue(a,`i32`),g=this.pdfiumModule.pdfium.getValue(o,`i32`),_=this.pdfiumModule.pdfium.getValue(s,`i32`);y={x:Math.min(m,g),y:Math.min(h,_)},b={width:Math.max(1,Math.abs(g-m)),height:Math.max(1,Math.abs(_-h))}}v=this.pdfiumModule.FPDFText_GetUnicode(n,r)===32}return p.forEach(e=>this.memoryManager.free(e)),{origin:{x:m,y:h},size:{width:g,height:_},...y&&{tightOrigin:y},...b&&{tightSize:b},...v&&{isSpace:v}}}getPageGlyphs(e,t){this.logger.debug(G,K,`getPageGlyphs`,e,t),this.logger.perf(G,K,`getPageGlyphs`,`Begin`,e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,K,`getPageGlyphs`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`document does not open`});let r=n.acquirePage(t.index),a=r.getTextPage(),o=this.pdfiumModule.FPDFText_CountChars(a),s=Array(o);for(let e=0;e<o;e++){let n=this.readGlyphInfo(t,r.pagePtr,a,e);n.isEmpty||(s[e]={...n})}return r.release(),this.logger.perf(G,K,`getPageGlyphs`,`End`,e.id),i.resolve(s)}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=y(),this.setAnnotString(n,`NM`,i)),this.pdfiumModule.FPDFAnnot_GetSubtype(n)===j.WIDGET)return this.readPdfWidgetAnno(e,t,n,r,i)}getPageAnnotationsRaw(e,t){this.logger.debug(G,K,`getPageAnnotationsRaw`,e,t),this.logger.perf(G,K,`GetPageAnnotationsRaw`,`Begin`,`${e.id}-${t.index}`);let n=this.cache.getContext(e.id);if(!n)return i.reject({code:E.DocNotOpen,message:`document does not open`});let r=this.pdfiumModule.PDFiumExt_OpenFormFillInfo(),a=this.pdfiumModule.PDFiumExt_InitFormFillEnvironment(n.docPtr,r);try{let r=this.readPageAnnotationsRaw(e,n,t,a);return this.logger.perf(G,K,`GetPageAnnotationsRaw`,`End`,`${e.id}-${t.index}`),this.logger.debug(G,K,`getPageAnnotationsRaw`,`${e.id}-${t.index}`,r),i.resolve(r)}finally{this.pdfiumModule.PDFiumExt_ExitFormFillEnvironment(a),this.pdfiumModule.PDFiumExt_CloseFormFillInfo(r)}}readPageAnnotation(e,t,n,r,i){let a=this.getAnnotString(r,`NM`);a||(a=y(),this.setAnnotString(r,`NM`,a));let o=this.pdfiumModule.FPDFAnnot_GetSubtype(r),s;switch(o){case j.TEXT:s=this.readPdfTextAnno(e,n,r,a);break;case j.FREETEXT:s=this.readPdfFreeTextAnno(e,n,r,a);break;case j.LINK:s=this.readPdfLinkAnno(e,n,t,r,a);break;case j.WIDGET:if(i!==void 0)return this.readPdfWidgetAnno(e,n,r,i,a);break;case j.FILEATTACHMENT:s=this.readPdfFileAttachmentAnno(e,n,r,a);break;case j.INK:s=this.readPdfInkAnno(e,n,r,a);break;case j.POLYGON:s=this.readPdfPolygonAnno(e,n,r,a);break;case j.POLYLINE:s=this.readPdfPolylineAnno(e,n,r,a);break;case j.LINE:s=this.readPdfLineAnno(e,n,r,a);break;case j.HIGHLIGHT:s=this.readPdfHighlightAnno(e,n,r,a);break;case j.STAMP:s=this.readPdfStampAnno(e,n,r,a);break;case j.SQUARE:s=this.readPdfSquareAnno(e,n,r,a);break;case j.CIRCLE:s=this.readPdfCircleAnno(e,n,r,a);break;case j.UNDERLINE:s=this.readPdfUnderlineAnno(e,n,r,a);break;case j.SQUIGGLY:s=this.readPdfSquigglyAnno(e,n,r,a);break;case j.STRIKEOUT:s=this.readPdfStrikeOutAnno(e,n,r,a);break;case j.CARET:s=this.readPdfCaretAnno(e,n,r,a);break;case j.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 j.INK:{let n=e,i=n.inkList.map(e=>({points:e.points.map(e=>this.rotatePointForSave(e,r,-t))}));return{...n,inkList:i}}case j.LINE:{let n=e;return{...n,linePoints:{start:this.rotatePointForSave(n.linePoints.start,r,-t),end:this.rotatePointForSave(n.linePoints.end,r,-t)}}}case j.POLYGON:{let n=e;return{...n,vertices:n.vertices.map(e=>this.rotatePointForSave(e,r,-t))}}case j.POLYLINE:{let n=e;return{...n,vertices:n.vertices.map(e=>this.rotatePointForSave(e,r,-t))}}default:return e}}readAnnotationColor(e,t=k.Color){let n=this.memoryManager.malloc(4),r=this.memoryManager.malloc(4),i=this.memoryManager.malloc(4),a=this.pdfiumModule.EPDFAnnot_GetColor(e,t,n,r,i),o;return a&&(o={red:this.pdfiumModule.pdfium.getValue(n,`i32`)&255,green:this.pdfiumModule.pdfium.getValue(r,`i32`)&255,blue:this.pdfiumModule.pdfium.getValue(i,`i32`)&255}),this.memoryManager.free(n),this.memoryManager.free(r),this.memoryManager.free(i),o}getAnnotationColor(e,t=k.Color){let n=this.readAnnotationColor(e,t);return n?m(n):void 0}setAnnotationColor(e,t,n=k.Color){let r=p(t);return this.pdfiumModule.EPDFAnnot_SetColor(e,n,r.red&255,r.green&255,r.blue&255)}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),l(n)}setAnnotationOpacity(e,n){let r=t(n);return this.pdfiumModule.EPDFAnnot_SetOpacity(e,r&255)}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=(t+1)*2,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)){[t,n,r,i,a].forEach(e=>this.memoryManager.free(e));return}let o=this.pdfiumModule.pdfium,s=o.getValue(t,`i32`),c=o.getValue(n,`float`),l=o.getValue(r,`i32`)&255,u=o.getValue(i,`i32`)&255,d=o.getValue(a,`i32`)&255;return[t,n,r,i,a].forEach(e=>this.memoryManager.free(e)),{fontFamily:s,fontSize:c,fontColor:m({red:l,green:u,blue:d})}}setAnnotationDefaultAppearance(e,t,n,r){let{red:i,green:a,blue:o}=p(r);return!!this.pdfiumModule.EPDFAnnot_SetDefaultAppearance(e,t,n,i&255,a&255,o&255)}getBorderStyle(e){let t=this.memoryManager.malloc(4),n=0,r=S.UNKNOWN,i=!1;return r=this.pdfiumModule.EPDFAnnot_GetBorderStyle(e,t),n=this.pdfiumModule.pdfium.getValue(t,`float`),i=r!==S.UNKNOWN,this.memoryManager.free(t),{ok:i,style:r,width:n}}setBorderStyle(e,t,n){let r=t===S.CLOUDY?S.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??w.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?ae(n):void 0}setAnnotationDate(e,t,n){let r=O(n);return this.setAnnotString(e,t,r)}getAttachmentDate(e,t){let n=this.getAttachmentString(e,t);return n?ae(n):void 0}setAttachmentDate(e,t,n){let r=O(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)){this.memoryManager.free(t),this.memoryManager.free(n);return}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)){this.memoryManager.free(r),this.memoryManager.free(i);return}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 i=this.pdfiumModule.FPDFAnnot_CountAttachmentPoints(n);if(i===0)return[];let a=[];for(let r=0;r<i;r++){let i=this.memoryManager.malloc(32);if(this.pdfiumModule.FPDFAnnot_GetAttachmentPoints(n,r,i)){let n=[],r=[];for(let e=0;e<4;e++){let t=i+e*8;n.push(this.pdfiumModule.pdfium.getValue(t,`float`)),r.push(this.pdfiumModule.pdfium.getValue(t+4,`float`))}let o=this.convertPagePointToDevicePoint(e,t,{x:n[0],y:r[0]}),s=this.convertPagePointToDevicePoint(e,t,{x:n[1],y:r[1]}),c=this.convertPagePointToDevicePoint(e,t,{x:n[2],y:r[2]}),l=this.convertPagePointToDevicePoint(e,t,{x:n[3],y:r[3]});a.push({p1:o,p2:s,p3:c,p4:l})}this.memoryManager.free(i)}return a.map(r)}syncQuadPointsAnno(e,t,n,r){let i=this.pdfiumModule.pdfium,a=this.pdfiumModule.FPDFAnnot_CountAttachmentPoints(n),o=this.memoryManager.malloc(32),s=n=>{let r=_(n),a=this.convertDevicePointToPagePoint(e,t,r.p1),s=this.convertDevicePointToPagePoint(e,t,r.p2),c=this.convertDevicePointToPagePoint(e,t,r.p3),l=this.convertDevicePointToPagePoint(e,t,r.p4);i.setValue(o+0,a.x,`float`),i.setValue(o+4,a.y,`float`),i.setValue(o+8,s.x,`float`),i.setValue(o+12,s.y,`float`),i.setValue(o+16,l.x,`float`),i.setValue(o+20,l.y,`float`),i.setValue(o+24,c.x,`float`),i.setValue(o+28,c.y,`float`)},c=Math.min(a,r.length);for(let e=0;e<c;e++)if(s(r[e]),!this.pdfiumModule.FPDFAnnot_SetAttachmentPoints(n,e,o))return this.memoryManager.free(o),!1;for(let e=a;e<r.length;e++)if(s(r[e]),!this.pdfiumModule.FPDFAnnot_AppendAttachmentPoints(n,o))return this.memoryManager.free(o),!1;return this.memoryManager.free(o),!0}redactTextInRects(e,t,n,r){let{recurseForms:a=!0,drawBlackBoxes:o=!1}=r??{};this.logger.debug(`PDFiumEngine`,`Engine`,`redactTextInQuads`,e.id,t.index,n.length);let s=`RedactTextInQuads`;this.logger.perf(`PDFiumEngine`,`Engine`,s,`Begin`,`${e.id}-${t.index}`);let c=this.cache.getContext(e.id);if(!c)return this.logger.perf(`PDFiumEngine`,`Engine`,s,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let l=(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(l.length===0)return this.logger.perf(`PDFiumEngine`,`Engine`,s,`End`,`${e.id}-${t.index}`),i.resolve(!1);let u=c.acquirePage(t.index),{ptr:d,count:f}=this.allocFSQuadsBufferFromRects(e,t,l),p=!1;try{p=!!this.pdfiumModule.EPDFText_RedactInQuads(u.pagePtr,d,f,!!a,!1)}finally{this.memoryManager.free(d)}return p&&=!!this.pdfiumModule.FPDFPage_GenerateContent(u.pagePtr),u.disposeImmediate(),this.logger.perf(`PDFiumEngine`,`Engine`,s,`End`,`${e.id}-${t.index}`),i.resolve(!!p)}applyRedaction(e,t,n){this.logger.debug(G,K,`applyRedaction`,e.id,t.index,n.id);let r=`ApplyRedaction`;this.logger.perf(G,K,r,`Begin`,`${e.id}-${t.index}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let o=a.acquirePage(t.index),s=this.getAnnotationByName(o.pagePtr,n.id);if(!s)return o.release(),this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`),i.reject({code:E.NotFound,message:`annotation not found`});let c=this.pdfiumModule.EPDFAnnot_ApplyRedaction(o.pagePtr,s);return this.pdfiumModule.FPDFPage_CloseAnnot(s),c&&this.pdfiumModule.FPDFPage_GenerateContent(o.pagePtr),o.disposeImmediate(),this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`),i.resolve(!!c)}applyAllRedactions(e,t){this.logger.debug(G,K,`applyAllRedactions`,e.id,t.index);let n=`ApplyAllRedactions`;this.logger.perf(G,K,n,`Begin`,`${e.id}-${t.index}`);let r=this.cache.getContext(e.id);if(!r)return this.logger.perf(G,K,n,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let a=r.acquirePage(t.index),o=this.pdfiumModule.EPDFPage_ApplyRedactions(a.pagePtr);return o&&this.pdfiumModule.FPDFPage_GenerateContent(a.pagePtr),a.disposeImmediate(),this.logger.perf(G,K,n,`End`,`${e.id}-${t.index}`),i.resolve(!!o)}flattenAnnotation(e,t,n){this.logger.debug(G,K,`flattenAnnotation`,e.id,t.index,n.id);let r=`FlattenAnnotation`;this.logger.perf(G,K,r,`Begin`,`${e.id}-${t.index}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let o=a.acquirePage(t.index),s=this.getAnnotationByName(o.pagePtr,n.id);if(!s)return o.release(),this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`),i.reject({code:E.NotFound,message:`annotation not found`});let c=this.pdfiumModule.EPDFAnnot_Flatten(o.pagePtr,s);return this.pdfiumModule.FPDFPage_CloseAnnot(s),c&&this.pdfiumModule.FPDFPage_GenerateContent(o.pagePtr),o.disposeImmediate(),this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`),i.resolve(!!c)}exportAnnotationAppearanceAsPdf(e,t,n){this.logger.debug(G,K,`exportAnnotationAppearanceAsPdf`,e.id,t.index,n.id);let r=`ExportAnnotationAppearanceAsPdf`;this.logger.perf(G,K,r,`Begin`,`${e.id}-${t.index}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let o=a.acquirePage(t.index),s=this.getAnnotationByName(o.pagePtr,n.id);if(!s)return o.release(),this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`),i.reject({code:E.NotFound,message:`annotation not found`});let c=this.pdfiumModule.EPDFAnnot_ExportAppearanceAsDocument(s);if(this.pdfiumModule.FPDFPage_CloseAnnot(s),!c)return o.release(),this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`),i.reject({code:E.CantCreateNewDoc,message:`can not export annotation as pdf`});try{return i.resolve(this.saveDocument(c))}finally{this.pdfiumModule.FPDF_CloseDocument(c),o.release(),this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`)}}exportAnnotationsAppearanceAsPdf(e,t,n){this.logger.debug(G,K,`exportAnnotationsAppearanceAsPdf`,e.id,t.index,n.map(e=>e.id));let r=`ExportAnnotationsAppearanceAsPdf`;this.logger.perf(G,K,r,`Begin`,`${e.id}-${t.index}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});if(n.length===0)return this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`),i.reject({code:E.NotFound,message:`no annotations provided`});let o=a.acquirePage(t.index),s=[];for(let a of n){let n=this.getAnnotationByName(o.pagePtr,a.id);if(!n){for(let e of s)this.pdfiumModule.FPDFPage_CloseAnnot(e);return o.release(),this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`),i.reject({code:E.NotFound,message:`annotation not found: ${a.id}`})}s.push(n)}let c=s.length*4,l=this.memoryManager.malloc(c);for(let e=0;e<s.length;e++)this.pdfiumModule.pdfium.setValue(l+e*4,s[e],`i32`);let u=this.pdfiumModule.EPDFAnnot_ExportMultipleAppearancesAsDocument(l,s.length);this.memoryManager.free(l);for(let e of s)this.pdfiumModule.FPDFPage_CloseAnnot(e);if(!u)return o.release(),this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`),i.reject({code:E.CantCreateNewDoc,message:`can not export annotations as pdf`});try{return i.resolve(this.saveDocument(u))}finally{this.pdfiumModule.FPDF_CloseDocument(u),o.release(),this.logger.perf(G,K,r,`End`,`${e.id}-${t.index}`)}}allocFSQuadsBufferFromRects(e,t,n){let r=n.length,i=this.memoryManager.malloc(32*r),a=this.pdfiumModule.pdfium;for(let o=0;o<r;o++){let r=n[o],s=_(r),c=this.convertDevicePointToPagePoint(e,t,s.p1),l=this.convertDevicePointToPagePoint(e,t,s.p2),u=this.convertDevicePointToPagePoint(e,t,s.p3),d=this.convertDevicePointToPagePoint(e,t,s.p4),f=i+o*32;a.setValue(f+0,c.x,`float`),a.setValue(f+4,c.y,`float`),a.setValue(f+8,l.x,`float`),a.setValue(f+12,l.y,`float`),a.setValue(f+16,d.x,`float`),a.setValue(f+20,d.y,`float`),a.setValue(f+24,u.x,`float`),a.setValue(f+28,u.y,`float`)}return{ptr:i,count:r}}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(s*8);this.pdfiumModule.FPDFAnnot_GetInkListPath(n,o,r,s);for(let n=0;n<s;n++){let o=r+n*8,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(r*8);for(let n=0;n<r;n++){let r=a.points[n],s=this.convertDevicePointToPagePoint(e,t,r);i.setValue(o+n*8+0,s.x,`float`),i.setValue(o+n*8+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:j.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),c=this.getAnnotationColor(n),l=this.getAnnotationColor(n,k.TextColor),u=this.getBorderStyle(n),d=this.getAnnotationTextAlignment(n),f=this.getAnnotationVerticalAlignment(n),p=this.getAnnotationOpacity(n),m=this.getAnnotRichContent(n),g=this.getRectangleDifferences(n),_=this.getAnnotIntent(n),v=this.getCalloutLine(e,t,n),y=this.getLineEndings(n);return{pageIndex:t.index,id:r,type:j.FREETEXT,rect:a,fontFamily:s?.fontFamily??h.Unknown,fontSize:s?.fontSize??12,fontColor:l??s?.fontColor??`#000000`,verticalAlign:f,color:c,backgroundColor:c,opacity:p,textAlign:d,defaultStyle:o,richContent:m,...g.ok&&{rectangleDifferences:{left:g.left,top:g.top,right:g.right,bottom:g.bottom}},..._&&{intent:_},...v&&{calloutLine:v},...y&&{lineEnding:y.end},...u.width>0?{strokeWidth:u.width,strokeColor:s?.fontColor??`#000000`}:_===`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,k.Color),d;if(c===S.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(r);e&&(d=t)}let f=this.readPdfLinkAnnoTarget(n,()=>this.pdfiumModule.FPDFLink_GetAction(a),()=>this.pdfiumModule.FPDFLink_GetDest(n,a));return{pageIndex:t.index,id:i,type:j.LINK,rect:s,target:f,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),c=this.readPdfWidgetAnnoField(r,n),l=this.readButtonExportValue(n),u=this.getMKColor(n,0),d=this.getMKColor(n,1),{width:f}=this.getBorderStyle(n);return{pageIndex:t.index,id:i,type:j.WIDGET,fontFamily:o?.fontFamily??h.Unknown,fontSize:o?.fontSize??12,fontColor:o?.fontColor??`#000000`,rect:s,field:c,...l!==void 0&&{exportValue:l},strokeWidth:f,strokeColor:u??`transparent`,color:d??`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:j.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:j.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,k.InteriorColor),l=this.getAnnotationOpacity(n),{style:u,width:d}=this.getBorderStyle(n),f;if(u===S.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(f=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 p=this.getRectangleDifferences(n),m=this.getBorderEffect(n);return{pageIndex:t.index,id:r,type:j.POLYGON,rect:a,strokeColor:s??`#FF0000`,color:c??`transparent`,opacity:l,strokeWidth:d===0?1:d,strokeStyle:u,strokeDashArray:f,vertices:o,...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)}}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,k.InteriorColor),l=this.getAnnotationOpacity(n),{style:u,width:d}=this.getBorderStyle(n),f;if(u===S.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(f=t)}let p=this.getLineEndings(n);return{pageIndex:t.index,id:r,type:j.POLYLINE,rect:a,strokeColor:s??`#FF0000`,color:c??`transparent`,opacity:l,strokeWidth:d===0?1:d,strokeStyle:u,strokeDashArray:f,lineEndings:p,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),s=this.getLineEndings(n),c=this.getAnnotationColor(n),l=this.getAnnotationColor(n,k.InteriorColor),u=this.getAnnotationOpacity(n),{style:d,width:f}=this.getBorderStyle(n),p;if(d===S.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(p=t)}return{pageIndex:t.index,id:r,type:j.LINE,rect:a,strokeWidth:f===0?1:f,strokeStyle:d,strokeDashArray:p,strokeColor:c??`#FF0000`,color:l??`transparent`,opacity:u,linePoints:o||{start:{x:0,y:0},end:{x:0,y:0}},lineEndings:s||{start:P.None,end:P.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:j.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:j.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:j.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:j.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:j.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,k.InteriorColor),c=this.getAnnotationColor(n,k.OverlayColor),l=this.getAnnotationColor(n,k.Color),u=this.getAnnotationOpacity(n),d=this.getOverlayText(n),f=this.getOverlayTextRepeat(n),p=this.getAnnotationDefaultAppearance(n),m=this.getAnnotationTextAlignment(n);return{pageIndex:t.index,id:r,type:j.REDACT,rect:a,segmentRects:o,color:s,overlayColor:c,strokeColor:l,opacity:u,overlayText:d,overlayTextRepeat:f,fontFamily:p?.fontFamily,fontSize:p?.fontSize,fontColor:p?.fontColor,textAlign:m,...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:j.STAMP,rect:a,name:o,icon:o,...this.readBaseAnnotationProperties(e,t,n)}}readPdfPageObject(e){switch(this.pdfiumModule.FPDFPageObj_GetType(e)){case ie.PATH:return this.readPathObject(e);case ie.IMAGE:return this.readImageObject(e);case ie.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:ie.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(o*4);for(let e=0;e<o;e++)switch(a){case 2:{let t=this.pdfiumModule.pdfium.getValue(n+e*3,`i8`),r=this.pdfiumModule.pdfium.getValue(n+e*3+1,`i8`),i=this.pdfiumModule.pdfium.getValue(n+e*3+2,`i8`);s[e*4]=i,s[e*4+1]=r,s[e*4+2]=t,s[e*4+3]=100}}let c={data:s,width:r,height:i},l=this.readPdfPageObjectTransformMatrix(e);return{type:ie.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:ie.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 u(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,k.InteriorColor),s=this.getAnnotationColor(n),c=this.getAnnotationOpacity(n),{style:l,width:u}=this.getBorderStyle(n),d;if(l===S.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(d=t)}let f=this.getRectangleDifferences(n),p=this.getBorderEffect(n);return{pageIndex:t.index,id:r,type:j.CIRCLE,rect:a,color:o??`transparent`,opacity:c,strokeWidth:u,strokeColor:s??`#FF0000`,strokeStyle:l,...d!==void 0&&{strokeDashArray:d},...p.ok&&{cloudyBorderIntensity:p.intensity},...f.ok&&{rectangleDifferences:{left:f.left,top:f.top,right:f.right,bottom:f.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,k.InteriorColor),s=this.getAnnotationColor(n),c=this.getAnnotationOpacity(n),{style:l,width:u}=this.getBorderStyle(n),d;if(l===S.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(d=t)}let f=this.getRectangleDifferences(n),p=this.getBorderEffect(n);return{pageIndex:t.index,id:r,type:j.SQUARE,rect:a,color:o??`transparent`,opacity:c,strokeColor:s??`#FF0000`,strokeWidth:u,strokeStyle:l,...d!==void 0&&{strokeDashArray:d},...p.ok&&{cloudyBorderIntensity:p.intensity},...f.ok&&{rectangleDifferences:{left:f.left,top:f.top,right:f.right,bottom:f.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=y(),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):!1}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 j.INK:{let n=e,i=n.inkList.map(e=>({points:e.points.map(e=>this.rotatePointForSave(e,r,t))}));return{...n,inkList:i}}case j.LINE:{let n=e;return{...n,linePoints:{start:this.rotatePointForSave(n.linePoints.start,r,t),end:this.rotatePointForSave(n.linePoints.end,r,t)}}}case j.POLYGON:{let n=e;return{...n,vertices:n.vertices.map(e=>this.rotatePointForSave(e,r,t))}}case j.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!==w.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=(n+1)*2,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=(t+1)*2,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=(n+1)*2,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=(t+1)*2,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=(t+1)*2,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(i*8);this.pdfiumModule.FPDFAnnot_GetVertices(n,a,i);for(let n=0;n<i;n++){let i=this.pdfiumModule.pdfium.getValue(a+n*8,`float`),o=this.pdfiumModule.pdfium.getValue(a+n*8+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+r*8+0,o.x,`float`),i.setValue(a+r*8+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(r*8);if(this.pdfiumModule.EPDFAnnot_GetCalloutLine(n,i,r)===0){this.memoryManager.free(i);return}let a=[];for(let n=0;n<r;n++){let r=this.pdfiumModule.pdfium.getValue(i+n*8,`float`),o=this.pdfiumModule.pdfium.getValue(i+n*8+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+r*8+0,o.x,`float`),i.setValue(a+r*8+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 n=this.pdfiumModule.FPDFAnnot_GetFormFieldFlags(e,t),r=this.pdfiumModule.FPDFAnnot_GetFormFieldType(e,t),i=I(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.FPDFAnnot_GetFormFieldName(e,t,n,r),this.pdfiumModule.pdfium.UTF16ToString),a=I(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.FPDFAnnot_GetFormFieldAlternateName(e,t,n,r),this.pdfiumModule.pdfium.UTF16ToString),o=I(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.EPDFAnnot_GetFormFieldRawValue(e,t,n,r),this.pdfiumModule.pdfium.UTF16ToString),s=this.pdfiumModule.EPDFAnnot_GetFormFieldObjectNumber(e,t),c={flag:n,name:i,alternateName:a,value:o,fieldObjectId:s>0?s:void 0};switch(r){case A.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),{...c,type:r,maxLen:e}}case A.CHECKBOX:return{...c,type:r};case A.RADIOBUTTON:return{...c,type:r,options:this.readWidgetOptions(e,t)};case A.COMBOBOX:return{...c,type:r,options:this.readWidgetOptions(e,t)};case A.LISTBOX:return{...c,type:r,options:this.readWidgetOptions(e,t)};case A.PUSHBUTTON:return{...c,type:r};case A.SIGNATURE:return{...c,type:r};default:return{...c,type:r}}}readWidgetOptions(e,t){let n=[],r=this.pdfiumModule.FPDFAnnot_GetOptionCount(e,t);for(let i=0;i<r;i++){let r=I(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,r,o){let{scaleFactor:s=1,rotation:c=a.Degree0,dpr:l=1,mode:u=N.Normal}=o??{};this.logger.debug(G,K,`renderPageAnnotation`,e,t,r,o),this.logger.perf(G,K,`RenderPageAnnotation`,`Begin`,`${e.id}-${t.index}-${r.id}`);let d=new f,p=this.cache.getContext(e.id);if(!p)return this.logger.perf(G,K,`RenderPageAnnotation`,`End`,`${e.id}-${t.index}-${r.id}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let m=p.acquirePage(t.index),h=this.getAnnotationByName(m.pagePtr,r.id);if(!h)return this.logger.perf(G,K,`RenderPageAnnotation`,`End`,`${e.id}-${t.index}-${r.id}`),m.release(),i.reject({code:E.NotFound,message:`annotation not found`});let g=!!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(h,u);if(!g&&r.type===j.WIDGET&&(this.pdfiumModule.FPDFAnnot_HasKey(h,`AP`)||(this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(h),g=!!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(h,u))),!g)return this.pdfiumModule.FPDFPage_CloseAnnot(h),m.release(),this.logger.perf(G,K,`RenderPageAnnotation`,`End`,`${e.id}-${t.index}-${r.id}`),d.resolve({data:/* @__PURE__ */ new Uint8ClampedArray(4),width:1,height:1}),d;let _=Math.max(.01,s*l),y=!!o?.unrotated&&!!r.unrotatedRect,b=y?r.unrotatedRect:r.rect,x=ee(v(t.size,b,c,_)),S=Math.max(1,x.size.width),C=Math.max(1,x.size.height),w=S*4,T=w*C,D=this.memoryManager.malloc(T),O=this.pdfiumModule.FPDFBitmap_CreateEx(S,C,4,D,w);this.pdfiumModule.FPDFBitmap_FillRect(O,0,0,S,C,0);let k=n(b,c,S,C),A=this.memoryManager.malloc(24);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,A,6).set([k.a,k.b,k.c,k.d,k.e,k.f]);let te=!1;try{te=y?!!this.pdfiumModule.EPDF_RenderAnnotBitmapUnrotated(O,m.pagePtr,h,u,A,16):!!this.pdfiumModule.EPDF_RenderAnnotBitmap(O,m.pagePtr,h,u,A,16)}finally{this.memoryManager.free(A),this.pdfiumModule.FPDFBitmap_Destroy(O),this.pdfiumModule.FPDFPage_CloseAnnot(h),m.release()}if(!te)return this.memoryManager.free(D),this.logger.perf(G,K,`RenderPageAnnotation`,`End`,`${e.id}-${t.index}-${r.id}`),i.reject({code:E.Unknown,message:`EPDF_RenderAnnotBitmap failed`});let M=this.pdfiumModule.pdfium.HEAPU8.subarray(D,D+T),P={data:new Uint8ClampedArray(M),width:S,height:C};return d.resolve(P),this.memoryManager.free(D),d}renderPageAnnotationsRaw(e,t,n){let{scaleFactor:r=1,rotation:o=a.Degree0,dpr:s=1}=n??{};this.logger.debug(G,K,`renderPageAnnotationsRaw`,e,t,n),this.logger.perf(G,K,`RenderPageAnnotationsRaw`,`Begin`,`${e.id}-${t.index}`);let c=this.cache.getContext(e.id);if(!c)return this.logger.perf(G,K,`RenderPageAnnotationsRaw`,`End`,`${e.id}-${t.index}`),i.reject({code:E.DocNotOpen,message:`document does not open`});let l=c.acquirePage(t.index),u={},d=Math.max(.01,r*s),p=this.pdfiumModule.FPDFPage_GetAnnotCount(l.pagePtr);for(let n=0;n<p;n++){let r=this.pdfiumModule.FPDFPage_GetAnnot(l.pagePtr,n);if(r)try{let n=this.getAnnotString(r,`NM`);if(!n||this.getAnnotExtendedRotation(r)!==0&&this.readAnnotUnrotatedRect(r))continue;let i=this.pdfiumModule.EPDFAnnot_GetAvailableAppearanceModes(r);if(!i)continue;let a={},s=[{bit:1,mode:N.Normal,key:`normal`},{bit:2,mode:N.Rollover,key:`rollover`},{bit:4,mode:N.Down,key:`down`}];for(let{bit:n,mode:c,key:u}of s){if(!(i&n))continue;let s=this.renderSingleAnnotAppearance(e,t,l,r,c,o,d);s&&(a[u]=s)}(a.normal||a.rollover||a.down)&&(u[n]=a)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(r)}}l.release(),this.logger.perf(G,K,`RenderPageAnnotationsRaw`,`End`,`${e.id}-${t.index}`);let m=new f;return m.resolve(u),m}renderSingleAnnotAppearance(e,t,r,i,a,o,s){if(!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(i,a)){if(this.pdfiumModule.FPDFAnnot_GetSubtype(i)===j.WIDGET&&!this.pdfiumModule.FPDFAnnot_HasKey(i,`AP`)){if(this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(i),!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(i,a))return null}else return null}let c=this.readPageAnnoRect(i),l=this.convertPageRectToDeviceRect(e,t,c),u=ee(v(t.size,l,o,s)),d=Math.max(1,u.size.width),f=Math.max(1,u.size.height),p=d*4,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 _=n(l,o,d,f),y=this.memoryManager.malloc(24);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,y,6).set([_.a,_.b,_.c,_.d,_.e,_.f]);let b=!1;try{b=!!this.pdfiumModule.EPDF_RenderAnnotBitmap(g,r.pagePtr,i,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,r,o){let s=new f,c=o?.rotation??a.Degree0,l=this.cache.getContext(e.id);if(!l)return i.reject({code:E.DocNotOpen,message:`document does not open`});let u=Math.max(.01,o?.scaleFactor??1)*Math.max(1,o?.dpr??1),d=r.size.width,p=r.size.height,m=(c&1)==1,h=Math.max(1,Math.round((m?p:d)*u)),g=Math.max(1,Math.round((m?d:p)*u)),_=h*4,v=_*g,y=l.acquirePage(t.index),b=o?.withForms??!1,x=this.memoryManager.malloc(v),S=this.pdfiumModule.FPDFBitmap_CreateEx(h,g,4,x,_),C=o?.transparentBackground?0:4294967295;this.pdfiumModule.FPDFBitmap_FillRect(S,0,0,h,g,C);let w=n(r,c,h,g),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 D=this.memoryManager.malloc(16);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,D,4).set([0,0,h,g]);let O=16;(o?.withAnnotations??!1)&&(O|=1);try{this.pdfiumModule.FPDF_RenderPageBitmapWithMatrix(S,y.pagePtr,T,D,O),b&&y.withFormHandle(e=>{let{startX:n,startY:i,formsWidth:a,formsHeight:o}=_e(w,r,t.size,c);this.pdfiumModule.FPDF_FFLDraw(e,S,y.pagePtr,n,i,a,o,c,O)})}finally{y.release(),this.memoryManager.free(T),this.memoryManager.free(D)}this.logger.perf(G,K,`RenderRectEncodedData`,`Begin`,`${e.id}-${t.index}`);let k=this.pdfiumModule.pdfium.HEAPU8.subarray(x,x+v);this.logger.perf(G,K,`RenderRectEncodedData`,`End`,`${e.id}-${t.index}`),this.logger.perf(G,K,`RenderRectEncodedImageData`,`Begin`,`${e.id}-${t.index}`);let A={data:new Uint8ClampedArray(k),width:h,height:g};return this.logger.perf(G,K,`RenderRectEncodedImageData`,`End`,`${e.id}-${t.index}`),s.resolve(A),this.pdfiumModule.FPDFBitmap_Destroy(S),this.memoryManager.free(x),s}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===g.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 g.FitPage:e=g.FitPage;break;case g.FitHorizontal:e=g.FitHorizontal,r=[t.view?.[0]??0];break;case g.FitVertical:e=g.FitVertical,r=[t.view?.[0]??0];break;case g.FitRectangle:{let n=t.view??[];r=[n[0]??0,n[1]??0,n[2]??0,n[3]??0],e=g.FitRectangle}break;case g.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 M.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):!1}case M.URI:{let n=this.pdfiumModule.EPDFAction_CreateURI(e,r.uri);return n?!!this.pdfiumModule.EPDFBookmark_SetAction(e,t,n):!1}case M.LaunchAppOrOpenFile:{let n=this.withWString(r.path,t=>this.pdfiumModule.EPDFAction_CreateLaunch(e,t));return n?!!this.pdfiumModule.EPDFBookmark_SetAction(e,t,n):!1}case M.RemoteGoto:return!1;case M.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):!1}let r=n.action;switch(r.type){case M.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):!1}case M.URI:{let n=this.pdfiumModule.EPDFAction_CreateURI(e,r.uri);return n?!!this.pdfiumModule.EPDFAnnot_SetAction(t,n):!1}case M.LaunchAppOrOpenFile:{let n=this.withWString(r.path,t=>this.pdfiumModule.EPDFAction_CreateLaunch(e,t));return n?!!this.pdfiumModule.EPDFAnnot_SetAction(t,n):!1}case M.RemoteGoto:case M.Unsupported:default:return!1}}readPdfAction(e,t){let n=this.pdfiumModule.FPDFAction_GetType(t),r;switch(n){case M.Unsupported:r={type:M.Unsupported};break;case M.Goto:{let n=this.pdfiumModule.FPDFAction_GetDest(e,t);if(n){let t=this.readPdfDestination(e,n);r={type:M.Goto,destination:t}}else r={type:M.Unsupported}}break;case M.RemoteGoto:r={type:M.Unsupported};break;case M.URI:{let n=I(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.FPDFAction_GetURIPath(e,t,n,r),this.pdfiumModule.pdfium.UTF8ToString);r={type:M.URI,uri:n}}break;case M.LaunchAppOrOpenFile:{let e=I(this.pdfiumModule.pdfium,(e,n)=>this.pdfiumModule.FPDFAction_GetFilePath(t,e,n),this.pdfiumModule.pdfium.UTF8ToString);r={type:M.LaunchAppOrOpenFile,path:e}}}return r}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+e*4;s.push(this.pdfiumModule.pdfium.getValue(t,`float`))}if(this.memoryManager.free(r),this.memoryManager.free(i),a===g.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=I(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFAttachment_GetName(n,e,t),this.pdfiumModule.pdfium.UTF16ToString),i=I(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.EPDFAttachment_GetDescription(n,e,t),this.pdfiumModule.pdfium.UTF16ToString),a=I(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFAttachment_GetSubtype(n,e,t),this.pdfiumModule.pdfium.UTF16ToString),o=this.getAttachmentDate(n,`CreationDate`),s=I(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:t.rotation&3,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:t.rotation&3,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,N.Normal),rollover:this.readPageAnnoAppearanceStream(e,N.Rollover),down:this.readPageAnnoAppearanceStream(e,N.Down)}}readPageAnnoAppearanceStream(e,t=N.Normal){let n=(this.pdfiumModule.FPDFAnnot_GetAP(e,t,0,0)+1)*2,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=N.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(G,K,`searchInPage`,e,t,n,r),this.logger.perf(G,K,`SearchInPage`,`Begin`,`${e.id}-${t.index}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(G,K,`PreparePrintDocument`,`End`,e.id),i.reject({code:E.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=this.searchAllInPage(e,a,t,s,r);return i.resolve(n)}finally{this.memoryManager.free(s)}}getAnnotationsBatch(e,t){this.logger.debug(G,K,`getAnnotationsBatch`,e.id,t.length);let n=new f;return queueMicrotask(()=>{this.logger.perf(G,K,`GetAnnotationsBatch`,`Begin`,e.id);let r=this.cache.getContext(e.id);if(!r){n.reject({code:E.DocNotOpen,message:`Document is not open`});return}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(G,K,`GetAnnotationsBatch`,`End`,e.id),n.resolve(i)}),n}searchBatch(e,t,n,r){this.logger.debug(G,K,`searchBatch`,e.id,t.length,n);let i=new f;return queueMicrotask(()=>{this.logger.perf(G,K,`SearchBatch`,`Begin`,e.id);let a=this.cache.getContext(e.id);if(!a){i.reject({code:E.DocNotOpen,message:`Document is not open`});return}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(G,K,`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(;t>0&&!i.test(e[t-1]);)t--;return t},o=t=>{for(;t<e.length&&!i.test(e[t]);)t++;return t},s=t;for(;s>0&&i.test(e[s-1]);)s--;let c=0;for(;s>0&&c<r;)s--,i.test(e[s])||c++;s=a(s);let l=t+n;for(;l<e.length&&i.test(e[l]);)l++;for(c=0;l<e.length&&c<r;)i.test(e[l])||c++,l++;l=o(l);let u=e.slice(s,t).replace(/\s+/g,` `).trimStart(),d=e.slice(t,t+n),f=e.slice(t+n,l).replace(/\s+/g,` `).trimEnd();return{before:this.tidy(u),match:this.tidy(d),after:this.tidy(f),truncatedLeft:s>0,truncatedRight:l<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(G,K,`preparePrintDocument`,e,t),this.logger.perf(G,K,`PreparePrintDocument`,`Begin`,e.id);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(G,K,`PreparePrintDocument`,`End`,e.id),i.reject({code:E.DocNotOpen,message:`Document is not open`});let o=this.pdfiumModule.FPDF_CreateNewDocument();if(!o)return this.logger.perf(G,K,`PreparePrintDocument`,`End`,e.id),i.reject({code:E.CantCreateNewDoc,message:`Cannot create print document`});try{let t=this.sanitizePageRange(r,e.pageCount);if(!this.pdfiumModule.FPDF_ImportPages(o,a.docPtr,t??``,0))return this.pdfiumModule.FPDF_CloseDocument(o),this.logger.error(G,K,`Failed to import pages for printing`),this.logger.perf(G,K,`PreparePrintDocument`,`End`,e.id),i.reject({code:E.CantImportPages,message:`Failed to import pages for printing`});if(!n){let t=this.removeAnnotationsFromPrintDocument(o);if(!t.success)return this.pdfiumModule.FPDF_CloseDocument(o),this.logger.error(G,K,`Failed to remove annotations: ${t.error}`),this.logger.perf(G,K,`PreparePrintDocument`,`End`,e.id),i.reject({code:E.Unknown,message:`Failed to prepare print document: ${t.error}`});this.logger.debug(G,K,`Removed ${t.annotationsRemoved} annotations from ${t.pagesProcessed} pages`)}let s=this.saveDocument(o);return this.pdfiumModule.FPDF_CloseDocument(o),this.logger.perf(G,K,`PreparePrintDocument`,`End`,e.id),i.resolve(s)}catch(t){return o&&this.pdfiumModule.FPDF_CloseDocument(o),this.logger.error(G,K,`preparePrintDocument failed`,t),this.logger.perf(G,K,`PreparePrintDocument`,`End`,e.id),i.reject({code:E.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(G,K,`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(G,K,`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(G,K,`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(G,K,`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(G,K,`Sanitized page range: "${e}" -> "${s}"`),s}catch(e){return this.logger.error(G,K,`Error sanitizing page range: ${e}`),null}}}})))()}function Le(){return(Le=e((()=>{me(),Ie(),oe()})))()}Le();export{L as createPdfiumEngine};