@sync-in/server 1.5.2 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +2 -1
  3. package/environment/environment.dist.min.yaml +1 -0
  4. package/environment/environment.dist.yaml +88 -30
  5. package/migrations/0002_sleepy_korath.sql +1 -0
  6. package/migrations/meta/0002_snapshot.json +2424 -0
  7. package/migrations/meta/_journal.json +7 -0
  8. package/package.json +14 -12
  9. package/server/app.bootstrap.js +1 -1
  10. package/server/app.bootstrap.js.map +1 -1
  11. package/server/applications/files/services/files-manager.service.js +1 -2
  12. package/server/applications/files/services/files-manager.service.js.map +1 -1
  13. package/server/applications/files/services/files-only-office-manager.service.js +5 -6
  14. package/server/applications/files/services/files-only-office-manager.service.js.map +1 -1
  15. package/server/applications/files/utils/files.js +6 -4
  16. package/server/applications/files/utils/files.js.map +1 -1
  17. package/server/applications/links/links.controller.js +2 -2
  18. package/server/applications/links/links.controller.js.map +1 -1
  19. package/server/applications/links/services/links-manager.service.js +2 -1
  20. package/server/applications/links/services/links-manager.service.js.map +1 -1
  21. package/server/applications/links/services/links-manager.service.spec.js +6 -3
  22. package/server/applications/links/services/links-manager.service.spec.js.map +1 -1
  23. package/server/applications/notifications/constants/notifications.js +9 -0
  24. package/server/applications/notifications/constants/notifications.js.map +1 -1
  25. package/server/applications/notifications/i18n/fr.js +10 -1
  26. package/server/applications/notifications/i18n/fr.js.map +1 -1
  27. package/server/applications/notifications/interfaces/notification-properties.interface.js.map +1 -1
  28. package/server/applications/notifications/mails/models.js +41 -3
  29. package/server/applications/notifications/mails/models.js.map +1 -1
  30. package/server/applications/notifications/mails/templates.js +1 -1
  31. package/server/applications/notifications/mails/templates.js.map +1 -1
  32. package/server/applications/notifications/schemas/notifications.schema.js +2 -1
  33. package/server/applications/notifications/schemas/notifications.schema.js.map +1 -1
  34. package/server/applications/notifications/services/notifications-manager.service.js +16 -13
  35. package/server/applications/notifications/services/notifications-manager.service.js.map +1 -1
  36. package/server/applications/notifications/services/notifications-manager.service.spec.js +9 -8
  37. package/server/applications/notifications/services/notifications-manager.service.spec.js.map +1 -1
  38. package/server/applications/notifications/services/notifications-queries.service.js +1 -1
  39. package/server/applications/notifications/services/notifications-queries.service.js.map +1 -1
  40. package/server/applications/shares/services/shares-manager.service.js +3 -2
  41. package/server/applications/shares/services/shares-manager.service.js.map +1 -1
  42. package/server/applications/sync/constants/auth.js +2 -2
  43. package/server/applications/sync/constants/auth.js.map +1 -1
  44. package/server/applications/sync/dtos/sync-client-registration.dto.js +5 -0
  45. package/server/applications/sync/dtos/sync-client-registration.dto.js.map +1 -1
  46. package/server/applications/sync/dtos/sync-operations.dto.js +1 -2
  47. package/server/applications/sync/dtos/sync-operations.dto.js.map +1 -1
  48. package/server/applications/sync/schemas/sync-clients.schema.js +2 -1
  49. package/server/applications/sync/schemas/sync-clients.schema.js.map +1 -1
  50. package/server/applications/sync/schemas/sync-paths.schema.js +2 -1
  51. package/server/applications/sync/schemas/sync-paths.schema.js.map +1 -1
  52. package/server/applications/sync/services/sync-clients-manager.service.js +28 -20
  53. package/server/applications/sync/services/sync-clients-manager.service.js.map +1 -1
  54. package/server/applications/sync/services/sync-clients-manager.service.spec.js +24 -18
  55. package/server/applications/sync/services/sync-clients-manager.service.spec.js.map +1 -1
  56. package/server/applications/sync/services/sync-queries.service.js +5 -5
  57. package/server/applications/sync/services/sync-queries.service.js.map +1 -1
  58. package/server/applications/users/admin-users.controller.js +48 -37
  59. package/server/applications/users/admin-users.controller.js.map +1 -1
  60. package/server/applications/users/admin-users.controller.spec.js +15 -0
  61. package/server/applications/users/admin-users.controller.spec.js.map +1 -1
  62. package/server/applications/users/constants/routes.js +5 -0
  63. package/server/applications/users/constants/routes.js.map +1 -1
  64. package/server/applications/users/constants/user.js +8 -0
  65. package/server/applications/users/constants/user.js.map +1 -1
  66. package/server/applications/users/dto/delete-user.dto.js +5 -23
  67. package/server/applications/users/dto/delete-user.dto.js.map +1 -1
  68. package/server/applications/users/dto/user-properties.dto.js +38 -3
  69. package/server/applications/users/dto/user-properties.dto.js.map +1 -1
  70. package/server/applications/users/interfaces/admin-user.interface.js.map +1 -1
  71. package/server/applications/users/interfaces/user-secrets.interface.js +10 -0
  72. package/server/applications/users/interfaces/user-secrets.interface.js.map +1 -0
  73. package/server/applications/users/models/user.model.js +84 -50
  74. package/server/applications/users/models/user.model.js.map +1 -1
  75. package/server/applications/users/schemas/user.interface.js.map +1 -1
  76. package/server/applications/users/schemas/users.schema.js +2 -0
  77. package/server/applications/users/schemas/users.schema.js.map +1 -1
  78. package/server/applications/users/services/admin-users-manager.service.js +7 -19
  79. package/server/applications/users/services/admin-users-manager.service.js.map +1 -1
  80. package/server/applications/users/services/admin-users-manager.service.spec.js +7 -26
  81. package/server/applications/users/services/admin-users-manager.service.spec.js.map +1 -1
  82. package/server/applications/users/services/admin-users-queries.service.js +1 -0
  83. package/server/applications/users/services/admin-users-queries.service.js.map +1 -1
  84. package/server/applications/users/services/users-manager.service.js +138 -28
  85. package/server/applications/users/services/users-manager.service.js.map +1 -1
  86. package/server/applications/users/services/users-manager.service.spec.js +11 -9
  87. package/server/applications/users/services/users-manager.service.spec.js.map +1 -1
  88. package/server/applications/users/services/users-queries.service.js +63 -57
  89. package/server/applications/users/services/users-queries.service.js.map +1 -1
  90. package/server/applications/users/users.controller.js +48 -1
  91. package/server/applications/users/users.controller.js.map +1 -1
  92. package/server/applications/users/users.controller.spec.js +8 -1
  93. package/server/applications/users/users.controller.spec.js.map +1 -1
  94. package/server/applications/users/users.e2e-spec.js +2 -1
  95. package/server/applications/users/users.e2e-spec.js.map +1 -1
  96. package/server/applications/users/utils/avatar.js +48 -0
  97. package/server/applications/users/utils/avatar.js.map +1 -0
  98. package/server/authentication/auth.config.js +89 -26
  99. package/server/authentication/auth.config.js.map +1 -1
  100. package/server/authentication/auth.controller.js +117 -9
  101. package/server/authentication/auth.controller.js.map +1 -1
  102. package/server/authentication/auth.controller.spec.js +16 -1
  103. package/server/authentication/auth.controller.spec.js.map +1 -1
  104. package/server/authentication/auth.e2e-spec.js +4 -3
  105. package/server/authentication/auth.e2e-spec.js.map +1 -1
  106. package/server/authentication/auth.module.js +4 -1
  107. package/server/authentication/auth.module.js.map +1 -1
  108. package/server/authentication/constants/auth-ldap.js +44 -0
  109. package/server/authentication/constants/auth-ldap.js.map +1 -0
  110. package/server/authentication/constants/auth.js +37 -4
  111. package/server/authentication/constants/auth.js.map +1 -1
  112. package/server/authentication/constants/routes.js +21 -0
  113. package/server/authentication/constants/routes.js.map +1 -1
  114. package/server/authentication/constants/scope.js +20 -0
  115. package/server/authentication/constants/scope.js.map +1 -0
  116. package/server/authentication/dto/login-response.dto.js +27 -4
  117. package/server/authentication/dto/login-response.dto.js.map +1 -1
  118. package/server/authentication/dto/token-response.dto.js +5 -0
  119. package/server/authentication/dto/token-response.dto.js.map +1 -1
  120. package/server/{applications/users/dto/user-password.dto.js → authentication/dto/two-fa-verify.dto.js} +27 -9
  121. package/server/authentication/dto/two-fa-verify.dto.js.map +1 -0
  122. package/server/authentication/guards/auth-basic.strategy.js +6 -5
  123. package/server/authentication/guards/auth-basic.strategy.js.map +1 -1
  124. package/server/authentication/guards/auth-token-access.strategy.js +3 -2
  125. package/server/authentication/guards/auth-token-access.strategy.js.map +1 -1
  126. package/server/authentication/guards/auth-token-refresh.strategy.js +3 -2
  127. package/server/authentication/guards/auth-token-refresh.strategy.js.map +1 -1
  128. package/server/authentication/guards/auth-two-fa-guard.js +81 -0
  129. package/server/authentication/guards/auth-two-fa-guard.js.map +1 -0
  130. package/server/authentication/interfaces/jwt-payload.interface.js +5 -0
  131. package/server/authentication/interfaces/jwt-payload.interface.js.map +1 -1
  132. package/server/authentication/interfaces/token.interface.js +2 -0
  133. package/server/authentication/interfaces/token.interface.js.map +1 -1
  134. package/server/authentication/interfaces/two-fa-setup.interface.js +10 -0
  135. package/server/authentication/interfaces/two-fa-setup.interface.js.map +1 -0
  136. package/server/authentication/models/auth-method.js.map +1 -1
  137. package/server/authentication/services/auth-manager.service.js +72 -49
  138. package/server/authentication/services/auth-manager.service.js.map +1 -1
  139. package/server/authentication/services/auth-methods/auth-method-database.service.js +3 -3
  140. package/server/authentication/services/auth-methods/auth-method-database.service.js.map +1 -1
  141. package/server/authentication/services/auth-methods/auth-method-database.service.spec.js +5 -0
  142. package/server/authentication/services/auth-methods/auth-method-database.service.spec.js.map +1 -1
  143. package/server/authentication/services/auth-methods/auth-method-ldap.service.js +151 -66
  144. package/server/authentication/services/auth-methods/auth-method-ldap.service.js.map +1 -1
  145. package/server/authentication/services/auth-methods/auth-method-ldap.service.spec.js +52 -50
  146. package/server/authentication/services/auth-methods/auth-method-ldap.service.spec.js.map +1 -1
  147. package/server/authentication/services/auth-methods/auth-method-two-fa.service.js +251 -0
  148. package/server/authentication/services/auth-methods/auth-method-two-fa.service.js.map +1 -0
  149. package/server/authentication/services/auth-methods/auth-method-two-fa.service.spec.js +41 -0
  150. package/server/authentication/services/auth-methods/auth-method-two-fa.service.spec.js.map +1 -0
  151. package/server/authentication/utils/crypt-secret.js +68 -0
  152. package/server/authentication/utils/crypt-secret.js.map +1 -0
  153. package/server/common/functions.js +18 -2
  154. package/server/common/functions.js.map +1 -1
  155. package/server/common/qrcode.js +34 -0
  156. package/server/common/qrcode.js.map +1 -0
  157. package/server/common/shared.js +18 -0
  158. package/server/common/shared.js.map +1 -1
  159. package/server/configuration/config.environment.js +23 -6
  160. package/server/configuration/config.environment.js.map +1 -1
  161. package/server/configuration/config.interfaces.js +10 -0
  162. package/server/configuration/config.interfaces.js.map +1 -0
  163. package/server/configuration/config.loader.js.map +1 -1
  164. package/server/configuration/config.validation.js +13 -13
  165. package/server/configuration/config.validation.js.map +1 -1
  166. package/server/infrastructure/cache/adapters/mysql-cache.adapter.js +6 -6
  167. package/server/infrastructure/cache/adapters/mysql-cache.adapter.js.map +1 -1
  168. package/server/infrastructure/cache/schemas/mysql-cache.schema.js +2 -1
  169. package/server/infrastructure/cache/schemas/mysql-cache.schema.js.map +1 -1
  170. package/server/infrastructure/cache/services/cache.service.js.map +1 -1
  171. package/server/infrastructure/database/columns.js +39 -0
  172. package/server/infrastructure/database/columns.js.map +1 -0
  173. package/server/infrastructure/database/database.config.js +0 -1
  174. package/server/infrastructure/database/database.config.js.map +1 -1
  175. package/server/infrastructure/mailer/interfaces/mail.interface.js.map +1 -1
  176. package/server/infrastructure/mailer/mailer.config.js +12 -0
  177. package/server/infrastructure/mailer/mailer.config.js.map +1 -1
  178. package/server/infrastructure/mailer/mailer.service.js +2 -1
  179. package/server/infrastructure/mailer/mailer.service.js.map +1 -1
  180. package/static/assets/mimes/text-x-c.svg +1 -0
  181. package/static/assets/pdfjs/build/pdf.mjs +2522 -914
  182. package/static/assets/pdfjs/build/pdf.mjs.map +1 -1
  183. package/static/assets/pdfjs/build/pdf.sandbox.mjs +2 -2
  184. package/static/assets/pdfjs/build/pdf.worker.mjs +1024 -566
  185. package/static/assets/pdfjs/build/pdf.worker.mjs.map +1 -1
  186. package/static/assets/pdfjs/version +1 -1
  187. package/static/assets/pdfjs/web/debugger.mjs +116 -37
  188. package/static/assets/pdfjs/web/images/comment-popup-editButton.svg +5 -0
  189. package/static/assets/pdfjs/web/locale/ach/viewer.ftl +0 -12
  190. package/static/assets/pdfjs/web/locale/af/viewer.ftl +0 -12
  191. package/static/assets/pdfjs/web/locale/an/viewer.ftl +0 -16
  192. package/static/assets/pdfjs/web/locale/ar/viewer.ftl +0 -32
  193. package/static/assets/pdfjs/web/locale/ast/viewer.ftl +0 -19
  194. package/static/assets/pdfjs/web/locale/az/viewer.ftl +0 -16
  195. package/static/assets/pdfjs/web/locale/be/viewer.ftl +0 -32
  196. package/static/assets/pdfjs/web/locale/bg/viewer.ftl +0 -32
  197. package/static/assets/pdfjs/web/locale/bn/viewer.ftl +0 -16
  198. package/static/assets/pdfjs/web/locale/bo/viewer.ftl +0 -12
  199. package/static/assets/pdfjs/web/locale/br/viewer.ftl +0 -22
  200. package/static/assets/pdfjs/web/locale/brx/viewer.ftl +0 -16
  201. package/static/assets/pdfjs/web/locale/bs/viewer.ftl +0 -32
  202. package/static/assets/pdfjs/web/locale/ca/viewer.ftl +12 -23
  203. package/static/assets/pdfjs/web/locale/cak/viewer.ftl +0 -23
  204. package/static/assets/pdfjs/web/locale/ckb/viewer.ftl +0 -16
  205. package/static/assets/pdfjs/web/locale/cs/viewer.ftl +0 -32
  206. package/static/assets/pdfjs/web/locale/cy/viewer.ftl +0 -32
  207. package/static/assets/pdfjs/web/locale/da/viewer.ftl +3 -35
  208. package/static/assets/pdfjs/web/locale/de/viewer.ftl +0 -32
  209. package/static/assets/pdfjs/web/locale/dsb/viewer.ftl +0 -32
  210. package/static/assets/pdfjs/web/locale/el/viewer.ftl +0 -32
  211. package/static/assets/pdfjs/web/locale/en-CA/viewer.ftl +0 -32
  212. package/static/assets/pdfjs/web/locale/en-GB/viewer.ftl +0 -32
  213. package/static/assets/pdfjs/web/locale/en-US/viewer.ftl +25 -13
  214. package/static/assets/pdfjs/web/locale/eo/viewer.ftl +0 -32
  215. package/static/assets/pdfjs/web/locale/es-AR/viewer.ftl +0 -32
  216. package/static/assets/pdfjs/web/locale/es-CL/viewer.ftl +0 -32
  217. package/static/assets/pdfjs/web/locale/es-ES/viewer.ftl +5 -32
  218. package/static/assets/pdfjs/web/locale/es-MX/viewer.ftl +0 -32
  219. package/static/assets/pdfjs/web/locale/et/viewer.ftl +0 -16
  220. package/static/assets/pdfjs/web/locale/eu/viewer.ftl +38 -32
  221. package/static/assets/pdfjs/web/locale/fa/viewer.ftl +0 -19
  222. package/static/assets/pdfjs/web/locale/ff/viewer.ftl +0 -12
  223. package/static/assets/pdfjs/web/locale/fi/viewer.ftl +0 -32
  224. package/static/assets/pdfjs/web/locale/fr/viewer.ftl +0 -32
  225. package/static/assets/pdfjs/web/locale/fur/viewer.ftl +0 -32
  226. package/static/assets/pdfjs/web/locale/fy-NL/viewer.ftl +0 -32
  227. package/static/assets/pdfjs/web/locale/ga-IE/viewer.ftl +0 -12
  228. package/static/assets/pdfjs/web/locale/gd/viewer.ftl +0 -23
  229. package/static/assets/pdfjs/web/locale/gl/viewer.ftl +0 -32
  230. package/static/assets/pdfjs/web/locale/gn/viewer.ftl +0 -32
  231. package/static/assets/pdfjs/web/locale/gu-IN/viewer.ftl +0 -12
  232. package/static/assets/pdfjs/web/locale/he/viewer.ftl +0 -32
  233. package/static/assets/pdfjs/web/locale/hi-IN/viewer.ftl +0 -16
  234. package/static/assets/pdfjs/web/locale/hr/viewer.ftl +0 -32
  235. package/static/assets/pdfjs/web/locale/hsb/viewer.ftl +0 -32
  236. package/static/assets/pdfjs/web/locale/hu/viewer.ftl +0 -32
  237. package/static/assets/pdfjs/web/locale/hy-AM/viewer.ftl +372 -16
  238. package/static/assets/pdfjs/web/locale/hye/viewer.ftl +0 -16
  239. package/static/assets/pdfjs/web/locale/ia/viewer.ftl +0 -32
  240. package/static/assets/pdfjs/web/locale/id/viewer.ftl +38 -32
  241. package/static/assets/pdfjs/web/locale/is/viewer.ftl +27 -32
  242. package/static/assets/pdfjs/web/locale/it/viewer.ftl +0 -33
  243. package/static/assets/pdfjs/web/locale/ja/viewer.ftl +31 -33
  244. package/static/assets/pdfjs/web/locale/ka/viewer.ftl +0 -32
  245. package/static/assets/pdfjs/web/locale/kab/viewer.ftl +0 -32
  246. package/static/assets/pdfjs/web/locale/kk/viewer.ftl +31 -32
  247. package/static/assets/pdfjs/web/locale/km/viewer.ftl +0 -12
  248. package/static/assets/pdfjs/web/locale/kn/viewer.ftl +0 -12
  249. package/static/assets/pdfjs/web/locale/ko/viewer.ftl +0 -32
  250. package/static/assets/pdfjs/web/locale/lij/viewer.ftl +0 -12
  251. package/static/assets/pdfjs/web/locale/lo/viewer.ftl +0 -23
  252. package/static/assets/pdfjs/web/locale/lt/viewer.ftl +0 -16
  253. package/static/assets/pdfjs/web/locale/ltg/viewer.ftl +0 -12
  254. package/static/assets/pdfjs/web/locale/lv/viewer.ftl +0 -12
  255. package/static/assets/pdfjs/web/locale/meh/viewer.ftl +0 -14
  256. package/static/assets/pdfjs/web/locale/mk/viewer.ftl +0 -19
  257. package/static/assets/pdfjs/web/locale/ml/viewer.ftl +0 -31
  258. package/static/assets/pdfjs/web/locale/mr/viewer.ftl +0 -16
  259. package/static/assets/pdfjs/web/locale/ms/viewer.ftl +0 -12
  260. package/static/assets/pdfjs/web/locale/my/viewer.ftl +0 -12
  261. package/static/assets/pdfjs/web/locale/nb-NO/viewer.ftl +0 -32
  262. package/static/assets/pdfjs/web/locale/ne-NP/viewer.ftl +0 -12
  263. package/static/assets/pdfjs/web/locale/nl/viewer.ftl +0 -32
  264. package/static/assets/pdfjs/web/locale/nn-NO/viewer.ftl +0 -32
  265. package/static/assets/pdfjs/web/locale/oc/viewer.ftl +0 -24
  266. package/static/assets/pdfjs/web/locale/pa-IN/viewer.ftl +0 -32
  267. package/static/assets/pdfjs/web/locale/pl/viewer.ftl +0 -32
  268. package/static/assets/pdfjs/web/locale/pt-BR/viewer.ftl +0 -32
  269. package/static/assets/pdfjs/web/locale/pt-PT/viewer.ftl +0 -32
  270. package/static/assets/pdfjs/web/locale/rm/viewer.ftl +0 -32
  271. package/static/assets/pdfjs/web/locale/ro/viewer.ftl +5 -37
  272. package/static/assets/pdfjs/web/locale/ru/viewer.ftl +0 -32
  273. package/static/assets/pdfjs/web/locale/sat/viewer.ftl +0 -23
  274. package/static/assets/pdfjs/web/locale/sc/viewer.ftl +8 -27
  275. package/static/assets/pdfjs/web/locale/sco/viewer.ftl +0 -16
  276. package/static/assets/pdfjs/web/locale/si/viewer.ftl +0 -22
  277. package/static/assets/pdfjs/web/locale/sk/viewer.ftl +0 -32
  278. package/static/assets/pdfjs/web/locale/skr/viewer.ftl +0 -32
  279. package/static/assets/pdfjs/web/locale/sl/viewer.ftl +30 -32
  280. package/static/assets/pdfjs/web/locale/son/viewer.ftl +0 -12
  281. package/static/assets/pdfjs/web/locale/sq/viewer.ftl +0 -32
  282. package/static/assets/pdfjs/web/locale/sr/viewer.ftl +0 -32
  283. package/static/assets/pdfjs/web/locale/sv-SE/viewer.ftl +0 -32
  284. package/static/assets/pdfjs/web/locale/szl/viewer.ftl +0 -16
  285. package/static/assets/pdfjs/web/locale/ta/viewer.ftl +0 -12
  286. package/static/assets/pdfjs/web/locale/te/viewer.ftl +0 -16
  287. package/static/assets/pdfjs/web/locale/tg/viewer.ftl +0 -32
  288. package/static/assets/pdfjs/web/locale/th/viewer.ftl +38 -32
  289. package/static/assets/pdfjs/web/locale/tl/viewer.ftl +0 -16
  290. package/static/assets/pdfjs/web/locale/tr/viewer.ftl +0 -32
  291. package/static/assets/pdfjs/web/locale/trs/viewer.ftl +0 -12
  292. package/static/assets/pdfjs/web/locale/uk/viewer.ftl +0 -32
  293. package/static/assets/pdfjs/web/locale/ur/viewer.ftl +0 -16
  294. package/static/assets/pdfjs/web/locale/uz/viewer.ftl +0 -12
  295. package/static/assets/pdfjs/web/locale/vi/viewer.ftl +0 -32
  296. package/static/assets/pdfjs/web/locale/xh/viewer.ftl +0 -12
  297. package/static/assets/pdfjs/web/locale/zh-CN/viewer.ftl +0 -32
  298. package/static/assets/pdfjs/web/locale/zh-TW/viewer.ftl +0 -32
  299. package/static/assets/pdfjs/web/viewer.css +586 -437
  300. package/static/assets/pdfjs/web/viewer.html +12 -23
  301. package/static/assets/pdfjs/web/viewer.mjs +955 -514
  302. package/static/assets/pdfjs/web/viewer.mjs.map +1 -1
  303. package/static/assets/pdfjs/web/wasm/openjpeg.wasm +0 -0
  304. package/static/assets/pdfjs/web/wasm/openjpeg_nowasm_fallback.js +10 -22
  305. package/static/{chunk-SPTF6FSM.js → chunk-27YQB3TE.js} +1 -1
  306. package/static/chunk-2I4CUFUA.js +1 -0
  307. package/static/chunk-2MTM6SWN.js +4 -0
  308. package/static/{chunk-7VRUZRJG.js → chunk-34MKICK5.js} +2 -2
  309. package/static/chunk-5O3DIUU3.js +1 -0
  310. package/static/{chunk-VJRTMDEJ.js → chunk-6NMVZIIT.js} +1 -1
  311. package/static/{chunk-L6MU6S2V.js → chunk-7DN7ZAPU.js} +1 -1
  312. package/static/{chunk-MVO4WZLK.js → chunk-7FUM3JGM.js} +1 -1
  313. package/static/{chunk-RSS6GYNE.js → chunk-7ITZXYYJ.js} +1 -1
  314. package/static/chunk-7P27WBGC.js +4 -0
  315. package/static/chunk-ATP3BFHV.js +562 -0
  316. package/static/chunk-AWQ2YTVC.js +1 -0
  317. package/static/chunk-DSOE3FEP.js +1 -0
  318. package/static/{chunk-2R6HHGUR.js → chunk-EFKMBLRE.js} +1 -1
  319. package/static/chunk-FUFKVHPU.js +1 -0
  320. package/static/{chunk-MRSWNAVB.js → chunk-HCDLWTMW.js} +1 -1
  321. package/static/chunk-IPAC4VAF.js +1 -0
  322. package/static/{chunk-ZC5NIT55.js → chunk-IQOALFYU.js} +1 -1
  323. package/static/chunk-JASU3CIH.js +1 -0
  324. package/static/{chunk-6OJZWYRZ.js → chunk-JQ5FTO2M.js} +1 -1
  325. package/static/chunk-JUNZFADM.js +1 -0
  326. package/static/{chunk-LLWSLOSX.js → chunk-LJUKI4SQ.js} +1 -1
  327. package/static/{chunk-WI7FOANP.js → chunk-LUWQFIWR.js} +1 -1
  328. package/static/{chunk-BIUNUYZ5.js → chunk-ORMRCEGT.js} +1 -1
  329. package/static/{chunk-IZL7JPTS.js → chunk-Q7D6RN4N.js} +1 -1
  330. package/static/{chunk-JYXLQRHG.js → chunk-QJX6ITLW.js} +1 -1
  331. package/static/{chunk-YJMN3B4N.js → chunk-QQ6UQQBR.js} +1 -1
  332. package/static/chunk-S2HDY3OL.js +1 -0
  333. package/static/{chunk-NE4NDO45.js → chunk-S75P2FFI.js} +1 -1
  334. package/static/{chunk-CRQNEHTX.js → chunk-T3EYFSVZ.js} +1 -1
  335. package/static/{chunk-MCLQFZ3S.js → chunk-U34OZUZ7.js} +1 -1
  336. package/static/chunk-Y7EH7G5K.js +1 -0
  337. package/static/{chunk-MGGT6MIJ.js → chunk-ZQQPUYLU.js} +1 -1
  338. package/static/index.html +2 -2
  339. package/static/main-7SQDDVMD.js +9 -0
  340. package/static/{styles-FYUSO6OJ.css → styles-A5VYX3CE.css} +1 -1
  341. package/server/applications/users/dto/user-password.dto.js.map +0 -1
  342. package/static/chunk-4U5A2DEP.js +0 -4
  343. package/static/chunk-54EAZ2UD.js +0 -1
  344. package/static/chunk-7ZRXJONB.js +0 -1
  345. package/static/chunk-F2J2IIJE.js +0 -1
  346. package/static/chunk-FNFGUIQH.js +0 -4
  347. package/static/chunk-GGLK52CG.js +0 -1
  348. package/static/chunk-HW2H3ISM.js +0 -559
  349. package/static/chunk-HX6BBYVD.js +0 -1
  350. package/static/chunk-JF7S3UYQ.js +0 -1
  351. package/static/chunk-KSHPKI4G.js +0 -1
  352. package/static/chunk-VPJ2V27B.js +0 -1
  353. package/static/chunk-VUI3KV7V.js +0 -1
  354. package/static/chunk-ZXS4V7J2.js +0 -1
  355. package/static/main-FFIWFD2F.js +0 -7
