@sync-in/server 1.8.1 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (603) hide show
  1. package/CHANGELOG.md +56 -11
  2. package/environment/environment.dist.yaml +29 -26
  3. package/package.json +15 -15
  4. package/server/app.constants.js +9 -0
  5. package/server/app.constants.js.map +1 -1
  6. package/server/app.module.js +4 -0
  7. package/server/app.module.js.map +1 -1
  8. package/server/applications/admin/admin.module.js +6 -1
  9. package/server/applications/admin/admin.module.js.map +1 -1
  10. package/server/applications/{notifications/interfaces/user-mail-notification.js → admin/interfaces/check-update.interfaces.js} +1 -1
  11. package/server/applications/admin/interfaces/check-update.interfaces.js.map +1 -0
  12. package/server/applications/admin/services/admin-scheduler.service.js +53 -0
  13. package/server/applications/admin/services/admin-scheduler.service.js.map +1 -0
  14. package/server/applications/admin/services/admin.service.js +102 -0
  15. package/server/applications/admin/services/admin.service.js.map +1 -0
  16. package/server/applications/admin/services/admin.service.spec.js +46 -0
  17. package/server/applications/admin/services/admin.service.spec.js.map +1 -0
  18. package/server/applications/admin/utils/check-update.js +28 -0
  19. package/server/applications/admin/utils/check-update.js.map +1 -0
  20. package/server/applications/comments/services/comments-manager.service.js +1 -1
  21. package/server/applications/comments/services/comments-manager.service.js.map +1 -1
  22. package/server/applications/comments/services/comments-manager.service.spec.js +1 -1
  23. package/server/applications/comments/services/comments-manager.service.spec.js.map +1 -1
  24. package/server/applications/comments/services/comments-queries.service.js.map +1 -1
  25. package/server/applications/files/constants/cache.js +10 -1
  26. package/server/applications/files/constants/cache.js.map +1 -1
  27. package/server/applications/files/constants/only-office.js +0 -25
  28. package/server/applications/files/constants/only-office.js.map +1 -1
  29. package/server/applications/files/constants/operations.js +20 -3
  30. package/server/applications/files/constants/operations.js.map +1 -1
  31. package/server/applications/files/dto/file-operations.dto.js +7 -0
  32. package/server/applications/files/dto/file-operations.dto.js.map +1 -1
  33. package/server/applications/files/files-only-office.controller.js +3 -2
  34. package/server/applications/files/files-only-office.controller.js.map +1 -1
  35. package/server/applications/files/files-only-office.controller.spec.js +6 -5
  36. package/server/applications/files/files-only-office.controller.spec.js.map +1 -1
  37. package/server/applications/files/files.controller.js +88 -8
  38. package/server/applications/files/files.controller.js.map +1 -1
  39. package/server/applications/files/files.controller.spec.js +11 -4
  40. package/server/applications/files/files.controller.spec.js.map +1 -1
  41. package/server/applications/files/guards/files-only-office.guard.js +6 -0
  42. package/server/applications/files/guards/files-only-office.guard.js.map +1 -1
  43. package/server/applications/files/interfaces/file-db-props.interface.js.map +1 -1
  44. package/server/applications/files/interfaces/file-props.interface.js.map +1 -1
  45. package/server/applications/files/interfaces/only-office-config.interface.js.map +1 -1
  46. package/server/applications/files/services/files-content-manager.service.js +3 -3
  47. package/server/applications/files/services/files-content-manager.service.js.map +1 -1
  48. package/server/applications/files/services/files-lock-manager.service.js +61 -22
  49. package/server/applications/files/services/files-lock-manager.service.js.map +1 -1
  50. package/server/applications/files/services/files-manager.service.js +122 -24
  51. package/server/applications/files/services/files-manager.service.js.map +1 -1
  52. package/server/applications/files/services/files-manager.service.spec.js +15 -0
  53. package/server/applications/files/services/files-manager.service.spec.js.map +1 -1
  54. package/server/applications/files/services/files-methods.service.js +38 -8
  55. package/server/applications/files/services/files-methods.service.js.map +1 -1
  56. package/server/applications/files/services/files-only-office-manager.service.js +12 -12
  57. package/server/applications/files/services/files-only-office-manager.service.js.map +1 -1
  58. package/server/applications/files/services/files-parser.service.js +1 -1
  59. package/server/applications/files/services/files-parser.service.js.map +1 -1
  60. package/server/applications/files/services/files-queries.service.js +10 -0
  61. package/server/applications/files/services/files-queries.service.js.map +1 -1
  62. package/server/applications/files/utils/files.js +1 -1
  63. package/server/applications/files/utils/files.js.map +1 -1
  64. package/server/applications/files/utils/send-file.js +3 -2
  65. package/server/applications/files/utils/send-file.js.map +1 -1
  66. package/server/applications/links/services/links-queries.service.js +1 -1
  67. package/server/applications/links/services/links-queries.service.js.map +1 -1
  68. package/server/applications/notifications/constants/notifications.js +5 -1
  69. package/server/applications/notifications/constants/notifications.js.map +1 -1
  70. package/server/applications/notifications/i18n/de.js +8 -2
  71. package/server/applications/notifications/i18n/de.js.map +1 -1
  72. package/server/applications/notifications/i18n/es.js +8 -2
  73. package/server/applications/notifications/i18n/es.js.map +1 -1
  74. package/server/applications/notifications/i18n/fr.js +8 -2
  75. package/server/applications/notifications/i18n/fr.js.map +1 -1
  76. package/server/applications/notifications/i18n/hi.js +8 -2
  77. package/server/applications/notifications/i18n/hi.js.map +1 -1
  78. package/server/applications/notifications/i18n/it.js +8 -2
  79. package/server/applications/notifications/i18n/it.js.map +1 -1
  80. package/server/applications/notifications/i18n/ja.js +8 -2
  81. package/server/applications/notifications/i18n/ja.js.map +1 -1
  82. package/server/applications/notifications/i18n/ko.js +8 -2
  83. package/server/applications/notifications/i18n/ko.js.map +1 -1
  84. package/server/applications/notifications/i18n/pl.js +8 -2
  85. package/server/applications/notifications/i18n/pl.js.map +1 -1
  86. package/server/applications/notifications/i18n/pt.js +8 -2
  87. package/server/applications/notifications/i18n/pt.js.map +1 -1
  88. package/server/applications/notifications/i18n/pt_br.js +8 -2
  89. package/server/applications/notifications/i18n/pt_br.js.map +1 -1
  90. package/server/applications/notifications/i18n/ru.js +8 -2
  91. package/server/applications/notifications/i18n/ru.js.map +1 -1
  92. package/server/applications/notifications/i18n/tr.js +8 -2
  93. package/server/applications/notifications/i18n/tr.js.map +1 -1
  94. package/server/applications/notifications/i18n/zh.js +8 -2
  95. package/server/applications/notifications/i18n/zh.js.map +1 -1
  96. package/server/applications/notifications/interfaces/notification-properties.interface.js.map +1 -1
  97. package/server/applications/notifications/interfaces/user-mail-notification.interface.js +10 -0
  98. package/server/applications/notifications/interfaces/user-mail-notification.interface.js.map +1 -0
  99. package/server/applications/notifications/mails/models.js +38 -3
  100. package/server/applications/notifications/mails/models.js.map +1 -1
  101. package/server/applications/notifications/mails/templates.js +1 -1
  102. package/server/applications/notifications/mails/templates.js.map +1 -1
  103. package/server/applications/notifications/services/notifications-manager.service.js +8 -1
  104. package/server/applications/notifications/services/notifications-manager.service.js.map +1 -1
  105. package/server/applications/notifications/services/notifications-queries.service.js.map +1 -1
  106. package/server/applications/shares/services/shares-manager.service.js +17 -10
  107. package/server/applications/shares/services/shares-manager.service.js.map +1 -1
  108. package/server/applications/shares/services/shares-manager.service.spec.js +10 -3
  109. package/server/applications/shares/services/shares-manager.service.spec.js.map +1 -1
  110. package/server/applications/shares/services/shares-queries.service.js +11 -1
  111. package/server/applications/shares/services/shares-queries.service.js.map +1 -1
  112. package/server/applications/spaces/guards/space.guard.spec.js +2 -2
  113. package/server/applications/spaces/guards/space.guard.spec.js.map +1 -1
  114. package/server/applications/spaces/services/spaces-browser.service.js +31 -11
  115. package/server/applications/spaces/services/spaces-browser.service.js.map +1 -1
  116. package/server/applications/spaces/services/spaces-manager.service.js +2 -2
  117. package/server/applications/spaces/services/spaces-manager.service.js.map +1 -1
  118. package/server/applications/spaces/services/spaces-queries.service.js +6 -2
  119. package/server/applications/spaces/services/spaces-queries.service.js.map +1 -1
  120. package/server/applications/spaces/utils/permissions.js +2 -2
  121. package/server/applications/spaces/utils/permissions.js.map +1 -1
  122. package/server/applications/sync/services/sync-manager.service.js +1 -0
  123. package/server/applications/sync/services/sync-manager.service.js.map +1 -1
  124. package/server/applications/sync/services/sync-paths-manager.service.js +1 -1
  125. package/server/applications/sync/services/sync-paths-manager.service.js.map +1 -1
  126. package/server/applications/sync/services/sync-paths-manager.service.spec.js +1 -1
  127. package/server/applications/sync/services/sync-paths-manager.service.spec.js.map +1 -1
  128. package/server/applications/users/constants/user.js +1 -1
  129. package/server/applications/users/constants/user.js.map +1 -1
  130. package/server/applications/users/services/admin-users-queries.service.js +8 -0
  131. package/server/applications/users/services/admin-users-queries.service.js.map +1 -1
  132. package/server/applications/users/services/users-queries.service.js +67 -68
  133. package/server/applications/users/services/users-queries.service.js.map +1 -1
  134. package/server/applications/users/users.module.js +2 -1
  135. package/server/applications/users/users.module.js.map +1 -1
  136. package/server/applications/webdav/guards/webdav-protocol.guard.js +4 -4
  137. package/server/applications/webdav/guards/webdav-protocol.guard.js.map +1 -1
  138. package/server/applications/webdav/guards/webdav-protocol.guard.spec.js +6 -6
  139. package/server/applications/webdav/guards/webdav-protocol.guard.spec.js.map +1 -1
  140. package/server/applications/webdav/services/webdav-methods.service.js +3 -2
  141. package/server/applications/webdav/services/webdav-methods.service.js.map +1 -1
  142. package/server/applications/webdav/services/webdav-methods.service.spec.js +2 -2
  143. package/server/applications/webdav/services/webdav-methods.service.spec.js.map +1 -1
  144. package/server/authentication/constants/auth-ldap.js +2 -0
  145. package/server/authentication/constants/auth-ldap.js.map +1 -1
  146. package/server/authentication/services/auth-methods/auth-method-ldap.service.js +34 -21
  147. package/server/authentication/services/auth-methods/auth-method-ldap.service.js.map +1 -1
  148. package/server/common/functions.js +0 -8
  149. package/server/common/functions.js.map +1 -1
  150. package/server/common/image.js +1 -0
  151. package/server/common/image.js.map +1 -1
  152. package/server/common/shared.js +18 -1
  153. package/server/common/shared.js.map +1 -1
  154. package/server/infrastructure/context/services/context-manager.service.js +3 -0
  155. package/server/infrastructure/context/services/context-manager.service.js.map +1 -1
  156. package/server/infrastructure/websocket/adapters/cluster.adapter.js +4 -4
  157. package/server/infrastructure/websocket/adapters/cluster.adapter.js.map +1 -1
  158. package/static/3rdpartylicenses.txt +1393 -44
  159. package/static/assets/favicon.svg +2 -25
  160. package/static/assets/logo-dark.svg +2 -32
  161. package/static/assets/logo.svg +2 -32
  162. package/static/assets/mimes/application-sql.svg +29 -1
  163. package/static/assets/mimes/application-x-sql.svg +29 -0
  164. package/static/assets/mimes/image-bmp.svg +12 -0
  165. package/static/assets/pdfjs/build/pdf.mjs +4869 -4454
  166. package/static/assets/pdfjs/build/pdf.mjs.map +1 -1
  167. package/static/assets/pdfjs/build/pdf.sandbox.mjs +3 -3
  168. package/static/assets/pdfjs/build/pdf.sandbox.mjs.map +1 -1
  169. package/static/assets/pdfjs/build/pdf.worker.mjs +885 -596
  170. package/static/assets/pdfjs/build/pdf.worker.mjs.map +1 -1
  171. package/static/assets/pdfjs/version +1 -1
  172. package/static/assets/pdfjs/web/locale/be/viewer.ftl +40 -0
  173. package/static/assets/pdfjs/web/locale/bg/viewer.ftl +2 -0
  174. package/static/assets/pdfjs/web/locale/cs/viewer.ftl +41 -0
  175. package/static/assets/pdfjs/web/locale/cy/viewer.ftl +43 -0
  176. package/static/assets/pdfjs/web/locale/da/viewer.ftl +39 -0
  177. package/static/assets/pdfjs/web/locale/de/viewer.ftl +41 -0
  178. package/static/assets/pdfjs/web/locale/dsb/viewer.ftl +43 -0
  179. package/static/assets/pdfjs/web/locale/el/viewer.ftl +39 -0
  180. package/static/assets/pdfjs/web/locale/en-CA/viewer.ftl +35 -0
  181. package/static/assets/pdfjs/web/locale/en-GB/viewer.ftl +41 -0
  182. package/static/assets/pdfjs/web/locale/en-US/viewer.ftl +2 -2
  183. package/static/assets/pdfjs/web/locale/eo/viewer.ftl +39 -0
  184. package/static/assets/pdfjs/web/locale/es-AR/viewer.ftl +41 -0
  185. package/static/assets/pdfjs/web/locale/es-CL/viewer.ftl +39 -0
  186. package/static/assets/pdfjs/web/locale/es-ES/viewer.ftl +72 -0
  187. package/static/assets/pdfjs/web/locale/es-MX/viewer.ftl +120 -0
  188. package/static/assets/pdfjs/web/locale/eu/viewer.ftl +41 -0
  189. package/static/assets/pdfjs/web/locale/fi/viewer.ftl +41 -0
  190. package/static/assets/pdfjs/web/locale/fr/viewer.ftl +41 -0
  191. package/static/assets/pdfjs/web/locale/fur/viewer.ftl +77 -0
  192. package/static/assets/pdfjs/web/locale/fy-NL/viewer.ftl +41 -0
  193. package/static/assets/pdfjs/web/locale/gn/viewer.ftl +39 -0
  194. package/static/assets/pdfjs/web/locale/he/viewer.ftl +41 -0
  195. package/static/assets/pdfjs/web/locale/hsb/viewer.ftl +43 -0
  196. package/static/assets/pdfjs/web/locale/hu/viewer.ftl +41 -0
  197. package/static/assets/pdfjs/web/locale/hy-AM/viewer.ftl +1 -1
  198. package/static/assets/pdfjs/web/locale/ia/viewer.ftl +41 -0
  199. package/static/assets/pdfjs/web/locale/it/viewer.ftl +41 -0
  200. package/static/assets/pdfjs/web/locale/ja/viewer.ftl +32 -0
  201. package/static/assets/pdfjs/web/locale/ka/viewer.ftl +41 -0
  202. package/static/assets/pdfjs/web/locale/kab/viewer.ftl +73 -0
  203. package/static/assets/pdfjs/web/locale/kk/viewer.ftl +21 -0
  204. package/static/assets/pdfjs/web/locale/ko/viewer.ftl +38 -1
  205. package/static/assets/pdfjs/web/locale/nb-NO/viewer.ftl +39 -0
  206. package/static/assets/pdfjs/web/locale/nl/viewer.ftl +41 -0
  207. package/static/assets/pdfjs/web/locale/nn-NO/viewer.ftl +37 -0
  208. package/static/assets/pdfjs/web/locale/pa-IN/viewer.ftl +37 -0
  209. package/static/assets/pdfjs/web/locale/pl/viewer.ftl +39 -0
  210. package/static/assets/pdfjs/web/locale/pt-BR/viewer.ftl +39 -0
  211. package/static/assets/pdfjs/web/locale/rm/viewer.ftl +73 -0
  212. package/static/assets/pdfjs/web/locale/ro/viewer.ftl +41 -0
  213. package/static/assets/pdfjs/web/locale/ru/viewer.ftl +42 -0
  214. package/static/assets/pdfjs/web/locale/sc/viewer.ftl +6 -0
  215. package/static/assets/pdfjs/web/locale/sk/viewer.ftl +43 -0
  216. package/static/assets/pdfjs/web/locale/sl/viewer.ftl +42 -1
  217. package/static/assets/pdfjs/web/locale/sq/viewer.ftl +77 -0
  218. package/static/assets/pdfjs/web/locale/sv-SE/viewer.ftl +41 -0
  219. package/static/assets/pdfjs/web/locale/tg/viewer.ftl +39 -0
  220. package/static/assets/pdfjs/web/locale/th/viewer.ftl +35 -0
  221. package/static/assets/pdfjs/web/locale/tr/viewer.ftl +39 -0
  222. package/static/assets/pdfjs/web/locale/vi/viewer.ftl +42 -5
  223. package/static/assets/pdfjs/web/locale/zh-CN/viewer.ftl +35 -0
  224. package/static/assets/pdfjs/web/locale/zh-TW/viewer.ftl +37 -0
  225. package/static/assets/pdfjs/web/viewer.css +141 -110
  226. package/static/assets/pdfjs/web/viewer.html +7 -7
  227. package/static/assets/pdfjs/web/viewer.mjs +97 -14
  228. package/static/assets/pdfjs/web/viewer.mjs.map +1 -1
  229. package/static/chunk-22DWHRCL.js +1 -0
  230. package/static/chunk-23UUFZSR.js +1 -0
  231. package/static/{chunk-MTVSJTIW.js → chunk-24Q7OUU2.js} +1 -1
  232. package/static/chunk-25QTY2GI.js +1 -0
  233. package/static/chunk-2E7IJZLL.js +1 -0
  234. package/static/chunk-2FC5EKS5.js +1 -0
  235. package/static/chunk-2FOWUJQF.js +1 -0
  236. package/static/chunk-2XPHUNYN.js +1 -0
  237. package/static/chunk-32L7RG2G.js +1 -0
  238. package/static/chunk-3IISSX63.js +1 -0
  239. package/static/chunk-3OHSTP3R.js +1 -0
  240. package/static/chunk-42L6C5MT.js +1 -0
  241. package/static/chunk-4AGQL5GV.js +1 -0
  242. package/static/chunk-4BPSQMI2.js +1 -0
  243. package/static/chunk-4FDRWZWT.js +1 -0
  244. package/static/chunk-4FJUCMEG.js +1 -0
  245. package/static/chunk-4GCCF6PF.js +1 -0
  246. package/static/chunk-4ORP3SBY.js +1 -0
  247. package/static/chunk-4QBOHIC3.js +1 -0
  248. package/static/chunk-4YT6K5KY.js +1 -0
  249. package/static/chunk-556I6YIW.js +1 -0
  250. package/static/chunk-5DPIGJU4.js +1 -0
  251. package/static/chunk-5HNQLBSW.js +3 -0
  252. package/static/chunk-5IL7C45D.js +1 -0
  253. package/static/chunk-5KJXGMKR.js +1 -0
  254. package/static/chunk-5SPGSHKL.js +1 -0
  255. package/static/chunk-5WCQBTXW.js +1 -0
  256. package/static/chunk-5XUIPWOH.js +1 -0
  257. package/static/chunk-62WT7PI3.js +1 -0
  258. package/static/chunk-6F6OMQ5H.js +1 -0
  259. package/static/chunk-6I5BGQHT.js +1 -0
  260. package/static/chunk-6NOS45DG.js +1 -0
  261. package/static/chunk-6OKLPRCD.js +1 -0
  262. package/static/chunk-6VEJCG43.js +1 -0
  263. package/static/chunk-77SS36Z2.js +1 -0
  264. package/static/chunk-7AXEPO3G.js +1 -0
  265. package/static/chunk-7CFSJ4BO.js +1 -0
  266. package/static/chunk-7CKHC72R.js +1 -0
  267. package/static/chunk-7DUTYOJG.js +1 -0
  268. package/static/chunk-7HKFYRPF.js +1 -0
  269. package/static/chunk-7NZJZATZ.js +1 -0
  270. package/static/chunk-AADK5D2H.js +1 -0
  271. package/static/chunk-ACUF7IKP.js +1 -0
  272. package/static/chunk-AGREZPV4.js +1 -0
  273. package/static/chunk-ATBJWFA3.js +1 -0
  274. package/static/chunk-ATXLZN2B.js +1 -0
  275. package/static/chunk-AZ5TF5Y3.js +1 -0
  276. package/static/chunk-BBHYIURC.js +1 -0
  277. package/static/chunk-BHZEPHRI.js +13 -0
  278. package/static/chunk-BQZWSZNN.js +1 -0
  279. package/static/chunk-BSB4VROD.js +2 -0
  280. package/static/chunk-BYWSTP3P.js +1 -0
  281. package/static/chunk-C3AAEQKW.js +1 -0
  282. package/static/chunk-CCGGCHGN.js +1 -0
  283. package/static/chunk-CFTKW432.js +1 -0
  284. package/static/chunk-CNOVT6KU.js +1 -0
  285. package/static/chunk-D56H3XE2.js +1 -0
  286. package/static/chunk-DFOOSIIA.js +1 -0
  287. package/static/chunk-DHFQIFOF.js +1 -0
  288. package/static/{chunk-3GMLWAFZ.js → chunk-DIC2MVRI.js} +1 -1
  289. package/static/chunk-DJDRX53V.js +2 -0
  290. package/static/chunk-DKGXUMLT.js +1 -0
  291. package/static/chunk-DRHPEERW.js +2 -0
  292. package/static/chunk-DWYP6ZGG.js +1 -0
  293. package/static/chunk-EDJAISWO.js +13 -0
  294. package/static/chunk-EIYRBM4J.js +1 -0
  295. package/static/chunk-EKEGRXCV.js +7 -0
  296. package/static/chunk-EL6QL4TP.js +1 -0
  297. package/static/chunk-ERDZ7IVF.js +1 -0
  298. package/static/chunk-EVQKKVUZ.js +1 -0
  299. package/static/chunk-F2XG7EWI.js +1 -0
  300. package/static/chunk-F672FY5I.js +1 -0
  301. package/static/chunk-F6V37MKG.js +1 -0
  302. package/static/chunk-F7TXTNZC.js +1 -0
  303. package/static/chunk-FCGTI42I.js +1 -0
  304. package/static/chunk-FQHOSSCO.js +1 -0
  305. package/static/chunk-FTSIPHMG.js +1 -0
  306. package/static/chunk-GAGHHYLF.js +1 -0
  307. package/static/{chunk-JPT5WEAT.js → chunk-GOJYWL2M.js} +1 -1
  308. package/static/chunk-H6WOTGQ5.js +1 -0
  309. package/static/{chunk-CHJ64RJM.js → chunk-H6ZXFINQ.js} +1 -1
  310. package/static/chunk-HC7F57NA.js +1 -0
  311. package/static/chunk-HHWXIK2M.js +7 -0
  312. package/static/chunk-HKRGIRKB.js +3 -0
  313. package/static/chunk-HNMGPG72.js +1 -0
  314. package/static/chunk-HS4S6BV3.js +1 -0
  315. package/static/chunk-IJ7K7ATQ.js +1 -0
  316. package/static/chunk-IOIBQGHN.js +562 -0
  317. package/static/chunk-ITVA26X2.js +2 -0
  318. package/static/chunk-J6YSFHLZ.js +1 -0
  319. package/static/chunk-JAEJ6IMV.js +1 -0
  320. package/static/chunk-JB5R6V33.js +1 -0
  321. package/static/chunk-JF6WIV6M.js +1 -0
  322. package/static/chunk-JGB4LLUT.js +1 -0
  323. package/static/chunk-JGXVTKLG.js +1 -0
  324. package/static/chunk-JMYAD7E2.js +1 -0
  325. package/static/chunk-JSE63Q5X.js +1 -0
  326. package/static/chunk-JVV3ZL6L.js +1 -0
  327. package/static/chunk-JXZCNFW7.js +1 -0
  328. package/static/chunk-KAVP6UXH.js +1 -0
  329. package/static/{chunk-3R74L4UU.js → chunk-KDEEERWZ.js} +1 -1
  330. package/static/chunk-KHRF67SG.js +1 -0
  331. package/static/chunk-KLOUBIO4.js +1 -0
  332. package/static/chunk-KMF3ZRAO.js +1 -0
  333. package/static/chunk-KNZ3AQPR.js +1 -0
  334. package/static/chunk-KT3TWCST.js +1 -0
  335. package/static/chunk-L6SYG23T.js +1 -0
  336. package/static/chunk-LJSVNPPQ.js +1 -0
  337. package/static/{chunk-LNTUR3GU.js → chunk-LRDKG274.js} +1 -1
  338. package/static/chunk-LRQSPCYZ.js +1 -0
  339. package/static/chunk-LUSVISM6.js +1 -0
  340. package/static/chunk-LXQGVNU2.js +1 -0
  341. package/static/{chunk-LVSNIS5P.js → chunk-LYZGJZNP.js} +1 -1
  342. package/static/chunk-LZKI5P5T.js +1 -0
  343. package/static/chunk-M4XL3JN5.js +6 -0
  344. package/static/{chunk-UNCPXHHT.js → chunk-MGWG7OD7.js} +1 -1
  345. package/static/chunk-MKUUWY6Y.js +1 -0
  346. package/static/{chunk-VJTXJ43D.js → chunk-MNNCSSHN.js} +1 -1
  347. package/static/chunk-MR3U7TKQ.js +1 -0
  348. package/static/chunk-MRF3CNLZ.js +1 -0
  349. package/static/chunk-MRMSMTWD.js +1 -0
  350. package/static/chunk-MVZJSG5R.js +1 -0
  351. package/static/chunk-MYM43ENO.js +1 -0
  352. package/static/chunk-N3P6P6GW.js +7 -0
  353. package/static/chunk-NAH4V2R6.js +2 -0
  354. package/static/chunk-NBBDVVUF.js +1 -0
  355. package/static/chunk-NMF2ZFBE.js +1 -0
  356. package/static/chunk-NN4ONTOT.js +1 -0
  357. package/static/chunk-NOPACN4F.js +1 -0
  358. package/static/chunk-NYJPOP4L.js +1 -0
  359. package/static/chunk-OJCAIKUK.js +1 -0
  360. package/static/chunk-OQRWXCLY.js +1 -0
  361. package/static/chunk-PCFH5HCI.js +2 -0
  362. package/static/chunk-PG54TWBO.js +4 -0
  363. package/static/chunk-PJF5XUTO.js +1 -0
  364. package/static/{chunk-FJE6BOFL.js → chunk-PSUAQBYM.js} +1 -1
  365. package/static/chunk-PTLYIUFW.js +1 -0
  366. package/static/chunk-PZGLDZZM.js +1 -0
  367. package/static/chunk-Q4VNZGFI.js +1 -0
  368. package/static/chunk-Q556XB3S.js +1 -0
  369. package/static/{chunk-PB4AIT7O.js → chunk-Q7IXRPOO.js} +1 -1
  370. package/static/chunk-Q7U2VPIS.js +1 -0
  371. package/static/chunk-QM6CQMEX.js +1 -0
  372. package/static/chunk-QMHUIHSR.js +1 -0
  373. package/static/chunk-QNFNXDSX.js +1 -0
  374. package/static/chunk-QVFPHTOH.js +1 -0
  375. package/static/chunk-R4MI25E2.js +1 -0
  376. package/static/chunk-R7JRAR3P.js +1 -0
  377. package/static/chunk-R7PNKQU2.js +1 -0
  378. package/static/chunk-RCAORRB7.js +1 -0
  379. package/static/chunk-RK7XRDNB.js +1 -0
  380. package/static/chunk-RO7SAOLK.js +1 -0
  381. package/static/chunk-RQUUINHV.js +1 -0
  382. package/static/chunk-RT3K6DZR.js +1 -0
  383. package/static/chunk-RUN556VW.js +1 -0
  384. package/static/chunk-RX3YQ67K.js +1 -0
  385. package/static/chunk-S6EVLDHA.js +5 -0
  386. package/static/chunk-S7S5M3AZ.js +1 -0
  387. package/static/chunk-SBLNYV74.js +1 -0
  388. package/static/chunk-SIZCHHUA.js +1 -0
  389. package/static/chunk-SRBOO7AO.js +1 -0
  390. package/static/{chunk-PVDHBQRM.js → chunk-STA7NTYL.js} +1 -1
  391. package/static/chunk-T3YI3BSS.js +1 -0
  392. package/static/chunk-T74SMT7I.js +1 -0
  393. package/static/chunk-TAL3RTTQ.js +1 -0
  394. package/static/chunk-TJZKTNNS.js +1 -0
  395. package/static/chunk-UJTFWZEC.js +1 -0
  396. package/static/chunk-UPGVU5LG.js +1 -0
  397. package/static/chunk-UQ6O3I6W.js +1 -0
  398. package/static/{chunk-5NMSIIQB.js → chunk-V43RGNXA.js} +1 -1
  399. package/static/chunk-VWIRXLNE.js +1 -0
  400. package/static/chunk-VZMVGIVW.js +1 -0
  401. package/static/chunk-VZPCXSRG.js +2 -0
  402. package/static/chunk-WR3MA3L3.js +1 -0
  403. package/static/chunk-XCLK7NJL.js +1 -0
  404. package/static/{chunk-DSWEWLXJ.js → chunk-XCPDPB5G.js} +1 -1
  405. package/static/chunk-XEGHEUP5.js +1 -0
  406. package/static/chunk-XKEBQNQJ.js +1 -0
  407. package/static/chunk-XOF4UW3S.js +1 -0
  408. package/static/chunk-XOTKK2NJ.js +1 -0
  409. package/static/chunk-XX7JXKA6.js +1 -0
  410. package/static/chunk-Y2I36A4K.js +1 -0
  411. package/static/chunk-Y44XDRM5.js +1 -0
  412. package/static/{chunk-QO6BTONN.js → chunk-Y4MAPE2C.js} +1 -1
  413. package/static/chunk-Y5RLD72B.js +1 -0
  414. package/static/{chunk-DPUVSXRB.js → chunk-Y5XTRCFK.js} +1 -1
  415. package/static/chunk-Y63UUJGJ.js +1 -0
  416. package/static/chunk-YBNAC7QM.js +1 -0
  417. package/static/chunk-YCTCESL4.js +1 -0
  418. package/static/chunk-YMAN4LIU.js +1 -0
  419. package/static/chunk-YTDE6SXT.js +1 -0
  420. package/static/chunk-YZPIUJB3.js +1 -0
  421. package/static/chunk-ZCOWBVOT.js +1 -0
  422. package/static/chunk-ZHRYYMYE.js +1 -0
  423. package/static/chunk-ZNXTOQFG.js +1 -0
  424. package/static/{chunk-URHTCJ7G.js → chunk-ZQLBPLXI.js} +1 -1
  425. package/static/favicon.ico +0 -0
  426. package/static/index.html +2 -2
  427. package/static/main-3PLRDZTO.js +11 -0
  428. package/static/styles-Q4OZOSSK.css +1 -0
  429. package/server/applications/notifications/interfaces/user-mail-notification.js.map +0 -1
  430. package/static/assets/codemirror/mode/apl/apl.js +0 -174
  431. package/static/assets/codemirror/mode/asciiarmor/asciiarmor.js +0 -74
  432. package/static/assets/codemirror/mode/asn.1/asn.1.js +0 -204
  433. package/static/assets/codemirror/mode/asterisk/asterisk.js +0 -220
  434. package/static/assets/codemirror/mode/brainfuck/brainfuck.js +0 -85
  435. package/static/assets/codemirror/mode/clike/clike.js +0 -942
  436. package/static/assets/codemirror/mode/clojure/clojure.js +0 -293
  437. package/static/assets/codemirror/mode/cmake/cmake.js +0 -97
  438. package/static/assets/codemirror/mode/cobol/cobol.js +0 -255
  439. package/static/assets/codemirror/mode/coffeescript/coffeescript.js +0 -359
  440. package/static/assets/codemirror/mode/commonlisp/commonlisp.js +0 -125
  441. package/static/assets/codemirror/mode/crystal/crystal.js +0 -433
  442. package/static/assets/codemirror/mode/css/css.js +0 -862
  443. package/static/assets/codemirror/mode/cypher/cypher.js +0 -152
  444. package/static/assets/codemirror/mode/d/d.js +0 -223
  445. package/static/assets/codemirror/mode/dart/dart.js +0 -168
  446. package/static/assets/codemirror/mode/diff/diff.js +0 -47
  447. package/static/assets/codemirror/mode/django/django.js +0 -356
  448. package/static/assets/codemirror/mode/dockerfile/dockerfile.js +0 -211
  449. package/static/assets/codemirror/mode/dtd/dtd.js +0 -142
  450. package/static/assets/codemirror/mode/dylan/dylan.js +0 -352
  451. package/static/assets/codemirror/mode/ebnf/ebnf.js +0 -195
  452. package/static/assets/codemirror/mode/ecl/ecl.js +0 -206
  453. package/static/assets/codemirror/mode/eiffel/eiffel.js +0 -160
  454. package/static/assets/codemirror/mode/elm/elm.js +0 -245
  455. package/static/assets/codemirror/mode/erlang/erlang.js +0 -619
  456. package/static/assets/codemirror/mode/factor/factor.js +0 -85
  457. package/static/assets/codemirror/mode/fcl/fcl.js +0 -173
  458. package/static/assets/codemirror/mode/forth/forth.js +0 -180
  459. package/static/assets/codemirror/mode/fortran/fortran.js +0 -188
  460. package/static/assets/codemirror/mode/gas/gas.js +0 -355
  461. package/static/assets/codemirror/mode/gfm/gfm.js +0 -129
  462. package/static/assets/codemirror/mode/gherkin/gherkin.js +0 -194
  463. package/static/assets/codemirror/mode/go/go.js +0 -187
  464. package/static/assets/codemirror/mode/groovy/groovy.js +0 -245
  465. package/static/assets/codemirror/mode/haml/haml.js +0 -161
  466. package/static/assets/codemirror/mode/handlebars/handlebars.js +0 -70
  467. package/static/assets/codemirror/mode/haskell/haskell.js +0 -268
  468. package/static/assets/codemirror/mode/haskell-literate/haskell-literate.js +0 -43
  469. package/static/assets/codemirror/mode/haxe/haxe.js +0 -515
  470. package/static/assets/codemirror/mode/htmlembedded/htmlembedded.js +0 -37
  471. package/static/assets/codemirror/mode/htmlmixed/htmlmixed.js +0 -153
  472. package/static/assets/codemirror/mode/http/http.js +0 -113
  473. package/static/assets/codemirror/mode/idl/idl.js +0 -290
  474. package/static/assets/codemirror/mode/javascript/javascript.js +0 -960
  475. package/static/assets/codemirror/mode/jinja2/jinja2.js +0 -193
  476. package/static/assets/codemirror/mode/jsx/jsx.js +0 -149
  477. package/static/assets/codemirror/mode/julia/julia.js +0 -390
  478. package/static/assets/codemirror/mode/livescript/livescript.js +0 -280
  479. package/static/assets/codemirror/mode/lua/lua.js +0 -160
  480. package/static/assets/codemirror/mode/markdown/markdown.js +0 -886
  481. package/static/assets/codemirror/mode/mathematica/mathematica.js +0 -176
  482. package/static/assets/codemirror/mode/mbox/mbox.js +0 -129
  483. package/static/assets/codemirror/mode/meta.js +0 -221
  484. package/static/assets/codemirror/mode/mirc/mirc.js +0 -193
  485. package/static/assets/codemirror/mode/mllike/mllike.js +0 -359
  486. package/static/assets/codemirror/mode/modelica/modelica.js +0 -245
  487. package/static/assets/codemirror/mode/mscgen/mscgen.js +0 -175
  488. package/static/assets/codemirror/mode/mumps/mumps.js +0 -148
  489. package/static/assets/codemirror/mode/nginx/nginx.js +0 -178
  490. package/static/assets/codemirror/mode/nsis/nsis.js +0 -95
  491. package/static/assets/codemirror/mode/ntriples/ntriples.js +0 -195
  492. package/static/assets/codemirror/mode/octave/octave.js +0 -139
  493. package/static/assets/codemirror/mode/oz/oz.js +0 -252
  494. package/static/assets/codemirror/mode/pascal/pascal.js +0 -136
  495. package/static/assets/codemirror/mode/pegjs/pegjs.js +0 -111
  496. package/static/assets/codemirror/mode/perl/perl.js +0 -836
  497. package/static/assets/codemirror/mode/php/php.js +0 -234
  498. package/static/assets/codemirror/mode/pig/pig.js +0 -178
  499. package/static/assets/codemirror/mode/powershell/powershell.js +0 -398
  500. package/static/assets/codemirror/mode/properties/properties.js +0 -78
  501. package/static/assets/codemirror/mode/protobuf/protobuf.js +0 -72
  502. package/static/assets/codemirror/mode/pug/pug.js +0 -591
  503. package/static/assets/codemirror/mode/puppet/puppet.js +0 -220
  504. package/static/assets/codemirror/mode/python/python.js +0 -402
  505. package/static/assets/codemirror/mode/q/q.js +0 -139
  506. package/static/assets/codemirror/mode/r/r.js +0 -190
  507. package/static/assets/codemirror/mode/rpm/changes/index.html +0 -66
  508. package/static/assets/codemirror/mode/rpm/rpm.js +0 -109
  509. package/static/assets/codemirror/mode/rst/rst.js +0 -557
  510. package/static/assets/codemirror/mode/ruby/ruby.js +0 -303
  511. package/static/assets/codemirror/mode/rust/rust.js +0 -72
  512. package/static/assets/codemirror/mode/sas/sas.js +0 -303
  513. package/static/assets/codemirror/mode/sass/sass.js +0 -459
  514. package/static/assets/codemirror/mode/scheme/scheme.js +0 -284
  515. package/static/assets/codemirror/mode/shell/shell.js +0 -168
  516. package/static/assets/codemirror/mode/sieve/sieve.js +0 -193
  517. package/static/assets/codemirror/mode/slim/slim.js +0 -575
  518. package/static/assets/codemirror/mode/smalltalk/smalltalk.js +0 -168
  519. package/static/assets/codemirror/mode/smarty/smarty.js +0 -225
  520. package/static/assets/codemirror/mode/solr/solr.js +0 -104
  521. package/static/assets/codemirror/mode/soy/soy.js +0 -665
  522. package/static/assets/codemirror/mode/sparql/sparql.js +0 -184
  523. package/static/assets/codemirror/mode/spreadsheet/spreadsheet.js +0 -112
  524. package/static/assets/codemirror/mode/sql/sql.js +0 -529
  525. package/static/assets/codemirror/mode/stex/stex.js +0 -264
  526. package/static/assets/codemirror/mode/stylus/stylus.js +0 -775
  527. package/static/assets/codemirror/mode/swift/swift.js +0 -221
  528. package/static/assets/codemirror/mode/tcl/tcl.js +0 -140
  529. package/static/assets/codemirror/mode/textile/textile.js +0 -469
  530. package/static/assets/codemirror/mode/tiddlywiki/tiddlywiki.css +0 -14
  531. package/static/assets/codemirror/mode/tiddlywiki/tiddlywiki.js +0 -308
  532. package/static/assets/codemirror/mode/tiki/tiki.css +0 -26
  533. package/static/assets/codemirror/mode/tiki/tiki.js +0 -312
  534. package/static/assets/codemirror/mode/toml/toml.js +0 -88
  535. package/static/assets/codemirror/mode/tornado/tornado.js +0 -68
  536. package/static/assets/codemirror/mode/troff/troff.js +0 -84
  537. package/static/assets/codemirror/mode/ttcn/ttcn.js +0 -283
  538. package/static/assets/codemirror/mode/ttcn-cfg/ttcn-cfg.js +0 -214
  539. package/static/assets/codemirror/mode/turtle/turtle.js +0 -162
  540. package/static/assets/codemirror/mode/twig/twig.js +0 -141
  541. package/static/assets/codemirror/mode/vb/vb.js +0 -275
  542. package/static/assets/codemirror/mode/vbscript/vbscript.js +0 -350
  543. package/static/assets/codemirror/mode/velocity/velocity.js +0 -202
  544. package/static/assets/codemirror/mode/verilog/verilog.js +0 -781
  545. package/static/assets/codemirror/mode/vhdl/vhdl.js +0 -189
  546. package/static/assets/codemirror/mode/vue/vue.js +0 -77
  547. package/static/assets/codemirror/mode/wast/wast.js +0 -132
  548. package/static/assets/codemirror/mode/webidl/webidl.js +0 -195
  549. package/static/assets/codemirror/mode/xml/xml.js +0 -417
  550. package/static/assets/codemirror/mode/xquery/xquery.js +0 -448
  551. package/static/assets/codemirror/mode/yacas/yacas.js +0 -204
  552. package/static/assets/codemirror/mode/yaml/yaml.js +0 -120
  553. package/static/assets/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +0 -72
  554. package/static/assets/codemirror/mode/z80/z80.js +0 -116
  555. package/static/chunk-2KLC4T2Z.js +0 -1
  556. package/static/chunk-2VMSXRCB.js +0 -12
  557. package/static/chunk-3OHSRRKH.js +0 -4
  558. package/static/chunk-3R4WKOHQ.js +0 -1
  559. package/static/chunk-3XVM35O2.js +0 -1
  560. package/static/chunk-3YVRP3VM.js +0 -2
  561. package/static/chunk-5UKZLU5H.js +0 -1
  562. package/static/chunk-AF24EYXU.js +0 -1
  563. package/static/chunk-AKQVEHO6.js +0 -2
  564. package/static/chunk-BCVX464U.js +0 -2
  565. package/static/chunk-BQV4FRM6.js +0 -1
  566. package/static/chunk-CETH7UYS.js +0 -1
  567. package/static/chunk-DIT6W7VM.js +0 -562
  568. package/static/chunk-DKSEQTMX.js +0 -1
  569. package/static/chunk-FZ3JPGYZ.js +0 -1
  570. package/static/chunk-IQSKQXC3.js +0 -1
  571. package/static/chunk-ITUFI2BJ.js +0 -1
  572. package/static/chunk-LCTZJ537.js +0 -1
  573. package/static/chunk-LK2UCQJ6.js +0 -1
  574. package/static/chunk-LP5TBXEN.js +0 -7
  575. package/static/chunk-N3U6637P.js +0 -1
  576. package/static/chunk-NNV4OXSB.js +0 -1
  577. package/static/chunk-O6FYXVHI.js +0 -1
  578. package/static/chunk-OOGP4WSH.js +0 -2
  579. package/static/chunk-PCWDQPOM.js +0 -2
  580. package/static/chunk-PNR6M34W.js +0 -1
  581. package/static/chunk-Q5KM7LTX.js +0 -1
  582. package/static/chunk-QHC6ZPQ4.js +0 -1
  583. package/static/chunk-QMRBZHE4.js +0 -1
  584. package/static/chunk-QSJRY3TF.js +0 -1
  585. package/static/chunk-QUUIRSYT.js +0 -1
  586. package/static/chunk-RFH46UW3.js +0 -1
  587. package/static/chunk-RSXHRKM5.js +0 -1
  588. package/static/chunk-RV3VZJPZ.js +0 -1
  589. package/static/chunk-S7HNXVRB.js +0 -1
  590. package/static/chunk-SBZ572Q4.js +0 -2
  591. package/static/chunk-SJR5R3Y4.js +0 -1
  592. package/static/chunk-SLHTEGRU.js +0 -1
  593. package/static/chunk-SSFF27P2.js +0 -24
  594. package/static/chunk-V3LHHZYN.js +0 -1
  595. package/static/chunk-VQQKMY2C.js +0 -1
  596. package/static/chunk-WSSU2HXE.js +0 -1
  597. package/static/chunk-XDZGW64M.js +0 -3
  598. package/static/chunk-XTRDKGKG.js +0 -1
  599. package/static/chunk-YLWTEC3X.js +0 -1
  600. package/static/chunk-Z5J5F5SX.js +0 -1
  601. package/static/main-4H5BJY3J.js +0 -9
  602. package/static/scripts-WRDOQIU5.js +0 -24
  603. package/static/styles-2C2UNCNB.css +0 -1
