@cortex-agent/server 2026.10.28 → 2026.12.5

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 (401) hide show
  1. package/LICENSE +255 -21
  2. package/README.md +36 -7
  3. package/THIRD_PARTY_NOTICES.txt +1990 -593
  4. package/defaults/hooks/cortex-hook-api.mjs +2 -1
  5. package/defaults/hooks/quota-stop.mjs +37 -0
  6. package/defaults/plugins/cortex-system/skills/client-manage/SKILL.md +23 -15
  7. package/defaults/prompts/clean-workspace.md +5 -0
  8. package/dist/agent-adapter/claude/remote-mcp-proxy.js +1 -1
  9. package/dist/chunks/agent-runner-LVZVKBZX.js +4 -0
  10. package/dist/chunks/anthropic-messages-TT6454AA.js +8 -0
  11. package/dist/chunks/azure-openai-responses-52LR2XZD.js +4 -0
  12. package/dist/chunks/bedrock-converse-stream-EOZGYUNY.js +60 -0
  13. package/dist/chunks/bowser-MLGGLXTZ.js +20 -0
  14. package/dist/chunks/child-runner-SMG2VOU5.js +4 -0
  15. package/dist/chunks/chunk-24DH4IR5.js +4 -0
  16. package/dist/chunks/chunk-25XKBRDT.js +70 -0
  17. package/dist/chunks/chunk-2ABET62E.js +23 -0
  18. package/dist/chunks/chunk-2BVUA256.js +4 -0
  19. package/dist/chunks/{chunk-LEUENXI2.js → chunk-2WFL62UO.js} +1 -1
  20. package/dist/chunks/{chunk-OZGBWAT2.js → chunk-2YTYYG4K.js} +1 -1
  21. package/dist/chunks/chunk-335SSANX.js +4 -0
  22. package/dist/chunks/chunk-377OPTXX.js +17 -0
  23. package/dist/chunks/chunk-3EZNVLBF.js +129 -0
  24. package/dist/chunks/chunk-3O6ZG5HA.js +7 -0
  25. package/dist/chunks/{chunk-6AKUD3CF.js → chunk-3XLHL5YT.js} +1 -1
  26. package/dist/chunks/chunk-4HRI75GU.js +4 -0
  27. package/dist/chunks/chunk-4JBYLRPM.js +57 -0
  28. package/dist/chunks/chunk-4KKV7VKE.js +4 -0
  29. package/dist/chunks/chunk-4KQHDDC5.js +4 -0
  30. package/dist/chunks/chunk-4SWD4JMP.js +33 -0
  31. package/dist/chunks/chunk-52VCLZS5.js +4 -0
  32. package/dist/chunks/chunk-54P7TSY3.js +10 -0
  33. package/dist/chunks/chunk-5DVSAXOI.js +7 -0
  34. package/dist/chunks/chunk-5F3A62YS.js +4 -0
  35. package/dist/chunks/{chunk-XNSSUVT6.js → chunk-5FHETFZM.js} +1 -1
  36. package/dist/chunks/{chunk-A34TDMIC.js → chunk-5LBLRAHS.js} +1 -1
  37. package/dist/chunks/chunk-5UYVNA3W.js +4 -0
  38. package/dist/chunks/chunk-6G3OYMCV.js +21 -0
  39. package/dist/chunks/chunk-7GGPYU5E.js +30 -0
  40. package/dist/chunks/chunk-7TYSMLUV.js +4 -0
  41. package/dist/chunks/chunk-7W7VYUTK.js +5 -0
  42. package/dist/chunks/chunk-AXYAZTTN.js +6 -0
  43. package/dist/chunks/{chunk-BGVHA2D4.js → chunk-B3NB243Z.js} +1 -1
  44. package/dist/chunks/chunk-BKYP6AGM.js +8 -0
  45. package/dist/chunks/chunk-BVEDNESB.js +4 -0
  46. package/dist/chunks/chunk-BWDJS6A4.js +12 -0
  47. package/dist/chunks/chunk-C6YVF7EI.js +4 -0
  48. package/dist/chunks/chunk-CEJIYYVE.js +15 -0
  49. package/dist/chunks/chunk-CI2RHH74.js +50 -0
  50. package/dist/chunks/chunk-CMSOOLJB.js +4 -0
  51. package/dist/chunks/chunk-CSVTYYLP.js +4 -0
  52. package/dist/chunks/chunk-DE5EGVKG.js +6 -0
  53. package/dist/chunks/{chunk-E6BYRULL.js → chunk-DK3RPZOQ.js} +1 -1
  54. package/dist/chunks/{chunk-YPK2CAIZ.js → chunk-DK4UCK7L.js} +1 -1
  55. package/dist/chunks/chunk-DYLBVUAU.js +4 -0
  56. package/dist/chunks/chunk-FDC2GRBK.js +27 -0
  57. package/dist/chunks/chunk-FE7HH5JS.js +18 -0
  58. package/dist/chunks/chunk-FYD57YRO.js +436 -0
  59. package/dist/chunks/chunk-G264APQN.js +5 -0
  60. package/dist/chunks/chunk-G4JYZFEO.js +11 -0
  61. package/dist/chunks/chunk-GFFM56U2.js +4 -0
  62. package/dist/chunks/chunk-GOS3P7KS.js +132 -0
  63. package/dist/chunks/chunk-HVN37UXD.js +4 -0
  64. package/dist/chunks/chunk-IA6IODY3.js +4 -0
  65. package/dist/chunks/{chunk-HU6UIDEJ.js → chunk-IGZWZP7Z.js} +1 -1
  66. package/dist/chunks/{chunk-NR6U3WIZ.js → chunk-IJ7XFQMI.js} +1 -1
  67. package/dist/chunks/chunk-IMMGYDAB.js +6 -0
  68. package/dist/chunks/chunk-IOWBF7UK.js +10 -0
  69. package/dist/chunks/{chunk-HALUQ7ZF.js → chunk-ITGCWQFK.js} +1 -1
  70. package/dist/chunks/chunk-IVZ7QUEG.js +4 -0
  71. package/dist/chunks/{chunk-YAEVYJAR.js → chunk-IWY2HIFK.js} +1 -1
  72. package/dist/chunks/{chunk-KGJZAYQD.js → chunk-J7OBATRN.js} +1 -1
  73. package/dist/chunks/{chunk-QWAQHHRS.js → chunk-JGUEIW2W.js} +1 -1
  74. package/dist/chunks/chunk-JKL3AK5D.js +106 -0
  75. package/dist/chunks/chunk-JZ7U7RUK.js +351 -0
  76. package/dist/chunks/chunk-KJUQCCB5.js +4 -0
  77. package/dist/chunks/chunk-KST6OY76.js +10 -0
  78. package/dist/chunks/chunk-KZSAFVSY.js +129 -0
  79. package/dist/chunks/chunk-LD2ZSH3M.js +903 -0
  80. package/dist/chunks/chunk-LE6QPXN6.js +7 -0
  81. package/dist/chunks/chunk-LEAV3FFG.js +4 -0
  82. package/dist/chunks/chunk-LIIZI3HY.js +5 -0
  83. package/dist/chunks/chunk-LP72AF56.js +45 -0
  84. package/dist/chunks/{chunk-FXDIR3SQ.js → chunk-MJQ2D2OP.js} +1 -1
  85. package/dist/chunks/{chunk-6LZK4DDH.js → chunk-NHHR4DCF.js} +1 -1
  86. package/dist/chunks/chunk-NW4GW47L.js +4 -0
  87. package/dist/chunks/chunk-OALEJ6FG.js +60 -0
  88. package/dist/chunks/chunk-OIV4DIMB.js +4 -0
  89. package/dist/chunks/chunk-OJ37ZWBG.js +4 -0
  90. package/dist/chunks/chunk-OZXMPBUX.js +4 -0
  91. package/dist/chunks/{chunk-3THJYAEF.js → chunk-PG7452XE.js} +1 -1
  92. package/dist/chunks/chunk-PJCUB7YJ.js +4 -0
  93. package/dist/chunks/chunk-PTS3J4DQ.js +6 -0
  94. package/dist/chunks/{chunk-PXS5SHOV.js → chunk-PVVEEBUU.js} +1 -1
  95. package/dist/chunks/chunk-Q7BZLPBU.js +8 -0
  96. package/dist/chunks/{chunk-FOJQXLL2.js → chunk-QC66ZXPP.js} +1 -1
  97. package/dist/chunks/chunk-QXFWIL4C.js +4 -0
  98. package/dist/chunks/{chunk-PFMEUFJ7.js → chunk-R2CCD4OF.js} +1 -1
  99. package/dist/chunks/chunk-R6CGBSTC.js +22 -0
  100. package/dist/chunks/chunk-RG5GP4RB.js +5 -0
  101. package/dist/chunks/{chunk-D3NXKK2L.js → chunk-RW2F2QNP.js} +1 -1
  102. package/dist/chunks/{models-L5VF4I5O-XXNJYQMQ.js → chunk-RWPO3NZ3.js} +1 -1
  103. package/dist/chunks/chunk-SAJD4EKE.js +10 -0
  104. package/dist/chunks/chunk-SDUS2H3E.js +4 -0
  105. package/dist/chunks/chunk-SIHGKM4E.js +4 -0
  106. package/dist/chunks/chunk-SKHFU5DI.js +4 -0
  107. package/dist/chunks/{chunk-STUHNKQS.js → chunk-SM45TH22.js} +1 -1
  108. package/dist/chunks/chunk-T54CZKNJ.js +6 -0
  109. package/dist/chunks/chunk-TKFFQNAP.js +19 -0
  110. package/dist/chunks/chunk-TMV2ZDOI.js +18 -0
  111. package/dist/chunks/chunk-TRXLIL7V.js +4 -0
  112. package/dist/chunks/{chunk-SUFW24P4.js → chunk-UEEW2R4E.js} +1 -1
  113. package/dist/chunks/chunk-UHXPRU6G.js +10 -0
  114. package/dist/chunks/chunk-UPQVWHZ3.js +4 -0
  115. package/dist/chunks/{chunk-JERCOLY3.js → chunk-V35MFAUQ.js} +4 -6
  116. package/dist/chunks/chunk-V7K3KNDM.js +4 -0
  117. package/dist/chunks/chunk-VHX2GHBF.js +4 -0
  118. package/dist/chunks/chunk-VOAKRJ4R.js +4 -0
  119. package/dist/chunks/{chunk-X2GYYRVM.js → chunk-VW7TLY3P.js} +1 -1
  120. package/dist/chunks/chunk-W34AK4SK.js +65 -0
  121. package/dist/chunks/{chunk-REBNWCKI.js → chunk-WU7RNAZD.js} +1 -1
  122. package/dist/chunks/chunk-WZC4TDDM.js +6 -0
  123. package/dist/chunks/chunk-WZYS2HAK.js +4 -0
  124. package/dist/chunks/chunk-X2TKJ7KR.js +11 -0
  125. package/dist/chunks/{chunk-H2FP6DG4.js → chunk-X5ND4H4P.js} +1 -1
  126. package/dist/chunks/{chunk-4U7XXM4W.js → chunk-Y3AOGNDT.js} +1 -1
  127. package/dist/chunks/chunk-Y6DGVTKM.js +6 -0
  128. package/dist/chunks/{chunk-KENCMLRE.js → chunk-YAEHSSR4.js} +1 -1
  129. package/dist/chunks/chunk-YWPBE5LP.js +4 -0
  130. package/dist/chunks/chunk-ZAVX7G2M.js +15 -0
  131. package/dist/chunks/chunk-ZD2M73XA.js +19 -0
  132. package/dist/chunks/chunk-ZD4O6NPV.js +4 -0
  133. package/dist/chunks/chunk-ZNAMETPQ.js +4 -0
  134. package/dist/chunks/chunk-ZY6N5LVQ.js +4 -0
  135. package/dist/chunks/chunk-ZYQ4TDTT.js +81 -0
  136. package/dist/chunks/cli-VB2N7HEK.js +55 -0
  137. package/dist/chunks/cloudflare-workers-ai-system-one-YKU742EC.js +4 -0
  138. package/dist/chunks/context-CI2FKEQE.js +4 -0
  139. package/dist/chunks/cost-CZRRSIUF.js +5 -0
  140. package/dist/chunks/dist-QCNQN6DY.js +4 -0
  141. package/dist/chunks/easter-egg-3d-XR5S2O3T.js +4 -0
  142. package/dist/chunks/{event-streams-3JSFPOTZ.js → event-streams-AVE4MSS6.js} +1 -1
  143. package/dist/chunks/{execution-repo-ZLJTBWFC.js → execution-repo-5TLV2NM4.js} +1 -1
  144. package/dist/chunks/{executions-6ARGR3IO.js → executions-I3UUIGSL.js} +1 -1
  145. package/dist/chunks/file-Y5G56IUT.js +4 -0
  146. package/dist/chunks/github-copilot-BRU2SRRZ.js +4 -0
  147. package/dist/chunks/google-generative-ai-ZF5QEUZV.js +4 -0
  148. package/dist/chunks/google-vertex-4PJZZI3Y.js +4 -0
  149. package/dist/chunks/init-A6GY656J.js +4 -0
  150. package/dist/chunks/{install-cli-4IZCSDFZ.js → install-cli-FALWKQYO.js} +1 -1
  151. package/dist/chunks/{interaction-ask-G5T3H3CG.js → interaction-ask-O5HGF6CH.js} +1 -1
  152. package/dist/chunks/{interaction-plan-E5V42MUP.js → interaction-plan-JTVDN3BC.js} +1 -1
  153. package/dist/chunks/kimi-coding-ZCIBMDZ6.js +4 -0
  154. package/dist/chunks/{llama-cpp-classify-OTXZWCMW.js → llama-cpp-classify-NRUXAIGQ.js} +3 -3
  155. package/dist/chunks/local-client-stop-RS4AHNF4.js +4 -0
  156. package/dist/chunks/{memory-cli-PYOILNN5.js → memory-cli-DIT4DQF3.js} +1 -1
  157. package/dist/chunks/meta-JQH66YU7.js +4 -0
  158. package/dist/chunks/mistral-conversations-CXHOECUV.js +7 -0
  159. package/dist/chunks/model-resolver-GIBPYRKP.js +4 -0
  160. package/dist/chunks/monitor-Z2HKNY5E.js +4 -0
  161. package/dist/chunks/{node-PTK2HCDV.js → node-DAO3SX7O.js} +1 -1
  162. package/dist/chunks/{openai-codex-2REL6UQU.js → openai-codex-JULCKICT.js} +1 -1
  163. package/dist/chunks/openai-codex-responses-U6DGMGDK.js +12 -0
  164. package/dist/chunks/openai-completions-PP4XLLOM.js +9 -0
  165. package/dist/chunks/{openai-decisions-2N6ZRPZC.js → openai-decisions-JU6QQKEM.js} +1 -1
  166. package/dist/chunks/openai-responses-2SG757TL.js +6 -0
  167. package/dist/chunks/openrouter-images-32M7YZWC.js +4 -0
  168. package/dist/chunks/pi-messages-VSINMXN4.js +10 -0
  169. package/dist/chunks/radius-THYKWV4E.js +4 -0
  170. package/dist/chunks/remote-ops-2WBEFQ3E.js +14 -0
  171. package/dist/chunks/runner-5MKMRTIN.js +4 -0
  172. package/dist/chunks/runtime-DST3H5JP.js +4 -0
  173. package/dist/chunks/schedule-cli-V7Y2BBVY.js +4 -0
  174. package/dist/chunks/slack-R7SEJYMY.js +4 -0
  175. package/dist/chunks/start-ui-http-7K5JOLPU.js +43 -0
  176. package/dist/chunks/subagent-Z5IQ4L54.js +4 -0
  177. package/dist/chunks/{time-KEHDQT6K.js → time-P6PE52WL.js} +1 -1
  178. package/dist/chunks/tool-shims-YCXZWTST.js +4 -0
  179. package/dist/chunks/typesafe-system-one-M2DABJSZ.js +4 -0
  180. package/dist/chunks/ui-board-HQIE4RZG.js +5 -0
  181. package/dist/chunks/ui-decision-YBZDS4YW.js +4 -0
  182. package/dist/chunks/{ui-file-GVH53O3X.js → ui-file-SRD4ILBS.js} +1 -1
  183. package/dist/chunks/ui-view-Z25MTZT7.js +4 -0
  184. package/dist/chunks/virtual-modules-H4DXPJZB.js +4 -0
  185. package/dist/chunks/waitpoint-M6JZBSLT.js +5 -0
  186. package/dist/chunks/workers-SQ2R32TK.js +4 -0
  187. package/dist/client-bundle/client.mjs +273 -93
  188. package/dist/client-bundle/manifest.json +2 -2
  189. package/dist/core/pi-sdk.js +1 -1
  190. package/dist/domain/auth/cc-auth-cli.js +1 -1
  191. package/dist/domain/mcp/bundled-server.js +1 -1
  192. package/dist/domain/mcp/feishu/client.js +4 -0
  193. package/dist/entry/app.js +151 -559
  194. package/dist/entry/browser-cli.js +10 -10
  195. package/dist/entry/cli.js +1 -1
  196. package/dist/entry/cortex-cli.js +1 -1
  197. package/dist/entry/daemon.js +4 -4
  198. package/dist/entry/hook-cli.js +2 -2
  199. package/dist/entry/production-app-bootstrap.js +1 -1
  200. package/dist/entry/production-evidence-export-cli.js +1 -1
  201. package/dist/entry/signal-cli.js +2 -2
  202. package/dist/tui/index.js +41 -41
  203. package/package.json +3 -3
  204. package/vendor/pi/CHANGELOG.md +330 -0
  205. package/vendor/pi/dist/codemode-worker.js +2 -0
  206. package/vendor/pi/dist/core/export-html/ansi-to-html.js +57 -20
  207. package/vendor/pi/dist/core/export-html/template.css +9 -0
  208. package/vendor/pi/dist/core/export-html/template.js +166 -46
  209. package/vendor/pi/dist/core/export-html/tool-renderer.js +5 -3
  210. package/vendor/pi/dist/core/extensions/loader.js +1 -1
  211. package/vendor/pi/dist/extensions/codemode/execute.js +15 -13
  212. package/vendor/pi/dist/modes/interactive/theme/theme.js +36 -23
  213. package/vendor/pi/dist/utils/image-resize-worker.js +1 -1
  214. package/vendor/pi/dist/utils/image-resize.js +1 -1
  215. package/vendor/pi/docs/cli.md +35 -12
  216. package/vendor/pi/docs/custom-provider.md +2 -0
  217. package/vendor/pi/docs/environment-variables.md +2 -0
  218. package/vendor/pi/docs/extensions.md +3192 -225
  219. package/vendor/pi/docs/keybindings.md +2 -2
  220. package/vendor/pi/docs/llama-cpp.md +27 -19
  221. package/vendor/pi/docs/mcp.md +6 -4
  222. package/vendor/pi/docs/message-types.md +1 -1
  223. package/vendor/pi/docs/models-configuration.md +9 -3
  224. package/vendor/pi/docs/models.md +2 -1
  225. package/vendor/pi/docs/nvidia-rtx-llama-cpp.md +5 -5
  226. package/vendor/pi/docs/packages.md +24 -0
  227. package/vendor/pi/docs/prompt-templates.md +1 -1
  228. package/vendor/pi/docs/providers.md +4 -2
  229. package/vendor/pi/docs/quickstart.md +7 -3
  230. package/vendor/pi/docs/rpc-commands.md +1 -1
  231. package/vendor/pi/docs/rpc.md +4 -2
  232. package/vendor/pi/docs/sessions.md +17 -3
  233. package/vendor/pi/docs/settings.md +6 -5
  234. package/vendor/pi/docs/slash-commands.md +3 -2
  235. package/vendor/pi/docs/terminal-setup.md +3 -1
  236. package/vendor/pi/docs/tmux.md +6 -0
  237. package/vendor/pi/docs/tui.md +4 -0
  238. package/vendor/pi/docs/windows.md +27 -0
  239. package/vendor/pi/examples/extensions/README.md +2 -1
  240. package/vendor/pi/examples/extensions/custom-provider-anthropic/index.ts +27 -31
  241. package/vendor/pi/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  242. package/vendor/pi/examples/extensions/custom-provider-anthropic/package.json +1 -1
  243. package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  244. package/vendor/pi/examples/extensions/debug-provider.ts +2 -2
  245. package/vendor/pi/examples/extensions/gondolin/index.ts +4 -7
  246. package/vendor/pi/examples/extensions/gondolin/package-lock.json +19 -29
  247. package/vendor/pi/examples/extensions/gondolin/package.json +2 -2
  248. package/vendor/pi/examples/extensions/plan-mode/index.ts +23 -13
  249. package/vendor/pi/examples/extensions/plan-mode/utils.ts +42 -16
  250. package/vendor/pi/examples/extensions/preset.ts +2 -0
  251. package/vendor/pi/examples/extensions/reload-runtime.ts +17 -5
  252. package/vendor/pi/examples/extensions/subagent/README.md +14 -11
  253. package/vendor/pi/examples/extensions/subagent/index.ts +392 -171
  254. package/vendor/pi/examples/extensions/todo.ts +7 -0
  255. package/vendor/pi/examples/extensions/tools.ts +2 -0
  256. package/vendor/pi/examples/extensions/with-deps/package-lock.json +2 -2
  257. package/vendor/pi/examples/extensions/with-deps/package.json +1 -1
  258. package/vendor/pi/examples/tsconfig.json +208 -0
  259. package/vendor/pi/package.json +15 -16
  260. package/vendor/pi/schemas/models.schema.json +66 -37
  261. package/vendor/pi/schemas/settings.schema.json +18 -1
  262. package/vendor/pi-ai/bedrock.js +1 -1
  263. package/vendor/pi-ai/oauth-load.js +1 -1
  264. package/web/dist/assets/{board-math-css-BPXakv_3.js → board-math-css-DKX6FcUS.js} +1 -1
  265. package/web/dist/assets/index-D11wi0uG.js +540 -0
  266. package/web/dist/assets/index-JedYumhY.css +1 -0
  267. package/web/dist/assets/{index-WCm6wwmM.js → index-jl30Gy8P.js} +1 -1
  268. package/web/dist/assets/pdf-worker-DdZgk2mV.js +57 -0
  269. package/web/dist/assets/pdf.worker.min-Bz_KHX45.js +55 -0
  270. package/web/dist/index.html +2 -2
  271. package/web/dist/theme.css +22 -0
  272. package/dist/chunks/anthropic-messages-M3SMXACA.js +0 -8
  273. package/dist/chunks/api-GM53PHIL-GFHEXXE6.js +0 -4
  274. package/dist/chunks/azure-openai-responses-76YWXHSB.js +0 -4
  275. package/dist/chunks/bedrock-converse-stream-5UPX4NTQ.js +0 -58
  276. package/dist/chunks/child-runner-3GHOWGZP.js +0 -4
  277. package/dist/chunks/chunk-2ZNLUY2U.js +0 -128
  278. package/dist/chunks/chunk-3F6WW7HR.js +0 -13
  279. package/dist/chunks/chunk-3OKHUVEM.js +0 -7
  280. package/dist/chunks/chunk-3YHOCPQU.js +0 -10
  281. package/dist/chunks/chunk-4EX2JJWB.js +0 -4
  282. package/dist/chunks/chunk-4LLH5OWM.js +0 -10
  283. package/dist/chunks/chunk-52T37Y47.js +0 -8
  284. package/dist/chunks/chunk-7MU2AKNM.js +0 -4
  285. package/dist/chunks/chunk-AAA3UBIS.js +0 -4
  286. package/dist/chunks/chunk-ASYQHJVQ.js +0 -9
  287. package/dist/chunks/chunk-BKHDWCRT.js +0 -79
  288. package/dist/chunks/chunk-CQLH4UVX.js +0 -4
  289. package/dist/chunks/chunk-CVC66CFV.js +0 -33
  290. package/dist/chunks/chunk-D6UA4BZC.js +0 -19
  291. package/dist/chunks/chunk-DGMNI4AO.js +0 -4
  292. package/dist/chunks/chunk-DHSA5ACV.js +0 -125
  293. package/dist/chunks/chunk-DPQPXBTP.js +0 -68
  294. package/dist/chunks/chunk-DXBSQXJL.js +0 -18
  295. package/dist/chunks/chunk-E7ZMYIY6.js +0 -30
  296. package/dist/chunks/chunk-EQITBTJC.js +0 -10
  297. package/dist/chunks/chunk-EXJA5RIX.js +0 -357
  298. package/dist/chunks/chunk-FF7UELTU.js +0 -4
  299. package/dist/chunks/chunk-FH74NME3.js +0 -115
  300. package/dist/chunks/chunk-FOQ7VLIL.js +0 -17
  301. package/dist/chunks/chunk-FX6MOGLR.js +0 -11
  302. package/dist/chunks/chunk-G2V65UBA.js +0 -4
  303. package/dist/chunks/chunk-HGPBHTVD.js +0 -6
  304. package/dist/chunks/chunk-J5DVLUKY.js +0 -6
  305. package/dist/chunks/chunk-JW2HFMTF.js +0 -4
  306. package/dist/chunks/chunk-KDYEGGMW.js +0 -4
  307. package/dist/chunks/chunk-KIGMAATV.js +0 -23
  308. package/dist/chunks/chunk-KIU5FAPY.js +0 -5
  309. package/dist/chunks/chunk-KIWMQPH7.js +0 -739
  310. package/dist/chunks/chunk-L6VCIGWS.js +0 -11
  311. package/dist/chunks/chunk-LACGULCN.js +0 -10
  312. package/dist/chunks/chunk-LMSQZ6TQ.js +0 -4
  313. package/dist/chunks/chunk-MEPASGPP.js +0 -6
  314. package/dist/chunks/chunk-MFAEUHMV.js +0 -28
  315. package/dist/chunks/chunk-NAA7GF6Q.js +0 -5
  316. package/dist/chunks/chunk-NKDMKRSB.js +0 -68
  317. package/dist/chunks/chunk-NKXV32S6.js +0 -4
  318. package/dist/chunks/chunk-NVX5IPRN.js +0 -4
  319. package/dist/chunks/chunk-O3JW2F7D.js +0 -8
  320. package/dist/chunks/chunk-OE4KH3NJ.js +0 -4
  321. package/dist/chunks/chunk-OISO5JXB.js +0 -4
  322. package/dist/chunks/chunk-OPYXNSMY.js +0 -4
  323. package/dist/chunks/chunk-OSEIQ7SS.js +0 -4
  324. package/dist/chunks/chunk-P52RMIYX.js +0 -6
  325. package/dist/chunks/chunk-PBJ5MPPX.js +0 -60
  326. package/dist/chunks/chunk-PZMGBKUR.js +0 -13
  327. package/dist/chunks/chunk-PZMXHA6X.js +0 -9
  328. package/dist/chunks/chunk-Q7CE3UIE.js +0 -133
  329. package/dist/chunks/chunk-QBKCAIJG.js +0 -4
  330. package/dist/chunks/chunk-QEOFEETJ.js +0 -4
  331. package/dist/chunks/chunk-QUUEQRIT.js +0 -4
  332. package/dist/chunks/chunk-RA6HKFBV.js +0 -4
  333. package/dist/chunks/chunk-REPYBMQS.js +0 -4
  334. package/dist/chunks/chunk-SKHLZ6XY.js +0 -9
  335. package/dist/chunks/chunk-TAWLERZA.js +0 -4
  336. package/dist/chunks/chunk-TWAEABGG.js +0 -52
  337. package/dist/chunks/chunk-TZFLHVOQ.js +0 -7
  338. package/dist/chunks/chunk-UD3NMUHR.js +0 -12
  339. package/dist/chunks/chunk-UNVEZI57.js +0 -4
  340. package/dist/chunks/chunk-VQUPKMDR.js +0 -4
  341. package/dist/chunks/chunk-W25TB3PU.js +0 -4
  342. package/dist/chunks/chunk-W5LGYSPZ.js +0 -4
  343. package/dist/chunks/chunk-WEZWKMYU.js +0 -4
  344. package/dist/chunks/chunk-XAJLZR7C.js +0 -28
  345. package/dist/chunks/chunk-XH6FMP3N.js +0 -71
  346. package/dist/chunks/chunk-XSRZHN63.js +0 -4
  347. package/dist/chunks/chunk-Y3GFB5XM.js +0 -8
  348. package/dist/chunks/chunk-YG7OEPR2.js +0 -6
  349. package/dist/chunks/chunk-YHIWOGVL.js +0 -4
  350. package/dist/chunks/chunk-YKKEI5GI.js +0 -4
  351. package/dist/chunks/chunk-YZSHTWNM.js +0 -92
  352. package/dist/chunks/chunk-Z4H3VDHI.js +0 -4
  353. package/dist/chunks/cli-5DBTRMHU.js +0 -53
  354. package/dist/chunks/client-XOGYH5UR.js +0 -4
  355. package/dist/chunks/cloudflare-workers-ai-system-one-32JCFHI3.js +0 -4
  356. package/dist/chunks/config-DJSQI77S-335IXHSM.js +0 -4
  357. package/dist/chunks/context-VCQH5OB6.js +0 -4
  358. package/dist/chunks/cost-PGGFI7QJ.js +0 -5
  359. package/dist/chunks/dist-PUKMZ7GW.js +0 -4
  360. package/dist/chunks/easter-egg-3d-MO4MOEVF.js +0 -4
  361. package/dist/chunks/es5-VNTQPCKX.js +0 -4
  362. package/dist/chunks/file-7BN7RCAY.js +0 -4
  363. package/dist/chunks/gateway-UCRPMR75.js +0 -36
  364. package/dist/chunks/github-copilot-HAI2DA62.js +0 -4
  365. package/dist/chunks/google-generative-ai-2VXWLHWI.js +0 -4
  366. package/dist/chunks/google-vertex-UA36QP2U.js +0 -4
  367. package/dist/chunks/init-HA7FAQ73.js +0 -4
  368. package/dist/chunks/kimi-coding-HMJRKCPA.js +0 -4
  369. package/dist/chunks/local-client-stop-SQRU7ZZM.js +0 -4
  370. package/dist/chunks/meta-KY3LNFV2.js +0 -4
  371. package/dist/chunks/mistral-conversations-34F66L3O.js +0 -7
  372. package/dist/chunks/model-resolver-N3DTAQ2S.js +0 -4
  373. package/dist/chunks/openai-codex-responses-ZBVHREB3.js +0 -12
  374. package/dist/chunks/openai-completions-VVIB26SH.js +0 -9
  375. package/dist/chunks/openai-responses-735XA2ZX.js +0 -6
  376. package/dist/chunks/openrouter-images-3IKETHAC.js +0 -4
  377. package/dist/chunks/pi-messages-I3E4ZFHA.js +0 -10
  378. package/dist/chunks/radius-HXRZVBDB.js +0 -4
  379. package/dist/chunks/remote-ops-BALZYKH6.js +0 -14
  380. package/dist/chunks/runner-PLVZDGHB.js +0 -4
  381. package/dist/chunks/runtime-6YLTA2ZD.js +0 -4
  382. package/dist/chunks/schedule-cli-OLASBBYJ.js +0 -4
  383. package/dist/chunks/slack-WAGSPZUX.js +0 -4
  384. package/dist/chunks/start-ui-http-QALT7C3P.js +0 -43
  385. package/dist/chunks/subagent-E3UC7ZHC.js +0 -4
  386. package/dist/chunks/tool-shims-Q6P6UXVC.js +0 -4
  387. package/dist/chunks/typesafe-system-one-6ULACYD4.js +0 -4
  388. package/dist/chunks/ui-board-4GYW6KKW.js +0 -5
  389. package/dist/chunks/ui-decision-U2FXSEC2.js +0 -4
  390. package/dist/chunks/ui-view-O7PLANT7.js +0 -4
  391. package/dist/chunks/virtual-modules-IDC5YKZJ.js +0 -4
  392. package/dist/chunks/waitpoint-2FGQBIAC.js +0 -5
  393. package/dist/chunks/workers-XN4PSTH6.js +0 -4
  394. package/vendor/aistatus/gateway-cli.js +0 -21
  395. package/vendor/pi/examples/extensions/sandbox/index.ts +0 -321
  396. package/vendor/pi/examples/extensions/sandbox/package-lock.json +0 -92
  397. package/vendor/pi/examples/extensions/sandbox/package.json +0 -19
  398. package/web/dist/assets/index-BHZpFXhc.js +0 -525
  399. package/web/dist/assets/index-DqWMdMkh.css +0 -1
  400. package/web/dist/assets/pdf-worker-Hp15W1QJ.js +0 -57
  401. package/web/dist/assets/pdf.worker.min-DnhTvCwe.js +0 -55
@@ -0,0 +1,57 @@
1
+ var d_=Object.defineProperty;var _y=u=>{throw TypeError(u)};var f_=(u,t,e)=>t in u?d_(u,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[t]=e;var O=(u,t,e)=>f_(u,typeof t!="symbol"?t+"":t,e),Fg=(u,t,e)=>t.has(u)||_y("Cannot "+e);var r=(u,t,e)=>(Fg(u,t,"read from private field"),e?e.call(u):t.get(u)),y=(u,t,e)=>t.has(u)?_y("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(u):t.set(u,e),p=(u,t,e,s)=>(Fg(u,t,"write to private field"),s?s.call(u,e):t.set(u,e),e),b=(u,t,e)=>(Fg(u,t,"access private method"),e);var Ft=(u,t,e,s)=>({set _(i){p(u,t,i,e)},get _(){return r(u,t,s)}});function p_(u){return new Worker("/assets/pdf.worker.min-Bz_KHX45.js",{name:u==null?void 0:u.name})}var g_={463(u){var t=TypeError;u.exports=function(e){if(typeof e=="string")return e;throw new t("Argument is not a string")}},804(u){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=t+"+/",s=t+"-_",i=function(n){for(var a={},o=0;o<64;o++)a[n.charAt(o)]=o;return a};u.exports={i2c:e,c2i:i(e),i2cUrl:s,c2iUrl:i(s)}},529(u){u.exports=function(t,e){return{value:t,done:e}}},837(u){var t=TypeError,e=9007199254740991;u.exports=function(s){if(s>e)throw new t("Maximum allowed index exceeded");return s}},2(u){u.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},944(u){var t=TypeError;u.exports=function(e){var s=e&&e.alphabet;if(s===void 0||s==="base64"||s==="base64url")return s||"base64";throw new t("Incorrect `alphabet` option")}},767(u){u.exports=function(t){return{iterator:t,next:t.next,done:!1}}},117(u){u.exports=function(t){return t==null}},859(u){u.exports=function(t){t.iterator=t.next=t.nextHandler=t.mapper=t.predicate=t.inner=t.iterables=t.iters=t.openIters=t.padding=t.finishResults=t.buffer=null}},684(u){u.exports=function(t,e){var s=typeof Iterator=="function"&&Iterator.prototype[t];if(s)try{s.call({next:null},e).next()}catch{return!0}}},269(u){u.exports=Object.create?Object.create(null):{}},741(u){var t=Math.ceil,e=Math.floor;u.exports=Math.trunc||function(i){var n=+i;return(n>0?e:t)(n)}},149(u){var t=RangeError;u.exports=function(e){if(e===e)return e;throw new t("NaN is not allowed")}},717(u,t){t.f=Object.getOwnPropertySymbols},103(u){u.exports=function(t){try{return{error:!1,value:t()}}catch(e){return{error:!0,value:e}}}},750(u,t,e){var s=e(117),i=TypeError;u.exports=function(n){if(s(n))throw new i("Can't call method on "+n);return n}},835(u){u.exports=function(t){try{var e=new Set,s={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return e.clear(),e.add(4),function(){return{done:!0}}}})}},i=e[t](s);return i.size===1&&i.values().next().value===4}catch{return!1}}},291(u,t,e){var s=e(741);u.exports=function(i){var n=+i;return n!==n||n===0?0:s(n)}},14(u,t,e){var s=e(291),i=Math.min;u.exports=function(n){var a=s(n);return a>0?i(a,9007199254740991):0}},981(u,t,e){var s=e(750),i=Object;u.exports=function(n){return i(s(n))}},590(u,t,e){var s=e(291),i=RangeError;u.exports=function(n){var a=s(n);if(a<0)throw new i("The argument can't be less than 0");return a}},812(u){var t=TypeError;u.exports=function(e,s){if(e<s)throw new t("Not enough arguments");return e}}};const Sy={};function P(u){const t=Sy[u];if(t!==void 0)return t.exports;const e=Sy[u]={exports:{}};return g_[u](e,e.exports,P),e.exports}P.cw=u=>{var t;return()=>{if(u){var e=u;u=0,t={exports:{}},e.call(t.exports,t,t.exports)}return t.exports}};P.d=(u,t)=>{for(var e in t)P.o(t,e)&&!P.o(u,e)&&Object.defineProperty(u,e,{enumerable:!0,get:t[e]})};P.o=(u,t)=>Object.prototype.hasOwnProperty.call(u,t);var cs=P.cw(function(u,t){var e=Se(),s=fg(),i=TypeError;u.exports=function(n){if(e(n))return n;throw new i(s(n)+" is not a function")}}),m_=P.cw(function(u,t){var e=Y_(),s=String,i=TypeError;u.exports=function(n){if(e(n))return n;throw new i("Can't set "+s(n)+" as a prototype")}}),_l=P.cw(function(u,t){var e=Er().has;u.exports=function(s){return e(s),s}}),ib=()=>P(463),v_=P.cw(function(u,t){var e=gg(),s=new e.WeakMap,i=e.set,n=e.remove;u.exports=function(a){return i(s,a,1),n(s,a),a}}),y_=P.cw(function(u,t){var e=gg().has;u.exports=function(s){return e(s),s}}),b_=P.cw(function(u,t){var e=Ui(),s=lg(),i=Ma().f,n=e("unscopables"),a=Array.prototype;a[n]===void 0&&i(a,n,{configurable:!0,value:s(null)}),u.exports=function(o){a[n][o]=!0}}),rb=P.cw(function(u,t){var e=cg(),s=TypeError;u.exports=function(i,n){if(e(n,i))return i;throw new s("Incorrect invocation")}}),nb=P.cw(function(u,t){var e=ds(),s=String,i=TypeError;u.exports=function(n){if(n===void 0||e(n))return n;throw new i(s(n)+" is not an object or undefined")}}),ae=P.cw(function(u,t){var e=ds(),s=String,i=TypeError;u.exports=function(n){if(e(n))return n;throw new i(s(n)+" is not an object")}}),Zp=P.cw(function(u,t){var e=eg(),s=TypeError;u.exports=function(i){if(e(i)==="Uint8Array")return i;throw new s("Argument is not an Uint8Array")}}),ab=P.cw(function(u,t){u.exports=typeof ArrayBuffer<"u"&&typeof DataView<"u"}),w_=P.cw(function(u,t){var e=Ut(),s=Bv(),i=Sl(),n=e.ArrayBuffer,a=e.TypeError;u.exports=n&&s(n.prototype,"byteLength","get")||function(o){if(i(o)!=="ArrayBuffer")throw new a("ArrayBuffer expected");return o.byteLength}}),A_=P.cw(function(u,t){var e=Ut(),s=ab(),i=w_(),n=e.DataView;u.exports=function(a){if(!s||i(a)!==0)return!1;try{return new n(a),!1}catch{return!0}}}),tg=P.cw(function(u,t){var e=A_(),s=TypeError;u.exports=function(i){if(e(i))throw new s("ArrayBuffer is detached");return i}}),__=P.cw(function(u,t){var e=ab(),s=hs(),i=Ut(),n=Se(),a=ds(),o=us(),l=eg(),c=fg(),h=sg(),d=rg(),f=cb(),g=cg(),m=Gv(),v=Ab(),w=Ui(),A=pg(),_=og(),E=_.enforce,S=_.get,x=i.Int8Array,T=x&&x.prototype,C=i.Uint8ClampedArray,I=C&&C.prototype,k=x&&m(x),M=T&&m(T),R=Object.prototype,N=i.TypeError,F=w("toStringTag"),$=A("TYPED_ARRAY_TAG"),U="TypedArrayConstructor",D=e&&!!v&&l(i.opera)!=="Opera",H=!1,X,nt,gt,mt={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ht={BigInt64Array:8,BigUint64Array:8},at=function(ut){if(!a(ut))return!1;var xt=l(ut);return xt==="DataView"||o(mt,xt)||o(ht,xt)},Ee=function(tt){var ut=m(tt);if(a(ut)){var xt=S(ut);return xt&&o(xt,U)?xt[U]:Ee(ut)}},G=function(tt){if(!a(tt))return!1;var ut=l(tt);return o(mt,ut)||o(ht,ut)},L=function(tt){if(G(tt))return tt;throw new N("Target is not a typed array")},B=function(tt){if(n(tt)&&(!v||g(k,tt)))return tt;throw new N(c(tt)+" is not a typed array constructor")},rt=function(tt,ut,xt,xe){if(s){if(xt)for(var ye in mt){var he=i[ye];if(he&&o(he.prototype,tt))try{delete he.prototype[tt]}catch{try{he.prototype[tt]=ut}catch{}}}(!M[tt]||xt)&&d(M,tt,xt?ut:D&&T[tt]||ut,xe)}},bt=function(tt,ut,xt){var xe,ye;if(s){if(v){if(xt){for(xe in mt)if(ye=i[xe],ye&&o(ye,tt))try{delete ye[tt]}catch{}}if(!k[tt]||xt)try{return d(k,tt,xt?ut:D&&k[tt]||ut)}catch{}else return}for(xe in mt)ye=i[xe],ye&&(!ye[tt]||xt)&&d(ye,tt,ut)}};for(X in mt)nt=i[X],gt=nt&&nt.prototype,gt?E(gt)[U]=nt:D=!1;for(X in ht)nt=i[X],gt=nt&&nt.prototype,gt&&(E(gt)[U]=nt);if((!D||!n(k)||k===Function.prototype)&&(k=function(){throw new N("Incorrect invocation")},D))for(X in mt)i[X]&&v(i[X],k);if((!D||!M||M===R)&&(M=k.prototype,D))for(X in mt)i[X]&&v(i[X].prototype,M);if(D&&m(I)!==M&&v(I,M),s&&!o(M,F)){H=!0,f(M,F,{configurable:!0,get:function(){return a(this)?this[$]:void 0}});for(X in mt)i[X]&&h(i[X].prototype,$,X)}u.exports={NATIVE_ARRAY_BUFFER_VIEWS:D,TYPED_ARRAY_TAG:H&&$,aTypedArray:L,aTypedArrayConstructor:B,exportTypedArrayMethod:rt,exportTypedArrayStaticMethod:bt,getTypedArrayConstructor:Ee,isView:at,isTypedArray:G,TypedArray:k,TypedArrayPrototype:M}}),S_=P.cw(function(u,t){var e=Ch();u.exports=function(s,i,n){for(var a=0,o=arguments.length>2?n:e(i),l=new s(o);o>a;)l[a]=i[a++];return l}}),Dv=P.cw(function(u,t){var e=ug(),s=y0(),i=Ch(),n=function(a){return function(o,l,c){var h=e(o),d=i(h);if(d===0)return!a&&-1;var f=s(c,d),g;if(a&&l!==l){for(;d>f;)if(g=h[f++],g!==g)return!0}else for(;d>f;f++)if((a||f in h)&&h[f]===l)return a||f||0;return!a&&-1}};u.exports={includes:n(!0),indexOf:n(!1)}}),E_=P.cw(function(u,t){var e=hs(),s=jv(),i=TypeError,n=Object.getOwnPropertyDescriptor,a=e&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(o){return o instanceof TypeError}}();u.exports=a?function(o,l){if(s(o)&&!n(o,"length").writable)throw new i("Cannot set read only .length");return o.length=l}:function(o,l){return o.length=l}}),x_=P.cw(function(u,t){var e=Bt();u.exports=e([].slice)}),ob=()=>P(804),lb=P.cw(function(u,t){var e=ae(),s=fs();u.exports=function(i,n,a,o){try{return o?n(e(a)[0],a[1]):n(a)}catch(l){s(i,"throw",l)}}}),Sl=P.cw(function(u,t){var e=Bt(),s=e({}.toString),i=e("".slice);u.exports=function(n){return i(s(n),8,-1)}}),eg=P.cw(function(u,t){var e=A0(),s=Se(),i=Sl(),n=Ui(),a=n("toStringTag"),o=Object,l=i(function(){return arguments}())==="Arguments",c=function(h,d){try{return h[d]}catch{}};u.exports=e?i:function(h){var d,f,g;return h===void 0?"Undefined":h===null?"Null":typeof(f=c(d=o(h),a))=="string"?f:l?i(d):(g=i(d))==="Object"&&s(d.callee)?"Arguments":g}}),T_=P.cw(function(u,t){var e=us(),s=o0(),i=bb(),n=Ma();u.exports=function(a,o,l){for(var c=s(o),h=n.f,d=i.f,f=0;f<c.length;f++){var g=c[f];!e(a,g)&&!(l&&e(l,g))&&h(a,g,d(o,g))}}}),C_=P.cw(function(u,t){var e=le();u.exports=!e(function(){function s(){}return s.prototype.constructor=null,Object.getPrototypeOf(new s)!==s.prototype})}),P_=()=>P(529),sg=P.cw(function(u,t){var e=hs(),s=Ma(),i=ig();u.exports=e?function(n,a,o){return s.f(n,a,i(1,o))}:function(n,a,o){return n[a]=o,n}}),ig=P.cw(function(u,t){u.exports=function(e,s){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:s}}}),Fv=P.cw(function(u,t){var e=hs(),s=Ma(),i=ig();u.exports=function(n,a,o){e?s.f(n,a,i(0,o)):n[a]=o}}),cb=P.cw(function(u,t){var e=gb(),s=Ma();u.exports=function(i,n,a){return a.get&&e(a.get,n,{getter:!0}),a.set&&e(a.set,n,{setter:!0}),s.f(i,n,a)}}),rg=P.cw(function(u,t){var e=Se(),s=Ma(),i=gb(),n=Lv();u.exports=function(a,o,l,c){c||(c={});var h=c.enumerable,d=c.name!==void 0?c.name:o;if(e(l)&&i(l,d,c),c.global)h?a[o]=l:n(o,l);else{try{c.unsafe?a[o]&&(h=!0):delete a[o]}catch{}h?a[o]=l:s.f(a,o,{value:l,enumerable:!1,configurable:!c.nonConfigurable,writable:!c.nonWritable})}return a}}),I_=P.cw(function(u,t){var e=rg();u.exports=function(s,i,n){for(var a in i)e(s,a,i[a],n);return s}}),Lv=P.cw(function(u,t){var e=Ut(),s=Object.defineProperty;u.exports=function(i,n){try{s(e,i,{value:n,configurable:!0,writable:!0})}catch{e[i]=n}return n}}),hs=P.cw(function(u,t){var e=le();u.exports=!e(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})}),hb=P.cw(function(u,t){var e=Ut(),s=ds(),i=e.document,n=s(i)&&s(i.createElement);u.exports=function(a){return n?i.createElement(a):{}}}),k_=()=>P(837),M_=()=>P(2),Nv=P.cw(function(u,t){u.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]}),O_=P.cw(function(u,t){var e=Ut(),s=e.navigator,i=s&&s.userAgent;u.exports=i?String(i):""}),R_=P.cw(function(u,t){var e=Ut(),s=O_(),i=e.process,n=e.Deno,a=i&&i.versions||n&&n.version,o=a&&a.v8,l,c;o&&(l=o.split("."),c=l[0]>0&&l[0]<4?1:+(l[0]+l[1])),!c&&s&&(l=s.match(/Edge\/(\d+)/),(!l||l[1]>=74)&&(l=s.match(/Chrome\/(\d+)/),l&&(c=+l[1]))),u.exports=c}),D_=P.cw(function(u,t){var e=Bt(),s=Error,i=e("".replace),n=function(l){return String(new s(l).stack)}("zxcasd"),a=/\n\s*at [^:]*:[^\n]*/,o=a.test(n);u.exports=function(l,c){if(o&&typeof l=="string"&&!s.prepareStackTrace)for(;c--;)l=i(l,a,"");return l}}),pt=P.cw(function(u,t){var e=Ut(),s=bb().f,i=sg(),n=rg(),a=Lv(),o=T_(),l=X_();u.exports=function(c,h){var d=c.target,f=c.global,g=c.stat,m,v,w,A,_,E;if(f?v=e:g?v=e[d]||a(d,{}):v=e[d]&&e[d].prototype,v)for(w in h){if(_=h[w],c.dontCallGetSet?(E=s(v,w),A=E&&E.value):A=v[w],m=l(f?w:d+(g?".":"#")+w,c.forced),!m&&A!==void 0){if(typeof _==typeof A)continue;o(_,A)}(c.sham||A&&A.sham)&&i(_,"sham",!0),n(v,w,_,c)}}}),le=P.cw(function(u,t){u.exports=function(e){try{return!!e()}catch{return!0}}}),F_=P.cw(function(u,t){var e=ng(),s=Function.prototype,i=s.apply,n=s.call;u.exports=typeof Reflect=="object"&&Reflect.apply||(e?n.bind(i):function(){return n.apply(i,arguments)})}),L_=P.cw(function(u,t){var e=B_(),s=cs(),i=ng(),n=e(e.bind);u.exports=function(a,o){return s(a),o===void 0?a:i?n(a,o):function(){return a.apply(o,arguments)}}}),ng=P.cw(function(u,t){var e=le();u.exports=!e(function(){var s=(function(){}).bind();return typeof s!="function"||s.hasOwnProperty("prototype")})}),ce=P.cw(function(u,t){var e=ng(),s=Function.prototype.call;u.exports=e?s.bind(s):function(){return s.apply(s,arguments)}}),N_=P.cw(function(u,t){var e=hs(),s=us(),i=Function.prototype,n=e&&Object.getOwnPropertyDescriptor,a=s(i,"name"),o=a&&(!e||e&&n(i,"name").configurable);u.exports={CONFIGURABLE:o}}),Bv=P.cw(function(u,t){var e=Bt(),s=cs();u.exports=function(i,n,a){try{return e(s(Object.getOwnPropertyDescriptor(i,n)[a]))}catch{}}}),B_=P.cw(function(u,t){var e=Sl(),s=Bt();u.exports=function(i){if(e(i)==="Function")return s(i)}}),Bt=P.cw(function(u,t){var e=ng(),s=Function.prototype,i=s.call,n=e&&s.bind.bind(i,i);u.exports=e?n:function(a){return function(){return i.apply(a,arguments)}}}),ub=()=>P(944),ka=P.cw(function(u,t){var e=Ut(),s=Se(),i=function(n){return s(n)?n:void 0};u.exports=function(n,a){return arguments.length<2?i(e[n]):e[n]&&e[n][a]}}),mi=()=>P(767),U_=P.cw(function(u,t){var e=ce(),s=ae(),i=mi(),n=Uv();u.exports=function(a,o){(!o||typeof a!="string")&&s(a);var l=n(a);return i(s(l!==void 0?e(l,a):a))}}),H_=P.cw(function(u,t){var e=ce(),s=Se(),i=ae(),n=fg(),a=Uv(),o=TypeError;u.exports=function(l,c){var h=arguments.length<2?a(l):c;if(s(h))return i(e(h,l));throw new o(n(l)+" is not iterable")}}),Uv=P.cw(function(u,t){var e=Sl(),s=fb(),i=ag(),n=Ui(),a=n("iterator"),o=Array.prototype;u.exports=function(l){if(!s(l))return i(l,a)||i(l,"@@iterator")||(e(l)==="Arguments"?o[a]:void 0)}}),ag=P.cw(function(u,t){var e=cs(),s=fb();u.exports=function(i,n){var a=i[n];return s(a)?void 0:e(a)}}),El=P.cw(function(u,t){var e=cs(),s=ae(),i=ce(),n=Xv(),a=mi(),o="Invalid size",l=RangeError,c=TypeError,h=Math.max,d=function(f,g){this.set=f,this.size=h(g,0),this.has=e(f.has),this.keys=e(f.keys)};d.prototype={getIterator:function(){return a(s(i(this.keys,this.set)))},includes:function(f){return i(this.has,this.set,f)}},u.exports=function(f){s(f);var g=+f.size;if(g!==g)throw new c(o);var m=n(g);if(m<0)throw new l(o);return new d(f,m)}}),Ut=P.cw(function(u,t){var e=function(s){return s&&s.Math===Math&&s};u.exports=e(typeof globalThis=="object"&&globalThis)||e(typeof window=="object"&&window)||e(typeof self=="object"&&self)||e(typeof global=="object"&&global)||e(typeof this=="object"&&this)||function(){return this}()||Function("return this")()}),us=P.cw(function(u,t){var e=Bt(),s=Yv(),i=e({}.hasOwnProperty);u.exports=Object.hasOwn||function(a,o){return i(s(a),o)}}),Hv=P.cw(function(u,t){u.exports={}}),j_=P.cw(function(u,t){var e=ka();u.exports=e("document","documentElement")}),db=P.cw(function(u,t){var e=hs(),s=le(),i=hb();u.exports=!e&&!s(function(){return Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a!==7})}),$_=P.cw(function(u,t){var e=Bt(),s=le(),i=Sl(),n=Object,a=e("".split);u.exports=s(function(){return!n("z").propertyIsEnumerable(0)})?function(o){return i(o)==="String"?a(o,""):n(o)}:n}),G_=P.cw(function(u,t){var e=Se(),s=ds(),i=Ab();u.exports=function(n,a,o){var l,c;return i&&e(l=a.constructor)&&l!==o&&s(c=l.prototype)&&c!==o.prototype&&i(n,c),n}}),z_=P.cw(function(u,t){var e=Bt(),s=Se(),i=Wv(),n=e(Function.toString);s(i.inspectSource)||(i.inspectSource=function(a){return n(a)}),u.exports=i.inspectSource}),og=P.cw(function(u,t){var e=x0(),s=Ut(),i=ds(),n=sg(),a=us(),o=Wv(),l=Vv(),c=Hv(),h="Object already initialized",d=s.TypeError,f=s.WeakMap,g,m,v,w=function(S){return v(S)?m(S):g(S,{})},A=function(S){return function(x){var T;if(!i(x)||(T=m(x)).type!==S)throw new d("Incompatible receiver, "+S+" required");return T}};if(e||o.state){var _=o.state||(o.state=new f);_.get=_.get,_.has=_.has,_.set=_.set,g=function(S,x){if(_.has(S))throw new d(h);return x.facade=S,_.set(S,x),x},m=function(S){return _.get(S)||{}},v=function(S){return _.has(S)}}else{var E=l("state");c[E]=!0,g=function(S,x){if(a(S,E))throw new d(h);return x.facade=S,n(S,E,x),x},m=function(S){return a(S,E)?S[E]:{}},v=function(S){return a(S,E)}}u.exports={set:g,get:m,has:v,enforce:w,getterFor:A}}),V_=P.cw(function(u,t){var e=Ui(),s=Q_(),i=e("iterator"),n=Array.prototype;u.exports=function(a){return a!==void 0&&(s.Array===a||n[i]===a)}}),jv=P.cw(function(u,t){var e=Sl();u.exports=Array.isArray||function(i){return e(i)==="Array"}}),W_=P.cw(function(u,t){var e=eg();u.exports=function(s){var i=e(s);return i==="BigInt64Array"||i==="BigUint64Array"}}),Se=P.cw(function(u,t){var e=typeof document=="object"&&document.all;u.exports=typeof e>"u"&&e!==void 0?function(s){return typeof s=="function"||s===e}:function(s){return typeof s=="function"}}),X_=P.cw(function(u,t){var e=le(),s=Se(),i=/#|\.prototype\./,n=function(h,d){var f=o[a(h)];return f===c?!0:f===l?!1:s(d)?e(d):!!d},a=n.normalize=function(h){return String(h).replace(i,".").toLowerCase()},o=n.data={},l=n.NATIVE="N",c=n.POLYFILL="P";u.exports=n}),fb=()=>P(117),ds=P.cw(function(u,t){var e=Se();u.exports=function(s){return typeof s=="object"?s!==null:e(s)}}),Y_=P.cw(function(u,t){var e=ds();u.exports=function(s){return e(s)||s===null}}),xs=P.cw(function(u,t){u.exports=!1}),K_=P.cw(function(u,t){var e=ds(),s=og().get;u.exports=function(n){if(!e(n))return!1;var a=s(n);return!!a&&a.type==="RawJSON"}}),$v=P.cw(function(u,t){var e=ka(),s=Se(),i=cg(),n=kb(),a=Object;u.exports=n?function(o){return typeof o=="symbol"}:function(o){var l=e("Symbol");return s(l)&&i(l.prototype,a(o))}}),xl=P.cw(function(u,t){var e=ce();u.exports=function(s,i,n){for(var a=n?s:s.iterator,o=s.next,l,c;!(l=e(o,a)).done;)if(c=i(l.value),c!==void 0)return c}}),Th=P.cw(function(u,t){var e=L_(),s=ce(),i=ae(),n=fg(),a=V_(),o=Ch(),l=cg(),c=H_(),h=Uv(),d=fs(),f=TypeError,g=function(v,w){this.stopped=v,this.result=w},m=g.prototype;u.exports=function(v,w,A){var _=A&&A.that,E=!!(A&&A.AS_ENTRIES),S=!!(A&&A.IS_RECORD),x=!!(A&&A.IS_ITERATOR),T=!!(A&&A.INTERRUPTED),C=e(w,_),I,k,M,R,N,F,$,U=function(X){var nt=I;return I=void 0,nt&&d(nt,"normal"),new g(!0,X)},D=function(X){return E?(i(X),T?C(X[0],X[1],U):C(X[0],X[1])):T?C(X,U):C(X)};if(S)I=v.iterator;else if(x)I=v;else{if(k=h(v),!k)throw new f(n(v)+" is not iterable");if(a(k)){for(M=0,R=o(v);R>M;M++)if(N=D(v[M]),N&&l(m,N))return N;return new g(!1)}I=c(v,k)}for(F=S?v.next:I.next;!($=s(F,I)).done;){var H=$.value;try{N=D(H)}catch(X){if(I)d(I,"throw",X);else throw X}if(typeof N=="object"&&N&&l(m,N))return N}return new g(!1)}}),q_=()=>P(859),J_=P.cw(function(u,t){var e=fs();u.exports=function(s,i,n){for(var a=s.length-1;a>=0;a--)if(s[a]!==void 0)try{n=e(s[a].iterator,i,n)}catch(o){i="throw",n=o}if(i==="throw")throw n;return n}}),fs=P.cw(function(u,t){var e=ce(),s=ae(),i=ag();u.exports=function(n,a,o){var l,c;s(n);try{if(l=i(n,"return"),!l){if(a==="throw")throw o;return o}l=e(l,n)}catch(h){c=!0,l=h}if(a==="throw")throw o;if(c)throw l;return s(l),o}}),cf=P.cw(function(u,t){var e=ce(),s=lg(),i=sg(),n=I_(),a=Ui(),o=og(),l=ag(),c=pb().IteratorPrototype,h=P_(),d=fs(),f=J_(),g=q_(),m=a("toStringTag"),v="IteratorHelper",w="WrapForValidIterator",A="normal",_="throw",E=o.set,S=function(C){var I=o.getterFor(C?w:v);return n(s(c),{next:function(){var M=I(this);if(C)return M.nextHandler();if(M.done)return h(void 0,!0);try{var R=M.nextHandler();return M.done&&g(M),M.returnHandlerResult?R:h(R,M.done)}catch(N){throw M.done=!0,g(M),N}},return:function(){var k=I(this),M=k.iterator,R=k.inner,N=k.openIters,F=k.done;if(k.done=!0,C){var $=l(M,"return");return $?e($,M):h(void 0,!0)}if(g(k),F)return h(void 0,!0);if(R)try{d(R.iterator,A)}catch(U){return d(M,_,U)}if(N)try{f(N,A)}catch(U){if(M)return d(M,_,U);throw U}return M&&d(M,A),h(void 0,!0)}})},x=S(!0),T=S(!1);i(T,m,"Iterator Helper"),u.exports=function(C,I,k){var M=function(N,F){F?(F.iterator=N.iterator,F.next=N.next):F=N,F.type=I?w:v,F.returnHandlerResult=!!k,F.nextHandler=C,F.counter=0,F.done=!1,E(this,F)};return M.prototype=I?x:T,M}}),hf=()=>P(684),An=P.cw(function(u,t){var e=Ut();u.exports=function(s,i){var n=e.Iterator,a=n&&n.prototype,o=a&&a[s],l=!1;if(o)try{o.call({next:function(){return{done:!0}},return:function(){l=!0}},-1)}catch(c){c instanceof i||(l=!1)}if(!l)return o}}),pb=P.cw(function(u,t){var e=le(),s=Se(),i=ds(),n=lg(),a=Gv(),o=rg(),l=Ui(),c=xs(),h=l("iterator"),d,f,g;[].keys&&(g=[].keys(),"next"in g&&(f=a(a(g)),f!==Object.prototype&&(d=f)));var m=!i(d)||e(function(){var v={};return d[h].call(v)!==v});m?d={}:c&&(d=n(d)),s(d[h])||o(d,h,function(){return this}),u.exports={IteratorPrototype:d}}),Q_=()=>P(269),Ch=P.cw(function(u,t){var e=w0();u.exports=function(s){return e(s.length)}}),gb=P.cw(function(u,t){var e=Bt(),s=le(),i=Se(),n=us(),a=hs(),o=N_().CONFIGURABLE,l=z_(),c=og(),h=c.enforce,d=c.get,f=String,g=Object.defineProperty,m=e("".slice),v=e("".replace),w=e([].join),A=a&&!s(function(){return g(function(){},"length",{value:8}).length!==8}),_=String(String).split("String"),E=u.exports=function(S,x,T){m(f(x),0,7)==="Symbol("&&(x="["+v(f(x),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),T&&T.getter&&(x="get "+x),T&&T.setter&&(x="set "+x),(!n(S,"name")||o&&S.name!==x)&&(a?g(S,"name",{value:x,configurable:!0}):S.name=x),A&&T&&n(T,"arity")&&S.length!==T.arity&&g(S,"length",{value:T.arity});try{T&&n(T,"constructor")&&T.constructor?a&&g(S,"prototype",{writable:!1}):S.prototype&&(S.prototype=void 0)}catch{}var C=h(S);return n(C,"source")||(C.source=w(_,typeof x=="string"?x:"")),S};Function.prototype.toString=E(function(){return i(this)&&d(this).source||l(this)},"toString")}),mb=P.cw(function(u,t){var e=Bt(),s=Map.prototype;u.exports={Map,set:e(s.set),get:e(s.get),has:e(s.has),remove:e(s.delete),proto:s}}),Z_=P.cw(function(u,t){var e=le();u.exports=!e(function(){var s="9007199254740993",i=JSON.rawJSON(s);return!JSON.isRawJSON(i)||JSON.stringify(i)!==s})}),vb=P.cw(function(u,t){var e=cs(),s=TypeError,i=function(n){var a,o;this.promise=new n(function(l,c){if(a!==void 0||o!==void 0)throw new s("Bad Promise constructor");a=l,o=c}),this.resolve=e(a),this.reject=e(o)};u.exports.f=function(n){return new i(n)}}),t0=P.cw(function(u,t){var e=dg();u.exports=function(s,i){return s===void 0?arguments.length<2?"":i:e(s)}}),yb=()=>P(149),lg=P.cw(function(u,t){var e=ae(),s=e0(),i=Nv(),n=Hv(),a=j_(),o=hb(),l=Vv(),c=">",h="<",d="prototype",f="script",g=l("IE_PROTO"),m=function(){},v=function(S){return h+f+c+S+h+"/"+f+c},w=function(S){S.write(v("")),S.close();var x=S.parentWindow.Object;return S=null,x},A=function(){var S=o("iframe"),x="java"+f+":",T;return S.style.display="none",a.appendChild(S),S.src=String(x),T=S.contentWindow.document,T.open(),T.write(v("document.F=Object")),T.close(),T.F},_,E=function(){try{_=new ActiveXObject("htmlfile")}catch{}E=typeof document<"u"?document.domain&&_?w(_):A():w(_);for(var S=i.length;S--;)delete E[d][i[S]];return E()};n[g]=!0,u.exports=Object.create||function(x,T){var C;return x!==null?(m[d]=e(x),C=new m,m[d]=null,C[g]=x):C=E(),T===void 0?C:s.f(C,T)}}),e0=P.cw(function(u,t){var e=hs(),s=Mb(),i=Ma(),n=ae(),a=ug(),o=r0();t.f=e&&!s?Object.defineProperties:function(c,h){n(c);for(var d=a(h),f=o(h),g=f.length,m=0,v;g>m;)i.f(c,v=f[m++],d[v]);return c}}),Ma=P.cw(function(u,t){var e=hs(),s=db(),i=Mb(),n=ae(),a=Pb(),o=TypeError,l=Object.defineProperty,c=Object.getOwnPropertyDescriptor,h="enumerable",d="configurable",f="writable";t.f=e?i?function(m,v,w){if(n(m),v=a(v),n(w),typeof m=="function"&&v==="prototype"&&"value"in w&&f in w&&!w[f]){var A=c(m,v);A&&A[f]&&(m[v]=w.value,w={configurable:d in w?w[d]:A[d],enumerable:h in w?w[h]:A[h],writable:!1})}return l(m,v,w)}:l:function(m,v,w){if(n(m),v=a(v),n(w),s)try{return l(m,v,w)}catch{}if("get"in w||"set"in w)throw new o("Accessors not supported");return"value"in w&&(m[v]=w.value),m}}),bb=P.cw(function(u,t){var e=hs(),s=ce(),i=n0(),n=ig(),a=ug(),o=Pb(),l=us(),c=db(),h=Object.getOwnPropertyDescriptor;t.f=e?h:function(f,g){if(f=a(f),g=o(g),c)try{return h(f,g)}catch{}if(l(f,g))return n(!s(i.f,f,g),f[g])}}),s0=P.cw(function(u,t){var e=wb(),s=Nv(),i=s.concat("length","prototype");t.f=Object.getOwnPropertyNames||function(a){return e(a,i)}}),i0=()=>P(717),Gv=P.cw(function(u,t){var e=us(),s=Se(),i=Yv(),n=Vv(),a=C_(),o=n("IE_PROTO"),l=Object,c=l.prototype;u.exports=a?l.getPrototypeOf:function(h){var d=i(h);if(e(d,o))return d[o];var f=d.constructor;return s(f)&&d instanceof f?f.prototype:d instanceof l?c:null}}),cg=P.cw(function(u,t){var e=Bt();u.exports=e({}.isPrototypeOf)}),wb=P.cw(function(u,t){var e=Bt(),s=us(),i=ug(),n=Dv().indexOf,a=Hv(),o=e([].push);u.exports=function(l,c){var h=i(l),d=0,f=[],g;for(g in h)!s(a,g)&&s(h,g)&&o(f,g);for(;c.length>d;)s(h,g=c[d++])&&(~n(f,g)||o(f,g));return f}}),r0=P.cw(function(u,t){var e=wb(),s=Nv();u.exports=Object.keys||function(n){return e(n,s)}}),n0=P.cw(function(u,t){var e={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,i=s&&!e.call({1:2},1);t.f=i?function(a){var o=s(this,a);return!!o&&o.enumerable}:e}),Ab=P.cw(function(u,t){var e=Bv(),s=ds(),i=Sb(),n=m_();u.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var a=!1,o={},l;try{l=e(Object.prototype,"__proto__","set"),l(o,[]),a=o instanceof Array}catch{}return function(h,d){return i(h),n(d),s(h)&&(a?l(h,d):h.__proto__=d),h}}():void 0)}),a0=P.cw(function(u,t){var e=ce(),s=Se(),i=ds(),n=TypeError;u.exports=function(a,o){var l,c;if(o==="string"&&s(l=a.toString)&&!i(c=e(l,a))||s(l=a.valueOf)&&!i(c=e(l,a))||o!=="string"&&s(l=a.toString)&&!i(c=e(l,a)))return c;throw new n("Can't convert object to primitive value")}}),o0=P.cw(function(u,t){var e=ka(),s=Bt(),i=s0(),n=i0(),a=ae(),o=s([].concat);u.exports=e("Reflect","ownKeys")||function(c){var h=i.f(a(c)),d=n.f;return d?o(h,d(c)):h}}),_b=P.cw(function(u,t){var e=Bt(),s=us(),i=SyntaxError,n=parseInt,a=String.fromCharCode,o=e("".charAt),l=e("".slice),c=e(/./.exec),h={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":`
2
+ `,"\\r":"\r","\\t":" "},d=/^[\da-f]{4}$/i,f=/^[\u0000-\u001F]$/;u.exports=function(g,m){for(var v=!0,w="";m<g.length;){var A=o(g,m);if(A==="\\"){var _=l(g,m,m+2);if(s(h,_))w+=h[_],m+=2;else if(_==="\\u"){m+=2;var E=l(g,m,m+4);if(!c(d,E))throw new i("Bad Unicode escape at: "+m);w+=a(n(E,16)),m+=4}else throw new i('Unknown escape sequence: "'+_+'"')}else if(A==='"'){v=!1,m++;break}else{if(c(f,A))throw new i("Bad control character in string literal at: "+m);w+=A,m++}}if(v)throw new i("Unterminated string at: "+m);return{value:w,end:m}}}),l0=()=>P(103),c0=P.cw(function(u,t){var e=ae(),s=ds(),i=vb();u.exports=function(n,a){if(e(n),s(a)&&a.constructor===n)return a;var o=i.f(n),l=o.resolve;return l(a),o.promise}}),Sb=()=>P(750),zv=P.cw(function(u,t){var e=Er(),s=uf(),i=e.Set,n=e.add;u.exports=function(a){var o=new i;return s(a,function(l){n(o,l)}),o}}),h0=P.cw(function(u,t){var e=_l(),s=Er(),i=zv(),n=df(),a=El(),o=uf(),l=xl(),c=s.has,h=s.remove;u.exports=function(f){var g=e(this),m=a(f),v=i(g);return n(v)<=m.size?o(v,function(w){m.includes(w)&&h(v,w)}):l(m.getIterator(),function(w){c(v,w)&&h(v,w)}),v}}),Er=P.cw(function(u,t){var e=Bt(),s=Set.prototype;u.exports={Set,add:e(s.add),has:e(s.has),remove:e(s.delete),proto:s}}),u0=P.cw(function(u,t){var e=_l(),s=Er(),i=df(),n=El(),a=uf(),o=xl(),l=s.Set,c=s.add,h=s.has;u.exports=function(f){var g=e(this),m=n(f),v=new l;return i(g)>m.size?o(m.getIterator(),function(w){h(g,w)&&c(v,w)}):a(g,function(w){m.includes(w)&&c(v,w)}),v}}),d0=P.cw(function(u,t){var e=_l(),s=Er().has,i=df(),n=El(),a=uf(),o=xl(),l=fs();u.exports=function(h){var d=e(this),f=n(h);if(i(d)<=f.size)return a(d,function(m){if(f.includes(m))return!1},!0)!==!1;var g=f.getIterator();return o(g,function(m){if(s(d,m))return l(g.iterator,"normal",!1)})!==!1}}),f0=P.cw(function(u,t){var e=_l(),s=df(),i=uf(),n=El();u.exports=function(o){var l=e(this),c=n(o);return s(l)>c.size?!1:i(l,function(h){if(!c.includes(h))return!1},!0)!==!1}}),p0=P.cw(function(u,t){var e=_l(),s=Er().has,i=df(),n=El(),a=xl(),o=fs();u.exports=function(c){var h=e(this),d=n(c);if(i(h)<d.size)return!1;var f=d.getIterator();return a(f,function(g){if(!s(h,g))return o(f.iterator,"normal",!1)})!==!1}}),uf=P.cw(function(u,t){var e=Bt(),s=xl(),i=Er(),n=i.Set,a=i.proto,o=e(a.forEach),l=e(a.keys),c=l(new n).next;u.exports=function(h,d,f){return f?s({iterator:l(h),next:c},d):o(h,d)}}),Tl=P.cw(function(u,t){var e=ka(),s=function(n){return{size:n,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},i=function(n){return{size:n,has:function(){return!0},keys:function(){throw new Error("e")}}};u.exports=function(n,a){var o=e("Set");try{new o()[n](s(0));try{return new o()[n](s(-1)),!1}catch{if(!a)return!0;try{return new o()[n](i(-1/0)),!1}catch{var l=new o([1,2]);return a(l[n](i(1/0)))}}}catch{return!1}}}),Eb=()=>P(835),df=P.cw(function(u,t){var e=Bv(),s=Er();u.exports=e(s.proto,"size","get")||function(i){return i.size}}),g0=P.cw(function(u,t){var e=_l(),s=Er(),i=zv(),n=El(),a=xl(),o=s.add,l=s.has,c=s.remove;u.exports=function(d){var f=e(this),g=n(d).getIterator(),m=i(f);return a(g,function(v){l(f,v)?c(m,v):o(m,v)}),m}}),m0=P.cw(function(u,t){var e=_l(),s=Er().add,i=zv(),n=El(),a=xl();u.exports=function(l){var c=e(this),h=n(l).getIterator(),d=i(c);return a(h,function(f){s(d,f)}),d}}),Vv=P.cw(function(u,t){var e=xb(),s=pg(),i=e("keys");u.exports=function(n){return i[n]||(i[n]=s(n))}}),Wv=P.cw(function(u,t){var e=xs(),s=Ut(),i=Lv(),n="__core-js_shared__",a=u.exports=s[n]||i(n,{});(a.versions||(a.versions=[])).push({version:"3.50.0",mode:e?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.50.0/LICENSE",source:"https://github.com/zloirock/core-js"})}),xb=P.cw(function(u,t){var e=Wv(),s=Object.create||Object;u.exports=function(i,n){return e[i]||(e[i]=n||s(null))}}),hg=P.cw(function(u,t){var e=R_(),s=le(),i=Ut(),n=i.String;u.exports=!!Object.getOwnPropertySymbols&&!s(function(){var a=Symbol("symbol detection");return!n(a)||!(Object(a)instanceof Symbol)||!Symbol.sham&&e&&e<41})}),v0=P.cw(function(u,t){var e=Bt();u.exports=e(1.1.valueOf)}),y0=P.cw(function(u,t){var e=Xv(),s=Math.max,i=Math.min;u.exports=function(n,a){var o=e(n);return o<0?s(o+a,0):i(o,a)}}),b0=P.cw(function(u,t){var e=Cb(),s=TypeError;u.exports=function(i){var n=e(i,"number");if(typeof n=="number")throw new s("Can't convert number to bigint");return BigInt(n)}}),ug=P.cw(function(u,t){var e=$_(),s=Sb();u.exports=function(i){return e(s(i))}}),Xv=()=>P(291),w0=()=>P(14),Yv=()=>P(981),Tb=()=>P(590),Cb=P.cw(function(u,t){var e=ce(),s=ds(),i=$v(),n=ag(),a=a0(),o=Ui(),l=TypeError,c=o("toPrimitive");u.exports=function(h,d){if(!s(h)||i(h))return h;var f=n(h,c),g;if(f){if(d===void 0&&(d="default"),g=e(f,h,d),!s(g)||i(g))return g;throw new l("Can't convert object to primitive value")}return d===void 0&&(d="number"),a(h,d)}}),Pb=P.cw(function(u,t){var e=Cb(),s=$v();u.exports=function(i){var n=e(i,"string");return s(n)?n:n+""}}),A0=P.cw(function(u,t){var e=Ui(),s=e("toStringTag"),i={};i[s]="z",u.exports=String(i)==="[object z]"}),dg=P.cw(function(u,t){var e=eg(),s=String;u.exports=function(i){if(e(i)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return s(i)}}),fg=P.cw(function(u,t){var e=String;u.exports=function(s){try{return e(s)}catch{return"Object"}}}),pg=P.cw(function(u,t){var e=Bt(),s=0,i=Math.random(),n=e(1.1.toString);u.exports=function(a){return"Symbol("+(a===void 0?"":a)+")_"+n(++s+i,36)}}),Ib=P.cw(function(u,t){var e=Ut(),s=Bt(),i=nb(),n=ib(),a=us(),o=ob(),l=ub(),c=tg(),h=o.c2i,d=o.c2iUrl,f=e.SyntaxError,g=e.TypeError,m=e.Array,v=s("".charAt),w=Math.floor,A=function(S,x){for(var T=S.length;x<T;x++){var C=v(S,x);if(C!==" "&&C!==" "&&C!==`
3
+ `&&C!=="\f"&&C!=="\r")break}return x},_=function(S,x,T){var C=S.length;C<4&&(S+=C===2?"AA":"A");var I=(x[v(S,0)]<<18)+(x[v(S,1)]<<12)+(x[v(S,2)]<<6)+x[v(S,3)],k=[I>>16&255,I>>8&255,I&255];if(C===2){if(T&&k[1]!==0)throw new f("Extra bits");return[k[0]]}if(C===3){if(T&&k[2]!==0)throw new f("Extra bits");return[k[0],k[1]]}return k},E=function(S,x,T){for(var C=x.length,I=0;I<C;I++)S[T+I]=x[I];return T+C};u.exports=function(S,x,T,C){n(S),i(x);var I=l(x)==="base64"?h:d,k=x?x.lastChunkHandling:void 0;if(k===void 0&&(k="loose"),k!=="loose"&&k!=="strict"&&k!=="stop-before-partial")throw new g("Incorrect `lastChunkHandling` option");T&&c(T.buffer);var M=S.length,R=T||m(w(M*3/4)),N=0,F=0,$="",U=0;if(C)for(;;){if(U=A(S,U),U===M){if($.length>0){if(k==="stop-before-partial")break;if(k==="loose"){if($.length===1)throw new f("Malformed padding: exactly one additional character");N=E(R,_($,I,!1),N)}else throw new f("Missing padding")}F=M;break}var D=v(S,U);if(++U,D==="="){if($.length<2)throw new f("Padding is too early");if(U=A(S,U),$.length===2){if(U===M){if(k==="stop-before-partial")break;throw new f("Malformed padding: only one =")}v(S,U)==="="&&(++U,U=A(S,U))}if(U<M)throw new f("Unexpected character after padding");N=E(R,_($,I,k==="strict"),N),F=M;break}if(!a(I,D))throw new f("Unexpected character");var H=C-N;if(H===1&&$.length===2||H===2&&$.length===3||($+=D,$.length===4&&(N=E(R,_($,I,!1),N),$="",F=U,N===C)))break}return T||(R.length=N),{bytes:R,read:F,written:N}}}),_0=P.cw(function(u,t){var e=Ut(),s=Bt(),i=e.Uint8Array,n=e.SyntaxError,a=Math.min,o=s("".match);u.exports=function(l,c){var h=l.length;if(h%2!==0)throw new n("String should be an even number of characters");for(var d=c?a(c.length,h/2):h/2,f=c||new i(d),g=o(l,/[\S\s]{2}/g),m=0;m<d;m++){var v=+("0x"+g[m]+"0");if(v!==v)throw new n("String should only contain hex characters");f[m]=v>>4}return{bytes:f,read:m<<1}}}),S0=P.cw(function(u,t){var e=le(),s=Ui(),i=hs(),n=xs(),a=s("iterator");u.exports=!e(function(){var o=new URL("b?a=1&b=2&c=3","https://a"),l=o.searchParams,c=new URLSearchParams("a=1&a=2&b=3"),h="";return o.pathname="c%20d",l.forEach(function(d,f){l.delete("b"),h+=f+d}),c.delete("a",2),c.delete("b",void 0),n&&(!o.toJSON||!c.has("a",1)||c.has("a",2)||!c.has("a",void 0)||c.has("b"))||!l.size&&(n||!i)||!l.sort||o.href!=="https://a/c%20d?a=1&c=3"||l.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!l[a]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("https://тест").host!=="xn--e1aybc"||new URL("https://a#б").hash!=="#%D0%B1"||h!=="a1c3"||new URL("https://x",void 0).host!=="x"})}),kb=P.cw(function(u,t){var e=hg();u.exports=e&&!Symbol.sham&&typeof Symbol.iterator=="symbol"}),Mb=P.cw(function(u,t){var e=hs(),s=le();u.exports=e&&s(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})}),E0=()=>P(812),x0=P.cw(function(u,t){var e=Ut(),s=Se(),i=e.WeakMap;u.exports=s(i)&&/native code/.test(String(i))}),gg=P.cw(function(u,t){var e=Bt(),s=WeakMap.prototype;u.exports={WeakMap,set:e(s.set),get:e(s.get),has:e(s.has),remove:e(s.delete)}}),Ui=P.cw(function(u,t){var e=Ut(),s=xb(),i=us(),n=pg(),a=hg(),o=kb(),l=e.Symbol,c=s("wks"),h=o?l.for||l:l&&l.withoutSetter||n;u.exports=function(d){return i(c,d)||(c[d]=a&&i(l,d)?l[d]:h("Symbol."+d)),c[d]}}),T0=P.cw(function(u,t){var e=pt(),s=Dv().includes,i=le(),n=b_(),a=i(function(){return!Array(1).includes()}),o=i(function(){return[,1].includes(void 0,1)});e({target:"Array",proto:!0,forced:a||o},{includes:function(c){return s(this,c,arguments.length>1?arguments[1]:void 0)}}),n("includes")}),C0=P.cw(function(u,t){var e=pt(),s=Yv(),i=Ch(),n=E_(),a=k_(),o=le(),l=o(function(){return[].push.call({length:4294967296},1)!==4294967297}),c=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(d){return d instanceof TypeError}},h=l||!c();e({target:"Array",proto:!0,arity:1,forced:h},{push:function(f){var g=s(this),m=i(g),v=arguments.length;a(m+v);for(var w=0;w<v;w++)g[m]=arguments[w],m++;return n(g,m),m}})}),P0=P.cw(function(u,t){var e=pt(),s=Ut(),i=rb(),n=ae(),a=Se(),o=Gv(),l=cb(),c=Fv(),h=le(),d=us(),f=Ui(),g=pb().IteratorPrototype,m=hs(),v=xs(),w="constructor",A="Iterator",_=f("toStringTag"),E=TypeError,S=s[A],x=v||!a(S)||S.prototype!==g||!h(function(){S({})}),T=function(){if(i(this,g),o(this)===g)throw new E("Abstract class Iterator not directly constructable")},C=function(I,k){m?l(g,I,{configurable:!0,get:function(){return k},set:function(M){if(n(this),this===g)throw new E("You can't redefine this property");d(this,I)?this[I]=M:c(this,I,M)}}):g[I]=k};d(g,_)||C(_,A),(x||!d(g,w)||g[w]===Object)&&C(w,T),T.prototype=g,e({global:!0,constructor:!0,forced:x},{Iterator:T})}),I0=P.cw(function(u,t){var e=pt(),s=ce(),i=ae(),n=mi(),a=yb(),o=Tb(),l=fs(),c=cf(),h=hf(),d=An(),f=xs(),g=RangeError,m=1/0,v=!f&&!h("drop",0),w=!f&&!v&&d("drop",RangeError),A=f||v||w||!function(){try{Iterator.prototype.drop.call({next:function(){return{done:!0}}},9007199254740992)}catch(E){return E instanceof g}}(),_=c(function(){for(var E=this.iterator,S=this.next,x,T;this.remaining;)if(this.remaining--,x=i(s(S,E)),T=this.done=!!x.done,T)return;if(x=i(s(S,E)),T=this.done=!!x.done,!T)return x.value});e({target:"Iterator",proto:!0,real:!0,forced:A},{drop:function(S){i(this);var x;try{if(x=o(a(+S)),x>9007199254740991&&x!==m)throw new g("The argument should be a safe integer")}catch(T){l(this,"throw",T)}return w?s(w,this,x):new _(n(this),{remaining:x})}})}),k0=P.cw(function(u,t){var e=pt(),s=ce(),i=Th(),n=cs(),a=ae(),o=mi(),l=fs(),c=An(),h=c("every",TypeError);e({target:"Iterator",proto:!0,real:!0,forced:h},{every:function(f){a(this);try{n(f)}catch(v){l(this,"throw",v)}if(h)return s(h,this,f);var g=o(this),m=0;return!i(g,function(v,w){if(!f(v,m++))return w()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}),M0=P.cw(function(u,t){var e=pt(),s=ce(),i=cs(),n=ae(),a=mi(),o=cf(),l=lb(),c=xs(),h=fs(),d=hf(),f=An(),g=!c&&!d("filter",function(){}),m=!c&&!g&&f("filter",TypeError),v=c||g||m,w=o(function(){for(var A=this.iterator,_=this.predicate,E=this.next,S,x,T;;){if(S=n(s(E,A)),x=this.done=!!S.done,x)return;if(T=S.value,l(A,_,[T,this.counter++],!0))return T}});e({target:"Iterator",proto:!0,real:!0,forced:v},{filter:function(_){n(this);try{i(_)}catch(E){h(this,"throw",E)}return m?s(m,this,_):new w(a(this),{predicate:_})}})}),O0=P.cw(function(u,t){var e=pt(),s=ce(),i=Th(),n=cs(),a=ae(),o=mi(),l=fs(),c=An(),h=c("find",TypeError);e({target:"Iterator",proto:!0,real:!0,forced:h},{find:function(f){a(this);try{n(f)}catch(v){l(this,"throw",v)}if(h)return s(h,this,f);var g=o(this),m=0;return i(g,function(v,w){if(f(v,m++))return w(v)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})}),R0=P.cw(function(u,t){var e=pt(),s=ce(),i=cs(),n=ae(),a=mi(),o=U_(),l=cf(),c=fs(),h=le(),d=xs(),f=hf(),g=An(),m=!d&&h(function(){return[1].values().flatMap(function(){return[1]}).find(function(){return!0})!==1}),v=!d&&!m&&!f("flatMap",function(){}),w=!d&&!m&&!v&&g("flatMap",TypeError),A=d||m||v||w,_=l(function(){for(var E=this.iterator,S=this.mapper,x,T;;){if(T=this.inner)try{if(x=n(s(T.next,T.iterator)),!x.done)return x.value;this.inner=null}catch(C){c(E,"throw",C)}if(x=n(s(this.next,E)),this.done=!!x.done)return;try{this.inner=o(S(x.value,this.counter++),!1)}catch(C){c(E,"throw",C)}}});e({target:"Iterator",proto:!0,real:!0,forced:A},{flatMap:function(S){n(this);try{i(S)}catch(x){c(this,"throw",x)}return w?s(w,this,S):new _(a(this),{mapper:S,inner:null})}})}),D0=P.cw(function(u,t){var e=pt(),s=ce(),i=Th(),n=cs(),a=ae(),o=mi(),l=fs(),c=An(),h=c("forEach",TypeError);e({target:"Iterator",proto:!0,real:!0,forced:h},{forEach:function(f){a(this);try{n(f)}catch(v){l(this,"throw",v)}if(h)return s(h,this,f);var g=o(this),m=0;i(g,function(v){f(v,m++)},{IS_RECORD:!0})}})}),F0=P.cw(function(u,t){var e=pt(),s=ce(),i=cs(),n=ae(),a=mi(),o=cf(),l=lb(),c=fs(),h=hf(),d=An(),f=xs(),g=!f&&!h("map",function(){}),m=!f&&!g&&d("map",TypeError),v=f||g||m,w=o(function(){var A=this.iterator,_=n(s(this.next,A)),E=this.done=!!_.done;if(!E)return l(A,this.mapper,[_.value,this.counter++],!0)});e({target:"Iterator",proto:!0,real:!0,forced:v},{map:function(_){n(this);try{i(_)}catch(E){c(this,"throw",E)}return m?s(m,this,_):new w(a(this),{mapper:_})}})}),L0=P.cw(function(u,t){var e=pt(),s=ce(),i=Th(),n=cs(),a=ae(),o=mi(),l=fs(),c=An(),h=c("some",TypeError);e({target:"Iterator",proto:!0,real:!0,forced:h},{some:function(f){a(this);try{n(f)}catch(v){l(this,"throw",v)}if(h)return s(h,this,f);var g=o(this),m=0;return i(g,function(v,w){if(f(v,m++))return w()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}),N0=P.cw(function(u,t){var e=pt(),s=ce(),i=ae(),n=mi(),a=yb(),o=Tb(),l=cf(),c=fs(),h=hf(),d=An(),f=xs(),g=RangeError,m=1/0,v=!f&&!h("take",1),w=!f&&!v&&d("take",RangeError),A=f||v||w||!function(){try{Iterator.prototype.take.call({next:function(){return{done:!0}}},9007199254740992)}catch(E){return E instanceof g}}(),_=l(function(){var E=this.iterator;if(!this.remaining--)return this.done=!0,c(E,"normal",void 0);var S=i(s(this.next,E)),x=this.done=!!S.done;if(!x)return S.value});e({target:"Iterator",proto:!0,real:!0,forced:A},{take:function(S){i(this);var x;try{if(x=o(a(+S)),x>9007199254740991&&x!==m)throw new g("The argument should be a safe integer")}catch(T){c(this,"throw",T)}return w?s(w,this,x):new _(n(this),{remaining:x})}})}),B0=P.cw(function(u,t){var e=pt(),s=ae(),i=Fv(),n=Th(),a=mi();e({target:"Iterator",proto:!0,real:!0},{toArray:function(){var l=[],c=0;return n(a(s(this)),function(h){i(l,c++,h)},{IS_RECORD:!0}),l}})}),U0=P.cw(function(u,t){var e=pt(),s=hs(),i=Ut(),n=ka(),a=Bt(),o=ce(),l=Se(),c=ds(),h=jv(),d=us(),f=dg(),g=Ch(),m=Fv(),v=le(),w=_b(),A=hg(),_=i.JSON,E=i.Number,S=i.SyntaxError,x=_&&_.parse,T=n("Object","keys"),C=Object.getOwnPropertyDescriptor,I=a("".charAt),k=a("".slice),M=a(/./.exec),R=a([].push),N=/^\d$/,F=/^[1-9]$/,$=/^[\d-]$/,U=/^[\t\n\r ]$/,D=0,H=1,X=function(G,L){G=f(G);var B=new ht(G,0),rt=B.parse(),bt=rt.value,tt=B.skip(U,rt.end);if(tt<G.length)throw new S('Unexpected extra character: "'+I(G,tt)+'" after the parsed data at: '+tt);return l(L)?nt({"":bt},"",L,rt):bt},nt=function(G,L,B,rt){var bt=G[L],tt=rt&&bt===rt.value,ut=tt&&typeof rt.source=="string"?{source:rt.source}:{},xt,xe,ye,he,vi;if(c(bt)){var Ih=h(bt),Ml=tt?rt.nodes:Ih?[]:{};if(Ih)for(xt=Ml.length,ye=g(bt),he=0;he<ye;he++)gt(bt,he,nt(bt,""+he,B,he<xt?Ml[he]:void 0));else for(xe=T(bt),ye=g(xe),he=0;he<ye;he++)vi=xe[he],gt(bt,vi,nt(bt,vi,B,d(Ml,vi)?Ml[vi]:void 0))}return o(B,G,L,bt,ut)},gt=function(G,L,B){if(s){var rt=C(G,L);if(rt&&!rt.configurable)return}B===void 0?delete G[L]:m(G,L,B)},mt=function(G,L,B,rt){this.value=G,this.end=L,this.source=B,this.nodes=rt},ht=function(G,L){this.source=G,this.index=L};ht.prototype={fork:function(G){return new ht(this.source,G)},parse:function(){var G=this.source,L=this.skip(U,this.index),B=this.fork(L),rt=I(G,L);if(M($,rt))return B.number();switch(rt){case"{":return B.object();case"[":return B.array();case'"':return B.string();case"t":return B.keyword(!0);case"f":return B.keyword(!1);case"n":return B.keyword(null)}throw new S('Unexpected character: "'+rt+'" at: '+L)},node:function(G,L,B,rt,bt){return new mt(L,rt,G?null:k(this.source,B,rt),bt)},object:function(){for(var G=this.source,L=this.index+1,B=!1,rt={},bt={},tt=!1;L<G.length;){if(L=this.until(['"',"}"],L),I(G,L)==="}"&&!B){L++,tt=!0;break}var ut=this.fork(L).string(),xt=ut.value;L=ut.end,L=this.until([":"],L)+1,L=this.skip(U,L),ut=this.fork(L).parse(),m(bt,xt,ut),m(rt,xt,ut.value),L=this.until([",","}"],ut.end);var xe=I(G,L);if(xe===",")B=!0,L++;else if(xe==="}"){L++,tt=!0;break}}if(!tt)throw new S("Unterminated object at: "+L);return this.node(H,rt,this.index,L,bt)},array:function(){for(var G=this.source,L=this.index+1,B=!1,rt=[],bt=[],tt=!1;L<G.length;){if(L=this.skip(U,L),I(G,L)==="]"&&!B){L++,tt=!0;break}var ut=this.fork(L).parse();if(R(bt,ut),R(rt,ut.value),L=this.until([",","]"],ut.end),I(G,L)===",")B=!0,L++;else if(I(G,L)==="]"){L++,tt=!0;break}}if(!tt)throw new S("Unterminated array at: "+L);return this.node(H,rt,this.index,L,bt)},string:function(){var G=this.index,L=w(this.source,this.index+1);return this.node(D,L.value,G,L.end)},number:function(){var G=this.source,L=this.index,B=L;if(I(G,B)==="-"&&B++,I(G,B)==="0")B++;else if(M(F,I(G,B)))B=this.skip(N,B+1);else throw new S("Failed to parse number at: "+B);if(I(G,B)==="."){var rt=B+1;if(B=this.skip(N,rt),rt===B)throw new S("Failed to parse number's fraction at: "+B)}if(I(G,B)==="e"||I(G,B)==="E"){B++,(I(G,B)==="+"||I(G,B)==="-")&&B++;var bt=B;if(B=this.skip(N,B),bt===B)throw new S("Failed to parse number's exponent value at: "+B)}return this.node(D,E(k(G,L,B)),L,B)},keyword:function(G){var L=""+G,B=this.index,rt=B+L.length;if(k(this.source,B,rt)!==L)throw new S("Failed to parse value at: "+B);return this.node(D,G,B,rt)},skip:function(G,L){for(var B=this.source;L<B.length&&M(G,I(B,L));L++);return L},until:function(G,L){L=this.skip(U,L);for(var B=I(this.source,L),rt=0;rt<G.length;rt++)if(G[rt]===B)return L;throw new S('Unexpected character: "'+B+'" at: '+L)}};var at=v(function(){var G="9007199254740993",L;return x(G,function(B,rt,bt){L=bt.source}),L!==G}),Ee=A&&!v(function(){return 1/x("-0 ")!==-1/0});e({target:"JSON",stat:!0,forced:at},{parse:function(L,B){return Ee&&!l(B)?x(L):X(L,B)}})}),H0=P.cw(function(u,t){var e=pt(),s=ka(),i=ce(),n=Bt(),a=le(),o=jv(),l=Se(),c=ds(),h=lg(),d=K_(),f=$v(),g=Sl(),m=v0(),v=Dv().includes,w=us(),A=dg(),_=_b(),E=pg(),S=hg(),x=Z_(),T=String,C=TypeError,I=s("JSON","stringify"),k=s("BigInt"),M=n("".valueOf),R=n((!0).valueOf),N=k&&n(k.prototype.valueOf),F=n(/./.exec),$=n("".charAt),U=n("".charCodeAt),D=n("".replace),H=n("".slice),X=n([].push),nt=n([].pop),gt=n(1.1.toString),mt=/[\uD800-\uDFFF]/g,ht=/^[\uD800-\uDBFF]$/,at=/^[\uDC00-\uDFFF]$/,Ee=/^\d+$/,G=E(),L=E(),B=E(),rt=G.length,bt=L.length,tt=!S||a(function(){var ft=s("Symbol")("stringify detection");return I([ft])!=="[null]"||I({a:ft})!=="{}"||I(Object(ft))!=="{}"}),ut=a(function(){return I("\uDF06\uD834")!=='"\\udf06\\ud834"'||I("\uDEAD")!=='"\\udead"'}),xt=x?s("JSON","isRawJSON"):d,xe=tt?function(ft,Dt,Kt){return I(ft,function(qe,Je){var Te=i(Dt,this,qe,Je);if(!f(Te))return Te},Kt)}:I,ye=function(ft,Dt,Kt){var qe=$(Kt,Dt-1),Je=$(Kt,Dt+1);return F(ht,ft)&&!F(at,Je)||F(at,ft)&&!F(ht,qe)?"\\u"+gt(U(ft,0),16):ft},he=function(ft){if(o(ft)){for(var Dt=ft.length,Kt=[],qe=h(null),Je=0;Je<Dt;Je++){var Te=ft[Je],yi;if(typeof Te=="string")yi=Te;else if(typeof Te=="number"||g(Te)==="Number"||g(Te)==="String")yi=A(Te);else continue;w(qe,yi)||(qe[yi]=!0,X(Kt,yi))}return Kt}},vi=function(ft,Dt){try{return ft(Dt),!0}catch{return!1}},Ih=function(ft){var Dt=g(ft);return Dt==="Number"&&vi(m,ft)||Dt==="String"&&vi(M,ft)||Dt==="Boolean"&&vi(R,ft)||!!N&&Dt==="BigInt"&&vi(N,ft)},Ml=function(ft){if(!c(ft)||l(ft)||o(ft))return!1;try{return!Ih(ft)}catch{return!0}},l_=function(ft,Dt){return{toJSON:function(){var Kt=ft[Dt];if(c(Kt)||typeof Kt=="bigint"){var qe=Kt.toJSON;l(qe)&&(Kt=i(qe,Kt,Dt))}return Kt}}},c_=function(ft){for(var Dt=0,Kt=ft.length;Dt<Kt;Dt++)if(F(Ee,ft[Dt]))return L;return""},h_=function(ft,Dt,Kt){for(var qe=h(null),Je=0,Te=Dt.length;Je<Te;Je++){var yi=Dt[Je];qe[Kt+yi]=l_(ft,yi)}return qe[B]=null,qe};I&&e({target:"JSON",stat:!0,arity:3,forced:tt||ut||!x},{stringify:function(Dt,Kt,qe){var Je=l(Kt)?Kt:void 0,Te=Je?void 0:he(Kt),yi=Te&&c_(Te),my=[],Rg=[],vy=[],vf,Dg=!1,yy=!0,xr=xe(Dt,function(Oh,Hi){if(Oh=T(Oh),Te){if(Oh===B){nt(Rg),vf=nt(vy);return}if(yy)yy=!1;else if(this!==vf&&!o(this)&&!v(Te,Oh))return}else Je&&(Hi=i(Je,this,Oh,Hi));if(xt(Hi))return x?Hi:(Dg=!0,G+(X(my,Hi.rawJSON)-1));if(Te&&Ml(Hi)){if(v(Rg,Hi))throw new C("Converting circular structure to JSON");var Ay=h_(Hi,Te,yi);return X(Rg,Hi),X(vy,vf),vf=Ay,yi&&(Dg=!0),Ay}return Hi},qe);if(typeof xr!="string"||(ut&&(xr=D(xr,mt,ye)),!Dg))return xr;for(var kh="",u_=xr.length,Ol=0;Ol<u_;Ol++){var by=$(xr,Ol);if(by==='"'){var wy=_(xr,++Ol).end-1,Mh=H(xr,Ol,wy);H(Mh,0,rt)===G?kh+=my[H(Mh,rt)]:H(Mh,0,bt)===L?kh+='"'+H(Mh,bt)+'"':kh+='"'+Mh+'"',Ol=wy}else kh+=by}return kh}})}),j0=P.cw(function(u,t){var e=pt(),s=cs(),i=mb(),n=xs(),a=i.get,o=i.has,l=i.set;e({target:"Map",proto:!0,real:!0,forced:n},{getOrInsertComputed:function(h,d){var f=o(this,h);if(s(d),f)return a(this,h);h===0&&1/h===-1/0&&(h=0);var g=d(h);return l(this,h,g),g}})}),$0=P.cw(function(u,t){var e=pt(),s=mb(),i=xs(),n=s.get,a=s.has,o=s.set;e({target:"Map",proto:!0,real:!0,forced:i},{getOrInsert:function(c,h){return a(this,c)?n(this,c):(o(this,c,h),h)}})}),G0=P.cw(function(u,t){var e=pt(),s=Bt(),i=Th(),n=RangeError,a=TypeError,o=1/0,l=NaN,c=Math.abs,h=Math.pow,d=s([].push),f=h(2,1023),g=h(2,53)-1,m=Number.MAX_VALUE,v=h(2,971),w={},A={},_={},E={},S={},x=function(T,C){var I=T+C,k=C-(I-T);return{hi:I,lo:k}};e({target:"Math",stat:!0},{sumPrecise:function(C){var I=[],k=0,M=E;switch(i(C,function(G){if(++k>g)throw new n("Maximum allowed index exceeded");if(typeof G!="number")throw new a("Value is not a number");M!==w&&(G!==G?M=w:G===o?M=M===A?w:_:G===-o?M=M===_?w:A:(G!==0||1/G===o)&&(M===E||M===S)&&(M=S,d(I,G)))}),M){case w:return l;case A:return-o;case _:return o;case E:return-0}for(var R=[],N=0,F,$,U,D,H,X,nt=0;nt<I.length;nt++){F=I[nt];for(var gt=0,mt=0;mt<R.length;mt++){if($=R[mt],c(F)<c($)&&(X=F,F=$,$=X),U=x(F,$),D=U.hi,H=U.lo,c(D)===o){var ht=D===o?1:-1;N+=ht,F=F-ht*f-ht*f,c(F)<c($)&&(X=F,F=$,$=X),U=x(F,$),D=U.hi,H=U.lo}H!==0&&(R[gt++]=H),F=D}R.length=gt,F!==0&&d(R,F)}var at=R.length-1;if(D=0,H=0,N!==0){var Ee=at>=0?R[at]:0;if(at--,c(N)>1||N>0&&Ee>0||N<0&&Ee<0)return N>0?o:-o;if(U=x(N*f,Ee/2),D=U.hi,H=U.lo,H*=2,c(2*D)===o)return D>0?D===f&&H===-(v/2)&&at>=0&&R[at]<0?m:o:D===-f&&H===v/2&&at>=0&&R[at]>0?-m:-o;H!==0&&(R[++at]=H,H=0),D*=2}for(;at>=0&&(U=x(D,R[at--]),D=U.hi,H=U.lo,H===0););return at>=0&&(H<0&&R[at]<0||H>0&&R[at]>0)&&($=H*2,F=D+$,$===F-D&&(D=F)),D}})}),z0=P.cw(function(u,t){var e=pt(),s=Ut(),i=F_(),n=x_(),a=c0(),o=vb(),l=cs(),c=l0(),h=le(),d=s.Promise,f=!1,g=!d||!d.try||h(function(){var m=d.resolve();return d.try(function(v){return f=v===8,m},8)!==m})||!f;e({target:"Promise",stat:!0,forced:g},{try:function(m){var v=arguments.length>1?n(arguments,1):[],w=c(function(){return i(l(m),void 0,v)});if(!w.error)return a(this,w.value);var A=o.f(this),_=A.reject;return _(w.value),A.promise}})}),V0=P.cw(function(u,t){var e=pt(),s=h0(),i=le(),n=Tl(),a=!n("difference",function(l){return l.size===0}),o=a||i(function(){var l={size:1,has:function(){return!0},keys:function(){var h=0;return{next:function(){var d=h++>1;return c.has(1)&&c.clear(),{done:d,value:2}}}}},c=new Set([1,2,3,4]);return c.difference(l).size!==3});e({target:"Set",proto:!0,real:!0,forced:o},{difference:s})}),W0=P.cw(function(u,t){var e=pt(),s=le(),i=u0(),n=Tl(),a=!n("intersection",function(o){return o.size===2&&o.has(1)&&o.has(2)})||s(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});e({target:"Set",proto:!0,real:!0,forced:a},{intersection:i})}),X0=P.cw(function(u,t){var e=pt(),s=d0(),i=Tl(),n=!i("isDisjointFrom",function(a){return!a});e({target:"Set",proto:!0,real:!0,forced:n},{isDisjointFrom:s})}),Y0=P.cw(function(u,t){var e=pt(),s=f0(),i=Tl(),n=!i("isSubsetOf",function(a){return a});e({target:"Set",proto:!0,real:!0,forced:n},{isSubsetOf:s})}),K0=P.cw(function(u,t){var e=pt(),s=p0(),i=Tl(),n=!i("isSupersetOf",function(a){return!a});e({target:"Set",proto:!0,real:!0,forced:n},{isSupersetOf:s})}),q0=P.cw(function(u,t){var e=pt(),s=g0(),i=Eb(),n=Tl(),a=!n("symmetricDifference")||!i("symmetricDifference");e({target:"Set",proto:!0,real:!0,forced:a},{symmetricDifference:s})}),J0=P.cw(function(u,t){var e=pt(),s=m0(),i=Eb(),n=Tl(),a=!n("union")||!i("union");e({target:"Set",proto:!0,real:!0,forced:a},{union:s})}),Q0=P.cw(function(u,t){var e=__(),s=W_(),i=Ch(),n=Xv(),a=b0(),o=e.aTypedArray,l=e.getTypedArrayConstructor,c=e.exportTypedArrayMethod,h=RangeError,d=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(g){return g===8}}(),f=d&&function(){try{new Int8Array(1).with(-.5,1)}catch{return!0}}();c("with",function(g,m){var v=o(this),w=i(v),A=n(g),_=A<0?w+A:A,E=s(v)?a(m):+m;if(_>=w||_<0)throw new h("Incorrect index");for(var S=new(l(v))(w),x=0;x<w;x++)S[x]=x===_?E:v[x];return S},!d||f)}),Z0=P.cw(function(u,t){var e=pt(),s=Ut(),i=S_(),n=Ib(),a=s.Uint8Array,o=!a||!a.fromBase64||!function(){try{a.fromBase64("a");return}catch{}try{a.fromBase64("",null)}catch{return!0}}();a&&e({target:"Uint8Array",stat:!0,forced:o},{fromBase64:function(c){var h=n(c,arguments.length>1?arguments[1]:void 0,null,9007199254740991);return i(a,h.bytes)}})}),tS=P.cw(function(u,t){var e=pt(),s=Ut(),i=Ib(),n=Zp(),a=s.Uint8Array,o=!a||!a.prototype.setFromBase64||!function(){var l=new a([255,255,255,255,255]);try{l.setFromBase64("",null);return}catch{}try{l.setFromBase64("a");return}catch{}try{l.setFromBase64("MjYyZg===")}catch{return l[0]===50&&l[1]===54&&l[2]===50&&l[3]===255&&l[4]===255}}();a&&e({target:"Uint8Array",proto:!0,forced:o},{setFromBase64:function(c){n(this);var h=i(c,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:h.read,written:h.written}}})}),eS=P.cw(function(u,t){var e=pt(),s=Ut(),i=ib(),n=Zp(),a=tg(),o=_0();function l(){try{var c=new ArrayBuffer(16,{maxByteLength:1024});new Uint8Array(c).setFromHex("cafed00d")}catch{return!0}}s.Uint8Array&&e({target:"Uint8Array",proto:!0,forced:l()},{setFromHex:function(h){n(this),i(h),a(this.buffer);var d=o(h,this).read;return{read:d,written:d/2}}})}),sS=P.cw(function(u,t){var e=pt(),s=Ut(),i=Bt(),n=nb(),a=Zp(),o=tg(),l=ob(),c=ub(),h=l.i2c,d=l.i2cUrl,f=Math.floor,g=Math.ceil,m=i("".charAt),v=s.Uint8Array,w=s.Array,A=i([].join),_=!v||!v.prototype.toBase64||!function(){try{var E=new v;E.toBase64(null)}catch{return!0}}();v&&e({target:"Uint8Array",proto:!0,forced:_},{toBase64:function(){var S=a(this),x=arguments.length?n(arguments[0]):void 0,T=c(x)==="base64"?h:d,C=!!x&&!!x.omitPadding;o(this.buffer);for(var I=0,k=S.length,M=w(C?f(k/3)*4+(k%3?k%3+1:0):g(k/3)*4),R=0,N,F=function($){return m(T,N>>6*$&63)};I+2<k;I+=3)N=(S[I]<<16)+(S[I+1]<<8)+S[I+2],M[R++]=F(3),M[R++]=F(2),M[R++]=F(1),M[R++]=F(0);return I+2===k?(N=(S[I]<<16)+(S[I+1]<<8),M[R++]=F(3),M[R++]=F(2),M[R++]=F(1),C||(M[R++]="=")):I+1===k&&(N=S[I]<<16,M[R++]=F(3),M[R++]=F(2),C||(M[R++]="=",M[R++]="=")),A(M,"")}})}),iS=P.cw(function(u,t){var e=pt(),s=Ut(),i=Bt(),n=Zp(),a=tg(),o=i(1.1.toString),l=i([].join),c=Array,h=s.Uint8Array,d=!h||!h.prototype.toHex||!function(){try{var f=new h([255,255,255,255,255,255,255,255]);return f.toHex()==="ffffffffffffffff"}catch{return!1}}();h&&e({target:"Uint8Array",proto:!0,forced:d},{toHex:function(){n(this),a(this.buffer);for(var g=c(this.length),m=0,v=this.length;m<v;m++){var w=o(this[m],16);g[m]=w.length===1?"0"+w:w}return l(g,"")}})}),rS=P.cw(function(u,t){var e=pt(),s=cs(),i=y_(),n=v_(),a=gg(),o=xs(),l=a.get,c=a.has,h=a.set,d=o||!function(){try{WeakMap.prototype.getOrInsertComputed&&new WeakMap().getOrInsertComputed(1,function(){throw 1})}catch(f){return f instanceof TypeError}}();e({target:"WeakMap",proto:!0,real:!0,forced:d},{getOrInsertComputed:function(g,m){if(o||i(this),n(g),s(m),c(this,g))return l(this,g);var v=m(g);return h(this,g,v),v}})}),nS=P.cw(function(u,t){var e=pt(),s=gg(),i=xs(),n=s.get,a=s.has,o=s.set;e({target:"WeakMap",proto:!0,real:!0,forced:i},{getOrInsert:function(c,h){return a(this,c)?n(this,c):(o(this,c,h),h)}})}),aS=P.cw(function(u,t){var e=pt(),s=Ut(),i=ka(),n=ig(),a=Ma().f,o=us(),l=rb(),c=G_(),h=t0(),d=M_(),f=D_(),g=hs(),m=xs(),v="DOMException",w=i("Error"),A=i(v),_=function(){l(this,E);var U=arguments.length,D=h(U<1?void 0:arguments[0]),H=h(U<2?void 0:arguments[1],"Error"),X=new A(D,H),nt=new w(D);return nt.name=v,a(X,"stack",n(1,f(nt.stack,1))),c(X,this,_),X},E=_.prototype=A.prototype,S="stack"in new w(v),x="stack"in new A(1,2),T=A&&g&&Object.getOwnPropertyDescriptor(s,v),C=!!T&&!(T.writable&&T.configurable),I=S&&!C&&!x;e({global:!0,constructor:!0,forced:m||I},{DOMException:I?_:A});var k=i(v),M=k.prototype;if(M.constructor!==k){m||a(M,"constructor",n(1,k));for(var R in d)if(o(d,R)){var N=d[R],F=N.s;o(k,F)||a(k,F,n(6,N.c))}}}),oS=P.cw(function(u,t){var e=pt(),s=ka(),i=E0(),n=dg(),a=S0(),o=s("URL");e({target:"URL",stat:!0,forced:!a},{parse:function(c){var h=i(arguments.length,1),d=n(c),f=h<2||arguments[1]===void 0?void 0:n(arguments[1]);try{return new o(d,f)}catch{return null}}})});T0();C0();P0();M0();$0();j0();V0();W0();X0();Y0();K0();q0();J0();Q0();tS();eS();sS();iS();oS();const Gs=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),wr=[1/0,1/0,-1/0,-1/0],$a=new Float32Array(wr),Gg=[.001,0,0,.001,0,0],ns="http://www.w3.org/2000/svg",$s={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},fn={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Ul="pdfjs_internal_id_",wh="pdfjs_internal_editor_",it={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},dt={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},Ob={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},be={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},iu={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},$t={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27},Dl={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},ff={ERRORS:0,WARNINGS:1,INFOS:5},Li={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},Rh={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},Rb={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let mg=ff.WARNINGS;function lS(u){Number.isInteger(u)&&(mg=u)}function cS(){return mg}function vg(u){mg>=ff.INFOS&&console.info(`Info: ${u}`)}function st(u){mg>=ff.WARNINGS&&console.warn(`Warning: ${u}`)}function vt(u){throw new Error(u)}function ne(u,t){u||vt(t)}function hS(u){switch(u==null?void 0:u.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Kv(u,t=null,e=null){if(!u)return null;if(e&&typeof u=="string"){if(e.addDefaultProtocol&&u.startsWith("www.")){const i=u.match(/\./g);(i==null?void 0:i.length)>=2&&(u=`http://${u}`)}if(e.tryConvertEncoding)try{u=fS(u)}catch{}}const s=t?URL.parse(u,t):URL.parse(u);return hS(s)?s:null}function qv(u,t,e=!1){const s=URL.parse(u);return s?(s.hash=t,s.href):e&&Kv(u,"http://example.com")?u.split("#",1)[0]+`${t?`#${t}`:""}`:""}function zg(u){return u.substring(u.lastIndexOf("/")+1)}function V(u,t,e,s=!1){return Object.defineProperty(u,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}const Cl=function(){function t(e,s){this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t}();class dp extends Cl{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Lg extends Cl{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class fp extends Cl{constructor(t){super(t,"InvalidPDFException")}}class hu extends Cl{constructor(t,e,s){super(t,"ResponseException"),this.status=e,this.missing=s}}class uS extends Cl{constructor(t){super(t,"FormatError")}}class mn extends Cl{constructor(t){super(t,"AbortException")}}function dS(u){(typeof u!="object"||(u==null?void 0:u.length)===void 0)&&vt("Invalid argument for bytesToString");const t=u.length,e=8192;if(t<e)return String.fromCharCode.apply(null,u);const s=[];for(let i=0;i<t;i+=e){const n=Math.min(i+e,t),a=u.subarray(i,n);s.push(String.fromCharCode.apply(null,a))}return s.join("")}function yg(u){typeof u!="string"&&vt("Invalid argument for stringToBytes");const t=u.length,e=new Uint8Array(t);for(let s=0;s<t;++s)e[s]=u.charCodeAt(s)&255;return e}class _t{static get isLittleEndian(){const t=new Uint8Array(4);t[0]=1;const e=new Uint32Array(t.buffer,0,1);return V(this,"isLittleEndian",e[0]===1)}static get isOffscreenCanvasSupported(){return V(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return V(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return V(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return V(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){const{platform:t,userAgent:e}=navigator;return V(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCanvasFilterSupported(){let t;return this.isOffscreenCanvasSupported?t=new OffscreenCanvas(1,1).getContext("2d"):typeof document<"u"&&(t=document.createElement("canvas").getContext("2d")),V(this,"isCanvasFilterSupported",(t==null?void 0:t.filter)!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>"u")return V(this,"isAlphaColorInputSupported",!1);const t=document.createElement("input");return t.type="color",t.setAttribute("alpha",""),t.value="#ff000080",V(this,"isAlphaColorInputSupported",t.value!=="#ff0000")}static get isBackdropFilterSupported(){return V(this,"isBackdropFilterSupported",typeof CSS<"u"&&CSS.supports("backdrop-filter","blur(1px)"))}}var pn,Cf,Vg;class j{static get hexNums(){return V(this,"hexNums",Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0")))}static makeHexColor(t,e,s){return`#${this.hexNums[t]}${this.hexNums[e]}${this.hexNums[s]}`}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,s=0){const i=t[s],n=t[s+1];t[s]=i*e[0]+n*e[2]+e[4],t[s+1]=i*e[1]+n*e[3]+e[5]}static applyTransformToBezier(t,e,s=0){const i=e[0],n=e[1],a=e[2],o=e[3],l=e[4],c=e[5];for(let h=0;h<6;h+=2){const d=t[s+h],f=t[s+h+1];t[s+h]=d*i+f*a+l,t[s+h+1]=d*n+f*o+c}}static applyInverseTransform(t,e){const s=t[0],i=t[1],n=e[0]*e[3]-e[1]*e[2];t[0]=(s*e[3]-i*e[2]+e[2]*e[5]-e[4]*e[3])/n,t[1]=(-s*e[1]+i*e[0]+e[4]*e[1]-e[5]*e[0])/n}static axialAlignedBoundingBox(t,e,s){const i=e[0],n=e[1],a=e[2],o=e[3],l=e[4],c=e[5],h=t[0],d=t[1],f=t[2],g=t[3];let m=i*h+l,v=m,w=i*f+l,A=w,_=o*d+c,E=_,S=o*g+c,x=S;if(n!==0||a!==0){const T=n*h,C=n*f,I=a*d,k=a*g;m+=I,A+=I,w+=k,v+=k,_+=T,x+=T,S+=C,E+=C}s[0]=Math.min(s[0],m,w,v,A),s[1]=Math.min(s[1],_,S,E,x),s[2]=Math.max(s[2],m,w,v,A),s[3]=Math.max(s[3],_,S,E,x)}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){const s=t[0],i=t[1],n=t[2],a=t[3],o=s**2+i**2,l=s*n+i*a,c=n**2+a**2,h=(o+c)/2,d=Math.sqrt(h**2-(o*c-l**2));e[0]=Math.sqrt(h+d||1),e[1]=Math.sqrt(h-d||1)}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const s=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(s>i)return null;const n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>a?null:[s,n,i,a]}static pointBoundingBox(t,e,s){s[0]=Math.min(s[0],t),s[1]=Math.min(s[1],e),s[2]=Math.max(s[2],t),s[3]=Math.max(s[3],e)}static rectBoundingBox(t,e,s,i,n){n[0]=Math.min(n[0],t,s),n[1]=Math.min(n[1],e,i),n[2]=Math.max(n[2],t,s),n[3]=Math.max(n[3],e,i)}static bezierBoundingBox(t,e,s,i,n,a,o,l,c){c[0]=Math.min(c[0],t,o),c[1]=Math.min(c[1],e,l),c[2]=Math.max(c[2],t,o),c[3]=Math.max(c[3],e,l),b(this,pn,Vg).call(this,t,s,n,o,e,i,a,l,3*(-t+3*(s-n)+o),6*(t-2*s+n),3*(s-t),c),b(this,pn,Vg).call(this,t,s,n,o,e,i,a,l,3*(-e+3*(i-a)+l),6*(e-2*i+a),3*(i-e),c)}}pn=new WeakSet,Cf=function(t,e,s,i,n,a,o,l,c,h){if(c<=0||c>=1)return;const d=1-c,f=c*c,g=f*c,m=d*(d*(d*t+3*c*e)+3*f*s)+g*i,v=d*(d*(d*n+3*c*a)+3*f*o)+g*l;h[0]=Math.min(h[0],m),h[1]=Math.min(h[1],v),h[2]=Math.max(h[2],m),h[3]=Math.max(h[3],v)},Vg=function(t,e,s,i,n,a,o,l,c,h,d,f){if(Math.abs(c)<1e-12){Math.abs(h)>=1e-12&&b(this,pn,Cf).call(this,t,e,s,i,n,a,o,l,-d/h,f);return}const g=h**2-4*d*c;if(g<0)return;const m=Math.sqrt(g),v=2*c;b(this,pn,Cf).call(this,t,e,s,i,n,a,o,l,(-h+m)/v,f),b(this,pn,Cf).call(this,t,e,s,i,n,a,o,l,(-h-m)/v,f)},y(j,pn);function fS(u){return decodeURIComponent(escape(u))}let Ng=null,Ey=null;function Db(u){return Ng||(Ng=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,Ey=new Map([["ſt","ſt"]])),u.replaceAll(Ng,(t,e,s)=>e?e.normalize("NFKC"):Ey.get(s))}function Jv(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const u=new Uint8Array(32);return crypto.getRandomValues(u),dS(u)}function pS(u,t,e){if(!Array.isArray(e)||e.length<2)return!1;const[s,i,...n]=e;if(!u(s)&&!Number.isInteger(s)||!t(i))return!1;const a=n.length;let o=!0;switch(i.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return a===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(a!==4)return!1;o=!1;break;default:return!1}for(const l of n)if(!(typeof l=="number"||o&&l===null))return!1;return!0}const Pl=()=>[],bg=()=>new Map,pp=()=>Object.create(null),Fb=()=>new Set;typeof Blob.prototype.bytes!="function"&&(Blob.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())});typeof Response.prototype.bytes!="function"&&(Response.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())});typeof Iterator.prototype.join!="function"&&(Iterator.prototype.join=function(u){return[...this].join(u)});F0();function Nt(u,t,e){return Math.min(Math.max(u,t),e)}class pf{constructor({viewBox:t,userUnit:e,scale:s,rotation:i,offsetX:n=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=t,this.userUnit=e,this.scale=s,this.rotation=i,this.offsetX=n,this.offsetY=a,s*=e;const l=(t[2]+t[0])/2,c=(t[3]+t[1])/2;let h,d,f,g;switch(i%=360,i<0&&(i+=360),i){case 180:h=-1,d=0,f=0,g=1;break;case 90:h=0,d=1,f=1,g=0;break;case 270:h=0,d=-1,f=-1,g=0;break;case 0:h=1,d=0,f=0,g=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(f=-f,g=-g);let m,v,w,A;h===0?(m=Math.abs(c-t[1])*s+n,v=Math.abs(l-t[0])*s+a,w=(t[3]-t[1])*s,A=(t[2]-t[0])*s):(m=Math.abs(l-t[0])*s+n,v=Math.abs(c-t[1])*s+a,w=(t[2]-t[0])*s,A=(t[3]-t[1])*s),this.transform=[h*s,d*s,f*s,g*s,m-h*s*l-f*s*c,v-d*s*l-g*s*c],this.width=w,this.height=A}get rawDims(){const t=this.viewBox;return V(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:n=!1}={}){return new pf({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(t,e){const s=[t,e];return j.applyTransform(s,this.transform),s}convertToPdfPoint(t,e){const s=[t,e];return j.applyInverseTransform(s,this.transform),s}}class uu{static textContent(t){const e=[],s={items:e,styles:Object.create(null)};function i(n){var l;if(!n)return;let a=null;const o=n.name;if(o==="#text")a=n.value;else if(uu.shouldBuildText(o))(l=n==null?void 0:n.attributes)!=null&&l.textContent?a=n.attributes.textContent:n.value&&(a=n.value);else return;if(a!==null&&e.push({str:a}),!!n.children)for(const c of n.children)i(c)}return i(t),s}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const gS=/url\(|image-set\(/i,mS=/^on/i;var yu,Wg;class wg{static get _allowedHtmlElements(){return V(this,"_allowedHtmlElements",new Set(["a","b","br","button","div","i","img","input","label","li","ol","option","p","select","span","sub","sup","textarea","ul"]))}static get _allowedSvgElements(){return V(this,"_allowedSvgElements",new Set(["ellipse","line","path","rect","svg"]))}static get _allowedRichTextElements(){return V(this,"_allowedRichTextElements",new Set(["a","b","br","div","i","li","ol","p","span","sub","sup","ul"]))}static get _allowedRichTextAttributes(){return V(this,"_allowedRichTextAttributes",new Set(["class","dir","style"]))}static get _allowedRichTextStyles(){return V(this,"_allowedRichTextStyles",new Set(["color","font","fontFamily","fontSize","fontStretch","fontStyle","fontWeight","kerningMode","letterSpacing","lineHeight","margin","marginBottom","marginLeft","marginRight","marginTop","orphans","paddingLeft","paddingRight","breakAfter","breakBefore","breakInside","tabInterval","tabStop","textAlign","textDecoration","textIndent","transform","verticalAlign","widows"]))}static setupStorage(t,e,s,i,n){const a=i.getValue(e,{value:null});switch(s.name){case"textarea":if(a.value!==null&&(t.textContent=a.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})});break;case"input":if(s.attributes.type==="radio"||s.attributes.type==="checkbox"){if(a.value===s.attributes.xfaOn?t.setAttribute("checked",!0):a.value===s.attributes.xfaOff&&t.removeAttribute("checked"),n==="print")break;t.addEventListener("change",o=>{i.setValue(e,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&t.setAttribute("value",a.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})})}break;case"select":if(a.value!==null){t.setAttribute("value",a.value);for(const o of s.children)o.attributes.value===a.value?o.attributes.selected=!0:Object.hasOwn(o.attributes,"selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{const l=o.target.options,c=l.selectedIndex===-1?"":l[l.selectedIndex].value;i.setValue(e,{value:c})});break}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:n}){const{attributes:a}=e,o=t instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${i}`);for(const[l,c]of Object.entries(a))if(!(c==null||mS.test(l))&&!(i==="richText"&&!this._allowedRichTextAttributes.has(l)))switch(l){case"class":c.length&&t.setAttribute(l,c.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",c);break;case"style":if(i==="richText"){const h=this._allowedRichTextStyles;for(const[d,f]of Object.entries(c))h.has(d)&&!gS.test(f)&&(t.style[d]=f)}else Object.assign(t.style,c);break;case"textContent":t.textContent=c;break;default:(!o||l!=="href"&&l!=="newWindow")&&t.setAttribute(l,c)}o&&(n==null||n.addLinkAttributes(t,a.href,a.newWindow)),s&&a.dataId&&this.setupStorage(t,a.dataId,e,s)}static render(t){var d,f,g;const e=t.annotationStorage,s=t.linkService,i=t.xfaHtml,n=t.intent||"display",a=b(this,yu,Wg).call(this,i.name,(d=i.attributes)==null?void 0:d.xmlns,n)??document.createElement("div");i.attributes&&this.setAttributes({html:a,element:i,intent:n,linkService:s});const o=n!=="richText",l=t.div;if(l.append(a),t.viewport){const m=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=m}o&&l.setAttribute("class","xfaLayer xfaFont");const c=[];if(i.children.length===0){if(i.value){const m=document.createTextNode(i.value);a.append(m),o&&uu.shouldBuildText(i.name)&&c.push(m)}return{textDivs:c}}const h=[[i,-1,a]];for(;h.length>0;){const[m,v,w]=h.at(-1);if(v+1===m.children.length){h.pop();continue}const A=m.children[++h.at(-1)[1]];if(A===null)continue;const{name:_}=A;if(_==="#text"){const S=document.createTextNode(A.value);c.push(S),w.append(S);continue}const E=b(this,yu,Wg).call(this,_,(f=A.attributes)==null?void 0:f.xmlns,n);if(E){if(w.append(E),A.attributes&&this.setAttributes({html:E,element:A,storage:e,intent:n,linkService:s}),((g=A.children)==null?void 0:g.length)>0)h.push([A,-1,E]);else if(A.value){const S=document.createTextNode(A.value);o&&uu.shouldBuildText(_)&&c.push(S),E.append(S)}}}for(const m of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))m.setAttribute("readOnly",!0);return{textDivs:c}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}static getPageViewport(t,{scale:e=1,rotation:s=0}){const{width:i,height:n}=t.attributes.style;return new pf({viewBox:[0,0,parseInt(i,10),parseInt(n,10)],userUnit:1,scale:e,rotation:s})}}yu=new WeakSet,Wg=function(t,e,s){return s==="richText"?!e&&this._allowedRichTextElements.has(t)?document.createElement(t):null:e?e===ns&&this._allowedSvgElements.has(t)?document.createElementNS(ns,t):null:this._allowedHtmlElements.has(t)?document.createElement(t):null},y(wg,yu);const Ba=class Ba{};O(Ba,"CSS",96),O(Ba,"PDF",72),O(Ba,"PDF_TO_CSS_UNITS",Ba.CSS/Ba.PDF);let vn=Ba;async function Ag(u,t="text"){if(ru(u,document.baseURI)){const e=await fetch(u);if(!e.ok)throw new Error(e.statusText);switch(t){case"blob":return e.blob();case"bytes":return e.bytes();case"json":return e.json()}return e.text()}return new Promise((e,s)=>{const i=new XMLHttpRequest;i.open("GET",u,!0),i.responseType=t==="bytes"?"arraybuffer":t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"bytes":e(new Uint8Array(i.response));return;case"blob":case"json":e(i.response);return}e(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}class _g extends Cl{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function gf(u){const t=u.length;let e=0;for(;e<t&&u[e].trim()==="";)e++;return u.substring(e,e+5).toLowerCase()==="data:"}function Sg(u){return typeof u=="string"&&/\.pdf$/i.test(u)}function Lb(u){return[u]=u.split(/[#?]/,1),zg(u)}function Nb(u,t="document.pdf"){if(typeof u!="string")return t;if(gf(u))return st('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const s=(o=>{try{return new URL(o)}catch{}try{return new URL(decodeURIComponent(o))}catch{}try{return new URL(o,"https://foo.bar")}catch{}try{return new URL(decodeURIComponent(o),"https://foo.bar")}catch{}return null})(u);if(!s)return t;const i=o=>{try{let l=decodeURIComponent(o);return l.includes("/")&&(l=zg(l),l.length===4&&n.test(l))?o:l}catch{return o}},n=/\.pdf$/i,a=zg(s.pathname);if(n.test(a))return i(a);if(s.searchParams.size>0){const o=c=>[...c].findLast(h=>n.test(h)),l=o(s.searchParams.values())??o(s.searchParams.keys());if(l)return i(l)}if(s.hash){const{hash:o}=s;let l=-1;for(const{index:c}of o.matchAll(/\.pdf\b/gi))l=c;if(l>0){let c=l;for(;c>0&&!"/?#=".includes(o[c-1]);)c--;if(c<l)return i(o.slice(c,l+4))}}return t}var En;class xy{constructor(){y(this,En,new Map);O(this,"times",[])}time(t){r(this,En).has(t)&&st(`Timer is already running for ${t}`),r(this,En).set(t,Date.now())}timeEnd(t){r(this,En).has(t)||st(`Timer has not been started for ${t}`),this.times.push({name:t,start:r(this,En).get(t),end:Date.now()}),r(this,En).delete(t)}toString(){const t=Math.max(...this.times.map(e=>e.name.length));return this.times.map(e=>`${e.name.padEnd(t)} ${e.end-e.start}ms
4
+ `).join("")}}En=new WeakMap;function ru(u,t){const e=t?URL.parse(u,t):URL.parse(u);return/https?:/.test((e==null?void 0:e.protocol)??"")}function gi(u){u.preventDefault()}function me(u){u.preventDefault(),u.stopPropagation()}var bu;class du{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;r(this,bu)||p(this,bu,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?"));const e=r(this,bu).exec(t);if(!e)return null;const s=parseInt(e[1],10);let i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const c=e[7]||"Z";let h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,c==="-"?(a+=h,o+=d):c==="+"&&(a-=h,o-=d),new Date(Date.UTC(s,i,n,a,o,l))}}bu=new WeakMap,y(du,bu);function Il(u){if(u.startsWith("#")){const e=u.slice(1);return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),e.length>=8?parseInt(e.slice(6,8),16)/255:1]}if(u.startsWith("rgb(")){const[e,s,i]=u.slice(4,-1).split(",").map(n=>parseInt(n,10));return[e,s,i,1]}if(u.startsWith("rgba(")){const e=u.slice(5,-1).split(",");return[parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3])]}const t=u.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return t?[Math.round(parseFloat(t[1])*255),Math.round(parseFloat(t[2])*255),Math.round(parseFloat(t[3])*255),t[4]!==void 0&&t[4]!=="none"?parseFloat(t[4]):1]:null}function Ph(u){const t=Il(u);return t?t.slice(0,3):(st(`Not a valid color format: "${u}"`),[0,0,0])}function vS(u){const t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(const e of u.keys()){t.style.color=e;const s=window.getComputedStyle(t).color;u.set(e,Ph(s))}t.remove()}function Ot(u){const{a:t,b:e,c:s,d:i,e:n,f:a}=u.getTransform();return[t,e,s,i,n,a]}function ji(u){const{a:t,b:e,c:s,d:i,e:n,f:a}=u.getTransform().invertSelf();return[t,e,s,i,n,a]}function Pa(u,t,e=!1,s=!0){if(t instanceof pf){const{pageWidth:i,pageHeight:n}=t.rawDims,{style:a}=u,o=`round(down, var(--total-scale-factor) * ${i}px, var(--scale-round-x))`,l=`round(down, var(--total-scale-factor) * ${n}px, var(--scale-round-y))`;!e||t.rotation%180===0?(a.width=o,a.height=l):(a.width=l,a.height=o)}s&&u.setAttribute("data-main-rotation",t.rotation)}class Ws{constructor(){const{pixelRatio:t}=Ws;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,s,i,n=-1){let a=1/0,o=1/0,l=1/0;s=Ws.capPixels(s,n),s>0&&(a=Math.sqrt(s/(t*e))),i!==-1&&(o=i/t,l=i/e);const c=Math.min(a,o,l);return this.sx>c||this.sy>c?(this.sx=c,this.sy=c,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){const s=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,s):s}return t}}const gp=new Set(["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"]);class yS{static get isDarkMode(){var t;return V(this,"isDarkMode",!!((t=window==null?void 0:window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: dark)").matches))}}class Bb{static get commentForegroundColor(){const t=document.createElement("span");t.classList.add("comment","sidebar");const{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);const{color:s}=window.getComputedStyle(t);return t.remove(),V(this,"commentForegroundColor",Ph(s))}}function Ub(u,t){t=Nt(t??1,0,1);const e=255*(1-t);return u.map(s=>Math.round(s*t+e))}function Ty(u,t){const e=u[0]/255,s=u[1]/255,i=u[2]/255,n=Math.max(e,s,i),a=Math.min(e,s,i),o=(n+a)/2;if(n===a)t[0]=t[1]=0;else{const l=n-a;switch(t[1]=o<.5?l/(n+a):l/(2-n-a),n){case e:t[0]=((s-i)/l+(s<i?6:0))*60;break;case s:t[0]=((i-e)/l+2)*60;break;case i:t[0]=((e-s)/l+4)*60;break}}t[2]=o}function Xg(u,t){const e=u[0],s=u[1],i=u[2],n=(1-Math.abs(2*i-1))*s,a=n*(1-Math.abs(e/60%2-1)),o=i-n/2;switch(Math.floor(e/60)){case 0:t[0]=n+o,t[1]=a+o,t[2]=o;break;case 1:t[0]=a+o,t[1]=n+o,t[2]=o;break;case 2:t[0]=o,t[1]=n+o,t[2]=a+o;break;case 3:t[0]=o,t[1]=a+o,t[2]=n+o;break;case 4:t[0]=a+o,t[1]=o,t[2]=n+o;break;case 5:case 6:t[0]=n+o,t[1]=o,t[2]=a+o;break}}function Yg(u){return u<=.03928?u/12.92:((u+.055)/1.055)**2.4}function Cy(u,t,e){Xg(u,e),e.map(Yg);const s=.2126*e[0]+.7152*e[1]+.0722*e[2];Xg(t,e),e.map(Yg);const i=.2126*e[0]+.7152*e[1]+.0722*e[2];return s>i?(s+.05)/(i+.05):(i+.05)/(s+.05)}const Py=new Map;function Hb(u,t){const e=u[0]+u[1]*256+u[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776;let s=Py.get(e);if(s)return s;const i=new Float32Array(9),n=i.subarray(0,3),a=i.subarray(3,6);Ty(u,a);const o=i.subarray(6,9);Ty(t,o);const l=o[2]<.5,c=l?12:4.5;if(a[2]=l?Math.sqrt(a[2]):1-Math.sqrt(1-a[2]),Cy(a,o,n)<c){let h,d;l?(h=a[2],d=1):(h=0,d=a[2]);const f=.005;for(;d-h>f;){const g=a[2]=(h+d)/2;l===Cy(a,o,n)<c?h=g:d=g}a[2]=l?d:h}return Xg(a,n),s=j.makeHexColor(Math.round(n[0]*255),Math.round(n[1]*255),Math.round(n[2]*255)),Py.set(e,s),s}function Qv({html:u,dir:t,className:e},s){const i=document.createDocumentFragment();if(typeof u=="string"){const n=document.createElement("p");n.dir=t||"auto";const a=u.split(/\r\n?|\n/);for(let o=0,l=a.length;o<l;++o){const c=a[o];n.append(document.createTextNode(c)),o<l-1&&n.append(document.createElement("br"))}i.append(n)}else wg.render({xfaHtml:u,div:i,intent:"richText"});i.firstElementChild.classList.add("richText",e),s.append(i)}function jb(u){const t=new Path2D;if(!u)return t;for(let e=0,s=u.length;e<s;)switch(u[e++]){case Rh.moveTo:t.moveTo(u[e++],u[e++]);break;case Rh.lineTo:t.lineTo(u[e++],u[e++]);break;case Rh.curveTo:t.bezierCurveTo(u[e++],u[e++],u[e++],u[e++],u[e++],u[e++]);break;case Rh.quadraticCurveTo:t.quadraticCurveTo(u[e++],u[e++],u[e++],u[e++]);break;case Rh.closePath:t.closePath();break;default:st(`Unrecognized drawing path operator: ${u[e-1]}`);break}return t}N0();nS();rS();aS();L0();H0();I0();k0();O0();U0();var xn,Tn,Js,Qs,wu,Cn,Gl,zl,Au,Ep,$b,je,Gb,zb,Fl,Lh;const Pr=class Pr{constructor(t){y(this,je);y(this,xn,null);y(this,Tn,null);y(this,Js);y(this,Qs,null);y(this,wu,null);y(this,Cn,null);y(this,Gl,null);y(this,zl,null);p(this,Js,t),r(Pr,Au)||p(Pr,Au,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){const t=p(this,xn,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=r(this,Js)._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",gi,{signal:e}),t.addEventListener("pointerdown",b(Pr,Ep,$b),{signal:e}));const s=p(this,Qs,document.createElement("div"));s.className="buttons",t.append(s);const i=r(this,Js).toolbarPosition;if(i){const{style:n}=t,a=r(this,Js)._uiManager.direction==="ltr"?1-i[0]:i[0];n.insetInlineEnd=`${100*a}%`,n.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return r(this,xn)}hide(){var t;r(this,xn).classList.add("hidden"),(t=r(this,Tn))==null||t.hideDropdown()}show(){var t,e;r(this,xn).classList.remove("hidden"),(t=r(this,wu))==null||t.shown(),(e=r(this,Cn))==null||e.shown()}addDeleteButton(){const{editorType:t,_uiManager:e}=r(this,Js),s=document.createElement("button");s.classList.add("basic","deleteButton"),s.tabIndex=0,s.setAttribute("data-l10n-id",r(Pr,Au)[t]),b(this,je,Fl).call(this,s)&&s.addEventListener("click",i=>{e.delete()},{signal:e._signal}),r(this,Qs).append(s)}async addAltText(t){const e=await t.render();b(this,je,Fl).call(this,e),r(this,Qs).append(e,r(this,je,Lh)),p(this,wu,t)}addComment(t,e=null){if(r(this,Cn))return;const s=t.renderForToolbar();if(!s)return;b(this,je,Fl).call(this,s);const i=p(this,Gl,r(this,je,Lh));e?(r(this,Qs).insertBefore(s,e),r(this,Qs).insertBefore(i,e)):r(this,Qs).append(s,i),p(this,Cn,t),t.toolbar=this}addColorPicker(t){if(r(this,Tn))return;p(this,Tn,t);const e=t.renderButton();b(this,je,Fl).call(this,e),r(this,Qs).append(e,r(this,je,Lh))}async addEditSignatureButton(t){const e=p(this,zl,await t.renderEditButton(r(this,Js)));e&&(b(this,je,Fl).call(this,e),r(this,Qs).append(e,r(this,je,Lh)))}removeButton(t){var e,s;switch(t){case"comment":(e=r(this,Cn))==null||e.removeToolbarCommentButton(),p(this,Cn,null),(s=r(this,Gl))==null||s.remove(),p(this,Gl,null);break}}async addButton(t,e){switch(t){case"colorPicker":e&&this.addColorPicker(e);break;case"altText":e&&await this.addAltText(e);break;case"editSignature":e&&await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":e&&this.addComment(e);break}}async addButtonBefore(t,e,s){if(!e&&t==="comment")return;const i=r(this,Qs).querySelector(s);i&&t==="comment"&&this.addComment(e,i)}updateEditSignatureButton(t){r(this,zl)&&(r(this,zl).title=t)}remove(){var t;r(this,xn).remove(),(t=r(this,Tn))==null||t.destroy(),p(this,Tn,null)}};xn=new WeakMap,Tn=new WeakMap,Js=new WeakMap,Qs=new WeakMap,wu=new WeakMap,Cn=new WeakMap,Gl=new WeakMap,zl=new WeakMap,Au=new WeakMap,Ep=new WeakSet,$b=function(t){t.stopPropagation()},je=new WeakSet,Gb=function(t){r(this,Js)._focusEventsAllowed=!1,me(t)},zb=function(t){r(this,Js)._focusEventsAllowed=!0,me(t)},Fl=function(t){const e=r(this,Js)._uiManager._signal;return!(e instanceof AbortSignal)||e.aborted?!1:(t.addEventListener("focusin",b(this,je,Gb).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",b(this,je,zb).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",gi,{signal:e}),!0)},Lh=function(){const t=document.createElement("div");return t.className="divider",t},y(Pr,Ep),y(Pr,Au,null);let Kg=Pr;var _u,Ga,Wi,yn,Vb,Wb,qg;class bS{constructor(t){y(this,yn);y(this,_u,null);y(this,Ga,null);y(this,Wi);p(this,Wi,t)}show(t,e,s){const[i,n]=b(this,yn,Wb).call(this,e,s),{style:a}=r(this,Ga)||p(this,Ga,b(this,yn,Vb).call(this));t.append(r(this,Ga)),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){r(this,Ga).remove()}}_u=new WeakMap,Ga=new WeakMap,Wi=new WeakMap,yn=new WeakSet,Vb=function(){const t=p(this,Ga,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.dir=r(this,Wi).direction;const e=r(this,Wi)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",gi,{signal:e});const s=p(this,_u,document.createElement("div"));return s.className="buttons",t.append(s),r(this,Wi).hasCommentManager()&&b(this,yn,qg).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{r(this,Wi).commentSelection("floating_button")}),b(this,yn,qg).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{r(this,Wi).highlightSelection("floating_button")}),t},Wb=function(t,e){let s=0,i=0;for(const n of t){const a=n.y+n.height;if(a<s)continue;const o=n.x+(e?n.width:0);if(a>s){i=o,s=a;continue}e?o>i&&(i=o):o<i&&(i=o)}return[e?1-i:i,s]},qg=function(t,e,s,i){const n=document.createElement("button");n.classList.add("basic",t),n.tabIndex=0,n.setAttribute("data-l10n-id",e);const a=document.createElement("span");n.append(a),a.className="visuallyHidden",a.setAttribute("data-l10n-id",s);const o=r(this,Wi)._signal;o instanceof AbortSignal&&!o.aborted&&(n.addEventListener("contextmenu",gi,{signal:o}),n.addEventListener("click",i,{signal:o})),r(this,_u).append(n)};const wS="2837668c-d334-48d1-ba74-aa7deba483da",Bg=Object.freeze({internal:wS});function Xb(u,t,e){for(const s of e)t.addEventListener(s,u[s].bind(u))}var za,Va,Vl,Wa;const Tt=class Tt{static initializeAndAddPointerId(t){(r(Tt,Va)||p(Tt,Va,new Set)).add(t)}static setPointer(t,e){r(Tt,za)||p(Tt,za,e),r(Tt,Wa)??p(Tt,Wa,t)}static setTimeStamp(t){p(Tt,Vl,t)}static isSamePointerId(t){return r(Tt,za)===t}static isSamePointerIdOrRemove(t){var e;return r(Tt,za)===t?!0:((e=r(Tt,Va))==null||e.delete(t),!1)}static isSamePointerType(t){return r(Tt,Wa)===t}static isInitializedAndDifferentPointerType(t){return r(Tt,Wa)!==null&&!Tt.isSamePointerType(t)}static isSameTimeStamp(t){return r(Tt,Vl)===t}static isUsingMultiplePointers(){var t;return((t=r(Tt,Va))==null?void 0:t.size)>=1}static clearPointerType(){p(Tt,Wa,null)}static clearPointerIds(){p(Tt,za,NaN),p(Tt,Va,null)}static clearTimeStamp(){p(Tt,Vl,NaN)}};za=new WeakMap,Va=new WeakMap,Vl=new WeakMap,Wa=new WeakMap,y(Tt,za,NaN),y(Tt,Va,null),y(Tt,Vl,NaN),y(Tt,Wa,null);let ze=Tt;var xp;class AS{constructor(){y(this,xp,0)}get id(){return`${wh}${Ft(this,xp)._++}`}}xp=new WeakMap;var Wl,Su,Ve,Xl,Pf;const hy=class hy{constructor(){y(this,Xl);y(this,Wl,Jv());y(this,Su,0);y(this,Ve,null)}static get _isSVGFittingCanvas(){const t=`data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="${ns}"><rect width="1" height="1" style="fill:red;"/></svg>`,s=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=t;const n=i.decode().then(()=>(s.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(s.getImageData(0,0,1,1).data.buffer)[0]===0));return V(this,"_isSVGFittingCanvas",n)}async getFromFile(t){const{lastModified:e,name:s,size:i,type:n}=t;return b(this,Xl,Pf).call(this,`${e}_${s}_${i}_${n}`,t)}async getFromUrl(t){return b(this,Xl,Pf).call(this,t,t)}async getFromBlob(t,e){const s=await e;return b(this,Xl,Pf).call(this,t,s)}async getFromId(t){r(this,Ve)||p(this,Ve,new Map);const e=r(this,Ve).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:s}=e;return delete e.blobPromise,this.getFromBlob(e.id,s)}return this.getFromUrl(e.url)}getFromCanvas(t,e){r(this,Ve)||p(this,Ve,new Map);let s=r(this,Ve).get(t);if(s!=null&&s.bitmap)return s.refCounter+=1,s;const i=new OffscreenCanvas(e.width,e.height);return i.getContext("2d").drawImage(e,0,0),s={bitmap:i.transferToImageBitmap(),id:`image_${r(this,Wl)}_${Ft(this,Su)._++}`,refCounter:1,isSvg:!1},r(this,Ve).set(t,s),r(this,Ve).set(s.id,s),s}getSvgUrl(t){const e=r(this,Ve).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){var i;r(this,Ve)||p(this,Ve,new Map);const e=r(this,Ve).get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;const{bitmap:s}=e;if(!e.url&&!e.file){const n=new OffscreenCanvas(s.width,s.height);n.getContext("bitmaprenderer").transferFromImageBitmap(s),e.blobPromise=n.convertToBlob()}(i=s.close)==null||i.call(s),e.bitmap=null}isValidId(t){return t.startsWith(`image_${r(this,Wl)}_`)}};Wl=new WeakMap,Su=new WeakMap,Ve=new WeakMap,Xl=new WeakSet,Pf=async function(t,e){r(this,Ve)||p(this,Ve,new Map);let s=r(this,Ve).get(t);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${r(this,Wl)}_${Ft(this,Su)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(s.url=e,i=await Ag(e,"blob")):e instanceof File?i=s.file=e:e instanceof Blob&&(i=e),i.type==="image/svg+xml"){const n=hy._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((c,h)=>{o.onload=()=>{s.bitmap=o,s.isSvg=!0,c()},a.onload=async()=>{const d=s.svgUrl=a.result;o.src=await n?`${d}#svgView(preserveAspectRatio(none))`:d},o.onerror=a.onerror=h});a.readAsDataURL(i),await l}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){st(i),s=null}return r(this,Ve).set(t,s),s&&r(this,Ve).set(s.id,s),s};let Jg=hy;var oe,Pn,Eu,qt;class _S{constructor(t=128){y(this,oe,[]);y(this,Pn,!1);y(this,Eu);y(this,qt,-1);p(this,Eu,t)}add({cmd:t,undo:e,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(i&&t(),r(this,Pn))return;const l={cmd:t,undo:e,post:s,type:n};if(r(this,qt)===-1){r(this,oe).length>0&&(r(this,oe).length=0),p(this,qt,0),r(this,oe).push(l);return}if(a&&r(this,oe)[r(this,qt)].type===n){o&&(l.undo=r(this,oe)[r(this,qt)].undo),r(this,oe)[r(this,qt)]=l;return}const c=r(this,qt)+1;c===r(this,Eu)?r(this,oe).splice(0,1):(p(this,qt,c),c<r(this,oe).length&&r(this,oe).splice(c)),r(this,oe).push(l)}undo(){if(r(this,qt)===-1)return;p(this,Pn,!0);const{undo:t,post:e}=r(this,oe)[r(this,qt)];t(),e==null||e(),p(this,Pn,!1),p(this,qt,r(this,qt)-1)}redo(){if(r(this,qt)<r(this,oe).length-1){p(this,qt,r(this,qt)+1),p(this,Pn,!0);const{cmd:t,post:e}=r(this,oe)[r(this,qt)];t(),e==null||e(),p(this,Pn,!1)}}hasSomethingToUndo(){return r(this,qt)!==-1}hasSomethingToRedo(){return r(this,qt)<r(this,oe).length-1}cleanType(t){if(r(this,qt)!==-1){for(let e=r(this,qt);e>=0;e--)if(r(this,oe)[e].type!==t){r(this,oe).splice(e+1,r(this,qt)-e),p(this,qt,e);return}r(this,oe).length=0,p(this,qt,-1)}}destroy(){p(this,oe,null)}}oe=new WeakMap,Pn=new WeakMap,Eu=new WeakMap,qt=new WeakMap;var Sh,Yb,Kb;const ms=class ms{constructor(t){var s;this.callbacks=new Map;const{isMac:e}=_t.platform;for(const[i,n,a={}]of t){const o=i.some(l=>l.startsWith("mac+"));for(const l of i){let c=l;if(o){const f=l.startsWith("mac+");if(e!==f)continue;f&&(c=l.slice(4))}const[h,d]=b(s=ms,Sh,Yb).call(s,c);h!==null&&this.callbacks.getOrInsertComputed(h,Pl).push({callback:n,options:a,modifiers:d})}}}exec(t,e){var h;let s=this.callbacks.get(e.key);if(!s){if(/^[a-z]$/i.test(e.key))return;const d=b(h=ms,Sh,Kb).call(h,e.code);if(d===null||d===e.key||(s=this.callbacks.get(d),!s))return}const i=(e.altKey?ms.ALT:0)|(e.ctrlKey?ms.CTRL:0)|(e.metaKey?ms.META:0)|(e.shiftKey?ms.SHIFT:0),n=s.find(d=>d.modifiers===i);if(!n)return;const{callback:a,options:{bubbles:o=!1,args:l=[],checker:c=null}}=n;c&&!c(t,e)||(a.bind(t,...l,e)(),o||me(e))}};Sh=new WeakSet,Yb=function(t){let e=null,s=0;for(let i of t.split("+")){if(i=i.trim(),!i)continue;const n=i.toUpperCase(),a=ms[n];if(a){s|=a;continue}if(e!==null){st(`KeyboardManager: multiple keys in shortcut "${t}"`);break}e=n==="SPACE"?" ":i}return e===null&&st(`KeyboardManager: no key found in shortcut "${t}"`),[e,s]},Kb=function(t){var s;const e=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(t);return e?((s=e[1])==null?void 0:s.toLowerCase())??e[2]:null},y(ms,Sh),O(ms,"ALT",1),O(ms,"CTRL",2),O(ms,"META",4),O(ms,"SHIFT",8);let bl=ms;const Tp=class Tp{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return vS(t),V(this,"_colors",t)}convert(t){const e=Ph(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[s,i]of this._colors)if(i.every((n,a)=>n===e[a]))return Tp._colorsMapping.get(s);return e}getHexCode(t){const e=this._colors.get(t);return e?j.makeHexColor(...e):t}};O(Tp,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let Qg=Tp;var Yl,Cs,Kl,Gt,Jt,ql,Jl,Ql,We,Zl,Zs,Ie,In,kn,Mn,On,Xi,ti,Xa,xu,Tu,tc,Cu,Yi,Rn,ec,Dn,Ki,Cp,kr,sc,Pu,Fn,Ya,ic,Ln,Iu,de,Ct,Mr,Nn,Bn,ku,rc,Mu,Un,qi,Or,Ou,Ru,ei,W,If,Zg,qb,Jb,Nh,Qb,Zb,tw,tm,ew,sw,iw,rw,Qe,Tr,nw,aw,em,ow,Bh,sm;const Hl=class Hl{constructor(t,e,s,i,n,a,o,l,c,h,d,f,g,m,v,w){y(this,W);y(this,Yl,new AbortController);y(this,Cs,null);y(this,Kl,null);y(this,Gt,new Map);y(this,Jt,new Map);y(this,ql,null);y(this,Jl,null);y(this,Ql,null);y(this,We,null);y(this,Zl,null);y(this,Zs,new _S);y(this,Ie,null);y(this,In,null);y(this,kn,null);y(this,Mn,0);y(this,On,new Set);y(this,Xi,null);y(this,ti,null);y(this,Xa,new Set);O(this,"_editorUndoBar",null);y(this,xu,!1);y(this,Tu,!1);y(this,tc,!1);y(this,Cu,null);y(this,Yi,null);y(this,Rn,null);y(this,ec,null);y(this,Dn,!1);y(this,Ki,null);y(this,Cp,new AS);y(this,kr,!1);y(this,sc,!1);y(this,Pu,!1);y(this,Fn,null);y(this,Ya,null);y(this,ic,null);y(this,Ln,null);y(this,Iu,null);y(this,de,it.NONE);y(this,Ct,new Set);y(this,Mr,null);y(this,Nn,null);y(this,Bn,null);y(this,ku,null);y(this,rc,null);y(this,Mu,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});y(this,Un,[0,0]);y(this,qi,null);y(this,Or,null);y(this,Ou,null);y(this,Ru,null);y(this,ei,null);const A=this._signal=r(this,Yl).signal;p(this,Or,t),p(this,Ou,e),p(this,Ru,s),p(this,Ql,i),p(this,Ie,n),p(this,Nn,a),p(this,rc,l),this._eventBus=o;const _={signal:A,...Bg};o.on("editingaction",this.onEditingAction.bind(this),_),o.on("pagechanging",this.onPageChanging.bind(this),_),o.on("scalechanging",this.onScaleChanging.bind(this),_),o.on("rotationchanging",this.onRotationChanging.bind(this),_),o.on("setpreference",this.onSetPreference.bind(this),_),o.on("switchannotationeditorparams",E=>this.updateParams(E.type,E.value),_),window.addEventListener("pointerdown",()=>{p(this,sc,!0)},{capture:!0,signal:A}),window.addEventListener("pointerup",()=>{p(this,sc,!1)},{capture:!0,signal:A}),window.addEventListener("beforeunload",this.endCurrentEditing.bind(this),{capture:!0,signal:A}),b(this,W,Qb).call(this),b(this,W,rw).call(this),b(this,W,tm).call(this),p(this,We,l.annotationStorage),p(this,Cu,l.filterFactory),p(this,Bn,c),p(this,ec,h||null),p(this,xu,d),p(this,Tu,f),p(this,tc,g),p(this,Iu,m||null),this.viewParameters={realScale:vn.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=v||null,this._supportsPinchToZoom=w!==!1,n==null||n.setSidebarUiManager(this)}static get _keyboardManager(){const t=Hl.prototype,e=a=>r(a,Or).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),s=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return V(this,"_keyboardManager",new bl([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],t.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:s}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:s}],[["Enter"],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,Or).contains(o)&&!a.isEnterHandled}],[["Space"],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,Or).contains(document.activeElement)}],[["Escape"],t.unselectAll],[["ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}destroy(){var t,e,s,i,n,a,o,l,c;(t=r(this,ei))==null||t.resolve(),p(this,ei,null),(e=r(this,Yl))==null||e.abort(),p(this,Yl,null),this._signal=null;for(const h of r(this,Jt).values())h.destroy();r(this,Jt).clear(),r(this,Gt).clear(),r(this,Xa).clear(),(s=r(this,Ln))==null||s.clear(),p(this,Cs,null),r(this,Ct).clear(),r(this,Zs).destroy(),(i=r(this,Ql))==null||i.destroy(),(n=r(this,Ie))==null||n.destroy(),(a=r(this,Nn))==null||a.destroy(),(o=r(this,Ki))==null||o.hide(),p(this,Ki,null),(l=r(this,ic))==null||l.destroy(),p(this,ic,null),p(this,Kl,null),r(this,Yi)&&(clearTimeout(r(this,Yi)),p(this,Yi,null)),r(this,qi)&&(clearTimeout(r(this,qi)),p(this,qi,null)),(c=this._editorUndoBar)==null||c.destroy(),p(this,rc,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return r(this,Iu)}get useNewAltTextFlow(){return r(this,Tu)}get useNewAltTextWhenAddingImage(){return r(this,tc)}get hcmFilter(){return V(this,"hcmFilter",r(this,Bn)?r(this,Cu).addHCMFilter(r(this,Bn).foreground,r(this,Bn).background):"none")}get direction(){return V(this,"direction",getComputedStyle(r(this,Or)).direction)}get _highlightColors(){return V(this,"_highlightColors",r(this,ec)?new Map(r(this,ec).split(",").map(t=>(t=t.split("=").map(e=>e.trim()),t[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){const{_highlightColors:t}=this;if(!t)return V(this,"highlightColors",null);const e=new Map,s=!!r(this,Bn);for(const[i,n]of t){const a=i.endsWith("_HCM");if(s&&a){e.set(i.replace("_HCM",""),n);continue}!s&&!a&&e.set(i,n)}return V(this,"highlightColors",e)}get highlightColorNames(){return V(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;const e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),p(this,kn,t)}setMainHighlightColorPicker(t){p(this,ic,t)}editAltText(t,e=!1){var s;(s=r(this,Ql))==null||s.editAltText(this,t,e)}hasCommentManager(){return!!r(this,Ie)}editComment(t,e,s,i){var n;(n=r(this,Ie))==null||n.showDialog(this,t,e,s,i)}selectComment(t,e){const s=r(this,Jt).get(t),i=s==null?void 0:s.getEditorByUID(e);i==null||i.toggleComment(!0,!0)}updateComment(t){var e;(e=r(this,Ie))==null||e.updateComment(t.getData())}updatePopupColor(t){var e;(e=r(this,Ie))==null||e.updatePopupColor(t)}removeComment(t){var e;(e=r(this,Ie))==null||e.removeComments([t.uid])}deleteComment(t,e){const s=()=>{t.comment=e},i=()=>{var n;(n=this._editorUndoBar)==null||n.show(s,"comment"),this.toggleComment(null),t.comment=null};this.addCommands({cmd:i,undo:s,mustExec:!0})}toggleComment(t,e,s=void 0){var i;(i=r(this,Ie))==null||i.toggleCommentPopup(t,e,s)}makeCommentColor(t,e){var s;return t&&((s=r(this,Ie))==null?void 0:s.makeCommentColor(t,e))||null}getCommentDialogElement(){var t;return((t=r(this,Ie))==null?void 0:t.dialogElement)||null}async waitForEditorsRendered(t){if(r(this,Jt).has(t-1))return;const{resolve:e,promise:s}=Promise.withResolvers(),i=n=>{n.pageNumber===t&&(this._eventBus.off("editorsrendered",i),e())};this._eventBus.on("editorsrendered",i,Bg),await s}getSignature(t){var e;(e=r(this,Nn))==null||e.getSignature({uiManager:this,editor:t})}get signatureManager(){return r(this,Nn)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal,...Bg}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){switch(t){case"enableNewAltTextWhenAddingImage":p(this,tc,e);break}}onPageChanging({pageNumber:t}){p(this,Mn,t-1)}deletePage(t){for(const e of this.getEditors(t))e.remove();r(this,Jt).delete(t),r(this,Mn)===t&&p(this,Mn,0)}focusMainContainer(){r(this,Or).focus()}findParent(t,e){for(const s of r(this,Jt).values()){const{x:i,y:n,width:a,height:o}=s.div.getBoundingClientRect();if(t>=i&&t<=i+a&&e>=n&&e<=n+o)return s}return null}disableUserSelect(t=!1){r(this,Ou).classList.toggle("noUserSelect",t)}addShouldRescale(t){r(this,Xa).add(t)}removeShouldRescale(t){r(this,Xa).delete(t)}onScaleChanging({scale:t}){var e;this.commitOrRemove(),this.viewParameters.realScale=t*vn.PDF_TO_CSS_UNITS;for(const s of r(this,Xa))s.onScaleChanging();(e=r(this,kn))==null||e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t="",e=!1){const s=document.getSelection();if(!s||s.isCollapsed)return;const{anchorNode:i,anchorOffset:n,focusNode:a,focusOffset:o}=s,l=s.toString(),h=b(this,W,If).call(this,s).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;s.empty();const f=b(this,W,Zg).call(this,h),g=r(this,de)===it.NONE,m=()=>{const v=f==null?void 0:f.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:i,anchorOffset:n,focusNode:a,focusOffset:o,text:l});g&&this.showAllEditors("highlight",!0,!0),e&&(v==null||v.editComment())};if(g){this.switchToMode(it.HIGHLIGHT,m);return}m()}commentSelection(t=""){this.highlightSelection(t,!0)}endCurrentEditing(){var t;this.commitOrRemove(),(t=this.currentLayer)==null||t.endDrawingSession(!1)}getAndRemoveDataFromAnnotationStorage(t){if(!r(this,We))return null;const e=`${wh}${t}`,s=r(this,We).getRawValue(e);return s&&r(this,We).remove(e),s}addToAnnotationStorage(t){!t.isEmpty()&&r(this,We)&&!r(this,We).has(t.id)&&r(this,We).setValue(t.id,t)}a11yAlert(t,e=null){const s=r(this,Ru);s&&(s.setAttribute("data-l10n-id",t),e?s.setAttribute("data-l10n-args",JSON.stringify(e)):s.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,r(this,Dn)&&(p(this,Dn,!1),b(this,W,Nh).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of r(this,Ct))if(e.div.contains(t)){p(this,Ya,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!r(this,Ya))return;const[t,e]=r(this,Ya);p(this,Ya,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){b(this,W,tm).call(this),this.setEditingState(!0)}removeEditListeners(){b(this,W,ew).call(this),this.setEditingState(!1)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const s of r(this,ti))if(s.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const e of t.dataTransfer.items)for(const s of r(this,ti))if(s.isHandlingMimeForPasting(e.type)){s.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var s;if(t.preventDefault(),(s=r(this,Cs))==null||s.commitOrRemove(),!this.hasSelection)return;const e=[];for(const i of r(this,Ct)){const n=i.serialize(!0);n&&e.push(n)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const n of e.items)for(const a of r(this,ti))if(a.isHandlingMimeForPasting(n.type)){a.paste(n,this.currentLayer);return}let s=e.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(n){st(`paste: "${n.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const n=[];for(const l of s){const c=await i.deserialize(l);if(!c)return;n.push(c)}const a=()=>{for(const l of n)b(this,W,em).call(this,l);b(this,W,sm).call(this,n)},o=()=>{for(const l of n)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(n){st(`paste: "${n.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),r(this,de)!==it.NONE&&!this.isEditorHandlingKeyboard&&Hl._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,r(this,Dn)&&(p(this,Dn,!1),b(this,W,Nh).call(this,"main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}updatePageIndex(t,e){for(const i of r(this,Jl).get(t)||[])i.pageIndex=e;const s=r(this,ql).get(t);s&&(s.pageIndex=e,r(this,Jt).set(e,s),r(this,kr)?s.enable():s.disable())}startUpdatePages(){p(this,ql,new Map(r(this,Jt))),r(this,Jt).clear();const t=p(this,Jl,new Map),e=s=>{t.getOrInsertComputed(s.pageIndex,Pl).push(s)};for(const s of r(this,Gt).values())e(s);for(const[s,i]of r(this,We))s.startsWith(wh)&&!r(this,Gt).has(s)&&Number.isInteger(i==null?void 0:i.pageIndex)&&e(i)}endUpdatePages(){p(this,ql,null),p(this,Jl,null)}clonePage(t,e){for(const s of this.getEditors(t)){const i=s.serialize(s.mode!==it.HIGHLIGHT);i&&(i.pageIndex=e,i.id=this.getId(),i.isClone=!0,delete i.popupRef,r(this,We).setValue(i.id,i))}}findClonesForPage(t){const e=[],{pageIndex:s}=t;for(const[i,n]of r(this,We))n.pageIndex===s&&n.isClone&&(r(this,We).remove(i),e.push(t.deserialize(n).then(a=>{a&&(a.isClone=!0,t.addOrRebuild(a))})));return Promise.all(e)}setEditingState(t){t?(b(this,W,Zb).call(this),b(this,W,sw).call(this),b(this,W,Qe).call(this,{isEditing:r(this,de)!==it.NONE,isEmpty:b(this,W,Bh).call(this),hasSomethingToUndo:r(this,Zs).hasSomethingToUndo(),hasSomethingToRedo:r(this,Zs).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,W,tw).call(this),b(this,W,iw).call(this),b(this,W,Qe).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!r(this,ti)){p(this,ti,t);for(const e of r(this,ti))b(this,W,Tr).call(this,e.defaultPropertiesToUpdate)}}getId(){return r(this,Cp).id}get currentLayer(){return r(this,Jt).get(r(this,Mn))}getLayer(t){return r(this,Jt).get(t)}get currentPageIndex(){return r(this,Mn)}addLayer(t){r(this,Jt).set(t.pageIndex,t),r(this,kr)?t.enable():t.disable()}removeLayer(t){r(this,Jt).delete(t.pageIndex)}async updateMode(t,e=null,s=!1,i=!1,n=!1,a=!1){var o,l,c,h,d,f;if(r(this,de)!==t&&!(r(this,ei)&&(await r(this,ei).promise,!r(this,ei)))){if(p(this,ei,Promise.withResolvers()),(o=r(this,kn))==null||o.commitOrRemove(),r(this,de)===it.POPUP&&((l=r(this,Ie))==null||l.hideSidebar()),(c=r(this,Ie))==null||c.destroyPopup(),p(this,de,t),t===it.NONE){this.setEditingState(!1),b(this,W,aw).call(this);for(const g of r(this,Gt).values())g.hideStandaloneCommentButton();(h=this._editorUndoBar)==null||h.hide(),this.toggleComment(null),r(this,ei).resolve();return}for(const g of r(this,Gt).values())g.addStandaloneCommentButton();t===it.SIGNATURE&&await((d=r(this,Nn))==null?void 0:d.loadSignatures()),s&&ze.clearPointerType(),this.setEditingState(!0),await b(this,W,nw).call(this),this.unselectAll();for(const g of r(this,Jt).values())g.updateMode(t);if(t===it.POPUP){r(this,Kl)||p(this,Kl,await r(this,rc).getAnnotationsByType(new Set(r(this,ti).map(v=>v._editorType))));const g=new Set,m=[];for(const v of r(this,Gt).values()){const{annotationElementId:w,hasComment:A,deleted:_}=v;w&&g.add(w),A&&!_&&m.push(v.getData())}for(const v of r(this,Kl)){const{id:w,popupRef:A,contentsObj:_}=v;A&&(_!=null&&_.str)&&!g.has(w)&&!r(this,On).has(w)&&m.push(v)}(f=r(this,Ie))==null||f.showSidebar(m)}if(!e){i&&this.addNewEditorFromKeyboard(),r(this,ei).resolve();return}for(const g of r(this,Gt).values())g.uid===e?(this.setSelected(g),a?g.editComment():n?g.enterInEditMode():g.focus()):g.unselect();r(this,ei).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==r(this,de)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(r(this,ti)){switch(t){case dt.CREATE:this.currentLayer.addNewEditor(e);return;case dt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(r(this,ku)||p(this,ku,new Map)).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(const s of r(this,Ct))s.updateParams(t,e);else for(const s of r(this,ti))s.updateDefaultParams(t,e)}}showAllEditors(t,e,s=!1){var n;for(const a of r(this,Gt).values())a.editorType===t&&a.show(e);(((n=r(this,ku))==null?void 0:n.get(dt.HIGHLIGHT_SHOW_ALL))??!0)!==e&&b(this,W,Tr).call(this,[[dt.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(r(this,Pu)!==t){p(this,Pu,t);for(const e of r(this,Jt).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(const e of r(this,Gt).values())e.pageIndex===t&&(yield e)}getEditor(t){return r(this,Gt).get(t)}addEditor(t){r(this,Gt).set(t.id,t)}removeEditor(t){var e,s;t.div.contains(document.activeElement)&&(r(this,Yi)&&clearTimeout(r(this,Yi)),p(this,Yi,setTimeout(()=>{this.focusMainContainer(),p(this,Yi,null)},0))),r(this,Gt).delete(t.id),t.annotationElementId&&((e=r(this,Ln))==null||e.delete(t.annotationElementId)),this.unselect(t),(!t.annotationElementId||!r(this,On).has(t.annotationElementId))&&((s=r(this,We))==null||s.remove(t.id))}addDeletedAnnotationElement(t){r(this,On).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return r(this,On).has(t)}removeDeletedAnnotationElement(t){r(this,On).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){r(this,Cs)!==t&&(p(this,Cs,t),t&&b(this,W,Tr).call(this,t.propertiesToUpdate))}updateUI(t){r(this,W,ow)===t&&b(this,W,Tr).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){b(this,W,Tr).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(r(this,Ct).has(t)){r(this,Ct).delete(t),t.unselect(),b(this,W,Qe).call(this,{hasSelectedEditor:this.hasSelection});return}r(this,Ct).add(t),t.select(),b(this,W,Tr).call(this,t.propertiesToUpdate),b(this,W,Qe).call(this,{hasSelectedEditor:!0})}setSelected(t){var e,s;this.updateToolbar({mode:t.mode,editId:t.uid}),(e=r(this,kn))==null||e.commitOrRemove();for(const i of r(this,Ct))i!==t&&i.unselect();(s=r(this,Ie))==null||s.destroyPopup(),r(this,Ct).clear(),r(this,Ct).add(t),t.select(),b(this,W,Tr).call(this,t.propertiesToUpdate),b(this,W,Qe).call(this,{hasSelectedEditor:!0})}get firstSelectedEditor(){return r(this,Ct).values().next().value}unselect(t){t.unselect(),r(this,Ct).delete(t),b(this,W,Qe).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return r(this,Ct).size!==0}get isEnterHandled(){return r(this,Ct).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var t;r(this,Zs).undo(),b(this,W,Qe).call(this,{hasSomethingToUndo:r(this,Zs).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,W,Bh).call(this)}),(t=this._editorUndoBar)==null||t.hide()}redo(){r(this,Zs).redo(),b(this,W,Qe).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:r(this,Zs).hasSomethingToRedo(),isEmpty:b(this,W,Bh).call(this)})}addCommands(t){r(this,Zs).add(t),b(this,W,Qe).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,W,Bh).call(this)})}cleanUndoStack(t){r(this,Zs).cleanType(t)}delete(){var n;this.commitOrRemove();const t=(n=this.currentLayer)==null?void 0:n.endDrawingSession(!0);if(!this.hasSelection&&!t)return;const e=t?[t]:[...r(this,Ct)],s=()=>{var a;(a=this._editorUndoBar)==null||a.show(i,e.length===1?e[0].editorType:e.length);for(const o of e)o.remove()},i=()=>{for(const a of e)b(this,W,em).call(this,a)};this.addCommands({cmd:s,undo:i,mustExec:!0})}commitOrRemove(){var t;(t=r(this,Cs))==null||t.commitOrRemove()}hasSomethingToControl(){return r(this,Cs)||this.hasSelection}selectAll(){for(const t of r(this,Ct))t.commit();b(this,W,sm).call(this,r(this,Gt).values())}unselectAll(){var t,e;if(!(r(this,Cs)&&(r(this,Cs).commitOrRemove(),r(this,de)!==it.NONE))&&!((t=r(this,kn))!=null&&t.commitOrRemove())&&((e=r(this,Ie))==null||e.destroyPopup(),!!this.hasSelection)){for(const s of r(this,Ct))s.unselect();r(this,Ct).clear(),b(this,W,Qe).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;r(this,Un)[0]+=t,r(this,Un)[1]+=e;const[i,n]=r(this,Un),a=[...r(this,Ct)],o=1e3;r(this,qi)&&clearTimeout(r(this,qi)),p(this,qi,setTimeout(()=>{p(this,qi,null),r(this,Un)[0]=r(this,Un)[1]=0,this.addCommands({cmd:()=>{for(const l of a)r(this,Gt).has(l.id)&&(l.translateInPage(i,n),l.translationDone())},undo:()=>{for(const l of a)r(this,Gt).has(l.id)&&(l.translateInPage(-i,-n),l.translationDone())},mustExec:!1})},o));for(const l of a)l.translateInPage(t,e),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),p(this,Xi,new Map);for(const t of r(this,Ct))r(this,Xi).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!r(this,Xi))return!1;this.disableUserSelect(!1);const t=r(this,Xi);p(this,Xi,null);let e=!1;for(const[{x:i,y:n,pageIndex:a},o]of t)o.newX=i,o.newY=n,o.newPageIndex=a,e||(e=i!==o.savedX||n!==o.savedY||a!==o.savedPageIndex);if(!e)return!1;const s=(i,n,a,o)=>{if(r(this,Gt).has(i.id)){const l=r(this,Jt).get(o);l?i._setParentAndPosition(l,n,a):(i.pageIndex=o,i.x=n,i.y=a)}};return this.addCommands({cmd:()=>{for(const[i,{newX:n,newY:a,newPageIndex:o}]of t)s(i,n,a,o)},undo:()=>{for(const[i,{savedX:n,savedY:a,savedPageIndex:o}]of t)s(i,n,a,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(r(this,Xi))for(const s of r(this,Xi).keys())s.drag(t,e)}rebuild(t){if(t.parent===null){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return((t=this.getActive())==null?void 0:t.shouldGetKeyboardEvents())||r(this,Ct).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return r(this,Cs)===t}getActive(){return r(this,Cs)}getMode(){return r(this,de)}isEditingMode(){return r(this,de)!==it.NONE}get imageManager(){return V(this,"imageManager",new Jg)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let c=0,h=e.rangeCount;c<h;c++)if(!t.contains(e.getRangeAt(c).commonAncestorContainer))return null;const{x:s,y:i,width:n,height:a}=t.getBoundingClientRect();let o;switch(t.getAttribute("data-main-rotation")){case"90":o=(c,h,d,f)=>({x:(h-i)/a,y:1-(c+d-s)/n,width:f/a,height:d/n});break;case"180":o=(c,h,d,f)=>({x:1-(c+d-s)/n,y:1-(h+f-i)/a,width:d/n,height:f/a});break;case"270":o=(c,h,d,f)=>({x:1-(h+f-i)/a,y:(c-s)/n,width:f/a,height:d/n});break;default:o=(c,h,d,f)=>({x:(c-s)/n,y:(h-i)/a,width:d/n,height:f/a});break}const l=[];for(let c=0,h=e.rangeCount;c<h;c++){const d=e.getRangeAt(c);if(!d.collapsed)for(const{x:f,y:g,width:m,height:v}of d.getClientRects())m===0||v===0||l.push(o(f,g,m,v))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:t,id:e}){(r(this,Zl)||p(this,Zl,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;(e=r(this,Zl))==null||e.delete(t)}renderAnnotationElement(t){var i;const e=(i=r(this,Zl))==null?void 0:i.get(t.data.id);if(!e)return;const s=r(this,We).getRawValue(e);s&&(r(this,de)===it.NONE&&!s.hasBeenModified||s.renderAnnotationElement(t))}setMissingCanvas(t,e,s){var n;const i=(n=r(this,Ln))==null?void 0:n.get(t);i&&(i.setCanvas(e,s),r(this,Ln).delete(t))}addMissingCanvas(t,e){(r(this,Ln)||p(this,Ln,new Map)).set(t,e)}};Yl=new WeakMap,Cs=new WeakMap,Kl=new WeakMap,Gt=new WeakMap,Jt=new WeakMap,ql=new WeakMap,Jl=new WeakMap,Ql=new WeakMap,We=new WeakMap,Zl=new WeakMap,Zs=new WeakMap,Ie=new WeakMap,In=new WeakMap,kn=new WeakMap,Mn=new WeakMap,On=new WeakMap,Xi=new WeakMap,ti=new WeakMap,Xa=new WeakMap,xu=new WeakMap,Tu=new WeakMap,tc=new WeakMap,Cu=new WeakMap,Yi=new WeakMap,Rn=new WeakMap,ec=new WeakMap,Dn=new WeakMap,Ki=new WeakMap,Cp=new WeakMap,kr=new WeakMap,sc=new WeakMap,Pu=new WeakMap,Fn=new WeakMap,Ya=new WeakMap,ic=new WeakMap,Ln=new WeakMap,Iu=new WeakMap,de=new WeakMap,Ct=new WeakMap,Mr=new WeakMap,Nn=new WeakMap,Bn=new WeakMap,ku=new WeakMap,rc=new WeakMap,Mu=new WeakMap,Un=new WeakMap,qi=new WeakMap,Or=new WeakMap,Ou=new WeakMap,Ru=new WeakMap,ei=new WeakMap,W=new WeakSet,If=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},Zg=function(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const s of r(this,Jt).values())if(s.hasTextLayer(t))return s;return null},qb=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const s=b(this,W,If).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(s);i&&(r(this,Ki)||p(this,Ki,new bS(this)),r(this,Ki).show(s,i,this.direction==="ltr"))},Jb=function(){var n,a,o;const t=document.getSelection();if(!t||t.isCollapsed){r(this,Mr)&&((n=r(this,Ki))==null||n.hide(),p(this,Mr,null),b(this,W,Qe).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=t;if(e===r(this,Mr))return;const i=b(this,W,If).call(this,t).closest(".textLayer");if(!i){r(this,Mr)&&((a=r(this,Ki))==null||a.hide(),p(this,Mr,null),b(this,W,Qe).call(this,{hasSelectedText:!1}));return}if((o=r(this,Ki))==null||o.hide(),p(this,Mr,e),b(this,W,Qe).call(this,{hasSelectedText:!0}),!(r(this,de)!==it.HIGHLIGHT&&r(this,de)!==it.NONE)&&(r(this,de)===it.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),p(this,Dn,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=r(this,de)===it.HIGHLIGHT?b(this,W,Zg).call(this,i):null;if(l==null||l.toggleDrawing(),r(this,sc)){const c=new AbortController,h=this.combinedSignal(c),d=f=>{f.type==="pointerup"&&f.button!==0||(c.abort(),l==null||l.toggleDrawing(!0),f.type==="pointerup"&&b(this,W,Nh).call(this,"main_toolbar"))};window.addEventListener("pointerup",d,{signal:h}),window.addEventListener("blur",d,{signal:h})}else l==null||l.toggleDrawing(!0),b(this,W,Nh).call(this,"main_toolbar")}},Nh=function(t=""){r(this,de)===it.HIGHLIGHT?this.highlightSelection(t):r(this,xu)&&b(this,W,qb).call(this)},Qb=function(){document.addEventListener("selectionchange",b(this,W,Jb).bind(this),{signal:this._signal})},Zb=function(){if(r(this,Rn))return;p(this,Rn,new AbortController);const t=this.combinedSignal(r(this,Rn));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},tw=function(){var t;(t=r(this,Rn))==null||t.abort(),p(this,Rn,null)},tm=function(){if(r(this,Fn))return;p(this,Fn,new AbortController);const t=this.combinedSignal(r(this,Fn));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},ew=function(){var t;(t=r(this,Fn))==null||t.abort(),p(this,Fn,null)},sw=function(){if(r(this,In))return;p(this,In,new AbortController);const t=this.combinedSignal(r(this,In));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})},iw=function(){var t;(t=r(this,In))==null||t.abort(),p(this,In,null)},rw=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},Qe=function(t){Object.entries(t).some(([s,i])=>r(this,Mu)[s]!==i)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(r(this,Mu),t)}),r(this,de)===it.HIGHLIGHT&&t.hasSelectedEditor===!1&&b(this,W,Tr).call(this,[[dt.HIGHLIGHT_FREE,!0]]))},Tr=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},nw=async function(){if(!r(this,kr)){p(this,kr,!0);const t=[];for(const e of r(this,Jt).values())t.push(e.enable());await Promise.all(t);for(const e of r(this,Gt).values())e.enable()}},aw=function(){if(this.unselectAll(),r(this,kr)){p(this,kr,!1);for(const t of r(this,Jt).values())t.disable();for(const t of r(this,Gt).values())t.disable()}},em=function(t){const e=r(this,Jt).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},ow=function(){let t=null;for(t of r(this,Ct));return t},Bh=function(){if(r(this,Gt).size===0)return!0;if(r(this,Gt).size===1)for(const t of r(this,Gt).values())return t.isEmpty();return!1},sm=function(t){for(const e of r(this,Ct))e.unselect();r(this,Ct).clear();for(const e of t)e.isEmpty()||(r(this,Ct).add(e),e.select());b(this,W,Qe).call(this,{hasSelectedEditor:this.hasSelection})},O(Hl,"TRANSLATE_SMALL",1),O(Hl,"TRANSLATE_BIG",10);let Ia=Hl;var ke,Ji,Ai,nc,Qi,Ps,ac,Zi,ys,Rr,Ka,tr,Hn,Bi,Uh,kf;const Ze=class Ze{constructor(t){y(this,Bi);y(this,ke,null);y(this,Ji,!1);y(this,Ai,null);y(this,nc,null);y(this,Qi,null);y(this,Ps,null);y(this,ac,!1);y(this,Zi,null);y(this,ys,null);y(this,Rr,null);y(this,Ka,null);y(this,tr,!1);p(this,ys,t),p(this,tr,t._uiManager.useNewAltTextFlow),r(Ze,Hn)||p(Ze,Hn,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){Ze._l10n??(Ze._l10n=t)}async render(){const t=p(this,Ai,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=p(this,nc,document.createElement("span"));t.append(e),r(this,tr)?(t.classList.add("new"),t.setAttribute("data-l10n-id",r(Ze,Hn).missing),e.setAttribute("data-l10n-id",r(Ze,Hn)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const s=r(this,ys)._uiManager._signal;t.addEventListener("contextmenu",gi,{signal:s}),t.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),r(this,ys)._uiManager.editAltText(r(this,ys)),r(this,tr)&&r(this,ys)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:r(this,Bi,Uh)}})};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",n=>{n.target===t&&n.key==="Enter"&&(p(this,ac,!0),i(n))},{signal:s}),await b(this,Bi,kf).call(this),t}finish(){r(this,Ai)&&(r(this,Ai).focus({focusVisible:r(this,ac)}),p(this,ac,!1))}isEmpty(){return r(this,tr)?r(this,ke)===null:!r(this,ke)&&!r(this,Ji)}hasData(){return r(this,tr)?r(this,ke)!==null||!!r(this,Rr):this.isEmpty()}get guessedText(){return r(this,Rr)}async setGuessedText(t){r(this,ke)===null&&(p(this,Rr,t),p(this,Ka,await Ze._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),b(this,Bi,kf).call(this))}toggleAltTextBadge(t=!1){var e;if(!r(this,tr)||r(this,ke)){(e=r(this,Zi))==null||e.remove(),p(this,Zi,null);return}if(!r(this,Zi)){const s=p(this,Zi,document.createElement("div"));s.className="noAltTextBadge",r(this,ys).div.append(s)}r(this,Zi).classList.toggle("hidden",!t)}serialize(t){let e=r(this,ke);return!t&&r(this,Rr)===e&&(e=r(this,Ka)),{altText:e,decorative:r(this,Ji),guessedText:r(this,Rr),textWithDisclaimer:r(this,Ka)}}get data(){return{altText:r(this,ke),decorative:r(this,Ji)}}set data({altText:t,decorative:e,guessedText:s,textWithDisclaimer:i,cancel:n=!1}){s&&(p(this,Rr,s),p(this,Ka,i)),!(r(this,ke)===t&&r(this,Ji)===e)&&(n||(p(this,ke,t),p(this,Ji,e)),b(this,Bi,kf).call(this))}toggle(t=!1){r(this,Ai)&&(!t&&r(this,Ps)&&(clearTimeout(r(this,Ps)),p(this,Ps,null)),r(this,Ai).disabled=!t)}shown(){r(this,ys)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:r(this,Bi,Uh)}})}destroy(){var t,e;(t=r(this,Ai))==null||t.remove(),p(this,Ai,null),p(this,nc,null),p(this,Qi,null),(e=r(this,Zi))==null||e.remove(),p(this,Zi,null)}};ke=new WeakMap,Ji=new WeakMap,Ai=new WeakMap,nc=new WeakMap,Qi=new WeakMap,Ps=new WeakMap,ac=new WeakMap,Zi=new WeakMap,ys=new WeakMap,Rr=new WeakMap,Ka=new WeakMap,tr=new WeakMap,Hn=new WeakMap,Bi=new WeakSet,Uh=function(){return r(this,ke)&&"added"||r(this,ke)===null&&this.guessedText&&"review"||"missing"},kf=async function(){var i,n,a;const t=r(this,Ai);if(!t)return;if(r(this,tr)){if(t.classList.toggle("done",!!r(this,ke)),t.setAttribute("data-l10n-id",r(Ze,Hn)[r(this,Bi,Uh)]),(i=r(this,nc))==null||i.setAttribute("data-l10n-id",r(Ze,Hn)[`${r(this,Bi,Uh)}-label`]),!r(this,ke)){(n=r(this,Qi))==null||n.remove();return}}else{if(!r(this,ke)&&!r(this,Ji)){t.classList.remove("done"),(a=r(this,Qi))==null||a.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=r(this,Qi);if(!e){p(this,Qi,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${r(this,ys).id}`;const o=100,l=r(this,ys)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(r(this,Ps)),p(this,Ps,null)},{once:!0}),t.addEventListener("mouseenter",()=>{p(this,Ps,setTimeout(()=>{p(this,Ps,null),r(this,Qi).classList.add("show"),r(this,ys)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),t.addEventListener("mouseleave",()=>{var c;r(this,Ps)&&(clearTimeout(r(this,Ps)),p(this,Ps,null)),(c=r(this,Qi))==null||c.classList.remove("show")},{signal:l})}r(this,Ji)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=r(this,ke)),e.parentNode||t.append(e);const s=r(this,ys).getElementForAltText();s==null||s.setAttribute("aria-describedby",e.id)},y(Ze,Hn,null),O(Ze,"_l10n",null);let mp=Ze;var De,si,qa,Lt,Du,jn,ii,$n,Gn,Ja,Fu,im;class yf{constructor(t){y(this,Fu);y(this,De,null);y(this,si,null);y(this,qa,!1);y(this,Lt,null);y(this,Du,null);y(this,jn,null);y(this,ii,null);y(this,$n,null);y(this,Gn,!1);y(this,Ja,null);p(this,Lt,t)}renderForToolbar(){const t=p(this,si,document.createElement("button"));return t.className="comment",b(this,Fu,im).call(this,t,!1)}renderForStandalone(){const t=p(this,De,document.createElement("button"));t.className="annotationCommentButton";const e=r(this,Lt).commentButtonPosition;if(e){const{style:s}=t;s.insetInlineEnd=`calc(${100*(r(this,Lt)._uiManager.direction==="ltr"?1-e[0]:e[0])}% - var(--comment-button-dim))`,s.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;const i=r(this,Lt).commentButtonColor;i&&(s.backgroundColor=i)}return b(this,Fu,im).call(this,t,!0)}focusButton(){setTimeout(()=>{var t;(t=r(this,De)??r(this,si))==null||t.focus()},0)}onUpdatedColor(){if(!r(this,De))return;const t=r(this,Lt).commentButtonColor;t&&(r(this,De).style.backgroundColor=t),r(this,Lt)._uiManager.updatePopupColor(r(this,Lt))}get commentButtonWidth(){var t;return(((t=r(this,De))==null?void 0:t.getBoundingClientRect().width)??0)/r(this,Lt).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(r(this,Ja))return r(this,Ja);if(!r(this,De))return null;const{x:t,y:e,height:s}=r(this,De).getBoundingClientRect(),{x:i,y:n,width:a,height:o}=r(this,Lt).parent.boundingClientRect;return[(t-i)/a,(e+s-n)/o]}set commentPopupPositionInLayer(t){p(this,Ja,t)}hasDefaultPopupPosition(){return r(this,Ja)===null}removeStandaloneCommentButton(){var t;(t=r(this,De))==null||t.remove(),p(this,De,null)}removeToolbarCommentButton(){var t;(t=r(this,si))==null||t.remove(),p(this,si,null)}setCommentButtonStates({selected:t,hasPopup:e}){r(this,De)&&(r(this,De).classList.toggle("selected",t),r(this,De).ariaExpanded=e)}edit(t){const e=this.commentPopupPositionInLayer;let s,i;if(e)[s,i]=e;else{[s,i]=r(this,Lt).commentButtonPosition;const{width:h,height:d,x:f,y:g}=r(this,Lt);s=f+s*h,i=g+i*d}const n=r(this,Lt).parent.boundingClientRect,{x:a,y:o,width:l,height:c}=n;r(this,Lt)._uiManager.editComment(r(this,Lt),a+s*l,o+i*c,{...t,parentDimensions:n})}finish(){r(this,si)&&(r(this,si).focus({focusVisible:r(this,qa)}),p(this,qa,!1))}isDeleted(){return r(this,Gn)||r(this,ii)===""}isEmpty(){return r(this,ii)===null}hasBeenEdited(){return this.isDeleted()||r(this,ii)!==r(this,Du)}serialize(){return this.data}get data(){return{text:r(this,ii),richText:r(this,jn),date:r(this,$n),deleted:this.isDeleted()}}set data(t){if(t!==r(this,ii)&&p(this,jn,null),t===null){p(this,ii,""),p(this,Gn,!0);return}p(this,ii,t),p(this,$n,new Date),p(this,Gn,!1)}restoreData({text:t,richText:e,date:s}){p(this,ii,t),p(this,jn,e),p(this,$n,s),p(this,Gn,!1)}setInitialText(t,e=null){p(this,Du,t),this.data=t,p(this,$n,null),p(this,jn,e)}shown(){}destroy(){var t,e;(t=r(this,si))==null||t.remove(),p(this,si,null),(e=r(this,De))==null||e.remove(),p(this,De,null),p(this,ii,""),p(this,jn,null),p(this,$n,null),p(this,Lt,null),p(this,qa,!1),p(this,Gn,!1)}}De=new WeakMap,si=new WeakMap,qa=new WeakMap,Lt=new WeakMap,Du=new WeakMap,jn=new WeakMap,ii=new WeakMap,$n=new WeakMap,Gn=new WeakMap,Ja=new WeakMap,Fu=new WeakSet,im=function(t,e){if(!r(this,Lt)._uiManager.hasCommentManager())return null;t.tabIndex="0",t.ariaHasPopup="dialog",e?(t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(t.ariaControlsElements=[r(this,Lt)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));const s=r(this,Lt)._uiManager._signal;if(!(s instanceof AbortSignal)||s.aborted)return t;t.addEventListener("contextmenu",gi,{signal:s}),e&&(t.addEventListener("focusin",n=>{r(this,Lt)._focusEventsAllowed=!1,me(n)},{capture:!0,signal:s}),t.addEventListener("focusout",n=>{r(this,Lt)._focusEventsAllowed=!0,me(n)},{capture:!0,signal:s})),t.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),t===r(this,si)?this.edit():r(this,Lt).toggleComment(!0)};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",n=>{n.target===t&&n.key==="Enter"&&(p(this,qa,!0),i(n))},{signal:s}),t.addEventListener("pointerenter",()=>{r(this,Lt).toggleComment(!1,!0)},{signal:s}),t.addEventListener("pointerleave",()=>{r(this,Lt).toggleComment(!1,!1)},{signal:s}),t};function Iy(u){u.preventDefault()}const ky=1e-4;function Ug(u){return u.cancelable?(me(u),!0):(u.stopPropagation(),!1)}var oc,zn,Lu,Nu,Bu,Uu,Hu,Qa,Vn,Dr,Za,er,Fr,to,Lr,Wn,Yt,lw,rm,nm,am,Mf,cw,hw,om;class Zv{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:s=null,onPinchStart:i=null,onPinching:n=null,onPinchEnd:a=null,onPanning:o=null,signal:l}){y(this,Yt);y(this,oc);y(this,zn,!1);y(this,Lu,null);y(this,Nu);y(this,Bu);y(this,Uu);y(this,Hu);y(this,Qa);y(this,Vn,!1);y(this,Dr,null);y(this,Za);y(this,er,new Set);y(this,Fr,null);y(this,to);y(this,Lr,null);y(this,Wn,0);p(this,oc,t),p(this,Lu,s),p(this,Nu,e),p(this,Bu,i),p(this,Uu,n),p(this,Hu,a),p(this,Qa,o),p(this,to,new AbortController),p(this,Za,AbortSignal.any([l,r(this,to).signal])),t.addEventListener("touchstart",b(this,Yt,lw).bind(this),{passive:!1,signal:r(this,Za)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Ws.pixelRatio}get MIN_TOUCH_DISTANCE_TO_SCALE(){return 4/Ws.pixelRatio}destroy(){var t,e;b(this,Yt,om).call(this),r(this,er).clear(),(t=r(this,to))==null||t.abort(),p(this,to,null),(e=r(this,Dr))==null||e.abort(),p(this,Dr,null)}}oc=new WeakMap,zn=new WeakMap,Lu=new WeakMap,Nu=new WeakMap,Bu=new WeakMap,Uu=new WeakMap,Hu=new WeakMap,Qa=new WeakMap,Vn=new WeakMap,Dr=new WeakMap,Za=new WeakMap,er=new WeakMap,Fr=new WeakMap,to=new WeakMap,Lr=new WeakMap,Wn=new WeakMap,Yt=new WeakSet,lw=function(t){var s,i;if((s=r(this,Nu))!=null&&s.call(this))return;b(this,Yt,nm).call(this,t);const e=r(this,er);for(const{identifier:n}of t.changedTouches)e.add(n);if(e.size===1){b(this,Yt,rm).call(this);return}if(!r(this,Lr)){p(this,Lr,new AbortController);const n=AbortSignal.any([r(this,Za),r(this,Lr).signal]),a=r(this,oc),o={signal:n,capture:!1,passive:!1};a.addEventListener("touchmove",b(this,Yt,cw).bind(this),o);const l=b(this,Yt,hw).bind(this);a.addEventListener("touchend",l,o),a.addEventListener("touchcancel",l,o),o.capture=!0,a.addEventListener("pointerdown",me,o),a.addEventListener("pointermove",me,o),a.addEventListener("pointercancel",Iy,o),a.addEventListener("pointerup",Iy,o),(i=r(this,Bu))==null||i.call(this)}p(this,Vn,Ug(t)),b(this,Yt,Mf).call(this,t)},rm=function(){if(r(this,Dr))return;const t=p(this,Dr,new AbortController),e=AbortSignal.any([r(this,Za),t.signal]),s=r(this,oc),i={capture:!0,signal:e,passive:!1},n=a=>{var o;a.pointerType==="touch"&&((o=r(this,Dr))==null||o.abort(),p(this,Dr,null))};s.addEventListener("pointerdown",a=>{a.pointerType==="touch"&&(me(a),n(a))},i),s.addEventListener("pointerup",n,i),s.addEventListener("pointercancel",n,i)},nm=function(t){const e=r(this,er);if(e.size===0)return;const s=p(this,er,new Set);for(const{identifier:i}of t.touches)e.has(i)&&s.add(i)},am=function(t){const e=r(this,er),s=[];for(const i of t.touches)e.has(i.identifier)&&s.push(i);return s},Mf=function(t){var n;const e=b(this,Yt,am).call(this,t);if(e.length!==2||(n=r(this,Lu))!=null&&n.call(this)){p(this,Fr,null);return}const[s,i]=e;p(this,Fr,{touch0X:s.screenX,touch0Y:s.screenY,touch1X:i.screenX,touch1Y:i.screenY,panX:(s.clientX+i.clientX)/2,panY:(s.clientY+i.clientY)/2,screenPanX:(s.screenX+i.screenX)/2,screenPanY:(s.screenY+i.screenY)/2})},cw=function(t){var D,H,X,nt;if(!r(this,Fr))return;const e=b(this,Yt,am).call(this,t);if(e.length!==2)return;const s=r(this,Vn);if(p(this,Vn,Ug(t)),!r(this,Vn))return;if(!s){b(this,Yt,Mf).call(this,t);return}const[i,n]=e,{screenX:a,screenY:o}=i,{screenX:l,screenY:c}=n,h=r(this,Fr),{touch0X:d,touch0Y:f,touch1X:g,touch1Y:m,panX:v,panY:w}=h,A=g-d,_=m-f,E=l-a,S=c-o,x=(i.clientX+n.clientX)/2,T=(i.clientY+n.clientY)/2;h.panX=x,h.panY=T;const C=x-v,I=T-w,k=(a+l)/2,M=(o+c)/2,R=Math.hypot(k-h.screenPanX,M-h.screenPanY);h.screenPanX=k,h.screenPanY=M;const N=Math.hypot(E,S),F=Math.hypot(A,_),$=r(this,zn)?this.MIN_TOUCH_DISTANCE_TO_SCALE:this.MIN_TOUCH_DISTANCE_TO_PINCH+2*R;if(N<ky||F<ky||Math.abs(F-N)<=$){(C||I)&&((D=r(this,Qa))==null||D.call(this,C,I));return}h.touch0X=a,h.touch0Y=o,h.touch1X=l,h.touch1Y=c;const U=Math.sign(N-F);if(!r(this,zn)){p(this,zn,!0),p(this,Wn,U),(C||I)&&((H=r(this,Qa))==null||H.call(this,C,I));return}if(r(this,Wn)){const gt=r(this,Wn);if(p(this,Wn,0),U!==gt&&Math.abs(N-F)<=2*R){p(this,zn,!1),(C||I)&&((X=r(this,Qa))==null||X.call(this,C,I));return}}(nt=r(this,Uu))==null||nt.call(this,[v,w],F,N,C,I)},hw=function(t){if(b(this,Yt,nm).call(this,t),r(this,er).size>=2){b(this,Yt,Mf).call(this,t);return}const e=!!r(this,Fr);b(this,Yt,om).call(this),r(this,er).size===1&&b(this,Yt,rm).call(this),e&&Ug(t)},om=function(){var t;p(this,Fr,null),p(this,zn,!1),p(this,Wn,0),p(this,Vn,!1),r(this,Lr)&&(r(this,Lr).abort(),p(this,Lr,null),(t=r(this,Hu))==null||t.call(this))};var eo,_i,zt,Et,Nr,lc,Xn,ju,Fe,so,Br,ri,Yn,$u,io,Is,Gu,ro,Ur,sr,cc,hc,ni,Kn,zu,Pp,Q,lm,Vu,cm,Of,uw,dw,hm,Rf,um,fw,pw,gw,dm,mw,fm,pm,vw,yw,bw,gm,Hh;const et=class et{constructor(t){y(this,Q);y(this,eo,null);y(this,_i,null);y(this,zt,null);y(this,Et,null);y(this,Nr,null);y(this,lc,!1);y(this,Xn,null);y(this,ju,"");y(this,Fe,null);y(this,so,null);y(this,Br,null);y(this,ri,null);y(this,Yn,null);y(this,$u,"");y(this,io,!1);y(this,Is,null);y(this,Gu,!1);y(this,ro,!1);y(this,Ur,!1);y(this,sr,null);y(this,cc,0);y(this,hc,0);y(this,ni,null);y(this,Kn,null);O(this,"isSelected",!1);O(this,"_isCopy",!1);O(this,"_editToolbar",null);O(this,"_initialOptions",Object.create(null));O(this,"_initialData",null);O(this,"_isVisible",!0);O(this,"_uiManager",null);O(this,"_focusEventsAllowed",!0);y(this,zu,!1);y(this,Pp,et._zIndex++);this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null,this.creationDate=t.creationDate||new Date,this.modificationDate=t.modificationDate||null,this.canAddComment=!0;const{rotation:e,rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[n,a];const[o,l]=this.parentDimensions;this.x=t.x/o,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=et.prototype._resizeWithKeyboard,e=Ia.TRANSLATE_SMALL,s=Ia.TRANSLATE_BIG;return V(this,"_resizerKeyboardManager",new bl([[["ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-s,0]}],[["ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[s,0]}],[["ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-s]}],[["ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,s]}],[["Escape"],et.prototype._stopResizingWithKeyboard]]))}updatePageIndex(t){this.pageIndex=t}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return V(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new SS({id:t._uiManager.getId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(et._l10n??(et._l10n=t),et._l10nAlert??(et._l10nAlert=Object.freeze({highlight:"pdfjs-editor-highlight-added-alert",freetext:"pdfjs-editor-freetext-added-alert",ink:"pdfjs-editor-ink-added-alert",stamp:"pdfjs-editor-stamp-added-alert",signature:"pdfjs-editor-signature-added-alert"})),et._l10nResizer??(et._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),et._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);et._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){vt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return r(this,zu)}set _isDraggable(t){var e;p(this,zu,t),(e=this.div)==null||e.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=r(this,Pp)}setParent(t){var e;t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(b(this,Q,Hh).call(this),(e=r(this,ri))==null||e.remove(),p(this,ri,null)),this.parent=t}focusin(t){this._focusEventsAllowed&&(r(this,io)?p(this,io,!1):this.parent.setSelected(this))}focusout(t){var s;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const e=t.relatedTarget;e!=null&&e.closest(`#${this.id}`)||(t.preventDefault(),(s=this.parent)!=null&&s.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,s,i){const[n,a]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(t+s)/n,this.y=(e+i)/a,this.fixAndSetPosition()}_moveAfterPaste(t,e){if(this.isClone){delete this.isClone;return}const[s,i]=this.parentDimensions;this.setAt(t*s,e*i,this.width*s,this.height*i),this._onTranslated()}translate(t,e){b(this,Q,lm).call(this,this.parentDimensions,t,e)}translateInPage(t,e){r(this,Is)||p(this,Is,[this.x,this.y,this.width,this.height]),b(this,Q,lm).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){r(this,Is)||p(this,Is,[this.x,this.y,this.width,this.height]);const{div:s,parentDimensions:[i,n]}=this;if(this.x+=t/i,this.y+=e/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:d,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,d,f)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this;const[l,c]=this.getBaseTranslation();a+=l,o+=c;const{style:h}=s;h.left=`${(100*a).toFixed(2)}%`,h.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o)}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!r(this,Is)&&(r(this,Is)[0]!==this.x||r(this,Is)[1]!==this.y)}get _hasBeenResized(){return!!r(this,Is)&&(r(this,Is)[2]!==this.width||r(this,Is)[3]!==this.height)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:s}=et,i=s/t,n=s/e;switch(this.rotation){case 90:return[-i,n];case 180:return[i,n];case 270:return[i,-n];default:return[-i,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const{div:{style:e},pageDimensions:[s,i]}=this;let{x:n,y:a,width:o,height:l}=this;if(o*=s,l*=i,n*=s,a*=i,this._mustFixPosition)switch(t){case 0:n=Nt(n,0,s-o),a=Nt(a,0,i-l);break;case 90:n=Nt(n,0,s-l),a=Nt(a,o,i);break;case 180:n=Nt(n,o,s),a=Nt(a,l,i);break;case 270:n=Nt(n,l,s),a=Nt(a,0,i-o);break}this.x=n/=s,this.y=a/=i;const[c,h]=this.getBaseTranslation();n+=c,a+=h,e.left=`${(100*n).toFixed(2)}%`,e.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var s;return b(s=et,Vu,cm).call(s,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var s;return b(s=et,Vu,cm).call(s,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,s]}=this;return[e*t,s*t]}setDims(){const{div:{style:t},width:e,height:s}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*s).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(t*1e4)/1e4}_onResizing(){}altTextFinish(){var t;(t=r(this,zt))==null||t.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||r(this,ro))return this._editToolbar;this._editToolbar=new Kg(this),this.div.append(this._editToolbar.render());const{toolbarButtons:t}=this;if(t)for(const[e,s]of t)await this._editToolbar.addButton(e,s);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){var t;(t=this._editToolbar)==null||t.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){var t;(t=this._editToolbar)==null||t.removeButton("comment")}removeEditToolbar(){var t,e;(t=this._editToolbar)==null||t.remove(),this._editToolbar=null,(e=r(this,zt))==null||e.destroy()}addContainer(t){var s;const e=(s=this._editToolbar)==null?void 0:s.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return r(this,zt)||(mp.initialize(et._l10n),p(this,zt,new mp(this)),r(this,eo)&&(r(this,zt).data=r(this,eo),p(this,eo,null))),r(this,zt)}get altTextData(){var t;return(t=r(this,zt))==null?void 0:t.data}set altTextData(t){r(this,zt)&&(r(this,zt).data=t)}get guessedAltText(){var t;return(t=r(this,zt))==null?void 0:t.guessedText}async setGuessedAltText(t){var e;await((e=r(this,zt))==null?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return(e=r(this,zt))==null?void 0:e.serialize(t)}hasAltText(){return!!r(this,zt)&&!r(this,zt).isEmpty()}hasAltTextData(){var t;return((t=r(this,zt))==null?void 0:t.hasData())??!1}focusCommentButton(){var t;(t=r(this,Et))==null||t.focusButton()}addCommentButton(){return this.canAddComment?r(this,Et)||p(this,Et,new yf(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(r(this,Nr)){this._uiManager.isEditingMode()&&r(this,Nr).classList.remove("hidden");return}this.hasComment&&(p(this,Nr,r(this,Et).renderForStandalone()),this.div.append(r(this,Nr)))}}removeStandaloneCommentButton(){r(this,Et).removeStandaloneCommentButton(),p(this,Nr,null)}hideStandaloneCommentButton(){var t;(t=r(this,Nr))==null||t.classList.add("hidden")}get comment(){if(!r(this,Et))return null;const{data:{richText:t,text:e,date:s,deleted:i}}=r(this,Et);return{text:e,richText:t,date:s,deleted:i,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){r(this,Et)||p(this,Et,new yf(this)),typeof t=="object"&&t!==null?r(this,Et).restoreData(t):r(this,Et).data=t,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:t,popupRef:e,richText:s}){if(!e||(r(this,Et)||p(this,Et,new yf(this)),r(this,Et).setInitialText(t,s),!this.annotationElementId))return;const i=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);i&&this.updateFromAnnotationLayer(i)}get hasEditedComment(){var t;return(t=r(this,Et))==null?void 0:t.hasBeenEdited()}get hasDeletedComment(){var t;return(t=r(this,Et))==null?void 0:t.isDeleted()}get hasComment(){return!!r(this,Et)&&!r(this,Et).isEmpty()&&!r(this,Et).isDeleted()}async editComment(t){r(this,Et)||p(this,Et,new yf(this)),r(this,Et).edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){r(this,Et).setSelectedButton(t)}addComment(t){if(this.hasEditedComment){const[,,,i]=t.rect,[n]=this.pageDimensions,[a]=this.pageTranslation,o=a+n+1,l=i-100,c=o+180;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[o,l,c,i]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){r(this,Et).data=e?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var a;const t=this.div=document.createElement("div");t.setAttribute("data-editor-rotation",(360-this.rotation)%360),t.className=this.name,t.setAttribute("id",this.id),t.tabIndex=r(this,lc)?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),b(this,Q,fm).call(this);const[e,s]=this.parentDimensions;this.parentRotation%180!==0&&(t.style.maxWidth=`${(100*s/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/s).toFixed(2)}%`);const[i,n]=this.getInitialTranslation();return this.translate(i,n),Xb(this,t,["keydown","pointerdown","dblclick"]),b(this,Q,pm).call(this),this.addStandaloneCommentButton(),(a=this._uiManager._editorUndoBar)==null||a.hide(),t}pointerdown(t){const{isMac:e}=_t.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(p(this,io,!0),this._isDraggable){b(this,Q,mw).call(this,t);return}b(this,Q,dm).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){r(this,sr)&&clearTimeout(r(this,sr)),p(this,sr,setTimeout(()=>{var t;p(this,sr,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,s){t.changeParent(this),this.x=e,this.y=s,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,s=this.rotation){const i=this.parentScale,[n,a]=this.pageDimensions,[o,l]=this.pageTranslation,c=t/i,h=e/i,d=this.x*n,f=this.y*a,g=this.width*n,m=this.height*a;switch(s){case 0:return[d+c+o,a-f-h-m+l,d+c+g+o,a-f-h+l];case 90:return[d+h+o,a-f+c+l,d+h+m+o,a-f+c+g+l];case 180:return[d-c-g+o,a-f+h+l,d-c+o,a-f+h+m+l];case 270:return[d-h-m+o,a-f-c-g+l,d-h+o,a-f-c+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[s,i,n,a]=t,o=n-s,l=a-i;switch(this.rotation){case 0:return[s,e-a,o,l];case 90:return[s,e-i,l,o];case 180:return[n,e-i,o,l];case 270:return[n,e-a,l,o];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&et._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var t;(t=r(this,Et))==null||t.onUpdatedColor()}getData(){const{comment:{text:t,color:e,date:s,opacity:i,deleted:n,richText:a},uid:o,pageIndex:l,creationDate:c,modificationDate:h}=this;return{id:o,pageIndex:l,rect:this.getPDFRect(),richText:a,contentsObj:{str:t},creationDate:c,modificationDate:s||h,popupRef:!n,color:e,opacity:i}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),p(this,ro,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),p(this,ro,!1),!0):!1}isInEditMode(){return r(this,ro)}shouldGetKeyboardEvents(){return r(this,Ur)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:t,left:e,bottom:s,right:i}=this.getClientDimensions(),{innerHeight:n,innerWidth:a}=window;return e<a&&i>0&&t<n&&s>0}rebuild(){b(this,Q,fm).call(this),b(this,Q,pm).call(this)}rotate(t){}resize(){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((t=this._initialData)==null?void 0:t.popupRef)||""}}serialize(t=!1,e=null){var s;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:((s=this._initialData)==null?void 0:s.popupRef)||""}}static async deserialize(t,e,s){const i=new this.prototype.constructor({parent:e,id:s.getId(),uiManager:s,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});i.rotation=t.rotation,p(i,eo,t.accessibilityData),i._isCopy=t.isCopy||!1;const[n,a]=i.pageDimensions,[o,l,c,h]=i.getRectInCurrentCoords(t.rect,a);return i.x=o/n,i.y=l/a,i.width=c/n,i.height=h/a,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var t,e,s;if((t=r(this,Yn))==null||t.abort(),p(this,Yn,null),this.isEmpty()||this.commit(),(e=r(this,Kn))==null||e.destroy(),p(this,Kn,null),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),r(this,sr)&&(clearTimeout(r(this,sr)),p(this,sr,null)),b(this,Q,Hh).call(this),this.removeEditToolbar(),r(this,ni)){for(const i of r(this,ni).values())clearTimeout(i);p(this,ni,null)}this.parent=null,(s=r(this,ri))==null||s.remove(),p(this,ri,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,Q,uw).call(this),r(this,Fe).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[t,e]}=this,[s,i,n,a]=this.getPDFRect();return[et._round(s+(n-s)*t),et._round(i+(a-i)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return r(this,Et).commentPopupPositionInLayer}set commentPopupPosition(t){r(this,Et).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return r(this,Et).hasDefaultPopupPosition()}get commentButtonWidth(){return r(this,Et).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){var e;(e=r(this,Et))==null||e.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),p(this,Br,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=r(this,Fe).children;if(!r(this,_i)){p(this,_i,Array.from(e));const a=b(this,Q,vw).bind(this),o=b(this,Q,yw).bind(this),l=this._uiManager._signal;for(const c of r(this,_i)){const h=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",a,{signal:l}),c.addEventListener("blur",o,{signal:l}),c.addEventListener("focus",b(this,Q,bw).bind(this,h),{signal:l}),c.setAttribute("data-l10n-id",et._l10nResizer[h])}}const s=r(this,_i)[0];let i=0;for(const a of e){if(a===s)break;i++}const n=(360-this.rotation+this.parentRotation)%360/90*(r(this,_i).length/4);if(n!==i){if(n<i)for(let o=0;o<i-n;o++)r(this,Fe).append(r(this,Fe).firstElementChild);else if(n>i)for(let o=0;o<n-i;o++)r(this,Fe).firstElementChild.before(r(this,Fe).lastElementChild);let a=0;for(const o of e){const c=r(this,_i)[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",et._l10nResizer[c])}}b(this,Q,gm).call(this,0),p(this,Ur,!0),r(this,Fe).firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){r(this,Ur)&&b(this,Q,um).call(this,r(this,$u),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){b(this,Q,Hh).call(this),this.div.focus()}select(){var t,e,s;if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),(t=this.div)==null||t.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var i,n;(i=this.div)!=null&&i.classList.contains("selectedEditor")&&((n=this._editToolbar)==null||n.show())});return}(e=this._editToolbar)==null||e.show(),(s=r(this,zt))==null||s.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var t;return(t=this.div)==null?void 0:t.focus({preventScroll:!0})},0)}unselect(){var t,e,s,i,n;this.isSelected&&(this.isSelected=!1,(t=r(this,Fe))==null||t.classList.add("hidden"),(e=this.div)==null||e.classList.remove("selectedEditor"),(s=this.div)!=null&&s.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(i=this._editToolbar)==null||i.hide(),(n=r(this,zt))==null||n.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){t.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return r(this,Gu)}set isEditing(t){p(this,Gu,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){r(this,ni)||p(this,ni,new Map);const{action:s}=t;let i=r(this,ni).get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),r(this,ni).delete(s),r(this,ni).size===0&&p(this,ni,null)},et._telemetryTimeout),r(this,ni).set(s,i);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),p(this,lc,!1)}disable(){this.div&&(this.div.tabIndex=-1),p(this,lc,!0)}updateFakeAnnotationElement(t){if(!r(this,ri)&&!this.deleted){p(this,ri,t.addFakeAnnotation(this));return}if(this.deleted){r(this,ri).remove(),p(this,ri,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&r(this,ri).updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){const s=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),s.before(e)}return e}resetAnnotationElement(t){const{firstElementChild:e}=t.container;(e==null?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};eo=new WeakMap,_i=new WeakMap,zt=new WeakMap,Et=new WeakMap,Nr=new WeakMap,lc=new WeakMap,Xn=new WeakMap,ju=new WeakMap,Fe=new WeakMap,so=new WeakMap,Br=new WeakMap,ri=new WeakMap,Yn=new WeakMap,$u=new WeakMap,io=new WeakMap,Is=new WeakMap,Gu=new WeakMap,ro=new WeakMap,Ur=new WeakMap,sr=new WeakMap,cc=new WeakMap,hc=new WeakMap,ni=new WeakMap,Kn=new WeakMap,zu=new WeakMap,Pp=new WeakMap,Q=new WeakSet,lm=function([t,e],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/t,this.y+=i/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},Vu=new WeakSet,cm=function(t,e,s){switch(s){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},Of=function(t){switch(t){case 90:{const[e,s]=this.pageDimensions;return[0,-e/s,s/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,s]=this.pageDimensions;return[0,e/s,-s/e,0]}default:return[1,0,0,1]}},uw=function(){if(r(this,Fe))return;p(this,Fe,document.createElement("div")),r(this,Fe).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const s of t){const i=document.createElement("div");r(this,Fe).append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",b(this,Q,dw).bind(this,s),{signal:e}),i.addEventListener("contextmenu",gi,{signal:e}),i.tabIndex=-1}this.div.prepend(r(this,Fe))},dw=function(t,e){var h;e.preventDefault();const{isMac:s}=_t.platform;if(e.button!==0||e.ctrlKey&&s)return;(h=r(this,zt))==null||h.toggle(!1);const i=this._isDraggable;this._isDraggable=!1,p(this,so,[e.screenX,e.screenY]);const n=new AbortController,a=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",b(this,Q,um).bind(this,t),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",me,{passive:!1,signal:a}),window.addEventListener("contextmenu",gi,{signal:a}),p(this,Br,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const c=()=>{var d;n.abort(),this.parent.togglePointerEvents(!0),(d=r(this,zt))==null||d.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=o,this.div.style.cursor=l,b(this,Q,Rf).call(this)};window.addEventListener("pointerup",c,{signal:a}),window.addEventListener("blur",c,{signal:a})},hm=function(t,e,s,i){this.width=s,this.height=i,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()},Rf=function(){if(!r(this,Br))return;const{savedX:t,savedY:e,savedWidth:s,savedHeight:i}=r(this,Br);p(this,Br,null);const n=this.x,a=this.y,o=this.width,l=this.height;n===t&&a===e&&o===s&&l===i||this.addCommands({cmd:b(this,Q,hm).bind(this,n,a,o,l),undo:b(this,Q,hm).bind(this,t,e,s,i),mustExec:!0})},um=function(t,e){const[s,i]=this.parentDimensions,n=this.x,a=this.y,o=this.width,l=this.height,c=et.MIN_SIZE/s,h=et.MIN_SIZE/i,d=b(this,Q,Of).call(this,this.rotation),f=(D,H)=>[d[0]*D+d[2]*H,d[1]*D+d[3]*H],g=b(this,Q,Of).call(this,360-this.rotation),m=(D,H)=>[g[0]*D+g[2]*H,g[1]*D+g[3]*H];let v,w,A=!1,_=!1;switch(t){case"topLeft":A=!0,v=(D,H)=>[0,0],w=(D,H)=>[D,H];break;case"topMiddle":v=(D,H)=>[D/2,0],w=(D,H)=>[D/2,H];break;case"topRight":A=!0,v=(D,H)=>[D,0],w=(D,H)=>[0,H];break;case"middleRight":_=!0,v=(D,H)=>[D,H/2],w=(D,H)=>[0,H/2];break;case"bottomRight":A=!0,v=(D,H)=>[D,H],w=(D,H)=>[0,0];break;case"bottomMiddle":v=(D,H)=>[D/2,H],w=(D,H)=>[D/2,0];break;case"bottomLeft":A=!0,v=(D,H)=>[0,H],w=(D,H)=>[D,0];break;case"middleLeft":_=!0,v=(D,H)=>[0,H/2],w=(D,H)=>[D,H/2];break}const E=v(o,l),S=w(o,l);let x=f(...S);const T=et._round(n+x[0]),C=et._round(a+x[1]);let I=1,k=1,M,R;if(e.fromKeyboard)({deltaX:M,deltaY:R}=e);else{const{screenX:D,screenY:H}=e,[X,nt]=r(this,so);[M,R]=this.screenToPageTranslation(D-X,H-nt),r(this,so)[0]=D,r(this,so)[1]=H}if([M,R]=m(M/s,R/i),A){const D=Math.hypot(o,l);I=k=Math.max(Math.min(Math.hypot(S[0]-E[0]-M,S[1]-E[1]-R)/D,1/o,1/l),c/o,h/l)}else _?I=Nt(Math.abs(S[0]-E[0]-M),c,1)/o:k=Nt(Math.abs(S[1]-E[1]-R),h,1)/l;const N=et._round(o*I),F=et._round(l*k);x=f(...w(N,F));const $=T-x[0],U=C-x[1];r(this,Is)||p(this,Is,[this.x,this.y,this.width,this.height]),this.width=N,this.height=F,this.x=$,this.y=U,this.setDims(),this.fixAndSetPosition(),this._onResizing()},fw=function(){var t;p(this,Br,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(t=r(this,zt))==null||t.toggle(!1),this.parent.togglePointerEvents(!1)},pw=function(t,e,s){let n=.7*(s/e)+1-.7;if(n===1)return;const a=b(this,Q,Of).call(this,this.rotation),o=(T,C)=>[a[0]*T+a[2]*C,a[1]*T+a[3]*C],[l,c]=this.parentDimensions,h=this.x,d=this.y,f=this.width,g=this.height,m=et.MIN_SIZE/l,v=et.MIN_SIZE/c;n=Math.max(Math.min(n,1/f,1/g),m/f,v/g);const w=et._round(f*n),A=et._round(g*n);if(w===f&&A===g)return;r(this,Is)||p(this,Is,[h,d,f,g]);const _=o(f/2,g/2),E=et._round(h+_[0]),S=et._round(d+_[1]),x=o(w/2,A/2);this.x=E-x[0],this.y=S-x[1],this.width=w,this.height=A,this.setDims(),this.fixAndSetPosition(),this._onResizing()},gw=function(){var t;(t=r(this,zt))==null||t.toggle(!0),this.parent.togglePointerEvents(!0),b(this,Q,Rf).call(this)},dm=function(t){const{isMac:e}=_t.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},mw=function(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();let s=!1;const i=new AbortController,n=this._uiManager.combinedSignal(i),a={capture:!0,passive:!1,signal:n},o=c=>{i.abort(),p(this,Xn,null),p(this,io,!1),this._uiManager.endDragSession()||b(this,Q,dm).call(this,c),s&&this._onStopDragging()};e&&(p(this,cc,t.clientX),p(this,hc,t.clientY),p(this,Xn,t.pointerId),p(this,ju,t.pointerType),window.addEventListener("pointermove",c=>{s||(s=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:h,clientY:d,pointerId:f}=c;if(f!==r(this,Xn)){me(c);return}const[g,m]=this.screenToPageTranslation(h-r(this,cc),d-r(this,hc));p(this,cc,h),p(this,hc,d),this._uiManager.dragSelectedEditors(g,m),this.div.scrollIntoView({block:"nearest"})},a),window.addEventListener("touchmove",me,a),window.addEventListener("pointerdown",c=>{c.pointerType===r(this,ju)&&(r(this,Kn)||c.isPrimary)&&o(c),me(c)},a));const l=c=>{if(!r(this,Xn)||r(this,Xn)===c.pointerId){o(c);return}me(c)};window.addEventListener("pointerup",l,{signal:n}),window.addEventListener("blur",l,{signal:n})},fm=function(){if(r(this,Yn)||!this.div)return;p(this,Yn,new AbortController);const t=this._uiManager.combinedSignal(r(this,Yn));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},pm=function(){r(this,Kn)||!this.div||!this.isResizable||!this._uiManager._supportsPinchToZoom||p(this,Kn,new Zv({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:b(this,Q,fw).bind(this),onPinching:b(this,Q,pw).bind(this),onPinchEnd:b(this,Q,gw).bind(this),signal:this._uiManager._signal}))},vw=function(t){et._resizerKeyboardManager.exec(this,t)},yw=function(t){var e;r(this,Ur)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==r(this,Fe)&&b(this,Q,Hh).call(this)},bw=function(t){p(this,$u,r(this,Ur)?t:"")},gm=function(t){if(r(this,_i))for(const e of r(this,_i))e.tabIndex=t},Hh=function(){p(this,Ur,!1),b(this,Q,gm).call(this,-1),b(this,Q,Rf).call(this)},y(et,Vu),O(et,"_l10n",null),O(et,"_l10nAlert",null),O(et,"_l10nResizer",null),O(et,"_borderLineWidth",-1),O(et,"_colorManager",new Qg),O(et,"_zIndex",1),O(et,"_telemetryTimeout",1e3);let Mt=et;class SS extends Mt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const My=3285377520,Ks=4294901760,$i=65535;class mm{constructor(t){this.h1=t?t&4294967295:My,this.h2=t?t&4294967295:My}update(t){let e,s;if(typeof t=="string"){e=new Uint8Array(t.length*2),s=0;for(let v=0,w=t.length;v<w;v++){const A=t.charCodeAt(v);A<=255?e[s++]=A:(e[s++]=A>>>8,e[s++]=A&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),s=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const i=s>>2,n=s-i*4,a=new Uint32Array(e.buffer,0,i);let o=0,l=0,c=this.h1,h=this.h2;const d=3432918353,f=461845907,g=d&$i,m=f&$i;for(let v=0;v<i;v++)v&1?(o=a[v],o=o*d&Ks|o*g&$i,o=o<<15|o>>>17,o=o*f&Ks|o*m&$i,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(l=a[v],l=l*d&Ks|l*g&$i,l=l<<15|l>>>17,l=l*f&Ks|l*m&$i,h^=l,h=h<<13|h>>>19,h=h*5+3864292196);switch(o=0,n){case 3:o^=e[i*4+2]<<16;case 2:o^=e[i*4+1]<<8;case 1:o^=e[i*4],o=o*d&Ks|o*g&$i,o=o<<15|o>>>17,o=o*f&Ks|o*m&$i,i&1?c^=o:h^=o}this.h1=c,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&Ks|t*36045&$i,e=e*4283543511&Ks|((e<<16|t>>>16)*2950163797&Ks)>>>16,t^=e>>>1,t=t*444984403&Ks|t*60499&$i,e=e*3301882366&Ks|((e<<16|t>>>16)*3120437893&Ks)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const fu=Object.freeze({map:null,hash:"",transfer:void 0});var no,ao,Hr,Le,Ip,ww;class ty{constructor(){y(this,Ip);y(this,no,!1);y(this,ao,null);y(this,Hr,null);y(this,Le,new Map);O(this,"onSetModified",null);O(this,"onResetModified",null);O(this,"onAnnotationEditor",null)}getValue(t,e){const s=r(this,Le).get(t);return s===void 0?e:Object.assign(e,s)}getRawValue(t){return r(this,Le).get(t)}remove(t){var s;const e=r(this,Le).get(t);e!==void 0&&(e instanceof Mt&&r(this,Hr).delete(e.annotationElementId),r(this,Le).delete(t),r(this,Le).size===0&&this.resetModified(),!r(this,Le).values().some(i=>i instanceof Mt)&&((s=this.onAnnotationEditor)==null||s.call(this,null)))}setValue(t,e){var n;const s=r(this,Le).get(t);let i=!1;if(s!==void 0)for(const[a,o]of Object.entries(e))s[a]!==o&&(i=!0,s[a]=o);else i=!0,r(this,Le).set(t,e);i&&b(this,Ip,ww).call(this),e instanceof Mt&&((r(this,Hr)||p(this,Hr,new Map)).set(e.annotationElementId,e),(n=this.onAnnotationEditor)==null||n.call(this,e.constructor._type))}has(t){return r(this,Le).has(t)}get size(){return r(this,Le).size}resetModified(){var t;r(this,no)&&(p(this,no,!1),(t=this.onResetModified)==null||t.call(this))}get print(){return new Aw(this)}get serializable(){if(r(this,Le).size===0)return fu;const t=new Map,e=new mm,s=[],i=Object.create(null);let n=!1;for(const[a,o]of r(this,Le)){const l=o instanceof Mt?o.serialize(!1,i):o;o.page&&(o.pageIndex=o.page._pageIndex,delete o.page),l&&(t.set(a,l),e.update(`${a}:${JSON.stringify(l)}`),n||(n=!!l.bitmap))}if(n)for(const a of t.values())a.bitmap&&s.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:s}:fu}get editorStats(){let t=null;const e=new Map;let s=0,i=0;for(const n of r(this,Le).values()){if(!(n instanceof Mt)){n.popup&&(n.popup.deleted?i+=1:s+=1);continue}n.isCommentDeleted?i+=1:n.hasEditedComment&&(s+=1);const a=n.telemetryFinalData;if(!a)continue;const{type:o}=a;e.getOrInsertComputed(o,()=>Object.getPrototypeOf(n).constructor),t||(t=Object.create(null));const l=t[o]||(t[o]=new Map);for(const[c,h]of Object.entries(a)){if(c==="type")continue;const d=l.getOrInsertComputed(c,bg);d.set(h,(d.get(h)??0)+1)}}if((i>0||s>0)&&(t||(t=Object.create(null)),t.comments={deleted:i,edited:s}),!t)return null;for(const[n,a]of e)t[n]=a.computeTelemetryFinalData(t[n]);return t}resetModifiedIds(){p(this,ao,null)}updateEditor(t,e){var i;const s=(i=r(this,Hr))==null?void 0:i.get(t);return s?(s.updateFromAnnotationLayer(e),!0):!1}getEditor(t){var e;return((e=r(this,Hr))==null?void 0:e.get(t))||null}get modifiedIds(){if(r(this,ao))return r(this,ao);const t=[];if(r(this,Hr))for(const s of r(this,Hr).values())s.serialize()&&t.push(s.annotationElementId);let e="";if(t.length){const s=new mm;s.update(t.join(",")),e=s.hexdigest()}return p(this,ao,{ids:new Set(t),hash:e})}[Symbol.iterator](){return r(this,Le).entries()}}no=new WeakMap,ao=new WeakMap,Hr=new WeakMap,Le=new WeakMap,Ip=new WeakSet,ww=function(){var t;r(this,no)||(p(this,no,!0),(t=this.onSetModified)==null||t.call(this))};var Wu;class Aw extends ty{constructor(e){super();y(this,Wu,fu);const{serializable:s}=e;if(s===fu)return;const{map:i,hash:n,transfer:a}=s,o=structuredClone(i,a?{transfer:a}:null);p(this,Wu,{map:o,hash:n,transfer:[]})}get print(){vt("Should not call PrintAnnotationStorage.print")}get serializable(){return r(this,Wu)}get modifiedIds(){return V(this,"modifiedIds",{ids:new Set,hash:""})}}Wu=new WeakMap;D0();const Rl="__forcedDependency",{floor:Oy,ceil:Ry}=Math;function Dy(u,t,e,s,i,n){u[t*4+0]=Math.min(u[t*4+0],e),u[t*4+1]=Math.min(u[t*4+1],s),u[t*4+2]=Math.max(u[t*4+2],i),u[t*4+3]=Math.max(u[t*4+3],n)}function ES(u,t,e,s,i){let n;u?(u<0&&(n=i[0],i[0]=i[2],i[2]=n),i[0]*=u,i[2]*=u,t<0&&(n=i[1],i[1]=i[3],i[3]=n),i[1]*=t,i[3]*=t):i.fill(0),i[0]+=e,i[1]+=s,i[2]+=e,i[3]+=s}const vm=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];var uc,qn;class xS{constructor(t,e){y(this,uc);y(this,qn);p(this,uc,t),p(this,qn,e)}get length(){return r(this,uc).length}isEmpty(t){return r(this,uc)[t]===vm}minX(t){return r(this,qn)[t*4+0]/256}minY(t){return r(this,qn)[t*4+1]/256}maxX(t){return(r(this,qn)[t*4+2]+1)/256}maxY(t){return(r(this,qn)[t*4+3]+1)/256}}uc=new WeakMap,qn=new WeakMap;const Fy=(u,t)=>u==null?void 0:u.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1}));var jr,At,jt,oo,lo,co,Xe,Xu,ym;class TS{constructor(t,e){y(this,Xu);y(this,jr,[[1,0,0,1,0,0]]);y(this,At,[-1/0,-1/0,1/0,1/0]);y(this,jt,new Float64Array(wr));O(this,"_pendingBBoxIdx",-1);y(this,oo);y(this,lo);y(this,co);y(this,Xe);O(this,"_savesStack",[]);O(this,"_markedContentStack",[]);p(this,oo,t.width),p(this,lo,t.height),b(this,Xu,ym).call(this,e)}growOperationsCount(t){t>=r(this,Xe).length&&b(this,Xu,ym).call(this,t,r(this,Xe))}get clipBox(){return r(this,At)}save(t){return p(this,At,{__proto__:r(this,At)}),this._savesStack.push(t),this}restore(t,e){const s=Object.getPrototypeOf(r(this,At));if(s===null)return this;p(this,At,s);const i=this._savesStack.pop();return i!==void 0&&(e==null||e(i,t),r(this,Xe)[t]=r(this,Xe)[i]),this}recordOpenMarker(t){return this._savesStack.push(t),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(t,e){const s=this._savesStack.pop();return s!==void 0&&(e==null||e(s,t),r(this,Xe)[t]=r(this,Xe)[s]),this}beginMarkedContent(t){return this._markedContentStack.push(t),this}endMarkedContent(t,e){const s=this._markedContentStack.pop();return s!==void 0&&(e==null||e(s,t),r(this,Xe)[t]=r(this,Xe)[s]),this}pushBaseTransform(t){return r(this,jr).push(j.multiplyByDOMMatrix(r(this,jr).at(-1),t.getTransform())),this}popBaseTransform(){return r(this,jr).length>1&&r(this,jr).pop(),this}resetBBox(t){return this._pendingBBoxIdx!==t&&(this._pendingBBoxIdx=t,r(this,jt).set(wr,0)),this}recordClipBox(t,e,s,i,n,a){const o=j.multiplyByDOMMatrix(r(this,jr).at(-1),e.getTransform()),l=wr.slice();j.axialAlignedBoundingBox([s,n,i,a],o,l);const c=j.intersect(r(this,At),l);return c?(r(this,At)[0]=c[0],r(this,At)[1]=c[1],r(this,At)[2]=c[2],r(this,At)[3]=c[3]):(r(this,At)[0]=r(this,At)[1]=1/0,r(this,At)[2]=r(this,At)[3]=-1/0),this}recordBBox(t,e,s,i,n,a){const o=r(this,At);if(o[0]===1/0)return this;const l=j.multiplyByDOMMatrix(r(this,jr).at(-1),e.getTransform());if(o[0]===-1/0)return j.axialAlignedBoundingBox([s,n,i,a],l,r(this,jt)),this;const c=wr.slice();return j.axialAlignedBoundingBox([s,n,i,a],l,c),r(this,jt)[0]=Nt(c[0],o[0],r(this,jt)[0]),r(this,jt)[1]=Nt(c[1],o[1],r(this,jt)[1]),r(this,jt)[2]=Nt(c[2],r(this,jt)[2],o[2]),r(this,jt)[3]=Nt(c[3],r(this,jt)[3],o[3]),this}recordFullPageBBox(t){return r(this,jt)[0]=Math.max(0,r(this,At)[0]),r(this,jt)[1]=Math.max(0,r(this,At)[1]),r(this,jt)[2]=Math.min(r(this,oo),r(this,At)[2]),r(this,jt)[3]=Math.min(r(this,lo),r(this,At)[3]),this}recordOperation(t,e=!1,s){if(this._pendingBBoxIdx!==t)return this;const i=Oy(r(this,jt)[0]*256/r(this,oo)),n=Oy(r(this,jt)[1]*256/r(this,lo)),a=Ry(r(this,jt)[2]*256/r(this,oo)),o=Ry(r(this,jt)[3]*256/r(this,lo));if(Dy(r(this,co),t,i,n,a,o),s)for(const l of s)for(const c of l)c!==t&&Dy(r(this,co),c,i,n,a,o);return e||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(t){return this._pendingBBoxIdx===t&&(this._pendingBBoxIdx=-1,r(this,At)[0]=Math.max(r(this,At)[0],r(this,jt)[0]),r(this,At)[1]=Math.max(r(this,At)[1],r(this,jt)[1]),r(this,At)[2]=Math.min(r(this,At)[2],r(this,jt)[2]),r(this,At)[3]=Math.min(r(this,At)[3],r(this,jt)[3])),this}take(){return new xS(r(this,Xe),r(this,co))}takeDebugMetadata(){throw new Error("Unreachable")}recordSimpleData(t,e){return this}recordIncrementalData(t,e){return this}resetIncrementalData(t,e){return this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,s){return this}recordFutureForcedDependency(t,e){return this}inheritSimpleDataAsFutureForcedDependencies(t){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(t,e,s,i=1,n=0,a=0,o){return this}getSimpleIndex(t){}recordDependencies(t,e){return this}recordNamedDependency(t,e){return this}recordShowTextOperation(t,e=!1){return this}}jr=new WeakMap,At=new WeakMap,jt=new WeakMap,oo=new WeakMap,lo=new WeakMap,co=new WeakMap,Xe=new WeakMap,Xu=new WeakSet,ym=function(t,e){const s=new ArrayBuffer(t*4);p(this,co,new Uint8ClampedArray(s)),p(this,Xe,new Uint32Array(s)),e&&e.length>0?(r(this,Xe).set(e),r(this,Xe).fill(vm,e.length)):r(this,Xe).fill(vm)};var bs,ws,ho,Si,dc,Jn,Qn,Pt;class CS{constructor(t,e=!1){y(this,bs,{__proto__:null});y(this,ws,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Rl]:[]});y(this,ho,new Map);y(this,Si,new Set);y(this,dc,new Map);y(this,Jn);y(this,Qn);y(this,Pt);p(this,Pt,t),e&&(p(this,Jn,new Map),p(this,Qn,(s,i)=>{Fy(r(this,Jn),i).dependencies.add(s)}))}get clipBox(){return r(this,Pt).clipBox}growOperationsCount(t){r(this,Pt).growOperationsCount(t)}save(t){return p(this,bs,{__proto__:r(this,bs)}),p(this,ws,{__proto__:r(this,ws),transform:{__proto__:r(this,ws).transform},moveText:{__proto__:r(this,ws).moveText},sameLineText:{__proto__:r(this,ws).sameLineText},[Rl]:{__proto__:r(this,ws)[Rl]}}),r(this,Pt).save(t),this}restore(t){r(this,Pt).restore(t,r(this,Qn));const e=Object.getPrototypeOf(r(this,bs));return e===null?this:(p(this,bs,e),p(this,ws,Object.getPrototypeOf(r(this,ws))),this)}recordOpenMarker(t){return r(this,Pt).recordOpenMarker(t,r(this,Qn)),this}getOpenMarker(){return r(this,Pt).getOpenMarker()}recordCloseMarker(t){return r(this,Pt).recordCloseMarker(t,r(this,Qn)),this}beginMarkedContent(t){return r(this,Pt).beginMarkedContent(t),this}endMarkedContent(t){return r(this,Pt).endMarkedContent(t,r(this,Qn)),this}pushBaseTransform(t){return r(this,Pt).pushBaseTransform(t),this}popBaseTransform(){return r(this,Pt).popBaseTransform(),this}recordSimpleData(t,e){return r(this,bs)[t]=e,this}recordIncrementalData(t,e){return r(this,ws)[t].push(e),this}resetIncrementalData(t,e){return r(this,ws)[t].length=0,this}recordNamedData(t,e){return r(this,ho).set(t,e),this}recordSimpleDataFromNamed(t,e,s){r(this,bs)[t]=r(this,ho).get(e)??s}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Rl,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(const e of t)e in r(this,bs)&&this.recordFutureForcedDependency(e,r(this,bs)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const t of r(this,Si))this.recordFutureForcedDependency(Rl,t);return this}resetBBox(t){return r(this,Pt).resetBBox(t),this}recordClipBox(t,e,s,i,n,a){return r(this,Pt).recordClipBox(t,e,s,i,n,a),this}recordBBox(t,e,s,i,n,a){return r(this,Pt).recordBBox(t,e,s,i,n,a),this}recordCharacterBBox(t,e,s,i=1,n=0,a=0,o){const l=s.bbox;let c,h;if(l&&(c=l[2]!==l[0]&&l[3]!==l[1]&&r(this,dc).get(s),c!==!1&&(h=[0,0,0,0],j.axialAlignedBoundingBox(l,s.fontMatrix,h),(i!==1||n!==0||a!==0)&&ES(i,-i,n,a,h),c)))return this.recordBBox(t,e,h[0],h[2],h[1],h[3]);if(!o)return this.recordFullPageBBox(t);const d=o();return l&&h&&c===void 0&&(c=h[0]<=n-d.actualBoundingBoxLeft&&h[2]>=n+d.actualBoundingBoxRight&&h[1]<=a-d.actualBoundingBoxAscent&&h[3]>=a+d.actualBoundingBoxDescent,r(this,dc).set(s,c),c)?this.recordBBox(t,e,h[0],h[2],h[1],h[3]):this.recordBBox(t,e,n-d.actualBoundingBoxLeft,n+d.actualBoundingBoxRight,a-d.actualBoundingBoxAscent,a+d.actualBoundingBoxDescent)}recordFullPageBBox(t){return r(this,Pt).recordFullPageBBox(t),this}getSimpleIndex(t){return r(this,bs)[t]}recordDependencies(t,e){const s=r(this,Si),i=r(this,bs),n=r(this,ws);for(const a of e)a in r(this,bs)?s.add(i[a]):a in n&&n[a].forEach(s.add,s);return this}recordNamedDependency(t,e){return r(this,ho).has(e)&&r(this,Si).add(r(this,ho).get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Rl]),r(this,Jn)){const i=Fy(r(this,Jn),t),{dependencies:n}=i;r(this,Si).forEach(n.add,n),r(this,Pt)._savesStack.forEach(n.add,n),r(this,Pt)._markedContentStack.forEach(n.add,n),n.delete(t),i.isRenderingOperation=!0}const s=!e&&t===r(this,Pt)._pendingBBoxIdx;return r(this,Pt).recordOperation(t,e,[r(this,Si),r(this,Pt)._savesStack,r(this,Pt)._markedContentStack]),s&&r(this,Si).clear(),this}recordShowTextOperation(t,e=!1){const s=Array.from(r(this,Si));this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(const i of s)this.recordIncrementalData("sameLineText",i);return this}bboxToClipBoxDropOperation(t,e=!1){const s=!e&&t===r(this,Pt)._pendingBBoxIdx;return r(this,Pt).bboxToClipBoxDropOperation(t),s&&r(this,Si).clear(),this}take(){return r(this,dc).clear(),r(this,Pt).take()}takeDebugMetadata(){return r(this,Jn)}}bs=new WeakMap,ws=new WeakMap,ho=new WeakMap,Si=new WeakMap,dc=new WeakMap,Jn=new WeakMap,Qn=new WeakMap,Pt=new WeakMap;var It,ee,Ei,fc,pc;const uy=class uy{constructor(t,e,s){y(this,It);y(this,ee);y(this,Ei);y(this,fc,0);y(this,pc,0);if(t instanceof uy&&r(t,Ei)===!!s)return t;p(this,It,t),p(this,ee,e),p(this,Ei,!!s)}get clipBox(){return r(this,It).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(t){return Ft(this,pc)._++,r(this,It).save(r(this,ee)),this}restore(t){return r(this,pc)>0&&(r(this,It).restore(r(this,ee)),Ft(this,pc)._--),this}recordOpenMarker(t){return Ft(this,fc)._++,this}getOpenMarker(){return r(this,fc)>0?r(this,ee):r(this,It).getOpenMarker()}recordCloseMarker(t){return Ft(this,fc)._--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return r(this,It).pushBaseTransform(t),this}popBaseTransform(){return r(this,It).popBaseTransform(),this}recordSimpleData(t,e){return r(this,It).recordSimpleData(t,r(this,ee)),this}recordIncrementalData(t,e){return r(this,It).recordIncrementalData(t,r(this,ee)),this}resetIncrementalData(t,e){return r(this,It).resetIncrementalData(t,r(this,ee)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,s){return r(this,It).recordSimpleDataFromNamed(t,e,r(this,ee)),this}recordFutureForcedDependency(t,e){return r(this,It).recordFutureForcedDependency(t,r(this,ee)),this}inheritSimpleDataAsFutureForcedDependencies(t){return r(this,It).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return r(this,It).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return r(this,Ei)||r(this,It).resetBBox(r(this,ee)),this}recordClipBox(t,e,s,i,n,a){return r(this,Ei)||r(this,It).recordClipBox(r(this,ee),e,s,i,n,a),this}recordBBox(t,e,s,i,n,a){return r(this,Ei)||r(this,It).recordBBox(r(this,ee),e,s,i,n,a),this}recordCharacterBBox(t,e,s,i,n,a,o){return r(this,Ei)||r(this,It).recordCharacterBBox(r(this,ee),e,s,i,n,a,o),this}recordFullPageBBox(t){return r(this,Ei)||r(this,It).recordFullPageBBox(r(this,ee)),this}getSimpleIndex(t){return r(this,It).getSimpleIndex(t)}recordDependencies(t,e){return r(this,It).recordDependencies(r(this,ee),e),this}recordNamedDependency(t,e){return r(this,It).recordNamedDependency(r(this,ee),e),this}recordOperation(t){return r(this,It).recordOperation(r(this,ee),!0),this}recordShowTextOperation(t){return r(this,It).recordShowTextOperation(r(this,ee),!0),this}bboxToClipBoxDropOperation(t){return r(this,Ei)||r(this,It).bboxToClipBoxDropOperation(r(this,ee),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};It=new WeakMap,ee=new WeakMap,Ei=new WeakMap,fc=new WeakMap,pc=new WeakMap;let pu=uy;const qs={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","filter","fillColor"]};var uo,fo,po,go,mo,Yu;const ou=class ou{constructor(t){y(this,uo);y(this,fo);y(this,po,4);y(this,go,0);y(this,mo,new(r(ou,Yu))(r(this,po)*6));p(this,uo,t.width),p(this,fo,t.height)}record(t,e,s,i){if(r(this,go)===r(this,po)){p(this,po,r(this,po)*2);const o=new(r(ou,Yu))(r(this,po)*6);o.set(r(this,mo)),p(this,mo,o)}const n=Ot(t);let a;if(i[0]!==1/0){const o=wr.slice();j.axialAlignedBoundingBox([0,-s,e,0],n,o);const l=j.intersect(i,o);if(!l)return;const[c,h,d,f]=l;if(c!==o[0]||h!==o[1]||d!==o[2]||f!==o[3]){const g=Math.atan2(n[1],n[0]),m=Math.abs(Math.sin(g)),v=Math.abs(Math.cos(g));if(m<1e-6||v<1e-6||Math.abs(m-v)<1e-6)a=[c,h,c,f,d,h];else{const w=d-c,A=f-h,_=m*m,E=v*v,S=v*m,x=E-_,T=(A*E-w*S)/x,C=(A*S-w*_)/x;a=[c+C,h,c,h+T,d,f-T]}}}a||(a=[0,-s,0,0,e,-s],j.applyTransform(a,n,0),j.applyTransform(a,n,2),j.applyTransform(a,n,4)),a[0]/=r(this,uo),a[1]/=r(this,fo),a[2]/=r(this,uo),a[3]/=r(this,fo),a[4]/=r(this,uo),a[5]/=r(this,fo),r(this,mo).set(a,r(this,go)*6),Ft(this,go)._++}take(){return r(this,mo).subarray(0,r(this,go)*6)}};uo=new WeakMap,fo=new WeakMap,po=new WeakMap,go=new WeakMap,mo=new WeakMap,Yu=new WeakMap,y(ou,Yu,_t.isFloat16ArraySupported?Float16Array:Float32Array);let bm=ou;const Ly=new RegExp("\\p{Cc}","u");function PS(u){const t=u[0];if(u.length<2||t!=='"'&&t!=="'"||u.at(-1)!==t)return!1;const e=u.length-1;for(let s=1;s<e;s++){const i=u[s];if(i===t||Ly.test(i)||i==="\\"&&(++s>=e||Ly.test(u[s])))return!1}return!0}function Ny(u){return PS(u)?u:`"${u.replaceAll(/["\\\p{Cc}]/gu,e=>e==='"'||e==="\\"?`\\${e}`:`\\${e.codePointAt(0).toString(16)} `)}"`}var vo,gc,xi,Eh,_w,Sw;class IS{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){y(this,Eh);y(this,vo,new Set);y(this,gc,new Set);y(this,xi,null);this._document=t,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){r(this,vo).add(t),this._document.fonts.add(t)}removeNativeFontFace(t){r(this,vo).delete(t),this._document.fonts.delete(t)}insertRule(t){const e=b(this,Eh,_w).call(this);e.insertRule(t,e.cssRules.length)}clear(){var t;for(const e of r(this,vo))this._document.fonts.delete(e);if(r(this,vo).clear(),r(this,gc).clear(),r(this,xi)){const{adoptedStyleSheets:e}=this._document;e!=null&&e.includes(r(this,xi))&&(this._document.adoptedStyleSheets=e.filter(s=>s!==r(this,xi))),p(this,xi,null)}(t=this.styleElement)==null||t.remove(),this.styleElement=null}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:s}){if(!(!t||r(this,gc).has(t.loadedName))){if(ne(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:i,src:n,style:a}=t,o=new FontFace(i,n,a);this.addNativeFontFace(o);try{await o.load(),r(this,gc).add(i),s==null||s(t)}catch{st(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}vt("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){const s=t.createNativeFontFace();if(s){this.addNativeFontFace(s);try{await s.loaded}catch(i){throw st(`Failed to load font '${s.family}': '${i}'.`),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await b(this,Eh,Sw).call(this,t)}}get isFontLoadingAPISupported(){var t;return V(this,"isFontLoadingAPISupported",!!((t=this._document)!=null&&t.fonts))}get isSyncFontLoadingSupported(){return V(this,"isSyncFontLoadingSupported",Gs||_t.platform.isFirefox)}}vo=new WeakMap,gc=new WeakMap,xi=new WeakMap,Eh=new WeakSet,_w=function(){var e;if(r(this,xi))return r(this,xi);const t=((e=this._document.defaultView)==null?void 0:e.CSSStyleSheet)||globalThis.CSSStyleSheet;if(!this.styleElement&&t){const{adoptedStyleSheets:s}=this._document;if(s){const i=new t;return s.push(i),p(this,xi,i)}}return this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement)),p(this,xi,this.styleElement.sheet)},Sw=function(t){function e(){for(ne(!a.done,"completeRequest() cannot be called twice."),a.done=!0;s.length>0&&s[0].done;){const k=s.shift();setTimeout(k.resolve,0)}}const{loadingRequests:s}=this,{promise:i,resolve:n}=Promise.withResolvers(),a={done:!1,resolve:n};s.push(a),this._loadTestFont??(this._loadTestFont=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="));function o(k,M){return k.charCodeAt(M)<<24|k.charCodeAt(M+1)<<16|k.charCodeAt(M+2)<<8|k.charCodeAt(M+3)&255}function l(k){return String.fromCharCode(k>>24&255,k>>16&255,k>>8&255,k&255)}function c(k,M,R,N){const F=k.substring(0,M),$=k.substring(M+R);return F+N+$}let h,d;const f=this._document.createElement("canvas");f.width=1,f.height=1;const g=f.getContext("2d");let m=0;function v(k,M){if(++m>30){st("Load test font never loaded."),M();return}if(g.font="30px "+k,g.fillText(".",0,20),g.getImageData(0,0,1,1).data[3]>0){M();return}setTimeout(v.bind(null,k,M))}const w=`lt${Date.now()}${this.loadTestFontId++}`;let A=this._loadTestFont;A=c(A,976,w.length,w);const E=16,S=1482184792;let x=o(A,E);for(h=0,d=w.length-3;h<d;h+=4)x=x-S+o(w,h)|0;h<w.length&&(x=x-S+o(w+"XXX",h)|0),A=c(A,E,4,l(x));const T=`url(data:font/opentype;base64,${btoa(A)});`,C=`@font-face {font-family:"${w}";src:${T}}`;this.insertRule(C);const I=this._document.createElement("div");I.style.visibility="hidden",I.style.width=I.style.height="10px",I.style.position="absolute",I.style.top=I.style.left="0px";for(const k of[t.loadedName,w]){const M=this._document.createElement("span");M.textContent="Hi",M.style.fontFamily=k,I.append(M)}return this._document.body.append(I),v(w,()=>{I.remove(),e()}),i};var Ku,se;class kS{constructor(t,e=null,s,i){y(this,Ku,new Map);y(this,se);p(this,se,t),this._inspectFont=e,s&&(this.charProcOperatorList=s),i&&Object.assign(this,i)}createNativeFontFace(){var s;const{data:t}=this;if(!t||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,t,{});else{const i={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(i.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(Ny(this.cssFontInfo.fontFamily),t,i)}return(s=this._inspectFont)==null||s.call(this,this),e}createFontFaceRule(){var i;const{data:t}=this;if(!t||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${t.toBase64()});`;let s;if(!this.cssFontInfo)s=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),s=`@font-face {font-family:${Ny(this.cssFontInfo.fontFamily)};${n}src:${e}}`}return(i=this._inspectFont)==null||i.call(this,this,e),s}getPathGenerator(t,e){let s=r(this,Ku).get(e);if(s)return s;const i=`${this.loadedName}_path_${e}`;let n;try{n=t.get(i)}catch(a){st(`getPathGenerator - ignoring character: "${a}".`)}return s=jb(n==null?void 0:n.path),this.fontExtraProperties||t.delete(i),r(this,Ku).set(e,s),s}get black(){return r(this,se).black}get bold(){return r(this,se).bold}get disableFontFace(){return r(this,se).disableFontFace}set disableFontFace(t){V(this,"disableFontFace",!!t)}get fontExtraProperties(){return r(this,se).fontExtraProperties}get isInvalidPDFjsFont(){return r(this,se).isInvalidPDFjsFont}get isType3Font(){return r(this,se).isType3Font}get italic(){return r(this,se).italic}get missingFile(){return r(this,se).missingFile}get remeasure(){return r(this,se).remeasure}get vertical(){return r(this,se).vertical}get bbox(){return r(this,se).bbox}get fontMatrix(){return r(this,se).fontMatrix}get fallbackName(){return r(this,se).fallbackName}get loadedName(){return r(this,se).loadedName}get mimetype(){return this.missingFile?null:"font/opentype"}get data(){return r(this,se).data}clearData(){r(this,se).clearData()}get cssFontInfo(){return r(this,se).cssFontInfo}get systemFontInfo(){return r(this,se).systemFontInfo}}Ku=new WeakMap,se=new WeakMap;class Ew{}O(Ew,"strings",["fontFamily","fontWeight","italicAngle"]);class xw{}O(xw,"strings",["css","loadedName","baseFontName","src"]);const Vi=class Vi{};O(Vi,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),O(Vi,"strings",["fallbackName","loadedName"]),O(Vi,"OFFSET_BBOX",Math.ceil(Vi.bools.length*2/8)),O(Vi,"OFFSET_FONT_MATRIX",Vi.OFFSET_BBOX+1+2*4),O(Vi,"OFFSET_STRINGS",Vi.OFFSET_FONT_MATRIX+1+8*6);let Sn=Vi;class as{}O(as,"KIND",0),O(as,"HAS_BBOX",1),O(as,"HAS_BACKGROUND",2),O(as,"SHADING_TYPE",3),O(as,"N_COORD",4),O(as,"N_COLOR",8),O(as,"N_STOP",12),O(as,"N_FIGURES",16);class MS{static get decoder(){return V(this,"decoder",new TextDecoder)}static get encoder(){return V(this,"encoder",new TextEncoder)}}function nu(u,t,e,s=0){const{decoder:i}=MS;for(let a=0;a<e;a++)s+=t.getUint32(s)+4;const n=t.getUint32(s);return i.decode(new Uint8Array(u,s+4,n))}var qu,Ju,mc,Df;class OS{constructor(t){y(this,mc);y(this,qu);y(this,Ju);p(this,qu,t),p(this,Ju,new DataView(t))}get fontFamily(){return V(this,"fontFamily",b(this,mc,Df).call(this,0))}get fontWeight(){return V(this,"fontWeight",b(this,mc,Df).call(this,1))}get italicAngle(){return V(this,"italicAngle",b(this,mc,Df).call(this,2))}}qu=new WeakMap,Ju=new WeakMap,mc=new WeakSet,Df=function(t){return ne(t<Ew.strings.length,"Invalid string index"),nu(r(this,qu),r(this,Ju),t)};var yo,Zn,bo,jh;class RS{constructor(t){y(this,bo);y(this,yo);y(this,Zn);p(this,yo,t),p(this,Zn,new DataView(t))}get css(){return V(this,"css",b(this,bo,jh).call(this,0))}get loadedName(){return V(this,"loadedName",b(this,bo,jh).call(this,1))}get baseFontName(){return V(this,"baseFontName",b(this,bo,jh).call(this,2))}get src(){return V(this,"src",b(this,bo,jh).call(this,3))}get style(){let t=0;t+=4+r(this,Zn).getUint32(t);const e=nu(r(this,yo),r(this,Zn),0,t),s=nu(r(this,yo),r(this,Zn),1,t);return V(this,"style",{style:e,weight:s})}}yo=new WeakMap,Zn=new WeakMap,bo=new WeakSet,jh=function(t){return ne(t<xw.strings.length,"Invalid string index"),nu(r(this,yo),r(this,Zn),t,4)};var Ti,ai,Wt,bi,wm,Am,$h;class DS{constructor(t){y(this,Wt);y(this,Ti);y(this,ai);p(this,Ti,t),p(this,ai,new DataView(t))}get black(){return V(this,"black",b(this,Wt,bi).call(this,0))}get bold(){return V(this,"bold",b(this,Wt,bi).call(this,1))}get disableFontFace(){return V(this,"disableFontFace",b(this,Wt,bi).call(this,2))}get fontExtraProperties(){return V(this,"fontExtraProperties",b(this,Wt,bi).call(this,3))}get isInvalidPDFjsFont(){return V(this,"isInvalidPDFjsFont",b(this,Wt,bi).call(this,4))}get isType3Font(){return V(this,"isType3Font",b(this,Wt,bi).call(this,5))}get italic(){return V(this,"italic",b(this,Wt,bi).call(this,6))}get missingFile(){return V(this,"missingFile",b(this,Wt,bi).call(this,7))}get remeasure(){return V(this,"remeasure",b(this,Wt,bi).call(this,8))}get vertical(){return V(this,"vertical",b(this,Wt,bi).call(this,9))}get bbox(){return V(this,"bbox",b(this,Wt,wm).call(this,Sn.OFFSET_BBOX,4,"getInt16",2))}get fontMatrix(){return V(this,"fontMatrix",b(this,Wt,wm).call(this,Sn.OFFSET_FONT_MATRIX,6,"getFloat64",8))}get fallbackName(){return V(this,"fallbackName",b(this,Wt,Am).call(this,0))}get loadedName(){return V(this,"loadedName",b(this,Wt,Am).call(this,1))}get data(){const{offset:t,length:e}=b(this,Wt,$h).call(this,2);return e?new Uint8Array(r(this,Ti),t+4,e):void 0}clearData(){const{offset:t,length:e}=b(this,Wt,$h).call(this,2);e&&(r(this,ai).setUint32(t,0),p(this,Ti,new Uint8Array(r(this,Ti),0,t+4).slice().buffer),p(this,ai,new DataView(r(this,Ti))))}get cssFontInfo(){const{offset:t,length:e}=b(this,Wt,$h).call(this,1);let s=null;if(e){const i=new Uint8Array(r(this,Ti),t+4,e).slice();s=new OS(i.buffer)}return V(this,"cssFontInfo",s)}get systemFontInfo(){const{offset:t,length:e}=b(this,Wt,$h).call(this,0);let s=null;if(e){const i=new Uint8Array(r(this,Ti),t+4,e).slice();s=new RS(i.buffer)}return V(this,"systemFontInfo",s)}}Ti=new WeakMap,ai=new WeakMap,Wt=new WeakSet,bi=function(t){ne(t<Sn.bools.length,"Invalid boolean index");const e=Math.floor(t/4),s=t*2%8,i=r(this,ai).getUint8(e)>>s&3;return i===0?void 0:i===2},wm=function(t,e,s,i){const n=r(this,ai).getUint8(t++);if(n===0)return;ne(n===e,"Invalid array length.");const a=new Array(n);for(let o=0;o<n;o++)a[o]=r(this,ai)[s](t,!0),t+=i;return a},Am=function(t){return ne(t<Sn.strings.length,"Invalid string index"),nu(r(this,Ti),r(this,ai),t,Sn.OFFSET_STRINGS+4)},$h=function(t){let e=Sn.OFFSET_STRINGS;for(let i=0;i<=t;i++)e+=4+r(this,ai).getUint32(e);const s=r(this,ai).getUint32(e);return{offset:e,length:s}};class FS{constructor(t){this.buffer=t,this.view=new DataView(t),this.data=new Uint8Array(t)}getIR(){const t=this.view,e=this.data[as.KIND],s=!!this.data[as.HAS_BBOX],i=!!this.data[as.HAS_BACKGROUND],n=t.getUint32(as.N_COORD,!0),a=t.getUint32(as.N_COLOR,!0),o=t.getUint32(as.N_STOP,!0);let l=20;const c=new Float32Array(this.buffer,l,n*2);l+=n*8;const h=new Uint8Array(this.buffer,l,a*4);l+=a*4;const d=[];for(let m=0;m<o;++m){const v=t.getFloat32(l,!0);l+=4;const w=t.getUint32(l,!0);l+=4,d.push([v,`#${w.toString(16).padStart(6,"0")}`])}let f=null;if(s){f=[];for(let m=0;m<4;++m)f.push(t.getFloat32(l,!0)),l+=4}let g=null;if(i&&(g=new Uint8Array(this.buffer,l,3),l+=3),e===1)return["RadialAxial","axial",f,d,[c[0],c[1]],[c[2],c[3]],null,null];if(e===2)return["RadialAxial","radial",f,d,[c[0],c[1]],[c[3],c[4]],c[2],c[5]];if(e===3){const m=this.data[as.SHADING_TYPE];let v=null;if(c.length>0){v=wr.slice();for(let w=0,A=c.length;w<A;w+=2)j.pointBoundingBox(c[w],c[w+1],v)}return["Mesh",m,c,h,n,v,f,g]}throw new Error(`Unsupported pattern kind: ${e}`)}}var vc;class LS{constructor(t){y(this,vc);p(this,vc,t)}get path(){return _t.isFloat16ArraySupported?new Float16Array(r(this,vc)):new Float32Array(r(this,vc))}}vc=new WeakMap;function NS(u){if(u instanceof URL)return u;if(typeof u=="string"){if(Gs){if(/^[a-z][a-z0-9\-+.]+:/i.test(u))return new URL(u);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(u))}const t=URL.parse(u,window.location);if(t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function BS(u){if(Gs&&typeof Buffer<"u"&&u instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(u instanceof Uint8Array&&u.byteLength===u.buffer.byteLength)return u;if(typeof u=="string")return yg(u);if(u instanceof ArrayBuffer||ArrayBuffer.isView(u)||typeof u=="object"&&!isNaN(u==null?void 0:u.length))return new Uint8Array(u);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function bf(u){if(typeof u!="string")return null;if(u.endsWith("/"))return u;throw new Error(`Invalid factory url: "${u}" must include trailing slash.`)}const _m=u=>typeof u=="object"&&Number.isInteger(u==null?void 0:u.num)&&u.num>=0&&Number.isInteger(u==null?void 0:u.gen)&&u.gen>=0,US=u=>typeof u=="object"&&typeof(u==null?void 0:u.name)=="string",Tw=pS.bind(null,_m,US);var $r,kp;class HS{constructor(){y(this,$r,new Map);y(this,kp,Promise.resolve())}postMessage(t,e){const s={data:structuredClone(t,e?{transfer:e}:null)};r(this,kp).then(()=>{for(const[i]of r(this,$r))i.call(this,s)})}addEventListener(t,e,s=null){let i=null;if((s==null?void 0:s.signal)instanceof AbortSignal){const{signal:n}=s;if(n.aborted){st("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(t,e);i=()=>n.removeEventListener("abort",a),n.addEventListener("abort",a)}r(this,$r).set(e,i)}removeEventListener(t,e){const s=r(this,$r).get(e);s==null||s(),r(this,$r).delete(e)}terminate(){for(const[,t]of r(this,$r))t==null||t();r(this,$r).clear()}}$r=new WeakMap,kp=new WeakMap;z0();const wf={DATA:1,ERROR:2},ue={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function By(){}function gs(u){if(u instanceof mn||u instanceof fp||u instanceof dp||u instanceof hu||u instanceof Lg)return u;switch(u instanceof Error||typeof u=="object"&&u!==null||vt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),u.name){case"AbortException":return new mn(u.message);case"InvalidPDFException":return new fp(u.message);case"PasswordException":return new dp(u.message,u.code);case"ResponseException":return new hu(u.message,u.status,u.missing);case"UnknownErrorException":return new Lg(u.message,u.details)}return new Lg(u.message,u.toString())}var yc,bc,Mp,ir,wc,Ci,Gr,Op,Ac,wo,pi,Cw,Pw,Iw,Ff;class Gh{constructor(t,e,s){y(this,pi);y(this,yc,new Map);y(this,bc,new Map);y(this,Mp,1);y(this,ir);y(this,wc,new AbortController);y(this,Ci);y(this,Gr,new Map);y(this,Op,1);y(this,Ac,new Map);y(this,wo);p(this,Ci,t),p(this,wo,e),p(this,ir,s),s.addEventListener("message",b(this,pi,Cw).bind(this),{signal:r(this,wc).signal})}on(t,e){const s=r(this,yc);if(s.has(t))throw new Error(`There is already a "${t}" handler.`);s.set(t,e)}send(t,e,s){r(this,ir).postMessage({sourceName:r(this,Ci),targetName:r(this,wo),action:t,data:e},s)}sendWithPromise(t,e,s){const i=Ft(this,Mp)._++,n=Promise.withResolvers();r(this,bc).set(i,n);try{r(this,ir).postMessage({sourceName:r(this,Ci),targetName:r(this,wo),action:t,callbackId:i,data:e},s)}catch(a){n.reject(a)}return n.promise}sendWithStream(t,e,s,i){const n=Ft(this,Op)._++,a=r(this,Ci),o=r(this,wo),l=r(this,ir);return new ReadableStream({start:c=>{const h=Promise.withResolvers();return r(this,Gr).set(n,{controller:c,startCall:h,pullCall:null,cancelCall:null,isClosed:!1}),l.postMessage({sourceName:a,targetName:o,action:t,streamId:n,data:e,desiredSize:c.desiredSize},i),h.promise},pull:c=>{const h=Promise.withResolvers();return r(this,Gr).get(n).pullCall=h,l.postMessage({sourceName:a,targetName:o,stream:ue.PULL,streamId:n,desiredSize:c.desiredSize}),h.promise},cancel:c=>{ne(c instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return r(this,Gr).get(n).cancelCall=h,r(this,Gr).get(n).isClosed=!0,l.postMessage({sourceName:a,targetName:o,stream:ue.CANCEL,streamId:n,reason:gs(c)}),h.promise}},s)}destroy(){var t;(t=r(this,wc))==null||t.abort(),p(this,wc,null)}}yc=new WeakMap,bc=new WeakMap,Mp=new WeakMap,ir=new WeakMap,wc=new WeakMap,Ci=new WeakMap,Gr=new WeakMap,Op=new WeakMap,Ac=new WeakMap,wo=new WeakMap,pi=new WeakSet,Cw=function({data:t}){if(t.targetName!==r(this,Ci))return;if(t.stream){b(this,pi,Iw).call(this,t);return}if(t.callback){const{callbackId:s,callback:i}=t,n=r(this,bc).get(s);if(!n)throw new Error(`Cannot resolve callback ${s}`);if(r(this,bc).delete(s),i===wf.DATA)n.resolve(t.data);else if(i===wf.ERROR)n.reject(gs(t.reason));else throw new Error("Unexpected callback case");return}const e=r(this,yc).get(t.action);if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const s=r(this,Ci),i=t.sourceName,n=r(this,ir);Promise.try(e,t.data).then(a=>{n.postMessage({sourceName:s,targetName:i,callback:wf.DATA,callbackId:t.callbackId,data:a})},a=>{n.postMessage({sourceName:s,targetName:i,callback:wf.ERROR,callbackId:t.callbackId,reason:gs(a)})});return}if(t.streamId){b(this,pi,Pw).call(this,t);return}e(t.data)},Pw=function(t){const e=t.streamId,s=r(this,Ci),i=t.sourceName,n=r(this,ir),a=r(this,Ac),o=r(this,yc).get(t.action),l={enqueue(c,h=1,d){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=h,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:s,targetName:i,stream:ue.ENQUEUE,streamId:e,chunk:c},d)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:ue.CLOSE,streamId:e}),a.delete(e))},error(c){ne(c instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:ue.ERROR,streamId:e,reason:gs(c)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,a.set(e,l),Promise.try(o,t.data,l).then(()=>{n.postMessage({sourceName:s,targetName:i,stream:ue.START_COMPLETE,streamId:e,success:!0})},c=>{n.postMessage({sourceName:s,targetName:i,stream:ue.START_COMPLETE,streamId:e,reason:gs(c)})})},Iw=function(t){const e=t.streamId,s=r(this,Ci),i=t.sourceName,n=r(this,ir),a=r(this,Gr).get(e),o=r(this,Ac).get(e);switch(t.stream){case ue.START_COMPLETE:t.success?a.startCall.resolve():a.startCall.reject(gs(t.reason));break;case ue.PULL_COMPLETE:t.success?a.pullCall.resolve():a.pullCall.reject(gs(t.reason));break;case ue.PULL:if(!o){n.postMessage({sourceName:s,targetName:i,stream:ue.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,Promise.try(o.onPull||By).then(()=>{n.postMessage({sourceName:s,targetName:i,stream:ue.PULL_COMPLETE,streamId:e,success:!0})},c=>{n.postMessage({sourceName:s,targetName:i,stream:ue.PULL_COMPLETE,streamId:e,reason:gs(c)})});break;case ue.ENQUEUE:if(ne(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case ue.CLOSE:if(ne(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),b(this,pi,Ff).call(this,a,e);break;case ue.ERROR:ne(a,"error should have stream controller"),a.controller.error(gs(t.reason)),b(this,pi,Ff).call(this,a,e);break;case ue.CANCEL_COMPLETE:t.success?a.cancelCall.resolve():a.cancelCall.reject(gs(t.reason)),b(this,pi,Ff).call(this,a,e);break;case ue.CANCEL:if(!o)break;const l=gs(t.reason);Promise.try(o.onCancel||By,l).then(()=>{n.postMessage({sourceName:s,targetName:i,stream:ue.CANCEL_COMPLETE,streamId:e,success:!0})},c=>{n.postMessage({sourceName:s,targetName:i,stream:ue.CANCEL_COMPLETE,streamId:e,reason:gs(c)})}),o.sinkCapability.reject(l),o.isCancelled=!0,r(this,Ac).delete(e);break;default:throw new Error("Unexpected stream case")}},Ff=async function(t,e){var s,i,n;await Promise.allSettled([(s=t.startCall)==null?void 0:s.promise,(i=t.pullCall)==null?void 0:i.promise,(n=t.cancelCall)==null?void 0:n.promise]),r(this,Gr).delete(e)};var Rp;class kw{constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:s=null}){y(this,Rp,Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"}));this.cMapUrl=t,this.standardFontDataUrl=e,this.wasmUrl=s}async fetch({kind:t,filename:e}){switch(t){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:vt(`Not implemented: ${t}`)}const s=this[t];if(!s)throw new Error(`Ensure that the \`${t}\` API parameter is provided.`);const i=`${s}${e}`;return this._fetch(i,t).catch(n=>{throw new Error(`Unable to load ${r(this,Rp)[t]} data at: ${i}`)})}async _fetch(t,e){vt("Abstract method `_fetch` called.")}}Rp=new WeakMap;class Uy extends kw{async _fetch(t,e){const s=e==="cMapUrl"&&!t.endsWith(".bcmap")?"text":"bytes",i=await Ag(t,s);return i instanceof Uint8Array?i:yg(i)}}var Qu;class Mw{constructor({enableHWA:t=!1}){y(this,Qu,!1);p(this,Qu,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const s=this._createCanvas(t,e);return{canvas:s,context:s.getContext("2d",{willReadFrequently:!r(this,Qu)})}}reset({canvas:t},e,s){if(!t)throw new Error("Canvas is not specified");if(e<=0||s<=0)throw new Error("Invalid canvas size");t.width=e,t.height=s}destroy(t){const{canvas:e}=t;if(!e)throw new Error("Canvas is not specified");e.width=e.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){vt("Abstract method `_createCanvas` called.")}}Qu=new WeakMap;class jS extends Mw{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){const s=this._document.createElement("canvas");return s.width=t,s.height=e,s}}class Ow{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addKnockoutFilter(t=0){return"none"}addHighlightHCMFilter(t,e,s,i,n){return"none"}addSelectionHCMFilter(t,e){return"none"}addSelectionFilter(){return"none"}createSelectionStyle(t=null){return null}destroy(t=!1){}}var Ao,_c,zr,rr,Me,_o,ta,z,Ce,zh,Gi,Lf,Ra,Rw,Sm,Da,Vh,Wh,Em,Xh,Dw,xm,Fw;class $S extends Ow{constructor({docId:e,ownerDocument:s=globalThis.document}){super();y(this,z);y(this,Ao);y(this,_c);y(this,zr);y(this,rr);y(this,Me);y(this,_o);y(this,ta,0);p(this,rr,e),p(this,Me,s)}addFilter(e){if(!e)return"none";let s=r(this,z,Ce).get(e);if(s)return s;const[i,n,a]=b(this,z,Lf).call(this,e),o=e.length===1?i:`${i}${n}${a}`;if(s=r(this,z,Ce).get(o),s)return r(this,z,Ce).set(e,s),s;const l=`g_${r(this,rr)}_transfer_map_${Ft(this,ta)._++}`,c=b(this,z,Ra).call(this,l);r(this,z,Ce).set(e,c),r(this,z,Ce).set(o,c);const h=b(this,z,Da).call(this,l);return b(this,z,Wh).call(this,i,n,a,h),c}addHCMFilter(e,s){var m;const i=`${e}-${s}`,n="base";let a=r(this,z,zh).get(n);if((a==null?void 0:a.key)===i||(a?((m=a.filter)==null||m.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},r(this,z,zh).set(n,a)),!e||!s))return a.url;const o=b(this,z,Xh).call(this,e);e=j.makeHexColor(...o);const l=b(this,z,Xh).call(this,s);if(s=j.makeHexColor(...l),b(this,z,xm).call(this),e==="#000000"&&s==="#ffffff"||e===s)return a.url;const h=Array.from({length:256},(v,w)=>Yg(w/255)).join(","),d=`g_${r(this,rr)}_hcm_filter`,f=a.filter=b(this,z,Da).call(this,d);b(this,z,Wh).call(this,h,h,h,f),b(this,z,Sm).call(this,f);const g=(v,w)=>{const A=o[v]/255,_=l[v]/255,E=new Array(w+1);for(let S=0;S<=w;S++)E[S]=A+S/w*(_-A);return E.join(",")};return b(this,z,Wh).call(this,g(0,5),g(1,5),g(2,5),f),a.url=b(this,z,Ra).call(this,d),a.url}addSelectionHCMFilter(e,s){return this.addHighlightHCMFilter("selection",e,s,"HighlightText","Highlight")}addSelectionFilter(){return this.addHighlightHCMFilter("selection_default","black","white","HighlightText","Highlight")}createSelectionStyle(e=null){const s=e?this.addSelectionHCMFilter(e.foreground,e.background):this.addSelectionFilter();return s==="none"||!_t.platform.isFirefox?null:{"backdrop-filter":s,"background-color":"transparent"}}addAlphaFilter(e){let s=r(this,z,Ce).get(e);if(s)return s;const[i]=b(this,z,Lf).call(this,[e]),n=`alpha_${i}`;if(s=r(this,z,Ce).get(n),s)return r(this,z,Ce).set(e,s),s;const a=`g_${r(this,rr)}_alpha_map_${Ft(this,ta)._++}`,o=b(this,z,Ra).call(this,a);r(this,z,Ce).set(e,o),r(this,z,Ce).set(n,o);const l=b(this,z,Da).call(this,a);return b(this,z,Em).call(this,i,l),o}addLuminosityFilter(e){let s=r(this,z,Ce).get(e||"luminosity");if(s)return s;let i,n;if(e?([i]=b(this,z,Lf).call(this,[e]),n=`luminosity_${i}`):n="luminosity",s=r(this,z,Ce).get(n),s)return r(this,z,Ce).set(e,s),s;const a=`g_${r(this,rr)}_luminosity_map_${Ft(this,ta)._++}`,o=b(this,z,Ra).call(this,a);r(this,z,Ce).set(e,o),r(this,z,Ce).set(n,o);const l=b(this,z,Da).call(this,a);return b(this,z,Rw).call(this,l),e&&b(this,z,Em).call(this,i,l),o}addKnockoutFilter(e=0){const s=e>0?Math.min(1/e,1e6):1e6,i=`knockout_${s}`,n=r(this,z,Ce).get(i);if(n)return n;const a=`g_${r(this,rr)}_knockout_filter_${Ft(this,ta)._++}`,o=b(this,z,Ra).call(this,a);r(this,z,Ce).set(i,o);const l=b(this,z,Da).call(this,a),c=r(this,Me).createElementNS(ns,"feComponentTransfer");l.append(c);const h=r(this,Me).createElementNS(ns,"feFuncA");return h.setAttribute("type","linear"),h.setAttribute("slope",`${s}`),h.setAttribute("intercept","0"),c.append(h),o}addHighlightHCMFilter(e,s,i,n,a){var _;const o=`${s}-${i}-${n}-${a}`;let l=r(this,z,zh).get(e);if((l==null?void 0:l.key)===o||(l?((_=l.filter)==null||_.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},r(this,z,zh).set(e,l)),!s||!i))return l.url;const[c,h]=[s,i].map(b(this,z,Xh).bind(this));let d=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),f=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[g,m]=[n,a].map(b(this,z,Fw).bind(this));f<d&&([d,f,g,m]=[f,d,m,g]),b(this,z,xm).call(this);const v=(E,S,x)=>{const T=new Array(256),C=(f-d)/x,I=E/255,k=(S-E)/(255*x);let M=0;for(let R=0;R<=x;R++){const N=Math.round(d+R*C),F=I+R*k;for(let $=M;$<=N;$++)T[$]=F;M=N+1}for(let R=M;R<256;R++)T[R]=T[M-1];return T.join(",")},w=`g_${r(this,rr)}_hcm_${e}_filter`,A=l.filter=b(this,z,Da).call(this,w);return b(this,z,Sm).call(this,A),b(this,z,Wh).call(this,v(g[0],m[0],5),v(g[1],m[1],5),v(g[2],m[2],5),A),l.url=b(this,z,Ra).call(this,w),l.url}destroy(e=!1){var s,i,n,a;e&&((s=r(this,_o))!=null&&s.size)||((i=r(this,zr))==null||i.parentNode.parentNode.remove(),p(this,zr,null),(n=r(this,_c))==null||n.clear(),p(this,_c,null),(a=r(this,_o))==null||a.clear(),p(this,_o,null),p(this,ta,0))}}Ao=new WeakMap,_c=new WeakMap,zr=new WeakMap,rr=new WeakMap,Me=new WeakMap,_o=new WeakMap,ta=new WeakMap,z=new WeakSet,Ce=function(){return r(this,_c)||p(this,_c,new Map)},zh=function(){return r(this,_o)||p(this,_o,new Map)},Gi=function(){if(!r(this,zr)){const e=r(this,Me).createElement("div"),{style:s}=e;s.colorScheme="only light",s.visibility="hidden",s.contain="strict",s.width=s.height=0,s.position="absolute",s.top=s.left=0,s.zIndex=-1;const i=r(this,Me).createElementNS(ns,"svg");i.setAttribute("width",0),i.setAttribute("height",0),p(this,zr,r(this,Me).createElementNS(ns,"defs")),e.append(i),i.append(r(this,zr)),r(this,Me).body.append(e)}return r(this,zr)},Lf=function(e){const s=o=>o&&Array.from(o,l=>l/255).join(",");if(e.length===1){const o=s(e[0]);return[o,o,o]}const[i,n,a]=e;return[s(i),s(n),s(a)]},Ra=function(e){if(r(this,Ao)===void 0){p(this,Ao,"");const s=r(this,Me).URL;s!==r(this,Me).baseURI&&(gf(s)?st('#createUrl: ignore "data:"-URL for performance reasons.'):p(this,Ao,qv(s,"")))}return`url(${r(this,Ao)}#${e})`},Rw=function(e){const s=r(this,Me).createElementNS(ns,"feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(s)},Sm=function(e){const s=r(this,Me).createElementNS(ns,"feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(s)},Da=function(e){const s=r(this,Me).createElementNS(ns,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",e),r(this,z,Gi).append(s),s},Vh=function(e,s,i){if(!i)return;const n=r(this,Me).createElementNS(ns,s);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),e.append(n)},Wh=function(e,s,i,n){const a=r(this,Me).createElementNS(ns,"feComponentTransfer");n.append(a),b(this,z,Vh).call(this,a,"feFuncR",e),b(this,z,Vh).call(this,a,"feFuncG",s),b(this,z,Vh).call(this,a,"feFuncB",i)},Em=function(e,s){const i=r(this,Me).createElementNS(ns,"feComponentTransfer");s.append(i),b(this,z,Vh).call(this,i,"feFuncA",e)},Xh=function(e){return r(this,z,Gi).style.color="CanvasText",r(this,z,Gi).style.backgroundColor=e,Ph(getComputedStyle(r(this,z,Gi)).getPropertyValue("background-color"))},Dw=function(e){return r(this,z,Gi).style.color="CanvasText",r(this,z,Gi).style.backgroundColor=e,Il(getComputedStyle(r(this,z,Gi)).getPropertyValue("background-color"))},xm=function(){r(this,z,Gi).style.color="",r(this,z,Gi).style.backgroundColor=""},Fw=function(e){const[s,i,n,a]=b(this,z,Dw).call(this,e);if(a===1)return[s,i,n];const[o,l,c]=b(this,z,Xh).call(this,"Canvas");return[Hg(s,o,a),Hg(i,l,a),Hg(n,c,a)]};function Hg(u,t,e){return Math.round(e*u+(1-e)*t)}var eb;if(Gs){let u;try{const t=process.getBuiltinModule("module").createRequire(import.meta.url);try{u=t("@napi-rs/canvas")}catch(e){st(`Cannot load "@napi-rs/canvas" package: "${e}".`)}}catch(t){st(`Cannot access the \`require\` function: "${t}".`)}globalThis.DOMMatrix||(u!=null&&u.DOMMatrix?globalThis.DOMMatrix=u.DOMMatrix:st("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.Path2D||(u!=null&&u.Path2D?globalThis.Path2D=u.Path2D:st("Cannot polyfill `Path2D`, rendering may be broken.")),(eb=globalThis.navigator)!=null&&eb.language||(globalThis.navigator={language:"en-US",platform:"",userAgent:""})}async function GS(u){const e=await process.getBuiltinModule("fs/promises").readFile(u);return new Uint8Array(e)}class zS extends Ow{}class VS extends Mw{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(t,e)}}class WS extends kw{async _fetch(t,e){return GS(t)}}function Lw({src:u,srcPos:t=0,dest:e,width:s,height:i,nonBlackColor:n=4294967295,inverseDecode:a=!1}){const o=_t.isLittleEndian?4278190080:255,[l,c]=a?[n,o]:[o,n],h=s>>3,d=s&7,f=l^c,g=u.length;e=new Uint32Array(e.buffer);let m=0;for(let v=0;v<i;++v){for(const A=t+h;t<A;++t,m+=8){const _=u[t];e[m]=l^-(_>>7&1)&f,e[m+1]=l^-(_>>6&1)&f,e[m+2]=l^-(_>>5&1)&f,e[m+3]=l^-(_>>4&1)&f,e[m+4]=l^-(_>>3&1)&f,e[m+5]=l^-(_>>2&1)&f,e[m+6]=l^-(_>>1&1)&f,e[m+7]=l^-(_&1)&f}if(d===0)continue;const w=t<g?u[t++]:255;for(let A=0;A<d;++A,++m)e[m]=l^-(w>>7-A&1)&f}return{srcPos:t,destPos:m}}function XS({src:u,srcPos:t=0,dest:e,destPos:s=0,width:i,height:n}){let a=0;const o=i*n*3,l=o>>2,c=new Uint32Array(u.buffer,t,l),h=_t.isLittleEndian?4278190080:255;if(_t.isLittleEndian){for(;a<l-2;a+=3,s+=4){const d=c[a],f=c[a+1],g=c[a+2];e[s]=d|h,e[s+1]=d>>>24|f<<8|h,e[s+2]=f>>>16|g<<16|h,e[s+3]=g>>>8|h}for(let d=t+a*4,f=t+o;d<f;d+=3)e[s++]=u[d]|u[d+1]<<8|u[d+2]<<16|h}else{for(;a<l-2;a+=3,s+=4){const d=c[a],f=c[a+1],g=c[a+2];e[s]=d|h,e[s+1]=d<<24|f>>>8|h,e[s+2]=f<<16|g>>>16|h,e[s+3]=g<<8|h}for(let d=t+a*4,f=t+o;d<f;d+=3)e[s++]=u[d]<<24|u[d+1]<<16|u[d+2]<<8|h}return{srcPos:t+o,destPos:s}}const YS=`
5
+ struct Uniforms {
6
+ offsetX : f32,
7
+ offsetY : f32,
8
+ scaleX : f32,
9
+ scaleY : f32,
10
+ paddedWidth : f32,
11
+ paddedHeight : f32,
12
+ borderSize : f32,
13
+ _pad : f32,
14
+ };
15
+
16
+ @group(0) @binding(0) var<uniform> u : Uniforms;
17
+
18
+ struct VertexInput {
19
+ @location(0) position : vec2<f32>,
20
+ @location(1) color : vec4<f32>,
21
+ };
22
+
23
+ struct VertexOutput {
24
+ @builtin(position) position : vec4<f32>,
25
+ @location(0) color : vec3<f32>,
26
+ };
27
+
28
+ @vertex
29
+ fn vs_main(in : VertexInput) -> VertexOutput {
30
+ var out : VertexOutput;
31
+ let cx = (in.position.x + u.offsetX) * u.scaleX;
32
+ let cy = (in.position.y + u.offsetY) * u.scaleY;
33
+ out.position = vec4<f32>(
34
+ ((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
35
+ 1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
36
+ 0.0,
37
+ 1.0
38
+ );
39
+ out.color = in.color.rgb;
40
+ return out;
41
+ }
42
+
43
+ @fragment
44
+ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
45
+ return vec4<f32>(in.color, 1.0);
46
+ }
47
+ `;var Dp,Vr,So,Sc,Fp,Nw;class KS{constructor(){y(this,Fp);y(this,Dp,null);y(this,Vr,null);y(this,So,null);y(this,Sc,null)}init(){return r(this,Dp)||p(this,Dp,b(this,Fp,Nw).call(this))}get isReady(){return r(this,Vr)!==null}loadMeshShader(){if(!r(this,Vr)||r(this,So))return;const t=r(this,Vr).createShaderModule({code:YS});p(this,So,r(this,Vr).createRenderPipeline({layout:"auto",vertex:{module:t,entryPoint:"vs_main",buffers:[{arrayStride:2*4,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:t,entryPoint:"fs_main",targets:[{format:r(this,Sc)}]},primitive:{topology:"triangle-list"}}))}draw(t,e,s,i,n,a,o,l){this.loadMeshShader();const c=r(this,Vr),{offsetX:h,offsetY:d,scaleX:f,scaleY:g}=i,m=c.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&c.queue.writeBuffer(m,0,t);const v=c.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&c.queue.writeBuffer(v,0,e);const w=c.createBuffer({size:8*4,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});c.queue.writeBuffer(w,0,new Float32Array([h,d,f,g,a,o,l,0]));const A=c.createBindGroup({layout:r(this,So).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:w}}]}),_=new OffscreenCanvas(a,o),E=_.getContext("webgpu");E.configure({device:c,format:r(this,Sc),alphaMode:n?"opaque":"premultiplied"});const S=n?{r:n[0]/255,g:n[1]/255,b:n[2]/255,a:1}:{r:0,g:0,b:0,a:0},x=c.createCommandEncoder(),T=x.beginRenderPass({colorAttachments:[{view:E.getCurrentTexture().createView(),clearValue:S,loadOp:"clear",storeOp:"store"}]});return s>0&&(T.setPipeline(r(this,So)),T.setBindGroup(0,A),T.setVertexBuffer(0,m),T.setVertexBuffer(1,v),T.draw(s)),T.end(),c.queue.submit([x.finish()]),m.destroy(),v.destroy(),w.destroy(),_.transferToImageBitmap()}}Dp=new WeakMap,Vr=new WeakMap,So=new WeakMap,Sc=new WeakMap,Fp=new WeakSet,Nw=async function(){var t;if(!((t=globalThis.navigator)!=null&&t.gpu))return!1;try{const e=await navigator.gpu.requestAdapter();return e?(p(this,Sc,navigator.gpu.getPreferredCanvasFormat()),p(this,Vr,await e.requestDevice()),!0):!1}catch{return!1}};const Eg=new KS;function qS(){return Eg.init()}function JS(){return Eg.isReady}function QS(){Eg.loadMeshShader()}function ZS(u,t,e,s,i,n,a,o){return Eg.draw(u,t,e,s,i,n,a,o)}const Ue={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function Nf(u,t){if(!t)return;const e=t[2]-t[0],s=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],e,s),u.clip(i)}class ey{constructor(){O(this,"matrix",null)}isModifyingCurrentTransform(){return!1}getPattern(){vt("Abstract method `getPattern` called.")}}class tE extends ey{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7]}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}areConic(){if(!this.isRadial())return!1;const t=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return t+this._r1>this._r0&&t+this._r0>this._r1}_createGradient(t,e=null){let s,i=this._p0,n=this._p1;if(e&&(i=i.slice(),n=n.slice(),j.applyTransform(i,e),j.applyTransform(n,e)),this._type==="axial")s=t.createLinearGradient(i[0],i[1],n[0],n[1]);else if(this._type==="radial"){let a=this._r0,o=this._r1;if(e){const l=new Float32Array(2);j.singularValueDecompose2dScale(e,l),a*=l[0],o*=l[0]}s=t.createRadialGradient(i[0],i[1],a,n[0],n[1],o)}for(const a of this._colorStops)s.addColorStop(a[0],a[1]);return s}_createReversedGradient(t,e=null){let s=this._p1,i=this._p0;e&&(s=s.slice(),i=i.slice(),j.applyTransform(s,e),j.applyTransform(i,e));let n=this._r1,a=this._r0;if(e){const c=new Float32Array(2);j.singularValueDecompose2dScale(e,c),n*=c[0],a*=c[0]}const o=t.createRadialGradient(s[0],s[1],n,i[0],i[1],a),l=this._colorStops.map(([c,h])=>[1-c,h]).reverse();for(const[c,h]of l)o.addColorStop(c,h);return o}_createRasterPattern(t,e,s,i,n,a){const o=Math.ceil(i[2]-i[0])||1,l=Math.ceil(i[3]-i[1])||1,c=e.canvasFactory.create(o,l),h=c.context;h.clearRect(0,0,o,l),h.beginPath(),h.rect(0,0,o,l),h.translate(-i[0],-i[1]),s=j.transform(s,[1,0,0,1,i[0],i[1]]),h.transform(...n),Nf(h,this._bbox),this.areConic()&&(h.fillStyle=this._createReversedGradient(h),h.fill()),h.fillStyle=this._createGradient(h),h.fill(),a==null||a.applyToCanvas(h);const d=t.createPattern(c.canvas,"no-repeat");return e.canvasFactory.destroy(c),d.setTransform(new DOMMatrix(s)),d}getPattern(t,e,s,i){const n=e.current.transferMapsFallback;if(i===Ue.STROKE||i===Ue.FILL){if(this.isOriginBased()&&!n){let l=j.transform(s,e.baseTransform);this.matrix&&(l=j.transform(l,this.matrix));const c=.001,h=Math.hypot(l[0],l[1]),d=Math.hypot(l[2],l[3]),f=(l[0]*l[2]+l[1]*l[3])/(h*d);if(Math.abs(f)<c)if(this.isRadial()){if(Math.abs(h-d)<c)return this._createGradient(t,l)}else return this._createGradient(t,l)}const a=e.current.getClippedPathBoundingBox(i,Ot(t))||[0,0,0,0],o=this.matrix?j.transform(e.baseTransform,this.matrix):e.baseTransform;return this._createRasterPattern(t,e,s,a,o,n)}return n&&s?this._createRasterPattern(t,e,s,e.current.clipBox,Ot(t),n):(this.areConic()&&(t.save(),Nf(t,this._bbox),t.fillStyle=this._createReversedGradient(t),t.fillRect(-1e10,-1e10,2e10,2e10),t.restore()),Nf(t,this._bbox),this._createGradient(t))}}function eE(u,t,e,s,i,n,a,o){const l=t.coords,c=t.colors,h=u.data,d=u.width*4;let f;l[e*2+1]>l[s*2+1]&&(f=e,e=s,s=f,f=n,n=a,a=f),l[s*2+1]>l[i*2+1]&&(f=s,s=i,i=f,f=a,a=o,o=f),l[e*2+1]>l[s*2+1]&&(f=e,e=s,s=f,f=n,n=a,a=f);const g=(l[e*2]+t.offsetX)*t.scaleX,m=(l[e*2+1]+t.offsetY)*t.scaleY,v=(l[s*2]+t.offsetX)*t.scaleX,w=(l[s*2+1]+t.offsetY)*t.scaleY,A=(l[i*2]+t.offsetX)*t.scaleX,_=(l[i*2+1]+t.offsetY)*t.scaleY;if(m>=_)return;const E=c[n*4],S=c[n*4+1],x=c[n*4+2],T=c[a*4],C=c[a*4+1],I=c[a*4+2],k=c[o*4],M=c[o*4+1],R=c[o*4+2],N=Math.round(m),F=Math.round(_);let $,U,D,H,X,nt,gt,mt;for(let ht=N;ht<=F;ht++){if(ht<w){const B=ht<m?0:(m-ht)/(m-w);$=g-(g-v)*B,U=E-(E-T)*B,D=S-(S-C)*B,H=x-(x-I)*B}else{let B;ht>_?B=1:w===_?B=0:B=(w-ht)/(w-_),$=v-(v-A)*B,U=T-(T-k)*B,D=C-(C-M)*B,H=I-(I-R)*B}let at;ht<m?at=0:ht>_?at=1:at=(m-ht)/(m-_),X=g-(g-A)*at,nt=E-(E-k)*at,gt=S-(S-M)*at,mt=x-(x-R)*at;const Ee=Math.round(Math.min($,X)),G=Math.round(Math.max($,X));let L=d*ht+Ee*4;for(let B=Ee;B<=G;B++)at=($-B)/($-X),at<0?at=0:at>1&&(at=1),h[L++]=U-(U-nt)*at|0,h[L++]=D-(D-gt)*at|0,h[L++]=H-(H-mt)*at|0,h[L++]=255}}class sE extends ey{constructor(t){super(),this._posData=t[2],this._colData=t[3],this._vertexCount=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],QS()}_createMeshCanvas(t,e,s,i=null){const l=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-l,d=Math.ceil(this._bounds[3])-c,f=Math.min(Math.ceil(Math.abs(h*t[0]*1.1)),3e3)||1,g=Math.min(Math.ceil(Math.abs(d*t[1]*1.1)),3e3)||1,m=h?h/f:1,v=d?d/g:1,w={coords:this._posData,colors:this._colData,offsetX:-l,offsetY:-c,scaleX:1/m,scaleY:1/v},A=f+2*2,_=g+2*2,E=s.create(A,_);if(JS()&&this._vertexCount>48)E.context.drawImage(ZS(this._posData,this._colData,this._vertexCount,w,e,A,_,2),0,0);else{const S=E.context.createImageData(f,g);if(e){const x=S.data;for(let T=0,C=x.length;T<C;T+=4)x[T]=e[0],x[T+1]=e[1],x[T+2]=e[2],x[T+3]=255}for(let x=0,T=this._vertexCount;x<T;x+=3)eE(S,w,x,x+1,x+2,x,x+1,x+2);E.context.putImageData(S,2,2)}return i==null||i.applyToCanvas(E.context),{canvas:E.canvas,offsetX:l-2*m,offsetY:c-2*v,scaleX:m,scaleY:v}}isModifyingCurrentTransform(){return!0}getPattern(t,e,s,i){Nf(t,this._bbox);const n=new Float32Array(2);if(i===Ue.SHADING)j.singularValueDecompose2dScale(Ot(t),n);else if(this.matrix){j.singularValueDecompose2dScale(this.matrix,n);const[l,c]=n;j.singularValueDecompose2dScale(e.baseTransform,n),n[0]*=l,n[1]*=c}else j.singularValueDecompose2dScale(e.baseTransform,n);const a=this._createMeshCanvas(n,i===Ue.SHADING?null:this._background,e.canvasFactory,e.current.transferMapsFallback);i!==Ue.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY);const o=t.createPattern(a.canvas,"no-repeat");return e.canvasFactory.destroy(a),o}}class iE extends ey{getPattern(){return"hotpink"}}function rE(u){switch(u[0]){case"RadialAxial":return new tE(u);case"Mesh":return new sE(u);case"Dummy":return new iE}throw new Error(`Unknown IR type: ${u[0]}`)}const Hy={COLORED:1,UNCOLORED:2},Lp=class Lp{constructor(t,e,s,i){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.needsIsolation=t[9]??!0,this.ctx=e,this.canvasGraphicsFactory=s,this.baseTransform=i,this.patternBaseMatrix=this.matrix?j.transform(i,this.matrix):i}canSkipPatternCanvas([t,e,s,i]){const[n,a,o,l]=this.bbox,c=Math.abs(this.xstep),h=Math.abs(this.ystep);if(t>c+1e-6||e>h+1e-6)return null;const d=Math.floor((s-o)/c)+1,f=Math.ceil((s+t-n)/c)-1,g=Math.floor((i-l)/h)+1,m=Math.ceil((i+e-a)/h)-1;return f<=d&&m<=g?[d,g]:null}updatePatternDims(t,e){const s=wr.slice();j.axialAlignedBoundingBox(t,j.inverseTransform(this.patternBaseMatrix),s),e[0]=s[2]-s[0],e[1]=s[3]-s[1],e[2]=s[0],e[3]=s[1]}_renderTileCanvas(t,e,s,i){var f,g;const[n,a,o,l]=this.bbox,c=t.canvasFactory.create(s.size,i.size),h=c.context,d=this.canvasGraphicsFactory.createCanvasGraphics(h,e);return d.groupLevel=t.groupLevel,d.current.transferMapsFallback=t.current.transferMapsFallback,this.setFillAndStrokeStyleToContext(d,this.paintType,this.color),h.translate(-s.scale*n,-i.scale*a),d.transform(0,s.scale,0,0,i.scale,0,0),h.save(),(f=d.dependencyTracker)==null||f.save(),this.clipBbox(d,n,a,o,l),d.baseTransform=Ot(d.ctx),d.executeOperatorList(this.operatorList),d.endDrawing(),(g=d.dependencyTracker)==null||g.restore(),h.restore(),c}_getCombinedScales(){const t=new Float32Array(2);j.singularValueDecompose2dScale(this.matrix,t);const[e,s]=t;return j.singularValueDecompose2dScale(this.baseTransform,t),[e*t[0],s*t[1]]}drawPattern(t,e,s=!1,[i,n],a){const[o,l,c,h]=this.bbox,d=t.dependencyTracker;if(d&&(t.dependencyTracker=new pu(d,a)),t.save(),s?t.ctx.clip(e,"evenodd"):t.ctx.clip(e),t.ctx.setTransform(...this.patternBaseMatrix),t.ctx.translate(i*this.xstep,n*this.ystep),this.needsIsolation||t.ctx.globalAlpha!==1||t.ctx.globalCompositeOperation!=="source-over"||t.inSMaskMode){const f=c-o,g=h-l,[m,v]=this._getCombinedScales(),w=this.getSizeAndScale(f,this.ctx.canvas.width,m),A=this.getSizeAndScale(g,this.ctx.canvas.height,v),_=this._renderTileCanvas(t,a,w,A);t.ctx.drawImage(_.canvas,o,l,f,g),t.canvasFactory.destroy(_)}else this.setFillAndStrokeStyleToContext(t,this.paintType,this.color),this.clipBbox(t,o,l,c,h),t.baseTransformStack.push(t.baseTransform),t.baseTransform=Ot(t.ctx),t.executeOperatorList(this.operatorList),t.baseTransform=t.baseTransformStack.pop();t.restore(),d&&(t.dependencyTracker=d)}createPatternCanvas(t,e){const[s,i,n,a]=this.bbox,o=n-s,l=a-i;let{xstep:c,ystep:h}=this;c=Math.abs(c),h=Math.abs(h),vg("TilingType: "+this.tilingType);const[d,f]=this._getCombinedScales();let g=o,m=l,v=!1,w=!1;Math.ceil(c*d)>=Math.ceil(o*d)?g=c:v=!0,Math.ceil(h*f)>=Math.ceil(l*f)?m=h:w=!0;const A=this.getSizeAndScale(g,this.ctx.canvas.width,d),_=this.getSizeAndScale(m,this.ctx.canvas.height,f),E=this._renderTileCanvas(t,e,A,_);if(v||w){const S=E.canvas;v&&(g=c),w&&(m=h);const x=this.getSizeAndScale(g,this.ctx.canvas.width,d),T=this.getSizeAndScale(m,this.ctx.canvas.height,f),C=x.size,I=T.size,k=t.canvasFactory.create(C,I),M=k.context,R=v?Math.min(Math.floor(o/c),Math.ceil(S.width/C)):0,N=w?Math.min(Math.floor(l/h),Math.ceil(S.height/I)):0;let F=S,$=null;if(w){$=t.canvasFactory.create(S.width,I);const U=$.context;for(let D=N;D>=0;D--)U.drawImage(S,0,I*D,S.width,I,0,0,S.width,I);F=$.canvas}for(let U=R;U>=0;U--)M.drawImage(F,C*U,0,C,I,0,0,C,I);return $&&t.canvasFactory.destroy($),t.canvasFactory.destroy(E),{canvas:k.canvas,canvasEntry:k,scaleX:x.scale,scaleY:T.scale,offsetX:s,offsetY:i}}return{canvas:E.canvas,canvasEntry:E,scaleX:A.scale,scaleY:_.scale,offsetX:s,offsetY:i}}getSizeAndScale(t,e,s){const i=Math.max(Lp.MAX_PATTERN_SIZE,e);let n=Math.ceil(t*s);return n>=i?n=i:s=n/t,{scale:s,size:n}}clipBbox(t,e,s,i,n){const a=i-e,o=n-s,l=new Path2D;l.rect(e,s,a,o),j.axialAlignedBoundingBox([e,s,i,n],Ot(t.ctx),t.current.minMax),t.ctx.clip(l),t.current.updateClipFromPath()}setFillAndStrokeStyleToContext(t,e,s){var a;switch(e){case Hy.COLORED:s="#000000";break;case Hy.UNCOLORED:break;default:throw new uS(`Unsupported paint type: ${e}`)}const{ctx:i,current:n}=t;n.patternFill=n.patternStroke=!1,i.fillStyle=i.strokeStyle=((a=n.transferMapsFallback)==null?void 0:a.applyToColor(s))??s,n.fillColor=n.strokeColor=s}isModifyingCurrentTransform(){return!1}getPattern(t,e,s,i,n){const a=i!==Ue.SHADING?j.transform(s,this.patternBaseMatrix):s,o=this.createPatternCanvas(e,n);let l=new DOMMatrix(a);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const c=t.createPattern(o.canvas,"repeat");return e.canvasFactory.destroy(o.canvasEntry),c.setTransform(l),c}};O(Lp,"MAX_PATTERN_SIZE",3e3);let au=Lp;const nE=16,aE=100,oE=15,jy=10,Ss=16,zs=new Float32Array(2);function $y(u,t){if(u._removeMirroring)throw new Error("Context is already forwarding operations.");const e=new Map;for(const s of["save","restore","rotate","scale","translate","transform","setTransform","resetTransform","clip","moveTo","lineTo","bezierCurveTo","quadraticCurveTo","arc","arcTo","ellipse","rect","roundRect","closePath","beginPath"]){const i=u[s];typeof i!="function"||typeof t[s]!="function"||(e.set(s,i),u[s]=function(...n){return t[s](...n),i.apply(this,n)})}u._removeMirroring=()=>{for(const[s,i]of e)u[s]=i;delete u._removeMirroring}}function Af(u,t,e,s,i,n,a,o,l,c){const[h,d,f,g,m,v]=Ot(u);if(d===0&&f===0){const _=a*h+m,E=Math.round(_),S=o*g+v,x=Math.round(S),T=(a+l)*h+m,C=Math.abs(Math.round(T)-E)||1,I=(o+c)*g+v,k=Math.abs(Math.round(I)-x)||1;return u.setTransform(Math.sign(h),0,0,Math.sign(g),E,x),u.drawImage(t,e,s,i,n,0,0,C,k),u.setTransform(h,d,f,g,m,v),[C,k]}if(h===0&&g===0){const _=o*f+m,E=Math.round(_),S=a*d+v,x=Math.round(S),T=(o+c)*f+m,C=Math.abs(Math.round(T)-E)||1,I=(a+l)*d+v,k=Math.abs(Math.round(I)-x)||1;return u.setTransform(0,Math.sign(d),Math.sign(f),0,E,x),u.drawImage(t,e,s,i,n,0,0,k,C),u.setTransform(h,d,f,g,m,v),[k,C]}u.drawImage(t,e,s,i,n,a,o,l,c);const w=Math.hypot(h,d),A=Math.hypot(f,g);return[w*l,A*c]}class Gy{constructor(t,e){O(this,"alphaIsShape",!1);O(this,"fontSize",0);O(this,"fontSizeScale",1);O(this,"textMatrix",null);O(this,"textMatrixScale",1);O(this,"fontMatrix",Gg);O(this,"leading",0);O(this,"x",0);O(this,"y",0);O(this,"lineX",0);O(this,"lineY",0);O(this,"charSpacing",0);O(this,"wordSpacing",0);O(this,"textHScale",1);O(this,"textRenderingMode",be.FILL);O(this,"textRise",0);O(this,"fillColor","#000000");O(this,"strokeColor","#000000");O(this,"tilingPatternDims",null);O(this,"patternFill",!1);O(this,"patternStroke",!1);O(this,"fillAlpha",1);O(this,"strokeAlpha",1);O(this,"lineWidth",1);O(this,"activeSMask",null);O(this,"transferMaps","none");O(this,"transferMapsFallback",null);O(this,"minMax",$a.slice());this.clipBox=new Float32Array([0,0,t,e])}clone(){var e;const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t.tilingPatternDims=(e=this.tilingPatternDims)==null?void 0:e.slice(),t}getPathBoundingBox(t=Ue.FILL,e=null){const s=this.minMax.slice();if(t===Ue.STROKE){e||vt("Stroke bounding box must include transform."),j.singularValueDecompose2dScale(e,zs);const i=zs[0]*this.lineWidth/2,n=zs[1]*this.lineWidth/2;s[0]-=i,s[1]-=n,s[2]+=i,s[3]+=n}return s}updateClipFromPath(){const t=j.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set($a,0)}getClippedPathBoundingBox(t=Ue.FILL,e=null){return j.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function zy(u,t){const{width:e,height:s,kind:i}=t,n=s%Ss,a=(s-n)/Ss,o=n===0?a:a+1,l=u.createImageData(e,Ss);let c=0;const h=t.data,d=l.data;let f;if(i===iu.GRAYSCALE_1BPP)for(f=0;f<o;f++)({srcPos:c}=Lw({src:h,srcPos:c,dest:d,width:e,height:f<a?Ss:n})),u.putImageData(l,0,f*Ss);else if(i===iu.RGBA_32BPP){let g=0,m=e*Ss*4;for(f=0;f<a;f++)d.set(h.subarray(c,c+m)),c+=m,u.putImageData(l,0,g),g+=Ss;f<o&&(m=e*n*4,d.set(h.subarray(c,c+m)),u.putImageData(l,0,g))}else if(i===iu.RGB_24BPP)for(f=0;f<o;f++)({srcPos:c}=XS({src:h,srcPos:c,dest:new Uint32Array(d.buffer),width:e,height:f<a?Ss:n})),u.putImageData(l,0,f*Ss);else throw new Error(`bad image kind: ${i}`)}function Vy(u,t){if(t.bitmap){u.drawImage(t.bitmap,0,0);return}const{width:e,height:s}=t,i=s%Ss,n=(s-i)/Ss,a=i===0?n:n+1,o=u.createImageData(e,Ss);let l=0;const c=t.data,h=o.data;for(let d=0;d<a;d++)({srcPos:l}=Lw({src:c,srcPos:l,dest:h,width:e,height:d<n?Ss:i,nonBlackColor:0})),u.putImageData(o,0,d*Ss)}function Oa(u,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of e)u[s]!==void 0&&(t[s]=u[s]);u.setLineDash!==void 0&&(t.setLineDash(u.getLineDash()),t.lineDashOffset=u.lineDashOffset)}function _f(u){u.strokeStyle=u.fillStyle="#000000",u.fillRule="nonzero",u.globalAlpha=1,u.lineWidth=1,u.lineCap="butt",u.lineJoin="miter",u.miterLimit=10,u.globalCompositeOperation="source-over",u.font="10px sans-serif",u.setLineDash!==void 0&&(u.setLineDash([]),u.lineDashOffset=0);const{filter:t}=u;t!=="none"&&t!==""&&(u.filter="none")}var Ec;const dy=class dy{constructor(t){y(this,Ec);const[e,s=e,i=e]=t,{identityMap:n}=dy;p(this,Ec,[e||n,s||n,i||n])}static get identityMap(){return V(this,"identityMap",Uint8Array.from({length:256},(t,e)=>e))}applyToColor(t){if(typeof t!="string"||!t.startsWith("#"))return t;const[e,s,i]=Il(t),[n,a,o]=r(this,Ec);return j.makeHexColor(n[e],a[s],o[i])}applyToImageData({data:t}){const[e,s,i]=r(this,Ec);for(let n=0,a=t.length;n<a;n+=4)t[n]=e[t[n]],t[n+1]=s[t[n+1]],t[n+2]=i[t[n+2]]}applyToCanvas(t){const{width:e,height:s}=t.canvas,i=t.getImageData(0,0,e,s);this.applyToImageData(i),t.putImageData(i,0,0)}};Ec=new WeakMap;let Tm=dy;function Wy(u,t){if(t)return!0;j.singularValueDecompose2dScale(u,zs);const e=Math.fround(Ws.pixelRatio*vn.PDF_TO_CSS_UNITS);return zs[0]<=e&&zs[1]<=e}const lE=["butt","round","square"],cE=["miter","round","bevel"],hE={},Xy={};var Np,ks,ea,Eo,xo,To,Co,Po,Io,ko,nr,q,Cm,Pm,Im,km,Mm,ps,Ge,Om,Yh,Bw,Bf;const Ua=class Ua{constructor(t,e,s,i,n,{optionalContentConfig:a,markedContentStack:o=null},l,c,h,d){y(this,q);y(this,ks,0);y(this,ea,0);y(this,Eo,null);y(this,xo,null);y(this,To,null);y(this,Co,null);y(this,Po,1);y(this,Io);y(this,ko,null);y(this,nr,[]);this.ctx=t,this.current=new Gy(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=e,this.objs=s,this.canvasFactory=i,this.filterFactory=n,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.tempSMask=null,this.smaskGroupCanvases=[],this.smaskPreparedEntry=null,this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedBitmapsMap=new Map,this.dependencyTracker=h??null,this.imagesTracker=d??null}getObject(t,e,s=null){var i;return typeof e=="string"?((i=this.dependencyTracker)==null||i.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):s}beginDrawing({transform:t,viewport:e,transparency:s=!1,background:i=null}){const n=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,n,a),this.ctx.fillStyle=o,s){const l=this.transparentCanvasEntry=this.canvasFactory.create(n,a);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=l,this.ctx.save(),this.ctx.transform(...Ot(this.compositeCtx))}this.ctx.save(),_f(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[3]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=Ot(this.ctx)}executeOperatorList(t,e,s,i,n){var A;const a=t.argsArray,o=t.fnArray;let l=e||0;const c=a.length;if(c===l)return l;const h=c-l>jy&&typeof s=="function",d=h?Date.now()+oE:0;let f=0;const g=this.commonObjs,m=this.objs;let v,w;for(;;){if(i!==void 0){if(l===i.nextBreakPoint)return i.breakIt(l,s),l;if(i.shouldSkip(l)){if(++l===c)return l;continue}}if(!n||n(l,t))if(v=o[l],w=a[l]??null,v!==Li.dependency)w===null?this[v](l):this[v](l,...w);else for(const _ of w){(A=this.dependencyTracker)==null||A.recordNamedData(_,l);const E=_.startsWith("g_")?g:m;if(!E.has(_))return E.get(_,s),l}if(l++,l===c)return l;if(h&&++f>jy){if(Date.now()>d)return s(),l;f=0}}}endDrawing(){b(this,q,Cm).call(this);for(const t of this.smaskGroupCanvases)this.canvasFactory.destroy(t);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(const t of r(this,nr))b(this,q,Bf).call(this,t);r(this,nr).length=0,p(this,Eo,null),p(this,xo,null),p(this,To,null),p(this,Co,null),p(this,Po,1),p(this,ko,null),p(this,ea,0),p(this,ks,0),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),b(this,q,Pm).call(this)}_scaleImage(t,e){const s=t.width??t.displayWidth,i=t.height??t.displayHeight,n=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),o=[];let l=n,c=a,h=s,d=i;for(;l>2&&h>1||c>2&&d>1;){let A=h,_=d;l>2&&h>1&&(A=Math.ceil(h/2),l/=h/A),c>2&&d>1&&(_=Math.ceil(d/2),c/=d/_),o.push({newWidth:A,newHeight:_}),h=A,d=_}if(o.length===0)return{img:t,paintWidth:s,paintHeight:i,tmpCanvas:null};if(o.length===1){const{newWidth:A,newHeight:_}=o[0],E=this.canvasFactory.create(A,_);return E.context.drawImage(t,0,0,s,i,0,0,A,_),{img:E.canvas,paintWidth:A,paintHeight:_,tmpCanvas:E}}let f=this.canvasFactory.create(1,1),g=this.canvasFactory.create(1,1),m=s,v=i,w=t;for(const{newWidth:A,newHeight:_}of o)this.canvasFactory.reset(g,A,_),g.context.drawImage(w,0,0,m,v,0,0,A,_),[f,g]=[g,f],w=f.canvas,m=A,v=_;return this.canvasFactory.destroy(g),{img:f.canvas,paintWidth:m,paintHeight:v,tmpCanvas:f}}_createMaskCanvas(t,e){var R,N;const s=this.ctx,{width:i,height:n}=e,a=this.current.patternFill,o=a?this.current.fillColor:s.fillStyle,l=Ot(s);let c,h,d,f;if((e.bitmap||e.data)&&e.count>1){const F=e.bitmap||e.data.buffer;h=JSON.stringify(a?l:[l.slice(0,4),o]),c=this._cachedBitmapsMap.getOrInsertComputed(F,bg);const $=c.get(h);if($&&!a){const U=Math.round(Math.min(l[0],l[2])+l[4]),D=Math.round(Math.min(l[1],l[3])+l[5]);return(R=this.dependencyTracker)==null||R.recordDependencies(t,qs.transformAndFill),{canvas:$,offsetX:U,offsetY:D}}d=$}d||(f=this.canvasFactory.create(i,n),Vy(f.context,e));let g=j.transform(l,[1/i,0,0,-1/n,0,0]);g=j.transform(g,[1,0,0,1,0,-n]);const m=$a.slice();j.axialAlignedBoundingBox([0,0,i,n],g,m);const[v,w,A,_]=m,E=Math.round(A-v)||1,S=Math.round(_-w)||1,x=this.canvasFactory.create(E,S),T=x.context,C=v,I=w;T.translate(-C,-I),T.transform(...g);let k=null;if(!d){const F=this._scaleImage(f.canvas,ji(T));d=F.img,k=F.tmpCanvas,d!==f.canvas&&(this.canvasFactory.destroy(f),f=null),c&&a&&(c.set(h,d),k=null,f=null)}T.imageSmoothingEnabled=Wy(Ot(T),e.interpolate),Af(T,d,0,0,d.width,d.height,0,0,i,n),k&&this.canvasFactory.destroy(k),f&&this.canvasFactory.destroy(f),T.globalCompositeOperation="source-in";const M=j.transform(ji(T),[1,0,0,1,-C,-I]);return T.fillStyle=a?o.getPattern(s,this,M,Ue.FILL,t):o,T.fillRect(0,0,i,n),c&&!a&&c.set(h,x.canvas),(N=this.dependencyTracker)==null||N.recordDependencies(t,qs.transformAndFill),{canvas:x.canvas,canvasEntry:c&&!a?null:x,offsetX:Math.round(C),offsetY:Math.round(I)}}setLineWidth(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineCap",t),this.ctx.lineCap=lE[e]}setLineJoin(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineJoin",t),this.ctx.lineJoin=cE[e]}setMiterLimit(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,s){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("dash",t);const i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(e),i.lineDashOffset=s)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){var s,i,n,a,o;for(const[l,c]of e)switch(l){case"LW":this.setLineWidth(t,c);break;case"LC":this.setLineCap(t,c);break;case"LJ":this.setLineJoin(t,c);break;case"ML":this.setMiterLimit(t,c);break;case"D":this.setDash(t,c[0],c[1]);break;case"RI":this.setRenderingIntent(t,c);break;case"FL":this.setFlatness(t,c);break;case"Font":this.setFont(t,c[0],c[1]);break;case"CA":(s=this.dependencyTracker)==null||s.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=c;break;case"ca":(i=this.dependencyTracker)==null||i.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=c;break;case"BM":(n=this.dependencyTracker)==null||n.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=c;break;case"SMask":(a=this.dependencyTracker)==null||a.recordSimpleData("SMask",t),this.current.activeSMask=c?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(t);break;case"TR":{(o=this.dependencyTracker)==null||o.recordSimpleData("filter",t);let h=this.filterFactory.addFilter(c);this.ctx.filter=h;let d=null;c&&(h==="none"||!_t.isCanvasFilterSupported||this.ctx.filter==="none"||this.ctx.filter==="")&&(this.ctx.filter=h="none",d=new Tm(c)),this.current.transferMaps=h,(d||this.current.transferMapsFallback)&&(this.current.transferMapsFallback=d,this.current.patternFill||(this.ctx.fillStyle=b(this,q,Yh).call(this,this.current.fillColor)),this.current.patternStroke||(this.ctx.strokeStyle=b(this,q,Yh).call(this,this.current.strokeColor)));break}}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&(this.canvasFactory.destroy(this.smaskPreparedEntry),this.smaskPreparedEntry=null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(t){t!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(t))}checkSMaskState(t){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode(t):!this.current.activeSMask&&e?this.endSMaskMode():this.current.activeSMask&&e&&this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(t){const{canvas:e,subtype:s,backdrop:i,transferMap:n}=t,a=s==="Luminosity"||s==="Alpha"&&n;if(!a&&!(s==="Luminosity"&&i)){this.smaskPreparedFor=t;return}let o;if(s==="Luminosity"&&i){const[_,E,S]=Il(i),x=Math.round(.3*_+.59*E+.11*S);o=(n==null?void 0:n[x])??x}else o=(n==null?void 0:n[0])??0;const l=4,{width:c,height:h}=this.ctx.canvas,d=e.width*e.height,f=c*h<l*d,g=a?{url:s==="Alpha"?this.filterFactory.addAlphaFilter(n):this.filterFactory.addLuminosityFilter(n),subtype:s,transferMap:n}:null,m=s==="Luminosity"?i:null;let v,w,A;f?(v=this._bakeSMaskCanvas(e,t.offsetX,t.offsetY,c,h,m,g),w=0,A=0):(v=this._bakeSMaskCanvas(e,0,0,e.width,e.height,m,g),w=t.offsetX,A=t.offsetY),this.smaskPreparedEntry=v,this.smaskPreparedFor=t,this.smaskPreparedOffsetX=w,this.smaskPreparedOffsetY=A,this.smaskPreparedOOBAlpha=!f&&o!==0?o:null}_bakeSMaskCanvas(t,e,s,i,n,a,o){!a&&!o&&vt("_bakeSMaskCanvas with neither backdrop nor filter");const l=this.canvasFactory.create(i,n),c=l.context;if(c.drawImage(t,e,s),a&&(c.globalCompositeOperation="destination-atop",c.fillStyle=a,c.fillRect(0,0,i,n)),!o)return l;const h=this.canvasFactory.create(i,n),d=h.context;d.filter=o.url;const f=_t.isCanvasFilterSupported&&d.filter!=="none"&&d.filter!=="";if(d.drawImage(l.canvas,0,0),_t.isCanvasFilterSupported&&(d.filter="none"),!f){const g=d.getImageData(0,0,i,n),{data:m}=g,{transferMap:v}=o;if(o.subtype==="Luminosity")for(let w=0,A=m.length;w<A;w+=4){const _=.3*m[w]+.59*m[w+1]+.11*m[w+2]+.5|0;m[w]=m[w+1]=m[w+2]=0,m[w+3]=(v==null?void 0:v[_])??_}else for(let w=3,A=m.length;w<A;w+=4)m[w]=v[m[w]];d.putImageData(g,0,0)}return this.canvasFactory.destroy(l),h}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const{width:e,height:s}=this.ctx.canvas,i=this.canvasFactory.create(e,s);this.smaskScratchCanvas=i,this.suspendedCtx=this.ctx;const n=this.ctx=i.context;n.setTransform(this.suspendedCtx.getTransform()),Oa(this.suspendedCtx,n),$y(n,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Oa(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}compose(t){if(!this.current.activeSMask)return;t=t?[Math.floor(t[0]),Math.floor(t[1]),Math.ceil(t[2]),Math.ceil(t[3])]:[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,s=this.suspendedCtx,i=r(this,ea)>0&&s===this.ctx;this.composeSMask(i?null:s,e,this.ctx,t),!i&&(this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore())}composeSMask(t,e,s,i){const n=i[0],a=i[1],o=i[2]-n,l=i[3]-a;if(o===0||l===0)return;const c=this.smaskPreparedEntry;if(c){let h=n,d=a,f=o,g=l;const m=this.smaskPreparedOOBAlpha,v=m!==null;if(v){h=Math.max(n,e.offsetX),d=Math.max(a,e.offsetY);const w=Math.min(n+o,e.offsetX+e.canvas.width),A=Math.min(a+l,e.offsetY+e.canvas.height);f=w-h,g=A-d}if(f>0&&g>0){const w=h-this.smaskPreparedOffsetX,A=d-this.smaskPreparedOffsetY;s.save(),s.globalAlpha=1,s.setTransform(1,0,0,1,0,0);const _=new Path2D;_.rect(h,d,f,g),s.clip(_),s.globalCompositeOperation="destination-in",s.drawImage(c.canvas,w,A,f,g,h,d,f,g),s.restore()}v&&m<255&&this._applySMaskOOBAlpha(s,n,a,o,l,h,d,h+f,d+g,m)}else this.genericComposeSMask(e,s,o,l,n,a);t&&(t.save(),t.globalAlpha=1,t.globalCompositeOperation=e.blendMode||"source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(s.canvas,n,a,o,l,n,a,o,l),t.restore())}_applySMaskOOBAlpha(t,e,s,i,n,a,o,l,c,h){const d=a<l&&o<c;if(d&&a===e&&o===s&&l===e+i&&c===s+n)return;const f=new Path2D;f.rect(e,s,i,n),d&&f.rect(a,o,l-a,c-o),t.save(),t.globalAlpha=h/255,t.setTransform(1,0,0,1,0,0),t.clip(f,"evenodd"),t.globalCompositeOperation="destination-in",t.fillStyle="#000000",t.fillRect(e,s,i,n),t.restore()}genericComposeSMask(t,e,s,i,n,a){const{context:o,offsetX:l,offsetY:c}=t;e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const h=new Path2D;h.rect(n,a,s,i),e.clip(h),e.globalCompositeOperation="destination-in",e.drawImage(o.canvas,n-l,a-c,s,i,n,a,s,i),e.restore()}save(t){var s;this.inSMaskMode&&Oa(this.ctx,this.suspendedCtx),this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone(),(s=this.dependencyTracker)==null||s.save(t)}restore(t){var e;if((e=this.dependencyTracker)==null||e.restore(t),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&(Oa(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform())),this.checkSMaskState(t),this.pendingClip=null,this._cachedScaleForStroking[0]=-1}transform(t,e,s,i,n,a,o){var l;(l=this.dependencyTracker)==null||l.recordIncrementalData("transform",t),this.ctx.transform(e,s,i,n,a,o),this._cachedScaleForStroking[0]=-1}constructPath(t,e,s,i){let[n]=s;if(!i){n||(n=s[0]=new Path2D),e!==Li.stroke&&e!==Li.closeStroke&&(this.current.tilingPatternDims=null),this[e](t,n);return}if(this.dependencyTracker!==null){const o=e===Li.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,i[0]-o,i[2]+o,i[1]-o,i[3]+o).recordDependencies(t,["transform"])}n instanceof Path2D||(n=s[0]=jb(n)),j.axialAlignedBoundingBox(i,Ot(this.ctx),this.current.minMax);const a=this.current.tilingPatternDims;if(a&&e!==Li.stroke&&e!==Li.closeStroke&&this.current.fillColor instanceof au){const o=j.intersect(this.current.clipBox,this.current.minMax);o?this.current.fillColor.updatePatternDims(o,a):this.current.tilingPatternDims=null}this[e](t,n),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,s=!0){var o;const i=s&&b(this,q,ps).call(this,this.current.strokeAlpha),n=this.ctx,a=this.current.strokeColor;if(n.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof a=="object"&&(a!=null&&a.getPattern)){const l=a.isModifyingCurrentTransform()?n.getTransform():null;if(n.save(),n.strokeStyle=a.getPattern(n,this,ji(n),Ue.STROKE,t),l){const c=new Path2D;c.addPath(e,n.getTransform().invertSelf().multiplySelf(l)),e=c}this.rescaleAndStroke(e,!1),n.restore()}else this.rescaleAndStroke(e,!0);(o=this.dependencyTracker)==null||o.recordDependencies(t,qs.stroke),s&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(Ue.STROKE,Ot(this.ctx))),n.globalAlpha=this.current.fillAlpha,b(this,q,Ge).call(this,i)}closeStroke(t,e){this.stroke(t,e)}fill(t,e,s=!0){var h,d,f;const i=s&&b(this,q,ps).call(this,this.current.fillAlpha),n=this.ctx,a=this.current.fillColor,o=this.current.patternFill;let l=!1;const c=this.current.getClippedPathBoundingBox();if((h=this.dependencyTracker)==null||h.recordDependencies(t,qs.fill),o){const g=this.current.tilingPatternDims,m=g&&a.canSkipPatternCanvas(g);if(m){a.drawPattern(this,e,this.pendingEOFill,m,t),this.pendingEOFill=!1,s&&this.consumePath(t,e,c),this.current.tilingPatternDims=null,b(this,q,Ge).call(this,i);return}const v=a.isModifyingCurrentTransform()?n.getTransform():null;if((d=this.dependencyTracker)==null||d.save(t),n.save(),n.fillStyle=a.getPattern(n,this,ji(n),Ue.FILL,t),v){const w=new Path2D;w.addPath(e,n.getTransform().invertSelf().multiplySelf(v)),e=w}l=!0}this.contentVisible&&c!==null&&(this.pendingEOFill?(n.fill(e,"evenodd"),this.pendingEOFill=!1):n.fill(e)),l&&(n.restore(),(f=this.dependencyTracker)==null||f.restore(t)),s&&this.consumePath(t,e,c),b(this,q,Ge).call(this,i)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){const s=b(this,q,ps).call(this,Math.min(this.current.fillAlpha,this.current.strokeAlpha));this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e),b(this,q,Ge).call(this,s)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){var i;const s=b(this,q,ps).call(this,this.current.fillAlpha);this.ctx.fill(e),(i=this.dependencyTracker)==null||i.recordDependencies(t,qs.rawFillPath).recordOperation(t),b(this,q,Ge).call(this,s)}clip(t){var e;(e=this.dependencyTracker)==null||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=hE}eoClip(t){var e;(e=this.dependencyTracker)==null||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=Xy}beginText(t){var e;this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,(e=this.dependencyTracker)==null||e.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){const e=this.pendingTextPaths,s=this.ctx;if(this.dependencyTracker){const{dependencyTracker:i}=this;e!==void 0&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",t),i.recordCloseMarker(t)}if(e!==void 0){const i=new Path2D,n=s.getTransform().invertSelf();for(const{transform:a,x:o,y:l,fontSize:c,path:h}of e)h&&i.addPath(h,new DOMMatrix(a).preMultiplySelf(n).translate(o,l).scale(c,-c));s.clip(i)}delete this.pendingTextPaths}setCharSpacing(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,s){var d,f;(d=this.dependencyTracker)==null||d.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);const i=this.commonObjs.get(e),n=this.current;if(!i)throw new Error(`Can't find font for ${e}`);if(n.fontMatrix=i.fontMatrix||Gg,(n.fontMatrix[0]===0||n.fontMatrix[3]===0)&&st("Invalid font matrix for font "+e),s<0?(s=-s,n.fontDirection=-1):n.fontDirection=1,this.current.font=i,this.current.fontSize=s,i.isType3Font)return;const a=i.loadedName||"sans-serif",o=((f=i.systemFontInfo)==null?void 0:f.css)||`"${a}", ${i.fallbackName}`;let l="normal";i.black?l="900":i.bold&&(l="bold");const c=i.italic?"italic":"normal",h=Nt(s,nE,aE);this.current.fontSizeScale=s/h,this.ctx.font=`${c} ${l} ${h}px ${o}`}setTextRenderingMode(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,s){var i;(i=this.dependencyTracker)==null||i.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=s}setLeadingMoveText(t,e,s){this.setLeading(t,-s),this.moveText(t,e,s)}setTextMatrix(t,e){var i;(i=this.dependencyTracker)==null||i.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",t);const{current:s}=this;s.textMatrix=e,s.textMatrixScale=Math.hypot(e[0],e[1]),s.x=s.lineX=0,s.y=s.lineY=0}nextLine(t){var e;this.moveText(t,0,this.current.leading),(e=this.dependencyTracker)==null||e.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??t)}paintChar(t,e,s,i,n,a){var A,_,E,S;const o=this.ctx,l=this.current,c=l.font,h=l.textRenderingMode,d=l.fontSize/l.fontSizeScale,f=h&be.FILL_STROKE_MASK,g=!!(h&be.ADD_TO_PATH_FLAG),m=l.patternFill&&!c.missingFile,v=l.patternStroke&&!c.missingFile;let w;if((c.disableFontFace||g||m||v)&&!c.missingFile&&(w=c.getPathGenerator(this.commonObjs,e)),w&&(c.disableFontFace||m||v)){o.save(),o.translate(s,i),o.scale(d,-d),(A=this.dependencyTracker)==null||A.recordCharacterBBox(t,o,c);let x;if(f===be.FILL||f===be.FILL_STROKE)if(n){x=o.getTransform(),o.setTransform(...n);const T=b(this,q,Om).call(this,w,x,n);o.fill(T)}else o.fill(w);if(f===be.STROKE||f===be.FILL_STROKE)if(a){x||(x=o.getTransform()),o.setTransform(...a);const{a:T,b:C,c:I,d:k}=x,M=j.inverseTransform(a),R=j.transform([T,C,I,k,0,0],M);j.singularValueDecompose2dScale(R,zs),o.lineWidth*=Math.max(zs[0],zs[1])/d,o.stroke(b(this,q,Om).call(this,w,x,a))}else o.lineWidth/=d,o.stroke(w);o.restore()}else(f===be.FILL||f===be.FILL_STROKE)&&(o.fillText(e,s,i),(_=this.dependencyTracker)==null||_.recordCharacterBBox(t,o,c,d,s,i,()=>o.measureText(e))),(f===be.STROKE||f===be.FILL_STROKE)&&(this.dependencyTracker&&((E=this.dependencyTracker)==null||E.recordCharacterBBox(t,o,c,d,s,i,()=>o.measureText(e)).recordDependencies(t,qs.stroke)),o.strokeText(e,s,i));g&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Ot(o),x:s,y:i,fontSize:d,path:w}),(S=this.dependencyTracker)==null||S.recordCharacterBBox(t,o,c,d,s,i))}get isFontSubpixelAAEnabled(){const t=this.canvasFactory.create(10,10),e=t.context;e.scale(1.5,1),e.fillText("I",0,10);const s=e.getImageData(0,0,10,10).data;this.canvasFactory.destroy(t);let i=!1;for(let n=3;n<s.length;n+=4)if(s[n]>0&&s[n]<255){i=!0;break}return V(this,"isFontSubpixelAAEnabled",i)}showText(t,e){var R,N,F,$;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,qs.showText).resetBBox(t),this.current.textRenderingMode&be.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());const s=this.current,i=s.font;if(i.isType3Font){const U=b(this,q,ps).call(this,s.fillAlpha);this.showType3Text(t,e),(R=this.dependencyTracker)==null||R.recordShowTextOperation(t),b(this,q,Ge).call(this,U);return}const n=s.fontSize;if(n===0){(N=this.dependencyTracker)==null||N.recordOperation(t);return}const a=b(this,q,ps).call(this,s.fillAlpha),o=this.ctx,l=s.fontSizeScale,c=s.charSpacing,h=s.wordSpacing,d=s.fontDirection,f=s.textHScale*d,g=e.length,m=i.vertical,v=m?1:-1,w=n*s.fontMatrix[0],A=s.textRenderingMode===be.FILL&&!i.disableFontFace&&!s.patternFill;o.save(),s.textMatrix&&o.transform(...s.textMatrix),o.translate(s.x,s.y+s.textRise),d>0?o.scale(f,-1):o.scale(f,1);let _,E;const S=s.textRenderingMode&be.FILL_STROKE_MASK,x=S===be.FILL||S===be.FILL_STROKE,T=S===be.STROKE||S===be.FILL_STROKE;let C=s.lineWidth;const I=s.textMatrixScale;if(I===0||C===0?T&&(C=this.getSinglePixelWidth()):C/=I,l!==1&&(o.scale(l,l),C/=l),o.lineWidth=C,x&&s.patternFill){o.save();const U=s.fillColor.getPattern(o,this,ji(o),Ue.FILL,t);_=Ot(o),o.restore(),o.fillStyle=U}if(T&&s.patternStroke){o.save();const U=s.strokeColor.getPattern(o,this,ji(o),Ue.STROKE,t);E=Ot(o),o.restore(),o.strokeStyle=U}if(i.isInvalidPDFjsFont){const U=[];let D=0;for(const X of e)U.push(X.unicode),D+=X.width;const H=U.join("");if(o.fillText(H,0,0),this.dependencyTracker!==null){const X=o.measureText(H);this.dependencyTracker.recordBBox(t,this.ctx,-X.actualBoundingBoxLeft,X.actualBoundingBoxRight,-X.actualBoundingBoxAscent,X.actualBoundingBoxDescent).recordShowTextOperation(t)}s.x+=D*w*f,o.restore(),this.compose(),b(this,q,Ge).call(this,a);return}let k=0,M;for(M=0;M<g;++M){const U=e[M];if(typeof U=="number"){k+=v*U*n/1e3;continue}let D=!1;const H=(U.isSpace?h:0)+c,X=U.fontChar,nt=U.accent;let gt,mt,ht=U.width;if(m){const G=U.vmetric,L=-G[1]*w,B=G[2]*w;ht=-G[0],gt=L/l,mt=(k+B)/l}else gt=k/l,mt=0;let at;if(i.remeasure&&ht>0){at=o.measureText(X);const G=at.width*1e3/n*l;if(ht<G&&this.isFontSubpixelAAEnabled){const L=ht/G;D=!0,o.save(),o.scale(L,1),gt/=L}else ht!==G&&(gt+=(ht-G)/2e3*n/l)}if(this.contentVisible&&(U.isInFont||i.missingFile)){if(A&&!nt)o.fillText(X,gt,mt),(F=this.dependencyTracker)==null||F.recordCharacterBBox(t,o,at?{bbox:null}:i,n/l,gt,mt,()=>at??o.measureText(X));else if(this.paintChar(t,X,gt,mt,_,E),nt){const G=gt+n*nt.offset.x/l,L=mt-n*nt.offset.y/l;this.paintChar(t,nt.fontChar,G,L,_,E)}}const Ee=m?ht*w-H*d:ht*w+H*d;k+=Ee,D&&o.restore()}m?s.y-=k:s.x+=k*f,o.restore(),this.compose(),($=this.dependencyTracker)==null||$.recordShowTextOperation(t),b(this,q,Ge).call(this,a)}showType3Text(t,e){const s=this.ctx,i=this.current,n=i.font,a=i.fontSize,o=i.fontDirection,l=n.vertical?1:-1,c=i.charSpacing,h=i.wordSpacing,d=i.textHScale*o,f=i.fontMatrix||Gg,g=e.length,m=i.textRenderingMode===be.INVISIBLE;let v,w,A,_;if(m||a===0)return;this._cachedScaleForStroking[0]=-1,s.save(),i.textMatrix&&s.transform(...i.textMatrix),s.translate(i.x,i.y+i.textRise),s.scale(d,o);const E=this.dependencyTracker;for(this.dependencyTracker=E?new pu(E,t):null,v=0;v<g;++v){if(w=e[v],typeof w=="number"){_=l*w*a/1e3,this.ctx.translate(_,0),i.x+=_*d;continue}const S=(w.isSpace?h:0)+c,x=n.charProcOperatorList.get(w.operatorListId);x?this.contentVisible&&(this.save(),x.fnArray[0]===Li.setCharWidth&&(i.fillAlpha=i.strokeAlpha=1,s.globalAlpha=1),s.scale(a,a),s.transform(...f),this.executeOperatorList(x),this.restore()):st(`Type3 character "${w.operatorListId}" is not available.`);const T=[w.width,0];j.applyTransform(T,f),A=T[0]*a+S,s.translate(A,0),i.x+=A*d}s.restore(),E&&(this.dependencyTracker=E)}setCharWidth(t,e,s){}setCharWidthAndBounds(t,e,s,i,n,a,o){var c;const l=new Path2D;l.rect(i,n,a-i,o-n),this.ctx.clip(l),(c=this.dependencyTracker)==null||c.recordBBox(t,this.ctx,i,a,n,o).recordClipBox(t,this.ctx,i,a,n,o),this.endPath(t)}getColorN_Pattern(t,e){let s;if(e[0]==="TilingPattern"){const i=this.baseTransform||Ot(this.ctx),n={createCanvasGraphics:(a,o)=>new Ua(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new pu(this.dependencyTracker,o,!0):null)};s=new au(e,this.ctx,n,i)}else s=this._getPattern(t,e[1],e[2]);return s}setStrokeColorN(t,...e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("strokeColor",t),this.current.strokeColor=this.getColorN_Pattern(t,e),this.current.patternStroke=!0}setFillColorN(t,...e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("fillColor",t);const s=this.current.fillColor=this.getColorN_Pattern(t,e);this.current.patternFill=!0,this.current.tilingPatternDims=s instanceof au?[0,0,0,0]:null}setStrokeRGBColor(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("strokeColor",t),this.current.strokeColor=e,this.ctx.strokeStyle=b(this,q,Yh).call(this,e),this.current.patternStroke=!1}setStrokeTransparent(t){var e;(e=this.dependencyTracker)==null||e.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("fillColor",t),this.current.fillColor=e,this.ctx.fillStyle=b(this,q,Yh).call(this,e),this.current.patternFill=!1,this.current.tilingPatternDims=null}setFillTransparent(t){var e;(e=this.dependencyTracker)==null||e.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(t,e,s=null){const i=this.cachedPatterns.getOrInsertComputed(e,()=>rE(this.getObject(t,e)));return s&&(i.matrix=s),i}shadingFill(t,e){var o;if(!this.contentVisible)return;const s=b(this,q,ps).call(this,this.current.fillAlpha),i=this.ctx;this.save(t);const n=this._getPattern(t,e);i.fillStyle=n.getPattern(i,this,ji(i),Ue.SHADING,t);const a=ji(i);if(a){const{width:l,height:c}=i.canvas,h=$a.slice();j.axialAlignedBoundingBox([0,0,l,c],a,h);const[d,f,g,m]=h;this.ctx.fillRect(d,f,g-d,m-f)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);(o=this.dependencyTracker)==null||o.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,qs.transform).recordDependencies(t,qs.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t),b(this,q,Ge).call(this,s)}beginInlineImage(){vt("Should not call beginInlineImage")}beginImageData(){vt("Should not call beginImageData")}paintFormXObjectBegin(t,e,s){var i;if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=Ot(this.ctx),s)){j.axialAlignedBoundingBox(s,this.baseTransform,this.current.minMax);const[n,a,o,l]=s,c=new Path2D;c.rect(n,a,o-n,l-a),this.ctx.clip(c),(i=this.dependencyTracker)==null||i.recordClipBox(t,this.ctx,n,o,a,l),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){var S;if(!this.contentVisible)return;this.save(t);const{inSMaskMode:s}=this;s&&(this.endSMaskMode(),this.current.activeSMask=null);const i=this.ctx;if((!e.needsIsolation||!e.isolated&&!e.hasSoftMask)&&!e.knockout&&!e.isGray&&r(this,ks)===0&&i.globalAlpha===1&&i.globalCompositeOperation==="source-over"&&!s){if(e.bbox){let x=new Path2D;const[T,C,I,k]=e.bbox;if(x.rect(T,C,I-T,k-C),e.matrix){const M=new Path2D;M.addPath(x,new DOMMatrix(e.matrix)),x=M}i.clip(x)}this.groupStack.push(null),r(this,nr).push(null),this.groupLevel++;return}!e.isolated&&!e.knockout&&r(this,ks)===0&&vg("TODO: Fully support non-isolated non-knockout groups.");const n=Ot(i);e.matrix&&i.transform(...e.matrix);const a=[0,0,i.canvas.width,i.canvas.height];let o;e.bbox?(o=$a.slice(),j.axialAlignedBoundingBox(e.bbox,Ot(i),o),o=j.intersect(o,a)||[0,0,0,0]):o=a;const l=Math.floor(o[0]),c=Math.floor(o[1]),h=Math.max(Math.ceil(o[2])-l,1),d=Math.max(Math.ceil(o[3])-c,1);this.current.startNewPathAndClipBox([0,0,h,d]);const f=this.canvasFactory.create(h,d);e.smask&&this.smaskGroupCanvases.push(f);const g=f.context,m=e.knockout&&!e.isolated?i:null,v=!e.isolated&&!e.knockout&&!e.smask&&e.needsIsolation&&r(this,ks)>0,w=e.knockout?this.canvasFactory.create(h,d):null,A=r(this,ks);e.knockout?Ft(this,ks)._++:p(this,ks,0),g.translate(-l,-c),g.transform(...n);const _=!e.isolated&&!e.smask&&e.needsIsolation,E=_&&!s&&A===0&&!e.knockout&&!e.isGray&&e.hasSoftMask&&i.globalAlpha===1&&i.globalCompositeOperation==="source-over"&&this.current.transferMaps==="none"&&!this.current.transferMapsFallback;if(_&&(s||E)&&(g.save(),g.setTransform(1,0,0,1,0,0),g.drawImage(i.canvas,-l,-c),g.restore()),e.bbox){let x=new Path2D;const[T,C,I,k]=e.bbox;if(x.rect(T,C,I-T,k-C),e.matrix){const M=new Path2D;M.addPath(x,new DOMMatrix(e.matrix)),x=M}g.clip(x)}e.smask&&this.smaskStack.push({canvas:f.canvas,context:g,offsetX:l,offsetY:c,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null}),(!e.smask||this.dependencyTracker)&&(i.setTransform(1,0,0,1,0,0),i.translate(l,c),i.save()),Oa(i,g),this.ctx=g,(S=this.dependencyTracker)==null||S.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(i),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(i),r(this,nr).push({backdropCtx:m,savedKnockoutLevel:A,offsetX:l,offsetY:c,hasInnerBackdrop:v,replaceBackdrop:E,knockoutMaskEntry:w,knockoutTempEntry:null,knockoutBackdropEntry:null}),this.groupLevel++}endGroup(t,e){var a,o;if(!this.contentVisible)return;this.groupLevel--;const s=this.ctx,i=this.groupStack.pop(),n=r(this,nr).pop();if(n&&p(this,ks,n.savedKnockoutLevel),i===null){this.restore(t);return}if(e.isGray&&b(this,q,Bw).call(this,s),this.ctx=i,this.ctx.imageSmoothingEnabled=!1,(a=this.dependencyTracker)==null||a.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&(this.ctx.restore(),this.inSMaskMode&&this.ctx.setTransform(this.suspendedCtx.getTransform())),b(this,q,Bf).call(this,n);else{this.ctx.restore();const l=Ot(this.ctx);this.restore(t),(o=this.current.transferMapsFallback)==null||o.applyToCanvas(s),this.ctx.save(),this.ctx.setTransform(...l);const c=$a.slice();j.axialAlignedBoundingBox([0,0,s.canvas.width,s.canvas.height],l,c);const h=r(this,nr).at(-1);if(r(this,ks)>0)if(n.hasInnerBackdrop){const{width:d,height:f}=s.canvas,g=this.canvasFactory.create(d,f),m=g.context;m.drawImage(i.canvas,n.offsetX,n.offsetY,d,f,0,0,d,f),m.globalCompositeOperation="source-over",m.drawImage(s.canvas,0,0);const v=b(this,q,Im).call(this,s.canvas);m.globalCompositeOperation="destination-in",m.drawImage(v.canvas,0,0);const w=this.ctx.globalCompositeOperation,A=this.ctx.globalAlpha,_=this.ctx.filter;this.ctx.save(),this.ctx.setTransform(...l),this.ctx.globalAlpha=1,_t.isCanvasFilterSupported&&(this.ctx.filter="none"),this.ctx.globalCompositeOperation="destination-out",this.ctx.drawImage(v.canvas,0,0),this.ctx.globalCompositeOperation=w,this.ctx.globalAlpha=A,_t.isCanvasFilterSupported&&(this.ctx.filter=_??"none"),this.ctx.drawImage(g.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(v),this.canvasFactory.destroy(g)}else{const d=(h==null?void 0:h.backdropCtx)??null;b(this,q,Mm).call(this,this.ctx,s.canvas,{backdropCanvas:(d==null?void 0:d.canvas)??null,destTransform:l,backdropOffset:d?[h.offsetX+n.offsetX,h.offsetY+n.offsetY]:[0,0],sourceAlpha:this.ctx.globalAlpha,sourceFilter:this.ctx.filter})}else{if(n.replaceBackdrop){const d=new Path2D;d.rect(0,0,s.canvas.width,s.canvas.height),this.ctx.clip(d),this.ctx.globalCompositeOperation="copy"}this.ctx.drawImage(s.canvas,0,0)}this.ctx.restore(),this.canvasFactory.destroy({canvas:s.canvas,context:s}),b(this,q,Bf).call(this,n),this.compose(c)}}beginAnnotation(t,e,s,i,n,a,o){if(b(this,q,Cm).call(this),_f(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),s){const l=s[2]-s[0],c=s[3]-s[1];if(a&&this.annotationCanvasMap){i=i.slice(),i[4]-=s[0],i[5]-=s[1],j.singularValueDecompose2dScale(Ot(this.ctx),zs);const{viewportScale:h}=this,d=Math.ceil(l*this.outputScaleX*h),f=Math.ceil(c*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(d,f);const{canvas:g,context:m}=this.annotationCanvas;if(o){const v=this.annotationCanvasMap.getOrInsertComputed(e,Pl);g.setAttribute("data-canvas-name",o);const w=v.findIndex(A=>A.getAttribute("data-canvas-name")===o);w===-1?v.push(g):v[w]=g}else this.annotationCanvasMap.set(e,g);this.annotationCanvas.savedCtx=this.ctx,this.ctx=m,this.ctx.save(),this.ctx.setTransform(zs[0],0,0,-zs[1],0,c*zs[1]),_f(this.ctx)}else{_f(this.ctx),this.endPath(t);const h=new Path2D;h.rect(s[0],s[1],l,c),this.ctx.clip(h)}}this.current=new Gy(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(t,...i),this.transform(t,...n),this.baseTransform=Ot(this.ctx)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),b(this,q,Pm).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(t,e){var l;if(!this.contentVisible)return;const s=e.count;e=this.getObject(t,e.data,e),e.count=s;const i=b(this,q,ps).call(this,this.current.fillAlpha),n=this.ctx,a=this._createMaskCanvas(t,e),o=a.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(o,a.offsetX,a.offsetY),(l=this.dependencyTracker)==null||l.resetBBox(t).recordBBox(t,this.ctx,a.offsetX,a.offsetX+o.width,a.offsetY,a.offsetY+o.height).recordOperation(t),n.restore(),a.canvasEntry&&this.canvasFactory.destroy(a.canvasEntry),this.compose(),b(this,q,Ge).call(this,i)}paintImageMaskXObjectRepeat(t,e,s,i=0,n=0,a,o){var f,g,m;if(!this.contentVisible)return;e=this.getObject(t,e.data,e);const l=b(this,q,ps).call(this,this.current.fillAlpha),c=this.ctx;c.save();const h=Ot(c);c.transform(s,i,n,a,0,0);const d=this._createMaskCanvas(t,e);c.setTransform(1,0,0,1,d.offsetX-h[4],d.offsetY-h[5]),(f=this.dependencyTracker)==null||f.resetBBox(t);for(let v=0,w=o.length;v<w;v+=2){const A=j.transform(h,[s,i,n,a,o[v],o[v+1]]);c.drawImage(d.canvas,A[4],A[5]),(g=this.dependencyTracker)==null||g.recordBBox(t,this.ctx,A[4],A[4]+d.canvas.width,A[5],A[5]+d.canvas.height)}c.restore(),d.canvasEntry&&this.canvasFactory.destroy(d.canvasEntry),this.compose(),(m=this.dependencyTracker)==null||m.recordOperation(t),b(this,q,Ge).call(this,l)}paintImageMaskXObjectGroup(t,e){var o,l,c;if(!this.contentVisible)return;const s=b(this,q,ps).call(this,this.current.fillAlpha),i=this.ctx,n=this.current.patternFill,a=n?this.current.fillColor:i.fillStyle;(o=this.dependencyTracker)==null||o.resetBBox(t).recordDependencies(t,qs.transformAndFill);for(const h of e){const{data:d,width:f,height:g,transform:m}=h,v=this.canvasFactory.create(f,g),w=v.context;w.save();const A=this.getObject(t,d,h);Vy(w,A),w.globalCompositeOperation="source-in",w.fillStyle=n?a.getPattern(w,this,ji(i),Ue.FILL,t):a,w.fillRect(0,0,f,g),w.restore(),i.save(),i.transform(...m),i.scale(1,-1),Af(i,v.canvas,0,0,f,g,0,-1,1,1),this.canvasFactory.destroy(v),(l=this.dependencyTracker)==null||l.recordBBox(t,i,0,f,0,g),i.restore()}this.compose(),(c=this.dependencyTracker)==null||c.recordOperation(t),b(this,q,Ge).call(this,s)}paintImageXObject(t,e){if(!this.contentVisible)return;const s=this.getObject(t,e);if(!s){st("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t,s)}paintImageXObjectRepeat(t,e,s,i,n){if(!this.contentVisible)return;const a=this.getObject(t,e);if(!a){st("Dependent image isn't ready yet");return}const o=a.width,l=a.height,c=[];for(let h=0,d=n.length;h<d;h+=2)c.push({transform:[s,0,0,i,n[h],n[h+1]],x:0,y:0,w:o,h:l});this.paintInlineImageXObjectGroup(t,a,c)}applyTransferMapsToCanvas(t){var e;return this.current.transferMaps!=="none"?(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"):(e=this.current.transferMapsFallback)==null||e.applyToCanvas(t),t.canvas}applyTransferMapsToBitmap(t){const{transferMaps:e,transferMapsFallback:s}=this.current;if(e==="none"&&!s)return{img:t.bitmap,canvasEntry:null};const{bitmap:i,width:n,height:a}=t,o=this.canvasFactory.create(n,a),l=o.context;return l.filter=e,l.drawImage(i,0,0),l.filter="none",s==null||s.applyToCanvas(l),{img:o.canvas,canvasEntry:o}}paintInlineImageXObject(t,e){var d;if(!this.contentVisible)return;const s=e.width,i=e.height,n=b(this,q,ps).call(this,this.current.fillAlpha),a=this.ctx;this.save(t);const{filter:o}=a;o!=="none"&&o!==""&&(a.filter="none"),a.scale(1/s,-1/i);let l,c=null;if(e.bitmap){const f=this.applyTransferMapsToBitmap(e);l=f.img,c=f.canvasEntry}else{const f=this.canvasFactory.create(s,i);zy(f.context,e),l=this.applyTransferMapsToCanvas(f.context),c=f}const h=this._scaleImage(l,ji(a));a.imageSmoothingEnabled=Wy(Ot(a),e.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(t).recordBBox(t,a,0,s,-i,0).recordDependencies(t,qs.imageXObject).recordOperation(t),(d=this.imagesTracker)==null||d.record(a,s,i,this.dependencyTracker.clipBox)),Af(a,h.img,0,0,h.paintWidth,h.paintHeight,0,-i,s,i),h.tmpCanvas&&this.canvasFactory.destroy(h.tmpCanvas),c&&this.canvasFactory.destroy(c),this.compose(),this.restore(t),b(this,q,Ge).call(this,n)}paintInlineImageXObjectGroup(t,e,s){var l,c,h;if(!this.contentVisible)return;const i=b(this,q,ps).call(this,this.current.fillAlpha),n=this.ctx;let a,o=null;if(e.bitmap&&!this.current.transferMapsFallback)a=e.bitmap;else if(e.bitmap)({img:a,canvasEntry:o}=this.applyTransferMapsToBitmap(e));else{const d=e.width,f=e.height,g=this.canvasFactory.create(d,f);zy(g.context,e),a=this.applyTransferMapsToCanvas(g.context),o=g}(l=this.dependencyTracker)==null||l.resetBBox(t);for(const d of s)n.save(),n.transform(...d.transform),n.scale(1,-1),Af(n,a,d.x,d.y,d.w,d.h,0,-1,1,1),(c=this.dependencyTracker)==null||c.recordBBox(t,n,0,1,-1,0),n.restore();o&&this.canvasFactory.destroy(o),(h=this.dependencyTracker)==null||h.recordOperation(t),this.compose(),b(this,q,Ge).call(this,i)}paintSolidColorImageMask(t){var s;if(!this.contentVisible)return;const e=b(this,q,ps).call(this,this.current.fillAlpha);(s=this.dependencyTracker)==null||s.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,qs.fill).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose(),b(this,q,Ge).call(this,e)}markPoint(t,e){}markPointProps(t,e,s){}beginMarkedContent(t,e){var s;(s=this.dependencyTracker)==null||s.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,s){var i;(i=this.dependencyTracker)==null||i.beginMarkedContent(t),e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(s)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(t){var e;(e=this.dependencyTracker)==null||e.endMarkedContent(t),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(t){}endCompat(t){}consumePath(t,e,s){var a,o;const i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(s);const n=this.ctx;this.pendingClip?(i||(this.pendingClip===Xy?n.clip(e,"evenodd"):n.clip(e)),this.pendingClip=null,(a=this.dependencyTracker)==null||a.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)):(o=this.dependencyTracker)==null||o.recordOperation(t),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){const t=Ot(this.ctx);if(t[1]===0&&t[2]===0)return 1/Math.min(Math.abs(t[0]),Math.abs(t[3]));const e=Math.abs(t[0]*t[3]-t[2]*t[1]),s=Math.hypot(t[0],t[2]),i=Math.hypot(t[1],t[3]);return Math.max(s,i)/e}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:e,b:s,c:i,d:n}=this.ctx.getTransform();let a,o;if(s===0&&i===0){const l=Math.abs(e),c=Math.abs(n);if(l===c)if(t===0)a=o=1/l;else{const h=l*t;a=o=h<1?1/h:1}else if(t===0)a=1/l,o=1/c;else{const h=l*t,d=c*t;a=h<1?1/h:1,o=d<1?1/d:1}}else{const l=Math.abs(e*n-s*i),c=Math.hypot(e,s),h=Math.hypot(i,n);if(t===0)a=h/l,o=c/l;else{const d=t*l;a=h>d?h/d:1,o=c>d?c/d:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,e){const{ctx:s,current:{lineWidth:i}}=this,[n,a]=this.getScaleForStroking();if(n===a){s.lineWidth=(i||1)*n,s.stroke(t);return}const o=r(Ua,Np)??p(Ua,Np,new DOMMatrix),l=s.getLineDash();e&&s.save(),s.scale(n,a),o.a=1/n,o.d=1/a;const c=new Path2D;if(c.addPath(t,o),l.length>0){const h=Math.max(n,a);s.setLineDash(l.map(d=>d/h)),s.lineDashOffset/=h}s.lineWidth=i||1,s.stroke(c),e&&s.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};Np=new WeakMap,ks=new WeakMap,ea=new WeakMap,Eo=new WeakMap,xo=new WeakMap,To=new WeakMap,Co=new WeakMap,Po=new WeakMap,Io=new WeakMap,ko=new WeakMap,nr=new WeakMap,q=new WeakSet,Cm=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)},Pm=function(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}},Im=function(t,e=null,s=1){const{width:i,height:n}=t,a=e??this.canvasFactory.create(i,n),o=a.context;s=Math.round(s*255)/255;const l=s<1;l&&r(this,Io)===void 0&&p(this,Io,_t.isCanvasFilterSupported?new Map:"none");let c="none";if(l&&r(this,Io)instanceof Map&&(c=r(this,Io).getOrInsertComputed(s,()=>this.filterFactory.addKnockoutFilter(s))),!l||c!=="none")return e&&(o.save(),o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,i,n),o.restore()),o.filter=c,o.drawImage(t,0,0),o.filter="none",a;const h=t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,i,n),d=o.createImageData(i,n),f=h.data,g=d.data,m=s>0?1/s:1e6;for(let v=3,w=f.length;v<w;v+=4)g[v]=Math.min(Math.round(f[v]*m),255);return o.putImageData(d,0,0),a},km=function(t,e,s,i){let n=(t==null?void 0:t[e])??null;if(n&&(n.canvas.width!==s||n.canvas.height!==i)&&(this.canvasFactory.destroy(n),n=null),!n)return n=this.canvasFactory.create(s,i),t&&(t[e]=n),n;const a=n.context;return a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,s,i),a.restore(),n},Mm=function(t,e,s={}){const{backdropCanvas:i=null,destTransform:n=[1,0,0,1,0,0],backdropOffset:a=[0,0],reuseMaskEntry:o=null,poolMeta:l=null,sourceAlpha:c=1,sourceFilter:h="none",knockoutAlpha:d=1}=s,{width:f,height:g}=e,m=b(this,q,Im).call(this,e,o,d),v=t.globalCompositeOperation;if(t.save(),t.setTransform(...n),t.globalAlpha=1,_t.isCanvasFilterSupported&&(t.filter="none"),t.globalCompositeOperation="destination-out",t.drawImage(m.canvas,0,0),i){const[w,A]=a,_=b(this,q,km).call(this,l,"knockoutBackdropEntry",f,g),E=_.context;E.drawImage(i,w,A,f,g,0,0,f,g),E.globalCompositeOperation="destination-in",E.drawImage(m.canvas,0,0),E.globalCompositeOperation="source-over",t.globalCompositeOperation="destination-over",t.drawImage(_.canvas,0,0),l||this.canvasFactory.destroy(_)}t.globalCompositeOperation=v,t.globalAlpha=c,_t.isCanvasFilterSupported&&(t.filter=h??"none"),t.drawImage(e,0,0),t.restore(),o||this.canvasFactory.destroy(m)},ps=function(t=1){if(r(this,ks)===0||r(this,ea)>0||!this.contentVisible)return!1;Ft(this,ea)._++,p(this,Po,t);const e=r(this,nr).at(-1),{canvas:s}=this.ctx,i=b(this,q,km).call(this,e,"knockoutTempEntry",s.width,s.height);p(this,Eo,i);const n=i.context;return n.save(),n.setTransform(this.ctx.getTransform()),Oa(this.ctx,n),p(this,Co,n.globalCompositeOperation),n.globalCompositeOperation="source-over",$y(n,this.ctx),p(this,ko,e),p(this,xo,this.ctx),p(this,To,this.suspendedCtx),this.ctx=n,this.inSMaskMode&&(this.suspendedCtx=n),!0},Ge=function(t){var l;if(!t)return;const e=r(this,Eo),s=r(this,xo),i=r(this,To),n=e.context;p(this,Eo,null),p(this,xo,null),p(this,To,null),this.inSMaskMode&&this.suspendedCtx===n&&this.ctx!==n&&this.endSMaskMode(),this.inSMaskMode&&(this.suspendedCtx=i),this.ctx._removeMirroring(),this.ctx.globalCompositeOperation=r(this,Co),p(this,Co,null),Oa(this.ctx,s),this.ctx=s;const a=r(this,ko);p(this,ko,null);const o=r(this,Po);p(this,Po,1);try{b(this,q,Mm).call(this,i??s,e.canvas,{backdropCanvas:((l=a==null?void 0:a.backdropCtx)==null?void 0:l.canvas)??null,backdropOffset:a!=null&&a.backdropCtx?[a.offsetX,a.offsetY]:[0,0],reuseMaskEntry:(a==null?void 0:a.knockoutMaskEntry)??null,poolMeta:a,knockoutAlpha:o})}finally{n.restore(),Ft(this,ea)._--,a||this.canvasFactory.destroy(e)}},Om=function(t,e,s){const i=new Path2D;return i.addPath(t,new DOMMatrix(s).invertSelf().multiplySelf(e)),i},Yh=function(t){var e;return((e=this.current.transferMapsFallback)==null?void 0:e.applyToColor(t))??t},Bw=function(t){const{canvas:e}=t,{width:s,height:i}=e;if(_t.isCanvasFilterSupported){t.save(),t.setTransform(1,0,0,1,0,0),t.filter="grayscale(1)",t.globalAlpha=1,t.globalCompositeOperation="copy",t.drawImage(e,0,0),t.restore();return}const n=t.getImageData(0,0,s,i),{data:a}=n;for(let o=0,l=a.length;o<l;o+=4){const c=a[o]*.2126+a[o+1]*.7152+a[o+2]*.0722+.5|0;a[o]=a[o+1]=a[o+2]=c}t.putImageData(n,0,0)},Bf=function(t){t&&(t.knockoutMaskEntry&&(this.canvasFactory.destroy(t.knockoutMaskEntry),t.knockoutMaskEntry=null),t.knockoutTempEntry&&(this.canvasFactory.destroy(t.knockoutTempEntry),t.knockoutTempEntry=null),t.knockoutBackdropEntry&&(this.canvasFactory.destroy(t.knockoutBackdropEntry),t.knockoutBackdropEntry=null))},y(Ua,Np,null);let $l=Ua;for(const u in Li)$l.prototype[u]!==void 0&&($l.prototype[Li[u]]=$l.prototype[u]);var Zu,td;class xg{constructor(t,e,s){y(this,Zu,null);y(this,td,null);O(this,"_fullReader",null);O(this,"_rangeReaders",new Set);O(this,"_source",null);this._source=t,p(this,Zu,e),p(this,td,s)}get _progressiveDataLength(){var t;return((t=this._fullReader)==null?void 0:t._loaded)??0}getFullReader(){return ne(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new(r(this,Zu))(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new(r(this,td))(this,t,e);return this._rangeReaders.add(s),s}cancelAllRequests(t){var e;(e=this._fullReader)==null||e.cancel(t);for(const s of new Set(this._rangeReaders))s.cancel(t)}}Zu=new WeakMap,td=new WeakMap;class Tg{constructor(t){O(this,"onProgress",null);O(this,"_contentLength",0);O(this,"_filename",null);O(this,"_headersCapability",Promise.withResolvers());O(this,"_isRangeSupported",!1);O(this,"_isStreamingSupported",!1);O(this,"_loaded",0);O(this,"_stream",null);this._stream=t}_callOnProgress(){var t;(t=this.onProgress)==null||t.call(this,{loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){vt("Abstract method `read` called")}cancel(t){vt("Abstract method `cancel` called")}}class Cg{constructor(t,e,s){O(this,"_stream",null);this._stream=t}async read(){vt("Abstract method `read` called")}cancel(t){vt("Abstract method `cancel` called")}}function uE(u){let t=!0,e=s("filename\\*","i").exec(u);if(e){e=e[1];let h=o(e);return h=unescape(h),h=l(h),h=c(h),n(h)}if(e=a(u),e){const h=c(e);return n(h)}if(e=s("filename","i").exec(u),e){e=e[1];let h=o(e);return h=c(h),n(h)}function s(h,d){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',d)}function i(h,d){if(h){if(!/^[\x00-\xFF]+$/.test(d))return d;try{const f=new TextDecoder(h,{fatal:!0}),g=yg(d);d=f.decode(g),t=!1}catch{}}return d}function n(h){return t&&/[\x80-\xff]/.test(h)&&(h=i("utf-8",h),t&&(h=i("iso-8859-1",h))),h}function a(h){const d=[];let f;const g=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=g.exec(h))!==null;){let[,v,w,A]=f;if(v=parseInt(v,10),v in d){if(v===0)break;continue}d[v]=[w,A]}const m=[];for(let v=0;v<d.length&&v in d;++v){let[w,A]=d[v];A=o(A),w&&(A=unescape(A),v===0&&(A=l(A))),m.push(A)}return m.join("")}function o(h){if(h.startsWith('"')){const d=h.slice(1).split('\\"');for(let f=0;f<d.length;++f){const g=d[f].indexOf('"');g!==-1&&(d[f]=d[f].slice(0,g),d.length=f+1),d[f]=d[f].replaceAll(/\\(.)/g,"$1")}h=d.join('"')}return h}function l(h){const d=h.indexOf("'");if(d===-1)return h;const f=h.slice(0,d),m=h.slice(d+1).replace(/^[^']*'/,"");return i(f,m)}function c(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi,function(d,f,g,m){if(g==="q"||g==="Q")return m=m.replaceAll("_"," ").replaceAll(/=([0-9a-f]{2})/gi,(v,w)=>String.fromCharCode(parseInt(w,16))),i(f,m);try{m=atob(m)}catch{}return i(f,m)})}return""}function Uw(u,t){const e=new Headers;if(!u||!t||typeof t!="object")return e;for(const s in t){const i=t[s];i!==void 0&&e.append(s,i)}return e}function dE(u){let t=u.length;for(;t>0&&u[t-1]!==" "&&/\s/.test(u[t-1]);)t--;return u.slice(0,t)}function Pg(u){var t;return((t=URL.parse(u))==null?void 0:t.origin)??null}function Hw({responseHeaders:u,isHttp:t,rangeChunkSize:e,disableRange:s}){const i={contentLength:0,isRangeSupported:!1},n=parseInt(u.get("Content-Length"),10);return!Number.isInteger(n)||(i.contentLength=n,n<=2*e)||s||!t||u.get("Accept-Ranges")!=="bytes"||(u.get("Content-Encoding")||"identity")==="identity"&&(i.isRangeSupported=!0),i}function jw(u){const t=u.get("Content-Disposition");if(t){let e=uE(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Sg(e))return e}return null}function Ig(u,t){return new hu(`Unexpected server response (${u}) while retrieving PDF "${t.href}".`,u,u===404||u===0&&t.protocol==="file:")}function $w(u,t){if(u!==t)throw new Error(`Expected range response-origin "${u}" to match "${t}".`)}function Gw(u,t,e,s){return fetch(u,{method:"GET",headers:t,signal:s.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"})}function zw(u,t){if(u!==200&&u!==206)throw Ig(u,t)}function kg(u){if(u instanceof Uint8Array)return u.buffer;if(u instanceof ArrayBuffer)return u;throw new Error(`getArrayBuffer - unexpected data: ${u}`)}class fE extends xg{constructor(e){super(e,pE,gE);O(this,"_responseOrigin",null);const{httpHeaders:s,url:i}=e;ne(/https?:/.test(i.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=Uw(!0,s)}}class pE extends Tg{constructor(e){super(e);O(this,"_abortController",new AbortController);O(this,"_reader",null);const{disableRange:s,disableStream:i,rangeChunkSize:n,url:a,withCredentials:o}=e._source;this._isStreamingSupported=!i;const l=new Headers(e.headers);Gw(a,l,o,this._abortController).then(c=>{e._responseOrigin=Pg(c.url),zw(c.status,a),this._reader=c.body.getReader();const h=c.headers,{contentLength:d,isRangeSupported:f}=Hw({responseHeaders:h,isHttp:!0,rangeChunkSize:n,disableRange:s});this._contentLength=d,this._isRangeSupported=f,this._filename=jw(h),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new mn("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;const{value:e,done:s}=await this._reader.read();return s?{value:e,done:s}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:kg(e),done:!1})}cancel(e){var s;(s=this._reader)==null||s.cancel(e),this._abortController.abort()}}class gE extends Cg{constructor(e,s,i){super(e,s,i);O(this,"_abortController",new AbortController);O(this,"_readCapability",Promise.withResolvers());O(this,"_reader",null);const{url:n,withCredentials:a}=e._source,o=new Headers(e.headers);o.append("Range",`bytes=${s}-${i-1}`),Gw(n,o,a,this._abortController).then(l=>{const c=Pg(l.url);$w(c,e._responseOrigin),zw(l.status,n),this._reader=l.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;const{value:e,done:s}=await this._reader.read();return s?{value:e,done:s}:{value:kg(e),done:!1}}cancel(e){var s;(s=this._reader)==null||s.cancel(e),this._abortController.abort()}}function Yy(u){return u instanceof Uint8Array&&u.byteLength===u.buffer.byteLength?u.buffer:new Uint8Array(u).buffer}function Mg(){for(const u of this._requests)u.resolve({value:void 0,done:!0});this._requests.length=0}var Bp,Vw;class mE extends xg{constructor(e){super(e,vE,yE);y(this,Bp);O(this,"_progressiveDone",!1);O(this,"_queuedChunks",[]);const{pdfDataRangeTransport:s}=e,{initialData:i,progressiveDone:n}=s;if((i==null?void 0:i.length)>0){const o=Yy(i);this._queuedChunks.push(o)}this._progressiveDone=n;const a=o=>{var l;switch(o.type){case"range":case"progressiveRead":b(this,Bp,Vw).call(this,o.begin,o.chunk);break;case"progressiveDone":(l=this._fullReader)==null||l.progressiveDone(),this._progressiveDone=!0;break}};s.transportReady(a)}getFullReader(){const e=super.getFullReader();return this._queuedChunks=null,e}getRangeReader(e,s){const i=super.getRangeReader(e,s);return i&&(i.onDone=()=>this._rangeReaders.delete(i),this._source.pdfDataRangeTransport.requestDataRange(e,s)),i}cancelAllRequests(e){super.cancelAllRequests(e),this._source.pdfDataRangeTransport.abort()}}Bp=new WeakSet,Vw=function(e,s){const i=Yy(s);if(e===void 0)this._fullReader?this._fullReader._enqueue(i):this._queuedChunks.push(i);else{const n=this._rangeReaders.keys().find(a=>a._begin===e);ne(n,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),n._enqueue(i)}};var ed;class vE extends Tg{constructor(e){super(e);y(this,ed,Mg.bind(this));O(this,"_done",!1);O(this,"_queuedChunks",null);O(this,"_requests",[]);const{pdfDataRangeTransport:s,disableRange:i,disableStream:n}=e._source,{length:a,contentDispositionFilename:o}=s;this._queuedChunks=e._queuedChunks||[];for(const c of this._queuedChunks)this._loaded+=c.byteLength;this._done=e._progressiveDone,this._contentLength=a,this._isStreamingSupported=!n,this._isRangeSupported=!i,Sg(o)&&(this._filename=o),this._headersCapability.resolve();const l=this._loaded;Promise.resolve().then(()=>{l>0&&this._loaded===l&&this._callOnProgress()})}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength,this._callOnProgress())}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,r(this,ed).call(this)}progressiveDone(){this._done||(this._done=!0),this._queuedChunks.length===0&&r(this,ed).call(this)}}ed=new WeakMap;var sd;class yE extends Cg{constructor(e,s,i){super(e,s,i);y(this,sd,Mg.bind(this));O(this,"onDone",null);O(this,"_begin",-1);O(this,"_done",!1);O(this,"_queuedChunk",null);O(this,"_requests",[]);this._begin=s}_enqueue(e){var s;this._done||(this._requests.length===0?this._queuedChunk=e:(this._requests.shift().resolve({value:e,done:!1}),r(this,sd).call(this)),this._done=!0,(s=this.onDone)==null||s.call(this))}async read(){if(this._queuedChunk){const s=this._queuedChunk;return this._queuedChunk=null,{value:s,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){var s;this._done=!0,r(this,sd).call(this),(s=this.onDone)==null||s.call(this)}}sd=new WeakMap;const jg=200,Ky=206;function bE(u){return typeof u!="string"?u:yg(u).buffer}var ar,xh,Ww,Xw;class wE extends xg{constructor(e){super(e,AE,_E);y(this,xh);y(this,ar,new WeakMap);O(this,"_responseOrigin",null);const{httpHeaders:s,url:i}=e;this.url=i,this.isHttp=/https?:/.test(i.protocol),this.headers=Uw(this.isHttp,s)}_request(e){const s=new XMLHttpRequest,i={validateStatus:null,onHeadersReceived:e.onHeadersReceived,onDone:e.onDone,onError:e.onError,onProgress:e.onProgress};r(this,ar).set(s,i),s.open("GET",this.url),s.withCredentials=this._source.withCredentials;for(const[n,a]of this.headers)s.setRequestHeader(n,a);return this.isHttp&&"begin"in e&&"end"in e?(s.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),i.validateStatus=n=>n===Ky||n===jg):i.validateStatus=n=>n===jg,s.responseType="arraybuffer",ne(e.onError,"Expected `onError` callback to be provided."),s.onerror=()=>e.onError(s.status),s.onreadystatechange=b(this,xh,Xw).bind(this,s),s.onprogress=b(this,xh,Ww).bind(this,s),s.send(null),s}_abortRequest(e){r(this,ar).has(e)&&(r(this,ar).delete(e),e.abort())}getRangeReader(e,s){const i=super.getRangeReader(e,s);return i&&(i.onClosed=()=>this._rangeReaders.delete(i)),i}}ar=new WeakMap,xh=new WeakSet,Ww=function(e,s){var n;const i=r(this,ar).get(e);(n=i==null?void 0:i.onProgress)==null||n.call(i,s)},Xw=function(e,s){const i=r(this,ar).get(e);if(!i||(e.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),e.readyState!==4)||!r(this,ar).has(e))return;if(r(this,ar).delete(e),e.status===0&&this.isHttp){i.onError(e.status);return}const n=e.status||jg;if(!i.validateStatus(n)){i.onError(e.status);return}const a=bE(e.response);if(n===Ky){const o=e.getResponseHeader("Content-Range");/bytes \d+-\d+\/\d+/.test(o)?i.onDone(a):(st('Missing or invalid "Content-Range" header.'),i.onError(0))}else a?i.onDone(a):i.onError(e.status)};var id,_r,Yw,Kw,qw,Jw;class AE extends Tg{constructor(e){super(e);y(this,_r);y(this,id,Mg.bind(this));O(this,"_cachedChunks",[]);O(this,"_done",!1);O(this,"_requests",[]);O(this,"_storedError",null);this._fullRequestXhr=e._request({onHeadersReceived:b(this,_r,Yw).bind(this),onDone:b(this,_r,Kw).bind(this),onError:b(this,_r,qw).bind(this),onProgress:b(this,_r,Jw).bind(this)})}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e),r(this,id).call(this),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}}id=new WeakMap,_r=new WeakSet,Yw=function(){const e=this._stream,{disableRange:s,rangeChunkSize:i}=e._source,n=this._fullRequestXhr;e._responseOrigin=Pg(n.responseURL);const a=n.getAllResponseHeaders(),o=new Headers(a?dE(a.trimStart()).split(/[\r\n]+/).map(h=>{const[d,...f]=h.split(": ");return[d,f.join(": ")]}):[]),{contentLength:l,isRangeSupported:c}=Hw({responseHeaders:o,isHttp:e.isHttp,rangeChunkSize:i,disableRange:s});this._contentLength=l,this._isRangeSupported=c,this._filename=jw(o),this._isRangeSupported&&e._abortRequest(n),this._headersCapability.resolve()},Kw=function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._cachedChunks.push(e),this._done=!0,this._cachedChunks.length===0&&r(this,id).call(this)},qw=function(e){this._storedError=Ig(e,this._stream.url),this._headersCapability.reject(this._storedError);for(const s of this._requests)s.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0},Jw=function(e){var s;(s=this.onProgress)==null||s.call(this,{loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})};var rd,bn,Qw,Zw,Rm;class _E extends Cg{constructor(e,s,i){super(e,s,i);y(this,bn);y(this,rd,Mg.bind(this));O(this,"onClosed",null);O(this,"_done",!1);O(this,"_queuedChunk",null);O(this,"_requests",[]);O(this,"_storedError",null);this._requestXhr=e._request({begin:s,end:i,onHeadersReceived:b(this,bn,Qw).bind(this),onDone:b(this,bn,Zw).bind(this),onError:b(this,bn,Rm).bind(this),onProgress:null})}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const s=this._queuedChunk;return this._queuedChunk=null,{value:s,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){var s;this._done=!0,r(this,rd).call(this),this._stream._abortRequest(this._requestXhr),(s=this.onClosed)==null||s.call(this)}}rd=new WeakMap,bn=new WeakSet,Qw=function(){var s;const e=Pg((s=this._requestXhr)==null?void 0:s.responseURL);try{$w(e,this._stream._responseOrigin)}catch(i){this._storedError=i,b(this,bn,Rm).call(this,0)}},Zw=function(e){var s;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,r(this,rd).call(this),(s=this.onClosed)==null||s.call(this)},Rm=function(e){this._storedError??(this._storedError=Ig(e,this._stream.url));for(const s of this._requests)s.reject(this._storedError);this._requests.length=0,this._queuedChunk=null};function tA(u,t=null){const e=process.getBuiltinModule("fs"),{Readable:s}=process.getBuiltinModule("stream"),i=e.createReadStream(u,t);return s.toWeb(i)}class SE extends xg{constructor(t){super(t,EE,xE);const{url:e}=t;ne(e.protocol==="file:","PDFNodeStream only supports file:// URLs.")}}class EE extends Tg{constructor(e){super(e);O(this,"_reader",null);const{disableRange:s,disableStream:i,rangeChunkSize:n,url:a}=e._source;this._isStreamingSupported=!i,process.getBuiltinModule("fs/promises").lstat(a).then(l=>{const c=tA(a);this._reader=c.getReader();const{size:h}=l;this._contentLength=h,this._isRangeSupported=!s&&h>2*n,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new mn("Streaming is disabled.")),this._headersCapability.resolve()}).catch(l=>{l.code==="ENOENT"&&(l=Ig(0,a)),this._headersCapability.reject(l)})}async read(){await this._headersCapability.promise;const{value:e,done:s}=await this._reader.read();return s?{value:e,done:s}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:kg(e),done:!1})}cancel(e){var s;(s=this._reader)==null||s.cancel(e)}}class xE extends Cg{constructor(e,s,i){super(e,s,i);O(this,"_readCapability",Promise.withResolvers());O(this,"_reader",null);const{url:n}=e._source;try{const a=tA(n,{start:s,end:i-1});this._reader=a.getReader(),this._readCapability.resolve()}catch(a){this._readCapability.reject(a)}}async read(){await this._readCapability.promise;const{value:e,done:s}=await this._reader.read();return s?{value:e,done:s}:{value:kg(e),done:!1}}cancel(e){var s;(s=this._reader)==null||s.cancel(e)}}function TE(u){return ru(u)?fE:Gs?SE:wE}var nd,ad;class Ni{static get workerPort(){return r(this,nd)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");p(this,nd,t)}static get workerSrc(){return r(this,ad)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");p(this,ad,t)}}nd=new WeakMap,ad=new WeakMap,y(Ni,nd,null),y(Ni,ad,"");var xc,od;class CE{constructor({parsedData:t,rawData:e}){y(this,xc);y(this,od);p(this,xc,t),p(this,od,e)}getRaw(){return r(this,od)}get(t){return r(this,xc).get(t)??null}[Symbol.iterator](){return r(this,xc).entries()}}xc=new WeakMap,od=new WeakMap;const Fa=Symbol("INTERNAL");var ld,cd,Tc,Mo;class PE{constructor(t,{name:e,intent:s,usage:i,rbGroups:n}){y(this,ld,!1);y(this,cd,!1);y(this,Tc,!1);y(this,Mo,!0);p(this,ld,!!(t&$s.DISPLAY)),p(this,cd,!!(t&$s.PRINT)),this.name=e,this.intent=s,this.usage=i,this.rbGroups=n}get visible(){if(r(this,Tc))return r(this,Mo);if(!r(this,Mo))return!1;const{print:t,view:e}=this.usage;return r(this,ld)?(e==null?void 0:e.viewState)!=="OFF":r(this,cd)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,s=!1){t!==Fa&&vt("Internal method `_setVisible` called."),p(this,Tc,s),p(this,Mo,e)}get serializable(){return{userSet:r(this,Tc),visible:r(this,Mo)}}}ld=new WeakMap,cd=new WeakMap,Tc=new WeakMap,Mo=new WeakMap;var sa,wt,Cc,Pc,hd,ud,Fm;const fy=class fy{constructor(t,e=$s.DISPLAY,s=null){y(this,ud);y(this,sa,null);y(this,wt,new Map);y(this,Cc,null);y(this,Pc,null);y(this,hd);O(this,"creator",null);O(this,"name",null);if(p(this,hd,t),this.renderingIntent=e,t!==null){this.name=t.name,this.creator=t.creator,p(this,Pc,t.order);for(const i of t.groups)r(this,wt).set(i.id,new PE(e,i));if(s){s.size!==r(this,wt).size&&vt("Incorrect serialized groupState.");for(const[i,n]of s)r(this,wt).get(i)._setVisible(Fa,n.visible,n.userSet)}else{if(t.baseState==="OFF")for(const i of r(this,wt).values())i._setVisible(Fa,!1);for(const i of t.on)r(this,wt).get(i)._setVisible(Fa,!0);for(const i of t.off)r(this,wt).get(i)._setVisible(Fa,!1)}p(this,Cc,this.getHash())}}isVisible(t){if(r(this,wt).size===0)return!0;if(!t)return vg("Optional content group not defined."),!0;if(t.type==="OCG")return r(this,wt).has(t.id)?r(this,wt).get(t.id).visible:(st(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return b(this,ud,Fm).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!r(this,wt).has(e))return st(`Optional content group not found: ${e}`),!0;if(r(this,wt).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!r(this,wt).has(e))return st(`Optional content group not found: ${e}`),!0;if(!r(this,wt).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!r(this,wt).has(e))return st(`Optional content group not found: ${e}`),!0;if(!r(this,wt).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!r(this,wt).has(e))return st(`Optional content group not found: ${e}`),!0;if(r(this,wt).get(e).visible)return!1}return!0}return st(`Unknown optional content policy ${t.policy}.`),!0}return st(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,s=!0){var n;const i=r(this,wt).get(t);if(!i){st(`Optional content group not found: ${t}`);return}if(s&&e&&i.rbGroups.length)for(const a of i.rbGroups)for(const o of a)o!==t&&((n=r(this,wt).get(o))==null||n._setVisible(Fa,!1,!0));i._setVisible(Fa,!!e,!0),p(this,sa,null)}setOCGState({state:t,preserveRB:e}){let s;for(const i of t){switch(i){case"ON":case"OFF":case"Toggle":s=i;continue}const n=r(this,wt).get(i);if(n)switch(s){case"ON":this.setVisibility(i,!0,e);break;case"OFF":this.setVisibility(i,!1,e);break;case"Toggle":this.setVisibility(i,!n.visible,e);break}}p(this,sa,null)}get hasInitialVisibility(){return r(this,Cc)===null||this.getHash()===r(this,Cc)}getOrder(){return r(this,wt).size?r(this,Pc)?r(this,Pc).slice():[...r(this,wt).keys()]:null}getGroup(t){return r(this,wt).get(t)||null}getHash(){if(r(this,sa)!==null)return r(this,sa);const t=new mm;for(const[e,s]of r(this,wt))t.update(`${e}:${s.visible}`);return p(this,sa,t.hexdigest())}[Symbol.iterator](){return r(this,wt).entries()}get serializable(){const t=new Map;for(const[e,s]of r(this,wt))t.set(e,s.serializable);return{data:r(this,hd),renderingIntent:this.renderingIntent,groupState:t}}static fromSerializable({data:t,renderingIntent:e,groupState:s}){return new fy(t,e,s)}};sa=new WeakMap,wt=new WeakMap,Cc=new WeakMap,Pc=new WeakMap,hd=new WeakMap,ud=new WeakSet,Fm=function(t){const e=t.length;if(e<2)return!0;const s=t[0];for(let i=1;i<e;i++){const n=t[i];let a;if(Array.isArray(n))a=b(this,ud,Fm).call(this,n);else if(r(this,wt).has(n))a=r(this,wt).get(n).visible;else return st(`Optional content group not found: ${n}`),!0;switch(s){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return s==="And"};let Dm=fy;var Qt,oi,we,Oo,or,$e,Kh,Uf,Lm,Nm;class IE{constructor(){y(this,$e);y(this,Qt,null);y(this,oi,null);y(this,we,0);y(this,Oo,null);y(this,or,null)}get pagesNumber(){return r(this,we)}set pagesNumber(t){r(this,we)!==t&&(p(this,we,t),p(this,Qt,null),p(this,oi,null))}movePages(t,e,s){b(this,$e,Kh).call(this);const i=r(this,Qt),n=e.length,a=new Uint32Array(n);let o=0;for(let f=0;f<n;f++){const g=e[f]-1;a[f]=i[g],g<s&&o++}const l=r(this,we),c=l-n,h=new Int32Array(l),d=Nt(s-o,0,c);for(let f=0,g=0;f<l;f++)t.has(f+1)||(i[g]=i[f],h[g++]=f+1);i.copyWithin(d+n,d,c),i.set(a,d),h.copyWithin(d+n,d,c),h.set(e,d),p(this,oi,h),i.every((f,g)=>f===g+1)&&p(this,Qt,null)}deletePages(t){b(this,$e,Kh).call(this);const e=r(this,Qt),s=b(this,$e,Uf).call(this);p(this,or,{pageNumberToId:e.slice(),pagesNumber:r(this,we),prevPageNumbers:r(this,oi).slice()});const i=r(this,we)-t.length;p(this,we,i);const n=p(this,Qt,new Uint32Array(i));p(this,oi,new Int32Array(i));let a=0,o=0;for(const l of t){const c=l-1;c!==a&&(n.set(e.subarray(a,c),o),o+=c-a),a=c+1}a<e.length&&n.set(e.subarray(a),o),b(this,$e,Lm).call(this,s,new Set(t))}cancelDelete(){r(this,or)&&(p(this,Qt,r(this,or).pageNumberToId),p(this,we,r(this,or).pagesNumber),p(this,oi,r(this,or).prevPageNumbers),p(this,or,null))}cleanSavedData(){p(this,or,null)}copyPages(t){b(this,$e,Kh).call(this),p(this,Oo,{pageNumbers:t,pageIds:t.map(e=>r(this,Qt)[e-1])})}cancelCopy(){p(this,Oo,null)}pastePages(t){b(this,$e,Kh).call(this);const e=r(this,Qt),s=b(this,$e,Uf).call(this),{pageNumbers:i,pageIds:n}=r(this,Oo),a=r(this,we)+i.length;p(this,we,a);const o=p(this,Qt,new Uint32Array(a));p(this,oi,new Int32Array(a)),o.set(e.subarray(0,t),0),o.set(n,t),o.set(e.subarray(t),t+i.length),b(this,$e,Lm).call(this,s,null,t,i),p(this,Oo,null)}hasBeenAltered(){return r(this,Qt)!==null}getPageMappingForSaving(t=null,e=b(this,$e,Nm).call(this)){t??(t=b(this,$e,Uf).call(this));let s=0;for(const n of t.values())s=Math.max(s,n.length);const i=new Array(s);for(let n=0;n<s;n++)i[n]={document:null,pageIndices:[],includePages:[]};for(const[n,a]of t)for(let o=0,l=a.length;o<l;o++)i[o].includePages.push([n-1,a[o]-1]);for(const{includePages:n,pageIndices:a}of i){n.sort((o,l)=>o[0]-l[0]);for(let o=0,l=n.length;o<l;o++)a.push(n[o][1]),n[o]=n[o][0]}return{pageInfos:i,copyLevels:e}}extractPages(t){t=Array.from(t).sort((s,i)=>s-i);const e=new Map;for(let s=0,i=t.length;s<i;s++){const n=this.getPageId(t[s]);e.getOrInsertComputed(n,Pl).push(s+1)}return this.getPageMappingForSaving(e,b(this,$e,Nm).call(this,t))}getPrevPageNumber(t){var e;return((e=r(this,oi))==null?void 0:e[t-1])??0}getPageNumber(t){if(!r(this,Qt))return t;const e=r(this,Qt);for(let s=0,i=r(this,we);s<i;s++)if(e[s]===t)return s+1;return 0}getPageId(t){var e;return((e=r(this,Qt))==null?void 0:e[t-1])??t}getMapping(){var t;return(t=r(this,Qt))==null?void 0:t.subarray(0,this.pagesNumber)}}Qt=new WeakMap,oi=new WeakMap,we=new WeakMap,Oo=new WeakMap,or=new WeakMap,$e=new WeakSet,Kh=function(){if(r(this,Qt))return;const t=r(this,we),e=p(this,Qt,new Uint32Array(t));for(let s=0;s<t;s++)e[s]=s+1;p(this,oi,new Int32Array(e))},Uf=function(){const t=new Map,e=r(this,Qt);for(let s=0,i=r(this,we);s<i;s++){const n=e[s],a=t.get(n);a?a.push(s+1):t.set(n,[s+1])}return t},Lm=function(t,e=null,s=-1,i=null){const n=r(this,oi),a=r(this,Qt),o=s+((i==null?void 0:i.length)??0),l=new Map;for(let c=0,h=r(this,we);c<h;c++){if(c>=s&&c<o){n[c]=-i[c-s];continue}const d=a[c],f=t.get(d);let g=l.get(d)||0;if(e&&f)for(;g<f.length&&e.has(f[g]);)g++;n[c]=f==null?void 0:f[g],l.set(d,g+1)}},Nm=function(t=null){if(!r(this,Qt))return null;const e=new Int32Array(r(this,we)).fill(-1),s=new Map;if(t)for(const i of t){const n=this.getPageId(i),a=s.get(n)??0;s.set(n,a+1),e[i-1]=a}else for(let i=0,n=r(this,we);i<n;i++){const a=r(this,Qt)[i],o=s.get(a)??0;s.set(a,o+1),e[i]=o}return e};const Ll=Symbol("INITIAL_DATA"),qy=()=>({...Promise.withResolvers(),data:Ll});var li;class eA{constructor(){y(this,li,new Map)}get(t,e=null){if(e){const i=r(this,li).getOrInsertComputed(t,qy);return i.promise.then(()=>e(i.data)),null}const s=r(this,li).get(t);if(!s||s.data===Ll)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){const e=r(this,li).get(t);return!!e&&e.data!==Ll}delete(t){const e=r(this,li).get(t);return!e||e.data===Ll?!1:(r(this,li).delete(t),!0)}resolve(t,e=null){const s=r(this,li).getOrInsertComputed(t,qy);if(s.data!==Ll)throw new Error(`Object already resolved ${t}.`);s.data=e,s.resolve()}clear(){var t;for(const{data:e}of r(this,li).values())(t=e==null?void 0:e.bitmap)==null||t.close();r(this,li).clear()}*[Symbol.iterator](){for(const[t,{data:e}]of r(this,li))e!==Ll&&(yield[t,e])}}li=new WeakMap;const kE=1e5,ME=30;var sb,ia,es,dd,fd,Ic,Ro,Wr,pd,gd,kc,Do,md,Mc,Fo,Oc,vd,Rc,Lo,yd,bd,Dc,No,wd,Fc,Lc,wn,sA,iA,Bm,os,Hf,rA,Um,nA,aA;const Pe=class Pe{constructor({textContentSource:t,images:e,container:s,viewport:i}){y(this,wn);y(this,ia,Promise.withResolvers());y(this,es,null);y(this,dd,!1);y(this,fd,!!((sb=globalThis.FontInspector)!=null&&sb.enabled));y(this,Ic,null);y(this,Ro,null);y(this,Wr,null);y(this,pd,0);y(this,gd,0);y(this,kc,Ws.pixelRatio);y(this,Do,null);y(this,md,null);y(this,Mc,0);y(this,Fo,0);y(this,Oc,Object.create(null));y(this,vd,[]);y(this,Rc,null);y(this,Lo,[]);y(this,yd,new WeakMap);y(this,bd,null);var c;if(t instanceof ReadableStream)p(this,Rc,t);else if(typeof t=="object")p(this,Rc,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');p(this,es,p(this,md,s)),p(this,Ic,e),p(this,Fo,i.scale*r(this,kc)),p(this,Mc,i.rotation),p(this,Wr,{div:null,properties:null,ctx:null});const{pageWidth:n,pageHeight:a,pageX:o,pageY:l}=i.rawDims;p(this,bd,[1,0,0,-1,-o,l+a]),p(this,gd,n),p(this,pd,a),b(c=Pe,os,nA).call(c),s.style.setProperty("--min-font-size",r(Pe,Fc)),Pa(s,i),r(this,ia).promise.finally(()=>{r(Pe,Lc).delete(this),p(this,Wr,null),p(this,Oc,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=_t.platform;return V(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){r(this,Ic)&&r(this,es).append(r(this,Ic).render());const t=()=>{r(this,Do).read().then(({value:e,done:s})=>{if(s){r(this,ia).resolve();return}r(this,Ro)??p(this,Ro,e.lang),Object.assign(r(this,Oc),e.styles),b(this,wn,sA).call(this,e.items),t()},r(this,ia).reject)};return p(this,Do,r(this,Rc).getReader()),r(Pe,Lc).add(this),t(),r(this,ia).promise}update({viewport:t,onBefore:e=null}){var n;const s=t.scale*Ws.pixelRatio,i=t.rotation;if(i!==r(this,Mc)&&(e==null||e(),p(this,Mc,i),Pa(r(this,md),{rotation:i})),s!==r(this,Fo)){e==null||e(),p(this,Fo,s),p(this,kc,Ws.pixelRatio);const a={div:null,properties:null,ctx:b(n=Pe,os,Hf).call(n,r(this,Ro))};for(const o of r(this,Lo))a.properties=r(this,yd).get(o),a.div=o,b(this,wn,Bm).call(this,a)}}cancel(){var e;const t=new mn("TextLayer task cancelled.");(e=r(this,Do))==null||e.cancel(t).catch(()=>{}),p(this,Do,null),r(this,ia).reject(t)}get textDivs(){return r(this,Lo)}get textContentItemsStr(){return r(this,vd)}static cleanup(){if(!(r(this,Lc).size>0)){r(this,Dc).clear();for(const{canvas:t}of r(this,No).values())t.remove();r(this,No).clear()}}};ia=new WeakMap,es=new WeakMap,dd=new WeakMap,fd=new WeakMap,Ic=new WeakMap,Ro=new WeakMap,Wr=new WeakMap,pd=new WeakMap,gd=new WeakMap,kc=new WeakMap,Do=new WeakMap,md=new WeakMap,Mc=new WeakMap,Fo=new WeakMap,Oc=new WeakMap,vd=new WeakMap,Rc=new WeakMap,Lo=new WeakMap,yd=new WeakMap,bd=new WeakMap,Dc=new WeakMap,No=new WeakMap,wd=new WeakMap,Fc=new WeakMap,Lc=new WeakMap,wn=new WeakSet,sA=function(t){var i,n;if(r(this,dd))return;(n=r(this,Wr)).ctx??(n.ctx=b(i=Pe,os,Hf).call(i,r(this,Ro)));const e=r(this,Lo),s=r(this,vd);for(const a of t){if(e.length>kE){st("Ignoring additional textDivs for performance reasons."),p(this,dd,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=r(this,es);p(this,es,document.createElement("span")),r(this,es).classList.add("markedContent"),a.id&&r(this,es).setAttribute("id",a.id),a.tag==="Artifact"&&(r(this,es).ariaHidden=!0),o.append(r(this,es))}else a.type==="endMarkedContent"&&p(this,es,r(this,es).parentNode);continue}s.push(a.str),b(this,wn,iA).call(this,a)}},iA=function(t){var v;const e=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};r(this,Lo).push(e);const i=j.transform(r(this,bd),t.transform);let n=Math.atan2(i[1],i[0]);const a=r(this,Oc)[t.fontName];a.vertical&&(n+=Math.PI/2);let o=r(this,fd)&&a.fontSubstitution||a.fontFamily;o=Pe.fontFamilyMap.get(o)||o;const l=Math.hypot(i[2],i[3]),c=l*b(v=Pe,os,aA).call(v,o,a,r(this,Ro));let h,d;n===0?(h=i[4],d=i[5]-c):(h=i[4]+c*Math.sin(n),d=i[5]-c*Math.cos(n));const f=e.style;f.left=`${(100*h/r(this,gd)).toFixed(2)}%`,f.top=`${(100*d/r(this,pd)).toFixed(2)}%`;const g=Math.round(l*100)/100;f.setProperty("--font-height",`${g}px`),f.fontFamily=o,s.fontSize=g,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,r(this,fd)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),n!==0&&(s.angle=n*(180/Math.PI));let m=!1;if(t.str.length>1)m=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const w=Math.abs(t.transform[0]),A=Math.abs(t.transform[3]);w!==A&&Math.max(w,A)/Math.min(w,A)>1.5&&(m=!0)}if(m&&(s.canvasWidth=a.vertical?t.height:t.width),r(this,yd).set(e,s),r(this,Wr).div=e,r(this,Wr).properties=s,b(this,wn,Bm).call(this,r(this,Wr)),s.hasText&&r(this,es).append(e),s.hasEOL){const w=document.createElement("br");w.setAttribute("role","presentation"),r(this,es).append(w)}},Bm=function(t){var l,c;const{div:e,properties:s,ctx:i}=t,{style:n}=e,{canvasWidth:a,fontSize:o}=s;if(a!==0&&o!==0&&s.hasText){const{fontFamily:h}=n,d=r(this,kc),f=b(l=Pe,os,rA).call(l,o*r(this,Fo)/d)*d;b(c=Pe,os,Um).call(c,i,f,h);const{width:g}=i.measureText(e.textContent);g>0&&n.setProperty("--scale-x",a*f/(g*o))}s.angle!==0&&n.setProperty("--rotate",`${s.angle}deg`)},os=new WeakSet,Hf=function(t=null){let e=r(this,No).get(t||(t=""));if(!e){const s=document.createElement("canvas");s.style.cssText="position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal",s.lang=t,document.body.append(s),e=s.getContext("2d",{alpha:!1,willReadFrequently:!0}),r(this,No).set(t,e),r(this,wd).set(e,{size:0,family:""})}return e},rA=function(t){t=Math.fround(t);const e=Math.fround(t*((1<<17)+1));return Math.fround(e-Math.fround(e-t))},Um=function(t,e,s){const i=r(this,wd).get(t);e===i.size&&s===i.family||(t.font=`${e}px ${s}`,i.size=e,i.family=s)},nA=function(){if(r(this,Fc)!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),p(this,Fc,t.getBoundingClientRect().height),t.remove()},aA=function(t,e,s){const i=r(this,Dc).get(t);if(i)return i;const n=b(this,os,Hf).call(this,s);b(this,os,Um).call(this,n,ME,t);const a=n.measureText(""),o=a.fontBoundingBoxAscent,l=Math.abs(a.fontBoundingBoxDescent);let c=.8;return o?c=o/(o+l):(_t.platform.isFirefox&&st("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?c=e.ascent:e.descent&&(c=1+e.descent)),r(this,Dc).set(t,c),c},y(Pe,os),y(Pe,Dc,new Map),y(Pe,No,new Map),y(Pe,wd,new WeakMap),y(Pe,Fc,null),y(Pe,Lc,new Set);let Ah=Pe;const OE=100;function oA(u={}){const t=new Hm,{docId:e}=t,s=u.url?NS(u.url):null,i=u.data?BS(u.data):null,n=u.httpHeaders||null,a=u.withCredentials===!0,o=u.password??null,l=u.range instanceof sy?u.range:null,c=Number.isInteger(u.rangeChunkSize)&&u.rangeChunkSize>0?u.rangeChunkSize:2**16;let h=u.worker instanceof _h?u.worker:null;const d=u.verbosity,f=typeof u.docBaseUrl=="string"&&!gf(u.docBaseUrl)?u.docBaseUrl:null,g=bf(u.cMapUrl),m=u.cMapPacked!==!1,v=bf(u.iccUrl),w=bf(u.standardFontDataUrl),A=bf(u.wasmUrl),_=u.stopAtErrors!==!0,E=Number.isInteger(u.maxImageSize)&&u.maxImageSize>-1?u.maxImageSize:-1,S=typeof u.isOffscreenCanvasSupported=="boolean"?u.isOffscreenCanvasSupported:!Gs,x=typeof u.isImageDecoderSupported=="boolean"?u.isImageDecoderSupported:!Gs,T=Number.isInteger(u.canvasMaxAreaInBytes)?u.canvasMaxAreaInBytes:-1,C=typeof u.disableFontFace=="boolean"?u.disableFontFace:Gs,I=u.fontExtraProperties===!0,k=u.enableXfa===!0,M=u.ownerDocument||globalThis.document,R=u.disableRange===!0,N=u.disableStream===!0,F=u.disableAutoFetch===!0,$=u.pdfBug===!0,U=u.CanvasFactory||(Gs?VS:jS),D=u.FilterFactory||(Gs?zS:$S),H=u.BinaryDataFactory||(Gs?WS:Uy),X=u.enableHWA===!0,gt=u.enableWebGPU===!0?qS():Promise.resolve(!1),mt=u.useWasm!==!1,ht=u.pagesMapper||new IE,at=typeof u.useSystemFonts=="boolean"?u.useSystemFonts:!Gs&&!C,Ee=typeof u.useWorkerFetch=="boolean"?u.useWorkerFetch:!!(H===Uy&&g&&m&&w&&A&&ru(g,document.baseURI)&&ru(w,document.baseURI)&&ru(A,document.baseURI)),G=null;lS(d);const L={canvasFactory:new U({ownerDocument:M,enableHWA:X}),filterFactory:new D({docId:e,ownerDocument:M}),binaryDataFactory:Ee?null:new H({cMapUrl:g,standardFontDataUrl:w,wasmUrl:A})};h||(h=_h.create({verbosity:d,port:Ni.workerPort}),t._worker=h);const B={docId:e,apiVersion:"6.4.299",data:i,password:o,disableAutoFetch:F,rangeChunkSize:c,docBaseUrl:f,enableXfa:k,evaluatorOptions:{maxImageSize:E,disableFontFace:C,ignoreErrors:_,isOffscreenCanvasSupported:S,isImageDecoderSupported:x,canvasMaxAreaInBytes:T,fontExtraProperties:I,useSystemFonts:at,useWasm:mt,useWorkerFetch:Ee,cMapUrl:g,cMapPacked:m,iccUrl:v,standardFontDataUrl:w,wasmUrl:A,hasGPU:!1}},rt={ownerDocument:M,pdfBug:$,styleElement:G,enableHWA:X,loadingParams:{disableAutoFetch:F,enableXfa:k}};return Promise.all([h.promise,gt]).then(function([,bt]){if(h.destroyed)throw new Error("Worker was destroyed");B.evaluatorOptions.hasGPU=bt;const tt=h.messageHandler.sendWithPromise("GetDocRequest",B,i?[i.buffer]:null);let ut;if(!i)if(l)ut=new mE({pdfDataRangeTransport:l,disableRange:R,disableStream:N});else if(s){const xt=TE(s);ut=new xt({url:s,httpHeaders:n,withCredentials:a,rangeChunkSize:c,disableRange:R,disableStream:N})}else throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");return tt.then(xt=>{if(h.destroyed)throw new Error("Worker was destroyed");const xe=new Gh(e,xt,h.port),ye=new DE(xe,t,ut,rt,L,ht);if(t._transport=ye,t.destroyed)throw new Error("Loading aborted");xe.send("Ready",null)})}).catch(t._capability.reject).finally(t._setupCapability.resolve),t}var Up;const Hp=class Hp{constructor(){O(this,"_capability",Promise.withResolvers());O(this,"_setupCapability",Promise.withResolvers());O(this,"_transport",null);O(this,"_worker",null);O(this,"docId",`d${Ft(Hp,Up)._++}`);O(this,"destroyed",!1);O(this,"onPassword",null);O(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var t,e,s,i;this.destroyed=!0,this._capability.promise.catch(()=>{});try{(t=this._worker)!=null&&t.port&&(this._worker._pendingDestroy=!0),await this._setupCapability.promise,await((e=this._transport)==null?void 0:e.destroy())}catch(n){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,n}this._transport=null,(i=this._worker)==null||i.destroy(),this._worker=null}async getData(){return this._transport.getData()}};Up=new WeakMap,y(Hp,Up,0);let Hm=Hp;var Nc,Bo;class sy{constructor(t,e,s=!1,i=null){y(this,Nc,Promise.withResolvers());y(this,Bo,null);this.length=t,this.initialData=e,this.progressiveDone=s,this.contentDispositionFilename=i}onDataRange(t,e){r(this,Bo).call(this,{type:"range",begin:t,chunk:e})}onDataProgressiveRead(t){r(this,Nc).promise.then(()=>{r(this,Bo).call(this,{type:"progressiveRead",chunk:t})})}onDataProgressiveDone(){r(this,Nc).promise.then(()=>{r(this,Bo).call(this,{type:"progressiveDone"})})}transportReady(t){p(this,Bo,t),r(this,Nc).resolve()}requestDataRange(t,e){vt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}Nc=new WeakMap,Bo=new WeakMap;class RE{constructor(t,e){this._pdfInfo=t,this._transport=e}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return V(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAttachmentContent(t){return this._transport.getAttachmentContent(t)}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(t){return this._transport.saveDocument(t)}extractPages(t,e=null){return this._transport.extractPages(t,e)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}getSignatures(){return this._transport.getSignatures()}getSignatureData(t){return this._transport.getSignatureData(t)}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Xr,Uo,jp,Ho,qh;const lu=class lu{constructor(t,e,s,i,n=!1){y(this,Ho);y(this,Xr,!1);y(this,Uo,null);this._pageIndex=t,this._id=Ft(lu,jp)._++,this._pageInfo=e,this._transport=s,this._stats=n?new xy:null,this._pdfBug=n,this.commonObjs=s.commonObjs,this.objs=new eA,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,p(this,Uo,i),this.imageCoordinates=null}clone(t){const e=new lu(t,this._pageInfo,this._transport,r(this,Uo),this._pdfBug);return e.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(e),e}get pageNumber(){return this._pageIndex+1}set pageNumber(t){this._pageIndex=t-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:n=!1}={}){return new pf({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}getAnnotations({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return V(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return((t=this._transport._htmlForXfa)==null?void 0:t.children[this._pageIndex])||null}render({canvasContext:t,canvas:e=t.canvas,viewport:s,intent:i="display",annotationMode:n=fn.ENABLE,transform:a=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:c=null,pageColors:h=null,printAnnotationStorage:d=null,isEditing:f=!1,recordImages:g=!1,recordOperations:m=!1,operationsFilter:v=null}){var F,$,U;(F=this._stats)==null||F.time("Overall");const w=this._transport.getRenderingIntent(i,n,d,f),{renderingIntent:A,cacheKey:_}=w;p(this,Xr,!1),l||(l=this._transport.getOptionalContentConfig(A));const E=this._intentStates.getOrInsertComputed(_,pp);E.streamReaderCancelTimeout&&(clearTimeout(E.streamReaderCancelTimeout),E.streamReaderCancelTimeout=null);const S=!!(A&$s.PRINT);E.displayReadyCapability||(E.displayReadyCapability=Promise.withResolvers(),E.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},($=this._stats)==null||$.time("Page Request"),this._pumpOperatorList(w));const x=!!(this._pdfBug&&((U=globalThis.StepperManager)!=null&&U.enabled)),T=!!e&&!this.recordedBBoxes&&(m||x),C=!!e&&!this.imageCoordinates&&g,I=D=>{var H,X,nt,gt;if(E.renderTasks.delete(R),T){const mt=(H=R.gfx)==null?void 0:H.dependencyTracker.take();mt&&((X=R.stepper)==null||X.setOperatorBBoxes(mt,R.gfx.dependencyTracker.takeDebugMetadata()),m&&(this.recordedBBoxes=mt))}C&&!D&&(this.imageCoordinates=(nt=R.gfx)==null?void 0:nt.imagesTracker.take()),S&&p(this,Xr,!0),b(this,Ho,qh).call(this),D?(R.capability.reject(D),this._abortOperatorList({intentState:E,reason:D instanceof Error?D:new Error(D)})):R.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(gt=globalThis.Stats)!=null&&gt.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))};let k=null,M=null;(T||C)&&(M=new TS(e,E.operatorList.length)),T&&(k=new CS(M,x));const R=new $m({callback:I,params:{canvas:e,canvasContext:t,dependencyTracker:k??M,imagesTracker:C?new bm(e):null,viewport:s,transform:a,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:E.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!S,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:v});(E.renderTasks||(E.renderTasks=new Set)).add(R);const N=R.task;return Promise.all([E.displayReadyCapability.promise,l]).then(([D,H])=>{var X;if(this.destroyed){I();return}if((X=this._stats)==null||X.time("Rendering"),!(H.renderingIntent&A))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");R.initializeGraphics({transparency:D,optionalContentConfig:H}),R.operatorListChanged()}).catch(I),N}getOperatorList({intent:t="display",annotationMode:e=fn.ENABLE,printAnnotationStorage:s=null,isEditing:i=!1}={}){var c;function n(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const a=this._transport.getRenderingIntent(t,e,s,i,!0),o=this._intentStates.getOrInsertComputed(a.cacheKey,pp);let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=n,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(c=this._stats)==null||c.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:r(this,Uo).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size:i=>i.items.length})}async getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(i=>uu.textContent(i));const e=this.streamTextContent(t),s={items:[],styles:Object.create(null),lang:null};for await(const i of e)s.lang??(s.lang=i.lang),Object.assign(s.styles,i.styles),s.items.push(...i.items);return s}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const s of e.renderTasks)t.push(s.completed),s.cancel();return this.objs.clear(),p(this,Xr,!1),Promise.all(t)}cleanup(t=!1){p(this,Xr,!0);const e=b(this,Ho,qh).call(this);return t&&e&&this._stats&&(this._stats=new xy),e}_startRenderPage(t,e){var i,n;const s=this._intentStates.get(e);s&&((i=this._stats)==null||i.timeEnd("Page Request"),(n=s.displayReadyCapability)==null||n.resolve(t))}_renderPageChunk(t,e){for(let s=0,i=t.length;s<i;s++)e.operatorList.fnArray.push(t.fnArray[s]),e.operatorList.argsArray.push(t.argsArray[s]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const s of e.renderTasks)s.operatorListChanged();t.lastChunk&&b(this,Ho,qh).call(this)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:s,modifiedIds:i}){const{map:n,transfer:a}=s,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:r(this,Uo).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,pageProxyId:this._id,intent:t,cacheKey:e,annotationStorage:n,modifiedIds:i},void 0,a).getReader(),c=this._intentStates.get(e);c.streamReader=l;const h=()=>{l.read().then(({value:d,done:f})=>{if(f){c.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(d,c),h())},d=>{if(c.streamReader=null,!this._transport.destroyed){if(c.operatorList){c.operatorList.lastChunk=!0;for(const f of c.renderTasks)f.operatorListChanged();b(this,Ho,qh).call(this)}if(c.displayReadyCapability)c.displayReadyCapability.reject(d);else if(c.opListReadCapability)c.opListReadCapability.reject(d);else throw d}})};h()}_abortOperatorList({intentState:t,reason:e,force:s=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!s){if(t.renderTasks.size>0)return;if(e instanceof _g){let i=OE;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new mn(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[i,n]of this._intentStates)if(n===t){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}};Xr=new WeakMap,Uo=new WeakMap,jp=new WeakMap,Ho=new WeakSet,qh=function(){if(!r(this,Xr)||this.destroyed)return!1;for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),p(this,Xr,!1),!0},y(lu,jp,0);let jm=lu;var ra,Pi,Yr,jo,$p,$o,Go,Es,jf,lA,cA,$f,Bc,Gf;const te=class te{constructor({name:t=null,port:e=null,verbosity:s=cS()}={}){y(this,Es);y(this,ra,Promise.withResolvers());y(this,Pi,null);y(this,Yr,null);y(this,jo,null);if(this.name=t,this.destroyed=!1,this.verbosity=s,e){if(r(te,Go).has(e))throw new Error("Cannot use more than one PDFWorker per port.");r(te,Go).set(e,this),b(this,Es,lA).call(this,e)}else b(this,Es,cA).call(this)}get promise(){return r(this,ra).promise}get port(){return r(this,Yr)}get messageHandler(){return r(this,Pi)}destroy(){var t,e;this.destroyed=!0,(t=r(this,jo))==null||t.terminate(),p(this,jo,null),r(te,Go).delete(r(this,Yr)),p(this,Yr,null),(e=r(this,Pi))==null||e.destroy(),p(this,Pi,null)}static create(t){const e=r(this,Go).get(t==null?void 0:t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new te(t)}static get workerSrc(){if(Ni.workerSrc)return Ni.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return V(this,"_setupFakeWorkerGlobal",(async()=>r(this,Bc,Gf)?r(this,Bc,Gf):(await import(this.workerSrc)).WorkerMessageHandler)())}};ra=new WeakMap,Pi=new WeakMap,Yr=new WeakMap,jo=new WeakMap,$p=new WeakMap,$o=new WeakMap,Go=new WeakMap,Es=new WeakSet,jf=function(){r(this,ra).resolve(),r(this,Pi).send("configure",{verbosity:this.verbosity})},lA=function(t){p(this,Yr,t),p(this,Pi,new Gh("main","worker",t)),r(this,Pi).on("ready",()=>{}),b(this,Es,jf).call(this)},cA=function(){if(r(te,$o)||r(te,Bc,Gf)){b(this,Es,$f).call(this);return}let{workerSrc:t}=te;try{te._isSameOrigin(window.location,t)||(t=te._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),s=new Gh("main","worker",e),i=()=>{n.abort(),s.destroy(),e.terminate(),this.destroyed?r(this,ra).reject(new Error("Worker was destroyed")):b(this,Es,$f).call(this)},n=new AbortController;e.addEventListener("error",()=>{r(this,jo)||i()},{signal:n.signal}),s.on("ready",a=>{if(n.abort(),this.destroyed||!(a instanceof Uint8Array)){i();return}p(this,Pi,s),p(this,Yr,e),p(this,jo,e),b(this,Es,jf).call(this)})}catch{vg("The worker has been disabled."),b(this,Es,$f).call(this)}},$f=function(){r(te,$o)||(st("Setting up fake worker."),p(te,$o,!0)),te._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){r(this,ra).reject(new Error("Worker was destroyed"));return}const e=new HS;p(this,Yr,e);const s=`fake${Ft(te,$p)._++}`,i=new Gh(s+"_worker",s,e);t.setup(i,e),p(this,Pi,new Gh(s,s+"_worker",e)),b(this,Es,jf).call(this)}).catch(t=>{r(this,ra).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},Bc=new WeakSet,Gf=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},y(te,Bc),y(te,$p,0),y(te,$o,!1),y(te,Go,new WeakMap),Gs&&(p(te,$o,!0),Ni.workerSrc||(Ni.workerSrc="./pdf.worker.mjs")),te._isSameOrigin=(t,e)=>{const s=URL.parse(t);if(!(s!=null&&s.origin)||s.origin==="null")return!1;const i=new URL(e,s);return s.origin===i.origin},te._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};let _h=te;var Ms,zo,Kr,Ii,Vo,Uc,qr,Ad,fi,Nl,zf;class DE{constructor(t,e,s,i,n,a){y(this,fi);O(this,"downloadInfoCapability",Promise.withResolvers());y(this,Ms,null);y(this,zo,new Map);y(this,Kr,null);y(this,Ii,new Map);y(this,Vo,new Map);y(this,Uc,new Map);y(this,qr,null);y(this,Ad,null);this.messageHandler=t,this.loadingTask=e,p(this,Kr,s),this.commonObjs=new eA,this.fontLoader=new IS({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.enableHWA=i.enableHWA,this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.binaryDataFactory=n.binaryDataFactory,this.pagesMapper=a,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(t){r(this,Ii).set(t._id,t),r(this,Vo).set(t._pageIndex,Promise.resolve(t))}get annotationStorage(){return V(this,"annotationStorage",new ty)}getRenderingIntent(t,e=fn.ENABLE,s=null,i=!1,n=!1){let a=$s.DISPLAY,o=fu;switch(t){case"any":a=$s.ANY;break;case"display":break;case"print":a=$s.PRINT;break;default:st(`getRenderingIntent - invalid intent: ${t}`)}const l=a&$s.PRINT&&s instanceof Aw?s:this.annotationStorage;switch(e){case fn.DISABLE:a+=$s.ANNOTATIONS_DISABLE;break;case fn.ENABLE:break;case fn.ENABLE_FORMS:a+=$s.ANNOTATIONS_FORMS;break;case fn.ENABLE_STORAGE:a+=$s.ANNOTATIONS_STORAGE,o=l.serializable;break;default:st(`getRenderingIntent - invalid annotationMode: ${e}`)}i&&(a+=$s.IS_EDITING),n&&(a+=$s.OPLIST);const{ids:c,hash:h}=l.modifiedIds,d=[a,o.hash,h];return{renderingIntent:a,cacheKey:d.join("_"),annotationStorageSerializable:o,modifiedIds:c}}destroy(){var s;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(s=r(this,qr))==null||s.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of r(this,Ii).values())t.push(i._destroy());r(this,Ii).clear(),r(this,Vo).clear(),r(this,Uc).clear(),Object.hasOwn(this,"annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var i,n;this.commonObjs.clear(),this.fontLoader.clear(),r(this,zo).clear(),this.filterFactory.destroy(),Ah.cleanup(),(i=r(this,Kr))==null||i.cancelAllRequests(new mn("Worker was terminated.")),(n=this.messageHandler)==null||n.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(s,i)=>{ne(r(this,Kr),"GetReader - no `BasePDFStream` instance available."),p(this,Ms,r(this,Kr).getFullReader()),r(this,Ms).onProgress=n=>b(this,fi,zf).call(this,n),i.onPull=()=>{r(this,Ms).read().then(function({value:n,done:a}){if(a){i.close();return}ne(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{i.error(n)})},i.onCancel=n=>{r(this,Ms).cancel(n),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("ReaderHeadersReady",async s=>{await r(this,Ms).headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:a}=r(this,Ms);return i&&n&&(r(this,Ms).onProgress=null),{isStreamingSupported:i,isRangeSupported:n,contentLength:a}}),t.on("GetRangeReader",(s,i)=>{ne(r(this,Kr),"GetRangeReader - no `BasePDFStream` instance available.");const n=r(this,Kr).getRangeReader(s.begin,s.end);if(!n){i.close();return}i.onPull=()=>{n.read().then(function({value:a,done:o}){if(o){i.close();return}ne(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{n.cancel(a),i.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("GetDoc",({pdfInfo:s})=>{this.pagesMapper.pagesNumber=s.numPages,this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,e._capability.resolve(new RE(s,this))}),t.on("DocException",s=>{e._capability.reject(gs(s))}),t.on("PasswordRequest",s=>{p(this,qr,Promise.withResolvers());try{if(!e.onPassword)throw gs(s);const i=n=>{n instanceof Error?r(this,qr).reject(n):r(this,qr).resolve({password:n})};e.onPassword(i,s.code)}catch(i){r(this,qr).reject(i)}return r(this,qr).promise}),t.on("DataLoaded",s=>{b(this,fi,zf).call(this,{loaded:s.length,total:s.length}),this.downloadInfoCapability.resolve(s)}),t.on("StartRenderPage",s=>{if(this.destroyed)return;r(this,Ii).get(s.pageProxyId)._startRenderPage(s.transparency,s.cacheKey)}),t.on("commonobj",([s,i,n])=>{var a;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":if("error"in n){const f=n.error;st(`Error during font loading: ${f}`),this.commonObjs.resolve(s,f);break}const o=new DS(n.buffer),l=this._params.pdfBug&&((a=globalThis.FontInspector)!=null&&a.enabled)?(f,g)=>globalThis.FontInspector.fontAdded(f,g):null,c=new kS(o,l,n.charProcOperatorList,n.extra);this.fontLoader.bind(c).catch(()=>t.sendWithPromise("FontFallback",{id:s})).finally(()=>{c.fontExtraProperties||c.clearData(),this.commonObjs.resolve(s,c)});break;case"CopyLocalImage":const{imageRef:h}=n;ne(h,"The imageRef must be defined.");for(const f of r(this,Ii).values())for(const[,g]of f.objs){if((g==null?void 0:g.ref)!==h)continue;if(!g.dataLen)return null;const m=structuredClone(g);return this.commonObjs.resolve(s,m),g.dataLen}break;case"FontPath":this.commonObjs.resolve(s,new LS(n));break;case"Image":this.commonObjs.resolve(s,n);break;case"Pattern":const d=new FS(n);this.commonObjs.resolve(s,d.getIR());break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([s,i,n,a])=>{var l;if(this.destroyed)return;const o=r(this,Ii).get(i);if(!o.objs.has(s)){if(o._intentStates.size===0){(l=a==null?void 0:a.bitmap)==null||l.close();return}switch(n){case"Image":case"Pattern":o.objs.resolve(s,a);break;default:throw new Error(`Got unknown object type ${n}`)}}}),t.on("DocProgress",s=>{this.destroyed||b(this,fi,zf).call(this,s)}),t.on("FetchBinaryData",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.binaryDataFactory)throw new Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(s)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(t=null){var i;this.annotationStorage.size<=0&&st("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:s}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,supportsPrintToPDF:r(this,Ad)!==null,filename:((i=r(this,Ms))==null?void 0:i.filename)??null},s).finally(()=>{p(this,Ad,null),this.annotationStorage.resetModified()})}extractPages(t,e=null){var a;const s={pageInfos:t};let i;const n=globalThis.ImageBitmap;if(typeof n=="function"){const o=Array.isArray(t)?t:[t];for(const l of o)(l==null?void 0:l.image)instanceof n&&(i||(i=[])).push(l.image)}if(this.annotationStorage.size>0){const o=this.annotationStorage.serializable;let{map:l}=o;(a=o.transfer)!=null&&a.length&&(i?i.push(...o.transfer):i=o.transfer);const c=this.pagesMapper.getMapping();if(c){const h=new Map;for(const[d,f]of l){if((f==null?void 0:f.pageIndex)!==void 0&&f.pageIndex>=0&&f.pageIndex<c.length){const g=(e==null?void 0:e[f.pageIndex])??0,m=c[f.pageIndex]-1;if(m!==f.pageIndex||g!==0){h.set(d,{...f,pageIndex:m,copyLevel:g});continue}}h.set(d,f)}l=h}s.annotationStorage=l}return this.messageHandler.sendWithPromise("ExtractPages",s,i).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this.pagesMapper.pagesNumber)return Promise.reject(new Error("Invalid page request."));const e=t-1,s=this.pagesMapper.getPageId(t)-1,i=r(this,Vo).get(e);if(i)return i;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:s}).then(a=>{if(this.destroyed)throw new Error("Transport destroyed");a.refStr&&r(this,Uc).set(a.refStr,s);const o=new jm(e,a,this,this.pagesMapper,this._params.pdfBug);return r(this,Ii).set(o._id,o),o});return r(this,Vo).set(e,n),n}async getPageIndex(t){if(!_m(t))throw new Error("Invalid pageIndex request.");const e=await this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}),s=this.pagesMapper.getPageNumber(e+1);if(s===0)throw new Error("GetPageIndex: page has been removed.");return s-1}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(t+1)-1,intent:e})}getFieldObjects(){return b(this,fi,Nl).call(this,"GetFieldObjects")}getSignatures(){return b(this,fi,Nl).call(this,"GetSignatures")}getSignatureData(t){return this.messageHandler.sendWithPromise("GetSignatureData",t)}hasJSActions(){return b(this,fi,Nl).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAttachmentContent(t){return this.messageHandler.sendWithPromise("GetAttachmentContent",t)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return b(this,fi,Nl).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return b(this,fi,Nl).call(this,"GetOptionalContentConfig").then(e=>new Dm(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata";return r(this,zo).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,null).then(e=>{var s,i;return{info:e[0],metadata:e[1]?new CE(e[1]):null,contentDispositionFilename:((s=r(this,Ms))==null?void 0:s.filename)??null,contentLength:((i=r(this,Ms))==null?void 0:i.contentLength)??null,hasStructTree:e[2]}}))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of r(this,Ii).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),r(this,zo).clear(),this.filterFactory.destroy(!0),Ah.cleanup()}}cachedPageNumber(t){if(!_m(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`,s=r(this,Uc).get(e);if(s>=0){const i=this.pagesMapper.getPageNumber(s+1);if(i!==0)return i}return null}}Ms=new WeakMap,zo=new WeakMap,Kr=new WeakMap,Ii=new WeakMap,Vo=new WeakMap,Uc=new WeakMap,qr=new WeakMap,Ad=new WeakMap,fi=new WeakSet,Nl=function(t,e=null){return r(this,zo).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,e))},zf=function({loaded:t,total:e}){var s,i;(i=(s=this.loadingTask).onProgress)==null||i.call(s,{loaded:t,total:e,percent:e?Nt(Math.round(t/e*100),0,100):NaN})};class FE{constructor(t){O(this,"_internalRenderTask",null);O(this,"onContinue",null);O(this,"onError",null);this._internalRenderTask=t}get promise(){return this._internalRenderTask.capability.promise}cancel(t=0){this._internalRenderTask.cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=this._internalRenderTask.operatorList;if(!t)return!1;const{annotationCanvasMap:e}=this._internalRenderTask;return t.form||t.canvas&&(e==null?void 0:e.size)>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}}var na,Wo;const Ha=class Ha{constructor({callback:t,params:e,objs:s,commonObjs:i,annotationCanvasMap:n,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:f=null,enableHWA:g=!1,operationsFilter:m=null}){y(this,na,null);this.callback=t,this.params=e,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=c,this._pdfBug=d,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new FE(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvas,this._canvasContext=e.canvas?null:e.canvasContext,this._enableHWA=g,this._dependencyTracker=e.dependencyTracker,this._imagesTracker=e.imagesTracker,this._operationsFilter=m}get completed(){return this.capability.promise.catch(()=>{})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){var c,h;if(this.cancelled)return;if(this._canvas){if(r(Ha,Wo).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");r(Ha,Wo).add(this._canvas)}this._pdfBug&&((c=globalThis.StepperManager)!=null&&c.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:s,transform:i,background:n,dependencyTracker:a,imagesTracker:o}=this.params,l=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new $l(l,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,a,o),this.gfx.beginDrawing({transform:i,viewport:s,transparency:t,background:n}),this.operatorListIdx=0,this.graphicsReady=!0,(h=this.graphicsReadyCallback)==null||h.call(this)}cancel(t=null,e=0){var s,i,n;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),r(this,na)&&(window.cancelAnimationFrame(r(this,na)),p(this,na,null)),r(Ha,Wo).delete(this._canvas),t||(t=new _g(`Rendering cancelled, page ${this._pageIndex+1}`,e)),this.callback(t),(n=(i=this.task).onError)==null||n.call(i,t)}operatorListChanged(){var t,e;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(t=this.gfx.dependencyTracker)==null||t.growOperationsCount(this.operatorList.fnArray.length),(e=this.stepper)==null||e.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?p(this,na,window.requestAnimationFrame(()=>{p(this,na,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),r(Ha,Wo).delete(this._canvas),this.callback())))}};na=new WeakMap,Wo=new WeakMap,y(Ha,Wo,new WeakSet);let $m=Ha;const hA="6.4.299",uA="d0991a0d5";G0();var Os,Xo,Hc,Ae,_d,jc,Jr,Sd,aa,ki,Ed,kt,Gm,zm,Vm,La,dA,_n;const vs=class vs{constructor({editor:t=null,uiManager:e=null}){y(this,kt);y(this,Os,null);y(this,Xo,null);y(this,Hc);y(this,Ae,null);y(this,_d,!1);y(this,jc,!1);y(this,Jr,null);y(this,Sd);y(this,aa,null);y(this,ki,null);var s,i;t?(p(this,jc,!1),p(this,Jr,t)):p(this,jc,!0),p(this,ki,(t==null?void 0:t._uiManager)||e),p(this,Sd,r(this,ki)._eventBus),p(this,Hc,((s=t==null?void 0:t.color)==null?void 0:s.toUpperCase())||((i=r(this,ki))==null?void 0:i.highlightColors.values().next().value)||"#FFFF98"),r(vs,Ed)||p(vs,Ed,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return V(this,"_keyboardManager",new bl([[["Escape"],vs.prototype._hideDropdownFromKeyboard],[["Space"],vs.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight"],vs.prototype._moveToNext],[["ArrowUp","ArrowLeft"],vs.prototype._moveToPrevious],[["Home"],vs.prototype._moveToBeginning],[["End"],vs.prototype._moveToEnd]]))}renderButton(){const t=p(this,Os,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",r(this,Jr)&&(t.ariaControls=`${r(this,Jr).id}_colorpicker_dropdown`);const e=r(this,ki)._signal;t.addEventListener("click",b(this,kt,La).bind(this),{signal:e}),t.addEventListener("keydown",b(this,kt,Vm).bind(this),{signal:e});const s=p(this,Xo,document.createElement("span"));return s.className="swatch",s.ariaHidden="true",s.style.backgroundColor=r(this,Hc),t.append(s),t}renderMainDropdown(){const t=p(this,Ae,b(this,kt,Gm).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===r(this,Os)){b(this,kt,La).call(this,t);return}const e=t.target.getAttribute("data-color");e&&b(this,kt,zm).call(this,e,t)}_moveToNext(t){var e,s;if(!r(this,kt,_n)){b(this,kt,La).call(this,t);return}if(t.target===r(this,Os)){(e=r(this,Ae).firstElementChild)==null||e.focus();return}(s=t.target.nextSibling)==null||s.focus()}_moveToPrevious(t){var e,s;if(t.target===((e=r(this,Ae))==null?void 0:e.firstElementChild)||t.target===r(this,Os)){r(this,kt,_n)&&this._hideDropdownFromKeyboard();return}r(this,kt,_n)||b(this,kt,La).call(this,t),(s=t.target.previousSibling)==null||s.focus()}_moveToBeginning(t){var e;if(!r(this,kt,_n)){b(this,kt,La).call(this,t);return}(e=r(this,Ae).firstElementChild)==null||e.focus()}_moveToEnd(t){var e;if(!r(this,kt,_n)){b(this,kt,La).call(this,t);return}(e=r(this,Ae).lastElementChild)==null||e.focus()}hideDropdown(){var t,e;(t=r(this,Ae))==null||t.classList.add("hidden"),r(this,Os).ariaExpanded="false",(e=r(this,aa))==null||e.abort(),p(this,aa,null)}_hideDropdownFromKeyboard(){var t;if(!r(this,jc)){if(!r(this,kt,_n)){(t=r(this,Jr))==null||t.unselect();return}this.hideDropdown(),r(this,Os).focus({preventScroll:!0,focusVisible:r(this,_d)})}}update(t){if(r(this,Xo)&&(r(this,Xo).style.backgroundColor=t),!r(this,Ae))return;const e=r(this,ki).highlightColors.values();for(const s of r(this,Ae).children)s.ariaSelected=e.next().value===t.toUpperCase()}destroy(){var t,e;(t=r(this,Os))==null||t.remove(),p(this,Os,null),p(this,Xo,null),(e=r(this,Ae))==null||e.remove(),p(this,Ae,null)}};Os=new WeakMap,Xo=new WeakMap,Hc=new WeakMap,Ae=new WeakMap,_d=new WeakMap,jc=new WeakMap,Jr=new WeakMap,Sd=new WeakMap,aa=new WeakMap,ki=new WeakMap,Ed=new WeakMap,kt=new WeakSet,Gm=function(){const t=document.createElement("div"),e=r(this,ki)._signal;t.addEventListener("contextmenu",gi,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),r(this,Jr)&&(t.id=`${r(this,Jr).id}_colorpicker_dropdown`);for(const[s,i]of r(this,ki).highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",i),n.title=s,n.setAttribute("data-l10n-id",r(vs,Ed)[s]);const a=document.createElement("span");n.append(a),a.className="swatch",a.style.backgroundColor=i,n.ariaSelected=i===r(this,Hc),n.addEventListener("click",b(this,kt,zm).bind(this,i),{signal:e}),t.append(n)}return t.addEventListener("keydown",b(this,kt,Vm).bind(this),{signal:e}),t},zm=function(t,e){e.stopPropagation(),r(this,Sd).dispatch("switchannotationeditorparams",{source:this,type:dt.HIGHLIGHT_COLOR,value:t}),this.update(t)},Vm=function(t){vs._keyboardManager.exec(this,t)},La=function(t){if(r(this,kt,_n)){this.hideDropdown();return}if(p(this,_d,t.detail===0),r(this,aa)||(p(this,aa,new AbortController),window.addEventListener("pointerdown",b(this,kt,dA).bind(this),{signal:r(this,ki).combinedSignal(r(this,aa))})),r(this,Os).ariaExpanded="true",r(this,Ae)){r(this,Ae).classList.remove("hidden");return}const e=p(this,Ae,b(this,kt,Gm).call(this));r(this,Os).append(e)},dA=function(t){var e;(e=r(this,Ae))!=null&&e.contains(t.target)||this.hideDropdown()},_n=function(){return r(this,Ae)&&!r(this,Ae).classList.contains("hidden")},y(vs,Ed,null);let gu=vs;var Rs,$c,Yo,Qr,xd;const ja=class ja{constructor(t){y(this,Rs,null);y(this,$c,!1);y(this,Yo,null);y(this,Qr,null);p(this,Yo,t),p(this,Qr,t._uiManager),r(ja,xd)||p(ja,xd,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(r(this,Rs))return r(this,Rs);const{editorType:t,colorType:e,colorAndOpacityType:s,opacityType:i,color:n,opacity:a}=r(this,Yo),o=p(this,$c,_t.isAlphaColorInputSupported&&i!==void 0),l=p(this,Rs,document.createElement("input"));if(l.type="color",o){l.setAttribute("alpha","");const c=j.hexNums[Math.round((a??1)*255)];l.value=(n||"#000000")+c}else l.value=n||"#000000";return l.className="basicColorPicker",l.tabIndex=0,l.setAttribute("data-l10n-id",r(ja,xd)[t]),l.addEventListener("input",()=>{if(o){const c=Il(l.value);if(!c)return;const[h,d,f,g]=c,m=j.makeHexColor(h,d,f);s!==void 0?r(this,Qr).updateParams(s,{color:m,opacity:g}):(r(this,Qr).updateParams(e,m),r(this,Qr).updateParams(i,g))}else r(this,Qr).updateParams(e,l.value)},{signal:r(this,Qr)._signal}),l}update(t){if(r(this,Rs))if(r(this,$c)){const e=j.hexNums[Math.round(r(this,Yo).opacity*255)];r(this,Rs).value=t+e}else r(this,Rs).value=t}updateOpacity(t){if(!r(this,Rs)||!r(this,$c))return;const e=j.hexNums[Math.round(t*255)];r(this,Rs).value=r(this,Yo).color+e}destroy(){var t;(t=r(this,Rs))==null||t.remove(),p(this,Rs,null)}hideDropdown(){}};Rs=new WeakMap,$c=new WeakMap,Yo=new WeakMap,Qr=new WeakMap,xd=new WeakMap,y(ja,xd,null);let vp=ja;R0();function Jy(u){return Math.floor(Nt(u,0,1)*255).toString(16).padStart(2,"0")}function Dh(u){return Nt(u,0,1)*255}class Qy{static CMYK_G([t,e,s,i]){return["G",1-Math.min(1,.3*t+.59*s+.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=Dh(t),[t,t,t]}static G_HTML([t]){const e=Jy(t);return`#${e}${e}${e}`}static RGB_G([t,e,s]){return["G",.3*t+.59*e+.11*s]}static RGB_rgb(t){return t.map(Dh)}static RGB_HTML(t){return`#${t.map(Jy).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,s,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,s+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,s,i]){return[Dh(1-Math.min(1,t+i)),Dh(1-Math.min(1,s+i)),Dh(1-Math.min(1,e+i))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,s]){const i=1-t,n=1-e,a=1-s,o=Math.min(i,n,a);return["CMYK",i,n,a,o]}}class LE{create(t,e,s=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){vt("Abstract method `_createSVG` called.")}}class mu extends LE{_createSVG(t){return document.createElementNS(ns,t)}}const NE=9,wl=new WeakSet,BE=new Date().getTimezoneOffset()*60*1e3;class $g{static create(t){switch(t.data.annotationType){case $t.LINK:return new iy(t);case $t.TEXT:return new HE(t);case $t.WIDGET:switch(t.data.fieldType){case"Tx":return new jE(t);case"Btn":return t.data.radioButton?new zE(t):t.data.checkBox?new GE(t):new VE(t);case"Ch":return new WE(t);case"Sig":return new $E(t)}return new kl(t);case $t.POPUP:return new Xm(t);case $t.FREETEXT:return new bA(t);case $t.LINE:return new YE(t);case $t.SQUARE:return new KE(t);case $t.CIRCLE:return new qE(t);case $t.POLYLINE:return new wA(t);case $t.CARET:return new QE(t);case $t.INK:return new ry(t);case $t.POLYGON:return new JE(t);case $t.HIGHLIGHT:return new AA(t);case $t.UNDERLINE:return new ZE(t);case $t.SQUIGGLY:return new tx(t);case $t.STRIKEOUT:return new ex(t);case $t.STAMP:return new _A(t);case $t.FILEATTACHMENT:return new sx(t);case $t.RICHMEDIA:case $t.SCREEN:case $t.SOUND:return new SA(t);default:return new Xt(t)}}}var Ko,Gc,ci,Td,Wm;const py=class py{constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){y(this,Td);y(this,Ko,null);y(this,Gc,!1);y(this,ci,null);this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,this.hasOwnCommentButton=!1,e&&(this.contentElement=this.container=this._createContainer(s)),i&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t!=null&&t.str||e!=null&&e.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return py._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var s;const{data:t}=this,e=(s=this.annotationStorage)==null?void 0:s.getEditor(t.id);return e?e.getData():t}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){var o;const t=(o=this.annotationStorage)==null?void 0:o.getEditor(this.data.id);if(t)return t.commentButtonPositionInPage;const{quadPoints:e,inkLists:s,rect:i}=this.data;let n=-1/0,a=-1/0;if((e==null?void 0:e.length)>=8){for(let l=0;l<e.length;l+=8)e[l+1]>a?(a=e[l+1],n=e[l+2]):e[l+1]===a&&(n=Math.max(n,e[l+2]));return[n,a]}if((s==null?void 0:s.length)>=1){for(const l of s)for(let c=0,h=l.length;c<h;c+=2)l[c+1]>a?(a=l[c+1],n=l[c]):l[c+1]===a&&(n=Math.max(n,l[c]));if(n!==1/0)return[n,a]}return i?[i[2],i[3]]:null}_normalizePoint(t){const{page:{view:e},viewport:{rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:a}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-n)/s,t[1]=100*(t[1]-a)/i,t}get commentText(){var e,s,i;const{data:t}=this;return((s=(e=this.annotationStorage.getRawValue(`${wh}${t.id}`))==null?void 0:e.popup)==null?void 0:s.contents)||((i=t.contentsObj)==null?void 0:i.str)||""}set commentText(t){const{data:e}=this,s={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:s})||this.annotationStorage.setValue(`${wh}${e.id}`,{id:e.id,annotationType:e.annotationType,page:this.parent.page,popup:s,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){var t,e;(e=((t=r(this,ci))==null?void 0:t.popup)||this.popup)==null||e.remove(),p(this,ci,this.popup=null)}updateEdited(t){var n;if(!this.container)return;t.rect&&(r(this,Ko)||p(this,Ko,{rect:this.data.rect.slice(0)}));const{rect:e,popup:s}=t;e&&b(this,Td,Wm).call(this,e);let i=((n=r(this,ci))==null?void 0:n.popup)||this.popup;!i&&(s!=null&&s.text)&&(this._createPopup(s),i=r(this,ci).popup),i&&(i.updateEdited(t),s!=null&&s.deleted&&(i.remove(),p(this,ci,null),this.popup=null))}resetEdited(){var t;r(this,Ko)&&(b(this,Td,Wm).call(this,r(this,Ko).rect),(t=r(this,ci))==null||t.popup.resetEdited(),p(this,Ko,null))}_createContainer(t){const{data:e,parent:{page:s,viewport:i}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),!(this instanceof kl)&&!(this instanceof iy)&&!(this instanceof SA)&&(n.tabIndex=0);const{style:a}=n;if(a.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof Xm){const{rotation:v}=e;return!e.hasOwnCanvas&&v!==0&&this.setRotation(v,n),n}const{width:o,height:l}=this;if(!t&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;const v=e.borderStyle.horizontalCornerRadius,w=e.borderStyle.verticalCornerRadius;if(v>0||w>0){const _=`calc(${v}px * var(--total-scale-factor)) / calc(${w}px * var(--total-scale-factor))`;a.borderRadius=_}switch(e.borderStyle.style){case Dl.SOLID:a.borderStyle="solid";break;case Dl.DASHED:a.borderStyle="dashed";break;case Dl.BEVELED:st("Unimplemented border style: beveled");break;case Dl.INSET:st("Unimplemented border style: inset");break;case Dl.UNDERLINE:a.borderBottomStyle="solid";break}const A=e.borderColor||null;A?(p(this,Gc,!0),a.borderColor=j.makeHexColor(...A)):a.borderWidth=0}const c=j.normalizeRect([e.rect[0],s.view[3]-e.rect[1]+s.view[1],e.rect[2],s.view[3]-e.rect[3]+s.view[1]]),{pageWidth:h,pageHeight:d,pageX:f,pageY:g}=i.rawDims;a.left=`${100*(c[0]-f)/h}%`,a.top=`${100*(c[1]-g)/d}%`;const{rotation:m}=e;return e.hasOwnCanvas||m===0?(a.width=`${100*o/h}%`,a.height=`${100*l/d}%`):this.setRotation(m,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims;let{width:n,height:a}=this;t%180!==0&&([n,a]=[a,n]),e.style.width=`${100*n/s}%`,e.style.height=`${100*a/i}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,s,i)=>{const n=i.detail[e],a=n[0],o=n.slice(1);i.target.style[s]=Qy[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[s]:Qy[`${a}_rgb`](o)})};return V(this,"_commonActions",{display:e=>{const{display:s}=e.detail,i=s%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:s===1||s===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:s}=e.detail;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:s,noView:s})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{const s=e.detail.rotation;this.setRotation(s),this.annotationStorage.setValue(this.data.id,{rotation:s})}})}_dispatchEventFromSandbox(t,e){const s=this._commonActions;for(const i of Object.keys(e.detail)){const n=t[i]||s[i];n==null||n(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const s=this._commonActions;for(const[i,n]of Object.entries(e)){const a=s[i];if(a){const o={detail:{[i]:n},target:t};a(o),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,s,i,n]=this.data.rect.map(Math.fround);if(t.length===8){const[v,w,A,_]=t.subarray(2,6);if(i===v&&n===w&&e===A&&s===_)return}const{style:a}=this.container;let o;if(r(this,Gc)){const{borderColor:v,borderWidth:w}=a;a.borderWidth=0,o=["url('data:image/svg+xml;utf8,",`<svg xmlns="${ns}" preserveAspectRatio="none" viewBox="0 0 1 1">`,`<g fill="transparent" stroke="${v}" stroke-width="${w}">`],this.container.classList.add("hasBorder")}const l=i-e,c=n-s,{svgFactory:h}=this,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0),d.role="none";const f=h.createElement("defs");d.append(f);const g=h.createElement("clipPath"),m=`clippath_${this.data.id}`;g.setAttribute("id",m),g.setAttribute("clipPathUnits","objectBoundingBox"),f.append(g);for(let v=2,w=t.length;v<w;v+=8){const A=t[v],_=t[v+1],E=t[v+2],S=t[v+3],x=h.createElement("rect"),T=(E-e)/l,C=(n-_)/c,I=(A-E)/l,k=(_-S)/c;x.setAttribute("x",T),x.setAttribute("y",C),x.setAttribute("width",I),x.setAttribute("height",k),g.append(x),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${T}" y="${C}" width="${I}" height="${k}"/>`)}r(this,Gc)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(d),this.container.style.clipPath=`url(#${m})`}_createPopup(t=null){const{data:e}=this;let s,i;t?(s={str:t.text},i=t.date):(s=e.contentsObj,i=e.modificationDate),p(this,ci,new Xm({data:{color:e.color,titleObj:e.titleObj,modificationDate:i,contentsObj:s,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}))}get hasPopupElement(){return!!(r(this,ci)||this.popup||this.data.popupRef)}get extraPopupElement(){return r(this,ci)}render(){vt("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects.get(t)||[];for(const{page:n,id:a,exportValues:o}of i){if(n===-1||a===e)continue;const l=typeof o=="string"?o:null,c=document.querySelector(`[data-element-id="${a}"]`);if(c&&!wl.has(c)){st(`_getElementsByName - element not allowed: ${a}`);continue}s.push({id:a,exportValue:l,domElement:c})}return s}for(const i of document.getElementsByName(t)){const{exportValue:n}=i,a=i.getAttribute("data-element-id");a===e||!wl.has(i)||s.push({id:a,exportValue:n,domElement:i})}return s}show(){var t;this.container&&(this.container.hidden=!1),(t=this.popup)==null||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),(t=this.popup)==null||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var s;(s=this.linkService.eventBus)==null||s.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}updateOC(t){if(!this.data.oc||!t)return;t.isVisible(this.data.oc)?this.show():this.hide()}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":j.makeHexColor(...e)}};Ko=new WeakMap,Gc=new WeakMap,ci=new WeakMap,Td=new WeakSet,Wm=function(t){const{container:{style:e},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:l}}}}=this;s==null||s.splice(0,4,...t),e.left=`${100*(t[0]-o)/n}%`,e.top=`${100*(a-t[3]+l)/a}%`,i===0?(e.width=`${100*(t[2]-t[0])/n}%`,e.height=`${100*(t[3]-t[1])/a}%`):this.setRotation(i)};let Xt=py;class UE extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:t}=this;t.hasComment&&this._createPopup(t.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){this.editor.comment=t,t||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}}var Vs,Na,fA,pA;class iy extends Xt{constructor(e,s=null){super(e,{isRenderable:!0,ignoreBorder:!!(s!=null&&s.ignoreBorder),createQuadrilaterals:!0});y(this,Vs);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:s}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let n=!1;return e.url?(s.addLinkAttributes(i,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(i,e.action,e.overlaidText),n=!0):e.attachment?(b(this,Vs,fA).call(this,i,e.attachmentId,e.attachment,e.overlaidText,e.attachmentDest),n=!0):e.setOCGState?(b(this,Vs,pA).call(this,i,e.setOCGState,e.overlaidText),n=!0):e.dest?(this._bindLink(i,e.dest,e.overlaidText),n=!0):(e.actions&&(e.actions.has("Action")||e.actions.has("Mouse Up")||e.actions.has("Mouse Down"))&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),n=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&(this.contentElement=i,this.container.append(i)),this.container}_bindLink(e,s,i=""){e.href=this.linkService.getDestinationHash(s),e.onclick=()=>(s&&this.linkService.goToDestination(s),!1),(s||s==="")&&b(this,Vs,Na).call(this),i&&(e.title=i)}_bindNamedAction(e,s,i=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(s),!1),i&&(e.title=i),b(this,Vs,Na).call(this)}_bindJSAction(e,{actions:s,id:i,overlaidText:n}){e.href=this.linkService.getAnchorUrl("");const a=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const o of s.keys()){const l=a.get(o);l&&(e[l]=()=>{var c;return(c=this.linkService.eventBus)==null||c.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:o}}),!1})}n&&(e.title=n),e.onclick||(e.onclick=()=>!1),b(this,Vs,Na).call(this)}_bindResetFormAction(e,s){const i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),b(this,Vs,Na).call(this),!this._fieldObjects){st('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(e.onclick=()=>!1);return}e.onclick=()=>{var d;i==null||i();const{fields:n,refs:a,include:o}=s,l=[];if(n.length!==0||a.length!==0){const f=new Set(a);for(const m of n){const v=this._fieldObjects.get(m)||[];for(const{id:w}of v)f.add(w)}const g=new Map;for(const m of this._fieldObjects.values())for(const{id:v,kidIds:w}of m)w&&g.set(v,w);for(const m of f)for(const v of g.get(m)||[])f.add(v);for(const m of this._fieldObjects.values())for(const v of m)f.has(v.id)===o&&l.push(v)}else for(const f of this._fieldObjects.values())l.push(...f);const c=this.annotationStorage,h=[];for(const f of l){const{id:g}=f;switch(h.push(g),f.type){case"text":{const v=f.defaultValue||"";c.setValue(g,{value:v});break}case"checkbox":case"radiobutton":{const v=f.defaultValue===f.exportValues;c.setValue(g,{value:v});break}case"combobox":case"listbox":{const v=f.defaultValue||"";c.setValue(g,{value:v});break}default:continue}const m=document.querySelector(`[data-element-id="${g}"]`);if(m){if(!wl.has(m)){st(`_bindResetFormAction - element not allowed: ${g}`);continue}}else continue;m.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((d=this.linkService.eventBus)==null||d.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}})),!1}}}Vs=new WeakSet,Na=function(){this.container.setAttribute("data-internal-link","")},fA=function(e,s,i,n="",a=null){e.href=this.linkService.getAnchorUrl(""),i.description?e.title=i.description:n&&(e.title=n);const o=async()=>{var c;const l=await this.linkService.getAttachmentContent(s);l&&((c=this.downloadManager)==null||c.openOrDownloadData(l,i.filename,a))};e.onclick=()=>(o(),!1),b(this,Vs,Na).call(this)},pA=function(e,s,i=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(s),!1),i&&(e.title=i),b(this,Vs,Na).call(this)};class HE extends Xt{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(t),this.container}}class kl extends Xt{render(){return this.container}_getKeyModifier(t){return _t.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,s,i,n){s.includes("mouse")?t.addEventListener(s,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):t.addEventListener(s,a=>{var o;if(s==="blur"){if(!e.focused||!a.relatedTarget)return;e.focused=!1}else if(s==="focus"){if(e.focused)return;e.focused=!0}n&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a)}}))})}_setEventListeners(t,e,s,i){const{actions:n}=this.data;for(const[a,o]of s)(o==="Action"||n!=null&&n.has(o))&&((o==="Focus"||o==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,a,o,i),o==="Focus"&&!(n!=null&&n.has("Blur"))?this._setEventListener(t,e,"blur","Blur",null):o==="Blur"&&!(n!=null&&n.has("Focus"))&&this._setEventListener(t,e,"focus","Focus",null))}_setTextStyle(t){const e=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||NE,n=t.style;let a;const o=2,l=c=>Math.round(10*c)/10;if(this.data.multiLine){const c=Math.abs(this.data.rect[3]-this.data.rect[1]-o),h=Math.round(c/(1.35*i))||1,d=c/h;a=Math.min(i,l(d/1.35))}else{const c=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(i,l(c/1.35))}n.fontSize=`calc(${a}px * var(--total-scale-factor))`,n.color=j.makeHexColor(...s),this.data.textAlignment!==null&&!this.data.comb&&(n.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class jE extends kl{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,s,i){const n=this.annotationStorage;for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=s),n.setValue(a.id,{[i]:s})}render(){var i,n;const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const a=t.getValue(e,{value:this.data.fieldValue});let o=a.value||"";const l=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let c=a.formattedValue||((i=this.data.textContent)==null?void 0:i.join(`
48
+ `))||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const h={userValue:o,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=c??o,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type=this.data.password?"password":"text",s.setAttribute("value",c??o),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(this.container.classList.add("hasOwnCanvas"),t.has(e)&&this.container.classList.add("sandboxModified")),wl.add(s),this.contentElement=s,s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=0;const{datetimeFormat:d,datetimeType:f,timeStep:g}=this.data,m=!!f&&this.enableScripting;d&&(s.title=d),this._setRequired(s,this.data.required),l&&(s.maxLength=l),s.addEventListener("input",w=>{t.setValue(e,{value:w.target.value}),this.setPropertyOnSiblings(s,"value",w.target.value,"value"),h.formattedValue=null}),s.addEventListener("resetform",w=>{const A=this.data.defaultFieldValue??"";s.value=h.userValue=A,h.formattedValue=null});let v=w=>{const{formattedValue:A}=h;A!=null&&(w.target.value=A),w.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",A=>{var E;if(h.focused)return;const{target:_}=A;if(m&&(_.type=f,g&&(_.step=g)),h.userValue){const S=h.userValue;if(m)if(f==="time"){const x=new Date(S),T=[x.getHours(),x.getMinutes(),x.getSeconds()];_.value=T.map(C=>C.toString().padStart(2,"0")).join(":")}else _.value=new Date(S-BE).toISOString().split(f==="date"?"T":".",1)[0];else _.value=S}h.lastCommittedValue=_.value,h.commitKey=1,(E=this.data.actions)!=null&&E.has("Focus")||(h.focused=!0)}),s.addEventListener("updatefromsandbox",A=>{this.container.classList.add("sandboxModified");const _={value(E){h.userValue=E.detail.value??"",m||t.setValue(e,{value:h.userValue.toString()}),E.target.value=h.userValue},formattedValue(E){const{formattedValue:S}=E.detail;h.formattedValue=S,S!=null&&E.target!==document.activeElement&&(E.target.value=S);const x={formattedValue:S};m&&(x.value=S),t.setValue(e,x)},selRange(E){E.target.setSelectionRange(...E.detail.selRange)},charLimit:E=>{var C;const{charLimit:S}=E.detail,{target:x}=E;if(S===0){x.removeAttribute("maxLength");return}x.setAttribute("maxLength",S);let T=h.userValue;!T||T.length<=S||(T=T.slice(0,S),x.value=h.userValue=T,t.setValue(e,{value:T}),(C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:T,willCommit:!0,commitKey:1,selStart:x.selectionStart,selEnd:x.selectionEnd}}))}};this._dispatchEventFromSandbox(_,A)}),s.addEventListener("keydown",A=>{var S;h.commitKey=1;let _=-1;if(A.key==="Escape"?_=0:A.key==="Enter"&&!this.data.multiLine?_=2:A.key==="Tab"&&(h.commitKey=3),_===-1)return;const{value:E}=A.target;h.lastCommittedValue!==E&&(h.lastCommittedValue=E,h.userValue=E,(S=this.linkService.eventBus)==null||S.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:E,willCommit:!0,commitKey:_,selStart:A.target.selectionStart,selEnd:A.target.selectionEnd}}))});const w=v;v=null,s.addEventListener("blur",A=>{var S,x;if(!h.focused||!A.relatedTarget)return;(S=this.data.actions)!=null&&S.has("Blur")||(h.focused=!1);const{target:_}=A;let{value:E}=_;if(m){if(E&&f==="time"){const T=E.split(":").map(C=>parseInt(C,10));E=new Date(2e3,0,1,T[0],T[1],T[2]||0).valueOf(),_.step=""}else E.includes("T")||(E=`${E}T00:00`),E=new Date(E).valueOf();_.type="text"}h.userValue=E,h.lastCommittedValue!==E&&((x=this.linkService.eventBus)==null||x.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:E,willCommit:!0,commitKey:h.commitKey,selStart:A.target.selectionStart,selEnd:A.target.selectionEnd}})),w(A)}),(n=this.data.actions)!=null&&n.has("Keystroke")&&s.addEventListener("beforeinput",A=>{var k;h.lastCommittedValue=null;const{data:_,target:E}=A,{value:S,selectionStart:x,selectionEnd:T}=E;let C=x,I=T;switch(A.inputType){case"deleteWordBackward":{const M=/\w/;for(;C>0&&!M.test(S[C-1]);)C--;for(;C>0&&M.test(S[C-1]);)C--;break}case"deleteWordForward":{const M=S.substring(x).match(/^\W*\w*/);M&&(I+=M[0].length);break}case"deleteContentBackward":x===T&&(C-=1);break;case"deleteContentForward":x===T&&(I+=1);break}A.preventDefault(),(k=this.linkService.eventBus)==null||k.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:S,change:_||"",willCommit:!1,selStart:C,selEnd:I}})}),this._setEventListeners(s,h,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],A=>A.target.value)}if(v&&s.addEventListener("blur",v),this.data.comb){const A=(this.data.rect[2]-this.data.rect[0])/l;s.classList.add("comb"),s.style.setProperty("--comb-width",`calc(${A}px * var(--total-scale-factor))`);const _=this.data.textAlignment;if(_===1||_===2){const E=()=>{const S=l-s.value.length;s.style.setProperty("--comb-offset",`${_===1?S>>1:S}`)};E();for(const S of["input","blur","resetform","updatefromsandbox"])s.addEventListener(S,E)}}}else s=document.createElement("div"),s.textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class $E extends kl{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class GE extends kl{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.exportValue===e.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",t.setValue(s,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return wl.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=0,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const c of this._getElementsByName(o,s)){const h=l&&c.exportValue===e.exportValue;c.domElement&&(c.domElement.checked=h),t.setValue(c.id,{value:h})}t.setValue(s,{value:l})}),n.addEventListener("resetform",a=>{const o=e.defaultFieldValue||"Off";a.target.checked=o===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",a=>{const o={value(l){l.target.checked=l.detail.value!=="Off",t.setValue(s,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class zE extends kl{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.buttonValue!==null&&e.fieldValue===e.buttonValue}).value;if(typeof i=="string"&&(i=i!==e.buttonValue,t.setValue(s,{value:i})),i)for(const a of this._getElementsByName(e.fieldName,s))t.setValue(a.id,{value:!1});const n=document.createElement("input");if(wl.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.tabIndex=0,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const c of this._getElementsByName(o,s))t.setValue(c.id,{value:!1});t.setValue(s,{value:l})}),n.addEventListener("resetform",a=>{const o=e.defaultFieldValue;a.target.checked=o!=null&&o===e.buttonValue}),this.enableScripting&&this.hasJSActions){const a=e.buttonValue;n.addEventListener("updatefromsandbox",o=>{const l={value:c=>{const h=a===c.detail.value;for(const d of this._getElementsByName(c.target.name)){const f=h&&d.id===s;d.domElement&&(d.domElement.checked=f),t.setValue(d.id,{value:f})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}return this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class VE extends iy{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",s=>{this._dispatchEventFromSandbox({},s)})),t}}class WE extends kl{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,s=t.getValue(e,{value:this.data.fieldValue}),i=document.createElement("select");wl.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=0;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",d=>{const f=this.data.defaultFieldValue;for(const g of i.options)g.selected=g.value===f});const a=(d,f)=>{const g=f.replaceAll(" "," ");d.textContent=g,g!==f&&d.setAttribute("display-value",f)};for(const d of this.data.options){const f=document.createElement("option");a(f,d.displayValue),f.value=d.exportValue,s.value.includes(d.exportValue)&&(f.setAttribute("selected",!0),n=!1),i.append(f)}let o=null;if(n){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),i.prepend(d),o=()=>{d.remove(),i.removeEventListener("input",o),o=null},i.addEventListener("input",o)}const l=d=>{const f=d?"value":"textContent",{options:g,multiple:m}=i;return m?Array.prototype.filter.call(g,v=>v.selected).map(v=>v[f]):g.selectedIndex===-1?null:g[g.selectedIndex][f]};let c=l(!1);const h=d=>{const f=d.target.options;return Array.prototype.map.call(f,g=>({displayValue:g.getAttribute("display-value")||g.textContent,exportValue:g.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",d=>{const f={value(g){o==null||o();const m=g.detail.value,v=new Set(Array.isArray(m)?m:[m]);for(const w of i.options)w.selected=v.has(w.value);t.setValue(e,{value:l(!0)}),c=l(!1)},multipleSelection(g){i.multiple=!0},remove(g){const m=i.options,v=g.detail.remove;m[v].selected=!1,i.remove(v),m.length>0&&Array.prototype.findIndex.call(m,A=>A.selected)===-1&&(m[0].selected=!0),t.setValue(e,{value:l(!0),items:h(g)}),c=l(!1)},clear(g){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),c=l(!1)},insert(g){const{index:m,displayValue:v,exportValue:w}=g.detail.insert,A=i.children[m],_=document.createElement("option");a(_,v),_.value=w,A?A.before(_):i.append(_),t.setValue(e,{value:l(!0),items:h(g)}),c=l(!1)},items(g){const{items:m}=g.detail;for(;i.length!==0;)i.remove(0);for(const v of m){const{displayValue:w,exportValue:A}=v,_=document.createElement("option");a(_,w),_.value=A,i.append(_)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:l(!0),items:h(g)}),c=l(!1)},indices(g){const m=new Set(g.detail.indices);for(const v of g.target.options)v.selected=m.has(v.index);t.setValue(e,{value:l(!0)}),c=l(!1)},editable(g){g.target.disabled=!g.detail.editable}};this._dispatchEventFromSandbox(f,d)}),i.addEventListener("input",d=>{var m;const f=l(!0),g=l(!1);t.setValue(e,{value:f}),d.preventDefault(),(m=this.linkService.eventBus)==null||m.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:c,change:g,changeEx:f,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):i.addEventListener("input",function(d){t.setValue(e,{value:l(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}var Cd,Ym;class Xm extends Xt{constructor(e){const{data:s,elements:i,parent:n}=e,a=!!n._commentManager;super(e,{isRenderable:!a&&Xt._hasPopupData(s)});y(this,Cd);if(this.elements=i,a&&Xt._hasPopupData(s)){const o=this.popup=b(this,Cd,Ym).call(this);for(const l of i)l.popup=o}else this.popup=null}render(){const{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";const s=this.popup=b(this,Cd,Ym).call(this),i=[];for(const n of this.elements)n.popup=s,n.container.ariaHasPopup="dialog",i.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(n=>`${Ul}${n}`).join(",")),this.container}}Cd=new WeakSet,Ym=function(){return new XE({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})};var Ds,oa,Gp,zp,zc,Vc,ie,lr,la,qo,Wc,Xc,cr,Fs,Zr,tn,re,en,ca,Pd,sn,Yc,Jo,ha,Oe,ua,lt,Vf,Km,qm,Jm,Wf,Qm,gA,mA,vA,yA,Xf,Yf,Zm;class XE{constructor({container:t,color:e,elements:s,titleObj:i,modificationDate:n,contentsObj:a,richText:o,parent:l,rect:c,parentRect:h,open:d,commentManager:f=null}){y(this,lt);y(this,Ds,null);y(this,oa,b(this,lt,vA).bind(this));y(this,Gp,b(this,lt,Zm).bind(this));y(this,zp,b(this,lt,Yf).bind(this));y(this,zc,b(this,lt,Xf).bind(this));y(this,Vc,null);y(this,ie,null);y(this,lr,null);y(this,la,null);y(this,qo,null);y(this,Wc,null);y(this,Xc,null);y(this,cr,!1);y(this,Fs,null);y(this,Zr,null);y(this,tn,null);y(this,re,null);y(this,en,null);y(this,ca,null);y(this,Pd,null);y(this,sn,null);y(this,Yc,null);y(this,Jo,null);y(this,ha,!1);y(this,Oe,null);y(this,ua,null);p(this,ie,t),p(this,Yc,i),p(this,lr,a),p(this,sn,o),p(this,Wc,l),p(this,Vc,e),p(this,Pd,c),p(this,Xc,h),p(this,qo,s),p(this,Ds,f),p(this,Oe,s[0]),p(this,la,du.toDateObject(n)),this.trigger=s.flatMap(g=>g.getElementsToTriggerPopup()),f||(b(this,lt,Vf).call(this),r(this,ie).hidden=!0,d&&b(this,lt,Xf).call(this))}renderCommentButton(){if(r(this,re)){r(this,re).parentNode||r(this,Oe).container.after(r(this,re));return}if(r(this,en)||b(this,lt,Km).call(this),!r(this,en))return;const{signal:t}=p(this,Zr,new AbortController),e=r(this,Oe).hasOwnCommentButton,s=()=>{r(this,Ds).toggleCommentPopup(this,!0,void 0,!e)},i=()=>{r(this,Ds).toggleCommentPopup(this,!1,!0,!e)},n=()=>{r(this,Ds).toggleCommentPopup(this,!1,!1)};if(e){p(this,re,r(this,Oe).container);for(const a of this.trigger)a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.addEventListener("keydown",r(this,oa),{signal:t}),a.addEventListener("click",s,{signal:t}),a.addEventListener("pointerenter",i,{signal:t}),a.addEventListener("pointerleave",n,{signal:t}),a.classList.add("popupTriggerArea")}else{const a=p(this,re,document.createElement("button"));a.className="annotationCommentButton";const o=r(this,Oe).container;a.style.zIndex=parseInt(o.style.zIndex,10)+1,a.tabIndex=0,a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.setAttribute("data-l10n-id","pdfjs-show-comment-button"),b(this,lt,Jm).call(this),b(this,lt,qm).call(this),a.addEventListener("keydown",r(this,oa),{signal:t}),a.addEventListener("click",s,{signal:t}),a.addEventListener("pointerenter",i,{signal:t}),a.addEventListener("pointerleave",n,{signal:t}),o.after(a)}}get commentButtonColor(){const{color:t,opacity:e}=r(this,Oe).commentData;return t?r(this,Wc)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{var t;(t=r(this,re))==null||t.focus()},0)}getData(){const{richText:t,color:e,opacity:s,creationDate:i,modificationDate:n}=r(this,Oe).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:s,creationDate:i,modificationDate:n}}get elementBeforePopup(){return r(this,re)}get comment(){return r(this,ua)||p(this,ua,r(this,Oe).commentText),r(this,ua)}set comment(t){t!==this.comment&&(r(this,Oe).commentText=p(this,ua,t))}focus(){var t;(t=r(this,Oe).container)==null||t.focus()}get parentBoundingClientRect(){return r(this,Oe).layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){r(this,re)&&(r(this,re).classList.toggle("selected",t),r(this,re).ariaExpanded=e)}setSelectedCommentButton(t){r(this,re).classList.toggle("selected",t)}get commentPopupPosition(){if(r(this,ca))return r(this,ca);const{x:t,y:e,height:s}=r(this,re).getBoundingClientRect(),{x:i,y:n,width:a,height:o}=r(this,Oe).layer.getBoundingClientRect();return[(t-i)/a,(e+s-n)/o]}set commentPopupPosition(t){p(this,ca,t)}hasDefaultPopupPosition(){return r(this,ca)===null}get commentButtonPosition(){return r(this,en)}get commentButtonWidth(){return r(this,re).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){const[e,s]=r(this,ca)||this.commentButtonPosition.map(c=>c/100),i=this.parentBoundingClientRect,{x:n,y:a,width:o,height:l}=i;r(this,Ds).showDialog(null,this,n+e*o,a+s*l,{...t,parentDimensions:i})}render(){var s,i;if(r(this,Fs))return;const t=p(this,Fs,document.createElement("div"));if(t.className="popup",r(this,Vc)){const n=t.style.outlineColor=j.makeHexColor(...r(this,Vc));t.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`}const e=document.createElement("span");if(e.className="header",(s=r(this,Yc))!=null&&s.str){const n=document.createElement("span");n.className="title",e.append(n),{dir:n.dir,str:n.textContent}=r(this,Yc)}if(t.append(e),r(this,la)){const n=document.createElement("time");n.className="popupDate",n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:r(this,la).valueOf()})),n.dateTime=r(this,la).toISOString(),e.append(n)}Qv({html:r(this,lt,Wf)||r(this,lr).str,dir:(i=r(this,lr))==null?void 0:i.dir,className:"popupContent"},t),r(this,ie).append(t)}updateEdited({rect:t,popup:e,deleted:s}){var i;if(r(this,Ds)){s?(this.remove(),p(this,ua,null)):e&&(e.deleted?this.remove():(b(this,lt,Jm).call(this),p(this,ua,e.text))),t&&(p(this,en,null),b(this,lt,Km).call(this),b(this,lt,qm).call(this));return}if(s||e!=null&&e.deleted){this.remove();return}b(this,lt,Vf).call(this),r(this,Jo)||p(this,Jo,{contentsObj:r(this,lr),richText:r(this,sn)}),t&&p(this,tn,null),e&&e.text&&(p(this,sn,b(this,lt,mA).call(this,e.text)),p(this,la,du.toDateObject(e.date)),p(this,lr,null)),(i=r(this,Fs))==null||i.remove(),p(this,Fs,null)}resetEdited(){var t;r(this,Jo)&&({contentsObj:Ft(this,lr)._,richText:Ft(this,sn)._}=r(this,Jo),p(this,Jo,null),(t=r(this,Fs))==null||t.remove(),p(this,Fs,null),p(this,tn,null))}remove(){var t,e,s;if((t=r(this,Zr))==null||t.abort(),p(this,Zr,null),(e=r(this,Fs))==null||e.remove(),p(this,Fs,null),p(this,ha,!1),p(this,cr,!1),(s=r(this,re))==null||s.remove(),p(this,re,null),this.trigger)for(const i of this.trigger)i.classList.remove("popupTriggerArea")}forceHide(){p(this,ha,this.isVisible),r(this,ha)&&(r(this,ie).hidden=!0)}maybeShow(){r(this,Ds)||(b(this,lt,Vf).call(this),r(this,ha)&&(r(this,Fs)||b(this,lt,Yf).call(this),p(this,ha,!1),r(this,ie).hidden=!1))}get isVisible(){return!r(this,Ds)&&r(this,ie).hidden===!1}}Ds=new WeakMap,oa=new WeakMap,Gp=new WeakMap,zp=new WeakMap,zc=new WeakMap,Vc=new WeakMap,ie=new WeakMap,lr=new WeakMap,la=new WeakMap,qo=new WeakMap,Wc=new WeakMap,Xc=new WeakMap,cr=new WeakMap,Fs=new WeakMap,Zr=new WeakMap,tn=new WeakMap,re=new WeakMap,en=new WeakMap,ca=new WeakMap,Pd=new WeakMap,sn=new WeakMap,Yc=new WeakMap,Jo=new WeakMap,ha=new WeakMap,Oe=new WeakMap,ua=new WeakMap,lt=new WeakSet,Vf=function(){var e;if(r(this,Zr))return;p(this,Zr,new AbortController);const{signal:t}=r(this,Zr);for(const s of this.trigger)s.addEventListener("click",r(this,zc),{signal:t}),s.addEventListener("pointerenter",r(this,zp),{signal:t}),s.addEventListener("pointerleave",r(this,Gp),{signal:t}),s.classList.add("popupTriggerArea");for(const s of r(this,qo))(e=s.container)==null||e.addEventListener("keydown",r(this,oa),{signal:t})},Km=function(){const t=r(this,qo).find(e=>e.hasCommentButton);t&&p(this,en,t._normalizePoint(t.commentButtonPosition))},qm=function(){if(r(this,Oe).extraPopupElement&&!r(this,Oe).editor)return;r(this,re)||this.renderCommentButton();const[t,e]=r(this,en),{style:s}=r(this,re);s.left=`calc(${t}%)`,s.top=`calc(${e}% - var(--comment-button-dim))`},Jm=function(){r(this,Oe).extraPopupElement||(r(this,re)||this.renderCommentButton(),r(this,re).style.backgroundColor=this.commentButtonColor||"")},Wf=function(){const t=r(this,sn),e=r(this,lr);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&r(this,sn).html||null},Qm=function(){var t,e,s;return((s=(e=(t=r(this,lt,Wf))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.fontSize)||0},gA=function(){var t,e,s;return((s=(e=(t=r(this,lt,Wf))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.color)||null},mA=function(t){const e=[],s={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:r(this,lt,gA),fontSize:r(this,lt,Qm)?`calc(${r(this,lt,Qm)}px * var(--total-scale-factor))`:""}};for(const n of t.split(`
49
+ `))e.push({name:"span",value:n,attributes:i});return s},vA=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&r(this,cr))&&b(this,lt,Xf).call(this)},yA=function(){if(r(this,tn)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:s,pageX:i,pageY:n}}}=r(this,Wc);let a=!!r(this,Xc),o=a?r(this,Xc):r(this,Pd);for(const m of r(this,qo))if(!o||j.intersect(m.data.rect,o)!==null){o=m.data.rect,a=!0;break}const l=j.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),h=a?o[2]-o[0]+5:0,d=l[0]+h,f=l[1];p(this,tn,[100*(d-i)/e,100*(f-n)/s]);const{style:g}=r(this,ie);g.left=`${r(this,tn)[0]}%`,g.top=`${r(this,tn)[1]}%`},Xf=function(){if(r(this,Ds)){r(this,Ds).toggleCommentPopup(this,!1);return}p(this,cr,!r(this,cr)),r(this,cr)?(b(this,lt,Yf).call(this),r(this,ie).addEventListener("click",r(this,zc)),r(this,ie).addEventListener("keydown",r(this,oa))):(b(this,lt,Zm).call(this),r(this,ie).removeEventListener("click",r(this,zc)),r(this,ie).removeEventListener("keydown",r(this,oa)))},Yf=function(){r(this,Fs)||this.render(),this.isVisible?r(this,cr)&&r(this,ie).classList.add("focused"):(b(this,lt,yA).call(this),r(this,ie).hidden=!1,r(this,ie).style.zIndex=parseInt(r(this,ie).style.zIndex,10)+1e3)},Zm=function(){r(this,ie).classList.remove("focused"),!(r(this,cr)||!this.isVisible)&&(r(this,ie).hidden=!0,r(this,ie).style.zIndex=parseInt(r(this,ie).style.zIndex,10)-1e3)};class bA extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=it.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=this.contentElement=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const s=document.createElement("span");s.textContent=e,t.append(s)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}var Id;class YE extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});y(this,Id,null)}render(){this.container.classList.add("lineAnnotation");const{data:e,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=p(this,Id,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),n.append(a),this.container.append(n),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return r(this,Id)}addHighlightArea(){this.container.classList.add("highlightArea")}}Id=new WeakMap;var kd;class KE extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});y(this,kd,null)}render(){this.container.classList.add("squareAnnotation");const{data:e,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=p(this,kd,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",s-a),o.setAttribute("height",i-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return r(this,kd)}addHighlightArea(){this.container.classList.add("highlightArea")}}kd=new WeakMap;var Md;class qE extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});y(this,Md,null)}render(){this.container.classList.add("circleAnnotation");const{data:e,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=p(this,Md,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",s/2),o.setAttribute("cy",i/2),o.setAttribute("rx",s/2-a/2),o.setAttribute("ry",i/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return r(this,Md)}addHighlightArea(){this.container.classList.add("highlightArea")}}Md=new WeakMap;var Od;class wA extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});y(this,Od,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:s,borderStyle:i,popupRef:n},width:a,height:o}=this;if(!s)return this.container;const l=this.svgFactory.create(a,o,!0);let c=[];for(let d=0,f=s.length;d<f;d+=2){const g=s[d]-e[0],m=e[3]-s[d+1];c.push(`${g},${m}`)}c=c.join(" ");const h=p(this,Od,this.svgFactory.createElement(this.svgElementName));return h.setAttribute("points",c),h.setAttribute("stroke-width",i.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),l.append(h),this.container.append(l),!n&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return r(this,Od)}addHighlightArea(){this.container.classList.add("highlightArea")}}Od=new WeakMap;class JE extends wA{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class QE extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}}var Rd,Qo,Dd,tv;class ry extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});y(this,Dd);y(this,Rd,null);y(this,Qo,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?it.HIGHLIGHT:it.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,rotation:s,inkLists:i,borderStyle:n,popupRef:a}}=this,{transform:o,width:l,height:c}=b(this,Dd,tv).call(this,s,e),h=this.svgFactory.create(l,c,!0),d=p(this,Rd,this.svgFactory.createElement("svg:g"));h.append(d),d.setAttribute("stroke-width",n.width||1),d.setAttribute("stroke-linecap","round"),d.setAttribute("stroke-linejoin","round"),d.setAttribute("stroke-miterlimit",10),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),d.setAttribute("transform",o);for(const f of i){const g=this.svgFactory.createElement(this.svgElementName);r(this,Qo).push(g),g.setAttribute("points",f.join(",")),d.append(g)}return!a&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(h),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);const{thickness:s,points:i,rect:n}=e,a=r(this,Rd);if(s>=0&&a.setAttribute("stroke-width",s||1),i)for(let o=0,l=r(this,Qo).length;o<l;o++)r(this,Qo)[o].setAttribute("points",i[o].join(","));if(n){const{transform:o,width:l,height:c}=b(this,Dd,tv).call(this,this.data.rotation,n);a.parentElement.setAttribute("viewBox",`0 0 ${l} ${c}`),a.setAttribute("transform",o)}}getElementsToTriggerPopup(){return r(this,Qo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Rd=new WeakMap,Qo=new WeakMap,Dd=new WeakSet,tv=function(e,s){switch(e){case 90:return{transform:`rotate(90) translate(${-s[0]},${s[1]}) scale(1,-1)`,width:s[3]-s[1],height:s[2]-s[0]};case 180:return{transform:`rotate(180) translate(${-s[2]},${s[1]}) scale(1,-1)`,width:s[2]-s[0],height:s[3]-s[1]};case 270:return{transform:`rotate(270) translate(${-s[2]},${s[3]}) scale(1,-1)`,width:s[3]-s[1],height:s[2]-s[0]};default:return{transform:`translate(${-s[0]},${s[3]}) scale(1,-1)`,width:s[2]-s[0],height:s[3]-s[1]}}};class AA extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=it.HIGHLIGHT}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){const s=document.createElement("mark");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class ZE extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("underlineAnnotation"),t){const s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class tx extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("squigglyAnnotation"),t){const s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class ex extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("strikeoutAnnotation"),t){const s=document.createElement("s");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class _A extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=it.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}var Fd,Ld,ev;class sx extends Xt{constructor(e){var n;super(e,{isRenderable:!0});y(this,Ld);y(this,Fd,null);const{fileId:s,file:i}=this.data;this.filename=i.filename,this.content=i.content,this.fileId=s,(n=this.linkService.eventBus)==null||n.dispatch("fileattachmentannotation",{source:this,attachmentId:this.fileId,...i})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:s}=this;let i;s.hasAppearance||s.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(s.name)?"paperclip":"pushpin"}.svg`,s.fillAlpha&&s.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(s.fillAlpha*100)}%);`)),i.addEventListener("dblclick",b(this,Ld,ev).bind(this)),p(this,Fd,i);const{isMac:n}=_t.platform;return e.addEventListener("keydown",a=>{a.key==="Enter"&&(n?a.metaKey:a.ctrlKey)&&b(this,Ld,ev).call(this)}),!s.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return r(this,Fd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Fd=new WeakMap,Ld=new WeakSet,ev=async function(){var a;const{fileId:e,filename:s,content:i}=this,n=await this.linkService.getAttachmentContent(e)||i;n&&((a=this.downloadManager)==null||a.openOrDownloadData(n,s))};var Kc,Zo,rn,Al,EA,sv;class SA extends Xt{constructor(e){super(e,{isRenderable:!!e.data.richMedia});y(this,Al);y(this,Kc,new AbortController);y(this,Zo,null);y(this,rn,null)}render(){this.container.classList.add("mediaAnnotation");const{filename:e}=this.data.richMedia,s=document.createElement("button");return s.className="mediaPlayButton",s.type="button",s.title=s.ariaLabel=e,s.addEventListener("click",()=>b(this,Al,EA).call(this,s),{signal:r(this,Kc).signal}),this.container.append(s),this.container}destroy(){r(this,Kc).abort(),r(this,rn)&&(r(this,rn).pause(),r(this,rn).removeAttribute("src"),r(this,rn).load(),p(this,rn,null)),b(this,Al,sv).call(this)}}Kc=new WeakMap,Zo=new WeakMap,rn=new WeakMap,Al=new WeakSet,EA=async function(e){const{fileId:s,filename:i,contentType:n}=this.data.richMedia;e.disabled=!0;let a;try{a=await this.linkService.getAttachmentContent(s)}catch{return}finally{e.disabled=!1}if(!a||!e.isConnected)return;const{signal:o}=r(this,Kc),l=new Blob([a],{type:n});if(!/^(?:video|audio)\//.test(l.type))return;const c=URL.createObjectURL(l);p(this,Zo,c);const h=l.type.startsWith("audio/"),d=document.createElement(h?"audio":"video");if(p(this,rn,d),d.className="mediaContent",this._setBackgroundColor(d),d.src=c,d.title=i,d.controls=!0,d.autoplay=!0,d.tabIndex=0,h){let f=!1,g=!1;const m=()=>{d.controls=f||g};this.container.addEventListener("pointerenter",()=>{f=!0,m()},{signal:o}),this.container.addEventListener("pointerleave",()=>{f=!1,m()},{signal:o}),this.container.addEventListener("focusin",()=>{g=!0,m()},{signal:o}),this.container.addEventListener("focusout",()=>{g=!1,m()},{signal:o})}d.addEventListener("emptied",()=>b(this,Al,sv).call(this,c),{once:!0,signal:o}),e.replaceWith(d),d.play().catch(()=>{})},sv=function(e=r(this,Zo)){e&&e===r(this,Zo)&&(URL.revokeObjectURL(e),p(this,Zo,null))};var da,tl,qc,nn,Jc,el,Ye,Nd,Ar,Kf,qf;const gy=class gy{constructor({div:t,accessibilityManager:e,annotationCanvasMap:s,annotationEditorUIManager:i,page:n,viewport:a,structTreeLayer:o,commentManager:l,linkService:c,annotationStorage:h}){y(this,Ar);y(this,da,null);y(this,tl,null);y(this,qc,null);y(this,nn,new Map);y(this,Jc,null);y(this,el,null);y(this,Ye,[]);y(this,Nd,!1);O(this,"zIndex",0);this.div=t,p(this,da,e),p(this,tl,s),p(this,Jc,o||null),p(this,el,c||null),p(this,qc,h||new ty),this.page=n,this.viewport=a,this._annotationEditorUIManager=i,this._commentManager=l||null}hasEditableAnnotations(){return r(this,nn).size>0}async render(t){var l;const{annotations:e,optionalContentConfig:s}=t,i=this.div;Pa(i,this.viewport);const n=new Map,a=[],o={data:null,layer:i,linkService:r(this,el),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new mu,annotationStorage:r(this,qc),enableComment:t.enableComment===!0,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const c of e){if(c.noHTML)continue;const h=c.annotationType===$t.POPUP;if(h){const g=n.get(c.id);if(!g)continue;if(!this._commentManager){a.push(c);continue}o.elements=g}else if(c.rect[2]===c.rect[0]||c.rect[3]===c.rect[1])continue;o.data=c;const d=$g.create(o);if(!d.isRenderable)continue;h||(r(this,Ye).push(d),c.popupRef&&n.getOrInsertComputed(c.popupRef,Pl).push(d));const f=d.render();c.hidden&&(f.style.visibility="hidden"),d.updateOC(s),d._isEditable&&(r(this,nn).set(d.data.id,d),(l=this._annotationEditorUIManager)==null||l.renderAnnotationElement(d))}await b(this,Ar,Kf).call(this);for(const c of a){const h=o.elements=n.get(c.id);o.data=c;const d=$g.create(o);if(!d.isRenderable)continue;const f=d.render();d.contentElement.id=`${Ul}${c.id}`,c.hidden&&(f.style.visibility="hidden"),h.at(-1).container.after(f)}b(this,Ar,qf).call(this)}async addLinkAnnotations(t){const e={data:null,layer:this.div,linkService:r(this,el),svgFactory:new mu,parent:this};for(const s of t){s.borderStyle||(s.borderStyle=gy._defaultBorderStyle),e.data=s;const i=$g.create(e);i.isRenderable&&(i.render(),i.contentElement.id=`${Ul}${s.id}`,r(this,Ye).push(i))}await b(this,Ar,Kf).call(this)}update({viewport:t,optionalContentConfig:e}){const s=this.div;this.viewport=t,Pa(s,{rotation:t.rotation});for(const i of r(this,Ye))i.updateOC(e);b(this,Ar,qf).call(this),s.hidden=!1}destroy(){var t,e;for(const s of r(this,Ye))(t=s.destroy)==null||t.call(s),(e=r(this,da))==null||e.removePointerInTextLayer(s.contentElement);r(this,Ye).length=0,r(this,nn).clear(),this.div.replaceChildren()}refreshCanvases(){b(this,Ar,qf).call(this)}getEditableAnnotations(){return r(this,nn).values()}getEditableAnnotation(t){return r(this,nn).get(t)}addFakeAnnotation(t){const{div:e}=this,{id:s,rotation:i}=t,n=new UE({data:{id:s,rect:t.getPDFRect(),rotation:i},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:r(this,el),annotationStorage:r(this,qc)});return n.render(),n.contentElement.id=`${Ul}${s}`,n.createOrUpdatePopup(),r(this,Ye).push(n),n}removeAnnotation(t){var i;const e=r(this,Ye).findIndex(n=>n.data.id===t);if(e<0)return;const[s]=r(this,Ye).splice(e,1);(i=r(this,da))==null||i.removePointerInTextLayer(s.contentElement)}updateFakeAnnotations(t){if(t.length!==0){for(const e of t)e.updateFakeAnnotationElement(this);b(this,Ar,Kf).call(this)}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return V(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Dl.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};da=new WeakMap,tl=new WeakMap,qc=new WeakMap,nn=new WeakMap,Jc=new WeakMap,el=new WeakMap,Ye=new WeakMap,Nd=new WeakMap,Ar=new WeakSet,Kf=async function(){var s,i,n,a;if(r(this,Ye).length===0)return;this.div.replaceChildren();const t=[];if(!r(this,Nd)){p(this,Nd,!0);for(const{contentElement:o,data:{hidden:l,id:c,oc:h}}of r(this,Ye)){const d=o.id=`${Ul}${c}`,f=o.localName==="a"&&!l&&!h;t.push((s=r(this,Jc))==null?void 0:s.getAriaAttributes(d,{enableLinkOwnership:f}).then(g=>{if(g)for(const[m,v]of g)o.setAttribute(m,v)}))}}r(this,Ye).sort(({data:{rect:[o,l,c,h]}},{data:{rect:[d,f,g,m]}})=>{if(o===c&&l===h)return 1;if(d===g&&f===m)return-1;const v=h,w=l,A=(l+h)/2,_=m,E=f,S=(f+m)/2;if(A>=_&&S<=w)return-1;if(S>=v&&A<=E)return 1;const x=(o+c)/2,T=(d+g)/2;return x-T});const e=document.createDocumentFragment();for(const o of r(this,Ye))e.append(o.container),this._commentManager?(n=((i=o.extraPopupElement)==null?void 0:i.popup)||o.popup)==null||n.renderCommentButton():o.extraPopupElement&&e.append(o.extraPopupElement.render());if(this.div.append(e),await Promise.all(t),r(this,da)){const o=await((a=r(this,Jc))==null?void 0:a.getAnnotationIds());for(const{contentElement:l}of r(this,Ye))o!=null&&o.has(l.id)||r(this,da).addPointerInTextLayer(l,!1)}},qf=function(){var e;if(!r(this,tl))return;const t=this.div;for(const[s,i]of r(this,tl)){const n=t.querySelector(`[data-annotation-id="${s}"]`);if(!n)continue;if(Array.isArray(i))for(const h of i)h.className="annotationContent",h.ariaHidden=!0;else i.className="annotationContent",i.ariaHidden=!0;const a=[];for(const h of n.children)h.nodeName==="CANVAS"&&a.push(h);for(const h of a)h.remove();const o=Array.isArray(i)?i[0]:i,{firstChild:l}=n;if(l?l.classList.contains("annotationContent")?l.after(o):l.before(o):n.append(o),Array.isArray(i)){let h=o;for(let d=1,f=i.length;d<f;d++)h.after(i[d]),h=i[d]}r(this,tl).delete(s);const c=r(this,nn).get(s);c&&(c._hasNoCanvas?((e=this._annotationEditorUIManager)==null||e.setMissingCanvas(s,n.id,i),c._hasNoCanvas=!1):c.canvas=i)}};let yp=gy;const Sf=/\r\n?|\n/g;var Ls,Bd,sl,Ns,ve,xA,TA,CA,Jf,gn,Qf,Zf,PA,rv,IA;const Ht=class Ht extends Mt{constructor(e){super({...e,name:"freeTextEditor"});y(this,ve);y(this,Ls,"");y(this,Bd,`${this.id}-editor`);y(this,sl,null);y(this,Ns);O(this,"_colorPicker",null);this.color=e.color||Ht._defaultColor||Mt._defaultLineColor,p(this,Ns,e.fontSize||Ht._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert(Mt._l10nAlert.freetext),this.canAddComment=!1}static get _keyboardManager(){const e=Ht.prototype,s=a=>a.isEmpty(),i=Ia.TRANSLATE_SMALL,n=Ia.TRANSLATE_BIG;return V(this,"_keyboardManager",new bl([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter"],e.commitOrRemove],[["Escape"],e.commitOrRemove],[["ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:s}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:s}],[["ArrowRight"],e._translateEmpty,{args:[i,0],checker:s}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[n,0],checker:s}],[["ArrowUp"],e._translateEmpty,{args:[0,-i],checker:s}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:s}],[["ArrowDown"],e._translateEmpty,{args:[0,i],checker:s}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,n],checker:s}]]))}static initialize(e,s){Mt.initialize(e,s);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,s){switch(e){case dt.FREETEXT_SIZE:Ht._defaultFontSize=s;break;case dt.FREETEXT_COLOR:Ht._defaultColor=s;break}}updateParams(e,s){switch(e){case dt.FREETEXT_SIZE:b(this,ve,xA).call(this,s);break;case dt.FREETEXT_COLOR:b(this,ve,TA).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[dt.FREETEXT_SIZE,Ht._defaultFontSize],[dt.FREETEXT_COLOR,Ht._defaultColor||Mt._defaultLineColor]]}get propertiesToUpdate(){return[[dt.FREETEXT_SIZE,r(this,Ns)],[dt.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new vp(this)),[["colorPicker",this._colorPicker]]}get colorType(){return dt.FREETEXT_COLOR}onUpdatedColor(){var e;this.editorDiv.style.color=this.color,(e=this._colorPicker)==null||e.update(this.color),super.onUpdatedColor()}_translateEmpty(e,s){this._uiManager.translateSelectedEditors(e,s,!0)}getInitialTranslation(){const e=this.parentScale;return[-Ht._internalPadding*e,-(Ht._internalPadding+r(this,Ns))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),p(this,sl,new AbortController);const e=this._uiManager.combinedSignal(r(this,sl));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){var e;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",r(this,Bd)),this._isDraggable=!0,(e=r(this,sl))==null||e.abort(),p(this,sl,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){var s;this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),(s=this._initialOptions)!=null&&s.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=r(this,Ls),s=p(this,Ls,b(this,ve,CA).call(this).trimEnd());if(e===s)return;const i=n=>{if(p(this,Ls,n),!n){this.remove();return}b(this,ve,Zf).call(this),this._uiManager.rebuild(this),b(this,ve,Jf).call(this)};this.addCommands({cmd:()=>{i(s)},undo:()=>{i(e)},mustExec:!1}),b(this,ve,Jf).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){Ht._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,s;(this._isCopy||this.annotationElementId)&&(e=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",r(this,Bd)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${r(this,Ns)}px * var(--total-scale-factor))`,i.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[n,a]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[l,c]=this.getInitialTranslation();[l,c]=this.pageTranslationToScreen(l,c);const[h,d]=this.pageDimensions,[f,g]=this.pageTranslation;let m,v;switch(this.rotation){case 0:m=e+(o[0]-f)/h,v=s+this.height-(o[1]-g)/d;break;case 90:m=e+(o[0]-f)/h,v=s-(o[1]-g)/d,[l,c]=[c,-l];break;case 180:m=e-this.width+(o[0]-f)/h,v=s-(o[1]-g)/d,[l,c]=[-l,-c];break;case 270:m=e+(o[0]-f-this.height*d)/h,v=s+(o[1]-g-this.width*h)/d,[l,c]=[-c,l];break}this.setAt(m*n,v*a,l,c)}else this._moveAfterPaste(e,s);b(this,ve,Zf).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var m,v,w;const s=e.clipboardData||window.clipboardData,{types:i}=s;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();const n=b(m=Ht,gn,rv).call(m,s.getData("text")||"").replaceAll(Sf,`
50
+ `);if(!n)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!n.includes(`
51
+ `)){o.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:l,startOffset:c}=o,h=[],d=[];if(l.nodeType===Node.TEXT_NODE){const A=l.parentElement;if(d.push(l.nodeValue.slice(c).replaceAll(Sf,"")),A!==this.editorDiv){let _=h;for(const E of this.editorDiv.childNodes){if(E===A){_=d;continue}_.push(b(v=Ht,gn,Qf).call(v,E))}}h.push(l.nodeValue.slice(0,c).replaceAll(Sf,""))}else if(l===this.editorDiv){let A=h,_=0;for(const E of this.editorDiv.childNodes)_++===c&&(A=d),A.push(b(w=Ht,gn,Qf).call(w,E))}p(this,Ls,`${h.join(`
52
+ `)}${n}${d.join(`
53
+ `)}`),b(this,ve,Zf).call(this);const f=new Range;let g=Math.sumPrecise(h.map(A=>A.length));for(const{firstChild:A}of this.editorDiv.childNodes)if(A.nodeType===Node.TEXT_NODE){const _=A.nodeValue.length;if(g<=_){f.setStart(A,g),f.setEnd(A,g);break}g-=_}a.removeAllRanges(),a.addRange(f)}get contentDiv(){return this.editorDiv}getPDFRect(){const e=Ht._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,s,i){var o;let n=null;if(e instanceof bA){const{data:{defaultAppearanceData:{fontSize:l,fontColor:c},rect:h,rotation:d,id:f,popupRef:g,richText:m,contentsObj:v,creationDate:w,modificationDate:A},textContent:_,textPosition:E,parent:{page:{pageNumber:S}}}=e;if(!(_!=null&&_.length))return null;n=e={annotationType:it.FREETEXT,color:Array.from(c),fontSize:l,value:_.join(`
54
+ `),position:E,pageIndex:S-1,rect:h.slice(0),rotation:d,annotationElementId:f,id:f,deleted:!1,popupRef:g,comment:(v==null?void 0:v.str)||null,richText:m,creationDate:w,modificationDate:A}}const a=await super.deserialize(e,s,i);return p(a,Ns,e.fontSize),a.color=j.makeHexColor(...e.color),p(a,Ls,b(o=Ht,gn,rv).call(o,e.value)),a._initialData=n,e.comment&&a.setCommentData(e),a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=Mt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(e),{color:s,fontSize:r(this,Ns),value:b(this,ve,PA).call(this)});return this.addComment(i),e?(i.isCopy=!0,i):this.annotationElementId&&!b(this,ve,IA).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(e){const s=super.renderAnnotationElement(e);if(!s)return null;const{style:i}=s;i.fontSize=`calc(${r(this,Ns)}px * var(--total-scale-factor))`,i.color=this.color,s.replaceChildren();for(const n of r(this,Ls).split(`
55
+ `)){const a=document.createElement("div");a.append(n?document.createTextNode(n):document.createElement("br")),s.append(a)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:r(this,Ls)}}),s}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};Ls=new WeakMap,Bd=new WeakMap,sl=new WeakMap,Ns=new WeakMap,ve=new WeakSet,xA=function(e){const s=n=>{this.editorDiv.style.fontSize=`calc(${n}px * var(--total-scale-factor))`,this.translate(0,-(n-r(this,Ns))*this.parentScale),p(this,Ns,n),b(this,ve,Jf).call(this)},i=r(this,Ns);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:dt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},TA=function(e){const s=n=>{this.color=n,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:dt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},CA=function(){var i;const e=[];this.editorDiv.normalize();let s=null;for(const n of this.editorDiv.childNodes)(s==null?void 0:s.nodeType)===Node.TEXT_NODE&&n.nodeName==="BR"||(e.push(b(i=Ht,gn,Qf).call(i,n)),s=n);return e.join(`
56
+ `)},Jf=function(){const[e,s]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:n,div:a}=this,o=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",n.div.append(this.div),i=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=i.width/e,this.height=i.height/s):(this.width=i.height/e,this.height=i.width/s),this.fixAndSetPosition()},gn=new WeakSet,Qf=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Sf,"")},Zf=function(){if(this.editorDiv.replaceChildren(),!!r(this,Ls))for(const e of r(this,Ls).split(`
57
+ `)){const s=document.createElement("div");s.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(s)}},PA=function(){return r(this,Ls).replaceAll(" "," ")},rv=function(e){return e.replaceAll(" "," ")},IA=function(e){const{value:s,fontSize:i,color:n,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==s||e.fontSize!==i||e.color.some((o,l)=>o!==n[l])||e.pageIndex!==a},y(Ht,gn),O(Ht,"_freeTextDefaultContent",""),O(Ht,"_internalPadding",0),O(Ht,"_defaultColor",null),O(Ht,"_defaultFontSize",10),O(Ht,"_type","freetext"),O(Ht,"_editorType",it.FREETEXT);let iv=Ht;var il;class ny{constructor(){y(this,il,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(const[e,s]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,s)}updateSVGProperty(t,e){r(this,il)[t]=e}toSVGProperties(){const t=r(this,il);return p(this,il,Object.create(null)),{root:t}}reset(){p(this,il,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){vt("Not implemented")}}il=new WeakMap;var Qc,Zc,fe,rl,nl,th,Z,nv,av,ov,lv,Jh,cv,hv,uv,Qh,kA,tp,Zh,Bl;const ot=class ot extends Mt{constructor(e){super(e);y(this,Z);y(this,Qc,null);y(this,Zc);O(this,"_clipPathId",null);O(this,"_colorPicker",null);O(this,"_drawId",null);O(this,"_drawOutlines",null);O(this,"_focusDrawId",null);p(this,Zc,e.mustBeCommitted||!1),this._addOutlines(e)}onUpdatedColor(){var e;(e=this._colorPicker)==null||e.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){var e,s;(s=(e=this._colorPicker)==null?void 0:e.updateOpacity)==null||s.call(e,this.opacity)}_addOutlines(e){e.drawOutlines&&(b(this,Z,nv).call(this,e),b(this,Z,Qh).call(this))}static _mergeSVGProperties(e,s){const i=new Set(Object.keys(e));for(const[n,a]of Object.entries(s))i.has(n)?Object.assign(e[n],a):e[n]=a;return e}static getDefaultDrawingOptions(e){vt("Not implemented")}static get typesMap(){vt("Not implemented")}static get isDrawer(){return!0}static get _hasClipPath(){return!1}static get _hasDrawClass(){return!0}static get supportMultipleDrawings(){return!1}get _drawRotation(){return this.rotation}get _opacityName(){return this.constructor.typesMap.get(this.opacityType)}static updateDefaultParams(e,s){const i=this.typesMap.get(e);i&&this._defaultDrawingOptions.updateProperty(i,s),this._currentParent&&(r(ot,fe).updateProperty(i,s),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,s){const i=this.constructor.typesMap.get(e);i&&this._updateProperty(e,i,s)}static get defaultPropertiesToUpdate(){const e=[],s=this._defaultDrawingOptions;for(const[i,n]of this.typesMap)e.push([i,s[n]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:s}=this;for(const[i,n]of this.constructor.typesMap)e.push([i,s[n]]);return e}_updateProperty(e,s,i){const n=this._drawingOptions,a=n[s],o=l=>{var h;n.updateProperty(s,l);const c=this._drawOutlines.updateProperty(s,l);c&&b(this,Z,Zh).call(this,c),(h=this.parent)==null||h.drawLayer.updateProperties(this._drawId,n.toSVGProperties()),e===this.colorType?this.onUpdatedColor():e===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:o.bind(this,i),undo:o.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(e,s,i=this.colorAndOpacityType){const n=this.constructor.typesMap.get(this.colorType),a=this._opacityName,o=this._drawingOptions,l=o[n],c=o[a],h=(d,f)=>{var g;o.updateProperty(n,d),o.updateProperty(a,f),this._drawOutlines.updateProperty(n,d),this._drawOutlines.updateProperty(a,f),(g=this.parent)==null||g.drawLayer.updateProperties(this._drawId,o.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:h.bind(this,e,s),undo:h.bind(this,l,c),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:i,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,ot._mergeSVGProperties(this._drawOutlines.getPathResizingSVGProperties(b(this,Z,tp).call(this)),{bbox:b(this,Z,Bl).call(this)}))}_onResized(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,ot._mergeSVGProperties(this._drawOutlines.getPathResizedSVGProperties(b(this,Z,tp).call(this)),{bbox:b(this,Z,Bl).call(this)})),b(this,Z,lv).call(this)}_onTranslating(e,s){var i;(i=this.parent)==null||i.drawLayer.updateProperties(this._drawId,{bbox:b(this,Z,Bl).call(this)})}_onTranslated(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,ot._mergeSVGProperties(this._drawOutlines.getPathTranslatedSVGProperties(b(this,Z,tp).call(this),this.parentDimensions),{bbox:b(this,Z,Bl).call(this)}))}_onStartDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}get _mustBeDisabledOnCommit(){return!0}commit(){super.commit(),this._mustBeDisabledOnCommit&&(this.disableEditMode(),this.disableEditing())}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,r(this,Zc)&&(p(this,Zc,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this._uiManager.removeShouldRescale(this),b(this,Z,uv).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,Z,Qh).call(this),b(this,Z,Zh).call(this,this._drawOutlines.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var i;let s=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),b(this,Z,uv).call(this)):e&&(this._uiManager.addShouldRescale(this),b(this,Z,Qh).call(this,e),s=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(e),b(this,Z,cv).call(this),s&&this.select()}rotate(e=this.parentRotation){if(!this.parent||this._drawId===null)return;const s=(e-this._drawRotation+360)%360;this.parent.drawLayer.updateProperties(this._drawId,ot._mergeSVGProperties({bbox:b(this,Z,Bl).call(this,e)},this._drawOutlines.updateRotation(s))),b(this,Z,lv).call(this,s)}show(e=this._isVisible){super.show(e),b(this,Z,cv).call(this)}select(){super.select(),b(this,Z,Jh).call(this,{hovered:!1,selected:!0})}unselect(){super.unselect(),b(this,Z,Jh).call(this,{selected:!1})}pointerover(){this.isSelected||b(this,Z,Jh).call(this,{hovered:!0})}pointerleave(){this.isSelected||b(this,Z,Jh).call(this,{hovered:!1})}onScaleChanging(){if(!this.parent)return;const e=this._drawOutlines.updateParentDimensions(this.parentDimensions,this.parent.scale);e&&b(this,Z,Zh).call(this,e)}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,s;this._isCopy&&(e=this.x,s=this.y);const i=super.render();this.constructor._hasDrawClass&&i.classList.add("draw");const n=p(this,Qc,document.createElement("div"));return i.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",this._clipPathId&&(n.style.clipPath=this._clipPathId),Xb(this,n,["pointerover","pointerleave"]),this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,s),i}static createDrawerInstance(e){vt("Not implemented")}static _getDrawingTarget(e,{target:s}){return s}static _getPointerCoords({offsetX:e,offsetY:s,clientX:i,clientY:n},a=null){if(!a)return[e,s];let o=i-a.clientX,l=n-a.clientY;switch(this._currentParent.viewport.rotation){case 90:[o,l]=[l,-o];break;case 180:[o,l]=[-o,-l];break;case 270:[o,l]=[-l,o];break}return[a.offsetX+o,a.offsetY+l]}static _addDrawingListeners(e,s){}static _endDrawingSession(e=!1){return this._currentParent.endDrawingSession(e)}static startDrawing(e,s,i,n){var S;const{pointerId:a,pointerType:o}=n;if(ze.isInitializedAndDifferentPointerType(o))return;const l=this._getDrawingTarget(e,n),[c,h]=this._getPointerCoords(n),{viewport:{rotation:d}}=e,{x:f,y:g,width:m,height:v}=l.getBoundingClientRect(),w=p(ot,rl,new AbortController),A=e.combinedSignal(w);if(ze.setPointer(o,a),window.addEventListener("pointerup",x=>{ze.isSamePointerIdOrRemove(x.pointerId)&&this._endDraw(x)},{signal:A}),window.addEventListener("pointercancel",x=>{ze.isSamePointerIdOrRemove(x.pointerId)&&this._endDrawingSession()},{signal:A}),window.addEventListener("pointerdown",x=>{ze.isSamePointerType(x.pointerType)&&(ze.initializeAndAddPointerId(x.pointerId),r(ot,fe).isCancellable()&&(r(ot,fe).removeLastElement(),r(ot,fe).isEmpty()?this._endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:A}),window.addEventListener("contextmenu",gi,{signal:A}),l.addEventListener("pointermove",this._drawMove.bind(this),{signal:A}),l.addEventListener("touchmove",x=>{ze.isSameTimeStamp(x.timeStamp)&&me(x)},{signal:A}),this._addDrawingListeners(l,A),e.toggleDrawing(),(S=s._editorUndoBar)==null||S.hide(),r(ot,fe)){e.drawLayer.updateProperties(this._currentDrawId,r(ot,fe).startNew(c,h,m,v,d));return}s.updateUIForDefaultProperties(this),p(ot,fe,this.createDrawerInstance({x:c,y:h,box:[f,g,m,v],rotation:d,parent:e,isLTR:i})),p(ot,nl,this.getDefaultDrawingOptions()),this._currentParent=e;const{id:_,clipPathId:E}=e.drawLayer.draw(this._mergeSVGProperties(r(ot,nl).toSVGProperties(),r(ot,fe).defaultSVGProperties),!0,this._hasClipPath);this._currentDrawId=_,p(ot,th,this._hasClipPath?E:null)}static _drawMove(e){var n;if(ze.isSameTimeStamp(e.timeStamp),!r(ot,fe)||!ze.isSamePointerId(e.pointerId))return;if(ze.isUsingMultiplePointers()){this._endDraw(e);return}let s;const i=(n=e.getCoalescedEvents)==null?void 0:n.call(e);if(i!=null&&i.length){const a=[];for(const o of i)a.push(...this._getPointerCoords(o,e));s=r(ot,fe).addPoints(a)}else s=r(ot,fe).add(...this._getPointerCoords(e));this._currentParent.drawLayer.updateProperties(this._currentDrawId,s),ze.setTimeStamp(e.timeStamp),me(e)}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,p(ot,fe,null),p(ot,nl,null),p(ot,th,null),ze.clearTimeStamp()),r(ot,rl)&&(r(ot,rl).abort(),p(ot,rl,null),ze.clearPointerIds())}static _endDraw(e){const s=this._currentParent;if(s){if(s.toggleDrawing(!0),this._cleanup(!1),s.drawLayer.updateProperties(this._currentDrawId,(e==null?void 0:e.target)===s.div?r(ot,fe).end(...this._getPointerCoords(e)):r(ot,fe).end()),this.supportMultipleDrawings){const i=r(ot,fe),n=this._currentDrawId,a=i.getLastElement();s.addCommands({cmd:()=>{s.drawLayer.updateProperties(n,i.setLastElement(a))},undo:()=>{s.drawLayer.updateProperties(n,i.removeLastElement())},mustExec:!1,type:dt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){const s=this._currentParent;if(!s)return null;if(s.toggleDrawing(!0),s.cleanUndoStack(dt.DRAW_STEP),!r(ot,fe).isEmpty()){const{pageDimensions:[i,n],scale:a}=s,o=s.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,clipPathId:r(ot,th),drawOutlines:r(ot,fe).getOutlines(i*a,n*a,a,this._INNER_MARGIN),drawingOptions:r(ot,nl),mustBeCommitted:!e});return this._cleanup(!0),o}return s.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,s,i,n,a,o,l){vt("Not implemented")}static async deserialize(e,s,i){var d,f;const{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:l}}=s.viewport,c=this.deserializeDraw(o,l,n,a,this._INNER_MARGIN,e,i),h=await super.deserialize(e,s,i);return h.createDrawingOptions(e),b(d=h,Z,nv).call(d,{drawOutlines:c}),b(f=h,Z,Qh).call(f),h.onScaleChanging(),h.rotate(),h}serializeDraw(e){const[s,i]=this.pageTranslation,[n,a]=this.pageDimensions;return this._drawOutlines.serialize([s,i,n,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};Qc=new WeakMap,Zc=new WeakMap,fe=new WeakMap,rl=new WeakMap,nl=new WeakMap,th=new WeakMap,Z=new WeakSet,nv=function({drawOutlines:e,drawId:s,drawingOptions:i,clipPathId:n}){this._drawOutlines=e,this._drawingOptions||(this._drawingOptions=i),this.annotationElementId||this._uiManager.a11yAlert(Mt._l10nAlert[this.editorType]),s>=0?(this._drawId=s,this._clipPathId=n??null,this.parent.drawLayer.finalizeDraw(s,e.defaultProperties),b(this,Z,ov).call(this,this.parent)):this._drawId=b(this,Z,av).call(this,e,this.parent),b(this,Z,Zh).call(this,e.box)},av=function(e,s){const{id:i,clipPathId:n}=s.drawLayer.draw(ot._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,this.constructor._hasClipPath);return this.constructor._hasClipPath&&(this._clipPathId=n),b(this,Z,ov).call(this,s),i},ov=function(e){const s=this._drawOutlines.getFocusSVGProperties(r(this,Z,hv));s&&(this._focusDrawId=e.drawLayer.drawOutline(s,this._drawOutlines.focusMustRemoveSelfIntersections))},lv=function(e=r(this,Z,hv)){var s;this._focusDrawId!==null&&((s=this.parent)==null||s.drawLayer.updateProperties(this._focusDrawId,this._drawOutlines.getFocusSVGProperties(e)))},Jh=function(e){var s;this._focusDrawId!==null&&((s=this.parent)==null||s.drawLayer.updateProperties(this._focusDrawId,{rootClass:e}))},cv=function(){const{parent:e,_drawId:s,_focusDrawId:i,_isVisible:n}=this;if(!e||s===null)return;const a={hidden:!n};e.drawLayer.updateProperties(s,{rootClass:a}),i!==null&&e.drawLayer.updateProperties(i,{rootClass:a})},hv=function(){return(this.parentRotation-this._drawRotation+360)%360},uv=function(){if(this._drawId===null||!this.parent)return;const{drawLayer:e}=this.parent;e.remove(this._drawId),this._drawId=null,this._focusDrawId!==null&&(e.remove(this._focusDrawId),this._focusDrawId=null),this._drawingOptions.reset()},Qh=function(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){const{drawLayer:s}=this.parent;s.updateParent(this._drawId,e.drawLayer),this._focusDrawId!==null&&s.updateParent(this._focusDrawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=b(this,Z,av).call(this,this._drawOutlines,e),this._clipPathId&&r(this,Qc)&&(r(this,Qc).style.clipPath=this._clipPathId)}},kA=function([e,s,i,n]){const{parentDimensions:[a,o],_drawRotation:l}=this;switch(l){case 90:return[s,1-e,i*(o/a),n*(a/o)];case 180:return[1-e,1-s,i,n];case 270:return[1-s,e,i*(o/a),n*(a/o)];default:return[e,s,i,n]}},tp=function(){const{x:e,y:s,width:i,height:n,parentDimensions:[a,o],_drawRotation:l}=this;switch(l){case 90:return[1-s,e,i*(a/o),n*(o/a)];case 180:return[1-e,1-s,i,n];case 270:return[s,1-e,i*(a/o),n*(o/a)];default:return[e,s,i,n]}},Zh=function(e){[this.x,this.y,this.width,this.height]=b(this,Z,kA).call(this,e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},Bl=function(e=this.parentRotation){const{x:s,y:i,width:n,height:a,_drawRotation:o,parentDimensions:[l,c]}=this;switch((o*4+e)/90){case 1:return[1-i-a,s,a,n];case 2:return[1-s-n,1-i-a,n,a];case 3:return[i,1-s-n,a,n];case 4:return[s,i-n*(l/c),a*(c/l),n*(l/c)];case 5:return[1-i,s,n*(l/c),a*(c/l)];case 6:return[1-s-a*(c/l),1-i,a*(c/l),n*(l/c)];case 7:return[i-n*(l/c),1-s-a*(c/l),n*(l/c),a*(c/l)];case 8:return[s-n,i-a,n,a];case 9:return[1-i,s-n,a,n];case 10:return[1-s,1-i,n,a];case 11:return[i-a,1-s,a,n];case 12:return[s-a*(c/l),i,a*(c/l),n*(l/c)];case 13:return[1-i-n*(l/c),s-a*(c/l),n*(l/c),a*(c/l)];case 14:return[1-s,1-i-n*(l/c),a*(c/l),n*(l/c)];case 15:return[i,1-s,n*(l/c),a*(c/l)];default:return[s,i,n,a]}},O(ot,"_currentDrawId",-1),O(ot,"_currentParent",null),y(ot,fe,null),y(ot,rl,null),y(ot,nl,null),y(ot,th,null),O(ot,"_INNER_MARGIN",3);let vu=ot;class Y{constructor(){O(this,"focusOutline",null)}toSVGPath(){vt("Abstract method `toSVGPath` must be implemented.")}get box(){vt("Abstract getter `box` must be implemented.")}serialize(t,e){vt("Abstract method `serialize` must be implemented.")}get defaultSVGProperties(){vt("Abstract getter `defaultSVGProperties` must be implemented.")}get defaultProperties(){return this.defaultSVGProperties}getFocusSVGProperties(t){return null}get focusMustRemoveSelfIntersections(){return!1}updateProperty(t,e){return null}updateParentDimensions(t,e){return null}serializeQuadPoints(t,e){return null}updateRotation(t){return{}}getPathResizingSVGProperties(t){return{}}getPathResizedSVGProperties(t){return{}}getPathTranslatedSVGProperties(t,e){return{}}static _rotateBox([t,e,s,i],n){switch(n){case 90:return[1-e-i,t,i,s];case 180:return[1-t-s,1-e-i,s,i];case 270:return[e,1-t-s,i,s]}return[t,e,s,i]}static _rescale(t,e,s,i,n,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o]*i,a[o+1]=s+t[o+1]*n;return a}static _rescaleAndSwap(t,e,s,i,n,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o+1]*i,a[o+1]=s+t[o]*n;return a}static _translate(t,e,s,i){i||(i=new Float32Array(t.length));for(let n=0,a=t.length;n<a;n+=2)i[n]=e+t[n],i[n+1]=s+t[n+1];return i}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,s,i,n){switch(n){case 90:return[1-e/s,t/i];case 180:return[1-t/s,1-e/i];case 270:return[e/s,1-t/i];default:return[t/s,e/i]}}static createBezierPoints(t,e,s,i,n,a){return[(t+5*s)/6,(e+5*i)/6,(5*s+n)/6,(5*i+a)/6,(s+n)/2,(i+a)/2]}}O(Y,"PRECISION",1e-4);var Bs,hi,eh,sh,Mi,ct,al,ol,Ud,Hd,ih,rh,hr,jd,Vp,Wp,_e,tu,MA,OA,RA,DA,FA,LA;const Ir=class Ir{constructor(t,e,s,i,n,a,o=0){y(this,_e);y(this,Bs);y(this,hi,[]);y(this,eh);y(this,sh);y(this,Mi,[]);y(this,ct,new Float32Array(18));y(this,al);y(this,ol);y(this,Ud);y(this,Hd);y(this,ih);y(this,rh);y(this,hr,[]);p(this,Bs,s),p(this,rh,n*i),p(this,sh,a),r(this,ct).set([NaN,NaN,NaN,NaN,t,e],6),p(this,eh,o),p(this,Hd,r(Ir,jd)*i),p(this,Ud,r(Ir,Wp)*i),p(this,ih,i),r(this,hr).push(t,e)}isEmpty(){return isNaN(r(this,ct)[8])}isCancellable(){return r(this,hr).length<=10}removeLastElement(){return r(this,ct).fill(NaN),r(this,Mi).length=r(this,hi).length=r(this,hr).length=0,{path:{d:""}}}add(t,e){var k;p(this,al,t),p(this,ol,e);const[s,i,n,a]=r(this,Bs);let[o,l,c,h]=r(this,ct).subarray(8,12);const d=t-c,f=e-h,g=Math.hypot(d,f);if(g<r(this,Ud))return!1;const m=g-r(this,Hd),v=m/g,w=v*d,A=v*f;let _=o,E=l;o=c,l=h,c+=w,h+=A,(k=r(this,hr))==null||k.push(t,e);const S=-A/m,x=w/m,T=S*r(this,rh),C=x*r(this,rh);return r(this,ct).set(r(this,ct).subarray(2,8),0),r(this,ct).set([c+T,h+C],4),r(this,ct).set(r(this,ct).subarray(14,18),12),r(this,ct).set([c-T,h-C],16),isNaN(r(this,ct)[6])?(r(this,Mi).length===0&&(r(this,ct).set([o+T,l+C],2),r(this,Mi).push(NaN,NaN,NaN,NaN,(o+T-s)/n,(l+C-i)/a),r(this,ct).set([o-T,l-C],14),r(this,hi).push(NaN,NaN,NaN,NaN,(o-T-s)/n,(l-C-i)/a)),r(this,ct).set([_,E,o,l,c,h],6),!this.isEmpty()):(r(this,ct).set([_,E,o,l,c,h],6),Math.abs(Math.atan2(E-l,_-o)-Math.atan2(A,w))<Math.PI/2?([o,l,c,h]=r(this,ct).subarray(2,6),r(this,Mi).push(NaN,NaN,NaN,NaN,((o+c)/2-s)/n,((l+h)/2-i)/a),[o,l,_,E]=r(this,ct).subarray(14,18),r(this,hi).push(NaN,NaN,NaN,NaN,((_+o)/2-s)/n,((E+l)/2-i)/a),!0):([_,E,o,l,c,h]=r(this,ct).subarray(0,6),r(this,Mi).push(((_+5*o)/6-s)/n,((E+5*l)/6-i)/a,((5*o+c)/6-s)/n,((5*l+h)/6-i)/a,((o+c)/2-s)/n,((l+h)/2-i)/a),[c,h,o,l,_,E]=r(this,ct).subarray(12,18),r(this,hi).push(((_+5*o)/6-s)/n,((E+5*l)/6-i)/a,((5*o+c)/6-s)/n,((5*l+h)/6-i)/a,((o+c)/2-s)/n,((l+h)/2-i)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const t=r(this,Mi),e=r(this,hi);if(isNaN(r(this,ct)[6])&&!this.isEmpty())return b(this,_e,MA).call(this);const s=[];s.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)isNaN(t[i])?s.push(`L${t[i+4]} ${t[i+5]}`):s.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);b(this,_e,RA).call(this,s);for(let i=e.length-6;i>=6;i-=6)isNaN(e[i])?s.push(`L${e[i+4]} ${e[i+5]}`):s.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);return b(this,_e,OA).call(this,s),s.join(" ")}newFreeDrawOutline(t,e,s,i,n,a){return new NA(t,e,s,i,n,a)}getOutlines(){var d;const t=r(this,Mi),e=r(this,hi),s=r(this,ct),[i,n,a,o]=r(this,Bs),l=new Float32Array((((d=r(this,hr))==null?void 0:d.length)??0)+2);for(let f=0,g=l.length-2;f<g;f+=2)l[f]=(r(this,hr)[f]-i)/a,l[f+1]=(r(this,hr)[f+1]-n)/o;if(l[l.length-2]=(r(this,al)-i)/a,l[l.length-1]=(r(this,ol)-n)/o,isNaN(s[6])&&!this.isEmpty())return b(this,_e,DA).call(this,l);const c=new Float32Array(r(this,Mi).length+24+r(this,hi).length);let h=t.length;for(let f=0;f<h;f+=2){if(isNaN(t[f])){c[f]=c[f+1]=NaN;continue}c[f]=t[f],c[f+1]=t[f+1]}h=b(this,_e,LA).call(this,c,h);for(let f=e.length-6;f>=6;f-=6)for(let g=0;g<6;g+=2){if(isNaN(e[f+g])){c[h]=c[h+1]=NaN,h+=2;continue}c[h]=e[f+g],c[h+1]=e[f+g+1],h+=2}return b(this,_e,FA).call(this,c,h),this.newFreeDrawOutline(c,l,r(this,Bs),r(this,ih),r(this,eh),r(this,sh))}};Bs=new WeakMap,hi=new WeakMap,eh=new WeakMap,sh=new WeakMap,Mi=new WeakMap,ct=new WeakMap,al=new WeakMap,ol=new WeakMap,Ud=new WeakMap,Hd=new WeakMap,ih=new WeakMap,rh=new WeakMap,hr=new WeakMap,jd=new WeakMap,Vp=new WeakMap,Wp=new WeakMap,_e=new WeakSet,tu=function(){const t=r(this,ct).subarray(4,6),e=r(this,ct).subarray(16,18),[s,i,n,a]=r(this,Bs);return[(r(this,al)+(t[0]-e[0])/2-s)/n,(r(this,ol)+(t[1]-e[1])/2-i)/a,(r(this,al)+(e[0]-t[0])/2-s)/n,(r(this,ol)+(e[1]-t[1])/2-i)/a]},MA=function(){const[t,e,s,i]=r(this,Bs),[n,a,o,l]=b(this,_e,tu).call(this);return`M${(r(this,ct)[2]-t)/s} ${(r(this,ct)[3]-e)/i} L${(r(this,ct)[4]-t)/s} ${(r(this,ct)[5]-e)/i} L${n} ${a} L${o} ${l} L${(r(this,ct)[16]-t)/s} ${(r(this,ct)[17]-e)/i} L${(r(this,ct)[14]-t)/s} ${(r(this,ct)[15]-e)/i} Z`},OA=function(t){const e=r(this,hi);t.push(`L${e[4]} ${e[5]} Z`)},RA=function(t){const[e,s,i,n]=r(this,Bs),a=r(this,ct).subarray(4,6),o=r(this,ct).subarray(16,18),[l,c,h,d]=b(this,_e,tu).call(this);t.push(`L${(a[0]-e)/i} ${(a[1]-s)/n} L${l} ${c} L${h} ${d} L${(o[0]-e)/i} ${(o[1]-s)/n}`)},DA=function(t){const e=r(this,ct),[s,i,n,a]=r(this,Bs),[o,l,c,h]=b(this,_e,tu).call(this),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(e[2]-s)/n,(e[3]-i)/a,NaN,NaN,NaN,NaN,(e[4]-s)/n,(e[5]-i)/a,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,c,h,NaN,NaN,NaN,NaN,(e[16]-s)/n,(e[17]-i)/a,NaN,NaN,NaN,NaN,(e[14]-s)/n,(e[15]-i)/a],0),this.newFreeDrawOutline(d,t,r(this,Bs),r(this,ih),r(this,eh),r(this,sh))},FA=function(t,e){const s=r(this,hi);return t.set([NaN,NaN,NaN,NaN,s[4],s[5]],e),e+=6},LA=function(t,e){const s=r(this,ct).subarray(4,6),i=r(this,ct).subarray(16,18),[n,a,o,l]=r(this,Bs),[c,h,d,f]=b(this,_e,tu).call(this);return t.set([NaN,NaN,NaN,NaN,(s[0]-n)/o,(s[1]-a)/l,NaN,NaN,NaN,NaN,c,h,NaN,NaN,NaN,NaN,d,f,NaN,NaN,NaN,NaN,(i[0]-n)/o,(i[1]-a)/l],e),e+=24},y(Ir,jd,8),y(Ir,Vp,2),y(Ir,Wp,r(Ir,jd)+r(Ir,Vp));let bp=Ir;var nh,ur,an,$d,Oi,Gd,Zt,Xp,BA;class NA extends Y{constructor(e,s,i,n,a,o){super();y(this,Xp);y(this,nh);y(this,ur,new Float32Array(4));y(this,an);y(this,$d);y(this,Oi);y(this,Gd);y(this,Zt);p(this,Zt,e),p(this,Oi,s),p(this,nh,i),p(this,Gd,n),p(this,an,a),p(this,$d,o),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],b(this,Xp,BA).call(this,o);const[l,c,h,d]=r(this,ur);for(let f=0,g=e.length;f<g;f+=2)e[f]=(e[f]-l)/h,e[f+1]=(e[f+1]-c)/d;for(let f=0,g=s.length;f<g;f+=2)s[f]=(s[f]-l)/h,s[f+1]=(s[f+1]-c)/d}toSVGPath(){const e=[`M${r(this,Zt)[4]} ${r(this,Zt)[5]}`];for(let s=6,i=r(this,Zt).length;s<i;s+=6){if(isNaN(r(this,Zt)[s])){e.push(`L${r(this,Zt)[s+4]} ${r(this,Zt)[s+5]}`);continue}e.push(`C${r(this,Zt)[s]} ${r(this,Zt)[s+1]} ${r(this,Zt)[s+2]} ${r(this,Zt)[s+3]} ${r(this,Zt)[s+4]} ${r(this,Zt)[s+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,s,i,n],a){const o=i-e,l=n-s;let c,h;switch(a){case 0:c=Y._rescale(r(this,Zt),e,n,o,-l),h=Y._rescale(r(this,Oi),e,n,o,-l);break;case 90:c=Y._rescaleAndSwap(r(this,Zt),e,s,o,l),h=Y._rescaleAndSwap(r(this,Oi),e,s,o,l);break;case 180:c=Y._rescale(r(this,Zt),i,s,-o,l),h=Y._rescale(r(this,Oi),i,s,-o,l);break;case 270:c=Y._rescaleAndSwap(r(this,Zt),i,n,-o,-l),h=Y._rescaleAndSwap(r(this,Oi),i,n,-o,-l);break}return{outline:Array.from(c),points:[Array.from(h)]}}get box(){return r(this,ur)}newOutliner(e,s,i,n,a,o,l=0){return new bp(e,s,i,n,a,o,l)}updateThickness(e){const s=this.getNewOutline(e);return p(this,Zt,r(s,Zt)),p(this,Oi,r(s,Oi)),r(this,ur).set(r(s,ur)),this.firstPoint=s.firstPoint,this.lastPoint=s.lastPoint,r(this,ur)}getNewOutline(e,s){const[i,n,a,o]=r(this,ur),[l,c,h,d]=r(this,nh),f=a*h,g=o*d,m=i*h+l,v=n*d+c,w=r(this,Oi),A=this.newOutliner(w[0]*f+m,w[1]*g+v,r(this,nh),r(this,Gd),e,r(this,$d),s??r(this,an));for(let _=2,E=w.length;_<E;_+=2)A.add(w[_]*f+m,w[_+1]*g+v);return A.getOutlines()}}nh=new WeakMap,ur=new WeakMap,an=new WeakMap,$d=new WeakMap,Oi=new WeakMap,Gd=new WeakMap,Zt=new WeakMap,Xp=new WeakSet,BA=function(e){const s=r(this,Zt);let i=s[4],n=s[5];const a=[i,n,i,n];let o=i,l=n,c=i,h=n;const d=e?Math.max:Math.min,f=new Float32Array(4);for(let m=6,v=s.length;m<v;m+=6){const w=s[m+4],A=s[m+5];isNaN(s[m])?(j.pointBoundingBox(w,A,a),l>A?(o=w,l=A):l===A&&(o=d(o,w)),h<A?(c=w,h=A):h===A&&(c=d(c,w))):(f.set(wr,0),j.bezierBoundingBox(i,n,...s.slice(m,m+6),f),j.rectBoundingBox(...f,a),l>f[1]?(o=f[0],l=f[1]):l===f[1]&&(o=d(o,f[0])),h<f[3]?(c=f[2],h=f[3]):h===f[3]&&(c=d(c,f[2]))),i=w,n=A}const g=r(this,ur);g[0]=a[0]-r(this,an),g[1]=a[1]-r(this,an),g[2]=a[2]-a[0]+2*r(this,an),g[3]=a[3]-a[1]+2*r(this,an),this.firstPoint=[o,l],this.lastPoint=[c,h]};function UA(u){return{bbox:u.box,root:{viewBox:"0 0 1 1"},rootClass:{highlight:!0,free:u.isFree},path:{d:u.toSVGPath()}}}function HA(u,t){const{focusOutline:e}=u;return{bbox:Y._rotateBox(e.box,t),root:{"data-main-rotation":t},rootClass:{highlightOutline:!0,free:u.isFree},path:{d:e.toSVGPath()}}}var zd,Vd,Wd,fa,Ri,ls,jA,ep,$A,GA,fv;class dv{constructor(t,e=0,s=0,i=!0){y(this,ls);y(this,zd);y(this,Vd);y(this,Wd);y(this,fa,[]);y(this,Ri,[]);const n=wr.slice(),a=10**-4;for(const{x:v,y:w,width:A,height:_}of t){const E=Math.floor((v-e)/a)*a,S=Math.ceil((v+A+e)/a)*a,x=Math.floor((w-e)/a)*a,T=Math.ceil((w+_+e)/a)*a,C=[E,x,T,!0],I=[S,x,T,!1];r(this,fa).push(C,I),j.rectBoundingBox(E,x,S,T,n)}const o=n[2]-n[0]+2*s,l=n[3]-n[1]+2*s,c=n[0]-s,h=n[1]-s;let d=i?-1/0:1/0,f=1/0;const g=r(this,fa).at(i?-1:-2),m=[g[0],g[2]];for(const v of r(this,fa)){const[w,A,_,E]=v;!E&&i?A<f?(f=A,d=w):A===f&&(d=Math.max(d,w)):E&&!i&&(A<f?(f=A,d=w):A===f&&(d=Math.min(d,w))),v[0]=(w-c)/o,v[1]=(A-h)/l,v[2]=(_-h)/l}p(this,zd,new Float32Array([c,h,o,l])),p(this,Vd,[d,f]),p(this,Wd,m)}getOutlines(){r(this,fa).sort((e,s)=>e[0]-s[0]||e[1]-s[1]||e[2]-s[2]);const t=[];for(const e of r(this,fa))e[3]?(t.push(...b(this,ls,fv).call(this,e)),b(this,ls,$A).call(this,e)):(b(this,ls,GA).call(this,e),t.push(...b(this,ls,fv).call(this,e)));return b(this,ls,jA).call(this,t)}}zd=new WeakMap,Vd=new WeakMap,Wd=new WeakMap,fa=new WeakMap,Ri=new WeakMap,ls=new WeakSet,jA=function(t){const e=[],s=new Set;for(const n of t){const[a,o,l]=n;e.push([a,o,n],[a,l,n])}e.sort((n,a)=>n[1]-a[1]||n[0]-a[0]);for(let n=0,a=e.length;n<a;n+=2){const o=e[n][2],l=e[n+1][2];o.push(l),l.push(o),s.add(o),s.add(l)}const i=[];for(;s.size>0;){const n=s.values().next().value;let[a,o,l,c,h]=n;s.delete(n);let d=a,f=o;const g=[a,l];for(i.push(g);;){let m;if(s.has(c))m=c;else if(s.has(h))m=h;else break;s.delete(m),[a,o,l,c,h]=m,d!==a&&(g.push(d,f,a,f===o?o:l),d=a),f=f===o?l:o}g.push(d,f)}return new pv(i,r(this,zd),r(this,Vd),r(this,Wd))},ep=function(t){const e=r(this,Ri);let s=0,i=e.length-1;for(;s<=i;){const n=s+i>>1,a=e[n][0];if(a===t)return n;a<t?s=n+1:i=n-1}return i+1},$A=function([,t,e]){const s=b(this,ls,ep).call(this,t);r(this,Ri).splice(s,0,[t,e])},GA=function([,t,e]){const s=b(this,ls,ep).call(this,t);for(let i=s;i<r(this,Ri).length;i++){const[n,a]=r(this,Ri)[i];if(n!==t)break;if(n===t&&a===e){r(this,Ri).splice(i,1);return}}for(let i=s-1;i>=0;i--){const[n,a]=r(this,Ri)[i];if(n!==t)break;if(n===t&&a===e){r(this,Ri).splice(i,1);return}}},fv=function(t){const[e,s,i]=t,n=[[e,s,i]],a=b(this,ls,ep).call(this,i);for(let o=0;o<a;o++){const[l,c]=r(this,Ri)[o];for(let h=0,d=n.length;h<d;h++){const[,f,g]=n[h];if(!(c<=f||g<=l)){if(f>=l){if(g>c)n[h][1]=c;else{if(d===1)return[];n.splice(h,1),h--,d--}continue}n[h][2]=l,g>c&&n.push([e,c,g])}}}return n};var Xd,Yd,ah;class pv extends Y{constructor(e,s,i,n){super();y(this,Xd);y(this,Yd,null);y(this,ah);p(this,ah,e),p(this,Xd,s),this.firstPoint=i,this.lastPoint=n}static build(e,s){const i=new dv(e,.001).getOutlines();return p(i,Yd,e),i.focusOutline=new dv(e,.0025,.001,s).getOutlines(),i}get isFree(){return!1}get defaultSVGProperties(){return UA(this)}getFocusSVGProperties(e){return HA(this,e)}updateRotation(e){return{root:{"data-main-rotation":e}}}serializeQuadPoints([e,s],[i,n]){const a=r(this,Yd),o=new Float32Array(a.length*8);let l=0;for(const{x:c,y:h,width:d,height:f}of a){const g=c*i+e,m=(1-h)*n+s;o[l]=o[l+4]=g,o[l+1]=o[l+3]=m,o[l+2]=o[l+6]=g+d*i,o[l+5]=o[l+7]=m-f*n,l+=8}return o}toSVGPath(){const e=[];for(const s of r(this,ah)){let[i,n]=s;e.push(`M${i} ${n}`);for(let a=2;a<s.length;a+=2){const o=s[a],l=s[a+1];o===i?(e.push(`V${l}`),n=l):l===n&&(e.push(`H${o}`),i=o)}e.push("Z")}return e.join(" ")}serialize([e,s,i,n],a){const o=[],l=i-e,c=n-s;for(const h of r(this,ah)){const d=new Array(h.length);for(let f=0;f<h.length;f+=2)d[f]=e+h[f]*l,d[f+1]=n-h[f+1]*c;o.push(d)}return o}get box(){return r(this,Xd)}}Xd=new WeakMap,Yd=new WeakMap,ah=new WeakMap;class ay extends bp{newFreeDrawOutline(t,e,s,i,n,a){return new gv(t,e,s,i,n,a)}}var Us,Kd;class ix{constructor(t,e,s,i,n,a,o){y(this,Us);y(this,Kd);p(this,Us,new ay(t,e,s,i,n,a,o)),p(this,Kd,n)}add(t,e){return r(this,Us).add(t,e)?{path:{d:r(this,Us).toSVGPath()}}:null}addPoints(t){let e=!1;for(let s=0,i=t.length;s<i;s+=2)e=r(this,Us).add(t[s],t[s+1])||e;return e?{path:{d:r(this,Us).toSVGPath()}}:null}end(t,e){return t===void 0?null:this.add(t,e)}isEmpty(){return r(this,Us).isEmpty()}isCancellable(){return r(this,Us).isCancellable()}removeLastElement(){return r(this,Us).removeLastElement()}updateProperty(t,e){return null}getOutlines(){const t=r(this,Us).getOutlines();return t.buildFocusOutline(2*r(this,Kd)),t}get defaultSVGProperties(){return{bbox:[0,0,1,1],root:{viewBox:"0 0 1 1"},rootClass:{highlight:!0,free:!0},path:{d:r(this,Us).toSVGPath()}}}}Us=new WeakMap,Kd=new WeakMap;var Yp;const Kp=class Kp extends NA{newOutliner(t,e,s,i,n,a,o=0){return new ay(t,e,s,i,n,a,o)}get isFree(){return!0}buildFocusOutline(t){this.focusOutline=this.getNewOutline(t/2+r(Kp,Yp),.0025)}get defaultSVGProperties(){return UA(this)}getFocusSVGProperties(t){return HA(this,t)}get focusMustRemoveSelfIntersections(){return!0}updateRotation(t){return{root:{"data-main-rotation":t}}}updateProperty(t,e){if(t!=="thickness")return null;const s=this.updateThickness(e/2);return this.buildFocusOutline(e),s}getPathResizedSVGProperties(){return{path:{d:this.toSVGPath()}}}};Yp=new WeakMap,y(Kp,Yp,1.5);let gv=Kp;class oy extends ny{constructor(t=null){super(),super.updateProperties(t)}updateSVGProperty(t,e){t!=="thickness"&&super.updateSVGProperty(t,e)}clone(){const t=new oy;return t.updateAll(this),t}}var oh,qd,Jd,Qd,Zd,lh,Xs,mv,zA,sp,VA;const ts=class ts extends vu{constructor(e){var s;super({...e,name:"highlightEditor"});y(this,Xs);y(this,oh,null);y(this,qd,0);y(this,Jd,null);y(this,Qd,0);y(this,Zd,"");y(this,lh,"");p(this,oh,e.anchorNode||null),p(this,qd,e.anchorOffset||0),p(this,Jd,e.focusNode||null),p(this,Qd,e.focusOffset||0),p(this,Zd,e.methodOfCreation||((s=this._drawOutlines)!=null&&s.isFree?"main_toolbar":"")),p(this,lh,e.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",this.rotate()}static get _keyboardManager(){const e=ts.prototype;return V(this,"_keyboardManager",new bl([[["ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown"],e._moveCaret,{args:[3]}]]))}static initialize(e,s){var i;Mt.initialize(e,s),this._defaultDrawingOptions||(this._defaultDrawingOptions=new oy({fill:((i=s.highlightColors)==null?void 0:i.values().next().value)||"#fff066","fill-opacity":ts._DEFAULT_OPACITY,thickness:ts._DEFAULT_THICKNESS}))}static getDefaultDrawingOptions(e){const s=this._defaultDrawingOptions.clone();return s.updateProperties(e),s}static get typesMap(){return V(this,"typesMap",new Map([[dt.HIGHLIGHT_COLOR,"fill"],[dt.HIGHLIGHT_THICKNESS,"thickness"]]))}static get isDrawer(){return!1}static get _hasClipPath(){return!0}static get _hasDrawClass(){return!1}_addOutlines(e){const{boxes:s,drawOutlines:i}=e;!s&&!i||(this._drawingOptions||(this._drawingOptions=e.drawingOptions||ts.getDefaultDrawingOptions()),s&&(e={...e,drawOutlines:pv.build(s,this._uiManager.direction==="ltr")}),super._addOutlines(e))}get colorType(){return dt.HIGHLIGHT_COLOR}get color(){return this._drawingOptions.fill}get opacity(){return this._drawingOptions["fill-opacity"]}get _opacityName(){return"fill-opacity"}get _drawRotation(){var e;return(e=this._drawOutlines)!=null&&e.isFree?this.rotation:0}get isResizable(){return!1}get _mustBeDisabledOnCommit(){return!1}get _mustFixPosition(){var e;return!((e=this._drawOutlines)!=null&&e.isFree)}get telemetryInitialData(){return{action:"added",type:this._drawOutlines.isFree?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this._drawingOptions.thickness,methodOfCreation:r(this,Zd)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}translateInPage(e,s){}get toolbarPosition(){return b(this,Xs,mv).call(this,this._drawOutlines.focusOutline.lastPoint)}get commentButtonPosition(){return b(this,Xs,mv).call(this,this._drawOutlines.firstPoint)}updateParams(e,s){switch(e){case dt.HIGHLIGHT_COLOR:this._updateColorAndOpacity(s,ts._DEFAULT_OPACITY,e),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(s)},!0);break;case dt.HIGHLIGHT_THICKNESS:super.updateParams(e,s),this._reportTelemetry({action:"thickness_changed",thickness:s},!0);break}}get propertiesToUpdate(){const e=super.propertiesToUpdate;return e.push([dt.HIGHLIGHT_FREE,this._drawOutlines.isFree]),e}get toolbarButtons(){return this._uiManager.highlightColors?(this._colorPicker=new gu({editor:this}),[["colorPicker",this._colorPicker]]):super.toolbarButtons}fixAndSetPosition(){return super.fixAndSetPosition(this._drawRotation)}getRect(e,s){return super.getRect(e,s,this._drawRotation)}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this._reportTelemetry({action:"deleted"}),super.remove()}render(){if(this.div)return this.div;const e=super.render();return r(this,lh)&&(e.setAttribute("aria-label",r(this,lh)),e.setAttribute("role","mark")),this._drawOutlines.isFree?e.classList.add("free"):e.addEventListener("keydown",b(this,Xs,zA).bind(this),{signal:this._uiManager._signal}),this.enableEditing(),e}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:b(this,Xs,sp).call(this,!0);break;case 1:case 3:b(this,Xs,sp).call(this,!1);break}}unselect(){super.unselect(),this._drawOutlines.isFree||b(this,Xs,sp).call(this,!1)}static createDrawerInstance({x:e,y:s,box:i,parent:n,isLTR:a}){return new ix(e,s,i,n.scale,this._defaultDrawingOptions.thickness/2,a,.001)}static _getDrawingTarget(e,{target:s}){return s.closest(".textLayer")}static _getPointerCoords({x:e,y:s}){return[e,s]}static _addDrawingListeners(e,s){e.classList.add("free"),s.addEventListener("abort",()=>e.classList.remove("free"),{once:!0}),window.addEventListener("blur",()=>this._endDraw(null),{signal:s}),window.addEventListener("pointerdown",me,{capture:!0,passive:!1,signal:s})}static _endDrawingSession(e=!1){return this.endDrawing(e)}createDrawingOptions({color:e,opacity:s,thickness:i}){const{_defaultDrawingOptions:n,_DEFAULT_OPACITY:a}=ts;this._drawingOptions=ts.getDefaultDrawingOptions({fill:j.makeHexColor(...e),"fill-opacity":s||a,thickness:i||n.thickness})}static deserializeDraw(e,s,i,n,a,o,l){const{quadPoints:c}=o;if(c){const m=[];for(let v=0,w=c.length;v<w;v+=8)m.push({x:(c[v]-e)/i,y:1-(c[v+1]-s)/n,width:(c[v+2]-c[v])/i,height:(c[v+1]-c[v+5])/n});return pv.build(m,l.direction==="ltr")}const h=o.thickness||this._defaultDrawingOptions.thickness,d=(o.inkLists||o.outlines.points)[0],f=new ay(d[0]-e,n-(d[1]-s),[0,0,i,n],1,h/2,!0,.001);for(let m=0,v=d.length;m<v;m+=2)f.add(d[m]-e,n-(d[m+1]-s));const g=f.getOutlines();return g.buildFocusOutline(h),g}static async deserialize(e,s,i){let n=null;if(e instanceof AA){const{data:{quadPoints:o,rect:l,rotation:c,id:h,color:d,opacity:f,popupRef:g,richText:m,contentsObj:v,creationDate:w,modificationDate:A},parent:{page:{pageNumber:_}}}=e;n=e={annotationType:it.HIGHLIGHT,color:Array.from(d),opacity:f,quadPoints:o,pageIndex:_-1,rect:l.slice(0),rotation:c,annotationElementId:h,id:h,deleted:!1,popupRef:g,richText:m,comment:(v==null?void 0:v.str)||null,creationDate:w,modificationDate:A}}else if(e instanceof ry){const{data:{inkLists:o,rect:l,rotation:c,id:h,color:d,borderStyle:{rawWidth:f},popupRef:g,richText:m,contentsObj:v,creationDate:w,modificationDate:A},parent:{page:{pageNumber:_}}}=e;n=e={annotationType:it.HIGHLIGHT,color:Array.from(d),thickness:f,inkLists:o,pageIndex:_-1,rect:l.slice(0),rotation:c,annotationElementId:h,id:h,deleted:!1,popupRef:g,richText:m,comment:(v==null?void 0:v.str)||null,creationDate:w,modificationDate:A}}const a=await super.deserialize(e,s,i);return a._initialData=n,e.comment&&a.setCommentData(e),a}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const s=super.serialize(e);return Object.assign(s,{color:Mt._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),opacity:this.opacity,thickness:this._drawingOptions.thickness,quadPoints:this._drawOutlines.serializeQuadPoints(this.pageTranslation,this.pageDimensions),outlines:this._drawOutlines.serialize(s.rect,this._drawRotation)}),this.addComment(s),this.annotationElementId&&!b(this,Xs,VA).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}};oh=new WeakMap,qd=new WeakMap,Jd=new WeakMap,Qd=new WeakMap,Zd=new WeakMap,lh=new WeakMap,Xs=new WeakSet,mv=function([e,s]){const[i,n,a,o]=this._drawOutlines.box;return[(e-i)/a,(s-n)/o]},zA=function(e){ts._keyboardManager.exec(this,e)},sp=function(e){if(!r(this,oh))return;const s=window.getSelection();e?s.setPosition(r(this,oh),r(this,qd)):s.setPosition(r(this,Jd),r(this,Qd))},VA=function(e){const{color:s}=this._initialData;return this.hasEditedComment||e.color.some((i,n)=>i!==s[n])},O(ts,"_DEFAULT_OPACITY",1),O(ts,"_DEFAULT_THICKNESS",12),O(ts,"_defaultDrawingOptions",null),O(ts,"_type","highlight"),O(ts,"_editorType",it.HIGHLIGHT);let wp=ts;var dr,pa,pe,Ne,ll,ch,Be,ge,ui,cl,hl,ul,Ys,ip,rp,vv;class rx{constructor(t,e,s,i,n,a){y(this,Ys);y(this,dr,new Float64Array(6));y(this,pa,new Float64Array(2));y(this,pe);y(this,Ne);y(this,ll);y(this,ch);y(this,Be);y(this,ge,"");y(this,ui,0);y(this,cl,new mf);y(this,hl);y(this,ul);p(this,hl,s),p(this,ul,i),p(this,ll,n),p(this,ch,a),[t,e]=b(this,Ys,ip).call(this,t,e);const o=p(this,pe,[NaN,NaN,NaN,NaN,t,e]);p(this,Be,[t,e]),p(this,Ne,[{line:o,points:r(this,Be)}]),r(this,dr).set(o,0),r(this,pa).set([t,e],0)}updateProperty(t,e){t==="stroke-width"&&p(this,ch,e)}isEmpty(){var t;return!((t=r(this,Ne))!=null&&t.length)}isCancellable(){return r(this,Be).length<=10}add(t,e){return b(this,Ys,rp).call(this,t,e)&&this.toSVGPath(),{path:{d:b(this,Ys,vv).call(this)}}}addPoints(t){let e=!1;for(let s=0,i=t.length;s<i;s+=2)b(this,Ys,rp).call(this,t[s],t[s+1])&&(e=!0,r(this,Be).length<=6&&(this.toSVGPath(),e=!1));return e&&this.toSVGPath(),{path:{d:b(this,Ys,vv).call(this)}}}end(t,e){return t!==void 0&&b(this,Ys,rp).call(this,t,e)?{path:{d:this.toSVGPath()}}:r(this,Be).length===2?{path:{d:this.toSVGPath()}}:{path:{d:r(this,ge)}}}startNew(t,e,s,i,n){p(this,hl,s),p(this,ul,i),p(this,ll,n),[t,e]=b(this,Ys,ip).call(this,t,e);const a=p(this,pe,[NaN,NaN,NaN,NaN,t,e]);p(this,Be,[t,e]),r(this,pa).set([t,e],0);const o=r(this,Ne).at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),r(this,Ne).push({line:a,points:r(this,Be)}),r(this,dr).set(a,0),p(this,ui,0),this.toSVGPath(),null}getLastElement(){return r(this,Ne).at(-1)}setLastElement(t){return r(this,Ne)?(r(this,Ne).push(t),p(this,pe,t.line),p(this,Be,t.points),p(this,ui,0),{path:{d:this.toSVGPath()}}):r(this,cl).setLastElement(t)}removeLastElement(){if(!r(this,Ne))return r(this,cl).removeLastElement();r(this,Ne).pop(),p(this,ge,"");for(let t=0,e=r(this,Ne).length;t<e;t++){const{line:s,points:i}=r(this,Ne)[t];p(this,pe,s),p(this,Be,i),p(this,ui,0),this.toSVGPath()}return{path:{d:r(this,ge)}}}toSVGPath(){const t=Y.svgRound(r(this,pe)[4]),e=Y.svgRound(r(this,pe)[5]);if(r(this,Be).length===2)return p(this,ge,`${r(this,ge)} M ${t} ${e} Z`),r(this,ge);if(r(this,Be).length<=6){const i=r(this,ge).lastIndexOf("M");p(this,ge,`${r(this,ge).slice(0,i)} M ${t} ${e}`),p(this,ui,6)}if(r(this,Be).length===4){const i=Y.svgRound(r(this,pe)[10]),n=Y.svgRound(r(this,pe)[11]);return p(this,ge,`${r(this,ge)} L ${i} ${n}`),p(this,ui,12),r(this,ge)}const s=[];r(this,ui)===0&&(s.push(`M ${t} ${e}`),p(this,ui,6));for(let i=r(this,ui),n=r(this,pe).length;i<n;i+=6){const[a,o,l,c,h,d]=r(this,pe).slice(i,i+6).map(Y.svgRound);s.push(`C${a} ${o} ${l} ${c} ${h} ${d}`)}return p(this,ge,r(this,ge)+s.join(" ")),p(this,ui,r(this,pe).length),r(this,ge)}getOutlines(t,e,s,i){const n=r(this,Ne).at(-1);return n.line=new Float32Array(n.line),n.points=new Float32Array(n.points),r(this,cl).build(r(this,Ne),t,e,s,r(this,ll),r(this,ch),i),p(this,dr,null),p(this,pe,null),p(this,Ne,null),p(this,ge,null),r(this,cl)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}dr=new WeakMap,pa=new WeakMap,pe=new WeakMap,Ne=new WeakMap,ll=new WeakMap,ch=new WeakMap,Be=new WeakMap,ge=new WeakMap,ui=new WeakMap,cl=new WeakMap,hl=new WeakMap,ul=new WeakMap,Ys=new WeakSet,ip=function(t,e){return Y._normalizePoint(t,e,r(this,hl),r(this,ul),r(this,ll))},rp=function(t,e){[t,e]=b(this,Ys,ip).call(this,t,e),r(this,pa).set([t,e],0);const[s,i,n,a]=r(this,dr).subarray(2,6),o=t-n,l=e-a;return Math.hypot(r(this,hl)*o,r(this,ul)*l)<=2?!1:(r(this,Be).push(t,e),isNaN(s)?(r(this,dr).set([n,a,t,e],2),r(this,pe).push(NaN,NaN,NaN,NaN,t,e),!0):(isNaN(r(this,dr)[0])&&r(this,pe).splice(6,6),r(this,dr).set([s,i,n,a,t,e],0),r(this,pe).push(...Y.createBezierPoints(s,i,n,a,t,e)),!0))},vv=function(){const t=Y.svgRound(r(this,pa)[0]),e=Y.svgRound(r(this,pa)[1]);if(r(this,Be).length===2){const s=Y.svgRound(r(this,pe)[4]),i=Y.svgRound(r(this,pe)[5]);return`${r(this,ge)} M ${s} ${i} L ${t} ${e}`}return`${r(this,ge)} L ${t} ${e}`};var ss,tf,ef,Hs,fr,pr,hh,uh,dl,He,Cr,WA,XA,YA;class mf extends Y{constructor(){super(...arguments);y(this,He);y(this,ss);y(this,tf,0);y(this,ef);y(this,Hs);y(this,fr);y(this,pr);y(this,hh);y(this,uh);y(this,dl)}build(e,s,i,n,a,o,l){p(this,fr,s),p(this,pr,i),p(this,hh,n),p(this,uh,a),p(this,dl,o),p(this,ef,l??0),p(this,Hs,e),b(this,He,XA).call(this)}get thickness(){return r(this,dl)}setLastElement(e){return r(this,Hs).push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return r(this,Hs).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:s}of r(this,Hs)){if(e.push(`M${Y.svgRound(s[4])} ${Y.svgRound(s[5])}`),s.length===6){e.push("Z");continue}if(s.length===12&&isNaN(s[6])){e.push(`L${Y.svgRound(s[10])} ${Y.svgRound(s[11])}`);continue}for(let i=6,n=s.length;i<n;i+=6){const[a,o,l,c,h,d]=s.subarray(i,i+6).map(Y.svgRound);e.push(`C${a} ${o} ${l} ${c} ${h} ${d}`)}}return e.join("")}serialize([e,s,i,n],a){const o=[],l=[],[c,h,d,f]=b(this,He,WA).call(this);let g,m,v,w,A,_,E,S,x;switch(r(this,uh)){case 0:x=Y._rescale,g=e,m=s+n,v=i,w=-n,A=e+c*i,_=s+(1-h-f)*n,E=e+(c+d)*i,S=s+(1-h)*n;break;case 90:x=Y._rescaleAndSwap,g=e,m=s,v=i,w=n,A=e+h*i,_=s+c*n,E=e+(h+f)*i,S=s+(c+d)*n;break;case 180:x=Y._rescale,g=e+i,m=s,v=-i,w=n,A=e+(1-c-d)*i,_=s+h*n,E=e+(1-c)*i,S=s+(h+f)*n;break;case 270:x=Y._rescaleAndSwap,g=e+i,m=s+n,v=-i,w=-n,A=e+(1-h-f)*i,_=s+(1-c-d)*n,E=e+(1-h)*i,S=s+(1-c)*n;break}for(const{line:T,points:C}of r(this,Hs))o.push(x(T,g,m,v,w,a?new Array(T.length):null)),l.push(x(C,g,m,v,w,a?new Array(C.length):null));return{lines:o,points:l,rect:[A,_,E,S]}}static deserialize(e,s,i,n,a,{paths:{lines:o,points:l},rotation:c,thickness:h}){const d=[];let f,g,m,v,w;switch(c){case 0:w=Y._rescale,f=-e/i,g=s/n+1,m=1/i,v=-1/n;break;case 90:w=Y._rescaleAndSwap,f=-s/n,g=-e/i,m=1/n,v=1/i;break;case 180:w=Y._rescale,f=e/i+1,g=-s/n,m=-1/i,v=1/n;break;case 270:w=Y._rescaleAndSwap,f=s/n+1,g=e/i+1,m=-1/n,v=-1/i;break}if(!o){o=[];for(const _ of l){const E=_.length;if(E===2){o.push(new Float32Array([NaN,NaN,NaN,NaN,_[0],_[1]]));continue}if(E===4){o.push(new Float32Array([NaN,NaN,NaN,NaN,_[0],_[1],NaN,NaN,NaN,NaN,_[2],_[3]]));continue}const S=new Float32Array(3*(E-2));o.push(S);let[x,T,C,I]=_.subarray(0,4);S.set([NaN,NaN,NaN,NaN,x,T],0);for(let k=4;k<E;k+=2){const M=_[k],R=_[k+1];S.set(Y.createBezierPoints(x,T,C,I,M,R),(k-2)*3),[x,T,C,I]=[C,I,M,R]}}}for(let _=0,E=o.length;_<E;_++)d.push({line:w(o[_].map(S=>S??NaN),f,g,m,v),points:w(l[_].map(S=>S??NaN),f,g,m,v)});const A=new this.prototype.constructor;return A.build(d,i,n,1,c,h,a),A}get box(){return r(this,ss)}updateProperty(e,s){return e==="stroke-width"?b(this,He,YA).call(this,s):null}updateParentDimensions([e,s],i){const[n,a]=b(this,He,Cr).call(this);p(this,fr,e),p(this,pr,s),p(this,hh,i);const[o,l]=b(this,He,Cr).call(this),c=o-n,h=l-a,d=r(this,ss);return d[0]-=c,d[1]-=h,d[2]+=2*c,d[3]+=2*h,d}updateRotation(e){return p(this,tf,e),{path:{transform:this.rotationTransform}}}get viewBox(){return r(this,ss).map(Y.svgRound).join(" ")}get defaultProperties(){const[e,s]=r(this,ss);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Y.svgRound(e)} ${Y.svgRound(s)}`}}}get rotationTransform(){const[,,e,s]=r(this,ss);let i=0,n=0,a=0,o=0,l=0,c=0;switch(r(this,tf)){case 90:n=s/e,a=-e/s,l=e;break;case 180:i=-1,o=-1,l=e,c=s;break;case 270:n=-s/e,a=e/s,c=s;break;default:return""}return`matrix(${i} ${n} ${a} ${o} ${Y.svgRound(l)} ${Y.svgRound(c)})`}getPathResizingSVGProperties([e,s,i,n]){const[a,o]=b(this,He,Cr).call(this),[l,c,h,d]=r(this,ss);if(Math.abs(h-a)<=Y.PRECISION||Math.abs(d-o)<=Y.PRECISION){const w=e+i/2-(l+h/2),A=s+n/2-(c+d/2);return{path:{"transform-origin":`${Y.svgRound(e)} ${Y.svgRound(s)}`,transform:`${this.rotationTransform} translate(${w} ${A})`}}}const f=(i-2*a)/(h-2*a),g=(n-2*o)/(d-2*o),m=h/i,v=d/n;return{path:{"transform-origin":`${Y.svgRound(l)} ${Y.svgRound(c)}`,transform:`${this.rotationTransform} scale(${m} ${v}) translate(${Y.svgRound(a)} ${Y.svgRound(o)}) scale(${f} ${g}) translate(${Y.svgRound(-a)} ${Y.svgRound(-o)})`}}}getPathResizedSVGProperties([e,s,i,n]){const[a,o]=b(this,He,Cr).call(this),l=r(this,ss),[c,h,d,f]=l;if(l[0]=e,l[1]=s,l[2]=i,l[3]=n,Math.abs(d-a)<=Y.PRECISION||Math.abs(f-o)<=Y.PRECISION){const A=e+i/2-(c+d/2),_=s+n/2-(h+f/2);for(const{line:E,points:S}of r(this,Hs))Y._translate(E,A,_,E),Y._translate(S,A,_,S);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Y.svgRound(e)} ${Y.svgRound(s)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const g=(i-2*a)/(d-2*a),m=(n-2*o)/(f-2*o),v=-g*(c+a)+e+a,w=-m*(h+o)+s+o;if(g!==1||m!==1||v!==0||w!==0)for(const{line:A,points:_}of r(this,Hs))Y._rescale(A,v,w,g,m,A),Y._rescale(_,v,w,g,m,_);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Y.svgRound(e)} ${Y.svgRound(s)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,s],i){const[n,a]=i,o=r(this,ss),l=e-o[0],c=s-o[1];if(r(this,fr)===n&&r(this,pr)===a)for(const{line:h,points:d}of r(this,Hs))Y._translate(h,l,c,h),Y._translate(d,l,c,d);else{const h=r(this,fr)/n,d=r(this,pr)/a;p(this,fr,n),p(this,pr,a);for(const{line:f,points:g}of r(this,Hs))Y._rescale(f,l,c,h,d,f),Y._rescale(g,l,c,h,d,g);o[2]*=h,o[3]*=d}return o[0]=e,o[1]=s,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Y.svgRound(e)} ${Y.svgRound(s)}`}}}get defaultSVGProperties(){const e=r(this,ss);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Y.svgRound(e[0])} ${Y.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}ss=new WeakMap,tf=new WeakMap,ef=new WeakMap,Hs=new WeakMap,fr=new WeakMap,pr=new WeakMap,hh=new WeakMap,uh=new WeakMap,dl=new WeakMap,He=new WeakSet,Cr=function(e=r(this,dl)){const s=r(this,ef)+e/2*r(this,hh);return r(this,uh)%180===0?[s/r(this,fr),s/r(this,pr)]:[s/r(this,pr),s/r(this,fr)]},WA=function(){const[e,s,i,n]=r(this,ss),[a,o]=b(this,He,Cr).call(this,0);return[e+a,s+o,i-2*a,n-2*o]},XA=function(){const e=p(this,ss,$a.slice());for(const{line:n}of r(this,Hs)){if(n.length<=12){for(let l=4,c=n.length;l<c;l+=6)j.pointBoundingBox(n[l],n[l+1],e);continue}let a=n[4],o=n[5];for(let l=6,c=n.length;l<c;l+=6){const[h,d,f,g,m,v]=n.subarray(l,l+6);j.bezierBoundingBox(a,o,h,d,f,g,m,v,e),a=m,o=v}}const[s,i]=b(this,He,Cr).call(this);e[0]=Nt(e[0]-s,0,1),e[1]=Nt(e[1]-i,0,1),e[2]=Nt(e[2]+s,0,1),e[3]=Nt(e[3]+i,0,1),e[2]-=e[0],e[3]-=e[1]},YA=function(e){const[s,i]=b(this,He,Cr).call(this);p(this,dl,e);const[n,a]=b(this,He,Cr).call(this),[o,l]=[n-s,a-i],c=r(this,ss);return c[0]-=o,c[1]-=l,c[2]+=2*o,c[3]+=2*l,c};class Og extends ny{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:Mt._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){t==="stroke-width"&&(e??(e=this["stroke-width"]),e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){const t=new Og(this._viewParameters);return t.updateAll(this),t}}var qp,KA;const jl=class jl extends vu{constructor(e){super({...e,name:"inkEditor"});y(this,qp);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,s){Mt.initialize(e,s),this._defaultDrawingOptions=new Og(s.viewParameters)}static getDefaultDrawingOptions(e){const s=this._defaultDrawingOptions.clone();return s.updateProperties(e),s}static get supportMultipleDrawings(){return!0}static get typesMap(){return V(this,"typesMap",new Map([[dt.INK_THICKNESS,"stroke-width"],[dt.INK_COLOR,"stroke"],[dt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance({x:e,y:s,box:[,,i,n],rotation:a}){return new rx(e,s,i,n,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,s,i,n,a,o){return mf.deserialize(e,s,i,n,a,o)}static async deserialize(e,s,i){let n=null;if(e instanceof ry){const{data:{inkLists:o,rect:l,rotation:c,id:h,color:d,opacity:f,borderStyle:{rawWidth:g},popupRef:m,richText:v,contentsObj:w,creationDate:A,modificationDate:_},parent:{page:{pageNumber:E}}}=e;n=e={annotationType:it.INK,color:Array.from(d),thickness:g,opacity:f,paths:{points:o},boxes:null,pageIndex:E-1,rect:l.slice(0),rotation:c,annotationElementId:h,id:h,deleted:!1,popupRef:m,richText:v,comment:(w==null?void 0:w.str)||null,creationDate:A,modificationDate:_}}const a=await super.deserialize(e,s,i);return a._initialData=n,e.comment&&a.setCommentData(e),a}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new vp(this)),[["colorPicker",this._colorPicker]]}get colorType(){return dt.INK_COLOR}get colorAndOpacityType(){return dt.INK_COLOR_AND_OPACITY}get opacityType(){return dt.INK_OPACITY}updateParams(e,s){if(e===dt.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(s.color,s.opacity);return}super.updateParams(e,s)}static updateDefaultParams(e,s){if(e===dt.INK_COLOR_AND_OPACITY){super.updateDefaultParams(dt.INK_COLOR,s.color),super.updateDefaultParams(dt.INK_OPACITY,s.opacity);return}super.updateDefaultParams(e,s)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:s,parent:i}=this;s.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(e,s.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:s,opacity:i}){this._drawingOptions=jl.getDefaultDrawingOptions({stroke:j.makeHexColor(...e),"stroke-width":s,"stroke-opacity":i})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:s,points:i}=this.serializeDraw(e),{_drawingOptions:{stroke:n,"stroke-opacity":a,"stroke-width":o}}=this,l=Object.assign(super.serialize(e),{color:Mt._colorManager.convert(n),opacity:a,thickness:o,paths:{lines:s,points:i}});return this.addComment(l),e?(l.isCopy=!0,l):this.annotationElementId&&!b(this,qp,KA).call(this,l)?null:(l.id=this.annotationElementId,l)}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;const{points:s,rect:i}=this.serializeDraw(!1);return e.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:s,popup:this.comment}),null}};qp=new WeakSet,KA=function(e){const{color:s,thickness:i,opacity:n,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((o,l)=>o!==s[l])||e.thickness!==i||e.opacity!==n||e.pageIndex!==a},O(jl,"_type","ink"),O(jl,"_editorType",it.INK),O(jl,"_defaultDrawingOptions",null);let yv=jl;class bv extends mf{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}Z0();const Ef=8,Fh=3;var fl,St,wv,Di,qA,JA,Av,np,QA,ZA,t_,_v,Sv,e_;class br{static extractContoursFromText(t,{fontFamily:e,fontStyle:s,fontWeight:i},n,a,o,l){let c=new OffscreenCanvas(1,1),h=c.getContext("2d",{alpha:!1});const d=200,f=h.font=`${s} ${i} ${d}px ${e}`,{actualBoundingBoxLeft:g,actualBoundingBoxRight:m,actualBoundingBoxAscent:v,actualBoundingBoxDescent:w,fontBoundingBoxAscent:A,fontBoundingBoxDescent:_,width:E}=h.measureText(t),S=1.5,x=Math.ceil(Math.max(Math.abs(g)+Math.abs(m)||0,E)*S),T=Math.ceil(Math.max(Math.abs(v)+Math.abs(w)||d,Math.abs(A)+Math.abs(_)||d)*S);c=new OffscreenCanvas(x,T),h=c.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=f,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,x,T),h.fillStyle="black",h.fillText(t,x*(S-1)/2,T*(3-S)/2);const C=b(this,St,_v).call(this,h.getImageData(0,0,x,T).data),I=b(this,St,t_).call(this,C),k=b(this,St,Sv).call(this,I),M=b(this,St,Av).call(this,C,x,T,k);return this.processDrawnLines({lines:{curves:M,width:x,height:T},pageWidth:n,pageHeight:a,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(t,e,s,i,n){const[a,o,l]=b(this,St,e_).call(this,t),[c,h]=b(this,St,ZA).call(this,a,o,l,Math.hypot(o,l)*r(this,fl).sigmaSFactor,r(this,fl).sigmaR,r(this,fl).kernelSize),d=b(this,St,Sv).call(this,h),f=b(this,St,Av).call(this,c,o,l,d);return this.processDrawnLines({lines:{curves:f,width:o,height:l},pageWidth:e,pageHeight:s,rotation:i,innerMargin:n,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:s,rotation:i,innerMargin:n,mustSmooth:a,areContours:o}){i%180!==0&&([e,s]=[s,e]);const{curves:l,width:c,height:h}=t,d=t.thickness??0,f=[],g=Math.min(e/c,s/h),m=g/e,v=g/s,w=[];for(const{points:_}of l){const E=a?b(this,St,QA).call(this,_):_;if(!E)continue;w.push(E);const S=E.length,x=new Float32Array(S),T=new Float32Array(3*(S===2?2:S-2));if(f.push({line:T,points:x}),S===2){x[0]=E[0]*m,x[1]=E[1]*v,T.set([NaN,NaN,NaN,NaN,x[0],x[1]],0);continue}let[C,I,k,M]=E;C*=m,I*=v,k*=m,M*=v,x.set([C,I,k,M],0),T.set([NaN,NaN,NaN,NaN,C,I],0);for(let R=4;R<S;R+=2){const N=x[R]=E[R]*m,F=x[R+1]=E[R+1]*v;T.set(Y.createBezierPoints(C,I,k,M,N,F),(R-2)*3),[C,I,k,M]=[k,M,N,F]}}if(f.length===0)return null;const A=o?new bv:new mf;return A.build(f,e,s,1,i,o?0:d,n),{outline:A,newCurves:w,areContours:o,thickness:d,width:c,height:h}}static async compressSignature({outlines:t,areContours:e,thickness:s,width:i,height:n}){let a=1/0,o=-1/0,l=0;for(const _ of t){l+=_.length;for(let E=2,S=_.length;E<S;E++){const x=_[E]-_[E-2];a=Math.min(a,x),o=Math.max(o,x)}}let c;a>=-128&&o<=127?c=Int8Array:a>=-32768&&o<=32767?c=Int16Array:c=Int32Array;const h=t.length,d=Ef+Fh*h,f=new Uint32Array(d);let g=0;f[g++]=d*Uint32Array.BYTES_PER_ELEMENT+(l-2*h)*c.BYTES_PER_ELEMENT,f[g++]=0,f[g++]=i,f[g++]=n,f[g++]=e?0:1,f[g++]=Math.max(0,Math.floor(s??0)),f[g++]=h,f[g++]=c.BYTES_PER_ELEMENT;for(const _ of t)f[g++]=_.length-2,f[g++]=_[0],f[g++]=_[1];const m=new CompressionStream("deflate-raw"),v=m.writable.getWriter();await v.ready,v.write(f);const w=c.prototype.constructor;for(const _ of t){const E=new w(_.length-2);for(let S=2,x=_.length;S<x;S++)E[S-2]=_[S]-_[S-2];v.write(E)}return v.close(),(await new Response(m.readable).bytes()).toBase64()}static async decompressSignature(t){try{const e=Uint8Array.fromBase64(t),{readable:s,writable:i}=new DecompressionStream("deflate-raw"),n=i.getWriter();await n.ready,n.write(e).then(async()=>{await n.ready,await n.close()}).catch(()=>{});let a=null,o=0;for await(const E of s)a||(a=new Uint8Array(new Uint32Array(E.buffer,0,4)[0])),a.set(E,o),o+=E.length;const l=new Uint32Array(a.buffer,0,a.length>>2),c=l[1];if(c!==0)throw new Error(`Invalid version: ${c}`);const h=l[2],d=l[3],f=l[4]===0,g=l[5],m=l[6],v=l[7],w=[],A=(Ef+Fh*m)*Uint32Array.BYTES_PER_ELEMENT;let _;switch(v){case Int8Array.BYTES_PER_ELEMENT:_=new Int8Array(a.buffer,A);break;case Int16Array.BYTES_PER_ELEMENT:_=new Int16Array(a.buffer,A);break;case Int32Array.BYTES_PER_ELEMENT:_=new Int32Array(a.buffer,A);break}o=0;for(let E=0;E<m;E++){const S=l[Fh*E+Ef],x=new Float32Array(S+2);w.push(x);for(let T=0;T<Fh-1;T++)x[T]=l[Fh*E+Ef+T+1];for(let T=0;T<S;T++)x[T+2]=x[T]+_[o++]}return{areContours:f,thickness:g,outlines:w,width:h,height:d}}catch(e){return st(`decompressSignature: ${e}`),null}}}fl=new WeakMap,St=new WeakSet,wv=function(t,e,s,i){return s-=t,i-=e,s===0?i>0?0:4:s===1?i+6:2-i},Di=new WeakMap,qA=function(t,e,s,i,n,a,o){const l=b(this,St,wv).call(this,s,i,n,a);for(let c=0;c<8;c++){const h=(-c+l-o+16)%8,d=r(this,Di)[2*h],f=r(this,Di)[2*h+1];if(t[(s+d)*e+(i+f)]!==0)return h}return-1},JA=function(t,e,s,i,n,a,o){const l=b(this,St,wv).call(this,s,i,n,a);for(let c=0;c<8;c++){const h=(c+l+o+16)%8,d=r(this,Di)[2*h],f=r(this,Di)[2*h+1];if(t[(s+d)*e+(i+f)]!==0)return h}return-1},Av=function(t,e,s,i){const n=t.length,a=new Int32Array(n);for(let h=0;h<n;h++)a[h]=t[h]<=i?1:0;for(let h=1;h<s-1;h++)a[h*e]=a[h*e+e-1]=0;for(let h=0;h<e;h++)a[h]=a[e*s-1-h]=0;let o=1,l;const c=[];for(let h=1;h<s-1;h++){l=1;for(let d=1;d<e-1;d++){const f=h*e+d,g=a[f];if(g===0)continue;let m=h,v=d;if(g===1&&a[f-1]===0)o+=1,v-=1;else if(g>=1&&a[f+1]===0)o+=1,v+=1,g>1&&(l=g);else{g!==1&&(l=Math.abs(g));continue}const w=[d,h],A=v===d+1,_={isHole:A,points:w,id:o,parent:0};c.push(_);let E;for(const R of c)if(R.id===l){E=R;break}E?E.isHole?_.parent=A?E.parent:l:_.parent=A?l:E.parent:_.parent=A?l:0;const S=b(this,St,qA).call(this,a,e,h,d,m,v,0);if(S===-1){a[f]=-o,a[f]!==1&&(l=Math.abs(a[f]));continue}let x=r(this,Di)[2*S],T=r(this,Di)[2*S+1];const C=h+x,I=d+T;m=C,v=I;let k=h,M=d;for(;;){const R=b(this,St,JA).call(this,a,e,k,M,m,v,1);x=r(this,Di)[2*R],T=r(this,Di)[2*R+1];const N=k+x,F=M+T;w.push(F,N);const $=k*e+M;if(a[$+1]===0?a[$]=-o:a[$]===1&&(a[$]=o),N===h&&F===d&&k===C&&M===I){a[f]!==1&&(l=Math.abs(a[f]));break}else m=k,v=M,k=N,M=F}}}return c},np=function(t,e,s,i){if(s-e<=4){for(let C=e;C<s-2;C+=2)i.push(t[C],t[C+1]);return}const n=t[e],a=t[e+1],o=t[s-4]-n,l=t[s-3]-a,c=Math.hypot(o,l),h=o/c,d=l/c,f=h*a-d*n,g=l/o,m=1/c,v=Math.atan(g),w=Math.cos(v),A=Math.sin(v),_=m*(Math.abs(w)+Math.abs(A)),E=m*(1-_+_**2),S=Math.max(Math.atan(Math.abs(A+w)*E),Math.atan(Math.abs(A-w)*E));let x=0,T=e;for(let C=e+2;C<s-2;C+=2){const I=Math.abs(f-h*t[C+1]+d*t[C]);I>x&&(T=C,x=I)}x>(c*S)**2?(b(this,St,np).call(this,t,e,T+2,i),b(this,St,np).call(this,t,T,s,i)):i.push(n,a)},QA=function(t){const e=[],s=t.length;return b(this,St,np).call(this,t,0,s,e),e.push(t[s-2],t[s-1]),e.length<=4?null:e},ZA=function(t,e,s,i,n,a){const o=new Float32Array(a**2),l=-2*i**2,c=a>>1;for(let v=0;v<a;v++){const w=(v-c)**2;for(let A=0;A<a;A++)o[v*a+A]=Math.exp((w+(A-c)**2)/l)}const h=new Float32Array(256),d=-2*n**2;for(let v=0;v<256;v++)h[v]=Math.exp(v**2/d);const f=t.length,g=new Uint8Array(f),m=new Uint32Array(256);for(let v=0;v<s;v++)for(let w=0;w<e;w++){const A=v*e+w,_=t[A];let E=0,S=0;for(let T=0;T<a;T++){const C=v+T-c;if(!(C<0||C>=s))for(let I=0;I<a;I++){const k=w+I-c;if(k<0||k>=e)continue;const M=t[C*e+k],R=o[T*a+I]*h[Math.abs(M-_)];E+=M*R,S+=R}}const x=g[A]=Math.round(E/S);m[x]++}return[g,m]},t_=function(t){const e=new Uint32Array(256);for(const s of t)e[s]++;return e},_v=function(t){const e=t.length,s=new Uint8ClampedArray(e>>2);let i=-1/0,n=1/0;for(let o=0,l=s.length;o<l;o++){const c=s[o]=t[o<<2];i=Math.max(i,c),n=Math.min(n,c)}const a=255/(i-n);for(let o=0,l=s.length;o<l;o++)s[o]=(s[o]-n)*a;return s},Sv=function(t){let e,s=-1/0,i=-1/0;const n=t.findIndex(l=>l!==0);let a=n,o=n;for(e=n;e<256;e++){const l=t[e];l>s&&(e-a>i&&(i=e-a,o=e-1),s=l,a=e)}for(e=o-1;e>=0&&!(t[e]>t[e+1]);e--);return e},e_=function(t){const e=t,{width:s,height:i}=t,{maxDim:n}=r(this,fl);let a=s,o=i;if(s>n||i>n){let f=s,g=i,m=Math.log2(Math.max(s,i)/n);const v=Math.floor(m);m=m===v?v-1:v;for(let A=0;A<m;A++){a=Math.ceil(f/2),o=Math.ceil(g/2);const _=new OffscreenCanvas(a,o);_.getContext("2d").drawImage(t,0,0,f,g,0,0,a,o),f=a,g=o,t!==e&&t.close(),t=_.transferToImageBitmap()}const w=Math.min(n/a,n/o);a=Math.round(a*w),o=Math.round(o*w)}const c=new OffscreenCanvas(a,o).getContext("2d",{willReadFrequently:!0});c.fillStyle="white",c.fillRect(0,0,a,o),c.filter="grayscale(1)",c.drawImage(t,0,0,t.width,t.height,0,0,a,o);const h=c.getImageData(0,0,a,o).data;return[b(this,St,_v).call(this,h),a,o]},y(br,St),y(br,fl,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),y(br,Di,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class ly extends ny{constructor(){super(),super.updateProperties({fill:Mt._defaultLineColor,"stroke-width":0})}clone(){const t=new ly;return t.updateAll(this),t}}class cy extends Og{constructor(t){super(t),super.updateProperties({stroke:Mt._defaultLineColor,"stroke-width":1})}clone(){const t=new cy(this._viewParameters);return t.updateAll(this),t}}var ga,gr,ma,pl;const Ts=class Ts extends vu{constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});y(this,ga,!1);y(this,gr,null);y(this,ma,null);y(this,pl,null);this._willKeepAspectRatio=!0,p(this,ma,e.signatureData||null),p(this,gr,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,s){Mt.initialize(e,s),this._defaultDrawingOptions=new ly,this._defaultDrawnSignatureOptions=new cy(s.viewParameters)}static getDefaultDrawingOptions(e){const s=this._defaultDrawingOptions.clone();return s.updateProperties(e),s}static get supportMultipleDrawings(){return!1}static get typesMap(){return V(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!r(this,gr)}}static computeTelemetryFinalData(e){const s=e.get("hasDescription");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,s;const{_isCopy:i}=this;if(i&&(this._isCopy=!1,e=this.x,s=this.y),super.render(),this._drawId===null)if(r(this,ma)){const{lines:n,mustSmooth:a,areContours:o,description:l,uuid:c,heightInPage:h}=r(this,ma),{rawDims:{pageWidth:d,pageHeight:f},rotation:g}=this.parent.viewport,m=br.processDrawnLines({lines:n,pageWidth:d,pageHeight:f,rotation:g,innerMargin:Ts._INNER_MARGIN,mustSmooth:a,areContours:o});this.addSignature(m,h,l,c)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:r(this,gr)||""}));return i&&(this._isCopy=!0,this._moveAfterPaste(e,s)),this.div}setUuid(e){p(this,pl,e),this.addEditToolbar()}getUuid(){return r(this,pl)}get description(){return r(this,gr)}set description(e){p(this,gr,e),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:e})),super.addEditToolbar().then(s=>{s==null||s.updateEditSignatureButton(e)}))}getSignaturePreview(){const{newCurves:e,areContours:s,thickness:i,width:n,height:a}=r(this,ma),o=Math.max(n,a),l=br.processDrawnLines({lines:{curves:e.map(c=>({points:c})),thickness:i,width:n,height:a},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:s});return{areContours:s,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,s,i,n){const{x:a,y:o}=this,{outline:l}=p(this,ma,e);p(this,ga,l instanceof bv),this.description=i;let c;r(this,ga)?c=Ts.getDefaultDrawingOptions():(c=Ts._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:c});const[,h]=this.pageDimensions;let d=s/h;d=d>=1?.5:d,this.width*=d/this.height,this.width>=1&&(d*=.9/this.width,this.width=.9),this.height=d,this.setDims(),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(n),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!n,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(e){const{rawDims:{pageWidth:s,pageHeight:i},rotation:n}=this.parent.viewport;return br.process(e,s,i,n,Ts._INNER_MARGIN)}getFromText(e,s){const{rawDims:{pageWidth:i,pageHeight:n},rotation:a}=this.parent.viewport;return br.extractContoursFromText(e,s,i,n,a,Ts._INNER_MARGIN)}getDrawnSignature(e){const{rawDims:{pageWidth:s,pageHeight:i},rotation:n}=this.parent.viewport;return br.processDrawnLines({lines:e,pageWidth:s,pageHeight:i,rotation:n,innerMargin:Ts._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:s}){e?this._drawingOptions=Ts.getDefaultDrawingOptions():(this._drawingOptions=Ts._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":s}))}serialize(e=!1){if(this.isEmpty())return null;const{lines:s,points:i}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":n}}=this,a=Object.assign(super.serialize(e),{isSignature:!0,areContours:r(this,ga),color:[0,0,0],thickness:r(this,ga)?0:n});return this.addComment(a),e?(a.paths={lines:s,points:i},a.uuid=r(this,pl),a.isCopy=!0):a.lines=s,r(this,gr)&&(a.accessibilityData={type:"Figure",alt:r(this,gr)}),a}static deserializeDraw(e,s,i,n,a,o){return o.areContours?bv.deserialize(e,s,i,n,a,o):mf.deserialize(e,s,i,n,a,o)}static async deserialize(e,s,i){var a;const n=await super.deserialize(e,s,i);return p(n,ga,e.areContours),n.description=((a=e.accessibilityData)==null?void 0:a.alt)||"",p(n,pl,e.uuid),n}};ga=new WeakMap,gr=new WeakMap,ma=new WeakMap,pl=new WeakMap,O(Ts,"_type","signature"),O(Ts,"_editorType",it.SIGNATURE),O(Ts,"_defaultDrawingOptions",null);let Ev=Ts;var Vt,Re,va,on,ya,dh,ln,gl,mr,js,fh,yt,eu,su,ap,op,lp,Tv,cp,s_;class xv extends Mt{constructor(e){super({...e,name:"stampEditor"});y(this,yt);y(this,Vt,null);y(this,Re,null);y(this,va,null);y(this,on,null);y(this,ya,null);y(this,dh,"");y(this,ln,null);y(this,gl,!1);y(this,mr,null);y(this,js,!1);y(this,fh,!1);p(this,on,e.bitmapUrl),p(this,ya,e.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,s){Mt.initialize(e,s)}static isHandlingMimeForPasting(e){return gp.has(e)}static paste(e,s){s.pasteEditor({mode:it.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var e;return{type:"stamp",hasAltText:!!((e=this.altTextData)!=null&&e.altText)}}static computeTelemetryFinalData(e){const s=e.get("hasAltText");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}async mlGuessAltText(e=null,s=!0){if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:n,width:a,height:o}=e||this.copyCanvas(null,null,!0).imageData,l=await i.guess({name:"altText",request:{data:n,width:a,height:o,channels:n.length/(a*o)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const c=l.output;return await this.setGuessedAltText(c),s&&!this.hasAltTextData()&&(this.altTextData={alt:c,decorative:!1}),c}remove(){var e;r(this,Re)&&(p(this,Vt,null),this._uiManager.imageManager.deleteId(r(this,Re)),(e=r(this,ln))==null||e.remove(),p(this,ln,null),r(this,mr)&&(clearTimeout(r(this,mr)),p(this,mr,null))),super.remove()}rebuild(){if(!this.parent){r(this,Re)&&b(this,yt,ap).call(this);return}super.rebuild(),this.div!==null&&(r(this,Re)&&r(this,ln)===null&&b(this,yt,ap).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(r(this,va)||r(this,Vt)||r(this,on)||r(this,ya)||r(this,Re)||r(this,gl))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,s;return this._isCopy&&(e=this.x,s=this.y),super.render(),this.div.hidden=!0,this.createAltText(),r(this,gl)||(r(this,Vt)?b(this,yt,op).call(this):b(this,yt,ap).call(this)),this._isCopy&&this._moveAfterPaste(e,s),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,s){const{id:i,bitmap:n}=this._uiManager.imageManager.getFromCanvas(e,s);s.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(p(this,Re,i),n&&p(this,Vt,n),p(this,gl,!1),b(this,yt,op).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;r(this,mr)!==null&&clearTimeout(r(this,mr)),p(this,mr,setTimeout(()=>{p(this,mr,null),b(this,yt,Tv).call(this)},200))}copyCanvas(e,s,i=!1){e||(e=224);const{width:n,height:a}=r(this,Vt),o=new Ws;let l=r(this,Vt),c=n,h=a,d=null;if(s){if(n>s||a>s){const C=Math.min(s/n,s/a);c=Math.floor(n*C),h=Math.floor(a*C)}d=document.createElement("canvas");const g=d.width=Math.ceil(c*o.sx),m=d.height=Math.ceil(h*o.sy);r(this,js)||(l=b(this,yt,lp).call(this,g,m));const v=d.getContext("2d");v.filter=this._uiManager.hcmFilter;let w="white",A="#cfcfd8";this._uiManager.hcmFilter!=="none"?A="black":yS.isDarkMode&&(w="#8f8f9d",A="#42414d");const _=15,E=_*o.sx,S=_*o.sy,x=new OffscreenCanvas(E*2,S*2),T=x.getContext("2d");T.fillStyle=w,T.fillRect(0,0,E*2,S*2),T.fillStyle=A,T.fillRect(0,0,E,S),T.fillRect(E,S,E,S),v.fillStyle=v.createPattern(x,"repeat"),v.fillRect(0,0,g,m),v.drawImage(l,0,0,l.width,l.height,0,0,g,m)}let f=null;if(i){let g,m;if(o.symmetric&&l.width<e&&l.height<e)g=l.width,m=l.height;else if(l=r(this,Vt),n>e||a>e){const A=Math.min(e/n,e/a);g=Math.floor(n*A),m=Math.floor(a*A),r(this,js)||(l=b(this,yt,lp).call(this,g,m))}const w=new OffscreenCanvas(g,m).getContext("2d",{willReadFrequently:!0});w.drawImage(l,0,0,l.width,l.height,0,0,g,m),f={width:g,height:m,data:w.getImageData(0,0,g,m).data}}return{canvas:d,width:c,height:h,imageData:f}}static async deserialize(e,s,i){var w;let n=null,a=!1;if(e instanceof _A){const{data:{rect:A,rotation:_,id:E,structParent:S,popupRef:x,richText:T,contentsObj:C,creationDate:I,modificationDate:k},container:M,parent:{page:{pageNumber:R}},canvas:N}=e;let F,$;N?(delete e.canvas,{id:F,bitmap:$}=i.imageManager.getFromCanvas(M.id,N),N.remove()):(a=!0,e._hasNoCanvas=!0);const U=((w=await s._structTree.getAriaAttributes(`${Ul}${E}`))==null?void 0:w.get("aria-label"))||"";n=e={annotationType:it.STAMP,bitmapId:F,bitmap:$,pageIndex:R-1,rect:A.slice(0),rotation:_,annotationElementId:E,id:E,deleted:!1,accessibilityData:{decorative:!1,altText:U},isSvg:!1,structParent:S,popupRef:x,richText:T,comment:(C==null?void 0:C.str)||null,creationDate:I,modificationDate:k}}const o=await super.deserialize(e,s,i),{rect:l,bitmap:c,bitmapUrl:h,bitmapId:d,isSvg:f,accessibilityData:g}=e;a?(i.addMissingCanvas(e.id,o),p(o,gl,!0)):d&&i.imageManager.isValidId(d)?(p(o,Re,d),c&&p(o,Vt,c)):p(o,on,h),p(o,js,f);const[m,v]=o.pageDimensions;return o.width=(l[2]-l[0])/m,o.height=(l[3]-l[1])/v,g&&(o.altTextData=g),o._initialData=n,e.comment&&o.setCommentData(e),p(o,fh,!!n),o}serialize(e=!1,s=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i=Object.assign(super.serialize(e),{bitmapId:r(this,Re),isSvg:r(this,js)});if(this.addComment(i),e)return i.bitmapUrl=b(this,yt,cp).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;const{decorative:n,altText:a}=this.serializeAltText(!1);if(!n&&a&&(i.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const l=b(this,yt,s_).call(this,i);return l.isSame?null:(l.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1,i.id=this.annotationElementId,delete i.bitmapId,i)}if(s===null)return i;s.stamps||(s.stamps=new Map);const o=r(this,js)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!s.stamps.has(r(this,Re)))s.stamps.set(r(this,Re),{area:o,serialized:i}),i.bitmap=b(this,yt,cp).call(this,!1);else if(r(this,js)){const l=s.stamps.get(r(this,Re));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=b(this,yt,cp).call(this,!1))}return i}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}Vt=new WeakMap,Re=new WeakMap,va=new WeakMap,on=new WeakMap,ya=new WeakMap,dh=new WeakMap,ln=new WeakMap,gl=new WeakMap,mr=new WeakMap,js=new WeakMap,fh=new WeakMap,yt=new WeakSet,eu=function(e,s=!1){if(!e){this.remove();return}p(this,Vt,e.bitmap),s||(p(this,Re,e.id),p(this,js,e.isSvg)),e.file&&p(this,dh,e.file.name),b(this,yt,op).call(this)},su=function(){if(p(this,va,null),this._uiManager.enableWaiting(!1),!!r(this,ln)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Vt)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Vt)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},ap=function(){if(r(this,Re)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(r(this,Re)).then(i=>b(this,yt,eu).call(this,i,!0)).finally(()=>b(this,yt,su).call(this));return}if(r(this,on)){const i=r(this,on);p(this,on,null),this._uiManager.enableWaiting(!0),p(this,va,this._uiManager.imageManager.getFromUrl(i).then(n=>b(this,yt,eu).call(this,n)).finally(()=>b(this,yt,su).call(this)));return}if(r(this,ya)){const i=r(this,ya);p(this,ya,null),this._uiManager.enableWaiting(!0),p(this,va,this._uiManager.imageManager.getFromFile(i).then(n=>b(this,yt,eu).call(this,n)).finally(()=>b(this,yt,su).call(this)));return}const e=document.createElement("input");e.type="file",e.accept=gp.keys().join(",");const s=this._uiManager._signal;p(this,va,new Promise(i=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const n=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),b(this,yt,eu).call(this,n)}i()},{signal:s}),e.addEventListener("cancel",()=>{this.remove(),i()},{signal:s})}).finally(()=>b(this,yt,su).call(this))),e.click()},op=function(){var c;const{div:e}=this;let{width:s,height:i}=r(this,Vt);const[n,a]=this.pageDimensions,o=.75;if(this.width)s=this.width*n,i=this.height*a;else if(s>o*n||i>o*a){const h=Math.min(o*n/s,o*a/i);s*=h,i*=h}this._uiManager.enableWaiting(!1);const l=p(this,ln,document.createElement("canvas"));l.setAttribute("role","img"),this.addContainer(l),this.width=s/n,this.height=i/a,this.setDims(),(c=this._initialOptions)!=null&&c.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),b(this,yt,Tv).call(this),r(this,fh)||(this.parent.addUndoableEditor(this),p(this,fh,!0)),this._reportTelemetry({action:"inserted_image"}),r(this,dh)&&this.div.setAttribute("aria-description",r(this,dh)),this.annotationElementId||this._uiManager.a11yAlert(Mt._l10nAlert.stamp)},lp=function(e,s){const{width:i,height:n}=r(this,Vt);let a=i,o=n,l=r(this,Vt);for(;a>2*e||o>2*s;){const c=a,h=o;a>2*e&&(a=Math.ceil(a/2)),o>2*s&&(o=Math.ceil(o/2));const d=new OffscreenCanvas(a,o);d.getContext("2d").drawImage(l,0,0,c,h,0,0,a,o),l=d.transferToImageBitmap()}return l},Tv=function(){const[e,s]=this.parentDimensions,{width:i,height:n}=this,a=new Ws,o=Math.ceil(i*e*a.sx),l=Math.ceil(n*s*a.sy),c=r(this,ln);if(!c||c.width===o&&c.height===l)return;c.width=o,c.height=l;const h=r(this,js)?r(this,Vt):b(this,yt,lp).call(this,o,l),d=c.getContext("2d");d.filter=this._uiManager.hcmFilter,d.drawImage(h,0,0,h.width,h.height,0,0,o,l)},cp=function(e){if(e){if(r(this,js)){const n=this._uiManager.imageManager.getSvgUrl(r(this,Re));if(n)return n}const s=document.createElement("canvas");return{width:s.width,height:s.height}=r(this,Vt),s.getContext("2d").drawImage(r(this,Vt),0,0),s.toDataURL()}if(r(this,js)){const[s,i]=this.pageDimensions,n=Math.round(this.width*s*vn.PDF_TO_CSS_UNITS),a=Math.round(this.height*i*vn.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(n,a);return o.getContext("2d").drawImage(r(this,Vt),0,0,r(this,Vt).width,r(this,Vt).height,0,0,n,a),o.transferToImageBitmap()}return structuredClone(r(this,Vt))},s_=function(e){var o;const{pageIndex:s,accessibilityData:{altText:i}}=this._initialData,n=e.pageIndex===s,a=(((o=e.accessibilityData)==null?void 0:o.alt)||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&n&&a,isSameAltText:a}},O(xv,"_type","stamp"),O(xv,"_editorType",it.STAMP);var ml,ph,ba,wa,cn,As,Aa,gh,mh,Fi,hn,_s,un,_a,vh,K,Sa,Rt,Cv,i_,zi,Pv,Iv,hp;const wi=class wi{constructor({uiManager:t,pageIndex:e,div:s,structTreeLayer:i,accessibilityManager:n,annotationLayer:a,drawLayer:o,textLayer:l,viewport:c,l10n:h}){y(this,Rt);y(this,ml);y(this,ph,!1);y(this,ba,null);y(this,wa,null);y(this,cn,null);y(this,As,new Map);y(this,Aa,!1);y(this,gh,!1);y(this,mh,!1);y(this,Fi,null);y(this,hn,null);y(this,_s,null);y(this,un,null);y(this,_a,null);y(this,vh,-1);y(this,K);const d=[...r(wi,Sa).values()];if(!wi._initialized){wi._initialized=!0;for(const f of d)f.initialize(h,t)}t.registerEditorTypes(d),p(this,K,t),this.pageIndex=e,this.div=s,p(this,ml,n),p(this,ba,a),this.viewport=c,p(this,_s,l),this.drawLayer=o,this._structTree=i,r(this,K).addLayer(this)}get isEmpty(){return r(this,As).size===0}get isInvisible(){return this.isEmpty&&r(this,K).getMode()===it.NONE}updateToolbar(t){r(this,K).updateToolbar(t)}updateMode(t=r(this,K).getMode()){switch(b(this,Rt,hp).call(this),t){case it.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case it.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case it.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===it.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(const s of r(wi,Sa).values())e.toggle(`${s._type}Editing`,t===s._editorType)}this.div.hidden=!1}hasTextLayer(t){var e;return t===((e=r(this,_s))==null?void 0:e.div)}setEditingState(t){r(this,K).setEditingState(t)}addCommands(t){r(this,K).addCommands(t)}cleanUndoStack(t){r(this,K).cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){var e;(e=r(this,ba))==null||e.togglePointerEvents(t)}async enable(){var s;p(this,mh,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),(s=r(this,_a))==null||s.abort(),p(this,_a,null);const t=new Set;for(const i of r(this,Rt,Cv))i.enableEditing(),i.show(!0),i.annotationElementId&&(r(this,K).removeChangedExistingAnnotation(i),t.add(i.annotationElementId));const e=r(this,ba);if(e)for(const i of e.getEditableAnnotations()){if(i.hide(),r(this,K).isDeletedAnnotationElement(i.data.id)||t.has(i.data.id))continue;const n=await this.deserialize(i);n&&(this.addOrRebuild(n),n.enableEditing())}p(this,mh,!1),r(this,K)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){var i;if(p(this,gh,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),r(this,_s)&&!r(this,_a)){p(this,_a,new AbortController);const n=r(this,K).combinedSignal(r(this,_a));r(this,_s).div.addEventListener("pointerdown",a=>{const{clientX:l,clientY:c,timeStamp:h}=a,d=r(this,vh);if(h-d>500){p(this,vh,h);return}p(this,vh,-1);const{classList:f}=this.div;f.toggle("getElements",!0);const g=document.elementsFromPoint(l,c);if(f.toggle("getElements",!1),!this.div.contains(g[0]))return;let m;const v=new RegExp(`^${wh}[0-9]+$`);for(const A of g)if(v.test(A.id)){m=A.id;break}if(!m)return;const w=r(this,As).get(m);(w==null?void 0:w.annotationElementId)===null&&(me(a),w.dblclick(a))},{signal:n,capture:!0})}const t=r(this,ba),e=[];if(t){const n=new Map,a=new Map;for(const o of r(this,Rt,Cv)){if(o.disableEditing(),!o.annotationElementId){e.push(o);continue}if(o.serialize()!==null){n.set(o.annotationElementId,o);continue}else a.set(o.annotationElementId,o);(i=this.getEditableAnnotation(o.annotationElementId))==null||i.show(),o.remove()}for(const o of t.getEditableAnnotations()){const{id:l}=o.data;if(r(this,K).isDeletedAnnotationElement(l)){o.updateEdited({deleted:!0});continue}let c=a.get(l);if(c){c.resetAnnotationElement(o),c.show(!1),o.show();continue}c=n.get(l),c&&(r(this,K).addChangedExistingAnnotation(c),c.renderAnnotationElement(o)&&c.show(!1)),o.show()}}b(this,Rt,hp).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of r(wi,Sa).values())s.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t==null||t.updateFakeAnnotations(e),p(this,gh,!1)}getEditableAnnotation(t){var e;return((e=r(this,ba))==null?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){r(this,K).getActive()!==t&&r(this,K).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(t=r(this,_s))!=null&&t.div&&!r(this,un)){p(this,un,new AbortController);const e=r(this,K).combinedSignal(r(this,un));r(this,_s).div.addEventListener("pointerdown",b(this,Rt,i_).bind(this),{signal:e}),r(this,_s).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(t=r(this,_s))!=null&&t.div&&r(this,un)&&(r(this,un).abort(),p(this,un,null),r(this,_s).div.classList.remove("highlighting"))}enableClick(){if(r(this,wa))return;p(this,wa,new AbortController);const t=r(this,K).combinedSignal(r(this,wa));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});const e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){var t;(t=r(this,wa))==null||t.abort(),p(this,wa,null)}attach(t){r(this,As).set(t.id,t);const{annotationElementId:e}=t;e&&r(this,K).isDeletedAnnotationElement(e)&&r(this,K).removeDeletedAnnotationElement(t)}detach(t){var e;r(this,As).delete(t.id),(e=r(this,ml))==null||e.removePointerInTextLayer(t.contentDiv),!r(this,gh)&&t.annotationElementId&&r(this,K).addDeletedAnnotationElement(t)}remove(t){this.detach(t),r(this,K).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(r(this,K).addDeletedAnnotationElement(t),Mt.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),(e=t.parent)==null||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),r(this,K).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!r(this,mh)),r(this,K).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var s;if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!r(this,cn)&&(t._focusEventsAllowed=!1,p(this,cn,setTimeout(()=>{p(this,cn,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:r(this,K)._signal}),e.focus())},0))),t._structTreeParentId=(s=r(this,ml))==null?void 0:s.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){const e=()=>t._uiManager.rebuild(t),s=()=>{t.remove()};this.addCommands({cmd:e,undo:s,mustExec:!1})}getEditorByUID(t){for(const e of r(this,As).values())if(e.uid===t)return e;return null}combinedSignal(t){return r(this,K).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return(t=r(this,Rt,zi))==null?void 0:t.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await r(this,K).updateMode(t.mode);const{offsetX:s,offsetY:i}=b(this,Rt,Iv).call(this),n=r(this,K).getId(),a=b(this,Rt,Pv).call(this,{parent:this,id:n,x:s,y:i,uiManager:r(this,K),isCentered:!0,...e});a&&this.add(a)}async deserialize(t){var e;return await((e=r(wi,Sa).get(t.annotationType??t.annotationEditorType))==null?void 0:e.deserialize(t,this,r(this,K)))||null}createAndAddNewEditor(t,e,s={}){const i=r(this,K).getId(),n=b(this,Rt,Pv).call(this,{parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:r(this,K),isCentered:e,...s});return n&&this.add(n),n}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(t={}){this.createAndAddNewEditor(b(this,Rt,Iv).call(this),!0,t)}setSelected(t){r(this,K).setSelected(t)}toggleSelected(t){r(this,K).toggleSelected(t)}unselect(t){r(this,K).unselect(t)}pointerup(t){var i;const{isMac:e}=_t.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!r(this,Aa)||(p(this,Aa,!1),(i=r(this,Rt,zi))!=null&&i.isDrawer&&r(this,Rt,zi).supportMultipleDrawings))return;if(!r(this,ph)){p(this,ph,!0);return}const s=r(this,K).getMode();if(s===it.STAMP||s===it.POPUP||s===it.SIGNATURE){r(this,K).unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){var i;if(r(this,K).getMode()===it.HIGHLIGHT&&this.enableTextSelection(),r(this,Aa)){p(this,Aa,!1);return}const{isMac:e}=_t.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(p(this,Aa,!0),(i=r(this,Rt,zi))!=null&&i.isDrawer){this.startDrawingSession(t);return}const s=r(this,K).getActive();p(this,ph,!s||s.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),r(this,Fi)){r(this,Rt,zi).startDrawing(this,r(this,K),!1,t);return}r(this,K).setCurrentDrawingSession(this),p(this,Fi,new AbortController);const e=r(this,K).combinedSignal(r(this,Fi));this.div.addEventListener("blur",({relatedTarget:s})=>{s&&!this.div.contains(s)&&(p(this,hn,null),this.commitOrRemove())},{signal:e}),r(this,Rt,zi).startDrawing(this,r(this,K),!1,t)}pause(t){if(t){const{activeElement:e}=document;this.div.contains(e)&&p(this,hn,e);return}r(this,hn)&&setTimeout(()=>{var e;(e=r(this,hn))==null||e.focus(),p(this,hn,null)},0)}endDrawingSession(t=!1){return r(this,Fi)?(r(this,K).setCurrentDrawingSession(null),r(this,Fi).abort(),p(this,Fi,null),p(this,hn,null),r(this,Rt,zi).endDrawing(t)):null}findNewParent(t,e,s){const i=r(this,K).findParent(e,s);return i===null||i===this?!1:(i.changeParent(t),!0)}commitOrRemove(){return r(this,Fi)?(this.endDrawingSession(),!0):!1}onScaleChanging(){r(this,Fi)&&r(this,Rt,zi).onScaleChangingWhenDrawing(this)}destroy(){var t,e;this.commitOrRemove(),((t=r(this,K).getActive())==null?void 0:t.parent)===this&&(r(this,K).commitOrRemove(),r(this,K).setActiveEditor(null)),r(this,cn)&&(clearTimeout(r(this,cn)),p(this,cn,null));for(const s of r(this,As).values())(e=r(this,ml))==null||e.removePointerInTextLayer(s.contentDiv),s.setParent(null),s.isAttachedToDOM=!1,s.div.remove();this.div=null,r(this,As).clear(),r(this,K).removeLayer(this)}async render({viewport:t}){this.viewport=t,Pa(this.div,t);for(const e of r(this,K).getEditors(this.pageIndex))this.add(e),e.rebuild();await r(this,K).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){r(this,K).commitOrRemove(),b(this,Rt,hp).call(this);const e=this.viewport.rotation,s=t.rotation;if(this.viewport=t,Pa(this.div,{rotation:s}),e!==s)for(const i of r(this,As).values())i.rotate(s)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return r(this,K).viewParameters.realScale}};ml=new WeakMap,ph=new WeakMap,ba=new WeakMap,wa=new WeakMap,cn=new WeakMap,As=new WeakMap,Aa=new WeakMap,gh=new WeakMap,mh=new WeakMap,Fi=new WeakMap,hn=new WeakMap,_s=new WeakMap,un=new WeakMap,_a=new WeakMap,vh=new WeakMap,K=new WeakMap,Sa=new WeakMap,Rt=new WeakSet,Cv=function(){return r(this,As).size!==0?r(this,As).values():r(this,K).getEditors(this.pageIndex)},i_=function(t){r(this,K).unselectAll();const{target:e}=t;if(e===r(this,_s).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent")||e.classList.contains("textLayerImages")||e.classList.contains("textLayerImagePlaceholder"))&&r(this,_s).div.contains(e)){const{isMac:s}=_t.platform;if(t.button!==0||t.ctrlKey&&s)return;r(this,K).showAllEditors("highlight",!0,!0),wp.startDrawing(this,r(this,K),r(this,K).direction==="ltr",t),t.preventDefault()}},zi=function(){return r(wi,Sa).get(r(this,K).getMode())},Pv=function(t){const e=r(this,Rt,zi);return e?new e.prototype.constructor(t):null},Iv=function(){const{x:t,y:e,width:s,height:i}=this.boundingClientRect,n=Math.max(0,t),a=Math.max(0,e),o=Math.min(window.innerWidth,t+s),l=Math.min(window.innerHeight,e+i),c=(n+o)/2-t,h=(a+l)/2-e,[d,f]=this.viewport.rotation%180===0?[c,h]:[h,c];return{offsetX:d,offsetY:f}},hp=function(){for(const t of r(this,As).values())t.isEmpty()&&t.remove()},O(wi,"_initialized",!1),y(wi,Sa,new Map([iv,yv,xv,wp,Ev].map(t=>[t._editorType,t])));let Ap=wi;B0();function nx(u,t){return u===t?0:u.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function xf(u){var t;return u?u.nodeType===Node.ELEMENT_NODE?u.closest(".textLayer"):((t=u.parentElement)==null?void 0:t.closest(".textLayer"))||null:null}function ax(u,t,e,s){if(u===e)return t<=s;const i=u.compareDocumentPosition(e);return i&Node.DOCUMENT_POSITION_FOLLOWING?!0:i&Node.DOCUMENT_POSITION_PRECEDING?!1:null}function Zy(u,t,e){if(u.nodeType!==Node.ELEMENT_NODE||!u.classList.contains("textLayer")||t!==u.childNodes.length)return{container:u,offset:t};let s=u.lastChild;return(s==null?void 0:s.nodeType)===Node.ELEMENT_NODE&&s.classList.contains("endOfContent")&&(s=s.previousSibling),!s||!e.contains(s)?null:s.nodeType===Node.TEXT_NODE?{container:s,offset:s.textContent.length}:{container:s,offset:s.childNodes.length}}var is,rs,di,sf,rf,vl,yl,nf,Jp,Ea,xa,Ta,Ca,dn,Ke,kv,Mv,r_,up,n_,Sr,Ov,a_,Rv;const J=class J{constructor({filterFactory:t=null,pageColors:e=null,pageIndex:s,textLayer:i=null}){y(this,Sr);y(this,is,null);y(this,rs,new Map);y(this,di,null);y(this,sf,null);y(this,rf,null);y(this,vl,null);y(this,yl,new Map);if(this.pageIndex=s,p(this,sf,t),p(this,rf,e),i){const n=r(J,dn).get(i);if(n!=null&&n.selectionDiv&&(n.selectionDiv.remove(),r(J,xa).delete(n.selectionDiv)),r(J,dn).set(i,{drawLayer:this}),r(J,Ca).add(i),p(this,di,i),p(this,vl,new MutationObserver(a=>{var o,l,c;if(!(!r(this,is)||!((o=r(this,di))!=null&&o.isConnected)||!b(l=J,Ke,Mv).call(l))){for(const{addedNodes:h}of a)for(const d of h)if(d.nodeType===Node.ELEMENT_NODE&&d.classList.contains("endOfContent")){b(c=J,Ke,up).call(c);return}}})),r(this,vl).observe(i,{childList:!0}),r(J,Ea)===null){p(J,Ea,new AbortController);const{signal:a}=r(J,Ea);document.addEventListener("selectionchange",b(J,Ke,up).bind(J),{signal:a}),document.addEventListener("pointerdown",()=>{p(J,Ta,!0)},{signal:a}),document.addEventListener("pointerup",()=>{p(J,Ta,!1)},{signal:a}),window.addEventListener("blur",()=>{p(J,Ta,!1)},{signal:a})}}}setParent(t){var e,s,i;if(!r(this,is)){p(this,is,t),(e=r(this,di))!=null&&e.isConnected&&b(s=J,Ke,Mv).call(s)&&b(i=J,Ke,up).call(i);return}if(r(this,is)!==t){if(r(this,rs).size>0)for(const n of r(this,rs).values())n.remove(),t.append(n);p(this,is,t)}}static get _svgFactory(){return V(this,"_svgFactory",new mu)}draw(t,e=!1,s=!1){const i=Ft(J,nf)._++,n=b(this,Sr,Ov).call(this),a=J._svgFactory.createElement("defs");n.append(a);const o=J._svgFactory.createElement("path");a.append(o);const l=`path_${i}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),e&&r(this,yl).set(i,o);const c=s?b(this,Sr,a_).call(this,a,l):null,h=J._svgFactory.createElement("use");return n.append(h),h.setAttribute("href",`#${l}`),this.updateProperties(n,t),r(this,rs).set(i,n),{id:i,clipPathId:`url(#${c})`}}drawOutline(t,e){const s=Ft(J,nf)._++,i=b(this,Sr,Ov).call(this),n=J._svgFactory.createElement("defs");i.append(n);const a=J._svgFactory.createElement("path");n.append(a);const o=`path_${s}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke");let l;if(e){const d=J._svgFactory.createElement("mask");n.append(d),l=`mask_${s}`,d.setAttribute("id",l),d.setAttribute("maskUnits","objectBoundingBox");const f=J._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const g=J._svgFactory.createElement("use");d.append(g),g.setAttribute("href",`#${o}`),g.setAttribute("stroke","none"),g.setAttribute("fill","black"),g.setAttribute("fill-rule","nonzero"),g.classList.add("mask")}const c=J._svgFactory.createElement("use");i.append(c),c.setAttribute("href",`#${o}`),l&&c.setAttribute("mask",`url(#${l})`);const h=c.cloneNode();return i.append(h),c.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.updateProperties(i,t),r(this,rs).set(s,i),s}finalizeDraw(t,e){r(this,yl).delete(t),this.updateProperties(t,e)}updateProperties(t,e){var l;if(!e)return;const{root:s,bbox:i,rootClass:n,path:a}=e,o=typeof t=="number"?r(this,rs).get(t):t;if(o){if(s&&b(this,Sr,Rv).call(this,o,s),i&&b(l=J,Ke,n_).call(l,o,i),n){const{classList:c}=o;for(const[h,d]of Object.entries(n))c.toggle(h,d)}if(a){const h=o.firstElementChild.firstElementChild;b(this,Sr,Rv).call(this,h,a)}}}updateParent(t,e){if(e===this)return;const s=r(this,rs).get(t);s&&(r(e,is).append(s),r(this,rs).delete(t),r(e,rs).set(t,s))}remove(t){r(this,yl).delete(t),r(this,is)!==null&&(r(this,rs).get(t).remove(),r(this,rs).delete(t))}destroy(){var t,e,s;p(this,is,null);for(const i of r(this,rs).values())i.remove();if(r(this,rs).clear(),r(this,yl).clear(),(t=r(this,vl))==null||t.disconnect(),p(this,vl,null),r(this,di)){const i=r(J,dn).get(r(this,di));(i==null?void 0:i.drawLayer)===this&&(b(e=J,Ke,kv).call(e,r(this,di)),r(J,dn).delete(r(this,di)),r(J,Ca).delete(r(this,di)),r(J,Ca).size===0&&((s=r(J,Ea))==null||s.abort(),p(J,Ea,null),p(J,Ta,!1))),p(this,di,null)}}};is=new WeakMap,rs=new WeakMap,di=new WeakMap,sf=new WeakMap,rf=new WeakMap,vl=new WeakMap,yl=new WeakMap,nf=new WeakMap,Jp=new WeakMap,Ea=new WeakMap,xa=new WeakMap,Ta=new WeakMap,Ca=new WeakMap,dn=new WeakMap,Ke=new WeakSet,kv=function(t){const e=r(this,dn).get(t);e!=null&&e.selectionDiv&&(e.selectionDiv.remove(),r(this,xa).delete(e.selectionDiv),e.selectionDiv=null,e.path=null)},Mv=function(){const t=document.getSelection();return!!t&&!t.isCollapsed},r_=function(){return r(this,Ca).keys().filter(t=>t.isConnected).toArray().sort(nx)},up=function(){var a;const t=document.getSelection();if(!t||t.isCollapsed){for(const o of r(this,xa))o.remove();r(this,xa).clear();return}const e=new WeakMap,s=b(this,Ke,r_).call(this),i=[];for(let o=0,l=t.rangeCount;o<l;o++){const c=t.getRangeAt(o);if(c.collapsed)continue;let{startContainer:h,startOffset:d,endContainer:f,endOffset:g}=c,m=xf(h),v=xf(f);const w=m===null,A=v===null;if(r(this,Ta)&&w!==A)return;if(t.rangeCount===1){const{anchorNode:S,anchorOffset:x,focusNode:T,focusOffset:C}=t,I=xf(S),k=xf(T),M=ax(S,x,T,C);I&&k&&M!==null&&(M?(h=S,d=x,m=I,f=T,g=C,v=k):(h=T,d=C,m=k,f=S,g=x,v=I))}const _=s.filter(S=>c.intersectsNode(S));if(_.length===0)continue;let E=!1;if(m||(m=_[0],h=m,d=0,E=!0),v||(v=_.at(-1),f=v,g=v.childNodes.length,E=!0),f.nodeType===Node.ELEMENT_NODE){if(f.classList.contains("endOfContent")){const S=f.previousSibling;if(!S)continue;f=S,g=S.nodeType===Node.TEXT_NODE?S.textContent.length:S.childNodes.length}else if(f.classList.contains("textLayer")&&f.childNodes.length===g){const S=Zy(f,g,v);if(!S)continue;f=S.container,g=S.offset}}if(h.nodeType===Node.ELEMENT_NODE){const S=Zy(h,d,m);if(!S)continue;h=S.container,d=S.offset}if(m===v&&!E&&_.includes(m)){i.push([c,m]);continue}for(const S of _){const x=S.firstChild;if(!x)continue;const T=document.createRange();if(S===m?T.setStart(h,d):T.setStartBefore(x),S===v)T.setEnd(f,g);else{const C=S.lastChild;if(!C)continue;if(C.nodeType===Node.ELEMENT_NODE&&C.classList.contains("endOfContent")){const I=C.previousSibling;if(!I)continue;T.setEndAfter(I)}else T.setEndAfter(C)}T.collapsed||i.push([T,S])}}const n=new Set(i.map(o=>o[1]));for(const o of r(this,Ca))n.has(o)||b(this,Ke,kv).call(this,o);for(const[o,l]of i){const c=r(J,dn).get(l);if(!c)continue;let h=e.get(l);if(!h){const v=l.getBoundingClientRect();h=(w,A,_,E)=>({x:(w-v.x)/v.width,y:(A-v.y)/v.height,width:_/v.width,height:E/v.height}),e.set(l,h)}const d=[];for(let{x:v,y:w,width:A,height:_}of o.getClientRects())A===0||_===0||({x:v,y:w,width:A,height:_}=h(v,w,A,_),!(A===1&&_===1)&&d.push(`M${v} ${w} h${A} v${_} h-${A} Z`));if(d.length===0)continue;const f=c.drawLayer;let g=c.selectionDiv,m=c.path;if(!g){const v=`clip_selection_${Ft(J,Jp)._++}`;g=document.createElement("div"),g.className="selection",g.style.clipPath=`url(#${v})`;const w=(a=r(f,sf))==null?void 0:a.createSelectionStyle(r(f,rf));if(w)for(const[E,S]of Object.entries(w))g.style.setProperty(E,S);const A=J._svgFactory.create(1,1,!0);A.setAttribute("aria-hidden","true"),A.setAttribute("width","100%"),A.setAttribute("height","100%");const _=J._svgFactory.createElement("clipPath");_.setAttribute("id",v),_.setAttribute("clipPathUnits","objectBoundingBox"),m=J._svgFactory.createElement("path"),_.append(m),A.append(_),g.append(A),c.path=m,c.selectionDiv=g}r(f,is)&&g.parentNode!==r(f,is)&&(r(f,is).append(g),r(this,xa).add(g)),m.setAttribute("d",d.join(" "))}},n_=function(t,[e,s,i,n]){const{style:a}=t;a.top=`${100*s}%`,a.left=`${100*e}%`,a.width=`${100*i}%`,a.height=`${100*n}%`},Sr=new WeakSet,Ov=function(){const t=J._svgFactory.create(1,1,!0);return r(this,is).append(t),t.setAttribute("aria-hidden","true"),t},a_=function(t,e){const s=J._svgFactory.createElement("clipPath");t.append(s);const i=`clip_${e}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=J._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),i},Rv=function(t,e){for(const[s,i]of Object.entries(e))i===null?t.removeAttribute(s):t.setAttribute(s,i)},y(J,Ke),y(J,nf,0),y(J,Jp,0),y(J,Ea,null),y(J,xa,new Set),y(J,Ta,!1),y(J,Ca,new Set),y(J,dn,new WeakMap);let _p=J;function Tf(u){return`${(u*100).toFixed(2)}%`}var yh,af,of,bh,vr,yr,lf,Qp,o_;const cu=class cu{constructor(t,e,s,i){y(this,Qp);y(this,yh,[]);y(this,af,new Map);y(this,of,null);y(this,bh,0);y(this,vr,0);y(this,yr,0);p(this,bh,t),p(this,yh,e),p(this,vr,s.rawDims.pageWidth),p(this,yr,s.rawDims.pageHeight),p(this,of,i)}render(){const t=document.createElement("div");t.className="textLayerImages";for(let e=0;e<r(this,yh).length;e+=6){const s=b(this,Qp,o_).call(this,r(this,yh).subarray(e,e+6));s&&t.append(s)}return t.addEventListener("contextmenu",e=>{var A;if(!(e.target instanceof HTMLCanvasElement))return;const s=e.target,i=r(this,af).get(s);if(!i)return;const n=(A=r(cu,lf))==null?void 0:A.deref();if(n===s)return;n&&(n.width=0,n.height=0),p(cu,lf,new WeakRef(s));const{inverseTransform:a,x1:o,y1:l,width:c,height:h}=i,d=r(this,of).call(this),f=Math.ceil(o*d.width),g=Math.ceil(l*d.height),m=Math.floor((o+c/r(this,vr))*d.width),v=Math.floor((l+h/r(this,yr))*d.height);s.width=m-f,s.height=v-g;const w=s.getContext("2d");w.setTransform(...a),w.translate(-f,-g),w.drawImage(d,0,0)}),t}};yh=new WeakMap,af=new WeakMap,of=new WeakMap,bh=new WeakMap,vr=new WeakMap,yr=new WeakMap,lf=new WeakMap,Qp=new WeakSet,o_=function([t,e,s,i,n,a]){const o=Math.hypot((n-t)*r(this,vr),(a-e)*r(this,yr)),l=Math.hypot((s-t)*r(this,vr),(i-e)*r(this,yr));if(o<r(this,bh)||l<r(this,bh))return null;const c=[(n-t)*r(this,vr)/o,(a-e)*r(this,yr)/o,(s-t)*r(this,vr)/l,(i-e)*r(this,yr)/l,0,0],h=j.inverseTransform(c),d=document.createElement("canvas");return d.className="textLayerImagePlaceholder",d.width=0,d.height=0,Object.assign(d.style,{opacity:0,position:"absolute",left:Tf(t),top:Tf(e),width:Tf(o/r(this,vr)),height:Tf(l/r(this,yr)),transformOrigin:"0% 0%",transform:`matrix(${c.join(",")})`}),r(this,af).set(d,{inverseTransform:h,width:o,height:l,x1:t,y1:e}),d},y(cu,lf,null);let Sp=cu;globalThis._pdfjsTestingUtils={HighlightOutliner:dv};globalThis.pdfjsLib={AbortException:mn,AnnotationEditorLayer:Ap,AnnotationEditorParamsType:dt,AnnotationEditorType:it,AnnotationEditorUIManager:Ia,AnnotationLayer:yp,AnnotationMode:fn,AnnotationType:$t,applyOpacity:Ub,build:uA,ColorPicker:gu,createValidAbsoluteUrl:Kv,CSSConstants:Bb,DOMSVGFactory:mu,DrawLayer:_p,FeatureTest:_t,fetchData:Ag,findContrastColor:Hb,getDocument:oA,getFilenameFromUrl:Lb,getPdfFilenameFromUrl:Nb,getRGB:Ph,getRGBA:Il,getUuid:Jv,GlobalWorkerOptions:Ni,ImageKind:iu,InvalidPDFException:fp,isDataScheme:gf,isPdfFile:Sg,isValidExplicitDest:Tw,makeArr:Pl,makeMap:bg,makeObj:pp,makeSet:Fb,MathClamp:Nt,noContextMenu:gi,normalizeUnicode:Db,OPS:Li,OutputScale:Ws,PasswordException:dp,PasswordResponses:Rb,PDFDataRangeTransport:sy,PDFDateString:du,PDFWorker:_h,PermissionFlag:Ob,PixelsPerInch:vn,RenderingCancelledException:_g,renderRichText:Qv,ResponseException:hu,setLayerDimensions:Pa,shadow:V,SignatureExtractor:br,stopEvent:me,SupportedImageMimeTypes:gp,TextLayer:Ah,TextLayerImages:Sp,TouchManager:Zv,updateUrlHash:qv,Util:j,VerbosityLevel:ff,version:hA,XfaLayer:wg};const ox=Object.freeze(Object.defineProperty({__proto__:null,AbortException:mn,AnnotationEditorLayer:Ap,AnnotationEditorParamsType:dt,AnnotationEditorType:it,AnnotationEditorUIManager:Ia,AnnotationLayer:yp,AnnotationMode:fn,AnnotationType:$t,CSSConstants:Bb,ColorPicker:gu,DOMSVGFactory:mu,DrawLayer:_p,FeatureTest:_t,GlobalWorkerOptions:Ni,ImageKind:iu,InvalidPDFException:fp,MathClamp:Nt,OPS:Li,OutputScale:Ws,PDFDataRangeTransport:sy,PDFDateString:du,PDFWorker:_h,PasswordException:dp,PasswordResponses:Rb,PermissionFlag:Ob,PixelsPerInch:vn,RenderingCancelledException:_g,ResponseException:hu,SignatureExtractor:br,SupportedImageMimeTypes:gp,TextLayer:Ah,TextLayerImages:Sp,TouchManager:Zv,Util:j,VerbosityLevel:ff,XfaLayer:wg,applyOpacity:Ub,build:uA,createValidAbsoluteUrl:Kv,fetchData:Ag,findContrastColor:Hb,getDocument:oA,getFilenameFromUrl:Lb,getPdfFilenameFromUrl:Nb,getRGB:Ph,getRGBA:Il,getUuid:Jv,isDataScheme:gf,isPdfFile:Sg,isValidExplicitDest:Tw,makeArr:Pl,makeMap:bg,makeObj:pp,makeSet:Fb,noContextMenu:gi,normalizeUnicode:Db,renderRichText:Qv,setLayerDimensions:Pa,shadow:V,stopEvent:me,updateUrlHash:qv,version:hA},Symbol.toStringTag,{value:"Module"}));let tb=!1;function cx(){return tb||(Ni.workerPort=new p_,tb=!0),ox}export{cx as getPdfjs};