@@ -21,8 +21,8 @@
21
21
  */
22
22
 
23
23
  /**
24
- * pdfjsVersion = 5.4.149
25
- * pdfjsBuild = 9e2e9e209
24
+ * pdfjsVersion = 5.4.296
25
+ * pdfjsBuild = f56dc8601
26
26
  */
27
27
  /******/ // The require scope
28
28
  /******/ var __webpack_require__ = {};
@@ -58,13 +58,16 @@ const {
58
58
  AnnotationLayer,
59
59
  AnnotationMode,
60
60
  AnnotationType,
61
+ applyOpacity,
61
62
  build,
62
63
  ColorPicker,
63
64
  createValidAbsoluteUrl,
65
+ CSSConstants,
64
66
  DOMSVGFactory,
65
67
  DrawLayer,
66
68
  FeatureTest,
67
69
  fetchData,
70
+ findContrastColor,
68
71
  getDocument,
69
72
  getFilenameFromUrl,
70
73
  getPdfFilenameFromUrl: pdfjs_getPdfFilenameFromUrl,
@@ -89,6 +92,7 @@ const {
89
92
  PermissionFlag,
90
93
  PixelsPerInch,
91
94
  RenderingCancelledException,
95
+ renderRichText,
92
96
  ResponseException,
93
97
  setLayerDimensions,
94
98
  shadow,
@@ -704,6 +708,10 @@ const defaultOptions = {
704
708
  value: 200,
705
709
  kind: OptionKind.VIEWER + OptionKind.PREFERENCE
706
710
  },
711
+ commentLearnMoreUrl: {
712
+ value: "",
713
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
714
+ },
707
715
  cursorToolOnLoad: {
708
716
  value: 0,
709
717
  kind: OptionKind.VIEWER + OptionKind.PREFERENCE
@@ -1171,13 +1179,14 @@ class PDFLinkService {
1171
1179
  pageNumber
1172
1180
  });
1173
1181
  }
1174
- goToXY(pageNumber, x, y) {
1182
+ goToXY(pageNumber, x, y, options = {}) {
1175
1183
  this.pdfViewer.scrollPageIntoView({
1176
1184
  pageNumber,
1177
1185
  destArray: [null, {
1178
1186
  name: "XYZ"
1179
1187
  }, x, y],
1180
- ignoreDestinationZoom: true
1188
+ ignoreDestinationZoom: true,
1189
+ ...options
1181
1190
  });
1182
1191
  }
1183
1192
  addLinkAttributes(link, url, newWindow = false) {
@@ -1506,6 +1515,7 @@ class BasePreferences {
1506
1515
  annotationEditorMode: 0,
1507
1516
  annotationMode: 2,
1508
1517
  capCanvasAreaFactor: 200,
1518
+ commentLearnMoreUrl: "",
1509
1519
  cursorToolOnLoad: 0,
1510
1520
  defaultZoomDelay: 400,
1511
1521
  defaultZoomValue: "",
@@ -3144,7 +3154,7 @@ class genericl10n_GenericL10n extends L10n {
3144
3154
  yield this.#createBundleFallback(lang);
3145
3155
  }
3146
3156
  static async #createBundleFallback(lang) {
3147
- const text = "pdfjs-previous-button =\n .title = Previous Page\npdfjs-previous-button-label = Previous\npdfjs-next-button =\n .title = Next Page\npdfjs-next-button-label = Next\npdfjs-page-input =\n .title = Page\npdfjs-of-pages = of { $pagesCount }\npdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })\npdfjs-zoom-out-button =\n .title = Zoom Out\npdfjs-zoom-out-button-label = Zoom Out\npdfjs-zoom-in-button =\n .title = Zoom In\npdfjs-zoom-in-button-label = Zoom In\npdfjs-zoom-select =\n .title = Zoom\npdfjs-presentation-mode-button =\n .title = Switch to Presentation Mode\npdfjs-presentation-mode-button-label = Presentation Mode\npdfjs-open-file-button =\n .title = Open File\npdfjs-open-file-button-label = Open\npdfjs-print-button =\n .title = Print\npdfjs-print-button-label = Print\npdfjs-save-button =\n .title = Save\npdfjs-save-button-label = Save\npdfjs-download-button =\n .title = Download\npdfjs-download-button-label = Download\npdfjs-bookmark-button =\n .title = Current Page (View URL from Current Page)\npdfjs-bookmark-button-label = Current Page\npdfjs-tools-button =\n .title = Tools\npdfjs-tools-button-label = Tools\npdfjs-first-page-button =\n .title = Go to First Page\npdfjs-first-page-button-label = Go to First Page\npdfjs-last-page-button =\n .title = Go to Last Page\npdfjs-last-page-button-label = Go to Last Page\npdfjs-page-rotate-cw-button =\n .title = Rotate Clockwise\npdfjs-page-rotate-cw-button-label = Rotate Clockwise\npdfjs-page-rotate-ccw-button =\n .title = Rotate Counterclockwise\npdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise\npdfjs-cursor-text-select-tool-button =\n .title = Enable Text Selection Tool\npdfjs-cursor-text-select-tool-button-label = Text Selection Tool\npdfjs-cursor-hand-tool-button =\n .title = Enable Hand Tool\npdfjs-cursor-hand-tool-button-label = Hand Tool\npdfjs-scroll-page-button =\n .title = Use Page Scrolling\npdfjs-scroll-page-button-label = Page Scrolling\npdfjs-scroll-vertical-button =\n .title = Use Vertical Scrolling\npdfjs-scroll-vertical-button-label = Vertical Scrolling\npdfjs-scroll-horizontal-button =\n .title = Use Horizontal Scrolling\npdfjs-scroll-horizontal-button-label = Horizontal Scrolling\npdfjs-scroll-wrapped-button =\n .title = Use Wrapped Scrolling\npdfjs-scroll-wrapped-button-label = Wrapped Scrolling\npdfjs-spread-none-button =\n .title = Do not join page spreads\npdfjs-spread-none-button-label = No Spreads\npdfjs-spread-odd-button =\n .title = Join page spreads starting with odd-numbered pages\npdfjs-spread-odd-button-label = Odd Spreads\npdfjs-spread-even-button =\n .title = Join page spreads starting with even-numbered pages\npdfjs-spread-even-button-label = Even Spreads\npdfjs-document-properties-button =\n .title = Document Properties\u2026\npdfjs-document-properties-button-label = Document Properties\u2026\npdfjs-document-properties-file-name = File name:\npdfjs-document-properties-file-size = File size:\npdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)\npdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)\npdfjs-document-properties-title = Title:\npdfjs-document-properties-author = Author:\npdfjs-document-properties-subject = Subject:\npdfjs-document-properties-keywords = Keywords:\npdfjs-document-properties-creation-date = Creation Date:\npdfjs-document-properties-modification-date = Modification Date:\npdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: \"short\", timeStyle: \"medium\") }\npdfjs-document-properties-creator = Creator:\npdfjs-document-properties-producer = PDF Producer:\npdfjs-document-properties-version = PDF Version:\npdfjs-document-properties-page-count = Page Count:\npdfjs-document-properties-page-size = Page Size:\npdfjs-document-properties-page-size-unit-inches = in\npdfjs-document-properties-page-size-unit-millimeters = mm\npdfjs-document-properties-page-size-orientation-portrait = portrait\npdfjs-document-properties-page-size-orientation-landscape = landscape\npdfjs-document-properties-page-size-name-a-three = A3\npdfjs-document-properties-page-size-name-a-four = A4\npdfjs-document-properties-page-size-name-letter = Letter\npdfjs-document-properties-page-size-name-legal = Legal\npdfjs-document-properties-page-size-dimension-string = { $width } \xD7 { $height } { $unit } ({ $orientation })\npdfjs-document-properties-page-size-dimension-name-string = { $width } \xD7 { $height } { $unit } ({ $name }, { $orientation })\npdfjs-document-properties-linearized = Fast Web View:\npdfjs-document-properties-linearized-yes = Yes\npdfjs-document-properties-linearized-no = No\npdfjs-document-properties-close-button = Close\npdfjs-print-progress-message = Preparing document for printing\u2026\npdfjs-print-progress-percent = { $progress }%\npdfjs-print-progress-close-button = Cancel\npdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.\npdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.\npdfjs-toggle-sidebar-button =\n .title = Toggle Sidebar\npdfjs-toggle-sidebar-notification-button =\n .title = Toggle Sidebar (document contains outline/attachments/layers)\npdfjs-toggle-sidebar-button-label = Toggle Sidebar\npdfjs-document-outline-button =\n .title = Show Document Outline (double-click to expand/collapse all items)\npdfjs-document-outline-button-label = Document Outline\npdfjs-attachments-button =\n .title = Show Attachments\npdfjs-attachments-button-label = Attachments\npdfjs-layers-button =\n .title = Show Layers (double-click to reset all layers to the default state)\npdfjs-layers-button-label = Layers\npdfjs-thumbs-button =\n .title = Show Thumbnails\npdfjs-thumbs-button-label = Thumbnails\npdfjs-current-outline-item-button =\n .title = Find Current Outline Item\npdfjs-current-outline-item-button-label = Current Outline Item\npdfjs-findbar-button =\n .title = Find in Document\npdfjs-findbar-button-label = Find\npdfjs-additional-layers = Additional Layers\npdfjs-thumb-page-title =\n .title = Page { $page }\npdfjs-thumb-page-canvas =\n .aria-label = Thumbnail of Page { $page }\npdfjs-find-input =\n .title = Find\n .placeholder = Find in document\u2026\npdfjs-find-previous-button =\n .title = Find the previous occurrence of the phrase\npdfjs-find-previous-button-label = Previous\npdfjs-find-next-button =\n .title = Find the next occurrence of the phrase\npdfjs-find-next-button-label = Next\npdfjs-find-highlight-checkbox = Highlight All\npdfjs-find-match-case-checkbox-label = Match Case\npdfjs-find-match-diacritics-checkbox-label = Match Diacritics\npdfjs-find-entire-word-checkbox-label = Whole Words\npdfjs-find-reached-top = Reached top of document, continued from bottom\npdfjs-find-reached-bottom = Reached end of document, continued from top\npdfjs-find-match-count =\n { $total ->\n [one] { $current } of { $total } match\n *[other] { $current } of { $total } matches\n }\npdfjs-find-match-count-limit =\n { $limit ->\n [one] More than { $limit } match\n *[other] More than { $limit } matches\n }\npdfjs-find-not-found = Phrase not found\npdfjs-page-scale-width = Page Width\npdfjs-page-scale-fit = Page Fit\npdfjs-page-scale-auto = Automatic Zoom\npdfjs-page-scale-actual = Actual Size\npdfjs-page-scale-percent = { $scale }%\npdfjs-page-landmark =\n .aria-label = Page { $page }\npdfjs-loading-error = An error occurred while loading the PDF.\npdfjs-invalid-file-error = Invalid or corrupted PDF file.\npdfjs-missing-file-error = Missing PDF file.\npdfjs-unexpected-response-error = Unexpected server response.\npdfjs-rendering-error = An error occurred while rendering the page.\npdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: \"short\", timeStyle: \"medium\") }\npdfjs-text-annotation-type =\n .alt = [{ $type } Annotation]\npdfjs-password-label = Enter the password to open this PDF file.\npdfjs-password-invalid = Invalid password. Please try again.\npdfjs-password-ok-button = OK\npdfjs-password-cancel-button = Cancel\npdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.\npdfjs-editor-free-text-button =\n .title = Text\npdfjs-editor-color-picker-free-text-input =\n .title = Change text color\npdfjs-editor-free-text-button-label = Text\npdfjs-editor-ink-button =\n .title = Draw\npdfjs-editor-color-picker-ink-input =\n .title = Change drawing color\npdfjs-editor-ink-button-label = Draw\npdfjs-editor-stamp-button =\n .title = Add or edit images\npdfjs-editor-stamp-button-label = Add or edit images\npdfjs-editor-highlight-button =\n .title = Highlight\npdfjs-editor-highlight-button-label = Highlight\npdfjs-highlight-floating-button1 =\n .title = Highlight\n .aria-label = Highlight\npdfjs-highlight-floating-button-label = Highlight\npdfjs-comment-floating-button =\n .title = Comment\n .aria-label = Comment\npdfjs-comment-floating-button-label = Comment\npdfjs-editor-comment-button =\n .title = Comment\n .aria-label = Comment\npdfjs-editor-comment-button-label = Comment\npdfjs-editor-signature-button =\n .title = Add signature\npdfjs-editor-signature-button-label = Add signature\npdfjs-editor-highlight-editor =\n .aria-label = Highlight editor\npdfjs-editor-ink-editor =\n .aria-label = Drawing editor\npdfjs-editor-signature-editor1 =\n .aria-description = Signature editor: { $description }\npdfjs-editor-stamp-editor =\n .aria-label = Image editor\npdfjs-editor-remove-ink-button =\n .title = Remove drawing\npdfjs-editor-remove-freetext-button =\n .title = Remove text\npdfjs-editor-remove-stamp-button =\n .title = Remove image\npdfjs-editor-remove-highlight-button =\n .title = Remove highlight\npdfjs-editor-remove-signature-button =\n .title = Remove signature\npdfjs-editor-free-text-color-input = Color\npdfjs-editor-free-text-size-input = Size\npdfjs-editor-ink-color-input = Color\npdfjs-editor-ink-thickness-input = Thickness\npdfjs-editor-ink-opacity-input = Opacity\npdfjs-editor-stamp-add-image-button =\n .title = Add image\npdfjs-editor-stamp-add-image-button-label = Add image\npdfjs-editor-free-highlight-thickness-input = Thickness\npdfjs-editor-free-highlight-thickness-title =\n .title = Change thickness when highlighting items other than text\npdfjs-editor-add-signature-container =\n .aria-label = Signature controls and saved signatures\npdfjs-editor-signature-add-signature-button =\n .title = Add new signature\npdfjs-editor-signature-add-signature-button-label = Add new signature\npdfjs-editor-add-saved-signature-button =\n .title = Saved signature: { $description }\npdfjs-free-text2 =\n .aria-label = Text Editor\n .default-content = Start typing\u2026\npdfjs-editor-comments-sidebar-title =\n { $count ->\n [one] Comment\n *[other] Comments\n }\npdfjs-editor-comments-sidebar-close-button =\n .title = Close the sidebar\n .aria-label = Close the sidebar\npdfjs-editor-comments-sidebar-close-button-label = Close the sidebar\npdfjs-editor-comments-sidebar-no-comments = Add a comment by selecting text or an annotation.\npdfjs-editor-alt-text-button =\n .aria-label = Alt text\npdfjs-editor-alt-text-button-label = Alt text\npdfjs-editor-alt-text-edit-button =\n .aria-label = Edit alt text\npdfjs-editor-alt-text-dialog-label = Choose an option\npdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can\u2019t see the image or when it doesn\u2019t load.\npdfjs-editor-alt-text-add-description-label = Add a description\npdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.\npdfjs-editor-alt-text-mark-decorative-label = Mark as decorative\npdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.\npdfjs-editor-alt-text-cancel-button = Cancel\npdfjs-editor-alt-text-save-button = Save\npdfjs-editor-alt-text-decorative-tooltip = Marked as decorative\npdfjs-editor-alt-text-textarea =\n .placeholder = For example, \u201CA young man sits down at a table to eat a meal\u201D\npdfjs-editor-resizer-top-left =\n .aria-label = Top left corner \u2014 resize\npdfjs-editor-resizer-top-middle =\n .aria-label = Top middle \u2014 resize\npdfjs-editor-resizer-top-right =\n .aria-label = Top right corner \u2014 resize\npdfjs-editor-resizer-middle-right =\n .aria-label = Middle right \u2014 resize\npdfjs-editor-resizer-bottom-right =\n .aria-label = Bottom right corner \u2014 resize\npdfjs-editor-resizer-bottom-middle =\n .aria-label = Bottom middle \u2014 resize\npdfjs-editor-resizer-bottom-left =\n .aria-label = Bottom left corner \u2014 resize\npdfjs-editor-resizer-middle-left =\n .aria-label = Middle left \u2014 resize\npdfjs-editor-highlight-colorpicker-label = Highlight color\npdfjs-editor-colorpicker-button =\n .title = Change color\npdfjs-editor-colorpicker-dropdown =\n .aria-label = Color choices\npdfjs-editor-colorpicker-yellow =\n .title = Yellow\npdfjs-editor-colorpicker-green =\n .title = Green\npdfjs-editor-colorpicker-blue =\n .title = Blue\npdfjs-editor-colorpicker-pink =\n .title = Pink\npdfjs-editor-colorpicker-red =\n .title = Red\npdfjs-editor-highlight-show-all-button-label = Show all\npdfjs-editor-highlight-show-all-button =\n .title = Show all\npdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)\npdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)\npdfjs-editor-new-alt-text-textarea =\n .placeholder = Write your description here\u2026\npdfjs-editor-new-alt-text-description = Short description for people who can\u2019t see the image or when the image doesn\u2019t load.\npdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.\npdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more\npdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically\npdfjs-editor-new-alt-text-not-now-button = Not now\npdfjs-editor-new-alt-text-error-title = Couldn\u2019t create alt text automatically\npdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.\npdfjs-editor-new-alt-text-error-close-button = Close\npdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\n .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\npdfjs-editor-new-alt-text-added-button =\n .aria-label = Alt text added\npdfjs-editor-new-alt-text-added-button-label = Alt text added\npdfjs-editor-new-alt-text-missing-button =\n .aria-label = Missing alt text\npdfjs-editor-new-alt-text-missing-button-label = Missing alt text\npdfjs-editor-new-alt-text-to-review-button =\n .aria-label = Review alt text\npdfjs-editor-new-alt-text-to-review-button-label = Review alt text\npdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }\npdfjs-image-alt-text-settings-button =\n .title = Image alt text settings\npdfjs-image-alt-text-settings-button-label = Image alt text settings\npdfjs-editor-alt-text-settings-dialog-label = Image alt text settings\npdfjs-editor-alt-text-settings-automatic-title = Automatic alt text\npdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically\npdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who can\u2019t see the image or when the image doesn\u2019t load.\npdfjs-editor-alt-text-settings-download-model-label = Alt text AI model ({ $totalSize } MB)\npdfjs-editor-alt-text-settings-ai-model-description = Runs locally on your device so your data stays private. Required for automatic alt text.\npdfjs-editor-alt-text-settings-delete-model-button = Delete\npdfjs-editor-alt-text-settings-download-model-button = Download\npdfjs-editor-alt-text-settings-downloading-model-button = Downloading\u2026\npdfjs-editor-alt-text-settings-editor-title = Alt text editor\npdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image\npdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.\npdfjs-editor-alt-text-settings-close-button = Close\npdfjs-editor-highlight-added-alert = Highlight added\npdfjs-editor-freetext-added-alert = Text added\npdfjs-editor-ink-added-alert = Drawing added\npdfjs-editor-stamp-added-alert = Image added\npdfjs-editor-signature-added-alert = Signature added\npdfjs-editor-undo-bar-message-highlight = Highlight removed\npdfjs-editor-undo-bar-message-freetext = Text removed\npdfjs-editor-undo-bar-message-ink = Drawing removed\npdfjs-editor-undo-bar-message-stamp = Image removed\npdfjs-editor-undo-bar-message-signature = Signature removed\npdfjs-editor-undo-bar-message-multiple =\n { $count ->\n [one] { $count } annotation removed\n *[other] { $count } annotations removed\n }\npdfjs-editor-undo-bar-undo-button =\n .title = Undo\npdfjs-editor-undo-bar-undo-button-label = Undo\npdfjs-editor-undo-bar-close-button =\n .title = Close\npdfjs-editor-undo-bar-close-button-label = Close\npdfjs-editor-add-signature-dialog-label = This modal allows the user to create a signature to add to a PDF document. The user can edit the name (which also serves as the alt text), and optionally save the signature for repeated use.\npdfjs-editor-add-signature-dialog-title = Add a signature\npdfjs-editor-add-signature-type-button = Type\n .title = Type\npdfjs-editor-add-signature-draw-button = Draw\n .title = Draw\npdfjs-editor-add-signature-image-button = Image\n .title = Image\npdfjs-editor-add-signature-type-input =\n .aria-label = Type your signature\n .placeholder = Type your signature\npdfjs-editor-add-signature-draw-placeholder = Draw your signature\npdfjs-editor-add-signature-draw-thickness-range-label = Thickness\npdfjs-editor-add-signature-draw-thickness-range =\n .title = Drawing thickness: { $thickness }\npdfjs-editor-add-signature-image-placeholder = Drag a file here to upload\npdfjs-editor-add-signature-image-browse-link =\n { PLATFORM() ->\n [macos] Or choose image files\n *[other] Or browse image files\n }\npdfjs-editor-add-signature-description-label = Description (alt text)\npdfjs-editor-add-signature-description-input =\n .title = Description (alt text)\npdfjs-editor-add-signature-description-default-when-drawing = Signature\npdfjs-editor-add-signature-clear-button-label = Clear signature\npdfjs-editor-add-signature-clear-button =\n .title = Clear signature\npdfjs-editor-add-signature-save-checkbox = Save signature\npdfjs-editor-add-signature-save-warning-message = You\u2019ve reached the limit of 5 saved signatures. Remove one to save more.\npdfjs-editor-add-signature-image-upload-error-title = Couldn\u2019t upload image\npdfjs-editor-add-signature-image-upload-error-description = Check your network connection or try another image.\npdfjs-editor-add-signature-image-no-data-error-title = Can\u2019t convert this image into a signature\npdfjs-editor-add-signature-image-no-data-error-description = Please try uploading a different image.\npdfjs-editor-add-signature-error-close-button = Close\npdfjs-editor-add-signature-cancel-button = Cancel\npdfjs-editor-add-signature-add-button = Add\npdfjs-editor-delete-signature-button1 =\n .title = Remove saved signature\npdfjs-editor-delete-signature-button-label1 = Remove saved signature\npdfjs-editor-add-signature-edit-button-label = Edit description\npdfjs-editor-edit-signature-dialog-title = Edit description\npdfjs-editor-edit-signature-update-button = Update\npdfjs-editor-edit-comment-actions-button-label = Actions\npdfjs-editor-edit-comment-actions-button =\n .title = Actions\npdfjs-editor-edit-comment-close-button-label = Close\npdfjs-editor-edit-comment-close-button =\n .title = Close\npdfjs-editor-edit-comment-actions-edit-button-label = Edit\npdfjs-editor-edit-comment-actions-delete-button-label = Delete\npdfjs-editor-edit-comment-manager-text-input =\n .placeholder = Enter your comment\npdfjs-editor-edit-comment-manager-cancel-button = Cancel\npdfjs-editor-edit-comment-manager-save-button = Save\npdfjs-editor-edit-comment-button =\n .title = Edit comment";
3157
+ const text = "pdfjs-previous-button =\n .title = Previous Page\npdfjs-previous-button-label = Previous\npdfjs-next-button =\n .title = Next Page\npdfjs-next-button-label = Next\npdfjs-page-input =\n .title = Page\npdfjs-of-pages = of { $pagesCount }\npdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })\npdfjs-zoom-out-button =\n .title = Zoom Out\npdfjs-zoom-out-button-label = Zoom Out\npdfjs-zoom-in-button =\n .title = Zoom In\npdfjs-zoom-in-button-label = Zoom In\npdfjs-zoom-select =\n .title = Zoom\npdfjs-presentation-mode-button =\n .title = Switch to Presentation Mode\npdfjs-presentation-mode-button-label = Presentation Mode\npdfjs-open-file-button =\n .title = Open File\npdfjs-open-file-button-label = Open\npdfjs-print-button =\n .title = Print\npdfjs-print-button-label = Print\npdfjs-save-button =\n .title = Save\npdfjs-save-button-label = Save\npdfjs-download-button =\n .title = Download\npdfjs-download-button-label = Download\npdfjs-bookmark-button =\n .title = Current Page (View URL from Current Page)\npdfjs-bookmark-button-label = Current Page\npdfjs-tools-button =\n .title = Tools\npdfjs-tools-button-label = Tools\npdfjs-first-page-button =\n .title = Go to First Page\npdfjs-first-page-button-label = Go to First Page\npdfjs-last-page-button =\n .title = Go to Last Page\npdfjs-last-page-button-label = Go to Last Page\npdfjs-page-rotate-cw-button =\n .title = Rotate Clockwise\npdfjs-page-rotate-cw-button-label = Rotate Clockwise\npdfjs-page-rotate-ccw-button =\n .title = Rotate Counterclockwise\npdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise\npdfjs-cursor-text-select-tool-button =\n .title = Enable Text Selection Tool\npdfjs-cursor-text-select-tool-button-label = Text Selection Tool\npdfjs-cursor-hand-tool-button =\n .title = Enable Hand Tool\npdfjs-cursor-hand-tool-button-label = Hand Tool\npdfjs-scroll-page-button =\n .title = Use Page Scrolling\npdfjs-scroll-page-button-label = Page Scrolling\npdfjs-scroll-vertical-button =\n .title = Use Vertical Scrolling\npdfjs-scroll-vertical-button-label = Vertical Scrolling\npdfjs-scroll-horizontal-button =\n .title = Use Horizontal Scrolling\npdfjs-scroll-horizontal-button-label = Horizontal Scrolling\npdfjs-scroll-wrapped-button =\n .title = Use Wrapped Scrolling\npdfjs-scroll-wrapped-button-label = Wrapped Scrolling\npdfjs-spread-none-button =\n .title = Do not join page spreads\npdfjs-spread-none-button-label = No Spreads\npdfjs-spread-odd-button =\n .title = Join page spreads starting with odd-numbered pages\npdfjs-spread-odd-button-label = Odd Spreads\npdfjs-spread-even-button =\n .title = Join page spreads starting with even-numbered pages\npdfjs-spread-even-button-label = Even Spreads\npdfjs-document-properties-button =\n .title = Document Properties\u2026\npdfjs-document-properties-button-label = Document Properties\u2026\npdfjs-document-properties-file-name = File name:\npdfjs-document-properties-file-size = File size:\npdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)\npdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)\npdfjs-document-properties-title = Title:\npdfjs-document-properties-author = Author:\npdfjs-document-properties-subject = Subject:\npdfjs-document-properties-keywords = Keywords:\npdfjs-document-properties-creation-date = Creation Date:\npdfjs-document-properties-modification-date = Modification Date:\npdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: \"short\", timeStyle: \"medium\") }\npdfjs-document-properties-creator = Creator:\npdfjs-document-properties-producer = PDF Producer:\npdfjs-document-properties-version = PDF Version:\npdfjs-document-properties-page-count = Page Count:\npdfjs-document-properties-page-size = Page Size:\npdfjs-document-properties-page-size-unit-inches = in\npdfjs-document-properties-page-size-unit-millimeters = mm\npdfjs-document-properties-page-size-orientation-portrait = portrait\npdfjs-document-properties-page-size-orientation-landscape = landscape\npdfjs-document-properties-page-size-name-a-three = A3\npdfjs-document-properties-page-size-name-a-four = A4\npdfjs-document-properties-page-size-name-letter = Letter\npdfjs-document-properties-page-size-name-legal = Legal\npdfjs-document-properties-page-size-dimension-string = { $width } \xD7 { $height } { $unit } ({ $orientation })\npdfjs-document-properties-page-size-dimension-name-string = { $width } \xD7 { $height } { $unit } ({ $name }, { $orientation })\npdfjs-document-properties-linearized = Fast Web View:\npdfjs-document-properties-linearized-yes = Yes\npdfjs-document-properties-linearized-no = No\npdfjs-document-properties-close-button = Close\npdfjs-print-progress-message = Preparing document for printing\u2026\npdfjs-print-progress-percent = { $progress }%\npdfjs-print-progress-close-button = Cancel\npdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.\npdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.\npdfjs-toggle-sidebar-button =\n .title = Toggle Sidebar\npdfjs-toggle-sidebar-notification-button =\n .title = Toggle Sidebar (document contains outline/attachments/layers)\npdfjs-toggle-sidebar-button-label = Toggle Sidebar\npdfjs-document-outline-button =\n .title = Show Document Outline (double-click to expand/collapse all items)\npdfjs-document-outline-button-label = Document Outline\npdfjs-attachments-button =\n .title = Show Attachments\npdfjs-attachments-button-label = Attachments\npdfjs-layers-button =\n .title = Show Layers (double-click to reset all layers to the default state)\npdfjs-layers-button-label = Layers\npdfjs-thumbs-button =\n .title = Show Thumbnails\npdfjs-thumbs-button-label = Thumbnails\npdfjs-current-outline-item-button =\n .title = Find Current Outline Item\npdfjs-current-outline-item-button-label = Current Outline Item\npdfjs-findbar-button =\n .title = Find in Document\npdfjs-findbar-button-label = Find\npdfjs-additional-layers = Additional Layers\npdfjs-thumb-page-title =\n .title = Page { $page }\npdfjs-thumb-page-canvas =\n .aria-label = Thumbnail of Page { $page }\npdfjs-find-input =\n .title = Find\n .placeholder = Find in document\u2026\npdfjs-find-previous-button =\n .title = Find the previous occurrence of the phrase\npdfjs-find-previous-button-label = Previous\npdfjs-find-next-button =\n .title = Find the next occurrence of the phrase\npdfjs-find-next-button-label = Next\npdfjs-find-highlight-checkbox = Highlight All\npdfjs-find-match-case-checkbox-label = Match Case\npdfjs-find-match-diacritics-checkbox-label = Match Diacritics\npdfjs-find-entire-word-checkbox-label = Whole Words\npdfjs-find-reached-top = Reached top of document, continued from bottom\npdfjs-find-reached-bottom = Reached end of document, continued from top\npdfjs-find-match-count =\n { $total ->\n [one] { $current } of { $total } match\n *[other] { $current } of { $total } matches\n }\npdfjs-find-match-count-limit =\n { $limit ->\n [one] More than { $limit } match\n *[other] More than { $limit } matches\n }\npdfjs-find-not-found = Phrase not found\npdfjs-page-scale-width = Page Width\npdfjs-page-scale-fit = Page Fit\npdfjs-page-scale-auto = Automatic Zoom\npdfjs-page-scale-actual = Actual Size\npdfjs-page-scale-percent = { $scale }%\npdfjs-page-landmark =\n .aria-label = Page { $page }\npdfjs-loading-error = An error occurred while loading the PDF.\npdfjs-invalid-file-error = Invalid or corrupted PDF file.\npdfjs-missing-file-error = Missing PDF file.\npdfjs-unexpected-response-error = Unexpected server response.\npdfjs-rendering-error = An error occurred while rendering the page.\npdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: \"short\", timeStyle: \"medium\") }\npdfjs-text-annotation-type =\n .alt = [{ $type } Annotation]\npdfjs-password-label = Enter the password to open this PDF file.\npdfjs-password-invalid = Invalid password. Please try again.\npdfjs-password-ok-button = OK\npdfjs-password-cancel-button = Cancel\npdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.\npdfjs-editor-free-text-button =\n .title = Text\npdfjs-editor-color-picker-free-text-input =\n .title = Change text color\npdfjs-editor-free-text-button-label = Text\npdfjs-editor-ink-button =\n .title = Draw\npdfjs-editor-color-picker-ink-input =\n .title = Change drawing color\npdfjs-editor-ink-button-label = Draw\npdfjs-editor-stamp-button =\n .title = Add or edit images\npdfjs-editor-stamp-button-label = Add or edit images\npdfjs-editor-highlight-button =\n .title = Highlight\npdfjs-editor-highlight-button-label = Highlight\npdfjs-highlight-floating-button1 =\n .title = Highlight\n .aria-label = Highlight\npdfjs-highlight-floating-button-label = Highlight\npdfjs-comment-floating-button =\n .title = Comment\n .aria-label = Comment\npdfjs-comment-floating-button-label = Comment\npdfjs-editor-comment-button =\n .title = Comment\n .aria-label = Comment\npdfjs-editor-comment-button-label = Comment\npdfjs-editor-signature-button =\n .title = Add signature\npdfjs-editor-signature-button-label = Add signature\npdfjs-editor-highlight-editor =\n .aria-label = Highlight editor\npdfjs-editor-ink-editor =\n .aria-label = Drawing editor\npdfjs-editor-signature-editor1 =\n .aria-description = Signature editor: { $description }\npdfjs-editor-stamp-editor =\n .aria-label = Image editor\npdfjs-editor-remove-ink-button =\n .title = Remove drawing\npdfjs-editor-remove-freetext-button =\n .title = Remove text\npdfjs-editor-remove-stamp-button =\n .title = Remove image\npdfjs-editor-remove-highlight-button =\n .title = Remove highlight\npdfjs-editor-remove-signature-button =\n .title = Remove signature\npdfjs-editor-free-text-color-input = Color\npdfjs-editor-free-text-size-input = Size\npdfjs-editor-ink-color-input = Color\npdfjs-editor-ink-thickness-input = Thickness\npdfjs-editor-ink-opacity-input = Opacity\npdfjs-editor-stamp-add-image-button =\n .title = Add image\npdfjs-editor-stamp-add-image-button-label = Add image\npdfjs-editor-free-highlight-thickness-input = Thickness\npdfjs-editor-free-highlight-thickness-title =\n .title = Change thickness when highlighting items other than text\npdfjs-editor-add-signature-container =\n .aria-label = Signature controls and saved signatures\npdfjs-editor-signature-add-signature-button =\n .title = Add new signature\npdfjs-editor-signature-add-signature-button-label = Add new signature\npdfjs-editor-add-saved-signature-button =\n .title = Saved signature: { $description }\npdfjs-free-text2 =\n .aria-label = Text Editor\n .default-content = Start typing\u2026\npdfjs-editor-comments-sidebar-title =\n { $count ->\n [one] Comment\n *[other] Comments\n }\npdfjs-editor-comments-sidebar-close-button =\n .title = Close the sidebar\n .aria-label = Close the sidebar\npdfjs-editor-comments-sidebar-close-button-label = Close the sidebar\npdfjs-editor-comments-sidebar-no-comments1 = See something noteworthy? Highlight it and leave a comment.\npdfjs-editor-comments-sidebar-no-comments-link = Learn more\npdfjs-editor-alt-text-button =\n .aria-label = Alt text\npdfjs-editor-alt-text-button-label = Alt text\npdfjs-editor-alt-text-edit-button =\n .aria-label = Edit alt text\npdfjs-editor-alt-text-dialog-label = Choose an option\npdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can\u2019t see the image or when it doesn\u2019t load.\npdfjs-editor-alt-text-add-description-label = Add a description\npdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.\npdfjs-editor-alt-text-mark-decorative-label = Mark as decorative\npdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.\npdfjs-editor-alt-text-cancel-button = Cancel\npdfjs-editor-alt-text-save-button = Save\npdfjs-editor-alt-text-decorative-tooltip = Marked as decorative\npdfjs-editor-alt-text-textarea =\n .placeholder = For example, \u201CA young man sits down at a table to eat a meal\u201D\npdfjs-editor-resizer-top-left =\n .aria-label = Top left corner \u2014 resize\npdfjs-editor-resizer-top-middle =\n .aria-label = Top middle \u2014 resize\npdfjs-editor-resizer-top-right =\n .aria-label = Top right corner \u2014 resize\npdfjs-editor-resizer-middle-right =\n .aria-label = Middle right \u2014 resize\npdfjs-editor-resizer-bottom-right =\n .aria-label = Bottom right corner \u2014 resize\npdfjs-editor-resizer-bottom-middle =\n .aria-label = Bottom middle \u2014 resize\npdfjs-editor-resizer-bottom-left =\n .aria-label = Bottom left corner \u2014 resize\npdfjs-editor-resizer-middle-left =\n .aria-label = Middle left \u2014 resize\npdfjs-editor-highlight-colorpicker-label = Highlight color\npdfjs-editor-colorpicker-button =\n .title = Change color\npdfjs-editor-colorpicker-dropdown =\n .aria-label = Color choices\npdfjs-editor-colorpicker-yellow =\n .title = Yellow\npdfjs-editor-colorpicker-green =\n .title = Green\npdfjs-editor-colorpicker-blue =\n .title = Blue\npdfjs-editor-colorpicker-pink =\n .title = Pink\npdfjs-editor-colorpicker-red =\n .title = Red\npdfjs-editor-highlight-show-all-button-label = Show all\npdfjs-editor-highlight-show-all-button =\n .title = Show all\npdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)\npdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)\npdfjs-editor-new-alt-text-textarea =\n .placeholder = Write your description here\u2026\npdfjs-editor-new-alt-text-description = Short description for people who can\u2019t see the image or when the image doesn\u2019t load.\npdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.\npdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more\npdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically\npdfjs-editor-new-alt-text-not-now-button = Not now\npdfjs-editor-new-alt-text-error-title = Couldn\u2019t create alt text automatically\npdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.\npdfjs-editor-new-alt-text-error-close-button = Close\npdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\n .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\npdfjs-editor-new-alt-text-added-button =\n .aria-label = Alt text added\npdfjs-editor-new-alt-text-added-button-label = Alt text added\npdfjs-editor-new-alt-text-missing-button =\n .aria-label = Missing alt text\npdfjs-editor-new-alt-text-missing-button-label = Missing alt text\npdfjs-editor-new-alt-text-to-review-button =\n .aria-label = Review alt text\npdfjs-editor-new-alt-text-to-review-button-label = Review alt text\npdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }\npdfjs-image-alt-text-settings-button =\n .title = Image alt text settings\npdfjs-image-alt-text-settings-button-label = Image alt text settings\npdfjs-editor-alt-text-settings-dialog-label = Image alt text settings\npdfjs-editor-alt-text-settings-automatic-title = Automatic alt text\npdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically\npdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who can\u2019t see the image or when the image doesn\u2019t load.\npdfjs-editor-alt-text-settings-download-model-label = Alt text AI model ({ $totalSize } MB)\npdfjs-editor-alt-text-settings-ai-model-description = Runs locally on your device so your data stays private. Required for automatic alt text.\npdfjs-editor-alt-text-settings-delete-model-button = Delete\npdfjs-editor-alt-text-settings-download-model-button = Download\npdfjs-editor-alt-text-settings-downloading-model-button = Downloading\u2026\npdfjs-editor-alt-text-settings-editor-title = Alt text editor\npdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image\npdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.\npdfjs-editor-alt-text-settings-close-button = Close\npdfjs-editor-highlight-added-alert = Highlight added\npdfjs-editor-freetext-added-alert = Text added\npdfjs-editor-ink-added-alert = Drawing added\npdfjs-editor-stamp-added-alert = Image added\npdfjs-editor-signature-added-alert = Signature added\npdfjs-editor-undo-bar-message-highlight = Highlight removed\npdfjs-editor-undo-bar-message-freetext = Text removed\npdfjs-editor-undo-bar-message-ink = Drawing removed\npdfjs-editor-undo-bar-message-stamp = Image removed\npdfjs-editor-undo-bar-message-signature = Signature removed\npdfjs-editor-undo-bar-message-multiple =\n { $count ->\n [one] { $count } annotation removed\n *[other] { $count } annotations removed\n }\npdfjs-editor-undo-bar-undo-button =\n .title = Undo\npdfjs-editor-undo-bar-undo-button-label = Undo\npdfjs-editor-undo-bar-close-button =\n .title = Close\npdfjs-editor-undo-bar-close-button-label = Close\npdfjs-editor-add-signature-dialog-label = This modal allows the user to create a signature to add to a PDF document. The user can edit the name (which also serves as the alt text), and optionally save the signature for repeated use.\npdfjs-editor-add-signature-dialog-title = Add a signature\npdfjs-editor-add-signature-type-button = Type\n .title = Type\npdfjs-editor-add-signature-draw-button = Draw\n .title = Draw\npdfjs-editor-add-signature-image-button = Image\n .title = Image\npdfjs-editor-add-signature-type-input =\n .aria-label = Type your signature\n .placeholder = Type your signature\npdfjs-editor-add-signature-draw-placeholder = Draw your signature\npdfjs-editor-add-signature-draw-thickness-range-label = Thickness\npdfjs-editor-add-signature-draw-thickness-range =\n .title = Drawing thickness: { $thickness }\npdfjs-editor-add-signature-image-placeholder = Drag a file here to upload\npdfjs-editor-add-signature-image-browse-link =\n { PLATFORM() ->\n [macos] Or choose image files\n *[other] Or browse image files\n }\npdfjs-editor-add-signature-description-label = Description (alt text)\npdfjs-editor-add-signature-description-input =\n .title = Description (alt text)\npdfjs-editor-add-signature-description-default-when-drawing = Signature\npdfjs-editor-add-signature-clear-button-label = Clear signature\npdfjs-editor-add-signature-clear-button =\n .title = Clear signature\npdfjs-editor-add-signature-save-checkbox = Save signature\npdfjs-editor-add-signature-save-warning-message = You\u2019ve reached the limit of 5 saved signatures. Remove one to save more.\npdfjs-editor-add-signature-image-upload-error-title = Couldn\u2019t upload image\npdfjs-editor-add-signature-image-upload-error-description = Check your network connection or try another image.\npdfjs-editor-add-signature-image-no-data-error-title = Can\u2019t convert this image into a signature\npdfjs-editor-add-signature-image-no-data-error-description = Please try uploading a different image.\npdfjs-editor-add-signature-error-close-button = Close\npdfjs-editor-add-signature-cancel-button = Cancel\npdfjs-editor-add-signature-add-button = Add\npdfjs-editor-delete-signature-button1 =\n .title = Remove saved signature\npdfjs-editor-delete-signature-button-label1 = Remove saved signature\npdfjs-editor-add-signature-edit-button-label = Edit description\npdfjs-editor-edit-signature-dialog-title = Edit description\npdfjs-editor-edit-signature-update-button = Update\npdfjs-show-comment-button =\n .title = Show comment\npdfjs-editor-edit-comment-popup-button-label = Edit comment\npdfjs-editor-edit-comment-popup-button =\n .title = Edit comment\npdfjs-editor-delete-comment-popup-button-label = Remove comment\npdfjs-editor-delete-comment-popup-button =\n .title = Remove comment\npdfjs-editor-edit-comment-dialog-title-when-editing = Edit comment\npdfjs-editor-edit-comment-dialog-save-button-when-editing = Update\npdfjs-editor-edit-comment-dialog-title-when-adding = Add comment\npdfjs-editor-edit-comment-dialog-save-button-when-adding = Add\npdfjs-editor-edit-comment-dialog-text-input =\n .placeholder = Start typing\u2026\npdfjs-editor-edit-comment-dialog-cancel-button = Cancel\npdfjs-editor-edit-comment-button =\n .title = Edit comment";
3148
3158
  return createBundle(lang, text);
3149
3159
  }
3150
3160
  }
@@ -4426,127 +4436,23 @@ class CaretBrowsingMode {
4426
4436
 
4427
4437
 
4428
4438
  class CommentManager {
4429
- #actions;
4430
- #currentEditor;
4431
4439
  #dialog;
4432
- #deleteMenuItem;
4433
- #editMenuItem;
4434
- #overlayManager;
4435
- #previousText = "";
4436
- #commentText = "";
4437
- #menu;
4438
- #textInput;
4439
- #textView;
4440
- #saveButton;
4440
+ #popup;
4441
4441
  #sidebar;
4442
- #uiManager;
4443
- #prevDragX = Infinity;
4444
- #prevDragY = Infinity;
4445
- #dialogX = 0;
4446
- #dialogY = 0;
4447
- #menuAC = null;
4448
- constructor({
4449
- dialog,
4450
- toolbar,
4451
- actions,
4452
- menu,
4453
- editMenuItem,
4454
- deleteMenuItem,
4455
- closeButton,
4456
- textInput,
4457
- textView,
4458
- cancelButton,
4459
- saveButton
4460
- }, sidebar, eventBus, linkService, overlayManager) {
4461
- this.#actions = actions;
4462
- this.#dialog = dialog;
4463
- this.#editMenuItem = editMenuItem;
4464
- this.#deleteMenuItem = deleteMenuItem;
4465
- this.#menu = menu;
4466
- this.#sidebar = new CommentSidebar(sidebar, eventBus, linkService);
4467
- this.#textInput = textInput;
4468
- this.#textView = textView;
4469
- this.#overlayManager = overlayManager;
4470
- this.#saveButton = saveButton;
4471
- const finishBound = this.#finish.bind(this);
4472
- dialog.addEventListener("close", finishBound);
4473
- dialog.addEventListener("contextmenu", e => {
4474
- if (e.target !== this.#textInput) {
4475
- e.preventDefault();
4476
- }
4477
- });
4478
- cancelButton.addEventListener("click", finishBound);
4479
- closeButton.addEventListener("click", finishBound);
4480
- saveButton.addEventListener("click", this.#save.bind(this));
4481
- this.#makeMenu();
4482
- editMenuItem.addEventListener("click", () => {
4483
- this.#closeMenu();
4484
- this.#edit();
4485
- });
4486
- deleteMenuItem.addEventListener("click", () => {
4487
- this.#closeMenu();
4488
- this.#textInput.value = "";
4489
- this.#currentEditor.comment = null;
4490
- this.#save();
4491
- });
4492
- textInput.addEventListener("input", () => {
4493
- saveButton.disabled = textInput.value === this.#previousText;
4494
- this.#deleteMenuItem.disabled = textInput.value === "";
4495
- });
4496
- textView.addEventListener("dblclick", () => {
4497
- this.#edit();
4498
- });
4499
- let pointerMoveAC;
4500
- const cancelDrag = () => {
4501
- this.#prevDragX = this.#prevDragY = Infinity;
4502
- this.#dialog.classList.remove("dragging");
4503
- pointerMoveAC?.abort();
4504
- pointerMoveAC = null;
4505
- };
4506
- toolbar.addEventListener("pointerdown", e => {
4507
- const {
4508
- target,
4509
- clientX,
4510
- clientY
4511
- } = e;
4512
- if (target !== toolbar) {
4513
- return;
4514
- }
4515
- this.#closeMenu();
4516
- this.#prevDragX = clientX;
4517
- this.#prevDragY = clientY;
4518
- pointerMoveAC = new AbortController();
4519
- const {
4520
- signal
4521
- } = pointerMoveAC;
4522
- dialog.classList.add("dragging");
4523
- window.addEventListener("pointermove", ev => {
4524
- if (this.#prevDragX !== Infinity) {
4525
- const {
4526
- clientX: x,
4527
- clientY: y
4528
- } = ev;
4529
- this.#setPosition(this.#dialogX + x - this.#prevDragX, this.#dialogY + y - this.#prevDragY);
4530
- this.#prevDragX = x;
4531
- this.#prevDragY = y;
4532
- stopEvent(ev);
4533
- }
4534
- }, {
4535
- signal
4536
- });
4537
- window.addEventListener("blur", cancelDrag, {
4538
- signal
4539
- });
4540
- stopEvent(e);
4541
- });
4542
- dialog.addEventListener("pointerup", e => {
4543
- if (this.#prevDragX === Infinity) {
4544
- return;
4545
- }
4546
- cancelDrag();
4547
- stopEvent(e);
4442
+ static #hasForcedColors = null;
4443
+ constructor(commentDialog, sidebar, eventBus, linkService, overlayManager, ltr, hasForcedColors) {
4444
+ const dateFormat = new Intl.DateTimeFormat(undefined, {
4445
+ dateStyle: "long"
4548
4446
  });
4549
- overlayManager.register(dialog);
4447
+ this.dialogElement = commentDialog.dialog;
4448
+ this.#dialog = new CommentDialog(commentDialog, overlayManager, eventBus, ltr);
4449
+ this.#popup = new CommentPopup(eventBus, dateFormat, ltr, this.dialogElement);
4450
+ this.#sidebar = new CommentSidebar(sidebar, eventBus, linkService, this.#popup, dateFormat, ltr);
4451
+ this.#popup.sidebar = this.#sidebar;
4452
+ CommentManager.#hasForcedColors = hasForcedColors;
4453
+ }
4454
+ setSidebarUiManager(uiManager) {
4455
+ this.#sidebar.setUIManager(uiManager);
4550
4456
  }
4551
4457
  showSidebar(annotations) {
4552
4458
  this.#sidebar.show(annotations);
@@ -4563,247 +4469,91 @@ class CommentManager {
4563
4469
  addComment(annotation) {
4564
4470
  this.#sidebar.addComment(annotation);
4565
4471
  }
4566
- #closeMenu() {
4567
- if (!this.#menuAC) {
4568
- return;
4569
- }
4570
- const menu = this.#menu;
4571
- menu.classList.toggle("hidden", true);
4572
- this.#actions.ariaExpanded = "false";
4573
- this.#menuAC.abort();
4574
- this.#menuAC = null;
4575
- if (menu.contains(document.activeElement)) {
4576
- setTimeout(() => {
4577
- if (!this.#dialog.contains(document.activeElement)) {
4578
- this.#actions.focus();
4579
- }
4580
- }, 0);
4581
- }
4582
- }
4583
- #renderActionsButton(visible) {
4584
- this.#actions.classList.toggle("hidden", !visible);
4585
- }
4586
- #makeMenu() {
4587
- this.#actions.addEventListener("click", e => {
4588
- const closeMenu = this.#closeMenu.bind(this);
4589
- if (this.#menuAC) {
4590
- closeMenu();
4591
- return;
4592
- }
4593
- const menu = this.#menu;
4594
- menu.classList.toggle("hidden", false);
4595
- this.#actions.ariaExpanded = "true";
4596
- this.#menuAC = new AbortController();
4597
- const {
4598
- signal
4599
- } = this.#menuAC;
4600
- window.addEventListener("pointerdown", ({
4601
- target
4602
- }) => {
4603
- if (target !== this.#actions && !menu.contains(target)) {
4604
- closeMenu();
4605
- }
4606
- }, {
4607
- signal
4608
- });
4609
- window.addEventListener("blur", closeMenu, {
4610
- signal
4611
- });
4612
- this.#actions.addEventListener("keydown", ({
4613
- key
4614
- }) => {
4615
- switch (key) {
4616
- case "ArrowDown":
4617
- case "Home":
4618
- menu.firstElementChild.focus();
4619
- stopEvent(e);
4620
- break;
4621
- case "ArrowUp":
4622
- case "End":
4623
- menu.lastElementChild.focus();
4624
- stopEvent(e);
4625
- break;
4626
- case "Escape":
4627
- closeMenu();
4628
- stopEvent(e);
4629
- }
4630
- }, {
4631
- signal
4632
- });
4633
- });
4634
- const keyboardListener = e => {
4635
- const {
4636
- key,
4637
- target
4638
- } = e;
4639
- const menu = this.#menu;
4640
- switch (key) {
4641
- case "Escape":
4642
- this.#closeMenu();
4643
- stopEvent(e);
4644
- break;
4645
- case "ArrowDown":
4646
- case "Tab":
4647
- (target.nextElementSibling || menu.firstElementChild).focus();
4648
- stopEvent(e);
4649
- break;
4650
- case "ArrowUp":
4651
- case "ShiftTab":
4652
- (target.previousElementSibling || menu.lastElementChild).focus();
4653
- stopEvent(e);
4654
- break;
4655
- case "Home":
4656
- menu.firstElementChild.focus();
4657
- stopEvent(e);
4658
- break;
4659
- case "End":
4660
- menu.lastElementChild.focus();
4661
- stopEvent(e);
4662
- break;
4663
- }
4664
- };
4665
- for (const menuItem of this.#menu.children) {
4666
- if (menuItem.classList.contains("hidden")) {
4667
- continue;
4668
- }
4669
- menuItem.addEventListener("keydown", keyboardListener);
4670
- menuItem.addEventListener("contextmenu", noContextMenu);
4671
- }
4672
- this.#menu.addEventListener("contextmenu", noContextMenu);
4472
+ updateComment(annotation) {
4473
+ this.#sidebar.updateComment(annotation);
4673
4474
  }
4674
- async open(uiManager, editor, position) {
4675
- if (editor) {
4676
- this.#uiManager = uiManager;
4677
- this.#currentEditor = editor;
4678
- }
4679
- const {
4680
- comment: {
4681
- text,
4682
- color
4683
- }
4684
- } = editor;
4685
- this.#dialog.style.setProperty("--dialog-base-color", this.#lightenColor(color) || "var(--default-dialog-bg-color)");
4686
- this.#commentText = text || "";
4687
- if (!text) {
4688
- this.#renderActionsButton(false);
4689
- this.#edit();
4690
- } else {
4691
- this.#renderActionsButton(true);
4692
- this.#setText(text);
4693
- this.#textInput.classList.toggle("hidden", true);
4694
- this.#textView.classList.toggle("hidden", false);
4695
- this.#editMenuItem.disabled = this.#deleteMenuItem.disabled = false;
4475
+ toggleCommentPopup(editor, isSelected, visibility, isEditable) {
4476
+ if (isSelected) {
4477
+ this.selectComment(editor.uid);
4696
4478
  }
4697
- this.#uiManager.removeEditListeners();
4698
- this.#saveButton.disabled = true;
4699
- const x = position.right !== undefined ? position.right - this._dialogWidth : position.left;
4700
- const y = position.top;
4701
- this.#setPosition(x, y, true);
4702
- await this.#overlayManager.open(this.#dialog);
4703
- }
4704
- async #save() {
4705
- this.#currentEditor.comment = this.#textInput.value;
4706
- this.#finish();
4707
- }
4708
- get _dialogWidth() {
4709
- const dialog = this.#dialog;
4710
- const {
4711
- style
4712
- } = dialog;
4713
- style.opacity = "0";
4714
- style.display = "block";
4715
- const width = dialog.getBoundingClientRect().width;
4716
- style.opacity = style.display = "";
4717
- return shadow(this, "_dialogWidth", width);
4479
+ this.#popup.toggle(editor, isSelected, visibility, isEditable);
4718
4480
  }
4719
- #lightenColor(color) {
4720
- if (!color) {
4721
- return null;
4722
- }
4723
- const [r, g, b] = getRGB(color);
4724
- const gray = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;
4725
- const ratio = gray < 0.9 ? Math.round((0.9 - gray) * 100) : 0;
4726
- return `color-mix(in srgb, ${ratio}% white, ${color})`;
4481
+ destroyPopup() {
4482
+ this.#popup.destroy();
4727
4483
  }
4728
- #setText(text) {
4729
- const textView = this.#textView;
4730
- for (const line of text.split("\n")) {
4731
- const span = document.createElement("span");
4732
- span.textContent = line;
4733
- textView.append(span, document.createElement("br"));
4734
- }
4484
+ updatePopupColor(editor) {
4485
+ this.#popup.updateColor(editor);
4735
4486
  }
4736
- #setPosition(x, y, isInitial = false) {
4737
- this.#dialogX = x;
4738
- this.#dialogY = y;
4739
- const {
4740
- style
4741
- } = this.#dialog;
4742
- style.left = `${x}px`;
4743
- style.top = isInitial ? `calc(${y}px + var(--editor-toolbar-vert-offset))` : `${y}px`;
4487
+ showDialog(uiManager, editor, posX, posY, options) {
4488
+ return this.#dialog.open(uiManager, editor, posX, posY, options);
4744
4489
  }
4745
- #edit() {
4746
- const textInput = this.#textInput;
4747
- const textView = this.#textView;
4748
- if (textView.childElementCount > 0) {
4749
- const height = parseFloat(getComputedStyle(textView).height);
4750
- textInput.value = this.#previousText = this.#commentText;
4751
- textInput.style.height = `${height + 20}px`;
4752
- } else {
4753
- textInput.value = this.#previousText = this.#commentText;
4754
- }
4755
- textInput.classList.toggle("hidden", false);
4756
- textView.classList.toggle("hidden", true);
4757
- this.#editMenuItem.disabled = true;
4758
- setTimeout(() => textInput.focus(), 0);
4490
+ makeCommentColor(color, opacity) {
4491
+ return CommentManager._makeCommentColor(color, opacity);
4759
4492
  }
4760
- #finish() {
4761
- this.#textView.replaceChildren();
4762
- this.#textInput.value = this.#previousText = this.#commentText = "";
4763
- this.#overlayManager.closeIfActive(this.#dialog);
4764
- this.#textInput.style.height = "";
4765
- this.#uiManager?.addEditListeners();
4766
- this.#uiManager = null;
4767
- this.#currentEditor = null;
4493
+ static _makeCommentColor(color, opacity) {
4494
+ return this.#hasForcedColors ? null : findContrastColor(applyOpacity(...color, opacity ?? 1), CSSConstants.commentForegroundColor);
4768
4495
  }
4769
4496
  destroy() {
4770
- this.#uiManager = null;
4771
- this.#finish();
4497
+ this.#dialog.destroy();
4498
+ this.#sidebar.hide();
4499
+ this.#popup.destroy();
4772
4500
  }
4773
4501
  }
4774
4502
  class CommentSidebar {
4775
4503
  #annotations = null;
4504
+ #eventBus;
4776
4505
  #boundCommentClick = this.#commentClick.bind(this);
4777
4506
  #boundCommentKeydown = this.#commentKeydown.bind(this);
4778
4507
  #sidebar;
4779
4508
  #closeButton;
4780
4509
  #commentsList;
4781
4510
  #commentCount;
4511
+ #dateFormat;
4782
4512
  #sidebarTitle;
4513
+ #learnMoreUrl;
4783
4514
  #linkService;
4515
+ #popup;
4784
4516
  #elementsToAnnotations = null;
4785
4517
  #idsToElements = null;
4518
+ #uiManager = null;
4519
+ #minWidth = 0;
4520
+ #maxWidth = 0;
4521
+ #initialWidth = 0;
4522
+ #width = 0;
4523
+ #ltr;
4786
4524
  constructor({
4525
+ learnMoreUrl,
4787
4526
  sidebar,
4527
+ sidebarResizer,
4788
4528
  commentsList,
4789
4529
  commentCount,
4790
4530
  sidebarTitle,
4791
4531
  closeButton,
4792
4532
  commentToolbarButton
4793
- }, eventBus, linkService) {
4533
+ }, eventBus, linkService, popup, dateFormat, ltr) {
4794
4534
  this.#sidebar = sidebar;
4795
4535
  this.#sidebarTitle = sidebarTitle;
4796
4536
  this.#commentsList = commentsList;
4797
4537
  this.#commentCount = commentCount;
4538
+ this.#learnMoreUrl = learnMoreUrl;
4798
4539
  this.#linkService = linkService;
4799
4540
  this.#closeButton = closeButton;
4541
+ this.#popup = popup;
4542
+ this.#dateFormat = dateFormat;
4543
+ this.#ltr = ltr;
4544
+ this.#eventBus = eventBus;
4545
+ const style = window.getComputedStyle(sidebar);
4546
+ this.#minWidth = parseFloat(style.getPropertyValue("--sidebar-min-width"));
4547
+ this.#maxWidth = parseFloat(style.getPropertyValue("--sidebar-max-width"));
4548
+ this.#initialWidth = this.#width = parseFloat(style.getPropertyValue("--sidebar-width"));
4549
+ this.#makeSidebarResizable(sidebarResizer);
4800
4550
  closeButton.addEventListener("click", () => {
4801
4551
  eventBus.dispatch("switchannotationeditormode", {
4802
4552
  source: this,
4803
4553
  mode: AnnotationEditorType.NONE
4804
4554
  });
4805
4555
  });
4806
- commentToolbarButton.addEventListener("keydown", e => {
4556
+ const keyDownCallback = e => {
4807
4557
  if (e.key === "ArrowDown" || e.key === "Home" || e.key === "F6") {
4808
4558
  this.#commentsList.firstElementChild.focus();
4809
4559
  stopEvent(e);
@@ -4811,13 +4561,81 @@ class CommentSidebar {
4811
4561
  this.#commentsList.lastElementChild.focus();
4812
4562
  stopEvent(e);
4813
4563
  }
4814
- });
4564
+ };
4565
+ commentToolbarButton.addEventListener("keydown", keyDownCallback);
4566
+ sidebar.addEventListener("keydown", keyDownCallback);
4815
4567
  this.#sidebar.hidden = true;
4816
4568
  }
4569
+ #makeSidebarResizable(resizer) {
4570
+ let pointerMoveAC;
4571
+ const cancelResize = () => {
4572
+ this.#width = MathClamp(this.#width, this.#minWidth, this.#maxWidth);
4573
+ this.#sidebar.classList.remove("resizing");
4574
+ pointerMoveAC?.abort();
4575
+ pointerMoveAC = null;
4576
+ };
4577
+ resizer.addEventListener("pointerdown", e => {
4578
+ if (pointerMoveAC) {
4579
+ cancelResize();
4580
+ return;
4581
+ }
4582
+ const {
4583
+ clientX
4584
+ } = e;
4585
+ stopEvent(e);
4586
+ let prevX = clientX;
4587
+ pointerMoveAC = new AbortController();
4588
+ const {
4589
+ signal
4590
+ } = pointerMoveAC;
4591
+ const sign = this.#ltr ? -1 : 1;
4592
+ const sidebar = this.#sidebar;
4593
+ const sidebarStyle = sidebar.style;
4594
+ sidebar.classList.add("resizing");
4595
+ const parentStyle = sidebar.parentElement.style;
4596
+ parentStyle.minWidth = 0;
4597
+ window.addEventListener("contextmenu", noContextMenu, {
4598
+ signal
4599
+ });
4600
+ window.addEventListener("pointermove", ev => {
4601
+ if (!pointerMoveAC) {
4602
+ return;
4603
+ }
4604
+ stopEvent(ev);
4605
+ const {
4606
+ clientX: x
4607
+ } = ev;
4608
+ const newWidth = this.#width += sign * (x - prevX);
4609
+ prevX = x;
4610
+ if (newWidth > this.#maxWidth || newWidth < this.#minWidth) {
4611
+ return;
4612
+ }
4613
+ sidebarStyle.width = `${newWidth.toFixed(3)}px`;
4614
+ parentStyle.insetInlineStart = `${(this.#initialWidth - newWidth).toFixed(3)}px`;
4615
+ }, {
4616
+ signal,
4617
+ capture: true
4618
+ });
4619
+ window.addEventListener("blur", cancelResize, {
4620
+ signal
4621
+ });
4622
+ window.addEventListener("pointerup", ev => {
4623
+ if (pointerMoveAC) {
4624
+ cancelResize();
4625
+ stopEvent(ev);
4626
+ }
4627
+ }, {
4628
+ signal
4629
+ });
4630
+ });
4631
+ }
4632
+ setUIManager(uiManager) {
4633
+ this.#uiManager = uiManager;
4634
+ }
4817
4635
  show(annotations) {
4818
4636
  this.#elementsToAnnotations = new WeakMap();
4819
4637
  this.#idsToElements = new Map();
4820
- this.#annotations = annotations = annotations.filter(a => a.popupRef && a.contentsObj?.str);
4638
+ this.#annotations = annotations;
4821
4639
  annotations.sort(this.#sortComments.bind(this));
4822
4640
  if (annotations.length !== 0) {
4823
4641
  const fragment = document.createDocumentFragment();
@@ -4830,6 +4648,15 @@ class CommentSidebar {
4830
4648
  this.#setCommentsCount();
4831
4649
  }
4832
4650
  this.#sidebar.hidden = false;
4651
+ this.#eventBus.dispatch("reporttelemetry", {
4652
+ source: this,
4653
+ details: {
4654
+ type: "commentSidebar",
4655
+ data: {
4656
+ numberOfAnnotations: annotations.length
4657
+ }
4658
+ }
4659
+ });
4833
4660
  }
4834
4661
  hide() {
4835
4662
  this.#sidebar.hidden = true;
@@ -4839,7 +4666,7 @@ class CommentSidebar {
4839
4666
  this.#annotations = null;
4840
4667
  }
4841
4668
  removeComments(ids) {
4842
- if (ids.length === 0) {
4669
+ if (ids.length === 0 || !this.#idsToElements) {
4843
4670
  return;
4844
4671
  }
4845
4672
  if (new Set(this.#idsToElements.keys()).difference(new Set(ids)).size === 0) {
@@ -4860,11 +4687,46 @@ class CommentSidebar {
4860
4687
  el.classList.toggle("selected", el === element);
4861
4688
  }
4862
4689
  }
4863
- #removeComment(id) {
4690
+ updateComment(annotation) {
4691
+ if (!this.#idsToElements) {
4692
+ return;
4693
+ }
4694
+ const {
4695
+ id,
4696
+ creationDate,
4697
+ modificationDate,
4698
+ richText,
4699
+ contentsObj,
4700
+ popupRef
4701
+ } = annotation;
4702
+ if (!popupRef || !richText && !contentsObj?.str) {
4703
+ this.#removeComment(id);
4704
+ }
4864
4705
  const element = this.#idsToElements.get(id);
4865
4706
  if (!element) {
4866
4707
  return;
4867
4708
  }
4709
+ const prevAnnotation = this.#elementsToAnnotations.get(element);
4710
+ let index = binarySearchFirstItem(this.#annotations, a => this.#sortComments(a, prevAnnotation) >= 0);
4711
+ if (index >= this.#annotations.length) {
4712
+ return;
4713
+ }
4714
+ this.#setDate(element.firstChild, modificationDate || creationDate);
4715
+ this.#setText(element.lastChild, richText, contentsObj);
4716
+ this.#annotations.splice(index, 1);
4717
+ index = binarySearchFirstItem(this.#annotations, a => this.#sortComments(a, annotation) >= 0);
4718
+ this.#annotations.splice(index, 0, annotation);
4719
+ if (index >= this.#commentsList.children.length) {
4720
+ this.#commentsList.append(element);
4721
+ } else {
4722
+ this.#commentsList.insertBefore(element, this.#commentsList.children[index]);
4723
+ }
4724
+ }
4725
+ #removeComment(id) {
4726
+ const element = this.#idsToElements?.get(id);
4727
+ if (!element) {
4728
+ return;
4729
+ }
4868
4730
  const annotation = this.#elementsToAnnotations.get(element);
4869
4731
  const index = binarySearchFirstItem(this.#annotations, a => this.#sortComments(a, annotation) >= 0);
4870
4732
  if (index >= this.#annotations.length) {
@@ -4883,13 +4745,23 @@ class CommentSidebar {
4883
4745
  this.#setCommentsCount();
4884
4746
  }
4885
4747
  selectComment(element, id = null) {
4748
+ if (!this.#idsToElements) {
4749
+ return;
4750
+ }
4751
+ const hasNoElement = !element;
4886
4752
  element ||= this.#idsToElements.get(id);
4887
4753
  for (const el of this.#commentsList.children) {
4888
4754
  el.classList.toggle("selected", el === element);
4889
4755
  }
4756
+ if (hasNoElement) {
4757
+ element?.scrollIntoView({
4758
+ behavior: "instant",
4759
+ block: "center"
4760
+ });
4761
+ }
4890
4762
  }
4891
4763
  addComment(annotation) {
4892
- if (this.#idsToElements.has(annotation.id)) {
4764
+ if (this.#idsToElements?.has(annotation.id)) {
4893
4765
  return;
4894
4766
  }
4895
4767
  const {
@@ -4906,133 +4778,684 @@ class CommentSidebar {
4906
4778
  this.#setCommentsCount();
4907
4779
  return;
4908
4780
  }
4909
- const index = binarySearchFirstItem(this.#annotations, a => this.#sortComments(a, annotation) >= 0);
4910
- this.#annotations.splice(index, 0, annotation);
4911
- if (index >= this.#commentsList.children.length) {
4912
- this.#commentsList.append(commentItem);
4913
- } else {
4914
- this.#commentsList.insertBefore(commentItem, this.#commentsList.children[index]);
4915
- }
4916
- this.#setCommentsCount();
4781
+ const index = binarySearchFirstItem(this.#annotations, a => this.#sortComments(a, annotation) >= 0);
4782
+ this.#annotations.splice(index, 0, annotation);
4783
+ if (index >= this.#commentsList.children.length) {
4784
+ this.#commentsList.append(commentItem);
4785
+ } else {
4786
+ this.#commentsList.insertBefore(commentItem, this.#commentsList.children[index]);
4787
+ }
4788
+ this.#setCommentsCount();
4789
+ }
4790
+ #setCommentsCount(container = this.#commentsList) {
4791
+ const count = this.#idsToElements.size;
4792
+ this.#sidebarTitle.setAttribute("data-l10n-args", JSON.stringify({
4793
+ count
4794
+ }));
4795
+ this.#commentCount.textContent = count;
4796
+ if (count === 0) {
4797
+ container.append(this.#createZeroCommentElement());
4798
+ }
4799
+ }
4800
+ #createZeroCommentElement() {
4801
+ const commentItem = document.createElement("li");
4802
+ commentItem.classList.add("sidebarComment", "noComments");
4803
+ const textDiv = document.createElement("div");
4804
+ textDiv.className = "sidebarCommentText";
4805
+ textDiv.setAttribute("data-l10n-id", "pdfjs-editor-comments-sidebar-no-comments1");
4806
+ commentItem.append(textDiv);
4807
+ if (this.#learnMoreUrl) {
4808
+ const a = document.createElement("a");
4809
+ a.setAttribute("data-l10n-id", "pdfjs-editor-comments-sidebar-no-comments-link");
4810
+ a.href = this.#learnMoreUrl;
4811
+ a.target = "_blank";
4812
+ a.rel = "noopener noreferrer";
4813
+ commentItem.append(a);
4814
+ }
4815
+ return commentItem;
4816
+ }
4817
+ #setDate(element, date) {
4818
+ date = PDFDateString.toDateObject(date);
4819
+ element.dateTime = date.toISOString();
4820
+ element.textContent = this.#dateFormat.format(date);
4821
+ }
4822
+ #setText(element, richText, contentsObj) {
4823
+ element.replaceChildren();
4824
+ const html = richText?.str && (!contentsObj?.str || richText.str === contentsObj.str) ? richText.html : contentsObj?.str;
4825
+ renderRichText({
4826
+ html,
4827
+ dir: contentsObj?.dir || "auto",
4828
+ className: "richText"
4829
+ }, element);
4830
+ }
4831
+ #createCommentElement(annotation) {
4832
+ const {
4833
+ id,
4834
+ creationDate,
4835
+ modificationDate,
4836
+ richText,
4837
+ contentsObj,
4838
+ color,
4839
+ opacity
4840
+ } = annotation;
4841
+ const commentItem = document.createElement("li");
4842
+ commentItem.role = "button";
4843
+ commentItem.className = "sidebarComment";
4844
+ commentItem.tabIndex = -1;
4845
+ commentItem.style.backgroundColor = color && CommentManager._makeCommentColor(color, opacity) || "";
4846
+ const dateDiv = document.createElement("time");
4847
+ this.#setDate(dateDiv, modificationDate || creationDate);
4848
+ const textDiv = document.createElement("div");
4849
+ textDiv.className = "sidebarCommentText";
4850
+ this.#setText(textDiv, richText, contentsObj);
4851
+ commentItem.append(dateDiv, textDiv);
4852
+ commentItem.addEventListener("click", this.#boundCommentClick);
4853
+ commentItem.addEventListener("keydown", this.#boundCommentKeydown);
4854
+ this.#elementsToAnnotations.set(commentItem, annotation);
4855
+ this.#idsToElements.set(id, commentItem);
4856
+ return commentItem;
4857
+ }
4858
+ async #commentClick({
4859
+ currentTarget
4860
+ }) {
4861
+ if (currentTarget.classList.contains("selected")) {
4862
+ currentTarget.classList.remove("selected");
4863
+ this.#popup._hide();
4864
+ return;
4865
+ }
4866
+ const annotation = this.#elementsToAnnotations.get(currentTarget);
4867
+ if (!annotation) {
4868
+ return;
4869
+ }
4870
+ this.#popup._hide();
4871
+ const {
4872
+ id,
4873
+ pageIndex,
4874
+ rect
4875
+ } = annotation;
4876
+ const pageNumber = pageIndex + 1;
4877
+ const pageVisiblePromise = this.#uiManager?.waitForEditorsRendered(pageNumber);
4878
+ this.#linkService?.goToXY(pageNumber, rect[0], rect[3], {
4879
+ center: "both"
4880
+ });
4881
+ this.selectComment(currentTarget);
4882
+ await pageVisiblePromise;
4883
+ this.#uiManager?.selectComment(pageIndex, id);
4884
+ }
4885
+ #commentKeydown(e) {
4886
+ const {
4887
+ key,
4888
+ currentTarget
4889
+ } = e;
4890
+ switch (key) {
4891
+ case "ArrowDown":
4892
+ (currentTarget.nextElementSibling || this.#commentsList.firstElementChild).focus();
4893
+ stopEvent(e);
4894
+ break;
4895
+ case "ArrowUp":
4896
+ (currentTarget.previousElementSibling || this.#commentsList.lastElementChild).focus();
4897
+ stopEvent(e);
4898
+ break;
4899
+ case "Home":
4900
+ this.#commentsList.firstElementChild.focus();
4901
+ stopEvent(e);
4902
+ break;
4903
+ case "End":
4904
+ this.#commentsList.lastElementChild.focus();
4905
+ stopEvent(e);
4906
+ break;
4907
+ case "Enter":
4908
+ case " ":
4909
+ this.#commentClick(e);
4910
+ stopEvent(e);
4911
+ break;
4912
+ case "ShiftTab":
4913
+ this.#closeButton.focus();
4914
+ stopEvent(e);
4915
+ break;
4916
+ }
4917
+ }
4918
+ #sortComments(a, b) {
4919
+ const dateA = PDFDateString.toDateObject(a.modificationDate || a.creationDate);
4920
+ const dateB = PDFDateString.toDateObject(b.modificationDate || b.creationDate);
4921
+ if (dateA !== dateB) {
4922
+ if (dateA !== null && dateB !== null) {
4923
+ return dateB - dateA;
4924
+ }
4925
+ return dateA !== null ? -1 : 1;
4926
+ }
4927
+ if (a.pageIndex !== b.pageIndex) {
4928
+ return a.pageIndex - b.pageIndex;
4929
+ }
4930
+ if (a.rect[3] !== b.rect[3]) {
4931
+ return b.rect[3] - a.rect[3];
4932
+ }
4933
+ if (a.rect[0] !== b.rect[0]) {
4934
+ return a.rect[0] - b.rect[0];
4935
+ }
4936
+ if (a.rect[1] !== b.rect[1]) {
4937
+ return b.rect[1] - a.rect[1];
4938
+ }
4939
+ if (a.rect[2] !== b.rect[2]) {
4940
+ return a.rect[2] - b.rect[2];
4941
+ }
4942
+ return a.id.localeCompare(b.id);
4943
+ }
4944
+ }
4945
+ class CommentDialog {
4946
+ #dialog;
4947
+ #editor;
4948
+ #overlayManager;
4949
+ #previousText = "";
4950
+ #commentText = "";
4951
+ #textInput;
4952
+ #title;
4953
+ #saveButton;
4954
+ #uiManager;
4955
+ #prevDragX = 0;
4956
+ #prevDragY = 0;
4957
+ #dialogX = 0;
4958
+ #dialogY = 0;
4959
+ #isLTR;
4960
+ #eventBus;
4961
+ constructor({
4962
+ dialog,
4963
+ toolbar,
4964
+ title,
4965
+ textInput,
4966
+ cancelButton,
4967
+ saveButton
4968
+ }, overlayManager, eventBus, ltr) {
4969
+ this.#dialog = dialog;
4970
+ this.#textInput = textInput;
4971
+ this.#overlayManager = overlayManager;
4972
+ this.#eventBus = eventBus;
4973
+ this.#saveButton = saveButton;
4974
+ this.#title = title;
4975
+ this.#isLTR = ltr;
4976
+ const finishBound = this.#finish.bind(this);
4977
+ dialog.addEventListener("close", finishBound);
4978
+ dialog.addEventListener("contextmenu", e => {
4979
+ if (e.target !== this.#textInput) {
4980
+ e.preventDefault();
4981
+ }
4982
+ });
4983
+ cancelButton.addEventListener("click", finishBound);
4984
+ saveButton.addEventListener("click", this.#save.bind(this));
4985
+ textInput.addEventListener("input", () => {
4986
+ saveButton.disabled = textInput.value === this.#previousText;
4987
+ });
4988
+ let pointerMoveAC;
4989
+ const cancelDrag = () => {
4990
+ dialog.classList.remove("dragging");
4991
+ pointerMoveAC?.abort();
4992
+ pointerMoveAC = null;
4993
+ };
4994
+ toolbar.addEventListener("pointerdown", e => {
4995
+ if (pointerMoveAC) {
4996
+ cancelDrag();
4997
+ return;
4998
+ }
4999
+ const {
5000
+ clientX,
5001
+ clientY
5002
+ } = e;
5003
+ stopEvent(e);
5004
+ this.#prevDragX = clientX;
5005
+ this.#prevDragY = clientY;
5006
+ pointerMoveAC = new AbortController();
5007
+ const {
5008
+ signal
5009
+ } = pointerMoveAC;
5010
+ const {
5011
+ innerHeight,
5012
+ innerWidth
5013
+ } = window;
5014
+ dialog.classList.add("dragging");
5015
+ window.addEventListener("pointermove", ev => {
5016
+ if (!pointerMoveAC) {
5017
+ return;
5018
+ }
5019
+ const {
5020
+ clientX: x,
5021
+ clientY: y
5022
+ } = ev;
5023
+ this.#setPosition(this.#dialogX + (x - this.#prevDragX) / innerWidth, this.#dialogY + (y - this.#prevDragY) / innerHeight);
5024
+ this.#prevDragX = x;
5025
+ this.#prevDragY = y;
5026
+ stopEvent(ev);
5027
+ }, {
5028
+ signal
5029
+ });
5030
+ window.addEventListener("blur", cancelDrag, {
5031
+ signal
5032
+ });
5033
+ window.addEventListener("pointerup", ev => {
5034
+ if (pointerMoveAC) {
5035
+ cancelDrag();
5036
+ stopEvent(ev);
5037
+ }
5038
+ }, {
5039
+ signal
5040
+ });
5041
+ });
5042
+ overlayManager.register(dialog);
5043
+ }
5044
+ async open(uiManager, editor, posX, posY, options) {
5045
+ if (editor) {
5046
+ this.#uiManager = uiManager;
5047
+ this.#editor = editor;
5048
+ }
5049
+ const {
5050
+ contentsObj: {
5051
+ str
5052
+ },
5053
+ color,
5054
+ opacity
5055
+ } = editor.getData();
5056
+ const {
5057
+ style: dialogStyle
5058
+ } = this.#dialog;
5059
+ if (color) {
5060
+ dialogStyle.backgroundColor = CommentManager._makeCommentColor(color, opacity);
5061
+ dialogStyle.borderColor = Util.makeHexColor(...color);
5062
+ } else {
5063
+ dialogStyle.backgroundColor = dialogStyle.borderColor = "";
5064
+ }
5065
+ this.#commentText = str || "";
5066
+ const textInput = this.#textInput;
5067
+ textInput.value = this.#previousText = this.#commentText;
5068
+ if (str) {
5069
+ this.#title.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-dialog-title-when-editing");
5070
+ this.#saveButton.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-dialog-save-button-when-editing");
5071
+ } else {
5072
+ this.#title.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-dialog-title-when-adding");
5073
+ this.#saveButton.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-dialog-save-button-when-adding");
5074
+ }
5075
+ if (options?.height) {
5076
+ textInput.style.height = `${options.height}px`;
5077
+ }
5078
+ this.#uiManager?.removeEditListeners();
5079
+ this.#saveButton.disabled = true;
5080
+ const parentDimensions = options?.parentDimensions;
5081
+ const {
5082
+ innerHeight,
5083
+ innerWidth
5084
+ } = window;
5085
+ if (editor.hasDefaultPopupPosition()) {
5086
+ const {
5087
+ dialogWidth,
5088
+ dialogHeight
5089
+ } = this._dialogDimensions;
5090
+ if (parentDimensions) {
5091
+ if (this.#isLTR && posX + dialogWidth > Math.min(parentDimensions.x + parentDimensions.width, innerWidth)) {
5092
+ const buttonWidth = this.#editor.commentButtonWidth;
5093
+ posX -= dialogWidth - buttonWidth * parentDimensions.width;
5094
+ } else if (!this.#isLTR) {
5095
+ const buttonWidth = this.#editor.commentButtonWidth * parentDimensions.width;
5096
+ if (posX - dialogWidth < Math.max(0, parentDimensions.x)) {
5097
+ posX = Math.max(0, posX);
5098
+ } else {
5099
+ posX -= dialogWidth - buttonWidth;
5100
+ }
5101
+ }
5102
+ }
5103
+ const height = Math.max(dialogHeight, options?.height || 0);
5104
+ if (posY + height > innerHeight) {
5105
+ posY = innerHeight - height;
5106
+ }
5107
+ if (posY < 0) {
5108
+ posY = 0;
5109
+ }
5110
+ }
5111
+ posX = MathClamp(posX / innerWidth, 0, 1);
5112
+ posY = MathClamp(posY / innerHeight, 0, 1);
5113
+ this.#setPosition(posX, posY);
5114
+ await this.#overlayManager.open(this.#dialog);
5115
+ textInput.focus();
5116
+ }
5117
+ async #save() {
5118
+ this.#editor.comment = this.#textInput.value;
5119
+ this.#finish();
5120
+ }
5121
+ get _dialogDimensions() {
5122
+ const dialog = this.#dialog;
5123
+ const {
5124
+ style
5125
+ } = dialog;
5126
+ style.opacity = "0";
5127
+ style.display = "block";
5128
+ const {
5129
+ width,
5130
+ height
5131
+ } = dialog.getBoundingClientRect();
5132
+ style.opacity = style.display = "";
5133
+ return shadow(this, "_dialogDimensions", {
5134
+ dialogWidth: width,
5135
+ dialogHeight: height
5136
+ });
5137
+ }
5138
+ #setPosition(x, y) {
5139
+ this.#dialogX = x;
5140
+ this.#dialogY = y;
5141
+ const {
5142
+ style
5143
+ } = this.#dialog;
5144
+ style.left = `${100 * x}%`;
5145
+ style.top = `${100 * y}%`;
5146
+ }
5147
+ #finish() {
5148
+ if (!this.#editor) {
5149
+ return;
5150
+ }
5151
+ const edited = this.#textInput.value !== this.#commentText;
5152
+ this.#eventBus.dispatch("reporttelemetry", {
5153
+ source: this,
5154
+ details: {
5155
+ type: "comment",
5156
+ data: {
5157
+ edited
5158
+ }
5159
+ }
5160
+ });
5161
+ this.#editor?.focusCommentButton();
5162
+ this.#editor = null;
5163
+ this.#textInput.value = this.#previousText = this.#commentText = "";
5164
+ this.#overlayManager.closeIfActive(this.#dialog);
5165
+ this.#textInput.style.height = "";
5166
+ this.#uiManager?.addEditListeners();
5167
+ this.#uiManager = null;
4917
5168
  }
4918
- #setCommentsCount(container = this.#commentsList) {
4919
- const count = this.#idsToElements.size;
4920
- this.#sidebarTitle.setAttribute("data-l10n-args", JSON.stringify({
4921
- count
4922
- }));
4923
- this.#commentCount.textContent = count;
4924
- if (count === 0) {
4925
- container.append(this.#createZeroCommentElement());
4926
- }
5169
+ destroy() {
5170
+ this.#uiManager = null;
5171
+ this.#editor = null;
5172
+ this.#finish();
4927
5173
  }
4928
- #createZeroCommentElement() {
4929
- const commentItem = document.createElement("li");
4930
- commentItem.classList.add("sidebarComment", "noComments");
4931
- commentItem.role = "button";
4932
- const textDiv = document.createElement("div");
4933
- textDiv.className = "sidebarCommentText";
4934
- textDiv.setAttribute("data-l10n-id", "pdfjs-editor-comments-sidebar-no-comments");
4935
- commentItem.addEventListener("keydown", this.#boundCommentKeydown);
4936
- commentItem.append(textDiv);
4937
- return commentItem;
5174
+ }
5175
+ class CommentPopup {
5176
+ #buttonsContainer = null;
5177
+ #eventBus;
5178
+ #commentDialog;
5179
+ #dateFormat;
5180
+ #editor = null;
5181
+ #isLTR;
5182
+ #container = null;
5183
+ #text = null;
5184
+ #time = null;
5185
+ #prevDragX = 0;
5186
+ #prevDragY = 0;
5187
+ #posX = 0;
5188
+ #posY = 0;
5189
+ #previousFocusedElement = null;
5190
+ #selected = false;
5191
+ #visible = false;
5192
+ constructor(eventBus, dateFormat, ltr, commentDialog) {
5193
+ this.#eventBus = eventBus;
5194
+ this.#dateFormat = dateFormat;
5195
+ this.#isLTR = ltr;
5196
+ this.#commentDialog = commentDialog;
5197
+ this.sidebar = null;
4938
5198
  }
4939
- #createCommentElement(annotation) {
5199
+ get _popupWidth() {
5200
+ const container = this.#createPopup();
4940
5201
  const {
4941
- creationDate,
4942
- modificationDate,
4943
- contentsObj: {
4944
- str: text
5202
+ style
5203
+ } = container;
5204
+ style.opacity = "0";
5205
+ style.display = "block";
5206
+ document.body.append(container);
5207
+ const width = container.getBoundingClientRect().width;
5208
+ container.remove();
5209
+ style.opacity = style.display = "";
5210
+ return shadow(this, "_popupWidth", width);
5211
+ }
5212
+ #createPopup() {
5213
+ if (this.#container) {
5214
+ return this.#container;
5215
+ }
5216
+ const container = this.#container = document.createElement("div");
5217
+ container.className = "commentPopup";
5218
+ container.id = "commentPopup";
5219
+ container.tabIndex = -1;
5220
+ container.role = "dialog";
5221
+ container.ariaModal = "false";
5222
+ container.addEventListener("contextmenu", noContextMenu);
5223
+ container.addEventListener("keydown", e => {
5224
+ if (e.key === "Escape") {
5225
+ this.toggle(this.#editor, true, false);
5226
+ this.#previousFocusedElement?.focus();
5227
+ stopEvent(e);
4945
5228
  }
4946
- } = annotation;
4947
- const commentItem = document.createElement("li");
4948
- commentItem.role = "button";
4949
- commentItem.className = "sidebarComment";
4950
- commentItem.tabIndex = -1;
4951
- const dateDiv = document.createElement("time");
4952
- const date = PDFDateString.toDateObject(modificationDate || creationDate);
4953
- dateDiv.dateTime = date.toISOString();
4954
- const dateFormat = new Intl.DateTimeFormat(undefined, {
4955
- dateStyle: "long"
4956
5229
  });
4957
- dateDiv.textContent = dateFormat.format(date);
4958
- const textDiv = document.createElement("div");
4959
- textDiv.className = "sidebarCommentText";
4960
- textDiv.textContent = text;
4961
- commentItem.append(dateDiv, textDiv);
4962
- commentItem.addEventListener("click", this.#boundCommentClick);
4963
- commentItem.addEventListener("keydown", this.#boundCommentKeydown);
4964
- this.#elementsToAnnotations.set(commentItem, annotation);
4965
- this.#idsToElements.set(annotation.id, commentItem);
4966
- return commentItem;
5230
+ container.addEventListener("click", () => {
5231
+ container.focus();
5232
+ });
5233
+ const top = document.createElement("div");
5234
+ top.className = "commentPopupTop";
5235
+ const time = this.#time = document.createElement("time");
5236
+ time.className = "commentPopupTime";
5237
+ const buttons = this.#buttonsContainer = document.createElement("div");
5238
+ buttons.className = "commentPopupButtons";
5239
+ const edit = document.createElement("button");
5240
+ edit.classList.add("commentPopupEdit", "toolbarButton");
5241
+ edit.tabIndex = 0;
5242
+ edit.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-popup-button");
5243
+ edit.ariaHasPopup = "dialog";
5244
+ edit.ariaControlsElements = [this.#commentDialog];
5245
+ const editLabel = document.createElement("span");
5246
+ editLabel.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-popup-button-label");
5247
+ edit.append(editLabel);
5248
+ edit.addEventListener("click", () => {
5249
+ const editor = this.#editor;
5250
+ const height = parseFloat(getComputedStyle(this.#text).height);
5251
+ this.toggle(editor, true, false);
5252
+ editor.editComment({
5253
+ height
5254
+ });
5255
+ });
5256
+ edit.addEventListener("contextmenu", noContextMenu);
5257
+ const del = document.createElement("button");
5258
+ del.classList.add("commentPopupDelete", "toolbarButton");
5259
+ del.tabIndex = 0;
5260
+ del.setAttribute("data-l10n-id", "pdfjs-editor-delete-comment-popup-button");
5261
+ const delLabel = document.createElement("span");
5262
+ delLabel.setAttribute("data-l10n-id", "pdfjs-editor-delete-comment-popup-button-label");
5263
+ del.append(delLabel);
5264
+ del.addEventListener("click", () => {
5265
+ this.#eventBus.dispatch("reporttelemetry", {
5266
+ source: this,
5267
+ details: {
5268
+ type: "comment",
5269
+ data: {
5270
+ deleted: true
5271
+ }
5272
+ }
5273
+ });
5274
+ this.#editor.comment = null;
5275
+ this.destroy();
5276
+ });
5277
+ del.addEventListener("contextmenu", noContextMenu);
5278
+ buttons.append(edit, del);
5279
+ top.append(time, buttons);
5280
+ const separator = document.createElement("hr");
5281
+ const text = this.#text = document.createElement("div");
5282
+ text.className = "commentPopupText";
5283
+ container.append(top, separator, text);
5284
+ let pointerMoveAC;
5285
+ const cancelDrag = () => {
5286
+ container.classList.remove("dragging");
5287
+ pointerMoveAC?.abort();
5288
+ pointerMoveAC = null;
5289
+ };
5290
+ top.addEventListener("pointerdown", e => {
5291
+ if (pointerMoveAC) {
5292
+ cancelDrag();
5293
+ return;
5294
+ }
5295
+ const {
5296
+ target,
5297
+ clientX,
5298
+ clientY
5299
+ } = e;
5300
+ if (buttons.contains(target)) {
5301
+ return;
5302
+ }
5303
+ stopEvent(e);
5304
+ const {
5305
+ width: parentWidth,
5306
+ height: parentHeight
5307
+ } = this.#editor.parentBoundingClientRect;
5308
+ this.#prevDragX = clientX;
5309
+ this.#prevDragY = clientY;
5310
+ pointerMoveAC = new AbortController();
5311
+ const {
5312
+ signal
5313
+ } = pointerMoveAC;
5314
+ container.classList.add("dragging");
5315
+ window.addEventListener("pointermove", ev => {
5316
+ if (!pointerMoveAC) {
5317
+ return;
5318
+ }
5319
+ const {
5320
+ clientX: x,
5321
+ clientY: y
5322
+ } = ev;
5323
+ this.#setPosition(this.#posX + (x - this.#prevDragX) / parentWidth, this.#posY + (y - this.#prevDragY) / parentHeight, false);
5324
+ this.#prevDragX = x;
5325
+ this.#prevDragY = y;
5326
+ stopEvent(ev);
5327
+ }, {
5328
+ signal
5329
+ });
5330
+ window.addEventListener("blur", cancelDrag, {
5331
+ signal
5332
+ });
5333
+ window.addEventListener("pointerup", ev => {
5334
+ if (pointerMoveAC) {
5335
+ cancelDrag();
5336
+ stopEvent(ev);
5337
+ }
5338
+ }, {
5339
+ signal
5340
+ });
5341
+ });
5342
+ return container;
4967
5343
  }
4968
- #commentClick({
4969
- currentTarget
4970
- }) {
4971
- if (currentTarget.classList.contains("selected")) {
4972
- return;
4973
- }
4974
- const annotation = this.#elementsToAnnotations.get(currentTarget);
4975
- if (!annotation) {
5344
+ updateColor(editor) {
5345
+ if (this.#editor !== editor || !this.#visible) {
4976
5346
  return;
4977
5347
  }
4978
5348
  const {
4979
- pageIndex,
4980
- rect
4981
- } = annotation;
4982
- const SPACE_ABOVE_ANNOTATION = 10;
4983
- this.#linkService?.goToXY(pageIndex + 1, rect[0], rect[3] + SPACE_ABOVE_ANNOTATION);
4984
- this.selectComment(currentTarget);
5349
+ color,
5350
+ opacity
5351
+ } = editor.getData();
5352
+ this.#container.style.backgroundColor = color && CommentManager._makeCommentColor(color, opacity) || "";
5353
+ }
5354
+ _hide(editor) {
5355
+ const container = this.#createPopup();
5356
+ container.classList.toggle("hidden", true);
5357
+ container.classList.toggle("selected", false);
5358
+ (editor || this.#editor)?.setCommentButtonStates({
5359
+ selected: false,
5360
+ hasPopup: false
5361
+ });
5362
+ this.#editor = null;
5363
+ this.#selected = false;
5364
+ this.#visible = false;
5365
+ this.#text.replaceChildren();
5366
+ this.sidebar.selectComment(null);
4985
5367
  }
4986
- #commentKeydown(e) {
4987
- const {
4988
- key,
4989
- currentTarget
4990
- } = e;
4991
- switch (key) {
4992
- case "ArrowDown":
4993
- (currentTarget.nextElementSibling || this.#commentsList.firstElementChild).focus();
4994
- stopEvent(e);
4995
- break;
4996
- case "ArrowUp":
4997
- (currentTarget.previousElementSibling || this.#commentsList.lastElementChild).focus();
4998
- stopEvent(e);
4999
- break;
5000
- case "Home":
5001
- this.#commentsList.firstElementChild.focus();
5002
- stopEvent(e);
5003
- break;
5004
- case "End":
5005
- this.#commentsList.lastElementChild.focus();
5006
- stopEvent(e);
5007
- break;
5008
- case "Enter":
5009
- case " ":
5010
- this.#commentClick(e);
5011
- stopEvent(e);
5012
- break;
5013
- case "ShiftTab":
5014
- this.#closeButton.focus();
5015
- stopEvent(e);
5016
- break;
5368
+ toggle(editor, isSelected, visibility = undefined, isEditable = true) {
5369
+ if (!editor) {
5370
+ this.destroy();
5371
+ return;
5017
5372
  }
5018
- }
5019
- #sortComments(a, b) {
5020
- if (a.pageIndex !== b.pageIndex) {
5021
- return a.pageIndex - b.pageIndex;
5373
+ if (isSelected) {
5374
+ visibility ??= this.#editor === editor ? !this.#selected || !this.#visible : true;
5375
+ } else {
5376
+ if (this.#selected) {
5377
+ return;
5378
+ }
5379
+ visibility ??= !this.#visible;
5022
5380
  }
5023
- if (a.rect[3] !== b.rect[3]) {
5024
- return b.rect[3] - a.rect[3];
5381
+ if (!visibility) {
5382
+ this._hide(editor);
5383
+ return;
5025
5384
  }
5026
- if (a.rect[0] !== b.rect[0]) {
5027
- return a.rect[0] - b.rect[0];
5385
+ this.#visible = true;
5386
+ if (this.#editor !== editor) {
5387
+ this.#editor?.setCommentButtonStates({
5388
+ selected: false,
5389
+ hasPopup: false
5390
+ });
5028
5391
  }
5029
- if (a.rect[1] !== b.rect[1]) {
5030
- return b.rect[1] - a.rect[1];
5392
+ const container = this.#createPopup();
5393
+ this.#buttonsContainer.classList.toggle("hidden", !isEditable);
5394
+ container.classList.toggle("hidden", false);
5395
+ container.classList.toggle("selected", isSelected);
5396
+ this.#selected = isSelected;
5397
+ this.#editor = editor;
5398
+ editor.setCommentButtonStates({
5399
+ selected: isSelected,
5400
+ hasPopup: true
5401
+ });
5402
+ const {
5403
+ contentsObj,
5404
+ richText,
5405
+ creationDate,
5406
+ modificationDate,
5407
+ color,
5408
+ opacity
5409
+ } = editor.getData();
5410
+ container.style.backgroundColor = color && CommentManager._makeCommentColor(color, opacity) || "";
5411
+ this.#text.replaceChildren();
5412
+ const html = richText?.str && (!contentsObj?.str || richText.str === contentsObj.str) ? richText.html : contentsObj?.str;
5413
+ if (html) {
5414
+ renderRichText({
5415
+ html,
5416
+ dir: contentsObj?.dir || "auto",
5417
+ className: "richText"
5418
+ }, this.#text);
5419
+ }
5420
+ this.#time.textContent = this.#dateFormat.format(PDFDateString.toDateObject(modificationDate || creationDate));
5421
+ this.#setPosition(...editor.commentPopupPosition, editor.hasDefaultPopupPosition());
5422
+ editor.elementBeforePopup.after(container);
5423
+ container.addEventListener("focus", ({
5424
+ relatedTarget
5425
+ }) => {
5426
+ this.#previousFocusedElement = relatedTarget;
5427
+ }, {
5428
+ once: true
5429
+ });
5430
+ if (isSelected) {
5431
+ setTimeout(() => container.focus(), 0);
5031
5432
  }
5032
- if (a.rect[2] !== b.rect[2]) {
5033
- return a.rect[2] - b.rect[2];
5433
+ }
5434
+ #setPosition(x, y, correctPosition) {
5435
+ if (!correctPosition) {
5436
+ this.#editor.commentPopupPosition = [x, y];
5437
+ } else {
5438
+ const widthRatio = this._popupWidth / this.#editor.parentBoundingClientRect.width;
5439
+ if (this.#isLTR && x + widthRatio > 1 || !this.#isLTR && x - widthRatio >= 0) {
5440
+ const buttonWidth = this.#editor.commentButtonWidth;
5441
+ x -= widthRatio - buttonWidth;
5442
+ }
5034
5443
  }
5035
- return a.id.localeCompare(b.id);
5444
+ this.#posX = x;
5445
+ this.#posY = y;
5446
+ const {
5447
+ style
5448
+ } = this.#container;
5449
+ style.left = `${100 * x}%`;
5450
+ style.top = `${100 * y}%`;
5451
+ }
5452
+ destroy() {
5453
+ this._hide();
5454
+ this.#container?.remove();
5455
+ this.#container = this.#text = this.#time = null;
5456
+ this.#prevDragX = this.#prevDragY = Infinity;
5457
+ this.#posX = this.#posY = 0;
5458
+ this.#previousFocusedElement = null;
5036
5459
  }
5037
5460
  }
5038
5461
 
@@ -9907,6 +10330,7 @@ class AnnotationEditorLayerBuilder {
9907
10330
 
9908
10331
  class AnnotationLayerBuilder {
9909
10332
  #annotations = null;
10333
+ #commentManager = null;
9910
10334
  #externalHide = false;
9911
10335
  #onAppend = null;
9912
10336
  #eventAbortController = null;
@@ -9919,6 +10343,7 @@ class AnnotationLayerBuilder {
9919
10343
  imageResourcesPath = "",
9920
10344
  renderForms = true,
9921
10345
  enableComment = false,
10346
+ commentManager = null,
9922
10347
  enableScripting = false,
9923
10348
  hasJSActionsPromise = null,
9924
10349
  fieldObjectsPromise = null,
@@ -9934,6 +10359,7 @@ class AnnotationLayerBuilder {
9934
10359
  this.renderForms = renderForms;
9935
10360
  this.annotationStorage = annotationStorage;
9936
10361
  this.enableComment = enableComment;
10362
+ this.#commentManager = commentManager;
9937
10363
  this.enableScripting = enableScripting;
9938
10364
  this._hasJSActionsPromise = hasJSActionsPromise || Promise.resolve(false);
9939
10365
  this._fieldObjectsPromise = fieldObjectsPromise || Promise.resolve(null);
@@ -9971,19 +10397,17 @@ class AnnotationLayerBuilder {
9971
10397
  const div = this.div = document.createElement("div");
9972
10398
  div.className = "annotationLayer";
9973
10399
  this.#onAppend?.(div);
10400
+ this.#initAnnotationLayer(viewport, structTreeLayer);
9974
10401
  if (annotations.length === 0) {
9975
10402
  this.#annotations = annotations;
9976
- this.hide(true);
10403
+ setLayerDimensions(this.div, viewport);
9977
10404
  return;
9978
10405
  }
9979
- this.#initAnnotationLayer(viewport, structTreeLayer);
9980
10406
  await this.annotationLayer.render({
9981
10407
  annotations,
9982
10408
  imageResourcesPath: this.imageResourcesPath,
9983
10409
  renderForms: this.renderForms,
9984
- linkService: this.linkService,
9985
10410
  downloadManager: this.downloadManager,
9986
- annotationStorage: this.annotationStorage,
9987
10411
  enableComment: this.enableComment,
9988
10412
  enableScripting: this.enableScripting,
9989
10413
  hasJSActions,
@@ -10008,11 +10432,14 @@ class AnnotationLayerBuilder {
10008
10432
  accessibilityManager: this._accessibilityManager,
10009
10433
  annotationCanvasMap: this._annotationCanvasMap,
10010
10434
  annotationEditorUIManager: this._annotationEditorUIManager,
10435
+ annotationStorage: this.annotationStorage,
10011
10436
  page: this.pdfPage,
10012
10437
  viewport: viewport.clone({
10013
10438
  dontFlip: true
10014
10439
  }),
10015
- structTreeLayer
10440
+ structTreeLayer,
10441
+ commentManager: this.#commentManager,
10442
+ linkService: this.linkService
10016
10443
  });
10017
10444
  }
10018
10445
  cancel() {
@@ -10030,11 +10457,7 @@ class AnnotationLayerBuilder {
10030
10457
  hasEditableAnnotations() {
10031
10458
  return !!this.annotationLayer?.hasEditableAnnotations();
10032
10459
  }
10033
- async injectLinkAnnotations({
10034
- inferredLinks,
10035
- viewport,
10036
- structTreeLayer = null
10037
- }) {
10460
+ async injectLinkAnnotations(inferredLinks) {
10038
10461
  if (this.#annotations === null) {
10039
10462
  throw new Error("`render` method must be called before `injectLinkAnnotations`.");
10040
10463
  }
@@ -10046,11 +10469,7 @@ class AnnotationLayerBuilder {
10046
10469
  if (!newLinks.length) {
10047
10470
  return;
10048
10471
  }
10049
- if (!this.annotationLayer) {
10050
- this.#initAnnotationLayer(viewport, structTreeLayer);
10051
- setLayerDimensions(this.div, viewport);
10052
- }
10053
- await this.annotationLayer.addLinkAnnotations(newLinks, this.linkService);
10472
+ await this.annotationLayer.addLinkAnnotations(newLinks);
10054
10473
  if (!this.#externalHide) {
10055
10474
  this.div.hidden = false;
10056
10475
  }
@@ -10277,7 +10696,7 @@ class BasePDFPageView {
10277
10696
  eventBus = null;
10278
10697
  id = null;
10279
10698
  pageColors = null;
10280
- recordedGroups = null;
10699
+ recordedBBoxes = null;
10281
10700
  renderingQueue = null;
10282
10701
  renderTask = null;
10283
10702
  resume = null;
@@ -10428,7 +10847,7 @@ class BasePDFPageView {
10428
10847
  if (renderTask === this.renderTask) {
10429
10848
  this.renderTask = null;
10430
10849
  if (this.enableOptimizedPartialRendering) {
10431
- this.recordedGroups ??= renderTask.recordedGroups;
10850
+ this.recordedBBoxes ??= renderTask.recordedBBoxes;
10432
10851
  }
10433
10852
  }
10434
10853
  }
@@ -10613,15 +11032,11 @@ class PDFPageDetailView extends BasePDFPageView {
10613
11032
  });
10614
11033
  }
10615
11034
  _getRenderingContext(canvas, transform) {
10616
- const baseContext = this.pageView._getRenderingContext(canvas, transform);
10617
- const recordedGroups = this.pdfPage.recordedGroups;
10618
- if (!recordedGroups || !this.enableOptimizedPartialRendering) {
10619
- return {
10620
- ...baseContext,
10621
- recordOperations: false
10622
- };
11035
+ const baseContext = this.pageView._getRenderingContext(canvas, transform, false);
11036
+ const recordedBBoxes = this.pdfPage.recordedBBoxes;
11037
+ if (!recordedBBoxes || !this.enableOptimizedPartialRendering) {
11038
+ return baseContext;
10623
11039
  }
10624
- const filteredIndexes = new Set();
10625
11040
  const {
10626
11041
  viewport: {
10627
11042
  width: vWidth,
@@ -10638,17 +11053,14 @@ class PDFPageDetailView extends BasePDFPageView {
10638
11053
  const detailMinY = aMinY / vHeight;
10639
11054
  const detailMaxX = (aMinX + aWidth) / vWidth;
10640
11055
  const detailMaxY = (aMinY + aHeight) / vHeight;
10641
- for (let i = 0, ii = recordedGroups.length; i < ii; i++) {
10642
- const group = recordedGroups[i];
10643
- if (group.minX <= detailMaxX && group.maxX >= detailMinX && group.minY <= detailMaxY && group.maxY >= detailMinY) {
10644
- filteredIndexes.add(group.idx);
10645
- group.dependencies.forEach(filteredIndexes.add, filteredIndexes);
10646
- }
10647
- }
10648
11056
  return {
10649
11057
  ...baseContext,
10650
- recordOperations: false,
10651
- filteredOperationIndexes: filteredIndexes
11058
+ operationsFilter(index) {
11059
+ if (recordedBBoxes.isEmpty(index)) {
11060
+ return false;
11061
+ }
11062
+ return recordedBBoxes.minX(index) <= detailMaxX && recordedBBoxes.maxX(index) >= detailMinX && recordedBBoxes.minY(index) <= detailMaxY && recordedBBoxes.maxY(index) >= detailMinY;
11063
+ }
10652
11064
  };
10653
11065
  }
10654
11066
  async draw() {
@@ -10681,7 +11093,10 @@ class PDFPageDetailView extends BasePDFPageView {
10681
11093
  canvasWrapper.prepend(newCanvas);
10682
11094
  }
10683
11095
  }, hideUntilComplete);
10684
- canvas.setAttribute("aria-hidden", "true");
11096
+ canvas.ariaHidden = true;
11097
+ if (this.enableOptimizedPartialRendering) {
11098
+ canvas.className = "detailView";
11099
+ }
10685
11100
  const {
10686
11101
  width,
10687
11102
  height
@@ -11517,6 +11932,7 @@ const LAYERS_ORDER = new Map([["canvasWrapper", 0], ["textLayer", 1], ["annotati
11517
11932
  class PDFPageView extends BasePDFPageView {
11518
11933
  #annotationMode = AnnotationMode.ENABLE_FORMS;
11519
11934
  #canvasWrapper = null;
11935
+ #commentManager = null;
11520
11936
  #enableAutoLinking = true;
11521
11937
  #hasRestrictedScaling = false;
11522
11938
  #isEditing = false;
@@ -11555,6 +11971,7 @@ class PDFPageView extends BasePDFPageView {
11555
11971
  this.maxCanvasDim = options.maxCanvasDim || AppOptions.get("maxCanvasDim");
11556
11972
  this.capCanvasAreaFactor = options.capCanvasAreaFactor ?? AppOptions.get("capCanvasAreaFactor");
11557
11973
  this.#enableAutoLinking = options.enableAutoLinking !== false;
11974
+ this.#commentManager = options.commentManager || null;
11558
11975
  this.l10n = options.l10n;
11559
11976
  this.l10n ||= new genericl10n_GenericL10n();
11560
11977
  this._isStandalone = !this.renderingQueue?.hasViewer();
@@ -11783,11 +12200,7 @@ class PDFPageView extends BasePDFPageView {
11783
12200
  if (!this.annotationLayer) {
11784
12201
  return;
11785
12202
  }
11786
- await this.annotationLayer.injectLinkAnnotations({
11787
- inferredLinks: Autolinker.processLinks(this),
11788
- viewport: this.viewport,
11789
- structTreeLayer: this.structTreeLayer
11790
- });
12203
+ await this.annotationLayer.injectLinkAnnotations(Autolinker.processLinks(this));
11791
12204
  } catch (ex) {
11792
12205
  console.error("#injectLinkAnnotations:", ex);
11793
12206
  error = ex;
@@ -11982,6 +12395,11 @@ class PDFPageView extends BasePDFPageView {
11982
12395
  this.#needsRestrictedScaling = true;
11983
12396
  } else {
11984
12397
  this.#needsRestrictedScaling = outputScale.limitCanvas(width, height, this.maxCanvasPixels, this.maxCanvasDim, this.capCanvasAreaFactor);
12398
+ if (this.#needsRestrictedScaling && this.enableDetailCanvas) {
12399
+ const factor = this.enableOptimizedPartialRendering ? 4 : 2;
12400
+ outputScale.sx /= factor;
12401
+ outputScale.sy /= factor;
12402
+ }
11985
12403
  }
11986
12404
  }
11987
12405
  cancelRendering({
@@ -12087,7 +12505,7 @@ class PDFPageView extends BasePDFPageView {
12087
12505
  }
12088
12506
  return canvasWrapper;
12089
12507
  }
12090
- _getRenderingContext(canvas, transform) {
12508
+ _getRenderingContext(canvas, transform, recordOperations) {
12091
12509
  return {
12092
12510
  canvas,
12093
12511
  transform,
@@ -12097,7 +12515,7 @@ class PDFPageView extends BasePDFPageView {
12097
12515
  annotationCanvasMap: this._annotationCanvasMap,
12098
12516
  pageColors: this.pageColors,
12099
12517
  isEditing: this.#isEditing,
12100
- recordOperations: this.enableOptimizedPartialRendering && !this.recordedGroups
12518
+ recordOperations
12101
12519
  };
12102
12520
  }
12103
12521
  async draw() {
@@ -12157,6 +12575,7 @@ class PDFPageView extends BasePDFPageView {
12157
12575
  annotationCanvasMap: this._annotationCanvasMap,
12158
12576
  accessibilityManager: this._accessibilityManager,
12159
12577
  annotationEditorUIManager,
12578
+ commentManager: this.#commentManager,
12160
12579
  onAppend: annotationLayerDiv => {
12161
12580
  this.#addLayer(annotationLayerDiv, "annotationLayer");
12162
12581
  }
@@ -12197,14 +12616,18 @@ class PDFPageView extends BasePDFPageView {
12197
12616
  div.style.setProperty("--scale-round-y", `${sfy[1]}px`);
12198
12617
  this.#scaleRoundY = sfy[1];
12199
12618
  }
12619
+ const recordBBoxes = this.enableOptimizedPartialRendering && this.#hasRestrictedScaling && !this.recordedBBoxes;
12200
12620
  const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null;
12201
- const resultPromise = this._drawCanvas(this._getRenderingContext(canvas, transform), () => {
12621
+ const resultPromise = this._drawCanvas(this._getRenderingContext(canvas, transform, recordBBoxes), () => {
12202
12622
  prevCanvas?.remove();
12203
12623
  this._resetCanvas();
12204
12624
  }, renderTask => {
12205
12625
  this.#useThumbnailCanvas.regularAnnotations = !renderTask.separateAnnots;
12206
12626
  this.dispatchPageRendered(false, false);
12207
12627
  }).then(async () => {
12628
+ if (this.renderingState !== RenderingStates.FINISHED) {
12629
+ return;
12630
+ }
12208
12631
  this.structTreeLayer ||= new StructTreeLayerBuilder(pdfPage, viewport.rawDims);
12209
12632
  const textLayerPromise = this.#renderTextLayer();
12210
12633
  if (this.annotationLayer) {
@@ -12224,20 +12647,22 @@ class PDFPageView extends BasePDFPageView {
12224
12647
  });
12225
12648
  await this.#renderDrawLayer();
12226
12649
  this.drawLayer.setParent(canvasWrapper);
12227
- this.annotationEditorLayer ||= new AnnotationEditorLayerBuilder({
12228
- uiManager: annotationEditorUIManager,
12229
- pdfPage,
12230
- l10n,
12231
- structTreeLayer: this.structTreeLayer,
12232
- accessibilityManager: this._accessibilityManager,
12233
- annotationLayer: this.annotationLayer?.annotationLayer,
12234
- textLayer: this.textLayer,
12235
- drawLayer: this.drawLayer.getDrawLayer(),
12236
- onAppend: annotationEditorLayerDiv => {
12237
- this.#addLayer(annotationEditorLayerDiv, "annotationEditorLayer");
12238
- }
12239
- });
12240
- this.#renderAnnotationEditorLayer();
12650
+ if (this.annotationLayer || this.#annotationMode === AnnotationMode.DISABLE) {
12651
+ this.annotationEditorLayer ||= new AnnotationEditorLayerBuilder({
12652
+ uiManager: annotationEditorUIManager,
12653
+ pdfPage,
12654
+ l10n,
12655
+ structTreeLayer: this.structTreeLayer,
12656
+ accessibilityManager: this._accessibilityManager,
12657
+ annotationLayer: this.annotationLayer?.annotationLayer,
12658
+ textLayer: this.textLayer,
12659
+ drawLayer: this.drawLayer.getDrawLayer(),
12660
+ onAppend: annotationEditorLayerDiv => {
12661
+ this.#addLayer(annotationEditorLayerDiv, "annotationEditorLayer");
12662
+ }
12663
+ });
12664
+ this.#renderAnnotationEditorLayer();
12665
+ }
12241
12666
  });
12242
12667
  if (pdfPage.isPureXfa) {
12243
12668
  if (!this.xfaLayer) {
@@ -12377,7 +12802,7 @@ class PDFViewer {
12377
12802
  #textLayerMode = TextLayerMode.ENABLE;
12378
12803
  #viewerAlert = null;
12379
12804
  constructor(options) {
12380
- const viewerVersion = "5.4.149";
12805
+ const viewerVersion = "5.4.296";
12381
12806
  if (version !== viewerVersion) {
12382
12807
  throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`);
12383
12808
  }
@@ -12884,7 +13309,8 @@ class PDFViewer {
12884
13309
  layerProperties: this._layerProperties,
12885
13310
  enableHWA: this.#enableHWA,
12886
13311
  enableAutoLinking: this.#enableAutoLinking,
12887
- minDurationToUpdateCanvas: this.#minDurationToUpdateCanvas
13312
+ minDurationToUpdateCanvas: this.#minDurationToUpdateCanvas,
13313
+ commentManager: this.#commentManager
12888
13314
  });
12889
13315
  this._pages.push(pageView);
12890
13316
  }
@@ -12894,6 +13320,17 @@ class PDFViewer {
12894
13320
  } else if (this._spreadMode !== SpreadMode.NONE) {
12895
13321
  this._updateSpreadMode();
12896
13322
  }
13323
+ eventBus._on("annotationeditorlayerrendered", evt => {
13324
+ if (this.#annotationEditorUIManager) {
13325
+ eventBus.dispatch("annotationeditormodechanged", {
13326
+ source: this,
13327
+ mode: this.#annotationEditorMode
13328
+ });
13329
+ }
13330
+ }, {
13331
+ once: true,
13332
+ signal
13333
+ });
12897
13334
  this.#onePageRenderedOrForceFetch(signal).then(async () => {
12898
13335
  if (pdfDocument !== this.pdfDocument) {
12899
13336
  return;
@@ -12905,12 +13342,6 @@ class PDFViewer {
12905
13342
  signal
12906
13343
  });
12907
13344
  }
12908
- if (this.#annotationEditorUIManager) {
12909
- eventBus.dispatch("annotationeditormodechanged", {
12910
- source: this,
12911
- mode: this.#annotationEditorMode
12912
- });
12913
- }
12914
13345
  if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT) {
12915
13346
  this._pagesCapability.resolve();
12916
13347
  return;
@@ -13239,7 +13670,8 @@ class PDFViewer {
13239
13670
  pageNumber,
13240
13671
  destArray = null,
13241
13672
  allowNegativeOffset = false,
13242
- ignoreDestinationZoom = false
13673
+ ignoreDestinationZoom = false,
13674
+ center = null
13243
13675
  }) {
13244
13676
  if (!this.pdfDocument) {
13245
13677
  return;
@@ -13325,7 +13757,14 @@ class PDFViewer {
13325
13757
  const boundingRect = [pageView.viewport.convertToViewportPoint(x, y), pageView.viewport.convertToViewportPoint(x + width, y + height)];
13326
13758
  let left = Math.min(boundingRect[0][0], boundingRect[1][0]);
13327
13759
  let top = Math.min(boundingRect[0][1], boundingRect[1][1]);
13328
- if (!allowNegativeOffset) {
13760
+ if (center) {
13761
+ if (center === "both" || center === "vertical") {
13762
+ top -= (this.container.clientHeight - Math.abs(boundingRect[1][1] - boundingRect[0][1])) / 2;
13763
+ }
13764
+ if (center === "both" || center === "horizontal") {
13765
+ left -= (this.container.clientWidth - Math.abs(boundingRect[1][0] - boundingRect[0][0])) / 2;
13766
+ }
13767
+ } else if (!allowNegativeOffset) {
13329
13768
  left = Math.max(left, 0);
13330
13769
  top = Math.max(top, 0);
13331
13770
  }
@@ -13930,6 +14369,7 @@ class PDFViewer {
13930
14369
  if (!isEditing) {
13931
14370
  this.pdfDocument.annotationStorage.resetModifiedIds();
13932
14371
  }
14372
+ this.cleanup();
13933
14373
  for (const pageView of this._pages) {
13934
14374
  pageView.toggleEditingMode(isEditing);
13935
14375
  }
@@ -15786,7 +16226,8 @@ const PDFViewerApplication = {
15786
16226
  const container = appConfig.mainContainer,
15787
16227
  viewer = appConfig.viewerContainer;
15788
16228
  const annotationEditorMode = AppOptions.get("annotationEditorMode");
15789
- const pageColors = AppOptions.get("forcePageColors") || window.matchMedia("(forced-colors: active)").matches ? {
16229
+ const hasForcedColors = AppOptions.get("forcePageColors") || window.matchMedia("(forced-colors: active)").matches;
16230
+ const pageColors = hasForcedColors ? {
15790
16231
  background: AppOptions.get("pageColorsBackground"),
15791
16232
  foreground: AppOptions.get("pageColorsForeground")
15792
16233
  } : null;
@@ -15800,14 +16241,17 @@ const PDFViewerApplication = {
15800
16241
  this.editorUndoBar = new EditorUndoBar(appConfig.editorUndoBar, eventBus);
15801
16242
  }
15802
16243
  const signatureManager = AppOptions.get("enableSignatureEditor") && appConfig.addSignatureDialog ? new SignatureManager(appConfig.addSignatureDialog, appConfig.editSignatureDialog, appConfig.annotationEditorParams?.editorSignatureAddSignature || null, overlayManager, l10n, externalServices.createSignatureStorage(eventBus, abortSignal), eventBus) : null;
16244
+ const ltr = appConfig.viewerContainer ? getComputedStyle(appConfig.viewerContainer).direction === "ltr" : true;
15803
16245
  const commentManager = AppOptions.get("enableComment") && appConfig.editCommentDialog ? new CommentManager(appConfig.editCommentDialog, {
16246
+ learnMoreUrl: AppOptions.get("commentLearnMoreUrl"),
15804
16247
  sidebar: appConfig.annotationEditorParams?.editorCommentsSidebar || null,
16248
+ sidebarResizer: appConfig.annotationEditorParams?.editorCommentsSidebarResizer || null,
15805
16249
  commentsList: appConfig.annotationEditorParams?.editorCommentsSidebarList || null,
15806
16250
  commentCount: appConfig.annotationEditorParams?.editorCommentsSidebarCount || null,
15807
16251
  sidebarTitle: appConfig.annotationEditorParams?.editorCommentsSidebarTitle || null,
15808
16252
  closeButton: appConfig.annotationEditorParams?.editorCommentsSidebarCloseButton || null,
15809
16253
  commentToolbarButton: appConfig.toolbar?.editorCommentButton || null
15810
- }, eventBus, linkService, overlayManager) : null;
16254
+ }, eventBus, linkService, overlayManager, ltr, hasForcedColors) : null;
15811
16255
  const enableHWA = AppOptions.get("enableHWA"),
15812
16256
  maxCanvasPixels = AppOptions.get("maxCanvasPixels"),
15813
16257
  maxCanvasDim = AppOptions.get("maxCanvasDim"),
@@ -16304,12 +16748,13 @@ const PDFViewerApplication = {
16304
16748
  await this.pdfScriptingManager.dispatchDidSave();
16305
16749
  this._saveInProgress = false;
16306
16750
  }
16307
- if (this._hasAnnotationEditors) {
16751
+ const editorStats = this.pdfDocument?.annotationStorage.editorStats;
16752
+ if (editorStats) {
16308
16753
  this.externalServices.reportTelemetry({
16309
16754
  type: "editing",
16310
16755
  data: {
16311
16756
  type: "save",
16312
- stats: this.pdfDocument?.annotationStorage.editorStats
16757
+ stats: editorStats
16313
16758
  }
16314
16759
  });
16315
16760
  }
@@ -17835,6 +18280,7 @@ function getViewerConfiguration() {
17835
18280
  editorCommentsSidebarTitle: document.getElementById("editorCommentsSidebarTitle"),
17836
18281
  editorCommentsSidebarCloseButton: document.getElementById("editorCommentsSidebarCloseButton"),
17837
18282
  editorCommentsSidebarList: document.getElementById("editorCommentsSidebarList"),
18283
+ editorCommentsSidebarResizer: document.getElementById("editorCommentsSidebarResizer"),
17838
18284
  editorFreeTextFontSize: document.getElementById("editorFreeTextFontSize"),
17839
18285
  editorFreeTextColor: document.getElementById("editorFreeTextColor"),
17840
18286
  editorInkColor: document.getElementById("editorInkColor"),
@@ -17855,13 +18301,8 @@ function getViewerConfiguration() {
17855
18301
  editCommentDialog: {
17856
18302
  dialog: document.getElementById("commentManagerDialog"),
17857
18303
  toolbar: document.getElementById("commentManagerToolbar"),
17858
- actions: document.getElementById("commentActionsButton"),
17859
- menu: document.getElementById("commentActionsMenu"),
17860
- editMenuItem: document.getElementById("commentActionsEditButton"),
17861
- deleteMenuItem: document.getElementById("commentActionsDeleteButton"),
17862
- closeButton: document.getElementById("commentCloseButton"),
18304
+ title: document.getElementById("commentManagerTitle"),
17863
18305
  textInput: document.getElementById("commentManagerTextInput"),
17864
- textView: document.getElementById("commentManagerTextView"),
17865
18306
  cancelButton: document.getElementById("commentManagerCancelButton"),
17866
18307
  saveButton: document.getElementById("commentManagerSaveButton")
17867
18308
  }