@@ -21,8 +21,8 @@
21
21
  */
22
22
 
23
23
  /**
24
- * pdfjsVersion = 5.4.296
25
- * pdfjsBuild = f56dc8601
24
+ * pdfjsVersion = 5.4.394
25
+ * pdfjsBuild = 2cc809ade
26
26
  */
27
27
  /******/ // The require scope
28
28
  /******/ var __webpack_require__ = {};
@@ -108,6 +108,11 @@ const PermissionFlag = {
108
108
  ASSEMBLE: 0x400,
109
109
  PRINT_HIGH_QUALITY: 0x800
110
110
  };
111
+ const MeshFigureType = {
112
+ TRIANGLES: 1,
113
+ LATTICE: 2,
114
+ PATCH: 3
115
+ };
111
116
  const TextRenderingMode = {
112
117
  FILL: 0,
113
118
  STROKE: 1,
@@ -326,7 +331,8 @@ const DrawOPS = {
326
331
  moveTo: 0,
327
332
  lineTo: 1,
328
333
  curveTo: 2,
329
- closePath: 3
334
+ quadraticCurveTo: 3,
335
+ closePath: 4
330
336
  };
331
337
  const PasswordResponses = {
332
338
  NEED_PASSWORD: 1,
@@ -515,6 +521,12 @@ class FeatureTest {
515
521
  static get isImageDecoderSupported() {
516
522
  return shadow(this, "isImageDecoderSupported", typeof ImageDecoder !== "undefined");
517
523
  }
524
+ static get isFloat16ArraySupported() {
525
+ return shadow(this, "isFloat16ArraySupported", typeof Float16Array !== "undefined");
526
+ }
527
+ static get isSanitizerSupported() {
528
+ return shadow(this, "isSanitizerSupported", typeof Sanitizer !== "undefined");
529
+ }
518
530
  static get platform() {
519
531
  const {
520
532
  platform,
@@ -1293,6 +1305,9 @@ class BaseStream {
1293
1305
  getBaseStreams() {
1294
1306
  return null;
1295
1307
  }
1308
+ getOriginalStream() {
1309
+ return this.stream?.getOriginalStream() || this;
1310
+ }
1296
1311
  }
1297
1312
 
1298
1313
  ;// ./src/core/core_utils.js
@@ -3898,7 +3913,7 @@ class DecodeStream extends BaseStream {
3898
3913
  return new Stream(this.buffer, start, length, dict);
3899
3914
  }
3900
3915
  getBaseStreams() {
3901
- return this.str ? this.str.getBaseStreams() : null;
3916
+ return this.stream ? this.stream.getBaseStreams() : null;
3902
3917
  }
3903
3918
  }
3904
3919
  class StreamsSequenceStream extends DecodeStream {
@@ -6979,7 +6994,7 @@ class Ascii85Stream extends DecodeStream {
6979
6994
  maybeLength *= 0.8;
6980
6995
  }
6981
6996
  super(maybeLength);
6982
- this.str = str;
6997
+ this.stream = str;
6983
6998
  this.dict = str.dict;
6984
6999
  this.input = new Uint8Array(5);
6985
7000
  }
@@ -6987,7 +7002,7 @@ class Ascii85Stream extends DecodeStream {
6987
7002
  const TILDA_CHAR = 0x7e;
6988
7003
  const Z_LOWER_CHAR = 0x7a;
6989
7004
  const EOF = -1;
6990
- const str = this.str;
7005
+ const str = this.stream;
6991
7006
  let c = str.getByte();
6992
7007
  while (isWhiteSpace(c)) {
6993
7008
  c = str.getByte();
@@ -7045,13 +7060,13 @@ class AsciiHexStream extends DecodeStream {
7045
7060
  maybeLength *= 0.5;
7046
7061
  }
7047
7062
  super(maybeLength);
7048
- this.str = str;
7063
+ this.stream = str;
7049
7064
  this.dict = str.dict;
7050
7065
  this.firstDigit = -1;
7051
7066
  }
7052
7067
  readBlock() {
7053
7068
  const UPSTREAM_BLOCK_SIZE = 8000;
7054
- const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
7069
+ const bytes = this.stream.getBytes(UPSTREAM_BLOCK_SIZE);
7055
7070
  if (!bytes.length) {
7056
7071
  this.eof = true;
7057
7072
  return;
@@ -7605,7 +7620,7 @@ class CCITTFaxDecoder {
7605
7620
  class CCITTFaxStream extends DecodeStream {
7606
7621
  constructor(str, maybeLength, params) {
7607
7622
  super(maybeLength);
7608
- this.str = str;
7623
+ this.stream = str;
7609
7624
  this.dict = str.dict;
7610
7625
  if (!(params instanceof Dict)) {
7611
7626
  params = Dict.empty;
@@ -7650,7 +7665,7 @@ const fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x
7650
7665
  class FlateStream extends DecodeStream {
7651
7666
  constructor(str, maybeLength) {
7652
7667
  super(maybeLength);
7653
- this.str = str;
7668
+ this.stream = str;
7654
7669
  this.dict = str.dict;
7655
7670
  const cmf = str.getByte();
7656
7671
  const flg = str.getByte();
@@ -7680,8 +7695,8 @@ class FlateStream extends DecodeStream {
7680
7695
  return data.subarray(0, length);
7681
7696
  }
7682
7697
  async asyncGetBytes() {
7683
- this.str.reset();
7684
- const bytes = this.str.getBytes();
7698
+ this.stream.reset();
7699
+ const bytes = this.stream.getBytes();
7685
7700
  try {
7686
7701
  const {
7687
7702
  readable,
@@ -7707,7 +7722,7 @@ class FlateStream extends DecodeStream {
7707
7722
  }
7708
7723
  return data;
7709
7724
  } catch {
7710
- this.str = new Stream(bytes, 2, bytes.length, this.str.dict);
7725
+ this.stream = new Stream(bytes, 2, bytes.length, this.stream.dict);
7711
7726
  this.reset();
7712
7727
  return null;
7713
7728
  }
@@ -7716,7 +7731,7 @@ class FlateStream extends DecodeStream {
7716
7731
  return true;
7717
7732
  }
7718
7733
  getBits(bits) {
7719
- const str = this.str;
7734
+ const str = this.stream;
7720
7735
  let codeSize = this.codeSize;
7721
7736
  let codeBuf = this.codeBuf;
7722
7737
  let b;
@@ -7733,7 +7748,7 @@ class FlateStream extends DecodeStream {
7733
7748
  return b;
7734
7749
  }
7735
7750
  getCode(table) {
7736
- const str = this.str;
7751
+ const str = this.stream;
7737
7752
  const codes = table[0];
7738
7753
  const maxLen = table[1];
7739
7754
  let codeSize = this.codeSize;
@@ -7791,7 +7806,7 @@ class FlateStream extends DecodeStream {
7791
7806
  }
7792
7807
  readBlock() {
7793
7808
  let buffer, hdr, len;
7794
- const str = this.str;
7809
+ const str = this.stream;
7795
7810
  try {
7796
7811
  hdr = this.getBits(3);
7797
7812
  } catch (ex) {
@@ -10103,7 +10118,7 @@ class JpxStream extends DecodeStream {
10103
10118
  class LZWStream extends DecodeStream {
10104
10119
  constructor(str, maybeLength, earlyChange) {
10105
10120
  super(maybeLength);
10106
- this.str = str;
10121
+ this.stream = str;
10107
10122
  this.dict = str.dict;
10108
10123
  this.cachedData = 0;
10109
10124
  this.bitsCached = 0;
@@ -10128,7 +10143,7 @@ class LZWStream extends DecodeStream {
10128
10143
  let bitsCached = this.bitsCached;
10129
10144
  let cachedData = this.cachedData;
10130
10145
  while (bitsCached < n) {
10131
- const c = this.str.getByte();
10146
+ const c = this.stream.getByte();
10132
10147
  if (c === -1) {
10133
10148
  this.eof = true;
10134
10149
  return null;
@@ -10233,7 +10248,7 @@ class PredictorStream extends DecodeStream {
10233
10248
  throw new FormatError(`Unsupported predictor: ${predictor}`);
10234
10249
  }
10235
10250
  this.readBlock = predictor === 2 ? this.readBlockTiff : this.readBlockPng;
10236
- this.str = str;
10251
+ this.stream = str;
10237
10252
  this.dict = str.dict;
10238
10253
  const colors = this.colors = params.get("Colors") || 1;
10239
10254
  const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
@@ -10248,7 +10263,7 @@ class PredictorStream extends DecodeStream {
10248
10263
  const buffer = this.ensureBuffer(bufferLength + rowBytes);
10249
10264
  const bits = this.bits;
10250
10265
  const colors = this.colors;
10251
- const rawBytes = this.str.getBytes(rowBytes);
10266
+ const rawBytes = this.stream.getBytes(rowBytes);
10252
10267
  this.eof = !rawBytes.length;
10253
10268
  if (this.eof) {
10254
10269
  return;
@@ -10317,8 +10332,8 @@ class PredictorStream extends DecodeStream {
10317
10332
  readBlockPng() {
10318
10333
  const rowBytes = this.rowBytes;
10319
10334
  const pixBytes = this.pixBytes;
10320
- const predictor = this.str.getByte();
10321
- const rawBytes = this.str.getBytes(rowBytes);
10335
+ const predictor = this.stream.getByte();
10336
+ const rawBytes = this.stream.getBytes(rowBytes);
10322
10337
  this.eof = !rawBytes.length;
10323
10338
  if (this.eof) {
10324
10339
  return;
@@ -10407,11 +10422,11 @@ class PredictorStream extends DecodeStream {
10407
10422
  class RunLengthStream extends DecodeStream {
10408
10423
  constructor(str, maybeLength) {
10409
10424
  super(maybeLength);
10410
- this.str = str;
10425
+ this.stream = str;
10411
10426
  this.dict = str.dict;
10412
10427
  }
10413
10428
  readBlock() {
10414
- const repeatHeader = this.str.getBytes(2);
10429
+ const repeatHeader = this.stream.getBytes(2);
10415
10430
  if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
10416
10431
  this.eof = true;
10417
10432
  return;
@@ -10423,7 +10438,7 @@ class RunLengthStream extends DecodeStream {
10423
10438
  buffer = this.ensureBuffer(bufferLength + n + 1);
10424
10439
  buffer[bufferLength++] = repeatHeader[1];
10425
10440
  if (n > 0) {
10426
- const source = this.str.getBytes(n);
10441
+ const source = this.stream.getBytes(n);
10427
10442
  buffer.set(source, bufferLength);
10428
10443
  bufferLength += n;
10429
10444
  }
@@ -19534,16 +19549,16 @@ function lookupCmap(ranges, unicode) {
19534
19549
  function compileGlyf(code, cmds, font) {
19535
19550
  function moveTo(x, y) {
19536
19551
  if (firstPoint) {
19537
- cmds.add("L", firstPoint);
19552
+ cmds.add(DrawOPS.lineTo, firstPoint);
19538
19553
  }
19539
19554
  firstPoint = [x, y];
19540
- cmds.add("M", [x, y]);
19555
+ cmds.add(DrawOPS.moveTo, [x, y]);
19541
19556
  }
19542
19557
  function lineTo(x, y) {
19543
- cmds.add("L", [x, y]);
19558
+ cmds.add(DrawOPS.lineTo, [x, y]);
19544
19559
  }
19545
19560
  function quadraticCurveTo(xa, ya, x, y) {
19546
- cmds.add("Q", [xa, ya, x, y]);
19561
+ cmds.add(DrawOPS.quadraticCurveTo, [xa, ya, x, y]);
19547
19562
  }
19548
19563
  let i = 0;
19549
19564
  const numberOfContours = readInt16(code, i);
@@ -19696,16 +19711,16 @@ function compileGlyf(code, cmds, font) {
19696
19711
  function compileCharString(charStringCode, cmds, font, glyphId) {
19697
19712
  function moveTo(x, y) {
19698
19713
  if (firstPoint) {
19699
- cmds.add("L", firstPoint);
19714
+ cmds.add(DrawOPS.lineTo, firstPoint);
19700
19715
  }
19701
19716
  firstPoint = [x, y];
19702
- cmds.add("M", [x, y]);
19717
+ cmds.add(DrawOPS.moveTo, [x, y]);
19703
19718
  }
19704
19719
  function lineTo(x, y) {
19705
- cmds.add("L", [x, y]);
19720
+ cmds.add(DrawOPS.lineTo, [x, y]);
19706
19721
  }
19707
19722
  function bezierCurveTo(x1, y1, x2, y2, x, y) {
19708
- cmds.add("C", [x1, y1, x2, y2, x, y]);
19723
+ cmds.add(DrawOPS.curveTo, [x1, y1, x2, y2, x, y]);
19709
19724
  }
19710
19725
  const stack = [];
19711
19726
  let x = 0,
@@ -20059,7 +20074,7 @@ class Commands {
20059
20074
  for (let i = 0, ii = args.length; i < ii; i += 2) {
20060
20075
  Util.applyTransform(args, currentTransform, i);
20061
20076
  }
20062
- this.cmds.push(`${cmd}${args.join(" ")}`);
20077
+ this.cmds.push(cmd, ...args);
20063
20078
  } else {
20064
20079
  this.cmds.push(cmd);
20065
20080
  }
@@ -20076,8 +20091,8 @@ class Commands {
20076
20091
  restore() {
20077
20092
  this.currentTransform = this.transformStack.pop() || [1, 0, 0, 1, 0, 0];
20078
20093
  }
20079
- getSVG() {
20080
- return this.cmds.join("");
20094
+ getPath() {
20095
+ return new (FeatureTest.isFloat16ArraySupported ? Float16Array : Float32Array)(this.cmds);
20081
20096
  }
20082
20097
  }
20083
20098
  class CompiledFont {
@@ -20126,8 +20141,8 @@ class CompiledFont {
20126
20141
  const cmds = new Commands();
20127
20142
  cmds.transform(fontMatrix.slice());
20128
20143
  this.compileGlyphImpl(code, cmds, glyphId);
20129
- cmds.add("Z");
20130
- return cmds.getSVG();
20144
+ cmds.add(DrawOPS.closePath);
20145
+ return cmds.getPath();
20131
20146
  }
20132
20147
  compileGlyphImpl() {
20133
20148
  unreachable("Children classes should implement this.");
@@ -27183,6 +27198,660 @@ class ErrorFont {
27183
27198
  }
27184
27199
  }
27185
27200
 
27201
+ ;// ./src/shared/obj-bin-transform.js
27202
+
27203
+ class CssFontInfo {
27204
+ #buffer;
27205
+ #view;
27206
+ #decoder;
27207
+ static strings = ["fontFamily", "fontWeight", "italicAngle"];
27208
+ static write(info) {
27209
+ const encoder = new TextEncoder();
27210
+ const encodedStrings = {};
27211
+ let stringsLength = 0;
27212
+ for (const prop of CssFontInfo.strings) {
27213
+ const encoded = encoder.encode(info[prop]);
27214
+ encodedStrings[prop] = encoded;
27215
+ stringsLength += 4 + encoded.length;
27216
+ }
27217
+ const buffer = new ArrayBuffer(stringsLength);
27218
+ const data = new Uint8Array(buffer);
27219
+ const view = new DataView(buffer);
27220
+ let offset = 0;
27221
+ for (const prop of CssFontInfo.strings) {
27222
+ const encoded = encodedStrings[prop];
27223
+ const length = encoded.length;
27224
+ view.setUint32(offset, length);
27225
+ data.set(encoded, offset + 4);
27226
+ offset += 4 + length;
27227
+ }
27228
+ assert(offset === buffer.byteLength, "CssFontInfo.write: Buffer overflow");
27229
+ return buffer;
27230
+ }
27231
+ constructor(buffer) {
27232
+ this.#buffer = buffer;
27233
+ this.#view = new DataView(this.#buffer);
27234
+ this.#decoder = new TextDecoder();
27235
+ }
27236
+ #readString(index) {
27237
+ assert(index < CssFontInfo.strings.length, "Invalid string index");
27238
+ let offset = 0;
27239
+ for (let i = 0; i < index; i++) {
27240
+ offset += this.#view.getUint32(offset) + 4;
27241
+ }
27242
+ const length = this.#view.getUint32(offset);
27243
+ return this.#decoder.decode(new Uint8Array(this.#buffer, offset + 4, length));
27244
+ }
27245
+ get fontFamily() {
27246
+ return this.#readString(0);
27247
+ }
27248
+ get fontWeight() {
27249
+ return this.#readString(1);
27250
+ }
27251
+ get italicAngle() {
27252
+ return this.#readString(2);
27253
+ }
27254
+ }
27255
+ class SystemFontInfo {
27256
+ #buffer;
27257
+ #view;
27258
+ #decoder;
27259
+ static strings = ["css", "loadedName", "baseFontName", "src"];
27260
+ static write(info) {
27261
+ const encoder = new TextEncoder();
27262
+ const encodedStrings = {};
27263
+ let stringsLength = 0;
27264
+ for (const prop of SystemFontInfo.strings) {
27265
+ const encoded = encoder.encode(info[prop]);
27266
+ encodedStrings[prop] = encoded;
27267
+ stringsLength += 4 + encoded.length;
27268
+ }
27269
+ stringsLength += 4;
27270
+ let encodedStyleStyle,
27271
+ encodedStyleWeight,
27272
+ lengthEstimate = 1 + stringsLength;
27273
+ if (info.style) {
27274
+ encodedStyleStyle = encoder.encode(info.style.style);
27275
+ encodedStyleWeight = encoder.encode(info.style.weight);
27276
+ lengthEstimate += 4 + encodedStyleStyle.length + 4 + encodedStyleWeight.length;
27277
+ }
27278
+ const buffer = new ArrayBuffer(lengthEstimate);
27279
+ const data = new Uint8Array(buffer);
27280
+ const view = new DataView(buffer);
27281
+ let offset = 0;
27282
+ view.setUint8(offset++, info.guessFallback ? 1 : 0);
27283
+ view.setUint32(offset, 0);
27284
+ offset += 4;
27285
+ stringsLength = 0;
27286
+ for (const prop of SystemFontInfo.strings) {
27287
+ const encoded = encodedStrings[prop];
27288
+ const length = encoded.length;
27289
+ stringsLength += 4 + length;
27290
+ view.setUint32(offset, length);
27291
+ data.set(encoded, offset + 4);
27292
+ offset += 4 + length;
27293
+ }
27294
+ view.setUint32(offset - stringsLength - 4, stringsLength);
27295
+ if (info.style) {
27296
+ view.setUint32(offset, encodedStyleStyle.length);
27297
+ data.set(encodedStyleStyle, offset + 4);
27298
+ offset += 4 + encodedStyleStyle.length;
27299
+ view.setUint32(offset, encodedStyleWeight.length);
27300
+ data.set(encodedStyleWeight, offset + 4);
27301
+ offset += 4 + encodedStyleWeight.length;
27302
+ }
27303
+ assert(offset <= buffer.byteLength, "SubstitionInfo.write: Buffer overflow");
27304
+ return buffer.transferToFixedLength(offset);
27305
+ }
27306
+ constructor(buffer) {
27307
+ this.#buffer = buffer;
27308
+ this.#view = new DataView(this.#buffer);
27309
+ this.#decoder = new TextDecoder();
27310
+ }
27311
+ get guessFallback() {
27312
+ return this.#view.getUint8(0) !== 0;
27313
+ }
27314
+ #readString(index) {
27315
+ assert(index < SystemFontInfo.strings.length, "Invalid string index");
27316
+ let offset = 5;
27317
+ for (let i = 0; i < index; i++) {
27318
+ offset += this.#view.getUint32(offset) + 4;
27319
+ }
27320
+ const length = this.#view.getUint32(offset);
27321
+ return this.#decoder.decode(new Uint8Array(this.#buffer, offset + 4, length));
27322
+ }
27323
+ get css() {
27324
+ return this.#readString(0);
27325
+ }
27326
+ get loadedName() {
27327
+ return this.#readString(1);
27328
+ }
27329
+ get baseFontName() {
27330
+ return this.#readString(2);
27331
+ }
27332
+ get src() {
27333
+ return this.#readString(3);
27334
+ }
27335
+ get style() {
27336
+ let offset = 1;
27337
+ offset += 4 + this.#view.getUint32(offset);
27338
+ const styleLength = this.#view.getUint32(offset);
27339
+ const style = this.#decoder.decode(new Uint8Array(this.#buffer, offset + 4, styleLength));
27340
+ offset += 4 + styleLength;
27341
+ const weightLength = this.#view.getUint32(offset);
27342
+ const weight = this.#decoder.decode(new Uint8Array(this.#buffer, offset + 4, weightLength));
27343
+ return {
27344
+ style,
27345
+ weight
27346
+ };
27347
+ }
27348
+ }
27349
+ class FontInfo {
27350
+ static bools = ["black", "bold", "disableFontFace", "fontExtraProperties", "isInvalidPDFjsFont", "isType3Font", "italic", "missingFile", "remeasure", "vertical"];
27351
+ static numbers = ["ascent", "defaultWidth", "descent"];
27352
+ static strings = ["fallbackName", "loadedName", "mimetype", "name"];
27353
+ static #OFFSET_NUMBERS = Math.ceil(this.bools.length * 2 / 8);
27354
+ static #OFFSET_BBOX = this.#OFFSET_NUMBERS + this.numbers.length * 8;
27355
+ static #OFFSET_FONT_MATRIX = this.#OFFSET_BBOX + 1 + 2 * 4;
27356
+ static #OFFSET_DEFAULT_VMETRICS = this.#OFFSET_FONT_MATRIX + 1 + 8 * 6;
27357
+ static #OFFSET_STRINGS = this.#OFFSET_DEFAULT_VMETRICS + 1 + 2 * 3;
27358
+ #buffer;
27359
+ #decoder;
27360
+ #view;
27361
+ constructor({
27362
+ data,
27363
+ extra
27364
+ }) {
27365
+ this.#buffer = data;
27366
+ this.#decoder = new TextDecoder();
27367
+ this.#view = new DataView(this.#buffer);
27368
+ if (extra) {
27369
+ Object.assign(this, extra);
27370
+ }
27371
+ }
27372
+ #readBoolean(index) {
27373
+ assert(index < FontInfo.bools.length, "Invalid boolean index");
27374
+ const byteOffset = Math.floor(index / 4);
27375
+ const bitOffset = index * 2 % 8;
27376
+ const value = this.#view.getUint8(byteOffset) >> bitOffset & 0x03;
27377
+ return value === 0x00 ? undefined : value === 0x02;
27378
+ }
27379
+ get black() {
27380
+ return this.#readBoolean(0);
27381
+ }
27382
+ get bold() {
27383
+ return this.#readBoolean(1);
27384
+ }
27385
+ get disableFontFace() {
27386
+ return this.#readBoolean(2);
27387
+ }
27388
+ get fontExtraProperties() {
27389
+ return this.#readBoolean(3);
27390
+ }
27391
+ get isInvalidPDFjsFont() {
27392
+ return this.#readBoolean(4);
27393
+ }
27394
+ get isType3Font() {
27395
+ return this.#readBoolean(5);
27396
+ }
27397
+ get italic() {
27398
+ return this.#readBoolean(6);
27399
+ }
27400
+ get missingFile() {
27401
+ return this.#readBoolean(7);
27402
+ }
27403
+ get remeasure() {
27404
+ return this.#readBoolean(8);
27405
+ }
27406
+ get vertical() {
27407
+ return this.#readBoolean(9);
27408
+ }
27409
+ #readNumber(index) {
27410
+ assert(index < FontInfo.numbers.length, "Invalid number index");
27411
+ return this.#view.getFloat64(FontInfo.#OFFSET_NUMBERS + index * 8);
27412
+ }
27413
+ get ascent() {
27414
+ return this.#readNumber(0);
27415
+ }
27416
+ get defaultWidth() {
27417
+ return this.#readNumber(1);
27418
+ }
27419
+ get descent() {
27420
+ return this.#readNumber(2);
27421
+ }
27422
+ get bbox() {
27423
+ let offset = FontInfo.#OFFSET_BBOX;
27424
+ const numCoords = this.#view.getUint8(offset);
27425
+ if (numCoords === 0) {
27426
+ return undefined;
27427
+ }
27428
+ offset += 1;
27429
+ const bbox = [];
27430
+ for (let i = 0; i < 4; i++) {
27431
+ bbox.push(this.#view.getInt16(offset, true));
27432
+ offset += 2;
27433
+ }
27434
+ return bbox;
27435
+ }
27436
+ get fontMatrix() {
27437
+ let offset = FontInfo.#OFFSET_FONT_MATRIX;
27438
+ const numPoints = this.#view.getUint8(offset);
27439
+ if (numPoints === 0) {
27440
+ return undefined;
27441
+ }
27442
+ offset += 1;
27443
+ const fontMatrix = [];
27444
+ for (let i = 0; i < 6; i++) {
27445
+ fontMatrix.push(this.#view.getFloat64(offset, true));
27446
+ offset += 8;
27447
+ }
27448
+ return fontMatrix;
27449
+ }
27450
+ get defaultVMetrics() {
27451
+ let offset = FontInfo.#OFFSET_DEFAULT_VMETRICS;
27452
+ const numMetrics = this.#view.getUint8(offset);
27453
+ if (numMetrics === 0) {
27454
+ return undefined;
27455
+ }
27456
+ offset += 1;
27457
+ const defaultVMetrics = [];
27458
+ for (let i = 0; i < 3; i++) {
27459
+ defaultVMetrics.push(this.#view.getInt16(offset, true));
27460
+ offset += 2;
27461
+ }
27462
+ return defaultVMetrics;
27463
+ }
27464
+ #readString(index) {
27465
+ assert(index < FontInfo.strings.length, "Invalid string index");
27466
+ let offset = FontInfo.#OFFSET_STRINGS + 4;
27467
+ for (let i = 0; i < index; i++) {
27468
+ offset += this.#view.getUint32(offset) + 4;
27469
+ }
27470
+ const length = this.#view.getUint32(offset);
27471
+ const stringData = new Uint8Array(length);
27472
+ stringData.set(new Uint8Array(this.#buffer, offset + 4, length));
27473
+ return this.#decoder.decode(stringData);
27474
+ }
27475
+ get fallbackName() {
27476
+ return this.#readString(0);
27477
+ }
27478
+ get loadedName() {
27479
+ return this.#readString(1);
27480
+ }
27481
+ get mimetype() {
27482
+ return this.#readString(2);
27483
+ }
27484
+ get name() {
27485
+ return this.#readString(3);
27486
+ }
27487
+ get data() {
27488
+ let offset = FontInfo.#OFFSET_STRINGS;
27489
+ const stringsLength = this.#view.getUint32(offset);
27490
+ offset += 4 + stringsLength;
27491
+ const systemFontInfoLength = this.#view.getUint32(offset);
27492
+ offset += 4 + systemFontInfoLength;
27493
+ const cssFontInfoLength = this.#view.getUint32(offset);
27494
+ offset += 4 + cssFontInfoLength;
27495
+ const length = this.#view.getUint32(offset);
27496
+ if (length === 0) {
27497
+ return undefined;
27498
+ }
27499
+ return new Uint8Array(this.#buffer, offset + 4, length);
27500
+ }
27501
+ clearData() {
27502
+ let offset = FontInfo.#OFFSET_STRINGS;
27503
+ const stringsLength = this.#view.getUint32(offset);
27504
+ offset += 4 + stringsLength;
27505
+ const systemFontInfoLength = this.#view.getUint32(offset);
27506
+ offset += 4 + systemFontInfoLength;
27507
+ const cssFontInfoLength = this.#view.getUint32(offset);
27508
+ offset += 4 + cssFontInfoLength;
27509
+ const length = this.#view.getUint32(offset);
27510
+ const data = new Uint8Array(this.#buffer, offset + 4, length);
27511
+ data.fill(0);
27512
+ this.#view.setUint32(offset, 0);
27513
+ }
27514
+ get cssFontInfo() {
27515
+ let offset = FontInfo.#OFFSET_STRINGS;
27516
+ const stringsLength = this.#view.getUint32(offset);
27517
+ offset += 4 + stringsLength;
27518
+ const systemFontInfoLength = this.#view.getUint32(offset);
27519
+ offset += 4 + systemFontInfoLength;
27520
+ const cssFontInfoLength = this.#view.getUint32(offset);
27521
+ if (cssFontInfoLength === 0) {
27522
+ return null;
27523
+ }
27524
+ const cssFontInfoData = new Uint8Array(cssFontInfoLength);
27525
+ cssFontInfoData.set(new Uint8Array(this.#buffer, offset + 4, cssFontInfoLength));
27526
+ return new CssFontInfo(cssFontInfoData.buffer);
27527
+ }
27528
+ get systemFontInfo() {
27529
+ let offset = FontInfo.#OFFSET_STRINGS;
27530
+ const stringsLength = this.#view.getUint32(offset);
27531
+ offset += 4 + stringsLength;
27532
+ const systemFontInfoLength = this.#view.getUint32(offset);
27533
+ if (systemFontInfoLength === 0) {
27534
+ return null;
27535
+ }
27536
+ const systemFontInfoData = new Uint8Array(systemFontInfoLength);
27537
+ systemFontInfoData.set(new Uint8Array(this.#buffer, offset + 4, systemFontInfoLength));
27538
+ return new SystemFontInfo(systemFontInfoData.buffer);
27539
+ }
27540
+ static write(font) {
27541
+ const systemFontInfoBuffer = font.systemFontInfo ? SystemFontInfo.write(font.systemFontInfo) : null;
27542
+ const cssFontInfoBuffer = font.cssFontInfo ? CssFontInfo.write(font.cssFontInfo) : null;
27543
+ const encoder = new TextEncoder();
27544
+ const encodedStrings = {};
27545
+ let stringsLength = 0;
27546
+ for (const prop of FontInfo.strings) {
27547
+ encodedStrings[prop] = encoder.encode(font[prop]);
27548
+ stringsLength += 4 + encodedStrings[prop].length;
27549
+ }
27550
+ const lengthEstimate = FontInfo.#OFFSET_STRINGS + 4 + stringsLength + 4 + (systemFontInfoBuffer ? systemFontInfoBuffer.byteLength : 0) + 4 + (cssFontInfoBuffer ? cssFontInfoBuffer.byteLength : 0) + 4 + (font.data ? font.data.length : 0);
27551
+ const buffer = new ArrayBuffer(lengthEstimate);
27552
+ const data = new Uint8Array(buffer);
27553
+ const view = new DataView(buffer);
27554
+ let offset = 0;
27555
+ const numBools = FontInfo.bools.length;
27556
+ let boolByte = 0,
27557
+ boolBit = 0;
27558
+ for (let i = 0; i < numBools; i++) {
27559
+ const value = font[FontInfo.bools[i]];
27560
+ const bits = value === undefined ? 0x00 : value ? 0x02 : 0x01;
27561
+ boolByte |= bits << boolBit;
27562
+ boolBit += 2;
27563
+ if (boolBit === 8 || i === numBools - 1) {
27564
+ view.setUint8(offset++, boolByte);
27565
+ boolByte = 0;
27566
+ boolBit = 0;
27567
+ }
27568
+ }
27569
+ assert(offset === FontInfo.#OFFSET_NUMBERS, "FontInfo.write: Boolean properties offset mismatch");
27570
+ for (const prop of FontInfo.numbers) {
27571
+ view.setFloat64(offset, font[prop]);
27572
+ offset += 8;
27573
+ }
27574
+ assert(offset === FontInfo.#OFFSET_BBOX, "FontInfo.write: Number properties offset mismatch");
27575
+ if (font.bbox) {
27576
+ view.setUint8(offset++, 4);
27577
+ for (const coord of font.bbox) {
27578
+ view.setInt16(offset, coord, true);
27579
+ offset += 2;
27580
+ }
27581
+ } else {
27582
+ view.setUint8(offset++, 0);
27583
+ offset += 2 * 4;
27584
+ }
27585
+ assert(offset === FontInfo.#OFFSET_FONT_MATRIX, "FontInfo.write: BBox properties offset mismatch");
27586
+ if (font.fontMatrix) {
27587
+ view.setUint8(offset++, 6);
27588
+ for (const point of font.fontMatrix) {
27589
+ view.setFloat64(offset, point, true);
27590
+ offset += 8;
27591
+ }
27592
+ } else {
27593
+ view.setUint8(offset++, 0);
27594
+ offset += 8 * 6;
27595
+ }
27596
+ assert(offset === FontInfo.#OFFSET_DEFAULT_VMETRICS, "FontInfo.write: FontMatrix properties offset mismatch");
27597
+ if (font.defaultVMetrics) {
27598
+ view.setUint8(offset++, 1);
27599
+ for (const metric of font.defaultVMetrics) {
27600
+ view.setInt16(offset, metric, true);
27601
+ offset += 2;
27602
+ }
27603
+ } else {
27604
+ view.setUint8(offset++, 0);
27605
+ offset += 3 * 2;
27606
+ }
27607
+ assert(offset === FontInfo.#OFFSET_STRINGS, "FontInfo.write: DefaultVMetrics properties offset mismatch");
27608
+ view.setUint32(FontInfo.#OFFSET_STRINGS, 0);
27609
+ offset += 4;
27610
+ for (const prop of FontInfo.strings) {
27611
+ const encoded = encodedStrings[prop];
27612
+ const length = encoded.length;
27613
+ view.setUint32(offset, length);
27614
+ data.set(encoded, offset + 4);
27615
+ offset += 4 + length;
27616
+ }
27617
+ view.setUint32(FontInfo.#OFFSET_STRINGS, offset - FontInfo.#OFFSET_STRINGS - 4);
27618
+ if (!systemFontInfoBuffer) {
27619
+ view.setUint32(offset, 0);
27620
+ offset += 4;
27621
+ } else {
27622
+ const length = systemFontInfoBuffer.byteLength;
27623
+ view.setUint32(offset, length);
27624
+ assert(offset + 4 + length <= buffer.byteLength, "FontInfo.write: Buffer overflow at systemFontInfo");
27625
+ data.set(new Uint8Array(systemFontInfoBuffer), offset + 4);
27626
+ offset += 4 + length;
27627
+ }
27628
+ if (!cssFontInfoBuffer) {
27629
+ view.setUint32(offset, 0);
27630
+ offset += 4;
27631
+ } else {
27632
+ const length = cssFontInfoBuffer.byteLength;
27633
+ view.setUint32(offset, length);
27634
+ assert(offset + 4 + length <= buffer.byteLength, "FontInfo.write: Buffer overflow at cssFontInfo");
27635
+ data.set(new Uint8Array(cssFontInfoBuffer), offset + 4);
27636
+ offset += 4 + length;
27637
+ }
27638
+ if (font.data === undefined) {
27639
+ view.setUint32(offset, 0);
27640
+ offset += 4;
27641
+ } else {
27642
+ view.setUint32(offset, font.data.length);
27643
+ data.set(font.data, offset + 4);
27644
+ offset += 4 + font.data.length;
27645
+ }
27646
+ assert(offset <= buffer.byteLength, "FontInfo.write: Buffer overflow");
27647
+ return buffer.transferToFixedLength(offset);
27648
+ }
27649
+ }
27650
+ class PatternInfo {
27651
+ static #KIND = 0;
27652
+ static #HAS_BBOX = 1;
27653
+ static #HAS_BACKGROUND = 2;
27654
+ static #SHADING_TYPE = 3;
27655
+ static #N_COORD = 4;
27656
+ static #N_COLOR = 8;
27657
+ static #N_STOP = 12;
27658
+ static #N_FIGURES = 16;
27659
+ constructor(buffer) {
27660
+ this.buffer = buffer;
27661
+ this.view = new DataView(buffer);
27662
+ this.data = new Uint8Array(buffer);
27663
+ }
27664
+ static write(ir) {
27665
+ let kind,
27666
+ bbox = null,
27667
+ coords = [],
27668
+ colors = [],
27669
+ colorStops = [],
27670
+ figures = [],
27671
+ shadingType = null,
27672
+ background = null;
27673
+ switch (ir[0]) {
27674
+ case "RadialAxial":
27675
+ kind = ir[1] === "axial" ? 1 : 2;
27676
+ bbox = ir[2];
27677
+ colorStops = ir[3];
27678
+ if (kind === 1) {
27679
+ coords.push(...ir[4], ...ir[5]);
27680
+ } else {
27681
+ coords.push(ir[4][0], ir[4][1], ir[6], ir[5][0], ir[5][1], ir[7]);
27682
+ }
27683
+ break;
27684
+ case "Mesh":
27685
+ kind = 3;
27686
+ shadingType = ir[1];
27687
+ coords = ir[2];
27688
+ colors = ir[3];
27689
+ figures = ir[4] || [];
27690
+ bbox = ir[6];
27691
+ background = ir[7];
27692
+ break;
27693
+ default:
27694
+ throw new Error(`Unsupported pattern type: ${ir[0]}`);
27695
+ }
27696
+ const nCoord = Math.floor(coords.length / 2);
27697
+ const nColor = Math.floor(colors.length / 3);
27698
+ const nStop = colorStops.length;
27699
+ const nFigures = figures.length;
27700
+ let figuresSize = 0;
27701
+ for (const figure of figures) {
27702
+ figuresSize += 1;
27703
+ figuresSize = Math.ceil(figuresSize / 4) * 4;
27704
+ figuresSize += 4 + figure.coords.length * 4;
27705
+ figuresSize += 4 + figure.colors.length * 4;
27706
+ if (figure.verticesPerRow !== undefined) {
27707
+ figuresSize += 4;
27708
+ }
27709
+ }
27710
+ const byteLen = 20 + nCoord * 8 + nColor * 3 + nStop * 8 + (bbox ? 16 : 0) + (background ? 3 : 0) + figuresSize;
27711
+ const buffer = new ArrayBuffer(byteLen);
27712
+ const dataView = new DataView(buffer);
27713
+ const u8data = new Uint8Array(buffer);
27714
+ dataView.setUint8(PatternInfo.#KIND, kind);
27715
+ dataView.setUint8(PatternInfo.#HAS_BBOX, bbox ? 1 : 0);
27716
+ dataView.setUint8(PatternInfo.#HAS_BACKGROUND, background ? 1 : 0);
27717
+ dataView.setUint8(PatternInfo.#SHADING_TYPE, shadingType);
27718
+ dataView.setUint32(PatternInfo.#N_COORD, nCoord, true);
27719
+ dataView.setUint32(PatternInfo.#N_COLOR, nColor, true);
27720
+ dataView.setUint32(PatternInfo.#N_STOP, nStop, true);
27721
+ dataView.setUint32(PatternInfo.#N_FIGURES, nFigures, true);
27722
+ let offset = 20;
27723
+ const coordsView = new Float32Array(buffer, offset, nCoord * 2);
27724
+ coordsView.set(coords);
27725
+ offset += nCoord * 8;
27726
+ u8data.set(colors, offset);
27727
+ offset += nColor * 3;
27728
+ for (const [pos, hex] of colorStops) {
27729
+ dataView.setFloat32(offset, pos, true);
27730
+ offset += 4;
27731
+ dataView.setUint32(offset, parseInt(hex.slice(1), 16), true);
27732
+ offset += 4;
27733
+ }
27734
+ if (bbox) {
27735
+ for (const v of bbox) {
27736
+ dataView.setFloat32(offset, v, true);
27737
+ offset += 4;
27738
+ }
27739
+ }
27740
+ if (background) {
27741
+ u8data.set(background, offset);
27742
+ offset += 3;
27743
+ }
27744
+ for (let i = 0; i < figures.length; i++) {
27745
+ const figure = figures[i];
27746
+ dataView.setUint8(offset, figure.type);
27747
+ offset += 1;
27748
+ offset = Math.ceil(offset / 4) * 4;
27749
+ dataView.setUint32(offset, figure.coords.length, true);
27750
+ offset += 4;
27751
+ const figureCoordsView = new Int32Array(buffer, offset, figure.coords.length);
27752
+ figureCoordsView.set(figure.coords);
27753
+ offset += figure.coords.length * 4;
27754
+ dataView.setUint32(offset, figure.colors.length, true);
27755
+ offset += 4;
27756
+ const colorsView = new Int32Array(buffer, offset, figure.colors.length);
27757
+ colorsView.set(figure.colors);
27758
+ offset += figure.colors.length * 4;
27759
+ if (figure.verticesPerRow !== undefined) {
27760
+ dataView.setUint32(offset, figure.verticesPerRow, true);
27761
+ offset += 4;
27762
+ }
27763
+ }
27764
+ return buffer;
27765
+ }
27766
+ getIR() {
27767
+ const dataView = this.view;
27768
+ const kind = this.data[PatternInfo.#KIND];
27769
+ const hasBBox = !!this.data[PatternInfo.#HAS_BBOX];
27770
+ const hasBackground = !!this.data[PatternInfo.#HAS_BACKGROUND];
27771
+ const nCoord = dataView.getUint32(PatternInfo.#N_COORD, true);
27772
+ const nColor = dataView.getUint32(PatternInfo.#N_COLOR, true);
27773
+ const nStop = dataView.getUint32(PatternInfo.#N_STOP, true);
27774
+ const nFigures = dataView.getUint32(PatternInfo.#N_FIGURES, true);
27775
+ let offset = 20;
27776
+ const coords = new Float32Array(this.buffer, offset, nCoord * 2);
27777
+ offset += nCoord * 8;
27778
+ const colors = new Uint8Array(this.buffer, offset, nColor * 3);
27779
+ offset += nColor * 3;
27780
+ const stops = [];
27781
+ for (let i = 0; i < nStop; ++i) {
27782
+ const p = dataView.getFloat32(offset, true);
27783
+ offset += 4;
27784
+ const rgb = dataView.getUint32(offset, true);
27785
+ offset += 4;
27786
+ stops.push([p, `#${rgb.toString(16).padStart(6, "0")}`]);
27787
+ }
27788
+ let bbox = null;
27789
+ if (hasBBox) {
27790
+ bbox = [];
27791
+ for (let i = 0; i < 4; ++i) {
27792
+ bbox.push(dataView.getFloat32(offset, true));
27793
+ offset += 4;
27794
+ }
27795
+ }
27796
+ let background = null;
27797
+ if (hasBackground) {
27798
+ background = new Uint8Array(this.buffer, offset, 3);
27799
+ offset += 3;
27800
+ }
27801
+ const figures = [];
27802
+ for (let i = 0; i < nFigures; ++i) {
27803
+ const type = dataView.getUint8(offset);
27804
+ offset += 1;
27805
+ offset = Math.ceil(offset / 4) * 4;
27806
+ const coordsLength = dataView.getUint32(offset, true);
27807
+ offset += 4;
27808
+ const figureCoords = new Int32Array(this.buffer, offset, coordsLength);
27809
+ offset += coordsLength * 4;
27810
+ const colorsLength = dataView.getUint32(offset, true);
27811
+ offset += 4;
27812
+ const figureColors = new Int32Array(this.buffer, offset, colorsLength);
27813
+ offset += colorsLength * 4;
27814
+ const figure = {
27815
+ type,
27816
+ coords: figureCoords,
27817
+ colors: figureColors
27818
+ };
27819
+ if (type === MeshFigureType.LATTICE) {
27820
+ figure.verticesPerRow = dataView.getUint32(offset, true);
27821
+ offset += 4;
27822
+ }
27823
+ figures.push(figure);
27824
+ }
27825
+ if (kind === 1) {
27826
+ return ["RadialAxial", "axial", bbox, stops, Array.from(coords.slice(0, 2)), Array.from(coords.slice(2, 4)), null, null];
27827
+ }
27828
+ if (kind === 2) {
27829
+ return ["RadialAxial", "radial", bbox, stops, [coords[0], coords[1]], [coords[3], coords[4]], coords[2], coords[5]];
27830
+ }
27831
+ if (kind === 3) {
27832
+ const shadingType = this.data[PatternInfo.#SHADING_TYPE];
27833
+ let bounds = null;
27834
+ if (coords.length > 0) {
27835
+ let minX = coords[0],
27836
+ maxX = coords[0];
27837
+ let minY = coords[1],
27838
+ maxY = coords[1];
27839
+ for (let i = 0; i < coords.length; i += 2) {
27840
+ const x = coords[i],
27841
+ y = coords[i + 1];
27842
+ minX = minX > x ? x : minX;
27843
+ minY = minY > y ? y : minY;
27844
+ maxX = maxX < x ? x : maxX;
27845
+ maxY = maxY < y ? y : maxY;
27846
+ }
27847
+ bounds = [minX, minY, maxX, maxY];
27848
+ }
27849
+ return ["Mesh", shadingType, coords, colors, figures, bounds, bbox, background];
27850
+ }
27851
+ throw new Error(`Unsupported pattern kind: ${kind}`);
27852
+ }
27853
+ }
27854
+
27186
27855
  ;// ./src/core/pattern.js
27187
27856
 
27188
27857
 
@@ -27588,7 +28257,7 @@ class MeshShading extends BaseShading {
27588
28257
  reader.align();
27589
28258
  }
27590
28259
  this.figures.push({
27591
- type: "triangles",
28260
+ type: MeshFigureType.TRIANGLES,
27592
28261
  coords: new Int32Array(ps),
27593
28262
  colors: new Int32Array(ps)
27594
28263
  });
@@ -27605,7 +28274,7 @@ class MeshShading extends BaseShading {
27605
28274
  colors.push(color);
27606
28275
  }
27607
28276
  this.figures.push({
27608
- type: "lattice",
28277
+ type: MeshFigureType.LATTICE,
27609
28278
  coords: new Int32Array(ps),
27610
28279
  colors: new Int32Array(ps),
27611
28280
  verticesPerRow
@@ -27722,7 +28391,7 @@ class MeshShading extends BaseShading {
27722
28391
  ps[10] = coords.length;
27723
28392
  coords.push([(-4 * coords[ps[15]][0] - coords[ps[0]][0] + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, (-4 * coords[ps[15]][1] - coords[ps[0]][1] + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9]);
27724
28393
  this.figures.push({
27725
- type: "patch",
28394
+ type: MeshFigureType.PATCH,
27726
28395
  coords: new Int32Array(ps),
27727
28396
  colors: new Int32Array(cs)
27728
28397
  });
@@ -27847,7 +28516,7 @@ class MeshShading extends BaseShading {
27847
28516
  break;
27848
28517
  }
27849
28518
  this.figures.push({
27850
- type: "patch",
28519
+ type: MeshFigureType.PATCH,
27851
28520
  coords: new Int32Array(ps),
27852
28521
  colors: new Int32Array(cs)
27853
28522
  });
@@ -27855,7 +28524,7 @@ class MeshShading extends BaseShading {
27855
28524
  }
27856
28525
  _buildFigureFromPatch(index) {
27857
28526
  const figure = this.figures[index];
27858
- assert(figure.type === "patch", "Unexpected patch mesh figure");
28527
+ assert(figure.type === MeshFigureType.PATCH, "Unexpected patch mesh figure");
27859
28528
  const coords = this.coords,
27860
28529
  colors = this.colors;
27861
28530
  const pi = figure.coords;
@@ -27920,7 +28589,7 @@ class MeshShading extends BaseShading {
27920
28589
  figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
27921
28590
  figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
27922
28591
  this.figures[index] = {
27923
- type: "lattice",
28592
+ type: MeshFigureType.LATTICE,
27924
28593
  coords: figureCoords,
27925
28594
  colors: figureColors,
27926
28595
  verticesPerRow
@@ -29911,456 +30580,6 @@ function bidi(str, startLevel = -1, vertical = false) {
29911
30580
  return createBidiText(chars.join(""), isLTR);
29912
30581
  }
29913
30582
 
29914
- ;// ./src/shared/obj-bin-transform.js
29915
-
29916
- class CssFontInfo {
29917
- #buffer;
29918
- #view;
29919
- #decoder;
29920
- static strings = ["fontFamily", "fontWeight", "italicAngle"];
29921
- static write(info) {
29922
- const encoder = new TextEncoder();
29923
- const encodedStrings = {};
29924
- let stringsLength = 0;
29925
- for (const prop of CssFontInfo.strings) {
29926
- const encoded = encoder.encode(info[prop]);
29927
- encodedStrings[prop] = encoded;
29928
- stringsLength += 4 + encoded.length;
29929
- }
29930
- const buffer = new ArrayBuffer(stringsLength);
29931
- const data = new Uint8Array(buffer);
29932
- const view = new DataView(buffer);
29933
- let offset = 0;
29934
- for (const prop of CssFontInfo.strings) {
29935
- const encoded = encodedStrings[prop];
29936
- const length = encoded.length;
29937
- view.setUint32(offset, length);
29938
- data.set(encoded, offset + 4);
29939
- offset += 4 + length;
29940
- }
29941
- assert(offset === buffer.byteLength, "CssFontInfo.write: Buffer overflow");
29942
- return buffer;
29943
- }
29944
- constructor(buffer) {
29945
- this.#buffer = buffer;
29946
- this.#view = new DataView(this.#buffer);
29947
- this.#decoder = new TextDecoder();
29948
- }
29949
- #readString(index) {
29950
- assert(index < CssFontInfo.strings.length, "Invalid string index");
29951
- let offset = 0;
29952
- for (let i = 0; i < index; i++) {
29953
- offset += this.#view.getUint32(offset) + 4;
29954
- }
29955
- const length = this.#view.getUint32(offset);
29956
- return this.#decoder.decode(new Uint8Array(this.#buffer, offset + 4, length));
29957
- }
29958
- get fontFamily() {
29959
- return this.#readString(0);
29960
- }
29961
- get fontWeight() {
29962
- return this.#readString(1);
29963
- }
29964
- get italicAngle() {
29965
- return this.#readString(2);
29966
- }
29967
- }
29968
- class SystemFontInfo {
29969
- #buffer;
29970
- #view;
29971
- #decoder;
29972
- static strings = ["css", "loadedName", "baseFontName", "src"];
29973
- static write(info) {
29974
- const encoder = new TextEncoder();
29975
- const encodedStrings = {};
29976
- let stringsLength = 0;
29977
- for (const prop of SystemFontInfo.strings) {
29978
- const encoded = encoder.encode(info[prop]);
29979
- encodedStrings[prop] = encoded;
29980
- stringsLength += 4 + encoded.length;
29981
- }
29982
- stringsLength += 4;
29983
- let encodedStyleStyle,
29984
- encodedStyleWeight,
29985
- lengthEstimate = 1 + stringsLength;
29986
- if (info.style) {
29987
- encodedStyleStyle = encoder.encode(info.style.style);
29988
- encodedStyleWeight = encoder.encode(info.style.weight);
29989
- lengthEstimate += 4 + encodedStyleStyle.length + 4 + encodedStyleWeight.length;
29990
- }
29991
- const buffer = new ArrayBuffer(lengthEstimate);
29992
- const data = new Uint8Array(buffer);
29993
- const view = new DataView(buffer);
29994
- let offset = 0;
29995
- view.setUint8(offset++, info.guessFallback ? 1 : 0);
29996
- view.setUint32(offset, 0);
29997
- offset += 4;
29998
- stringsLength = 0;
29999
- for (const prop of SystemFontInfo.strings) {
30000
- const encoded = encodedStrings[prop];
30001
- const length = encoded.length;
30002
- stringsLength += 4 + length;
30003
- view.setUint32(offset, length);
30004
- data.set(encoded, offset + 4);
30005
- offset += 4 + length;
30006
- }
30007
- view.setUint32(offset - stringsLength - 4, stringsLength);
30008
- if (info.style) {
30009
- view.setUint32(offset, encodedStyleStyle.length);
30010
- data.set(encodedStyleStyle, offset + 4);
30011
- offset += 4 + encodedStyleStyle.length;
30012
- view.setUint32(offset, encodedStyleWeight.length);
30013
- data.set(encodedStyleWeight, offset + 4);
30014
- offset += 4 + encodedStyleWeight.length;
30015
- }
30016
- assert(offset <= buffer.byteLength, "SubstitionInfo.write: Buffer overflow");
30017
- return buffer.transferToFixedLength(offset);
30018
- }
30019
- constructor(buffer) {
30020
- this.#buffer = buffer;
30021
- this.#view = new DataView(this.#buffer);
30022
- this.#decoder = new TextDecoder();
30023
- }
30024
- get guessFallback() {
30025
- return this.#view.getUint8(0) !== 0;
30026
- }
30027
- #readString(index) {
30028
- assert(index < SystemFontInfo.strings.length, "Invalid string index");
30029
- let offset = 5;
30030
- for (let i = 0; i < index; i++) {
30031
- offset += this.#view.getUint32(offset) + 4;
30032
- }
30033
- const length = this.#view.getUint32(offset);
30034
- return this.#decoder.decode(new Uint8Array(this.#buffer, offset + 4, length));
30035
- }
30036
- get css() {
30037
- return this.#readString(0);
30038
- }
30039
- get loadedName() {
30040
- return this.#readString(1);
30041
- }
30042
- get baseFontName() {
30043
- return this.#readString(2);
30044
- }
30045
- get src() {
30046
- return this.#readString(3);
30047
- }
30048
- get style() {
30049
- let offset = 1;
30050
- offset += 4 + this.#view.getUint32(offset);
30051
- const styleLength = this.#view.getUint32(offset);
30052
- const style = this.#decoder.decode(new Uint8Array(this.#buffer, offset + 4, styleLength));
30053
- offset += 4 + styleLength;
30054
- const weightLength = this.#view.getUint32(offset);
30055
- const weight = this.#decoder.decode(new Uint8Array(this.#buffer, offset + 4, weightLength));
30056
- return {
30057
- style,
30058
- weight
30059
- };
30060
- }
30061
- }
30062
- class FontInfo {
30063
- static bools = ["black", "bold", "disableFontFace", "fontExtraProperties", "isInvalidPDFjsFont", "isType3Font", "italic", "missingFile", "remeasure", "vertical"];
30064
- static numbers = ["ascent", "defaultWidth", "descent"];
30065
- static strings = ["fallbackName", "loadedName", "mimetype", "name"];
30066
- static #OFFSET_NUMBERS = Math.ceil(this.bools.length * 2 / 8);
30067
- static #OFFSET_BBOX = this.#OFFSET_NUMBERS + this.numbers.length * 8;
30068
- static #OFFSET_FONT_MATRIX = this.#OFFSET_BBOX + 1 + 2 * 4;
30069
- static #OFFSET_DEFAULT_VMETRICS = this.#OFFSET_FONT_MATRIX + 1 + 8 * 6;
30070
- static #OFFSET_STRINGS = this.#OFFSET_DEFAULT_VMETRICS + 1 + 2 * 3;
30071
- #buffer;
30072
- #decoder;
30073
- #view;
30074
- constructor({
30075
- data,
30076
- extra
30077
- }) {
30078
- this.#buffer = data;
30079
- this.#decoder = new TextDecoder();
30080
- this.#view = new DataView(this.#buffer);
30081
- if (extra) {
30082
- Object.assign(this, extra);
30083
- }
30084
- }
30085
- #readBoolean(index) {
30086
- assert(index < FontInfo.bools.length, "Invalid boolean index");
30087
- const byteOffset = Math.floor(index / 4);
30088
- const bitOffset = index * 2 % 8;
30089
- const value = this.#view.getUint8(byteOffset) >> bitOffset & 0x03;
30090
- return value === 0x00 ? undefined : value === 0x02;
30091
- }
30092
- get black() {
30093
- return this.#readBoolean(0);
30094
- }
30095
- get bold() {
30096
- return this.#readBoolean(1);
30097
- }
30098
- get disableFontFace() {
30099
- return this.#readBoolean(2);
30100
- }
30101
- get fontExtraProperties() {
30102
- return this.#readBoolean(3);
30103
- }
30104
- get isInvalidPDFjsFont() {
30105
- return this.#readBoolean(4);
30106
- }
30107
- get isType3Font() {
30108
- return this.#readBoolean(5);
30109
- }
30110
- get italic() {
30111
- return this.#readBoolean(6);
30112
- }
30113
- get missingFile() {
30114
- return this.#readBoolean(7);
30115
- }
30116
- get remeasure() {
30117
- return this.#readBoolean(8);
30118
- }
30119
- get vertical() {
30120
- return this.#readBoolean(9);
30121
- }
30122
- #readNumber(index) {
30123
- assert(index < FontInfo.numbers.length, "Invalid number index");
30124
- return this.#view.getFloat64(FontInfo.#OFFSET_NUMBERS + index * 8);
30125
- }
30126
- get ascent() {
30127
- return this.#readNumber(0);
30128
- }
30129
- get defaultWidth() {
30130
- return this.#readNumber(1);
30131
- }
30132
- get descent() {
30133
- return this.#readNumber(2);
30134
- }
30135
- get bbox() {
30136
- let offset = FontInfo.#OFFSET_BBOX;
30137
- const numCoords = this.#view.getUint8(offset);
30138
- if (numCoords === 0) {
30139
- return undefined;
30140
- }
30141
- offset += 1;
30142
- const bbox = [];
30143
- for (let i = 0; i < 4; i++) {
30144
- bbox.push(this.#view.getInt16(offset, true));
30145
- offset += 2;
30146
- }
30147
- return bbox;
30148
- }
30149
- get fontMatrix() {
30150
- let offset = FontInfo.#OFFSET_FONT_MATRIX;
30151
- const numPoints = this.#view.getUint8(offset);
30152
- if (numPoints === 0) {
30153
- return undefined;
30154
- }
30155
- offset += 1;
30156
- const fontMatrix = [];
30157
- for (let i = 0; i < 6; i++) {
30158
- fontMatrix.push(this.#view.getFloat64(offset, true));
30159
- offset += 8;
30160
- }
30161
- return fontMatrix;
30162
- }
30163
- get defaultVMetrics() {
30164
- let offset = FontInfo.#OFFSET_DEFAULT_VMETRICS;
30165
- const numMetrics = this.#view.getUint8(offset);
30166
- if (numMetrics === 0) {
30167
- return undefined;
30168
- }
30169
- offset += 1;
30170
- const defaultVMetrics = [];
30171
- for (let i = 0; i < 3; i++) {
30172
- defaultVMetrics.push(this.#view.getInt16(offset, true));
30173
- offset += 2;
30174
- }
30175
- return defaultVMetrics;
30176
- }
30177
- #readString(index) {
30178
- assert(index < FontInfo.strings.length, "Invalid string index");
30179
- let offset = FontInfo.#OFFSET_STRINGS + 4;
30180
- for (let i = 0; i < index; i++) {
30181
- offset += this.#view.getUint32(offset) + 4;
30182
- }
30183
- const length = this.#view.getUint32(offset);
30184
- const stringData = new Uint8Array(length);
30185
- stringData.set(new Uint8Array(this.#buffer, offset + 4, length));
30186
- return this.#decoder.decode(stringData);
30187
- }
30188
- get fallbackName() {
30189
- return this.#readString(0);
30190
- }
30191
- get loadedName() {
30192
- return this.#readString(1);
30193
- }
30194
- get mimetype() {
30195
- return this.#readString(2);
30196
- }
30197
- get name() {
30198
- return this.#readString(3);
30199
- }
30200
- get data() {
30201
- let offset = FontInfo.#OFFSET_STRINGS;
30202
- const stringsLength = this.#view.getUint32(offset);
30203
- offset += 4 + stringsLength;
30204
- const systemFontInfoLength = this.#view.getUint32(offset);
30205
- offset += 4 + systemFontInfoLength;
30206
- const cssFontInfoLength = this.#view.getUint32(offset);
30207
- offset += 4 + cssFontInfoLength;
30208
- const length = this.#view.getUint32(offset);
30209
- if (length === 0) {
30210
- return undefined;
30211
- }
30212
- return new Uint8Array(this.#buffer, offset + 4, length);
30213
- }
30214
- clearData() {
30215
- let offset = FontInfo.#OFFSET_STRINGS;
30216
- const stringsLength = this.#view.getUint32(offset);
30217
- offset += 4 + stringsLength;
30218
- const systemFontInfoLength = this.#view.getUint32(offset);
30219
- offset += 4 + systemFontInfoLength;
30220
- const cssFontInfoLength = this.#view.getUint32(offset);
30221
- offset += 4 + cssFontInfoLength;
30222
- const length = this.#view.getUint32(offset);
30223
- const data = new Uint8Array(this.#buffer, offset + 4, length);
30224
- data.fill(0);
30225
- this.#view.setUint32(offset, 0);
30226
- }
30227
- get cssFontInfo() {
30228
- let offset = FontInfo.#OFFSET_STRINGS;
30229
- const stringsLength = this.#view.getUint32(offset);
30230
- offset += 4 + stringsLength;
30231
- const systemFontInfoLength = this.#view.getUint32(offset);
30232
- offset += 4 + systemFontInfoLength;
30233
- const cssFontInfoLength = this.#view.getUint32(offset);
30234
- if (cssFontInfoLength === 0) {
30235
- return null;
30236
- }
30237
- const cssFontInfoData = new Uint8Array(cssFontInfoLength);
30238
- cssFontInfoData.set(new Uint8Array(this.#buffer, offset + 4, cssFontInfoLength));
30239
- return new CssFontInfo(cssFontInfoData.buffer);
30240
- }
30241
- get systemFontInfo() {
30242
- let offset = FontInfo.#OFFSET_STRINGS;
30243
- const stringsLength = this.#view.getUint32(offset);
30244
- offset += 4 + stringsLength;
30245
- const systemFontInfoLength = this.#view.getUint32(offset);
30246
- if (systemFontInfoLength === 0) {
30247
- return null;
30248
- }
30249
- const systemFontInfoData = new Uint8Array(systemFontInfoLength);
30250
- systemFontInfoData.set(new Uint8Array(this.#buffer, offset + 4, systemFontInfoLength));
30251
- return new SystemFontInfo(systemFontInfoData.buffer);
30252
- }
30253
- static write(font) {
30254
- const systemFontInfoBuffer = font.systemFontInfo ? SystemFontInfo.write(font.systemFontInfo) : null;
30255
- const cssFontInfoBuffer = font.cssFontInfo ? CssFontInfo.write(font.cssFontInfo) : null;
30256
- const encoder = new TextEncoder();
30257
- const encodedStrings = {};
30258
- let stringsLength = 0;
30259
- for (const prop of FontInfo.strings) {
30260
- encodedStrings[prop] = encoder.encode(font[prop]);
30261
- stringsLength += 4 + encodedStrings[prop].length;
30262
- }
30263
- const lengthEstimate = FontInfo.#OFFSET_STRINGS + 4 + stringsLength + 4 + (systemFontInfoBuffer ? systemFontInfoBuffer.byteLength : 0) + 4 + (cssFontInfoBuffer ? cssFontInfoBuffer.byteLength : 0) + 4 + (font.data ? font.data.length : 0);
30264
- const buffer = new ArrayBuffer(lengthEstimate);
30265
- const data = new Uint8Array(buffer);
30266
- const view = new DataView(buffer);
30267
- let offset = 0;
30268
- const numBools = FontInfo.bools.length;
30269
- let boolByte = 0,
30270
- boolBit = 0;
30271
- for (let i = 0; i < numBools; i++) {
30272
- const value = font[FontInfo.bools[i]];
30273
- const bits = value === undefined ? 0x00 : value ? 0x02 : 0x01;
30274
- boolByte |= bits << boolBit;
30275
- boolBit += 2;
30276
- if (boolBit === 8 || i === numBools - 1) {
30277
- view.setUint8(offset++, boolByte);
30278
- boolByte = 0;
30279
- boolBit = 0;
30280
- }
30281
- }
30282
- assert(offset === FontInfo.#OFFSET_NUMBERS, "FontInfo.write: Boolean properties offset mismatch");
30283
- for (const prop of FontInfo.numbers) {
30284
- view.setFloat64(offset, font[prop]);
30285
- offset += 8;
30286
- }
30287
- assert(offset === FontInfo.#OFFSET_BBOX, "FontInfo.write: Number properties offset mismatch");
30288
- if (font.bbox) {
30289
- view.setUint8(offset++, 4);
30290
- for (const coord of font.bbox) {
30291
- view.setInt16(offset, coord, true);
30292
- offset += 2;
30293
- }
30294
- } else {
30295
- view.setUint8(offset++, 0);
30296
- offset += 2 * 4;
30297
- }
30298
- assert(offset === FontInfo.#OFFSET_FONT_MATRIX, "FontInfo.write: BBox properties offset mismatch");
30299
- if (font.fontMatrix) {
30300
- view.setUint8(offset++, 6);
30301
- for (const point of font.fontMatrix) {
30302
- view.setFloat64(offset, point, true);
30303
- offset += 8;
30304
- }
30305
- } else {
30306
- view.setUint8(offset++, 0);
30307
- offset += 8 * 6;
30308
- }
30309
- assert(offset === FontInfo.#OFFSET_DEFAULT_VMETRICS, "FontInfo.write: FontMatrix properties offset mismatch");
30310
- if (font.defaultVMetrics) {
30311
- view.setUint8(offset++, 1);
30312
- for (const metric of font.defaultVMetrics) {
30313
- view.setInt16(offset, metric, true);
30314
- offset += 2;
30315
- }
30316
- } else {
30317
- view.setUint8(offset++, 0);
30318
- offset += 3 * 2;
30319
- }
30320
- assert(offset === FontInfo.#OFFSET_STRINGS, "FontInfo.write: DefaultVMetrics properties offset mismatch");
30321
- view.setUint32(FontInfo.#OFFSET_STRINGS, 0);
30322
- offset += 4;
30323
- for (const prop of FontInfo.strings) {
30324
- const encoded = encodedStrings[prop];
30325
- const length = encoded.length;
30326
- view.setUint32(offset, length);
30327
- data.set(encoded, offset + 4);
30328
- offset += 4 + length;
30329
- }
30330
- view.setUint32(FontInfo.#OFFSET_STRINGS, offset - FontInfo.#OFFSET_STRINGS - 4);
30331
- if (!systemFontInfoBuffer) {
30332
- view.setUint32(offset, 0);
30333
- offset += 4;
30334
- } else {
30335
- const length = systemFontInfoBuffer.byteLength;
30336
- view.setUint32(offset, length);
30337
- assert(offset + 4 + length <= buffer.byteLength, "FontInfo.write: Buffer overflow at systemFontInfo");
30338
- data.set(new Uint8Array(systemFontInfoBuffer), offset + 4);
30339
- offset += 4 + length;
30340
- }
30341
- if (!cssFontInfoBuffer) {
30342
- view.setUint32(offset, 0);
30343
- offset += 4;
30344
- } else {
30345
- const length = cssFontInfoBuffer.byteLength;
30346
- view.setUint32(offset, length);
30347
- assert(offset + 4 + length <= buffer.byteLength, "FontInfo.write: Buffer overflow at cssFontInfo");
30348
- data.set(new Uint8Array(cssFontInfoBuffer), offset + 4);
30349
- offset += 4 + length;
30350
- }
30351
- if (font.data === undefined) {
30352
- view.setUint32(offset, 0);
30353
- offset += 4;
30354
- } else {
30355
- view.setUint32(offset, font.data.length);
30356
- data.set(font.data, offset + 4);
30357
- offset += 4 + font.data.length;
30358
- }
30359
- assert(offset <= buffer.byteLength, "FontInfo.write: Buffer overflow");
30360
- return buffer.transferToFixedLength(offset);
30361
- }
30362
- }
30363
-
30364
30583
  ;// ./src/core/font_substitutions.js
30365
30584
 
30366
30585
 
@@ -30382,7 +30601,7 @@ const BOLDITALIC = {
30382
30601
  weight: "bold"
30383
30602
  };
30384
30603
  const substitutionMap = new Map([["Times-Roman", {
30385
- local: ["Times New Roman", "Times-Roman", "Times", "Liberation Serif", "Nimbus Roman", "Nimbus Roman L", "Tinos", "Thorndale", "TeX Gyre Termes", "FreeSerif", "Linux Libertine O", "Libertinus Serif", "DejaVu Serif", "Bitstream Vera Serif", "Ubuntu"],
30604
+ local: ["Times New Roman", "Times-Roman", "Times", "Liberation Serif", "Nimbus Roman", "Nimbus Roman L", "Tinos", "Thorndale", "TeX Gyre Termes", "FreeSerif", "Linux Libertine O", "Libertinus Serif", "PT Astra Serif", "DejaVu Serif", "Bitstream Vera Serif", "Ubuntu"],
30386
30605
  style: NORMAL,
30387
30606
  ultimate: "serif"
30388
30607
  }], ["Times-Bold", {
@@ -32572,7 +32791,10 @@ class PartialEvaluator {
32572
32791
  }
32573
32792
  localShadingPatternCache.set(shading, id);
32574
32793
  if (this.parsingType3Font) {
32575
- this.handler.send("commonobj", [id, "Pattern", patternIR]);
32794
+ const transfers = [];
32795
+ const patternBuffer = PatternInfo.write(patternIR);
32796
+ transfers.push(patternBuffer);
32797
+ this.handler.send("commonobj", [id, "Pattern", patternBuffer], transfers);
32576
32798
  } else {
32577
32799
  this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
32578
32800
  }
@@ -34579,7 +34801,7 @@ class PartialEvaluator {
34579
34801
  }
34580
34802
  hash.update(`${firstChar}-${lastChar}`);
34581
34803
  if (toUnicode instanceof BaseStream) {
34582
- const stream = toUnicode.str || toUnicode;
34804
+ const stream = toUnicode.stream || toUnicode;
34583
34805
  const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
34584
34806
  hash.update(uint8array);
34585
34807
  } else if (toUnicode instanceof Name) {
@@ -36838,6 +37060,7 @@ class MetadataParser {
36838
37060
 
36839
37061
 
36840
37062
 
37063
+
36841
37064
  const MAX_DEPTH = 40;
36842
37065
  const StructElementType = {
36843
37066
  PAGE_CONTENT: 1,
@@ -36853,6 +37076,28 @@ class StructTreeRoot {
36853
37076
  this.ref = rootRef instanceof Ref ? rootRef : null;
36854
37077
  this.roleMap = new Map();
36855
37078
  this.structParentIds = null;
37079
+ this.kidRefToPosition = undefined;
37080
+ }
37081
+ getKidPosition(kidRef) {
37082
+ if (this.kidRefToPosition === undefined) {
37083
+ const obj = this.dict.get("K");
37084
+ if (Array.isArray(obj)) {
37085
+ const map = this.kidRefToPosition = new Map();
37086
+ for (let i = 0, ii = obj.length; i < ii; i++) {
37087
+ const ref = obj[i];
37088
+ if (ref) {
37089
+ map.set(ref.toString(), i);
37090
+ }
37091
+ }
37092
+ } else if (obj instanceof Dict) {
37093
+ this.kidRefToPosition = new Map([[obj.objId, 0]]);
37094
+ } else if (!obj) {
37095
+ this.kidRefToPosition = new Map();
37096
+ } else {
37097
+ this.kidRefToPosition = null;
37098
+ }
37099
+ }
37100
+ return this.kidRefToPosition ? this.kidRefToPosition.get(kidRef) ?? NaN : -1;
36856
37101
  }
36857
37102
  init() {
36858
37103
  this.readRoleMap();
@@ -37317,6 +37562,48 @@ class StructElementNode {
37317
37562
  } = this.tree;
37318
37563
  return root.roleMap.get(name) ?? name;
37319
37564
  }
37565
+ get mathML() {
37566
+ let AFs = this.dict.get("AF") || [];
37567
+ if (!Array.isArray(AFs)) {
37568
+ AFs = [AFs];
37569
+ }
37570
+ for (let af of AFs) {
37571
+ af = this.xref.fetchIfRef(af);
37572
+ if (!(af instanceof Dict)) {
37573
+ continue;
37574
+ }
37575
+ if (!isName(af.get("Type"), "Filespec")) {
37576
+ continue;
37577
+ }
37578
+ if (!isName(af.get("AFRelationship"), "Supplement")) {
37579
+ continue;
37580
+ }
37581
+ const ef = af.get("EF");
37582
+ if (!(ef instanceof Dict)) {
37583
+ continue;
37584
+ }
37585
+ const fileStream = ef.get("UF") || ef.get("F");
37586
+ if (!(fileStream instanceof BaseStream)) {
37587
+ continue;
37588
+ }
37589
+ if (!isName(fileStream.dict.get("Type"), "EmbeddedFile")) {
37590
+ continue;
37591
+ }
37592
+ if (!isName(fileStream.dict.get("Subtype"), "application/mathml+xml")) {
37593
+ continue;
37594
+ }
37595
+ return stringToUTF8String(fileStream.getString());
37596
+ }
37597
+ const A = this.dict.get("A");
37598
+ if (A instanceof Dict) {
37599
+ const O = A.get("O");
37600
+ if (isName(O, "MSFT_Office")) {
37601
+ const mathml = A.get("MSFT_MathML");
37602
+ return mathml ? stringToPDFString(mathml) : null;
37603
+ }
37604
+ }
37605
+ return null;
37606
+ }
37320
37607
  parseKids() {
37321
37608
  let pageObjId = null;
37322
37609
  const objRef = this.dict.getRaw("Pg");
@@ -37483,6 +37770,23 @@ class StructTreePage {
37483
37770
  }
37484
37771
  const element = new StructElementNode(this, dict);
37485
37772
  map.set(dict, element);
37773
+ switch (element.role) {
37774
+ case "L":
37775
+ case "LBody":
37776
+ case "LI":
37777
+ case "Table":
37778
+ case "THead":
37779
+ case "TBody":
37780
+ case "TFoot":
37781
+ case "TR":
37782
+ {
37783
+ for (const kid of element.kids) {
37784
+ if (kid.type === StructElementType.ELEMENT) {
37785
+ this.addNode(kid.dict, map, level - 1);
37786
+ }
37787
+ }
37788
+ }
37789
+ }
37486
37790
  const parent = dict.get("P");
37487
37791
  if (!(parent instanceof Dict) || isName(parent.get("Type"), "StructTreeRoot")) {
37488
37792
  if (!this.addTopLevelNode(dict, element)) {
@@ -37507,29 +37811,14 @@ class StructTreePage {
37507
37811
  return element;
37508
37812
  }
37509
37813
  addTopLevelNode(dict, element) {
37510
- const obj = this.rootDict.get("K");
37511
- if (!obj) {
37814
+ const index = this.root.getKidPosition(dict.objId);
37815
+ if (isNaN(index)) {
37512
37816
  return false;
37513
37817
  }
37514
- if (obj instanceof Dict) {
37515
- if (obj.objId !== dict.objId) {
37516
- return false;
37517
- }
37518
- this.nodes[0] = element;
37519
- return true;
37520
- }
37521
- if (!Array.isArray(obj)) {
37522
- return true;
37523
- }
37524
- let save = false;
37525
- for (let i = 0; i < obj.length; i++) {
37526
- const kidRef = obj[i];
37527
- if (kidRef?.toString() === dict.objId) {
37528
- this.nodes[i] = element;
37529
- save = true;
37530
- }
37818
+ if (index !== -1) {
37819
+ this.nodes[index] = element;
37531
37820
  }
37532
- return save;
37821
+ return true;
37533
37822
  }
37534
37823
  get serializable() {
37535
37824
  function nodeToSerializable(node, parent, level = 0) {
@@ -37548,6 +37837,14 @@ class StructTreePage {
37548
37837
  if (typeof alt === "string") {
37549
37838
  obj.alt = stringToPDFString(alt);
37550
37839
  }
37840
+ if (obj.role === "Formula") {
37841
+ const {
37842
+ mathML
37843
+ } = node;
37844
+ if (mathML) {
37845
+ obj.mathML = mathML;
37846
+ }
37847
+ }
37551
37848
  const a = node.dict.get("A");
37552
37849
  if (a instanceof Dict) {
37553
37850
  const bbox = lookupNormalRect(a.getArray("BBox"), null);
@@ -53511,10 +53808,10 @@ class DatasetReader {
53511
53808
  ;// ./src/core/intersector.js
53512
53809
  class SingleIntersector {
53513
53810
  #annotation;
53514
- #minX = Infinity;
53515
- #minY = Infinity;
53516
- #maxX = -Infinity;
53517
- #maxY = -Infinity;
53811
+ minX = Infinity;
53812
+ minY = Infinity;
53813
+ maxX = -Infinity;
53814
+ maxY = -Infinity;
53518
53815
  #quadPoints = null;
53519
53816
  #text = [];
53520
53817
  #extraChars = [];
@@ -53524,24 +53821,21 @@ class SingleIntersector {
53524
53821
  this.#annotation = annotation;
53525
53822
  const quadPoints = annotation.data.quadPoints;
53526
53823
  if (!quadPoints) {
53527
- [this.#minX, this.#minY, this.#maxX, this.#maxY] = annotation.data.rect;
53824
+ [this.minX, this.minY, this.maxX, this.maxY] = annotation.data.rect;
53528
53825
  return;
53529
53826
  }
53530
53827
  for (let i = 0, ii = quadPoints.length; i < ii; i += 8) {
53531
- this.#minX = Math.min(this.#minX, quadPoints[i]);
53532
- this.#maxX = Math.max(this.#maxX, quadPoints[i + 2]);
53533
- this.#minY = Math.min(this.#minY, quadPoints[i + 5]);
53534
- this.#maxY = Math.max(this.#maxY, quadPoints[i + 1]);
53828
+ this.minX = Math.min(this.minX, quadPoints[i]);
53829
+ this.maxX = Math.max(this.maxX, quadPoints[i + 2]);
53830
+ this.minY = Math.min(this.minY, quadPoints[i + 5]);
53831
+ this.maxY = Math.max(this.maxY, quadPoints[i + 1]);
53535
53832
  }
53536
53833
  if (quadPoints.length > 8) {
53537
53834
  this.#quadPoints = quadPoints;
53538
53835
  }
53539
53836
  }
53540
- overlaps(other) {
53541
- return !(this.#minX >= other.#maxX || this.#maxX <= other.#minX || this.#minY >= other.#maxY || this.#maxY <= other.#minY);
53542
- }
53543
53837
  #intersects(x, y) {
53544
- if (this.#minX >= x || this.#maxX <= x || this.#minY >= y || this.#maxY <= y) {
53838
+ if (this.minX >= x || this.maxX <= x || this.minY >= y || this.maxY <= y) {
53545
53839
  return false;
53546
53840
  }
53547
53841
  const quadPoints = this.#quadPoints;
@@ -53592,52 +53886,81 @@ class SingleIntersector {
53592
53886
  this.#annotation.data.overlaidText = this.#text.join("");
53593
53887
  }
53594
53888
  }
53889
+ const STEPS = 64;
53595
53890
  class Intersector {
53596
- #intersectors = new Map();
53891
+ #intersectors = [];
53892
+ #grid = [];
53893
+ #minX;
53894
+ #maxX;
53895
+ #minY;
53896
+ #maxY;
53897
+ #invXRatio;
53898
+ #invYRatio;
53597
53899
  constructor(annotations) {
53900
+ let minX = Infinity;
53901
+ let minY = Infinity;
53902
+ let maxX = -Infinity;
53903
+ let maxY = -Infinity;
53904
+ const intersectors = this.#intersectors;
53598
53905
  for (const annotation of annotations) {
53599
53906
  if (!annotation.data.quadPoints && !annotation.data.rect) {
53600
53907
  continue;
53601
53908
  }
53602
53909
  const intersector = new SingleIntersector(annotation);
53603
- for (const [otherIntersector, overlapping] of this.#intersectors) {
53604
- if (otherIntersector.overlaps(intersector)) {
53605
- if (!overlapping) {
53606
- this.#intersectors.set(otherIntersector, new Set([intersector]));
53607
- } else {
53608
- overlapping.add(intersector);
53609
- }
53610
- }
53611
- }
53612
- this.#intersectors.set(intersector, null);
53613
- }
53910
+ intersectors.push(intersector);
53911
+ minX = Math.min(minX, intersector.minX);
53912
+ minY = Math.min(minY, intersector.minY);
53913
+ maxX = Math.max(maxX, intersector.maxX);
53914
+ maxY = Math.max(maxY, intersector.maxY);
53915
+ }
53916
+ this.#minX = minX;
53917
+ this.#minY = minY;
53918
+ this.#maxX = maxX;
53919
+ this.#maxY = maxY;
53920
+ this.#invXRatio = (STEPS - 1) / (maxX - minX);
53921
+ this.#invYRatio = (STEPS - 1) / (maxY - minY);
53922
+ for (const intersector of intersectors) {
53923
+ const iMin = this.#getGridIndex(intersector.minX, intersector.minY);
53924
+ const iMax = this.#getGridIndex(intersector.maxX, intersector.maxY);
53925
+ const w = (iMax - iMin) % STEPS;
53926
+ const h = Math.floor((iMax - iMin) / STEPS);
53927
+ for (let i = iMin; i <= iMin + h * STEPS; i += STEPS) {
53928
+ for (let j = 0; j <= w; j++) {
53929
+ let existing = this.#grid[i + j];
53930
+ if (!existing) {
53931
+ this.#grid[i + j] = existing = [];
53932
+ }
53933
+ existing.push(intersector);
53934
+ }
53935
+ }
53936
+ }
53937
+ }
53938
+ #getGridIndex(x, y) {
53939
+ const i = Math.floor((x - this.#minX) * this.#invXRatio);
53940
+ const j = Math.floor((y - this.#minY) * this.#invYRatio);
53941
+ return i + j * STEPS;
53614
53942
  }
53615
53943
  addGlyph(transform, width, height, glyph) {
53616
53944
  const x = transform[4] + width / 2;
53617
53945
  const y = transform[5] + height / 2;
53618
- let overlappingIntersectors;
53619
- for (const [intersector, overlapping] of this.#intersectors) {
53620
- if (overlappingIntersectors) {
53621
- if (overlappingIntersectors.has(intersector)) {
53622
- intersector.addGlyph(x, y, glyph);
53623
- } else {
53624
- intersector.disableExtraChars();
53625
- }
53626
- continue;
53627
- }
53628
- if (!intersector.addGlyph(x, y, glyph)) {
53629
- continue;
53630
- }
53631
- overlappingIntersectors = overlapping;
53946
+ if (x < this.#minX || y < this.#minY || x > this.#maxX || y > this.#maxY) {
53947
+ return;
53948
+ }
53949
+ const intersectors = this.#grid[this.#getGridIndex(x, y)];
53950
+ if (!intersectors) {
53951
+ return;
53952
+ }
53953
+ for (const intersector of intersectors) {
53954
+ intersector.addGlyph(x, y, glyph);
53632
53955
  }
53633
53956
  }
53634
53957
  addExtraChar(char) {
53635
- for (const intersector of this.#intersectors.keys()) {
53958
+ for (const intersector of this.#intersectors) {
53636
53959
  intersector.addExtraChar(char);
53637
53960
  }
53638
53961
  }
53639
53962
  setText() {
53640
- for (const intersector of this.#intersectors.keys()) {
53963
+ for (const intersector of this.#intersectors) {
53641
53964
  intersector.setText();
53642
53965
  }
53643
53966
  }
@@ -54016,7 +54339,7 @@ const chunkSize = 512;
54016
54339
  class DecryptStream extends DecodeStream {
54017
54340
  constructor(str, maybeLength, decrypt) {
54018
54341
  super(maybeLength);
54019
- this.str = str;
54342
+ this.stream = str;
54020
54343
  this.dict = str.dict;
54021
54344
  this.decrypt = decrypt;
54022
54345
  this.nextChunk = null;
@@ -54027,14 +54350,14 @@ class DecryptStream extends DecodeStream {
54027
54350
  if (this.initialized) {
54028
54351
  chunk = this.nextChunk;
54029
54352
  } else {
54030
- chunk = this.str.getBytes(chunkSize);
54353
+ chunk = this.stream.getBytes(chunkSize);
54031
54354
  this.initialized = true;
54032
54355
  }
54033
54356
  if (!chunk?.length) {
54034
54357
  this.eof = true;
54035
54358
  return;
54036
54359
  }
54037
- this.nextChunk = this.str.getBytes(chunkSize);
54360
+ this.nextChunk = this.stream.getBytes(chunkSize);
54038
54361
  const hasMoreData = this.nextChunk?.length > 0;
54039
54362
  const decrypt = this.decrypt;
54040
54363
  chunk = decrypt(chunk, !hasMoreData);
@@ -56337,40 +56660,6 @@ class PDFDocument {
56337
56660
  return isSignature && isInvisible;
56338
56661
  });
56339
56662
  }
56340
- #collectSignatureCertificates(fields, collectedSignatureCertificates, visited = new RefSet()) {
56341
- if (!Array.isArray(fields)) {
56342
- return;
56343
- }
56344
- for (let field of fields) {
56345
- if (field instanceof Ref) {
56346
- if (visited.has(field)) {
56347
- continue;
56348
- }
56349
- visited.put(field);
56350
- }
56351
- field = this.xref.fetchIfRef(field);
56352
- if (!(field instanceof Dict)) {
56353
- continue;
56354
- }
56355
- if (field.has("Kids")) {
56356
- this.#collectSignatureCertificates(field.get("Kids"), collectedSignatureCertificates, visited);
56357
- continue;
56358
- }
56359
- const isSignature = isName(field.get("FT"), "Sig");
56360
- if (!isSignature) {
56361
- continue;
56362
- }
56363
- const value = field.get("V");
56364
- if (!(value instanceof Dict)) {
56365
- continue;
56366
- }
56367
- const subFilter = value.get("SubFilter");
56368
- if (!(subFilter instanceof Name)) {
56369
- continue;
56370
- }
56371
- collectedSignatureCertificates.add(subFilter.name);
56372
- }
56373
- }
56374
56663
  get _xfaStreams() {
56375
56664
  const {
56376
56665
  acroForm
@@ -58152,7 +58441,7 @@ class WorkerMessageHandler {
58152
58441
  docId,
58153
58442
  apiVersion
58154
58443
  } = docParams;
58155
- const workerVersion = "5.4.296";
58444
+ const workerVersion = "5.4.394";
58156
58445
  if (apiVersion !== workerVersion) {
58157
58446
  throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
58158
58447
  }